diff options
Diffstat (limited to 'src')
25 files changed, 360 insertions, 454 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 3b99529853f..64845c6686e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -771,7 +771,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.fleeAssist.withEmote) { - Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST); + Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_FLEE_FOR_ASSIST, me->getGender()); sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUID().GetCounter()); @@ -1009,7 +1009,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u target->ToCreature()->CallForHelp(float(e.action.callHelp.range)); if (e.action.callHelp.withEmote) { - Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP); + Trinity::BroadcastTextBuilder builder(me, CHAT_MSG_MONSTER_EMOTE, BROADCAST_TEXT_CALL_FOR_HELP, me->getGender()); sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE); } TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_CALL_FOR_HELP: Creature %u, target: %u", me->GetGUID().GetCounter(), target->GetGUID().GetCounter()); diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 498db45909a..0cc53de0cb5 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -650,7 +650,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId())) { - Trinity::BroadcastTextBuilder _builder(GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, GetPlayer(), achievement->ID); + Trinity::BroadcastTextBuilder _builder(GetPlayer(), CHAT_MSG_GUILD_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, GetPlayer()->getGender(), GetPlayer(), achievement->ID); Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> _localizer(_builder); guild->BroadcastWorker(_localizer, GetPlayer()); } @@ -675,7 +675,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement) // if player is in world he can tell his friends about new achievement else if (GetPlayer()->IsInWorld()) { - Trinity::BroadcastTextBuilder _builder(GetPlayer(), CHAT_MSG_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, GetPlayer(), achievement->ID); + Trinity::BroadcastTextBuilder _builder(GetPlayer(), CHAT_MSG_ACHIEVEMENT, BROADCAST_TEXT_ACHIEVEMENT_EARNED, GetPlayer()->getGender(), GetPlayer(), achievement->ID); Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> _localizer(_builder); Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder>> _worker(GetPlayer(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), _localizer); Cell::VisitWorldObjects(GetPlayer(), _worker, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY)); diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index 52adce14a8d..e1ff192e65f 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -18,7 +18,6 @@ #include "Arena.h" #include "ArenaScore.h" #include "ArenaTeamMgr.h" -#include "Language.h" #include "Log.h" #include "ObjectAccessor.h" #include "Player.h" @@ -65,10 +64,10 @@ Arena::Arena() StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_FIRST] = ARENA_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_SECOND] = ARENA_TEXT_START_THIRTY_SECONDS; + StartMessageIds[BG_STARTING_EVENT_THIRD] = ARENA_TEXT_START_FIFTEEN_SECONDS; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = ARENA_TEXT_START_BATTLE_HAS_BEGUN; } void Arena::AddPlayer(Player* player) diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index dc4dc662bd2..3e09c0158ee 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.h @@ -20,6 +20,14 @@ #include "Battleground.h" +enum ArenaBroadcastTexts +{ + ARENA_TEXT_START_ONE_MINUTE = 15740, + ARENA_TEXT_START_THIRTY_SECONDS = 15741, + ARENA_TEXT_START_FIFTEEN_SECONDS = 15739, + ARENA_TEXT_START_BATTLE_HAS_BEGUN = 15742, +}; + enum ArenaSpellIds { SPELL_ALLIANCE_GOLD_FLAG = 32724, diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 33eaac77962..96d91da4330 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -20,7 +20,7 @@ #include "ArenaScore.h" #include "BattlegroundMgr.h" #include "BattlegroundScore.h" -#include "Chat.h" +#include "ChatTextBuilder.h" #include "Creature.h" #include "CreatureTextMgr.h" #include "DatabaseEnv.h" @@ -54,72 +54,6 @@ void BattlegroundScore::AppendToPacket(WorldPacket& data) BuildObjectivesBlock(data); } -namespace Trinity -{ - class BattlegroundChatBuilder - { - public: - BattlegroundChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, va_list* args = nullptr) - : _msgtype(msgtype), _textId(textId), _source(source), _args(args) { } - - void operator()(WorldPacket& data, LocaleConstant loc_idx) - { - char const* text = sObjectMgr->GetTrinityString(_textId, loc_idx); - if (_args) - { - // we need copy va_list before use or original va_list will corrupted - va_list ap; - va_copy(ap, *_args); - - char str[2048]; - vsnprintf(str, 2048, text, ap); - va_end(ap); - - do_helper(data, &str[0]); - } - else - do_helper(data, text); - } - - private: - void do_helper(WorldPacket& data, char const* text) - { - ChatHandler::BuildChatPacket(data, _msgtype, LANG_UNIVERSAL, _source, _source, text); - } - - ChatMsg _msgtype; - uint32 _textId; - Player const* _source; - va_list* _args; - }; - - class Battleground2ChatBuilder - { - public: - Battleground2ChatBuilder(ChatMsg msgtype, uint32 textId, Player const* source, uint32 arg1, uint32 arg2) - : _msgtype(msgtype), _textId(textId), _source(source), _arg1(arg1), _arg2(arg2) { } - - void operator()(WorldPacket& data, LocaleConstant loc_idx) - { - char const* text = sObjectMgr->GetTrinityString(_textId, loc_idx); - char const* arg1str = _arg1 ? sObjectMgr->GetTrinityString(_arg1, loc_idx) : ""; - char const* arg2str = _arg2 ? sObjectMgr->GetTrinityString(_arg2, loc_idx) : ""; - - char str[2048]; - snprintf(str, 2048, text, arg1str, arg2str); - - ChatHandler::BuildChatPacket(data, _msgtype, LANG_UNIVERSAL, _source, _source, str); - } - - private: - ChatMsg _msgtype; - uint32 _textId; - Player const* _source; - uint32 _arg1; - uint32 _arg2; - }; -} // namespace Trinity - template<class Do> void Battleground::BroadcastWorker(Do& _do) { @@ -190,11 +124,11 @@ Battleground::Battleground() StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_1M; StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; - //we must set to some default existing values - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + + StartMessageIds[BG_STARTING_EVENT_FIRST] = BG_TEXT_START_TWO_MINUTES; + StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_TEXT_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_TEXT_BATTLE_HAS_BEGUN; } Battleground::~Battleground() @@ -489,19 +423,22 @@ inline void Battleground::_ProcessJoin(uint32 diff) StartingEventCloseDoors(); SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FIRST]); // First start warning - 2 or 1 minute - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); + if (StartMessageIds[BG_STARTING_EVENT_FIRST]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 1 minute or 30 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) { m_Events |= BG_STARTING_EVENT_2; - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); + if (StartMessageIds[BG_STARTING_EVENT_SECOND]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_SECOND], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 30 or 15 seconds, warning is signaled else if (GetStartDelayTime() <= StartDelayTimes[BG_STARTING_EVENT_THIRD] && !(m_Events & BG_STARTING_EVENT_3)) { m_Events |= BG_STARTING_EVENT_3; - SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); + if (StartMessageIds[BG_STARTING_EVENT_THIRD]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // Delay expired (after 2 or 1 minute) else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4)) @@ -510,7 +447,8 @@ inline void Battleground::_ProcessJoin(uint32 diff) StartingEventOpenDoors(); - SendWarningToAll(StartMessageIds[BG_STARTING_EVENT_FOURTH]); + if (StartMessageIds[BG_STARTING_EVENT_FOURTH]) + SendBroadcastText(StartMessageIds[BG_STARTING_EVENT_FOURTH], CHAT_MSG_BG_SYSTEM_NEUTRAL); SetStatus(STATUS_IN_PROGRESS); SetStartDelayTime(StartDelayTimes[BG_STARTING_EVENT_FOURTH]); @@ -650,10 +588,23 @@ void Battleground::SendChatMessage(Creature* source, uint8 textId, WorldObject* sCreatureTextMgr->SendChat(source, textId, target); } -void Battleground::PlaySoundToAll(uint32 SoundID) +void Battleground::SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target) +{ + if (!sObjectMgr->GetBroadcastText(id)) + { + TC_LOG_ERROR("bg.battleground", "Battleground::SendBroadcastText: `broadcast_text` (ID: %u) was not found", id); + return; + } + + Trinity::BroadcastTextBuilder builder(nullptr, msgType, id, GENDER_MALE, target); + Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> localizer(builder); + BroadcastWorker(localizer); +} + +void Battleground::PlaySoundToAll(uint32 soundID) { WorldPacket data; - sBattlegroundMgr->BuildPlaySoundPacket(&data, SoundID); + sBattlegroundMgr->BuildPlaySoundPacket(&data, soundID); SendPacketToAll(&data); } @@ -726,11 +677,10 @@ void Battleground::EndBattleground(uint32 winner) { RemoveFromBGFreeSlotQueue(); - int32 winmsg_id = 0; - if (winner == ALLIANCE) { - winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; + if (isBattleground()) + SendBroadcastText(BG_TEXT_ALLIANCE_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound @@ -738,7 +688,8 @@ void Battleground::EndBattleground(uint32 winner) } else if (winner == HORDE) { - winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS; + if (isBattleground()) + SendBroadcastText(BG_TEXT_HORDE_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound @@ -859,9 +810,6 @@ void Battleground::EndBattleground(uint32 winner) player->SendDirectMessage(&data); player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, player->GetMapId()); } - - if (winmsg_id) - SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL); } uint32 Battleground::GetBonusHonorFromKill(uint32 kills) const @@ -1615,17 +1563,17 @@ bool Battleground::AddSpiritGuide(uint32 type, Position const& pos, TeamId teamI return AddSpiritGuide(type, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teamId); } -void Battleground::SendMessageToAll(uint32 entry, ChatMsg type, Player const* source) +void Battleground::SendMessageToAll(uint32 entry, ChatMsg msgType, Player const* source) { if (!entry) return; - Trinity::BattlegroundChatBuilder bg_builder(type, entry, source); - Trinity::LocalizedPacketDo<Trinity::BattlegroundChatBuilder> bg_do(bg_builder); - BroadcastWorker(bg_do); + Trinity::TrinityStringChatBuilder builder(nullptr, msgType, entry, source); + Trinity::LocalizedPacketDo<Trinity::TrinityStringChatBuilder> localizer(builder); + BroadcastWorker(localizer); } -void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...) +void Battleground::PSendMessageToAll(uint32 entry, ChatMsg msgType, Player const* source, ...) { if (!entry) return; @@ -1633,46 +1581,13 @@ void Battleground::PSendMessageToAll(uint32 entry, ChatMsg type, Player const* s va_list ap; va_start(ap, source); - Trinity::BattlegroundChatBuilder bg_builder(type, entry, source, &ap); - Trinity::LocalizedPacketDo<Trinity::BattlegroundChatBuilder> bg_do(bg_builder); - BroadcastWorker(bg_do); + Trinity::TrinityStringChatBuilder builder(nullptr, msgType, entry, source, &ap); + Trinity::LocalizedPacketDo<Trinity::TrinityStringChatBuilder> localizer(builder); + BroadcastWorker(localizer); va_end(ap); } -void Battleground::SendWarningToAll(uint32 entry, ...) -{ - if (!entry) - return; - - std::map<uint32, WorldPacket> localizedPackets; - for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - if (Player* player = _GetPlayer(itr, "SendWarningToAll")) - { - if (localizedPackets.find(player->GetSession()->GetSessionDbLocaleIndex()) == localizedPackets.end()) - { - char const* format = sObjectMgr->GetTrinityString(entry, player->GetSession()->GetSessionDbLocaleIndex()); - - char str[1024]; - va_list ap; - va_start(ap, entry); - vsnprintf(str, 1024, format, ap); - va_end(ap); - - ChatHandler::BuildChatPacket(localizedPackets[player->GetSession()->GetSessionDbLocaleIndex()], CHAT_MSG_RAID_BOSS_EMOTE, LANG_UNIVERSAL, nullptr, nullptr, str); - } - - player->SendDirectMessage(&localizedPackets[player->GetSession()->GetSessionDbLocaleIndex()]); - } -} - -void Battleground::SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 arg1, uint32 arg2) -{ - Trinity::Battleground2ChatBuilder bg_builder(type, entry, source, arg1, arg2); - Trinity::LocalizedPacketDo<Trinity::Battleground2ChatBuilder> bg_do(bg_builder); - BroadcastWorker(bg_do); -} - void Battleground::EndNow() { RemoveFromBGFreeSlotQueue(); diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 329019f8988..02966e77e55 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -59,6 +59,17 @@ enum BattlegroundCriteriaId BG_CRITERIA_CHECK_NOT_EVEN_A_SCRATCH, }; +enum BattlegroundBroadcastTexts +{ + BG_TEXT_ALLIANCE_WINS = 10633, + BG_TEXT_HORDE_WINS = 10634, + + BG_TEXT_START_TWO_MINUTES = 18193, + BG_TEXT_START_ONE_MINUTE = 18194, + BG_TEXT_START_HALF_MINUTE = 18195, + BG_TEXT_BATTLE_HAS_BEGUN = 18196, +}; + enum BattlegroundSounds { SOUND_HORDE_WINS = 8454, @@ -356,6 +367,7 @@ class TC_GAME_API Battleground void SendPacketToAll(WorldPacket* packet); void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = nullptr); + void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr); template<class Do> void BroadcastWorker(Do& _do); @@ -375,9 +387,6 @@ class TC_GAME_API Battleground void SendMessageToAll(uint32 entry, ChatMsg type, Player const* source = nullptr); void PSendMessageToAll(uint32 entry, ChatMsg type, Player const* source, ...); - // specialized version with 2 string id args - void SendMessage2ToAll(uint32 entry, ChatMsg type, Player const* source, uint32 strId1 = 0, uint32 strId2 = 0); - // Raid Group Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[TEAM_ALLIANCE] : m_BgRaids[TEAM_HORDE]; } void SetBgRaid(uint32 TeamID, Group* bg_raid); diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 4aa51c47143..7b1513f0bb9 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -37,6 +37,7 @@ #include "Formulas.h" #include "GameEventMgr.h" #include "GameTime.h" +#include "Language.h" #include "Map.h" #include "MapManager.h" #include "SharedDefines.h" diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 1d1c7a1e0aa..ab1aac5b657 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -21,7 +21,6 @@ #include "Creature.h" #include "DBCStores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "Player.h" @@ -64,11 +63,6 @@ BattlegroundAB::BattlegroundAB() m_HonorTics = 0; m_ReputationTics = 0; - - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; } BattlegroundAB::~BattlegroundAB() { } @@ -110,19 +104,17 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) // create new occupied banner _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); - _NodeOccupied(node, (teamIndex == 0) ? ALLIANCE:HORDE); + _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE : HORDE); // Message to chatlog - if (teamIndex == 0) + if (teamIndex == TEAM_ALLIANCE) { - // FIXME: team and node names not localized - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, nullptr, LANG_BG_AB_ALLY, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE); } else { - // FIXME: team and node names not localized - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, nullptr, LANG_BG_AB_HORDE, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE); } } @@ -164,9 +156,9 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff) if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE) { if (team == TEAM_ALLIANCE) - SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_AB_TEXT_ALLIANCE_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); else - SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_AB_TEXT_HORDE_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY); m_IsInformedNearVictory = true; } @@ -311,21 +303,6 @@ void BattlegroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) SpawnBGObject(obj, RESPAWN_ONE_DAY); } -int32 BattlegroundAB::_GetNodeNameId(uint8 node) -{ - switch (node) - { - case BG_AB_NODE_STABLES: return LANG_BG_AB_NODE_STABLES; - case BG_AB_NODE_BLACKSMITH: return LANG_BG_AB_NODE_BLACKSMITH; - case BG_AB_NODE_FARM: return LANG_BG_AB_NODE_FARM; - case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL; - case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE; - default: - ABORT(); - } - return 0; -} - void BattlegroundAB::FillInitialWorldStates(WorldPacket& data) { const uint8 plusArray[] = {0, 2, 3, 0, 1}; @@ -473,11 +450,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: team and node names not localized - if (teamIndex == 0) - SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY); + if (teamIndex == TEAM_ALLIANCE) + SendBroadcastText(ABNodes[node].TextAllianceClaims, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); + SendBroadcastText(ABNodes[node].TextHordeClaims, CHAT_MSG_BG_SYSTEM_HORDE, source); sound = BG_AB_SOUND_NODE_CLAIMED; } @@ -497,11 +473,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, source); } // If contested, change back to occupied else @@ -515,13 +490,12 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; - _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE:HORDE); + _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE : HORDE); - // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeDefended, CHAT_MSG_BG_SYSTEM_HORDE, source); } sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } @@ -539,11 +513,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ _NodeDeOccupied(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; - // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else - SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, source); sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } @@ -551,11 +524,10 @@ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*targ // If node is occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { - // FIXME: team and node names not localized if (teamIndex == TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, nullptr, LANG_BG_AB_ALLY, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE); else - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, nullptr, LANG_BG_AB_HORDE, _GetNodeNameId(node)); + SendBroadcastText(ABNodes[node].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE); } PlaySoundToAll(sound); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index cfdc7ad1b08..7a1d1290c04 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -152,6 +152,34 @@ enum BG_AB_BattlegroundNodes BG_AB_ALL_NODES_COUNT = 7 // all nodes (dynamic and static) }; +enum BG_AB_BroadcastTexts +{ + BG_AB_TEXT_ALLIANCE_NEAR_VICTORY = 10598, + BG_AB_TEXT_HORDE_NEAR_VICTORY = 10599, +}; + +struct ABNodeInfo +{ + uint32 NodeId; + uint32 TextAllianceAssaulted; + uint32 TextHordeAssaulted; + uint32 TextAllianceTaken; + uint32 TextHordeTaken; + uint32 TextAllianceDefended; + uint32 TextHordeDefended; + uint32 TextAllianceClaims; + uint32 TextHordeClaims; +}; + +ABNodeInfo const ABNodes[BG_AB_DYNAMIC_NODES_COUNT] = +{ + { BG_AB_NODE_STABLES, 10199, 10200, 10203, 10204, 10201, 10202, 10286, 10287 }, + { BG_AB_NODE_BLACKSMITH, 10211, 10212, 10213, 10214, 10215, 10216, 10290, 10291 }, + { BG_AB_NODE_FARM, 10217, 10218, 10219, 10220, 10221, 10222, 10288, 10289 }, + { BG_AB_NODE_LUMBER_MILL, 10224, 10225, 10226, 10227, 10228, 10229, 10284, 10285 }, + { BG_AB_NODE_GOLD_MINE, 10230, 10231, 10232, 10233, 10234, 10235, 10282, 10283 } +}; + enum BG_AB_NodeStatus { BG_AB_NODE_TYPE_NEUTRAL = 0, @@ -310,8 +338,6 @@ class BattlegroundAB : public Battleground void _NodeOccupied(uint8 node, Team team); void _NodeDeOccupied(uint8 node); - int32 _GetNodeNameId(uint8 node); - /* Nodes info: 0: neutral 1: ally contested diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index ac723c914ec..b68dc070ae4 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -21,7 +21,6 @@ #include "CreatureAI.h" #include "DBCStores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "MotionMaster.h" #include "ObjectMgr.h" @@ -61,10 +60,9 @@ BattlegroundAV::BattlegroundAV() for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) InitNode(i, 0, false); - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_AV_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_AV_TEXT_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_AV_TEXT_BATTLE_HAS_BEGUN; } BattlegroundAV::~BattlegroundAV() { } @@ -274,7 +272,10 @@ void BattlegroundAV::UpdateScore(uint16 team, int16 points) } else if (!m_IsInformedNearVictory[teamindex] && m_Team_Scores[teamindex] < SEND_MSG_NEAR_LOSE) { - SendMessageToAll(teamindex == TEAM_HORDE?LANG_BG_AV_H_NEAR_LOSE:LANG_BG_AV_A_NEAR_LOSE, teamindex == TEAM_HORDE ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE); + if (teamindex == TEAM_ALLIANCE) + SendBroadcastText(BG_AV_TEXT_ALLIANCE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_ALLIANCE); + else + SendBroadcastText(BG_AV_TEXT_HORDE_NEAR_LOSE, CHAT_MSG_BG_SYSTEM_HORDE); PlaySoundToAll(AV_SOUND_NEAR_VICTORY); m_IsInformedNearVictory[teamindex] = true; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 7bb0f94011e..361a4f70524 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -55,6 +55,16 @@ enum SharedActions ACTION_BUFF_YELL = -30001 }; +enum BG_AV_BroadcastTexts +{ + BG_AV_TEXT_START_ONE_MINUTE = 10638, + BG_AV_TEXT_START_HALF_MINUTE = 10639, + BG_AV_TEXT_BATTLE_HAS_BEGUN = 10640, + + BG_AV_TEXT_ALLIANCE_NEAR_LOSE = 23210, + BG_AV_TEXT_HORDE_NEAR_LOSE = 23211 +}; + enum BG_AV_Sounds { /// @todo: get out if there comes a sound when neutral team captures mine diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index e8b6626b6e3..9623e8cc284 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -22,7 +22,6 @@ #include "Creature.h" #include "DBCStores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "Player.h" @@ -74,11 +73,6 @@ BattlegroundEY::BattlegroundEY() for (uint8 i = 0; i < 2 * EY_POINTS_MAX; ++i) m_CurrentPointPlayersCount[i] = 0; - - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; } BattlegroundEY::~BattlegroundEY() { } @@ -303,16 +297,6 @@ void BattlegroundEY::UpdatePointStatuses() void BattlegroundEY::UpdateTeamScore(uint32 Team) { uint32 score = GetTeamScore(Team); - /// @todo there should be some sound played when one team is near victory!! - and define variables - /*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE) - { - if (Team == ALLIANCE) - SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - else - SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY); - m_IsInformedNearVictory = true; - }*/ if (score >= BG_EY_MAX_TEAM_SCORE) { @@ -589,7 +573,7 @@ void BattlegroundEY::RespawnFlag(bool send_message) if (send_message) { - SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_EY_TEXT_FLAG_RESET, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound... } @@ -650,9 +634,9 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player) UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN); if (player->GetTeam() == ALLIANCE) - SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, nullptr); + SendBroadcastText(BG_EY_TEXT_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE); else - SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, nullptr); + SendBroadcastText(BG_EY_TEXT_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE); } void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) @@ -682,9 +666,9 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* target player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (player->GetTeam() == ALLIANCE) - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, nullptr, player->GetName().c_str()); + SendBroadcastText(BG_EY_TEXT_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, nullptr, player->GetName().c_str()); + SendBroadcastText(BG_EY_TEXT_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); } void BattlegroundEY::EventTeamLostPoint(Player* player, uint32 Point) @@ -723,9 +707,9 @@ void BattlegroundEY::EventTeamLostPoint(Player* player, uint32 Point) m_PointState[Point] = EY_POINT_NO_OWNER; if (Team == ALLIANCE) - SendMessageToAll(m_LosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(m_LosingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - SendMessageToAll(m_LosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(m_LosingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); @@ -766,9 +750,9 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) m_PointState[Point] = EY_POINT_UNDER_CONTROL; if (Team == ALLIANCE) - SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); if (BgCreatures[Point]) DelCreature(Point); @@ -809,27 +793,22 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (player->GetTeam() == ALLIANCE) + { + SendBroadcastText(BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE); + } else + { + SendBroadcastText(BG_EY_TEXT_HORDE_CAPTURED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE); + } SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY); m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME; m_FlagCapturedBgObjectType = BgObjectType; - uint8 team_id = 0; - if (player->GetTeam() == ALLIANCE) - { - team_id = TEAM_ALLIANCE; - SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); - } - else - { - team_id = TEAM_HORDE; - SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player); - } - + uint8 team_id = player->GetTeam() == ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE; if (m_TeamPointsCount[team_id] > 0) AddPoints(player->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 9bdcbbcf29b..ae44f090e65 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -21,7 +21,6 @@ #include "Battleground.h" #include "BattlegroundScore.h" -#include "Language.h" #include "Object.h" enum BG_EY_Misc @@ -248,6 +247,35 @@ enum BG_EY_Objectives EY_OBJECTIVE_CAPTURE_FLAG = 183 }; +enum BG_EY_BroadcastTexts +{ + BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS = 17828, + BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS = 17829, + BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS = 17835, + BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS = 17836, + + BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER = 17819, + BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER = 17823, + BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER = 17831, + BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER = 17832, + + BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS = 17826, + BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS = 17827, + BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS = 17833, + BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS = 17834, + + BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER = 17824, + BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER = 17825, + BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER = 17837, + BG_EY_TEXT_HORDE_LOST_MAGE_TOWER = 17838, + + BG_EY_TEXT_TAKEN_FLAG = 18359, + BG_EY_TEXT_FLAG_DROPPED = 18361, + BG_EY_TEXT_FLAG_RESET = 18364, + BG_EY_TEXT_ALLIANCE_CAPTURED_FLAG = 18375, + BG_EY_TEXT_HORDE_CAPTURED_FLAG = 18384, +}; + struct BattlegroundEYPointIconsStruct { BattlegroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex) @@ -310,17 +338,17 @@ const BattlegroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] = }; const BattlegroundEYLosingPointStruct m_LosingPointTypes[EY_POINTS_MAX] = { - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS), - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER), - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS), - BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER) + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_ALLIANCE_LOST_FEL_REAVER_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_HORDE_LOST_FEL_REAVER_RUINS), + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_ALLIANCE_LOST_BLOOD_ELF_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_HORDE_LOST_BLOOD_ELF_TOWER), + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_ALLIANCE_LOST_DRAENEI_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_HORDE_LOST_DRAENEI_RUINS), + BattlegroundEYLosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_ALLIANCE_LOST_MAGE_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_HORDE_LOST_MAGE_TOWER) }; const BattlegroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] = { - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REAVER), - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF), - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), - BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER) + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REAVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_FEL_REAVER_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REAVER_CENTER, BG_EY_TEXT_HORDE_TAKEN_FEL_REAVER_RUINS, EY_GRAVEYARD_FEL_REAVER), + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_BLOOD_ELF_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_EY_TEXT_HORDE_TAKEN_BLOOD_ELF_TOWER, EY_GRAVEYARD_BLOOD_ELF), + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_DRAENEI_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_EY_TEXT_HORDE_TAKEN_DRAENEI_RUINS, EY_GRAVEYARD_DRAENEI_RUINS), + BattlegroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_ALLIANCE_TAKEN_MAGE_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_EY_TEXT_HORDE_TAKEN_MAGE_TOWER, EY_GRAVEYARD_MAGE_TOWER) }; struct BattlegroundEYScore final : public BattlegroundScore diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 128ad19a9f2..24c35476df7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -18,10 +18,8 @@ #include "BattlegroundIC.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" -#include "ObjectMgr.h" #include "Player.h" #include "ScriptedCreature.h" #include "Transport.h" @@ -40,11 +38,6 @@ BattlegroundIC::BattlegroundIC() BgObjects.resize(MAX_NORMAL_GAMEOBJECTS_SPAWNS + MAX_AIRSHIPS_SPAWNS + MAX_HANGAR_TELEPORTERS_SPAWNS + MAX_FORTRESS_TELEPORTERS_SPAWNS + MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS + MAX_FORTRESS_TELEPORTER_EFFECTS_SPAWNS); BgCreatures.resize(MAX_NORMAL_NPCS_SPAWNS + MAX_WORKSHOP_SPAWNS + MAX_DOCKS_SPAWNS + MAX_SPIRIT_GUIDES_SPAWNS + MAX_HANGAR_NPCS_SPAWNS); - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_IC_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_IC_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_IC_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_IC_HAS_BEGUN; - for (uint8 i = 0; i < 2; ++i) factionReinforcements[i] = MAX_REINFORCEMENTS; @@ -200,7 +193,10 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) UpdateNodeWorldState(&nodePoint[i]); HandleCapturedNodes(&nodePoint[i], false); - SendMessage2ToAll(LANG_BG_IC_TEAM_HAS_TAKEN_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, nullptr, (nodePoint[i].faction == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE), nodePoint[i].string); + if (nodePoint[i].faction == TEAM_ALLIANCE) + SendBroadcastText(ICNodes[i].TextAllianceTaken, CHAT_MSG_BG_SYSTEM_ALLIANCE); + else + SendBroadcastText(ICNodes[i].TextHordeTaken, CHAT_MSG_BG_SYSTEM_HORDE); nodePoint[i].needChange = false; nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; @@ -422,13 +418,6 @@ void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer) EndBattleground(killer->GetTeam()); } -void BattlegroundIC::EndBattleground(uint32 winner) -{ - SendMessage2ToAll(LANG_BG_IC_TEAM_WINS, CHAT_MSG_BG_SYSTEM_NEUTRAL, nullptr, (winner == ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE)); - - Battleground::EndBattleground(winner); -} - void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) @@ -466,15 +455,23 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1); - SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_1, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string); - SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE)); + if (nodePoint[i].faction == TEAM_ALLIANCE) + SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + else + SendBroadcastText(ICNodes[i].TextAssaulted, CHAT_MSG_BG_SYSTEM_HORDE, player); + HandleContestedNodes(&nodePoint[i]); } else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED]) // if we are going to spawn the definitve faction banner, we dont need the timer anymore { nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; nodePoint[i].needChange = false; - SendMessage2ToAll(LANG_BG_IC_TEAM_DEFENDED_NODE, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string); + + if (nodePoint[i].faction == TEAM_ALLIANCE) + SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + else + SendBroadcastText(ICNodes[i].TextDefended, CHAT_MSG_BG_SYSTEM_HORDE, player); + HandleCapturedNodes(&nodePoint[i], true); UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1); } @@ -818,26 +815,36 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) GetBGObject(BG_IC_GO_ALLIANCE_BANNER)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } - uint32 lang_entry = 0; - + uint32 textId; + ChatMsg msgType; switch (go->GetEntry()) { case GO_HORDE_GATE_1: - lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED; + textId = BG_IC_TEXT_FRONT_GATE_HORDE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE; break; case GO_HORDE_GATE_2: - case GO_ALLIANCE_GATE_1: - lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED; + textId = BG_IC_TEXT_WEST_GATE_HORDE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE; break; case GO_HORDE_GATE_3: + textId = BG_IC_TEXT_EAST_GATE_HORDE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_ALLIANCE; + break; + case GO_ALLIANCE_GATE_1: + textId = BG_IC_TEXT_WEST_GATE_ALLIANCE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_HORDE; + break; case GO_ALLIANCE_GATE_2: - lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED; + textId = BG_IC_TEXT_EAST_GATE_ALLIANCE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_HORDE; break; case GO_ALLIANCE_GATE_3: - lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED; + textId = BG_IC_TEXT_FRONT_GATE_ALLIANCE_DESTROYED; + msgType = CHAT_MSG_BG_SYSTEM_HORDE; break; default: - break; + return; } if (go->GetEntry() == GO_HORDE_GATE_1 || go->GetEntry() == GO_HORDE_GATE_2 || go->GetEntry() == GO_HORDE_GATE_3) @@ -851,7 +858,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go) TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE].entry); } - SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, nullptr, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP)); + SendBroadcastText(textId, msgType); } WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 66f50551129..11f305563b3 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -21,7 +21,6 @@ #include "Battleground.h" #include "BattlegroundScore.h" -#include "Language.h" #include "Object.h" const uint32 BG_IC_Factions[2] = @@ -847,6 +846,36 @@ Position const BG_IC_SpiritGuidePos[MAX_NODE_TYPES+2] = {1148.65f, -1250.98f, 16.60f, 1.74f}, // last resort horde }; +enum ICBroadcastTexts +{ + BG_IC_TEXT_FRONT_GATE_HORDE_DESTROYED = 35409, + BG_IC_TEXT_FRONT_GATE_ALLIANCE_DESTROYED = 35410, + BG_IC_TEXT_WEST_GATE_HORDE_DESTROYED = 35411, + BG_IC_TEXT_WEST_GATE_ALLIANCE_DESTROYED = 35412, + BG_IC_TEXT_EAST_GATE_HORDE_DESTROYED = 35413, + BG_IC_TEXT_EAST_GATE_ALLIANCE_DESTROYED = 35414 +}; + +struct ICNodeInfo +{ + uint32 NodeId; + uint32 TextAssaulted; + uint32 TextDefended; + uint32 TextAllianceTaken; + uint32 TextHordeTaken; +}; + +ICNodeInfo const ICNodes[MAX_NODE_TYPES] = +{ + { NODE_TYPE_REFINERY, 35377, 35378, 35379, 35380 }, + { NODE_TYPE_QUARRY, 35373, 35374, 35375, 35376 }, + { NODE_TYPE_DOCKS, 35365, 35366, 35367, 35368 }, + { NODE_TYPE_HANGAR, 35369, 35370, 35371, 35372 }, + { NODE_TYPE_WORKSHOP, 35278, 35286, 35279, 35280 }, + { NODE_TYPE_GRAVEYARD_A, 35461, 35459, 35463, 35466 }, + { NODE_TYPE_GRAVEYARD_H, 35462, 35460, 35464, 35465 } +}; + // I.E: Hangar, Quarry, Graveyards .. etc struct ICNodePoint { @@ -860,18 +889,17 @@ struct ICNodePoint uint32 last_entry; // the last gameobject_entry uint32 worldStates[5]; // the worldstates that represent the node in the map ICNodeState nodeState; - uint32 string; }; -const ICNodePoint nodePointInitial[7] = +const ICNodePoint nodePointInitial[MAX_NODE_TYPES] = { - {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_REFINERY}, - {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_QUARRY}, - {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_DOCKS}, - {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_HANGAR}, - {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H}, NODE_STATE_UNCONTROLLED, LANG_BG_IC_WORKSHOP}, - {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_A, LANG_BG_IC_ALLIANCE_KEEP}, - {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_H, LANG_BG_IC_HORDE_KEEP} + {BG_IC_GO_REFINERY_BANNER, GO_REFINERY_BANNER, TEAM_NEUTRAL, NODE_TYPE_REFINERY, {GO_ALLIANCE_BANNER_REFINERY, GO_ALLIANCE_BANNER_REFINERY_CONT, GO_HORDE_BANNER_REFINERY, GO_HORDE_BANNER_REFINERY_CONT}, false, 0, 0, {BG_IC_REFINERY_UNCONTROLLED, BG_IC_REFINERY_CONFLICT_A, BG_IC_REFINERY_CONFLICT_H, BG_IC_REFINERY_CONTROLLED_A, BG_IC_REFINERY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_QUARRY_BANNER, GO_QUARRY_BANNER, TEAM_NEUTRAL, NODE_TYPE_QUARRY, {GO_ALLIANCE_BANNER_QUARRY, GO_ALLIANCE_BANNER_QUARRY_CONT, GO_HORDE_BANNER_QUARRY, GO_HORDE_BANNER_QUARRY_CONT}, false, 0, 0, {BG_IC_QUARRY_UNCONTROLLED, BG_IC_QUARRY_CONFLICT_A, BG_IC_QUARRY_CONFLICT_H, BG_IC_QUARRY_CONTROLLED_A, BG_IC_QUARRY_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_DOCKS_BANNER, GO_DOCKS_BANNER, TEAM_NEUTRAL, NODE_TYPE_DOCKS, {GO_ALLIANCE_BANNER_DOCK, GO_ALLIANCE_BANNER_DOCK_CONT, GO_HORDE_BANNER_DOCK, GO_HORDE_BANNER_DOCK_CONT}, false, 0, 0, {BG_IC_DOCKS_UNCONTROLLED, BG_IC_DOCKS_CONFLICT_A, BG_IC_DOCKS_CONFLICT_H, BG_IC_DOCKS_CONTROLLED_A, BG_IC_DOCKS_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_HANGAR_BANNER, GO_HANGAR_BANNER, TEAM_NEUTRAL, NODE_TYPE_HANGAR, {GO_ALLIANCE_BANNER_HANGAR, GO_ALLIANCE_BANNER_HANGAR_CONT, GO_HORDE_BANNER_HANGAR, GO_HORDE_BANNER_HANGAR_CONT}, false, 0, 0, {BG_IC_HANGAR_UNCONTROLLED, BG_IC_HANGAR_CONFLICT_A, BG_IC_HANGAR_CONFLICT_H, BG_IC_HANGAR_CONTROLLED_A, BG_IC_HANGAR_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_WORKSHOP_BANNER, GO_WORKSHOP_BANNER, TEAM_NEUTRAL, NODE_TYPE_WORKSHOP, {GO_ALLIANCE_BANNER_WORKSHOP, GO_ALLIANCE_BANNER_WORKSHOP_CONT, GO_HORDE_BANNER_WORKSHOP, GO_HORDE_BANNER_WORKSHOP_CONT}, false, 0, 0, {BG_IC_WORKSHOP_UNCONTROLLED, BG_IC_WORKSHOP_CONFLICT_A, BG_IC_WORKSHOP_CONFLICT_H, BG_IC_WORKSHOP_CONTROLLED_A, BG_IC_WORKSHOP_CONTROLLED_H}, NODE_STATE_UNCONTROLLED}, + {BG_IC_GO_ALLIANCE_BANNER, GO_ALLIANCE_BANNER, TEAM_ALLIANCE, NODE_TYPE_GRAVEYARD_A, {GO_ALLIANCE_BANNER_GRAVEYARD_A, GO_ALLIANCE_BANNER_GRAVEYARD_A_CONT, GO_HORDE_BANNER_GRAVEYARD_A, GO_HORDE_BANNER_GRAVEYARD_A_CONT}, false, 0, 0, {BG_IC_ALLIANCE_KEEP_UNCONTROLLED, BG_IC_ALLIANCE_KEEP_CONFLICT_A, BG_IC_ALLIANCE_KEEP_CONFLICT_H, BG_IC_ALLIANCE_KEEP_CONTROLLED_A, BG_IC_ALLIANCE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_A}, + {BG_IC_GO_HORDE_BANNER, GO_HORDE_BANNER, TEAM_HORDE, NODE_TYPE_GRAVEYARD_H, {GO_ALLIANCE_BANNER_GRAVEYARD_H, GO_ALLIANCE_BANNER_GRAVEYARD_H_CONT, GO_HORDE_BANNER_GRAVEYARD_H, GO_HORDE_BANNER_GRAVEYARD_H_CONT}, false, 0, 0, {BG_IC_HORDE_KEEP_UNCONTROLLED, BG_IC_HORDE_KEEP_CONFLICT_A, BG_IC_HORDE_KEEP_CONFLICT_H, BG_IC_HORDE_KEEP_CONTROLLED_A, BG_IC_HORDE_KEEP_CONTROLLED_H}, NODE_STATE_CONTROLLED_H} }; enum HonorRewards @@ -930,7 +958,6 @@ class BattlegroundIC : public Battleground void SpawnLeader(uint32 teamid); void HandleKillUnit(Creature* unit, Player* killer) override; void HandleKillPlayer(Player* player, Player* killer) override; - void EndBattleground(uint32 winner) override; void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) override; void DestroyGate(Player* player, GameObject* go) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index dd94361fcfb..ec6658cc5d0 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -20,7 +20,6 @@ #include "DBCStores.h" #include "GameObject.h" #include "GameTime.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "ObjectAccessor.h" @@ -39,10 +38,7 @@ void BattlegroundSAScore::BuildObjectivesBlock(WorldPacket& data) BattlegroundSA::BattlegroundSA() { - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = 0; // handle by Kanrethad BgObjects.resize(BG_SA_MAXOBJ); BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY); @@ -332,7 +328,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) { SignaledRoundTwo = true; InitSecondRound = false; - SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_ROUND_TWO_START_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); } } else @@ -389,7 +385,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff) if (!SignaledRoundTwoHalfMin) { SignaledRoundTwoHalfMin = true; - SendMessageToAll(LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL); } } StartShips(); @@ -906,9 +902,9 @@ void BattlegroundSA::TitanRelicActivated(Player* clicker) if (clicker->GetTeamId() == Attackers) { if (clicker->GetTeamId() == TEAM_ALLIANCE) - SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_ALLIANCE_CAPTURED_TITAN_PORTAL, CHAT_MSG_BG_SYSTEM_ALLIANCE); else - SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_SA_TEXT_HORDE_CAPTURED_TITAN_PORTAL, CHAT_MSG_BG_SYSTEM_HORDE); if (Status == BG_SA_ROUND_ONE) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 38e2110d60d..bcb8fa1270f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -482,6 +482,15 @@ float const BG_SA_GYOrientation[BG_SA_MAX_GY] = 6.148f, // defender last GY }; +enum BG_SA_BroadcastTexts +{ + BG_SA_TEXT_ALLIANCE_CAPTURED_TITAN_PORTAL = 28944, + BG_SA_TEXT_HORDE_CAPTURED_TITAN_PORTAL = 28945, + + BG_SA_TEXT_ROUND_TWO_START_ONE_MINUTE = 29448, + BG_SA_TEXT_ROUND_TWO_START_HALF_MINUTE = 29449 +}; + struct GateInfo { uint8 GateId; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 2e2fca7e84e..5a8c2c81b7a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -20,7 +20,6 @@ #include "BattlegroundMgr.h" #include "DBCStores.h" #include "GameObject.h" -#include "Language.h" #include "Log.h" #include "Map.h" #include "Object.h" @@ -48,10 +47,10 @@ BattlegroundWS::BattlegroundWS() BgObjects.resize(BG_WS_OBJECT_MAX); BgCreatures.resize(BG_CREATURES_MAX_WS); - StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; - StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; - StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; - StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; + StartMessageIds[BG_STARTING_EVENT_SECOND] = BG_WS_TEXT_START_ONE_MINUTE; + StartMessageIds[BG_STARTING_EVENT_THIRD] = BG_WS_TEXT_START_HALF_MINUTE; + StartMessageIds[BG_STARTING_EVENT_FOURTH] = BG_WS_TEXT_BATTLE_HAS_BEGUN; + _flagSpellForceTimer = 0; _bothFlagsKept = false; _flagDebuffState = 0; @@ -258,7 +257,7 @@ void BattlegroundWS::RespawnFlag(uint32 Team, bool captured) //when map_update will be allowed for battlegrounds this code will be useless SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); + SendBroadcastText(BG_WS_TEXT_FLAGS_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound... } _bothFlagsKept = false; @@ -271,16 +270,11 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) RespawnFlag(team, false); if (team == ALLIANCE) - { SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); - } else - { SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); - SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); - } + SendBroadcastText(BG_WS_TEXT_FLAGS_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL); PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) @@ -345,9 +339,9 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player) SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); if (player->GetTeam() == ALLIANCE) - SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(BG_WS_TEXT_CAPTURED_HORDE_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else - SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateFlagState(player->GetTeam(), 1); // flag state none UpdateTeamScore(player->GetTeamId()); @@ -455,12 +449,12 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player) if (player->GetTeam() == ALLIANCE) { - SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player); + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); } else { - SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_DROPPED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } @@ -473,15 +467,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target if (GetStatus() != STATUS_IN_PROGRESS) return; - int32 message_id = 0; - ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL; - //alliance flag picked up from base if (player->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE && BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) { - message_id = LANG_BG_WS_PICKEDUP_AF; - type = CHAT_MSG_BG_SYSTEM_HORDE; + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_HORDE, player); PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SetAllianceFlagPicker(player->GetGUID()); @@ -499,8 +489,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target if (player->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE && BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) { - message_id = LANG_BG_WS_PICKEDUP_HF; - type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SetHordeFlagPicker(player->GetGUID()); @@ -520,8 +509,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target { if (player->GetTeam() == ALLIANCE) { - message_id = LANG_BG_WS_RETURNED_AF; - type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_RETURNED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN); RespawnFlag(ALLIANCE, false); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); @@ -531,8 +519,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target } else { - message_id = LANG_BG_WS_PICKEDUP_AF; - type = CHAT_MSG_BG_SYSTEM_HORDE; + SendBroadcastText(BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_HORDE, player); PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY); SetAllianceFlagPicker(player->GetGUID()); @@ -555,8 +542,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target { if (player->GetTeam() == HORDE) { - message_id = LANG_BG_WS_RETURNED_HF; - type = CHAT_MSG_BG_SYSTEM_HORDE; + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_RETURNED, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN); RespawnFlag(HORDE, false); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); @@ -566,8 +552,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target } else { - message_id = LANG_BG_WS_PICKEDUP_HF; - type = CHAT_MSG_BG_SYSTEM_ALLIANCE; + SendBroadcastText(BG_WS_TEXT_HORDE_FLAG_PICKED_UP, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP); SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY); SetHordeFlagPicker(player->GetGUID()); @@ -584,10 +569,6 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* target //target_obj->Delete(); } - if (!message_id) - return; - - SendMessageToAll(message_id, type, player); player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index f4c9dd85acd..55991eaced7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -31,6 +31,23 @@ enum BG_WS_TimerOrScore BG_WS_SPELL_BRUTAL_TIME = 900000 }; +enum BG_WS_BroadcastTexts +{ + BG_WS_TEXT_START_ONE_MINUTE = 10015, + BG_WS_TEXT_START_HALF_MINUTE = 10016, + BG_WS_TEXT_BATTLE_HAS_BEGUN = 10014, + + BG_WS_TEXT_CAPTURED_HORDE_FLAG = 9801, + BG_WS_TEXT_CAPTURED_ALLIANCE_FLAG = 9802, + BG_WS_TEXT_FLAGS_PLACED = 9803, + BG_WS_TEXT_ALLIANCE_FLAG_PICKED_UP = 9804, + BG_WS_TEXT_ALLIANCE_FLAG_DROPPED = 9805, + BG_WS_TEXT_HORDE_FLAG_PICKED_UP = 9807, + BG_WS_TEXT_HORDE_FLAG_DROPPED = 9806, + BG_WS_TEXT_ALLIANCE_FLAG_RETURNED = 9808, + BG_WS_TEXT_HORDE_FLAG_RETURNED = 9809, +}; + enum BG_WS_Sound { BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173, diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index e135dd940ac..080f5233897 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14376,11 +14376,11 @@ void Unit::Talk(uint32 textId, ChatMsg msgType, float textRange, WorldObject con { if (!sObjectMgr->GetBroadcastText(textId)) { - TC_LOG_ERROR("entities.unit", "WorldObject::MonsterText: `broadcast_text` was not %u found", textId); + TC_LOG_ERROR("entities.unit", "WorldObject::MonsterText: `broadcast_text` (ID: %u) was not found", textId); return; } - Trinity::BroadcastTextBuilder builder(this, msgType, textId, target); + Trinity::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target); Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> localizer(builder); Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::BroadcastTextBuilder> > worker(this, textRange, localizer); Cell::VisitWorldObjects(this, worker, textRange); diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index b7a203f5e56..52b15508835 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -26,7 +26,6 @@ #include "Guild.h" #include "GuildMgr.h" #include "Item.h" -#include "Language.h" #include "Log.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" @@ -111,7 +110,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) /// @todo find correct opcode if (_player->getLevel() < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - SendNotification(LANG_ARENA_ONE_TOOLOW, sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)); + SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", _player->GetName(), ERR_ARENA_TEAM_TARGET_TOO_LOW_S); return; } diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index d2ef0171247..5b53d43f378 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -635,79 +635,7 @@ enum TrinityStrings // End Level 3 list, continued at 1100 - // Battleground - LANG_BG_A_WINS = 600, - LANG_BG_H_WINS = 601, - - LANG_BG_WS_START_TWO_MINUTES = 753, - LANG_BG_WS_START_ONE_MINUTE = 602, - LANG_BG_WS_START_HALF_MINUTE = 603, - LANG_BG_WS_HAS_BEGUN = 604, - - LANG_BG_WS_CAPTURED_HF = 605, - LANG_BG_WS_CAPTURED_AF = 606, - LANG_BG_WS_DROPPED_HF = 607, - LANG_BG_WS_DROPPED_AF = 608, - LANG_BG_WS_RETURNED_AF = 609, - LANG_BG_WS_RETURNED_HF = 610, - LANG_BG_WS_PICKEDUP_HF = 611, - LANG_BG_WS_PICKEDUP_AF = 612, - LANG_BG_WS_F_PLACED = 613, - LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED = 614, - LANG_BG_WS_HORDE_FLAG_RESPAWNED = 615, - - LANG_BG_EY_START_TWO_MINUTES = 755, - LANG_BG_EY_START_ONE_MINUTE = 636, - LANG_BG_EY_START_HALF_MINUTE = 637, - LANG_BG_EY_HAS_BEGUN = 638, - - LANG_BG_AB_ALLY = 650, - LANG_BG_AB_HORDE = 651, - LANG_BG_AB_NODE_STABLES = 652, - LANG_BG_AB_NODE_BLACKSMITH = 653, - LANG_BG_AB_NODE_FARM = 654, - LANG_BG_AB_NODE_LUMBER_MILL = 655, - LANG_BG_AB_NODE_GOLD_MINE = 656, - LANG_BG_AB_NODE_TAKEN = 657, - LANG_BG_AB_NODE_DEFENDED = 658, - LANG_BG_AB_NODE_ASSAULTED = 659, - LANG_BG_AB_NODE_CLAIMED = 660, - - LANG_BG_AB_START_TWO_MINUTES = 754, - LANG_BG_AB_START_ONE_MINUTE = 661, - LANG_BG_AB_START_HALF_MINUTE = 662, - LANG_BG_AB_HAS_BEGUN = 663, - LANG_BG_AB_A_NEAR_VICTORY = 664, - LANG_BG_AB_H_NEAR_VICTORY = 665, - LANG_BG_MARK_BY_MAIL = 666, - - LANG_BG_EY_HAS_TAKEN_A_M_TOWER = 667, - LANG_BG_EY_HAS_TAKEN_H_M_TOWER = 668, - LANG_BG_EY_HAS_TAKEN_A_D_RUINS = 669, - LANG_BG_EY_HAS_TAKEN_H_D_RUINS = 670, - LANG_BG_EY_HAS_TAKEN_A_B_TOWER = 671, - LANG_BG_EY_HAS_TAKEN_H_B_TOWER = 672, - LANG_BG_EY_HAS_TAKEN_A_F_RUINS = 673, - LANG_BG_EY_HAS_TAKEN_H_F_RUINS = 674, - LANG_BG_EY_HAS_LOST_A_M_TOWER = 675, - LANG_BG_EY_HAS_LOST_H_M_TOWER = 676, - LANG_BG_EY_HAS_LOST_A_D_RUINS = 677, - LANG_BG_EY_HAS_LOST_H_D_RUINS = 678, - LANG_BG_EY_HAS_LOST_A_B_TOWER = 679, - LANG_BG_EY_HAS_LOST_H_B_TOWER = 680, - LANG_BG_EY_HAS_LOST_A_F_RUINS = 681, - LANG_BG_EY_HAS_LOST_H_F_RUINS = 682, - LANG_BG_EY_HAS_TAKEN_FLAG = 683, - LANG_BG_EY_CAPTURED_FLAG_A = 684, - LANG_BG_EY_CAPTURED_FLAG_H = 685, - LANG_BG_EY_DROPPED_FLAG = 686, - LANG_BG_EY_RESETED_FLAG = 687, - - LANG_ARENA_ONE_TOOLOW = 700, - LANG_ARENA_ONE_MINUTE = 701, - LANG_ARENA_THIRTY_SECONDS = 702, - LANG_ARENA_FIFTEEN_SECONDS = 703, - LANG_ARENA_HAS_BEGUN = 704, + // 600-704 - free LANG_WAIT_BEFORE_SPEAKING = 705, LANG_NOT_EQUIPPED_ITEM = 706, @@ -730,9 +658,7 @@ enum TrinityStrings LANG_ARENA_GROUP_TOO_LARGE = 721, // "Your group is too large for this arena. Please regroup to join." LANG_ARENA_YOUR_TEAM_ONLY = 722, // "Your group has members not in your arena team. Please regroup to join." LANG_ARENA_NOT_ENOUGH_PLAYERS = 723, // "Your group does not have enough players to join this match." - LANG_ARENA_GOLD_WINS = 724, // "The Gold Team wins!" - LANG_ARENA_GREEN_WINS = 725, // "The Green Team wins!" -// = 726, not used + // 724-726 - free LANG_BG_GROUP_OFFLINE_MEMBER = 727, // "Your group has an offline member. Please remove him before joining." LANG_BG_GROUP_MIXED_FACTION = 728, // "Your group has players from the opposing faction. You can't join the battleground as a group." LANG_BG_GROUP_MIXED_LEVELS = 729, // "Your group has players from different battleground brakets. You can't join as group." @@ -760,14 +686,13 @@ enum TrinityStrings LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING = 750, // "Not enough players. This game will close in %u mins." LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS = 751, // "Not enough players. This game will close in %u seconds." // = 752, see LANG_PINFO_ACC_IP -// LANG_BG_WS_START_TWO_MINUTES = 753, - defined above -// LANG_BG_AB_START_TWO_MINUTES = 754, - defined above -// LANG_BG_EY_START_TWO_MINUTES = 755, - defined above + // 753-755 - free - // Room for BG/ARENA = 773-784, 788-799 not used + // Room for BG/ARENA = 773-784 LANG_ARENA_TESTING = 785, LANG_AUTO_ANN = 786, LANG_ANNOUNCE_COLOR = 787, + // 788-799 - free // in game strings LANG_PET_INVALID_NAME = 800, @@ -1010,41 +935,7 @@ enum TrinityStrings LANG_DEBUG_AREATRIGGER_OFF = 1203, LANG_DEBUG_AREATRIGGER_REACHED = 1204, - // Isle of Conquest - LANG_BG_IC_START_TWO_MINUTES = 1205, - LANG_BG_IC_START_ONE_MINUTE = 1206, - LANG_BG_IC_START_HALF_MINUTE = 1207, - LANG_BG_IC_HAS_BEGUN = 1208, - LANG_BG_IC_ALLIANCE_KEEP = 1209, - LANG_BG_IC_HORDE_KEEP = 1210, - LANG_BG_IC_TEAM_WINS = 1211, - LANG_BG_IC_WEST_GATE_DESTROYED = 1212, - LANG_BG_IC_EAST_GATE_DESTROYED = 1213, - LANG_BG_IC_SOUTH_GATE_DESTROYED = 1214, - LANG_BG_IC_NORTH_GATE_DESTROYED = 1215, - LANG_BG_IC_TEAM_ASSAULTED_NODE_1 = 1216, - LANG_BG_IC_TEAM_DEFENDED_NODE = 1217, - LANG_BG_IC_TEAM_ASSAULTED_NODE_2 = 1218, - LANG_BG_IC_TEAM_HAS_TAKEN_NODE = 1219, - LANG_BG_IC_WORKSHOP = 1220, - LANG_BG_IC_DOCKS = 1221, - LANG_BG_IC_REFINERY = 1222, - LANG_BG_IC_QUARRY = 1223, - LANG_BG_IC_HANGAR = 1224, - // 1225-1299 - LANG_BG_IC_ALLIANCE = 1300, - LANG_BG_IC_HORDE = 1301, - - // 1302-1325 - // AV - LANG_BG_AV_START_ONE_MINUTE = 1326, - LANG_BG_AV_START_HALF_MINUTE = 1327, - LANG_BG_AV_HAS_BEGUN = 1328, - LANG_BG_AV_A_NEAR_LOSE = 1329, - LANG_BG_AV_H_NEAR_LOSE = 1330, - // 1331-1332 - LANG_BG_AV_START_TWO_MINUTES = 1333, - // FREE IDS 1334-1999 + // 1205-2002 - free // Ticket Strings 2000-2030 LANG_COMMAND_TICKETNEW = 2000, @@ -1229,14 +1120,7 @@ enum TrinityStrings LANG_OPVP_ZM_GOSSIP_ALLIANCE = 10054, LANG_OPVP_ZM_GOSSIP_HORDE = 10055, - LANG_BG_SA_START_TWO_MINUTES = 10056, - LANG_BG_SA_START_ONE_MINUTE = 10057, - LANG_BG_SA_START_HALF_MINUTE = 10058, - // unused 10059-10062 - LANG_BG_SA_ALLIANCE_CAPTURED_RELIC = 10063, //The Alliance captured the titan portal! - LANG_BG_SA_HORDE_CAPTURED_RELIC = 10064, //The Horde captured the titan portal! - LANG_BG_SA_ROUND_TWO_ONE_MINUTE = 10065, //Round 2 of the Battle for the Strand of the Ancients begins in 1 minute. - LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE = 10066, //Round 2 begins in 30 seconds. Prepare yourselves! + // 10056-10066 - free // Use for custom patches 11000-11999 LANG_AUTO_BROADCAST = 11000, diff --git a/src/server/game/Texts/ChatTextBuilder.cpp b/src/server/game/Texts/ChatTextBuilder.cpp index 537d3944b84..8d989c9c281 100644 --- a/src/server/game/Texts/ChatTextBuilder.cpp +++ b/src/server/game/Texts/ChatTextBuilder.cpp @@ -18,21 +18,42 @@ #include "ChatTextBuilder.h" #include "Chat.h" #include "ObjectMgr.h" -#include "Unit.h" +#include <cstdarg> void Trinity::BroadcastTextBuilder::operator()(WorldPacket& data, LocaleConstant locale) const { BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId); - ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _source->getGender()) : "", _achievementId, "", locale); + ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale); } size_t Trinity::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const { BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId); - return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _source->getGender()) : "", _achievementId, "", locale); + return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale); } void Trinity::CustomChatTextBuilder::operator()(WorldPacket& data, LocaleConstant locale) const { ChatHandler::BuildChatPacket(data, _msgType, _language, _source, _target, _text, 0, "", locale); } + +void Trinity::TrinityStringChatBuilder::operator()(WorldPacket& data, LocaleConstant locale) const +{ + char const* text = sObjectMgr->GetTrinityString(_textId, locale); + + if (_args) + { + // we need copy va_list before use or original va_list will corrupted + va_list ap; + va_copy(ap, *_args); + + static size_t const BufferSize = 2048; + char strBuffer[BufferSize]; + vsnprintf(strBuffer, BufferSize, text, ap); + va_end(ap); + + ChatHandler::BuildChatPacket(data, _msgType, LANG_UNIVERSAL, _source, _target, strBuffer, 0, "", locale); + } + else + ChatHandler::BuildChatPacket(data, _msgType, LANG_UNIVERSAL, _source, _target, text, 0, "", locale); +} diff --git a/src/server/game/Texts/ChatTextBuilder.h b/src/server/game/Texts/ChatTextBuilder.h index a19880fe5ef..08b80c28eeb 100644 --- a/src/server/game/Texts/ChatTextBuilder.h +++ b/src/server/game/Texts/ChatTextBuilder.h @@ -22,7 +22,6 @@ #include "SharedDefines.h" #include <string> -class Unit; class WorldObject; class WorldPacket; @@ -31,16 +30,17 @@ namespace Trinity class BroadcastTextBuilder { public: - BroadcastTextBuilder(Unit const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, uint32 achievementId = 0) - : _source(obj), _msgType(msgType), _textId(textId), _target(target), _achievementId(achievementId) { } + BroadcastTextBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, uint8 gender, WorldObject const* target = nullptr, uint32 achievementId = 0) + : _source(obj), _msgType(msgType), _textId(textId), _gender(gender), _target(target), _achievementId(achievementId) { } void operator()(WorldPacket& data, LocaleConstant locale) const; size_t operator()(WorldPacket* data, LocaleConstant locale) const; private: - Unit const* _source; + WorldObject const* _source; ChatMsg _msgType; uint32 _textId; + uint8 _gender; WorldObject const* _target; uint32 _achievementId; }; @@ -60,6 +60,22 @@ namespace Trinity Language _language; WorldObject const* _target; }; + + class TrinityStringChatBuilder + { + public: + TrinityStringChatBuilder(WorldObject const* obj, ChatMsg msgType, uint32 textId, WorldObject const* target = nullptr, va_list* args = nullptr) + : _source(obj), _msgType(msgType), _textId(textId), _target(target), _args(args) { } + + void operator()(WorldPacket& data, LocaleConstant locale) const; + + private: + WorldObject const* _source; + ChatMsg _msgType; + uint32 _textId; + WorldObject const* _target; + va_list* _args; + }; } // namespace Trinity diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index b5b73cca89f..1c666bc5139 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -20,6 +20,7 @@ #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" +#include "SpellScript.h" #include "TemporarySummon.h" #include "utgarde_pinnacle.h" |