From e96fedc97c621be29f4ded43ce2f0838fafb91aa Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Sun, 26 Oct 2008 23:38:45 +0300 Subject: [PATCH] Implement new player conditions CONDITION_NO_AURA, CONDITION_ACTIVE_EVENT. Signed-off-by: VladimirMangos Currently can be used in loot conditions, later possible in gossip options show. --- src/game/ObjectMgr.cpp | 28 ++++++++++++++++++++++++++++ src/game/ObjectMgr.h | 4 +++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 9ce7fad75..9720564bf 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -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; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index d5391c464..982b9a4a9 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -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 {