mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-02 16:57:47 +00:00
add left/right to nudge command
- fix Common::Util::getOffsettedPosition - fix action timepoint getting stuck (todo: fix actions legit)
This commit is contained in:
parent
75a2fcbb63
commit
b38afc0256
8 changed files with 26 additions and 9 deletions
|
@ -1861,6 +1861,7 @@ namespace Sapphire::Common
|
||||||
THREAT
|
THREAT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// todo: fill this out (Action.exd EffectType)
|
||||||
enum CastType : uint8_t
|
enum CastType : uint8_t
|
||||||
{
|
{
|
||||||
SingleTarget = 1,
|
SingleTarget = 1,
|
||||||
|
|
|
@ -80,7 +80,7 @@ uint8_t Util::floatToUInt8Rot( float val )
|
||||||
return static_cast< uint8_t >( 0x80 * ( ( val + PI ) ) / PI );
|
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 };
|
FFXIVARR_POSITION3 ret{ pos };
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ FFXIVARR_POSITION3 Util::getOffsettedPosition( const FFXIVARR_POSITION3& pos, fl
|
||||||
ret.z += forward * sin( angle );
|
ret.z += forward * sin( angle );
|
||||||
|
|
||||||
// side
|
// side
|
||||||
ret.x += left * cos( rot );
|
ret.x -= right * cos( rot );
|
||||||
ret.z += left * sin( rot );
|
ret.z += right * sin( rot );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Sapphire::Common::Util
|
||||||
|
|
||||||
uint8_t floatToUInt8Rot( float val );
|
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 >
|
template < typename T >
|
||||||
T clamp( T val, T minimum, T maximum )
|
T clamp( T val, T minimum, T maximum )
|
||||||
|
|
|
@ -7,8 +7,12 @@ inline bool FFXIVARR_POSITION3::operator == ( const FFXIVARR_POSITION3& target )
|
||||||
return x == target.x && y == target.y && z == target.z;
|
return x == target.x && y == target.y && z == target.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Vector3::operator == ( const Vector3& target ) const
|
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;
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Sapphire::Common
|
namespace Sapphire::Common
|
||||||
{
|
{
|
||||||
|
// todo: get rid of this struct and use an actual vector 3 class
|
||||||
struct FFXIVARR_POSITION3
|
struct FFXIVARR_POSITION3
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
|
@ -15,8 +16,8 @@ namespace Sapphire::Common
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float z;
|
float z;
|
||||||
float reserve;
|
|
||||||
inline bool operator == ( const Vector3& target ) const;
|
inline bool operator == ( const Vector3& target ) const;
|
||||||
|
inline bool operator == ( const FFXIVARR_POSITION3& target ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Matrix33
|
struct Matrix33
|
||||||
|
|
|
@ -854,6 +854,7 @@ void Action::Action::addDefaultActorFilters()
|
||||||
{
|
{
|
||||||
switch( m_castType )
|
switch( m_castType )
|
||||||
{
|
{
|
||||||
|
// todo: figure these out and remove 5/RectangularAOE to own handler
|
||||||
case( Common::CastType ) 5:
|
case( Common::CastType ) 5:
|
||||||
case Common::CastType::RectangularAOE:
|
case Common::CastType::RectangularAOE:
|
||||||
case Common::CastType::SingleTarget:
|
case Common::CastType::SingleTarget:
|
||||||
|
|
|
@ -414,9 +414,9 @@ namespace Sapphire::Encounter
|
||||||
auto pAction = pBNpc->getCurrentAction();
|
auto pAction = pBNpc->getCurrentAction();
|
||||||
|
|
||||||
// todo: this is probably wrong
|
// 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
|
// todo: this really shouldnt exist, but need to figure out why actions interrupt
|
||||||
else if( pAction->getId() == pActionData->m_actionId )
|
else if( pAction->getId() == pActionData->m_actionId )
|
||||||
|
|
|
@ -559,8 +559,13 @@ void DebugCommandMgr::add( char* data, Entity::Player& player, std::shared_ptr<
|
||||||
Entity::GameObjectPtr pTarget = nullptr;
|
Entity::GameObjectPtr pTarget = nullptr;
|
||||||
auto inRange = player.getInRangeActors();
|
auto inRange = player.getInRangeActors();
|
||||||
for( auto pChara : inRange )
|
for( auto pChara : inRange )
|
||||||
|
{
|
||||||
if( pChara->getId() == targetId )
|
if( pChara->getId() == targetId )
|
||||||
|
{
|
||||||
pTarget = pChara;
|
pTarget = pChara;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( pTarget )
|
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 );
|
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
|
else
|
||||||
{
|
{
|
||||||
float angle = player.getRot() + ( PI / 2 );
|
float angle = player.getRot() + ( PI / 2 );
|
||||||
|
|
Loading…
Add table
Reference in a new issue