mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[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.
This commit is contained in:
parent
e355084376
commit
5a4358dda9
29 changed files with 319 additions and 262 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -177,18 +177,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);
|
||||
|
|
|
|||
|
|
@ -52,21 +52,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
|
||||
|
|
@ -129,13 +129,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);
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
uint32 location = AuctioneerFactionToLocation(pCreature->getFaction());
|
||||
AuctionLocation location = AuctioneerFactionToLocation(pCreature->getFaction());
|
||||
AuctionHouseObject * mAuctions;
|
||||
mAuctions = objmgr.GetAuctionsMap( location );
|
||||
|
||||
|
|
@ -341,7 +341,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 );
|
||||
|
|
@ -468,7 +468,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 );
|
||||
|
|
@ -556,7 +556,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) );
|
||||
|
|
@ -614,7 +614,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 );
|
||||
|
||||
|
|
@ -644,9 +644,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;
|
||||
|
|
@ -671,15 +671,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
|
||||
|
|
@ -710,7 +709,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();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,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;
|
||||
|
|
@ -52,7 +61,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
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "Object.h"
|
||||
#include "Player.h"
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "MapManager.h"
|
||||
#include "Language.h"
|
||||
|
|
@ -26,11 +27,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;
|
||||
|
|
@ -768,7 +772,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())
|
||||
|
|
@ -1507,3 +1511,11 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -20,13 +20,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,
|
||||
|
|
@ -129,22 +132,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
|
||||
{
|
||||
|
|
@ -268,7 +255,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; }
|
||||
|
|
@ -291,7 +278,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; }
|
||||
|
|
@ -385,13 +372,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);
|
||||
|
||||
|
|
@ -482,7 +463,7 @@ class BattleGround
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "MapManager.h"
|
||||
#include "Language.h"
|
||||
#include "Util.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattleGroundAB::BattleGroundAB()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Creature.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "MapManager.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Language.h"
|
||||
|
||||
BattleGroundBE::BattleGroundBE()
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "MapManager.h"
|
||||
#include "Language.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Util.h"
|
||||
|
||||
BattleGroundEY::BattleGroundEY()
|
||||
|
|
|
|||
|
|
@ -51,7 +51,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))
|
||||
{
|
||||
|
|
@ -63,7 +63,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);
|
||||
|
|
@ -75,22 +75,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
|
||||
|
|
@ -272,19 +274,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 );
|
||||
}
|
||||
|
||||
|
|
@ -297,15 +295,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)
|
||||
|
|
@ -329,7 +327,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;
|
||||
|
|
@ -365,6 +363,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;
|
||||
|
|
@ -393,7 +393,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;
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +570,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);
|
||||
|
|
@ -698,7 +698,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
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Player.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "BattleGroundAV.h"
|
||||
|
|
@ -30,8 +31,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"
|
||||
|
|
@ -39,6 +38,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 );
|
||||
|
||||
|
|
@ -71,7 +75,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();
|
||||
|
|
@ -204,7 +208,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();
|
||||
|
||||
|
|
@ -406,7 +410,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)
|
||||
{
|
||||
|
|
@ -485,26 +489,25 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b
|
|||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// inititate the groups eligible to create the bg
|
||||
|
|
@ -587,7 +590,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 updateing 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);
|
||||
|
|
@ -603,7 +606,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)
|
||||
{
|
||||
|
|
@ -725,7 +728,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])) &&
|
||||
|
|
@ -889,7 +892,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])) &&
|
||||
|
|
@ -991,22 +994,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
|
||||
|
|
@ -1051,7 +1050,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);
|
||||
|
|
@ -1343,7 +1342,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
|
||||
|
|
@ -1420,25 +1419,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)
|
||||
{
|
||||
|
|
@ -1506,7 +1504,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;
|
||||
|
|
@ -1589,16 +1587,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;
|
||||
|
|
@ -1746,7 +1746,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;
|
||||
|
||||
|
|
@ -1812,7 +1812,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 ||
|
||||
|
|
@ -1820,7 +1820,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)
|
||||
{
|
||||
|
|
@ -1856,7 +1856,7 @@ uint32 BattleGroundMgr::BGQueueTypeId(uint32 bgTypeId, uint8 arenaType)
|
|||
}
|
||||
}
|
||||
|
||||
uint32 BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
|
||||
BattleGroundTypeId BattleGroundMgr::BGTemplateId(uint32 bgQueueTypeId)
|
||||
{
|
||||
switch(bgQueueTypeId)
|
||||
{
|
||||
|
|
@ -1875,7 +1875,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1902,3 +1902,64 @@ void BattleGroundMgr::ToggleArenaTesting()
|
|||
else
|
||||
sWorld.SendGlobalText("Arenas are set to normal playercount.", NULL);
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,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..
|
||||
|
|
@ -30,13 +28,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
|
||||
|
|
@ -51,7 +49,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
|
||||
|
|
@ -68,9 +66,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);
|
||||
|
|
@ -87,7 +85,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);
|
||||
void RemoveGroup(GroupQueueInfo * ginfo);
|
||||
};
|
||||
|
||||
|
|
@ -123,7 +121,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:
|
||||
|
||||
|
|
@ -178,8 +176,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);
|
||||
|
|
@ -194,46 +192,56 @@ 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 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;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Creature.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "MapManager.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Language.h"
|
||||
|
||||
BattleGroundNA::BattleGroundNA()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "MapManager.h"
|
||||
#include "Language.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattleGroundRL::BattleGroundRL()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundSA.h"
|
||||
#include "Player.h"
|
||||
|
||||
BattleGroundSA::BattleGroundSA()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include "GameObject.h"
|
||||
#include "Chat.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "Language.h"
|
||||
|
||||
BattleGroundWS::BattleGroundWS()
|
||||
|
|
|
|||
|
|
@ -37,7 +37,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"
|
||||
|
|
@ -654,7 +654,7 @@ bool Creature::isCanIneractWithBattleMaster(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);
|
||||
|
||||
|
|
@ -911,7 +911,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1329,7 +1329,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();
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ class MANGOS_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);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "BattleGround.h"
|
||||
#include "WaypointMovementGenerator.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -265,14 +265,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
|
||||
|
|
@ -280,18 +280,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;
|
||||
|
|
@ -1565,18 +1565,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;
|
||||
|
||||
|
|
@ -6550,51 +6563,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
|
||||
|
|
|
|||
|
|
@ -373,15 +373,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;
|
||||
|
|
@ -439,14 +439,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);
|
||||
|
||||
|
|
@ -539,7 +531,6 @@ class ObjectMgr
|
|||
void LoadQuestAreaTriggers();
|
||||
void LoadAreaTriggerScripts();
|
||||
void LoadTavernAreaTriggers();
|
||||
void LoadBattleMastersEntry();
|
||||
void LoadGameObjectForQuests();
|
||||
|
||||
void LoadItemTexts();
|
||||
|
|
@ -798,7 +789,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;
|
||||
|
|
@ -817,7 +807,6 @@ class ObjectMgr
|
|||
AuctionHouseObject mNeutralAuctions;
|
||||
|
||||
QuestAreaTriggerMap mQuestAreaTriggerMap;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
TavernAreaTriggerSet mTavernAreaTriggerSet;
|
||||
GameObjectForQuestSet mGameObjectForQuestSet;
|
||||
GossipTextMap mGossipText;
|
||||
|
|
|
|||
|
|
@ -18376,7 +18376,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);
|
||||
|
|
|
|||
|
|
@ -1966,7 +1966,7 @@ class MANGOS_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();
|
||||
|
||||
/*********************************************************/
|
||||
|
|
|
|||
|
|
@ -2212,4 +2212,21 @@ enum BanReturn
|
|||
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
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "Creature.h"
|
||||
#include "Totem.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundEY.h"
|
||||
#include "BattleGroundWS.h"
|
||||
|
|
|
|||
|
|
@ -1286,7 +1286,7 @@ void World::SetInitialWorldSettings()
|
|||
objmgr.LoadGameObjectForQuests();
|
||||
|
||||
sLog.outString( "Loading BattleMasters..." );
|
||||
objmgr.LoadBattleMastersEntry();
|
||||
sBattleGroundMgr.LoadBattleMastersEntry();
|
||||
|
||||
sLog.outString( "Loading GameTeleports..." );
|
||||
objmgr.LoadGameTele();
|
||||
|
|
@ -1477,13 +1477,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#define __WORLDSESSION_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
class MailItemsInfo;
|
||||
struct ItemPrototype;
|
||||
|
|
@ -151,7 +152,7 @@ class MANGOS_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();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7249"
|
||||
#define REVISION_NR "7250"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue