mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
Various small cleanups
This commit is contained in:
parent
94b111ee85
commit
d1efbe6307
13 changed files with 51 additions and 77 deletions
|
@ -4,7 +4,6 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <boost/make_shared.hpp>
|
|
||||||
#include "CommonGen.h"
|
#include "CommonGen.h"
|
||||||
|
|
||||||
// +---------------------------------------------------------------------------
|
// +---------------------------------------------------------------------------
|
||||||
|
@ -27,8 +26,7 @@ struct FFXIVARR_POSITION3
|
||||||
float z;
|
float z;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InventoryOperation :
|
enum InventoryOperation : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Discard = 0x07,
|
Discard = 0x07,
|
||||||
Move = 0x08,
|
Move = 0x08,
|
||||||
|
@ -37,8 +35,7 @@ enum InventoryOperation :
|
||||||
Split = 0x0A
|
Split = 0x0A
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ClientLanguage :
|
enum ClientLanguage : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Japanese = 1,
|
Japanese = 1,
|
||||||
English = 2,
|
English = 2,
|
||||||
|
@ -46,8 +43,7 @@ enum ClientLanguage :
|
||||||
French = 8
|
French = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ObjKind :
|
enum ObjKind : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
None = 0x00,
|
None = 0x00,
|
||||||
Player = 0x01,
|
Player = 0x01,
|
||||||
|
@ -66,15 +62,13 @@ enum ObjKind :
|
||||||
CardStand = 0x0E,
|
CardStand = 0x0E,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Stance :
|
enum Stance : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Passive = 0,
|
Passive = 0,
|
||||||
Active = 1,
|
Active = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DisplayFlags :
|
enum class DisplayFlags : uint16_t
|
||||||
uint16_t
|
|
||||||
{
|
{
|
||||||
ActiveStance = 0x001,
|
ActiveStance = 0x001,
|
||||||
Invisible = 0x020,
|
Invisible = 0x020,
|
||||||
|
@ -84,8 +78,7 @@ enum class DisplayFlags :
|
||||||
Visor = 0x800,
|
Visor = 0x800,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum struct ActorStatus :
|
enum struct ActorStatus : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Idle = 0x01,
|
Idle = 0x01,
|
||||||
Dead = 0x02,
|
Dead = 0x02,
|
||||||
|
@ -99,8 +92,7 @@ enum struct ActorStatus :
|
||||||
EmoteMode = 0x0B
|
EmoteMode = 0x0B
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GearSetSlot :
|
enum GearSetSlot : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
MainHand = 0,
|
MainHand = 0,
|
||||||
OffHand = 1,
|
OffHand = 1,
|
||||||
|
@ -173,8 +165,7 @@ enum EquipSlotCategory : uint8_t
|
||||||
BodyDisallowLegsFeet = 21,
|
BodyDisallowLegsFeet = 21,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InventoryType :
|
enum InventoryType : uint16_t
|
||||||
uint16_t
|
|
||||||
{
|
{
|
||||||
Bag0 = 0,
|
Bag0 = 0,
|
||||||
Bag1 = 1,
|
Bag1 = 1,
|
||||||
|
@ -226,8 +217,7 @@ enum InventoryType :
|
||||||
FreeCompanyCrystal = 22001
|
FreeCompanyCrystal = 22001
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ContainerType :
|
enum ContainerType : uint16_t
|
||||||
uint16_t
|
|
||||||
{
|
{
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
Bag = 1,
|
Bag = 1,
|
||||||
|
@ -237,8 +227,7 @@ enum ContainerType :
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum CurrencyType :
|
enum CurrencyType : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Gil = 0x01,
|
Gil = 0x01,
|
||||||
StormSeal = 0x02,
|
StormSeal = 0x02,
|
||||||
|
@ -256,8 +245,7 @@ enum CurrencyType :
|
||||||
TomestoneLore = 0x0E
|
TomestoneLore = 0x0E
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CrystalType :
|
enum CrystalType : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
FireShard = 0x01,
|
FireShard = 0x01,
|
||||||
IceShard = 0x02,
|
IceShard = 0x02,
|
||||||
|
@ -281,8 +269,7 @@ enum CrystalType :
|
||||||
WaterCluster = 0x12
|
WaterCluster = 0x12
|
||||||
};
|
};
|
||||||
|
|
||||||
enum struct ZoneingType :
|
enum struct ZoneingType : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
None = 1,
|
None = 1,
|
||||||
Teleport = 2,
|
Teleport = 2,
|
||||||
|
@ -291,24 +278,21 @@ enum struct ZoneingType :
|
||||||
FadeIn = 5,
|
FadeIn = 5,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum struct ResurrectType :
|
enum struct ResurrectType : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
RaiseSpell = 5,
|
RaiseSpell = 5,
|
||||||
Return = 8
|
Return = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Gender :
|
enum Gender : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
Male = 0,
|
Male = 0,
|
||||||
Female = 1,
|
Female = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum struct GCRank :
|
enum struct GCRank : uint8_t
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
PrivateThirdClass = 1,
|
PrivateThirdClass = 1,
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
enum struct LoggingSeverity : uint8_t
|
||||||
enum struct LoggingSeverity :
|
|
||||||
uint8_t
|
|
||||||
{
|
{
|
||||||
trace = 0,
|
trace = 0,
|
||||||
debug = 1,
|
debug = 1,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define ACCEPTOR_H_
|
#define ACCEPTOR_H_
|
||||||
|
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <boost/enable_shared_from_this.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "PacketDef/Ipcs.h"
|
#include "PacketDef/Ipcs.h"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Network {
|
namespace Network {
|
||||||
namespace Packets {
|
namespace Packets {
|
||||||
|
@ -70,12 +68,12 @@ struct FFXIVARR_PACKET_HEADER
|
||||||
uint32_t unknown_24;
|
uint32_t unknown_24;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ostream& operator<<( ostream& os, const FFXIVARR_PACKET_HEADER& hdr )
|
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_HEADER& hdr )
|
||||||
{
|
{
|
||||||
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline istream& operator>>( istream& is, FFXIVARR_PACKET_HEADER& hdr )
|
inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_HEADER& hdr )
|
||||||
{
|
{
|
||||||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||||
}
|
}
|
||||||
|
@ -108,12 +106,12 @@ struct FFXIVARR_PACKET_SEGMENT_HEADER
|
||||||
uint16_t padding;
|
uint16_t padding;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ostream& operator<<( ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
||||||
{
|
{
|
||||||
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline istream& operator>>( istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr )
|
||||||
{
|
{
|
||||||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||||
}
|
}
|
||||||
|
@ -145,7 +143,7 @@ enum FFXIVARR_SEGMENT_TYPE
|
||||||
SEGMENTTYPE_IPC = 3,
|
SEGMENTTYPE_IPC = 3,
|
||||||
SEGMENTTYPE_KEEPALIVE = 7,
|
SEGMENTTYPE_KEEPALIVE = 7,
|
||||||
//SEGMENTTYPE_RESPONSE = 8,
|
//SEGMENTTYPE_RESPONSE = 8,
|
||||||
SEGMENTTYPE_ENCRYPTIONINIT = 9,
|
SEGMENTTYPE_ENCRYPTIONINIT = 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,12 +169,12 @@ struct FFXIVARR_IPC_HEADER
|
||||||
uint32_t padding1;
|
uint32_t padding1;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ostream& operator<<( ostream& os, const FFXIVARR_IPC_HEADER& hdr )
|
inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_IPC_HEADER& hdr )
|
||||||
{
|
{
|
||||||
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline istream& operator>>( istream& is, FFXIVARR_IPC_HEADER& hdr )
|
inline std::istream& operator>>( std::istream& is, FFXIVARR_IPC_HEADER& hdr )
|
||||||
{
|
{
|
||||||
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <boost/variant/detail/substitute.hpp>
|
#include <boost/variant/detail/substitute.hpp>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
std::string Core::Util::binaryToHexString( uint8_t* pBinData, uint16_t size )
|
std::string Core::Util::binaryToHexString( uint8_t* pBinData, uint16_t size )
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define _UTIL_H
|
#define _UTIL_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <boost/format.hpp>
|
#include <string>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Util {
|
namespace Util {
|
||||||
|
|
|
@ -27,22 +27,18 @@ uint16_t floatToUInt16Rot( float val );
|
||||||
|
|
||||||
uint8_t floatToUInt8Rot( float val );
|
uint8_t floatToUInt8Rot( float val );
|
||||||
|
|
||||||
template
|
template < typename T >
|
||||||
< typename T >
|
|
||||||
T clamp( T val, T minimum, T maximum )
|
T clamp( T val, T minimum, T maximum )
|
||||||
{
|
{
|
||||||
if( val > maximum )
|
if( val > maximum )
|
||||||
{
|
|
||||||
return maximum;
|
return maximum;
|
||||||
}
|
|
||||||
|
|
||||||
if( val < minimum )
|
if( val < minimum )
|
||||||
{
|
|
||||||
return minimum;
|
return minimum;
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/xml_parser.hpp>
|
#include <boost/property_tree/xml_parser.hpp>
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Config/ConfigMgr.h>
|
#include <Config/ConfigMgr.h>
|
||||||
|
|
||||||
|
|
|
@ -160,13 +160,13 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
|
||||||
memset( &details, 0, sizeof( FFXIVIpcCharList::CharaDetails ) );
|
memset( &details, 0, sizeof( FFXIVIpcCharList::CharaDetails ) );
|
||||||
|
|
||||||
auto& charEntry = charList[ charIndex ];
|
auto& charEntry = charList[ charIndex ];
|
||||||
details.uniqueId = get< 1 >( charEntry );
|
details.uniqueId = std::get< 1 >( charEntry );
|
||||||
details.contentId = get< 2 >( charEntry );
|
details.contentId = std::get< 2 >( charEntry );
|
||||||
details.serverId = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
|
details.serverId = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
|
||||||
details.serverId1 = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
|
details.serverId1 = g_serverLobby.getConfig()->getValue< uint16_t >( "Lobby.WorldID", 1 );
|
||||||
details.index = charIndex;
|
details.index = charIndex;
|
||||||
strcpy( details.charDetailJson, get< 3 >( charEntry ).c_str() );
|
strcpy( details.charDetailJson, std::get< 3 >( charEntry ).c_str() );
|
||||||
strcpy( details.nameChara, get< 0 >( charEntry ).c_str() );
|
strcpy( details.nameChara, std::get< 0 >( charEntry ).c_str() );
|
||||||
strcpy( details.nameServer,
|
strcpy( details.nameServer,
|
||||||
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
g_serverLobby.getConfig()->getValue< std::string >( "Lobby.WorldName", "Sapphire" ).c_str() );
|
||||||
strcpy( details.nameServer1,
|
strcpy( details.nameServer1,
|
||||||
|
@ -175,10 +175,10 @@ void Core::Network::GameConnection::getCharList( FFXIVARR_PACKET_RAW& packet, ui
|
||||||
charListPacket->data().charaDetails[ j ] = details;
|
charListPacket->data().charaDetails[ j ] = details;
|
||||||
|
|
||||||
g_log.debug( "[" + std::to_string( charIndex ) + "] " + std::to_string( details.index ) + " - "
|
g_log.debug( "[" + std::to_string( charIndex ) + "] " + std::to_string( details.index ) + " - "
|
||||||
+ get< 0 >( charEntry ) + " - " +
|
+ std::get< 0 >( charEntry ) + " - " +
|
||||||
std::to_string( get< 1 >( charEntry ) ) + " - " +
|
std::to_string( std::get< 1 >( charEntry ) ) + " - " +
|
||||||
std::to_string( get< 2 >( charEntry ) ) + " - " +
|
std::to_string( std::get< 2 >( charEntry ) ) + " - " +
|
||||||
get< 3 >( charEntry ) );
|
std::get< 3 >( charEntry ) );
|
||||||
}
|
}
|
||||||
charIndex++;
|
charIndex++;
|
||||||
}
|
}
|
||||||
|
@ -215,12 +215,12 @@ void Core::Network::GameConnection::enterWorld( FFXIVARR_PACKET_RAW& packet, uin
|
||||||
auto charList = g_restConnector.getCharList( ( char* ) m_pSession->getSessionId() );
|
auto charList = g_restConnector.getCharList( ( char* ) m_pSession->getSessionId() );
|
||||||
for( uint32_t i = 0; i < charList.size(); i++ )
|
for( uint32_t i = 0; i < charList.size(); i++ )
|
||||||
{
|
{
|
||||||
uint64_t thisContentId = get< 2 >( charList[ i ] );
|
uint64_t thisContentId = std::get< 2 >( charList[ i ] );
|
||||||
|
|
||||||
if( thisContentId == lookupId )
|
if( thisContentId == lookupId )
|
||||||
{
|
{
|
||||||
logInCharId = get< 1 >( charList[ i ] );
|
logInCharId = std::get< 1 >( charList[ i ] );
|
||||||
logInCharName = get< 0 >( charList[ i ] );
|
logInCharName = std::get< 0 >( charList[ i ] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -502,7 +502,7 @@ void Core::Entity::Player::updateDbSearchInfo() const
|
||||||
pDb->execute( stmtS1 );
|
pDb->execute( stmtS1 );
|
||||||
|
|
||||||
auto stmtS2 = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SEARCHCOMMENT );
|
auto stmtS2 = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SEARCHCOMMENT );
|
||||||
stmtS2->setString( 1, string( m_searchMessage ) );
|
stmtS2->setString( 1, std::string( m_searchMessage ) );
|
||||||
stmtS2->setInt( 2, m_id );
|
stmtS2->setInt( 2, m_id );
|
||||||
pDb->execute( stmtS2 );
|
pDb->execute( stmtS2 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,13 +141,13 @@ bool Core::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set<
|
||||||
boost::filesystem::directory_iterator iter( targetDir );
|
boost::filesystem::directory_iterator iter( targetDir );
|
||||||
boost::filesystem::directory_iterator eod;
|
boost::filesystem::directory_iterator eod;
|
||||||
|
|
||||||
BOOST_FOREACH( boost::filesystem::path const& i, make_pair( iter, eod ) )
|
BOOST_FOREACH( boost::filesystem::path const& i, std::make_pair( iter, eod ) )
|
||||||
{
|
{
|
||||||
if( is_regular_file( i ) && boost::filesystem::extension( i.string() ) == ext )
|
if( is_regular_file( i ) && boost::filesystem::extension( i.string() ) == ext )
|
||||||
{
|
{
|
||||||
files.insert( i.string() );
|
files.insert( i.string() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( files.size() )
|
if( files.size() )
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -216,7 +216,7 @@ void Core::ServerZone::mainLoop()
|
||||||
|
|
||||||
while( isRunning() )
|
while( isRunning() )
|
||||||
{
|
{
|
||||||
this_thread::sleep_for( chrono::milliseconds( 50 ) );
|
std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
||||||
|
|
||||||
auto currTime = Util::getTimeSeconds();
|
auto currTime = Util::getTimeSeconds();
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ void Core::ServerZone::mainLoop()
|
||||||
|
|
||||||
pScriptMgr->update();
|
pScriptMgr->update();
|
||||||
|
|
||||||
lock_guard< std::mutex > lock( m_sessionMutex );
|
std::lock_guard< std::mutex > lock( m_sessionMutex );
|
||||||
for( auto sessionIt : m_sessionMapById )
|
for( auto sessionIt : m_sessionMapById )
|
||||||
{
|
{
|
||||||
auto session = sessionIt.second;
|
auto session = sessionIt.second;
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
#include "ForwardsZone.h"
|
#include "ForwardsZone.h"
|
||||||
|
|
||||||
#include "Actor/BNpcTemplate.h"
|
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class ServerZone
|
class ServerZone
|
||||||
|
|
Loading…
Add table
Reference in a new issue