1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-20 19:57:46 +00:00

Added some new work parameters. Fixed GC Packet (wrong sized data). Connected player data packets to DB. Cleaned up login code.

This commit is contained in:
Filip Maj 2016-01-16 11:26:35 -05:00
parent 2bf532a6db
commit f7702bca13
16 changed files with 209 additions and 123 deletions

View file

@ -158,7 +158,7 @@ namespace FFXIVClassic_Lobby_Server
}
}
player.charaWork.parameterSave.state_mainSkillLevel = 1;
player.charaWork.parameterSave.state_mainSkillLevel = 49;
/*
//Get level of our classjob
@ -457,9 +457,8 @@ namespace FFXIVClassic_Lobby_Server
}
}
public static SubPacket getLatestAchievements(Player player)
public static void getLatestAchievements(Player player)
{
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)))
{
try
@ -470,7 +469,7 @@ namespace FFXIVClassic_Lobby_Server
string query = @"
SELECT
achievementId
FROM characters_achievements WHERE characterId = @charId ORDER BY timeDone DESC LIMIT 5";
FROM characters_achievements WHERE characterId = @charId ORDER BY timeDone LIMIT 5";
MySqlCommand cmd = new MySqlCommand(query, conn);
cmd.Parameters.AddWithValue("@charId", player.actorId);
@ -478,7 +477,12 @@ namespace FFXIVClassic_Lobby_Server
{
int count = 0;
while (reader.Read())
latestAchievements[count] = reader.GetUInt32(0);
{
player.latestAchievements[count++] = reader.GetUInt32(0);
}
for (; count < player.latestAchievements.Length; count++)
player.latestAchievements[count] = 0;
}
}
catch (MySqlException e)
@ -489,7 +493,6 @@ namespace FFXIVClassic_Lobby_Server
}
}
return SetLatestAchievementsPacket.buildPacket(player.actorId, latestAchievements);
}
public static SubPacket getAchievements(Player player)

View file

@ -64,6 +64,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="actors\chara\npc\NpcWork.cs" />
<Compile Include="actors\chara\AetheryteWork.cs" />
<Compile Include="actors\chara\Work.cs" />
<Compile Include="actors\judge\Judge.cs" />
<Compile Include="actors\StaticActors.cs" />

View file

@ -182,18 +182,12 @@ namespace FFXIVClassic_Lobby_Server
break;
//Unknown
case 0x0002:
BasePacket packet196 = new BasePacket("./packets/196");
BasePacket reply7 = new BasePacket("./packets/login/login7_data.bin");
BasePacket reply8 = new BasePacket("./packets/login/login8_data.bin");
BasePacket reply9 = new BasePacket("./packets/login/login9_zonesetup.bin");
BasePacket reply10 = new BasePacket("./packets/login/login10.bin");
BasePacket reply11 = new BasePacket("./packets/login/login11.bin");
BasePacket reply12 = new BasePacket("./packets/login/login12.bin");
// BasePacket keyitems = new BasePacket("./packets/login/keyitems.bin");
// BasePacket currancy = new BasePacket("./packets/login/currancy.bin");
#region replaceid
//currancy.replaceActorID(player.actorID);
//keyitems.replaceActorID(player.actorID);
@ -233,10 +227,10 @@ namespace FFXIVClassic_Lobby_Server
BasePacket partyListPacket = BasePacket.createPacket(ListUtils.createPartyList(player.actorID, 0xF4, 1, 0x8000000000696df2, partyListEntries), true, false);
client.queuePacket(partyListPacket);
#region itemsetup
////////ITEMS////////
client.queuePacket(InventoryBeginChangePacket.buildPacket(player.actorID), true, false);
#region itemsetup
//TEST
List<Item> items = new List<Item>();
@ -273,14 +267,14 @@ namespace FFXIVClassic_Lobby_Server
setinvPackets.Add(beginInventory);
setinvPackets.Add(setInventory);
setinvPackets.Add(endInventory);
#endregion
client.queuePacket(BasePacket.createPacket(setinvPackets, true, false));
//client.queuePacket(currancy);
//client.queuePacket(keyitems);
#endregion
#region equipsetup
client.queuePacket(BasePacket.createPacket(setinvPackets, true, false));
EquipmentSetupPacket initialEqupmentPacket = new EquipmentSetupPacket();
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_BODY, 5);
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_HEAD, 3);
@ -288,7 +282,6 @@ namespace FFXIVClassic_Lobby_Server
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_UNDERGARMENT, 7);
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_MAINHAND, 2);
initialEqupmentPacket.setItem(EquipmentSetupPacket.SLOT_LEGS, 8);
#endregion
//Equip Init
client.queuePacket(InventorySetBeginPacket.buildPacket(player.actorID, 0x23, InventorySetBeginPacket.CODE_EQUIPMENT), true, false);
@ -298,53 +291,14 @@ namespace FFXIVClassic_Lobby_Server
client.queuePacket(InventoryEndChangePacket.buildPacket(player.actorID), true, false);
////////ITEMS////////
client.queuePacket(SetGrandCompanyPacket.buildPacket(player.actorID, player.actorID, 0x01, 0x1B, 0x1B, 0x1B), true, false);
client.queuePacket(SetPlayerTitlePacket.buildPacket(player.actorID, player.actorID, 0x00), true, false);
client.queuePacket(SetCurrentJobPacket.buildPacket(player.actorID, player.actorID, 0x13), true, false);
//client.queuePacket(packet196);//client.queuePacket(_0x196Packet.buildPacket(player.actorID, player.actorID), true, false);
client.queuePacket(SetChocoboNamePacket.buildPacket(player.actorID, player.actorID, "Boco"), true, false);
client.queuePacket(SetHasChocoboPacket.buildPacket(player.actorID, true), true, false);
client.queuePacket(SetHasGoobbuePacket.buildPacket(player.actorID, true), true, false);
SetCompletedAchievementsPacket cheevos = new SetCompletedAchievementsPacket();
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_BATTLE] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_CHARACTER] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_CURRENCY] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_DUNGEONS] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_EXPLORATION] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_GATHERING] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_GRAND_COMPANY] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_ITEMS] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_MATERIA] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_QUESTS] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_SEASONAL_EVENTS] = true;
cheevos.achievementFlags[SetCompletedAchievementsPacket.CATEGORY_SYNTHESIS] = true;
client.queuePacket(cheevos.buildPacket(player.actorID), true, false);
client.queuePacket(SetLatestAchievementsPacket.buildPacket(player.actorID, new uint[5]), true, false);
client.queuePacket(SetAchievementPointsPacket.buildPacket(player.actorID, 0x00), true, false);
SetCutsceneBookPacket book = new SetCutsceneBookPacket();
for (int i = 0; i < book.cutsceneFlags.Length; i++)
book.cutsceneFlags[i] = true;
client.queuePacket(book.buildPacket(player.actorID), true, false);
//client.queuePacket(SetPlayerDreamPacket.buildPacket(player.actorID, 11), true, false);
#endregion
BasePacket tpacket = player.getActor().getInitPackets(player.actorID);
tpacket.debugPrintPacket();
client.queuePacket(tpacket);
//BasePacket packet1a5 = new BasePacket("./packets/1ax/1a5");
//packet1a5.replaceActorID(player.actorID);
//client.queuePacket(packet1a5);
//loadTest(client, player);
//return;
inn.addActorToZone(player.getActor());
//client.queuePacket(reply7);
client.queuePacket(reply8);
client.queuePacket(reply9);
client.queuePacket(reply10);

View file

@ -227,12 +227,15 @@ namespace FFXIVClassic_Lobby_Server
public void testCodePacket(uint id, uint value, string target)
{
SetActorPropetyPacket changeProperty = new SetActorPropetyPacket(target);
changeProperty.addInt(id, value);
changeProperty.setTarget(target);
changeProperty.addInt(id, value);
changeProperty.addTarget();
foreach (KeyValuePair<uint, ConnectedPlayer> entry in mConnectedPlayerList)
{
SubPacket changePropertyPacket = changeProperty.buildPacket((entry.Value.actorID), (entry.Value.actorID));
BasePacket packet = BasePacket.createPacket(changePropertyPacket, true, false);
packet.debugPrintPacket();
if (entry.Value.getConnection1() != null)

View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class AetheryteWork
{
public int iconGil;
public short guildleveId;
public short clearTime;
public int missionBonus;
public int difficultyBonus;
public byte factionNumber;
public int factionBonus;
public byte factionCredit;
public int glRewardItem;
public int glRewardNumber;
public int glRewardSubItem;
public int glRewardSubNumber;
public byte difficulty;
}
}

View file

@ -9,10 +9,11 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
class BattleSave
{
public float potencial = 6.6f;
public int skillLevel;
public int skillLevelCap;
public int[] skillPoint;
public short[] skillLevel = new short[52];
public short[] skillLevelCap = new short[52];
public short[] skillPoint = new short[52];
public short physicalLevel;
public int physicalExp;
public bool[] negotiationFlag= new bool[2];

View file

@ -49,6 +49,6 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public float[] castGauge_speed = { 1.0f, 0.25f};
public bool[] timingCommandFlag = new bool[4];
public ushort[] generalParameter = new ushort[32];
public ushort[] generalParameter = new ushort[35];
}
}

View file

@ -18,17 +18,21 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public EventSave eventSave = new EventSave();
public EventTemp eventTemp = new EventTemp();
public bool gameParameter = false;
public byte[] property = new byte[32];
public ushort[] status = new ushort[20];
public uint[] statusShownTime = new uint[20];
public uint[] command = new uint[64];
public uint[] command = new uint[64]; //ACTORS
public byte[] commandCategory = new byte[64];
public byte commandBorder = 0x20;
public bool commandAcquired = false;
public bool[] additionalCommandAcquired = new bool[32];
public bool[] commandAcquired = new bool[4096];
public bool[] additionalCommandAcquired = new bool[36];
public uint currentContentGroup;
public uint depictionJudge = 0xa0f50911;
}
}

View file

@ -10,6 +10,6 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
{
public bool bazaar;
public byte bazaarTax;
public int repairType;
public byte repairType;
}
}

View file

@ -8,19 +8,30 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class ParameterSave
{
public short[] hp = new short[1];
public short[] hpMax = new short[1];
public short[] hp = new short[8];
public short[] hpMax = new short[8];
public short mp;
public short mpMax;
public byte[] state_mainSkill = new byte[4];
public ushort state_mainSkillLevel;
public int[] state_boostPointForSkill;
public byte[] state_boostPointForSkill = new byte[4];
public bool[] commandSlot_compatibility = new bool[40];
public uint[] commandSlot_recastTime = new uint[40];
public bool[] commandSlot_compatibility = new bool[40];
public int[] giftCommandSlot_commandId;
public ushort[] giftCommandSlot_commandId = new ushort[10];
public ushort[] constanceCommandSlot_commandId = new ushort[10];
public byte abilityCostPoint_used;
public byte abilityCostPoint_max;
public byte giftCostPoint_used;
public byte giftCostPoint_max;
public byte constanceCostPoint_used;
public byte constanceCostPoint_max;
}
}

View file

@ -12,12 +12,12 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public int targetInformation = 0;
public int[] maxCommandRecastTime = new int[40];
public ushort[] maxCommandRecastTime = new ushort[40];
public float[] forceControl_float_forClientSelf = { 1.0f, 1.0f};
public float[] forceControl_float_forClientSelf = { 1.0f, 1.0f, 0.0f, 0.0f};
public short[] forceControl_int16_forClientSelf = { -1, -1 };
public int[] otherClassAbilityCount = new int[2];
public int[] giftCount = new int[2];
public byte[] otherClassAbilityCount = new byte[2];
public byte[] giftCount = new byte[2];
}
}

View file

@ -11,6 +11,9 @@ namespace FFXIVClassic_Map_Server.actors.chara
public ushort[] guildleveId = new ushort[16];
public bool[] guildleveDone = new bool[16];
public bool[] guildleveChecked = new bool[16];
public bool betacheck = false;
public bool[] event_achieve_aetheryte = new bool[512];
}
}

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FFXIVClassic_Map_Server.dataobjects.chara
{
class NpcWork
{
public short pushCommand;
public int pushCommandSub;
public byte pushCommandPriority;
public byte hateType;
}
}

View file

@ -3,6 +3,7 @@ using FFXIVClassic_Lobby_Server.common;
using FFXIVClassic_Lobby_Server.packets;
using FFXIVClassic_Map_Server.lua;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.packets.send.player;
using FFXIVClassic_Map_Server.utils;
using MySql.Data.MySqlClient;
using System;
@ -39,6 +40,8 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public uint[] timers = new uint[20];
public ushort currentJob;
public uint currentTitle;
public byte gcCurrent;
@ -52,7 +55,7 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public string chocoboName;
public uint achievementPoints;
public ushort[] latestAchievements = new ushort[5];
public uint[] latestAchievements = new uint[5];
public PlayerWork playerWork = new PlayerWork();
@ -85,25 +88,19 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
charaWork.command[15] = 0xA0F00000 | 22015;
charaWork.command[32] = 0xA0F00000 | 27155;
charaWork.command[33] = 0xA0F00000 | 27150;
//charaWork.command[33] = 0xA0F00000 | 27150;
charaWork.command[34] = 0xA0F00000 | 27300;
charaWork.command[61] = 0xA0F00000 | 27300;
charaWork.command[36] = 0xA0F00000 | 27300;
//charaWork.command[35] = 0xA0F00000 | 27300;
//charaWork.command[35] = 0xA0F00000 | 27300;
charaWork.commandAcquired[27150 - 26000] = true;
/*
charaWork.additionalCommandAcquired[0] = true;
charaWork.additionalCommandAcquired[12] = true;
charaWork.additionalCommandAcquired[22] = true;
charaWork.additionalCommandAcquired[25] = true;
charaWork.additionalCommandAcquired[28] = true;
charaWork.additionalCommandAcquired[30] = true;
playerWork.questScenarioComplete[110001 - 110001] = true;
playerWork.questGuildleveComplete[120050 - 120001] = true;
charaWork.commandCategory[0] = 1;
charaWork.commandCategory[1] = 1;
*/
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++ )
charaWork.additionalCommandAcquired[i] = true;
for (int i = 0; i < charaWork.commandCategory.Length; i++)
charaWork.commandCategory[i] = 1;
charaWork.battleTemp.generalParameter[3] = 1;
@ -113,6 +110,8 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
charaWork.commandBorder = 0x20;
Database.loadPlayerCharacter(this);
Database.getLatestAchievements(this);
}
public List<SubPacket> create0x132Packets(uint playerActorId)
@ -158,10 +157,62 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
subpackets.Add(createInitStatusPacket(playerActorId));
subpackets.Add(createSetActorIconPacket(playerActorId));
subpackets.Add(createIsZoneingPacket(playerActorId));
subpackets.AddRange(createPlayerRelatedPackets(playerActorId));
subpackets.Add(createScriptBindPacket(playerActorId));
return BasePacket.createPacket(subpackets, true, false);
}
public List<SubPacket> createPlayerRelatedPackets(uint playerActorId)
{
List<SubPacket> subpackets = new List<SubPacket>();
if (gcCurrent != 0)
subpackets.Add(SetGrandCompanyPacket.buildPacket(actorId, playerActorId, gcCurrent, gcRankLimsa, gcRankGridania, gcRankUldah));
if (currentTitle != 0)
subpackets.Add(SetPlayerTitlePacket.buildPacket(actorId, playerActorId, currentTitle));
if (currentJob != 0)
subpackets.Add(SetCurrentJobPacket.buildPacket(actorId, playerActorId, currentJob));
if (isMyPlayer(playerActorId))
{
subpackets.Add(_0x196Packet.buildPacket(playerActorId, playerActorId));
if (hasChocobo && chocoboName != null && !chocoboName.Equals(""))
{
subpackets.Add(SetChocoboNamePacket.buildPacket(actorId, playerActorId, chocoboName));
subpackets.Add(SetHasChocoboPacket.buildPacket(playerActorId, hasChocobo));
}
if (hasGoobbue)
subpackets.Add(SetHasGoobbuePacket.buildPacket(playerActorId, hasGoobbue));
subpackets.Add(SetAchievementPointsPacket.buildPacket(playerActorId, achievementPoints));
subpackets.Add(SetLatestAchievementsPacket.buildPacket(playerActorId, latestAchievements));
SetCompletedAchievementsPacket cheevos = new SetCompletedAchievementsPacket();
for (int i = 0; i < cheevos.achievementFlags.Length; i++)
cheevos.achievementFlags[i] = true;
subpackets.Add(cheevos.buildPacket(playerActorId));
/*
if (isInn)
{
SetCutsceneBookPacket book = new SetCutsceneBookPacket();
for (int i = 0; i < book.cutsceneFlags.Length; i++)
book.cutsceneFlags[i] = true;
client.queuePacket(book.buildPacket(player.actorID), true, false);
//
//subpackets.Add(SetPlayerDreamPacket.buildPacket(playerActorId, );
}
*/
}
return subpackets;
}
public override BasePacket getInitPackets(uint playerActorId)
{
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("/_init", this, playerActorId);
@ -192,12 +243,6 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
propPacketUtil.addProperty(String.Format("charaWork.statusShownTime[{0}]", i));
}
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++)
{
if (charaWork.additionalCommandAcquired[i] != false)
propPacketUtil.addProperty(String.Format("charaWork.additionalCommandAcquired[{0}]", i));
}
//General Parameters
for (int i = 3; i < charaWork.battleTemp.generalParameter.Length; i++)
{
@ -213,26 +258,42 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
//Commands
propPacketUtil.addProperty("charaWork.commandBorder");
for (int i = 0; i < charaWork.command.Length; i++)
{
if (charaWork.command[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.command[{0}]", i));
}
/*
for (int i = 0; i < charaWork.commandCategory.Length; i++)
{
charaWork.commandCategory[i] = 1;
if (charaWork.commandCategory[i] != 0)
propPacketUtil.addProperty(String.Format("charaWork.commandCategory[{0}]", i));
}
for (int i = 0; i < charaWork.commandAcquired.Length; i++)
{
if (charaWork.commandAcquired[i] != false)
propPacketUtil.addProperty(String.Format("charaWork.commandAcquired[{0}]", i));
}
*/
for (int i = 0; i < charaWork.additionalCommandAcquired.Length; i++)
{
if (charaWork.additionalCommandAcquired[i] != false)
propPacketUtil.addProperty(String.Format("charaWork.additionalCommandAcquired[{0}]", i));
}
for (int i = 0; i < charaWork.parameterSave.commandSlot_compatibility.Length; i++)
{
charaWork.parameterSave.commandSlot_compatibility[i] = true;
if (charaWork.parameterSave.commandSlot_compatibility[i])
propPacketUtil.addProperty(String.Format("charaWork.parameterSave.commandSlot_compatibility[{0}]", i));
}
/*
for (int i = 0; i < charaWork.parameterSave.commandSlot_recastTime.Length; i++)
{
if (charaWork.parameterSave.commandSlot_recastTime[i] != 0)

View file

@ -14,13 +14,13 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public byte birthdayDay;
public byte initialTown;
public int restBonusExpRate;
public float restBonusExpRate = 1.5f;
public uint[] questScenario = new uint[16];
public uint[] questGuildleve = new uint[8];
public int questScenarioComplete;
public int questGuildleveComplete;
public bool[] questScenarioComplete = new bool[2048];
public bool[] questGuildleveComplete = new bool[2048];
public bool isContentsCommand;
@ -28,7 +28,7 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public int castEndClient;
public int[] comboNextCommandId = new int[2];
public int comboCostBonusRate;
public float comboCostBonusRate;
public bool isRemainBonusPoint;
@ -36,15 +36,15 @@ namespace FFXIVClassic_Map_Server.dataobjects.chara
public bool[] npcLinkshellChatExtra = new bool[64];
public int variableCommandConfirmWarp;
public int variableCommandConfirmWarpSender;
public string variableCommandConfirmWarpSender;
public int variableCommandConfirmWarpSenderByID;
public int variableCommandConfirmWarpSenderSex;
public byte variableCommandConfirmWarpSenderSex;
public int variableCommandConfirmWarpPlace;
public int variableCommandConfirmRaise;
public int variableCommandConfirmRaiseSender;
public string variableCommandConfirmRaiseSender;
public int variableCommandConfirmRaiseSenderByID;
public int variableCommandConfirmRaiseSenderSex;
public byte variableCommandConfirmRaiseSenderSex;
public int variableCommandConfirmRaisePlace;
}

View file

@ -21,10 +21,10 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
{
using (BinaryWriter binWriter = new BinaryWriter(mem))
{
binWriter.Write((UInt16)currentAllegiance);
binWriter.Write((UInt16)rankLimsa);
binWriter.Write((UInt16)rankGridania);
binWriter.Write((UInt16)rankUldah);
binWriter.Write((Byte)currentAllegiance);
binWriter.Write((Byte)rankLimsa);
binWriter.Write((Byte)rankGridania);
binWriter.Write((Byte)rankUldah);
}
}