mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-25 19:17:45 +00:00
show job ui and some war stuff
This commit is contained in:
parent
bbcf5a82eb
commit
450ff0ddff
15 changed files with 189 additions and 7 deletions
|
@ -624,8 +624,8 @@ namespace Sapphire::Common
|
|||
TpLoss = 12,
|
||||
TpGain = 13,
|
||||
GpGain = 14,
|
||||
ApplyStatusEffect = 15,
|
||||
//ApplyStatusEffect2 = 16, // thin air uses this one but works fine with 15 wtf?
|
||||
ApplyStatusEffectTarget = 15,
|
||||
ApplyStatusEffectSource = 16,
|
||||
StatusNoEffect = 21,
|
||||
/*!
|
||||
* @brief Tells the client that it should show combo indicators on actions.
|
||||
|
|
|
@ -159,6 +159,7 @@ namespace Sapphire::Network::Packets
|
|||
ActorOwner = 0x03BB, // updated 5.18
|
||||
PlayerStateFlags = 0x02C6, // updated 5.18
|
||||
PlayerClassInfo = 0x01B0, // updated 5.18
|
||||
Effect037F = 0x037F, // 5.18
|
||||
|
||||
ModelEquip = 0x02E6, // updated 5.18
|
||||
Examine = 0x0366, // updated 5.18
|
||||
|
|
|
@ -1994,6 +1994,12 @@ namespace Sapphire::Network::Packets::Server
|
|||
char otherName[32];
|
||||
};
|
||||
|
||||
struct FFXIVIpcEffect037F : FFXIVIpcBasePacket< Effect037F >
|
||||
{
|
||||
uint32_t value1;
|
||||
uint32_t value2;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /*_CORE_NETWORK_PACKETS_SERVER_IPC_H*/
|
||||
|
|
29
src/scripts/action/war/ActionMaim37.cpp
Normal file
29
src/scripts/action/war/ActionMaim37.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/Action.h>
|
||||
#include <Math/CalcStats.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class ActionMaim37 :
|
||||
public ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionMaim37() :
|
||||
ScriptAPI::ActionScript( 37 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
assert( pPlayer );
|
||||
uint8_t ib = pPlayer->gaugeWarGetIb();
|
||||
ib = std::min( 100, ib + 10 );
|
||||
pPlayer->gaugeWarSetIb( ib );
|
||||
pPlayer->sendActorGuage();
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ActionMaim37 );
|
29
src/scripts/action/war/ActionStormsEye45.cpp
Normal file
29
src/scripts/action/war/ActionStormsEye45.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/Action.h>
|
||||
#include <Math/CalcStats.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class ActionStormsEye45 :
|
||||
public ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionStormsEye45() :
|
||||
ScriptAPI::ActionScript( 45 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
assert( pPlayer );
|
||||
uint8_t ib = pPlayer->gaugeWarGetIb();
|
||||
ib = std::min( 100, ib + 10 );
|
||||
pPlayer->gaugeWarSetIb( ib );
|
||||
pPlayer->sendActorGuage();
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ActionStormsEye45 );
|
29
src/scripts/action/war/ActionStormsPath42.cpp
Normal file
29
src/scripts/action/war/ActionStormsPath42.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
#include <Script/NativeScriptApi.h>
|
||||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
#include <Action/Action.h>
|
||||
#include <Math/CalcStats.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class ActionStormsPath42 :
|
||||
public ScriptAPI::ActionScript
|
||||
{
|
||||
public:
|
||||
ActionStormsPath42() :
|
||||
ScriptAPI::ActionScript( 42 )
|
||||
{
|
||||
}
|
||||
|
||||
void onExecute( Sapphire::World::Action::Action& action ) override
|
||||
{
|
||||
auto pPlayer = action.getSourceChara()->getAsPlayer();
|
||||
assert( pPlayer );
|
||||
uint8_t ib = pPlayer->gaugeWarGetIb();
|
||||
ib = std::min( 100, ib + 20 );
|
||||
pPlayer->gaugeWarSetIb( ib );
|
||||
pPlayer->sendActorGuage();
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( ActionStormsPath42 );
|
|
@ -427,6 +427,7 @@ void Action::Action::buildEffects()
|
|||
{
|
||||
// send any effect packet added by script or an empty one just to play animation for other players
|
||||
m_effectBuilder->buildAndSendPackets();
|
||||
pScriptMgr->onAfterBuildEffect( *this );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -531,6 +532,7 @@ void Action::Action::buildEffects()
|
|||
}
|
||||
|
||||
m_effectBuilder->buildAndSendPackets();
|
||||
pScriptMgr->onAfterBuildEffect( *this );
|
||||
|
||||
// at this point we're done with it and no longer need it
|
||||
m_effectBuilder.reset();
|
||||
|
|
|
@ -96,7 +96,7 @@ void EffectResult::applyStatusEffect( uint16_t statusId, uint32_t duration, uint
|
|||
m_statusDuration = duration;
|
||||
m_param2 = param;
|
||||
|
||||
m_type = Common::ActionEffectType::ApplyStatusEffect;
|
||||
m_type = Common::ActionEffectType::ApplyStatusEffectTarget;
|
||||
}
|
||||
|
||||
void EffectResult::applyStatusEffect( StatusEffect::StatusEffectPtr pStatusEffect )
|
||||
|
@ -105,7 +105,7 @@ void EffectResult::applyStatusEffect( StatusEffect::StatusEffectPtr pStatusEffec
|
|||
m_param2 = pStatusEffect->getParam();
|
||||
m_pPreBuiltStatusEffect = std::move( pStatusEffect );
|
||||
|
||||
m_type = Common::ActionEffectType::ApplyStatusEffect;
|
||||
m_type = Common::ActionEffectType::ApplyStatusEffectTarget;
|
||||
}
|
||||
|
||||
void EffectResult::statusNoEffect( uint16_t statusId )
|
||||
|
@ -160,8 +160,8 @@ void EffectResult::execute()
|
|||
break;
|
||||
}
|
||||
|
||||
case Common::ActionEffectType::ApplyStatusEffect:
|
||||
//case Common::ActionEffectType::ApplyStatusEffect2:
|
||||
case Common::ActionEffectType::ApplyStatusEffectTarget:
|
||||
case Common::ActionEffectType::ApplyStatusEffectSource:
|
||||
{
|
||||
uint64_t lastTickOverride = 0;
|
||||
//refreshing old buff
|
||||
|
|
|
@ -106,6 +106,8 @@ Sapphire::Entity::Player::Player( FrameworkPtr pFw ) :
|
|||
|
||||
m_objSpawnIndexAllocator.init( MAX_DISPLAYED_EOBJS );
|
||||
m_actorSpawnIndexAllocator.init( MAX_DISPLAYED_ACTORS, true );
|
||||
|
||||
gaugeClear();
|
||||
}
|
||||
|
||||
Sapphire::Entity::Player::~Player()
|
||||
|
@ -831,6 +833,8 @@ void Sapphire::Entity::Player::setClassJob( Common::ClassJob classJob )
|
|||
sendToInRangeSet( makeActorControl( getId(), ClassJobChange, 0x04 ), true );
|
||||
|
||||
sendStatusUpdate();
|
||||
|
||||
gaugeClear();
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::setLevel( uint8_t level )
|
||||
|
@ -2151,3 +2155,51 @@ bool Sapphire::Entity::Player::checkAction()
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::gaugeClear()
|
||||
{
|
||||
std::memset( m_gauge, 0, sizeof( m_gauge ) );
|
||||
auto pPacket = makeZonePacket< FFXIVIpcEffect037F >( getId() );
|
||||
queuePacket( pPacket );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::gaugeSet( uint8_t index, uint8_t value )
|
||||
{
|
||||
m_gauge[ index ] = value;
|
||||
}
|
||||
|
||||
uint8_t Sapphire::Entity::Player::gaugeGet( uint8_t index )
|
||||
{
|
||||
return m_gauge[ index ];
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::sendActorGuage()
|
||||
{
|
||||
auto pPacket = makeZonePacket< FFXIVIpcActorGauge >( getId() );
|
||||
pPacket->data().classJobId = static_cast< uint8_t >( getClass() );
|
||||
std::memcpy( pPacket->data().data, m_gauge, sizeof( m_gauge ) );
|
||||
|
||||
queuePacket( pPacket );
|
||||
}
|
||||
|
||||
void Sapphire::Entity::Player::gaugeWarSetIb( uint8_t value )
|
||||
{
|
||||
auto oldValue = gaugeWarGetIb();
|
||||
if( ( oldValue == 0 && value != 0 ) ||
|
||||
( oldValue != 0 && value == 0 ) )
|
||||
{
|
||||
auto pPacket = makeZonePacket< FFXIVIpcEffect037F >( getId() );
|
||||
if( value != 0 )
|
||||
{
|
||||
pPacket->data().value1 = 0x07;
|
||||
pPacket->data().value2 = 0x7C;
|
||||
}
|
||||
queuePacket( pPacket );
|
||||
}
|
||||
gaugeSet( 0, value );
|
||||
}
|
||||
|
||||
uint8_t Sapphire::Entity::Player::gaugeWarGetIb()
|
||||
{
|
||||
return gaugeGet( 0 );
|
||||
}
|
|
@ -971,6 +971,16 @@ namespace Sapphire::Entity
|
|||
|
||||
Sapphire::ItemPtr dropInventoryItem( Common::InventoryType type, uint16_t slotId );
|
||||
|
||||
// Job UI
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void gaugeClear();
|
||||
void gaugeSet( uint8_t index, uint8_t value );
|
||||
uint8_t gaugeGet( uint8_t index );
|
||||
void sendActorGuage();
|
||||
|
||||
void gaugeWarSetIb( uint8_t value );
|
||||
uint8_t gaugeWarGetIb();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Common::HuntingLogEntry& getHuntingLogEntry( uint8_t index );
|
||||
|
@ -1083,6 +1093,8 @@ namespace Sapphire::Entity
|
|||
bool m_bLoadingComplete;
|
||||
bool m_bAutoattack;
|
||||
|
||||
uint8_t m_gauge[15];
|
||||
|
||||
Common::ZoneingType m_zoningType;
|
||||
uint32_t m_territoryId;
|
||||
|
||||
|
|
|
@ -424,6 +424,8 @@ void Sapphire::Network::GameConnection::finishLoadingHandler( FrameworkPtr pFw,
|
|||
// spawn the player for himself
|
||||
player.spawn( player.getAsPlayer() );
|
||||
|
||||
player.sendActorGuage();
|
||||
|
||||
// notify the zone of a change in position to force an "inRangeActor" update
|
||||
player.getCurrentTerritory()->updateActorPosition( player );
|
||||
}
|
||||
|
|
|
@ -96,6 +96,10 @@ namespace Sapphire::ScriptAPI
|
|||
{
|
||||
}
|
||||
|
||||
void ActionScript::onAfterBuildEffect( Sapphire::World::Action::Action& action )
|
||||
{
|
||||
}
|
||||
|
||||
void ActionScript::onInterrupt( Sapphire::World::Action::Action& action )
|
||||
{
|
||||
}
|
||||
|
|
|
@ -144,6 +144,8 @@ namespace Sapphire::ScriptAPI
|
|||
|
||||
virtual void onExecute( Sapphire::World::Action::Action& action );
|
||||
|
||||
virtual void onAfterBuildEffect( Sapphire::World::Action::Action& action );
|
||||
|
||||
virtual void onInterrupt( Sapphire::World::Action::Action& action );
|
||||
};
|
||||
|
||||
|
|
|
@ -341,6 +341,18 @@ bool Sapphire::Scripting::ScriptMgr::onExecute( World::Action::Action& action )
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Sapphire::Scripting::ScriptMgr::onAfterBuildEffect( World::Action::Action& action )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::ActionScript >( action.getId() );
|
||||
|
||||
if( script )
|
||||
{
|
||||
script->onAfterBuildEffect( action );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Sapphire::Scripting::ScriptMgr::onInterrupt( World::Action::Action& action )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::ActionScript >( action.getId() );
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace Sapphire::Scripting
|
|||
|
||||
bool onExecute( World::Action::Action& action );
|
||||
|
||||
bool onAfterBuildEffect( World::Action::Action& action );
|
||||
|
||||
bool onStatusReceive( Entity::CharaPtr pActor, uint32_t effectId );
|
||||
|
||||
bool onStatusTick( Entity::CharaPtr pActor, Sapphire::StatusEffect::StatusEffect& effect );
|
||||
|
|
Loading…
Add table
Reference in a new issue