TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SpellArea Struct Reference

#include <SpellMgr.h>

Public Member Functions

bool IsFitToRequirements (Player const *player, uint32 newZone, uint32 newArea) const
 

Public Attributes

uint32 spellId
 
uint32 areaId
 
uint32 questStart
 
uint32 questEnd
 
int32 auraSpell
 
uint32 raceMask
 
Gender gender
 
uint32 questStartStatus
 
uint32 questEndStatus
 
bool autocast
 

Member Function Documentation

bool SpellArea::IsFitToRequirements ( Player const player,
uint32  newZone,
uint32  newArea 
) const
1163 {
1164  if (gender != GENDER_NONE) // not in expected gender
1165  if (!player || gender != player->getGender())
1166  return false;
1167 
1168  if (raceMask) // not in expected race
1169  if (!player || !(raceMask & player->getRaceMask()))
1170  return false;
1171 
1172  if (areaId) // not in expected zone
1173  if (newZone != areaId && newArea != areaId)
1174  return false;
1175 
1176  if (questStart) // not in expected required quest state
1177  if (!player || (((1 << player->GetQuestStatus(questStart)) & questStartStatus) == 0))
1178  return false;
1179 
1180  if (questEnd) // not in expected forbidden quest state
1181  if (!player || (((1 << player->GetQuestStatus(questEnd)) & questEndStatus) == 0))
1182  return false;
1183 
1184  if (auraSpell) // not have expected aura
1185  if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
1186  return false;
1187 
1188  if (player)
1189  {
1190  if (Battleground* bg = player->GetBattleground())
1191  return bg->IsSpellAllowed(spellId, player);
1192  }
1193 
1194  // Extra conditions
1195  switch (spellId)
1196  {
1197  case 91604: // No fly Zone - Wintergrasp
1198  {
1199  if (!player)
1200  return false;
1201 
1202  Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1203  if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
1204  return false;
1205  break;
1206  }
1207  case 56618: // Horde Controls Factory Phase Shift
1208  case 56617: // Alliance Controls Factory Phase Shift
1209  {
1210  if (!player)
1211  return false;
1212 
1213  Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1214 
1215  if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
1216  return false;
1217 
1218  // team that controls the workshop in the specified area
1219  uint32 team = bf->GetData(newArea);
1220 
1221  if (team == TEAM_HORDE)
1222  return spellId == 56618;
1223  else if (team == TEAM_ALLIANCE)
1224  return spellId == 56617;
1225  break;
1226  }
1227  case 57940: // Essence of Wintergrasp - Northrend
1228  case 58045: // Essence of Wintergrasp - Wintergrasp
1229  {
1230  if (!player)
1231  return false;
1232 
1233  if (Battlefield* battlefieldWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
1234  return battlefieldWG->IsEnabled() && (player->GetTeamId() == battlefieldWG->GetDefenderTeam()) && !battlefieldWG->IsWarTime();
1235  break;
1236  }
1237  case 74411: // Battleground - Dampening
1238  {
1239  if (!player)
1240  return false;
1241 
1242  if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
1243  return bf->IsWarTime();
1244  break;
1245  }
1246 
1247  }
1248 
1249  return true;
1250 }
virtual uint32 GetData(uint32 dataId) const override
Definition: Battlefield.h:266
int32 auraSpell
Definition: SpellMgr.h:486
Definition: Battlefield.h:27
uint32 questEndStatus
Definition: SpellMgr.h:490
bool CanFlyIn()
Return if we can use mount in battlefield.
Definition: Battlefield.h:335
uint32 raceMask
Definition: SpellMgr.h:487
uint32 areaId
Definition: SpellMgr.h:483
uint32 questStartStatus
Definition: SpellMgr.h:489
Definition: SpellAuraDefines.h:261
uint32 spellId
Definition: SpellMgr.h:482
uint32_t uint32
Definition: Define.h:150
bool IsWarTime() const
Return true if battle is start, false if battle is not started.
Definition: Battlefield.h:241
Definition: Battlefield.h:196
Gender gender
Definition: SpellMgr.h:488
Definition: SharedDefines.h:992
uint32 GetTypeId() const
Definition: Battlefield.h:234
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67
Definition: Battlefield.h:33
uint32 questStart
Definition: SpellMgr.h:484
Definition: Battleground.h:235
Definition: SpellAuraDefines.h:267
Definition: SharedDefines.h:993
Definition: SharedDefines.h:95
uint32 questEnd
Definition: SpellMgr.h:485

+ Here is the call graph for this function:

Member Data Documentation

uint32 SpellArea::areaId
int32 SpellArea::auraSpell
bool SpellArea::autocast
Gender SpellArea::gender
uint32 SpellArea::questEnd
uint32 SpellArea::questEndStatus
uint32 SpellArea::questStart
uint32 SpellArea::questStartStatus
uint32 SpellArea::raceMask
uint32 SpellArea::spellId

The documentation for this struct was generated from the following files: