From c0ca56c856dfc8e143060e850149bbb7c05ec345 Mon Sep 17 00:00:00 2001 From: Konctantin Date: Fri, 8 Oct 2010 17:50:57 +0300 Subject: [PATCH] update to 4.0.3 patch by TOM_RUS, thanks http://paste2.org/p/1025135 Signed-off-by: Konctantin --- SpellWork/DBC/DBC.cs | 19 +- SpellWork/DBC/DBCReader.cs | 6 +- SpellWork/DBC/Structure.cs | 706 ++++++++++++++----- SpellWork/Extensions/Extensions.cs | 7 + SpellWork/Extensions/SpellWorkException.cs | 21 - SpellWork/Forms/FormMain.cs | 40 +- SpellWork/Forms/FormSearch.cs | 10 +- SpellWork/Loader.cs | 81 ++- SpellWork/Program.cs | 37 +- SpellWork/Spell/ProcInfo.cs | 4 +- SpellWork/Spell/SpellInfo.cs | 315 +++++---- SpellWork/SpellWork.csproj | 39 +- SpellWork_VC2010.sln => SpellWork_VS2010.sln | 12 +- 13 files changed, 860 insertions(+), 437 deletions(-) delete mode 100644 SpellWork/Extensions/SpellWorkException.cs rename SpellWork_VC2010.sln => SpellWork_VS2010.sln (55%) diff --git a/SpellWork/DBC/DBC.cs b/SpellWork/DBC/DBC.cs index 7bb9e6c7..78b32942 100644 --- a/SpellWork/DBC/DBC.cs +++ b/SpellWork/DBC/DBC.cs @@ -4,14 +4,27 @@ namespace SpellWork { public static class DBC { - public const string VERSION = "SpellWork 3.3.3a (11723)"; - public const string DBC_PATH = @"dbc\"; + public const string VERSION = "SpellWork 4.0.3 (13117)"; + public const string DBC_PATH = "dbc"; public const int MAX_DBC_LOCALE = 16; public const int MAX_EFFECT_INDEX = 3; public const int SPELL_ENTRY_FOR_DETECT_LOCALE = 1; public static Dictionary Spell; + public static Dictionary SpellEffect; + public static Dictionary SpellTargetRestrictions; + public static Dictionary SpellAuraRestrictions; + public static Dictionary SpellCooldowns; + public static Dictionary SpellCategories; + public static Dictionary SpellShapeshift; + public static Dictionary SpellAuraOptions; + public static Dictionary SpellLevels; + public static Dictionary SpellClassOptions; + public static Dictionary SpellCastingRequirements; + public static Dictionary SpellPower; + public static Dictionary SpellInterrupts; + public static Dictionary SpellEquippedItems; public static Dictionary SpellRadius; public static Dictionary SpellCastTimes; public static Dictionary SpellRange; @@ -26,6 +39,8 @@ public static class DBC public static Dictionary SpellRangeStrings = new Dictionary(); public static Dictionary ScreenEffectStrings = new Dictionary(); + public static Dictionary> SpellEffects = new Dictionary>(); + // DB public static List ItemTemplate = new List(); diff --git a/SpellWork/DBC/DBCReader.cs b/SpellWork/DBC/DBCReader.cs index 1056d4bd..680cb9b7 100644 --- a/SpellWork/DBC/DBCReader.cs +++ b/SpellWork/DBC/DBCReader.cs @@ -15,15 +15,17 @@ static class DBCReader using (BinaryReader reader = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read), Encoding.UTF8)) { + if (!File.Exists(fileName)) + throw new FileNotFoundException(); // read dbc header DbcHeader header = reader.ReadStruct(); int size = Marshal.SizeOf(typeof(T)); if (!header.IsDBC) - throw new SpellWorkException("{0} is not DBC files", fileName); + throw new Exception(fileName + " is not DBC files"); if (header.RecordSize != size) - throw new SpellWorkException("Size of row in DBC file ({0}) != size of DBC struct ({1}) in DBC: {2}", header.RecordSize, size, fileName); + throw new Exception(string.Format("Size of row in DBC file ({0}) != size of DBC struct ({1}) in DBC: {2}", header.RecordSize, size, fileName)); // read dbc data for (int r = 0; r < header.RecordsCount; ++r) diff --git a/SpellWork/DBC/Structure.cs b/SpellWork/DBC/Structure.cs index f214b58e..36afa312 100644 --- a/SpellWork/DBC/Structure.cs +++ b/SpellWork/DBC/Structure.cs @@ -29,157 +29,267 @@ public long StartStringPosition } }; - [StructLayout(LayoutKind.Sequential)] - public struct SpellEntry + // SpellAuraOptions.dbc + public struct SpellAuraOptionsEntry + { + public uint Id; // 0 m_ID + public uint StackAmount; // 51 m_cumulativeAura + public uint ProcChance; // 38 m_procChance + public uint ProcCharges; // 39 m_procCharges + public uint ProcFlags; // 37 m_procTypeMask + }; + + // SpellAuraRestrictions.dbc + public struct SpellAuraRestrictionsEntry { - public uint ID; // 0 m_ID + public uint Id; // 0 m_ID + public uint CasterAuraState; // 21 m_casterAuraState + public uint TargetAuraState; // 22 m_targetAuraState + public uint CasterAuraStateNot; // 23 m_excludeCasterAuraState + public uint TargetAuraStateNot; // 24 m_excludeTargetAuraState + public uint CasterAuraSpell; // 25 m_casterAuraSpell + public uint TargetAuraSpell; // 26 m_targetAuraSpell + public uint ExcludeCasterAuraSpell; // 27 m_excludeCasterAuraSpell + public uint ExcludeTargetAuraSpell; // 28 m_excludeTargetAuraSpell + }; + + // SpellCastingRequirements.dbc + public struct SpellCastingRequirementsEntry + { + public uint Id; // 0 m_ID + public uint FacingCasterFlags; // 20 m_facingCasterFlags + public uint MinFactionId; // 159 m_minFactionID not used + public uint MinReputation; // 160 m_minReputation not used + public int AreaGroupId; // 164 m_requiredAreaGroupId + public uint RequiredAuraVision; // 161 m_requiredAuraVision not used + public uint RequiresSpellFocus; // 19 m_requiresSpellFocus + }; + + // SpellCategories.dbc + public struct SpellCategoriesEntry + { + public uint Id; // 0 m_ID public uint Category; // 1 m_category + public uint DmgClass; // 153 m_defenseType 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 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] Totem; // 50-51 m_totem + public uint PreventionType; // 154 m_preventionType + public uint StartRecoveryCategory; // 145 m_startRecoveryCategory + }; + + // SpellClassOptions.dbc + public struct SpellClassOptionsEntry + { + public uint Id; // 0 m_ID + public uint ModalNextSpell; // 50 m_modalNextSpell not used + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public uint[] SpellFamilyFlags; // 149-150 m_spellClassMask NOTE: size is 12 bytes!!! + public uint SpellFamilyName; // 148 m_spellClassSet + public uint Description; // 6 4.0.0 + }; + + // SpellCooldowns.dbc + public struct SpellCooldownsEntry + { + public uint Id; // 0 m_ID + public uint CategoryRecoveryTime; // 31 m_categoryRecoveryTime + public uint RecoveryTime; // 30 m_recoveryTime + public uint StartRecoveryTime; // 146 m_startRecoveryTime + }; + + // SpellEffect.dbc + public struct SpellEffectEntry + { + public uint Id; // 0 m_ID + public uint Effect; // 73-75 m_effect + public float EffectMultipleValue; // 106-108 m_effectAmplitude + public uint EffectApplyAuraName; // 100-102 m_effectAura + public uint EffectAmplitude; // 103-105 m_effectAuraPeriod + public int EffectBasePoints; // 82-84 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints) + public float Unk_320_4; // 169-171 3.2.0 + public float DmgMultiplier; // 156-158 m_effectChainAmplitude + public uint EffectChainTarget; // 109-111 m_effectChainTargets + public int EffectDieSides; // 76-78 m_effectDieSides + public uint EffectItemType; // 112-114 m_effectItemType + public uint EffectMechanic; // 85-87 m_effectMechanic + public int EffectMiscValue; // 115-117 m_effectMiscValue + public int EffectMiscValueB; // 118-120 m_effectMiscValueB + public float EffectPointsPerComboPoint; // 124-126 m_effectPointsPerCombo + public uint EffectRadiusIndex; // 94-96 m_effectRadiusIndex - spellradius.dbc + public uint EffectRadiusMaxIndex; // 97-99 4.0.0 + public float EffectRealPointsPerLevel; // 79-81 m_effectRealPointsPerLevel + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public uint[] EffectSpellClassMaskA; // 127-129 m_effectSpellClassMaskA, effect 0 + public uint EffectTriggerSpell; // 121-123 m_effectTriggerSpell + public uint EffectImplicitTargetA; // 88-90 m_implicitTargetA + public uint EffectImplicitTargetB; // 91-93 m_implicitTargetB + public uint EffectSpellId; // new 4.0.0 + public uint EffectIndex; // new 4.0.0 + }; + + // SpellEquippedItems.dbc + public struct SpellEquippedItemsEntry + { + public uint Id; // 0 m_ID + public int EquippedItemClass; // 70 m_equippedItemClass (value) + public int EquippedItemInventoryTypeMask; // 72 m_equippedItemInvTypes (mask) + public int EquippedItemSubClassMask; // 71 m_equippedItemSubclass (mask) + }; + + // SpellInterrupts.dbc + public struct SpellInterruptsEntry + { + public uint Id; // 0 m_ID + public uint AuraInterruptFlags; // 33 m_auraInterruptFlags + public uint Unk1; // 34 4.0.0 + public uint ChannelInterruptFlags; // 35 m_channelInterruptFlags + public uint Unk2; // 36 4.0.0 + public uint InterruptFlags; // 32 m_interruptFlags + }; + + // SpellLevels.dbc + public struct SpellLevelsEntry + { + public uint Id; // 0 m_ID + public uint BaseLevel; // 41 m_baseLevel + public uint MaxLevel; // 40 m_maxLevel + public uint SpellLevel; // 42 m_spellLevel + }; + + // SpellPower.dbc + public struct SpellPowerEntry + { + public uint Id; // 0 m_ID + public uint ManaCost; // 45 m_manaCost + public uint ManaCostPerlevel; // 46 m_manaCostPerLevel + public uint ManaCostPercentage; // 144 m_manaCostPct + public uint ManaPerSecond; // 47 m_manaPerSecond + public uint PowerDisplayId; // 168 PowerDisplay.dbc, new in 3.1 + public uint Unk1; // 6 4.0.0 + }; + + // SpellReagents.dbc + public struct SpellReagentsEntry + { + public uint Id; // 0 m_ID [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public int[] Reagent; // 52-59 m_reagent + public int[] Reagent; // 54-61 m_reagent [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] ReagentCount; // 60-67 m_reagentCount - public int EquippedItemClass; // 68 m_equippedItemClass (value) - public int EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask) - public int EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] Effect; // 71-73 m_effect - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public int[] EffectDieSides; // 74-76 m_effectDieSides - [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) - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectMechanic; // 83-85 m_effectMechanic - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectImplicitTargetA; // 86-88 m_implicitTargetA - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectImplicitTargetB; // 89-91 m_implicitTargetB - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectRadiusIndex; // 92-94 m_effectRadiusIndex - spellradius.dbc - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectApplyAuraName; // 95-97 m_effectAura - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectAmplitude; // 98-100 m_effectAuraPeriod - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public float[] EffectMultipleValue; // 101-103 m_effectAmplitude - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectChainTarget; // 104-106 m_effectChainTargets - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public uint[] EffectItemType; // 107-109 m_effectItemType - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public int[] EffectMiscValue; // 110-112 m_effectMiscValue - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - public int[] EffectMiscValueB; // 113-115 m_effectMiscValueB - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_EFFECT_INDEX)] - 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 + public uint[] ReagentCount; // 62-69 m_reagentCount + }; + + // SpellScaling.dbc + public struct SpellScalingEntry + { + public uint Id; // 0 m_ID + public uint unk1; // 1 + public uint unk2; // 2 + public uint unk3; // 3 + public uint unk4; // 4 class? + public float unk5; // 5 + public float unk6; // 6 + public float unk7; // 7 + public float unk8; // 8 + public float unk9; // 9 + public float unk10; // 10 all zeros + public float unk11; // 11 + public float unk12; // 12 all zeros + public float unk13; // 13 all zeros + public float unk14; // 14 + public uint unk15; // 15 + }; + + // SpellShapeshift.dbc + [StructLayout(LayoutKind.Explicit, Size = 24)] + public struct SpellShapeshiftEntry + { + [FieldOffset(0x00)] + public uint Id; // 0 m_ID + [FieldOffset(0x04)] + public ulong Stances; // 13 m_shapeshiftMask + [FieldOffset(0x0C)] + public ulong StancesNot; // 15 m_shapeshiftExclude + [FieldOffset(0x14)] + public uint StanceBarOrder; // 155 m_stanceBarOrder not used + }; + + // SpellTargetRestrictions.dbc + public struct SpellTargetRestrictionsEntry + { + public uint Id; // 0 m_ID + public uint MaxAffectedTargets; // 152 m_maxTargets + public uint MaxTargetLevel; // 147 m_maxTargetLevel + public uint TargetCreatureType; // 18 m_targetCreatureType + public uint Targets; // 17 m_targets + }; + + // SpellTotems.dbc + public struct SpellTotemsEntry + { + public uint Id; // 0 m_ID [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 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_DBC_LOCALE)] - private uint[] _SpellName; // 136-151 m_name_lang - public uint SpellNameFlag; // 152 not used - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_DBC_LOCALE)] - private uint[] _Rank; // 153-168 m_nameSubtext_lang - public uint RankFlags; // 169 not used - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_DBC_LOCALE)] - private uint[] _Description; // 170-185 m_description_lang not used - public uint DescriptionFlags; // 186 not used - [MarshalAs(UnmanagedType.ByValArray, SizeConst = DBC.MAX_DBC_LOCALE)] - private uint[] _ToolTip; // 187-202 m_auraDescription_lang not used - public uint ToolTipFlags; // 203 not used - public uint ManaCostPercentage; // 204 m_manaCostPct - public uint StartRecoveryCategory; // 205 m_startRecoveryCategory - 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!!! - public uint MaxAffectedTargets; // 212 m_maxTargets - public uint DmgClass; // 213 m_defenseType - public uint PreventionType; // 214 m_preventionType - public uint StanceBarOrder; // 215 m_stanceBarOrder not used - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public float[] DmgMultiplier; // 216-218 m_effectChainAmplitude - public uint MinFactionId; // 219 m_minFactionID not used - public uint MinReputation; // 220 m_minReputation not used - public uint RequiredAuraVision; // 221 m_requiredAuraVision not used + public uint[] TotemCategory; // 162-163 m_requiredTotemCategoryID [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - 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 + public uint[] Totem; // 52-53 m_totem + }; + + // Spell.dbc + public struct SpellEntry + { + public uint ID; // 0 m_ID + public uint Attributes; // 1 m_attribute + public uint AttributesEx; // 2 m_attributesEx + public uint AttributesEx2; // 3 m_attributesExB + public uint AttributesEx3; // 4 m_attributesExC + public uint AttributesEx4; // 5 m_attributesExD + public uint AttributesEx5; // 6 m_attributesExE + public uint AttributesEx6; // 7 m_attributesExF + public uint AttributesExG; // 8 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...) + public uint SomeFlags; // 9 4.0.0 + public uint Unk_400_1; // 10 4.0.0 + public uint CastingTimeIndex; // 11 m_castingTimeIndex + public uint DurationIndex; // 12 m_durationIndex + public uint PowerType; // 13 m_powerType + public uint RangeIndex; // 14 m_rangeIndex + public float Speed; // 15 m_speed + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public uint[] SpellVisual; // 16-17 m_spellVisualID + public uint SpellIconID; // 18 m_spellIconID + public uint ActiveIconID; // 19 m_activeIconID + public uint _SpellName; // 20 m_name_lang + public uint _Rank; // 21 m_nameSubtext_lang + public uint _Description; // 22 m_description_lang not used + public uint _ToolTip; // 23 m_auraDescription_lang not used + public uint SchoolMask; // 24 m_schoolMask + public uint RuneCostID; // 25 m_runeCostID + public uint SpellMissileID; // 26 m_spellMissileID not used + public uint SpellDescriptionVariableID; // 27 3.2.0 + public uint SpellDifficultyId; // 28 m_spellDifficultyID - id from SpellDifficulty.dbc + public float Unk_f1; // 29 + public uint SpellScalingId; // 30 SpellScaling.dbc + public uint SpellAuraOptionsId; // 31 SpellAuraOptions.dbc + public uint SpellAuraRestrictionsId; // 32 SpellAuraRestrictions.dbc + public uint SpellCastingRequirementsId; // 33 SpellCastingRequirements.dbc + public uint SpellCategoriesId; // 34 SpellCategories.dbc + public uint SpellClassOptionsId; // 35 SpellClassOptions.dbc + public uint SpellCooldownsId; // 36 SpellCooldowns.dbc + public uint UnkIndex7; // 37 all zeros... + public uint SpellEquippedItemsId; // 38 SpellEquippedItems.dbc + public uint SpellInterruptsId; // 39 SpellInterrupts.dbc + public uint SpellLevelsId; // 40 SpellLevels.dbc + public uint SpellPowerId; // 41 SpellPower.dbc + public uint SpellReagentsId; // 42 SpellReagents.dbc + public uint SpellShapeshiftId; // 43 SpellShapeshift.dbc + public uint SpellTargetRestrictionsId; // 44 SpellTargetRestrictions.dbc + public uint SpellTotemsId; // 45 SpellTotems.dbc + public uint ResearchProject; // 46 ResearchProject.dbc /// /// Return current Spell Name /// public string SpellName { - get { return DBC.SpellStrings.GetValue(_SpellName[(uint)DBC.Locale]); } + get { return DBC.SpellStrings.GetValue(_SpellName); } } /// @@ -187,7 +297,7 @@ public string SpellName /// public string Rank { - get { return _Rank[(uint)DBC.Locale] != 0 ? DBC.SpellStrings[_Rank[(uint)DBC.Locale]] : ""; } + get { return _Rank != 0 ? DBC.SpellStrings[_Rank] : ""; } } public string SpellNameRank @@ -200,7 +310,7 @@ public string SpellNameRank /// public string Description { - get { return DBC.SpellStrings.GetValue(_Description[(uint)DBC.Locale]); } + get { return DBC.SpellStrings.GetValue(_Description); } } /// @@ -208,12 +318,12 @@ public string Description /// public string ToolTip { - get { return DBC.SpellStrings.GetValue(_ToolTip[(uint)DBC.Locale]); } + get { return DBC.SpellStrings.GetValue(_ToolTip); } } public string GetName(byte loc) { - return DBC.SpellStrings.GetValue(_SpellName[loc]); + return DBC.SpellStrings.GetValue(_SpellName); } public string ProcInfo @@ -222,7 +332,7 @@ public string ProcInfo { int i = 0; StringBuilder sb = new StringBuilder(); - uint proc = ProcFlags; + uint proc = SpellAuraOptions.ProcFlags; while (proc != 0) { if ((proc & 1) != 0) @@ -258,7 +368,7 @@ public string Range public string GetRadius(int index) { - uint rIndex = EffectRadiusIndex[index]; + uint rIndex = GetEffect(index).EffectRadiusIndex; if (rIndex != 0) { if (DBC.SpellRadius.ContainsKey(rIndex)) @@ -269,6 +379,103 @@ public string GetRadius(int index) return String.Empty; } + public bool HasEffectAtIndex(int index) + { + try + { + var value = DBC.SpellEffects[ID][index]; + return true; + } + catch + { + return false; + } + } + + public bool HasSpellEffect(int effect) + { + try + { + var value = DBC.SpellEffects[ID]; + foreach (var eff in value) + { + if (eff.Value.Effect == effect) + return true; + } + return false; + } + catch + { + return false; + } + } + + public bool HasSpellAura(int aura) + { + try + { + var value = DBC.SpellEffects[ID]; + foreach (var eff in value) + { + if (eff.Value.EffectApplyAuraName == aura) + return true; + } + return false; + } + catch + { + return false; + } + } + + public bool HasSpellTargetA(int target) + { + try + { + var value = DBC.SpellEffects[ID]; + foreach (var eff in value) + { + if (eff.Value.EffectImplicitTargetA == target) + return true; + } + return false; + } + catch + { + return false; + } + } + + public bool HasSpellTargetB(int target) + { + try + { + var value = DBC.SpellEffects[ID]; + foreach (var eff in value) + { + if (eff.Value.EffectImplicitTargetB == target) + return true; + } + return false; + } + catch + { + return false; + } + } + + public SpellEffectEntry GetEffect(int index) + { + try + { + return DBC.SpellEffects[ID][index]; + } + catch + { + return default(SpellEffectEntry); + } + } + public string CastTime { get @@ -279,7 +486,7 @@ public string CastTime if (!DBC.SpellCastTimes.ContainsKey(CastingTimeIndex)) return String.Format("CastingTime (Id {0}) = ????", CastingTimeIndex); else - return String.Format("CastingTime (Id {0}) = {1:F}", + return String.Format("CastingTime (Id {0}) = {1:F}", CastingTimeIndex, DBC.SpellCastTimes[CastingTimeIndex].CastTime / 1000.0f); } } @@ -291,6 +498,186 @@ public SpellSchoolMask School return (SpellSchoolMask)SchoolMask; } } + + public SpellTargetRestrictionsEntry SpellTargetRestrictions + { + get + { + try + { + return DBC.SpellTargetRestrictions[SpellTargetRestrictionsId]; + } + catch + { + return default(SpellTargetRestrictionsEntry); + } + } + } + + public SpellAuraRestrictionsEntry SpellAuraRestrictions + { + get + { + try + { + return DBC.SpellAuraRestrictions[SpellAuraRestrictionsId]; + } + catch + { + return default(SpellAuraRestrictionsEntry); + } + } + } + + public SpellCooldownsEntry SpellCooldowns + { + get + { + try + { + return DBC.SpellCooldowns[SpellCooldownsId]; + } + catch + { + return default(SpellCooldownsEntry); + } + } + } + + public SpellCategoriesEntry SpellCategories + { + get + { + try + { + return DBC.SpellCategories[SpellCategoriesId]; + } + catch + { + return default(SpellCategoriesEntry); + } + } + } + + public SpellShapeshiftEntry SpellShapeshift + { + get + { + try + { + return DBC.SpellShapeshift[SpellShapeshiftId]; + } + catch + { + return default(SpellShapeshiftEntry); + } + } + } + + public SpellAuraOptionsEntry SpellAuraOptions + { + get + { + try + { + return DBC.SpellAuraOptions[SpellAuraOptionsId]; + } + catch + { + return default(SpellAuraOptionsEntry); + } + } + } + + public SpellLevelsEntry SpellLevels + { + get + { + try + { + return DBC.SpellLevels[SpellLevelsId]; + } + catch + { + return default(SpellLevelsEntry); + } + } + } + + public SpellClassOptionsEntry SpellClassOptions + { + get + { + try + { + return DBC.SpellClassOptions[SpellClassOptionsId]; + } + catch + { + return default(SpellClassOptionsEntry); + } + } + } + + public SpellCastingRequirementsEntry SpellCastingRequirements + { + get + { + try + { + return DBC.SpellCastingRequirements[SpellCastingRequirementsId]; + } + catch + { + return default(SpellCastingRequirementsEntry); + } + } + } + + public SpellPowerEntry SpellPower + { + get + { + try + { + return DBC.SpellPower[SpellPowerId]; + } + catch + { + return default(SpellPowerEntry); + } + } + } + + public SpellInterruptsEntry SpellInterrupts + { + get + { + try + { + return DBC.SpellInterrupts[SpellInterruptsId]; + } + catch + { + return default(SpellInterruptsEntry); + } + } + } + + public SpellEquippedItemsEntry SpellEquippedItems + { + get + { + try + { + return DBC.SpellEquippedItems[SpellEquippedItemsId]; + } + catch + { + return default(SpellEquippedItemsEntry); + } + } + } }; public struct SkillLineEntry @@ -298,31 +685,25 @@ public struct SkillLineEntry public uint ID; // 0 m_ID public int CategoryId; // 1 m_categoryID public uint SkillCostID; // 2 m_skillCostsID - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] _Name; // 3-18 m_displayName_lang - public uint NameFlags; // 19 - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] _Description; // 20-35 m_description_lang - public uint DescriptionFlags; // 36 + public uint _Name; // 3-18 m_displayName_lang + public uint _Description; // 20-35 m_description_lang public uint SpellIcon; // 37 m_spellIconID - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] _AlternateVerb; // 38-53 m_alternateVerb_lang - public uint AlternateVerbFlags; // 54 + public uint _AlternateVerb; // 38-53 m_alternateVerb_lang public uint CanLink; // 55 m_canLink (prof. with recipes public string Name { - get { return DBC.SkillLineStrings.GetValue(_Name[(uint)DBC.Locale]); } + get { return DBC.SkillLineStrings.GetValue(_Name); } } public string Description { - get { return DBC.SkillLineStrings.GetValue(_Description[(uint)DBC.Locale]); } + get { return DBC.SkillLineStrings.GetValue(_Description); } } public string AlternateVerb { - get { return DBC.SkillLineStrings.GetValue(_AlternateVerb[(uint)DBC.Locale]); } + get { return DBC.SkillLineStrings.GetValue(_AlternateVerb); } } }; @@ -360,21 +741,17 @@ public struct SpellRangeEntry public float MaxRange; public float MaxRangeFriendly; public uint Field5; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] _Desc1; - public uint Desc1Flags; - [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] _Desc2; - public uint Desc2Flags; + public uint _Desc1; + public uint _Desc2; public string Description1 { - get { return DBC.SpellRangeStrings.GetValue(_Desc1[(uint)DBC.Locale]); } + get { return DBC.SpellRangeStrings.GetValue(_Desc1); } } public string Description2 { - get { return DBC.SpellRangeStrings.GetValue(_Desc2[(uint)DBC.Locale]); } + get { return DBC.SpellRangeStrings.GetValue(_Desc2); } } }; @@ -424,6 +801,7 @@ public struct OverrideSpellDataEntry [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] Spells; public uint unk; + public uint AltBarStringIndex; // string }; //=============== DateBase =================\\ diff --git a/SpellWork/Extensions/Extensions.cs b/SpellWork/Extensions/Extensions.cs index 992c3d31..e9ea7894 100644 --- a/SpellWork/Extensions/Extensions.cs +++ b/SpellWork/Extensions/Extensions.cs @@ -280,6 +280,13 @@ public static bool ContainsElement(this uint[] array, uint[] value) return false; } + public static bool Match(this SpellClassOptionsEntry opt, SpellClassOptionsEntry arg, uint[] mask) + { + if (opt.SpellFamilyName == arg.SpellFamilyName && opt.SpellFamilyFlags != null && opt.SpellFamilyFlags.ContainsElement(mask)) + return true; + return false; + } + /// /// Checks if the specified value in a given array /// diff --git a/SpellWork/Extensions/SpellWorkException.cs b/SpellWork/Extensions/SpellWorkException.cs deleted file mode 100644 index 39eb0c84..00000000 --- a/SpellWork/Extensions/SpellWorkException.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows.Forms; - -namespace SpellWork -{ - [Serializable] - public class SpellWorkException : Exception - { - public SpellWorkException(string message, params object[] arg0) - : base(String.Format(message, arg0)) - { - MessageBox.Show(String.Format(message, arg0), - String.Format("{0} ERROR", DBC.VERSION), - MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - } -} diff --git a/SpellWork/Forms/FormMain.cs b/SpellWork/Forms/FormMain.cs index 3569d61a..667f9057 100644 --- a/SpellWork/Forms/FormMain.cs +++ b/SpellWork/Forms/FormMain.cs @@ -202,7 +202,7 @@ private void AdvansedFilter() var bTarget2 = _cbTarget2.SelectedIndex != 0; var fTarget2 = _cbTarget2.SelectedValue.ToInt32(); - // additional filtert + // additional filter var advVal1 = _tbAdvansedFilter1Val.Text; var advVal2 = _tbAdvansedFilter2Val.Text; @@ -213,12 +213,12 @@ private void AdvansedFilter() bool use2val = advVal2 != string.Empty; _spellList = (from spell in DBC.Spell.Values - - where ( !bFamilyNames || spell.SpellFamilyName == fFamilyNames) - && (!bSpellEffect || spell.Effect.ContainsElement((uint)fSpellEffect)) - && (!bSpellAura || spell.EffectApplyAuraName.ContainsElement((uint)fSpellAura)) - && (!bTarget1 || spell.EffectImplicitTargetA.ContainsElement((uint)fTarget1)) - && (!bTarget2 || spell.EffectImplicitTargetB.ContainsElement((uint)fTarget2)) + + where (!bFamilyNames || spell.SpellClassOptions.SpellFamilyName == fFamilyNames) + && (!bSpellEffect || spell.HasSpellEffect(fSpellEffect)) + && (!bSpellAura || spell.HasSpellAura(fSpellAura)) + && (!bTarget1 || spell.HasSpellTargetA(fTarget1)) + && (!bTarget2 || spell.HasSpellTargetB(fTarget2)) && (!use1val || spell.CreateFilter(field1, advVal1)) && (!use2val || spell.CreateFilter(field2, advVal2)) @@ -227,7 +227,6 @@ private void AdvansedFilter() _lvSpellList.VirtualListSize = _spellList.Count(); if (_lvSpellList.SelectedIndices.Count > 0) _lvSpellList.Items[_lvSpellList.SelectedIndices[0]].Selected = false; - } #endregion @@ -315,13 +314,15 @@ private void SetProcAtribute(SpellEntry spell) { new SpellInfo(_rtbProcSpellInfo, spell); - _cbProcSpellFamilyTree.SelectedValue = spell.SpellFamilyName; - _clbProcFlags.SetCheckedItemFromFlag(spell.ProcFlags); + var classOptions = spell.SpellClassOptions; + _cbProcSpellFamilyTree.SelectedValue = classOptions.SpellFamilyName; + var auraOptions = spell.SpellAuraOptions; + _clbProcFlags.SetCheckedItemFromFlag(auraOptions.ProcFlags); _clbSchools.SetCheckedItemFromFlag(spell.SchoolMask); - _cbProcFitstSpellFamily.SelectedValue = spell.SpellFamilyName; + _cbProcFitstSpellFamily.SelectedValue = classOptions.SpellFamilyName; _tbPPM.Text = "0"; // need correct value - _tbChance.Text = spell.ProcChance.ToString(); - _tbCooldown.Text = (spell.RecoveryTime / 1000f).ToString(); + _tbChance.Text = auraOptions.ProcChance.ToString(); + _tbCooldown.Text = (spell.SpellCooldowns.RecoveryTime / 1000f).ToString(); } private void GetProcAttribute(SpellEntry spell) @@ -375,11 +376,11 @@ private void ProcFilter() _spellProcList = (from spell in DBC.Spell.Values - where (!bFamilyNames || spell.SpellFamilyName == fFamilyNames) - && (!bSpellEffect || spell.Effect.ContainsElement((uint)fSpellEffect)) - && (!bSpellAura || spell.EffectApplyAuraName.Contains((uint)fSpellAura)) - && (!bTarget1 || spell.EffectImplicitTargetA.ContainsElement((uint)fTarget1)) - && (!bTarget2 || spell.EffectImplicitTargetB.ContainsElement((uint)fTarget2)) + where (!bFamilyNames || spell.SpellClassOptions.SpellFamilyName == fFamilyNames) + && (!bSpellEffect || spell.HasSpellEffect(fSpellEffect)) + && (!bSpellAura || spell.HasSpellAura(fSpellAura)) + && (!bTarget1 || spell.HasSpellTargetA(fTarget1)) + && (!bTarget2 || spell.HasSpellTargetB(fTarget2)) select spell).ToList(); @@ -398,8 +399,7 @@ private void FamilyTree_AfterCheck(object sender, TreeViewEventArgs e) uint[] mask = ((TreeView)sender).GetMask(); var query = from Spell in DBC.Spell.Values - where Spell.SpellFamilyName == ProcInfo.SpellProc.SpellFamilyName - && Spell.SpellFamilyFlags.ContainsElement(mask) + where Spell.SpellClassOptions.Match(ProcInfo.SpellProc.SpellClassOptions, mask) join sk in DBC.SkillLineAbility on Spell.ID equals sk.Value.SpellId into temp1 from Skill in temp1.DefaultIfEmpty() //join skl in DBC.SkillLine on Skill.Value.SkillId equals skl.Value.ID into temp2 diff --git a/SpellWork/Forms/FormSearch.cs b/SpellWork/Forms/FormSearch.cs index 2e49a31e..678bc7f7 100644 --- a/SpellWork/Forms/FormSearch.cs +++ b/SpellWork/Forms/FormSearch.cs @@ -79,11 +79,11 @@ private void SpellFamily_SelectedIndexChanged(object sender, EventArgs e) _spellList = (from spell in DBC.Spell.Values - where (!bFamilyNames || spell.SpellFamilyName == fFamilyNames) - && (!bSpellEffect || spell.Effect.ContainsElement((uint)fSpellEffect)) - && (!bSpellAura || spell.EffectApplyAuraName.ContainsElement((uint)fSpellAura)) - && (!bTarget1 || spell.EffectImplicitTargetA.ContainsElement((uint)fTarget1)) - && (!bTarget2 || spell.EffectImplicitTargetB.ContainsElement((uint)fTarget2)) + where (!bFamilyNames || spell.SpellClassOptions.SpellFamilyName == fFamilyNames) + && (!bSpellEffect || spell.HasSpellEffect(fSpellEffect)) + && (!bSpellAura || spell.HasSpellAura(fSpellAura)) + && (!bTarget1 || spell.HasSpellTargetA(fTarget1)) + && (!bTarget2 || spell.HasSpellTargetB(fTarget2)) select spell).ToList(); diff --git a/SpellWork/Loader.cs b/SpellWork/Loader.cs index 1e846e04..eb3be0c6 100644 --- a/SpellWork/Loader.cs +++ b/SpellWork/Loader.cs @@ -1,53 +1,66 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; namespace SpellWork { class Loader { - public Loader(bool thread) + public Loader() { - DBC.Spell = DBCReader.ReadDBC(DBC.SpellStrings); - - if (thread) - new Thread(RunOther).Start(); - else - RunOther(); - - DBC.Locale = DetectedLocale; - } + DBC.Spell = DBCReader.ReadDBC(DBC.SpellStrings); + DBC.SpellEffect = DBCReader.ReadDBC(null); - private void RunOther() - { - DBC.SkillLine = DBCReader.ReadDBC(DBC.SkillLineStrings); - DBC.SpellRange = DBCReader.ReadDBC(DBC.SpellRangeStrings); - DBC.ScreenEffect = DBCReader.ReadDBC(DBC.ScreenEffectStrings); - - DBC.SpellDuration = DBCReader.ReadDBC(null); - DBC.SkillLineAbility = DBCReader.ReadDBC(null); - DBC.SpellRadius = DBCReader.ReadDBC(null); - DBC.SpellCastTimes = DBCReader.ReadDBC(null); + // this is to speedup spelleffect lookups + foreach (var value in DBC.SpellEffect) + { + if (DBC.SpellEffects.ContainsKey(value.Value.EffectSpellId)) + { + DBC.SpellEffects[value.Value.EffectSpellId].Add((int)value.Value.EffectIndex, value.Value); + } + else + { + Dictionary temp = new Dictionary(3); + DBC.SpellEffects.Add(value.Value.EffectSpellId, temp); + DBC.SpellEffects[value.Value.EffectSpellId].Add((int)value.Value.EffectIndex, value.Value); + } + } + + DBC.SpellTargetRestrictions = DBCReader.ReadDBC(null); + DBC.SpellAuraRestrictions = DBCReader.ReadDBC(null); + DBC.SpellCooldowns = DBCReader.ReadDBC(null); + DBC.SpellCategories = DBCReader.ReadDBC(null); + DBC.SpellShapeshift = DBCReader.ReadDBC(null); + DBC.SpellAuraOptions = DBCReader.ReadDBC(null); + DBC.SpellLevels = DBCReader.ReadDBC(null); + DBC.SpellClassOptions = DBCReader.ReadDBC(null); + DBC.SpellCastingRequirements = DBCReader.ReadDBC(null); + DBC.SpellPower = DBCReader.ReadDBC(null); + DBC.SpellInterrupts = DBCReader.ReadDBC(null); + DBC.SpellEquippedItems = DBCReader.ReadDBC(null); + DBC.SpellDuration = DBCReader.ReadDBC(null); + DBC.SkillLineAbility = DBCReader.ReadDBC(null); + DBC.SpellRadius = DBCReader.ReadDBC(null); + DBC.SpellCastTimes = DBCReader.ReadDBC(null); - DBC.OverrideSpellData = DBCReader.ReadDBC(null); + DBC.OverrideSpellData = DBCReader.ReadDBC(null); + DBC.SkillLine = DBCReader.ReadDBC(DBC.SkillLineStrings); + DBC.SpellRange = DBCReader.ReadDBC(DBC.SpellRangeStrings); + DBC.ScreenEffect = DBCReader.ReadDBC(DBC.ScreenEffectStrings); + + DBC.Locale = DetectedLocale(); } - private LocalesDBC DetectedLocale + private LocalesDBC DetectedLocale() { - get + byte locale = 0; + while (DBC.Spell[DBC.SPELL_ENTRY_FOR_DETECT_LOCALE].GetName(locale) == string.Empty) { - byte locale = 0; - while (DBC.Spell[DBC.SPELL_ENTRY_FOR_DETECT_LOCALE].GetName(locale) == String.Empty) - { - ++locale; + ++locale; - if (locale >= DBC.MAX_DBC_LOCALE) - throw new SpellWorkException("Detected unknown locale index {0}", locale); - } - return (LocalesDBC)locale; + if (locale >= DBC.MAX_DBC_LOCALE) + throw new Exception("Detected unknown locale index " + locale); } + return (LocalesDBC)locale; } } } diff --git a/SpellWork/Program.cs b/SpellWork/Program.cs index cd48807c..207266d9 100644 --- a/SpellWork/Program.cs +++ b/SpellWork/Program.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; -using System.IO; namespace SpellWork { @@ -17,33 +14,15 @@ static void Main(string[] args) Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - if (!File.Exists(DBC.DBC_PATH + "Spell.dbc") || - !File.Exists(DBC.DBC_PATH + "SpellRadius.dbc") || - !File.Exists(DBC.DBC_PATH + "SpellRange.dbc") || - !File.Exists(DBC.DBC_PATH + "SpellDuration.dbc") || - !File.Exists(DBC.DBC_PATH + "SkillLineAbility.dbc") || - !File.Exists(DBC.DBC_PATH + "SkillLine.dbc") || - !File.Exists(DBC.DBC_PATH + "SpellCastTimes.dbc")) + try { - MessageBox.Show(String.Format("Files not found:\r\n" - + "{0}Spell.dbc\r\n" - + "{0}SpellRadius.dbc\r\n" - + "{0}SpellRange.dbc\r\n" - + "{0}SpellDuration.dbc\r\n" - + "{0}SkillLineAbility.dbc\r\n" - + "{0}SkillLine.dbc\r\n" - + "{0}SpellCastTimes.dbc\r\n", - DBC.DBC_PATH), - "SpellWork ERROR", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - Application.Exit(); - return; + new Loader(); + Application.Run(new FormMain()); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "SpellWork Eroor!", MessageBoxButtons.OK, MessageBoxIcon.Error); } - - new Loader(!(args.Count() > 0 && args[0].ToLower() == "nothread")); - - Application.Run(new FormMain()); } } -} +} \ No newline at end of file diff --git a/SpellWork/Spell/ProcInfo.cs b/SpellWork/Spell/ProcInfo.cs index abaa43e1..2120c9ba 100644 --- a/SpellWork/Spell/ProcInfo.cs +++ b/SpellWork/Spell/ProcInfo.cs @@ -16,7 +16,7 @@ public ProcInfo(TreeView familyTree, SpellFamilyNames spellfamily) familyTree.Nodes.Clear(); var spells = from Spell in DBC.Spell - where Spell.Value.SpellFamilyName == (uint)spellfamily + where Spell.Value.SpellClassOptions.SpellFamilyName == (uint)spellfamily join sk in DBC.SkillLineAbility on Spell.Key equals sk.Value.SpellId into temp1 from Skill in temp1.DefaultIfEmpty() join skl in DBC.SkillLine on Skill.Value.SkillId equals skl.Key into temp2 @@ -81,7 +81,7 @@ select new else mask[2] = 1U << (node.Index - 64); - if ((spell.SpellFamilyFlags.ContainsElement(mask))) + if ((spell.SpellClassOptions.SpellFamilyFlags.ContainsElement(mask))) { TreeNode child = new TreeNode(); child = node.Nodes.Add(name.ToString()); diff --git a/SpellWork/Spell/SpellInfo.cs b/SpellWork/Spell/SpellInfo.cs index 19590215..bce259f9 100644 --- a/SpellWork/Spell/SpellInfo.cs +++ b/SpellWork/Spell/SpellInfo.cs @@ -8,8 +8,20 @@ namespace SpellWork { class SpellInfo { - private RichTextBox rtb; + private RichTextBox rtb; private SpellEntry spell; + private SpellClassOptionsEntry classOptions; + private SpellTargetRestrictionsEntry targetRestrictions; + private SpellShapeshiftEntry spellShapeshift; + private SpellCategoriesEntry spellCategories; + private SpellLevelsEntry spellLevels; + private SpellEquippedItemsEntry spellEquippedItems; + private SpellAuraOptionsEntry spellAuraOptions; + private SpellCooldownsEntry spellCooldowns; + private SpellAuraRestrictionsEntry spellAuraRestrictions; + private SpellCastingRequirementsEntry spellCastingRequirements; + private SpellInterruptsEntry spellInterrupts; + private SpellPowerEntry spellPower; private string _line = "================================================="; @@ -17,7 +29,21 @@ public SpellInfo(RichTextBox rtb, SpellEntry spell) { this.rtb = rtb; this.spell = spell; - + + // cache dbc data to avoid multiple searching + this.classOptions = spell.SpellClassOptions; + this.targetRestrictions = spell.SpellTargetRestrictions; + this.spellShapeshift = spell.SpellShapeshift; + this.spellCategories = spell.SpellCategories; + this.spellLevels = spell.SpellLevels; + this.spellEquippedItems = spell.SpellEquippedItems; + this.spellAuraOptions = spell.SpellAuraOptions; + this.spellCooldowns = spell.SpellCooldowns; + this.spellAuraRestrictions = spell.SpellAuraRestrictions; + this.spellCastingRequirements = spell.SpellCastingRequirements; + this.spellInterrupts = spell.SpellInterrupts; + this.spellPower = spell.SpellPower; + ProcInfo.SpellProc = spell; ViewSpellInfo(); @@ -33,30 +59,34 @@ private void ViewSpellInfo() rtb.AppendFormatLine(_line); rtb.AppendFormatLineIfNotNull("Description: {0}", spell.Description); rtb.AppendFormatLineIfNotNull("ToolTip: {0}", spell.ToolTip); - rtb.AppendFormatLineIfNotNull("Modal Next Spell: {0}", spell.ModalNextSpell); - if(spell.Description != string.Empty && spell.ToolTip != string.Empty && spell.ModalNextSpell != 0) + rtb.AppendFormatLineIfNotNull("Modal Next Spell: {0}", classOptions.ModalNextSpell); + if (spell.Description != string.Empty && spell.ToolTip != string.Empty && classOptions.ModalNextSpell != 0) rtb.AppendFormatLine(_line); rtb.AppendFormatLine("Category = {0}, SpellIconID = {1}, activeIconID = {2}, SpellVisual = ({3},{4})", - spell.Category, spell.SpellIconID, spell.ActiveIconID, spell.SpellVisual[0], spell.SpellVisual[1]); + spellCategories.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]); + if (classOptions.SpellFamilyFlags != null) + rtb.AppendFormatLine("Family {0}, flag 0x{1:X8} {2:X8} {3:X8}", + (SpellFamilyNames)classOptions.SpellFamilyName, classOptions.SpellFamilyFlags[2], classOptions.SpellFamilyFlags[1], classOptions.SpellFamilyFlags[0]); + else + rtb.AppendFormatLine("Family {0}, flag 0x{1:X8} {2:X8} {3:X8}", + (SpellFamilyNames)classOptions.SpellFamilyName, 0, 0, 0); rtb.AppendLine(); rtb.AppendFormatLine("SpellSchoolMask = {0} ({1})", spell.SchoolMask, spell.School); - rtb.AppendFormatLine("DamageClass = {0} ({1})", spell.DmgClass, (SpellDmgClass)spell.DmgClass); - rtb.AppendFormatLine("PreventionType = {0} ({1})", spell.PreventionType, (SpellPreventionType)spell.PreventionType); + rtb.AppendFormatLine("DamageClass = {0} ({1})", spellCategories.DmgClass, (SpellDmgClass)spellCategories.DmgClass); + rtb.AppendFormatLine("PreventionType = {0} ({1})", spellCategories.PreventionType, (SpellPreventionType)spellCategories.PreventionType); - if (spell.Attributes != 0 || spell.AttributesEx != 0 || spell.AttributesEx2 != 0 || spell.AttributesEx3 != 0 + 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) rtb.AppendLine(_line); if (spell.Attributes != 0) - rtb.AppendFormatLine("Attributes: 0x{0:X8} ({1})", spell.Attributes, (SpellAtribute)spell.Attributes); + rtb.AppendFormatLine("Attributes: 0x{0:X8} ({1})", spell.Attributes, (SpellAtribute)spell.Attributes); if (spell.AttributesEx != 0) - rtb.AppendFormatLine("AttributesEx1: 0x{0:X8} ({1})", spell.AttributesEx, (SpellAtributeEx)spell.AttributesEx); + rtb.AppendFormatLine("AttributesEx1: 0x{0:X8} ({1})", spell.AttributesEx, (SpellAtributeEx)spell.AttributesEx); if (spell.AttributesEx2 != 0) rtb.AppendFormatLine("AttributesEx2: 0x{0:X8} ({1})", spell.AttributesEx2, (SpellAtributeEx2)spell.AttributesEx2); if (spell.AttributesEx3 != 0) @@ -71,114 +101,114 @@ private void ViewSpellInfo() rtb.AppendFormatLine("AttributesExG: 0x{0:X8} ({1})", spell.AttributesExG, (SpellAtributeExG)spell.AttributesExG); rtb.AppendLine(_line); - - if (spell.Targets != 0) - rtb.AppendFormatLine("Targets Mask = 0x{0:X8} ({1})", spell.Targets, (SpellCastTargetFlags)spell.Targets); - if (spell.TargetCreatureType != 0) - rtb.AppendFormatLine("Creature Type Mask = 0x{0:X8} ({1})", - spell.TargetCreatureType, (CreatureTypeMask)spell.TargetCreatureType); + if (targetRestrictions.Targets != 0) + rtb.AppendFormatLine("Targets Mask = 0x{0:X8} ({1})", targetRestrictions.Targets, (SpellCastTargetFlags)targetRestrictions.Targets); - if (spell.Stances != 0) - rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)spell.Stances); + if (targetRestrictions.TargetCreatureType != 0) + rtb.AppendFormatLine("Creature Type Mask = 0x{0:X8} ({1})", + targetRestrictions.TargetCreatureType, (CreatureTypeMask)targetRestrictions.TargetCreatureType); - if (spell.StancesNot != 0) - rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)spell.StancesNot); + if (spellShapeshift.Stances != 0) + rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)spellShapeshift.Stances); + + if (spellShapeshift.StancesNot != 0) + rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)spellShapeshift.StancesNot); AppendSkillLine(); - rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}, maxTarget {3}", - spell.SpellLevel, spell.BaseLevel, spell.MaxLevel, spell.MaxTargetLevel); + rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}, maxTarget {3}", + spellLevels.SpellLevel, spellLevels.BaseLevel, spellLevels.MaxLevel, targetRestrictions.MaxTargetLevel); - if (spell.EquippedItemClass != -1) + if (spellEquippedItems.EquippedItemClass != -1) { - rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", spell.EquippedItemClass, (ItemClass)spell.EquippedItemClass); + rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", spellEquippedItems.EquippedItemClass, (ItemClass)spellEquippedItems.EquippedItemClass); - if (spell.EquippedItemSubClassMask != 0) + if (spellEquippedItems.EquippedItemSubClassMask != 0) { - switch ((ItemClass)spell.EquippedItemClass) + switch ((ItemClass)spellEquippedItems.EquippedItemClass) { case ItemClass.WEAPON: - rtb.AppendFormatLine(" SubClass mask 0x{0:X8} ({1})", - spell.EquippedItemSubClassMask, (ItemSubClassWeaponMask)spell.EquippedItemSubClassMask); + rtb.AppendFormatLine(" SubClass mask 0x{0:X8} ({1})", + spellEquippedItems.EquippedItemSubClassMask, (ItemSubClassWeaponMask)spellEquippedItems.EquippedItemSubClassMask); break; case ItemClass.ARMOR: - rtb.AppendFormatLine(" SubClass mask 0x{0:X8} ({1})", - spell.EquippedItemSubClassMask, (ItemSubClassArmorMask)spell.EquippedItemSubClassMask); + rtb.AppendFormatLine(" SubClass mask 0x{0:X8} ({1})", + spellEquippedItems.EquippedItemSubClassMask, (ItemSubClassArmorMask)spellEquippedItems.EquippedItemSubClassMask); break; case ItemClass.MISC: - rtb.AppendFormatLine(" SubClass mask 0x{0:X8} ({1})", - spell.EquippedItemSubClassMask, (ItemSubClassMiscMask)spell.EquippedItemSubClassMask); + rtb.AppendFormatLine(" SubClass mask 0x{0:X8} ({1})", + spellEquippedItems.EquippedItemSubClassMask, (ItemSubClassMiscMask)spellEquippedItems.EquippedItemSubClassMask); break; } } - if (spell.EquippedItemInventoryTypeMask != 0) - rtb.AppendFormatLine(" InventoryType mask = 0x{0:X8} ({1})", - spell.EquippedItemInventoryTypeMask, (InventoryTypeMask)spell.EquippedItemInventoryTypeMask); + if (spellEquippedItems.EquippedItemInventoryTypeMask != 0) + rtb.AppendFormatLine(" InventoryType mask = 0x{0:X8} ({1})", + spellEquippedItems.EquippedItemInventoryTypeMask, (InventoryTypeMask)spellEquippedItems.EquippedItemInventoryTypeMask); } rtb.AppendLine(); - rtb.AppendFormatLine("Category = {0}", spell.Category); - rtb.AppendFormatLine("DispelType = {0} ({1})", spell.Dispel, (DispelType)spell.Dispel); - rtb.AppendFormatLine("Mechanic = {0} ({1})", spell.Mechanic, (Mechanics)spell.Mechanic); - + rtb.AppendFormatLine("Category = {0}", spellCategories.Category); + rtb.AppendFormatLine("DispelType = {0} ({1})", spellCategories.Dispel, (DispelType)spellCategories.Dispel); + rtb.AppendFormatLine("Mechanic = {0} ({1})", spellCategories.Mechanic, (Mechanics)spellCategories.Mechanic); + rtb.AppendLine(spell.Range); rtb.AppendFormatLineIfNotNull("Speed {0:F}", spell.Speed); - rtb.AppendFormatLineIfNotNull("Stackable up to {0}", spell.StackAmount); - + rtb.AppendFormatLineIfNotNull("Stackable up to {0}", spellAuraOptions.StackAmount); + rtb.AppendLine(spell.CastTime); - if (spell.RecoveryTime != 0 || spell.CategoryRecoveryTime != 0 || spell.StartRecoveryCategory != 0) + if (spellCooldowns.RecoveryTime != 0 || spellCooldowns.CategoryRecoveryTime != 0 || spellCategories.StartRecoveryCategory != 0) { - rtb.AppendFormatLine("RecoveryTime: {0} ms, CategoryRecoveryTime: {1} ms", spell.RecoveryTime, spell.CategoryRecoveryTime); - rtb.AppendFormatLine("StartRecoveryCategory = {0}, StartRecoveryTime = {1:F} ms", spell.StartRecoveryCategory, spell.StartRecoveryTime); + rtb.AppendFormatLine("RecoveryTime: {0} ms, CategoryRecoveryTime: {1} ms", spellCooldowns.RecoveryTime, spellCooldowns.CategoryRecoveryTime); + rtb.AppendFormatLine("StartRecoveryCategory = {0}, StartRecoveryTime = {1:F} ms", spellCategories.StartRecoveryCategory, spellCooldowns.StartRecoveryTime); } rtb.AppendLine(spell.Duration); - if (spell.ManaCost != 0 || spell.ManaCostPercentage != 0) + if (spellPower.ManaCost != 0 || spellPower.ManaCostPercentage != 0) { - rtb.AppendFormat("Power {0}, Cost {1}", - (Powers)spell.PowerType, spell.ManaCost == 0 ? spell.ManaCostPercentage.ToString() + " %" : spell.ManaCost.ToString()); - rtb.AppendFormatIfNotNull(" + lvl * {0}", spell.ManaCostPerlevel); - rtb.AppendFormatIfNotNull(" + {0} Per Second", spell.ManaPerSecond); - rtb.AppendFormatIfNotNull(" + lvl * {0}", spell.ManaPerSecondPerLevel); + rtb.AppendFormat("Power {0}, Cost {1}", + (Powers)spell.PowerType, spellPower.ManaCost == 0 ? spellPower.ManaCostPercentage.ToString() + " %" : spellPower.ManaCost.ToString()); + rtb.AppendFormatIfNotNull(" + lvl * {0}", spellPower.ManaCostPerlevel); + rtb.AppendFormatIfNotNull(" + {0} Per Second", spellPower.ManaPerSecond); + //rtb.AppendFormatIfNotNull(" + lvl * {0}", spellPower.ManaPerSecondPerLevel); rtb.AppendLine(); } rtb.AppendFormatLine("Interrupt Flags: 0x{0:X8}, AuraIF 0x{1:X8}, ChannelIF 0x{2:X8}", - spell.InterruptFlags, spell.AuraInterruptFlags, spell.ChannelInterruptFlags); + spellInterrupts.InterruptFlags, spellInterrupts.AuraInterruptFlags, spellInterrupts.ChannelInterruptFlags); - if (spell.CasterAuraState != 0) - rtb.AppendFormatLine("CasterAuraState = {0} ({1})", spell.CasterAuraState, (AuraState)spell.CasterAuraState); + if (spellAuraRestrictions.CasterAuraState != 0) + rtb.AppendFormatLine("CasterAuraState = {0} ({1})", spellAuraRestrictions.CasterAuraState, (AuraState)spellAuraRestrictions.CasterAuraState); - if (spell.TargetAuraState != 0) - rtb.AppendFormatLine("TargetAuraState = {0} ({1})", spell.TargetAuraState, (AuraState)spell.TargetAuraState); + if (spellAuraRestrictions.TargetAuraState != 0) + rtb.AppendFormatLine("TargetAuraState = {0} ({1})", spellAuraRestrictions.TargetAuraState, (AuraState)spellAuraRestrictions.TargetAuraState); - if (spell.CasterAuraStateNot != 0) - rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", spell.CasterAuraStateNot, (AuraState)spell.CasterAuraStateNot); + if (spellAuraRestrictions.CasterAuraStateNot != 0) + rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", spellAuraRestrictions.CasterAuraStateNot, (AuraState)spellAuraRestrictions.CasterAuraStateNot); - if (spell.TargetAuraStateNot != 0) - rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", spell.TargetAuraStateNot, (AuraState)spell.TargetAuraStateNot); + if (spellAuraRestrictions.TargetAuraStateNot != 0) + rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", spellAuraRestrictions.TargetAuraStateNot, (AuraState)spellAuraRestrictions.TargetAuraStateNot); AppendSpellAura(); - rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", spell.RequiresSpellFocus); + rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", spellCastingRequirements.RequiresSpellFocus); - if (spell.ProcFlags != 0) + if (spellAuraOptions.ProcFlags != 0) { rtb.SetBold(); rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance = {1}, charges - {2}", - spell.ProcFlags, spell.ProcChance, spell.ProcCharges); + spellAuraOptions.ProcFlags, spellAuraOptions.ProcChance, spellAuraOptions.ProcCharges); rtb.SetDefaultStyle(); rtb.AppendFormatLine(_line); rtb.AppendText(spell.ProcInfo); } else { - rtb.AppendFormatLine("Chance = {0}, charges - {1}", spell.ProcChance, spell.ProcCharges); + rtb.AppendFormatLine("Chance = {0}, charges - {1}", spellAuraOptions.ProcChance, spellAuraOptions.ProcCharges); } AppendSpellEffectInfo(); @@ -191,17 +221,17 @@ private void AppendSkillLine() join skillLine in DBC.SkillLine on skillLineAbility.Value.SkillId equals skillLine.Key where skillLineAbility.Value.SpellId == spell.ID - select new - { - skillLineAbility, - skillLine + select new + { + skillLineAbility, + skillLine }; if (query.Count() == 0) return; var skill = query.First().skillLineAbility.Value; - var line = query.First().skillLine.Value; + var line = query.First().skillLine.Value; rtb.AppendFormatLine("Skill (Id {0}) \"{1}\"", skill.SkillId, line.Name); rtb.AppendFormat(" ReqSkillValue {0}", skill.Req_skill_value); @@ -216,67 +246,74 @@ private void AppendSpellEffectInfo() for (int EFFECT_INDEX = 0; EFFECT_INDEX < DBC.MAX_EFFECT_INDEX; EFFECT_INDEX++) { + if (!spell.HasEffectAtIndex(EFFECT_INDEX)) + continue; + + SpellEffectEntry effect = spell.GetEffect(EFFECT_INDEX); + rtb.SetBold(); - if ((SpellEffects)spell.Effect[EFFECT_INDEX] == SpellEffects.NO_SPELL_EFFECT) + if ((SpellEffects)effect.Effect == SpellEffects.NO_SPELL_EFFECT) { rtb.AppendFormatLine("Effect {0}: NO EFFECT", EFFECT_INDEX); rtb.AppendLine(); continue; } - rtb.AppendFormatLine("Effect {0}: Id {1} ({2})", EFFECT_INDEX, spell.Effect[EFFECT_INDEX], (SpellEffects)spell.Effect[EFFECT_INDEX]); + rtb.AppendFormatLine("Effect {0}: Id {1} ({2})", EFFECT_INDEX, effect.Effect, (SpellEffects)effect.Effect); rtb.SetDefaultStyle(); - rtb.AppendFormat("BasePoints = {0}", spell.EffectBasePoints[EFFECT_INDEX] + 1); - - if (spell.EffectRealPointsPerLevel[EFFECT_INDEX] != 0) - rtb.AppendFormat(" + Level * {0:F}", spell.EffectRealPointsPerLevel[EFFECT_INDEX]); + rtb.AppendFormat("BasePoints = {0}", effect.EffectBasePoints + 1); + + if (effect.EffectRealPointsPerLevel != 0) + rtb.AppendFormat(" + Level * {0:F}", effect.EffectRealPointsPerLevel); // WTF ? 1 = spell.EffectBaseDice[i] - if (1 < spell.EffectDieSides[EFFECT_INDEX]) + if (1 < effect.EffectDieSides) { - if (spell.EffectRealPointsPerLevel[EFFECT_INDEX] != 0) + if (effect.EffectRealPointsPerLevel != 0) rtb.AppendFormat(" to {0} + lvl * {1:F}", - spell.EffectBasePoints[EFFECT_INDEX] + 1 + spell.EffectDieSides[EFFECT_INDEX], spell.EffectRealPointsPerLevel[EFFECT_INDEX]); + effect.EffectBasePoints + 1 + effect.EffectDieSides, effect.EffectRealPointsPerLevel); else - rtb.AppendFormat(" to {0}", spell.EffectBasePoints[EFFECT_INDEX] + 1 + spell.EffectDieSides[EFFECT_INDEX]); + rtb.AppendFormat(" to {0}", effect.EffectBasePoints + 1 + effect.EffectDieSides); } - rtb.AppendFormatIfNotNull(" + combo * {0:F}", spell.EffectPointsPerComboPoint[EFFECT_INDEX]); + rtb.AppendFormatIfNotNull(" + combo * {0:F}", effect.EffectPointsPerComboPoint); - if (spell.DmgMultiplier[EFFECT_INDEX] != 1.0f) - rtb.AppendFormat(" x {0:F}", spell.DmgMultiplier[EFFECT_INDEX]); + if (effect.DmgMultiplier != 1.0f) + rtb.AppendFormat(" x {0:F}", effect.DmgMultiplier); - rtb.AppendFormatIfNotNull(" Multiple = {0:F}", spell.EffectMultipleValue[EFFECT_INDEX]); + rtb.AppendFormatIfNotNull(" Multiple = {0:F}", effect.EffectMultipleValue); rtb.AppendLine(); rtb.AppendFormatLine("Targets ({0}, {1}) ({2}, {3})", - spell.EffectImplicitTargetA[EFFECT_INDEX], spell.EffectImplicitTargetB[EFFECT_INDEX], - (Targets)spell.EffectImplicitTargetA[EFFECT_INDEX], (Targets)spell.EffectImplicitTargetB[EFFECT_INDEX]); + effect.EffectImplicitTargetA, effect.EffectImplicitTargetB, + (Targets)effect.EffectImplicitTargetA, (Targets)effect.EffectImplicitTargetB); AuraModTypeName(EFFECT_INDEX); 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; - } + + ClassMask = effect.EffectSpellClassMaskA; + + //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) + where Spell.SpellClassOptions.Match(classOptions, 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, + SpellID = Spell.ID, SpellName = Spell.SpellNameRank, - SkillId = Skill.Value.SkillId + SkillId = Skill.Value.SkillId }; foreach (var row in query) @@ -284,7 +321,7 @@ select new if (row.SkillId > 0) { rtb.SelectionColor = Color.Blue; - rtb.AppendFormatLine("\t+ {0} - {1}", row.SpellID, row.SpellName); + rtb.AppendFormatLine("\t+ {0} - {1}", row.SpellID, row.SpellName); } else { @@ -296,22 +333,23 @@ select new } rtb.AppendFormatLineIfNotNull("{0}", spell.GetRadius(EFFECT_INDEX)); - + // append trigger spell - uint trigger = spell.EffectTriggerSpell[EFFECT_INDEX]; + uint trigger = spell.GetEffect(EFFECT_INDEX).EffectTriggerSpell; if (trigger != 0) { if (DBC.Spell.ContainsKey(trigger)) { SpellEntry triggerSpell = DBC.Spell[trigger]; rtb.SetStyle(Color.Blue, FontStyle.Bold); - rtb.AppendFormatLine(" Trigger spell ({0}) {1}. Chance = {2}", trigger, triggerSpell.SpellNameRank, spell.ProcChance); + rtb.AppendFormatLine(" Trigger spell ({0}) {1}. Chance = {2}", trigger, triggerSpell.SpellNameRank, spellAuraOptions.ProcChance); rtb.AppendFormatLineIfNotNull(" Description: {0}", triggerSpell.Description); rtb.AppendFormatLineIfNotNull(" ToolTip: {0}", triggerSpell.ToolTip); rtb.SetDefaultStyle(); - if (triggerSpell.ProcFlags != 0) + var triggerAuraOptions = triggerSpell.SpellAuraOptions; + if (triggerAuraOptions.ProcFlags != 0) { - rtb.AppendFormatLine("Charges - {0}", triggerSpell.ProcCharges); + rtb.AppendFormatLine("Charges - {0}", triggerAuraOptions.ProcCharges); rtb.AppendLine(_line); rtb.AppendLine(triggerSpell.ProcInfo); rtb.AppendLine(_line); @@ -319,15 +357,15 @@ select new } else { - rtb.AppendFormatLine("Trigger spell ({0}) Not found, Chance = {1}", trigger, spell.ProcChance); + rtb.AppendFormatLine("Trigger spell ({0}) Not found, Chance = {1}", trigger, spellAuraOptions.ProcChance); } } - rtb.AppendFormatLineIfNotNull("EffectChainTarget = {0}", spell.EffectChainTarget[EFFECT_INDEX]); - rtb.AppendFormatLineIfNotNull("EffectItemType = {0}", spell.EffectItemType[EFFECT_INDEX]); + rtb.AppendFormatLineIfNotNull("EffectChainTarget = {0}", effect.EffectChainTarget); + rtb.AppendFormatLineIfNotNull("EffectItemType = {0}", effect.EffectItemType); - if((Mechanics)spell.EffectMechanic[EFFECT_INDEX] != Mechanics.MECHANIC_NONE) - rtb.AppendFormatLine("Effect Mechanic = {0} ({1})", spell.EffectMechanic[EFFECT_INDEX], (Mechanics)spell.EffectMechanic[EFFECT_INDEX]); + if ((Mechanics)effect.EffectMechanic != Mechanics.MECHANIC_NONE) + rtb.AppendFormatLine("Effect Mechanic = {0} ({1})", effect.EffectMechanic, (Mechanics)effect.EffectMechanic); rtb.AppendLine(); } @@ -335,57 +373,58 @@ select new private void AppendSpellAura() { - if (spell.CasterAuraSpell != 0) + if (spellAuraRestrictions.CasterAuraSpell != 0) { - if(DBC.Spell.ContainsKey(spell.CasterAuraSpell)) - rtb.AppendFormatLine(" Caster Aura Spell ({0}) {1}", spell.CasterAuraSpell, DBC.Spell[spell.CasterAuraSpell].SpellName); + if (DBC.Spell.ContainsKey(spellAuraRestrictions.CasterAuraSpell)) + rtb.AppendFormatLine(" Caster Aura Spell ({0}) {1}", spellAuraRestrictions.CasterAuraSpell, DBC.Spell[spellAuraRestrictions.CasterAuraSpell].SpellName); else - rtb.AppendFormatLine(" Caster Aura Spell ({0}) ?????", spell.CasterAuraSpell); + rtb.AppendFormatLine(" Caster Aura Spell ({0}) ?????", spellAuraRestrictions.CasterAuraSpell); } - if (spell.TargetAuraSpell != 0) + if (spellAuraRestrictions.TargetAuraSpell != 0) { - if(DBC.Spell.ContainsKey(spell.TargetAuraSpell)) - rtb.AppendFormatLine(" Target Aura Spell ({0}) {1}", spell.TargetAuraSpell, DBC.Spell[spell.TargetAuraSpell].SpellName); + if (DBC.Spell.ContainsKey(spellAuraRestrictions.TargetAuraSpell)) + rtb.AppendFormatLine(" Target Aura Spell ({0}) {1}", spellAuraRestrictions.TargetAuraSpell, DBC.Spell[spellAuraRestrictions.TargetAuraSpell].SpellName); else - rtb.AppendFormatLine(" Target Aura Spell ({0}) ?????", spell.TargetAuraSpell); + rtb.AppendFormatLine(" Target Aura Spell ({0}) ?????", spellAuraRestrictions.TargetAuraSpell); } - if (spell.ExcludeCasterAuraSpell != 0) + if (spellAuraRestrictions.ExcludeCasterAuraSpell != 0) { - if(DBC.Spell.ContainsKey(spell.ExcludeCasterAuraSpell)) - rtb.AppendFormatLine(" Ex Caster Aura Spell ({0}) {1}", spell.ExcludeCasterAuraSpell, DBC.Spell[spell.ExcludeCasterAuraSpell].SpellName); + if (DBC.Spell.ContainsKey(spellAuraRestrictions.ExcludeCasterAuraSpell)) + rtb.AppendFormatLine(" Ex Caster Aura Spell ({0}) {1}", spellAuraRestrictions.ExcludeCasterAuraSpell, DBC.Spell[spellAuraRestrictions.ExcludeCasterAuraSpell].SpellName); else - rtb.AppendFormatLine(" Ex Caster Aura Spell ({0}) ?????", spell.ExcludeCasterAuraSpell); + rtb.AppendFormatLine(" Ex Caster Aura Spell ({0}) ?????", spellAuraRestrictions.ExcludeCasterAuraSpell); } - if (spell.ExcludeTargetAuraSpell != 0) + if (spellAuraRestrictions.ExcludeTargetAuraSpell != 0) { - if(DBC.Spell.ContainsKey(spell.ExcludeTargetAuraSpell)) - rtb.AppendFormatLine(" Ex Target Aura Spell ({0}) {1}", spell.ExcludeTargetAuraSpell, DBC.Spell[spell.ExcludeTargetAuraSpell].SpellName); + if (DBC.Spell.ContainsKey(spellAuraRestrictions.ExcludeTargetAuraSpell)) + rtb.AppendFormatLine(" Ex Target Aura Spell ({0}) {1}", spellAuraRestrictions.ExcludeTargetAuraSpell, DBC.Spell[spellAuraRestrictions.ExcludeTargetAuraSpell].SpellName); else - rtb.AppendFormatLine(" Ex Target Aura Spell ({0}) ?????", spell.ExcludeTargetAuraSpell); + rtb.AppendFormatLine(" Ex Target Aura Spell ({0}) ?????", spellAuraRestrictions.ExcludeTargetAuraSpell); } } private void AuraModTypeName(int index) { - AuraType aura = (AuraType)spell.EffectApplyAuraName[index]; - int misc = spell.EffectMiscValue[index]; + SpellEffectEntry effect = spell.GetEffect(index); + AuraType aura = (AuraType)effect.EffectApplyAuraName; + int misc = effect.EffectMiscValue; - if (spell.EffectApplyAuraName[index] == 0) + if (effect.EffectApplyAuraName == 0) { - rtb.AppendFormatLineIfNotNull("EffectMiscValueA = {0}", spell.EffectMiscValue[index]); - rtb.AppendFormatLineIfNotNull("EffectMiscValueB = {0}", spell.EffectMiscValueB[index]); - rtb.AppendFormatLineIfNotNull("EffectAmplitude = {0}", spell.EffectAmplitude[index]); - + rtb.AppendFormatLineIfNotNull("EffectMiscValueA = {0}", effect.EffectMiscValue); + rtb.AppendFormatLineIfNotNull("EffectMiscValueB = {0}", effect.EffectMiscValueB); + rtb.AppendFormatLineIfNotNull("EffectAmplitude = {0}", effect.EffectAmplitude); + return; } rtb.AppendFormat("Aura Id {0:D} ({0})", aura); - rtb.AppendFormat(", value = {0}", spell.EffectBasePoints[index] + 1); + rtb.AppendFormat(", value = {0}", effect.EffectBasePoints + 1); rtb.AppendFormat(", misc = {0} (", misc); - + switch (aura) { case AuraType.SPELL_AURA_MOD_STAT: @@ -404,8 +443,8 @@ private void AuraModTypeName(int index) break; } - rtb.AppendFormat("), miscB = {0}", spell.EffectMiscValueB[index]); - rtb.AppendFormatLine(", periodic = {0}", spell.EffectAmplitude[index]); + rtb.AppendFormat("), miscB = {0}", effect.EffectMiscValueB); + rtb.AppendFormatLine(", periodic = {0}", effect.EffectAmplitude); switch (aura) { @@ -447,9 +486,9 @@ private void AppendItemInfo() { if (!MySQLConnect.Connected) return; - - var items = from item in DBC.ItemTemplate - where item.SpellID.ContainsElement(spell.ID) + + var items = from item in DBC.ItemTemplate + where item.SpellID.ContainsElement(spell.ID) select item; if (items.Count() == 0) @@ -464,7 +503,7 @@ where item.SpellID.ContainsElement(spell.ID) { string name = item.LocalesName == string.Empty ? item.Name : item.LocalesName; string desc = item.LocalesDescription == string.Empty ? item.Description : item.LocalesDescription; - + desc = desc == string.Empty ? string.Empty : string.Format("({0})", desc); rtb.AppendFormatLine(@" {0} - {1} {2} ", item.Entry, name, desc); diff --git a/SpellWork/SpellWork.csproj b/SpellWork/SpellWork.csproj index 984adda3..12d05152 100644 --- a/SpellWork/SpellWork.csproj +++ b/SpellWork/SpellWork.csproj @@ -34,28 +34,41 @@ false true - + true - full - false bin\Debug\ DEBUG;TRACE - prompt - 4 true + full + x86 + bin\Debug\SpellWork.exe.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt AllRules.ruleset + ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + false + ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + false + false - - pdbonly - true + bin\Release\ DEBUG;TRACE - prompt - 4 true + true + pdbonly + x86 + bin\Release\SpellWork.exe.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt AllRules.ruleset - - + ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets + false + ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules + false + false @@ -114,8 +127,6 @@ FormSettings.cs - - diff --git a/SpellWork_VC2010.sln b/SpellWork_VS2010.sln similarity index 55% rename from SpellWork_VC2010.sln rename to SpellWork_VS2010.sln index 7fd65dc2..12ebdc67 100644 --- a/SpellWork_VC2010.sln +++ b/SpellWork_VS2010.sln @@ -5,14 +5,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpellWork", "SpellWork\Spel EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {49A3559B-529A-4406-824B-F7E2831DE1B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {49A3559B-529A-4406-824B-F7E2831DE1B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {49A3559B-529A-4406-824B-F7E2831DE1B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {49A3559B-529A-4406-824B-F7E2831DE1B2}.Release|Any CPU.Build.0 = Release|Any CPU + {49A3559B-529A-4406-824B-F7E2831DE1B2}.Debug|x86.ActiveCfg = Debug|x86 + {49A3559B-529A-4406-824B-F7E2831DE1B2}.Debug|x86.Build.0 = Debug|x86 + {49A3559B-529A-4406-824B-F7E2831DE1B2}.Release|x86.ActiveCfg = Release|x86 + {49A3559B-529A-4406-824B-F7E2831DE1B2}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE