shorten credits with K/M suffixes
This commit is contained in:
		
							parent
							
								
									64fe83a0db
								
							
						
					
					
						commit
						9f3632650f
					
				| @ -26,7 +26,7 @@ namespace NonaBGS.BGS { | ||||
| 
 | ||||
|         public override string ToString() { | ||||
|             StringBuilder builder = new StringBuilder(); | ||||
|             builder.AppendFormat("Sold {0} CR worth of Cartographics Data", TotalSum); | ||||
|             builder.AppendFormat("Sold {0} worth of Cartographics Data", Credits.FormatCredits(TotalSum)); | ||||
|             return builder.ToString(); | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -22,7 +22,7 @@ namespace NonaBGS.BGS { | ||||
|         } | ||||
| 
 | ||||
|         public override string ToString() { | ||||
|             return string.Format("Sell Micro Resources: {0} CR", TotalSum); | ||||
|             return string.Format("Sell Micro Resources: {0}", Credits.FormatCredits(TotalSum)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -31,7 +31,7 @@ namespace NonaBGS.BGS { | ||||
|         public override string ToString() { | ||||
|             StringBuilder builder = new StringBuilder(); | ||||
| 
 | ||||
|             builder.AppendFormat("{0} Vouchers: {1} CR", TotalSum, Type); | ||||
|             builder.AppendFormat("{0} Vouchers: {1}", Type, Credits.FormatCredits(TotalSum)); | ||||
| 
 | ||||
|             return builder.ToString(); | ||||
|         } | ||||
|  | ||||
							
								
								
									
										21
									
								
								Journal/Credits.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								Journal/Credits.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| 
 | ||||
| namespace NonaBGS.Journal { | ||||
|     public class Credits { | ||||
|         public static string FormatCredits(int amount) { | ||||
|             if ((amount % 1000000) == 0) { | ||||
|                 amount /= 1000000; | ||||
|                 return string.Format("{0}M CR", amount); | ||||
|             } else if ((amount % 1000) == 0) { | ||||
|                 amount /= 1000; | ||||
|                 return string.Format("{0}K CR", amount); | ||||
|             } | ||||
| 
 | ||||
|             return string.Format("{0} CR", amount); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -101,7 +101,7 @@ namespace NonaBGS.Journal { | ||||
|             } | ||||
| 
 | ||||
|             if (donated > 0) { | ||||
|                 builder.AppendFormat(" ({0} CR)", donated); | ||||
|                 builder.AppendFormat(" ({0})", Credits.FormatCredits(donated)); | ||||
|             } | ||||
| 
 | ||||
|             readable_name = builder.ToString().Trim(); | ||||
|  | ||||
| @ -75,6 +75,7 @@ | ||||
|     <Compile Include="BGS\SellMicroResources.cs" /> | ||||
|     <Compile Include="EDDB\PopulatedSystems.cs" /> | ||||
|     <Compile Include="EDDB\Stations.cs" /> | ||||
|     <Compile Include="Journal\Credits.cs" /> | ||||
|     <Compile Include="Journal\EliteDangerous.cs" /> | ||||
|     <Compile Include="Journal\MarketSellEntry.cs" /> | ||||
|     <Compile Include="Journal\MultiSellExplorationDataEntry.cs" /> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user