Ejemplo n.º 1
0
        public SpellEffectInfo(SpellInfo _spellInfo, uint effIndex, SpellEffectEntry _effect)
        {
            SpellScalingEntry scaling = DBCStorage.SpellScalingStorage.LookupByKey(_spellInfo.SpellScalingId);

            spellInfo           = _spellInfo;
            _effIndex           = _effect != null ? _effect.EffectIndex : effIndex;
            Effect              = _effect.Effect;
            ApplyAuraName       = _effect.EffectApplyAuraName;
            Amplitude           = _effect.EffectAmplitude;
            DieSides            = _effect.EffectDieSides;
            RealPointsPerLevel  = _effect.EffectRealPointsPerLevel;
            BasePoints          = _effect.EffectBasePoints;
            PointsPerComboPoint = _effect.EffectPointsPerComboPoint;
            ValueMultiplier     = _effect.EffectValueMultiplier;
            DamageMultiplier    = _effect.EffectDamageMultiplier;
            BonusMultiplier     = _effect.EffectBonusMultiplier;
            MiscValue           = _effect.EffectMiscValue;
            MiscValueB          = _effect.EffectMiscValueB;
            //Mechanic = Mechanics(_effect ? _effect.EffectMechanic : 0);
            //TargetA = SpellImplicitTargetInfo(_effect ? _effect.EffectImplicitTargetA : 0);
            //TargetB = SpellImplicitTargetInfo(_effect ? _effect.EffectImplicitTargetB : 0);
            RadiusEntry    = DBCStorage.SpellRadiusStorage.LookupByKey(_effect.EffectRadiusIndex);
            ChainTarget    = _effect.EffectChainTarget;
            ItemType       = _effect.EffectItemType;
            TriggerSpell   = _effect.EffectTriggerSpell;
            SpellClassMask = new flag96(_effect.EffectSpellClassMask);
            //ImplicitTargetConditions = null;
            //ScalingMultiplier = scaling != null ? scaling.Multiplier[_effIndex] : 0.0f;
            //DeltaScalingMultiplier = scaling != null ? scaling.RandomMultiplier[_effIndex] : 0.0f;
            //ComboScalingMultiplier = scaling != null ? scaling.OtherMultiplier[_effIndex] : 0.0f;
        }
Ejemplo n.º 2
0
        public void LoadSpellInfoStore()
        {
            SpellInfoList.Clear();

            var effectsBySpell = new SpellEffectEntry[DBCStorage.SpellEffectStorage.Keys.Max()][];

            foreach (var effect in DBCStorage.SpellEffectStorage.Values)
            {
                if (effectsBySpell[effect.EffectSpellId] == null)
                {
                    effectsBySpell[effect.EffectSpellId] = new SpellEffectEntry[21];
                }
                effectsBySpell[effect.EffectSpellId][effect.EffectIndex] = effect;
            }

            foreach (var spell in DBCStorage.SpellStorage.Values)
            {
                SpellInfoList.Add(spell.Id, new SpellInfo(spell, effectsBySpell[spell.Id]));
            }

            Log.outInfo("Loaded {0} SpellInfos", SpellInfoList.Count);
            Log.outInit();
        }
Ejemplo n.º 3
0
        private void AuraModTypeName(SpellEffectEntry effect)
        {
            var aura = (AuraType)effect.ApplyAuraName;
            var misc = effect.MiscValue;

            if (effect.ApplyAuraName == 0)
            {
                _rtb.AppendFormatLineIfNotNull("EffectMiscValueA = {0}", effect.MiscValue);
                _rtb.AppendFormatLineIfNotNull("EffectMiscValueB = {0}", effect.MiscValueB);
                _rtb.AppendFormatLineIfNotNull("EffectAmplitude = {0}", effect.Amplitude);

                return;
            }

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

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

            case AuraType.SPELL_AURA_MOD_RATING:
                _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.MiscValueB);
            _rtb.AppendFormatLine(", periodic = {0}", effect.Amplitude);

            switch (aura)
            {
            case AuraType.SPELL_AURA_OVERRIDE_SPELLS:
                if (!DBC.DBC.OverrideSpellData.ContainsKey((uint)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[(uint)misc];
                    _rtb.AppendFormatLine("Overriding Spells{0}:", !String.IsNullOrEmpty(@override.Name) ? String.Format(" ({0})", @override.Name) : String.Empty);
                    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(@override.Spells[i]) ? DBC.DBC.SpellInfoStore[@override.Spells[i]].SpellName : "?????");
                    }
                    _rtb.AppendLine();
                }
                break;

            case AuraType.SPELL_AURA_SCREEN_EFFECT:
                _rtb.SetStyle(Color.DarkBlue, FontStyle.Bold);
                _rtb.AppendFormatLine("ScreenEffect: {0}",
                                      DBC.DBC.ScreenEffect.ContainsKey((uint)misc) ? DBC.DBC.ScreenEffect[(uint)misc].Name : "?????");
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
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;
            }
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
 public SpellEffectInfo(SpellEffectEntry spellEffectEntry)
 {
     SpellEffect = spellEffectEntry;
 }