mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
Merge pull request #306 from NotAdam/develop
remove xmlconfig and implement new configmgr
This commit is contained in:
commit
cb2e45a5a4
71 changed files with 4055 additions and 1193 deletions
20
README.md
20
README.md
|
@ -17,25 +17,7 @@ Sapphire requires the following software:
|
|||
| Boost 1.63.0 | [Win32 precompiled binaries](https://sourceforge.net/projects/boost/files/boost-binaries/1.63.0/boost_1_63_0-msvc-14.0-32.exe/download) | Boost libraries from your distribution's package manager |
|
||||
| MySQL Server 5.7 | [Official Site](https://dev.mysql.com/downloads/mysql/) | MySQL server from your distribution's package manager |
|
||||
|
||||
**Windows**
|
||||
Set the environment variables ``BOOST_ROOT_DIR`` and ``BOOST_LIB_DIR`` to ``[boost main folder]`` and ``[boost main folder]/lib32-msvc-14.0`` respectively **or** copy your boost installation into the project's ``src/lib`` folder.
|
||||
|
||||
Visual Studio 2017 users: open `Visual Studio Installer` and ensure `Individual Components > SDKs, libraries, and frameworks > Windows Universal C Runtime` is installed. You may also need to install `Individual Components > Compilers, build tools, and runtimes > VC++ 2015.3 v140 toolset for desktop (x86, 64)`.
|
||||
|
||||
To enable [Edit and Continue](https://msdn.microsoft.com/en-us/library/esaeyddf.aspx) ensure you define `-DCMAKE_BUILD_TYPE="Debug"` when generating with CMake.
|
||||
|
||||
If you installed CMake outside of Visual Studio and have it in your `PATH` environment variable, navigate to Sapphire folder and `cmake -DCMAKE_BUILD_TYPE="Debug" && cmake --build .`.
|
||||
|
||||
Otherwise:
|
||||
* In *Visual Studio 2017*: Open the project via ``File`` > ``Open`` > ``Folder`` and wait, till CMake automatically finishes cache generation. Right click any CMakeLists.txt and select build to build a application.
|
||||
To configure debug startup parameters, select ``Debug and Launch settings``, the application you want to set up parameters for, and add a ``args`` json array containing your launch parameters in ``configurations``.
|
||||
If Visual Studio fails to generate a CMake Cache or does not show options to build, make sure that the newest version of it is installed and all environment variables are set correctly. Keep in mind that generating a cache can take a while on some machines.
|
||||
|
||||
The solution `Sapphire.sln` is also generated in the main Sapphire folder.
|
||||
|
||||
**Linux**
|
||||
`cmake . -DSAPPHIRE_BOOST_VER="your.boost.ver" && make -j JOBS` where `JOBS` is number of cores on your system.
|
||||
`-j JOBS` can be omitted if your system lacks resources (spoiler: your system probably lacks resources if running on 1GB RAM or lower, or if the build fails due to being out of memory)
|
||||
Please check the [wiki](https://github.com/SapphireMordred/Sapphire/wiki) for detailed installation/build instructions for your OS.
|
||||
|
||||
## Links
|
||||
|
||||
|
|
22
bin/config/global.ini.default
Normal file
22
bin/config/global.ini.default
Normal file
|
@ -0,0 +1,22 @@
|
|||
[Database]
|
||||
Host = 127.0.0.1
|
||||
Port = 3306
|
||||
Database = sapphire
|
||||
Username = sapphire
|
||||
Password =
|
||||
SyncThreads = 2
|
||||
AsyncThreads = 2
|
||||
|
||||
[GlobalParameters]
|
||||
ServerSecret = default
|
||||
DataPath = C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack
|
||||
|
||||
[GlobalNetwork]
|
||||
ZoneHost = 127.0.0.1
|
||||
ZonePort = 54992
|
||||
|
||||
LobbyHost = 127.0.0.1
|
||||
LobbyPort = 54994
|
||||
|
||||
RestHost = 127.0.0.1
|
||||
RestPort = 80
|
4
bin/config/lobby.ini.default
Normal file
4
bin/config/lobby.ini.default
Normal file
|
@ -0,0 +1,4 @@
|
|||
[Lobby]
|
||||
WorldID = 67
|
||||
AllowNoSessionConnect = false
|
||||
WorldName = Sapphire
|
2
bin/config/rest.ini.default
Normal file
2
bin/config/rest.ini.default
Normal file
|
@ -0,0 +1,2 @@
|
|||
[CharacterCreation]
|
||||
DefaultGMRank = 255
|
|
@ -1,34 +0,0 @@
|
|||
<Settings>
|
||||
<General>
|
||||
<!-- Port the lobby server accepts client connections on -->
|
||||
<ListenPort>54994</ListenPort>
|
||||
<AuthPort>54998</AuthPort>
|
||||
<!-- Ip the lobby server listens on -->
|
||||
<ListenIp>127.0.0.1</ListenIp>
|
||||
<!-- IP of the world server -->
|
||||
<ZoneIp>127.0.0.1</ZoneIp>
|
||||
<!-- Port the world server listens for clients -->
|
||||
<ZonePort>54992</ZonePort>
|
||||
<!-- Address to connect to the rest server -->
|
||||
<RestHost>127.0.0.1:80</RestHost>
|
||||
<!-- Secret for server authentication -->
|
||||
<ServerSecret>default</ServerSecret>
|
||||
<!-- Connection settings for the mysql db -->
|
||||
<Mysql>
|
||||
<Host>127.0.0.1</Host>
|
||||
<Port>3306</Port>
|
||||
<Username>root</Username>
|
||||
<Pass></Pass>
|
||||
<Database>sapphire</Database>
|
||||
</Mysql>
|
||||
</General>
|
||||
<Parameters>
|
||||
<!-- Do not disconnect players without a session - this should be definitely disabled unless you are testing on a PS4 -->
|
||||
<AllowNoSessionConnect>false</AllowNoSessionConnect>
|
||||
<!-- The ID of the Sapphire world - this is what the game determines your datacenter with, check world.exh -->
|
||||
<WorldID>67</WorldID>
|
||||
<!-- The name of the world -->
|
||||
<!-- TODO: Allow multiple world servers -->
|
||||
<WorldName>Sapphire</WorldName>
|
||||
</Parameters>
|
||||
</Settings>
|
|
@ -1,32 +0,0 @@
|
|||
<Settings>
|
||||
<General>
|
||||
<!-- Port the lobby server accepts client connections on -->
|
||||
<ListenPort>54994</ListenPort>
|
||||
<AuthPort>54998</AuthPort>
|
||||
<!-- Ip the lobby server listens on -->
|
||||
<ListenIp>127.0.0.1</ListenIp>
|
||||
<!-- Path of FFXIV dat files -->
|
||||
<DataPath>C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack</DataPath>
|
||||
<!-- <DataPath>/opt/sapphire_3_15_0/bin/sqpack</DataPath> -->
|
||||
<!-- IP of the lobby server -->
|
||||
<LobbyHost>127.0.0.1</LobbyHost>
|
||||
<!-- IP of the frontier server -->
|
||||
<FrontierHost>127.0.0.1</FrontierHost>
|
||||
<!-- Secret used for server auth - you *must* change this for public servers -->
|
||||
<ServerSecret>default</ServerSecret>
|
||||
<!-- Web server port -->
|
||||
<HttpPort>80</HttpPort>
|
||||
<Mysql>
|
||||
<Host>127.0.0.1</Host>
|
||||
<Port>3306</Port>
|
||||
<Username>root</Username>
|
||||
<Pass></Pass>
|
||||
<Database>sapphire</Database>
|
||||
</Mysql>
|
||||
</General>
|
||||
|
||||
<Parameters>
|
||||
<!-- GM Rank for newly created characters - should be changed to 0 for public servers -->
|
||||
<DefaultGMRank>255</DefaultGMRank>
|
||||
</Parameters>
|
||||
</Settings>
|
|
@ -1,45 +0,0 @@
|
|||
<Settings>
|
||||
<General>
|
||||
<!-- Port the zone server accepts game conenctions on -->
|
||||
<ListenPort>54992</ListenPort>
|
||||
<!-- Ip the zone server conenctions on -->
|
||||
<ListenIp>127.0.0.1</ListenIp>
|
||||
<!-- Path of FFXIV dat files -->
|
||||
<DataPath>C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack</DataPath>
|
||||
|
||||
<Scripts>
|
||||
<!-- where compiled scripts are placed -->
|
||||
<Path>./compiledscripts/</Path>
|
||||
<CachePath>./cache/</CachePath>
|
||||
|
||||
<HotSwap>
|
||||
<Enabled>true</Enabled>
|
||||
<ScriptsDir>../scripts/native/</ScriptsDir>
|
||||
<BuildDir>../cmake-build-debug/</BuildDir>
|
||||
<BuildCmd>cmake --build %1% --target %2%</BuildCmd>
|
||||
</HotSwap>
|
||||
</Scripts>
|
||||
|
||||
<!-- Path of Chai script files -->
|
||||
<ScriptPath>./compiledscripts/</ScriptPath>
|
||||
<!-- Connection settings for the mysql db -->
|
||||
<Mysql>
|
||||
<Host>127.0.0.1</Host>
|
||||
<Port>3306</Port>
|
||||
<Username>root</Username>
|
||||
<Pass></Pass>
|
||||
<Database>sapphire</Database>
|
||||
<SyncThreads>2</SyncThreads>
|
||||
<AsyncThreads>2</AsyncThreads>
|
||||
</Mysql>
|
||||
</General>
|
||||
|
||||
<Parameters>
|
||||
<!-- Messages players see upon logging in - These *must* be smaller than 307 characters -->
|
||||
<MotDArray>
|
||||
<MotD><<<Welcome to Sapphire>>></MotD>
|
||||
<MotD>This is a very good server</MotD>
|
||||
<MotD>You can change these messages by editing MotDArray in config/settings_zone.xml</MotD>
|
||||
</MotDArray>
|
||||
</Parameters>
|
||||
</Settings>
|
14
bin/config/zone.ini.default
Normal file
14
bin/config/zone.ini.default
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Scripts]
|
||||
; where compiled script modules are located
|
||||
Path = ./compiledscripts/
|
||||
; relative to Path, where we copy and load modules from
|
||||
CachePath = ./cache/
|
||||
; whether we should detect changes to script modules and reload them
|
||||
HotSwap = true
|
||||
|
||||
[Network]
|
||||
DisconnectTimeout = 20
|
||||
|
||||
[General]
|
||||
; Sent on login - each line must be shorter than 307 characters, split lines with ';'
|
||||
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/zone.ini
|
|
@ -553,6 +553,7 @@ namespace Common {
|
|||
AetherReductionDlg = 0x17D,
|
||||
|
||||
Unk6 = 0x19C,
|
||||
EObjAnimation = 0x19D,
|
||||
|
||||
SetTitle = 0x1F4,
|
||||
|
||||
|
@ -562,6 +563,7 @@ namespace Common {
|
|||
SetFavorite = 0x1FC,
|
||||
LearnTeleport = 0x1FD,
|
||||
|
||||
OpenRecommendationGuide = 0x200,
|
||||
ArmoryErrorMsg = 0x201,
|
||||
|
||||
AchievementPopup = 0x203,
|
||||
|
|
66
src/common/Config/ConfigMgr.cpp
Normal file
66
src/common/Config/ConfigMgr.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
#include "ConfigMgr.h"
|
||||
|
||||
#include <boost/property_tree/ini_parser.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
/**
|
||||
* Loads an ini file and parses it
|
||||
* @param configName the name of ini file relative to m_configFolderRoot to load alongside global.ini
|
||||
* @return true if loading was successful
|
||||
*/
|
||||
bool Core::ConfigMgr::loadConfig( const std::string& configName )
|
||||
{
|
||||
std::stringstream configStream;
|
||||
|
||||
// get global config
|
||||
auto configDir = boost::filesystem::path( m_configFolderRoot );
|
||||
|
||||
if( !boost::filesystem::exists( configDir ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
auto globalConfig = boost::filesystem::path( configDir / m_globalConfigFile );
|
||||
if( !boost::filesystem::exists( globalConfig ) )
|
||||
{
|
||||
if( !copyDefaultConfig( globalConfig.filename().string() ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ifstream globalConfigFile( globalConfig.c_str() );
|
||||
configStream << globalConfigFile.rdbuf();
|
||||
|
||||
// add some newlines just in case there's no newline at the end of the global file
|
||||
configStream << "\n\n";
|
||||
|
||||
// get local config
|
||||
auto localConfig = boost::filesystem::path( configDir / configName );
|
||||
if( !boost::filesystem::exists( localConfig ) )
|
||||
{
|
||||
if( !copyDefaultConfig( localConfig.filename().string() ) )
|
||||
return false;
|
||||
}
|
||||
std::ifstream configFile( localConfig.c_str() );
|
||||
configStream << configFile.rdbuf();
|
||||
|
||||
// parse the tree and we're fuckin done
|
||||
boost::property_tree::read_ini( configStream, m_propTree );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Core::ConfigMgr::copyDefaultConfig( const std::string& configName )
|
||||
{
|
||||
boost::filesystem::path configPath( m_configFolderRoot );
|
||||
configPath /= configName;
|
||||
|
||||
if( !boost::filesystem::exists( configPath.string() + m_configDefaultSuffix ) )
|
||||
{
|
||||
// no default file :(
|
||||
return false;
|
||||
}
|
||||
|
||||
boost::filesystem::copy_file( configPath.string() + m_configDefaultSuffix, configPath );
|
||||
|
||||
return true;
|
||||
}
|
45
src/common/Config/ConfigMgr.h
Normal file
45
src/common/Config/ConfigMgr.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
#ifndef SAPPHIRE_CONFIGMGR_H
|
||||
#define SAPPHIRE_CONFIGMGR_H
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
namespace Core
|
||||
{
|
||||
class ConfigMgr
|
||||
{
|
||||
public:
|
||||
ConfigMgr() = default;
|
||||
~ConfigMgr() = default;
|
||||
|
||||
bool loadConfig( const std::string& configName );
|
||||
|
||||
template< class T >
|
||||
T getValue( const std::string& name, T defaultValue = T() )
|
||||
{
|
||||
try
|
||||
{
|
||||
return m_propTree.get< T >( name );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
template< class T >
|
||||
void setValue( const std::string& name, T defaultValue = T() )
|
||||
{
|
||||
m_propTree.put( name, defaultValue );
|
||||
}
|
||||
|
||||
private:
|
||||
bool copyDefaultConfig( const std::string& configName );
|
||||
|
||||
boost::property_tree::ptree m_propTree;
|
||||
const std::string m_globalConfigFile = "global.ini";
|
||||
const std::string m_configFolderRoot = "./config/";
|
||||
const std::string m_configDefaultSuffix = ".default";
|
||||
};
|
||||
}
|
||||
|
||||
#endif //SAPPHIRE_CONFIGMGR_H
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -6,9 +6,9 @@
|
|||
namespace Core
|
||||
{
|
||||
|
||||
class XMLConfig;
|
||||
class ConfigMgr;
|
||||
|
||||
typedef boost::shared_ptr<XMLConfig> XMLConfigPtr;
|
||||
typedef boost::shared_ptr< ConfigMgr > ConfigMgrPtr;
|
||||
|
||||
|
||||
namespace Network
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
/**
|
||||
* Structural definitions common to all FFXIV:ARR packets.
|
||||
*/
|
||||
#ifndef _CORE_NETWORK_PACKETS_COMMON_H
|
||||
#define _CORE_NETWORK_PACKETS_COMMON_H
|
||||
|
||||
|
@ -46,6 +43,8 @@ namespace Packets {
|
|||
*
|
||||
* 0 4 8 12 14 16
|
||||
* +-------------------------------+---------------+-------+-------+
|
||||
* | unknown_0 | unknown_8 |
|
||||
* +-------------------------------+---------------+-------+-------+
|
||||
* | timestamp | size | cType | count |
|
||||
* +---+---+-------+---------------+---------------+-------+-------+
|
||||
* | ? |CMP| ? | ? |
|
||||
|
@ -54,13 +53,10 @@ namespace Packets {
|
|||
*/
|
||||
struct FFXIVARR_PACKET_HEADER
|
||||
{
|
||||
|
||||
/** Unknown data, no actual use has been determined */
|
||||
uint64_t unknown_0;
|
||||
uint64_t unknown_8;
|
||||
/**
|
||||
* Represents the number of milliseconds since epoch that the packet was
|
||||
* sent.
|
||||
*/
|
||||
/** Represents the number of milliseconds since epoch that the packet was sent. */
|
||||
uint64_t timestamp;
|
||||
/** The size of the packet header and its payload */
|
||||
uint32_t size;
|
||||
|
@ -92,7 +88,7 @@ inline istream& operator>>(istream& is, FFXIVARR_PACKET_HEADER& hdr)
|
|||
*
|
||||
* 0 4 8 12 16
|
||||
* +---------------+---------------+---------------+-------+-------+
|
||||
* | size | source_actor | target_actor | type | ? |
|
||||
* | size | source_actor | target_actor | type | pad |
|
||||
* +---------------+---------------+---------------+-------+-------+
|
||||
* | |
|
||||
* : type-specific data of length, size, follows :
|
||||
|
@ -109,7 +105,7 @@ struct FFXIVARR_PACKET_SEGMENT_HEADER
|
|||
uint32_t target_actor;
|
||||
/** The segment type. (1, 2, 3, 7, 8, 9, 10) */
|
||||
uint16_t type;
|
||||
uint16_t _reserved_E;
|
||||
uint16_t padding;
|
||||
};
|
||||
|
||||
inline ostream& operator << ( ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
||||
|
@ -122,8 +118,6 @@ inline istream& operator>>(istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr)
|
|||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||
}
|
||||
|
||||
// TODO: Include structures for the individual packet segment types
|
||||
|
||||
template < int T > struct FFXIVIpcBasePacket
|
||||
{
|
||||
/** Creates a constant representing the IPC type */
|
||||
|
@ -142,7 +136,7 @@ struct FFXIVARR_PACKET_RAW
|
|||
*
|
||||
* 0 4 6 8 12 16
|
||||
* +-------+-------+------+----------+---------------+---------------+
|
||||
* | 14 00 | type | ?? | serverId | timestamp | ??? |
|
||||
* | 14 00 | type | pad | serverId | timestamp | pad1 |
|
||||
* +-------+-------+------+----------+---------------+---------------+
|
||||
* | |
|
||||
* : data :
|
||||
|
@ -153,10 +147,10 @@ struct FFXIVARR_IPC_HEADER
|
|||
{
|
||||
uint16_t reserved;
|
||||
uint16_t type;
|
||||
uint16_t unknown_2;
|
||||
uint16_t padding;
|
||||
uint16_t serverId;
|
||||
uint32_t timestamp;
|
||||
uint32_t unknown_C;
|
||||
uint32_t padding1;
|
||||
};
|
||||
|
||||
inline ostream& operator << ( ostream& os, const FFXIVARR_IPC_HEADER& hdr )
|
||||
|
@ -169,8 +163,6 @@ inline istream& operator>>(istream& is, FFXIVARR_IPC_HEADER& hdr)
|
|||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
} /* Packets */
|
||||
} /* Network */
|
||||
} /* Core */
|
||||
|
|
|
@ -7,23 +7,24 @@
|
|||
#include <boost/format.hpp>
|
||||
#include "Util/Util.h"
|
||||
|
||||
Core::Network::Packets::GamePacket::GamePacket( uint16_t subType, uint16_t size, uint32_t id1, uint32_t id2, uint16_t type )
|
||||
Core::Network::Packets::GamePacket::GamePacket( uint16_t subType, uint16_t size,
|
||||
uint32_t id1, uint32_t id2, uint16_t type )
|
||||
{
|
||||
m_dataBuf = std::vector< uint8_t >( size );
|
||||
memset( &m_segHdr, 0, sizeof( m_segHdr ) );
|
||||
|
||||
setHeader( size, type, id1, id2, subType, 0x00 );
|
||||
|
||||
}
|
||||
|
||||
void Core::Network::Packets::GamePacket::setHeader( uint16_t size, uint16_t type, uint32_t id1, uint32_t id2, uint16_t subType, uint32_t unknown )
|
||||
void Core::Network::Packets::GamePacket::setHeader( uint16_t size, uint16_t type, uint32_t id1,
|
||||
uint32_t id2, uint16_t subType, uint32_t unknown )
|
||||
{
|
||||
|
||||
m_segHdr.size = size;
|
||||
m_segHdr.type = type;
|
||||
m_segHdr.source_actor = id1;
|
||||
m_segHdr.target_actor = id2;
|
||||
m_segHdr._reserved_E = 0x00;
|
||||
//m_segHdr._reserved_E = 0x00;
|
||||
m_subType = subType;
|
||||
|
||||
m_timeStamp = static_cast< uint32_t >( time( nullptr ) );
|
||||
|
@ -67,7 +68,10 @@ Core::Network::Packets::GamePacket::GamePacket( const Packets::FFXIVARR_PACKET_R
|
|||
m_segHdr = packetData.segHdr;
|
||||
m_dataBuf = std::vector< uint8_t >( m_segHdr.size );
|
||||
|
||||
memcpy( &m_dataBuf[0] + sizeof( Packets::FFXIVARR_PACKET_SEGMENT_HEADER ), &packetData.data[0], m_segHdr.size - sizeof( Packets::FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||
memcpy( &m_dataBuf[0] + sizeof( Packets::FFXIVARR_PACKET_SEGMENT_HEADER ),
|
||||
&packetData.data[0],
|
||||
m_segHdr.size - sizeof( Packets::FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||
|
||||
memcpy( &m_dataBuf[0], &m_segHdr, sizeof( Packets::FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||
|
||||
m_subType = *reinterpret_cast< uint16_t* >( &m_dataBuf[0] + 0x12 );
|
||||
|
@ -88,7 +92,7 @@ Core::Network::Packets::GamePacket::~GamePacket()
|
|||
void Core::Network::Packets::GamePacket::savePacket()
|
||||
{
|
||||
char filename[20];
|
||||
sprintf( filename, "dump_0x%x.dat", m_subType );
|
||||
sprintf( filename, "dump_0x%x_%li.dat", m_subType, Util::getTimeMs() );
|
||||
FILE* fp = nullptr;
|
||||
fp = fopen( filename, "wb" );
|
||||
fwrite( &m_dataBuf[0], 1, m_segHdr.size, fp );
|
||||
|
|
|
@ -32,15 +32,15 @@ using ChatChannelPacket = GamePacketNew< T, ServerChatIpcType >;
|
|||
* The base implementation of a game packet. Needed for parsing packets.
|
||||
*/
|
||||
template < typename T1 >
|
||||
class GamePacketNewBase
|
||||
class FFXIVIpcPacketBase
|
||||
{
|
||||
public:
|
||||
virtual ~GamePacketNewBase() = default;
|
||||
virtual ~FFXIVIpcPacketBase() = default;
|
||||
/**
|
||||
* @brief Gets the IPC type of this packet. (Useful for determining the
|
||||
* type of a parsed packet.)
|
||||
*/
|
||||
virtual T1 ipcType( void ) = 0;
|
||||
virtual T1 ipcType() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ public:
|
|||
* 32 byte header information.)
|
||||
*/
|
||||
template < typename T, typename T1 >
|
||||
class GamePacketNew : public GamePacketNewBase<T1>
|
||||
class GamePacketNew : public FFXIVIpcPacketBase< T1 >
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ protected:
|
|||
};
|
||||
|
||||
public:
|
||||
virtual T1 ipcType( void )
|
||||
virtual T1 ipcType()
|
||||
{
|
||||
return static_cast< T1 >( m_data._ServerIpcType );
|
||||
};
|
||||
|
|
|
@ -5,14 +5,7 @@
|
|||
|
||||
using namespace Core::Network::Packets;
|
||||
|
||||
namespace Core
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
namespace Packets
|
||||
{
|
||||
PacketParseResult getHeader(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
PacketParseResult Core::Network::Packets::getHeader( const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
FFXIVARR_PACKET_HEADER &header )
|
||||
{
|
||||
|
@ -21,23 +14,18 @@ namespace Core
|
|||
// Check if we have enough bytes in the buffer.
|
||||
auto remainingBytes = buffer.size() - offset;
|
||||
if( remainingBytes < headerSize )
|
||||
{
|
||||
return Incomplete;
|
||||
}
|
||||
|
||||
// Copy packet header.
|
||||
memcpy( &header, buffer.data() + offset, headerSize );
|
||||
|
||||
if( !checkHeader(header) )
|
||||
{
|
||||
return Malformed;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PacketParseResult getSegmentHeader(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
PacketParseResult Core::Network::Packets::getSegmentHeader( const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
FFXIVARR_PACKET_SEGMENT_HEADER &header )
|
||||
{
|
||||
|
@ -46,9 +34,7 @@ namespace Core
|
|||
// Check if we have enough bytes in the buffer.
|
||||
auto remainingBytes = buffer.size() - offset;
|
||||
if( remainingBytes < headerSize )
|
||||
{
|
||||
return Incomplete;
|
||||
}
|
||||
|
||||
// Copy segment header
|
||||
memcpy( &header, buffer.data() + offset, headerSize );
|
||||
|
@ -56,8 +42,7 @@ namespace Core
|
|||
return Success;
|
||||
}
|
||||
|
||||
PacketParseResult getPackets(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
PacketParseResult Core::Network::Packets::getPackets( const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
const FFXIVARR_PACKET_HEADER &packetHeader,
|
||||
std::vector< FFXIVARR_PACKET_RAW > &packets )
|
||||
|
@ -65,9 +50,7 @@ namespace Core
|
|||
// sanity check: check there's enough bytes in the buffer
|
||||
const auto bytesExpected = packetHeader.size - sizeof( struct FFXIVARR_PACKET_HEADER );
|
||||
if( buffer.size() - offset < bytesExpected )
|
||||
{
|
||||
return Incomplete;
|
||||
}
|
||||
|
||||
// Loop each message
|
||||
uint32_t count = 0;
|
||||
|
@ -79,9 +62,7 @@ namespace Core
|
|||
// Copy ipc packet message
|
||||
const auto packetResult = getPacket( buffer, offset + bytesProcessed, rawPacket );
|
||||
if( packetResult != Success )
|
||||
{
|
||||
return packetResult;
|
||||
}
|
||||
|
||||
// NOTE: isn't rawPacket is allocated on stack?
|
||||
// why is okay to do this?
|
||||
|
@ -95,31 +76,22 @@ namespace Core
|
|||
// sanity check: check if we processed all bytes.
|
||||
// this check can fail if size of messages don't add up to size reported from packet header.
|
||||
if( bytesExpected != bytesProcessed )
|
||||
{
|
||||
return Malformed;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
PacketParseResult getPacket(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
FFXIVARR_PACKET_RAW &packet
|
||||
)
|
||||
PacketParseResult Core::Network::Packets::getPacket( const std::vector< uint8_t > &buffer, const uint32_t offset,
|
||||
FFXIVARR_PACKET_RAW &packet )
|
||||
{
|
||||
// Copy segment header
|
||||
const auto headerResult = getSegmentHeader( buffer, offset, packet.segHdr );
|
||||
if( headerResult != Success )
|
||||
{
|
||||
return headerResult;
|
||||
}
|
||||
|
||||
// Check header sanity and it's size
|
||||
if( !checkSegmentHeader( packet.segHdr ) )
|
||||
{
|
||||
return Malformed;
|
||||
}
|
||||
|
||||
const auto dataOffset = offset + sizeof( struct FFXIVARR_PACKET_SEGMENT_HEADER );
|
||||
const auto dataSize = packet.segHdr.size;
|
||||
|
@ -131,33 +103,24 @@ namespace Core
|
|||
return Success;
|
||||
}
|
||||
|
||||
bool checkHeader(const FFXIVARR_PACKET_HEADER &header)
|
||||
bool Core::Network::Packets::checkHeader( const FFXIVARR_PACKET_HEADER &header )
|
||||
{
|
||||
// Max size of the packet is capped at 1MB for now.
|
||||
if( header.size > 1 * 1024 * 1024 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Max number of message is capped at 255 for now.
|
||||
if( header.count > 255 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool checkSegmentHeader(const FFXIVARR_PACKET_SEGMENT_HEADER &header)
|
||||
bool Core::Network::Packets::checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER &header )
|
||||
{
|
||||
// Max size of individual message is capped at 256KB for now.
|
||||
if( header.size > 256 * 1024 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
#define _GAMEPACKETPARSER_H
|
||||
#include "CommonNetwork.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
namespace Packets
|
||||
{
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
namespace Packets {
|
||||
|
||||
enum PacketParseResult
|
||||
{
|
||||
/// Dissected game packet successfully
|
||||
|
@ -22,36 +20,25 @@ namespace Core
|
|||
|
||||
/// Read packet header from buffer with given offset.
|
||||
/// Buffer with given offset must be pointing to start of the new FFXIV packet.
|
||||
PacketParseResult getHeader(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
FFXIVARR_PACKET_HEADER &header
|
||||
);
|
||||
PacketParseResult getHeader( const std::vector< uint8_t > &buffer, const uint32_t offset,
|
||||
FFXIVARR_PACKET_HEADER &header );
|
||||
|
||||
/// Read packet header from buffer with given offset.
|
||||
/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
|
||||
/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed.
|
||||
PacketParseResult getSegmentHeader(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
FFXIVARR_PACKET_SEGMENT_HEADER &header
|
||||
);
|
||||
PacketParseResult getSegmentHeader( const std::vector< uint8_t > &buffer, const uint32_t offset,
|
||||
FFXIVARR_PACKET_SEGMENT_HEADER &header );
|
||||
|
||||
/// Read packets from the buffer with given offset.
|
||||
/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data.
|
||||
PacketParseResult getPackets(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
PacketParseResult getPackets( const std::vector< uint8_t > &buffer, const uint32_t offset,
|
||||
const FFXIVARR_PACKET_HEADER &header,
|
||||
std::vector< Packets::FFXIVARR_PACKET_RAW > &packets );
|
||||
|
||||
/// Read single packet from the buffer with given offset.
|
||||
/// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
|
||||
PacketParseResult getPacket(
|
||||
const std::vector< uint8_t > &buffer,
|
||||
const uint32_t offset,
|
||||
FFXIVARR_PACKET_RAW &packet
|
||||
);
|
||||
PacketParseResult getPacket( const std::vector< uint8_t > &buffer, const uint32_t offset,
|
||||
FFXIVARR_PACKET_RAW &packet );
|
||||
|
||||
bool checkHeader(const FFXIVARR_PACKET_HEADER &header);
|
||||
bool checkSegmentHeader(const FFXIVARR_PACKET_SEGMENT_HEADER &header);
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
#include <chrono>
|
||||
|
||||
|
||||
Core::Network::Packets::PacketContainer::PacketContainer( void )
|
||||
Core::Network::Packets::PacketContainer::PacketContainer()
|
||||
{
|
||||
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_PACKET_HEADER ) );
|
||||
m_ipcHdr.size = sizeof( FFXIVARR_PACKET_HEADER );
|
||||
m_ipcHdr.count = 0;
|
||||
}
|
||||
|
||||
Core::Network::Packets::PacketContainer::~PacketContainer( void )
|
||||
Core::Network::Packets::PacketContainer::~PacketContainer()
|
||||
{
|
||||
m_entryList.clear();
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ class GamePacket;
|
|||
class PacketContainer
|
||||
{
|
||||
public:
|
||||
PacketContainer( void );
|
||||
~PacketContainer( void );
|
||||
PacketContainer();
|
||||
~PacketContainer();
|
||||
|
||||
void addPacket( GamePacket pEntry );
|
||||
|
||||
|
|
|
@ -45,11 +45,10 @@ namespace Packets {
|
|||
enum ServerZoneIpcType : uint16_t
|
||||
{
|
||||
|
||||
// static opcode ( the ones that rarely if ever change )
|
||||
// static opcode ( the ones that rarely, if ever, change )
|
||||
Ping = 0x0065,
|
||||
Init = 0x0066,
|
||||
|
||||
ActorSpawn = 0x0190, // DEPRECATED
|
||||
ActorFreeSpawn = 0x0191,
|
||||
InitZone = 0x019A,
|
||||
|
||||
|
@ -62,7 +61,7 @@ namespace Packets {
|
|||
///////////////////////////////////////////////////
|
||||
|
||||
ChatBanned = 0x006B,
|
||||
Logout = 0x0077,
|
||||
Logout = 0x0077, // updated 4.3
|
||||
CFNotify = 0x0078,
|
||||
CFMemberStatus = 0x0079,
|
||||
CFDutyInfo = 0x007A,
|
||||
|
@ -74,118 +73,126 @@ namespace Packets {
|
|||
CFRegistered = 0x00B8, // updated 4.1
|
||||
SocialRequestResponse = 0x00BB, // updated 4.1
|
||||
CancelAllianceForming = 0x00C6, // updated 4.2
|
||||
Chat = 0x00E1, // updated 4.2
|
||||
SocialList = 0x00E7, // updated 4.2
|
||||
|
||||
UpdateSearchInfo = 0x00EA, // updated 4.2
|
||||
InitSearchInfo = 0x00EB, // updated 4.2
|
||||
Chat = 0x00F7, // updated 4.3
|
||||
SocialList = 0x00FD, // updated 4.3
|
||||
|
||||
ServerNotice = 0x00F0, // updated 4.2
|
||||
SetOnlineStatus = 0x00F1, // updated 4.2
|
||||
UpdateSearchInfo = 0x0100, // updated 4.3
|
||||
InitSearchInfo = 0x0101, // updated 4.3
|
||||
|
||||
CountdownInitiate = 0x00FB, // updated 4.2
|
||||
CountdownCancel = 0x00FC, // updated 4.2
|
||||
ServerNotice = 0x0106, // updated 4.3
|
||||
SetOnlineStatus = 0x0107, // updated 4.3
|
||||
|
||||
BlackList = 0x00FF, // updated 4.2
|
||||
CountdownInitiate = 0x0111, // updated 4.3
|
||||
CountdownCancel = 0x0112, // updated 4.3
|
||||
|
||||
BlackList = 0x0115, // updated 4.3
|
||||
|
||||
LogMessage = 0x00D0,
|
||||
|
||||
LinkshellList = 0x0106, // updated 4.2
|
||||
SetCharacterFCInfo = 0x0114, // updated 4.2
|
||||
StatusEffectList = 0x0125, // updated 4.2
|
||||
Effect = 0x0128, // updated 4.2
|
||||
PersistantEffect = 0x013B, // updated 4.2
|
||||
LinkshellList = 0x011C, // updated 4.3
|
||||
SetCharaFCTag = 0x013B, // updated 4.3
|
||||
SetFreeCompanyInfo = 0x013D, // updated 4.3
|
||||
|
||||
StatusEffectList = 0x014E, // updated 4.3
|
||||
Effect = 0x0151, // updated 4.3
|
||||
PersistantEffect = 0x0158, // updated 4.3
|
||||
|
||||
GCAffiliation = 0xCCFC, // OUTDATED
|
||||
|
||||
PlayerSpawn = 0x015C, // updated 4.2
|
||||
NpcSpawn = 0x015D, // updated 4.2
|
||||
ActorMove = 0x015E, // updated 4.2
|
||||
ActorSetPos = 0x0160, // updated 4.2
|
||||
PlayerSpawn = 0x0172, // updated 4.3
|
||||
NpcSpawn = 0x0173, // updated 4.3
|
||||
ActorMove = 0x0174, // updated 4.3
|
||||
ActorSetPos = 0x0176, // updated 4.3
|
||||
|
||||
ActorCast = 0x0162, // updated 4.2
|
||||
ActorCast = 0x0178, // updated 4.3
|
||||
|
||||
HateList = 0x0165, // updated 4.2
|
||||
PartyList = 0x017A, // updated 4.3
|
||||
HateList = 0x017B, // updated 4.3
|
||||
|
||||
ObjectSpawn = 0x0167, // updated 4.2
|
||||
ObjectDespawn = 0x0168, // updated 4.2
|
||||
UpdateClassInfo = 0x0169, // updated 4.2
|
||||
ObjectSpawn = 0x017D, // updated 4.3
|
||||
ObjectDespawn = 0x017E, // updated 4.3
|
||||
|
||||
InitUI = 0x016B, // updated 4.2
|
||||
PlayerStats = 0x016C, // updated 4.2
|
||||
ActorOwner = 0x016D, // updated 4.2 ?
|
||||
PlayerStateFlags = 0x016E, // updated 4.2
|
||||
PlayerClassInfo = 0x016F, // updated 4.2
|
||||
ModelEquip = 0x0170, // updated 4.2
|
||||
|
||||
ItemInfo = 0x017A, // updated 4.2
|
||||
ContainerInfo = 0x017B, // updated 4.2
|
||||
InventoryTransactionFinish = 0x017C, // updated 4.2
|
||||
InventoryTransaction = 0x017D, // updated 4.2
|
||||
CurrencyCrystalInfo = 0x017E, // updated 4.2
|
||||
SetLevelSync = 0x017F, // updated 4.3
|
||||
|
||||
InventoryActionAck = 0x0180, // updated 4.2 ?
|
||||
UpdateInventorySlot = 0x0181, // updated 4.2
|
||||
|
||||
EventPlay = 0x018E, // updated 4.2
|
||||
DirectorPlayScene = 0x0192, // updated 4.2
|
||||
InitUI = 0x0181, // updated 4.3
|
||||
PlayerStats = 0x0182, // updated 4.3
|
||||
ActorOwner = 0x0183, // updated 4.3 ?
|
||||
PlayerStateFlags = 0x0184, // updated 4.3
|
||||
PlayerClassInfo = 0x0185, // updated 4.3
|
||||
ModelEquip = 0x0186, // updated 4.3
|
||||
|
||||
EventStart = 0x0198, // updated 4.2
|
||||
EventFinish = 0x0199, // updated 4.2
|
||||
UpdateClassInfo = 0x018A, // updated 4.3
|
||||
|
||||
ItemInfo = 0x0190, // updated 4.3
|
||||
ContainerInfo = 0x0192, // updated 4.3
|
||||
InventoryTransactionFinish = 0x0193, // updated 4.3
|
||||
InventoryTransaction = 0x0194, // updated 4.3
|
||||
CurrencyCrystalInfo = 0x0197, // updated 4.3
|
||||
|
||||
UpdateInventorySlot = 0x0198, // updated 4.3
|
||||
|
||||
EventPlay = 0x01A6, // updated 4.3
|
||||
DirectorPlayScene = 0x01AA, // updated 4.3
|
||||
|
||||
EventStart = 0x01AF, // updated 4.3
|
||||
EventFinish = 0x01B0, // updated 4.3
|
||||
|
||||
EventLinkshell = 0x1169,
|
||||
|
||||
QuestMessage = 0x01B8, // updated 4.2
|
||||
QuestTracker = 0x01BD, // updated 4.2
|
||||
QuestActiveList = 0x01C3, // updated 4.3
|
||||
QuestUpdate = 0x01C4, // updated 4.3
|
||||
QuestCompleteList = 0x01C5, // updated 4.3
|
||||
|
||||
QuestFinish = 0x01B0, // updated 4.2
|
||||
MSQTrackerComplete = 0x01B1, // updated 4.2
|
||||
MSQTrackerProgress = 0x01B2, // updated 4.2
|
||||
QuestFinish = 0x01C6, // updated 4.3
|
||||
MSQTrackerComplete = 0x01C7, // updated 4.3
|
||||
MSQTrackerProgress = 0x01C8, // updated 4.3
|
||||
|
||||
QuestActiveList = 0x01AD, // updated 4.2
|
||||
QuestMessage = 0x01CE, // updated 4.3
|
||||
|
||||
QuestUpdate = 0x01AE, // updated 4.2
|
||||
QuestCompleteList = 0x01AF, // updated 4.2
|
||||
QuestTracker = 0x01D3, // updated 4.3
|
||||
|
||||
Mount = 0x01CD, // updated 4.2
|
||||
Mount = 0x01E3, // updated 4.3
|
||||
|
||||
DirectorVars = 0x01CF, // updated 4.2
|
||||
|
||||
WeatherChange = 0x01EA, // updated 4.2
|
||||
PlayerTitleList = 0x01EB, // updated 4.2
|
||||
Discovery = 0x01EC, // updated 4.2
|
||||
|
||||
EorzeaTimeOffset = 0x01EE, // updated 4.2
|
||||
|
||||
EquipDisplayFlags = 0x01FA, // updated 4.2
|
||||
DirectorVars = 0x01E5, // updated 4.3
|
||||
|
||||
CFAvailableContents = 0x01FD, // updated 4.2
|
||||
|
||||
PrepareZoning = 0x027C, // updated 4.2
|
||||
ActorGauge = 0x027D, // updated 4.2
|
||||
WeatherChange = 0x0200, // updated 4.3
|
||||
PlayerTitleList = 0x0201, // updated 4.3
|
||||
Discovery = 0x0202, // updated 4.3
|
||||
|
||||
EorzeaTimeOffset = 0x0204, // updated 4.3
|
||||
|
||||
EquipDisplayFlags = 0x0210, // updated 4.3
|
||||
|
||||
DuelChallenge = 0x0277, // 4.2; this is responsible for opening the ui
|
||||
PerformNote = 0x0286, // updated 4.3
|
||||
|
||||
PrepareZoning = 0x0291, // updated 4.3
|
||||
ActorGauge = 0x0292, // updated 4.3
|
||||
|
||||
|
||||
DuelChallenge = 0x0277, // 4.2; this is the responsible for opening an ui
|
||||
PerformNote = 0x0286, // updated 4.2
|
||||
|
||||
// Unknown IPC types that still need to be sent
|
||||
// TODO: figure all these out properly
|
||||
IPCTYPE_UNK_320 = 0x0235, // updated 4.2
|
||||
IPCTYPE_UNK_322 = 0x0237, // updated 4.2
|
||||
IPCTYPE_UNK_320 = 0x024C, // updated 4.3
|
||||
IPCTYPE_UNK_322 = 0x024E, // updated 4.3
|
||||
|
||||
};
|
||||
|
||||
// TODO: Include structures for the individual packet segment types
|
||||
|
||||
/**
|
||||
* Client IPC Zone Type Codes.
|
||||
*/
|
||||
enum ClientZoneIpcType : uint16_t
|
||||
{
|
||||
|
||||
PingHandler = 0x0065, // unchanged 4.2
|
||||
InitHandler = 0x0066, // unchanged 4.2
|
||||
PingHandler = 0x0065, // unchanged 4.3
|
||||
InitHandler = 0x0066, // unchanged 4.3
|
||||
|
||||
FinishLoadingHandler = 0x0069, // unchanged 4.2
|
||||
FinishLoadingHandler = 0x0069, // unchanged 4.3
|
||||
|
||||
CFCommenceHandler = 0x006F,
|
||||
|
||||
|
@ -193,23 +200,24 @@ namespace Packets {
|
|||
|
||||
CFRegisterDuty = 0x0071,
|
||||
CFRegisterRoulette = 0x0072,
|
||||
PlayTimeHandler = 0x0073, // unchanged 4.2
|
||||
LogoutHandler = 0x0074, // unchanged 4.2
|
||||
PlayTimeHandler = 0x0073, // unchanged 4.3
|
||||
LogoutHandler = 0x0074, // unchanged 4.3
|
||||
|
||||
CFDutyInfoHandler = 0x0078, // updated 4.2
|
||||
|
||||
SocialReqSendHandler = 0x00AE, // updated 4.1
|
||||
CreateCrossWorldLS = 0x00AF, // updated 4.3
|
||||
|
||||
ChatHandler = 0x00C7, // updated 4.2
|
||||
ChatHandler = 0x00D3, // updated 4.3
|
||||
|
||||
SocialListHandler = 0x00CF, // updated 4.2
|
||||
ReqSearchInfoHandler = 0x00D4, // updated 4.2
|
||||
SetSearchInfoHandler = 0x00D2, // updated 4.2
|
||||
SocialListHandler = 0x00DB, // updated 4.3
|
||||
ReqSearchInfoHandler = 0x00E0, // updated 4.3
|
||||
SetSearchInfoHandler = 0x00DE, // updated 4.3
|
||||
|
||||
BlackListHandler = 0x00E0, // updated 4.2
|
||||
BlackListHandler = 0x00EC, // updated 4.3
|
||||
PlayerSearchHandler = 0x00E2, // updated 4.2
|
||||
|
||||
LinkshellListHandler = 0x00E8, // updated 4.2
|
||||
LinkshellListHandler = 0x00F4, // updated 4.3
|
||||
|
||||
FcInfoReqHandler = 0x011A, // updated 4.2
|
||||
|
||||
|
@ -218,34 +226,34 @@ namespace Packets {
|
|||
ReqCountdownInitiate = 0x012C, // updated 4.2
|
||||
ReqCountdownCancel = 0x012D, // updated 4.2
|
||||
|
||||
ZoneLineHandler = 0x0130, // updated 4.2
|
||||
ActionHandler = 0x0131, // updated 4.2
|
||||
DiscoveryHandler = 0x0132, // updated 4.2
|
||||
ZoneLineHandler = 0x013C, // updated 4.3
|
||||
ActionHandler = 0x013D, // updated 4.3
|
||||
DiscoveryHandler = 0x013E, // updated 4.3
|
||||
|
||||
SkillHandler = 0x0134, // updated 4.2
|
||||
GMCommand1 = 0x0135, // updated 4.2
|
||||
GMCommand2 = 0x0136, // updated 4.2
|
||||
UpdatePositionHandler = 0x0138, // updated 4.2
|
||||
UpdatePositionInstance = 0x0177, // updated 4.2
|
||||
SkillHandler = 0x0140, // updated 4.3
|
||||
GMCommand1 = 0x0141, // updated 4.3
|
||||
GMCommand2 = 0x0142, // updated 4.3
|
||||
|
||||
InventoryModifyHandler = 0x013F, // updated 4.2
|
||||
UpdatePositionHandler = 0x0144, // updated 4.3
|
||||
UpdatePositionInstance = 0x0183, // updated 4.3
|
||||
|
||||
TalkEventHandler = 0x0148, // updated 4.2
|
||||
EmoteEventHandler = 0x0149, // updated 4.2
|
||||
WithinRangeEventHandler = 0x014A, // updated 4.2
|
||||
OutOfRangeEventHandler = 0x014B, // updated 4.2
|
||||
EnterTeriEventHandler = 0x014C, // updated 4.2
|
||||
InventoryModifyHandler = 0x014B, // updated 4.3
|
||||
|
||||
ReturnEventHandler = 0x0151, // updated 4.2
|
||||
TradeReturnEventHandler = 0x0152, // updated 4.2
|
||||
TalkEventHandler = 0x0154, // updated 4.3
|
||||
EmoteEventHandler = 0x0155, // updated 4.3
|
||||
WithinRangeEventHandler = 0x0156, // updated 4.3
|
||||
OutOfRangeEventHandler = 0x0157, // updated 4.3
|
||||
EnterTeriEventHandler = 0x0158, // updated 4.3
|
||||
|
||||
ReturnEventHandler = 0x015D, // updated 4.3
|
||||
TradeReturnEventHandler = 0x015E, // updated 4.3
|
||||
|
||||
LinkshellEventHandler = 0x0144, // updated 4.1 ??
|
||||
LinkshellEventHandler1 = 0x0145, // updated 4.1 ??
|
||||
LinkshellEventHandler = 0x0150, // updated 4.1 ??
|
||||
LinkshellEventHandler1 = 0x0151, // updated 4.1 ??
|
||||
|
||||
PerformNoteHandler = 0x0160,
|
||||
PerformNoteHandler = 0x029B, // updated 4.3
|
||||
|
||||
ReqEquipDisplayFlagsChange = 0x016C, // updated 4.2
|
||||
ReqEquipDisplayFlagsChange = 0x0178, // updated 4.3
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -87,8 +87,10 @@ struct FFXIVIpcCharList : FFXIVIpcBasePacket<LobbyCharList>
|
|||
uint32_t index;
|
||||
uint32_t padding2;
|
||||
uint16_t serverId;
|
||||
uint16_t serverId1;
|
||||
char nameChara[32];
|
||||
char nameServer[32];
|
||||
char nameServer1[32];
|
||||
char charDetailJson[1030];
|
||||
} charaDetails[2];
|
||||
|
||||
|
|
|
@ -609,146 +609,156 @@ struct FFXIVIpcInitZone : FFXIVIpcBasePacket<InitZone>
|
|||
*/
|
||||
struct FFXIVIpcInitUI : FFXIVIpcBasePacket<InitUI>
|
||||
{
|
||||
// plain C types for a bit until the packet is actually fixed.
|
||||
// makes conversion between different editors easier.
|
||||
uint64_t contentId;
|
||||
uint32_t unknown8;
|
||||
uint32_t unknownC;
|
||||
uint32_t charId;
|
||||
uint32_t restedExp;
|
||||
uint16_t currentLevel;
|
||||
uint8_t maxLevel;
|
||||
uint8_t expansion;
|
||||
uint8_t unknown1A;
|
||||
uint8_t race;
|
||||
uint8_t tribe;
|
||||
uint8_t gender;
|
||||
uint8_t currentJob;
|
||||
uint8_t currentClass;
|
||||
uint8_t deity;
|
||||
uint8_t namedayMonth;
|
||||
uint8_t namedayDay;
|
||||
uint8_t cityState;
|
||||
uint8_t homepoint;
|
||||
uint8_t unknown26; // 2 if "warrior of light"
|
||||
uint8_t petHotBar;
|
||||
uint8_t companionRank;
|
||||
uint8_t companionStars;
|
||||
uint8_t companionSp;
|
||||
uint8_t companionUnk2B;
|
||||
uint8_t companionColor;
|
||||
uint8_t companionFavoFeed;
|
||||
uint8_t companionUnk2E;
|
||||
float companionTimePassed;
|
||||
uint32_t companionCurrentExp;
|
||||
uint32_t unknown38;
|
||||
uint32_t unknown3C;
|
||||
uint32_t fishCaught;
|
||||
uint32_t useBaitCatalogId;
|
||||
uint32_t pvpWolfFoldMatches;
|
||||
uint16_t pvpWolfFoldWeeklyMatches;
|
||||
uint16_t pvpWolfFoldWeeklyVictories;
|
||||
uint16_t pvpStats[6];
|
||||
uint16_t playerCommendations;
|
||||
uint16_t pvpStats1;
|
||||
uint8_t frontlineCampaigns[4];
|
||||
uint16_t frontlineCampaignsWeekly;
|
||||
uint8_t currentRelic;
|
||||
uint8_t currentBook;
|
||||
uint8_t masterCrafterMask;
|
||||
uint8_t unknown69;
|
||||
uint8_t unknown6A;
|
||||
uint8_t unknown6B;
|
||||
uint8_t unknown6C[4];
|
||||
uint8_t unknown70[61];
|
||||
uint8_t preNamePadding;
|
||||
unsigned int unknown8;
|
||||
unsigned int unknownC;
|
||||
unsigned int charId;
|
||||
unsigned int restedExp;
|
||||
unsigned int companionCurrentExp;
|
||||
unsigned int unknown3C;
|
||||
unsigned int fishCaught;
|
||||
unsigned int useBaitCatalogId;
|
||||
unsigned int pvpWolfFoldMatches;
|
||||
unsigned short pvpWolfFoldWeeklyMatches;
|
||||
unsigned short pvpWolfFoldWeeklyVictories;
|
||||
unsigned short pvpStats[6];
|
||||
unsigned short playerCommendations;
|
||||
unsigned short pvpStats1;
|
||||
unsigned char frontlineCampaigns[4];
|
||||
unsigned short frontlineCampaignsWeekly;
|
||||
unsigned char currentRelic;
|
||||
unsigned char currentBook;
|
||||
unsigned char masterCrafterMask;
|
||||
unsigned char unknown69;
|
||||
unsigned char unknown6A;
|
||||
unsigned char unknown6B;
|
||||
unsigned char unknown6C[4];
|
||||
unsigned char unknown70[34];
|
||||
unsigned short unknown18;
|
||||
unsigned char maxLevel;
|
||||
unsigned char expansion;
|
||||
unsigned char unknown;
|
||||
unsigned char race;
|
||||
unsigned char tribe;
|
||||
unsigned char gender;
|
||||
unsigned char currentJob;
|
||||
unsigned char currentClass;
|
||||
unsigned char deity;
|
||||
unsigned char namedayMonth;
|
||||
unsigned char namedayDay;
|
||||
unsigned char cityState;
|
||||
unsigned char homepoint;
|
||||
unsigned char unknown26;
|
||||
unsigned char petHotBar;
|
||||
unsigned char companionRank;
|
||||
unsigned char companionStars;
|
||||
unsigned char companionSp;
|
||||
unsigned char companionUnk2B;
|
||||
unsigned char companionColor;
|
||||
unsigned char companionFavoFeed;
|
||||
unsigned char companionUnk2E;
|
||||
unsigned char companionTimePassed[4];
|
||||
unsigned short unknown38[11];
|
||||
|
||||
unsigned int exp[25];
|
||||
unsigned char unknown564[16];
|
||||
unsigned int pvpFrontlineOverall1st;
|
||||
unsigned int pvpFrontlineOverall2nd;
|
||||
unsigned int pvpFrontlineOverall3rd;
|
||||
unsigned char relicBookCompletion1[4];
|
||||
unsigned short levels[25];
|
||||
unsigned short levelsPadding;
|
||||
unsigned char unknown__[16];
|
||||
unsigned short fishingRecordsFish[26];
|
||||
unsigned short fishingRecordsFishWeight[26];
|
||||
unsigned char unknownMask554[44];
|
||||
|
||||
unsigned char companion_name[21];
|
||||
unsigned char companionDefRank;
|
||||
unsigned char companionAttRank;
|
||||
unsigned char companionHealRank;
|
||||
unsigned char mountGuideMask[16];
|
||||
char name[32];
|
||||
uint8_t unknownOword[16];
|
||||
uint8_t unknownDE[2];
|
||||
uint16_t levels[25];
|
||||
uint16_t levelsPadding;
|
||||
uint32_t exp[25];
|
||||
uint8_t unlockBitmask[64];
|
||||
uint8_t aetheryte[16];
|
||||
uint8_t discovery[421];
|
||||
uint8_t howto[33];
|
||||
uint8_t minions[37];
|
||||
uint8_t chocoboTaxiMask[8];
|
||||
uint8_t contentClearMask[108];
|
||||
uint8_t contentClearPadding;
|
||||
uint16_t unknown428[8];
|
||||
uint8_t companionBardingMask[8];
|
||||
uint8_t companionEquippedHead;
|
||||
uint8_t companionEquippedBody;
|
||||
uint8_t companionEquippedFeet;
|
||||
uint8_t companionUnk4[4];
|
||||
uint8_t companion_fields[11];
|
||||
uint8_t companion_name[21];
|
||||
uint8_t companionDefRank;
|
||||
uint8_t companionAttRank;
|
||||
uint8_t companionHealRank;
|
||||
uint8_t mountGuideMask[15];
|
||||
uint8_t fishingGuideMask[89];
|
||||
uint8_t fishingSpotVisited[25];
|
||||
uint16_t fishingRecordsFish[26];
|
||||
uint16_t fishingRecordsFishWeight[26];
|
||||
uint8_t unknownMask554[15];
|
||||
uint8_t unknownMask4Padding;
|
||||
uint8_t unknown564[19];
|
||||
uint8_t rankAmalJaa;
|
||||
uint8_t rankSylph;
|
||||
uint8_t rankKobold;
|
||||
uint8_t rankSahagin;
|
||||
uint8_t rankIxal;
|
||||
uint8_t rankVanu;
|
||||
uint8_t rankVath;
|
||||
uint8_t rankMoogle;
|
||||
uint8_t rankKojin;
|
||||
uint8_t rankAnata;
|
||||
uint16_t expAmalJaa;
|
||||
uint16_t expSylph;
|
||||
uint16_t expKobold;
|
||||
uint16_t expSahagin;
|
||||
uint16_t expIxal;
|
||||
uint16_t expVanu;
|
||||
uint16_t expVath;
|
||||
uint16_t expMoogle;
|
||||
uint16_t expKojin;
|
||||
uint16_t expAnata;
|
||||
uint8_t unknown596[10];
|
||||
uint16_t unknown5A0[5];
|
||||
uint8_t unknownMask59E[5];
|
||||
uint8_t unknown5A3[18];
|
||||
uint8_t unknownMask5C1[28];
|
||||
uint8_t unknown_03411;
|
||||
uint32_t unknownDword5E0;
|
||||
uint8_t relicBookCompletion[12];
|
||||
uint8_t sightseeingMask[26];
|
||||
uint16_t unknown_XXX;
|
||||
uint32_t pvpFrontlineOverall1st;
|
||||
uint32_t pvpFrontlineOverall2nd;
|
||||
uint32_t pvpFrontlineOverall3rd;
|
||||
uint16_t pvpFrontlineWeekly1st;
|
||||
uint16_t pvpFrontlineWeekly2nd;
|
||||
uint16_t pvpFrontlineWeekly3rd;
|
||||
uint8_t unknown61E;
|
||||
uint8_t centurioSealHunts[32];
|
||||
uint8_t alliedSealHunts[22];
|
||||
uint8_t tripleTriadCards[28];
|
||||
uint8_t unknown671[11];
|
||||
uint8_t unknownMask67C[22];
|
||||
uint8_t unknown692[3];
|
||||
uint8_t orchestrionMask[40];
|
||||
uint8_t hallOfNoviceCompleteMask[3];
|
||||
uint8_t unknownMask6C0[11];
|
||||
uint8_t animaRelicMask[16]; // [2] = anima glass key item, [1] = ulan's note key item
|
||||
uint8_t unknown6DB[14];
|
||||
uint8_t unlockedRaids[28];
|
||||
uint8_t unlockedDungeons[18];
|
||||
uint8_t unlockedGuildhests[10];
|
||||
uint8_t unlockedTrials[7];
|
||||
uint8_t unlockedPvp[5];
|
||||
uint8_t unknownMask72D[28];
|
||||
uint8_t unknownMask749[18];
|
||||
uint8_t unknown749[23];
|
||||
unsigned char unknownOword[16];
|
||||
unsigned char unlockBitmask[64];
|
||||
unsigned char aetheryte[17];
|
||||
unsigned char discovery[421];
|
||||
unsigned char howto[33];
|
||||
unsigned char minions[38];
|
||||
unsigned char chocoboTaxiMask[8];
|
||||
unsigned char contentClearMask[111];
|
||||
unsigned char contentClearPadding;
|
||||
unsigned short unknown428[8];
|
||||
unsigned char companionBardingMask[8];
|
||||
unsigned char companionEquippedHead;
|
||||
unsigned char companionEquippedBody;
|
||||
unsigned char companionEquippedFeet;
|
||||
unsigned char companionUnk4[4];
|
||||
unsigned char companion_fields[11];
|
||||
|
||||
unsigned char fishingGuideMask[89];
|
||||
unsigned char fishingSpotVisited[25];
|
||||
|
||||
|
||||
unsigned char unknownMask4Padding;
|
||||
|
||||
unsigned char rankAmalJaa;
|
||||
unsigned char rankSylph;
|
||||
unsigned char rankKobold;
|
||||
unsigned char rankSahagin;
|
||||
unsigned char rankIxal;
|
||||
unsigned char rankVanu;
|
||||
unsigned char rankVath;
|
||||
unsigned char rankMoogle;
|
||||
unsigned char rankKojin;
|
||||
unsigned char rankAnata;
|
||||
unsigned short expAmalJaa;
|
||||
unsigned short expSylph;
|
||||
unsigned short expKobold;
|
||||
unsigned short expSahagin;
|
||||
unsigned short expIxal;
|
||||
unsigned short expVanu;
|
||||
unsigned short expVath;
|
||||
unsigned short expMoogle;
|
||||
unsigned short expKojin;
|
||||
unsigned short expAnata;
|
||||
unsigned char unknown596[10];
|
||||
unsigned short unknown5A0[5];
|
||||
unsigned char unknownMask59E[5];
|
||||
unsigned char unknown5A3[18];
|
||||
unsigned char unknownMask5C1[28];
|
||||
unsigned char unknown_03411;
|
||||
unsigned int unknownDword5E0;
|
||||
unsigned short pvpFrontlineWeekly1st;
|
||||
unsigned short pvpFrontlineWeekly2nd;
|
||||
unsigned short pvpFrontlineWeekly3rd;
|
||||
unsigned char relicBookCompletion2[8];
|
||||
unsigned char sightseeingMask[26];
|
||||
unsigned short unknown_XXX;
|
||||
|
||||
unsigned char unknown61E;
|
||||
unsigned char unknown61F[32];
|
||||
unsigned char unknown63F[22];
|
||||
unsigned char tripleTriadCards[28];
|
||||
unsigned char unknown671[11];
|
||||
unsigned char unknownMask67C[22];
|
||||
unsigned char unknown692[3];
|
||||
unsigned char orchestrionMask[40];
|
||||
unsigned char hallOfNoviceCompleteMask[3];
|
||||
unsigned char unknownMask6C0[11];
|
||||
unsigned char unknownMask6CB[16];
|
||||
unsigned char unknown6DB[14];
|
||||
unsigned char unlockedRaids[28];
|
||||
unsigned char unlockedDungeons[18];
|
||||
unsigned char unlockedGuildhests[10];
|
||||
unsigned char unlockedTrials[7];
|
||||
unsigned char unlockedPvp[5];
|
||||
unsigned char unknownMask72D[28];
|
||||
// unsigned char unknownMask749[18];
|
||||
//unsigned char unknown749[13];
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Zone/InstanceContent.h>
|
||||
|
||||
class TheWeaponsRefrainUltimate : public InstanceContentScript
|
||||
{
|
||||
public:
|
||||
TheWeaponsRefrainUltimate() : InstanceContentScript( 30067 )
|
||||
{ }
|
||||
|
||||
void onInit( InstanceContentPtr instance ) override
|
||||
{
|
||||
instance->registerEObj( "unknown_0", 2009480, 0, 4, { 94.011192f, 0.000000f, 107.700996f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "sgvf_w1fz_b1432", 2007457, 7372735, 4, { 100.000000f, 0.000000f, 100.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_1", 2007457, 7373056, 4, { 100.000000f, 0.000000f, 100.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_2", 2009481, 0, 4, { 101.695602f, 0.000000f, 101.959396f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_3", 2007457, 7237754, 4, { 100.000000f, 0.000000f, 100.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_4", 2007457, 7237753, 4, { 100.000000f, 0.000000f, 100.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_5", 2007457, 7237756, 4, { 100.000000f, 0.000000f, 100.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_6", 2007457, 7237755, 4, { 100.000000f, 0.000000f, 100.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "Entrance", 2007457, 7343478, 5, { 100.000000f, 0.000000f, 116.000000f }, 1.000000f, 0.000000f );
|
||||
// States -> vf_lock_on vf_lock_of
|
||||
instance->registerEObj( "Exit", 2000139, 0, 4, { 100.000000f, 0.000000f, 85.000000f }, 1.000000f, 0.000000f );
|
||||
instance->registerEObj( "unknown_7", 2007457, 7538258, 4, { 100.160004f, 0.000000f, 101.443398f }, 1.000000f, 0.000000f );
|
||||
}
|
||||
|
||||
void onUpdate( InstanceContentPtr instance, uint32_t currTime ) override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ) override
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
};
|
|
@ -110,12 +110,20 @@ namespace Core {
|
|||
std::string PlayerMinimal::getInfoJson()
|
||||
{
|
||||
std::string charDetails = "{\"content\":[\"" + std::string( getName() ) + "\"," +
|
||||
"[" + getClassString() + "]," +
|
||||
"\"0\",\"0\",\"0\",\"" + std::to_string( getBirthMonth() ) + "\",\"" + std::to_string( getBirthDay() ) + "\",\"" + std::to_string( getGuardianDeity() ) + "\",\"" + std::to_string( m_class ) + "\",\"0\",\"" + std::to_string( getZoneId() ) + "\"," +
|
||||
//"[" + getClassString() + "]," +
|
||||
"[\"0\",\"0\",\"0\",\"0\",\"0\",\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"],"
|
||||
"\"0\",\"0\",\"0\",\"" +
|
||||
std::to_string( getBirthMonth() ) +
|
||||
"\",\"" + std::to_string( getBirthDay() ) +
|
||||
"\",\"" + std::to_string( getGuardianDeity() ) +
|
||||
"\",\"" + std::to_string( m_class ) +
|
||||
"\",\"0\",\"" + std::to_string( getZoneId() ) +
|
||||
"\",\"0\"," +
|
||||
|
||||
"[" + getLookString() + "]," +
|
||||
"\"0\",\"0\"," +
|
||||
"[" + getModelString() + "]," +
|
||||
"\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\",\"0\"]," +
|
||||
"\"1\",\"0\",\"0\",\"0\",\"0\",\"0\",\"\",\"0\",\"0\"]," +
|
||||
"\"classname\":\"ClientSelectData\",\"classid\":116}";
|
||||
return charDetails;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
||||
#include <Logging/Logger.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include <Network/Connection.h>
|
||||
#include <Network/Hive.h>
|
||||
|
@ -52,13 +52,13 @@ void default_resource_send( const HttpServer &server, const shared_ptr< HttpServ
|
|||
const shared_ptr< ifstream > &ifs );
|
||||
|
||||
|
||||
auto m_pConfig = boost::make_shared< Core::XMLConfig >();
|
||||
auto m_pConfig = boost::make_shared< Core::ConfigMgr >();
|
||||
HttpServer server;
|
||||
std::string configPath( "config/settings_rest.xml" );
|
||||
std::string configPath( "rest.ini" );
|
||||
|
||||
void reloadConfig()
|
||||
{
|
||||
m_pConfig = boost::make_shared< Core::XMLConfig >();
|
||||
m_pConfig = boost::make_shared< Core::ConfigMgr >();
|
||||
|
||||
if( !m_pConfig->loadConfig( configPath ) )
|
||||
throw "Error loading config ";
|
||||
|
@ -96,43 +96,43 @@ bool loadSettings( int32_t argc, char* argv[] )
|
|||
if( arg == "ip" )
|
||||
{
|
||||
// todo: ip addr in config
|
||||
m_pConfig->setValue< std::string >( "Settings.General.ListenIP", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.RestHost", val );
|
||||
}
|
||||
else if( arg == "p" || arg == "port" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.RestPort", val );
|
||||
}
|
||||
else if( arg == "exdpath" || arg == "datapath" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.DataPath", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalParameters.DataPath", val );
|
||||
}
|
||||
else if( arg == "h" || arg == "dbhost" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.Mysql.Host", val );
|
||||
m_pConfig->setValue< std::string >( "Database.Host", val );
|
||||
}
|
||||
else if( arg == "dbport" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.Mysql.Port", val );
|
||||
m_pConfig->setValue< std::string >( "Database.Port", val );
|
||||
}
|
||||
else if( arg == "u" || arg == "user" || arg == "dbuser" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.Mysql.Username", val );
|
||||
m_pConfig->setValue< std::string >( "Database.Username", val );
|
||||
}
|
||||
else if( arg == "pass" || arg == "dbpass" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.Mysql.Pass", val );
|
||||
m_pConfig->setValue< std::string >( "Database.Password", val );
|
||||
}
|
||||
else if( arg == "d" || arg == "db" || arg == "database" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.Mysql.Database", val );
|
||||
m_pConfig->setValue< std::string >( "Database.Database", val );
|
||||
}
|
||||
else if ( arg == "lobbyip" || arg == "lobbyhost" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.LobbyHost", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyHost", val );
|
||||
}
|
||||
else if ( arg == "lobbyport" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.LobbyPort", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyPort", val );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -143,7 +143,7 @@ bool loadSettings( int32_t argc, char* argv[] )
|
|||
}
|
||||
|
||||
g_log.info( "Setting up generated EXD data" );
|
||||
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
|
||||
if( !g_exdDataGen.init( m_pConfig->getValue< std::string >( "GlobalParameters.DataPath", "" ) ) )
|
||||
{
|
||||
g_log.fatal( "Error setting up generated EXD data " );
|
||||
return false;
|
||||
|
@ -152,19 +152,19 @@ bool loadSettings( int32_t argc, char* argv[] )
|
|||
Core::Db::DbLoader loader;
|
||||
|
||||
Core::Db::ConnectionInfo info;
|
||||
info.password = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Pass", "" );
|
||||
info.host = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Host", "127.0.0.1" );
|
||||
info.database = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Database", "sapphire" );
|
||||
info.port = m_pConfig->getValue< uint16_t >( "Settings.General.Mysql.Port", 3306 );
|
||||
info.user = m_pConfig->getValue< std::string >( "Settings.General.Mysql.Username", "root" );
|
||||
info.syncThreads = m_pConfig->getValue< uint8_t >( "Settings.General.Mysql.SyncThreads", 2 );
|
||||
info.asyncThreads = m_pConfig->getValue< uint8_t >( "Settings.General.Mysql.AsyncThreads", 2 );
|
||||
info.password = m_pConfig->getValue< std::string >( "Database.Password", "" );
|
||||
info.host = m_pConfig->getValue< std::string >( "Database.Host", "127.0.0.1" );
|
||||
info.database = m_pConfig->getValue< std::string >( "Database.Database", "sapphire" );
|
||||
info.port = m_pConfig->getValue< uint16_t >( "Database.Port", 3306 );
|
||||
info.user = m_pConfig->getValue< std::string >( "Database.Username", "root" );
|
||||
info.syncThreads = m_pConfig->getValue< uint8_t >( "Database.SyncThreads", 2 );
|
||||
info.asyncThreads = m_pConfig->getValue< uint8_t >( "Database.AsyncThreads", 2 );
|
||||
|
||||
loader.addDb( g_charaDb, info );
|
||||
if( !loader.initDbs() )
|
||||
return false;
|
||||
|
||||
server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) ) );
|
||||
server.config.port = static_cast< uint16_t >( std::stoul( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) ) );
|
||||
|
||||
g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
|
||||
|
||||
|
@ -269,8 +269,8 @@ void createAccount( shared_ptr<HttpServer::Response> response, shared_ptr<HttpSe
|
|||
if( g_sapphireAPI.createAccount( user, pass, sId ) )
|
||||
{
|
||||
std::string json_string = "{\"sId\":\"" + sId +
|
||||
"\", \"lobbyHost\":\"" + m_pConfig->getValue< std::string >( "Settings.General.LobbyHost" ) +
|
||||
"\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "Settings.General.FrontierHost" ) + "\"}";
|
||||
"\", \"lobbyHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost" ) +
|
||||
"\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + "\"}";
|
||||
*response << buildHttpResponse( 200, json_string, JSON );
|
||||
}
|
||||
else
|
||||
|
@ -301,8 +301,8 @@ void login( shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Re
|
|||
if( g_sapphireAPI.login( user, pass, sId ) )
|
||||
{
|
||||
std::string json_string = "{\"sId\":\"" + sId +
|
||||
"\", \"lobbyHost\":\"" + m_pConfig->getValue< std::string >("Settings.General.LobbyHost") +
|
||||
"\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "Settings.General.FrontierHost" ) + "\"}";
|
||||
"\", \"lobbyHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost" ) +
|
||||
"\", \"frontierHost\":\"" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + "\"}";
|
||||
*response << buildHttpResponse( 200, json_string, JSON );
|
||||
}
|
||||
else
|
||||
|
@ -333,7 +333,7 @@ void deleteCharacter( shared_ptr<HttpServer::Response> response, shared_ptr<Http
|
|||
|
||||
int32_t accountId = g_sapphireAPI.checkSession( sId );
|
||||
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -374,14 +374,14 @@ void createCharacter( shared_ptr<HttpServer::Response> response, shared_ptr<Http
|
|||
|
||||
if( result != -1 )
|
||||
{
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >( "Settings.Parameters.DefaultGMRank", 255 ) );
|
||||
int32_t charId = g_sapphireAPI.createCharacter( result, name, finalJson, m_pConfig->getValue< uint8_t >( "CharacterCreation.DefaultGMRank", 255 ) );
|
||||
|
||||
std::string json_string = "{\"result\":\"" + std::to_string( charId ) + "\"}";
|
||||
*response << buildHttpResponse( 200, json_string, JSON );
|
||||
|
@ -414,7 +414,7 @@ void insertSession( shared_ptr<HttpServer::Response> response, shared_ptr<HttpSe
|
|||
uint32_t accountId = pt.get<uint32_t>( "accountId" );
|
||||
std::string secret = pt.get<string>( "secret" );
|
||||
// reloadConfig();
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -448,7 +448,7 @@ void checkNameTaken( shared_ptr<HttpServer::Response> response, shared_ptr<HttpS
|
|||
|
||||
// reloadConfig();
|
||||
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -486,7 +486,7 @@ void checkSession( shared_ptr<HttpServer::Response> response, shared_ptr<HttpSer
|
|||
|
||||
if( result != -1 )
|
||||
{
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -523,7 +523,7 @@ void getNextCharId( shared_ptr<HttpServer::Response> response, shared_ptr<HttpSe
|
|||
|
||||
// reloadConfig();
|
||||
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -555,7 +555,7 @@ void getNextContentId( shared_ptr<HttpServer::Response> response, shared_ptr<Htt
|
|||
|
||||
// reloadConfig();
|
||||
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -591,7 +591,7 @@ void getCharacterList( shared_ptr<HttpServer::Response> response, shared_ptr<Htt
|
|||
|
||||
if( result != -1 )
|
||||
{
|
||||
if( m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" ) != secret )
|
||||
if( m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" ) != secret )
|
||||
{
|
||||
std::string json_string = "{\"result\":\"invalid_secret\"}";
|
||||
*response << buildHttpResponse( 403, json_string, JSON );
|
||||
|
@ -756,8 +756,8 @@ int main( int argc, char* argv[] )
|
|||
if( !loadSettings( argc, argv ) )
|
||||
throw std::exception();
|
||||
|
||||
server.config.port = stoi( m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) );
|
||||
g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "Settings.General.HttpPort", "80" ) + "..." );
|
||||
server.config.port = stoi( m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) );
|
||||
g_log.info( "Starting API server at port " + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort", "80" ) + "..." );
|
||||
|
||||
server.resource["^/ZoneName/([0-9]+)$"]["GET"] = &getZoneName;
|
||||
server.resource["^/sapphire-api/lobby/createAccount"]["POST"] = &createAccount;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <Network/GamePacketParser.h>
|
||||
#include <Crypt/md5.h>
|
||||
#include <Crypt/blowfish.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
||||
|
@ -129,10 +130,10 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
|
|||
serverListPacket.data().seq = 1;
|
||||
serverListPacket.data().offset = 0;
|
||||
serverListPacket.data().numServers = 1;
|
||||
serverListPacket.data().server[0].id = g_serverLobby.getConfig()->getValue<uint16_t>( "Settings.Parameters.WorldID", 1 );
|
||||
serverListPacket.data().server[0].id = g_serverLobby.getConfig()->getValue<uint16_t>( "Lobby.WorldID", 1 );
|
||||
serverListPacket.data().server[0].index = 0;
|
||||
serverListPacket.data().final = 1;
|
||||
strcpy( serverListPacket.data().server[0].name, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
|
||||
strcpy( serverListPacket.data().server[0].name, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
||||
|
||||
pRP.addPacket( serverListPacket );
|
||||
|
||||
|
@ -166,11 +167,11 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
|
|||
auto& charEntry = charList[charIndex];
|
||||
details.uniqueId = get< 1 >( charEntry );
|
||||
details.contentId = get< 2 >( charEntry );
|
||||
details.serverId = g_serverLobby.getConfig()->getValue<uint16_t>( "Settings.Parameters.WorldID", 1 );
|
||||
details.serverId = g_serverLobby.getConfig()->getValue<uint16_t>( "Lobby.WorldID", 1 );
|
||||
details.index = charIndex;
|
||||
strcpy( details.charDetailJson, get< 3 >( charEntry ).c_str() );
|
||||
strcpy( details.nameChara, get< 0 >( charEntry ).c_str() );
|
||||
strcpy( details.nameServer, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
|
||||
strcpy( details.nameServer, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
||||
|
||||
charListPacket.data().charaDetails[j] = details;
|
||||
|
||||
|
@ -238,8 +239,8 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
|
|||
enterWorldPacket.data().contentId = lookupId;
|
||||
|
||||
enterWorldPacket.data().seq = sequence;
|
||||
strcpy( enterWorldPacket.data().host, g_serverLobby.getConfig()->getValue< std::string >( "Settings.General.ZoneIp" ).c_str() );
|
||||
enterWorldPacket.data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "Settings.General.ZonePort" );
|
||||
strcpy( enterWorldPacket.data().host, g_serverLobby.getConfig()->getValue< std::string >( "GlobalNetwork.ZoneHost" ).c_str() );
|
||||
enterWorldPacket.data().port = g_serverLobby.getConfig()->getValue< uint16_t >( "GlobalNetwork.ZonePort" );
|
||||
enterWorldPacket.data().charId = logInCharId;
|
||||
memcpy( enterWorldPacket.data().sid, m_pSession->getSessionId(), 66 );
|
||||
|
||||
|
@ -251,7 +252,7 @@ bool Core::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW&
|
|||
{
|
||||
LobbySessionPtr pSession = g_serverLobby.getSession( ( char* )&packet.data[0] + 0x20 );
|
||||
|
||||
if( g_serverLobby.getConfig()->getValue< bool >( "Settings.Parameters.AllowNoSessionConnect" ) && pSession == nullptr )
|
||||
if( g_serverLobby.getConfig()->getValue< bool >( "Lobby.AllowNoSessionConnect" ) && pSession == nullptr )
|
||||
{
|
||||
auto session = make_LobbySession();
|
||||
session->setAccountID( 0 );
|
||||
|
@ -319,7 +320,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
|
|||
|
||||
charCreatePacket.data().content_id = newContentId;
|
||||
strcpy( charCreatePacket.data().name, name.c_str() );
|
||||
strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
|
||||
strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
||||
charCreatePacket.data().type = 1;
|
||||
charCreatePacket.data().seq = sequence;
|
||||
charCreatePacket.data().unknown = 1;
|
||||
|
@ -343,7 +344,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
|
|||
|
||||
charCreatePacket.data().content_id = newContentId;
|
||||
strcpy( charCreatePacket.data().name, name.c_str() );
|
||||
strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
|
||||
strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
||||
charCreatePacket.data().type = 2;
|
||||
charCreatePacket.data().seq = sequence;
|
||||
charCreatePacket.data().unknown = 1;
|
||||
|
@ -374,7 +375,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac
|
|||
//charCreatePacket.data().content_id = deletePlayer.getContentId();
|
||||
charCreatePacket.data().content_id = 0;
|
||||
strcpy( charCreatePacket.data().name, name.c_str() );
|
||||
strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Settings.Parameters.WorldName", "Sapphire" ).c_str() );
|
||||
strcpy( charCreatePacket.data().world, g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
||||
charCreatePacket.data().type = 4;
|
||||
charCreatePacket.data().seq = sequence;
|
||||
charCreatePacket.data().unknown = 1;
|
||||
|
@ -475,8 +476,8 @@ void Core::Network::GameConnection::generateEncryptionKey( uint32_t key, const s
|
|||
m_baseKey[2] = 0x34;
|
||||
m_baseKey[3] = 0x12;
|
||||
memcpy( m_baseKey + 0x04, &key, 4 );
|
||||
m_baseKey[8] = 0xA0;
|
||||
m_baseKey[9] = 0x0F;
|
||||
m_baseKey[8] = 0xCC;
|
||||
m_baseKey[9] = 0x10;
|
||||
memcpy( ( char* )m_baseKey + 0x0C, keyPhrase.c_str(), keyPhrase.size() );
|
||||
Core::Util::md5( m_baseKey, m_encKey, 0x2C );
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <Version.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
//#include "LobbySession.h"
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace Core {
|
|||
m_configPath( configPath ),
|
||||
m_numConnections( 0 )
|
||||
{
|
||||
m_pConfig = boost::shared_ptr<XMLConfig>( new XMLConfig );
|
||||
m_pConfig = boost::shared_ptr< ConfigMgr >( new ConfigMgr );
|
||||
}
|
||||
|
||||
ServerLobby::~ServerLobby( void )
|
||||
|
@ -49,7 +49,7 @@ namespace Core {
|
|||
return g_restConnector.getSession( sessionId );
|
||||
}
|
||||
|
||||
XMLConfigPtr ServerLobby::getConfig() const
|
||||
ConfigMgrPtr ServerLobby::getConfig() const
|
||||
{
|
||||
return m_pConfig;
|
||||
}
|
||||
|
@ -109,23 +109,19 @@ namespace Core {
|
|||
if( arg == "ip" )
|
||||
{
|
||||
// todo: ip addr in config
|
||||
m_pConfig->setValue< std::string >( "Settings.General.ListenIp", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyHost", val );
|
||||
}
|
||||
else if( arg == "p" || arg == "port" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.ListenPort", val );
|
||||
}
|
||||
else if( arg == "ap" || arg == "auth" || arg == "authport" )
|
||||
{
|
||||
m_pConfig->setValue< std::string>( "Settings.General.AuthPort", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.LobbyPort", val );
|
||||
}
|
||||
else if( arg == "worldip" || arg == "worldip" )
|
||||
{
|
||||
m_pConfig->setValue < std::string >( "Settings.General.WorldIp", val );
|
||||
m_pConfig->setValue < std::string >( "GlobalNetwork.ZoneHost", val );
|
||||
}
|
||||
else if( arg == "worldport" )
|
||||
{
|
||||
m_pConfig->setValue< std::string >( "Settings.General.WorldPort", val );
|
||||
m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -135,11 +131,11 @@ namespace Core {
|
|||
}
|
||||
}
|
||||
|
||||
m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54994 );
|
||||
m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );
|
||||
m_port = m_pConfig->getValue< uint16_t >( "GlobalNetwork.LobbyPort", 54994 );
|
||||
m_ip = m_pConfig->getValue< std::string >( "GlobalNetwork.LobbyHost", "0.0.0.0" );
|
||||
|
||||
g_restConnector.restHost = m_pConfig->getValue< std::string >( "Settings.General.RestHost" );
|
||||
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "Settings.General.ServerSecret" );
|
||||
g_restConnector.restHost = m_pConfig->getValue< std::string >( "GlobalNetwork.RestHost" ) + ":" + m_pConfig->getValue< std::string >( "GlobalNetwork.RestPort" );
|
||||
g_restConnector.serverSecret = m_pConfig->getValue< std::string >( "GlobalParameters.ServerSecret" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <map>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <Config/XMLConfig.h>
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
|
@ -15,7 +14,7 @@ const std::string LOBBY_VERSION = "0.0.5";
|
|||
namespace Core
|
||||
{
|
||||
class LobbySession;
|
||||
class XMLConfig;
|
||||
class ConfigMgr;
|
||||
typedef std::map< std::string, LobbySessionPtr > LobbySessionMap;
|
||||
|
||||
class ServerLobby
|
||||
|
@ -30,7 +29,7 @@ namespace Core
|
|||
uint16_t m_port;
|
||||
std::string m_ip;
|
||||
|
||||
boost::shared_ptr<XMLConfig> m_pConfig;
|
||||
boost::shared_ptr< ConfigMgr > m_pConfig;
|
||||
|
||||
public:
|
||||
ServerLobby( const std::string& configPath );
|
||||
|
@ -45,7 +44,7 @@ namespace Core
|
|||
m_sessionMap[std::string( sessionId )] = pSession;
|
||||
}
|
||||
|
||||
boost::shared_ptr<XMLConfig> getConfig() const;
|
||||
boost::shared_ptr< ConfigMgr > getConfig() const;
|
||||
|
||||
LobbySessionPtr getSession( char* sessionId );
|
||||
uint32_t m_numConnections;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "ServerLobby.h"
|
||||
|
||||
Core::ServerLobby g_serverLobby( "config/settings_lobby.xml" );
|
||||
Core::ServerLobby g_serverLobby( "lobby.ini" );
|
||||
|
||||
int main( int32_t argc, char* argv[] )
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "Actor/Player.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
using namespace Core::Entity;
|
||||
using namespace Core::Common;
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
#define _ACTIONCOLLISION_H
|
||||
|
||||
#include <Common.h>
|
||||
#include "Action.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Data
|
||||
{
|
||||
struct Action;
|
||||
}
|
||||
|
||||
namespace Entity {
|
||||
|
||||
enum class TargetFilter
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _ACTIONMOUNT_H_
|
||||
#define _ACTIONMOUNT_H_
|
||||
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _ACTIONTELEPORT_H_
|
||||
#define _ACTIONTELEPORT_H_
|
||||
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
#include "Event/EventHandler.h"
|
||||
|
||||
#include "EventAction.h"
|
||||
#include "Framework.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <Common.h>
|
||||
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _EVENTITEMACTION_H_
|
||||
#define _EVENTITEMACTION_H_
|
||||
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#include "Actor.h"
|
||||
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Network/GamePacket.h>
|
||||
|
||||
#include <Util/Util.h>
|
||||
#include <Util/UtilMath.h>
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionCollision.h"
|
||||
|
||||
|
@ -19,8 +18,6 @@
|
|||
|
||||
#include "ServerZone.h"
|
||||
#include "Session.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
|
||||
#include "Zone/TerritoryMgr.h"
|
||||
|
||||
|
@ -28,11 +25,6 @@
|
|||
|
||||
#include "Math/CalcBattle.h"
|
||||
|
||||
#include "ServerZone.h"
|
||||
#include "Session.h"
|
||||
#include "Actor.h"
|
||||
#include "Player.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include <Util/UtilMath.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Network/GamePacket.h>
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "Action/Action.h"
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
#include <Logging/Logger.h>
|
||||
#include <Network/GamePacket.h>
|
||||
#include <Network/GamePacketNew.h>
|
||||
#include <Network/CommonNetwork.h>
|
||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Util/UtilMath.h>
|
||||
|
||||
using namespace Core::Common;
|
||||
|
|
|
@ -10,10 +10,11 @@ namespace Entity
|
|||
class EventObject : public Actor
|
||||
{
|
||||
public:
|
||||
EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId, uint8_t initialState, Common::FFXIVARR_POSITION3 pos,
|
||||
float rotation, const std::string& givenName = "none" );
|
||||
EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId, uint8_t initialState,
|
||||
Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" );
|
||||
|
||||
using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, InstanceContentPtr, uint64_t ) >;
|
||||
using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr,
|
||||
InstanceContentPtr, uint64_t ) >;
|
||||
|
||||
uint32_t getGimmickId() const;
|
||||
void setGimmickId( uint32_t gimmickId );
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <Common.h>
|
||||
#include <Util/Util.h>
|
||||
#include <Util/UtilMath.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Network/GamePacket.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
|
@ -30,11 +29,6 @@
|
|||
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Inventory/Item.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include "Event/EventHandler.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionTeleport.h"
|
||||
#include "Action/EventAction.h"
|
||||
|
@ -317,7 +311,7 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
|||
}
|
||||
|
||||
setStateFlag( PlayerStateFlag::BetweenAreas );
|
||||
auto targetPos = pTeriMgr->getTerritoryPosition( data->levelId );
|
||||
auto targetPos = pTeriMgr->getTerritoryPosition( data->level.at( 0 ) );
|
||||
|
||||
Common::FFXIVARR_POSITION3 pos;
|
||||
pos.x = 0;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Network/GamePacket.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
||||
|
@ -16,12 +16,7 @@
|
|||
#include "Action/EventAction.h"
|
||||
#include "Action/EventItemAction.h"
|
||||
|
||||
#include "Event/EventHandler.h"
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "Player.h"
|
||||
#include "Forwards.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Framework.h"
|
||||
|
||||
|
@ -312,10 +307,14 @@ void Core::Entity::Player::eventItemActionStart( uint32_t eventId,
|
|||
|
||||
void Core::Entity::Player::onLogin()
|
||||
{
|
||||
auto pConfig = g_fw.get< XMLConfig >();
|
||||
for( auto& child : pConfig->getChild( "Settings.Parameters.MotDArray" ) )
|
||||
auto pConfig = g_fw.get< ConfigMgr >();
|
||||
auto motd = pConfig->getValue< std::string >( "General.MotD", "" );
|
||||
|
||||
std::istringstream ss( motd );
|
||||
std::string msg;
|
||||
while( std::getline( ss, msg, ';' ) )
|
||||
{
|
||||
sendNotice( child.second.data() );
|
||||
sendNotice( msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "Network/PacketWrappers/QuestMessagePacket.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
#include "Player.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
#include <set>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <Common.h>
|
||||
#include <Network/GamePacket.h>
|
||||
#include <Util/Util.h>
|
||||
#include <Util/UtilMath.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
|
@ -19,11 +16,7 @@
|
|||
#include "Zone/TerritoryMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include "Player.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Forwards.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <Common.h>
|
||||
#include <Version.h>
|
||||
#include <Network/GamePacketNew.h>
|
||||
#include <Network/CommonNetwork.h>
|
||||
#include <Util/UtilMath.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Logging/Logger.h>
|
||||
|
@ -25,7 +24,6 @@
|
|||
#include "Script/ScriptMgr.h"
|
||||
#include "Script/NativeScriptMgr.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
#include "Actor/EventObject.h"
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
|
@ -34,7 +32,6 @@
|
|||
|
||||
#include "ServerZone.h"
|
||||
|
||||
#include "StatusEffect/StatusEffect.h"
|
||||
#include "Session.h"
|
||||
#include "Framework.h"
|
||||
|
||||
|
|
|
@ -69,12 +69,6 @@ namespace Core
|
|||
EVENT_TABLE_GAME = 24
|
||||
};
|
||||
|
||||
enum EventFinishState
|
||||
{
|
||||
UNLOCK = 1,
|
||||
KEEPLOCK = 0
|
||||
};
|
||||
|
||||
enum DamageType
|
||||
{
|
||||
STD_DAMAGE = 0X03,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _EVENT_H
|
||||
#define _EVENT_H
|
||||
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Event {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include <Common.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <boost/range/algorithm/remove_if.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
||||
#include "Framework.h"
|
||||
#include "EventHelper.h"
|
||||
#include "EventHandler.h"
|
||||
#include <boost/range/algorithm/remove_if.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <boost/algorithm/clamp.hpp>
|
||||
|
||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||
#include <Common.h>
|
||||
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Database/DatabaseDef.h>
|
||||
|
@ -12,8 +12,6 @@
|
|||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "Inventory.h"
|
||||
#include "ItemContainer.h"
|
||||
#include "Item.h"
|
||||
#include "Framework.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define INVENTORY_H_
|
||||
#include <map>
|
||||
#include <Common.h>
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <Common.h>
|
||||
|
||||
#include "../Forwards.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
|
|
@ -4,8 +4,11 @@
|
|||
#include <Network/CommonNetwork.h>
|
||||
#include <Util/Util.h>
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
#include <Network/Acceptor.h>
|
||||
#include <Network/PacketContainer.h>
|
||||
#include <Network/GamePacketParser.h>
|
||||
#include <Network/GamePacket.h>
|
||||
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
|
@ -13,8 +16,6 @@
|
|||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "GameConnection.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Session.h"
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
#define GAMECONNECTION_H
|
||||
|
||||
#include <Network/Connection.h>
|
||||
#include <Network/Acceptor.h>
|
||||
|
||||
#include <Network/CommonNetwork.h>
|
||||
#include <Network/GamePacket.h>
|
||||
//#include <Network/GamePacket.h>
|
||||
#include <Util/LockedQueue.h>
|
||||
|
||||
#include "Forwards.h"
|
||||
|
@ -13,7 +13,9 @@
|
|||
|
||||
namespace Core {
|
||||
namespace Network {
|
||||
|
||||
namespace Packets {
|
||||
class GamePacket;
|
||||
}
|
||||
enum ConnectionType : uint8_t
|
||||
{
|
||||
Zone = 1,
|
||||
|
|
|
@ -25,10 +25,6 @@
|
|||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include "Event/EventHelper.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
#include "Framework.h"
|
||||
#include "Session.h"
|
||||
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Event/EventHelper.h"
|
||||
|
||||
#include "Zone/InstanceContent.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <Network/PacketContainer.h>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
|
@ -16,9 +15,7 @@
|
|||
#include "Zone/TerritoryMgr.h"
|
||||
#include "Zone/Zone.h"
|
||||
#include "Zone/InstanceContent.h"
|
||||
#include "Zone/ZonePosition.h"
|
||||
|
||||
#include "Network/GameConnection.h"
|
||||
#include "Network/PacketWrappers/InitUIPacket.h"
|
||||
#include "Network/PacketWrappers/PingPacket.h"
|
||||
#include "Network/PacketWrappers/MoveActorPacket.h"
|
||||
|
@ -31,20 +28,7 @@
|
|||
#include "Network/PacketWrappers/EventFinishPacket.h"
|
||||
#include "Network/PacketWrappers/PlayerStateFlagsPacket.h"
|
||||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include "Event/EventHelper.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionTeleport.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Forwards.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -17,11 +17,10 @@
|
|||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
#include "Actor/Player.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "ServerZone.h"
|
||||
#include "Forwards.h"
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
#include <Network/PacketContainer.h>
|
||||
#include <Network/PacketDef/Chat/ServerChatDef.h>
|
||||
#include <Database/DatabaseDef.h>
|
||||
#include <Database/DbWorkerPool.h>
|
||||
#include <Database/CharaDbConnection.h>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <unordered_map>
|
||||
#include "Network/GameConnection.h"
|
||||
|
||||
|
@ -32,10 +29,6 @@
|
|||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
#include "Event/EventHelper.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
|
@ -55,9 +48,10 @@ using namespace Core::Network::Packets::Server;
|
|||
void Core::Network::GameConnection::fcInfoReqHandler( const Packets::GamePacket& inPacket,
|
||||
Entity::Player& player )
|
||||
{
|
||||
GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, player.getId(), player.getId() ) );
|
||||
pPe->setValAt< uint8_t >( 0x48, 0x01 );
|
||||
queueOutPacket( pPe );
|
||||
// TODO: use new packet struct for this
|
||||
//GamePacketPtr pPe( new GamePacket( 0xDD, 0x78, player.getId(), player.getId() ) );
|
||||
//pPe->setValAt< uint8_t >( 0x48, 0x01 );
|
||||
//queueOutPacket( pPe );
|
||||
}
|
||||
|
||||
void Core::Network::GameConnection::setSearchInfoHandler( const Packets::GamePacket& inPacket,
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "Actor/Player.h"
|
||||
|
||||
#include "Action/Action.h"
|
||||
#include "Action/ActionCast.h"
|
||||
#include "Action/ActionMount.h"
|
||||
|
@ -27,7 +25,6 @@
|
|||
#include "Script/ScriptMgr.h"
|
||||
|
||||
#include "Session.h"
|
||||
#include "Forwards.h"
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
|
|
@ -38,7 +38,7 @@ private:
|
|||
m_data.gender = player.getLookAt( Common::CharaLook::Gender );
|
||||
m_data.currentClass = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.currentJob = static_cast< uint8_t >( player.getClass() );
|
||||
m_data.currentLevel = player.getLevel();
|
||||
m_data.maxLevel = player.getLevel();
|
||||
m_data.deity = static_cast< uint8_t >( player.getGuardianDeity() );
|
||||
m_data.namedayMonth = player.getBirthMonth();
|
||||
m_data.namedayDay = player.getBirthDay();
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
|
||||
// df stuff
|
||||
// todo: actually do this properly
|
||||
m_data.unknown70[4] = 1; // enable df
|
||||
// m_data.unknown70[4] = 1; // enable df
|
||||
|
||||
// enable all raids/guildhests/dungeons
|
||||
memset( m_data.unlockedDungeons, 0xFF, sizeof( m_data.unlockedDungeons ) );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "ScriptLoader.h"
|
||||
|
||||
#include <Logging/Logger.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include "ServerZone.h"
|
||||
|
||||
|
@ -53,7 +53,7 @@ bool Core::Scripting::ScriptLoader::unloadModule( ModuleHandle handle )
|
|||
Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const std::string& path )
|
||||
{
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
auto pConfig = g_fw.get< XMLConfig >();
|
||||
auto pConfig = g_fw.get< ConfigMgr >();
|
||||
fs::path f( path );
|
||||
|
||||
if( isModuleLoaded( f.stem().string() ) )
|
||||
|
@ -63,7 +63,7 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st
|
|||
}
|
||||
|
||||
// copy to temp dir
|
||||
fs::path cacheDir( f.parent_path() /= pConfig->getValue< std::string >( "Settings.General.Scripts.CachePath", "./cache/" ) );
|
||||
fs::path cacheDir( f.parent_path() /= pConfig->getValue< std::string >( "Scripts.CachePath", "./cache/" ) );
|
||||
fs::create_directories( cacheDir );
|
||||
fs::path dest( cacheDir /= f.filename().string() );
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <Logging/Logger.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include "watchdog/Watchdog.h"
|
||||
|
||||
|
@ -51,10 +51,10 @@ void Core::Scripting::ScriptMgr::update()
|
|||
bool Core::Scripting::ScriptMgr::init()
|
||||
{
|
||||
std::set< std::string > files;
|
||||
auto pConfig = g_fw.get< XMLConfig >();
|
||||
auto pConfig = g_fw.get< ConfigMgr >();
|
||||
auto pLog = g_fw.get< Logger >();
|
||||
|
||||
auto status = loadDir( pConfig->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ),
|
||||
auto status = loadDir( pConfig->getValue< std::string >( "Scripts.Path", "./compiledscripts/" ),
|
||||
files, m_nativeScriptMgr->getModuleExtension() );
|
||||
|
||||
if( !status )
|
||||
|
@ -85,12 +85,12 @@ bool Core::Scripting::ScriptMgr::init()
|
|||
|
||||
void Core::Scripting::ScriptMgr::watchDirectories()
|
||||
{
|
||||
auto pConfig = g_fw.get< XMLConfig >();
|
||||
auto shouldWatch = pConfig->getValue< bool >( "Settings.General.Scripts.HotSwap.Enabled", true );
|
||||
auto pConfig = g_fw.get< ConfigMgr >();
|
||||
auto shouldWatch = pConfig->getValue< bool >( "Scripts.HotSwap", true );
|
||||
if( !shouldWatch )
|
||||
return;
|
||||
|
||||
Watchdog::watchMany( pConfig->getValue< std::string >( "Settings.General.Scripts.Path", "./compiledscripts/" ) + "*" + m_nativeScriptMgr->getModuleExtension(),
|
||||
Watchdog::watchMany( pConfig->getValue< std::string >( "Scripts.Path", "./compiledscripts/" ) + "*" + m_nativeScriptMgr->getModuleExtension(),
|
||||
[ this ]( const std::vector< ci::fs::path >& paths )
|
||||
{
|
||||
if( !m_firstScriptChangeNotificiation )
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
#include <Version.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Version.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
#include <MySqlBase.h>
|
||||
#include <Connection.h>
|
||||
|
@ -26,23 +25,20 @@
|
|||
|
||||
#include "Zone/TerritoryMgr.h"
|
||||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include "Script/ScriptMgr.h"
|
||||
#include "Linkshell/LinkshellMgr.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <thread>
|
||||
|
||||
#include "Framework.h"
|
||||
|
||||
extern Core::Framework g_fw;
|
||||
|
||||
Core::ServerZone::ServerZone( const std::string& configPath ) :
|
||||
m_configPath( configPath ),
|
||||
Core::ServerZone::ServerZone( const std::string& configName ) :
|
||||
m_configName( configName ),
|
||||
m_bRunning( true ),
|
||||
m_lastDBPingTime( 0 )
|
||||
{
|
||||
|
@ -60,15 +56,15 @@ size_t Core::ServerZone::getSessionCount() const
|
|||
bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
||||
{
|
||||
auto pLog = g_fw.get< Core::Logger >();
|
||||
auto pConfig = g_fw.get< Core::XMLConfig >();
|
||||
auto pConfig = g_fw.get< Core::ConfigMgr >();
|
||||
auto pExd = g_fw.get< Data::ExdDataGenerated >();
|
||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
|
||||
pLog->info( "Loading config " + m_configPath );
|
||||
pLog->info( "Loading config " + m_configName );
|
||||
|
||||
if( !pConfig->loadConfig( m_configPath ) )
|
||||
if( !pConfig->loadConfig( m_configName ) )
|
||||
{
|
||||
pLog->fatal( "Error loading config " + m_configPath );
|
||||
pLog->fatal( "Error loading config " + m_configName );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -89,39 +85,35 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
|||
if( arg == "ip" )
|
||||
{
|
||||
// todo: ip addr in config
|
||||
pConfig->setValue< std::string >( "Settings.General.ListenIP", val );
|
||||
pConfig->setValue< std::string >( "GlobalNetwork.ZoneIP", val );
|
||||
}
|
||||
else if( arg == "p" || arg == "port" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.ListenPort", val );
|
||||
pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
|
||||
}
|
||||
else if( arg == "exdpath" || arg == "datapath" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.DataPath", val );
|
||||
}
|
||||
else if( arg == "s" || arg == "scriptpath" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.ScriptPath", val );
|
||||
pConfig->setValue< std::string >( "GlobalParameters.DataPath", val );
|
||||
}
|
||||
else if( arg == "h" || arg == "dbhost" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.Mysql.Host", val );
|
||||
pConfig->setValue< std::string >( "Database.Host", val );
|
||||
}
|
||||
else if( arg == "dbport" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.Mysql.Port", val );
|
||||
pConfig->setValue< std::string >( "Database.Port", val );
|
||||
}
|
||||
else if( arg == "u" || arg == "user" || arg == "dbuser" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.Mysql.Username", val );
|
||||
pConfig->setValue< std::string >( "Database.Username", val );
|
||||
}
|
||||
else if( arg == "pass" || arg == "dbpass" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.Mysql.Pass", val );
|
||||
pConfig->setValue< std::string >( "Database.Password", val );
|
||||
}
|
||||
else if( arg == "d" || arg == "db" || arg == "database" )
|
||||
{
|
||||
pConfig->setValue< std::string >( "Settings.General.Mysql.Database", val );
|
||||
pConfig->setValue< std::string >( "Database.Database", val );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -132,7 +124,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
|||
}
|
||||
|
||||
pLog->info( "Setting up generated EXD data" );
|
||||
if( !pExd->init( pConfig->getValue< std::string >( "Settings.General.DataPath", "" ) ) )
|
||||
if( !pExd->init( pConfig->getValue< std::string >( "GlobalParameters.DataPath", "" ) ) )
|
||||
{
|
||||
pLog->fatal( "Error setting up generated EXD data " );
|
||||
return false;
|
||||
|
@ -141,20 +133,20 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
|||
Core::Db::DbLoader loader;
|
||||
|
||||
Core::Db::ConnectionInfo info;
|
||||
info.password = pConfig->getValue< std::string >( "Settings.General.Mysql.Pass", "" );
|
||||
info.host = pConfig->getValue< std::string >( "Settings.General.Mysql.Host", "127.0.0.1" );
|
||||
info.database = pConfig->getValue< std::string >( "Settings.General.Mysql.Database", "sapphire" );
|
||||
info.port = pConfig->getValue< uint16_t >( "Settings.General.Mysql.Port", 3306 );
|
||||
info.user = pConfig->getValue< std::string >( "Settings.General.Mysql.Username", "root" );
|
||||
info.syncThreads = pConfig->getValue< uint8_t >( "Settings.General.Mysql.SyncThreads", 2 );
|
||||
info.asyncThreads = pConfig->getValue< uint8_t >( "Settings.General.Mysql.AsyncThreads", 2 );
|
||||
info.password = pConfig->getValue< std::string >( "Database.Password", "" );
|
||||
info.host = pConfig->getValue< std::string >( "Database.Host", "127.0.0.1" );
|
||||
info.database = pConfig->getValue< std::string >( "Database.Database", "sapphire" );
|
||||
info.port = pConfig->getValue< uint16_t >( "Database.Port", 3306 );
|
||||
info.user = pConfig->getValue< std::string >( "Database.Username", "root" );
|
||||
info.syncThreads = pConfig->getValue< uint8_t >( "Database.SyncThreads", 2 );
|
||||
info.asyncThreads = pConfig->getValue< uint8_t >( "Database.AsyncThreads", 2 );
|
||||
|
||||
loader.addDb( *pDb, info );
|
||||
if( !loader.initDbs() )
|
||||
return false;
|
||||
|
||||
m_port = pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54992 );
|
||||
m_ip = pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );
|
||||
m_port = pConfig->getValue< uint16_t >( "GlobalNetwork.ZonePort", 54992 );
|
||||
m_ip = pConfig->getValue< std::string >( "GlobalNetwork.ZoneIP", "0.0.0.0" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -335,15 +327,6 @@ void Core::ServerZone::removeSession( uint32_t sessionId )
|
|||
m_sessionMapById.erase( sessionId );
|
||||
}
|
||||
|
||||
void Core::ServerZone::updateSession( uint32_t id )
|
||||
{
|
||||
std::lock_guard< std::mutex > lock( m_sessionMutex );
|
||||
auto it = m_sessionMapById.find( id );
|
||||
|
||||
if( it != m_sessionMapById.end() )
|
||||
it->second->loadPlayer();
|
||||
}
|
||||
|
||||
Core::SessionPtr Core::ServerZone::getSession( uint32_t id )
|
||||
{
|
||||
//std::lock_guard<std::mutex> lock( m_sessionMutex );
|
||||
|
@ -373,14 +356,6 @@ void Core::ServerZone::removeSession( std::string playerName )
|
|||
m_sessionMapByName.erase( playerName );
|
||||
}
|
||||
|
||||
void Core::ServerZone::updateSession( std::string playerName )
|
||||
{
|
||||
std::lock_guard< std::mutex > lock( m_sessionMutex );
|
||||
auto it = m_sessionMapByName.find( playerName );
|
||||
|
||||
if( it != m_sessionMapByName.end() )
|
||||
it->second->loadPlayer();
|
||||
}
|
||||
|
||||
bool Core::ServerZone::isRunning() const
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Core {
|
|||
class ServerZone
|
||||
{
|
||||
public:
|
||||
ServerZone( const std::string& configPath );
|
||||
ServerZone( const std::string& configName );
|
||||
~ServerZone();
|
||||
|
||||
void run( int32_t argc, char* argv[] );
|
||||
|
@ -27,8 +27,6 @@ namespace Core {
|
|||
|
||||
SessionPtr getSession( uint32_t id );
|
||||
SessionPtr getSession( std::string playerName );
|
||||
void updateSession( uint32_t id );
|
||||
void updateSession( std::string playerName );
|
||||
|
||||
size_t getSessionCount() const;
|
||||
|
||||
|
@ -38,7 +36,6 @@ namespace Core {
|
|||
|
||||
void printBanner() const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
uint16_t m_port;
|
||||
|
@ -47,7 +44,7 @@ namespace Core {
|
|||
|
||||
bool m_bRunning;
|
||||
|
||||
std::string m_configPath;
|
||||
std::string m_configName;
|
||||
|
||||
std::mutex m_sessionMutex;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <Framework.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Config/XMLConfig.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include "Script/ScriptMgr.h"
|
||||
#include <Database/CharaDbConnection.h>
|
||||
|
@ -13,34 +12,36 @@
|
|||
#include "Zone/TerritoryMgr.h"
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
Core::Framework g_fw;
|
||||
|
||||
using namespace Core;
|
||||
|
||||
bool setupFramework()
|
||||
{
|
||||
auto pServer = boost::make_shared< ServerZone >( "config/settings_zone.xml" );
|
||||
auto pServer = boost::make_shared< ServerZone >( "zone.ini" );
|
||||
auto pLogger = boost::make_shared< Logger >();
|
||||
auto pConfig = boost::make_shared< XMLConfig >();
|
||||
auto pExdData = boost::make_shared< Data::ExdDataGenerated >();
|
||||
auto pScript = boost::make_shared< Scripting::ScriptMgr >();
|
||||
auto pDb = boost::make_shared< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||
auto pLsMgr = boost::make_shared< LinkshellMgr >();
|
||||
auto pTeriMgr = boost::make_shared< TerritoryMgr >();
|
||||
auto pDebugCom = boost::make_shared< DebugCommandHandler >();
|
||||
auto pConfig = boost::make_shared< ConfigMgr >();
|
||||
|
||||
pLogger->setLogPath( "log/SapphireZone_" );
|
||||
pLogger->init();
|
||||
|
||||
g_fw.set< ServerZone >( pServer );
|
||||
g_fw.set< Logger >( pLogger );
|
||||
g_fw.set< XMLConfig >( pConfig );
|
||||
g_fw.set< Data::ExdDataGenerated >( pExdData );
|
||||
g_fw.set< Scripting::ScriptMgr >( pScript );
|
||||
g_fw.set< Db::DbWorkerPool< Db::CharaDbConnection > >( pDb );
|
||||
g_fw.set< LinkshellMgr >( pLsMgr );
|
||||
g_fw.set< TerritoryMgr >( pTeriMgr );
|
||||
g_fw.set< DebugCommandHandler >( pDebugCom );
|
||||
g_fw.set< ConfigMgr >( pConfig );
|
||||
|
||||
// actuall catch errors here...
|
||||
return true;
|
||||
|
@ -48,7 +49,6 @@ bool setupFramework()
|
|||
|
||||
int main( int32_t argc, char* argv[] )
|
||||
{
|
||||
|
||||
if( !setupFramework() )
|
||||
return 0; // too fucking bad...
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,14 +25,35 @@
|
|||
#include <fstream>
|
||||
#include <streambuf>
|
||||
#include <regex>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
|
||||
|
||||
Core::Logger g_log;
|
||||
Core::Data::ExdData g_exdData;
|
||||
bool skipUnmapped = true;
|
||||
|
||||
std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
//std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
||||
std::map< char, std::string > numberToStringMap
|
||||
{
|
||||
{ '0', "zero" },
|
||||
{ '1', "one" },
|
||||
{ '2', "two" },
|
||||
{ '3', "three" },
|
||||
{ '4', "four" },
|
||||
{ '5', "five" },
|
||||
{ '6', "six" },
|
||||
{ '7', "seven" },
|
||||
{ '8', "eight" },
|
||||
{ '9', "nine" },
|
||||
};
|
||||
|
||||
std::vector< std::string > cppKeyWords
|
||||
{
|
||||
"new",
|
||||
"class"
|
||||
};
|
||||
|
||||
//std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
|
||||
std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
|
||||
std::map< uint8_t, std::string > g_typeMap;
|
||||
|
||||
|
||||
|
@ -180,6 +201,22 @@ std::string generateStruct( const std::string &exd )
|
|||
}
|
||||
fieldName[0] = std::tolower( fieldName[0] );
|
||||
fieldName.erase( boost::remove_if( fieldName, boost::is_any_of(",-':![](){}<>% \x02\x1f\x01\x03") ), fieldName.end() );
|
||||
|
||||
for( auto entry : numberToStringMap )
|
||||
{
|
||||
if( fieldName[0] == entry.first )
|
||||
{
|
||||
fieldName.erase( 0, 1 );
|
||||
fieldName.insert( 0, entry.second );
|
||||
}
|
||||
}
|
||||
|
||||
for( std::string keyword : cppKeyWords )
|
||||
{
|
||||
if( fieldName == keyword )
|
||||
fieldName[0] = toupper( fieldName[0] );
|
||||
}
|
||||
|
||||
indexToNameMap[count] = fieldName;
|
||||
indexToTypeMap[count] = type;
|
||||
if( indexToTarget.find( count ) != indexToTarget.end() )
|
||||
|
|
|
@ -16,11 +16,12 @@
|
|||
#include <DatCat.h>
|
||||
|
||||
#include <Exd/ExdData.h>
|
||||
#include <Exd/ExdDataGenerated.h>
|
||||
#include <Logging/Logger.h>
|
||||
|
||||
|
||||
Core::Logger g_log;
|
||||
Core::Data::ExdData g_exdData;
|
||||
Core::Data::ExdDataGenerated g_exdDataGen;
|
||||
|
||||
const std::string onTalkStr(
|
||||
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
|
||||
|
@ -58,7 +59,7 @@ std::string titleCase( const std::string& str )
|
|||
return retStr;
|
||||
}
|
||||
|
||||
void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::set< std::string >& additionalList )
|
||||
void createScript( boost::shared_ptr< Core::Data::Quest >& pQuestData, std::set< std::string >& additionalList, int questId )
|
||||
{
|
||||
std::string header(
|
||||
"// This is an automatically generated C++ script template\n"
|
||||
|
@ -69,8 +70,8 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
"#include <ScriptObject.h>\n\n"
|
||||
);
|
||||
|
||||
std::size_t splitPos( pQuestData->name_intern.find( "_" ) );
|
||||
std::string className( pQuestData->name_intern.substr( 0, splitPos ) );
|
||||
std::size_t splitPos( pQuestData->id.find( "_" ) );
|
||||
std::string className( pQuestData->id.substr( 0, splitPos ) );
|
||||
//className = "Quest" + className;
|
||||
std::string sceneStr( " //////////////////////////////////////////////////////////////////////\n // Available Scenes in this quest, not necessarly all are used\n" );
|
||||
std::string seqStr;
|
||||
|
@ -131,26 +132,26 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
std::string rewards;
|
||||
rewards.reserve( 0xFFF );
|
||||
rewards += " // Quest rewards \n";
|
||||
rewards += ( pQuestData->reward_exp_factor != 0 ) ? " static constexpr auto RewardExpFactor = " + std::to_string( pQuestData->reward_exp_factor ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_gil != 0 ) ? " static constexpr auto RewardGil = " + std::to_string( pQuestData->reward_gil ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_emote != 0 ) ? " static constexpr auto RewardEmote = " + std::to_string( pQuestData->reward_emote ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_action != 0 ) ? " static constexpr auto RewardAction = " + std::to_string( pQuestData->reward_action ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_action_general1 != 0 ) ? " static constexpr auto RewardGeneralAction1 = " + std::to_string( pQuestData->reward_action_general1 ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_action_general2 != 0 ) ? " static constexpr auto RewardGeneralAction2 = " + std::to_string( pQuestData->reward_action_general2 ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_gc_seals != 0 ) ? " static constexpr auto RewardGCSeals = " + std::to_string( pQuestData->reward_gc_seals ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_other != 0 ) ? " static constexpr auto RewardOther = " + std::to_string( pQuestData->reward_other ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_reputation != 0 ) ? " static constexpr auto RewardReputation = " + std::to_string( pQuestData->reward_reputation ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_tome_type != 0 ) ? " static constexpr auto RewardTomeType = " + std::to_string( pQuestData->reward_tome_type ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reward_tome_count != 0 ) ? " static constexpr auto RewardTomeCount = " + std::to_string( pQuestData->reward_tome_count ) + ";\n" : "";
|
||||
rewards += ( pQuestData->instanced_content_unlock != 0 ) ? " static constexpr auto InstancedContentUnlock = " + std::to_string( pQuestData->instanced_content_unlock ) + ";\n" : "";
|
||||
rewards += ( pQuestData->expFactor != 0 ) ? " static constexpr auto RewardExpFactor = " + std::to_string( pQuestData->expFactor ) + ";\n" : "";
|
||||
rewards += ( pQuestData->gilReward != 0 ) ? " static constexpr auto RewardGil = " + std::to_string( pQuestData->gilReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->emoteReward != 0 ) ? " static constexpr auto RewardEmote = " + std::to_string( pQuestData->emoteReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->actionReward != 0 ) ? " static constexpr auto RewardAction = " + std::to_string( pQuestData->actionReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->generalActionReward[0] != 0 ) ? " static constexpr auto RewardGeneralAction1 = " + std::to_string( pQuestData->generalActionReward[0] ) + ";\n" : "";
|
||||
rewards += ( pQuestData->generalActionReward[1] != 0 ) ? " static constexpr auto RewardGeneralAction2 = " + std::to_string( pQuestData->generalActionReward[1] ) + ";\n" : "";
|
||||
rewards += ( pQuestData->gCSeals != 0 ) ? " static constexpr auto RewardGCSeals = " + std::to_string( pQuestData->gCSeals ) + ";\n" : "";
|
||||
rewards += ( pQuestData->otherReward != 0 ) ? " static constexpr auto RewardOther = " + std::to_string( pQuestData->otherReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->reputationReward != 0 ) ? " static constexpr auto RewardReputation = " + std::to_string( pQuestData->reputationReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->tomestoneReward != 0 ) ? " static constexpr auto RewardTomeType = " + std::to_string( pQuestData->tomestoneReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->tomestoneCountReward != 0 ) ? " static constexpr auto RewardTomeCount = " + std::to_string( pQuestData->tomestoneCountReward ) + ";\n" : "";
|
||||
rewards += ( pQuestData->instanceContentUnlock != 0 ) ? " static constexpr auto InstancedContentUnlock = " + std::to_string( pQuestData->instanceContentUnlock ) + ";\n" : "";
|
||||
|
||||
if( pQuestData->reward_item.size() > 0 )
|
||||
if( !pQuestData->itemReward0.empty() )
|
||||
{
|
||||
rewards += " static constexpr auto RewardItem[] = { ";
|
||||
for( size_t ca = 0; ca < pQuestData->reward_item.size(); ca++ )
|
||||
for( size_t ca = 0; ca < pQuestData->itemReward0.size(); ca++ )
|
||||
{
|
||||
rewards += std::to_string( pQuestData->reward_item.at( ca ) );
|
||||
if( ca != pQuestData->reward_item.size() - 1 )
|
||||
rewards += std::to_string( pQuestData->itemReward0.at( ca ) );
|
||||
if( ca != pQuestData->itemReward0.size() - 1 )
|
||||
{
|
||||
rewards += ", ";
|
||||
}
|
||||
|
@ -158,13 +159,13 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
rewards += " };\n";
|
||||
}
|
||||
|
||||
if( pQuestData->reward_item.size() > 0 )
|
||||
if( !pQuestData->itemReward0.empty() )
|
||||
{
|
||||
rewards += " static constexpr auto RewardItemCount[] = { ";
|
||||
for( size_t ca = 0; ca < pQuestData->reward_item_count.size(); ca++ )
|
||||
for( size_t ca = 0; ca < pQuestData->itemCountReward0.size(); ca++ )
|
||||
{
|
||||
rewards += std::to_string( pQuestData->reward_item_count.at( ca ) );
|
||||
if( ca != pQuestData->reward_item_count.size() - 1 )
|
||||
rewards += std::to_string( pQuestData->itemCountReward0.at( ca ) );
|
||||
if( ca != pQuestData->itemCountReward0.size() - 1 )
|
||||
{
|
||||
rewards += ", ";
|
||||
}
|
||||
|
@ -172,13 +173,13 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
rewards += " };\n";
|
||||
}
|
||||
|
||||
if( pQuestData->reward_item_optional.size() > 0 )
|
||||
if( !pQuestData->itemReward1.empty() )
|
||||
{
|
||||
rewards += " static constexpr auto RewardItemOptional[] = { ";
|
||||
for( size_t ca = 0; ca < pQuestData->reward_item_optional.size(); ca++ )
|
||||
for( size_t ca = 0; ca < pQuestData->itemReward1.size(); ca++ )
|
||||
{
|
||||
rewards += std::to_string( pQuestData->reward_item_optional.at( ca ) );
|
||||
if( ca != pQuestData->reward_item_optional.size() - 1 )
|
||||
rewards += std::to_string( pQuestData->itemReward1.at( ca ) );
|
||||
if( ca != pQuestData->itemReward1.size() - 1 )
|
||||
{
|
||||
rewards += ", ";
|
||||
}
|
||||
|
@ -186,13 +187,13 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
rewards += " };\n";
|
||||
}
|
||||
|
||||
if( pQuestData->reward_item_optional_count.size() > 0 )
|
||||
if( !pQuestData->itemCountReward1.empty() )
|
||||
{
|
||||
rewards += " static constexpr auto RewardItemOptionalCount[] = { ";
|
||||
for( size_t ca = 0; ca < pQuestData->reward_item_optional_count.size(); ca++ )
|
||||
for( size_t ca = 0; ca < pQuestData->itemCountReward1.size(); ca++ )
|
||||
{
|
||||
rewards += std::to_string( pQuestData->reward_item_optional_count.at( ca ) );
|
||||
if( ca != pQuestData->reward_item_optional_count.size() - 1 )
|
||||
rewards += std::to_string( pQuestData->itemCountReward1.at( ca ) );
|
||||
if( ca != pQuestData->itemCountReward1.size() - 1 )
|
||||
{
|
||||
rewards += ", ";
|
||||
}
|
||||
|
@ -207,21 +208,22 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
std::vector< std::string > script_entities;
|
||||
std::string sentities = " // Entities found in the script data of the quest\n";
|
||||
|
||||
for( size_t ca = 0; ca < pQuestData->script_entity.size(); ca ++ )
|
||||
for( size_t ca = 0; ca < pQuestData->scriptInstruction.size(); ca ++ )
|
||||
{
|
||||
if( ( pQuestData->script_entity.at( ca ).find( "HOWTO" ) != std::string::npos ) || ( pQuestData->script_entity.at( ca ).find( "HOW_TO" ) != std::string::npos ) )
|
||||
if( ( pQuestData->scriptInstruction.at( ca ).find( "HOWTO" ) != std::string::npos ) || ( pQuestData->scriptInstruction.at( ca ).find( "HOW_TO" ) != std::string::npos ) )
|
||||
continue;
|
||||
|
||||
if( ( pQuestData->script_entity.at( ca ).find( "EMOTENO" ) != std::string::npos ) || ( pQuestData->script_entity.at( ca ).find( "EMOTEOK" ) != std::string::npos ) )
|
||||
if( ( pQuestData->scriptInstruction.at( ca ).find( "EMOTENO" ) != std::string::npos ) || ( pQuestData->scriptInstruction.at( ca ).find( "EMOTEOK" ) != std::string::npos ) )
|
||||
hasEmote = true;
|
||||
|
||||
if( pQuestData->script_entity.at( ca ).find( "ENEMY" ) != std::string::npos )
|
||||
if( pQuestData->scriptInstruction.at( ca ).find( "ENEMY" ) != std::string::npos )
|
||||
{
|
||||
hasEnemies = true;
|
||||
enemy_ids.push_back( pQuestData->script_value.at( ca ) );
|
||||
enemy_ids.push_back( pQuestData->scriptArg.at( ca ) );
|
||||
}
|
||||
|
||||
script_entities.push_back( pQuestData->script_entity.at( ca ) + " = " + std::to_string( pQuestData->script_value.at( ca ) ) );
|
||||
if( !pQuestData->scriptInstruction.at( ca ).empty() )
|
||||
script_entities.push_back( pQuestData->scriptInstruction.at( ca ) + " = " + std::to_string( pQuestData->scriptArg.at( ca ) ) );
|
||||
}
|
||||
std::sort( script_entities.begin(), script_entities.end() );
|
||||
for( auto& entity : script_entities )
|
||||
|
@ -231,11 +233,11 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
sentities += " static constexpr auto " + name + ";\n";
|
||||
}
|
||||
|
||||
std::string additional = "// Quest Script: " + pQuestData->name_intern + "\n";
|
||||
std::string additional = "// Quest Script: " + pQuestData->id + "\n";
|
||||
additional += "// Quest Name: " + pQuestData->name + "\n";
|
||||
additional += "// Quest ID: " + std::to_string( pQuestData->id ) + "\n";
|
||||
additional += "// Start NPC: " + std::to_string( pQuestData->enpc_resident_start ) + "\n";
|
||||
additional += "// End NPC: " + std::to_string( pQuestData->enpc_resident_end ) + "\n\n";
|
||||
additional += "// Quest ID: " + std::to_string( questId ) + "\n";
|
||||
additional += "// Start NPC: " + std::to_string( pQuestData->eNpcResidentStart ) + "\n";
|
||||
additional += "// End NPC: " + std::to_string( pQuestData->eNpcResidentEnd ) + "\n\n";
|
||||
|
||||
std::string scriptEntry;
|
||||
scriptEntry.reserve(0xFFFF);
|
||||
|
@ -271,7 +273,7 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
constructor += rewards + "\n";
|
||||
constructor += sentities + "\n";
|
||||
constructor += " public:\n";
|
||||
constructor += " " + className + "() : EventScript" + "( " + std::to_string( pQuestData->id ) + " ){}; \n";
|
||||
constructor += " " + className + "() : EventScript" + "( " + std::to_string( questId ) + " ){}; \n";
|
||||
constructor += " ~" + className + "(){}; \n";
|
||||
|
||||
std::string classString(
|
||||
|
@ -287,7 +289,7 @@ void createScript( boost::shared_ptr< Core::Data::QuestInfo >& pQuestData, std::
|
|||
|
||||
std::ofstream outputFile;
|
||||
|
||||
outputFile.open( "generated/" + className + ".cpp_generated" );
|
||||
outputFile.open( "generated/" + className + ".cpp" );
|
||||
outputFile << header << additional << classString;
|
||||
outputFile.close();
|
||||
}
|
||||
|
@ -308,8 +310,8 @@ int main( int argc, char** argv )
|
|||
|
||||
unluac = true;
|
||||
|
||||
g_log.info( "Setting up EXD data" );
|
||||
if( !g_exdData.init( datLocation ) )
|
||||
g_log.info( "Setting up generated EXD data" );
|
||||
if( !g_exdDataGen.init( datLocation ) )
|
||||
{
|
||||
std::cout << datLocation << "\n";
|
||||
g_log.fatal( "Error setting up EXD data " );
|
||||
|
@ -318,33 +320,33 @@ int main( int argc, char** argv )
|
|||
}
|
||||
|
||||
xiv::dat::GameData data( datLocation );
|
||||
xiv::exd::ExdData eData( data );
|
||||
|
||||
auto QuestDat = g_exdData.setupDatAccess( "Quest", xiv::exd::Language::en );
|
||||
auto rows = QuestDat.get_rows();
|
||||
auto rows = g_exdDataGen.getQuestIdList();
|
||||
|
||||
if ( !boost::filesystem::exists( "./generated" ) )
|
||||
boost::filesystem::create_directory( "./generated" );
|
||||
|
||||
std::cout << "Export in progress";
|
||||
g_log.info( "Export in progress" );
|
||||
|
||||
uint32_t updateInterval = rows.size() / 20;
|
||||
uint32_t i = 0;
|
||||
for( const auto& row : rows )
|
||||
{
|
||||
auto questInfo = g_exdData.getQuestInfo( row.first );
|
||||
g_log.info( "Generating " + std::to_string( row ) );
|
||||
auto questInfo = g_exdDataGen.get<Core::Data::Quest>( row );
|
||||
|
||||
if( questInfo->name.empty() || questInfo->name_intern.empty() )
|
||||
if( questInfo->name.empty() || questInfo->id.empty() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t pos_seperator = questInfo->name_intern.find_first_of( "_" );
|
||||
size_t pos_seperator = questInfo->id.find_first_of( "_" );
|
||||
|
||||
std::string folder;
|
||||
|
||||
if( pos_seperator != std::string::npos )
|
||||
{
|
||||
folder = questInfo->name_intern.substr( pos_seperator + 1, 3 );
|
||||
folder = questInfo->id.substr( pos_seperator + 1, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -355,7 +357,7 @@ int main( int argc, char** argv )
|
|||
|
||||
const xiv::dat::Cat& test = data.getCategory( "game_script" );
|
||||
|
||||
const std::string questPath = "game_script/quest/" + folder + "/" + questInfo->name_intern + ".luab";
|
||||
const std::string questPath = "game_script/quest/" + folder + "/" + questInfo->id + ".luab";
|
||||
|
||||
const auto &test_file = data.getFile( questPath );
|
||||
auto §ion = test_file->access_data_sections().at( 0 );
|
||||
|
@ -366,12 +368,12 @@ int main( int argc, char** argv )
|
|||
uint32_t offset = 0;
|
||||
|
||||
std::ofstream outputFile1;
|
||||
outputFile1.open( "generated/" + questInfo->name_intern + ".luab", std::ios::binary );
|
||||
outputFile1.open( "generated/" + questInfo->id + ".luab", std::ios::binary );
|
||||
outputFile1.write( §ion[0], section.size() );
|
||||
outputFile1.close();
|
||||
if( unluac )
|
||||
{
|
||||
std::string command = std::string( "java -jar unluac_2015_06_13.jar " ) + "generated/" + questInfo->name_intern + ".luab" + ">> " + "generated/" + questInfo->name_intern + ".lua";
|
||||
std::string command = std::string( "java -jar unluac_2015_06_13.jar " ) + "generated/" + questInfo->id + ".luab" + ">> " + "generated/" + questInfo->id + ".lua";
|
||||
if ( system( command.c_str() ) == -1 )
|
||||
{
|
||||
g_log.error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) );
|
||||
|
@ -402,7 +404,7 @@ int main( int argc, char** argv )
|
|||
}
|
||||
|
||||
|
||||
createScript( questInfo, stringList );
|
||||
createScript( questInfo, stringList, row );
|
||||
++i;
|
||||
if( i % updateInterval == 0 )
|
||||
std::cout << ".";
|
||||
|
|
Loading…
Add table
Reference in a new issue