HISP/Horse Isle Server/Horse Isle Server/Messages.cs
2020-10-20 01:05:32 +13:00

215 lines
8.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Horse_Isle_Server
{
class Messages
{
// Announcements
public static string NewUserMessage;
public static string WelcomeFormat;
public static string MotdFormat;
public static string IdleWarningFormat;
public static string LoginMessageForamt;
public static string LogoutMessageFormat;
// Records
public static string ProfileSavedMessage;
// Chat
public static string GlobalChatFormat;
public static string AdsChatFormat;
public static string BuddyChatFormat;
public static string NearChatFormat;
public static string IsleChatFormat;
public static string HereChatFormat;
public static string DirectChatFormat;
public static string ModChatFormat;
public static string AdminChatFormat;
public static string GlobalChatFormatForModerators;
public static string DirectChatFormatForModerators;
public static string IsleChatFormatForSender;
public static string NearChatFormatForSender;
public static string HereChatFormatForSender;
public static string BuddyChatFormatForSender;
public static string DirectChatFormatForSender;
public static string AdminChatFormatForSender;
public static string ModChatFormatForSender;
public static string ChatViolationMessageFormat;
public static int RequiredChatViolations;
public static string PasswordNotice;
public static string CapsNotice;
// Meta
public static string IsleFormat;
public static string TownFormat;
public static string AreaFormat;
public static string LocationFormat;
public static string TransportFormat;
public static string NearbyPlayers;
public static string North;
public static string East;
public static string South;
public static string West;
public static string TileFormat;
public static string NothingMessage;
public static string Seperator;
public static string ExitThisPlace;
public static string MetaTerminator;
// Disconnect Messages
public static string BanMessage;
public static string IdleKickMessageFormat;
// Swf
public static string BoatCutscene;
public static string WagonCutscene;
public static string BallonCutscene;
public static string FormatGlobalChatViolationMessage(Chat.Reason violationReason)
{
return ChatViolationMessageFormat.Replace("%AMOUNT%", RequiredChatViolations.ToString()).Replace("%REASON%", violationReason.Message);
}
// Meta
public static string FormatTransportMessage(string method, string place, int cost, int id, int x, int y)
{
byte[] xy = new byte[4];
xy[0] = (byte)(((x - 4) / 64) + 20);
xy[1] = (byte)(((x - 4) % 64) + 20);
xy[2] = (byte)(((y - 1) / 64) + 20);
xy[3] = (byte)(((y - 1) % 64) + 20);
int iconId = 253;
if(method == "WAGON")
iconId = 254;
return TransportFormat.Replace("%METHOD%", method).Replace("%PLACE%", place).Replace("%COST%", cost.ToString()).Replace("%ID%", id.ToString()).Replace("%ICON%",iconId.ToString()).Replace(" % XY%",Encoding.UTF8.GetString(xy));
}
// For all
public static string FormatGlobalChatMessage(string username, string message)
{
return GlobalChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatBuddyChatMessage(string username, string message)
{
return BuddyChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatIsleChatMessage(string username, string message)
{
return IsleChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatNearbyChatMessage(string username, string message)
{
return NearChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatHereChatMessage(string username, string message)
{
return HereChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatDirectMessage(string username, string message)
{
return DirectChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatDirectMessageForMod(string username, string message)
{
return DirectChatFormatForModerators.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatGlobalChatMessageForMod(string username, string message)
{
return GlobalChatFormatForModerators.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatAdsChatMessage(string username, string message)
{
return AdsChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatModChatMessage(string username, string message)
{
return ModChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
public static string FormatAdminChatMessage(string username, string message)
{
return AdminChatFormat.Replace("%USERNAME%", username).Replace("%MESSAGE%", message);
}
// For Sender
public static string FormatBuddyChatMessageForSender(int numbBuddies, string username, string message)
{
return BuddyChatFormatForSender.Replace("%USERNAME%", username).Replace("%MESSAGE%", message).Replace("%AMOUNT%", numbBuddies.ToString());
}
public static string FormatHereChatMessageForSender(int numbHere, string username, string message)
{
return HereChatFormatForSender.Replace("%USERNAME%", username).Replace("%MESSAGE%", message).Replace("%AMOUNT%", numbHere.ToString());
}
public static string FormatNearChatMessageForSender(int numbNear, string username, string message)
{
return NearChatFormatForSender.Replace("%USERNAME%", username).Replace("%MESSAGE%", message).Replace("%AMOUNT%", numbNear.ToString());
}
public static string FormatIsleChatMessageForSender(int numbIsle, string username, string message)
{
return IsleChatFormatForSender.Replace("%USERNAME%", username).Replace("%MESSAGE%", message).Replace("%AMOUNT%", numbIsle.ToString());
}
public static string FormatAdminChatForSender(int numbAdmins, string username, string message)
{
return AdminChatFormatForSender.Replace("%USERNAME%", username).Replace("%MESSAGE%", message).Replace("%AMOUNT%", numbAdmins.ToString());
}
public static string FormatModChatForSender(int numbMods, string username, string message)
{
return ModChatFormatForSender.Replace("%USERNAME%", username).Replace("%MESSAGE%", message).Replace("%AMOUNT%", numbMods.ToString());
}
public static string FormatDirectChatMessageForSender(string username,string toUsername, string message)
{
return DirectChatFormatForSender.Replace("%FROMUSER%", username).Replace("%TOUSER%", toUsername).Replace(" %MESSAGE%", message);
}
public static string FormatIdleWarningMessage()
{
return IdleWarningFormat.Replace("%WARN%", Server.IdleWarning.ToString()).Replace("%KICK%", Server.IdleTimeout.ToString());
}
public static string FormatLoginMessage(string username)
{
return LoginMessageForamt.Replace("%USERNAME%", username);
}
public static string FormatLogoutMessage(string username)
{
return LogoutMessageFormat.Replace("%USERNAME%", username);
}
public static string FormatMOTD()
{
return MotdFormat.Replace("%MOTD%", ConfigReader.Motd);
}
public static string FormatWelcomeMessage(string username)
{
return WelcomeFormat.Replace("%USERNAME%", username);
}
// Disconnect
public static string FormatIdleKickMessage()
{
return IdleKickMessageFormat.Replace("%KICK%", Server.IdleTimeout.ToString());
}
}
}