private static string GetAugmentSelectorText(MagicItem magicItem, int i, IReadOnlyList <MagicItemEffect> augmentableEffects, ItemRarity rarity) { var pip = EpicLoot.GetMagicEffectPip(magicItem.IsEffectAugmented(i)); bool free = EnchantCostsHelper.EffectIsDeprecated(augmentableEffects[i].EffectType); return($"{pip} {Localization.instance.Localize(MagicItem.GetEffectText(augmentableEffects[i], rarity, true))}{(free ? " [FREE]" : "")}"); }
public void AddRecipeToList(InventoryGui __instance, AugmentRecipe recipe, int index) { var count = __instance.m_recipeList.Count; var element = Object.Instantiate(__instance.m_recipeElementPrefab, __instance.m_recipeListRoot); element.SetActive(true); element.RectTransform().anchoredPosition = new Vector2(0.0f, count * -__instance.m_recipeListSpace); //var canCraft = Player.m_localPlayer.HaveRequirements(recipe.GetRequirementArray(), false, 1); var item = recipe.FromItem; var image = element.transform.Find("icon").GetComponent <Image>(); image.sprite = item.GetIcon(); image.color = Color.white; var bgImage = Object.Instantiate(image, image.transform.parent, true); bgImage.name = "MagicItemBG"; bgImage.transform.SetSiblingIndex(image.transform.GetSiblingIndex()); bgImage.sprite = EpicLoot.GetMagicItemBgSprite(); bgImage.color = EpicLoot.GetRarityColorARGB(item.GetRarity()); var nameText = element.transform.Find("name").GetComponent <Text>(); nameText.text = Localization.instance.Localize(item.GetDecoratedName()); if (item.GetMagicItem() != null && item.GetMagicItem().HasBeenAugmented()) { nameText.text += $" {EpicLoot.GetMagicEffectPip(true)}"; } nameText.color = Color.white; var durability = element.transform.Find("Durability").GetComponent <GuiBar>(); if (item.m_shared.m_useDurability && item.m_durability < item.GetMaxDurability()) { durability.gameObject.SetActive(true); durability.SetValue(item.GetDurabilityPercentage()); } else { durability.gameObject.SetActive(false); } var quality = element.transform.Find("QualityLevel").GetComponent <Text>(); quality.gameObject.SetActive(true); quality.text = item.m_quality.ToString(); element.GetComponent <Button>().onClick.AddListener(() => OnSelectedRecipe(__instance, index)); __instance.m_recipeList.Add(element); }