Exemple #1
0
 public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
 {
     if (__instance.IsMagic() && __instance.GetMagicItem().HasEffect(MagicEffectType.ModifyDurability))
     {
         var totalDurabilityMod = __instance.GetMagicItem().GetTotalEffectValue(MagicEffectType.ModifyDurability, 0.01f);
         __result *= 1.0f + totalDurabilityMod;
     }
 }
Exemple #2
0
        public static string GetDecoratedName(this ItemDrop.ItemData itemData, string colorOverride = null)
        {
            var color = "white";
            var name  = itemData.m_shared.m_name;

            if (itemData.IsMagic())
            {
                var magicItem = itemData.GetMagicItem();
                color = magicItem.GetColorString();
                if (!string.IsNullOrEmpty(magicItem.DisplayName))
                {
                    name = magicItem.DisplayName;
                }
            }
            else if (itemData.IsMagicCraftingMaterial() || itemData.IsRunestone())
            {
                color = itemData.GetCraftingMaterialRarityColor();
            }

            if (!string.IsNullOrEmpty(colorOverride))
            {
                color = colorOverride;
            }

            return($"<color={color}>{name}</color>");
        }
Exemple #3
0
        public static ItemAmountConfig GetReAugmentCost(ItemDrop.ItemData item, int indexToAugment)
        {
            if (EffectIsDeprecated(item, indexToAugment))
            {
                return(null);
            }

            var magicItem = item.GetMagicItem();

            if (magicItem == null)
            {
                return(null);
            }

            var totalAugments = magicItem.GetAugmentCount();

            if (totalAugments == 0)
            {
                return(null);
            }

            var reaugmentCostIndex = Mathf.Clamp(totalAugments - 1, 0, Config.ReAugmentCosts.Count - 1);

            return(Config.ReAugmentCosts[reaugmentCostIndex]);
        }
Exemple #4
0
        public static bool CanBeAugmented(this ItemDrop.ItemData itemData)
        {
            if (!itemData.IsMagic())
            {
                return(false);
            }

            return(itemData.GetMagicItem().Effects.Select(effect => MagicItemEffectDefinitions.Get(effect.EffectType)).Any(effectDef => effectDef.CanBeAugmented));
        }
Exemple #5
0
 public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
 {
     if (__instance.HasMagicEffect(MagicEffectType.Weightless))
     {
         __result = 0;
     }
     else if (__instance.HasMagicEffect(MagicEffectType.ReduceWeight))
     {
         var totalWeightReduction = __instance.GetMagicItem().GetTotalEffectValue(MagicEffectType.ReduceWeight, 0.01f);
         __result *= 1.0f - totalWeightReduction;
     }
 }
 public static string GetDescription(this ItemDrop.ItemData itemData)
 {
     if (itemData.IsMagic())
     {
         var magicItem = itemData.GetMagicItem();
         if (magicItem.IsUniqueLegendary() && UniqueLegendaryHelper.TryGetLegendaryInfo(magicItem.LegendaryID, out var legendaryInfo))
         {
             return(legendaryInfo.Description);
         }
     }
     return(itemData.m_shared.m_description);
 }
Exemple #7
0
        public static List <MagicItemEffectDefinition> GetAvailableAugments(AugmentRecipe recipe, ItemDrop.ItemData item, MagicItem magicItem, ItemRarity rarity)
        {
            var valuelessEffect = false;

            if (recipe.EffectIndex >= 0 && recipe.EffectIndex < magicItem.Effects.Count)
            {
                var currentEffectDef = MagicItemEffectDefinitions.Get(magicItem.Effects[recipe.EffectIndex].EffectType);
                valuelessEffect = currentEffectDef.GetValuesForRarity(rarity) == null;
            }

            return(MagicItemEffectDefinitions.GetAvailableEffects(item.Extended(), item.GetMagicItem(), valuelessEffect ? -1 : recipe.EffectIndex));
        }
        private static DisenchantRecipe GenerateDisenchantRecipe(ItemDrop.ItemData item)
        {
            if (item.IsMagic())
            {
                var recipe = new DisenchantRecipe {
                    FromItem = item.Extended()
                };
                AddDisenchantProducts(item, recipe, item.GetMagicItem().Rarity);
                return(recipe);
            }

            return(null);
        }
        public static bool Prefix(Humanoid __instance, HitData hit, Character attacker)
        {
            Override      = false;
            OriginalValue = -1;

            ItemDrop.ItemData currentBlocker = __instance.GetCurrentBlocker();
            if (currentBlocker == null)
            {
                return(true);
            }

            if (currentBlocker.IsMagic() && currentBlocker.GetMagicItem().HasEffect(MagicEffectType.ModifyParry))
            {
                Override      = true;
                OriginalValue = currentBlocker.m_shared.m_timedBlockBonus;

                var totalParryBonusMod = currentBlocker.GetMagicItem().GetTotalEffectValue(MagicEffectType.ModifyParry, 0.01f);
                currentBlocker.m_shared.m_timedBlockBonus *= 1.0f + totalParryBonusMod;
            }

            return(true);
        }
        public static bool Prefix(Humanoid __instance, HitData hit, Character attacker)
        {
            Override      = false;
            OriginalValue = -1;

            ItemDrop.ItemData currentBlockingItem = __instance.GetCurrentBlocker();
            if (currentBlockingItem == null)
            {
                return(true);
            }

            if (currentBlockingItem.IsMagic() && currentBlockingItem.GetMagicItem().HasEffect(MagicEffectType.ModifyBlockStaminaUse))
            {
                Override      = true;
                OriginalValue = __instance.m_blockStaminaDrain;

                var totalBlockStaminaUseMod = currentBlockingItem.GetMagicItem().GetTotalEffectValue(MagicEffectType.ModifyBlockStaminaUse, 0.01f);
                __instance.m_blockStaminaDrain *= 1.0f - totalBlockStaminaUseMod;
            }

            return(true);
        }
Exemple #11
0
        public static void DoSpeedCalc(Player __instance, ItemDrop.ItemData item)
        {
            if (item != null)
            {
                if (item.HasMagicEffect(MagicEffectType.RemoveSpeedPenalty))
                {
                    __instance.m_equipmentMovementModifier -= item.m_shared.m_movementModifier;
                }

                if (item.HasMagicEffect(MagicEffectType.ModifyMovementSpeed))
                {
                    __instance.m_equipmentMovementModifier += item.GetMagicItem().GetTotalEffectValue(MagicEffectType.ModifyMovementSpeed, 0.01f);
                }
            }
        }
Exemple #12
0
        public static void Postfix(ItemDrop.ItemData __instance, ref HitData.DamageTypes __result)
        {
            if (!__instance.IsMagic())
            {
                return;
            }

            var magicItem = __instance.GetMagicItem();

            // Add damages first
            __result.m_blunt     += GetAddedDamageType(magicItem, MagicEffectType.AddBluntDamage);
            __result.m_slash     += GetAddedDamageType(magicItem, MagicEffectType.AddSlashingDamage);
            __result.m_pierce    += GetAddedDamageType(magicItem, MagicEffectType.AddPiercingDamage);
            __result.m_fire      += GetAddedDamageType(magicItem, MagicEffectType.AddFireDamage);
            __result.m_frost     += GetAddedDamageType(magicItem, MagicEffectType.AddFrostDamage);
            __result.m_lightning += GetAddedDamageType(magicItem, MagicEffectType.AddLightningDamage);
            __result.m_poison    += GetAddedDamageType(magicItem, MagicEffectType.AddPoisonDamage);
            __result.m_spirit    += GetAddedDamageType(magicItem, MagicEffectType.AddSpiritDamage);

            // Then modify
            if (magicItem.HasEffect(MagicEffectType.ModifyPhysicalDamage))
            {
                var totalDamageMod = magicItem.GetTotalEffectValue(MagicEffectType.ModifyPhysicalDamage, 0.01f);
                var modifier       = 1.0f + totalDamageMod;

                __result.m_blunt  *= modifier;
                __result.m_slash  *= modifier;
                __result.m_pierce *= modifier;
            }

            if (magicItem.HasEffect(MagicEffectType.ModifyElementalDamage))
            {
                var totalDamageMod = magicItem.GetTotalEffectValue(MagicEffectType.ModifyElementalDamage, 0.01f);
                var modifier       = 1.0f + totalDamageMod;

                __result.m_fire      *= modifier;
                __result.m_frost     *= modifier;
                __result.m_lightning *= modifier;
            }

            if (magicItem.HasEffect(MagicEffectType.ModifyDamage))
            {
                var totalDamageMod = magicItem.GetTotalEffectValue(MagicEffectType.ModifyDamage, 0.01f);
                __result.Modify(1.0f + totalDamageMod);
            }
        }
Exemple #13
0
        public static ItemRarity GetRarity(this ItemDrop.ItemData itemData)
        {
            if (itemData.IsMagic())
            {
                return(itemData.GetMagicItem().Rarity);
            }
            else if (itemData.IsMagicCraftingMaterial())
            {
                return(itemData.GetCraftingMaterialRarity());
            }
            else if (itemData.IsRunestone())
            {
                return(itemData.GetRunestoneRarity());
            }

            throw new ArgumentException("itemData is not magic item, magic crafting material, or runestone");
        }
Exemple #14
0
        public static Color GetRarityColor(this ItemDrop.ItemData itemData)
        {
            var colorString = "white";

            if (itemData.IsMagic())
            {
                colorString = itemData.GetMagicItem().GetColorString();
            }
            else if (itemData.IsMagicCraftingMaterial())
            {
                colorString = itemData.GetCraftingMaterialRarityColor();
            }
            else if (itemData.IsRunestone())
            {
                colorString = itemData.GetRunestoneRarityColor();
            }

            return(ColorUtility.TryParseHtmlString(colorString, out var color) ? color : Color.white);
        }
Exemple #15
0
        public static void UpdatePlayerZDOForEquipment(Player player, ItemDrop.ItemData item, bool equip)
        {
            if (!(player?.m_nview?.GetZDO() is ZDO zdo))
            {
                return;
            }

            var magicItem = item.GetMagicItem();
            var data      = equip ? (magicItem != null && magicItem.IsUniqueLegendary() ? magicItem.LegendaryID : "") : "";

            var itemType = item.m_shared.m_itemType;

            switch (itemType)
            {
            case ItemDrop.ItemData.ItemType.Bow:
            case ItemDrop.ItemData.ItemType.OneHandedWeapon:
            case ItemDrop.ItemData.ItemType.TwoHandedWeapon:
            case ItemDrop.ItemData.ItemType.Shield:
                if (player.m_leftItem?.m_dropPrefab.name == item.m_dropPrefab.name)
                {
                    zdo.Set("lf-ell", data);
                }
                if (player.m_rightItem?.m_dropPrefab.name == item.m_dropPrefab.name)
                {
                    zdo.Set("ri-ell", data);
                }
                break;

            case ItemDrop.ItemData.ItemType.Chest: zdo.Set("ch-ell", data); break;

            case ItemDrop.ItemData.ItemType.Legs: zdo.Set("lg-ell", data); break;

            case ItemDrop.ItemData.ItemType.Helmet: zdo.Set("hl-ell", data); break;

            case ItemDrop.ItemData.ItemType.Shoulder: zdo.Set("sh-ell", data); break;

            case ItemDrop.ItemData.ItemType.Utility: zdo.Set("ut-ell", data); break;
            }

            EpicLoot.LogWarning($"Setting Equipment ZDO: {itemType}='{data}'");
        }
Exemple #16
0
        public static void Postfix(ItemDrop.ItemData __instance, ref float __result)
        {
            var player = PlayerExtensions.GetPlayerWithEquippedItem(__instance);

            // Apply this item's armor for just this item
            var totalArmorMod = __instance.GetMagicItem()?.GetTotalEffectValue(MagicEffectType.ModifyArmor, 0.01f) ?? 0f;

            // apply +armor from set bonuses globally
            if (player != null)
            {
                totalArmorMod += MagicEffectsHelper.GetTotalActiveSetEffectValue(player, MagicEffectType.ModifyArmor, 0.01f);
            }

            // Apply +armor (health critical) for all items
            ModifyWithLowHealth.ApplyOnlyForLowHealth(player, MagicEffectType.ModifyArmor, effect =>
            {
                totalArmorMod += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, __instance, effect, 0.01f);
            });

            __result *= 1.0f + totalArmorMod;
        }
Exemple #17
0
            private static bool DoCheck(Player player, ZDO zdo, string equipKey, string legendaryDataKey, ref ItemDrop.ItemData itemData)
            {
                var zdoLegendaryID = zdo.GetString(legendaryDataKey);

                if (string.IsNullOrEmpty(zdoLegendaryID))
                {
                    var hadItem = itemData != null;
                    if (hadItem)
                    {
                        ForceResetVisEquipment(player, itemData);
                    }
                    itemData = null;
                    return(hadItem);
                }

                var currentLegendaryID = itemData?.GetMagicItem()?.LegendaryID;

                if (currentLegendaryID == zdoLegendaryID)
                {
                    return(false);
                }

                var itemHash   = zdo.GetInt(equipKey);
                var itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash);

                if (itemPrefab?.GetComponent <ItemDrop>()?.m_itemData is ItemDrop.ItemData targetItemData)
                {
                    itemData = new ExtendedItemData(targetItemData);
                    itemData.m_durability = float.PositiveInfinity;
                    var magicItemComponent = itemData.Extended().AddComponent <MagicItemComponent>();
                    var stubMagicItem      = new MagicItem {
                        Rarity = ItemRarity.Legendary, LegendaryID = zdoLegendaryID
                    };
                    magicItemComponent.SetMagicItem(stubMagicItem);

                    ForceResetVisEquipment(player, itemData);
                }

                return(false);
            }
Exemple #18
0
        public static bool DoPrefix(Attack __instance)
        {
            Override      = false;
            OriginalValue = -1;

            ItemDrop.ItemData weapon = __instance.m_weapon;
            if (weapon == null)
            {
                return(true);
            }

            if (weapon.HasMagicEffect(MagicEffectType.ModifyBackstab))
            {
                Override      = true;
                OriginalValue = weapon.m_shared.m_backstabBonus;

                var totalBackstabMod = weapon.GetMagicItem().GetTotalEffectValue(MagicEffectType.ModifyBackstab, 0.01f);
                weapon.m_shared.m_backstabBonus *= 1.0f + totalBackstabMod;
            }

            return(true);
        }
Exemple #19
0
        public static List <ItemAmountConfig> GetAugmentCost(ItemDrop.ItemData item, ItemRarity rarity, int recipeEffectIndex)
        {
            var type = item.m_shared.m_itemType;

            var configEntry = Config.AugmentCosts.Find(x => {
                if (x.Rarity != rarity)
                {
                    return(false);
                }

                if (x.ItemTypes?.Count > 0 && !x.ItemTypes.Contains(type.ToString()))
                {
                    return(false);
                }

                return(true);
            });

            if (EffectIsDeprecated(item, recipeEffectIndex))
            {
                return(new List <ItemAmountConfig>());
            }

            if (configEntry != null && !item.GetMagicItem().IsEffectAugmented(recipeEffectIndex))
            {
                var cost          = configEntry.Cost.ToList();
                var reaugmentCost = GetReAugmentCost(item, recipeEffectIndex);
                if (reaugmentCost != null)
                {
                    cost.Add(reaugmentCost);
                }
                return(cost);
            }

            return(configEntry?.Cost);
        }
Exemple #20
0
        public static bool EffectIsDeprecated(ItemDrop.ItemData item, int effectIndex)
        {
            var effects = item?.GetMagicItem()?.GetEffects();

            return(effects != null && effectIndex >= 0 && effectIndex < effects.Count && EffectIsDeprecated(effects[effectIndex].EffectType));
        }
Exemple #21
0
 public static bool HasMagicEffect(this ItemDrop.ItemData itemData, string effectType)
 {
     return(itemData.GetMagicItem()?.HasEffect(effectType) ?? false);
 }
 public static float GetTotalActiveMagicEffectValue(Player player, ItemDrop.ItemData itemData, string effectType, float scale = 1.0f)
 {
     return(GetTotalActiveMagicEffectValue(player, itemData.GetMagicItem(), effectType, scale));
 }
 public static bool HasActiveMagicEffect(Player player, ItemDrop.ItemData itemData, string effectType)
 {
     return(HasActiveMagicEffect(player, itemData.GetMagicItem(), effectType));
 }
 public static bool IsMagic(this ItemDrop.ItemData itemData, out MagicItem magicItem)
 {
     magicItem = itemData.GetMagicItem();
     return(magicItem != null);
 }
Exemple #25
0
        public static void Postfix(ItemDrop.ItemData __instance, ref HitData.DamageTypes __result)
        {
            if (!__instance.IsMagic())
            {
                return;
            }

            var magicItem          = __instance.GetMagicItem();
            var magicItemskillType = __instance.m_shared.m_skillType;

            var player = PlayerExtensions.GetPlayerWithEquippedItem(__instance);

            // Add damages first
            __result.m_blunt     += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddBluntDamage);
            __result.m_slash     += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddSlashingDamage);
            __result.m_pierce    += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddPiercingDamage);
            __result.m_fire      += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddFireDamage);
            __result.m_frost     += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddFrostDamage);
            __result.m_lightning += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddLightningDamage);
            __result.m_poison    += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddPoisonDamage);
            __result.m_spirit    += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddSpiritDamage);

            if (magicItemskillType == Skills.SkillType.Axes)
            {
                __result.m_chop += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddSlashingDamage);
            }
            else if (magicItemskillType == Skills.SkillType.Pickaxes)
            {
                __result.m_pickaxe += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.AddPiercingDamage);
            }

            // Then modify
            if (MagicEffectsHelper.HasActiveMagicEffect(player, magicItem, MagicEffectType.ModifyPhysicalDamage))
            {
                var totalDamageMod = MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.ModifyPhysicalDamage, 0.01f);
                var modifier       = 1.0f + totalDamageMod;

                __result.m_blunt   *= modifier;
                __result.m_slash   *= modifier;
                __result.m_pierce  *= modifier;
                __result.m_chop    *= modifier;
                __result.m_pickaxe *= modifier;
            }

            if (MagicEffectsHelper.HasActiveMagicEffect(player, magicItem, MagicEffectType.ModifyElementalDamage))
            {
                var totalDamageMod = MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, MagicEffectType.ModifyElementalDamage, 0.01f);
                var modifier       = 1.0f + totalDamageMod;

                __result.m_fire      *= modifier;
                __result.m_frost     *= modifier;
                __result.m_lightning *= modifier;
                __result.m_poison    *= modifier;
                __result.m_spirit    *= modifier;
            }

            var damageMod = 0f;

            ModifyWithLowHealth.Apply(player, MagicEffectType.ModifyDamage, effect =>
            {
                if (MagicEffectsHelper.HasActiveMagicEffect(player, magicItem, effect))
                {
                    damageMod += MagicEffectsHelper.GetTotalActiveMagicEffectValue(player, magicItem, effect, 0.01f);
                }
            });
            __result.Modify(1.0f + damageMod);

            if (player != null && player.GetSEMan().HaveStatusEffect("BerserkerStatusEffect"))
            {
                var percentLife  = player.GetHealthPercentage();
                var berserkerMod = Mathf.Lerp(2.0f, 0.5f, percentLife);
                __result.Modify(1.0f + berserkerMod);
            }
        }
        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);
        }