Ejemplo n.º 1
0
        private static string GetDamageString(ItemDrop.ItemData item, int qualityLevel)
        {
            string str = item.GetDamage(qualityLevel).GetTooltipString(item.m_shared.m_skillType);

            if (str.StartsWith("\n"))
            {
                return(str.Substring(1));
            }
            return(str);
        }
Ejemplo n.º 2
0
        public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
        {
            var player        = PlayerExtensions.GetPlayerWithEquippedItem(__instance);
            var totalParryMod = 0f;

            ModifyWithLowHealth.Apply(player, MagicEffectType.ModifyParry, effect =>
            {
                totalParryMod += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, __instance, effect, 0.01f);
            });

            __result *= 1.0f + totalParryMod;
            if (player != null && player.m_leftItem == null && player.HasActiveMagicEffect(MagicEffectType.Duelist))
            {
                __result += __instance.GetDamage().GetTotalDamage() / 2 * player.GetTotalActiveMagicEffectValue(MagicEffectType.Duelist, 0.01f);
            }

            __result = (float)Math.Round(__result, 1);
        }
Ejemplo n.º 3
0
 private static void CustomDamageCalculations(int newLvl, int oldLvl)
 {
     HitData.DamageTypes oldItem = _item.GetDamage(oldLvl);
     HitData.DamageTypes newItem = _item.GetDamage(newLvl);
     if (newItem.m_damage > oldItem.m_damage)
     {
         _sb.AppendFormat("\n$inventory_damage: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_damage, arrow, newItem.m_damage);
     }
     if (newItem.m_blunt > oldItem.m_blunt)
     {
         _sb.AppendFormat("\n$inventory_blunt: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_blunt, arrow, newItem.m_blunt);
     }
     if (newItem.m_slash > oldItem.m_slash)
     {
         _sb.AppendFormat("\n$inventory_slash: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_slash, arrow, newItem.m_slash);
     }
     if (newItem.m_pierce > oldItem.m_pierce)
     {
         _sb.AppendFormat("\n$inventory_pierce: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_pierce, arrow, newItem.m_pierce);
     }
     if (newItem.m_fire > oldItem.m_fire)
     {
         _sb.AppendFormat("\n$inventory_fire: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_fire, arrow, newItem.m_fire);
     }
     if (newItem.m_frost > oldItem.m_frost)
     {
         _sb.AppendFormat("\n$inventory_frost: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_frost, arrow, newItem.m_frost);
     }
     if (newItem.m_lightning > oldItem.m_lightning)
     {
         _sb.AppendFormat("\n$inventory_lightning: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_lightning, arrow, newItem.m_lightning);
     }
     if (newItem.m_poison > oldItem.m_poison)
     {
         _sb.AppendFormat("\n$inventory_poison: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_poison, arrow, newItem.m_poison);
     }
     if (newItem.m_spirit > oldItem.m_spirit)
     {
         _sb.AppendFormat("\n$inventory_spirit: <color=silver>{0}</color> {1} <color=orange>{2}</color>", oldItem.m_spirit, arrow, newItem.m_spirit);
     }
 }
Ejemplo n.º 4
0
        private static void WeaponStats(Player player, StringBuilder sb)
        {
            ItemDrop.ItemData leftHand  = GetHand(player, true);  // Shield, Torch, 2H
            ItemDrop.ItemData rightHand = GetHand(player, false); // 1H
            ItemDrop.ItemData ammoItem  = player.GetAmmoItem();

            // 1H at right hand, shield left

            // 2H at left hand
            if (leftHand != null)
            {
                if (leftHand.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Shield)
                {
                    // Has shield, weapon in right hand.
                }
                else
                {
                    HitData.DamageTypes hd = leftHand.GetDamage(leftHand.m_quality);

                    if (leftHand.m_shared.m_skillType == Skills.SkillType.Bows && ammoItem != null)
                    {
                        hd.Add(ammoItem.GetDamage()); // Add current ammo to damage calculations.
                    }
                    sb.AppendFormat("{0}", hd.GetTooltipString(leftHand.m_shared.m_skillType));

                    sb.AppendFormat("\n\n$item_knockback: <color=orange>{0}</color>", leftHand.m_shared.m_attackForce);
                    sb.AppendFormat("\n$item_backstab: <color=orange>{0}x</color>", leftHand.m_shared.m_backstabBonus);
                }
            }

            if (rightHand != null)
            {
                HitData.DamageTypes hd = rightHand.GetDamage(rightHand.m_quality);

                // Show Item Damage
                sb.AppendFormat("{0}", hd.GetTooltipString(rightHand.m_shared.m_skillType));
                sb.AppendFormat("\n\n$item_knockback: <color=orange>{0}</color>", rightHand.m_shared.m_attackForce);
                sb.AppendFormat("\n$item_backstab: <color=orange>{0}x</color>", rightHand.m_shared.m_backstabBonus);
            }
        }
Ejemplo n.º 5
0
        // Token: 0x0600114C RID: 4428 RVA: 0x00077F18 File Offset: 0x00076118
        public static string GetTooltip(ItemDrop.ItemData item, int qualityLevel, bool crafting)
        {
            Player        localPlayer   = Player.m_localPlayer;
            StringBuilder stringBuilder = new StringBuilder(256);

            stringBuilder.Append(item.m_shared.m_description);
            stringBuilder.Append("\n\n");
            if (item.m_shared.m_dlc.Length > 0)
            {
                stringBuilder.Append("\n<color=aqua>$item_dlc</color>");
            }
            ItemDrop.ItemData.AddHandedTip(item, stringBuilder);
            if (item.m_crafterID != 0L)
            {
                stringBuilder.AppendFormat("\n$item_crafter: <color=orange>{0}</color>", item.m_crafterName);
            }
            if (!item.m_shared.m_teleportable)
            {
                stringBuilder.Append("\n<color=orange>$item_noteleport</color>");
            }
            if (item.m_shared.m_value > 0)
            {
                stringBuilder.AppendFormat("\n$item_value: <color=orange>{0}  ({1})</color>", item.GetValue(), item.m_shared.m_value);
            }
            stringBuilder.AppendFormat("\n$item_weight: <color=orange>{0}</color>", item.GetWeight().ToString("0.0"));
            if (item.m_shared.m_maxQuality > 1)
            {
                stringBuilder.AppendFormat("\n$item_quality: <color=orange>{0}</color>", qualityLevel);
            }
            if (item.m_shared.m_useDurability)
            {
                if (crafting)
                {
                    float maxDurability = item.GetMaxDurability(qualityLevel);
                    stringBuilder.AppendFormat("\n$item_durability: <color=orange>{0}</color>", maxDurability);
                }
                else
                {
                    float maxDurability2 = item.GetMaxDurability(qualityLevel);
                    float durability     = item.m_durability;
                    stringBuilder.AppendFormat("\n$item_durability: <color=orange>{0}%</color> <color=yellow>({1}/{2})</color>", (item.GetDurabilityPercentage() * 100f).ToString("0"), durability.ToString("0"), maxDurability2.ToString("0"));
                }
                if (item.m_shared.m_canBeReparied)
                {
                    Recipe recipe = ObjectDB.instance.GetRecipe(item);
                    if (recipe != null)
                    {
                        int minStationLevel = recipe.m_minStationLevel;
                        stringBuilder.AppendFormat("\n$item_repairlevel: <color=orange>{0}</color>", minStationLevel.ToString());
                    }
                }
            }
            switch (item.m_shared.m_itemType)
            {
            case ItemDrop.ItemData.ItemType.Consumable:
            {
                if (item.m_shared.m_food > 0f)
                {
                    stringBuilder.AppendFormat("\n$item_food_health: <color=orange>{0}</color>", item.m_shared.m_food);
                    stringBuilder.AppendFormat("\n$item_food_stamina: <color=orange>{0}</color>", item.m_shared.m_foodStamina);
                    stringBuilder.AppendFormat("\n$item_food_duration: <color=orange>{0}s</color>", item.m_shared.m_foodBurnTime);
                    stringBuilder.AppendFormat("\n$item_food_regen: <color=orange>{0} hp/tick</color>", item.m_shared.m_foodRegen);
                }
                string statusEffectTooltip = item.GetStatusEffectTooltip();
                if (statusEffectTooltip.Length > 0)
                {
                    stringBuilder.Append("\n\n");
                    stringBuilder.Append(statusEffectTooltip);
                }
                break;
            }

            case ItemDrop.ItemData.ItemType.OneHandedWeapon:
            case ItemDrop.ItemData.ItemType.Bow:
            case ItemDrop.ItemData.ItemType.TwoHandedWeapon:
            case ItemDrop.ItemData.ItemType.Torch:
            {
                stringBuilder.Append(item.GetDamage(qualityLevel).GetTooltipString(item.m_shared.m_skillType));
                stringBuilder.AppendFormat("\n$item_blockpower: <color=orange>{0}</color> <color=yellow>({1})</color>", item.GetBaseBlockPower(qualityLevel), item.GetBlockPowerTooltip(qualityLevel).ToString("0"));
                if (item.m_shared.m_timedBlockBonus > 1f)
                {
                    stringBuilder.AppendFormat("\n$item_deflection: <color=orange>{0}</color>", item.GetDeflectionForce(qualityLevel));
                    stringBuilder.AppendFormat("\n$item_parrybonus: <color=orange>{0}x</color>", item.m_shared.m_timedBlockBonus);
                }
                stringBuilder.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", item.m_shared.m_attackForce);
                stringBuilder.AppendFormat("\n$item_backstab: <color=orange>{0}x</color>", item.m_shared.m_backstabBonus);
                string projectileTooltip = item.GetProjectileTooltip(qualityLevel);
                if (projectileTooltip.Length > 0)
                {
                    stringBuilder.Append("\n\n");
                    stringBuilder.Append(projectileTooltip);
                }
                string statusEffectTooltip2 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip2.Length > 0)
                {
                    stringBuilder.Append("\n\n");
                    stringBuilder.Append(statusEffectTooltip2);
                }
                break;
            }

            case ItemDrop.ItemData.ItemType.Shield:
                stringBuilder.AppendFormat("\n$item_blockpower: <color=orange>{0}</color> <color=yellow>({1})</color>", item.GetBaseBlockPower(qualityLevel), item.GetBlockPowerTooltip(qualityLevel).ToString("0"));
                if (item.m_shared.m_timedBlockBonus > 1f)
                {
                    stringBuilder.AppendFormat("\n$item_deflection: <color=orange>{0}</color>", item.GetDeflectionForce(qualityLevel));
                    stringBuilder.AppendFormat("\n$item_parrybonus: <color=orange>{0}x</color>", item.m_shared.m_timedBlockBonus);
                }
                break;

            case ItemDrop.ItemData.ItemType.Helmet:
            case ItemDrop.ItemData.ItemType.Chest:
            case ItemDrop.ItemData.ItemType.Legs:
            case ItemDrop.ItemData.ItemType.Shoulder:
            {
                stringBuilder.AppendFormat("\n$item_armor: <color=orange>{0}</color>", item.GetArmor(qualityLevel));
                string damageModifiersTooltipString = SE_Stats.GetDamageModifiersTooltipString(item.m_shared.m_damageModifiers);
                if (damageModifiersTooltipString.Length > 0)
                {
                    stringBuilder.Append(damageModifiersTooltipString);
                }
                string statusEffectTooltip3 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip3.Length > 0)
                {
                    stringBuilder.Append("\n\n");
                    stringBuilder.Append(statusEffectTooltip3);
                }
                break;
            }

            case ItemDrop.ItemData.ItemType.Ammo:
                stringBuilder.Append(item.GetDamage(qualityLevel).GetTooltipString(item.m_shared.m_skillType));
                stringBuilder.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", item.m_shared.m_attackForce);
                break;
            }
            if (item.m_shared.m_movementModifier != 0f && localPlayer != null)
            {
                float equipmentMovementModifier = localPlayer.GetEquipmentMovementModifier();
                stringBuilder.AppendFormat("\n$item_movement_modifier: <color=orange>{0}%</color> ($item_total:<color=yellow>{1}%</color>)", (item.m_shared.m_movementModifier * 100f).ToString("+0;-0"), (equipmentMovementModifier * 100f).ToString("+0;-0"));
            }
            string setStatusEffectTooltip = item.GetSetStatusEffectTooltip();

            if (setStatusEffectTooltip.Length > 0)
            {
                stringBuilder.AppendFormat("\n\n$item_seteffect (<color=orange>{0}</color> $item_parts):<color=orange>{1}</color>", item.m_shared.m_setSize, setStatusEffectTooltip);
            }
            return(stringBuilder.ToString());
        }
        private static bool Prefix(ref string __result, ItemDrop.ItemData item, int qualityLevel, bool crafting)
        {
            if (!item.IsMagic())
            {
                return(true);
            }

            Player        localPlayer = Player.m_localPlayer;
            StringBuilder text        = new StringBuilder(256);

            var magicItem   = item.GetMagicItem();
            var magicColor  = magicItem.GetColorString();
            var displayName = magicItem.GetDisplayName(item.Extended());

            text.Append($"<color={magicColor}>{magicItem.GetRarityDisplay()} {displayName}</color>\n");
            text.Append(item.m_shared.m_description);

            text.Append("\n");
            if (item.m_shared.m_dlc.Length > 0)
            {
                text.Append("\n<color=aqua>$item_dlc</color>");
            }

            ItemDrop.ItemData.AddHandedTip(item, text);
            if (item.m_crafterID != 0L)
            {
                text.AppendFormat("\n$item_crafter: <color=orange>{0}</color>", item.m_crafterName);
            }

            if (!item.m_shared.m_teleportable)
            {
                text.Append("\n<color=orange>$item_noteleport</color>");
            }

            if (item.m_shared.m_value > 0)
            {
                text.AppendFormat("\n$item_value: <color=orange>{0} ({1})</color>", item.GetValue(), item.m_shared.m_value);
            }

            var weightColor = magicItem.HasEffect(MagicEffectType.ReduceWeight) || magicItem.HasEffect(MagicEffectType.Weightless) ? magicColor : "orange";

            text.Append($"\n$item_weight: <color={weightColor}>{item.GetWeight():0.0}</color>");

            if (item.m_shared.m_maxQuality > 1)
            {
                text.AppendFormat("\n$item_quality: <color=orange>{0}</color>", qualityLevel);
            }

            var indestructible = magicItem.HasEffect(MagicEffectType.Indestructible);

            if (!indestructible && item.m_shared.m_useDurability)
            {
                var maxDurabilityColor1 = magicItem.HasEffect(MagicEffectType.ModifyDurability) ? magicColor : "orange";
                var maxDurabilityColor2 = magicItem.HasEffect(MagicEffectType.ModifyDurability) ? magicColor : "yellow";

                float  maxDurability = item.GetMaxDurability(qualityLevel);
                float  durability    = item.m_durability;
                float  currentDurabilityPercentage = item.GetDurabilityPercentage() * 100f;
                string durabilityPercentageString  = currentDurabilityPercentage.ToString("0");
                string durabilityValueString       = durability.ToString("0");
                string durabilityMaxString         = maxDurability.ToString("0");
                text.Append($"\n$item_durability: <color={maxDurabilityColor1}>{durabilityPercentageString}%</color> <color={maxDurabilityColor2}>({durabilityValueString}/{durabilityMaxString})</color>");

                if (item.m_shared.m_canBeReparied)
                {
                    Recipe recipe = ObjectDB.instance.GetRecipe(item);
                    if (recipe != null)
                    {
                        int minStationLevel = recipe.m_minStationLevel;
                        text.AppendFormat("\n$item_repairlevel: <color=orange>{0}</color>", minStationLevel.ToString());
                    }
                }
            }
            else if (indestructible)
            {
                text.Append($"\n$item_durability: <color={magicColor}>Indestructible</color>");
            }

            var magicBlockPower    = magicItem.HasEffect(MagicEffectType.ModifyBlockPower);
            var magicBlockColor1   = magicBlockPower ? magicColor : "orange";
            var magicBlockColor2   = magicBlockPower ? magicColor : "yellow";
            var magicParry         = magicItem.HasEffect(MagicEffectType.ModifyParry);
            var totalParryBonusMod = magicItem.GetTotalEffectValue(MagicEffectType.ModifyParry, 0.01f);
            var magicParryColor    = magicParry ? magicColor : "orange";

            switch (item.m_shared.m_itemType)
            {
            case ItemDrop.ItemData.ItemType.Consumable:
                if (item.m_shared.m_food > 0.0)
                {
                    text.AppendFormat("\n$item_food_health: <color=orange>{0}</color>", item.m_shared.m_food);
                    text.AppendFormat("\n$item_food_stamina: <color=orange>{0}</color>", item.m_shared.m_foodStamina);
                    text.AppendFormat("\n$item_food_duration: <color=orange>{0}s</color>", item.m_shared.m_foodBurnTime);
                    text.AppendFormat("\n$item_food_regen: <color=orange>{0} hp/tick</color>", item.m_shared.m_foodRegen);
                }

                string consumeStatusEffectTooltip = item.GetStatusEffectTooltip();
                if (consumeStatusEffectTooltip.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(consumeStatusEffectTooltip);
                }

                break;

            case ItemDrop.ItemData.ItemType.OneHandedWeapon:
            case ItemDrop.ItemData.ItemType.Bow:
            case ItemDrop.ItemData.ItemType.TwoHandedWeapon:
            case ItemDrop.ItemData.ItemType.Torch:
                text.Append(GetDamageTooltipString(magicItem, item.GetDamage(qualityLevel), item.m_shared.m_skillType, magicColor));
                float  baseBlockPower1            = item.GetBaseBlockPower(qualityLevel);
                float  blockPowerTooltipValue     = item.GetBlockPowerTooltip(qualityLevel);
                string blockPowerPercentageString = blockPowerTooltipValue.ToString("0");
                text.Append($"\n$item_blockpower: <color={magicBlockColor1}>{baseBlockPower1}</color> <color={magicBlockColor2}>({blockPowerPercentageString})</color>");
                if (item.m_shared.m_timedBlockBonus > 1.0)
                {
                    text.Append($"\n$item_deflection: <color={magicParryColor}>{item.GetDeflectionForce(qualityLevel)}</color>");

                    var timedBlockBonus = item.m_shared.m_timedBlockBonus;
                    if (magicParry)
                    {
                        timedBlockBonus *= 1.0f + totalParryBonusMod;
                    }

                    text.Append($"\n$item_parrybonus: <color={magicParryColor}>{timedBlockBonus:0.#}x</color>");
                }

                text.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", item.m_shared.m_attackForce);

                var magicBackstab         = magicItem.HasEffect(MagicEffectType.ModifyBackstab);
                var totalBackstabBonusMod = magicItem.GetTotalEffectValue(MagicEffectType.ModifyBackstab, 0.01f);
                var magicBackstabColor    = magicBackstab ? magicColor : "orange";
                var backstabValue         = item.m_shared.m_backstabBonus * (1.0f + totalBackstabBonusMod);
                text.Append($"\n$item_backstab: <color={magicBackstabColor}>{backstabValue:0.#}x</color>");

                string projectileTooltip = item.GetProjectileTooltip(qualityLevel);
                if (projectileTooltip.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(projectileTooltip);
                }

                string statusEffectTooltip2 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip2.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(statusEffectTooltip2);
                }

                break;

            case ItemDrop.ItemData.ItemType.Shield:
                float baseBlockPower2 = item.GetBaseBlockPower(qualityLevel);
                blockPowerTooltipValue = item.GetBlockPowerTooltip(qualityLevel);
                string str5 = blockPowerTooltipValue.ToString("0");
                text.Append($"\n$item_blockpower: <color={magicBlockColor1}>{baseBlockPower2}</color> <color={magicBlockColor2}>({str5})</color>");
                if (item.m_shared.m_timedBlockBonus > 1.0)
                {
                    text.Append($"\n$item_deflection: <color={magicParryColor}>{item.GetDeflectionForce(qualityLevel)}</color>");

                    var timedBlockBonus = item.m_shared.m_timedBlockBonus;
                    if (magicParry)
                    {
                        timedBlockBonus *= 1.0f + totalParryBonusMod;
                    }

                    text.Append($"\n$item_parrybonus: <color={magicParryColor}>{timedBlockBonus:0.#}x</color>");
                }

                break;

            case ItemDrop.ItemData.ItemType.Helmet:
            case ItemDrop.ItemData.ItemType.Chest:
            case ItemDrop.ItemData.ItemType.Legs:
            case ItemDrop.ItemData.ItemType.Shoulder:
                var magicArmorColor = magicItem.HasEffect(MagicEffectType.ModifyArmor) ? magicColor : "orange";
                text.Append($"\n$item_armor: <color={magicArmorColor}>{item.GetArmor(qualityLevel):0.#}</color>");
                string modifiersTooltipString = SE_Stats.GetDamageModifiersTooltipString(item.m_shared.m_damageModifiers);
                if (modifiersTooltipString.Length > 0)
                {
                    text.Append(modifiersTooltipString);
                }

                string statusEffectTooltip3 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip3.Length > 0)
                {
                    text.Append("\n");
                    text.Append(statusEffectTooltip3);
                }

                break;

            case ItemDrop.ItemData.ItemType.Ammo:
                text.Append(item.GetDamage(qualityLevel).GetTooltipString(item.m_shared.m_skillType));
                text.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", item.m_shared.m_attackForce);
                break;
            }

            var magicMovement = magicItem.HasEffect(MagicEffectType.ModifyMovementSpeed);

            if ((magicMovement || item.m_shared.m_movementModifier != 0) && localPlayer != null)
            {
                var removePenalty = magicItem.HasEffect(MagicEffectType.RemoveSpeedPenalty);

                var itemMovementModifier = removePenalty ? 0 : item.m_shared.m_movementModifier * 100f;
                if (magicMovement)
                {
                    itemMovementModifier += magicItem.GetTotalEffectValue(MagicEffectType.ModifyMovementSpeed);
                }

                var itemMovementModDisplay = (itemMovementModifier == 0) ? "0%" : $"{itemMovementModifier:+0;-0}%";

                float movementModifier      = localPlayer.GetEquipmentMovementModifier();
                var   totalMovementModifier = movementModifier * 100f;
                var   color = (removePenalty || magicMovement) ? magicColor : "orange";
                text.Append($"\n$item_movement_modifier: <color={color}>{itemMovementModDisplay}</color> ($item_total:<color=yellow>{totalMovementModifier:+0;-0}%</color>)");
            }

            // Add magic item effects here
            text.Append(magicItem.GetTooltip());

            // Set stuff
            if (!string.IsNullOrEmpty(item.m_shared.m_setName))
            {
                AddSetTooltip(item, text);
            }

            __result = text.ToString();
            return(false);
        }
Ejemplo n.º 7
0
        public static string GetTooltip(ItemDrop.ItemData item, int qualityLevel, bool crafting)
        {
            Player        localPlayer = Player.m_localPlayer;
            StringBuilder text        = new StringBuilder(256);

            text.Append(item.m_shared.m_description);
            text.Append("\n\n");
            if (item.m_shared.m_dlc.Length > 0)
            {
                text.Append("\n<color=aqua>$item_dlc</color>");
            }
            ItemDrop.ItemData.AddHandedTip(item, text);
            if (item.m_crafterID != 0L)
            {
                text.AppendFormat("\n$item_crafter: <color=orange>{0}</color>", (object)item.m_crafterName);
            }
            if (!item.m_shared.m_teleportable)
            {
                text.Append("\n<color=orange>$item_noteleport</color>");
            }
            if (item.m_shared.m_value > 0)
            {
                text.AppendFormat("\n$item_value: <color=orange>{0}  ({1})</color>", (object)item.GetValue(), (object)item.m_shared.m_value);
            }
            text.AppendFormat("\n$item_weight: <color=orange>{0}</color>", (object)item.GetWeight().ToString("0.0"));
            if (item.m_shared.m_maxQuality > 1)
            {
                text.AppendFormat("\n$item_quality: <color=orange>{0}</color>", (object)qualityLevel);
            }
            float num;

            if (item.m_shared.m_useDurability)
            {
                if (crafting)
                {
                    float maxDurability = item.GetMaxDurability(qualityLevel);
                    text.AppendFormat("\n$item_durability: <color=orange>{0}</color>", (object)maxDurability);
                }
                else
                {
                    float         maxDurability = item.GetMaxDurability(qualityLevel);
                    float         durability    = item.m_durability;
                    StringBuilder stringBuilder = text;
                    num = item.GetDurabilityPercentage() * 100f;
                    string str1 = num.ToString("0");
                    string str2 = durability.ToString("0");
                    string str3 = maxDurability.ToString("0");
                    stringBuilder.AppendFormat("\n$item_durability: <color=orange>{0}%</color> <color=yellow>({1}/{2})</color>", (object)str1, (object)str2, (object)str3);
                }
                if (item.m_shared.m_canBeReparied)
                {
                    Recipe recipe = ObjectDB.instance.GetRecipe(item);
                    if ((UnityEngine.Object)recipe != (UnityEngine.Object)null)
                    {
                        int minStationLevel = recipe.m_minStationLevel;
                        text.AppendFormat("\n$item_repairlevel: <color=orange>{0}</color>", (object)minStationLevel.ToString());
                    }
                }
            }
            switch (item.m_shared.m_itemType)
            {
            case ItemDrop.ItemData.ItemType.Consumable:
                if ((double)item.m_shared.m_food > 0.0)
                {
                    text.AppendFormat("\n$item_food_health: <color=orange>{0}</color>", (object)item.m_shared.m_food);
                    text.AppendFormat("\n$item_food_stamina: <color=orange>{0}</color>", (object)item.m_shared.m_foodStamina);
                    text.AppendFormat("\n$item_food_duration: <color=orange>{0}s</color>", (object)item.m_shared.m_foodBurnTime);
                    text.AppendFormat("\n$item_food_regen: <color=orange>{0} hp/tick</color>", (object)item.m_shared.m_foodRegen);
                }
                string statusEffectTooltip1 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip1.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(statusEffectTooltip1);
                    break;
                }
                break;

            case ItemDrop.ItemData.ItemType.OneHandedWeapon:
            case ItemDrop.ItemData.ItemType.Bow:
            case ItemDrop.ItemData.ItemType.TwoHandedWeapon:
            case ItemDrop.ItemData.ItemType.Torch:
                text.Append(item.GetDamage(qualityLevel).GetTooltipString(item.m_shared.m_skillType));
                StringBuilder stringBuilder1 = text;
                // ISSUE: variable of a boxed type
                __Boxed <float> baseBlockPower1 = (ValueType)item.GetBaseBlockPower(qualityLevel);
                num = item.GetBlockPowerTooltip(qualityLevel);
                string str4 = num.ToString("0");
                stringBuilder1.AppendFormat("\n$item_blockpower: <color=orange>{0}</color> <color=yellow>({1})</color>", (object)baseBlockPower1, (object)str4);
                if ((double)item.m_shared.m_timedBlockBonus > 1.0)
                {
                    text.AppendFormat("\n$item_deflection: <color=orange>{0}</color>", (object)item.GetDeflectionForce(qualityLevel));
                    text.AppendFormat("\n$item_parrybonus: <color=orange>{0}x</color>", (object)item.m_shared.m_timedBlockBonus);
                }
                text.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", (object)item.m_shared.m_attackForce);
                text.AppendFormat("\n$item_backstab: <color=orange>{0}x</color>", (object)item.m_shared.m_backstabBonus);
                string projectileTooltip = item.GetProjectileTooltip(qualityLevel);
                if (projectileTooltip.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(projectileTooltip);
                }
                string statusEffectTooltip2 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip2.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(statusEffectTooltip2);
                    break;
                }
                break;

            case ItemDrop.ItemData.ItemType.Shield:
                StringBuilder stringBuilder2 = text;
                // ISSUE: variable of a boxed type
                __Boxed <float> baseBlockPower2 = (ValueType)item.GetBaseBlockPower(qualityLevel);
                num = item.GetBlockPowerTooltip(qualityLevel);
                string str5 = num.ToString("0");
                stringBuilder2.AppendFormat("\n$item_blockpower: <color=orange>{0}</color> <color=yellow>({1})</color>", (object)baseBlockPower2, (object)str5);
                if ((double)item.m_shared.m_timedBlockBonus > 1.0)
                {
                    text.AppendFormat("\n$item_deflection: <color=orange>{0}</color>", (object)item.GetDeflectionForce(qualityLevel));
                    text.AppendFormat("\n$item_parrybonus: <color=orange>{0}x</color>", (object)item.m_shared.m_timedBlockBonus);
                    break;
                }
                break;

            case ItemDrop.ItemData.ItemType.Helmet:
            case ItemDrop.ItemData.ItemType.Chest:
            case ItemDrop.ItemData.ItemType.Legs:
            case ItemDrop.ItemData.ItemType.Shoulder:
                text.AppendFormat("\n$item_armor: <color=orange>{0}</color>", (object)item.GetArmor(qualityLevel));
                string modifiersTooltipString = SE_Stats.GetDamageModifiersTooltipString(item.m_shared.m_damageModifiers);
                if (modifiersTooltipString.Length > 0)
                {
                    text.Append(modifiersTooltipString);
                }
                string statusEffectTooltip3 = item.GetStatusEffectTooltip();
                if (statusEffectTooltip3.Length > 0)
                {
                    text.Append("\n\n");
                    text.Append(statusEffectTooltip3);
                    break;
                }
                break;

            case ItemDrop.ItemData.ItemType.Ammo:
                text.Append(item.GetDamage(qualityLevel).GetTooltipString(item.m_shared.m_skillType));
                text.AppendFormat("\n$item_knockback: <color=orange>{0}</color>", (object)item.m_shared.m_attackForce);
                break;
            }
            if ((double)item.m_shared.m_movementModifier != 0.0 && (UnityEngine.Object)localPlayer != (UnityEngine.Object)null)
            {
                float         movementModifier = localPlayer.GetEquipmentMovementModifier();
                StringBuilder stringBuilder3   = text;
                num = item.m_shared.m_movementModifier * 100f;
                string str1 = num.ToString("+0;-0");
                num = movementModifier * 100f;
                string str2 = num.ToString("+0;-0");
                stringBuilder3.AppendFormat("\n$item_movement_modifier: <color=orange>{0}%</color> ($item_total:<color=yellow>{1}%</color>)", (object)str1, (object)str2);
            }
            string statusEffectTooltip4 = item.GetSetStatusEffectTooltip();

            if (statusEffectTooltip4.Length > 0)
            {
                text.AppendFormat("\n\n$item_seteffect (<color=orange>{0}</color> $item_parts):<color=orange>{1}</color>", (object)item.m_shared.m_setSize, (object)statusEffectTooltip4);
            }
            return(text.ToString());
        }
Ejemplo n.º 8
0
        public static void UpdateDamageTooltip(ref string tooltip, ItemDrop.ItemData item)
        {
            Player localplayer     = Player.m_localPlayer;
            SEMan  seman           = localplayer.GetSEMan();
            float  totalMultiplier = 0f;
            float  frostDamage     = 0f;
            float  spiritDamage    = 0f;

            if (item == null || seman == null || localplayer == null || item.m_shared == null || item.m_shared.m_name == null)
            {
                return;
            }

            if (seman.HaveStatusEffect("One Hand Damage Bonus") && (item.m_shared.m_name.Contains("axe") || item.m_shared.m_name.Contains("battleaxe")))
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("One Hand Damage Bonus") as SE_OneHandDamageBonus;
                totalMultiplier += effect.getDamageBonus();
            }

            if (seman.HaveStatusEffect("Dagger/Spear Damage Bonus") && (item.m_shared.m_name.Contains("spear") || item.m_shared.m_name.Contains("knife")))
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Dagger/Spear Damage Bonus") as SE_DaggerSpearDmgBonus;
                totalMultiplier += effect.getDamageBonus();
            }

            if (seman.HaveStatusEffect("Melee Damage Bonus") && item.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Bow)
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Melee Damage Bonus") as SE_MeleeDamageBonus;
                totalMultiplier += effect.getDamageBonus();
            }

            if (seman.HaveStatusEffect("Ranged Damage Bonus") && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow)
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Ranged Damage Bonus") as SE_RangedDmgBonus;
                totalMultiplier += effect.getDamageBonus();
            }

            if (seman.HaveStatusEffect("Two Handed Damage Bonus") && item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeapon)
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Two Handed Damage Bonus") as SE_TwoHandedDmgBonus;
                totalMultiplier += effect.getDamageBonus();
            }

            if (seman.HaveStatusEffect("Ranger Weapon Bonus") && (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow || item.m_shared.m_name.Contains("spear") || item.m_shared.m_name.Contains("knife")))
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Ranger Weapon Bonus") as SE_RangerWeaponBonus;
                totalMultiplier += effect.GetDamageBonus();
            }

            if (seman.HaveStatusEffect("Throwing Damage Bonus") && item.m_shared.m_name.Contains("_throwingaxe") ||
                item.m_shared.m_name.Contains("_spear") ||
                item.m_shared.m_name.Contains("bomb"))
            {
                var effect = seman.GetStatusEffect("Throwing Damage Bonus") as SE_ThrowingDamageBonus;
                if (effect != null)
                {
                    totalMultiplier += effect.getDamageBonus();
                }
            }
            if (seman.HaveStatusEffect("Wolftears"))
            {
                SE_Wolftears effect = seman.GetStatusEffect("Wolftears") as SE_Wolftears;
                totalMultiplier += effect.GetDamageBonus();
            }
            if (seman.HaveStatusEffect("Battle Furor"))
            {
                SE_FullHPDamageBonus effect = seman.GetStatusEffect("Battle Furor") as SE_FullHPDamageBonus;
                if (localplayer.GetHealthPercentage() >= effect.GetActivationHP())
                {
                    totalMultiplier += effect.GetDamageBonus();
                }
            }
            if (seman.HaveStatusEffect("Silver Damage Bonus") && (item.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow || item.m_shared.m_name.Contains("spear") || item.m_shared.m_name.Contains("knife")))
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Silver Damage Bonus") as SE_SilverDamageBonus;
                spiritDamage += (item.GetDamage().GetTotalDamage() * effect.GetDamageBonus()) / 2;
                frostDamage  += (item.GetDamage().GetTotalDamage() * effect.GetDamageBonus()) / 2;
            }
            if (seman.HaveStatusEffect("Spirit Damage Bonus"))
            {
                var effect = localplayer.GetSEMan().GetStatusEffect("Spirit Damage Bonus") as SE_SpiritDamageBonus;
                spiritDamage += effect.GetDamageBonus();
            }
            if (totalMultiplier > 0f)
            {
                var damages = item.m_shared.m_damages;
                if (damages.m_blunt != 0f)
                {
                    localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                    int    minRange    = Mathf.RoundToInt(item.GetDamage().m_blunt *min);
                    int    maxRange    = Mathf.RoundToInt(item.GetDamage().m_blunt *max);
                    string bluntString = $"$inventory_blunt: <color=orange>{item.GetDamage().m_blunt}</color> <color=yellow>({minRange}-{maxRange}) </color>";
                    var    index       = tooltip.IndexOf(bluntString);
                    if (index > -1)
                    {
                        var dmgBonusMin = (item.GetDamage().m_blunt + item.GetDamage().m_blunt *totalMultiplier) * min;
                        var dmgBonusMax = (item.GetDamage().m_blunt + item.GetDamage().m_blunt *totalMultiplier) * max;
                        tooltip = tooltip.Insert(index + bluntString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                    }
                }
                if (damages.m_slash != 0f)
                {
                    localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                    int    minRange   = Mathf.RoundToInt(item.GetDamage().m_slash *min);
                    int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_slash *max);
                    string toolString = $"$inventory_slash: <color=orange>{item.GetDamage().m_slash}</color> <color=yellow>({minRange}-{maxRange}) </color>";
                    var    index      = tooltip.IndexOf(toolString);
                    if (index > -1)
                    {
                        var dmgBonusMin = (item.GetDamage().m_slash + item.GetDamage().m_slash *totalMultiplier) * min;
                        var dmgBonusMax = (item.GetDamage().m_slash + item.GetDamage().m_slash *totalMultiplier) * max;
                        tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                    }
                }
                if (damages.m_pierce != 0f)
                {
                    localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                    int    minRange   = Mathf.RoundToInt(item.GetDamage().m_pierce *min);
                    int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_pierce *max);
                    string toolString = $"$inventory_pierce: <color=orange>{item.GetDamage().m_pierce}</color> <color=yellow>({minRange}-{maxRange}) </color>";
                    var    index      = tooltip.IndexOf(toolString);
                    if (index > -1)
                    {
                        var dmgBonusMin = (item.GetDamage().m_pierce + item.GetDamage().m_pierce *totalMultiplier) * min;
                        var dmgBonusMax = (item.GetDamage().m_pierce + item.GetDamage().m_pierce *totalMultiplier) * max;
                        tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                    }
                }
                if (damages.m_fire != 0f)
                {
                    localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                    int    minRange   = Mathf.RoundToInt(item.GetDamage().m_fire *min);
                    int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_fire *max);
                    string toolString = $"$inventory_fire: <color=orange>{item.GetDamage().m_fire}</color> <color=yellow>({minRange}-{maxRange}) </color>";
                    var    index      = tooltip.IndexOf(toolString);
                    if (index > -1)
                    {
                        var dmgBonusMin = (item.GetDamage().m_fire + item.GetDamage().m_fire *totalMultiplier) * min;
                        var dmgBonusMax = (item.GetDamage().m_fire + item.GetDamage().m_fire *totalMultiplier) * max;
                        tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                    }
                }

                if (damages.m_lightning != 0f)
                {
                    localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                    int    minRange   = Mathf.RoundToInt(item.GetDamage().m_lightning *min);
                    int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_lightning *max);
                    string toolString = $"$inventory_lightning: <color=orange>{item.GetDamage().m_lightning}</color> <color=yellow>({minRange}-{maxRange}) </color>";
                    var    index      = tooltip.IndexOf(toolString);
                    if (index > -1)
                    {
                        var dmgBonusMin = (item.GetDamage().m_lightning + item.GetDamage().m_lightning *totalMultiplier) * min;
                        var dmgBonusMax = (item.GetDamage().m_lightning + item.GetDamage().m_lightning *totalMultiplier) * max;
                        tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                    }
                }
                if (damages.m_poison != 0f)
                {
                    localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                    int    minRange   = Mathf.RoundToInt(item.GetDamage().m_poison *min);
                    int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_poison *max);
                    string toolString = $"$inventory_poison: <color=orange>{item.GetDamage().m_poison}</color> <color=yellow>({minRange}-{maxRange}) </color>";
                    var    index      = tooltip.IndexOf(toolString);
                    if (index > -1)
                    {
                        var dmgBonusMin = (item.GetDamage().m_poison + item.GetDamage().m_poison *totalMultiplier) * min;
                        var dmgBonusMax = (item.GetDamage().m_poison + item.GetDamage().m_poison *totalMultiplier) * max;
                        tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                    }
                }
            }
            if (spiritDamage > 0f)
            {
                localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);

                int    minRange   = Mathf.RoundToInt(item.GetDamage().m_spirit *min);
                int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_spirit *max);
                string toolString = $"$inventory_spirit: <color=orange>{item.GetDamage().m_spirit}</color> <color=yellow>({minRange}-{maxRange}) </color>";

                var dmgBonusMin = Mathf.RoundToInt((item.GetDamage().m_spirit + spiritDamage) * min);
                var dmgBonusMax = Mathf.RoundToInt((item.GetDamage().m_spirit + spiritDamage) * max);

                var index = tooltip.IndexOf(toolString);
                if (index > -1)
                {
                    tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.##}-{dmgBonusMax:#.##})</color>");
                }
                else
                {
                    string newString = $"$item_blockpower: <color=orange>{item.m_shared.m_blockPower}</color> <color=yellow>({item.m_shared.m_blockPower})</color>";
                    index = tooltip.IndexOf(newString);
                    if (index > -1)
                    {
                        tooltip = tooltip.Insert(index, $"<color=cyan>$inventory_spirit: {item.GetDamage().m_spirit + spiritDamage} ({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>\n");
                    }
                }
            }
            if (frostDamage > 0f)
            {
                localplayer.GetSkills().GetRandomSkillRange(out var min, out var max, item.m_shared.m_skillType);
                int    minRange   = Mathf.RoundToInt(item.GetDamage().m_frost *min);
                int    maxRange   = Mathf.RoundToInt(item.GetDamage().m_frost *max);
                string toolString = $"$inventory_frost: <color=orange>{item.GetDamage().m_frost}</color> <color=yellow>({minRange}-{maxRange}) </color>";

                var dmgBonusMin = ((item.GetDamage().m_frost + frostDamage) * min);
                var dmgBonusMax = ((item.GetDamage().m_frost + frostDamage) * max);

                var index = tooltip.IndexOf(toolString);
                if (index > -1)
                {
                    tooltip = tooltip.Insert(index + toolString.Length, $"<color=orange>|</color> <color=cyan>({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>");
                }
                else
                {
                    string newString = $"$item_blockpower: <color=orange>{item.m_shared.m_blockPower}</color> <color=yellow>({item.m_shared.m_blockPower})</color>";
                    index = tooltip.IndexOf(newString);
                    if (index > -1)
                    {
                        tooltip = tooltip.Insert(index, $"<color=cyan>$inventory_frost: {item.GetDamage().m_frost + frostDamage} ({dmgBonusMin:#.#}-{dmgBonusMax:#.#})</color>\n");
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private static void doMeleeAttack(Humanoid ___m_character, ItemDrop.ItemData ___m_weapon, Attack __instance,
                                          EffectList ___m_hitEffect, Skills.SkillType ___m_specialHitSkill, DestructibleType ___m_specialHitType,
                                          bool ___m_lowerDamagePerHit, float ___m_forceMultiplier, float ___m_staggerMultiplier, float ___m_damageMultiplier,
                                          int ___m_attackChainLevels, int ___m_currentAttackCainLevel, DestructibleType ___m_resetChainIfHit,
                                          ref int ___m_nextAttackChainLevel, EffectList ___m_hitTerrainEffect, float ___m_attackHitNoise, Vector3 pos,
                                          Collider col, Vector3 dir, GameObject ___m_spawnOnTrigger)
        {
            Vector3 zero  = Vector3.zero;
            bool    flag2 = false; //rename
            HashSet <Skills.SkillType> skillTypeSet = new HashSet <Skills.SkillType>();
            bool hitOccured = false;

            ___m_weapon.m_shared.m_hitEffect.Create(pos, Quaternion.identity);
            ___m_hitEffect.Create(pos, Quaternion.identity);

            GameObject hitObject = Projectile.FindHitObject(col);

            if (!(hitObject == ___m_character.gameObject))
            {
                Vagon component1 = hitObject.GetComponent <Vagon>();
                if (!component1 || !component1.IsAttached(___m_character))
                {
                    Character component2 = hitObject.GetComponent <Character>();
                    if (!(component2 != null) ||
                        (___m_character.IsPlayer() || BaseAI.IsEnemy(___m_character, component2)) &&
                        (!___m_weapon.m_shared.m_dodgeable || !component2.IsDodgeInvincible()))
                    {
                        hitOccured = true;
                    }
                }
            }

            if (!hitOccured)
            {
                return;
            }

            IDestructible component = hitObject.GetComponent <IDestructible>();

            if (component != null)
            {
                DestructibleType destructibleType = component.GetDestructibleType();
                Skills.SkillType skill            = ___m_weapon.m_shared.m_skillType;

                if (___m_specialHitSkill != Skills.SkillType.None &&
                    (destructibleType & ___m_specialHitType) != DestructibleType.None)
                {
                    skill = ___m_specialHitSkill;
                }

                float randomSkillFactor = ___m_character.GetRandomSkillFactor(skill);

                if (___m_lowerDamagePerHit)
                {
                    randomSkillFactor /= 0.75f;
                }

                HitData hitData = new HitData();
                hitData.m_toolTier     = ___m_weapon.m_shared.m_toolTier;
                hitData.m_statusEffect = ___m_weapon.m_shared.m_attackStatusEffect
                    ? ___m_weapon.m_shared.m_attackStatusEffect.name
                    : "";
                hitData.m_pushForce         = ___m_weapon.m_shared.m_attackForce * randomSkillFactor * ___m_forceMultiplier;
                hitData.m_backstabBonus     = ___m_weapon.m_shared.m_backstabBonus;
                hitData.m_staggerMultiplier = ___m_staggerMultiplier;
                hitData.m_dodgeable         = ___m_weapon.m_shared.m_dodgeable;
                hitData.m_blockable         = ___m_weapon.m_shared.m_blockable;
                hitData.m_skill             = skill;
                hitData.m_damage            = ___m_weapon.GetDamage();
                hitData.m_point             = pos;
                hitData.m_dir         = dir;
                hitData.m_hitCollider = col;
                hitData.SetAttacker(___m_character);
                hitData.m_damage.Modify(___m_damageMultiplier);
                hitData.m_damage.Modify(randomSkillFactor);
                hitData.m_damage.Modify((float)getLevelDamageFactorMethod.Invoke(__instance, null));
                if (___m_attackChainLevels > 1 && ___m_currentAttackCainLevel == ___m_attackChainLevels - 1)
                {
                    hitData.m_damage.Modify(2f);
                    hitData.m_pushForce *= 1.2f;
                }
                hitData.m_damage.Modify(MeshCooldown.calcDamageMultiplier());

                ___m_character.GetSEMan().ModifyAttack(skill, ref hitData);
                if (component is Character)
                {
                    flag2 = true;
                }
                component.Damage(hitData);
                if ((destructibleType & ___m_resetChainIfHit) != DestructibleType.None)
                {
                    ___m_nextAttackChainLevel = 0;
                }
                skillTypeSet.Add(skill);
            }

            ___m_weapon.m_shared.m_hitTerrainEffect.Create(pos,
                                                           Quaternion.identity); // Quaternion.identity might need to be replaced
            ___m_hitTerrainEffect.Create(pos, Quaternion.identity);

            if (___m_weapon.m_shared.m_spawnOnHitTerrain)
            {
                spawnOnHitTerrainMethod.Invoke(__instance,
                                               new object[] { pos, ___m_weapon.m_shared.m_spawnOnHitTerrain });
            }

            if (___m_weapon.m_shared.m_useDurability && ___m_character.IsPlayer())
            {
                ___m_weapon.m_durability -= ___m_weapon.m_shared.m_useDurabilityDrain;
            }
            ___m_character.AddNoise(___m_attackHitNoise);

            if (___m_weapon.m_shared.m_spawnOnHit)
            {
                Object.Instantiate(___m_weapon.m_shared.m_spawnOnHit, pos,
                                   Quaternion.identity).GetComponent <IProjectile>()
                ?.Setup(___m_character, zero, ___m_attackHitNoise, null, ___m_weapon);
            }
            foreach (Skills.SkillType skill in skillTypeSet)
            {
                ___m_character.RaiseSkill(skill, flag2 ? 1.5f : 1f);
            }

            if (!___m_spawnOnTrigger)
            {
                return;
            }
            Object.Instantiate(___m_spawnOnTrigger, zero,
                               Quaternion.identity).GetComponent <IProjectile>()?.Setup(___m_character,
                                                                                        ___m_character.transform.forward, -1f, null, ___m_weapon);

            return;
        }
Ejemplo n.º 10
0
    // Token: 0x060002F0 RID: 752 RVA: 0x000180F0 File Offset: 0x000162F0
    private void FireProjectileBurst()
    {
        ItemDrop.ItemData ammoItem         = this.m_ammoItem;
        GameObject        attackProjectile = this.m_attackProjectile;
        float             num  = this.m_projectileVel;
        float             num2 = this.m_projectileVelMin;
        float             num3 = this.m_projectileAccuracy;
        float             num4 = this.m_projectileAccuracyMin;
        float             num5 = this.m_attackHitNoise;

        if (ammoItem != null && ammoItem.m_shared.m_attack.m_attackProjectile)
        {
            attackProjectile = ammoItem.m_shared.m_attack.m_attackProjectile;
            num  += ammoItem.m_shared.m_attack.m_projectileVel;
            num2 += ammoItem.m_shared.m_attack.m_projectileVelMin;
            num3 += ammoItem.m_shared.m_attack.m_projectileAccuracy;
            num4 += ammoItem.m_shared.m_attack.m_projectileAccuracyMin;
            num5 += ammoItem.m_shared.m_attack.m_attackHitNoise;
        }
        float num6 = this.m_character.GetRandomSkillFactor(this.m_weapon.m_shared.m_skillType);

        if (this.m_weapon.m_shared.m_holdDurationMin > 0f)
        {
            num3  = Mathf.Lerp(num4, num3, Mathf.Pow(this.m_attackDrawPercentage, 0.5f));
            num6 *= this.m_attackDrawPercentage;
            num   = Mathf.Lerp(num2, num, this.m_attackDrawPercentage);
        }
        Vector3 position;
        Vector3 vector;

        this.GetProjectileSpawnPoint(out position, out vector);
        Transform transform = this.m_character.transform;

        if (this.m_useCharacterFacing)
        {
            Vector3 forward = Vector3.forward;
            if (this.m_useCharacterFacingYAim)
            {
                forward.y = vector.y;
            }
            vector = transform.TransformDirection(forward);
        }
        if (this.m_launchAngle != 0f)
        {
            Vector3 axis = Vector3.Cross(Vector3.up, vector);
            vector = Quaternion.AngleAxis(this.m_launchAngle, axis) * vector;
        }
        for (int i = 0; i < this.m_projectiles; i++)
        {
            if (this.m_destroyPreviousProjectile && this.m_weapon.m_lastProjectile)
            {
                ZNetScene.instance.Destroy(this.m_weapon.m_lastProjectile);
                this.m_weapon.m_lastProjectile = null;
            }
            Vector3    vector2  = vector;
            Vector3    axis2    = Vector3.Cross(vector2, Vector3.up);
            Quaternion rotation = Quaternion.AngleAxis(UnityEngine.Random.Range(-num3, num3), Vector3.up);
            vector2 = Quaternion.AngleAxis(UnityEngine.Random.Range(-num3, num3), axis2) * vector2;
            vector2 = rotation * vector2;
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(attackProjectile, position, Quaternion.LookRotation(vector2));
            HitData    hitData    = new HitData();
            hitData.m_toolTier          = this.m_weapon.m_shared.m_toolTier;
            hitData.m_pushForce         = this.m_weapon.m_shared.m_attackForce * this.m_forceMultiplier;
            hitData.m_backstabBonus     = this.m_weapon.m_shared.m_backstabBonus;
            hitData.m_staggerMultiplier = this.m_staggerMultiplier;
            hitData.m_damage.Add(this.m_weapon.GetDamage(), 1);
            hitData.m_statusEffect = (this.m_weapon.m_shared.m_attackStatusEffect ? this.m_weapon.m_shared.m_attackStatusEffect.name : "");
            hitData.m_blockable    = this.m_weapon.m_shared.m_blockable;
            hitData.m_dodgeable    = this.m_weapon.m_shared.m_dodgeable;
            hitData.m_skill        = this.m_weapon.m_shared.m_skillType;
            hitData.SetAttacker(this.m_character);
            if (ammoItem != null)
            {
                hitData.m_damage.Add(ammoItem.GetDamage(), 1);
                hitData.m_pushForce += ammoItem.m_shared.m_attackForce;
                if (ammoItem.m_shared.m_attackStatusEffect != null)
                {
                    hitData.m_statusEffect = ammoItem.m_shared.m_attackStatusEffect.name;
                }
                if (!ammoItem.m_shared.m_blockable)
                {
                    hitData.m_blockable = false;
                }
                if (!ammoItem.m_shared.m_dodgeable)
                {
                    hitData.m_dodgeable = false;
                }
            }
            hitData.m_pushForce *= num6;
            hitData.m_damage.Modify(this.m_damageMultiplier);
            hitData.m_damage.Modify(num6);
            hitData.m_damage.Modify(this.GetLevelDamageFactor());
            this.m_character.GetSEMan().ModifyAttack(this.m_weapon.m_shared.m_skillType, ref hitData);
            IProjectile component = gameObject.GetComponent <IProjectile>();
            if (component != null)
            {
                component.Setup(this.m_character, vector2 * num, num5, hitData, this.m_weapon);
            }
            this.m_weapon.m_lastProjectile = gameObject;
        }
    }
Ejemplo n.º 11
0
        public static void Prefix(ref Attack __instance, Humanoid character, ref ItemDrop.ItemData weapon)
        {
            //Log.LogWarning("Attack Start");
            if (character.m_unarmedWeapon && weapon == character?.m_unarmedWeapon.m_itemData)
            {
                //check for all damage bonus
                return;
            }

            //Get base weapon
            var baseWeapon = PrefabManager.Cache.GetPrefab <ItemDrop>(weapon.m_dropPrefab.name);

            if (baseWeapon == null)
            {
                Log.LogMessage("Terraheim (AttackPatch Start) | Weapon is null, grabbing directly");
                baseWeapon = ObjectDB.instance.GetItemPrefab(weapon.m_dropPrefab.name).GetComponent <ItemDrop>();
            }

            //set all damages to default values to prevent forever increasing damages
            weapon.m_shared.m_backstabBonus             = baseWeapon.m_itemData.m_shared.m_backstabBonus;
            weapon.m_shared.m_damages.m_frost           = baseWeapon.m_itemData.m_shared.m_damages.m_frost;
            weapon.m_shared.m_damages.m_spirit          = baseWeapon.m_itemData.m_shared.m_damages.m_spirit;
            weapon.m_shared.m_attack.m_damageMultiplier = baseWeapon.m_itemData.m_shared.m_attack.m_damageMultiplier;
            //Bow Damage Effect
            if (weapon.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow)
            {
                if (character.GetSEMan().GetStatusEffect("Life Steal"))
                {
                    SE_HPOnHit effect = character.GetSEMan().GetStatusEffect("Life Steal") as SE_HPOnHit;
                    effect.setLastHitMelee(false);
                }
                if (character.GetSEMan().HaveStatusEffect("Ranged Damage Bonus"))
                {
                    SE_RangedDmgBonus effect = character.GetSEMan().GetStatusEffect("Ranged Damage Bonus") as SE_RangedDmgBonus;
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.getDamageBonus();
                }
            }
            else if (character.GetSEMan().GetStatusEffect("Life Steal"))
            {
                SE_HPOnHit effect = character.GetSEMan().GetStatusEffect("Life Steal") as SE_HPOnHit;
                effect.setLastHitMelee(true);
            }

            //Melee Damage Effect
            if (weapon.m_shared.m_itemType != ItemDrop.ItemData.ItemType.Bow)
            {
                if (character.GetSEMan().HaveStatusEffect("Melee Damage Bonus"))
                {
                    SE_MeleeDamageBonus effect = character.GetSEMan().GetStatusEffect("Melee Damage Bonus") as SE_MeleeDamageBonus;
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.getDamageBonus();
                    //Log.LogMessage("weapon  damage " + weapon.m_shared.m_attack.m_damageMultiplier);
                }
            }

            //Throwing Damage Effect
            if (weapon.m_shared.m_name.Contains("_throwingaxe") ||
                (weapon.m_shared.m_name.Contains("_spear") && __instance.m_attackAnimation == weapon.m_shared.m_secondaryAttack.m_attackAnimation) ||
                weapon.m_shared.m_name.Contains("bomb"))
            {
                if (character.GetSEMan().HaveStatusEffect("Throwing Damage Bonus"))
                {
                    SE_ThrowingDamageBonus effect = character.GetSEMan().GetStatusEffect("Throwing Damage Bonus") as SE_ThrowingDamageBonus;
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.getDamageBonus();
                    //Log.LogMessage("weapon  damage " + weapon.m_shared.m_attack.m_damageMultiplier);
                }
                if (character.GetSEMan().HaveStatusEffect("Death Mark"))
                {
                    (character.GetSEMan().GetStatusEffect("Death Mark") as SE_DeathMark).SetLastHitThrowing(true);
                    //Log.LogMessage("weapon  damage " + weapon.m_shared.m_attack.m_damageMultiplier);
                }
            }
            else
            {
                if (character.GetSEMan().HaveStatusEffect("Death Mark"))
                {
                    (character.GetSEMan().GetStatusEffect("Death Mark") as SE_DeathMark).SetLastHitThrowing(false);
                    //Log.LogMessage("weapon  damage " + weapon.m_shared.m_attack.m_damageMultiplier);
                }
            }

            //Dagger/Spear Damage Effect
            if ((weapon.m_shared.m_name.Contains("spear") || weapon.m_shared.m_name.Contains("knife")))
            {
                if (character.GetSEMan().HaveStatusEffect("Dagger/Spear Damage Bonus"))
                {
                    SE_DaggerSpearDmgBonus effect = character.GetSEMan().GetStatusEffect("Dagger/Spear Damage Bonus") as SE_DaggerSpearDmgBonus;
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.getDamageBonus();
                }
            }

            //One Hand Damage Effect
            if (weapon.m_shared.m_itemType != ItemDrop.ItemData.ItemType.TwoHandedWeapon && character.GetLeftItem() == null)
            {
                //Log.LogMessage("Weapon only in right hand");
                if (character.GetSEMan().HaveStatusEffect("One Hand Damage Bonus"))
                {
                    SE_OneHandDamageBonus effect = character.GetSEMan().GetStatusEffect("One Hand Damage Bonus") as SE_OneHandDamageBonus;
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.getDamageBonus();
                }
            }

            //Two Handed Damage Effect
            if (weapon.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeapon)
            {
                if (character.GetSEMan().HaveStatusEffect("Two Handed Damage Bonus"))
                {
                    SE_TwoHandedDmgBonus effect = character.GetSEMan().GetStatusEffect("Two Handed Damage Bonus") as SE_TwoHandedDmgBonus;
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.getDamageBonus();
                }
            }

            //TODO: Audio Effect on Activation!
            //Crit Damage Effect
            if (weapon.m_shared.m_itemType == ItemDrop.ItemData.ItemType.TwoHandedWeapon)
            {
                if (character.GetSEMan().HaveStatusEffect("Crit Chance"))
                {
                    SE_CritChance effect = character.GetSEMan().GetStatusEffect("Crit Chance") as SE_CritChance;
                    System.Random rand   = new System.Random();

                    int roll = rand.Next(1, 100);
                    if (roll <= effect.GetCritChance())
                    {
                        Log.LogWarning("Crit!");
                        weapon.m_shared.m_attack.m_damageMultiplier *= effect.GetCritBonus();
                    }
                }
            }

            //Ammo Consumption Effect
            if (weapon.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow && character.GetSEMan().HaveStatusEffect("Ammo Consumption"))
            {
                System.Random      rand   = new System.Random();
                SE_AmmoConsumption effect = character.GetSEMan().GetStatusEffect("Ammo Consumption") as SE_AmmoConsumption;

                int roll = rand.Next(1, 100);
                if (roll <= effect.getAmmoConsumption())
                {
                    if (string.IsNullOrEmpty(weapon.m_shared.m_ammoType))
                    {
                        return;
                    }

                    //First check if bow has ammo available
                    bool hasAmmo = true;
                    ItemDrop.ItemData ammoItem = character.GetAmmoItem();
                    if (ammoItem != null && (!character.GetInventory().ContainsItem(ammoItem) || ammoItem.m_shared.m_ammoType != weapon.m_shared.m_ammoType))
                    {
                        ammoItem = null;
                    }
                    if (ammoItem == null)
                    {
                        ammoItem = character.GetInventory().GetAmmoItem(weapon.m_shared.m_ammoType);
                    }
                    if (ammoItem == null)
                    {
                        return;
                    }
                    if (ammoItem.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Consumable)
                    {
                        hasAmmo = character.CanConsumeItem(ammoItem);
                    }
                    //Log.LogWarning("Stack " + ammoItem.m_stack);

                    //if so, add 1 of the selected ammo type
                    if (hasAmmo)
                    {
                        //Add 1 Ammo
                        ammoItem.m_stack += 1;
                        //Log.LogWarning("Stack " + ammoItem.m_stack);

                        //character.GetInventory().AddItem(ammoItem);
                    }
                }
            }

            //Backstab Bonus Effect
            if (character.GetSEMan().HaveStatusEffect("Backstab Bonus"))
            {
                SE_BackstabBonus effect = character.GetSEMan().GetStatusEffect("Backstab Bonus") as SE_BackstabBonus;
                weapon.m_shared.m_backstabBonus = baseWeapon.m_itemData.m_shared.m_backstabBonus + effect.getBackstabBonus();
            }

            //Silver Damage Bonus Effect
            weapon.m_shared.m_damages.m_spirit = baseWeapon.m_itemData.m_shared.m_damages.m_spirit;
            if (weapon.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow || weapon.m_shared.m_name.Contains("spear") || weapon.m_shared.m_name.Contains("knife"))
            {
                if (character.GetSEMan().HaveStatusEffect("Silver Damage Bonus"))
                {
                    SE_SilverDamageBonus effect = character.GetSEMan().GetStatusEffect("Silver Damage Bonus") as SE_SilverDamageBonus;

                    var totalDamage   = weapon.GetDamage().GetTotalDamage();
                    var elementDamage = (totalDamage * effect.GetDamageBonus()) / 2;
                    weapon.m_shared.m_damages.m_frost  += elementDamage;
                    weapon.m_shared.m_damages.m_spirit += elementDamage;
                    //Log.LogMessage("elemental damage " + elementDamage);
                    //Log.LogMessage("weapon Element damage " + weapon.m_shared.m_damages.m_frost);
                }
            }

            //Ranger weapon bonus
            if (weapon.m_shared.m_itemType == ItemDrop.ItemData.ItemType.Bow || weapon.m_shared.m_name.Contains("spear") || weapon.m_shared.m_name.Contains("knife"))
            {
                //Log.LogInfo(1);
                if (character.GetSEMan().HaveStatusEffect("Ranger Weapon Bonus"))
                {
                    //Log.LogInfo(2);
                    weapon.m_shared.m_attack.m_damageMultiplier += (character.GetSEMan().GetStatusEffect("Ranger Weapon Bonus") as SE_RangerWeaponBonus).GetDamageBonus();
                }
            }

            //Add Spirit damage to all weapons
            if (character.GetSEMan().HaveStatusEffect("Spirit Damage Bonus"))
            {
                SE_SpiritDamageBonus effect = character.GetSEMan().GetStatusEffect("Spirit Damage Bonus") as SE_SpiritDamageBonus;
                weapon.m_shared.m_damages.m_spirit += effect.GetDamageBonus();
                //Log.LogMessage("weapon spirit damage " + weapon.m_shared.m_damages.m_spirit);
            }

            //Red Tearstone Ring
            if (character.GetSEMan().HaveStatusEffect("Wolftears"))
            {
                SE_Wolftears effect = character.GetSEMan().GetStatusEffect("Wolftears") as SE_Wolftears;
                weapon.m_shared.m_attack.m_damageMultiplier += effect.GetDamageBonus();
                Log.LogInfo("Damage Bonus " + effect.GetDamageBonus());
            }

            //Damage Bonus on Full HP
            if (character.GetSEMan().HaveStatusEffect("Battle Furor"))
            {
                SE_FullHPDamageBonus effect = character.GetSEMan().GetStatusEffect("Battle Furor") as SE_FullHPDamageBonus;
                if (character.GetHealthPercentage() >= effect.GetActivationHP())
                {
                    weapon.m_shared.m_attack.m_damageMultiplier += effect.GetDamageBonus();
                }
            }

            //Wyrdarrow
            if (character.GetSEMan().HaveStatusEffect("WyrdarrowFX"))
            {
                Log.LogInfo("Wyrd Active");
                if (weapon.m_shared.m_name.Contains("_knife") && __instance.m_attackAnimation == weapon.m_shared.m_secondaryAttack.m_attackAnimation)
                {
                    var effect      = character.GetSEMan().GetStatusEffect("Wyrdarrow") as SE_AoECounter;
                    var damageBonus = (weapon.m_shared.m_damages.GetTotalDamage() * effect.GetDamageBonus()) / 2;
                    AssetHelper.TestProjectile.GetComponent <Projectile>().m_spawnOnHit.GetComponent <Aoe>().m_radius = effect.GetAoESize();

                    AssetHelper.TestProjectile.GetComponent <Projectile>().m_spawnOnHit.GetComponent <Aoe>().m_damage.m_frost  = damageBonus;
                    AssetHelper.TestProjectile.GetComponent <Projectile>().m_spawnOnHit.GetComponent <Aoe>().m_damage.m_spirit = damageBonus;

                    Log.LogInfo("Terraheim | Aoe deals " + damageBonus + " frost and " + damageBonus + " spirit damage.");

                    __instance.m_attackProjectile = AssetHelper.TestProjectile;
                    __instance.m_attackType       = Attack.AttackType.Projectile;
                }
            }
        }