mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
action lut generation
This commit is contained in:
parent
81fb7ad247
commit
cd09f72a5b
4 changed files with 1187 additions and 4 deletions
8
src/tools/action_parse/ActionLut.cpp.tmpl
Normal file
8
src/tools/action_parse/ActionLut.cpp.tmpl
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include "ActionData.h"
|
||||
|
||||
using namespace Sapphire::World::Action;
|
||||
|
||||
ActionData::ActionLut ActionData::m_actionLut =
|
||||
{
|
||||
%INSERT_GARBAGE%
|
||||
};
|
|
@ -17,8 +17,12 @@
|
|||
#include <streambuf>
|
||||
#include <regex>
|
||||
|
||||
#include <experimental/filesystem>
|
||||
|
||||
Sapphire::Data::ExdDataGenerated g_exdData;
|
||||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
const std::string datLocation( "/home/mordred/sqpack" );
|
||||
|
@ -70,6 +74,9 @@ int main()
|
|||
|
||||
Logger::init( "action_parse" );
|
||||
|
||||
if( !fs::exists( "ActionLut.cpp.tmpl" ) )
|
||||
throw std::runtime_error( "ActionLut.cpp.tmpl is missing in working directory" );
|
||||
|
||||
Logger::info( "Setting up EXD data" );
|
||||
if( !g_exdData.init( datLocation ) )
|
||||
{
|
||||
|
@ -78,7 +85,7 @@ int main()
|
|||
}
|
||||
auto idList = g_exdData.getActionIdList();
|
||||
|
||||
std::unordered_map< uint32_t, ActionEntry > actions;
|
||||
std::map< uint32_t, ActionEntry > actions;
|
||||
|
||||
auto total = idList.size();
|
||||
int cursor = 0;
|
||||
|
@ -233,13 +240,33 @@ int main()
|
|||
|
||||
// dump entries
|
||||
Logger::info( "Found {} player actions", actions.size() );
|
||||
|
||||
std::string output;
|
||||
for( const auto& action : actions )
|
||||
{
|
||||
const auto& data = action.second;
|
||||
Logger::info( " - {:<5} {:<25} pot: {:<4} flank pot: {:<4} front pot: {:<4} rear pot: {:<4} cure pot: {:<4} restore %: {:<4}",
|
||||
action.first, data.name, data.potency, data.flankPotency, data.frontPotency, data.rearPotency,
|
||||
data.curePotency, data.restorePercentage );
|
||||
// Logger::info( " - {:<5} {:<25} pot: {:<4} flank pot: {:<4} front pot: {:<4} rear pot: {:<4} cure pot: {:<4} restore %: {:<4}",
|
||||
// action.first, data.name, data.potency, data.flankPotency, data.frontPotency, data.rearPotency,
|
||||
// data.curePotency, data.restorePercentage );
|
||||
|
||||
auto out = fmt::format( " // {}\n {{ {}, {{ {}, {}, {}, {}, {} }} }},\n",
|
||||
data.name, action.first,
|
||||
data.potency, data.flankPotency, data.frontPotency, data.rearPotency, data.curePotency );
|
||||
|
||||
output += out;
|
||||
// Logger::info( out );
|
||||
}
|
||||
|
||||
std::ifstream ifs( "ActionLut.cpp.tmpl" );
|
||||
|
||||
std::string actionTmpl( ( std::istreambuf_iterator< char >( ifs ) ),
|
||||
std::istreambuf_iterator< char >() );
|
||||
|
||||
auto result = std::regex_replace( actionTmpl, std::regex( "%INSERT_GARBAGE%" ), output );
|
||||
|
||||
std::ofstream outH( "ActionLut.cpp" );
|
||||
outH << result;
|
||||
outH.close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
1120
src/world/Action/ActionLut.cpp
Normal file
1120
src/world/Action/ActionLut.cpp
Normal file
File diff suppressed because it is too large
Load diff
28
src/world/Action/ActionLut.h
Normal file
28
src/world/Action/ActionLut.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef SAPPHIRE_ACTIONLUT_H
|
||||
#define SAPPHIRE_ACTIONLUT_H
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Sapphire::World::Action
|
||||
{
|
||||
struct ActionEntry
|
||||
{
|
||||
uint16_t potency;
|
||||
uint16_t comboPotency;
|
||||
uint16_t flankPotency;
|
||||
uint16_t frontPotency;
|
||||
uint16_t rearPotency;
|
||||
uint16_t curePotency;
|
||||
// uint16_t restorePercentage;
|
||||
};
|
||||
|
||||
class ActionLut
|
||||
{
|
||||
public:
|
||||
using Lut = std::unordered_map< uint16_t, ActionEntry >;
|
||||
|
||||
static Lut m_actionLut;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SAPPHIRE_ACTIONLUT_H
|
Loading…
Add table
Reference in a new issue