From 5f98d00d48089ae365d12a48845ffe40a6b22192 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sun, 10 Feb 2019 19:50:28 +1100 Subject: [PATCH] correctly capture itemaction source slot/container from cast packet --- src/common/Network/PacketDef/Zone/ClientZoneDef.h | 4 +++- src/world/Manager/ActionMgr.cpp | 10 ++++++---- src/world/Manager/ActionMgr.h | 3 ++- src/world/Network/Handlers/ActionHandler.cpp | 4 +++- src/world/Network/Handlers/ClientTriggerHandler.cpp | 4 ++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/common/Network/PacketDef/Zone/ClientZoneDef.h b/src/common/Network/PacketDef/Zone/ClientZoneDef.h index 6794399a..ee117d35 100644 --- a/src/common/Network/PacketDef/Zone/ClientZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ClientZoneDef.h @@ -70,7 +70,9 @@ struct FFXIVIpcSkillHandler : /* 0008 */ uint16_t sequence; /* 000A */ char pad_000C[6]; /* 0010 */ uint64_t targetId; - /* 0018 */ uint64_t unknown; + /* 0018 */ uint16_t itemSourceSlot; + /* 001A */ uint16_t itemSourceContainer; + /* 001C */ uint32_t unknown; }; struct FFXIVIpcAoESkillHandler : diff --git a/src/world/Manager/ActionMgr.cpp b/src/world/Manager/ActionMgr.cpp index c9cccb35..38936cb4 100644 --- a/src/world/Manager/ActionMgr.cpp +++ b/src/world/Manager/ActionMgr.cpp @@ -49,9 +49,13 @@ void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& play bootstrapAction( player, action, *actionData ); } -void World::Manager::ActionMgr::handleItemAction( Sapphire::Entity::Player& player, uint32_t itemId, Data::ItemActionPtr itemActionData ) +void World::Manager::ActionMgr::handleItemAction( Sapphire::Entity::Player& player, uint32_t itemId, + Data::ItemActionPtr itemActionData, + uint16_t itemSourceSlot, uint16_t itemSourceContainer ) { - player.sendDebug( "got item act: {0}", itemId ); + player.sendDebug( "got item act: {0}, slot: {1}, container: {2}", itemId, itemSourceSlot, itemSourceContainer ); + + // todo: check we have item & remove item from inventory switch( itemActionData->type ) { @@ -133,8 +137,6 @@ bool World::Manager::ActionMgr::canPlayerUseAction( Entity::Player& player, void World::Manager::ActionMgr::handleItemActionVFX( Sapphire::Entity::Player& player, uint32_t itemId, uint16_t vfxId ) { - // todo: check we have item & remove item from inventory - Common::EffectEntry effect{}; effect.effectType = Common::ActionEffectType::VFX; effect.value = vfxId; diff --git a/src/world/Manager/ActionMgr.h b/src/world/Manager/ActionMgr.h index 6a61fc5c..2e77ad44 100644 --- a/src/world/Manager/ActionMgr.h +++ b/src/world/Manager/ActionMgr.h @@ -26,7 +26,8 @@ namespace Sapphire::World::Manager void handleAoEPlayerAction( Entity::Player& player, uint32_t actionId, Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos ); - void handleItemAction( Entity::Player& player, uint32_t itemId, Data::ItemActionPtr itemActionData ); + void handleItemAction( Entity::Player& player, uint32_t itemId, Data::ItemActionPtr itemActionData, + uint16_t itemSourceSlot, uint16_t itemSourceContainer ); private: void bootstrapAction( Entity::Player& player, Action::ActionPtr currentAction, Data::Action& actionData ); diff --git a/src/world/Network/Handlers/ActionHandler.cpp b/src/world/Network/Handlers/ActionHandler.cpp index 21324e73..cb71bb6e 100644 --- a/src/world/Network/Handlers/ActionHandler.cpp +++ b/src/world/Network/Handlers/ActionHandler.cpp @@ -24,6 +24,8 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw, const auto actionId = packet.data().actionId; const auto sequence = packet.data().sequence; const auto targetId = packet.data().targetId; + const auto itemSourceSlot = packet.data().itemSourceSlot; + const auto itemSourceContainer = packet.data().itemSourceContainer; player.sendDebug( "Skill type: {0}, sequence: {1}, actionId: {2}, targetId: {3}", type, sequence, actionId, targetId ); @@ -63,7 +65,7 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw, if( !itemAction ) return; - actionMgr->handleItemAction( player, actionId, itemAction ); + actionMgr->handleItemAction( player, actionId, itemAction, itemSourceSlot, itemSourceContainer ); break; } diff --git a/src/world/Network/Handlers/ClientTriggerHandler.cpp b/src/world/Network/Handlers/ClientTriggerHandler.cpp index 6aad2f8c..60dd7a4d 100644 --- a/src/world/Network/Handlers/ClientTriggerHandler.cpp +++ b/src/world/Network/Handlers/ClientTriggerHandler.cpp @@ -279,6 +279,10 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw, } case ClientTriggerType::DyeItem: // Dye item { + // param11 = item to dye container + // param12 = item to dye slot + // param2 = dye bag container + // param4 = dye bag slot break; } case ClientTriggerType::DirectorInitFinish: // Director init finish