mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 05:05:40 +12:00
Improve command system, add HELP command,
This commit is contained in:
parent
a2782fd35e
commit
9e69492e46
39 changed files with 1865 additions and 1620 deletions
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.8.58.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.58.0")]
|
||||
[assembly: AssemblyVersion("1.8.59.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.59.0")]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: hisp
|
||||
Version: 1.8.58
|
||||
Version: 1.8.59
|
||||
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
|
||||
Maintainer: Li
|
||||
Homepage: https://islehorse.com
|
||||
|
|
|
@ -203,8 +203,8 @@ namespace HISP.Game
|
|||
byte[] startingUpEventPacket = PacketBuilder.CreateChat(message, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swf, PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
Logger.DebugPrint(entry.EnteredUser.Username + " Loading swf: " + swf);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(swfModulePacket);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(startingUpEventPacket);
|
||||
entry.EnteredUser.Client.SendPacket(swfModulePacket);
|
||||
entry.EnteredUser.Client.SendPacket(startingUpEventPacket);
|
||||
}
|
||||
|
||||
arenaTimeout = new Timer(new TimerCallback(arenaTimedOut), null, Timeout * 60 * 1000, Timeout * 60 * 1000);
|
||||
|
@ -275,7 +275,7 @@ namespace HISP.Game
|
|||
try
|
||||
{
|
||||
byte[] arenaResults = PacketBuilder.CreateChat(chatMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(arenaResults);
|
||||
entry.EnteredUser.Client.SendPacket(arenaResults);
|
||||
|
||||
int expReward = expRewards[place];
|
||||
|
||||
|
@ -289,7 +289,7 @@ namespace HISP.Game
|
|||
|
||||
|
||||
byte[] youWinMessage = PacketBuilder.CreateChat(Messages.FormatArenaYouWinMessage(prize, expReward), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(youWinMessage);
|
||||
entry.EnteredUser.Client.SendPacket(youWinMessage);
|
||||
|
||||
// Awards:
|
||||
|
||||
|
@ -327,7 +327,7 @@ namespace HISP.Game
|
|||
entry.EnteredUser.Awards.AddAward(Award.GetAwardById(32)); // Perseverance
|
||||
|
||||
byte[] youDONTWinMessage = PacketBuilder.CreateChat(Messages.FormatArenaOnlyWinnerWinsMessage(expReward), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(youDONTWinMessage);
|
||||
entry.EnteredUser.Client.SendPacket(youDONTWinMessage);
|
||||
}
|
||||
place++;
|
||||
}
|
||||
|
@ -361,8 +361,8 @@ namespace HISP.Game
|
|||
if (Entries.Length + 1 > Slots)
|
||||
{
|
||||
byte[] enterFailed = PacketBuilder.CreateChat(Messages.ArenaFullErrorMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(enterFailed);
|
||||
GameServer.UpdateArea(user.LoggedinClient);
|
||||
user.Client.SendPacket(enterFailed);
|
||||
GameServer.UpdateArea(user.Client);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ namespace HISP.Game
|
|||
user.TakeMoney(EntryCost);
|
||||
|
||||
byte[] enteredIntoCompetition = PacketBuilder.CreateChat(Messages.ArenaEnteredInto, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(enteredIntoCompetition);
|
||||
user.Client.SendPacket(enteredIntoCompetition);
|
||||
GameServer.UpdateAreaForAll(user.X, user.Y, true);
|
||||
|
||||
return;
|
||||
|
|
42
HorseIsleServer/LibHISP/Game/Chat/Chat.cs → HorseIsleServer/LibHISP/Game/Chat/ChatMsg.cs
Executable file → Normal file
42
HorseIsleServer/LibHISP/Game/Chat/Chat.cs → HorseIsleServer/LibHISP/Game/Chat/ChatMsg.cs
Executable file → Normal file
|
@ -8,7 +8,7 @@ using HISP.Server;
|
|||
|
||||
namespace HISP.Game.Chat
|
||||
{
|
||||
public class Chat
|
||||
public class ChatMsg
|
||||
{
|
||||
public struct Correction
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ namespace HISP.Game.Chat
|
|||
if (parsedMessage.ToUpper(CultureInfo.InvariantCulture).StartsWith(cmd.CmdName))
|
||||
{
|
||||
string[] args = parsedMessage.Substring(cmd.CmdName.Length).Trim().Split(' ');
|
||||
return cmd.CmdCallback(messageToGive, args, user);
|
||||
return cmd.Execute(messageToGive, args, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,9 +197,9 @@ namespace HISP.Game.Chat
|
|||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (!client.LoggedinUser.MuteGlobal && !client.LoggedinUser.MuteAll)
|
||||
if (client.LoggedinUser.Id != user.Id)
|
||||
if(!client.LoggedinUser.MutePlayer.IsUserMuted(user))
|
||||
if (!client.User.MuteGlobal && !client.User.MuteAll)
|
||||
if (client.User.Id != user.Id)
|
||||
if(!client.User.MutePlayer.IsUserMuted(user))
|
||||
recipiants.Add(client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
|
@ -211,9 +211,9 @@ namespace HISP.Game.Chat
|
|||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (!client.LoggedinUser.MuteAds && !client.LoggedinUser.MuteAll)
|
||||
if (client.LoggedinUser.Id != user.Id)
|
||||
if (!client.LoggedinUser.MutePlayer.IsUserMuted(user))
|
||||
if (!client.User.MuteAds && !client.User.MuteAll)
|
||||
if (client.User.Id != user.Id)
|
||||
if (!client.User.MutePlayer.IsUserMuted(user))
|
||||
recipiants.Add(client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
|
@ -225,10 +225,10 @@ namespace HISP.Game.Chat
|
|||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (!client.LoggedinUser.MuteBuddy && !client.LoggedinUser.MuteAll)
|
||||
if (client.LoggedinUser.Id != user.Id)
|
||||
if (client.LoggedinUser.Friends.List.Contains(user.Id))
|
||||
if (!client.LoggedinUser.MutePlayer.IsUserMuted(user))
|
||||
if (!client.User.MuteBuddy && !client.User.MuteAll)
|
||||
if (client.User.Id != user.Id)
|
||||
if (client.User.Friends.List.Contains(user.Id))
|
||||
if (!client.User.MutePlayer.IsUserMuted(user))
|
||||
recipiants.Add(client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
|
@ -245,7 +245,7 @@ namespace HISP.Game.Chat
|
|||
if (user.Id != userInIsle.Id)
|
||||
if(!userInIsle.MuteAll && !userInIsle.MuteIsland)
|
||||
if(!userInIsle.MutePlayer.IsUserMuted(user))
|
||||
recipiants.Add(userInIsle.LoggedinClient);
|
||||
recipiants.Add(userInIsle.Client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ namespace HISP.Game.Chat
|
|||
if (user.Id != userHere.Id)
|
||||
if (!userHere.MuteAll && !userHere.MuteHere)
|
||||
if (!userHere.MutePlayer.IsUserMuted(user))
|
||||
recipiants.Add(userHere.LoggedinClient);
|
||||
recipiants.Add(userHere.Client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ namespace HISP.Game.Chat
|
|||
if (user.Id != nearbyUser.Id)
|
||||
if (!nearbyUser.MuteAll && !nearbyUser.MuteNear)
|
||||
if (!nearbyUser.MutePlayer.IsUserMuted(user))
|
||||
recipiants.Add(nearbyUser.LoggedinClient);
|
||||
recipiants.Add(nearbyUser.Client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
}
|
||||
|
@ -296,8 +296,8 @@ namespace HISP.Game.Chat
|
|||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (client.LoggedinUser.Moderator)
|
||||
if (client.LoggedinUser.Id != user.Id)
|
||||
if (client.User.Moderator)
|
||||
if (client.User.Id != user.Id)
|
||||
recipiants.Add(client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
|
@ -316,8 +316,8 @@ namespace HISP.Game.Chat
|
|||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (client.LoggedinUser.Administrator)
|
||||
if (client.LoggedinUser.Id != user.Id)
|
||||
if (client.User.Administrator)
|
||||
if (client.User.Id != user.Id)
|
||||
recipiants.Add(client);
|
||||
}
|
||||
return recipiants.ToArray();
|
||||
|
@ -332,9 +332,9 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
if (client.LoggedIn)
|
||||
{
|
||||
if (!client.LoggedinUser.MutePrivateMessage && !client.LoggedinUser.MuteAll)
|
||||
if (!client.User.MutePrivateMessage && !client.User.MuteAll)
|
||||
{
|
||||
if (client.LoggedinUser.Username.ToLower().StartsWith(to.ToLower()))
|
||||
if (client.User.Username.ToLower().StartsWith(to.ToLower()))
|
||||
{
|
||||
recipiants.Add(client);
|
||||
break;
|
|
@ -8,6 +8,7 @@ using HISP.Game.Inventory;
|
|||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace HISP.Game.Chat
|
||||
{
|
||||
|
@ -21,9 +22,9 @@ namespace HISP.Game.Chat
|
|||
continue;
|
||||
if (client.LoggedIn)
|
||||
{
|
||||
if (client.LoggedinUser.Username.ToLower().StartsWith(name.ToLower()))
|
||||
if (client.User.Username.ToLower().StartsWith(name.ToLower()))
|
||||
{
|
||||
return client.LoggedinUser;
|
||||
return client.User;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,41 +34,124 @@ namespace HISP.Game.Chat
|
|||
public static void RegisterCommands()
|
||||
{
|
||||
// Admin Commands
|
||||
new CommandRegister('%', "GIVE", "OBJECT <itemid / RANDOM> [username / ALL]\nMONEY <amount> [username]\nHORSE <breedid> [username]\nQUEST <questid> [FORCE]\nAWARD <awardid> [username]", Command.Give);
|
||||
new CommandRegister('%', "SWF", "<swf> [username / ALL]", Command.Swf);
|
||||
new CommandRegister('%', "GOTO", "<x>,<y>\nPLAYER <playername>\nAREA <locationname>\nNPC <npcname>", Command.Goto);
|
||||
new CommandRegister('%', "JUMP", "<username> HERE", Command.Jump);
|
||||
new CommandRegister('%', "KICK" , "<username> [reason]", Command.Kick);
|
||||
new CommandRegister('%', "NOCLIP", "", Command.NoClip);
|
||||
new CommandRegister('%', "MODHORSE", "<slot id> <stat> <value>", Command.ModHorse);
|
||||
new CommandRegister('%', "DELITEM", "<item id> [username]", Command.DelItem);
|
||||
new CommandRegister('%', "SHUTDOWN", "", Command.Shutdown);
|
||||
new CommandRegister('%', "CALL", "HORSE", Command.CallHorse);
|
||||
new CommandRegister('%', "MESSAGE", "<message>", Command.Message);
|
||||
new CommandRegister('%', "GIVE", "OBJECT <itemid / RANDOM> [username / ALL]\nMONEY <amount> [username]\nHORSE <breedid> [username]\nQUEST <questid> [FORCE]\nAWARD <awardid> [username]", Command.Give, true, false);
|
||||
new CommandRegister('%', "SWF", "<swf> [username / ALL]", Command.Swf, true, false);
|
||||
new CommandRegister('%', "GOTO", "<x>,<y>\nPLAYER <playername>\nAREA <locationname>\nNPC <npcname>", Command.Goto, true, false);
|
||||
new CommandRegister('%', "JUMP", "<username> HERE", Command.Jump, true, false);
|
||||
new CommandRegister('%', "NOCLIP", "", Command.NoClip, true, false);
|
||||
new CommandRegister('%', "MODHORSE", "<slot id> <stat> <value>", Command.ModHorse, true, false);
|
||||
new CommandRegister('%', "DELITEM", "<item id> [username]", Command.DelItem, true, false);
|
||||
new CommandRegister('%', "SHUTDOWN", "", Command.Shutdown, true, false);
|
||||
new CommandRegister('%', "CALL", "HORSE", Command.CallHorse, true, false);
|
||||
new CommandRegister('%', "MESSAGE", "<message>", Command.Message, true, false);
|
||||
new CommandRegister('%', "PERMISSION", "<username> <admin / moderator / normal>", Command.Permission, true, false);
|
||||
|
||||
// Moderator commands
|
||||
new CommandRegister('%', "RULES", "<username>", Command.Rules);
|
||||
new CommandRegister('%', "PRISON", "<username>", Command.Prison);
|
||||
new CommandRegister('%', "STEALTH", "", Command.Stealth);
|
||||
new CommandRegister('%', "BAN", "<username> [reason]", Command.Ban);
|
||||
new CommandRegister('%', "UNBAN", "<username>", Command.UnBan);
|
||||
new CommandRegister('%', "ESCAPE", "", Command.Escape);
|
||||
new CommandRegister('%', "RULES", "<username>", Command.Rules, false, true);
|
||||
new CommandRegister('%', "PRISON", "<username>", Command.Prison, false, true);
|
||||
new CommandRegister('%', "STEALTH", "", Command.Stealth, false, true);
|
||||
new CommandRegister('%', "KICK", "<username> [reason]", Command.Kick, false, true);
|
||||
new CommandRegister('%', "BAN", "<username> [reason]", Command.Ban, false, true);
|
||||
new CommandRegister('%', "UNBAN", "<username>", Command.UnBan, false, true);
|
||||
new CommandRegister('%', "ESCAPE", "", Command.Escape, false, true);
|
||||
|
||||
// User commands
|
||||
new CommandRegister('!', "MUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.Mute);
|
||||
new CommandRegister('!', "UNMUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute);
|
||||
new CommandRegister('!', "HEAR", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute);
|
||||
new CommandRegister('!', "AUTOREPLY", "[message]", Command.AutoReply);
|
||||
new CommandRegister('!', "QUIZ", "", Command.Quiz);
|
||||
new CommandRegister('!', "WARP", "<username / location>", Command.Warp);
|
||||
new CommandRegister('!', "DANCE", "<udlr>", Command.Dance);
|
||||
new CommandRegister('!', "VERSION", "", Command.Version);
|
||||
new CommandRegister('%', "VERSION", "", Command.Version, false, false);
|
||||
new CommandRegister('%', "HELP", "", Command.Help, false, false);
|
||||
|
||||
new CommandRegister('!', "MUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.Mute, false, false);
|
||||
new CommandRegister('!', "UNMUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute, false, false);
|
||||
new CommandRegister('!', "HEAR", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute, false, false);
|
||||
new CommandRegister('!', "AUTOREPLY", "[message]", Command.AutoReply, false, false);
|
||||
new CommandRegister('!', "QUIZ", "", Command.Quiz, false, false);
|
||||
new CommandRegister('!', "WARP", "<username / location>", Command.Warp, false, false);
|
||||
new CommandRegister('!', "DANCE", "<udlr>", Command.Dance, false, false);
|
||||
}
|
||||
|
||||
public static bool Help(string message, string[] args, User user)
|
||||
{
|
||||
|
||||
foreach (CommandRegister cmd in CommandRegister.RegisteredCommands)
|
||||
{
|
||||
if (!cmd.HasPermission(user)) continue;
|
||||
|
||||
user.Client.SendPacket(PacketBuilder.CreateChat(Messages.FormatHispHelpUsage(cmd.CmdLetter, cmd.CmdName, cmd.CmdUsage).Replace("\n", "<BR>\t"), PacketBuilder.CHAT_BOTTOM_LEFT));
|
||||
}
|
||||
|
||||
user.Client.SendPacket(PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Permission(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length < 2)
|
||||
return false;
|
||||
string username = args[0].Trim();
|
||||
string privledgeLevel = args[1].ToUpper().Trim();
|
||||
|
||||
try
|
||||
{
|
||||
User modifyUser = findNamePartial(username);
|
||||
|
||||
if (privledgeLevel == "NORMAL")
|
||||
{
|
||||
modifyUser.Administrator = false;
|
||||
modifyUser.Moderator = false;
|
||||
}
|
||||
else if (privledgeLevel == "ADMIN")
|
||||
{
|
||||
modifyUser.Administrator = true;
|
||||
modifyUser.Moderator = true;
|
||||
}
|
||||
else if (privledgeLevel == "MOD" || privledgeLevel == "MODERATOR")
|
||||
{
|
||||
modifyUser.Administrator = false;
|
||||
modifyUser.Moderator = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
try
|
||||
{
|
||||
int playerId = Database.GetUserid(username);
|
||||
|
||||
if (privledgeLevel == "NORMAL")
|
||||
{
|
||||
Database.SetUserAdmin(playerId, false);
|
||||
Database.SetUserMod(playerId, false);
|
||||
}
|
||||
else if (privledgeLevel == "ADMIN")
|
||||
{
|
||||
Database.SetUserAdmin(playerId, true);
|
||||
Database.SetUserMod(playerId, true);
|
||||
}
|
||||
else if (privledgeLevel == "MOD" || privledgeLevel == "MODERATOR")
|
||||
{
|
||||
Database.SetUserAdmin(playerId, false);
|
||||
Database.SetUserMod(playerId, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (KeyNotFoundException) { return false; };
|
||||
};
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Message(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
string serverAnnoucement = String.Join(" ", args);
|
||||
|
||||
|
@ -87,11 +171,9 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
public static bool Shutdown(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
GameServer.ShutdownServer("Administrator initiated");
|
||||
|
||||
|
@ -101,8 +183,6 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
if(args[0].ToUpper() == "OBJECT")
|
||||
{
|
||||
int itemId = 0;
|
||||
|
@ -137,7 +217,7 @@ namespace HISP.Game.Chat
|
|||
if (itemId == Item.Present)
|
||||
itmInstance.Data = Item.GetRandomItem().Id;
|
||||
|
||||
client.LoggedinUser.Inventory.AddIgnoringFull(itmInstance);
|
||||
client.User.Inventory.AddIgnoringFull(itmInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +326,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
msg:;
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -255,8 +335,6 @@ namespace HISP.Game.Chat
|
|||
if (args.Length <= 0)
|
||||
return false;
|
||||
|
||||
if (!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -277,7 +355,7 @@ namespace HISP.Game.Chat
|
|||
else
|
||||
{
|
||||
User player = findNamePartial(swfUser);
|
||||
player.LoggedinClient.SendPacket(packetBytes);
|
||||
player.Client.SendPacket(packetBytes);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -286,7 +364,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -295,8 +373,6 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
if(args.Length <= 0)
|
||||
return false;
|
||||
if(!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
try{
|
||||
string userName = args[0];
|
||||
|
@ -310,7 +386,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -319,18 +395,17 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
// Get current version and send to client
|
||||
byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(versionPacket);
|
||||
user.Client.SendPacket(versionPacket);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
public static bool Ban(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
if (!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
string userName = args[0];
|
||||
|
@ -350,53 +425,43 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
try{
|
||||
User bannedUser = GameServer.GetUserByName(args[0]);
|
||||
bannedUser.LoggedinClient.Kick(Messages.KickReasonBanned);
|
||||
bannedUser.Client.Kick(Messages.KickReasonBanned);
|
||||
}
|
||||
catch(KeyNotFoundException){};
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
public static bool Escape(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
user.Teleport(Map.ModIsleX, Map.ModIsleY);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message) + Messages.ModIsleMessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Stealth(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
user.Stealth = !user.Stealth;
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
public static bool NoClip(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
user.NoClip = !user.NoClip;
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
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;
|
||||
|
||||
|
@ -406,7 +471,7 @@ namespace HISP.Game.Chat
|
|||
|
||||
toSend.Teleport(Map.RulesIsleX, Map.RulesIsleY);
|
||||
byte[] studyTheRulesMsg = PacketBuilder.CreateChat(Messages.RulesIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
toSend.LoggedinClient.SendPacket(studyTheRulesMsg);
|
||||
toSend.Client.SendPacket(studyTheRulesMsg);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
|
@ -414,14 +479,12 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message)+Messages.FormatRulesCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Prison(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
|
@ -432,7 +495,7 @@ namespace HISP.Game.Chat
|
|||
|
||||
toSend.Teleport(Map.PrisonIsleX, Map.PrisonIsleY);
|
||||
byte[] dontDoTheTime = PacketBuilder.CreateChat(Messages.PrisonIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
toSend.LoggedinClient.SendPacket(dontDoTheTime);
|
||||
toSend.Client.SendPacket(dontDoTheTime);
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
|
@ -440,14 +503,12 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message) + Messages.FormatPrisonCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
|
||||
}
|
||||
public static bool Kick(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator && !user.Moderator)
|
||||
return false;
|
||||
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
|
@ -459,11 +520,11 @@ namespace HISP.Game.Chat
|
|||
if (args.Length >= 2)
|
||||
{
|
||||
string reason = string.Join(" ", args, 1, args.Length - 1);
|
||||
toKick.LoggedinClient.Kick(reason);
|
||||
toKick.Client.Kick(reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
toKick.LoggedinClient.Kick(Messages.KickReasonKicked);
|
||||
toKick.Client.Kick(Messages.KickReasonKicked);
|
||||
}
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
|
@ -472,15 +533,13 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Jump(string message, string[] args, User user)
|
||||
{
|
||||
if (args.Length <= 2)
|
||||
return false;
|
||||
if (!user.Administrator)
|
||||
if (args.Length < 2)
|
||||
return false;
|
||||
|
||||
|
||||
|
@ -496,7 +555,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -504,8 +563,6 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
int itemId = 0;
|
||||
try
|
||||
|
@ -531,7 +588,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -539,8 +596,6 @@ namespace HISP.Game.Chat
|
|||
{
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
if(args[0].ToUpper() == "PLAYER")
|
||||
{
|
||||
if(args.Length < 2)
|
||||
|
@ -629,16 +684,13 @@ namespace HISP.Game.Chat
|
|||
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ModHorse(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
if (args.Length < 3)
|
||||
return false;
|
||||
|
||||
|
@ -709,7 +761,7 @@ namespace HISP.Game.Chat
|
|||
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -768,20 +820,18 @@ namespace HISP.Game.Chat
|
|||
|
||||
playSwf:;
|
||||
byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
user.LoggedinClient.SendPacket(swfPacket);
|
||||
user.Client.SendPacket(swfPacket);
|
||||
|
||||
|
||||
sendText:;
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CallHorse(string message, string[] args, User user)
|
||||
{
|
||||
if (!user.Administrator)
|
||||
return false;
|
||||
|
||||
if (args.Length <= 0)
|
||||
return false;
|
||||
|
@ -806,7 +856,7 @@ namespace HISP.Game.Chat
|
|||
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -820,16 +870,16 @@ namespace HISP.Game.Chat
|
|||
if (replyMessage.Length > 1024)
|
||||
{
|
||||
byte[] tooLong = PacketBuilder.CreateChat(Messages.AutoReplyTooLong, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(tooLong);
|
||||
user.Client.SendPacket(tooLong);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object violationReason = Chat.FilterMessage(replyMessage);
|
||||
Object violationReason = ChatMsg.FilterMessage(replyMessage);
|
||||
if (violationReason != null)
|
||||
{
|
||||
byte[] hasVios = PacketBuilder.CreateChat(Messages.AutoReplyHasViolations, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(hasVios);
|
||||
user.Client.SendPacket(hasVios);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -837,7 +887,7 @@ namespace HISP.Game.Chat
|
|||
user.AutoReplyText = replyMessage;
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
}
|
||||
public static bool Dance(string message, string[] args, User user)
|
||||
|
@ -851,7 +901,7 @@ namespace HISP.Game.Chat
|
|||
user.ActiveDance = new Dance(user, moves);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -862,7 +912,7 @@ namespace HISP.Game.Chat
|
|||
if(user.InRealTimeQuiz)
|
||||
{
|
||||
byte[] cantEnterRealTimeQuiz = PacketBuilder.CreateChat(Messages.EventAlreadyEnteredRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(cantEnterRealTimeQuiz);
|
||||
user.Client.SendPacket(cantEnterRealTimeQuiz);
|
||||
return false;
|
||||
}
|
||||
if (quizActive)
|
||||
|
@ -874,24 +924,24 @@ namespace HISP.Game.Chat
|
|||
if(participent.Quit)
|
||||
{
|
||||
byte[] quizQuit = PacketBuilder.CreateChat(Messages.EventQuitRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(quizQuit);
|
||||
user.Client.SendPacket(quizQuit);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
participent.UpdateParticipent();
|
||||
byte[] enteredRealTimeQuiz = PacketBuilder.CreateChat(Messages.EventEnteredRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(enteredRealTimeQuiz);
|
||||
user.Client.SendPacket(enteredRealTimeQuiz);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
return true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] quizUnavailable = PacketBuilder.CreateChat(Messages.EventUnavailableRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(quizUnavailable);
|
||||
user.Client.SendPacket(quizUnavailable);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -970,7 +1020,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1048,7 +1098,7 @@ namespace HISP.Game.Chat
|
|||
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -15,19 +15,43 @@ namespace HISP.Game.Chat
|
|||
return registeredComamnds.ToArray();
|
||||
}
|
||||
}
|
||||
private Func<string, string[], User, bool> commandCallback;
|
||||
|
||||
public bool CmdRequiresAdmin;
|
||||
public bool CmdRequiresMod;
|
||||
|
||||
public char CmdLetter;
|
||||
public string CmdName;
|
||||
public string CmdUsage;
|
||||
public Func<string,string[],User, bool> CmdCallback;
|
||||
public CommandRegister(char cmdLetter, string cmdName, string cmdUsage, Func<string, string[], User, bool> cmdCallback)
|
||||
public CommandRegister(char cmdLetter, string cmdName, string cmdUsage, Func<string, string[], User, bool> cmdCallback, bool cmdRequiresAdmin, bool cmdRequiresMod)
|
||||
{
|
||||
CmdLetter = cmdLetter;
|
||||
CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture);
|
||||
CmdCallback = cmdCallback;
|
||||
CmdUsage = cmdUsage;
|
||||
this.CmdLetter = cmdLetter;
|
||||
this.CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture).Trim();
|
||||
this.CmdUsage = cmdUsage;
|
||||
|
||||
this.CmdRequiresMod = cmdRequiresMod;
|
||||
this.CmdRequiresAdmin = cmdRequiresAdmin;
|
||||
|
||||
this.commandCallback = cmdCallback;
|
||||
|
||||
registeredComamnds.Add(this);
|
||||
}
|
||||
|
||||
public bool HasPermission(User user)
|
||||
{
|
||||
if (CmdRequiresAdmin && !(user.Administrator))
|
||||
return false;
|
||||
if (CmdRequiresMod && !(user.Moderator || user.Administrator))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Execute(string message, string[] args, User user)
|
||||
{
|
||||
if(HasPermission(user))
|
||||
return commandCallback(message, args, user);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,16 +54,16 @@ namespace HISP.Game.Events
|
|||
int totalTypes = 0;
|
||||
|
||||
foreach (int itemId in Item.TradingCards)
|
||||
if (client.LoggedinUser.Inventory.HasItemId(itemId))
|
||||
totalCards += client.LoggedinUser.Inventory.GetItemByItemId(itemId).ItemInstances.Length;
|
||||
if (client.User.Inventory.HasItemId(itemId))
|
||||
totalCards += client.User.Inventory.GetItemByItemId(itemId).ItemInstances.Length;
|
||||
|
||||
if (client.LoggedinUser.Inventory.HasItemId(Item.ColtTradingCard))
|
||||
if (client.User.Inventory.HasItemId(Item.ColtTradingCard))
|
||||
totalTypes++;
|
||||
if (client.LoggedinUser.Inventory.HasItemId(Item.FillyTradingCard))
|
||||
if (client.User.Inventory.HasItemId(Item.FillyTradingCard))
|
||||
totalTypes++;
|
||||
if (client.LoggedinUser.Inventory.HasItemId(Item.MareTradingCard))
|
||||
if (client.User.Inventory.HasItemId(Item.MareTradingCard))
|
||||
totalTypes++;
|
||||
if (client.LoggedinUser.Inventory.HasItemId(Item.StallionTradingCard))
|
||||
if (client.User.Inventory.HasItemId(Item.StallionTradingCard))
|
||||
totalTypes++;
|
||||
|
||||
if(totalCards > 4)
|
||||
|
@ -93,12 +93,12 @@ namespace HISP.Game.Events
|
|||
}
|
||||
else if (totalTypes == 4)
|
||||
{
|
||||
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.IsleCardsGameWin).Count++;
|
||||
client.User.TrackedItems.GetTrackedItem(Tracking.TrackableItem.IsleCardsGameWin).Count++;
|
||||
|
||||
byte[] wonIsleCardGame = PacketBuilder.CreateChat(Messages.EventWonIsleTradingGame, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
client.SendPacket(wonIsleCardGame);
|
||||
|
||||
client.LoggedinUser.AddMoney(25000);
|
||||
client.User.AddMoney(25000);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -148,8 +148,8 @@ namespace HISP.Game.Events
|
|||
thrower.AddMoney(50);
|
||||
throwAt.AddMoney(500);
|
||||
|
||||
thrower.LoggedinClient.SendPacket(youEarned);
|
||||
throwAt.LoggedinClient.SendPacket(otherEarned);
|
||||
thrower.Client.SendPacket(youEarned);
|
||||
throwAt.Client.SendPacket(otherEarned);
|
||||
|
||||
throwCounter.AddThrownAt(throwAt);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace HISP.Game.Events
|
|||
|
||||
string msg = Messages.FormatRandomEvent(rngEvent.Text, moneyEarned, horseName);
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.RandomEventPrefix + msg, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(chatPacket);
|
||||
user.Client.SendPacket(chatPacket);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace HISP.Game.Events
|
|||
return;
|
||||
|
||||
byte[] realTimeQuizQuestion = PacketBuilder.CreateMeta(Meta.BuildRealTimeQuiz(this));
|
||||
this.UserInstance.LoggedinClient.SendPacket(realTimeQuizQuestion);
|
||||
this.UserInstance.Client.SendPacket(realTimeQuizQuestion);
|
||||
}
|
||||
|
||||
public void CheckAnswer(string answer)
|
||||
|
@ -160,7 +160,7 @@ namespace HISP.Game.Events
|
|||
Participent partcipent = getParticipent(user.Id);
|
||||
partcipent.Quit = true;
|
||||
user.InRealTimeQuiz = false;
|
||||
GameServer.UpdateArea(user.LoggedinClient);
|
||||
GameServer.UpdateArea(user.Client);
|
||||
}
|
||||
catch (KeyNotFoundException) { };
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ namespace HISP.Game.Events
|
|||
|
||||
|
||||
participent.UserInstance.InRealTimeQuiz = false;
|
||||
GameServer.UpdateArea(participent.UserInstance.LoggedinClient);
|
||||
GameServer.UpdateArea(participent.UserInstance.Client);
|
||||
|
||||
int money = 0;
|
||||
|
||||
|
@ -238,12 +238,12 @@ namespace HISP.Game.Events
|
|||
if (participent.Won)
|
||||
{
|
||||
byte[] wonBonusMessage = PacketBuilder.CreateChat(Messages.FormatEventRealTimeQuizWinBonus(money), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
participent.UserInstance.LoggedinClient.SendPacket(wonBonusMessage);
|
||||
participent.UserInstance.Client.SendPacket(wonBonusMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] bonusMessage = PacketBuilder.CreateChat(Messages.FormatEventRealTimeQuizBonus(money), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
participent.UserInstance.LoggedinClient.SendPacket(bonusMessage);
|
||||
participent.UserInstance.Client.SendPacket(bonusMessage);
|
||||
}
|
||||
|
||||
participent.UserInstance.AddMoney(money);
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace HISP.Game.Events
|
|||
if (Database.HasPlayerCompletedRealTimeRiddle(RiddleId, winner.Id))
|
||||
{
|
||||
byte[] alreadyWonRiddleMessage = PacketBuilder.CreateChat(Messages.EventAlreadySovledRealTimeRiddle, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
winner.LoggedinClient.SendPacket(alreadyWonRiddleMessage);
|
||||
winner.Client.SendPacket(alreadyWonRiddleMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ namespace HISP.Game.Events
|
|||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
{
|
||||
if (client.LoggedIn)
|
||||
if (client.LoggedinUser.Id != winner.Id)
|
||||
if (client.User.Id != winner.Id)
|
||||
client.SendPacket(riddleWonMessage);
|
||||
else
|
||||
client.SendPacket(riddleYouWonMessage);
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace HISP.Game.Events
|
|||
{
|
||||
byte[] youWinMsg = PacketBuilder.CreateChat(Messages.EventWonWaterBallonGame, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
winner.UserHit.AddMoney(20000);
|
||||
winner.UserHit.LoggedinClient.SendPacket(youWinMsg);
|
||||
winner.UserHit.Client.SendPacket(youWinMsg);
|
||||
winner.UserHit.TrackedItems.GetTrackedItem(Tracking.TrackableItem.WaterbaloonGameWin).Count++;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace HISP.Game.Items
|
|||
if (isle.Name == "Prison Isle")
|
||||
{
|
||||
byte[] dontWorkHere = PacketBuilder.CreateChat(Messages.RanchDorothyShoesPrisonIsleMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(dontWorkHere);
|
||||
user.Client.SendPacket(dontWorkHere);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -162,14 +162,14 @@ namespace HISP.Game.Items
|
|||
return;
|
||||
}
|
||||
byte[] noPlaceLIke127001 = PacketBuilder.CreateChat(Messages.RanchDorothyShoesMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(noPlaceLIke127001);
|
||||
user.Client.SendPacket(noPlaceLIke127001);
|
||||
|
||||
user.Teleport(user.OwnedRanch.X, user.OwnedRanch.Y);
|
||||
}
|
||||
else if (itm.ItemId == Item.Telescope)
|
||||
{
|
||||
byte[] birdMap = PacketBuilder.CreateBirdMap(user.X, user.Y);
|
||||
user.LoggedinClient.SendPacket(birdMap);
|
||||
user.Client.SendPacket(birdMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -12,7 +12,14 @@ namespace HISP.Game
|
|||
public string Type;
|
||||
}
|
||||
|
||||
public static int[] OverlayTileDepth;
|
||||
public struct TileDepth
|
||||
{
|
||||
public bool ShowPlayer;
|
||||
public bool Passable;
|
||||
}
|
||||
|
||||
public static TileDepth[] OverlayTileDepth;
|
||||
public static TerrainTile[] TerrainTiles;
|
||||
|
||||
public static int Width;
|
||||
public static int Height;
|
||||
|
@ -20,8 +27,6 @@ namespace HISP.Game
|
|||
public static byte[] MapData;
|
||||
public static byte[] oMapData;
|
||||
|
||||
public static TerrainTile[] TerrainTiles;
|
||||
|
||||
|
||||
public static int NewUserStartX;
|
||||
public static int NewUserStartY;
|
||||
|
@ -77,17 +82,7 @@ namespace HISP.Game
|
|||
otileId = otileId + 64 * tileset;
|
||||
}
|
||||
|
||||
|
||||
int tileDepth = OverlayTileDepth[otileId];
|
||||
bool overlayPassable = false;
|
||||
if (tileDepth == 0)
|
||||
overlayPassable = false;
|
||||
if (tileDepth == 1)
|
||||
overlayPassable = false;
|
||||
if (tileDepth == 2)
|
||||
overlayPassable = true;
|
||||
if (tileDepth == 3)
|
||||
overlayPassable = true;
|
||||
bool overlayPassable = OverlayTileDepth[otileId].Passable;
|
||||
|
||||
if ((!terrainPassable && overlayPassable) && otileId == 0)
|
||||
return false;
|
||||
|
|
|
@ -5,11 +5,16 @@ using System.Globalization;
|
|||
using HISP.Security;
|
||||
using HISP.Server;
|
||||
using HISP.Util;
|
||||
using HISP.Game.Chat;
|
||||
|
||||
namespace HISP.Game
|
||||
{
|
||||
public class Messages
|
||||
{
|
||||
// HISP specific
|
||||
public static string HISPHelpCommandUsageFormat;
|
||||
|
||||
// extended config
|
||||
public static int RequiredChatViolations;
|
||||
|
||||
// Message Queue
|
||||
|
@ -1220,6 +1225,12 @@ namespace HISP.Game
|
|||
// Click
|
||||
public static string NothingInterestingHere;
|
||||
|
||||
// HISP Help Command
|
||||
public static string FormatHispHelpUsage(char commandPrefix, string commandName, string commandUsage)
|
||||
{
|
||||
return HISPHelpCommandUsageFormat.Replace("%PREFIX%", commandPrefix.ToString()).Replace("%COMMANDNAME%", commandName).Replace("%USAGE%", ChatMsg.EscapeMessage(commandUsage));
|
||||
}
|
||||
|
||||
// Violations
|
||||
public static string FormatProfileSavedBlocked(string reasons)
|
||||
{
|
||||
|
@ -1345,6 +1356,7 @@ namespace HISP.Game
|
|||
return PlayerIgnoringYourPrivateMessagesFormat.Replace("%USERNAME%", username);
|
||||
}
|
||||
|
||||
|
||||
// AUTO SELL
|
||||
|
||||
public static string FormatAutoSellSoldOffline(string horseName, int price, string toUsername)
|
||||
|
@ -2798,7 +2810,7 @@ namespace HISP.Game
|
|||
return NpcStartChatFormat.Replace("%ICONID%", iconId.ToString()).Replace("%NAME%", name).Replace("%DESCRIPTION%", shortDescription).Replace("%ID%", npcId.ToString());
|
||||
}
|
||||
|
||||
public static string FormatGlobalChatViolationMessage(Chat.Chat.Reason violationReason)
|
||||
public static string FormatGlobalChatViolationMessage(Chat.ChatMsg.Reason violationReason)
|
||||
{
|
||||
return ChatViolationMessageFormat.Replace("%AMOUNT%", RequiredChatViolations.ToString()).Replace("%REASON%", violationReason.Message);
|
||||
}
|
||||
|
|
|
@ -1154,9 +1154,9 @@ namespace HISP.Game
|
|||
{
|
||||
if (client.LoggedIn)
|
||||
{
|
||||
if (client.LoggedinUser.Stealth)
|
||||
if (client.User.Stealth)
|
||||
continue;
|
||||
onlineUsers.Add(client.LoggedinUser);
|
||||
onlineUsers.Add(client.User);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1189,17 +1189,17 @@ namespace HISP.Game
|
|||
{
|
||||
if (client.LoggedIn)
|
||||
{
|
||||
if (client.LoggedinUser.Stealth)
|
||||
if (client.User.Stealth)
|
||||
continue;
|
||||
|
||||
bool isYou = (client.LoggedinUser.Id == currentUser.Id);
|
||||
bool isYou = (client.User.Id == currentUser.Id);
|
||||
|
||||
int icon = client.LoggedinUser.GetPlayerListIcon();
|
||||
int icon = client.User.GetPlayerListIcon();
|
||||
string iconFormat = "";
|
||||
if (icon != -1)
|
||||
iconFormat = Messages.FormatIconFormat(icon);
|
||||
|
||||
message += Messages.FormatPlayerEntry(iconFormat, client.LoggedinUser.Username, client.LoggedinUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - client.LoggedinUser.LoginTime).TotalMinutes)), client.LoggedinUser.X, client.LoggedinUser.Y, client.LoggedinUser.Idle, currentUser.MutePlayer.IsUserMuted(client.LoggedinUser), isYou);
|
||||
message += Messages.FormatPlayerEntry(iconFormat, client.User.Username, client.User.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - client.User.LoginTime).TotalMinutes)), client.User.X, client.User.Y, client.User.Idle, currentUser.MutePlayer.IsUserMuted(client.User), isYou);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1735,7 +1735,7 @@ namespace HISP.Game
|
|||
string swfModule = ranch.GetSwf(mine);
|
||||
|
||||
byte[] moduleSwf = PacketBuilder.CreateSwfModule(swfModule, PacketBuilder.PACKET_SWF_MODULE_FORCE);
|
||||
user.LoggedinClient.SendPacket(moduleSwf);
|
||||
user.Client.SendPacket(moduleSwf);
|
||||
|
||||
if (mine) // This is My DS.
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace HISP.Game
|
|||
if (joinedUser.Id != user.Id)
|
||||
if(!TwoPlayer.IsPlayerInGame(joinedUser))
|
||||
if(!joinedUser.MajorPriority)
|
||||
GameServer.UpdateArea(joinedUser.LoggedinClient);
|
||||
GameServer.UpdateArea(joinedUser.Client);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace HISP.Game
|
|||
foreach (User joinedUser in JoinedUsers)
|
||||
if (!TwoPlayer.IsPlayerInGame(joinedUser))
|
||||
if (!joinedUser.MajorPriority)
|
||||
GameServer.UpdateArea(joinedUser.LoggedinClient);
|
||||
GameServer.UpdateArea(joinedUser.Client);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ namespace HISP.Game
|
|||
if (quest.SuccessMessage != null)
|
||||
{
|
||||
byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(ChatPacket);
|
||||
user.Client.SendPacket(ChatPacket);
|
||||
}
|
||||
|
||||
if (quest.SuccessNpcChat != null)
|
||||
|
@ -246,7 +246,7 @@ namespace HISP.Game
|
|||
if (!npcActivation)
|
||||
{
|
||||
byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(ChatPacket);
|
||||
user.Client.SendPacket(ChatPacket);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ namespace HISP.Game
|
|||
if (quest.Id == CloudIslesQuest)
|
||||
{
|
||||
byte[] swfLoadPacket = PacketBuilder.CreateSwfModule("ballooncutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
user.LoggedinClient.SendPacket(swfLoadPacket);
|
||||
user.Client.SendPacket(swfLoadPacket);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -290,7 +290,7 @@ namespace HISP.Game
|
|||
if (!npcActivation)
|
||||
{
|
||||
byte[] ChatPacket = PacketBuilder.CreateChat(quest.FailNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(ChatPacket);
|
||||
user.Client.SendPacket(ChatPacket);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -371,7 +371,7 @@ namespace HISP.Game
|
|||
if(result.NpcChat != null)
|
||||
{
|
||||
byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(ChatPacket);
|
||||
user.Client.SendPacket(ChatPacket);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ namespace HISP.Game
|
|||
if (result.NpcChat != null)
|
||||
{
|
||||
byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(ChatPacket);
|
||||
user.Client.SendPacket(ChatPacket);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace HISP.Game
|
|||
{
|
||||
if(ownerId != -1)
|
||||
{
|
||||
if (ConfigReader.AllUsersSubbed || Database.IsUserAdmin(ownerId))
|
||||
if (ConfigReader.AllUsersSubbed || Database.GetUserAdmin(ownerId))
|
||||
return ownerId;
|
||||
|
||||
int subExp = Database.GetUserSubscriptionExpireDate(ownerId);
|
||||
|
@ -474,7 +474,7 @@ namespace HISP.Game
|
|||
throw new KeyNotFoundException("No Ranch found at x" + x + " y" + y);
|
||||
}
|
||||
|
||||
public static bool IsRanchOwned(int playerId)
|
||||
public static bool GetOwnedRanch(int playerId)
|
||||
{
|
||||
foreach (Ranch ranch in Ranches)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace HISP.Game
|
|||
Database.CompleteRiddle(this.Id, user.Id);
|
||||
|
||||
byte[] riddleAnswerCorrectPacket = PacketBuilder.CreateChat(Messages.FormatRiddlerAnswerCorrect(this.Reason), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(riddleAnswerCorrectPacket);
|
||||
user.Client.SendPacket(riddleAnswerCorrectPacket);
|
||||
user.AddMoney(10000);
|
||||
|
||||
if(HasCompletedAllRiddles(user))
|
||||
|
@ -42,7 +42,7 @@ namespace HISP.Game
|
|||
public void AnswerFail(User user)
|
||||
{
|
||||
byte[] riddleIncorrect = PacketBuilder.CreateChat(Messages.RiddlerIncorrectAnswer, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(riddleIncorrect);
|
||||
user.Client.SendPacket(riddleIncorrect);
|
||||
}
|
||||
|
||||
public bool CheckAnswer(User user, string txt)
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace HISP.Game.Services
|
|||
if(BidUser.HorseInventory.HorseList.Length >= BidUser.MaxHorses)
|
||||
{
|
||||
byte[] tooManyHorses = PacketBuilder.CreateChat(Messages.AuctionYouHaveTooManyHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
BidUser.LoggedinClient.SendPacket(tooManyHorses);
|
||||
BidUser.Client.SendPacket(tooManyHorses);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace HISP.Game.Services
|
|||
if(BidAmount >= MAX_BID)
|
||||
{
|
||||
byte[] maxBidReached = PacketBuilder.CreateChat(Messages.AuctionBidMax, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
BidUser.LoggedinClient.SendPacket(maxBidReached);
|
||||
BidUser.Client.SendPacket(maxBidReached);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace HISP.Game.Services
|
|||
{
|
||||
|
||||
byte[] cantAffordBid = PacketBuilder.CreateChat(Messages.AuctionCantAffordBid, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
BidUser.LoggedinClient.SendPacket(cantAffordBid);
|
||||
BidUser.Client.SendPacket(cantAffordBid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace HISP.Game.Services
|
|||
if(entry.RandomId != AuctionItem.RandomId && entry.HighestBidder == BidUser.Id)
|
||||
{
|
||||
byte[] cantWinTooMuch = PacketBuilder.CreateChat(Messages.AuctionOnlyOneWinningBidAllowed, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
BidUser.LoggedinClient.SendPacket(cantWinTooMuch);
|
||||
BidUser.Client.SendPacket(cantWinTooMuch);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace HISP.Game.Services
|
|||
{
|
||||
User oldBidder = GameServer.GetUserById(AuctionItem.HighestBidder);
|
||||
byte[] outbidMessage = PacketBuilder.CreateChat(Messages.FormatAuctionYourOutbidBy(BidUser.Username, AuctionItem.HighestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
oldBidder.LoggedinClient.SendPacket(outbidMessage);
|
||||
oldBidder.Client.SendPacket(outbidMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ namespace HISP.Game.Services
|
|||
}
|
||||
|
||||
byte[] bidPlacedMsg = PacketBuilder.CreateChat(yourBidRaisedTo, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
BidUser.LoggedinClient.SendPacket(bidPlacedMsg);
|
||||
BidUser.Client.SendPacket(bidPlacedMsg);
|
||||
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ namespace HISP.Game.Services
|
|||
User auctionRunner = GameServer.GetUserById(highestBidder);
|
||||
auctionRunner.HorseInventory.UnHide(Horse.RandomId);
|
||||
byte[] notSold = PacketBuilder.CreateChat(Messages.AuctionNoHorseBrought, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
auctionRunner.LoggedinClient.SendPacket(notSold);
|
||||
auctionRunner.Client.SendPacket(notSold);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ namespace HISP.Game.Services
|
|||
{
|
||||
User userWon = GameServer.GetUserById(highestBidder);
|
||||
byte[] wonAuction = PacketBuilder.CreateChat(Messages.FormatAuctionBroughtHorse(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
userWon.LoggedinClient.SendPacket(wonAuction);
|
||||
userWon.Client.SendPacket(wonAuction);
|
||||
userWon.TakeMoney(highestBid);
|
||||
userWon.HorseInventory.AddHorse(Horse, false);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ namespace HISP.Game.Services
|
|||
{
|
||||
User userSold = GameServer.GetUserById(OwnerId);
|
||||
byte[] horseSold = PacketBuilder.CreateChat(Messages.FormatAuctionHorseSold(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
userSold.LoggedinClient.SendPacket(horseSold);
|
||||
userSold.Client.SendPacket(horseSold);
|
||||
userSold.AddMoney(highestBid);
|
||||
userSold.HorseInventory.DeleteHorse(Horse, false);
|
||||
}
|
||||
|
|
|
@ -140,14 +140,14 @@ namespace HISP.Game
|
|||
GenerateTreasure();
|
||||
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovement(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
user.LoggedinClient.SendPacket(MovementPacket);
|
||||
user.Client.SendPacket(MovementPacket);
|
||||
|
||||
user.AddMoney(Value);
|
||||
|
||||
if(this.Type == "BURIED")
|
||||
{
|
||||
byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPirateTreasure(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(treasureReceivedPacket);
|
||||
user.Client.SendPacket(treasureReceivedPacket);
|
||||
user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PirateTreasure).Count++;
|
||||
|
||||
if(user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PirateTreasure).Count >= 10)
|
||||
|
@ -159,7 +159,7 @@ namespace HISP.Game
|
|||
else if(this.Type == "RAINBOW")
|
||||
{
|
||||
byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPotOfGold(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
user.LoggedinClient.SendPacket(treasureReceivedPacket);
|
||||
user.Client.SendPacket(treasureReceivedPacket);
|
||||
|
||||
user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PotOfGold).Count++;
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ namespace HISP.Game
|
|||
byte[] youHaveInvited = PacketBuilder.CreateChat(Messages.Format2PlayerYouInvited(inviting.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] yourInvited = PacketBuilder.CreateChat(Messages.Format2PlayerYourInvited(invitee.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
|
||||
Invitee.LoggedinClient.SendPacket(youHaveInvited);
|
||||
Inviting.LoggedinClient.SendPacket(yourInvited);
|
||||
Invitee.Client.SendPacket(youHaveInvited);
|
||||
Inviting.Client.SendPacket(yourInvited);
|
||||
|
||||
deleteTimer = new Timer(new TimerCallback(deleteTwoPlayer), null, 2 * 60 * 1000, 2 * 60 * 1000);
|
||||
|
||||
|
@ -119,15 +119,15 @@ namespace HISP.Game
|
|||
|
||||
private void update()
|
||||
{
|
||||
GameServer.UpdateArea(Invitee.LoggedinClient);
|
||||
GameServer.UpdateArea(Inviting.LoggedinClient);
|
||||
GameServer.UpdateArea(Invitee.Client);
|
||||
GameServer.UpdateArea(Inviting.Client);
|
||||
}
|
||||
private void updateOthers()
|
||||
{
|
||||
foreach(User user in this.Multiroom.JoinedUsers)
|
||||
if (IsPlayerInGame(user))
|
||||
if(user.Id != Invitee.Id && user.Id != Inviting.Id)
|
||||
GameServer.UpdateArea(user.LoggedinClient);
|
||||
GameServer.UpdateArea(user.Client);
|
||||
|
||||
}
|
||||
public void UpdateAll()
|
||||
|
@ -182,14 +182,14 @@ namespace HISP.Game
|
|||
byte[] startingUpGameInvitee = PacketBuilder.CreateChat(Messages.Format2PlayerStartingGame(Inviting.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] startingUpGameInvited = PacketBuilder.CreateChat(Messages.Format2PlayerStartingGame(Invitee.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
|
||||
Invitee.LoggedinClient.SendPacket(startingUpGameInvitee);
|
||||
Inviting.LoggedinClient.SendPacket(startingUpGameInvited);
|
||||
Invitee.Client.SendPacket(startingUpGameInvitee);
|
||||
Inviting.Client.SendPacket(startingUpGameInvited);
|
||||
|
||||
byte[] loadSwfInvitee = PacketBuilder.CreateSwfModule(buildSwf(2), PacketBuilder.PACKET_SWF_MODULE_FORCE);
|
||||
byte[] loadSwfInvited = PacketBuilder.CreateSwfModule(buildSwf(1), PacketBuilder.PACKET_SWF_MODULE_FORCE);
|
||||
|
||||
Invitee.LoggedinClient.SendPacket(loadSwfInvitee);
|
||||
Inviting.LoggedinClient.SendPacket(loadSwfInvited);
|
||||
Invitee.Client.SendPacket(loadSwfInvitee);
|
||||
Inviting.Client.SendPacket(loadSwfInvited);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -207,13 +207,13 @@ namespace HISP.Game
|
|||
|
||||
if (userWhoClosed.Id == Inviting.Id)
|
||||
{
|
||||
Invitee.LoggedinClient.SendPacket(gameClosedByOther);
|
||||
Inviting.LoggedinClient.SendPacket(gameClosed);
|
||||
Invitee.Client.SendPacket(gameClosedByOther);
|
||||
Inviting.Client.SendPacket(gameClosed);
|
||||
}
|
||||
else if (userWhoClosed.Id == Invitee.Id)
|
||||
{
|
||||
Invitee.LoggedinClient.SendPacket(gameClosed);
|
||||
Inviting.LoggedinClient.SendPacket(gameClosedByOther);
|
||||
Invitee.Client.SendPacket(gameClosed);
|
||||
Inviting.Client.SendPacket(gameClosedByOther);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace HISP.Game
|
|||
Database.SetWeather(Name, value);
|
||||
foreach(User user in GameServer.GetUsersInIsle(this,true,true))
|
||||
{
|
||||
GameServer.UpdateWorld(user.LoggedinClient);
|
||||
GameServer.UpdateWorld(user.Client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ namespace HISP.Game
|
|||
Database.SetWeather(Name, value);
|
||||
foreach (User user in GameServer.GetUsersInTown(this, true, true))
|
||||
{
|
||||
GameServer.UpdateArea(user.LoggedinClient);
|
||||
GameServer.UpdateArea(user.Client);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace HISP.Player
|
|||
baseUser.AddMoney(award.MoneyBonus);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(award.CompletionText, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(chatPacket);
|
||||
baseUser.Client.SendPacket(chatPacket);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace HISP.Player
|
|||
baseUser.Facing = direction + (onHorse * 5);
|
||||
|
||||
byte[] moveResponse = PacketBuilder.CreateMovement(baseUser.X, baseUser.Y, baseUser.CharacterId, baseUser.Facing, PacketBuilder.DIRECTION_NONE, false);
|
||||
baseUser.LoggedinClient.SendPacket(moveResponse);
|
||||
baseUser.Client.SendPacket(moveResponse);
|
||||
|
||||
GameServer.UpdateUserFacingAndLocation(baseUser);
|
||||
|
||||
|
|
|
@ -77,19 +77,19 @@ namespace HISP.Player
|
|||
if(baseUser.MuteBuddy)
|
||||
{
|
||||
byte[] cantFriend = PacketBuilder.CreateChat(Messages.CantSendBuddyRequestWhileMuted, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(cantFriend);
|
||||
baseUser.Client.SendPacket(cantFriend);
|
||||
return;
|
||||
}
|
||||
else if(userToFriend.MuteBuddyRequests)
|
||||
{
|
||||
byte[] cantFriend = PacketBuilder.CreateChat(Messages.PlayerIgnoringAllBuddyRequests, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(cantFriend);
|
||||
baseUser.Client.SendPacket(cantFriend);
|
||||
return;
|
||||
}
|
||||
else if(userToFriend.MutePlayer.IsUserMuted(userToFriend))
|
||||
{
|
||||
byte[] cantFriend = PacketBuilder.CreateChat(Messages.PlayerIgnoringYourBuddyRequests, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(cantFriend);
|
||||
baseUser.Client.SendPacket(cantFriend);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -102,23 +102,23 @@ namespace HISP.Player
|
|||
byte[] nowFriendsMsg = PacketBuilder.CreateChat(Messages.FormatAddBuddyConfirmed(userToFriend.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] nowFriendsOther = PacketBuilder.CreateChat(Messages.FormatAddBuddyConfirmed(baseUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
|
||||
userToFriend.LoggedinClient.SendPacket(nowFriendsOther);
|
||||
baseUser.LoggedinClient.SendPacket(nowFriendsMsg);
|
||||
userToFriend.Client.SendPacket(nowFriendsOther);
|
||||
baseUser.Client.SendPacket(nowFriendsMsg);
|
||||
|
||||
if(!baseUser.MajorPriority)
|
||||
GameServer.UpdateArea(baseUser.LoggedinClient);
|
||||
GameServer.UpdateArea(baseUser.Client);
|
||||
|
||||
if (!userToFriend.MajorPriority)
|
||||
GameServer.UpdateArea(userToFriend.LoggedinClient);
|
||||
GameServer.UpdateArea(userToFriend.Client);
|
||||
}
|
||||
else
|
||||
{
|
||||
baseUser.PendingBuddyRequestTo = userToFriend;
|
||||
byte[] pendingMsg = PacketBuilder.CreateChat(Messages.AddBuddyPending, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] pendingMsgOther = PacketBuilder.CreateChat(Messages.FormatAddBuddyPendingOther(baseUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(pendingMsg);
|
||||
baseUser.Client.SendPacket(pendingMsg);
|
||||
if(!userToFriend.MuteBuddyRequests && !userToFriend.MuteAll)
|
||||
userToFriend.LoggedinClient.SendPacket(pendingMsgOther);
|
||||
userToFriend.Client.SendPacket(pendingMsgOther);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ namespace HISP.Player
|
|||
}
|
||||
|
||||
byte[] rippedUpMessage = PacketBuilder.CreateChat(Messages.MailRippedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(rippedUpMessage);
|
||||
GameServer.UpdateInventory(baseUser.LoggedinClient);
|
||||
baseUser.Client.SendPacket(rippedUpMessage);
|
||||
GameServer.UpdateInventory(baseUser.Client);
|
||||
}
|
||||
|
||||
public void ReadAllMail()
|
||||
|
@ -87,7 +87,7 @@ namespace HISP.Player
|
|||
mails[i].Read = true;
|
||||
}
|
||||
|
||||
GameServer.UpdatePlayer(baseUser.LoggedinClient);
|
||||
GameServer.UpdatePlayer(baseUser.Client);
|
||||
}
|
||||
public void AddMail(Mail mailMessage)
|
||||
{
|
||||
|
|
|
@ -68,8 +68,8 @@ namespace HISP.Player
|
|||
OtherTrade.Trader.PendingTradeTo = 0;
|
||||
OtherTrade.Trader.TradingWith = null;
|
||||
|
||||
GameServer.UpdateArea(Trader.LoggedinClient);
|
||||
GameServer.UpdateArea(OtherTrade.Trader.LoggedinClient);
|
||||
GameServer.UpdateArea(Trader.Client);
|
||||
GameServer.UpdateArea(OtherTrade.Trader.Client);
|
||||
}
|
||||
|
||||
public bool Fail = false;
|
||||
|
@ -84,7 +84,7 @@ namespace HISP.Player
|
|||
if (MoneyOffered > 0 && OtherTrade.Trader.Money < 0)
|
||||
{
|
||||
byte[] otherNegativeMoneyNotAllowed = PacketBuilder.CreateChat(Messages.TradeOtherPlayerHasNegativeMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(otherNegativeMoneyNotAllowed);
|
||||
Trader.Client.SendPacket(otherNegativeMoneyNotAllowed);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace HISP.Player
|
|||
if (OtherTrade.MoneyOffered > 0 && Trader.Money < 0)
|
||||
{
|
||||
byte[] negativeMoneyNotAllowed = PacketBuilder.CreateChat(Messages.TradeYouHaveNegativeMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(negativeMoneyNotAllowed);
|
||||
Trader.Client.SendPacket(negativeMoneyNotAllowed);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ namespace HISP.Player
|
|||
if (OtherTrade.Trader.Bids.Length > 0)
|
||||
{
|
||||
byte[] tradeNotAllowedWhileOtherBidding = PacketBuilder.CreateChat(Messages.TradeNotAllowedWhileOtherBidding, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeNotAllowedWhileOtherBidding);
|
||||
Trader.Client.SendPacket(tradeNotAllowedWhileOtherBidding);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace HISP.Player
|
|||
if (Trader.Bids.Length > 0)
|
||||
{
|
||||
byte[] tradeNotAllowedWhileBidding = PacketBuilder.CreateChat(Messages.TradeNotAllowedWhileBidding, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeNotAllowedWhileBidding);
|
||||
Trader.Client.SendPacket(tradeNotAllowedWhileBidding);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace HISP.Player
|
|||
if (MoneyOffered > 0 && OtherTrade.Trader.Money + MoneyOffered > 2100000000)
|
||||
{
|
||||
byte[] tradeOtherHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveOtherTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeOtherHasTooMuchMoney);
|
||||
Trader.Client.SendPacket(tradeOtherHasTooMuchMoney);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace HISP.Player
|
|||
if (OtherTrade.MoneyOffered > 0 && Trader.Money + OtherTrade.MoneyOffered > 2100000000)
|
||||
{
|
||||
byte[] tradeYouHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveYouTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeYouHasTooMuchMoney);
|
||||
Trader.Client.SendPacket(tradeYouHasTooMuchMoney);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ namespace HISP.Player
|
|||
if (HorsesOffered.Length > 0 && OtherTrade.Trader.HorseInventory.HorseList.Length + HorsesOffered.Length > OtherTrade.Trader.MaxHorses)
|
||||
{
|
||||
byte[] tradeYouHaveTooManyHorses = PacketBuilder.CreateChat(Messages.TradeYouCantHandleMoreHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeYouHaveTooManyHorses);
|
||||
Trader.Client.SendPacket(tradeYouHaveTooManyHorses);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ namespace HISP.Player
|
|||
if (OtherTrade.HorsesOffered.Length > 0 && Trader.HorseInventory.HorseList.Length + OtherTrade.HorsesOffered.Length > Trader.MaxHorses)
|
||||
{
|
||||
byte[] tradeYouHaveTooManyHorses = PacketBuilder.CreateChat(Messages.TradeYouCantHandleMoreHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeYouHaveTooManyHorses);
|
||||
Trader.Client.SendPacket(tradeYouHaveTooManyHorses);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ namespace HISP.Player
|
|||
if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK)
|
||||
{
|
||||
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeYouCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeTooManyItems);
|
||||
Trader.Client.SendPacket(tradeTooManyItems);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ namespace HISP.Player
|
|||
if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK)
|
||||
{
|
||||
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeOtherCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeTooManyItems);
|
||||
Trader.Client.SendPacket(tradeTooManyItems);
|
||||
Fail = true;
|
||||
OtherTrade.Fail = true;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ namespace HISP.Player
|
|||
|
||||
acceptTrade:;
|
||||
byte[] tradeAccepted = PacketBuilder.CreateChat(Messages.TradeAcceptedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeAccepted);
|
||||
Trader.Client.SendPacket(tradeAccepted);
|
||||
|
||||
// Transfer Money
|
||||
|
||||
|
@ -214,14 +214,14 @@ namespace HISP.Player
|
|||
{
|
||||
Trader.TakeMoney(MoneyOffered);
|
||||
byte[] tradeSpentMoney = PacketBuilder.CreateChat(Messages.FormatTradeYouSpent(MoneyOffered), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeSpentMoney);
|
||||
Trader.Client.SendPacket(tradeSpentMoney);
|
||||
}
|
||||
|
||||
if(OtherTrade.MoneyOffered > 0)
|
||||
{
|
||||
Trader.AddMoney(OtherTrade.MoneyOffered);
|
||||
byte[] tradeReceivedMoney = PacketBuilder.CreateChat(Messages.FormatTradeYouReceived(OtherTrade.MoneyOffered), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeReceivedMoney);
|
||||
Trader.Client.SendPacket(tradeReceivedMoney);
|
||||
}
|
||||
|
||||
foreach (HorseInstance inst in HorsesOffered) // Transfer Horses
|
||||
|
@ -236,7 +236,7 @@ namespace HISP.Player
|
|||
byte[] disMounted = PacketBuilder.CreateChat(Messages.TradeRiddenHorse, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.Facing %= 5;
|
||||
Trader.CurrentlyRidingHorse = null;
|
||||
Trader.LoggedinClient.SendPacket(disMounted);
|
||||
Trader.Client.SendPacket(disMounted);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,13 +273,13 @@ namespace HISP.Player
|
|||
public void InteruptTrade()
|
||||
{
|
||||
byte[] tradeCanceled = PacketBuilder.CreateChat(Messages.TradeCanceledInterupted, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeCanceled);
|
||||
Trader.Client.SendPacket(tradeCanceled);
|
||||
endTrade();
|
||||
}
|
||||
public void AcceptTrade()
|
||||
{
|
||||
byte[] waitingForAccept = PacketBuilder.CreateChat(Messages.TradeWaitingForOthersToAcceptMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(waitingForAccept);
|
||||
Trader.Client.SendPacket(waitingForAccept);
|
||||
|
||||
if (OtherTrade.Stage == "ACCEPTED")
|
||||
{
|
||||
|
@ -292,18 +292,18 @@ namespace HISP.Player
|
|||
public void CancelTrade()
|
||||
{
|
||||
byte[] tradeCanceled = PacketBuilder.CreateChat(Messages.TradeCanceledByYouMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(tradeCanceled);
|
||||
Trader.Client.SendPacket(tradeCanceled);
|
||||
|
||||
byte[] tradeCanceledOther = PacketBuilder.CreateChat(Messages.FormatTradeCanceledByPlayer(Trader.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
OtherTrade.Trader.LoggedinClient.SendPacket(tradeCanceledOther);
|
||||
OtherTrade.Trader.Client.SendPacket(tradeCanceledOther);
|
||||
|
||||
endTrade();
|
||||
}
|
||||
public void CancelTradeMoved()
|
||||
{
|
||||
byte[] playerMoved = PacketBuilder.CreateChat(Messages.TradeCanceledBecuasePlayerMovedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
Trader.LoggedinClient.SendPacket(playerMoved);
|
||||
OtherTrade.Trader.LoggedinClient.SendPacket(playerMoved);
|
||||
Trader.Client.SendPacket(playerMoved);
|
||||
OtherTrade.Trader.Client.SendPacket(playerMoved);
|
||||
|
||||
endTrade();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace HISP.Player
|
|||
private int thirst;
|
||||
private int tired;
|
||||
private bool noClip = false;
|
||||
private bool administrator = false;
|
||||
private bool moderator = false;
|
||||
|
||||
public bool NoClip
|
||||
{
|
||||
|
@ -60,6 +62,36 @@ namespace HISP.Player
|
|||
noClip = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool Administrator
|
||||
{
|
||||
get
|
||||
{
|
||||
return administrator;
|
||||
}
|
||||
set
|
||||
{
|
||||
administrator = value;
|
||||
Database.SetUserAdmin(Id, administrator);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Moderator
|
||||
{
|
||||
get
|
||||
{
|
||||
if (administrator)
|
||||
return true;
|
||||
return moderator;
|
||||
}
|
||||
set
|
||||
{
|
||||
moderator = value;
|
||||
Database.SetUserMod(Id, moderator);
|
||||
}
|
||||
}
|
||||
|
||||
public Trade TradingWith = null;
|
||||
public int AttemptingToOfferItem;
|
||||
public bool TradeMenuPriority = false;
|
||||
|
@ -68,10 +100,8 @@ namespace HISP.Player
|
|||
public int SecCodeCount = 0;
|
||||
public int Id;
|
||||
public string Username;
|
||||
public bool Administrator = false;
|
||||
public bool Moderator = false;
|
||||
public bool NewPlayer = false;
|
||||
public GameClient LoggedinClient;
|
||||
public GameClient Client;
|
||||
public CompetitionGear EquipedCompetitionGear;
|
||||
public Jewelry EquipedJewelry;
|
||||
public bool MuteAds = false;
|
||||
|
@ -182,13 +212,13 @@ namespace HISP.Player
|
|||
int money = Money;
|
||||
money -= amount;
|
||||
Database.SetPlayerMoney(money, Id);
|
||||
GameServer.UpdatePlayer(LoggedinClient);
|
||||
GameServer.UpdatePlayer(Client);
|
||||
}
|
||||
|
||||
public void SetMoney(int amount)
|
||||
{
|
||||
Database.SetPlayerMoney(amount, Id);
|
||||
GameServer.UpdatePlayer(LoggedinClient);
|
||||
GameServer.UpdatePlayer(Client);
|
||||
}
|
||||
|
||||
public void AddMoney(int amount)
|
||||
|
@ -207,7 +237,7 @@ namespace HISP.Player
|
|||
}
|
||||
|
||||
Database.SetPlayerMoney(money, Id);
|
||||
GameServer.UpdatePlayer(LoggedinClient);
|
||||
GameServer.UpdatePlayer(Client);
|
||||
}
|
||||
public string GetWeatherSeen()
|
||||
{
|
||||
|
@ -565,8 +595,8 @@ namespace HISP.Player
|
|||
Y = newY;
|
||||
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovement(X, Y, CharacterId, Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
LoggedinClient.SendPacket(MovementPacket);
|
||||
GameServer.UpdateWeather(LoggedinClient);
|
||||
Client.SendPacket(MovementPacket);
|
||||
GameServer.UpdateWeather(Client);
|
||||
|
||||
|
||||
User[] goneOffScreen = onScreenBefore.Except(onScreenNow).ToArray();
|
||||
|
@ -580,7 +610,7 @@ namespace HISP.Player
|
|||
continue;
|
||||
|
||||
byte[] playerInfoBytes = PacketBuilder.CreatePlayerInfoUpdateOrCreate(1000 + 4, 1000 + 1, this.Facing, this.CharacterId, this.Username);
|
||||
offScreenUsers.LoggedinClient.SendPacket(playerInfoBytes);
|
||||
offScreenUsers.Client.SendPacket(playerInfoBytes);
|
||||
}
|
||||
|
||||
// Tell players now on screen there locations
|
||||
|
@ -590,11 +620,11 @@ namespace HISP.Player
|
|||
continue;
|
||||
|
||||
byte[] playerInfoBytes = PacketBuilder.CreatePlayerInfoUpdateOrCreate(onScreenUsers.X, onScreenUsers.Y, onScreenUsers.Facing, onScreenUsers.CharacterId, onScreenUsers.Username);
|
||||
LoggedinClient.SendPacket(playerInfoBytes);
|
||||
Client.SendPacket(playerInfoBytes);
|
||||
}
|
||||
|
||||
|
||||
GameServer.Update(LoggedinClient);
|
||||
GameServer.Update(Client);
|
||||
}
|
||||
|
||||
// Insert LGBT Patch here
|
||||
|
@ -640,18 +670,16 @@ namespace HISP.Player
|
|||
{
|
||||
Database.CreateUserExt(UserId);
|
||||
NewPlayer = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
EquipedCompetitionGear = new CompetitionGear(UserId);
|
||||
EquipedJewelry = new Jewelry(UserId);
|
||||
|
||||
Id = UserId;
|
||||
Username = Database.GetUsername(UserId);
|
||||
|
||||
Administrator = Database.CheckUserIsAdmin(Username);
|
||||
Moderator = Database.CheckUserIsModerator(Username);
|
||||
administrator = Database.GetUserModerator(Id);
|
||||
moderator = Database.GetUserAdmin(Id);
|
||||
|
||||
chatViolations = Database.GetChatViolations(UserId);
|
||||
x = Database.GetPlayerX(UserId);
|
||||
|
@ -663,7 +691,7 @@ namespace HISP.Player
|
|||
|
||||
bankMoney = Database.GetPlayerBankMoney(UserId);
|
||||
questPoints = Database.GetPlayerQuestPoints(UserId);
|
||||
subscribed = Database.IsUserSubscribed(UserId);
|
||||
subscribed = Database.GetUserSubscribed(UserId);
|
||||
subscribedUntil = Database.GetUserSubscriptionExpireDate(UserId);
|
||||
profilePage = Database.GetPlayerProfile(UserId);
|
||||
privateNotes = Database.GetPlayerNotes(UserId);
|
||||
|
@ -671,7 +699,7 @@ namespace HISP.Player
|
|||
thirst = Database.GetPlayerThirst(UserId);
|
||||
tired = Database.GetPlayerTiredness(UserId);
|
||||
|
||||
if(Ranch.IsRanchOwned(this.Id))
|
||||
if(Ranch.GetOwnedRanch(this.Id))
|
||||
OwnedRanch = Ranch.GetRanchOwnedBy(this.Id);
|
||||
|
||||
Gender = Database.GetGender(UserId);
|
||||
|
@ -693,7 +721,7 @@ namespace HISP.Player
|
|||
|
||||
Friends = new Friends(this);
|
||||
LoginTime = DateTime.UtcNow;
|
||||
LoggedinClient = baseClient;
|
||||
Client = baseClient;
|
||||
Inventory = new PlayerInventory(this);
|
||||
Quests = new PlayerQuests(this);
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.8.58.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.58.0")]
|
||||
[assembly: AssemblyVersion("1.8.59.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.59.0")]
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3545,8 +3545,6 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void SetJewelrySlot1(int playerId, int itemId)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
|
@ -4145,7 +4143,24 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
|
||||
public static bool IsUserAdmin(int playerId)
|
||||
|
||||
public static bool GetUserModerator(int playerId)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
db.Open();
|
||||
DbCommand sqlCommand = db.CreateCommand();
|
||||
|
||||
sqlCommand.CommandText = "SELECT Moderator FROM Users WHERE Id=@playerId";
|
||||
addWithValue(sqlCommand, "@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
bool admin = sqlCommand.ExecuteScalar().ToString() == "YES";
|
||||
|
||||
|
||||
return admin;
|
||||
}
|
||||
}
|
||||
public static bool GetUserAdmin(int playerId)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
|
@ -4161,7 +4176,7 @@ namespace HISP.Server
|
|||
return admin;
|
||||
}
|
||||
}
|
||||
public static bool IsUserSubscribed(int playerId)
|
||||
public static bool GetUserSubscribed(int playerId)
|
||||
{
|
||||
if (ConfigReader.AllUsersSubbed)
|
||||
return true;
|
||||
|
@ -4456,6 +4471,38 @@ namespace HISP.Server
|
|||
|
||||
}
|
||||
}
|
||||
public static void SetUserMod(int playerId, bool moderator)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
db.Open();
|
||||
DbCommand sqlCommand = db.CreateCommand();
|
||||
string yesno = (moderator ? "YES" : "NO");
|
||||
|
||||
sqlCommand.CommandText = "UPDATE Users SET Moderator=@moderator WHERE Id=@playerId";
|
||||
addWithValue(sqlCommand, "@playerId", playerId);
|
||||
addWithValue(sqlCommand, "@moderator", yesno);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetUserAdmin(int playerId, bool admin)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
db.Open();
|
||||
DbCommand sqlCommand = db.CreateCommand();
|
||||
string yesno = (admin ? "YES" : "NO");
|
||||
|
||||
sqlCommand.CommandText = "UPDATE Users SET Admin=@admin WHERE Id=@playerId";
|
||||
addWithValue(sqlCommand, "@playerId", playerId);
|
||||
addWithValue(sqlCommand, "@admin", yesno);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetNpcX(int npcId, int x)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
|
@ -4854,7 +4901,7 @@ namespace HISP.Server
|
|||
}
|
||||
|
||||
|
||||
public static bool CheckUserIsModerator(string username)
|
||||
public static bool CheckUsernameIsModerator(string username)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
|
@ -4878,7 +4925,7 @@ namespace HISP.Server
|
|||
}
|
||||
|
||||
|
||||
public static bool CheckUserIsAdmin(string username)
|
||||
public static bool CheckUsernameIsAdmin(string username)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
|
||||
private Transport networkTransport;
|
||||
private ITransport networkTransport;
|
||||
|
||||
private bool loggedIn = false;
|
||||
|
||||
|
@ -38,9 +38,9 @@ namespace HISP.Server
|
|||
get
|
||||
{
|
||||
bool login = loggedIn;
|
||||
if (LoggedinUser == null)
|
||||
if (User == null)
|
||||
return false;
|
||||
if (LoggedinUser.LoggedinClient == null)
|
||||
if (User.Client == null)
|
||||
return false;
|
||||
return login;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace HISP.Server
|
|||
loggedIn = value;
|
||||
}
|
||||
}
|
||||
public User LoggedinUser;
|
||||
public User User;
|
||||
|
||||
private Timer keepAliveTimer;
|
||||
private Timer timeoutTimer;
|
||||
|
@ -93,11 +93,11 @@ namespace HISP.Server
|
|||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
ItemInstance rubyItem = new ItemInstance(Item.Ruby);
|
||||
client.LoggedinUser.Inventory.AddIgnoringFull(rubyItem);
|
||||
client.User.Inventory.AddIgnoringFull(rubyItem);
|
||||
}
|
||||
|
||||
client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
|
||||
Logger.DebugPrint("Kicking: " + client.LoggedinUser.Username);
|
||||
client.User.TrackedItems.GetTrackedItem(Tracking.TrackableItem.GameUpdates).Count++;
|
||||
Logger.DebugPrint("Kicking: " + client.User.Username);
|
||||
}
|
||||
client.Kick("Server shutdown: "+reason);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ namespace HISP.Server
|
|||
|
||||
private void keepAliveTick(object state)
|
||||
{
|
||||
Logger.DebugPrint("Sending keep-alive packet to " + LoggedinUser.Username);
|
||||
Logger.DebugPrint("Sending keep-alive packet to " + User.Username);
|
||||
byte[] updatePacket = PacketBuilder.CreateKeepAlive();
|
||||
SendPacket(updatePacket);
|
||||
keepAliveTimer.Change(oneMinute, oneMinute);
|
||||
|
@ -182,20 +182,20 @@ namespace HISP.Server
|
|||
|
||||
GameServer.UpdatePlayer(this);
|
||||
|
||||
LoggedinUser.CanUseAdsChat = true;
|
||||
LoggedinUser.FreeMinutes -= 1;
|
||||
User.CanUseAdsChat = true;
|
||||
User.FreeMinutes -= 1;
|
||||
|
||||
GameServer.DoItemPurchases(this);
|
||||
|
||||
if (totalMinutesElapsed % 2 == 0)
|
||||
{
|
||||
LoggedinUser.TotalGlobalChatMessages++;
|
||||
User.TotalGlobalChatMessages++;
|
||||
}
|
||||
|
||||
if (LoggedinUser.FreeMinutes <= 0)
|
||||
if (User.FreeMinutes <= 0)
|
||||
{
|
||||
LoggedinUser.FreeMinutes = 0;
|
||||
if (!LoggedinUser.Subscribed && !LoggedinUser.Moderator && !LoggedinUser.Administrator)
|
||||
User.FreeMinutes = 0;
|
||||
if (!User.Subscribed && !User.Moderator && !User.Administrator)
|
||||
{
|
||||
Kick(Messages.KickReasonNoTime);
|
||||
return;
|
||||
|
@ -214,11 +214,11 @@ namespace HISP.Server
|
|||
|
||||
if (GameServer.RandomNumberGenerator.Next(0, 100) == 59) // RANDOM EVENT HAS OCCURED!
|
||||
{
|
||||
RandomEvent.ExecuteRandomEvent(LoggedinUser);
|
||||
RandomEvent.ExecuteRandomEvent(User);
|
||||
}
|
||||
|
||||
bool gotoPrision = false;
|
||||
foreach(HorseInstance horse in LoggedinUser.HorseInventory.HorseList)
|
||||
foreach(HorseInstance horse in User.HorseInventory.HorseList)
|
||||
{
|
||||
if (totalMinutesElapsed % 2 == 0)
|
||||
{
|
||||
|
@ -290,28 +290,28 @@ namespace HISP.Server
|
|||
SendPacket(horseReturned);
|
||||
|
||||
if(tpX != 0 && tpY != 0)
|
||||
LoggedinUser.Teleport(tpX, tpY);
|
||||
User.Teleport(tpX, tpY);
|
||||
|
||||
|
||||
if (LoggedinUser.CurrentlyRidingHorse != null)
|
||||
if (User.CurrentlyRidingHorse != null)
|
||||
{
|
||||
if(LoggedinUser.CurrentlyRidingHorse.RandomId == horse.RandomId)
|
||||
if(User.CurrentlyRidingHorse.RandomId == horse.RandomId)
|
||||
{
|
||||
GameServer.StopRidingHorse(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(LoggedinUser.LastViewedHorse != null)
|
||||
if(User.LastViewedHorse != null)
|
||||
{
|
||||
if(LoggedinUser.LastViewedHorse.RandomId == horse.RandomId)
|
||||
if(User.LastViewedHorse.RandomId == horse.RandomId)
|
||||
{
|
||||
LoggedinUser.LastViewedHorse = null;
|
||||
User.LastViewedHorse = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LoggedinUser.HorseInventory.DeleteHorse(horse);
|
||||
User.HorseInventory.DeleteHorse(horse);
|
||||
}
|
||||
|
||||
|
||||
|
@ -322,18 +322,18 @@ namespace HISP.Server
|
|||
{
|
||||
byte[] sendToPrision = PacketBuilder.CreateChat(Messages.YouWereSentToPrisionIsle, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
SendPacket(sendToPrision);
|
||||
LoggedinUser.Teleport(45, 35);
|
||||
User.Teleport(45, 35);
|
||||
}
|
||||
|
||||
|
||||
if (totalMinutesElapsed % 5 == 0)
|
||||
LoggedinUser.Thirst--;
|
||||
User.Thirst--;
|
||||
|
||||
if (totalMinutesElapsed % 15 == 0)
|
||||
LoggedinUser.Hunger--;
|
||||
User.Hunger--;
|
||||
|
||||
if (totalMinutesElapsed % 15 == 0)
|
||||
LoggedinUser.Tiredness--;
|
||||
User.Tiredness--;
|
||||
}
|
||||
|
||||
minuteTimer.Change(oneMinute, oneMinute);
|
||||
|
@ -345,7 +345,7 @@ namespace HISP.Server
|
|||
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatIdleWarningMessage(), PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
SendPacket(chatPacket);
|
||||
if (LoggedIn)
|
||||
LoggedinUser.Idle = true;
|
||||
User.Idle = true;
|
||||
}
|
||||
|
||||
private void kickTimerTick(object state)
|
||||
|
@ -363,12 +363,12 @@ namespace HISP.Server
|
|||
{
|
||||
if (Client.LoggedIn)
|
||||
{
|
||||
if (Client.LoggedinUser.Id == id)
|
||||
if (Client.User.Id == id)
|
||||
Client.Kick(Messages.KickReasonDuplicateLogin);
|
||||
}
|
||||
}
|
||||
|
||||
LoggedinUser = new User(this, id);
|
||||
User = new User(this, id);
|
||||
LoggedIn = true;
|
||||
|
||||
Database.SetIpAddress(id, RemoteIp);
|
||||
|
@ -404,7 +404,7 @@ namespace HISP.Server
|
|||
if (keepAliveTimer != null && identifier != PacketBuilder.PACKET_KEEP_ALIVE)
|
||||
{
|
||||
if (LoggedIn)
|
||||
LoggedinUser.Idle = false;
|
||||
User.Idle = false;
|
||||
keepAliveTimer.Change(oneMinute, oneMinute);
|
||||
}
|
||||
else
|
||||
|
@ -547,6 +547,7 @@ namespace HISP.Server
|
|||
|
||||
public void SendPacket(byte[] packetData)
|
||||
{
|
||||
if(!networkTransport.Disconnected)
|
||||
networkTransport.Send(packetData);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ namespace HISP.Server
|
|||
{
|
||||
public class GameDataJson
|
||||
{
|
||||
private static dynamic gameData;
|
||||
public static void ReadGamedata()
|
||||
{
|
||||
dynamic gameData;
|
||||
Logger.DebugPrint("Reading GAMEDATA");
|
||||
if (Directory.Exists(ConfigReader.GameData))
|
||||
{
|
||||
|
@ -158,10 +158,10 @@ namespace HISP.Server
|
|||
int totalReasons = gameData.messages.chat.reason_messages.Count;
|
||||
for (int i = 0; i < totalReasons; i++)
|
||||
{
|
||||
Chat.Reason reason = new Chat.Reason();
|
||||
ChatMsg.Reason reason = new ChatMsg.Reason();
|
||||
reason.Name = gameData.messages.chat.reason_messages[i].name;
|
||||
reason.Message = gameData.messages.chat.reason_messages[i].message;
|
||||
Chat.AddReason(reason);
|
||||
ChatMsg.AddReason(reason);
|
||||
|
||||
Logger.DebugPrint("Registered Chat Warning Reason: " + reason.Name + " (Message: " + reason.Message + ")");
|
||||
}
|
||||
|
@ -170,11 +170,11 @@ namespace HISP.Server
|
|||
int totalFilters = gameData.messages.chat.filter.Count;
|
||||
for (int i = 0; i < totalFilters; i++)
|
||||
{
|
||||
Chat.Filter filter = new Chat.Filter();
|
||||
ChatMsg.Filter filter = new ChatMsg.Filter();
|
||||
filter.FilteredWord = gameData.messages.chat.filter[i].word;
|
||||
filter.MatchAll = gameData.messages.chat.filter[i].match_all;
|
||||
filter.Reason = Chat.GetReason((string)gameData.messages.chat.filter[i].reason_type);
|
||||
Chat.AddFilter(filter);
|
||||
filter.Reason = ChatMsg.GetReason((string)gameData.messages.chat.filter[i].reason_type);
|
||||
ChatMsg.AddFilter(filter);
|
||||
|
||||
Logger.DebugPrint("Registered Filtered Word: " + filter.FilteredWord + " With reason: " + filter.Reason.Name + " (Matching all: " + filter.MatchAll + ")");
|
||||
}
|
||||
|
@ -183,10 +183,10 @@ namespace HISP.Server
|
|||
int totalCorrections = gameData.messages.chat.correct.Count;
|
||||
for (int i = 0; i < totalCorrections; i++)
|
||||
{
|
||||
Chat.Correction correction = new Chat.Correction();
|
||||
ChatMsg.Correction correction = new ChatMsg.Correction();
|
||||
correction.FilteredWord = gameData.messages.chat.correct[i].word;
|
||||
correction.ReplacedWord = gameData.messages.chat.correct[i].new_word;
|
||||
Chat.AddCorrection(correction);
|
||||
ChatMsg.AddCorrection(correction);
|
||||
|
||||
Logger.DebugPrint("Registered Word Correction: " + correction.FilteredWord + " to " + correction.ReplacedWord);
|
||||
}
|
||||
|
@ -468,10 +468,22 @@ namespace HISP.Server
|
|||
Logger.DebugPrint("Registered Abuse Report Reason: " + reason.Name);
|
||||
}
|
||||
|
||||
// Map Data
|
||||
/// Map Data
|
||||
|
||||
Map.OverlayTileDepth = gameData.tile_paramaters.overlay_tiles.tile_depth.ToObject<int[]>();
|
||||
// Overlay tile depth;
|
||||
List<Map.TileDepth> overlayTilesDepth = new List<Map.TileDepth>();
|
||||
int totalOverlayTileDepth = gameData.tile_paramaters.overlay_tiles.Count;
|
||||
for (int i = 0; i < totalOverlayTileDepth; i++)
|
||||
{
|
||||
Map.TileDepth tileDepth = new Map.TileDepth();
|
||||
tileDepth.Passable = gameData.tile_paramaters.overlay_tiles[i].passable;
|
||||
tileDepth.ShowPlayer = gameData.tile_paramaters.overlay_tiles[i].show_player;
|
||||
Logger.DebugPrint("Registered Overlay Tile: " + i + " Depth; Passable: " + tileDepth.Passable + " ShowPlayer: " + tileDepth.ShowPlayer);
|
||||
overlayTilesDepth.Add(tileDepth);
|
||||
}
|
||||
Map.OverlayTileDepth = overlayTilesDepth.ToArray();
|
||||
|
||||
// Terrain tile types and passable;
|
||||
List<Map.TerrainTile> terrainTiles = new List<Map.TerrainTile>();
|
||||
int totalTerrainTiles = gameData.tile_paramaters.terrain_tiles.Count;
|
||||
for (int i = 0; i < totalTerrainTiles; i++)
|
||||
|
@ -479,7 +491,7 @@ namespace HISP.Server
|
|||
Map.TerrainTile tile = new Map.TerrainTile();
|
||||
tile.Passable = gameData.tile_paramaters.terrain_tiles[i].passable;
|
||||
tile.Type = gameData.tile_paramaters.terrain_tiles[i].tile_type;
|
||||
Logger.DebugPrint("Registered Tile: " + i + " Passable: " + tile.Passable + " Type: " + tile.Type);
|
||||
Logger.DebugPrint("Registered Tile Information: " + i + " Passable: " + tile.Passable + " Type: " + tile.Type);
|
||||
terrainTiles.Add(tile);
|
||||
}
|
||||
Map.TerrainTiles = terrainTiles.ToArray();
|
||||
|
@ -939,7 +951,7 @@ namespace HISP.Server
|
|||
GameServer.IdleWarning = Convert.ToInt32(gameData.messages.disconnect.client_timeout.warn_after);
|
||||
GameServer.IdleTimeout = Convert.ToInt32(gameData.messages.disconnect.client_timeout.kick_after);
|
||||
|
||||
Chat.PrivateMessageSound = gameData.messages.chat.pm_sound;
|
||||
ChatMsg.PrivateMessageSound = gameData.messages.chat.pm_sound;
|
||||
|
||||
// New Users
|
||||
|
||||
|
@ -947,6 +959,9 @@ namespace HISP.Server
|
|||
Map.NewUserStartX = gameData.messages.new_user.starting_x;
|
||||
Map.NewUserStartY = gameData.messages.new_user.starting_y;
|
||||
|
||||
// HISP Specific ...
|
||||
Messages.HISPHelpCommandUsageFormat = gameData.hisp_specific.HISP_help_command_usage_format;
|
||||
|
||||
// Timed Messages
|
||||
|
||||
Messages.PlaytimeMessageFormat = gameData.messages.timed_messages.playtime_message;
|
||||
|
|
File diff suppressed because it is too large
Load diff
55
HorseIsleServer/LibHISP/Server/Network/NullSocket.cs
Normal file
55
HorseIsleServer/LibHISP/Server/Network/NullSocket.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
// A transport that does absolutely nothing.
|
||||
// only use this for testing.
|
||||
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace HISP.Server.Network
|
||||
{
|
||||
public class NullSocket : ITransport
|
||||
{
|
||||
private bool disconnected = false;
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return "NullSocket";
|
||||
}
|
||||
}
|
||||
public bool Disconnected
|
||||
{
|
||||
get
|
||||
{
|
||||
return disconnected;
|
||||
}
|
||||
set
|
||||
{
|
||||
disconnected = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Ip
|
||||
{
|
||||
get
|
||||
{
|
||||
return IPAddress.Loopback.MapToIPv4().ToString();
|
||||
}
|
||||
}
|
||||
public void Accept(Socket socket, Action<byte[]> onReceive, Action onDisconnect)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public void Disconnect()
|
||||
{
|
||||
disconnected = true;
|
||||
return;
|
||||
}
|
||||
|
||||
public void Send(byte[] data)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,7 +6,6 @@ using System.Text;
|
|||
using HISP.Game;
|
||||
using HISP.Game.SwfModules;
|
||||
using HISP.Util;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
public class PacketBuilder
|
||||
|
@ -14,6 +13,7 @@ namespace HISP.Server
|
|||
public const int PACKET_CLIENT_TERMINATOR_LENGTH = 1;
|
||||
public const byte PACKET_CLIENT_TERMINATOR = 0x0A;
|
||||
|
||||
// hi1 packets
|
||||
public const byte PACKET_LOGIN = 0x7F;
|
||||
public const byte PACKET_CHAT = 0x14;
|
||||
public const byte PACKET_MOVE = 0x15;
|
||||
|
@ -802,13 +802,28 @@ namespace HISP.Server
|
|||
// Creates a byte array of a packet informing the client of Tile Overlay flags
|
||||
// these tell the client what tiles are and are not passable, which ones the player
|
||||
// should appear ontop of or under, and stuff like that.
|
||||
public static byte[] CreateTileOverlayFlags(int[] tileDepthFlags)
|
||||
public static byte[] CreateTileOverlayFlags(Map.TileDepth[] tileDepthFlags)
|
||||
{
|
||||
byte[] packet = new byte[1 + tileDepthFlags.Length];
|
||||
packet[0] = PACKET_TILE_FLAGS;
|
||||
|
||||
for(int i = 0; i < tileDepthFlags.Length; i++)
|
||||
packet[1 + i] = (byte)(tileDepthFlags[i].ToString()[0]);
|
||||
{
|
||||
int flag;
|
||||
|
||||
if (!tileDepthFlags[i].ShowPlayer && !tileDepthFlags[i].Passable)
|
||||
flag = 0;
|
||||
else if (tileDepthFlags[i].ShowPlayer && !tileDepthFlags[i].Passable)
|
||||
flag = 1;
|
||||
else if (!tileDepthFlags[i].ShowPlayer && tileDepthFlags[i].Passable)
|
||||
flag = 2;
|
||||
else if (tileDepthFlags[i].ShowPlayer && tileDepthFlags[i].Passable)
|
||||
flag = 3;
|
||||
else
|
||||
throw new Exception("Somehow, showplayers was not true or false, and passable was not true or false, this should be impossible");
|
||||
|
||||
packet[1 + i] = Convert.ToByte(flag.ToString()[0]);
|
||||
}
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
|
|
@ -277,9 +277,12 @@ namespace HTTP
|
|||
|
||||
public void Shutdown() {
|
||||
shutdownServer = true;
|
||||
if(ServerSocket != null)
|
||||
{
|
||||
ServerSocket.Dispose();
|
||||
ServerSocket = null;
|
||||
}
|
||||
}
|
||||
private bool shutdownServer = false;
|
||||
public string ipaddr;
|
||||
public short portnum;
|
||||
|
|
|
@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.8.58.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.58.0")]
|
||||
[assembly: AssemblyVersion("1.8.59.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.59.0")]
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue