From d5022516f586aed0726d05129a82f6bb08509cb1 Mon Sep 17 00:00:00 2001 From: Alice Ogeda Date: Mon, 13 Feb 2023 16:27:36 -0300 Subject: [PATCH] fix actionresult, hudparam, resting packet; comment action filter for sprint false selftarget; warp vfx on exit range; fix status duration; --- .../Network/PacketDef/Zone/ServerZoneDef.h | 19 +++++++++++-------- src/world/Action/Action.cpp | 7 ++++--- src/world/Actor/Chara.cpp | 10 +++++++++- src/world/Network/Handlers/PacketHandlers.cpp | 2 +- .../Network/PacketWrappers/HudParamPacket.h | 17 ++++++++++++++++- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index d744179e..8ffb9369 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -470,15 +470,15 @@ namespace Sapphire::Network::Packets::WorldPackets::Server }; struct IntegrityStatus { + uint8_t Slot; - uint8_t __padding1; + uint8_t paddingmaybe; uint16_t Id; int16_t SystemParam; uint8_t __padding2; uint8_t __padding3; float Time; uint32_t Source; - uint8_t unknown_3_2; }; /** @@ -499,8 +499,9 @@ namespace Sapphire::Network::Packets::WorldPackets::Server uint32_t HpMax; uint16_t MpMax; uint8_t StatusCount; - uint8_t __padding3; + uint8_t unknown_E0; IntegrityStatus Status[4]; + uint32_t unk_1; }; /** @@ -550,14 +551,15 @@ namespace Sapphire::Network::Packets::WorldPackets::Server /** * Structural representation of the packet sent by the server - * to update HP / MP / TP + * to update HP / MP / TP / GP */ struct FFXIVIpcResting : FFXIVIpcBasePacket< Resting > { - /* 0000 */ uint32_t Hp; - /* 0004 */ uint16_t Mp; - /* 0006 */ uint16_t Tp; - /* 0008 */ uint16_t Gp; + uint32_t Hp; + uint16_t Mp; + uint16_t Tp; + uint16_t Gp; + uint32_t Unknown_3_2; }; struct FFXIVIpcRecastGroup : FFXIVIpcBasePacket< RecastGroup > @@ -617,6 +619,7 @@ namespace Sapphire::Network::Packets::WorldPackets::Server uint64_t Target; uint32_t BallistaEntityId; Common::CalcResult CalcResult; + uint32_t __padding2; }; struct MountStruct diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index ca9762b2..0e725a8c 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -839,9 +839,10 @@ bool Action::Action::preFilterActor( Sapphire::Entity::GameObject& actor ) const // todo: are there any server side eobjs that players can hit? if( kind != ObjKind::BattleNpc && kind != ObjKind::Player ) return false; - - if( !m_canTargetSelf && chara->getId() == m_pSource->getId() ) - return false; + + // todo: evaluate other actions that can hit condition (eg. sprint) + /* if( !m_canTargetSelf && chara->getId() == m_pSource->getId() ) + return false;*/ if( ( m_lutEntry.potency > 0 || m_lutEntry.curePotency > 0 ) && !chara->isAlive() ) // !m_canTargetDead not working for aoe return false; diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index e65aacf0..49982401 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -530,13 +530,21 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf statusEffectAdd->data().MpMax = static_cast< uint16_t >( getMaxMp() ); statusEffectAdd->data().ClassJob = static_cast< uint8_t >( getClass() ); statusEffectAdd->data().StatusCount = 1; + statusEffectAdd->data().unknown_E0 = 0xE0; + + // set all status sources to u32 invalid game obj + // todo: chara status effect map should be filled instead, since hudparam also uses invalid gameobj + for( int i = 0; i < 4; ++i ) + { + statusEffectAdd->data().Status[ i ].Source = INVALID_GAME_OBJECT_ID; + } auto& status = statusEffectAdd->data().Status[ 0 ]; status.Source = pEffect->getSrcActorId(); status.Time = static_cast< float >( pEffect->getDuration() ) / 1000; status.Id = static_cast< uint16_t >( pEffect->getId() ); - status.Slot = static_cast< uint8_t >( nextSlot ); + status.Slot = static_cast< uint8_t >( nextSlot + 1 ); status.SystemParam = static_cast< int16_t >( pEffect->getParam() ); sendToInRangeSet( statusEffectAdd, isPlayer() ); diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 5f863346..1c725fa8 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -335,7 +335,7 @@ void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR return; auto& warpMgr = Common::Service< WarpMgr >::ref(); - warpMgr.requestMoveTerritory( player, Common::WARP_TYPE_EXIT_RANGE, pTargetTeri->getGuId(), targetPos, rotation ); + warpMgr.requestMoveTerritory( player, Common::WARP_TYPE_NORMAL_POS, pTargetTeri->getGuId(), targetPos, rotation ); } diff --git a/src/world/Network/PacketWrappers/HudParamPacket.h b/src/world/Network/PacketWrappers/HudParamPacket.h index b808d575..98e7d523 100644 --- a/src/world/Network/PacketWrappers/HudParamPacket.h +++ b/src/world/Network/PacketWrappers/HudParamPacket.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include #include "Forwards.h" namespace Sapphire::Network::Packets::WorldPackets::Server @@ -28,7 +30,20 @@ namespace Sapphire::Network::Packets::WorldPackets::Server m_data.Mp = player.getMp(); m_data.Tp = player.getTp(); m_data.HpMax = player.getMaxHp(); - m_data.MpMax = player.getMaxMp();; + m_data.MpMax = player.getMaxMp(); + + auto statusMap = player.getStatusEffectMap(); + + int i = 0; + for( const auto& [ key, val ] : statusMap ) + { + m_data.effect[ i ].Id = val->getId(); + m_data.effect[ i ].Source = val->getSrcActorId(); + m_data.effect[ i ].SystemParam = val->getParam(); + m_data.effect[ i ].Time = ( val->getDuration() - ( Common::Util::getTimeMs() - val->getStartTimeMs() ) ) / 1000.f; + + i++; + } }; }; template< typename... Args >