mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
mass replaced all methods to pascal case
This commit is contained in:
parent
ed0a0a58f7
commit
24f55139dd
@ -283,7 +283,7 @@ namespace FFXIVClassic.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)
|
||||||
@ -295,7 +295,7 @@ namespace FFXIVClassic.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);
|
||||||
@ -316,7 +316,7 @@ namespace FFXIVClassic.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);
|
||||||
@ -351,7 +351,7 @@ namespace FFXIVClassic.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;
|
||||||
@ -374,7 +374,7 @@ namespace FFXIVClassic.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;
|
||||||
@ -383,13 +383,13 @@ namespace FFXIVClassic.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;
|
||||||
@ -399,7 +399,7 @@ namespace FFXIVClassic.Common
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int initializeBlowfish(byte [] key)
|
private int InitializeBlowfish(byte [] key)
|
||||||
{
|
{
|
||||||
Int16 i;
|
Int16 i;
|
||||||
Int16 j;
|
Int16 j;
|
||||||
@ -433,7 +433,7 @@ namespace FFXIVClassic.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;
|
||||||
@ -443,7 +443,7 @@ namespace FFXIVClassic.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;
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,14 @@ namespace FFXIVClassic.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];
|
||||||
@ -53,7 +53,7 @@ namespace FFXIVClassic.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)
|
||||||
@ -64,7 +64,7 @@ namespace FFXIVClassic.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)
|
||||||
@ -104,14 +104,14 @@ namespace FFXIVClassic.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];
|
||||||
@ -132,7 +132,7 @@ namespace FFXIVClassic.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)
|
||||||
|
@ -198,7 +198,7 @@ namespace FFXIVClassic.Common
|
|||||||
// *** 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;
|
||||||
@ -379,7 +379,7 @@ namespace FFXIVClassic.Common
|
|||||||
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);
|
||||||
}
|
}
|
||||||
@ -473,7 +473,7 @@ namespace FFXIVClassic.Common
|
|||||||
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;
|
||||||
@ -518,7 +518,7 @@ namespace FFXIVClassic.Common
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ namespace FFXIVClassic.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) |
|
||||||
@ -119,7 +119,7 @@ namespace FFXIVClassic.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) |
|
||||||
@ -127,7 +127,7 @@ namespace FFXIVClassic.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;
|
||||||
|
|
||||||
|
@ -15,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
|
||||||
@ -31,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;
|
||||||
@ -39,20 +39,20 @@ 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 {
|
||||||
@ -63,12 +63,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
@ -16,7 +16,7 @@ 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 lobby_config.ini file... ");
|
Console.Write("Loading lobby_config.ini file... ");
|
||||||
|
|
||||||
|
@ -13,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)))
|
||||||
@ -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)))
|
||||||
@ -100,13 +100,13 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
conn.Dispose();
|
conn.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Program.Log.Debug("[SQL] 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)))
|
||||||
@ -245,7 +245,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
Program.Log.Debug("[SQL] 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)))
|
||||||
{
|
{
|
||||||
@ -267,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);
|
||||||
@ -292,7 +292,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)))
|
||||||
{
|
{
|
||||||
@ -323,7 +323,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
Program.Log.Debug("[SQL] 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)))
|
||||||
{
|
{
|
||||||
@ -345,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)))
|
||||||
{
|
{
|
||||||
@ -369,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)))
|
||||||
@ -384,7 +384,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
serverId,
|
serverId,
|
||||||
name,
|
name,
|
||||||
isLegacy,
|
isLegacy,
|
||||||
doRename,
|
DoRename,
|
||||||
currentZoneId,
|
currentZoneId,
|
||||||
guardian,
|
guardian,
|
||||||
birthMonth,
|
birthMonth,
|
||||||
@ -427,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)))
|
||||||
@ -441,7 +441,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
serverId,
|
serverId,
|
||||||
name,
|
name,
|
||||||
isLegacy,
|
isLegacy,
|
||||||
doRename,
|
DoRename,
|
||||||
currentZoneId,
|
currentZoneId,
|
||||||
guardian,
|
guardian,
|
||||||
birthMonth,
|
birthMonth,
|
||||||
@ -482,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)))
|
||||||
{
|
{
|
||||||
@ -506,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)))
|
||||||
{
|
{
|
||||||
@ -528,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)))
|
||||||
{
|
{
|
||||||
|
@ -14,25 +14,25 @@ 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)
|
||||||
{
|
{
|
||||||
@ -71,30 +71,30 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
|
|
||||||
//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;
|
||||||
|
|
||||||
Program.Log.Info("Got acknowledgment for secure session.");
|
Program.Log.Info("Got acknowledgment for secure session.");
|
||||||
Program.Log.Info("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);
|
||||||
|
|
||||||
Program.Log.Info("Invalid session, kicking...");
|
Program.Log.Info("Invalid session, kicking...");
|
||||||
return;
|
return;
|
||||||
@ -108,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)
|
||||||
{
|
{
|
||||||
Program.Log.Info("{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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,29 +128,29 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
SelectCharacterPacket selectCharRequest = new SelectCharacterPacket(packet.data);
|
SelectCharacterPacket selectCharRequest = new SelectCharacterPacket(packet.data);
|
||||||
|
|
||||||
Program.Log.Info("{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)
|
||||||
@ -169,23 +169,23 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
//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);
|
||||||
|
|
||||||
Program.Log.Info("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;
|
||||||
@ -197,15 +197,15 @@ 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);
|
||||||
|
|
||||||
Program.Log.Info("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;
|
||||||
@ -222,7 +222,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
Program.Log.Info("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);
|
||||||
@ -266,25 +266,25 @@ 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;
|
||||||
|
|
||||||
Program.Log.Info("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);
|
||||||
|
|
||||||
Program.Log.Info("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;
|
||||||
@ -293,7 +293,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
Program.Log.Info("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);
|
||||||
|
|
||||||
Program.Log.Info("User {0} => Character deleted \"{1}\"", client.currentUserId, name);
|
Program.Log.Info("User {0} => Character deleted \"{1}\"", client.currentUserId, name);
|
||||||
break;
|
break;
|
||||||
@ -304,58 +304,58 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
Program.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)
|
||||||
|
@ -21,7 +21,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
//Load Config
|
//Load Config
|
||||||
if (!ConfigConstants.load())
|
if (!ConfigConstants.Load())
|
||||||
startServer = false;
|
startServer = false;
|
||||||
|
|
||||||
Log = LogManager.GetCurrentClassLogger();
|
Log = LogManager.GetCurrentClassLogger();
|
||||||
@ -57,7 +57,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
if (startServer)
|
if (startServer)
|
||||||
{
|
{
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
server.startServer();
|
server.StartServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
Program.Log.Info("Press any key to continue...");
|
Program.Log.Info("Press any key to continue...");
|
||||||
|
@ -24,7 +24,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
private Thread cleanupThread;
|
private Thread cleanupThread;
|
||||||
private bool killCleanupThread = false;
|
private bool killCleanupThread = false;
|
||||||
|
|
||||||
private void socketCleanup()
|
private void SocketCleanup()
|
||||||
{
|
{
|
||||||
Program.Log.Info("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)
|
||||||
@ -47,7 +47,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
#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";
|
||||||
@ -60,7 +60,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
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -89,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
|
||||||
@ -103,9 +103,9 @@ 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);
|
||||||
Program.Log.Info("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)
|
||||||
@ -118,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)
|
||||||
{
|
{
|
||||||
@ -130,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;
|
||||||
|
|
||||||
@ -151,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
|
||||||
@ -169,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
|
||||||
{
|
{
|
||||||
Program.Log.Info("{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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||||||
{
|
{
|
||||||
if (conn.socket != null)
|
if (conn.socket != null)
|
||||||
{
|
{
|
||||||
Program.Log.Info("{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)
|
||||||
{
|
{
|
||||||
@ -209,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;
|
||||||
|
|
||||||
|
@ -56,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('_', '/'));
|
||||||
|
|
||||||
@ -116,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;
|
||||||
|
|
||||||
@ -146,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);
|
||||||
@ -223,7 +223,7 @@ 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");
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ namespace FFXIVClassic_Lobby_Server.dataobjects
|
|||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -103,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);
|
||||||
|
|
||||||
@ -115,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)
|
||||||
@ -129,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];
|
||||||
@ -141,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))
|
||||||
{
|
{
|
||||||
@ -173,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))
|
||||||
{
|
{
|
||||||
@ -196,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();
|
||||||
@ -218,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;
|
||||||
}
|
}
|
||||||
@ -229,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();
|
||||||
@ -247,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);
|
||||||
@ -256,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);
|
||||||
@ -277,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;
|
||||||
@ -304,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;
|
||||||
@ -331,16 +331,16 @@ 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;
|
||||||
|
|
||||||
Program.Log.Debug("IsAuth: {0} Size: 0x{1:X}, NumSubpackets: {2}{3}{4}", header.isAuthenticated, header.packetSize, header.numSubpackets, Environment.NewLine, 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())
|
foreach (SubPacket sub in GetSubpackets())
|
||||||
{
|
{
|
||||||
sub.debugPrintSubPacket();
|
sub.DebugPrintSubPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.BackgroundColor = ConsoleColor.Black;
|
Console.BackgroundColor = ConsoleColor.Black;
|
||||||
|
@ -101,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];
|
||||||
@ -113,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];
|
||||||
@ -125,26 +125,26 @@ 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
|
||||||
Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes()));
|
Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||||
|
|
||||||
if (header.type == 0x03)
|
if (header.type == 0x03)
|
||||||
{
|
{
|
||||||
Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(getGameMessageBytes(), SUBPACKET_SIZE));
|
Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(GetGameMessageBytes(), SUBPACKET_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
Program.Log.Debug("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE));
|
Program.Log.Debug("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE));
|
||||||
|
@ -20,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>();
|
||||||
|
|
||||||
|
@ -36,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);
|
||||||
|
@ -20,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>();
|
||||||
|
|
||||||
@ -34,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)
|
||||||
{
|
{
|
||||||
@ -53,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); //???
|
||||||
@ -74,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++;
|
||||||
|
@ -23,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);
|
||||||
|
@ -19,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>();
|
||||||
|
|
||||||
|
@ -19,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>();
|
||||||
|
|
||||||
|
@ -26,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>();
|
||||||
|
|
||||||
|
@ -20,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>();
|
||||||
|
|
||||||
|
@ -13,33 +13,33 @@ namespace FFXIVClassic_Map_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
|
||||||
{
|
{
|
||||||
@ -50,17 +50,17 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
@ -26,45 +26,45 @@ namespace FFXIVClassic_Map_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;
|
||||||
|
|
||||||
@ -74,13 +74,13 @@ namespace FFXIVClassic_Map_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,228 +90,228 @@ namespace FFXIVClassic_Map_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));
|
||||||
Program.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();
|
||||||
Program.Log.Info("{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("{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;
|
||||||
@ -331,7 +331,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
catch{return;}
|
catch{return;}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
doWarp(client, zoneId);
|
DoWarp(client, zoneId);
|
||||||
}
|
}
|
||||||
else if (split.Length == 4)
|
else if (split.Length == 4)
|
||||||
{
|
{
|
||||||
@ -343,7 +343,7 @@ namespace FFXIVClassic_Map_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();
|
||||||
@ -355,7 +355,7 @@ namespace FFXIVClassic_Map_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();
|
||||||
@ -367,7 +367,7 @@ namespace FFXIVClassic_Map_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();
|
||||||
@ -381,12 +381,12 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -411,8 +411,8 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -439,20 +439,20 @@ namespace FFXIVClassic_Map_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
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doWeather(ConnectedPlayer client, string weatherID, string value)
|
private void DoWeather(ConnectedPlayer client, string weatherID, string value)
|
||||||
{
|
{
|
||||||
ushort weather = Convert.ToUInt16(weatherID);
|
ushort weather = Convert.ToUInt16(weatherID);
|
||||||
|
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -461,15 +461,15 @@ namespace FFXIVClassic_Map_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,13 +482,13 @@ namespace FFXIVClassic_Map_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("!"))
|
||||||
@ -499,7 +499,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -508,41 +508,41 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -550,7 +550,7 @@ namespace FFXIVClassic_Map_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -573,12 +573,12 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doWeather(client, split[2], split[3]);
|
DoWeather(client, split[2], split[3]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Program.Log.Error("Could not change weather: " + e);
|
Program.Log.Error("Could not Change weather: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -592,7 +592,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
printPos(client);
|
PrintPos(client);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -607,13 +607,13 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
Program.Log.Info("Got request to reset zone: {0}", client.getActor().zoneId);
|
Program.Log.Info("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
|
||||||
@ -622,11 +622,11 @@ namespace FFXIVClassic_Map_Server
|
|||||||
else if (split[0].Equals("reloaditems"))
|
else if (split[0].Equals("reloaditems"))
|
||||||
{
|
{
|
||||||
Program.Log.Info("Got request to reload item gamedata");
|
Program.Log.Info("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();
|
||||||
Program.Log.Info("Loaded {0} items.", gamedataItems.Count);
|
Program.Log.Info("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
|
||||||
@ -639,7 +639,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
sendPacket(client, "./packets/" + split[1]);
|
SendPacket(client, "./packets/" + split[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@ -655,7 +655,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -671,11 +671,11 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -694,11 +694,11 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -714,7 +714,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -732,7 +732,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -748,9 +748,9 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -768,9 +768,9 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -788,12 +788,12 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doMusic(client, split[1]);
|
DoMusic(client, split[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Program.Log.Error("Could not change music: " + e);
|
Program.Log.Error("Could not Change music: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -801,7 +801,7 @@ namespace FFXIVClassic_Map_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
|
||||||
@ -811,7 +811,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
}
|
}
|
||||||
@ -822,7 +822,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_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 map_config.ini file... ");
|
Console.Write("Loading map_config.ini file... ");
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ 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)))
|
||||||
@ -47,7 +47,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -149,7 +149,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerAppearance(Player player)
|
public static void SavePlayerAppearance(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -205,7 +205,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerCurrentClass(Player player)
|
public static void SavePlayerCurrentClass(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -241,7 +241,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerPosition(Player player)
|
public static void SavePlayerPosition(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -283,7 +283,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void savePlayerPlayTime(Player player)
|
public static void SavePlayerPlayTime(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -302,7 +302,7 @@ namespace FFXIVClassic_Map_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();
|
||||||
}
|
}
|
||||||
@ -317,19 +317,19 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
Program.Log.Error("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;
|
||||||
@ -369,7 +369,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void loadPlayerCharacter(Player player)
|
public static void LoadPlayerCharacter(Player player)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -560,12 +560,12 @@ namespace FFXIVClassic_Map_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);
|
||||||
@ -712,7 +712,7 @@ namespace FFXIVClassic_Map_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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -779,14 +779,14 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -800,9 +800,9 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -827,7 +827,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -845,7 +845,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
@ -882,7 +882,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
@ -915,7 +915,7 @@ namespace FFXIVClassic_Map_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>();
|
||||||
|
|
||||||
@ -987,7 +987,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
{
|
{
|
||||||
@ -1043,7 +1043,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -1077,7 +1077,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -1117,7 +1117,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
{
|
{
|
||||||
@ -1158,7 +1158,7 @@ namespace FFXIVClassic_Map_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)))
|
||||||
@ -1196,10 +1196,10 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
@ -1242,7 +1242,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cheevosPacket.buildPacket(player.actorId);
|
return cheevosPacket.BuildPacket(player.actorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,17 +36,17 @@ namespace FFXIVClassic_Map_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,
|
||||||
@ -117,35 +117,35 @@ namespace FFXIVClassic_Map_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)
|
||||||
Program.Log.Debug("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)
|
||||||
Program.Log.Debug("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)
|
||||||
{
|
{
|
||||||
@ -162,18 +162,18 @@ namespace FFXIVClassic_Map_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;
|
||||||
@ -181,15 +181,15 @@ namespace FFXIVClassic_Map_Server
|
|||||||
case 0x0003:
|
case 0x0003:
|
||||||
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
|
ChatMessagePacket chatMessage = new ChatMessagePacket(subpacket.data);
|
||||||
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);
|
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
|
||||||
@ -199,37 +199,37 @@ namespace FFXIVClassic_Map_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);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -245,83 +245,83 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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
|
||||||
{
|
{
|
||||||
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));
|
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);
|
||||||
|
|
||||||
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));
|
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);
|
||||||
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));
|
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:
|
||||||
@ -335,84 +335,84 @@ namespace FFXIVClassic_Map_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);
|
||||||
Program.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:
|
||||||
Program.Log.Debug("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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ namespace FFXIVClassic_Map_Server
|
|||||||
bool startServer = true;
|
bool startServer = true;
|
||||||
|
|
||||||
//Load Config
|
//Load Config
|
||||||
if (!ConfigConstants.load())
|
if (!ConfigConstants.Load())
|
||||||
startServer = false;
|
startServer = false;
|
||||||
|
|
||||||
// set up logging
|
// set up logging
|
||||||
|
|
||||||
Log = LogManager.GetCurrentClassLogger();
|
Log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
Program.Log.Info("---------FFXIV 1.0 Map Server---------");
|
||||||
@ -58,7 +58,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
//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)
|
||||||
Program.Log.Info("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
|
||||||
@ -68,14 +68,14 @@ namespace FFXIVClassic_Map_Server
|
|||||||
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 (startServer)
|
while (startServer)
|
||||||
{
|
{
|
||||||
String input = Console.ReadLine();
|
String input = Console.ReadLine();
|
||||||
Log.Info("[Console Input] " + input);
|
Log.Info("[Console Input] " + input);
|
||||||
cp.doCommand(input, null);
|
cp.DoCommand(input, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
@ -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>
|
||||||
|
@ -38,7 +38,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
private Thread mConnectionHealthThread;
|
private Thread mConnectionHealthThread;
|
||||||
private bool killHealthThread = false;
|
private bool killHealthThread = false;
|
||||||
|
|
||||||
private void connectionHealth()
|
private void ConnectionHealth()
|
||||||
{
|
{
|
||||||
Program.Log.Info("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)
|
||||||
@ -48,12 +48,12 @@ namespace FFXIVClassic_Map_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);
|
||||||
}
|
}
|
||||||
@ -64,20 +64,20 @@ namespace FFXIVClassic_Map_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();
|
||||||
Program.Log.Info("Loaded {0} items.", gamedataItems.Count);
|
Program.Log.Info("Loaded {0} items.", gamedataItems.Count);
|
||||||
|
|
||||||
mWorldManager = new WorldManager(this);
|
mWorldManager = new WorldManager(this);
|
||||||
@ -93,7 +93,7 @@ namespace FFXIVClassic_Map_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
|
||||||
{
|
{
|
||||||
@ -106,7 +106,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -124,7 +124,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(Player player)
|
public void RemovePlayer(Player player)
|
||||||
{
|
{
|
||||||
lock (mConnectedPlayerList)
|
lock (mConnectedPlayerList)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
@ -153,9 +153,9 @@ namespace FFXIVClassic_Map_Server
|
|||||||
|
|
||||||
Program.Log.Info("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)
|
||||||
{
|
{
|
||||||
@ -167,7 +167,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mServerSocket.BeginAccept(new AsyncCallback(acceptCallback), mServerSocket);
|
mServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), mServerSocket);
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@ -178,21 +178,21 @@ namespace FFXIVClassic_Map_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];
|
||||||
@ -204,7 +204,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
mConnectionList.Remove(conn);
|
mConnectionList.Remove(conn);
|
||||||
}
|
}
|
||||||
if (conn.connType == BasePacket.TYPE_ZONE)
|
if (conn.connType == BasePacket.TYPE_ZONE)
|
||||||
Program.Log.Info("{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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,13 +235,13 @@ namespace FFXIVClassic_Map_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
|
||||||
@ -251,18 +251,18 @@ namespace FFXIVClassic_Map_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
|
||||||
{
|
{
|
||||||
Program.Log.Info("{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)
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
if (conn.socket != null)
|
if (conn.socket != null)
|
||||||
{
|
{
|
||||||
Program.Log.Info("{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)
|
||||||
{
|
{
|
||||||
@ -290,7 +290,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
return mWorldManager;
|
return mWorldManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<uint, ConnectedPlayer> getConnectedPlayerList()
|
public Dictionary<uint, ConnectedPlayer> GetConnectedPlayerList()
|
||||||
{
|
{
|
||||||
return mConnectedPlayerList;
|
return mConnectedPlayerList;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,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"), reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
|
PrivateArea privArea = new PrivateArea(parent, reader.GetUInt32("id"), reader.GetString("className"), reader.GetString("privateAreaName"), reader.GetUInt16("dayMusic"), reader.GetUInt16("nightMusic"), reader.GetUInt16("battleMusic"));
|
||||||
parent.addPrivateArea(privArea);
|
parent.AddPrivateArea(privArea);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
@ -224,7 +224,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (!reader.IsDBNull(12))
|
if (!reader.IsDBNull(12))
|
||||||
{
|
{
|
||||||
string eventConditions = reader.GetString(12);
|
string eventConditions = reader.GetString(12);
|
||||||
npc.loadEventConditions(eventConditions);
|
npc.LoadEventConditions(eventConditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zoneList.ContainsKey(npc.zoneId))
|
if (!zoneList.ContainsKey(npc.zoneId))
|
||||||
@ -233,7 +233,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
continue;
|
continue;
|
||||||
npc.zone = zone;
|
npc.zone = zone;
|
||||||
zone.addActorToZone(npc);
|
zone.AddActorToZone(npc);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (!reader.IsDBNull(12))
|
if (!reader.IsDBNull(12))
|
||||||
{
|
{
|
||||||
string eventConditions = reader.GetString(12);
|
string eventConditions = reader.GetString(12);
|
||||||
npc.loadEventConditions(eventConditions);
|
npc.LoadEventConditions(eventConditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!zoneList.ContainsKey(npc.zoneId))
|
if (!zoneList.ContainsKey(npc.zoneId))
|
||||||
@ -306,7 +306,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
if (zone == null)
|
if (zone == null)
|
||||||
continue;
|
continue;
|
||||||
npc.zone = zone;
|
npc.zone = zone;
|
||||||
zone.addActorToZone(npc);
|
zone.AddActorToZone(npc);
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -326,7 +326,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
Program.Log.Info("Loaded {0} npc(s).", count);
|
Program.Log.Info("Loaded {0} npc(s).", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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.
|
||||||
public void DoSeamlessZoneChange(Player player, uint destinationZoneId)
|
public void DoSeamlessZoneChange(Player player, uint destinationZoneId)
|
||||||
{
|
{
|
||||||
Area oldZone;
|
Area oldZone;
|
||||||
@ -334,19 +334,19 @@ 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
|
||||||
Zone newZone = GetZone(destinationZoneId);
|
Zone newZone = GetZone(destinationZoneId);
|
||||||
|
|
||||||
//This server does not contain that zoneId
|
//This server Does not contain that zoneId
|
||||||
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
|
||||||
@ -371,7 +371,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
|
||||||
@ -380,12 +380,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;
|
||||||
@ -396,13 +396,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
|
||||||
@ -428,8 +428,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;
|
||||||
@ -438,9 +438,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();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -451,31 +451,31 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//Add player to new zone and update
|
//Add player to new zone and update
|
||||||
Zone zone = GetZone(player.zoneId);
|
Zone zone = GetZone(player.zoneId);
|
||||||
|
|
||||||
//This server does not contain that zoneId
|
//This server Does not contain that zoneId
|
||||||
if (zone == null)
|
if (zone == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//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)
|
||||||
{
|
{
|
||||||
if (!zoneList.ContainsKey(zoneId))
|
if (!zoneList.ContainsKey(zoneId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Zone zone = zoneList[zoneId];
|
Zone zone = zoneList[zoneId];
|
||||||
//zone.clear();
|
//zone.Clear();
|
||||||
LoadNPCs(zone.actorId);
|
LoadNPCs(zone.actorId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -552,7 +552,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];
|
||||||
|
@ -52,66 +52,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>();
|
||||||
|
|
||||||
@ -122,126 +122,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)
|
||||||
@ -253,50 +253,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,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)
|
||||||
@ -50,7 +50,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool loadStaticActors(byte[] data)
|
private bool LoadStaticActors(byte[] data)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -61,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;
|
||||||
@ -96,12 +96,12 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
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)
|
||||||
{
|
{
|
||||||
@ -112,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];
|
||||||
|
@ -65,29 +65,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);
|
||||||
@ -112,7 +112,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);
|
||||||
|
|
||||||
@ -136,7 +136,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;
|
||||||
@ -181,7 +181,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;
|
||||||
|
|
||||||
@ -224,7 +224,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;
|
||||||
|
|
||||||
@ -296,7 +296,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();
|
||||||
@ -309,12 +309,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)
|
||||||
@ -324,7 +324,7 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,17 +18,17 @@ namespace FFXIVClassic_Map_Server.actors.area
|
|||||||
this.privateAreaName = privateAreaName;
|
this.privateAreaName = privateAreaName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string getPrivateAreaName()
|
public string GetPrivateAreaName()
|
||||||
{
|
{
|
||||||
return privateAreaName;
|
return privateAreaName;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -37,9 +37,9 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,18 +16,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))
|
||||||
{
|
{
|
||||||
@ -41,13 +41,13 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -55,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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
this.zoneId = zoneId;
|
this.zoneId = zoneId;
|
||||||
|
|
||||||
loadNpcTemplate(id);
|
LoadNpcTemplate(id);
|
||||||
|
|
||||||
charaWork.battleSave.potencial = 1.0f;
|
charaWork.battleSave.potencial = 1.0f;
|
||||||
|
|
||||||
@ -58,47 +58,47 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
charaWork.property[4] = 1;
|
charaWork.property[4] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket createAddActorPacket(uint playerActorId)
|
public SubPacket CreateAddActorPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
return AddActorPacket.buildPacket(actorId, playerActorId, 8);
|
return AddActorPacket.BuildPacket(actorId, playerActorId, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SubPacket createScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams;
|
List<LuaParam> lParams;
|
||||||
|
|
||||||
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
|
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
|
||||||
lParams = LuaEngine.doActorInstantiate(player, this);
|
lParams = LuaEngine.DoActorInstantiate(player, this);
|
||||||
|
|
||||||
if (lParams == null)
|
if (lParams == null)
|
||||||
{
|
{
|
||||||
className = "PopulaceStandard";
|
className = "PopulaceStandard";
|
||||||
lParams = LuaUtils.createLuaParamList("/Chara/Npc/Populace/PopulaceStandard", false, false, false, false, false, 0xF47F6, false, false, 0, 1, "TEST");
|
lParams = LuaUtils.CreateLuaParamList("/Chara/Npc/Populace/PopulaceStandard", false, false, false, false, false, 0xF47F6, false, false, 0, 1, "TEST");
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@ -106,52 +106,52 @@ 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");
|
||||||
|
|
||||||
return BasePacket.createPacket(propPacketUtil.done(), true, false);
|
return BasePacket.CreatePacket(propPacketUtil.Done(), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint getActorClassId()
|
public uint GetActorClassId()
|
||||||
{
|
{
|
||||||
return actorClassId;
|
return actorClassId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadNpcTemplate(uint id)
|
public void LoadNpcTemplate(uint id)
|
||||||
{
|
{
|
||||||
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)))
|
||||||
{
|
{
|
||||||
@ -216,7 +216,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);
|
||||||
@ -247,7 +247,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadEventConditions(string eventConditions)
|
public void LoadEventConditions(string eventConditions)
|
||||||
{
|
{
|
||||||
EventList conditions = JsonConvert.DeserializeObject<EventList>(eventConditions);
|
EventList conditions = JsonConvert.DeserializeObject<EventList>(eventConditions);
|
||||||
this.eventConditions = conditions;
|
this.eventConditions = conditions;
|
||||||
|
@ -64,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)
|
||||||
@ -107,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)
|
||||||
@ -134,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;
|
||||||
@ -148,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;
|
||||||
}
|
}
|
||||||
@ -177,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;
|
||||||
}
|
}
|
||||||
@ -195,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)
|
||||||
@ -208,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
|
||||||
|
@ -33,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];
|
||||||
@ -46,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)
|
||||||
{
|
{
|
||||||
@ -58,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>();
|
||||||
|
|
||||||
@ -121,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;
|
||||||
@ -220,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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,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;
|
||||||
@ -274,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
|
||||||
@ -380,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
|
||||||
@ -405,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
|
||||||
@ -439,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);
|
||||||
@ -459,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;
|
||||||
|
|
||||||
@ -483,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
@ -18,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SaveData()
|
public void SaveData()
|
||||||
{
|
{
|
||||||
Database.saveQuest(owner, this);
|
Database.SaveQuest(owner, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,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)
|
||||||
@ -43,55 +43,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;
|
||||||
@ -104,11 +104,11 @@ 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>();
|
||||||
@ -119,7 +119,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,18 +134,18 @@ 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)
|
||||||
{
|
{
|
||||||
LuaEngine.doActorOnSpawn(getActor(), (Npc)actor);
|
LuaEngine.DoActorOnSpawn(GetActor(), (Npc)actor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,7 +153,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void clearInstance()
|
public void ClearInstance()
|
||||||
{
|
{
|
||||||
actorInstanceList.Clear();
|
actorInstanceList.Clear();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
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;
|
||||||
|
@ -30,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,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];
|
||||||
|
|
||||||
|
@ -378,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));
|
||||||
}
|
}
|
||||||
@ -420,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;
|
||||||
|
|
||||||
@ -459,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");
|
||||||
}
|
}
|
||||||
|
@ -16,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);
|
||||||
|
@ -28,13 +28,13 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
|
UserData.RegistrationPolicy = InteropRegistrationPolicy.Automatic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<LuaParam> doActorInstantiate(Player player, Actor target)
|
public static List<LuaParam> DoActorInstantiate(Player player, Actor target)
|
||||||
{
|
{
|
||||||
string luaPath;
|
string luaPath;
|
||||||
|
|
||||||
if (target is Npc)
|
if (target is Npc)
|
||||||
{
|
{
|
||||||
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());
|
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName());
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
Script script = loadScript(luaPath);
|
Script script = loadScript(luaPath);
|
||||||
@ -43,12 +43,12 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
DynValue result = script.Call(script.Globals["init"], target);
|
DynValue result = script.Call(script.Globals["init"], target);
|
||||||
List<LuaParam> lparams = LuaUtils.createLuaParamList(result);
|
List<LuaParam> lparams = LuaUtils.CreateLuaParamList(result);
|
||||||
return lparams;
|
return lparams;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.getName()));
|
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,20 +56,20 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart)
|
public static void DoActorOnEventStarted(Player player, Actor target, EventStartPacket eventStart)
|
||||||
{
|
{
|
||||||
string luaPath;
|
string luaPath;
|
||||||
|
|
||||||
if (target is Command)
|
if (target is Command)
|
||||||
{
|
{
|
||||||
luaPath = String.Format(FILEPATH_COMMANDS, target.getName());
|
luaPath = String.Format(FILEPATH_COMMANDS, target.GetName());
|
||||||
}
|
}
|
||||||
else if (target is Director)
|
else if (target is Director)
|
||||||
{
|
{
|
||||||
luaPath = String.Format(FILEPATH_DIRECTORS, target.getName());
|
luaPath = String.Format(FILEPATH_DIRECTORS, target.GetName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());
|
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName());
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
@ -78,14 +78,14 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
if (script == null)
|
if (script == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Have to do this to combine LuaParams
|
//Have to Do this to combine LuaParams
|
||||||
List<Object> objects = new List<Object>();
|
List<Object> objects = new List<Object>();
|
||||||
objects.Add(player);
|
objects.Add(player);
|
||||||
objects.Add(target);
|
objects.Add(target);
|
||||||
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
|
||||||
if (!script.Globals.Get("onEventStarted").IsNil())
|
if (!script.Globals.Get("onEventStarted").IsNil())
|
||||||
@ -93,14 +93,14 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.getName()));
|
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doActorOnSpawn(Player player, Npc target)
|
public static void DoActorOnSpawn(Player player, Npc target)
|
||||||
{
|
{
|
||||||
string luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());
|
string luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName());
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
@ -115,21 +115,21 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.getName()));
|
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void doActorOnEventUpdated(Player player, Actor target, EventUpdatePacket eventUpdate)
|
public static void DoActorOnEventUpdated(Player player, Actor target, EventUpdatePacket eventUpdate)
|
||||||
{
|
{
|
||||||
string luaPath;
|
string luaPath;
|
||||||
|
|
||||||
if (target is Command)
|
if (target is Command)
|
||||||
luaPath = String.Format(FILEPATH_COMMANDS, target.getName());
|
luaPath = String.Format(FILEPATH_COMMANDS, target.GetName());
|
||||||
else if (target is Director)
|
else if (target is Director)
|
||||||
luaPath = String.Format(FILEPATH_DIRECTORS, target.getName());
|
luaPath = String.Format(FILEPATH_DIRECTORS, target.GetName());
|
||||||
else
|
else
|
||||||
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.getName());
|
luaPath = String.Format(FILEPATH_NPCS, target.zoneId, target.GetName());
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
@ -138,12 +138,12 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
if (script == null)
|
if (script == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Have to do this to combine LuaParams
|
//Have to Do this to combine LuaParams
|
||||||
List<Object> objects = new List<Object>();
|
List<Object> objects = new List<Object>();
|
||||||
objects.Add(player);
|
objects.Add(player);
|
||||||
objects.Add(target);
|
objects.Add(target);
|
||||||
objects.Add(eventUpdate.val2);
|
objects.Add(eventUpdate.val2);
|
||||||
objects.AddRange(LuaUtils.createLuaParamObjectList(eventUpdate.luaParams));
|
objects.AddRange(LuaUtils.CreateLuaParamObjectList(eventUpdate.luaParams));
|
||||||
|
|
||||||
//Run Script
|
//Run Script
|
||||||
if (!script.Globals.Get("onEventUpdate").IsNil())
|
if (!script.Globals.Get("onEventUpdate").IsNil())
|
||||||
@ -151,13 +151,13 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.getName()));
|
SendError(player, String.Format("ERROR: Could not find script for actor {0}.", target.GetName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onZoneIn(Player player)
|
public static void OnZoneIn(Player player)
|
||||||
{
|
{
|
||||||
string luaPath = String.Format(FILEPATH_ZONE, player.getZone().actorId);
|
string luaPath = String.Format(FILEPATH_ZONE, player.GetZone().actorId);
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onBeginLogin(Player player)
|
public static void OnBeginLogin(Player player)
|
||||||
{
|
{
|
||||||
if (File.Exists(FILEPATH_PLAYER))
|
if (File.Exists(FILEPATH_PLAYER))
|
||||||
{
|
{
|
||||||
@ -187,7 +187,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onLogin(Player player)
|
public static void OnLogin(Player player)
|
||||||
{
|
{
|
||||||
if (File.Exists(FILEPATH_PLAYER))
|
if (File.Exists(FILEPATH_PLAYER))
|
||||||
{
|
{
|
||||||
@ -207,9 +207,9 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
Script script = new Script();
|
Script script = new Script();
|
||||||
((FileSystemScriptLoader)script.Options.ScriptLoader).ModulePaths = FileSystemScriptLoader.UnpackStringPaths("./scripts/?;./scripts/?.lua");
|
((FileSystemScriptLoader)script.Options.ScriptLoader).ModulePaths = FileSystemScriptLoader.UnpackStringPaths("./scripts/?;./scripts/?.lua");
|
||||||
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
|
script.Globals["getWorldManager"] = (Func<WorldManager>)Server.GetWorldManager;
|
||||||
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.getStaticActors;
|
script.Globals["getStaticActor"] = (Func<string, Actor>)Server.GetStaticActors;
|
||||||
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
script.Globals["getWorldMaster"] = (Func<Actor>)Server.GetWorldManager().GetActor;
|
||||||
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.getItemGamedata;
|
script.Globals["getItemGamedata"] = (Func<uint, Item>)Server.GetItemGamedata;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -225,16 +225,16 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
|
|
||||||
private static void SendError(Player player, string message)
|
private static void SendError(Player player, string message)
|
||||||
{
|
{
|
||||||
List<SubPacket> sendError = new List<SubPacket>();
|
List<SubPacket> SendError = new List<SubPacket>();
|
||||||
sendError.Add(EndEventPacket.buildPacket(player.actorId, player.currentEventOwner, player.currentEventName));
|
SendError.Add(EndEventPacket.BuildPacket(player.actorId, player.currentEventOwner, player.currentEventName));
|
||||||
player.sendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "", message);
|
player.SendMessage(SendMessagePacket.MESSAGE_TYPE_SYSTEM_ERROR, "", message);
|
||||||
player.playerSession.queuePacket(BasePacket.createPacket(sendError, true, false));
|
player.playerSession.QueuePacket(BasePacket.CreatePacket(SendError, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal static void doDirectorOnTalked(Director director, Player player, Npc npc)
|
internal static void DoDirectorOnTalked(Director director, Player player, Npc npc)
|
||||||
{
|
{
|
||||||
string luaPath = String.Format(FILEPATH_DIRECTORS, director.getName());
|
string luaPath = String.Format(FILEPATH_DIRECTORS, director.GetName());
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
@ -249,13 +249,13 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendError(player, String.Format("ERROR: Could not find script for director {0}.", director.getName()));
|
SendError(player, String.Format("ERROR: Could not find script for director {0}.", director.GetName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void doDirectorOnCommand(Director director, Player player, Command command)
|
internal static void DoDirectorOnCommand(Director director, Player player, Command command)
|
||||||
{
|
{
|
||||||
string luaPath = String.Format(FILEPATH_DIRECTORS, director.getName());
|
string luaPath = String.Format(FILEPATH_DIRECTORS, director.GetName());
|
||||||
|
|
||||||
if (File.Exists(luaPath))
|
if (File.Exists(luaPath))
|
||||||
{
|
{
|
||||||
@ -270,7 +270,7 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendError(player, String.Format("ERROR: Could not find script for director {0}.", director.getName()));
|
SendError(player, String.Format("ERROR: Could not find script for director {0}.", director.GetName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
{
|
{
|
||||||
class LuaEvent
|
class LuaEvent
|
||||||
{
|
{
|
||||||
public static void getStep()
|
public static void GetStep()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getParam()
|
public static void GetParam()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,55 +15,55 @@ namespace FFXIVClassic_Map_Server.lua
|
|||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMusic(ushort musicID, ushort playMode)
|
public void SetMusic(ushort musicID, ushort playMode)
|
||||||
{
|
{
|
||||||
player.playerSession.queuePacket(SetMusicPacket.buildPacket(player.actorId, musicID, playMode), true, false);
|
player.playerSession.QueuePacket(SetMusicPacket.BuildPacket(player.actorId, musicID, playMode), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeather(ushort weatherID)
|
public void SetWeather(ushort weatherID)
|
||||||
{
|
{
|
||||||
player.playerSession.queuePacket(SetWeatherPacket.buildPacket(player.actorId, weatherID, 1), true, false);
|
player.playerSession.QueuePacket(SetWeatherPacket.BuildPacket(player.actorId, weatherID, 1), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getParameter(string paramName)
|
public void GetParameter(string paramName)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParameter(string paramName, object value, string uiToRefresh)
|
public void SetParameter(string paramName, object value, string uiToRefresh)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAttributePoints()
|
public void GetAttributePoints()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttributePoints(int str, int vit, int dex, int inte, int min, int pie)
|
public void SetAttributePoints(int str, int vit, int dex, int inte, int min, int pie)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logout()
|
public void Logout()
|
||||||
{
|
{
|
||||||
player.playerSession.queuePacket(LogoutPacket.buildPacket(player.actorId), true, false);
|
player.playerSession.QueuePacket(LogoutPacket.BuildPacket(player.actorId), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void quitGame()
|
public void QuitGame()
|
||||||
{
|
{
|
||||||
player.playerSession.queuePacket(QuitPacket.buildPacket(player.actorId), true, false);
|
player.playerSession.QueuePacket(QuitPacket.BuildPacket(player.actorId), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runEvent(string functionName, params object[] parameters)
|
public void RunEvent(string functionName, params object[] parameters)
|
||||||
{
|
{
|
||||||
List<LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
|
List<LuaParam> lParams = LuaUtils.CreateLuaParamList(parameters);
|
||||||
// player.playerSession.queuePacket(RunEventFunctionPacket.buildPacket(player.actorId, player.eventCurrentOwner, player.eventCurrentStarter, functionName, lParams), true, false);
|
// player.playerSession.QueuePacket(RunEventFunctionPacket.BuildPacket(player.actorId, player.eventCurrentOwner, player.eventCurrentStarter, functionName, lParams), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void endEvent()
|
public void EndEvent()
|
||||||
{
|
{
|
||||||
// player.playerSession.queuePacket(EndEventPacket.buildPacket(player.actorId, player.eventCurrentOwner, player.eventCurrentStarter), true, false);
|
// player.playerSession.QueuePacket(EndEventPacket.BuildPacket(player.actorId, player.eventCurrentOwner, player.eventCurrentStarter), true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<LuaParam> readLuaParams(BinaryReader reader)
|
public static List<LuaParam> ReadLuaParams(BinaryReader reader)
|
||||||
{
|
{
|
||||||
List<LuaParam> luaParams = new List<LuaParam>();
|
List<LuaParam> luaParams = new List<LuaParam>();
|
||||||
|
|
||||||
@ -54,10 +54,10 @@ namespace FFXIVClassic_Map_Server
|
|||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 0x0: //Int32
|
case 0x0: //Int32
|
||||||
value = Utils.swapEndian(reader.ReadInt32());
|
value = Utils.SwapEndian(reader.ReadInt32());
|
||||||
break;
|
break;
|
||||||
case 0x1: //Int32
|
case 0x1: //Int32
|
||||||
value = Utils.swapEndian(reader.ReadUInt32());
|
value = Utils.SwapEndian(reader.ReadUInt32());
|
||||||
break;
|
break;
|
||||||
case 0x2: //Null Termed String
|
case 0x2: //Null Termed String
|
||||||
List<byte> list = new List<byte>();
|
List<byte> list = new List<byte>();
|
||||||
@ -79,17 +79,17 @@ namespace FFXIVClassic_Map_Server
|
|||||||
wasNil = true;
|
wasNil = true;
|
||||||
break;
|
break;
|
||||||
case 0x6: //Actor (By Id)
|
case 0x6: //Actor (By Id)
|
||||||
value = Utils.swapEndian(reader.ReadUInt32());
|
value = Utils.SwapEndian(reader.ReadUInt32());
|
||||||
break;
|
break;
|
||||||
case 0x7: //Weird one used for inventory
|
case 0x7: //Weird one used for inventory
|
||||||
uint type7ActorId = Utils.swapEndian(reader.ReadUInt32());
|
uint type7ActorId = Utils.SwapEndian(reader.ReadUInt32());
|
||||||
byte type7Unknown = reader.ReadByte();
|
byte type7Unknown = reader.ReadByte();
|
||||||
byte type7Slot = reader.ReadByte();
|
byte type7Slot = reader.ReadByte();
|
||||||
byte type7InventoryType = reader.ReadByte();
|
byte type7InventoryType = reader.ReadByte();
|
||||||
value = new Type7Param(type7ActorId, type7Unknown, type7Slot, type7InventoryType);
|
value = new Type7Param(type7ActorId, type7Unknown, type7Slot, type7InventoryType);
|
||||||
break;
|
break;
|
||||||
case 0x9: //Two Longs (only storing first one)
|
case 0x9: //Two Longs (only storing first one)
|
||||||
value = new Type9Param(Utils.swapEndian(reader.ReadUInt64()), Utils.swapEndian(reader.ReadUInt64()));
|
value = new Type9Param(Utils.SwapEndian(reader.ReadUInt64()), Utils.SwapEndian(reader.ReadUInt64()));
|
||||||
break;
|
break;
|
||||||
case 0xC: //Byte
|
case 0xC: //Byte
|
||||||
value = reader.ReadByte();
|
value = reader.ReadByte();
|
||||||
@ -114,7 +114,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
return luaParams;
|
return luaParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void writeLuaParams(BinaryWriter writer, List<LuaParam> luaParams)
|
public static void WriteLuaParams(BinaryWriter writer, List<LuaParam> luaParams)
|
||||||
{
|
{
|
||||||
foreach (LuaParam l in luaParams)
|
foreach (LuaParam l in luaParams)
|
||||||
{
|
{
|
||||||
@ -126,10 +126,10 @@ namespace FFXIVClassic_Map_Server
|
|||||||
switch (l.typeID)
|
switch (l.typeID)
|
||||||
{
|
{
|
||||||
case 0x0: //Int32
|
case 0x0: //Int32
|
||||||
writer.Write((Int32)Utils.swapEndian((Int32)l.value));
|
writer.Write((Int32)Utils.SwapEndian((Int32)l.value));
|
||||||
break;
|
break;
|
||||||
case 0x1: //Int32
|
case 0x1: //Int32
|
||||||
writer.Write((UInt32)Utils.swapEndian((UInt32)l.value));
|
writer.Write((UInt32)Utils.SwapEndian((UInt32)l.value));
|
||||||
break;
|
break;
|
||||||
case 0x2: //Null Termed String
|
case 0x2: //Null Termed String
|
||||||
string sv = (string)l.value;
|
string sv = (string)l.value;
|
||||||
@ -143,18 +143,18 @@ namespace FFXIVClassic_Map_Server
|
|||||||
case 0x5: //Nil
|
case 0x5: //Nil
|
||||||
break;
|
break;
|
||||||
case 0x6: //Actor (By Id)
|
case 0x6: //Actor (By Id)
|
||||||
writer.Write((UInt32)Utils.swapEndian((UInt32)l.value));
|
writer.Write((UInt32)Utils.SwapEndian((UInt32)l.value));
|
||||||
break;
|
break;
|
||||||
case 0x7: //Weird one used for inventory
|
case 0x7: //Weird one used for inventory
|
||||||
Type7Param type7 = (Type7Param)l.value;
|
Type7Param type7 = (Type7Param)l.value;
|
||||||
writer.Write((UInt32)Utils.swapEndian((UInt32)type7.actorId));
|
writer.Write((UInt32)Utils.SwapEndian((UInt32)type7.actorId));
|
||||||
writer.Write((Byte)type7.unknown);
|
writer.Write((Byte)type7.unknown);
|
||||||
writer.Write((Byte)type7.slot);
|
writer.Write((Byte)type7.slot);
|
||||||
writer.Write((Byte)type7.inventoryType);
|
writer.Write((Byte)type7.inventoryType);
|
||||||
break;
|
break;
|
||||||
case 0x9: //Two Longs (only storing first one)
|
case 0x9: //Two Longs (only storing first one)
|
||||||
writer.Write((UInt64)Utils.swapEndian(((Type9Param)l.value).item1));
|
writer.Write((UInt64)Utils.SwapEndian(((Type9Param)l.value).item1));
|
||||||
writer.Write((UInt64)Utils.swapEndian(((Type9Param)l.value).item2));
|
writer.Write((UInt64)Utils.SwapEndian(((Type9Param)l.value).item2));
|
||||||
break;
|
break;
|
||||||
case 0xC: //Byte
|
case 0xC: //Byte
|
||||||
writer.Write((Byte)l.value);
|
writer.Write((Byte)l.value);
|
||||||
@ -169,7 +169,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
writer.Write((Byte)0xF);
|
writer.Write((Byte)0xF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<LuaParam> readLuaParams(byte[] bytesIn)
|
public static List<LuaParam> ReadLuaParams(byte[] bytesIn)
|
||||||
{
|
{
|
||||||
List<LuaParam> luaParams = new List<LuaParam>();
|
List<LuaParam> luaParams = new List<LuaParam>();
|
||||||
|
|
||||||
@ -187,10 +187,10 @@ namespace FFXIVClassic_Map_Server
|
|||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 0x0: //Int32
|
case 0x0: //Int32
|
||||||
value = Utils.swapEndian(reader.ReadInt32());
|
value = Utils.SwapEndian(reader.ReadInt32());
|
||||||
break;
|
break;
|
||||||
case 0x1: //Int32
|
case 0x1: //Int32
|
||||||
value = Utils.swapEndian(reader.ReadUInt32());
|
value = Utils.SwapEndian(reader.ReadUInt32());
|
||||||
break;
|
break;
|
||||||
case 0x2: //Null Termed String
|
case 0x2: //Null Termed String
|
||||||
List<byte> list = new List<byte>();
|
List<byte> list = new List<byte>();
|
||||||
@ -213,17 +213,17 @@ namespace FFXIVClassic_Map_Server
|
|||||||
wasNil = true;
|
wasNil = true;
|
||||||
break;
|
break;
|
||||||
case 0x6: //Actor (By Id)
|
case 0x6: //Actor (By Id)
|
||||||
value = Utils.swapEndian(reader.ReadUInt32());
|
value = Utils.SwapEndian(reader.ReadUInt32());
|
||||||
break;
|
break;
|
||||||
case 0x7: //Weird one used for inventory
|
case 0x7: //Weird one used for inventory
|
||||||
uint type7ActorId = Utils.swapEndian(reader.ReadUInt32());
|
uint type7ActorId = Utils.SwapEndian(reader.ReadUInt32());
|
||||||
byte type7Unknown = reader.ReadByte();
|
byte type7Unknown = reader.ReadByte();
|
||||||
byte type7Slot = reader.ReadByte();
|
byte type7Slot = reader.ReadByte();
|
||||||
byte type7InventoryType = reader.ReadByte();
|
byte type7InventoryType = reader.ReadByte();
|
||||||
value = new Type7Param(type7ActorId, type7Unknown, type7Slot, type7InventoryType);
|
value = new Type7Param(type7ActorId, type7Unknown, type7Slot, type7InventoryType);
|
||||||
break;
|
break;
|
||||||
case 0x9: //Two Longs (only storing first one)
|
case 0x9: //Two Longs (only storing first one)
|
||||||
value = new Type9Param(Utils.swapEndian(reader.ReadUInt64()), Utils.swapEndian(reader.ReadUInt64()));
|
value = new Type9Param(Utils.SwapEndian(reader.ReadUInt64()), Utils.SwapEndian(reader.ReadUInt64()));
|
||||||
break;
|
break;
|
||||||
case 0xC: //Byte
|
case 0xC: //Byte
|
||||||
value = reader.ReadByte();
|
value = reader.ReadByte();
|
||||||
@ -249,7 +249,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
return luaParams;
|
return luaParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<LuaParam> createLuaParamList(DynValue fromScript)
|
public static List<LuaParam> CreateLuaParamList(DynValue fromScript)
|
||||||
{
|
{
|
||||||
List<LuaParam> luaParams = new List<LuaParam>();
|
List<LuaParam> luaParams = new List<LuaParam>();
|
||||||
|
|
||||||
@ -257,16 +257,16 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
foreach (DynValue d in fromScript.Tuple)
|
foreach (DynValue d in fromScript.Tuple)
|
||||||
{
|
{
|
||||||
addToList(d, luaParams);
|
AddToList(d, luaParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addToList(fromScript, luaParams);
|
AddToList(fromScript, luaParams);
|
||||||
|
|
||||||
return luaParams;
|
return luaParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<LuaParam> createLuaParamList(params object[] list)
|
public static List<LuaParam> CreateLuaParamList(params object[] list)
|
||||||
{
|
{
|
||||||
List<LuaParam> luaParams = new List<LuaParam>();
|
List<LuaParam> luaParams = new List<LuaParam>();
|
||||||
|
|
||||||
@ -276,16 +276,16 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
Array arrayO = (Array)o;
|
Array arrayO = (Array)o;
|
||||||
foreach (object o2 in arrayO)
|
foreach (object o2 in arrayO)
|
||||||
addToList(o2, luaParams);
|
AddToList(o2, luaParams);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addToList(o, luaParams);
|
AddToList(o, luaParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
return luaParams;
|
return luaParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addToList(DynValue d, List<LuaParam> luaParams)
|
private static void AddToList(DynValue d, List<LuaParam> luaParams)
|
||||||
{
|
{
|
||||||
if (d.Type == DataType.Number)
|
if (d.Type == DataType.Number)
|
||||||
{
|
{
|
||||||
@ -316,7 +316,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addToList(object o, List<LuaParam> luaParams)
|
private static void AddToList(object o, List<LuaParam> luaParams)
|
||||||
{
|
{
|
||||||
if (o is int)
|
if (o is int)
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
{
|
{
|
||||||
luaParams.Add(new LuaParam(0x1, (uint)o));
|
luaParams.Add(new LuaParam(0x1, (uint)o));
|
||||||
}
|
}
|
||||||
else if (o is double)
|
else if (o is Double)
|
||||||
{
|
{
|
||||||
if (((double)o) % 1 == 0)
|
if (((double)o) % 1 == 0)
|
||||||
luaParams.Add(new LuaParam(0x0, (int)(double)o));
|
luaParams.Add(new LuaParam(0x0, (int)(double)o));
|
||||||
@ -364,7 +364,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static object[] createLuaParamObjectList(List <LuaParam> luaParams)
|
public static object[] CreateLuaParamObjectList(List <LuaParam> luaParams)
|
||||||
{
|
{
|
||||||
object[] list = new object[luaParams.Count];
|
object[] list = new object[luaParams.Count];
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ namespace FFXIVClassic_Map_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string dumpParams(List<LuaParam> lParams)
|
public static string DumpParams(List<LuaParam> lParams)
|
||||||
{
|
{
|
||||||
if (lParams == null)
|
if (lParams == null)
|
||||||
return "Param list was null?";
|
return "Param list was null?";
|
||||||
|
@ -102,7 +102,7 @@ namespace FFXIVClassic_Map_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);
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ namespace FFXIVClassic_Map_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)
|
||||||
@ -128,7 +128,7 @@ namespace FFXIVClassic_Map_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];
|
||||||
@ -140,16 +140,16 @@ namespace FFXIVClassic_Map_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))
|
||||||
{
|
{
|
||||||
@ -172,7 +172,7 @@ namespace FFXIVClassic_Map_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))
|
||||||
{
|
{
|
||||||
@ -195,7 +195,7 @@ namespace FFXIVClassic_Map_Server.packets
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Utility Functions
|
#region Utility Functions
|
||||||
public static BasePacket createPacket(List<SubPacket> subpackets, bool isAuthed, bool isCompressed)
|
public static BasePacket CreatePacket(List<SubPacket> subpackets, bool isAuthed, bool isCompressed)
|
||||||
{
|
{
|
||||||
//Create Header
|
//Create Header
|
||||||
BasePacketHeader header = new BasePacketHeader();
|
BasePacketHeader header = new BasePacketHeader();
|
||||||
@ -217,7 +217,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ namespace FFXIVClassic_Map_Server.packets
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BasePacket createPacket(SubPacket subpacket, bool isAuthed, bool isCompressed)
|
public static BasePacket CreatePacket(SubPacket subpacket, bool isAuthed, bool isCompressed)
|
||||||
{
|
{
|
||||||
//Create Header
|
//Create Header
|
||||||
BasePacketHeader header = new BasePacketHeader();
|
BasePacketHeader header = new BasePacketHeader();
|
||||||
@ -246,7 +246,7 @@ namespace FFXIVClassic_Map_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);
|
||||||
@ -255,7 +255,7 @@ namespace FFXIVClassic_Map_Server.packets
|
|||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BasePacket createPacket(byte[] data, bool isAuthed, bool isCompressed)
|
public static BasePacket CreatePacket(byte[] data, bool isAuthed, bool isCompressed)
|
||||||
{
|
{
|
||||||
|
|
||||||
Debug.Assert(data != null);
|
Debug.Assert(data != null);
|
||||||
@ -276,7 +276,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
@ -302,7 +302,7 @@ namespace FFXIVClassic_Map_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;
|
||||||
@ -329,16 +329,16 @@ namespace FFXIVClassic_Map_Server.packets
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public void debugPrintPacket()
|
public void DebugPrintPacket()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Console.BackgroundColor = ConsoleColor.DarkYellow;
|
Console.BackgroundColor = ConsoleColor.DarkYellow;
|
||||||
|
|
||||||
Program.Log.Debug("IsAuth: {0} IsEncrypted: {1}, Size: 0x{2:X}, NumSubpackets: {3}{4}{5}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes()));
|
Program.Log.Debug("IsAuth: {0} IsEncrypted: {1}, Size: 0x{2:X}, NumSubpackets: {3}{4}{5}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||||
|
|
||||||
foreach (SubPacket sub in getSubpackets())
|
foreach (SubPacket sub in GetSubpackets())
|
||||||
{
|
{
|
||||||
sub.debugPrintSubPacket();
|
sub.DebugPrintSubPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.BackgroundColor = ConsoleColor.Black;
|
Console.BackgroundColor = ConsoleColor.Black;
|
||||||
|
@ -101,7 +101,7 @@ namespace FFXIVClassic_Map_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];
|
||||||
@ -113,7 +113,7 @@ namespace FFXIVClassic_Map_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];
|
||||||
@ -125,28 +125,28 @@ namespace FFXIVClassic_Map_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;
|
Console.BackgroundColor = ConsoleColor.DarkRed;
|
||||||
|
|
||||||
Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(getHeaderBytes()));
|
Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||||
|
|
||||||
if (header.type == 0x03)
|
if (header.type == 0x03)
|
||||||
{
|
{
|
||||||
Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(getGameMessageBytes(), SUBPACKET_SIZE));
|
Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(GetGameMessageBytes(), SUBPACKET_SIZE));
|
||||||
|
|
||||||
Console.BackgroundColor = ConsoleColor.DarkMagenta;
|
Console.BackgroundColor = ConsoleColor.DarkMagenta;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace FFXIVClassic_Map_Server.packets.receive.events
|
|||||||
|
|
||||||
binReader.BaseStream.Seek(0x31, SeekOrigin.Begin);
|
binReader.BaseStream.Seek(0x31, SeekOrigin.Begin);
|
||||||
|
|
||||||
luaParams = LuaUtils.readLuaParams(binReader);
|
luaParams = LuaUtils.ReadLuaParams(binReader);
|
||||||
}
|
}
|
||||||
catch (Exception){
|
catch (Exception){
|
||||||
invalidPacket = true;
|
invalidPacket = true;
|
||||||
|
@ -31,7 +31,7 @@ namespace FFXIVClassic_Map_Server.packets.receive.events
|
|||||||
val1 = binReader.ReadUInt32();
|
val1 = binReader.ReadUInt32();
|
||||||
val2 = binReader.ReadUInt32();
|
val2 = binReader.ReadUInt32();
|
||||||
step = binReader.ReadByte();
|
step = binReader.ReadByte();
|
||||||
luaParams = LuaUtils.readLuaParams(binReader);
|
luaParams = LuaUtils.ReadLuaParams(binReader);
|
||||||
}
|
}
|
||||||
catch (Exception){
|
catch (Exception){
|
||||||
invalidPacket = true;
|
invalidPacket = true;
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00E1;
|
public const ushort OPCODE = 0x00E1;
|
||||||
public const uint PACKET_SIZE = 0x30;
|
public const uint PACKET_SIZE = 0x30;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, uint targettedActorId, uint emoteID)
|
public static SubPacket BuildPacket(uint sourceActorId, uint targetActorId, uint targettedActorId, uint emoteID)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
}
|
}
|
||||||
|
|
||||||
SubPacket packet = new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
SubPacket packet = new SubPacket(OPCODE, sourceActorId, targetActorId, data);
|
||||||
packet.debugPrintSubPacket();
|
packet.DebugPrintSubPacket();
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00CC;
|
public const ushort OPCODE = 0x00CC;
|
||||||
public const uint PACKET_SIZE = 0x128;
|
public const uint PACKET_SIZE = 0x128;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint sourceActorID, uint targetActorID, string objectName, string className, List<LuaParam> initParams)
|
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, string objectName, string className, List<LuaParam> initParams)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
binWriter.BaseStream.Seek(0x24, SeekOrigin.Begin);
|
binWriter.BaseStream.Seek(0x24, SeekOrigin.Begin);
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(className), 0, Encoding.ASCII.GetByteCount(className) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(className));
|
binWriter.Write(Encoding.ASCII.GetBytes(className), 0, Encoding.ASCII.GetByteCount(className) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(className));
|
||||||
binWriter.BaseStream.Seek(0x44, SeekOrigin.Begin);
|
binWriter.BaseStream.Seek(0x44, SeekOrigin.Begin);
|
||||||
LuaUtils.writeLuaParams(binWriter, initParams);
|
LuaUtils.WriteLuaParams(binWriter, initParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00E3;
|
public const ushort OPCODE = 0x00E3;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, int iconCode)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, int iconCode)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
public const ushort OPCODE = 0x00CA;
|
public const ushort OPCODE = 0x00CA;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint actorID, byte val)
|
public static SubPacket BuildPacket(uint playerActorID, uint actorID, byte val)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE-0x20];
|
byte[] data = new byte[PACKET_SIZE-0x20];
|
||||||
data[0] = val; //Why?
|
data[0] = val; //Why?
|
||||||
|
@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x0139;
|
public const ushort OPCODE = 0x0139;
|
||||||
public const uint PACKET_SIZE = 0x58;
|
public const uint PACKET_SIZE = 0x58;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint sourceId, uint targetId)
|
public static SubPacket BuildPacket(uint sourceId, uint targetId)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
public const ushort OPCODE = 0x0007;
|
public const ushort OPCODE = 0x0007;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID)
|
public static SubPacket BuildPacket(uint playerActorID)
|
||||||
{
|
{
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
return new SubPacket(OPCODE, playerActorID, playerActorID, new byte[8]);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00CF;
|
public const ushort OPCODE = 0x00CF;
|
||||||
public const uint PACKET_SIZE = 0x50;
|
public const uint PACKET_SIZE = 0x50;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, float x, float y, float z, float rot, ushort moveState)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, float x, float y, float z, float rot, ushort moveState)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00CB;
|
public const ushort OPCODE = 0x00CB;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint actorId)
|
public static SubPacket BuildPacket(uint playerActorID, uint actorId)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
appearanceIDs = appearanceTable;
|
appearanceIDs = appearanceTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket buildPacket(uint playerActorID, uint actorID)
|
public SubPacket BuildPacket(uint playerActorID, uint actorID)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x0145;
|
public const ushort OPCODE = 0x0145;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, uint iconCode)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint iconCode)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x144;
|
public const ushort OPCODE = 0x144;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetID, uint idleAnimationId)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint idleAnimationId)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
public const ushort OPCODE = 0x017B;
|
public const ushort OPCODE = 0x017B;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, bool isDimmed)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, bool isDimmed)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
data[0] = (byte)(isDimmed ? 1 : 0);
|
data[0] = (byte)(isDimmed ? 1 : 0);
|
||||||
|
@ -9,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x013D;
|
public const ushort OPCODE = 0x013D;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, uint displayNameID, string customName)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint displayNameID, string customName)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const float INNPOS_Z = 165.050003f;
|
public const float INNPOS_Z = 165.050003f;
|
||||||
public const float INNPOS_ROT = -1.530000f;
|
public const float INNPOS_ROT = -1.530000f;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint sourceActorID, uint targetActorID, uint actorId, float x, float y, float z, float rotation, uint spawnType, bool isZoningPlayer)
|
public static SubPacket BuildPacket(uint sourceActorID, uint targetActorID, uint actorId, float x, float y, float z, float rotation, uint spawnType, bool isZoningPlayer)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE-0x20];
|
byte[] data = new byte[PACKET_SIZE-0x20];
|
||||||
|
|
||||||
|
@ -34,13 +34,13 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
currentTarget = startingTarget;
|
currentTarget = startingTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closeStreams()
|
public void CloseStreams()
|
||||||
{
|
{
|
||||||
binWriter.Dispose();
|
binWriter.Dispose();
|
||||||
mem.Dispose();
|
mem.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool addByte(uint id, byte value)
|
public bool AddByte(uint id, byte value)
|
||||||
{
|
{
|
||||||
if (runningByteTotal + 6 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
if (runningByteTotal + 6 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
||||||
return false;
|
return false;
|
||||||
@ -53,7 +53,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool addShort(uint id, ushort value)
|
public bool AddShort(uint id, ushort value)
|
||||||
{
|
{
|
||||||
if (runningByteTotal + 7 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
if (runningByteTotal + 7 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
||||||
return false;
|
return false;
|
||||||
@ -66,7 +66,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool addInt(uint id, uint value)
|
public bool AddInt(uint id, uint value)
|
||||||
{
|
{
|
||||||
if (runningByteTotal + 9 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
if (runningByteTotal + 9 + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
||||||
return false;
|
return false;
|
||||||
@ -79,7 +79,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool addBuffer(uint id, byte[] buffer)
|
public bool AddBuffer(uint id, byte[] buffer)
|
||||||
{
|
{
|
||||||
if (runningByteTotal + 5 + buffer.Length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
if (runningByteTotal + 5 + buffer.Length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
||||||
return false;
|
return false;
|
||||||
@ -92,7 +92,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool addBuffer(uint id, byte[] buffer, int index, int length, int page)
|
public bool AddBuffer(uint id, byte[] buffer, int index, int length, int page)
|
||||||
{
|
{
|
||||||
if (runningByteTotal + 5 + length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
if (runningByteTotal + 5 + length + (1 + Encoding.ASCII.GetByteCount(currentTarget)) > MAXBYTES)
|
||||||
return false;
|
return false;
|
||||||
@ -106,7 +106,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool addProperty(FFXIVClassic_Map_Server.Actors.Actor actor, string name)
|
public bool AddProperty(FFXIVClassic_Map_Server.Actors.Actor actor, string name)
|
||||||
{
|
{
|
||||||
string[] split = name.Split('.');
|
string[] split = name.Split('.');
|
||||||
int arrayIndex = 0;
|
int arrayIndex = 0;
|
||||||
@ -151,43 +151,43 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
if (curObj == null)
|
if (curObj == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Cast to the proper object and add to packet
|
//Cast to the proper object and Add to packet
|
||||||
uint id = Utils.MurmurHash2(name, 0);
|
uint id = Utils.MurmurHash2(name, 0);
|
||||||
if (curObj is bool)
|
if (curObj is bool)
|
||||||
return addByte(id, (byte)(((bool)curObj) ? 1 : 0));
|
return AddByte(id, (byte)(((bool)curObj) ? 1 : 0));
|
||||||
else if (curObj is byte)
|
else if (curObj is byte)
|
||||||
return addByte(id, (byte)curObj);
|
return AddByte(id, (byte)curObj);
|
||||||
else if (curObj is ushort)
|
else if (curObj is ushort)
|
||||||
return addShort(id, (ushort)curObj);
|
return AddShort(id, (ushort)curObj);
|
||||||
else if (curObj is short)
|
else if (curObj is short)
|
||||||
return addShort(id, (ushort)(short)curObj);
|
return AddShort(id, (ushort)(short)curObj);
|
||||||
else if (curObj is uint)
|
else if (curObj is uint)
|
||||||
return addInt(id, (uint)curObj);
|
return AddInt(id, (uint)curObj);
|
||||||
else if (curObj is int)
|
else if (curObj is int)
|
||||||
return addInt(id, (uint)(int)curObj);
|
return AddInt(id, (uint)(int)curObj);
|
||||||
else if (curObj is float)
|
else if (curObj is float)
|
||||||
return addBuffer(id, BitConverter.GetBytes((float)curObj));
|
return AddBuffer(id, BitConverter.GetBytes((float)curObj));
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsArrayMode(bool flag)
|
public void SetIsArrayMode(bool flag)
|
||||||
{
|
{
|
||||||
isArrayMode = flag;
|
isArrayMode = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsMore(bool flag)
|
public void SetIsMore(bool flag)
|
||||||
{
|
{
|
||||||
isMore = flag;
|
isMore = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTarget(string target)
|
public void SetTarget(string target)
|
||||||
{
|
{
|
||||||
currentTarget = target;
|
currentTarget = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTarget()
|
public void AddTarget()
|
||||||
{
|
{
|
||||||
if (isArrayMode)
|
if (isArrayMode)
|
||||||
binWriter.Write((byte)(0xA4 + currentTarget.Length));
|
binWriter.Write((byte)(0xA4 + currentTarget.Length));
|
||||||
@ -197,7 +197,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(currentTarget));
|
runningByteTotal += (ushort)(1 + Encoding.ASCII.GetByteCount(currentTarget));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTarget(string newTarget)
|
public void AddTarget(string newTarget)
|
||||||
{
|
{
|
||||||
binWriter.Write((byte)(isMore ? 0x60 + currentTarget.Length : 0x82 + currentTarget.Length));
|
binWriter.Write((byte)(isMore ? 0x60 + currentTarget.Length : 0x82 + currentTarget.Length));
|
||||||
binWriter.Write(Encoding.ASCII.GetBytes(currentTarget));
|
binWriter.Write(Encoding.ASCII.GetBytes(currentTarget));
|
||||||
@ -205,12 +205,12 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
currentTarget = newTarget;
|
currentTarget = newTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubPacket buildPacket(uint playerActorID, uint actorID)
|
public SubPacket BuildPacket(uint playerActorID, uint actorID)
|
||||||
{
|
{
|
||||||
binWriter.Seek(0, SeekOrigin.Begin);
|
binWriter.Seek(0, SeekOrigin.Begin);
|
||||||
binWriter.Write((byte)runningByteTotal);
|
binWriter.Write((byte)runningByteTotal);
|
||||||
|
|
||||||
closeStreams();
|
CloseStreams();
|
||||||
|
|
||||||
SubPacket packet = new SubPacket(OPCODE, actorID, playerActorID, data);
|
SubPacket packet = new SubPacket(OPCODE, actorID, playerActorID, data);
|
||||||
return packet;
|
return packet;
|
||||||
|
@ -12,7 +12,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const float DEFAULT_WALK = 2.0f;
|
public const float DEFAULT_WALK = 2.0f;
|
||||||
public const float DEFAULT_RUN = 5.0f;
|
public const float DEFAULT_RUN = 5.0f;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, float stopSpeed, float walkSpeed, float runSpeed)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, float stopSpeed, float walkSpeed, float runSpeed)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x134;
|
public const ushort OPCODE = 0x134;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetID, uint mainState, uint subState)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetID, uint mainState, uint subState)
|
||||||
{
|
{
|
||||||
ulong combined = (mainState & 0xFF) | ((subState & 0xFF) << 8);
|
ulong combined = (mainState & 0xFF) | ((subState & 0xFF) << 8);
|
||||||
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes(combined));
|
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes(combined));
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x0179;
|
public const ushort OPCODE = 0x0179;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, ushort[] statusIds)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, ushort[] statusIds)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x0177;
|
public const ushort OPCODE = 0x0177;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, ushort index, ushort statusCode)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, ushort index, ushort statusCode)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00D3;
|
public const ushort OPCODE = 0x00D3;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, uint targetID)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint targetID)
|
||||||
{
|
{
|
||||||
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes((ulong)targetID));
|
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes((ulong)targetID));
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x00DB;
|
public const ushort OPCODE = 0x00DB;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, uint targetID)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID, uint targetID)
|
||||||
{
|
{
|
||||||
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes((ulong)targetID));
|
return new SubPacket(OPCODE, playerActorID, targetID, BitConverter.GetBytes((ulong)targetID));
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x132;
|
public const ushort OPCODE = 0x132;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, ushort number, string function)
|
public static SubPacket BuildPacket(uint playerActorID, ushort number, string function)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||||||
public const ushort OPCODE = 0x000F;
|
public const ushort OPCODE = 0x000F;
|
||||||
public const uint PACKET_SIZE = 0x38;
|
public const uint PACKET_SIZE = 0x38;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID)
|
public static SubPacket BuildPacket(uint playerActorID, uint targetActorID)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
|||||||
public const ushort OPCODE = 0x013C;
|
public const ushort OPCODE = 0x013C;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, ushort commandId)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, ushort commandId)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
|||||||
public const ushort OPCODE = 0x0139;
|
public const ushort OPCODE = 0x0139;
|
||||||
public const uint PACKET_SIZE = 0x58;
|
public const uint PACKET_SIZE = 0x58;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, uint effectId, ushort worldMasterTextId, ushort commandId, ushort amount, byte param)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint targetActorId, uint animationId, uint effectId, ushort worldMasterTextId, ushort commandId, ushort amount, byte param)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
|||||||
public const ushort OPCODE = 0x013A;
|
public const ushort OPCODE = 0x013A;
|
||||||
public const uint PACKET_SIZE = 0xD8;
|
public const uint PACKET_SIZE = 0xD8;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.battle
|
|||||||
public const ushort OPCODE = 0x013B;
|
public const ushort OPCODE = 0x013B;
|
||||||
public const uint PACKET_SIZE = 0x148;
|
public const uint PACKET_SIZE = 0x148;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorId, uint animationId, ushort commandId, BattleAction[] actionList)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x016C;
|
public const ushort OPCODE = 0x016C;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.EmoteEventCondition condition)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.EmoteEventCondition condition)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x0136;
|
public const ushort OPCODE = 0x0136;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, bool enabled, byte unknown2, string conditionName)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, bool enabled, byte unknown2, string conditionName)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x016B;
|
public const ushort OPCODE = 0x016B;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.NoticeEventCondition condition)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.NoticeEventCondition condition)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x016F;
|
public const ushort OPCODE = 0x016F;
|
||||||
public const uint PACKET_SIZE = 0x58;
|
public const uint PACKET_SIZE = 0x58;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.PushCircleEventCondition condition)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.PushCircleEventCondition condition)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x0170;
|
public const ushort OPCODE = 0x0170;
|
||||||
public const uint PACKET_SIZE = 0x60;
|
public const uint PACKET_SIZE = 0x60;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.PushFanEventCondition condition)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.PushFanEventCondition condition)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
binWriter.Write(Encoding.ASCII.GetBytes(condition.conditionName), 0, Encoding.ASCII.GetByteCount(condition.conditionName) >= 0x24 ? 0x24 : Encoding.ASCII.GetByteCount(condition.conditionName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
new SubPacket(OPCODE, sourceActorID, playerActorID, data).debugPrintSubPacket();
|
new SubPacket(OPCODE, sourceActorID, playerActorID, data).DebugPrintSubPacket();
|
||||||
return new SubPacket(OPCODE, sourceActorID, playerActorID, data);
|
return new SubPacket(OPCODE, sourceActorID, playerActorID, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x0175;
|
public const ushort OPCODE = 0x0175;
|
||||||
public const uint PACKET_SIZE = 0x60;
|
public const uint PACKET_SIZE = 0x60;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.PushBoxEventCondition condition)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.PushBoxEventCondition condition)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor.events
|
|||||||
public const ushort OPCODE = 0x012E;
|
public const ushort OPCODE = 0x012E;
|
||||||
public const uint PACKET_SIZE = 0x48;
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, uint sourceActorID, EventList.TalkEventCondition condition)
|
public static SubPacket BuildPacket(uint playerActorID, uint sourceActorID, EventList.TalkEventCondition condition)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
|||||||
public const ushort OPCODE = 0x014D;
|
public const ushort OPCODE = 0x014D;
|
||||||
public const uint PACKET_SIZE = 0x28;
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID, ushort equipSlot, uint itemSlot)
|
public static SubPacket BuildPacket(uint playerActorID, ushort equipSlot, uint itemSlot)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
|||||||
public const ushort OPCODE = 0x14E;
|
public const ushort OPCODE = 0x14E;
|
||||||
public const uint PACKET_SIZE = 0x58;
|
public const uint PACKET_SIZE = 0x58;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorId, InventoryItem[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
|
public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ namespace FFXIVClassic_Map_Server.packets.send.Actor.inventory
|
|||||||
public const ushort OPCODE = 0x14F;
|
public const ushort OPCODE = 0x14F;
|
||||||
public const uint PACKET_SIZE = 0x80;
|
public const uint PACKET_SIZE = 0x80;
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorId, InventoryItem[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
|
public static SubPacket BuildPacket(uint playerActorId, InventoryItem[] equipment, List<ushort> slotsToUpdate, ref int listOffset)
|
||||||
{
|
{
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user