fix money related bugs and crashes.

This commit is contained in:
SilicaAndPina 2021-05-14 11:38:04 +12:00
parent 99d9b401a2
commit e600554555
21 changed files with 151 additions and 83 deletions

View file

@ -110,6 +110,30 @@ namespace HISP.Player
public bool ListingAuction = false;
public int TotalGlobalChatMessages = 1;
public void TakeMoney(int amount)
{
money -= amount;
Database.SetPlayerMoney(money, Id);
GameServer.UpdatePlayer(LoggedinClient);
}
public void AddMoney(int amount)
{
try
{
checked
{
money += amount;
}
}
catch(OverflowException)
{
money = 2147483647;
}
Database.SetPlayerMoney(money, Id);
GameServer.UpdatePlayer(LoggedinClient);
}
public string GetWeatherSeen()
{
string weather = "SUNNY";
@ -256,25 +280,6 @@ namespace HISP.Player
{
return money;
}
set
{
try
{
checked
{
money = value;
Database.SetPlayerMoney(value, Id);
GameServer.UpdatePlayer(LoggedinClient);
}
}
catch(OverflowException)
{
money = 2147483647;
Database.SetPlayerMoney(2147483647, Id);
GameServer.UpdatePlayer(LoggedinClient);
}
}
}