mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-06 05:05:40 +12:00
Begin work on Unit Tests
This commit is contained in:
parent
cf7605c6c9
commit
eaf1db1ee1
51 changed files with 3883 additions and 2101 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -16,10 +16,15 @@ HorseIsleServer/MPN00BS/bin/*
|
|||
HorseIsleServer/HISPd/obj/*
|
||||
HorseIsleServer/HISPd/bin/*
|
||||
|
||||
HorseIsleServer/Installer/Windows/*
|
||||
HorseIsleServer/HISPtests/obj/*
|
||||
HorseIsleServer/HISPtests/bin/*
|
||||
|
||||
|
||||
HorseIsleServer/LibHISP/obj/*
|
||||
HorseIsleServer/LibHISP/bin/*
|
||||
HorseIsleServer/LibHISP/Resources/Versioning/*
|
||||
|
||||
HorseIsleServer/Installer/Windows/*
|
||||
|
||||
|
||||
HorseIsleServer/.vs/*
|
||||
|
|
|
@ -8,9 +8,8 @@ EndProject
|
|||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HISPd", "HISPd\HISPd.csproj", "{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MPN00BS", "MPN00BS\MPN00BS.csproj", "{72EF95FC-03DB-4E61-A696-E0095DD42A4E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{C48CBD82-AB30-494A-8FFA-4DE7069B5827} = {C48CBD82-AB30-494A-8FFA-4DE7069B5827}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HISPtests", "HISPtests\HISPtests.csproj", "{689FB972-1612-440E-817D-BE290F655AA8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -39,6 +38,11 @@ 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
|
||||
|
@ -95,6 +99,16 @@ 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 = Windows|x86
|
||||
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x86.Build.0 = Windows|x86
|
||||
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
|
||||
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.Build.0 = Windows|Any CPU
|
||||
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|ARM.ActiveCfg = Windows|ARM
|
||||
|
@ -154,6 +168,16 @@ 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 = Windows|Any CPU
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|Any CPU.Build.0 = Windows|Any CPU
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM.ActiveCfg = Windows|ARM
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM.Build.0 = Windows|ARM
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM64.ActiveCfg = Windows|ARM64
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|ARM64.Build.0 = Windows|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 = Windows|x86
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|x86.Build.0 = Windows|x86
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.Build.0 = Windows|Any CPU
|
||||
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|ARM.ActiveCfg = Windows|ARM
|
||||
|
@ -214,6 +238,16 @@ Global
|
|||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.MacOS|x64.Build.0 = MacOS|x64
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.MacOS|x86.ActiveCfg = MacOS|x86
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.MacOS|x86.Build.0 = MacOS|x86
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|Any CPU.ActiveCfg = Windows|Any CPU
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|Any CPU.Build.0 = Windows|Any CPU
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|ARM.ActiveCfg = Windows|ARM
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|ARM.Build.0 = Windows|ARM
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|ARM64.ActiveCfg = Windows|ARM64
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|ARM64.Build.0 = Windows|ARM64
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|x64.ActiveCfg = Windows|x64
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|x64.Build.0 = Windows|x64
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|x86.ActiveCfg = Windows|x86
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Release|x86.Build.0 = Windows|x86
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|Any CPU.Build.0 = Windows|Any CPU
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|ARM.ActiveCfg = Windows|ARM
|
||||
|
@ -224,6 +258,76 @@ Global
|
|||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|x64.Build.0 = Windows|x64
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|x86.ActiveCfg = Windows|x86
|
||||
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|x86.Build.0 = Windows|x86
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|Any CPU.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|ARM.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|ARM.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|ARM64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|x64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|x64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|x86.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Android|x86.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|x64.Build.0 = Debug|x64
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Debug|x86.Build.0 = Debug|x86
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|Any CPU.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|ARM.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|ARM.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|ARM64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|x64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|x64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|x86.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.iOS|x86.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|Any CPU.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|ARM.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|ARM.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|ARM64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|x64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|x64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|x86.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Linux|x86.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|Any CPU.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|ARM.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|ARM.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|ARM64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|x64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|x64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|x86.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.MacOS|x86.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|ARM64.ActiveCfg = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|ARM64.Build.0 = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Release|x86.Build.0 = Release|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|Any CPU.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|ARM.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|ARM.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|ARM64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|ARM64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|x64.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|x64.Build.0 = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|x86.ActiveCfg = Debug|Any CPU
|
||||
{689FB972-1612-440E-817D-BE290F655AA8}.Windows|x86.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -158,112 +158,12 @@
|
|||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE;OS_DEBUG;ARCH_ARM</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
<DefineConstants>DEBUG;TRACE;OS_DEBUG</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE;OS_DEBUG;ARCH_ARM64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE;OS_DEBUG;ARCH_X86_64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE;OS_DEBUG;ARCH_X86</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MacOS|x86'">
|
||||
<Optimize>True</Optimize>
|
||||
<DefineConstants>OS_MACOS;ARCH_X86</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|x86'">
|
||||
<Optimize>True</Optimize>
|
||||
<DefineConstants>OS_LINUX;ARCH_X86</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|AnyCPU'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>OS_LINUX;ARCH_ANYCPU</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|AnyCPU'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_ANYCPU</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MacOS|AnyCPU'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>OS_MACOS;ARCH_ANYCPU</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MacOS|ARM'">
|
||||
<Optimize>True</Optimize>
|
||||
<DefineConstants>OS_MACOS;ARCH_ARM</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<WarningLevel>3</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Android|x64'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='iOS|x64'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Android|x86'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='iOS|x86'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Android|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='iOS|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace HISP.Cli
|
|||
|
||||
string BaseDir = Directory.GetCurrentDirectory();
|
||||
Logger.SetCallback(LogStdout);
|
||||
Entry.SetShutdownCallback(OnShutdown);
|
||||
|
||||
string HispConfVar = Environment.GetEnvironmentVariable("HISP_CONF_FILE");
|
||||
string HispLogVar = Environment.GetEnvironmentVariable("HISP_LOG_FILE");
|
||||
|
@ -145,7 +146,6 @@ namespace HISP.Cli
|
|||
Directory.SetCurrentDirectory(BaseDir);
|
||||
}
|
||||
|
||||
Entry.SetShutdownCallback(OnShutdown);
|
||||
Entry.Start();
|
||||
|
||||
shutdownHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
|
||||
|
|
|
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.8.23.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.23.0")]
|
||||
[assembly: AssemblyVersion("1.8.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.30.0")]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Package: hisp
|
||||
Version: 1.8.23
|
||||
Version: 1.8.30
|
||||
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
|
||||
Maintainer: Li
|
||||
Homepage: https://islehorse.com
|
||||
|
|
169
HorseIsleServer/HISPtests/HISPtests.csproj
Normal file
169
HorseIsleServer/HISPtests/HISPtests.csproj
Normal file
|
@ -0,0 +1,169 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>HISP.Tests</RootNamespace>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<Platforms>x64;x86;ARM;ARM64;AnyCPU</Platforms>
|
||||
<Configurations>Debug;Windows;Linux;MacOS;Android;iOS</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LibHISP\LibHISP.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
|
||||
<GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<NoWin32Manifest>true</NoWin32Manifest>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
<StartupObject>HISP.Tests.Program</StartupObject>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<DebugType>embedded</DebugType>
|
||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||
<AnalysisLevel>none</AnalysisLevel>
|
||||
<EnableNETAnalyzers>False</EnableNETAnalyzers>
|
||||
<Copyright>Public Domain, 2022</Copyright>
|
||||
<PackageProjectUrl>https://islehorse.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/islehorse/HISP</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
<NoWarn>1701;1702;2026;IL2026</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
||||
<TrimMode>partial</TrimMode>
|
||||
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
|
||||
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
|
||||
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x86'">
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<Platforms>x86</Platforms>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_X86</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x64'">
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<Platforms>x64</Platforms>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|ARM'">
|
||||
<RuntimeIdentifier>win-arm</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_ARM</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|ARM64'">
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_ARM64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Android|ARM'">
|
||||
<RuntimeIdentifier>android-arm</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<DefineConstants>OS_ANDROID;ARCH_ARM</DefineConstants>
|
||||
<WarningLevel>3</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Android|ARM64'">
|
||||
<RuntimeIdentifier>android-arm64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<DefineConstants>OS_ANDROID;ARCH_ARM64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|x64'">
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>OS_LINUX;ARCH_X86_64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|ARM'">
|
||||
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>OS_LINUX;ARCH_ARM</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Linux|ARM64'">
|
||||
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>OS_LINUX;ARCH_ARM64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MacOS|x64'">
|
||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DefineConstants>OS_MACOS;ARCH_X86_64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MacOS|ARM64'">
|
||||
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>OS_MACOS;ARCH_ARM64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='iOS|ARM'">
|
||||
<RuntimeIdentifier>ios-arm</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<DefineConstants>OS_IOS;ARCH_ARM</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='iOS|ARM64'">
|
||||
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
|
||||
<Optimize>true</Optimize>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<DefineConstants>OS_IOS;ARCH_ARM64</DefineConstants>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='All|AnyCPU'">
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm;win-arm64;linux-x64;linux-arm;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
<Optimize>True</Optimize>
|
||||
<DefineConstants>OS_ALL;ARCH_ANYCPU</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<Optimize>False</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE;OS_DEBUG</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
||||
</Project>
|
20
HorseIsleServer/HISPtests/Program.cs
Normal file
20
HorseIsleServer/HISPtests/Program.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using HISP.Server;
|
||||
using HISP.Tests.UnitTests;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Tests
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
ServerStartTest.RunServerStartTest();
|
||||
AuthenticationTest.RunAuthenticationTest();
|
||||
await UserTest.RunUserTest();
|
||||
PacketTest.RunPacketTest();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
35
HorseIsleServer/HISPtests/Properties/AssemblyInfo.cs
Normal file
35
HorseIsleServer/HISPtests/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("HISPd")]
|
||||
[assembly: AssemblyDescription("Server Emulator for \"Horse Isle\"")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Li")]
|
||||
[assembly: AssemblyProduct("HISP")]
|
||||
[assembly: AssemblyCopyright("Public Domain <20> 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("57264c6b-1461-41d6-9304-3890cf6c8390")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.8.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.30.0")]
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>Android</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
<PublishDir>bin\arm\Android\net7.0\android-arm\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>android-arm</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<UseAppHost>True</UseAppHost>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_ANDROID;ARCH_ARM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>Android</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
<PublishDir>bin\arm64\Android\net7.0\android-arm64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>android-arm64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<UseAppHost>True</UseAppHost>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_ANDROID;ARCH_ARM64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>Linux</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>bin\x64\Linux\net7.0\linux-x64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_LINUX;ARCH_X86_64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>Linux</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
<PublishDir>bin\ARM\Linux\net7.0\linux-arm\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_LINUX;ARCH_ARM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>Linux</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
<PublishDir>bin\ARM64\Linux\net7.0\linux-arm64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_LINUX;ARCH_ARM64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>MacOS</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>bin\x64\MacOS\net7.0\osx-x64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>osx-x64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_MACOS;ARCH_X86_64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>MacOS</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
<PublishDir>bin\arm64\MacOS\net7.0\osx-arm64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_MACOS;ARCH_ARM64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Windows</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
<PublishDir>bin\x86\Windows\net7.0\win-x86\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_X86</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>Windows</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<PublishDir>bin\x64\Windows\net7.0\win-x64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Windows</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
<PublishDir>bin\arm\Windows\net7.0\win-arm\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-arm</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_ARM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration>Windows</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
<PublishDir>bin\arm64\Windows\net7.0\win-arm64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
<PublishReadyToRun>True</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_WINDOWS;ARCH_ARM64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>iOS</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
<PublishDir>bin\arm\iOS\net7.0\ios-arm\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>ios-arm</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>False</PublishSingleFile>
|
||||
<PublishReadyToRun>False</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_IOS;ARCH_ARM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration>iOS</Configuration>
|
||||
<Platform>ARM64</Platform>
|
||||
<PublishDir>bin\arm64\iOS\net7.0\ios-arm64\publish\</PublishDir>
|
||||
<PublishProtocol>FileSystem</PublishProtocol>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
|
||||
<SelfContained>True</SelfContained>
|
||||
<PublishSingleFile>False</PublishSingleFile>
|
||||
<PublishReadyToRun>False</PublishReadyToRun>
|
||||
<PublishTrimmed>True</PublishTrimmed>
|
||||
<DefineConstants>OS_IOS;ARCH_ARM64</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
74
HorseIsleServer/HISPtests/Properties/Resources.Designer.cs
generated
Normal file
74
HorseIsleServer/HISPtests/Properties/Resources.Designer.cs
generated
Normal file
|
@ -0,0 +1,74 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace HISP.Tests.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HISP.Tests.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
public static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {
|
||||
/// "2PlayerClose": "UFgA",
|
||||
/// "BirdMap_OutsideMapTop": "dgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
public static string PacketTestDataSet {
|
||||
get {
|
||||
return ResourceManager.GetString("PacketTestDataSet", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
124
HorseIsleServer/HISPtests/Properties/Resources.resx
Normal file
124
HorseIsleServer/HISPtests/Properties/Resources.resx
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="PacketTestDataSet" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\PacketTestDataSet.json;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
7
HorseIsleServer/HISPtests/Properties/launchSettings.json
Normal file
7
HorseIsleServer/HISPtests/Properties/launchSettings.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"profiles": {
|
||||
"HISPtests": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
256
HorseIsleServer/HISPtests/Resources/PacketTestDataSet.json
Normal file
256
HorseIsleServer/HISPtests/Resources/PacketTestDataSet.json
Normal file
File diff suppressed because one or more lines are too long
51
HorseIsleServer/HISPtests/ResultLogger.cs
Normal file
51
HorseIsleServer/HISPtests/ResultLogger.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Tests
|
||||
{
|
||||
public class ResultLogger
|
||||
{
|
||||
public static void LogTestStatus(bool successful, string testname, string message)
|
||||
{
|
||||
if (successful)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.Out.Write("[ " + testname + " ] ");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.Out.WriteLine("* " + message + " *");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.Error.Write("[ " + testname + " ] ");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.Error.WriteLine("* " + message + " *");
|
||||
}
|
||||
}
|
||||
|
||||
public static void LogTestResult(bool successful, string testname, string message, string expected)
|
||||
{
|
||||
if (successful)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.Out.Write("[ " + testname + " ] ");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.Out.WriteLine("* " + message + " == " + expected + " *");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
Console.Error.Write("[ " + testname + " ] ");
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.Error.WriteLine("* " + message + " != " + expected + " *");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
59
HorseIsleServer/HISPtests/UnitTests/AuthenticationTest.cs
Normal file
59
HorseIsleServer/HISPtests/UnitTests/AuthenticationTest.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using HISP.Security;
|
||||
using HISP.Util;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Tests.UnitTests
|
||||
{
|
||||
public class AuthenticationTest
|
||||
{
|
||||
|
||||
private const string ALLOWED_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||||
public static bool Test(string testName, object value, object valueComp)
|
||||
{
|
||||
bool result = value.Equals(valueComp);
|
||||
if (result)
|
||||
ResultLogger.LogTestStatus(true, "AUTH_TEST " + testName, "Success.");
|
||||
else
|
||||
ResultLogger.LogTestResult(false, "AUTH_TEST " + testName, value.ToString(), valueComp.ToString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool RunAuthenticationTest()
|
||||
{
|
||||
List<bool> results = new List<bool>();
|
||||
|
||||
// Test Login Encrypt/Decrypt
|
||||
for(int i = 0; i <= 100; i++)
|
||||
{
|
||||
string rngStr = Helper.RandomString(ALLOWED_CHARS);
|
||||
string cipherText = Authentication.EncryptLogin(rngStr);
|
||||
string plainText = Authentication.DecryptLogin(cipherText);
|
||||
|
||||
results.Add(Test("LoginEncryptDecrypt" + i.ToString(), plainText, rngStr));
|
||||
|
||||
}
|
||||
|
||||
|
||||
string username = Helper.RandomString(ALLOWED_CHARS);
|
||||
string password = Helper.RandomString(ALLOWED_CHARS);
|
||||
|
||||
string wrongPassword = Helper.RandomString(ALLOWED_CHARS);
|
||||
string wrongUsername = Helper.RandomString(ALLOWED_CHARS);
|
||||
|
||||
Authentication.CreateAccount(username, password, "DEMIGIRL", true, true);
|
||||
|
||||
// Test Login function
|
||||
results.Add(Test("CorrectUsernameAndPassword", Authentication.CheckPassword(username, password), true));
|
||||
results.Add(Test("CorrectUsernameWrongPassword", Authentication.CheckPassword(username, wrongPassword), false));
|
||||
results.Add(Test("WrongPasswordAndUsername", Authentication.CheckPassword(wrongUsername, wrongPassword), false));
|
||||
results.Add(Test("WrongUsernameCorrectPassword", Authentication.CheckPassword(wrongUsername, password), false));
|
||||
|
||||
|
||||
foreach (bool result in results)
|
||||
if (!result)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
418
HorseIsleServer/HISPtests/UnitTests/PacketTest.cs
Normal file
418
HorseIsleServer/HISPtests/UnitTests/PacketTest.cs
Normal file
|
@ -0,0 +1,418 @@
|
|||
using HISP.Tests.Properties;
|
||||
using HISP.Game.SwfModules;
|
||||
using HISP.Game;
|
||||
using HISP.Server;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace HISP.Tests.UnitTests
|
||||
{
|
||||
public class PacketTest
|
||||
{
|
||||
private const bool GENERATE = false;
|
||||
|
||||
private static Dictionary<string, string> knownGoodPackets = new Dictionary<string, string>();
|
||||
|
||||
public static bool Test(string name, byte[] packet)
|
||||
{
|
||||
|
||||
if (GENERATE)
|
||||
{
|
||||
knownGoodPackets.Add(name, Convert.ToBase64String(packet));
|
||||
}
|
||||
else
|
||||
{
|
||||
string goodPacketStr = null;
|
||||
knownGoodPackets.TryGetValue(name, out goodPacketStr);
|
||||
byte[] goodPacket = Convert.FromBase64String(goodPacketStr);
|
||||
|
||||
|
||||
if(!goodPacket.SequenceEqual(packet))
|
||||
{
|
||||
ResultLogger.LogTestResult(false, "PACKET_TEST "+name, BitConverter.ToString(packet).Replace("-", ""), goodPacket.ToString().Replace("-", ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
ResultLogger.LogTestStatus(true, "PACKET_TEST " + name, "Success.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool RunPacketTest()
|
||||
{
|
||||
if (!GENERATE)
|
||||
{
|
||||
JObject jobj = JsonConvert.DeserializeObject(Resources.PacketTestDataSet) as JObject;
|
||||
knownGoodPackets = jobj.ToObject<Dictionary<string, string>>();
|
||||
}
|
||||
|
||||
List<bool> results = new List<bool>();
|
||||
|
||||
results.Add(Test("2PlayerClose", PacketBuilder.Create2PlayerClose()));
|
||||
|
||||
// Test Map
|
||||
results.Add(Test("BirdMap_OutsideMapTop", PacketBuilder.CreateBirdMap(-100, -800)));
|
||||
results.Add(Test("BirdMap_OutsideMapBottom", PacketBuilder.CreateBirdMap(Map.Height+100, Map.Width+600)));
|
||||
results.Add(Test("BirdMap_InsideMap", PacketBuilder.CreateBirdMap(100, 200)));
|
||||
|
||||
// Test Brickpoet
|
||||
results.Add(Test("BrickPoetList", PacketBuilder.CreateBrickPoetList(Brickpoet.GetPoetryRoom(1))));
|
||||
results.Add(Test("BrickPoetMove", PacketBuilder.CreateBrickPoetMove(Brickpoet.GetPoetryPeice(Brickpoet.GetPoetryRoom(1), 30))));
|
||||
|
||||
// Test Chat
|
||||
results.Add(Test("ChatBottomLeft", PacketBuilder.CreateChat("Trans Rights", PacketBuilder.CHAT_BOTTOM_LEFT)));
|
||||
results.Add(Test("ChatBottomRight", PacketBuilder.CreateChat("Are Human", PacketBuilder.CHAT_BOTTOM_RIGHT)));
|
||||
results.Add(Test("ChatDmRight", PacketBuilder.CreateChat("Rights", PacketBuilder.CHAT_DM_RIGHT)));
|
||||
results.Add(Test("ChatMotd", PacketBuilder.CreateMotd("Enbies are valid!")));
|
||||
|
||||
// Test Drawing Room
|
||||
results.Add(Test("DrawingRoomUpdate", PacketBuilder.CreateDrawingUpdate("C959|64^67|66^73|68^79|69^87")));
|
||||
|
||||
// Test Dressup Room
|
||||
results.Add(Test("DressupRoomPeiceLoad", PacketBuilder.CreateDressupRoomPeiceLoad(Dressup.GetDressupRoom(2).DressupPeices)));
|
||||
results.Add(Test("DressupRoomPeiceMove", PacketBuilder.CreateDressupRoomPeiceMove(11, 14.4, 2.4, true)));
|
||||
|
||||
// Test SwfModule Forwarding
|
||||
results.Add(Test("ForwardedSwfModule_516152", PacketBuilder.CreateForwardedSwfModule(new byte[] { 0x51, 0x61, 0x52 })));
|
||||
results.Add(Test("ForwardedSwfModule_AF8D91C8", PacketBuilder.CreateForwardedSwfModule(new byte[] { 0xAF, 0x8D, 0x91, 0xC8 })));
|
||||
|
||||
// Test KeepAlive
|
||||
results.Add(Test("KeepAlive", PacketBuilder.CreateKeepAlive()));
|
||||
|
||||
// Test KickMessage
|
||||
results.Add(Test("KickMessage", PacketBuilder.CreateKickMessage("Transphobia")));
|
||||
|
||||
// Test Login
|
||||
results.Add(Test("LoginSuccess", PacketBuilder.CreateLogin(true)));
|
||||
results.Add(Test("LoginFail", PacketBuilder.CreateLogin(false)));
|
||||
results.Add(Test("LoginFail_ReasonBanned", PacketBuilder.CreateLogin(false, "You are banned.")));
|
||||
|
||||
// Test Meta
|
||||
results.Add(Test("CreateMeta", PacketBuilder.CreateMeta("^R1Trans Rights^X^Z")));
|
||||
|
||||
// Test Money, PlayerCount, Mail
|
||||
results.Add(Test("MoneyPlayerCountAndMail", PacketBuilder.CreateMoneyPlayerCountAndMail(100, 1, 40)));
|
||||
|
||||
// Test Movement
|
||||
results.Add(Test("Movement_DirectionUpMoveUpInsideMapWalk", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveDownInsideMapWalk", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveLeftInsideMapWalk", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveRightInsideMapWalk", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveUpdateInsideMapWalk", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveEscapeInsideMapWalk", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionDownMoveUpInsideMapWalk", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveDownInsideMapWalk", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveLeftInsideMapWalk", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveRightInsideMapWalk", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveUpdateInsideMapWalk", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveEscapeInsideMapWalk", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpInsideMapWalk", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveDownInsideMapWalk", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveLeftInsideMapWalk", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveRightInsideMapWalk", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpdateInsideMapWalk", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveEscapeInsideMapWalk", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionRightMoveUpInsideMapWalk", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveDownInsideMapWalk", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveLeftInsideMapWalk", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveRightInsideMapWalk", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveUpdateInsideMapWalk", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveEscapeInsideMapWalk", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpInsideMapWalk", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveDownInsideMapWalk", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveLeftInsideMapWalk", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveRightInsideMapWalk", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpdateInsideMapWalk", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveEscapeInsideMapWalk", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpInsideMapWalk", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveDownInsideMapWalk", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveLeftInsideMapWalk", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveRightInsideMapWalk", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpdateInsideMapWalk", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveEscapeInsideMapWalk", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
// walk = false
|
||||
|
||||
results.Add(Test("Movement_DirectionUpMoveUpInsideMap", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveDownInsideMap", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveLeftInsideMap", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveRightInsideMap", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveUpdateInsideMap", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveEscapeInsideMap", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionDownMoveUpInsideMap", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveDownInsideMap", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveLeftInsideMap", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveRightInsideMap", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveUpdateInsideMap", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveEscapeInsideMap", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpInsideMap", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveDownInsideMap", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveLeftInsideMap", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveRightInsideMap", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpdateInsideMap", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveEscapeInsideMap", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionRightMoveUpInsideMap", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveDownInsideMap", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveLeftInsideMap", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveRightInsideMap", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveUpdateInsideMap", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveEscapeInsideMap", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpInsideMap", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveDownInsideMap", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveLeftInsideMap", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveRightInsideMap", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpdateInsideMap", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveEscapeInsideMap", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpInsideMap", PacketBuilder.CreateMovement(100, 131, 10, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveDownInsideMap", PacketBuilder.CreateMovement(123, 170, 12, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveLeftInsideMap", PacketBuilder.CreateMovement(210, 156, 14, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveRightInsideMap", PacketBuilder.CreateMovement(51, 53, 16, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpdateInsideMap", PacketBuilder.CreateMovement(90, 150, 1, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveEscapeInsideMap", PacketBuilder.CreateMovement(87, 43, 7, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
/*
|
||||
* Test Outside Map (From Top)
|
||||
*/
|
||||
|
||||
results.Add(Test("Movement_DirectionUpMoveUpOutsideMapTopWalk", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveDownOutsideMapTopWalk", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveLeftOutsideMapTopWalk", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveRightOutsideMapTopWalk", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveUpdateOutsideMapTopWalk", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveEscapeOutsideMapTopWalk", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionDownMoveUpOutsideMapTopWalk", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveDownOutsideMapTopWalk", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveLeftOutsideMapTopWalk", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveRightOutsideMapTopWalk", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveUpdateOutsideMapTopWalk", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveEscapeOutsideMapTopWalk", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpOutsideMapTopWalk", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveDownOutsideMapTopWalk", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveLeftOutsideMapTopWalk", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveRightOutsideMapTopWalk", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpdateOutsideMapTopWalk", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveEscapeOutsideMapTopWalk", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionRightMoveUpOutsideMapTopWalk", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveDownOutsideMapTopWalk", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveLeftOutsideMapTopWalk", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveRightOutsideMapTopWalk", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveUpdateOutsideMapTopWalk", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveEscapeOutsideMapTopWalk", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpOutsideMapTopWalk", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveDownOutsideMapTopWalk", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveLeftOutsideMapTopWalk", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveRightOutsideMapTopWalk", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpdateOutsideMapTopWalk", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveEscapeOutsideMapTopWalk", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpOutsideMapTopWalk", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveDownOutsideMapTopWalk", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveLeftOutsideMapTopWalk", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveRightOutsideMapTopWalk", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpdateOutsideMapTopWalk", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveEscapeOutsideMapTopWalk", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
// walk = false
|
||||
|
||||
results.Add(Test("Movement_DirectionUpMoveUpOutsideMapTop", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveDownOutsideMapTop", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveLeftOutsideMapTop", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveRightOutsideMapTop", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveUpdateOutsideMapTop", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveEscapeOutsideMapTop", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionDownMoveUpOutsideMapTop", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveDownOutsideMapTop", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveLeftOutsideMapTop", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveRightOutsideMapTop", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveUpdateOutsideMapTop", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveEscapeOutsideMapTop", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpOutsideMapTop", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveDownOutsideMapTop", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveLeftOutsideMapTop", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveRightOutsideMapTop", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpdateOutsideMapTop", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveEscapeOutsideMapTop", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionRightMoveUpOutsideMapTop", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveDownOutsideMapTop", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveLeftOutsideMapTop", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveRightOutsideMapTop", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveUpdateOutsideMapTop", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveEscapeOutsideMapTop", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpOutsideMapTop", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveDownOutsideMapTop", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveLeftOutsideMapTop", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveRightOutsideMapTop", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpdateOutsideMapTop", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveEscapeOutsideMapTop", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpOutsideMapTop", PacketBuilder.CreateMovement(-100, -131, 10, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveDownOutsideMapTop", PacketBuilder.CreateMovement(-123, -170, 12, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveLeftOutsideMapTop", PacketBuilder.CreateMovement(-210, -156, 14, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveRightOutsideMapTop", PacketBuilder.CreateMovement(-51, -53, 16, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpdateOutsideMapTop", PacketBuilder.CreateMovement(-90, -150, 1, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveEscapeOutsideMapTop", PacketBuilder.CreateMovement(-87, -43, 7, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
/*
|
||||
* Test Outside Map (From Bottom)
|
||||
*/
|
||||
|
||||
results.Add(Test("Movement_DirectionUpMoveUpOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveDownOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveLeftOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveRightOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveUpdateOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionUpMoveEscapeOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionDownMoveUpOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveDownOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveLeftOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveRightOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveUpdateOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionDownMoveEscapeOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveDownOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveLeftOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveRightOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpdateOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveEscapeOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionRightMoveUpOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveDownOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveLeftOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveRightOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveUpdateOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionRightMoveEscapeOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveDownOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveLeftOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveRightOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpdateOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveEscapeOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UP, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveDownOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_DOWN, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveLeftOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_LEFT, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveRightOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_RIGHT, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpdateOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UPDATE, true)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveEscapeOutsideMapBottomWalk", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_ESCAPE, true)));
|
||||
|
||||
// walk = false
|
||||
|
||||
results.Add(Test("Movement_DirectionUpMoveUpOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveDownOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveLeftOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveRightOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveUpdateOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionUpMoveEscapeOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_UP, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionDownMoveUpOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveDownOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveLeftOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveRightOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveUpdateOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionDownMoveEscapeOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_DOWN, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveDownOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveLeftOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveRightOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveUpdateOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionLeftMoveEscapeOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_LEFT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionRightMoveUpOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveDownOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveLeftOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveRightOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveUpdateOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionRightMoveEscapeOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_RIGHT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveDownOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveLeftOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveRightOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveUpdateOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionTeleportMoveEscapeOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_TELEPORT, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+100, Map.Height+131, 10, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UP, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveDownOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+123, Map.Height+170, 12, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_DOWN, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveLeftOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+210, Map.Height+156, 14, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_LEFT, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveRightOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+51, Map.Height+53, 16, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_RIGHT, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveUpdateOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+90, Map.Height+150, 1, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_UPDATE, false)));
|
||||
results.Add(Test("Movement_DirectionNoneMoveEscapeOutsideMapBottom", PacketBuilder.CreateMovement(Map.Width+87, Map.Height+43, 7, PacketBuilder.DIRECTION_NONE, PacketBuilder.MOVE_ESCAPE, false)));
|
||||
|
||||
// Test Place Data Packet
|
||||
results.Add(Test("PlaceData", PacketBuilder.CreatePlaceData(World.Isles.ToArray(), World.Towns.ToArray(), World.Areas.ToArray())));
|
||||
|
||||
// Test Player Update
|
||||
results.Add(Test("PlayerInfoUpdateOrCreate", PacketBuilder.CreatePlayerInfoUpdateOrCreate(100, 200, PacketBuilder.DIRECTION_UP, 10, "Li")));
|
||||
results.Add(Test("PlayerLeave", PacketBuilder.CreatePlayerLeave("Li")));
|
||||
|
||||
// Test PlaySound Packet
|
||||
results.Add(Test("PlaySound", PacketBuilder.CreatePlaySound("PM")));
|
||||
|
||||
// Test Profile Page
|
||||
results.Add(Test("ProfilePage", PacketBuilder.CreateProfilePage("TRANS RIGHTS ARE HUMAN RIGHTS")));
|
||||
|
||||
// Test SecCode
|
||||
results.Add(Test("SecCode_AdminMod", PacketBuilder.CreateSecCode(new byte[] { 0x31, 0x52, 0x22 }, 0x34, true, true)));
|
||||
results.Add(Test("SecCode_Admin", PacketBuilder.CreateSecCode(new byte[] { 0x54, 0x32, 0x24 }, 0x34, true, false)));
|
||||
results.Add(Test("SecCode_Mod", PacketBuilder.CreateSecCode(new byte[] { 0x22, 0x12, 0x12 }, 0x34, false, true)));
|
||||
results.Add(Test("SecCode_User", PacketBuilder.CreateSecCode(new byte[] { 0x12, 0x32, 0x14 }, 0x34, false, false)));
|
||||
|
||||
// Test SwfModule
|
||||
results.Add(Test("SwfModule_Force", PacketBuilder.CreateSwfModule("test.swf", PacketBuilder.PACKET_SWF_MODULE_FORCE)));
|
||||
results.Add(Test("SwfModule_Gentle", PacketBuilder.CreateSwfModule("test.swf", PacketBuilder.PACKET_SWF_MODULE_GENTLE)));
|
||||
results.Add(Test("SwfModule_Cutscene", PacketBuilder.CreateSwfModule("test.swf", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE)));
|
||||
|
||||
// Test TileClickInfo
|
||||
results.Add(Test("TileClickInfo", PacketBuilder.CreateTileClickInfo("Trans Rights Are Human Rights")));
|
||||
|
||||
// Test TileOverlayFlags
|
||||
results.Add(Test("TileOverlayFlags", PacketBuilder.CreateTileOverlayFlags(new int[] { 1, 2, 3, 1, 2, 3, 1, 2, 3 })));
|
||||
|
||||
// Test TimeAndWeatherUpdate
|
||||
results.Add(Test("TimeAndWeatherUpdate", PacketBuilder.CreateTimeAndWeatherUpdate(10, 4, 541, "SUNNY")));
|
||||
results.Add(Test("WeatherUpdate", PacketBuilder.CreateWeatherUpdate("CLOUD")));
|
||||
|
||||
if (GENERATE)
|
||||
{
|
||||
string resultsStr = JsonConvert.SerializeObject(knownGoodPackets, Formatting.Indented);
|
||||
File.WriteAllText("test.json", resultsStr);
|
||||
}
|
||||
|
||||
foreach(bool result in results)
|
||||
{
|
||||
if (result == false)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
40
HorseIsleServer/HISPtests/UnitTests/ServerStartTest.cs
Normal file
40
HorseIsleServer/HISPtests/UnitTests/ServerStartTest.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using HISP.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Tests.UnitTests
|
||||
{
|
||||
public class ServerStartTest
|
||||
{
|
||||
|
||||
public static void OnShutdown()
|
||||
{
|
||||
ResultLogger.LogTestStatus(false, "START_SERVER", "OnShutdown called");
|
||||
}
|
||||
public static void LogStdout(bool error, string type, string text)
|
||||
{
|
||||
if (type == "CRASH")
|
||||
ResultLogger.LogTestStatus(false, "START_SERVER", text);
|
||||
}
|
||||
|
||||
public static bool RunServerStartTest()
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.SetCallback(LogStdout);
|
||||
Entry.SetShutdownCallback(OnShutdown);
|
||||
Entry.Start();
|
||||
ResultLogger.LogTestStatus(true, "START_SERVER_TEST", "Success.");
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ResultLogger.LogTestStatus(false, "START_SERVER_TEST", e.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
172
HorseIsleServer/HISPtests/UnitTests/UserTest.cs
Normal file
172
HorseIsleServer/HISPtests/UnitTests/UserTest.cs
Normal file
|
@ -0,0 +1,172 @@
|
|||
using HISP.Game;
|
||||
using HISP.Player;
|
||||
using HISP.Security;
|
||||
using HISP.Server;
|
||||
using HISP.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace HISP.Tests.UnitTests
|
||||
{
|
||||
public class UserTest
|
||||
{
|
||||
private const string ALLOWED_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
|
||||
|
||||
private static byte[] createLoginPacket(string username, string password)
|
||||
{
|
||||
byte[] loginInformation = Encoding.UTF8.GetBytes("91|" + Authentication.EncryptLogin(username) + "|" + Authentication.EncryptLogin(password) + "|");
|
||||
byte[] loginPacket = new byte[1 * 3 + loginInformation.Length];
|
||||
loginPacket[0] = PacketBuilder.PACKET_LOGIN;
|
||||
loginPacket[loginPacket.Length - 2] = PacketBuilder.PACKET_CLIENT_TERMINATOR;
|
||||
loginPacket[loginPacket.Length - 1] = PacketBuilder.PACKET_TERMINATOR;
|
||||
|
||||
Array.ConstrainedCopy(loginInformation, 0, loginPacket, 1, loginInformation.Length);
|
||||
|
||||
return loginPacket;
|
||||
}
|
||||
|
||||
private static byte[] createUserInfoPacket()
|
||||
{
|
||||
byte[] packet = new byte[] { PacketBuilder.PACKET_LOGIN, PacketBuilder.PACKET_CLIENT_TERMINATOR, PacketBuilder.PACKET_TERMINATOR};
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static bool Test(string testName, object value, object valueComp)
|
||||
{
|
||||
bool result = value.Equals(valueComp);
|
||||
if (result)
|
||||
ResultLogger.LogTestStatus(true, "USER_TEST "+testName, "Success.");
|
||||
else
|
||||
ResultLogger.LogTestResult(false, "USER_TEST " + testName, value.ToString(), valueComp.ToString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static async Task<byte[]> receiveAsync(Socket s)
|
||||
{
|
||||
byte[] buffer = new byte[s.Available];
|
||||
await s.ReceiveAsync(buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static async Task<bool> RunUserTest()
|
||||
{
|
||||
List<bool> results = new List<bool>();
|
||||
|
||||
string username = Helper.RandomString(ALLOWED_CHARS);
|
||||
string password = Helper.RandomString(ALLOWED_CHARS);
|
||||
|
||||
int userId = Authentication.CreateAccount(username, password, "GENDERFLUID", true, true);
|
||||
|
||||
// Connect to running server via TCP;
|
||||
using (Socket hispServer = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
|
||||
{
|
||||
// This is already a pretty good unit test; confirming we can actually login to the game,
|
||||
|
||||
try
|
||||
{
|
||||
await hispServer.ConnectAsync("127.0.0.1", ConfigReader.Port);
|
||||
|
||||
// Login to the game;
|
||||
await hispServer.SendAsync(createLoginPacket(username, password));
|
||||
await receiveAsync(hispServer);
|
||||
|
||||
await hispServer.SendAsync(createUserInfoPacket());
|
||||
await receiveAsync(hispServer);
|
||||
|
||||
|
||||
ResultLogger.LogTestStatus(true, "GAME_LOGIN_TEST", "Success.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ResultLogger.LogTestStatus(false, "GAME_LOGIN_TEST", e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// While were here; lets do a bunch of tests on HISPs "User" object.
|
||||
User user = GameServer.GetUserById(userId);
|
||||
|
||||
|
||||
// Test Maximums
|
||||
|
||||
user.SetMoney(Int32.MaxValue);
|
||||
user.AddMoney(1000);
|
||||
results.Add(Test("MoneyOverflow", user.Money, Int32.MaxValue));
|
||||
|
||||
user.Hunger = 8000;
|
||||
results.Add(Test("HungerMaximumEnforcement", user.Hunger, 1000));
|
||||
user.Hunger = -8000;
|
||||
results.Add(Test("HungerMinimumEnforcement", user.Hunger, 0));
|
||||
|
||||
user.BankMoney = 9999999999.9999;
|
||||
user.BankMoney += 1000.0;
|
||||
results.Add(Test("BankMoneyMaximumEnforcement", user.BankMoney, 9999999999.9999));
|
||||
|
||||
user.BankInterest = 9999999999.9999;
|
||||
user.BankInterest += 1000.0;
|
||||
results.Add(Test("BankInterestMaximumEnforcement", user.BankInterest, 9999999999.9999));
|
||||
|
||||
// Test Gender Setting
|
||||
user.Gender = "GENDERFLUID";
|
||||
results.Add(Test("GenderedPronounsTestTheir", user.GetPronouns(true), Messages.PronounNeutralTheir));
|
||||
results.Add(Test("GenderedPronounsTestThey", user.GetPronouns(false), Messages.PronounNeutralThey));
|
||||
|
||||
user.Gender = "MALE";
|
||||
results.Add(Test("GenderedPronounsTestHis", user.GetPronouns(true), Messages.PronounMaleHis));
|
||||
results.Add(Test("GenderedPronounsTestHe", user.GetPronouns(false), Messages.PronounMaleHe));
|
||||
|
||||
user.Gender = "FEMALE";
|
||||
results.Add(Test("GenderedPronounsTestHer", user.GetPronouns(true), Messages.PronounFemaleHer));
|
||||
results.Add(Test("GenderedPronounsTestShe", user.GetPronouns(false), Messages.PronounFemaleShe));
|
||||
|
||||
// Test icon
|
||||
|
||||
results.Add(Test("IconTestAdmin", user.GetPlayerListIcon(), Messages.AdminIcon));
|
||||
user.Administrator = false;
|
||||
results.Add(Test("IconTestModerator", user.GetPlayerListIcon(), Messages.ModeratorIcon));
|
||||
user.Moderator = false;
|
||||
results.Add(Test("IconTestNew", user.GetPlayerListIcon(), Messages.NewUserIcon));
|
||||
user.NewPlayer = false;
|
||||
results.Add(Test("IconTestNone", user.GetPlayerListIcon(), -1));
|
||||
|
||||
user.SubscribedUntil = DateTime.UtcNow.AddMonths(1);
|
||||
user.Subscribed = true;
|
||||
results.Add(Test("IconTest1Month", user.GetPlayerListIcon(), Messages.MonthSubscriptionIcon));
|
||||
user.SubscribedUntil = DateTime.UtcNow.AddMonths(3);
|
||||
results.Add(Test("IconTest3Month", user.GetPlayerListIcon(), Messages.ThreeMonthSubscripitionIcon));
|
||||
user.SubscribedUntil = DateTime.UtcNow.AddYears(1).AddMonths(3);
|
||||
results.Add(Test("IconTest1Year", user.GetPlayerListIcon(), Messages.YearSubscriptionIcon));
|
||||
|
||||
// SecCode
|
||||
user.SecCodeSeeds[0] = 0x34;
|
||||
user.SecCodeSeeds[1] = 0x39;
|
||||
user.SecCodeSeeds[2] = 0x2a;
|
||||
user.SecCodeInc = 0x3e;
|
||||
|
||||
byte[] expectedSecCodeResult = { 0x55, 0x3C, 0x4B, 0x58 };
|
||||
byte[] gotSecCode = user.GenerateSecCode();
|
||||
|
||||
results.Add(Test("GenerateSecCode", gotSecCode.SequenceEqual(expectedSecCodeResult), true));
|
||||
|
||||
|
||||
|
||||
foreach (bool result in results)
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
BIN
HorseIsleServer/HISPtests/icon.ico
Normal file
BIN
HorseIsleServer/HISPtests/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
|
@ -201,7 +201,7 @@ namespace HISP.Game
|
|||
break;
|
||||
}
|
||||
byte[] startingUpEventPacket = PacketBuilder.CreateChat(message, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swf, PacketBuilder.PACKET_SWF_CUTSCENE);
|
||||
byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swf, PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
Logger.DebugPrint(entry.EnteredUser.Username + " Loading swf: " + swf);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(swfModulePacket);
|
||||
entry.EnteredUser.LoggedinClient.SendPacket(startingUpEventPacket);
|
||||
|
|
|
@ -766,7 +766,7 @@ namespace HISP.Game.Chat
|
|||
}
|
||||
|
||||
playSwf:;
|
||||
byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
|
||||
byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
user.LoggedinClient.SendPacket(swfPacket);
|
||||
|
||||
|
||||
|
|
|
@ -3008,9 +3008,9 @@ namespace HISP.Game
|
|||
return LogoutMessageFormat.Replace("%USERNAME%", username);
|
||||
}
|
||||
|
||||
public static string FormatMOTD()
|
||||
public static string FormatMotd(string Motd)
|
||||
{
|
||||
return MotdFormat.Replace("%MOTD%", ConfigReader.Motd);
|
||||
return MotdFormat.Replace("%MOTD%", Motd);
|
||||
}
|
||||
public static string FormatWelcomeMessage(string username)
|
||||
{
|
||||
|
|
|
@ -264,7 +264,7 @@ namespace HISP.Game
|
|||
// Is cloud isles quest?
|
||||
if (quest.Id == CloudIslesQuest)
|
||||
{
|
||||
byte[] swfLoadPacket = PacketBuilder.CreateSwfModule("ballooncutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
|
||||
byte[] swfLoadPacket = PacketBuilder.CreateSwfModule("ballooncutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
user.LoggedinClient.SendPacket(swfLoadPacket);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace HISP.Game
|
|||
Database.DeleteTreasure(this.RandomId);
|
||||
GenerateTreasure();
|
||||
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovement(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
user.LoggedinClient.SendPacket(MovementPacket);
|
||||
|
||||
user.AddMoney(Value);
|
||||
|
|
|
@ -1,100 +1,100 @@
|
|||
using HISP.Server;
|
||||
using HISP.Server;
|
||||
using HISP.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Player
|
||||
{
|
||||
public class Award
|
||||
{
|
||||
public struct AwardEntry
|
||||
{
|
||||
public int Id;
|
||||
public int Sort;
|
||||
public string Title;
|
||||
public int IconId;
|
||||
public int MoneyBonus;
|
||||
public string CompletionText;
|
||||
public string Description;
|
||||
}
|
||||
|
||||
public static AwardEntry[] GlobalAwardList;
|
||||
|
||||
public static AwardEntry GetAwardById(int id)
|
||||
{
|
||||
//99% fo the time this will work
|
||||
try
|
||||
{
|
||||
AwardEntry award = GlobalAwardList[id - 1];
|
||||
if (award.Id == id)
|
||||
return award;
|
||||
}
|
||||
catch (Exception) { };
|
||||
|
||||
// Incase it doesnt...
|
||||
foreach(AwardEntry award in GlobalAwardList)
|
||||
{
|
||||
if (award.Id == id)
|
||||
return award;
|
||||
}
|
||||
|
||||
throw new KeyNotFoundException("Award ID " + id + " Does not exist.");
|
||||
}
|
||||
|
||||
|
||||
private ThreadSafeList<AwardEntry> awardsEarned;
|
||||
private User baseUser;
|
||||
public AwardEntry[] AwardsEarned
|
||||
{
|
||||
get
|
||||
{
|
||||
return awardsEarned.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasAward(AwardEntry award)
|
||||
{
|
||||
foreach(AwardEntry awardEntry in AwardsEarned)
|
||||
{
|
||||
if (awardEntry.Id == award.Id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void AddAward(AwardEntry award,bool addToDatabase=true)
|
||||
{
|
||||
if (HasAward(award))
|
||||
return;
|
||||
|
||||
if (addToDatabase)
|
||||
{
|
||||
Database.AddAward(baseUser.Id, award.Id);
|
||||
|
||||
baseUser.AddMoney(award.MoneyBonus);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(award.CompletionText, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(chatPacket);
|
||||
}
|
||||
|
||||
|
||||
awardsEarned.Add(award);
|
||||
}
|
||||
|
||||
public Award(User user)
|
||||
{
|
||||
baseUser = user;
|
||||
int[] awards = Database.GetAwards(user.Id);
|
||||
awardsEarned = new ThreadSafeList<AwardEntry>();
|
||||
|
||||
foreach (int awardid in awards)
|
||||
{
|
||||
AddAward(GetAwardById(awardid), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HISP.Player
|
||||
{
|
||||
public class Award
|
||||
{
|
||||
public struct AwardEntry
|
||||
{
|
||||
public int Id;
|
||||
public int Sort;
|
||||
public string Title;
|
||||
public int IconId;
|
||||
public int MoneyBonus;
|
||||
public string CompletionText;
|
||||
public string Description;
|
||||
}
|
||||
|
||||
public static AwardEntry[] GlobalAwardList;
|
||||
|
||||
public static AwardEntry GetAwardById(int id)
|
||||
{
|
||||
//99% fo the time this will work
|
||||
try
|
||||
{
|
||||
AwardEntry award = GlobalAwardList[id - 1];
|
||||
if (award.Id == id)
|
||||
return award;
|
||||
}
|
||||
catch (Exception) { };
|
||||
|
||||
// Incase it doesnt...
|
||||
foreach(AwardEntry award in GlobalAwardList)
|
||||
{
|
||||
if (award.Id == id)
|
||||
return award;
|
||||
}
|
||||
|
||||
throw new KeyNotFoundException("Award ID " + id + " Does not exist.");
|
||||
}
|
||||
|
||||
|
||||
private ThreadSafeList<AwardEntry> awardsEarned;
|
||||
private User baseUser;
|
||||
public AwardEntry[] AwardsEarned
|
||||
{
|
||||
get
|
||||
{
|
||||
return awardsEarned.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasAward(AwardEntry award)
|
||||
{
|
||||
foreach(AwardEntry awardEntry in AwardsEarned)
|
||||
{
|
||||
if (awardEntry.Id == award.Id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void AddAward(AwardEntry award,bool addToDatabase=true)
|
||||
{
|
||||
if (HasAward(award))
|
||||
return;
|
||||
|
||||
if (addToDatabase)
|
||||
{
|
||||
Database.AddAward(baseUser.Id, award.Id);
|
||||
|
||||
baseUser.AddMoney(award.MoneyBonus);
|
||||
|
||||
byte[] chatPacket = PacketBuilder.CreateChat(award.CompletionText, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
baseUser.LoggedinClient.SendPacket(chatPacket);
|
||||
}
|
||||
|
||||
|
||||
awardsEarned.Add(award);
|
||||
}
|
||||
|
||||
public Award(User user)
|
||||
{
|
||||
baseUser = user;
|
||||
int[] awards = Database.GetAwards(user.Id);
|
||||
awardsEarned = new ThreadSafeList<AwardEntry>();
|
||||
|
||||
foreach (int awardid in awards)
|
||||
{
|
||||
AddAward(GetAwardById(awardid), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace HISP.Player
|
|||
|
||||
baseUser.Facing = direction + (onHorse * 5);
|
||||
|
||||
byte[] moveResponse = PacketBuilder.CreateMovementPacket(baseUser.X, baseUser.Y, baseUser.CharacterId, baseUser.Facing, PacketBuilder.DIRECTION_NONE, false);
|
||||
byte[] moveResponse = PacketBuilder.CreateMovement(baseUser.X, baseUser.Y, baseUser.CharacterId, baseUser.Facing, PacketBuilder.DIRECTION_NONE, false);
|
||||
baseUser.LoggedinClient.SendPacket(moveResponse);
|
||||
|
||||
GameServer.UpdateUserFacingAndLocation(baseUser);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.8.23.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.23.0")]
|
||||
[assembly: AssemblyVersion("1.8.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.30.0")]
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,88 +1,134 @@
|
|||
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
using HISP.Server;
|
||||
|
||||
namespace HISP.Security
|
||||
{
|
||||
public class Authentication
|
||||
{
|
||||
public static string DecryptLogin(string encpass)
|
||||
{
|
||||
string decrypt = "";
|
||||
string ROTPOOL = "bl7Jgk61IZdnY mfDN5zjM2XLqTCty4WSEoKR3BFVQsaUhHOAx0rPwp9uc8iGve";
|
||||
string POSPOOL = "DQc3uxiGsKZatMmOS5qYveN71zoPTk8yU0H2w9VjprBXWn l4FJd6IRbhgACfEL";
|
||||
string ROTPOOL2 = "evGi8cu9pwPr0xAOHhUasQVFB3RKoESW4ytCTqLX2Mjz5NDfm YndZI16kgJ7lb";
|
||||
|
||||
|
||||
int i = 0;
|
||||
int ii = 0;
|
||||
while (i < encpass.Length)
|
||||
{
|
||||
int ROT = ROTPOOL.IndexOf(encpass[i].ToString());
|
||||
int POS = POSPOOL.IndexOf(encpass[i + 1].ToString());
|
||||
POS -= (ROT + ii);
|
||||
if (POS < 0)
|
||||
{
|
||||
POS = (POS / -1) - 1;
|
||||
|
||||
while (POS >= ROTPOOL.Length)
|
||||
{
|
||||
POS -= ROTPOOL.Length;
|
||||
}
|
||||
|
||||
decrypt += ROTPOOL2[POS];
|
||||
}
|
||||
else
|
||||
{
|
||||
while (POS >= ROTPOOL.Length)
|
||||
{
|
||||
POS -= ROTPOOL.Length;
|
||||
}
|
||||
|
||||
decrypt += ROTPOOL[POS];
|
||||
}
|
||||
|
||||
i += 2;
|
||||
ii += 1;
|
||||
}
|
||||
return decrypt.Replace(" ", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static byte[] HashAndSalt(string plaintext, byte[] salt)
|
||||
{
|
||||
byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext);
|
||||
|
||||
SHA512 sha512 = SHA512.Create();
|
||||
byte[] hash = sha512.ComputeHash(plaintextBytes);
|
||||
|
||||
for (int i = 0; i < hash.Length; i++)
|
||||
{
|
||||
hash[i] ^= salt[i];
|
||||
}
|
||||
|
||||
byte[] finalHash = sha512.ComputeHash(hash);
|
||||
|
||||
return finalHash;
|
||||
}
|
||||
|
||||
public static bool CheckPassword(string username, string password)
|
||||
{
|
||||
if(Database.CheckUserExist(username))
|
||||
{
|
||||
byte[] expectedPassword = Database.GetPasswordHash(username);
|
||||
byte[] salt = Database.GetPasswordSalt(username);
|
||||
byte[] hashedPassword = HashAndSalt(password, salt);
|
||||
|
||||
if (Enumerable.SequenceEqual(expectedPassword, hashedPassword))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
using HISP.Server;
|
||||
using System;
|
||||
using HISP.Util;
|
||||
|
||||
namespace HISP.Security
|
||||
{
|
||||
public class Authentication
|
||||
{
|
||||
|
||||
public const string ROTPOOL = "bl7Jgk61IZdnY mfDN5zjM2XLqTCty4WSEoKR3BFVQsaUhHOAx0rPwp9uc8iGve";
|
||||
public const string POSPOOL = "DQc3uxiGsKZatMmOS5qYveN71zoPTk8yU0H2w9VjprBXWn l4FJd6IRbhgACfEL";
|
||||
|
||||
public static string EncryptLogin(string plainpass)
|
||||
{
|
||||
string encrypt = "";
|
||||
|
||||
int i = 0;
|
||||
while (i < plainpass.Length)
|
||||
{
|
||||
int rotation = GameServer.RandomNumberGenerator.Next(0, ROTPOOL.Length);
|
||||
int position = ROTPOOL.IndexOf(plainpass[i]);
|
||||
|
||||
position = position + (rotation + i);
|
||||
while (position >= ROTPOOL.Length)
|
||||
position -= ROTPOOL.Length;
|
||||
encrypt += ROTPOOL[rotation];
|
||||
encrypt += POSPOOL[position];
|
||||
|
||||
i++;
|
||||
}
|
||||
return encrypt;
|
||||
|
||||
}
|
||||
public static string DecryptLogin(string encpass)
|
||||
{
|
||||
string decrypt = "";
|
||||
|
||||
int i = 0;
|
||||
int rotationCycle = 0;
|
||||
while (i < encpass.Length)
|
||||
{
|
||||
int rotation = ROTPOOL.IndexOf(encpass[i].ToString());
|
||||
int position = POSPOOL.IndexOf(encpass[i + 1].ToString());
|
||||
position -= (rotation + rotationCycle);
|
||||
if (position < 0)
|
||||
{
|
||||
position = (position / -1) - 1;
|
||||
|
||||
while (position >= ROTPOOL.Length)
|
||||
position -= ROTPOOL.Length;
|
||||
|
||||
decrypt += Helper.ReverseString(ROTPOOL)[position];
|
||||
}
|
||||
else
|
||||
{
|
||||
while (position >= ROTPOOL.Length)
|
||||
position -= ROTPOOL.Length;
|
||||
|
||||
decrypt += ROTPOOL[position];
|
||||
}
|
||||
|
||||
i += 2;
|
||||
rotationCycle++;
|
||||
}
|
||||
return decrypt.Replace(" ", "");
|
||||
}
|
||||
|
||||
public static byte[] Sha512Digest(byte[] message)
|
||||
{
|
||||
using (SHA512 sha512 = SHA512.Create())
|
||||
return sha512.ComputeHash(message);
|
||||
}
|
||||
|
||||
public static byte[] XorBytes(byte[] plaintext, byte[] key)
|
||||
{
|
||||
int length = Math.Min(plaintext.Length, key.Length);
|
||||
|
||||
byte[] ciphertext = new byte[length];
|
||||
for(int i = 0; i < length; i++)
|
||||
ciphertext[i] = Convert.ToByte(plaintext[i] ^ key[i]);
|
||||
|
||||
return ciphertext;
|
||||
}
|
||||
|
||||
public static byte[] HashAndSalt(string plaintext, byte[] salt)
|
||||
{
|
||||
byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext);
|
||||
|
||||
byte[] hash = Sha512Digest(plaintextBytes);
|
||||
byte[] saltedHash = XorBytes(hash, salt);
|
||||
byte[] finalHash = Sha512Digest(saltedHash);
|
||||
|
||||
return finalHash;
|
||||
}
|
||||
|
||||
public static bool CheckPassword(string username, string password)
|
||||
{
|
||||
if(Database.CheckUserExist(username))
|
||||
{
|
||||
byte[] expectedPassword = Database.GetPasswordHash(username);
|
||||
byte[] salt = Database.GetPasswordSalt(username);
|
||||
byte[] hashedPassword = HashAndSalt(password, salt);
|
||||
|
||||
if (Enumerable.SequenceEqual(expectedPassword, hashedPassword))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int CreateAccount(string username, string password, string gender, bool admin, bool moderator)
|
||||
{
|
||||
// Get a free user id
|
||||
int userId = Database.GetNextFreeUserId();
|
||||
|
||||
// Generate salt value
|
||||
byte[] salt = new byte[64];
|
||||
GameServer.RandomNumberGenerator.NextBytes(salt);
|
||||
string saltText = BitConverter.ToString(salt).Replace("-", "");
|
||||
string hashsalt = BitConverter.ToString(Authentication.HashAndSalt(password, salt)).Replace("-", "");
|
||||
|
||||
// Add user to database
|
||||
Database.CreateUser(userId, username, hashsalt, saltText, gender, admin, moderator);
|
||||
|
||||
return userId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
using System.Threading;
|
||||
|
||||
namespace HISP.Security
|
||||
{
|
||||
public class RandomID
|
||||
{
|
||||
private static Mutex rndmIdMutex = new Mutex();
|
||||
private static int prevId = 0;
|
||||
public static int NextRandomId(int randomId=-1)
|
||||
{
|
||||
int rndmId = 0;
|
||||
rndmIdMutex.WaitOne();
|
||||
|
||||
if (randomId == -1)
|
||||
rndmId = prevId+1;
|
||||
else
|
||||
rndmId = randomId;
|
||||
|
||||
if (rndmId >= prevId)
|
||||
namespace HISP.Security
|
||||
{
|
||||
public class RandomID
|
||||
{
|
||||
private static Mutex rndmIdMutex = new Mutex();
|
||||
private static int prevId = 0;
|
||||
public static int NextRandomId(int randomId=-1)
|
||||
{
|
||||
int rndmId = 0;
|
||||
rndmIdMutex.WaitOne();
|
||||
|
||||
if (randomId == -1)
|
||||
rndmId = prevId+1;
|
||||
else
|
||||
rndmId = randomId;
|
||||
|
||||
if (rndmId >= prevId)
|
||||
prevId = rndmId;
|
||||
|
||||
rndmIdMutex.ReleaseMutex();
|
||||
|
||||
return rndmId;
|
||||
}
|
||||
}
|
||||
}
|
||||
rndmIdMutex.ReleaseMutex();
|
||||
|
||||
return rndmId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,141 +1,141 @@
|
|||
using HISP.Properties;
|
||||
using System.IO;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
|
||||
public class ConfigReader
|
||||
{
|
||||
public static int Port = 12321;
|
||||
public static string BindIP = "0.0.0.0";
|
||||
|
||||
public static string DatabaseIP = "127.0.0.1";
|
||||
public static string DatabaseName = "game1";
|
||||
public static string DatabaseUsername = "root";
|
||||
public static string DatabasePassword = "test123";
|
||||
|
||||
public static int DatabasePort = 3306;
|
||||
public static int IntrestRate = 3333;
|
||||
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
|
||||
public static string MapFile = "HI1.MAP";
|
||||
public static string GameData = "gamedata.json";
|
||||
public static string CrossDomainPolicyFile = "CrossDomainPolicy.xml";
|
||||
|
||||
public static string ModsFolder = "mods";
|
||||
public static int LogLevel = 4;
|
||||
|
||||
public static bool SqlLite = false;
|
||||
public static bool EnableSpamFilter = true;
|
||||
public static bool AllUsersSubbed = false;
|
||||
public static bool FixOfficalBugs = false;
|
||||
public static bool EnableSwearFilter = true;
|
||||
public static bool EnableCorrections = true;
|
||||
public static bool EnableNonViolations = true;
|
||||
|
||||
public static string ConfigurationFileName = "server.properties";
|
||||
public static void OpenConfig()
|
||||
{
|
||||
if (!File.Exists(ConfigurationFileName))
|
||||
{
|
||||
Logger.WarnPrint(ConfigurationFileName+" not found! writing default.");
|
||||
File.WriteAllText(ConfigurationFileName, Resources.DefaultServerProperties);
|
||||
Logger.WarnPrint("! Its very likely database connection will fail...");
|
||||
}
|
||||
|
||||
string[] configFile = File.ReadAllLines(ConfigurationFileName);
|
||||
foreach (string setting in configFile)
|
||||
{
|
||||
/*
|
||||
* Avoid crashing.
|
||||
*/
|
||||
if (setting.Length < 1)
|
||||
continue;
|
||||
if (setting[0] == '#')
|
||||
continue;
|
||||
if (!setting.Contains("="))
|
||||
continue;
|
||||
|
||||
string[] dataPair = setting.Split('=');
|
||||
|
||||
string key = dataPair[0];
|
||||
string data = dataPair[1];
|
||||
/*
|
||||
* Parse configuration file
|
||||
*/
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case "port":
|
||||
Port = int.Parse(data);
|
||||
break;
|
||||
case "ip":
|
||||
BindIP = data;
|
||||
break;
|
||||
case "db_ip":
|
||||
DatabaseIP = data;
|
||||
break;
|
||||
case "db_username":
|
||||
DatabaseUsername = data;
|
||||
break;
|
||||
case "db_password":
|
||||
DatabasePassword = data;
|
||||
break;
|
||||
case "db_name":
|
||||
DatabaseName = data;
|
||||
break;
|
||||
case "db_port":
|
||||
DatabasePort = int.Parse(data);
|
||||
break;
|
||||
case "map":
|
||||
MapFile = data;
|
||||
break;
|
||||
case "motd":
|
||||
Motd = data;
|
||||
break;
|
||||
case "gamedata":
|
||||
GameData = data;
|
||||
break;
|
||||
case "crossdomain":
|
||||
CrossDomainPolicyFile = data;
|
||||
break;
|
||||
case "all_users_subscribed":
|
||||
AllUsersSubbed = data == "true";
|
||||
break;
|
||||
case "enable_corrections":
|
||||
EnableCorrections = data == "true";
|
||||
break;
|
||||
case "sql_lite":
|
||||
SqlLite = data == "true";
|
||||
break;
|
||||
case "enable_non_violation_check":
|
||||
EnableNonViolations = data == "true";
|
||||
break;
|
||||
case "enable_spam_filter":
|
||||
EnableSpamFilter = data == "true";
|
||||
break;
|
||||
case "fix_offical_bugs":
|
||||
FixOfficalBugs = data == "true";
|
||||
break;
|
||||
case "enable_word_filter":
|
||||
EnableSwearFilter = data == "true";
|
||||
using HISP.Properties;
|
||||
using System.IO;
|
||||
|
||||
namespace HISP.Server
|
||||
{
|
||||
|
||||
public class ConfigReader
|
||||
{
|
||||
public static int Port = 12321;
|
||||
public static string BindIP = "0.0.0.0";
|
||||
|
||||
public static string DatabaseIP = "127.0.0.1";
|
||||
public static string DatabaseName = "game1";
|
||||
public static string DatabaseUsername = "root";
|
||||
public static string DatabasePassword = "test123";
|
||||
|
||||
public static int DatabasePort = 3306;
|
||||
public static int IntrestRate = 3333;
|
||||
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
|
||||
public static string MapFile = "HI1.MAP";
|
||||
public static string GameData = "gamedata.json";
|
||||
public static string CrossDomainPolicyFile = "CrossDomainPolicy.xml";
|
||||
|
||||
public static string ModsFolder = "mods";
|
||||
public static int LogLevel = 4;
|
||||
|
||||
public static bool SqlLite = false;
|
||||
public static bool EnableSpamFilter = true;
|
||||
public static bool AllUsersSubbed = false;
|
||||
public static bool FixOfficalBugs = false;
|
||||
public static bool EnableSwearFilter = true;
|
||||
public static bool EnableCorrections = true;
|
||||
public static bool EnableNonViolations = true;
|
||||
|
||||
public static string ConfigurationFileName = "server.properties";
|
||||
public static void OpenConfig()
|
||||
{
|
||||
if (!File.Exists(ConfigurationFileName))
|
||||
{
|
||||
Logger.WarnPrint(ConfigurationFileName+" not found! writing default.");
|
||||
File.WriteAllText(ConfigurationFileName, Resources.DefaultServerProperties);
|
||||
Logger.WarnPrint("! Its very likely database connection will fail...");
|
||||
}
|
||||
|
||||
string[] configFile = File.ReadAllLines(ConfigurationFileName);
|
||||
foreach (string setting in configFile)
|
||||
{
|
||||
/*
|
||||
* Avoid crashing.
|
||||
*/
|
||||
if (setting.Length < 1)
|
||||
continue;
|
||||
if (setting[0] == '#')
|
||||
continue;
|
||||
if (!setting.Contains("="))
|
||||
continue;
|
||||
|
||||
string[] dataPair = setting.Split('=');
|
||||
|
||||
string key = dataPair[0];
|
||||
string data = dataPair[1];
|
||||
/*
|
||||
* Parse configuration file
|
||||
*/
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case "port":
|
||||
Port = int.Parse(data);
|
||||
break;
|
||||
case "mods_folder":
|
||||
ModsFolder = data;
|
||||
break;
|
||||
case "intrest_rate":
|
||||
IntrestRate = int.Parse(data);
|
||||
break;
|
||||
case "log_level":
|
||||
LogLevel = int.Parse(data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
case "ip":
|
||||
BindIP = data;
|
||||
break;
|
||||
case "db_ip":
|
||||
DatabaseIP = data;
|
||||
break;
|
||||
case "db_username":
|
||||
DatabaseUsername = data;
|
||||
break;
|
||||
case "db_password":
|
||||
DatabasePassword = data;
|
||||
break;
|
||||
case "db_name":
|
||||
DatabaseName = data;
|
||||
break;
|
||||
case "db_port":
|
||||
DatabasePort = int.Parse(data);
|
||||
break;
|
||||
case "map":
|
||||
MapFile = data;
|
||||
break;
|
||||
case "motd":
|
||||
Motd = data;
|
||||
break;
|
||||
case "gamedata":
|
||||
GameData = data;
|
||||
break;
|
||||
case "crossdomain":
|
||||
CrossDomainPolicyFile = data;
|
||||
break;
|
||||
case "all_users_subscribed":
|
||||
AllUsersSubbed = data == "true";
|
||||
break;
|
||||
case "enable_corrections":
|
||||
EnableCorrections = data == "true";
|
||||
break;
|
||||
case "sql_lite":
|
||||
SqlLite = data == "true";
|
||||
break;
|
||||
case "enable_non_violation_check":
|
||||
EnableNonViolations = data == "true";
|
||||
break;
|
||||
case "enable_spam_filter":
|
||||
EnableSpamFilter = data == "true";
|
||||
break;
|
||||
case "fix_offical_bugs":
|
||||
FixOfficalBugs = data == "true";
|
||||
break;
|
||||
case "enable_word_filter":
|
||||
EnableSwearFilter = data == "true";
|
||||
break;
|
||||
case "mods_folder":
|
||||
ModsFolder = data;
|
||||
break;
|
||||
case "intrest_rate":
|
||||
IntrestRate = int.Parse(data);
|
||||
break;
|
||||
case "log_level":
|
||||
LogLevel = int.Parse(data);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4128,6 +4128,23 @@ namespace HISP.Server
|
|||
return subscribedUntil;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetUserSubscriptionStatus(int playerId, int subscribedUntil)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
{
|
||||
db.Open();
|
||||
DbCommand sqlCommand = db.CreateCommand();
|
||||
|
||||
sqlCommand.CommandText = "UPDATE UserExt SET SubscribedUntil=@subscribedUntil WHERE Id=@playerId";
|
||||
addWithValue(sqlCommand, "@subscribedUntil", subscribedUntil);
|
||||
addWithValue(sqlCommand, "@playerId", playerId);
|
||||
sqlCommand.Prepare();
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsUserAdmin(int playerId)
|
||||
{
|
||||
using (DbConnection db = connectDb())
|
||||
|
|
|
@ -693,7 +693,7 @@ namespace HISP.Server
|
|||
if (user.MuteAll || user.MuteSocials)
|
||||
continue;
|
||||
|
||||
byte[] soundEffect = PacketBuilder.CreatePlaysoundPacket(social.SoundEffect);
|
||||
byte[] soundEffect = PacketBuilder.CreatePlaySound(social.SoundEffect);
|
||||
user.LoggedinClient.SendPacket(soundEffect);
|
||||
}
|
||||
}
|
||||
|
@ -3694,7 +3694,7 @@ namespace HISP.Server
|
|||
User user = sender.LoggedinUser;
|
||||
|
||||
// Send player current location & map data
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovement(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
sender.SendPacket(MovementPacket);
|
||||
|
||||
// Send "Welcome to the Secret Land of Horses" message.
|
||||
|
@ -3770,7 +3770,7 @@ namespace HISP.Server
|
|||
sender.SendPacket(TileFlags);
|
||||
|
||||
// Send Todays Note:
|
||||
byte[] MotdData = PacketBuilder.CreateAnnouncement(Messages.FormatMOTD());
|
||||
byte[] MotdData = PacketBuilder.CreateMotd(Messages.FormatMotd(ConfigReader.Motd));
|
||||
sender.SendPacket(MotdData);
|
||||
|
||||
// Send riddle annoucement
|
||||
|
@ -3918,7 +3918,7 @@ namespace HISP.Server
|
|||
|
||||
if(room.Drawing != "")
|
||||
{
|
||||
byte[] drawingPacket = PacketBuilder.CreateDrawingUpdatePacket(room.Drawing);
|
||||
byte[] drawingPacket = PacketBuilder.CreateDrawingUpdate(room.Drawing);
|
||||
sender.SendPacket(drawingPacket);
|
||||
}
|
||||
|
||||
|
@ -4117,7 +4117,7 @@ namespace HISP.Server
|
|||
break;
|
||||
}
|
||||
// Send list of peices
|
||||
byte[] poetPacket = PacketBuilder.CreateBrickPoetListPacket(room);
|
||||
byte[] poetPacket = PacketBuilder.CreateBrickPoetList(room);
|
||||
sender.SendPacket(poetPacket);
|
||||
|
||||
}
|
||||
|
@ -4173,7 +4173,7 @@ namespace HISP.Server
|
|||
if (user.Id == sender.LoggedinUser.Id)
|
||||
continue;
|
||||
|
||||
byte[] updatePoetRoomPacket = PacketBuilder.CreateBrickPoetMovePacket(peice);
|
||||
byte[] updatePoetRoomPacket = PacketBuilder.CreateBrickPoetMove(peice);
|
||||
user.LoggedinClient.SendPacket(updatePoetRoomPacket);
|
||||
|
||||
}
|
||||
|
@ -4206,7 +4206,7 @@ namespace HISP.Server
|
|||
|
||||
if (room.DressupPeices.Length > 0)
|
||||
{
|
||||
byte[] allDressupsResponse = PacketBuilder.CreateDressupRoomPeiceLoad(room.DressupPeices.ToArray());
|
||||
byte[] allDressupsResponse = PacketBuilder.CreateDressupRoomPeiceLoad(room.DressupPeices);
|
||||
sender.SendPacket(allDressupsResponse);
|
||||
}
|
||||
|
||||
|
@ -4280,7 +4280,7 @@ namespace HISP.Server
|
|||
}
|
||||
break;
|
||||
case PacketBuilder.SWFMODULE_BANDHALL:
|
||||
byte[] response = PacketBuilder.CreateForwardedSwfRequest(packet);
|
||||
byte[] response = PacketBuilder.CreateForwardedSwfModule(packet);
|
||||
foreach (User user in GetUsersAt(sender.LoggedinUser.X, sender.LoggedinUser.Y))
|
||||
{
|
||||
if (user.Id == sender.LoggedinUser.Id)
|
||||
|
@ -4299,7 +4299,7 @@ namespace HISP.Server
|
|||
else if (twoPlayerGame.Inviting.Id == sender.LoggedinUser.Id)
|
||||
otherUser = twoPlayerGame.Invitee;
|
||||
|
||||
response = PacketBuilder.CreateForwardedSwfRequest(packet);
|
||||
response = PacketBuilder.CreateForwardedSwfModule(packet);
|
||||
otherUser.LoggedinClient.SendPacket(response);
|
||||
}
|
||||
break;
|
||||
|
@ -4326,7 +4326,7 @@ namespace HISP.Server
|
|||
if (Arena.UserHasEnteredHorseInAnyArena(sender.LoggedinUser))
|
||||
{
|
||||
Arena arena = Arena.GetArenaUserEnteredIn(sender.LoggedinUser);
|
||||
response = PacketBuilder.CreateForwardedSwfRequest(packet);
|
||||
response = PacketBuilder.CreateForwardedSwfModule(packet);
|
||||
foreach (Arena.ArenaEntry entry in arena.Entries.ToArray())
|
||||
{
|
||||
if (entry.EnteredUser.Id == sender.LoggedinUser.Id)
|
||||
|
@ -5088,7 +5088,7 @@ namespace HISP.Server
|
|||
|
||||
loggedInUser.Facing = Direction + (onHorse * 5);
|
||||
Logger.DebugPrint("Exiting player: " + loggedInUser.Username + " to: " + loggedInUser.X + "," + loggedInUser.Y);
|
||||
byte[] moveResponse = PacketBuilder.CreateMovementPacket(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, Direction, true);
|
||||
byte[] moveResponse = PacketBuilder.CreateMovement(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, Direction, true);
|
||||
sender.SendPacket(moveResponse);
|
||||
goto Complete;
|
||||
}
|
||||
|
@ -5177,12 +5177,12 @@ namespace HISP.Server
|
|||
}
|
||||
}
|
||||
|
||||
byte[] moveResponse = PacketBuilder.CreateMovementPacket(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, direction, true);
|
||||
byte[] moveResponse = PacketBuilder.CreateMovement(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, direction, true);
|
||||
sender.SendPacket(moveResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] moveResponse = PacketBuilder.CreateMovementPacket(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, PacketBuilder.DIRECTION_NONE, false);
|
||||
byte[] moveResponse = PacketBuilder.CreateMovement(loggedInUser.X, loggedInUser.Y, loggedInUser.CharacterId, loggedInUser.Facing, PacketBuilder.DIRECTION_NONE, false);
|
||||
sender.SendPacket(moveResponse);
|
||||
}
|
||||
Complete:;
|
||||
|
@ -5396,7 +5396,7 @@ namespace HISP.Server
|
|||
|
||||
if (transportLocation.Type != "ROWBOAT")
|
||||
{
|
||||
byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swfToLoad, PacketBuilder.PACKET_SWF_CUTSCENE);
|
||||
byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swfToLoad, PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
sender.SendPacket(swfModulePacket);
|
||||
}
|
||||
|
||||
|
@ -5491,7 +5491,7 @@ namespace HISP.Server
|
|||
User[] users = GetUsersAt(sender.LoggedinUser.X, sender.LoggedinUser.Y, true, true);
|
||||
foreach (User user in users)
|
||||
{
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovement(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
user.LoggedinClient.SendPacket(MovementPacket);
|
||||
}
|
||||
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true);
|
||||
|
@ -5531,7 +5531,7 @@ namespace HISP.Server
|
|||
User[] users = GetUsersAt(sender.LoggedinUser.X, sender.LoggedinUser.Y, true, true);
|
||||
foreach (User user in users)
|
||||
{
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
byte[] MovementPacket = PacketBuilder.CreateMovement(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
|
||||
user.LoggedinClient.SendPacket(MovementPacket);
|
||||
}
|
||||
UpdateAreaForAll(sender.LoggedinUser.X, sender.LoggedinUser.Y, true);
|
||||
|
@ -6017,7 +6017,7 @@ namespace HISP.Server
|
|||
|
||||
byte[] chatPacketOthers = PacketBuilder.CreateChat(formattedMessage, chatSide);
|
||||
byte[] chatPacketSender = PacketBuilder.CreateChat(formattedMessageSender, chatSide);
|
||||
byte[] playDmSound = PacketBuilder.CreatePlaysoundPacket(Chat.PrivateMessageSound);
|
||||
byte[] playDmSound = PacketBuilder.CreatePlaySound(Chat.PrivateMessageSound);
|
||||
|
||||
// Send to clients ...
|
||||
foreach (GameClient recipiant in recipiants)
|
||||
|
@ -7389,7 +7389,7 @@ namespace HISP.Server
|
|||
if(Database.IsUserBanned(userId))
|
||||
{
|
||||
Logger.DebugPrint(sender.RemoteIp + " Tried to login to : " + username + " but, the account was banned.");
|
||||
byte[] userBannedPacket = PacketBuilder.CreateLoginPacket(false, Messages.LoginFailedReasonBanned);
|
||||
byte[] userBannedPacket = PacketBuilder.CreateLogin(false, Messages.LoginFailedReasonBanned);
|
||||
sender.SendPacket(userBannedPacket);
|
||||
return;
|
||||
}
|
||||
|
@ -7397,18 +7397,15 @@ namespace HISP.Server
|
|||
if(Database.IsIpBanned(sender.RemoteIp))
|
||||
{
|
||||
Logger.DebugPrint(sender.RemoteIp + " Tried to login to : " + username + " but, the IP was banned.");
|
||||
byte[] ipBannedPacket = PacketBuilder.CreateLoginPacket(false, Messages.FormatIpBannedMessage(sender.RemoteIp));
|
||||
byte[] ipBannedPacket = PacketBuilder.CreateLogin(false, Messages.FormatIpBannedMessage(sender.RemoteIp));
|
||||
sender.SendPacket(ipBannedPacket);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sender.Login(userId);
|
||||
sender.LoggedinUser.Password = password;
|
||||
|
||||
byte[] ResponsePacket = PacketBuilder.CreateLoginPacket(true);
|
||||
byte[] ResponsePacket = PacketBuilder.CreateLogin(true);
|
||||
sender.SendPacket(ResponsePacket);
|
||||
|
||||
Logger.DebugPrint(sender.RemoteIp + " Logged into : " + sender.LoggedinUser.Username + " (ADMIN: " + sender.LoggedinUser.Administrator + " MOD: " + sender.LoggedinUser.Moderator + ")");
|
||||
|
@ -7417,7 +7414,7 @@ namespace HISP.Server
|
|||
else
|
||||
{
|
||||
Logger.WarnPrint(sender.RemoteIp + " Attempted to login to: " + username + " with incorrect password ");
|
||||
byte[] ResponsePacket = PacketBuilder.CreateLoginPacket(false);
|
||||
byte[] ResponsePacket = PacketBuilder.CreateLogin(false);
|
||||
sender.SendPacket(ResponsePacket);
|
||||
}
|
||||
}
|
||||
|
@ -7467,7 +7464,7 @@ namespace HISP.Server
|
|||
client.SendPacket(logoutMessageBytes);
|
||||
|
||||
// Tell clients of diconnect (remove from chat)
|
||||
byte[] playerRemovePacket = PacketBuilder.CreatePlayerLeavePacket(sender.LoggedinUser.Username);
|
||||
byte[] playerRemovePacket = PacketBuilder.CreatePlayerLeave(sender.LoggedinUser.Username);
|
||||
foreach (GameClient client in GameClient.ConnectedClients)
|
||||
if (client.LoggedIn)
|
||||
if (client.LoggedinUser.Id != sender.LoggedinUser.Id)
|
||||
|
@ -7755,7 +7752,7 @@ namespace HISP.Server
|
|||
if (user.MailBox.UnreadMailCount > 0)
|
||||
{
|
||||
|
||||
byte[] RipOffAOLSound = PacketBuilder.CreatePlaysoundPacket(Messages.MailSe);
|
||||
byte[] RipOffAOLSound = PacketBuilder.CreatePlaySound(Messages.MailSe);
|
||||
user.LoggedinClient.SendPacket(RipOffAOLSound);
|
||||
|
||||
byte[] mailReceivedText = PacketBuilder.CreateChat(Messages.MailReceivedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
|
||||
|
@ -7830,7 +7827,7 @@ namespace HISP.Server
|
|||
if (user.Id == sender.LoggedinUser.Id)
|
||||
continue;
|
||||
|
||||
byte[] patchDrawing = PacketBuilder.CreateDrawingUpdatePacket(drawing);
|
||||
byte[] patchDrawing = PacketBuilder.CreateDrawingUpdate(drawing);
|
||||
user.LoggedinClient.SendPacket(patchDrawing);
|
||||
}
|
||||
}
|
||||
|
@ -7876,7 +7873,7 @@ namespace HISP.Server
|
|||
string weather = forClient.LoggedinUser.GetWeatherSeen();
|
||||
if (lastWeather != weather)
|
||||
{
|
||||
byte[] WeatherUpdate = PacketBuilder.CreateWeatherUpdatePacket(weather);
|
||||
byte[] WeatherUpdate = PacketBuilder.CreateWeatherUpdate(weather);
|
||||
forClient.SendPacket(WeatherUpdate);
|
||||
}
|
||||
}
|
||||
|
@ -8159,7 +8156,7 @@ namespace HISP.Server
|
|||
|
||||
UpdateUserFacingAndLocation(sender.LoggedinUser);
|
||||
|
||||
byte[] updatePlayer = PacketBuilder.CreateMovementPacket(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Facing, PacketBuilder.DIRECTION_NONE, true);
|
||||
byte[] updatePlayer = PacketBuilder.CreateMovement(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Facing, PacketBuilder.DIRECTION_NONE, true);
|
||||
sender.SendPacket(updatePlayer);
|
||||
|
||||
if (sender.LoggedinUser.HorseWindowOpen)
|
||||
|
@ -8188,7 +8185,7 @@ namespace HISP.Server
|
|||
sender.LoggedinUser.Facing %= 5;
|
||||
UpdateUserFacingAndLocation(sender.LoggedinUser);
|
||||
|
||||
byte[] updatePlayer = PacketBuilder.CreateMovementPacket(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Facing, PacketBuilder.DIRECTION_NONE, true);
|
||||
byte[] updatePlayer = PacketBuilder.CreateMovement(sender.LoggedinUser.X, sender.LoggedinUser.Y, sender.LoggedinUser.CharacterId, sender.LoggedinUser.Facing, PacketBuilder.DIRECTION_NONE, true);
|
||||
sender.SendPacket(updatePlayer);
|
||||
|
||||
if (sender.LoggedinUser.HorseWindowOpen)
|
||||
|
@ -8222,7 +8219,7 @@ namespace HISP.Server
|
|||
int overlay = Map.GetTileId(tile.X, tile.Y, true);
|
||||
if (tileset == 6 && overlay == 249) // warp point
|
||||
{
|
||||
byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
|
||||
byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE);
|
||||
forClient.SendPacket(swfPacket);
|
||||
}
|
||||
}
|
||||
|
@ -8271,6 +8268,7 @@ namespace HISP.Server
|
|||
Entry.OnShutdown();
|
||||
}
|
||||
|
||||
|
||||
public static void StartServer()
|
||||
{
|
||||
ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using HISP.Server;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
@ -36,10 +37,17 @@ namespace HISP.Util
|
|||
char firstChar = char.ToUpper(str[0]);
|
||||
return firstChar + str.Substring(1);
|
||||
}
|
||||
public static int GetMonthsBetweenTwoDateTimes(DateTime from, DateTime to)
|
||||
{
|
||||
if (from > to) return GetMonthsBetweenTwoDateTimes(to, from);
|
||||
int monthDiff = Math.Abs((to.Year * 12 + (to.Month)) - (from.Year * 12 + (from.Month)));
|
||||
return monthDiff;
|
||||
|
||||
}
|
||||
public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)
|
||||
{
|
||||
// Unix timestamp is seconds past epoch
|
||||
System.DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
dtDateTime = dtDateTime.AddSeconds(unixTimeStamp).ToUniversalTime();
|
||||
return dtDateTime;
|
||||
}
|
||||
|
@ -47,6 +55,23 @@ namespace HISP.Util
|
|||
public static void ByteArrayToByteList(byte[] byteArray, List<byte> byteList)
|
||||
{
|
||||
byteList.AddRange(byteArray.ToList());
|
||||
}
|
||||
public static string RandomString(string allowedCharacters)
|
||||
{
|
||||
int length = GameServer.RandomNumberGenerator.Next(7, 16);
|
||||
string str = "";
|
||||
for (int i = 0; i < length; i++)
|
||||
str += allowedCharacters[GameServer.RandomNumberGenerator.Next(0, allowedCharacters.Length - 1)];
|
||||
|
||||
return str;
|
||||
}
|
||||
public static string ReverseString(string str)
|
||||
{
|
||||
char[] charArray = str.ToCharArray();
|
||||
Array.Reverse(charArray);
|
||||
string newStr = new string(charArray);
|
||||
|
||||
return newStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.8.23.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.23.0")]
|
||||
[assembly: AssemblyVersion("1.8.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.8.30.0")]
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -127,20 +127,19 @@ namespace MPN00BS
|
|||
|
||||
private void CreateAccount(object sender, RoutedEventArgs e)
|
||||
{
|
||||
int newUserId = Database.GetNextFreeUserId();
|
||||
|
||||
// Generate random salt
|
||||
byte[] salt = new byte[64];
|
||||
new Random(Guid.NewGuid().GetHashCode()).NextBytes(salt);
|
||||
|
||||
// Hash password
|
||||
string saltText = BitConverter.ToString(salt).Replace("-", "");
|
||||
string hashsalt = BitConverter.ToString(Authentication.HashAndSalt(passwordBox.Text, salt)).Replace("-", "");
|
||||
|
||||
|
||||
// GENDer? I hardly knew THEM!
|
||||
string gender = ((ComboBoxItem)genderSelectionBox.SelectedItem).Content.ToString();
|
||||
|
||||
// Permissions
|
||||
bool admin = (bool)adminCheckbox.IsChecked;
|
||||
bool mod = (bool)modCheckbox.IsChecked;
|
||||
|
||||
// Credentials
|
||||
string password = passwordBox.Text;
|
||||
string username = usernameBox.Text;
|
||||
|
||||
Database.CreateUser(newUserId, usernameBox.Text, hashsalt, saltText, gender, (bool)adminCheckbox.IsChecked, (bool)modCheckbox.IsChecked);
|
||||
Authentication.CreateAccount(username, password, gender, admin, mod);
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
|
|
@ -122,11 +122,6 @@ namespace MPN00BS
|
|||
ProgressCallback();
|
||||
|
||||
|
||||
if (Database.GetUsers().Length <= 0)
|
||||
{
|
||||
UserCreationCallback();
|
||||
}
|
||||
|
||||
|
||||
// Start HI1 Server
|
||||
ProgressCallback();
|
||||
|
@ -184,6 +179,11 @@ namespace MPN00BS
|
|||
ProgressCallback();
|
||||
HasServerStarted = true;
|
||||
ServerStartedCallback();
|
||||
|
||||
|
||||
|
||||
if (Database.GetUsers().Length <= 0)
|
||||
UserCreationCallback();
|
||||
}
|
||||
|
||||
public static void ModifyConfig(string okey, string value)
|
||||
|
|
Loading…
Add table
Reference in a new issue