mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04: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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user