Exemplo n.º 1
0
        private void AppendItemInfo(RichTextBox rtb)
        {
            var items = DBC.DBC.ItemEffect.Where(effect => effect.Value.SpellID == (int)ID).ToArray();

            if (!items.Any())
            {
                return;
            }

            rtb.AppendLine(Separator);
            rtb.SetStyle(Color.Blue, FontStyle.Bold);
            rtb.AppendLine("Items using this spell:");
            rtb.SetDefaultStyle();

            foreach (var item in items)
            {
                if (!DBC.DBC.ItemSparse.ContainsKey((int)item.Value.ItemID))
                {
                    rtb.AppendFormatLine($@"   Non-existing Item-sparse.db2 entry { item.Value.ItemID }");
                    continue;
                }

                var itemTemplate = DBC.DBC.ItemSparse[(int)item.Value.ItemID];

                var name        = itemTemplate.Name;
                var description = itemTemplate.Description;

                description = string.IsNullOrEmpty(description) ? string.Empty : $" - \"{ description }\"";

                rtb.AppendFormatLine($@"   { item.Value.ItemID }: { name } { description }");
            }
        }
Exemplo n.º 2
0
 public static void AppendLine(this RichTextBox source, string[] values)
 {
     foreach (var value in values)
     {
         source.AppendLine(value);
     }
 }
Exemplo n.º 3
0
        private void AddInfo(RichTextBox rtb, string name, string value)
        {
            if (!string.IsNullOrEmpty(value))
            {
                if (rtb.TextLength > 0)
                {
                    rtb.AppendLine();
                    rtb.AppendLine();
                }

                rtb.SetFontBold();
                rtb.AppendLine(name + ":");
                rtb.SetFontRegular();
                rtb.AppendText(value);
            }
        }
Exemplo n.º 4
0
 private void AppendPairContent(RichTextBox textBox, String pairInfo, String content)
 {
     content = ProcessPairContent(content);
     Invoke(new Action(() =>
     {
         textBox.AppendLine(pairInfo, Color.Blue, FontStyle.Bold);
         textBox.AppendText(content);
     }));
 }
        public static void AppendLine(this RichTextBox source, string value, Color color)
        {
            source.SelectionStart  = source.TextLength;
            source.SelectionLength = 0;

            source.SelectionColor = color;
            source.AppendLine(value);
            source.SelectionColor = source.ForeColor;
        }
Exemplo n.º 6
0
        protected override void Write(LogEventInfo logEvent)
        {
            string level   = logEvent.Level.Name;
            string prefix  = DateTime.Now.ToString("HH:mm:ss");
            string message = RenderLogEvent(Layout, logEvent);

            _rtb.AppendText(prefix + " ", Color.DarkGray);
            _rtb.AppendLine(message, GetColor(level));
            _rtb.ScrollToCaret();
        }
Exemplo n.º 7
0
Arquivo: Log.cs Projeto: ekolis/BOSWP
        public static string toRTF()
        {
            RichTextBox temp = new RichTextBox();

            foreach (var msg in Entries)
            {
                temp.AppendLine(msg.Text, msg.Color, msg.EndOfLine); // add to output
                msg.Color = fadeColor(msg.Color);                    //Color.Gray;// mark gray for read
            }
            return(temp.Rtf);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Genera el código responsable de recrear la región diseñada
        /// </summary>
        private void UpdateCodeOutput()
        {
            // Creación de un buffer temporal
            RichTextBox rtb = new RichTextBox();

            rtb.AppendLine($"GraphicsPath {gpname} = new GraphicsPath();");

            //  Por cada nodo agregado, se genera su código C#
            foreach (Node n in nodes)
            {
                rtb.AppendLine(n.GenerateCode(gpname));
            }

            rtb.AppendLine($"Region region = new Region({gpname});");

            //  Si estamos usando el formulario de ejemplo, crear el código para él también
            if (exampleForm != null && exampleForm.Visible)
            {
                rtb.AppendLine($"Form form = new Form();");
                rtb.AppendLine($"form.FormBorderStyle = FormBorderStyle.FixedToolWindow;");

                rtb.AppendLine($@"Size newSize = new Size(
(int)({gpname}.GetBounds().Size.Width + {gpname}.GetBounds().Location.X),
(int)({gpname}.GetBounds().Size.Height + {gpname}.GetBounds().Location.Y)
);");
                rtb.AppendLine($"form.Bounds = new Rectangle(form.Bounds.Location, newSize);");
                rtb.AppendLine($"form.Region = region;");
                rtb.AppendLine($"form.Show();");
            }

            // Suspendemos la actualizacion del control para prevenir flickering temporalmente
            richTextBoxCode.SuspendLayout();
            richTextBoxCode.Text = rtb.Text;
            LinterText(richTextBoxCode);
            richTextBoxCode.ResumeLayout();
        }
Exemplo n.º 9
0
        private void ViewSpellInfo()
        {
            rtb.Clear();
            rtb.SetBold();
            rtb.AppendFormatLine("ID - {0} {1}", spell.ID, spell.SpellNameRank);
            rtb.SetDefaultStyle();

            rtb.AppendFormatLine(_line);
            rtb.AppendFormatLineIfNotNull("Description: {0}", spell.Description);
            rtb.AppendFormatLineIfNotNull("ToolTip: {0}", spell.ToolTip);
            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})",
                                 spellCategories.Category, spell.SpellIconID, spell.ActiveIconID, spell.SpellVisual[0], spell.SpellVisual[1]);

            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})", 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 ||
                spell.AttributesEx4 != 0 || spell.AttributesEx5 != 0 || spell.AttributesEx6 != 0 || spell.AttributesEx7 != 0)
            {
                rtb.AppendLine(_line);
            }

            if (spell.Attributes != 0)
            {
                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);
            }
            if (spell.AttributesEx2 != 0)
            {
                rtb.AppendFormatLine("AttributesEx2: 0x{0:X8} ({1})", spell.AttributesEx2, (SpellAtributeEx2)spell.AttributesEx2);
            }
            if (spell.AttributesEx3 != 0)
            {
                rtb.AppendFormatLine("AttributesEx3: 0x{0:X8} ({1})", spell.AttributesEx3, (SpellAtributeEx3)spell.AttributesEx3);
            }
            if (spell.AttributesEx4 != 0)
            {
                rtb.AppendFormatLine("AttributesEx4: 0x{0:X8} ({1})", spell.AttributesEx4, (SpellAtributeEx4)spell.AttributesEx4);
            }
            if (spell.AttributesEx5 != 0)
            {
                rtb.AppendFormatLine("AttributesEx5: 0x{0:X8} ({1})", spell.AttributesEx5, (SpellAtributeEx5)spell.AttributesEx5);
            }
            if (spell.AttributesEx6 != 0)
            {
                rtb.AppendFormatLine("AttributesEx6: 0x{0:X8} ({1})", spell.AttributesEx6, (SpellAtributeEx6)spell.AttributesEx6);
            }
            if (spell.AttributesEx7 != 0)
            {
                rtb.AppendFormatLine("AttributesEx7: 0x{0:X8} ({1})", spell.AttributesEx7, (SpellAtributeEx7)spell.AttributesEx7);
            }

            rtb.AppendLine(_line);

            if (targetRestrictions.Targets != 0)
            {
                rtb.AppendFormatLine("Targets Mask = 0x{0:X8} ({1})", targetRestrictions.Targets, (SpellCastTargetFlags)targetRestrictions.Targets);
            }

            if (targetRestrictions.TargetCreatureType != 0)
            {
                rtb.AppendFormatLine("Creature Type Mask = 0x{0:X8} ({1})",
                                     targetRestrictions.TargetCreatureType, (CreatureTypeMask)targetRestrictions.TargetCreatureType);
            }

            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}",
                                 spellLevels.SpellLevel, spellLevels.BaseLevel, spellLevels.MaxLevel, targetRestrictions.MaxTargetLevel);

            if (spellEquippedItems.EquippedItemClass != -1)
            {
                rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", spellEquippedItems.EquippedItemClass, (ItemClass)spellEquippedItems.EquippedItemClass);

                if (spellEquippedItems.EquippedItemSubClassMask != 0)
                {
                    switch ((ItemClass)spellEquippedItems.EquippedItemClass)
                    {
                    case ItemClass.WEAPON:
                        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})",
                                             spellEquippedItems.EquippedItemSubClassMask, (ItemSubClassArmorMask)spellEquippedItems.EquippedItemSubClassMask);
                        break;

                    case ItemClass.MISC:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                             spellEquippedItems.EquippedItemSubClassMask, (ItemSubClassMiscMask)spellEquippedItems.EquippedItemSubClassMask);
                        break;
                    }
                }

                if (spellEquippedItems.EquippedItemInventoryTypeMask != 0)
                {
                    rtb.AppendFormatLine("    InventoryType mask = 0x{0:X8} ({1})",
                                         spellEquippedItems.EquippedItemInventoryTypeMask, (InventoryTypeMask)spellEquippedItems.EquippedItemInventoryTypeMask);
                }
            }

            rtb.AppendLine();
            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}", spellAuraOptions.StackAmount);

            rtb.AppendLine(spell.CastTime);

            rtb.AppendLine(spell.SpellDifficulty);

            if (spellCooldowns.RecoveryTime != 0 || spellCooldowns.CategoryRecoveryTime != 0 || spellCategories.StartRecoveryCategory != 0)
            {
                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 (spellPower.ManaCost != 0 || spellPower.ManaCostPercentage != 0)
            {
                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}",
                                 spellInterrupts.InterruptFlags, spellInterrupts.AuraInterruptFlags, spellInterrupts.ChannelInterruptFlags);

            if (spellAuraRestrictions.CasterAuraState != 0)
            {
                rtb.AppendFormatLine("CasterAuraState = {0} ({1})", spellAuraRestrictions.CasterAuraState, (AuraState)spellAuraRestrictions.CasterAuraState);
            }

            if (spellAuraRestrictions.TargetAuraState != 0)
            {
                rtb.AppendFormatLine("TargetAuraState = {0} ({1})", spellAuraRestrictions.TargetAuraState, (AuraState)spellAuraRestrictions.TargetAuraState);
            }

            if (spellAuraRestrictions.CasterAuraStateNot != 0)
            {
                rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", spellAuraRestrictions.CasterAuraStateNot, (AuraState)spellAuraRestrictions.CasterAuraStateNot);
            }

            if (spellAuraRestrictions.TargetAuraStateNot != 0)
            {
                rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", spellAuraRestrictions.TargetAuraStateNot, (AuraState)spellAuraRestrictions.TargetAuraStateNot);
            }

            AppendSpellAura();

            rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", spellCastingRequirements.RequiresSpellFocus);

            if (spellAuraOptions.ProcFlags != 0)
            {
                rtb.SetBold();
                rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance = {1}, charges - {2}",
                                     spellAuraOptions.ProcFlags, spellAuraOptions.ProcChance, spellAuraOptions.ProcCharges);
                rtb.SetDefaultStyle();
                rtb.AppendFormatLine(_line);
                rtb.AppendText(spell.ProcInfo);
            }
            else
            {
                rtb.AppendFormatLine("Chance = {0}, charges - {1}", spellAuraOptions.ProcChance, spellAuraOptions.ProcCharges);
            }

            AppendSpellEffectInfo();
            AppendItemInfo();
        }
Exemplo n.º 10
0
        private void ViewSpellInfo()
        {
            try
            {
                _rtb.Clear();
                _rtb.SetBold();
                _rtb.AppendFormatLine("ID - {0} {1}{2}", _spell.ID, _spell.SpellNameRank, _spell.ScalingText);
                _rtb.SetDefaultStyle();

                _rtb.AppendFormatLine(_line);

                _rtb.AppendLine(_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.AppendFormatLine(_line);
                }

                bool addline = false;
                if (DBC.DBC.SpellTriggerStore.ContainsKey(_spell.ID))
                {
                    foreach (uint procSpellId in DBC.DBC.SpellTriggerStore[_spell.ID])
                    {
                        string procname = "Spell Not Found";
                        if (DBC.DBC.Spell.ContainsKey(procSpellId))
                        {
                            procname = DBC.DBC.Spell[procSpellId].SpellName;
                        }
                        _rtb.SetStyle(Color.Blue, FontStyle.Bold);

                        _rtb.AppendFormatLine("Triggred by spell: ({0}) {1}", procSpellId, procname);
                        _rtb.SetDefaultStyle();
                        addline = true;
                    }
                }
                if (addline)
                {
                    _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]);

                _rtb.AppendFormatLine("Family {0}, flag [0] 0x{1:X8} [1] 0x{2:X8} [2] 0x{3:X8}",
                                      (SpellFamilyNames)_spell.SpellFamilyName, _spell.SpellFamilyFlags[0], _spell.SpellFamilyFlags[1], _spell.SpellFamilyFlags[2]);

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

                if (_spell.Attributes != 0 || _spell.AttributesEx != 0 || _spell.AttributesEx2 != 0 || _spell.AttributesEx3 != 0 || _spell.AttributesEx4 != 0 ||
                    _spell.AttributesEx5 != 0 || _spell.AttributesEx6 != 0 || _spell.AttributesEx7 != 0 || _spell.AttributesEx8 != 0)
                {
                    _rtb.AppendLine(_line);
                }

                if (_spell.Attributes != 0)
                {
                    _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);
                }
                if (_spell.AttributesEx2 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx2: 0x{0:X8} ({1})", _spell.AttributesEx2, (SpellAtributeEx2)_spell.AttributesEx2);
                }
                if (_spell.AttributesEx3 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx3: 0x{0:X8} ({1})", _spell.AttributesEx3, (SpellAtributeEx3)_spell.AttributesEx3);
                }
                if (_spell.AttributesEx4 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx4: 0x{0:X8} ({1})", _spell.AttributesEx4, (SpellAtributeEx4)_spell.AttributesEx4);
                }
                if (_spell.AttributesEx5 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx5: 0x{0:X8} ({1})", _spell.AttributesEx5, (SpellAtributeEx5)_spell.AttributesEx5);
                }
                if (_spell.AttributesEx6 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx6: 0x{0:X8} ({1})", _spell.AttributesEx6, (SpellAtributeEx6)_spell.AttributesEx6);
                }
                if (_spell.AttributesEx7 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx7: 0x{0:X8} ({1})", _spell.AttributesEx7, (SpellAtributeEx7)_spell.AttributesEx7);
                }
                if (_spell.AttributesEx8 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx8: 0x{0:X8} ({1})", _spell.AttributesEx8, (SpellAtributeEx8)_spell.AttributesEx8);
                }
                if (_spell.AttributesEx9 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx9: 0x{0:X8} ({1})", _spell.AttributesEx9, (SpellAtributeEx9)_spell.AttributesEx9);
                }
                if (_spell.AttributesEx10 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx10: 0x{0:X8} ({1})", _spell.AttributesEx10, (SpellAtributeEx10)_spell.AttributesEx10);
                }
                if (_spell.AttributesEx11 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx11: 0x{0:X8} ({1})", _spell.AttributesEx11, (SpellAtributeEx11)_spell.AttributesEx11);
                }
                if (_spell.AttributesEx12 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx12: 0x{0:X8} ({1})", _spell.AttributesEx12, (SpellAtributeEx12)_spell.AttributesEx12);
                }
                if (_spell.AttributesEx13 != 0)
                {
                    _rtb.AppendFormatLine("AttributesEx13: 0x{0:X8} ({1})", _spell.AttributesEx13, (SpellAtributeEx13)_spell.AttributesEx13);
                }

                _rtb.AppendLine(_line);

                if (_spell.SpellTargetRestrictionsList != null)
                {
                    foreach (var TargetRestriction in _spell.SpellTargetRestrictionsList)
                    {
                        if (TargetRestriction.Targets != 0)
                        {
                            _rtb.AppendFormatLine("Targets Mask = 0x{0:X8} ({1})", TargetRestriction.Targets, (SpellCastTargetFlags)TargetRestriction.Targets);
                        }

                        if (TargetRestriction.TargetCreatureType != 0)
                        {
                            _rtb.AppendFormatLine("Creature Type Mask = 0x{0:X8} ({1})",
                                                  TargetRestriction.TargetCreatureType, (CreatureTypeMask)TargetRestriction.TargetCreatureType);
                        }

                        if (TargetRestriction.MaxAffectedTargets != 0)
                        {
                            _rtb.AppendFormatLine("MaxAffectedTargets: {0}", TargetRestriction.MaxAffectedTargets);
                        }
                    }
                }

                if (_spell.Stances != 0)
                {
                    _rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)_spell.Stances);
                }

                if (_spell.StancesNot != 0)
                {
                    _rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)_spell.StancesNot);
                }

                AppendSkillLine();

                // reagents
                {
                    var printedHeader = false;
                    for (var i = 0; i < _spell.Reagent.Length; ++i)
                    {
                        if (_spell.Reagent[i] == 0)
                        {
                            continue;
                        }

                        if (!printedHeader)
                        {
                            _rtb.AppendLine();
                            _rtb.Append("Reagents:");
                            printedHeader = true;
                        }

                        _rtb.AppendFormat("  {0} x{1}", _spell.Reagent[i], _spell.ReagentCount[i]);
                    }

                    if (printedHeader)
                    {
                        _rtb.AppendLine();
                    }
                }

                _rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}",
                                      _spell.SpellLevel, _spell.BaseLevel, _spell.MaxLevel);

                if (_spell.EquippedItemClass != 0)
                {
                    _rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", _spell.EquippedItemClass, (ItemClass)_spell.EquippedItemClass);

                    if (_spell.EquippedItemSubClassMask != 0)
                    {
                        switch ((ItemClass)_spell.EquippedItemClass)
                        {
                        case ItemClass.WEAPON:
                            _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                                  _spell.EquippedItemSubClassMask, (ItemSubClassWeaponMask)_spell.EquippedItemSubClassMask);
                            break;

                        case ItemClass.ARMOR:
                            _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                                  _spell.EquippedItemSubClassMask, (ItemSubClassArmorMask)_spell.EquippedItemSubClassMask);
                            break;

                        case ItemClass.MISC:
                            _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                                  _spell.EquippedItemSubClassMask, (ItemSubClassMiscMask)_spell.EquippedItemSubClassMask);
                            break;
                        }
                    }

                    if (_spell.EquippedItemInventoryTypeMask != 0)
                    {
                        _rtb.AppendFormatLine("    InventoryType mask = 0x{0:X8} ({1})",
                                              _spell.EquippedItemInventoryTypeMask, (InventoryTypeMask)_spell.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.AppendLine(_spell.Range);

                _rtb.AppendFormatLineIfNotNull("Speed {0:F}", _spell.Speed);
                _rtb.AppendFormatLineIfNotNull("Stackable up to {0}", _spell.StackAmount);

                _rtb.AppendLine(_spell.CastTime);

                if (_spell.RecoveryTime != 0 || _spell.CategoryRecoveryTime != 0 || _spell.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.AppendLine(_spell.Duration);

                if (_spell.RuneCost != null)
                {
                    _rtb.AppendFormatLine("Rune Cost: {0}, {1}, {2}, {3}, Power Gain: {4}", _spell.RuneCost.RuneCost[0], _spell.RuneCost.RuneCost[1], _spell.RuneCost.RuneCost[2], _spell.RuneCost.UnkMop, _spell.RuneCost.RunicPowerGain);
                }

                if (_spell.SpellPowerList != null)
                {
                    foreach (var spellPower in _spell.SpellPowerList)
                    {
                        if (spellPower.ManaCost != 0 || spellPower.ManaCostPercentage != 0 || spellPower.PowerType != 0 ||
                            spellPower.ManaCostPerlevel != 0 || spellPower.ManaPerSecond != 0)
                        {
                            _rtb.AppendFormat("Power {0}, Cost {1}",
                                              (Powers)spellPower.PowerType, spellPower.ManaCost == 0 ? spellPower.ManaCostPercentage + " %" : spellPower.ManaCost.ToString());
                            _rtb.AppendFormatIfNotNull(" + lvl * {0}", spellPower.ManaCostPerlevel);
                            _rtb.AppendFormatIfNotNull(" + {0} Per Second", spellPower.ManaPerSecond);

                            if (spellPower.RequiredAura > 0)
                            {
                                _rtb.AppendFormat(" if aura {0}", spellPower.RequiredAura);
                                if (DBC.DBC.Spell.ContainsKey(spellPower.RequiredAura))
                                {
                                    _rtb.AppendFormat(" ({0})", DBC.DBC.Spell[spellPower.RequiredAura].SpellName);
                                }
                            }
                            if (spellPower.Difficulty > 0)
                            {
                                _rtb.AppendFormat(" if {0}", (Difficulty)spellPower.Difficulty);
                            }

                            _rtb.AppendLine();
                        }
                    }
                }

                _rtb.AppendFormatLine("Interrupt Flags: 0x{0:X8}, AuraIF 0x{1:X8}, ChannelIF 0x{2:X8}",
                                      _spell.InterruptFlags, _spell.AuraInterruptFlags, _spell.ChannelInterruptFlags);

                if (_spell.CasterAuraState != 0)
                {
                    _rtb.AppendFormatLine("CasterAuraState = {0} ({1})", _spell.CasterAuraState, (AuraState)_spell.CasterAuraState);
                }

                if (_spell.TargetAuraState != 0)
                {
                    _rtb.AppendFormatLine("TargetAuraState = {0} ({1})", _spell.TargetAuraState, (AuraState)_spell.TargetAuraState);
                }

                if (_spell.CasterAuraStateNot != 0)
                {
                    _rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", _spell.CasterAuraStateNot, (AuraState)_spell.CasterAuraStateNot);
                }

                if (_spell.TargetAuraStateNot != 0)
                {
                    _rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", _spell.TargetAuraStateNot, (AuraState)_spell.TargetAuraStateNot);
                }

                AppendSpellAura();

                AppendAreaInfo();

                _rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", _spell.RequiresSpellFocus);

                if (_spell.ProcFlags != 0)
                {
                    _rtb.SetBold();
                    _rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance = {1}, charges - {2}",
                                          _spell.ProcFlags, _spell.ProcChance, _spell.ProcCharges);
                    _rtb.SetDefaultStyle();
                    _rtb.AppendFormatLine(_line);
                    _rtb.AppendText(_spell.ProcInfo);
                }
                else
                {
                    _rtb.AppendFormatLine("Chance = {0}, charges - {1}", _spell.ProcChance, _spell.ProcCharges);
                }

                AppendSpellEffectInfo();
                AppendItemInfo();
                AppendDifficultyInfo();

                AppendSpellVisualInfo();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 11
0
        public void ViewVehicleInfo()
        {
            _rtb.Clear();
            _rtb.SetBold();
            _rtb.AppendFormatLine("Vehicle ID: {0}", _vehicle.Id);
            _rtb.AppendFormatLine("Locomotion Type: {0}", _vehicle.LocomotionType);
            _rtb.AppendFormatLine("Seat Indicator Type: {0}", _vehicle.SeatIndicatorType);
            _rtb.AppendFormatLine("Power Type: {0}", _vehicle.PowerType);
            _rtb.AppendFormatLine("Turn Speed: {0}", _vehicle.TurnSpeed);
            _rtb.AppendFormatLine("Pitch Speed: {0}", _vehicle.PitchSpeed);
            _rtb.AppendFormatLine("Pitch Min: {0}", _vehicle.PitchMin);
            _rtb.AppendFormatLine("Pitch Max: {0}", _vehicle.PitchMax);
            _rtb.AppendFormatLine("Pitch Offset: {0}", _vehicle.PitchOffset);
            _rtb.AppendFormatLine("Mouselook Offset Pitch: {0}", _vehicle.MouseLookOffsetPitch);
            _rtb.AppendFormatLine("Camera Fade Distance Scalar Min: {0}", _vehicle.CameraFadeDistScalarMin);
            _rtb.AppendFormatLine("Camera Fade Distance Scalar Max: {0}", _vehicle.CameraFadeDistScalarMax);
            _rtb.AppendFormatLine("Camera Yaw Offset: {0}", _vehicle.CameraYawOffset);
            _rtb.AppendFormatLine("Facing Limit Right: {0}", _vehicle.FacingLimitRight);
            _rtb.AppendFormatLine("Facing Limit Left: {0}", _vehicle.FacingLimitLeft);
            _rtb.AppendFormatLine("Missle Target Turn Lingering: {0}", _vehicle.MissleTargetTurnLingering);
            _rtb.AppendFormatLine("Missle Target Pitch Lingering: {0}", _vehicle.MissleTargetPitchLingering);
            _rtb.AppendFormatLine("Missle Target Mouse Lingering: {0}", _vehicle.MissleTargetMouseLingering);
            _rtb.AppendFormatLine("Missle Target End Opacity: {0}", _vehicle.MissleTargetEndOpacity);
            _rtb.AppendFormatLine("Missle Target Arc Speed: {0}", _vehicle.MissleTargetArcSpeed);
            _rtb.AppendFormatLine("Missle Target Arc Repeat: {0}", _vehicle.MissleTargetArcRepeat);
            _rtb.AppendFormatLine("Missle Target Arc Width: {0}", _vehicle.MissleTargetArcWidth);
            _rtb.AppendFormatLine("Missle Target Impact Radius 1: {0}", _vehicle.MissleTargetImpactRadius[0]);
            _rtb.AppendFormatLine("Missle Target Impact Radius 2: {0}", _vehicle.MissleTargetImpactRadius[1]);
            _rtb.AppendFormatLine("Missle Target Impact Texture Radius: {0}", _vehicle.MissleTargetImpactTexRadius);
            _rtb.AppendFormatLine("Missle Target Arc Texture: {0}", _vehicle.MissleTargetArcTexture);
            _rtb.AppendFormatLine("Missle Target Impact Model 1: {0}", _vehicle.MissleTargetImpactModel1);
            _rtb.AppendFormatLine("Missle Target Impact Model 2: {0}", _vehicle.MissleTargetImpactModel2);
            _rtb.AppendFormatLine("Unk1: {0}", _vehicle.Unk1);
            _rtb.AppendFormatLine("Unk2: {0}", _vehicle.Unk2);
            _rtb.AppendLine();

            _rtb.SetBold();
            _rtb.AppendFormatLine("Has VehiceFlags:");
            _rtb.SetDefaultStyle();
            for (var i = 0; i < 32; ++i)
            {
                if ((_vehicle.Flags & (1 << i)) != 0L)
                {
                    _rtb.AppendFormatLine("{0}", (VehicleFlags)(1 << i));
                }
            }

            _rtb.AppendLine();
            _rtb.SetBold();
            _rtb.AppendFormatLine("Used by the following creatures:");
            _rtb.SetDefaultStyle();

            foreach (var c in
                     SQL.CreatureTemplate.Where(x => x.Value.VehicleId == _vehicle.Id).Select(creature => creature.Value))
            {
                _rtb.AppendFormatLine("{0} - {1}", c.Id, c.Name);
                _rtb.SetDefaultStyle();
                if (((NPCFlags)c.NPCFlag).HasFlag(NPCFlags.Spellclick))
                {
                    _rtb.AppendLine("    Has spellclick NPC flag");
                }

                List <int> spellClickSpells;
                if (SQL.SpellClick.TryGetValue(c.Id, out spellClickSpells))
                {
                    foreach (var spell in spellClickSpells)
                    {
                        _rtb.AppendFormatLine("    Has spellclick spell {0}", spell);
                    }
                }

                var vehicleSeats = new LinkedList <VehicleSeatEntry>();
                foreach (var s in Seats)
                {
                    vehicleSeats.AddLast(s.Seat);
                }

                List <VehicleTemplateAccessory> accessories;
                if (SQL.Accessories.TryGetValue(c.Id, out accessories))
                {
                    foreach (var accessory in accessories)
                    {
                        _rtb.AppendFormatLine("    Has accessory entry {0} on seat {1}", accessory.AccessoryEntry,
                                              accessory.SeatId);
                        CreatureTemplate template;
                        if (!SQL.CreatureTemplate.TryGetValue((int)accessory.AccessoryEntry, out template))
                        {
                            continue;
                        }

                        if (template.VehicleId == 0)
                        {
                            continue;
                        }

                        _rtb.AppendFormatLine("    Accessory is a vehicle.");

                        var val = vehicleSeats.Find(
                            Seats.Find(x => x.Seat.Id == _vehicle.SeatId[accessory.SeatId]).Seat
                            );

                        VehicleEntry vehicle;
                        if (!DBC.Vehicle.TryGetValue(template.VehicleId, out vehicle))
                        {
                            continue;
                        }

                        foreach (var vs in vehicle.SeatId)
                        {
                            VehicleSeatEntry vsE;
                            if (DBC.VehicleSeat.TryGetValue(vs, out vsE))
                            {
                                if (vsE.Flags.HasFlag(VehicleSeatFlags.CanControl))
                                {
                                    vehicleSeats.AddAfter(val, vsE);
                                }
                            }
                        }

                        vehicleSeats.Remove(val);
                    }

                    _rtb.AppendLine();
                    _rtb.SetBold();
                    _rtb.AppendFormatLine("The following seats can be cycled trough by the player (recursive cycling included)");
                    foreach (var vs in vehicleSeats)
                    {
                        _rtb.AppendFormat("{0}->", vs.Id);
                    }
                    _rtb.SetDefaultStyle();
                    _rtb.AppendLine();
                }

                _rtb.AppendFormatLineIfNotNull("    AIName: \"{0}\"", c.AIName);
                _rtb.AppendFormatLineIfNotNull("    ScriptName: \"{0}\"", c.ScriptName);

                _rtb.AppendLine();
                _rtb.SetDefaultStyle();
            }
        }
Exemplo n.º 12
0
 public void RenderView <T>(T view)
 {
     RedirectToWhen.InvokeOptional(this, view, (i, v) =>
     {
         using (_rich.Styled(Solarized.Yellow))
         {
             _rich.AppendLine(view.GetType().Name);
         }
         _rich.AppendText(ServiceStack.Text.TypeSerializer.SerializeAndFormat(view));
     });
 }
Exemplo n.º 13
0
 /// <summary>
 /// 追加默认颜色文本行
 /// </summary>
 /// <param name="box"></param>
 /// <param name="text"></param>
 public static void AppendInfo(this RichTextBox box, string text)
 {
     box.AppendLine(text, box.ForeColor);
 }
Exemplo n.º 14
0
 /// <summary>
 /// 追加红色错误文本行
 /// </summary>
 /// <param name="box"></param>
 /// <param name="text"></param>
 public static void AppendError(this RichTextBox box, string text)
 {
     box.AppendLine(text, Color.Red);
 }
Exemplo n.º 15
0
        public void ViewSeatInfo()
        {
            _rtb.Clear();
            _rtb.SetBold();
            _rtb.AppendFormatLine("Seat ID: {0}", Seat.Id);
            _rtb.SetDefaultStyle();

            _rtb.AppendFormatLine("Attachment ID: {0}", Seat.AttachmentId);
            _rtb.AppendFormatLine("Attachment Offset X: {0}", Seat.AttachmentOffsetX);
            _rtb.AppendFormatLine("Attachment Offset Y: {0}", Seat.AttachmentOffsetY);
            _rtb.AppendFormatLine("Attachment Offset Z: {0}", Seat.AttachmentOffsetZ);
            _rtb.AppendFormatLine("Enter Pre-delay: {0}", Seat.EnterPreDelay);
            _rtb.AppendFormatLine("Enter Speed: {0}", Seat.EnterSpeed);
            _rtb.AppendFormatLine("Enter Gravity: {0}", Seat.EnterGravity);
            _rtb.AppendFormatLine("Enter Duration Min: {0}", Seat.EnterMinDuration);
            _rtb.AppendFormatLine("Enter Duration Max: {0}", Seat.EnterMaxDuration);
            _rtb.AppendFormatLine("Enter Arc Height Min: {0}", Seat.EnterMinArcHeight);
            _rtb.AppendFormatLine("Enter Arc Height Max: {0}", Seat.EnterMaxArcHeight);
            _rtb.AppendFormatLine("Enter Animation Start: {0}", Seat.EnterAnimStart);
            _rtb.AppendFormatLine("Enter Animation Loop: {0}", Seat.EnterAnimLoop);
            _rtb.AppendFormatLine("Ride Animation Start: {0}", Seat.RideAnimStart);
            _rtb.AppendFormatLine("Ride Animation Loop: {0}", Seat.RideAnimLoop);
            _rtb.AppendFormatLine("Ride Upper Animation Start: {0}", Seat.RideUpperAnimStart);
            _rtb.AppendFormatLine("Ride Upper Animation Loop: {0}", Seat.RideUpperAnimLoop);
            _rtb.AppendFormatLine("Exit Pre-delay: {0}", Seat.ExitPreDelay);
            _rtb.AppendFormatLine("Exit Gravity: {0}", Seat.ExitGravity);
            _rtb.AppendFormatLine("Exit Duration Min: {0}", Seat.ExitMinDuration);
            _rtb.AppendFormatLine("Exit Duration Max: {0}", Seat.ExitMaxDuration);
            _rtb.AppendFormatLine("Exit Arc Height Min: {0}", Seat.ExitMinArcHeight);
            _rtb.AppendFormatLine("Exit Arc height Max: {0}", Seat.ExitMaxArcHeight);
            _rtb.AppendFormatLine("Exit Animation Start: {0}", Seat.ExitAnimStart);
            _rtb.AppendFormatLine("Exit Animation Loop: {0}", Seat.ExitAnimLoop);
            _rtb.AppendFormatLine("Exit Animation End: {0}", Seat.ExitAnimEnd);
            _rtb.AppendFormatLine("Passenger Yaw: {0}", Seat.PassengerYaw);
            _rtb.AppendFormatLine("Passenger Pitch: {0}", Seat.PassengerPitch);
            _rtb.AppendFormatLine("Passenger Roll: {0}", Seat.PassengerRoll);
            _rtb.AppendFormatLine("Passenger Attachment ID: {0}", Seat.PassengerAttachmentId);
            _rtb.AppendFormatLine("Vehicle Enter Animation: {0}", Seat.VehicleEnterAnim);
            _rtb.AppendFormatLine("Vehicle Enter Animation Bone: {0}", Seat.VehicleEnterAnimBone);
            _rtb.AppendFormatLine("Vehicle Enter Animation Delay: {0}", Seat.VehicleEnterAnimDelay);
            _rtb.AppendFormatLine("Vehicle Exit Animation: {0}", Seat.VehicleExitAnim);
            _rtb.AppendFormatLine("Vehicle Exit Animation Bone: {0}", Seat.VehicleExitAnimBone);
            _rtb.AppendFormatLine("Vehicle Exit Animation Delay: {0}", Seat.VehicleExitAnimDelay);
            _rtb.AppendFormatLine("Vehicle Ride Animation Loop: {0}", Seat.VehicleRideAnimLoop);
            _rtb.AppendFormatLine("Vehicle Ride Animation Loop Bone: {0}", Seat.VehicleRideAnimLoopBone);
            _rtb.AppendFormatLine("Vehicle Ability Display: {0}", Seat.VehicleAbilityDisplay);
            _rtb.AppendFormatLine("Vehicle Enter UI Sound ID: {0}", Seat.EnterUiSoundId);
            _rtb.AppendFormatLine("Vehicle Exit UI Sound ID: {0}", Seat.ExitUiSoundId);
            _rtb.AppendFormatLine("Vehicle Skin: {0}", Seat.Skin);
            _rtb.AppendFormatLine("Camera Entering Delay: {0}", Seat.CameraEnteringDelay);
            _rtb.AppendFormatLine("Camera Entering Duration: {0}", Seat.CameraEnteringDuration);
            _rtb.AppendFormatLine("Camera Exiting Delay: {0}", Seat.CameraExitingDelay);
            _rtb.AppendFormatLine("Camera Exiting Duration: {0}", Seat.CameraExitingDuration);
            _rtb.AppendFormatLine("Camera Offset X: {0}", Seat.CameraOffsetX);
            _rtb.AppendFormatLine("Camera Offset Y: {0}", Seat.CameraOffsetY);
            _rtb.AppendFormatLine("Camera Offset Z: {0}", Seat.CameraOffsetZ);
            _rtb.AppendFormatLine("Camera Pos Chase Rate: {0}", Seat.CameraPosChaseRate);
            _rtb.AppendFormatLine("Camera Facing Chase Rate: {0}", Seat.CameraFacingChaseRate);
            _rtb.AppendFormatLine("Camera Entering Zoom: {0}", Seat.CameraEnteringZoom);
            _rtb.AppendFormatLine("Camera Seat Zoom Min: {0}", Seat.CameraSeatZoomMin);
            _rtb.AppendFormatLine("Camera Seat Zoom Max: {0}", Seat.CameraSeatZoomMax);

            _rtb.AppendLine();

            _rtb.SetBold();
            _rtb.AppendFormatLine("Has VehiceSeatFlags:");
            _rtb.SetDefaultStyle();
            for (var i = 0; i < 32; ++i)
            {
                if (Seat.Flags.HasFlag((VehicleSeatFlags)(1 << i)))
                {
                    _rtb.AppendFormatLine("{0}", (VehicleSeatFlags)(1 << i));
                }
            }


            _rtb.AppendLine();
            _rtb.SetBold();
            _rtb.AppendFormatLine("Has VehiceSeatFlagsB:");
            _rtb.SetDefaultStyle();
            for (var i = 0; i < 32; ++i)
            {
                if ((Seat.FlagsB & (1 << i)) != 0L)
                {
                    _rtb.AppendFormatLine("{0}", (VehicleSeatFlagsB)(1 << i));
                }
            }
            _rtb.SetDefaultStyle();
        }
 public static RichTextBox AppendLine(this RichTextBox box) => box.AppendLine(string.Empty);
Exemplo n.º 17
0
        private void AppendSpellEffectInfo(RichTextBox sb, SpellEntry spell)
        {
            sb.AppendLine("=================================================");

            for (int i = 0; i < 3; i++)
            {
                sb.SetBold();
                if ((SpellEffects)spell.Effect[i] == SpellEffects.NO_SPELL_EFFECT)
                {
                    sb.AppendFormatLine("Effect {0}:  NO EFFECT", i);
                    return;
                }

                sb.AppendFormatLine("Effect {0}: Id {1} ({2})", i, spell.Effect[i], (SpellEffects)spell.Effect[i]);
                sb.SetDefaultStyle();
                sb.AppendFormat("BasePoints = {0}", spell.EffectBasePoints[i] + 1);
                if (spell.EffectRealPointsPerLevel[i] != 0)
                {
                    sb.AppendFormat(" + Level * {0:F}", spell.EffectRealPointsPerLevel[i]);
                }

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

                sb.AppendFormatIfNotNull(" + combo * {0:F}", spell.EffectPointsPerComboPoint[i]);

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

                sb.AppendFormatIfNotNull("  Multiple = {0:F}", spell.EffectMultipleValue[i]);
                sb.AppendLine();

                sb.AppendFormatLine("Targets ({0}, {1}) ({2}, {3})",
                                    spell.EffectImplicitTargetA[i], spell.EffectImplicitTargetB[i],
                                    (Targets)spell.EffectImplicitTargetA[i], (Targets)spell.EffectImplicitTargetB[i]);

                sb.AppendText(AuraModTypeName(spell, i));

                uint[] ClassMask = new uint[3];

                switch (i)
                {
                case 0: ClassMask[0] = spell.EffectSpellClassMaskA[i]; break;

                case 1: ClassMask[1] = spell.EffectSpellClassMaskB[i]; break;

                case 2: ClassMask[2] = spell.EffectSpellClassMaskC[i]; break;
                }

                if (ClassMask[0] != 0 || ClassMask[1] != 0 || ClassMask[2] != 0)
                {
                    sb.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.SpellFamilyFlags1 & ClassMask[0]) != 0 ||
                                 (Spell.SpellFamilyFlags2 & ClassMask[1]) != 0 ||
                                 (Spell.SpellFamilyFlags3 & ClassMask[2]) != 0)
                                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)
                        {
                            sb.SelectionColor = Color.Blue;
                            sb.AppendFormatLine("\t+ {0} - {1}", row.SpellID, row.SpellName);
                        }
                        else
                        {
                            sb.SelectionColor = Color.Red;
                            sb.AppendFormatLine("\t- {0} - {1}", row.SpellID, row.SpellName);
                        }
                        sb.SelectionColor = Color.Black;
                    }
                }

                sb.AppendFormatLineIfNotNull("{0}", spell.GetRadius(i));

                // append trigger spell
                var tsId = spell.EffectTriggerSpell[i];
                if (tsId != 0)
                {
                    if (DBC.Spell.ContainsKey(tsId))
                    {
                        SpellEntry trigger = DBC.Spell[tsId];
                        sb.SetStyle(Color.Blue, FontStyle.Bold);
                        sb.AppendFormatLine("   Trigger spell ({0}) {1}. Chance = {2}", tsId, trigger.SpellNameRank, spell.ProcChance);
                        sb.SetStyle(FontStyle.Italic);
                        sb.AppendFormatLineIfNotNull("   Description: {0}", trigger.Description);
                        sb.SetStyle(FontStyle.Italic);
                        sb.AppendFormatLineIfNotNull("   ToolTip: {0}", trigger.ToolTip);
                        sb.SetDefaultStyle();
                        if (trigger.ProcFlags != 0)
                        {
                            sb.AppendFormatLine("Charges - {0}", trigger.ProcCharges);
                            sb.AppendLine("=================================================");
                            sb.AppendLine(trigger.ProcInfo);
                            sb.AppendLine("=================================================");
                        }
                    }
                    else
                    {
                        sb.AppendFormatLine("Trigger spell ({0}) Not found, Chance = {1}", tsId, spell.ProcChance);
                    }
                }

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

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

                sb.AppendLine();
            }
        }
Exemplo n.º 18
0
 public static void InvokeAppendLine(this RichTextBox box, string text, Color color, params object[] args)
 {
     box.Invoke((MethodInvoker) delegate { box.AppendLine(text, color, args); });
 }
Exemplo n.º 19
0
        private static void AuraModTypeName(RichTextBox rtb, SpellEffectEntry effect)
        {
            var aura = (AuraType)effect.EffectAura;
            var misc = effect.EffectMiscValues[0];

            if (effect.EffectAura == 0)
            {
                rtb.AppendFormatLineIfNotNull("EffectMiscValueA = {0}", effect.EffectMiscValues[0]);
                rtb.AppendFormatLineIfNotNull("EffectMiscValueB = {0}", effect.EffectMiscValues[1]);
                rtb.AppendFormatLineIfNotNull("EffectAmplitude = {0}", effect.EffectAmplitude);

                return;
            }

            rtb.AppendFormat("Aura Id {0:D} ({0})", aura);
            rtb.AppendFormat(", value = {0}", effect.EffectBasePoints);
            rtb.AppendFormat(", misc = {0} (", misc);

            switch (aura)
            {
            case AuraType.SPELL_AURA_MOD_STAT:
                rtb.Append((UnitMods)misc);
                break;

            case AuraType.SPELL_AURA_MOD_RATING:
            case AuraType.SPELL_AURA_MOD_RATING_PCT:
                rtb.Append((CombatRating)misc);
                break;

            case AuraType.SPELL_AURA_ADD_FLAT_MODIFIER:
            case AuraType.SPELL_AURA_ADD_PCT_MODIFIER:
                rtb.Append((SpellModOp)misc);
                break;

            // TODO: more case
            default:
                rtb.Append(misc);
                break;
            }

            rtb.AppendFormat("), miscB = {0}", effect.EffectMiscValues[1]);
            rtb.AppendFormatLine(", amplitude = {0}, periodic = {1}", effect.EffectAmplitude, effect.EffectAuraPeriod);

            switch (aura)
            {
            case AuraType.SPELL_AURA_OVERRIDE_SPELLS:
                if (!DBC.DBC.OverrideSpellData.ContainsKey(misc))
                {
                    rtb.SetStyle(Color.Red, FontStyle.Bold);
                    rtb.AppendFormatLine("Cannot find key {0} in OverrideSpellData.dbc", (uint)misc);
                }
                else
                {
                    rtb.AppendLine();
                    rtb.SetStyle(Color.DarkRed, FontStyle.Bold);
                    var @override = DBC.DBC.OverrideSpellData[misc];
                    for (var i = 0; i < 10; ++i)
                    {
                        if (@override.Spells[i] == 0)
                        {
                            continue;
                        }

                        rtb.SetStyle(Color.DarkBlue, FontStyle.Regular);
                        rtb.AppendFormatLine("\t - #{0} ({1}) {2}", i + 1, @override.Spells[i],
                                             DBC.DBC.SpellInfoStore.ContainsKey((int)@override.Spells[i]) ? DBC.DBC.SpellInfoStore[(int)@override.Spells[i]].Name : "?????");
                    }
                    rtb.AppendLine();
                }
                break;

            case AuraType.SPELL_AURA_SCREEN_EFFECT:
                rtb.SetStyle(Color.DarkBlue, FontStyle.Bold);
                rtb.AppendFormatLine("ScreenEffect: {0}",
                                     DBC.DBC.ScreenEffect.ContainsKey(misc) ? DBC.DBC.ScreenEffect[misc].Name : "?????");
                break;
            }
        }
Exemplo n.º 20
0
        private void AppendEffectInfo(RichTextBox rtb, SpellEffectEntry effect)
        {
            rtb.SetBold();
            rtb.AppendFormatLine($"Effect { effect.EffectIndex }: Id { effect.Effect } ({ (SpellEffects)effect.Effect })");
            rtb.SetBold();
            rtb.AppendFormatLine($"Difficulty: Id { effect.DifficultyID } ({ (Difficulty)effect.DifficultyID })");
            rtb.SetDefaultStyle();

            var value = 0.0f;

            if (effect.SpellEffectScalingEntry != null &&
                Math.Abs(effect.SpellEffectScalingEntry.Coefficient) > 1.0E-5f &&
                Scaling != null &&
                Scaling.ScalingClass != 0)
            {
                var level = (int)(DBC.DBC.SelectedLevel - 1);
                if ((AttributesEx11 & (uint)SpellAtributeEx11.SPELL_ATTR11_SCALES_WITH_ITEM_LEVEL) == 0)
                {
                    if ((AttributesEx10 & (uint)SpellAtributeEx10.SPELL_ATTR10_USE_SPELL_BASE_LEVEL_FOR_SCALING) != 0)
                    {
                        level = BaseLevel;
                    }
                }
                else
                {
                    level = (int)DBC.DBC.SelectedItemLevel;
                }

                if (Scaling.MaxScalingLevel != 0 && Scaling.MaxScalingLevel < level)
                {
                    level = (int)Scaling.MaxScalingLevel;
                }

                if (level < 1)
                {
                    level = 1;
                }

                if (Scaling.ScalingClass != 0)
                {
                    if (Scaling.ScalesFromItemLevel == 0)
                    {
                        if ((AttributesEx11 & (uint)SpellAtributeEx11.SPELL_ATTR11_SCALES_WITH_ITEM_LEVEL) == 0)
                        {
                            var gtScaling = GameTable <GtSpellScalingEntry> .GetRecord(level);

                            Debug.Assert(gtScaling != null);
                            value = gtScaling.GetColumnForClass(Scaling.ScalingClass);
                        }
                        else if (DBC.DBC.RandPropPoints.ContainsKey(level))
                        {
                            var randPropPoints = DBC.DBC.RandPropPoints[level];
                            value = randPropPoints.Superior[0];
                        }
                    }
                    else
                    {
                        if (DBC.DBC.RandPropPoints.ContainsKey(Scaling.ScalesFromItemLevel))
                        {
                            var randPropPoints = DBC.DBC.RandPropPoints[Scaling.ScalesFromItemLevel];
                            value = randPropPoints.Superior[0];
                        }
                    }

                    // if (level < Scaling.CastTimeMaxLevel && Scaling.CastTimeMax != 0)
                    //     value *= (float)(Scaling.CastTimeMin + (level - 1) * (Scaling.CastTimeMax - Scaling.CastTimeMin) / (Scaling.CastTimeMaxLevel - 1)) / (Scaling.CastTimeMax);

                    // if (level < Scaling.NerfMaxLevel)
                    //     value *= ((((1.0f - Scaling.NerfFactor) * (level - 1)) / (Scaling.NerfMaxLevel - 1)) + Scaling.NerfFactor);
                }

                value *= effect.SpellEffectScalingEntry.Coefficient;
                if (Math.Abs(value) > 1.0E-5f && value < 1.0f)
                {
                    value = 1.0f;
                }

                if (Math.Abs(effect.SpellEffectScalingEntry.Variance) > 1.0E-5f)
                {
                    var delta = Math.Abs(value * effect.SpellEffectScalingEntry.Variance * 0.5f);
                    rtb.AppendFormat("BasePoints = {0:F} to {1:F}", value - delta, value + delta);
                }
                else
                {
                    rtb.AppendFormat("BasePoints = {0:F}", value);
                }

                if (Math.Abs(effect.SpellEffectScalingEntry.ResourceCoefficient) > 1.0E-5f)
                {
                    rtb.AppendFormatIfNotNull(" + combo * {0:F}", effect.SpellEffectScalingEntry.ResourceCoefficient * value);
                }
            }
            else
            {
                rtb.AppendFormat("BasePoints = {0}", effect.EffectBasePoints + (effect.EffectDieSides == 0 ? 0 : 1));

                if (Math.Abs(effect.EffectRealPointsPerLevel) > 1.0E-5f)
                {
                    rtb.AppendFormat(" + Level * {0:F}", effect.EffectRealPointsPerLevel);
                }

                if (effect.EffectDieSides > 1)
                {
                    if (Math.Abs(effect.EffectRealPointsPerLevel) > 1.0E-5f)
                    {
                        rtb.AppendFormat(" to {0} + lvl * {1:F}",
                                         effect.EffectBasePoints + effect.EffectDieSides, effect.EffectRealPointsPerLevel);
                    }
                    else
                    {
                        rtb.AppendFormat(" to {0}", effect.EffectBasePoints + effect.EffectDieSides);
                    }
                }

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

            if (effect.EffectBonusCoefficient > 1.0E-5f)
            {
                rtb.AppendFormat(" + spellPower * {0}", effect.EffectBonusCoefficient);
            }

            if (effect.BonusCoefficientFromAP > 1.0E-5)
            {
                rtb.AppendFormat(" + AP * {0}", effect.BonusCoefficientFromAP);
            }

            // if (Math.Abs(effect.DamageMultiplier - 1.0f) > 1.0E-5f)
            //     rtb.AppendFormat(" x {0:F}", effect.DamageMultiplier);

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

            rtb.AppendFormatLine("Targets ({0}, {1}) ({2}, {3})",
                                 effect.ImplicitTarget[0], effect.ImplicitTarget[1],
                                 (Targets)effect.ImplicitTarget[0], (Targets)effect.ImplicitTarget[1]);

            AuraModTypeName(rtb, effect);

            var classMask = effect.EffectSpellClassMask;

            if (classMask[0] != 0 || classMask[1] != 0 || classMask[2] != 0 || classMask[3] != 0)
            {
                rtb.AppendFormatLine("SpellClassMask = {0:X8} {1:X8} {2:X8} {3:X8}", classMask[0], classMask[1], classMask[2], classMask[3]);

                var query = from spell in DBC.DBC.SpellInfoStore.Values
                            where spell.SpellFamilyName == SpellFamilyName && spell.SpellFamilyFlags.ContainsElement(classMask)
                            join sk in DBC.DBC.SkillLineAbility.Values on spell.ID equals sk.SpellID into temp
                            from skill in temp.DefaultIfEmpty(new SkillLineAbilityEntry())
                            select new
                {
                    SpellID   = spell.Spell.ID,
                    SpellName = spell.Spell.Name,
                    SkillId   = skill.SkillLine
                };

                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}", effect.Radius);
            rtb.AppendFormatLineIfNotNull("{0}", effect.MaxRadius);

            // append trigger spell
            var trigger = effect.EffectTriggerSpell;

            if (trigger != 0)
            {
                if (DBC.DBC.SpellInfoStore.ContainsKey((int)trigger))
                {
                    var triggerSpell = DBC.DBC.SpellInfoStore[(int)trigger];
                    rtb.SetStyle(Color.Blue, FontStyle.Bold);
                    rtb.AppendFormatLine("   Trigger spell ({0}) {1}. Chance = {2}", trigger, triggerSpell.Spell.Name, ProcChance);
                    rtb.AppendFormatLineIfNotNull("   Description: {0}", triggerSpell.Spell.Description);
                    rtb.AppendFormatLineIfNotNull("   ToolTip: {0}", triggerSpell.Spell.AuraDescription);
                    rtb.SetDefaultStyle();
                    if (triggerSpell.ProcFlags != 0)
                    {
                        rtb.AppendFormatLine("Charges - {0}", triggerSpell.ProcCharges);
                        rtb.AppendLine(Separator);
                        rtb.AppendLine(triggerSpell.ProcInfo);
                        rtb.AppendLine(Separator);
                    }
                }
                else
                {
                    rtb.AppendFormatLine("Trigger spell ({0}) Not found, Chance = {1}", trigger, ProcChance);
                }
            }

            rtb.AppendFormatLineIfNotNull("EffectChainTargets = {0}", effect.EffectChainTargets);
            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.AppendFormatLineIfNotNull("Attributes {0:X8} ({0})", effect.EffectAttributes);
            rtb.AppendLine();
        }
Exemplo n.º 21
0
        public void Write(RichTextBox rtb)
        {
            rtb.Clear();

            rtb.SetBold();
            rtb.AppendFormatLine("ID - {0} {1}{2}",
                                 ID, Name, Scaling != null ? $" (Level {DBC.DBC.SelectedLevel})" : string.Empty);
            rtb.SetDefaultStyle();

            rtb.AppendFormatLine(Separator);

            rtb.AppendLine(Description);
            rtb.AppendFormatLineIfNotNull("ToolTip: {0}", Tooltip);
            if (DescriptionVariables != null)
            {
                rtb.AppendLine("Description variables:");
                rtb.AppendLine(DescriptionVariables.Variables);
            }

            rtb.AppendFormatLineIfNotNull("Modal Next Spell: {0}", ModalNextSpell);
            if (!string.IsNullOrEmpty(Spell.Description) && !string.IsNullOrEmpty(Spell.AuraDescription) && ModalNextSpell != 0)
            {
                rtb.AppendFormatLine(Separator);
            }

            #region Triggered by ...
            var addline = false;
            if (DBC.DBC.SpellTriggerStore.ContainsKey(Spell.ID))
            {
                foreach (var procSpellId in DBC.DBC.SpellTriggerStore[Spell.ID])
                {
                    var procname = "Spell Not Found";
                    if (DBC.DBC.Spell.ContainsKey(procSpellId))
                    {
                        procname = DBC.DBC.Spell[procSpellId].Name;
                    }
                    rtb.SetStyle(Color.Blue, FontStyle.Bold);

                    rtb.AppendFormatLine("Triggered by spell: ({0}) {1}", procSpellId, procname);
                    rtb.SetDefaultStyle();
                    addline = true;
                }
            }
            if (addline)
            {
                rtb.AppendFormatLine(Separator);
            }
            #endregion

            rtb.AppendFormatLine($"Category = { Category }, IconFileDataID = { IconFileDataID }, ActiveIconFileDataID = { ActiveIconFileDataID }, SpellVisualID = { SpellVisualID }");

            rtb.AppendFormatLine("Family {0} ({1}), flag [0] 0x{2:X8} [1] 0x{3:X8} [2] 0x{4:X8} [3] 0x{5:X8}",
                                 (SpellFamilyNames)SpellFamilyName, SpellFamilyName,
                                 SpellFamilyFlags[0], SpellFamilyFlags[1], SpellFamilyFlags[2], SpellFamilyFlags[3]);

            #region Modified by ...
            foreach (var eff in
                     from s in DBC.DBC.SpellInfoStore.Values
                     where s.SpellFamilyName == SpellFamilyName
                     from eff in s.Effects
                     where eff != null && ((eff.EffectSpellClassMask[0] & SpellFamilyFlags[0]) != 0 ||
                                           (eff.EffectSpellClassMask[1] & SpellFamilyFlags[1]) != 0 ||
                                           (eff.EffectSpellClassMask[2] & SpellFamilyFlags[2]) != 0 ||
                                           (eff.EffectSpellClassMask[3] & SpellFamilyFlags[3]) != 0)
                     select eff)
            {
                rtb.SetStyle(Color.Blue, FontStyle.Bold);
                rtb.AppendFormatLine("Modified by {0} ({1})",
                                     DBC.DBC.SpellInfoStore[eff.SpellID].Spell.Name, eff.SpellID);
            }
            #endregion

            rtb.AppendLine();

            rtb.AppendFormatLine("SpellSchoolMask = {0} ({1})", (SpellSchoolMask)SchoolMask, SchoolMask);
            rtb.AppendFormatLine("DamageClass = {0} ({1})", DamageClass, (SpellDmgClass)DamageClass);
            rtb.AppendFormatLine("PreventionType = {0} ({1})", PreventionType, (SpellPreventionType)PreventionType);

            #region Attributes
            if (Misc != null && !Misc.Attributes.All(a => a == 0))
            {
                rtb.AppendLine(Separator);
            }

            if (Attributes != 0)
            {
                rtb.AppendFormatLine("Attributes: 0x{0:X8} ({1})", Attributes, (SpellAtribute)Attributes);
            }
            if (AttributesEx != 0)
            {
                rtb.AppendFormatLine("AttributesEx1: 0x{0:X8} ({1})", AttributesEx, (SpellAtributeEx)AttributesEx);
            }
            if (AttributesEx2 != 0)
            {
                rtb.AppendFormatLine("AttributesEx2: 0x{0:X8} ({1})", AttributesEx2, (SpellAtributeEx2)AttributesEx2);
            }
            if (AttributesEx3 != 0)
            {
                rtb.AppendFormatLine("AttributesEx3: 0x{0:X8} ({1})", AttributesEx3, (SpellAtributeEx3)AttributesEx3);
            }
            if (AttributesEx4 != 0)
            {
                rtb.AppendFormatLine("AttributesEx4: 0x{0:X8} ({1})", AttributesEx4, (SpellAtributeEx4)AttributesEx4);
            }
            if (AttributesEx5 != 0)
            {
                rtb.AppendFormatLine("AttributesEx5: 0x{0:X8} ({1})", AttributesEx5, (SpellAtributeEx5)AttributesEx5);
            }
            if (AttributesEx6 != 0)
            {
                rtb.AppendFormatLine("AttributesEx6: 0x{0:X8} ({1})", AttributesEx6, (SpellAtributeEx6)AttributesEx6);
            }
            if (AttributesEx7 != 0)
            {
                rtb.AppendFormatLine("AttributesEx7: 0x{0:X8} ({1})", AttributesEx7, (SpellAtributeEx7)AttributesEx7);
            }
            if (AttributesEx8 != 0)
            {
                rtb.AppendFormatLine("AttributesEx8: 0x{0:X8} ({1})", AttributesEx8, (SpellAtributeEx8)AttributesEx8);
            }
            if (AttributesEx9 != 0)
            {
                rtb.AppendFormatLine("AttributesEx9: 0x{0:X8} ({1})", AttributesEx9, (SpellAtributeEx9)AttributesEx9);
            }
            if (AttributesEx10 != 0)
            {
                rtb.AppendFormatLine("AttributesEx10: 0x{0:X8} ({1})", AttributesEx10, (SpellAtributeEx10)AttributesEx10);
            }
            if (AttributesEx11 != 0)
            {
                rtb.AppendFormatLine("AttributesEx11: 0x{0:X8} ({1})", AttributesEx11, (SpellAtributeEx11)AttributesEx11);
            }
            if (AttributesEx12 != 0)
            {
                rtb.AppendFormatLine("AttributesEx12: 0x{0:X8} ({1})", AttributesEx12, (SpellAtributeEx12)AttributesEx12);
            }
            if (AttributesEx13 != 0)
            {
                rtb.AppendFormatLine("AttributesEx13: 0x{0:X8} ({1})", AttributesEx13, (SpellAtributeEx13)AttributesEx13);
            }

            rtb.AppendLine(Separator);
            #endregion

            if (TargetRestrictions != null)
            {
                foreach (var targetRestriction in TargetRestrictions)
                {
                    if (targetRestriction.Targets != 0)
                    {
                        rtb.AppendFormatLine("Targets Mask = 0x{0:X8} ({1})", targetRestriction.Targets, (SpellCastTargetFlags)targetRestriction.Targets);
                    }

                    if (targetRestriction.TargetCreatureType != 0)
                    {
                        rtb.AppendFormatLine("Creature Type Mask = 0x{0:X8} ({1})",
                                             targetRestriction.TargetCreatureType, (CreatureTypeMask)targetRestriction.TargetCreatureType);
                    }

                    if (targetRestriction.MaxAffectedTargets != 0)
                    {
                        rtb.AppendFormatLine("MaxAffectedTargets: {0}", targetRestriction.MaxAffectedTargets);
                    }
                }
            }

            if (Stances != 0)
            {
                rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)Stances);
            }

            if (StancesNot != 0)
            {
                rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)StancesNot);
            }

            // Skills
            {
                var query = DBC.DBC.SkillLineAbility.Where(skl => skl.Value.SpellID == Spell.ID).ToArray();
                if (query.Length != 0)
                {
                    var skill = query.First().Value;
                    var line  = DBC.DBC.SkillLine[skill.SkillLine];

                    rtb.AppendFormatLine(@"Skill (Id {0}) ""{1}""", skill.SkillLine, line.DisplayName);
                    rtb.AppendFormat("    MinSkillLineRank {0}", skill.MinSkillLineRank);

                    rtb.AppendFormat(", SupercedesSpell = {0}, MinMaxValue ({1}, {2})", skill.SupercedesSpell,
                                     skill.TrivialSkillLineRankLow, skill.TrivialSkillLineRankHigh);
                    rtb.AppendFormat(", NumSkillups ({0})", skill.NumSkillUps);
                }
            }

            // SpellReagents
            {
                var printedHeader = false;
                for (var i = 0; Reagents != null && i < Reagents.ReagentCount.Length; ++i)
                {
                    if (Reagents.ReagentCount[i] == 0 || Reagents.Reagent[i] == 0)
                    {
                        continue;
                    }

                    if (!printedHeader)
                    {
                        rtb.AppendLine();
                        rtb.Append("Reagents:");
                        printedHeader = true;
                    }

                    rtb.AppendFormat("  {0} x{1}", Reagents.Reagent[i], Reagents.ReagentCount[i]);
                }

                if (printedHeader)
                {
                    rtb.AppendLine();
                }
            }

            // SpellReagentsCurrency
            {
                var printedHeader = false;
                foreach (var reagentsCurrency in ReagentsCurrency)
                {
                    if (!printedHeader)
                    {
                        rtb.AppendLine();
                        rtb.Append("ReagentsCurrency:");
                        printedHeader = true;
                    }

                    rtb.AppendFormat("  {0} x{1}", reagentsCurrency.CurrencyTypeID, reagentsCurrency.CurrencyCount);
                }

                if (printedHeader)
                {
                    rtb.AppendLine();
                }
            }

            rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}, max usable {3}",
                                 SpellLevel, BaseLevel, MaxLevel, MaxUsableLevel);

            if (EquippedItemClass != 0)
            {
                rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", EquippedItemClass, (ItemClass)EquippedItemClass);

                if (EquippedItemSubClassMask != 0)
                {
                    switch ((ItemClass)EquippedItemClass)
                    {
                    case ItemClass.WEAPON:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})", EquippedItemSubClassMask, (ItemSubClassWeaponMask)EquippedItemSubClassMask);
                        break;

                    case ItemClass.ARMOR:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})", EquippedItemSubClassMask, (ItemSubClassArmorMask)EquippedItemSubClassMask);
                        break;

                    case ItemClass.MISC:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})", EquippedItemSubClassMask, (ItemSubClassMiscMask)EquippedItemSubClassMask);
                        break;
                    }
                }

                if (EquippedItemInventoryTypeMask != 0)
                {
                    rtb.AppendFormatLine("    InventoryType mask = 0x{0:X8} ({1})", EquippedItemInventoryTypeMask, (InventoryTypeMask)EquippedItemInventoryTypeMask);
                }
            }

            rtb.AppendLine();
            rtb.AppendFormatLine("Category = {0}", Category);
            rtb.AppendFormatLine("DispelType = {0} ({1})", Dispel, (DispelType)Dispel);
            rtb.AppendFormatLine("Mechanic = {0} ({1})", Mechanic, (Mechanics)Mechanic);

            if (Range != null)
            {
                rtb.AppendFormatLine("SpellRange: (Id {0}) \"{1}\":", RangeIndex, Range.DisplayName);
                rtb.AppendFormatLine("    MinRangeNegative = {0}, MinRangePositive = {1}", Range.MinRange[0], Range.MinRange[1]);
                rtb.AppendFormatLine("    MaxRangeNegative = {0}, MaxRangePositive = {1}", Range.MaxRange[0], Range.MaxRange[1]);
            }

            if (Misc != null)
            {
                rtb.AppendFormatLineIfNotNull("Speed {0:F}", Speed);
            }

            rtb.AppendFormatLineIfNotNull("Stackable up to {0}", CumulativeAura);

            if (CastingTimeIndex != 0)
            {
                var castTimeEntry = DBC.DBC.SpellCastTimes[CastingTimeIndex];

                var level = DBC.DBC.SelectedLevel;
                if (Scaling != null && level > Scaling.MaxScalingLevel)
                {
                    level = Scaling.MaxScalingLevel;
                }

                if (((SpellAtributeEx13)AttributesEx13).HasFlag(SpellAtributeEx13.SPELL_ATTR13_UNK17))
                {
                    level *= 5;
                }

                if (Scaling != null && level > Scaling.MaxScalingLevel)
                {
                    level = Scaling.MaxScalingLevel;
                }

                if (Levels != null && Levels.BaseLevel != 0)
                {
                    level -= Levels.BaseLevel;
                }

                if (Scaling != null && level < Scaling.MinScalingLevel)
                {
                    level = Scaling.MinScalingLevel;
                }

                var castTime = castTimeEntry.CastTime + castTimeEntry.CastTimePerLevel * level;
                if (castTime < castTimeEntry.MinCastTime)
                {
                    castTime = castTimeEntry.MinCastTime;
                }

                rtb.AppendFormatLine("Cast Time: (ID {0}): {1}", CastingTimeIndex, castTime);
            }

            if (RecoveryTime != 0 || CategoryRecoveryTime != 0 || StartRecoveryCategory != 0)
            {
                rtb.AppendFormatLine("RecoveryTime: {0} ms, CategoryRecoveryTime: {1} ms", RecoveryTime, CategoryRecoveryTime);
                rtb.AppendFormatLine("StartRecoveryCategory = {0}, StartRecoveryTime = {1:F} ms", StartRecoveryCategory, StartRecoveryTime);
            }

            if (DurationEntry != null)
            {
                rtb.AppendFormatLine("Duration {0}, {1}, {2}", Duration, DurationPerLevel, MaxDuration);
            }

            if (Interrupts != null)
            {
                rtb.AppendFormatLine("Interrupt Flags: 0x{0:X8} ({1})", Interrupts.InterruptFlags, (SpellInterruptFlags)Interrupts.InterruptFlags);
                rtb.AppendFormatLine("AuraInterrupt Flags: 0x{0:X8} ({1}), 0x{2:X8} ({3})", Interrupts.AuraInterruptFlags[0], (SpellAuraInterruptFlags)Interrupts.AuraInterruptFlags[0], Interrupts.AuraInterruptFlags[1], (SpellAuraInterruptFlags)Interrupts.AuraInterruptFlags[1]);
                rtb.AppendFormatLine("ChannelInterrupt Flags: 0x{0:X8} ({1}), 0x{2:X8} ({3})", Interrupts.ChannelInterruptFlags[0], (SpellChannelInterruptFlags)Interrupts.ChannelInterruptFlags[0], Interrupts.ChannelInterruptFlags[1], (SpellChannelInterruptFlags)Interrupts.ChannelInterruptFlags[1]);
            }

            if (CasterAuraState != 0)
            {
                rtb.AppendFormatLine("CasterAuraState = {0} ({1})", CasterAuraState, (AuraState)CasterAuraState);
            }

            if (TargetAuraState != 0)
            {
                rtb.AppendFormatLine("TargetAuraState = {0} ({1})", TargetAuraState, (AuraState)TargetAuraState);
            }

            if (CasterAuraStateNot != 0)
            {
                rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", CasterAuraStateNot, (AuraState)CasterAuraStateNot);
            }

            if (TargetAuraStateNot != 0)
            {
                rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", TargetAuraStateNot, (AuraState)TargetAuraStateNot);
            }

            if (CasterAuraSpell != 0)
            {
                if (DBC.DBC.SpellInfoStore.ContainsKey(CasterAuraSpell))
                {
                    rtb.AppendFormatLine("  Caster Aura Spell ({0}) {1}", CasterAuraSpell, DBC.DBC.SpellInfoStore[CasterAuraSpell].Spell.Name);
                }
                else
                {
                    rtb.AppendFormatLine("  Caster Aura Spell ({0}) ?????", CasterAuraSpell);
                }
            }

            if (TargetAuraSpell != 0)
            {
                if (DBC.DBC.SpellInfoStore.ContainsKey(TargetAuraSpell))
                {
                    rtb.AppendFormatLine("  Target Aura Spell ({0}) {1}", TargetAuraSpell, DBC.DBC.SpellInfoStore[TargetAuraSpell].Spell.Name);
                }
                else
                {
                    rtb.AppendFormatLine("  Target Aura Spell ({0}) ?????", TargetAuraSpell);
                }
            }

            if (ExcludeCasterAuraSpell != 0)
            {
                if (DBC.DBC.SpellInfoStore.ContainsKey(ExcludeCasterAuraSpell))
                {
                    rtb.AppendFormatLine("  Ex Caster Aura Spell ({0}) {1}", ExcludeCasterAuraSpell, DBC.DBC.SpellInfoStore[ExcludeCasterAuraSpell].Spell.Name);
                }
                else
                {
                    rtb.AppendFormatLine("  Ex Caster Aura Spell ({0}) ?????", ExcludeCasterAuraSpell);
                }
            }

            if (ExcludeTargetAuraSpell != 0)
            {
                if (DBC.DBC.SpellInfoStore.ContainsKey(ExcludeTargetAuraSpell))
                {
                    rtb.AppendFormatLine("  Ex Target Aura Spell ({0}) {1}", ExcludeTargetAuraSpell, DBC.DBC.SpellInfoStore[ExcludeTargetAuraSpell].Spell.Name);
                }
                else
                {
                    rtb.AppendFormatLine("  Ex Target Aura Spell ({0}) ?????", ExcludeTargetAuraSpell);
                }
            }

            if (RequiredAreasId > 0)
            {
                var areas = DBC.DBC.AreaGroupMember.Values.Where(ag => ag.AreaGroupId == RequiredAreasId).ToList();
                if (areas.Count == 0)
                {
                    rtb.AppendFormatLine("Cannot find area group id {0} in AreaGroupMember.db2!", RequiredAreasId);
                }
                else
                {
                    rtb.AppendLine();
                    rtb.SetBold();
                    rtb.AppendLine("Allowed areas:");
                    foreach (var areaGroupMember in areas)
                    {
                        var areaId = areaGroupMember.AreaId;
                        if (!DBC.DBC.AreaTable.ContainsKey(areaId))
                        {
                            continue;
                        }

                        var areaEntry = DBC.DBC.AreaTable[areaId];
                        rtb.AppendFormatLine("{0} - {1} (Map: {2})", areaId, areaEntry.AreaName, areaEntry.MapID);
                    }

                    rtb.AppendLine();
                }
            }

            rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", RequiresSpellFocus);

            if (Math.Abs(BaseProcRate) > 1.0E-5f)
            {
                rtb.SetBold();
                rtb.AppendFormatLine("PPM flag 0x{0:X2} BaseRate {1}", ProcsPerMinuteFlags, BaseProcRate);
                rtb.SetDefaultStyle();
            }

            if (ProcFlags != 0)
            {
                rtb.SetBold();
                rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance: {1}%, charges: {2}, cooldown: {3}",
                                     ProcFlags, ProcChance, ProcCharges, ProcCooldown);
                rtb.SetDefaultStyle();
                rtb.AppendFormatLine(Separator);
                rtb.AppendText(ProcInfo);
            }
            else
            {
                rtb.AppendFormatLine("Chance = {0}, charges - {1}", ProcChance, ProcCharges);
            }

            rtb.AppendLine(Separator);
            foreach (var effect in Effects)
            {
                AppendEffectInfo(rtb, effect);
            }

            AppendItemInfo(rtb);

            AppendSpellVisualInfo();
        }
Exemplo n.º 22
0
        public static void RunDiff(TextSection oldText, TextSection newText, RichTextBox rtb)
        {
            // Longest common subsequence, simple edition. If/when something faster is needed,
            // should probably take a dependency on a proper diff package. Other than shorter
            // comparison windows, other things to look for are avoiding creating strings here,
            // working on the RichTextBox buffer directly for color, and unique'ing lines.
            string[] oldLines = oldText.Lines;
            string[] newLines = newText.Lines;
            // Reduce strings to hashes.
            int[] oldHashes = oldText.LineHashes;
            int[] newHashes = newText.LineHashes;
            // Reduce by trimming prefix and suffix.
            int diffStart = 0;

            while (diffStart < oldHashes.Length && diffStart < newHashes.Length && oldHashes[diffStart] == newHashes[diffStart])
            {
                diffStart++;
            }
            int newDiffEndExc = newLines.Length, oldDiffEndExc = oldLines.Length;

            while (newDiffEndExc > diffStart && oldDiffEndExc > diffStart)
            {
                if (oldHashes[oldDiffEndExc - 1] == newHashes[newDiffEndExc - 1])
                {
                    oldDiffEndExc--;
                    newDiffEndExc--;
                }
                else
                {
                    break;
                }
            }
            int suffixLength = (newLines.Length - newDiffEndExc);
            // Build LCS table.
            int oldLen = oldDiffEndExc - diffStart, newLen = newDiffEndExc - diffStart;

            int[,] lcs = new int[oldLen + 1, newLen + 1]; // already zero-initialized
            for (int i = 0; i < oldLen; i++)
            {
                for (int j = 0; j < newLen; j++)
                {
                    if (oldHashes[i + diffStart] == newHashes[j + diffStart])
                    {
                        lcs[i + 1, j + 1] = lcs[i, j] + 1;
                    }
                    else
                    {
                        lcs[i + 1, j + 1] = Math.Max(lcs[i, j + 1], lcs[i + 1, j]);
                    }
                }
            }
            // Print the diff - common prefix, backtracked diff and common suffix.
            rtb.AppendLines("  ", newLines, 0, diffStart, Color.White);
            {
                int            i = oldLen, j = newLen;
                Stack <string> o = new Stack <string>();
                for (;;)
                {
                    if (i > 0 && j > 0 && oldHashes[diffStart + i - 1] == newHashes[diffStart + j - 1])
                    {
                        o.Push("  " + oldLines[diffStart + i - 1]);
                        i--;
                        j--;
                    }
                    else if (j > 0 && (i == 0 || lcs[i, j - 1] >= lcs[i - 1, j]))
                    {
                        o.Push("+ " + newLines[diffStart + j - 1]);
                        j--;
                    }
                    else if (i > 0 && (j == 0 || lcs[i, j - 1] < lcs[i - 1, j]))
                    {
                        o.Push("- " + oldLines[diffStart + i - 1]);
                        i--;
                    }
                    else
                    {
                        break;
                    }
                }
                while (o.Count != 0)
                {
                    string line = o.Pop();
                    Color  c    = (line[0] == ' ') ? Color.White :
                                  ((line[0] == '+') ? Color.Yellow : Color.Red);
                    rtb.AppendLine(line, c);
                }
            }
            rtb.AppendLines("  ", newLines, newDiffEndExc, (newLines.Length - newDiffEndExc), Color.White);
        }
Exemplo n.º 23
0
 public static void AppendLine(this RichTextBox rtb, StringBuilder line)
 {
     rtb.AppendLine(line.FromUTF8());
 }
Exemplo n.º 24
0
 /// <summary>
 /// Appends the formatted line to textBox
 /// </summary>
 public static void AppendLine(this RichTextBox textBox, String format, params object[] args)
 {
     textBox.AppendLine(String.Format(format, args));
 }
Exemplo n.º 25
0
        private void ViewSpellInfo()
        {
            _rtb.Clear();
            _rtb.SetBold();
            _rtb.AppendFormatLine("ID - {0} {1}{2}", _spell.ID, _spell.SpellNameRank, _spell.ScalingText);
            _rtb.SetDefaultStyle();

            _rtb.AppendFormatLine(_line);

            _rtb.AppendLine(_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.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]);

            _rtb.AppendFormatLine("Family {0}, flag [0] 0x{1:X8} [1] 0x{2:X8} [2] 0x{3:X8} [3] 0x{4:X8}",
                                  (SpellFamilyNames)_spell.SpellFamilyName, _spell.SpellFamilyFlags[0], _spell.SpellFamilyFlags[1], _spell.SpellFamilyFlags[2], _spell.SpellFamilyFlags[3]);

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

            if (_spell.Attributes != 0 || _spell.AttributesEx != 0 || _spell.AttributesEx2 != 0 || _spell.AttributesEx3 != 0 || _spell.AttributesEx4 != 0 ||
                _spell.AttributesEx5 != 0 || _spell.AttributesEx6 != 0 || _spell.AttributesEx7 != 0 || _spell.AttributesEx8 != 0)
            {
                _rtb.AppendLine(_line);
            }

            if (_spell.Attributes != 0)
            {
                _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);
            }
            if (_spell.AttributesEx2 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx2: 0x{0:X8} ({1})", _spell.AttributesEx2, (SpellAtributeEx2)_spell.AttributesEx2);
            }
            if (_spell.AttributesEx3 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx3: 0x{0:X8} ({1})", _spell.AttributesEx3, (SpellAtributeEx3)_spell.AttributesEx3);
            }
            if (_spell.AttributesEx4 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx4: 0x{0:X8} ({1})", _spell.AttributesEx4, (SpellAtributeEx4)_spell.AttributesEx4);
            }
            if (_spell.AttributesEx5 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx5: 0x{0:X8} ({1})", _spell.AttributesEx5, (SpellAtributeEx5)_spell.AttributesEx5);
            }
            if (_spell.AttributesEx6 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx6: 0x{0:X8} ({1})", _spell.AttributesEx6, (SpellAtributeEx6)_spell.AttributesEx6);
            }
            if (_spell.AttributesEx7 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx7: 0x{0:X8} ({1})", _spell.AttributesEx7, (SpellAtributeEx7)_spell.AttributesEx7);
            }
            if (_spell.AttributesEx8 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx8: 0x{0:X8} ({1})", _spell.AttributesEx8, (SpellAtributeEx8)_spell.AttributesEx8);
            }
            if (_spell.AttributesEx9 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx9: 0x{0:X8} ({1})", _spell.AttributesEx9, (SpellAtributeEx9)_spell.AttributesEx9);
            }
            if (_spell.AttributesEx10 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx10: 0x{0:X8} ({1})", _spell.AttributesEx10, (SpellAtributeEx10)_spell.AttributesEx10);
            }
            if (_spell.AttributesEx11 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx11: 0x{0:X8} ({1})", _spell.AttributesEx11, (SpellAtributeEx11)_spell.AttributesEx11);
            }
            if (_spell.AttributesEx12 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx12: 0x{0:X8} ({1})", _spell.AttributesEx12, (SpellAtributeEx12)_spell.AttributesEx12);
            }
            if (_spell.AttributesEx13 != 0)
            {
                _rtb.AppendFormatLine("AttributesEx13: 0x{0:X8} ({1})", _spell.AttributesEx13, (SpellAtributeEx13)_spell.AttributesEx13);
            }

            _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 (_spell.Stances != 0)
            {
                _rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)_spell.Stances);
            }

            if (_spell.StancesNot != 0)
            {
                _rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)_spell.StancesNot);
            }

            AppendSkillLine();

            // reagents
            {
                var printedHeader = false;
                for (var i = 0; i < _spell.Reagent.Length; ++i)
                {
                    if (_spell.Reagent[i] == 0)
                    {
                        continue;
                    }

                    if (!printedHeader)
                    {
                        _rtb.AppendLine();
                        _rtb.Append("Reagents:");
                        printedHeader = true;
                    }

                    _rtb.AppendFormat("  {0} x{1}", _spell.Reagent[i], _spell.ReagentCount[i]);
                }

                if (printedHeader)
                {
                    _rtb.AppendLine();
                }
            }

            _rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}, maxTarget {3}",
                                  _spell.SpellLevel, _spell.BaseLevel, _spell.MaxLevel, _spell.MaxTargetLevel);

            if (_spell.EquippedItemClass != 0)
            {
                _rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", _spell.EquippedItemClass, (ItemClass)_spell.EquippedItemClass);

                if (_spell.EquippedItemSubClassMask != 0)
                {
                    switch ((ItemClass)_spell.EquippedItemClass)
                    {
                    case ItemClass.WEAPON:
                        _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                              _spell.EquippedItemSubClassMask, (ItemSubClassWeaponMask)_spell.EquippedItemSubClassMask);
                        break;

                    case ItemClass.ARMOR:
                        _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                              _spell.EquippedItemSubClassMask, (ItemSubClassArmorMask)_spell.EquippedItemSubClassMask);
                        break;

                    case ItemClass.MISC:
                        _rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                              _spell.EquippedItemSubClassMask, (ItemSubClassMiscMask)_spell.EquippedItemSubClassMask);
                        break;
                    }
                }

                if (_spell.EquippedItemInventoryTypeMask != 0)
                {
                    _rtb.AppendFormatLine("    InventoryType mask = 0x{0:X8} ({1})",
                                          _spell.EquippedItemInventoryTypeMask, (InventoryTypeMask)_spell.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.AppendLine(_spell.Range);

            _rtb.AppendFormatLineIfNotNull("Speed {0:F}", _spell.Speed);
            _rtb.AppendFormatLineIfNotNull("Stackable up to {0}", _spell.StackAmount);

            _rtb.AppendLine(_spell.CastTime);

            if (_spell.RecoveryTime != 0 || _spell.CategoryRecoveryTime != 0 || _spell.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.AppendLine(_spell.Duration);

            if (_spell.ManaCost != 0 || _spell.ManaCostPercentage != 0)
            {
                _rtb.AppendFormat("Power {0}, Cost {1}",
                                  (Powers)_spell.PowerType, _spell.ManaCost == 0 ? _spell.ManaCostPercentage + " %" : _spell.ManaCost.ToString());
                _rtb.AppendFormatIfNotNull(" + lvl * {0}", _spell.ManaCostPerlevel);
                _rtb.AppendFormatIfNotNull(" + {0} Per Second", _spell.ManaPerSecond);
                _rtb.AppendLine();
            }

            _rtb.AppendFormatLine("Interrupt Flags: 0x{0:X8}, AuraIF 0x{1:X8}, ChannelIF 0x{2:X8}",
                                  _spell.InterruptFlags, _spell.AuraInterruptFlags, _spell.ChannelInterruptFlags);

            if (_spell.CasterAuraState != 0)
            {
                _rtb.AppendFormatLine("CasterAuraState = {0} ({1})", _spell.CasterAuraState, (AuraState)_spell.CasterAuraState);
            }

            if (_spell.TargetAuraState != 0)
            {
                _rtb.AppendFormatLine("TargetAuraState = {0} ({1})", _spell.TargetAuraState, (AuraState)_spell.TargetAuraState);
            }

            if (_spell.CasterAuraStateNot != 0)
            {
                _rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", _spell.CasterAuraStateNot, (AuraState)_spell.CasterAuraStateNot);
            }

            if (_spell.TargetAuraStateNot != 0)
            {
                _rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", _spell.TargetAuraStateNot, (AuraState)_spell.TargetAuraStateNot);
            }

            if (_spell.MaxAffectedTargets != 0)
            {
                _rtb.AppendFormatLine("MaxAffectedTargets = {0}", _spell.MaxAffectedTargets);
            }

            AppendSpellAura();

            AppendAreaInfo();

            _rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", _spell.RequiresSpellFocus);

            if (_spell.ProcFlags != 0)
            {
                _rtb.SetBold();
                _rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance = {1}, charges - {2}",
                                      _spell.ProcFlags, _spell.ProcChance, _spell.ProcCharges);
                _rtb.SetDefaultStyle();
                _rtb.AppendFormatLine(_line);
                _rtb.AppendText(_spell.ProcInfo);
            }
            else
            {
                _rtb.AppendFormatLine("Chance = {0}, charges - {1}", _spell.ProcChance, _spell.ProcCharges);
            }

            AppendSpellEffectInfo();
            AppendItemInfo();
            AppendDifficultyInfo();

            AppendSpellVisualInfo();
        }
Exemplo n.º 26
0
        public void ViewSeatInfo()
        {
            _rtb.Clear();
            _rtb.SetBold();
            _rtb.AppendFormatLine("Seat ID: {0}", Seat.Id);
            _rtb.SetDefaultStyle();

            _rtb.AppendFormatLine("Attachment ID: {0}", Seat.AttachmentId);
            _rtb.AppendFormatLine("Attachment Offset X: {0}", Seat.AttachmentOffsetX);
            _rtb.AppendFormatLine("Attachment Offset Y: {0}", Seat.AttachmentOffsetY);
            _rtb.AppendFormatLine("Attachment Offset Z: {0}", Seat.AttachmentOffsetZ);
            _rtb.AppendFormatLine("Enter Pre-delay: {0}", Seat.EnterPreDelay);
            _rtb.AppendFormatLine("Enter Speed: {0}", Seat.EnterSpeed);
            _rtb.AppendFormatLine("Enter Gravity: {0}", Seat.EnterGravity);
            _rtb.AppendFormatLine("Enter Duration Min: {0}", Seat.EnterMinDuration);
            _rtb.AppendFormatLine("Enter Duration Max: {0}", Seat.EnterMaxDuration);
            _rtb.AppendFormatLine("Enter Arc Height Min: {0}", Seat.EnterMinArcHeight);
            _rtb.AppendFormatLine("Enter Arc Height Max: {0}", Seat.EnterMaxArcHeight);
            _rtb.AppendFormatLine("Enter Animation Start: {0}", Seat.EnterAnimStart);
            _rtb.AppendFormatLine("Enter Animation Loop: {0}", Seat.EnterAnimLoop);
            _rtb.AppendFormatLine("Ride Animation Start: {0}", Seat.RideAnimStart);
            _rtb.AppendFormatLine("Ride Animation Loop: {0}", Seat.RideAnimLoop);
            _rtb.AppendFormatLine("Ride Upper Animation Start: {0}", Seat.RideUpperAnimStart);
            _rtb.AppendFormatLine("Ride Upper Animation Loop: {0}", Seat.RideUpperAnimLoop);
            _rtb.AppendFormatLine("Exit Pre-delay: {0}", Seat.ExitPreDelay);
            _rtb.AppendFormatLine("Exit Gravity: {0}", Seat.ExitGravity);
            _rtb.AppendFormatLine("Exit Duration Min: {0}", Seat.ExitMinDuration);
            _rtb.AppendFormatLine("Exit Duration Max: {0}", Seat.ExitMaxDuration);
            _rtb.AppendFormatLine("Exit Arc Height Min: {0}", Seat.ExitMinArcHeight);
            _rtb.AppendFormatLine("Exit Arc height Max: {0}", Seat.ExitMaxArcHeight);
            _rtb.AppendFormatLine("Exit Animation Start: {0}", Seat.ExitAnimStart);
            _rtb.AppendFormatLine("Exit Animation Loop: {0}", Seat.ExitAnimLoop);
            _rtb.AppendFormatLine("Exit Animation End: {0}", Seat.ExitAnimEnd);
            _rtb.AppendFormatLine("Passenger Yaw: {0}", Seat.PassengerYaw);
            _rtb.AppendFormatLine("Passenger Pitch: {0}", Seat.PassengerPitch);
            _rtb.AppendFormatLine("Passenger Roll: {0}", Seat.PassengerRoll);
            _rtb.AppendFormatLine("Passenger Attachment ID: {0}", Seat.PassengerAttachmentId);
            _rtb.AppendFormatLine("Vehicle Enter Animation: {0}", Seat.VehicleEnterAnim);
            _rtb.AppendFormatLine("Vehicle Enter Animation Bone: {0}", Seat.VehicleEnterAnimBone);
            _rtb.AppendFormatLine("Vehicle Enter Animation Delay: {0}", Seat.VehicleEnterAnimDelay);
            _rtb.AppendFormatLine("Vehicle Exit Animation: {0}", Seat.VehicleExitAnim);
            _rtb.AppendFormatLine("Vehicle Exit Animation Bone: {0}", Seat.VehicleExitAnimBone);
            _rtb.AppendFormatLine("Vehicle Exit Animation Delay: {0}", Seat.VehicleExitAnimDelay);
            _rtb.AppendFormatLine("Vehicle Ride Animation Loop: {0}", Seat.VehicleRideAnimLoop);
            _rtb.AppendFormatLine("Vehicle Ride Animation Loop Bone: {0}", Seat.VehicleRideAnimLoopBone);
            _rtb.AppendFormatLine("Vehicle Ability Display: {0}", Seat.VehicleAbilityDisplay);
            _rtb.AppendFormatLine("Vehicle Enter UI Sound ID: {0}", Seat.EnterUiSoundId);
            _rtb.AppendFormatLine("Vehicle Exit UI Sound ID: {0}", Seat.ExitUiSoundId);
            _rtb.AppendFormatLine("Vehicle Skin: {0}", Seat.Skin);
            _rtb.AppendFormatLine("Unk1: {0}", Seat.Unk1);
            _rtb.AppendFormatLine("Unk2: {0}", Seat.Unk2);
            _rtb.AppendFormatLine("Unk3: {0}", Seat.Unk3);
            _rtb.AppendFormatLine("Unk4: {0}", Seat.Unk4);
            _rtb.AppendFormatLine("Unk5: {0}", Seat.Unk5);
            _rtb.AppendFormatLine("Unk6: {0}", Seat.Unk6);
            _rtb.AppendFormatLine("Unk7: {0}", Seat.Unk7);
            _rtb.AppendFormatLine("Unk8: {0}", Seat.Unk8);
            _rtb.AppendFormatLine("Unk9: {0}", Seat.Unk9);
            _rtb.AppendFormatLine("Unk10: {0}", Seat.Unk10);
            _rtb.AppendFormatLine("Unk11: {0}", Seat.Unk11);
            _rtb.AppendFormatLine("Unk12: {0}", Seat.Unk12);
            _rtb.AppendLine();

            _rtb.SetBold();
            _rtb.AppendFormatLine("Has VehiceSeatFlags:");
            _rtb.SetDefaultStyle();
            for (var i = 0; i < 32; ++i)
            {
                if (Seat.Flags.HasFlag((VehicleSeatFlags)(1 << i)))
                {
                    _rtb.AppendFormatLine("{0}", (VehicleSeatFlags)(1 << i));
                }
            }


            _rtb.AppendLine();
            _rtb.SetBold();
            _rtb.AppendFormatLine("Has VehiceSeatFlagsB:");
            _rtb.SetDefaultStyle();
            for (var i = 0; i < 32; ++i)
            {
                if ((Seat.FlagsB & (1 << i)) != 0L)
                {
                    _rtb.AppendFormatLine("{0}", (VehicleSeatFlagsB)(1 << i));
                }
            }
            _rtb.SetDefaultStyle();
        }
Exemplo n.º 27
0
 /// <summary>
 /// 追加蓝色提醒文本行
 /// </summary>
 /// <param name="box"></param>
 /// <param name="text"></param>
 public static void AppendWarn(this RichTextBox box, string text)
 {
     box.AppendLine(text, Color.Blue);
 }
Exemplo n.º 28
0
        private void ViewSpellInfo()
        {
            rtb.Clear();
            rtb.SetBold();
            rtb.AppendFormatLine("ID - {0} {1}", spell.ID, spell.SpellNameRank);
            rtb.SetDefaultStyle();

            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.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]);

            rtb.AppendFormatLine("Family {0}, flag 0x{1:X8} {2:X8} {3:X8}",
                                 (SpellFamilyNames)spell.SpellFamilyName, spell.SpellFamilyFlags[2], spell.SpellFamilyFlags[1], spell.SpellFamilyFlags[0]);

            rtb.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);

            if (spell.Attributes != 0 || spell.AttributesEx != 0 || spell.AttributesEx2 != 0 || spell.AttributesEx3 != 0 ||
                spell.AttributesEx4 != 0 || spell.AttributesEx5 != 0 || spell.AttributesEx6 != 0 || spell.AttributesEx7 != 0)
            {
                rtb.AppendLine(_line);
            }

            rtb.AppendFormatLineIfNotNull("Attributes   : 0x{0:X8} ({1})", spell.Attributes, (SpellAtribute)spell.Attributes);
            rtb.AppendFormatLineIfNotNull("AttributesEx1: 0x{0:X8} ({1})", spell.AttributesEx, (SpellAtributeEx)spell.AttributesEx);
            rtb.AppendFormatLineIfNotNull("AttributesEx2: 0x{0:X8} ({1})", spell.AttributesEx2, (SpellAtributeEx2)spell.AttributesEx2);
            rtb.AppendFormatLineIfNotNull("AttributesEx3: 0x{0:X8} ({1})", spell.AttributesEx3, (SpellAtributeEx3)spell.AttributesEx3);
            rtb.AppendFormatLineIfNotNull("AttributesEx4: 0x{0:X8} ({1})", spell.AttributesEx4, (SpellAtributeEx4)spell.AttributesEx4);
            rtb.AppendFormatLineIfNotNull("AttributesEx5: 0x{0:X8} ({1})", spell.AttributesEx5, (SpellAtributeEx5)spell.AttributesEx5);
            rtb.AppendFormatLineIfNotNull("AttributesEx6: 0x{0:X8} ({1})", spell.AttributesEx6, (SpellAtributeEx6)spell.AttributesEx6);
            rtb.AppendFormatLineIfNotNull("AttributesEx7: 0x{0:X8} ({1})", spell.AttributesEx7, (SpellAtributeEx7)spell.AttributesEx7);

            rtb.AppendLine(_line);


            rtb.AppendFormatLineIfNotNull("Targets Mask = 0x{0:X8} ({1})", spell.Targets, (SpellCastTargetFlags)spell.Targets);
            rtb.AppendFormatLineIfNotNull("Creature Type Mask = 0x{0:X8} ({1})", spell.TargetCreatureType, (CreatureTypeMask)spell.TargetCreatureType);

            if (spell.Stances != 0)
            {
                rtb.AppendFormatLine("Stances: {0}", (ShapeshiftFormMask)spell.Stances);
            }

            if (spell.StancesNot != 0)
            {
                rtb.AppendFormatLine("Stances Not: {0}", (ShapeshiftFormMask)spell.StancesNot);
            }

            AppendSkillLine();

            // reagents
            {
                bool printedHeader = false;
                for (int i = 0; i < spell.Reagent.Length; ++i)
                {
                    if (spell.Reagent[i] == 0)
                    {
                        continue;
                    }

                    if (!printedHeader)
                    {
                        rtb.AppendLine();
                        rtb.Append("Reagents:");
                        printedHeader = true;
                    }

                    rtb.AppendFormat("  {0}x{1}", spell.Reagent[i], spell.ReagentCount[i]);
                }

                if (printedHeader)
                {
                    rtb.AppendLine();
                }
            }

            rtb.AppendFormatLine("Spell Level = {0}, base {1}, max {2}, maxTarget {3}",
                                 spell.SpellLevel, spell.BaseLevel, spell.MaxLevel, spell.MaxTargetLevel);

            if (spell.EquippedItemClass != -1)
            {
                rtb.AppendFormatLine("EquippedItemClass = {0} ({1})", spell.EquippedItemClass, (ItemClass)spell.EquippedItemClass);

                if (spell.EquippedItemSubClassMask != 0)
                {
                    switch ((ItemClass)spell.EquippedItemClass)
                    {
                    case ItemClass.WEAPON:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                             spell.EquippedItemSubClassMask, (ItemSubClassWeaponMask)spell.EquippedItemSubClassMask);
                        break;

                    case ItemClass.ARMOR:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                             spell.EquippedItemSubClassMask, (ItemSubClassArmorMask)spell.EquippedItemSubClassMask);
                        break;

                    case ItemClass.MISC:
                        rtb.AppendFormatLine("    SubClass mask 0x{0:X8} ({1})",
                                             spell.EquippedItemSubClassMask, (ItemSubClassMiscMask)spell.EquippedItemSubClassMask);
                        break;
                    }
                }

                if (spell.EquippedItemInventoryTypeMask != 0)
                {
                    rtb.AppendFormatLine("    InventoryType mask = 0x{0:X8} ({1})",
                                         spell.EquippedItemInventoryTypeMask, (InventoryTypeMask)spell.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.AppendLine(spell.Range);

            rtb.AppendFormatLineIfNotNull("Speed {0:F}", spell.Speed);
            rtb.AppendFormatLineIfNotNull("Stackable up to {0}", spell.StackAmount);

            rtb.AppendLine(spell.CastTime);

            rtb.AppendLine(spell.SpellDifficulty);

            if (spell.RecoveryTime != 0 || spell.CategoryRecoveryTime != 0 || spell.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.AppendLine(spell.Duration);

            if (spell.ManaCost != 0 || spell.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.AppendLine();
            }


            if (spell.RuneCostID != 0 && DBC.SpellRuneCostTable.ContainsKey(spell.RuneCostID))
            {
                SpellRuneCostEntry R = DBC.SpellRuneCostTable[spell.RuneCostID];

                bool append = true;
                for (uint i = 0; i < R.RuneCost.Length; i++)
                {
                    if (R.RuneCost[i] != 0)
                    {
                        if (append)
                        {
                            rtb.AppendLine(_line);
                            rtb.Append("Rune cost: ");
                        }
                        rtb.AppendFormat("{0}x{1} ", (RuneType)i, R.RuneCost[i]);
                        append = false;
                    }
                }

                if (!append)
                {
                    rtb.AppendLine();
                }

                rtb.AppendFormatLineIfNotNull("Rune power gain ={0}", R.runePowerGain);
                if (!append)
                {
                    rtb.AppendLine(_line);
                }
            }

            rtb.AppendFormatLine("Interrupt Flags: 0x{0:X8}({1}), AuraIF 0x{2:X8}({3}), ChannelIF 0x{4:X8}({5})",
                                 spell.InterruptFlags, ((SpellInterruptFlags)spell.InterruptFlags).ToString().Replace("SPELL_INTERRUPT_FLAG_", ""),
                                 spell.AuraInterruptFlags, ((SpellChannelInterruptFlags)spell.AuraInterruptFlags).ToString().Replace("CHANNEL_FLAG_", ""),
                                 spell.ChannelInterruptFlags, ((SpellAuraInterruptFlags)spell.ChannelInterruptFlags).ToString().Replace("AURA_INTERRUPT_FLAG_", ""));

            if (spell.CasterAuraState != 0)
            {
                rtb.AppendFormatLine("CasterAuraState = {0} ({1})", spell.CasterAuraState, (AuraState)spell.CasterAuraState);
            }

            if (spell.TargetAuraState != 0)
            {
                rtb.AppendFormatLine("TargetAuraState = {0} ({1})", spell.TargetAuraState, (AuraState)spell.TargetAuraState);
            }

            if (spell.CasterAuraStateNot != 0)
            {
                rtb.AppendFormatLine("CasterAuraStateNot = {0} ({1})", spell.CasterAuraStateNot, (AuraState)spell.CasterAuraStateNot);
            }

            if (spell.TargetAuraStateNot != 0)
            {
                rtb.AppendFormatLine("TargetAuraStateNot = {0} ({1})", spell.TargetAuraStateNot, (AuraState)spell.TargetAuraStateNot);
            }

            AppendSpellAura();

            AppendAreaInfo();

            rtb.AppendFormatLineIfNotNull("Requires Spell Focus {0}", spell.RequiresSpellFocus);

            if (spell.ProcFlags != 0)
            {
                rtb.SetBold();
                rtb.AppendFormatLine("Proc flag 0x{0:X8}, chance = {1}, charges - {2}",
                                     spell.ProcFlags, spell.ProcChance, spell.ProcCharges);
                rtb.SetDefaultStyle();
                rtb.AppendFormatLine(_line);
                rtb.AppendText(spell.ProcInfo);
            }
            else
            {
                rtb.AppendFormatLine("Chance = {0}, charges - {1}", spell.ProcChance, spell.ProcCharges);
            }

            AppendSpellEffectInfo();
            AppendItemInfo();
        }
Exemplo n.º 29
0
        public static void AppendTimeStampedLine(this RichTextBox box, string text, Color?color = null)
        {
            var stamp = DateTime.Now.ToString("HH:mm:ss");

            box.AppendLine($"[{stamp}] {text}", color);
        }
Exemplo n.º 30
0
 public static void AppendLine(this RichTextBox box, string text)
 {
     box.AppendLine(text, Color.Black);
     box.ScrollToCaret();
 }