Compare commits
2 Commits
d82d672df6
...
ff41f79dd8
Author | SHA1 | Date | |
---|---|---|---|
ff41f79dd8 | |||
4e14f781d8 |
16
Credits.cs
16
Credits.cs
@ -3,13 +3,25 @@
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class Credits {
|
public class Credits {
|
||||||
public static string FormatCredits(int amount) {
|
public static string FormatCredits(int amount) {
|
||||||
|
return FormatCredits((long)amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatCredits(long amount) {
|
||||||
var format = new CultureInfo(CultureInfo.CurrentCulture.Name, true).NumberFormat;
|
var format = new CultureInfo(CultureInfo.CurrentCulture.Name, true).NumberFormat;
|
||||||
format.NumberGroupSeparator = ",";
|
format.NumberGroupSeparator = ",";
|
||||||
|
format.NumberDecimalSeparator = ".";
|
||||||
format.NumberGroupSizes = new int[1] { 3 };
|
format.NumberGroupSizes = new int[1] { 3 };
|
||||||
format.NumberDecimalDigits = 0;
|
format.NumberDecimalDigits = 1;
|
||||||
if (amount > 0 && (amount % 1000000) == 0) {
|
if (amount > 0 && (amount % 1000000000) == 0) {
|
||||||
|
amount /= 1000000000;
|
||||||
|
return string.Format("{0}M CR", amount.ToString("N", format));
|
||||||
|
} else if (amount > 0 && (amount % 1000000) == 0) {
|
||||||
amount /= 1000000;
|
amount /= 1000000;
|
||||||
return string.Format("{0}M CR", amount.ToString("N", format));
|
return string.Format("{0}M CR", amount.ToString("N", format));
|
||||||
|
} else if (amount > 0 && (amount % 100000) == 0) {
|
||||||
|
double am = ((double)amount) / 1000000;
|
||||||
|
format.NumberDecimalDigits = 1;
|
||||||
|
return string.Format("{0}M CR", am.ToString("N", format));
|
||||||
} else if (amount > 0 && (amount % 1000) == 0) {
|
} else if (amount > 0 && (amount % 1000) == 0) {
|
||||||
amount /= 1000;
|
amount /= 1000;
|
||||||
return string.Format("{0}K CR", amount.ToString("N", format));
|
return string.Format("{0}K CR", amount.ToString("N", format));
|
||||||
|
1
Entry.cs
1
Entry.cs
@ -29,6 +29,7 @@ namespace EDJournal {
|
|||||||
{ Events.MissionRedirected, typeof(MissionRedirectedEntry) },
|
{ Events.MissionRedirected, typeof(MissionRedirectedEntry) },
|
||||||
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
|
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
|
||||||
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
|
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
|
||||||
|
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) },
|
||||||
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
|
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
|
||||||
{ Events.ShieldState, typeof(ShieldStateEntry) },
|
{ Events.ShieldState, typeof(ShieldStateEntry) },
|
||||||
{ Events.ShipTargeted, typeof(ShipTargetedEntry) },
|
{ Events.ShipTargeted, typeof(ShipTargetedEntry) },
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
public static readonly string MissionRedirected = "MissionRedirected";
|
public static readonly string MissionRedirected = "MissionRedirected";
|
||||||
public static readonly string MultiSellExplorationData = "MultiSellExplorationData";
|
public static readonly string MultiSellExplorationData = "MultiSellExplorationData";
|
||||||
public static readonly string RedeemVoucher = "RedeemVoucher";
|
public static readonly string RedeemVoucher = "RedeemVoucher";
|
||||||
|
public static readonly string SellExplorationData = "SellExplorationData";
|
||||||
public static readonly string SellMicroResources = "SellMicroResources";
|
public static readonly string SellMicroResources = "SellMicroResources";
|
||||||
public static readonly string ShieldState = "ShieldState";
|
public static readonly string ShieldState = "ShieldState";
|
||||||
public static readonly string ShipTargeted = "ShipTargeted";
|
public static readonly string ShipTargeted = "ShipTargeted";
|
||||||
|
32
SellExplorationDataEntry.cs
Normal file
32
SellExplorationDataEntry.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace EDJournal {
|
||||||
|
public class SellExplorationDataEntry : Entry {
|
||||||
|
private List<string> systems = new List<string>();
|
||||||
|
private List<string> discovered = new List<string>();
|
||||||
|
public long BaseValue { get; set; }
|
||||||
|
public long Bonus { get; set; }
|
||||||
|
public long TotalEarnings { get; set; }
|
||||||
|
|
||||||
|
public List<string> Systems => systems;
|
||||||
|
public List<string> Discovered => discovered;
|
||||||
|
|
||||||
|
protected override void Initialise() {
|
||||||
|
BaseValue = JSON.Value<long?>("BaseValue") ?? 0;
|
||||||
|
Bonus = JSON.Value<long?>("Bonus") ?? 0;
|
||||||
|
TotalEarnings = JSON.Value<long?>("TotalEarnings") ?? 0;
|
||||||
|
|
||||||
|
var sys = JSON.Value<JArray>("Systems");
|
||||||
|
if (sys != null) {
|
||||||
|
systems = sys.Select(x => x.ToString()).ToList<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var dis = JSON.Value<JArray>("Discovered");
|
||||||
|
if (dis != null) {
|
||||||
|
discovered = dis.Select(x => x.ToString()).ToList<string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -68,6 +68,7 @@
|
|||||||
<Compile Include="PlayerJournal.cs" />
|
<Compile Include="PlayerJournal.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="RedeemVoucherEntry.cs" />
|
<Compile Include="RedeemVoucherEntry.cs" />
|
||||||
|
<Compile Include="SellExplorationDataEntry.cs" />
|
||||||
<Compile Include="SellMicroResourcesEntry.cs" />
|
<Compile Include="SellMicroResourcesEntry.cs" />
|
||||||
<Compile Include="ShieldStateEntry.cs" />
|
<Compile Include="ShieldStateEntry.cs" />
|
||||||
<Compile Include="ShipTargetedEntry.cs" />
|
<Compile Include="ShipTargetedEntry.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user