示例#1
0
        private void ProcParse(object sender)
        {
            SpellProcEventEntry proc  = MySQLConnect.SpellProcEvent[((ListView)sender).SelectedIndices[0]];
            SpellEntry          spell = DBC.Spell[proc.ID];

            ProcInfo.SpellProc = spell;

            new SpellInfo(_rtbProcSpellInfo, spell);

            SpellProc_spellFilter.Search(proc.ID.ToString());

            _clbSchools.SetCheckedItemFromFlag(proc.SchoolMask);
            _clbProcFlags.SetCheckedItemFromFlag(proc.ProcFlags);
            _clbProcFlagEx.SetCheckedItemFromFlag(proc.ProcEx);

            _cbProcSpellFamilyTree.SelectedValue  = proc.SpellFamilyName;
            _cbProcFitstSpellFamily.SelectedValue = proc.SpellFamilyName;

            _tbPPM.Text      = proc.PpmRate.ToString();
            _tbChance.Text   = proc.CustomChance.ToString();
            _tbCooldown.Text = proc.Cooldown.ToString();

            _tvFamilyTree.SetMask(proc.SpellFamilyMask);
            GetProcAttribute(spell);
            tabControl1.SelectedIndex = 1;
        }
示例#2
0
 private void AddSpellToExplorer(SpellEntry S)
 {
     DynamicObject D = new DynamicObject(S);
     if (cbDBfields.Checked)
         D.Filter = String.Join(";", SpellDBC.SpellDBCFields.ToArray());
     pg_Spell.SelectedObject = D;
 }
示例#3
0
 public DynamicObject(SpellEntry S)
 {
     Spell = S;
     foreach (FieldInfo f in Spell.GetType().GetFields())
     {
         AddProperty(f);
     }
 }
示例#4
0
        public SpellInfo(RichTextBox rtb, SpellEntry spell)
        {
            this.rtb   = rtb;
            this.spell = spell;

            ProcInfo.SpellProc = spell;

            ViewSpellInfo();
        }
示例#5
0
 private void Ok_Click(object sender, EventArgs e)
 {
     if (_lvSpellList.SelectedIndices.Count > 0)
     {
         Spell             = _spellList[_lvSpellList.SelectedIndices[0]];
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
示例#6
0
        public SpellInfo(RichTextBox rtb, SpellEntry spell)
        {
            this.rtb = rtb;
            this.spell = spell;

            ProcInfo.SpellProc = spell;

            ViewSpellInfo();
        }
示例#7
0
        public static string CreateSpellPatch(SpellEntry Current)
        {
            int ssize = Marshal.SizeOf(typeof(SpellEntry)) / sizeof(Int32);

            Int32[]    OriginalS = new Int32[ssize];
            Int32[]    CurrentS  = new Int32[ssize];
            IntPtr     O_ptr     = Marshal.AllocHGlobal(ssize * sizeof(Int32));
            IntPtr     C_ptr     = Marshal.AllocHGlobal(ssize * sizeof(Int32));
            SpellEntry O         = DBC.Spell[Current.ID];

            Marshal.StructureToPtr(O, O_ptr, false);
            Marshal.StructureToPtr(Current, C_ptr, false);
            Marshal.Copy(O_ptr, OriginalS, 0, ssize);
            Marshal.Copy(C_ptr, CurrentS, 0, ssize);
            StringBuilder res = new StringBuilder();

            for (int i = 0; i < ssize; i++)
            {
                if (CurrentS[i] != OriginalS[i])
                {
                    res.AppendFormat("{0} {1} ", i.ToString(), CurrentS[i].ToString());
                }
            }

            string result = "";

            if (res.Length > 0)
            {
                StringBuilder diff = new StringBuilder();

                foreach (FieldInfo f in typeof(SpellEntry).GetFields())
                {
                    if (f.GetValueDirect(__makeref(Current)).ToString() != f.GetValueDirect(__makeref(O)).ToString())
                    {
                        diff.AppendFormat("{0} ", f.Name);
                    }
                    if (f.FieldType.IsArray)
                    {
                        Array a = (Array)f.GetValue(Current);
                        Array b = (Array)f.GetValue(O);
                        for (int i = 0; i < a.Length; i++)
                        {
                            if (a.GetValue(i).ToString() != b.GetValue(i).ToString())
                            {
                                diff.AppendFormat("{0}{1} ", f.Name, (i + 1).ToString());
                            }
                        }
                    }
                }
                result = String.Format("REPLACE INTO spell_patch VALUES ({0},'Spell.dbc','{1}','{2}-{0} (Update {3})');\r\n", O.ID, res.ToString().TrimEnd(' '), O.SpellName, diff.ToString());
            }

            Marshal.FreeHGlobal(O_ptr);
            Marshal.FreeHGlobal(C_ptr);
            return(result);
        }
示例#8
0
        private void cbDBfields_CheckedChanged(object sender, EventArgs e)
        {
            DynamicObject D = pg_Spell.SelectedObject as DynamicObject;

            if (D != null)
            {
                SpellEntry S = D.Spell;
                AddSpellToExplorer(S);
            }
        }
示例#9
0
        private void AddSpellToExplorer(SpellEntry S)
        {
            DynamicObject D = new DynamicObject(S);

            if (cbDBfields.Checked)
            {
                D.Filter = String.Join(";", SpellDBC.SpellDBCFields.ToArray());
            }
            pg_Spell.SelectedObject = D;
        }
示例#10
0
        string[] words = new[] { "=====" };// todo: more wodrs

        /// <summary>
        /// Compares two spells
        /// </summary>
        /// <param name="rtb1">RichTextBox 1 in left</param>
        /// <param name="rtb2">RichTextBox 2 in right</param>
        /// <param name="spell1">Compare Spell 1</param>
        /// <param name="spell2">Compare Spell 2</param>
        public SpellCompare(RichTextBox rtb1, RichTextBox rtb2, SpellEntry spell1, SpellEntry spell2)
        {
            new SpellInfo(rtb1, spell1);
            new SpellInfo(rtb2, spell2);

            string[] strsl = rtb1.Text.Split('\n');
            string[] strsr = rtb2.Text.Split('\n');

            int pos = 0;

            foreach (string str in strsl)
            {
                pos += str.Length + 1;
                rtb1.Select(pos - str.Length - 1, pos - 1);

                if (rtb2.Find(str, RichTextBoxFinds.WholeWord) != -1)
                {
                    if (str.ContainsText(words))
                    {
                        rtb1.SelectionBackColor = rtb1.BackColor;
                    }
                    else
                    {
                        rtb1.SelectionBackColor = Color.Cyan;
                    }
                }
                else
                {
                    rtb1.SelectionBackColor = Color.Salmon;
                }
            }

            pos = 0;
            foreach (string str in strsr)
            {
                pos += str.Length + 1;
                rtb2.Select(pos - str.Length - 1, pos - 1);

                if (rtb1.Find(str, RichTextBoxFinds.WholeWord) != -1)
                {
                    if (str.ContainsText(words))
                    {
                        rtb2.SelectionBackColor = rtb2.BackColor;
                    }
                    else
                    {
                        rtb2.SelectionBackColor = Color.Cyan;
                    }
                }
                else
                {
                    rtb2.SelectionBackColor = Color.Salmon;
                }
            }
        }
示例#11
0
        string[] words = new[] { "=====" }; // todo: more wodrs

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Compares two spells
        /// </summary>
        /// <param name="rtb1">RichTextBox 1 in left</param>
        /// <param name="rtb2">RichTextBox 2 in right</param>
        /// <param name="spell1">Compare Spell 1</param>
        /// <param name="spell2">Compare Spell 2</param>
        public SpellCompare(RichTextBox rtb1, RichTextBox rtb2, SpellEntry spell1, SpellEntry spell2)
        {
            new SpellInfo(rtb1, spell1);
            new SpellInfo(rtb2, spell2);

            string[] strsl = rtb1.Text.Split('\n');
            string[] strsr = rtb2.Text.Split('\n');

            int pos = 0;
            foreach (string str in strsl)
            {
                pos += str.Length + 1;
                rtb1.Select(pos - str.Length - 1, pos - 1);

                if (rtb2.Find(str, RichTextBoxFinds.WholeWord) != -1)
                {
                    if (str.ContainsText(words))
                    {
                        rtb1.SelectionBackColor = rtb1.BackColor;
                    }
                    else
                    {
                        rtb1.SelectionBackColor = Color.Cyan;
                    }
                }
                else
                {
                    rtb1.SelectionBackColor = Color.Salmon;
                }
            }

            pos = 0;
            foreach (string str in strsr)
            {
                pos += str.Length + 1;
                rtb2.Select(pos - str.Length - 1, pos - 1);

                if (rtb1.Find(str, RichTextBoxFinds.WholeWord) != -1)
                {
                    if (str.ContainsText(words))
                    {
                        rtb2.SelectionBackColor = rtb2.BackColor;
                    }
                    else
                    {
                        rtb2.SelectionBackColor = Color.Cyan;
                    }
                }
                else
                {
                    rtb2.SelectionBackColor = Color.Salmon;
                }
            }
        }
示例#12
0
        private void SetProcAtribute(SpellEntry spell)
        {
            new SpellInfo(_rtbProcSpellInfo, spell);

            _cbProcSpellFamilyTree.SelectedValue = spell.SpellFamilyName;
            _clbProcFlags.SetCheckedItemFromFlag(spell.ProcFlags);
            _clbSchools.SetCheckedItemFromFlag(spell.SchoolMask);
            _cbProcFitstSpellFamily.SelectedValue = spell.SpellFamilyName;
            _tbPPM.Text      = "0"; // need correct value
            _tbChance.Text   = spell.ProcChance.ToString();
            _tbCooldown.Text = (spell.RecoveryTime / 1000f).ToString();
        }
示例#13
0
        private void GetProcAttribute(SpellEntry spell)
        {
            uint[] SpellFamilyFlags = _tvFamilyTree.GetMask();
            var    statusproc       = String.Format("Spell ({0}) {1}. Proc Event ==> SchoolMask 0x{2:X2}, SpellFamily {3}, 0x{4:X8} {5:X8} {6:X8}, procFlag 0x{7:X8}, procEx 0x{8:X8}, PPMRate {9}",
                                                    spell.ID,
                                                    spell.SpellNameRank,
                                                    _clbSchools.GetFlagsValue(),
                                                    _cbProcFitstSpellFamily.ValueMember,
                                                    SpellFamilyFlags[0],
                                                    SpellFamilyFlags[1],
                                                    SpellFamilyFlags[2],
                                                    _clbProcFlags.GetFlagsValue(),
                                                    _clbProcFlagEx.GetFlagsValue(),
                                                    _tbPPM.Text.ToFloat());

            _gSpellProcEvent.Text = "Spell Proc Event    " + statusproc;
        }
示例#14
0
        private void _bCreatePatch_Click(object sender, EventArgs e)
        {
            string        patch;
            DynamicObject D = pg_Spell.SelectedObject as DynamicObject;

            if (D != null)
            {
                SpellEntry S = D.Spell;

                patch = SpellDBC.CreateSpellSql(S).ToString();
                if (!patch.IsEmpty())
                {
                    _rbDBCSQL.AppendLine("-- Spell SQL for spell_dbc---------------");
                    _rbDBCSQL.AppendLine(patch);
                }
                _rbDBCSQL.ColorizeCode();
            }
        }
示例#15
0
        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();
        }
示例#16
0
        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();
        }
示例#17
0
        private void GetProcAttribute(SpellEntry spell)
        {
            uint[] SpellFamilyFlags = _tvFamilyTree.GetMask();
            var statusproc = String.Format("Spell ({0}) {1}. Proc Event ==> SchoolMask 0x{2:X2}, SpellFamily {3}, 0x{4:X8} {5:X8} {6:X8}, procFlag 0x{7:X8}, procEx 0x{8:X8}, PPMRate {9}",
                spell.ID,
                spell.SpellNameRank,
                _clbSchools.GetFlagsValue(),
                _cbProcFitstSpellFamily.SelectedValue,
                SpellFamilyFlags[0],
                SpellFamilyFlags[1],
                SpellFamilyFlags[2],
                _clbProcFlags.GetFlagsValue(),
                _clbProcFlagEx.GetFlagsValue(),
                _tbPPM.Text.ToFloat());

            _gSpellProcEvent.Text = "Spell Proc Event    " + statusproc;
        }
示例#18
0
 private void spellFilter1_OnSpellChange(object sender, EventArgs e)
 {
     SpellSelected = true;
     Spell = ((Forms.SpellFilter)sender).SelectedSpell;
     new SpellInfo(_rtbSpellInfo, Spell);
 }
示例#19
0
        public ProcInfo(TreeView familyTree, SpellFamilyNames spellfamily)
        {
            familyTree.Nodes.Clear();

            var spells = from Spell in DBC.Spell
                         where Spell.Value.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
                         from SkillLine in temp2.DefaultIfEmpty()
                         select new
            {
                Spell,
                Skill.Value.SkillId,
                SkillLine.Value
            };

            for (int i = 0; i < 96; i++)
            {
                uint[] mask = new uint[3];

                if (i < 32)
                {
                    mask[0] = 1U << i;
                }
                else if (i < 64)
                {
                    mask[1] = 1U << (i - 32);
                }
                else
                {
                    mask[2] = 1U << (i - 64);
                }

                TreeNode node = new TreeNode();
                node.Text     = String.Format("0x{0:X8} {1:X8} {2:X8}", mask[2], mask[1], mask[0]);
                node.ImageKey = "family.ico";
                familyTree.Nodes.Add(node);
            }

            foreach (var elem in spells)
            {
                SpellEntry spell   = elem.Spell.Value;
                bool       IsSkill = elem.SkillId != 0;

                StringBuilder name    = new StringBuilder();
                StringBuilder toolTip = new StringBuilder();

                name.AppendFormat("{0} - {1} ", spell.ID, spell.SpellNameRank);

                toolTip.AppendFormatLine("Spell Name: {0}", spell.SpellNameRank);
                toolTip.AppendFormatLine("Description: {0}", spell.Description);
                toolTip.AppendFormatLine("ToolTip: {0}", spell.ToolTip);

                if (IsSkill)
                {
                    name.AppendFormat("(Skill: ({0}) {1}) ", elem.SkillId, elem.Value.Name);

                    toolTip.AppendLine();
                    toolTip.AppendFormatLine("Skill Name: {0}", elem.Value.Name);
                    toolTip.AppendFormatLine("Description: {0}", elem.Value.Description);
                }

                name.AppendFormat("({0})", spell.School.ToString().NormaliseString("MASK_"));

                foreach (TreeNode node in familyTree.Nodes)
                {
                    uint[] mask = new uint[3];

                    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);
                    }

                    if ((spell.SpellFamilyFlags.ContainsElement(mask)))
                    {
                        TreeNode child = new TreeNode();
                        child             = node.Nodes.Add(name.ToString());
                        child.Name        = spell.ID.ToString();
                        child.ImageKey    = IsSkill ? "plus.ico" : "munus.ico";
                        child.ForeColor   = IsSkill ? Color.Blue : Color.Red;
                        child.ToolTipText = toolTip.ToString();
                    }
                }
            }
        }
示例#20
0
 public DynamicObject (SpellEntry S)
 {
     Spell = S;
     foreach (FieldInfo f in Spell.GetType().GetFields())
         AddProperty(f);
 }
示例#21
0
        private void AppendSpellEffectInfo()
        {
            rtb.AppendLine(_line);

            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)effect.Effect == SpellEffects.SPELL_EFFECT_NONE)
                {
                    rtb.AppendFormatLine("Effect {0}:  NO EFFECT", EFFECT_INDEX);
                    rtb.AppendLine();
                    continue;
                }

                rtb.AppendFormatLine("Effect {0}: Id {1} ({2})", EFFECT_INDEX, effect.Effect, (SpellEffects)effect.Effect);
                rtb.SetDefaultStyle();
                rtb.AppendFormat("BasePoints = {0}", effect.EffectBasePoints);

                if (effect.EffectRealPointsPerLevel != 0)
                {
                    rtb.AppendFormat(" + Level * {0:F}", effect.EffectRealPointsPerLevel);
                }

                // WTF ? 1 = spell.EffectBaseDice[i]
                if (1 < effect.EffectDieSides)
                {
                    if (effect.EffectRealPointsPerLevel != 0)
                    {
                        rtb.AppendFormat(" to {0} + lvl * {1:F}",
                                         effect.EffectBasePoints + 1 + effect.EffectDieSides, effect.EffectRealPointsPerLevel);
                    }
                    else
                    {
                        rtb.AppendFormat(" to {0}", effect.EffectBasePoints + 1 + effect.EffectDieSides);
                    }
                }

                rtb.AppendFormatIfNotNull(" + combo * {0:F}", effect.EffectPointsPerComboPoint);

                if (effect.DmgMultiplier != 1.0f)
                {
                    rtb.AppendFormat(" x {0:F}", effect.DmgMultiplier);
                }

                rtb.AppendFormatIfNotNull("  Multiple = {0:F}", effect.EffectMultipleValue);
                rtb.AppendLine();

                rtb.AppendFormatLine("Targets ({0}, {1}) ({2}, {3})",
                                     effect.EffectImplicitTargetA, effect.EffectImplicitTargetB,
                                     (Targets)effect.EffectImplicitTargetA, (Targets)effect.EffectImplicitTargetB);

                AuraModTypeName(EFFECT_INDEX);

                uint[] ClassMask = new uint[3];

                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.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,
                        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));
                rtb.AppendFormatLineIfNotNull("{0}", spell.GetMaxRadius(EFFECT_INDEX));

                // append trigger spell
                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, spellAuraOptions.ProcChance);
                        rtb.AppendFormatLineIfNotNull("   Description: {0}", triggerSpell.Description);
                        rtb.AppendFormatLineIfNotNull("   ToolTip: {0}", triggerSpell.ToolTip);
                        rtb.SetDefaultStyle();
                        var triggerAuraOptions = triggerSpell.SpellAuraOptions;
                        if (triggerAuraOptions.ProcFlags != 0)
                        {
                            rtb.AppendFormatLine("Charges - {0}", triggerAuraOptions.ProcCharges);
                            rtb.AppendLine(_line);
                            rtb.AppendLine(triggerSpell.ProcInfo);
                            rtb.AppendLine(_line);
                        }
                    }
                    else
                    {
                        rtb.AppendFormatLine("Trigger spell ({0}) Not found, Chance = {1}", trigger, spellAuraOptions.ProcChance);
                    }
                }

                rtb.AppendFormatLineIfNotNull("EffectChainTarget = {0}", effect.EffectChainTarget);
                rtb.AppendFormatLineIfNotNull("EffectItemType = {0}", effect.EffectItemType);

                if ((Mechanics)effect.EffectMechanic != Mechanics.MECHANIC_NONE)
                {
                    rtb.AppendFormatLine("Effect Mechanic = {0} ({1})", effect.EffectMechanic, (Mechanics)effect.EffectMechanic);
                }

                rtb.AppendLine();
            }
        }
示例#22
0
        public static StringBuilder CreateSpellSql(SpellEntry Current)
        {
            SpellEntry Old_Spell = DBC.Spell[Current.ID];
            StringBuilder result = new StringBuilder();
            StringBuilder not_found = new StringBuilder();
            StringBuilder update=new StringBuilder();

            Type ObjType = typeof(SpellEntry);
            result.AppendFormatLine("-- Replace DBC values for spell {0} - {1}", Old_Spell.ID,Old_Spell.SpellNameRank);
            result.AppendFormatLine("DELETE FROM `spell_dbc` WHERE ID={0};", Old_Spell.ID);
            result.AppendFormat("INSERT INTO `spell_dbc` (`{0}`)\r\nVALUES (",String.Join("`, `", SpellDBCFields.ToArray()));

            for (int i = 0; i < SpellDBCFields.Count; i++)
            {
                string FieldName = SpellDBCFields[i];
                FieldInfo f = ObjType.GetField(FieldName, B_Flags);

                if (f == null)
                {
                    //Try to find array
                    f = ObjType.GetField(FieldName.ArrayName(), B_Flags);
                    if (f != null && f.FieldType.IsArray)
                    {
                        Array arr = (Array)f.GetValue(Old_Spell);
                        Array arr_new = (Array)f.GetValue(Current);
                        for (int j = 0; j < arr.Length && SpellDBCFields[i].ArrayName()== f.Name; j++)
                        {
                            string old_val = arr.GetValue(j).ToMySqlString();
                            string new_val = arr_new.GetValue(j).ToMySqlString();
                            if (old_val != new_val)
                                update.AppendFormatLine("`{0}`={1}, -- old value = {1}", SpellDBCFields[i], new_val, old_val);
                            result.AppendFormat(" {0} ,", old_val);
                            i++;
                        }
                        i--; //correct counter before next iteration

                    }
                    else
                    {
                        not_found.AppendFormat("{0} ", FieldName);
                    }

                }
                else
                {
                    string old_val=f.GetValue(Old_Spell).ToMySqlString();
                    string new_val=f.GetValue(Current).ToMySqlString();
                    result.AppendFormat(" {0} ,", old_val);
                    if (old_val != new_val)
                        update.AppendFormatLine("`{0}`={1}, -- old value = {2}", SpellDBCFields[i], new_val,old_val);
                }
            }

            result.AppendFormatLine("'{0}');", Old_Spell.SpellName); //assume that the last field is `Comment`
            result.AppendFormatLine("-- Attention! Fields [ {0} ] not mapped", not_found.ToString());
            if (update.Length > 0)
            {
                update.AppendFormatLine("`Comment` = 'Replacement for spell {0} \"{1}\"' ", Current.ID, Current.SpellNameRank);
                result.AppendLine();
                result.AppendLine();
                result.AppendLine("UPDATE `spell_dbc` SET ");
                result.AppendFormat("{0}", update.ToString());
                result.AppendFormatLine("WHERE Id={0};", Current.ID);
            }
            return result;
        }
示例#23
0
 private void spellFilter1_OnSpellChange(object sender, EventArgs e)
 {
     SpellSelected = true;
     Spell         = ((Forms.SpellFilter)sender).SelectedSpell;
     new SpellInfo(_rtbSpellInfo, Spell);
 }
示例#24
0
        private void AppendSpellEffectInfo()
        {
            rtb.AppendLine(_line);

            for (int EFFECT_INDEX = 0; EFFECT_INDEX < DBC.MAX_EFFECT_INDEX; EFFECT_INDEX++)
            {
                rtb.SetBold();
                if ((SpellEffects)spell.Effect[EFFECT_INDEX] == 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.SetDefaultStyle();
                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]);
                }

                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] + spell.EffectBaseDice[EFFECT_INDEX] + spell.EffectDieSides[EFFECT_INDEX], spell.EffectRealPointsPerLevel[EFFECT_INDEX]);
                    }
                    else
                    {
                        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]);

                if (spell.DmgMultiplier[EFFECT_INDEX] != 1.0f)
                {
                    rtb.AppendFormat(" x {0:F}", spell.DmgMultiplier[EFFECT_INDEX]);
                }

                rtb.AppendFormatIfNotNull("  Multiple = {0:F}", spell.EffectMultipleValue[EFFECT_INDEX]);
                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]);

                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;
                //}

                //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));

                // append trigger spell
                uint trigger = spell.EffectTriggerSpell[EFFECT_INDEX];
                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.AppendFormatLineIfNotNull("   Description: {0}", triggerSpell.Description);
                        rtb.AppendFormatLineIfNotNull("   ToolTip: {0}", triggerSpell.ToolTip);
                        rtb.SetDefaultStyle();
                        if (triggerSpell.ProcFlags != 0)
                        {
                            rtb.AppendFormatLine("Charges - {0}", triggerSpell.ProcCharges);
                            rtb.AppendLine(_line);
                            rtb.AppendLine(triggerSpell.ProcInfo);
                            rtb.AppendLine(_line);
                        }
                    }
                    else
                    {
                        rtb.AppendFormatLine("Trigger spell ({0}) Not found, Chance = {1}", trigger, spell.ProcChance);
                    }
                }

                rtb.AppendFormatLineIfNotNull("EffectChainTarget = {0}", spell.EffectChainTarget[EFFECT_INDEX]);
                rtb.AppendFormatLineIfNotNull("EffectItemType = {0}", spell.EffectItemType[EFFECT_INDEX]);

                if ((Mechanics)spell.EffectMechanic[EFFECT_INDEX] != Mechanics.MECHANIC_NONE)
                {
                    rtb.AppendFormatLine("Effect Mechanic = {0} ({1})", spell.EffectMechanic[EFFECT_INDEX], (Mechanics)spell.EffectMechanic[EFFECT_INDEX]);
                }

                rtb.AppendLine();
            }
        }
示例#25
0
        private void SetProcAtribute(SpellEntry spell)
        {
            new SpellInfo(_rtbProcSpellInfo, spell);

            var classOptions = spell.SpellClassOptions;
            _cbProcSpellFamilyTree.SelectedValue = classOptions.SpellFamilyName;
            var auraOptions = spell.SpellAuraOptions;
            _clbProcFlags.SetCheckedItemFromFlag(auraOptions.ProcFlags);
            _clbSchools.SetCheckedItemFromFlag(spell.SchoolMask);
            _cbProcFitstSpellFamily.SelectedValue = classOptions.SpellFamilyName;
            _tbPPM.Text = "0"; // need correct value
            _tbChance.Text = auraOptions.ProcChance.ToString();
            _tbCooldown.Text = (spell.SpellCooldowns.RecoveryTime / 1000f).ToString();
        }
示例#26
0
 private void Ok_Click(object sender, EventArgs e)
 {
     if (_lvSpellList.SelectedIndices.Count > 0)
     {
         Spell = _spellList[_lvSpellList.SelectedIndices[0]];
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
示例#27
0
        public static StringBuilder CreateSpellSql(SpellEntry Current)
        {
            SpellEntry    Old_Spell = DBC.Spell[Current.ID];
            StringBuilder result    = new StringBuilder();
            StringBuilder not_found = new StringBuilder();
            StringBuilder update    = new StringBuilder();

            Type ObjType = typeof(SpellEntry);

            result.AppendFormatLine("-- Replace DBC values for spell {0} - {1}", Old_Spell.ID, Old_Spell.SpellNameRank);
            result.AppendFormatLine("DELETE FROM `spell_dbc` WHERE ID={0};", Old_Spell.ID);
            result.AppendFormat("INSERT INTO `spell_dbc` (`{0}`)\r\nVALUES (", String.Join("`, `", SpellDBCFields.ToArray()));

            for (int i = 0; i < SpellDBCFields.Count; i++)
            {
                string    FieldName = SpellDBCFields[i];
                FieldInfo f         = ObjType.GetField(FieldName, B_Flags);

                if (f == null)
                {
                    //Try to find array
                    f = ObjType.GetField(FieldName.ArrayName(), B_Flags);
                    if (f != null && f.FieldType.IsArray)
                    {
                        Array arr     = (Array)f.GetValue(Old_Spell);
                        Array arr_new = (Array)f.GetValue(Current);
                        for (int j = 0; j < arr.Length && SpellDBCFields[i].ArrayName() == f.Name; j++)
                        {
                            string old_val = arr.GetValue(j).ToMySqlString();
                            string new_val = arr_new.GetValue(j).ToMySqlString();
                            if (old_val != new_val)
                            {
                                update.AppendFormatLine("`{0}`={1}, -- old value = {1}", SpellDBCFields[i], new_val, old_val);
                            }
                            result.AppendFormat(" {0} ,", old_val);
                            i++;
                        }
                        i--; //correct counter before next iteration
                    }
                    else
                    {
                        not_found.AppendFormat("{0} ", FieldName);
                    }
                }
                else
                {
                    string old_val = f.GetValue(Old_Spell).ToMySqlString();
                    string new_val = f.GetValue(Current).ToMySqlString();
                    result.AppendFormat(" {0} ,", old_val);
                    if (old_val != new_val)
                    {
                        update.AppendFormatLine("`{0}`={1}, -- old value = {2}", SpellDBCFields[i], new_val, old_val);
                    }
                }
            }

            result.AppendFormatLine("'{0}');", Old_Spell.SpellName); //assume that the last field is `Comment`
            result.AppendFormatLine("-- Attention! Fields [ {0} ] not mapped", not_found.ToString());
            if (update.Length > 0)
            {
                update.AppendFormatLine("`Comment` = 'Replacement for spell {0} \"{1}\"' ", Current.ID, Current.SpellNameRank);
                result.AppendLine();
                result.AppendLine();
                result.AppendLine("UPDATE `spell_dbc` SET ");
                result.AppendFormat("{0}", update.ToString());
                result.AppendFormatLine("WHERE Id={0};", Current.ID);
            }
            return(result);
        }