mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-24 05:35:51 +12:00
add %RULES command, fix bugs in random events
This commit is contained in:
parent
e600554555
commit
1ad0783f8f
7 changed files with 62 additions and 4 deletions
|
@ -26,14 +26,19 @@ namespace HISP.Game.Events
|
|||
if (rngEvent.Text.Contains("%HORSENAME%") && user.HorseInventory.HorseList.Length <= 0)
|
||||
continue;
|
||||
|
||||
int moneyEarned = 0;
|
||||
int moneyEarned = 0;
|
||||
if (rngEvent.MinMoney != 0 || rngEvent.MaxMoney != 0)
|
||||
moneyEarned = GameServer.RandomNumberGenerator.Next(rngEvent.MinMoney, rngEvent.MaxMoney);
|
||||
|
||||
|
||||
if (moneyEarned < 0)
|
||||
if (user.Money + moneyEarned < 0)
|
||||
continue;
|
||||
|
||||
if (rngEvent.GiveObject != 0)
|
||||
user.Inventory.AddIgnoringFull(new ItemInstance(rngEvent.GiveObject));
|
||||
|
||||
|
||||
if(moneyEarned != 0)
|
||||
user.AddMoney(moneyEarned);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue