diff options
| author | ForesterDev <11771800+ForesterDev@users.noreply.github.com> | 2019-03-23 20:51:36 +0400 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-11-24 22:56:14 +0100 |
| commit | b26c2f5c130090554b6a723a540c42c88472d959 (patch) | |
| tree | 0b70436a6d888adf6335bd7863396de8b0b223e6 | |
| parent | e182a38b014f5538c42432f871e094dc79c2b131 (diff) | |
Core/Conditions: implement CONDITION_GAMEMASTER (#23108)
(cherry picked from commit 262ddaf819d3b2e759bb4690149c0c28a4022d5f)
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 17 | ||||
| -rw-r--r-- | src/server/game/Conditions/ConditionMgr.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 95eedba3161..1c5c294d9c1 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -135,7 +135,7 @@ ConditionMgr::ConditionTypeInfo const ConditionMgr::StaticConditionTypeData[COND { "Quest state mask", true, true, false }, { "Objective Complete", true, false, false }, { "Map Difficulty", true, false, false }, - { nullptr, false, false, false }, + { "Is Gamemaster", true, false, false }, { "Object Entry or Guid", true, true, true }, { "Object TypeMask", true, false, false }, }; @@ -547,6 +547,17 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const condMeets = object->GetMap()->GetDifficultyID() == ConditionValue1; break; } + case CONDITION_GAMEMASTER: + { + if (Player* player = object->ToPlayer()) + { + if (ConditionValue1 == 1) + condMeets = player->CanBeGameMaster(); + else + condMeets = player->IsGameMaster(); + } + break; + } default: condMeets = false; break; @@ -745,6 +756,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const case CONDITION_DIFFICULTY_ID: mask |= GRID_MAP_TYPE_MASK_ALL; break; + case CONDITION_GAMEMASTER: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -2423,6 +2437,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const case CONDITION_TERRAIN_SWAP: case CONDITION_CHARMED: case CONDITION_TAXI: + case CONDITION_GAMEMASTER: break; case CONDITION_DIFFICULTY_ID: if (!sDifficultyStore.LookupEntry(cond->ConditionValue1)) diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 496bd43974a..d4f3bf8a188 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -104,6 +104,7 @@ enum ConditionTypes CONDITION_QUESTSTATE = 47, // quest_id state_mask 0 true if player is in any of the provided quest states for the quest (1 = not taken, 2 = completed, 8 = in progress, 32 = failed, 64 = rewarded) CONDITION_QUEST_OBJECTIVE_COMPLETE = 48, // ID 0 0 true if player has ID objective complete, but quest not yet rewarded CONDITION_DIFFICULTY_ID = 49, // Difficulty 0 0 true is map has difficulty id + CONDITION_GAMEMASTER = 50, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster) CONDITION_OBJECT_ENTRY_GUID = 51, // TypeID entry guid true if object is type TypeID and the entry is 0 or matches entry of the object or matches guid of the object CONDITION_TYPE_MASK = 52, // TypeMask 0 0 true if object is type object's TypeMask matches provided TypeMask CONDITION_MAX |
