[7275] getbattlegroundqueueidfromlevel returns now bg-specific queueids

before this commit, queueids were staticaly given for
9-19,20-29,30-39... but for instance alterac valley needs
51-60,61-70,71-80.. this patch allows this,
if you change the minlevel in battleground_template you also could make
23-32,33-42.. levelranges
not that we always use 10lvl-steps.. this is actually hardcoded..
This commit is contained in:
balrok 2009-02-12 12:15:57 +01:00 committed by VladimirMangos
parent 6b715047a7
commit bd89568993
6 changed files with 84 additions and 94 deletions

View file

@ -18471,39 +18471,34 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const
return true;
}
uint32 Player::GetMinLevelForBattleGroundQueueId(uint32 queue_id)
uint32 Player::GetMinLevelForBattleGroundQueueId(uint32 queue_id, BattleGroundTypeId bgTypeId)
{
if(queue_id < 1)
return 0;
if(queue_id >=7)
queue_id = 7;
return 10*(queue_id+1);
}
uint32 Player::GetMaxLevelForBattleGroundQueueId(uint32 queue_id)
{
if(queue_id >=7)
return 255; // hardcoded max level
return 10*(queue_id+2)-1;
}
uint32 Player::GetBattleGroundQueueIdFromLevel() const
{
uint32 level = getLevel();
if(level <= 19)
return 0;
else if (level > 79)
return 7;
else
return level/10 - 1; // 20..29 -> 1, 30-39 -> 2, ...
/*
assert(bgTypeId < MAX_BATTLEGROUND_TYPES);
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
assert(bg);
return (getLevel() - bg->GetMinLevel()) / 10;*/
return (queue_id*10)+bg->GetMinLevel();
}
uint32 Player::GetMaxLevelForBattleGroundQueueId(uint32 queue_id, BattleGroundTypeId bgTypeId)
{
return GetMinLevelForBattleGroundQueueId(queue_id, bgTypeId)+10;
}
uint32 Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) const
{
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
assert(bg);
if(getLevel()<bg->GetMinLevel())
{
sLog.outError("getting queue_id for player who doesn't meet the requirements - this shouldn't happen");
return 0;
}
uint32 queue_id = (getLevel() - bg->GetMinLevel()) / 10;
if(queue_id>MAX_BATTLEGROUND_QUEUES)
{
sLog.outError("to high queue_id %u this shouldn't happen",queue_id);
return 0;
}
return queue_id;
}
float Player::GetReputationPriceDiscount( Creature const* pCreature ) const