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

◆ ValueToName() [2/2]

static string Terraria.PopupText.ValueToName ( long coinValue)
inlinestatic

Converts a value in copper coins to a formatted string.

Parameters
coinValueThe value to format in copper coins.
Returns
The formatted text.

Definition at line 693 of file PopupText.cs.

694 {
695 int num = 0;
696 int num2 = 0;
697 int num3 = 0;
698 int num4 = 0;
699 string text = "";
700 long num5 = coinValue;
701 while (num5 > 0)
702 {
703 if (num5 >= 1000000)
704 {
705 num5 -= 1000000;
706 num++;
707 }
708 else if (num5 >= 10000)
709 {
710 num5 -= 10000;
711 num2++;
712 }
713 else if (num5 >= 100)
714 {
715 num5 -= 100;
716 num3++;
717 }
718 else if (num5 >= 1)
719 {
720 num5--;
721 num4++;
722 }
723 }
724 text = "";
725 if (num > 0)
726 {
727 text = text + num + string.Format(" {0} ", Language.GetTextValue("Currency.Platinum"));
728 }
729 if (num2 > 0)
730 {
731 text = text + num2 + string.Format(" {0} ", Language.GetTextValue("Currency.Gold"));
732 }
733 if (num3 > 0)
734 {
735 text = text + num3 + string.Format(" {0} ", Language.GetTextValue("Currency.Silver"));
736 }
737 if (num4 > 0)
738 {
739 text = text + num4 + string.Format(" {0} ", Language.GetTextValue("Currency.Copper"));
740 }
741 if (text.Length > 1)
742 {
743 text = text.Substring(0, text.Length - 1);
744 }
745 return text;
746 }
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
long coinValue
The value of coins this T:Terraria.PopupText represents in the range [0, 999999999].
Definition PopupText.cs:100

References Terraria.PopupText.coinValue, and Terraria.Localization.Language.GetTextValue().

+ Here is the call graph for this function: