Updated Copyright year to 2013
[getmangos.git] / src / game / DBCStructure.cpp
blob0d514a5f0d5bea6c8569d46118e48afdf6003cd7
1 /*
2 * Copyright (C) 2005-2013 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "Common.h"
20 #include "DBCStructure.h"
21 #include "DBCStores.h"
22 #include "SharedDefines.h"
24 int32 SpellEntry::CalculateSimpleValue(SpellEffectIndex eff) const
26 if(SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
27 return effectEntry->CalculateSimpleValue();
28 return 0;
31 ClassFamilyMask const& SpellEntry::GetEffectSpellClassMask(SpellEffectIndex eff) const
33 if (SpellEffectEntry const* effectEntry = GetSpellEffectEntry(Id, eff))
34 return effectEntry->EffectSpellClassMask;
36 static ClassFamilyMask const emptyCFM;
38 return emptyCFM;
41 SpellAuraOptionsEntry const* SpellEntry::GetSpellAuraOptions() const
43 return SpellAuraOptionsId ? sSpellAuraOptionsStore.LookupEntry(SpellAuraOptionsId) : NULL;
46 SpellAuraRestrictionsEntry const* SpellEntry::GetSpellAuraRestrictions() const
48 return SpellAuraRestrictionsId ? sSpellAuraRestrictionsStore.LookupEntry(SpellAuraRestrictionsId) : NULL;
51 SpellCastingRequirementsEntry const* SpellEntry::GetSpellCastingRequirements() const
53 return SpellCastingRequirementsId ? sSpellCastingRequirementsStore.LookupEntry(SpellCastingRequirementsId) : NULL;
56 SpellCategoriesEntry const* SpellEntry::GetSpellCategories() const
58 return SpellCategoriesId ? sSpellCategoriesStore.LookupEntry(SpellCategoriesId) : NULL;
61 SpellClassOptionsEntry const* SpellEntry::GetSpellClassOptions() const
63 return SpellClassOptionsId ? sSpellClassOptionsStore.LookupEntry(SpellClassOptionsId) : NULL;
66 SpellCooldownsEntry const* SpellEntry::GetSpellCooldowns() const
68 return SpellCooldownsId ? sSpellCooldownsStore.LookupEntry(SpellCooldownsId) : NULL;
71 SpellEffectEntry const* SpellEntry::GetSpellEffect(SpellEffectIndex eff) const
73 return GetSpellEffectEntry(Id, eff);
76 SpellEquippedItemsEntry const* SpellEntry::GetSpellEquippedItems() const
78 return SpellEquippedItemsId ? sSpellEquippedItemsStore.LookupEntry(SpellEquippedItemsId) : NULL;
81 SpellInterruptsEntry const* SpellEntry::GetSpellInterrupts() const
83 return SpellInterruptsId ? sSpellInterruptsStore.LookupEntry(SpellInterruptsId) : NULL;
86 SpellLevelsEntry const* SpellEntry::GetSpellLevels() const
88 return SpellLevelsId ? sSpellLevelsStore.LookupEntry(SpellLevelsId) : NULL;
91 SpellPowerEntry const* SpellEntry::GetSpellPower() const
93 return SpellPowerId ? sSpellPowerStore.LookupEntry(SpellPowerId) : NULL;
96 SpellReagentsEntry const* SpellEntry::GetSpellReagents() const
98 return SpellReagentsId ? sSpellReagentsStore.LookupEntry(SpellReagentsId) : NULL;
101 SpellScalingEntry const* SpellEntry::GetSpellScaling() const
103 return SpellScalingId ? sSpellScalingStore.LookupEntry(SpellScalingId) : NULL;
106 SpellShapeshiftEntry const* SpellEntry::GetSpellShapeshift() const
108 return SpellShapeshiftId ? sSpellShapeshiftStore.LookupEntry(SpellShapeshiftId) : NULL;
111 SpellTargetRestrictionsEntry const* SpellEntry::GetSpellTargetRestrictions() const
113 return SpellTargetRestrictionsId ? sSpellTargetRestrictionsStore.LookupEntry(SpellTargetRestrictionsId) : NULL;
116 SpellTotemsEntry const* SpellEntry::GetSpellTotems() const
118 return SpellTotemsId ? sSpellTotemsStore.LookupEntry(SpellTotemsId) : NULL;
121 uint32 SpellEntry::GetManaCost() const
123 SpellPowerEntry const* power = GetSpellPower();
124 return power ? power->manaCost : 0;
127 uint32 SpellEntry::GetPreventionType() const
129 SpellCategoriesEntry const* cat = GetSpellCategories();
130 return cat ? cat->PreventionType : 0;
133 uint32 SpellEntry::GetCategory() const
135 SpellCategoriesEntry const* cat = GetSpellCategories();
136 return cat ? cat->Category : 0;
139 uint32 SpellEntry::GetStartRecoveryTime() const
141 SpellCooldownsEntry const* cd = GetSpellCooldowns();
142 return cd ? cd->StartRecoveryTime : 0;
145 uint32 SpellEntry::GetMechanic() const
147 SpellCategoriesEntry const* cat = GetSpellCategories();
148 return cat ? cat->Mechanic : 0;
151 uint32 SpellEntry::GetRecoveryTime() const
153 SpellCooldownsEntry const* cd = GetSpellCooldowns();
154 return cd ? cd->RecoveryTime : 0;
157 uint32 SpellEntry::GetCategoryRecoveryTime() const
159 SpellCooldownsEntry const* cd = GetSpellCooldowns();
160 return cd ? cd->CategoryRecoveryTime : 0;
163 uint32 SpellEntry::GetStartRecoveryCategory() const
165 SpellCategoriesEntry const* cat = GetSpellCategories();
166 return cat ? cat->StartRecoveryCategory : 0;
169 uint32 SpellEntry::GetSpellLevel() const
171 SpellLevelsEntry const* levels = GetSpellLevels();
172 return levels ? levels->spellLevel : 0;
175 int32 SpellEntry::GetEquippedItemClass() const
177 SpellEquippedItemsEntry const* items = GetSpellEquippedItems();
178 return items ? items->EquippedItemClass : -1;
181 SpellFamily SpellEntry::GetSpellFamilyName() const
183 SpellClassOptionsEntry const* classOpt = GetSpellClassOptions();
184 return classOpt ? SpellFamily(classOpt->SpellFamilyName) : SPELLFAMILY_GENERIC;
187 uint32 SpellEntry::GetDmgClass() const
189 SpellCategoriesEntry const* cat = GetSpellCategories();
190 return cat ? cat->DmgClass : 0;
193 uint32 SpellEntry::GetDispel() const
195 SpellCategoriesEntry const* cat = GetSpellCategories();
196 return cat ? cat->Dispel : 0;
199 uint32 SpellEntry::GetMaxAffectedTargets() const
201 SpellTargetRestrictionsEntry const* target = GetSpellTargetRestrictions();
202 return target ? target->MaxAffectedTargets : 0;
205 uint32 SpellEntry::GetStackAmount() const
207 SpellAuraOptionsEntry const* aura = GetSpellAuraOptions();
208 return aura ? aura->StackAmount : 0;
211 uint32 SpellEntry::GetManaCostPercentage() const
213 SpellPowerEntry const* power = GetSpellPower();
214 return power ? power->ManaCostPercentage : 0;
217 uint32 SpellEntry::GetProcCharges() const
219 SpellAuraOptionsEntry const* aura = GetSpellAuraOptions();
220 return aura ? aura->procCharges : 0;
223 uint32 SpellEntry::GetProcChance() const
225 SpellAuraOptionsEntry const* aura = GetSpellAuraOptions();
226 return aura ? aura->procChance : 0;
229 uint32 SpellEntry::GetMaxLevel() const
231 SpellLevelsEntry const* levels = GetSpellLevels();
232 return levels ? levels->maxLevel : 0;
235 uint32 SpellEntry::GetTargetAuraState() const
237 SpellAuraRestrictionsEntry const* aura = GetSpellAuraRestrictions();
238 return aura ? aura->TargetAuraState : 0;
241 uint32 SpellEntry::GetManaPerSecond() const
243 SpellPowerEntry const* power = GetSpellPower();
244 return power ? power->manaPerSecond : 0;
247 uint32 SpellEntry::GetRequiresSpellFocus() const
249 SpellCastingRequirementsEntry const* castReq = GetSpellCastingRequirements();
250 return castReq ? castReq->RequiresSpellFocus : 0;
253 uint32 SpellEntry::GetSpellEffectIdByIndex(SpellEffectIndex index) const
255 SpellEffectEntry const* effect = GetSpellEffect(index);
256 return effect ? effect->Effect : SPELL_EFFECT_NONE;
259 uint32 SpellEntry::GetAuraInterruptFlags() const
261 SpellInterruptsEntry const* interrupt = GetSpellInterrupts();
262 return interrupt ? interrupt->AuraInterruptFlags : 0;
265 uint32 SpellEntry::GetEffectImplicitTargetAByIndex(SpellEffectIndex index) const
267 SpellEffectEntry const* effect = GetSpellEffect(index);
268 return effect ? effect->EffectImplicitTargetA : TARGET_NONE;
271 int32 SpellEntry::GetAreaGroupId() const
273 SpellCastingRequirementsEntry const* castReq = GetSpellCastingRequirements();
274 return castReq ? castReq->AreaGroupId : -1;
277 uint32 SpellEntry::GetFacingCasterFlags() const
279 SpellCastingRequirementsEntry const* castReq = GetSpellCastingRequirements();
280 return castReq ? castReq->FacingCasterFlags : -1;
283 uint32 SpellEntry::GetBaseLevel() const
285 SpellLevelsEntry const* levels = GetSpellLevels();
286 return levels ? levels->baseLevel : 0;
289 uint32 SpellEntry::GetInterruptFlags() const
291 SpellInterruptsEntry const* interrupt = GetSpellInterrupts();
292 return interrupt ? interrupt->InterruptFlags : 0;
295 uint32 SpellEntry::GetTargetCreatureType() const
297 SpellTargetRestrictionsEntry const* target = GetSpellTargetRestrictions();
298 return target ? target->TargetCreatureType : 0;
301 int32 SpellEntry::GetEffectMiscValue(SpellEffectIndex index) const
303 SpellEffectEntry const* effect = GetSpellEffect(index);
304 return effect ? effect->EffectMiscValue : 0;
307 uint32 SpellEntry::GetStances() const
309 SpellShapeshiftEntry const* ss = GetSpellShapeshift();
310 return ss ? ss->Stances : 0;
313 uint32 SpellEntry::GetStancesNot() const
315 SpellShapeshiftEntry const* ss = GetSpellShapeshift();
316 return ss ? ss->StancesNot : 0;
319 uint32 SpellEntry::GetProcFlags() const
321 SpellAuraOptionsEntry const* aura = GetSpellAuraOptions();
322 return aura ? aura->procFlags : 0;
325 uint32 SpellEntry::GetChannelInterruptFlags() const
327 SpellInterruptsEntry const* interrupt = GetSpellInterrupts();
328 return interrupt ? interrupt->ChannelInterruptFlags : 0;
331 uint32 SpellEntry::GetManaCostPerLevel() const
333 SpellPowerEntry const* power = GetSpellPower();
334 return power ? power->manaCostPerlevel : 0;
337 uint32 SpellEntry::GetCasterAuraState() const
339 SpellAuraRestrictionsEntry const* aura = GetSpellAuraRestrictions();
340 return aura ? aura->CasterAuraState : 0;
343 uint32 SpellEntry::GetTargets() const
345 SpellTargetRestrictionsEntry const* target = GetSpellTargetRestrictions();
346 return target ? target->Targets : 0;
349 uint32 SpellEntry::GetEffectApplyAuraNameByIndex(SpellEffectIndex index) const
351 SpellEffectEntry const* effect = GetSpellEffect(index);
352 return effect ? effect->EffectApplyAuraName : 0;