Begin work on Unit Tests

This commit is contained in:
Li 2022-11-14 23:09:22 +13:00
parent cf7605c6c9
commit eaf1db1ee1
51 changed files with 3883 additions and 2101 deletions

7
.gitignore vendored
View file

@ -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/*

View file

@ -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

View file

@ -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>

View file

@ -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);

View file

@ -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")]

View file

@ -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

View 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>

View 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();
}
}
}

View 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")]

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View 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 {
/// &quot;2PlayerClose&quot;: &quot;UFgA&quot;,
/// &quot;BirdMap_OutsideMapTop&quot;: &quot;dgEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ [rest of string was truncated]&quot;;.
/// </summary>
public static string PacketTestDataSet {
get {
return ResourceManager.GetString("PacketTestDataSet", resourceCulture);
}
}
}
}

View 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>

View file

@ -0,0 +1,7 @@
{
"profiles": {
"HISPtests": {
"commandName": "Project"
}
}
}

File diff suppressed because one or more lines are too long

View 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 + " *");
}
}
}
}

View 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;
}
}
}

View 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;
}
}
}

View 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;
}
}
}
}

View 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;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -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);

View file

@ -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);

View file

@ -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)
{

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -173,7 +173,7 @@ namespace HISP.Player
return baseValue;
}
return 7; // will change when ranches are implemented.
return 7;
}
}
@ -185,6 +185,12 @@ namespace HISP.Player
GameServer.UpdatePlayer(LoggedinClient);
}
public void SetMoney(int amount)
{
Database.SetPlayerMoney(amount, Id);
GameServer.UpdatePlayer(LoggedinClient);
}
public void AddMoney(int amount)
{
int money = Money;
@ -197,7 +203,7 @@ namespace HISP.Player
}
catch(OverflowException)
{
money = 2147483647;
money = Int32.MaxValue;
}
Database.SetPlayerMoney(money, Id);
@ -250,6 +256,11 @@ namespace HISP.Player
{
return Helper.UnixTimeStampToDateTime(subscribedUntil);
}
set
{
subscribedUntil = Convert.ToInt32(((DateTimeOffset)value).ToUnixTimeSeconds());
Database.SetUserSubscriptionStatus(Id, subscribedUntil);
}
}
public int FreeMinutes
{
@ -285,6 +296,7 @@ namespace HISP.Player
}
set
{
subscribed = value;
Database.SetUserSubscriptionStatus(this.Id, value);
}
}
@ -526,11 +538,12 @@ namespace HISP.Player
icon = Messages.NewUserIcon;
if (Subscribed)
{
int months = (SubscribedUntil.Month - DateTime.UtcNow.Month) + ((SubscribedUntil.Year - DateTime.UtcNow.Year) * 12);
if (months >= 3)
icon = Messages.ThreeMonthSubscripitionIcon;
else if(months >= (12+3))
int months = Helper.GetMonthsBetweenTwoDateTimes(DateTime.UtcNow, SubscribedUntil);
if(months >= 12 + 3)
icon = Messages.YearSubscriptionIcon;
else if (months >= 3)
icon = Messages.ThreeMonthSubscripitionIcon;
else
icon = Messages.MonthSubscriptionIcon;
}
@ -551,7 +564,7 @@ namespace HISP.Player
X = newX;
Y = newY;
byte[] MovementPacket = PacketBuilder.CreateMovementPacket(X, Y, CharacterId, Facing, PacketBuilder.DIRECTION_TELEPORT, true);
byte[] MovementPacket = PacketBuilder.CreateMovement(X, Y, CharacterId, Facing, PacketBuilder.DIRECTION_TELEPORT, true);
LoggedinClient.SendPacket(MovementPacket);
GameServer.UpdateWeather(LoggedinClient);
@ -597,19 +610,22 @@ namespace HISP.Player
public byte[] GenerateSecCode()
{
var i = 0;
SecCodeCount++;
SecCodeSeeds[SecCodeCount % 3] = (byte)(SecCodeSeeds[SecCodeCount % 3] + SecCodeInc);
SecCodeSeeds[SecCodeCount % 3] = (byte)(SecCodeSeeds[SecCodeCount % 3] % 92);
i = SecCodeSeeds[0] + SecCodeSeeds[1] * SecCodeSeeds[2] - SecCodeSeeds[1];
SecCodeCount = ((SecCodeCount + 1) % 3);
SecCodeSeeds[SecCodeCount] = (byte)(SecCodeSeeds[SecCodeCount] + SecCodeInc);
SecCodeSeeds[SecCodeCount] = (byte)(SecCodeSeeds[SecCodeCount] % '\\');
double i = SecCodeSeeds[0] + SecCodeSeeds[1] * SecCodeSeeds[2] - SecCodeSeeds[1];
i = Math.Abs(i);
i = i % 92;
i %= '\\';
byte[] SecCode = new byte[4];
SecCode[0] = (byte)(SecCodeSeeds[0] + 33);
SecCode[1] = (byte)(SecCodeSeeds[1] + 33);
SecCode[2] = (byte)(SecCodeSeeds[2] + 33);
SecCode[3] = (byte)(i + 33);
SecCode[0] = (byte)(SecCodeSeeds[0] + '!');
SecCode[1] = (byte)(SecCodeSeeds[1] + '!');
SecCode[2] = (byte)(SecCodeSeeds[2] + '!');
SecCode[3] = (byte)(i + '!');
Logger.DebugPrint("Expecting "+Username+" To send Sec Code: "+BitConverter.ToString(SecCode).Replace("-", " "));
return SecCode;
}
@ -644,7 +660,7 @@ namespace HISP.Player
Facing = PacketBuilder.DIRECTION_DOWN;
experience = Database.GetExperience(UserId);
//money = Database.GetPlayerMoney(UserId);
bankMoney = Database.GetPlayerBankMoney(UserId);
questPoints = Database.GetPlayerQuestPoints(UserId);
subscribed = Database.IsUserSubscribed(UserId);
@ -656,9 +672,7 @@ namespace HISP.Player
tired = Database.GetPlayerTiredness(UserId);
if(Ranch.IsRanchOwned(this.Id))
{
OwnedRanch = Ranch.GetRanchOwnedBy(this.Id);
}
Gender = Database.GetGender(UserId);
MailBox = new Mailbox(this);
@ -671,10 +685,10 @@ namespace HISP.Player
// Generate SecCodes
SecCodeSeeds[0] = (byte)GameServer.RandomNumberGenerator.Next(40, 60);
SecCodeSeeds[1] = (byte)GameServer.RandomNumberGenerator.Next(40, 60);
SecCodeSeeds[2] = (byte)GameServer.RandomNumberGenerator.Next(40, 60);
SecCodeInc = (byte)GameServer.RandomNumberGenerator.Next(40, 60);
SecCodeSeeds[0] = (byte)GameServer.RandomNumberGenerator.Next('!', '\\');
SecCodeSeeds[1] = (byte)GameServer.RandomNumberGenerator.Next('!', '\\');
SecCodeSeeds[2] = (byte)GameServer.RandomNumberGenerator.Next('!', '\\');
SecCodeInc = (byte)GameServer.RandomNumberGenerator.Next('!', '\\');
Friends = new Friends(this);

View file

@ -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")]

View file

@ -4,68 +4,96 @@ 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 = "";
string ROTPOOL = "bl7Jgk61IZdnY mfDN5zjM2XLqTCty4WSEoKR3BFVQsaUhHOAx0rPwp9uc8iGve";
string POSPOOL = "DQc3uxiGsKZatMmOS5qYveN71zoPTk8yU0H2w9VjprBXWn l4FJd6IRbhgACfEL";
string ROTPOOL2 = "evGi8cu9pwPr0xAOHhUasQVFB3RKoESW4ytCTqLX2Mjz5NDfm YndZI16kgJ7lb";
int i = 0;
int ii = 0;
int rotationCycle = 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)
int rotation = ROTPOOL.IndexOf(encpass[i].ToString());
int position = POSPOOL.IndexOf(encpass[i + 1].ToString());
position -= (rotation + rotationCycle);
if (position < 0)
{
POS = (POS / -1) - 1;
position = (position / -1) - 1;
while (POS >= ROTPOOL.Length)
{
POS -= ROTPOOL.Length;
}
while (position >= ROTPOOL.Length)
position -= ROTPOOL.Length;
decrypt += ROTPOOL2[POS];
decrypt += Helper.ReverseString(ROTPOOL)[position];
}
else
{
while (POS >= ROTPOOL.Length)
{
POS -= ROTPOOL.Length;
}
while (position >= ROTPOOL.Length)
position -= ROTPOOL.Length;
decrypt += ROTPOOL[POS];
decrypt += ROTPOOL[position];
}
i += 2;
ii += 1;
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);
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);
byte[] hash = Sha512Digest(plaintextBytes);
byte[] saltedHash = XorBytes(hash, salt);
byte[] finalHash = Sha512Digest(saltedHash);
return finalHash;
}
@ -84,5 +112,23 @@ namespace HISP.Security
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;
}
}
}

View file

@ -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())

View file

@ -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);

View file

@ -23,7 +23,7 @@ namespace HISP.Server
public const byte PACKET_WORLD = 0x7A;
public const byte PACKET_BASE_STATS = 0x7B;
public const byte PACKET_RANCH = 0x23;
public const byte PACKET_SWF_CUTSCENE = 0x29;
public const byte PACKET_SWF_MODULE_CUTSCENE = 0x29;
public const byte PACKET_SWF_MODULE_FORCE = 0x28;
public const byte PACKET_SWF_MODULE_GENTLE = 0x2A;
public const byte PACKET_META = 0x1E;
@ -226,7 +226,7 @@ namespace HISP.Server
public const byte DIRECTION_TELEPORT = 4;
public const byte DIRECTION_NONE = 10;
// Helper function for packets that return map data, (eg CreateMovementPacket or CreateBirdMap)
// Helper function for packets that return map data, (eg CreateMovement or CreateBirdMap)
// To encode tile data and add it to a given packet represented as a List<Byte>.
private static void encodeTileDataAndAddToPacket(List<byte> packet, int tileId, int otileId)
{
@ -311,7 +311,7 @@ namespace HISP.Server
// Creates a byte array that contains the contents of a request byte array
// as the response, it basically just forwards it onwards
// this is used for *most* SwfModule
public static byte[] CreateForwardedSwfRequest(byte[] request)
public static byte[] CreateForwardedSwfModule(byte[] request)
{
byte[] packet = new byte[(1 * 2) + request.Length];
packet[0] = PACKET_SWFMODULE;
@ -350,7 +350,7 @@ namespace HISP.Server
return packet.ToArray();
}
// Creates a byte array for a packet to inform the client that the image in a drawing room has changed.
public static byte[] CreateDrawingUpdatePacket(string Drawing)
public static byte[] CreateDrawingUpdate(string Drawing)
{
byte[] drawingBytes = Encoding.UTF8.GetBytes(Drawing);
byte[] packet = new byte[(1 * 2) + drawingBytes.Length];
@ -362,7 +362,7 @@ namespace HISP.Server
return packet;
}
// Creates a byte array for a packet to inform the client that a poetry peice in a brick poet room has moved.
public static byte[] CreateBrickPoetMovePacket(Brickpoet.PoetryPeice peice)
public static byte[] CreateBrickPoetMove(Brickpoet.PoetryPeice peice)
{
string peiceUpdateStr = "|";
peiceUpdateStr += peice.Id + "|";
@ -383,7 +383,7 @@ namespace HISP.Server
return packet;
}
// Creates a byte array for a packet to inform the client of all all Poetry Peices in a Brick Poet room
public static byte[] CreateBrickPoetListPacket(Brickpoet.PoetryPeice[] room)
public static byte[] CreateBrickPoetList(Brickpoet.PoetryPeice[] room)
{
string peicesStr = "";
foreach(Brickpoet.PoetryPeice peice in room)
@ -412,7 +412,7 @@ namespace HISP.Server
return packet;
}
// Creates a byte array of a packet requesting the client to play a sound effect.
public static byte[] CreatePlaysoundPacket(string sound)
public static byte[] CreatePlaySound(string sound)
{
byte[] soundBytes = Encoding.UTF8.GetBytes(sound);
byte[] packet = new byte[(1 * 2) + soundBytes.Length];
@ -427,7 +427,7 @@ namespace HISP.Server
}
// Creates a byte array of a packet informing the client that a given user has left the game
// So they can be removed from the chat list
public static byte[] CreatePlayerLeavePacket(string username)
public static byte[] CreatePlayerLeave(string username)
{
byte[] userBytes = Encoding.UTF8.GetBytes(username);
byte[] packet = new byte[(1 * 3) + userBytes.Length];
@ -470,7 +470,7 @@ namespace HISP.Server
}
// Creates a byte array of a packet to inform the client
// if a given Login Attempt was successful or not
public static byte[] CreateLoginPacket(bool Success, string ErrorMessage="")
public static byte[] CreateLogin(bool Success, string ErrorMessage="")
{
byte[] loginFailMessage = Encoding.UTF8.GetBytes(ErrorMessage);
byte[] packet = new byte[(1 * 3) + loginFailMessage.Length];
@ -505,7 +505,7 @@ namespace HISP.Server
}
// Creates a byte array of a packet to inform the client of the players
// new X/Y position, there character id, facing direction, and Tile Data for their position in the map.
public static byte[] CreateMovementPacket(int x, int y, int charId, int facing, int direction, bool walk)
public static byte[] CreateMovement(int x, int y, int charId, int facing, int direction, bool walk)
{
/* Packet HEADER */
@ -682,7 +682,7 @@ namespace HISP.Server
}
// Creates a byte array of a packet informing the client to change the current Weather Effect.
public static byte[] CreateWeatherUpdatePacket(string newWeather)
public static byte[] CreateWeatherUpdate(string newWeather)
{
byte[] weatherBytes = Encoding.UTF8.GetBytes(newWeather);
byte[] packet = new byte[(1 * 3) + weatherBytes.Length];
@ -861,10 +861,10 @@ namespace HISP.Server
packet[0] = PACKET_SEC_CODE;
packet[1] = (byte)(SecCodeSeed[0] + 33);
packet[2] = (byte)(SecCodeSeed[1] + 33);
packet[3] = (byte)(SecCodeSeed[2] + 33);
packet[4] = (byte)(SecCodeInc + 33);
packet[1] = (byte)(SecCodeSeed[0] + '!');
packet[2] = (byte)(SecCodeSeed[1] + '!');
packet[3] = (byte)(SecCodeSeed[2] + '!');
packet[4] = (byte)(SecCodeInc + '!');
packet[5] = (byte)userType;
@ -890,7 +890,7 @@ namespace HISP.Server
// This has the exact same effect as CreateChat with CHAT_BOTTOM_RIGHT but for some reason
// the header byte is different,
// This is basically only used for MOTD.
public static byte[] CreateAnnouncement(string announcement)
public static byte[] CreateMotd(string announcement)
{
byte[] annouceBytes = Encoding.UTF8.GetBytes(announcement);
byte[] packet = new byte[(1 * 2) + annouceBytes.Length];

View file

@ -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;
}
@ -48,5 +56,22 @@ namespace HISP.Util
{
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;
}
}
}

View file

@ -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")]

View file

@ -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();
Database.CreateUser(newUserId, usernameBox.Text, hashsalt, saltText, gender, (bool)adminCheckbox.IsChecked, (bool)modCheckbox.IsChecked);
// Permissions
bool admin = (bool)adminCheckbox.IsChecked;
bool mod = (bool)modCheckbox.IsChecked;
// Credentials
string password = passwordBox.Text;
string username = usernameBox.Text;
Authentication.CreateAccount(username, password, gender, admin, mod);
this.Close();
}

View file

@ -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)