mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
Basic actions are functional
This commit is contained in:
parent
c4129924ea
commit
d9e7e42a6d
12 changed files with 8578 additions and 1549 deletions
|
@ -784,7 +784,8 @@ namespace Sapphire::Common
|
||||||
{
|
{
|
||||||
None = 0, // ?
|
None = 0, // ?
|
||||||
MagicPoints = 3,
|
MagicPoints = 3,
|
||||||
TacticsPoints = 6,
|
TacticsPoints = 5,
|
||||||
|
TacticsPoints1 = 6,
|
||||||
// WARGauge = 22,
|
// WARGauge = 22,
|
||||||
// DRKGauge = 25,
|
// DRKGauge = 25,
|
||||||
// AetherflowStack = 30,
|
// AetherflowStack = 30,
|
||||||
|
|
|
@ -26,5 +26,5 @@ add_subdirectory( "pcb_reader" )
|
||||||
add_subdirectory( "nav_export" )
|
add_subdirectory( "nav_export" )
|
||||||
add_subdirectory( "BattleNpcParserPs3" )
|
add_subdirectory( "BattleNpcParserPs3" )
|
||||||
#add_subdirectory( "event_object_parser" )
|
#add_subdirectory( "event_object_parser" )
|
||||||
#add_subdirectory( "action_parse" )
|
add_subdirectory( "action_parse" )
|
||||||
#add_subdirectory( "questbattle_bruteforce" )
|
#add_subdirectory( "questbattle_bruteforce" )
|
|
@ -9,7 +9,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdData.h>
|
||||||
|
#include <Exd/Structs.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Common.h>
|
#include <Common.h>
|
||||||
|
|
||||||
|
@ -19,13 +20,12 @@
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
using namespace Sapphire;
|
using namespace Sapphire;
|
||||||
|
Sapphire::Data::ExdData g_exdDataGen;
|
||||||
|
|
||||||
std::string datLocation( "/home/mordred/sqpack" );
|
std::string datLocation( "F:\\client3.0\\game\\sqpack" );
|
||||||
//const std::string datLocation( "/mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack" );
|
//const std::string datLocation( "/mnt/c/Program Files (x86)/Steam/steamapps/common/FINAL FANTASY XIV Online/game/sqpack" );
|
||||||
|
|
||||||
struct ActionEntry
|
struct ActionEntry
|
||||||
|
@ -83,12 +83,12 @@ int main( int argc, char* argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::info( "Setting up EXD data" );
|
Logger::info( "Setting up EXD data" );
|
||||||
if( !g_exdData.init( datLocation ) )
|
if( !g_exdDataGen.init( datLocation ) )
|
||||||
{
|
{
|
||||||
Logger::fatal( "Error setting up EXD data " );
|
Logger::fatal( "Error setting up EXD data " );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
auto idList = g_exdData.getActionIdList();
|
auto idList = g_exdDataGen.getIdList< Component::Excel::Action >();
|
||||||
|
|
||||||
std::map< uint32_t, ActionEntry > actions;
|
std::map< uint32_t, ActionEntry > actions;
|
||||||
|
|
||||||
|
@ -101,25 +101,31 @@ int main( int argc, char* argv[] )
|
||||||
if( cursor % 50 == 0 && cursor > 0 )
|
if( cursor % 50 == 0 && cursor > 0 )
|
||||||
Logger::info( "Processing {} actions of {} ({:.2f}%)", cursor, total, done );
|
Logger::info( "Processing {} actions of {} ({:.2f}%)", cursor, total, done );
|
||||||
|
|
||||||
auto action = g_exdData.get< Sapphire::Data::Action >( id );
|
auto action = g_exdDataGen.getRow< Component::Excel::Action >( id );
|
||||||
auto actionTransient = g_exdData.get< Sapphire::Data::ActionTransient >( id );
|
|
||||||
|
//auto actionTransient = g_exdData.get< Sapphire::Data::ActionTransient >( id );
|
||||||
if( action )
|
if( action )
|
||||||
{
|
{
|
||||||
if( action->classJob == -1 || action->name.empty() )
|
auto& actionData = action->data();
|
||||||
|
|
||||||
|
if( actionData.UseClassJob == -1 || action->getString( actionData.Text.Name ).empty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( action->isPvP )
|
//if( actionData.PvPOnly )
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
auto classJob = g_exdData.get< Sapphire::Data::ClassJob >( action->classJob );
|
// auto classJob = g_exdDataGen.getRow< Component::Excel::ClassJob >( actionData.UseClassJob );
|
||||||
if( !classJob )
|
// if( !classJob )
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
// exclude dol/doh
|
// exclude dol/doh
|
||||||
if( classJob->classJobCategory == 32 || classJob->classJobCategory == 33 )
|
// if( classJob->data().CraftingClassIndex > 0 )
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
auto ac = static_cast< Common::ActionCategory >( action->actionCategory );
|
if( id == 75 )
|
||||||
|
int test = 1;
|
||||||
|
|
||||||
|
auto ac = static_cast< Common::ActionCategory >( actionData.Category );
|
||||||
if( ac != Common::ActionCategory::Ability &&
|
if( ac != Common::ActionCategory::Ability &&
|
||||||
ac != Common::ActionCategory::Autoattack &&
|
ac != Common::ActionCategory::Autoattack &&
|
||||||
ac != Common::ActionCategory::Spell &&
|
ac != Common::ActionCategory::Spell &&
|
||||||
|
@ -129,11 +135,11 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
ActionEntry entry{};
|
ActionEntry entry{};
|
||||||
|
|
||||||
entry.name = action->name;
|
entry.name = action->getString( actionData.Text.Name );
|
||||||
entry.id = id;
|
entry.id = id;
|
||||||
|
|
||||||
Logger::info( " {0} - {1}", id, action->name );
|
Logger::info( " {0} - {1}", id, action->getString( actionData.Text.Name ) );
|
||||||
std::string desc = actionTransient->description;
|
std::string desc = action->getString( actionData.Text.Help );
|
||||||
stripUnicode( desc );
|
stripUnicode( desc );
|
||||||
desc = std::regex_replace( desc, std::regex( "HI" ), "\n" );
|
desc = std::regex_replace( desc, std::regex( "HI" ), "\n" );
|
||||||
desc = std::regex_replace( desc, std::regex( "IH" ), "" );
|
desc = std::regex_replace( desc, std::regex( "IH" ), "" );
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <Exd/ExdData.h>
|
#include <Exd/ExdData.h>
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
|
#include <Util/UtilMath.h>
|
||||||
#include "Script/ScriptMgr.h"
|
#include "Script/ScriptMgr.h"
|
||||||
|
|
||||||
#include <Math/CalcStats.h>
|
#include <Math/CalcStats.h>
|
||||||
|
@ -682,6 +683,7 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
|
||||||
switch( m_primaryCostType )
|
switch( m_primaryCostType )
|
||||||
{
|
{
|
||||||
case Common::ActionPrimaryCostType::TacticsPoints:
|
case Common::ActionPrimaryCostType::TacticsPoints:
|
||||||
|
case Common::ActionPrimaryCostType::TacticsPoints1:
|
||||||
{
|
{
|
||||||
auto curTp = m_pSource->getTp();
|
auto curTp = m_pSource->getTp();
|
||||||
|
|
||||||
|
@ -716,7 +718,7 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Logger::debug( "Unknown action cost type: {}", m_primaryCostType );
|
Logger::debug( "Unknown action cost type: {}", static_cast< uint16_t >( m_primaryCostType ) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -126,6 +126,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
||||||
uint64_t* pEffectTargetId;
|
uint64_t* pEffectTargetId;
|
||||||
|
|
||||||
effectResult->data().ActionKey = m_actionId;
|
effectResult->data().ActionKey = m_actionId;
|
||||||
|
effectResult->data().ActionKind = 1;
|
||||||
effectResult->data().Action = static_cast< uint16_t >( m_actionId );
|
effectResult->data().Action = static_cast< uint16_t >( m_actionId );
|
||||||
effectResult->data().MainTarget = m_sourceChara->getId();
|
effectResult->data().MainTarget = m_sourceChara->getId();
|
||||||
effectResult->data().DirTarget = Common::Util::floatToUInt16Rot( m_sourceChara->getRot() );
|
effectResult->data().DirTarget = Common::Util::floatToUInt16Rot( m_sourceChara->getRot() );
|
||||||
|
|
|
@ -899,7 +899,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
|
||||||
effectEntry.Value = static_cast< int16_t >( damage.first );
|
effectEntry.Value = static_cast< int16_t >( damage.first );
|
||||||
effectEntry.Type = ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP;
|
effectEntry.Type = ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP;
|
||||||
effectEntry.Arg0 = static_cast< uint8_t >( damage.second );
|
effectEntry.Arg0 = static_cast< uint8_t >( damage.second );
|
||||||
effectEntry.Arg2 = 0x71;
|
//effectEntry.Arg2 = 0x71;
|
||||||
effectPacket->addEffect( effectEntry, static_cast< uint64_t >( pTarget->getId() ) );
|
effectPacket->addEffect( effectEntry, static_cast< uint64_t >( pTarget->getId() ) );
|
||||||
|
|
||||||
sendToInRangeSet( effectPacket );
|
sendToInRangeSet( effectPacket );
|
||||||
|
|
|
@ -1173,6 +1173,11 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
|
||||||
Chara::update( tickCount );
|
Chara::update( tickCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sapphire::Entity::Player::setLastAttack( uint64_t tickCount )
|
||||||
|
{
|
||||||
|
m_lastAttack = tickCount;
|
||||||
|
}
|
||||||
|
|
||||||
void Sapphire::Entity::Player::freePlayerSpawnId( uint32_t actorId )
|
void Sapphire::Entity::Player::freePlayerSpawnId( uint32_t actorId )
|
||||||
{
|
{
|
||||||
auto spawnId = m_actorSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
|
auto spawnId = m_actorSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
|
||||||
|
@ -1506,12 +1511,12 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
||||||
{
|
{
|
||||||
effectPacket->setAnimationId( 8 );
|
effectPacket->setAnimationId( 8 );
|
||||||
entry.Arg2 = 0x72;
|
//entry.Arg2 = 0x72;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
effectPacket->setAnimationId( 7 );
|
effectPacket->setAnimationId( 7 );
|
||||||
entry.Arg2 = 0x73;
|
//entry.Arg2 = 0x73;
|
||||||
}
|
}
|
||||||
|
|
||||||
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );
|
||||||
|
|
|
@ -94,6 +94,8 @@ namespace Sapphire::Entity
|
||||||
/*! Event called on every session iteration */
|
/*! Event called on every session iteration */
|
||||||
void update( uint64_t tickCount ) override;
|
void update( uint64_t tickCount ) override;
|
||||||
|
|
||||||
|
void setLastAttack( uint64_t tickCount );
|
||||||
|
|
||||||
// Quest
|
// Quest
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/*! load data for currently active quests */
|
/*! load data for currently active quests */
|
||||||
|
|
|
@ -134,6 +134,7 @@ void World::Manager::ActionMgr::bootstrapAction( Entity::Player& player,
|
||||||
|
|
||||||
// todo: what do in cases of swiftcast/etc? script callback?
|
// todo: what do in cases of swiftcast/etc? script callback?
|
||||||
currentAction->start();
|
currentAction->start();
|
||||||
|
player.setLastAttack( Common::Util::getTimeMs() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -587,7 +587,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA
|
||||||
// Logger::debug( format, pot, aa, ap, det, ten, factor );
|
// Logger::debug( format, pot, aa, ap, det, ten, factor );
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::pair( factor * 3, hitType );
|
return std::pair( factor, hitType );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg )
|
std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcActionDamage( const Sapphire::Entity::Chara& chara, uint32_t ptc, float wepDmg )
|
||||||
|
|
|
@ -20,7 +20,9 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
|
||||||
m_data.Flag = 0;
|
m_data.Flag = 0;
|
||||||
m_data.ActionKey = actionId;
|
m_data.ActionKey = actionId;
|
||||||
m_data.Action = static_cast< uint16_t >( actionId );
|
m_data.Action = static_cast< uint16_t >( actionId );
|
||||||
|
m_data.ActionKind = 1;
|
||||||
|
|
||||||
|
m_data.LockTime = 0.6f;
|
||||||
m_data.MainTarget = static_cast< uint64_t >( targetId );
|
m_data.MainTarget = static_cast< uint64_t >( targetId );
|
||||||
|
|
||||||
m_data.ActionArg = Common::ActionEffectDisplayType::ShowActionName;
|
m_data.ActionArg = Common::ActionEffectDisplayType::ShowActionName;
|
||||||
|
|
Loading…
Add table
Reference in a new issue