private void ModifyTooltips_TemperatureIf( string modName, Item item, List <TooltipLine> tooltips, ref int tipIdx) { //var myplayer = Main.LocalPlayer.GetModPlayer<PowerfulMagicPlayer>(); //float temp = myplayer.MeteorArmorTemperature; float temp = this.Temperature; if (temp <= 0f) { return; } Color color = Color.Lerp(Color.Lime, Color.Red, Math.Min(temp / 100f, 1f)); string clrHex = MiscLibraries.RenderColorHex(color); string tipText = modName + "Temperature percent until overheat: [c/" + clrHex + ":" + (int)temp + "%]"; var tip = new TooltipLine(this.mod, "PowerfulMagicTemp", tipText); tooltips.Insert(tipIdx++, tip); }
/// <summary> /// Generates an English-formatted string indicating an amount of money. /// </summary> /// <param name="money"></param> /// <param name="addDenom"></param> /// <param name="addColors"></param> /// <param name="tint"></param> /// <returns></returns> public static string[] RenderMoneyDenominations(long money, bool addDenom, bool addColors, Color tint) { var denoms = ItemMoneyLibraries.GetMoneyDenominations(money); var rendered = new List <string>(4); if (denoms.platinum != 0) { string render = denoms.platinum.ToString(); if (addDenom) { render += " " + Language.GetTextValue("Currency.Platinum"); //Lang.inter[15]; } if (addColors) { Color color = XNAColorLibraries.Mul(ItemMoneyLibraries.PlatinumCoinColor, tint); string colorHex = MiscLibraries.RenderColorHex(color); render = "[c/" + colorHex + ":" + render + "]"; } rendered.Add(render); } if (denoms.gold != 0) { string render = denoms.gold.ToString(); if (addDenom) { render += " " + Language.GetTextValue("Currency.Gold"); //Lang.inter[16]; } if (addColors) { Color color = XNAColorLibraries.Mul(ItemMoneyLibraries.GoldCoinColor, tint); string colorHex = MiscLibraries.RenderColorHex(color); render = "[c/" + colorHex + ":" + render + "]"; } rendered.Add(render); } if (denoms.silver != 0) { string render = denoms.silver.ToString(); if (addDenom) { render += " " + Language.GetTextValue("Currency.Silver"); //Lang.inter[17]; } if (addColors) { Color color = XNAColorLibraries.Mul(ItemMoneyLibraries.SilverCoinColor, tint); string colorHex = MiscLibraries.RenderColorHex(color); render = "[c/" + colorHex + ":" + render + "]"; } rendered.Add(render); } if (denoms.copper != 0) { string render = denoms.copper.ToString(); if (addDenom) { render += " " + Language.GetTextValue("Currency.Copper"); //Lang.inter[18]; } if (addColors) { Color color = XNAColorLibraries.Mul(ItemMoneyLibraries.CopperCoinColor, tint); string colorHex = MiscLibraries.RenderColorHex(color); render = "[c/" + colorHex + ":" + render + "]"; } rendered.Add(render); } return(rendered.ToArray()); }
//////////////// /// <summary> /// Renders a color as a hex code string. /// </summary> /// <param name="color"></param> /// <returns></returns> public static string RenderHex(Color color) { return(MiscLibraries.RenderColorHex(color)); }