diff options
author | megamage <none@none> | 2009-02-13 20:07:49 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-13 20:07:49 -0600 |
commit | 096030e6258d2c136eeae947246a36784abc2def (patch) | |
tree | 63b82e95384dce2bc156b40a72e076849d263854 /src/game/Player.cpp | |
parent | 136e49f39f961c6a9dd97bb2c9a8188aa24fe0fe (diff) |
[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..
Author: balrok
--HG--
branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 11d8d6de5b3..ba11ffa6c27 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19053,40 +19053,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); + BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); + assert(bg); + return (queue_id*10)+bg->GetMinLevel(); } -uint32 Player::GetMaxLevelForBattleGroundQueueId(uint32 queue_id) +uint32 Player::GetMaxLevelForBattleGroundQueueId(uint32 queue_id, BattleGroundTypeId bgTypeId) { - if(queue_id >=7) - return 255; // hardcoded max level - - return 10*(queue_id+2)-1; + return GetMinLevelForBattleGroundQueueId(queue_id, bgTypeId)+10; } -//TODO make this more generic - current implementation is wrong -uint32 Player::GetBattleGroundQueueIdFromLevel() const +uint32 Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) 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;*/ + 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 |