Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps

This commit is contained in:
Subv
2012-08-30 19:16:09 -05:00
74 changed files with 476 additions and 464 deletions
@@ -0,0 +1 @@
ALTER TABLE `creature_template` ADD `unit_flags2` int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `unit_flags`;
@@ -0,0 +1,8 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (41054, 63418, 69893, 45205, 69896, 57594);
INSERT INTO `spell_script_names` VALUES
(41054, "spell_gen_clone_weapon_aura"),
(63418, "spell_gen_clone_weapon_aura"),
(69893, "spell_gen_clone_weapon_aura"),
(45205, "spell_gen_clone_weapon_aura"),
(69896, "spell_gen_clone_weapon_aura"),
(57594, "spell_gen_clone_weapon_aura");
+2 -2
View File
@@ -196,7 +196,7 @@ const AuthHandler table[] =
Patcher PatchesCache;
// Constructor - set the N and g values for SRP6
AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket)
AuthSocket::AuthSocket(RealmSocket& socket) : socket_(socket), pPatch(NULL)
{
N.SetHexStr("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7");
g.SetDword(7);
@@ -946,7 +946,7 @@ bool AuthSocket::_HandleXferResume()
{
sLog->outDebug(LOG_FILTER_AUTHSERVER, "Entering _HandleXferResume");
// Check packet length and patch existence
if (socket().recv_len() < 9 || !pPatch)
if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Error while resuming patch transfer (wrong packet)");
return false;
+2 -2
View File
@@ -124,8 +124,8 @@ namespace VMAP
return intersectionCallBack.result;
}
StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath):
iMapID(mapID), iTreeValues(0), iBasePath(basePath)
StaticMapTree::StaticMapTree(uint32 mapID, const std::string &basePath)
: iMapID(mapID), iTreeValues(0), iBasePath(basePath), iIsTiled(false)
{
if (iBasePath.length() > 0 && iBasePath[iBasePath.length()-1] != '/' && iBasePath[iBasePath.length()-1] != '\\')
{
+1 -4
View File
@@ -54,11 +54,8 @@ namespace VMAP
//=================================================================
TileAssembler::TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName)
: iSrcDir(pSrcDirName), iDestDir(pDestDirName), iCurrentUniqueNameId(0), iFilterMethod(NULL)
{
iCurrentUniqueNameId = 0;
iFilterMethod = NULL;
iSrcDir = pSrcDirName;
iDestDir = pDestDirName;
//mkdir(iDestDir);
//init();
}
+1 -1
View File
@@ -63,7 +63,7 @@ namespace VMAP
class ModelInstance: public ModelSpawn
{
public:
ModelInstance(): iModel(0) {}
ModelInstance(): iModel(0), iInvScale(0.0f) {}
ModelInstance(const ModelSpawn &spawn, WorldModel* model);
void setUnloaded() { iModel = 0; }
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const;
@@ -79,6 +79,7 @@ SmartScript::SmartScript()
{
go = NULL;
me = NULL;
trigger = NULL;
mEventPhase = 0;
mPathId = 0;
mTargetStorage = new ObjectListMap();
@@ -92,6 +93,7 @@ SmartScript::SmartScript()
meOrigGUID = 0;
goOrigGUID = 0;
mLastInvoker = 0;
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
}
SmartScript::~SmartScript()
@@ -1117,10 +1119,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
case SMART_ACTION_SUMMON_CREATURE:
{
float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
(*itr)->GetPosition(x, y, z, o);
@@ -1149,10 +1151,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!GetBaseObject())
break;
float x, y, z, o;
ObjectList* targets = GetTargets(e, unit);
if (targets)
{
float x, y, z, o;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (!IsUnit(*itr))
@@ -913,7 +913,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return true;
}
bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused
{
bool error = false;
uint32 entry = 0;
@@ -938,4 +938,4 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
return false;
}
return true;
}
}*/
@@ -1215,16 +1215,9 @@ enum SmartCastFlags
// one line in DB is one event
struct SmartScriptHolder
{
SmartScriptHolder()
{
timer = 0;
active = false;
runOnce = false;
link = 0;
entryOrGuid = 0;
event_id = 0;
enableTimed = false;
}
SmartScriptHolder() : timer(0), active(false), runOnce(false), link(0), entryOrGuid(0),
event_id(0), enableTimed(false), source_type(SMART_SCRIPT_TYPE_CREATURE) {}
int32 entryOrGuid;
SmartScriptType source_type;
uint32 event_id;
@@ -1436,7 +1429,7 @@ class SmartAIMgr
return true;
}
bool IsTextValid(SmartScriptHolder const& e, uint32 id);
//bool IsTextValid(SmartScriptHolder const& e, uint32 id);
};
#define sSmartScriptMgr ACE_Singleton<SmartAIMgr, ACE_Null_Mutex>::instance()
+1 -7
View File
@@ -25,13 +25,7 @@
struct AddonInfo
{
AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey)
{
Name = name;
Enabled = enabled;
CRC = crc;
State = state;
UsePublicKeyOrCRC = crcOrPubKey;
}
: Name(name), Enabled(enabled), CRC(crc), State(state), UsePublicKeyOrCRC(crcOrPubKey) {}
std::string Name;
uint8 Enabled;
+4 -3
View File
@@ -155,13 +155,13 @@ bool Battlefield::Update(uint32 diff)
if (m_uiKickDontAcceptTimer <= diff)
{
for (int team = 0; team < 2; team++)
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
if ((*itr).second <= time(NULL))
KickPlayerFromBattlefield((*itr).first);
InvitePlayersInZoneToWar();
for (int team = 0; team < 2; team++)
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); ++itr)
if ((*itr).second <= time(NULL))
KickPlayerFromBattlefield((*itr).first);
@@ -862,7 +862,8 @@ BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_
{
m_team = TEAM_NEUTRAL;
m_value = 0;
m_maxValue = 0;
m_minValue = 0.0f;
m_maxValue = 0.0f;
m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
m_capturePointEntry = 0;
@@ -1084,10 +1084,12 @@ WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, Tea
{
m_Bf = battlefield;
m_team = teamInControl;
m_Workshop = NULL;
}
void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
{
ASSERT(m_Workshop);
m_Workshop->GiveControlTo(m_team, false);
}
+3 -10
View File
@@ -24,16 +24,9 @@
#include "ArenaTeamMgr.h"
ArenaTeam::ArenaTeam()
: TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0),
BorderStyle(0), BorderColor(0)
{
TeamId = 0;
Type = 0;
TeamName = "";
CaptainGuid = 0;
BackgroundColor = 0;
EmblemStyle = 0;
EmblemColor = 0;
BorderStyle = 0;
BorderColor = 0;
Stats.WeekGames = 0;
Stats.SeasonGames = 0;
Stats.Rank = 0;
@@ -343,7 +336,7 @@ void ArenaTeam::Disband(WorldSession* session)
// Broadcast update
if (session)
{
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName().c_str(), GetName(), "");
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
if (Player* player = session->GetPlayer())
sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+3 -3
View File
@@ -47,8 +47,8 @@ class ChatHandler
{
public:
WorldSession* GetSession() { return m_session; }
explicit ChatHandler(WorldSession* session) : m_session(session) {}
explicit ChatHandler(Player* player) : m_session(player->GetSession()) {}
explicit ChatHandler(WorldSession* session) : m_session(session), sentErrorMessage(false) {}
explicit ChatHandler(Player* player) : m_session(player->GetSession()), sentErrorMessage(false) {}
virtual ~ChatHandler() {}
static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit* speaker);
@@ -126,7 +126,7 @@ class ChatHandler
bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
protected:
explicit ChatHandler() : m_session(NULL) {} // for CLI subclass
explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
+2 -2
View File
@@ -123,8 +123,8 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent
private:
ThreatContainer* iThreatContainer;
public:
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {}
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {}
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(NULL) {}
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(NULL) {}
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
@@ -867,7 +867,6 @@ void ConditionMgr::LoadConditions(bool isReload)
valid = true;
++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting
break;
}
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
valid = addToSpellImplicitTargetConditions(cond);
+2 -2
View File
@@ -26,8 +26,7 @@
#include "GossipDef.h"
#include "World.h"
Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
, m_type(type)
Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
{
m_objectType |= TYPEMASK_CORPSE;
m_objectTypeId = TYPEID_CORPSE;
@@ -39,6 +38,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
m_time = time(NULL);
lootForBody = false;
lootRecipient = NULL;
}
Corpse::~Corpse()
@@ -380,6 +380,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
SetAttackTime(RANGED_ATTACK, cInfo->rangeattacktime);
SetUInt32Value(UNIT_FIELD_FLAGS, unit_flags);
SetUInt32Value(UNIT_FIELD_FLAGS_2, cInfo->unit_flags2);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, dynamicflags);
@@ -111,6 +111,7 @@ struct CreatureTemplate
uint32 rangeattacktime;
uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
uint32 unit_flags; // enum UnitFlags mask values
uint32 unit_flags2; // enum UnitFlags2 mask values
uint32 dynamicflags;
uint32 family; // enum CreatureFamily values (optional)
uint32 trainer_type;
@@ -1418,7 +1418,8 @@ void GameObject::Use(Unit* user)
// full amount unique participants including original summoner
if (GetUniqueUseCount() == info->summoningRitual.reqParticipants)
{
spellCaster = m_ritualOwner ? m_ritualOwner : spellCaster;
if (m_ritualOwner)
spellCaster = m_ritualOwner;
spellId = info->summoningRitual.spellId;
+1 -1
View File
@@ -1019,7 +1019,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
if (count > pProto->GetMaxStackSize())
count = pProto->GetMaxStackSize();
ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already");
ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
Item* pItem = NewItemOrBag(pProto);
if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player))
+1 -1
View File
@@ -1764,10 +1764,10 @@ bool WorldObject::canSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
return true;
bool corpseCheck = false;
bool corpseVisibility = false;
if (distanceCheck)
{
bool corpseCheck = false;
if (Player const* thisPlayer = ToPlayer())
{
if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 && // Cheap way to check for ghost state
+11 -14
View File
@@ -7262,8 +7262,6 @@ void Player::SetArenaPoints(uint32 value)
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
PreparedStatement* stmt = NULL;
int32 newValue = int32(GetHonorPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7271,7 +7269,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_HONOR_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -7280,8 +7278,6 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
{
PreparedStatement* stmt = NULL;
int32 newValue = int32(GetArenaPoints()) + value;
if (newValue < 0)
newValue = 0;
@@ -7289,7 +7285,7 @@ void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/)
if (trans && !trans->null())
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_ARENA_POINTS);
stmt->setUInt32(0, newValue);
stmt->setUInt32(1, GetGUIDLow());
(*trans)->Append(stmt);
@@ -15681,7 +15677,6 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
{
uint32 srcItemId = quest->GetSrcItemId();
ItemTemplate const* item = sObjectMgr->GetItemTemplate(srcItemId);
bool destroyItem = true;
if (srcItemId > 0)
{
@@ -15701,6 +15696,7 @@ bool Player::TakeQuestSourceItem(uint32 questId, bool msg)
return false;
}
bool destroyItem = true;
for (uint8 n = 0; n < QUEST_ITEM_OBJECTIVES_COUNT; ++n)
if (item->StartQuest == questId && srcItemId == quest->RequiredItemId[n])
destroyItem = false;
@@ -17119,7 +17115,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt64Value(PLAYER_FARSIGHT, 0);
SetCreatorGUID(0);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
// reset some aura modifiers before aura apply
SetUInt32Value(PLAYER_TRACK_CREATURES, 0);
@@ -17516,8 +17512,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
uint32 zoneId = GetZoneId();
std::map<uint64, Bag*> bagMap; // fast guid lookup for bags
std::map<uint64, Item*> invalidBagMap; // fast guid lookup for bags
std::map<uint32, Bag*> bagMap; // fast guid lookup for bags
std::map<uint32, Item*> invalidBagMap; // fast guid lookup for bags
std::list<Item*> problematicItems;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -17576,7 +17572,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
{
item->SetSlot(NULL_SLOT);
// Item is in the bag, find the bag
std::map<uint64, Bag*>::iterator itr = bagMap.find(bagGuid);
std::map<uint32, Bag*>::iterator itr = bagMap.find(bagGuid);
if (itr != bagMap.end())
{
ItemPosCountVec dest;
@@ -17586,8 +17582,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
std::map<uint64, Item*>::iterator itr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(),problematicItems.end(),itr->second) != problematicItems.end())
std::map<uint32, Item*>::iterator itr = invalidBagMap.find(bagGuid);
if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
err = EQUIP_ERR_INT_BAG_ERROR;
}
else
@@ -17637,7 +17633,6 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields)
{
PreparedStatement* stmt = NULL;
Item* item = NULL;
uint32 itemGuid = fields[13].GetUInt32();
uint32 itemEntry = fields[14].GetUInt32();
@@ -17647,6 +17642,8 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
item = NewItemOrBag(proto);
if (item->LoadFromDB(itemGuid, GetGUID(), fields, itemEntry))
{
PreparedStatement* stmt = NULL;
// Do not allow to have item limited to another map/zone in alive state
if (isAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId))
{
+1 -1
View File
@@ -114,7 +114,7 @@ struct PlayerTalent
// Spell modifier (used for modify other spells)
struct SpellModifier
{
SpellModifier(Aura* _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {}
SpellModifier(Aura* _ownerAura = NULL) : op(SPELLMOD_DAMAGE), type(SPELLMOD_FLAT), charges(0), value(0), mask(), spellId(0), ownerAura(_ownerAura) {}
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
+2 -14
View File
@@ -54,24 +54,12 @@ struct FriendInfo
uint8 Class;
std::string Note;
FriendInfo()
FriendInfo() : Status(FRIEND_STATUS_OFFLINE), Flags(0), Area(0), Level(0), Class(0), Note()
{
Status = FRIEND_STATUS_OFFLINE;
Flags = 0;
Area = 0;
Level = 0;
Class = 0;
Note = "";
}
FriendInfo(uint8 flags, const std::string& note)
FriendInfo(uint8 flags, const std::string& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note)
{
Status = FRIEND_STATUS_OFFLINE;
Flags = flags;
Area = 0;
Level = 0;
Class = 0;
Note = note;
}
};
+3 -2
View File
@@ -159,7 +159,7 @@ m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(fa
m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL),
i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(this),
m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE),
m_HostileRefManager(this)
m_HostileRefManager(this), m_TempSpeed(0.0f), m_AutoRepeatFirstCast(false)
{
#ifdef _MSC_VER
#pragma warning(default:4355)
@@ -13903,7 +13903,8 @@ void Unit::DeleteCharmInfo()
CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_petnumber(0), m_barInit(false),
m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false)
m_isCommandAttack(false), m_isAtStay(false), m_isFollowing(false), m_isReturning(false),
m_stayX(0.0f), m_stayY(0.0f), m_stayZ(0.0f)
{
for (uint8 i = 0; i < MAX_SPELL_CHARM; ++i)
m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
+18 -11
View File
@@ -619,17 +619,24 @@ enum UnitFlags
// Value masks for UNIT_FIELD_FLAGS_2
enum UnitFlags2
{
UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
UNIT_FLAG2_FORCE_MOVE = 0x00000040,
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
UNIT_FLAG2_FEIGN_DEATH = 0x00000001,
UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip)
UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004,
UNIT_FLAG2_COMPREHEND_LANG = 0x00000008,
UNIT_FLAG2_MIRROR_IMAGE = 0x00000010,
UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in)
UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040,
UNIT_FLAG2_DISARM_OFFHAND = 0x00000080,
UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames)
UNIT_FLAG2_DISARM_RANGED = 0x00000400, // this does not disable ranged weapon display (maybe additional flag needed?)
UNIT_FLAG2_REGENERATE_POWER = 0x00000800,
UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid
UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick
UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000,
UNIT_FLAG2_DISABLE_TURN = 0x00008000,
UNIT_FLAG2_UNK2 = 0x00010000,
UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death
UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL
};
/// Non Player Character flags
+43 -44
View File
@@ -369,17 +369,17 @@ void ObjectMgr::LoadCreatureTemplates()
QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, "
// 9 10 11 12 13 14 15 16 17 18 19 20 21
"modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, "
// 22 23 24 25 26 27 28 29 30 31 32
"scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, "
// 33 34 35 36 37 38 39 40 41 42
// 22 23 24 25 26 27 28 29 30 31 32 33
"scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, "
// 34 35 36 37 38 39 40 41 42 43
"dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, "
// 43 44 45 46 47 48 49 50 51 52 53
// 44 45 46 47 48 49 50 51 52 53 54
"type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, "
// 54 55 56 57 58 59 60 61 62 63 64 65 66
// 55 56 57 58 59 60 61 62 63 64 65 66 67
"spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, "
// 67 68 69 70 71 72 73 74 75 76 77
// 68 69 70 71 72 73 74 75 76 77 78
"InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, "
// 78 79 80 81 82 83
// 79 80 81 82 83 84
" questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName "
"FROM creature_template;");
@@ -435,49 +435,50 @@ void ObjectMgr::LoadCreatureTemplates()
creatureTemplate.rangeattacktime = fields[30].GetUInt32();
creatureTemplate.unit_class = uint32(fields[31].GetUInt8());
creatureTemplate.unit_flags = fields[32].GetUInt32();
creatureTemplate.dynamicflags = fields[33].GetUInt32();
creatureTemplate.family = uint32(fields[34].GetUInt8());
creatureTemplate.trainer_type = uint32(fields[35].GetUInt8());
creatureTemplate.trainer_spell = fields[36].GetUInt32();
creatureTemplate.trainer_class = uint32(fields[37].GetUInt8());
creatureTemplate.trainer_race = uint32(fields[38].GetUInt8());
creatureTemplate.minrangedmg = fields[39].GetFloat();
creatureTemplate.maxrangedmg = fields[40].GetFloat();
creatureTemplate.rangedattackpower = uint32(fields[41].GetUInt16());
creatureTemplate.type = uint32(fields[42].GetUInt8());
creatureTemplate.type_flags = fields[43].GetUInt32();
creatureTemplate.lootid = fields[44].GetUInt32();
creatureTemplate.pickpocketLootId = fields[45].GetUInt32();
creatureTemplate.SkinLootId = fields[46].GetUInt32();
creatureTemplate.unit_flags2 = fields[33].GetUInt32();
creatureTemplate.dynamicflags = fields[34].GetUInt32();
creatureTemplate.family = uint32(fields[35].GetUInt8());
creatureTemplate.trainer_type = uint32(fields[36].GetUInt8());
creatureTemplate.trainer_spell = fields[37].GetUInt32();
creatureTemplate.trainer_class = uint32(fields[38].GetUInt8());
creatureTemplate.trainer_race = uint32(fields[39].GetUInt8());
creatureTemplate.minrangedmg = fields[40].GetFloat();
creatureTemplate.maxrangedmg = fields[41].GetFloat();
creatureTemplate.rangedattackpower = uint32(fields[42].GetUInt16());
creatureTemplate.type = uint32(fields[43].GetUInt8());
creatureTemplate.type_flags = fields[44].GetUInt32();
creatureTemplate.lootid = fields[45].GetUInt32();
creatureTemplate.pickpocketLootId = fields[46].GetUInt32();
creatureTemplate.SkinLootId = fields[47].GetUInt32();
for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16();
creatureTemplate.resistance[i] = fields[48 + i -1].GetInt16();
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
creatureTemplate.spells[i] = fields[53 + i].GetUInt32();
creatureTemplate.spells[i] = fields[54 + i].GetUInt32();
creatureTemplate.PetSpellDataId = fields[61].GetUInt32();
creatureTemplate.VehicleId = fields[62].GetUInt32();
creatureTemplate.mingold = fields[63].GetUInt32();
creatureTemplate.maxgold = fields[64].GetUInt32();
creatureTemplate.AIName = fields[65].GetString();
creatureTemplate.MovementType = uint32(fields[66].GetUInt8());
creatureTemplate.InhabitType = uint32(fields[67].GetUInt8());
creatureTemplate.HoverHeight = fields[68].GetFloat();
creatureTemplate.ModHealth = fields[69].GetFloat();
creatureTemplate.ModMana = fields[70].GetFloat();
creatureTemplate.ModArmor = fields[71].GetFloat();
creatureTemplate.RacialLeader = fields[72].GetBool();
creatureTemplate.PetSpellDataId = fields[62].GetUInt32();
creatureTemplate.VehicleId = fields[63].GetUInt32();
creatureTemplate.mingold = fields[64].GetUInt32();
creatureTemplate.maxgold = fields[65].GetUInt32();
creatureTemplate.AIName = fields[66].GetString();
creatureTemplate.MovementType = uint32(fields[67].GetUInt8());
creatureTemplate.InhabitType = uint32(fields[68].GetUInt8());
creatureTemplate.HoverHeight = fields[69].GetFloat();
creatureTemplate.ModHealth = fields[70].GetFloat();
creatureTemplate.ModMana = fields[71].GetFloat();
creatureTemplate.ModArmor = fields[72].GetFloat();
creatureTemplate.RacialLeader = fields[73].GetBool();
for (uint8 i = 0; i < MAX_CREATURE_QUEST_ITEMS; ++i)
creatureTemplate.questItems[i] = fields[73 + i].GetUInt32();
creatureTemplate.questItems[i] = fields[74 + i].GetUInt32();
creatureTemplate.movementId = fields[79].GetUInt32();
creatureTemplate.RegenHealth = fields[80].GetBool();
creatureTemplate.equipmentId = fields[81].GetUInt32();
creatureTemplate.MechanicImmuneMask = fields[82].GetUInt32();
creatureTemplate.flags_extra = fields[83].GetUInt32();
creatureTemplate.ScriptID = GetScriptId(fields[84].GetCString());
creatureTemplate.movementId = fields[80].GetUInt32();
creatureTemplate.RegenHealth = fields[81].GetBool();
creatureTemplate.equipmentId = fields[82].GetUInt32();
creatureTemplate.MechanicImmuneMask = fields[83].GetUInt32();
creatureTemplate.flags_extra = fields[84].GetUInt32();
creatureTemplate.ScriptID = GetScriptId(fields[85].GetCString());
++count;
}
@@ -7901,8 +7902,6 @@ void ObjectMgr::LoadTrainerSpell()
// For reload case
_cacheTrainerSpellStore.clear();
std::set<uint32> skip_trainers;
QueryResult result = WorldDatabase.Query("SELECT b.entry, a.spell, a.spellcost, a.reqskill, a.reqskillvalue, a.reqlevel FROM npc_trainer AS a "
"INNER JOIN npc_trainer AS b ON a.entry = -(b.spell) "
"UNION SELECT * FROM npc_trainer WHERE spell > 0");
+1 -2
View File
@@ -79,9 +79,8 @@ class NGrid
public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> GridType;
NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true)
: i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false)
: i_gridId(id), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false), i_GridInfo(GridInfo(expiry, unload))
{
i_GridInfo = GridInfo(expiry, unload);
}
GridType& GetGridType(const uint32 x, const uint32 y)
+21 -20
View File
@@ -37,26 +37,6 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint32 CurrentPosition;
uint32 TempValue;
unsigned char tdata[256] =
{
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
};
// broken addon packet, can't be received from real client
if (Source->rpos() + 4 > Source->size())
return false;
@@ -110,7 +90,28 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target)
uint8 unk = (crc != 0x4c1c776d); // If addon is Standard addon CRC
*Target << uint8(unk);
if (unk)
{
unsigned char tdata[256] =
{
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
0xFF, 0x31, 0xFE, 0x2F, 0x64, 0x3F, 0x3D, 0x6D, 0x07, 0xD9, 0x44, 0x9B, 0x40, 0x85, 0x59, 0x34,
0x4E, 0x10, 0xE1, 0xE7, 0x43, 0x69, 0xEF, 0x7C, 0x16, 0xFC, 0xB4, 0xED, 0x1B, 0x95, 0x28, 0xA8,
0x23, 0x76, 0x51, 0x31, 0x57, 0x30, 0x2B, 0x79, 0x08, 0x50, 0x10, 0x1C, 0x4A, 0x1A, 0x2C, 0xC8,
0x8B, 0x8F, 0x05, 0x2D, 0x22, 0x3D, 0xDB, 0x5A, 0x24, 0x7A, 0x0F, 0x13, 0x50, 0x37, 0x8F, 0x5A,
0xCC, 0x9E, 0x04, 0x44, 0x0E, 0x87, 0x01, 0xD4, 0xA3, 0x15, 0x94, 0x16, 0x34, 0xC6, 0xC2, 0xC3,
0xFB, 0x49, 0xFE, 0xE1, 0xF9, 0xDA, 0x8C, 0x50, 0x3C, 0xBE, 0x2C, 0xBB, 0x57, 0xED, 0x46, 0xB9,
0xAD, 0x8B, 0xC6, 0xDF, 0x0E, 0xD6, 0x0F, 0xBE, 0x80, 0xB3, 0x8B, 0x1E, 0x77, 0xCF, 0xAD, 0x22,
0xCF, 0xB7, 0x4B, 0xCF, 0xFB, 0xF0, 0x6B, 0x11, 0x45, 0x2D, 0x7A, 0x81, 0x18, 0xF2, 0x92, 0x7E,
0x98, 0x56, 0x5D, 0x5E, 0x69, 0x72, 0x0A, 0x0D, 0x03, 0x0A, 0x85, 0xA2, 0x85, 0x9C, 0xCB, 0xFB,
0x56, 0x6E, 0x8F, 0x44, 0xBB, 0x8F, 0x02, 0x22, 0x68, 0x63, 0x97, 0xBC, 0x85, 0xBA, 0xA8, 0xF7,
0xB5, 0x40, 0x68, 0x3C, 0x77, 0x86, 0x6F, 0x4B, 0xD7, 0x88, 0xCA, 0x8A, 0xD7, 0xCE, 0x36, 0xF0,
0x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
};
Target->append(tdata, sizeof(tdata));
}
*Target << uint32(0);
}
+1 -1
View File
@@ -2706,7 +2706,7 @@ uint32 InstanceMap::GetMaxResetDelay() const
/* ******* Battleground Instance Maps ******* */
BattlegroundMap::BattlegroundMap(uint32 id, time_t expiry, uint32 InstanceId, Map* _parent, uint8 spawnMode)
: Map(id, expiry, InstanceId, spawnMode, _parent)
: Map(id, expiry, InstanceId, spawnMode, _parent), m_bg(NULL)
{
//lets initialize visibility distance for BG/Arenas
BattlegroundMap::InitVisibilityDistance();
@@ -201,10 +201,6 @@ bool TimedFleeingMovementGenerator::Update(Unit* owner, const uint32& time_diff)
return true;
}
i_totalFleeTime.Update(time_diff);
if (i_totalFleeTime.Passed())
return false;
i_totalFleeTime.Update(time_diff);
if (i_totalFleeTime.Passed())
return false;
+2 -2
View File
@@ -29,8 +29,8 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp):
m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0), m_maxSpeed(0),
OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp) :
m_capturePointGUID(0), m_capturePoint(NULL), m_minValue(0.0f), m_maxValue(0.0f), m_maxSpeed(0),
m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL),
m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp)
{
+1 -1
View File
@@ -65,7 +65,7 @@ class ReputationMgr
{
public: // constructors and global modifiers
explicit ReputationMgr(Player* owner) : _player(owner),
_visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0) {}
_visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0), _sendFactionIncreased(false) {}
~ReputationMgr() {}
void SaveToDB(SQLTransaction& trans);
+1 -1
View File
@@ -1390,7 +1390,7 @@ inline std::string GetOpcodeNameForLogging(uint16 opcode)
{
std::ostringstream ss;
ss << '[' << LookupOpcodeName(opcode) << " 0x" << std::hex << std::uppercase << opcode << std::nouppercase << " (" << std::dec << opcode << ")]";
return ss.str().c_str();
return ss.str();
}
#endif
@@ -2958,13 +2958,13 @@ void AuraEffect::HandleForceMoveForward(AuraApplication const* aurApp, uint8 mod
Unit* target = aurApp->GetTarget();
if (apply)
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
else
{
// do not remove unit flag if there are more than this auraEffect of that kind on unit on unit
if (target->HasAuraType(GetAuraType()))
return;
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVEMENT);
}
}
+1 -2
View File
@@ -87,7 +87,7 @@ SpellDestination::SpellDestination(WorldObject const& wObj)
}
SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0), m_strTarget()
{
m_objectTarget = NULL;
m_itemTarget = NULL;
@@ -96,7 +96,6 @@ SpellCastTargets::SpellCastTargets() : m_elevation(0), m_speed(0)
m_itemTargetGUID = 0;
m_itemTargetEntry = 0;
m_strTarget = "";
m_targetMask = 0;
}
+1 -2
View File
@@ -312,10 +312,9 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
return;
bool apply_direct_bonus = true;
if (unitTarget && unitTarget->isAlive())
{
bool apply_direct_bonus = true;
switch (m_spellInfo->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
+1 -1
View File
@@ -441,7 +441,7 @@ class PetAura
typedef UNORDERED_MAP<uint32, uint32> PetAuraMap;
public:
PetAura()
PetAura() : removeOnChangePet(false), damage(0)
{
auras.clear();
}
+2 -11
View File
@@ -642,19 +642,13 @@ public:
{
handler->PSendSysMessage("|cff00ff00DEBUG: wp modify del, PathID: |r|cff00ffff%u|r", pathid);
// wpCreature
Creature* wpCreature = NULL;
if (wpGuid != 0)
{
wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
if (wpCreature)
if (Creature* wpCreature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
wpCreature->AddObjectToRemoveList();
}
}
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_WAYPOINT_DATA);
@@ -681,15 +675,12 @@ public:
Player* chr = handler->GetSession()->GetPlayer();
Map* map = chr->GetMap();
{
// wpCreature
Creature* wpCreature = NULL;
// What to do:
// Move the visual spawnpoint
// Respawn the owner of the waypoints
if (wpGuid != 0)
{
wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT));
if (wpCreature)
if (Creature* wpCreature = map->GetCreature(MAKE_NEW_GUID(wpGuid, VISUAL_WAYPOINT, HIGHGUID_UNIT)))
{
wpCreature->CombatStop();
wpCreature->DeleteFromDB();
@@ -243,11 +243,9 @@ public:
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* unit;
if ((*i) && (*i)->getSource())
{
unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit)
if (Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
//Cast affliction
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
@@ -201,12 +201,11 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Creature::GetCreature((*me), AddGUID[i]);
if (Temp && Temp->isAlive())
Temp->DisappearAndDie();
Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
if (temp && temp->isAlive())
temp->DisappearAndDie();
}
}
}
@@ -215,14 +214,13 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Creature::GetCreature((*me), AddGUID[i]);
if (Temp && Temp->isAlive())
Creature* temp = Creature::GetCreature((*me), AddGUID[i]);
if (temp && temp->isAlive())
{
Temp->AI()->AttackStart(me->getVictim());
DoZoneInCombat(Temp);
temp->AI()->AttackStart(me->getVictim());
DoZoneInCombat(temp);
} else
EnterEvadeMode();
}
@@ -250,13 +248,12 @@ public:
{
for (uint8 i = 0; i < 4; ++i)
{
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Unit::GetCreature((*me), AddGUID[i]);
if (Temp && Temp->isAlive())
if (!Temp->getVictim())
Temp->AI()->AttackStart(me->getVictim());
Creature* temp = Unit::GetCreature((*me), AddGUID[i]);
if (temp && temp->isAlive())
if (!temp->getVictim())
temp->AI()->AttackStart(me->getVictim());
}
}
CheckAdds_Timer = 5000;
@@ -240,7 +240,6 @@ public:
return;
Creature* pArchmage = instance->GetCreature(uiArchmageArugalGUID);
Creature* summon = NULL;
if (!pArchmage || !pArchmage->isAlive())
return;
@@ -252,7 +251,8 @@ public:
switch (uiPhase)
{
case 1:
summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
{
Creature* summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000);
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
summon->SetReactState(REACT_DEFENSIVE);
summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true);
@@ -260,13 +260,16 @@ public:
uiTimer = 2000;
uiPhase = 2;
break;
}
case 2:
{
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
pArchmage->SummonCreature(NPC_ARUGAL_VOIDWALKER, SpawnLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000);
uiPhase = 0;
break;
}
}
} else uiTimer -= uiDiff;
@@ -315,14 +315,12 @@ class boss_zuljin : public CreatureScript
{
for (uint8 i = 0; i < 4; ++i)
{
Unit* Temp = NULL;
if (SpiritGUID[i])
{
Temp = Unit::GetUnit(*me, SpiritGUID[i]);
if (Temp)
if (Unit* temp = Unit::GetUnit(*me, SpiritGUID[i]))
{
Temp->SetVisible(false);
Temp->setDeathState(DEAD);
temp->SetVisible(false);
temp->setDeathState(DEAD);
}
}
SpiritGUID[i] = 0;
@@ -230,13 +230,11 @@ public:
{
if (Creature* summoned = me->SummonCreature(creatureId, PyrewoodSpawnPoints[position][0], PyrewoodSpawnPoints[position][1], PyrewoodSpawnPoints[position][2], PyrewoodSpawnPoints[position][3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000))
{
Player* player = NULL;
Unit* target = NULL;
if (PlayerGUID)
{
player = Unit::GetPlayer(*me, PlayerGUID);
if (player)
target = RAND((Unit*)me, (Unit*)player);
if (Unit* player = Unit::GetPlayer(*me, PlayerGUID)->ToUnit())
target = RAND((Unit*)me, player);
} else
target = me;
@@ -60,12 +60,12 @@ public:
{
npc_tapoke_slim_jahnAI(Creature* creature) : npc_escortAI(creature) { }
bool m_bFriendSummoned;
bool IsFriendSummoned;
void Reset()
{
if (!HasEscortState(STATE_ESCORT_ESCORTING))
m_bFriendSummoned = false;
IsFriendSummoned = false;
}
void WaypointReached(uint32 waypointId)
@@ -83,14 +83,12 @@ public:
void EnterCombat(Unit* /*who*/)
{
Player* player = GetPlayerForEscort();
if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_bFriendSummoned && player)
if (HasEscortState(STATE_ESCORT_ESCORTING) && !IsFriendSummoned && GetPlayerForEscort())
{
for (uint8 i = 0; i < 3; ++i)
DoCast(me, SPELL_CALL_FRIENDS, true);
m_bFriendSummoned = true;
IsFriendSummoned = true;
}
}
@@ -222,11 +222,9 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
if (msg == EQUIP_ERR_OK)
{
Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true);
if (item && player)
if (Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true))
player->SendNewItem(item, 1, true, false, true);
}
player->SEND_GOSSIP_MENU(907, creature->GetGUID());
}
return true;
+2 -4
View File
@@ -537,7 +537,6 @@ public:
if (!Fandral || !Arygos || !Caelestrasz || !Merithra)
return;
Unit* mob = NULL;
AnimationTimer = EventAnim[AnimationCount].Timer;
if (eventEnd == false)
{
@@ -720,6 +719,7 @@ public:
case 51:
{
uint32 entries[4] = { 15423, 15424, 15414, 15422 };
Unit* mob = NULL;
for (uint8 i = 0; i < 4; ++i)
{
mob = player->FindNearestCreature(entries[i], 50, me);
@@ -844,9 +844,6 @@ public:
void UpdateAI(const uint32 diff)
{
Unit* target = NULL;
//Player* player = me->GetPlayer(PlayerGUID);
if (!Timers)
{
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers
@@ -890,6 +887,7 @@ public:
}
if (!hasTarget)
{
Unit* target = NULL;
if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414)
target = me->FindNearestCreature(15423, 20, true);
if (me->GetEntry() == 15423)
@@ -314,15 +314,14 @@ class boss_gothik : public CreatureScript
bool CheckGroupSplitted()
{
bool checklife = false;
bool checkdead = false;
Map* map = me->GetMap();
if (map && map->IsDungeon())
{
Map::PlayerList const &PlayerList = map->GetPlayers();
if (!PlayerList.isEmpty())
{
bool checklife = false;
bool checkdead = false;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
if (i->getSource() && i->getSource()->isAlive() &&
@@ -248,11 +248,9 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
Unit* unit = NULL;
if (TargetGUID[i])
{
unit = Unit::GetUnit(*me, TargetGUID[i]);
if (unit)
if (Unit* unit = Unit::GetUnit(*me, TargetGUID[i]))
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
@@ -299,12 +299,11 @@ public:
for (uint8 i = 0; i < 4; ++i)
{
Unit* Member = NULL;
if (Council[i])
{
Member = Unit::GetUnit(*me, Council[i]);
if (Member && Member->isAlive())
CAST_CRE(Member)->AI()->AttackStart(target);
Unit* member = Unit::GetUnit(*me, Council[i]);
if (member && member->isAlive())
CAST_CRE(member)->AI()->AttackStart(target);
}
}
+150 -78
View File
@@ -950,14 +950,14 @@ class spell_generic_clone : public SpellScriptLoader
enum CloneWeaponSpells
{
SPELL_COPY_WEAPON = 41055,
SPELL_COPY_WEAPON_2 = 63416,
SPELL_COPY_WEAPON_3 = 69891,
SPELL_COPY_WEAPON_AURA = 41054,
SPELL_COPY_WEAPON_2_AURA = 63418,
SPELL_COPY_WEAPON_3_AURA = 69893,
SPELL_COPY_OFFHAND = 45206,
SPELL_COPY_OFFHAND_2 = 69892,
SPELL_COPY_OFFHAND_AURA = 45205,
SPELL_COPY_OFFHAND_2_AURA = 69896,
SPELL_COPY_RANGED = 57593
SPELL_COPY_RANGED_AURA = 57594
};
class spell_generic_clone_weapon : public SpellScriptLoader
@@ -969,68 +969,16 @@ class spell_generic_clone_weapon : public SpellScriptLoader
{
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)
|| !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
return false;
return true;
}
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
target->CastSpell(caster, spellId, true);
if (target->GetTypeId() == TYPEID_PLAYER)
return;
switch (GetSpellInfo()->Id)
{
case SPELL_COPY_WEAPON:
case SPELL_COPY_WEAPON_2:
case SPELL_COPY_WEAPON_3:
{
if (Player* player = caster->ToPlayer())
{
if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
}
else
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
break;
}
case SPELL_COPY_OFFHAND:
case SPELL_COPY_OFFHAND_2:
{
if (Player* player = caster->ToPlayer())
{
if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
}
else
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
break;
}
case SPELL_COPY_RANGED:
{
if (Player* player = caster->ToPlayer())
{
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
}
else
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
break;
}
default:
break;
}
caster->CastSpell(target, spellId, true);
}
}
@@ -1046,6 +994,125 @@ class spell_generic_clone_weapon : public SpellScriptLoader
}
};
class spell_gen_clone_weapon_aura : public SpellScriptLoader
{
public:
spell_gen_clone_weapon_aura() : SpellScriptLoader("spell_gen_clone_weapon_aura") { }
class spell_gen_clone_weapon_auraScript : public AuraScript
{
PrepareAuraScript(spell_gen_clone_weapon_auraScript);
uint32 prevItem;
bool Validate(SpellInfo const* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3_AURA)
|| !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2_AURA) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED_AURA))
return false;
return true;
}
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* caster = GetCaster();
Unit* target = GetTarget();
if (!caster)
return;
switch (GetSpellInfo()->Id)
{
case SPELL_COPY_WEAPON_AURA:
case SPELL_COPY_WEAPON_2_AURA:
case SPELL_COPY_WEAPON_3_AURA:
{
prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID);
if (Player* player = caster->ToPlayer())
{
if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
}
else
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
break;
}
case SPELL_COPY_OFFHAND_AURA:
case SPELL_COPY_OFFHAND_2_AURA:
{
prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 1;
if (Player* player = caster->ToPlayer())
{
if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
}
else
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
break;
}
case SPELL_COPY_RANGED_AURA:
{
prevItem = target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID) + 2;
if (Player* player = caster->ToPlayer())
{
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
}
else
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
break;
}
default:
break;
}
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
switch (GetSpellInfo()->Id)
{
case SPELL_COPY_WEAPON_AURA:
case SPELL_COPY_WEAPON_2_AURA:
case SPELL_COPY_WEAPON_3_AURA:
{
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, prevItem);
break;
}
case SPELL_COPY_OFFHAND_AURA:
case SPELL_COPY_OFFHAND_2_AURA:
{
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, prevItem);
break;
}
case SPELL_COPY_RANGED_AURA:
{
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, prevItem);
break;
}
default:
break;
}
}
void Register()
{
OnEffectApply += AuraEffectApplyFn(spell_gen_clone_weapon_auraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
OnEffectRemove += AuraEffectRemoveFn(spell_gen_clone_weapon_auraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
}
};
AuraScript* GetAuraScript() const
{
return new spell_gen_clone_weapon_auraScript();
}
};
enum SeaforiumSpells
{
SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT = 60937,
@@ -1844,16 +1911,18 @@ class spell_gen_break_shield: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura* aura = itr->second->GetBase();
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
if (Aura* aura = itr->second->GetBase())
{
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
// Remove dummys from rider (Necessary for updating visual shields)
if (Unit* rider = target->GetCharmer())
if (Aura* defend = rider->GetAura(aura->GetId()))
defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
break;
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
{
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
// Remove dummys from rider (Necessary for updating visual shields)
if (Unit* rider = target->GetCharmer())
if (Aura* defend = rider->GetAura(aura->GetId()))
defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
break;
}
}
}
break;
@@ -1972,16 +2041,18 @@ class spell_gen_mounted_charge: public SpellScriptLoader
Unit::AuraApplicationMap const& auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura* aura = itr->second->GetBase();
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (aura && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
if (Aura* aura = itr->second->GetBase())
{
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
// Remove dummys from rider (Necessary for updating visual shields)
if (Unit* rider = target->GetCharmer())
if (Aura* defend = rider->GetAura(aura->GetId()))
defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
break;
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo && auraInfo->SpellIconID == 2007 && aura->HasEffectType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN))
{
aura->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
// Remove dummys from rider (Necessary for updating visual shields)
if (Unit* rider = target->GetCharmer())
if (Aura* defend = rider->GetAura(aura->GetId()))
defend->ModStackAmount(-1, AURA_REMOVE_BY_ENEMY_SPELL);
break;
}
}
}
break;
@@ -3189,6 +3260,7 @@ void AddSC_generic_spell_scripts()
new spell_gen_profession_research();
new spell_generic_clone();
new spell_generic_clone_weapon();
new spell_gen_clone_weapon_aura();
new spell_gen_seaforium_blast();
new spell_gen_turkey_marker();
new spell_gen_lifeblood();
+1 -1
View File
@@ -1291,7 +1291,7 @@ class spell_q12372_destabilize_azure_dragonshrine_dummy : public SpellScriptLoad
class spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript : public SpellScript
{
PrepareSpellScript(spell_q12372_destabilize_azure_dragonshrine_dummy_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
if (GetHitCreature())
@@ -278,6 +278,9 @@ class achievement_tilted : public AchievementCriteriaScript
bool OnCheck(Player* player, Unit* /*target*/)
{
if (!player)
return false;
bool checkArea = player->GetAreaId() == AREA_ARGENT_TOURNAMENT_FIELDS ||
player->GetAreaId() == AREA_RING_OF_ASPIRANTS ||
player->GetAreaId() == AREA_RING_OF_ARGENT_VALIANTS ||
@@ -285,7 +288,7 @@ class achievement_tilted : public AchievementCriteriaScript
player->GetAreaId() == AREA_RING_OF_HORDE_VALIANTS ||
player->GetAreaId() == AREA_RING_OF_CHAMPIONS;
return player && checkArea && player->duel && player->duel->isMounted;
return checkArea && player->duel && player->duel->isMounted;
}
};
+1 -1
View File
@@ -75,7 +75,7 @@ void BigNumber::SetRand(int numbits)
BN_rand(_bn, numbits, 0, 1);
}
BigNumber BigNumber::operator=(const BigNumber &bn)
BigNumber& BigNumber::operator=(const BigNumber &bn)
{
if (this == &bn)
return *this;
+1 -1
View File
@@ -39,7 +39,7 @@ class BigNumber
void SetRand(int numbits);
BigNumber operator=(const BigNumber &bn);
BigNumber& operator=(const BigNumber &bn);
BigNumber operator+=(const BigNumber &bn);
BigNumber operator+(const BigNumber &bn)
@@ -23,10 +23,8 @@
#include "DBCFileLoader.h"
#include "Errors.h"
DBCFileLoader::DBCFileLoader()
DBCFileLoader::DBCFileLoader() : stringTable(NULL), data(NULL), fieldsOffset(NULL)
{
data = NULL;
fieldsOffset = NULL;
}
bool DBCFileLoader::Load(const char* filename, const char* fmt)
+2 -2
View File
@@ -32,8 +32,8 @@ enum
FT_BYTE='b', //uint8
FT_SORT='d', //sorted by this field, field is not included
FT_IND='n', //the same, but parsed to data
FT_LOGIC='l', //Logical (boolean)
FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_LOGIC='l', //Logical (boolean)
FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
};
@@ -78,7 +78,7 @@ void WorldDatabaseConnection::DoPrepareStatements()
PREPARE_STATEMENT(WORLD_INS_CREATURE_TRANSPORT, "INSERT INTO creature_transport (guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO) values (?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_UPD_CREATURE_TRANSPORT_EMOTE, "UPDATE creature_transport SET emote = ? WHERE transport_entry = ? AND guid = ?", CONNECTION_ASYNC);
PREPARE_STATEMENT(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, equipment_id, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
PREPARE_STATEMENT(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH);
+2 -2
View File
@@ -103,7 +103,7 @@ void Log::CreateAppenderFromConfig(const char* name)
LogLevel level = LogLevel(atoi(*iter));
if (level > LOG_LEVEL_FATAL)
{
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %u for appender %s\n", level, name);
fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level %d for appender %s\n", level, name);
return;
}
@@ -158,7 +158,7 @@ void Log::CreateAppenderFromConfig(const char* name)
break;
}
default:
fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %u for appender %s\n", type, name);
fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type %d for appender %s\n", type, name);
break;
}
}
+2 -4
View File
@@ -52,8 +52,6 @@ typedef WINADVAPI BOOL (WINAPI *CSD_T)(SC_HANDLE, DWORD, LPCVOID);
bool WinServiceInstall()
{
CSD_T ChangeService_Config2;
HMODULE advapi32;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
if (serviceControlManager)
@@ -79,7 +77,7 @@ bool WinServiceInstall()
0); // no password
if (service)
{
advapi32 = GetModuleHandle("ADVAPI32.DLL");
HMODULE advapi32 = GetModuleHandle("ADVAPI32.DLL");
if (!advapi32)
{
CloseServiceHandle(service);
@@ -87,7 +85,7 @@ bool WinServiceInstall()
return false;
}
ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
CSD_T ChangeService_Config2 = (CSD_T) GetProcAddress(advapi32, "ChangeServiceConfig2A");
if (!ChangeService_Config2)
{
CloseServiceHandle(service);
+1 -1
View File
@@ -217,7 +217,7 @@ uint32 CreatePIDFile(const std::string& filename)
pid_t pid = getpid();
#endif
fprintf(pid_file, "%d", pid );
fprintf(pid_file, "%u", pid );
fclose(pid_file);
return (uint32)pid;
+1 -1
View File
@@ -51,7 +51,7 @@ class SOAPCommand
{
public:
SOAPCommand():
pendingCommands(0, USYNC_THREAD, "pendingCommands")
pendingCommands(0, USYNC_THREAD, "pendingCommands"), m_success(false)
{
}
+3 -3
View File
@@ -936,7 +936,7 @@ void ExtractMapsFromMpq(uint32 build)
printf("Convert map files\n");
for(uint32 z = 0; z < map_count; ++z)
{
printf("Extract %s (%d/%d) \n", map_ids[z].name, z+1, map_count);
printf("Extract %s (%d/%u) \n", map_ids[z].name, z+1, map_count);
// Loadup map grid data
sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
WDT_file wdt;
@@ -1016,13 +1016,13 @@ void ExtractDBCFiles(int locale, bool basicLocale)
}
// extract DBCs
int count = 0;
uint32 count = 0;
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{
string filename = path;
filename += (iter->c_str() + strlen("DBFilesClient\\"));
if(ExtractFile(iter->c_str(), filename))
if (ExtractFile(iter->c_str(), filename))
++count;
}
printf("Extracted %u DBC files\n\n", count);
+3 -3
View File
@@ -3,12 +3,12 @@
#include "dbcfile.h"
#include "mpq_libmpq04.h"
DBCFile::DBCFile(const std::string &filename):
filename(filename),
data(0)
DBCFile::DBCFile(const std::string& filename):
filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
{
}
bool DBCFile::open()
{
MPQFile f(filename.c_str());
+19 -23
View File
@@ -26,7 +26,7 @@
#define snprintf _snprintf
#endif
const char * GetPlainName(const char * FileName)
char const* GetPlainName(char const* FileName)
{
const char * szTemp;
@@ -35,7 +35,7 @@ const char * GetPlainName(const char * FileName)
return FileName;
}
char * GetPlainName(char * FileName)
char* GetPlainName(char* FileName)
{
char * szTemp;
@@ -44,24 +44,21 @@ char * GetPlainName(char * FileName)
return FileName;
}
void fixnamen(char *name, size_t len)
void fixnamen(char* name, size_t len)
{
for (size_t i=0; i<len-3; i++)
for (size_t i = 0; i < len-3; i++)
{
if (i>0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1]))
{
if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i-1]))
name[i] |= 0x20;
} else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
{
else if ((i == 0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
name[i] &= ~0x20;
}
}
//extension in lowercase
for(size_t i=len-3; i<len; i++)
for (size_t i = len - 3; i < len; i++)
name[i] |= 0x20;
}
void fixname2(char *name, size_t len)
void fixname2(char* name, size_t len)
{
for (size_t i=0; i<len-3; i++)
{
@@ -70,15 +67,15 @@ void fixname2(char *name, size_t len)
}
}
char * GetExtension(char * FileName)
char* GetExtension(char* FileName)
{
char * szTemp;
if((szTemp = strrchr(FileName, '.')) != NULL)
char* szTemp;
if (szTemp = strrchr(FileName, '.'))
return szTemp;
return NULL;
}
ADTFile::ADTFile(char* filename): ADT(filename)
ADTFile::ADTFile(char* filename): ADT(filename), nWMO(0), nMDX(0), WmoInstansName(NULL), ModelInstansName(NULL)
{
Adtfilename.append(filename);
}
@@ -99,7 +96,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
xMap = TempMapNumber.substr(TempMapNumber.find("_")+1,(TempMapNumber.find_last_of("_")-1) - (TempMapNumber.find("_")));
yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_")+1,(TempMapNumber.length()) - (TempMapNumber.find_last_of("_")));
Adtfilename.erase((Adtfilename.length()-xMap.length()-yMap.length()-2), (xMap.length()+yMap.length()+2));
string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
//string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
//printf("Processing map %s...\n", AdtMapNumber.c_str());
//printf("MapNumber = %s\n", TempMapNumber.c_str());
//printf("xMap = %s\n", xMap.c_str());
@@ -159,18 +156,17 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
{
if (size)
{
char *buf = new char[size];
char* buf = new char[size];
ADT.read(buf, size);
char *p=buf;
char* p=buf;
int q = 0;
WmoInstansName = new string[size];
while (p<buf+size)
{
string path(p);
char* s=GetPlainName(p);
fixnamen(s,strlen(s));
fixname2(s,strlen(s));
p=p+strlen(p)+1;
char* s = GetPlainName(p);
fixnamen(s, strlen(s));
fixname2(s, strlen(s));
p += strlen(p) + 1;
WmoInstansName[q++] = s;
}
delete[] buf;
+3 -2
View File
@@ -23,9 +23,10 @@
#include <cstdio>
DBCFile::DBCFile(const std::string &filename) : filename(filename)
DBCFile::DBCFile(const std::string& filename):
filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
{
data = NULL;
}
bool DBCFile::open()
+22 -25
View File
@@ -26,15 +26,14 @@
Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0)
{
memset(&header, 0, sizeof(header));
}
bool Model::open()
{
MPQFile f(filename.c_str());
ok = !f.isEof();
if (!ok)
if (f.isEof())
{
f.close();
// Do not show this error on console to avoid confusion, the extractor can continue working even if some models fail to load
@@ -52,9 +51,7 @@ bool Model::open()
vertices = new Vec3D[header.nBoundingVertices];
f.read(vertices,header.nBoundingVertices*12);
for (uint32 i=0; i<header.nBoundingVertices; i++)
{
vertices[i] = fixCoordSystem(vertices[i]);
}
f.seek(0);
f.seekRelative(header.ofsBoundingTriangles);
indices = new uint16[header.nBoundingTriangles];
@@ -73,13 +70,13 @@ bool Model::open()
bool Model::ConvertToVMAPModel(const char * outfilename)
{
int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
FILE * output=fopen(outfilename,"wb");
if(!output)
FILE* output=fopen(outfilename, "wb");
if (!output)
{
printf("Can't create the output file '%s'\n",outfilename);
return false;
}
fwrite(szRawVMAPMagic,8,1,output);
fwrite(szRawVMAPMagic, 8, 1, output);
uint32 nVertices = 0;
nVertices = header.nBoundingVertices;
fwrite(&nVertices, sizeof(int), 1, output);
@@ -101,20 +98,18 @@ bool Model::ConvertToVMAPModel(const char * outfilename)
wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes;
fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nIndexes, sizeof(uint32), 1, output);
if(nIndexes >0)
{
if (nIndexes >0)
fwrite(indices, sizeof(unsigned short), nIndexes, output);
}
fwrite("VERT",4, 1, output);
fwrite("VERT", 4, 1, output);
wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
fwrite(&wsize, sizeof(int), 1, output);
fwrite(&nVertices, sizeof(int), 1, output);
if(nVertices >0)
if (nVertices >0)
{
for(uint32 vpos=0; vpos <nVertices; ++vpos)
{
std::swap(vertices[vpos].y, vertices[vpos].z);
}
fwrite(vertices, sizeof(float)*3, nVertices, output);
}
@@ -134,24 +129,24 @@ Vec3D fixCoordSystem2(Vec3D v)
return Vec3D(v.x, v.z, v.y);
}
ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
: model(NULL), d1(0), w(0.0f)
{
float ff[3];
f.read(&id, 4);
f.read(ff,12);
pos = fixCoords(Vec3D(ff[0],ff[1],ff[2]));
f.read(ff,12);
rot = Vec3D(ff[0],ff[1],ff[2]);
f.read(&scale,4);
f.read(ff, 12);
pos = fixCoords(Vec3D(ff[0], ff[1], ff[2]));
f.read(ff, 12);
rot = Vec3D(ff[0], ff[1], ff[2]);
f.read(&scale, 4);
// scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
sc = scale / 1024.0f;
char tempname[512];
sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName);
FILE *input;
input = fopen(tempname, "r+b");
FILE* input = fopen(tempname, "r+b");
if(!input)
if (!input)
{
//printf("ModelInstance::ModelInstance couldn't open %s\n", tempname);
return;
@@ -167,7 +162,9 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID,
uint16 adtId = 0;// not used for models
uint32 flags = MOD_M2;
if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
if (tileX == 65 && tileY == 65)
flags |= MOD_WORLDSPAWN;
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name
fwrite(&mapID, sizeof(uint32), 1, pDirfile);
fwrite(&tileX, sizeof(uint32), 1, pDirfile);
+10 -17
View File
@@ -21,12 +21,9 @@
#include "loadlib/loadlib.h"
#include "vec3d.h"
//#include "mpq.h"
#include "modelheaders.h"
#include <vector>
class Model;
class WMOInstance;
class MPQFile;
Vec3D fixCoordSystem(Vec3D v);
@@ -35,18 +32,14 @@ class Model
{
public:
ModelHeader header;
uint32 offsBB_vertices, offsBB_indices;
Vec3D *BB_vertices, *vertices;
uint16 *BB_indices, *indices;
size_t nIndices;
Vec3D* vertices;
uint16* indices;
bool open();
bool ConvertToVMAPModel(const char * outfilename);
bool ConvertToVMAPModel(char const* outfilename);
bool ok;
Model(std::string &filename);
~Model() {_unload();}
Model(std::string& filename);
~Model() { _unload(); }
private:
void _unload()
@@ -56,22 +49,22 @@ private:
vertices = NULL;
indices = NULL;
}
std::string filename;
char outfilename;
};
class ModelInstance
{
public:
Model *model;
Model* model;
uint32 id;
Vec3D pos, rot;
unsigned int d1, scale;
float w,sc;
float w, sc;
ModelInstance() {}
ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
ModelInstance() : model(NULL), d1(0), scale(0), w(0.0f), sc(0.0f), id(0) {}
ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
};
+4 -4
View File
@@ -159,12 +159,12 @@ bool ExtractSingleWmo(std::string& fname)
int p = 0;
//Select root wmo files
const char * rchr = strrchr(plain_name, '_');
char const* rchr = strrchr(plain_name, '_');
if(rchr != NULL)
{
char cpy[4];
strncpy((char*)cpy,rchr,4);
for (int i=0;i < 4; ++i)
strncpy((char*)cpy, rchr, 4);
for (int i = 0; i < 4; ++i)
{
int m = cpy[i];
if(isdigit(m))
@@ -200,7 +200,7 @@ bool ExtractSingleWmo(std::string& fname)
strcpy(temp, fname.c_str());
temp[fname.length()-4] = 0;
char groupFileName[1024];
sprintf(groupFileName,"%s_%03d.wmo",temp, i);
sprintf(groupFileName, "%s_%03u.wmo", temp, i);
//printf("Trying to open groupfile %s\n",groupFileName);
string s = groupFileName;
+7 -11
View File
@@ -30,7 +30,7 @@ char * wdtGetPlainName(char * FileName)
return FileName;
}
WDTFile::WDTFile(char* file_name, char* file_name1):WDT(file_name)
WDTFile::WDTFile(char* file_name, char* file_name1) : WDT(file_name), gWmoInstansName(NULL), gnWMO(0)
{
filename.append(file_name1,strlen(file_name1));
}
@@ -78,9 +78,8 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
char *p=buf;
int q = 0;
gWmoInstansName = new string[size];
while (p<buf+size)
while (p < buf + size)
{
string path(p);
char* s=wdtGetPlainName(p);
fixnamen(s,strlen(s));
p=p+strlen(p)+1;
@@ -89,23 +88,20 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
delete[] buf;
}
}
else if (!strcmp(fourcc,"MODF"))
else if (!strcmp(fourcc, "MODF"))
{
// global wmo instance data
if (size)
{
gnWMO = (int)size / 64;
string gWMO_mapname;
string fake_mapname;
fake_mapname = "65 65 ";
//gWMO_mapname = fake_mapname + filename;
gWMO_mapname = fake_mapname + std::string(map_id);
for (int i=0; i<gnWMO; ++i)
for (int i = 0; i < gnWMO; ++i)
{
int id;
WDT.read(&id, 4);
WMOInstance inst(WDT,gWmoInstansName[id].c_str(),mapID, 65, 65, dirfile);
WMOInstance inst(WDT,gWmoInstansName[id].c_str(), mapID, 65, 65, dirfile);
}
delete[] gWmoInstansName;
}
}
+2 -3
View File
@@ -13,16 +13,15 @@ class WDTFile
public:
WDTFile(char* file_name, char* file_name1);
~WDTFile(void);
bool init(char *map_id, unsigned int mapID);
bool init(char* map_id, unsigned int mapID);
string* gWmoInstansName;
int gnWMO, nMaps;
int gnWMO;
ADTFile* GetMap(int x, int z);
private:
MPQFile WDT;
bool maps[64][64];
string filename;
};
+23 -16
View File
@@ -31,8 +31,12 @@
using namespace std;
extern uint16 *LiqType;
WMORoot::WMORoot(std::string &filename) : filename(filename)
WMORoot::WMORoot(std::string &filename)
: filename(filename), col(0), nTextures(0), nGroups(0), nP(0), nLights(0),
nModels(0), nDoodads(0), nDoodadSets(0), RootWMOID(0), liquidType(0)
{
memset(bbcorn1, 0, sizeof(bbcorn1));
memset(bbcorn2, 0, sizeof(bbcorn2));
}
bool WMORoot::open()
@@ -57,7 +61,7 @@ bool WMORoot::open()
size_t nextpos = f.getPos() + size;
if (!strcmp(fourcc,"MOHD"))//header
if (!strcmp(fourcc,"MOHD")) // header
{
f.read(&nTextures, 4);
f.read(&nGroups, 4);
@@ -68,8 +72,8 @@ bool WMORoot::open()
f.read(&nDoodadSets, 4);
f.read(&col, 4);
f.read(&RootWMOID, 4);
f.read(bbcorn1,12);
f.read(bbcorn2,12);
f.read(bbcorn1, 12);
f.read(bbcorn2, 12);
f.read(&liquidType, 4);
break;
}
@@ -120,15 +124,15 @@ bool WMORoot::open()
return true;
}
bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile)
bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile)
{
//printf("Convert RootWmo...\n");
fwrite(szRawVMAPMagic,1,8,pOutfile);
fwrite(szRawVMAPMagic, 1, 8, pOutfile);
unsigned int nVectors = 0;
fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later
fwrite(&nGroups,4,1,pOutfile);
fwrite(&RootWMOID,4,1,pOutfile);
fwrite(&nVectors,sizeof(nVectors), 1, pOutfile); // will be filled later
fwrite(&nGroups, 4, 1, pOutfile);
fwrite(&RootWMOID, 4, 1, pOutfile);
return true;
}
@@ -136,9 +140,13 @@ WMORoot::~WMORoot()
{
}
WMOGroup::WMOGroup(std::string &filename) : filename(filename),
MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), hlq(0), LiquEx(0), LiquBytes(0)
WMOGroup::WMOGroup(const std::string &filename) :
filename(filename), MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0),
hlq(0), LiquEx(0), LiquBytes(0), groupName(0), descGroupName(0), mogpFlags(0),
mopy_size(0), moba_size(0), LiquEx_size(0), nVertices(0), nTriangles(0)
{
memset(bbcorn1, 0, sizeof(bbcorn1));
memset(bbcorn2, 0, sizeof(bbcorn2));
}
bool WMOGroup::open()
@@ -237,7 +245,7 @@ bool WMOGroup::open()
return true;
}
int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData)
int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool preciseVectorData)
{
fwrite(&mogpFlags,sizeof(uint32),1,output);
fwrite(&groupWMOID,sizeof(uint32),1,output);
@@ -246,7 +254,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
fwrite(bbcorn2, sizeof(float), 3, output);
fwrite(&liquflags,sizeof(uint32),1,output);
int nColTriangles = 0;
if(pPreciseVectorData)
if (preciseVectorData)
{
char GRP[] = "GRP ";
fwrite(GRP,1,4,output);
@@ -479,10 +487,9 @@ WMOGroup::~WMOGroup()
delete [] LiquBytes;
}
WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
: currx(0), curry(0), wmo(NULL), doodadset(0), pos(), indx(0), d3(0)
{
pos = Vec3D(0,0,0);
float ff[3];
f.read(&id, 4);
f.read(ff,12);
+17 -19
View File
@@ -50,14 +50,13 @@ public:
float bbcorn1[3];
float bbcorn2[3];
WMORoot(std::string &filename);
WMORoot(std::string& filename);
~WMORoot();
bool open();
bool ConvertToVMAPRootWmo(FILE *output);
bool ConvertToVMAPRootWmo(FILE* output);
private:
std::string filename;
char outfilename;
};
struct WMOLiquidHeader
@@ -89,30 +88,29 @@ public:
uint16 nBatchB;
uint32 nBatchC, fogIdx, liquidType, groupWMOID;
int mopy_size,moba_size;
int mopy_size, moba_size;
int LiquEx_size;
unsigned int nVertices; // number when loaded
int nTriangles; // number when loaded
char *MOPY;
uint16 *MOVI;
uint16 *MoviEx;
float *MOVT;
uint16 *MOBA;
int *MobaEx;
WMOLiquidHeader *hlq;
WMOLiquidVert *LiquEx;
char *LiquBytes;
char* MOPY;
uint16* MOVI;
uint16* MoviEx;
float* MOVT;
uint16* MOBA;
int* MobaEx;
WMOLiquidHeader* hlq;
WMOLiquidVert* LiquEx;
char* LiquBytes;
uint32 liquflags;
WMOGroup(std::string &filename);
WMOGroup(std::string const& filename);
~WMOGroup();
bool open();
int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData);
int ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool preciseVectorData);
private:
std::string filename;
char outfilename;
};
class WMOInstance
@@ -122,13 +120,13 @@ public:
std::string MapName;
int currx;
int curry;
WMOGroup *wmo;
WMOGroup* wmo;
Vec3D pos;
Vec3D pos2, pos3, rot;
uint32 indx,id, d2, d3;
uint32 indx, id, d2, d3;
int doodadset;
WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
WMOInstance(MPQFile&f , char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
static void reset();
};