Compare commits

..

No commits in common. "master" and "v1.8" have entirely different histories.
master ... v1.8

211 changed files with 8207 additions and 12944 deletions

View file

@ -21,8 +21,8 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: 8.0.x dotnet-version: 7.0.100-preview.5.22307.18
include-prerelease: false include-prerelease: true
- name: Install utils - name: Install utils
run: | run: |
sudo apt update sudo apt update
@ -33,7 +33,7 @@ jobs:
run: | run: |
dotnet restore LibHISP dotnet restore LibHISP
dotnet restore HISPd dotnet restore HISPd
# linux x64 # nativeaot linux x54
- name: Build linux-x64 - name: Build linux-x64
continue-on-error: false continue-on-error: false
run: | run: |
@ -44,14 +44,27 @@ jobs:
dotnet publish -p:PublishProfile=Linux64.pubxml dotnet publish -p:PublishProfile=Linux64.pubxml
cd .. cd ..
# linux arm # Currently broken ...
# dotnet add HISPd package Microsoft.DotNet.ILCompiler --prerelease
# cd HISPd
# dotnet publish -r linux-x64 -c Linux /p:Platform=x64 --self-contained
# cd ..
# mkdir -p HISPd/bin/x64/Linux/net7.0/linux-x64/native/gamedata
# cp -r HISPd/bin/x64/Linux/net7.0/linux-x64/gamedata/* HISPd/bin/x64/Linux/net7.0/linux-x64/native/gamedata
# cp HISPd/bin/x64/Linux/net7.0/linux-x64/HI1.MAP HISPd/bin/x64/Linux/net7.0/linux-x64/native/HI1.MAP
# cp HISPd/bin/x64/Linux/net7.0/linux-x64/publish/libe_sqlite3.so HISPd/bin/x64/Linux/net7.0/linux-x64/native/libe_sqlite3.so
# rm -f HISPd/bin/x64/Linux/net7.0/linux-x64/native/HISPd.dbg
# dotnet remove HISPd package Microsoft.DotNet.ILCompiler
- name: Build linux-arm - name: Build linux-arm
continue-on-error: false continue-on-error: false
run: | run: |
cd HISPd cd HISPd
dotnet publish -p:PublishProfile=LinuxARM.pubxml dotnet publish -p:PublishProfile=LinuxARM.pubxml
cd .. cd ..
# linux arm64 # nativeaot linux arm64
- name: Build linux-arm64 - name: Build linux-arm64
continue-on-error: false continue-on-error: false
run: | run: |
@ -59,6 +72,18 @@ jobs:
dotnet publish -p:PublishProfile=LinuxARM64.pubxml dotnet publish -p:PublishProfile=LinuxARM64.pubxml
cd .. cd ..
# dotnet add HISPd package Microsoft.DotNet.ILCompiler --prerelease
# dotnet add HISPd package runtime.linux-x64.Microsoft.DotNet.ILCompiler --prerelease
# cd HISPd
# dotnet publish -r linux-arm64 -c Linux /p:Platform=ARM64 --self-contained
# cd ..
# mkdir -p HISPd/bin/ARM64/Linux/net7.0/linux-arm64/native/gamedata
# cp -r HISPd/bin/ARM64/Linux/net7.0/linux-arm64/gamedata/* HISPd/bin/ARM64/Linux/net7.0/linux-arm64/native/gamedata
# cp HISPd/bin/ARM64/Linux/net7.0/linux-arm64/HI1.MAP HISPd/bin/ARM64/Linux/net7.0/linux-arm64/native/HI1.MAP
# cp HISPd/bin/ARM64/Linux/net7.0/linux-arm64/publish/libe_sqlite3.so HISPd/bin/ARM64/Linux/net7.0/linux-arm64/native/libe_sqlite3.so
# rm -f HISPd/bin/ARM64/Linux/net7.0/linux-arm64/native/HISPd.dbg
# dotnet remove HISPd package Microsoft.DotNet.ILCompiler
# dotnet remove HISPd package runtime.linux-x64.Microsoft.DotNet.ILCompiler
- name: Build deb package - name: Build deb package
continue-on-error: false continue-on-error: false
@ -77,10 +102,10 @@ jobs:
cp LibHISP/Resources/server.properties /tmp/debpkg/Debian64/etc/hisp/server.properties cp LibHISP/Resources/server.properties /tmp/debpkg/Debian64/etc/hisp/server.properties
cp LibHISP/Resources/default_cross_domain.xml /tmp/debpkg/Debian64/etc/hisp/CrossDomainPolicy.xml cp LibHISP/Resources/default_cross_domain.xml /tmp/debpkg/Debian64/etc/hisp/CrossDomainPolicy.xml
cp -r HISPd/Resources/DEBIAN/* /tmp/debpkg/Debian64/DEBIAN cp -r HISPd/Resources/DEBIAN/* /tmp/debpkg/Debian64/DEBIAN
cp -r HISPd/bin/x64/Linux/net8.0/linux-x64/publish/gamedata/* /tmp/debpkg/Debian64/etc/hisp/gamedata cp -r HISPd/bin/x64/Linux/net7.0/linux-x64/publish/gamedata/* /tmp/debpkg/Debian64/etc/hisp/gamedata
cp HISPd/bin/x64/Linux/net8.0/linux-x64/publish/libe_sqlite3.so /tmp/debpkg/Debian64/usr/lib/libe_sqlite3.so cp HISPd/bin/x64/Linux/net7.0/linux-x64/publish/libe_sqlite3.so /tmp/debpkg/Debian64/usr/lib/libe_sqlite3.so
cp HISPd/bin/x64/Linux/net8.0/linux-x64/publish/HI1.MAP /tmp/debpkg/Debian64/etc/hisp/HI1.MAP cp HISPd/bin/x64/Linux/net7.0/linux-x64/publish/HI1.MAP /tmp/debpkg/Debian64/etc/hisp/HI1.MAP
cp HISPd/bin/x64/Linux/net8.0/linux-x64/publish/HISPd /tmp/debpkg/Debian64/usr/bin/HISPd cp HISPd/bin/x64/Linux/net7.0/linux-x64/publish/HISPd /tmp/debpkg/Debian64/usr/bin/HISPd
cp HISPd/Resources/HISP.service /tmp/debpkg/Debian64/etc/systemd/system/HISP.service cp HISPd/Resources/HISP.service /tmp/debpkg/Debian64/etc/systemd/system/HISP.service
cat /tmp/debpkg/Debian64/DEBIAN/control cat /tmp/debpkg/Debian64/DEBIAN/control
dos2unix /tmp/debpkg/Debian64/DEBIAN/conffiles dos2unix /tmp/debpkg/Debian64/DEBIAN/conffiles
@ -95,33 +120,60 @@ jobs:
dpkg-deb --build /tmp/debpkg/Debian64 dpkg-deb --build /tmp/debpkg/Debian64
mv /tmp/debpkg/Debian64.deb debpackage/HISP-Debian-AMD64.deb mv /tmp/debpkg/Debian64.deb debpackage/HISP-Debian-AMD64.deb
#android .. maybe someday
# - name: Build android-arm
# continue-on-error: false
# run: |
# dotnet publish -p:PublishProfile=AndroidARM.pubxml
# - name: Build android-arm64
# continue-on-error: false
# run: |
# dotnet publish -p:PublishProfile=AndroidARM64.pubxml
# - name: Upload android-arm
# uses: actions/upload-artifact@v2
# with:
# name: HISP-AndroidARM
# path: HorseIsleServer/HISPd/bin/arm/Android/net7.0/android-arm/publish/
# - name: Upload android-arm64
# uses: actions/upload-artifact@v2
# with:
# name: HISP-AndroidARM64
# path: HorseIsleServer/HISPd/bin/arm64/Android/net7.0/android-arm64/publish/
# Upload LINUX # Upload LINUX
- name: Upload linux-x64 - name: Upload linux-x64
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Linux64 name: HISP-Linux64
path: HorseIsleServer/HISPd/bin/x64/Linux/net8.0/linux-x64/publish/ path: HorseIsleServer/HISPd/bin/x64/Linux/net7.0/linux-x64/publish/
- name: Upload linux-x64-noobs - name: Upload linux-x64-noobs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Linux64-Noobs name: HISP-Linux64-Noobs
path: HorseIsleServer/MPN00BS/bin/x64/Linux/net8.0/linux-x64/publish/ path: HorseIsleServer/MPN00BS/bin/x64/Linux/net7.0/linux-x64/publish/
- name: Upload linux-arm - name: Upload linux-arm
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-LinuxARM name: HISP-LinuxARM
path: HorseIsleServer/HISPd/bin/ARM/Linux/net8.0/linux-arm/publish/ path: HorseIsleServer/HISPd/bin/ARM/Linux/net7.0/linux-arm/publish/
- name: Upload linux-arm64 - name: Upload linux-arm64
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-LinuxARM64 name: HISP-LinuxARM64
path: HorseIsleServer/HISPd/bin/ARM64/Linux/net8.0/linux-arm64/publish/ path: HorseIsleServer/HISPd/bin/ARM64/Linux/net7.0/linux-arm64/publish/
- name: Upload deb package - name: Upload deb package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-DebianPackage name: HISP-DebianPackage
path: HorseIsleServer/debpackage path: HorseIsleServer/debpackage
@ -139,8 +191,8 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: 8.0.x dotnet-version: 7.0.100-preview.5.22307.18
include-prerelease: false include-prerelease: true
- name: Install utils - name: Install utils
run: dotnet tool install -g dotnet-script run: dotnet tool install -g dotnet-script
@ -148,7 +200,7 @@ jobs:
- name: Restore dependencies - name: Restore dependencies
run: dotnet restore run: dotnet restore
# x64 build #nativeaot x64 build
- name: Build win-x64 - name: Build win-x64
continue-on-error: false continue-on-error: false
run: | run: |
@ -159,6 +211,21 @@ jobs:
dotnet publish -p:PublishProfile=Win64.pubxml dotnet publish -p:PublishProfile=Win64.pubxml
cd .. cd ..
# dotnet add HISPd package Microsoft.DotNet.ILCompiler --prerelease
# cd HISPd
# dotnet publish -r win-x64 -c Windows /p:Platform=x64 --self-contained
# cd ..
# mkdir "HISPd\bin\x64\Windows\net7.0\win-x64\native\gamedata"
# copy "..\HorseIsleData\gamedata\*" "HISPd\bin\x64\Windows\net7.0\win-x64\native\gamedata"
# copy "..\HorseIsleData\HI1.MAP" "HISPd\bin\x64\Windows\net7.0\win-x64\native\HI1.MAP"
# copy "HISPd\bin\x64\Windows\net7.0\win-x64\publish\e_sqlite3.dll" "HISPd\bin\x64\Windows\net7.0\win-x64\native\e_sqlite3.dll"
# del "HISPd\bin\x64\Windows\net7.0\win-x64\native\HISPd.pdb"
# del "HISPd\bin\x64\Windows\net7.0\win-x64\native\HISPd.lib"
# del "HISPd\bin\x64\Windows\net7.0\win-x64\native\HISPd.exp"
# dotnet remove HISPd package Microsoft.DotNet.ILCompiler
# cd N00BS
# dotnet publish -p:PublishProfile=Win64.pubxml
# cd ..
- name: Build win-x86 - name: Build win-x86
continue-on-error: false continue-on-error: false
run: | run: |
@ -168,46 +235,72 @@ jobs:
cd MPN00BS cd MPN00BS
dotnet publish -p:PublishProfile=Win32.pubxml dotnet publish -p:PublishProfile=Win32.pubxml
cd .. cd ..
- name: Build win-arm
# arm64 build continue-on-error: false
run: |
cd HISPd
dotnet publish -p:PublishProfile=WinARM.pubxml
cd ..
#nativeaot arm64 build
- name: Build win-arm64 - name: Build win-arm64
continue-on-error: false continue-on-error: false
run: | run: |
cd HISPd cd HISPd
dotnet publish -p:PublishProfile=WinARM64.pubxml dotnet publish -p:PublishProfile=WinARM64.pubxml
cd .. cd ..
# dotnet add HISPd package Microsoft.DotNet.ILCompiler --prerelease
# dotnet add HISPd package runtime.win-x64.Microsoft.DotNet.ILCompiler --prerelease
# cd HISPd
# dotnet publish -r win-arm64 -c Windows /p:Platform=ARM64 --self-contained
# cd ..
# mkdir "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\gamedata"
# copy "..\HorseIsleData\gamedata\*" "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\gamedata"
# copy "..\HorseIsleData\HI1.MAP" "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\HI1.MAP"
# copy "HISPd\bin\ARM64\Windows\net7.0\win-arm64\publish\e_sqlite3.dll" "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\e_sqlite3.dll"
# del "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\HISPd.pdb"
# del "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\HISPd.lib"
# del "HISPd\bin\ARM64\Windows\net7.0\win-arm64\native\HISPd.exp"
# dotnet remove HISPd package Microsoft.DotNet.ILCompiler
# dotnet remove HISPd package runtime.win-x64.Microsoft.DotNet.ILCompiler
# Upload WINDOWS # Upload WINDOWS
- name: Upload win-x64 - name: Upload win-x64
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Win64 name: HISP-Win64
path: HorseIsleServer/HISPd/bin/x64/Windows/net8.0/win-x64/publish/ path: HorseIsleServer/HISPd/bin/x64/Windows/net7.0/win-x64/publish/
- name: Upload win-x86 - name: Upload win-x86
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Win32 name: HISP-Win32
path: HorseIsleServer/HISPd/bin/x86/Windows/net8.0/win-x86/publish/ path: HorseIsleServer/HISPd/bin/x86/Windows/net7.0/win-x86/publish/
- name: Upload win-arm
uses: actions/upload-artifact@v2
with:
name: HISP-WinARM
path: HorseIsleServer/HISPd/bin/arm/Windows/net7.0/win-arm/publish/
- name: Upload win-arm64 - name: Upload win-arm64
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-WinARM64 name: HISP-WinARM64
path: HorseIsleServer/HISPd/bin/arm64/Windows/net8.0/win-arm64/publish/ path: HorseIsleServer/HISPd/bin/arm64/Windows/net7.0/win-arm64/publish/
- name: Upload win-x86-noobs - name: Upload win-x86-noobs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Win32-Noobs name: HISP-Win32-Noobs
path: HorseIsleServer/MPN00BS/bin/x86/Windows/net8.0/win-x86/publish/ path: HorseIsleServer/MPN00BS/bin/x86/Windows/net7.0/win-x86/publish/
- name: Upload win-x64-noobs - name: Upload win-x64-noobs
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Win64-Noobs name: HISP-Win64-Noobs
path: HorseIsleServer/MPN00BS/bin/x64/Windows/net8.0/win-x64/publish/ path: HorseIsleServer/MPN00BS/bin/x64/Windows/net7.0/win-x64/publish/
build-mac: build-mac:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -222,8 +315,8 @@ jobs:
- name: Setup .NET - name: Setup .NET
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: 8.0.x dotnet-version: 7.0.100-preview.5.22307.18
include-prerelease: false include-prerelease: true
- name: Install utils - name: Install utils
run: dotnet tool install -g dotnet-script run: dotnet tool install -g dotnet-script
@ -239,9 +332,6 @@ jobs:
cd HISPd cd HISPd
dotnet publish -p:PublishProfile=Osx64.pubxml dotnet publish -p:PublishProfile=Osx64.pubxml
cd .. cd ..
cd MPN00BS
dotnet publish -p:PublishProfile=Osx64.pubxml
cd ..
- name: Build mac-arm64 - name: Build mac-arm64
continue-on-error: false continue-on-error: false
run: | run: |
@ -249,23 +339,17 @@ jobs:
dotnet publish -p:PublishProfile=OsxARM64.pubxml dotnet publish -p:PublishProfile=OsxARM64.pubxml
cd .. cd ..
- name: Upload mac-x64 - name: Upload mac-x64
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Mac64 name: HISP-Mac64
path: HorseIsleServer/HISPd/bin/x64/MacOS/net8.0/osx-x64/publish/ path: HorseIsleServer/HISPd/bin/x64/MacOS/net7.0/osx-x64/publish/
- name: Upload mac-arm64 - name: Upload mac-arm64
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-MacARM64 name: HISP-MacARM64
path: HorseIsleServer/HISPd/bin/arm64/MacOS/net8.0/osx-arm64/publish/ path: HorseIsleServer/HISPd/bin/arm64/MacOS/net7.0/osx-arm64/publish/
- name: Upload mac-x64-noobs
uses: actions/upload-artifact@v4
with:
name: HISP-Mac-Noobs
path: HorseIsleServer/MPN00BS/bin/x64/MacOS/net8.0/osx-x64/publish/
build-web: build-web:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -279,13 +363,13 @@ jobs:
# UPLOAD WEB # UPLOAD WEB
- name: Upload Website (master) - name: Upload Website (master)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Web-Master name: HISP-Web-Master
path: HorseIsleWeb/master-site path: HorseIsleWeb/master-site
- name: Upload Website (game) - name: Upload Website (game)
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v2
with: with:
name: HISP-Web-Game name: HISP-Web-Game
path: HorseIsleWeb/game-site path: HorseIsleWeb/game-site

13
.gitignore vendored
View file

@ -4,12 +4,6 @@
*.log *.log
*.suo *.suo
*.csproj.user *.csproj.user
*.pubxml.user
*.user
*.idb
*Thumbs.db
*.DS_Store
HorseIsleServer/N00BS/obj/* HorseIsleServer/N00BS/obj/*
HorseIsleServer/N00BS/bin/* HorseIsleServer/N00BS/bin/*
@ -20,15 +14,10 @@ HorseIsleServer/MPN00BS/bin/*
HorseIsleServer/HISPd/obj/* HorseIsleServer/HISPd/obj/*
HorseIsleServer/HISPd/bin/* HorseIsleServer/HISPd/bin/*
HorseIsleServer/HISPtests/obj/* HorseIsleServer/Installer/Windows/*
HorseIsleServer/HISPtests/bin/*
HorseIsleServer/LibHISP/obj/* HorseIsleServer/LibHISP/obj/*
HorseIsleServer/LibHISP/bin/* HorseIsleServer/LibHISP/bin/*
HorseIsleServer/LibHISP/Resources/Versioning/* HorseIsleServer/LibHISP/Resources/Versioning/*
HorseIsleServer/Installer/Windows/*
HorseIsleServer/.vs/* HorseIsleServer/.vs/*

@ -1 +1 @@
Subproject commit e9c09c77cd0dd99eb12e16b679478fb0e3742b55 Subproject commit 0afb5924fd3d0b83e6a1369789b1b98255374183

View file

@ -8,8 +8,9 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HISPd", "HISPd\HISPd.csproj", "{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HISPd", "HISPd\HISPd.csproj", "{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MPN00BS", "MPN00BS\MPN00BS.csproj", "{72EF95FC-03DB-4E61-A696-E0095DD42A4E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MPN00BS", "MPN00BS\MPN00BS.csproj", "{72EF95FC-03DB-4E61-A696-E0095DD42A4E}"
EndProject ProjectSection(ProjectDependencies) = postProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HISPtests", "HISPtests\HISPtests.csproj", "{689FB972-1612-440E-817D-BE290F655AA8}" {C48CBD82-AB30-494A-8FFA-4DE7069B5827} = {C48CBD82-AB30-494A-8FFA-4DE7069B5827}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -38,11 +39,6 @@ Global
MacOS|ARM64 = MacOS|ARM64 MacOS|ARM64 = MacOS|ARM64
MacOS|x64 = MacOS|x64 MacOS|x64 = MacOS|x64
MacOS|x86 = MacOS|x86 MacOS|x86 = MacOS|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
Windows|Any CPU = Windows|Any CPU Windows|Any CPU = Windows|Any CPU
Windows|ARM = Windows|ARM Windows|ARM = Windows|ARM
Windows|ARM64 = Windows|ARM64 Windows|ARM64 = Windows|ARM64
@ -99,16 +95,6 @@ Global
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x64.Build.0 = MacOS|x64 {C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x64.Build.0 = MacOS|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.ActiveCfg = MacOS|x86 {C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.ActiveCfg = MacOS|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.Build.0 = MacOS|x86 {C48CBD82-AB30-494A-8FFA-4DE7069B5827}.MacOS|x86.Build.0 = MacOS|x86
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|Any CPU.ActiveCfg = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|Any CPU.Build.0 = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM.ActiveCfg = Windows|ARM
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM.Build.0 = Windows|ARM
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM64.ActiveCfg = Windows|ARM64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|ARM64.Build.0 = Windows|ARM64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x64.ActiveCfg = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x64.Build.0 = Windows|x64
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Release|x86.ActiveCfg = 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.ActiveCfg = Windows|Any CPU
{C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|Any CPU.Build.0 = 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 {C48CBD82-AB30-494A-8FFA-4DE7069B5827}.Windows|ARM.ActiveCfg = Windows|ARM
@ -168,16 +154,6 @@ Global
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x64.Build.0 = MacOS|x64 {DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x64.Build.0 = MacOS|x64
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.ActiveCfg = MacOS|x86 {DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.ActiveCfg = MacOS|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.Build.0 = MacOS|x86 {DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.MacOS|x86.Build.0 = MacOS|x86
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Release|Any CPU.ActiveCfg = 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.ActiveCfg = Windows|Any CPU
{DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|Any CPU.Build.0 = 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 {DEAD5CB0-C6B6-4B63-B1FB-A9F649CA1D27}.Windows|ARM.ActiveCfg = Windows|ARM
@ -238,16 +214,6 @@ Global
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.MacOS|x64.Build.0 = MacOS|x64 {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.ActiveCfg = MacOS|x86
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.MacOS|x86.Build.0 = 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.ActiveCfg = Windows|Any CPU
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|Any CPU.Build.0 = 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 {72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|ARM.ActiveCfg = Windows|ARM
@ -258,76 +224,6 @@ Global
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|x64.Build.0 = Windows|x64 {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.ActiveCfg = Windows|x86
{72EF95FC-03DB-4E61-A696-E0095DD42A4E}.Windows|x86.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -27,7 +27,7 @@
<GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType> <GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWin32Manifest>true</NoWin32Manifest> <NoWin32Manifest>true</NoWin32Manifest>
<ApplicationIcon>icon.ico</ApplicationIcon> <ApplicationIcon>icon.ico</ApplicationIcon>
@ -44,13 +44,7 @@
<WarningLevel>3</WarningLevel> <WarningLevel>3</WarningLevel>
<NoWarn>1701;1702;2026;IL2026</NoWarn> <NoWarn>1701;1702;2026;IL2026</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<TrimMode>partial</TrimMode>
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x86'">
<RuntimeIdentifier>win-x86</RuntimeIdentifier> <RuntimeIdentifier>win-x86</RuntimeIdentifier>
<Optimize>true</Optimize> <Optimize>true</Optimize>
@ -158,12 +152,112 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<PlatformTarget>ARM</PlatformTarget>
<Optimize>False</Optimize> <Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE;OS_DEBUG</DefineConstants> <DefineConstants>DEBUG;TRACE;OS_DEBUG;ARCH_ARM</DefineConstants>
<DebugType>full</DebugType> <DebugType>none</DebugType>
</PropertyGroup> </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> </Project>

View file

@ -11,7 +11,7 @@ namespace HISP.Cli
private static StreamWriter sw = null; private static StreamWriter sw = null;
private static FileStream fs = null; private static FileStream fs = null;
private static string logFile; private static string logFile;
private static EventWaitHandle shutdownHandle = null; private static EventWaitHandle shutdownHandle;
public static bool ShuttingDown = false; public static bool ShuttingDown = false;
public static string BaseDir; public static string BaseDir;
@ -44,95 +44,46 @@ namespace HISP.Cli
public static void OnShutdown() public static void OnShutdown()
{ {
try shutdownHandle.Set();
{
if (sw != null)
{
sw.Flush();
sw.Close();
sw.Dispose();
sw = null;
}
}
catch (Exception) { };
try
{
if (fs != null)
{
fs.Flush();
fs.Close();
fs.Dispose();
fs = null;
}
}
catch (Exception) { };
if(shutdownHandle != null)
shutdownHandle.Set();
} }
private static string formatMessage(string type, string text, bool console)
{
#if OS_WINDOWS
string newline = "\r\n";
#else
string newline = "\n";
#endif
string msg = DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss") + ": [" + type + "] ";
if (console && text.Length > (Console.WindowWidth - msg.Length) - newline.Length)
text = text.Substring(0, (Console.WindowWidth - msg.Length) - newline.Length);
return msg + text + newline;
}
public static void LogToFile(bool error, string type,string text) public static void LogToFile(bool error, string type,string text)
{ {
sw.WriteLine(formatMessage(type, text, false)); sw.WriteLineAsync(DateTime.Now.ToString("MM-dd-YYYY HH:mm:dd") + ": [" + type + "] " + text + sw.NewLine);
if (error)
sw.Flush();
} }
public static void LogStdout(bool error, string type, string text) public static void LogStdout(bool error, string type, string text)
{ {
if (type == "CRASH") if (type == "CRASH")
LogToFile(error, type, text); LogToFile(error, type, text);
try
{ if (error)
if (error) Console.Error.WriteAsync(DateTime.Now.ToString("MM-dd-YYYY HH:mm:dd")+": [" + type + "] " + text + Console.Error.NewLine);
Console.Error.WriteAsync(formatMessage(type, text, true)); else
else Console.Out.WriteAsync(DateTime.Now.ToString("MM-dd-YYYY HH:mm:dd") + ": [" + type + "] " + text + Console.Out.NewLine);
Console.Out.WriteAsync(formatMessage(type, text, true));
}
catch (Exception) { };
} }
public static void Main(string[] args) public static void Main(string[] args)
{ {
AppDomain.CurrentDomain.ProcessExit += ProcessQuitHandler; AppDomain.CurrentDomain.ProcessExit += ProcessQuitHandler;
string baseDir = Directory.GetCurrentDirectory(); string BaseDir = Directory.GetCurrentDirectory();
Logger.SetCallback(LogStdout); Logger.SetCallback(LogStdout);
Entry.SetShutdownCallback(OnShutdown);
string hispConfVar = Environment.GetEnvironmentVariable("HISP_CONF_FILE"); string HispConfVar = Environment.GetEnvironmentVariable("HISP_CONF_FILE");
string hispLogVar = Environment.GetEnvironmentVariable("HISP_LOG_FILE"); string HispLogVar = Environment.GetEnvironmentVariable("HISP_LOG_FILE");
string hispBaseDir = Environment.GetEnvironmentVariable("HISP_BASE_DIR"); string HispBaseDir = Environment.GetEnvironmentVariable("HISP_BASE_DIR");
foreach (string arg in args) foreach (string arg in args)
{ {
switch (arg) switch (arg)
{ {
case "--install-service": case "--install-service":
#if OS_LINUX #if OS_LINUX
File.WriteAllBytes("/etc/systemd/system/HISP.service", Resources.HISPService); File.WriteAllBytes("/etc/systemd/system/HISP.service", Resources.HISPService);
LogStdout(false, "INFO", "Crreated Service! enable it with \"sudo systemctl enable HISP\""); LogStdout(false, "INFO", "Crreated Service! enable it with \"sudo systemctl enable HISP\"");
#else #else
LogStdout(true, "ERROR", "Installing as a service unsupported on this platform"); LogStdout(true, "ERROR", "Installing as a service unsupported on this platform");
#endif #endif
break; break;
default: default:
if (arg.Contains("=")) if (arg.Contains("="))
@ -150,8 +101,8 @@ namespace HISP.Cli
Logger.SetCallback(LogToFile); Logger.SetCallback(LogToFile);
break; break;
case "--base-directory": case "--base-directory":
baseDir = argu[1]; BaseDir = argu[1];
Directory.SetCurrentDirectory(baseDir); Directory.SetCurrentDirectory(BaseDir);
break; break;
default: default:
continue; continue;
@ -162,27 +113,28 @@ namespace HISP.Cli
} }
} }
if (hispConfVar != null) if (HispConfVar != null)
{ {
ConfigReader.ConfigurationFileName = hispConfVar; ConfigReader.ConfigurationFileName = HispConfVar;
} }
if (hispLogVar != null) if (HispLogVar != null)
{ {
LogFile = hispLogVar; LogFile = HispLogVar;
Logger.SetCallback(LogToFile); Logger.SetCallback(LogToFile);
} }
else else
{ {
LogFile = Path.Combine(baseDir, "crash.log"); LogFile = Path.Combine(BaseDir, "crash.log");
} }
if (hispBaseDir != null) if (HispBaseDir != null)
{ {
baseDir = hispBaseDir; BaseDir = HispBaseDir;
Directory.SetCurrentDirectory(baseDir); Directory.SetCurrentDirectory(BaseDir);
} }
Entry.SetShutdownCallback(OnShutdown);
Entry.Start(); Entry.Start();
shutdownHandle = new EventWaitHandle(false, EventResetMode.ManualReset); shutdownHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
@ -191,7 +143,7 @@ namespace HISP.Cli
private static void ProcessQuitHandler(object sender, EventArgs e) private static void ProcessQuitHandler(object sender, EventArgs e)
{ {
GameServer.ShutdownServer("HISPd process quitting."); GameServer.ShutdownServer();
} }
} }
} }

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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.73.0")] [assembly: AssemblyVersion("1.7.140.0")]
[assembly: AssemblyFileVersion("1.8.73.0")] [assembly: AssemblyFileVersion("1.7.140.0")]

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Android</Configuration> <Configuration>Android</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\arm\Android\net8.0\android-arm\publish\</PublishDir> <PublishDir>bin\arm\Android\net7.0\android-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>android-arm</RuntimeIdentifier> <RuntimeIdentifier>android-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<UseAppHost>True</UseAppHost> <UseAppHost>True</UseAppHost>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Android</Configuration> <Configuration>Android</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\Android\net8.0\android-arm64\publish\</PublishDir> <PublishDir>bin\arm64\Android\net7.0\android-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>android-arm64</RuntimeIdentifier> <RuntimeIdentifier>android-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<UseAppHost>True</UseAppHost> <UseAppHost>True</UseAppHost>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Linux</Configuration> <Configuration>Linux</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>bin\x64\Linux\net8.0\linux-x64\publish\</PublishDir> <PublishDir>bin\x64\Linux\net7.0\linux-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Linux</Configuration> <Configuration>Linux</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\ARM\Linux\net8.0\linux-arm\publish\</PublishDir> <PublishDir>bin\ARM\Linux\net7.0\linux-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier> <RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Linux</Configuration> <Configuration>Linux</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\ARM64\Linux\net8.0\linux-arm64\publish\</PublishDir> <PublishDir>bin\ARM64\Linux\net7.0\linux-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier> <RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>MacOS</Configuration> <Configuration>MacOS</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>bin\x64\MacOS\net8.0\osx-x64\publish\</PublishDir> <PublishDir>bin\x64\MacOS\net7.0\osx-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier> <RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>MacOS</Configuration> <Configuration>MacOS</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\MacOS\net8.0\osx-arm64\publish\</PublishDir> <PublishDir>bin\arm64\MacOS\net7.0\osx-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier> <RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>x86</Platform> <Platform>x86</Platform>
<PublishDir>bin\x86\Windows\net8.0\win-x86\publish\</PublishDir> <PublishDir>bin\x86\Windows\net7.0\win-x86\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-x86</RuntimeIdentifier> <RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,14 +6,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>bin\x64\Windows\net8.0\win-x64\publish\</PublishDir> <PublishDir>bin\x64\Windows\net7.0\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishTrimmed>True</PublishTrimmed>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>
<PublishReadyToRun>True</PublishReadyToRun> <PublishReadyToRun>True</PublishReadyToRun>
<PublishTrimmed>True</PublishTrimmed>
<DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants> <DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\arm\Windows\net8.0\win-arm\publish\</PublishDir> <PublishDir>bin\arm\Windows\net7.0\win-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-arm</RuntimeIdentifier> <RuntimeIdentifier>win-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\Windows\net8.0\win-arm64\publish\</PublishDir> <PublishDir>bin\arm64\Windows\net7.0\win-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier> <RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>True</PublishSingleFile> <PublishSingleFile>True</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>iOS</Configuration> <Configuration>iOS</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\arm\iOS\net8.0\ios-arm\publish\</PublishDir> <PublishDir>bin\arm\iOS\net7.0\ios-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>ios-arm</RuntimeIdentifier> <RuntimeIdentifier>ios-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>False</PublishSingleFile> <PublishSingleFile>False</PublishSingleFile>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>iOS</Configuration> <Configuration>iOS</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\iOS\net8.0\ios-arm64\publish\</PublishDir> <PublishDir>bin\arm64\iOS\net7.0\ios-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier> <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<PublishSingleFile>False</PublishSingleFile> <PublishSingleFile>False</PublishSingleFile>

View file

@ -1,5 +1,5 @@
Package: hisp Package: hisp
Version: 1.8.73 Version: 1.7.140
Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev Depends: coreutils,systemd,mariadb-server,libsqlite3-dev,zlib1g-dev,libicu-dev,libkrb5-dev
Maintainer: Li Maintainer: Li
Homepage: https://islehorse.com Homepage: https://islehorse.com

View file

@ -16,8 +16,8 @@ Type=simple
ProtectSystem=full ProtectSystem=full
PrivateDevices=true PrivateDevices=true
StandardError=journal+console StandardError=syslog+console
StandardOutput=journal+console StandardOutput=syslog+console
User=horseisle User=horseisle
Group=horseisle Group=horseisle

View file

@ -1,169 +0,0 @@
<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>net8.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

@ -1,20 +0,0 @@
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

@ -1,35 +0,0 @@
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

@ -1,20 +0,0 @@
<?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\net8.0\android-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,20 +0,0 @@
<?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\net8.0\android-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\linux-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\linux-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\linux-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\osx-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\osx-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\win-x86\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\win-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\win-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\ios-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,19 +0,0 @@
<?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\net8.0\ios-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.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

@ -1,74 +0,0 @@
//------------------------------------------------------------------------------
// <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

@ -1,124 +0,0 @@
<?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

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

File diff suppressed because one or more lines are too long

View file

@ -1,51 +0,0 @@
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

@ -1,59 +0,0 @@
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

@ -1,416 +0,0 @@
//#define GENERATE
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 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));
return true;
#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("-", ""));
return false;
}
else
{
ResultLogger.LogTestStatus(true, "PACKET_TEST " + name, "Success.");
return true;
}
#endif
}
public static bool RunPacketTest()
{
#if !GENERATE
JObject jobj = JsonConvert.DeserializeObject(Resources.PacketTestDataSet) as JObject;
knownGoodPackets = jobj.ToObject<Dictionary<string, string>>();
#endif
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);
#endif
foreach(bool result in results)
{
if (result == false)
return false;
}
return true;
}
}
}

View file

@ -1,40 +0,0 @@
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

@ -1,248 +0,0 @@
using HISP.Game;
using HISP.Game.Horse;
using HISP.Game.Items;
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] = 0;
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, 0};
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.Thirst = 8000;
results.Add(Test("ThirstMaximumEnforcement", user.Thirst, 1000));
user.Thirst = -8000;
results.Add(Test("ThirstMinimumEnforcement", user.Thirst, 0));
user.Tiredness = 8000;
results.Add(Test("TirednessMaximumEnforcement", user.Tiredness, 1000));
user.Tiredness = -8000;
results.Add(Test("TirednessMinimumEnforcement", user.Tiredness, 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));
// Check max horses count
user.Subscribed = false;
results.Add(Test("UnsubbedMaxHorses", user.MaxHorses, 7));
user.Subscribed = true;
results.Add(Test("SubbedMaxHorses", user.MaxHorses, 11));
HorseInstance horse = new HorseInstance(HorseInfo.GetBreedById(170));
horse.BasicStats.Thirst = 0;
horse.BasicStats.Hunger = 0;
int horseId = horse.RandomId;
user.HorseInventory.AddHorse(horse);
/*
* Test Ranches
*/
// Give player ranch id 10
Ranch.GetRanchById(37).OwnerId = user.Id;
// Check ranch is now owned by that player, and propagates to user object.
results.Add(Test("GiveRanchTest", user.OwnedRanch.Id, 37));
results.Add(Test("HaveDorothyShoes", user.Inventory.HasItemId(Item.DorothyShoes), true));
// Ranch upgrade test
foreach(Ranch.RanchUpgrade upgrade in Ranch.RanchUpgrade.RanchUpgrades)
{
int id = upgrade.Id;
user.OwnedRanch.UpgradedLevel = id;
}
// Test swf
results.Add(Test("RanchSwfMine", user.OwnedRanch.GetSwf(true), "ranchviewer.swf?H=10&B1=11&B2=&B3=&B4=&B5=&B6=&B7=&B8=&B9=&B10=&B11=&B12=&B13=&B14=&B15=&B16=&MINE=1"));
results.Add(Test("RanchSwf", user.OwnedRanch.GetSwf(false), "ranchviewer.swf?H=10&B1=11&B2=&B3=&B4=&B5=&B6=&B7=&B8=&B9=&B10=&B11=&B12=&B13=&B14=&B15=&B16="));
// Test Ranch Building Functionality
// Test Barn
user.OwnedRanch.SetBuilding(0, Ranch.RanchBuilding.GetRanchBuildingById(1)); // Barn
results.Add(Test("RanchBarnMaxHorses", user.MaxHorses, 11 + 4));
// Test Water Well
user.OwnedRanch.SetBuilding(0, Ranch.RanchBuilding.GetRanchBuildingById(2)); // Water Well
user.Teleport(user.OwnedRanch.X, user.OwnedRanch.Y);
results.Add(Test("RanchWaterWellWatering", user.HorseInventory.GetHorseById(horseId).BasicStats.Thirst, 1000));
// Test Grain Silo
user.OwnedRanch.SetBuilding(0, Ranch.RanchBuilding.GetRanchBuildingById(3)); // Grain Silo
user.Teleport(user.OwnedRanch.X, user.OwnedRanch.Y);
results.Add(Test("RanchGrainSiloFeeding", user.HorseInventory.GetHorseById(horseId).BasicStats.Hunger, 1000));
// Set building id 0 to a big barn
user.OwnedRanch.SetBuilding(0, Ranch.RanchBuilding.GetRanchBuildingById(10)); // Big Barn
results.Add(Test("RanchBigBarnMaxHorses", user.MaxHorses, 11 + 8));
// Set building id 0 to a gold barn
user.OwnedRanch.SetBuilding(0, Ranch.RanchBuilding.GetRanchBuildingById(11)); // Gold Barn
results.Add(Test("RanchGoldBarnMaxHorses", user.MaxHorses, 11 + 12));
foreach (bool result in results)
if (!result)
return false;
return true;
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -201,10 +201,10 @@ namespace HISP.Game
break; break;
} }
byte[] startingUpEventPacket = PacketBuilder.CreateChat(message, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] startingUpEventPacket = PacketBuilder.CreateChat(message, PacketBuilder.CHAT_BOTTOM_RIGHT);
byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swf, PacketBuilder.PACKET_SWF_MODULE_CUTSCENE); byte[] swfModulePacket = PacketBuilder.CreateSwfModule(swf, PacketBuilder.PACKET_SWF_CUTSCENE);
Logger.DebugPrint(entry.EnteredUser.Username + " Loading swf: " + swf); Logger.DebugPrint(entry.EnteredUser.Username + " Loading swf: " + swf);
entry.EnteredUser.Client.SendPacket(swfModulePacket); entry.EnteredUser.LoggedinClient.SendPacket(swfModulePacket);
entry.EnteredUser.Client.SendPacket(startingUpEventPacket); entry.EnteredUser.LoggedinClient.SendPacket(startingUpEventPacket);
} }
arenaTimeout = new Timer(new TimerCallback(arenaTimedOut), null, Timeout * 60 * 1000, Timeout * 60 * 1000); arenaTimeout = new Timer(new TimerCallback(arenaTimedOut), null, Timeout * 60 * 1000, Timeout * 60 * 1000);
@ -275,7 +275,7 @@ namespace HISP.Game
try try
{ {
byte[] arenaResults = PacketBuilder.CreateChat(chatMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] arenaResults = PacketBuilder.CreateChat(chatMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
entry.EnteredUser.Client.SendPacket(arenaResults); entry.EnteredUser.LoggedinClient.SendPacket(arenaResults);
int expReward = expRewards[place]; int expReward = expRewards[place];
@ -289,7 +289,7 @@ namespace HISP.Game
byte[] youWinMessage = PacketBuilder.CreateChat(Messages.FormatArenaYouWinMessage(prize, expReward), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] youWinMessage = PacketBuilder.CreateChat(Messages.FormatArenaYouWinMessage(prize, expReward), PacketBuilder.CHAT_BOTTOM_RIGHT);
entry.EnteredUser.Client.SendPacket(youWinMessage); entry.EnteredUser.LoggedinClient.SendPacket(youWinMessage);
// Awards: // Awards:
@ -327,7 +327,7 @@ namespace HISP.Game
entry.EnteredUser.Awards.AddAward(Award.GetAwardById(32)); // Perseverance entry.EnteredUser.Awards.AddAward(Award.GetAwardById(32)); // Perseverance
byte[] youDONTWinMessage = PacketBuilder.CreateChat(Messages.FormatArenaOnlyWinnerWinsMessage(expReward), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] youDONTWinMessage = PacketBuilder.CreateChat(Messages.FormatArenaOnlyWinnerWinsMessage(expReward), PacketBuilder.CHAT_BOTTOM_RIGHT);
entry.EnteredUser.Client.SendPacket(youDONTWinMessage); entry.EnteredUser.LoggedinClient.SendPacket(youDONTWinMessage);
} }
place++; place++;
} }
@ -361,8 +361,8 @@ namespace HISP.Game
if (Entries.Length + 1 > Slots) if (Entries.Length + 1 > Slots)
{ {
byte[] enterFailed = PacketBuilder.CreateChat(Messages.ArenaFullErrorMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] enterFailed = PacketBuilder.CreateChat(Messages.ArenaFullErrorMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(enterFailed); user.LoggedinClient.SendPacket(enterFailed);
GameServer.UpdateArea(user.Client); GameServer.UpdateArea(user.LoggedinClient);
return; return;
} }
} }
@ -378,7 +378,7 @@ namespace HISP.Game
user.TakeMoney(EntryCost); user.TakeMoney(EntryCost);
byte[] enteredIntoCompetition = PacketBuilder.CreateChat(Messages.ArenaEnteredInto, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] enteredIntoCompetition = PacketBuilder.CreateChat(Messages.ArenaEnteredInto, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(enteredIntoCompetition); user.LoggedinClient.SendPacket(enteredIntoCompetition);
GameServer.UpdateAreaForAll(user.X, user.Y, true); GameServer.UpdateAreaForAll(user.X, user.Y, true);
return; return;

View file

@ -8,7 +8,7 @@ using HISP.Server;
namespace HISP.Game.Chat namespace HISP.Game.Chat
{ {
public class ChatMsg public class Chat
{ {
public struct Correction public struct Correction
{ {
@ -102,7 +102,7 @@ namespace HISP.Game.Chat
if (parsedMessage.ToUpper(CultureInfo.InvariantCulture).StartsWith(cmd.CmdName)) if (parsedMessage.ToUpper(CultureInfo.InvariantCulture).StartsWith(cmd.CmdName))
{ {
string[] args = parsedMessage.Substring(cmd.CmdName.Length).Trim().Split(' '); string[] args = parsedMessage.Substring(cmd.CmdName.Length).Trim().Split(' ');
return cmd.Execute(messageToGive, args, user); return cmd.CmdCallback(messageToGive, args, user);
} }
} }
} }
@ -197,9 +197,9 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameClient.ConnectedClients) foreach (GameClient client in GameClient.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.User.MuteGlobal && !client.User.MuteAll) if (!client.LoggedinUser.MuteGlobal && !client.LoggedinUser.MuteAll)
if (client.User.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
if(!client.User.MutePlayer.IsUserMuted(user)) if(!client.LoggedinUser.MutePlayer.IsUserMuted(user))
recipiants.Add(client); recipiants.Add(client);
} }
return recipiants.ToArray(); return recipiants.ToArray();
@ -211,9 +211,9 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameClient.ConnectedClients) foreach (GameClient client in GameClient.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.User.MuteAds && !client.User.MuteAll) if (!client.LoggedinUser.MuteAds && !client.LoggedinUser.MuteAll)
if (client.User.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
if (!client.User.MutePlayer.IsUserMuted(user)) if (!client.LoggedinUser.MutePlayer.IsUserMuted(user))
recipiants.Add(client); recipiants.Add(client);
} }
return recipiants.ToArray(); return recipiants.ToArray();
@ -225,10 +225,10 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameClient.ConnectedClients) foreach (GameClient client in GameClient.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (!client.User.MuteBuddy && !client.User.MuteAll) if (!client.LoggedinUser.MuteBuddy && !client.LoggedinUser.MuteAll)
if (client.User.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
if (client.User.Friends.List.Contains(user.Id)) if (client.LoggedinUser.Friends.List.Contains(user.Id))
if (!client.User.MutePlayer.IsUserMuted(user)) if (!client.LoggedinUser.MutePlayer.IsUserMuted(user))
recipiants.Add(client); recipiants.Add(client);
} }
return recipiants.ToArray(); return recipiants.ToArray();
@ -245,7 +245,7 @@ namespace HISP.Game.Chat
if (user.Id != userInIsle.Id) if (user.Id != userInIsle.Id)
if(!userInIsle.MuteAll && !userInIsle.MuteIsland) if(!userInIsle.MuteAll && !userInIsle.MuteIsland)
if(!userInIsle.MutePlayer.IsUserMuted(user)) if(!userInIsle.MutePlayer.IsUserMuted(user))
recipiants.Add(userInIsle.Client); recipiants.Add(userInIsle.LoggedinClient);
} }
return recipiants.ToArray(); return recipiants.ToArray();
} }
@ -265,7 +265,7 @@ namespace HISP.Game.Chat
if (user.Id != userHere.Id) if (user.Id != userHere.Id)
if (!userHere.MuteAll && !userHere.MuteHere) if (!userHere.MuteAll && !userHere.MuteHere)
if (!userHere.MutePlayer.IsUserMuted(user)) if (!userHere.MutePlayer.IsUserMuted(user))
recipiants.Add(userHere.Client); recipiants.Add(userHere.LoggedinClient);
} }
return recipiants.ToArray(); return recipiants.ToArray();
} }
@ -279,7 +279,7 @@ namespace HISP.Game.Chat
if (user.Id != nearbyUser.Id) if (user.Id != nearbyUser.Id)
if (!nearbyUser.MuteAll && !nearbyUser.MuteNear) if (!nearbyUser.MuteAll && !nearbyUser.MuteNear)
if (!nearbyUser.MutePlayer.IsUserMuted(user)) if (!nearbyUser.MutePlayer.IsUserMuted(user))
recipiants.Add(nearbyUser.Client); recipiants.Add(nearbyUser.LoggedinClient);
} }
return recipiants.ToArray(); return recipiants.ToArray();
} }
@ -296,8 +296,8 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameClient.ConnectedClients) foreach (GameClient client in GameClient.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (client.User.Moderator) if (client.LoggedinUser.Moderator)
if (client.User.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client); recipiants.Add(client);
} }
return recipiants.ToArray(); return recipiants.ToArray();
@ -316,8 +316,8 @@ namespace HISP.Game.Chat
foreach (GameClient client in GameClient.ConnectedClients) foreach (GameClient client in GameClient.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (client.User.Administrator) if (client.LoggedinUser.Administrator)
if (client.User.Id != user.Id) if (client.LoggedinUser.Id != user.Id)
recipiants.Add(client); recipiants.Add(client);
} }
return recipiants.ToArray(); return recipiants.ToArray();
@ -332,9 +332,9 @@ namespace HISP.Game.Chat
{ {
if (client.LoggedIn) if (client.LoggedIn)
{ {
if (!client.User.MutePrivateMessage && !client.User.MuteAll) if (!client.LoggedinUser.MutePrivateMessage && !client.LoggedinUser.MuteAll)
{ {
if (client.User.Username.ToLower().StartsWith(to.ToLower())) if (client.LoggedinUser.Username.ToLower().StartsWith(to.ToLower()))
{ {
recipiants.Add(client); recipiants.Add(client);
break; break;

View file

@ -8,7 +8,6 @@ using HISP.Game.Inventory;
using System.Linq; using System.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace HISP.Game.Chat namespace HISP.Game.Chat
{ {
@ -22,9 +21,9 @@ namespace HISP.Game.Chat
continue; continue;
if (client.LoggedIn) if (client.LoggedIn)
{ {
if (client.User.Username.ToLower().StartsWith(name.ToLower())) if (client.LoggedinUser.Username.ToLower().StartsWith(name.ToLower()))
{ {
return client.User; return client.LoggedinUser;
} }
} }
} }
@ -34,124 +33,41 @@ namespace HISP.Game.Chat
public static void RegisterCommands() public static void RegisterCommands()
{ {
// Admin Commands // Admin Commands
new CommandRegister('%', "GIVE", "OBJECT <itemid / RANDOM> [username / ALL]\nMONEY <amount> [username]\nHORSE <breedid> [username]\nQUEST <questid> [FORCE]\nAWARD <awardid> [username]", Command.Give, true, false); new CommandRegister('%', "GIVE", "OBJECT <itemid / RANDOM> [username / ALL]\nMONEY <amount> [username]\nHORSE <breedid> [username]\nQUEST <questid> [FORCE]\nAWARD <awardid> [username]", Command.Give);
new CommandRegister('%', "SWF", "<swf> [username / ALL]", Command.Swf, true, false); new CommandRegister('%', "SWF", "<swf> [username / ALL]", Command.Swf);
new CommandRegister('%', "GOTO", "<x>,<y>\nPLAYER <playername>\nAREA <locationname>\nNPC <npcname>", Command.Goto, true, false); new CommandRegister('%', "GOTO", "<x>,<y>\nPLAYER <playername>\nAREA <locationname>\nNPC <npcname>", Command.Goto);
new CommandRegister('%', "JUMP", "<username> HERE", Command.Jump, true, false); new CommandRegister('%', "JUMP", "<username> HERE", Command.Jump);
new CommandRegister('%', "NOCLIP", "", Command.NoClip, true, false); new CommandRegister('%', "KICK" , "<username> [reason]", Command.Kick);
new CommandRegister('%', "MODHORSE", "<slot id> <stat> <value>", Command.ModHorse, true, false); new CommandRegister('%', "NOCLIP", "", Command.NoClip);
new CommandRegister('%', "DELITEM", "<item id> [username]", Command.DelItem, true, false); new CommandRegister('%', "MODHORSE", "<slot id> <stat> <value>", Command.ModHorse);
new CommandRegister('%', "SHUTDOWN", "", Command.Shutdown, true, false); new CommandRegister('%', "DELITEM", "<item id> [username]", Command.DelItem);
new CommandRegister('%', "CALL", "HORSE", Command.CallHorse, true, false); new CommandRegister('%', "SHUTDOWN", "", Command.Shutdown);
new CommandRegister('%', "MESSAGE", "<message>", Command.Message, true, false); new CommandRegister('%', "CALL", "HORSE", Command.CallHorse);
new CommandRegister('%', "PERMISSION", "<username> <admin / moderator / normal>", Command.Permission, true, false); new CommandRegister('%', "MESSAGE", "<message>", Command.Message);
// Moderator commands // Moderator commands
new CommandRegister('%', "RULES", "<username>", Command.Rules, false, true); new CommandRegister('%', "RULES", "<username>", Command.Rules);
new CommandRegister('%', "PRISON", "<username>", Command.Prison, false, true); new CommandRegister('%', "PRISON", "<username>", Command.Prison);
new CommandRegister('%', "STEALTH", "", Command.Stealth, false, true); new CommandRegister('%', "STEALTH", "", Command.Stealth);
new CommandRegister('%', "KICK", "<username> [reason]", Command.Kick, false, true); new CommandRegister('%', "BAN", "<username> [reason]", Command.Ban);
new CommandRegister('%', "BAN", "<username> [reason]", Command.Ban, false, true); new CommandRegister('%', "UNBAN", "<username>", Command.UnBan);
new CommandRegister('%', "UNBAN", "<username>", Command.UnBan, false, true); new CommandRegister('%', "ESCAPE", "", Command.Escape);
new CommandRegister('%', "ESCAPE", "", Command.Escape, false, true);
// User commands // User commands
new CommandRegister('%', "VERSION", "", Command.Version, false, false); new CommandRegister('!', "MUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.Mute);
new CommandRegister('%', "HELP", "", Command.Help, false, false); new CommandRegister('!', "UNMUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute);
new CommandRegister('!', "HEAR", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute);
new CommandRegister('!', "MUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.Mute, false, false); new CommandRegister('!', "AUTOREPLY", "[message]", Command.AutoReply);
new CommandRegister('!', "UNMUTE", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute, false, false); new CommandRegister('!', "QUIZ", "", Command.Quiz);
new CommandRegister('!', "HEAR", "ALL\nGLOBAL\nISLAND\nNEAR\nHERE\nBUDDY\nPM\nBR\nSOCIALS\nLOGINS", Command.UnMute, false, false); new CommandRegister('!', "WARP", "<username / location>", Command.Warp);
new CommandRegister('!', "AUTOREPLY", "[message]", Command.AutoReply, false, false); new CommandRegister('!', "DANCE", "<udlr>", Command.Dance);
new CommandRegister('!', "QUIZ", "", Command.Quiz, false, false); new CommandRegister('!', "VERSION", "", Command.Version);
new CommandRegister('!', "WARP", "<username / location>", Command.Warp, false, false);
new CommandRegister('!', "DANCE", "<udlr>", Command.Dance, false, false);
}
public static bool Help(string message, string[] args, User user)
{
foreach (CommandRegister cmd in CommandRegister.RegisteredCommands)
{
if (!cmd.HasPermission(user)) continue;
user.Client.SendPacket(PacketBuilder.CreateChat(Messages.FormatHispHelpUsage(cmd.CmdLetter, cmd.CmdName, cmd.CmdUsage).Replace("\n", "<BR>\t"), PacketBuilder.CHAT_BOTTOM_LEFT));
}
user.Client.SendPacket(PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT));
return true;
}
public static bool Permission(string message, string[] args, User user)
{
if (args.Length < 2)
return false;
string username = args[0].Trim();
string privledgeLevel = args[1].ToUpper().Trim();
try
{
User modifyUser = findNamePartial(username);
if (privledgeLevel == "NORMAL")
{
modifyUser.Administrator = false;
modifyUser.Moderator = false;
}
else if (privledgeLevel == "ADMIN")
{
modifyUser.Administrator = true;
modifyUser.Moderator = true;
}
else if (privledgeLevel == "MOD" || privledgeLevel == "MODERATOR")
{
modifyUser.Administrator = false;
modifyUser.Moderator = true;
}
else
{
return false;
}
}
catch (KeyNotFoundException)
{
try
{
int playerId = Database.GetUserid(username);
if (privledgeLevel == "NORMAL")
{
Database.SetUserAdmin(playerId, false);
Database.SetUserMod(playerId, false);
}
else if (privledgeLevel == "ADMIN")
{
Database.SetUserAdmin(playerId, true);
Database.SetUserMod(playerId, true);
}
else if (privledgeLevel == "MOD" || privledgeLevel == "MODERATOR")
{
Database.SetUserAdmin(playerId, false);
Database.SetUserMod(playerId, true);
}
else
{
return false;
}
}
catch (KeyNotFoundException) { return false; };
};
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket);
return true;
} }
public static bool Message(string message, string[] args, User user) public static bool Message(string message, string[] args, User user)
{ {
if (!user.Administrator)
return false;
string serverAnnoucement = String.Join(" ", args); string serverAnnoucement = String.Join(" ", args);
@ -170,12 +86,13 @@ namespace HISP.Game.Chat
return true; return true;
} }
public static bool Shutdown(string message, string[] args, User user) public static bool Shutdown(string message, string[] args, User user)
{ {
if (!user.Administrator)
return false;
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
GameServer.ShutdownServer();
GameServer.ShutdownServer("Administrator initiated");
return true; return true;
} }
@ -183,6 +100,8 @@ namespace HISP.Game.Chat
{ {
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
if (!user.Administrator)
return false;
if(args[0].ToUpper() == "OBJECT") if(args[0].ToUpper() == "OBJECT")
{ {
int itemId = 0; int itemId = 0;
@ -217,7 +136,7 @@ namespace HISP.Game.Chat
if (itemId == Item.Present) if (itemId == Item.Present)
itmInstance.Data = Item.GetRandomItem().Id; itmInstance.Data = Item.GetRandomItem().Id;
client.User.Inventory.AddIgnoringFull(itmInstance); client.LoggedinUser.Inventory.AddIgnoringFull(itmInstance);
} }
} }
} }
@ -326,7 +245,7 @@ namespace HISP.Game.Chat
} }
msg:; msg:;
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -335,6 +254,8 @@ namespace HISP.Game.Chat
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
if (!user.Administrator && !user.Moderator)
return false;
try try
{ {
@ -355,7 +276,7 @@ namespace HISP.Game.Chat
else else
{ {
User player = findNamePartial(swfUser); User player = findNamePartial(swfUser);
player.Client.SendPacket(packetBytes); player.LoggedinClient.SendPacket(packetBytes);
} }
} }
catch (Exception) catch (Exception)
@ -364,7 +285,7 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -373,6 +294,8 @@ namespace HISP.Game.Chat
{ {
if(args.Length <= 0) if(args.Length <= 0)
return false; return false;
if(!user.Administrator && !user.Moderator)
return false;
try{ try{
string userName = args[0]; string userName = args[0];
@ -386,7 +309,7 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -395,17 +318,18 @@ namespace HISP.Game.Chat
{ {
// Get current version and send to client // Get current version and send to client
byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] versionPacket = PacketBuilder.CreateChat(ServerVersion.GetBuildString(), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(versionPacket); user.LoggedinClient.SendPacket(versionPacket);
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatPlayerCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Ban(string message, string[] args, User user) public static bool Ban(string message, string[] args, User user)
{ {
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
if (!user.Administrator && !user.Moderator)
return false;
try try
{ {
string userName = args[0]; string userName = args[0];
@ -425,43 +349,53 @@ namespace HISP.Game.Chat
} }
try{ try{
User bannedUser = GameServer.GetUserByName(args[0]); User bannedUser = GameServer.GetUserByName(args[0]);
bannedUser.Client.Kick(Messages.KickReasonBanned); bannedUser.LoggedinClient.Kick(Messages.KickReasonBanned);
} }
catch(KeyNotFoundException){}; catch(KeyNotFoundException){};
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Escape(string message, string[] args, User user) public static bool Escape(string message, string[] args, User user)
{ {
if (!user.Administrator && !user.Moderator)
return false;
user.Teleport(Map.ModIsleX, Map.ModIsleY); user.Teleport(Map.ModIsleX, Map.ModIsleY);
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message) + Messages.ModIsleMessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message) + Messages.ModIsleMessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Stealth(string message, string[] args, User user) public static bool Stealth(string message, string[] args, User user)
{ {
if (!user.Administrator && !user.Moderator)
return false;
user.Stealth = !user.Stealth; user.Stealth = !user.Stealth;
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool NoClip(string message, string[] args, User user) public static bool NoClip(string message, string[] args, User user)
{ {
if (!user.Administrator)
return false;
user.NoClip = !user.NoClip; user.NoClip = !user.NoClip;
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Rules(string message, string[] args, User user) public static bool Rules(string message, string[] args, User user)
{ {
if (!user.Administrator && !user.Moderator)
return false;
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
@ -471,7 +405,7 @@ namespace HISP.Game.Chat
toSend.Teleport(Map.RulesIsleX, Map.RulesIsleY); toSend.Teleport(Map.RulesIsleX, Map.RulesIsleY);
byte[] studyTheRulesMsg = PacketBuilder.CreateChat(Messages.RulesIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] studyTheRulesMsg = PacketBuilder.CreateChat(Messages.RulesIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
toSend.Client.SendPacket(studyTheRulesMsg); toSend.LoggedinClient.SendPacket(studyTheRulesMsg);
} }
catch (KeyNotFoundException) catch (KeyNotFoundException)
{ {
@ -479,12 +413,14 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message)+Messages.FormatRulesCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message)+Messages.FormatRulesCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Prison(string message, string[] args, User user) public static bool Prison(string message, string[] args, User user)
{ {
if (!user.Administrator && !user.Moderator)
return false;
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
@ -495,7 +431,7 @@ namespace HISP.Game.Chat
toSend.Teleport(Map.PrisonIsleX, Map.PrisonIsleY); toSend.Teleport(Map.PrisonIsleX, Map.PrisonIsleY);
byte[] dontDoTheTime = PacketBuilder.CreateChat(Messages.PrisonIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] dontDoTheTime = PacketBuilder.CreateChat(Messages.PrisonIsleSentMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
toSend.Client.SendPacket(dontDoTheTime); toSend.LoggedinClient.SendPacket(dontDoTheTime);
} }
catch (KeyNotFoundException) catch (KeyNotFoundException)
{ {
@ -503,12 +439,14 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message) + Messages.FormatPrisonCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message) + Messages.FormatPrisonCommandMessage(args[0]), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Kick(string message, string[] args, User user) public static bool Kick(string message, string[] args, User user)
{ {
if (!user.Administrator && !user.Moderator)
return false;
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
@ -520,11 +458,11 @@ namespace HISP.Game.Chat
if (args.Length >= 2) if (args.Length >= 2)
{ {
string reason = string.Join(" ", args, 1, args.Length - 1); string reason = string.Join(" ", args, 1, args.Length - 1);
toKick.Client.Kick(reason); toKick.LoggedinClient.Kick(reason);
} }
else else
{ {
toKick.Client.Kick(Messages.KickReasonKicked); toKick.LoggedinClient.Kick(Messages.KickReasonKicked);
} }
} }
catch (KeyNotFoundException) catch (KeyNotFoundException)
@ -533,13 +471,15 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Jump(string message, string[] args, User user) public static bool Jump(string message, string[] args, User user)
{ {
if (args.Length < 2) if (args.Length <= 2)
return false;
if (!user.Administrator)
return false; return false;
@ -555,7 +495,7 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -563,6 +503,8 @@ namespace HISP.Game.Chat
{ {
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
if (!user.Administrator)
return false;
int itemId = 0; int itemId = 0;
try try
@ -588,7 +530,7 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -596,6 +538,8 @@ namespace HISP.Game.Chat
{ {
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
if (!user.Administrator)
return false;
if(args[0].ToUpper() == "PLAYER") if(args[0].ToUpper() == "PLAYER")
{ {
if(args.Length < 2) if(args.Length < 2)
@ -684,13 +628,16 @@ namespace HISP.Game.Chat
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool ModHorse(string message, string[] args, User user) public static bool ModHorse(string message, string[] args, User user)
{ {
if (!user.Administrator)
return false;
if (args.Length < 3) if (args.Length < 3)
return false; return false;
@ -761,7 +708,7 @@ namespace HISP.Game.Chat
byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.FormatAdminCommandCompleteMessage(message), PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -819,19 +766,21 @@ namespace HISP.Game.Chat
} }
playSwf:; playSwf:;
byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE); byte[] swfPacket = PacketBuilder.CreateSwfModule("warpcutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
user.Client.SendPacket(swfPacket); user.LoggedinClient.SendPacket(swfPacket);
sendText:; sendText:;
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool CallHorse(string message, string[] args, User user) public static bool CallHorse(string message, string[] args, User user)
{ {
if (!user.Administrator)
return false;
if (args.Length <= 0) if (args.Length <= 0)
return false; return false;
@ -856,7 +805,7 @@ namespace HISP.Game.Chat
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -870,16 +819,16 @@ namespace HISP.Game.Chat
if (replyMessage.Length > 1024) if (replyMessage.Length > 1024)
{ {
byte[] tooLong = PacketBuilder.CreateChat(Messages.AutoReplyTooLong, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tooLong = PacketBuilder.CreateChat(Messages.AutoReplyTooLong, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(tooLong); user.LoggedinClient.SendPacket(tooLong);
return false; return false;
} }
Object violationReason = ChatMsg.FilterMessage(replyMessage); Object violationReason = Chat.FilterMessage(replyMessage);
if (violationReason != null) if (violationReason != null)
{ {
byte[] hasVios = PacketBuilder.CreateChat(Messages.AutoReplyHasViolations, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] hasVios = PacketBuilder.CreateChat(Messages.AutoReplyHasViolations, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(hasVios); user.LoggedinClient.SendPacket(hasVios);
return false; return false;
} }
@ -887,7 +836,7 @@ namespace HISP.Game.Chat
user.AutoReplyText = replyMessage; user.AutoReplyText = replyMessage;
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
public static bool Dance(string message, string[] args, User user) public static bool Dance(string message, string[] args, User user)
@ -901,7 +850,7 @@ namespace HISP.Game.Chat
user.ActiveDance = new Dance(user, moves); user.ActiveDance = new Dance(user, moves);
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -912,7 +861,7 @@ namespace HISP.Game.Chat
if(user.InRealTimeQuiz) if(user.InRealTimeQuiz)
{ {
byte[] cantEnterRealTimeQuiz = PacketBuilder.CreateChat(Messages.EventAlreadyEnteredRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] cantEnterRealTimeQuiz = PacketBuilder.CreateChat(Messages.EventAlreadyEnteredRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(cantEnterRealTimeQuiz); user.LoggedinClient.SendPacket(cantEnterRealTimeQuiz);
return false; return false;
} }
if (quizActive) if (quizActive)
@ -924,24 +873,24 @@ namespace HISP.Game.Chat
if(participent.Quit) if(participent.Quit)
{ {
byte[] quizQuit = PacketBuilder.CreateChat(Messages.EventQuitRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] quizQuit = PacketBuilder.CreateChat(Messages.EventQuitRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(quizQuit); user.LoggedinClient.SendPacket(quizQuit);
return false; return false;
} }
participent.UpdateParticipent(); participent.UpdateParticipent();
byte[] enteredRealTimeQuiz = PacketBuilder.CreateChat(Messages.EventEnteredRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] enteredRealTimeQuiz = PacketBuilder.CreateChat(Messages.EventEnteredRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(enteredRealTimeQuiz); user.LoggedinClient.SendPacket(enteredRealTimeQuiz);
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
else else
{ {
byte[] quizUnavailable = PacketBuilder.CreateChat(Messages.EventUnavailableRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] quizUnavailable = PacketBuilder.CreateChat(Messages.EventUnavailableRealTimeQuiz, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(quizUnavailable); user.LoggedinClient.SendPacket(quizUnavailable);
return false; return false;
} }
@ -1020,7 +969,7 @@ namespace HISP.Game.Chat
} }
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }
@ -1098,7 +1047,7 @@ namespace HISP.Game.Chat
byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT); byte[] chatPacket = PacketBuilder.CreateChat(formattedmessage, PacketBuilder.CHAT_BOTTOM_LEFT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return true; return true;
} }

View file

@ -15,43 +15,19 @@ namespace HISP.Game.Chat
return registeredComamnds.ToArray(); return registeredComamnds.ToArray();
} }
} }
private Func<string, string[], User, bool> commandCallback;
public bool CmdRequiresAdmin;
public bool CmdRequiresMod;
public char CmdLetter; public char CmdLetter;
public string CmdName; public string CmdName;
public string CmdUsage; public string CmdUsage;
public CommandRegister(char cmdLetter, string cmdName, string cmdUsage, Func<string, string[], User, bool> cmdCallback, bool cmdRequiresAdmin, bool cmdRequiresMod) public Func<string,string[],User, bool> CmdCallback;
public CommandRegister(char cmdLetter, string cmdName, string cmdUsage, Func<string, string[], User, bool> cmdCallback)
{ {
this.CmdLetter = cmdLetter; CmdLetter = cmdLetter;
this.CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture).Trim(); CmdName = cmdName.ToUpper(CultureInfo.InvariantCulture);
this.CmdUsage = cmdUsage; CmdCallback = cmdCallback;
CmdUsage = cmdUsage;
this.CmdRequiresMod = cmdRequiresMod;
this.CmdRequiresAdmin = cmdRequiresAdmin;
this.commandCallback = cmdCallback;
registeredComamnds.Add(this); registeredComamnds.Add(this);
} }
public bool HasPermission(User user)
{
if (CmdRequiresAdmin && !(user.Administrator))
return false;
if (CmdRequiresMod && !(user.Moderator || user.Administrator))
return false;
return true;
}
public bool Execute(string message, string[] args, User user)
{
if(HasPermission(user))
return commandCallback(message, args, user);
return false;
}
} }
} }

View file

@ -54,16 +54,16 @@ namespace HISP.Game.Events
int totalTypes = 0; int totalTypes = 0;
foreach (int itemId in Item.TradingCards) foreach (int itemId in Item.TradingCards)
if (client.User.Inventory.HasItemId(itemId)) if (client.LoggedinUser.Inventory.HasItemId(itemId))
totalCards += client.User.Inventory.GetItemByItemId(itemId).ItemInstances.Length; totalCards += client.LoggedinUser.Inventory.GetItemByItemId(itemId).ItemInstances.Length;
if (client.User.Inventory.HasItemId(Item.ColtTradingCard)) if (client.LoggedinUser.Inventory.HasItemId(Item.ColtTradingCard))
totalTypes++; totalTypes++;
if (client.User.Inventory.HasItemId(Item.FillyTradingCard)) if (client.LoggedinUser.Inventory.HasItemId(Item.FillyTradingCard))
totalTypes++; totalTypes++;
if (client.User.Inventory.HasItemId(Item.MareTradingCard)) if (client.LoggedinUser.Inventory.HasItemId(Item.MareTradingCard))
totalTypes++; totalTypes++;
if (client.User.Inventory.HasItemId(Item.StallionTradingCard)) if (client.LoggedinUser.Inventory.HasItemId(Item.StallionTradingCard))
totalTypes++; totalTypes++;
if(totalCards > 4) if(totalCards > 4)
@ -93,12 +93,12 @@ namespace HISP.Game.Events
} }
else if (totalTypes == 4) else if (totalTypes == 4)
{ {
client.User.TrackedItems.GetTrackedItem(Tracking.TrackableItem.IsleCardsGameWin).Count++; client.LoggedinUser.TrackedItems.GetTrackedItem(Tracking.TrackableItem.IsleCardsGameWin).Count++;
byte[] wonIsleCardGame = PacketBuilder.CreateChat(Messages.EventWonIsleTradingGame, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] wonIsleCardGame = PacketBuilder.CreateChat(Messages.EventWonIsleTradingGame, PacketBuilder.CHAT_BOTTOM_RIGHT);
client.SendPacket(wonIsleCardGame); client.SendPacket(wonIsleCardGame);
client.User.AddMoney(25000); client.LoggedinUser.AddMoney(25000);
} }

View file

@ -148,8 +148,8 @@ namespace HISP.Game.Events
thrower.AddMoney(50); thrower.AddMoney(50);
throwAt.AddMoney(500); throwAt.AddMoney(500);
thrower.Client.SendPacket(youEarned); thrower.LoggedinClient.SendPacket(youEarned);
throwAt.Client.SendPacket(otherEarned); throwAt.LoggedinClient.SendPacket(otherEarned);
throwCounter.AddThrownAt(throwAt); throwCounter.AddThrownAt(throwAt);
} }

View file

@ -59,7 +59,7 @@ namespace HISP.Game.Events
string msg = Messages.FormatRandomEvent(rngEvent.Text, moneyEarned, horseName); string msg = Messages.FormatRandomEvent(rngEvent.Text, moneyEarned, horseName);
byte[] chatPacket = PacketBuilder.CreateChat(Messages.RandomEventPrefix + msg, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] chatPacket = PacketBuilder.CreateChat(Messages.RandomEventPrefix + msg, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(chatPacket); user.LoggedinClient.SendPacket(chatPacket);
return; return;
} }

View file

@ -48,7 +48,7 @@ namespace HISP.Game.Events
return; return;
byte[] realTimeQuizQuestion = PacketBuilder.CreateMeta(Meta.BuildRealTimeQuiz(this)); byte[] realTimeQuizQuestion = PacketBuilder.CreateMeta(Meta.BuildRealTimeQuiz(this));
this.UserInstance.Client.SendPacket(realTimeQuizQuestion); this.UserInstance.LoggedinClient.SendPacket(realTimeQuizQuestion);
} }
public void CheckAnswer(string answer) public void CheckAnswer(string answer)
@ -160,7 +160,7 @@ namespace HISP.Game.Events
Participent partcipent = getParticipent(user.Id); Participent partcipent = getParticipent(user.Id);
partcipent.Quit = true; partcipent.Quit = true;
user.InRealTimeQuiz = false; user.InRealTimeQuiz = false;
GameServer.UpdateArea(user.Client); GameServer.UpdateArea(user.LoggedinClient);
} }
catch (KeyNotFoundException) { }; catch (KeyNotFoundException) { };
} }
@ -219,7 +219,7 @@ namespace HISP.Game.Events
participent.UserInstance.InRealTimeQuiz = false; participent.UserInstance.InRealTimeQuiz = false;
GameServer.UpdateArea(participent.UserInstance.Client); GameServer.UpdateArea(participent.UserInstance.LoggedinClient);
int money = 0; int money = 0;
@ -238,12 +238,12 @@ namespace HISP.Game.Events
if (participent.Won) if (participent.Won)
{ {
byte[] wonBonusMessage = PacketBuilder.CreateChat(Messages.FormatEventRealTimeQuizWinBonus(money), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] wonBonusMessage = PacketBuilder.CreateChat(Messages.FormatEventRealTimeQuizWinBonus(money), PacketBuilder.CHAT_BOTTOM_RIGHT);
participent.UserInstance.Client.SendPacket(wonBonusMessage); participent.UserInstance.LoggedinClient.SendPacket(wonBonusMessage);
} }
else else
{ {
byte[] bonusMessage = PacketBuilder.CreateChat(Messages.FormatEventRealTimeQuizBonus(money), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] bonusMessage = PacketBuilder.CreateChat(Messages.FormatEventRealTimeQuizBonus(money), PacketBuilder.CHAT_BOTTOM_RIGHT);
participent.UserInstance.Client.SendPacket(bonusMessage); participent.UserInstance.LoggedinClient.SendPacket(bonusMessage);
} }
participent.UserInstance.AddMoney(money); participent.UserInstance.AddMoney(money);

View file

@ -59,7 +59,7 @@ namespace HISP.Game.Events
if (Database.HasPlayerCompletedRealTimeRiddle(RiddleId, winner.Id)) if (Database.HasPlayerCompletedRealTimeRiddle(RiddleId, winner.Id))
{ {
byte[] alreadyWonRiddleMessage = PacketBuilder.CreateChat(Messages.EventAlreadySovledRealTimeRiddle, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] alreadyWonRiddleMessage = PacketBuilder.CreateChat(Messages.EventAlreadySovledRealTimeRiddle, PacketBuilder.CHAT_BOTTOM_RIGHT);
winner.Client.SendPacket(alreadyWonRiddleMessage); winner.LoggedinClient.SendPacket(alreadyWonRiddleMessage);
return; return;
} }
@ -81,7 +81,7 @@ namespace HISP.Game.Events
foreach (GameClient client in GameClient.ConnectedClients) foreach (GameClient client in GameClient.ConnectedClients)
{ {
if (client.LoggedIn) if (client.LoggedIn)
if (client.User.Id != winner.Id) if (client.LoggedinUser.Id != winner.Id)
client.SendPacket(riddleWonMessage); client.SendPacket(riddleWonMessage);
else else
client.SendPacket(riddleYouWonMessage); client.SendPacket(riddleYouWonMessage);

View file

@ -80,7 +80,7 @@ namespace HISP.Game.Events
{ {
byte[] youWinMsg = PacketBuilder.CreateChat(Messages.EventWonWaterBallonGame, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] youWinMsg = PacketBuilder.CreateChat(Messages.EventWonWaterBallonGame, PacketBuilder.CHAT_BOTTOM_RIGHT);
winner.UserHit.AddMoney(20000); winner.UserHit.AddMoney(20000);
winner.UserHit.Client.SendPacket(youWinMsg); winner.UserHit.LoggedinClient.SendPacket(youWinMsg);
winner.UserHit.TrackedItems.GetTrackedItem(Tracking.TrackableItem.WaterbaloonGameWin).Count++; winner.UserHit.TrackedItems.GetTrackedItem(Tracking.TrackableItem.WaterbaloonGameWin).Count++;
} }

View file

@ -150,7 +150,7 @@ namespace HISP.Game.Items
if (isle.Name == "Prison Isle") if (isle.Name == "Prison Isle")
{ {
byte[] dontWorkHere = PacketBuilder.CreateChat(Messages.RanchDorothyShoesPrisonIsleMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] dontWorkHere = PacketBuilder.CreateChat(Messages.RanchDorothyShoesPrisonIsleMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(dontWorkHere); user.LoggedinClient.SendPacket(dontWorkHere);
return; return;
} }
} }
@ -162,14 +162,14 @@ namespace HISP.Game.Items
return; return;
} }
byte[] noPlaceLIke127001 = PacketBuilder.CreateChat(Messages.RanchDorothyShoesMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] noPlaceLIke127001 = PacketBuilder.CreateChat(Messages.RanchDorothyShoesMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(noPlaceLIke127001); user.LoggedinClient.SendPacket(noPlaceLIke127001);
user.Teleport(user.OwnedRanch.X, user.OwnedRanch.Y); user.Teleport(user.OwnedRanch.X, user.OwnedRanch.Y);
} }
else if (itm.ItemId == Item.Telescope) else if (itm.ItemId == Item.Telescope)
{ {
byte[] birdMap = PacketBuilder.CreateBirdMap(user.X, user.Y); byte[] birdMap = PacketBuilder.CreateBirdMap(user.X, user.Y);
user.Client.SendPacket(birdMap); user.LoggedinClient.SendPacket(birdMap);
} }
else else
{ {

View file

@ -12,14 +12,7 @@ namespace HISP.Game
public string Type; public string Type;
} }
public struct TileDepth public static int[] OverlayTileDepth;
{
public bool ShowPlayer;
public bool Passable;
}
public static TileDepth[] OverlayTileDepth;
public static TerrainTile[] TerrainTiles;
public static int Width; public static int Width;
public static int Height; public static int Height;
@ -27,6 +20,8 @@ namespace HISP.Game
public static byte[] MapData; public static byte[] MapData;
public static byte[] oMapData; public static byte[] oMapData;
public static TerrainTile[] TerrainTiles;
public static int NewUserStartX; public static int NewUserStartX;
public static int NewUserStartY; public static int NewUserStartY;
@ -80,9 +75,19 @@ namespace HISP.Game
if (World.InIsle(x, y)) if (World.InIsle(x, y))
tileset = World.GetIsle(x, y).Tileset; tileset = World.GetIsle(x, y).Tileset;
otileId = otileId + 64 * tileset; otileId = otileId + 64 * tileset;
} }
bool overlayPassable = OverlayTileDepth[otileId].Passable;
int tileDepth = OverlayTileDepth[otileId];
bool overlayPassable = false;
if (tileDepth == 0)
overlayPassable = false;
if (tileDepth == 1)
overlayPassable = false;
if (tileDepth == 2)
overlayPassable = true;
if (tileDepth == 3)
overlayPassable = true;
if ((!terrainPassable && overlayPassable) && otileId == 0) if ((!terrainPassable && overlayPassable) && otileId == 0)
return false; return false;

File diff suppressed because it is too large Load diff

View file

@ -1154,9 +1154,9 @@ namespace HISP.Game
{ {
if (client.LoggedIn) if (client.LoggedIn)
{ {
if (client.User.Stealth) if (client.LoggedinUser.Stealth)
continue; continue;
onlineUsers.Add(client.User); onlineUsers.Add(client.LoggedinUser);
} }
} }
@ -1189,17 +1189,17 @@ namespace HISP.Game
{ {
if (client.LoggedIn) if (client.LoggedIn)
{ {
if (client.User.Stealth) if (client.LoggedinUser.Stealth)
continue; continue;
bool isYou = (client.User.Id == currentUser.Id); bool isYou = (client.LoggedinUser.Id == currentUser.Id);
int icon = client.User.GetPlayerListIcon(); int icon = client.LoggedinUser.GetPlayerListIcon();
string iconFormat = ""; string iconFormat = "";
if (icon != -1) if (icon != -1)
iconFormat = Messages.FormatIconFormat(icon); iconFormat = Messages.FormatIconFormat(icon);
message += Messages.FormatPlayerEntry(iconFormat, client.User.Username, client.User.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - client.User.LoginTime).TotalMinutes)), client.User.X, client.User.Y, client.User.Idle, currentUser.MutePlayer.IsUserMuted(client.User), isYou); message += Messages.FormatPlayerEntry(iconFormat, client.LoggedinUser.Username, client.LoggedinUser.Id, Convert.ToInt32(Math.Round((DateTime.UtcNow - client.LoggedinUser.LoginTime).TotalMinutes)), client.LoggedinUser.X, client.LoggedinUser.Y, client.LoggedinUser.Idle, currentUser.MutePlayer.IsUserMuted(client.LoggedinUser), isYou);
} }
} }
@ -1735,7 +1735,7 @@ namespace HISP.Game
string swfModule = ranch.GetSwf(mine); string swfModule = ranch.GetSwf(mine);
byte[] moduleSwf = PacketBuilder.CreateSwfModule(swfModule, PacketBuilder.PACKET_SWF_MODULE_FORCE); byte[] moduleSwf = PacketBuilder.CreateSwfModule(swfModule, PacketBuilder.PACKET_SWF_MODULE_FORCE);
user.Client.SendPacket(moduleSwf); user.LoggedinClient.SendPacket(moduleSwf);
if (mine) // This is My DS. if (mine) // This is My DS.
{ {

View file

@ -84,7 +84,7 @@ namespace HISP.Game
if (joinedUser.Id != user.Id) if (joinedUser.Id != user.Id)
if(!TwoPlayer.IsPlayerInGame(joinedUser)) if(!TwoPlayer.IsPlayerInGame(joinedUser))
if(!joinedUser.MajorPriority) if(!joinedUser.MajorPriority)
GameServer.UpdateArea(joinedUser.Client); GameServer.UpdateArea(joinedUser.LoggedinClient);
} }
} }
@ -101,7 +101,7 @@ namespace HISP.Game
foreach (User joinedUser in JoinedUsers) foreach (User joinedUser in JoinedUsers)
if (!TwoPlayer.IsPlayerInGame(joinedUser)) if (!TwoPlayer.IsPlayerInGame(joinedUser))
if (!joinedUser.MajorPriority) if (!joinedUser.MajorPriority)
GameServer.UpdateArea(joinedUser.Client); GameServer.UpdateArea(joinedUser.LoggedinClient);
} }
} }

View file

@ -238,7 +238,7 @@ namespace HISP.Game
if (quest.SuccessMessage != null) if (quest.SuccessMessage != null)
{ {
byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(ChatPacket); user.LoggedinClient.SendPacket(ChatPacket);
} }
if (quest.SuccessNpcChat != null) if (quest.SuccessNpcChat != null)
@ -246,7 +246,7 @@ namespace HISP.Game
if (!npcActivation) if (!npcActivation)
{ {
byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] ChatPacket = PacketBuilder.CreateChat(quest.SuccessNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(ChatPacket); user.LoggedinClient.SendPacket(ChatPacket);
} }
} }
@ -264,8 +264,8 @@ namespace HISP.Game
// Is cloud isles quest? // Is cloud isles quest?
if (quest.Id == CloudIslesQuest) if (quest.Id == CloudIslesQuest)
{ {
byte[] swfLoadPacket = PacketBuilder.CreateSwfModule("ballooncutscene", PacketBuilder.PACKET_SWF_MODULE_CUTSCENE); byte[] swfLoadPacket = PacketBuilder.CreateSwfModule("ballooncutscene", PacketBuilder.PACKET_SWF_CUTSCENE);
user.Client.SendPacket(swfLoadPacket); user.LoggedinClient.SendPacket(swfLoadPacket);
} }
return res; return res;
@ -290,7 +290,7 @@ namespace HISP.Game
if (!npcActivation) if (!npcActivation)
{ {
byte[] ChatPacket = PacketBuilder.CreateChat(quest.FailNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] ChatPacket = PacketBuilder.CreateChat(quest.FailNpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(ChatPacket); user.LoggedinClient.SendPacket(ChatPacket);
} }
else else
{ {
@ -371,7 +371,7 @@ namespace HISP.Game
if(result.NpcChat != null) if(result.NpcChat != null)
{ {
byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(ChatPacket); user.LoggedinClient.SendPacket(ChatPacket);
} }
return true; return true;
} }
@ -383,7 +383,7 @@ namespace HISP.Game
if (result.NpcChat != null) if (result.NpcChat != null)
{ {
byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] ChatPacket = PacketBuilder.CreateChat(result.NpcChat, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(ChatPacket); user.LoggedinClient.SendPacket(ChatPacket);
} }
return true; return true;
} }

View file

@ -1,500 +1,489 @@
using HISP.Game.Inventory; using HISP.Game.Inventory;
using HISP.Game.Items; using HISP.Game.Items;
using HISP.Player; using HISP.Player;
using HISP.Server; using HISP.Server;
using HISP.Util; using HISP.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace HISP.Game namespace HISP.Game
{ {
public class Ranch public class Ranch
{ {
public class RanchUpgrade public class RanchUpgrade
{ {
public static List<RanchUpgrade> RanchUpgrades = new List<RanchUpgrade>(); public static List<RanchUpgrade> RanchUpgrades = new List<RanchUpgrade>();
public int Id; public int Id;
public int Cost; public int Cost;
public string Title; public string Title;
public string Description; public string Description;
public int Limit; public int Limit;
public static bool RanchUpgradeExists(int id) public static bool RanchUpgradeExists(int id)
{ {
foreach (RanchUpgrade rachUpgrade in RanchUpgrades) foreach (RanchUpgrade rachUpgrade in RanchUpgrades)
{ {
if (rachUpgrade.Id == id) if (rachUpgrade.Id == id)
return true; return true;
} }
return false; return false;
} }
public static RanchUpgrade GetRanchUpgradeById(int id) public static RanchUpgrade GetRanchUpgradeById(int id)
{ {
foreach (RanchUpgrade ranchUpgrade in RanchUpgrades) foreach (RanchUpgrade rachUpgrade in RanchUpgrades)
{ {
if (ranchUpgrade.Id == id) if (rachUpgrade.Id == id)
return ranchUpgrade; return rachUpgrade;
} }
throw new KeyNotFoundException("No ranch found."); throw new KeyNotFoundException("No ranch found.");
} }
} }
public class RanchBuilding public class RanchBuilding
{ {
public static List<RanchBuilding> RanchBuildings = new List<RanchBuilding>(); public static List<RanchBuilding> RanchBuildings = new List<RanchBuilding>();
public int Id; public int Id;
public int Cost; public int Cost;
public string Title; public string Title;
public string Description; public string Description;
public static bool RanchBuildingExists(int id) public static bool RanchBuildingExists(int id)
{ {
foreach (RanchBuilding ranchBuilding in RanchBuildings) foreach (RanchBuilding ranchBuilding in RanchBuildings)
{ {
if (ranchBuilding.Id == id) if (ranchBuilding.Id == id)
return true; return true;
} }
return false; return false;
} }
public static RanchBuilding GetRanchBuildingById(int id) public static RanchBuilding GetRanchBuildingById(int id)
{ {
foreach(RanchBuilding ranchBuilding in RanchBuildings) foreach(RanchBuilding ranchBuilding in RanchBuildings)
{ {
if (ranchBuilding.Id == id) if (ranchBuilding.Id == id)
return ranchBuilding; return ranchBuilding;
} }
throw new KeyNotFoundException("No ranch found."); throw new KeyNotFoundException("No ranch found.");
} }
public int GetTeardownPrice() public int GetTeardownPrice()
{ {
return Convert.ToInt32(Math.Round((float)this.Cost / (100 / 35.0))); return Convert.ToInt32(Math.Round((float)this.Cost / (100 / 35.0)));
} }
} }
public static List<Ranch> Ranches = new List<Ranch>(); public static List<Ranch> Ranches = new List<Ranch>();
public int X; public int X;
public int Y; public int Y;
public int Id; public int Id;
public int Value; public int Value;
private int ownerId; private int ownerId;
private int upgradedLevel; private int upgradedLevel;
private int investedMoney; private int investedMoney;
private string title; private string title;
private string description; private string description;
public int GetSellPrice() public int GetSellPrice()
{ {
return Convert.ToInt32(Math.Round((double)this.InvestedMoney / (100 / 75.0))); return Convert.ToInt32(Math.Round((double)this.InvestedMoney / (100 / 75.0)));
} }
private void removeDorothyShoes(int Id) private void removeDorothyShoes(int Id)
{ {
if (Id == -1) if (Id == -1)
return; return;
if(GameServer.IsUserOnline(Id)) if(GameServer.IsUserOnline(Id))
{ {
User user = GameServer.GetUserById(Id); User user = GameServer.GetUserById(Id);
user.OwnedRanch = null; user.OwnedRanch = null;
InventoryItem items = user.Inventory.GetItemByItemId(Item.DorothyShoes); InventoryItem items = user.Inventory.GetItemByItemId(Item.DorothyShoes);
foreach (ItemInstance itm in items.ItemInstances) foreach (ItemInstance itm in items.ItemInstances)
{ {
user.Inventory.Remove(itm); user.Inventory.Remove(itm);
} }
} }
else else
{ {
Database.RemoveAllItemTypesFromPlayerInventory(this.Id, Item.DorothyShoes); Database.RemoveAllItemTypesFromPlayerInventory(this.Id, Item.DorothyShoes);
} }
} }
private void deleteRanch() private void deleteRanch()
{ {
Database.DeleteRanchOwner(this.Id); Database.DeleteRanchOwner(this.Id);
removeDorothyShoes(this.ownerId); removeDorothyShoes(this.ownerId);
resetRanch(); resetRanch();
} }
private void resetRanch() private void resetRanch()
{ {
title = ""; title = "";
description = ""; description = "";
investedMoney = 0; investedMoney = 0;
upgradedLevel = 0; upgradedLevel = 0;
ownerId = -1; ownerId = -1;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
buildings[i] = null; buildings[i] = null;
} }
public int OwnerId public int OwnerId
{ {
get get
{ {
if(ownerId != -1) if(ownerId != -1)
{ {
if (ConfigReader.AllUsersSubbed || Database.GetUserAdmin(ownerId)) if (ConfigReader.AllUsersSubbed || Database.IsUserAdmin(ownerId))
return ownerId; return ownerId;
int subExp = Database.GetUserSubscriptionExpireDate(ownerId); int subExp = Database.GetUserSubscriptionExpireDate(ownerId);
DateTime expTime = Helper.UnixTimeStampToDateTime(subExp); DateTime expTime = Helper.UnixTimeStampToDateTime(subExp);
if ((DateTime.UtcNow.Date - expTime.Date).Days >= 30) if ((DateTime.UtcNow.Date - expTime.Date).Days >= 30)
{ {
int price = GetSellPrice(); int price = GetSellPrice();
try try
{ {
checked checked
{ {
Database.SetPlayerMoney(Database.GetPlayerMoney(ownerId) + price, ownerId); Database.SetPlayerMoney(Database.GetPlayerMoney(ownerId) + price, ownerId);
} }
} }
catch (OverflowException) catch (OverflowException)
{ {
Database.SetPlayerMoney(2147483647, ownerId);; Database.SetPlayerMoney(2147483647, ownerId);;
} }
Database.AddMessageToQueue(ownerId, Messages.FormatRanchForcefullySoldMessage(price)); Database.AddMessageToQueue(ownerId, Messages.FormatRanchForcefullySoldMessage(price));
deleteRanch(); deleteRanch();
return -1; return -1;
} }
} }
return ownerId; return ownerId;
} }
set set
{ {
if (value == -1) if (value == -1)
{ {
deleteRanch(); deleteRanch();
} }
else else
{ {
if (Database.IsRanchOwned(this.Id)) if(Database.IsRanchOwned(this.Id))
{ {
Database.SetRanchOwner(this.Id, ownerId); Database.SetRanchOwner(this.Id, ownerId);
removeDorothyShoes(ownerId); removeDorothyShoes(ownerId);
} }
else else
{ {
resetRanch(); resetRanch();
Database.AddRanch(this.Id, value, "", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Database.AddRanch(this.Id, value, "", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
} }
} }
if (GameServer.IsUserOnline(value)) ownerId = value;
{ }
User user = GameServer.GetUserById(value); }
user.OwnedRanch = this;
user.Inventory.AddIgnoringFull(new ItemInstance(Item.DorothyShoes)); public int UpgradedLevel
} {
else get
{ {
Database.AddItemToInventory(value, new ItemInstance(Item.DorothyShoes)); return upgradedLevel;
} }
set
ownerId = value; {
} upgradedLevel = value;
} Database.SetRanchUpgradeLevel(Id, value);
}
public int UpgradedLevel }
{ public int InvestedMoney
get {
{ get
return upgradedLevel; {
} return investedMoney;
set }
{ set
upgradedLevel = value; {
Database.SetRanchUpgradeLevel(Id, value); investedMoney = value;
} Database.SetRanchInvestment(Id, value);
} }
public int InvestedMoney }
{ public string Title
get {
{ get
return investedMoney; {
} return title;
set }
{ set
investedMoney = value; {
Database.SetRanchInvestment(Id, value); title = value.Trim();
} Database.SetRanchTitle(Id, title);
} }
public string Title }
{ public string Description
get {
{ get
return title; {
} return description;
set }
{ set
title = value.Trim(); {
Database.SetRanchTitle(Id, title); description = value.Trim();
} Database.SetRanchDescription(Id, value);
} }
public string Description }
{
get
{ private RanchBuilding[] buildings = new RanchBuilding[16];
return description; public int GetBuildingCount(int buildingId)
} {
set int count = 0;
{ foreach(RanchBuilding building in buildings)
description = value.Trim(); {
Database.SetRanchDescription(Id, value); if(building != null)
} if (building.Id == buildingId)
} count++;
}
return count;
private RanchBuilding[] buildings = new RanchBuilding[16]; }
public int GetBuildingCount(int buildingId) private void updateBuildings()
{ {
int count = 0; if (buildings[0] != null)
foreach(RanchBuilding building in buildings) Database.SetRanchBuilding1(this.Id, buildings[0].Id);
{ else
if(building != null) Database.SetRanchBuilding1(this.Id, 0);
if (building.Id == buildingId) if (buildings[1] != null)
count++; Database.SetRanchBuilding2(this.Id, buildings[1].Id);
} else
return count; Database.SetRanchBuilding2(this.Id, 0);
} if (buildings[2] != null)
private void updateBuildings() Database.SetRanchBuilding3(this.Id, buildings[2].Id);
{ else
if (buildings[0] != null) Database.SetRanchBuilding3(this.Id, 0);
Database.SetRanchBuilding1(this.Id, buildings[0].Id); if (buildings[3] != null)
else Database.SetRanchBuilding4(this.Id, buildings[3].Id);
Database.SetRanchBuilding1(this.Id, 0); else
if (buildings[1] != null) Database.SetRanchBuilding4(this.Id, 0);
Database.SetRanchBuilding2(this.Id, buildings[1].Id); if (buildings[4] != null)
else Database.SetRanchBuilding5(this.Id, buildings[4].Id);
Database.SetRanchBuilding2(this.Id, 0); else
if (buildings[2] != null) Database.SetRanchBuilding5(this.Id, 0);
Database.SetRanchBuilding3(this.Id, buildings[2].Id); if (buildings[5] != null)
else Database.SetRanchBuilding6(this.Id, buildings[5].Id);
Database.SetRanchBuilding3(this.Id, 0); else
if (buildings[3] != null) Database.SetRanchBuilding6(this.Id, 0);
Database.SetRanchBuilding4(this.Id, buildings[3].Id); if (buildings[6] != null)
else Database.SetRanchBuilding7(this.Id, buildings[6].Id);
Database.SetRanchBuilding4(this.Id, 0); else
if (buildings[4] != null) Database.SetRanchBuilding7(this.Id, 0);
Database.SetRanchBuilding5(this.Id, buildings[4].Id); if (buildings[7] != null)
else Database.SetRanchBuilding8(this.Id, buildings[7].Id);
Database.SetRanchBuilding5(this.Id, 0); else
if (buildings[5] != null) Database.SetRanchBuilding8(this.Id, 0);
Database.SetRanchBuilding6(this.Id, buildings[5].Id); if (buildings[8] != null)
else Database.SetRanchBuilding9(this.Id, buildings[8].Id);
Database.SetRanchBuilding6(this.Id, 0); else
if (buildings[6] != null) Database.SetRanchBuilding9(this.Id, 0);
Database.SetRanchBuilding7(this.Id, buildings[6].Id); if (buildings[9] != null)
else Database.SetRanchBuilding10(this.Id, buildings[9].Id);
Database.SetRanchBuilding7(this.Id, 0); else
if (buildings[7] != null) Database.SetRanchBuilding10(this.Id, 0);
Database.SetRanchBuilding8(this.Id, buildings[7].Id); if (buildings[10] != null)
else Database.SetRanchBuilding11(this.Id, buildings[10].Id);
Database.SetRanchBuilding8(this.Id, 0); else
if (buildings[8] != null) Database.SetRanchBuilding11(this.Id, 0);
Database.SetRanchBuilding9(this.Id, buildings[8].Id); if (buildings[11] != null)
else Database.SetRanchBuilding12(this.Id, buildings[11].Id);
Database.SetRanchBuilding9(this.Id, 0); else
if (buildings[9] != null) Database.SetRanchBuilding12(this.Id, 0);
Database.SetRanchBuilding10(this.Id, buildings[9].Id); if (buildings[12] != null)
else Database.SetRanchBuilding13(this.Id, buildings[12].Id);
Database.SetRanchBuilding10(this.Id, 0); else
if (buildings[10] != null) Database.SetRanchBuilding13(this.Id, 0);
Database.SetRanchBuilding11(this.Id, buildings[10].Id); if (buildings[13] != null)
else Database.SetRanchBuilding14(this.Id, buildings[13].Id);
Database.SetRanchBuilding11(this.Id, 0); else
if (buildings[11] != null) Database.SetRanchBuilding14(this.Id, 0);
Database.SetRanchBuilding12(this.Id, buildings[11].Id); if (buildings[14] != null)
else Database.SetRanchBuilding15(this.Id, buildings[14].Id);
Database.SetRanchBuilding12(this.Id, 0); else
if (buildings[12] != null) Database.SetRanchBuilding15(this.Id, 0);
Database.SetRanchBuilding13(this.Id, buildings[12].Id); if (buildings[15] != null)
else Database.SetRanchBuilding16(this.Id, buildings[15].Id);
Database.SetRanchBuilding13(this.Id, 0); else
if (buildings[13] != null) Database.SetRanchBuilding16(this.Id, 0);
Database.SetRanchBuilding14(this.Id, buildings[13].Id); }
else public RanchBuilding GetBuilding(int buildingId)
Database.SetRanchBuilding14(this.Id, 0); {
if (buildings[14] != null) if (buildingId < 0)
Database.SetRanchBuilding15(this.Id, buildings[14].Id); return null;
else
Database.SetRanchBuilding15(this.Id, 0); if (buildingId >= buildings.Length)
if (buildings[15] != null) return null;
Database.SetRanchBuilding16(this.Id, buildings[15].Id);
else return buildings[buildingId];
Database.SetRanchBuilding16(this.Id, 0); }
} public void SetBuilding(int buildingId, RanchBuilding value)
public RanchBuilding GetBuilding(int buildingId) {
{ buildings[buildingId] = value;
if (buildingId < 0) updateBuildings();
return null; }
if (buildingId >= buildings.Length)
return null; public string GetSwf(bool mine)
{
return buildings[buildingId]; string swf = "ranchviewer.swf?H=" + (upgradedLevel+1).ToString();
} for(int i = 0; i < buildings.Length; i++)
public void SetBuilding(int buildingId, RanchBuilding value) {
{ swf += "&B" + (i+1).ToString() + "=";
buildings[buildingId] = value; if (buildings[i] != null)
updateBuildings(); {
} swf += buildings[i].Id.ToString();
}
}
public string GetSwf(bool mine) if (mine)
{ swf += "&MINE=1";
string swf = "ranchviewer.swf?H=" + (upgradedLevel+1).ToString(); return swf;
for(int i = 0; i < buildings.Length; i++) }
{
swf += "&B" + (i+1).ToString() + "=";
if (buildings[i] != null) public Ranch(int x, int y, int id, int value)
{ {
swf += buildings[i].Id.ToString(); X = x;
} Y = y;
} Id = id;
if (mine) Value = value;
swf += "&MINE=1"; title = "";
return swf; description = "";
} upgradedLevel = 0;
ownerId = -1;
investedMoney = 0;
public Ranch(int x, int y, int id, int value) for (int i = 0; i < 16; i++)
{ buildings[i] = null;
X = x; bool owned = Database.IsRanchOwned(id);
Y = y; if (owned)
Id = id; {
Value = value; upgradedLevel = Database.GetRanchUpgradeLevel(id);
title = ""; title = Database.GetRanchTitle(id);
description = ""; description = Database.GetRanchDescription(id);
upgradedLevel = 0; ownerId = Database.GetRanchOwner(id);
ownerId = -1; int b1 = Database.GetRanchBuilding1(id);
investedMoney = 0; int b2 = Database.GetRanchBuilding2(id);
for (int i = 0; i < 16; i++) int b3 = Database.GetRanchBuilding3(id);
buildings[i] = null; int b4 = Database.GetRanchBuilding4(id);
bool owned = Database.IsRanchOwned(id); int b5 = Database.GetRanchBuilding5(id);
if (owned) int b6 = Database.GetRanchBuilding6(id);
{ int b7 = Database.GetRanchBuilding7(id);
upgradedLevel = Database.GetRanchUpgradeLevel(id); int b8 = Database.GetRanchBuilding8(id);
title = Database.GetRanchTitle(id); int b9 = Database.GetRanchBuilding9(id);
description = Database.GetRanchDescription(id); int b10 = Database.GetRanchBuilding10(id);
ownerId = Database.GetRanchOwner(id); int b11 = Database.GetRanchBuilding11(id);
int b1 = Database.GetRanchBuilding1(id); int b12 = Database.GetRanchBuilding12(id);
int b2 = Database.GetRanchBuilding2(id); int b13 = Database.GetRanchBuilding13(id);
int b3 = Database.GetRanchBuilding3(id); int b14 = Database.GetRanchBuilding14(id);
int b4 = Database.GetRanchBuilding4(id); int b15 = Database.GetRanchBuilding15(id);
int b5 = Database.GetRanchBuilding5(id); int b16 = Database.GetRanchBuilding16(id);
int b6 = Database.GetRanchBuilding6(id);
int b7 = Database.GetRanchBuilding7(id); if (RanchBuilding.RanchBuildingExists(b1))
int b8 = Database.GetRanchBuilding8(id); buildings[0] = RanchBuilding.GetRanchBuildingById(b1);
int b9 = Database.GetRanchBuilding9(id); if (RanchBuilding.RanchBuildingExists(b2))
int b10 = Database.GetRanchBuilding10(id); buildings[1] = RanchBuilding.GetRanchBuildingById(b2);
int b11 = Database.GetRanchBuilding11(id); if (RanchBuilding.RanchBuildingExists(b3))
int b12 = Database.GetRanchBuilding12(id); buildings[2] = RanchBuilding.GetRanchBuildingById(b3);
int b13 = Database.GetRanchBuilding13(id); if (RanchBuilding.RanchBuildingExists(b4))
int b14 = Database.GetRanchBuilding14(id); buildings[3] = RanchBuilding.GetRanchBuildingById(b4);
int b15 = Database.GetRanchBuilding15(id); if (RanchBuilding.RanchBuildingExists(b5))
int b16 = Database.GetRanchBuilding16(id); buildings[4] = RanchBuilding.GetRanchBuildingById(b5);
if (RanchBuilding.RanchBuildingExists(b6))
if (RanchBuilding.RanchBuildingExists(b1)) buildings[5] = RanchBuilding.GetRanchBuildingById(b6);
buildings[0] = RanchBuilding.GetRanchBuildingById(b1); if (RanchBuilding.RanchBuildingExists(b7))
if (RanchBuilding.RanchBuildingExists(b2)) buildings[6] = RanchBuilding.GetRanchBuildingById(b7);
buildings[1] = RanchBuilding.GetRanchBuildingById(b2); if (RanchBuilding.RanchBuildingExists(b8))
if (RanchBuilding.RanchBuildingExists(b3)) buildings[7] = RanchBuilding.GetRanchBuildingById(b8);
buildings[2] = RanchBuilding.GetRanchBuildingById(b3); if (RanchBuilding.RanchBuildingExists(b9))
if (RanchBuilding.RanchBuildingExists(b4)) buildings[8] = RanchBuilding.GetRanchBuildingById(b9);
buildings[3] = RanchBuilding.GetRanchBuildingById(b4); if (RanchBuilding.RanchBuildingExists(b10))
if (RanchBuilding.RanchBuildingExists(b5)) buildings[9] = RanchBuilding.GetRanchBuildingById(b10);
buildings[4] = RanchBuilding.GetRanchBuildingById(b5); if (RanchBuilding.RanchBuildingExists(b11))
if (RanchBuilding.RanchBuildingExists(b6)) buildings[10] = RanchBuilding.GetRanchBuildingById(b11);
buildings[5] = RanchBuilding.GetRanchBuildingById(b6); if (RanchBuilding.RanchBuildingExists(b12))
if (RanchBuilding.RanchBuildingExists(b7)) buildings[11] = RanchBuilding.GetRanchBuildingById(b12);
buildings[6] = RanchBuilding.GetRanchBuildingById(b7); if (RanchBuilding.RanchBuildingExists(b13))
if (RanchBuilding.RanchBuildingExists(b8)) buildings[12] = RanchBuilding.GetRanchBuildingById(b13);
buildings[7] = RanchBuilding.GetRanchBuildingById(b8); if (RanchBuilding.RanchBuildingExists(b14))
if (RanchBuilding.RanchBuildingExists(b9)) buildings[13] = RanchBuilding.GetRanchBuildingById(b14);
buildings[8] = RanchBuilding.GetRanchBuildingById(b9); if (RanchBuilding.RanchBuildingExists(b15))
if (RanchBuilding.RanchBuildingExists(b10)) buildings[14] = RanchBuilding.GetRanchBuildingById(b15);
buildings[9] = RanchBuilding.GetRanchBuildingById(b10); if (RanchBuilding.RanchBuildingExists(b16))
if (RanchBuilding.RanchBuildingExists(b11)) buildings[15] = RanchBuilding.GetRanchBuildingById(b16);
buildings[10] = RanchBuilding.GetRanchBuildingById(b11);
if (RanchBuilding.RanchBuildingExists(b12))
buildings[11] = RanchBuilding.GetRanchBuildingById(b12); InvestedMoney = Database.GetRanchInvestment(id);
if (RanchBuilding.RanchBuildingExists(b13)) }
buildings[12] = RanchBuilding.GetRanchBuildingById(b13); }
if (RanchBuilding.RanchBuildingExists(b14))
buildings[13] = RanchBuilding.GetRanchBuildingById(b14); public RanchUpgrade GetRanchUpgrade()
if (RanchBuilding.RanchBuildingExists(b15)) {
buildings[14] = RanchBuilding.GetRanchBuildingById(b15); return RanchUpgrade.GetRanchUpgradeById(this.upgradedLevel + 1);
if (RanchBuilding.RanchBuildingExists(b16)) }
buildings[15] = RanchBuilding.GetRanchBuildingById(b16); public static bool IsRanchHere(int x, int y)
{
foreach (Ranch ranch in Ranches)
InvestedMoney = Database.GetRanchInvestment(id); {
} if (ranch.X == x && ranch.Y == y)
} return true;
}
public RanchUpgrade GetRanchUpgrade() return false;
{ }
return RanchUpgrade.GetRanchUpgradeById(this.upgradedLevel + 1); public static bool RanchExists(int ranchId)
} {
public static bool IsRanchHere(int x, int y) foreach (Ranch ranch in Ranches)
{ {
foreach (Ranch ranch in Ranches) if (ranch.Id == ranchId)
{ return true;
if (ranch.X == x && ranch.Y == y) }
return true; return false;
} }
return false; public static Ranch GetRanchById(int ranchId)
} {
public static bool RanchExists(int ranchId) foreach (Ranch ranch in Ranches)
{ {
foreach (Ranch ranch in Ranches) if (ranch.Id == ranchId)
{ return ranch;
if (ranch.Id == ranchId) }
return true; throw new KeyNotFoundException("No Ranch with id " + ranchId);
} }
return false; public static Ranch GetRanchAt(int x, int y)
} {
public static Ranch GetRanchById(int ranchId) foreach(Ranch ranch in Ranches)
{ {
foreach (Ranch ranch in Ranches) if (ranch.X == x && ranch.Y == y)
{ return ranch;
if (ranch.Id == ranchId) }
return ranch; throw new KeyNotFoundException("No Ranch found at x" + x + " y" + y);
} }
throw new KeyNotFoundException("No Ranch with id " + ranchId);
} public static bool IsRanchOwned(int playerId)
public static Ranch GetRanchAt(int x, int y) {
{ foreach (Ranch ranch in Ranches)
foreach(Ranch ranch in Ranches) {
{ if (ranch.OwnerId == playerId)
if (ranch.X == x && ranch.Y == y) {
return ranch; return true;
} }
throw new KeyNotFoundException("No Ranch found at x" + x + " y" + y); }
} return false;
}
public static bool GetOwnedRanch(int playerId) public static Ranch GetRanchOwnedBy(int playerId)
{ {
foreach (Ranch ranch in Ranches) foreach(Ranch ranch in Ranches)
{ {
if (ranch.OwnerId == playerId) if(ranch.OwnerId == playerId)
{ {
return true; return ranch;
} }
} }
return false; throw new KeyNotFoundException("Player " + playerId + " does not own a ranch.");
} }
public static Ranch GetRanchOwnedBy(int playerId) }
{ }
foreach(Ranch ranch in Ranches)
{
if(ranch.OwnerId == playerId)
{
return ranch;
}
}
throw new KeyNotFoundException("Player " + playerId + " does not own a ranch.");
}
}
}

View file

@ -32,7 +32,7 @@ namespace HISP.Game
Database.CompleteRiddle(this.Id, user.Id); Database.CompleteRiddle(this.Id, user.Id);
byte[] riddleAnswerCorrectPacket = PacketBuilder.CreateChat(Messages.FormatRiddlerAnswerCorrect(this.Reason), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] riddleAnswerCorrectPacket = PacketBuilder.CreateChat(Messages.FormatRiddlerAnswerCorrect(this.Reason), PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(riddleAnswerCorrectPacket); user.LoggedinClient.SendPacket(riddleAnswerCorrectPacket);
user.AddMoney(10000); user.AddMoney(10000);
if(HasCompletedAllRiddles(user)) if(HasCompletedAllRiddles(user))
@ -42,7 +42,7 @@ namespace HISP.Game
public void AnswerFail(User user) public void AnswerFail(User user)
{ {
byte[] riddleIncorrect = PacketBuilder.CreateChat(Messages.RiddlerIncorrectAnswer, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] riddleIncorrect = PacketBuilder.CreateChat(Messages.RiddlerIncorrectAnswer, PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(riddleIncorrect); user.LoggedinClient.SendPacket(riddleIncorrect);
} }
public bool CheckAnswer(User user, string txt) public bool CheckAnswer(User user, string txt)

View file

@ -38,7 +38,7 @@ namespace HISP.Game.Services
if(BidUser.HorseInventory.HorseList.Length >= BidUser.MaxHorses) if(BidUser.HorseInventory.HorseList.Length >= BidUser.MaxHorses)
{ {
byte[] tooManyHorses = PacketBuilder.CreateChat(Messages.AuctionYouHaveTooManyHorses, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tooManyHorses = PacketBuilder.CreateChat(Messages.AuctionYouHaveTooManyHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
BidUser.Client.SendPacket(tooManyHorses); BidUser.LoggedinClient.SendPacket(tooManyHorses);
return; return;
} }
@ -47,7 +47,7 @@ namespace HISP.Game.Services
if(BidAmount >= MAX_BID) if(BidAmount >= MAX_BID)
{ {
byte[] maxBidReached = PacketBuilder.CreateChat(Messages.AuctionBidMax, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] maxBidReached = PacketBuilder.CreateChat(Messages.AuctionBidMax, PacketBuilder.CHAT_BOTTOM_RIGHT);
BidUser.Client.SendPacket(maxBidReached); BidUser.LoggedinClient.SendPacket(maxBidReached);
return; return;
} }
@ -56,7 +56,7 @@ namespace HISP.Game.Services
{ {
byte[] cantAffordBid = PacketBuilder.CreateChat(Messages.AuctionCantAffordBid, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] cantAffordBid = PacketBuilder.CreateChat(Messages.AuctionCantAffordBid, PacketBuilder.CHAT_BOTTOM_RIGHT);
BidUser.Client.SendPacket(cantAffordBid); BidUser.LoggedinClient.SendPacket(cantAffordBid);
return; return;
} }
@ -78,7 +78,7 @@ namespace HISP.Game.Services
if(entry.RandomId != AuctionItem.RandomId && entry.HighestBidder == BidUser.Id) if(entry.RandomId != AuctionItem.RandomId && entry.HighestBidder == BidUser.Id)
{ {
byte[] cantWinTooMuch = PacketBuilder.CreateChat(Messages.AuctionOnlyOneWinningBidAllowed, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] cantWinTooMuch = PacketBuilder.CreateChat(Messages.AuctionOnlyOneWinningBidAllowed, PacketBuilder.CHAT_BOTTOM_RIGHT);
BidUser.Client.SendPacket(cantWinTooMuch); BidUser.LoggedinClient.SendPacket(cantWinTooMuch);
return; return;
} }
} }
@ -92,7 +92,7 @@ namespace HISP.Game.Services
{ {
User oldBidder = GameServer.GetUserById(AuctionItem.HighestBidder); User oldBidder = GameServer.GetUserById(AuctionItem.HighestBidder);
byte[] outbidMessage = PacketBuilder.CreateChat(Messages.FormatAuctionYourOutbidBy(BidUser.Username, AuctionItem.HighestBid), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] outbidMessage = PacketBuilder.CreateChat(Messages.FormatAuctionYourOutbidBy(BidUser.Username, AuctionItem.HighestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
oldBidder.Client.SendPacket(outbidMessage); oldBidder.LoggedinClient.SendPacket(outbidMessage);
} }
} }
@ -105,7 +105,7 @@ namespace HISP.Game.Services
} }
byte[] bidPlacedMsg = PacketBuilder.CreateChat(yourBidRaisedTo, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] bidPlacedMsg = PacketBuilder.CreateChat(yourBidRaisedTo, PacketBuilder.CHAT_BOTTOM_RIGHT);
BidUser.Client.SendPacket(bidPlacedMsg); BidUser.LoggedinClient.SendPacket(bidPlacedMsg);
} }
@ -152,7 +152,7 @@ namespace HISP.Game.Services
User auctionRunner = GameServer.GetUserById(highestBidder); User auctionRunner = GameServer.GetUserById(highestBidder);
auctionRunner.HorseInventory.UnHide(Horse.RandomId); auctionRunner.HorseInventory.UnHide(Horse.RandomId);
byte[] notSold = PacketBuilder.CreateChat(Messages.AuctionNoHorseBrought, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] notSold = PacketBuilder.CreateChat(Messages.AuctionNoHorseBrought, PacketBuilder.CHAT_BOTTOM_RIGHT);
auctionRunner.Client.SendPacket(notSold); auctionRunner.LoggedinClient.SendPacket(notSold);
} }
return; return;
} }
@ -162,7 +162,7 @@ namespace HISP.Game.Services
{ {
User userWon = GameServer.GetUserById(highestBidder); User userWon = GameServer.GetUserById(highestBidder);
byte[] wonAuction = PacketBuilder.CreateChat(Messages.FormatAuctionBroughtHorse(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] wonAuction = PacketBuilder.CreateChat(Messages.FormatAuctionBroughtHorse(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
userWon.Client.SendPacket(wonAuction); userWon.LoggedinClient.SendPacket(wonAuction);
userWon.TakeMoney(highestBid); userWon.TakeMoney(highestBid);
userWon.HorseInventory.AddHorse(Horse, false); userWon.HorseInventory.AddHorse(Horse, false);
} }
@ -175,7 +175,7 @@ namespace HISP.Game.Services
{ {
User userSold = GameServer.GetUserById(OwnerId); User userSold = GameServer.GetUserById(OwnerId);
byte[] horseSold = PacketBuilder.CreateChat(Messages.FormatAuctionHorseSold(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] horseSold = PacketBuilder.CreateChat(Messages.FormatAuctionHorseSold(highestBid), PacketBuilder.CHAT_BOTTOM_RIGHT);
userSold.Client.SendPacket(horseSold); userSold.LoggedinClient.SendPacket(horseSold);
userSold.AddMoney(highestBid); userSold.AddMoney(highestBid);
userSold.HorseInventory.DeleteHorse(Horse, false); userSold.HorseInventory.DeleteHorse(Horse, false);
} }

View file

@ -24,7 +24,7 @@ namespace HISP.Game.Services
if (Item.ItemIdExist(stock)) if (Item.ItemIdExist(stock))
this.Inventory.AddInfinity(Item.GetItemById(stock)); this.Inventory.AddInfinity(Item.GetItemById(stock));
else else
Logger.WarnPrint("Item ID: " + stock + " doesn't exist, but shop " + id + " stocks it"); Logger.WarnPrint("Item ID: " + stock + " Does not exist.");
} }
ItemInstance[] instances = Database.GetShopInventory(this.Id); ItemInstance[] instances = Database.GetShopInventory(this.Id);

View file

@ -156,7 +156,7 @@ namespace HISP.Game.SwfModules
foreach(int room in rooms) foreach(int room in rooms)
{ {
Logger.InfoPrint("Loading Poetry room: " + room.ToString()); Logger.InfoPrint("Loading poetry room: " + room.ToString());
poetryRooms.Add(getPoetryRoom(room)); poetryRooms.Add(getPoetryRoom(room));
if (!Database.LastPlayerExist("P" + room)) if (!Database.LastPlayerExist("P" + room))
Database.AddLastPlayer("P" + room, -1); Database.AddLastPlayer("P" + room, -1);

View file

@ -139,15 +139,15 @@ namespace HISP.Game
Database.DeleteTreasure(this.RandomId); Database.DeleteTreasure(this.RandomId);
GenerateTreasure(); GenerateTreasure();
byte[] MovementPacket = PacketBuilder.CreateMovement(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true); byte[] MovementPacket = PacketBuilder.CreateMovementPacket(user.X, user.Y, user.CharacterId, user.Facing, PacketBuilder.DIRECTION_TELEPORT, true);
user.Client.SendPacket(MovementPacket); user.LoggedinClient.SendPacket(MovementPacket);
user.AddMoney(Value); user.AddMoney(Value);
if(this.Type == "BURIED") if(this.Type == "BURIED")
{ {
byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPirateTreasure(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPirateTreasure(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(treasureReceivedPacket); user.LoggedinClient.SendPacket(treasureReceivedPacket);
user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PirateTreasure).Count++; user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PirateTreasure).Count++;
if(user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PirateTreasure).Count >= 10) if(user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PirateTreasure).Count >= 10)
@ -159,7 +159,7 @@ namespace HISP.Game
else if(this.Type == "RAINBOW") else if(this.Type == "RAINBOW")
{ {
byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPotOfGold(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] treasureReceivedPacket = PacketBuilder.CreateChat(Messages.FormatPotOfGold(this.Value), PacketBuilder.CHAT_BOTTOM_RIGHT);
user.Client.SendPacket(treasureReceivedPacket); user.LoggedinClient.SendPacket(treasureReceivedPacket);
user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PotOfGold).Count++; user.TrackedItems.GetTrackedItem(Tracking.TrackableItem.PotOfGold).Count++;

View file

@ -86,8 +86,8 @@ namespace HISP.Game
byte[] youHaveInvited = PacketBuilder.CreateChat(Messages.Format2PlayerYouInvited(inviting.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] youHaveInvited = PacketBuilder.CreateChat(Messages.Format2PlayerYouInvited(inviting.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
byte[] yourInvited = PacketBuilder.CreateChat(Messages.Format2PlayerYourInvited(invitee.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] yourInvited = PacketBuilder.CreateChat(Messages.Format2PlayerYourInvited(invitee.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
Invitee.Client.SendPacket(youHaveInvited); Invitee.LoggedinClient.SendPacket(youHaveInvited);
Inviting.Client.SendPacket(yourInvited); Inviting.LoggedinClient.SendPacket(yourInvited);
deleteTimer = new Timer(new TimerCallback(deleteTwoPlayer), null, 2 * 60 * 1000, 2 * 60 * 1000); deleteTimer = new Timer(new TimerCallback(deleteTwoPlayer), null, 2 * 60 * 1000, 2 * 60 * 1000);
@ -119,15 +119,15 @@ namespace HISP.Game
private void update() private void update()
{ {
GameServer.UpdateArea(Invitee.Client); GameServer.UpdateArea(Invitee.LoggedinClient);
GameServer.UpdateArea(Inviting.Client); GameServer.UpdateArea(Inviting.LoggedinClient);
} }
private void updateOthers() private void updateOthers()
{ {
foreach(User user in this.Multiroom.JoinedUsers) foreach(User user in this.Multiroom.JoinedUsers)
if (IsPlayerInGame(user)) if (IsPlayerInGame(user))
if(user.Id != Invitee.Id && user.Id != Inviting.Id) if(user.Id != Invitee.Id && user.Id != Inviting.Id)
GameServer.UpdateArea(user.Client); GameServer.UpdateArea(user.LoggedinClient);
} }
public void UpdateAll() public void UpdateAll()
@ -182,14 +182,14 @@ namespace HISP.Game
byte[] startingUpGameInvitee = PacketBuilder.CreateChat(Messages.Format2PlayerStartingGame(Inviting.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] startingUpGameInvitee = PacketBuilder.CreateChat(Messages.Format2PlayerStartingGame(Inviting.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
byte[] startingUpGameInvited = PacketBuilder.CreateChat(Messages.Format2PlayerStartingGame(Invitee.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] startingUpGameInvited = PacketBuilder.CreateChat(Messages.Format2PlayerStartingGame(Invitee.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
Invitee.Client.SendPacket(startingUpGameInvitee); Invitee.LoggedinClient.SendPacket(startingUpGameInvitee);
Inviting.Client.SendPacket(startingUpGameInvited); Inviting.LoggedinClient.SendPacket(startingUpGameInvited);
byte[] loadSwfInvitee = PacketBuilder.CreateSwfModule(buildSwf(2), PacketBuilder.PACKET_SWF_MODULE_FORCE); byte[] loadSwfInvitee = PacketBuilder.CreateSwfModule(buildSwf(2), PacketBuilder.PACKET_SWF_MODULE_FORCE);
byte[] loadSwfInvited = PacketBuilder.CreateSwfModule(buildSwf(1), PacketBuilder.PACKET_SWF_MODULE_FORCE); byte[] loadSwfInvited = PacketBuilder.CreateSwfModule(buildSwf(1), PacketBuilder.PACKET_SWF_MODULE_FORCE);
Invitee.Client.SendPacket(loadSwfInvitee); Invitee.LoggedinClient.SendPacket(loadSwfInvitee);
Inviting.Client.SendPacket(loadSwfInvited); Inviting.LoggedinClient.SendPacket(loadSwfInvited);
} }
} }
@ -207,13 +207,13 @@ namespace HISP.Game
if (userWhoClosed.Id == Inviting.Id) if (userWhoClosed.Id == Inviting.Id)
{ {
Invitee.Client.SendPacket(gameClosedByOther); Invitee.LoggedinClient.SendPacket(gameClosedByOther);
Inviting.Client.SendPacket(gameClosed); Inviting.LoggedinClient.SendPacket(gameClosed);
} }
else if (userWhoClosed.Id == Invitee.Id) else if (userWhoClosed.Id == Invitee.Id)
{ {
Invitee.Client.SendPacket(gameClosed); Invitee.LoggedinClient.SendPacket(gameClosed);
Inviting.Client.SendPacket(gameClosedByOther); Inviting.LoggedinClient.SendPacket(gameClosedByOther);
} }
} }

View file

@ -74,7 +74,7 @@ namespace HISP.Game
Database.SetWeather(Name, value); Database.SetWeather(Name, value);
foreach(User user in GameServer.GetUsersInIsle(this,true,true)) foreach(User user in GameServer.GetUsersInIsle(this,true,true))
{ {
GameServer.UpdateWorld(user.Client); GameServer.UpdateWorld(user.LoggedinClient);
} }
} }
} }
@ -127,7 +127,7 @@ namespace HISP.Game
Database.SetWeather(Name, value); Database.SetWeather(Name, value);
foreach (User user in GameServer.GetUsersInTown(this, true, true)) foreach (User user in GameServer.GetUsersInTown(this, true, true))
{ {
GameServer.UpdateArea(user.Client); GameServer.UpdateArea(user.LoggedinClient);
} }
} }

View file

@ -28,9 +28,9 @@
</ContentWithTargetPath> </ContentWithTargetPath>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.4" /> <PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.7" />
<PackageReference Include="MySqlConnector" Version="2.2.5" /> <PackageReference Include="MySqlConnector" Version="2.1.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx"> <EmbeddedResource Update="Properties\Resources.resx">
@ -42,7 +42,7 @@
<GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType> <GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoWin32Manifest>true</NoWin32Manifest> <NoWin32Manifest>true</NoWin32Manifest>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent> <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
@ -57,13 +57,7 @@
<WarningLevel>3</WarningLevel> <WarningLevel>3</WarningLevel>
<NoWarn>1701;1702;2026;IL2026</NoWarn> <NoWarn>1701;1702;2026;IL2026</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<TrimMode>partial</TrimMode>
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
<TrimmerRemoveSymbols>true</TrimmerRemoveSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Windows|x86'">
<RuntimeIdentifier>win-x86</RuntimeIdentifier> <RuntimeIdentifier>win-x86</RuntimeIdentifier>
<Optimize>true</Optimize> <Optimize>true</Optimize>

View file

@ -1,100 +1,100 @@
using HISP.Server; using HISP.Server;
using HISP.Util; using HISP.Util;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace HISP.Player namespace HISP.Player
{ {
public class Award public class Award
{ {
public struct AwardEntry public struct AwardEntry
{ {
public int Id; public int Id;
public int Sort; public int Sort;
public string Title; public string Title;
public int IconId; public int IconId;
public int MoneyBonus; public int MoneyBonus;
public string CompletionText; public string CompletionText;
public string Description; public string Description;
} }
public static AwardEntry[] GlobalAwardList; public static AwardEntry[] GlobalAwardList;
public static AwardEntry GetAwardById(int id) public static AwardEntry GetAwardById(int id)
{ {
//99% fo the time this will work //99% fo the time this will work
try try
{ {
AwardEntry award = GlobalAwardList[id - 1]; AwardEntry award = GlobalAwardList[id - 1];
if (award.Id == id) if (award.Id == id)
return award; return award;
} }
catch (Exception) { }; catch (Exception) { };
// Incase it doesnt... // Incase it doesnt...
foreach(AwardEntry award in GlobalAwardList) foreach(AwardEntry award in GlobalAwardList)
{ {
if (award.Id == id) if (award.Id == id)
return award; return award;
} }
throw new KeyNotFoundException("Award ID " + id + " Does not exist."); throw new KeyNotFoundException("Award ID " + id + " Does not exist.");
} }
private ThreadSafeList<AwardEntry> awardsEarned; private ThreadSafeList<AwardEntry> awardsEarned;
private User baseUser; private User baseUser;
public AwardEntry[] AwardsEarned public AwardEntry[] AwardsEarned
{ {
get get
{ {
return awardsEarned.ToArray(); return awardsEarned.ToArray();
} }
} }
public bool HasAward(AwardEntry award) public bool HasAward(AwardEntry award)
{ {
foreach(AwardEntry awardEntry in AwardsEarned) foreach(AwardEntry awardEntry in AwardsEarned)
{ {
if (awardEntry.Id == award.Id) if (awardEntry.Id == award.Id)
return true; return true;
} }
return false; return false;
} }
public void AddAward(AwardEntry award,bool addToDatabase=true) public void AddAward(AwardEntry award,bool addToDatabase=true)
{ {
if (HasAward(award)) if (HasAward(award))
return; return;
if (addToDatabase) if (addToDatabase)
{ {
Database.AddAward(baseUser.Id, award.Id); Database.AddAward(baseUser.Id, award.Id);
baseUser.AddMoney(award.MoneyBonus); baseUser.AddMoney(award.MoneyBonus);
byte[] chatPacket = PacketBuilder.CreateChat(award.CompletionText, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] chatPacket = PacketBuilder.CreateChat(award.CompletionText, PacketBuilder.CHAT_BOTTOM_RIGHT);
baseUser.Client.SendPacket(chatPacket); baseUser.LoggedinClient.SendPacket(chatPacket);
} }
awardsEarned.Add(award); awardsEarned.Add(award);
} }
public Award(User user) public Award(User user)
{ {
baseUser = user; baseUser = user;
int[] awards = Database.GetAwards(user.Id); int[] awards = Database.GetAwards(user.Id);
awardsEarned = new ThreadSafeList<AwardEntry>(); awardsEarned = new ThreadSafeList<AwardEntry>();
foreach (int awardid in awards) foreach (int awardid in awards)
{ {
AddAward(GetAwardById(awardid), false); AddAward(GetAwardById(awardid), false);
} }
} }
} }
} }

View file

@ -62,8 +62,8 @@ namespace HISP.Player
baseUser.Facing = direction + (onHorse * 5); baseUser.Facing = direction + (onHorse * 5);
byte[] moveResponse = PacketBuilder.CreateMovement(baseUser.X, baseUser.Y, baseUser.CharacterId, baseUser.Facing, PacketBuilder.DIRECTION_NONE, false); byte[] moveResponse = PacketBuilder.CreateMovementPacket(baseUser.X, baseUser.Y, baseUser.CharacterId, baseUser.Facing, PacketBuilder.DIRECTION_NONE, false);
baseUser.Client.SendPacket(moveResponse); baseUser.LoggedinClient.SendPacket(moveResponse);
GameServer.UpdateUserFacingAndLocation(baseUser); GameServer.UpdateUserFacingAndLocation(baseUser);

View file

@ -77,19 +77,19 @@ namespace HISP.Player
if(baseUser.MuteBuddy) if(baseUser.MuteBuddy)
{ {
byte[] cantFriend = PacketBuilder.CreateChat(Messages.CantSendBuddyRequestWhileMuted, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] cantFriend = PacketBuilder.CreateChat(Messages.CantSendBuddyRequestWhileMuted, PacketBuilder.CHAT_BOTTOM_RIGHT);
baseUser.Client.SendPacket(cantFriend); baseUser.LoggedinClient.SendPacket(cantFriend);
return; return;
} }
else if(userToFriend.MuteBuddyRequests) else if(userToFriend.MuteBuddyRequests)
{ {
byte[] cantFriend = PacketBuilder.CreateChat(Messages.PlayerIgnoringAllBuddyRequests, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] cantFriend = PacketBuilder.CreateChat(Messages.PlayerIgnoringAllBuddyRequests, PacketBuilder.CHAT_BOTTOM_RIGHT);
baseUser.Client.SendPacket(cantFriend); baseUser.LoggedinClient.SendPacket(cantFriend);
return; return;
} }
else if(userToFriend.MutePlayer.IsUserMuted(userToFriend)) else if(userToFriend.MutePlayer.IsUserMuted(userToFriend))
{ {
byte[] cantFriend = PacketBuilder.CreateChat(Messages.PlayerIgnoringYourBuddyRequests, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] cantFriend = PacketBuilder.CreateChat(Messages.PlayerIgnoringYourBuddyRequests, PacketBuilder.CHAT_BOTTOM_RIGHT);
baseUser.Client.SendPacket(cantFriend); baseUser.LoggedinClient.SendPacket(cantFriend);
return; return;
} }
@ -102,23 +102,23 @@ namespace HISP.Player
byte[] nowFriendsMsg = PacketBuilder.CreateChat(Messages.FormatAddBuddyConfirmed(userToFriend.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] nowFriendsMsg = PacketBuilder.CreateChat(Messages.FormatAddBuddyConfirmed(userToFriend.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
byte[] nowFriendsOther = PacketBuilder.CreateChat(Messages.FormatAddBuddyConfirmed(baseUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] nowFriendsOther = PacketBuilder.CreateChat(Messages.FormatAddBuddyConfirmed(baseUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
userToFriend.Client.SendPacket(nowFriendsOther); userToFriend.LoggedinClient.SendPacket(nowFriendsOther);
baseUser.Client.SendPacket(nowFriendsMsg); baseUser.LoggedinClient.SendPacket(nowFriendsMsg);
if(!baseUser.MajorPriority) if(!baseUser.MajorPriority)
GameServer.UpdateArea(baseUser.Client); GameServer.UpdateArea(baseUser.LoggedinClient);
if (!userToFriend.MajorPriority) if (!userToFriend.MajorPriority)
GameServer.UpdateArea(userToFriend.Client); GameServer.UpdateArea(userToFriend.LoggedinClient);
} }
else else
{ {
baseUser.PendingBuddyRequestTo = userToFriend; baseUser.PendingBuddyRequestTo = userToFriend;
byte[] pendingMsg = PacketBuilder.CreateChat(Messages.AddBuddyPending, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] pendingMsg = PacketBuilder.CreateChat(Messages.AddBuddyPending, PacketBuilder.CHAT_BOTTOM_RIGHT);
byte[] pendingMsgOther = PacketBuilder.CreateChat(Messages.FormatAddBuddyPendingOther(baseUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] pendingMsgOther = PacketBuilder.CreateChat(Messages.FormatAddBuddyPendingOther(baseUser.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
baseUser.Client.SendPacket(pendingMsg); baseUser.LoggedinClient.SendPacket(pendingMsg);
if(!userToFriend.MuteBuddyRequests && !userToFriend.MuteAll) if(!userToFriend.MuteBuddyRequests && !userToFriend.MuteAll)
userToFriend.Client.SendPacket(pendingMsgOther); userToFriend.LoggedinClient.SendPacket(pendingMsgOther);
} }
} }

View file

@ -68,8 +68,8 @@ namespace HISP.Player
} }
byte[] rippedUpMessage = PacketBuilder.CreateChat(Messages.MailRippedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] rippedUpMessage = PacketBuilder.CreateChat(Messages.MailRippedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
baseUser.Client.SendPacket(rippedUpMessage); baseUser.LoggedinClient.SendPacket(rippedUpMessage);
GameServer.UpdateInventory(baseUser.Client); GameServer.UpdateInventory(baseUser.LoggedinClient);
} }
public void ReadAllMail() public void ReadAllMail()
@ -87,7 +87,7 @@ namespace HISP.Player
mails[i].Read = true; mails[i].Read = true;
} }
GameServer.UpdatePlayer(baseUser.Client); GameServer.UpdatePlayer(baseUser.LoggedinClient);
} }
public void AddMail(Mail mailMessage) public void AddMail(Mail mailMessage)
{ {

View file

@ -68,8 +68,8 @@ namespace HISP.Player
OtherTrade.Trader.PendingTradeTo = 0; OtherTrade.Trader.PendingTradeTo = 0;
OtherTrade.Trader.TradingWith = null; OtherTrade.Trader.TradingWith = null;
GameServer.UpdateArea(Trader.Client); GameServer.UpdateArea(Trader.LoggedinClient);
GameServer.UpdateArea(OtherTrade.Trader.Client); GameServer.UpdateArea(OtherTrade.Trader.LoggedinClient);
} }
public bool Fail = false; public bool Fail = false;
@ -84,7 +84,7 @@ namespace HISP.Player
if (MoneyOffered > 0 && OtherTrade.Trader.Money < 0) if (MoneyOffered > 0 && OtherTrade.Trader.Money < 0)
{ {
byte[] otherNegativeMoneyNotAllowed = PacketBuilder.CreateChat(Messages.TradeOtherPlayerHasNegativeMoney, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] otherNegativeMoneyNotAllowed = PacketBuilder.CreateChat(Messages.TradeOtherPlayerHasNegativeMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(otherNegativeMoneyNotAllowed); Trader.LoggedinClient.SendPacket(otherNegativeMoneyNotAllowed);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -93,7 +93,7 @@ namespace HISP.Player
if (OtherTrade.MoneyOffered > 0 && Trader.Money < 0) if (OtherTrade.MoneyOffered > 0 && Trader.Money < 0)
{ {
byte[] negativeMoneyNotAllowed = PacketBuilder.CreateChat(Messages.TradeYouHaveNegativeMoney, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] negativeMoneyNotAllowed = PacketBuilder.CreateChat(Messages.TradeYouHaveNegativeMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(negativeMoneyNotAllowed); Trader.LoggedinClient.SendPacket(negativeMoneyNotAllowed);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -102,7 +102,7 @@ namespace HISP.Player
if (OtherTrade.Trader.Bids.Length > 0) if (OtherTrade.Trader.Bids.Length > 0)
{ {
byte[] tradeNotAllowedWhileOtherBidding = PacketBuilder.CreateChat(Messages.TradeNotAllowedWhileOtherBidding, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeNotAllowedWhileOtherBidding = PacketBuilder.CreateChat(Messages.TradeNotAllowedWhileOtherBidding, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeNotAllowedWhileOtherBidding); Trader.LoggedinClient.SendPacket(tradeNotAllowedWhileOtherBidding);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -111,7 +111,7 @@ namespace HISP.Player
if (Trader.Bids.Length > 0) if (Trader.Bids.Length > 0)
{ {
byte[] tradeNotAllowedWhileBidding = PacketBuilder.CreateChat(Messages.TradeNotAllowedWhileBidding, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeNotAllowedWhileBidding = PacketBuilder.CreateChat(Messages.TradeNotAllowedWhileBidding, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeNotAllowedWhileBidding); Trader.LoggedinClient.SendPacket(tradeNotAllowedWhileBidding);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -120,7 +120,7 @@ namespace HISP.Player
if (MoneyOffered > 0 && OtherTrade.Trader.Money + MoneyOffered > 2100000000) if (MoneyOffered > 0 && OtherTrade.Trader.Money + MoneyOffered > 2100000000)
{ {
byte[] tradeOtherHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveOtherTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeOtherHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveOtherTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeOtherHasTooMuchMoney); Trader.LoggedinClient.SendPacket(tradeOtherHasTooMuchMoney);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -129,7 +129,7 @@ namespace HISP.Player
if (OtherTrade.MoneyOffered > 0 && Trader.Money + OtherTrade.MoneyOffered > 2100000000) if (OtherTrade.MoneyOffered > 0 && Trader.Money + OtherTrade.MoneyOffered > 2100000000)
{ {
byte[] tradeYouHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveYouTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeYouHasTooMuchMoney = PacketBuilder.CreateChat(Messages.TradeWillGiveYouTooMuchMoney, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeYouHasTooMuchMoney); Trader.LoggedinClient.SendPacket(tradeYouHasTooMuchMoney);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -143,7 +143,7 @@ namespace HISP.Player
if (HorsesOffered.Length > 0 && OtherTrade.Trader.HorseInventory.HorseList.Length + HorsesOffered.Length > OtherTrade.Trader.MaxHorses) if (HorsesOffered.Length > 0 && OtherTrade.Trader.HorseInventory.HorseList.Length + HorsesOffered.Length > OtherTrade.Trader.MaxHorses)
{ {
byte[] tradeYouHaveTooManyHorses = PacketBuilder.CreateChat(Messages.TradeYouCantHandleMoreHorses, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeYouHaveTooManyHorses = PacketBuilder.CreateChat(Messages.TradeYouCantHandleMoreHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeYouHaveTooManyHorses); Trader.LoggedinClient.SendPacket(tradeYouHaveTooManyHorses);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -152,7 +152,7 @@ namespace HISP.Player
if (OtherTrade.HorsesOffered.Length > 0 && Trader.HorseInventory.HorseList.Length + OtherTrade.HorsesOffered.Length > Trader.MaxHorses) if (OtherTrade.HorsesOffered.Length > 0 && Trader.HorseInventory.HorseList.Length + OtherTrade.HorsesOffered.Length > Trader.MaxHorses)
{ {
byte[] tradeYouHaveTooManyHorses = PacketBuilder.CreateChat(Messages.TradeYouCantHandleMoreHorses, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeYouHaveTooManyHorses = PacketBuilder.CreateChat(Messages.TradeYouCantHandleMoreHorses, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeYouHaveTooManyHorses); Trader.LoggedinClient.SendPacket(tradeYouHaveTooManyHorses);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -171,7 +171,7 @@ namespace HISP.Player
if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK) if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK)
{ {
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeYouCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeYouCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeTooManyItems); Trader.LoggedinClient.SendPacket(tradeTooManyItems);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -189,7 +189,7 @@ namespace HISP.Player
if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK) if (items.ItemInstances.Length + inst.Length > Item.MAX_STACK)
{ {
byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeOtherCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeTooManyItems = PacketBuilder.CreateChat(Messages.TradeOtherCantCarryMoreItems, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeTooManyItems); Trader.LoggedinClient.SendPacket(tradeTooManyItems);
Fail = true; Fail = true;
OtherTrade.Fail = true; OtherTrade.Fail = true;
} }
@ -206,7 +206,7 @@ namespace HISP.Player
acceptTrade:; acceptTrade:;
byte[] tradeAccepted = PacketBuilder.CreateChat(Messages.TradeAcceptedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeAccepted = PacketBuilder.CreateChat(Messages.TradeAcceptedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeAccepted); Trader.LoggedinClient.SendPacket(tradeAccepted);
// Transfer Money // Transfer Money
@ -214,14 +214,14 @@ namespace HISP.Player
{ {
Trader.TakeMoney(MoneyOffered); Trader.TakeMoney(MoneyOffered);
byte[] tradeSpentMoney = PacketBuilder.CreateChat(Messages.FormatTradeYouSpent(MoneyOffered), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeSpentMoney = PacketBuilder.CreateChat(Messages.FormatTradeYouSpent(MoneyOffered), PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeSpentMoney); Trader.LoggedinClient.SendPacket(tradeSpentMoney);
} }
if(OtherTrade.MoneyOffered > 0) if(OtherTrade.MoneyOffered > 0)
{ {
Trader.AddMoney(OtherTrade.MoneyOffered); Trader.AddMoney(OtherTrade.MoneyOffered);
byte[] tradeReceivedMoney = PacketBuilder.CreateChat(Messages.FormatTradeYouReceived(OtherTrade.MoneyOffered), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeReceivedMoney = PacketBuilder.CreateChat(Messages.FormatTradeYouReceived(OtherTrade.MoneyOffered), PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeReceivedMoney); Trader.LoggedinClient.SendPacket(tradeReceivedMoney);
} }
foreach (HorseInstance inst in HorsesOffered) // Transfer Horses foreach (HorseInstance inst in HorsesOffered) // Transfer Horses
@ -236,7 +236,7 @@ namespace HISP.Player
byte[] disMounted = PacketBuilder.CreateChat(Messages.TradeRiddenHorse, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] disMounted = PacketBuilder.CreateChat(Messages.TradeRiddenHorse, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Facing %= 5; Trader.Facing %= 5;
Trader.CurrentlyRidingHorse = null; Trader.CurrentlyRidingHorse = null;
Trader.Client.SendPacket(disMounted); Trader.LoggedinClient.SendPacket(disMounted);
} }
} }
@ -273,13 +273,13 @@ namespace HISP.Player
public void InteruptTrade() public void InteruptTrade()
{ {
byte[] tradeCanceled = PacketBuilder.CreateChat(Messages.TradeCanceledInterupted, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeCanceled = PacketBuilder.CreateChat(Messages.TradeCanceledInterupted, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeCanceled); Trader.LoggedinClient.SendPacket(tradeCanceled);
endTrade(); endTrade();
} }
public void AcceptTrade() public void AcceptTrade()
{ {
byte[] waitingForAccept = PacketBuilder.CreateChat(Messages.TradeWaitingForOthersToAcceptMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] waitingForAccept = PacketBuilder.CreateChat(Messages.TradeWaitingForOthersToAcceptMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(waitingForAccept); Trader.LoggedinClient.SendPacket(waitingForAccept);
if (OtherTrade.Stage == "ACCEPTED") if (OtherTrade.Stage == "ACCEPTED")
{ {
@ -292,18 +292,18 @@ namespace HISP.Player
public void CancelTrade() public void CancelTrade()
{ {
byte[] tradeCanceled = PacketBuilder.CreateChat(Messages.TradeCanceledByYouMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeCanceled = PacketBuilder.CreateChat(Messages.TradeCanceledByYouMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(tradeCanceled); Trader.LoggedinClient.SendPacket(tradeCanceled);
byte[] tradeCanceledOther = PacketBuilder.CreateChat(Messages.FormatTradeCanceledByPlayer(Trader.Username), PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] tradeCanceledOther = PacketBuilder.CreateChat(Messages.FormatTradeCanceledByPlayer(Trader.Username), PacketBuilder.CHAT_BOTTOM_RIGHT);
OtherTrade.Trader.Client.SendPacket(tradeCanceledOther); OtherTrade.Trader.LoggedinClient.SendPacket(tradeCanceledOther);
endTrade(); endTrade();
} }
public void CancelTradeMoved() public void CancelTradeMoved()
{ {
byte[] playerMoved = PacketBuilder.CreateChat(Messages.TradeCanceledBecuasePlayerMovedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT); byte[] playerMoved = PacketBuilder.CreateChat(Messages.TradeCanceledBecuasePlayerMovedMessage, PacketBuilder.CHAT_BOTTOM_RIGHT);
Trader.Client.SendPacket(playerMoved); Trader.LoggedinClient.SendPacket(playerMoved);
OtherTrade.Trader.Client.SendPacket(playerMoved); OtherTrade.Trader.LoggedinClient.SendPacket(playerMoved);
endTrade(); endTrade();
} }

File diff suppressed because it is too large Load diff

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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.8.73.0")] [assembly: AssemblyVersion("1.7.140.0")]
[assembly: AssemblyFileVersion("1.8.73.0")] [assembly: AssemblyFileVersion("1.7.140.0")]

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Android</Configuration> <Configuration>Android</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\arm\Android\net8.0\android-arm\publish\</PublishDir> <PublishDir>bin\arm\Android\net7.0\android-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>android-arm</RuntimeIdentifier> <RuntimeIdentifier>android-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Android</Configuration> <Configuration>Android</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\Android\net8.0\android-arm64\publish\</PublishDir> <PublishDir>bin\arm64\Android\net7.0\android-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>android-arm64</RuntimeIdentifier> <RuntimeIdentifier>android-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>False</PublishSingleFile> !--> <!-- <PublishSingleFile>False</PublishSingleFile> !-->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Linux</Configuration> <Configuration>Linux</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>bin\x64\Linux\net8.0\linux-x64\publish\</PublishDir> <PublishDir>bin\x64\Linux\net7.0\linux-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> <RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Linux</Configuration> <Configuration>Linux</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\ARM\Linux\net8.0\linux-arm\publish\</PublishDir> <PublishDir>bin\ARM\Linux\net7.0\linux-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>linux-arm</RuntimeIdentifier> <RuntimeIdentifier>linux-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Linux</Configuration> <Configuration>Linux</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\ARM64\Linux\net8.0\linux-arm64\publish\</PublishDir> <PublishDir>bin\ARM64\Linux\net7.0\linux-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier> <RuntimeIdentifier>linux-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>MacOS</Configuration> <Configuration>MacOS</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>bin\x64\MacOS\net8.0\osx-x64\publish\</PublishDir> <PublishDir>bin\x64\MacOS\net7.0\osx-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>osx-x64</RuntimeIdentifier> <RuntimeIdentifier>osx-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>MacOS</Configuration> <Configuration>MacOS</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\MacOS\net8.0\osx-arm64\publish\</PublishDir> <PublishDir>bin\arm64\MacOS\net7.0\osx-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>osx-arm64</RuntimeIdentifier> <RuntimeIdentifier>osx-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>x86</Platform> <Platform>x86</Platform>
<PublishDir>bin\x86\Windows\net8.0\win-x86\publish\</PublishDir> <PublishDir>bin\x86\Windows\net7.0\win-x86\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-x86</RuntimeIdentifier> <RuntimeIdentifier>win-x86</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,14 +6,14 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>x64</Platform> <Platform>x64</Platform>
<PublishDir>bin\x64\Windows\net8.0\win-x64\publish\</PublishDir> <PublishDir>bin\x64\Windows\net7.0\win-x64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->
<!-- <PublishReadyToRun>True</PublishReadyToRun> --> <PublishReadyToRun>True</PublishReadyToRun>
<!-- <PublishTrimmed>True</PublishTrimmed> --> <PublishTrimmed>True</PublishTrimmed>
<DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants> <DefineConstants>OS_WINDOWS;ARCH_X86_64</DefineConstants>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\arm\Windows\net8.0\win-arm\publish\</PublishDir> <PublishDir>bin\arm\Windows\net7.0\win-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-arm</RuntimeIdentifier> <RuntimeIdentifier>win-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>Windows</Configuration> <Configuration>Windows</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\Windows\net8.0\win-arm64\publish\</PublishDir> <PublishDir>bin\arm64\Windows\net7.0\win-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier> <RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>iOS</Configuration> <Configuration>iOS</Configuration>
<Platform>ARM</Platform> <Platform>ARM</Platform>
<PublishDir>bin\arm\iOS\net8.0\ios-arm\publish\</PublishDir> <PublishDir>bin\arm\iOS\net7.0\ios-arm\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>ios-arm</RuntimeIdentifier> <RuntimeIdentifier>ios-arm</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>True</PublishSingleFile> --> <!-- <PublishSingleFile>True</PublishSingleFile> -->

View file

@ -6,9 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PropertyGroup> <PropertyGroup>
<Configuration>iOS</Configuration> <Configuration>iOS</Configuration>
<Platform>ARM64</Platform> <Platform>ARM64</Platform>
<PublishDir>bin\arm64\iOS\net8.0\ios-arm64\publish\</PublishDir> <PublishDir>bin\arm64\iOS\net7.0\ios-arm64\publish\</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol> <PublishProtocol>FileSystem</PublishProtocol>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>ios-arm64</RuntimeIdentifier> <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
<SelfContained>True</SelfContained> <SelfContained>True</SelfContained>
<!-- <PublishSingleFile>False</PublishSingleFile> !--> <!-- <PublishSingleFile>False</PublishSingleFile> !-->

View file

@ -2,15 +2,11 @@
# Horse Isle Server Configuration # Horse Isle Server Configuration
# ======================= # =======================
# #
# HISP was Created and Developed by Li / SilicaAndPina # HISP was Created and Developed by SilicaAndPina
# However it is NOT COPYRIGHTED! This software is in the Public Domain! # However it is NOT COPYRIGHTED! This software is in the Public Domain!
# #
# =======================
# Network
# =======================
# Ip address the server will bind to (default: 0.0.0.0 ALL INTERFACES) # Ip address the server will bind to (default: 0.0.0.0 ALL INTERFACES)
ip=0.0.0.0 ip=0.0.0.0
# Port the server will bind to defaults: (on beta.horseisle.com: 12321, on pinto.horseisle.com: 443) # Port the server will bind to defaults: (on beta.horseisle.com: 12321, on pinto.horseisle.com: 443)
@ -18,15 +14,6 @@ ip=0.0.0.0
# running on the same port, so i prefer 12321. # running on the same port, so i prefer 12321.
port=12321 port=12321
# Listen for WebSockets as well as raw Flash XMLSocket Connection
# If this feature is enabled, players can play Horse Isle
# on HTML5 and WebAssembly with a fork of the Ruffle Flash Player Emulator
enable_websocket=true
# =======================
# Database
# =======================
# MariaDB Database Information # MariaDB Database Information
# For best performance, the database should be hosted on the SAME MACHINE as the HISP server. # For best performance, the database should be hosted on the SAME MACHINE as the HISP server.
# Or atleast, on a local network. # Or atleast, on a local network.
@ -39,6 +26,16 @@ db_port=3306
# Connect to a sqllite database instead of a sql server. # Connect to a sqllite database instead of a sql server.
sql_lite=false sql_lite=false
# File that contains the map tile data
# the default was downloaded from the original server
map=HI1.MAP
# This folder contains all definitions in the game
# such as items, horses. and quest data.
# NOTE: This can be a folder or a file.
gamedata=gamedata
# ======================= # =======================
# Security # Security
# ======================= # =======================
@ -74,15 +71,6 @@ enable_spam_filter=true
# Misc Settings. # Misc Settings.
# ======================= # =======================
# File that contains the map tile data
# the default was downloaded from the original server
map=HI1.MAP
# This folder contains all definitions in the game
# such as items, horses. and quest data.
# NOTE: This can be a folder or a file.
gamedata=gamedata
# Should the server consider all users "Subscribers" # Should the server consider all users "Subscribers"
# (warning: makes ranches be in use forever.) # (warning: makes ranches be in use forever.)
all_users_subscribed=false all_users_subscribed=false

View file

@ -1,141 +1,88 @@
 
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Linq; using System.Linq;
using HISP.Server; using HISP.Server;
using System;
using HISP.Util; namespace HISP.Security
{
namespace HISP.Security public class Authentication
{ {
public class Authentication public static string DecryptLogin(string encpass)
{ {
string decrypt = "";
public const string ROTPOOL = "bl7Jgk61IZdnY mfDN5zjM2XLqTCty4WSEoKR3BFVQsaUhHOAx0rPwp9uc8iGve"; string ROTPOOL = "bl7Jgk61IZdnY mfDN5zjM2XLqTCty4WSEoKR3BFVQsaUhHOAx0rPwp9uc8iGve";
public const string POSPOOL = "DQc3uxiGsKZatMmOS5qYveN71zoPTk8yU0H2w9VjprBXWn l4FJd6IRbhgACfEL"; string POSPOOL = "DQc3uxiGsKZatMmOS5qYveN71zoPTk8yU0H2w9VjprBXWn l4FJd6IRbhgACfEL";
string ROTPOOL2 = "evGi8cu9pwPr0xAOHhUasQVFB3RKoESW4ytCTqLX2Mjz5NDfm YndZI16kgJ7lb";
public static string EncryptLogin(string plainpass)
{
string encrypt = ""; int i = 0;
int ii = 0;
int i = 0; while (i < encpass.Length)
while (i < plainpass.Length) {
{ int ROT = ROTPOOL.IndexOf(encpass[i].ToString());
int rotation = GameServer.RandomNumberGenerator.Next(0, ROTPOOL.Length); int POS = POSPOOL.IndexOf(encpass[i + 1].ToString());
int position = ROTPOOL.IndexOf(plainpass[i]); POS -= (ROT + ii);
if (POS < 0)
position = position + (rotation + i); {
while (position >= ROTPOOL.Length) POS = (POS / -1) - 1;
position -= ROTPOOL.Length;
encrypt += ROTPOOL[rotation]; while (POS >= ROTPOOL.Length)
encrypt += POSPOOL[position]; {
POS -= ROTPOOL.Length;
i++; }
}
return encrypt; decrypt += ROTPOOL2[POS];
}
} else
public static string DecryptLogin(string encpass) {
{ while (POS >= ROTPOOL.Length)
string decrypt = ""; {
POS -= ROTPOOL.Length;
int i = 0; }
int rotationCycle = 0;
while (i < encpass.Length) decrypt += ROTPOOL[POS];
{ }
int rotation = ROTPOOL.IndexOf(encpass[i].ToString());
int position = POSPOOL.IndexOf(encpass[i + 1].ToString()); i += 2;
position -= (rotation + rotationCycle); ii += 1;
if (position < 0) }
{ return decrypt.Replace(" ", "");
position = (position / -1) - 1; }
while (position >= ROTPOOL.Length)
position -= ROTPOOL.Length;
public static byte[] HashAndSalt(string plaintext, byte[] salt)
decrypt += Helper.ReverseString(ROTPOOL)[position]; {
} byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext);
else
{ SHA512 sha512 = SHA512.Create();
while (position >= ROTPOOL.Length) byte[] hash = sha512.ComputeHash(plaintextBytes);
position -= ROTPOOL.Length;
for (int i = 0; i < hash.Length; i++)
decrypt += ROTPOOL[position]; {
} hash[i] ^= salt[i];
}
i += 2;
rotationCycle++; byte[] finalHash = sha512.ComputeHash(hash);
}
return decrypt.Replace(" ", ""); return finalHash;
} }
public static byte[] Sha1Digest(byte[] message) public static bool CheckPassword(string username, string password)
{ {
using (SHA1 sha1 = SHA1.Create()) if(Database.CheckUserExist(username))
return sha1.ComputeHash(message); {
} byte[] expectedPassword = Database.GetPasswordHash(username);
byte[] salt = Database.GetPasswordSalt(username);
byte[] hashedPassword = HashAndSalt(password, salt);
public static byte[] Sha512Digest(byte[] message)
{ if (Enumerable.SequenceEqual(expectedPassword, hashedPassword))
using (SHA512 sha512 = SHA512.Create()) return true;
return sha512.ComputeHash(message); }
} return false;
}
public static byte[] XorBytes(byte[] plaintext, byte[] key)
{ }
int length = Math.Min(plaintext.Length, key.Length); }
byte[] ciphertext = new byte[length];
for(int i = 0; i < length; i++)
ciphertext[i] = Convert.ToByte(plaintext[i] ^ key[i]);
return ciphertext;
}
public static byte[] HashAndSalt(string plaintext, byte[] salt)
{
byte[] plaintextBytes = Encoding.UTF8.GetBytes(plaintext);
byte[] hash = Sha512Digest(plaintextBytes);
byte[] saltedHash = XorBytes(hash, salt);
byte[] finalHash = Sha512Digest(saltedHash);
return finalHash;
}
public static bool CheckPassword(string username, string password)
{
if(Database.CheckUserExist(username))
{
byte[] expectedPassword = Database.GetPasswordHash(username);
byte[] salt = Database.GetPasswordSalt(username);
byte[] hashedPassword = HashAndSalt(password, salt);
if (Enumerable.SequenceEqual(expectedPassword, hashedPassword))
return true;
}
return false;
}
public static int CreateAccount(string username, string password, string gender, bool admin, bool moderator)
{
// Get a free user id
int userId = Database.GetNextFreeUserId();
// Generate salt value
byte[] salt = new byte[64];
GameServer.RandomNumberGenerator.NextBytes(salt);
string saltText = BitConverter.ToString(salt).Replace("-", "");
string hashsalt = BitConverter.ToString(Authentication.HashAndSalt(password, salt)).Replace("-", "");
// Add user to database
Database.CreateUser(userId, username, hashsalt, saltText, gender, admin, moderator);
return userId;
}
}
}

View file

@ -5,14 +5,24 @@ namespace HISP.Security
{ {
public class CrossDomainPolicy public class CrossDomainPolicy
{ {
public static byte[] GetPolicyFile() public static byte[] GetPolicy()
{ {
if (!File.Exists(ConfigReader.CrossDomainPolicyFile)) { if (!File.Exists(ConfigReader.CrossDomainPolicyFile)) {
Logger.InfoPrint("Cross-Domain-Policy file not found, using default"); Logger.InfoPrint("Cross-Domain-Policy file not found, using default");
File.WriteAllText(ConfigReader.CrossDomainPolicyFile, Resources.DefaultCrossDomain); File.WriteAllText(ConfigReader.CrossDomainPolicyFile, Resources.DefaultCrossDomain);
} }
MemoryStream ms = new MemoryStream();
byte[] policyFileBytes = File.ReadAllBytes(ConfigReader.CrossDomainPolicyFile); byte[] policyFileBytes = File.ReadAllBytes(ConfigReader.CrossDomainPolicyFile);
return policyFileBytes; ms.Write(policyFileBytes, 0x00, policyFileBytes.Length);
ms.WriteByte(0x00);
ms.Seek(0x00, SeekOrigin.Begin);
byte[] policyFileData = ms.ToArray();
ms.Close();
return policyFileData;
} }
} }
} }

View file

@ -1,27 +1,27 @@
using System.Threading; using System.Threading;
namespace HISP.Security namespace HISP.Security
{ {
public class RandomID public class RandomID
{ {
private static Mutex rndmIdMutex = new Mutex(); private static Mutex rndmIdMutex = new Mutex();
private static int prevId = 0; private static int prevId = 0;
public static int NextRandomId(int randomId=-1) public static int NextRandomId(int randomId=-1)
{ {
int rndmId = 0; int rndmId = 0;
rndmIdMutex.WaitOne(); rndmIdMutex.WaitOne();
if (randomId == -1) if (randomId == -1)
rndmId = prevId+1; rndmId = prevId+1;
else else
rndmId = randomId; rndmId = randomId;
if (rndmId >= prevId) if (rndmId >= prevId)
prevId = rndmId; prevId = rndmId;
rndmIdMutex.ReleaseMutex(); rndmIdMutex.ReleaseMutex();
return rndmId; return rndmId;
} }
} }
} }

View file

@ -1,142 +1,141 @@
using HISP.Properties; using HISP.Properties;
using System.IO; using System.IO;
namespace HISP.Server namespace HISP.Server
{ {
public class ConfigReader public class ConfigReader
{ {
public static int Port = 12321; public static int Port = 12321;
public static string BindIP = "0.0.0.0"; public static string BindIP = "0.0.0.0";
public static string DatabaseIP = "127.0.0.1"; public static string DatabaseIP = "127.0.0.1";
public static string DatabaseName = "game1"; public static string DatabaseName = "game1";
public static string DatabaseUsername = "root"; public static string DatabaseUsername = "root";
public static string DatabasePassword = "test123"; public static string DatabasePassword = "test123";
public static int DatabasePort = 3306; public static int DatabasePort = 3306;
public static int IntrestRate = 3333; public static int IntrestRate = 3333;
public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests."; public static string Motd = "April 11, 2020. New breed, Camarillo White Horse. Two new quests.";
public static string MapFile = "HI1.MAP"; public static string MapFile = "HI1.MAP";
public static string GameData = "gamedata.json"; public static string GameData = "gamedata.json";
public static string CrossDomainPolicyFile = "CrossDomainPolicy.xml"; public static string CrossDomainPolicyFile = "CrossDomainPolicy.xml";
public static int LogLevel = 4; public static string ModsFolder = "mods";
public static int LogLevel = 4;
public static bool SqlLite = false;
public static bool EnableSpamFilter = true; public static bool SqlLite = false;
public static bool AllUsersSubbed = false; public static bool EnableSpamFilter = true;
public static bool FixOfficalBugs = false; public static bool AllUsersSubbed = false;
public static bool EnableSwearFilter = true; public static bool FixOfficalBugs = false;
public static bool EnableCorrections = true; public static bool EnableSwearFilter = true;
public static bool EnableNonViolations = true; public static bool EnableCorrections = true;
public static bool EnableNonViolations = true;
public static bool EnableWebSocket = true;
public static string ConfigurationFileName = "server.properties";
public static string ConfigurationFileName = "server.properties"; public static void OpenConfig()
public static void OpenConfig() {
{ if (!File.Exists(ConfigurationFileName))
if (!File.Exists(ConfigurationFileName)) {
{ Logger.WarnPrint(ConfigurationFileName+" not found! writing default.");
Logger.WarnPrint(ConfigurationFileName+" not found! writing default."); File.WriteAllText(ConfigurationFileName, Resources.DefaultServerProperties);
File.WriteAllText(ConfigurationFileName, Resources.DefaultServerProperties); Logger.WarnPrint("! Its very likely database connection will fail...");
Logger.WarnPrint("! Its very likely database connection will fail..."); }
}
string[] configFile = File.ReadAllLines(ConfigurationFileName);
string[] configFile = File.ReadAllLines(ConfigurationFileName); foreach (string setting in configFile)
foreach (string setting in configFile) {
{ /*
/* * Avoid crashing.
* Avoid crashing. */
*/ if (setting.Length < 1)
if (setting.Length < 1) continue;
continue; if (setting[0] == '#')
if (setting[0] == '#') continue;
continue; if (!setting.Contains("="))
if (!setting.Contains("=")) continue;
continue;
string[] dataPair = setting.Split('=');
string[] dataPair = setting.Split('=');
string key = dataPair[0];
string key = dataPair[0]; string data = dataPair[1];
string data = dataPair[1]; /*
/* * Parse configuration file
* Parse configuration file */
*/
switch (key)
switch (key) {
{ case "port":
case "port": Port = int.Parse(data);
Port = int.Parse(data); break;
case "ip":
BindIP = data;
break;
case "db_ip":
DatabaseIP = data;
break;
case "db_username":
DatabaseUsername = data;
break;
case "db_password":
DatabasePassword = data;
break;
case "db_name":
DatabaseName = data;
break;
case "db_port":
DatabasePort = int.Parse(data);
break;
case "map":
MapFile = data;
break;
case "motd":
Motd = data;
break;
case "gamedata":
GameData = data;
break;
case "crossdomain":
CrossDomainPolicyFile = data;
break;
case "all_users_subscribed":
AllUsersSubbed = data == "true";
break;
case "enable_corrections":
EnableCorrections = data == "true";
break;
case "sql_lite":
SqlLite = data == "true";
break;
case "enable_non_violation_check":
EnableNonViolations = data == "true";
break;
case "enable_spam_filter":
EnableSpamFilter = data == "true";
break;
case "fix_offical_bugs":
FixOfficalBugs = data == "true";
break;
case "enable_word_filter":
EnableSwearFilter = data == "true";
break; break;
case "ip": case "mods_folder":
BindIP = data; ModsFolder = data;
break; break;
case "db_ip": case "intrest_rate":
DatabaseIP = data; IntrestRate = int.Parse(data);
break; break;
case "db_username": case "log_level":
DatabaseUsername = data; LogLevel = int.Parse(data);
break; break;
case "db_password": }
DatabasePassword = data;
break;
case "db_name":
DatabaseName = data; }
break;
case "db_port":
DatabasePort = int.Parse(data); }
break;
case "map": }
MapFile = data; }
break;
case "motd":
Motd = data;
break;
case "gamedata":
GameData = data;
break;
case "crossdomain":
CrossDomainPolicyFile = data;
break;
case "all_users_subscribed":
AllUsersSubbed = (data == "true");
break;
case "enable_corrections":
EnableCorrections = (data == "true");
break;
case "sql_lite":
SqlLite = (data == "true");
break;
case "enable_non_violation_check":
EnableNonViolations = (data == "true");
break;
case "enable_spam_filter":
EnableSpamFilter = (data == "true");
break;
case "enable_websocket":
EnableWebSocket = (data == "true");
break;
case "fix_offical_bugs":
FixOfficalBugs = (data == "true");
break;
case "enable_word_filter":
EnableSwearFilter = (data == "true");
break;
case "intrest_rate":
IntrestRate = int.Parse(data);
break;
case "log_level":
LogLevel = int.Parse(data);
break;
}
}
}
}
}

View file

@ -39,6 +39,7 @@ namespace HISP.Server
Database.TryExecuteSqlQuery("UPDATE World SET LastLoadedInVersion=\"v1.7.20\";"); Database.TryExecuteSqlQuery("UPDATE World SET LastLoadedInVersion=\"v1.7.20\";");
} }
public static void FixUpDb() public static void FixUpDb()
{ {
string lastVersionStr = Database.GetLastLoadedVersion(); string lastVersionStr = Database.GetLastLoadedVersion();

View file

@ -3545,6 +3545,8 @@ namespace HISP.Server
} }
} }
public static void SetJewelrySlot1(int playerId, int itemId) public static void SetJewelrySlot1(int playerId, int itemId)
{ {
using (DbConnection db = connectDb()) using (DbConnection db = connectDb())
@ -4126,41 +4128,7 @@ namespace HISP.Server
return subscribedUntil; return subscribedUntil;
} }
} }
public static bool IsUserAdmin(int playerId)
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 GetUserModerator(int playerId)
{
using (DbConnection db = connectDb())
{
db.Open();
DbCommand sqlCommand = db.CreateCommand();
sqlCommand.CommandText = "SELECT Moderator FROM Users WHERE Id=@playerId";
addWithValue(sqlCommand, "@playerId", playerId);
sqlCommand.Prepare();
bool admin = sqlCommand.ExecuteScalar().ToString() == "YES";
return admin;
}
}
public static bool GetUserAdmin(int playerId)
{ {
using (DbConnection db = connectDb()) using (DbConnection db = connectDb())
{ {
@ -4176,7 +4144,7 @@ namespace HISP.Server
return admin; return admin;
} }
} }
public static bool GetUserSubscribed(int playerId) public static bool IsUserSubscribed(int playerId)
{ {
if (ConfigReader.AllUsersSubbed) if (ConfigReader.AllUsersSubbed)
return true; return true;
@ -4471,38 +4439,6 @@ namespace HISP.Server
} }
} }
public static void SetUserMod(int playerId, bool moderator)
{
using (DbConnection db = connectDb())
{
db.Open();
DbCommand sqlCommand = db.CreateCommand();
string yesno = (moderator ? "YES" : "NO");
sqlCommand.CommandText = "UPDATE Users SET Moderator=@moderator WHERE Id=@playerId";
addWithValue(sqlCommand, "@playerId", playerId);
addWithValue(sqlCommand, "@moderator", yesno);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
}
}
public static void SetUserAdmin(int playerId, bool admin)
{
using (DbConnection db = connectDb())
{
db.Open();
DbCommand sqlCommand = db.CreateCommand();
string yesno = (admin ? "YES" : "NO");
sqlCommand.CommandText = "UPDATE Users SET Admin=@admin WHERE Id=@playerId";
addWithValue(sqlCommand, "@playerId", playerId);
addWithValue(sqlCommand, "@admin", yesno);
sqlCommand.Prepare();
sqlCommand.ExecuteNonQuery();
}
}
public static void SetNpcX(int npcId, int x) public static void SetNpcX(int npcId, int x)
{ {
using (DbConnection db = connectDb()) using (DbConnection db = connectDb())
@ -4901,7 +4837,7 @@ namespace HISP.Server
} }
public static bool CheckUsernameIsModerator(string username) public static bool CheckUserIsModerator(string username)
{ {
using (DbConnection db = connectDb()) using (DbConnection db = connectDb())
{ {
@ -4925,7 +4861,7 @@ namespace HISP.Server
} }
public static bool CheckUsernameIsAdmin(string username) public static bool CheckUserIsAdmin(string username)
{ {
using (DbConnection db = connectDb()) using (DbConnection db = connectDb())
{ {

Some files were not shown because too many files have changed in this diff Show more