diff options
-rw-r--r-- | sql/updates/world/2015_08_15_00_world.sql | 1 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 12 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 5 |
3 files changed, 16 insertions, 2 deletions
diff --git a/sql/updates/world/2015_08_15_00_world.sql b/sql/updates/world/2015_08_15_00_world.sql new file mode 100644 index 00000000000..72645ab0734 --- /dev/null +++ b/sql/updates/world/2015_08_15_00_world.sql @@ -0,0 +1 @@ +UPDATE `conditions` SET `ConditionTypeOrReference`=41 WHERE `ConditionTypeOrReference`=40; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7cae9ee2221..8a37012f5f4 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -101,6 +101,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Health Value", true, true, false }, { "Health Pct", true, true, false }, { "Realm Achievement", true, false, false }, + { "In Water", false, false, false }, { "Terrain Swap", true, false, false } }; @@ -425,6 +426,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = true; break; } + case CONDITION_IN_WATER: + { + if (Unit* unit = object->ToUnit()) + condMeets = unit->IsInWater(); + break; + } case CONDITION_TERRAIN_SWAP: { condMeets = object->IsInTerrainSwap(ConditionValue1); @@ -602,6 +609,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_REALM_ACHIEVEMENT: mask |= GRID_MAP_TYPE_MASK_ALL; break; + case CONDITION_IN_WATER: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; case CONDITION_TERRAIN_SWAP: mask |= GRID_MAP_TYPE_MASK_ALL; break; @@ -2120,6 +2130,8 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } break; } + case CONDITION_IN_WATER: + break; default: break; } diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index f2d27afb5f3..3549b1f2515 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -90,8 +90,9 @@ enum ConditionTypes CONDITION_HP_VAL = 37, // hpVal ComparisonType 0 true if unit's hp matches given value CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct CONDITION_REALM_ACHIEVEMENT = 39, // achievement_id 0 0 true if realm achievement is complete - CONDITION_TERRAIN_SWAP = 40, // terrainSwap 0 0 true if object is in terrainswap - CONDITION_MAX = 41 // MAX + CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water + CONDITION_TERRAIN_SWAP = 41, // terrainSwap 0 0 true if object is in terrainswap + CONDITION_MAX = 42 // MAX }; /*! Documentation on implementing a new ConditionSourceType: |