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
1078{
1079 if (gender != GENDER_NONE) // not in expected gender
1080 if (!player || gender != player->getGender())
1081 return false;
1082
1083 if (raceMask) // not in expected race
1084 if (!player || !(raceMask & player->getRaceMask()))
1085 return false;
1086
1087 if (areaId) // not in expected zone
1088 if (newZone != areaId && newArea != areaId)
1089 return false;
1090
1091 if (questStart) // not in expected required quest state
1092 if (!player || (((1 << player->GetQuestStatus(questStart)) & questStartStatus) == 0))
1093 return false;
1094
1095 if (questEnd) // not in expected forbidden quest state
1096 if (!player || (((1 << player->GetQuestStatus(questEnd)) & questEndStatus) == 0))
1097 return false;
1098
1099 if (auraSpell) // not have expected aura
1100 if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell)))
1101 return false;
1102
1103 // Extra conditions -- leaving the possibility add extra conditions...
1104 switch (spellId)
1105 {
1106 case 58600: // No fly Zone - Dalaran
1107 {
1108 if (!player)
1109 return false;
1110
1111 AreaTableEntry const* pArea = sAreaTableStore.LookupEntry(player->GetAreaId());
1112 if (!(pArea && pArea->flags & AREA_FLAG_NO_FLY_ZONE))
1113 return false;
1114 if (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY))
1115 return false;
1116 // Xinef: Underbelly elixir
1117 if (player->GetPositionZ() < 637.0f && player->HasAuraType(SPELL_AURA_TRANSFORM))
1118 return false;
1119 break;
1120 }
1121 case 58730: // No fly Zone - Wintergrasp
1122 {
1123 if (!player)
1124 return false;
1125
1126 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1127 if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
1128 return false;
1129 break;
1130 }
1131 // xinef: northrend flying mounts
1132 // xinef: NE wisp and spectral gryphon
1133 case 55164:
1134 case 55173:
1135 {
1136 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1137 return !Bf || Bf->CanFlyIn();
1138 }
1139 case 57940: // Essence of Wintergrasp OUTSIDE
1140 case 58045: // Essence of Wintergrasp INSIDE
1141 {
1142 if (!player)
1143 return false;
1144
1145 if (sWorld->getIntConfig(CONFIG_WINTERGRASP_ENABLE) != 1)
1146 return false;
1147
1148 Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
1149 if (!Bf || player->GetTeamId() != Bf->GetDefenderTeam() || Bf->IsWarTime())
1150 return false;
1151 break;
1152 }
1153 case 74411: // Battleground - Dampening
1154 {
1155 if (!player)
1156 return false;
1157
1158 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
1159 return bf->IsWarTime();
1160 break;
1161 }
1162 case 68719: // Oil Refinery - Isle of Conquest.
1163 case 68720: // Quarry - Isle of Conquest.
1164 {
1165 if (!player)
1166 return false;
1167
1168 Battleground* bg = player->GetBattleground();
1169 if (!bg || bg->GetBgTypeID(true) != BATTLEGROUND_IC)
1170 return false;
1171
1172 uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY;
1173 uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H;
1174
1175 return bg->ToBattlegroundIC()->GetNodeState(nodeType) == nodeState;
1176 }
1177 case 56618: // Horde Controls Factory Phase Shift
1178 case 56617: // Alliance Controls Factory Phase Shift
1179 {
1180 if (!player)
1181 return false;
1182
1183 Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
1184
1185 if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
1186 return false;
1187
1188 // team that controls the workshop in the specified area
1189 uint32 team = bf->GetData(newArea);
1190
1191 if (team == TEAM_HORDE)
1192 return spellId == 56618;
1193 else if (team == TEAM_ALLIANCE)
1194 return spellId == 56617;
1195 else
1196 return false;
1197 break;
1198 }
1199 // Hellscream's Warsong
1200 case 73816:
1201 case 73818:
1202 case 73819:
1203 case 73820:
1204 case 73821:
1205 case 73822:
1206 // Strength of Wrynn
1207 case 73762:
1208 case 73824:
1209 case 73825:
1210 case 73826:
1211 case 73827:
1212 case 73828:
1213 if (player)
1214 if (InstanceScript* s = const_cast<Player*>(player)->GetInstanceScript())
1215 return s->GetData(251 /*DATA_BUFF_AVAILABLE*/) != 0;
1216 return false;
1217 break;
1218 }
1219
1220 return true;
1221}
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
@ CONFIG_WINTERGRASP_ENABLE
Definition: IWorld.h:321
@ BATTLEFIELD_WG
Definition: Battlefield.h:29
@ BATTLEFIELD_BATTLEID_WG
Definition: Battlefield.h:35
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ NODE_TYPE_REFINERY
Definition: BattlegroundIC.h:820
@ NODE_TYPE_QUARRY
Definition: BattlegroundIC.h:821
@ NODE_STATE_CONTROLLED_A
Definition: BattlegroundIC.h:838
@ NODE_STATE_CONTROLLED_H
Definition: BattlegroundIC.h:839
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
@ GENDER_NONE
Definition: SharedDefines.h:63
@ BATTLEGROUND_IC
Definition: SharedDefines.h:3492
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
@ AREA_FLAG_NO_FLY_ZONE
Definition: DBCEnums.h:262
#define sWorld
Definition: World.h:443
Definition: Battlefield.h:204
uint32 GetData(uint32 dataId) const override
Definition: Battlefield.h:270
TeamId GetDefenderTeam()
Definition: Battlefield.h:275
bool IsWarTime()
Return true if battle is start, false if battle is not started.
Definition: Battlefield.h:247
uint32 GetTypeId()
Definition: Battlefield.h:241
bool CanFlyIn()
Return if we can use mount in battlefield.
Definition: Battlefield.h:340
Definition: Battleground.h:303
BattlegroundIC * ToBattlegroundIC()
Definition: Battleground.h:614
BattlegroundTypeId GetBgTypeID(bool GetRandom=false) const
Definition: Battleground.h:329
uint32 GetNodeState(uint8 nodeType) const
Definition: BattlegroundIC.h:981
Definition: Player.h:1064
Definition: InstanceScript.h:142
uint32 questEnd
Definition: SpellMgr.h:531
uint32 raceMask
Definition: SpellMgr.h:533
uint32 questStartStatus
Definition: SpellMgr.h:535
uint32 spellId
Definition: SpellMgr.h:528
uint32 questEndStatus
Definition: SpellMgr.h:536
int32 auraSpell
Definition: SpellMgr.h:532
Gender gender
Definition: SpellMgr.h:534
uint32 areaId
Definition: SpellMgr.h:529
uint32 questStart
Definition: SpellMgr.h:530
Definition: DBCStructure.h:518
uint32 flags
Definition: DBCStructure.h:523

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::HasAuraType(), Battlefield::IsWarTime(), NODE_STATE_CONTROLLED_A, NODE_STATE_CONTROLLED_H, NODE_TYPE_QUARRY, NODE_TYPE_REFINERY, questEnd, questEndStatus, questStart, questStartStatus, raceMask, sAreaTableStore, sBattlefieldMgr, SPELL_AURA_FLY, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_TRANSFORM, 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