TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ConditionMgr.cpp File Reference
#include "ConditionMgr.h"
#include "AchievementMgr.h"
#include "GameEventMgr.h"
#include "Group.h"
#include "InstanceScript.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
+ Include dependency graph for ConditionMgr.cpp:

Functions

bool PlayerConditionCompare (int32 comparisonType, int32 value1, int32 value2)
 
template<std::size_t N>
bool PlayerConditionLogic (uint32 logic, std::array< bool, N > &results)
 

Function Documentation

bool PlayerConditionCompare ( int32  comparisonType,
int32  value1,
int32  value2 
)
inline
2279 {
2280  switch (comparisonType)
2281  {
2282  case 1:
2283  return value1 == value2;
2284  case 2:
2285  return value1 != value2;
2286  case 3:
2287  return value1 > value2;
2288  case 4:
2289  return value1 >= value2;
2290  case 5:
2291  return value1 < value2;
2292  case 6:
2293  return value1 <= value2;
2294  default:
2295  break;
2296  }
2297  return false;
2298 }

+ Here is the caller graph for this function:

template<std::size_t N>
bool PlayerConditionLogic ( uint32  logic,
std::array< bool, N > &  results 
)
inline
2302 {
2303  static_assert(N < 16, "Logic array size must be equal to or less than 16");
2304 
2305  for (std::size_t i = 0; i < results.size(); ++i)
2306  if ((logic >> (16 + i)) & 1)
2307  results[i] ^= true;
2308 
2309  bool result = results[0];
2310  for (std::size_t i = 1; i < results.size(); ++i)
2311  {
2312  switch ((logic >> (2 * (i - 1))) & 3)
2313  {
2314  case 1:
2315  result = result && results[i];
2316  break;
2317  case 2:
2318  result = result || results[i];
2319  break;
2320  default:
2321  break;
2322  }
2323  }
2324 
2325  return result;
2326 }

+ Here is the caller graph for this function: