[8612] better error-check when getting bgTypeId from Battlemasterentry

This commit is contained in:
balrok 2009-10-10 01:35:58 +02:00
parent d7e01c3e16
commit caf4732e38
4 changed files with 13 additions and 2 deletions

View file

@ -711,6 +711,9 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const
return false;
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry());
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
return false;
if(!msg)
return pPlayer->GetBGAccessByLevel(bgTypeId);
@ -968,6 +971,11 @@ void Creature::OnGossipSelect(Player* player, uint32 option)
case GOSSIP_OPTION_BATTLEFIELD:
{
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(GetEntry());
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
{
sLog.outError("a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", player->GetGUIDLow());
return;
}
player->GetSession()->SendBattlegGroundList( GetGUID(), bgTypeId );
break;
}