mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-10 07:05:41 +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
|
@ -224,6 +224,12 @@
|
||||||
"only_unicorn":"Only a ridden unicorn can respond to such a request.",
|
"only_unicorn":"Only a ridden unicorn can respond to such a request.",
|
||||||
"location_unknown":"Unicorn Failed to understand location or player name to warp to."
|
"location_unknown":"Unicorn Failed to understand location or player name to warp to."
|
||||||
},
|
},
|
||||||
|
"rules_isle":{
|
||||||
|
"x":17,
|
||||||
|
"y":17,
|
||||||
|
"message":"You have been sent to Review the game rules by a Moderator. Please take the time to seriously review the rules so you have a more enjoyable game experience. Your chat has been blocked for 20 minutes to help you focus on the rules.",
|
||||||
|
"command_msg":"<B>%USERNAME% muted for 20 minutes and Sent to Study Rules.</B>"
|
||||||
|
},
|
||||||
"mod_isle":{
|
"mod_isle":{
|
||||||
"x":165,
|
"x":165,
|
||||||
"y":465,
|
"y":465,
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace HISP.Game.Chat
|
||||||
return Command.Goto(message, args, user);
|
return Command.Goto(message, args, user);
|
||||||
if (message.ToUpper().StartsWith("%KICK"))
|
if (message.ToUpper().StartsWith("%KICK"))
|
||||||
return Command.Kick(message, args, user);
|
return Command.Kick(message, args, user);
|
||||||
|
if (message.ToUpper().StartsWith("%RULES"))
|
||||||
|
return Command.Rules(message, args, user);
|
||||||
if (message.ToUpper().StartsWith("%NOCLIP"))
|
if (message.ToUpper().StartsWith("%NOCLIP"))
|
||||||
return Command.NoClip(message, args, user);
|
return Command.NoClip(message, args, user);
|
||||||
if (message.ToUpper().StartsWith("%BAN"))
|
if (message.ToUpper().StartsWith("%BAN"))
|
||||||
|
|
|
@ -159,6 +159,31 @@ namespace HISP.Game.Chat
|
||||||
return true;
|
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)
|
public static bool Kick(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (!user.Administrator || !user.Moderator)
|
if (!user.Administrator || !user.Moderator)
|
||||||
|
@ -358,6 +383,9 @@ namespace HISP.Game.Chat
|
||||||
|
|
||||||
public static bool CallHorse(string message, string[] args, User user)
|
public static bool CallHorse(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
|
if (!user.Administrator)
|
||||||
|
return false;
|
||||||
|
|
||||||
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
string formattedmessage = Messages.FormatPlayerCommandCompleteMessage(message.Substring(1));
|
||||||
|
|
||||||
WildHorse horse = WildHorse.WildHorses[GameServer.RandomNumberGenerator.Next(0, WildHorse.WildHorses.Length)];
|
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)
|
if (rngEvent.Text.Contains("%HORSENAME%") && user.HorseInventory.HorseList.Length <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int moneyEarned = 0;
|
int moneyEarned = 0;
|
||||||
if (rngEvent.MinMoney != 0 || rngEvent.MaxMoney != 0)
|
if (rngEvent.MinMoney != 0 || rngEvent.MaxMoney != 0)
|
||||||
moneyEarned = GameServer.RandomNumberGenerator.Next(rngEvent.MinMoney, rngEvent.MaxMoney);
|
moneyEarned = GameServer.RandomNumberGenerator.Next(rngEvent.MinMoney, rngEvent.MaxMoney);
|
||||||
|
|
||||||
|
|
||||||
|
if (moneyEarned < 0)
|
||||||
|
if (user.Money + moneyEarned < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (rngEvent.GiveObject != 0)
|
if (rngEvent.GiveObject != 0)
|
||||||
user.Inventory.AddIgnoringFull(new ItemInstance(rngEvent.GiveObject));
|
user.Inventory.AddIgnoringFull(new ItemInstance(rngEvent.GiveObject));
|
||||||
|
|
||||||
|
|
||||||
if(moneyEarned != 0)
|
if(moneyEarned != 0)
|
||||||
user.AddMoney(moneyEarned);
|
user.AddMoney(moneyEarned);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,10 @@ namespace HISP.Game
|
||||||
|
|
||||||
public static int ModIsleX;
|
public static int ModIsleX;
|
||||||
public static int ModIsleY;
|
public static int ModIsleY;
|
||||||
|
|
||||||
|
public static int RulesIsleX;
|
||||||
|
public static int RulesIsleY;
|
||||||
|
|
||||||
public static int GetTileId(int x, int y, bool overlay)
|
public static int GetTileId(int x, int y, bool overlay)
|
||||||
{
|
{
|
||||||
int pos = ((x * Height) + y);
|
int pos = ((x * Height) + y);
|
||||||
|
@ -94,9 +98,6 @@ namespace HISP.Game
|
||||||
if (!passable && overlayPassable)
|
if (!passable && overlayPassable)
|
||||||
passable = true;
|
passable = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return passable;
|
return passable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,10 @@ namespace HISP.Game
|
||||||
public static string PlaytimeMessageFormat;
|
public static string PlaytimeMessageFormat;
|
||||||
public static string[] RngMessages;
|
public static string[] RngMessages;
|
||||||
|
|
||||||
|
// Rules Isle
|
||||||
|
public static string RulesIsleSentMessage;
|
||||||
|
public static string RulesIsleCommandMessageFormat;
|
||||||
|
|
||||||
// Mod
|
// Mod
|
||||||
public static string ModIsleMessage;
|
public static string ModIsleMessage;
|
||||||
public static string ModSplatterballEarnedYouFormat;
|
public static string ModSplatterballEarnedYouFormat;
|
||||||
|
@ -1244,6 +1248,12 @@ namespace HISP.Game
|
||||||
return EventWonRealTimeRiddleForYouFormat.Replace("%PRIZE%", prize.ToString("N0", CultureInfo.InvariantCulture));
|
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
|
// Mute Command
|
||||||
public static string FormatStoppedMutingPlayer(string username)
|
public static string FormatStoppedMutingPlayer(string username)
|
||||||
{
|
{
|
||||||
|
|
|
@ -968,6 +968,12 @@ namespace HISP.Server
|
||||||
Map.ModIsleX = gameData.messages.commands.mod_isle.x;
|
Map.ModIsleX = gameData.messages.commands.mod_isle.x;
|
||||||
Map.ModIsleY = gameData.messages.commands.mod_isle.y;
|
Map.ModIsleY = gameData.messages.commands.mod_isle.y;
|
||||||
|
|
||||||
|
// Rules Isle
|
||||||
|
Map.RulesIsleX = gameData.messages.commands.rules_isle.x;
|
||||||
|
Map.RulesIsleY = gameData.messages.commands.rules_isle.y;
|
||||||
|
Messages.RulesIsleSentMessage = gameData.messages.commands.rules_isle.message;
|
||||||
|
Messages.RulesIsleCommandMessageFormat = gameData.messages.commands.rules_isle.command_msg;
|
||||||
|
|
||||||
// Tag
|
// Tag
|
||||||
|
|
||||||
Messages.TagYourItFormat = gameData.messages.meta.player_interaction.tag.tag_player;
|
Messages.TagYourItFormat = gameData.messages.meta.player_interaction.tag.tag_player;
|
||||||
|
|
Loading…
Add table
Reference in a new issue