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>"); }
public static List <ItemAmountConfig> GetDisenchantProducts(ItemDrop.ItemData item) { var isMagic = item.IsMagic(); var type = item.m_shared.m_itemType; var name = item.m_shared.m_name; var configEntry = Config.DisenchantProducts.Find(x => { if (x.IsMagic && !isMagic) { return(false); } if (isMagic && x.Rarity != item.GetRarity()) { return(false); } if (x.ItemTypes?.Count > 0 && !x.ItemTypes.Contains(type.ToString())) { return(false); } if (x.ItemNames?.Count > 0 && !x.ItemNames.Contains(name)) { return(false); } return(true); }); return(configEntry?.Products); }
public static void Postfix(ref string __result, ItemDrop.ItemData item) { if (item != null && (item.IsMagicCraftingMaterial() || item.IsRunestone())) { var rarityDisplay = EpicLoot.GetRarityDisplayName(item.GetCraftingMaterialRarity()); __result = $"<color={item.GetCraftingMaterialRarityColor()}>{rarityDisplay} crafting material\n</color>" + __result; } if (item != null && !item.IsMagic()) { var text = new StringBuilder(); // Set stuff if (!string.IsNullOrEmpty(item.m_shared.m_setName)) { // Remove old set stuff var index = __result.IndexOf("\n\n$item_seteffect", StringComparison.InvariantCulture); if (index >= 0) { __result = __result.Remove(index); } // Create new AddSetTooltip(item, text); } __result += text.ToString(); } __result = __result.Replace("<color=orange>", "<color=lightblue>"); __result = __result.Replace("<color=yellow>", "<color=lightblue>"); }
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; } }
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)); }
public void Show(ItemDrop.ItemData item) { gameObject.SetActive(true); var rarityColor = item.IsMagic() ? item.GetRarityColor() : Color.white; MagicBG.enabled = item.IsMagic(); MagicBG.color = rarityColor; NameText.text = Localization.instance.Localize(item.GetDecoratedName()); Description.text = Localization.instance.Localize(item.GetTooltip()); Icon.sprite = item.GetIcon(); if (item.IsMagic()) { _audioSource.PlayOneShot(EpicLoot.GetMagicItemDropSFX(item.GetRarity())); } }
private void GenerateEnchantRecipesForItem(ItemDrop.ItemData item) { if (!item.IsMagic() && EpicLoot.CanBeMagicItem(item)) { var recipe = new EnchantRecipe { FromItem = item.Extended() }; Recipes.Add(recipe); } }
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); }
private void GenerateEnchantRecipesForItem(ItemDrop.ItemData item) { if (!item.IsMagic() && EpicLoot.CanBeMagicItem(item)) { if (Player.m_localPlayer.m_knownMaterial.Contains($"Magic Runestone")) { var recipe = new EnchantRecipe { FromItem = item.Extended() }; Recipes.Add(recipe); } } }
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 DisenchantRecipe GenerateDisenchantRecipe(ItemDrop.ItemData item) { if (item.IsMagic()) { var recipe = new DisenchantRecipe { FromItem = item.Extended() }; recipe.Products = GetDisenchantProducts(item, item.GetRarity()); return(recipe); } return(null); }
public void Show(ItemDrop.ItemData item) { gameObject.SetActive(true); var rarityColor = item.IsMagic() ? item.GetRarityColor() : Color.white; if (MagicBG != null) { MagicBG.enabled = item.IsMagic(); MagicBG.color = rarityColor; } if (EpicLoot.HasAuga) { Auga.API.ComplexTooltip_SetItem(gameObject, item); EpicLoot.ExtendAugaTooltipForMagicItem(gameObject, item); } if (NameText != null) { NameText.text = Localization.instance.Localize(item.GetDecoratedName()); } if (Description != null) { Description.text = Localization.instance.Localize(item.GetTooltip()); } if (Icon != null) { Icon.sprite = item.GetIcon(); } if (item.IsMagic()) { _audioSource.PlayOneShot(EpicLoot.GetMagicItemDropSFX(item.GetRarity())); } }
private void GenerateEnchantRecipesForItem(ItemDrop.ItemData item) { if (!item.IsMagic() && EpicLoot.CanBeMagicItem(item)) { //foreach (ItemRarity rarity in Enum.GetValues(typeof(ItemRarity))) { if (Player.m_localPlayer.m_knownMaterial.Contains($"Magic Runestone")) { var recipe = new EnchantRecipe { FromItem = item.Extended() }; // todo, no rarity in recipe Recipes.Add(recipe); } } } }
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"); }
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); } }
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); }
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); }
public static bool UseMagicBackground(this ItemDrop.ItemData itemData) { return(itemData.IsMagic() || itemData.IsRunestone()); }
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); }
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); } }