1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Basic actions are functional

This commit is contained in:
Mordred 2022-01-02 22:32:17 +01:00
parent c4129924ea
commit d9e7e42a6d
12 changed files with 8578 additions and 1549 deletions

View file

@ -784,7 +784,8 @@ namespace Sapphire::Common
{
None = 0, // ?
MagicPoints = 3,
TacticsPoints = 6,
TacticsPoints = 5,
TacticsPoints1 = 6,
// WARGauge = 22,
// DRKGauge = 25,
// AetherflowStack = 30,

View file

@ -26,5 +26,5 @@ add_subdirectory( "pcb_reader" )
add_subdirectory( "nav_export" )
add_subdirectory( "BattleNpcParserPs3" )
#add_subdirectory( "event_object_parser" )
#add_subdirectory( "action_parse" )
add_subdirectory( "action_parse" )
#add_subdirectory( "questbattle_bruteforce" )

View file

@ -9,7 +9,8 @@
#include <iostream>
#include <cctype>
#include <set>
#include <Exd/ExdDataGenerated.h>
#include <Exd/ExdData.h>
#include <Exd/Structs.h>
#include <Logging/Logger.h>
#include <Common.h>
@ -19,13 +20,12 @@
#include <filesystem>
Sapphire::Data::ExdDataGenerated g_exdData;
namespace fs = std::filesystem;
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" );
struct ActionEntry
@ -83,12 +83,12 @@ int main( int argc, char* argv[] )
}
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
if( !g_exdDataGen.init( datLocation ) )
{
Logger::fatal( "Error setting up EXD data " );
return 0;
}
auto idList = g_exdData.getActionIdList();
auto idList = g_exdDataGen.getIdList< Component::Excel::Action >();
std::map< uint32_t, ActionEntry > actions;
@ -101,25 +101,31 @@ int main( int argc, char* argv[] )
if( cursor % 50 == 0 && cursor > 0 )
Logger::info( "Processing {} actions of {} ({:.2f}%)", cursor, total, done );
auto action = g_exdData.get< Sapphire::Data::Action >( id );
auto actionTransient = g_exdData.get< Sapphire::Data::ActionTransient >( id );
auto action = g_exdDataGen.getRow< Component::Excel::Action >( id );
//auto actionTransient = g_exdData.get< Sapphire::Data::ActionTransient >( id );
if( action )
{
if( action->classJob == -1 || action->name.empty() )
auto& actionData = action->data();
if( actionData.UseClassJob == -1 || action->getString( actionData.Text.Name ).empty() )
continue;
if( action->isPvP )
continue;
//if( actionData.PvPOnly )
// continue;
auto classJob = g_exdData.get< Sapphire::Data::ClassJob >( action->classJob );
if( !classJob )
continue;
// auto classJob = g_exdDataGen.getRow< Component::Excel::ClassJob >( actionData.UseClassJob );
// if( !classJob )
// continue;
// exclude dol/doh
if( classJob->classJobCategory == 32 || classJob->classJobCategory == 33 )
continue;
// if( classJob->data().CraftingClassIndex > 0 )
// 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 &&
ac != Common::ActionCategory::Autoattack &&
ac != Common::ActionCategory::Spell &&
@ -129,11 +135,11 @@ int main( int argc, char* argv[] )
ActionEntry entry{};
entry.name = action->name;
entry.name = action->getString( actionData.Text.Name );
entry.id = id;
Logger::info( " {0} - {1}", id, action->name );
std::string desc = actionTransient->description;
Logger::info( " {0} - {1}", id, action->getString( actionData.Text.Name ) );
std::string desc = action->getString( actionData.Text.Help );
stripUnicode( desc );
desc = std::regex_replace( desc, std::regex( "HI" ), "\n" );
desc = std::regex_replace( desc, std::regex( "IH" ), "" );

View file

@ -4,6 +4,7 @@
#include <Exd/ExdData.h>
#include <Util/Util.h>
#include <Util/UtilMath.h>
#include "Script/ScriptMgr.h"
#include <Math/CalcStats.h>
@ -682,6 +683,7 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
switch( m_primaryCostType )
{
case Common::ActionPrimaryCostType::TacticsPoints:
case Common::ActionPrimaryCostType::TacticsPoints1:
{
auto curTp = m_pSource->getTp();
@ -716,7 +718,7 @@ bool Action::Action::primaryCostCheck( bool subtractCosts )
}
default:
Logger::debug( "Unknown action cost type: {}", m_primaryCostType );
Logger::debug( "Unknown action cost type: {}", static_cast< uint16_t >( m_primaryCostType ) );
return false;
}
}

File diff suppressed because it is too large Load diff

View file

@ -126,6 +126,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
uint64_t* pEffectTargetId;
effectResult->data().ActionKey = m_actionId;
effectResult->data().ActionKind = 1;
effectResult->data().Action = static_cast< uint16_t >( m_actionId );
effectResult->data().MainTarget = m_sourceChara->getId();
effectResult->data().DirTarget = Common::Util::floatToUInt16Rot( m_sourceChara->getRot() );

View file

@ -899,7 +899,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget )
effectEntry.Value = static_cast< int16_t >( damage.first );
effectEntry.Type = ActionEffectType::CALC_RESULT_TYPE_DAMAGE_HP;
effectEntry.Arg0 = static_cast< uint8_t >( damage.second );
effectEntry.Arg2 = 0x71;
//effectEntry.Arg2 = 0x71;
effectPacket->addEffect( effectEntry, static_cast< uint64_t >( pTarget->getId() ) );
sendToInRangeSet( effectPacket );

View file

@ -1173,6 +1173,11 @@ void Sapphire::Entity::Player::update( uint64_t tickCount )
Chara::update( tickCount );
}
void Sapphire::Entity::Player::setLastAttack( uint64_t tickCount )
{
m_lastAttack = tickCount;
}
void Sapphire::Entity::Player::freePlayerSpawnId( uint32_t 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 )
{
effectPacket->setAnimationId( 8 );
entry.Arg2 = 0x72;
//entry.Arg2 = 0x72;
}
else
{
effectPacket->setAnimationId( 7 );
entry.Arg2 = 0x73;
//entry.Arg2 = 0x73;
}
effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) );

View file

@ -94,6 +94,8 @@ namespace Sapphire::Entity
/*! Event called on every session iteration */
void update( uint64_t tickCount ) override;
void setLastAttack( uint64_t tickCount );
// Quest
//////////////////////////////////////////////////////////////////////////////////////////////////////
/*! load data for currently active quests */

View file

@ -134,6 +134,7 @@ void World::Manager::ActionMgr::bootstrapAction( Entity::Player& player,
// todo: what do in cases of swiftcast/etc? script callback?
currentAction->start();
player.setLastAttack( Common::Util::getTimeMs() );
}
}

View file

@ -587,7 +587,7 @@ std::pair< float, Sapphire::Common::ActionHitSeverityType > CalcStats::calcAutoA
// 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 )

View file

@ -20,7 +20,9 @@ namespace Sapphire::Network::Packets::WorldPackets::Server
m_data.Flag = 0;
m_data.ActionKey = 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.ActionArg = Common::ActionEffectDisplayType::ShowActionName;