mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-21 20:25: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
|
@ -61,6 +61,8 @@ namespace HISP.Game.Chat
|
|||
return Command.Goto(message, args, user);
|
||||
if (message.ToUpper().StartsWith("%KICK"))
|
||||
return Command.Kick(message, args, user);
|
||||
if (message.ToUpper().StartsWith("%RULES"))
|
||||
return Command.Rules(message, args, user);
|
||||
if (message.ToUpper().StartsWith("%NOCLIP"))
|
||||
return Command.NoClip(message, args, user);
|
||||
if (message.ToUpper().StartsWith("%BAN"))
|
||||
|
|
|
@ -159,6 +159,31 @@ namespace HISP.Game.Chat
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool Rules(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator || !user.Moderator)
|
||||
return false;
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
User toSend = GameServer.GetUserByName(args[0]);
|
||||
|
||||
toSend.Teleport(Map.RulesIsleX, Map.RulesIsleY);
|
||||
byte[] studyTheRulesMsg = PacketBuilder.CreateChat(Messages.RulesIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
toSend.LoggedinClient.SendPacket(studyTheRulesMsg);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1))+Messages.FormatRulesCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Kick(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator || !user.Moderator)
|
||||
|
@ -358,6 +383,9 @@ namespace HISP.Game.Chat
|
|||
|
||||
public static bool CallHorse(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
||||
|
||||
WildHorse horse = WildHorse.WildHorses[GameServer.RandomNumberGenerator.Next(0, WildHorse.WildHorses.Length)];
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ namespace HISP.Game
|
|||
|
||||
public static int ModIsleX;
|
||||
public static int ModIsleY;
|
||||
|
||||
public static int RulesIsleX;
|
||||
public static int RulesIsleY;
|
||||
|
||||
public static int GetTileId(int x, int y, bool overlay)
|
||||
{
|
||||
int pos = ((x * Height) + y);
|
||||
|
@ -94,9 +98,6 @@ namespace HISP.Game
|
|||
if (!passable && overlayPassable)
|
||||
passable = true;
|
||||
|
||||
|
||||
|
||||
|
||||
return passable;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@ namespace HISP.Game
|
|||
public static string PlaytimeMessageFormat;
|
||||
public static string[] RngMessages;
|
||||
|
||||
// Rules Isle
|
||||
public static string RulesIsleSentMessage;
|
||||
public static string RulesIsleCommandMessageFormat;
|
||||
|
||||
// Mod
|
||||
public static string ModIsleMessage;
|
||||
public static string ModSplatterballEarnedYouFormat;
|
||||
|
@ -1244,6 +1248,12 @@ namespace HISP.Game
|
|||
return EventWonRealTimeRiddleForYouFormat.Replace("%PRIZE%", prize.ToString("N0", CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
// Rules Command
|
||||
public static string FormatRulesCommandMessage(string username)
|
||||
{
|
||||
return RulesIsleCommandMessageFormat.Replace("%USERNAME%", username.ToUpper());
|
||||
}
|
||||
|
||||
// Mute Command
|
||||
public static string FormatStoppedMutingPlayer(string username)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue