Updated DB2 structs

This commit is contained in:
hondacrx
2018-02-26 13:13:54 -05:00
parent 0a3dfaba37
commit 82dca6de94
61 changed files with 2639 additions and 2517 deletions
+7 -14
View File
@@ -6108,30 +6108,23 @@ namespace Game.Spells
break;
case SpellEffectName.Disenchant:
{
if (m_targets.GetItemTarget() == null)
Item item = m_targets.GetItemTarget();
if (!item)
return SpellCastResult.CantBeDisenchanted;
// prevent disenchanting in trade slot
if (m_targets.GetItemTarget().GetOwnerGUID() != m_caster.GetGUID())
if (item.GetOwnerGUID() != m_caster.GetGUID())
return SpellCastResult.CantBeDisenchanted;
ItemTemplate itemProto = m_targets.GetItemTarget().GetTemplate();
ItemTemplate itemProto = item.GetTemplate();
if (itemProto == null)
return SpellCastResult.CantBeDisenchanted;
int item_quality = (int)itemProto.GetQuality();
// 2.0.x addon: Check player enchanting level against the item disenchanting requirements
uint item_disenchantskilllevel = itemProto.RequiredDisenchantSkill;
if (item_disenchantskilllevel == Convert.ToUInt32(-1))
ItemDisenchantLootRecord itemDisenchantLoot = item.GetDisenchantLoot(m_caster.ToPlayer());
if (itemDisenchantLoot == null)
return SpellCastResult.CantBeDisenchanted;
if (item_disenchantskilllevel > player.GetSkillValue(SkillType.Enchanting))
if (itemDisenchantLoot.RequiredDisenchantSkill > player.GetSkillValue(SkillType.Enchanting))
return SpellCastResult.LowCastlevel;
if (item_quality > 4 || item_quality < 2)
return SpellCastResult.CantBeDisenchanted;
if (itemProto.GetClass() != ItemClass.Weapon && itemProto.GetClass() != ItemClass.Armor)
return SpellCastResult.CantBeDisenchanted;
if (itemProto.DisenchantID == 0)
return SpellCastResult.CantBeDisenchanted;
break;
}
case SpellEffectName.Prospecting:
-3
View File
@@ -3740,9 +3740,6 @@ namespace Game.Spells
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
return;
if (itemTarget == null || itemTarget.GetTemplate().DisenchantID == 0)
return;
Player caster = m_caster.ToPlayer();
if (caster != null)
{
+6 -9
View File
@@ -30,13 +30,12 @@ namespace Game.Spells
{
public class SpellInfo
{
public SpellInfo(SpellInfoLoadHelper data, Dictionary<uint, SpellEffectRecord[]> effectsMap, MultiMap<uint, SpellXSpellVisualRecord> visuals, Dictionary<uint, SpellEffectScalingRecord> effectScaling)
public SpellInfo(SpellInfoLoadHelper data, Dictionary<uint, SpellEffectRecord[]> effectsMap, MultiMap<uint, SpellXSpellVisualRecord> visuals)
{
Id = data.Entry.Id;
_effects = new Dictionary<uint, SpellEffectInfo[]>();
// SpellDifficultyEntry
if (effectsMap != null)
{
foreach (var pair in effectsMap)
@@ -50,8 +49,7 @@ namespace Game.Spells
if (effect == null)
continue;
var scaling = effectScaling.LookupByKey(effect.Id);
_effects[pair.Key][effect.EffectIndex] = new SpellEffectInfo(scaling, this, effect.EffectIndex, effect);
_effects[pair.Key][effect.EffectIndex] = new SpellEffectInfo(this, effect.EffectIndex, effect);
}
}
}
@@ -3671,7 +3669,7 @@ namespace Game.Spells
public class SpellEffectInfo
{
public SpellEffectInfo(SpellEffectScalingRecord spellEffectScaling, SpellInfo spellInfo, uint effIndex, SpellEffectRecord _effect)
public SpellEffectInfo(SpellInfo spellInfo, uint effIndex, SpellEffectRecord _effect)
{
_spellInfo = spellInfo;
EffectIndex = effIndex;
@@ -3706,14 +3704,13 @@ namespace Game.Spells
TriggerSpell = _effect.EffectTriggerSpell;
SpellClassMask = _effect.EffectSpellClassMask;
BonusCoefficientFromAP = _effect.BonusCoefficientFromAP;
Scaling.Coefficient = _effect.Coefficient;
Scaling.Variance = _effect.Variance;
Scaling.ResourceCoefficient = _effect.ResourceCoefficient;
}
ImplicitTargetConditions = null;
Scaling.Coefficient = spellEffectScaling != null ? spellEffectScaling.Coefficient : 0.0f;
Scaling.Variance = spellEffectScaling != null ? spellEffectScaling.Variance : 0.0f;
Scaling.ResourceCoefficient = spellEffectScaling != null ? spellEffectScaling.ResourceCoefficient : 0.0f;
_immunityInfo = new ImmunityInfo();
}
+5 -8
View File
@@ -1935,7 +1935,6 @@ namespace Game.Entities
Dictionary<uint, Dictionary<uint, SpellEffectRecord[]>> effectsBySpell = new Dictionary<uint, Dictionary<uint, SpellEffectRecord[]>>();
Dictionary<uint, MultiMap<uint, SpellXSpellVisualRecord>> visualsBySpell = new Dictionary<uint, MultiMap<uint, SpellXSpellVisualRecord>>();
Dictionary<uint, SpellEffectScalingRecord> spellEffectScallingByEffectId = new Dictionary<uint, SpellEffectScalingRecord>();
foreach (var effect in CliDB.SpellEffectStorage.Values)
{
/*Contract.Assert(effect.EffectIndex < MAX_SPELL_EFFECTS, "MAX_SPELL_EFFECTS must be at least {0}", effect.EffectIndex);
@@ -1993,11 +1992,6 @@ namespace Game.Entities
}
CliDB.SpellCooldownsStorage.Clear();
foreach (SpellEffectScalingRecord spellEffectScaling in CliDB.SpellEffectScalingStorage.Values)
spellEffectScallingByEffectId[spellEffectScaling.SpellEffectID] = spellEffectScaling;
CliDB.SpellEffectScalingStorage.Clear();
foreach (SpellEquippedItemsRecord equippedItems in CliDB.SpellEquippedItemsStorage.Values)
loadData[equippedItems.SpellID].EquippedItems = equippedItems;
@@ -2016,6 +2010,10 @@ namespace Game.Entities
loadData[levels.SpellID].Levels = levels;
}
foreach (SpellMiscRecord misc in CliDB.SpellMiscStorage.Values)
if (misc.DifficultyID == 0)
loadData[misc.SpellID].Misc = misc;
foreach (SpellReagentsRecord reagents in CliDB.SpellReagentsStorage.Values)
loadData[reagents.SpellID].Reagents = reagents;
@@ -2054,8 +2052,7 @@ namespace Game.Entities
foreach (var spellEntry in CliDB.SpellStorage.Values)
{
loadData[spellEntry.Id].Entry = spellEntry;
loadData[spellEntry.Id].Misc = CliDB.SpellMiscStorage.LookupByKey(spellEntry.MiscID);
mSpellInfoMap[spellEntry.Id] = new SpellInfo(loadData[spellEntry.Id], effectsBySpell.LookupByKey(spellEntry.Id), visualsBySpell.LookupByKey(spellEntry.Id), spellEffectScallingByEffectId);
mSpellInfoMap[spellEntry.Id] = new SpellInfo(loadData[spellEntry.Id], effectsBySpell.LookupByKey(spellEntry.Id), visualsBySpell.LookupByKey(spellEntry.Id));
}
CliDB.SpellStorage.Clear();