mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Merged in xdemolish/ffxiv-classic-server/logging_and_casing (pull request #13)
fixed logging and casing
This commit is contained in:
commit
9a29d0806a
@ -1,13 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
namespace FFXIVClassic.Common
|
||||||
{
|
{
|
||||||
[global::System.AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
[global::System.AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
||||||
sealed class BitfieldLengthAttribute : Attribute
|
public sealed class BitfieldLengthAttribute : Attribute
|
||||||
{
|
{
|
||||||
uint length;
|
uint length;
|
||||||
|
|
||||||
@ -19,7 +15,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
public uint Length { get { return length; } }
|
public uint Length { get { return length; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
static class PrimitiveConversion
|
public static class PrimitiveConversion
|
||||||
{
|
{
|
||||||
public static UInt32 ToUInt32<T>(T t) where T : struct
|
public static UInt32 ToUInt32<T>(T t) where T : struct
|
||||||
{
|
{
|
@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
namespace FFXIVClassic.Common
|
||||||
{
|
{
|
||||||
public class Blowfish
|
public class Blowfish
|
||||||
{
|
{
|
||||||
@ -287,7 +283,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
|
|
||||||
public Blowfish(byte[] key)
|
public Blowfish(byte[] key)
|
||||||
{
|
{
|
||||||
initializeBlowfish(key);
|
InitializeBlowfish(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Encipher(byte[] data, int offset, int length)
|
public void Encipher(byte[] data, int offset, int length)
|
||||||
@ -299,7 +295,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
{
|
{
|
||||||
uint xl = (uint)((data[i + 0]) | (data[i + 1] << 8) | (data[i + 2] << 16) | (data[i + 3] << 24));
|
uint xl = (uint)((data[i + 0]) | (data[i + 1] << 8) | (data[i + 2] << 16) | (data[i + 3] << 24));
|
||||||
uint xr = (uint)((data[i + 4]) | (data[i + 5] << 8) | (data[i + 6] << 16) | (data[i + 7] << 24));
|
uint xr = (uint)((data[i + 4]) | (data[i + 5] << 8) | (data[i + 6] << 16) | (data[i + 7] << 24));
|
||||||
blowfish_encipher(ref xl, ref xr);
|
BlowfishEncipher(ref xl, ref xr);
|
||||||
data[i + 0] = (byte)(xl >> 0);
|
data[i + 0] = (byte)(xl >> 0);
|
||||||
data[i + 1] = (byte)(xl >> 8);
|
data[i + 1] = (byte)(xl >> 8);
|
||||||
data[i + 2] = (byte)(xl >> 16);
|
data[i + 2] = (byte)(xl >> 16);
|
||||||
@ -320,7 +316,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
{
|
{
|
||||||
uint xl = (uint)((data[i + 0]) | (data[i + 1] << 8) | (data[i + 2] << 16) | (data[i + 3] << 24));
|
uint xl = (uint)((data[i + 0]) | (data[i + 1] << 8) | (data[i + 2] << 16) | (data[i + 3] << 24));
|
||||||
uint xr = (uint)((data[i + 4]) | (data[i + 5] << 8) | (data[i + 6] << 16) | (data[i + 7] << 24));
|
uint xr = (uint)((data[i + 4]) | (data[i + 5] << 8) | (data[i + 6] << 16) | (data[i + 7] << 24));
|
||||||
blowfish_decipher(ref xl, ref xr);
|
BlowfishDecipher(ref xl, ref xr);
|
||||||
data[i + 0] = (byte)(xl >> 0);
|
data[i + 0] = (byte)(xl >> 0);
|
||||||
data[i + 1] = (byte)(xl >> 8);
|
data[i + 1] = (byte)(xl >> 8);
|
||||||
data[i + 2] = (byte)(xl >> 16);
|
data[i + 2] = (byte)(xl >> 16);
|
||||||
@ -355,7 +351,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void blowfish_encipher(ref UInt32 xl, ref UInt32 xr)
|
private void BlowfishEncipher(ref UInt32 xl, ref UInt32 xr)
|
||||||
{
|
{
|
||||||
UInt32 temp;
|
UInt32 temp;
|
||||||
Int32 i;
|
Int32 i;
|
||||||
@ -378,7 +374,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void blowfish_decipher(ref UInt32 xl, ref UInt32 xr)
|
private void BlowfishDecipher(ref UInt32 xl, ref UInt32 xr)
|
||||||
{
|
{
|
||||||
UInt32 temp;
|
UInt32 temp;
|
||||||
Int32 i;
|
Int32 i;
|
||||||
@ -387,13 +383,13 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
xl = xl ^ P[i];
|
xl = xl ^ P[i];
|
||||||
xr = F(xl) ^ xr;
|
xr = F(xl) ^ xr;
|
||||||
|
|
||||||
/* Exchange xl and xr */
|
/* ExChange xl and xr */
|
||||||
temp = xl;
|
temp = xl;
|
||||||
xl = xr;
|
xl = xr;
|
||||||
xr = temp;
|
xr = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Exchange xl and xr */
|
/* ExChange xl and xr */
|
||||||
temp = xl;
|
temp = xl;
|
||||||
xl = xr;
|
xl = xr;
|
||||||
xr = temp;
|
xr = temp;
|
||||||
@ -403,7 +399,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int initializeBlowfish(byte [] key)
|
private int InitializeBlowfish(byte [] key)
|
||||||
{
|
{
|
||||||
Int16 i;
|
Int16 i;
|
||||||
Int16 j;
|
Int16 j;
|
||||||
@ -437,7 +433,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
|
|
||||||
for (i = 0; i < N + 2; i += 2)
|
for (i = 0; i < N + 2; i += 2)
|
||||||
{
|
{
|
||||||
blowfish_encipher(ref datal, ref datar);
|
BlowfishEncipher(ref datal, ref datar);
|
||||||
|
|
||||||
P[i] = datal;
|
P[i] = datal;
|
||||||
P[i + 1] = datar;
|
P[i + 1] = datar;
|
||||||
@ -447,7 +443,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
{
|
{
|
||||||
for (j = 0; j < 256; j += 2)
|
for (j = 0; j < 256; j += 2)
|
||||||
{
|
{
|
||||||
blowfish_encipher(ref datal, ref datar);
|
BlowfishEncipher(ref datal, ref datar);
|
||||||
S[i,j] = datal;
|
S[i,j] = datal;
|
||||||
S[i,j + 1] = datar;
|
S[i,j + 1] = datar;
|
||||||
}
|
}
|
@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.common
|
namespace FFXIVClassic.Common
|
||||||
{
|
{
|
||||||
namespace EfficientHashTables
|
namespace EfficientHashTables
|
||||||
{
|
{
|
||||||
@ -29,14 +25,14 @@ namespace FFXIVClassic_Map_Server.common
|
|||||||
_buckets = new element[_capacity][];
|
_buckets = new element[_capacity][];
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint hash(ulong key)
|
public uint Hash(ulong key)
|
||||||
{
|
{
|
||||||
return (uint)(key % _capacity);
|
return (uint)(key % _capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(ulong key, T value)
|
public void Add(ulong key, T value)
|
||||||
{
|
{
|
||||||
uint hsh = hash(key);
|
uint hsh = Hash(key);
|
||||||
element[] e;
|
element[] e;
|
||||||
if (_buckets[hsh] == null)
|
if (_buckets[hsh] == null)
|
||||||
_buckets[hsh] = e = new element[1];
|
_buckets[hsh] = e = new element[1];
|
||||||
@ -57,7 +53,7 @@ namespace FFXIVClassic_Map_Server.common
|
|||||||
|
|
||||||
public T Get(ulong key)
|
public T Get(ulong key)
|
||||||
{
|
{
|
||||||
uint hsh = hash(key);
|
uint hsh = Hash(key);
|
||||||
element[] e = _buckets[hsh];
|
element[] e = _buckets[hsh];
|
||||||
if (e == null) return default(T);
|
if (e == null) return default(T);
|
||||||
foreach (var f in e)
|
foreach (var f in e)
|
||||||
@ -68,7 +64,7 @@ namespace FFXIVClassic_Map_Server.common
|
|||||||
|
|
||||||
public bool Has(ulong key)
|
public bool Has(ulong key)
|
||||||
{
|
{
|
||||||
uint hsh = hash(key);
|
uint hsh = Hash(key);
|
||||||
element[] e = _buckets[hsh];
|
element[] e = _buckets[hsh];
|
||||||
if (e == null) return false;
|
if (e == null) return false;
|
||||||
foreach (var f in e)
|
foreach (var f in e)
|
||||||
@ -108,14 +104,14 @@ namespace FFXIVClassic_Map_Server.common
|
|||||||
_buckets = new element[_capacity][];
|
_buckets = new element[_capacity][];
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint hash(uint key)
|
public uint Hash(uint key)
|
||||||
{
|
{
|
||||||
return (uint)(key % _capacity);
|
return (uint)(key % _capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(uint key, T value)
|
public void Add(uint key, T value)
|
||||||
{
|
{
|
||||||
uint hsh = hash(key);
|
uint hsh = Hash(key);
|
||||||
element[] e;
|
element[] e;
|
||||||
if (_buckets[hsh] == null)
|
if (_buckets[hsh] == null)
|
||||||
_buckets[hsh] = e = new element[1];
|
_buckets[hsh] = e = new element[1];
|
||||||
@ -136,7 +132,7 @@ namespace FFXIVClassic_Map_Server.common
|
|||||||
|
|
||||||
public T Get(uint key)
|
public T Get(uint key)
|
||||||
{
|
{
|
||||||
uint hsh = hash(key);
|
uint hsh = Hash(key);
|
||||||
element[] e = _buckets[hsh];
|
element[] e = _buckets[hsh];
|
||||||
if (e == null) return default(T);
|
if (e == null) return default(T);
|
||||||
foreach (var f in e)
|
foreach (var f in e)
|
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{3A3D6626-C820-4C18-8C81-64811424F20E}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>FFXIVClassic.Common</RootNamespace>
|
||||||
|
<AssemblyName>FFXIVClassic.Common</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile>
|
||||||
|
</TargetFrameworkProfile>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
<RegisterForComInterop>false</RegisterForComInterop>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Bitfield.cs" />
|
||||||
|
<Compile Include="Blowfish.cs" />
|
||||||
|
<Compile Include="EfficientHashTables.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="STA_INIFile.cs" />
|
||||||
|
<Compile Include="Utils.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
</Target>
|
||||||
|
-->
|
||||||
|
</Project>
|
36
FFXIVClassic Common Class Lib/Properties/AssemblyInfo.cs
Normal file
36
FFXIVClassic Common Class Lib/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
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("FFXIVClassic.Common")]
|
||||||
|
[assembly: AssemblyDescription("Common class library for FFXIVClassic project")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("ffxivclassic.fragmenterworks.com")]
|
||||||
|
[assembly: AssemblyProduct("FFXIVClassic.Common")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||||
|
[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("3a3d6626-c820-4c18-8c81-64811424f20e")]
|
||||||
|
|
||||||
|
// 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.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -9,10 +9,9 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace STA.Settings
|
namespace FFXIVClassic.Common
|
||||||
{
|
{
|
||||||
|
public class INIFile
|
||||||
internal class INIFile
|
|
||||||
{
|
{
|
||||||
|
|
||||||
#region "Declarations"
|
#region "Declarations"
|
||||||
@ -179,7 +178,7 @@ namespace STA.Settings
|
|||||||
// *** Check if original file exists ***
|
// *** Check if original file exists ***
|
||||||
bool OriginalFileExists = File.Exists(m_FileName);
|
bool OriginalFileExists = File.Exists(m_FileName);
|
||||||
|
|
||||||
// *** Get temporary file name ***
|
// *** get temporary file name ***
|
||||||
string TmpFileName = Path.ChangeExtension(m_FileName, "$n$");
|
string TmpFileName = Path.ChangeExtension(m_FileName, "$n$");
|
||||||
|
|
||||||
// *** Copy content of original file to temporary file, replace modified values ***
|
// *** Copy content of original file to temporary file, replace modified values ***
|
||||||
@ -199,7 +198,7 @@ namespace STA.Settings
|
|||||||
// *** Open the original file ***
|
// *** Open the original file ***
|
||||||
sr = new StreamReader(m_FileName);
|
sr = new StreamReader(m_FileName);
|
||||||
|
|
||||||
// *** Read the file original content, replace changes with local cache values ***
|
// *** Read the file original content, replace Changes with local cache values ***
|
||||||
string s;
|
string s;
|
||||||
string SectionName;
|
string SectionName;
|
||||||
string Key = null;
|
string Key = null;
|
||||||
@ -337,7 +336,7 @@ namespace STA.Settings
|
|||||||
}
|
}
|
||||||
|
|
||||||
// *** Read a value from local cache ***
|
// *** Read a value from local cache ***
|
||||||
internal string GetValue(string SectionName, string Key, string DefaultValue)
|
public string GetValue(string SectionName, string Key, string DefaultValue)
|
||||||
{
|
{
|
||||||
// *** Lazy loading ***
|
// *** Lazy loading ***
|
||||||
if (m_Lazy)
|
if (m_Lazy)
|
||||||
@ -380,7 +379,7 @@ namespace STA.Settings
|
|||||||
Dictionary<string, string> Section;
|
Dictionary<string, string> Section;
|
||||||
if (!m_Sections.TryGetValue(SectionName, out Section))
|
if (!m_Sections.TryGetValue(SectionName, out Section))
|
||||||
{
|
{
|
||||||
// *** If it doesn't, add it ***
|
// *** If it Doesn't, Add it ***
|
||||||
Section = new Dictionary<string, string>();
|
Section = new Dictionary<string, string>();
|
||||||
m_Sections.Add(SectionName,Section);
|
m_Sections.Add(SectionName,Section);
|
||||||
}
|
}
|
||||||
@ -474,7 +473,7 @@ namespace STA.Settings
|
|||||||
return DefaultValue;
|
return DefaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal double GetValue(string SectionName, string Key, double DefaultValue)
|
internal Double GetValue(string SectionName, string Key, Double DefaultValue)
|
||||||
{
|
{
|
||||||
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(CultureInfo.InvariantCulture));
|
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(CultureInfo.InvariantCulture));
|
||||||
double Value;
|
double Value;
|
||||||
@ -519,7 +518,7 @@ namespace STA.Settings
|
|||||||
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetValue(string SectionName, string Key, double Value)
|
internal void SetValue(string SectionName, string Key, Double Value)
|
||||||
{
|
{
|
||||||
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
@ -1,12 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
namespace FFXIVClassic.Common
|
||||||
{
|
{
|
||||||
static class Utils
|
public static class Utils
|
||||||
{
|
{
|
||||||
private static readonly uint[] _lookup32 = CreateLookup32();
|
private static readonly uint[] _lookup32 = CreateLookup32();
|
||||||
|
|
||||||
@ -21,28 +18,71 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ByteArrayToHex(byte[] bytes)
|
public static string ByteArrayToHex(byte[] bytes, int offset = 0, int bytesPerLine = 16)
|
||||||
{
|
{
|
||||||
var lookup32 = _lookup32;
|
if (bytes == null)
|
||||||
var result = new char[(bytes.Length * 3) + ((bytes.Length / 16) < 1 ? 1 : (bytes.Length / 16) * 3) + bytes.Length + 60];
|
|
||||||
int numNewLines = 0;
|
|
||||||
for (int i = 0; i < bytes.Length; i++)
|
|
||||||
{
|
{
|
||||||
var val = lookup32[bytes[i]];
|
return String.Empty;
|
||||||
result[(3 * i) + (17 * numNewLines) + 0] = (char)val;
|
|
||||||
result[(3 * i) + (17 * numNewLines) + 1] = (char)(val >> 16);
|
|
||||||
result[(3 * i) + (17 * numNewLines) + 2] = ' ';
|
|
||||||
|
|
||||||
result[(numNewLines * (3 * 16 + 17)) + (3 * 16) + (i % 16)] = (char)bytes[i] >= 32 && (char)bytes[i] <= 126 ? (char)bytes[i] : '.';
|
|
||||||
|
|
||||||
if (i != bytes.Length - 1 && bytes.Length > 16 && i != 0 && (i + 1) % 16 == 0)
|
|
||||||
{
|
|
||||||
result[(numNewLines * (3 * 16 + 17)) + (3 * 16) + (16)] = '\n';
|
|
||||||
numNewLines++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char[] hexChars = "0123456789ABCDEF".ToCharArray();
|
||||||
|
|
||||||
|
// 00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||||
|
// 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
|
||||||
|
int offsetBlock = 8 + 3;
|
||||||
|
int byteBlock = offsetBlock + (bytesPerLine * 3) + ((bytesPerLine - 1) / 8) + 2;
|
||||||
|
int lineLength = byteBlock + bytesPerLine + Environment.NewLine.Length;
|
||||||
|
|
||||||
|
char[] line = (new String(' ', lineLength - Environment.NewLine.Length) + Environment.NewLine).ToCharArray();
|
||||||
|
int numLines = (bytes.Length + bytesPerLine - 1) / bytesPerLine;
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(numLines * lineLength);
|
||||||
|
|
||||||
|
for (int i = 0; i < bytes.Length; i += bytesPerLine)
|
||||||
|
{
|
||||||
|
int h = i + offset;
|
||||||
|
|
||||||
|
line[0] = hexChars[(h >> 28) & 0xF];
|
||||||
|
line[1] = hexChars[(h >> 24) & 0xF];
|
||||||
|
line[2] = hexChars[(h >> 20) & 0xF];
|
||||||
|
line[3] = hexChars[(h >> 16) & 0xF];
|
||||||
|
line[4] = hexChars[(h >> 12) & 0xF];
|
||||||
|
line[5] = hexChars[(h >> 8) & 0xF];
|
||||||
|
line[6] = hexChars[(h >> 4) & 0xF];
|
||||||
|
line[7] = hexChars[(h >> 0) & 0xF];
|
||||||
|
|
||||||
|
int hexColumn = offsetBlock;
|
||||||
|
int charColumn = byteBlock;
|
||||||
|
|
||||||
|
for (int j = 0; j < bytesPerLine; j++)
|
||||||
|
{
|
||||||
|
if (j > 0 && (j & 7) == 0)
|
||||||
|
{
|
||||||
|
hexColumn++;
|
||||||
}
|
}
|
||||||
return new string(result);
|
|
||||||
|
if (i + j >= bytes.Length)
|
||||||
|
{
|
||||||
|
line[hexColumn] = ' ';
|
||||||
|
line[hexColumn + 1] = ' ';
|
||||||
|
line[charColumn] = ' ';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
byte by = bytes[i + j];
|
||||||
|
line[hexColumn] = hexChars[(by >> 4) & 0xF];
|
||||||
|
line[hexColumn + 1] = hexChars[by & 0xF];
|
||||||
|
line[charColumn] = (by < 32 ? '.' : (char)by);
|
||||||
|
}
|
||||||
|
|
||||||
|
hexColumn += 3;
|
||||||
|
charColumn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.Append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt32 UnixTimeStampUTC()
|
public static UInt32 UnixTimeStampUTC()
|
||||||
@ -67,7 +107,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
return unixTimeStamp;
|
return unixTimeStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ulong swapEndian(ulong input)
|
public static ulong SwapEndian(ulong input)
|
||||||
{
|
{
|
||||||
return ((0x00000000000000FF) & (input >> 56) |
|
return ((0x00000000000000FF) & (input >> 56) |
|
||||||
(0x000000000000FF00) & (input >> 40) |
|
(0x000000000000FF00) & (input >> 40) |
|
||||||
@ -79,7 +119,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
(0xFF00000000000000) & (input << 56));
|
(0xFF00000000000000) & (input << 56));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static uint swapEndian(uint input)
|
public static uint SwapEndian(uint input)
|
||||||
{
|
{
|
||||||
return ((input >> 24) & 0xff) |
|
return ((input >> 24) & 0xff) |
|
||||||
((input << 8) & 0xff0000) |
|
((input << 8) & 0xff0000) |
|
||||||
@ -87,7 +127,7 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
((input << 24) & 0xff000000);
|
((input << 24) & 0xff000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int swapEndian(int input)
|
public static int SwapEndian(int input)
|
||||||
{
|
{
|
||||||
uint inputAsUint = (uint)input;
|
uint inputAsUint = (uint)input;
|
||||||
|
|
||||||
@ -179,5 +219,15 @@ namespace FFXIVClassic_Lobby_Server.common
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToStringBase63(int number)
|
||||||
|
{
|
||||||
|
string lookup = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
string secondDigit = lookup.Substring((int)Math.Floor((double)number / (double)lookup.Length), 1);
|
||||||
|
string firstDigit = lookup.Substring(number % lookup.Length, 1);
|
||||||
|
|
||||||
|
return secondDigit + firstDigit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
4
FFXIVClassic Common Class Lib/packages.config
Normal file
4
FFXIVClassic Common Class Lib/packages.config
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="NLog" version="4.3.5" tarGetFramework="net45" />
|
||||||
|
</packages>
|
@ -1,14 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
using System.Diagnostics;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.IO;
|
|
||||||
using Cyotek.Collections.Generic;
|
using Cyotek.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
@ -21,7 +15,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
public Socket socket;
|
public Socket socket;
|
||||||
public byte[] buffer = new byte[0xffff];
|
public byte[] buffer = new byte[0xffff];
|
||||||
public CircularBuffer<byte> incomingStream = new CircularBuffer<byte>(1024);
|
public CircularBuffer<byte> incomingStream = new CircularBuffer<byte>(1024);
|
||||||
public BlockingCollection<BasePacket> sendPacketQueue = new BlockingCollection<BasePacket>(100);
|
public BlockingCollection<BasePacket> SendPacketQueue = new BlockingCollection<BasePacket>(100);
|
||||||
public int lastPartialSize = 0;
|
public int lastPartialSize = 0;
|
||||||
|
|
||||||
//Instance Stuff
|
//Instance Stuff
|
||||||
@ -37,7 +31,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
public ushort newCharaWorldId;
|
public ushort newCharaWorldId;
|
||||||
|
|
||||||
|
|
||||||
public void processIncoming(int bytesIn)
|
public void ProcessIncoming(int bytesIn)
|
||||||
{
|
{
|
||||||
if (bytesIn == 0)
|
if (bytesIn == 0)
|
||||||
return;
|
return;
|
||||||
@ -45,36 +39,36 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
incomingStream.Put(buffer, 0, bytesIn);
|
incomingStream.Put(buffer, 0, bytesIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queuePacket(BasePacket packet)
|
public void QueuePacket(BasePacket packet)
|
||||||
{
|
{
|
||||||
sendPacketQueue.Add(packet);
|
SendPacketQueue.Add(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flushQueuedSendPackets()
|
public void FlushQueuedSendPackets()
|
||||||
{
|
{
|
||||||
if (!socket.Connected)
|
if (!socket.Connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (sendPacketQueue.Count > 0)
|
while (SendPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
BasePacket packet = sendPacketQueue.Take();
|
BasePacket packet = SendPacketQueue.Take();
|
||||||
byte[] packetBytes = packet.getPacketBytes();
|
byte[] packetBytes = packet.GetPacketBytes();
|
||||||
byte[] buffer = new byte[0xffff];
|
byte[] buffer = new byte[0xffff];
|
||||||
Array.Copy(packetBytes, buffer, packetBytes.Length);
|
Array.Copy(packetBytes, buffer, packetBytes.Length);
|
||||||
try {
|
try {
|
||||||
socket.Send(packetBytes);
|
socket.Send(packetBytes);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{ Log.error(String.Format("Weird case, socket was d/ced: {0}", e)); }
|
{ Program.Log.Error("Weird case, socket was d/ced: {0}", e); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddress()
|
public String GetAddress()
|
||||||
{
|
{
|
||||||
return String.Format("{0}:{1}", (socket.RemoteEndPoint as IPEndPoint).Address, (socket.RemoteEndPoint as IPEndPoint).Port);
|
return String.Format("{0}:{1}", (socket.RemoteEndPoint as IPEndPoint).Address, (socket.RemoteEndPoint as IPEndPoint).Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
socket.Shutdown(SocketShutdown.Both);
|
socket.Shutdown(SocketShutdown.Both);
|
||||||
socket.Disconnect(false);
|
socket.Disconnect(false);
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using STA.Settings;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
class ConfigConstants
|
class ConfigConstants
|
||||||
{
|
{
|
||||||
public static String OPTIONS_BINDIP;
|
public static String OPTIONS_BINDIP;
|
||||||
|
public static String OPTIONS_PORT;
|
||||||
public static bool OPTIONS_TIMESTAMP = false;
|
public static bool OPTIONS_TIMESTAMP = false;
|
||||||
|
|
||||||
public static String DATABASE_HOST;
|
public static String DATABASE_HOST;
|
||||||
@ -20,21 +16,22 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
public static String DATABASE_USERNAME;
|
public static String DATABASE_USERNAME;
|
||||||
public static String DATABASE_PASSWORD;
|
public static String DATABASE_PASSWORD;
|
||||||
|
|
||||||
public static bool load()
|
public static bool Load()
|
||||||
{
|
{
|
||||||
Console.Write("Loading config.ini file... ");
|
Console.Write("Loading lobby_config.ini file... ");
|
||||||
|
|
||||||
if (!File.Exists("./config.ini"))
|
if (!File.Exists("./lobby_config.ini"))
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
Console.WriteLine("[FILE NOT FOUND]");
|
Console.WriteLine(String.Format("[FILE NOT FOUND]"));
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIFile configIni = new INIFile("./config.ini");
|
INIFile configIni = new INIFile("./lobby_config.ini");
|
||||||
|
|
||||||
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
|
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
|
||||||
|
ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "54994");
|
||||||
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
|
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
|
||||||
|
|
||||||
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
|
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using FFXIVClassic_Lobby_Server.dataobjects;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Lobby_Server.utils;
|
using FFXIVClassic_Lobby_Server.utils;
|
||||||
|
using FFXIVClassic.Common;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
@ -16,7 +13,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
class Database
|
class Database
|
||||||
{
|
{
|
||||||
public static uint getUserIdFromSession(String sessionId)
|
public static uint GetUserIdFromSession(String sessionId)
|
||||||
{
|
{
|
||||||
uint id = 0;
|
uint id = 0;
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -35,7 +32,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -44,7 +44,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool reserveCharacter(uint userId, uint slot, uint serverId, String name, out uint pid, out uint cid)
|
public static bool ReserveCharacter(uint userId, uint slot, uint serverId, String name, out uint pid, out uint cid)
|
||||||
{
|
{
|
||||||
bool alreadyExists = false;
|
bool alreadyExists = false;
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -88,6 +88,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
pid = 0;
|
pid = 0;
|
||||||
cid = 0;
|
cid = 0;
|
||||||
}
|
}
|
||||||
@ -96,13 +100,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.database(String.Format("CID={0} created on 'characters' table.", cid));
|
Program.Log.Debug("[SQL] CID={0} Created on 'characters' table.", cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return alreadyExists;
|
return alreadyExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void makeCharacter(uint accountId, uint cid, CharaInfo charaInfo)
|
public static void MakeCharacter(uint accountId, uint cid, CharaInfo charaInfo)
|
||||||
{
|
{
|
||||||
//Update character entry
|
//Update character entry
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -179,6 +183,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -202,6 +208,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -222,6 +230,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -232,10 +242,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.database(String.Format("CID={0} state updated to active(2).", cid));
|
Program.Log.Debug("[SQL] CID={0} state updated to active(2).", cid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool renameCharacter(uint userId, uint characterId, uint serverId, String newName)
|
public static bool RenameCharacter(uint userId, uint characterId, uint serverId, String newName)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -257,7 +267,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
cmd = new MySqlCommand();
|
cmd = new MySqlCommand();
|
||||||
cmd.Connection = conn;
|
cmd.Connection = conn;
|
||||||
cmd.CommandText = "UPDATE characters SET name=@name, doRename=0 WHERE id=@cid AND userId=@uid";
|
cmd.CommandText = "UPDATE characters SET name=@name, DoRename=0 WHERE id=@cid AND userId=@uid";
|
||||||
cmd.Prepare();
|
cmd.Prepare();
|
||||||
cmd.Parameters.AddWithValue("@uid", userId);
|
cmd.Parameters.AddWithValue("@uid", userId);
|
||||||
cmd.Parameters.AddWithValue("@cid", characterId);
|
cmd.Parameters.AddWithValue("@cid", characterId);
|
||||||
@ -267,6 +277,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -274,13 +286,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.database(String.Format("CID={0} name updated to \"{1}\".", characterId, newName));
|
Program.Log.Debug("[SQL] CID={0} name updated to \"{1}\".", characterId, newName);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void deleteCharacter(uint characterId, String name)
|
public static void DeleteCharacter(uint characterId, String name)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -298,6 +310,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -306,10 +320,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.database(String.Format("CID={0} deleted.", characterId));
|
Program.Log.Debug("[SQL] CID={0} deleted.", characterId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<World> getServers()
|
public static List<World> GetServers()
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -320,7 +334,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
worldList = conn.Query<World>("SELECT * FROM servers WHERE isActive=true").ToList();
|
worldList = conn.Query<World>("SELECT * FROM servers WHERE isActive=true").ToList();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ worldList = new List<World>(); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
worldList = new List<World>(); }
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -329,7 +345,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static World getServer(uint serverId)
|
public static World GetServer(uint serverId)
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -341,6 +357,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -351,7 +369,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Character> getCharacters(uint userId)
|
public static List<Character> GetCharacters(uint userId)
|
||||||
{
|
{
|
||||||
List<Character> characters = new List<Character>();
|
List<Character> characters = new List<Character>();
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -409,7 +427,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return characters;
|
return characters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Character getCharacter(uint userId, uint charId)
|
public static Character GetCharacter(uint userId, uint charId)
|
||||||
{
|
{
|
||||||
Character chara = null;
|
Character chara = null;
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -464,7 +482,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return chara;
|
return chara;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Appearance getAppearance(uint charaId)
|
public static Appearance GetAppearance(uint charaId)
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -476,6 +494,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -486,7 +506,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getReservedNames(uint userId)
|
public static List<String> GetReservedNames(uint userId)
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -497,7 +517,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
nameList = conn.Query<String>("SELECT name FROM reserved_names WHERE userId=@UserId", new { UserId = userId }).ToList();
|
nameList = conn.Query<String>("SELECT name FROM reserved_names WHERE userId=@UserId", new { UserId = userId }).ToList();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ nameList = new List<String>(); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
nameList = new List<String>(); }
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -506,7 +528,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Retainer> getRetainers(uint userId)
|
public static List<Retainer> GetRetainers(uint userId)
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -517,7 +539,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
retainerList = conn.Query<Retainer>("SELECT * FROM retainers WHERE id=@UserId ORDER BY characterId, slot", new { UserId = userId }).ToList();
|
retainerList = conn.Query<Retainer>("SELECT * FROM retainers WHERE id=@UserId ORDER BY characterId, slot", new { UserId = userId }).ToList();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ retainerList = new List<Retainer>(); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
retainerList = new List<Retainer>(); }
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
|
@ -11,6 +11,21 @@
|
|||||||
<AssemblyName>FFXIVClassic_Lobby_Server</AssemblyName>
|
<AssemblyName>FFXIVClassic_Lobby_Server</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
|
<PublishUrl>publish\</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Disk</InstallFrom>
|
||||||
|
<UpdateEnabled>false</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -40,6 +55,9 @@
|
|||||||
<Reference Include="Dapper">
|
<Reference Include="Dapper">
|
||||||
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
|
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="FFXIVClassic.Common">
|
||||||
|
<HintPath>..\FFXIVClassic Common Class Lib\bin\Debug\FFXIVClassic.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="MySql.Data">
|
<Reference Include="MySql.Data">
|
||||||
<HintPath>..\packages\MySql.Data.6.9.7\lib\net45\MySql.Data.dll</HintPath>
|
<HintPath>..\packages\MySql.Data.6.9.7\lib\net45\MySql.Data.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -47,6 +65,10 @@
|
|||||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.3.4\lib\net45\NLog.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@ -56,17 +78,12 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="common\Bitfield.cs" />
|
|
||||||
<Compile Include="common\Blowfish.cs" />
|
|
||||||
<Compile Include="common\Log.cs" />
|
|
||||||
<Compile Include="common\STA_INIFile.cs" />
|
|
||||||
<Compile Include="dataobjects\Account.cs" />
|
<Compile Include="dataobjects\Account.cs" />
|
||||||
<Compile Include="dataobjects\Appearance.cs" />
|
<Compile Include="dataobjects\Appearance.cs" />
|
||||||
<Compile Include="dataobjects\CharaInfo.cs" />
|
<Compile Include="dataobjects\CharaInfo.cs" />
|
||||||
<Compile Include="dataobjects\Retainer.cs" />
|
<Compile Include="dataobjects\Retainer.cs" />
|
||||||
<Compile Include="dataobjects\Character.cs" />
|
<Compile Include="dataobjects\Character.cs" />
|
||||||
<Compile Include="ClientConnection.cs" />
|
<Compile Include="ClientConnection.cs" />
|
||||||
<Compile Include="common\Utils.cs" />
|
|
||||||
<Compile Include="ConfigConstants.cs" />
|
<Compile Include="ConfigConstants.cs" />
|
||||||
<Compile Include="Database.cs" />
|
<Compile Include="Database.cs" />
|
||||||
<Compile Include="dataobjects\World.cs" />
|
<Compile Include="dataobjects\World.cs" />
|
||||||
@ -92,11 +109,29 @@
|
|||||||
<Compile Include="utils\CharacterCreatorUtils.cs" />
|
<Compile Include="utils\CharacterCreatorUtils.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="NLog.config">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<None Include="NLog.xsd">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy "$(SolutionDir)data\config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
|
<PostBuildEvent>copy "$(SolutionDir)data\lobby_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
45
FFXIVClassic Lobby Server/NLog.config
Normal file
45
FFXIVClassic Lobby Server/NLog.config
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||||
|
|
||||||
|
|
||||||
|
<!-- optional, add some variabeles
|
||||||
|
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||||
|
-->
|
||||||
|
<variable name="myvar" value="myvalue"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||||
|
for information on customizing logging rules and outputs.
|
||||||
|
-->
|
||||||
|
<targets async="true">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
add your targets here
|
||||||
|
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||||
|
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write events to a file with the date in the filename.
|
||||||
|
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||||
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
|
-->
|
||||||
|
<target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
|
||||||
|
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/lobby.log" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<!-- add your logging rules here -->
|
||||||
|
<logger name='*' minlevel='Trace' writeTo='file' />
|
||||||
|
<logger name='*' minlevel='Trace' writeTo='console' />
|
||||||
|
<!--
|
||||||
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
2601
FFXIVClassic Lobby Server/NLog.xsd
Normal file
2601
FFXIVClassic Lobby Server/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,43 +1,38 @@
|
|||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using FFXIVClassic_Lobby_Server.dataobjects;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
using FFXIVClassic_Lobby_Server.packets.receive;
|
using FFXIVClassic_Lobby_Server.packets.receive;
|
||||||
using FFXIVClassic_Lobby_Server.utils;
|
using FFXIVClassic_Lobby_Server.utils;
|
||||||
using MySql.Data.MySqlClient;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
class PacketProcessor
|
class PacketProcessor
|
||||||
{
|
{
|
||||||
|
|
||||||
public void processPacket(ClientConnection client, BasePacket packet)
|
public void ProcessPacket(ClientConnection client, BasePacket packet)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((packet.header.packetSize == 0x288) && (packet.data[0x34] == 'T')) //Test Ticket Data
|
if ((packet.header.packetSize == 0x288) && (packet.data[0x34] == 'T')) //Test Ticket Data
|
||||||
{
|
{
|
||||||
packet.debugPrintPacket();
|
packet.DebugPrintPacket();
|
||||||
//Crypto handshake
|
//Crypto handshake
|
||||||
ProcessStartSession(client, packet);
|
ProcessStartSession(client, packet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BasePacket.decryptPacket(client.blowfish, ref packet);
|
BasePacket.DecryptPacket(client.blowfish, ref packet);
|
||||||
|
|
||||||
packet.debugPrintPacket();
|
packet.DebugPrintPacket();
|
||||||
|
|
||||||
List<SubPacket> subPackets = packet.getSubpackets();
|
List<SubPacket> subPackets = packet.GetSubpackets();
|
||||||
foreach (SubPacket subpacket in subPackets)
|
foreach (SubPacket subpacket in subPackets)
|
||||||
{
|
{
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
|
|
||||||
if (subpacket.header.type == 3)
|
if (subpacket.header.type == 3)
|
||||||
{
|
{
|
||||||
@ -58,7 +53,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
case 0x0F:
|
case 0x0F:
|
||||||
//Mod Retainers
|
//Mod Retainers
|
||||||
default:
|
default:
|
||||||
Log.debug(String.Format("Unknown command 0x{0:X} received.", subpacket.gameMessage.opcode));
|
Program.Log.Debug("Unknown command 0x{0:X} received.", subpacket.gameMessage.opcode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -72,40 +67,40 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
byte[] blowfishKey = GenerateKey(securityHandshake.ticketPhrase, securityHandshake.clientNumber);
|
byte[] blowfishKey = GenerateKey(securityHandshake.ticketPhrase, securityHandshake.clientNumber);
|
||||||
client.blowfish = new Blowfish(blowfishKey);
|
client.blowfish = new Blowfish(blowfishKey);
|
||||||
|
|
||||||
Log.info(String.Format("SecCNum: 0x{0:X}", securityHandshake.clientNumber));
|
Program.Log.Info("SecCNum: 0x{0:X}", securityHandshake.clientNumber);
|
||||||
|
|
||||||
//Respond with acknowledgment
|
//Respond with acknowledgment
|
||||||
BasePacket outgoingPacket = new BasePacket(HardCoded_Packets.g_secureConnectionAcknowledgment);
|
BasePacket outgoingPacket = new BasePacket(HardCoded_Packets.g_secureConnectionAcknowledgment);
|
||||||
BasePacket.encryptPacket(client.blowfish, outgoingPacket);
|
BasePacket.EncryptPacket(client.blowfish, outgoingPacket);
|
||||||
client.queuePacket(outgoingPacket);
|
client.QueuePacket(outgoingPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessSessionAcknowledgement(ClientConnection client, SubPacket packet)
|
private void ProcessSessionAcknowledgement(ClientConnection client, SubPacket packet)
|
||||||
{
|
{
|
||||||
packet.debugPrintSubPacket();
|
packet.DebugPrintSubPacket();
|
||||||
SessionPacket sessionPacket = new SessionPacket(packet.data);
|
SessionPacket sessionPacket = new SessionPacket(packet.data);
|
||||||
String clientVersion = sessionPacket.version;
|
String clientVersion = sessionPacket.version;
|
||||||
|
|
||||||
Log.info(String.Format("Got acknowledgment for secure session."));
|
Program.Log.Info("Got acknowledgment for secure session.");
|
||||||
Log.info(String.Format("CLIENT VERSION: {0}", clientVersion));
|
Program.Log.Info("CLIENT VERSION: {0}", clientVersion);
|
||||||
|
|
||||||
uint userId = Database.getUserIdFromSession(sessionPacket.session);
|
uint userId = Database.GetUserIdFromSession(sessionPacket.session);
|
||||||
client.currentUserId = userId;
|
client.currentUserId = userId;
|
||||||
client.currentSessionToken = sessionPacket.session; ;
|
client.currentSessionToken = sessionPacket.session; ;
|
||||||
|
|
||||||
if (userId == 0)
|
if (userId == 0)
|
||||||
{
|
{
|
||||||
ErrorPacket errorPacket = new ErrorPacket(sessionPacket.sequence, 0, 0, 13001, "Your session has expired, please login again.");
|
ErrorPacket errorPacket = new ErrorPacket(sessionPacket.sequence, 0, 0, 13001, "Your session has expired, please login again.");
|
||||||
SubPacket subpacket = errorPacket.buildPacket();
|
SubPacket subpacket = errorPacket.BuildPacket();
|
||||||
BasePacket errorBasePacket = BasePacket.createPacket(subpacket, true, false);
|
BasePacket errorBasePacket = BasePacket.CreatePacket(subpacket, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, errorBasePacket);
|
BasePacket.EncryptPacket(client.blowfish, errorBasePacket);
|
||||||
client.queuePacket(errorBasePacket);
|
client.QueuePacket(errorBasePacket);
|
||||||
|
|
||||||
Log.info(String.Format("Invalid session, kicking..."));
|
Program.Log.Info("Invalid session, kicking...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("USER ID: {0}", userId));
|
Program.Log.Info("USER ID: {0}", userId);
|
||||||
|
|
||||||
List<Account> accountList = new List<Account>();
|
List<Account> accountList = new List<Account>();
|
||||||
Account defaultAccount = new Account();
|
Account defaultAccount = new Account();
|
||||||
@ -113,19 +108,19 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
defaultAccount.name = "FINAL FANTASY XIV";
|
defaultAccount.name = "FINAL FANTASY XIV";
|
||||||
accountList.Add(defaultAccount);
|
accountList.Add(defaultAccount);
|
||||||
AccountListPacket listPacket = new AccountListPacket(1, accountList);
|
AccountListPacket listPacket = new AccountListPacket(1, accountList);
|
||||||
BasePacket basePacket = BasePacket.createPacket(listPacket.buildPackets(), true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(listPacket.BuildPackets(), true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessGetCharacters(ClientConnection client, SubPacket packet)
|
private void ProcessGetCharacters(ClientConnection client, SubPacket packet)
|
||||||
{
|
{
|
||||||
Log.info(String.Format("{0} => Get characters", client.currentUserId == 0 ? client.getAddress() : "User " + client.currentUserId));
|
Program.Log.Info("{0} => Get characters", client.currentUserId == 0 ? client.GetAddress() : "User " + client.currentUserId);
|
||||||
|
|
||||||
sendWorldList(client, packet);
|
SendWorldList(client, packet);
|
||||||
sendImportList(client, packet);
|
SendImportList(client, packet);
|
||||||
sendRetainerList(client, packet);
|
SendRetainerList(client, packet);
|
||||||
sendCharacterList(client, packet);
|
SendCharacterList(client, packet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,29 +128,29 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
SelectCharacterPacket selectCharRequest = new SelectCharacterPacket(packet.data);
|
SelectCharacterPacket selectCharRequest = new SelectCharacterPacket(packet.data);
|
||||||
|
|
||||||
Log.info(String.Format("{0} => Select character id {1}", client.currentUserId == 0 ? client.getAddress() : "User " + client.currentUserId, selectCharRequest.characterId));
|
Program.Log.Info("{0} => Select character id {1}", client.currentUserId == 0 ? client.GetAddress() : "User " + client.currentUserId, selectCharRequest.characterId);
|
||||||
|
|
||||||
Character chara = Database.getCharacter(client.currentUserId, selectCharRequest.characterId);
|
Character chara = Database.GetCharacter(client.currentUserId, selectCharRequest.characterId);
|
||||||
World world = null;
|
World world = null;
|
||||||
|
|
||||||
if (chara != null)
|
if (chara != null)
|
||||||
world = Database.getServer(chara.serverId);
|
world = Database.GetServer(chara.serverId);
|
||||||
|
|
||||||
if (world == null)
|
if (world == null)
|
||||||
{
|
{
|
||||||
ErrorPacket errorPacket = new ErrorPacket(selectCharRequest.sequence, 0, 0, 13001, "World does not exist or is inactive.");
|
ErrorPacket errorPacket = new ErrorPacket(selectCharRequest.sequence, 0, 0, 13001, "World Does not exist or is inactive.");
|
||||||
SubPacket subpacket = errorPacket.buildPacket();
|
SubPacket subpacket = errorPacket.BuildPacket();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subpacket, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectCharacterConfirmPacket connectCharacter = new SelectCharacterConfirmPacket(selectCharRequest.sequence, selectCharRequest.characterId, client.currentSessionToken, world.address, world.port, selectCharRequest.ticket);
|
SelectCharacterConfirmPacket connectCharacter = new SelectCharacterConfirmPacket(selectCharRequest.sequence, selectCharRequest.characterId, client.currentSessionToken, world.address, world.port, selectCharRequest.ticket);
|
||||||
|
|
||||||
BasePacket outgoingPacket = BasePacket.createPacket(connectCharacter.buildPackets(), true, false);
|
BasePacket outgoingPacket = BasePacket.CreatePacket(connectCharacter.BuildPackets(), true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, outgoingPacket);
|
BasePacket.EncryptPacket(client.blowfish, outgoingPacket);
|
||||||
client.queuePacket(outgoingPacket);
|
client.QueuePacket(outgoingPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProcessModifyCharacter(ClientConnection client, SubPacket packet)
|
private void ProcessModifyCharacter(ClientConnection client, SubPacket packet)
|
||||||
@ -171,28 +166,28 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (worldId == 0)
|
if (worldId == 0)
|
||||||
worldId = client.newCharaWorldId;
|
worldId = client.newCharaWorldId;
|
||||||
|
|
||||||
//Check if this character exists, get world from there
|
//Check if this character exists, Get world from there
|
||||||
if (worldId == 0 && charaReq.characterId != 0)
|
if (worldId == 0 && charaReq.characterId != 0)
|
||||||
{
|
{
|
||||||
Character chara = Database.getCharacter(client.currentUserId, charaReq.characterId);
|
Character chara = Database.GetCharacter(client.currentUserId, charaReq.characterId);
|
||||||
if (chara != null)
|
if (chara != null)
|
||||||
worldId = chara.serverId;
|
worldId = chara.serverId;
|
||||||
}
|
}
|
||||||
|
|
||||||
string worldName = null;
|
string worldName = null;
|
||||||
World world = Database.getServer(worldId);
|
World world = Database.GetServer(worldId);
|
||||||
if (world != null)
|
if (world != null)
|
||||||
worldName = world.name;
|
worldName = world.name;
|
||||||
|
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
{
|
{
|
||||||
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 0, 0, 13001, "World does not exist or is inactive.");
|
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 0, 0, 13001, "World Does not exist or is inactive.");
|
||||||
SubPacket subpacket = errorPacket.buildPacket();
|
SubPacket subpacket = errorPacket.BuildPacket();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subpacket, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Error; invalid server id: \"{1}\"", client.currentUserId, worldId));
|
Program.Log.Info("User {0} => Error; invalid server id: \"{1}\"", client.currentUserId, worldId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,17 +197,17 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
case 0x01://Reserve
|
case 0x01://Reserve
|
||||||
|
|
||||||
alreadyTaken = Database.reserveCharacter(client.currentUserId, slot, worldId, name, out pid, out cid);
|
alreadyTaken = Database.ReserveCharacter(client.currentUserId, slot, worldId, name, out pid, out cid);
|
||||||
|
|
||||||
if (alreadyTaken)
|
if (alreadyTaken)
|
||||||
{
|
{
|
||||||
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 1003, 0, 13005, ""); //BDB - Chara Name Used, //1003 - Bad Word
|
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 1003, 0, 13005, ""); //BDB - Chara Name Used, //1003 - Bad Word
|
||||||
SubPacket subpacket = errorPacket.buildPacket();
|
SubPacket subpacket = errorPacket.BuildPacket();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subpacket, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Error; name taken: \"{1}\"", client.currentUserId, charaReq.characterName));
|
Program.Log.Info("User {0} => Error; name taken: \"{1}\"", client.currentUserId, charaReq.characterName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -224,10 +219,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
client.newCharaName = name;
|
client.newCharaName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Character reserved \"{1}\"", client.currentUserId, name));
|
Program.Log.Info("User {0} => Character reserved \"{1}\"", client.currentUserId, name);
|
||||||
break;
|
break;
|
||||||
case 0x02://Make
|
case 0x02://Make
|
||||||
CharaInfo info = CharaInfo.getFromNewCharRequest(charaReq.characterInfoEncoded);
|
CharaInfo info = CharaInfo.GetFromNewCharRequest(charaReq.characterInfoEncoded);
|
||||||
|
|
||||||
//Set Initial Appearance (items will be loaded in by map server)
|
//Set Initial Appearance (items will be loaded in by map server)
|
||||||
uint[] classAppearance = CharacterCreatorUtils.GetEquipmentForClass(info.currentClass);
|
uint[] classAppearance = CharacterCreatorUtils.GetEquipmentForClass(info.currentClass);
|
||||||
@ -271,96 +266,96 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Database.makeCharacter(client.currentUserId, client.newCharaCid, info);
|
Database.MakeCharacter(client.currentUserId, client.newCharaCid, info);
|
||||||
|
|
||||||
pid = 1;
|
pid = 1;
|
||||||
cid = client.newCharaCid;
|
cid = client.newCharaCid;
|
||||||
name = client.newCharaName;
|
name = client.newCharaName;
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Character created \"{1}\"", client.currentUserId, name));
|
Program.Log.Info("User {0} => Character Created \"{1}\"", client.currentUserId, name);
|
||||||
break;
|
break;
|
||||||
case 0x03://Rename
|
case 0x03://Rename
|
||||||
|
|
||||||
alreadyTaken = Database.renameCharacter(client.currentUserId, charaReq.characterId, worldId, charaReq.characterName);
|
alreadyTaken = Database.RenameCharacter(client.currentUserId, charaReq.characterId, worldId, charaReq.characterName);
|
||||||
|
|
||||||
if (alreadyTaken)
|
if (alreadyTaken)
|
||||||
{
|
{
|
||||||
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 1003, 0, 13005, ""); //BDB - Chara Name Used, //1003 - Bad Word
|
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 1003, 0, 13005, ""); //BDB - Chara Name Used, //1003 - Bad Word
|
||||||
SubPacket subpacket = errorPacket.buildPacket();
|
SubPacket subpacket = errorPacket.BuildPacket();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subpacket, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Error; name taken: \"{1}\"", client.currentUserId, charaReq.characterName));
|
Program.Log.Info("User {0} => Error; name taken: \"{1}\"", client.currentUserId, charaReq.characterName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Character renamed \"{1}\"", client.currentUserId, name));
|
Program.Log.Info("User {0} => Character renamed \"{1}\"", client.currentUserId, name);
|
||||||
break;
|
break;
|
||||||
case 0x04://Delete
|
case 0x04://Delete
|
||||||
Database.deleteCharacter(charaReq.characterId, charaReq.characterName);
|
Database.DeleteCharacter(charaReq.characterId, charaReq.characterName);
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Character deleted \"{1}\"", client.currentUserId, name));
|
Program.Log.Info("User {0} => Character deleted \"{1}\"", client.currentUserId, name);
|
||||||
break;
|
break;
|
||||||
case 0x06://Rename Retainer
|
case 0x06://Rename Retainer
|
||||||
|
|
||||||
Log.info(String.Format("User {0} => Retainer renamed \"{1}\"", client.currentUserId, name));
|
Program.Log.Info("User {0} => Retainer renamed \"{1}\"", client.currentUserId, name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharaCreatorPacket charaCreator = new CharaCreatorPacket(charaReq.sequence, charaReq.command, pid, cid, 1, name, worldName);
|
CharaCreatorPacket charaCreator = new CharaCreatorPacket(charaReq.sequence, charaReq.command, pid, cid, 1, name, worldName);
|
||||||
BasePacket charaCreatorPacket = BasePacket.createPacket(charaCreator.buildPacket(), true, false);
|
BasePacket charaCreatorPacket = BasePacket.CreatePacket(charaCreator.BuildPacket(), true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, charaCreatorPacket);
|
BasePacket.EncryptPacket(client.blowfish, charaCreatorPacket);
|
||||||
client.queuePacket(charaCreatorPacket);
|
client.QueuePacket(charaCreatorPacket);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendWorldList(ClientConnection client, SubPacket packet)
|
private void SendWorldList(ClientConnection client, SubPacket packet)
|
||||||
{
|
{
|
||||||
List<World> serverList = Database.getServers();
|
List<World> serverList = Database.GetServers();
|
||||||
WorldListPacket worldlistPacket = new WorldListPacket(0, serverList);
|
WorldListPacket worldlistPacket = new WorldListPacket(0, serverList);
|
||||||
List<SubPacket> subPackets = worldlistPacket.buildPackets();
|
List<SubPacket> subPackets = worldlistPacket.BuildPackets();
|
||||||
|
|
||||||
BasePacket basePacket = BasePacket.createPacket(subPackets, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subPackets, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendImportList(ClientConnection client, SubPacket packet)
|
private void SendImportList(ClientConnection client, SubPacket packet)
|
||||||
{
|
{
|
||||||
List<String> names = Database.getReservedNames(client.currentUserId);
|
List<String> names = Database.GetReservedNames(client.currentUserId);
|
||||||
|
|
||||||
ImportListPacket importListPacket = new ImportListPacket(0, names);
|
ImportListPacket importListPacket = new ImportListPacket(0, names);
|
||||||
List<SubPacket> subPackets = importListPacket.buildPackets();
|
List<SubPacket> subPackets = importListPacket.BuildPackets();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subPackets, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subPackets, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendRetainerList(ClientConnection client, SubPacket packet)
|
private void SendRetainerList(ClientConnection client, SubPacket packet)
|
||||||
{
|
{
|
||||||
List<Retainer> retainers = Database.getRetainers(client.currentUserId);
|
List<Retainer> retainers = Database.GetRetainers(client.currentUserId);
|
||||||
|
|
||||||
RetainerListPacket retainerListPacket = new RetainerListPacket(0, retainers);
|
RetainerListPacket retainerListPacket = new RetainerListPacket(0, retainers);
|
||||||
List<SubPacket> subPackets = retainerListPacket.buildPackets();
|
List<SubPacket> subPackets = retainerListPacket.BuildPackets();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subPackets, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subPackets, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendCharacterList(ClientConnection client, SubPacket packet)
|
private void SendCharacterList(ClientConnection client, SubPacket packet)
|
||||||
{
|
{
|
||||||
List<Character> characterList = Database.getCharacters(client.currentUserId);
|
List<Character> characterList = Database.GetCharacters(client.currentUserId);
|
||||||
|
|
||||||
if (characterList.Count > 8)
|
if (characterList.Count > 8)
|
||||||
Log.error("Warning, got more than 8 characters. List truncated, check DB for issues.");
|
Program.Log.Error("Warning, got more than 8 characters. List truncated, check DB for issues.");
|
||||||
|
|
||||||
CharacterListPacket characterlistPacket = new CharacterListPacket(0, characterList);
|
CharacterListPacket characterlistPacket = new CharacterListPacket(0, characterList);
|
||||||
List<SubPacket> subPackets = characterlistPacket.buildPackets();
|
List<SubPacket> subPackets = characterlistPacket.BuildPackets();
|
||||||
BasePacket basePacket = BasePacket.createPacket(subPackets, true, false);
|
BasePacket basePacket = BasePacket.CreatePacket(subPackets, true, false);
|
||||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
BasePacket.EncryptPacket(client.blowfish, basePacket);
|
||||||
client.queuePacket(basePacket);
|
client.QueuePacket(basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] GenerateKey(string ticketPhrase, uint clientNumber)
|
private byte[] GenerateKey(string ticketPhrase, uint clientNumber)
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using FFXIVClassic.Common;
|
||||||
|
using NLog;
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
|
public static Logger Log;
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
@ -21,36 +20,35 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
//Load Config
|
||||||
Console.WriteLine("--------FFXIV 1.0 Lobby Server--------");
|
if (!ConfigConstants.Load())
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
startServer = false;
|
||||||
|
|
||||||
|
Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
Program.Log.Info("--------FFXIV 1.0 Lobby Server--------");
|
||||||
|
|
||||||
|
|
||||||
Assembly assem = Assembly.GetExecutingAssembly();
|
Assembly assem = Assembly.GetExecutingAssembly();
|
||||||
Version vers = assem.GetName().Version;
|
Version vers = assem.GetName().Version;
|
||||||
Console.WriteLine("Version: " + vers.ToString());
|
Program.Log.Info("Version: " + vers.ToString());
|
||||||
|
|
||||||
//Load Config
|
|
||||||
if (!ConfigConstants.load())
|
|
||||||
startServer = false;
|
|
||||||
|
|
||||||
//Test DB Connection
|
//Test DB Connection
|
||||||
Console.Write("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST);
|
Program.Log.Info("Testing DB connection to \"{0}\"... ", ConfigConstants.DATABASE_HOST);
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.WriteLine("[OK]");
|
Program.Log.Info("[OK]");
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Program.Log.Error(e.ToString());
|
||||||
Console.WriteLine("[FAILED]");
|
Program.Log.Error("[FAILED]");
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
startServer = false;
|
startServer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,12 +57,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (startServer)
|
if (startServer)
|
||||||
{
|
{
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
server.startServer();
|
server.StartServer();
|
||||||
|
|
||||||
while (true) Thread.Sleep(10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Press any key to continue...");
|
Program.Log.Info("Press any key to continue...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
|
using FFXIVClassic.Common;
|
||||||
|
using NLog;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
@ -26,9 +24,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
private Thread cleanupThread;
|
private Thread cleanupThread;
|
||||||
private bool killCleanupThread = false;
|
private bool killCleanupThread = false;
|
||||||
|
|
||||||
private void socketCleanup()
|
private void SocketCleanup()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Cleanup thread started; it will run every {0} seconds.", CLEANUP_THREAD_SLEEP_TIME);
|
Program.Log.Info("Cleanup thread started; it will run every {0} seconds.", CLEANUP_THREAD_SLEEP_TIME);
|
||||||
while (!killCleanupThread)
|
while (!killCleanupThread)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -43,26 +41,26 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
Log.conn(String.Format("{0} connections were cleaned up.", count));
|
Program.Log.Info("{0} connections were cleaned up.", count);
|
||||||
Thread.Sleep(CLEANUP_THREAD_SLEEP_TIME*1000);
|
Thread.Sleep(CLEANUP_THREAD_SLEEP_TIME*1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Socket Handling
|
#region Socket Handling
|
||||||
public bool startServer()
|
public bool StartServer()
|
||||||
{
|
{
|
||||||
//cleanupThread = new Thread(new ThreadStart(socketCleanup));
|
//cleanupThread = new Thread(new ThreadStart(socketCleanup));
|
||||||
//cleanupThread.Name = "LobbyThread:Cleanup";
|
//cleanupThread.Name = "LobbyThread:Cleanup";
|
||||||
//cleanupThread.Start();
|
//cleanupThread.Start();
|
||||||
|
|
||||||
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_LOBBY_PORT);
|
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT));
|
||||||
|
|
||||||
try{
|
try{
|
||||||
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
mServerSocket = new System.Net.Sockets.Socket(serverEndPoint.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApplicationException("Could not create socket, check to make sure not duplicating port", e);
|
throw new ApplicationException("Could not Create socket, check to make sure not duplicating port", e);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -75,16 +73,15 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApplicationException("Error occured starting listeners, check inner exception", e);
|
throw new ApplicationException("Error occured starting listeners, check inner exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.Write("Server has started @ ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
Console.WriteLine("{0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
Program.Log.Debug("Lobby Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
|
|
||||||
mProcessor = new PacketProcessor();
|
mProcessor = new PacketProcessor();
|
||||||
@ -92,7 +89,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void acceptCallback(IAsyncResult result)
|
private void AcceptCallback(IAsyncResult result)
|
||||||
{
|
{
|
||||||
ClientConnection conn = null;
|
ClientConnection conn = null;
|
||||||
try
|
try
|
||||||
@ -106,10 +103,10 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Add(conn);
|
mConnectionList.Add(conn);
|
||||||
}
|
}
|
||||||
//Queue recieving of data from the connection
|
//Queue recieving of data from the connection
|
||||||
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), conn);
|
||||||
//Queue the accept of the next incomming connection
|
//Queue the accept of the next incomming connection
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
Log.conn(String.Format("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port));
|
Program.Log.Info("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port);
|
||||||
}
|
}
|
||||||
catch (SocketException)
|
catch (SocketException)
|
||||||
{
|
{
|
||||||
@ -121,7 +118,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -133,11 +130,11 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void receiveCallback(IAsyncResult result)
|
private void ReceiveCallback(IAsyncResult result)
|
||||||
{
|
{
|
||||||
ClientConnection conn = (ClientConnection)result.AsyncState;
|
ClientConnection conn = (ClientConnection)result.AsyncState;
|
||||||
|
|
||||||
@ -154,13 +151,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
//Build packets until can no longer or out of data
|
//Build packets until can no longer or out of data
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
BasePacket basePacket = BuildPacket(ref offset, conn.buffer, bytesRead);
|
||||||
|
|
||||||
//If can't build packet, break, else process another
|
//If can't build packet, break, else process another
|
||||||
if (basePacket == null)
|
if (basePacket == null)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
mProcessor.processPacket(conn, basePacket);
|
mProcessor.ProcessPacket(conn, basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Not all bytes consumed, transfer leftover to beginning
|
//Not all bytes consumed, transfer leftover to beginning
|
||||||
@ -172,22 +169,22 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
conn.lastPartialSize = bytesRead - offset;
|
conn.lastPartialSize = bytesRead - offset;
|
||||||
|
|
||||||
//Build any queued subpackets into basepackets and send
|
//Build any queued subpackets into basepackets and send
|
||||||
conn.flushQueuedSendPackets();
|
conn.FlushQueuedSendPackets();
|
||||||
|
|
||||||
if (offset < bytesRead)
|
if (offset < bytesRead)
|
||||||
//Need offset since not all bytes consumed
|
//Need offset since not all bytes consumed
|
||||||
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(ReceiveCallback), conn);
|
||||||
else
|
else
|
||||||
//All bytes consumed, full buffer available
|
//All bytes consumed, full buffer available
|
||||||
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), conn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.conn(String.Format("{0} has disconnected.", conn.currentUserId == 0 ? conn.getAddress() : "User " + conn.currentUserId));
|
Program.Log.Info("{0} has disconnected.", conn.currentUserId == 0 ? conn.GetAddress() : "User " + conn.currentUserId);
|
||||||
|
|
||||||
lock (mConnectionList)
|
lock (mConnectionList)
|
||||||
{
|
{
|
||||||
conn.disconnect();
|
conn.Disconnect();
|
||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,7 +193,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (conn.socket != null)
|
if (conn.socket != null)
|
||||||
{
|
{
|
||||||
Log.conn(String.Format("{0} has disconnected.", conn.currentUserId == 0 ? conn.getAddress() : "User " + conn.currentUserId));
|
Program.Log.Info("{0} has disconnected.", conn.currentUserId == 0 ? conn.GetAddress() : "User " + conn.currentUserId);
|
||||||
|
|
||||||
lock (mConnectionList)
|
lock (mConnectionList)
|
||||||
{
|
{
|
||||||
@ -212,7 +209,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
/// <param name="offset">Current offset in buffer.</param>
|
/// <param name="offset">Current offset in buffer.</param>
|
||||||
/// <param name="buffer">Incoming buffer.</param>
|
/// <param name="buffer">Incoming buffer.</param>
|
||||||
/// <returns>Returns either a BasePacket or null if not enough data.</returns>
|
/// <returns>Returns either a BasePacket or null if not enough data.</returns>
|
||||||
public BasePacket buildPacket(ref int offset, byte[] buffer, int bytesRead)
|
public BasePacket BuildPacket(ref int offset, byte[] buffer, int bytesRead)
|
||||||
{
|
{
|
||||||
BasePacket newPacket = null;
|
BasePacket newPacket = null;
|
||||||
|
|
||||||
|
@ -1,460 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
|
||||||
{
|
|
||||||
public class Blowfish
|
|
||||||
{
|
|
||||||
const int N = 16;
|
|
||||||
UInt32 [] P = new uint[16 + 2];
|
|
||||||
UInt32 [,] S = new UInt32[4,256];
|
|
||||||
|
|
||||||
#region P and S Values
|
|
||||||
|
|
||||||
byte [] P_values =
|
|
||||||
{
|
|
||||||
0x88, 0x6A, 0x3F, 0x24, 0xD3, 0x08, 0xA3, 0x85, 0x2E, 0x8A, 0x19, 0x13, 0x44, 0x73, 0x70, 0x03,
|
|
||||||
0x22, 0x38, 0x09, 0xA4, 0xD0, 0x31, 0x9F, 0x29, 0x98, 0xFA, 0x2E, 0x08, 0x89, 0x6C, 0x4E, 0xEC,
|
|
||||||
0xE6, 0x21, 0x28, 0x45, 0x77, 0x13, 0xD0, 0x38, 0xCF, 0x66, 0x54, 0xBE, 0x6C, 0x0C, 0xE9, 0x34,
|
|
||||||
0xB7, 0x29, 0xAC, 0xC0, 0xDD, 0x50, 0x7C, 0xC9, 0xB5, 0xD5, 0x84, 0x3F, 0x17, 0x09, 0x47, 0xB5,
|
|
||||||
0xD9, 0xD5, 0x16, 0x92, 0x1B, 0xFB, 0x79, 0x89
|
|
||||||
};
|
|
||||||
|
|
||||||
byte [] S_values =
|
|
||||||
{
|
|
||||||
0xA6, 0x0B, 0x31, 0xD1, 0xAC, 0xB5, 0xDF, 0x98, 0xDB, 0x72, 0xFD, 0x2F, 0xB7, 0xDF, 0x1A, 0xD0,
|
|
||||||
0xED, 0xAF, 0xE1, 0xB8, 0x96, 0x7E, 0x26, 0x6A, 0x45, 0x90, 0x7C, 0xBA, 0x99, 0x7F, 0x2C, 0xF1,
|
|
||||||
0x47, 0x99, 0xA1, 0x24, 0xF7, 0x6C, 0x91, 0xB3, 0xE2, 0xF2, 0x01, 0x08, 0x16, 0xFC, 0x8E, 0x85,
|
|
||||||
0xD8, 0x20, 0x69, 0x63, 0x69, 0x4E, 0x57, 0x71, 0xA3, 0xFE, 0x58, 0xA4, 0x7E, 0x3D, 0x93, 0xF4,
|
|
||||||
0x8F, 0x74, 0x95, 0x0D, 0x58, 0xB6, 0x8E, 0x72, 0x58, 0xCD, 0x8B, 0x71, 0xEE, 0x4A, 0x15, 0x82,
|
|
||||||
0x1D, 0xA4, 0x54, 0x7B, 0xB5, 0x59, 0x5A, 0xC2, 0x39, 0xD5, 0x30, 0x9C, 0x13, 0x60, 0xF2, 0x2A,
|
|
||||||
0x23, 0xB0, 0xD1, 0xC5, 0xF0, 0x85, 0x60, 0x28, 0x18, 0x79, 0x41, 0xCA, 0xEF, 0x38, 0xDB, 0xB8,
|
|
||||||
0xB0, 0xDC, 0x79, 0x8E, 0x0E, 0x18, 0x3A, 0x60, 0x8B, 0x0E, 0x9E, 0x6C, 0x3E, 0x8A, 0x1E, 0xB0,
|
|
||||||
0xC1, 0x77, 0x15, 0xD7, 0x27, 0x4B, 0x31, 0xBD, 0xDA, 0x2F, 0xAF, 0x78, 0x60, 0x5C, 0x60, 0x55,
|
|
||||||
0xF3, 0x25, 0x55, 0xE6, 0x94, 0xAB, 0x55, 0xAA, 0x62, 0x98, 0x48, 0x57, 0x40, 0x14, 0xE8, 0x63,
|
|
||||||
0x6A, 0x39, 0xCA, 0x55, 0xB6, 0x10, 0xAB, 0x2A, 0x34, 0x5C, 0xCC, 0xB4, 0xCE, 0xE8, 0x41, 0x11,
|
|
||||||
0xAF, 0x86, 0x54, 0xA1, 0x93, 0xE9, 0x72, 0x7C, 0x11, 0x14, 0xEE, 0xB3, 0x2A, 0xBC, 0x6F, 0x63,
|
|
||||||
0x5D, 0xC5, 0xA9, 0x2B, 0xF6, 0x31, 0x18, 0x74, 0x16, 0x3E, 0x5C, 0xCE, 0x1E, 0x93, 0x87, 0x9B,
|
|
||||||
0x33, 0xBA, 0xD6, 0xAF, 0x5C, 0xCF, 0x24, 0x6C, 0x81, 0x53, 0x32, 0x7A, 0x77, 0x86, 0x95, 0x28,
|
|
||||||
0x98, 0x48, 0x8F, 0x3B, 0xAF, 0xB9, 0x4B, 0x6B, 0x1B, 0xE8, 0xBF, 0xC4, 0x93, 0x21, 0x28, 0x66,
|
|
||||||
0xCC, 0x09, 0xD8, 0x61, 0x91, 0xA9, 0x21, 0xFB, 0x60, 0xAC, 0x7C, 0x48, 0x32, 0x80, 0xEC, 0x5D,
|
|
||||||
0x5D, 0x5D, 0x84, 0xEF, 0xB1, 0x75, 0x85, 0xE9, 0x02, 0x23, 0x26, 0xDC, 0x88, 0x1B, 0x65, 0xEB,
|
|
||||||
0x81, 0x3E, 0x89, 0x23, 0xC5, 0xAC, 0x96, 0xD3, 0xF3, 0x6F, 0x6D, 0x0F, 0x39, 0x42, 0xF4, 0x83,
|
|
||||||
0x82, 0x44, 0x0B, 0x2E, 0x04, 0x20, 0x84, 0xA4, 0x4A, 0xF0, 0xC8, 0x69, 0x5E, 0x9B, 0x1F, 0x9E,
|
|
||||||
0x42, 0x68, 0xC6, 0x21, 0x9A, 0x6C, 0xE9, 0xF6, 0x61, 0x9C, 0x0C, 0x67, 0xF0, 0x88, 0xD3, 0xAB,
|
|
||||||
0xD2, 0xA0, 0x51, 0x6A, 0x68, 0x2F, 0x54, 0xD8, 0x28, 0xA7, 0x0F, 0x96, 0xA3, 0x33, 0x51, 0xAB,
|
|
||||||
0x6C, 0x0B, 0xEF, 0x6E, 0xE4, 0x3B, 0x7A, 0x13, 0x50, 0xF0, 0x3B, 0xBA, 0x98, 0x2A, 0xFB, 0x7E,
|
|
||||||
0x1D, 0x65, 0xF1, 0xA1, 0x76, 0x01, 0xAF, 0x39, 0x3E, 0x59, 0xCA, 0x66, 0x88, 0x0E, 0x43, 0x82,
|
|
||||||
0x19, 0x86, 0xEE, 0x8C, 0xB4, 0x9F, 0x6F, 0x45, 0xC3, 0xA5, 0x84, 0x7D, 0xBE, 0x5E, 0x8B, 0x3B,
|
|
||||||
0xD8, 0x75, 0x6F, 0xE0, 0x73, 0x20, 0xC1, 0x85, 0x9F, 0x44, 0x1A, 0x40, 0xA6, 0x6A, 0xC1, 0x56,
|
|
||||||
0x62, 0xAA, 0xD3, 0x4E, 0x06, 0x77, 0x3F, 0x36, 0x72, 0xDF, 0xFE, 0x1B, 0x3D, 0x02, 0x9B, 0x42,
|
|
||||||
0x24, 0xD7, 0xD0, 0x37, 0x48, 0x12, 0x0A, 0xD0, 0xD3, 0xEA, 0x0F, 0xDB, 0x9B, 0xC0, 0xF1, 0x49,
|
|
||||||
0xC9, 0x72, 0x53, 0x07, 0x7B, 0x1B, 0x99, 0x80, 0xD8, 0x79, 0xD4, 0x25, 0xF7, 0xDE, 0xE8, 0xF6,
|
|
||||||
0x1A, 0x50, 0xFE, 0xE3, 0x3B, 0x4C, 0x79, 0xB6, 0xBD, 0xE0, 0x6C, 0x97, 0xBA, 0x06, 0xC0, 0x04,
|
|
||||||
0xB6, 0x4F, 0xA9, 0xC1, 0xC4, 0x60, 0x9F, 0x40, 0xC2, 0x9E, 0x5C, 0x5E, 0x63, 0x24, 0x6A, 0x19,
|
|
||||||
0xAF, 0x6F, 0xFB, 0x68, 0xB5, 0x53, 0x6C, 0x3E, 0xEB, 0xB2, 0x39, 0x13, 0x6F, 0xEC, 0x52, 0x3B,
|
|
||||||
0x1F, 0x51, 0xFC, 0x6D, 0x2C, 0x95, 0x30, 0x9B, 0x44, 0x45, 0x81, 0xCC, 0x09, 0xBD, 0x5E, 0xAF,
|
|
||||||
0x04, 0xD0, 0xE3, 0xBE, 0xFD, 0x4A, 0x33, 0xDE, 0x07, 0x28, 0x0F, 0x66, 0xB3, 0x4B, 0x2E, 0x19,
|
|
||||||
0x57, 0xA8, 0xCB, 0xC0, 0x0F, 0x74, 0xC8, 0x45, 0x39, 0x5F, 0x0B, 0xD2, 0xDB, 0xFB, 0xD3, 0xB9,
|
|
||||||
0xBD, 0xC0, 0x79, 0x55, 0x0A, 0x32, 0x60, 0x1A, 0xC6, 0x00, 0xA1, 0xD6, 0x79, 0x72, 0x2C, 0x40,
|
|
||||||
0xFE, 0x25, 0x9F, 0x67, 0xCC, 0xA3, 0x1F, 0xFB, 0xF8, 0xE9, 0xA5, 0x8E, 0xF8, 0x22, 0x32, 0xDB,
|
|
||||||
0xDF, 0x16, 0x75, 0x3C, 0x15, 0x6B, 0x61, 0xFD, 0xC8, 0x1E, 0x50, 0x2F, 0xAB, 0x52, 0x05, 0xAD,
|
|
||||||
0xFA, 0xB5, 0x3D, 0x32, 0x60, 0x87, 0x23, 0xFD, 0x48, 0x7B, 0x31, 0x53, 0x82, 0xDF, 0x00, 0x3E,
|
|
||||||
0xBB, 0x57, 0x5C, 0x9E, 0xA0, 0x8C, 0x6F, 0xCA, 0x2E, 0x56, 0x87, 0x1A, 0xDB, 0x69, 0x17, 0xDF,
|
|
||||||
0xF6, 0xA8, 0x42, 0xD5, 0xC3, 0xFF, 0x7E, 0x28, 0xC6, 0x32, 0x67, 0xAC, 0x73, 0x55, 0x4F, 0x8C,
|
|
||||||
0xB0, 0x27, 0x5B, 0x69, 0xC8, 0x58, 0xCA, 0xBB, 0x5D, 0xA3, 0xFF, 0xE1, 0xA0, 0x11, 0xF0, 0xB8,
|
|
||||||
0x98, 0x3D, 0xFA, 0x10, 0xB8, 0x83, 0x21, 0xFD, 0x6C, 0xB5, 0xFC, 0x4A, 0x5B, 0xD3, 0xD1, 0x2D,
|
|
||||||
0x79, 0xE4, 0x53, 0x9A, 0x65, 0x45, 0xF8, 0xB6, 0xBC, 0x49, 0x8E, 0xD2, 0x90, 0x97, 0xFB, 0x4B,
|
|
||||||
0xDA, 0xF2, 0xDD, 0xE1, 0x33, 0x7E, 0xCB, 0xA4, 0x41, 0x13, 0xFB, 0x62, 0xE8, 0xC6, 0xE4, 0xCE,
|
|
||||||
0xDA, 0xCA, 0x20, 0xEF, 0x01, 0x4C, 0x77, 0x36, 0xFE, 0x9E, 0x7E, 0xD0, 0xB4, 0x1F, 0xF1, 0x2B,
|
|
||||||
0x4D, 0xDA, 0xDB, 0x95, 0x98, 0x91, 0x90, 0xAE, 0x71, 0x8E, 0xAD, 0xEA, 0xA0, 0xD5, 0x93, 0x6B,
|
|
||||||
0xD0, 0xD1, 0x8E, 0xD0, 0xE0, 0x25, 0xC7, 0xAF, 0x2F, 0x5B, 0x3C, 0x8E, 0xB7, 0x94, 0x75, 0x8E,
|
|
||||||
0xFB, 0xE2, 0xF6, 0x8F, 0x64, 0x2B, 0x12, 0xF2, 0x12, 0xB8, 0x88, 0x88, 0x1C, 0xF0, 0x0D, 0x90,
|
|
||||||
0xA0, 0x5E, 0xAD, 0x4F, 0x1C, 0xC3, 0x8F, 0x68, 0x91, 0xF1, 0xCF, 0xD1, 0xAD, 0xC1, 0xA8, 0xB3,
|
|
||||||
0x18, 0x22, 0x2F, 0x2F, 0x77, 0x17, 0x0E, 0xBE, 0xFE, 0x2D, 0x75, 0xEA, 0xA1, 0x1F, 0x02, 0x8B,
|
|
||||||
0x0F, 0xCC, 0xA0, 0xE5, 0xE8, 0x74, 0x6F, 0xB5, 0xD6, 0xF3, 0xAC, 0x18, 0x99, 0xE2, 0x89, 0xCE,
|
|
||||||
0xE0, 0x4F, 0xA8, 0xB4, 0xB7, 0xE0, 0x13, 0xFD, 0x81, 0x3B, 0xC4, 0x7C, 0xD9, 0xA8, 0xAD, 0xD2,
|
|
||||||
0x66, 0xA2, 0x5F, 0x16, 0x05, 0x77, 0x95, 0x80, 0x14, 0x73, 0xCC, 0x93, 0x77, 0x14, 0x1A, 0x21,
|
|
||||||
0x65, 0x20, 0xAD, 0xE6, 0x86, 0xFA, 0xB5, 0x77, 0xF5, 0x42, 0x54, 0xC7, 0xCF, 0x35, 0x9D, 0xFB,
|
|
||||||
0x0C, 0xAF, 0xCD, 0xEB, 0xA0, 0x89, 0x3E, 0x7B, 0xD3, 0x1B, 0x41, 0xD6, 0x49, 0x7E, 0x1E, 0xAE,
|
|
||||||
0x2D, 0x0E, 0x25, 0x00, 0x5E, 0xB3, 0x71, 0x20, 0xBB, 0x00, 0x68, 0x22, 0xAF, 0xE0, 0xB8, 0x57,
|
|
||||||
0x9B, 0x36, 0x64, 0x24, 0x1E, 0xB9, 0x09, 0xF0, 0x1D, 0x91, 0x63, 0x55, 0xAA, 0xA6, 0xDF, 0x59,
|
|
||||||
0x89, 0x43, 0xC1, 0x78, 0x7F, 0x53, 0x5A, 0xD9, 0xA2, 0x5B, 0x7D, 0x20, 0xC5, 0xB9, 0xE5, 0x02,
|
|
||||||
0x76, 0x03, 0x26, 0x83, 0xA9, 0xCF, 0x95, 0x62, 0x68, 0x19, 0xC8, 0x11, 0x41, 0x4A, 0x73, 0x4E,
|
|
||||||
0xCA, 0x2D, 0x47, 0xB3, 0x4A, 0xA9, 0x14, 0x7B, 0x52, 0x00, 0x51, 0x1B, 0x15, 0x29, 0x53, 0x9A,
|
|
||||||
0x3F, 0x57, 0x0F, 0xD6, 0xE4, 0xC6, 0x9B, 0xBC, 0x76, 0xA4, 0x60, 0x2B, 0x00, 0x74, 0xE6, 0x81,
|
|
||||||
0xB5, 0x6F, 0xBA, 0x08, 0x1F, 0xE9, 0x1B, 0x57, 0x6B, 0xEC, 0x96, 0xF2, 0x15, 0xD9, 0x0D, 0x2A,
|
|
||||||
0x21, 0x65, 0x63, 0xB6, 0xB6, 0xF9, 0xB9, 0xE7, 0x2E, 0x05, 0x34, 0xFF, 0x64, 0x56, 0x85, 0xC5,
|
|
||||||
0x5D, 0x2D, 0xB0, 0x53, 0xA1, 0x8F, 0x9F, 0xA9, 0x99, 0x47, 0xBA, 0x08, 0x6A, 0x07, 0x85, 0x6E,
|
|
||||||
0xE9, 0x70, 0x7A, 0x4B, 0x44, 0x29, 0xB3, 0xB5, 0x2E, 0x09, 0x75, 0xDB, 0x23, 0x26, 0x19, 0xC4,
|
|
||||||
0xB0, 0xA6, 0x6E, 0xAD, 0x7D, 0xDF, 0xA7, 0x49, 0xB8, 0x60, 0xEE, 0x9C, 0x66, 0xB2, 0xED, 0x8F,
|
|
||||||
0x71, 0x8C, 0xAA, 0xEC, 0xFF, 0x17, 0x9A, 0x69, 0x6C, 0x52, 0x64, 0x56, 0xE1, 0x9E, 0xB1, 0xC2,
|
|
||||||
0xA5, 0x02, 0x36, 0x19, 0x29, 0x4C, 0x09, 0x75, 0x40, 0x13, 0x59, 0xA0, 0x3E, 0x3A, 0x18, 0xE4,
|
|
||||||
0x9A, 0x98, 0x54, 0x3F, 0x65, 0x9D, 0x42, 0x5B, 0xD6, 0xE4, 0x8F, 0x6B, 0xD6, 0x3F, 0xF7, 0x99,
|
|
||||||
0x07, 0x9C, 0xD2, 0xA1, 0xF5, 0x30, 0xE8, 0xEF, 0xE6, 0x38, 0x2D, 0x4D, 0xC1, 0x5D, 0x25, 0xF0,
|
|
||||||
0x86, 0x20, 0xDD, 0x4C, 0x26, 0xEB, 0x70, 0x84, 0xC6, 0xE9, 0x82, 0x63, 0x5E, 0xCC, 0x1E, 0x02,
|
|
||||||
0x3F, 0x6B, 0x68, 0x09, 0xC9, 0xEF, 0xBA, 0x3E, 0x14, 0x18, 0x97, 0x3C, 0xA1, 0x70, 0x6A, 0x6B,
|
|
||||||
0x84, 0x35, 0x7F, 0x68, 0x86, 0xE2, 0xA0, 0x52, 0x05, 0x53, 0x9C, 0xB7, 0x37, 0x07, 0x50, 0xAA,
|
|
||||||
0x1C, 0x84, 0x07, 0x3E, 0x5C, 0xAE, 0xDE, 0x7F, 0xEC, 0x44, 0x7D, 0x8E, 0xB8, 0xF2, 0x16, 0x57,
|
|
||||||
0x37, 0xDA, 0x3A, 0xB0, 0x0D, 0x0C, 0x50, 0xF0, 0x04, 0x1F, 0x1C, 0xF0, 0xFF, 0xB3, 0x00, 0x02,
|
|
||||||
0x1A, 0xF5, 0x0C, 0xAE, 0xB2, 0x74, 0xB5, 0x3C, 0x58, 0x7A, 0x83, 0x25, 0xBD, 0x21, 0x09, 0xDC,
|
|
||||||
0xF9, 0x13, 0x91, 0xD1, 0xF6, 0x2F, 0xA9, 0x7C, 0x73, 0x47, 0x32, 0x94, 0x01, 0x47, 0xF5, 0x22,
|
|
||||||
0x81, 0xE5, 0xE5, 0x3A, 0xDC, 0xDA, 0xC2, 0x37, 0x34, 0x76, 0xB5, 0xC8, 0xA7, 0xDD, 0xF3, 0x9A,
|
|
||||||
0x46, 0x61, 0x44, 0xA9, 0x0E, 0x03, 0xD0, 0x0F, 0x3E, 0xC7, 0xC8, 0xEC, 0x41, 0x1E, 0x75, 0xA4,
|
|
||||||
0x99, 0xCD, 0x38, 0xE2, 0x2F, 0x0E, 0xEA, 0x3B, 0xA1, 0xBB, 0x80, 0x32, 0x31, 0xB3, 0x3E, 0x18,
|
|
||||||
0x38, 0x8B, 0x54, 0x4E, 0x08, 0xB9, 0x6D, 0x4F, 0x03, 0x0D, 0x42, 0x6F, 0xBF, 0x04, 0x0A, 0xF6,
|
|
||||||
0x90, 0x12, 0xB8, 0x2C, 0x79, 0x7C, 0x97, 0x24, 0x72, 0xB0, 0x79, 0x56, 0xAF, 0x89, 0xAF, 0xBC,
|
|
||||||
0x1F, 0x77, 0x9A, 0xDE, 0x10, 0x08, 0x93, 0xD9, 0x12, 0xAE, 0x8B, 0xB3, 0x2E, 0x3F, 0xCF, 0xDC,
|
|
||||||
0x1F, 0x72, 0x12, 0x55, 0x24, 0x71, 0x6B, 0x2E, 0xE6, 0xDD, 0x1A, 0x50, 0x87, 0xCD, 0x84, 0x9F,
|
|
||||||
0x18, 0x47, 0x58, 0x7A, 0x17, 0xDA, 0x08, 0x74, 0xBC, 0x9A, 0x9F, 0xBC, 0x8C, 0x7D, 0x4B, 0xE9,
|
|
||||||
0x3A, 0xEC, 0x7A, 0xEC, 0xFA, 0x1D, 0x85, 0xDB, 0x66, 0x43, 0x09, 0x63, 0xD2, 0xC3, 0x64, 0xC4,
|
|
||||||
0x47, 0x18, 0x1C, 0xEF, 0x08, 0xD9, 0x15, 0x32, 0x37, 0x3B, 0x43, 0xDD, 0x16, 0xBA, 0xC2, 0x24,
|
|
||||||
0x43, 0x4D, 0xA1, 0x12, 0x51, 0xC4, 0x65, 0x2A, 0x02, 0x00, 0x94, 0x50, 0xDD, 0xE4, 0x3A, 0x13,
|
|
||||||
0x9E, 0xF8, 0xDF, 0x71, 0x55, 0x4E, 0x31, 0x10, 0xD6, 0x77, 0xAC, 0x81, 0x9B, 0x19, 0x11, 0x5F,
|
|
||||||
0xF1, 0x56, 0x35, 0x04, 0x6B, 0xC7, 0xA3, 0xD7, 0x3B, 0x18, 0x11, 0x3C, 0x09, 0xA5, 0x24, 0x59,
|
|
||||||
0xED, 0xE6, 0x8F, 0xF2, 0xFA, 0xFB, 0xF1, 0x97, 0x2C, 0xBF, 0xBA, 0x9E, 0x6E, 0x3C, 0x15, 0x1E,
|
|
||||||
0x70, 0x45, 0xE3, 0x86, 0xB1, 0x6F, 0xE9, 0xEA, 0x0A, 0x5E, 0x0E, 0x86, 0xB3, 0x2A, 0x3E, 0x5A,
|
|
||||||
0x1C, 0xE7, 0x1F, 0x77, 0xFA, 0x06, 0x3D, 0x4E, 0xB9, 0xDC, 0x65, 0x29, 0x0F, 0x1D, 0xE7, 0x99,
|
|
||||||
0xD6, 0x89, 0x3E, 0x80, 0x25, 0xC8, 0x66, 0x52, 0x78, 0xC9, 0x4C, 0x2E, 0x6A, 0xB3, 0x10, 0x9C,
|
|
||||||
0xBA, 0x0E, 0x15, 0xC6, 0x78, 0xEA, 0xE2, 0x94, 0x53, 0x3C, 0xFC, 0xA5, 0xF4, 0x2D, 0x0A, 0x1E,
|
|
||||||
0xA7, 0x4E, 0xF7, 0xF2, 0x3D, 0x2B, 0x1D, 0x36, 0x0F, 0x26, 0x39, 0x19, 0x60, 0x79, 0xC2, 0x19,
|
|
||||||
0x08, 0xA7, 0x23, 0x52, 0xB6, 0x12, 0x13, 0xF7, 0x6E, 0xFE, 0xAD, 0xEB, 0x66, 0x1F, 0xC3, 0xEA,
|
|
||||||
0x95, 0x45, 0xBC, 0xE3, 0x83, 0xC8, 0x7B, 0xA6, 0xD1, 0x37, 0x7F, 0xB1, 0x28, 0xFF, 0x8C, 0x01,
|
|
||||||
0xEF, 0xDD, 0x32, 0xC3, 0xA5, 0x5A, 0x6C, 0xBE, 0x85, 0x21, 0x58, 0x65, 0x02, 0x98, 0xAB, 0x68,
|
|
||||||
0x0F, 0xA5, 0xCE, 0xEE, 0x3B, 0x95, 0x2F, 0xDB, 0xAD, 0x7D, 0xEF, 0x2A, 0x84, 0x2F, 0x6E, 0x5B,
|
|
||||||
0x28, 0xB6, 0x21, 0x15, 0x70, 0x61, 0x07, 0x29, 0x75, 0x47, 0xDD, 0xEC, 0x10, 0x15, 0x9F, 0x61,
|
|
||||||
0x30, 0xA8, 0xCC, 0x13, 0x96, 0xBD, 0x61, 0xEB, 0x1E, 0xFE, 0x34, 0x03, 0xCF, 0x63, 0x03, 0xAA,
|
|
||||||
0x90, 0x5C, 0x73, 0xB5, 0x39, 0xA2, 0x70, 0x4C, 0x0B, 0x9E, 0x9E, 0xD5, 0x14, 0xDE, 0xAA, 0xCB,
|
|
||||||
0xBC, 0x86, 0xCC, 0xEE, 0xA7, 0x2C, 0x62, 0x60, 0xAB, 0x5C, 0xAB, 0x9C, 0x6E, 0x84, 0xF3, 0xB2,
|
|
||||||
0xAF, 0x1E, 0x8B, 0x64, 0xCA, 0xF0, 0xBD, 0x19, 0xB9, 0x69, 0x23, 0xA0, 0x50, 0xBB, 0x5A, 0x65,
|
|
||||||
0x32, 0x5A, 0x68, 0x40, 0xB3, 0xB4, 0x2A, 0x3C, 0xD5, 0xE9, 0x9E, 0x31, 0xF7, 0xB8, 0x21, 0xC0,
|
|
||||||
0x19, 0x0B, 0x54, 0x9B, 0x99, 0xA0, 0x5F, 0x87, 0x7E, 0x99, 0xF7, 0x95, 0xA8, 0x7D, 0x3D, 0x62,
|
|
||||||
0x9A, 0x88, 0x37, 0xF8, 0x77, 0x2D, 0xE3, 0x97, 0x5F, 0x93, 0xED, 0x11, 0x81, 0x12, 0x68, 0x16,
|
|
||||||
0x29, 0x88, 0x35, 0x0E, 0xD6, 0x1F, 0xE6, 0xC7, 0xA1, 0xDF, 0xDE, 0x96, 0x99, 0xBA, 0x58, 0x78,
|
|
||||||
0xA5, 0x84, 0xF5, 0x57, 0x63, 0x72, 0x22, 0x1B, 0xFF, 0xC3, 0x83, 0x9B, 0x96, 0x46, 0xC2, 0x1A,
|
|
||||||
0xEB, 0x0A, 0xB3, 0xCD, 0x54, 0x30, 0x2E, 0x53, 0xE4, 0x48, 0xD9, 0x8F, 0x28, 0x31, 0xBC, 0x6D,
|
|
||||||
0xEF, 0xF2, 0xEB, 0x58, 0xEA, 0xFF, 0xC6, 0x34, 0x61, 0xED, 0x28, 0xFE, 0x73, 0x3C, 0x7C, 0xEE,
|
|
||||||
0xD9, 0x14, 0x4A, 0x5D, 0xE3, 0xB7, 0x64, 0xE8, 0x14, 0x5D, 0x10, 0x42, 0xE0, 0x13, 0x3E, 0x20,
|
|
||||||
0xB6, 0xE2, 0xEE, 0x45, 0xEA, 0xAB, 0xAA, 0xA3, 0x15, 0x4F, 0x6C, 0xDB, 0xD0, 0x4F, 0xCB, 0xFA,
|
|
||||||
0x42, 0xF4, 0x42, 0xC7, 0xB5, 0xBB, 0x6A, 0xEF, 0x1D, 0x3B, 0x4F, 0x65, 0x05, 0x21, 0xCD, 0x41,
|
|
||||||
0x9E, 0x79, 0x1E, 0xD8, 0xC7, 0x4D, 0x85, 0x86, 0x6A, 0x47, 0x4B, 0xE4, 0x50, 0x62, 0x81, 0x3D,
|
|
||||||
0xF2, 0xA1, 0x62, 0xCF, 0x46, 0x26, 0x8D, 0x5B, 0xA0, 0x83, 0x88, 0xFC, 0xA3, 0xB6, 0xC7, 0xC1,
|
|
||||||
0xC3, 0x24, 0x15, 0x7F, 0x92, 0x74, 0xCB, 0x69, 0x0B, 0x8A, 0x84, 0x47, 0x85, 0xB2, 0x92, 0x56,
|
|
||||||
0x00, 0xBF, 0x5B, 0x09, 0x9D, 0x48, 0x19, 0xAD, 0x74, 0xB1, 0x62, 0x14, 0x00, 0x0E, 0x82, 0x23,
|
|
||||||
0x2A, 0x8D, 0x42, 0x58, 0xEA, 0xF5, 0x55, 0x0C, 0x3E, 0xF4, 0xAD, 0x1D, 0x61, 0x70, 0x3F, 0x23,
|
|
||||||
0x92, 0xF0, 0x72, 0x33, 0x41, 0x7E, 0x93, 0x8D, 0xF1, 0xEC, 0x5F, 0xD6, 0xDB, 0x3B, 0x22, 0x6C,
|
|
||||||
0x59, 0x37, 0xDE, 0x7C, 0x60, 0x74, 0xEE, 0xCB, 0xA7, 0xF2, 0x85, 0x40, 0x6E, 0x32, 0x77, 0xCE,
|
|
||||||
0x84, 0x80, 0x07, 0xA6, 0x9E, 0x50, 0xF8, 0x19, 0x55, 0xD8, 0xEF, 0xE8, 0x35, 0x97, 0xD9, 0x61,
|
|
||||||
0xAA, 0xA7, 0x69, 0xA9, 0xC2, 0x06, 0x0C, 0xC5, 0xFC, 0xAB, 0x04, 0x5A, 0xDC, 0xCA, 0x0B, 0x80,
|
|
||||||
0x2E, 0x7A, 0x44, 0x9E, 0x84, 0x34, 0x45, 0xC3, 0x05, 0x67, 0xD5, 0xFD, 0xC9, 0x9E, 0x1E, 0x0E,
|
|
||||||
0xD3, 0xDB, 0x73, 0xDB, 0xCD, 0x88, 0x55, 0x10, 0x79, 0xDA, 0x5F, 0x67, 0x40, 0x43, 0x67, 0xE3,
|
|
||||||
0x65, 0x34, 0xC4, 0xC5, 0xD8, 0x38, 0x3E, 0x71, 0x9E, 0xF8, 0x28, 0x3D, 0x20, 0xFF, 0x6D, 0xF1,
|
|
||||||
0xE7, 0x21, 0x3E, 0x15, 0x4A, 0x3D, 0xB0, 0x8F, 0x2B, 0x9F, 0xE3, 0xE6, 0xF7, 0xAD, 0x83, 0xDB,
|
|
||||||
0x68, 0x5A, 0x3D, 0xE9, 0xF7, 0x40, 0x81, 0x94, 0x1C, 0x26, 0x4C, 0xF6, 0x34, 0x29, 0x69, 0x94,
|
|
||||||
0xF7, 0x20, 0x15, 0x41, 0xF7, 0xD4, 0x02, 0x76, 0x2E, 0x6B, 0xF4, 0xBC, 0x68, 0x00, 0xA2, 0xD4,
|
|
||||||
0x71, 0x24, 0x08, 0xD4, 0x6A, 0xF4, 0x20, 0x33, 0xB7, 0xD4, 0xB7, 0x43, 0xAF, 0x61, 0x00, 0x50,
|
|
||||||
0x2E, 0xF6, 0x39, 0x1E, 0x46, 0x45, 0x24, 0x97, 0x74, 0x4F, 0x21, 0x14, 0x40, 0x88, 0x8B, 0xBF,
|
|
||||||
0x1D, 0xFC, 0x95, 0x4D, 0xAF, 0x91, 0xB5, 0x96, 0xD3, 0xDD, 0xF4, 0x70, 0x45, 0x2F, 0xA0, 0x66,
|
|
||||||
0xEC, 0x09, 0xBC, 0xBF, 0x85, 0x97, 0xBD, 0x03, 0xD0, 0x6D, 0xAC, 0x7F, 0x04, 0x85, 0xCB, 0x31,
|
|
||||||
0xB3, 0x27, 0xEB, 0x96, 0x41, 0x39, 0xFD, 0x55, 0xE6, 0x47, 0x25, 0xDA, 0x9A, 0x0A, 0xCA, 0xAB,
|
|
||||||
0x25, 0x78, 0x50, 0x28, 0xF4, 0x29, 0x04, 0x53, 0xDA, 0x86, 0x2C, 0x0A, 0xFB, 0x6D, 0xB6, 0xE9,
|
|
||||||
0x62, 0x14, 0xDC, 0x68, 0x00, 0x69, 0x48, 0xD7, 0xA4, 0xC0, 0x0E, 0x68, 0xEE, 0x8D, 0xA1, 0x27,
|
|
||||||
0xA2, 0xFE, 0x3F, 0x4F, 0x8C, 0xAD, 0x87, 0xE8, 0x06, 0xE0, 0x8C, 0xB5, 0xB6, 0xD6, 0xF4, 0x7A,
|
|
||||||
0x7C, 0x1E, 0xCE, 0xAA, 0xEC, 0x5F, 0x37, 0xD3, 0x99, 0xA3, 0x78, 0xCE, 0x42, 0x2A, 0x6B, 0x40,
|
|
||||||
0x35, 0x9E, 0xFE, 0x20, 0xB9, 0x85, 0xF3, 0xD9, 0xAB, 0xD7, 0x39, 0xEE, 0x8B, 0x4E, 0x12, 0x3B,
|
|
||||||
0xF7, 0xFA, 0xC9, 0x1D, 0x56, 0x18, 0x6D, 0x4B, 0x31, 0x66, 0xA3, 0x26, 0xB2, 0x97, 0xE3, 0xEA,
|
|
||||||
0x74, 0xFA, 0x6E, 0x3A, 0x32, 0x43, 0x5B, 0xDD, 0xF7, 0xE7, 0x41, 0x68, 0xFB, 0x20, 0x78, 0xCA,
|
|
||||||
0x4E, 0xF5, 0x0A, 0xFB, 0x97, 0xB3, 0xFE, 0xD8, 0xAC, 0x56, 0x40, 0x45, 0x27, 0x95, 0x48, 0xBA,
|
|
||||||
0x3A, 0x3A, 0x53, 0x55, 0x87, 0x8D, 0x83, 0x20, 0xB7, 0xA9, 0x6B, 0xFE, 0x4B, 0x95, 0x96, 0xD0,
|
|
||||||
0xBC, 0x67, 0xA8, 0x55, 0x58, 0x9A, 0x15, 0xA1, 0x63, 0x29, 0xA9, 0xCC, 0x33, 0xDB, 0xE1, 0x99,
|
|
||||||
0x56, 0x4A, 0x2A, 0xA6, 0xF9, 0x25, 0x31, 0x3F, 0x1C, 0x7E, 0xF4, 0x5E, 0x7C, 0x31, 0x29, 0x90,
|
|
||||||
0x02, 0xE8, 0xF8, 0xFD, 0x70, 0x2F, 0x27, 0x04, 0x5C, 0x15, 0xBB, 0x80, 0xE3, 0x2C, 0x28, 0x05,
|
|
||||||
0x48, 0x15, 0xC1, 0x95, 0x22, 0x6D, 0xC6, 0xE4, 0x3F, 0x13, 0xC1, 0x48, 0xDC, 0x86, 0x0F, 0xC7,
|
|
||||||
0xEE, 0xC9, 0xF9, 0x07, 0x0F, 0x1F, 0x04, 0x41, 0xA4, 0x79, 0x47, 0x40, 0x17, 0x6E, 0x88, 0x5D,
|
|
||||||
0xEB, 0x51, 0x5F, 0x32, 0xD1, 0xC0, 0x9B, 0xD5, 0x8F, 0xC1, 0xBC, 0xF2, 0x64, 0x35, 0x11, 0x41,
|
|
||||||
0x34, 0x78, 0x7B, 0x25, 0x60, 0x9C, 0x2A, 0x60, 0xA3, 0xE8, 0xF8, 0xDF, 0x1B, 0x6C, 0x63, 0x1F,
|
|
||||||
0xC2, 0xB4, 0x12, 0x0E, 0x9E, 0x32, 0xE1, 0x02, 0xD1, 0x4F, 0x66, 0xAF, 0x15, 0x81, 0xD1, 0xCA,
|
|
||||||
0xE0, 0x95, 0x23, 0x6B, 0xE1, 0x92, 0x3E, 0x33, 0x62, 0x0B, 0x24, 0x3B, 0x22, 0xB9, 0xBE, 0xEE,
|
|
||||||
0x0E, 0xA2, 0xB2, 0x85, 0x99, 0x0D, 0xBA, 0xE6, 0x8C, 0x0C, 0x72, 0xDE, 0x28, 0xF7, 0xA2, 0x2D,
|
|
||||||
0x45, 0x78, 0x12, 0xD0, 0xFD, 0x94, 0xB7, 0x95, 0x62, 0x08, 0x7D, 0x64, 0xF0, 0xF5, 0xCC, 0xE7,
|
|
||||||
0x6F, 0xA3, 0x49, 0x54, 0xFA, 0x48, 0x7D, 0x87, 0x27, 0xFD, 0x9D, 0xC3, 0x1E, 0x8D, 0x3E, 0xF3,
|
|
||||||
0x41, 0x63, 0x47, 0x0A, 0x74, 0xFF, 0x2E, 0x99, 0xAB, 0x6E, 0x6F, 0x3A, 0x37, 0xFD, 0xF8, 0xF4,
|
|
||||||
0x60, 0xDC, 0x12, 0xA8, 0xF8, 0xDD, 0xEB, 0xA1, 0x4C, 0xE1, 0x1B, 0x99, 0x0D, 0x6B, 0x6E, 0xDB,
|
|
||||||
0x10, 0x55, 0x7B, 0xC6, 0x37, 0x2C, 0x67, 0x6D, 0x3B, 0xD4, 0x65, 0x27, 0x04, 0xE8, 0xD0, 0xDC,
|
|
||||||
0xC7, 0x0D, 0x29, 0xF1, 0xA3, 0xFF, 0x00, 0xCC, 0x92, 0x0F, 0x39, 0xB5, 0x0B, 0xED, 0x0F, 0x69,
|
|
||||||
0xFB, 0x9F, 0x7B, 0x66, 0x9C, 0x7D, 0xDB, 0xCE, 0x0B, 0xCF, 0x91, 0xA0, 0xA3, 0x5E, 0x15, 0xD9,
|
|
||||||
0x88, 0x2F, 0x13, 0xBB, 0x24, 0xAD, 0x5B, 0x51, 0xBF, 0x79, 0x94, 0x7B, 0xEB, 0xD6, 0x3B, 0x76,
|
|
||||||
0xB3, 0x2E, 0x39, 0x37, 0x79, 0x59, 0x11, 0xCC, 0x97, 0xE2, 0x26, 0x80, 0x2D, 0x31, 0x2E, 0xF4,
|
|
||||||
0xA7, 0xAD, 0x42, 0x68, 0x3B, 0x2B, 0x6A, 0xC6, 0xCC, 0x4C, 0x75, 0x12, 0x1C, 0xF1, 0x2E, 0x78,
|
|
||||||
0x37, 0x42, 0x12, 0x6A, 0xE7, 0x51, 0x92, 0xB7, 0xE6, 0xBB, 0xA1, 0x06, 0x50, 0x63, 0xFB, 0x4B,
|
|
||||||
0x18, 0x10, 0x6B, 0x1A, 0xFA, 0xED, 0xCA, 0x11, 0xD8, 0xBD, 0x25, 0x3D, 0xC9, 0xC3, 0xE1, 0xE2,
|
|
||||||
0x59, 0x16, 0x42, 0x44, 0x86, 0x13, 0x12, 0x0A, 0x6E, 0xEC, 0x0C, 0xD9, 0x2A, 0xEA, 0xAB, 0xD5,
|
|
||||||
0x4E, 0x67, 0xAF, 0x64, 0x5F, 0xA8, 0x86, 0xDA, 0x88, 0xE9, 0xBF, 0xBE, 0xFE, 0xC3, 0xE4, 0x64,
|
|
||||||
0x57, 0x80, 0xBC, 0x9D, 0x86, 0xC0, 0xF7, 0xF0, 0xF8, 0x7B, 0x78, 0x60, 0x4D, 0x60, 0x03, 0x60,
|
|
||||||
0x46, 0x83, 0xFD, 0xD1, 0xB0, 0x1F, 0x38, 0xF6, 0x04, 0xAE, 0x45, 0x77, 0xCC, 0xFC, 0x36, 0xD7,
|
|
||||||
0x33, 0x6B, 0x42, 0x83, 0x71, 0xAB, 0x1E, 0xF0, 0x87, 0x41, 0x80, 0xB0, 0x5F, 0x5E, 0x00, 0x3C,
|
|
||||||
0xBE, 0x57, 0xA0, 0x77, 0x24, 0xAE, 0xE8, 0xBD, 0x99, 0x42, 0x46, 0x55, 0x61, 0x2E, 0x58, 0xBF,
|
|
||||||
0x8F, 0xF4, 0x58, 0x4E, 0xA2, 0xFD, 0xDD, 0xF2, 0x38, 0xEF, 0x74, 0xF4, 0xC2, 0xBD, 0x89, 0x87,
|
|
||||||
0xC3, 0xF9, 0x66, 0x53, 0x74, 0x8E, 0xB3, 0xC8, 0x55, 0xF2, 0x75, 0xB4, 0xB9, 0xD9, 0xFC, 0x46,
|
|
||||||
0x61, 0x26, 0xEB, 0x7A, 0x84, 0xDF, 0x1D, 0x8B, 0x79, 0x0E, 0x6A, 0x84, 0xE2, 0x95, 0x5F, 0x91,
|
|
||||||
0x8E, 0x59, 0x6E, 0x46, 0x70, 0x57, 0xB4, 0x20, 0x91, 0x55, 0xD5, 0x8C, 0x4C, 0xDE, 0x02, 0xC9,
|
|
||||||
0xE1, 0xAC, 0x0B, 0xB9, 0xD0, 0x05, 0x82, 0xBB, 0x48, 0x62, 0xA8, 0x11, 0x9E, 0xA9, 0x74, 0x75,
|
|
||||||
0xB6, 0x19, 0x7F, 0xB7, 0x09, 0xDC, 0xA9, 0xE0, 0xA1, 0x09, 0x2D, 0x66, 0x33, 0x46, 0x32, 0xC4,
|
|
||||||
0x02, 0x1F, 0x5A, 0xE8, 0x8C, 0xBE, 0xF0, 0x09, 0x25, 0xA0, 0x99, 0x4A, 0x10, 0xFE, 0x6E, 0x1D,
|
|
||||||
0x1D, 0x3D, 0xB9, 0x1A, 0xDF, 0xA4, 0xA5, 0x0B, 0x0F, 0xF2, 0x86, 0xA1, 0x69, 0xF1, 0x68, 0x28,
|
|
||||||
0x83, 0xDA, 0xB7, 0xDC, 0xFE, 0x06, 0x39, 0x57, 0x9B, 0xCE, 0xE2, 0xA1, 0x52, 0x7F, 0xCD, 0x4F,
|
|
||||||
0x01, 0x5E, 0x11, 0x50, 0xFA, 0x83, 0x06, 0xA7, 0xC4, 0xB5, 0x02, 0xA0, 0x27, 0xD0, 0xE6, 0x0D,
|
|
||||||
0x27, 0x8C, 0xF8, 0x9A, 0x41, 0x86, 0x3F, 0x77, 0x06, 0x4C, 0x60, 0xC3, 0xB5, 0x06, 0xA8, 0x61,
|
|
||||||
0x28, 0x7A, 0x17, 0xF0, 0xE0, 0x86, 0xF5, 0xC0, 0xAA, 0x58, 0x60, 0x00, 0x62, 0x7D, 0xDC, 0x30,
|
|
||||||
0xD7, 0x9E, 0xE6, 0x11, 0x63, 0xEA, 0x38, 0x23, 0x94, 0xDD, 0xC2, 0x53, 0x34, 0x16, 0xC2, 0xC2,
|
|
||||||
0x56, 0xEE, 0xCB, 0xBB, 0xDE, 0xB6, 0xBC, 0x90, 0xA1, 0x7D, 0xFC, 0xEB, 0x76, 0x1D, 0x59, 0xCE,
|
|
||||||
0x09, 0xE4, 0x05, 0x6F, 0x88, 0x01, 0x7C, 0x4B, 0x3D, 0x0A, 0x72, 0x39, 0x24, 0x7C, 0x92, 0x7C,
|
|
||||||
0x5F, 0x72, 0xE3, 0x86, 0xB9, 0x9D, 0x4D, 0x72, 0xB4, 0x5B, 0xC1, 0x1A, 0xFC, 0xB8, 0x9E, 0xD3,
|
|
||||||
0x78, 0x55, 0x54, 0xED, 0xB5, 0xA5, 0xFC, 0x08, 0xD3, 0x7C, 0x3D, 0xD8, 0xC4, 0x0F, 0xAD, 0x4D,
|
|
||||||
0x5E, 0xEF, 0x50, 0x1E, 0xF8, 0xE6, 0x61, 0xB1, 0xD9, 0x14, 0x85, 0xA2, 0x3C, 0x13, 0x51, 0x6C,
|
|
||||||
0xE7, 0xC7, 0xD5, 0x6F, 0xC4, 0x4E, 0xE1, 0x56, 0xCE, 0xBF, 0x2A, 0x36, 0x37, 0xC8, 0xC6, 0xDD,
|
|
||||||
0x34, 0x32, 0x9A, 0xD7, 0x12, 0x82, 0x63, 0x92, 0x8E, 0xFA, 0x0E, 0x67, 0xE0, 0x00, 0x60, 0x40,
|
|
||||||
0x37, 0xCE, 0x39, 0x3A, 0xCF, 0xF5, 0xFA, 0xD3, 0x37, 0x77, 0xC2, 0xAB, 0x1B, 0x2D, 0xC5, 0x5A,
|
|
||||||
0x9E, 0x67, 0xB0, 0x5C, 0x42, 0x37, 0xA3, 0x4F, 0x40, 0x27, 0x82, 0xD3, 0xBE, 0x9B, 0xBC, 0x99,
|
|
||||||
0x9D, 0x8E, 0x11, 0xD5, 0x15, 0x73, 0x0F, 0xBF, 0x7E, 0x1C, 0x2D, 0xD6, 0x7B, 0xC4, 0x00, 0xC7,
|
|
||||||
0x6B, 0x1B, 0x8C, 0xB7, 0x45, 0x90, 0xA1, 0x21, 0xBE, 0xB1, 0x6E, 0xB2, 0xB4, 0x6E, 0x36, 0x6A,
|
|
||||||
0x2F, 0xAB, 0x48, 0x57, 0x79, 0x6E, 0x94, 0xBC, 0xD2, 0x76, 0xA3, 0xC6, 0xC8, 0xC2, 0x49, 0x65,
|
|
||||||
0xEE, 0xF8, 0x0F, 0x53, 0x7D, 0xDE, 0x8D, 0x46, 0x1D, 0x0A, 0x73, 0xD5, 0xC6, 0x4D, 0xD0, 0x4C,
|
|
||||||
0xDB, 0xBB, 0x39, 0x29, 0x50, 0x46, 0xBA, 0xA9, 0xE8, 0x26, 0x95, 0xAC, 0x04, 0xE3, 0x5E, 0xBE,
|
|
||||||
0xF0, 0xD5, 0xFA, 0xA1, 0x9A, 0x51, 0x2D, 0x6A, 0xE2, 0x8C, 0xEF, 0x63, 0x22, 0xEE, 0x86, 0x9A,
|
|
||||||
0xB8, 0xC2, 0x89, 0xC0, 0xF6, 0x2E, 0x24, 0x43, 0xAA, 0x03, 0x1E, 0xA5, 0xA4, 0xD0, 0xF2, 0x9C,
|
|
||||||
0xBA, 0x61, 0xC0, 0x83, 0x4D, 0x6A, 0xE9, 0x9B, 0x50, 0x15, 0xE5, 0x8F, 0xD6, 0x5B, 0x64, 0xBA,
|
|
||||||
0xF9, 0xA2, 0x26, 0x28, 0xE1, 0x3A, 0x3A, 0xA7, 0x86, 0x95, 0xA9, 0x4B, 0xE9, 0x62, 0x55, 0xEF,
|
|
||||||
0xD3, 0xEF, 0x2F, 0xC7, 0xDA, 0xF7, 0x52, 0xF7, 0x69, 0x6F, 0x04, 0x3F, 0x59, 0x0A, 0xFA, 0x77,
|
|
||||||
0x15, 0xA9, 0xE4, 0x80, 0x01, 0x86, 0xB0, 0x87, 0xAD, 0xE6, 0x09, 0x9B, 0x93, 0xE5, 0x3E, 0x3B,
|
|
||||||
0x5A, 0xFD, 0x90, 0xE9, 0x97, 0xD7, 0x34, 0x9E, 0xD9, 0xB7, 0xF0, 0x2C, 0x51, 0x8B, 0x2B, 0x02,
|
|
||||||
0x3A, 0xAC, 0xD5, 0x96, 0x7D, 0xA6, 0x7D, 0x01, 0xD6, 0x3E, 0xCF, 0xD1, 0x28, 0x2D, 0x7D, 0x7C,
|
|
||||||
0xCF, 0x25, 0x9F, 0x1F, 0x9B, 0xB8, 0xF2, 0xAD, 0x72, 0xB4, 0xD6, 0x5A, 0x4C, 0xF5, 0x88, 0x5A,
|
|
||||||
0x71, 0xAC, 0x29, 0xE0, 0xE6, 0xA5, 0x19, 0xE0, 0xFD, 0xAC, 0xB0, 0x47, 0x9B, 0xFA, 0x93, 0xED,
|
|
||||||
0x8D, 0xC4, 0xD3, 0xE8, 0xCC, 0x57, 0x3B, 0x28, 0x29, 0x66, 0xD5, 0xF8, 0x28, 0x2E, 0x13, 0x79,
|
|
||||||
0x91, 0x01, 0x5F, 0x78, 0x55, 0x60, 0x75, 0xED, 0x44, 0x0E, 0x96, 0xF7, 0x8C, 0x5E, 0xD3, 0xE3,
|
|
||||||
0xD4, 0x6D, 0x05, 0x15, 0xBA, 0x6D, 0xF4, 0x88, 0x25, 0x61, 0xA1, 0x03, 0xBD, 0xF0, 0x64, 0x05,
|
|
||||||
0x15, 0x9E, 0xEB, 0xC3, 0xA2, 0x57, 0x90, 0x3C, 0xEC, 0x1A, 0x27, 0x97, 0x2A, 0x07, 0x3A, 0xA9,
|
|
||||||
0x9B, 0x6D, 0x3F, 0x1B, 0xF5, 0x21, 0x63, 0x1E, 0xFB, 0x66, 0x9C, 0xF5, 0x19, 0xF3, 0xDC, 0x26,
|
|
||||||
0x28, 0xD9, 0x33, 0x75, 0xF5, 0xFD, 0x55, 0xB1, 0x82, 0x34, 0x56, 0x03, 0xBB, 0x3C, 0xBA, 0x8A,
|
|
||||||
0x11, 0x77, 0x51, 0x28, 0xF8, 0xD9, 0x0A, 0xC2, 0x67, 0x51, 0xCC, 0xAB, 0x5F, 0x92, 0xAD, 0xCC,
|
|
||||||
0x51, 0x17, 0xE8, 0x4D, 0x8E, 0xDC, 0x30, 0x38, 0x62, 0x58, 0x9D, 0x37, 0x91, 0xF9, 0x20, 0x93,
|
|
||||||
0xC2, 0x90, 0x7A, 0xEA, 0xCE, 0x7B, 0x3E, 0xFB, 0x64, 0xCE, 0x21, 0x51, 0x32, 0xBE, 0x4F, 0x77,
|
|
||||||
0x7E, 0xE3, 0xB6, 0xA8, 0x46, 0x3D, 0x29, 0xC3, 0x69, 0x53, 0xDE, 0x48, 0x80, 0xE6, 0x13, 0x64,
|
|
||||||
0x10, 0x08, 0xAE, 0xA2, 0x24, 0xB2, 0x6D, 0xDD, 0xFD, 0x2D, 0x85, 0x69, 0x66, 0x21, 0x07, 0x09,
|
|
||||||
0x0A, 0x46, 0x9A, 0xB3, 0xDD, 0xC0, 0x45, 0x64, 0xCF, 0xDE, 0x6C, 0x58, 0xAE, 0xC8, 0x20, 0x1C,
|
|
||||||
0xDD, 0xF7, 0xBE, 0x5B, 0x40, 0x8D, 0x58, 0x1B, 0x7F, 0x01, 0xD2, 0xCC, 0xBB, 0xE3, 0xB4, 0x6B,
|
|
||||||
0x7E, 0x6A, 0xA2, 0xDD, 0x45, 0xFF, 0x59, 0x3A, 0x44, 0x0A, 0x35, 0x3E, 0xD5, 0xCD, 0xB4, 0xBC,
|
|
||||||
0xA8, 0xCE, 0xEA, 0x72, 0xBB, 0x84, 0x64, 0xFA, 0xAE, 0x12, 0x66, 0x8D, 0x47, 0x6F, 0x3C, 0xBF,
|
|
||||||
0x63, 0xE4, 0x9B, 0xD2, 0x9E, 0x5D, 0x2F, 0x54, 0x1B, 0x77, 0xC2, 0xAE, 0x70, 0x63, 0x4E, 0xF6,
|
|
||||||
0x8D, 0x0D, 0x0E, 0x74, 0x57, 0x13, 0x5B, 0xE7, 0x71, 0x16, 0x72, 0xF8, 0x5D, 0x7D, 0x53, 0xAF,
|
|
||||||
0x08, 0xCB, 0x40, 0x40, 0xCC, 0xE2, 0xB4, 0x4E, 0x6A, 0x46, 0xD2, 0x34, 0x84, 0xAF, 0x15, 0x01,
|
|
||||||
0x28, 0x04, 0xB0, 0xE1, 0x1D, 0x3A, 0x98, 0x95, 0xB4, 0x9F, 0xB8, 0x06, 0x48, 0xA0, 0x6E, 0xCE,
|
|
||||||
0x82, 0x3B, 0x3F, 0x6F, 0x82, 0xAB, 0x20, 0x35, 0x4B, 0x1D, 0x1A, 0x01, 0xF8, 0x27, 0x72, 0x27,
|
|
||||||
0xB1, 0x60, 0x15, 0x61, 0xDC, 0x3F, 0x93, 0xE7, 0x2B, 0x79, 0x3A, 0xBB, 0xBD, 0x25, 0x45, 0x34,
|
|
||||||
0xE1, 0x39, 0x88, 0xA0, 0x4B, 0x79, 0xCE, 0x51, 0xB7, 0xC9, 0x32, 0x2F, 0xC9, 0xBA, 0x1F, 0xA0,
|
|
||||||
0x7E, 0xC8, 0x1C, 0xE0, 0xF6, 0xD1, 0xC7, 0xBC, 0xC3, 0x11, 0x01, 0xCF, 0xC7, 0xAA, 0xE8, 0xA1,
|
|
||||||
0x49, 0x87, 0x90, 0x1A, 0x9A, 0xBD, 0x4F, 0xD4, 0xCB, 0xDE, 0xDA, 0xD0, 0x38, 0xDA, 0x0A, 0xD5,
|
|
||||||
0x2A, 0xC3, 0x39, 0x03, 0x67, 0x36, 0x91, 0xC6, 0x7C, 0x31, 0xF9, 0x8D, 0x4F, 0x2B, 0xB1, 0xE0,
|
|
||||||
0xB7, 0x59, 0x9E, 0xF7, 0x3A, 0xBB, 0xF5, 0x43, 0xFF, 0x19, 0xD5, 0xF2, 0x9C, 0x45, 0xD9, 0x27,
|
|
||||||
0x2C, 0x22, 0x97, 0xBF, 0x2A, 0xFC, 0xE6, 0x15, 0x71, 0xFC, 0x91, 0x0F, 0x25, 0x15, 0x94, 0x9B,
|
|
||||||
0x61, 0x93, 0xE5, 0xFA, 0xEB, 0x9C, 0xB6, 0xCE, 0x59, 0x64, 0xA8, 0xC2, 0xD1, 0xA8, 0xBA, 0x12,
|
|
||||||
0x5E, 0x07, 0xC1, 0xB6, 0x0C, 0x6A, 0x05, 0xE3, 0x65, 0x50, 0xD2, 0x10, 0x42, 0xA4, 0x03, 0xCB,
|
|
||||||
0x0E, 0x6E, 0xEC, 0xE0, 0x3B, 0xDB, 0x98, 0x16, 0xBE, 0xA0, 0x98, 0x4C, 0x64, 0xE9, 0x78, 0x32,
|
|
||||||
0x32, 0x95, 0x1F, 0x9F, 0xDF, 0x92, 0xD3, 0xE0, 0x2B, 0x34, 0xA0, 0xD3, 0x1E, 0xF2, 0x71, 0x89,
|
|
||||||
0x41, 0x74, 0x0A, 0x1B, 0x8C, 0x34, 0xA3, 0x4B, 0x20, 0x71, 0xBE, 0xC5, 0xD8, 0x32, 0x76, 0xC3,
|
|
||||||
0x8D, 0x9F, 0x35, 0xDF, 0x2E, 0x2F, 0x99, 0x9B, 0x47, 0x6F, 0x0B, 0xE6, 0x1D, 0xF1, 0xE3, 0x0F,
|
|
||||||
0x54, 0xDA, 0x4C, 0xE5, 0x91, 0xD8, 0xDA, 0x1E, 0xCF, 0x79, 0x62, 0xCE, 0x6F, 0x7E, 0x3E, 0xCD,
|
|
||||||
0x66, 0xB1, 0x18, 0x16, 0x05, 0x1D, 0x2C, 0xFD, 0xC5, 0xD2, 0x8F, 0x84, 0x99, 0x22, 0xFB, 0xF6,
|
|
||||||
0x57, 0xF3, 0x23, 0xF5, 0x23, 0x76, 0x32, 0xA6, 0x31, 0x35, 0xA8, 0x93, 0x02, 0xCD, 0xCC, 0x56,
|
|
||||||
0x62, 0x81, 0xF0, 0xAC, 0xB5, 0xEB, 0x75, 0x5A, 0x97, 0x36, 0x16, 0x6E, 0xCC, 0x73, 0xD2, 0x88,
|
|
||||||
0x92, 0x62, 0x96, 0xDE, 0xD0, 0x49, 0xB9, 0x81, 0x1B, 0x90, 0x50, 0x4C, 0x14, 0x56, 0xC6, 0x71,
|
|
||||||
0xBD, 0xC7, 0xC6, 0xE6, 0x0A, 0x14, 0x7A, 0x32, 0x06, 0xD0, 0xE1, 0x45, 0x9A, 0x7B, 0xF2, 0xC3,
|
|
||||||
0xFD, 0x53, 0xAA, 0xC9, 0x00, 0x0F, 0xA8, 0x62, 0xE2, 0xBF, 0x25, 0xBB, 0xF6, 0xD2, 0xBD, 0x35,
|
|
||||||
0x05, 0x69, 0x12, 0x71, 0x22, 0x02, 0x04, 0xB2, 0x7C, 0xCF, 0xCB, 0xB6, 0x2B, 0x9C, 0x76, 0xCD,
|
|
||||||
0xC0, 0x3E, 0x11, 0x53, 0xD3, 0xE3, 0x40, 0x16, 0x60, 0xBD, 0xAB, 0x38, 0xF0, 0xAD, 0x47, 0x25,
|
|
||||||
0x9C, 0x20, 0x38, 0xBA, 0x76, 0xCE, 0x46, 0xF7, 0xC5, 0xA1, 0xAF, 0x77, 0x60, 0x60, 0x75, 0x20,
|
|
||||||
0x4E, 0xFE, 0xCB, 0x85, 0xD8, 0x8D, 0xE8, 0x8A, 0xB0, 0xF9, 0xAA, 0x7A, 0x7E, 0xAA, 0xF9, 0x4C,
|
|
||||||
0x5C, 0xC2, 0x48, 0x19, 0x8C, 0x8A, 0xFB, 0x02, 0xE4, 0x6A, 0xC3, 0x01, 0xF9, 0xE1, 0xEB, 0xD6,
|
|
||||||
0x69, 0xF8, 0xD4, 0x90, 0xA0, 0xDE, 0x5C, 0xA6, 0x2D, 0x25, 0x09, 0x3F, 0x9F, 0xE6, 0x08, 0xC2,
|
|
||||||
0x32, 0x61, 0x4E, 0xB7, 0x5B, 0xE2, 0x77, 0xCE, 0xE3, 0xDF, 0x8F, 0x57, 0xE6, 0x72, 0xC3, 0x3A
|
|
||||||
};
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public Blowfish(byte[] key)
|
|
||||||
{
|
|
||||||
initializeBlowfish(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Encipher(byte[] data, int offset, int length)
|
|
||||||
{
|
|
||||||
if ((length - offset) % 8 != 0)
|
|
||||||
throw new ArgumentException("Needs to be a multiple of 8");
|
|
||||||
|
|
||||||
for (int i = offset; i < offset + length; i += 8)
|
|
||||||
{
|
|
||||||
uint xl = (uint)((data[i + 0]) | (data[i + 1] << 8) | (data[i + 2] << 16) | (data[i + 3] << 24));
|
|
||||||
uint xr = (uint)((data[i + 4]) | (data[i + 5] << 8) | (data[i + 6] << 16) | (data[i + 7] << 24));
|
|
||||||
blowfish_encipher(ref xl, ref xr);
|
|
||||||
data[i + 0] = (byte)(xl >> 0);
|
|
||||||
data[i + 1] = (byte)(xl >> 8);
|
|
||||||
data[i + 2] = (byte)(xl >> 16);
|
|
||||||
data[i + 3] = (byte)(xl >> 24);
|
|
||||||
data[i + 4] = (byte)(xr >> 0);
|
|
||||||
data[i + 5] = (byte)(xr >> 8);
|
|
||||||
data[i + 6] = (byte)(xr >> 16);
|
|
||||||
data[i + 7] = (byte)(xr >> 24);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Decipher(byte[] data, int offset, int length)
|
|
||||||
{
|
|
||||||
if ((length - offset) % 8 != 0)
|
|
||||||
throw new ArgumentException("Needs to be a multiple of 8");
|
|
||||||
|
|
||||||
for (int i = offset; i < offset + length; i += 8)
|
|
||||||
{
|
|
||||||
uint xl = (uint)((data[i + 0]) | (data[i + 1] << 8) | (data[i + 2] << 16) | (data[i + 3] << 24));
|
|
||||||
uint xr = (uint)((data[i + 4]) | (data[i + 5] << 8) | (data[i + 6] << 16) | (data[i + 7] << 24));
|
|
||||||
blowfish_decipher(ref xl, ref xr);
|
|
||||||
data[i + 0] = (byte)(xl >> 0);
|
|
||||||
data[i + 1] = (byte)(xl >> 8);
|
|
||||||
data[i + 2] = (byte)(xl >> 16);
|
|
||||||
data[i + 3] = (byte)(xl >> 24);
|
|
||||||
data[i + 4] = (byte)(xr >> 0);
|
|
||||||
data[i + 5] = (byte)(xr >> 8);
|
|
||||||
data[i + 6] = (byte)(xr >> 16);
|
|
||||||
data[i + 7] = (byte)(xr >> 24);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private UInt32 F(UInt32 x)
|
|
||||||
{
|
|
||||||
UInt16 a;
|
|
||||||
UInt16 b;
|
|
||||||
UInt16 c;
|
|
||||||
UInt16 d;
|
|
||||||
UInt32 y;
|
|
||||||
|
|
||||||
d = (UInt16)(x & 0x00FF);
|
|
||||||
x >>= 8;
|
|
||||||
c = (UInt16)(x & 0x00FF);
|
|
||||||
x >>= 8;
|
|
||||||
b = (UInt16)(x & 0x00FF);
|
|
||||||
x >>= 8;
|
|
||||||
a = (UInt16)(x & 0x00FF);
|
|
||||||
//y = ((S[0][a] + S[1][b]) ^ S[2][c]) + S[3][d];
|
|
||||||
y = S[0,a] + S[1,b];
|
|
||||||
y = y ^ S[2,c];
|
|
||||||
y = y + S[3,d];
|
|
||||||
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void blowfish_encipher(ref UInt32 xl, ref UInt32 xr)
|
|
||||||
{
|
|
||||||
UInt32 temp;
|
|
||||||
Int32 i;
|
|
||||||
|
|
||||||
for (i = 0; i < N; ++i) {
|
|
||||||
xl = xl ^ P[i];
|
|
||||||
xr = F(xl) ^ xr;
|
|
||||||
|
|
||||||
temp = xl;
|
|
||||||
xl = xr;
|
|
||||||
xr = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp = xl;
|
|
||||||
xl = xr;
|
|
||||||
xr = temp;
|
|
||||||
|
|
||||||
xr = xr ^ P[N];
|
|
||||||
xl = xl ^ P[N + 1];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void blowfish_decipher(ref UInt32 xl, ref UInt32 xr)
|
|
||||||
{
|
|
||||||
UInt32 temp;
|
|
||||||
Int32 i;
|
|
||||||
|
|
||||||
for (i = N + 1; i > 1; --i) {
|
|
||||||
xl = xl ^ P[i];
|
|
||||||
xr = F(xl) ^ xr;
|
|
||||||
|
|
||||||
/* Exchange xl and xr */
|
|
||||||
temp = xl;
|
|
||||||
xl = xr;
|
|
||||||
xr = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Exchange xl and xr */
|
|
||||||
temp = xl;
|
|
||||||
xl = xr;
|
|
||||||
xr = temp;
|
|
||||||
|
|
||||||
xr = xr ^ P[1];
|
|
||||||
xl = xl ^ P[0];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private int initializeBlowfish(byte [] key)
|
|
||||||
{
|
|
||||||
Int16 i;
|
|
||||||
Int16 j;
|
|
||||||
Int16 k;
|
|
||||||
|
|
||||||
int data;
|
|
||||||
uint datal;
|
|
||||||
uint datar;
|
|
||||||
|
|
||||||
Buffer.BlockCopy(P_values, 0, P, 0, P_values.Length);
|
|
||||||
Buffer.BlockCopy(S_values, 0, S, 0, S_values.Length);
|
|
||||||
|
|
||||||
j = 0;
|
|
||||||
for (i = 0; i < N + 2; ++i)
|
|
||||||
{
|
|
||||||
data = 0x00000000;
|
|
||||||
for (k = 0; k < 4; ++k)
|
|
||||||
{
|
|
||||||
data = (data << 8) | (SByte)key[j];
|
|
||||||
j = (short)(j + 1);
|
|
||||||
if (j >= key.Length)
|
|
||||||
{
|
|
||||||
j = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
P[i] = P[i] ^ (uint)data;
|
|
||||||
}
|
|
||||||
|
|
||||||
datal = 0x00000000;
|
|
||||||
datar = 0x00000000;
|
|
||||||
|
|
||||||
for (i = 0; i < N + 2; i += 2)
|
|
||||||
{
|
|
||||||
blowfish_encipher(ref datal, ref datar);
|
|
||||||
|
|
||||||
P[i] = datal;
|
|
||||||
P[i + 1] = datar;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 4; ++i)
|
|
||||||
{
|
|
||||||
for (j = 0; j < 256; j += 2)
|
|
||||||
{
|
|
||||||
blowfish_encipher(ref datal, ref datar);
|
|
||||||
S[i,j] = datal;
|
|
||||||
S[i,j + 1] = datar;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
|
||||||
{
|
|
||||||
class Log
|
|
||||||
{
|
|
||||||
public static void error(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Console.Write("[ERROR] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray ;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
|
||||||
Console.Write("[DEBUG] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
|
||||||
Console.Write("[INFO] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void database(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
|
||||||
Console.Write("[SQL] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void conn(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.Write("[CONN] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,533 +0,0 @@
|
|||||||
// *******************************
|
|
||||||
// *** INIFile class V2.1 ***
|
|
||||||
// *******************************
|
|
||||||
// *** (C)2009-2013 S.T.A. snc ***
|
|
||||||
// *******************************
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace STA.Settings
|
|
||||||
{
|
|
||||||
|
|
||||||
internal class INIFile
|
|
||||||
{
|
|
||||||
|
|
||||||
#region "Declarations"
|
|
||||||
|
|
||||||
// *** Lock for thread-safe access to file and local cache ***
|
|
||||||
private object m_Lock = new object();
|
|
||||||
|
|
||||||
// *** File name ***
|
|
||||||
private string m_FileName = null;
|
|
||||||
internal string FileName
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_FileName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Lazy loading flag ***
|
|
||||||
private bool m_Lazy = false;
|
|
||||||
|
|
||||||
// *** Automatic flushing flag ***
|
|
||||||
private bool m_AutoFlush = false;
|
|
||||||
|
|
||||||
// *** Local cache ***
|
|
||||||
private Dictionary<string, Dictionary<string, string>> m_Sections = new Dictionary<string, Dictionary<string, string>>();
|
|
||||||
private Dictionary<string, Dictionary<string, string>> m_Modified = new Dictionary<string, Dictionary<string, string>>();
|
|
||||||
|
|
||||||
// *** Local cache modified flag ***
|
|
||||||
private bool m_CacheModified = false;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region "Methods"
|
|
||||||
|
|
||||||
// *** Constructor ***
|
|
||||||
public INIFile(string FileName)
|
|
||||||
{
|
|
||||||
Initialize(FileName, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public INIFile(string FileName, bool Lazy, bool AutoFlush)
|
|
||||||
{
|
|
||||||
Initialize(FileName, Lazy, AutoFlush);
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Initialization ***
|
|
||||||
private void Initialize(string FileName, bool Lazy, bool AutoFlush)
|
|
||||||
{
|
|
||||||
m_FileName = FileName;
|
|
||||||
m_Lazy = Lazy;
|
|
||||||
m_AutoFlush = AutoFlush;
|
|
||||||
if (!m_Lazy) Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Parse section name ***
|
|
||||||
private string ParseSectionName(string Line)
|
|
||||||
{
|
|
||||||
if (!Line.StartsWith("[")) return null;
|
|
||||||
if (!Line.EndsWith("]")) return null;
|
|
||||||
if (Line.Length < 3) return null;
|
|
||||||
return Line.Substring(1, Line.Length - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Parse key+value pair ***
|
|
||||||
private bool ParseKeyValuePair(string Line, ref string Key, ref string Value)
|
|
||||||
{
|
|
||||||
// *** Check for key+value pair ***
|
|
||||||
int i;
|
|
||||||
if ((i = Line.IndexOf('=')) <= 0) return false;
|
|
||||||
|
|
||||||
int j = Line.Length - i - 1;
|
|
||||||
Key = Line.Substring(0, i).Trim();
|
|
||||||
if (Key.Length <= 0) return false;
|
|
||||||
|
|
||||||
Value = (j > 0) ? (Line.Substring(i + 1, j).Trim()) : ("");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Read file contents into local cache ***
|
|
||||||
internal void Refresh()
|
|
||||||
{
|
|
||||||
lock (m_Lock)
|
|
||||||
{
|
|
||||||
StreamReader sr = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// *** Clear local cache ***
|
|
||||||
m_Sections.Clear();
|
|
||||||
m_Modified.Clear();
|
|
||||||
|
|
||||||
// *** Open the INI file ***
|
|
||||||
try
|
|
||||||
{
|
|
||||||
sr = new StreamReader(m_FileName);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Read up the file content ***
|
|
||||||
Dictionary<string, string> CurrentSection = null;
|
|
||||||
string s;
|
|
||||||
string SectionName;
|
|
||||||
string Key = null;
|
|
||||||
string Value = null;
|
|
||||||
while ((s = sr.ReadLine()) != null)
|
|
||||||
{
|
|
||||||
s = s.Trim();
|
|
||||||
|
|
||||||
// *** Check for section names ***
|
|
||||||
SectionName = ParseSectionName(s);
|
|
||||||
if (SectionName != null)
|
|
||||||
{
|
|
||||||
// *** Only first occurrence of a section is loaded ***
|
|
||||||
if (m_Sections.ContainsKey(SectionName))
|
|
||||||
{
|
|
||||||
CurrentSection = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CurrentSection = new Dictionary<string, string>();
|
|
||||||
m_Sections.Add(SectionName, CurrentSection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (CurrentSection != null)
|
|
||||||
{
|
|
||||||
// *** Check for key+value pair ***
|
|
||||||
if (ParseKeyValuePair(s, ref Key, ref Value))
|
|
||||||
{
|
|
||||||
// *** Only first occurrence of a key is loaded ***
|
|
||||||
if (!CurrentSection.ContainsKey(Key))
|
|
||||||
{
|
|
||||||
CurrentSection.Add(Key, Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// *** Cleanup: close file ***
|
|
||||||
if (sr != null) sr.Close();
|
|
||||||
sr = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Flush local cache content ***
|
|
||||||
internal void Flush()
|
|
||||||
{
|
|
||||||
lock (m_Lock)
|
|
||||||
{
|
|
||||||
PerformFlush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PerformFlush()
|
|
||||||
{
|
|
||||||
// *** If local cache was not modified, exit ***
|
|
||||||
if (!m_CacheModified) return;
|
|
||||||
m_CacheModified = false;
|
|
||||||
|
|
||||||
// *** Check if original file exists ***
|
|
||||||
bool OriginalFileExists = File.Exists(m_FileName);
|
|
||||||
|
|
||||||
// *** Get temporary file name ***
|
|
||||||
string TmpFileName = Path.ChangeExtension(m_FileName, "$n$");
|
|
||||||
|
|
||||||
// *** Copy content of original file to temporary file, replace modified values ***
|
|
||||||
StreamWriter sw = null;
|
|
||||||
|
|
||||||
// *** Create the temporary file ***
|
|
||||||
sw = new StreamWriter(TmpFileName);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Dictionary<string, string> CurrentSection = null;
|
|
||||||
if (OriginalFileExists)
|
|
||||||
{
|
|
||||||
StreamReader sr = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// *** Open the original file ***
|
|
||||||
sr = new StreamReader(m_FileName);
|
|
||||||
|
|
||||||
// *** Read the file original content, replace changes with local cache values ***
|
|
||||||
string s;
|
|
||||||
string SectionName;
|
|
||||||
string Key = null;
|
|
||||||
string Value = null;
|
|
||||||
bool Unmodified;
|
|
||||||
bool Reading = true;
|
|
||||||
while (Reading)
|
|
||||||
{
|
|
||||||
s = sr.ReadLine();
|
|
||||||
Reading = (s != null);
|
|
||||||
|
|
||||||
// *** Check for end of file ***
|
|
||||||
if (Reading)
|
|
||||||
{
|
|
||||||
Unmodified = true;
|
|
||||||
s = s.Trim();
|
|
||||||
SectionName = ParseSectionName(s);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Unmodified = false;
|
|
||||||
SectionName = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Check for section names ***
|
|
||||||
if ((SectionName != null) || (!Reading))
|
|
||||||
{
|
|
||||||
if (CurrentSection != null)
|
|
||||||
{
|
|
||||||
// *** Write all remaining modified values before leaving a section ****
|
|
||||||
if (CurrentSection.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (string fkey in CurrentSection.Keys)
|
|
||||||
{
|
|
||||||
if (CurrentSection.TryGetValue(fkey, out Value))
|
|
||||||
{
|
|
||||||
sw.Write(fkey);
|
|
||||||
sw.Write('=');
|
|
||||||
sw.WriteLine(Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sw.WriteLine();
|
|
||||||
CurrentSection.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Reading)
|
|
||||||
{
|
|
||||||
// *** Check if current section is in local modified cache ***
|
|
||||||
if (!m_Modified.TryGetValue(SectionName, out CurrentSection))
|
|
||||||
{
|
|
||||||
CurrentSection = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (CurrentSection != null)
|
|
||||||
{
|
|
||||||
// *** Check for key+value pair ***
|
|
||||||
if (ParseKeyValuePair(s, ref Key, ref Value))
|
|
||||||
{
|
|
||||||
if (CurrentSection.TryGetValue(Key, out Value))
|
|
||||||
{
|
|
||||||
// *** Write modified value to temporary file ***
|
|
||||||
Unmodified = false;
|
|
||||||
CurrentSection.Remove(Key);
|
|
||||||
|
|
||||||
sw.Write(Key);
|
|
||||||
sw.Write('=');
|
|
||||||
sw.WriteLine(Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Write unmodified lines from the original file ***
|
|
||||||
if (Unmodified)
|
|
||||||
{
|
|
||||||
sw.WriteLine(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Close the original file ***
|
|
||||||
sr.Close();
|
|
||||||
sr = null;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// *** Cleanup: close files ***
|
|
||||||
if (sr != null) sr.Close();
|
|
||||||
sr = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Cycle on all remaining modified values ***
|
|
||||||
foreach (KeyValuePair<string, Dictionary<string, string>> SectionPair in m_Modified)
|
|
||||||
{
|
|
||||||
CurrentSection = SectionPair.Value;
|
|
||||||
if (CurrentSection.Count > 0)
|
|
||||||
{
|
|
||||||
sw.WriteLine();
|
|
||||||
|
|
||||||
// *** Write the section name ***
|
|
||||||
sw.Write('[');
|
|
||||||
sw.Write(SectionPair.Key);
|
|
||||||
sw.WriteLine(']');
|
|
||||||
|
|
||||||
// *** Cycle on all key+value pairs in the section ***
|
|
||||||
foreach (KeyValuePair<string, string> ValuePair in CurrentSection)
|
|
||||||
{
|
|
||||||
// *** Write the key+value pair ***
|
|
||||||
sw.Write(ValuePair.Key);
|
|
||||||
sw.Write('=');
|
|
||||||
sw.WriteLine(ValuePair.Value);
|
|
||||||
}
|
|
||||||
CurrentSection.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_Modified.Clear();
|
|
||||||
|
|
||||||
// *** Close the temporary file ***
|
|
||||||
sw.Close();
|
|
||||||
sw = null;
|
|
||||||
|
|
||||||
// *** Rename the temporary file ***
|
|
||||||
File.Copy(TmpFileName, m_FileName, true);
|
|
||||||
|
|
||||||
// *** Delete the temporary file ***
|
|
||||||
File.Delete(TmpFileName);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// *** Cleanup: close files ***
|
|
||||||
if (sw != null) sw.Close();
|
|
||||||
sw = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Read a value from local cache ***
|
|
||||||
internal string GetValue(string SectionName, string Key, string DefaultValue)
|
|
||||||
{
|
|
||||||
// *** Lazy loading ***
|
|
||||||
if (m_Lazy)
|
|
||||||
{
|
|
||||||
m_Lazy = false;
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (m_Lock)
|
|
||||||
{
|
|
||||||
// *** Check if the section exists ***
|
|
||||||
Dictionary<string, string> Section;
|
|
||||||
if (!m_Sections.TryGetValue(SectionName, out Section)) return DefaultValue;
|
|
||||||
|
|
||||||
// *** Check if the key exists ***
|
|
||||||
string Value;
|
|
||||||
if (!Section.TryGetValue(Key, out Value)) return DefaultValue;
|
|
||||||
|
|
||||||
// *** Return the found value ***
|
|
||||||
return Value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Insert or modify a value in local cache ***
|
|
||||||
internal void SetValue(string SectionName, string Key, string Value)
|
|
||||||
{
|
|
||||||
// *** Lazy loading ***
|
|
||||||
if (m_Lazy)
|
|
||||||
{
|
|
||||||
m_Lazy = false;
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (m_Lock)
|
|
||||||
{
|
|
||||||
// *** Flag local cache modification ***
|
|
||||||
m_CacheModified = true;
|
|
||||||
|
|
||||||
// *** Check if the section exists ***
|
|
||||||
Dictionary<string, string> Section;
|
|
||||||
if (!m_Sections.TryGetValue(SectionName, out Section))
|
|
||||||
{
|
|
||||||
// *** If it doesn't, add it ***
|
|
||||||
Section = new Dictionary<string, string>();
|
|
||||||
m_Sections.Add(SectionName,Section);
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Modify the value ***
|
|
||||||
if (Section.ContainsKey(Key)) Section.Remove(Key);
|
|
||||||
Section.Add(Key, Value);
|
|
||||||
|
|
||||||
// *** Add the modified value to local modified values cache ***
|
|
||||||
if (!m_Modified.TryGetValue(SectionName, out Section))
|
|
||||||
{
|
|
||||||
Section = new Dictionary<string, string>();
|
|
||||||
m_Modified.Add(SectionName, Section);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Section.ContainsKey(Key)) Section.Remove(Key);
|
|
||||||
Section.Add(Key, Value);
|
|
||||||
|
|
||||||
// *** Automatic flushing : immediately write any modification to the file ***
|
|
||||||
if (m_AutoFlush) PerformFlush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Encode byte array ***
|
|
||||||
private string EncodeByteArray(byte[] Value)
|
|
||||||
{
|
|
||||||
if (Value == null) return null;
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
foreach (byte b in Value)
|
|
||||||
{
|
|
||||||
string hex = Convert.ToString(b, 16);
|
|
||||||
int l = hex.Length;
|
|
||||||
if (l > 2)
|
|
||||||
{
|
|
||||||
sb.Append(hex.Substring(l - 2, 2));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (l < 2) sb.Append("0");
|
|
||||||
sb.Append(hex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Decode byte array ***
|
|
||||||
private byte[] DecodeByteArray(string Value)
|
|
||||||
{
|
|
||||||
if (Value == null) return null;
|
|
||||||
|
|
||||||
int l = Value.Length;
|
|
||||||
if (l < 2) return new byte[] { };
|
|
||||||
|
|
||||||
l /= 2;
|
|
||||||
byte[] Result = new byte[l];
|
|
||||||
for (int i = 0; i < l; i++) Result[i] = Convert.ToByte(Value.Substring(i * 2, 2), 16);
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Getters for various types ***
|
|
||||||
internal bool GetValue(string SectionName, string Key, bool DefaultValue)
|
|
||||||
{
|
|
||||||
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(System.Globalization.CultureInfo.InvariantCulture));
|
|
||||||
int Value;
|
|
||||||
if (int.TryParse(StringValue, out Value)) return (Value != 0);
|
|
||||||
return DefaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal int GetValue(string SectionName, string Key, int DefaultValue)
|
|
||||||
{
|
|
||||||
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(CultureInfo.InvariantCulture));
|
|
||||||
int Value;
|
|
||||||
if (int.TryParse(StringValue, NumberStyles.Any, CultureInfo.InvariantCulture, out Value)) return Value;
|
|
||||||
return DefaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal long GetValue(string SectionName, string Key, long DefaultValue)
|
|
||||||
{
|
|
||||||
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(CultureInfo.InvariantCulture));
|
|
||||||
long Value;
|
|
||||||
if (long.TryParse(StringValue, NumberStyles.Any, CultureInfo.InvariantCulture, out Value)) return Value;
|
|
||||||
return DefaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal double GetValue(string SectionName, string Key, double DefaultValue)
|
|
||||||
{
|
|
||||||
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(CultureInfo.InvariantCulture));
|
|
||||||
double Value;
|
|
||||||
if (double.TryParse(StringValue, NumberStyles.Any, CultureInfo.InvariantCulture, out Value)) return Value;
|
|
||||||
return DefaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal byte[] GetValue(string SectionName, string Key, byte[] DefaultValue)
|
|
||||||
{
|
|
||||||
string StringValue = GetValue(SectionName, Key, EncodeByteArray(DefaultValue));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return DecodeByteArray(StringValue);
|
|
||||||
}
|
|
||||||
catch (FormatException)
|
|
||||||
{
|
|
||||||
return DefaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal DateTime GetValue(string SectionName, string Key, DateTime DefaultValue)
|
|
||||||
{
|
|
||||||
string StringValue = GetValue(SectionName, Key, DefaultValue.ToString(CultureInfo.InvariantCulture));
|
|
||||||
DateTime Value;
|
|
||||||
if (DateTime.TryParse(StringValue, CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces | DateTimeStyles.NoCurrentDateDefault | DateTimeStyles.AssumeLocal, out Value)) return Value;
|
|
||||||
return DefaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *** Setters for various types ***
|
|
||||||
internal void SetValue(string SectionName, string Key, bool Value)
|
|
||||||
{
|
|
||||||
SetValue(SectionName, Key, (Value) ? ("1") : ("0"));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetValue(string SectionName, string Key, int Value)
|
|
||||||
{
|
|
||||||
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetValue(string SectionName, string Key, long Value)
|
|
||||||
{
|
|
||||||
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetValue(string SectionName, string Key, double Value)
|
|
||||||
{
|
|
||||||
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetValue(string SectionName, string Key, byte[] Value)
|
|
||||||
{
|
|
||||||
SetValue(SectionName, Key, EncodeByteArray(Value));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetValue(string SectionName, string Key, DateTime Value)
|
|
||||||
{
|
|
||||||
SetValue(SectionName, Key, Value.ToString(CultureInfo.InvariantCulture));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.dataobjects
|
namespace FFXIVClassic_Lobby_Server.dataobjects
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Lobby_Server.dataobjects
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.dataobjects
|
|
||||||
{
|
{
|
||||||
class Appearance
|
class Appearance
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using FFXIVClassic.Common;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.dataobjects
|
namespace FFXIVClassic_Lobby_Server.dataobjects
|
||||||
@ -60,7 +56,7 @@ namespace FFXIVClassic_Lobby_Server.dataobjects
|
|||||||
public uint feet;
|
public uint feet;
|
||||||
public uint belt;
|
public uint belt;
|
||||||
|
|
||||||
public static CharaInfo getFromNewCharRequest(String encoded)
|
public static CharaInfo GetFromNewCharRequest(String encoded)
|
||||||
{
|
{
|
||||||
byte[] data = Convert.FromBase64String(encoded.Replace('-', '+').Replace('_', '/'));
|
byte[] data = Convert.FromBase64String(encoded.Replace('-', '+').Replace('_', '/'));
|
||||||
|
|
||||||
@ -120,7 +116,7 @@ namespace FFXIVClassic_Lobby_Server.dataobjects
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildForCharaList(Character chara, Appearance appearance)
|
public static String BuildForCharaList(Character chara, Appearance appearance)
|
||||||
{
|
{
|
||||||
byte[] data;
|
byte[] data;
|
||||||
|
|
||||||
@ -150,7 +146,7 @@ namespace FFXIVClassic_Lobby_Server.dataobjects
|
|||||||
writer.Write(System.Text.Encoding.UTF8.GetBytes(chara.name + '\0'));
|
writer.Write(System.Text.Encoding.UTF8.GetBytes(chara.name + '\0'));
|
||||||
writer.Write((UInt32)0x1c);
|
writer.Write((UInt32)0x1c);
|
||||||
writer.Write((UInt32)0x04);
|
writer.Write((UInt32)0x04);
|
||||||
writer.Write((UInt32)getTribeModel(chara.tribe));
|
writer.Write((UInt32)GetTribeModel(chara.tribe));
|
||||||
writer.Write((UInt32)appearance.size);
|
writer.Write((UInt32)appearance.size);
|
||||||
uint colorVal = appearance.skinColor | (uint)(appearance.hairColor << 10) | (uint)(appearance.eyeColor << 20);
|
uint colorVal = appearance.skinColor | (uint)(appearance.hairColor << 10) | (uint)(appearance.eyeColor << 20);
|
||||||
writer.Write((UInt32)colorVal);
|
writer.Write((UInt32)colorVal);
|
||||||
@ -227,16 +223,16 @@ namespace FFXIVClassic_Lobby_Server.dataobjects
|
|||||||
return Convert.ToBase64String(data).Replace('+', '-').Replace('/', '_');
|
return Convert.ToBase64String(data).Replace('+', '-').Replace('/', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String debug()
|
public static String Debug()
|
||||||
{
|
{
|
||||||
byte[] bytes = File.ReadAllBytes("./packets/charaappearance.bin");
|
byte[] bytes = File.ReadAllBytes("./packets/charaappearance.bin");
|
||||||
|
|
||||||
Console.WriteLine(Utils.ByteArrayToHex(bytes));
|
Program.Log.Debug(Utils.ByteArrayToHex(bytes));
|
||||||
|
|
||||||
return Convert.ToBase64String(bytes).Replace('+', '-').Replace('/', '_');
|
return Convert.ToBase64String(bytes).Replace('+', '-').Replace('/', '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt32 getTribeModel(byte tribe)
|
public static UInt32 GetTribeModel(byte tribe)
|
||||||
{
|
{
|
||||||
switch (tribe)
|
switch (tribe)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using FFXIVClassic.Common;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using FFXIVClassic_Lobby_Server.dataobjects;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
@ -37,9 +33,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
charaInfo.Replace("/", "_");
|
charaInfo.Replace("/", "_");
|
||||||
byte[] data = System.Convert.FromBase64String(charaInfo);
|
byte[] data = System.Convert.FromBase64String(charaInfo);
|
||||||
|
|
||||||
Console.WriteLine("------------Base64 printout------------------");
|
Program.Log.Debug("------------Base64 printout------------------");
|
||||||
Console.WriteLine(Utils.ByteArrayToHex(data));
|
Program.Log.Debug(Utils.ByteArrayToHex(data));
|
||||||
Console.WriteLine("------------Base64 printout------------------");
|
Program.Log.Debug("------------Base64 printout------------------");
|
||||||
|
|
||||||
CharaInfo chara = new CharaInfo();
|
CharaInfo chara = new CharaInfo();
|
||||||
|
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Lobby_Server
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
|
||||||
{
|
{
|
||||||
class Retainer
|
class Retainer
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Lobby_Server.dataobjects
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.dataobjects
|
|
||||||
{
|
{
|
||||||
class World
|
class World
|
||||||
{
|
{
|
||||||
|
@ -4,4 +4,7 @@
|
|||||||
<package id="Dapper" version="1.42" targetFramework="net45" />
|
<package id="Dapper" version="1.42" targetFramework="net45" />
|
||||||
<package id="MySql.Data" version="6.9.7" targetFramework="net45" />
|
<package id="MySql.Data" version="6.9.7" targetFramework="net45" />
|
||||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
|
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
|
||||||
|
<package id="NLog" version="4.3.4" targetFramework="net45" />
|
||||||
|
<package id="NLog.Config" version="4.3.4" targetFramework="net45" />
|
||||||
|
<package id="NLog.Schema" version="4.3.4" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
@ -106,7 +103,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> getSubpackets()
|
public List<SubPacket> GetSubpackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>(header.numSubpackets);
|
List<SubPacket> subpackets = new List<SubPacket>(header.numSubpackets);
|
||||||
|
|
||||||
@ -118,7 +115,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return subpackets;
|
return subpackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static BasePacketHeader getHeader(byte[] bytes)
|
public unsafe static BasePacketHeader GetHeader(byte[] bytes)
|
||||||
{
|
{
|
||||||
BasePacketHeader header;
|
BasePacketHeader header;
|
||||||
if (bytes.Length < BASEPACKET_SIZE)
|
if (bytes.Length < BASEPACKET_SIZE)
|
||||||
@ -132,7 +129,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getHeaderBytes()
|
public byte[] GetHeaderBytes()
|
||||||
{
|
{
|
||||||
int size = Marshal.SizeOf(header);
|
int size = Marshal.SizeOf(header);
|
||||||
byte[] arr = new byte[size];
|
byte[] arr = new byte[size];
|
||||||
@ -144,16 +141,16 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getPacketBytes()
|
public byte[] GetPacketBytes()
|
||||||
{
|
{
|
||||||
byte[] outBytes = new byte[header.packetSize];
|
byte[] outBytes = new byte[header.packetSize];
|
||||||
Array.Copy(getHeaderBytes(), 0, outBytes, 0, BASEPACKET_SIZE);
|
Array.Copy(GetHeaderBytes(), 0, outBytes, 0, BASEPACKET_SIZE);
|
||||||
Array.Copy(data, 0, outBytes, BASEPACKET_SIZE, data.Length);
|
Array.Copy(data, 0, outBytes, BASEPACKET_SIZE, data.Length);
|
||||||
return outBytes;
|
return outBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Replaces all instances of the sniffed actorID with the given one
|
//Replaces all instances of the sniffed actorID with the given one
|
||||||
public void replaceActorID(uint actorID)
|
public void ReplaceActorID(uint actorID)
|
||||||
{
|
{
|
||||||
using (MemoryStream mem = new MemoryStream(data))
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
{
|
{
|
||||||
@ -176,7 +173,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Replaces all instances of the sniffed actorID with the given one
|
//Replaces all instances of the sniffed actorID with the given one
|
||||||
public void replaceActorID(uint fromActorID, uint actorID)
|
public void ReplaceActorID(uint fromActorID, uint actorID)
|
||||||
{
|
{
|
||||||
using (MemoryStream mem = new MemoryStream(data))
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
{
|
{
|
||||||
@ -199,7 +196,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Utility Functions
|
#region Utility Functions
|
||||||
public static BasePacket createPacket(List<SubPacket> subpackets, bool isAuthed, bool isEncrypted)
|
public static BasePacket CreatePacket(List<SubPacket> subpackets, bool isAuthed, bool isEncrypted)
|
||||||
{
|
{
|
||||||
//Create Header
|
//Create Header
|
||||||
BasePacketHeader header = new BasePacketHeader();
|
BasePacketHeader header = new BasePacketHeader();
|
||||||
@ -221,7 +218,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
int offset = 0;
|
int offset = 0;
|
||||||
foreach (SubPacket subpacket in subpackets)
|
foreach (SubPacket subpacket in subpackets)
|
||||||
{
|
{
|
||||||
byte[] subpacketData = subpacket.getBytes();
|
byte[] subpacketData = subpacket.GetBytes();
|
||||||
Array.Copy(subpacketData, 0, data, offset, subpacketData.Length);
|
Array.Copy(subpacketData, 0, data, offset, subpacketData.Length);
|
||||||
offset += (ushort)subpacketData.Length;
|
offset += (ushort)subpacketData.Length;
|
||||||
}
|
}
|
||||||
@ -232,7 +229,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BasePacket createPacket(SubPacket subpacket, bool isAuthed, bool isEncrypted)
|
public static BasePacket CreatePacket(SubPacket subpacket, bool isAuthed, bool isEncrypted)
|
||||||
{
|
{
|
||||||
//Create Header
|
//Create Header
|
||||||
BasePacketHeader header = new BasePacketHeader();
|
BasePacketHeader header = new BasePacketHeader();
|
||||||
@ -250,7 +247,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
data = new byte[header.packetSize - 0x10];
|
data = new byte[header.packetSize - 0x10];
|
||||||
|
|
||||||
//Add Subpackets
|
//Add Subpackets
|
||||||
byte[] subpacketData = subpacket.getBytes();
|
byte[] subpacketData = subpacket.GetBytes();
|
||||||
Array.Copy(subpacketData, 0, data, 0, subpacketData.Length);
|
Array.Copy(subpacketData, 0, data, 0, subpacketData.Length);
|
||||||
|
|
||||||
Debug.Assert(data != null);
|
Debug.Assert(data != null);
|
||||||
@ -259,7 +256,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BasePacket createPacket(byte[] data, bool isAuthed, bool isEncrypted)
|
public static BasePacket CreatePacket(byte[] data, bool isAuthed, bool isEncrypted)
|
||||||
{
|
{
|
||||||
|
|
||||||
Debug.Assert(data != null);
|
Debug.Assert(data != null);
|
||||||
@ -280,7 +277,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void encryptPacket(Blowfish blowfish, BasePacket packet)
|
public static unsafe void EncryptPacket(Blowfish blowfish, BasePacket packet)
|
||||||
{
|
{
|
||||||
byte[] data = packet.data;
|
byte[] data = packet.data;
|
||||||
int size = packet.header.packetSize;
|
int size = packet.header.packetSize;
|
||||||
@ -307,7 +304,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void decryptPacket(Blowfish blowfish, ref BasePacket packet)
|
public static unsafe void DecryptPacket(Blowfish blowfish, ref BasePacket packet)
|
||||||
{
|
{
|
||||||
byte[] data = packet.data;
|
byte[] data = packet.data;
|
||||||
int size = packet.header.packetSize;
|
int size = packet.header.packetSize;
|
||||||
@ -334,14 +331,18 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void debugPrintPacket()
|
public void DebugPrintPacket()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.BackgroundColor = ConsoleColor.DarkYellow;
|
Console.BackgroundColor = ConsoleColor.DarkYellow;
|
||||||
Console.WriteLine("IsAuthed: {0}, IsEncrypted: {1}, Size: 0x{2:X}, Num Subpackets: {3}", header.isAuthenticated, header.isEncrypted, header.packetSize, header.numSubpackets);
|
|
||||||
Console.WriteLine("{0}", Utils.ByteArrayToHex(getHeaderBytes()));
|
Program.Log.Debug("IsAuth: {0} Size: 0x{1:X}, NumSubpackets: {2}{3}{4}", header.isAuthenticated, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||||
foreach (SubPacket sub in getSubpackets())
|
|
||||||
sub.debugPrintSubPacket();
|
foreach (SubPacket sub in GetSubpackets())
|
||||||
|
{
|
||||||
|
sub.DebugPrintSubPacket();
|
||||||
|
}
|
||||||
|
|
||||||
Console.BackgroundColor = ConsoleColor.Black;
|
Console.BackgroundColor = ConsoleColor.Black;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
|
||||||
{
|
{
|
||||||
class HardCoded_Packets
|
class HardCoded_Packets
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -106,7 +101,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
data = original.data;
|
data = original.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getHeaderBytes()
|
public byte[] GetHeaderBytes()
|
||||||
{
|
{
|
||||||
int size = Marshal.SizeOf(header);
|
int size = Marshal.SizeOf(header);
|
||||||
byte[] arr = new byte[size];
|
byte[] arr = new byte[size];
|
||||||
@ -118,7 +113,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getGameMessageBytes()
|
public byte[] GetGameMessageBytes()
|
||||||
{
|
{
|
||||||
int size = Marshal.SizeOf(gameMessage);
|
int size = Marshal.SizeOf(gameMessage);
|
||||||
byte[] arr = new byte[size];
|
byte[] arr = new byte[size];
|
||||||
@ -130,31 +125,29 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes()
|
public byte[] GetBytes()
|
||||||
{
|
{
|
||||||
byte[] outBytes = new byte[header.subpacketSize];
|
byte[] outBytes = new byte[header.subpacketSize];
|
||||||
Array.Copy(getHeaderBytes(), 0, outBytes, 0, SUBPACKET_SIZE);
|
Array.Copy(GetHeaderBytes(), 0, outBytes, 0, SUBPACKET_SIZE);
|
||||||
|
|
||||||
if (header.type == 0x3)
|
if (header.type == 0x3)
|
||||||
Array.Copy(getGameMessageBytes(), 0, outBytes, SUBPACKET_SIZE, GAMEMESSAGE_SIZE);
|
Array.Copy(GetGameMessageBytes(), 0, outBytes, SUBPACKET_SIZE, GAMEMESSAGE_SIZE);
|
||||||
|
|
||||||
Array.Copy(data, 0, outBytes, SUBPACKET_SIZE + (header.type == 0x3 ? GAMEMESSAGE_SIZE : 0), data.Length);
|
Array.Copy(data, 0, outBytes, SUBPACKET_SIZE + (header.type == 0x3 ? GAMEMESSAGE_SIZE : 0), data.Length);
|
||||||
return outBytes;
|
return outBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugPrintSubPacket()
|
public void DebugPrintSubPacket()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.BackgroundColor = ConsoleColor.DarkRed;
|
Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||||
Console.WriteLine("Size: 0x{0:X}", header.subpacketSize);
|
|
||||||
if (header.type == 0x03)
|
if (header.type == 0x03)
|
||||||
Console.WriteLine("Opcode: 0x{0:X}", gameMessage.opcode);
|
{
|
||||||
Console.WriteLine("{0}", Utils.ByteArrayToHex(getHeaderBytes()));
|
Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(GetGameMessageBytes(), SUBPACKET_SIZE));
|
||||||
if (header.type == 0x03)
|
}
|
||||||
Console.WriteLine("{0}", Utils.ByteArrayToHex(getGameMessageBytes()));
|
|
||||||
Console.BackgroundColor = ConsoleColor.DarkMagenta;
|
Program.Log.Debug("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE));
|
||||||
Console.WriteLine("{0}", Utils.ByteArrayToHex(data));
|
|
||||||
Console.BackgroundColor = ConsoleColor.Black;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets.receive
|
namespace FFXIVClassic_Lobby_Server.packets.receive
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets.receive
|
namespace FFXIVClassic_Lobby_Server.packets.receive
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets.receive
|
namespace FFXIVClassic_Lobby_Server.packets.receive
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets.receive
|
namespace FFXIVClassic_Lobby_Server.packets.receive
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -22,7 +20,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.accountList = accountList;
|
this.accountList = accountList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> buildPackets()
|
public List<SubPacket> BuildPackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subPackets = new List<SubPacket>();
|
List<SubPacket> subPackets = new List<SubPacket>();
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -39,7 +36,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.worldName = worldName;
|
this.worldName = worldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket buildPacket()
|
public SubPacket BuildPacket()
|
||||||
{
|
{
|
||||||
MemoryStream memStream = new MemoryStream(0x1F0);
|
MemoryStream memStream = new MemoryStream(0x1F0);
|
||||||
BinaryWriter binWriter = new BinaryWriter(memStream);
|
BinaryWriter binWriter = new BinaryWriter(memStream);
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using FFXIVClassic_Lobby_Server.dataobjects;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -23,7 +20,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.characterList = characterList;
|
this.characterList = characterList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> buildPackets()
|
public List<SubPacket> BuildPackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subPackets = new List<SubPacket>();
|
List<SubPacket> subPackets = new List<SubPacket>();
|
||||||
|
|
||||||
@ -37,7 +34,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
|
|
||||||
foreach (Character chara in characterList)
|
foreach (Character chara in characterList)
|
||||||
{
|
{
|
||||||
Appearance appearance = Database.getAppearance(chara.id);
|
Appearance appearance = Database.GetAppearance(chara.id);
|
||||||
|
|
||||||
if (totalCount == 0 || characterCount % MAXPERPACKET == 0)
|
if (totalCount == 0 || characterCount % MAXPERPACKET == 0)
|
||||||
{
|
{
|
||||||
@ -56,7 +53,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
binWriter.Seek(0x10 + (0x1D0 * characterCount), SeekOrigin.Begin);
|
binWriter.Seek(0x10 + (0x1D0 * characterCount), SeekOrigin.Begin);
|
||||||
|
|
||||||
//Write Entries
|
//Write Entries
|
||||||
World world = Database.getServer(chara.serverId);
|
World world = Database.GetServer(chara.serverId);
|
||||||
string worldname = world == null ? "Unknown" : world.name;
|
string worldname = world == null ? "Unknown" : world.name;
|
||||||
|
|
||||||
binWriter.Write((uint)0); //???
|
binWriter.Write((uint)0); //???
|
||||||
@ -77,8 +74,8 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
binWriter.Write(Encoding.ASCII.GetBytes(chara.name.PadRight(0x20, '\0'))); //Name
|
binWriter.Write(Encoding.ASCII.GetBytes(chara.name.PadRight(0x20, '\0'))); //Name
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(worldname.PadRight(0xE, '\0'))); //World Name
|
binWriter.Write(Encoding.ASCII.GetBytes(worldname.PadRight(0xE, '\0'))); //World Name
|
||||||
|
|
||||||
binWriter.Write(CharaInfo.buildForCharaList(chara, appearance)); //Appearance Data
|
binWriter.Write(CharaInfo.BuildForCharaList(chara, appearance)); //Appearance Data
|
||||||
//binWriter.Write(CharaInfo.debug()); //Appearance Data
|
//binWriter.Write(CharaInfo.Debug()); //Appearance Data
|
||||||
|
|
||||||
characterCount++;
|
characterCount++;
|
||||||
totalCount++;
|
totalCount++;
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -26,7 +23,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket buildPacket()
|
public SubPacket BuildPacket()
|
||||||
{
|
{
|
||||||
MemoryStream memStream = new MemoryStream(0x210);
|
MemoryStream memStream = new MemoryStream(0x210);
|
||||||
BinaryWriter binWriter = new BinaryWriter(memStream);
|
BinaryWriter binWriter = new BinaryWriter(memStream);
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -22,7 +19,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.namesList = names;
|
this.namesList = names;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> buildPackets()
|
public List<SubPacket> BuildPackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subPackets = new List<SubPacket>();
|
List<SubPacket> subPackets = new List<SubPacket>();
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -22,7 +19,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.retainerList = retainerList;
|
this.retainerList = retainerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> buildPackets()
|
public List<SubPacket> BuildPackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subPackets = new List<SubPacket>();
|
List<SubPacket> subPackets = new List<SubPacket>();
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -28,7 +26,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.selectCharTicket = selectCharTicket;
|
this.selectCharTicket = selectCharTicket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> buildPackets()
|
public List<SubPacket> BuildPackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subPackets = new List<SubPacket>();
|
List<SubPacket> subPackets = new List<SubPacket>();
|
||||||
|
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.packets
|
namespace FFXIVClassic_Lobby_Server.packets
|
||||||
{
|
{
|
||||||
@ -22,7 +20,7 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||||||
this.worldList = serverList;
|
this.worldList = serverList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> buildPackets()
|
public List<SubPacket> BuildPackets()
|
||||||
{
|
{
|
||||||
List<SubPacket> subPackets = new List<SubPacket>();
|
List<SubPacket> subPackets = new List<SubPacket>();
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.utils
|
namespace FFXIVClassic_Lobby_Server.utils
|
||||||
{
|
{
|
||||||
|
@ -1,18 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using System.Diagnostics;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.IO;
|
|
||||||
using Cyotek.Collections.Generic;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class ClientConnection
|
class ClientConnection
|
||||||
{
|
{
|
||||||
@ -20,54 +13,54 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
public Blowfish blowfish;
|
public Blowfish blowfish;
|
||||||
public Socket socket;
|
public Socket socket;
|
||||||
public byte[] buffer;
|
public byte[] buffer;
|
||||||
private BlockingCollection<BasePacket> sendPacketQueue = new BlockingCollection<BasePacket>(1000);
|
private BlockingCollection<BasePacket> SendPacketQueue = new BlockingCollection<BasePacket>(1000);
|
||||||
public int lastPartialSize = 0;
|
public int lastPartialSize = 0;
|
||||||
|
|
||||||
//Instance Stuff
|
//Instance Stuff
|
||||||
public uint owner = 0;
|
public uint owner = 0;
|
||||||
public int connType = 0;
|
public int connType = 0;
|
||||||
|
|
||||||
public void queuePacket(BasePacket packet)
|
public void QueuePacket(BasePacket packet)
|
||||||
{
|
{
|
||||||
sendPacketQueue.Add(packet);
|
SendPacketQueue.Add(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queuePacket(SubPacket subpacket, bool isAuthed, bool isEncrypted)
|
public void QueuePacket(SubPacket subpacket, bool isAuthed, bool isEncrypted)
|
||||||
{
|
{
|
||||||
sendPacketQueue.Add(BasePacket.createPacket(subpacket, isAuthed, isEncrypted));
|
SendPacketQueue.Add(BasePacket.CreatePacket(subpacket, isAuthed, isEncrypted));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flushQueuedSendPackets()
|
public void FlushQueuedSendPackets()
|
||||||
{
|
{
|
||||||
if (!socket.Connected)
|
if (!socket.Connected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (sendPacketQueue.Count > 0)
|
while (SendPacketQueue.Count > 0)
|
||||||
{
|
{
|
||||||
BasePacket packet = sendPacketQueue.Take();
|
BasePacket packet = SendPacketQueue.Take();
|
||||||
|
|
||||||
byte[] packetBytes = packet.getPacketBytes();
|
byte[] packetBytes = packet.GetPacketBytes();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
socket.Send(packetBytes);
|
socket.Send(packetBytes);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{ Log.error(String.Format("Weird case, socket was d/ced: {0}", e)); }
|
{ Program.Log.Error("Weird case, socket was d/ced: {0}", e); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAddress()
|
public String GetAddress()
|
||||||
{
|
{
|
||||||
return String.Format("{0}:{1}", (socket.RemoteEndPoint as IPEndPoint).Address, (socket.RemoteEndPoint as IPEndPoint).Port);
|
return String.Format("{0}:{1}", (socket.RemoteEndPoint as IPEndPoint).Address, (socket.RemoteEndPoint as IPEndPoint).Port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isConnected()
|
public bool IsConnected()
|
||||||
{
|
{
|
||||||
return (socket.Poll(1, SelectMode.SelectRead) && socket.Available == 0);
|
return (socket.Poll(1, SelectMode.SelectRead) && socket.Available == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
if (socket.Connected)
|
if (socket.Connected)
|
||||||
socket.Disconnect(false);
|
socket.Disconnect(false);
|
||||||
|
@ -6,9 +6,9 @@ using System.Net;
|
|||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server;
|
using FFXIVClassic_Map_Server;
|
||||||
@ -19,7 +19,7 @@ using FFXIVClassic_Map_Server.lua;
|
|||||||
using FFXIVClassic_Map_Server.actors.chara.player;
|
using FFXIVClassic_Map_Server.actors.chara.player;
|
||||||
using FFXIVClassic_Map_Server.Properties;
|
using FFXIVClassic_Map_Server.Properties;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class CommandProcessor
|
class CommandProcessor
|
||||||
{
|
{
|
||||||
@ -35,45 +35,45 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectedPlayerList = playerList;
|
mConnectedPlayerList = playerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPacket(ConnectedPlayer client, string path)
|
public void SendPacket(ConnectedPlayer client, string path)
|
||||||
{
|
{
|
||||||
BasePacket packet = new BasePacket(path);
|
BasePacket packet = new BasePacket(path);
|
||||||
|
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
packet.replaceActorID(client.actorID);
|
packet.ReplaceActorID(client.actorID);
|
||||||
client.queuePacket(packet);
|
client.QueuePacket(packet);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
packet.replaceActorID(entry.Value.actorID);
|
packet.ReplaceActorID(entry.Value.actorID);
|
||||||
entry.Value.queuePacket(packet);
|
entry.Value.QueuePacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeProperty(uint id, uint value, string target)
|
public void ChangeProperty(uint id, uint value, string target)
|
||||||
{
|
{
|
||||||
SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(target);
|
SetActorPropetyPacket ChangeProperty = new SetActorPropetyPacket(target);
|
||||||
|
|
||||||
changeProperty.setTarget(target);
|
ChangeProperty.SetTarget(target);
|
||||||
changeProperty.addInt(id, value);
|
ChangeProperty.AddInt(id, value);
|
||||||
changeProperty.addTarget();
|
ChangeProperty.AddTarget();
|
||||||
|
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
SubPacket changePropertyPacket = changeProperty.buildPacket((entry.Value.actorID), (entry.Value.actorID));
|
SubPacket ChangePropertyPacket = ChangeProperty.BuildPacket((entry.Value.actorID), (entry.Value.actorID));
|
||||||
|
|
||||||
BasePacket packet = BasePacket.createPacket(changePropertyPacket, true, false);
|
BasePacket packet = BasePacket.CreatePacket(ChangePropertyPacket, true, false);
|
||||||
packet.debugPrintPacket();
|
packet.DebugPrintPacket();
|
||||||
|
|
||||||
entry.Value.queuePacket(packet);
|
entry.Value.QueuePacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doMusic(ConnectedPlayer client, string music)
|
public void DoMusic(ConnectedPlayer client, string music)
|
||||||
{
|
{
|
||||||
ushort musicId;
|
ushort musicId;
|
||||||
|
|
||||||
@ -83,13 +83,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
musicId = Convert.ToUInt16(music);
|
musicId = Convert.ToUInt16(music);
|
||||||
|
|
||||||
if (client != null)
|
if (client != null)
|
||||||
client.queuePacket(BasePacket.createPacket(SetMusicPacket.buildPacket(client.actorID, musicId, 1), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SetMusicPacket.BuildPacket(client.actorID, musicId, 1), true, false));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
BasePacket musicPacket = BasePacket.createPacket(SetMusicPacket.buildPacket(entry.Value.actorID, musicId, 1), true, false);
|
BasePacket musicPacket = BasePacket.CreatePacket(SetMusicPacket.BuildPacket(entry.Value.actorID, musicId, 1), true, false);
|
||||||
entry.Value.queuePacket(musicPacket);
|
entry.Value.QueuePacket(musicPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,228 +99,228 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client">The current player</param>
|
/// <param name="client">The current player</param>
|
||||||
/// <param name="id">Predefined list: <ffxiv_database>\server_zones_spawnlocations</param>
|
/// <param name="id">Predefined list: <ffxiv_database>\server_zones_spawnlocations</param>
|
||||||
public void doWarp(ConnectedPlayer client, uint id)
|
public void DoWarp(ConnectedPlayer client, uint id)
|
||||||
{
|
{
|
||||||
WorldManager worldManager = Server.GetWorldManager();
|
WorldManager worldManager = Server.GetWorldManager();
|
||||||
FFXIVClassic_Map_Server.WorldManager.ZoneEntrance ze = worldManager.getZoneEntrance(id);
|
FFXIVClassic_Map_Server.WorldManager.ZoneEntrance ze = worldManager.GetZoneEntrance(id);
|
||||||
|
|
||||||
if (ze == null)
|
if (ze == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (client != null)
|
if (client != null)
|
||||||
worldManager.DoZoneChange(client.getActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
worldManager.DoZoneChange(client.GetActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
worldManager.DoZoneChange(entry.Value.getActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
worldManager.DoZoneChange(entry.Value.GetActor(), ze.zoneId, ze.privateAreaName, ze.spawnType, ze.spawnX, ze.spawnY, ze.spawnZ, ze.spawnRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doWarp(ConnectedPlayer client, uint zoneId, string privateArea, byte spawnType, float x, float y, float z, float r)
|
public void DoWarp(ConnectedPlayer client, uint zoneId, string privateArea, byte spawnType, float x, float y, float z, float r)
|
||||||
{
|
{
|
||||||
WorldManager worldManager = Server.GetWorldManager();
|
WorldManager worldManager = Server.GetWorldManager();
|
||||||
if (worldManager.GetZone(zoneId) == null)
|
if (worldManager.GetZone(zoneId) == null)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", "Zone does not exist or setting isn't valid."), true, false));
|
||||||
Log.error("Zone does not exist or setting isn't valid.");
|
Program.Log.Error("Zone does not exist or setting isn't valid.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client != null)
|
if (client != null)
|
||||||
worldManager.DoZoneChange(client.getActor(), zoneId, privateArea, spawnType, x, y, z, r);
|
worldManager.DoZoneChange(client.GetActor(), zoneId, privateArea, spawnType, x, y, z, r);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
worldManager.DoZoneChange(entry.Value.getActor(), zoneId, privateArea, spawnType, x, y, z, r);
|
worldManager.DoZoneChange(entry.Value.GetActor(), zoneId, privateArea, spawnType, x, y, z, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printPos(ConnectedPlayer client)
|
public void PrintPos(ConnectedPlayer client)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation)), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation)), true, false));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
Log.info(String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation));
|
Program.Log.Info(String.Format("{0}\'s position: ZoneID: {1}, X: {2}, Y: {3}, Z: {4}, Rotation: {5}", p.customDisplayName, p.zoneId, p.positionX, p.positionY, p.positionZ, p.rotation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGraphic(ConnectedPlayer client, uint slot, uint wId, uint eId, uint vId, uint cId)
|
private void SetGraphic(ConnectedPlayer client, uint slot, uint wId, uint eId, uint vId, uint cId)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.graphicChange(slot, wId, eId, vId, cId);
|
p.GraphicChange(slot, wId, eId, vId, cId);
|
||||||
p.sendAppearance();
|
p.SendAppearance();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.graphicChange(slot, wId, eId, vId, cId);
|
p.GraphicChange(slot, wId, eId, vId, cId);
|
||||||
p.sendAppearance();
|
p.SendAppearance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void giveItem(ConnectedPlayer client, uint itemId, int quantity)
|
private void GiveItem(ConnectedPlayer client, uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.getInventory(Inventory.NORMAL).addItem(itemId, quantity);
|
p.GetInventory(Inventory.NORMAL).AddItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.getInventory(Inventory.NORMAL).addItem(itemId, quantity);
|
p.GetInventory(Inventory.NORMAL).AddItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void giveItem(ConnectedPlayer client, uint itemId, int quantity, ushort type)
|
private void GiveItem(ConnectedPlayer client, uint itemId, int quantity, ushort type)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
|
|
||||||
if (p.getInventory(type) != null)
|
if (p.GetInventory(type) != null)
|
||||||
p.getInventory(type).addItem(itemId, quantity);
|
p.GetInventory(type).AddItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
|
|
||||||
if (p.getInventory(type) != null)
|
if (p.GetInventory(type) != null)
|
||||||
p.getInventory(type).addItem(itemId, quantity);
|
p.GetInventory(type).AddItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeItem(ConnectedPlayer client, uint itemId, int quantity)
|
private void RemoveItem(ConnectedPlayer client, uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.getInventory(Inventory.NORMAL).removeItem(itemId, quantity);
|
p.GetInventory(Inventory.NORMAL).RemoveItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.getInventory(Inventory.NORMAL).removeItem(itemId, quantity);
|
p.GetInventory(Inventory.NORMAL).RemoveItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeItem(ConnectedPlayer client, uint itemId, int quantity, ushort type)
|
private void RemoveItem(ConnectedPlayer client, uint itemId, int quantity, ushort type)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
|
|
||||||
if (p.getInventory(type) != null)
|
if (p.GetInventory(type) != null)
|
||||||
p.getInventory(type).removeItem(itemId, quantity);
|
p.GetInventory(type).RemoveItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
|
|
||||||
if (p.getInventory(type) != null)
|
if (p.GetInventory(type) != null)
|
||||||
p.getInventory(type).removeItem(itemId, quantity);
|
p.GetInventory(type).RemoveItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void giveCurrency(ConnectedPlayer client, uint itemId, int quantity)
|
private void GiveCurrency(ConnectedPlayer client, uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.getInventory(Inventory.CURRENCY).addItem(itemId, quantity);
|
p.GetInventory(Inventory.CURRENCY).AddItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.getInventory(Inventory.CURRENCY).addItem(itemId, quantity);
|
p.GetInventory(Inventory.CURRENCY).AddItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make removeCurrency() remove all quantity of a currency if quantity_to_remove > quantity_in_inventory instead of silently failing
|
// TODO: make RemoveCurrency() Remove all quantity of a currency if quantity_to_Remove > quantity_in_inventory instead of silently failing
|
||||||
private void removeCurrency(ConnectedPlayer client, uint itemId, int quantity)
|
private void RemoveCurrency(ConnectedPlayer client, uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.getInventory(Inventory.CURRENCY).removeItem(itemId, quantity);
|
p.GetInventory(Inventory.CURRENCY).RemoveItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.getInventory(Inventory.CURRENCY).removeItem(itemId, quantity);
|
p.GetInventory(Inventory.CURRENCY).RemoveItem(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void giveKeyItem(ConnectedPlayer client, uint itemId)
|
private void GiveKeyItem(ConnectedPlayer client, uint itemId)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.getInventory(Inventory.KEYITEMS).addItem(itemId, 1);
|
p.GetInventory(Inventory.KEYITEMS).AddItem(itemId, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.getInventory(Inventory.KEYITEMS).addItem(itemId, 1);
|
p.GetInventory(Inventory.KEYITEMS).AddItem(itemId, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeKeyItem(ConnectedPlayer client, uint itemId)
|
private void RemoveKeyItem(ConnectedPlayer client, uint itemId)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Player p = client.getActor();
|
Player p = client.GetActor();
|
||||||
p.getInventory(Inventory.KEYITEMS).removeItem(itemId, 1);
|
p.GetInventory(Inventory.KEYITEMS).RemoveItem(itemId, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
Player p = entry.Value.getActor();
|
Player p = entry.Value.GetActor();
|
||||||
p.getInventory(Inventory.KEYITEMS).removeItem(itemId, 1);
|
p.GetInventory(Inventory.KEYITEMS).RemoveItem(itemId, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseWarp(ConnectedPlayer client, string[] split)
|
private void ParseWarp(ConnectedPlayer client, string[] split)
|
||||||
{
|
{
|
||||||
float x = 0, y = 0, z = 0, r = 0.0f;
|
float x = 0, y = 0, z = 0, r = 0.0f;
|
||||||
uint zoneId = 0;
|
uint zoneId = 0;
|
||||||
@ -340,7 +340,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
catch{return;}
|
catch{return;}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
doWarp(client, zoneId);
|
DoWarp(client, zoneId);
|
||||||
}
|
}
|
||||||
else if (split.Length == 4)
|
else if (split.Length == 4)
|
||||||
{
|
{
|
||||||
@ -352,7 +352,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (String.IsNullOrEmpty(split[1]))
|
if (String.IsNullOrEmpty(split[1]))
|
||||||
split[1] = "0";
|
split[1] = "0";
|
||||||
|
|
||||||
try { x = Single.Parse(split[1]) + client.getActor().positionX; }
|
try { x = Single.Parse(split[1]) + client.GetActor().positionX; }
|
||||||
catch{return;}
|
catch{return;}
|
||||||
|
|
||||||
split[1] = x.ToString();
|
split[1] = x.ToString();
|
||||||
@ -364,7 +364,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (String.IsNullOrEmpty(split[2]))
|
if (String.IsNullOrEmpty(split[2]))
|
||||||
split[2] = "0";
|
split[2] = "0";
|
||||||
|
|
||||||
try { y = Single.Parse(split[2]) + client.getActor().positionY; }
|
try { y = Single.Parse(split[2]) + client.GetActor().positionY; }
|
||||||
catch{return;}
|
catch{return;}
|
||||||
|
|
||||||
split[2] = y.ToString();
|
split[2] = y.ToString();
|
||||||
@ -376,7 +376,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (String.IsNullOrEmpty(split[3]))
|
if (String.IsNullOrEmpty(split[3]))
|
||||||
split[3] = "0";
|
split[3] = "0";
|
||||||
|
|
||||||
try { z = Single.Parse(split[3]) + client.getActor().positionZ; }
|
try { z = Single.Parse(split[3]) + client.GetActor().positionZ; }
|
||||||
catch{return;}
|
catch{return;}
|
||||||
|
|
||||||
split[3] = z.ToString();
|
split[3] = z.ToString();
|
||||||
@ -390,12 +390,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch{return;}
|
catch{return;}
|
||||||
|
|
||||||
zoneId = client.getActor().zoneId;
|
zoneId = client.GetActor().zoneId;
|
||||||
r = client.getActor().rotation;
|
r = client.GetActor().rotation;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z));
|
SendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z));
|
||||||
doWarp(client, zoneId, privatearea, 0x00, x, y, z, r);
|
DoWarp(client, zoneId, privatearea, 0x00, x, y, z, r);
|
||||||
}
|
}
|
||||||
else if (split.Length == 5)
|
else if (split.Length == 5)
|
||||||
{
|
{
|
||||||
@ -420,8 +420,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z));
|
SendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z));
|
||||||
doWarp(client, zoneId, privatearea, 0x2, x, y, z, r);
|
DoWarp(client, zoneId, privatearea, 0x2, x, y, z, r);
|
||||||
}
|
}
|
||||||
else if (split.Length == 6)
|
else if (split.Length == 6)
|
||||||
{
|
{
|
||||||
@ -448,8 +448,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
privatearea = split[2];
|
privatearea = split[2];
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
sendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z));
|
SendMessage(client, String.Format("Warping to: ZoneID: {0} X: {1}, Y: {2}, Z: {3}", zoneId, x, y, z));
|
||||||
doWarp(client, zoneId, privatearea, 0x2, x, y, z, r);
|
DoWarp(client, zoneId, privatearea, 0x2, x, y, z, r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return; // catch any invalid warps here
|
return; // catch any invalid warps here
|
||||||
@ -461,7 +461,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
client.queuePacket(BasePacket.createPacket(SetWeatherPacket.buildPacket(client.actorID, weather, Convert.ToUInt16(value)), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SetWeatherPacket.BuildPacket(client.actorID, weather, Convert.ToUInt16(value)), true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -470,15 +470,15 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
uint currentZoneID;
|
uint currentZoneID;
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
currentZoneID = client.getActor().zoneId;
|
currentZoneID = client.GetActor().zoneId;
|
||||||
|
|
||||||
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
// Change the weather for everyone in the same zone
|
// Change the weather for everyone in the same zone
|
||||||
if (currentZoneID == entry.Value.getActor().zoneId)
|
if (currentZoneID == entry.Value.GetActor().zoneId)
|
||||||
{
|
{
|
||||||
BasePacket weatherPacket = BasePacket.createPacket(SetWeatherPacket.buildPacket(entry.Value.actorID, weather), true, false);
|
BasePacket weatherPacket = BasePacket.CreatePacket(SetWeatherPacket.BuildPacket(entry.Value.actorID, weather), true, false);
|
||||||
entry.Value.queuePacket(weatherPacket);
|
entry.Value.QueuePacket(weatherPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -491,13 +491,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
private void sendMessage(ConnectedPlayer client, String message)
|
private void SendMessage(ConnectedPlayer client, String message)
|
||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
client.getActor().queuePacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", message));
|
client.GetActor().QueuePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", message));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool doCommand(string input, ConnectedPlayer client)
|
internal bool DoCommand(string input, ConnectedPlayer client)
|
||||||
{
|
{
|
||||||
input.Trim();
|
input.Trim();
|
||||||
if (input.StartsWith("!"))
|
if (input.StartsWith("!"))
|
||||||
@ -508,7 +508,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
split = split.Where(temp => temp != "").ToArray(); // strips extra whitespace from commands
|
split = split.Where(temp => temp != "").ToArray(); // strips extra whitespace from commands
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
//sendMessage(client, string.Join(",", split));
|
//SendMessage(client, string.Join(",", split));
|
||||||
|
|
||||||
if (split.Length >= 1)
|
if (split.Length >= 1)
|
||||||
{
|
{
|
||||||
@ -517,41 +517,41 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (split.Length == 1)
|
if (split.Length == 1)
|
||||||
{
|
{
|
||||||
sendMessage(client, Resources.CPhelp);
|
SendMessage(client, Resources.CPhelp);
|
||||||
}
|
}
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
{
|
{
|
||||||
if (split[1].Equals("mypos"))
|
if (split[1].Equals("mypos"))
|
||||||
sendMessage(client, Resources.CPmypos);
|
SendMessage(client, Resources.CPmypos);
|
||||||
else if (split[1].Equals("music"))
|
else if (split[1].Equals("music"))
|
||||||
sendMessage(client, Resources.CPmusic);
|
SendMessage(client, Resources.CPmusic);
|
||||||
else if (split[1].Equals("warp"))
|
else if (split[1].Equals("warp"))
|
||||||
sendMessage(client, Resources.CPwarp);
|
SendMessage(client, Resources.CPwarp);
|
||||||
else if (split[1].Equals("givecurrency"))
|
else if (split[1].Equals("givecurrency"))
|
||||||
sendMessage(client, Resources.CPgivecurrency);
|
SendMessage(client, Resources.CPgivecurrency);
|
||||||
else if (split[1].Equals("giveitem"))
|
else if (split[1].Equals("giveitem"))
|
||||||
sendMessage(client, Resources.CPgiveitem);
|
SendMessage(client, Resources.CPgiveitem);
|
||||||
else if (split[1].Equals("givekeyitem"))
|
else if (split[1].Equals("givekeyitem"))
|
||||||
sendMessage(client, Resources.CPgivekeyitem);
|
SendMessage(client, Resources.CPgivekeyitem);
|
||||||
else if (split[1].Equals("removecurrency"))
|
else if (split[1].Equals("Removecurrency"))
|
||||||
sendMessage(client, Resources.CPremovecurrency);
|
SendMessage(client, Resources.CPRemovecurrency);
|
||||||
else if (split[1].Equals("removeitem"))
|
else if (split[1].Equals("Removeitem"))
|
||||||
sendMessage(client, Resources.CPremoveitem);
|
SendMessage(client, Resources.CPRemoveitem);
|
||||||
else if (split[1].Equals("removekeyitem"))
|
else if (split[1].Equals("Removekeyitem"))
|
||||||
sendMessage(client, Resources.CPremovekeyitem);
|
SendMessage(client, Resources.CPRemovekeyitem);
|
||||||
else if (split[1].Equals("reloaditems"))
|
else if (split[1].Equals("reloaditems"))
|
||||||
sendMessage(client, Resources.CPreloaditems);
|
SendMessage(client, Resources.CPreloaditems);
|
||||||
else if (split[1].Equals("reloadzones"))
|
else if (split[1].Equals("reloadzones"))
|
||||||
sendMessage(client, Resources.CPreloadzones);
|
SendMessage(client, Resources.CPreloadzones);
|
||||||
/*
|
/*
|
||||||
else if (split[1].Equals("property"))
|
else if (split[1].Equals("property"))
|
||||||
sendMessage(client, Resources.CPproperty);
|
SendMessage(client, Resources.CPproperty);
|
||||||
else if (split[1].Equals("property2"))
|
else if (split[1].Equals("property2"))
|
||||||
sendMessage(client, Resources.CPproperty2);
|
SendMessage(client, Resources.CPproperty2);
|
||||||
else if (split[1].Equals("sendpacket"))
|
else if (split[1].Equals("sendpacket"))
|
||||||
sendMessage(client, Resources.CPsendpacket);
|
SendMessage(client, Resources.CPsendpacket);
|
||||||
else if (split[1].Equals("setgraphic"))
|
else if (split[1].Equals("setgraphic"))
|
||||||
sendMessage(client, Resources.CPsetgraphic);
|
SendMessage(client, Resources.CPsetgraphic);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
if (split.Length == 3)
|
if (split.Length == 3)
|
||||||
@ -559,7 +559,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if(split[1].Equals("test"))
|
if(split[1].Equals("test"))
|
||||||
{
|
{
|
||||||
if (split[2].Equals("weather"))
|
if (split[2].Equals("weather"))
|
||||||
sendMessage(client, Resources.CPtestweather);
|
SendMessage(client, Resources.CPtestweather);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -573,7 +573,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (split.Length == 1)
|
if (split.Length == 1)
|
||||||
{
|
{
|
||||||
// catch invalid commands
|
// catch invalid commands
|
||||||
sendMessage(client, Resources.CPhelp);
|
SendMessage(client, Resources.CPhelp);
|
||||||
}
|
}
|
||||||
else if (split.Length >= 2)
|
else if (split.Length >= 2)
|
||||||
{
|
{
|
||||||
@ -587,7 +587,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not change weather: " + e);
|
Program.Log.Error("Could not change weather: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -601,12 +601,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
printPos(client);
|
PrintPos(client);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not load packet: " + e);
|
Program.Log.Error("Could not load packet: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -616,13 +616,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Log.info(String.Format("Got request to reset zone: {0}", client.getActor().zoneId));
|
Program.Log.Info(String.Format("Got request to reset zone: {0}", client.GetActor().zoneId));
|
||||||
client.getActor().zone.clear();
|
client.GetActor().zone.Clear();
|
||||||
client.getActor().zone.addActorToZone(client.getActor());
|
client.GetActor().zone.AddActorToZone(client.GetActor());
|
||||||
client.getActor().sendInstanceUpdate();
|
client.GetActor().SendInstanceUpdate();
|
||||||
client.queuePacket(BasePacket.createPacket(SendMessagePacket.buildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Reseting zone {0}...", client.getActor().zoneId)), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SendMessagePacket.BuildPacket(client.actorID, client.actorID, SendMessagePacket.MESSAGE_TYPE_GENERAL_INFO, "", String.Format("Reseting zone {0}...", client.GetActor().zoneId)), true, false));
|
||||||
}
|
}
|
||||||
Server.GetWorldManager().reloadZone(client.getActor().zoneId);
|
Server.GetWorldManager().reloadZone(client.GetActor().zoneId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -630,12 +630,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
#region !reloaditems
|
#region !reloaditems
|
||||||
else if (split[0].Equals("reloaditems"))
|
else if (split[0].Equals("reloaditems"))
|
||||||
{
|
{
|
||||||
Log.info(String.Format("Got request to reload item gamedata"));
|
Program.Log.Info(String.Format("Got request to reload item gamedata"));
|
||||||
sendMessage(client, "Reloading Item Gamedata...");
|
SendMessage(client, "Reloading Item Gamedata...");
|
||||||
gamedataItems.Clear();
|
gamedataItems.Clear();
|
||||||
gamedataItems = Database.getItemGamedata();
|
gamedataItems = Database.GetItemGamedata();
|
||||||
Log.info(String.Format("Loaded {0} items.", gamedataItems.Count));
|
Program.Log.Info(String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||||
sendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count));
|
SendMessage(client, String.Format("Loaded {0} items.", gamedataItems.Count));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -648,12 +648,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sendPacket(client, "./packets/" + split[1]);
|
SendPacket(client, "./packets/" + split[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not load packet: " + e);
|
Program.Log.Error("Could not load packet: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -664,12 +664,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 6)
|
if (split.Length == 6)
|
||||||
setGraphic(client, UInt32.Parse(split[1]), UInt32.Parse(split[2]), UInt32.Parse(split[3]), UInt32.Parse(split[4]), UInt32.Parse(split[5]));
|
SetGraphic(client, UInt32.Parse(split[1]), UInt32.Parse(split[2]), UInt32.Parse(split[3]), UInt32.Parse(split[4]), UInt32.Parse(split[5]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not give item.");
|
Program.Log.Error("Could not give item.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -680,22 +680,22 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
giveItem(client, UInt32.Parse(split[1]), 1);
|
GiveItem(client, UInt32.Parse(split[1]), 1);
|
||||||
else if (split.Length == 3)
|
else if (split.Length == 3)
|
||||||
giveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
GiveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
||||||
else if (split.Length == 4)
|
else if (split.Length == 4)
|
||||||
giveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]), UInt16.Parse(split[3]));
|
GiveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]), UInt16.Parse(split[3]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not give item.");
|
Program.Log.Error("Could not give item.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region !removeitem
|
#region !Removeitem
|
||||||
else if (split[0].Equals("removeitem"))
|
else if (split[0].Equals("Removeitem"))
|
||||||
{
|
{
|
||||||
if (split.Length < 2)
|
if (split.Length < 2)
|
||||||
return false;
|
return false;
|
||||||
@ -703,16 +703,16 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
removeItem(client, UInt32.Parse(split[1]), 1);
|
RemoveItem(client, UInt32.Parse(split[1]), 1);
|
||||||
else if (split.Length == 3)
|
else if (split.Length == 3)
|
||||||
removeItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
RemoveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
||||||
else if (split.Length == 4)
|
else if (split.Length == 4)
|
||||||
removeItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]), UInt16.Parse(split[3]));
|
RemoveItem(client, UInt32.Parse(split[1]), Int32.Parse(split[2]), UInt16.Parse(split[3]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not remove item.");
|
Program.Log.Error("Could not Remove item.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -723,17 +723,17 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
giveKeyItem(client, UInt32.Parse(split[1]));
|
GiveKeyItem(client, UInt32.Parse(split[1]));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not give keyitem.");
|
Program.Log.Error("Could not give keyitem.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region !removekeyitem
|
#region !Removekeyitem
|
||||||
else if (split[0].Equals("removekeyitem"))
|
else if (split[0].Equals("Removekeyitem"))
|
||||||
{
|
{
|
||||||
if (split.Length < 2)
|
if (split.Length < 2)
|
||||||
return false;
|
return false;
|
||||||
@ -741,12 +741,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
removeKeyItem(client, UInt32.Parse(split[1]));
|
RemoveKeyItem(client, UInt32.Parse(split[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not remove keyitem.");
|
Program.Log.Error("Could not Remove keyitem.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -757,19 +757,19 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
giveCurrency(client, ITEM_GIL, Int32.Parse(split[1]));
|
GiveCurrency(client, ITEM_GIL, Int32.Parse(split[1]));
|
||||||
else if (split.Length == 3)
|
else if (split.Length == 3)
|
||||||
giveCurrency(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
GiveCurrency(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not give currency.");
|
Program.Log.Error("Could not give currency.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region !removecurrency
|
#region !Removecurrency
|
||||||
else if (split[0].Equals("removecurrency"))
|
else if (split[0].Equals("Removecurrency"))
|
||||||
{
|
{
|
||||||
if (split.Length < 2)
|
if (split.Length < 2)
|
||||||
return false;
|
return false;
|
||||||
@ -777,14 +777,14 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (split.Length == 2)
|
if (split.Length == 2)
|
||||||
removeCurrency(client, ITEM_GIL, Int32.Parse(split[1]));
|
RemoveCurrency(client, ITEM_GIL, Int32.Parse(split[1]));
|
||||||
else if (split.Length == 3)
|
else if (split.Length == 3)
|
||||||
removeCurrency(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
RemoveCurrency(client, UInt32.Parse(split[1]), Int32.Parse(split[2]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not remove currency.");
|
Program.Log.Error("Could not Remove currency.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -797,12 +797,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doMusic(client, split[1]);
|
DoMusic(client, split[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Log.error("Could not change music: " + e);
|
Program.Log.Error("Could not change music: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -810,7 +810,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
#region !warp
|
#region !warp
|
||||||
else if (split[0].Equals("warp"))
|
else if (split[0].Equals("warp"))
|
||||||
{
|
{
|
||||||
parseWarp(client, split);
|
ParseWarp(client, split);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -820,7 +820,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (split.Length == 4)
|
if (split.Length == 4)
|
||||||
{
|
{
|
||||||
changeProperty(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);
|
ChangeProperty(Utils.MurmurHash2(split[1], 0), Convert.ToUInt32(split[2], 16), split[3]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -831,7 +831,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (split.Length == 4)
|
if (split.Length == 4)
|
||||||
{
|
{
|
||||||
changeProperty(Convert.ToUInt32(split[1], 16), Convert.ToUInt32(split[2], 16), split[3]);
|
ChangeProperty(Convert.ToUInt32(split[1], 16), Convert.ToUInt32(split[2], 16), split[3]);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using STA.Settings;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class ConfigConstants
|
class ConfigConstants
|
||||||
{
|
{
|
||||||
public static String OPTIONS_BINDIP;
|
public static String OPTIONS_BINDIP;
|
||||||
|
public static String OPTIONS_PORT;
|
||||||
public static bool OPTIONS_TIMESTAMP = false;
|
public static bool OPTIONS_TIMESTAMP = false;
|
||||||
|
|
||||||
public static uint DATABASE_WORLDID;
|
public static uint DATABASE_WORLDID;
|
||||||
@ -21,24 +17,25 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
public static String DATABASE_USERNAME;
|
public static String DATABASE_USERNAME;
|
||||||
public static String DATABASE_PASSWORD;
|
public static String DATABASE_PASSWORD;
|
||||||
|
|
||||||
public static bool load()
|
public static bool Load()
|
||||||
{
|
{
|
||||||
Console.Write("Loading config.ini file... ");
|
Console.Write("Loading map_config.ini file... ");
|
||||||
|
|
||||||
if (!File.Exists("./config.ini"))
|
if (!File.Exists("./map_config.ini"))
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Console.ForegroundColor = ConsoleColor.Red;
|
||||||
Console.WriteLine("[FILE NOT FOUND]");
|
Console.WriteLine(String.Format("[FILE NOT FOUND]"));
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
INIFile configIni = new INIFile("./config.ini");
|
INIFile configIni = new INIFile("./map_config.ini");
|
||||||
|
|
||||||
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
|
ConfigConstants.OPTIONS_BINDIP = configIni.GetValue("General", "server_ip", "127.0.0.1");
|
||||||
|
ConfigConstants.OPTIONS_PORT = configIni.GetValue("General", "server_port", "54992");
|
||||||
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
|
ConfigConstants.OPTIONS_TIMESTAMP = configIni.GetValue("General", "showtimestamp", "true").ToLower().Equals("true");
|
||||||
|
|
||||||
ConfigConstants.DATABASE_WORLDID = configIni.GetValue("Database", "worldid", (uint)0);
|
ConfigConstants.DATABASE_WORLDID = UInt32.Parse(configIni.GetValue("Database", "worldid", "0"));
|
||||||
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
|
ConfigConstants.DATABASE_HOST = configIni.GetValue("Database", "host", "");
|
||||||
ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", "");
|
ConfigConstants.DATABASE_PORT = configIni.GetValue("Database", "port", "");
|
||||||
ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", "");
|
ConfigConstants.DATABASE_NAME = configIni.GetValue("Database", "database", "");
|
||||||
|
@ -1,30 +1,23 @@
|
|||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using FFXIVClassic.Common;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Map_Server.utils;
|
using FFXIVClassic_Map_Server.utils;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.packets.send.player;
|
using FFXIVClassic_Map_Server.packets.send.player;
|
||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
|
||||||
using FFXIVClassic_Map_Server;
|
|
||||||
using FFXIVClassic_Map_Server.common.EfficientHashTables;
|
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.actors.chara.player;
|
using FFXIVClassic_Map_Server.actors.chara.player;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
|
|
||||||
class Database
|
class Database
|
||||||
{
|
{
|
||||||
|
|
||||||
public static uint getUserIdFromSession(String sessionId)
|
public static uint GetUserIdFromSession(String sessionId)
|
||||||
{
|
{
|
||||||
uint id = 0;
|
uint id = 0;
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -43,7 +36,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -52,7 +47,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DBWorld getServer(uint serverId)
|
public static DBWorld GetServer(uint serverId)
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -64,6 +59,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -74,7 +70,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Npc> getNpcList()
|
public static List<Npc> GetNpcList()
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -86,6 +82,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -96,7 +93,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<uint, Item> getItemGamedata()
|
public static Dictionary<uint, Item> GetItemGamedata()
|
||||||
{
|
{
|
||||||
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (var conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -140,7 +137,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -150,7 +149,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerAppearance(Player player)
|
public static void SavePlayerAppearance(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -196,7 +195,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -204,7 +205,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerCurrentClass(Player player)
|
public static void SavePlayerCurrentClass(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -230,7 +231,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -238,7 +241,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerPosition(Player player)
|
public static void SavePlayerPosition(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -270,7 +273,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -278,7 +283,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerPlayTime(Player player)
|
public static void SavePlayerPlayTime(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -297,12 +302,14 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
cmd = new MySqlCommand(query, conn);
|
cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
cmd.Parameters.AddWithValue("@charaId", player.actorId);
|
||||||
cmd.Parameters.AddWithValue("@playtime", player.getPlayTime(true));
|
cmd.Parameters.AddWithValue("@playtime", player.GetPlayTime(true));
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -310,19 +317,19 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveQuest(Player player, Quest quest)
|
public static void SaveQuest(Player player, Quest quest)
|
||||||
{
|
{
|
||||||
int slot = player.getQuestSlot(quest.actorId);
|
int slot = player.GetQuestSlot(quest.actorId);
|
||||||
if (slot == -1)
|
if (slot == -1)
|
||||||
{
|
{
|
||||||
Log.error(String.Format("Tried saving quest player didn't have: Player: {0:x}, QuestId: {0:x}", player.actorId, quest.actorId));
|
Program.Log.Error("Tried saving quest player didn't have: Player: {0:x}, QuestId: {0:x}", player.actorId, quest.actorId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
saveQuest(player, quest, slot);
|
SaveQuest(player, quest, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveQuest(Player player, Quest quest, int slot)
|
public static void SaveQuest(Player player, Quest quest, int slot)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -352,7 +359,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -360,7 +369,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadPlayerCharacter(Player player)
|
public static void LoadPlayerCharacter(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -550,12 +559,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (reader.Read())
|
if (reader.Read())
|
||||||
{
|
{
|
||||||
if (reader.GetUInt32(0) == 0xFFFFFFFF)
|
if (reader.GetUInt32(0) == 0xFFFFFFFF)
|
||||||
player.modelId = CharacterUtils.getTribeModel(player.playerWork.tribe);
|
player.modelId = CharacterUtils.GetTribeModel(player.playerWork.tribe);
|
||||||
else
|
else
|
||||||
player.modelId = reader.GetUInt32(0);
|
player.modelId = reader.GetUInt32(0);
|
||||||
player.appearanceIds[Character.SIZE] = reader.GetByte(1);
|
player.appearanceIds[Character.SIZE] = reader.GetByte(1);
|
||||||
player.appearanceIds[Character.COLORINFO] = (uint)(reader.GetUInt16(3) | (reader.GetUInt16(5) << 10) | (reader.GetUInt16(7) << 20));
|
player.appearanceIds[Character.COLORINFO] = (uint)(reader.GetUInt16(3) | (reader.GetUInt16(5) << 10) | (reader.GetUInt16(7) << 20));
|
||||||
player.appearanceIds[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.getFaceInfo(reader.GetByte(8), reader.GetByte(9), reader.GetByte(10), reader.GetByte(11), reader.GetByte(12), reader.GetByte(13), reader.GetByte(14), reader.GetByte(15), reader.GetByte(16), reader.GetByte(17)));
|
player.appearanceIds[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.GetFaceInfo(reader.GetByte(8), reader.GetByte(9), reader.GetByte(10), reader.GetByte(11), reader.GetByte(12), reader.GetByte(13), reader.GetByte(14), reader.GetByte(15), reader.GetByte(16), reader.GetByte(17)));
|
||||||
player.appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt16(6) | reader.GetUInt16(4) << 10);
|
player.appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt16(6) | reader.GetUInt16(4) << 10);
|
||||||
player.appearanceIds[Character.VOICE] = reader.GetByte(2);
|
player.appearanceIds[Character.VOICE] = reader.GetByte(2);
|
||||||
player.appearanceIds[Character.MAINHAND] = reader.GetUInt32(18);
|
player.appearanceIds[Character.MAINHAND] = reader.GetUInt32(18);
|
||||||
@ -702,7 +711,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
else
|
else
|
||||||
questFlags = 0;
|
questFlags = 0;
|
||||||
|
|
||||||
string questName = Server.getStaticActors(player.playerWork.questScenario[index]).actorName;
|
string questName = Server.GetStaticActors(player.playerWork.questScenario[index]).actorName;
|
||||||
player.questScenario[index] = new Quest(player, player.playerWork.questScenario[index], questName, questData, questFlags);
|
player.questScenario[index] = new Quest(player, player.playerWork.questScenario[index], questName, questData, questFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -769,17 +778,19 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory(Inventory.NORMAL).initList(getInventory(player, 0, Inventory.NORMAL));
|
player.GetInventory(Inventory.NORMAL).InitList(GetInventory(player, 0, Inventory.NORMAL));
|
||||||
player.getInventory(Inventory.KEYITEMS).initList(getInventory(player, 0, Inventory.KEYITEMS));
|
player.GetInventory(Inventory.KEYITEMS).InitList(GetInventory(player, 0, Inventory.KEYITEMS));
|
||||||
player.getInventory(Inventory.CURRENCY).initList(getInventory(player, 0, Inventory.CURRENCY));
|
player.GetInventory(Inventory.CURRENCY).InitList(GetInventory(player, 0, Inventory.CURRENCY));
|
||||||
player.getInventory(Inventory.BAZAAR).initList(getInventory(player, 0, Inventory.BAZAAR));
|
player.GetInventory(Inventory.BAZAAR).InitList(GetInventory(player, 0, Inventory.BAZAAR));
|
||||||
player.getInventory(Inventory.MELDREQUEST).initList(getInventory(player, 0, Inventory.MELDREQUEST));
|
player.GetInventory(Inventory.MELDREQUEST).InitList(GetInventory(player, 0, Inventory.MELDREQUEST));
|
||||||
player.getInventory(Inventory.LOOT).initList(getInventory(player, 0, Inventory.LOOT));
|
player.GetInventory(Inventory.LOOT).InitList(GetInventory(player, 0, Inventory.LOOT));
|
||||||
|
|
||||||
player.getEquipment().SetEquipment(getEquipment(player, player.charaWork.parameterSave.state_mainSkill[0]));
|
player.GetEquipment().SetEquipment(GetEquipment(player, player.charaWork.parameterSave.state_mainSkill[0]));
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -788,9 +799,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InventoryItem[] getEquipment(Player player, ushort classId)
|
public static InventoryItem[] GetEquipment(Player player, ushort classId)
|
||||||
{
|
{
|
||||||
InventoryItem[] equipment = new InventoryItem[player.getEquipment().GetCapacity()];
|
InventoryItem[] equipment = new InventoryItem[player.GetEquipment().GetCapacity()];
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -815,13 +826,15 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
ushort equipSlot = reader.GetUInt16(0);
|
ushort equipSlot = reader.GetUInt16(0);
|
||||||
ulong uniqueItemId = reader.GetUInt16(1);
|
ulong uniqueItemId = reader.GetUInt16(1);
|
||||||
InventoryItem item = player.getInventory(Inventory.NORMAL).getItemById(uniqueItemId);
|
InventoryItem item = player.GetInventory(Inventory.NORMAL).GetItemById(uniqueItemId);
|
||||||
equipment[equipSlot] = item;
|
equipment[equipSlot] = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -831,7 +844,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return equipment;
|
return equipment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void equipItem(Player player, ushort equipSlot, ulong uniqueItemId)
|
public static void EquipItem(Player player, ushort equipSlot, ulong uniqueItemId)
|
||||||
{
|
{
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -857,7 +870,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -866,7 +881,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unequipItem(Player player, ushort equipSlot)
|
public static void UnequipItem(Player player, ushort equipSlot)
|
||||||
{
|
{
|
||||||
|
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -888,7 +903,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -897,7 +914,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<InventoryItem> getInventory(Player player, uint slotOffset, uint type)
|
public static List<InventoryItem> GetInventory(Player player, uint slotOffset, uint type)
|
||||||
{
|
{
|
||||||
List<InventoryItem> items = new List<InventoryItem>();
|
List<InventoryItem> items = new List<InventoryItem>();
|
||||||
|
|
||||||
@ -957,7 +974,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -967,7 +986,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InventoryItem addItem(Player player, uint itemId, int quantity, byte quality, byte itemType, int durability, ushort type)
|
public static InventoryItem AddItem(Player player, uint itemId, int quantity, byte quality, byte itemType, int durability, ushort type)
|
||||||
{
|
{
|
||||||
InventoryItem insertedItem = null;
|
InventoryItem insertedItem = null;
|
||||||
|
|
||||||
@ -1008,10 +1027,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
cmd2.ExecuteNonQuery();
|
cmd2.ExecuteNonQuery();
|
||||||
|
|
||||||
insertedItem = new InventoryItem((uint)cmd.LastInsertedId, itemId, quantity, (ushort)player.getInventory(type).getNextEmptySlot(), itemType, quality, durability, 0, 0, 0, 0, 0, 0);
|
insertedItem = new InventoryItem((uint)cmd.LastInsertedId, itemId, quantity, (ushort)player.GetInventory(type).GetNextEmptySlot(), itemType, quality, durability, 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -1021,7 +1042,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return insertedItem;
|
return insertedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setQuantity(Player player, uint slot, ushort type, int quantity)
|
public static void SetQuantity(Player player, uint slot, ushort type, int quantity)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -1044,7 +1065,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -1053,7 +1076,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeItem(Player player, ulong serverItemId, ushort type)
|
public static void RemoveItem(Player player, ulong serverItemId, ushort type)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -1082,7 +1105,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -1091,7 +1116,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeItem(Player player, ushort slot, ushort type)
|
public static void RemoveItem(Player player, ushort slot, ushort type)
|
||||||
{
|
{
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}; Allow User Variables=True", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
@ -1121,7 +1146,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
@ -1130,7 +1157,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SubPacket getLatestAchievements(Player player)
|
public static SubPacket GetLatestAchievements(Player player)
|
||||||
{
|
{
|
||||||
uint[] latestAchievements = new uint[5];
|
uint[] latestAchievements = new uint[5];
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
@ -1159,17 +1186,19 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SetLatestAchievementsPacket.buildPacket(player.actorId, latestAchievements);
|
return SetLatestAchievementsPacket.BuildPacket(player.actorId, latestAchievements);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SubPacket getAchievementsPacket(Player player)
|
public static SubPacket GetAchievementsPacket(Player player)
|
||||||
{
|
{
|
||||||
SetCompletedAchievementsPacket cheevosPacket = new SetCompletedAchievementsPacket();
|
SetCompletedAchievementsPacket cheevosPacket = new SetCompletedAchievementsPacket();
|
||||||
|
|
||||||
@ -1195,7 +1224,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
if (offset < 0 || offset >= cheevosPacket.achievementFlags.Length)
|
if (offset < 0 || offset >= cheevosPacket.achievementFlags.Length)
|
||||||
{
|
{
|
||||||
Log.error("SQL Error; achievement flag offset id out of range: " + offset);
|
Program.Log.Error("SQL Error; achievement flag offset id out of range: " + offset);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
cheevosPacket.achievementFlags[offset] = true;
|
cheevosPacket.achievementFlags[offset] = true;
|
||||||
@ -1203,14 +1232,16 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{ Console.WriteLine(e); }
|
{
|
||||||
|
Program.Log.Error(e.ToString());
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cheevosPacket.buildPacket(player.actorId);
|
return cheevosPacket.BuildPacket(player.actorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
|
<HintPath>..\packages\Dapper.1.42\lib\net45\Dapper.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="FFXIVClassic.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\FFXIVClassic Common Class Lib\bin\Debug\FFXIVClassic.Common.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="MoonSharp.Interpreter">
|
<Reference Include="MoonSharp.Interpreter">
|
||||||
<HintPath>..\packages\MoonSharp.1.2.1.0\lib\net40-client\MoonSharp.Interpreter.dll</HintPath>
|
<HintPath>..\packages\MoonSharp.1.2.1.0\lib\net40-client\MoonSharp.Interpreter.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@ -53,6 +57,10 @@
|
|||||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\NLog.4.3.5\lib\net45\NLog.dll</HintPath>
|
||||||
|
<Private>True</Private>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
@ -85,12 +93,6 @@
|
|||||||
<Compile Include="actors\world\WorldMaster.cs" />
|
<Compile Include="actors\world\WorldMaster.cs" />
|
||||||
<Compile Include="ClientConnection.cs" />
|
<Compile Include="ClientConnection.cs" />
|
||||||
<Compile Include="CommandProcessor.cs" />
|
<Compile Include="CommandProcessor.cs" />
|
||||||
<Compile Include="common\Bitfield.cs" />
|
|
||||||
<Compile Include="common\Blowfish.cs" />
|
|
||||||
<Compile Include="common\EfficientHashTables.cs" />
|
|
||||||
<Compile Include="common\Log.cs" />
|
|
||||||
<Compile Include="common\STA_INIFile.cs" />
|
|
||||||
<Compile Include="common\Utils.cs" />
|
|
||||||
<Compile Include="ConfigConstants.cs" />
|
<Compile Include="ConfigConstants.cs" />
|
||||||
<Compile Include="Database.cs" />
|
<Compile Include="Database.cs" />
|
||||||
<Compile Include="actors\Actor.cs" />
|
<Compile Include="actors\Actor.cs" />
|
||||||
@ -272,6 +274,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
<Content Include="NLog.config">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<None Include="NLog.xsd">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@ -282,8 +290,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>robocopy "$(SolutionDir)data" "$(SolutionDir)$(ProjectName)\$(OutDir)." /XO 2>nul 1>nul
|
<PostBuildEvent>copy "$(SolutionDir)data\map_config.ini" "$(SolutionDir)$(ProjectName)\$(OutDir)"</PostBuildEvent>
|
||||||
EXIT 0</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
45
FFXIVClassic Map Server/NLog.config
Normal file
45
FFXIVClassic Map Server/NLog.config
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||||
|
autoReload="true"
|
||||||
|
throwExceptions="false"
|
||||||
|
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||||
|
|
||||||
|
|
||||||
|
<!-- optional, add some variabeles
|
||||||
|
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||||
|
-->
|
||||||
|
<variable name="myvar" value="myvalue"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||||
|
for information on customizing logging rules and outputs.
|
||||||
|
-->
|
||||||
|
<targets async="true">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
add your targets here
|
||||||
|
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||||
|
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Write events to a file with the date in the filename.
|
||||||
|
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||||
|
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||||
|
-->
|
||||||
|
<target xsi:type="ColoredConsole" name="console" layout="[${longdate}] [${uppercase:${level}}] ${message}" />
|
||||||
|
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}/map.log" layout="[${longdate}] [${uppercase:${level}}] ${message}"/>
|
||||||
|
</targets>
|
||||||
|
|
||||||
|
<rules>
|
||||||
|
<!-- add your logging rules here -->
|
||||||
|
<logger name='*' minlevel='Trace' writeTo='file' />
|
||||||
|
<logger name='*' minlevel='Trace' writeTo='console' />
|
||||||
|
<!--
|
||||||
|
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||||
|
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||||
|
-->
|
||||||
|
</rules>
|
||||||
|
</nlog>
|
2601
FFXIVClassic Map Server/NLog.xsd
Normal file
2601
FFXIVClassic Map Server/NLog.xsd
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,40 +1,25 @@
|
|||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using MySql.Data.MySqlClient;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Map_Server.packets;
|
|
||||||
using FFXIVClassic_Map_Server.packets.receive;
|
using FFXIVClassic_Map_Server.packets.receive;
|
||||||
using FFXIVClassic_Map_Server.packets.send;
|
using FFXIVClassic_Map_Server.packets.send;
|
||||||
using FFXIVClassic_Map_Server.packets.send.login;
|
using FFXIVClassic_Map_Server.packets.send.login;
|
||||||
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
|
||||||
using FFXIVClassic_Map_Server.packets.send.Actor;
|
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server;
|
|
||||||
using FFXIVClassic_Map_Server.packets.send.player;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
|
||||||
using FFXIVClassic_Map_Server.packets.send.supportdesk;
|
using FFXIVClassic_Map_Server.packets.send.supportdesk;
|
||||||
using FFXIVClassic_Map_Server.packets.receive.social;
|
using FFXIVClassic_Map_Server.packets.receive.social;
|
||||||
using FFXIVClassic_Map_Server.packets.send.social;
|
using FFXIVClassic_Map_Server.packets.send.social;
|
||||||
using FFXIVClassic_Map_Server.packets.receive.supportdesk;
|
using FFXIVClassic_Map_Server.packets.receive.supportdesk;
|
||||||
using FFXIVClassic_Map_Server.packets.receive.recruitment;
|
using FFXIVClassic_Map_Server.packets.receive.recruitment;
|
||||||
using FFXIVClassic_Map_Server.packets.send.recruitment;
|
using FFXIVClassic_Map_Server.packets.send.recruitment;
|
||||||
using FFXIVClassic_Map_Server.packets.send.list;
|
|
||||||
using FFXIVClassic_Map_Server.packets.receive.events;
|
using FFXIVClassic_Map_Server.packets.receive.events;
|
||||||
using FFXIVClassic_Map_Server.packets.send.events;
|
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using System.Net;
|
|
||||||
using FFXIVClassic_Map_Server.common.EfficientHashTables;
|
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class PacketProcessor
|
class PacketProcessor
|
||||||
{
|
{
|
||||||
@ -51,17 +36,17 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
cp = new CommandProcessor(playerList);
|
cp = new CommandProcessor(playerList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processPacket(ClientConnection client, BasePacket packet)
|
public void ProcessPacket(ClientConnection client, BasePacket packet)
|
||||||
{
|
{
|
||||||
if (packet.header.isCompressed == 0x01)
|
if (packet.header.isCompressed == 0x01)
|
||||||
BasePacket.decryptPacket(client.blowfish, ref packet);
|
BasePacket.DecryptPacket(client.blowfish, ref packet);
|
||||||
|
|
||||||
List<SubPacket> subPackets = packet.getSubpackets();
|
List<SubPacket> subPackets = packet.GetSubpackets();
|
||||||
foreach (SubPacket subpacket in subPackets)
|
foreach (SubPacket subpacket in subPackets)
|
||||||
{
|
{
|
||||||
if (subpacket.header.type == 0x01)
|
if (subpacket.header.type == 0x01)
|
||||||
{
|
{
|
||||||
packet.debugPrintPacket();
|
packet.DebugPrintPacket();
|
||||||
byte[] reply1Data = {
|
byte[] reply1Data = {
|
||||||
0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x01, 0x00, 0x00, 0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x18, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFD, 0xFF, 0xFF,
|
0x18, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFD, 0xFF, 0xFF,
|
||||||
@ -132,35 +117,35 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
player = mPlayers[client.owner];
|
player = mPlayers[client.owner];
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create connected player if not created
|
//Create connected player if not Created
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
player = new ConnectedPlayer(actorID);
|
player = new ConnectedPlayer(actorID);
|
||||||
mPlayers[actorID] = player;
|
mPlayers[actorID] = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.setConnection(packet.header.connectionType, client);
|
player.SetConnection(packet.header.connectionType, client);
|
||||||
|
|
||||||
if (packet.header.connectionType == BasePacket.TYPE_ZONE)
|
if (packet.header.connectionType == BasePacket.TYPE_ZONE)
|
||||||
Log.debug(String.Format("Got {0} connection for ActorID {1} @ {2}.", "zone", actorID, client.getAddress()));
|
Program.Log.Debug("Got {0} connection for ActorID {1} @ {2}.", "zone", actorID, client.GetAddress());
|
||||||
else if (packet.header.connectionType == BasePacket.TYPE_CHAT)
|
else if (packet.header.connectionType == BasePacket.TYPE_CHAT)
|
||||||
Log.debug(String.Format("Got {0} connection for ActorID {1} @ {2}.", "chat", actorID, client.getAddress()));
|
Program.Log.Debug("Got {0} connection for ActorID {1} @ {2}.", "chat", actorID, client.GetAddress());
|
||||||
|
|
||||||
//Create player actor
|
//Create player actor
|
||||||
reply1.debugPrintPacket();
|
reply1.DebugPrintPacket();
|
||||||
client.queuePacket(reply1);
|
client.QueuePacket(reply1);
|
||||||
client.queuePacket(reply2);
|
client.QueuePacket(reply2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (subpacket.header.type == 0x07)
|
else if (subpacket.header.type == 0x07)
|
||||||
{
|
{
|
||||||
BasePacket init = Login0x7ResponsePacket.buildPacket(BitConverter.ToUInt32(packet.data, 0x10), Utils.UnixTimeStampUTC());
|
BasePacket init = Login0x7ResponsePacket.BuildPacket(BitConverter.ToUInt32(packet.data, 0x10), Utils.UnixTimeStampUTC());
|
||||||
//client.queuePacket(init);
|
//client.QueuePacket(init);
|
||||||
}
|
}
|
||||||
else if (subpacket.header.type == 0x08)
|
else if (subpacket.header.type == 0x08)
|
||||||
{
|
{
|
||||||
//Response, client's current [actorID][time]
|
//Response, client's current [actorID][time]
|
||||||
packet.debugPrintPacket();
|
packet.DebugPrintPacket();
|
||||||
}
|
}
|
||||||
else if (subpacket.header.type == 0x03)
|
else if (subpacket.header.type == 0x03)
|
||||||
{
|
{
|
||||||
@ -177,34 +162,34 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
//Ping
|
//Ping
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
//subpacket.debugPrintSubPacket();
|
//subpacket.DebugPrintSubPacket();
|
||||||
PingPacket pingPacket = new PingPacket(subpacket.data);
|
PingPacket pingPacket = new PingPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(PongPacket.buildPacket(player.actorID, pingPacket.time), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(PongPacket.BuildPacket(player.actorID, pingPacket.time), true, false));
|
||||||
player.ping();
|
player.Ping();
|
||||||
break;
|
break;
|
||||||
//Unknown
|
//Unknown
|
||||||
case 0x0002:
|
case 0x0002:
|
||||||
|
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
client.queuePacket(_0x2Packet.buildPacket(player.actorID), true, false);
|
client.QueuePacket(_0x2Packet.BuildPacket(player.actorID), true, false);
|
||||||
|
|
||||||
Server.GetWorldManager().DoLogin(player.getActor());
|
Server.GetWorldManager().DoLogin(player.GetActor());
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Chat Received
|
//Chat Received
|
||||||
case 0x0003:
|
case 0x0003:
|
||||||
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
|
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
|
||||||
Log.info(String.Format("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType));
|
Program.Log.Info("Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}", chatMessage.message, chatMessage.posX, chatMessage.posY, chatMessage.posZ, chatMessage.posRot, chatMessage.logType);
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
|
|
||||||
if (chatMessage.message.StartsWith("!"))
|
if (chatMessage.message.StartsWith("!"))
|
||||||
{
|
{
|
||||||
if (cp.doCommand(chatMessage.message, player))
|
if (cp.DoCommand(chatMessage.message, player))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getActor().broadcastPacket(SendMessagePacket.buildPacket(player.actorID, player.actorID, chatMessage.logType, player.getActor().customDisplayName, chatMessage.message), false);
|
player.GetActor().BroadcastPacket(SendMessagePacket.BuildPacket(player.actorID, player.actorID, chatMessage.logType, player.GetActor().customDisplayName, chatMessage.message), false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Langauge Code
|
//Langauge Code
|
||||||
@ -214,37 +199,37 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
break;
|
break;
|
||||||
//Unknown - Happens a lot at login, then once every time player zones
|
//Unknown - Happens a lot at login, then once every time player zones
|
||||||
case 0x0007:
|
case 0x0007:
|
||||||
//subpacket.debugPrintSubPacket();
|
//subpacket.DebugPrintSubPacket();
|
||||||
_0x07Packet unknown07 = new _0x07Packet(subpacket.data);
|
_0x07Packet unknown07 = new _0x07Packet(subpacket.data);
|
||||||
break;
|
break;
|
||||||
//Update Position
|
//Update Position
|
||||||
case 0x00CA:
|
case 0x00CA:
|
||||||
//Update Position
|
//Update Position
|
||||||
//subpacket.debugPrintSubPacket();
|
//subpacket.DebugPrintSubPacket();
|
||||||
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data);
|
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket(subpacket.data);
|
||||||
player.updatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState);
|
player.UpdatePlayerActorPosition(posUpdate.x, posUpdate.y, posUpdate.z, posUpdate.rot, posUpdate.moveState);
|
||||||
player.getActor().sendInstanceUpdate();
|
player.GetActor().SendInstanceUpdate();
|
||||||
|
|
||||||
if (player.getActor().isInZoneChange())
|
if (player.GetActor().IsInZoneChange())
|
||||||
player.getActor().setZoneChanging(false);
|
player.GetActor().SetZoneChanging(false);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Set Target
|
//Set Target
|
||||||
case 0x00CD:
|
case 0x00CD:
|
||||||
//subpacket.debugPrintSubPacket();
|
//subpacket.DebugPrintSubPacket();
|
||||||
|
|
||||||
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
|
SetTargetPacket setTarget = new SetTargetPacket(subpacket.data);
|
||||||
player.getActor().currentTarget = setTarget.actorID;
|
player.GetActor().currentTarget = setTarget.actorID;
|
||||||
player.getActor().broadcastPacket(SetActorTargetAnimatedPacket.buildPacket(player.actorID, player.actorID, setTarget.actorID), true);
|
player.GetActor().BroadcastPacket(SetActorTargetAnimatedPacket.BuildPacket(player.actorID, player.actorID, setTarget.actorID), true);
|
||||||
break;
|
break;
|
||||||
//Lock Target
|
//Lock Target
|
||||||
case 0x00CC:
|
case 0x00CC:
|
||||||
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
|
LockTargetPacket lockTarget = new LockTargetPacket(subpacket.data);
|
||||||
player.getActor().currentLockedTarget = lockTarget.actorID;
|
player.GetActor().currentLockedTarget = lockTarget.actorID;
|
||||||
break;
|
break;
|
||||||
//Start Event
|
//Start Event
|
||||||
case 0x012D:
|
case 0x012D:
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
EventStartPacket eventStart = new EventStartPacket(subpacket.data);
|
EventStartPacket eventStart = new EventStartPacket(subpacket.data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -253,90 +238,90 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
player.errorMessage += eventStart.error;
|
player.errorMessage += eventStart.error;
|
||||||
|
|
||||||
if (eventStart.errorIndex == eventStart.errorNum - 1)
|
if (eventStart.errorIndex == eventStart.errorNum - 1)
|
||||||
Log.error("\n"+player.errorMessage);
|
Program.Log.Error("\n"+player.errorMessage);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Actor ownerActor = Server.getStaticActors(eventStart.scriptOwnerActorID);
|
Actor ownerActor = Server.GetStaticActors(eventStart.scriptOwnerActorID);
|
||||||
if (ownerActor != null && ownerActor is Command)
|
if (ownerActor != null && ownerActor is Command)
|
||||||
{
|
{
|
||||||
player.getActor().currentCommand = eventStart.scriptOwnerActorID;
|
player.GetActor().currentCommand = eventStart.scriptOwnerActorID;
|
||||||
player.getActor().currentCommandName = eventStart.triggerName;
|
player.GetActor().currentCommandName = eventStart.triggerName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.getActor().currentEventOwner = eventStart.scriptOwnerActorID;
|
player.GetActor().currentEventOwner = eventStart.scriptOwnerActorID;
|
||||||
player.getActor().currentEventName = eventStart.triggerName;
|
player.GetActor().currentEventName = eventStart.triggerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ownerActor == null)
|
if (ownerActor == null)
|
||||||
{
|
{
|
||||||
//Is it a instance actor?
|
//Is it a instance actor?
|
||||||
ownerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().currentEventOwner);
|
ownerActor = Server.GetWorldManager().GetActorInWorld(player.GetActor().currentEventOwner);
|
||||||
if (ownerActor == null)
|
if (ownerActor == null)
|
||||||
{
|
{
|
||||||
//Is it a Director?
|
//Is it a Director?
|
||||||
if (player.getActor().currentDirector != null && player.getActor().currentEventOwner == player.getActor().currentDirector.actorId)
|
if (player.GetActor().currentDirector != null && player.GetActor().currentEventOwner == player.GetActor().currentDirector.actorId)
|
||||||
ownerActor = player.getActor().currentDirector;
|
ownerActor = player.GetActor().currentDirector;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.debug(String.Format("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams)));
|
Program.Log.Debug("\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.triggerName, LuaUtils.DumpParams(eventStart.luaParams));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaEngine.doActorOnEventStarted(player.getActor(), ownerActor, eventStart);
|
LuaEngine.DoActorOnEventStarted(player.GetActor(), ownerActor, eventStart);
|
||||||
|
|
||||||
Log.debug(String.Format("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.dumpParams(eventStart.luaParams)));
|
Program.Log.Debug("\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}", eventStart.actorID, eventStart.scriptOwnerActorID, eventStart.val1, eventStart.val2, eventStart.triggerName, LuaUtils.DumpParams(eventStart.luaParams));
|
||||||
break;
|
break;
|
||||||
//Unknown, happens at npc spawn and cutscene play????
|
//Unknown, happens at npc spawn and cutscene play????
|
||||||
case 0x00CE:
|
case 0x00CE:
|
||||||
break;
|
break;
|
||||||
//Event Result
|
//Event Result
|
||||||
case 0x012E:
|
case 0x012E:
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
EventUpdatePacket eventUpdate = new EventUpdatePacket(subpacket.data);
|
EventUpdatePacket eventUpdate = new EventUpdatePacket(subpacket.data);
|
||||||
Log.debug(String.Format("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}", eventUpdate.actorID, eventUpdate.scriptOwnerActorID, eventUpdate.val1, eventUpdate.val2, eventUpdate.step, LuaUtils.dumpParams(eventUpdate.luaParams)));
|
Program.Log.Debug("\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}", eventUpdate.actorID, eventUpdate.scriptOwnerActorID, eventUpdate.val1, eventUpdate.val2, eventUpdate.step, LuaUtils.DumpParams(eventUpdate.luaParams));
|
||||||
|
|
||||||
//Is it a static actor? If not look in the player's instance
|
//Is it a static actor? If not look in the player's instance
|
||||||
Actor updateOwnerActor = Server.getStaticActors(player.getActor().currentEventOwner);
|
Actor updateOwnerActor = Server.GetStaticActors(player.GetActor().currentEventOwner);
|
||||||
if (updateOwnerActor == null)
|
if (updateOwnerActor == null)
|
||||||
{
|
{
|
||||||
updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.getActor().currentEventOwner);
|
updateOwnerActor = Server.GetWorldManager().GetActorInWorld(player.GetActor().currentEventOwner);
|
||||||
|
|
||||||
if (player.getActor().currentDirector != null && player.getActor().currentEventOwner == player.getActor().currentDirector.actorId)
|
if (player.GetActor().currentDirector != null && player.GetActor().currentEventOwner == player.GetActor().currentDirector.actorId)
|
||||||
updateOwnerActor = player.getActor().currentDirector;
|
updateOwnerActor = player.GetActor().currentDirector;
|
||||||
|
|
||||||
if (updateOwnerActor == null)
|
if (updateOwnerActor == null)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaEngine.doActorOnEventUpdated(player.getActor(), updateOwnerActor, eventUpdate);
|
LuaEngine.DoActorOnEventUpdated(player.GetActor(), updateOwnerActor, eventUpdate);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x012F:
|
case 0x012F:
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
ParameterDataRequestPacket paramRequest = new ParameterDataRequestPacket(subpacket.data);
|
ParameterDataRequestPacket paramRequest = new ParameterDataRequestPacket(subpacket.data);
|
||||||
if (paramRequest.paramName.Equals("charaWork/exp"))
|
if (paramRequest.paramName.Equals("charaWork/exp"))
|
||||||
player.getActor().sendCharaExpInfo();
|
player.GetActor().SendCharaExpInfo();
|
||||||
break;
|
break;
|
||||||
/* RECRUITMENT */
|
/* RECRUITMENT */
|
||||||
//Start Recruiting
|
//Start Recruiting
|
||||||
case 0x01C3:
|
case 0x01C3:
|
||||||
StartRecruitingRequestPacket recruitRequestPacket = new StartRecruitingRequestPacket(subpacket.data);
|
StartRecruitingRequestPacket recruitRequestPacket = new StartRecruitingRequestPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(StartRecruitingResponse.buildPacket(player.actorID, true), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(StartRecruitingResponse.BuildPacket(player.actorID, true), true, false));
|
||||||
break;
|
break;
|
||||||
//End Recruiting
|
//End Recruiting
|
||||||
case 0x01C4:
|
case 0x01C4:
|
||||||
client.queuePacket(BasePacket.createPacket(EndRecruitmentPacket.buildPacket(player.actorID), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(EndRecruitmentPacket.BuildPacket(player.actorID), true, false));
|
||||||
break;
|
break;
|
||||||
//Party Window Opened, Request State
|
//Party Window Opened, Request State
|
||||||
case 0x01C5:
|
case 0x01C5:
|
||||||
client.queuePacket(BasePacket.createPacket(RecruiterStatePacket.buildPacket(player.actorID, true, true, 1), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(RecruiterStatePacket.BuildPacket(player.actorID, true, true, 1), true, false));
|
||||||
break;
|
break;
|
||||||
//Search Recruiting
|
//Search Recruiting
|
||||||
case 0x01C7:
|
case 0x01C7:
|
||||||
@ -350,84 +335,84 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
details.purposeId = 2;
|
details.purposeId = 2;
|
||||||
details.locationId = 1;
|
details.locationId = 1;
|
||||||
details.subTaskId = 1;
|
details.subTaskId = 1;
|
||||||
details.comment = "This is a test details packet sent by the server. No implementation has been created yet...";
|
details.comment = "This is a test details packet sent by the server. No implementation has been Created yet...";
|
||||||
details.num[0] = 1;
|
details.num[0] = 1;
|
||||||
client.queuePacket(BasePacket.createPacket(CurrentRecruitmentDetailsPacket.buildPacket(player.actorID, details), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(CurrentRecruitmentDetailsPacket.BuildPacket(player.actorID, details), true, false));
|
||||||
break;
|
break;
|
||||||
//Accepted Recruiting
|
//Accepted Recruiting
|
||||||
case 0x01C6:
|
case 0x01C6:
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
break;
|
break;
|
||||||
/* SOCIAL STUFF */
|
/* SOCIAL STUFF */
|
||||||
case 0x01C9:
|
case 0x01C9:
|
||||||
AddRemoveSocialPacket addBlackList = new AddRemoveSocialPacket(subpacket.data);
|
AddRemoveSocialPacket addBlackList = new AddRemoveSocialPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(BlacklistAddedPacket.buildPacket(player.actorID, true, addBlackList.name), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(BlacklistAddedPacket.BuildPacket(player.actorID, true, addBlackList.name), true, false));
|
||||||
break;
|
break;
|
||||||
case 0x01CA:
|
case 0x01CA:
|
||||||
AddRemoveSocialPacket removeBlackList = new AddRemoveSocialPacket(subpacket.data);
|
AddRemoveSocialPacket RemoveBlackList = new AddRemoveSocialPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(BlacklistRemovedPacket.buildPacket(player.actorID, true, removeBlackList.name), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(BlacklistRemovedPacket.BuildPacket(player.actorID, true, RemoveBlackList.name), true, false));
|
||||||
break;
|
break;
|
||||||
case 0x01CB:
|
case 0x01CB:
|
||||||
int offset1 = 0;
|
int offset1 = 0;
|
||||||
client.queuePacket(BasePacket.createPacket(SendBlacklistPacket.buildPacket(player.actorID, new String[] { "Test" }, ref offset1), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SendBlacklistPacket.BuildPacket(player.actorID, new String[] { "Test" }, ref offset1), true, false));
|
||||||
break;
|
break;
|
||||||
case 0x01CC:
|
case 0x01CC:
|
||||||
AddRemoveSocialPacket addFriendList = new AddRemoveSocialPacket(subpacket.data);
|
AddRemoveSocialPacket addFriendList = new AddRemoveSocialPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(FriendlistAddedPacket.buildPacket(player.actorID, true, (uint)addFriendList.name.GetHashCode(), true, addFriendList.name), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(FriendlistAddedPacket.BuildPacket(player.actorID, true, (uint)addFriendList.name.GetHashCode(), true, addFriendList.name), true, false));
|
||||||
break;
|
break;
|
||||||
case 0x01CD:
|
case 0x01CD:
|
||||||
AddRemoveSocialPacket removeFriendList = new AddRemoveSocialPacket(subpacket.data);
|
AddRemoveSocialPacket RemoveFriendList = new AddRemoveSocialPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(FriendlistRemovedPacket.buildPacket(player.actorID, true, removeFriendList.name), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(FriendlistRemovedPacket.BuildPacket(player.actorID, true, RemoveFriendList.name), true, false));
|
||||||
break;
|
break;
|
||||||
case 0x01CE:
|
case 0x01CE:
|
||||||
int offset2 = 0;
|
int offset2 = 0;
|
||||||
client.queuePacket(BasePacket.createPacket(SendFriendlistPacket.buildPacket(player.actorID, new Tuple<long, string>[] { new Tuple<long, string>(01, "Test2") }, ref offset2), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(SendFriendlistPacket.BuildPacket(player.actorID, new Tuple<long, string>[] { new Tuple<long, string>(01, "Test2") }, ref offset2), true, false));
|
||||||
break;
|
break;
|
||||||
case 0x01CF:
|
case 0x01CF:
|
||||||
client.queuePacket(BasePacket.createPacket(FriendStatusPacket.buildPacket(player.actorID, null), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(FriendStatusPacket.BuildPacket(player.actorID, null), true, false));
|
||||||
break;
|
break;
|
||||||
/* SUPPORT DESK STUFF */
|
/* SUPPORT DESK STUFF */
|
||||||
//Request for FAQ/Info List
|
//Request for FAQ/Info List
|
||||||
case 0x01D0:
|
case 0x01D0:
|
||||||
FaqListRequestPacket faqRequest = new FaqListRequestPacket(subpacket.data);
|
FaqListRequestPacket faqRequest = new FaqListRequestPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(FaqListResponsePacket.buildPacket(player.actorID, new string[] { "Testing FAQ1", "Coded style!" }), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(FaqListResponsePacket.BuildPacket(player.actorID, new string[] { "Testing FAQ1", "Coded style!" }), true, false));
|
||||||
break;
|
break;
|
||||||
//Request for body of a faq/info selection
|
//Request for body of a faq/info selection
|
||||||
case 0x01D1:
|
case 0x01D1:
|
||||||
FaqBodyRequestPacket faqBodyRequest = new FaqBodyRequestPacket(subpacket.data);
|
FaqBodyRequestPacket faqBodyRequest = new FaqBodyRequestPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(FaqBodyResponsePacket.buildPacket(player.actorID, "HERE IS A GIANT BODY. Nothing else to say!"), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(FaqBodyResponsePacket.BuildPacket(player.actorID, "HERE IS A GIANT BODY. Nothing else to say!"), true, false));
|
||||||
break;
|
break;
|
||||||
//Request issue list
|
//Request issue list
|
||||||
case 0x01D2:
|
case 0x01D2:
|
||||||
GMTicketIssuesRequestPacket issuesRequest = new GMTicketIssuesRequestPacket(subpacket.data);
|
GMTicketIssuesRequestPacket issuesRequest = new GMTicketIssuesRequestPacket(subpacket.data);
|
||||||
client.queuePacket(BasePacket.createPacket(IssueListResponsePacket.buildPacket(player.actorID, new string[] { "Test1", "Test2", "Test3", "Test4", "Test5" }), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(IssueListResponsePacket.BuildPacket(player.actorID, new string[] { "Test1", "Test2", "Test3", "Test4", "Test5" }), true, false));
|
||||||
break;
|
break;
|
||||||
//Request if GM ticket exists
|
//Request if GM ticket exists
|
||||||
case 0x01D3:
|
case 0x01D3:
|
||||||
client.queuePacket(BasePacket.createPacket(StartGMTicketPacket.buildPacket(player.actorID, false), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(StartGMTicketPacket.BuildPacket(player.actorID, false), true, false));
|
||||||
break;
|
break;
|
||||||
//Request for GM response message
|
//Request for GM response message
|
||||||
case 0x01D4:
|
case 0x01D4:
|
||||||
client.queuePacket(BasePacket.createPacket(GMTicketPacket.buildPacket(player.actorID, "This is a GM Ticket Title", "This is a GM Ticket Body."), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(GMTicketPacket.BuildPacket(player.actorID, "This is a GM Ticket Title", "This is a GM Ticket Body."), true, false));
|
||||||
break;
|
break;
|
||||||
//GM Ticket Sent
|
//GM Ticket Sent
|
||||||
case 0x01D5:
|
case 0x01D5:
|
||||||
GMSupportTicketPacket gmTicket = new GMSupportTicketPacket(subpacket.data);
|
GMSupportTicketPacket gmTicket = new GMSupportTicketPacket(subpacket.data);
|
||||||
Log.info("Got GM Ticket: \n" + gmTicket.ticketTitle + "\n" + gmTicket.ticketBody);
|
Program.Log.Info("Got GM Ticket: \n" + gmTicket.ticketTitle + "\n" + gmTicket.ticketBody);
|
||||||
client.queuePacket(BasePacket.createPacket(GMTicketSentResponsePacket.buildPacket(player.actorID, true), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(GMTicketSentResponsePacket.BuildPacket(player.actorID, true), true, false));
|
||||||
break;
|
break;
|
||||||
//Request to end ticket
|
//Request to end ticket
|
||||||
case 0x01D6:
|
case 0x01D6:
|
||||||
client.queuePacket(BasePacket.createPacket(EndGMTicketPacket.buildPacket(player.actorID), true, false));
|
client.QueuePacket(BasePacket.CreatePacket(EndGMTicketPacket.BuildPacket(player.actorID), true, false));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.debug(String.Format("Unknown command 0x{0:X} received.", subpacket.gameMessage.opcode));
|
Program.Log.Debug("Unknown command 0x{0:X} received.", subpacket.gameMessage.opcode);
|
||||||
subpacket.debugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
packet.debugPrintPacket();
|
packet.DebugPrintPacket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using System.Text;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.IO;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Lobby_Server.dataobjects;
|
using FFXIVClassic.Common;
|
||||||
using System.Collections.Generic;
|
using NLog;
|
||||||
using System.Text;
|
using NLog.Targets;
|
||||||
|
using NLog.Targets.Wrappers;
|
||||||
|
using NLog.Config;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
|
public static Logger Log;
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
@ -23,62 +25,61 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
#endif
|
#endif
|
||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
//Load Config
|
||||||
Console.WriteLine("---------FFXIV 1.0 Map Server---------");
|
if (!ConfigConstants.Load())
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
startServer = false;
|
||||||
|
|
||||||
|
// set up logging
|
||||||
|
|
||||||
|
Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
|
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
||||||
|
|
||||||
Assembly assem = Assembly.GetExecutingAssembly();
|
Assembly assem = Assembly.GetExecutingAssembly();
|
||||||
Version vers = assem.GetName().Version;
|
Version vers = assem.GetName().Version;
|
||||||
Console.WriteLine("Version: " + vers.ToString());
|
Program.Log.Info("Version: " + vers.ToString());
|
||||||
|
|
||||||
//Load Config
|
|
||||||
if (!ConfigConstants.load())
|
|
||||||
startServer = false;
|
|
||||||
|
|
||||||
//Test DB Connection
|
//Test DB Connection
|
||||||
Console.Write("Testing DB connection... ");
|
Program.Log.Info("Testing DB connection... ");
|
||||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
conn.Open();
|
conn.Open();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.WriteLine("[OK]");
|
Program.Log.Info("[OK]");
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
}
|
}
|
||||||
catch (MySqlException e)
|
catch (MySqlException e)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
Program.Log.Error(e.ToString());
|
||||||
Console.WriteLine("[FAILED]");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
startServer = false;
|
startServer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check World ID
|
//Check World ID
|
||||||
DBWorld thisWorld = Database.getServer(ConfigConstants.DATABASE_WORLDID);
|
DBWorld thisWorld = Database.GetServer(ConfigConstants.DATABASE_WORLDID);
|
||||||
if (thisWorld != null)
|
if (thisWorld != null)
|
||||||
Console.WriteLine("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name);
|
Program.Log.Info("Successfully pulled world info from DB. Server name is {0}.", thisWorld.name);
|
||||||
else
|
else
|
||||||
Console.WriteLine("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
|
Program.Log.Info("World info could not be retrieved from the DB. Welcome and MOTD will not be displayed.");
|
||||||
|
|
||||||
//Start server if A-OK
|
//Start server if A-OK
|
||||||
if (startServer)
|
if (startServer)
|
||||||
{
|
{
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
CommandProcessor cp = new CommandProcessor(server.getConnectedPlayerList());
|
CommandProcessor cp = new CommandProcessor(server.GetConnectedPlayerList());
|
||||||
server.startServer();
|
server.StartServer();
|
||||||
|
|
||||||
while (true)
|
while (startServer)
|
||||||
{
|
{
|
||||||
String input = Console.ReadLine();
|
String input = Console.ReadLine();
|
||||||
cp.doCommand(input, null);
|
Log.Info("[Console Input] " + input);
|
||||||
|
cp.DoCommand(input, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine("Press any key to continue...");
|
Program.Log.Info("Press any key to continue...");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
|
@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.Properties {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or Remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
@ -105,7 +105,7 @@ namespace FFXIVClassic_Map_Server.Properties {
|
|||||||
///
|
///
|
||||||
///Available commands:
|
///Available commands:
|
||||||
///Standard: mypos, music, warp
|
///Standard: mypos, music, warp
|
||||||
///Server Administration: givecurrency, giveitem, givekeyitem, removecurrency, removekeyitem, reloaditems, reloadzones
|
///Server Administration: givecurrency, giveitem, givekeyitem, Removecurrency, Removekeyitem, reloaditems, reloadzones
|
||||||
///Test: test weather.
|
///Test: test weather.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string CPhelp {
|
public static string CPhelp {
|
||||||
@ -129,7 +129,7 @@ namespace FFXIVClassic_Map_Server.Properties {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Prints out your current location
|
/// Looks up a localized string similar to Prints out your current location
|
||||||
///
|
///
|
||||||
///*Note: The X/Y/Z coordinates do not correspond to the coordinates listed in the in-game map, they are based on the underlying game data.
|
///*Note: The X/Y/Z coordinates Do not correspond to the coordinates listed in the in-game map, they are based on the underlying game data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string CPmypos {
|
public static string CPmypos {
|
||||||
get {
|
get {
|
||||||
@ -176,38 +176,38 @@ namespace FFXIVClassic_Map_Server.Properties {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Removes the specified currency from the current player's inventory
|
/// Looks up a localized string similar to Removes the specified currency from the current player's inventory
|
||||||
///
|
///
|
||||||
///*Syntax: removecurrency <quantity>
|
///*Syntax: Removecurrency <quantity>
|
||||||
/// removecurrency <type> <quantity>
|
/// Removecurrency <type> <quantity>
|
||||||
///<type> is the specific type of currency desired, defaults to gil if no type specified.
|
///<type> is the specific type of currency desired, defaults to gil if no type specified.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string CPremovecurrency {
|
public static string CPRemovecurrency {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("CPremovecurrency", resourceCulture);
|
return ResourceManager.GetString("CPRemovecurrency", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Removes the specified items to the current player's inventory
|
/// Looks up a localized string similar to Removes the specified items to the current player's inventory
|
||||||
///
|
///
|
||||||
///*Syntax: removeitem <itemid>
|
///*Syntax: Removeitem <itemid>
|
||||||
/// removeitem <itemid> <quantity>
|
/// Removeitem <itemid> <quantity>
|
||||||
///<item id> is the item's specific id as defined in the server database.
|
///<item id> is the item's specific id as defined in the server database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string CPremoveitem {
|
public static string CPRemoveitem {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("CPremoveitem", resourceCulture);
|
return ResourceManager.GetString("CPRemoveitem", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Removes the specified key item to the current player's inventory
|
/// Looks up a localized string similar to Removes the specified key item to the current player's inventory
|
||||||
///
|
///
|
||||||
///*Syntax: removekeyitem <itemid>
|
///*Syntax: Removekeyitem <itemid>
|
||||||
///<item id> is the key item's specific id as defined in the server database.
|
///<item id> is the key item's specific id as defined in the server database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string CPremovekeyitem {
|
public static string CPRemovekeyitem {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("CPremovekeyitem", resourceCulture);
|
return ResourceManager.GetString("CPRemovekeyitem", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ namespace FFXIVClassic_Map_Server.Properties {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Overrides the currently displayed character equipment in a specific slot
|
/// Looks up a localized string similar to Overrides the currently displayed character equipment in a specific slot
|
||||||
///
|
///
|
||||||
///*Note: Similar to Glamours in FFXIV:ARR, the overridden graphics are purely cosmetic, they do not affect the underlying stats of whatever is equipped on that slot
|
///*Note: Similar to Glamours in FFXIV:ARR, the overridden graphics are purely cosmetic, they Do not affect the underlying stats of whatever is equipped on that slot
|
||||||
///
|
///
|
||||||
///*Syntax: sendpacket <slot> <wid> <eid> <vid> <cid>
|
///*Syntax: sendpacket <slot> <wid> <eid> <vid> <cid>
|
||||||
///<w/e/v/c id> are as defined in the client game data.
|
///<w/e/v/c id> are as defined in the client game data.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are Done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@ -33,7 +33,7 @@
|
|||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that Don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
@ -156,7 +156,7 @@ Test: test weather</value>
|
|||||||
<data name="CPmypos" xml:space="preserve">
|
<data name="CPmypos" xml:space="preserve">
|
||||||
<value>Prints out your current location
|
<value>Prints out your current location
|
||||||
|
|
||||||
*Note: The X/Y/Z coordinates do not correspond to the coordinates listed in the in-game map, they are based on the underlying game data</value>
|
*Note: The X/Y/Z coordinates Do not correspond to the coordinates listed in the in-game map, they are based on the underlying game data</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CPproperty" xml:space="preserve">
|
<data name="CPproperty" xml:space="preserve">
|
||||||
<value>*Syntax: property <value 1> <value 2> <value 3></value>
|
<value>*Syntax: property <value 1> <value 2> <value 3></value>
|
||||||
@ -199,7 +199,7 @@ Test: test weather</value>
|
|||||||
<data name="CPsetgraphic" xml:space="preserve">
|
<data name="CPsetgraphic" xml:space="preserve">
|
||||||
<value>Overrides the currently displayed character equipment in a specific slot
|
<value>Overrides the currently displayed character equipment in a specific slot
|
||||||
|
|
||||||
*Note: Similar to Glamours in FFXIV:ARR, the overridden graphics are purely cosmetic, they do not affect the underlying stats of whatever is equipped on that slot
|
*Note: Similar to Glamours in FFXIV:ARR, the overridden graphics are purely cosmetic, they Do not affect the underlying stats of whatever is equipped on that slot
|
||||||
|
|
||||||
*Syntax: sendpacket <slot> <wid> <eid> <vid> <cid>
|
*Syntax: sendpacket <slot> <wid> <eid> <vid> <cid>
|
||||||
<w/e/v/c id> are as defined in the client game data</value>
|
<w/e/v/c id> are as defined in the client game data</value>
|
||||||
|
@ -1,24 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using System.IO;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using NLog;
|
||||||
using FFXIVClassic_Map_Server;
|
|
||||||
using FFXIVClassic_Map_Server.packets.send;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.actors.chara.player;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Map_Server
|
||||||
{
|
{
|
||||||
class Server
|
class Server
|
||||||
{
|
{
|
||||||
@ -46,9 +38,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
private Thread mConnectionHealthThread;
|
private Thread mConnectionHealthThread;
|
||||||
private bool killHealthThread = false;
|
private bool killHealthThread = false;
|
||||||
|
|
||||||
private void connectionHealth()
|
private void ConnectionHealth()
|
||||||
{
|
{
|
||||||
Log.info(String.Format("Connection Health thread started; it will run every {0} seconds.", HEALTH_THREAD_SLEEP_TIME));
|
Program.Log.Info("Connection Health thread started; it will run every {0} seconds.", HEALTH_THREAD_SLEEP_TIME);
|
||||||
while (!killHealthThread)
|
while (!killHealthThread)
|
||||||
{
|
{
|
||||||
lock (mConnectedPlayerList)
|
lock (mConnectedPlayerList)
|
||||||
@ -56,12 +48,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
List<ConnectedPlayer> dcedPlayers = new List<ConnectedPlayer>();
|
List<ConnectedPlayer> dcedPlayers = new List<ConnectedPlayer>();
|
||||||
foreach (ConnectedPlayer cp in mConnectedPlayerList.Values)
|
foreach (ConnectedPlayer cp in mConnectedPlayerList.Values)
|
||||||
{
|
{
|
||||||
if (cp.checkIfDCing())
|
if (cp.CheckIfDCing())
|
||||||
dcedPlayers.Add(cp);
|
dcedPlayers.Add(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ConnectedPlayer cp in dcedPlayers)
|
foreach (ConnectedPlayer cp in dcedPlayers)
|
||||||
cp.getActor().cleanupAndSave();
|
cp.GetActor().CleanupAndSave();
|
||||||
}
|
}
|
||||||
Thread.Sleep(HEALTH_THREAD_SLEEP_TIME * 1000);
|
Thread.Sleep(HEALTH_THREAD_SLEEP_TIME * 1000);
|
||||||
}
|
}
|
||||||
@ -72,30 +64,30 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mSelf = this;
|
mSelf = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Server getServer()
|
public static Server GetServer()
|
||||||
{
|
{
|
||||||
return mSelf;
|
return mSelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool startServer()
|
public bool StartServer()
|
||||||
{
|
{
|
||||||
mConnectionHealthThread = new Thread(new ThreadStart(connectionHealth));
|
mConnectionHealthThread = new Thread(new ThreadStart(ConnectionHealth));
|
||||||
mConnectionHealthThread.Name = "MapThread:Health";
|
mConnectionHealthThread.Name = "MapThread:Health";
|
||||||
//mConnectionHealthThread.Start();
|
//mConnectionHealthThread.Start();
|
||||||
|
|
||||||
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
mStaticActors = new StaticActors(STATIC_ACTORS_PATH);
|
||||||
|
|
||||||
gamedataItems = Database.getItemGamedata();
|
gamedataItems = Database.GetItemGamedata();
|
||||||
Log.info(String.Format("Loaded {0} items.", gamedataItems.Count));
|
Program.Log.Info("Loaded {0} items.", gamedataItems.Count);
|
||||||
|
|
||||||
mWorldManager = new WorldManager(this);
|
mWorldManager = new WorldManager(this);
|
||||||
mWorldManager.LoadZoneList();
|
mWorldManager.LoadZoneList();
|
||||||
mWorldManager.LoadZoneEntranceList();
|
mWorldManager.LoadZoneEntranceList();
|
||||||
mWorldManager.LoadActorClasses();
|
mWorldManager.LoadActorClasses();
|
||||||
mWorldManager.LoadSpawnLocations();
|
mWorldManager.LoadSpawnLocations();
|
||||||
mWorldManager.spawnAllActors();
|
mWorldManager.SpawnAllActors();
|
||||||
|
|
||||||
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), FFXIV_MAP_PORT);
|
IPEndPoint serverEndPoint = new System.Net.IPEndPoint(IPAddress.Parse(ConfigConstants.OPTIONS_BINDIP), int.Parse(ConfigConstants.OPTIONS_PORT));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -103,7 +95,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApplicationException("Could not create socket, check to make sure not duplicating port", e);
|
throw new ApplicationException("Could not Create socket, check to make sure not duplicating port", e);
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -116,16 +108,15 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new ApplicationException("Error occured starting listeners, check inner exception", e);
|
throw new ApplicationException("Error occured starting listeners, check inner exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.Write("Game server has started @ ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.White;
|
Console.ForegroundColor = ConsoleColor.White;
|
||||||
Console.WriteLine("{0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
Program.Log.Debug("Map Server has started @ {0}:{1}", (mServerSocket.LocalEndPoint as IPEndPoint).Address, (mServerSocket.LocalEndPoint as IPEndPoint).Port);
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
Console.ForegroundColor = ConsoleColor.Gray;
|
||||||
|
|
||||||
mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList);
|
mProcessor = new PacketProcessor(this, mConnectedPlayerList, mConnectionList);
|
||||||
@ -135,7 +126,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(Player player)
|
public void RemovePlayer(Player player)
|
||||||
{
|
{
|
||||||
lock (mConnectedPlayerList)
|
lock (mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
@ -145,7 +136,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Socket Handling
|
#region Socket Handling
|
||||||
private void acceptCallback(IAsyncResult result)
|
private void AcceptCallback(IAsyncResult result)
|
||||||
{
|
{
|
||||||
ClientConnection conn = null;
|
ClientConnection conn = null;
|
||||||
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
Socket socket = (System.Net.Sockets.Socket)result.AsyncState;
|
||||||
@ -162,11 +153,11 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Add(conn);
|
mConnectionList.Add(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.conn(String.Format("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port));
|
Program.Log.Info("Connection {0}:{1} has connected.", (conn.socket.RemoteEndPoint as IPEndPoint).Address, (conn.socket.RemoteEndPoint as IPEndPoint).Port);
|
||||||
//Queue recieving of data from the connection
|
//Queue recieving of data from the connection
|
||||||
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), conn);
|
||||||
//Queue the accept of the next incomming connection
|
//Queue the accept of the next incomming connection
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (SocketException)
|
catch (SocketException)
|
||||||
{
|
{
|
||||||
@ -178,7 +169,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -189,21 +180,21 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Actor getStaticActors(uint id)
|
public static Actor GetStaticActors(uint id)
|
||||||
{
|
{
|
||||||
return mStaticActors.getActor(id);
|
return mStaticActors.GetActor(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Actor getStaticActors(string name)
|
public static Actor GetStaticActors(string name)
|
||||||
{
|
{
|
||||||
return mStaticActors.findStaticActor(name);
|
return mStaticActors.FindStaticActor(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item getItemGamedata(uint id)
|
public static Item GetItemGamedata(uint id)
|
||||||
{
|
{
|
||||||
if (gamedataItems.ContainsKey(id))
|
if (gamedataItems.ContainsKey(id))
|
||||||
return gamedataItems[id];
|
return gamedataItems[id];
|
||||||
@ -215,7 +206,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
/// Receive Callback. Reads in incoming data, converting them to base packets. Base packets are sent to be parsed. If not enough data at the end to build a basepacket, move to the beginning and prepend.
|
/// Receive Callback. Reads in incoming data, converting them to base packets. Base packets are sent to be parsed. If not enough data at the end to build a basepacket, move to the beginning and prepend.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="result"></param>
|
/// <param name="result"></param>
|
||||||
private void receiveCallback(IAsyncResult result)
|
private void ReceiveCallback(IAsyncResult result)
|
||||||
{
|
{
|
||||||
ClientConnection conn = (ClientConnection)result.AsyncState;
|
ClientConnection conn = (ClientConnection)result.AsyncState;
|
||||||
|
|
||||||
@ -229,7 +220,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
if (conn.connType == BasePacket.TYPE_ZONE)
|
if (conn.connType == BasePacket.TYPE_ZONE)
|
||||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.GetAddress() : "User " + conn.owner);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,13 +237,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
//Build packets until can no longer or out of data
|
//Build packets until can no longer or out of data
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
BasePacket basePacket = buildPacket(ref offset, conn.buffer, bytesRead);
|
BasePacket basePacket = BuildPacket(ref offset, conn.buffer, bytesRead);
|
||||||
|
|
||||||
//If can't build packet, break, else process another
|
//If can't build packet, break, else process another
|
||||||
if (basePacket == null)
|
if (basePacket == null)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
mProcessor.processPacket(conn, basePacket);
|
mProcessor.ProcessPacket(conn, basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Not all bytes consumed, transfer leftover to beginning
|
//Not all bytes consumed, transfer leftover to beginning
|
||||||
@ -262,18 +253,18 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
conn.lastPartialSize = bytesRead - offset;
|
conn.lastPartialSize = bytesRead - offset;
|
||||||
|
|
||||||
//Build any queued subpackets into basepackets and send
|
//Build any queued subpackets into basepackets and send
|
||||||
conn.flushQueuedSendPackets();
|
conn.FlushQueuedSendPackets();
|
||||||
|
|
||||||
if (offset < bytesRead)
|
if (offset < bytesRead)
|
||||||
//Need offset since not all bytes consumed
|
//Need offset since not all bytes consumed
|
||||||
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
conn.socket.BeginReceive(conn.buffer, bytesRead - offset, conn.buffer.Length - (bytesRead - offset), SocketFlags.None, new AsyncCallback(ReceiveCallback), conn);
|
||||||
else
|
else
|
||||||
//All bytes consumed, full buffer available
|
//All bytes consumed, full buffer available
|
||||||
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(receiveCallback), conn);
|
conn.socket.BeginReceive(conn.buffer, 0, conn.buffer.Length, SocketFlags.None, new AsyncCallback(ReceiveCallback), conn);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.GetAddress() : "User " + conn.owner);
|
||||||
|
|
||||||
lock (mConnectionList)
|
lock (mConnectionList)
|
||||||
{
|
{
|
||||||
@ -285,7 +276,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (conn.socket != null)
|
if (conn.socket != null)
|
||||||
{
|
{
|
||||||
Log.conn(String.Format("{0} has disconnected.", conn.owner == 0 ? conn.getAddress() : "User " + conn.owner));
|
Program.Log.Info("{0} has disconnected.", conn.owner == 0 ? conn.GetAddress() : "User " + conn.owner);
|
||||||
|
|
||||||
lock (mConnectionList)
|
lock (mConnectionList)
|
||||||
{
|
{
|
||||||
@ -301,7 +292,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
/// <param name="offset">Current offset in buffer.</param>
|
/// <param name="offset">Current offset in buffer.</param>
|
||||||
/// <param name="buffer">Incoming buffer.</param>
|
/// <param name="buffer">Incoming buffer.</param>
|
||||||
/// <returns>Returns either a BasePacket or null if not enough data.</returns>
|
/// <returns>Returns either a BasePacket or null if not enough data.</returns>
|
||||||
public BasePacket buildPacket(ref int offset, byte[] buffer, int bytesRead)
|
public BasePacket BuildPacket(ref int offset, byte[] buffer, int bytesRead)
|
||||||
{
|
{
|
||||||
BasePacket newPacket = null;
|
BasePacket newPacket = null;
|
||||||
|
|
||||||
@ -338,7 +329,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
return mWorldManager;
|
return mWorldManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<uint, ConnectedPlayer> getConnectedPlayerList()
|
public Dictionary<uint, ConnectedPlayer> GetConnectedPlayerList()
|
||||||
{
|
{
|
||||||
return mConnectedPlayerList;
|
return mConnectedPlayerList;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Map_Server.actors.area;
|
using FFXIVClassic_Map_Server.actors.area;
|
||||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.common.EfficientHashTables;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
using FFXIVClassic_Map_Server.dataobjects.chara;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
@ -113,7 +113,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
Zone parent = zoneList[parentZoneId];
|
Zone parent = zoneList[parentZoneId];
|
||||||
PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), 1, reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
|
PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), 1, reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
|
||||||
parent.addPrivateArea(privArea);
|
parent.AddPrivateArea(privArea);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
@ -130,7 +130,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2));
|
Program.Log.Info(String.Format("Loaded {0} zones and {1} private areas.", count1, count2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadZoneEntranceList()
|
public void LoadZoneEntranceList()
|
||||||
@ -181,7 +181,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("Loaded {0} zone spawn locations.", count));
|
Program.Log.Info(String.Format("Loaded {0} zone spawn locations.", count));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadActorClasses()
|
public void LoadActorClasses()
|
||||||
@ -234,7 +234,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("Loaded {0} actor classes.", count));
|
Program.Log.Info(String.Format("Loaded {0} actor classes.", count));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadSpawnLocations()
|
public void LoadSpawnLocations()
|
||||||
@ -296,7 +296,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
SpawnLocation spawn = new SpawnLocation(classId, uniqueId, zoneId, privAreaName, privAreaLevel, x, y, z, rot, state, animId);
|
SpawnLocation spawn = new SpawnLocation(classId, uniqueId, zoneId, privAreaName, privAreaLevel, x, y, z, rot, state, animId);
|
||||||
|
|
||||||
zone.addSpawnLocation(spawn);
|
zone.AddSpawnLocation(spawn);
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
@ -311,14 +311,14 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.info(String.Format("Loaded {0} spawn(s).", count));
|
Program.Log.Info(String.Format("Loaded {0} spawn(s).", count));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnAllActors()
|
public void SpawnAllActors()
|
||||||
{
|
{
|
||||||
Log.info("Spawning actors...");
|
Program.Log.Info("Spawning actors...");
|
||||||
foreach (Zone z in zoneList.Values)
|
foreach (Zone z in zoneList.Values)
|
||||||
z.spawnAllActors(true);
|
z.SpawnAllActors(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Moves the actor to the new zone if exists. No packets are sent nor position changed.
|
//Moves the actor to the new zone if exists. No packets are sent nor position changed.
|
||||||
@ -329,7 +329,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (player.zone != null)
|
if (player.zone != null)
|
||||||
{
|
{
|
||||||
oldZone = player.zone;
|
oldZone = player.zone;
|
||||||
oldZone.removeActorFromZone(player);
|
oldZone.RemoveActorFromZone(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add player to new zone and update
|
//Add player to new zone and update
|
||||||
@ -339,9 +339,9 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (newZone == null)
|
if (newZone == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
newZone.addActorToZone(player);
|
newZone.AddActorToZone(player);
|
||||||
|
|
||||||
LuaEngine.onZoneIn(player);
|
LuaEngine.OnZoneIn(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Moves actor to new zone, and sends packets to spawn at the given zone entrance
|
//Moves actor to new zone, and sends packets to spawn at the given zone entrance
|
||||||
@ -349,7 +349,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
||||||
{
|
{
|
||||||
Log.error("Given zone entrance was not found: " + zoneEntrance);
|
Program.Log.Error("Given zone entrance was not found: " + zoneEntrance);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (player.zone != null)
|
if (player.zone != null)
|
||||||
{
|
{
|
||||||
oldZone = player.zone;
|
oldZone = player.zone;
|
||||||
oldZone.removeActorFromZone(player);
|
oldZone.RemoveActorFromZone(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add player to new zone and update
|
//Add player to new zone and update
|
||||||
@ -375,12 +375,12 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (destinationPrivateArea == null)
|
if (destinationPrivateArea == null)
|
||||||
newArea = GetZone(destinationZoneId);
|
newArea = GetZone(destinationZoneId);
|
||||||
else
|
else
|
||||||
newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0);
|
newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, 0);
|
||||||
//This server does not contain that zoneId
|
//This server does not contain that zoneId
|
||||||
if (newArea == null)
|
if (newArea == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
newArea.addActorToZone(player);
|
newArea.AddActorToZone(player);
|
||||||
|
|
||||||
//Update player actor's properties
|
//Update player actor's properties
|
||||||
player.zoneId = newArea.actorId;
|
player.zoneId = newArea.actorId;
|
||||||
@ -391,13 +391,13 @@ namespace FFXIVClassic_Map_Server
|
|||||||
player.rotation = spawnRotation;
|
player.rotation = spawnRotation;
|
||||||
|
|
||||||
//Send packets
|
//Send packets
|
||||||
player.playerSession.queuePacket(DeleteAllActorsPacket.buildPacket(player.actorId), true, false);
|
player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId), true, false);
|
||||||
player.playerSession.queuePacket(_0xE2Packet.buildPacket(player.actorId, 0x0), true, false);
|
player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x0), true, false);
|
||||||
player.sendZoneInPackets(this, spawnType);
|
player.SendZoneInPackets(this, spawnType);
|
||||||
player.playerSession.clearInstance();
|
player.playerSession.ClearInstance();
|
||||||
player.sendInstanceUpdate();
|
player.SendInstanceUpdate();
|
||||||
|
|
||||||
LuaEngine.onZoneIn(player);
|
LuaEngine.OnZoneIn(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Moves actor within zone to spawn position
|
//Moves actor within zone to spawn position
|
||||||
@ -405,7 +405,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
if (!zoneEntranceList.ContainsKey(zoneEntrance))
|
||||||
{
|
{
|
||||||
Log.error("Given zone entrance was not found: " + zoneEntrance);
|
Program.Log.Error("Given zone entrance was not found: " + zoneEntrance);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,8 +423,8 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//Remove player from currentZone if transfer else it's login
|
//Remove player from currentZone if transfer else it's login
|
||||||
if (player.zone != null)
|
if (player.zone != null)
|
||||||
{
|
{
|
||||||
player.zone.removeActorFromZone(player);
|
player.zone.RemoveActorFromZone(player);
|
||||||
player.zone.addActorToZone(player);
|
player.zone.AddActorToZone(player);
|
||||||
|
|
||||||
//Update player actor's properties;
|
//Update player actor's properties;
|
||||||
player.positionX = spawnX;
|
player.positionX = spawnX;
|
||||||
@ -433,9 +433,9 @@ namespace FFXIVClassic_Map_Server
|
|||||||
player.rotation = spawnRotation;
|
player.rotation = spawnRotation;
|
||||||
|
|
||||||
//Send packets
|
//Send packets
|
||||||
player.playerSession.queuePacket(_0xE2Packet.buildPacket(player.actorId, 0x0), true, false);
|
player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x0), true, false);
|
||||||
player.playerSession.queuePacket(player.createSpawnTeleportPacket(player.actorId, spawnType), true, false);
|
player.playerSession.QueuePacket(player.CreateSpawnTeleportPacket(player.actorId, spawnType), true, false);
|
||||||
player.sendInstanceUpdate();
|
player.SendInstanceUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,15 +453,15 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//Set the current zone and add player
|
//Set the current zone and add player
|
||||||
player.zone = zone;
|
player.zone = zone;
|
||||||
|
|
||||||
LuaEngine.onBeginLogin(player);
|
LuaEngine.OnBeginLogin(player);
|
||||||
|
|
||||||
zone.addActorToZone(player);
|
zone.AddActorToZone(player);
|
||||||
|
|
||||||
//Send packets
|
//Send packets
|
||||||
player.sendZoneInPackets(this, 0x1);
|
player.SendZoneInPackets(this, 0x1);
|
||||||
|
|
||||||
LuaEngine.onLogin(player);
|
LuaEngine.OnLogin(player);
|
||||||
LuaEngine.onZoneIn(player);
|
LuaEngine.OnZoneIn(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reloadZone(uint zoneId)
|
public void reloadZone(uint zoneId)
|
||||||
@ -547,7 +547,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZoneEntrance getZoneEntrance(uint entranceId)
|
public ZoneEntrance GetZoneEntrance(uint entranceId)
|
||||||
{
|
{
|
||||||
if (zoneEntranceList.ContainsKey(entranceId))
|
if (zoneEntranceList.ContainsKey(entranceId))
|
||||||
return zoneEntranceList[entranceId];
|
return zoneEntranceList[entranceId];
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
|
||||||
using FFXIVClassic_Map_Server.actors;
|
using FFXIVClassic_Map_Server.actors;
|
||||||
using FFXIVClassic_Map_Server.actors.area;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects.chara;
|
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor.events;
|
using FFXIVClassic_Map_Server.packets.send.actor.events;
|
||||||
|
using FFXIVClassic.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using FFXIVClassic_Map_Server.actors.area;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -62,66 +55,66 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_RUN;
|
this.moveSpeeds[3] = SetActorSpeedPacket.DEFAULT_RUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createAddActorPacket(uint playerActorId, byte val)
|
public SubPacket CreateAddActorPacket(uint playerActorId, byte val)
|
||||||
{
|
{
|
||||||
return AddActorPacket.buildPacket(actorId, playerActorId, val);
|
return AddActorPacket.BuildPacket(actorId, playerActorId, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createNamePacket(uint playerActorId)
|
public SubPacket CreateNamePacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return SetActorNamePacket.buildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : "");
|
return SetActorNamePacket.BuildPacket(actorId, playerActorId, displayNameId, displayNameId == 0xFFFFFFFF | displayNameId == 0x0 ? customDisplayName : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createSpeedPacket(uint playerActorId)
|
public SubPacket CreateSpeedPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return SetActorSpeedPacket.buildPacket(actorId, playerActorId);
|
return SetActorSpeedPacket.BuildPacket(actorId, playerActorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createSpawnPositonPacket(uint playerActorId, uint spawnType)
|
public SubPacket CreateSpawnPositonPacket(uint playerActorId, uint spawnType)
|
||||||
{
|
{
|
||||||
SubPacket spawnPacket;
|
SubPacket spawnPacket;
|
||||||
if (!spawnedFirstTime && playerActorId == actorId)
|
if (!spawnedFirstTime && playerActorId == actorId)
|
||||||
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, 0x1, false);
|
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, 0x1, false);
|
||||||
else if (playerActorId == actorId)
|
else if (playerActorId == actorId)
|
||||||
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true);
|
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, true);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this is Player)
|
if (this is Player)
|
||||||
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, spawnType, false);
|
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0, positionX, positionY, positionZ, rotation, spawnType, false);
|
||||||
else
|
else
|
||||||
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, actorId, positionX, positionY, positionZ, rotation, spawnType, false);
|
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, actorId, positionX, positionY, positionZ, rotation, spawnType, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
|
//return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
|
||||||
spawnedFirstTime = true;
|
spawnedFirstTime = true;
|
||||||
|
|
||||||
return spawnPacket;
|
return spawnPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createSpawnTeleportPacket(uint playerActorId, uint spawnType)
|
public SubPacket CreateSpawnTeleportPacket(uint playerActorId, uint spawnType)
|
||||||
{
|
{
|
||||||
SubPacket spawnPacket;
|
SubPacket spawnPacket;
|
||||||
|
|
||||||
spawnPacket = SetActorPositionPacket.buildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false);
|
spawnPacket = SetActorPositionPacket.BuildPacket(actorId, playerActorId, 0xFFFFFFFF, positionX, positionY, positionZ, rotation, spawnType, false);
|
||||||
|
|
||||||
//return SetActorPositionPacket.buildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
|
//return SetActorPositionPacket.BuildPacket(actorId, playerActorId, -211.895477f, 190.000000f, 29.651011f, 2.674819f, SetActorPositionPacket.SPAWNTYPE_PLAYERWAKE);
|
||||||
|
|
||||||
spawnPacket.debugPrintSubPacket();
|
spawnPacket.DebugPrintSubPacket();
|
||||||
|
|
||||||
return spawnPacket;
|
return spawnPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createPositionUpdatePacket(uint playerActorId)
|
public SubPacket CreatePositionUpdatePacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return MoveActorToPositionPacket.buildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState);
|
return MoveActorToPositionPacket.BuildPacket(actorId, playerActorId, positionX, positionY, positionZ, rotation, moveState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createStatePacket(uint playerActorID)
|
public SubPacket CreateStatePacket(uint playerActorID)
|
||||||
{
|
{
|
||||||
return SetActorStatePacket.buildPacket(actorId, playerActorID, currentMainState, currentSubState);
|
return SetActorStatePacket.BuildPacket(actorId, playerActorID, currentMainState, currentSubState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SubPacket> getEventConditionPackets(uint playerActorId)
|
public List<SubPacket> GetEventConditionPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
|
|
||||||
@ -132,126 +125,126 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
if (eventConditions.talkEventConditions != null)
|
if (eventConditions.talkEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
|
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
|
||||||
subpackets.Add(SetTalkEventCondition.buildPacket(playerActorId, actorId, condition));
|
subpackets.Add(SetTalkEventCondition.BuildPacket(playerActorId, actorId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.noticeEventConditions != null)
|
if (eventConditions.noticeEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
|
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
|
||||||
subpackets.Add(SetNoticeEventCondition.buildPacket(playerActorId, actorId, condition));
|
subpackets.Add(SetNoticeEventCondition.BuildPacket(playerActorId, actorId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.emoteEventConditions != null)
|
if (eventConditions.emoteEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
|
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
|
||||||
subpackets.Add(SetEmoteEventCondition.buildPacket(playerActorId, actorId, condition));
|
subpackets.Add(SetEmoteEventCondition.BuildPacket(playerActorId, actorId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.pushWithCircleEventConditions != null)
|
if (eventConditions.pushWithCircleEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
|
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
|
||||||
subpackets.Add(SetPushEventConditionWithCircle.buildPacket(playerActorId, actorId, condition));
|
subpackets.Add(SetPushEventConditionWithCircle.BuildPacket(playerActorId, actorId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.pushWithFanEventConditions != null)
|
if (eventConditions.pushWithFanEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
|
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
|
||||||
subpackets.Add(SetPushEventConditionWithFan.buildPacket(playerActorId, actorId, condition));
|
subpackets.Add(SetPushEventConditionWithFan.BuildPacket(playerActorId, actorId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.pushWithBoxEventConditions != null)
|
if (eventConditions.pushWithBoxEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
|
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
|
||||||
subpackets.Add(SetPushEventConditionWithTriggerBox.buildPacket(playerActorId, actorId, condition));
|
subpackets.Add(SetPushEventConditionWithTriggerBox.BuildPacket(playerActorId, actorId, condition));
|
||||||
}
|
}
|
||||||
|
|
||||||
return subpackets;
|
return subpackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasePacket getSetEventStatusPackets(uint playerActorId)
|
public BasePacket GetSetEventStatusPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
|
|
||||||
//Return empty list
|
//Return empty list
|
||||||
if (eventConditions == null)
|
if (eventConditions == null)
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
|
|
||||||
if (eventConditions.talkEventConditions != null)
|
if (eventConditions.talkEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
|
foreach (EventList.TalkEventCondition condition in eventConditions.talkEventConditions)
|
||||||
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 1, condition.conditionName));
|
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.noticeEventConditions != null)
|
if (eventConditions.noticeEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
|
foreach (EventList.NoticeEventCondition condition in eventConditions.noticeEventConditions)
|
||||||
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 1, condition.conditionName));
|
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 1, condition.conditionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.emoteEventConditions != null)
|
if (eventConditions.emoteEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
|
foreach (EventList.EmoteEventCondition condition in eventConditions.emoteEventConditions)
|
||||||
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 3, condition.conditionName));
|
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 3, condition.conditionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.pushWithCircleEventConditions != null)
|
if (eventConditions.pushWithCircleEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
|
foreach (EventList.PushCircleEventCondition condition in eventConditions.pushWithCircleEventConditions)
|
||||||
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 2, condition.conditionName));
|
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.pushWithFanEventConditions != null)
|
if (eventConditions.pushWithFanEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
|
foreach (EventList.PushFanEventCondition condition in eventConditions.pushWithFanEventConditions)
|
||||||
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 2, condition.conditionName));
|
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventConditions.pushWithBoxEventConditions != null)
|
if (eventConditions.pushWithBoxEventConditions != null)
|
||||||
{
|
{
|
||||||
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
|
foreach (EventList.PushBoxEventCondition condition in eventConditions.pushWithBoxEventConditions)
|
||||||
subpackets.Add(SetEventStatus.buildPacket(playerActorId, actorId, true, 2, condition.conditionName));
|
subpackets.Add(SetEventStatus.BuildPacket(playerActorId, actorId, true, 2, condition.conditionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createIsZoneingPacket(uint playerActorId)
|
public SubPacket CreateIsZoneingPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return SetActorIsZoningPacket.buildPacket(actorId, playerActorId, false);
|
return SetActorIsZoningPacket.BuildPacket(actorId, playerActorId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual SubPacket createScriptBindPacket(uint playerActorId)
|
public virtual SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, classParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, classParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual BasePacket getSpawnPackets(uint playerActorId)
|
public virtual BasePacket GetSpawnPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
return getSpawnPackets(playerActorId, 0x1);
|
return GetSpawnPackets(playerActorId, 0x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
|
public virtual BasePacket GetSpawnPackets(uint playerActorId, uint spawnType)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId, 8));
|
subpackets.Add(CreateAddActorPacket(playerActorId, 8));
|
||||||
subpackets.AddRange(getEventConditionPackets(playerActorId));
|
subpackets.AddRange(GetEventConditionPackets(playerActorId));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, spawnType));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, spawnType));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual BasePacket getInitPackets(uint playerActorId)
|
public virtual BasePacket GetInitPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
|
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
|
||||||
initProperties.addByte(0xE14B0CA8, 1);
|
initProperties.AddByte(0xE14B0CA8, 1);
|
||||||
initProperties.addByte(0x2138FD71, 1);
|
initProperties.AddByte(0x2138FD71, 1);
|
||||||
initProperties.addByte(0xFBFBCFB1, 1);
|
initProperties.AddByte(0xFBFBCFB1, 1);
|
||||||
initProperties.addTarget();
|
initProperties.AddTarget();
|
||||||
return BasePacket.createPacket(initProperties.buildPacket(playerActorId, actorId), true, false);
|
return BasePacket.CreatePacket(initProperties.BuildPacket(playerActorId, actorId), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(Object obj)
|
public override bool Equals(Object obj)
|
||||||
@ -263,50 +256,50 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return actorId == actorObj.actorId;
|
return actorId == actorObj.actorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getName()
|
public string GetName()
|
||||||
{
|
{
|
||||||
return actorName;
|
return actorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getClassName()
|
public string GetClassName()
|
||||||
{
|
{
|
||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ushort getState()
|
public ushort GetState()
|
||||||
{
|
{
|
||||||
return currentMainState;
|
return currentMainState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LuaParam> getLuaParams()
|
public List<LuaParam> GetLuaParams()
|
||||||
{
|
{
|
||||||
return classParams;
|
return classParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeState(ushort newState)
|
public void ChangeState(ushort newState)
|
||||||
{
|
{
|
||||||
currentMainState = newState;
|
currentMainState = newState;
|
||||||
SubPacket changeStatePacket = SetActorStatePacket.buildPacket(actorId, actorId, newState, currentSubState);
|
SubPacket ChangeStatePacket = SetActorStatePacket.BuildPacket(actorId, actorId, newState, currentSubState);
|
||||||
SubPacket battleActionPacket = BattleAction1Packet.buildPacket(actorId, actorId);
|
SubPacket battleActionPacket = BattleAction1Packet.BuildPacket(actorId, actorId);
|
||||||
zone.broadcastPacketAroundActor(this, changeStatePacket);
|
zone.BroadcastPacketAroundActor(this, ChangeStatePacket);
|
||||||
zone.broadcastPacketAroundActor(this, battleActionPacket);
|
zone.BroadcastPacketAroundActor(this, battleActionPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeSpeed(int type, float value)
|
public void ChangeSpeed(int type, float value)
|
||||||
{
|
{
|
||||||
moveSpeeds[type] = value;
|
moveSpeeds[type] = value;
|
||||||
SubPacket changeSpeedPacket = SetActorSpeedPacket.buildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
|
SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
|
||||||
zone.broadcastPacketAroundActor(this, changeSpeedPacket);
|
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeSpeed(float speedStop, float speedWalk, float speedRun)
|
public void ChangeSpeed(float speedStop, float speedWalk, float speedRun)
|
||||||
{
|
{
|
||||||
moveSpeeds[0] = speedStop;
|
moveSpeeds[0] = speedStop;
|
||||||
moveSpeeds[1] = speedWalk;
|
moveSpeeds[1] = speedWalk;
|
||||||
moveSpeeds[2] = speedRun;
|
moveSpeeds[2] = speedRun;
|
||||||
moveSpeeds[3] = speedRun;
|
moveSpeeds[3] = speedRun;
|
||||||
SubPacket changeSpeedPacket = SetActorSpeedPacket.buildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
|
SubPacket ChangeSpeedPacket = SetActorSpeedPacket.BuildPacket(actorId, actorId, moveSpeeds[0], moveSpeeds[1], moveSpeeds[2]);
|
||||||
zone.broadcastPacketAroundActor(this, changeSpeedPacket);
|
zone.BroadcastPacketAroundActor(this, ChangeSpeedPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateActorName(int actorNumber)
|
public void generateActorName(int actorNumber)
|
||||||
@ -351,7 +344,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
uint zoneId = zone.actorId;
|
uint zoneId = zone.actorId;
|
||||||
uint privLevel = 0;
|
uint privLevel = 0;
|
||||||
if (zone is PrivateArea)
|
if (zone is PrivateArea)
|
||||||
privLevel = ((PrivateArea)zone).getPrivateAreaLevel();
|
privLevel = ((PrivateArea)zone).GetPrivateAreaLevel();
|
||||||
|
|
||||||
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
actorName = String.Format("{0}_{1}_{2}@{3:X3}{4:X2}", className, zoneName, classNumber, zoneId, privLevel);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors
|
namespace FFXIVClassic_Map_Server.actors
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -20,7 +18,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
if (data[0] == 's' && data[1] == 'a' && data[2] == 'n' && data[3] == 'e')
|
if (data[0] == 's' && data[1] == 'a' && data[2] == 'n' && data[3] == 'e')
|
||||||
data = DecryptStaticActorsFile(data);
|
data = DecryptStaticActorsFile(data);
|
||||||
|
|
||||||
loadStaticActors(data);
|
LoadStaticActors(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] DecryptStaticActorsFile(byte[] encoded)
|
private byte[] DecryptStaticActorsFile(byte[] encoded)
|
||||||
@ -52,7 +50,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool loadStaticActors(byte[] data)
|
private bool LoadStaticActors(byte[] data)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -63,7 +61,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
while (binReader.BaseStream.Position != binReader.BaseStream.Length)
|
while (binReader.BaseStream.Position != binReader.BaseStream.Length)
|
||||||
{
|
{
|
||||||
uint id = Utils.swapEndian(binReader.ReadUInt32()) | 0xA0F00000;
|
uint id = Utils.SwapEndian(binReader.ReadUInt32()) | 0xA0F00000;
|
||||||
|
|
||||||
List<byte> list = new List<byte>();
|
List<byte> list = new List<byte>();
|
||||||
byte readByte;
|
byte readByte;
|
||||||
@ -91,19 +89,19 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(FileNotFoundException e)
|
catch(FileNotFoundException e)
|
||||||
{ Log.error("Could not find staticactors file."); return false; }
|
{ Program.Log.Error("Could not find staticactors file."); return false; }
|
||||||
|
|
||||||
Log.info(String.Format("Loaded {0} static actors.", mStaticActors.Count()));
|
Program.Log.Info("Loaded {0} static actors.", mStaticActors.Count());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool exists(uint actorId)
|
public bool Exists(uint actorId)
|
||||||
{
|
{
|
||||||
return mStaticActors[actorId] != null;
|
return mStaticActors[actorId] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor findStaticActor(string name)
|
public Actor FindStaticActor(string name)
|
||||||
{
|
{
|
||||||
foreach (Actor a in mStaticActors.Values)
|
foreach (Actor a in mStaticActors.Values)
|
||||||
{
|
{
|
||||||
@ -114,7 +112,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Actor getActor(uint actorId)
|
public Actor GetActor(uint actorId)
|
||||||
{
|
{
|
||||||
if (mStaticActors.ContainsKey(actorId))
|
if (mStaticActors.ContainsKey(actorId))
|
||||||
return mStaticActors[actorId];
|
return mStaticActors[actorId];
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.actors.area;
|
using FFXIVClassic_Map_Server.actors.area;
|
||||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
@ -75,29 +75,29 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList(classPath, false, true, zoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
lParams = LuaUtils.CreateLuaParamList(classPath, false, true, zoneName, "/Area/Zone/ZoneDefault", -1, (byte)1, true, false, false, false, false, false, false, false);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, "ZoneDefault", lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, "ZoneDefault", lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getSpawnPackets(uint playerActorId)
|
public override BasePacket GetSpawnPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId, 0));
|
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x1));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Actor Management
|
#region Actor Management
|
||||||
|
|
||||||
public void addActorToZone(Actor actor)
|
public void AddActorToZone(Actor actor)
|
||||||
{
|
{
|
||||||
if (!mActorList.ContainsKey(actor.actorId))
|
if (!mActorList.ContainsKey(actor.actorId))
|
||||||
mActorList.Add(actor.actorId, actor);
|
mActorList.Add(actor.actorId, actor);
|
||||||
@ -122,7 +122,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
mActorBlock[gridX, gridY].Add(actor);
|
mActorBlock[gridX, gridY].Add(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeActorFromZone(Actor actor)
|
public void RemoveActorFromZone(Actor actor)
|
||||||
{
|
{
|
||||||
mActorList.Remove(actor.actorId);
|
mActorList.Remove(actor.actorId);
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
mActorBlock[gridX, gridY].Remove(actor);
|
mActorBlock[gridX, gridY].Remove(actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateActorPosition(Actor actor)
|
public void UpdateActorPosition(Actor actor)
|
||||||
{
|
{
|
||||||
int gridX = (int)actor.positionX / boundingGridSize;
|
int gridX = (int)actor.positionX / boundingGridSize;
|
||||||
int gridY = (int)actor.positionZ / boundingGridSize;
|
int gridY = (int)actor.positionZ / boundingGridSize;
|
||||||
@ -191,7 +191,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Actor> getActorsAroundPoint(float x, float y, int checkDistance)
|
public List<Actor> GetActorsAroundPoint(float x, float y, int checkDistance)
|
||||||
{
|
{
|
||||||
checkDistance /= boundingGridSize;
|
checkDistance /= boundingGridSize;
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Actor> getActorsAroundActor(Actor actor, int checkDistance)
|
public List<Actor> GetActorsAroundActor(Actor actor, int checkDistance)
|
||||||
{
|
{
|
||||||
checkDistance /= boundingGridSize;
|
checkDistance /= boundingGridSize;
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return (Player)mActorList[id];
|
return (Player)mActorList[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
//Clear All
|
//Clear All
|
||||||
mActorList.Clear();
|
mActorList.Clear();
|
||||||
@ -319,12 +319,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void broadcastPacketAroundActor(Actor actor, SubPacket packet)
|
public void BroadcastPacketAroundActor(Actor actor, SubPacket packet)
|
||||||
{
|
{
|
||||||
if (isIsolated)
|
if (isIsolated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<Actor> aroundActor = getActorsAroundActor(actor, 50);
|
List<Actor> aroundActor = GetActorsAroundActor(actor, 50);
|
||||||
foreach (Actor a in aroundActor)
|
foreach (Actor a in aroundActor)
|
||||||
{
|
{
|
||||||
if (a is Player)
|
if (a is Player)
|
||||||
@ -334,12 +334,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
|
SubPacket clonedPacket = new SubPacket(packet, actor.actorId);
|
||||||
Player p = (Player)a;
|
Player p = (Player)a;
|
||||||
p.queuePacket(clonedPacket);
|
p.QueuePacket(clonedPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnActor(SpawnLocation location)
|
public void SpawnActor(SpawnLocation location)
|
||||||
{
|
{
|
||||||
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
|
ActorClass actorClass = Server.GetWorldManager().GetActorClass(location.classId);
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
Npc npc = new Npc(mActorList.Count + 1, actorClass.actorClassId, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, actorClass.displayNameId, null, actorClass.classPath);
|
Npc npc = new Npc(mActorList.Count + 1, actorClass.actorClassId, location.uniqueId, actorId, location.x, location.y, location.z, location.rot, location.state, location.animId, actorClass.displayNameId, null, actorClass.classPath);
|
||||||
npc.loadEventConditions(actorClass.eventConditions);
|
npc.loadEventConditions(actorClass.eventConditions);
|
||||||
|
|
||||||
addActorToZone(npc);
|
AddActorToZone(npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
@ -24,22 +24,22 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
this.privateAreaLevel = privateAreaLevel;
|
this.privateAreaLevel = privateAreaLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getPrivateAreaName()
|
public string GetPrivateAreaName()
|
||||||
{
|
{
|
||||||
return privateAreaName;
|
return privateAreaName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint getPrivateAreaLevel()
|
public uint GetPrivateAreaLevel()
|
||||||
{
|
{
|
||||||
return privateAreaLevel;
|
return privateAreaLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Zone getParentZone()
|
public Zone GetParentZone()
|
||||||
{
|
{
|
||||||
return parentZone;
|
return parentZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
|
|
||||||
@ -48,21 +48,21 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
if (className.ToLower().Contains("content"))
|
if (className.ToLower().Contains("content"))
|
||||||
path = "Content/" + className;
|
path = "Content/" + className;
|
||||||
|
|
||||||
lParams = LuaUtils.createLuaParamList("/Area/PrivateArea/" + path, false, true, zoneName, privateAreaName, 0x9E, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
lParams = LuaUtils.CreateLuaParamList("/Area/PrivateArea/" + path, false, true, zoneName, privateAreaName, 0x9E, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, false, false, false);
|
||||||
ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams).debugPrintSubPacket();
|
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket();
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addSpawnLocation(SpawnLocation spawn)
|
public void AddSpawnLocation(SpawnLocation spawn)
|
||||||
{
|
{
|
||||||
mSpawnLocations.Add(spawn);
|
mSpawnLocations.Add(spawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnAllActors()
|
public void SpawnAllActors()
|
||||||
{
|
{
|
||||||
foreach (SpawnLocation spawn in mSpawnLocations)
|
foreach (SpawnLocation spawn in mSpawnLocations)
|
||||||
spawnActor(spawn);
|
SpawnActor(spawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.actors.chara.npc;
|
using FFXIVClassic_Map_Server.actors.chara.npc;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
@ -23,18 +23,18 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPrivateArea(PrivateArea pa)
|
public void AddPrivateArea(PrivateArea pa)
|
||||||
{
|
{
|
||||||
if (privateAreas.ContainsKey(pa.getPrivateAreaName()))
|
if (privateAreas.ContainsKey(pa.GetPrivateAreaName()))
|
||||||
privateAreas[pa.getPrivateAreaName()][0] = pa;
|
privateAreas[pa.GetPrivateAreaName()][0] = pa;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
privateAreas[pa.getPrivateAreaName()] = new Dictionary<uint, PrivateArea>();
|
privateAreas[pa.GetPrivateAreaName()] = new Dictionary<uint, PrivateArea>();
|
||||||
privateAreas[pa.getPrivateAreaName()][0] = pa;
|
privateAreas[pa.GetPrivateAreaName()][0] = pa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PrivateArea getPrivateArea(string type, uint number)
|
public PrivateArea GetPrivateArea(string type, uint number)
|
||||||
{
|
{
|
||||||
if (privateAreas.ContainsKey(type))
|
if (privateAreas.ContainsKey(type))
|
||||||
{
|
{
|
||||||
@ -48,16 +48,16 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
bool isEntranceDesion = false;
|
bool isEntranceDesion = false;
|
||||||
|
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/Area/Zone/" + className, false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
lParams = LuaUtils.CreateLuaParamList("/Area/Zone/" + className, false, true, zoneName, "", -1, canRideChocobo ? (byte)1 : (byte)0, canStealth, isInn, false, false, false, true, isInstanceRaid, isEntranceDesion);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSpawnLocation(SpawnLocation spawn)
|
public void AddSpawnLocation(SpawnLocation spawn)
|
||||||
{
|
{
|
||||||
//Is it in a private area?
|
//Is it in a private area?
|
||||||
if (!spawn.privAreaName.Equals(""))
|
if (!spawn.privAreaName.Equals(""))
|
||||||
@ -66,28 +66,28 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
{
|
{
|
||||||
Dictionary<uint, PrivateArea> levels = privateAreas[spawn.privAreaName];
|
Dictionary<uint, PrivateArea> levels = privateAreas[spawn.privAreaName];
|
||||||
if (levels.ContainsKey(spawn.privAreaLevel))
|
if (levels.ContainsKey(spawn.privAreaLevel))
|
||||||
levels[spawn.privAreaLevel].addSpawnLocation(spawn);
|
levels[spawn.privAreaLevel].AddSpawnLocation(spawn);
|
||||||
else
|
else
|
||||||
Log.error(String.Format("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, zoneName));
|
Program.Log.Error("Tried to add a spawn location to non-existing private area level \"{0}\" in area {1} in zone {2}", spawn.privAreaName, spawn.privAreaLevel, zoneName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Log.error(String.Format("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, zoneName));
|
Program.Log.Error("Tried to add a spawn location to non-existing private area \"{0}\" in zone {1}", spawn.privAreaName, zoneName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mSpawnLocations.Add(spawn);
|
mSpawnLocations.Add(spawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnAllActors(bool doPrivAreas)
|
public void SpawnAllActors(bool doPrivAreas)
|
||||||
{
|
{
|
||||||
foreach (SpawnLocation spawn in mSpawnLocations)
|
foreach (SpawnLocation spawn in mSpawnLocations)
|
||||||
spawnActor(spawn);
|
SpawnActor(spawn);
|
||||||
|
|
||||||
if (doPrivAreas)
|
if (doPrivAreas)
|
||||||
{
|
{
|
||||||
foreach (Dictionary<uint, PrivateArea> areas in privateAreas.Values)
|
foreach (Dictionary<uint, PrivateArea> areas in privateAreas.Values)
|
||||||
{
|
{
|
||||||
foreach (PrivateArea pa in areas.Values)
|
foreach (PrivateArea pa in areas.Values)
|
||||||
pa.spawnAllActors();
|
pa.SpawnAllActors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class AetheryteWork
|
class AetheryteWork
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class BattleSave
|
class BattleSave
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class BattleTemp
|
class BattleTemp
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class CharaWork
|
class CharaWork
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors.Chara;
|
using FFXIVClassic_Map_Server.Actors.Chara;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -60,30 +55,30 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
charaWork.statusShownTime[i] = 0xFFFFFFFF;
|
charaWork.statusShownTime[i] = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createAppearancePacket(uint playerActorId)
|
public SubPacket CreateAppearancePacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelId, appearanceIds);
|
SetActorAppearancePacket setappearance = new SetActorAppearancePacket(modelId, appearanceIds);
|
||||||
return setappearance.buildPacket(actorId, playerActorId);
|
return setappearance.BuildPacket(actorId, playerActorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createInitStatusPacket(uint playerActorId)
|
public SubPacket CreateInitStatusPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return (SetActorStatusAllPacket.buildPacket(actorId, playerActorId, charaWork.status));
|
return (SetActorStatusAllPacket.BuildPacket(actorId, playerActorId, charaWork.status));
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createSetActorIconPacket(uint playerActorId)
|
public SubPacket CreateSetActorIconPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return SetActorIconPacket.buildPacket(actorId, playerActorId, currentActorIcon);
|
return SetActorIconPacket.BuildPacket(actorId, playerActorId, currentActorIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createIdleAnimationPacket(uint playerActorId)
|
public SubPacket CreateIdleAnimationPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return SetActorIdleAnimationPacket.buildPacket(actorId, playerActorId, animationId);
|
return SetActorIdleAnimationPacket.BuildPacket(actorId, playerActorId, animationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuestGraphic(Player player, int graphicNum)
|
public void SetQuestGraphic(Player player, int graphicNum)
|
||||||
{
|
{
|
||||||
player.queuePacket(SetActorQuestGraphicPacket.buildPacket(player.actorId, actorId, graphicNum));
|
player.QueuePacket(SetActorQuestGraphicPacket.BuildPacket(player.actorId, actorId, graphicNum));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class EventSave
|
class EventSave
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class EventTemp
|
class EventTemp
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class ParameterSave
|
class ParameterSave
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class ParameterTemp
|
class ParameterTemp
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class Work
|
class Work
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
|
||||||
using FFXIVClassic_Map_Server.actors;
|
using FFXIVClassic_Map_Server.actors;
|
||||||
using FFXIVClassic_Map_Server.Actors.Chara;
|
using FFXIVClassic_Map_Server.Actors.Chara;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.packets.receive.events;
|
using FFXIVClassic_Map_Server.packets.receive.events;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server.utils;
|
using FFXIVClassic_Map_Server.utils;
|
||||||
@ -77,13 +76,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
generateActorName((int)actorNumber);
|
generateActorName((int)actorNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createAddActorPacket(uint playerActorId)
|
public SubPacket CreateAddActorPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return AddActorPacket.buildPacket(actorId, playerActorId, 8);
|
return AddActorPacket.BuildPacket(actorId, playerActorId, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
// actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent
|
// actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
|
|
||||||
@ -94,9 +93,9 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
string classPathFake = "/Chara/Npc/Populace/PopulaceStandard";
|
string classPathFake = "/Chara/Npc/Populace/PopulaceStandard";
|
||||||
string classNameFake = "PopulaceStandard";
|
string classNameFake = "PopulaceStandard";
|
||||||
lParams = LuaUtils.createLuaParamList(classPathFake, false, false, false, false, false, 0xF47F6, false, false, 0, 0);
|
lParams = LuaUtils.CreateLuaParamList(classPathFake, false, false, false, false, false, 0xF47F6, false, false, 0, 0);
|
||||||
ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, classNameFake, lParams).debugPrintSubPacket();
|
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, classNameFake, lParams).DebugPrintSubPacket();
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, classNameFake, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, classNameFake, lParams);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -109,30 +108,30 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
lParams.Insert(6, new LuaParam(0, (int)actorClassId));
|
lParams.Insert(6, new LuaParam(0, (int)actorClassId));
|
||||||
}
|
}
|
||||||
|
|
||||||
ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams).debugPrintSubPacket();
|
ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams).DebugPrintSubPacket();
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
|
public override BasePacket GetSpawnPackets(uint playerActorId, uint spawnType)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId));
|
subpackets.Add(CreateAddActorPacket(playerActorId));
|
||||||
subpackets.AddRange(getEventConditionPackets(playerActorId));
|
subpackets.AddRange(GetEventConditionPackets(playerActorId));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x0));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x0));
|
||||||
subpackets.Add(createAppearancePacket(playerActorId));
|
subpackets.Add(CreateAppearancePacket(playerActorId));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIdleAnimationPacket(playerActorId));
|
subpackets.Add(CreateIdleAnimationPacket(playerActorId));
|
||||||
subpackets.Add(createInitStatusPacket(playerActorId));
|
subpackets.Add(CreateInitStatusPacket(playerActorId));
|
||||||
subpackets.Add(createSetActorIconPacket(playerActorId));
|
subpackets.Add(CreateSetActorIconPacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
|
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getInitPackets(uint playerActorId)
|
public override BasePacket GetInitPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId);
|
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId);
|
||||||
|
|
||||||
@ -140,49 +139,49 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
for (int i = 0; i < charaWork.property.Length; i++)
|
for (int i = 0; i < charaWork.property.Length; i++)
|
||||||
{
|
{
|
||||||
if (charaWork.property[i] != 0)
|
if (charaWork.property[i] != 0)
|
||||||
propPacketUtil.addProperty(String.Format("charaWork.property[{0}]", i));
|
propPacketUtil.AddProperty(String.Format("charaWork.property[{0}]", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Parameters
|
//Parameters
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.hp[0]");
|
propPacketUtil.AddProperty("charaWork.parameterSave.hp[0]");
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.hpMax[0]");
|
propPacketUtil.AddProperty("charaWork.parameterSave.hpMax[0]");
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.mp");
|
propPacketUtil.AddProperty("charaWork.parameterSave.mp");
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.mpMax");
|
propPacketUtil.AddProperty("charaWork.parameterSave.mpMax");
|
||||||
propPacketUtil.addProperty("charaWork.parameterTemp.tp");
|
propPacketUtil.AddProperty("charaWork.parameterTemp.tp");
|
||||||
|
|
||||||
if (charaWork.parameterSave.state_mainSkill[0] != 0)
|
if (charaWork.parameterSave.state_mainSkill[0] != 0)
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[0]");
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[0]");
|
||||||
if (charaWork.parameterSave.state_mainSkill[1] != 0)
|
if (charaWork.parameterSave.state_mainSkill[1] != 0)
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[1]");
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[1]");
|
||||||
if (charaWork.parameterSave.state_mainSkill[2] != 0)
|
if (charaWork.parameterSave.state_mainSkill[2] != 0)
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[2]");
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[2]");
|
||||||
if (charaWork.parameterSave.state_mainSkill[3] != 0)
|
if (charaWork.parameterSave.state_mainSkill[3] != 0)
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkill[3]");
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkill[3]");
|
||||||
|
|
||||||
propPacketUtil.addProperty("charaWork.parameterSave.state_mainSkillLevel");
|
propPacketUtil.AddProperty("charaWork.parameterSave.state_mainSkillLevel");
|
||||||
|
|
||||||
//Status Times
|
//Status Times
|
||||||
for (int i = 0; i < charaWork.statusShownTime.Length; i++)
|
for (int i = 0; i < charaWork.statusShownTime.Length; i++)
|
||||||
{
|
{
|
||||||
if (charaWork.statusShownTime[i] != 0xFFFFFFFF)
|
if (charaWork.statusShownTime[i] != 0xFFFFFFFF)
|
||||||
propPacketUtil.addProperty(String.Format("charaWork.statusShownTime[{0}]", i));
|
propPacketUtil.AddProperty(String.Format("charaWork.statusShownTime[{0}]", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
//General Parameters
|
//General Parameters
|
||||||
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
|
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
|
||||||
{
|
{
|
||||||
if (charaWork.battleTemp.generalParameter[i] != 0)
|
if (charaWork.battleTemp.generalParameter[i] != 0)
|
||||||
propPacketUtil.addProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
propPacketUtil.AddProperty(String.Format("charaWork.battleTemp.generalParameter[{0}]", i));
|
||||||
}
|
}
|
||||||
|
|
||||||
propPacketUtil.addProperty("npcWork.hateType");
|
propPacketUtil.AddProperty("npcWork.hateType");
|
||||||
propPacketUtil.addProperty("npcWork.pushCommand");
|
propPacketUtil.AddProperty("npcWork.pushCommand");
|
||||||
propPacketUtil.addProperty("npcWork.pushCommandPriority");
|
propPacketUtil.AddProperty("npcWork.pushCommandPriority");
|
||||||
|
|
||||||
return BasePacket.createPacket(propPacketUtil.done(), true, false);
|
return BasePacket.CreatePacket(propPacketUtil.Done(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint getActorClassId()
|
public uint GetActorClassId()
|
||||||
{
|
{
|
||||||
return actorClassId;
|
return actorClassId;
|
||||||
}
|
}
|
||||||
@ -252,7 +251,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
modelId = reader.GetUInt32(0);
|
modelId = reader.GetUInt32(0);
|
||||||
appearanceIds[Character.SIZE] = reader.GetUInt32(1);
|
appearanceIds[Character.SIZE] = reader.GetUInt32(1);
|
||||||
appearanceIds[Character.COLORINFO] = (uint)(reader.GetUInt32(16) | (reader.GetUInt32(15) << 10) | (reader.GetUInt32(17) << 20)); //17 - Skin Color, 16 - Hair Color, 18 - Eye Color
|
appearanceIds[Character.COLORINFO] = (uint)(reader.GetUInt32(16) | (reader.GetUInt32(15) << 10) | (reader.GetUInt32(17) << 20)); //17 - Skin Color, 16 - Hair Color, 18 - Eye Color
|
||||||
appearanceIds[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.getFaceInfo(reader.GetByte(6), reader.GetByte(7), reader.GetByte(5), reader.GetByte(14), reader.GetByte(13), reader.GetByte(12), reader.GetByte(11), reader.GetByte(10), reader.GetByte(9), reader.GetByte(8)));
|
appearanceIds[Character.FACEINFO] = PrimitiveConversion.ToUInt32(CharacterUtils.GetFaceInfo(reader.GetByte(6), reader.GetByte(7), reader.GetByte(5), reader.GetByte(14), reader.GetByte(13), reader.GetByte(12), reader.GetByte(11), reader.GetByte(10), reader.GetByte(9), reader.GetByte(8)));
|
||||||
appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(3) | reader.GetUInt32(2) << 10); //5- Hair Highlight, 4 - Hair Style
|
appearanceIds[Character.HIGHLIGHT_HAIR] = (uint)(reader.GetUInt32(3) | reader.GetUInt32(2) << 10); //5- Hair Highlight, 4 - Hair Style
|
||||||
appearanceIds[Character.VOICE] = reader.GetUInt32(17);
|
appearanceIds[Character.VOICE] = reader.GetUInt32(17);
|
||||||
appearanceIds[Character.MAINHAND] = reader.GetUInt32(19);
|
appearanceIds[Character.MAINHAND] = reader.GetUInt32(19);
|
||||||
@ -300,13 +299,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
Script parent = null, child = null;
|
Script parent = null, child = null;
|
||||||
|
|
||||||
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
||||||
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
|
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
|
||||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||||
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||||
|
|
||||||
if (parent == null && child == null)
|
if (parent == null && child == null)
|
||||||
{
|
{
|
||||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", getName()));
|
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,7 +318,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<LuaParam> lparams = LuaUtils.createLuaParamList(result);
|
List<LuaParam> lparams = LuaUtils.CreateLuaParamList(result);
|
||||||
return lparams;
|
return lparams;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,13 +327,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
Script parent = null, child = null;
|
Script parent = null, child = null;
|
||||||
|
|
||||||
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
||||||
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
|
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
|
||||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||||
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||||
|
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", getName()));
|
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +344,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
objects.Add(eventStart.triggerName);
|
objects.Add(eventStart.triggerName);
|
||||||
|
|
||||||
if (eventStart.luaParams != null)
|
if (eventStart.luaParams != null)
|
||||||
objects.AddRange(LuaUtils.createLuaParamObjectList(eventStart.luaParams));
|
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventStart.luaParams));
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
DynValue result;
|
DynValue result;
|
||||||
@ -364,13 +363,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
Script parent = null, child = null;
|
Script parent = null, child = null;
|
||||||
|
|
||||||
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
||||||
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
|
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
|
||||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||||
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||||
|
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", getName()));
|
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +378,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
objects.Add(player);
|
objects.Add(player);
|
||||||
objects.Add(this);
|
objects.Add(this);
|
||||||
objects.Add(eventUpdate.val2);
|
objects.Add(eventUpdate.val2);
|
||||||
objects.AddRange(LuaUtils.createLuaParamObjectList(eventUpdate.luaParams));
|
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventUpdate.luaParams));
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
DynValue result;
|
DynValue result;
|
||||||
@ -398,13 +397,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
Script parent = null, child = null;
|
Script parent = null, child = null;
|
||||||
|
|
||||||
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
if (File.Exists("./scripts/base/" + classPath + ".lua"))
|
||||||
parent = LuaEngine.loadScript("./scripts/base/" + classPath + ".lua");
|
parent = LuaEngine.LoadScript("./scripts/base/" + classPath + ".lua");
|
||||||
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
if (File.Exists(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier)))
|
||||||
child = LuaEngine.loadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
child = LuaEngine.LoadScript(String.Format("./scripts/unique/{0}/{1}/{2}.lua", zone.zoneName, className, uniqueIdentifier));
|
||||||
|
|
||||||
if (parent == null)
|
if (parent == null)
|
||||||
{
|
{
|
||||||
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", getName()));
|
LuaEngine.SendError(player, String.Format("ERROR: Could not find script for actor {0}.", GetName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors.Chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors.Chara
|
|
||||||
{
|
{
|
||||||
class NpcWork
|
class NpcWork
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
|
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
|
||||||
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.chara.player
|
namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
{
|
{
|
||||||
@ -69,40 +64,40 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toPlayer.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, toPlayer.actorId, 0x23, Inventory.EQUIPMENT_OTHERPLAYER));
|
toPlayer.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, toPlayer.actorId, 0x23, Inventory.EQUIPMENT_OTHERPLAYER));
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (items.Count - currentIndex >= 16)
|
if (items.Count - currentIndex >= 16)
|
||||||
toPlayer.queuePacket(InventoryListX16Packet.buildPacket(owner.actorId, toPlayer.actorId, items, ref currentIndex));
|
toPlayer.QueuePacket(InventoryListX16Packet.BuildPacket(owner.actorId, toPlayer.actorId, items, ref currentIndex));
|
||||||
else if (items.Count - currentIndex > 1)
|
else if (items.Count - currentIndex > 1)
|
||||||
toPlayer.queuePacket(InventoryListX08Packet.buildPacket(owner.actorId, toPlayer.actorId, items, ref currentIndex));
|
toPlayer.QueuePacket(InventoryListX08Packet.BuildPacket(owner.actorId, toPlayer.actorId, items, ref currentIndex));
|
||||||
else if (items.Count - currentIndex == 1)
|
else if (items.Count - currentIndex == 1)
|
||||||
{
|
{
|
||||||
toPlayer.queuePacket(InventoryListX01Packet.buildPacket(owner.actorId, toPlayer.actorId, items[currentIndex]));
|
toPlayer.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, toPlayer.actorId, items[currentIndex]));
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
toPlayer.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId, toPlayer.actorId));
|
toPlayer.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId, toPlayer.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendFullEquipment(bool doClear)
|
public void SendFullEquipment(bool DoClear)
|
||||||
{
|
{
|
||||||
List<ushort> slotsToUpdate = new List<ushort>();
|
List<ushort> slotsToUpdate = new List<ushort>();
|
||||||
for (ushort i = 0; i < list.Length; i++)
|
for (ushort i = 0; i < list.Length; i++)
|
||||||
{
|
{
|
||||||
if (list[i] == null && doClear)
|
if (list[i] == null && DoClear)
|
||||||
slotsToUpdate.Add(0);
|
slotsToUpdate.Add(0);
|
||||||
else if (list[i] != null)
|
else if (list[i] != null)
|
||||||
slotsToUpdate.Add(i);
|
slotsToUpdate.Add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
SendEquipmentPackets(slotsToUpdate);
|
SendEquipmentPackets(slotsToUpdate);
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEquipment(ushort[] slots, ushort[] itemSlots)
|
public void SetEquipment(ushort[] slots, ushort[] itemSlots)
|
||||||
@ -112,18 +107,18 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
for (int i = 0; i < slots.Length; i++)
|
for (int i = 0; i < slots.Length; i++)
|
||||||
{
|
{
|
||||||
InventoryItem item = normalInventory.getItemBySlot(itemSlots[i]);
|
InventoryItem item = normalInventory.GetItemBySlot(itemSlots[i]);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Database.equipItem(owner, slots[i], item.uniqueId);
|
Database.EquipItem(owner, slots[i], item.uniqueId);
|
||||||
list[slots[i]] = normalInventory.getItemBySlot(itemSlots[i]);
|
list[slots[i]] = normalInventory.GetItemBySlot(itemSlots[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
SendFullEquipment(false);
|
SendFullEquipment(false);
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEquipment(InventoryItem[] toEquip)
|
public void SetEquipment(InventoryItem[] toEquip)
|
||||||
@ -139,7 +134,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
public void Equip(ushort slot, ushort invSlot)
|
public void Equip(ushort slot, ushort invSlot)
|
||||||
{
|
{
|
||||||
InventoryItem item = normalInventory.getItemBySlot(invSlot);
|
InventoryItem item = normalInventory.GetItemBySlot(invSlot);
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
return;
|
return;
|
||||||
@ -153,20 +148,20 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (writeToDB)
|
if (writeToDB)
|
||||||
Database.equipItem(owner, slot, item.uniqueId);
|
Database.EquipItem(owner, slot, item.uniqueId);
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
if (list[slot] != null)
|
if (list[slot] != null)
|
||||||
normalInventory.RefreshItem(list[slot], item);
|
normalInventory.RefreshItem(list[slot], item);
|
||||||
else
|
else
|
||||||
normalInventory.RefreshItem(item);
|
normalInventory.RefreshItem(item);
|
||||||
|
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
SendEquipmentPackets(slot, item);
|
SendEquipmentPackets(slot, item);
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
list[slot] = item;
|
list[slot] = item;
|
||||||
}
|
}
|
||||||
@ -182,17 +177,17 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (writeToDB)
|
if (writeToDB)
|
||||||
Database.unequipItem(owner, slot);
|
Database.UnequipItem(owner, slot);
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
normalInventory.RefreshItem(list[slot]);
|
normalInventory.RefreshItem(list[slot]);
|
||||||
|
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
SendEquipmentPackets(slot, null);
|
SendEquipmentPackets(slot, null);
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
list[slot] = null;
|
list[slot] = null;
|
||||||
}
|
}
|
||||||
@ -200,9 +195,9 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
private void SendEquipmentPackets(ushort equipSlot, InventoryItem item)
|
private void SendEquipmentPackets(ushort equipSlot, InventoryItem item)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
owner.queuePacket(InventoryRemoveX01Packet.buildPacket(owner.actorId, equipSlot));
|
owner.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, equipSlot));
|
||||||
else
|
else
|
||||||
owner.queuePacket(EquipmentListX01Packet.buildPacket(owner.actorId, equipSlot, item.slot));
|
owner.QueuePacket(EquipmentListX01Packet.BuildPacket(owner.actorId, equipSlot, item.slot));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendEquipmentPackets(List<ushort> slotsToUpdate)
|
private void SendEquipmentPackets(List<ushort> slotsToUpdate)
|
||||||
@ -213,16 +208,16 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (slotsToUpdate.Count - currentIndex >= 64)
|
if (slotsToUpdate.Count - currentIndex >= 64)
|
||||||
owner.queuePacket(EquipmentListX64Packet.buildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
owner.QueuePacket(EquipmentListX64Packet.BuildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
||||||
else if (slotsToUpdate.Count - currentIndex >= 32)
|
else if (slotsToUpdate.Count - currentIndex >= 32)
|
||||||
owner.queuePacket(EquipmentListX32Packet.buildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
owner.QueuePacket(EquipmentListX32Packet.BuildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
||||||
else if (slotsToUpdate.Count - currentIndex >= 16)
|
else if (slotsToUpdate.Count - currentIndex >= 16)
|
||||||
owner.queuePacket(EquipmentListX16Packet.buildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
owner.QueuePacket(EquipmentListX16Packet.BuildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
||||||
else if (slotsToUpdate.Count - currentIndex > 1)
|
else if (slotsToUpdate.Count - currentIndex > 1)
|
||||||
owner.queuePacket(EquipmentListX08Packet.buildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
owner.QueuePacket(EquipmentListX08Packet.BuildPacket(owner.actorId, list, slotsToUpdate, ref currentIndex));
|
||||||
else if (slotsToUpdate.Count - currentIndex == 1)
|
else if (slotsToUpdate.Count - currentIndex == 1)
|
||||||
{
|
{
|
||||||
owner.queuePacket(EquipmentListX01Packet.buildPacket(owner.actorId, slotsToUpdate[currentIndex], list[slotsToUpdate[currentIndex]].slot));
|
owner.QueuePacket(EquipmentListX01Packet.BuildPacket(owner.actorId, slotsToUpdate[currentIndex], list[slotsToUpdate[currentIndex]].slot));
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
|
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
|
||||||
@ -7,8 +6,6 @@ using FFXIVClassic_Map_Server.packets.send.Actor.inventory;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.chara.player
|
namespace FFXIVClassic_Map_Server.actors.chara.player
|
||||||
{
|
{
|
||||||
@ -36,12 +33,12 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Inventory Management
|
#region Inventory Management
|
||||||
public void initList(List<InventoryItem> itemsFromDB)
|
public void InitList(List<InventoryItem> itemsFromDB)
|
||||||
{
|
{
|
||||||
list = itemsFromDB;
|
list = itemsFromDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryItem getItemBySlot(ushort slot)
|
public InventoryItem GetItemBySlot(ushort slot)
|
||||||
{
|
{
|
||||||
if (slot < list.Count)
|
if (slot < list.Count)
|
||||||
return list[slot];
|
return list[slot];
|
||||||
@ -49,7 +46,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InventoryItem getItemById(ulong itemId)
|
public InventoryItem GetItemById(ulong itemId)
|
||||||
{
|
{
|
||||||
foreach (InventoryItem item in list)
|
foreach (InventoryItem item in list)
|
||||||
{
|
{
|
||||||
@ -61,41 +58,41 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
public void RefreshItem(InventoryItem item)
|
public void RefreshItem(InventoryItem item)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
sendInventoryPackets(item);
|
SendInventoryPackets(item);
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshItem(params InventoryItem[] items)
|
public void RefreshItem(params InventoryItem[] items)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
sendInventoryPackets(items.ToList());
|
SendInventoryPackets(items.ToList());
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshItem(List<InventoryItem> items)
|
public void RefreshItem(List<InventoryItem> items)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
sendInventoryPackets(items);
|
SendInventoryPackets(items);
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(uint itemId)
|
public void AddItem(uint itemId)
|
||||||
{
|
{
|
||||||
addItem(itemId, 1, 1);
|
AddItem(itemId, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(uint itemId, int quantity)
|
public void AddItem(uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
addItem(itemId, quantity, 1);
|
AddItem(itemId, quantity, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(uint itemId, int quantity, byte quality)
|
public void AddItem(uint itemId, int quantity, byte quality)
|
||||||
{
|
{
|
||||||
if (!isSpaceForAdd(itemId, quantity))
|
if (!IsSpaceForAdd(itemId, quantity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Item gItem = Server.getItemGamedata(itemId);
|
Item gItem = Server.GetItemGamedata(itemId);
|
||||||
List<ushort> slotsToUpdate = new List<ushort>();
|
List<ushort> slotsToUpdate = new List<ushort>();
|
||||||
List<SubPacket> addItemPackets = new List<SubPacket>();
|
List<SubPacket> addItemPackets = new List<SubPacket>();
|
||||||
|
|
||||||
@ -124,73 +121,73 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
// return ITEMERROR_FULL;
|
// return ITEMERROR_FULL;
|
||||||
|
|
||||||
//Update lists and db
|
//Update lists and db
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
|
|
||||||
//These had their quantities changed
|
//These had their quantities Changed
|
||||||
foreach (ushort slot in slotsToUpdate)
|
foreach (ushort slot in slotsToUpdate)
|
||||||
{
|
{
|
||||||
Database.setQuantity(owner, slot, inventoryCode, list[slot].quantity);
|
Database.SetQuantity(owner, slot, inventoryCode, list[slot].quantity);
|
||||||
|
|
||||||
if (inventoryCode != CURRENCY && inventoryCode != KEYITEMS)
|
if (inventoryCode != CURRENCY && inventoryCode != KEYITEMS)
|
||||||
sendInventoryPackets(list[slot]);
|
SendInventoryPackets(list[slot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//New item that spilled over
|
//New item that spilled over
|
||||||
while (quantityCount > 0)
|
while (quantityCount > 0)
|
||||||
{
|
{
|
||||||
InventoryItem addedItem = Database.addItem(owner, itemId, Math.Min(quantityCount, gItem.maxStack), quality, gItem.isExclusive ? (byte)0x3 : (byte)0x0, gItem.durability, inventoryCode);
|
InventoryItem addedItem = Database.AddItem(owner, itemId, Math.Min(quantityCount, gItem.maxStack), quality, gItem.isExclusive ? (byte)0x3 : (byte)0x0, gItem.durability, inventoryCode);
|
||||||
|
|
||||||
|
|
||||||
list.Add(addedItem);
|
list.Add(addedItem);
|
||||||
|
|
||||||
if (inventoryCode != CURRENCY && inventoryCode != KEYITEMS)
|
if (inventoryCode != CURRENCY && inventoryCode != KEYITEMS)
|
||||||
sendInventoryPackets(addedItem);
|
SendInventoryPackets(addedItem);
|
||||||
|
|
||||||
quantityCount -= gItem.maxStack;
|
quantityCount -= gItem.maxStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventoryCode == CURRENCY || inventoryCode == KEYITEMS)
|
if (inventoryCode == CURRENCY || inventoryCode == KEYITEMS)
|
||||||
sendFullInventory();
|
SendFullInventory();
|
||||||
|
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addItem(uint[] itemId)
|
public void AddItem(uint[] itemId)
|
||||||
{
|
{
|
||||||
if (!isSpaceForAdd(itemId[0], itemId.Length))
|
if (!IsSpaceForAdd(itemId[0], itemId.Length))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Update lists and db
|
//Update lists and db
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
|
|
||||||
int startPos = list.Count;
|
int startPos = list.Count;
|
||||||
|
|
||||||
//New item that spilled over
|
//New item that spilled over
|
||||||
for (int i = 0; i < itemId.Length; i++)
|
for (int i = 0; i < itemId.Length; i++)
|
||||||
{
|
{
|
||||||
Item gItem = Server.getItemGamedata(itemId[i]);
|
Item gItem = Server.GetItemGamedata(itemId[i]);
|
||||||
InventoryItem addedItem = Database.addItem(owner, itemId[i], 1, (byte)1, gItem.isExclusive ? (byte)0x3 : (byte)0x0, gItem.durability, inventoryCode);
|
InventoryItem addedItem = Database.AddItem(owner, itemId[i], 1, (byte)1, gItem.isExclusive ? (byte)0x3 : (byte)0x0, gItem.durability, inventoryCode);
|
||||||
list.Add(addedItem);
|
list.Add(addedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendInventoryPackets(startPos);
|
SendInventoryPackets(startPos);
|
||||||
|
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(uint itemId, int quantity)
|
public void RemoveItem(uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
if (!hasItem(itemId, quantity))
|
if (!HasItem(itemId, quantity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<ushort> slotsToUpdate = new List<ushort>();
|
List<ushort> slotsToUpdate = new List<ushort>();
|
||||||
List<InventoryItem> itemsToRemove = new List<InventoryItem>();
|
List<InventoryItem> itemsToRemove = new List<InventoryItem>();
|
||||||
List<ushort> slotsToRemove = new List<ushort>();
|
List<ushort> slotsToRemove = new List<ushort>();
|
||||||
List<SubPacket> addItemPackets = new List<SubPacket>();
|
List<SubPacket> AddItemPackets = new List<SubPacket>();
|
||||||
|
|
||||||
//Remove as we go along
|
//Remove as we go along
|
||||||
int quantityCount = quantity;
|
int quantityCount = quantity;
|
||||||
@ -223,13 +220,13 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
for (int i = 0; i < slotsToUpdate.Count; i++)
|
for (int i = 0; i < slotsToUpdate.Count; i++)
|
||||||
{
|
{
|
||||||
Database.setQuantity(owner, slotsToUpdate[i], inventoryCode, list[slotsToUpdate[i]].quantity);
|
Database.SetQuantity(owner, slotsToUpdate[i], inventoryCode, list[slotsToUpdate[i]].quantity);
|
||||||
}
|
}
|
||||||
|
|
||||||
int oldListSize = list.Count;
|
int oldListSize = list.Count;
|
||||||
for (int i = 0; i < itemsToRemove.Count; i++)
|
for (int i = 0; i < itemsToRemove.Count; i++)
|
||||||
{
|
{
|
||||||
Database.removeItem(owner, itemsToRemove[i].uniqueId, inventoryCode);
|
Database.RemoveItem(owner, itemsToRemove[i].uniqueId, inventoryCode);
|
||||||
list.Remove(itemsToRemove[i]);
|
list.Remove(itemsToRemove[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,21 +241,21 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
slotsToRemove.Add((ushort)i);
|
slotsToRemove.Add((ushort)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
|
|
||||||
sendInventoryPackets(lowestSlot);
|
SendInventoryPackets(lowestSlot);
|
||||||
sendInventoryRemovePackets(slotsToRemove);
|
SendInventoryRemovePackets(slotsToRemove);
|
||||||
|
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
if (inventoryCode == NORMAL)
|
if (inventoryCode == NORMAL)
|
||||||
owner.getEquipment().SendFullEquipment(false);
|
owner.GetEquipment().SendFullEquipment(false);
|
||||||
|
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(ulong itemDBId)
|
public void RemoveItem(ulong itemDBId)
|
||||||
{
|
{
|
||||||
ushort slot = 0;
|
ushort slot = 0;
|
||||||
InventoryItem toDelete = null;
|
InventoryItem toDelete = null;
|
||||||
@ -277,104 +274,104 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
int oldListSize = list.Count;
|
int oldListSize = list.Count;
|
||||||
list.RemoveAt(slot);
|
list.RemoveAt(slot);
|
||||||
Database.removeItem(owner, itemDBId, inventoryCode);
|
Database.RemoveItem(owner, itemDBId, inventoryCode);
|
||||||
|
|
||||||
//Realign slots
|
//Realign slots
|
||||||
for (int i = slot; i < list.Count; i++)
|
for (int i = slot; i < list.Count; i++)
|
||||||
list[i].slot = (ushort)i;
|
list[i].slot = (ushort)i;
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
|
|
||||||
sendInventoryPackets(slot);
|
SendInventoryPackets(slot);
|
||||||
sendInventoryRemovePackets(slot);
|
SendInventoryRemovePackets(slot);
|
||||||
if (slot != oldListSize - 1)
|
if (slot != oldListSize - 1)
|
||||||
sendInventoryRemovePackets((ushort)(oldListSize - 1));
|
SendInventoryRemovePackets((ushort)(oldListSize - 1));
|
||||||
|
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
if (inventoryCode == NORMAL)
|
if (inventoryCode == NORMAL)
|
||||||
owner.getEquipment().SendFullEquipment(false);
|
owner.GetEquipment().SendFullEquipment(false);
|
||||||
|
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeItem(ushort slot)
|
public void RemoveItem(ushort slot)
|
||||||
{
|
{
|
||||||
if (slot >= list.Count)
|
if (slot >= list.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int oldListSize = list.Count;
|
int oldListSize = list.Count;
|
||||||
list.RemoveAt((int)slot);
|
list.RemoveAt((int)slot);
|
||||||
Database.removeItem(owner, slot, inventoryCode);
|
Database.RemoveItem(owner, slot, inventoryCode);
|
||||||
|
|
||||||
//Realign slots
|
//Realign slots
|
||||||
for (int i = slot; i < list.Count; i++)
|
for (int i = slot; i < list.Count; i++)
|
||||||
list[i].slot = (ushort)i;
|
list[i].slot = (ushort)i;
|
||||||
|
|
||||||
owner.queuePacket(InventoryBeginChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryBeginChangePacket.BuildPacket(owner.actorId));
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
|
|
||||||
sendInventoryPackets(slot);
|
SendInventoryPackets(slot);
|
||||||
sendInventoryRemovePackets(slot);
|
SendInventoryRemovePackets(slot);
|
||||||
if (slot != oldListSize - 1)
|
if (slot != oldListSize - 1)
|
||||||
sendInventoryRemovePackets((ushort)(oldListSize - 1));
|
SendInventoryRemovePackets((ushort)(oldListSize - 1));
|
||||||
|
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
|
|
||||||
if (inventoryCode == NORMAL)
|
if (inventoryCode == NORMAL)
|
||||||
owner.getEquipment().SendFullEquipment(false);
|
owner.GetEquipment().SendFullEquipment(false);
|
||||||
|
|
||||||
owner.queuePacket(InventoryEndChangePacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventoryEndChangePacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeDurability(uint slot, uint durabilityChange)
|
public void ChangeDurability(uint slot, uint durabilityChange)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeSpiritBind(uint slot, uint spiritBindChange)
|
public void ChangeSpiritBind(uint slot, uint spiritBindChange)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeMateria(uint slot, byte materiaSlot, byte materiaId)
|
public void ChangeMateria(uint slot, byte materiaSlot, byte materiaId)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Packet Functions
|
#region Packet Functions
|
||||||
public void sendFullInventory()
|
public void SendFullInventory()
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventorySetBeginPacket.buildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
owner.QueuePacket(InventorySetBeginPacket.BuildPacket(owner.actorId, inventoryCapacity, inventoryCode));
|
||||||
sendInventoryPackets(0);
|
SendInventoryPackets(0);
|
||||||
owner.queuePacket(InventorySetEndPacket.buildPacket(owner.actorId));
|
owner.QueuePacket(InventorySetEndPacket.BuildPacket(owner.actorId));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendInventoryPackets(InventoryItem item)
|
private void SendInventoryPackets(InventoryItem item)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventoryListX01Packet.buildPacket(owner.actorId, item));
|
owner.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, item));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendInventoryPackets(List<InventoryItem> items)
|
private void SendInventoryPackets(List<InventoryItem> items)
|
||||||
{
|
{
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (items.Count - currentIndex >= 64)
|
if (items.Count - currentIndex >= 64)
|
||||||
owner.queuePacket(InventoryListX64Packet.buildPacket(owner.actorId, items, ref currentIndex));
|
owner.QueuePacket(InventoryListX64Packet.BuildPacket(owner.actorId, items, ref currentIndex));
|
||||||
else if (items.Count - currentIndex >= 32)
|
else if (items.Count - currentIndex >= 32)
|
||||||
owner.queuePacket(InventoryListX32Packet.buildPacket(owner.actorId, items, ref currentIndex));
|
owner.QueuePacket(InventoryListX32Packet.BuildPacket(owner.actorId, items, ref currentIndex));
|
||||||
else if (items.Count - currentIndex >= 16)
|
else if (items.Count - currentIndex >= 16)
|
||||||
owner.queuePacket(InventoryListX16Packet.buildPacket(owner.actorId, items, ref currentIndex));
|
owner.QueuePacket(InventoryListX16Packet.BuildPacket(owner.actorId, items, ref currentIndex));
|
||||||
else if (items.Count - currentIndex > 1)
|
else if (items.Count - currentIndex > 1)
|
||||||
owner.queuePacket(InventoryListX08Packet.buildPacket(owner.actorId, items, ref currentIndex));
|
owner.QueuePacket(InventoryListX08Packet.BuildPacket(owner.actorId, items, ref currentIndex));
|
||||||
else if (items.Count - currentIndex == 1)
|
else if (items.Count - currentIndex == 1)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventoryListX01Packet.buildPacket(owner.actorId, items[currentIndex]));
|
owner.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, items[currentIndex]));
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -383,23 +380,23 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendInventoryPackets(int startOffset)
|
private void SendInventoryPackets(int startOffset)
|
||||||
{
|
{
|
||||||
int currentIndex = startOffset;
|
int currentIndex = startOffset;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (list.Count - currentIndex >= 64)
|
if (list.Count - currentIndex >= 64)
|
||||||
owner.queuePacket(InventoryListX64Packet.buildPacket(owner.actorId, list, ref currentIndex));
|
owner.QueuePacket(InventoryListX64Packet.BuildPacket(owner.actorId, list, ref currentIndex));
|
||||||
else if (list.Count - currentIndex >= 32)
|
else if (list.Count - currentIndex >= 32)
|
||||||
owner.queuePacket(InventoryListX32Packet.buildPacket(owner.actorId, list, ref currentIndex));
|
owner.QueuePacket(InventoryListX32Packet.BuildPacket(owner.actorId, list, ref currentIndex));
|
||||||
else if (list.Count - currentIndex >= 16)
|
else if (list.Count - currentIndex >= 16)
|
||||||
owner.queuePacket(InventoryListX16Packet.buildPacket(owner.actorId, list, ref currentIndex));
|
owner.QueuePacket(InventoryListX16Packet.BuildPacket(owner.actorId, list, ref currentIndex));
|
||||||
else if (list.Count - currentIndex > 1)
|
else if (list.Count - currentIndex > 1)
|
||||||
owner.queuePacket(InventoryListX08Packet.buildPacket(owner.actorId, list, ref currentIndex));
|
owner.QueuePacket(InventoryListX08Packet.BuildPacket(owner.actorId, list, ref currentIndex));
|
||||||
else if (list.Count - currentIndex == 1)
|
else if (list.Count - currentIndex == 1)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventoryListX01Packet.buildPacket(owner.actorId, list[currentIndex]));
|
owner.QueuePacket(InventoryListX01Packet.BuildPacket(owner.actorId, list[currentIndex]));
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -408,28 +405,28 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendInventoryRemovePackets(ushort index)
|
private void SendInventoryRemovePackets(ushort index)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventoryRemoveX01Packet.buildPacket(owner.actorId, index));
|
owner.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, index));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendInventoryRemovePackets(List<ushort> indexes)
|
private void SendInventoryRemovePackets(List<ushort> indexes)
|
||||||
{
|
{
|
||||||
int currentIndex = 0;
|
int currentIndex = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (indexes.Count - currentIndex >= 64)
|
if (indexes.Count - currentIndex >= 64)
|
||||||
owner.queuePacket(InventoryRemoveX64Packet.buildPacket(owner.actorId, indexes, ref currentIndex));
|
owner.QueuePacket(InventoryRemoveX64Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
|
||||||
else if (indexes.Count - currentIndex >= 32)
|
else if (indexes.Count - currentIndex >= 32)
|
||||||
owner.queuePacket(InventoryRemoveX32Packet.buildPacket(owner.actorId, indexes, ref currentIndex));
|
owner.QueuePacket(InventoryRemoveX32Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
|
||||||
else if (indexes.Count - currentIndex >= 16)
|
else if (indexes.Count - currentIndex >= 16)
|
||||||
owner.queuePacket(InventoryRemoveX16Packet.buildPacket(owner.actorId, indexes, ref currentIndex));
|
owner.QueuePacket(InventoryRemoveX16Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
|
||||||
else if (indexes.Count - currentIndex > 1)
|
else if (indexes.Count - currentIndex > 1)
|
||||||
owner.queuePacket(InventoryRemoveX08Packet.buildPacket(owner.actorId, indexes, ref currentIndex));
|
owner.QueuePacket(InventoryRemoveX08Packet.BuildPacket(owner.actorId, indexes, ref currentIndex));
|
||||||
else if (indexes.Count - currentIndex == 1)
|
else if (indexes.Count - currentIndex == 1)
|
||||||
{
|
{
|
||||||
owner.queuePacket(InventoryRemoveX01Packet.buildPacket(owner.actorId, indexes[currentIndex]));
|
owner.QueuePacket(InventoryRemoveX01Packet.BuildPacket(owner.actorId, indexes[currentIndex]));
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -442,18 +439,18 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
|
|
||||||
#region Inventory Utils
|
#region Inventory Utils
|
||||||
|
|
||||||
public bool isFull()
|
public bool IsFull()
|
||||||
{
|
{
|
||||||
return list.Count >= inventoryCapacity;
|
return list.Count >= inventoryCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isSpaceForAdd(uint itemId, int quantity)
|
public bool IsSpaceForAdd(uint itemId, int quantity)
|
||||||
{
|
{
|
||||||
int quantityCount = quantity;
|
int quantityCount = quantity;
|
||||||
for (int i = 0; i < list.Count; i++)
|
for (int i = 0; i < list.Count; i++)
|
||||||
{
|
{
|
||||||
InventoryItem item = list[i];
|
InventoryItem item = list[i];
|
||||||
Item gItem = Server.getItemGamedata(item.itemId);
|
Item gItem = Server.GetItemGamedata(item.itemId);
|
||||||
if (item.itemId == itemId && item.quantity < gItem.maxStack)
|
if (item.itemId == itemId && item.quantity < gItem.maxStack)
|
||||||
{
|
{
|
||||||
quantityCount -= (gItem.maxStack - item.quantity);
|
quantityCount -= (gItem.maxStack - item.quantity);
|
||||||
@ -462,15 +459,15 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return quantityCount <= 0 || (quantityCount > 0 && !isFull());
|
return quantityCount <= 0 || (quantityCount > 0 && !IsFull());
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool hasItem(uint itemId)
|
public bool HasItem(uint itemId)
|
||||||
{
|
{
|
||||||
return hasItem(itemId, 1);
|
return HasItem(itemId, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool hasItem(uint itemId, int minQuantity)
|
public bool HasItem(uint itemId, int minQuantity)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
@ -486,7 +483,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.player
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNextEmptySlot()
|
public int GetNextEmptySlot()
|
||||||
{
|
{
|
||||||
return list.Count == 0 ? 0 : list.Count();
|
return list.Count == 0 ? 0 : list.Count();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.dataobjects.chara
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.dataobjects.chara
|
|
||||||
{
|
{
|
||||||
class PlayerWork
|
class PlayerWork
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
|
||||||
{
|
{
|
||||||
class Command : Actor
|
class Command : Actor
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -23,24 +18,24 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
this.className = "Debug";
|
this.className = "Debug";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/System/Debug.prog", false, false, false, false, true, 0xC51F, true, true);
|
lParams = LuaUtils.CreateLuaParamList("/System/Debug.prog", false, false, false, false, true, 0xC51F, true, true);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getSpawnPackets(uint playerActorId)
|
public override BasePacket GetSpawnPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId, 0));
|
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x1));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.director
|
namespace FFXIVClassic_Map_Server.actors.director
|
||||||
{
|
{
|
||||||
@ -19,35 +15,35 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual BasePacket getSpawnPackets(uint playerActorId, uint spawnType)
|
public virtual BasePacket GetSpawnPackets(uint playerActorId, uint spawnType)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId, 0));
|
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||||
subpackets.AddRange(getEventConditionPackets(playerActorId));
|
subpackets.AddRange(GetEventConditionPackets(playerActorId));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, 0));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getInitPackets(uint playerActorId)
|
public override BasePacket GetInitPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
|
SetActorPropetyPacket initProperties = new SetActorPropetyPacket("/_init");
|
||||||
initProperties.addTarget();
|
initProperties.AddTarget();
|
||||||
return BasePacket.createPacket(initProperties.buildPacket(playerActorId, actorId), true, false);
|
return BasePacket.CreatePacket(initProperties.BuildPacket(playerActorId, actorId), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTalked(Npc npc)
|
public void OnTalked(Npc npc)
|
||||||
{
|
{
|
||||||
LuaEngine.doDirectorOnTalked(this, owner, npc);
|
LuaEngine.DoDirectorOnTalked(this, owner, npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCommand(Command command)
|
public void OnCommand(Command command)
|
||||||
{
|
{
|
||||||
LuaEngine.doDirectorOnCommand(this, owner, command);
|
LuaEngine.DoDirectorOnCommand(this, owner, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.director
|
namespace FFXIVClassic_Map_Server.actors.director
|
||||||
{
|
{
|
||||||
@ -33,11 +30,11 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||||||
this.eventConditions.noticeEventConditions = noticeEventList;
|
this.eventConditions.noticeEventConditions = noticeEventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/Director/OpeningDirector", false, false, false, false, 0x13881);
|
lParams = LuaUtils.CreateLuaParamList("/Director/OpeningDirector", false, false, false, false, 0x13881);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.actors.director;
|
using FFXIVClassic_Map_Server.actors.director;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -29,24 +25,24 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
this.className = "Debug";
|
this.className = "Debug";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/Director/Weather/WeatherDirector", false, false, false, false, weatherId);
|
lParams = LuaUtils.CreateLuaParamList("/Director/Weather/WeatherDirector", false, false, false, false, weatherId);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getSpawnPackets(uint playerActorId)
|
public override BasePacket GetSpawnPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId, 0));
|
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x1));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.director
|
namespace FFXIVClassic_Map_Server.actors.director
|
||||||
{
|
{
|
||||||
@ -31,11 +27,11 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||||||
this.eventConditions.noticeEventConditions = noticeEventList;
|
this.eventConditions.noticeEventConditions = noticeEventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/Director/Quest/QuestDirectorMan0g001", false, false, false, false, false, 0x753A);
|
lParams = LuaUtils.CreateLuaParamList("/Director/Quest/QuestDirectorMan0g001", false, false, false, false, false, 0x753A);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.director
|
namespace FFXIVClassic_Map_Server.actors.director
|
||||||
{
|
{
|
||||||
@ -31,11 +27,11 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||||||
this.eventConditions.noticeEventConditions = noticeEventList;
|
this.eventConditions.noticeEventConditions = noticeEventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/Director/Quest/QuestDirectorMan0l001", false, false, false, false, false, 0x7532);
|
lParams = LuaUtils.CreateLuaParamList("/Director/Quest/QuestDirectorMan0l001", false, false, false, false, false, 0x7532);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.actors.director
|
namespace FFXIVClassic_Map_Server.actors.director
|
||||||
{
|
{
|
||||||
@ -31,11 +27,11 @@ namespace FFXIVClassic_Map_Server.actors.director
|
|||||||
this.eventConditions.noticeEventConditions = noticeEventList;
|
this.eventConditions.noticeEventConditions = noticeEventList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/Director/Quest/QuestDirectorMan0u001", false, false, false, false, false, 0x757F);
|
lParams = LuaUtils.CreateLuaParamList("/Director/Quest/QuestDirectorMan0u001", false, false, false, false, false, 0x757F);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
using FFXIVClassic_Map_Server.dataobjects;
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
|
||||||
{
|
{
|
||||||
class Judge : Actor
|
class Judge : Actor
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -69,7 +68,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
if (bitIndex >= 32)
|
if (bitIndex >= 32)
|
||||||
{
|
{
|
||||||
Log.error(String.Format("Tried to access bit flag >= 32 for questId: {0}", actorId));
|
Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
{
|
{
|
||||||
if (bitIndex >= 32)
|
if (bitIndex >= 32)
|
||||||
{
|
{
|
||||||
Log.error(String.Format("Tried to access bit flag >= 32 for questId: {0}", actorId));
|
Program.Log.Error("Tried to access bit flag >= 32 for questId: {0}", actorId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -116,7 +115,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SaveData()
|
public void SaveData()
|
||||||
{
|
{
|
||||||
Database.saveQuest(owner, this);
|
Database.SaveQuest(owner, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.dataobjects;
|
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.Actors
|
namespace FFXIVClassic_Map_Server.Actors
|
||||||
{
|
{
|
||||||
@ -21,24 +16,24 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
this.className = "WorldMaster";
|
this.className = "WorldMaster";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
lParams = LuaUtils.createLuaParamList("/World/WorldMaster_event", false, false, false, false, false, null);
|
lParams = LuaUtils.CreateLuaParamList("/World/WorldMaster_event", false, false, false, false, false, null);
|
||||||
return ActorInstantiatePacket.buildPacket(actorId, playerActorId, actorName, className, lParams);
|
return ActorInstantiatePacket.BuildPacket(actorId, playerActorId, actorName, className, lParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BasePacket getSpawnPackets(uint playerActorId)
|
public override BasePacket GetSpawnPackets(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<SubPacket> subpackets = new List<SubPacket>();
|
List<SubPacket> subpackets = new List<SubPacket>();
|
||||||
subpackets.Add(createAddActorPacket(playerActorId, 0));
|
subpackets.Add(CreateAddActorPacket(playerActorId, 0));
|
||||||
subpackets.Add(createSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(createSpawnPositonPacket(playerActorId, 0x1));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x1));
|
||||||
subpackets.Add(createNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(createStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
subpackets.Add(createIsZoneingPacket(playerActorId));
|
subpackets.Add(CreateIsZoneingPacket(playerActorId));
|
||||||
subpackets.Add(createScriptBindPacket(playerActorId));
|
subpackets.Add(CreateScriptBindPacket(playerActorId));
|
||||||
return BasePacket.createPacket(subpackets, true, false);
|
return BasePacket.CreatePacket(subpackets, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
|
||||||
{
|
|
||||||
[global::System.AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
|
|
||||||
sealed class BitfieldLengthAttribute : Attribute
|
|
||||||
{
|
|
||||||
uint length;
|
|
||||||
|
|
||||||
public BitfieldLengthAttribute(uint length)
|
|
||||||
{
|
|
||||||
this.length = length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint Length { get { return length; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
static class PrimitiveConversion
|
|
||||||
{
|
|
||||||
public static UInt32 ToUInt32<T>(T t) where T : struct
|
|
||||||
{
|
|
||||||
UInt32 r = 0;
|
|
||||||
int offset = 0;
|
|
||||||
|
|
||||||
// For every field suitably attributed with a BitfieldLength
|
|
||||||
foreach (System.Reflection.FieldInfo f in t.GetType().GetFields())
|
|
||||||
{
|
|
||||||
object[] attrs = f.GetCustomAttributes(typeof(BitfieldLengthAttribute), false);
|
|
||||||
if (attrs.Length == 1)
|
|
||||||
{
|
|
||||||
uint fieldLength = ((BitfieldLengthAttribute)attrs[0]).Length;
|
|
||||||
|
|
||||||
// Calculate a bitmask of the desired length
|
|
||||||
uint mask = 0;
|
|
||||||
for (int i = 0; i < fieldLength; i++)
|
|
||||||
mask |= (UInt32)1 << i;
|
|
||||||
|
|
||||||
r |= ((UInt32)f.GetValue(t) & mask) << offset;
|
|
||||||
|
|
||||||
offset += (int)fieldLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long ToLong<T>(T t) where T : struct
|
|
||||||
{
|
|
||||||
long r = 0;
|
|
||||||
int offset = 0;
|
|
||||||
|
|
||||||
// For every field suitably attributed with a BitfieldLength
|
|
||||||
foreach (System.Reflection.FieldInfo f in t.GetType().GetFields())
|
|
||||||
{
|
|
||||||
object[] attrs = f.GetCustomAttributes(typeof(BitfieldLengthAttribute), false);
|
|
||||||
if (attrs.Length == 1)
|
|
||||||
{
|
|
||||||
uint fieldLength = ((BitfieldLengthAttribute)attrs[0]).Length;
|
|
||||||
|
|
||||||
// Calculate a bitmask of the desired length
|
|
||||||
long mask = 0;
|
|
||||||
for (int i = 0; i < fieldLength; i++)
|
|
||||||
mask |= 1 << i;
|
|
||||||
|
|
||||||
r |= ((UInt32)f.GetValue(t) & mask) << offset;
|
|
||||||
|
|
||||||
offset += (int)fieldLength;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
|
||||||
{
|
|
||||||
class Log
|
|
||||||
{
|
|
||||||
public static void error(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Red;
|
|
||||||
Console.Write("[ERROR] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray ;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String message)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
|
||||||
Console.Write("[DEBUG] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
|
||||||
Console.Write("[INFO] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void database(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Magenta;
|
|
||||||
Console.Write("[SQL] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void conn(String message)
|
|
||||||
{
|
|
||||||
Console.Write("[{0}]", DateTime.Now.ToString("dd/MMM HH:mm"));
|
|
||||||
Console.ForegroundColor = ConsoleColor.Green;
|
|
||||||
Console.Write("[CONN] ");
|
|
||||||
Console.ForegroundColor = ConsoleColor.Gray;
|
|
||||||
Console.WriteLine(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,316 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.common
|
|
||||||
{
|
|
||||||
static class Utils
|
|
||||||
{
|
|
||||||
private static readonly uint[] _lookup32 = CreateLookup32();
|
|
||||||
|
|
||||||
private static uint[] CreateLookup32()
|
|
||||||
{
|
|
||||||
var result = new uint[256];
|
|
||||||
for (int i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
string s = i.ToString("X2");
|
|
||||||
result[i] = ((uint)s[0]) + ((uint)s[1] << 16);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ByteArrayToHex(byte[] bytes)
|
|
||||||
{
|
|
||||||
var lookup32 = _lookup32;
|
|
||||||
var result = new char[(bytes.Length * 3) + ((bytes.Length/16) < 1 ? 1 : (bytes.Length/16)*3) + bytes.Length+60];
|
|
||||||
int numNewLines = 0;
|
|
||||||
for (int i = 0; i < bytes.Length; i++)
|
|
||||||
{
|
|
||||||
var val = lookup32[bytes[i]];
|
|
||||||
result[(3 * i) + (17 * numNewLines) + 0] = (char)val;
|
|
||||||
result[(3 * i) + (17 * numNewLines) + 1] = (char)(val >> 16);
|
|
||||||
result[(3 * i) + (17 * numNewLines) + 2] = ' ';
|
|
||||||
|
|
||||||
result[(numNewLines * (3*16+17)) + (3 * 16) + (i % 16)] = (char)bytes[i] >= 32 && (char)bytes[i] <= 126 ? (char)bytes[i] : '.';
|
|
||||||
|
|
||||||
if (i != bytes.Length - 1 && bytes.Length > 16 && i != 0 && (i+1) % 16 == 0)
|
|
||||||
{
|
|
||||||
result[(numNewLines * (3*16+17)) + (3 * 16) + (16)] = '\n';
|
|
||||||
numNewLines++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return new string(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UInt32 UnixTimeStampUTC()
|
|
||||||
{
|
|
||||||
UInt32 unixTimeStamp;
|
|
||||||
DateTime currentTime = DateTime.Now;
|
|
||||||
DateTime zuluTime = currentTime.ToUniversalTime();
|
|
||||||
DateTime unixEpoch = new DateTime(1970, 1, 1);
|
|
||||||
unixTimeStamp = (UInt32)(zuluTime.Subtract(unixEpoch)).TotalSeconds;
|
|
||||||
|
|
||||||
return unixTimeStamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static UInt64 MilisUnixTimeStampUTC()
|
|
||||||
{
|
|
||||||
UInt64 unixTimeStamp;
|
|
||||||
DateTime currentTime = DateTime.Now;
|
|
||||||
DateTime zuluTime = currentTime.ToUniversalTime();
|
|
||||||
DateTime unixEpoch = new DateTime(1970, 1, 1);
|
|
||||||
unixTimeStamp = (UInt64)(zuluTime.Subtract(unixEpoch)).TotalMilliseconds;
|
|
||||||
|
|
||||||
return unixTimeStamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ulong swapEndian(ulong input)
|
|
||||||
{
|
|
||||||
return ((0x00000000000000FF) & (input >> 56) |
|
|
||||||
(0x000000000000FF00) & (input >> 40) |
|
|
||||||
(0x0000000000FF0000) & (input >> 24) |
|
|
||||||
(0x00000000FF000000) & (input >> 8) |
|
|
||||||
(0x000000FF00000000) & (input << 8) |
|
|
||||||
(0x0000FF0000000000) & (input << 24) |
|
|
||||||
(0x00FF000000000000) & (input << 40) |
|
|
||||||
(0xFF00000000000000) & (input << 56));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static uint swapEndian(uint input)
|
|
||||||
{
|
|
||||||
return ((input >> 24) & 0xff) |
|
|
||||||
((input << 8) & 0xff0000) |
|
|
||||||
((input >> 8) & 0xff00) |
|
|
||||||
((input << 24) & 0xff000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int swapEndian(int input)
|
|
||||||
{
|
|
||||||
uint inputAsUint = (uint)input;
|
|
||||||
|
|
||||||
input = (int)
|
|
||||||
(((inputAsUint >> 24) & 0xff) |
|
|
||||||
((inputAsUint << 8) & 0xff0000) |
|
|
||||||
((inputAsUint >> 8) & 0xff00) |
|
|
||||||
((inputAsUint << 24) & 0xff000000));
|
|
||||||
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static uint MurmurHash2(string key, uint seed)
|
|
||||||
{
|
|
||||||
// 'm' and 'r' are mixing constants generated offline.
|
|
||||||
// They're not really 'magic', they just happen to work well.
|
|
||||||
|
|
||||||
byte[] data = Encoding.ASCII.GetBytes(key);
|
|
||||||
const uint m = 0x5bd1e995;
|
|
||||||
const int r = 24;
|
|
||||||
int len = key.Length;
|
|
||||||
int dataIndex = len - 4;
|
|
||||||
|
|
||||||
// Initialize the hash to a 'random' value
|
|
||||||
|
|
||||||
uint h = seed ^ (uint)len;
|
|
||||||
|
|
||||||
// Mix 4 bytes at a time into the hash
|
|
||||||
|
|
||||||
|
|
||||||
while (len >= 4)
|
|
||||||
{
|
|
||||||
h *= m;
|
|
||||||
|
|
||||||
uint k = (uint)BitConverter.ToInt32(data, dataIndex);
|
|
||||||
k = ((k >> 24) & 0xff) | // move byte 3 to byte 0
|
|
||||||
((k << 8) & 0xff0000) | // move byte 1 to byte 2
|
|
||||||
((k >> 8) & 0xff00) | // move byte 2 to byte 1
|
|
||||||
((k << 24) & 0xff000000); // byte 0 to byte 3
|
|
||||||
|
|
||||||
k *= m;
|
|
||||||
k ^= k >> r;
|
|
||||||
k *= m;
|
|
||||||
|
|
||||||
h ^= k;
|
|
||||||
|
|
||||||
dataIndex -= 4;
|
|
||||||
len -= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle the last few bytes of the input array
|
|
||||||
switch (len)
|
|
||||||
{
|
|
||||||
case 3:
|
|
||||||
h ^= (uint)data[0] << 16; goto case 2;
|
|
||||||
case 2:
|
|
||||||
h ^= (uint)data[len-2] << 8; goto case 1;
|
|
||||||
case 1:
|
|
||||||
h ^= data[len-1];
|
|
||||||
h *= m;
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Do a few final mixes of the hash to ensure the last few
|
|
||||||
// bytes are well-incorporated.
|
|
||||||
|
|
||||||
h ^= h >> 13;
|
|
||||||
h *= m;
|
|
||||||
h ^= h >> 15;
|
|
||||||
|
|
||||||
return h;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] ConvertBoolArrayToBinaryStream(bool[] array)
|
|
||||||
{
|
|
||||||
byte[] data = new byte[(array.Length/8)+(array.Length%8 != 0 ? 1 : 0)];
|
|
||||||
|
|
||||||
int dataCounter = 0;
|
|
||||||
for (int i = 0; i < array.Length; i+=8)
|
|
||||||
{
|
|
||||||
for (int bitCount = 0; bitCount < 8; bitCount++)
|
|
||||||
{
|
|
||||||
if (i + bitCount >= array.Length)
|
|
||||||
break;
|
|
||||||
data[dataCounter] = (byte)(((array[i + bitCount] ? 1 : 0) << 7-bitCount) | data[dataCounter]);
|
|
||||||
}
|
|
||||||
dataCounter++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string FFXIVLoginStringDecodeBinary(string path)
|
|
||||||
{
|
|
||||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
|
||||||
byte[] data = File.ReadAllBytes(path);
|
|
||||||
int offset = 0x5405a;
|
|
||||||
//int offset = 0x5425d;
|
|
||||||
//int offset = 0x53ea0;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
string result = "";
|
|
||||||
uint key = (uint)data[offset + 0] << 8 | data[offset+1];
|
|
||||||
uint key2 = data[offset + 2];
|
|
||||||
key = RotateRight(key, 1) & 0xFFFF;
|
|
||||||
key -= 0x22AF;
|
|
||||||
key &= 0xFFFF;
|
|
||||||
key2 = key2 ^ key;
|
|
||||||
key = RotateRight(key, 1) & 0xFFFF;
|
|
||||||
key -= 0x22AF;
|
|
||||||
key &= 0xFFFF;
|
|
||||||
uint finalKey = key;
|
|
||||||
key = data[offset + 3];
|
|
||||||
uint count = (key2 & 0xFF) << 8;
|
|
||||||
key = key ^ finalKey;
|
|
||||||
key &= 0xFF;
|
|
||||||
count |= key;
|
|
||||||
|
|
||||||
int count2 = 0;
|
|
||||||
while (count != 0)
|
|
||||||
{
|
|
||||||
uint encrypted = data[offset + 4 + count2];
|
|
||||||
finalKey = RotateRight(finalKey, 1) & 0xFFFF;
|
|
||||||
finalKey -= 0x22AF;
|
|
||||||
finalKey &= 0xFFFF;
|
|
||||||
encrypted = encrypted ^ (finalKey & 0xFF);
|
|
||||||
|
|
||||||
result += (char)encrypted;
|
|
||||||
count--;
|
|
||||||
count2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset += 4 + count2;
|
|
||||||
|
|
||||||
Console.WriteLine(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string FFXIVLoginStringDecode(byte[] data)
|
|
||||||
{
|
|
||||||
string result = "";
|
|
||||||
uint key = (uint)data[0] << 8 | data[1];
|
|
||||||
uint key2 = data[2];
|
|
||||||
key = RotateRight(key, 1) & 0xFFFF;
|
|
||||||
key -= 0x22AF;
|
|
||||||
key2 = key2 ^ key;
|
|
||||||
key = RotateRight(key, 1) & 0xFFFF;
|
|
||||||
key -= 0x22AF;
|
|
||||||
uint finalKey = key;
|
|
||||||
key = data[3];
|
|
||||||
uint count = (key2 & 0xFF) << 8;
|
|
||||||
key = key ^ finalKey;
|
|
||||||
key &= 0xFF;
|
|
||||||
count |= key;
|
|
||||||
|
|
||||||
int count2 = 0;
|
|
||||||
while (count != 0)
|
|
||||||
{
|
|
||||||
uint encrypted = data[4 + count2];
|
|
||||||
finalKey = RotateRight(finalKey, 1) & 0xFFFF;
|
|
||||||
finalKey -= 0x22AF;
|
|
||||||
encrypted = encrypted ^ (finalKey & 0xFF);
|
|
||||||
result += (char)encrypted;
|
|
||||||
count--;
|
|
||||||
count2++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] FFXIVLoginStringEncode(uint key, string text)
|
|
||||||
{
|
|
||||||
key = key & 0xFFFF;
|
|
||||||
|
|
||||||
uint count = 0;
|
|
||||||
byte[] asciiBytes = Encoding.ASCII.GetBytes(text);
|
|
||||||
byte[] result = new byte[4 + text.Length];
|
|
||||||
for (count = 0; count < text.Length; count++)
|
|
||||||
{
|
|
||||||
result[result.Length - count - 1] = (byte)(asciiBytes[asciiBytes.Length - count - 1] ^ (key & 0xFF));
|
|
||||||
key += 0x22AF;
|
|
||||||
key &= 0xFFFF;
|
|
||||||
key = RotateLeft(key, 1) & 0xFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = count ^ key;
|
|
||||||
result[3] = (byte) (count & 0xFF);
|
|
||||||
|
|
||||||
key += 0x22AF & 0xFFFF;
|
|
||||||
key = RotateLeft(key, 1) & 0xFFFF;
|
|
||||||
|
|
||||||
result[2] = (byte)(key & 0xFF);
|
|
||||||
|
|
||||||
key += 0x22AF & 0xFFFF;
|
|
||||||
key = RotateLeft(key, 1) & 0xFFFF;
|
|
||||||
|
|
||||||
|
|
||||||
result[1] = (byte)(key & 0xFF);
|
|
||||||
result[0] = (byte)((key >> 8) & 0xFF);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static uint RotateLeft(uint value, int bits)
|
|
||||||
{
|
|
||||||
return (value << bits) | (value >> (16 - bits));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static uint RotateRight(uint value, int bits)
|
|
||||||
{
|
|
||||||
return (value >> bits) | (value << (16 - bits));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static string ToStringBase63(int number)
|
|
||||||
{
|
|
||||||
string lookup = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
||||||
|
|
||||||
string secondDigit = lookup.Substring((int)Math.Floor((double)number / (double)lookup.Length), 1);
|
|
||||||
string firstDigit = lookup.Substring(number % lookup.Length, 1);
|
|
||||||
|
|
||||||
return secondDigit + firstDigit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using FFXIVClassic_Map_Server;
|
||||||
using FFXIVClassic_Lobby_Server.common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
using FFXIVClassic_Map_Server.packets;
|
||||||
using FFXIVClassic_Map_Server.Actors;
|
using FFXIVClassic_Map_Server.Actors;
|
||||||
using FFXIVClassic_Map_Server.lua;
|
using FFXIVClassic_Map_Server.lua;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
@ -34,7 +34,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
actorInstanceList.Add(playerActor);
|
actorInstanceList.Add(playerActor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConnection(int type, ClientConnection conn)
|
public void SetConnection(int type, ClientConnection conn)
|
||||||
{
|
{
|
||||||
conn.connType = type;
|
conn.connType = type;
|
||||||
switch (type)
|
switch (type)
|
||||||
@ -48,55 +48,55 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isClientConnectionsReady()
|
public bool IsClientConnectionsReady()
|
||||||
{
|
{
|
||||||
return (zoneConnection != null && chatConnection != null);
|
return (zoneConnection != null && chatConnection != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disconnect()
|
public void Disconnect()
|
||||||
{
|
{
|
||||||
zoneConnection.disconnect();
|
zoneConnection.Disconnect();
|
||||||
chatConnection.disconnect();
|
chatConnection.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isDisconnected()
|
public bool IsDisconnected()
|
||||||
{
|
{
|
||||||
return (!zoneConnection.isConnected() && !chatConnection.isConnected());
|
return (!zoneConnection.IsConnected() && !chatConnection.IsConnected());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queuePacket(BasePacket basePacket)
|
public void QueuePacket(BasePacket basePacket)
|
||||||
{
|
{
|
||||||
zoneConnection.queuePacket(basePacket);
|
zoneConnection.QueuePacket(basePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queuePacket(SubPacket subPacket, bool isAuthed, bool isEncrypted)
|
public void QueuePacket(SubPacket subPacket, bool isAuthed, bool isEncrypted)
|
||||||
{
|
{
|
||||||
zoneConnection.queuePacket(subPacket, isAuthed, isEncrypted);
|
zoneConnection.QueuePacket(subPacket, isAuthed, isEncrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getActor()
|
public Player GetActor()
|
||||||
{
|
{
|
||||||
return playerActor;
|
return playerActor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ping()
|
public void Ping()
|
||||||
{
|
{
|
||||||
lastPingPacket = Utils.UnixTimeStampUTC();
|
lastPingPacket = Utils.UnixTimeStampUTC();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool checkIfDCing()
|
public bool CheckIfDCing()
|
||||||
{
|
{
|
||||||
uint currentTime = Utils.UnixTimeStampUTC();
|
uint currentTime = Utils.UnixTimeStampUTC();
|
||||||
if (currentTime - lastPingPacket >= 5000) //Show D/C flag
|
if (currentTime - lastPingPacket >= 5000) //Show D/C flag
|
||||||
playerActor.setDCFlag(true);
|
playerActor.SetDCFlag(true);
|
||||||
else if (currentTime - lastPingPacket >= 30000) //DCed
|
else if (currentTime - lastPingPacket >= 30000) //DCed
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
playerActor.setDCFlag(false);
|
playerActor.SetDCFlag(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePlayerActorPosition(float x, float y, float z, float rot, ushort moveState)
|
public void UpdatePlayerActorPosition(float x, float y, float z, float rot, ushort moveState)
|
||||||
{
|
{
|
||||||
playerActor.oldPositionX = playerActor.positionX;
|
playerActor.oldPositionX = playerActor.positionX;
|
||||||
playerActor.oldPositionY = playerActor.positionY;
|
playerActor.oldPositionY = playerActor.positionY;
|
||||||
@ -109,14 +109,14 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
playerActor.rotation = rot;
|
playerActor.rotation = rot;
|
||||||
playerActor.moveState = moveState;
|
playerActor.moveState = moveState;
|
||||||
|
|
||||||
getActor().zone.updateActorPosition(getActor());
|
GetActor().zone.UpdateActorPosition(GetActor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInstance(List<Actor> list)
|
public void UpdateInstance(List<Actor> list)
|
||||||
{
|
{
|
||||||
List<BasePacket> basePackets = new List<BasePacket>();
|
List<BasePacket> basePackets = new List<BasePacket>();
|
||||||
List<SubPacket> removeActorSubpackets = new List<SubPacket>();
|
List<SubPacket> RemoveActorSubpackets = new List<SubPacket>();
|
||||||
List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
|
List<SubPacket> posUpdateSubpackets = new List<SubPacket>();
|
||||||
|
|
||||||
//Remove missing actors
|
//Remove missing actors
|
||||||
@ -124,7 +124,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
{
|
{
|
||||||
if (!list.Contains(actorInstanceList[i]))
|
if (!list.Contains(actorInstanceList[i]))
|
||||||
{
|
{
|
||||||
getActor().queuePacket(RemoveActorPacket.buildPacket(playerActor.actorId, actorInstanceList[i].actorId));
|
GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId));
|
||||||
actorInstanceList.RemoveAt(i);
|
actorInstanceList.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,13 +139,13 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
|
|
||||||
if (actorInstanceList.Contains(actor))
|
if (actorInstanceList.Contains(actor))
|
||||||
{
|
{
|
||||||
getActor().queuePacket(actor.createPositionUpdatePacket(playerActor.actorId));
|
GetActor().QueuePacket(actor.CreatePositionUpdatePacket(playerActor.actorId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getActor().queuePacket(actor.getSpawnPackets(playerActor.actorId, 1));
|
GetActor().QueuePacket(actor.GetSpawnPackets(playerActor.actorId, 1));
|
||||||
getActor().queuePacket(actor.getInitPackets(playerActor.actorId));
|
GetActor().QueuePacket(actor.GetInitPackets(playerActor.actorId));
|
||||||
getActor().queuePacket(actor.getSetEventStatusPackets(playerActor.actorId));
|
GetActor().QueuePacket(actor.GetSetEventStatusPackets(playerActor.actorId));
|
||||||
actorInstanceList.Add(actor);
|
actorInstanceList.Add(actor);
|
||||||
|
|
||||||
if (actor is Npc)
|
if (actor is Npc)
|
||||||
@ -158,7 +158,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void clearInstance()
|
public void ClearInstance()
|
||||||
{
|
{
|
||||||
actorInstanceList.Clear();
|
actorInstanceList.Clear();
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server.dataobjects
|
|
||||||
{
|
{
|
||||||
class DBWorld
|
class DBWorld
|
||||||
{
|
{
|
||||||
public ushort id;
|
public ushort id;
|
||||||
public string address;
|
public string Address;
|
||||||
public ushort port;
|
public ushort port;
|
||||||
public ushort listPosition;
|
public ushort listPosition;
|
||||||
public ushort population;
|
public ushort population;
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
using FFXIVClassic_Lobby_Server;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.dataobjects
|
namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
{
|
{
|
||||||
@ -35,7 +30,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
this.quantity = 1;
|
this.quantity = 1;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
|
|
||||||
Item gItem = Server.getItemGamedata(itemId);
|
Item gItem = Server.GetItemGamedata(itemId);
|
||||||
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
itemType = gItem.isExclusive ? (byte)0x3 : (byte)0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +72,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
this.materia5 = materia5;
|
this.materia5 = materia5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] toPacketBytes()
|
public byte[] ToPacketBytes()
|
||||||
{
|
{
|
||||||
byte[] data = new byte[0x70];
|
byte[] data = new byte[0x70];
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.dataobjects
|
namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
{
|
{
|
||||||
@ -382,7 +378,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getItemHQValue(float value1, float value2)
|
public Double GetItemHQValue(float value1, float value2)
|
||||||
{
|
{
|
||||||
return Math.Max(value1 + 1, Math.Ceiling(value1 * value2));
|
return Math.Max(value1 + 1, Math.Ceiling(value1 * value2));
|
||||||
}
|
}
|
||||||
@ -424,7 +420,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
public readonly int paramBonusType10;
|
public readonly int paramBonusType10;
|
||||||
public readonly short paramBonusValue10;
|
public readonly short paramBonusValue10;
|
||||||
|
|
||||||
public readonly short additionalEffect;
|
public readonly short AdditionalEffect;
|
||||||
public readonly bool materialBindPermission;
|
public readonly bool materialBindPermission;
|
||||||
public readonly short materializeTable;
|
public readonly short materializeTable;
|
||||||
|
|
||||||
@ -463,7 +459,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
paramBonusType10 = reader.GetInt32("paramBonusType10");
|
paramBonusType10 = reader.GetInt32("paramBonusType10");
|
||||||
paramBonusValue10 = reader.GetInt16("paramBonusValue10");
|
paramBonusValue10 = reader.GetInt16("paramBonusValue10");
|
||||||
|
|
||||||
additionalEffect = reader.GetInt16("additionalEffect");
|
AdditionalEffect = reader.GetInt16("additionalEffect");
|
||||||
materialBindPermission = reader.GetBoolean("materiaBindPermission");
|
materialBindPermission = reader.GetBoolean("materiaBindPermission");
|
||||||
materializeTable = reader.GetInt16("materializeTable");
|
materializeTable = reader.GetInt16("materializeTable");
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.dataobjects
|
|
||||||
{
|
{
|
||||||
class RecruitmentDetails
|
class RecruitmentDetails
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.dataobjects
|
namespace FFXIVClassic_Map_Server.dataobjects
|
||||||
{
|
{
|
||||||
@ -19,7 +16,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
public ushort[] classes = new ushort[2 * 20];
|
public ushort[] classes = new ushort[2 * 20];
|
||||||
public ushort[] jobs = new ushort[8];
|
public ushort[] jobs = new ushort[8];
|
||||||
|
|
||||||
public void writeSearchEntry(BinaryWriter writer)
|
public void WriteSearchEntry(BinaryWriter writer)
|
||||||
{
|
{
|
||||||
writer.Write((UInt16)preferredClass);
|
writer.Write((UInt16)preferredClass);
|
||||||
writer.Write((UInt16)langauges);
|
writer.Write((UInt16)langauges);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user