Implement new player conditions CONDITION_NO_AURA, CONDITION_ACTIVE_EVENT.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
Currently can be used in loot conditions, later possible in gossip options show.
This commit is contained in:
@ 2008-10-26 23:38:45 +03:00 committed by VladimirMangos
parent 4482593653
commit e96fedc97c
2 changed files with 31 additions and 1 deletions

View file

@ -6381,6 +6381,10 @@ bool PlayerCondition::Meets(Player const * player) const
return true;
return false;
}
case CONDITION_NO_AURA:
return !player->HasAura(value1, value2);
case CONDITION_ACTIVE_EVENT:
return gameeventmgr.IsActiveEvent(value1);
default:
return false;
}
@ -6501,6 +6505,30 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val
sLog.outErrorDb("Quest condition has useless data in value2 (%u)!", value2);
break;
}
case CONDITION_NO_AURA:
{
if(!sSpellStore.LookupEntry(value1))
{
sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1);
return false;
}
if(value2 > 2)
{
sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2);
return false;
}
break;
}
case CONDITION_ACTIVE_EVENT:
{
GameEvent::GameEventDataMap const& events = gameeventmgr.GetEventMap();
if(value1 >=events.size() || !events[value1].isValid())
{
sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1);
return false;
}
break;
}
}
return true;
}

View file

@ -203,9 +203,11 @@ enum ConditionType
CONDITION_QUESTREWARDED = 8, // quest_id 0
CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active.
CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ñommission aura active
CONDITION_NO_AURA = 11, // spell_id effindex
CONDITION_ACTIVE_EVENT = 12, // event_id
};
#define MAX_CONDITION 11 // maximum value in ConditionType enum
#define MAX_CONDITION 13 // maximum value in ConditionType enum
struct PlayerCondition
{