Changes to new Gold Ledger system (#3)
Changes new gold system to use separate gold/platinum with DivRem instead of relying on doubles.
This commit is contained in:
parent
1030bb7675
commit
d8ed7c1da9
7 changed files with 68 additions and 438 deletions
|
|
@ -134,9 +134,8 @@ namespace Server.Items
|
|||
{
|
||||
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
|
||||
{
|
||||
var total = Worth / Math.Max(1.0, Account.CurrencyThreshold);
|
||||
var plat = (int)Math.Truncate(total);
|
||||
var gold = (int)((total - plat) * Account.CurrencyThreshold);
|
||||
int gold;
|
||||
int plat = Math.DivRem(Worth, AccountGold.CurrencyThreshold, out gold);
|
||||
|
||||
tradeInfo.Plat += plat;
|
||||
tradeInfo.Gold += gold;
|
||||
|
|
@ -268,4 +267,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,9 +103,8 @@ namespace Server.Items
|
|||
{
|
||||
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
|
||||
{
|
||||
var total = Amount / Math.Max(1.0, Account.CurrencyThreshold);
|
||||
var plat = (int)Math.Truncate(total);
|
||||
var gold = (int)((total - plat) * Account.CurrencyThreshold);
|
||||
int gold;
|
||||
int plat = Math.DivRem(Amount, AccountGold.CurrencyThreshold, out gold);
|
||||
|
||||
tradeInfo.Plat += plat;
|
||||
tradeInfo.Gold += gold;
|
||||
|
|
@ -148,4 +147,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue