Core/Conditions: implement CONDITION_GAMEMASTER (#23108)

This commit is contained in:
ForesterDev
2019-03-23 20:51:36 +04:00
committed by Giacomo Pozzoni
parent a926a3088d
commit 262ddaf819
2 changed files with 17 additions and 1 deletions

View File

@@ -499,6 +499,17 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
}
break;
}
case CONDITION_GAMEMASTER:
{
if (Player* player = object->ToPlayer())
{
if (ConditionValue1 == 1)
condMeets = player->CanBeGameMaster();
else
condMeets = player->IsGameMaster();
}
break;
}
default:
condMeets = false;
break;
@@ -686,6 +697,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() const
case CONDITION_QUESTSTATE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_GAMEMASTER:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
@@ -2259,6 +2273,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
case CONDITION_IN_WATER:
case CONDITION_CHARMED:
case CONDITION_TAXI:
case CONDITION_GAMEMASTER:
default:
break;
}

View File

@@ -82,7 +82,8 @@ enum ConditionTypes
CONDITION_PET_TYPE = 45, // mask 0 0 true if player has a pet of given type(s)
CONDITION_TAXI = 46, // 0 0 0 true if player is on taxi
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_MAX = 48 // MAX
CONDITION_GAMEMASTER = 48, // canBeGM 0 0 true if player is gamemaster (or can be gamemaster)
CONDITION_MAX = 49 // MAX
};
/*! Documentation on implementing a new ConditionSourceType: