[8970] Implement CONDITION_AREA_FLAG

Value1 is for "include flag", Value2 for "not include flag"

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2009-12-11 18:37:06 +01:00
parent 5e2c6e6b86
commit fb6712f3a3
3 changed files with 21 additions and 2 deletions

View file

@ -7244,6 +7244,15 @@ bool PlayerCondition::Meets(Player const * player) const
return !player->HasAura(value1, value2);
case CONDITION_ACTIVE_EVENT:
return sGameEventMgr.IsActiveEvent(value1);
case CONDITION_AREA_FLAG:
{
if (AreaTableEntry const *pAreaEntry = GetAreaEntryByAreaID(player->GetAreaId()))
{
if ((!value1 || (pAreaEntry->flags & value1)) && (!value2 || !(pAreaEntry->flags & value2)))
return true;
}
return false;
}
default:
return false;
}
@ -7388,6 +7397,15 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
}
break;
}
case CONDITION_AREA_FLAG:
{
if (!value1 && !value2)
{
sLog.outErrorDb("Area flag condition has both values like 0, skipped");
return false;
}
break;
}
case CONDITION_NONE:
break;
}

View file

@ -284,9 +284,10 @@ enum ConditionType
CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD commission aura active
CONDITION_NO_AURA = 11, // spell_id effindex
CONDITION_ACTIVE_EVENT = 12, // event_id
CONDITION_AREA_FLAG = 13 // area_flag area_flag_not
};
#define MAX_CONDITION 13 // maximum value in ConditionType enum
#define MAX_CONDITION 14 // maximum value in ConditionType enum
struct PlayerCondition
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8969"
#define REVISION_NR "8970"
#endif // __REVISION_NR_H__