diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index e0b57d73f..a24cf7598 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1456,7 +1456,7 @@ void BattleGround::DoorOpen(ObjectGuid guid) void BattleGround::OnObjectDBLoad(Creature* creature) { - const BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(creature->GetDBTableGUIDLow()); + const BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow()); if (eventId.event1 == BG_EVENT_NONE) return; m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].creatures.push_back(creature->GetObjectGuid()); @@ -1474,7 +1474,7 @@ ObjectGuid BattleGround::GetSingleCreatureGuid(uint8 event1, uint8 event2) void BattleGround::OnObjectDBLoad(GameObject* obj) { - const BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(obj->GetDBTableGUIDLow()); + const BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(obj->GetGUIDLow()); if (eventId.event1 == BG_EVENT_NONE) return; m_EventObjects[MAKE_PAIR32(eventId.event1, eventId.event2)].gameobjects.push_back(obj->GetObjectGuid()); diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 51f9eae42..f450b28af 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -335,7 +335,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* target if (GetStatus() != STATUS_IN_PROGRESS) return; - uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetDBTableGUIDLow())).event1; + uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1; if (event >= BG_AB_NODES_MAX) // not a node return; BG_AB_Nodes node = BG_AB_Nodes(event); diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index ab07c089b..c7ff4cb18 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -51,7 +51,7 @@ void BattleGroundAV::HandleKillUnit(Creature *creature, Player *killer) DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry()); if (GetStatus() != STATUS_IN_PROGRESS) return; - uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetDBTableGUIDLow())).event1; + uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1; if (event1 == BG_EVENT_NONE) return; switch(event1) @@ -514,11 +514,11 @@ void BattleGroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target if (GetStatus() != STATUS_IN_PROGRESS) return; DEBUG_LOG("BattleGroundAV: using gameobject %i", target_obj->GetEntry()); - uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetDBTableGUIDLow())).event1; + uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1; if (event >= BG_AV_NODES_MAX) // not a node return; BG_AV_Nodes node = BG_AV_Nodes(event); - switch ((sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetDBTableGUIDLow())).event2 % BG_AV_MAX_STATES) + switch ((sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event2 % BG_AV_MAX_STATES) { case POINT_CONTROLLED: EventPlayerAssaultsPoint(source, node); diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 98aea98c2..eff3c3d8b 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -347,7 +347,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target int32 message_id = 0; ChatMsg type; - uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetDBTableGUIDLow())).event1; + uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1; //alliance flag picked up from base if(Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 8def1ecab..30e760143 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -2703,23 +2703,14 @@ bool ChatHandler::ExtractUint32KeyFromLink(char** text, char const* linkType, ui return ExtractUInt32(&arg, value); } -GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry) +GameObject* ChatHandler::GetGameObjectWithGuid(uint32 lowguid,uint32 entry) { - if(!m_session) + if (!m_session) return NULL; Player* pl = m_session->GetPlayer(); - GameObject* obj = pl->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, entry, lowguid)); - - if(!obj && sObjectMgr.GetGOData(lowguid)) // guid is DB guid of object - { - MaNGOS::GameObjectWithDbGUIDCheck go_check(*pl,lowguid); - MaNGOS::GameObjectSearcher checker(obj,go_check); - Cell::VisitGridObjects(pl,checker, pl->GetMap()->GetVisibilityDistance()); - } - - return obj; + return pl->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, entry, lowguid)); } enum SpellLinkType diff --git a/src/game/Chat.h b/src/game/Chat.h index f32f53f7f..4ed9ff6f8 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -615,7 +615,7 @@ class ChatHandler std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; } std::string GetNameLink(Player* chr) const; - GameObject* GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid,uint32 entry); + GameObject* GetGameObjectWithGuid(uint32 lowguid,uint32 entry); // Utility methods for commands bool ShowAccountListHelper(QueryResult* result, uint32* limit = NULL, bool title = true, bool error = true); diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index e8994ff84..863483e21 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -123,7 +123,7 @@ Unit(), i_AI(NULL), lootForPickPocketed(false), lootForBody(false), lootForSkin(false), m_groupLootTimer(0), m_groupLootId(0), m_lootMoney(0), m_lootGroupRecipientId(0), m_corpseDecayTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(5.0f), -m_subtype(subtype), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), +m_subtype(subtype), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_needNotify(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), @@ -461,7 +461,7 @@ void Creature::Update(uint32 update_diff, uint32 diff) if(m_originalEntry != GetEntry()) { // need preserver gameevent state - GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(GetDBTableGUIDLow()); + GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(GetGUIDLow()); UpdateEntry(m_originalEntry, TEAM_NONE, NULL, eventData); } @@ -496,9 +496,8 @@ void Creature::Update(uint32 update_diff, uint32 diff) if (m_corpseDecayTimer <= update_diff) { // since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless - uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool(GetDBTableGUIDLow()) : 0; - if (poolid) - sPoolMgr.UpdatePool(poolid, GetDBTableGUIDLow()); + if (uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow())) + sPoolMgr.UpdatePool(poolid, GetGUIDLow()); if (IsInWorld()) // can be despawned by update pool { @@ -527,10 +526,8 @@ void Creature::Update(uint32 update_diff, uint32 diff) if (m_corpseDecayTimer <= update_diff) { // since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless - uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool(GetDBTableGUIDLow()) : 0; - - if (poolid) - sPoolMgr.UpdatePool(poolid, GetDBTableGUIDLow()); + if (uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow())) + sPoolMgr.UpdatePool(poolid, GetGUIDLow()); if (IsInWorld()) // can be despawned by update pool { @@ -1011,7 +1008,7 @@ void Creature::SaveToDB() { // this should only be used when the creature has already been loaded // preferably after adding to map, because mapid may not be valid otherwise - CreatureData const *data = sObjectMgr.GetCreatureData(m_DBTableGuid); + CreatureData const *data = sObjectMgr.GetCreatureData(GetGUIDLow()); if(!data) { sLog.outError("Creature::SaveToDB failed, cannot get creature data!"); @@ -1024,9 +1021,7 @@ void Creature::SaveToDB() void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) { // update in loaded data - if (!m_DBTableGuid) - m_DBTableGuid = GetGUIDLow(); - CreatureData& data = sObjectMgr.NewOrExistCreatureData(m_DBTableGuid); + CreatureData& data = sObjectMgr.NewOrExistCreatureData(GetGUIDLow()); uint32 displayId = GetNativeDisplayId(); @@ -1072,11 +1067,11 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) // updated in DB WorldDatabase.BeginTransaction(); - WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", m_DBTableGuid); + WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", GetGUIDLow()); std::ostringstream ss; ss << "INSERT INTO creature VALUES (" - << m_DBTableGuid << "," + << GetGUIDLow() << "," << GetEntry() << "," << mapid <<"," << uint32(spawnMask) << "," // cast to prevent save as symbol @@ -1240,8 +1235,6 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map) GameEventCreatureData const* eventData = sGameEventMgr.GetCreatureUpdateDataForActiveEvent(guidlow); - m_DBTableGuid = guidlow; - // Creature can be loaded already in map if grid has been unloaded while creature walk to another grid if (map->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, guidlow))) return false; @@ -1263,7 +1256,7 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map) m_isDeadByDefault = data->is_dead; m_deathState = m_isDeadByDefault ? DEAD : ALIVE; - m_respawnTime = map->GetPersistentState()->GetCreatureRespawnTime(m_DBTableGuid); + m_respawnTime = map->GetPersistentState()->GetCreatureRespawnTime(GetGUIDLow()); if(m_respawnTime > time(NULL)) // not ready to respawn { @@ -1279,11 +1272,11 @@ bool Creature::LoadFromDB(uint32 guidlow, Map *map) { m_respawnTime = 0; - GetMap()->GetPersistentState()->SaveCreatureRespawnTime(m_DBTableGuid, 0); + GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), 0); } uint32 curhealth = data->curhealth; - if(curhealth) + if (curhealth) { curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank)); if(curhealth < 1) @@ -1361,24 +1354,24 @@ struct CreatureRespawnDeleteWorker void Creature::DeleteFromDB() { - if (!m_DBTableGuid) + if (!HasStaticDBSpawnData()) { DEBUG_LOG("Trying to delete not saved creature!"); return; } - CreatureRespawnDeleteWorker worker (m_DBTableGuid); + CreatureRespawnDeleteWorker worker (GetGUIDLow()); sMapPersistentStateMgr.DoForAllStatesWithMapId(GetMapId(), worker); - sObjectMgr.DeleteCreatureData(m_DBTableGuid); + sObjectMgr.DeleteCreatureData(GetGUIDLow()); WorldDatabase.BeginTransaction(); - WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid=%u", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid=%u", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM game_event_creature_data WHERE guid=%u", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM creature_battleground WHERE guid=%u", m_DBTableGuid); + WorldDatabase.PExecuteLog("DELETE FROM creature WHERE guid=%u", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM creature_addon WHERE guid=%u", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM creature_movement WHERE id=%u", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM game_event_creature WHERE guid=%u", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM game_event_creature_data WHERE guid=%u", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM creature_battleground WHERE guid=%u", GetGUIDLow()); WorldDatabase.CommitTransaction(); } @@ -1526,8 +1519,8 @@ void Creature::Respawn() if (IsDespawned()) { - if (m_DBTableGuid) - GetMap()->GetPersistentState()->SaveCreatureRespawnTime(m_DBTableGuid, 0); + if (HasStaticDBSpawnData()) + GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), 0); m_respawnTime = time(NULL); // respawn at next tick } } @@ -1822,13 +1815,13 @@ bool Creature::CanInitiateAttack() void Creature::SaveRespawnTime() { - if(IsPet() || !m_DBTableGuid) + if(IsPet() || !HasStaticDBSpawnData()) return; if(m_respawnTime > time(NULL)) // dead (no corpse) - GetMap()->GetPersistentState()->SaveCreatureRespawnTime(m_DBTableGuid, m_respawnTime); + GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), m_respawnTime); else if (m_corpseDecayTimer > 0) // dead (corpse) - GetMap()->GetPersistentState()->SaveCreatureRespawnTime(m_DBTableGuid, time(NULL) + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS); + GetMap()->GetPersistentState()->SaveCreatureRespawnTime(GetGUIDLow(), time(NULL) + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS); } bool Creature::IsOutOfThreatArea(Unit* pVictim) const @@ -1861,11 +1854,8 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const CreatureDataAddon const* Creature::GetCreatureAddon() const { - if (m_DBTableGuid) - { - if(CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(m_DBTableGuid)) - return addon; - } + if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureAddon(GetGUIDLow())) + return addon; // dependent from difficulty mode entry return ObjectMgr::GetCreatureTemplateAddon(GetCreatureInfo()->Entry); @@ -2115,20 +2105,17 @@ time_t Creature::GetRespawnTimeEx() const void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* dist ) const { - if (m_DBTableGuid) + if (CreatureData const* data = sObjectMgr.GetCreatureData(GetGUIDLow())) { - if (CreatureData const* data = sObjectMgr.GetCreatureData(GetDBTableGUIDLow())) - { - x = data->posX; - y = data->posY; - z = data->posZ; - if (ori) - *ori = data->orientation; - if (dist) - *dist = GetRespawnRadius(); + x = data->posX; + y = data->posY; + z = data->posZ; + if (ori) + *ori = data->orientation; + if (dist) + *dist = GetRespawnRadius(); - return; - } + return; } float orient; @@ -2453,3 +2440,7 @@ void Creature::SpawnInMaps(uint32 db_guid, CreatureData const* data) sMapMgr.DoForAllMapsWithMapId(data->mapid, worker); } +bool Creature::HasStaticDBSpawnData() const +{ + return sObjectMgr.GetCreatureData(GetGUIDLow()) != NULL; +} diff --git a/src/game/Creature.h b/src/game/Creature.h index df31120d0..509249663 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -405,7 +405,8 @@ class MANGOS_DLL_SPEC Creature : public Unit void SelectLevel(const CreatureInfo *cinfo, float percentHealth = 100.0f, float percentMana = 100.0f); void LoadEquipment(uint32 equip_entry, bool force=false); - uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } + bool HasStaticDBSpawnData() const; // listed in `creature` table and have fixed in DB guid + char const* GetSubName() const { return GetCreatureInfo()->SubName; } void Update(uint32 update_diff, uint32 time); // overwrite Unit::Update @@ -684,7 +685,6 @@ class MANGOS_DLL_SPEC Creature : public Unit void RegenerateHealth(); MovementGeneratorType m_defaultMovementType; Cell m_currentCell; // store current cell where creature listed - uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid uint32 m_equipmentId; bool m_AlreadyCallAssistance; diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 85d56050f..23904e14d 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -56,7 +56,6 @@ GameObject::GameObject() : WorldObject() m_cooldownTime = 0; m_goInfo = NULL; - m_DBTableGuid = 0; m_rotation = 0; } @@ -424,8 +423,8 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/) SaveRespawnTime(); // if part of pool, let pool system schedule new spawn instead of just scheduling respawn - if (uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool(GetDBTableGUIDLow()) : 0) - sPoolMgr.UpdatePool(poolid, GetDBTableGUIDLow()); + if (uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow())) + sPoolMgr.UpdatePool(poolid, GetGUIDLow()); // can be not in world at pool despawn if (IsInWorld()) @@ -464,9 +463,8 @@ void GameObject::Delete() SetGoState(GO_STATE_READY); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); - uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool(GetDBTableGUIDLow()) : 0; - if (poolid) - sPoolMgr.UpdatePool(poolid, GetDBTableGUIDLow()); + if (uint16 poolid = sPoolMgr.IsPartOfAPool(GetGUIDLow())) + sPoolMgr.UpdatePool(poolid, GetGUIDLow()); else AddObjectToRemoveList(); } @@ -488,7 +486,7 @@ void GameObject::SaveToDB() { // this should only be used when the gameobject has already been loaded // preferably after adding to map, because mapid may not be valid otherwise - GameObjectData const *data = sObjectMgr.GetGOData(m_DBTableGuid); + GameObjectData const *data = sObjectMgr.GetGOData(GetGUIDLow()); if(!data) { sLog.outError("GameObject::SaveToDB failed, cannot get gameobject data!"); @@ -505,10 +503,8 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) if (!goI) return; - if (!m_DBTableGuid) - m_DBTableGuid = GetGUIDLow(); // update in loaded data (changing data only in this place) - GameObjectData& data = sObjectMgr.NewGOData(m_DBTableGuid); + GameObjectData& data = sObjectMgr.NewGOData(GetGUIDLow()); // data->guid = guid don't must be update at save data.id = GetEntry(); @@ -530,7 +526,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) // updated in DB std::ostringstream ss; ss << "INSERT INTO gameobject VALUES ( " - << m_DBTableGuid << ", " + << GetGUIDLow() << ", " << GetEntry() << ", " << mapid << ", " << uint32(spawnMask) << "," // cast to prevent save as symbol @@ -548,7 +544,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << uint32(GetGoState()) << ")"; WorldDatabase.BeginTransaction(); - WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid); + WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", GetGUIDLow()); WorldDatabase.PExecuteLog("%s", ss.str().c_str()); WorldDatabase.CommitTransaction(); } @@ -579,8 +575,6 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) uint8 animprogress = data->animprogress; GOState go_state = data->go_state; - m_DBTableGuid = guid; - if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state) ) return false; @@ -598,13 +592,13 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map) m_spawnedByDefault = true; m_respawnDelayTime = data->spawntimesecs; - m_respawnTime = map->GetPersistentState()->GetGORespawnTime(m_DBTableGuid); + m_respawnTime = map->GetPersistentState()->GetGORespawnTime(GetGUIDLow()); // ready to respawn if (m_respawnTime && m_respawnTime <= time(NULL)) { m_respawnTime = 0; - map->GetPersistentState()->SaveGORespawnTime(m_DBTableGuid, 0); + map->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), 0); } } else @@ -633,19 +627,19 @@ struct GameObjectRespawnDeleteWorker void GameObject::DeleteFromDB() { - if (!m_DBTableGuid) + if (!HasStaticDBSpawnData()) { DEBUG_LOG("Trying to delete not saved gameobject!"); return; } - GameObjectRespawnDeleteWorker worker(m_DBTableGuid); + GameObjectRespawnDeleteWorker worker(GetGUIDLow()); sMapPersistentStateMgr.DoForAllStatesWithMapId(GetMapId(), worker); - sObjectMgr.DeleteGOData(m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM game_event_gameobject WHERE guid = '%u'", m_DBTableGuid); - WorldDatabase.PExecuteLog("DELETE FROM gameobject_battleground WHERE guid = '%u'", m_DBTableGuid); + sObjectMgr.DeleteGOData(GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM gameobject WHERE guid = '%u'", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM game_event_gameobject WHERE guid = '%u'", GetGUIDLow()); + WorldDatabase.PExecuteLog("DELETE FROM gameobject_battleground WHERE guid = '%u'", GetGUIDLow()); } GameObjectInfo const *GameObject::GetGOInfo() const @@ -694,7 +688,7 @@ Unit* GameObject::GetOwner() const void GameObject::SaveRespawnTime() { if(m_respawnTime > time(NULL) && m_spawnedByDefault) - GetMap()->GetPersistentState()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime); + GetMap()->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), m_respawnTime); } bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const @@ -737,7 +731,7 @@ void GameObject::Respawn() if(m_spawnedByDefault && m_respawnTime > 0) { m_respawnTime = time(NULL); - GetMap()->GetPersistentState()->SaveGORespawnTime(m_DBTableGuid, 0); + GetMap()->GetPersistentState()->SaveGORespawnTime(GetGUIDLow(), 0); } } @@ -960,7 +954,7 @@ void GameObject::Use(Unit* user) UseDoorOrButton(); // activate script - GetMap()->ScriptsStart(sGameObjectScripts, GetDBTableGUIDLow(), spellCaster, this); + GetMap()->ScriptsStart(sGameObjectScripts, GetGUIDLow(), spellCaster, this); return; } case GAMEOBJECT_TYPE_BUTTON: // 1 @@ -969,7 +963,7 @@ void GameObject::Use(Unit* user) UseDoorOrButton(); // activate script - GetMap()->ScriptsStart(sGameObjectScripts, GetDBTableGUIDLow(), spellCaster, this); + GetMap()->ScriptsStart(sGameObjectScripts, GetGUIDLow(), spellCaster, this); TriggerLinkedGameObject(user); return; @@ -997,7 +991,7 @@ void GameObject::Use(Unit* user) // TODO: possible must be moved to loot release (in different from linked triggering) if (GetGOInfo()->chest.eventId) { - DEBUG_LOG("Chest ScriptStart id %u for GO %u", GetGOInfo()->chest.eventId, GetDBTableGUIDLow()); + DEBUG_LOG("Chest ScriptStart id %u for GO %u", GetGOInfo()->chest.eventId, GetGUIDLow()); if (!sScriptMgr.OnProcessEvent(GetGOInfo()->chest.eventId, user, this, true)) GetMap()->ScriptsStart(sEventScripts, GetGOInfo()->chest.eventId, user, this); @@ -1118,7 +1112,7 @@ void GameObject::Use(Unit* user) if (info->goober.eventId) { - DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetGUIDLow()); if (!sScriptMgr.OnProcessEvent(info->goober.eventId, player, this, true)) GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this); @@ -1755,3 +1749,8 @@ void GameObject::SpawnInMaps(uint32 db_guid, GameObjectData const* data) SpawnGameObjectInMapsWorker worker(db_guid, data); sMapMgr.DoForAllMapsWithMapId(data->mapid, worker); } + +bool GameObject::HasStaticDBSpawnData() const +{ + return sObjectMgr.GetGOData(GetGUIDLow()) != NULL; +} diff --git a/src/game/GameObject.h b/src/game/GameObject.h index eda4a2b57..959da5491 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -603,7 +603,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject bool IsTransport() const; - uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } + bool HasStaticDBSpawnData() const; // listed in `gameobject` table and have fixed in DB guid void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f); @@ -739,7 +739,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject ObjectGuid m_firstUser; // first GO user, in most used cases owner, but in some cases no, for example non-summoned multi-use GAMEOBJECT_TYPE_SUMMONING_RITUAL GuidsSet m_UniqueUsers; // all players who use item, some items activated after specific amount unique uses - uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid GameObjectInfo const* m_goInfo; uint64 m_rotation; private: diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index ccac40a9b..021cbd27e 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -216,7 +216,7 @@ void MaNGOS::RespawnDo::operator()( Creature* u ) const Map* map = u->GetMap(); if (map->IsBattleGroundOrArena()) { - BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(u->GetDBTableGUIDLow()); + BattleGroundEventIdx eventId = sBattleGroundMgr.GetCreatureEventIndex(u->GetGUIDLow()); if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2)) return; } @@ -230,7 +230,7 @@ void MaNGOS::RespawnDo::operator()( GameObject* u ) const Map* map = u->GetMap(); if (map->IsBattleGroundOrArena()) { - BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(u->GetDBTableGUIDLow()); + BattleGroundEventIdx eventId = sBattleGroundMgr.GetGameObjectEventIndex(u->GetGUIDLow()); if (!((BattleGroundMap*)map)->GetBG()->IsActiveEvent(eventId.event1, eventId.event2)) return; } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 5483b1270..fd8cf88ef 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -749,20 +749,6 @@ namespace MaNGOS GameObjectEntryInPosRangeCheck(GameObjectEntryInPosRangeCheck const&); }; - class GameObjectWithDbGUIDCheck - { - public: - GameObjectWithDbGUIDCheck(WorldObject const& obj,uint32 db_guid) : i_obj(obj), i_db_guid(db_guid) {} - WorldObject const& GetFocusObject() const { return i_obj; } - bool operator()(GameObject const* go) const - { - return go->GetDBTableGUIDLow() == i_db_guid; - } - private: - WorldObject const& i_obj; - uint32 i_db_guid; - }; - // Unit checks class MostHPMissingInRangeCheck diff --git a/src/game/HomeMovementGenerator.cpp b/src/game/HomeMovementGenerator.cpp index 5ab5cd97b..b8997d550 100644 --- a/src/game/HomeMovementGenerator.cpp +++ b/src/game/HomeMovementGenerator.cpp @@ -73,7 +73,7 @@ HomeMovementGenerator::Update(Creature &owner, const uint32& time_diff if (owner.GetDefaultMovementType() == IDLE_MOTION_TYPE) { // such a mob might need very exact spawning point, hence relocate to spawn-position - if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetDBTableGUIDLow())) + if (CreatureData const* data = sObjectMgr.GetCreatureData(owner.GetGUIDLow())) { owner.Relocate(data->posX, data->posY, data->posZ, data->orientation); owner.SendHeartBeat(false); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 605b37069..8bd6e0975 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -877,7 +877,7 @@ bool ChatHandler::HandleGameObjectTargetCommand(char* args) PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(),curRespawnDelayStr.c_str()); - ShowNpcOrGoSpawnInformation(target->GetDBTableGUIDLow()); + ShowNpcOrGoSpawnInformation(target->GetGUIDLow()); } return true; } @@ -897,7 +897,7 @@ bool ChatHandler::HandleGameObjectDeleteCommand(char* args) // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + obj = GetGameObjectWithGuid(lowguid,go_data->id); if (!obj) { @@ -944,7 +944,7 @@ bool ChatHandler::HandleGameObjectTurnCommand(char* args) // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + obj = GetGameObjectWithGuid(lowguid,go_data->id); if (!obj) { @@ -988,7 +988,7 @@ bool ChatHandler::HandleGameObjectMoveCommand(char* args) // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + obj = GetGameObjectWithGuid(lowguid,go_data->id); if (!obj) { @@ -1133,7 +1133,7 @@ bool ChatHandler::HandleGameObjectPhaseCommand(char* args) // by DB guid if (GameObjectData const* go_data = sObjectMgr.GetGOData(lowguid)) - obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id); + obj = GetGameObjectWithGuid(lowguid,go_data->id); if (!obj) { @@ -1576,7 +1576,7 @@ bool ChatHandler::HandleNpcAddCommand(char* args) pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); - uint32 db_guid = pCreature->GetDBTableGUIDLow(); + uint32 db_guid = pCreature->GetGUIDLow(); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); pCreature->LoadFromDB(db_guid, map); @@ -1844,7 +1844,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args) pCreature = player->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid)); } else - lowguid = pCreature->GetDBTableGUIDLow(); + lowguid = pCreature->GetGUIDLow(); float x = m_session->GetPlayer()->GetPositionX(); float y = m_session->GetPlayer()->GetPositionY(); @@ -1853,7 +1853,7 @@ bool ChatHandler::HandleNpcMoveCommand(char* args) if (pCreature) { - if (CreatureData const* data = sObjectMgr.GetCreatureData(pCreature->GetDBTableGUIDLow())) + if (CreatureData const* data = sObjectMgr.GetCreatureData(pCreature->GetGUIDLow())) { const_cast(data)->posX = x; const_cast(data)->posY = y; @@ -1903,7 +1903,7 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args) pCreature = getSelectedCreature(); if (!pCreature || pCreature->IsPet()) return false; - lowguid = pCreature->GetDBTableGUIDLow(); + lowguid = pCreature->GetGUIDLow(); } else // case .setmovetype #creature_guid $move_type (with guid) { @@ -2057,7 +2057,7 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args) uint32 u_guidlow = 0; if (pCreature) - u_guidlow = pCreature->GetDBTableGUIDLow(); + u_guidlow = pCreature->GetGUIDLow(); else return false; @@ -2089,7 +2089,7 @@ bool ChatHandler::HandleNpcSpawnTimeCommand(char* args) return false; } - uint32 u_guidlow = pCreature->GetDBTableGUIDLow(); + uint32 u_guidlow = pCreature->GetGUIDLow(); WorldDatabase.PExecuteLog("UPDATE creature SET spawntimesecs=%i WHERE guid=%u", stime, u_guidlow); pCreature->SetRespawnDelay(stime); @@ -2911,7 +2911,7 @@ bool ChatHandler::HandleWpAddCommand(char* args) } else { - lowguid = target->GetDBTableGUIDLow(); + lowguid = target->GetGUIDLow(); } } else @@ -3201,7 +3201,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) { wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); - wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(), map); + wpCreature->LoadFromDB(wpCreature->GetGUIDLow(), map); map->Add(wpCreature); wpGuid = wpCreature->GetGUIDLow(); } @@ -3321,7 +3321,7 @@ bool ChatHandler::HandleWpModifyCommand(char* args) wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); - wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map); + wpCreature2->LoadFromDB(wpCreature2->GetGUIDLow(), map); map->Add(wpCreature2); //npcCreature->GetMap()->Add(wpCreature2); } @@ -3470,7 +3470,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) } } - uint32 lowguid = target->GetDBTableGUIDLow(); + uint32 lowguid = target->GetGUIDLow(); std::string show = show_str; uint32 Maxpoint; @@ -3632,7 +3632,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); - wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(),map); + wpCreature->LoadFromDB(wpCreature->GetGUIDLow(),map); map->Add(wpCreature); //wpCreature->GetMap()->Add(wpCreature); } while (result->NextRow()); @@ -3684,7 +3684,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) } pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); - pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); + pCreature->LoadFromDB(pCreature->GetGUIDLow(), map); map->Add(pCreature); //player->PlayerTalkClass->SendPointOfInterest(x, y, 6, 6, 0, "First Waypoint"); @@ -3744,7 +3744,7 @@ bool ChatHandler::HandleWpShowCommand(char* args) } pCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMaskForSpawn()); - pCreature->LoadFromDB(pCreature->GetDBTableGUIDLow(), map); + pCreature->LoadFromDB(pCreature->GetGUIDLow(), map); map->Add(pCreature); //player->PlayerTalkClass->SendPointOfInterest(x, y, 6, 6, 0, "Last Waypoint"); // Cleanup memory diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 98cf09e2b..089b0b508 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -4090,7 +4090,7 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) std::string curRespawnDelayStr = secsToTimeString(curRespawnDelay,true); std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(),true); - PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), faction, npcflags, Entry, displayid, nativeid); + PSendSysMessage(LANG_NPCINFO_CHAR, target->GetGUIDLow(), faction, npcflags, Entry, displayid, nativeid); PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel()); PSendSysMessage(LANG_NPCINFO_HEALTH,target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth()); PSendSysMessage(LANG_NPCINFO_FLAGS, target->GetUInt32Value(UNIT_FIELD_FLAGS), target->GetUInt32Value(UNIT_DYNAMIC_FLAGS), target->getFaction()); @@ -4108,7 +4108,7 @@ bool ChatHandler::HandleNpcInfoCommand(char* /*args*/) SendSysMessage(LANG_NPCINFO_TRAINER); } - ShowNpcOrGoSpawnInformation(target->GetDBTableGUIDLow()); + ShowNpcOrGoSpawnInformation(target->GetGUIDLow()); return true; } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 7c1582797..d7c83603f 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1183,7 +1183,7 @@ void Map::AddToActive( WorldObject* obj ) { Creature* c= (Creature*)obj; - if (!c->IsPet() && c->GetDBTableGUIDLow()) + if (!c->IsPet() && c->HasStaticDBSpawnData()) { float x,y,z; c->GetRespawnCoord(x,y,z); @@ -1218,7 +1218,7 @@ void Map::RemoveFromActive( WorldObject* obj ) { Creature* c= (Creature*)obj; - if(!c->IsPet() && c->GetDBTableGUIDLow()) + if(!c->IsPet() && c->HasStaticDBSpawnData()) { float x,y,z; c->GetRespawnCoord(x,y,z); @@ -2140,11 +2140,8 @@ void Map::ScriptsProcess() } case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: { - if (!step.script->respawnGo.goGuid) // gameobject not specified - { - sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) call for NULL gameobject.", step.script->id); + if (!step.script->respawnGo.goGuid) // checked at load break; - } if (!source) { @@ -2159,17 +2156,23 @@ void Map::ScriptsProcess() } WorldObject* summoner = (WorldObject*)source; + if (!summoner->IsInWorld()) + { + sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) call for non-in-world WorldObject (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); + break; + } - GameObject *go = NULL; int32 time_to_despawn = step.script->respawnGo.despawnDelay < 5 ? 5 : step.script->respawnGo.despawnDelay; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*summoner, step.script->respawnGo.goGuid); - MaNGOS::GameObjectSearcher checker(go, go_check); - Cell::VisitGridObjects(summoner, checker, GetVisibilityDistance()); + uint32 guidlow = step.script->respawnGo.goGuid; + GameObjectData const* goData = sObjectMgr.GetGOData(guidlow); + if (!goData) + break; // checked at load + GameObject *go = summoner->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, goData->id, guidlow)); if (!go) { - sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->respawnGo.goGuid); + sLog.outError("SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (script id %u) failed for gameobject(guid: %u).", step.script->id, guidlow); break; } @@ -2229,11 +2232,8 @@ void Map::ScriptsProcess() } case SCRIPT_COMMAND_OPEN_DOOR: { - if (!step.script->openDoor.goGuid) // door not specified - { - sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) call for NULL door.", step.script->id); + if (!step.script->openDoor.goGuid) // checked at load break; - } if (!source) { @@ -2248,14 +2248,20 @@ void Map::ScriptsProcess() } Unit* caster = (Unit*)source; + if (!caster->IsInWorld()) + { + sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) call for non-in-world unit (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); + break; + } - GameObject *door = NULL; int32 time_to_close = step.script->openDoor.resetDelay < 15 ? 15 : step.script->openDoor.resetDelay; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster, step.script->openDoor.goGuid); - MaNGOS::GameObjectSearcher checker(door, go_check); - Cell::VisitGridObjects(caster, checker, GetVisibilityDistance()); + uint32 guidlow = step.script->openDoor.goGuid; + GameObjectData const* goData = sObjectMgr.GetGOData(guidlow); + if (!goData) // checked at load + break; + GameObject *door = caster->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, goData->id, guidlow)); if (!door) { sLog.outError("SCRIPT_COMMAND_OPEN_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->openDoor.goGuid); @@ -2280,11 +2286,8 @@ void Map::ScriptsProcess() } case SCRIPT_COMMAND_CLOSE_DOOR: { - if (!step.script->closeDoor.goGuid) // guid for door not specified - { - sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) call for NULL door.", step.script->id); + if (!step.script->closeDoor.goGuid) // checked at load break; - } if (!source) { @@ -2299,17 +2302,23 @@ void Map::ScriptsProcess() } Unit* caster = (Unit*)source; + if (!caster->IsInWorld()) + { + sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) call for non-in-world unit (TypeId: %u), skipping.", step.script->id, source->GetTypeId()); + break; + } - GameObject *door = NULL; int32 time_to_open = step.script->closeDoor.resetDelay < 15 ? 15 : step.script->closeDoor.resetDelay; - MaNGOS::GameObjectWithDbGUIDCheck go_check(*caster, step.script->closeDoor.goGuid); - MaNGOS::GameObjectSearcher checker(door, go_check); - Cell::VisitGridObjects(caster, checker, GetVisibilityDistance()); + uint32 guidlow = step.script->closeDoor.goGuid; + GameObjectData const* goData = sObjectMgr.GetGOData(guidlow); + if (!goData) // checked at load + break; + GameObject *door = caster->GetMap()->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, goData->id, guidlow)); if (!door) { - sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, step.script->closeDoor.goGuid); + sLog.outError("SCRIPT_COMMAND_CLOSE_DOOR (script id %u) failed for gameobject(guid: %u).", step.script->id, guidlow); break; } if (door->GetGoType() != GAMEOBJECT_TYPE_DOOR) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index a69a73ea4..eaddec0b8 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -1931,7 +1931,6 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint3 Object::_Create(guidlow, pet_number, HIGHGUID_PET); - m_DBTableGuid = guidlow; m_originalEntry = Entry; if(!InitEntry(Entry)) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 39c943205..3624106a4 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13147,10 +13147,10 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me uint32 Player::GetGossipTextId(WorldObject *pSource) { - if (!pSource || pSource->GetTypeId() != TYPEID_UNIT || !((Creature*)pSource)->GetDBTableGUIDLow()) + if (!pSource || pSource->GetTypeId() != TYPEID_UNIT) return DEFAULT_GOSSIP_MESSAGE; - if (uint32 pos = sObjectMgr.GetNpcGossip(((Creature*)pSource)->GetDBTableGUIDLow())) + if (uint32 pos = sObjectMgr.GetNpcGossip(((Creature*)pSource)->GetGUIDLow())) return pos; return DEFAULT_GOSSIP_MESSAGE; diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 3676bc2bd..c1c06e6ef 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -46,9 +46,9 @@ alter table creature_movement add `wpguid` int(11) default '0'; //-----------------------------------------------// void WaypointMovementGenerator::LoadPath(Creature &creature) { - DETAIL_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "LoadPath: loading waypoint path for creature %u, %u", creature.GetGUIDLow(), creature.GetDBTableGUIDLow()); + DETAIL_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "LoadPath: loading waypoint path for %s", creature.GetGuidStr().c_str()); - i_path = sWaypointMgr.GetPath(creature.GetDBTableGUIDLow()); + i_path = sWaypointMgr.GetPath(creature.GetGUIDLow()); // We may LoadPath() for several occasions: @@ -70,7 +70,7 @@ void WaypointMovementGenerator::LoadPath(Creature &creature) if (!i_path) { sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path", - creature.GetName(), creature.GetEntry(), creature.GetDBTableGUIDLow()); + creature.GetName(), creature.GetEntry(), creature.GetGUIDLow()); return; } } @@ -186,7 +186,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 if (i_path->at(i_currentNode).script_id) { - DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature movement start script %u at point %u for creature %u (entry %u).", i_path->at(i_currentNode).script_id, i_currentNode, creature.GetDBTableGUIDLow(), creature.GetEntry()); + DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "Creature movement start script %u at point %u for %s.", i_path->at(i_currentNode).script_id, i_currentNode, creature.GetGuidStr().c_str()); creature.GetMap()->ScriptsStart(sCreatureMovementScripts, i_path->at(i_currentNode).script_id, &creature, &creature); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6d847bd48..0b6db4bc0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11158" + #define REVISION_NR "11159" #endif // __REVISION_NR_H__