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
1136{
1137 if (gender != GENDER_NONE) // not in expected gender
1138 if (!player || gender != player->getGender())
1139 return false;
1140
1141 if (raceMask) // not in expected race
1142 if (!player || !(raceMask & player->getRaceMask()))
1143 return false;
1144
1145 if (areaId) // not in expected zone
1146 if (newZone != areaId && newArea != areaId)
1147 return false;
1148
1149 if (questStart) // not in expected required quest state
1150 if (!player || (((1 << player->GetQuestStatus(questStart)) & questStartStatus) == 0))
1151 return false;
1152
1153 if (questEnd) // not in expected forbidden quest state
1154 if (!player || (((1 << player->GetQuestStatus(questEnd)) & questEndStatus) == 0))
1155 return false;
1156
1157 if (auraSpell) // not have expected aura
1158 if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
1159 return false;
1160
1161 // Extra conditions -- leaving the possibility add extra conditions...
1162 switch (spellId)
1163 {
1164 case 58600: // No fly Zone - Dalaran
1165 {
1166 if (!player)
1167 return false;
1168
1169 AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(player->GetAreaId());
1170 if (!(pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE))
1171 return false;
1172 if (!player->HasIncreaseMountedFlightSpeedAura() && !player->HasFlyAura())
1173 return false;
1174 // Xinef: Underbelly elixir
1175 if (player->GetPositionZ() < 637.0f && player->HasTransformAura())
1176 return false;
1177 break;
1178 }
1179 case 58730: // No fly Zone - Wintergrasp
1180 {
1181 if (!player)
1182 return false;
1183
1184 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1185 if (!Bf || Bf->CanFlyIn() || (!player->HasIncreaseMountedFlightSpeedAura() && !player->HasFlyAura()))
1186 return false;
1187 break;
1188 }
1189 // xinef: northrend flying mounts
1190 // xinef: NE wisp and spectral gryphon
1191 case 55164:
1192 case 55173:
1193 {
1194 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1195 return !Bf || Bf->CanFlyIn();
1196 }
1197 case 57940: // Essence of Wintergrasp OUTSIDE
1198 case 58045: // Essence of Wintergrasp INSIDE
1199 {
1200 if (!player)
1201 return false;
1202
1203 if (sWorld->getIntConfig(CONFIG_WINTERGRASP_ENABLE) != 1)
1204 return false;
1205
1206 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
1207 if (!Bf || player->GetTeamId() != Bf->GetDefenderTeam() || Bf->IsWarTime())
1208 return false;
1209 break;
1210 }
1211 case 74411: // Battleground - Dampening
1212 {
1213 if (!player)
1214 return false;
1215
1216 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
1217 return bf->IsWarTime();
1218 break;
1219 }
1220 case 68719: // Oil Refinery - Isle of Conquest.
1221 case 68720: // Quarry - Isle of Conquest.
1222 {
1223 if (!player)
1224 return false;
1225
1226 Battleground* bg = player->GetBattleground();
1227 if (!bg || bg->GetBgTypeID(true) != BATTLEGROUND_IC)
1228 return false;
1229
1230 uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
1231 uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
1232
1233 return bg->ToBattlegroundIC()->GetNodeState(nodeType) == nodeState;
1234 }
1235 case 56618: // Horde Controls Factory Phase Shift
1236 case 56617: // Alliance Controls Factory Phase Shift
1237 {
1238 if (!player)
1239 return false;
1240
1241 Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1242
1243 if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
1244 return false;
1245
1246 // team that controls the workshop in the specified area
1247 uint32 team = bf->GetData(newArea);
1248
1249 if (team == TEAM_HORDE)
1250 return spellId == 56618;
1251 else if (team == TEAM_ALLIANCE)
1252 return spellId == 56617;
1253 else
1254 return false;
1255 break;
1256 }
1257 // Hellscream's Warsong
1258 case 73816:
1259 case 73818:
1260 case 73819:
1261 case 73820:
1262 case 73821:
1263 case 73822:
1264 // Strength of Wrynn
1265 case 73762:
1266 case 73824:
1267 case 73825:
1268 case 73826:
1269 case 73827:
1270 case 73828:
1271 if (player)
1272 if (InstanceScript* s = const_cast<Player*>(player)->GetInstanceScript())
1273 return s->GetData(251 /*DATA_BUFF_AVAILABLE*/) != 0;
1274 return false;
1275 break;
1276 }
1277
1278 return true;
1279}
#define sBattlefieldMgr
Definition BattlefieldMgr.h:77
@ BATTLEFIELD_WG
Definition Battlefield.h:29
@ BATTLEFIELD_BATTLEID_WG
Definition Battlefield.h:35
@ 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:3758
@ TEAM_ALLIANCE
Definition SharedDefines.h:771
@ TEAM_HORDE
Definition SharedDefines.h:772
@ CONFIG_WINTERGRASP_ENABLE
Definition WorldConfig.h:281
Definition Battlefield.h:205
uint32 GetData(uint32 dataId) const override
Definition Battlefield.h:271
TeamId GetDefenderTeam()
Definition Battlefield.h:276
bool IsWarTime()
Return true if battle is start, false if battle is not started.
Definition Battlefield.h:248
uint32 GetTypeId()
Definition Battlefield.h:242
bool CanFlyIn()
Return if we can use mount in battlefield.
Definition Battlefield.h:342
uint32 GetNodeState(uint8 nodeType) const
Definition BattlegroundIC.h:920
Definition Battleground.h:294
BattlegroundIC * ToBattlegroundIC()
Definition Battleground.h:603
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition Battleground.h:320
Definition InstanceScript.h:143
Definition Player.h:1071
#define sWorld
Definition World.h:316
Definition DBCStructure.h:519
uint32 flags
Definition DBCStructure.h:524
uint32 questEnd
Definition SpellMgr.h:523
uint32 raceMask
Definition SpellMgr.h:525
uint32 questStartStatus
Definition SpellMgr.h:527
uint32 spellId
Definition SpellMgr.h:520
uint32 questEndStatus
Definition SpellMgr.h:528
int32 auraSpell
Definition SpellMgr.h:524
Gender gender
Definition SpellMgr.h:526
uint32 areaId
Definition SpellMgr.h:521
uint32 questStart
Definition SpellMgr.h:522

References AREA_FLAG_NO_FLY_ZONE, areaId, auraSpell, BATTLEFIELD_BATTLEID_WG, BATTLEFIELD_WG, BATTLEGROUND_IC, Battlefield::CanFlyIn(), CONFIG_WINTERGRASP_ENABLE, 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: