add %RULES command, fix bugs in random events

This commit is contained in:
SilicaAndPina 2021-05-14 12:18:11 +12:00
parent e600554555
commit 1ad0783f8f
7 changed files with 62 additions and 4 deletions

View file

@ -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);