[9892] Cleanups for BattleGroundEY code

Signed-off-by: VladimirMangos <vladimir@getmangos.com>

Also prevent send uninitilized mark data in case BATTLEGROUND_EY end.
Simplify related code.
This commit is contained in:
j4r0d 2010-05-14 23:14:23 +04:00 committed by VladimirMangos
parent 312a076491
commit 19b5d777cd
4 changed files with 75 additions and 94 deletions

View file

@ -855,42 +855,30 @@ uint32 BattleGround::GetBattlemasterEntry() const
void BattleGround::RewardMark(Player *plr,uint32 count)
{
BattleGroundMarks mark;
bool IsSpell;
switch(GetTypeID())
{
case BATTLEGROUND_AV:
IsSpell = true;
if (count == ITEM_WINNER_COUNT)
mark = SPELL_AV_MARK_WINNER;
RewardSpellCast(plr,SPELL_AV_MARK_WINNER);
else
mark = SPELL_AV_MARK_LOSER;
RewardSpellCast(plr,SPELL_AV_MARK_LOSER);
break;
case BATTLEGROUND_WS:
IsSpell = true;
if (count == ITEM_WINNER_COUNT)
mark = SPELL_WS_MARK_WINNER;
RewardSpellCast(plr,SPELL_WS_MARK_WINNER);
else
mark = SPELL_WS_MARK_LOSER;
RewardSpellCast(plr,SPELL_WS_MARK_LOSER);
break;
case BATTLEGROUND_AB:
IsSpell = true;
if (count == ITEM_WINNER_COUNT)
mark = SPELL_AB_MARK_WINNER;
RewardSpellCast(plr,SPELL_AB_MARK_WINNER);
else
mark = SPELL_AB_MARK_LOSER;
break;
case BATTLEGROUND_EY:
IsSpell = false;
RewardSpellCast(plr,SPELL_AB_MARK_LOSER);
break;
case BATTLEGROUND_EY: // no rewards
default:
return;
break;
}
if (IsSpell)
RewardSpellCast(plr,mark);
else
RewardItem(plr,mark,count);
}
void BattleGround::RewardSpellCast(Player *plr, uint32 spell_id)