diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Conditions/ConditionMgr.cpp | 82 | ||||
-rwxr-xr-x | src/server/game/Conditions/ConditionMgr.h | 56 |
2 files changed, 87 insertions, 51 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 81db61171a3..831452e50f6 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -37,7 +37,6 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker) sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found"); return false; } - uint32 refId = mConditionValue3;//value 3 can be a 'quick' reference bool condMeets = false; bool sendErrorMsg = false; switch (mConditionType) @@ -49,7 +48,6 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker) { if (Unit* unit = object->ToUnit()) { - refId = 0; if (!mConditionValue3) condMeets = unit->HasAuraEffect(mConditionValue1, mConditionValue2); else if (Player* player = unit->ToPlayer()) @@ -207,8 +205,7 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker) break; case CONDITION_ITEM_TARGET: { - condMeets = true;//handled in Item::IsTargetValidForItemUse - refId = 0;//cant have references for now + condMeets = true; //handled in Item::IsTargetValidForItemUse break; } case CONDITION_SPELL: @@ -271,7 +268,6 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker) } default: condMeets = false; - refId = 0; break; } switch (mSourceType) @@ -287,15 +283,6 @@ bool Condition::Meets(WorldObject* object, WorldObject* invoker) if (mNegativeCondition) condMeets = !condMeets; - bool refMeets = false; - if (condMeets && refId)//only have to check references if 'this' is met - { - ConditionList ref = sConditionMgr->GetConditionReferences(refId); - refMeets = sConditionMgr->IsObjectMeetToConditions(object, ref, invoker); - } - else - refMeets = true; - if (Player* player = object->ToPlayer()) if (sendErrorMsg && ErrorTextd && (!condMeets || !refMeets))//send special error from DB player->m_ConditionErrorMsgId = ErrorTextd; @@ -1156,6 +1143,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->mConditionValue2); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("Item condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_ITEM_EQUIPPED: @@ -1169,6 +1158,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_ZONEID: @@ -1176,18 +1167,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->mConditionValue1); if (!areaEntry) { - sLog->outErrorDb("Zone condition has non existing area (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->mConditionValue1); return false; } if (areaEntry->zone != 0) { - sLog->outErrorDb("Zone condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->mConditionValue1); + sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->mConditionValue1); return false; } if (cond->mConditionValue2) - sLog->outErrorDb("Zone condition has useless data in value2 (%u)!", cond->mConditionValue2); + sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_REPUTATION_RANK: @@ -1198,6 +1191,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->mConditionValue1); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_TEAM: @@ -1210,6 +1205,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_SKILL: @@ -1226,6 +1223,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->mConditionValue2); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_QUESTREWARDED: @@ -1241,21 +1240,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2 > 1) sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_NO_AURA: { if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1)) { - sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1); + sLog->outErrorDb("NoAura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1); return false; } if (cond->mConditionValue2 > 2) { - sLog->outErrorDb("Aura condition has non existing effect index (%u) in value2 (must be 0..2), skipped", cond->mConditionValue2); + sLog->outErrorDb("NoAura condition has non existing effect index (%u) in value2 (must be 0..2), skipped", cond->mConditionValue2); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("NoAura condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_ACTIVE_EVENT: @@ -1263,12 +1266,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); if (cond->mConditionValue1 >=events.size() || !events[cond->mConditionValue1].isValid()) { - sLog->outErrorDb("Active event condition has non existing event id (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->mConditionValue1); return false; } if (cond->mConditionValue2) - sLog->outErrorDb("Active event condition has useless data in value2 (%u)!", cond->mConditionValue2); + sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_ACHIEVEMENT: @@ -1276,12 +1281,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(cond->mConditionValue1); if (!achievement) { - sLog->outErrorDb("Achivemen condition has non existing achivement id (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->mConditionValue1); return false; } if (cond->mConditionValue2) - sLog->outErrorDb("Achivemen condition has useless data in value2 (%u)!", cond->mConditionValue2); + sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_CLASS: @@ -1294,6 +1301,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_RACE: @@ -1306,6 +1315,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_SPELL_SCRIPT_TARGET: @@ -1358,6 +1369,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("CreatureTarget condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("CreatureTarget condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_TARGET_HEALTH_BELOW_PCT: @@ -1370,6 +1383,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("TargetHealthBelowPct condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("TargetHealthBelowPct condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_TARGET_RANGE: @@ -1379,6 +1394,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("TargetRange condition has max distance closer then min distance, skipped"); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("TargetRange condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_MAPID: @@ -1392,6 +1409,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_ITEM_TARGET: @@ -1422,6 +1441,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->mConditionValue2) sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->mConditionValue3) + sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_NOITEM: @@ -1432,6 +1453,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("NoItem condition has non existing item (%u), skipped", cond->mConditionValue1); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("NoItem condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_LEVEL: @@ -1441,6 +1464,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->mConditionValue2); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_DRUNKENSTATE: @@ -1450,6 +1475,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->mConditionValue1); return false; } + if (cond->mConditionValue2) + { + sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->mConditionValue3); + return false; + } + if (cond->mConditionValue3) + sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_NEAR_CREATURE: @@ -1459,6 +1491,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->mConditionValue1); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("NearCreature condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_NEAR_GAMEOBJECT: @@ -1468,6 +1502,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->mConditionValue1); return false; } + if (cond->mConditionValue3) + sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->mConditionValue3); break; } case CONDITION_AREAID: diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index b3ba27db7b5..19bdd929b58 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -30,35 +30,35 @@ enum ConditionType { // value1 value2 value3 CONDITION_NONE = 0, // 0 0 0 always true CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex - CONDITION_ITEM = 2, // item_id count +referenceID true if has #count of item_ids - CONDITION_ITEM_EQUIPPED = 3, // item_id 0 +referenceID true if has item_id equipped - CONDITION_ZONEID = 4, // zone_id 0 +referenceID true if in zone_id - CONDITION_REPUTATION_RANK = 5, // faction_id min_rank +referenceID true if has min_rank for faction_id - CONDITION_TEAM = 6, // player_team 0, +referenceID 469 - Alliance, 67 - Horde) - CONDITION_SKILL = 7, // skill_id skill_value +referenceID true if has skill_value for skill_id - CONDITION_QUESTREWARDED = 8, // quest_id 0 +referenceID true if quest_id was rewarded before - CONDITION_QUESTTAKEN = 9, // quest_id 0, +referenceID true while quest active - CONDITION_DRUNKENSTATE = 10, // DrunkenState 0, +referenceID true if player is drunk enough - CONDITION_NO_AURA = 11, // spell_id effindex +referenceID true if does not have aura of spell_id with effect effindex - CONDITION_ACTIVE_EVENT = 12, // event_id 0 +referenceID true if event is active - CONDITION_INSTANCE_DATA = 13, // entry data +referenceID true if data is set in current instance - CONDITION_QUEST_NONE = 14, // quest_id 0 +referenceID true if doesn't have quest saved - CONDITION_CLASS = 15, // class 0 +referenceID true if player's class is equal to class - CONDITION_RACE = 16, // race 0 +referenceID true if player's race is equal to race - CONDITION_ACHIEVEMENT = 17, // achievement_id 0 +referenceID true if achievement is complete - CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0 - CONDITION_CREATURE_TARGET = 19, // creature entry 0 +referenceID true if current target is creature with value1 entry - 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 = 2, // item_id count 0 true if has #count of item_ids + CONDITION_ITEM_EQUIPPED = 3, // item_id 0 0 true if has item_id equipped + CONDITION_ZONEID = 4, // zone_id 0 0 true if in zone_id + CONDITION_REPUTATION_RANK = 5, // faction_id min_rank 0 true if has min_rank for faction_id + CONDITION_TEAM = 6, // player_team 0, 0 469 - Alliance, 67 - Horde) + CONDITION_SKILL = 7, // skill_id skill_value 0 true if has skill_value for skill_id + CONDITION_QUESTREWARDED = 8, // quest_id 0 0 true if quest_id was rewarded before + CONDITION_QUESTTAKEN = 9, // quest_id 0, 0 true while quest active + CONDITION_DRUNKENSTATE = 10, // DrunkenState 0, 0 true if player is drunk enough + CONDITION_NO_AURA = 11, // spell_id effindex 0 true if does not have aura of spell_id with effect effindex + CONDITION_ACTIVE_EVENT = 12, // event_id 0 0 true if event is active + CONDITION_INSTANCE_DATA = 13, // entry data 0 true if data is set in current instance + CONDITION_QUEST_NONE = 14, // quest_id 0 0 true if doesn't have quest saved + CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class + CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race + CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete + CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0 + CONDITION_CREATURE_TARGET = 19, // creature entry 0 0 true if current target is creature with value1 entry + CONDITION_TARGET_HEALTH_BELOW_PCT = 20, // 0-100 0 0 true if target's health is below value1 percent, false if over or no target + CONDITION_TARGET_RANGE = 21, // minDistance maxDist 0 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 0 true if in map_id + CONDITION_AREAID = 23, // area_id 0 0 true if in area_id CONDITION_ITEM_TARGET = 24, // ItemRequiredTargetType, TargetEntry, 0 - CONDITION_SPELL = 25, // spell_id bool +referenceID bool 1 for true 0 for false - CONDITION_NOITEM = 26, // item_id bank +referenceID true if player does not have any of the item (if 'bank' is set it searches in bank slots too) - CONDITION_LEVEL = 27, // level opt +referenceID true if player's level is equal to param1 (param2 can modify the statement) - CONDITION_QUEST_COMPLETE = 28, // quest_id 0 +referenceID true if player has quest_id with all objectives complete, but not yet rewarded - CONDITION_NEAR_CREATURE = 29, // creature entry distance +referenceID true if there is a creature of entry in range - CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance +referenceID true if there is a gameobject of entry in range + CONDITION_SPELL = 25, // spell_id bool 0 bool 1 for true 0 for false + CONDITION_NOITEM = 26, // item_id bank 0 true if player does not have any of the item (if 'bank' is set it searches in bank slots too) + CONDITION_LEVEL = 27, // level opt 0 true if player's level is equal to param1 (param2 can modify the statement) + CONDITION_QUEST_COMPLETE = 28, // quest_id 0 0 true if player has quest_id with all objectives complete, but not yet rewarded + CONDITION_NEAR_CREATURE = 29, // creature entry distance 0 true if there is a creature of entry in range + CONDITION_NEAR_GAMEOBJECT = 30, // gameobject entry distance 0 true if there is a gameobject of entry in range CONDITION_MAX = 31 // MAX }; |