From d6a2517efbee0a7680ff57ef78aa23c5d8ffb9f8 Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Wed, 26 Sep 2018 03:22:30 +1000 Subject: [PATCH 01/24] Add Shared Estate Settings PacketDef and ClientTrigger --- src/common/Network/CommonActorControl.h | 2 ++ src/common/Network/PacketDef/Ipcs.h | 4 ++++ .../Network/PacketDef/Zone/ServerZoneDef.h | 21 +++++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/common/Network/CommonActorControl.h b/src/common/Network/CommonActorControl.h index 8dc22704..588afba0 100644 --- a/src/common/Network/CommonActorControl.h +++ b/src/common/Network/CommonActorControl.h @@ -287,6 +287,8 @@ enum ClientTriggerType AchievementCritReq = 0x3E8, AchievementList = 0x3E9, + RequestSharedEstateSettings = 0x46F, + CompanionAction = 0x6A4, CompanionSetBarding = 0x6A5, CompanionActionUnlock = 0x6A6, diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 42166f17..4d1c1360 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -187,6 +187,8 @@ enum ServerZoneIpcType : WardHousingPermission = 0x0229, // updated 4.4 WardYardInfo = 0x022B, // updated 4.4 + SharedEstateSettingsResponse = 0x023C, // updated 4.4 + DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui PerformNote = 0x0286, // updated 4.3 @@ -280,6 +282,8 @@ enum ClientZoneIpcType : LinkshellEventHandler = 0x0150, // updated 4.1 ?? LinkshellEventHandler1 = 0x0151, // updated 4.1 ?? + SetSharedEstateSettings = 0x0177, // updated 4.4 + PerformNoteHandler = 0x029B, // updated 4.3 ReqEquipDisplayFlagsChange = 0x016F, // updated 4.4 diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index cc26c3e1..a0d625b6 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1592,6 +1592,27 @@ struct FFXIVIpcWardYardInfo : } object[100]; }; +/** +* Structural representation of the packet sent by the server +* to show the shared estate settings +*/ +struct FFXIVIpcActorFreeSpawn : + FFXIVIpcBasePacket< SharedEstateSettingsResponse > +{ + uint64_t char1ContentId; + uint8_t char1Permissions; + char char1Name[0x20]; + char padding1[0x7]; + uint64_t char2ContentId; + uint8_t char2Permissions; + char char2Name[0x20]; + char padding2[0x7]; + uint64_t char3ContentId; + uint8_t char3Permissions; + char char3Name[0x20]; + char padding3[0x7]; +}; + struct FFXIVIpcMSQTrackerProgress : FFXIVIpcBasePacket< MSQTrackerProgress > { From 219c06632f840e9a6121e8bcbf7c211abe2d39b6 Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Wed, 26 Sep 2018 03:23:31 +1000 Subject: [PATCH 02/24] Should mention it's the current --- src/common/Network/PacketDef/Zone/ServerZoneDef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index a0d625b6..0cf87f85 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1594,7 +1594,7 @@ struct FFXIVIpcWardYardInfo : /** * Structural representation of the packet sent by the server -* to show the shared estate settings +* to show the current shared estate settings */ struct FFXIVIpcActorFreeSpawn : FFXIVIpcBasePacket< SharedEstateSettingsResponse > From 38d4ea25de6da51f8b38ca4c804a0f8ffa6f8b5c Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Wed, 26 Sep 2018 03:32:05 +1000 Subject: [PATCH 03/24] oops forgot the ClientDef --- src/common/Network/PacketDef/Zone/ClientZoneDef.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/common/Network/PacketDef/Zone/ClientZoneDef.h b/src/common/Network/PacketDef/Zone/ClientZoneDef.h index 3f751d4f..c5552526 100644 --- a/src/common/Network/PacketDef/Zone/ClientZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ClientZoneDef.h @@ -183,6 +183,20 @@ struct FFXIVIpcInventoryModifyHandler : /* 0028 */ uint32_t splitCount; }; +struct FFXIVIpcSetSharedEstateSettings : + FFXIVIpcBasePacket< SetSharedEstateSettings > +{ + /* 0000 */ uint64_t char1ContentId; + /* 0008 */ uint64_t char2ContentId; + /* 0010 */ uint64_t char3ContentId; + /* 0018 */ uint8_t char1Permissions; + /* 0019 */ char padding1[0x7]; + /* 0020 */ uint8_t char2Permissions; + /* 0021 */ char padding2[0x7]; + /* 0028 */ uint8_t char3Permissions; + /* 0029 */ char padding3[0x7]; +}; + } } } From eef05e4a1038032577f652c307f04119e02cecb4 Mon Sep 17 00:00:00 2001 From: goaaats Date: Tue, 2 Oct 2018 00:39:34 +0200 Subject: [PATCH 04/24] Fix EorzeaTimeOffset --- src/common/Network/PacketDef/Ipcs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 42166f17..2afb4324 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -179,7 +179,7 @@ enum ServerZoneIpcType : PlayerTitleList = 0x01FD, // updated 4.4 Discovery = 0x01FE, // updated 4.4 - EorzeaTimeOffset = 0x01FF, // updated 4.4 + EorzeaTimeOffset = 0x0200, // updated 4.4 EquipDisplayFlags = 0x020C, // updated 4.4 From 8e475a092a9252580e9779e5997de46d4a6e40db Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Wed, 3 Oct 2018 01:22:43 +1000 Subject: [PATCH 05/24] Added some moogle mail defs --- src/common/Network/PacketDef/Ipcs.h | 5 +++ .../Network/PacketDef/Zone/ServerZoneDef.h | 37 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 42166f17..fcdfeee9 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -98,6 +98,11 @@ enum ServerZoneIpcType : LogMessage = 0x00D0, LinkshellList = 0x0117, // updated 4.4 + + MailDeleteRequest = 0x0118, // updated 4.4 + ReqMoogleMailList = 0x0119, // updated 4.4 + ReqMoogleMailLetter = 0x01A, // updated 4.4 + MailLetterNotification = 0x011B, // updated 4.4 ExamineFreeCompanyInfo = 0x013A, // updated 4.1 CharaFreeCompanyTag = 0x0127, // updated 4.4 diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index cc26c3e1..c6202853 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -210,6 +210,43 @@ struct FFXIVIpcLinkshellList : } entry[8]; }; +/** +* Structural representation of the packet sent by the server +* to send a list of mail the player has +*/ +struct FFXIVIpcReqMoogleMailList : + FFXIVIpcBasePacket< ReqMoogleMailList > +{ + struct letterEntry { + char unk[0x8]; + uint32_t timeStamp; // The time the mail was sent (this also seems to be used as a Id) + char unk1[0x30]; // This should be items, gil, etc for the letter + uint8_t read; // 0 = false | 1 = true + uint8_t type; // 0 = Friends | 1 = Rewards | 2 = GM + uint8_t unk2; + char senderName[0x20]; // The name of the sender + char summary[0x3C]; // The start of the full letter text + char padding2[0x5]; + } letter[5]; + char unk3[0x08]; +}; + +/** +* Structural representation of the packet sent by the server +* to show the mail delivery notification +*/ +struct FFXIVIpcMailLetterNotificationt : + FFXIVIpcBasePacket< MailLetterNotification > +{ + uint32_t sendbackCount; // The amount of letters sent back since you ran out of room (moogle dialog changes based on this) + uint16_t friendLetters; // The amount of letters in the friends section of the letterbox + uint16_t unreadCount; // The amount of unreads in the letterbox (this is the number that shows up) + uint16_t rewardLetters; // The amount of letters in the rewards section of the letterbox + uint8_t isGmLetter; // Makes the letter notification flash red + uint8_t isSupportDesk; // After setting this to 1 we can no longer update mail notifications (more research needed on the support desk) + char unk2[0x4]; // This has probs something to do with the support desk (inquiry id?) +}; + struct FFXIVIpcExamineFreeCompanyInfo : FFXIVIpcBasePacket< ExamineFreeCompanyInfo > { From faa8e05a8d05e947ffcc4d53a0e36a1648664d85 Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Wed, 3 Oct 2018 01:58:58 +1000 Subject: [PATCH 06/24] Fixed WardYardInfo for Vox --- src/common/Network/PacketDef/Ipcs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index fcdfeee9..c06b1505 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -190,7 +190,7 @@ enum ServerZoneIpcType : WardInfo = 0x0220, // updated 4.4 WardHousingPermission = 0x0229, // updated 4.4 - WardYardInfo = 0x022B, // updated 4.4 + WardYardInfo = 0x022C, // updated 4.4 DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui PerformNote = 0x0286, // updated 4.3 From 2668674b311bd0f1150523615400fd32f6f56cc8 Mon Sep 17 00:00:00 2001 From: Biscuit Boy Date: Fri, 5 Oct 2018 19:22:12 +1000 Subject: [PATCH 07/24] mmm fresh new line --- src/common/Network/PacketDef/Zone/ServerZoneDef.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index c6202853..7b679901 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -217,7 +217,8 @@ struct FFXIVIpcLinkshellList : struct FFXIVIpcReqMoogleMailList : FFXIVIpcBasePacket< ReqMoogleMailList > { - struct letterEntry { + struct letterEntry + { char unk[0x8]; uint32_t timeStamp; // The time the mail was sent (this also seems to be used as a Id) char unk1[0x30]; // This should be items, gil, etc for the letter From 037b98f25b43fde7791643ef9876208250943020 Mon Sep 17 00:00:00 2001 From: Biscuit Date: Thu, 11 Oct 2018 15:44:15 +1100 Subject: [PATCH 08/24] derp, they should be in their own struct --- .../Network/PacketDef/Zone/ServerZoneDef.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 0cf87f85..b786e13c 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1599,18 +1599,12 @@ struct FFXIVIpcWardYardInfo : struct FFXIVIpcActorFreeSpawn : FFXIVIpcBasePacket< SharedEstateSettingsResponse > { - uint64_t char1ContentId; - uint8_t char1Permissions; - char char1Name[0x20]; - char padding1[0x7]; - uint64_t char2ContentId; - uint8_t char2Permissions; - char char2Name[0x20]; - char padding2[0x7]; - uint64_t char3ContentId; - uint8_t char3Permissions; - char char3Name[0x20]; - char padding3[0x7]; + struct playerEntry { + uint64_t contentId; + uint8_t permissions; + char name[0x20]; + char padding[0x7]; + } entry[3]; }; struct FFXIVIpcMSQTrackerProgress : From 0b285c409117b016f56afae0cd9e9659d2f513fd Mon Sep 17 00:00:00 2001 From: Biscuit Date: Thu, 11 Oct 2018 16:09:53 +1100 Subject: [PATCH 09/24] Fixed Level up / Fixed Build --- src/common/Network/PacketDef/Ipcs.h | 4 ++-- src/common/Network/PacketDef/Zone/ServerZoneDef.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 4d1c1360..c2d9c6dd 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -127,7 +127,7 @@ enum ServerZoneIpcType : ObjectSpawn = 0x0179, // updated 4.4 ObjectDespawn = 0x017A, // updated 4.4 - SetLevelSync = 0x017B, // updated 4.4 + UpdateClassInfo = 0x017B, // updated 4.4 SilentSetClassJob = 0x017C, // updated 4.4 - seems to be the case, not sure if it's actually used for anything InitUI = 0x017D, // updated 4.4 @@ -138,7 +138,7 @@ enum ServerZoneIpcType : ModelEquip = 0x0182, // updated 4.4 Examine = 0x0183, // updated 4.4 CharaNameReq = 0x0185, // updated 4.4 - UpdateClassInfo = 0x0186, // updated 4.4 + SetLevelSync = 0x0186, // not updated for 4.4, not sure what it is anymore ItemInfo = 0x018C, // updated 4.4 ContainerInfo = 0x018D, // updated 4.4 diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index b786e13c..1fb94f8b 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1596,7 +1596,7 @@ struct FFXIVIpcWardYardInfo : * Structural representation of the packet sent by the server * to show the current shared estate settings */ -struct FFXIVIpcActorFreeSpawn : +struct FFXIVIpcSharedEstateSettingsResponse : FFXIVIpcBasePacket< SharedEstateSettingsResponse > { struct playerEntry { From 6bc0512fa4189ed85cfa9407f36f8179e1052df3 Mon Sep 17 00:00:00 2001 From: Biscuit Date: Thu, 11 Oct 2018 17:15:52 +1100 Subject: [PATCH 10/24] I WAS SO CLOSE --- src/common/Network/PacketDef/Zone/ServerZoneDef.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 1fb94f8b..b4115dc4 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1599,7 +1599,8 @@ struct FFXIVIpcWardYardInfo : struct FFXIVIpcSharedEstateSettingsResponse : FFXIVIpcBasePacket< SharedEstateSettingsResponse > { - struct playerEntry { + struct playerEntry + { uint64_t contentId; uint8_t permissions; char name[0x20]; From 23c288489f0a18472409b4384924d8f5b61343bc Mon Sep 17 00:00:00 2001 From: Biscuit Date: Sun, 14 Oct 2018 12:52:06 +1100 Subject: [PATCH 11/24] Update GMCommand 1 and 2 Defs --- .../Network/PacketDef/Zone/ClientZoneDef.h | 14 +++++++--- .../Network/Handlers/GMCommandHandlers.cpp | 26 +++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/common/Network/PacketDef/Zone/ClientZoneDef.h b/src/common/Network/PacketDef/Zone/ClientZoneDef.h index c5552526..f973bfa7 100644 --- a/src/common/Network/PacketDef/Zone/ClientZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ClientZoneDef.h @@ -15,16 +15,22 @@ struct FFXIVIpcGmCommand1 : /* 0000 */ uint32_t commandId; /* 0004 */ uint32_t param1; /* 0008 */ uint32_t param2; - /* 000C */ uint8_t unknown_C[0xC]; - /* 0018 */ uint32_t param3; + /* 000C */ uint32_t param3; + /* 0010 */ uint32_t param4; + /* 0014 */ uint32_t unknown1; + /* 0018 */ uint32_t target; }; struct FFXIVIpcGmCommand2 : FFXIVIpcBasePacket< GMCommand2 > { /* 0000 */ uint32_t commandId; - /* 0004 */ char unk_4[0x10]; - /* 0014 */ char param1[0x20]; + /* 0004 */ uint32_t param1; + /* 0008 */ uint32_t param2; + /* 000C */ uint32_t param3; + /* 0010 */ uint32_t param4; + /* 0014 */ char target[0x20]; + /* 0034 */ uint32_t unknown1; }; struct FFXIVIpcClientTrigger : diff --git a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp index 7a9a23f3..b0e9d0eb 100644 --- a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp @@ -98,16 +98,19 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R const auto& param1 = packet.data().param1; const auto& param2 = packet.data().param2; const auto& param3 = packet.data().param3; + const auto& param4 = packet.data().param4; + const auto& target = packet.data().target; auto pLog = g_fw.get< Logger >(); pLog->debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) + ", params: " + std::to_string( param1 ) + ", " + - std::to_string( param2 ) + ", " + std::to_string( param3 ) ); + std::to_string( param2 ) + ", " + std::to_string( param3 ) + ", " + std::to_string( param4 ) + + ", target: " + std::to_string( target ) ); Core::Entity::ActorPtr targetActor; - if( player.getId() == param3 ) + if( player.getId() == target ) { targetActor = player.getAsPlayer(); } @@ -116,7 +119,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R auto inRange = player.getInRangeActors(); for( auto& actor : inRange ) { - if( actor->getId() == param3 ) + if( actor->getId() == target ) targetActor = actor; } } @@ -506,11 +509,18 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand2 >( inPacket ); const auto& commandId = packet.data().commandId; - const auto& param1 = std::string( packet.data().param1 ); + const auto& param1 = packet.data().param1; + const auto& param2 = packet.data().param2; + const auto& param3 = packet.data().param3; + const auto& param4 = packet.data().param4; + const auto& target = std::string( packet.data().target ); - pLog->debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 ); + pLog->debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + + ", params: " + std::to_string( param1 ) + ", " + + std::to_string( param2 ) + ", " + std::to_string( param3 ) + ", " + std::to_string( param4 ) + + ", target: " + target ); - auto targetSession = pServerZone->getSession( param1 ); + auto targetSession = pServerZone->getSession( target ); Core::Entity::CharaPtr targetActor; if( targetSession != nullptr ) @@ -519,13 +529,13 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R } else { - if( param1 == "self" ) + if( target == "self" ) { targetActor = player.getAsPlayer(); } else { - player.sendUrgent( "Player " + param1 + " not found on this server." ); + player.sendUrgent( "Player " + target + " not found on this server." ); return; } } From c224967480ab5d27c8b3d50a68dae9b7c98ba2d0 Mon Sep 17 00:00:00 2001 From: Biscuit Date: Sun, 14 Oct 2018 13:03:15 +1100 Subject: [PATCH 12/24] Fix /playtime --- src/common/Network/PacketDef/Ipcs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index c2d9c6dd..6d1f142b 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -64,6 +64,7 @@ enum ServerZoneIpcType : /////////////////////////////////////////////////// ChatBanned = 0x006B, + Playtime = 0x006C, // updated 4.4 Logout = 0x0077, // updated 4.4 CFNotify = 0x0078, CFMemberStatus = 0x0079, @@ -78,7 +79,6 @@ enum ServerZoneIpcType : - Playtime = 0x00F5, // updated 4.3 Chat = 0x00F4, // updated 4.4 SocialList = 0x00FB, // updated 4.4 From e569ffd809d1787f567b1b8e3a374fc5d8ace26d Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sun, 14 Oct 2018 18:33:16 +1100 Subject: [PATCH 13/24] ReqServiceAccountList -> ClientVersionInfo --- src/common/Network/PacketDef/Ipcs.h | 2 +- src/servers/sapphire_lobby/GameConnection.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index 61ab5deb..8dd3de06 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -33,7 +33,7 @@ enum ClientLobbyIpcType : { ReqCharList = 0x0003, ReqEnterWorld = 0x0004, - ReqServiceAccountList = 0x0005, + ClientVersionInfo = 0x0005, ReqCharDelete = 0x000A, ReqCharCreate = 0x000B, diff --git a/src/servers/sapphire_lobby/GameConnection.cpp b/src/servers/sapphire_lobby/GameConnection.cpp index ce47eee1..10182e56 100644 --- a/src/servers/sapphire_lobby/GameConnection.cpp +++ b/src/servers/sapphire_lobby/GameConnection.cpp @@ -404,8 +404,9 @@ void Core::Network::GameConnection::handleGamePacket( Packets::FFXIVARR_PACKET_R switch( *reinterpret_cast< uint16_t* >( &packet.data[ 2 ] ) ) { - case ReqServiceAccountList: + case ClientVersionInfo: { + // todo: validate client version based on sha1 or gamever/bootver sendServiceAccountList( packet, tmpId ); } break; From 638b84d31de73178a200e2707f64991067d9e6db Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sun, 14 Oct 2018 19:20:06 +1100 Subject: [PATCH 14/24] fix some compiler warnings --- src/common/Database/DbConnection.cpp | 2 +- src/servers/sapphire_zone/Actor/BNpc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/Database/DbConnection.cpp b/src/common/Database/DbConnection.cpp index 3eb7a4d5..7a27717c 100644 --- a/src/common/Database/DbConnection.cpp +++ b/src/common/Database/DbConnection.cpp @@ -207,7 +207,7 @@ boost::shared_ptr< Mysql::PreparedStatement > Core::Db::DbConnection::getPrepare assert( index < m_stmts.size() ); auto ret = m_stmts[ index ]; if( !ret ) - nullptr; + return nullptr; return ret; } diff --git a/src/servers/sapphire_zone/Actor/BNpc.h b/src/servers/sapphire_zone/Actor/BNpc.h index b5ef8bcd..c1679887 100644 --- a/src/servers/sapphire_zone/Actor/BNpc.h +++ b/src/servers/sapphire_zone/Actor/BNpc.h @@ -31,7 +31,7 @@ public: void spawn( PlayerPtr pTarget ) override; uint16_t getModelChara() const; - uint8_t getLevel() const; + uint8_t getLevel() const override; uint32_t getBNpcBaseId() const; uint32_t getBNpcNameId() const; From dbbd6bb530bdb19952a1d86e6365dd3616ecce3a Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sun, 14 Oct 2018 23:31:52 +1100 Subject: [PATCH 15/24] cleanup unnecessary refs --- .../Network/Handlers/ActionHandler.cpp | 8 ++--- .../Network/Handlers/ClientTriggerHandler.cpp | 12 +++---- .../Network/Handlers/EventHandlers.cpp | 36 +++++++++---------- .../Network/Handlers/GMCommandHandlers.cpp | 12 +++---- .../Network/Handlers/InventoryHandler.cpp | 12 +++---- .../Network/Handlers/PacketHandlers.cpp | 12 +++---- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp index ed82ae61..fd7bb69f 100644 --- a/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/ActionHandler.cpp @@ -41,10 +41,10 @@ void Core::Network::GameConnection::actionHandler( const Packets::FFXIVARR_PACKE { const auto packet = ZoneChannelPacket< Client::FFXIVIpcSkillHandler >( inPacket ); - const auto& type = packet.data().type; - const auto& action = packet.data().actionId; - const auto& useCount = packet.data().useCount; - const auto& targetId = packet.data().targetId; + const auto type = packet.data().type; + const auto action = packet.data().actionId; + const auto useCount = packet.data().useCount; + const auto targetId = packet.data().targetId; player.sendDebug( "Skill type:" + std::to_string( type ) ); diff --git a/src/servers/sapphire_zone/Network/Handlers/ClientTriggerHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/ClientTriggerHandler.cpp index 374a6d64..b2d6a7f9 100644 --- a/src/servers/sapphire_zone/Network/Handlers/ClientTriggerHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/ClientTriggerHandler.cpp @@ -65,12 +65,12 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR const auto packet = ZoneChannelPacket< Client::FFXIVIpcClientTrigger >( inPacket ); - const auto& commandId = packet.data().commandId; - const auto& param1 = *reinterpret_cast< const uint64_t* >( &packet.data().param11 ); - const auto& param11 = packet.data().param11; - const auto& param12 = packet.data().param12; - const auto& param2 = packet.data().param2; - const auto& param3 = packet.data().param3; + const auto commandId = packet.data().commandId; + const auto param1 = *reinterpret_cast< const uint64_t* >( &packet.data().param11 ); + const auto param11 = packet.data().param11; + const auto param12 = packet.data().param12; + const auto param2 = packet.data().param2; + const auto param3 = packet.data().param3; pLog->debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " + boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) + diff --git a/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp index 9298a673..2700cf49 100644 --- a/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/EventHandlers.cpp @@ -39,8 +39,8 @@ void Core::Network::GameConnection::eventHandlerTalk( const Packets::FFXIVARR_PA const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerTalk >( inPacket ); - const auto& actorId = packet.data().actorId; - const auto& eventId = packet.data().eventId; + const auto actorId = packet.data().actorId; + const auto eventId = packet.data().eventId; auto eventType = static_cast< uint16_t >( eventId >> 16 ); @@ -84,9 +84,9 @@ void Core::Network::GameConnection::eventHandlerEmote( const Packets::FFXIVARR_P const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerEmote >( inPacket ); - const auto& actorId = packet.data().actorId; - const auto& eventId = packet.data().eventId; - const auto& emoteId = packet.data().emoteId; + const auto actorId = packet.data().actorId; + const auto eventId = packet.data().eventId; + const auto emoteId = packet.data().emoteId; const auto eventType = static_cast< uint16_t >( eventId >> 16 ); std::string eventName = "onEmote"; @@ -122,8 +122,8 @@ void Core::Network::GameConnection::eventHandlerWithinRange( const Packets::FFXI const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerWithinRange >( inPacket ); - const auto& eventId = packet.data().eventId; - const auto& param1 = packet.data().param1; + const auto eventId = packet.data().eventId; + const auto param1 = packet.data().param1; const auto& pos = packet.data().position; std::string eventName = "onWithinRange"; @@ -144,8 +144,8 @@ void Core::Network::GameConnection::eventHandlerOutsideRange( const Packets::FFX auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >(); const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerOutsideRange >( inPacket ); - const auto& eventId = packet.data().eventId; - const auto& param1 = packet.data().param1; + const auto eventId = packet.data().eventId; + const auto param1 = packet.data().param1; const auto& pos = packet.data().position; std::string eventName = "onOutsideRange"; @@ -167,9 +167,9 @@ void Core::Network::GameConnection::eventHandlerEnterTerritory( const Packets::F const auto packet = ZoneChannelPacket< Client::FFXIVIpcEnterTerritoryHandler >( inPacket ); - const auto& eventId = packet.data().eventId; - const auto& param1 = packet.data().param1; - const auto& param2 = packet.data().param2; + const auto eventId = packet.data().eventId; + const auto param1 = packet.data().param1; + const auto param2 = packet.data().param2; std::string eventName = "onEnterTerritory"; @@ -195,12 +195,12 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_ Entity::Player& player ) { const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerReturn >( inPacket ); - const auto& eventId = packet.data().eventId; - const auto& scene = packet.data().scene; - const auto& param1 = packet.data().param1; - const auto& param2 = packet.data().param2; - const auto& param3 = packet.data().param3; - const auto& param4 = packet.data().param4; + const auto eventId = packet.data().eventId; + const auto scene = packet.data().scene; + const auto param1 = packet.data().param1; + const auto param2 = packet.data().param2; + const auto param3 = packet.data().param3; + const auto param4 = packet.data().param4; std::string eventName = Event::getEventName( eventId ); diff --git a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp index 7a9a23f3..e56b943d 100644 --- a/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/GMCommandHandlers.cpp @@ -94,10 +94,10 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R return; const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand1 >( inPacket ); - const auto& commandId = packet.data().commandId; - const auto& param1 = packet.data().param1; - const auto& param2 = packet.data().param2; - const auto& param3 = packet.data().param3; + const auto commandId = packet.data().commandId; + const auto param1 = packet.data().param1; + const auto param2 = packet.data().param2; + const auto param3 = packet.data().param3; auto pLog = g_fw.get< Logger >(); pLog->debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) + @@ -505,8 +505,8 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand2 >( inPacket ); - const auto& commandId = packet.data().commandId; - const auto& param1 = std::string( packet.data().param1 ); + const auto commandId = packet.data().commandId; + const auto param1 = std::string( packet.data().param1 ); pLog->debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 ); diff --git a/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp b/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp index 67ce0127..68018fe2 100644 --- a/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/InventoryHandler.cpp @@ -32,13 +32,13 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::FFXIV { const auto packet = ZoneChannelPacket< Client::FFXIVIpcInventoryModifyHandler >( inPacket ); - const auto& action = packet.data().action; - const auto& splitCount = packet.data().splitCount; + const auto action = packet.data().action; + const auto splitCount = packet.data().splitCount; - const auto& fromSlot = packet.data().fromSlot; - const auto& fromContainer = packet.data().fromContainer; - const auto& toSlot = packet.data().toSlot; - const auto& toContainer = packet.data().toContainer; + const auto fromSlot = packet.data().fromSlot; + const auto fromContainer = packet.data().fromContainer; + const auto toSlot = packet.data().toSlot; + const auto toContainer = packet.data().toContainer; auto ackPacket = makeZonePacket< Server::FFXIVIpcInventoryActionAck >( player.getId() ); ackPacket->data().sequence = packet.data().seq; diff --git a/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp b/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp index 798e3d9a..c6756bde 100644 --- a/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp +++ b/src/servers/sapphire_zone/Network/Handlers/PacketHandlers.cpp @@ -65,10 +65,10 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::FFXIVAR { const auto packet = ZoneChannelPacket< Client::FFXIVIpcSetSearchInfo >( inPacket ); - const auto& inval = packet.data().status1; - const auto& inval1 = packet.data().status2; - const auto& status = packet.data().status; - const auto& selectRegion = packet.data().language; + const auto inval = packet.data().status1; + const auto inval1 = packet.data().status2; + const auto status = packet.data().status; + const auto selectRegion = packet.data().language; player.setSearchInfo( selectRegion, 0, packet.data().searchComment ); @@ -311,7 +311,7 @@ void Core::Network::GameConnection::zoneLineHandler( const Core::Network::Packet auto pTeriMgr = g_fw.get< TerritoryMgr >(); const auto packet = ZoneChannelPacket< Client::FFXIVIpcZoneLineHandler >( inPacket ); - const auto& zoneLineId = packet.data().zoneLineId; + const auto zoneLineId = packet.data().zoneLineId; player.sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) ); @@ -355,7 +355,7 @@ void Core::Network::GameConnection::discoveryHandler( const Core::Network::Packe Entity::Player& player ) { const auto packet = ZoneChannelPacket< Client::FFXIVIpcDiscoveryHandler >( inPacket ); - const auto& positionRef = packet.data().positionRef; + const auto positionRef = packet.data().positionRef; auto pDb = g_fw.get< Db::DbWorkerPool< Db::ZoneDbConnection > >(); From b622764cf7c8b616a65665f469a05e15f7c77383 Mon Sep 17 00:00:00 2001 From: Mordred <30826167+SapphireMordred@users.noreply.github.com> Date: Mon, 15 Oct 2018 08:06:39 +0200 Subject: [PATCH 16/24] Fixed an error in Update.sql --- sql/update.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/update.sql b/sql/update.sql index 43b36def..f4a048cb 100644 --- a/sql/update.sql +++ b/sql/update.sql @@ -47,7 +47,7 @@ ALTER TABLE `charainfo` CHANGE `Mounts` `Mounts` BINARY(17) NULL DEFAULT NULL; ALTER TABLE `charainfo` CHANGE `Orchestrion` `Orchestrion` BINARY(40) NULL DEFAULT NULL; ALTER TABLE `charainfo` CHANGE `Minions` `Minions` BINARY(40) NULL DEFAULT NULL; ALTER TABLE `charainfo` CHANGE `QuestCompleteFlags` `QuestCompleteFlags` VARBINARY(396) NULL DEFAULT NULL; -ALTER TABLE `charainfo` CHANGE `Aetheryte` `Minions` BINARY(17) NULL DEFAULT NULL; +ALTER TABLE `charainfo` CHANGE `Aetheryte` Aetheryte` BINARY(17) NULL DEFAULT NULL; ALTER TABLE `charainfo` ADD COLUMN `EquipDisplayFlags` INT(3) NULL DEFAULT '0' AFTER `GMRank`; ALTER TABLE `charainfo` ADD COLUMN `Pose` INT(3) NULL DEFAULT '0' AFTER `EquipDisplayFlags`; From 6fb2765e30de8fdf22cc62ecf1e0806d7bc3592f Mon Sep 17 00:00:00 2001 From: Mordred <30826167+SapphireMordred@users.noreply.github.com> Date: Mon, 15 Oct 2018 08:16:57 +0200 Subject: [PATCH 17/24] Opps, thanks Squall. ( missing backtick ) --- sql/update.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/update.sql b/sql/update.sql index f4a048cb..ce4c3fd9 100644 --- a/sql/update.sql +++ b/sql/update.sql @@ -47,7 +47,7 @@ ALTER TABLE `charainfo` CHANGE `Mounts` `Mounts` BINARY(17) NULL DEFAULT NULL; ALTER TABLE `charainfo` CHANGE `Orchestrion` `Orchestrion` BINARY(40) NULL DEFAULT NULL; ALTER TABLE `charainfo` CHANGE `Minions` `Minions` BINARY(40) NULL DEFAULT NULL; ALTER TABLE `charainfo` CHANGE `QuestCompleteFlags` `QuestCompleteFlags` VARBINARY(396) NULL DEFAULT NULL; -ALTER TABLE `charainfo` CHANGE `Aetheryte` Aetheryte` BINARY(17) NULL DEFAULT NULL; +ALTER TABLE `charainfo` CHANGE `Aetheryte` `Aetheryte` BINARY(17) NULL DEFAULT NULL; ALTER TABLE `charainfo` ADD COLUMN `EquipDisplayFlags` INT(3) NULL DEFAULT '0' AFTER `GMRank`; ALTER TABLE `charainfo` ADD COLUMN `Pose` INT(3) NULL DEFAULT '0' AFTER `EquipDisplayFlags`; From 6d3896dc7296d2e39f276344910a6d084d6b2418 Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Mon, 15 Oct 2018 21:38:39 +0300 Subject: [PATCH 18/24] Fixes disappearing soul crystals on re-logging. --- src/servers/sapphire_zone/Actor/PlayerSql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/servers/sapphire_zone/Actor/PlayerSql.cpp b/src/servers/sapphire_zone/Actor/PlayerSql.cpp index 5b6abae1..1f98fa7b 100644 --- a/src/servers/sapphire_zone/Actor/PlayerSql.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerSql.cpp @@ -608,7 +608,7 @@ bool Core::Entity::Player::loadInventory() { uint16_t storageId = res->getUInt16( 1 ); - for( uint32_t i = 1; i <= 13; i++ ) + for( uint32_t i = 1; i <= 14; i++ ) { uint64_t uItemId = res->getUInt64( i + 1 ); if( uItemId == 0 ) From 91d5ece4270ff08a2e08bcf3cc368bc03e6a544d Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Tue, 16 Oct 2018 20:06:30 +0300 Subject: [PATCH 19/24] Add ArmorySoulCrystal on new character creation. --- src/servers/sapphire_api/PlayerMinimal.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/servers/sapphire_api/PlayerMinimal.cpp b/src/servers/sapphire_api/PlayerMinimal.cpp index d117eea0..db375d03 100644 --- a/src/servers/sapphire_api/PlayerMinimal.cpp +++ b/src/servers/sapphire_api/PlayerMinimal.cpp @@ -319,6 +319,7 @@ void PlayerMinimal::saveAsNew() createInvDbContainer( InventoryType::ArmoryWrist ); createInvDbContainer( InventoryType::ArmoryRing ); createInvDbContainer( InventoryType::ArmoryMain ); + createInvDbContainer( InventoryType::ArmorySoulCrystal ); createInvDbContainer( InventoryType::Currency ); createInvDbContainer( InventoryType::Crystal ); From a503a6007fcaf9aa88597ab77778aad83c4b4dff Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Wed, 17 Oct 2018 23:25:41 +0300 Subject: [PATCH 20/24] Implements class change on weapon swap. --- .../sapphire_zone/Actor/PlayerInventory.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp index a40ce99f..e8c51b73 100644 --- a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp @@ -122,16 +122,12 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem ) auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() ); auto itemClassJob = itemInfo->classJobUse; - - auto currentClass = getClass(); + auto classJobInfo = exdData->get< Core::Data::ClassJob >( (uint32_t)getClass() ); + auto currentParentClass = static_cast< ClassJob >(classJobInfo->classJobParent); auto newClassJob = static_cast< ClassJob >( itemClassJob ); - if( isClassJobUnlocked( newClassJob ) ) - return; - - // todo: check if soul crystal is equipped and use job instead - - setClassJob( newClassJob ); + if( ( isClassJobUnlocked( newClassJob ) ) && ( currentParentClass != newClassJob ) ) + setClassJob( newClassJob ); } // equip an item @@ -160,8 +156,7 @@ void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::It case MainHand: m_modelMainWeapon = model; m_modelSubWeapon = model2; - // TODO: add job change upon changing weapon if needed - // equipWeapon( pItem ); + equipWeapon( pItem ); break; case OffHand: From 3d5e794d6e32fc736ce9c82229218fab5f0379d7 Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Thu, 18 Oct 2018 07:48:34 +0300 Subject: [PATCH 21/24] Code style. --- src/servers/sapphire_zone/Actor/PlayerInventory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp index e8c51b73..80d62605 100644 --- a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp @@ -122,8 +122,8 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem ) auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() ); auto itemClassJob = itemInfo->classJobUse; - auto classJobInfo = exdData->get< Core::Data::ClassJob >( (uint32_t)getClass() ); - auto currentParentClass = static_cast< ClassJob >(classJobInfo->classJobParent); + auto classJobInfo = exdData->get< Core::Data::ClassJob >( ( uint32_t )getClass() ); + auto currentParentClass = static_cast< ClassJob >( classJobInfo->classJobParent ); auto newClassJob = static_cast< ClassJob >( itemClassJob ); if( ( isClassJobUnlocked( newClassJob ) ) && ( currentParentClass != newClassJob ) ) From 8588d549baa0184defe0d94f493a36b5212a07d9 Mon Sep 17 00:00:00 2001 From: Biscuit Date: Thu, 18 Oct 2018 20:46:55 +1100 Subject: [PATCH 22/24] ModelEquip Updates Turns out padding1 holds some extra stuff --- src/common/Network/PacketDef/Zone/ServerZoneDef.h | 5 ++++- .../sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index b4115dc4..6ea34e79 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -976,7 +976,10 @@ struct FFXIVIpcModelEquip : { /* 0000 */ uint64_t mainWeapon; /* 0008 */ uint64_t offWeapon; - /* 0010 */ uint32_t padding1; + /* 0010 */ uint8_t unk1; + /* 0011 */ uint8_t classJobId; + /* 0012 */ uint8_t level; + /* 0013 */ uint8_t unk2; /* 0014 */ uint32_t models[10]; /* 003C */ uint32_t padding2; }; diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h index fd2801fa..f0bb7ebe 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h @@ -28,6 +28,8 @@ private: { m_data.mainWeapon = player.getModelMainWeapon(); m_data.offWeapon = player.getModelSubWeapon(); + m_data.classJobId = static_cast< uint8_t >( player.getClass() ); + m_data.level = player.getLevel(); m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead ); m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody ); m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands ); From 19f7bf82c97172feb62b3f27a095373ff1ea05a7 Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Thu, 18 Oct 2018 20:59:04 +0300 Subject: [PATCH 23/24] Fixes logon crash when using weapon of another class. --- src/servers/sapphire_zone/Actor/Player.h | 4 ++-- .../sapphire_zone/Actor/PlayerInventory.cpp | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/servers/sapphire_zone/Actor/Player.h b/src/servers/sapphire_zone/Actor/Player.h index fd5f4a65..ce984909 100644 --- a/src/servers/sapphire_zone/Actor/Player.h +++ b/src/servers/sapphire_zone/Actor/Player.h @@ -324,7 +324,7 @@ public: void unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem ); /*! equip a weapon, possibly forcing a job change */ - void equipWeapon( ItemPtr pItem ); + void equipWeapon( ItemPtr pItem, bool updateClass ); /*! get player ilvl */ uint16_t getItemLevel() const; @@ -356,7 +356,7 @@ public: /*! return the current amount of crystals of type */ uint32_t getCrystal( uint8_t type ) const; - void updateModels( Common::GearSetSlot equipSlotId, const Core::ItemPtr& pItem ); + void updateModels( Common::GearSetSlot equipSlotId, const Core::ItemPtr& pItem, bool updateClass ); Common::GearModelSlot equipSlotToModelSlot( Common::GearSetSlot slot ); diff --git a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp index 80d62605..bd7c1272 100644 --- a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp @@ -114,7 +114,7 @@ void Core::Entity::Player::sendItemLevel() queuePacket( makeActorControl142( getId(), SetItemLevel, getItemLevel(), 0 ) ); } -void Core::Entity::Player::equipWeapon( ItemPtr pItem ) +void Core::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass ) { auto exdData = g_fw.get< Core::Data::ExdDataGenerated >(); if( !exdData ) @@ -127,7 +127,12 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem ) auto newClassJob = static_cast< ClassJob >( itemClassJob ); if( ( isClassJobUnlocked( newClassJob ) ) && ( currentParentClass != newClassJob ) ) - setClassJob( newClassJob ); + { + if ( updateClass ) + setClassJob( newClassJob ); + else + return; + } } // equip an item @@ -135,18 +140,18 @@ void Core::Entity::Player::equipItem( Common::GearSetSlot equipSlotId, ItemPtr p { //g_framework.getLogger().debug( "Equipping into slot " + std::to_string( equipSlotId ) ); - - updateModels( equipSlotId, pItem ); - if( sendUpdate ) { + updateModels( equipSlotId, pItem, true ); this->sendModel(); m_itemLevel = calculateEquippedGearItemLevel(); sendItemLevel(); } + else + updateModels( equipSlotId, pItem, false ); } -void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::ItemPtr& pItem ) +void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::ItemPtr& pItem, bool updateClass ) { uint64_t model = pItem->getModelId1(); uint64_t model2 = pItem->getModelId2(); @@ -156,7 +161,7 @@ void Core::Entity::Player::updateModels( GearSetSlot equipSlotId, const Core::It case MainHand: m_modelMainWeapon = model; m_modelSubWeapon = model2; - equipWeapon( pItem ); + equipWeapon( pItem, updateClass ); break; case OffHand: From 44980a74b9ce45e8fdb048ddf3c3a61ce3e99872 Mon Sep 17 00:00:00 2001 From: Squall Leonhart <43782392+Squall5668@users.noreply.github.com> Date: Fri, 19 Oct 2018 16:48:18 +0300 Subject: [PATCH 24/24] Thanks Adam. Change c-style cast. --- src/servers/sapphire_zone/Actor/PlayerInventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp index bd7c1272..f8aef788 100644 --- a/src/servers/sapphire_zone/Actor/PlayerInventory.cpp +++ b/src/servers/sapphire_zone/Actor/PlayerInventory.cpp @@ -122,7 +122,7 @@ void Core::Entity::Player::equipWeapon( ItemPtr pItem, bool updateClass ) auto itemInfo = exdData->get< Core::Data::Item >( pItem->getId() ); auto itemClassJob = itemInfo->classJobUse; - auto classJobInfo = exdData->get< Core::Data::ClassJob >( ( uint32_t )getClass() ); + auto classJobInfo = exdData->get< Core::Data::ClassJob >( static_cast< uint32_t >( getClass() ) ); auto currentParentClass = static_cast< ClassJob >( classJobInfo->classJobParent ); auto newClassJob = static_cast< ClassJob >( itemClassJob );