mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-23 13:15:53 +12:00
fix money related bugs and crashes.
This commit is contained in:
parent
99d9b401a2
commit
e600554555
21 changed files with 151 additions and 83 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue