From a0e50ea35fca61447bf07fc45d93c98234ba59f7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 14 Sep 2014 16:14:12 +0200 Subject: Core/Entities: Use ObjectGuid class in game project --- src/server/game/Texts/CreatureTextMgr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/server/game/Texts') diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 18dc7683b8d..49d83b91353 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -78,7 +78,7 @@ typedef std::map LocaleCreatureTextMap; //used for handling non-repeatable random texts typedef std::vector CreatureTextRepeatIds; typedef std::unordered_map CreatureTextRepeatGroup; -typedef std::unordered_map CreatureTextRepeatMap;//guid based +typedef std::unordered_map CreatureTextRepeatMap;//guid based class CreatureTextMgr { @@ -165,7 +165,7 @@ class CreatureTextLocalizer { case CHAT_MSG_MONSTER_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER: - data.put(whisperGUIDpos, player->GetGUID()); + data.put(whisperGUIDpos, player->GetGUID().GetRawValue()); break; default: break; -- cgit v1.2.3 From e567ab95972508adc85a36f867723114a04fe227 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Thu, 18 Sep 2014 23:33:59 +0200 Subject: Core/Texts: added TextRange parameter to creature_text Ranges: 0 - Normal (Default) 1 - Area 2 - Zone 3 - Map 4 - World Ref #13116 --- .../world/2014_09_18_03_world_creature_text.sql | 10 ++++ src/server/game/AI/CreatureAI.cpp | 7 +-- src/server/game/AI/CreatureAI.h | 8 ++-- src/server/game/Battlegrounds/Battleground.cpp | 2 +- .../game/Battlegrounds/Zones/BattlegroundAV.cpp | 14 +++--- src/server/game/Groups/Group.cpp | 4 +- src/server/game/Groups/Group.h | 18 +++++++- src/server/game/Texts/CreatureTextMgr.cpp | 49 +++++++++++--------- src/server/game/Texts/CreatureTextMgr.h | 53 +++++++++++++--------- .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 2 +- .../instance_culling_of_stratholme.cpp | 8 ++-- .../Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 4 +- .../Database/Implementation/WorldDatabase.cpp | 2 +- 13 files changed, 107 insertions(+), 74 deletions(-) create mode 100644 sql/updates/world/2014_09_18_03_world_creature_text.sql (limited to 'src/server/game/Texts') diff --git a/sql/updates/world/2014_09_18_03_world_creature_text.sql b/sql/updates/world/2014_09_18_03_world_creature_text.sql new file mode 100644 index 00000000000..a3ccd371ecc --- /dev/null +++ b/sql/updates/world/2014_09_18_03_world_creature_text.sql @@ -0,0 +1,10 @@ +ALTER TABLE `creature_text` + CHANGE `BroadcastTextID` `BroadcastTextId` MEDIUMINT(6) DEFAULT 0 NOT NULL AFTER `sound`, + ADD COLUMN `TextRange` TINYINT(3) UNSIGNED DEFAULT 0 NOT NULL AFTER `BroadcastTextId`; + +-- Zone +UPDATE `creature_text` SET `TextRange`=2 WHERE `entry`=15214; + +-- Map +UPDATE `creature_text` SET `TextRange`=3 WHERE `entry` IN (29, 14848, 22515, 26527, 27915, 30084); + diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 7a79bb722a0..933cb38aef5 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -38,16 +38,11 @@ void CreatureAI::OnCharmed(bool /*apply*/) AISpellInfoType* UnitAI::AISpellInfo; AISpellInfoType* GetAISpellInfo(uint32 i) { return &CreatureAI::AISpellInfo[i]; } -void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= NULL*/) +void CreatureAI::Talk(uint8 id, WorldObject const* whisperTarget /*= nullptr*/) { sCreatureTextMgr->SendChat(me, id, whisperTarget); } -void CreatureAI::TalkToMap(uint8 id, WorldObject const* whisperTarget /*= NULL*/) -{ - sCreatureTextMgr->SendChat(me, id, whisperTarget, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); -} - void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/) { if (!creature) diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index b79dd6abbc8..83ecb11a8ef 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -78,8 +78,8 @@ class CreatureAI : public UnitAI Creature* DoSummonFlyer(uint32 entry, WorldObject* obj, float flightZ, float radius = 5.0f, uint32 despawnTime = 30000, TempSummonType summonType = TEMPSUMMON_CORPSE_TIMED_DESPAWN); public: - void Talk(uint8 id, WorldObject const* whisperTarget = NULL); - void TalkToMap(uint8 id, WorldObject const* whisperTarget = NULL); + void Talk(uint8 id, WorldObject const* whisperTarget = nullptr); + explicit CreatureAI(Creature* creature) : UnitAI(creature), me(creature), m_MoveInLineOfSight_locked(false) { } virtual ~CreatureAI() { } @@ -165,14 +165,12 @@ class CreatureAI : public UnitAI /// == Fields ======================================= - // Pointer to controlled by AI creature - //Creature* const me; - virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) { } virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { } virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; } + protected: virtual void MoveInLineOfSight(Unit* /*who*/); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 90a84774a81..86081c7f074 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -620,7 +620,7 @@ void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* void Battleground::SendChatMessage(Creature* source, uint8 textId, WorldObject* target /*= NULL*/) { - sCreatureTextMgr->SendChat(source, textId, target, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP); + sCreatureTextMgr->SendChat(source, textId, target); } void Battleground::PlaySoundToAll(uint32 SoundID) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index c028698f5ae..0490923510c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -119,7 +119,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) DelCreature(AV_CPLACE_TRIGGER16); if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD)) - herold->AI()->TalkToMap(TEXT_STORMPIKE_GENERAL_DEAD); + herold->AI()->Talk(TEXT_STORMPIKE_GENERAL_DEAD); } else if (entry == BG_AV_CreatureInfo[AV_NPC_H_CAPTAIN]) { @@ -138,7 +138,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer) DelCreature(AV_CPLACE_TRIGGER18); if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD)) - herold->AI()->TalkToMap(TEXT_FROSTWOLF_GENERAL_DEAD); + herold->AI()->Talk(TEXT_FROSTWOLF_GENERAL_DEAD); } else if (entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_N_4] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_A_4] || entry == BG_AV_CreatureInfo[AV_NPC_N_MINE_H_4]) ChangeMineOwner(AV_NORTH_MINE, killer->GetTeam()); @@ -603,7 +603,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node)) if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD)) - herold->AI()->TalkToMap(owner == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture); + herold->AI()->Talk(owner == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture); } void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) @@ -679,9 +679,9 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, uint32 team, bool initial) if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD)) { if (mine == AV_NORTH_MINE) - herold->AI()->TalkToMap(team == ALLIANCE ? TEXT_IRONDEEP_MINE_ALLIANCE_TAKEN : TEXT_IRONDEEP_MINE_HORDE_TAKEN); + herold->AI()->Talk(team == ALLIANCE ? TEXT_IRONDEEP_MINE_ALLIANCE_TAKEN : TEXT_IRONDEEP_MINE_HORDE_TAKEN); else if (mine == AV_SOUTH_MINE) - herold->AI()->TalkToMap(team == ALLIANCE ? TEXT_COLDTOOTH_MINE_ALLIANCE_TAKEN : TEXT_COLDTOOTH_MINE_HORDE_TAKEN); + herold->AI()->Talk(team == ALLIANCE ? TEXT_COLDTOOTH_MINE_ALLIANCE_TAKEN : TEXT_COLDTOOTH_MINE_HORDE_TAKEN); } } else @@ -923,7 +923,7 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object) if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node)) if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD)) - herold->AI()->TalkToMap(team == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture); + herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceCapture : nodeInfo->TextIds.HordeCapture); // update the statistic for the defending player UpdatePlayerScore(player, IsTower(node) ? SCORE_TOWERS_DEFENDED : SCORE_GRAVEYARDS_DEFENDED, 1); @@ -1014,7 +1014,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) if (StaticNodeInfo const* nodeInfo = GetStaticNodeInfo(node)) if (Creature* herold = GetBGCreature(AV_CPLACE_HERALD)) - herold->AI()->TalkToMap(team == ALLIANCE ? nodeInfo->TextIds.AllianceAttack : nodeInfo->TextIds.HordeAttack); + herold->AI()->Talk(team == ALLIANCE ? nodeInfo->TextIds.AllianceAttack : nodeInfo->TextIds.HordeAttack); // update the statistic for the assaulting player UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index df34c12e332..b203ccb8bb9 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1591,12 +1591,12 @@ void Group::UpdatePlayerOutOfRange(Player* player) } } -void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, ObjectGuid ignore) +void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group /*= -1*/, ObjectGuid ignoredPlayer /*= ObjectGuid::Empty*/) { for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* player = itr->GetSource(); - if (!player || (!ignore.IsEmpty() && player->GetGUID() == ignore) || (ignorePlayersInBGRaid && player->GetGroup() != this)) + if (!player || (!ignoredPlayer.IsEmpty() && player->GetGUID() == ignoredPlayer) || (ignorePlayersInBGRaid && player->GetGroup() != this)) continue; if (player->GetSession() && (group == -1 || itr->getSubGroup() == group)) diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 6abfd5b667d..5e9ab911292 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -269,8 +269,22 @@ class Group void SendUpdate(); void SendUpdateToPlayer(ObjectGuid playerGUID, MemberSlot* slot = NULL); void UpdatePlayerOutOfRange(Player* player); - // ignore: GUID of player that will be ignored - void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignore = ObjectGuid::Empty); + + template + void BroadcastWorker(Worker& worker) + { + for (GroupReference* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) + worker(itr->GetSource()); + } + + template + void BroadcastWorker(Worker const& worker) const + { + for (GroupReference const* itr = GetFirstMember(); itr != nullptr; itr = itr->next()) + worker(itr->GetSource()); + } + + void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group = -1, ObjectGuid ignoredPlayer = ObjectGuid::Empty); void BroadcastReadyCheck(WorldPacket* packet); void OfflineReadyCheck(); diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 0412128754c..05769c84f94 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -91,7 +91,6 @@ void CreatureTextMgr::LoadCreatureTexts() } uint32 textCount = 0; - uint32 creatureCount = 0; do { @@ -109,25 +108,26 @@ void CreatureTextMgr::LoadCreatureTexts() temp.duration = fields[8].GetUInt32(); temp.sound = fields[9].GetUInt32(); temp.BroadcastTextId = fields[10].GetUInt32(); + temp.TextRange = CreatureTextRange(fields[11].GetUInt8()); if (temp.sound) { if (!sSoundEntriesStore.LookupEntry(temp.sound)) { - TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); temp.sound = 0; } } if (!GetLanguageDescByID(temp.lang)) { - TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); temp.lang = LANG_UNIVERSAL; } if (temp.type >= MAX_CHAT_MSG_TYPE) { - TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); temp.type = CHAT_MSG_SAY; } @@ -135,7 +135,7 @@ void CreatureTextMgr::LoadCreatureTexts() { if (!sEmotesStore.LookupEntry(temp.emote)) { - TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); temp.emote = EMOTE_ONESHOT_NONE; } } @@ -149,9 +149,11 @@ void CreatureTextMgr::LoadCreatureTexts() } } - // entry not yet added, add empty TextHolder (list of groups) - if (mTextMap.find(temp.entry) == mTextMap.end()) - ++creatureCount; + if (temp.TextRange > TEXT_RANGE_WORLD) + { + TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange); + temp.TextRange = TEXT_RANGE_NORMAL; + } // add the text into our entry's group mTextMap[temp.entry][temp.group].push_back(temp); @@ -160,7 +162,7 @@ void CreatureTextMgr::LoadCreatureTexts() } while (result->NextRow()); - TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for " SZFMTD " creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime)); } void CreatureTextMgr::LoadCreatureTextLocales() @@ -193,7 +195,7 @@ void CreatureTextMgr::LoadCreatureTextLocales() } -uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= NULL*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= NULL*/) +uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= nullptr*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/, Player* srcPlr /*= nullptr*/) { if (!source) return 0; @@ -274,6 +276,9 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject Language finalLang = (language == LANG_ADDON) ? iter->lang : language; uint32 finalSound = sound ? sound : iter->sound; + if (range == TEXT_RANGE_NORMAL) + range = iter->TextRange; + if (finalSound) SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly); @@ -334,6 +339,18 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, { switch (msgType) { + case CHAT_MSG_MONSTER_PARTY: + { + if (!whisperTarget) + return; + + if (Player const* whisperPlayer = whisperTarget->ToPlayer()) + { + if (Group const* group = whisperPlayer->GetGroup()) + group->BroadcastWorker([data](Player* player) { player->SendDirectMessage(data); }); + } + return; + } case CHAT_MSG_MONSTER_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER: { @@ -347,18 +364,6 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket* data, } break; } - case CHAT_MSG_MONSTER_PARTY: - if (!whisperTarget) - return; - - if (Player const* player = whisperTarget->ToPlayer()) - { - if (Group* group = const_cast(player->GetGroup())) - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - if (Player* member = itr->GetSource()) - member->GetSession()->SendPacket(data); - } - return; default: break; } diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 49d83b91353..d6fa2b2492c 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -24,6 +24,15 @@ #include "SharedDefines.h" #include "Opcodes.h" +enum CreatureTextRange +{ + TEXT_RANGE_NORMAL = 0, + TEXT_RANGE_AREA = 1, + TEXT_RANGE_ZONE = 2, + TEXT_RANGE_MAP = 3, + TEXT_RANGE_WORLD = 4 +}; + struct CreatureTextEntry { uint32 entry; @@ -37,15 +46,7 @@ struct CreatureTextEntry uint32 duration; uint32 sound; uint32 BroadcastTextId; -}; - -enum CreatureTextRange -{ - TEXT_RANGE_NORMAL = 0, - TEXT_RANGE_AREA = 1, - TEXT_RANGE_ZONE = 2, - TEXT_RANGE_MAP = 3, - TEXT_RANGE_WORLD = 4 + CreatureTextRange TextRange; }; struct CreatureTextLocale @@ -55,9 +56,7 @@ struct CreatureTextLocale struct CreatureTextId { - CreatureTextId(uint32 e, uint32 g, uint32 i) : entry(e), textGroup(g), textId(i) - { - } + CreatureTextId(uint32 e, uint32 g, uint32 i) : entry(e), textGroup(g), textId(i) { } bool operator<(CreatureTextId const& right) const { @@ -69,9 +68,9 @@ struct CreatureTextId uint32 textId; }; -typedef std::vector CreatureTextGroup; //texts in a group -typedef std::unordered_map CreatureTextHolder; //groups for a creature by groupid -typedef std::unordered_map CreatureTextMap; //all creatures by entry +typedef std::vector CreatureTextGroup; // texts in a group +typedef std::unordered_map CreatureTextHolder; // groups for a creature by groupid +typedef std::unordered_map CreatureTextMap; // all creatures by entry typedef std::map LocaleCreatureTextMap; @@ -83,8 +82,8 @@ typedef std::unordered_map CreatureTextRepe class CreatureTextMgr { private: - CreatureTextMgr() { }; - ~CreatureTextMgr() { }; + CreatureTextMgr() { } + ~CreatureTextMgr() { } public: static CreatureTextMgr* instance() @@ -101,11 +100,11 @@ class CreatureTextMgr void SendEmote(Unit* source, uint32 emote); //if sent, returns the 'duration' of the text else 0 if error - uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = NULL, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = NULL); + uint32 SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget = nullptr, ChatMsg msgType = CHAT_MSG_ADDON, Language language = LANG_ADDON, CreatureTextRange range = TEXT_RANGE_NORMAL, uint32 sound = 0, Team team = TEAM_OTHER, bool gmOnly = false, Player* srcPlr = nullptr); bool TextExist(uint32 sourceEntry, uint8 textGroup); std::string GetLocalizedChatString(uint32 entry, uint8 gender, uint8 textGroup, uint32 id, LocaleConstant locale) const; - template void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = NULL, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const; + template void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = nullptr, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false) const; private: CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup); @@ -181,7 +180,7 @@ class CreatureTextLocalizer }; template -void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget /*= NULL*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/) const +void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget /*= nullptr*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/) const { if (!source) return; @@ -190,6 +189,18 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder switch (msgType) { + case CHAT_MSG_MONSTER_PARTY: + { + if (!whisperTarget) + return; + + if (Player* whisperPlayer = const_cast(whisperTarget->ToPlayer())) + { + if (Group* group = whisperPlayer->GetGroup()) + group->BroadcastWorker(localizer); + } + return; + } case CHAT_MSG_MONSTER_WHISPER: case CHAT_MSG_RAID_BOSS_WHISPER: { @@ -240,7 +251,7 @@ void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder SessionMap const& smap = sWorld->GetAllSessions(); for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter) if (Player* player = iter->second->GetPlayer()) - if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster())) + if ((!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster())) localizer(player); return; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index e9039da892c..2fcdd276bdc 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -420,7 +420,7 @@ class npc_eye_of_acherus : public CreatureScript for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true); - TalkToMap(TALK_CONTROL, owner); + Talk(TALK_CONTROL, owner); } me->SetDisableGravity(false); DoCast(me, SPELL_EYE_FLIGHT); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index ae0fa2aa564..c25a061d622 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -163,7 +163,7 @@ class instance_culling_of_stratholme : public InstanceMapScript // Summon Chromie and global whisper if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos[0])) if (!instance->GetPlayers().isEmpty()) - chromie->AI()->TalkToMap(SAY_CRATES_COMPLETED); + chromie->AI()->Talk(SAY_CRATES_COMPLETED); } DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount); break; @@ -277,17 +277,17 @@ class instance_culling_of_stratholme : public InstanceMapScript case 25: if (instance->HavePlayers()) if (Creature* chromie = instance->GetCreature(_chromieGUID)) - chromie->AI()->TalkToMap(SAY_INFINITE_START); + chromie->AI()->Talk(SAY_INFINITE_START); break; case 5: if (instance->HavePlayers()) if (Creature* chromie = instance->GetCreature(_chromieGUID)) - chromie->AI()->TalkToMap(SAY_INFINITE); + chromie->AI()->Talk(SAY_INFINITE); break; case 0: if (instance->HavePlayers()) if (Creature* chromie = instance->GetCreature(_chromieGUID)) - chromie->AI()->TalkToMap(SAY_INFINITE_FAIL); + chromie->AI()->Talk(SAY_INFINITE_FAIL); if (Creature* infinite = instance->GetCreature(_infiniteGUID)) { diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 5862453731e..bd1a345e55b 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -672,7 +672,7 @@ public: Talk(SAY_BUFF_SPARK); } else if (spell->Id == SPELL_MALYGOS_BERSERK) - TalkToMap(EMOTE_HIT_BERSERKER_TIMER); + Talk(EMOTE_HIT_BERSERKER_TIMER); } void MoveInLineOfSight(Unit* who) override @@ -1121,7 +1121,7 @@ public: npc_power_sparkAI(Creature* creature) : ScriptedAI(creature) { _instance = creature->GetInstanceScript(); - TalkToMap(EMOTE_POWER_SPARK_SUMMONED); + Talk(EMOTE_POWER_SPARK_SUMMONED); MoveToMalygos(); } diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index f5d9913bc5b..e83901c8557 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -25,7 +25,7 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_QUEST_POOLS, "SELECT entry, pool_entry FROM pool_quest", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_CRELINKED_RESPAWN, "DELETE FROM linked_respawn WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(WORLD_REP_CREATURE_LINKED_RESPAWN, "REPLACE INTO linked_respawn (guid, linkedGuid) VALUES (?, ?)", CONNECTION_ASYNC); - PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, BroadcastTextID FROM creature_text", CONNECTION_SYNCH); + PrepareStatement(WORLD_SEL_CREATURE_TEXT, "SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, BroadcastTextId, TextRange FROM creature_text", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_SMART_SCRIPTS, "SELECT entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o FROM smart_scripts ORDER BY entryorguid, source_type, id, link", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_SMARTAI_WP, "SELECT entry, pointid, position_x, position_y, position_z FROM waypoints ORDER BY entry, pointid", CONNECTION_SYNCH); PrepareStatement(WORLD_DEL_GAMEOBJECT, "DELETE FROM gameobject WHERE guid = ?", CONNECTION_ASYNC); -- cgit v1.2.3 From 0f1f7ef4017ac32df669ceee120489321da680aa Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 19 Sep 2014 03:16:59 +0200 Subject: Core/Misc: multiple changes * fixed build * apply tc codestyle to ObjectGuid class * fixed warning --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 +- .../game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 2 +- src/server/game/Battlefield/Battlefield.cpp | 17 +----- src/server/game/Battlefield/Battlefield.h | 3 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 26 ++++----- src/server/game/Entities/Object/ObjectGuid.cpp | 10 ++-- src/server/game/Entities/Object/ObjectGuid.h | 64 +++++++++++----------- src/server/game/Texts/CreatureTextMgr.cpp | 1 - src/server/game/Texts/CreatureTextMgr.h | 1 + src/server/scripts/Northrend/zone_wintergrasp.cpp | 6 +- 10 files changed, 60 insertions(+), 72 deletions(-) (limited to 'src/server/game/Texts') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 38b3d2d882d..0b69391f935 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -23,10 +23,10 @@ SDComment: SDCategory: Npc EndScriptData */ +#include "Player.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "Group.h" -#include "Player.h" enum Points { diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 6640341e589..00aa8eacc93 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -23,10 +23,10 @@ SDComment: This AI is under development SDCategory: Npc EndScriptData */ +#include "Player.h" #include "ScriptedCreature.h" #include "ScriptedFollowerAI.h" #include "Group.h" -#include "Player.h" const float MAX_PLAYER_DISTANCE = 100.0f; diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index d54ce790c5b..3d725284cc1 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -357,10 +357,7 @@ void Battlefield::DoPlaySoundToAll(uint32 SoundID) data.Initialize(SMSG_PLAY_SOUND, 4); data << uint32(SoundID); - for (int team = 0; team < BG_TEAMS_COUNT; team++) - for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr) - if (Player* player = ObjectAccessor::FindPlayer(*itr)) - player->SendDirectMessage(&data); + BroadcastPacketToWar(data); } bool Battlefield::HasPlayer(Player* player) const @@ -443,18 +440,10 @@ void Battlefield::BroadcastPacketToWar(WorldPacket& data) const player->SendDirectMessage(&data); } -void Battlefield::SendWarningToAllInZone(uint32 entry) +void Battlefield::SendWarning(uint8 id, WorldObject const* target /*= nullptr*/) { if (Creature* stalker = GetCreature(StalkerGuid)) - // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/ - sCreatureTextMgr->SendChat(stalker, (uint8) entry, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE); -} - -void Battlefield::SendWarningToPlayer(Player* player, uint32 entry) -{ - if (player) - if (Creature* stalker = GetCreature(StalkerGuid)) - sCreatureTextMgr->SendChat(stalker, (uint8)entry, player); + sCreatureTextMgr->SendChat(stalker, id, target); } void Battlefield::SendUpdateWorldState(uint32 field, uint32 value) diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index c7322e63a21..9e706f3650b 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -303,8 +303,7 @@ class Battlefield : public ZoneScript /// Called when a player enter in battlefield zone virtual void OnPlayerEnterZone(Player* /*player*/) { } - void SendWarningToAllInZone(uint32 entry); - void SendWarningToPlayer(Player* player, uint32 entry); + void SendWarning(uint8 id, WorldObject const* target = nullptr); void PlayerAcceptInviteToQueue(Player* player); void PlayerAcceptInviteToWar(Player* player); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index a6eb0c24ece..360d2d68bc3 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -268,7 +268,7 @@ void BattlefieldWG::OnBattleStart() // Initialize vehicle counter UpdateCounterVehicle(true); // Send start warning to all players - SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START); + SendWarning(BATTLEFIELD_WG_TEXT_START); } void BattlefieldWG::UpdateCounterVehicle(bool init) @@ -409,9 +409,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer) } if (!endByTimer) // win alli/horde - SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1); + SendWarning((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1); else // defend alli/horde - SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1); + SendWarning((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1); } // ******************************************************* @@ -442,7 +442,7 @@ void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* void BattlefieldWG::OnStartGrouping() { - SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); + SendWarning(BATTLEFIELD_WG_TEXT_WILL_START); } uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const @@ -689,7 +689,7 @@ void BattlefieldWG::PromotePlayer(Player* killer) { killer->RemoveAura(SPELL_RECRUIT); killer->CastSpell(killer, SPELL_CORPORAL, true); - SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK); + SendWarning(BATTLEFIELD_WG_TEXT_FIRSTRANK, killer); } else killer->CastSpell(killer, SPELL_RECRUIT, true); @@ -700,7 +700,7 @@ void BattlefieldWG::PromotePlayer(Player* killer) { killer->RemoveAura(SPELL_CORPORAL); killer->CastSpell(killer, SPELL_LIEUTENANT, true); - SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK); + SendWarning(BATTLEFIELD_WG_TEXT_SECONDRANK, killer); } else killer->CastSpell(killer, SPELL_CORPORAL, true); @@ -1116,7 +1116,7 @@ void BfWGGameObjectBuilding::Damaged() // Send warning message if (m_NameId) // tower damage + name - m_WG->SendWarningToAllInZone(m_NameId); + m_WG->SendWarning(m_NameId); for (ObjectGuid guid : m_CreatureTopList[m_WG->GetAttackerTeam()]) if (Creature* creature = m_WG->GetCreature(guid)) @@ -1140,7 +1140,7 @@ void BfWGGameObjectBuilding::Destroyed() // Warn players if (m_NameId) - m_WG->SendWarningToAllInZone(m_NameId); + m_WG->SendWarning(m_NameId); switch (m_Type) { @@ -1447,7 +1447,7 @@ void WGWorkshop::GiveControlTo(uint8 team, bool init) { // Send warning message to all player to inform a faction attack to a workshop // alliance / horde attacking a workshop - bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1); + bf->SendWarning(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1); break; } case BATTLEFIELD_WG_TEAM_ALLIANCE: @@ -1459,7 +1459,7 @@ void WGWorkshop::GiveControlTo(uint8 team, bool init) // Warning message if (!init) // workshop taken - alliance - bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1); + bf->SendWarning(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1); // Found associate graveyard and update it if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) @@ -1530,7 +1530,7 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init) { // Send warning message to all player for inform a faction attack a workshop // alliance / horde attacking workshop - m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1); + m_WG->SendWarning(m_TeamControl ? m_NameId : m_NameId + 1); break; } case BATTLEFIELD_WG_TEAM_ALLIANCE: @@ -1562,7 +1562,7 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init) // Warning message if (!init) // workshop taken - alliance - m_WG->SendWarningToAllInZone(m_NameId); + m_WG->SendWarning(m_NameId); // Found associate graveyard and update it if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) @@ -1600,7 +1600,7 @@ void WintergraspWorkshopData::GiveControlTo(uint8 team, bool init) // Warning message if (!init) // workshop taken - horde - m_WG->SendWarningToAllInZone(m_NameId + 1); + m_WG->SendWarning(m_NameId + 1); // Update graveyard control if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp index cf40e248808..989d5dc5b05 100644 --- a/src/server/game/Entities/Object/ObjectGuid.cpp +++ b/src/server/game/Entities/Object/ObjectGuid.cpp @@ -48,7 +48,7 @@ char const* ObjectGuid::GetTypeName(HighGuid high) std::string ObjectGuid::ToString() const { std::ostringstream str; - str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << m_guid << std::dec; + str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << _guid << std::dec; str << " Type: " << GetTypeName(); if (HasEntry()) str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " "; @@ -60,12 +60,12 @@ std::string ObjectGuid::ToString() const template uint32 ObjectGuidGenerator::Generate() { - if (m_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1) + if (_nextGuid >= ObjectGuid::GetMaxCounter(high) - 1) { TC_LOG_ERROR("", "%s guid overflow!! Can't continue, shutting down server. ", ObjectGuid::GetTypeName(high)); World::StopNow(ERROR_EXIT_CODE); } - return m_nextGuid++; + return _nextGuid++; } ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid) @@ -82,13 +82,13 @@ ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid) ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid) { - buf.append(guid.m_packedGuid); + buf.append(guid._packedGuid); return buf; } ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid) { - buf.readPackGUID(*reinterpret_cast(guid.m_guidPtr)); + buf.readPackGUID(*reinterpret_cast(guid.GuidPtr)); return buf; } diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h index 30b7b1e0293..ebc24e78cad 100644 --- a/src/server/game/Entities/Object/ObjectGuid.h +++ b/src/server/game/Entities/Object/ObjectGuid.h @@ -73,8 +73,8 @@ class PackedGuid; struct PackedGuidReader { - explicit PackedGuidReader(ObjectGuid& guid) : m_guidPtr(&guid) {} - ObjectGuid* m_guidPtr; + explicit PackedGuidReader(ObjectGuid& guid) : GuidPtr(&guid) { } + ObjectGuid* GuidPtr; }; class ObjectGuid @@ -82,27 +82,27 @@ class ObjectGuid public: static ObjectGuid const Empty; - ObjectGuid() : m_guid(0) {} - explicit ObjectGuid(uint64 guid) : m_guid(guid) {} - ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) {} - ObjectGuid(HighGuid hi, uint32 counter) : m_guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) {} + ObjectGuid() : _guid(0) { } + explicit ObjectGuid(uint64 guid) : _guid(guid) { } + ObjectGuid(HighGuid hi, uint32 entry, uint32 counter) : _guid(counter ? uint64(counter) | (uint64(entry) << 24) | (uint64(hi) << 48) : 0) { } + ObjectGuid(HighGuid hi, uint32 counter) : _guid(counter ? uint64(counter) | (uint64(hi) << 48) : 0) { } - operator uint64() const { return m_guid; } + operator uint64() const { return _guid; } PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); } - void Set(uint64 guid) { m_guid = guid; } - void Clear() { m_guid = 0; } + void Set(uint64 guid) { _guid = guid; } + void Clear() { _guid = 0; } PackedGuid WriteAsPacked() const; - uint64 GetRawValue() const { return m_guid; } - HighGuid GetHigh() const { return HighGuid((m_guid >> 48) & 0x0000FFFF); } - uint32 GetEntry() const { return HasEntry() ? uint32((m_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } + uint64 GetRawValue() const { return _guid; } + HighGuid GetHigh() const { return HighGuid((_guid >> 48) & 0x0000FFFF); } + uint32 GetEntry() const { return HasEntry() ? uint32((_guid >> 24) & UI64LIT(0x0000000000FFFFFF)) : 0; } uint32 GetCounter() const { return HasEntry() - ? uint32(m_guid & UI64LIT(0x0000000000FFFFFF)) - : uint32(m_guid & UI64LIT(0x00000000FFFFFFFF)); + ? uint32(_guid & UI64LIT(0x0000000000FFFFFF)) + : uint32(_guid & UI64LIT(0x00000000FFFFFFFF)); } static uint32 GetMaxCounter(HighGuid high) @@ -114,7 +114,7 @@ class ObjectGuid uint32 GetMaxCounter() const { return GetMaxCounter(GetHigh()); } - bool IsEmpty() const { return m_guid == 0; } + bool IsEmpty() const { return _guid == 0; } bool IsCreature() const { return GetHigh() == HIGHGUID_UNIT; } bool IsPet() const { return GetHigh() == HIGHGUID_PET; } bool IsVehicle() const { return GetHigh() == HIGHGUID_VEHICLE; } @@ -194,7 +194,7 @@ class ObjectGuid ObjectGuid(HighGuid, uint32, uint64 counter) = delete; // no implementation, used to catch wrong type assignment ObjectGuid(HighGuid, uint64 counter) = delete; // no implementation, used to catch wrong type assignment - uint64 m_guid; + uint64 _guid; }; // Some Shared defines @@ -210,32 +210,32 @@ class PackedGuid { friend ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid); - public: // constructors - explicit PackedGuid() : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(0); } - explicit PackedGuid(uint64 guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid); } - explicit PackedGuid(ObjectGuid guid) : m_packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { m_packedGuid.appendPackGUID(guid.GetRawValue()); } + public: + explicit PackedGuid() : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(0); } + explicit PackedGuid(uint64 guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(guid); } + explicit PackedGuid(ObjectGuid guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(guid.GetRawValue()); } - void Set(uint64 guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid); } - void Set(ObjectGuid guid) { m_packedGuid.wpos(0); m_packedGuid.appendPackGUID(guid.GetRawValue()); } + void Set(uint64 guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid); } + void Set(ObjectGuid guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); } - size_t size() const { return m_packedGuid.size(); } + size_t size() const { return _packedGuid.size(); } - private: // fields - ByteBuffer m_packedGuid; + private: + ByteBuffer _packedGuid; }; template class ObjectGuidGenerator { - public: // constructors - explicit ObjectGuidGenerator(uint32 start = 1) : m_nextGuid(start) {} + public: + explicit ObjectGuidGenerator(uint32 start = 1) : _nextGuid(start) { } - void Set(uint32 val) { m_nextGuid = val; } + void Set(uint32 val) { _nextGuid = val; } uint32 Generate(); - uint32 GetNextAfterMaxUsed() const { return m_nextGuid; } + uint32 GetNextAfterMaxUsed() const { return _nextGuid; } - private: // fields - uint32 m_nextGuid; + private: + uint32 _nextGuid; }; ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid); @@ -249,7 +249,7 @@ inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); namespace std { template<> - class hash + struct hash { public: size_t operator()(ObjectGuid const& key) const diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index 05769c84f94..1633df67d58 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -24,7 +24,6 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CreatureTextMgr.h" -#include "Group.h" class CreatureTextBuilder { diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index d6fa2b2492c..a2539e6c18d 100644 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -23,6 +23,7 @@ #include "ObjectAccessor.h" #include "SharedDefines.h" #include "Opcodes.h" +#include "Group.h" enum CreatureTextRange { diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index fe74997bb39..b0059de7e27 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -198,7 +198,7 @@ class npc_wg_spirit_guide : public CreatureScript GraveyardVect graveyard = wintergrasp->GetGraveyardVector(); for (uint8 i = 0; i < graveyard.size(); i++) if (graveyard[i]->GetControlTeamId() == player->GetTeamId()) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; @@ -292,7 +292,7 @@ class npc_wg_queue : public CreatureScript if (wintergrasp->IsWarTime()) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else @@ -301,7 +301,7 @@ class npc_wg_queue : public CreatureScript player->SendUpdateWorldState(4354, time(NULL) + timer); if (timer < 15 * MINUTE) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); } else -- cgit v1.2.3