private void AddPriceTooltip(Item item, List <TooltipLine> tooltips) { if (!ModContent.GetInstance <MoreItemInfoConfig>().ShowPricePerItem) { return; } if (Main.npcShop != 0) { return; } if (item.value == 0) { return; } long unitSellValue = item.value / 5; long stackSellValue = unitSellValue * item.stack; string[] renderedSellValueDenoms = ItemMoneyLibraries.RenderMoneyDenominations(stackSellValue, true, true); string renderedSellValue = string.Join(", ", renderedSellValueDenoms); string tipText = "Sells for " + renderedSellValue; if (item.stack > 1) { string[] renderedUnitSellValueDenoms = ItemMoneyLibraries.RenderMoneyDenominations(unitSellValue, true, true); for (int i = 0; i < renderedUnitSellValueDenoms.Length; i++) { string[] segs = renderedUnitSellValueDenoms[i].Split(' '); renderedUnitSellValueDenoms[i] = segs[0] + segs[1][0] + "]"; } string renderedUnitSellValue = string.Join(", ", renderedUnitSellValueDenoms); tipText += " (" + renderedUnitSellValue + " each)"; } var tip = new TooltipLine(this.mod, "MoreItemInfoValue", tipText); tooltips.Add(tip); }
//////////////// private void Draw_NpcChatButton_WitchDoctor_HealNecrotis() { string label = "Heal Necrotis"; float healAmount = NecrotisPlayer.CalculateHealAmountFromWitchDoctor(Main.LocalPlayer); int cost = NecrotisPlayer.CalculateHealCostFromWitchDoctor(Main.LocalPlayer, healAmount); Color color; if (cost == 0) { color = Color.Gray; } else { string readCost = string.Join(" ", ItemMoneyLibraries.RenderMoneyDenominations(cost, true, false, false)); label += " (" + readCost + ")"; color = new Color( Main.mouseTextColor, (byte)((double)Main.mouseTextColor / 1.1d), Main.mouseTextColor / 2, Main.mouseTextColor ); } List <List <TextSnippet> > snippets = Utils.WordwrapStringSmart( text: Main.npcChatText, c: Color.White, font: Main.fontMouseText, maxWidth: 460, maxLines: 10 ); int lineCount = snippets.Count; Vector2 scale = new Vector2(0.9f); DynamicSpriteFont font = Main.fontMouseText; Vector2 stringSize = ChatManager.GetStringSize(font, label, scale, -1f); Vector2 pos = new Vector2( stringSize.X + 30f + 96f /*todo?*/, 100 + (lineCount + 1) * 30 ); pos.X += (Main.screenWidth / 2) - (Main.chatBackTexture.Width / 2); if (cost > 0) { this.Hover_NpcChatButton_WitchDoctor_HealNecrotis(pos, stringSize, ref scale); } ChatManager.DrawColorCodedStringWithShadow( spriteBatch: Main.spriteBatch, font: font, text: label, position: pos + stringSize * 0.5f, baseColor: color, rotation: 0f, origin: stringSize * 0.5f, baseScale: scale, maxWidth: -1f, spread: 2f ); // TODO: Figure out how to use this properly? //UILinkPointNavigator.SetPosition( 2502, pos + stringSize * 0.5f ); //UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = true; if (cost > 0) { if (Main.npcChatFocus3 && Main.mouseLeft && Main.mouseLeftRelease) { this.Click_NpcChatButton_WitchDoctorHeal_Necrotis(healAmount); } } }