diff --git a/src/common/Common.h b/src/common/Common.h index bceab9c0..1cf24ea3 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -1861,6 +1861,7 @@ namespace Sapphire::Common THREAT }; + // todo: fill this out (Action.exd EffectType) enum CastType : uint8_t { SingleTarget = 1, diff --git a/src/common/Util/UtilMath.cpp b/src/common/Util/UtilMath.cpp index 93b45624..9a5d1991 100644 --- a/src/common/Util/UtilMath.cpp +++ b/src/common/Util/UtilMath.cpp @@ -80,7 +80,7 @@ uint8_t Util::floatToUInt8Rot( float val ) return static_cast< uint8_t >( 0x80 * ( ( val + PI ) ) / PI ); } -FFXIVARR_POSITION3 Util::getOffsettedPosition( const FFXIVARR_POSITION3& pos, float rot, float left, float up, float forward ) +FFXIVARR_POSITION3 Util::getOffsettedPosition( const FFXIVARR_POSITION3& pos, float rot, float right, float up, float forward ) { FFXIVARR_POSITION3 ret{ pos }; @@ -93,8 +93,8 @@ FFXIVARR_POSITION3 Util::getOffsettedPosition( const FFXIVARR_POSITION3& pos, fl ret.z += forward * sin( angle ); // side - ret.x += left * cos( rot ); - ret.z += left * sin( rot ); + ret.x -= right * cos( rot ); + ret.z += right * sin( rot ); return ret; } diff --git a/src/common/Util/UtilMath.h b/src/common/Util/UtilMath.h index e245892d..21be831a 100644 --- a/src/common/Util/UtilMath.h +++ b/src/common/Util/UtilMath.h @@ -29,7 +29,7 @@ namespace Sapphire::Common::Util uint8_t floatToUInt8Rot( float val ); - FFXIVARR_POSITION3 getOffsettedPosition( const FFXIVARR_POSITION3& pos, float rotation, float left, float up, float forward ); + FFXIVARR_POSITION3 getOffsettedPosition( const FFXIVARR_POSITION3& pos, float rotation, float right, float up, float forward ); template < typename T > T clamp( T val, T minimum, T maximum ) diff --git a/src/common/Vector3.cpp b/src/common/Vector3.cpp index a98c4fde..29aefdef 100644 --- a/src/common/Vector3.cpp +++ b/src/common/Vector3.cpp @@ -7,8 +7,12 @@ inline bool FFXIVARR_POSITION3::operator == ( const FFXIVARR_POSITION3& target ) return x == target.x && y == target.y && z == target.z; } - inline bool Vector3::operator == ( const Vector3& target ) const { - return x == target.x && y == target.y && z == target.z && reserve == target.reserve; + return x == target.x && y == target.y && z == target.z; +} + +inline bool Vector3::operator == ( const FFXIVARR_POSITION3& target ) const +{ + return x == target.x && y == target.y && z == target.z; } \ No newline at end of file diff --git a/src/common/Vector3.h b/src/common/Vector3.h index 1658aa76..e03b3dfc 100644 --- a/src/common/Vector3.h +++ b/src/common/Vector3.h @@ -2,6 +2,7 @@ namespace Sapphire::Common { + // todo: get rid of this struct and use an actual vector 3 class struct FFXIVARR_POSITION3 { float x; @@ -15,8 +16,8 @@ namespace Sapphire::Common float x; float y; float z; - float reserve; inline bool operator == ( const Vector3& target ) const; + inline bool operator == ( const FFXIVARR_POSITION3& target ) const; }; struct Matrix33 diff --git a/src/world/Action/Action.cpp b/src/world/Action/Action.cpp index 72207ff9..912a73f0 100644 --- a/src/world/Action/Action.cpp +++ b/src/world/Action/Action.cpp @@ -854,6 +854,7 @@ void Action::Action::addDefaultActorFilters() { switch( m_castType ) { + // todo: figure these out and remove 5/RectangularAOE to own handler case( Common::CastType ) 5: case Common::CastType::RectangularAOE: case Common::CastType::SingleTarget: diff --git a/src/world/Encounter/Timepoint.cpp b/src/world/Encounter/Timepoint.cpp index d4245fd8..bc954d44 100644 --- a/src/world/Encounter/Timepoint.cpp +++ b/src/world/Encounter/Timepoint.cpp @@ -414,9 +414,9 @@ namespace Sapphire::Encounter auto pAction = pBNpc->getCurrentAction(); // todo: this is probably wrong - if( !pAction ) + if( !pAction || pAction->isInterrupted() ) { - actionMgr.handleTargetedAction( *pBNpc, pActionData->m_actionId, targetId, 0 ); + actionMgr.handleTargetedAction( *pBNpc, pActionData->m_actionId, targetId, pTeri->getNextActionResultId() ); } // todo: this really shouldnt exist, but need to figure out why actions interrupt else if( pAction->getId() == pActionData->m_actionId ) diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 990a67e7..bb682b3c 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -559,8 +559,13 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr< Entity::GameObjectPtr pTarget = nullptr; auto inRange = player.getInRangeActors(); for( auto pChara : inRange ) + { if( pChara->getId() == targetId ) + { pTarget = pChara; + break; + } + } if( pTarget ) { @@ -731,6 +736,11 @@ void DebugCommandMgr::nudge( char* data, Entity::Player& player, std::shared_ptr PlayerMgr::sendServerNotice( player, "nudge: Placing down {0} yalms", offset ); } + else if( direction[ 0 ] == 'r' ) + { + pos = Common::Util::getOffsettedPosition( pos, player.getRot(), offset, 0, 0 ); + PlayerMgr::sendServerNotice( player, "nudge: Placing right {0} yalms", offset ); + } else { float angle = player.getRot() + ( PI / 2 );