Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ValueToCoins()

static string Terraria.Main.ValueToCoins ( long value)
inlinestatic

Definition at line 52286 of file Main.cs.

52287 {
52288 long num = value;
52289 long num2 = 0L;
52290 long num3 = 0L;
52291 long num4 = 0L;
52292 long num5 = 0L;
52293 while (num >= 1000000)
52294 {
52295 num -= 1000000;
52296 num2++;
52297 }
52298 while (num >= 10000)
52299 {
52300 num -= 10000;
52301 num3++;
52302 }
52303 while (num >= 100)
52304 {
52305 num -= 100;
52306 num4++;
52307 }
52308 num5 = num;
52309 string text = "";
52310 if (num2 > 0)
52311 {
52312 text += string.Format("{0} {1} ", num2, Language.GetTextValue("Currency.Platinum").ToLower());
52313 }
52314 if (num3 > 0)
52315 {
52316 text += string.Format("{0} {1} ", num3, Language.GetTextValue("Currency.Gold").ToLower());
52317 }
52318 if (num4 > 0)
52319 {
52320 text += string.Format("{0} {1} ", num4, Language.GetTextValue("Currency.Silver").ToLower());
52321 }
52322 if (num5 > 0)
52323 {
52324 text += string.Format("{0} {1} ", num5, Language.GetTextValue("Currency.Copper").ToLower());
52325 }
52326 if (text.Length > 0)
52327 {
52328 text = text.Substring(0, text.Length - 1);
52329 }
52330 return text;
52331 }
static string GetTextValue(string key)
Definition Language.cs:15

References Terraria.Localization.Language.GetTextValue(), System.L, System.text, and System.value.

Referenced by Terraria.Player.DropCoins(), and Terraria.Player.KillMe().