AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
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
 

Detailed Description

Member Function Documentation

◆ IsFitToRequirements()

bool SpellArea::IsFitToRequirements ( Player const *  player,
uint32  newZone,
uint32  newArea 
) const
1063{
1064 if (gender != GENDER_NONE) // not in expected gender
1065 if (!player || gender != player->getGender())
1066 return false;
1067
1068 if (raceMask) // not in expected race
1069 if (!player || !(raceMask & player->getRaceMask()))
1070 return false;
1071
1072 if (areaId) // not in expected zone
1073 if (newZone != areaId && newArea != areaId)
1074 return false;
1075
1076 if (questStart) // not in expected required quest state
1077 if (!player || (((1 << player->GetQuestStatus(questStart)) & questStartStatus) == 0))
1078 return false;
1079
1080 if (questEnd) // not in expected forbidden quest state
1081 if (!player || (((1 << player->GetQuestStatus(questEnd)) & questEndStatus) == 0))
1082 return false;
1083
1084 if (auraSpell) // not have expected aura
1085 if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
1086 return false;
1087
1088 // Extra conditions -- leaving the possibility add extra conditions...
1089 switch (spellId)
1090 {
1091 case 58600: // No fly Zone - Dalaran
1092 {
1093 if (!player)
1094 return false;
1095
1096 AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(player->GetAreaId());
1097 if (!(pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE))
1098 return false;
1099 if (!player->HasIncreaseMountedFlightSpeedAura() && !player->HasFlyAura())
1100 return false;
1101 // Xinef: Underbelly elixir
1102 if (player->GetPositionZ() < 637.0f && player->HasTransformAura())
1103 return false;
1104 break;
1105 }
1106 case 58730: // No fly Zone - Wintergrasp
1107 {
1108 if (!player)
1109 return false;
1110
1111 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1112 if (!Bf || Bf->CanFlyIn() || (!player->HasIncreaseMountedFlightSpeedAura() && !player->HasFlyAura()))
1113 return false;
1114 break;
1115 }
1116 // xinef: northrend flying mounts
1117 // xinef: NE wisp and spectral gryphon
1118 case 55164:
1119 case 55173:
1120 {
1121 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1122 return !Bf || Bf->CanFlyIn();
1123 }
1124 case 57940: // Essence of Wintergrasp OUTSIDE
1125 case 58045: // Essence of Wintergrasp INSIDE
1126 {
1127 if (!player)
1128 return false;
1129
1130 if (sWorld->getIntConfig(CONFIG_WINTERGRASP_ENABLE) != 1)
1131 return false;
1132
1133 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
1134 if (!Bf || Bf->IsWarTime())
1135 return false;
1136 if (!sWorld->getBoolConfig(CONFIG_WINTERGRASP_ESSENCE_BOTH_FACTIONS) && player->GetTeamId() != Bf->GetDefenderTeam())
1137 return false;
1138 break;
1139 }
1140 case 74411: // Battleground - Dampening
1141 {
1142 if (!player)
1143 return false;
1144
1145 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
1146 return bf->IsWarTime();
1147 break;
1148 }
1149 case 68719: // Oil Refinery - Isle of Conquest.
1150 case 68720: // Quarry - Isle of Conquest.
1151 {
1152 if (!player)
1153 return false;
1154
1155 Battleground* bg = player->GetBattleground();
1156 if (!bg || bg->GetBgTypeID(true) != BATTLEGROUND_IC)
1157 return false;
1158
1159 uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
1160 uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
1161
1162 return bg->ToBattlegroundIC()->GetNodeState(nodeType) == nodeState;
1163 }
1164 case 56618: // Horde Controls Factory Phase Shift
1165 case 56617: // Alliance Controls Factory Phase Shift
1166 {
1167 if (!player)
1168 return false;
1169
1170 Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1171
1172 if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
1173 return false;
1174
1175 // team that controls the workshop in the specified area
1176 uint32 team = bf->GetData(newArea);
1177
1178 if (team == TEAM_HORDE)
1179 return spellId == 56618;
1180 else if (team == TEAM_ALLIANCE)
1181 return spellId == 56617;
1182 else
1183 return false;
1184 break;
1185 }
1186 // Hellscream's Warsong
1187 case 73816:
1188 case 73818:
1189 case 73819:
1190 case 73820:
1191 case 73821:
1192 case 73822:
1193 // Strength of Wrynn
1194 case 73762:
1195 case 73824:
1196 case 73825:
1197 case 73826:
1198 case 73827:
1199 case 73828:
1200 if (player)
1201 if (InstanceScript* s = const_cast<Player*>(player)->GetInstanceScript())
1202 return s->GetData(251 /*DATA_BUFF_AVAILABLE*/) != 0;
1203 return false;
1204 break;
1205 }
1206
1207 return true;
1208}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:79
@ BATTLEFIELD_WG
Definition Battlefield.h:30
@ BATTLEFIELD_BATTLEID_WG
Definition Battlefield.h:36
@ NODE_TYPE_REFINERY
Definition BattlegroundIC.h:759
@ NODE_TYPE_QUARRY
Definition BattlegroundIC.h:760
@ NODE_STATE_CONTROLLED_A
Definition BattlegroundIC.h:777
@ NODE_STATE_CONTROLLED_H
Definition BattlegroundIC.h:778
@ AREA_FLAG_NO_FLY_ZONE
Definition DBCEnums.h:262
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
@ GENDER_NONE
Definition SharedDefines.h:63
@ BATTLEGROUND_IC
Definition SharedDefines.h:3748
@ TEAM_ALLIANCE
Definition SharedDefines.h:748
@ TEAM_HORDE
Definition SharedDefines.h:749
@ CONFIG_WINTERGRASP_ENABLE
Definition WorldConfig.h:284
@ CONFIG_WINTERGRASP_ESSENCE_BOTH_FACTIONS
Definition WorldConfig.h:334
Definition Battlefield.h:196
uint32 GetData(uint32 dataId) const override
Definition Battlefield.h:262
bool IsWarTime() const
Return true if battle is started, false if battle is not started.
Definition Battlefield.h:239
TeamId GetDefenderTeam() const
Definition Battlefield.h:267
uint32 GetTypeId() const
Definition Battlefield.h:233
bool CanFlyIn() const
Return if we can use mount in battlefield.
Definition Battlefield.h:336
uint32 GetNodeState(uint8 nodeType) const
Definition BattlegroundIC.h:920
Definition Battleground.h:304
BattlegroundIC * ToBattlegroundIC()
Definition Battleground.h:613
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition Battleground.h:330
Definition InstanceScript.h:143
Definition Player.h:1084
#define sWorld
Definition World.h:317
Definition DBCStructure.h:519
uint32 flags
Definition DBCStructure.h:524
uint32 questEnd
Definition SpellMgr.h:528
uint32 raceMask
Definition SpellMgr.h:530
uint32 questStartStatus
Definition SpellMgr.h:532
uint32 spellId
Definition SpellMgr.h:525
uint32 questEndStatus
Definition SpellMgr.h:533
int32 auraSpell
Definition SpellMgr.h:529
Gender gender
Definition SpellMgr.h:531
uint32 areaId
Definition SpellMgr.h:526
uint32 questStart
Definition SpellMgr.h:527

References AREA_FLAG_NO_FLY_ZONE, areaId, auraSpell, BATTLEFIELD_BATTLEID_WG, BATTLEFIELD_WG, BATTLEGROUND_IC, Battlefield::CanFlyIn(), CONFIG_WINTERGRASP_ENABLE, CONFIG_WINTERGRASP_ESSENCE_BOTH_FACTIONS, AreaTableEntry::flags, gender, GENDER_NONE, WorldObject::GetAreaId(), Player::GetBattleground(), Battleground::GetBgTypeID(), Battlefield::GetData(), Battlefield::GetDefenderTeam(), Unit::getGender(), BattlegroundIC::GetNodeState(), Position::GetPositionZ(), Player::GetQuestStatus(), Unit::getRaceMask(), Player::GetTeamId(), Battlefield::GetTypeId(), WorldObject::GetZoneId(), Unit::HasAura(), Unit::HasFlyAura(), Unit::HasIncreaseMountedFlightSpeedAura(), Unit::HasTransformAura(), Battlefield::IsWarTime(), NODE_STATE_CONTROLLED_A, NODE_STATE_CONTROLLED_H, NODE_TYPE_QUARRY, NODE_TYPE_REFINERY, questEnd, questEndStatus, questStart, questStartStatus, raceMask, sAreaTableStore, sBattlefieldMgr, spellId, sWorld, TEAM_ALLIANCE, TEAM_HORDE, and Battleground::ToBattlegroundIC().

Member Data Documentation

◆ areaId

uint32 SpellArea::areaId

Referenced by IsFitToRequirements().

◆ auraSpell

int32 SpellArea::auraSpell

Referenced by IsFitToRequirements().

◆ autocast

bool SpellArea::autocast

◆ gender

Gender SpellArea::gender

Referenced by IsFitToRequirements().

◆ questEnd

uint32 SpellArea::questEnd

Referenced by IsFitToRequirements().

◆ questEndStatus

uint32 SpellArea::questEndStatus

Referenced by IsFitToRequirements().

◆ questStart

uint32 SpellArea::questStart

Referenced by IsFitToRequirements().

◆ questStartStatus

uint32 SpellArea::questStartStatus

Referenced by IsFitToRequirements().

◆ raceMask

uint32 SpellArea::raceMask

Referenced by IsFitToRequirements().

◆ spellId

uint32 SpellArea::spellId

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