diff options
author | megamage <none@none> | 2009-02-09 22:08:06 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-09 22:08:06 -0600 |
commit | d696381f325278d2243ec5072e872ebfd38f8568 (patch) | |
tree | 7ecde5127884a93c7b7d5ff6a7d2bd62db553d20 | |
parent | 99c822621621ae0aa1ab1b28d3c1dc782ee9434a (diff) |
[7250] Use bg type ids enum insted raw values and catch some bugs in result for fixing.
* Replace max bg type checks by DBC valid index check
* Use in functions and fields BattlegroundTypeId type instead uint32
* Fixed wrong use bg queue ids instead bg type ids in queue update/remove function calls.
Many bg have same raw values for type id and queue id but some can be affected by this bug:
BATTLEGROUND_EY, BATTLEGROUND_SA, and all areans (with small arena/team size exceptions)
* Move Battlemaster to bg type ids map fron ObjectMgr to BatteleGroundMgr.
* Remobe redundent for header itself includes for BG headers.
* Use Auction location enum instead raw valus.
Author: VladimirMangos
--HG--
branch : trunk
33 files changed, 337 insertions, 279 deletions
diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index a8bd08113ae..3765d5e731a 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -650,6 +650,19 @@ void ArenaTeam::FinishWeek() } } +bool ArenaTeam::IsFighting() const +{ + for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) + { + if (Player *p = objmgr.GetPlayer(itr->guid)) + { + if (p->GetMap()->IsBattleArena()) + return true; + } + } + return false; +} + /* arenateam fields (id from 2.3.3 client): 1414 - arena team id 2v2 diff --git a/src/game/ArenaTeam.h b/src/game/ArenaTeam.h index cb53aedc0f4..4b839401e12 100644 --- a/src/game/ArenaTeam.h +++ b/src/game/ArenaTeam.h @@ -179,18 +179,7 @@ class ArenaTeam return NULL; } - bool IsFighting() const - { - for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) - { - if (Player *p = objmgr.GetPlayer(itr->guid)) - { - if (p->GetMap()->IsBattleArena()) - return true; - } - } - return false; - } + bool IsFighting() const; bool LoadArenaTeamFromDB(uint32 ArenaTeamId); void LoadMembersFromDB(uint32 ArenaTeamId); diff --git a/src/game/AuctionHouse.cpp b/src/game/AuctionHouse.cpp index f566d98a773..b9bafdf0eb6 100644 --- a/src/game/AuctionHouse.cpp +++ b/src/game/AuctionHouse.cpp @@ -55,21 +55,21 @@ void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data ) SendAuctionHello(guid, unit); } -static uint8 AuctioneerFactionToLocation(uint32 faction) +static AuctionLocation AuctioneerFactionToLocation(uint32 faction) { if(sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) - return 7; // neutral + return AUCTION_NEUTRAL; FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(faction); if(!u_entry) - return 7; // neutral + return AUCTION_NEUTRAL; if(u_entry->ourMask & FACTION_MASK_ALLIANCE) - return 2; + return AUCTION_ALLIANCE; else if(u_entry->ourMask & FACTION_MASK_HORDE) - return 6; + return AUCTION_HORDE; else - return 7; + return AUCTION_NEUTRAL; } //this void causes that auction window is opened @@ -132,13 +132,13 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin void WorldSession::SendAuctionBidderNotification( uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template) { WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4)); - data << location; - data << auctionId; - data << (uint64) bidder; - data << bidSum; - data << (uint32) diff; - data << item_template; - data << (uint32) 0; + data << uint32(location); + data << uint32(auctionId); + data << uint64(bidder); + data << uint32(bidSum); + data << uint32(diff); + data << uint32(item_template); + data << uint32(0); SendPacket(&data); } @@ -268,7 +268,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data ) return; } - uint32 location = AuctioneerFactionToLocation(pCreature->getFaction()); + AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction()); AuctionHouseObject * mAuctions; mAuctions = objmgr.GetAuctionsMap( location ); @@ -347,7 +347,7 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - uint32 location = AuctioneerFactionToLocation(pCreature->getFaction()); + AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction()); AuctionHouseObject * mAuctions; mAuctions = objmgr.GetAuctionsMap( location ); @@ -474,7 +474,7 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - uint32 location = AuctioneerFactionToLocation(pCreature->getFaction()); + AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction()); AuctionHouseObject * mAuctions; mAuctions = objmgr.GetAuctionsMap( location ); @@ -562,7 +562,7 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - uint32 location = AuctioneerFactionToLocation(pCreature->getFaction()); + AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction()); AuctionHouseObject* mAuctions = objmgr.GetAuctionsMap( location ); WorldPacket data( SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4) ); @@ -620,7 +620,7 @@ void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - uint32 location = AuctioneerFactionToLocation(pCreature->getFaction()); + AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction()); AuctionHouseObject* mAuctions = objmgr.GetAuctionsMap( location ); @@ -650,9 +650,9 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) { CHECK_PACKET_SIZE(recv_data,8+4+1+1+1+4+4+4+4+1); - std::string searchedname, name; - uint8 levelmin, levelmax, usable, location; - uint32 count, totalcount, listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; + std::string searchedname; + uint8 levelmin, levelmax, usable; + uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality; uint64 guid; recv_data >> guid; @@ -677,15 +677,14 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) if(GetPlayer()->hasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); - location = AuctioneerFactionToLocation(pCreature->getFaction()); - AuctionHouseObject * mAuctions; - mAuctions = objmgr.GetAuctionsMap( location ); + AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction()); + AuctionHouseObject * mAuctions = objmgr.GetAuctionsMap( location ); //sLog.outDebug("Auctionhouse search guid: " I64FMTD ", list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", guid, listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); WorldPacket data( SMSG_AUCTION_LIST_RESULT, (4+4+4) ); - count = 0; - totalcount = 0; + uint32 count = 0; + uint32 totalcount = 0; data << (uint32) 0; // converting string that we try to find to lower case @@ -716,7 +715,7 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data ) { if( ( levelmin == (0x00) || proto->RequiredLevel >= levelmin ) && ( levelmax == (0x00) || proto->RequiredLevel <= levelmax ) ) { - name = proto->Name1; + std::string name = proto->Name1; // local name int loc_idx = GetSessionDbLocaleIndex(); diff --git a/src/game/AuctionHouseBot.cpp b/src/game/AuctionHouseBot.cpp index f05d31abb41..4830dcefce4 100644 --- a/src/game/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot.cpp @@ -1,4 +1,3 @@ -#include "AuctionHouseBot.h" #include "Bag.h" #include "Config/ConfigEnv.h" #include "Database/DatabaseEnv.h" @@ -9,6 +8,7 @@ #include "World.h" #include "WorldSession.h" #include "time.h" +#include "AuctionHouseBot.h" #include <vector> #include <iostream> @@ -40,9 +40,9 @@ static bool Bind_When_Equipped = 0; static bool Bind_When_Use = 0; static bool Bind_Quest_Item = 0; -static AHBConfig AllianceConfig = AHBConfig(2); -static AHBConfig HordeConfig = AHBConfig(6); -static AHBConfig NeutralConfig = AHBConfig(7); +static AHBConfig AllianceConfig = AHBConfig(AUCTION_ALLIANCE); +static AHBConfig HordeConfig = AHBConfig(AUCTION_HORDE); +static AHBConfig NeutralConfig = AHBConfig(AUCTION_NEUTRAL); time_t _lastrun_a; time_t _lastrun_h; time_t _lastrun_n; @@ -905,18 +905,18 @@ void AuctionHouseBotInit() sLog.outString("AuctionHouseBot now includes AHBuyer by Kerbe and Paradox"); } -void AuctionHouseBotCommands(uint32 command, uint32 ahMapID, uint32 col, char* args) +void AuctionHouseBotCommands(uint32 command, AuctionLocation ahMapID, uint32 col, char* args) { AHBConfig *config; switch (ahMapID) { - case 2: + case AUCTION_ALLIANCE: config = &AllianceConfig; break; - case 6: + case AUCTION_HORDE: config = &HordeConfig; break; - case 7: + case AUCTION_NEUTRAL: config = &NeutralConfig; break; } diff --git a/src/game/AuctionHouseBot.h b/src/game/AuctionHouseBot.h index 71b14d17a4a..afb3e15e968 100644 --- a/src/game/AuctionHouseBot.h +++ b/src/game/AuctionHouseBot.h @@ -3,6 +3,7 @@ #include "Common.h" #include "Log.h" #include "Config/ConfigEnv.h" +#include "AuctionHouseObject.h" #define AHB_GREY 0 #define AHB_WHITE 1 #define AHB_GREEN 2 @@ -27,7 +28,7 @@ class AHBConfig { private: - uint32 AHID; + AuctionLocation AHID; uint32 minItems; uint32 maxItems; uint32 minTime; @@ -78,14 +79,14 @@ class AHBConfig uint32 bip; uint32 pip; public: - AHBConfig(uint32 ahid) + AHBConfig(AuctionLocation ahid) { AHID = ahid; } AHBConfig() { } - uint32 GetAHID() + AuctionLocation GetAHID() { return AHID; } @@ -683,5 +684,5 @@ class AHBConfig void AuctionHouseBot(); void AuctionHouseBotInit(); void AuctionHouseBotLoadValues(AHBConfig*); -void AuctionHouseBotCommands(uint32, uint32, uint32, char*); +void AuctionHouseBotCommands(uint32, AuctionLocation, uint32, char*); #endif diff --git a/src/game/AuctionHouseObject.h b/src/game/AuctionHouseObject.h index 7915918ec9e..f82867c5742 100644 --- a/src/game/AuctionHouseObject.h +++ b/src/game/AuctionHouseObject.h @@ -41,6 +41,15 @@ enum AuctionAction AUCTION_PLACE_BID = 2 }; +enum AuctionLocation +{ + AUCTION_ALLIANCE = 2, + AUCTION_HORDE = 6, + AUCTION_NEUTRAL = 7 +}; + +inline bool IsValidAuctionLocation(uint32 loc) { return loc == AUCTION_ALLIANCE || loc == AUCTION_HORDE || loc == AUCTION_NEUTRAL; } + struct AuctionEntry { uint32 Id; @@ -54,7 +63,7 @@ struct AuctionEntry time_t time; uint32 bidder; uint32 deposit; //deposit can be calculated only when creating auction - uint32 location; + AuctionLocation location; }; //this class is used as auctionhouse instance diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 0fa7f09aa20..28e9551e36b 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -21,6 +21,7 @@ #include "Object.h" #include "Player.h" #include "BattleGround.h" +#include "BattleGroundMgr.h" #include "Creature.h" #include "MapManager.h" #include "Language.h" @@ -28,11 +29,14 @@ #include "SpellAuras.h" #include "ArenaTeam.h" #include "World.h" +#include "Group.h" +#include "ObjectMgr.h" +#include "WorldPacket.h" #include "Util.h" BattleGround::BattleGround() { - m_TypeID = 0; + m_TypeID = BattleGroundTypeId(0); m_InstanceID = 0; m_Status = 0; m_EndTime = 0; @@ -789,7 +793,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac { if(!team) team = plr->GetTeam(); - uint32 bgTypeId = GetTypeID(); + BattleGroundTypeId bgTypeId = GetTypeID(); uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType()); // if arena, remove the specific arena auras if(isArena()) @@ -1568,3 +1572,11 @@ int32 BattleGround::GetObjectType(uint64 guid) void BattleGround::HandleKillUnit(Creature *creature, Player *killer) { } + +void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid ) +{ + Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; + if(old_raid) old_raid->SetBattlegroundGroup(NULL); + if(bg_raid) bg_raid->SetBattlegroundGroup(this); + old_raid = bg_raid; +} diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 99497f17563..fbba9175ef2 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -22,13 +22,16 @@ #define __BATTLEGROUND_H #include "Common.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "Opcodes.h" -#include "ObjectMgr.h" -#include "BattleGroundMgr.h" #include "SharedDefines.h" +class Creature; +class GameObject; +class Group; +class Player; +class WorldPacket; + +struct WorldSafeLocsEntry; + enum BattleGroundSounds { SOUND_HORDE_WINS = 8454, @@ -132,22 +135,6 @@ struct BattleGroundObjectInfo uint32 spellid; }; -enum BattleGroundTypeId -{ - BATTLEGROUND_AV = 1, - BATTLEGROUND_WS = 2, - BATTLEGROUND_AB = 3, - BATTLEGROUND_NA = 4, - BATTLEGROUND_BE = 5, - BATTLEGROUND_AA = 6, - BATTLEGROUND_EY = 7, - BATTLEGROUND_RL = 8, - BATTLEGROUND_SA = 9, - BATTLEGROUND_DS = 10, - BATTLEGROUND_RV = 11 -}; -#define MAX_BATTLEGROUND_TYPE_ID 12 - // handle the queue types and bg types separately to enable joining queue for different sized arenas at the same time enum BattleGroundQueueTypeId { @@ -278,7 +265,7 @@ class BattleGround /* Battleground */ // Get methods: char const* GetName() const { return m_Name; } - uint32 GetTypeID() const { return m_TypeID; } + BattleGroundTypeId GetTypeID() const { return m_TypeID; } uint32 GetQueueType() const { return m_Queue_type; } uint32 GetInstanceID() const { return m_InstanceID; } uint32 GetStatus() const { return m_Status; } @@ -301,7 +288,7 @@ class BattleGround // Set methods: void SetName(char const* Name) { m_Name = Name; } - void SetTypeID(uint32 TypeID) { m_TypeID = TypeID; } + void SetTypeID(BattleGroundTypeId TypeID) { m_TypeID = TypeID; } void SetQueueType(uint32 ID) { m_Queue_type = ID; } void SetInstanceID(uint32 InstanceID) { m_InstanceID = InstanceID; } void SetStatus(uint32 Status) { m_Status = Status; } @@ -398,13 +385,7 @@ class BattleGround /* Raid Group */ Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } - void SetBgRaid(uint32 TeamID, Group *bg_raid) - { - Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; - if(old_raid) old_raid->SetBattlegroundGroup(NULL); - if(bg_raid) bg_raid->SetBattlegroundGroup(this); - old_raid = bg_raid; - } + void SetBgRaid(uint32 TeamID, Group *bg_raid); virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); @@ -499,7 +480,7 @@ class BattleGround BGHonorMode m_HonorMode; private: /* Battleground */ - uint32 m_TypeID; //Battleground type, defined in enum BattleGroundTypeId + BattleGroundTypeId m_TypeID; uint32 m_InstanceID; //BattleGround Instance's GUID! uint32 m_Status; uint32 m_StartTime; diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index ed85674b5f9..e4b0c82882d 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -29,6 +29,7 @@ #include "Language.h" #include "World.h" #include "Util.h" +#include "WorldPacket.h" // these variables aren't used outside of this file, so declare them only here uint32 BG_AB_HonorScoreTicks[BG_HONOR_MODE_NUM] = { diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index b9589bdbb84..d8e0fce535e 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -30,6 +30,7 @@ #include "Language.h" #include "SpellAuras.h" #include "Formulas.h" +#include "WorldPacket.h" BattleGroundAV::BattleGroundAV() { diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 35ba08300be..f63c6822c5b 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -25,6 +25,7 @@ #include "Creature.h" #include "ObjectMgr.h" #include "MapManager.h" +#include "WorldPacket.h" #include "Language.h" BattleGroundBE::BattleGroundBE() diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 2e736a85f53..baaa345d96d 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -27,7 +27,8 @@ #include "ObjectMgr.h" #include "MapManager.h" #include "Language.h" -#include "World.h" +#include "World.h" //music +#include "WorldPacket.h" #include "Util.h" // these variables aren't used outside of this file, so declare them only here diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index e7948c9b2e8..6a5c7378c5a 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -53,7 +53,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data ) // Stop the npc if moving unit->StopMoving(); - uint32 bgTypeId = objmgr.GetBattleMasterBG(unit->GetEntry()); + BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry()); if(!_player->GetBGAccessByLevel(bgTypeId)) { @@ -65,7 +65,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data ) SendBattlegGroundList(guid, bgTypeId); } -void WorldSession::SendBattlegGroundList( uint64 guid, uint32 bgTypeId ) +void WorldSession::SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId ) { WorldPacket data; sBattleGroundMgr.BuildBattleGroundListPacket(&data, guid, _player, bgTypeId); @@ -77,22 +77,24 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data ) CHECK_PACKET_SIZE(recv_data, 8+4+4+1); uint64 guid; - uint32 bgTypeId; + uint32 bgTypeId_; uint32 instanceId; uint8 joinAsGroup; Group * grp; recv_data >> guid; // battlemaster guid - recv_data >> bgTypeId; // battleground type id (DBC id) + recv_data >> bgTypeId_; // battleground type id (DBC id) recv_data >> instanceId; // instance id, 0 if First Available selected recv_data >> joinAsGroup; // join as group - if(bgTypeId >= MAX_BATTLEGROUND_TYPES) + if(!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - sLog.outError("Battleground: invalid bgtype received. possible cheater? player guid %u",_player->GetGUIDLow()); + sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow()); return; } + BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); + sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_JOIN Message from: " I64FMT, guid); // can do this, since it's battleground, not arena @@ -274,19 +276,15 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data ) uint32 bgTypeId; recv_data >> bgTypeId; // id from DBC - if(bgTypeId >= MAX_BATTLEGROUND_TYPES) + BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); + if(!bl) { sLog.outError("Battleground: invalid bgtype received."); return; } - BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId); - - if(!bl) - return; - WorldPacket data; - sBattleGroundMgr.BuildBattleGroundListPacket(&data, _player->GetGUID(), _player, bgTypeId); + sBattleGroundMgr.BuildBattleGroundListPacket(&data, _player->GetGUID(), _player, BattleGroundTypeId(bgTypeId)); SendPacket( &data ); } @@ -299,15 +297,15 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) uint8 type; // arenatype if arena uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1 uint32 instanceId; - uint32 bgTypeId; // type id from dbc + uint32 bgTypeId_; // type id from dbc uint16 unk; // 0x1F90 constant? uint8 action; // enter battle 0x1, leave queue 0x0 - recv_data >> type >> unk2 >> bgTypeId >> unk >> action; + recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action; - if(bgTypeId >= MAX_BATTLEGROUND_TYPES) + if(!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - sLog.outError("Battleground: invalid bgtype received."); + sLog.outError("Battleground: invalid bgtype (%u) received.",bgTypeId_); // update battleground slots for the player to fix his UI and sent data. // this is a HACK, I don't know why the client starts sending invalid packets in the first place. // it usually happens with extremely high latency (if debugging / stepping in the code for example) @@ -331,7 +329,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) BattleGround * bg = NULL; // get possibly needed data from groupinfo - bgTypeId = itrPlayerStatus->second.GroupInfo->BgTypeId; + BattleGroundTypeId bgTypeId = itrPlayerStatus->second.GroupInfo->BgTypeId; uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType; uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated; uint8 status = 0; @@ -367,6 +365,8 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) return; } + BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); + uint32 bgQueueTypeId = 0; // get the bg what we were invited to BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus; @@ -395,7 +395,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) if(!bg) { - sLog.outError("Battleground: bg not found."); + sLog.outError("Battleground: bg not found for type id %u.",bgTypeId); return; } @@ -572,7 +572,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) uint32 queue_id = _player->GetBattleGroundQueueId(i); if(!queue_id) continue; - uint32 bgTypeId = BattleGroundMgr::BGTemplateId(queue_id); + BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(queue_id); uint8 arenatype = BattleGroundMgr::BGArenaType(queue_id); uint8 isRated = 0; BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); @@ -700,7 +700,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data ) return; } - uint8 bgTypeId = bg->GetTypeID(); + BattleGroundTypeId bgTypeId = bg->GetTypeID(); uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype); // check queueing conditions diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 1f8a99fa725..90b7c2a02a8 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -19,6 +19,7 @@ */ #include "Common.h" +#include "SharedDefines.h" #include "Player.h" #include "BattleGroundMgr.h" #include "BattleGroundAV.h" @@ -32,8 +33,6 @@ #include "BattleGroundSA.h" #include "BattleGroundDS.h" #include "BattleGroundRV.h" -#include "SharedDefines.h" -#include "Policies/SingletonImp.h" #include "MapManager.h" #include "Map.h" #include "MapInstanced.h" @@ -41,6 +40,11 @@ #include "ProgressBar.h" #include "Chat.h" #include "ArenaTeam.h" +#include "World.h" +#include "WorldPacket.h" +#include "ProgressBar.h" + +#include "Policies/SingletonImp.h" INSTANTIATE_SINGLETON_1( BattleGroundMgr ); @@ -73,7 +77,7 @@ BattleGroundQueue::~BattleGroundQueue() } // initialize eligible groups from the given source matching the given specifications -void BattleGroundQueue::EligibleGroups::Init(BattleGroundQueue::QueuedGroupsList *source, uint32 BgTypeId, uint32 side, uint32 MaxPlayers, uint8 ArenaType, bool IsRated, uint32 MinRating, uint32 MaxRating, uint32 DisregardTime, uint32 excludeTeam) +void BattleGroundQueue::EligibleGroups::Init(BattleGroundQueue::QueuedGroupsList *source, BattleGroundTypeId BgTypeId, uint32 side, uint32 MaxPlayers, uint8 ArenaType, bool IsRated, uint32 MinRating, uint32 MaxRating, uint32 DisregardTime, uint32 excludeTeam) { // clear from prev initialization clear(); @@ -138,7 +142,7 @@ void BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo * ginfo) } // add group to bg queue with the given leader and bg specifications -GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, uint32 BgTypeId, uint8 ArenaType, bool isRated, uint32 arenaRating, uint32 arenateamid) +GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId BgTypeId, uint8 ArenaType, bool isRated, uint32 arenaRating, uint32 arenateamid) { uint32 queue_id = leader->GetBattleGroundQueueIdFromLevel(); @@ -340,7 +344,7 @@ void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playe uint8 qHorde = 0; uint8 qAlliance = 0; - uint32 bgTypeId = ginfo->BgTypeId; + BattleGroundTypeId bgTypeId = ginfo->BgTypeId; QueuedPlayersMap::iterator itr; for(itr = m_QueuedPlayers[queue_id].begin(); itr!= m_QueuedPlayers[queue_id].end(); ++itr) { @@ -448,26 +452,25 @@ bool BattleGroundQueue::SelectionPool::Build(uint32 MinPlayers, uint32 MaxPlayer } // this function is responsible for the selection of queued groups when trying to create new battlegrounds -bool BattleGroundQueue::BuildSelectionPool(uint32 bgTypeId, uint32 queue_id, uint32 MinPlayers, uint32 MaxPlayers, SelectionPoolBuildMode mode, uint8 ArenaType, bool isRated, uint32 MinRating, uint32 MaxRating, uint32 DisregardTime, uint32 excludeTeam) +bool BattleGroundQueue::BuildSelectionPool(BattleGroundTypeId bgTypeId, uint32 queue_id, uint32 MinPlayers, uint32 MaxPlayers, SelectionPoolBuildMode mode, uint8 ArenaType, bool isRated, uint32 MinRating, uint32 MaxRating, uint32 DisregardTime, uint32 excludeTeam) { uint32 side; switch(mode) { - case NORMAL_ALLIANCE: - case ONESIDE_ALLIANCE_TEAM1: - case ONESIDE_ALLIANCE_TEAM2: - side = ALLIANCE; - break; - case NORMAL_HORDE: - case ONESIDE_HORDE_TEAM1: - case ONESIDE_HORDE_TEAM2: - side = HORDE; - break; - default: - //unknown mode, return false - sLog.outDebug("Battleground: unknown selection pool build mode, returning..."); - return false; - break; + case NORMAL_ALLIANCE: + case ONESIDE_ALLIANCE_TEAM1: + case ONESIDE_ALLIANCE_TEAM2: + side = ALLIANCE; + break; + case NORMAL_HORDE: + case ONESIDE_HORDE_TEAM1: + case ONESIDE_HORDE_TEAM2: + side = HORDE; + break; + default: + //unknown mode, return false + sLog.outDebug("Battleground: unknown selection pool build mode, returning..."); + return false; } // initiate the groups eligible to create the bg @@ -541,7 +544,7 @@ void BattleGroundQueue::BGEndedRemoveInvites(BattleGround *bg) RemovePlayer(itr2->first, true); // this is probably unneeded, since this player was already invited -> does not fit when initing eligible groups // but updating the queue can't hurt - Update(bgQueueTypeId, bg->GetQueueType()); + Update(bg->GetTypeID(), bg->GetQueueType()); // send info to client WorldPacket data; sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, team, queueSlot, STATUS_NONE, 0, 0); @@ -557,7 +560,7 @@ this method is called when group is inserted, or player / group is removed from it must be called after fully adding the members of a group to ensure group joining should be called after removeplayer functions in some cases */ -void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype, bool isRated, uint32 arenaRating) +void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uint8 arenatype, bool isRated, uint32 arenaRating) { if (queue_id >= MAX_BATTLEGROUND_QUEUES) { @@ -679,7 +682,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype if(bg_template->isArena()) { // Find a random arena, that can be created - uint8 arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL}; + BattleGroundTypeId arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL}; uint32 arena_num = urand(0,2); if( !(bg2 = sBattleGroundMgr.CreateNewBattleGround(arenas[arena_num%3])) && !(bg2 = sBattleGroundMgr.CreateNewBattleGround(arenas[(arena_num+1)%3])) && @@ -843,7 +846,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype } // create random arena - uint8 arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL}; + BattleGroundTypeId arenas[] = {BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL}; uint32 arena_num = urand(0,2); BattleGround* bg2 = NULL; if( !(bg2 = sBattleGroundMgr.CreateNewBattleGround(arenas[arena_num%3])) && @@ -945,22 +948,18 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) if (!bg) return true; - uint32 queueSlot = plr->GetBattleGroundQueueIndex(bg->GetTypeID()); + uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType()); + uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue { - uint32 bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType()); - uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); - if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue + // check if player is invited to this bg ... this check must be here, because when player leaves queue and joins another, it would cause a problems + BattleGroundQueue::QueuedPlayersMap const& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[plr->GetBattleGroundQueueIdFromLevel()]; + BattleGroundQueue::QueuedPlayersMap::const_iterator qItr = qpMap.find(m_PlayerGuid); + if (qItr != qpMap.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID) { - // check if player is invited to this bg ... this check must be here, because when player leaves queue and joins another, it would cause a problems - BattleGroundQueue::QueuedPlayersMap const& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers[plr->GetBattleGroundQueueIdFromLevel()]; - BattleGroundQueue::QueuedPlayersMap::const_iterator qItr = qpMap.find(m_PlayerGuid); - if (qItr != qpMap.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID) - { - WorldPacket data; - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, qItr->second.GroupInfo->Team, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME/2, 0); - plr->GetSession()->SendPacket(&data); - } + WorldPacket data; + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, qItr->second.GroupInfo->Team, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME/2, 0); + plr->GetSession()->SendPacket(&data); } } return true; //event will be deleted @@ -1005,7 +1004,7 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) } plr->RemoveBattleGroundQueueId(bgQueueTypeId); sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(m_PlayerGuid, true); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgQueueTypeId, bg->GetQueueType()); + sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bg->GetTypeID(),bg->GetQueueType()); WorldPacket data; sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, m_PlayersTeam, queueSlot, STATUS_NONE, 0, 0); plr->GetSession()->SendPacket(&data); @@ -1297,7 +1296,7 @@ void BattleGroundMgr::BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg) } } -void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, uint32 bgTypeId) +void BattleGroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId) { /*bgTypeId is: 0 - Your group has joined a battleground queue, but you are not eligible @@ -1374,25 +1373,24 @@ void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID, uint32 te plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME)); } -BattleGround * BattleGroundMgr::GetBattleGroundTemplate(uint32 bgTypeId) +BattleGround * BattleGroundMgr::GetBattleGroundTemplate(BattleGroundTypeId bgTypeId) { return BGFreeSlotQueue[bgTypeId].empty() ? NULL : BGFreeSlotQueue[bgTypeId].back(); } // create a new battleground that will really be used to play -BattleGround * BattleGroundMgr::CreateNewBattleGround(uint32 bgTypeId) +BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeId) { - BattleGround *bg = NULL; - // get the template BG BattleGround *bg_template = GetBattleGroundTemplate(bgTypeId); - if(!bg_template) { sLog.outError("BattleGround: CreateNewBattleGround - bg template not found for %u", bgTypeId); - return 0; + return NULL; } + BattleGround *bg = NULL; + // create a copy of the BG template switch(bgTypeId) { @@ -1460,7 +1458,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(uint32 bgTypeId) } // used to create the BG templates -uint32 BattleGroundMgr::CreateBattleGround(uint32 bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) +uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) { // Create the BG BattleGround *bg = NULL; @@ -1543,16 +1541,18 @@ void BattleGroundMgr::CreateInitialBattleGrounds() Field *fields = result->Fetch(); bar.step(); - uint32 bgTypeID = fields[0].GetUInt32(); + uint32 bgTypeID_ = fields[0].GetUInt32(); - // can be overwrited by values from DB - bl = sBattlemasterListStore.LookupEntry(bgTypeID); + // can be overwrite by values from DB + bl = sBattlemasterListStore.LookupEntry(bgTypeID_); if(!bl) { - sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.",bgTypeID); + sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.",bgTypeID_); continue; } + BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_); + MaxPlayersPerTeam = bl->maxplayersperteam; MinPlayersPerTeam = bl->maxplayersperteam/2; MinLvl = bl->minlvl; @@ -1700,7 +1700,7 @@ void BattleGroundMgr::DistributeArenaPoints() sWorld.SendGlobalText("Done flushing Arena points.", NULL); } -void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, uint32 bgTypeId) +void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player* plr, BattleGroundTypeId bgTypeId) { uint32 PlayerLevel = 10; @@ -1766,7 +1766,7 @@ void BattleGroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround * pl->GetSession()->SendPacket(&data); } -bool BattleGroundMgr::IsArenaType(uint32 bgTypeId) +bool BattleGroundMgr::IsArenaType(BattleGroundTypeId bgTypeId) { return ( bgTypeId == BATTLEGROUND_AA || bgTypeId == BATTLEGROUND_BE || @@ -1774,7 +1774,7 @@ bool BattleGroundMgr::IsArenaType(uint32 bgTypeId) bgTypeId == BATTLEGROUND_RL ); } -uint32 BattleGroundMgr::BGQueueTypeId(uint32 bgTypeId, uint8 arenaType) +uint32 BattleGroundMgr::BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType) { switch(bgTypeId) { @@ -1810,7 +1810,7 @@ uint32 BattleGroundMgr::BGQueueTypeId(uint32 bgTypeId, uint8 arenaType) } } -uint32 BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId) +BattleGroundTypeId BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId) { switch(bgQueueTypeId) { @@ -1829,7 +1829,7 @@ uint32 BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId) case BATTLEGROUND_QUEUE_5v5: return BATTLEGROUND_AA; default: - return 0; + return BattleGroundTypeId(0); // used for unknown template (it existed and do nothing) } } @@ -1859,11 +1859,71 @@ void BattleGroundMgr::ToggleArenaTesting() void BattleGroundMgr::SetHolidayWeekends(uint32 mask) { - for(uint32 bgtype = 1; bgtype <= 8; ++bgtype) + for(uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype) { - if(BattleGround * bg = GetBattleGroundTemplate(bgtype)) + if(BattleGround * bg = GetBattleGroundTemplate(BattleGroundTypeId(bgtype))) { bg->SetHoliday(mask & (1 << bgtype)); } } } + +uint32 BattleGroundMgr::GetMaxRatingDifference() const +{ + return sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE); +} + +uint32 BattleGroundMgr::GetRatingDiscardTimer() const +{ + return sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); +} + +uint32 BattleGroundMgr::GetPrematureFinishTime() const +{ + return sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER); +} + +void BattleGroundMgr::LoadBattleMastersEntry() +{ + mBattleMastersMap.clear(); // need for reload case + + QueryResult *result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" ); + + uint32 count = 0; + + if( !result ) + { + barGoLink bar( 1 ); + bar.step(); + + sLog.outString(); + sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" ); + return; + } + + barGoLink bar( result->GetRowCount() ); + + do + { + ++count; + bar.step(); + + Field *fields = result->Fetch(); + + uint32 entry = fields[0].GetUInt32(); + uint32 bgTypeId = fields[1].GetUInt32(); + if (!sBattlemasterListStore.LookupEntry(bgTypeId)) + { + sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId); + continue; + } + + mBattleMastersMap[entry] = BattleGroundTypeId(bgTypeId); + + } while( result->NextRow() ); + + delete result; + + sLog.outString(); + sLog.outString( ">> Loaded %u battlemaster entries", count ); +} diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index fb435fb297c..d9b517fc23b 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -21,10 +21,8 @@ #ifndef __BATTLEGROUNDMGR_H #define __BATTLEGROUNDMGR_H +#include "Common.h" #include "BattleGround.h" -#include "World.h" - -class BattleGround; //TODO it is not possible to have this structure, because we should have BattlegroundSet for each queue //so i propose to change this type to array 1..MAX_BATTLEGROUND_TYPES of sets or maps.. @@ -32,13 +30,13 @@ typedef std::map<uint32, BattleGround*> BattleGroundSet; //typedef std::map<uint32, BattleGroundQueue*> BattleGroundQueueSet; typedef std::deque<BattleGround*> BGFreeSlotQueueType; -#define MAX_BATTLEGROUND_QUEUES 8 // for level ranges 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79, 80+ +typedef UNORDERED_MAP<uint32, BattleGroundTypeId> BattleMastersMap; -#define MAX_BATTLEGROUND_TYPES 12 // each BG type will be in array +#define MAX_BATTLEGROUND_QUEUES 8 // for level ranges 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79, 80+ #define MAX_BATTLEGROUND_QUEUE_TYPES 9 -#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day +#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day struct GroupQueueInfo; // type predefinition struct PlayerQueueInfo // stores information for players in queue @@ -53,7 +51,7 @@ struct GroupQueueInfo // stores informatio { std::map<uint64, PlayerQueueInfo*> Players; // player queue info map uint32 Team; // Player team (ALLIANCE/HORDE) - uint32 BgTypeId; // battleground type id + BattleGroundTypeId BgTypeId; // battleground type id bool IsRated; // rated uint8 ArenaType; // 2v2, 3v3, 5v5 or 0 when BG uint32 ArenaTeamId; // team id if rated match @@ -70,9 +68,9 @@ class BattleGroundQueue BattleGroundQueue(); ~BattleGroundQueue(); - void Update(uint32 bgTypeId, uint32 queue_id, uint8 arenatype = 0, bool isRated = false, uint32 minRating = 0); + void Update(BattleGroundTypeId bgTypeId, uint32 queue_id, uint8 arenatype = 0, bool isRated = false, uint32 minRating = 0); - GroupQueueInfo * AddGroup(Player * leader, uint32 BgTypeId, uint8 ArenaType, bool isRated, uint32 ArenaRating, uint32 ArenaTeamId = 0); + GroupQueueInfo * AddGroup(Player * leader, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, uint32 ArenaRating, uint32 ArenaTeamId = 0); void AddPlayer(Player *plr, GroupQueueInfo *ginfo); void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); void DecreaseGroupLength(uint32 queueId, uint32 AsGroup); @@ -89,7 +87,7 @@ class BattleGroundQueue class EligibleGroups : public std::list<GroupQueueInfo *> { public: - void Init(QueuedGroupsList * source, uint32 BgTypeId, uint32 side, uint32 MaxPlayers, uint8 ArenaType = 0, bool IsRated = false, uint32 MinRating = 0, uint32 MaxRating = 0, uint32 DisregardTime = 0, uint32 excludeTeam = 0); + void Init(QueuedGroupsList * source, BattleGroundTypeId BgTypeId, uint32 side, uint32 MaxPlayers, uint8 ArenaType = 0, bool IsRated = false, uint32 MinRating = 0, uint32 MaxRating = 0, uint32 DisregardTime = 0, uint32 excludeTeam = 0); }; EligibleGroups m_EligibleGroups; @@ -124,7 +122,7 @@ class BattleGroundQueue SelectionPool m_SelectionPools[NUM_SELECTION_POOL_TYPES]; - bool BuildSelectionPool(uint32 bgTypeId, uint32 queue_id, uint32 MinPlayers, uint32 MaxPlayers, SelectionPoolBuildMode mode, uint8 ArenaType = 0, bool isRated = false, uint32 MinRating = 0, uint32 MaxRating = 0, uint32 DisregardTime = 0, uint32 excludeTeam = 0); + bool BuildSelectionPool(BattleGroundTypeId bgTypeId, uint32 queue_id, uint32 MinPlayers, uint32 MaxPlayers, SelectionPoolBuildMode mode, uint8 ArenaType = 0, bool isRated = false, uint32 MinRating = 0, uint32 MaxRating = 0, uint32 DisregardTime = 0, uint32 excludeTeam = 0); private: @@ -179,8 +177,8 @@ class BattleGroundMgr /* Packet Building */ void BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Player *plr); void BuildPlayerLeftBattleGroundPacket(WorldPacket *data, Player *plr); - void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, uint32 bgTypeId); - void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, uint32 bgTypeId); + void BuildBattleGroundListPacket(WorldPacket *data, const uint64& guid, Player *plr, BattleGroundTypeId bgTypeId); + void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, BattleGroundTypeId bgTypeId); void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value); void BuildPvpLogDataPacket(WorldPacket *data, BattleGround *bg); void BuildBattleGroundStatusPacket(WorldPacket *data, BattleGround *bg, uint32 team, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint32 arenatype = 0, uint8 israted = 0); @@ -195,48 +193,57 @@ class BattleGroundMgr BattleGroundSet::iterator GetBattleGroundsBegin() { return m_BattleGrounds.begin(); }; BattleGroundSet::iterator GetBattleGroundsEnd() { return m_BattleGrounds.end(); }; - BattleGround* GetBattleGround(uint32 ID) + BattleGround* GetBattleGround(uint32 InstanceID) { - BattleGroundSet::iterator i = m_BattleGrounds.find(ID); + BattleGroundSet::iterator i = m_BattleGrounds.find(InstanceID); return ( (i != m_BattleGrounds.end()) ? i->second : NULL ); }; - BattleGround * GetBattleGroundTemplate(uint32 bgTypeId); - BattleGround * CreateNewBattleGround(uint32 bgTypeId); + BattleGround * GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); + BattleGround * CreateNewBattleGround(BattleGroundTypeId bgTypeId); - uint32 CreateBattleGround(uint32 bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); + uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); - void AddBattleGround(uint32 ID, BattleGround* BG) { m_BattleGrounds[ID] = BG; }; + void AddBattleGround(uint32 InstanceID, BattleGround* BG) { m_BattleGrounds[InstanceID] = BG; }; void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); } void CreateInitialBattleGrounds(); - void SendToBattleGround(Player *pl, uint32 bgTypeId); + void SendToBattleGround(Player *pl, uint32 InstanceID); /* Battleground queues */ //these queues are instantiated when creating BattlegroundMrg BattleGroundQueue m_BattleGroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES]; // public, because we need to access them in BG handler code - BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPES]; + BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID]; - uint32 GetMaxRatingDifference() const { return sWorld.getConfig(CONFIG_ARENA_MAX_RATING_DIFFERENCE); } - uint32 GetRatingDiscardTimer() const { return sWorld.getConfig(CONFIG_ARENA_RATING_DISCARD_TIMER); } - uint32 GetPrematureFinishTime() const { return sWorld.getConfig(CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER); } + uint32 GetMaxRatingDifference() const; + uint32 GetRatingDiscardTimer() const; + uint32 GetPrematureFinishTime() const; void InitAutomaticArenaPointDistribution(); void DistributeArenaPoints(); void ToggleArenaTesting(); void SetHolidayWeekends(uint32 mask); + void LoadBattleMastersEntry(); + BattleGroundTypeId GetBattleMasterBG(uint32 entry) const + { + BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry); + if(itr != mBattleMastersMap.end()) + return itr->second; + return BATTLEGROUND_WS; + } bool isArenaTesting() const { return m_ArenaTesting; } - static bool IsArenaType(uint32 bgTypeId); - static bool IsBattleGroundType(uint32 bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); } - static uint32 BGQueueTypeId(uint32 bgTypeId, uint8 arenaType); - static uint32 BGTemplateId(uint32 bgQueueTypeId); + static bool IsArenaType(BattleGroundTypeId bgTypeId); + static bool IsBattleGroundType(BattleGroundTypeId bgTypeId) { return !BattleGroundMgr::IsArenaType(bgTypeId); } + static uint32 BGQueueTypeId(BattleGroundTypeId bgTypeId, uint8 arenaType); + static BattleGroundTypeId BGTemplateId(uint32 bgQueueTypeId); static uint8 BGArenaType(uint32 bgQueueTypeId); private: + BattleMastersMap mBattleMastersMap; /* Battlegrounds */ BattleGroundSet m_BattleGrounds; diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index c3ca002cf88..ad6d622e71a 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -25,6 +25,7 @@ #include "Creature.h" #include "ObjectMgr.h" #include "MapManager.h" +#include "WorldPacket.h" #include "Language.h" BattleGroundNA::BattleGroundNA() diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index 0538f3d5e85..85117acd2f6 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -26,6 +26,7 @@ #include "ObjectMgr.h" #include "MapManager.h" #include "Language.h" +#include "WorldPacket.h" BattleGroundRL::BattleGroundRL() { diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index 20a69297609..d5585fd93e9 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -18,6 +18,7 @@ #include "BattleGround.h" #include "BattleGroundSA.h" +#include "Player.h" BattleGroundSA::BattleGroundSA() { diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 18fd8932ff3..3175f2873f9 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -26,6 +26,8 @@ #include "GameObject.h" #include "Chat.h" #include "MapManager.h" +#include "ObjectMgr.h" +#include "WorldPacket.h" #include "Language.h" #include "World.h" diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index ca8fd942e76..87dc3674601 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -39,7 +39,7 @@ #include "SpellAuras.h" #include "WaypointMovementGenerator.h" #include "InstanceData.h" -#include "BattleGround.h" +#include "BattleGroundMgr.h" #include "Util.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" @@ -760,7 +760,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const if(!isBattleMaster()) return false; - uint32 bgTypeId = objmgr.GetBattleMasterBG(GetEntry()); + BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry()); if(!msg) return pPlayer->GetBGAccessByLevel(bgTypeId); @@ -1027,7 +1027,7 @@ void Creature::OnGossipSelect(Player* player, uint32 option) break; case GOSSIP_OPTION_BATTLEFIELD: { - uint32 bgTypeId = objmgr.GetBattleMasterBG(GetEntry()); + BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry()); player->GetSession()->SendBattlegGroundList( GetGUID(), bgTypeId ); break; } diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 8da41311902..82778346837 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1333,7 +1333,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed ) SendUpdate(); } -uint32 Group::CanJoinBattleGroundQueue(uint32 bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot) +uint32 Group::CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot) { // check for min / max count uint32 memberscount = GetMembersCount(); diff --git a/src/game/Group.h b/src/game/Group.h index d42f6305ee9..87cf8b6b315 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -250,7 +250,7 @@ class TRINITY_DLL_SPEC Group void ConvertToRaid(); void SetBattlegroundGroup(BattleGround *bg) { m_bgGroup = bg; } - uint32 CanJoinBattleGroundQueue(uint32 bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); + uint32 CanJoinBattleGroundQueue(BattleGroundTypeId bgTypeId, uint32 bgQueueType, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); void ChangeMembersGroup(const uint64 &guid, const uint8 &group); void ChangeMembersGroup(Player *player, const uint8 &group); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 240e20ec2bf..21782fd5d41 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -56,12 +56,12 @@ bool ChatHandler::HandleAHBotOptionsCommand(const char* args) { - uint32 ahMapID = 0; + AuctionLocation ahMapID = AUCTION_NEUTRAL; char * opt = strtok((char*)args, " "); char * ahMapIdStr = strtok(NULL, " "); if (ahMapIdStr) { - ahMapID = (uint32) strtoul(ahMapIdStr, NULL, 0); + ahMapID = (AuctionLocation) strtoul(ahMapIdStr, NULL, 0); } if (!opt) { diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 07ebaee02e9..7cc126e965f 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -31,6 +31,7 @@ #include "BattleGround.h" #include "WaypointMovementGenerator.h" #include "InstanceSaveMgr.h" +#include "ObjectMgr.h" void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ ) { diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index e898112a75d..948c29294f4 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -327,14 +327,14 @@ void ObjectMgr::RemoveArenaTeam(ArenaTeam* arenaTeam) mArenaTeamMap.erase( arenaTeam->GetId() ); } -AuctionHouseObject * ObjectMgr::GetAuctionsMap( uint32 location ) +AuctionHouseObject * ObjectMgr::GetAuctionsMap( AuctionLocation location ) { switch ( location ) { - case 6: //horde + case AUCTION_HORDE: return & mHordeAuctions; break; - case 2: //alliance + case AUCTION_ALLIANCE: return & mAllianceAuctions; break; default: //neutral @@ -342,18 +342,18 @@ AuctionHouseObject * ObjectMgr::GetAuctionsMap( uint32 location ) } } -uint32 ObjectMgr::GetAuctionCut(uint32 location, uint32 highBid) +uint32 ObjectMgr::GetAuctionCut(AuctionLocation location, uint32 highBid) { - if (location == 7 && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + if (location == AUCTION_NEUTRAL && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) return (uint32) (0.15f * highBid * sWorld.getRate(RATE_AUCTION_CUT)); else return (uint32) (0.05f * highBid * sWorld.getRate(RATE_AUCTION_CUT)); } -uint32 ObjectMgr::GetAuctionDeposit(uint32 location, uint32 time, Item *pItem) +uint32 ObjectMgr::GetAuctionDeposit(AuctionLocation location, uint32 time, Item *pItem) { float percentance; // in 0..1 - if ( location == 7 && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) + if (location == AUCTION_NEUTRAL && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) percentance = 0.75f; else percentance = 0.15f; @@ -1660,18 +1660,31 @@ void ObjectMgr::LoadAuctions() aItem->bid = fields[8].GetUInt32(); aItem->startbid = fields[9].GetUInt32(); aItem->deposit = fields[10].GetUInt32(); - aItem->location = fields[11].GetUInt8(); - //check if sold item exists - if ( GetAItem( aItem->item_guidlow ) ) + + uint32 loc = fields[11].GetUInt8(); + if(!IsValidAuctionLocation(loc)) { - GetAuctionsMap( aItem->location )->AddAuction(aItem); + CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",aItem->Id); + sLog.outError("Auction %u has wrong auction location (%u)", aItem->Id, loc); + delete aItem; + continue; } - else + aItem->location = AuctionLocation(loc); + + // check if sold item exists for guid + // and item_template in fact (GetAItem will fail if problematic in result check in ObjectMgr::LoadAuctionItems) + if ( !GetAItem( aItem->item_guidlow ) ) { CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",aItem->Id); sLog.outError("Auction %u has not a existing item : %u", aItem->Id, aItem->item_guidlow); delete aItem; + continue; } + + if(aItem->location) + + GetAuctionsMap( aItem->location )->AddAuction(aItem); + } while (result->NextRow()); delete result; @@ -6721,51 +6734,6 @@ int ObjectMgr::GetOrNewIndexForLocale( LocaleConstant loc ) return m_LocalForIndex.size()-1; } -void ObjectMgr::LoadBattleMastersEntry() -{ - mBattleMastersMap.clear(); // need for reload case - - QueryResult *result = WorldDatabase.Query( "SELECT entry,bg_template FROM battlemaster_entry" ); - - uint32 count = 0; - - if( !result ) - { - barGoLink bar( 1 ); - bar.step(); - - sLog.outString(); - sLog.outString( ">> Loaded 0 battlemaster entries - table is empty!" ); - return; - } - - barGoLink bar( result->GetRowCount() ); - - do - { - ++count; - bar.step(); - - Field *fields = result->Fetch(); - - uint32 entry = fields[0].GetUInt32(); - uint32 bgTypeId = fields[1].GetUInt32(); - if (bgTypeId >= MAX_BATTLEGROUND_TYPE_ID) - { - sLog.outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.",entry,bgTypeId); - continue; - } - - mBattleMastersMap[entry] = bgTypeId; - - } while( result->NextRow() ); - - delete result; - - sLog.outString(); - sLog.outString( ">> Loaded %u battlemaster entries", count ); -} - void ObjectMgr::LoadGameObjectForQuests() { mGameObjectForQuestSet.clear(); // need for reload case diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 249a0394668..c39e0414a69 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -399,15 +399,15 @@ class ObjectMgr mAitems.erase(i); return true; } - AuctionHouseObject * GetAuctionsMap( uint32 location ); + AuctionHouseObject * GetAuctionsMap( AuctionLocation location ); //auction messages void SendAuctionWonMail( AuctionEntry * auction ); void SendAuctionSalePendingMail( AuctionEntry * auction ); void SendAuctionSuccessfulMail( AuctionEntry * auction ); void SendAuctionExpiredMail( AuctionEntry * auction ); - static uint32 GetAuctionCut( uint32 location, uint32 highBid ); - static uint32 GetAuctionDeposit(uint32 location, uint32 time, Item *pItem); + static uint32 GetAuctionCut( AuctionLocation location, uint32 highBid ); + static uint32 GetAuctionDeposit(AuctionLocation location, uint32 time, Item *pItem); static uint32 GetAuctionOutBid(uint32 currentBid); PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint32 level) const; @@ -465,14 +465,6 @@ class ObjectMgr return false; } - uint32 GetBattleMasterBG(uint32 entry) const - { - BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry); - if(itr != mBattleMastersMap.end()) - return itr->second; - return 2; //BATTLEGROUND_WS - i will not add include only for constant usage! - } - void AddGossipText(GossipText *pGText); GossipText *GetGossipText(uint32 Text_ID); @@ -569,7 +561,6 @@ class ObjectMgr void LoadQuestAreaTriggers(); void LoadAreaTriggerScripts(); void LoadTavernAreaTriggers(); - void LoadBattleMastersEntry(); void LoadGameObjectForQuests(); void LoadItemTexts(); @@ -836,7 +827,6 @@ class ObjectMgr typedef UNORDERED_MAP<uint32, GossipText*> GossipTextMap; typedef UNORDERED_MAP<uint32, uint32> QuestAreaTriggerMap; - typedef UNORDERED_MAP<uint32, uint32> BattleMastersMap; typedef UNORDERED_MAP<uint32, std::string> ItemTextMap; typedef std::set<uint32> TavernAreaTriggerSet; typedef std::set<uint32> GameObjectForQuestSet; @@ -855,7 +845,6 @@ class ObjectMgr AuctionHouseObject mNeutralAuctions; QuestAreaTriggerMap mQuestAreaTriggerMap; - BattleMastersMap mBattleMastersMap; TavernAreaTriggerSet mTavernAreaTriggerSet; GameObjectForQuestSet mGameObjectForQuestSet; GossipTextMap mGossipText; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 9d52c8dd0fc..e20a4709848 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -18958,7 +18958,7 @@ bool Player::InArena() const return true; } -bool Player::GetBGAccessByLevel(uint32 bgTypeId) const +bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const { // get a template bg instead of running one BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); diff --git a/src/game/Player.h b/src/game/Player.h index b3867d84878..7ff25ac6411 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1962,7 +1962,7 @@ class TRINITY_DLL_SPEC Player : public Unit void ReportedAfkBy(Player* reporter); void ClearAfkReports() { m_bgAfkReporter.clear(); } - bool GetBGAccessByLevel(uint32 bgTypeId) const; + bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const; bool isAllowUseBattleGroundObject(); bool isTotalImmunity(); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 7d6adb159d9..2eb8d0016d6 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2292,4 +2292,22 @@ enum BanReturn BAN_SYNTAX_ERROR, BAN_NOTFOUND }; + +// indexes of BattlemasterList.dbc +enum BattleGroundTypeId +{ + BATTLEGROUND_AV = 1, + BATTLEGROUND_WS = 2, + BATTLEGROUND_AB = 3, + BATTLEGROUND_NA = 4, + BATTLEGROUND_BE = 5, + BATTLEGROUND_AA = 6, + BATTLEGROUND_EY = 7, + BATTLEGROUND_RL = 8, + BATTLEGROUND_SA = 9, + BATTLEGROUND_DS = 10, + BATTLEGROUND_RV = 11 +}; +#define MAX_BATTLEGROUND_TYPE_ID 12 + #endif diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 74edc89f854..9bd7a32e498 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -47,6 +47,7 @@ #include "Creature.h" #include "Totem.h" #include "CreatureAI.h" +#include "BattleGroundMgr.h" #include "BattleGround.h" #include "BattleGroundEY.h" #include "BattleGroundWS.h" diff --git a/src/game/World.cpp b/src/game/World.cpp index 3bce771bec0..3b7445b4843 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1338,7 +1338,7 @@ void World::SetInitialWorldSettings() objmgr.LoadGameObjectForQuests(); sLog.outString( "Loading BattleMasters..." ); - objmgr.LoadBattleMastersEntry(); + sBattleGroundMgr.LoadBattleMastersEntry(); sLog.outString( "Loading GameTeleports..." ); objmgr.LoadGameTele(); @@ -1585,13 +1585,13 @@ void World::Update(uint32 diff) switch (i) { case 0: - AuctionMap = objmgr.GetAuctionsMap( 6 );//horde + AuctionMap = objmgr.GetAuctionsMap(AUCTION_HORDE); break; case 1: - AuctionMap = objmgr.GetAuctionsMap( 2 );//alliance + AuctionMap = objmgr.GetAuctionsMap(AUCTION_ALLIANCE); break; case 2: - AuctionMap = objmgr.GetAuctionsMap( 7 );//neutral + AuctionMap = objmgr.GetAuctionsMap(AUCTION_NEUTRAL); break; } diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 65216b028d5..8fb8a7f2335 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -26,6 +26,7 @@ #define __WORLDSESSION_H #include "Common.h" +#include "SharedDefines.h" class MailItemsInfo; struct ItemPrototype; @@ -153,7 +154,7 @@ class TRINITY_DLL_SPEC WorldSession void SendAttackStop(Unit const* enemy); - void SendBattlegGroundList( uint64 guid, uint32 bgTypeId ); + void SendBattlegGroundList( uint64 guid, BattleGroundTypeId bgTypeId ); void SendTradeStatus(uint32 status); void SendCancelTrade(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e400b7797b8..a14834d0866 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7249" + #define REVISION_NR "7250" #endif // __REVISION_NR_H__ |