diff --git a/SpellWork/DBC/Structure.cs b/SpellWork/DBC/Structure.cs index f214b58e..ea623c17 100644 --- a/SpellWork/DBC/Structure.cs +++ b/SpellWork/DBC/Structure.cs @@ -34,52 +34,48 @@ public struct SpellEntry { public uint ID; // 0 m_ID public uint Category; // 1 m_category - public uint Dispel; // 2 m_dispelType - public uint Mechanic; // 3 m_mechanic - public uint Attributes; // 4 m_attribute - public uint AttributesEx; // 5 m_attributesEx - public uint AttributesEx2; // 6 m_attributesExB - public uint AttributesEx3; // 7 m_attributesExC - public uint AttributesEx4; // 8 m_attributesExD - public uint AttributesEx5; // 9 m_attributesExE - public uint AttributesEx6; // 10 m_attributesExF - public uint AttributesExG; // 11 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...) - public ulong Stances; // 12-13 m_shapeshiftMask - public ulong StancesNot; // 14-15 m_shapeshiftExclude - public uint Targets; // 16 m_targets - public uint TargetCreatureType; // 17 m_targetCreatureType - public uint RequiresSpellFocus; // 18 m_requiresSpellFocus - public uint FacingCasterFlags; // 19 m_facingCasterFlags - public uint CasterAuraState; // 20 m_casterAuraState - public uint TargetAuraState; // 21 m_targetAuraState - public uint CasterAuraStateNot; // 22 m_excludeCasterAuraState - public uint TargetAuraStateNot; // 23 m_excludeTargetAuraState - public uint CasterAuraSpell; // 24 m_casterAuraSpell - public uint TargetAuraSpell; // 25 m_targetAuraSpell - public uint ExcludeCasterAuraSpell; // 26 m_excludeCasterAuraSpell - public uint ExcludeTargetAuraSpell; // 27 m_excludeTargetAuraSpell - public uint CastingTimeIndex; // 28 m_castingTimeIndex - public uint RecoveryTime; // 29 m_recoveryTime - public uint CategoryRecoveryTime; // 30 m_categoryRecoveryTime - public uint InterruptFlags; // 31 m_interruptFlags - public uint AuraInterruptFlags; // 32 m_auraInterruptFlags - public uint ChannelInterruptFlags; // 33 m_channelInterruptFlags - public uint ProcFlags; // 34 m_procTypeMask - public uint ProcChance; // 35 m_procChance - public uint ProcCharges; // 36 m_procCharges - public uint MaxLevel; // 37 m_maxLevel - public uint BaseLevel; // 38 m_baseLevel - public uint SpellLevel; // 39 m_spellLevel - public uint DurationIndex; // 40 m_durationIndex - public uint PowerType; // 41 m_powerType - public uint ManaCost; // 42 m_manaCost - public uint ManaCostPerlevel; // 43 m_manaCostPerLevel - public uint ManaPerSecond; // 44 m_manaPerSecond - public uint ManaPerSecondPerLevel; // 45 m_manaPerSecondPerLevel - public uint RangeIndex; // 46 m_rangeIndex - public float Speed; // 47 m_speed - public uint ModalNextSpell; // 48 m_modalNextSpell not used - public uint StackAmount; // 49 m_cumulativeAura + public uint CastUI; // 2 not used + public uint Dispel; // 3 m_dispelType + public uint Mechanic; // 4 m_mechanic + public uint Attributes; // 5 m_attribute + public uint AttributesEx; // 6 m_attributesEx + public uint AttributesEx2; // 7 m_attributesExB + public uint AttributesEx3; // 8 m_attributesExC + public uint AttributesEx4; // 9 m_attributesExD + public uint AttributesEx5; // 10 m_attributesExE + public uint AttributesEx6; // 11 m_attributesExF + public uint Stances; // 12 m_shapeshiftMask + public uint StancesNot; // 13 m_shapeshiftExclude + public uint Targets; // 14 m_targets + public uint TargetCreatureType; // 15 m_targetCreatureType + public uint RequiresSpellFocus; // 16 m_requiresSpellFocus + public uint FacingCasterFlags; // 17 m_facingCasterFlags + public uint CasterAuraState; // 18 m_casterAuraState + public uint TargetAuraState; // 19 m_targetAuraState + public uint CasterAuraStateNot; // 20 m_excludeCasterAuraState + public uint TargetAuraStateNot; // 21 m_excludeTargetAuraState + public uint CastingTimeIndex; // 22 m_castingTimeIndex + public uint RecoveryTime; // 23 m_recoveryTime + public uint CategoryRecoveryTime; // 24 m_categoryRecoveryTime + public uint InterruptFlags; // 25 m_interruptFlags + public uint AuraInterruptFlags; // 26 m_auraInterruptFlags + public uint ChannelInterruptFlags; // 27 m_channelInterruptFlags + public uint ProcFlags; // 28 m_procTypeMask + public uint ProcChance; // 29 m_procChance + public uint ProcCharges; // 30 m_procCharges + public uint MaxLevel; // 31 m_maxLevel + public uint BaseLevel; // 32 m_baseLevel + public uint SpellLevel; // 33 m_spellLevel + public uint DurationIndex; // 34 m_durationIndex + public uint PowerType; // 35 m_powerType + public uint ManaCost; // 36 m_manaCost + public uint ManaCostPerlevel; // 37 m_manaCostPerLevel + public uint ManaPerSecond; // 38 m_manaPerSecond + public uint ManaPerSecondPerLevel; // 39 m_manaPerSecondPerLevel + public uint RangeIndex; // 40 m_rangeIndex + public float Speed; // 41 m_speed + public uint ModalNextSpell; // 42 m_modalNextSpell not used + public uint StackAmount; // 43 m_cumulativeAura [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] Totem; // 50-51 m_totem [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] @@ -94,6 +90,10 @@ public struct SpellEntry [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] public int[] EffectDieSides; // 74-76 m_effectDieSides [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] + public uint[] EffectBaseDice; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] + public float[] EffectDicePerLevel; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] public float[] EffectRealPointsPerLevel; // 77-79 m_effectRealPointsPerLevel [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] public int[] EffectBasePoints; // 80-82 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints) @@ -123,14 +123,8 @@ public struct SpellEntry public uint[] EffectTriggerSpell; // 116-118 m_effectTriggerSpell [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] public float[] EffectPointsPerComboPoint; // 119-121 m_effectPointsPerCombo - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectSpellClassMaskA; // 122-124 m_effectSpellClassMaskA, effect 0 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectSpellClassMaskB; // 125-127 m_effectSpellClassMaskB, effect 1 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectSpellClassMaskC; // 128-130 m_effectSpellClassMaskC, effect 2 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] SpellVisual; // 131-132 m_spellVisualID + public uint SpellIconID; // 133 m_spellIconID public uint ActiveIconID; // 134 m_activeIconID public uint SpellPriority; // 135 m_spellPriority not used @@ -151,8 +145,8 @@ public struct SpellEntry public uint StartRecoveryTime; // 206 m_startRecoveryTime public uint MaxTargetLevel; // 207 m_maxTargetLevel public uint SpellFamilyName; // 208 m_spellClassSet - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] SpellFamilyFlags; // 209-211 m_spellClassMask NOTE: size is 12 bytes!!! + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public uint[] SpellFamilyFlags; // 209-211 m_spellClassMask NOTE: size is 12 bytes!!! public uint MaxAffectedTargets; // 212 m_maxTargets public uint DmgClass; // 213 m_defenseType public uint PreventionType; // 214 m_preventionType @@ -166,13 +160,6 @@ public struct SpellEntry public uint[] TotemCategory; // 222-223 m_requiredTotemCategoryID public int AreaGroupId; // 224 m_requiredAreaGroupId public uint SchoolMask; // 225 m_schoolMask - public uint RuneCostID; // 226 m_runeCostID - public uint SpellMissileID; // 227 m_spellMissileID not used - public uint PowerDisplayId; // 228 PowerDisplay.dbc, new in 3.1 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public float[] Unk_320_4; // 229-231 3.2.0 - public uint SpellDescriptionVariableID; // 232 3.2.0 - public uint SpellDifficultyId; // 233 3.3.0 // 239 3.3.0 /// /// Return current Spell Name diff --git a/SpellWork/Extensions/TreeViewExtensions.cs b/SpellWork/Extensions/TreeViewExtensions.cs index 8ca72111..275a6c75 100644 --- a/SpellWork/Extensions/TreeViewExtensions.cs +++ b/SpellWork/Extensions/TreeViewExtensions.cs @@ -11,17 +11,15 @@ public static class TreeViewExtensions /// public static uint[] GetMask(this TreeView tv) { - uint[] val = new uint[3]; + uint[] val = new uint[2]; foreach (TreeNode node in tv.Nodes) { if (node.Checked) { if(node.Index < 32) val[0] += 1U << node.Index; - else if(node.Index < 64) - val[1] += 1U << (node.Index - 32); else - val[2] += 1U << (node.Index - 64); + val[1] += 1U << (node.Index - 32); } } return val; @@ -40,10 +38,8 @@ public static void SetMask(this TreeView tv, uint[] mask) { if (i < 32) tv.Nodes[i].Checked = ((mask[0] / (1 << i)) % 2) != 0; - else if (i < 64) - tv.Nodes[i].Checked = ((mask[1] / (1 << (i - 32))) % 2) != 0; else - tv.Nodes[i].Checked = ((mask[2] / (1 << (i - 64))) % 2) != 0; + tv.Nodes[i].Checked = ((mask[1] / (1 << (i - 32))) % 2) != 0; } ProcInfo.Update = true; diff --git a/SpellWork/Forms/FormMain.cs b/SpellWork/Forms/FormMain.cs index 3569d61a..6e4e8439 100644 --- a/SpellWork/Forms/FormMain.cs +++ b/SpellWork/Forms/FormMain.cs @@ -173,8 +173,7 @@ private void AdvancedSearch() || (spell.AttributesEx3 & at) != 0 || (spell.AttributesEx4 & at) != 0 || (spell.AttributesEx5 & at) != 0 - || (spell.AttributesEx6 & at) != 0 - || (spell.AttributesExG & at) != 0)) + || (spell.AttributesEx6 & at) != 0)) && ((id != 0 || ic != 0 && at != 0) || spell.SpellName.ContainsText(name)) diff --git a/SpellWork/Forms/FormSearch.cs b/SpellWork/Forms/FormSearch.cs index 2e49a31e..3d6569c4 100644 --- a/SpellWork/Forms/FormSearch.cs +++ b/SpellWork/Forms/FormSearch.cs @@ -43,8 +43,7 @@ private void IdName_KeyDown(object sender, KeyEventArgs e) || (spell.AttributesEx3 & at) != 0 || (spell.AttributesEx4 & at) != 0 || (spell.AttributesEx5 & at) != 0 - || (spell.AttributesEx6 & at) != 0 - || (spell.AttributesExG & at) != 0)) + || (spell.AttributesEx6 & at) != 0)) && (id != 0 || ic != 0 && at != 0) || spell.SpellName.ContainsText(name) diff --git a/SpellWork/Spell/ProcInfo.cs b/SpellWork/Spell/ProcInfo.cs index abaa43e1..721ae24e 100644 --- a/SpellWork/Spell/ProcInfo.cs +++ b/SpellWork/Spell/ProcInfo.cs @@ -28,19 +28,17 @@ select new SkillLine.Value }; - for (int i = 0; i < 96; i++) + for (int i = 0; i < 64; i++) { - uint[] mask = new uint[3]; + uint[] mask = new uint[2]; if (i < 32) mask[0] = 1U << i; - else if (i < 64) - mask[1] = 1U << (i - 32); else - mask[2] = 1U << (i - 64); + mask[1] = 1U << (i - 32); TreeNode node = new TreeNode(); - node.Text = String.Format("0x{0:X8} {1:X8} {2:X8}", mask[2], mask[1], mask[0]); + node.Text = String.Format("0x{0:X8} {1:X8}", mask[1], mask[0]); node.ImageKey = "family.ico"; familyTree.Nodes.Add(node); } @@ -72,14 +70,12 @@ select new foreach (TreeNode node in familyTree.Nodes) { - uint[] mask = new uint[3]; + uint[] mask = new uint[2]; if (node.Index < 32) mask[0] = 1U << node.Index; - else if (node.Index < 64) - mask[1] = 1U << (node.Index - 32); else - mask[2] = 1U << (node.Index - 64); + mask[1] = 1U << (node.Index - 32); if ((spell.SpellFamilyFlags.ContainsElement(mask))) { diff --git a/SpellWork/Spell/SpellInfo.cs b/SpellWork/Spell/SpellInfo.cs index 19590215..5a41e593 100644 --- a/SpellWork/Spell/SpellInfo.cs +++ b/SpellWork/Spell/SpellInfo.cs @@ -40,8 +40,8 @@ private void ViewSpellInfo() rtb.AppendFormatLine("Category = {0}, SpellIconID = {1}, activeIconID = {2}, SpellVisual = ({3},{4})", spell.Category, spell.SpellIconID, spell.ActiveIconID, spell.SpellVisual[0], spell.SpellVisual[1]); - rtb.AppendFormatLine("Family {0}, flag 0x{1:X8} {2:X8} {3:X8}", - (SpellFamilyNames)spell.SpellFamilyName, spell.SpellFamilyFlags[2], spell.SpellFamilyFlags[1], spell.SpellFamilyFlags[0]); + rtb.AppendFormatLine("Family {0}, flag 0x{1:X16}", + (SpellFamilyNames)spell.SpellFamilyName, spell.SpellFamilyFlags); rtb.AppendLine(); @@ -50,7 +50,7 @@ private void ViewSpellInfo() rtb.AppendFormatLine("PreventionType = {0} ({1})", spell.PreventionType, (SpellPreventionType)spell.PreventionType); if (spell.Attributes != 0 || spell.AttributesEx != 0 || spell.AttributesEx2 != 0 || spell.AttributesEx3 != 0 - || spell.AttributesEx4 != 0 || spell.AttributesEx5 != 0 || spell.AttributesEx6 != 0 || spell.AttributesExG != 0) + || spell.AttributesEx4 != 0 || spell.AttributesEx5 != 0 || spell.AttributesEx6 != 0) rtb.AppendLine(_line); if (spell.Attributes != 0) @@ -67,8 +67,6 @@ private void ViewSpellInfo() rtb.AppendFormatLine("AttributesEx5: 0x{0:X8} ({1})", spell.AttributesEx5, (SpellAtributeEx5)spell.AttributesEx5); if (spell.AttributesEx6 != 0) rtb.AppendFormatLine("AttributesEx6: 0x{0:X8} ({1})", spell.AttributesEx6, (SpellAtributeEx6)spell.AttributesEx6); - if (spell.AttributesExG != 0) - rtb.AppendFormatLine("AttributesExG: 0x{0:X8} ({1})", spell.AttributesExG, (SpellAtributeExG)spell.AttributesExG); rtb.AppendLine(_line); @@ -163,8 +161,6 @@ private void ViewSpellInfo() if (spell.TargetAuraStateNot != 0) rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", spell.TargetAuraStateNot, (AuraState)spell.TargetAuraStateNot); - AppendSpellAura(); - rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", spell.RequiresSpellFocus); if (spell.ProcFlags != 0) @@ -226,19 +222,18 @@ private void AppendSpellEffectInfo() rtb.AppendFormatLine("Effect {0}: Id {1} ({2})", EFFECT_INDEX, spell.Effect[EFFECT_INDEX], (SpellEffects)spell.Effect[EFFECT_INDEX]); rtb.SetDefaultStyle(); - rtb.AppendFormat("BasePoints = {0}", spell.EffectBasePoints[EFFECT_INDEX] + 1); + rtb.AppendFormat("BasePoints = {0}", spell.EffectBasePoints[EFFECT_INDEX] + spell.EffectBaseDice[EFFECT_INDEX]); if (spell.EffectRealPointsPerLevel[EFFECT_INDEX] != 0) rtb.AppendFormat(" + Level * {0:F}", spell.EffectRealPointsPerLevel[EFFECT_INDEX]); - // WTF ? 1 = spell.EffectBaseDice[i] - if (1 < spell.EffectDieSides[EFFECT_INDEX]) + if (spell.EffectBaseDice[EFFECT_INDEX] < spell.EffectDieSides[EFFECT_INDEX]) { if (spell.EffectRealPointsPerLevel[EFFECT_INDEX] != 0) rtb.AppendFormat(" to {0} + lvl * {1:F}", - spell.EffectBasePoints[EFFECT_INDEX] + 1 + spell.EffectDieSides[EFFECT_INDEX], spell.EffectRealPointsPerLevel[EFFECT_INDEX]); + spell.EffectBasePoints[EFFECT_INDEX] + spell.EffectBaseDice[EFFECT_INDEX] + spell.EffectDieSides[EFFECT_INDEX], spell.EffectRealPointsPerLevel[EFFECT_INDEX]); else - rtb.AppendFormat(" to {0}", spell.EffectBasePoints[EFFECT_INDEX] + 1 + spell.EffectDieSides[EFFECT_INDEX]); + rtb.AppendFormat(" to {0}", spell.EffectBasePoints[EFFECT_INDEX] + spell.EffectBaseDice[EFFECT_INDEX] + spell.EffectDieSides[EFFECT_INDEX]); } rtb.AppendFormatIfNotNull(" + combo * {0:F}", spell.EffectPointsPerComboPoint[EFFECT_INDEX]); @@ -255,45 +250,45 @@ private void AppendSpellEffectInfo() AuraModTypeName(EFFECT_INDEX); - uint[] ClassMask = new uint[3]; + //uint[] ClassMask = new uint[3]; - switch (EFFECT_INDEX) - { - case 0: ClassMask = spell.EffectSpellClassMaskA; break; - case 1: ClassMask = spell.EffectSpellClassMaskB; break; - case 2: ClassMask = spell.EffectSpellClassMaskC; break; - } - - if (ClassMask[0] != 0 || ClassMask[1] != 0 || ClassMask[2] != 0) - { - rtb.AppendFormatLine("SpellClassMask = {0:X8} {1:X8} {2:X8}", ClassMask[2], ClassMask[1], ClassMask[0]); - - var query = from Spell in DBC.Spell.Values - where Spell.SpellFamilyName == spell.SpellFamilyName && Spell.SpellFamilyFlags.ContainsElement(ClassMask) - join sk in DBC.SkillLineAbility on Spell.ID equals sk.Value.SpellId into temp - from Skill in temp.DefaultIfEmpty() - select new - { - SpellID = Spell.ID, - SpellName = Spell.SpellNameRank, - SkillId = Skill.Value.SkillId - }; - - foreach (var row in query) - { - if (row.SkillId > 0) - { - rtb.SelectionColor = Color.Blue; - rtb.AppendFormatLine("\t+ {0} - {1}", row.SpellID, row.SpellName); - } - else - { - rtb.SelectionColor = Color.Red; - rtb.AppendFormatLine("\t- {0} - {1}", row.SpellID, row.SpellName); - } - rtb.SelectionColor = Color.Black; - } - } + //switch (EFFECT_INDEX) + //{ + // case 0: ClassMask = spell.EffectSpellClassMaskA; break; + // case 1: ClassMask = spell.EffectSpellClassMaskB; break; + // case 2: ClassMask = spell.EffectSpellClassMaskC; break; + //} + + //if (ClassMask[0] != 0 || ClassMask[1] != 0 || ClassMask[2] != 0) + //{ + // rtb.AppendFormatLine("SpellClassMask = {0:X8} {1:X8} {2:X8}", ClassMask[2], ClassMask[1], ClassMask[0]); + + // var query = from Spell in DBC.Spell.Values + // where Spell.SpellFamilyName == spell.SpellFamilyName && Spell.SpellFamilyFlags.ContainsElement(ClassMask) + // join sk in DBC.SkillLineAbility on Spell.ID equals sk.Value.SpellId into temp + // from Skill in temp.DefaultIfEmpty() + // select new + // { + // SpellID = Spell.ID, + // SpellName = Spell.SpellNameRank, + // SkillId = Skill.Value.SkillId + // }; + + // foreach (var row in query) + // { + // if (row.SkillId > 0) + // { + // rtb.SelectionColor = Color.Blue; + // rtb.AppendFormatLine("\t+ {0} - {1}", row.SpellID, row.SpellName); + // } + // else + // { + // rtb.SelectionColor = Color.Red; + // rtb.AppendFormatLine("\t- {0} - {1}", row.SpellID, row.SpellName); + // } + // rtb.SelectionColor = Color.Black; + // } + //} rtb.AppendFormatLineIfNotNull("{0}", spell.GetRadius(EFFECT_INDEX)); @@ -333,41 +328,6 @@ select new } } - private void AppendSpellAura() - { - if (spell.CasterAuraSpell != 0) - { - if(DBC.Spell.ContainsKey(spell.CasterAuraSpell)) - rtb.AppendFormatLine(" Caster Aura Spell ({0}) {1}", spell.CasterAuraSpell, DBC.Spell[spell.CasterAuraSpell].SpellName); - else - rtb.AppendFormatLine(" Caster Aura Spell ({0}) ?????", spell.CasterAuraSpell); - } - - if (spell.TargetAuraSpell != 0) - { - if(DBC.Spell.ContainsKey(spell.TargetAuraSpell)) - rtb.AppendFormatLine(" Target Aura Spell ({0}) {1}", spell.TargetAuraSpell, DBC.Spell[spell.TargetAuraSpell].SpellName); - else - rtb.AppendFormatLine(" Target Aura Spell ({0}) ?????", spell.TargetAuraSpell); - } - - if (spell.ExcludeCasterAuraSpell != 0) - { - if(DBC.Spell.ContainsKey(spell.ExcludeCasterAuraSpell)) - rtb.AppendFormatLine(" Ex Caster Aura Spell ({0}) {1}", spell.ExcludeCasterAuraSpell, DBC.Spell[spell.ExcludeCasterAuraSpell].SpellName); - else - rtb.AppendFormatLine(" Ex Caster Aura Spell ({0}) ?????", spell.ExcludeCasterAuraSpell); - } - - if (spell.ExcludeTargetAuraSpell != 0) - { - if(DBC.Spell.ContainsKey(spell.ExcludeTargetAuraSpell)) - rtb.AppendFormatLine(" Ex Target Aura Spell ({0}) {1}", spell.ExcludeTargetAuraSpell, DBC.Spell[spell.ExcludeTargetAuraSpell].SpellName); - else - rtb.AppendFormatLine(" Ex Target Aura Spell ({0}) ?????", spell.ExcludeTargetAuraSpell); - } - } - private void AuraModTypeName(int index) { AuraType aura = (AuraType)spell.EffectApplyAuraName[index];