mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-23 21:27:46 +00:00
Finished SetCompletedAchievementsPacket and renamed CutsceneBookSetPacket to SetCutsceneBookPacket in line with other "set" packets. Moved a lot of the hardcoded packets into the coded login part under PacketProcessor.
This commit is contained in:
parent
50659afc82
commit
9bb8cc816f
7 changed files with 143 additions and 169 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
FFXIVClassic Map Server/bin/Debug/packets/wireshark packets/
|
FFXIVClassic Map Server/bin/Debug/packets/wireshark packets/
|
||||||
|
FFXIVClassic Map Server/bin/
|
||||||
|
FFXIVClassic Map Server/obj/
|
||||||
|
|
|
@ -106,8 +106,9 @@
|
||||||
<Compile Include="packets\send\actor\SetActorPositionPacket.cs" />
|
<Compile Include="packets\send\actor\SetActorPositionPacket.cs" />
|
||||||
<Compile Include="packets\send\login\InitPacket.cs" />
|
<Compile Include="packets\send\login\InitPacket.cs" />
|
||||||
<Compile Include="packets\send\LogoutPacket.cs" />
|
<Compile Include="packets\send\LogoutPacket.cs" />
|
||||||
|
<Compile Include="packets\send\player\SetCompletedAchievementsPacket.cs" />
|
||||||
<Compile Include="packets\send\player\AchievementEarnedPacket.cs" />
|
<Compile Include="packets\send\player\AchievementEarnedPacket.cs" />
|
||||||
<Compile Include="packets\send\player\CutsceneBookSetPacket.cs" />
|
<Compile Include="packets\send\player\SetCutsceneBookPacket.cs" />
|
||||||
<Compile Include="packets\send\player\SetAchievementPointsPacket.cs" />
|
<Compile Include="packets\send\player\SetAchievementPointsPacket.cs" />
|
||||||
<Compile Include="packets\send\player\SetChocoboNamePacket.cs" />
|
<Compile Include="packets\send\player\SetChocoboNamePacket.cs" />
|
||||||
<Compile Include="packets\send\player\SetGCInfoPacket.cs" />
|
<Compile Include="packets\send\player\SetGCInfoPacket.cs" />
|
||||||
|
|
|
@ -19,6 +19,7 @@ using FFXIVClassic_Map_Server.packets.send.Actor;
|
||||||
using FFXIVClassic_Map_Server.packets.send.actor;
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
||||||
using FFXIVClassic_Map_Server;
|
using FFXIVClassic_Map_Server;
|
||||||
using FFXIVClassic_Map_Server.packets.send.script;
|
using FFXIVClassic_Map_Server.packets.send.script;
|
||||||
|
using FFXIVClassic_Map_Server.packets.send.player;
|
||||||
|
|
||||||
namespace FFXIVClassic_Lobby_Server
|
namespace FFXIVClassic_Lobby_Server
|
||||||
{
|
{
|
||||||
|
@ -250,11 +251,25 @@ namespace FFXIVClassic_Lobby_Server
|
||||||
////////ITEMS////////
|
////////ITEMS////////
|
||||||
|
|
||||||
//The rest of hardcode
|
//The rest of hardcode
|
||||||
|
//client.queuePacket(BasePacket.createPacket(SetGCInfoPacket.buildPacket(player.actorID), true, false));
|
||||||
|
//client.queuePacket(BasePacket.createPacket(SetGCInfoPacket.buildPacket(player.actorID), true, false));
|
||||||
|
client.queuePacket(BasePacket.createPacket(SetPlayerTitlePacket.buildPacket(player.actorID, player.actorID, 0x00), true, false));
|
||||||
|
client.queuePacket(BasePacket.createPacket(SetPlayerTitlePacket.buildPacket(player.actorID, player.actorID, 0x00), true, false));
|
||||||
|
//client.queuePacket(BasePacket.createPacket(SetCurrentJobPacket.buildPacket(player.actorID, player.actorID, 0x00), true, false)); //196
|
||||||
|
client.queuePacket(BasePacket.createPacket(SetChocoboNamePacket.buildPacket(player.actorID, player.actorID, "Boco"), true, false));
|
||||||
|
//client.queuePacket(BasePacket.createPacket(SetPlayerTitlePacket.buildPacket(player.actorID, player.actorID, 0x00), true, false)); //199
|
||||||
|
client.queuePacket(BasePacket.createPacket(SetPlayerTitlePacket.buildPacket(player.actorID, player.actorID, 0x00), true, false));
|
||||||
|
client.queuePacket(BasePacket.createPacket(new SetCompletedAchievementsPacket().buildPacket(player.actorID), true, false));
|
||||||
|
client.queuePacket(BasePacket.createPacket(SetLatestAchievementsPacket.buildPacket(player.actorID, new uint[5]), true, false));
|
||||||
|
client.queuePacket(BasePacket.createPacket(SetAchievementPointsPacket.buildPacket(player.actorID, 0x00), true, false));
|
||||||
|
//client.queuePacket(BasePacket.createPacket(new SetCutsceneBookPacket().buildPacket(player.actorID), true, false));
|
||||||
|
//client.queuePacket(BasePacket.createPacket(SetPlayerDreamPacket.buildPacket(player.actorID, player.actorID, 0x00), true, false));
|
||||||
|
|
||||||
client.queuePacket(reply7);
|
client.queuePacket(reply7);
|
||||||
client.queuePacket(reply8);
|
client.queuePacket(reply8);
|
||||||
client.queuePacket(reply9);
|
client.queuePacket(reply9);
|
||||||
client.queuePacket(reply10);
|
client.queuePacket(reply10);
|
||||||
//client.queuePacket(reply11);
|
// client.queuePacket(reply11);
|
||||||
client.queuePacket(reply12);
|
client.queuePacket(reply12);
|
||||||
|
|
||||||
inn.addActorToZone(player.getActor());
|
inn.addActorToZone(player.getActor());
|
||||||
|
|
|
@ -118,5 +118,23 @@ namespace FFXIVClassic_Lobby_Server.common
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] ConvertBoolArrayToBinaryStream(bool[] array)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[(array.Length/8)+(array.Length%8 != 0 ? 1 : 0)];
|
||||||
|
|
||||||
|
int dataCounter = 0;
|
||||||
|
for (int i = 0; i < array.Length; i+=8)
|
||||||
|
{
|
||||||
|
for (int bitCount = 0; bitCount < 8; bitCount++)
|
||||||
|
{
|
||||||
|
if (i + bitCount >= array.Length)
|
||||||
|
break;
|
||||||
|
data[dataCounter] = (byte)(((array[i + bitCount] ? 1 : 0) << 7-bitCount) | data[dataCounter]);
|
||||||
|
}
|
||||||
|
dataCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,167 +0,0 @@
|
||||||
using FFXIVClassic_Lobby_Server.packets;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FFXIVClassic_Map_Server.packets.send.player
|
|
||||||
{
|
|
||||||
class CutsceneBookSetPacket
|
|
||||||
{
|
|
||||||
public const ushort OPCODE = 0x01A3;
|
|
||||||
public const uint PACKET_SIZE = 0150;
|
|
||||||
|
|
||||||
private byte[] mainstoryFlags = new byte[7];
|
|
||||||
private byte[] classFlags = new byte[2*17];
|
|
||||||
|
|
||||||
public static SubPacket buildPacket(uint playerActorID)
|
|
||||||
{
|
|
||||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
|
||||||
|
|
||||||
byte currentOut = 0;
|
|
||||||
int byteIndex = 0;
|
|
||||||
int currentBit = 0;
|
|
||||||
|
|
||||||
//Main Scenario
|
|
||||||
for (int i = 0; i < 60; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte) (1|(currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Classes
|
|
||||||
for (int i = 0; i < 340; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte)(1 | (currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//GAP
|
|
||||||
for (int i = 0; i < 60; i++)
|
|
||||||
{
|
|
||||||
currentBit++;
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
byteIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Side Quests
|
|
||||||
for (int i = 0; i < 372; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte)(1 | (currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//GAP
|
|
||||||
for (int i = 0; i < 228; i++)
|
|
||||||
{
|
|
||||||
currentBit++;
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
byteIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Jobs
|
|
||||||
for (int i = 0; i < 140; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte)(1 | (currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//GAP
|
|
||||||
for (int i = 0; i < 61; i++)
|
|
||||||
{
|
|
||||||
currentBit++;
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
byteIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Maelstrom
|
|
||||||
for (int i = 0; i < 200; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte)(1 | (currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Adders
|
|
||||||
for (int i = 0; i < 200; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte)(1 | (currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Flames
|
|
||||||
for (int i = 0; i < 200; i++)
|
|
||||||
{
|
|
||||||
currentOut = (byte)(1 | (currentOut << currentBit));
|
|
||||||
currentBit++;
|
|
||||||
|
|
||||||
if (currentBit >= 8)
|
|
||||||
{
|
|
||||||
currentBit = 0;
|
|
||||||
data[byteIndex] = currentOut;
|
|
||||||
byteIndex++;
|
|
||||||
currentOut = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
using FFXIVClassic_Lobby_Server.common;
|
||||||
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.packets.send.player
|
||||||
|
{
|
||||||
|
class SetCompletedAchievementsPacket
|
||||||
|
{
|
||||||
|
//Achievenments are +1 and up, except for Quests and GCs which is +2
|
||||||
|
public const int CATEGORY_BATTLE = 000;
|
||||||
|
public const int CATEGORY_CHARACTER = 050;
|
||||||
|
public const int CATEGORY_CURRENCY = 200;
|
||||||
|
public const int CATEGORY_ITEMS = 250;
|
||||||
|
public const int CATEGORY_SYNTHESIS = 300;
|
||||||
|
public const int CATEGORY_GATHERING = 400;
|
||||||
|
public const int CATEGORY_MATERIA = 550;
|
||||||
|
public const int CATEGORY_QUESTS = 600;
|
||||||
|
public const int CATEGORY_SEASONAL_EVENTS = 700;
|
||||||
|
public const int CATEGORY_DUNGEONS = 750;
|
||||||
|
public const int CATEGORY_EXPLORATION = 800;
|
||||||
|
public const int CATEGORY_GRAND_COMPANY = 820;
|
||||||
|
|
||||||
|
public const ushort OPCODE = 0x019A;
|
||||||
|
public const uint PACKET_SIZE = 0xA0;
|
||||||
|
|
||||||
|
public bool[] achievementFlags = new bool[1024];
|
||||||
|
|
||||||
|
public SubPacket buildPacket(uint playerActorID)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
byte[] binStream = Utils.ConvertBoolArrayToBinaryStream(achievementFlags);
|
||||||
|
if (binStream.Length <= PACKET_SIZE - 0x20)
|
||||||
|
binWriter.Write(binStream);
|
||||||
|
else
|
||||||
|
Log.error("Failed making SetCompletedAchievements packet. Bin Stream was too big!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
using FFXIVClassic_Lobby_Server.common;
|
||||||
|
using FFXIVClassic_Lobby_Server.packets;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.packets.send.player
|
||||||
|
{
|
||||||
|
class SetCutsceneBookPacket
|
||||||
|
{
|
||||||
|
public const int CATEGORY_BATTLE = 000;
|
||||||
|
public const int CATEGORY_CHARACTER = 050;
|
||||||
|
public const int CATEGORY_CURRENCY = 200;
|
||||||
|
public const int CATEGORY_ITEMS = 250;
|
||||||
|
public const int CATEGORY_SYNTHESIS = 300;
|
||||||
|
public const int CATEGORY_GATHERING = 400;
|
||||||
|
public const int CATEGORY_MATERIA = 550;
|
||||||
|
public const int CATEGORY_QUESTS = 600;
|
||||||
|
public const int CATEGORY_SEASONAL_EVENTS = 700;
|
||||||
|
public const int CATEGORY_DUNGEONS = 750;
|
||||||
|
public const int CATEGORY_EXPLORATION = 800;
|
||||||
|
public const int CATEGORY_GRAND_COMPANY = 820;
|
||||||
|
|
||||||
|
public const ushort OPCODE = 0x01A3;
|
||||||
|
public const uint PACKET_SIZE = 0150;
|
||||||
|
|
||||||
|
public bool[] cutsceneFlags = new bool[2432];
|
||||||
|
|
||||||
|
public SubPacket buildPacket(uint playerActorID)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
byte[] binStream = Utils.ConvertBoolArrayToBinaryStream(cutsceneFlags);
|
||||||
|
if (binStream.Length <= PACKET_SIZE - 0x20)
|
||||||
|
binWriter.Write(binStream);
|
||||||
|
else
|
||||||
|
Log.error("Failed making SetCutsceneBook packet. Bin Stream was too big!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue