1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 08:57:44 +00:00

Merge pull request #1 from SapphireServer/develop

Develop
This commit is contained in:
JeidoUran 2019-01-02 17:06:25 +01:00 committed by GitHub
commit 8a7ab5aeb6
188 changed files with 5103 additions and 2019 deletions

View file

@ -6,15 +6,18 @@ set( CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin )
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin )
set( LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin )
set( EXECUTABLE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake )
set( CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake )
##########################################################################
# Dependencies and compiler settings
######################################
# Dependencies and compiler settings #
######################################
include( "cmake/mysql.cmake" )
include( "cmake/compiler.cmake" )
include( "cmake/cotire.cmake" )
##############################
# Git #
##############################
@ -25,23 +28,31 @@ configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/common/Version.cpp.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/common/Version.cpp" @ONLY )
##############################
# Mysql #
# Mysql #
##############################
find_package( MySQL )
##########################################################################
##############################
# Dependencies #
##############################
add_subdirectory( "deps/zlib" )
add_subdirectory( "deps/MySQL" )
add_subdirectory( "deps/datReader" )
add_subdirectory( "deps/mysqlConnector" )
add_subdirectory( "src/common" )
##############################
# Main Sapphire Components #
##############################
add_subdirectory( "src/common" )
add_subdirectory( "src/api" )
add_subdirectory( "src/lobby" )
add_subdirectory( "src/world" )
add_subdirectory( "src/dbm" )
add_subdirectory( "src/scripts" )
add_subdirectory( "src/dbm" )
##############################
# Tools #
##############################
add_subdirectory( "src/tools/exd_common_gen" )
add_subdirectory( "src/tools/exd_struct_gen" )
add_subdirectory( "src/tools/exd_struct_test" )

View file

@ -55,4 +55,8 @@ ListenPort = 54992
[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
MotD = Welcome to Sapphire!;This is a very good server;You can change these messages by editing General.MotD in config/config.ini
[Housing]
; Set the default estate name. %i will be replaced with the plot number
DefaultEstateName = Estate #%i

File diff suppressed because one or more lines are too long

View file

@ -27,6 +27,17 @@ CREATE TABLE `bnpctemplate` (
KEY `templatename` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `spawnpoint` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`spawnGroupId` int(11) NOT NULL,
`x` float NOT NULL,
`y` float NOT NULL,
`z` float NOT NULL,
`r` float NOT NULL,
PRIMARY KEY (`id`),
KEY `spawngroupidx` (`spawnGroupId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `charainfo` (
`AccountId` int(11) NOT NULL,
`CharacterId` int(20) NOT NULL,
@ -404,9 +415,6 @@ CREATE TABLE `house` (
`Comment` binary(193) DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`HouseName` binary(23) DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`Endorsements` bigint(20) DEFAULT NULL,
`HousePartModels` binary(32) DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`HousePartColours` binary(8) DEFAULT '\0\0\0\0\0\0\0\0',
`HouseInteriorModels` binary(40) DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
`UPDATE_DATE` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`HouseId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -530,11 +538,12 @@ CREATE TABLE `landset` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `houseiteminventory` (
`LandIdent` BIGINT(20) UNSIGNED NOT NULL,
`ContainerId` INT(10) UNSIGNED NOT NULL,
`ItemId` INT(20) NOT NULL,
`SlotId` INT(10) UNSIGNED NOT NULL,
INDEX `landIdent` (`landIdent`)
`LandIdent` BIGINT(20) UNSIGNED NOT NULL,
`ContainerId` INT(10) UNSIGNED NOT NULL,
`SlotId` INT(10) UNSIGNED NOT NULL,
`ItemId` INT(20) NOT NULL,
PRIMARY KEY (`LandIdent`, `ContainerId`, `SlotId`),
INDEX `landIdent` (`LandIdent`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `spawngroup` (
@ -543,7 +552,6 @@ CREATE TABLE `spawngroup` (
`bNpcTemplateId` int(10) NOT NULL,
`level` int(3) NOT NULL,
`maxHp` int(10) NOT NULL,
`gimmickId` int(10) NOT NULL,
PRIMARY KEY(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@ -564,3 +572,14 @@ CREATE TABLE `zonepositions` (
`radius` int(11) NOT NULL DEFAULT '2',
PRIMARY KEY(`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
CREATE TABLE `landplaceditems` (
`ItemId` INT(20) UNSIGNED NOT NULL,
`PosX` INT(10) NOT NULL,
`PosY` INT(10) NOT NULL,
`PosZ` INT(10) NOT NULL,
`Rotation` INT(10) NOT NULL,
PRIMARY KEY (`ItemId`)
)
COLLATE='latin1_swedish_ci' ENGINE=InnoDB;

View file

@ -43,6 +43,14 @@
return data;
}
function keypressing(e) {
if (!e) e = window.event;
var keyCode = e.keyCode || e.which;
if (keyCode == '13'){
doLogin();
return false;
}
}
</script>
@ -79,7 +87,7 @@
<div class="input-control">
<label class="s-login-input-wrapper">
Password
<input type="password" name="password">
<input type="password" name="password" onkeypress="return keypressing(event)">
</label>
</div>
<button class="btn btn-default s-login-btn pull-right" id="submitButton" onclick="doLogin()">Login</button>

View file

@ -1,33 +1,43 @@
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fPIC")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
if( UNIX )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fPIC" )
else()
add_definitions(-D_WIN32_WINNT=0x601)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DNOMINMAX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
add_definitions( -D_WIN32_WINNT=0x601 )
add_definitions( -D_CRT_SECURE_NO_WARNINGS )
add_definitions( -DNOMINMAX )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj" )
set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_STANDARD_REQUIRED ON )
set( CMAKE_CXX_EXTENSIONS ON )
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/bin/" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin/" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/bin/" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/bin/" )
set( VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/" )
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
# disabling SAFESEH
message(STATUS "Disabling Safe Exception Handlers..")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
message( STATUS "Disabling Safe Exception Handlers.." )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO" )
# edit and continue
message(STATUS "Enabling Edit and Continue..")
add_definitions(/Zi)
message( STATUS "Enabling Edit and Continue.." )
add_definitions( /Zi )
# incremental linking
message(STATUS "Enabling Incremental Linking..")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL")
message( STATUS "Enabling Incremental Linking.." )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /INCREMENTAL" )
# enable building with multiple processes
message(STATUS "Enabling Build with Multiple Processes..")
add_definitions(/MP)
message( STATUS "Enabling Build with Multiple Processes.." )
add_definitions( /MP )
endif()
endif()
# force standalone asio
add_definitions( -DASIO_STANDALONE )
add_definitions( -DASIO_STANDALONE )

View file

@ -10,12 +10,6 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
add_library( xivdat ${UTILS_PUBLIC_INCLUDE_FILES} ${UTILS_SOURCE_FILES} )
set_target_properties( xivdat PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)
if (UNIX)
target_link_libraries( xivdat PUBLIC dl )
target_link_libraries( xivdat PUBLIC z )

View file

@ -9,12 +9,6 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
add_library( mysqlConnector ${UTILS_PUBLIC_INCLUDE_FILES} ${UTILS_SOURCE_FILES} )
set_target_properties( mysqlConnector PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
)
target_include_directories( mysqlConnector PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries( mysqlConnector PUBLIC mysql )
#cotire(mysqlConnector)

View file

@ -7,21 +7,4 @@ file( GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*" )
add_executable( api ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES} )
set_target_properties( api PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
)
target_link_libraries( api common )
if( UNIX )
target_link_libraries( api mysqlclient stdc++fs )
else()
target_link_libraries( api mysql )
endif()

View file

@ -409,6 +409,7 @@ void PlayerMinimal::insertDbGlobalItem( uint32_t itemId, uint64_t uniqueId ) con
stmtItemGlobal->setInt( 1, m_id );
stmtItemGlobal->setInt64( 2, uniqueId );
stmtItemGlobal->setInt( 3, itemId );
stmtItemGlobal->setInt( 4, 1 ); // stack of 1
g_charaDb.directExecute( stmtItemGlobal );
}

View file

@ -27,13 +27,11 @@
#include <algorithm>
#include <Framework.h>
#include <Logging/Logger.h>
#include "Forwards.h"
#include "SapphireAPI.h"
Sapphire::Framework g_fw;
Sapphire::Logger g_log;
Sapphire::Db::DbWorkerPool< Sapphire::Db::ZoneDbConnection > g_charaDb;
Sapphire::Data::ExdDataGenerated g_exdDataGen;
Sapphire::Network::SapphireAPI g_sapphireAPI;
@ -41,6 +39,7 @@ Sapphire::Network::SapphireAPI g_sapphireAPI;
namespace fs = std::experimental::filesystem;
using namespace std;
using namespace Sapphire;
using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >;
using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >;
@ -64,17 +63,17 @@ void reloadConfig()
void print_request_info( shared_ptr< HttpServer::Request > request )
{
g_log.info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" );
Logger::info( "Request from " + request->remote_endpoint_address + " (" + request->path + ")" );
}
bool loadSettings( int32_t argc, char* argv[] )
{
g_log.info( "Loading config " + configPath );
Logger::info( "Loading config " + configPath );
if( !m_pConfig->loadConfig( configPath ) )
{
g_log.fatal( "Error loading config " + configPath );
g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
Logger::fatal( "Error loading config " + configPath );
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
return false;
}
@ -135,17 +134,17 @@ bool loadSettings( int32_t argc, char* argv[] )
}
catch( ... )
{
g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
g_log.error( "Usage: <arg> <val> \n" );
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
Logger::error( "Usage: <arg> <val> \n" );
}
}
g_log.info( "Setting up generated EXD data" );
Logger::info( "Setting up generated EXD data" );
auto dataPath = m_pConfig->getValue< std::string >( "GlobalParameters", "DataPath", "" );
if( !g_exdDataGen.init( dataPath ) )
{
g_log.fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
g_log.fatal( "DataPath: " + dataPath );
Logger::fatal( "Error setting up generated EXD data. Make sure that DataPath is set correctly in config.ini" );
Logger::fatal( "DataPath: " + dataPath );
return false;
}
@ -168,7 +167,7 @@ bool loadSettings( int32_t argc, char* argv[] )
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) ) );
server.config.address = m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" );
g_log.info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
Logger::info( "Database: Connected to " + info.host + ":" + std::to_string( info.port ) );
return true;
}
@ -279,7 +278,7 @@ void createAccount( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -313,7 +312,7 @@ void login( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServer:
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -348,7 +347,7 @@ void deleteCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -396,7 +395,7 @@ void createCharacter( shared_ptr< HttpServer::Response > response, shared_ptr< H
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -429,7 +428,7 @@ void insertSession( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -464,7 +463,7 @@ void checkNameTaken( shared_ptr< HttpServer::Response > response, shared_ptr< Ht
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -506,7 +505,7 @@ void checkSession( shared_ptr< HttpServer::Response > response, shared_ptr< Http
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -536,7 +535,7 @@ void getNextCharId( shared_ptr< HttpServer::Response > response, shared_ptr< Htt
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -567,7 +566,7 @@ void getNextContentId( shared_ptr< HttpServer::Response > response, shared_ptr<
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -623,7 +622,7 @@ void getCharacterList( shared_ptr< HttpServer::Response > response, shared_ptr<
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -658,7 +657,7 @@ void get_init( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServ
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -692,7 +691,7 @@ void get_headline_all( shared_ptr< HttpServer::Response > response, shared_ptr<
catch( exception& e )
{
*response << buildHttpResponse( 500 );
g_log.error( e.what() );
Logger::error( e.what() );
}
}
@ -735,16 +734,13 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe
int main( int argc, char* argv[] )
{
auto pLog = std::shared_ptr< Sapphire::Logger >( new Sapphire::Logger() );
g_fw.set< Sapphire::Logger >( pLog );
g_log.setLogPath( "log/SapphireAPI" );
g_log.init();
Logger::init( "log/api" );
g_log.info( "===========================================================" );
g_log.info( "Sapphire API Server " );
g_log.info( "Version: 0.0.1" );
g_log.info( "Compiled: " __DATE__ " " __TIME__ );
g_log.info( "===========================================================" );
Logger::info( "===========================================================" );
Logger::info( "Sapphire API Server " );
Logger::info( "Version: 0.0.1" );
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
Logger::info( "===========================================================" );
if( !loadSettings( argc, argv ) )
throw std::exception();
@ -771,8 +767,8 @@ int main( int argc, char* argv[] )
server.start();
} );
g_log.info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
Logger::info( "API server running on " + m_pConfig->getValue< std::string >( "RestNetwork", "ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "RestNetwork", "ListenPort", "80" ) );
//Wait for server to start so that the client can connect
this_thread::sleep_for( chrono::seconds( 1 ) );

View file

@ -17,28 +17,16 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
add_library( common ${UTILS_PUBLIC_INCLUDE_FILES} ${UTILS_SOURCE_FILES} )
set_target_properties( common PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
)
target_link_libraries( common PUBLIC xivdat )
target_link_libraries( common PUBLIC mysqlConnector )
target_link_libraries( common
PUBLIC
xivdat
mysqlConnector
mysql )
if( UNIX )
target_link_libraries( common PUBLIC mysqlclient )
target_link_libraries( common PUBLIC pthread )
else()
target_link_libraries( common
target_link_libraries( common
PUBLIC
mysql )
pthread
stdc++fs )
endif()
target_include_directories( common

View file

@ -26,6 +26,13 @@ namespace Sapphire::Common
float z;
};
struct FFXIVARR_POSITION3_U16
{
uint16_t x;
uint16_t y;
uint16_t z;
};
struct ActiveLand
{
uint8_t ward;
@ -225,13 +232,15 @@ namespace Sapphire::Common
// housing interior containers
HousingInteriorAppearance = 25002,
// 50 in each container max, 300 slots max
// 50 in each container max, 400 slots max
HousingInteriorPlacedItems1 = 25003,
HousingInteriorPlacedItems2 = 25004,
HousingInteriorPlacedItems3 = 25005,
HousingInteriorPlacedItems4 = 25006,
HousingInteriorPlacedItems5 = 25007,
HousingInteriorPlacedItems6 = 25008,
HousingInteriorPlacedItems7 = 25009,
HousingInteriorPlacedItems8 = 25010,
// 50 max per container, 400 slots max
// slot limit increased 'temporarily' for relocation for all estates
@ -247,9 +256,9 @@ namespace Sapphire::Common
// housing exterior containers
HousingOutdoorPlacedItems = 25001,
HousingOutdoorAppearance = 25000,
HousingOutdoorStoreroom = 27000,
HousingExteriorAppearance = 25000,
HousingExteriorPlacedItems = 25001,
HousingExteriorStoreroom = 27000,
};
@ -769,19 +778,20 @@ namespace Sapphire::Common
MountSkill = 0xD,
};
enum HousePartSlot
enum HouseExteriorSlot
{
HousePermit,
ExteriorRoof,
ExteriorWall,
ExteriorWindow,
ExteriorDoor,
OtherFloorWall,
OtherFloorFlooring,
BasementWall,
YardSign
ExteriorRoofDecoration,
ExteriorWallDecoration,
ExteriorPlacard,
ExteriorFence
};
enum HousingInteriorSlot
enum HouseInteriorSlot
{
InteriorWall,
InteriorFloor,
@ -842,13 +852,11 @@ namespace Sapphire::Common
uint32_t unkown1; //12
};
struct YardObject
struct HousingObject
{
uint32_t itemId;
uint16_t itemRotation;
uint16_t pos_x;
uint16_t pos_y;
uint16_t pos_z;
Common::FFXIVARR_POSITION3_U16 pos;
};
enum HouseSize : uint8_t
@ -858,13 +866,13 @@ namespace Sapphire::Common
Mansion
};
enum HouseState : uint8_t
enum HouseStatus : uint8_t
{
none,
forSale,
sold,
privateHouse,
fcHouse,
ForSale,
Sold,
PrivateEstate,
FreeCompanyEstate,
};
enum HouseIconAdd : uint8_t

View file

@ -6,8 +6,6 @@
#include "PreparedStatement.h"
#include "Framework.h"
extern Sapphire::Framework g_fw;
Sapphire::Db::DbConnection::DbConnection( ConnectionInfo& connInfo ) :
m_reconnecting( false ),
m_prepareError( false ),
@ -66,7 +64,7 @@ uint32_t Sapphire::Db::DbConnection::open()
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
Logger::error( e.what() );
return 1;
}
@ -118,7 +116,7 @@ bool Sapphire::Db::DbConnection::execute( const std::string& sql )
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
Logger::error( e.what() );
return false;
}
}
@ -133,7 +131,7 @@ std::shared_ptr< Mysql::ResultSet > Sapphire::Db::DbConnection::query( const std
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
Logger::error( e.what() );
return nullptr;
}
}
@ -170,7 +168,7 @@ Sapphire::Db::DbConnection::query( std::shared_ptr< Sapphire::Db::PreparedStatem
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
Logger::error( e.what() );
return nullptr;
}
@ -196,7 +194,7 @@ bool Sapphire::Db::DbConnection::execute( std::shared_ptr< Sapphire::Db::Prepare
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
Logger::error( e.what() );
return false;
}
}
@ -232,7 +230,7 @@ void Sapphire::Db::DbConnection::prepareStatement( uint32_t index, const std::st
}
catch( std::runtime_error& e )
{
g_fw.get< Logger >()->error( e.what() );
Logger::error( e.what() );
m_prepareError = true;
}

View file

@ -3,9 +3,6 @@
#include "ZoneDbConnection.h"
#include "DbWorkerPool.h"
#include "Logging/Logger.h"
#include "Framework.h"
extern Sapphire::Framework g_fw;
Sapphire::Db::DbLoader::DbLoader()
{
@ -17,14 +14,12 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
m_open.push( [ this, info, &pool ]()->bool
{
auto pLog = g_fw.get< Logger >();
const uint8_t asyncThreads = info.asyncThreads;
const uint8_t synchThreads = info.syncThreads;
if( asyncThreads < 1 || asyncThreads > 32 )
{
pLog->error(
Logger::error(
"database: invalid number of worker threads specified. Please pick a value between 1 and 32." );
return false;
}
@ -40,7 +35,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
if( error )
{
pLog->error( "DatabasePool failed to open." );
Logger::error( "DatabasePool failed to open." );
return false;
}
}
@ -55,8 +50,7 @@ Sapphire::Db::DbLoader& Sapphire::Db::DbLoader::addDb( Sapphire::Db::DbWorkerPoo
{
if( !pool.prepareStatements() )
{
auto pLog = g_fw.get< Logger >();
pLog->error( "Could not prepare statements of the database, see log for details." );
Logger::error( "Could not prepare statements of the database, see log for details." );
return false;
}
return true;

View file

@ -10,8 +10,6 @@
#include "Logging/Logger.h"
#include <mysql.h>
extern Sapphire::Framework g_fw;
class PingOperation :
public Sapphire::Db::Operation
{
@ -23,8 +21,7 @@ class PingOperation :
};
template< class T >
Sapphire::Db::DbWorkerPool< T >::DbWorkerPool()
:
Sapphire::Db::DbWorkerPool< T >::DbWorkerPool() :
m_queue( new Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >() ),
m_asyncThreads( 0 ),
m_synchThreads( 0 )
@ -39,8 +36,8 @@ Sapphire::Db::DbWorkerPool< T >::~DbWorkerPool()
template< class T >
void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& info,
uint8_t asyncThreads,
uint8_t synchThreads )
uint8_t asyncThreads,
uint8_t synchThreads )
{
m_connectionInfo = info;
m_asyncThreads = asyncThreads;
@ -50,10 +47,9 @@ void Sapphire::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& i
template< class T >
uint32_t Sapphire::Db::DbWorkerPool< T >::open()
{
auto pLog = g_fw.get< Logger >();
pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
" Synchronous connections: " + std::to_string( m_synchThreads ) );
Logger::info( "[DbPool] Opening DatabasePool " + getDatabaseName() +
" Asynchronous connections: " + std::to_string( m_asyncThreads ) +
" Synchronous connections: " + std::to_string( m_synchThreads ) );
uint32_t error = openConnections( IDX_ASYNC, m_asyncThreads );
@ -64,9 +60,9 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
if( !error )
{
pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
" total connections running." );
Logger::info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " +
std::to_string( ( m_connections[ IDX_SYNCH ].size() + m_connections[ IDX_ASYNC ].size() ) ) +
" total connections running." );
}
return error;
@ -75,11 +71,10 @@ uint32_t Sapphire::Db::DbWorkerPool< T >::open()
template< class T >
void Sapphire::Db::DbWorkerPool< T >::close()
{
auto pLog = g_fw.get< Logger >();
pLog->info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
Logger::info( "[DbPool] Closing down DatabasePool " + getDatabaseName() );
m_connections[ IDX_ASYNC ].clear();
m_connections[ IDX_SYNCH ].clear();
pLog->info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
Logger::info( "[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." );
}
template< class T >

View file

@ -172,8 +172,8 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
/// ITEM GLOBAL
prepareStatement( CHARA_ITEMGLOBAL_INS,
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, UPDATE_DATE ) VALUES ( ?, ?, ?, NOW() );",
CONNECTION_BOTH );
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );",
CONNECTION_SYNC );
/// BNPC TEMPLATES
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
@ -193,15 +193,21 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
/// HOUSING
prepareStatement( HOUSING_HOUSE_INS,
"INSERT INTO house ( LandSetId, HouseId ) VALUES ( ?, ? );",
"INSERT INTO house ( LandSetId, HouseId, HouseName ) VALUES ( ?, ?, ? );",
CONNECTION_BOTH );
prepareStatement( HOUSING_HOUSE_UP,
"UPDATE house SET BuildTime = ?, Aetheryte = ?, Comment = ?, HouseName = ?, Endorsements = ?, HousePartModels = ?, HousePartColours = ?, HouseInteriorModels = ? WHERE HouseId = ?;",
"UPDATE house SET BuildTime = ?, Aetheryte = ?, Comment = ?, HouseName = ?, Endorsements = ? WHERE HouseId = ?;",
CONNECTION_BOTH );
prepareStatement( LAND_INV_SEL_ALL,
"SELECT LandIdent, ContainerId, ItemId, SlotId FROM houseiteminventory;",
"SELECT houseiteminventory.*, charaglobalitem.catalogId, charaglobalitem.stain, charaglobalitem.CharacterId, "
"landplaceditems.PosX, landplaceditems.PosY, landplaceditems.PosZ, landplaceditems.Rotation "
"FROM houseiteminventory "
"LEFT JOIN charaglobalitem "
"ON houseiteminventory.ItemId = charaglobalitem.itemId "
"LEFT JOIN landplaceditems "
"ON houseiteminventory.ItemId = landplaceditems.ItemId;",
CONNECTION_BOTH );
prepareStatement( LAND_INV_SEL_HOUSE,
@ -212,6 +218,35 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
"SELECT * FROM land WHERE LandSetId = ?;",
CONNECTION_SYNC );
prepareStatement( LAND_SEL_ALL,
"SELECT land.*, house.Welcome, house.Aetheryte, house.Comment, house.HouseName, house.BuildTime, house.Endorsements "
"FROM land "
"LEFT JOIN house "
"ON land.HouseId = house.HouseId;",
CONNECTION_SYNC );
prepareStatement( LAND_INV_UP,
"INSERT INTO houseiteminventory ( LandIdent, ContainerId, SlotId, ItemId ) "
"VALUES ( ?, ?, ?, ? ) "
"ON DUPLICATE KEY UPDATE ItemId = ?;",
CONNECTION_BOTH );
prepareStatement( LAND_INV_DEL,
"DELETE FROM houseiteminventory "
"WHERE LandIdent = ? AND ContainerId = ? AND SlotId = ?;",
CONNECTION_BOTH );
prepareStatement( LAND_INV_UP_ITEMPOS,
"INSERT INTO landplaceditems ( ItemId, PosX, PosY, PosZ, Rotation ) "
"VALUES ( ?, ?, ?, ?, ? ) "
"ON DUPLICATE KEY UPDATE PosX = ?, PosY = ?, PosZ = ?, Rotation = ?;",
CONNECTION_BOTH );
prepareStatement( LAND_INV_DEL_ITEMPOS,
"DELETE FROM landplaceditems "
"WHERE ItemId = ?;",
CONNECTION_BOTH );
/*prepareStatement( LAND_INS,
"INSERT INTO land ( LandSetId ) VALUES ( ? );",
CONNECTION_BOTH );

View file

@ -80,6 +80,7 @@ namespace Sapphire::Db
LAND_INS,
LAND_SEL,
LAND_SEL_ALL,
LAND_UP,
LANDSET_SEL,
HOUSING_HOUSE_INS,
@ -90,6 +91,8 @@ namespace Sapphire::Db
LAND_INV_SEL_HOUSE,
LAND_INV_DEL,
LAND_INV_UP,
LAND_INV_UP_ITEMPOS,
LAND_INV_DEL_ITEMPOS,
MAX_STATEMENTS

View file

@ -8,6 +8,8 @@ namespace Sapphire
class ConfigMgr;
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
class Framework;
using FrameworkPtr = std::shared_ptr< Framework >;
namespace Network
{

View file

@ -23,9 +23,9 @@ namespace Sapphire
}
void Logger::setLogPath( const std::string& logPath )
void Logger::init( const std::string& logPath )
{
auto pos = logPath.find_last_of( '/' );
auto pos = logPath.find_last_of( fs::path::preferred_separator );
if( pos != std::string::npos )
{
@ -33,15 +33,10 @@ namespace Sapphire
fs::create_directories( realPath );
}
m_logFile = logPath;
}
void Logger::init()
{
spdlog::init_thread_pool( 8192, 1 );
auto stdout_sink = std::make_shared< spdlog::sinks::stdout_color_sink_mt >();
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( m_logFile + ".log", 0, 0 );
auto daily_sink = std::make_shared< spdlog::sinks::daily_file_sink_mt >( logPath + ".log", 0, 0 );
std::vector< spdlog::sink_ptr > sinks { stdout_sink, daily_sink };
@ -63,6 +58,11 @@ namespace Sapphire
spdlog::get( "logger" )->error( text );
}
void Logger::warn( const std::string& text )
{
spdlog::get( "logger" )->warn( text );
}
void Logger::info( const std::string& text )
{
spdlog::get( "logger" )->info( text );
@ -78,4 +78,9 @@ namespace Sapphire
spdlog::get( "logger" )->critical( text );
}
void Logger::trace( const std::string& text )
{
spdlog::get( "logger" )->trace( text );
}
}

View file

@ -11,23 +11,24 @@ namespace Sapphire
private:
std::string m_logFile;
public:
Logger();
~Logger();
void init();
public:
void error( const std::string& text );
static void init( const std::string& logPath );
void info( const std::string& text );
static void error( const std::string& text );
void debug( const std::string& text );
static void warn( const std::string& text );
void fatal( const std::string& text );
static void info( const std::string& text );
void setLogPath( const std::string& logPath );
static void debug( const std::string& text );
static void fatal( const std::string& text );
static void trace( const std::string& text );
};

View file

@ -213,8 +213,35 @@ enum ActorControlType : uint16_t
// Housing
ShowHousingItemUI = 0x3F7,
ShowBuildPresetUI = 0x3E9,
/*!
* param1 = plot id
*/
ShowEstateExternalAppearanceUI = 0x3EA,
ShowEstateInternalAppearanceUI = 0x3EB,
BuildPresetResponse = 0x3ED,
/*!
* param1 = u16 landid
* u16 slotid
*/
RemoveExteriorHousingItem = 0x3EF,
/*!
* param1 = object array index
*/
RemoveInteriorHousingItem = 0x3F1,
/*!
* param1 = identity shit
* u16 1 - container id
* u16 2 - plot id
* param2 = item shit
* u16 1 - slot
*/
HousingItemMoveConfirm = 0x3F9,
OpenEstateSettingsUI = 0x3FF,
HideAdditionalChambersDoor = 0x400,
/*!
* param1 = outdoor furnishings
* u8 0 - relocation available, 1 = available
@ -306,6 +333,8 @@ enum ActorControlType : uint16_t
SetEstateLightingLevel = 0x40B, // param1 = light level 0 - 5 maps to UI val 5-0
RequestHousingBuildPreset = 0x44C,
RequestEstateExteriorRemodel = 0x044D, // param11 = land id
RequestEstateInteriorRemodel = 0x44E,
RequestEstateHallRemoval = 0x44F,
RequestBuildPreset = 0x450, // no idea what this is, it gets sent with BuildPresetHandler and has the plot id in param1
RequestLandSignFree = 0x451,
@ -313,15 +342,18 @@ enum ActorControlType : uint16_t
RequestWardLandInfo = 0x453,
RequestLandRelinquish = 0x454,
RequestLandInventory = 0x0458,
RequestHousingItemRemove = 0x0459,
RequestEstateRename = 0x45A,
RequestEstateEditGreeting = 0x45B,
RequestEstateGreeting = 0x45C, // sends FFXIVIpcHousingEstateGreeting in return
RequestEstateEditGuestAccessSettings = 0x45D,
UpdateEstateGuestAccess = 0x45E,
RequestEstateTagSettings = 0x45F,
RequestEstateInventory = 0x0461,
RequestHousingItemUI = 0x463,
RequestSharedEstateSettings = 0x46F,
UpdateEstateLightingLevel = 0x471,
HousingItemSelectedInUI = 0x47E,
CompanionAction = 0x6A4,
CompanionSetBarding = 0x6A5,

View file

@ -1,17 +1,19 @@
#include "Connection.h"
#include "Hive.h"
#include <functional>
#include "Framework.h"
namespace Sapphire {
namespace Network {
//-----------------------------------------------------------------------------
Connection::Connection( HivePtr hive ) :
Connection::Connection( HivePtr hive, FrameworkPtr pFw ) :
m_hive( hive ),
m_socket( hive->GetService() ),
m_io_strand( hive->GetService() ),
m_receive_buffer_size( 32000 ),
m_error_state( 0 )
m_error_state( 0 ),
m_pFw( pFw )
{
}

View file

@ -12,6 +12,12 @@
#include "Acceptor.h"
#include <memory>
namespace Sapphire
{
class Framework;
using FrameworkPtr = std::shared_ptr< Framework >;
}
namespace Sapphire::Network
{
@ -38,9 +44,9 @@ namespace Sapphire::Network
std::list< std::vector< uint8_t > > m_pending_sends;
int32_t m_receive_buffer_size;
std::atomic< uint32_t > m_error_state;
Sapphire::FrameworkPtr m_pFw;
Connection( HivePtr hive );
Connection( HivePtr hive, FrameworkPtr pFw );
virtual ~Connection();
@ -144,13 +150,13 @@ namespace Sapphire::Network
//-----------------------------------------------------------------------------
template< class T >
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive )
std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive, FrameworkPtr pFw )
{
try
{
AcceptorPtr acceptor( new Acceptor( pHive ) );
acceptor->Listen( listenIp, port );
std::shared_ptr< T > connection( new T( pHive, acceptor ) );
std::shared_ptr< T > connection( new T( pHive, acceptor, pFw ) );
acceptor->Accept( connection );
return connection;
}

View file

@ -169,7 +169,7 @@ namespace Sapphire::Network::Packets
// Set the values of static fields.
// The size must be the sum of the segment header and the content
m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize();
m_segHdr.size = static_cast< uint32_t >( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize() );
m_segHdr.type = getSegmentType();
}

View file

@ -24,7 +24,7 @@ void Sapphire::Network::Packets::PacketContainer::addPacket( Sapphire::Network::
{
m_entryList.push_back( entry );
m_ipcHdr.size += entry->getSize();
m_ipcHdr.size += static_cast< uint32_t >( entry->getSize() );
m_ipcHdr.count++;
}

View file

@ -176,7 +176,7 @@ namespace Sapphire::Network::Packets
DirectorVars = 0x01E1, // updated 4.4
CFAvailableContents = 0x01FD, // updated 4.2
CFAvailableContents = 0xF1FD, // updated 4.2
WeatherChange = 0x01FC, // updated 4.4
PlayerTitleList = 0x01FD, // updated 4.4
@ -201,9 +201,10 @@ namespace Sapphire::Network::Packets
HousingShowEstateGuestAccess = 0x022A, // updated 4.4
HousingObjectInitialize = 0x022C, // updated 4.4
HousingInternalObjectSpawn = 0x22D, // updated 4.4
HousingWardInfo = 0x022F, // updated 4.4
YardObjectMove = 0x0230, // updated 4.4
HousingObjectMove = 0x0230, // updated 4.4
SharedEstateSettingsResponse = 0x023C, // updated 4.4
@ -263,10 +264,10 @@ namespace Sapphire::Network::Packets
LinkshellListHandler = 0x00F4, // updated 4.3
MarketBoardRequestItemInformation = 0x00FE, // updated 4.4
MarketBoardRequestItemListingInfo = 0x00FE, // updated 4.4
MarketBoardRequestItemListings = 0x00FF, // updated 4.4
MarketBoardSearch = 0x0103, // updated 4.4
SearchMarketboard = 0x0103, // updated 4.3
ReqExamineFcInfo = 0x010F, // updated 4.1
FcInfoReqHandler = 0x011A, // updated 4.2
@ -294,6 +295,8 @@ namespace Sapphire::Network::Packets
InventoryModifyHandler = 0x0142, // updated 4.4
ReqPlaceHousingItem = 0x145, // updated 4.4
BuildPresetHandler = 0x014A, // updated 4.4
TalkEventHandler = 0x014B, // updated 4.4
EmoteEventHandler = 0x014C, // updated 4.4
@ -311,6 +314,7 @@ namespace Sapphire::Network::Packets
LandRenameHandler = 0x0171, // updated 4.4
HousingUpdateHouseGreeting = 0x0172, // updated 4.4
HousingUpdateObjectPosition = 0x0173, // updated 4.4
SetSharedEstateSettings = 0x0177, // updated 4.4

View file

@ -41,7 +41,8 @@ struct FFXIVIpcClientTrigger :
/* 0004 */ uint32_t param11;
/* 0008 */ uint32_t param12;
/* 000C */ uint32_t param2;
/* 0010 */ char unk_10[8];
/* 0010 */ uint32_t param4; // todo: really?
/* 0014 */ uint32_t param5;
/* 0018 */ uint64_t param3;
};
@ -236,8 +237,58 @@ struct FFXIVIpcSetSharedEstateSettings :
struct FFXIVIpcMarketBoardRequestItemListings :
FFXIVIpcBasePacket< MarketBoardRequestItemListings >
{
/* 0000 */ uint32_t itemCatalogId;
/* 0004 */ uint32_t padding;
/* 0000 */ uint16_t padding1;
/* 0002 */ uint16_t itemCatalogId;
/* 0004 */ uint32_t padding2;
};
struct FFXIVIpcReqPlaceHousingItem :
FFXIVIpcBasePacket< ReqPlaceHousingItem >
{
/* 0000 */ uint16_t landId; // 0 when plot 0 or inside an estate
/* 0002 */ uint16_t unknown1;
/* 0004 */ uint32_t unknown2;
/* 0008 */ uint16_t sourceInvContainerId;
/* 000A */ uint16_t sourceInvSlotId;
/* 000C */ Common::FFXIVARR_POSITION3 position;
/* 0018 */ float rotation;
/* 001C */ uint32_t shouldPlaceItem; // 1 if placing an item, 0 if placing in store
/* 0020 */ uint32_t unknown4[2]; // always 0 it looks like
};
struct FFXIVIpcHousingUpdateObjectPosition :
FFXIVIpcBasePacket< HousingUpdateObjectPosition >
{
/* 0000 */ Common::LandIdent ident;
/* 0008 */ uint16_t slot;
/* 000A */ uint16_t unk;
/* 000C */ Common::FFXIVARR_POSITION3 pos;
/* 0018 */ float rotation;
/* 001C */ uint32_t padding;
};
struct FFXIVIpcMarketBoardSearch :
FFXIVIpcBasePacket< MarketBoardSearch >
{
/* 0000 */ uint32_t startIdx;
/* 0004 */ uint16_t requestId;
/* 0006 */ uint8_t itemSearchCategory;
/* 0007 */ uint8_t shouldCheckClassJobId; // wat? seems only 1 there at least...
/* 0008 */ uint8_t maxEquipLevel;
/* 0009 */ uint8_t classJobId;
/* 000A */ char searchStr[40];
/* 0032 */ uint16_t unk4[43];
};
struct FFXIVIpcMarketBoardRequestItemListingInfo :
FFXIVIpcBasePacket< MarketBoardRequestItemListingInfo >
{
/* 0000 */ uint32_t catalogId;
/* 0000 */ uint32_t requestId;
};
}

View file

@ -1679,26 +1679,20 @@ struct FFXIVIpcLandSetInitialize : FFXIVIpcBasePacket< LandSetInitialize >
LandStruct land[ 30 ];
};
struct FFXIVIpcYardObjectSpawn : FFXIVIpcBasePacket<YardObjectSpawn>
struct FFXIVIpcYardObjectSpawn : FFXIVIpcBasePacket< YardObjectSpawn >
{
uint8_t landSetId;
uint8_t landId;
uint8_t objectArray;
uint16_t unknown1;
uint32_t itemId;
uint16_t itemRotation;
uint16_t pos_x;
uint16_t pos_y;
uint16_t pos_z;
Common::HousingObject object;
};
struct FFXIVIpcYardObjectMove : FFXIVIpcBasePacket<YardObjectMove>
struct FFXIVIpcHousingObjectMove : FFXIVIpcBasePacket< HousingObjectMove >
{
uint16_t itemRotation;
uint8_t objectArray;
uint8_t landSetId;
uint16_t pos_x;
uint16_t pos_y;
uint16_t pos_z;
uint8_t landId;
Common::FFXIVARR_POSITION3_U16 pos;
uint16_t unknown1;
uint16_t unknown2;
uint16_t unknown3;
@ -1707,14 +1701,31 @@ struct FFXIVIpcYardObjectMove : FFXIVIpcBasePacket<YardObjectMove>
struct FFXIVIpcHousingObjectInitialize : FFXIVIpcBasePacket< HousingObjectInitialize >
{
Common::LandIdent landIdent;
/*!
* when this is 2, actrl 0x400 will hide the additional quarters door
* if it's any other value, it will stay there regardless
*/
int8_t u1; //Outdoor -1 / Indoor 0 - probably indicator
uint8_t packetNum;
uint8_t packetTotal;
uint8_t u2; //Outdoor 0 / Indoor 100(?)
Common::YardObject object[100];
Common::HousingObject object[100];
uint32_t unknown4; //unused
};
struct FFXIVIpcHousingInternalObjectSpawn : FFXIVIpcBasePacket< HousingInternalObjectSpawn >
{
uint16_t containerId;
uint8_t containerOffset;
uint8_t pad1;
uint16_t itemId;
uint8_t unk2;
uint8_t pad2;
uint16_t rotation;
Common::FFXIVARR_POSITION3_U16 pos;
};
struct FFXIVIpcHousingIndoorInitialize : FFXIVIpcBasePacket< HousingIndoorInitialize >
{
uint16_t u1;
@ -1836,23 +1847,24 @@ struct FFXIVIpcMarketBoardSearchResult :
struct MarketBoardItem
{
uint32_t itemCatalogId;
uint32_t quantity;
uint16_t quantity;
uint16_t demand;
} items[20];
uint32_t itemIndexEnd;
uint32_t padding1;
uint32_t itemIndexStart;
uint32_t padding2;
uint32_t requestId;
};
struct FFFXIVIpcMarketBoardItemListingCount :
FFXIVIpcBasePacket< MarketBoardItemListingCount >
{
uint32_t itemCatalogId;
uint32_t unknown1; // does some shit if nonzero
uint16_t unknown2;
uint16_t quantity; // high/low u8s read separately?
uint32_t padding3;
uint32_t itemCatalogId;
uint32_t unknown1; // does some shit if nonzero
uint16_t requestId;
uint16_t quantity; // high/low u8s read separately?
uint32_t unknown3;
};
struct FFXIVIpcMarketBoardItemListingHistory :
@ -1864,14 +1876,14 @@ struct FFXIVIpcMarketBoardItemListingHistory :
struct MarketListing
{
uint32_t salePrice;
time_t purchaseTime;
uint32_t purchaseTime;
uint32_t quantity;
uint16_t unknown1;
uint8_t unknown2;
uint8_t isHq;
uint8_t padding;
uint8_t onMannequin;
char sellerName[32];
char buyerName[33];
uint8_t unknown3;
uint32_t itemCatalogId;
} listing[20];
};

View file

@ -7,21 +7,12 @@ file( GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*" )
add_executable( dbm ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES} )
set_target_properties( dbm PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
)
target_include_directories( dbm
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/"
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../" )
target_link_libraries( dbm PRIVATE mysqlConnector common xivdat )
if (UNIX)
target_link_libraries( dbm PRIVATE stdc++fs )

View file

@ -16,7 +16,7 @@ namespace filesys = std::experimental::filesystem;
#include "DbManager.h"
Sapphire::Logger g_log;
using namespace Sapphire;
std::vector< std::string > getAllFilesInDir( const std::string& dirPath,
const std::vector< std::string > dirSkipList = {} )
@ -77,20 +77,20 @@ std::string delChar( std::string &str, char del )
void printUsage()
{
g_log.info( " Usage: sapphire_dbm " );
g_log.info( "\t --mode" );
g_log.info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" );
g_log.info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" );
g_log.info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" );
g_log.info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" );
g_log.info( "\t\t liquidate -> Removes all tables and deletes the DB" );
g_log.info( "\t --user <mysqlUserName>" );
g_log.info( "\t --pass <mysqlPassword> ( default empty )" );
g_log.info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
g_log.info( "\t --port <mysqlPort> ( default 3306 )" );
g_log.info( "\t --database <mysqlDatabase>" );
g_log.info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
g_log.info( "\t --force ( skips user input / auto Yes )" );
Logger::info( " Usage: sapphire_dbm " );
Logger::info( "\t --mode" );
Logger::info( "\t\t initialize -> Creates DB if not present and inserts default tables/data" );
Logger::info( "\t\t check -> Checks if Sapphire DB-Version matches your DB-Version" );
Logger::info( "\t\t update -> Updates your DB-Version to Sapphire DB-Version" );
Logger::info( "\t\t clearchars -> Removes all character data from DB. Accounts will stay untouched" );
Logger::info( "\t\t liquidate -> Removes all tables and deletes the DB" );
Logger::info( "\t --user <mysqlUserName>" );
Logger::info( "\t --pass <mysqlPassword> ( default empty )" );
Logger::info( "\t --host <mysqlHost> ( default 127.0.0.1 )" );
Logger::info( "\t --port <mysqlPort> ( default 3306 )" );
Logger::info( "\t --database <mysqlDatabase>" );
Logger::info( "\t --sfile <path/to/schemafile> ( default sql/schema/schema.sql )" );
Logger::info( "\t --force ( skips user input / auto Yes )" );
}
int main( int32_t argc, char* argv[] )
@ -104,8 +104,7 @@ int main( int32_t argc, char* argv[] )
std::string database;
std::string pass;
g_log.setLogPath( "log/SapphireDbm" );
g_log.init();
Logger::init( "log/dbm" );
std::string sFile;
std::string iFile;
@ -181,23 +180,23 @@ int main( int32_t argc, char* argv[] )
}
else
{
g_log.fatal( "Not a valid mode: " + mode + " !" );
Logger::fatal( "Not a valid mode: " + mode + " !" );
return 1;
}
g_log.info( "Launching in " + mode + " mode..." );
Logger::info( "Launching in " + mode + " mode..." );
if( !dbm.connect() )
{
g_log.fatal( "Could not connect to server!" );
g_log.fatal( dbm.getLastError() );
Logger::fatal( "Could not connect to server!" );
Logger::fatal( dbm.getLastError() );
return 1;
}
if( !dbm.performAction() )
{
g_log.fatal( "Could not perform action!" );
g_log.fatal( dbm.getLastError() );
Logger::fatal( "Could not perform action!" );
Logger::fatal( dbm.getLastError() );
return 1;
}

View file

@ -8,26 +8,7 @@ file( GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*" )
add_executable( lobby ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES} )
set_target_properties( lobby
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
)
target_link_libraries( lobby
PRIVATE
common
mysql )
if( UNIX )
target_link_libraries( lobby
PRIVATE
stdc++fs )
endif()
common )
#cotire( lobby )

View file

@ -24,9 +24,11 @@ using namespace Sapphire::Network::Packets;
using namespace Sapphire::Network::Packets::Server;
Sapphire::Network::GameConnection::GameConnection( Sapphire::Network::HivePtr pHive,
Sapphire::Network::AcceptorPtr pAcceptor )
:
Connection( pHive ), m_pAcceptor( pAcceptor ), m_bEncryptionInitialized( false )
Sapphire::Network::AcceptorPtr pAcceptor,
FrameworkPtr pFw ) :
Connection( pHive, pFw ),
m_pAcceptor( pAcceptor ),
m_bEncryptionInitialized( false )
{
}
@ -39,7 +41,7 @@ Sapphire::Network::GameConnection::~GameConnection()
// overwrite the parents onConnect for our game socket needs
void Sapphire::Network::GameConnection::OnAccept( const std::string& host, uint16_t port )
{
auto connection = make_GameConnection( m_hive, m_pAcceptor );
auto connection = make_GameConnection( m_hive, m_pAcceptor, m_pFw );
m_pAcceptor->Accept( connection );
g_log.info( "Connect from " + m_socket.remote_endpoint().address().to_string() );
@ -186,7 +188,7 @@ void Sapphire::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet
if( i == 3 )
{
charListPacket->data().entitledExpansion = 2;
charListPacket->data().maxCharOnWorld = 8;
charListPacket->data().maxCharOnWorld = 25;
charListPacket->data().unknown8 = 8;
charListPacket->data().veteranRank = 12;
charListPacket->data().counter = ( i * 4 ) + 1;
@ -473,7 +475,7 @@ void Sapphire::Network::GameConnection::generateEncryptionKey( uint32_t key, con
}
void Sapphire::Network::GameConnection::handlePackets( const Sapphire::Network::Packets::FFXIVARR_PACKET_HEADER& ipcHeader,
const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
const std::vector< Sapphire::Network::Packets::FFXIVARR_PACKET_RAW >& packetData )
{
for( auto inPacket : packetData )

View file

@ -40,7 +40,7 @@ namespace Sapphire::Network
LockedQueue< Packets::GamePacketPtr > m_outQueue;
public:
GameConnection( HivePtr pHive, AcceptorPtr pAcceptor );
GameConnection( HivePtr pHive, AcceptorPtr pAcceptor, FrameworkPtr pFw );
~GameConnection();

View file

@ -10,7 +10,7 @@
#include <Logging/Logger.h>
#include <Config/ConfigMgr.h>
//#include "LobbySession.h"
#include "Framework.h"
#include "ServerLobby.h"
@ -21,124 +21,122 @@
#include <thread>
Sapphire::Logger g_log;
Sapphire::Network::RestConnector g_restConnector;
namespace Sapphire {
ServerLobby::ServerLobby( const std::string& configPath ) :
m_configPath( configPath ),
m_numConnections( 0 )
namespace Sapphire
{
m_pConfig = std::shared_ptr< ConfigMgr >( new ConfigMgr );
}
ServerLobby::~ServerLobby( void )
{
}
LobbySessionPtr ServerLobby::getSession( char* sessionId )
{
return g_restConnector.getSession( sessionId );
}
ConfigMgrPtr ServerLobby::getConfig() const
{
return m_pConfig;
}
void ServerLobby::run( int32_t argc, char* argv[] )
{
g_log.setLogPath( "log/SapphireLobby" );
g_log.init();
g_log.info( "===========================================================" );
g_log.info( "Sapphire Server Project " );
g_log.info( "Version: " + Version::VERSION );
g_log.info( "Git Hash: " + Version::GIT_HASH );
g_log.info( "Compiled: " __DATE__ " " __TIME__ );
g_log.info( "===========================================================" );
if( !loadSettings( argc, argv ) )
ServerLobby::ServerLobby( const std::string& configPath ) :
m_configPath( configPath ),
m_numConnections( 0 )
{
g_log.fatal( "Error loading settings! " );
return;
m_pConfig = std::make_shared< ConfigMgr >();
}
Network::HivePtr hive( new Network::Hive() );
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
ServerLobby::~ServerLobby( void ) = default;
g_log.info(
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
std::vector< std::thread > threadGroup;
threadGroup.emplace_back( std::bind( &Network::Hive::Run, hive.get() ) );
for( auto& thread : threadGroup )
if( thread.joinable() )
thread.join();
}
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
{
g_log.info( "Loading config " + m_configPath );
if( !m_pConfig->loadConfig( m_configPath ) )
LobbySessionPtr ServerLobby::getSession( char* sessionId )
{
g_log.fatal( "Error loading config " + m_configPath );
g_log.fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
return false;
return g_restConnector.getSession( sessionId );
}
std::vector< std::string > args( argv + 1, argv + argc );
for( size_t i = 0; i + 1 < args.size(); i += 2 )
{
std::string arg( "" );
std::string val( "" );
try
ConfigMgrPtr ServerLobby::getConfig() const
{
return m_pConfig;
}
void ServerLobby::run( int32_t argc, char* argv[] )
{
Logger::init( "log/lobby" );
Logger::info( "===========================================================" );
Logger::info( "Sapphire Server Project " );
Logger::info( "Version: " + Version::VERSION );
Logger::info( "Git Hash: " + Version::GIT_HASH );
Logger::info( "Compiled: " __DATE__ " " __TIME__ );
Logger::info( "===========================================================" );
if( !loadSettings( argc, argv ) )
{
std::transform( arg.begin(), arg.end(), arg.begin(), [](unsigned char c){ return std::tolower( c ); } );
val = std::string( args[ i + 1 ] );
Logger::fatal( "Error loading settings! " );
return;
}
// trim '-' from start of arg
arg = arg.erase( 0, arg.find_first_not_of( '-' ) );
auto pFw = std::make_shared< Framework >();
Network::HivePtr hive( new Network::Hive() );
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive, pFw );
if( arg == "ip" )
Logger::info(
"Lobby server running on " + m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" ) + ":" +
m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenPort", "80" ) );
std::vector< std::thread > threadGroup;
threadGroup.emplace_back( std::bind( &Network::Hive::Run, hive.get() ) );
for( auto& thread : threadGroup )
if( thread.joinable() )
thread.join();
}
bool ServerLobby::loadSettings( int32_t argc, char* argv[] )
{
Logger::info( "Loading config " + m_configPath );
if( !m_pConfig->loadConfig( m_configPath ) )
{
Logger::fatal( "Error loading config " + m_configPath );
Logger::fatal( "If this is the first time starting the server, we've copied the default one for your editing pleasure." );
return false;
}
std::vector< std::string > args( argv + 1, argv + argc );
for( size_t i = 0; i + 1 < args.size(); i += 2 )
{
std::string arg( "" );
std::string val( "" );
try
{
// todo: ip addr in config
m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val );
std::transform( arg.begin(), arg.end(), arg.begin(), [](unsigned char c){ return std::tolower( c ); } );
val = std::string( args[ i + 1 ] );
// trim '-' from start of arg
arg = arg.erase( 0, arg.find_first_not_of( '-' ) );
if( arg == "ip" )
{
// todo: ip addr in config
m_pConfig->setValue< std::string >( "LobbyNetwork.ListenIp", val );
}
else if( arg == "p" || arg == "port" )
{
m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val );
}
else if( arg == "worldip" || arg == "worldip" )
{
m_pConfig->setValue< std::string >( "GlobalNetwork.ZoneHost", val );
}
else if( arg == "worldport" )
{
m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
}
}
else if( arg == "p" || arg == "port" )
catch( ... )
{
m_pConfig->setValue< std::string >( "LobbyNetwork.LobbyPort", val );
}
else if( arg == "worldip" || arg == "worldip" )
{
m_pConfig->setValue< std::string >( "GlobalNetwork.ZoneHost", val );
}
else if( arg == "worldport" )
{
m_pConfig->setValue< std::string >( "GlobalNetwork.ZonePort", val );
Logger::error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
Logger::error( "Usage: <arg> <val> \n" );
}
}
catch( ... )
{
g_log.error( "Error parsing argument: " + arg + " " + "value: " + val + "\n" );
g_log.error( "Usage: <arg> <val> \n" );
}
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork", "ListenPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" );
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;
}
m_port = m_pConfig->getValue< uint16_t >( "LobbyNetwork", "ListenPort", 54994 );
m_ip = m_pConfig->getValue< std::string >( "LobbyNetwork", "ListenIp", "0.0.0.0" );
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;
}
}

View file

@ -3,14 +3,13 @@ project(Script)
file(GLOB SCRIPT_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
message("exec: ${EXECUTABLE_OUTPUT_DIRECTORY}")
message("exec: ${EXECUTABLE_OUTPUT_PATH}")
set(SCRIPT_LIB_DIR "${EXECUTABLE_OUTPUT_DIRECTORY}/compiledscripts/" )
set(SCRIPT_LIB_DIR "${EXECUTABLE_OUTPUT_PATH}/compiledscripts/" )
set(EXECUTABLE_OUTPUT_PATH "${SCRIPT_LIB_DIR}")
set(LIBRARY_OUTPUT_PATH "${SCRIPT_LIB_DIR}")
set(RUNTIME_OUTPUT_DIRECTORY "${SCRIPT_LIB_DIR}")
file(GLOB children "${CMAKE_CURRENT_SOURCE_DIR}/*" )
foreach(_scriptDir ${children})
get_filename_component(_name "${_scriptDir}" NAME_WE)
@ -40,9 +39,6 @@ foreach(_scriptDir ${children})
if(MSVC)
set_target_properties( "script_${_name}" PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${SCRIPT_LIB_DIR}"
LIBRARY_OUTPUT_DIRECTORY_RELEASE "${SCRIPT_LIB_DIR}"
LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${SCRIPT_LIB_DIR}"

View file

@ -4,6 +4,7 @@
#include "Actor/EventObject.h"
#include "Territory/HousingZone.h"
#include "Manager/TerritoryMgr.h"
#include "Territory/Land.h"
#include "Framework.h"
using namespace Sapphire;
@ -19,8 +20,6 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, Entity::EventObject& eobj ) override
{
player.sendDebug( "Found plot entrance for plot: " + std::to_string( eobj.getHousingLink() >> 8 ) );
player.playScene( eventId, 0, 0, [this, eobj]( Entity::Player& player, const Event::SceneResult& result )
{
// param2 == 1 when player wants to enter house
@ -42,15 +41,45 @@ public:
ident.worldId = 67;
auto internalZone = terriMgr->findOrCreateHousingInterior( ident );
if( internalZone )
if( !internalZone )
{
player.sendDebug( "created zone with guid: " + std::to_string( internalZone->getGuId() ) + "\nname: " + internalZone->getName() );
// an error occurred during event movement
// lol
player.sendLogMessage( 1311 );
player.eventFinish( result.eventId, 1 );
return;
}
player.eventFinish( result.eventId, 1 );
player.setPos( { 0.f, 0.f, 0.f } );
player.setInstance( internalZone );
Common::FFXIVARR_POSITION3 pos {};
auto land = zone->getLand( eobj.getHousingLink() >> 8 );
if( !land )
return;
switch( land->getSize() )
{
case 0:
{
pos = { 0.1321167f, 0.f, 2.746273f };
break;
}
case 1:
{
pos = { 1.337722f, 0.f, 3.995964f };
break;
}
case 2:
{
pos = { 0.07214607f, 0.f, 8.217761f };
break;
}
default:
return;
}
player.setInstance( internalZone, pos );
} );
}
};

View file

@ -1,7 +1,8 @@
#include <Actor/Player.h>
#include <ScriptObject.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include "Event/EventHandler.h"
#include "Framework.h"
// Quest Script: ManFst001_00039
// Quest Name: Coming to Gridania
@ -95,7 +96,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
Scene00000( player );

View file

@ -1,7 +1,8 @@
#include <Actor/Player.h>
#include <ScriptObject.h>
#include "Event/EventHandler.h"
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include "Framework.h"
// Quest Script: ManFst002_00124
// Quest Name: Close to Home
@ -192,7 +193,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
Scene00000( player );

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManFst003_00123
// Quest Name: Close to Home
@ -81,7 +82,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManFst004_00124
// Quest Name: Close to Home
@ -81,7 +82,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ManFst004::Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManSea001_00107
// Quest Name: Coming to Limsa Lominsa
@ -141,7 +142,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
Scene00000( player );

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManSea002_00108
// Quest Name: Close to Home
@ -47,7 +48,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManSea003_00109
// Quest Name: Close to Home
@ -63,7 +64,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManWil001_00594
// Quest Name: Coming to Ul'dah
@ -173,7 +174,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
// Quest Script: ManWil002_00568
// Quest Name: Close to Home
@ -69,7 +70,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -13,6 +13,7 @@
#include "subquest/gridania/SubFst002.cpp"
#include "subquest/gridania/SubFst003.cpp"
#include "subquest/gridania/SubFst004.cpp"
#include "subquest/gridania/SubFst005.cpp"
#include "subquest/gridania/SubFst008.cpp"
#include "subquest/gridania/SubFst009.cpp"
#include "subquest/gridania/SubFst010.cpp"
@ -25,6 +26,7 @@
#include "subquest/gridania/SubFst029.cpp"
#include "subquest/gridania/SubFst030.cpp"
#include "subquest/gridania/SubFst041.cpp"
#include "subquest/gridania/SubFst045.cpp"
#include "subquest/limsa/SubSea001.cpp"
#include "subquest/uldah/SubWil000.cpp"
#include "subquest/uldah/SubWil001.cpp"
@ -55,6 +57,7 @@ const Sapphire::ScriptAPI::ScriptObject* ptrs[] =
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst002 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst003 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst004 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst005 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst008 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst009 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst010 ),
@ -67,6 +70,7 @@ const Sapphire::ScriptAPI::ScriptObject* ptrs[] =
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst029 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst030 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst041 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubFst045 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubSea001 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubWil000 ),
static_cast< Sapphire::ScriptAPI::ScriptObject* >( new SubWil001 ),

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -72,7 +73,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -58,7 +59,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 && !player.hasQuest( getId() ) )
Scene00000( player );

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -51,7 +52,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -55,7 +56,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -0,0 +1,88 @@
#include <Actor/Player.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
// Quest Script: SubFst005_00028
// Quest Name: To the Bannock
// Quest ID: 65564
// Start NPC: 1000100
// End NPC: 1000421
class SubFst005 :
public Sapphire::ScriptAPI::EventScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestUI8AL
enum Sequence :
uint8_t
{
Seq0 = 0,
SeqFinish = 255,
};
// Quest rewards
static constexpr auto RewardExpFactor = 200;
static constexpr auto RewardGil = 127;
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1000100;
static constexpr auto Actor1 = 1000421;
static constexpr auto Seq0Actor0 = 0;
static constexpr auto Seq1Actor1 = 1;
public:
SubFst005() :
Sapphire::ScriptAPI::EventScript( 65564 )
{
};
~SubFst005()
{
};
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
if ( actor == Actor0 )
{
Scene00000( player );
}
else if ( actor == Actor1 )
{
Scene00001( player );
}
}
private:
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if ( result.param2 == 1 )
player.updateQuest( getId(), SeqFinish );
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if ( result.param2 == 1 )
{
if ( player.giveQuestRewards( getId(), 0 ) )
player.finishQuest( getId() );
}
} );
}
};

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -55,7 +56,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -51,7 +52,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -54,7 +55,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR0 )
Scene00000( player );

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -48,7 +49,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,6 +1,7 @@
#include <ScriptObject.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include "Framework.h"
using namespace Sapphire;
@ -160,7 +161,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( !player.hasQuest( getId() ) )
{
@ -180,7 +182,8 @@ public:
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == ACTOR1 && emoteId == 5 && player.getQuestSeq( getId() ) == SEQ_1 )
Scene00100( player );

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -55,7 +56,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -53,7 +54,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -48,7 +49,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -50,7 +51,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -46,7 +47,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == SubFst029::Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,7 +1,8 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -64,7 +65,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -56,7 +57,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -0,0 +1,90 @@
#include <Actor/Player.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
// Quest Script: SubFst045_00201
// Quest Name: Passing Muster
// Quest ID: 65737
// Start NPC: 1000421
// End NPC: 1000421
class SubFst045 :
public Sapphire::ScriptAPI::EventScript
{
private:
// Basic quest information
// Quest vars / flags used
// GetQuestUI8AL
enum Sequence :
uint8_t
{
Seq0 = 0,
SeqFinish = 255,
};
// Quest rewards
static constexpr auto RewardExpFactor = 200;
static constexpr auto RewardGil = 128;
// Entities found in the script data of the quest
static constexpr auto Actor0 = 1000421;
static constexpr auto Seq0Actor0 = 0;
static constexpr auto Seq1Actor0 = 1;
public:
SubFst045() :
Sapphire::ScriptAPI::EventScript( 65737 )
{
};
~SubFst045()
{
};
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast<uint32_t>( actorId ) );
if ( actor == Actor0 )
{
if ( !player.hasQuest( getId() ) )
{
Scene00000( player );
}
else
{
Scene00001( player );
}
}
}
private:
void Scene00000( Entity::Player& player )
{
player.playScene( getId(), 0, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if ( result.param2 == 1 )
player.updateQuest( getId(), SeqFinish );
} );
}
void Scene00001( Entity::Player& player )
{
player.playScene( getId(), 1, 0,
[&]( Entity::Player& player, const Event::SceneResult& result )
{
if ( result.param2 == 1 )
{
if ( player.giveQuestRewards( getId(), 0 ) )
player.finishQuest( getId() );
}
} );
}
};

View file

@ -1,7 +1,8 @@
#include <Script/NativeScriptApi.h>
#include <Actor/Player.h>
#include "Event/EventHelper.h"
#include "Manager/EventMgr.h"
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -64,7 +65,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -47,7 +48,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -48,7 +49,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -52,7 +53,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -57,7 +58,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -50,7 +51,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,7 +1,8 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include <ctime>
#include "Framework.h"
using namespace Sapphire;
@ -54,7 +55,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{
@ -88,7 +90,8 @@ public:
void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && emoteId == 41 && player.getQuestSeq( getId() ) == Seq1 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -54,7 +55,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 && !player.hasQuest( getId() ) )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -47,7 +48,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -51,7 +52,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -51,7 +52,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -45,7 +46,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -47,7 +48,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -1,6 +1,7 @@
#include <Actor/Player.h>
#include <Event/EventHelper.h>
#include <Manager/EventMgr.h>
#include <ScriptObject.h>
#include "Framework.h"
using namespace Sapphire;
@ -50,7 +51,8 @@ public:
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
{
auto actor = Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
auto pEventMgr = m_framework->get< World::Manager::EventMgr >();
auto actor = pEventMgr->mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
if( actor == Actor0 )
{

View file

@ -17,9 +17,6 @@ file(GLOB SERVER_SOURCE_FILES
add_executable(discovery_parser ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(discovery_parser PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -14,9 +14,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(event_object_parser ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(event_object_parser PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -11,9 +11,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(exd_common_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_common_gen PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -16,10 +16,9 @@
#include <fstream>
Sapphire::Logger g_log;
Sapphire::Data::ExdDataGenerated g_exdData;
using namespace Sapphire;
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
const std::string datLocation(
@ -91,13 +90,13 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s
int main()
{
g_log.init();
Logger::init( "commongen" );
g_log.info( "Setting up EXD data" );
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
{
g_log.fatal( "Error setting up EXD data " );
Logger::fatal( "Error setting up EXD data " );
return 1;
}
@ -130,6 +129,6 @@ int main()
result += generateEnum( "HousingAppeal", 0, "uint8_t" );
result += "}\n";
result += "}\n#endif\n";
g_log.info( result );
Logger::info( result );
return 0;
}

View file

@ -14,9 +14,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(exd_struct_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_struct_gen PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -19,9 +19,8 @@
#include <regex>
#include <algorithm>
using namespace Sapphire;
Sapphire::Logger g_log;
Sapphire::Data::ExdDataGenerated g_exdData;
bool skipUnmapped = true;
@ -324,10 +323,10 @@ std::string generateConstructorsDecl( const std::string& exd )
int main( int argc, char** argv )
{
g_log.init();
Logger::init( "struct_gen" );
if( argc > 1 )
{
g_log.info( "using dat path: " + std::string( argv[ 1 ] ) );
Logger::info( "using dat path: " + std::string( argv[ 1 ] ) );
datLocation = std::string( argv[ 1 ] );
}
@ -357,14 +356,14 @@ int main( int argc, char** argv )
auto json = nlohmann::json();
exJson >> json;
g_log.info( "Setting up EXD data" );
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
{
g_log.fatal( "Error setting up EXD data " );
Logger::fatal( "Error setting up EXD data " );
return 0;
}
g_log.info( "Generating structs, this may take several minutes..." );
g_log.info( "Go grab a coffee..." );
Logger::info( "Generating structs, this may take several minutes..." );
Logger::info( "Go grab a coffee..." );
std::string structDefs;
std::string idListsDecl;

View file

@ -12,9 +12,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(exd_struct_test ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_struct_test PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -16,10 +16,9 @@
#include <streambuf>
#include <regex>
Sapphire::Logger g_log;
Sapphire::Data::ExdDataGenerated g_exdData;
using namespace Sapphire;
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
@ -28,30 +27,30 @@ const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Rebo
int main()
{
g_log.init();
Logger::init( "struct_test" );
g_log.info( "Setting up EXD data" );
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
{
g_log.fatal( "Error setting up EXD data " );
Logger::fatal( "Error setting up EXD data " );
return 0;
}
//g_log.info( "getting id list " );
//Logger::info( "getting id list " );
//auto idList = g_exdData.getGilShopIdList();
//g_log.info( "getting id list done" );
//Logger::info( "getting id list done" );
//for( auto id : idList )
{
auto teri1 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 0 );
g_log.info( "0 -> " + std::to_string( teri1->item ) );
Logger::info( "0 -> " + std::to_string( teri1->item ) );
auto teri2 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 1 );
g_log.info( "1 -> " + std::to_string( teri2->item ) );
Logger::info( "1 -> " + std::to_string( teri2->item ) );
auto teri3 = g_exdData.get< Sapphire::Data::GilShopItem >( 262440, 2 );
g_log.info( "2 -> " + std::to_string( teri3->item ) );
Logger::info( "2 -> " + std::to_string( teri3->item ) );
}
return 0;

View file

@ -12,9 +12,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(mob_parse ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(mob_parse PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -22,9 +22,10 @@ namespace filesys = std::experimental::filesystem;
#include <regex>
#include <map>
Sapphire::Logger g_log;
Sapphire::Data::ExdDataGenerated g_exdData;
using namespace Sapphire;
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
const std::string datLocation( "C:\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack" );
@ -194,12 +195,12 @@ std::string delChar( std::string &str, char del )
int dumpSpawns()
{
g_log.init();
Logger::init( "mob_parse" );
g_log.info( "Setting up EXD data" );
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
{
g_log.fatal( "Error setting up EXD data " );
Logger::fatal( "Error setting up EXD data " );
return 0;
}
@ -223,7 +224,7 @@ int dumpSpawns()
auto str = file.substr( 0, pos );
pos = str.find_last_of( filesys::path::preferred_separator );
auto zone = str.substr( pos + 1 );
//g_log.info( zone );
//Logger::info( zone );
FFXIVIpcNpcSpawn packet;
std::ifstream is;
@ -249,7 +250,7 @@ int dumpSpawns()
}
//std::ofstream out("output.txt");
std::ofstream out("output_1.txt");
int spawngroups = 0;
for( auto entry : zoneToPacketList )
@ -258,15 +259,15 @@ int dumpSpawns()
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
g_log.info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
g_log.info( "Mob Count: " + std::to_string( entry.second.size() ) );
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
for( auto mob : entry.second )
{
nameToPacketList[ mob.bNPCBase ].push_back( mob );
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mob.bNPCName );
//g_log.info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
}
std::map< std::string, std::vector< FFXIVIpcNpcSpawn > > lvlToPacket;
@ -282,7 +283,24 @@ int dumpSpawns()
for( auto mobName : lvlToPacket )
{
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
g_log.info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
Logger::info( "|-> " + std::to_string( entry.first ) );
std::string name1 = delChar( nameStruct->singular, ' ' );
name1 = delChar( name1, '\'' );
std::string templateName = name1 + "_" + std::to_string( mobName.second.at(0).bNPCBase );
std::string output = "INSERT IGNORE INTO `spawngroup` ( `territoryTypeId`, `bNpcTemplateId`, `level`, `maxHp` ) "
" VALUES ( " + std::to_string( entry.first ) +
", ( SELECT id FROM bnpctemplate WHERE name = '" + templateName + "' ) , " +
std::to_string( mobName.second.at(0).level ) + ", " +
std::to_string( mobName.second.at(0).hPMax ) + " );";
output += "\nSET @last_id_spawngroup = LAST_INSERT_ID(); ";
spawngroups++;
for( FFXIVIpcNpcSpawn instance : mobName.second )
@ -297,7 +315,6 @@ int dumpSpawns()
modelStr += "]";
std::string cusStr = "[";
for( auto cusEntry : instance.look )
@ -314,16 +331,25 @@ int dumpSpawns()
std::string name = delChar( nameStruct->singular, ' ' );
name = delChar( name, '\'' );
g_log.info( "|----> " + name + "_" + std::to_string( instance.bNPCBase ) + " " +
std::to_string( instance.posX ) + ", " +
std::to_string( instance.posY ) + ", " +
std::to_string( instance.posZ ) + ", " +
std::to_string( instance.modelChara ) + ", " +
std::to_string( instance.gimmickId ) + ", " +
std::to_string( instance.level ) + ", " +
std::to_string( instance.hPMax ) );
//g_log.info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
Logger::info( "|----> " + name + "_" +
std::to_string( instance.bNPCBase ) + " " +
std::to_string( instance.posX ) + ", " +
std::to_string( instance.posY ) + ", " +
std::to_string( instance.posZ ) + ", " +
std::to_string( instance.modelChara ) + ", " +
std::to_string( instance.gimmickId ) + ", " +
std::to_string( instance.level ) + ", " +
std::to_string( instance.hPMax ) );
//Logger::info( "|----> " + name + " - " + std::to_string( instance.bNPCBase ) + ", " + std::to_string( instance.gimmickId ) );
output += "INSERT INTO `spawnpoint` ( `spawngroupid`, `x`, `y`, `z`, `r` ) "
" VALUES ( @last_id_spawngroup, " +
std::to_string( instance.posX ) + ", " +
std::to_string( instance.posY ) + ", " +
std::to_string( instance.posZ ) + ", " +
std::to_string( 0 ) + " ); ";
//Logger::info( output );
/*std::string output = "INSERT IGNORE INTO `bnpctemplate` ( `Name`, `bNPCBaseId`, `bNPCNameId`, `mainWeaponModel`, `secWeaponModel`, `aggressionMode`, `enemyType`, `pose`, `modelChara`, `displayFlags`, `Look`, `Models`) "
@ -340,18 +366,19 @@ int dumpSpawns()
+ "UNHEX( '" + cusStr + "'), "
+ "UNHEX( '" + modelStr + "') );\n";*/
//g_log.info( output );
//Logger::info( output );
//out << output;
}
out << output;
}
nameToPacketList.clear();
}
g_log.info( "|--> Total SpawnGroups: " + std::to_string( spawngroups ) );
Logger::info( "|--> Total SpawnGroups: " + std::to_string( spawngroups ) );
return 0;
}
@ -360,12 +387,12 @@ int dumpSpawns()
int dumpTemplates()
{
g_log.init();
Logger::init( "mob_parse" );
g_log.info( "Setting up EXD data" );
Logger::info( "Setting up EXD data" );
if( !g_exdData.init( datLocation ) )
{
g_log.fatal( "Error setting up EXD data " );
Logger::fatal( "Error setting up EXD data " );
return 0;
}
@ -389,7 +416,7 @@ int dumpTemplates()
auto str = file.substr( 0, pos );
pos = str.find_last_of( filesys::path::preferred_separator );
auto zone = str.substr( pos + 1 );
//g_log.info( zone );
//Logger::info( zone );
FFXIVIpcNpcSpawn packet;
std::ifstream is;
@ -419,7 +446,7 @@ int dumpTemplates()
{
auto zoneIdStr = file.substr( pos + 1 );
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( std::stoi( zoneIdStr ) );
g_log.info( zoneIdStr + " - " + teri1->name );
Logger::info( zoneIdStr + " - " + teri1->name );
}
}
else
@ -434,7 +461,7 @@ int dumpTemplates()
nameToPacketList[ packet.bNPCName ].push_back( packet );
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( packet.bNPCName );
//g_log.info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
}
*/
@ -448,23 +475,23 @@ int dumpTemplates()
//auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( entry.first );
auto teri1 = g_exdData.get< Sapphire::Data::TerritoryType >( entry.first );
auto teriPlaceName = g_exdData.get< Sapphire::Data::PlaceName >( teri1->placeName );
g_log.info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
g_log.info( "Mob Count: " + std::to_string( entry.second.size() ) );
Logger::info( std::to_string( entry.first ) + " - " + teri1->name + " - " + teriPlaceName->name );
Logger::info( "Mob Count: " + std::to_string( entry.second.size() ) );
for( auto mob : entry.second )
{
nameToPacketList[ mob.bNPCBase ].push_back( mob );
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mob.bNPCName );
//g_log.info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
//Logger::info( nameStruct->singular + " " + std::to_string( packet.bNPCBase ) );
}
g_log.info( "Unique Mobs: " + std::to_string( nameToPacketList.size() ) );
Logger::info( "Unique Mobs: " + std::to_string( nameToPacketList.size() ) );
for( auto mobName : nameToPacketList )
{
auto nameStruct = g_exdData.get< Sapphire::Data::BNpcName >( mobName.second.at(0).bNPCName );
g_log.info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
Logger::info( "|--> " + nameStruct->singular + "(" + std::to_string( mobName.second.size() ) + ")" );
auto instance = mobName.second.at(0);
//for( FFXIVIpcNpcSpawn instance : mobName.second )
@ -494,8 +521,8 @@ int dumpTemplates()
cusStr = binaryToHexString( (uint8_t*)instance.look, 26 );
//g_log.info( "|----> " + std::to_string( instance.bNPCBase ) + " " + std::to_string( instance.posX ) + ", " + std::to_string( instance.posY ) + ", " + std::to_string( instance.posZ ) );
// g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
//Logger::info( "|----> " + std::to_string( instance.bNPCBase ) + " " + std::to_string( instance.posX ) + ", " + std::to_string( instance.posY ) + ", " + std::to_string( instance.posZ ) );
// Logger::info( "|----> " + std::to_string( instance.bNPCBase ) +
// " " + std::to_string( instance.mainWeaponModel ) +
// ", " + std::to_string( instance.secWeaponModel ) +
// ", " + std::to_string( instance.aggressionMode ) +
@ -522,11 +549,11 @@ int dumpTemplates()
+ "UNHEX( '" + cusStr + "'), "
+ "UNHEX( '" + modelStr + "') );\n";
g_log.info( output );
Logger::info( output );
out << output;
/* g_log.info( "|----> " + std::to_string( instance.bNPCBase ) +
/* Logger::info( "|----> " + std::to_string( instance.bNPCBase ) +
" " + std::to_string( instance.u2ab ) +
", " + std::to_string( instance.u2b ) +
", " + std::to_string( instance.u3b ) +
@ -554,15 +581,15 @@ int dumpTemplates()
}
out.close();
/*g_log.info( "getting id list " );
/*Logger::info( "getting id list " );
auto idList = g_exdData.getTerritoryTypeIdList();
g_log.info( "getting id list done" );
Logger::info( "getting id list done" );
for( auto id : idList )
{
auto teri1 = g_exdData.get<Sapphire::Data::TerritoryType>( id );
g_log.info( teri1->name );
Logger::info( teri1->name );
}*/
return 0;
@ -571,7 +598,8 @@ int dumpTemplates()
int main()
{
dumpTemplates();
//dumpTemplates();
dumpSpawns();
return 0;
}

View file

@ -12,9 +12,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(pcb_reader2 ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(pcb_reader2 PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -20,9 +20,6 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(quest_parse ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(quest_parse PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -20,10 +20,9 @@
#include <algorithm>
Sapphire::Logger g_log;
Sapphire::Data::ExdDataGenerated g_exdDataGen;
namespace fs = std::experimental::filesystem;
using namespace Sapphire;
const std::string onTalkStr(
" void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n"
@ -328,7 +327,7 @@ createScript( std::shared_ptr< Sapphire::Data::Quest >& pQuestData, std::set< st
int main( int argc, char** argv )
{
g_log.init();
Logger::init( "quest_parser" );
bool unluac = false;
// std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
@ -341,11 +340,11 @@ int main( int argc, char** argv )
unluac = true;
g_log.info( "Setting up generated EXD data" );
Logger::info( "Setting up generated EXD data" );
if( !g_exdDataGen.init( datLocation ) )
{
std::cout << datLocation << "\n";
g_log.fatal( "Error setting up EXD data " );
Logger::fatal( "Error setting up EXD data " );
std::cout << "Usage: quest_parser \"path/to/ffxiv/game/sqpack\" <1/0 unluac export toggle>\n";
return 0;
}
@ -357,13 +356,13 @@ int main( int argc, char** argv )
if( !fs::exists( "./generated" ) )
fs::create_directory( "./generated" );
g_log.info( "Export in progress" );
Logger::info( "Export in progress" );
uint32_t updateInterval = rows.size() / 20;
uint32_t i = 0;
for( const auto& row : rows )
{
g_log.info( "Generating " + std::to_string( row ) );
Logger::info( "Generating " + std::to_string( row ) );
auto questInfo = g_exdDataGen.get< Sapphire::Data::Quest >( row );
if( questInfo->name.empty() || questInfo->id.empty() )
@ -408,7 +407,7 @@ int main( int argc, char** argv )
"generated/" + questInfo->id + ".lua";
if( system( command.c_str() ) == -1 )
{
g_log.error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) );
Logger::error( "Error executing java command:\n" + command + "\nerrno: " + std::strerror( errno ) );
return errno;
}
}

View file

@ -62,6 +62,8 @@ namespace Sapphire::Action
bool m_bInterrupt;
FrameworkPtr m_pFw;
};
}

View file

@ -22,16 +22,16 @@ using namespace Sapphire::Network::Packets;
using namespace Sapphire::Network::Packets::Server;
using namespace Sapphire::Network::ActorControl;
extern Sapphire::Framework g_fw;
Sapphire::Action::ActionCast::ActionCast()
{
m_handleActionType = Common::HandleActionType::Event;
}
Sapphire::Action::ActionCast::ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId )
Sapphire::Action::ActionCast::ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget,
uint16_t actionId, FrameworkPtr pFw )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
m_pFw = pFw;
auto pExdData = m_pFw->get< Data::ExdDataGenerated >();
m_startTime = 0;
m_id = actionId;
m_handleActionType = HandleActionType::Spell;
@ -70,7 +70,7 @@ void Sapphire::Action::ActionCast::onFinish()
if( !m_pSource )
return;
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >();
auto pPlayer = m_pSource->getAsPlayer();
pPlayer->sendDebug( "onFinish()" );

View file

@ -16,7 +16,7 @@ namespace Sapphire::Action
~ActionCast();
ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId );
ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId, FrameworkPtr pFw );
void onStart() override;

View file

@ -19,16 +19,14 @@ using namespace Sapphire::Network::Packets;
using namespace Sapphire::Network::Packets::Server;
using namespace Sapphire::Network::ActorControl;
extern Sapphire::Framework g_fw;
Sapphire::Action::ActionTeleport::ActionTeleport()
{
m_handleActionType = HandleActionType::Event;
}
Sapphire::Action::ActionTeleport::ActionTeleport( Entity::CharaPtr pActor, uint16_t targetZone, uint16_t cost )
Sapphire::Action::ActionTeleport::ActionTeleport( Entity::CharaPtr pActor, uint16_t targetZone, uint16_t cost, FrameworkPtr pFw )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
auto pExdData = pFw->get< Data::ExdDataGenerated >();
m_startTime = 0;
m_id = 5;
m_handleActionType = HandleActionType::Teleport;

View file

@ -18,7 +18,7 @@ namespace Sapphire::Action
~ActionTeleport();
ActionTeleport( Entity::CharaPtr pActor, uint16_t action, uint16_t cost );
ActionTeleport( Entity::CharaPtr pActor, uint16_t action, uint16_t cost, FrameworkPtr pFw );
void onStart() override;

View file

@ -11,8 +11,6 @@
#include "EventAction.h"
#include "Framework.h"
extern Sapphire::Framework g_fw;
using namespace Sapphire::Common;
using namespace Sapphire::Network;
using namespace Sapphire::Network::Packets;
@ -25,14 +23,15 @@ Sapphire::Action::EventAction::EventAction()
}
Sapphire::Action::EventAction::EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional )
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional,
FrameworkPtr pFw )
{
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
m_additional = additional;
m_handleActionType = HandleActionType::Event;
m_eventId = eventId;
m_id = action;
m_pFw = pFw;
auto pExdData = pFw->get< Data::ExdDataGenerated >();
m_castTime = pExdData->get< Sapphire::Data::EventAction >( action )->castTime * 1000; // TODO: Add security checks.
m_onActionFinishClb = finishRef;
m_onActionInterruptClb = interruptRef;
@ -95,8 +94,7 @@ void Sapphire::Action::EventAction::onFinish()
}
catch( std::exception& e )
{
auto pLog = g_fw.get< Logger >();
pLog->error( e.what() );
Logger::error( e.what() );
}
}
@ -134,8 +132,7 @@ void Sapphire::Action::EventAction::onInterrupt()
}
catch( std::exception& e )
{
auto pLog = g_fw.get< Logger >();
pLog->error( e.what() );
Logger::error( e.what() );
}
}

View file

@ -18,7 +18,7 @@ namespace Sapphire::Action
~EventAction();
EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action,
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional );
ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional, FrameworkPtr pFw );
void onStart() override;

View file

@ -14,8 +14,6 @@
#include "EventItemAction.h"
#include "Framework.h"
extern Sapphire::Framework g_fw;
using namespace Sapphire::Common;
using namespace Sapphire::Network;
using namespace Sapphire::Network::Packets;
@ -83,8 +81,7 @@ void Sapphire::Action::EventItemAction::onFinish()
}
catch( std::exception& e )
{
auto pLog = g_fw.get< Logger >();
pLog->error( e.what() );
Logger::error( e.what() );
}
}
@ -112,8 +109,7 @@ void Sapphire::Action::EventItemAction::onInterrupt()
}
catch( std::exception& e )
{
auto pLog = g_fw.get< Logger >();
pLog->error( e.what() );
Logger::error( e.what() );
}
}

Some files were not shown because too many files have changed in this diff Show more