aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp22
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.h2
2 files changed, 23 insertions, 1 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 029272b3841..dbde48bd257 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -105,6 +105,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = unit->getRaceMask() & ConditionValue1;
break;
}
+ case CONDITION_GENDER:
+ {
+ if (Player* player = object->ToPlayer())
+ condMeets = player->getGender() == ConditionValue1;
+ break;
+ }
case CONDITION_SKILL:
{
if (Player* player = object->ToPlayer())
@@ -442,6 +448,8 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
case CONDITION_SPAWNMASK:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
+ case CONDITION_GENDER:
+ mask |= GRID_MAP_TYPE_MASK_PLAYER;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
@@ -1616,6 +1624,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog->outError(LOG_FILTER_SQL, "Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
+ case CONDITION_GENDER:
+ {
+ if (!Player::IsValidGender(uint8(cond->ConditionValue1)))
+ {
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has invalid gender (%u), skipped", cond->ConditionValue1);
+ return false;
+ }
+
+ if (cond->ConditionValue2)
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has useless data in value2 (%u)!", cond->ConditionValue2);
+ if (cond->ConditionValue3)
+ sLog->outError(LOG_FILTER_SQL, "Gender condition has useless data in value3 (%u)!", cond->ConditionValue3);
+ break;
+ }
case CONDITION_MAPID:
{
MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1);
diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h
index 7ffb6ff584c..0adf44a2d5a 100755
--- a/src/server/game/Conditions/ConditionMgr.h
+++ b/src/server/game/Conditions/ConditionMgr.h
@@ -53,7 +53,7 @@ enum ConditionTypes
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete
CONDITION_TITLE = 18, // title id 0 0 true if player has title
CONDITION_SPAWNMASK = 19, // spawnMask 0 0 true if in spawnMask
- CONDITION_UNUSED_20 = 20, //
+ CONDITION_GENDER = 20, // gender 0 0 true if player's gender is equal to gender
CONDITION_UNUSED_21 = 21, //
CONDITION_MAPID = 22, // map_id 0 0 true if in map_id
CONDITION_AREAID = 23, // area_id 0 0 true if in area_id