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

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