aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp15
-rw-r--r--src/server/game/Conditions/ConditionMgr.h5
2 files changed, 18 insertions, 2 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 8763e61d95a..abf68389a12 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -166,6 +166,9 @@ bool Condition::Meets(Player * player, Unit* targetOverride)
refId = 0;//cant have references for now
break;
}
+ case CONDITION_SPELL:
+ condMeets = player->HasSpell(mConditionValue1);
+ break;
default:
condMeets = false;
refId = 0;
@@ -1217,6 +1220,18 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog.outErrorDb("ItemTarget condition has useless data in value3 (%u)!", cond->mConditionValue3);
break;
}
+ case CONDITION_SPELL:
+ {
+ if (!sSpellStore.LookupEntry(cond->mConditionValue1))
+ {
+ sLog.outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
+ return false;
+ }
+
+ if (cond->mConditionValue2)
+ sLog.outErrorDb("Spell condition has useless data in value2 (%u)!", cond->mConditionValue2);
+ break;
+ }
case CONDITION_AREAID:
case CONDITION_INSTANCE_DATA:
break;
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index cdb343fbe48..0a0741e98ed 100644
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -52,8 +52,9 @@ enum ConditionType
CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 +referenceID true if target's health is below value1 percent, false if over or no target
CONDITION_TARGET_RANGE = 21, // minDistance maxDist +referenceID true if target is closer then minDist and further then maxDist or if max is 0 then max dist is infinit
CONDITION_MAPID = 22, // map_id 0 +referenceID true if in map_id
- CONDITION_AREAID = 23, // area_id 0 +referenceID true if in area_id
- CONDITION_ITEM_TARGET = 24 // ItemRequiredTargetType, TargetEntry, 0
+ CONDITION_AREAID = 23, // area_id 0 +referenceID true if in area_id
+ CONDITION_ITEM_TARGET = 24, // ItemRequiredTargetType, TargetEntry, 0
+ CONDITION_SPELL = 25 // spell_id 0 +referenceID true if knows spell
};
#define MAX_CONDITION 25 // maximum value in ConditionType enum