add build script

This commit is contained in:
Li 2022-05-08 12:21:33 +12:00
parent 063c267755
commit bf4d5f5005
14 changed files with 8903 additions and 9004 deletions

View file

@ -38,11 +38,6 @@ Global
MacOS|ARM64 = MacOS|ARM64
MacOS|x64 = MacOS|x64
MacOS|x86 = MacOS|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
Windows|Any CPU = Windows|Any CPU
Windows|ARM = Windows|ARM
Windows|ARM64 = Windows|ARM64
@ -98,16 +93,6 @@ Global
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x64.Build.0 = MacOS|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.ActiveCfg = MacOS|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.Build.0 = MacOS|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|Any CPU.ActiveCfg = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|Any CPU.Build.0 = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM.ActiveCfg = Windows|ARM
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM.Build.0 = Windows|ARM
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM64.ActiveCfg = Windows|ARM64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM64.Build.0 = Windows|ARM64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x64.ActiveCfg = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x64.Build.0 = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x86.ActiveCfg = Debug|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x86.Build.0 = Debug|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.ActiveCfg = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.Build.0 = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|ARM.ActiveCfg = Windows|ARM
@ -166,16 +151,6 @@ Global
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x64.Build.0 = MacOS|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.ActiveCfg = MacOS|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.Build.0 = MacOS|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|Any CPU.ActiveCfg = Linux|Any CPU
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|Any CPU.Build.0 = Linux|Any CPU
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM.ActiveCfg = Debug|ARM
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM.Build.0 = Debug|ARM
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM64.ActiveCfg = Debug|ARM64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM64.Build.0 = Debug|ARM64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x64.ActiveCfg = Windows|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x64.Build.0 = Windows|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x86.ActiveCfg = Debug|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x86.Build.0 = Debug|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.ActiveCfg = Debug|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.Build.0 = Debug|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|ARM.ActiveCfg = Windows|Any CPU
@ -216,16 +191,6 @@ Global
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|ARM64.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|x64.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|x86.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|Any CPU.ActiveCfg = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|Any CPU.Build.0 = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM.ActiveCfg = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM.Build.0 = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM64.ActiveCfg = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|ARM64.Build.0 = Windows|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x64.ActiveCfg = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x64.Build.0 = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x86.ActiveCfg = Debug|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Release|x86.Build.0 = Debug|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|Any CPU.ActiveCfg = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|Any CPU.Build.0 = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|ARM.ActiveCfg = Windows|Any CPU
@ -234,7 +199,7 @@ Global
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x64.Build.0 = Windows|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.ActiveCfg = Windows|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.Build.0 = Windows|x86
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|Any CPU.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|Any CPU.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|ARM.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|ARM64.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|x64.ActiveCfg = Windows
@ -259,17 +224,7 @@ Global
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|ARM64.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|x64.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|x86.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|Any CPU.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|Any CPU.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|ARM64.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x64.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x86.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|x86.Build.0 = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|Any CPU.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|Any CPU.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|ARM.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|ARM64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|x64.ActiveCfg = Windows

View file

@ -1,7 +1,7 @@
Package: hisp
Version: 1.6.2
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev
Version: $VERSION
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
Maintainer: Li
Homepage: https://islehorse.com
Architecture: amd64
Description: Open Source Implementation of the flash game "Horse Isle" server.
Description: Open Source Implementation of the server for flash game "Horse Isle".

View file

@ -1,94 +1,94 @@
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using HISP.Player;
using HISP.Server;
namespace HISP.Game.Chat
{
public class Chat
{
public struct Correction
{
public string FilteredWord;
public string ReplacedWord;
}
public struct Reason
{
public string Name;
public string Message;
}
public struct Filter
{
public string FilteredWord;
public Reason Reason;
public bool MatchAll;
}
public enum ChatChannel
{
All = 0x14,
Ads = 0x1D,
Near = 0x15,
Buddies = 0x17,
Here = 0x18,
Isle = 0x1A,
Dm = 0x16,
Mod = 0x1c,
Admin = 0x1b
}
public static string PrivateMessageSound;
private static List<Filter> filteredWords = new List<Filter>();
private static List<Correction> correctedWords = new List<Correction>();
private static List<Reason> reasons = new List<Reason>();
public static void AddFilter(Filter filter)
{
filteredWords.Add(filter);
}
public static void AddCorrection(Correction correction)
{
correctedWords.Add(correction);
}
public static void AddReason(Reason reason)
{
reasons.Add(reason);
}
public static Filter[] FilteredWords
{
get
{
return filteredWords.ToArray();
}
}
public static Correction[] CorrectedWords
{
get
{
return correctedWords.ToArray();
}
}
public static Reason[] Reasons
{
get
{
return reasons.ToArray();
}
}
public static bool ProcessCommand(User user, string message)
{
if (message.Length < 1)
using System.Linq;
using HISP.Player;
using HISP.Server;
namespace HISP.Game.Chat
{
public class Chat
{
public struct Correction
{
public string FilteredWord;
public string ReplacedWord;
}
public struct Reason
{
public string Name;
public string Message;
}
public struct Filter
{
public string FilteredWord;
public Reason Reason;
public bool MatchAll;
}
public enum ChatChannel
{
All = 0x14,
Ads = 0x1D,
Near = 0x15,
Buddies = 0x17,
Here = 0x18,
Isle = 0x1A,
Dm = 0x16,
Mod = 0x1c,
Admin = 0x1b
}
public static string PrivateMessageSound;
private static List<Filter> filteredWords = new List<Filter>();
private static List<Correction> correctedWords = new List<Correction>();
private static List<Reason> reasons = new List<Reason>();
public static void AddFilter(Filter filter)
{
filteredWords.Add(filter);
}
public static void AddCorrection(Correction correction)
{
correctedWords.Add(correction);
}
public static void AddReason(Reason reason)
{
reasons.Add(reason);
}
public static Filter[] FilteredWords
{
get
{
return filteredWords.ToArray();
}
}
public static Correction[] CorrectedWords
{
get
{
return correctedWords.ToArray();
}
}
public static Reason[] Reasons
{
get
{
return reasons.ToArray();
}
}
public static bool ProcessCommand(User user, string message)
{
if (message.Length < 1)
return false;
string parsedMessage = message;
parsedMessage = parsedMessage.Trim();
parsedMessage = parsedMessage.Trim();
char cLetter = parsedMessage[0];
parsedMessage = parsedMessage.Substring(1).Trim();
@ -105,405 +105,405 @@ namespace HISP.Game.Chat
return cmd.CmdCallback(messageToGive, args, user);
}
}
}
return false;
}
public static Object FilterMessage(string message) // Handles chat filtering and violation stuffs
{
if (!ConfigReader.BadWords) // Freedom of Speech Mode
return null;
string[] wordsSaid;
if (message.Contains(' '))
wordsSaid = message.Split(' ');
else
wordsSaid = new string[] { message };
foreach(Filter filter in FilteredWords)
{
if (!filter.MatchAll)
{
foreach (string word in wordsSaid)
{
if (word.ToLower() == filter.FilteredWord.ToLower())
return filter.Reason;
}
}
else
{
if (message.ToLower().Contains(filter.FilteredWord))
return filter.Reason;
}
}
return null;
}
public static byte GetSide(ChatChannel channel)
{
switch (channel)
{
case ChatChannel.All:
case ChatChannel.Ads:
case ChatChannel.Isle:
return PacketBuilder.CHAT_BOTTOM_LEFT;
case ChatChannel.Buddies:
case ChatChannel.Here:
case ChatChannel.Admin:
case ChatChannel.Mod:
return PacketBuilder.CHAT_BOTTOM_RIGHT;
case ChatChannel.Dm:
return PacketBuilder.CHAT_DM_RIGHT;
default:
Logger.ErrorPrint("unknown channel: " + (byte)channel);
return PacketBuilder.CHAT_BOTTOM_LEFT;
}
}
public static string GetDmRecipiant(string message)
{
if(message.Contains('|'))
{
string recipiantName = message.Split('|')[0];
return recipiantName;
}
else
{
return null;
}
}
public static string GetDmMessage(string message)
{
if (message.Contains('|'))
{
string messageStr = message.Split('|')[1];
return messageStr;
}
else
{
return message;
}
}
public static GameClient[] GetRecipiants(User user, ChatChannel channel, string to=null)
{
if (channel == ChatChannel.All)
{
List<GameClient> recipiants = new List<GameClient>();
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))
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Ads)
{
List<GameClient> recipiants = new List<GameClient>();
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))
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Buddies)
{
List<GameClient> recipiants = new List<GameClient>();
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))
recipiants.Add(client);
}
return recipiants.ToArray();
}
if (channel == ChatChannel.Isle)
{
List<GameClient> recipiants = new List<GameClient>();
if(World.InIsle(user.X,user.Y))
{
User[] usersInSile = GameServer.GetUsersInIsle(World.GetIsle(user.X, user.Y), true, false);
foreach (User userInIsle in usersInSile)
{
if (user.Id != userInIsle.Id)
if(!userInIsle.MuteAll && !userInIsle.MuteIsland)
if(!userInIsle.MutePlayer.IsUserMuted(user))
recipiants.Add(userInIsle.LoggedinClient);
}
return recipiants.ToArray();
}
else
{
return new GameClient[0];
}
}
if (channel == ChatChannel.Here)
{
List<GameClient> recipiants = new List<GameClient>();
User[] usersHere = GameServer.GetUsersAt(user.X, user.Y, true, false);
foreach (User userHere in usersHere)
{
if (user.Id != userHere.Id)
if (!userHere.MuteAll && !userHere.MuteHere)
if (!userHere.MutePlayer.IsUserMuted(user))
recipiants.Add(userHere.LoggedinClient);
}
return recipiants.ToArray();
}
if (channel == ChatChannel.Near)
{
List<GameClient> recipiants = new List<GameClient>();
User[] nearbyUsers = GameServer.GetNearbyUsers(user.X, user.Y, true, false);
foreach (User nearbyUser in nearbyUsers)
{
if (user.Id != nearbyUser.Id)
if (!nearbyUser.MuteAll && !nearbyUser.MuteNear)
if (!nearbyUser.MutePlayer.IsUserMuted(user))
recipiants.Add(nearbyUser.LoggedinClient);
}
return recipiants.ToArray();
}
if (channel == ChatChannel.Mod)
{
if (!user.Moderator && !user.Administrator) // No mod chat for non-mods!
{
Logger.WarnPrint(user.Username + " attempted to send in MOD chat, without being a MOD.");
return new GameClient[0];
}
List<GameClient> recipiants = new List<GameClient>();
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
if (client.LoggedinUser.Moderator)
if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Admin)
{
if (!user.Administrator) // No admin chat for non-admins!
{
Logger.WarnPrint(user.Username + " attempted to send in ADMIN chat, without being an ADMIN.");
return new GameClient[0];
}
List<GameClient> recipiants = new List<GameClient>();
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
if (client.LoggedinUser.Administrator)
if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Dm)
{
if (to != null && to != "")
{
List<GameClient> recipiants = new List<GameClient>();
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
{
if (!client.LoggedinUser.MutePrivateMessage && !client.LoggedinUser.MuteAll)
{
if (client.LoggedinUser.Username.ToLower().StartsWith(to.ToLower()))
{
recipiants.Add(client);
break;
}
}
}
}
return recipiants.ToArray();
}
else
{
Logger.ErrorPrint("Channel is " + channel + " (DM) BUT no 'to' Paramater was specfied");
return new GameClient[0];
}
}
Logger.ErrorPrint(user.Username + " Sent message in unknown channel: " + (byte)channel);
return new GameClient[0]; // No recipiants
}
public static string DoCorrections(string message)
{
if (!ConfigReader.DoCorrections)
return message;
foreach(Correction correct in CorrectedWords)
message = message.Replace(correct.FilteredWord, correct.ReplacedWord);
return message.Trim();
}
public static string EscapeMessage(string message)
{
return message.Replace("<", "&lt;");
}
public static string FormatChatForOthers(User user, ChatChannel channel, string message, bool autoReply=false)
{
switch (channel)
{
case ChatChannel.All:
if (user.Moderator || user.Administrator)
return Messages.FormatGlobalChatMessageForMod(user.Username, message);
else
return Messages.FormatGlobalChatMessage(user.Username, message);
case ChatChannel.Ads:
return Messages.FormatAdsChatMessage(user.Username, message);
case ChatChannel.Buddies:
return Messages.FormatBuddyChatMessage(user.Username, message);
case ChatChannel.Dm:
string badge = "";
if (user.Moderator || user.Administrator)
badge += Messages.DmModBadge;
if (autoReply)
badge += Messages.DmAutoResponse;
return Messages.FormatDirectMessage(user.Username, message, badge);
case ChatChannel.Near:
return Messages.FormatNearbyChatMessage(user.Username, message);
case ChatChannel.Isle:
return Messages.FormatIsleChatMessage(user.Username, message);
case ChatChannel.Here:
return Messages.FormatHereChatMessage(user.Username, message);
case ChatChannel.Mod:
if (user.Moderator || user.Administrator)
return Messages.FormatModChatMessage(user.Username, message);
else
{
Logger.HackerPrint(user.Username + " Tried to send in mod chat without being a moderator. (Hack/Code Attempt)");
return "";
}
case ChatChannel.Admin:
if (user.Administrator)
return Messages.FormatAdminChatMessage(user.Username, message);
else
{
Logger.HackerPrint(user.Username + " Tried to send in mod chat without being a moderator. (Hack/Code Attempt)");
return "";
}
default:
Logger.ErrorPrint(user.Username + " is trying to end a message in unknown channel " + channel.ToString("X"));
return "not implemented yet :(";
}
}
public static string FormatChatForSender(User user, ChatChannel channel, string message, string dmRecipiant=null, bool autoReply=false)
{
switch (channel)
{
case ChatChannel.All:
if (user.Moderator || user.Administrator)
return Messages.FormatGlobalChatMessageForMod(user.Username, message);
else
return Messages.FormatGlobalChatMessage(user.Username, message);
case ChatChannel.Ads:
int numbListening = GameServer.GetNumberOfPlayersListeningToAdsChat(); // vry specific function ik
return Messages.FormatAdsChatForSender(numbListening-1, user.Username, message);
case ChatChannel.Buddies:
return Messages.FormatBuddyChatMessageForSender(GameServer.GetNumberOfBuddiesOnline(user), user.Username, message);
case ChatChannel.Isle:
int inIsle = 0;
if (World.InIsle(user.X, user.Y))
inIsle = GameServer.GetUsersInIsle(World.GetIsle(user.X, user.Y), false, false).Length -1;
return Messages.FormatIsleChatMessageForSender(inIsle, user.Username, message);
case ChatChannel.Here:
int usersHere = GameServer.GetUsersAt(user.X, user.Y, false, false).Length -1;
return Messages.FormatHereChatMessageForSender(usersHere, user.Username, message);
case ChatChannel.Near:
int nearbyUsers = GameServer.GetNearbyUsers(user.X, user.Y, false, false).Length -1;
return Messages.FormatNearChatMessageForSender(nearbyUsers, user.Username, message);
case ChatChannel.Mod:
int modsOnline = GameServer.GetNumberOfModsOnline() - 1;
return Messages.FormatModChatForSender(modsOnline, user.Username, message);
case ChatChannel.Admin:
int adminsOnline = GameServer.GetNumberOfAdminsOnline() - 1;
return Messages.FormatAdminChatForSender(adminsOnline, user.Username, message);
case ChatChannel.Dm:
string badge = "";
if (user.Moderator || user.Administrator)
badge += Messages.DmModBadge;
if (autoReply)
badge += Messages.DmAutoResponse;
return Messages.FormatDirectChatMessageForSender(user.Username, dmRecipiant, message, badge);
default:
Logger.ErrorPrint(user.Username + " is trying to end a message in unknown channel " + channel.ToString("X"));
return "not implemented yet :(";
}
}
public static string NonViolationChecks(User user, string message)
{
if(!ConfigReader.DoNonViolations)
return null;
// Check if contains password.
if (message.ToLower().Contains(user.Password.ToLower()))
return Messages.PasswordNotice;
// Check if ALL CAPS
string[] wordsSaid;
if (message.Contains(' '))
wordsSaid = message.Split(' ');
else
wordsSaid = new string[] { message };
foreach (string word in wordsSaid)
{
string lettersOnly = "";
foreach(char c in word)
{
if((byte)c >= (byte)'A' && (byte)c <= (byte)'z') // is letter
{
lettersOnly += c;
}
}
if (lettersOnly.ToUpper() == lettersOnly && lettersOnly.Length >= 5)
return Messages.CapsNotice;
}
return null;
}
public static Reason GetReason(string name)
{
foreach (Reason reason in Reasons)
if (reason.Name == name)
return reason;
throw new KeyNotFoundException("Reason " + name + " not found.");
}
}
}
}
return false;
}
public static Object FilterMessage(string message) // Handles chat filtering and violation stuffs
{
if (!ConfigReader.BadWords) // Freedom of Speech Mode
return null;
string[] wordsSaid;
if (message.Contains(' '))
wordsSaid = message.Split(' ');
else
wordsSaid = new string[] { message };
foreach(Filter filter in FilteredWords)
{
if (!filter.MatchAll)
{
foreach (string word in wordsSaid)
{
if (word.ToLower() == filter.FilteredWord.ToLower())
return filter.Reason;
}
}
else
{
if (message.ToLower().Contains(filter.FilteredWord))
return filter.Reason;
}
}
return null;
}
public static byte GetSide(ChatChannel channel)
{
switch (channel)
{
case ChatChannel.All:
case ChatChannel.Ads:
case ChatChannel.Isle:
return PacketBuilder.CHAT_BOTTOM_LEFT;
case ChatChannel.Buddies:
case ChatChannel.Here:
case ChatChannel.Admin:
case ChatChannel.Mod:
return PacketBuilder.CHAT_BOTTOM_RIGHT;
case ChatChannel.Dm:
return PacketBuilder.CHAT_DM_RIGHT;
default:
Logger.ErrorPrint("unknown channel: " + (byte)channel);
return PacketBuilder.CHAT_BOTTOM_LEFT;
}
}
public static string GetDmRecipiant(string message)
{
if(message.Contains('|'))
{
string recipiantName = message.Split('|')[0];
return recipiantName;
}
else
{
return null;
}
}
public static string GetDmMessage(string message)
{
if (message.Contains('|'))
{
string messageStr = message.Split('|')[1];
return messageStr;
}
else
{
return message;
}
}
public static GameClient[] GetRecipiants(User user, ChatChannel channel, string to=null)
{
if (channel == ChatChannel.All)
{
List<GameClient> recipiants = new List<GameClient>();
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))
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Ads)
{
List<GameClient> recipiants = new List<GameClient>();
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))
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Buddies)
{
List<GameClient> recipiants = new List<GameClient>();
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))
recipiants.Add(client);
}
return recipiants.ToArray();
}
if (channel == ChatChannel.Isle)
{
List<GameClient> recipiants = new List<GameClient>();
if(World.InIsle(user.X,user.Y))
{
User[] usersInSile = GameServer.GetUsersInIsle(World.GetIsle(user.X, user.Y), true, false);
foreach (User userInIsle in usersInSile)
{
if (user.Id != userInIsle.Id)
if(!userInIsle.MuteAll && !userInIsle.MuteIsland)
if(!userInIsle.MutePlayer.IsUserMuted(user))
recipiants.Add(userInIsle.LoggedinClient);
}
return recipiants.ToArray();
}
else
{
return new GameClient[0];
}
}
if (channel == ChatChannel.Here)
{
List<GameClient> recipiants = new List<GameClient>();
User[] usersHere = GameServer.GetUsersAt(user.X, user.Y, true, false);
foreach (User userHere in usersHere)
{
if (user.Id != userHere.Id)
if (!userHere.MuteAll && !userHere.MuteHere)
if (!userHere.MutePlayer.IsUserMuted(user))
recipiants.Add(userHere.LoggedinClient);
}
return recipiants.ToArray();
}
if (channel == ChatChannel.Near)
{
List<GameClient> recipiants = new List<GameClient>();
User[] nearbyUsers = GameServer.GetNearbyUsers(user.X, user.Y, true, false);
foreach (User nearbyUser in nearbyUsers)
{
if (user.Id != nearbyUser.Id)
if (!nearbyUser.MuteAll && !nearbyUser.MuteNear)
if (!nearbyUser.MutePlayer.IsUserMuted(user))
recipiants.Add(nearbyUser.LoggedinClient);
}
return recipiants.ToArray();
}
if (channel == ChatChannel.Mod)
{
if (!user.Moderator && !user.Administrator) // No mod chat for non-mods!
{
Logger.WarnPrint(user.Username + " attempted to send in MOD chat, without being a MOD.");
return new GameClient[0];
}
List<GameClient> recipiants = new List<GameClient>();
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
if (client.LoggedinUser.Moderator)
if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Admin)
{
if (!user.Administrator) // No admin chat for non-admins!
{
Logger.WarnPrint(user.Username + " attempted to send in ADMIN chat, without being an ADMIN.");
return new GameClient[0];
}
List<GameClient> recipiants = new List<GameClient>();
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
if (client.LoggedinUser.Administrator)
if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client);
}
return recipiants.ToArray();
}
if(channel == ChatChannel.Dm)
{
if (to != null && to != "")
{
List<GameClient> recipiants = new List<GameClient>();
foreach (GameClient client in GameClient.ConnectedClients)
{
if (client.LoggedIn)
{
if (!client.LoggedinUser.MutePrivateMessage && !client.LoggedinUser.MuteAll)
{
if (client.LoggedinUser.Username.ToLower().StartsWith(to.ToLower()))
{
recipiants.Add(client);
break;
}
}
}
}
return recipiants.ToArray();
}
else
{
Logger.ErrorPrint("Channel is " + channel + " (DM) BUT no 'to' Paramater was specfied");
return new GameClient[0];
}
}
Logger.ErrorPrint(user.Username + " Sent message in unknown channel: " + (byte)channel);
return new GameClient[0]; // No recipiants
}
public static string DoCorrections(string message)
{
if (!ConfigReader.DoCorrections)
return message;
foreach(Correction correct in CorrectedWords)
message = message.Replace(correct.FilteredWord, correct.ReplacedWord);
return message.Trim();
}
public static string EscapeMessage(string message)
{
return message.Replace("<", "&lt;");
}
public static string FormatChatForOthers(User user, ChatChannel channel, string message, bool autoReply=false)
{
switch (channel)
{
case ChatChannel.All:
if (user.Moderator || user.Administrator)
return Messages.FormatGlobalChatMessageForMod(user.Username, message);
else
return Messages.FormatGlobalChatMessage(user.Username, message);
case ChatChannel.Ads:
return Messages.FormatAdsChatMessage(user.Username, message);
case ChatChannel.Buddies:
return Messages.FormatBuddyChatMessage(user.Username, message);
case ChatChannel.Dm:
string badge = "";
if (user.Moderator || user.Administrator)
badge += Messages.DmModBadge;
if (autoReply)
badge += Messages.DmAutoResponse;
return Messages.FormatDirectMessage(user.Username, message, badge);
case ChatChannel.Near:
return Messages.FormatNearbyChatMessage(user.Username, message);
case ChatChannel.Isle:
return Messages.FormatIsleChatMessage(user.Username, message);
case ChatChannel.Here:
return Messages.FormatHereChatMessage(user.Username, message);
case ChatChannel.Mod:
if (user.Moderator || user.Administrator)
return Messages.FormatModChatMessage(user.Username, message);
else
{
Logger.HackerPrint(user.Username + " Tried to send in mod chat without being a moderator. (Hack/Code Attempt)");
return "";
}
case ChatChannel.Admin:
if (user.Administrator)
return Messages.FormatAdminChatMessage(user.Username, message);
else
{
Logger.HackerPrint(user.Username + " Tried to send in mod chat without being a moderator. (Hack/Code Attempt)");
return "";
}
default:
Logger.ErrorPrint(user.Username + " is trying to end a message in unknown channel " + channel.ToString("X"));
return "not implemented yet :(";
}
}
public static string FormatChatForSender(User user, ChatChannel channel, string message, string dmRecipiant=null, bool autoReply=false)
{
switch (channel)
{
case ChatChannel.All:
if (user.Moderator || user.Administrator)
return Messages.FormatGlobalChatMessageForMod(user.Username, message);
else
return Messages.FormatGlobalChatMessage(user.Username, message);
case ChatChannel.Ads:
int numbListening = GameServer.GetNumberOfPlayersListeningToAdsChat(); // vry specific function ik
return Messages.FormatAdsChatForSender(numbListening-1, user.Username, message);
case ChatChannel.Buddies:
return Messages.FormatBuddyChatMessageForSender(GameServer.GetNumberOfBuddiesOnline(user), user.Username, message);
case ChatChannel.Isle:
int inIsle = 0;
if (World.InIsle(user.X, user.Y))
inIsle = GameServer.GetUsersInIsle(World.GetIsle(user.X, user.Y), false, false).Length -1;
return Messages.FormatIsleChatMessageForSender(inIsle, user.Username, message);
case ChatChannel.Here:
int usersHere = GameServer.GetUsersAt(user.X, user.Y, false, false).Length -1;
return Messages.FormatHereChatMessageForSender(usersHere, user.Username, message);
case ChatChannel.Near:
int nearbyUsers = GameServer.GetNearbyUsers(user.X, user.Y, false, false).Length -1;
return Messages.FormatNearChatMessageForSender(nearbyUsers, user.Username, message);
case ChatChannel.Mod:
int modsOnline = GameServer.GetNumberOfModsOnline() - 1;
return Messages.FormatModChatForSender(modsOnline, user.Username, message);
case ChatChannel.Admin:
int adminsOnline = GameServer.GetNumberOfAdminsOnline() - 1;
return Messages.FormatAdminChatForSender(adminsOnline, user.Username, message);
case ChatChannel.Dm:
string badge = "";
if (user.Moderator || user.Administrator)
badge += Messages.DmModBadge;
if (autoReply)
badge += Messages.DmAutoResponse;
return Messages.FormatDirectChatMessageForSender(user.Username, dmRecipiant, message, badge);
default:
Logger.ErrorPrint(user.Username + " is trying to end a message in unknown channel " + channel.ToString("X"));
return "not implemented yet :(";
}
}
public static string NonViolationChecks(User user, string message)
{
if(!ConfigReader.DoNonViolations)
return null;
// Check if contains password.
if (message.ToLower().Contains(user.Password.ToLower()))
return Messages.PasswordNotice;
// Check if ALL CAPS
string[] wordsSaid;
if (message.Contains(' '))
wordsSaid = message.Split(' ');
else
wordsSaid = new string[] { message };
foreach (string word in wordsSaid)
{
string lettersOnly = "";
foreach(char c in word)
{
if((byte)c >= (byte)'A' && (byte)c <= (byte)'z') // is letter
{
lettersOnly += c;
}
}
if (lettersOnly.ToUpper() == lettersOnly && lettersOnly.Length >= 5)
return Messages.CapsNotice;
}
return null;
}
public static Reason GetReason(string name)
{
foreach (Reason reason in Reasons)
if (reason.Name == name)
return reason;
throw new KeyNotFoundException("Reason " + name + " not found.");
}
}
}

View file

@ -4,7 +4,6 @@ using HISP.Game.Items;
using HISP.Game.Events;
using HISP.Game.Horse;
using HISP.Game.Inventory;
using HISP.Modding;
using System.Linq;
using System;
@ -70,7 +69,6 @@ namespace HISP.Game.Chat
if (!user.Administrator)
return false;
ModLoader.ReloadModsFromFilesystem();
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.LoggedinClient.SendPacket(chatPacket);

View file

@ -218,6 +218,6 @@
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="mkdir $(ProjectDir)Resources\Versioning&#xD;&#xA;&#xD;&#xA;git rev-parse --verify HEAD&gt;&quot;$(ProjectDir)Resources\Versioning\GitCommit&quot; &#xD;&#xA;&#xD;&#xA;git describe --abbrev=0 --tags&gt;&quot;$(ProjectDir)Resources\Versioning\GitTag&quot; &#xD;&#xA;&#xD;&#xA;git branch --show-current&gt;&quot;$(ProjectDir)Resources\Versioning\GitBranch&quot; &#xD;&#xA;&#xD;&#xA;date /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildDate&quot; &#xD;&#xA;&#xD;&#xA;time /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildTime&quot; " />
<Exec Command="mkdir $(ProjectDir)Resources\Versioning&#xD;&#xA;git rev-parse --verify HEAD&gt;&quot;$(ProjectDir)Resources\Versioning\GitCommit&quot; &#xD;&#xA;git describe --abbrev=0 --tags&gt;&quot;$(ProjectDir)Resources\Versioning\GitTag&quot; &#xD;&#xA;git branch --show-current&gt;&quot;$(ProjectDir)Resources\Versioning\GitBranch&quot; &#xD;&#xA;date /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildDate&quot; &#xD;&#xA;time /t&gt;&quot;$(ProjectDir)Resources\Versioning\BuildTime&quot; " />
</Target>
</Project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\LibHISP\Properties\PublishProfiles\iOSARM.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\LibHISP\Properties\PublishProfiles\Linux64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
</Project>

View file

@ -1,20 +0,0 @@
namespace HISP.Modding
{
public interface IMod
{
public void OnModLoad();
public void OnModUnload();
public string ModName
{
get;
}
public string ModVersion
{
get;
}
public string ModId
{
get;
}
}
}

View file

@ -1,77 +0,0 @@
using HISP.Server;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
namespace HISP.Modding
{
public class ModLoader
{
private static List<IMod> modList = new List<IMod>();
public static IMod[] ModList
{
get
{
return modList.ToArray();
}
}
public static void LoadMod(IMod mod)
{
mod.OnModLoad(); // Call OnModLoad();
modList.Add(mod); // add to the list of mods
Logger.InfoPrint("Loaded mod: "+mod.ModName + " v" + mod.ModVersion + " SUCCESS.");
}
public static void UnloadMod(IMod mod)
{
mod.OnModUnload();
modList.Remove(mod);
Logger.InfoPrint("Unloading mod: " + mod.ModName);
}
public static void UnloadAllMods()
{
foreach (IMod loadedMod in ModList)
{
UnloadMod(loadedMod);
}
}
public static void LoadModFromFilesystem(string dllfile)
{
try
{
Assembly assembly = Assembly.LoadFile(dllfile);
Type[] types = assembly.GetTypes();
// Search for classes that implement IMod
foreach (Type type in types)
{
if (type.GetInterfaces().Contains(typeof(IMod)))
{
IMod mod = (IMod)Activator.CreateInstance(type); // Crate an instance of the class
LoadMod(mod); // Load it into memory
}
}
}
catch (Exception e)
{
Logger.ErrorPrint("Failed to load mod: " + dllfile + " - [EXCEPTION]" + e.Message + " " + e.InnerException + "\n" + e.StackTrace);
}
}
public static void OnShutdown()
{
UnloadAllMods();
}
public static void ReloadModsFromFilesystem()
{
UnloadAllMods();
if (Directory.Exists(ConfigReader.ModsFolder))
{
string[] filelist = Directory.GetFiles(ConfigReader.ModsFolder, "*.dll", SearchOption.TopDirectoryOnly);
foreach (string file in filelist)
{
LoadModFromFilesystem(file);
}
}
}
}
}

View file

@ -1,76 +1,74 @@
using HISP.Game;
using HISP.Game.Horse;
using HISP.Game.Items;
using HISP.Game.Services;
using HISP.Game.SwfModules;
using HISP.Game.Chat;
using HISP.Security;
using System;
using System.Diagnostics;
using HISP.Modding;
using HISP.Game;
using HISP.Game.Horse;
using HISP.Game.Items;
using HISP.Game.Services;
using HISP.Game.SwfModules;
using HISP.Game.Chat;
using HISP.Security;
using System;
using System.Diagnostics;
namespace HISP.Server
{
public static class Entry
{
// "Entry Point"
private static void defaultOnShutdownCallback()
{
Process.GetCurrentProcess().Close();
}
public static Action OnShutdown = defaultOnShutdownCallback;
public static void SetShutdownCallback(Action callback)
{
OnShutdown = callback;
}
public static void Start()
namespace HISP.Server
{
public static class Entry
{
// "Entry Point"
private static void defaultOnShutdownCallback()
{
#if (!DEBUG)
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#endif
Process.GetCurrentProcess().Close();
}
public static Action OnShutdown = defaultOnShutdownCallback;
ModLoader.ReloadModsFromFilesystem();
Console.Title = ServerVersion.GetBuildString();
ConfigReader.OpenConfig();
CrossDomainPolicy.GetPolicy();
Database.OpenDatabase();
GameDataJson.ReadGamedata();
Map.OpenMap();
World.ReadWorldData();
Treasure.Init();
DroppedItems.Init();
WildHorse.Init();
Drawingroom.LoadAllDrawingRooms();
Brickpoet.LoadPoetryRooms();
Multiroom.CreateMultirooms();
Auction.LoadAllAuctionRooms();
Item.DoSpecialCases();
Command.RegisterCommands();
GameServer.StartServer();
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception execpt = (Exception)e.ExceptionObject;
Logger.ErrorPrint("HISP HAS CRASHED :(");
Logger.ErrorPrint("Unhandled Exception: " + execpt.ToString());
Logger.ErrorPrint(execpt.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(execpt.StackTrace);
while (true) { /* Allow asyncronous operations to happen. */ };
}
}
}
public static void SetShutdownCallback(Action callback)
{
OnShutdown = callback;
}
public static void Start()
{
#if (!DEBUG)
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#endif
Console.Title = ServerVersion.GetBuildString();
ConfigReader.OpenConfig();
CrossDomainPolicy.GetPolicy();
Database.OpenDatabase();
GameDataJson.ReadGamedata();
Map.OpenMap();
World.ReadWorldData();
Treasure.Init();
DroppedItems.Init();
WildHorse.Init();
Drawingroom.LoadAllDrawingRooms();
Brickpoet.LoadPoetryRooms();
Multiroom.CreateMultirooms();
Auction.LoadAllAuctionRooms();
Item.DoSpecialCases();
Command.RegisterCommands();
GameServer.StartServer();
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception execpt = (Exception)e.ExceptionObject;
Logger.ErrorPrint("HISP HAS CRASHED :(");
Logger.ErrorPrint("Unhandled Exception: " + execpt.ToString());
Logger.ErrorPrint(execpt.Message);
Logger.ErrorPrint("");
Logger.ErrorPrint(execpt.StackTrace);
while (true) { /* Allow asyncronous operations to happen. */ };
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,6 @@
using HISP.Properties;
using System;
using System.Globalization;
using HISP.Properties;
namespace HISP.Server
{
@ -44,27 +46,33 @@ namespace HISP.Server
}
public static string GetVersionString()
{
return Resources.GitTag.Replace("\r", "").Replace("\n", "");
return Resources.GitTag.Replace("\r", "").Replace("\n", "").ToString().Trim() + "."+ GetCommitHashVersion();
}
public static string GetBranch()
{
return Resources.GitBranch.Replace("\r", "").Replace("\n", "");
return Resources.GitBranch.Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetBuildDate()
{
return Resources.BuildDate.Replace("\r", "").Replace("\n", "");
return Resources.BuildDate.Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetBuildTime()
{
return Resources.BuildTime.Replace("\r", "").Replace("\n", "");
return Resources.BuildTime.Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetCommitHashVersion()
{
return UInt16.Parse(Resources.GitCommit.Substring(0, 4), NumberStyles.HexNumber).ToString();
}
public static string GetCommitHash(int TotalBytes)
{
return Resources.GitCommit.Substring(0, TotalBytes).Replace("\r", "").Replace("\n", "");
return Resources.GitCommit.Substring(0, TotalBytes).Replace("\r", "").Replace("\n", "").ToString().Trim();
}
public static string GetBuildString()
{
return PRODUCT + " " + GetVersionString() + " `" + GetBranch() + "@" + GetCommitHash(7) + "`; (" + GetArchitecture() + "; " + GetPlatform() + "); Built on " + GetBuildDate() + " at " + GetBuildTime();
return PRODUCT + " " + GetVersionString() + " " + GetBranch() + " (" + GetArchitecture() + "; " + GetPlatform() + "); Built @ " + GetBuildDate() + " " + GetBuildTime();
}
}
}

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\N00BS\Properties\PublishProfiles\Win32.pubxml</_LastSelectedProfileId>
<_LastSelectedProfileId>C:\Users\User\Documents\git\HISP\HorseIsleServer\N00BS\Properties\PublishProfiles\Win64.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<Compile Update="LoadingForm.cs">

View file

@ -7,7 +7,6 @@ using HISP.Game.Horse;
using HISP.Game.Items;
using HISP.Game.Services;
using HISP.Game.SwfModules;
using HISP.Modding;
using HISP.Security;
using HISP.Server;
using HTTP;
@ -75,7 +74,6 @@ namespace HISP.Noobs
BaseDir = Path.Combine(Environment.GetEnvironmentVariable("APPDATA"), "HISP", "N00BS");
Directory.CreateDirectory(BaseDir);
ModLoader.ReloadModsFromFilesystem();
// Start Web Server
try

41
HorseIsleServer/build.py Normal file
View file

@ -0,0 +1,41 @@
#!/bin/python3
import os
import subprocess
import date
import datetime
import struct
import binascii
global commit_hash
global commit_tag
global commit_branch
def derive_version():
commit_tag + "." + struct.unpack("h", binascii.unhexlify())
versioning_folder = os.path.join("LibHISP", "Resources", "Versioning")
if not os.path.exists(versioning_folder):
os.mkdir(versioning_folder)
commit_hash = "0"*40
commit_tag = "v0.0.0"
commit_branch = "master"
try:
commit_hash = subprocess.run(['git', 'rev-parse', '--verify', 'HEAD'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8")
commit_tag = subprocess.run(['git', 'describe', '--abbrev=0', '--tags'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8")
commit_branch = subprocess.run(['git', 'branch', '--show-current'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8")
except FileNotFoundError:
print("Git not installed")
commit_date = datetime.datetime.now().strftime("%d/%m/%Y")
commit_time = datetime.datetime.now().strftime("%H:%M:%S")
open(os.path.join(versioning_folder, "GitCommit"), "w").write(commit_hash)
open(os.path.join(versioning_folder, "GitTag" ), "w").write(commit_tag)
open(os.path.join(versioning_folder, "GitBranch"), "w").write(commit_branch)
open(os.path.join(versioning_folder, "BuildDate"), "w").write(commit_date)
open(os.path.join(versioning_folder, "BuildTime"), "w").write(commit_time)