fix money duplication T-t

This commit is contained in:
SilicaAndPina 2021-02-12 14:04:27 +13:00
parent d4f2d8f69e
commit 8c43129303
4 changed files with 19 additions and 13 deletions

View file

@ -239,8 +239,14 @@
"cannot_improve":"^I258^T9This groomer cannot improve this horse's groom.^R1",
},
"farrier":{
"shoes_total":"^LYour horse %HORSENAME%: shoes currently %TOTAL%/%MAX%^R1",
"current_shoes":"^LYour horse %HORSENAME%: shoes currently %TOTAL%/%MAX%^R1",
"apply_iron":"^I255^T6Apply Iron Shoe for $%PRICE% (%INCBY%)^B3JI%HORSERANDOMID%^R1",
"apply_steel":"^I256^T6Apply Steel Shoe for $%PRICE% (%INCBY%)^B3JS%HORSERANDOMID%^R1",
"put_on_steel_shoes":"Your horse has had new Steel Horseshoes put on. Now shoes=%TOTAL%/%MAX%.",
"put_on_iron_shoes":"Your horse has had new Iron Horseshoes put on. Now shoes=%TOTAL%/%MAX%.",
"put_on_steel_all":"All your horses have had new Steel Horseshoes put on. Now shoes=%TOTAL%/%MAX%.",
"cant_afford_farrier":"You cannot afford the farrier's service!"
},
"vet":{
"service_horse":"^LYour horse %HORSENAME%: health currently %CURHEALTH%/%MAXHEALTH%^R1",

View file

@ -271,7 +271,7 @@ namespace HISP.Game
foreach (HorseInfo.Category category in HorseInfo.HorseCategories)
{
HorseInstance[] horsesInCategory = Database.GetPlayerHorsesInCategory(userId, category.Name);
HorseInstance[] horsesInCategory = Database.GetPlayerHorsesInCategory(userId, category.Name).OrderBy(o => o.Name).ToArray();
if (horsesInCategory.Length > 0)
{
message += category.MetaOthers;
@ -708,7 +708,7 @@ namespace HISP.Game
message += Messages.FormatExperience(user.Experience);
message += Messages.FormatHungryStat(Messages.FormatPlayerStat(SelectPlayerStatFormat(user.Hunger), Messages.StatHunger));
message += Messages.FormatThirstStat(Messages.FormatPlayerStat(SelectPlayerStatFormat(user.Thirst), Messages.StatThirst));
message += Messages.FormatTiredStat(Messages.FormatPlayerStat(SelectPlayerStatFormat(user.Thirst), Messages.StatTired));
message += Messages.FormatTiredStat(Messages.FormatPlayerStat(SelectPlayerStatFormat(user.Tiredness), Messages.StatTired));
message += Messages.FormatGenderStat(user.Gender);
message += Messages.FormatJewelryStat(buildWornJewelery(user));
message += Messages.FormatCompetitionGearStat(buildEquippedCompetitionGear(user));
@ -1106,10 +1106,9 @@ namespace HISP.Game
if (user.BankInterest > user.BankMoney)
{
moneyMade = user.BankInterest - user.BankMoney;
user.BankMoney = user.BankInterest;
user.BankMoney += moneyMade;
}
user.BankInterest = user.BankMoney;
string message = "";
moneyMade = Math.Floor(moneyMade);
@ -1505,7 +1504,7 @@ namespace HISP.Game
int i = 1;
foreach (HorseInfo.Category category in HorseInfo.HorseCategories)
{
HorseInstance[] horsesInCategory = user.HorseInventory.GetHorsesInCategory(category);
HorseInstance[] horsesInCategory = user.HorseInventory.GetHorsesInCategory(category).OrderBy(o => o.Name).ToArray();
if (horsesInCategory.Length > 0)
{
if (youView)

View file

@ -301,6 +301,7 @@ namespace HISP.Player
Database.SetPlayerBankMoney(value, Id);
bankMoney = value;
BankInterest = value;
}
}

View file

@ -1045,13 +1045,13 @@ namespace HISP.Server
if (dynamicInput.Length >= 2)
{
int moneyDeposited = 0;
int moneyWithdrawn = 0;
Int64 moneyWithdrawn = 0;
try
{
moneyDeposited = int.Parse(dynamicInput[1]);
moneyWithdrawn = int.Parse(dynamicInput[2]);
moneyWithdrawn = Int64.Parse(dynamicInput[2]);
}
catch (FormatException)
catch (Exception)
{
Logger.ErrorPrint(sender.LoggedinUser.Username + " tried to deposit/witthdraw NaN money....");
break;
@ -1066,12 +1066,12 @@ namespace HISP.Server
sender.SendPacket(chatPacket);
}
if ((Convert.ToUInt64(moneyWithdrawn) <= sender.LoggedinUser.BankMoney) && moneyWithdrawn != 0)
if ((moneyWithdrawn >= sender.LoggedinUser.BankMoney) && moneyWithdrawn != 0)
{
sender.LoggedinUser.BankMoney -= Convert.ToUInt64(moneyWithdrawn);
sender.LoggedinUser.Money += moneyWithdrawn;
sender.LoggedinUser.BankMoney -= moneyWithdrawn;
sender.LoggedinUser.Money += (int)moneyWithdrawn;
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatWithdrawMoneyMessage(moneyWithdrawn), PacketBuilder.CHAT_BOTTOM_RIGHT);
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatWithdrawMoneyMessage((int)moneyWithdrawn), PacketBuilder.CHAT_BOTTOM_RIGHT);
sender.SendPacket(chatPacket);
}