mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 21:55:42 +12:00
Add %SHUTDOWN command
This commit is contained in:
parent
0df62c80c6
commit
0fc3582ae1
6 changed files with 40 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit d44f6107e607e3e23c137f4678235c12965af533
|
Subproject commit 9540f98ef9180dca80bcb27599e939a767ba92eb
|
|
@ -116,6 +116,8 @@ namespace HISP.Game.Chat
|
||||||
return Command.ModHorse(message, args, user);
|
return Command.ModHorse(message, args, user);
|
||||||
if (message.ToUpper().StartsWith("%DELITEM"))
|
if (message.ToUpper().StartsWith("%DELITEM"))
|
||||||
return Command.DelItem(message, args, user);
|
return Command.DelItem(message, args, user);
|
||||||
|
if (message.ToUpper().StartsWith("%SHUTDOWN"))
|
||||||
|
return Command.Shutdown(message, args, user);
|
||||||
if (message.ToUpper().StartsWith("%CALL HORSE"))
|
if (message.ToUpper().StartsWith("%CALL HORSE"))
|
||||||
return Command.CallHorse(message, args, user);
|
return Command.CallHorse(message, args, user);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,6 +30,38 @@ namespace HISP.Game.Chat
|
||||||
throw new KeyNotFoundException("name not found");
|
throw new KeyNotFoundException("name not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool Shutdown(string message, string[] args, User user)
|
||||||
|
{
|
||||||
|
if (!user.Administrator)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach(GameClient client in GameClient.ConnectedClients)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (client.LoggedIn)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
ItemInstance rubyItem = new ItemInstance(Item.Ruby);
|
||||||
|
client.LoggedinUser.Inventory.AddIgnoringFull(rubyItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.Kick("Server was closed by an Administrator.");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception) { };
|
||||||
|
|
||||||
|
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message.Substring(1)), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||||
|
user.LoggedinClient.SendPacket(chatPacket);
|
||||||
|
Program.ShuttingDown = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
public static bool Give(string message, string[] args, User user)
|
public static bool Give(string message, string[] args, User user)
|
||||||
{
|
{
|
||||||
if (args.Length <= 0)
|
if (args.Length <= 0)
|
||||||
|
@ -390,7 +422,7 @@ namespace HISP.Game.Chat
|
||||||
|
|
||||||
foreach (ItemInstance instance in itm.ItemInstances)
|
foreach (ItemInstance instance in itm.ItemInstances)
|
||||||
{
|
{
|
||||||
itm.RemoveItem(instance);
|
target.Inventory.Remove(instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,7 @@ namespace HISP.Game.Items
|
||||||
public static int BirthdayToken;
|
public static int BirthdayToken;
|
||||||
public static int MagicBean;
|
public static int MagicBean;
|
||||||
public static int MagicDroplet;
|
public static int MagicDroplet;
|
||||||
|
public static int Ruby;
|
||||||
|
|
||||||
public static int StallionTradingCard;
|
public static int StallionTradingCard;
|
||||||
public static int MareTradingCard;
|
public static int MareTradingCard;
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace HISP
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
public static bool ShuttingDown = false;
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
#if (!DEBUG)
|
#if (!DEBUG)
|
||||||
|
@ -54,7 +55,7 @@ namespace HISP
|
||||||
Logger.ErrorPrint("");
|
Logger.ErrorPrint("");
|
||||||
Logger.ErrorPrint(execpt.StackTrace);
|
Logger.ErrorPrint(execpt.StackTrace);
|
||||||
|
|
||||||
while (true) { };
|
while (!ShuttingDown) { /*Allow asyncronous operations to happen.*/ };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -903,6 +903,7 @@ namespace HISP.Server
|
||||||
Item.ModSplatterball = gameData.item.special.mod_splatterball;
|
Item.ModSplatterball = gameData.item.special.mod_splatterball;
|
||||||
Item.MagicBean = gameData.item.special.magic_bean;
|
Item.MagicBean = gameData.item.special.magic_bean;
|
||||||
Item.MagicDroplet = gameData.item.special.magic_droplet;
|
Item.MagicDroplet = gameData.item.special.magic_droplet;
|
||||||
|
Item.Ruby = gameData.item.special.ruby;
|
||||||
|
|
||||||
Item.StallionTradingCard = gameData.item.special.stallion_trading_card;
|
Item.StallionTradingCard = gameData.item.special.stallion_trading_card;
|
||||||
Item.MareTradingCard = gameData.item.special.mare_trading_card;
|
Item.MareTradingCard = gameData.item.special.mare_trading_card;
|
||||||
|
|
Loading…
Add table
Reference in a new issue