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|ARM64 = MacOS|ARM64
MacOS|x64 = MacOS|x64 MacOS|x64 = MacOS|x64
MacOS|x86 = MacOS|x86 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|Any CPU = Windows|Any CPU
Windows|ARM = Windows|ARM Windows|ARM = Windows|ARM
Windows|ARM64 = Windows|ARM64 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|x64.Build.0 = MacOS|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.ActiveCfg = MacOS|x86 {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}.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.ActiveCfg = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.Build.0 = Windows|x64 {C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.Build.0 = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|ARM.ActiveCfg = Windows|ARM {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|x64.Build.0 = MacOS|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.ActiveCfg = MacOS|x86 {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}.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.ActiveCfg = Debug|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.Build.0 = 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 {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|ARM64.ActiveCfg = Debug|Any CPU
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.MacOS|x64.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}.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.ActiveCfg = Debug|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|Any CPU.Build.0 = 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 {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|x64.Build.0 = Windows|x64
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.ActiveCfg = Windows|x86 {6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.ActiveCfg = Windows|x86
{6B45A1E8-0F54-4BF7-AF48-41B9FE676570}.Windows|x86.Build.0 = 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|ARM.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|ARM64.ActiveCfg = Windows {D330A197-67D4-42B0-8906-54264AF95EC1}.Android|ARM64.ActiveCfg = Windows
{D330A197-67D4-42B0-8906-54264AF95EC1}.Android|x64.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|ARM64.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.MacOS|x64.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}.MacOS|x86.ActiveCfg = Debug
{D330A197-67D4-42B0-8906-54264AF95EC1}.Release|Any CPU.ActiveCfg = Release {D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|Any CPU.ActiveCfg = Windows
{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|ARM.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|ARM64.ActiveCfg = Release
{D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|x64.ActiveCfg = Windows {D330A197-67D4-42B0-8906-54264AF95EC1}.Windows|x64.ActiveCfg = Windows

View file

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

View file

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

View file

@ -218,6 +218,6 @@
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <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> </Target>
</Project> </Project>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <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> </PropertyGroup>
</Project> </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;
using HISP.Game.Horse; using HISP.Game.Horse;
using HISP.Game.Items; using HISP.Game.Items;
using HISP.Game.Services; using HISP.Game.Services;
using HISP.Game.SwfModules; using HISP.Game.SwfModules;
using HISP.Game.Chat; using HISP.Game.Chat;
using HISP.Security; using HISP.Security;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using HISP.Modding;
namespace HISP.Server namespace HISP.Server
{ {
public static class Entry public static class Entry
{ {
// "Entry Point" // "Entry Point"
private static void defaultOnShutdownCallback() private static void defaultOnShutdownCallback()
{
Process.GetCurrentProcess().Close();
}
public static Action OnShutdown = defaultOnShutdownCallback;
public static void SetShutdownCallback(Action callback)
{
OnShutdown = callback;
}
public static void Start()
{ {
#if (!DEBUG) Process.GetCurrentProcess().Close();
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); }
#endif public static Action OnShutdown = defaultOnShutdownCallback;
ModLoader.ReloadModsFromFilesystem();
public static void SetShutdownCallback(Action callback)
Console.Title = ServerVersion.GetBuildString(); {
ConfigReader.OpenConfig(); OnShutdown = callback;
CrossDomainPolicy.GetPolicy(); }
Database.OpenDatabase();
GameDataJson.ReadGamedata(); public static void Start()
{
Map.OpenMap(); #if (!DEBUG)
World.ReadWorldData(); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Treasure.Init(); #endif
DroppedItems.Init();
WildHorse.Init(); Console.Title = ServerVersion.GetBuildString();
ConfigReader.OpenConfig();
Drawingroom.LoadAllDrawingRooms(); CrossDomainPolicy.GetPolicy();
Brickpoet.LoadPoetryRooms(); Database.OpenDatabase();
Multiroom.CreateMultirooms(); GameDataJson.ReadGamedata();
Auction.LoadAllAuctionRooms(); Map.OpenMap();
World.ReadWorldData();
Item.DoSpecialCases(); Treasure.Init();
Command.RegisterCommands();
DroppedItems.Init();
GameServer.StartServer(); WildHorse.Init();
}
Drawingroom.LoadAllDrawingRooms();
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) Brickpoet.LoadPoetryRooms();
{ Multiroom.CreateMultirooms();
Exception execpt = (Exception)e.ExceptionObject;
Auction.LoadAllAuctionRooms();
Logger.ErrorPrint("HISP HAS CRASHED :(");
Logger.ErrorPrint("Unhandled Exception: " + execpt.ToString()); Item.DoSpecialCases();
Logger.ErrorPrint(execpt.Message); Command.RegisterCommands();
Logger.ErrorPrint("");
Logger.ErrorPrint(execpt.StackTrace); GameServer.StartServer();
}
while (true) { /* Allow asyncronous operations to happen. */ };
} 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 namespace HISP.Server
{ {
@ -44,27 +46,33 @@ namespace HISP.Server
} }
public static string GetVersionString() 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() public static string GetBranch()
{ {
return Resources.GitBranch.Replace("\r", "").Replace("\n", ""); return Resources.GitBranch.Replace("\r", "").Replace("\n", "").ToString().Trim();
} }
public static string GetBuildDate() public static string GetBuildDate()
{ {
return Resources.BuildDate.Replace("\r", "").Replace("\n", ""); return Resources.BuildDate.Replace("\r", "").Replace("\n", "").ToString().Trim();
} }
public static string GetBuildTime() 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) 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() 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"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <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> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Update="LoadingForm.cs"> <Compile Update="LoadingForm.cs">

View file

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