diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index cf4b318a067125..e6e1c7a576c0d5 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -265,95 +265,111 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) } *data << uint32(itr2->second->DamageDone); // damage done *data << uint32(itr2->second->HealingDone); // healing done - switch (bg->GetBgTypeID()) // battleground specific things - { - case BATTLEGROUND_RB: - switch (bg->GetMapId()) - { - case 489: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures - *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns - break; - case 566: - *data << uint32(0x00000001); // count of next fields - *data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures - break; - case 529: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted - *data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended - break; - case 30: - *data << uint32(0x00000005); // count of next fields - *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted - *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended - *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted - *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended - *data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured - break; - case 607: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed); - *data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed); - break; - case 628: // IC - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases asssulted - *data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended - default: - *data << uint32(0); - break; - } - break; - case BATTLEGROUND_AV: - *data << uint32(0x00000005); // count of next fields - *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted - *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended - *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted - *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended - *data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured - break; - case BATTLEGROUND_WS: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures - *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns - break; - case BATTLEGROUND_AB: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted - *data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended - break; - case BATTLEGROUND_EY: - *data << uint32(0x00000001); // count of next fields - *data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures - break; - case BATTLEGROUND_SA: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed); - *data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed); - break; - case BATTLEGROUND_IC: - *data << uint32(0x00000002); // count of next fields - *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases assaulted - *data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended - break; - case BATTLEGROUND_NA: - case BATTLEGROUND_BE: - case BATTLEGROUND_AA: - case BATTLEGROUND_RL: - case BATTLEGROUND_DS: - case BATTLEGROUND_RV: - *data << uint32(0); - break; - default: - *data << uint32(0); - break; + + + // battleground specific things + int bgTypeID = bg->GetBgTypeID(); + + // if there is a key in the getBgFromType hashmap OR a key in the getBgFromMap hashmap (with bgTypeID == BATTLEGROUND_RB) + // -> use hashmap code + // else -> use switch case + if (BattlegroundMgr::getBgFromTypeID.find(bgTypeID) != BattlegroundMgr::getBgFromTypeID.end() || + (bgTypeID == BATTLEGROUND_RB && BattlegroundMgr::getBgFromMap.find(bg->GetMapId()) != BattlegroundMgr::getBgFromMap.end()) + ) { + BattlegroundMgr::getBgFromTypeID[bgTypeID](data, itr2, bg); + } + else { + switch (bgTypeID) + { + case BATTLEGROUND_RB: + switch (bg->GetMapId()) + { + case 489: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures + *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns + break; + case 566: + *data << uint32(0x00000001); // count of next fields + *data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures + break; + case 529: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted + *data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended + break; + case 30: + *data << uint32(0x00000005); // count of next fields + *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted + *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended + *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted + *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended + *data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured + break; + case 607: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed); + *data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed); + break; + case 628: // IC + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases asssulted + *data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended + default: + *data << uint32(0); + break; + } + break; + case BATTLEGROUND_AV: + *data << uint32(0x00000005); // count of next fields + *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted + *data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsDefended); // GraveyardsDefended + *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersAssaulted); // TowersAssaulted + *data << uint32(((BattlegroundAVScore*)itr2->second)->TowersDefended); // TowersDefended + *data << uint32(((BattlegroundAVScore*)itr2->second)->MinesCaptured); // MinesCaptured + break; + case BATTLEGROUND_WS: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagCaptures); // flag captures + *data << uint32(((BattlegroundWGScore*)itr2->second)->FlagReturns); // flag returns + break; + case BATTLEGROUND_AB: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundABScore*)itr2->second)->BasesAssaulted); // bases asssulted + *data << uint32(((BattlegroundABScore*)itr2->second)->BasesDefended); // bases defended + break; + case BATTLEGROUND_EY: + *data << uint32(0x00000001); // count of next fields + *data << uint32(((BattlegroundEYScore*)itr2->second)->FlagCaptures); // flag captures + break; + case BATTLEGROUND_SA: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundSAScore*)itr2->second)->demolishers_destroyed); + *data << uint32(((BattlegroundSAScore*)itr2->second)->gates_destroyed); + break; + case BATTLEGROUND_IC: + *data << uint32(0x00000002); // count of next fields + *data << uint32(((BattlegroundICScore*)itr2->second)->BasesAssaulted); // bases assaulted + *data << uint32(((BattlegroundICScore*)itr2->second)->BasesDefended); // bases defended + break; + case BATTLEGROUND_NA: + case BATTLEGROUND_BE: + case BATTLEGROUND_AA: + case BATTLEGROUND_RL: + case BATTLEGROUND_DS: + case BATTLEGROUND_RV: + *data << uint32(0); + break; + default: + *data << uint32(0); + break; + } } + // should never happen if (++scoreCount >= bg->GetMaxPlayersPerTeam()*2 && itr != bg->GetPlayerScoresEnd()) { - sLog->outMisc("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bg->GetBgTypeID(), bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam()*2); + sLog->outMisc("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bgTypeID, bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam()*2); break; } } @@ -437,11 +453,54 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId Battleground* bg = NULL; // create a copy of the BG template - if (BattlegroundMgr::bgTypeToTemplate.find(bgTypeId) == BattlegroundMgr::bgTypeToTemplate.end()) { - return NULL; + if (BattlegroundMgr::bgTypeToTemplate.find(bgTypeId) != BattlegroundMgr::bgTypeToTemplate.end()) { + bg = BattlegroundMgr::bgTypeToTemplate[bgTypeId](bg_template); } - - bg = BattlegroundMgr::bgTypeToTemplate[bgTypeId](bg_template); + else { + switch (bgTypeId) + { + case BATTLEGROUND_AV: + bg = new BattlegroundAV(*(static_cast(bg_template))); + break; + case BATTLEGROUND_WS: + bg = new BattlegroundWS(*(static_cast(bg_template))); + break; + case BATTLEGROUND_AB: + bg = new BattlegroundAB(*(static_cast(bg_template))); + break; + case BATTLEGROUND_NA: + bg = new BattlegroundNA(*(static_cast(bg_template))); + break; + case BATTLEGROUND_BE: + bg = new BattlegroundBE(*(static_cast(bg_template))); + break; + case BATTLEGROUND_EY: + bg = new BattlegroundEY(*(static_cast(bg_template))); + break; + case BATTLEGROUND_RL: + bg = new BattlegroundRL(*(static_cast(bg_template))); + break; + case BATTLEGROUND_SA: + bg = new BattlegroundSA(*(static_cast(bg_template))); + break; + case BATTLEGROUND_DS: + bg = new BattlegroundDS(*(static_cast(bg_template))); + break; + case BATTLEGROUND_RV: + bg = new BattlegroundRV(*(static_cast(bg_template))); + break; + case BATTLEGROUND_IC: + bg = new BattlegroundIC(*(static_cast(bg_template))); + break; + case BATTLEGROUND_RB: + case BATTLEGROUND_AA: + bg = new Battleground(*bg_template); + break; + default: + return NULL; + } + } + bg->SetLevelRange(minLevel, maxLevel); bg->SetInstanceID(sMapMgr->GenerateInstanceId()); @@ -480,7 +539,56 @@ bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) { // Create the BG Battleground* bg = NULL; - bg = BattlegroundMgr::bgtypeToBattleground[data.bgTypeId]; + + if (BattlegroundMgr::bgtypeToBattleground.find(data.bgTypeId) != BattlegroundMgr::bgtypeToBattleground.end()) { + bg = BattlegroundMgr::bgtypeToBattleground[data.bgTypeId]; + } + else { + switch (data.bgTypeId) + { + case BATTLEGROUND_AV: + bg = new BattlegroundAV; + break; + case BATTLEGROUND_WS: + bg = new BattlegroundWS; + break; + case BATTLEGROUND_AB: + bg = new BattlegroundAB; + break; + case BATTLEGROUND_NA: + bg = new BattlegroundNA; + break; + case BATTLEGROUND_BE: + bg = new BattlegroundBE; + break; + case BATTLEGROUND_EY: + bg = new BattlegroundEY; + break; + case BATTLEGROUND_RL: + bg = new BattlegroundRL; + break; + case BATTLEGROUND_SA: + bg = new BattlegroundSA; + break; + case BATTLEGROUND_DS: + bg = new BattlegroundDS; + break; + case BATTLEGROUND_RV: + bg = new BattlegroundRV; + break; + case BATTLEGROUND_IC: + bg = new BattlegroundIC; + break; + case BATTLEGROUND_AA: + bg = new Battleground; + break; + case BATTLEGROUND_RB: + bg = new Battleground; + break; + default: + return false; + } + } if (bg == NULL) return false; @@ -722,33 +830,77 @@ bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId) BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgTypeId, uint8 arenaType) { - if (arenaType) { - switch (arenaType) { - case ARENA_TYPE_2v2: - return BATTLEGROUND_QUEUE_2v2; - case ARENA_TYPE_3v3: - return BATTLEGROUND_QUEUE_3v3; - case ARENA_TYPE_5v5: - return BATTLEGROUND_QUEUE_5v5; - default: - return BATTLEGROUND_QUEUE_NONE; - } + if (BattlegroundMgr::bgToQueue.find(bgTypeId) != BattlegroundMgr::bgToQueue.end()) { + return BattlegroundMgr::bgToQueue[bgTypeId]; } - if (BattlegroundMgr::bgToQueue.find(bgTypeId) == BattlegroundMgr::bgToQueue.end()) { - return BATTLEGROUND_QUEUE_NONE; + switch (bgTypeId) + { + case BATTLEGROUND_AB: + return BATTLEGROUND_QUEUE_AB; + case BATTLEGROUND_AV: + return BATTLEGROUND_QUEUE_AV; + case BATTLEGROUND_EY: + return BATTLEGROUND_QUEUE_EY; + case BATTLEGROUND_IC: + return BATTLEGROUND_QUEUE_IC; + case BATTLEGROUND_RB: + return BATTLEGROUND_QUEUE_RB; + case BATTLEGROUND_SA: + return BATTLEGROUND_QUEUE_SA; + case BATTLEGROUND_WS: + return BATTLEGROUND_QUEUE_WS; + case BATTLEGROUND_AA: + case BATTLEGROUND_BE: + case BATTLEGROUND_DS: + case BATTLEGROUND_NA: + case BATTLEGROUND_RL: + case BATTLEGROUND_RV: + switch (arenaType) + { + case ARENA_TYPE_2v2: + return BATTLEGROUND_QUEUE_2v2; + case ARENA_TYPE_3v3: + return BATTLEGROUND_QUEUE_3v3; + case ARENA_TYPE_5v5: + return BATTLEGROUND_QUEUE_5v5; + default: + return BATTLEGROUND_QUEUE_NONE; + } + default: + return BATTLEGROUND_QUEUE_NONE; } - - return BattlegroundMgr::bgToQueue[bgTypeId]; } BattlegroundTypeId BattlegroundMgr::BGTemplateId(BattlegroundQueueTypeId bgQueueTypeId) { - if (BattlegroundMgr::queueToBg.find(bgQueueTypeId) == BattlegroundMgr::queueToBg.end()) { - return BattlegroundTypeId(0); + if (BattlegroundMgr::queueToBg.find(bgQueueTypeId) != BattlegroundMgr::queueToBg.end()) { + return BattlegroundMgr::queueToBg[bgQueueTypeId]; } - return BattlegroundMgr::queueToBg[bgQueueTypeId]; + switch (bgQueueTypeId) + { + case BATTLEGROUND_QUEUE_WS: + return BATTLEGROUND_WS; + case BATTLEGROUND_QUEUE_AB: + return BATTLEGROUND_AB; + case BATTLEGROUND_QUEUE_AV: + return BATTLEGROUND_AV; + case BATTLEGROUND_QUEUE_EY: + return BATTLEGROUND_EY; + case BATTLEGROUND_QUEUE_SA: + return BATTLEGROUND_SA; + case BATTLEGROUND_QUEUE_IC: + return BATTLEGROUND_IC; + case BATTLEGROUND_QUEUE_RB: + return BATTLEGROUND_RB; + case BATTLEGROUND_QUEUE_2v2: + case BATTLEGROUND_QUEUE_3v3: + case BATTLEGROUND_QUEUE_5v5: + return BATTLEGROUND_AA; + default: + return BattlegroundTypeId(0); // used for unknown template (it existed and do nothing) + } } uint8 BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId bgQueueTypeId) @@ -1039,68 +1191,22 @@ void RandomBattlegroundSystem::BattlegroundCreated(BattlegroundTypeId bgTypeId) Update(0xffffffff); } -// init/update unordered_map -// Battlegrounds -std::unordered_map BattlegroundMgr::bgToQueue = { - { BATTLEGROUND_AV, BATTLEGROUND_QUEUE_AV}, - { BATTLEGROUND_WS, BATTLEGROUND_QUEUE_WS}, - { BATTLEGROUND_AB, BATTLEGROUND_QUEUE_AB}, - { BATTLEGROUND_EY, BATTLEGROUND_QUEUE_EY}, - { BATTLEGROUND_SA, BATTLEGROUND_QUEUE_SA}, - { BATTLEGROUND_IC, BATTLEGROUND_QUEUE_IC}, - { BATTLEGROUND_RB, BATTLEGROUND_QUEUE_RB}, - // Arena Battlegrounds - { BATTLEGROUND_NA, BattlegroundQueueTypeId(0)}, // Nagrand Arena - { BATTLEGROUND_BE, BattlegroundQueueTypeId(0)}, // Blade's Edge Arena - { BATTLEGROUND_AA, BattlegroundQueueTypeId(0)}, // All Arena - { BATTLEGROUND_RL, BattlegroundQueueTypeId(0)}, // Ruins of Lordaernon - { BATTLEGROUND_DS, BattlegroundQueueTypeId(0)}, // Dalaran Sewer - { BATTLEGROUND_RV, BattlegroundQueueTypeId(0)}, // Ring of Valor -}; - -std::unordered_map BattlegroundMgr::queueToBg = { - { BATTLEGROUND_QUEUE_NONE, BATTLEGROUND_TYPE_NONE }, - { BATTLEGROUND_QUEUE_AV, BATTLEGROUND_AV }, - { BATTLEGROUND_QUEUE_WS, BATTLEGROUND_WS }, - { BATTLEGROUND_QUEUE_AB, BATTLEGROUND_AB }, - { BATTLEGROUND_QUEUE_EY, BATTLEGROUND_EY }, - { BATTLEGROUND_QUEUE_SA, BATTLEGROUND_SA }, - { BATTLEGROUND_QUEUE_IC, BATTLEGROUND_IC }, - { BATTLEGROUND_QUEUE_RB, BATTLEGROUND_RB }, - { BATTLEGROUND_QUEUE_2v2, BATTLEGROUND_AA }, - { BATTLEGROUND_QUEUE_3v3, BATTLEGROUND_AA }, - { BATTLEGROUND_QUEUE_5v5, BATTLEGROUND_AA }, -}; - -std::unordered_map BattlegroundMgr::bgtypeToBattleground = { - { BATTLEGROUND_AV, new BattlegroundAV }, - { BATTLEGROUND_WS, new BattlegroundWS }, - { BATTLEGROUND_AB, new BattlegroundAB }, - { BATTLEGROUND_NA, new BattlegroundNA }, - { BATTLEGROUND_BE, new BattlegroundBE }, - { BATTLEGROUND_EY, new BattlegroundEY }, - { BATTLEGROUND_RL, new BattlegroundRL }, - { BATTLEGROUND_SA, new BattlegroundSA }, - { BATTLEGROUND_DS, new BattlegroundDS }, - { BATTLEGROUND_RV, new BattlegroundRV }, - { BATTLEGROUND_IC, new BattlegroundIC }, - { BATTLEGROUND_AA, new Battleground }, - { BATTLEGROUND_RB, new Battleground }, -}; - -std::unordered_map BattlegroundMgr::bgTypeToTemplate = { - { BATTLEGROUND_AV, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundAV(*(BattlegroundAV*)bg_t); } }, - { BATTLEGROUND_WS, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundWS(*(BattlegroundWS*)bg_t); } }, - { BATTLEGROUND_AB, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundAB(*(BattlegroundAB*)bg_t); } }, - { BATTLEGROUND_NA, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundNA(*(BattlegroundNA*)bg_t); } }, - { BATTLEGROUND_BE, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundBE(*(BattlegroundBE*)bg_t); } }, - { BATTLEGROUND_EY, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundEY(*(BattlegroundEY*)bg_t); } }, - { BATTLEGROUND_RL, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundRL(*(BattlegroundRL*)bg_t); } }, - { BATTLEGROUND_SA, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundSA(*(BattlegroundSA*)bg_t); } }, - { BATTLEGROUND_DS, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundDS(*(BattlegroundDS*)bg_t); } }, - { BATTLEGROUND_RV, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundRV(*(BattlegroundRV*)bg_t); } }, - { BATTLEGROUND_IC, [](Battleground *bg_t) -> Battleground*{ return new BattlegroundIC(*(BattlegroundIC*)bg_t); } }, - - { BATTLEGROUND_RB, [](Battleground *bg_t) -> Battleground*{ return new Battleground(*bg_t); }, }, - { BATTLEGROUND_AA, [](Battleground *bg_t) -> Battleground*{ return new Battleground(*bg_t); }, }, +// init/update unordered_map battlegrounds +std::unordered_map BattlegroundMgr::bgToQueue = {}; +std::unordered_map BattlegroundMgr::queueToBg = {}; +std::unordered_map BattlegroundMgr::bgtypeToBattleground = {}; +std::unordered_map BattlegroundMgr::bgTypeToTemplate = {}; +std::unordered_map BattlegroundMgr::getBgFromMap = {}; +std::unordered_map BattlegroundMgr::getBgFromTypeID = { + { + BATTLEGROUND_RB, + [](WorldPacket* data, Battleground::BattlegroundScoreMap::const_iterator itr2, Battleground* bg) { + if (BattlegroundMgr::getBgFromMap.find(bg->GetMapId()) == BattlegroundMgr::getBgFromMap.end()) { // this should not happen + *data << uint32(0); + } + else { + BattlegroundMgr::getBgFromMap[bg->GetMapId()](data, itr2); + } + } + } }; diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index 50d83e0bc5e640..f7974d1b96de1e 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -18,7 +18,8 @@ typedef std::map BattlegroundContainer; typedef std::unordered_map BattleMastersMap; typedef Battleground*(*bgRef)(Battleground*); - +typedef void(*bgMapRef)(WorldPacket*, Battleground::BattlegroundScoreMap::const_iterator); +typedef void(*bgTypeRef)(WorldPacket*, Battleground::BattlegroundScoreMap::const_iterator, Battleground*); #define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // how many seconds in day @@ -136,10 +137,12 @@ class BattlegroundMgr const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard RandomBattlegroundSystem RandomSystem; // pussywizard - static std::unordered_map bgToQueue; // BattlegroundTypeId -> BattlegroundQueueTypeId - static std::unordered_map queueToBg; // BattlegroundQueueTypeId -> BattlegroundTypeId - static std::unordered_map bgtypeToBattleground; // BattlegroundTypeId -> Battleground* - static std::unordered_map bgTypeToTemplate; // BattlegroundTypeId -> bgRef + static std::unordered_map bgToQueue; // BattlegroundTypeId -> BattlegroundQueueTypeId + static std::unordered_map queueToBg; // BattlegroundQueueTypeId -> BattlegroundTypeId + static std::unordered_map bgtypeToBattleground; // BattlegroundTypeId -> Battleground* + static std::unordered_map bgTypeToTemplate; // BattlegroundTypeId -> bgRef + static std::unordered_map getBgFromMap; // BattlegroundMapID -> bgMapRef + static std::unordered_map getBgFromTypeID; // BattlegroundTypeID -> bgTypeRef private: bool CreateBattleground(CreateBattlegroundData& data); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index eb472998c1391f..acb86269de9e60 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1780,17 +1780,22 @@ void GameObject::Use(Unit* user) GameObjectTemplate const* info = GetGOInfo(); if (info) { - switch (info->entry) - { - case 179785: // Silverwing Flag - case 179786: // Warsong Flag - if (bg->GetBgTypeID() == BATTLEGROUND_WS) - bg->EventPlayerClickedOnFlag(player, this); - break; - case 184142: // Netherstorm Flag - if (bg->GetBgTypeID() == BATTLEGROUND_EY) - bg->EventPlayerClickedOnFlag(player, this); - break; + if (GameObject::gameObjectToEventFlag.find(info->entry) != GameObject::gameObjectToEventFlag.end()) { + GameObject::gameObjectToEventFlag[info->entry](player, this, bg); + } + else { + switch (info->entry) + { + case 179785: // Silverwing Flag + case 179786: // Warsong Flag + if (bg->GetBgTypeID() == BATTLEGROUND_WS) + bg->EventPlayerClickedOnFlag(player, this); + break; + case 184142: // Netherstorm Flag + if (bg->GetBgTypeID() == BATTLEGROUND_EY) + bg->EventPlayerClickedOnFlag(player, this); + break; + } } } //this cause to call return, all flags must be deleted here!! @@ -2490,3 +2495,5 @@ void GameObject::UpdateModelPosition() GetMap()->InsertGameObjectModel(*m_model); } } + +std::unordered_map GameObject::gameObjectToEventFlag = {}; diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 9ce7ee545e6a0e..8a01572701d7e4 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -20,6 +20,8 @@ class Transport; class StaticTransport; class MotionTransport; +typedef void(*goEventFlag)(Player*, GameObject*, Battleground*); + #define MAX_GAMEOBJECT_QUEST_ITEMS 6 // from `gameobject_template` @@ -879,6 +881,8 @@ class GameObject : public WorldObject, public GridObject, public Mov void UpdateModelPosition(); + static std::unordered_map gameObjectToEventFlag; // Gameobject -> event flag + protected: bool AIM_Initialize(); void UpdateModel(); // updates model in case displayId were changed diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 179bbbb5ece1fa..706d4e1d1fe3c5 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -9437,593 +9437,598 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) data << uint32(0x9bb) << uint32(0xF); // 9 } - // insert - switch (zoneid) - { - case 1: // Dun Morogh - case 11: // Wetlands - case 12: // Elwynn Forest - case 38: // Loch Modan - case 40: // Westfall - case 51: // Searing Gorge - case 1519: // Stormwind City - case 1537: // Ironforge - case 2257: // Deeprun Tram - case 3703: // Shattrath City - break; - case 139: // Eastern Plaguelands - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP) - pvp->FillInitialWorldStates(data); - else - { - data << uint32(0x97a) << uint32(0x0); // 10 2426 - data << uint32(0x917) << uint32(0x0); // 11 2327 - data << uint32(0x918) << uint32(0x0); // 12 2328 - data << uint32(0x97b) << uint32(0x32); // 13 2427 - data << uint32(0x97c) << uint32(0x32); // 14 2428 - data << uint32(0x933) << uint32(0x1); // 15 2355 - data << uint32(0x946) << uint32(0x0); // 16 2374 - data << uint32(0x947) << uint32(0x0); // 17 2375 - data << uint32(0x948) << uint32(0x0); // 18 2376 - data << uint32(0x949) << uint32(0x0); // 19 2377 - data << uint32(0x94a) << uint32(0x0); // 20 2378 - data << uint32(0x94b) << uint32(0x0); // 21 2379 - data << uint32(0x932) << uint32(0x0); // 22 2354 - data << uint32(0x934) << uint32(0x0); // 23 2356 - data << uint32(0x935) << uint32(0x0); // 24 2357 - data << uint32(0x936) << uint32(0x0); // 25 2358 - data << uint32(0x937) << uint32(0x0); // 26 2359 - data << uint32(0x938) << uint32(0x0); // 27 2360 - data << uint32(0x939) << uint32(0x1); // 28 2361 - data << uint32(0x930) << uint32(0x1); // 29 2352 - data << uint32(0x93a) << uint32(0x0); // 30 2362 - data << uint32(0x93b) << uint32(0x0); // 31 2363 - data << uint32(0x93c) << uint32(0x0); // 32 2364 - data << uint32(0x93d) << uint32(0x0); // 33 2365 - data << uint32(0x944) << uint32(0x0); // 34 2372 - data << uint32(0x945) << uint32(0x0); // 35 2373 - data << uint32(0x931) << uint32(0x1); // 36 2353 - data << uint32(0x93e) << uint32(0x0); // 37 2366 - data << uint32(0x931) << uint32(0x1); // 38 2367 ?? grey horde not in dbc! send for consistency's sake, and to match field count - data << uint32(0x940) << uint32(0x0); // 39 2368 - data << uint32(0x941) << uint32(0x0); // 7 2369 - data << uint32(0x942) << uint32(0x0); // 8 2370 - data << uint32(0x943) << uint32(0x0); // 9 2371 - } - break; - case 1377: // Silithus - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_SI) - pvp->FillInitialWorldStates(data); - else - { - // states are always shown - data << uint32(2313) << uint32(0x0); // 7 ally silityst gathered - data << uint32(2314) << uint32(0x0); // 8 horde silityst gathered - data << uint32(2317) << uint32(0x0); // 9 max silithyst - } - // dunno about these... aq opening event maybe? - data << uint32(2322) << uint32(0x0); // 10 sandworm N - data << uint32(2323) << uint32(0x0); // 11 sandworm S - data << uint32(2324) << uint32(0x0); // 12 sandworm SW - data << uint32(2325) << uint32(0x0); // 13 sandworm E - break; - case 2597: // Alterac Valley - if (bg && bg->GetBgTypeID() == BATTLEGROUND_AV) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0x7ae) << uint32(0x1); // 7 snowfall n - data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc - data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac - data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a - data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused - data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused - data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c - data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c - data << uint32(0x550) << uint32(0x1); // 15 irondeep (N) ally - data << uint32(0x544) << uint32(0x0); // 16 ice grave a_a - data << uint32(0x536) << uint32(0x0); // 17 stormpike grave h_c - data << uint32(0x535) << uint32(0x1); // 18 stormpike grave a_c - data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a - data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a - data << uint32(0x574) << uint32(0x0); // 21 1396 unk - data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused - data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused - data << uint32(0x56f) << uint32(0x0); // 24 1391 unk - data << uint32(0x56e) << uint32(0x0); // 25 iceblood a - data << uint32(0x56d) << uint32(0x0); // 26 towerp a - data << uint32(0x56c) << uint32(0x0); // 27 frostwolfe a - data << uint32(0x56b) << uint32(0x0); // 28 froswolfw a - data << uint32(0x56a) << uint32(0x1); // 29 1386 unk - data << uint32(0x569) << uint32(0x1); // 30 iceblood c - data << uint32(0x568) << uint32(0x1); // 31 towerp c - data << uint32(0x565) << uint32(0x0); // 32 stoneh tower a - data << uint32(0x564) << uint32(0x0); // 33 icewing tower a - data << uint32(0x563) << uint32(0x0); // 34 dunn a - data << uint32(0x562) << uint32(0x0); // 35 duns a - data << uint32(0x561) << uint32(0x0); // 36 stoneheart bunker alliance assaulted - unused - data << uint32(0x560) << uint32(0x0); // 37 icewing bunker alliance assaulted - unused - data << uint32(0x55f) << uint32(0x0); // 38 dunbaldar south alliance assaulted - unused - data << uint32(0x55e) << uint32(0x0); // 39 dunbaldar north alliance assaulted - unused - data << uint32(0x55d) << uint32(0x0); // 40 stone tower d - data << uint32(0x3c6) << uint32(0x0); // 41 966 unk - data << uint32(0x3c4) << uint32(0x0); // 42 964 unk - data << uint32(0x3c2) << uint32(0x0); // 43 962 unk - data << uint32(0x516) << uint32(0x1); // 44 stoneheart grave a_c - data << uint32(0x515) << uint32(0x0); // 45 stonheart grave h_c - data << uint32(0x3b6) << uint32(0x0); // 46 950 unk - data << uint32(0x55c) << uint32(0x0); // 47 icewing tower d - data << uint32(0x55b) << uint32(0x0); // 48 dunn d - data << uint32(0x55a) << uint32(0x0); // 49 duns d - data << uint32(0x559) << uint32(0x0); // 50 1369 unk - data << uint32(0x558) << uint32(0x0); // 51 iceblood d - data << uint32(0x557) << uint32(0x0); // 52 towerp d - data << uint32(0x556) << uint32(0x0); // 53 frostwolfe d - data << uint32(0x555) << uint32(0x0); // 54 frostwolfw d - data << uint32(0x554) << uint32(0x1); // 55 stoneh tower c - data << uint32(0x553) << uint32(0x1); // 56 icewing tower c - data << uint32(0x552) << uint32(0x1); // 57 dunn c - data << uint32(0x551) << uint32(0x1); // 58 duns c - data << uint32(0x54f) << uint32(0x0); // 59 irondeep (N) horde - data << uint32(0x54e) << uint32(0x0); // 60 irondeep (N) ally - data << uint32(0x54d) << uint32(0x1); // 61 mine (S) neutral - data << uint32(0x54c) << uint32(0x0); // 62 mine (S) horde - data << uint32(0x54b) << uint32(0x0); // 63 mine (S) ally - data << uint32(0x545) << uint32(0x0); // 64 iceblood h_a - data << uint32(0x543) << uint32(0x1); // 65 iceblod h_c - data << uint32(0x542) << uint32(0x0); // 66 iceblood a_c - data << uint32(0x540) << uint32(0x0); // 67 snowfall h_a - data << uint32(0x53f) << uint32(0x0); // 68 snowfall a_a - data << uint32(0x53e) << uint32(0x0); // 69 snowfall h_c - data << uint32(0x53d) << uint32(0x0); // 70 snowfall a_c - data << uint32(0x53c) << uint32(0x0); // 71 frostwolf g h_a - data << uint32(0x53b) << uint32(0x0); // 72 frostwolf g a_a - data << uint32(0x53a) << uint32(0x1); // 73 frostwolf g h_c - data << uint32(0x539) << uint32(0x0); // 74 frostwolf g a_c - data << uint32(0x538) << uint32(0x0); // 75 stormpike grave h_a - data << uint32(0x537) << uint32(0x0); // 76 stormpike grave a_a - data << uint32(0x534) << uint32(0x0); // 77 frostwolf hut h_a - data << uint32(0x533) << uint32(0x0); // 78 frostwolf hut a_a - data << uint32(0x530) << uint32(0x0); // 79 stormpike first aid h_a - data << uint32(0x52f) << uint32(0x0); // 80 stormpike first aid h_c - data << uint32(0x52d) << uint32(0x1); // 81 stormpike first aid a_c - } - break; - case 3277: // Warsong Gulch - if (bg && bg->GetBgTypeID() == BATTLEGROUND_WS) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0x62d) << uint32(0x0); // 7 1581 alliance flag captures - data << uint32(0x62e) << uint32(0x0); // 8 1582 horde flag captures - data << uint32(0x609) << uint32(0x0); // 9 1545 unk, set to 1 on alliance flag pickup... - data << uint32(0x60a) << uint32(0x0); // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1 - data << uint32(0x60b) << uint32(0x2); // 11 1547 unk - data << uint32(0x641) << uint32(0x3); // 12 1601 unk (max flag captures?) - data << uint32(0x922) << uint32(0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - data << uint32(0x923) << uint32(0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - } - break; - case 3358: // Arathi Basin - if (bg && bg->GetBgTypeID() == BATTLEGROUND_AB) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0x6e7) << uint32(0x0); // 7 1767 stables alliance - data << uint32(0x6e8) << uint32(0x0); // 8 1768 stables horde - data << uint32(0x6e9) << uint32(0x0); // 9 1769 unk, ST? - data << uint32(0x6ea) << uint32(0x0); // 10 1770 stables (show/hide) - data << uint32(0x6ec) << uint32(0x0); // 11 1772 farm (0 - horde controlled, 1 - alliance controlled) - data << uint32(0x6ed) << uint32(0x0); // 12 1773 farm (show/hide) - data << uint32(0x6ee) << uint32(0x0); // 13 1774 farm color - data << uint32(0x6ef) << uint32(0x0); // 14 1775 gold mine color, may be FM? - data << uint32(0x6f0) << uint32(0x0); // 15 1776 alliance resources - data << uint32(0x6f1) << uint32(0x0); // 16 1777 horde resources - data << uint32(0x6f2) << uint32(0x0); // 17 1778 horde bases - data << uint32(0x6f3) << uint32(0x0); // 18 1779 alliance bases - data << uint32(0x6f4) << uint32(0x640); // 19 1780 max resources (1600) - data << uint32(0x6f6) << uint32(0x0); // 20 1782 blacksmith color - data << uint32(0x6f7) << uint32(0x0); // 21 1783 blacksmith (show/hide) - data << uint32(0x6f8) << uint32(0x0); // 22 1784 unk, bs? - data << uint32(0x6f9) << uint32(0x0); // 23 1785 unk, bs? - data << uint32(0x6fb) << uint32(0x0); // 24 1787 gold mine (0 - horde contr, 1 - alliance contr) - data << uint32(0x6fc) << uint32(0x0); // 25 1788 gold mine (0 - conflict, 1 - horde) - data << uint32(0x6fd) << uint32(0x0); // 26 1789 gold mine (1 - show/0 - hide) - data << uint32(0x6fe) << uint32(0x0); // 27 1790 gold mine color - data << uint32(0x700) << uint32(0x0); // 28 1792 gold mine color, wtf?, may be LM? - data << uint32(0x701) << uint32(0x0); // 29 1793 lumber mill color (0 - conflict, 1 - horde contr) - data << uint32(0x702) << uint32(0x0); // 30 1794 lumber mill (show/hide) - data << uint32(0x703) << uint32(0x0); // 31 1795 lumber mill color color - data << uint32(0x732) << uint32(0x1); // 32 1842 stables (1 - uncontrolled) - data << uint32(0x733) << uint32(0x1); // 33 1843 gold mine (1 - uncontrolled) - data << uint32(0x734) << uint32(0x1); // 34 1844 lumber mill (1 - uncontrolled) - data << uint32(0x735) << uint32(0x1); // 35 1845 farm (1 - uncontrolled) - data << uint32(0x736) << uint32(0x1); // 36 1846 blacksmith (1 - uncontrolled) - data << uint32(0x745) << uint32(0x2); // 37 1861 unk - data << uint32(0x7a3) << uint32(0x578); // 38 1955 warning limit (1400) - } - break; - case 3820: // Eye of the Storm - if (bg && bg->GetBgTypeID() == BATTLEGROUND_EY) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0xac1) << uint32(0x0); // 7 2753 Horde Bases - data << uint32(0xac0) << uint32(0x0); // 8 2752 Alliance Bases - data << uint32(0xab6) << uint32(0x0); // 9 2742 Mage Tower - Horde conflict - data << uint32(0xab5) << uint32(0x0); // 10 2741 Mage Tower - Alliance conflict - data << uint32(0xab4) << uint32(0x0); // 11 2740 Fel Reaver - Horde conflict - data << uint32(0xab3) << uint32(0x0); // 12 2739 Fel Reaver - Alliance conflict - data << uint32(0xab2) << uint32(0x0); // 13 2738 Draenei - Alliance conflict - data << uint32(0xab1) << uint32(0x0); // 14 2737 Draenei - Horde conflict - data << uint32(0xab0) << uint32(0x0); // 15 2736 unk // 0 at start - data << uint32(0xaaf) << uint32(0x0); // 16 2735 unk // 0 at start - data << uint32(0xaad) << uint32(0x0); // 17 2733 Draenei - Horde control - data << uint32(0xaac) << uint32(0x0); // 18 2732 Draenei - Alliance control - data << uint32(0xaab) << uint32(0x1); // 19 2731 Draenei uncontrolled (1 - yes, 0 - no) - data << uint32(0xaaa) << uint32(0x0); // 20 2730 Mage Tower - Alliance control - data << uint32(0xaa9) << uint32(0x0); // 21 2729 Mage Tower - Horde control - data << uint32(0xaa8) << uint32(0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) - data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control - data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control - data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) - data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control - data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control - data << uint32(0xaa2) << uint32(0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) - data << uint32(0xac5) << uint32(0x1); // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way! - data << uint32(0xad2) << uint32(0x1); // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag - data << uint32(0xad1) << uint32(0x1); // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag - data << uint32(0xabe) << uint32(0x0); // 32 2750 Horde resources - data << uint32(0xabd) << uint32(0x0); // 33 2749 Alliance resources - data << uint32(0xa05) << uint32(0x8e); // 34 2565 unk, constant? - data << uint32(0xaa0) << uint32(0x0); // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) - data << uint32(0xa9f) << uint32(0x0); // 36 2719 Capturing progress-bar (0 - left, 100 - right) - data << uint32(0xa9e) << uint32(0x0); // 37 2718 Capturing progress-bar (1 - show, 0 - hide) - data << uint32(0xc0d) << uint32(0x17b); // 38 3085 unk - // and some more ... unknown - } - break; - // any of these needs change! the client remembers the prev setting! - // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF! - case 3483: // Hellfire Peninsula - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP) - pvp->FillInitialWorldStates(data); - else - { - data << uint32(0x9ba) << uint32(0x1); // 10 // add ally tower main gui icon // maybe should be sent only on login? - data << uint32(0x9b9) << uint32(0x1); // 11 // add horde tower main gui icon // maybe should be sent only on login? - data << uint32(0x9b5) << uint32(0x0); // 12 // show neutral broken hill icon // 2485 - data << uint32(0x9b4) << uint32(0x1); // 13 // show icon above broken hill // 2484 - data << uint32(0x9b3) << uint32(0x0); // 14 // show ally broken hill icon // 2483 - data << uint32(0x9b2) << uint32(0x0); // 15 // show neutral overlook icon // 2482 - data << uint32(0x9b1) << uint32(0x1); // 16 // show the overlook arrow // 2481 - data << uint32(0x9b0) << uint32(0x0); // 17 // show ally overlook icon // 2480 - data << uint32(0x9ae) << uint32(0x0); // 18 // horde pvp objectives captured // 2478 - data << uint32(0x9ac) << uint32(0x0); // 19 // ally pvp objectives captured // 2476 - data << uint32(2475) << uint32(100); //: ally / horde slider grey area // show only in direct vicinity! - data << uint32(2474) << uint32(50); //: ally / horde slider percentage, 100 for ally, 0 for horde // show only in direct vicinity! - data << uint32(2473) << uint32(0); //: ally / horde slider display // show only in direct vicinity! - data << uint32(0x9a8) << uint32(0x0); // 20 // show the neutral stadium icon // 2472 - data << uint32(0x9a7) << uint32(0x0); // 21 // show the ally stadium icon // 2471 - data << uint32(0x9a6) << uint32(0x1); // 22 // show the horde stadium icon // 2470 - } - break; - case 3518: // Nagrand - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA) - pvp->FillInitialWorldStates(data); - else - { - data << uint32(2503) << uint32(0x0); // 10 - data << uint32(2502) << uint32(0x0); // 11 - data << uint32(2493) << uint32(0x0); // 12 - data << uint32(2491) << uint32(0x0); // 13 - - data << uint32(2495) << uint32(0x0); // 14 - data << uint32(2494) << uint32(0x0); // 15 - data << uint32(2497) << uint32(0x0); // 16 - - data << uint32(2762) << uint32(0x0); // 17 - data << uint32(2662) << uint32(0x0); // 18 - data << uint32(2663) << uint32(0x0); // 19 - data << uint32(2664) << uint32(0x0); // 20 - - data << uint32(2760) << uint32(0x0); // 21 - data << uint32(2670) << uint32(0x0); // 22 - data << uint32(2668) << uint32(0x0); // 23 - data << uint32(2669) << uint32(0x0); // 24 - - data << uint32(2761) << uint32(0x0); // 25 - data << uint32(2667) << uint32(0x0); // 26 - data << uint32(2665) << uint32(0x0); // 27 - data << uint32(2666) << uint32(0x0); // 28 - - data << uint32(2763) << uint32(0x0); // 29 - data << uint32(2659) << uint32(0x0); // 30 - data << uint32(2660) << uint32(0x0); // 31 - data << uint32(2661) << uint32(0x0); // 32 - - data << uint32(2671) << uint32(0x0); // 33 - data << uint32(2676) << uint32(0x0); // 34 - data << uint32(2677) << uint32(0x0); // 35 - data << uint32(2672) << uint32(0x0); // 36 - data << uint32(2673) << uint32(0x0); // 37 - } - break; - case 3519: // Terokkar Forest - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF) - pvp->FillInitialWorldStates(data); - else - { - data << uint32(0xa41) << uint32(0x0); // 10 // 2625 capture bar pos - data << uint32(0xa40) << uint32(0x14); // 11 // 2624 capture bar neutral - data << uint32(0xa3f) << uint32(0x0); // 12 // 2623 show capture bar - data << uint32(0xa3e) << uint32(0x0); // 13 // 2622 horde towers controlled - data << uint32(0xa3d) << uint32(0x5); // 14 // 2621 ally towers controlled - data << uint32(0xa3c) << uint32(0x0); // 15 // 2620 show towers controlled - data << uint32(0xa88) << uint32(0x0); // 16 // 2696 SE Neu - data << uint32(0xa87) << uint32(0x0); // 17 // SE Horde - data << uint32(0xa86) << uint32(0x0); // 18 // SE Ally - data << uint32(0xa85) << uint32(0x0); // 19 //S Neu - data << uint32(0xa84) << uint32(0x0); // 20 S Horde - data << uint32(0xa83) << uint32(0x0); // 21 S Ally - data << uint32(0xa82) << uint32(0x0); // 22 NE Neu - data << uint32(0xa81) << uint32(0x0); // 23 NE Horde - data << uint32(0xa80) << uint32(0x0); // 24 NE Ally - data << uint32(0xa7e) << uint32(0x0); // 25 // 2686 N Neu - data << uint32(0xa7d) << uint32(0x0); // 26 N Horde - data << uint32(0xa7c) << uint32(0x0); // 27 N Ally - data << uint32(0xa7b) << uint32(0x0); // 28 NW Ally - data << uint32(0xa7a) << uint32(0x0); // 29 NW Horde - data << uint32(0xa79) << uint32(0x0); // 30 NW Neutral - data << uint32(0x9d0) << uint32(0x5); // 31 // 2512 locked time remaining seconds first digit - data << uint32(0x9ce) << uint32(0x0); // 32 // 2510 locked time remaining seconds second digit - data << uint32(0x9cd) << uint32(0x0); // 33 // 2509 locked time remaining minutes - data << uint32(0x9cc) << uint32(0x0); // 34 // 2508 neutral locked time show - data << uint32(0xad0) << uint32(0x0); // 35 // 2768 horde locked time show - data << uint32(0xacf) << uint32(0x1); // 36 // 2767 ally locked time show - } - break; - case 3521: // Zangarmarsh - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM) - pvp->FillInitialWorldStates(data); - else - { - data << uint32(0x9e1) << uint32(0x0); // 10 //2529 - data << uint32(0x9e0) << uint32(0x0); // 11 - data << uint32(0x9df) << uint32(0x0); // 12 - data << uint32(0xa5d) << uint32(0x1); // 13 //2653 - data << uint32(0xa5c) << uint32(0x0); // 14 //2652 east beacon neutral - data << uint32(0xa5b) << uint32(0x1); // 15 horde - data << uint32(0xa5a) << uint32(0x0); // 16 ally - data << uint32(0xa59) << uint32(0x1); // 17 // 2649 Twin spire graveyard horde 12??? - data << uint32(0xa58) << uint32(0x0); // 18 ally 14 ??? - data << uint32(0xa57) << uint32(0x0); // 19 neutral 7??? - data << uint32(0xa56) << uint32(0x0); // 20 // 2646 west beacon neutral - data << uint32(0xa55) << uint32(0x1); // 21 horde - data << uint32(0xa54) << uint32(0x0); // 22 ally - data << uint32(0x9e7) << uint32(0x0); // 23 // 2535 - data << uint32(0x9e6) << uint32(0x0); // 24 - data << uint32(0x9e5) << uint32(0x0); // 25 - data << uint32(0xa00) << uint32(0x0); // 26 // 2560 - data << uint32(0x9ff) << uint32(0x1); // 27 - data << uint32(0x9fe) << uint32(0x0); // 28 - data << uint32(0x9fd) << uint32(0x0); // 29 - data << uint32(0x9fc) << uint32(0x1); // 30 - data << uint32(0x9fb) << uint32(0x0); // 31 - data << uint32(0xa62) << uint32(0x0); // 32 // 2658 - data << uint32(0xa61) << uint32(0x1); // 33 - data << uint32(0xa60) << uint32(0x1); // 34 - data << uint32(0xa5f) << uint32(0x0); // 35 - } - break; - case 3698: // Nagrand Arena - if (bg && bg->GetBgTypeID() == BATTLEGROUND_NA) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0xa0f) << uint32(0x0); // 7 - data << uint32(0xa10) << uint32(0x0); // 8 - data << uint32(0xa11) << uint32(0x0); // 9 show - } - break; - case 3702: // Blade's Edge Arena - if (bg && bg->GetBgTypeID() == BATTLEGROUND_BE) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0x9f0) << uint32(0x0); // 7 gold - data << uint32(0x9f1) << uint32(0x0); // 8 green - data << uint32(0x9f3) << uint32(0x0); // 9 show - } - break; - case 3968: // Ruins of Lordaeron - if (bg && bg->GetBgTypeID() == BATTLEGROUND_RL) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0xbb8) << uint32(0x0); // 7 gold - data << uint32(0xbb9) << uint32(0x0); // 8 green - data << uint32(0xbba) << uint32(0x0); // 9 show - } - break; - case 4378: // Dalaran Sewers - if (bg && bg->GetBgTypeID() == BATTLEGROUND_DS) - bg->FillInitialWorldStates(data); - else - { - data << uint32(3601) << uint32(0x0); // 7 gold - data << uint32(3600) << uint32(0x0); // 8 green - data << uint32(3610) << uint32(0x0); // 9 show - } - break; - case 4384: // Strand of the Ancients - if (bg && bg->GetBgTypeID() == BATTLEGROUND_SA) - bg->FillInitialWorldStates(data); - else - { - // 1-3 A defend, 4-6 H defend, 7-9 unk defend, 1 - ok, 2 - half destroyed, 3 - destroyed - data << uint32(0xf09) << uint32(0x0); // 7 3849 Gate of Temple - data << uint32(0xe36) << uint32(0x0); // 8 3638 Gate of Yellow Moon - data << uint32(0xe27) << uint32(0x0); // 9 3623 Gate of Green Emerald - data << uint32(0xe24) << uint32(0x0); // 10 3620 Gate of Blue Sapphire - data << uint32(0xe21) << uint32(0x0); // 11 3617 Gate of Red Sun - data << uint32(0xe1e) << uint32(0x0); // 12 3614 Gate of Purple Ametyst - - data << uint32(0xdf3) << uint32(0x0); // 13 3571 bonus timer (1 - on, 0 - off) - data << uint32(0xded) << uint32(0x0); // 14 3565 Horde Attacker - data << uint32(0xdec) << uint32(0x0); // 15 3564 Alliance Attacker - // End Round (timer), better explain this by example, eg. ends in 19:59 -> A:BC - data << uint32(0xde9) << uint32(0x0); // 16 3561 C - data << uint32(0xde8) << uint32(0x0); // 17 3560 B - data << uint32(0xde7) << uint32(0x0); // 18 3559 A - data << uint32(0xe35) << uint32(0x0); // 19 3637 East g - Horde control - data << uint32(0xe34) << uint32(0x0); // 20 3636 West g - Horde control - data << uint32(0xe33) << uint32(0x0); // 21 3635 South g - Horde control - data << uint32(0xe32) << uint32(0x0); // 22 3634 East g - Alliance control - data << uint32(0xe31) << uint32(0x0); // 23 3633 West g - Alliance control - data << uint32(0xe30) << uint32(0x0); // 24 3632 South g - Alliance control - data << uint32(0xe2f) << uint32(0x0); // 25 3631 Chamber of Ancients - Horde control - data << uint32(0xe2e) << uint32(0x0); // 26 3630 Chamber of Ancients - Alliance control - data << uint32(0xe2d) << uint32(0x0); // 27 3629 Beach1 - Horde control - data << uint32(0xe2c) << uint32(0x0); // 28 3628 Beach2 - Horde control - data << uint32(0xe2b) << uint32(0x0); // 29 3627 Beach1 - Alliance control - data << uint32(0xe2a) << uint32(0x0); // 30 3626 Beach2 - Alliance control - // and many unks... - } - break; - case 4406: // Ring of Valor - if (bg && bg->GetBgTypeID() == BATTLEGROUND_RV) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0xe10) << uint32(0x0); // 7 gold - data << uint32(0xe11) << uint32(0x0); // 8 green - data << uint32(0xe1a) << uint32(0x0); // 9 show - } - break; - case 4710: - if (bg && bg->GetBgTypeID() == BATTLEGROUND_IC) - bg->FillInitialWorldStates(data); - else - { - data << uint32(4221) << uint32(1); // 7 BG_IC_ALLIANCE_RENFORT_SET - data << uint32(4222) << uint32(1); // 8 BG_IC_HORDE_RENFORT_SET - data << uint32(4226) << uint32(300); // 9 BG_IC_ALLIANCE_RENFORT - data << uint32(4227) << uint32(300); // 10 BG_IC_HORDE_RENFORT - data << uint32(4322) << uint32(1); // 11 BG_IC_GATE_FRONT_H_WS_OPEN - data << uint32(4321) << uint32(1); // 12 BG_IC_GATE_WEST_H_WS_OPEN - data << uint32(4320) << uint32(1); // 13 BG_IC_GATE_EAST_H_WS_OPEN - data << uint32(4323) << uint32(1); // 14 BG_IC_GATE_FRONT_A_WS_OPEN - data << uint32(4324) << uint32(1); // 15 BG_IC_GATE_WEST_A_WS_OPEN - data << uint32(4325) << uint32(1); // 16 BG_IC_GATE_EAST_A_WS_OPEN - data << uint32(4317) << uint32(1); // 17 unknown - - data << uint32(4301) << uint32(1); // 18 BG_IC_DOCKS_UNCONTROLLED - data << uint32(4296) << uint32(1); // 19 BG_IC_HANGAR_UNCONTROLLED - data << uint32(4306) << uint32(1); // 20 BG_IC_QUARRY_UNCONTROLLED - data << uint32(4311) << uint32(1); // 21 BG_IC_REFINERY_UNCONTROLLED - data << uint32(4294) << uint32(1); // 22 BG_IC_WORKSHOP_UNCONTROLLED - data << uint32(4243) << uint32(1); // 23 unknown - data << uint32(4345) << uint32(1); // 24 unknown - } - break; - // The Ruby Sanctum - case 4987: - if (instance && mapid == 724) - instance->FillInitialWorldStates(data); - else - { - data << uint32(5049) << uint32(50); // 9 WORLDSTATE_CORPOREALITY_MATERIAL - data << uint32(5050) << uint32(50); // 10 WORLDSTATE_CORPOREALITY_TWILIGHT - data << uint32(5051) << uint32(0); // 11 WORLDSTATE_CORPOREALITY_TOGGLE - } - break; - // Icecrown Citadel - case 4812: - if (instance && mapid == 631) - instance->FillInitialWorldStates(data); - else - { - data << uint32(4903) << uint32(0); // 9 WORLDSTATE_SHOW_TIMER (Blood Quickening weekly) - data << uint32(4904) << uint32(30); // 10 WORLDSTATE_EXECUTION_TIME - data << uint32(4940) << uint32(0); // 11 WORLDSTATE_SHOW_ATTEMPTS - data << uint32(4941) << uint32(50); // 12 WORLDSTATE_ATTEMPTS_REMAINING - data << uint32(4942) << uint32(50); // 13 WORLDSTATE_ATTEMPTS_MAX - } - break; - // The Culling of Stratholme - case 4100: - if (instance && mapid == 595) - instance->FillInitialWorldStates(data); - else - { - data << uint32(3479) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES - data << uint32(3480) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED - data << uint32(3504) << uint32(0); // 11 WORLDSTATE_WAVE_COUNT - data << uint32(3931) << uint32(25); // 12 WORLDSTATE_TIME_GUARDIAN - data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW - } - break; - // The Oculus - case 4228: - if (instance && mapid == 578) - instance->FillInitialWorldStates(data); - else - { - data << uint32(3524) << uint32(0); // 9 WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW - data << uint32(3486) << uint32(0); // 10 WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT - } - break; - // Ulduar - case 4273: - if (instance && mapid == 603) - instance->FillInitialWorldStates(data); - else - { - data << uint32(4132) << uint32(0); // 9 WORLDSTATE_ALGALON_TIMER_ENABLED - data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER - } - break; - // Halls of Refection - case 4820: - if (instance && mapid == 668) - instance->FillInitialWorldStates(data); - else - { - data << uint32(4884) << uint32(0); // 9 WORLD_STATE_HOR_WAVES_ENABLED - data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT - } - break; - // Scarlet Enclave (DK starting zone) - case 4298: - // Get Mograine, GUID and ENTRY should NEVER change - if (Creature* mograine = ObjectAccessor::GetCreature(*this, MAKE_NEW_GUID(130956, 29173, HIGHGUID_UNIT))) - { - if (CreatureAI* mograineAI = mograine->AI()) + if (Player::bgZoneIdToFillWorldStates.find(zoneid) != Player::bgZoneIdToFillWorldStates.end()) { + Player::bgZoneIdToFillWorldStates[zoneid](bg, data); + } + else { + // insert + switch (zoneid) + { + case 1: // Dun Morogh + case 11: // Wetlands + case 12: // Elwynn Forest + case 38: // Loch Modan + case 40: // Westfall + case 51: // Searing Gorge + case 1519: // Stormwind City + case 1537: // Ironforge + case 2257: // Deeprun Tram + case 3703: // Shattrath City + break; + case 139: // Eastern Plaguelands + if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP) + pvp->FillInitialWorldStates(data); + else { - data << uint32(3590) << uint32(mograineAI->GetData(3590)); - data << uint32(3591) << uint32(mograineAI->GetData(3591)); - data << uint32(3592) << uint32(mograineAI->GetData(3592)); - data << uint32(3603) << uint32(mograineAI->GetData(3603)); - data << uint32(3604) << uint32(mograineAI->GetData(3604)); - data << uint32(3605) << uint32(mograineAI->GetData(3605)); + data << uint32(0x97a) << uint32(0x0); // 10 2426 + data << uint32(0x917) << uint32(0x0); // 11 2327 + data << uint32(0x918) << uint32(0x0); // 12 2328 + data << uint32(0x97b) << uint32(0x32); // 13 2427 + data << uint32(0x97c) << uint32(0x32); // 14 2428 + data << uint32(0x933) << uint32(0x1); // 15 2355 + data << uint32(0x946) << uint32(0x0); // 16 2374 + data << uint32(0x947) << uint32(0x0); // 17 2375 + data << uint32(0x948) << uint32(0x0); // 18 2376 + data << uint32(0x949) << uint32(0x0); // 19 2377 + data << uint32(0x94a) << uint32(0x0); // 20 2378 + data << uint32(0x94b) << uint32(0x0); // 21 2379 + data << uint32(0x932) << uint32(0x0); // 22 2354 + data << uint32(0x934) << uint32(0x0); // 23 2356 + data << uint32(0x935) << uint32(0x0); // 24 2357 + data << uint32(0x936) << uint32(0x0); // 25 2358 + data << uint32(0x937) << uint32(0x0); // 26 2359 + data << uint32(0x938) << uint32(0x0); // 27 2360 + data << uint32(0x939) << uint32(0x1); // 28 2361 + data << uint32(0x930) << uint32(0x1); // 29 2352 + data << uint32(0x93a) << uint32(0x0); // 30 2362 + data << uint32(0x93b) << uint32(0x0); // 31 2363 + data << uint32(0x93c) << uint32(0x0); // 32 2364 + data << uint32(0x93d) << uint32(0x0); // 33 2365 + data << uint32(0x944) << uint32(0x0); // 34 2372 + data << uint32(0x945) << uint32(0x0); // 35 2373 + data << uint32(0x931) << uint32(0x1); // 36 2353 + data << uint32(0x93e) << uint32(0x0); // 37 2366 + data << uint32(0x931) << uint32(0x1); // 38 2367 ?? grey horde not in dbc! send for consistency's sake, and to match field count + data << uint32(0x940) << uint32(0x0); // 39 2368 + data << uint32(0x941) << uint32(0x0); // 7 2369 + data << uint32(0x942) << uint32(0x0); // 8 2370 + data << uint32(0x943) << uint32(0x0); // 9 2371 } - } - break; - // Wintergrasp - case 4197: - if (bf && bf->GetTypeId() == BATTLEFIELD_WG) - { - bf->FillInitialWorldStates(data); break; - } - // No break here, intended. - default: - data << uint32(0x914) << uint32(0x0); // 7 - data << uint32(0x913) << uint32(0x0); // 8 - data << uint32(0x912) << uint32(0x0); // 9 - data << uint32(0x915) << uint32(0x0); // 10 - break; + case 1377: // Silithus + if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_SI) + pvp->FillInitialWorldStates(data); + else + { + // states are always shown + data << uint32(2313) << uint32(0x0); // 7 ally silityst gathered + data << uint32(2314) << uint32(0x0); // 8 horde silityst gathered + data << uint32(2317) << uint32(0x0); // 9 max silithyst + } + // dunno about these... aq opening event maybe? + data << uint32(2322) << uint32(0x0); // 10 sandworm N + data << uint32(2323) << uint32(0x0); // 11 sandworm S + data << uint32(2324) << uint32(0x0); // 12 sandworm SW + data << uint32(2325) << uint32(0x0); // 13 sandworm E + break; + case 2597: // Alterac Valley + if (bg && bg->GetBgTypeID() == BATTLEGROUND_AV) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0x7ae) << uint32(0x1); // 7 snowfall n + data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc + data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac + data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a + data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused + data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused + data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c + data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c + data << uint32(0x550) << uint32(0x1); // 15 irondeep (N) ally + data << uint32(0x544) << uint32(0x0); // 16 ice grave a_a + data << uint32(0x536) << uint32(0x0); // 17 stormpike grave h_c + data << uint32(0x535) << uint32(0x1); // 18 stormpike grave a_c + data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a + data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a + data << uint32(0x574) << uint32(0x0); // 21 1396 unk + data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused + data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused + data << uint32(0x56f) << uint32(0x0); // 24 1391 unk + data << uint32(0x56e) << uint32(0x0); // 25 iceblood a + data << uint32(0x56d) << uint32(0x0); // 26 towerp a + data << uint32(0x56c) << uint32(0x0); // 27 frostwolfe a + data << uint32(0x56b) << uint32(0x0); // 28 froswolfw a + data << uint32(0x56a) << uint32(0x1); // 29 1386 unk + data << uint32(0x569) << uint32(0x1); // 30 iceblood c + data << uint32(0x568) << uint32(0x1); // 31 towerp c + data << uint32(0x565) << uint32(0x0); // 32 stoneh tower a + data << uint32(0x564) << uint32(0x0); // 33 icewing tower a + data << uint32(0x563) << uint32(0x0); // 34 dunn a + data << uint32(0x562) << uint32(0x0); // 35 duns a + data << uint32(0x561) << uint32(0x0); // 36 stoneheart bunker alliance assaulted - unused + data << uint32(0x560) << uint32(0x0); // 37 icewing bunker alliance assaulted - unused + data << uint32(0x55f) << uint32(0x0); // 38 dunbaldar south alliance assaulted - unused + data << uint32(0x55e) << uint32(0x0); // 39 dunbaldar north alliance assaulted - unused + data << uint32(0x55d) << uint32(0x0); // 40 stone tower d + data << uint32(0x3c6) << uint32(0x0); // 41 966 unk + data << uint32(0x3c4) << uint32(0x0); // 42 964 unk + data << uint32(0x3c2) << uint32(0x0); // 43 962 unk + data << uint32(0x516) << uint32(0x1); // 44 stoneheart grave a_c + data << uint32(0x515) << uint32(0x0); // 45 stonheart grave h_c + data << uint32(0x3b6) << uint32(0x0); // 46 950 unk + data << uint32(0x55c) << uint32(0x0); // 47 icewing tower d + data << uint32(0x55b) << uint32(0x0); // 48 dunn d + data << uint32(0x55a) << uint32(0x0); // 49 duns d + data << uint32(0x559) << uint32(0x0); // 50 1369 unk + data << uint32(0x558) << uint32(0x0); // 51 iceblood d + data << uint32(0x557) << uint32(0x0); // 52 towerp d + data << uint32(0x556) << uint32(0x0); // 53 frostwolfe d + data << uint32(0x555) << uint32(0x0); // 54 frostwolfw d + data << uint32(0x554) << uint32(0x1); // 55 stoneh tower c + data << uint32(0x553) << uint32(0x1); // 56 icewing tower c + data << uint32(0x552) << uint32(0x1); // 57 dunn c + data << uint32(0x551) << uint32(0x1); // 58 duns c + data << uint32(0x54f) << uint32(0x0); // 59 irondeep (N) horde + data << uint32(0x54e) << uint32(0x0); // 60 irondeep (N) ally + data << uint32(0x54d) << uint32(0x1); // 61 mine (S) neutral + data << uint32(0x54c) << uint32(0x0); // 62 mine (S) horde + data << uint32(0x54b) << uint32(0x0); // 63 mine (S) ally + data << uint32(0x545) << uint32(0x0); // 64 iceblood h_a + data << uint32(0x543) << uint32(0x1); // 65 iceblod h_c + data << uint32(0x542) << uint32(0x0); // 66 iceblood a_c + data << uint32(0x540) << uint32(0x0); // 67 snowfall h_a + data << uint32(0x53f) << uint32(0x0); // 68 snowfall a_a + data << uint32(0x53e) << uint32(0x0); // 69 snowfall h_c + data << uint32(0x53d) << uint32(0x0); // 70 snowfall a_c + data << uint32(0x53c) << uint32(0x0); // 71 frostwolf g h_a + data << uint32(0x53b) << uint32(0x0); // 72 frostwolf g a_a + data << uint32(0x53a) << uint32(0x1); // 73 frostwolf g h_c + data << uint32(0x539) << uint32(0x0); // 74 frostwolf g a_c + data << uint32(0x538) << uint32(0x0); // 75 stormpike grave h_a + data << uint32(0x537) << uint32(0x0); // 76 stormpike grave a_a + data << uint32(0x534) << uint32(0x0); // 77 frostwolf hut h_a + data << uint32(0x533) << uint32(0x0); // 78 frostwolf hut a_a + data << uint32(0x530) << uint32(0x0); // 79 stormpike first aid h_a + data << uint32(0x52f) << uint32(0x0); // 80 stormpike first aid h_c + data << uint32(0x52d) << uint32(0x1); // 81 stormpike first aid a_c + } + break; + case 3277: // Warsong Gulch + if (bg && bg->GetBgTypeID() == BATTLEGROUND_WS) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0x62d) << uint32(0x0); // 7 1581 alliance flag captures + data << uint32(0x62e) << uint32(0x0); // 8 1582 horde flag captures + data << uint32(0x609) << uint32(0x0); // 9 1545 unk, set to 1 on alliance flag pickup... + data << uint32(0x60a) << uint32(0x0); // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1 + data << uint32(0x60b) << uint32(0x2); // 11 1547 unk + data << uint32(0x641) << uint32(0x3); // 12 1601 unk (max flag captures?) + data << uint32(0x922) << uint32(0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + data << uint32(0x923) << uint32(0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + } + break; + case 3358: // Arathi Basin + if (bg && bg->GetBgTypeID() == BATTLEGROUND_AB) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0x6e7) << uint32(0x0); // 7 1767 stables alliance + data << uint32(0x6e8) << uint32(0x0); // 8 1768 stables horde + data << uint32(0x6e9) << uint32(0x0); // 9 1769 unk, ST? + data << uint32(0x6ea) << uint32(0x0); // 10 1770 stables (show/hide) + data << uint32(0x6ec) << uint32(0x0); // 11 1772 farm (0 - horde controlled, 1 - alliance controlled) + data << uint32(0x6ed) << uint32(0x0); // 12 1773 farm (show/hide) + data << uint32(0x6ee) << uint32(0x0); // 13 1774 farm color + data << uint32(0x6ef) << uint32(0x0); // 14 1775 gold mine color, may be FM? + data << uint32(0x6f0) << uint32(0x0); // 15 1776 alliance resources + data << uint32(0x6f1) << uint32(0x0); // 16 1777 horde resources + data << uint32(0x6f2) << uint32(0x0); // 17 1778 horde bases + data << uint32(0x6f3) << uint32(0x0); // 18 1779 alliance bases + data << uint32(0x6f4) << uint32(0x640); // 19 1780 max resources (1600) + data << uint32(0x6f6) << uint32(0x0); // 20 1782 blacksmith color + data << uint32(0x6f7) << uint32(0x0); // 21 1783 blacksmith (show/hide) + data << uint32(0x6f8) << uint32(0x0); // 22 1784 unk, bs? + data << uint32(0x6f9) << uint32(0x0); // 23 1785 unk, bs? + data << uint32(0x6fb) << uint32(0x0); // 24 1787 gold mine (0 - horde contr, 1 - alliance contr) + data << uint32(0x6fc) << uint32(0x0); // 25 1788 gold mine (0 - conflict, 1 - horde) + data << uint32(0x6fd) << uint32(0x0); // 26 1789 gold mine (1 - show/0 - hide) + data << uint32(0x6fe) << uint32(0x0); // 27 1790 gold mine color + data << uint32(0x700) << uint32(0x0); // 28 1792 gold mine color, wtf?, may be LM? + data << uint32(0x701) << uint32(0x0); // 29 1793 lumber mill color (0 - conflict, 1 - horde contr) + data << uint32(0x702) << uint32(0x0); // 30 1794 lumber mill (show/hide) + data << uint32(0x703) << uint32(0x0); // 31 1795 lumber mill color color + data << uint32(0x732) << uint32(0x1); // 32 1842 stables (1 - uncontrolled) + data << uint32(0x733) << uint32(0x1); // 33 1843 gold mine (1 - uncontrolled) + data << uint32(0x734) << uint32(0x1); // 34 1844 lumber mill (1 - uncontrolled) + data << uint32(0x735) << uint32(0x1); // 35 1845 farm (1 - uncontrolled) + data << uint32(0x736) << uint32(0x1); // 36 1846 blacksmith (1 - uncontrolled) + data << uint32(0x745) << uint32(0x2); // 37 1861 unk + data << uint32(0x7a3) << uint32(0x578); // 38 1955 warning limit (1400) + } + break; + case 3820: // Eye of the Storm + if (bg && bg->GetBgTypeID() == BATTLEGROUND_EY) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0xac1) << uint32(0x0); // 7 2753 Horde Bases + data << uint32(0xac0) << uint32(0x0); // 8 2752 Alliance Bases + data << uint32(0xab6) << uint32(0x0); // 9 2742 Mage Tower - Horde conflict + data << uint32(0xab5) << uint32(0x0); // 10 2741 Mage Tower - Alliance conflict + data << uint32(0xab4) << uint32(0x0); // 11 2740 Fel Reaver - Horde conflict + data << uint32(0xab3) << uint32(0x0); // 12 2739 Fel Reaver - Alliance conflict + data << uint32(0xab2) << uint32(0x0); // 13 2738 Draenei - Alliance conflict + data << uint32(0xab1) << uint32(0x0); // 14 2737 Draenei - Horde conflict + data << uint32(0xab0) << uint32(0x0); // 15 2736 unk // 0 at start + data << uint32(0xaaf) << uint32(0x0); // 16 2735 unk // 0 at start + data << uint32(0xaad) << uint32(0x0); // 17 2733 Draenei - Horde control + data << uint32(0xaac) << uint32(0x0); // 18 2732 Draenei - Alliance control + data << uint32(0xaab) << uint32(0x1); // 19 2731 Draenei uncontrolled (1 - yes, 0 - no) + data << uint32(0xaaa) << uint32(0x0); // 20 2730 Mage Tower - Alliance control + data << uint32(0xaa9) << uint32(0x0); // 21 2729 Mage Tower - Horde control + data << uint32(0xaa8) << uint32(0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) + data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control + data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control + data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) + data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control + data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control + data << uint32(0xaa2) << uint32(0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) + data << uint32(0xac5) << uint32(0x1); // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way! + data << uint32(0xad2) << uint32(0x1); // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag + data << uint32(0xad1) << uint32(0x1); // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag + data << uint32(0xabe) << uint32(0x0); // 32 2750 Horde resources + data << uint32(0xabd) << uint32(0x0); // 33 2749 Alliance resources + data << uint32(0xa05) << uint32(0x8e); // 34 2565 unk, constant? + data << uint32(0xaa0) << uint32(0x0); // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) + data << uint32(0xa9f) << uint32(0x0); // 36 2719 Capturing progress-bar (0 - left, 100 - right) + data << uint32(0xa9e) << uint32(0x0); // 37 2718 Capturing progress-bar (1 - show, 0 - hide) + data << uint32(0xc0d) << uint32(0x17b); // 38 3085 unk + // and some more ... unknown + } + break; + // any of these needs change! the client remembers the prev setting! + // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF! + case 3483: // Hellfire Peninsula + if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0x9ba) << uint32(0x1); // 10 // add ally tower main gui icon // maybe should be sent only on login? + data << uint32(0x9b9) << uint32(0x1); // 11 // add horde tower main gui icon // maybe should be sent only on login? + data << uint32(0x9b5) << uint32(0x0); // 12 // show neutral broken hill icon // 2485 + data << uint32(0x9b4) << uint32(0x1); // 13 // show icon above broken hill // 2484 + data << uint32(0x9b3) << uint32(0x0); // 14 // show ally broken hill icon // 2483 + data << uint32(0x9b2) << uint32(0x0); // 15 // show neutral overlook icon // 2482 + data << uint32(0x9b1) << uint32(0x1); // 16 // show the overlook arrow // 2481 + data << uint32(0x9b0) << uint32(0x0); // 17 // show ally overlook icon // 2480 + data << uint32(0x9ae) << uint32(0x0); // 18 // horde pvp objectives captured // 2478 + data << uint32(0x9ac) << uint32(0x0); // 19 // ally pvp objectives captured // 2476 + data << uint32(2475) << uint32(100); //: ally / horde slider grey area // show only in direct vicinity! + data << uint32(2474) << uint32(50); //: ally / horde slider percentage, 100 for ally, 0 for horde // show only in direct vicinity! + data << uint32(2473) << uint32(0); //: ally / horde slider display // show only in direct vicinity! + data << uint32(0x9a8) << uint32(0x0); // 20 // show the neutral stadium icon // 2472 + data << uint32(0x9a7) << uint32(0x0); // 21 // show the ally stadium icon // 2471 + data << uint32(0x9a6) << uint32(0x1); // 22 // show the horde stadium icon // 2470 + } + break; + case 3518: // Nagrand + if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(2503) << uint32(0x0); // 10 + data << uint32(2502) << uint32(0x0); // 11 + data << uint32(2493) << uint32(0x0); // 12 + data << uint32(2491) << uint32(0x0); // 13 + + data << uint32(2495) << uint32(0x0); // 14 + data << uint32(2494) << uint32(0x0); // 15 + data << uint32(2497) << uint32(0x0); // 16 + + data << uint32(2762) << uint32(0x0); // 17 + data << uint32(2662) << uint32(0x0); // 18 + data << uint32(2663) << uint32(0x0); // 19 + data << uint32(2664) << uint32(0x0); // 20 + + data << uint32(2760) << uint32(0x0); // 21 + data << uint32(2670) << uint32(0x0); // 22 + data << uint32(2668) << uint32(0x0); // 23 + data << uint32(2669) << uint32(0x0); // 24 + + data << uint32(2761) << uint32(0x0); // 25 + data << uint32(2667) << uint32(0x0); // 26 + data << uint32(2665) << uint32(0x0); // 27 + data << uint32(2666) << uint32(0x0); // 28 + + data << uint32(2763) << uint32(0x0); // 29 + data << uint32(2659) << uint32(0x0); // 30 + data << uint32(2660) << uint32(0x0); // 31 + data << uint32(2661) << uint32(0x0); // 32 + + data << uint32(2671) << uint32(0x0); // 33 + data << uint32(2676) << uint32(0x0); // 34 + data << uint32(2677) << uint32(0x0); // 35 + data << uint32(2672) << uint32(0x0); // 36 + data << uint32(2673) << uint32(0x0); // 37 + } + break; + case 3519: // Terokkar Forest + if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0xa41) << uint32(0x0); // 10 // 2625 capture bar pos + data << uint32(0xa40) << uint32(0x14); // 11 // 2624 capture bar neutral + data << uint32(0xa3f) << uint32(0x0); // 12 // 2623 show capture bar + data << uint32(0xa3e) << uint32(0x0); // 13 // 2622 horde towers controlled + data << uint32(0xa3d) << uint32(0x5); // 14 // 2621 ally towers controlled + data << uint32(0xa3c) << uint32(0x0); // 15 // 2620 show towers controlled + data << uint32(0xa88) << uint32(0x0); // 16 // 2696 SE Neu + data << uint32(0xa87) << uint32(0x0); // 17 // SE Horde + data << uint32(0xa86) << uint32(0x0); // 18 // SE Ally + data << uint32(0xa85) << uint32(0x0); // 19 //S Neu + data << uint32(0xa84) << uint32(0x0); // 20 S Horde + data << uint32(0xa83) << uint32(0x0); // 21 S Ally + data << uint32(0xa82) << uint32(0x0); // 22 NE Neu + data << uint32(0xa81) << uint32(0x0); // 23 NE Horde + data << uint32(0xa80) << uint32(0x0); // 24 NE Ally + data << uint32(0xa7e) << uint32(0x0); // 25 // 2686 N Neu + data << uint32(0xa7d) << uint32(0x0); // 26 N Horde + data << uint32(0xa7c) << uint32(0x0); // 27 N Ally + data << uint32(0xa7b) << uint32(0x0); // 28 NW Ally + data << uint32(0xa7a) << uint32(0x0); // 29 NW Horde + data << uint32(0xa79) << uint32(0x0); // 30 NW Neutral + data << uint32(0x9d0) << uint32(0x5); // 31 // 2512 locked time remaining seconds first digit + data << uint32(0x9ce) << uint32(0x0); // 32 // 2510 locked time remaining seconds second digit + data << uint32(0x9cd) << uint32(0x0); // 33 // 2509 locked time remaining minutes + data << uint32(0x9cc) << uint32(0x0); // 34 // 2508 neutral locked time show + data << uint32(0xad0) << uint32(0x0); // 35 // 2768 horde locked time show + data << uint32(0xacf) << uint32(0x1); // 36 // 2767 ally locked time show + } + break; + case 3521: // Zangarmarsh + if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM) + pvp->FillInitialWorldStates(data); + else + { + data << uint32(0x9e1) << uint32(0x0); // 10 //2529 + data << uint32(0x9e0) << uint32(0x0); // 11 + data << uint32(0x9df) << uint32(0x0); // 12 + data << uint32(0xa5d) << uint32(0x1); // 13 //2653 + data << uint32(0xa5c) << uint32(0x0); // 14 //2652 east beacon neutral + data << uint32(0xa5b) << uint32(0x1); // 15 horde + data << uint32(0xa5a) << uint32(0x0); // 16 ally + data << uint32(0xa59) << uint32(0x1); // 17 // 2649 Twin spire graveyard horde 12??? + data << uint32(0xa58) << uint32(0x0); // 18 ally 14 ??? + data << uint32(0xa57) << uint32(0x0); // 19 neutral 7??? + data << uint32(0xa56) << uint32(0x0); // 20 // 2646 west beacon neutral + data << uint32(0xa55) << uint32(0x1); // 21 horde + data << uint32(0xa54) << uint32(0x0); // 22 ally + data << uint32(0x9e7) << uint32(0x0); // 23 // 2535 + data << uint32(0x9e6) << uint32(0x0); // 24 + data << uint32(0x9e5) << uint32(0x0); // 25 + data << uint32(0xa00) << uint32(0x0); // 26 // 2560 + data << uint32(0x9ff) << uint32(0x1); // 27 + data << uint32(0x9fe) << uint32(0x0); // 28 + data << uint32(0x9fd) << uint32(0x0); // 29 + data << uint32(0x9fc) << uint32(0x1); // 30 + data << uint32(0x9fb) << uint32(0x0); // 31 + data << uint32(0xa62) << uint32(0x0); // 32 // 2658 + data << uint32(0xa61) << uint32(0x1); // 33 + data << uint32(0xa60) << uint32(0x1); // 34 + data << uint32(0xa5f) << uint32(0x0); // 35 + } + break; + case 3698: // Nagrand Arena + if (bg && bg->GetBgTypeID() == BATTLEGROUND_NA) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0xa0f) << uint32(0x0); // 7 + data << uint32(0xa10) << uint32(0x0); // 8 + data << uint32(0xa11) << uint32(0x0); // 9 show + } + break; + case 3702: // Blade's Edge Arena + if (bg && bg->GetBgTypeID() == BATTLEGROUND_BE) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0x9f0) << uint32(0x0); // 7 gold + data << uint32(0x9f1) << uint32(0x0); // 8 green + data << uint32(0x9f3) << uint32(0x0); // 9 show + } + break; + case 3968: // Ruins of Lordaeron + if (bg && bg->GetBgTypeID() == BATTLEGROUND_RL) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0xbb8) << uint32(0x0); // 7 gold + data << uint32(0xbb9) << uint32(0x0); // 8 green + data << uint32(0xbba) << uint32(0x0); // 9 show + } + break; + case 4378: // Dalaran Sewers + if (bg && bg->GetBgTypeID() == BATTLEGROUND_DS) + bg->FillInitialWorldStates(data); + else + { + data << uint32(3601) << uint32(0x0); // 7 gold + data << uint32(3600) << uint32(0x0); // 8 green + data << uint32(3610) << uint32(0x0); // 9 show + } + break; + case 4384: // Strand of the Ancients + if (bg && bg->GetBgTypeID() == BATTLEGROUND_SA) + bg->FillInitialWorldStates(data); + else + { + // 1-3 A defend, 4-6 H defend, 7-9 unk defend, 1 - ok, 2 - half destroyed, 3 - destroyed + data << uint32(0xf09) << uint32(0x0); // 7 3849 Gate of Temple + data << uint32(0xe36) << uint32(0x0); // 8 3638 Gate of Yellow Moon + data << uint32(0xe27) << uint32(0x0); // 9 3623 Gate of Green Emerald + data << uint32(0xe24) << uint32(0x0); // 10 3620 Gate of Blue Sapphire + data << uint32(0xe21) << uint32(0x0); // 11 3617 Gate of Red Sun + data << uint32(0xe1e) << uint32(0x0); // 12 3614 Gate of Purple Ametyst + + data << uint32(0xdf3) << uint32(0x0); // 13 3571 bonus timer (1 - on, 0 - off) + data << uint32(0xded) << uint32(0x0); // 14 3565 Horde Attacker + data << uint32(0xdec) << uint32(0x0); // 15 3564 Alliance Attacker + // End Round (timer), better explain this by example, eg. ends in 19:59 -> A:BC + data << uint32(0xde9) << uint32(0x0); // 16 3561 C + data << uint32(0xde8) << uint32(0x0); // 17 3560 B + data << uint32(0xde7) << uint32(0x0); // 18 3559 A + data << uint32(0xe35) << uint32(0x0); // 19 3637 East g - Horde control + data << uint32(0xe34) << uint32(0x0); // 20 3636 West g - Horde control + data << uint32(0xe33) << uint32(0x0); // 21 3635 South g - Horde control + data << uint32(0xe32) << uint32(0x0); // 22 3634 East g - Alliance control + data << uint32(0xe31) << uint32(0x0); // 23 3633 West g - Alliance control + data << uint32(0xe30) << uint32(0x0); // 24 3632 South g - Alliance control + data << uint32(0xe2f) << uint32(0x0); // 25 3631 Chamber of Ancients - Horde control + data << uint32(0xe2e) << uint32(0x0); // 26 3630 Chamber of Ancients - Alliance control + data << uint32(0xe2d) << uint32(0x0); // 27 3629 Beach1 - Horde control + data << uint32(0xe2c) << uint32(0x0); // 28 3628 Beach2 - Horde control + data << uint32(0xe2b) << uint32(0x0); // 29 3627 Beach1 - Alliance control + data << uint32(0xe2a) << uint32(0x0); // 30 3626 Beach2 - Alliance control + // and many unks... + } + break; + case 4406: // Ring of Valor + if (bg && bg->GetBgTypeID() == BATTLEGROUND_RV) + bg->FillInitialWorldStates(data); + else + { + data << uint32(0xe10) << uint32(0x0); // 7 gold + data << uint32(0xe11) << uint32(0x0); // 8 green + data << uint32(0xe1a) << uint32(0x0); // 9 show + } + break; + case 4710: + if (bg && bg->GetBgTypeID() == BATTLEGROUND_IC) + bg->FillInitialWorldStates(data); + else + { + data << uint32(4221) << uint32(1); // 7 BG_IC_ALLIANCE_RENFORT_SET + data << uint32(4222) << uint32(1); // 8 BG_IC_HORDE_RENFORT_SET + data << uint32(4226) << uint32(300); // 9 BG_IC_ALLIANCE_RENFORT + data << uint32(4227) << uint32(300); // 10 BG_IC_HORDE_RENFORT + data << uint32(4322) << uint32(1); // 11 BG_IC_GATE_FRONT_H_WS_OPEN + data << uint32(4321) << uint32(1); // 12 BG_IC_GATE_WEST_H_WS_OPEN + data << uint32(4320) << uint32(1); // 13 BG_IC_GATE_EAST_H_WS_OPEN + data << uint32(4323) << uint32(1); // 14 BG_IC_GATE_FRONT_A_WS_OPEN + data << uint32(4324) << uint32(1); // 15 BG_IC_GATE_WEST_A_WS_OPEN + data << uint32(4325) << uint32(1); // 16 BG_IC_GATE_EAST_A_WS_OPEN + data << uint32(4317) << uint32(1); // 17 unknown + + data << uint32(4301) << uint32(1); // 18 BG_IC_DOCKS_UNCONTROLLED + data << uint32(4296) << uint32(1); // 19 BG_IC_HANGAR_UNCONTROLLED + data << uint32(4306) << uint32(1); // 20 BG_IC_QUARRY_UNCONTROLLED + data << uint32(4311) << uint32(1); // 21 BG_IC_REFINERY_UNCONTROLLED + data << uint32(4294) << uint32(1); // 22 BG_IC_WORKSHOP_UNCONTROLLED + data << uint32(4243) << uint32(1); // 23 unknown + data << uint32(4345) << uint32(1); // 24 unknown + } + break; + // The Ruby Sanctum + case 4987: + if (instance && mapid == 724) + instance->FillInitialWorldStates(data); + else + { + data << uint32(5049) << uint32(50); // 9 WORLDSTATE_CORPOREALITY_MATERIAL + data << uint32(5050) << uint32(50); // 10 WORLDSTATE_CORPOREALITY_TWILIGHT + data << uint32(5051) << uint32(0); // 11 WORLDSTATE_CORPOREALITY_TOGGLE + } + break; + // Icecrown Citadel + case 4812: + if (instance && mapid == 631) + instance->FillInitialWorldStates(data); + else + { + data << uint32(4903) << uint32(0); // 9 WORLDSTATE_SHOW_TIMER (Blood Quickening weekly) + data << uint32(4904) << uint32(30); // 10 WORLDSTATE_EXECUTION_TIME + data << uint32(4940) << uint32(0); // 11 WORLDSTATE_SHOW_ATTEMPTS + data << uint32(4941) << uint32(50); // 12 WORLDSTATE_ATTEMPTS_REMAINING + data << uint32(4942) << uint32(50); // 13 WORLDSTATE_ATTEMPTS_MAX + } + break; + // The Culling of Stratholme + case 4100: + if (instance && mapid == 595) + instance->FillInitialWorldStates(data); + else + { + data << uint32(3479) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES + data << uint32(3480) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED + data << uint32(3504) << uint32(0); // 11 WORLDSTATE_WAVE_COUNT + data << uint32(3931) << uint32(25); // 12 WORLDSTATE_TIME_GUARDIAN + data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW + } + break; + // The Oculus + case 4228: + if (instance && mapid == 578) + instance->FillInitialWorldStates(data); + else + { + data << uint32(3524) << uint32(0); // 9 WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW + data << uint32(3486) << uint32(0); // 10 WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT + } + break; + // Ulduar + case 4273: + if (instance && mapid == 603) + instance->FillInitialWorldStates(data); + else + { + data << uint32(4132) << uint32(0); // 9 WORLDSTATE_ALGALON_TIMER_ENABLED + data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER + } + break; + // Halls of Refection + case 4820: + if (instance && mapid == 668) + instance->FillInitialWorldStates(data); + else + { + data << uint32(4884) << uint32(0); // 9 WORLD_STATE_HOR_WAVES_ENABLED + data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT + } + break; + // Scarlet Enclave (DK starting zone) + case 4298: + // Get Mograine, GUID and ENTRY should NEVER change + if (Creature* mograine = ObjectAccessor::GetCreature(*this, MAKE_NEW_GUID(130956, 29173, HIGHGUID_UNIT))) + { + if (CreatureAI* mograineAI = mograine->AI()) + { + data << uint32(3590) << uint32(mograineAI->GetData(3590)); + data << uint32(3591) << uint32(mograineAI->GetData(3591)); + data << uint32(3592) << uint32(mograineAI->GetData(3592)); + data << uint32(3603) << uint32(mograineAI->GetData(3603)); + data << uint32(3604) << uint32(mograineAI->GetData(3604)); + data << uint32(3605) << uint32(mograineAI->GetData(3605)); + } + } + break; + // Wintergrasp + case 4197: + if (bf && bf->GetTypeId() == BATTLEFIELD_WG) + { + bf->FillInitialWorldStates(data); + break; + } + // No break here, intended. + default: + data << uint32(0x914) << uint32(0x0); // 7 + data << uint32(0x913) << uint32(0x0); // 8 + data << uint32(0x912) << uint32(0x0); // 9 + data << uint32(0x915) << uint32(0x0); // 10 + break; + } } uint16 length = (data.wpos() - countPos) / 8; @@ -27620,3 +27625,5 @@ bool Player::IsPetDismissed() return false; } + +std::unordered_map Player::bgZoneIdToFillWorldStates = {}; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index ee101e32465ccf..37def0c1578ddc 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -45,6 +45,7 @@ class SpellCastTargets; class UpdateMask; typedef std::deque PlayerMails; +typedef void(*bgZoneRef)(Battleground*, WorldPacket&); #define PLAYER_MAX_SKILLS 127 #define PLAYER_MAX_DAILY_QUESTS 25 @@ -2628,6 +2629,8 @@ class Player : public Unit, public GridObject uint32 GetNextSave() const { return m_nextSave; } SpellModList const& GetSpellModList(uint32 type) const { return m_spellMods[type]; } + static std::unordered_map bgZoneIdToFillWorldStates; // zoneId -> FillInitialWorldStates + protected: // Gamemaster whisper whitelist WhisperListContainer WhisperList;