Cleaned up namespaces (still have to do Map Project) and removed references to FFXIV Classic from the code. Removed the Launcher Editor project as it is no longer needed (host file editing is cleaner).

This commit is contained in:
Filip Maj 2019-06-19 00:05:18 -04:00
parent 7587a6e142
commit 0f61c4c0e1
544 changed files with 54548 additions and 55498 deletions

View file

@ -0,0 +1,73 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
namespace Meteor.Lobby.Packets
{
class HardCoded_Packets
{
public static byte[] g_secureConnectionAcknowledgment =
{
0x00, 0x00, 0x00, 0x00, 0xA0, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x90, 0x02, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x69, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xED, 0x45, 0x02, 0x00, 0x00, 0x00, 0x00,
0xC0, 0xED, 0xDF, 0xFF, 0xAF, 0xF7, 0xF7, 0xAF, 0x10, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF,
0x42, 0x82, 0x63, 0x52, 0x01, 0x00, 0x00, 0x00, 0x10, 0xEF, 0xDF, 0xFF, 0x53, 0x61, 0x6D, 0x70,
0x6C, 0x65, 0x20, 0x53, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x20, 0x52, 0x75, 0x6E, 0x52, 0x75, 0x6E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0xF7, 0xAF, 0xAF, 0xF7, 0x00, 0x00, 0xB8, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00,
0x10, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, 0x2C, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x4F, 0x62,
0x6A, 0x65, 0x63, 0x74, 0x2E, 0x2E, 0x2E, 0x5B, 0x36, 0x36, 0x2E, 0x31, 0x33, 0x30, 0x2E, 0x39,
0x39, 0x2E, 0x38, 0x32, 0x3A, 0x36, 0x33, 0x34, 0x30, 0x37, 0x5D, 0x00, 0x00, 0x00, 0x00, 0x00,
0x70, 0xEE, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x6C, 0x4E, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00,
0x32, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0xAF, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xC0, 0xEE, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0xFE, 0x4E, 0x38, 0x01, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x20, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF,
0x00, 0x01, 0xCC, 0xCC, 0x0C, 0x69, 0x00, 0xE0, 0xD0, 0x58, 0x33, 0x02, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x80, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF,
0xC0, 0xEE, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0xD0, 0xED, 0x45, 0x02, 0x00, 0x00, 0x00, 0x00,
0xF0, 0xEE, 0xDF, 0xFF, 0xAF, 0xF7, 0xF7, 0xAF, 0x20, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF,
0x0C, 0x69, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00,
0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x34, 0x30, 0x37, 0x00, 0x00, 0x00, 0x00,
0x90, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x18, 0xBE, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00,
0xD8, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0xF7, 0xAF, 0x42, 0x82, 0x63, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x36, 0x36, 0x2E, 0x31, 0x33, 0x30, 0x2E, 0x39, 0x39, 0x2E, 0x38, 0x32, 0x00, 0x00,
0x00, 0x00, 0x36, 0x36, 0x2E, 0x31, 0x33, 0x30, 0x2E, 0x39, 0x39, 0x2E, 0x38, 0x32, 0x00, 0xFF,
0x90, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x24, 0xCF, 0x76, 0x01, 0x00, 0x00, 0x00, 0x00,
0x10, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x70, 0x7A, 0xB7, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00,
0x90, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0xD1, 0xF3, 0x37, 0x01, 0x00, 0x00, 0x00, 0x00,
0x10, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00,
0xC0, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0xE8, 0x3E, 0x77, 0x01, 0x00, 0x00, 0x00, 0x00,
0x70, 0x99, 0xAA, 0x01, 0x0C, 0x69, 0x00, 0xE0, 0xA0, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00,
0x58, 0x59, 0x33, 0x02, 0x00, 0x00, 0x00, 0x00, 0x10, 0x6C, 0x4D, 0x02, 0x00, 0x00, 0x00, 0x00,
0xE0, 0xEF, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x05, 0x3F, 0x77, 0x01, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x69, 0x00, 0xE0, 0x0C, 0x69, 0x00, 0xE0, 0xA0, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF0, 0xDF, 0xFF, 0x7F, 0xFD, 0xFF, 0xFF, 0x23, 0x3F, 0x77, 0x01, 0x00, 0x00, 0x00, 0x00,
0xC0, 0x5A, 0x33, 0x02, 0x0C, 0x69, 0x00, 0xE0, 0xA0, 0x32, 0xAC, 0x01, 0x00, 0x00, 0x00, 0x00,
};
}
}

View file

@ -0,0 +1,66 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.IO;
using System.Text;
namespace Meteor.Lobby.Packets.Receive
{
class CharacterModifyPacket
{
public UInt64 sequence;
public uint characterId;
public uint personType;
public byte slot;
public byte command;
public ushort worldId;
public String characterName;
public String characterInfoEncoded;
public bool invalidPacket = false;
public CharacterModifyPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try
{
sequence = binReader.ReadUInt64();
characterId = binReader.ReadUInt32();
personType = binReader.ReadUInt32();
slot = binReader.ReadByte();
command = binReader.ReadByte();
worldId = binReader.ReadUInt16();
characterName = Encoding.ASCII.GetString(binReader.ReadBytes(0x20)).Trim(new[] { '\0' });
characterInfoEncoded = Encoding.ASCII.GetString(binReader.ReadBytes(0x190)).Trim(new[] { '\0' });
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -0,0 +1,54 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.IO;
using System.Text;
namespace Meteor.Lobby.Packets.Receive
{
class SecurityHandshakePacket
{
public string ticketPhrase;
public uint clientNumber;
public bool invalidPacket = false;
public SecurityHandshakePacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try
{
binReader.BaseStream.Seek(0x34, SeekOrigin.Begin);
ticketPhrase = Encoding.ASCII.GetString(binReader.ReadBytes(0x40)).Trim(new[] { '\0' });
clientNumber = binReader.ReadUInt32();
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -0,0 +1,57 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.IO;
namespace Meteor.Lobby.Packets.Receive
{
class SelectCharacterPacket
{
public UInt64 sequence;
public uint characterId;
public uint unknownId;
public UInt64 ticket;
public bool invalidPacket = false;
public SelectCharacterPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try
{
sequence = binReader.ReadUInt64();
characterId = binReader.ReadUInt32();
unknownId = binReader.ReadUInt32();
ticket = binReader.ReadUInt64();
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -0,0 +1,56 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.IO;
using System.Text;
namespace Meteor.Lobby.Packets.Receive
{
class SessionPacket
{
public bool invalidPacket = false;
public UInt64 sequence;
public String session;
public String version;
public SessionPacket(byte[] data)
{
using (MemoryStream mem = new MemoryStream(data))
{
using (BinaryReader binReader = new BinaryReader(mem))
{
try
{
sequence = binReader.ReadUInt64();
binReader.ReadUInt32();
binReader.ReadUInt32();
session = Encoding.ASCII.GetString(binReader.ReadBytes(0x40)).Trim(new[] { '\0' });
version = Encoding.ASCII.GetString(binReader.ReadBytes(0x20)).Trim(new[] { '\0' });
}
catch (Exception){
invalidPacket = true;
}
}
}
}
}
}

View file

@ -0,0 +1,121 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Meteor.Common;
using Meteor.Lobby.DataObjects;
namespace Meteor.Lobby.Packets
{
class AccountListPacket
{
public const ushort OPCODE = 0x0C;
public const ushort MAXPERPACKET = 8;
private UInt64 sequence;
private List<Account> accountList;
public AccountListPacket(UInt64 sequence, List<Account> accountList)
{
this.sequence = sequence;
this.accountList = accountList;
}
public List<SubPacket> BuildPackets()
{
List<SubPacket> subPackets = new List<SubPacket>();
int accountCount = 0;
int totalCount = 0;
MemoryStream memStream = null;
BinaryWriter binWriter = null;
foreach (Account account in accountList)
{
if (totalCount == 0 || accountCount % MAXPERPACKET == 0)
{
memStream = new MemoryStream(0x280);
binWriter = new BinaryWriter(memStream);
//Write List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(accountList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write(accountList.Count - totalCount <= MAXPERPACKET ? (UInt32)(accountList.Count - totalCount) : (UInt32)MAXPERPACKET);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
//Write Entries
binWriter.Write((UInt32)account.id);
binWriter.Write((UInt32)0);
binWriter.Write(Encoding.ASCII.GetBytes(account.name.PadRight(0x40, '\0')));
accountCount++;
totalCount++;
//Send this chunk of world list
if (accountCount >= MAXPERPACKET)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
accountCount = 0;
}
}
//If there is anything left that was missed or the list is empty
if (accountCount > 0 || accountList.Count == 0)
{
if (accountList.Count == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write Empty List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(accountList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write((UInt32)0);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
}
return subPackets;
}
}
}

View file

@ -0,0 +1,86 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.IO;
using System.Text;
using Meteor.Common;
namespace Meteor.Lobby.Packets
{
class CharaCreatorPacket
{
public const ushort OPCODE = 0x0E;
public const ushort RESERVE = 0x01;
public const ushort MAKE = 0x02;
public const ushort RENAME = 0x03;
public const ushort DELETE = 0x04;
public const ushort RENAME_RETAINER = 0x06;
private UInt64 sequence;
private ushort command;
private uint pid;
private uint cid;
private uint type;
private uint ticket;
private string charaName;
private string worldName;
public CharaCreatorPacket(UInt64 sequence, ushort command, uint pid, uint cid, uint ticket, string charaName, string worldName)
{
this.sequence = sequence;
this.command = command;
this.pid = pid;
this.cid = cid;
this.type = 0x400017;
this.ticket = ticket;
this.charaName = charaName;
this.worldName = worldName;
}
public SubPacket BuildPacket()
{
MemoryStream memStream = new MemoryStream(0x1F0);
BinaryWriter binWriter = new BinaryWriter(memStream);
binWriter.Write((UInt64)sequence);
binWriter.Write((byte)1);
binWriter.Write((byte)1);
binWriter.Write((UInt16)command);
binWriter.Write((UInt32)0);
binWriter.Write((UInt32)pid); //PID
binWriter.Write((UInt32)cid); //CID
binWriter.Write((UInt32)type); //Type?
binWriter.Write((UInt32)ticket); //Ticket
binWriter.Write(Encoding.ASCII.GetBytes(charaName.PadRight(0x20, '\0'))); //Name
binWriter.Write(Encoding.ASCII.GetBytes(worldName.PadRight(0x20, '\0'))); //World Name
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
return new SubPacket(OPCODE, 0xe0006868, data);
}
}
}

View file

@ -0,0 +1,179 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Meteor.Common;
using Meteor.Lobby.DataObjects;
namespace Meteor.Lobby.Packets
{
class CharacterListPacket
{
public const ushort OPCODE = 0x0D;
public const ushort MAXPERPACKET = 2;
private ulong sequence;
private List<Character> characterList;
public CharacterListPacket(ulong sequence, List<Character> characterList)
{
this.sequence = sequence;
this.characterList = characterList;
}
public List<SubPacket> BuildPackets()
{
List<SubPacket> subPackets = new List<SubPacket>();
int numCharacters = characterList.Count >= 8 ? 8 : characterList.Count + 1;
int characterCount = 0;
int totalCount = 0;
MemoryStream memStream = null;
BinaryWriter binWriter = null;
foreach (Character chara in characterList)
{
Appearance appearance = Database.GetAppearance(chara.id);
if (totalCount == 0 || characterCount % MAXPERPACKET == 0)
{
memStream = new MemoryStream(0x3B0);
binWriter = new BinaryWriter(memStream);
//Write List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(numCharacters - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write(numCharacters - totalCount <= MAXPERPACKET ? (UInt32)(numCharacters - totalCount) : (UInt32)MAXPERPACKET);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
binWriter.Seek(0x10 + (0x1D0 * characterCount), SeekOrigin.Begin);
//Write Entries
World world = Database.GetServer(chara.serverId);
string worldname = world == null ? "Unknown" : world.name;
binWriter.Write((uint)0); //???
binWriter.Write((uint)chara.id); //Character Id
binWriter.Write((byte)(totalCount)); //Slot
byte options = 0;
if (chara.state == 1)
options |= 0x01;
if (chara.doRename)
options |= 0x02;
if (chara.isLegacy)
options |= 0x08;
binWriter.Write((byte)options); //Options (0x01: Service Account not active, 0x72: Change Chara Name)
binWriter.Write((ushort)0);
binWriter.Write((uint)chara.currentZoneId); //Logged out zone
binWriter.Write(Encoding.ASCII.GetBytes(chara.name.PadRight(0x20, '\0'))); //Name
binWriter.Write(Encoding.ASCII.GetBytes(worldname.PadRight(0xE, '\0'))); //World Name
binWriter.Write(CharaInfo.BuildForCharaList(chara, appearance)); //Appearance Data
//binWriter.Write(CharaInfo.Debug()); //Appearance Data
characterCount++;
totalCount++;
//Send this chunk of character list
if (characterCount >= MAXPERPACKET)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
characterCount = 0;
}
//Incase DB came back with more than max
if (totalCount >= 8)
break;
}
//Add a 'NEW' slot if there is space
if (characterList.Count < 8)
{
if (characterCount % MAXPERPACKET == 0)
{
memStream = new MemoryStream(0x3B0);
binWriter = new BinaryWriter(memStream);
//Write List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(numCharacters - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write(numCharacters - totalCount <= MAXPERPACKET ? (UInt32)(numCharacters-totalCount) : (UInt32)MAXPERPACKET);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
binWriter.Seek(0x10 + (0x1D0 * characterCount), SeekOrigin.Begin);
//Write Entries
binWriter.Write((uint)0); //???
binWriter.Write((uint)0); //Character Id
binWriter.Write((byte)(totalCount)); //Slot
binWriter.Write((byte)0); //Options (0x01: Service Account not active, 0x72: Change Chara Name)
binWriter.Write((ushort)0);
binWriter.Write((uint)0); //Logged out zone
characterCount++;
totalCount++;
//Send this chunk of character list
if (characterCount >= MAXPERPACKET)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
characterCount = 0;
}
}
//If there is anything left that was missed or the list is empty
if (characterCount > 0 || numCharacters == 0)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
}
return subPackets;
}
}
}

View file

@ -0,0 +1,67 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.IO;
using System.Text;
using Meteor.Common;
namespace Meteor.Lobby.Packets
{
class ErrorPacket
{
private const ushort OPCODE = 0x02;
private UInt64 sequence;
private uint errorCode;
private uint statusCode;
private uint textId;
private string message;
public ErrorPacket(UInt64 sequence, uint errorCode, uint statusCode, uint textId, string message)
{
this.sequence = sequence;
this.errorCode = errorCode;
this.statusCode = statusCode;
this.textId = textId;
this.message = message;
}
public SubPacket BuildPacket()
{
MemoryStream memStream = new MemoryStream(0x210);
BinaryWriter binWriter = new BinaryWriter(memStream);
binWriter.Write(sequence);
binWriter.Write(errorCode);
binWriter.Write(statusCode);
binWriter.Write(textId);
binWriter.Write(Encoding.ASCII.GetBytes(message));
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
return subpacket;
}
}
}

View file

@ -0,0 +1,124 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Meteor.Common;
namespace Meteor.Lobby.Packets
{
class ImportListPacket
{
public const ushort OPCODE = 0x16;
public const ushort MAXPERPACKET = 12;
private UInt64 sequence;
private List<String> namesList;
public ImportListPacket(UInt64 sequence, List<String> names)
{
this.sequence = sequence;
this.namesList = names;
}
public List<SubPacket> BuildPackets()
{
List<SubPacket> subPackets = new List<SubPacket>();
int namesCount = 0;
int totalCount = 0;
MemoryStream memStream = null;
BinaryWriter binWriter = null;
foreach (String name in namesList)
{
if (totalCount == 0 || namesCount % MAXPERPACKET == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(namesList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write(namesList.Count - totalCount <= MAXPERPACKET ? (UInt32)(namesList.Count - totalCount) : (UInt32)MAXPERPACKET);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
//Write Entries
binWriter.Write((uint)0);
binWriter.Write((uint)totalCount);
if (!name.Contains(" "))
binWriter.Write(Encoding.ASCII.GetBytes((name+" Last").PadRight(0x20, '\0')));
else
binWriter.Write(Encoding.ASCII.GetBytes(name.PadRight(0x20, '\0')));
namesCount++;
totalCount++;
//Send this chunk of world list
if (namesCount >= MAXPERPACKET)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
namesCount = 0;
}
}
//If there is anything left that was missed or the list is empty
if (namesCount > 0 || namesList.Count == 0)
{
if (namesList.Count == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write Empty List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(namesList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write((UInt32)0);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
}
return subPackets;
}
}
}

View file

@ -0,0 +1,126 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Meteor.Common;
using Meteor.Lobby.DataObjects;
namespace Meteor.Lobby.Packets
{
class RetainerListPacket
{
public const ushort OPCODE = 0x17;
public const ushort MAXPERPACKET = 9;
private UInt64 sequence;
private List<Retainer> retainerList;
public RetainerListPacket(UInt64 sequence, List<Retainer> retainerList)
{
this.sequence = sequence;
this.retainerList = retainerList;
}
public List<SubPacket> BuildPackets()
{
List<SubPacket> subPackets = new List<SubPacket>();
int retainerCount = 0;
int totalCount = 0;
MemoryStream memStream = null;
BinaryWriter binWriter = null;
foreach (Retainer retainer in retainerList)
{
if (totalCount == 0 || retainerCount % MAXPERPACKET == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(retainerList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write(retainerList.Count - totalCount <= MAXPERPACKET ? (UInt32)(retainerList.Count - totalCount) : (UInt32)MAXPERPACKET);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
binWriter.Write((UInt64)0);
binWriter.Write((UInt32)0);
}
//Write Entries
binWriter.Write((uint)retainer.id);
binWriter.Write((uint)retainer.characterId);
binWriter.Write((ushort)totalCount);
binWriter.Write((ushort)(retainer.doRename ? 0x04 : 0x00));
binWriter.Write((uint)0);
binWriter.Write(Encoding.ASCII.GetBytes(retainer.name.PadRight(0x20, '\0')));
retainerCount++;
totalCount++;
//Send this chunk of character list
if (retainerCount >= MAXPERPACKET)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
retainerCount = 0;
}
}
//If there is anything left that was missed or the list is empty
if (retainerCount > 0 || retainerList.Count == 0)
{
if (retainerList.Count == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write Empty List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(retainerList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write((UInt32)0);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
}
return subPackets;
}
}
}

View file

@ -0,0 +1,80 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Meteor.Common;
namespace Meteor.Lobby.Packets
{
class SelectCharacterConfirmPacket
{
public const ushort OPCODE = 0x0F;
private UInt64 sequence;
private UInt32 characterId;
private string sessionToken;
private string worldIp;
private UInt16 worldPort;
private UInt64 selectCharTicket;
public SelectCharacterConfirmPacket(UInt64 sequence, UInt32 characterId, string sessionToken, string worldIp, ushort worldPort, UInt64 selectCharTicket)
{
this.sequence = sequence;
this.characterId = characterId;
this.sessionToken = sessionToken;
this.worldIp = worldIp;
this.worldPort = worldPort;
this.selectCharTicket = selectCharTicket;
}
public List<SubPacket> BuildPackets()
{
List<SubPacket> subPackets = new List<SubPacket>();
byte[] data;
using (MemoryStream memStream = new MemoryStream(0x98))
{
using (BinaryWriter binWriter = new BinaryWriter(memStream))
{
binWriter.Write((UInt64)sequence);
binWriter.Write((UInt32)characterId); //ActorId
binWriter.Write((UInt32)characterId); //CharacterId
binWriter.Write((UInt32)0);
binWriter.Write(Encoding.ASCII.GetBytes(sessionToken.PadRight(0x42, '\0'))); //Session Token
binWriter.Write((UInt16)worldPort); //World Port
binWriter.Write(Encoding.ASCII.GetBytes(worldIp.PadRight(0x38, '\0'))); //World Hostname/IP
binWriter.Write((UInt64)selectCharTicket); //Ticket or Handshake of somekind
}
data = memStream.GetBuffer();
}
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
return subPackets;
}
}
}

View file

@ -0,0 +1,123 @@
/*
===========================================================================
Copyright (C) 2015-2019 Project Meteor Dev Team
This file is part of Project Meteor Server.
Project Meteor Server is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Project Meteor Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
===========================================================================
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Meteor.Common;
using Meteor.Lobby.DataObjects;
namespace Meteor.Lobby.Packets
{
class WorldListPacket
{
public const ushort OPCODE = 0x15;
public const ushort MAXPERPACKET = 6;
private UInt64 sequence;
private List<World> worldList;
public WorldListPacket(UInt64 sequence, List<World> serverList)
{
this.sequence = sequence;
this.worldList = serverList;
}
public List<SubPacket> BuildPackets()
{
List<SubPacket> subPackets = new List<SubPacket>();
int serverCount = 0;
int totalCount = 0;
MemoryStream memStream = null;
BinaryWriter binWriter = null;
foreach (World world in worldList)
{
if (totalCount == 0 || serverCount % MAXPERPACKET == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(worldList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write(worldList.Count - totalCount <= MAXPERPACKET ? (UInt32)(worldList.Count - totalCount) : (UInt32)MAXPERPACKET);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
//Write Entries
binWriter.Write((ushort)world.id);
binWriter.Write((ushort)world.listPosition);
binWriter.Write((uint)world.population);
binWriter.Write((UInt64)0);
binWriter.Write(Encoding.ASCII.GetBytes(world.name.PadRight(64, '\0')));
serverCount++;
totalCount++;
//Send this chunk of world list
if (serverCount >= MAXPERPACKET)
{
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
serverCount = 0;
}
}
//If there is anything left that was missed or the list is empty
if (serverCount > 0 || worldList.Count == 0)
{
if (worldList.Count == 0)
{
memStream = new MemoryStream(0x210);
binWriter = new BinaryWriter(memStream);
//Write Empty List Info
binWriter.Write((UInt64)sequence);
byte listTracker = (byte)((MAXPERPACKET * 2) * subPackets.Count);
binWriter.Write(worldList.Count - totalCount <= MAXPERPACKET ? (byte)(listTracker + 1) : (byte)(listTracker));
binWriter.Write((UInt32)0);
binWriter.Write((byte)0);
binWriter.Write((UInt16)0);
}
byte[] data = memStream.GetBuffer();
binWriter.Dispose();
memStream.Dispose();
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, data);
subpacket.SetTargetId(0xe0006868);
subPackets.Add(subpacket);
}
return subPackets;
}
}
}