1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 14:07:46 +00:00

Refactoring and modernizing

This commit is contained in:
Mordred 2018-10-28 21:53:21 +01:00
parent 5182439403
commit 13dc04ebb5
425 changed files with 6922 additions and 6542 deletions

View file

@ -10,41 +10,41 @@
// The following enumerations are structures to require their type be included. // The following enumerations are structures to require their type be included.
// They are also defined within the Core::Common namespace to avoid collisions. // They are also defined within the Core::Common namespace to avoid collisions.
// +--------------------------------------------------------------------------- // +---------------------------------------------------------------------------
namespace Core { namespace Core::Common
namespace Common {
// 99 is the last spawn id that seems to spawn any actor
const uint8_t MAX_DISPLAYED_ACTORS = 99;
const uint8_t MAX_DISPLAYED_EOBJS = 40;
const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000;
struct FFXIVARR_POSITION3
{ {
// 99 is the last spawn id that seems to spawn any actor
const uint8_t MAX_DISPLAYED_ACTORS = 99;
const uint8_t MAX_DISPLAYED_EOBJS = 40;
const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000;
struct FFXIVARR_POSITION3
{
float x; float x;
float y; float y;
float z; float z;
}; };
enum InventoryOperation : uint8_t enum InventoryOperation : uint8_t
{ {
Discard = 0x07, Discard = 0x07,
Move = 0x08, Move = 0x08,
Swap = 0x09, Swap = 0x09,
Merge = 0x0C, Merge = 0x0C,
Split = 0x0A Split = 0x0A
}; };
enum ClientLanguage : uint8_t enum ClientLanguage : uint8_t
{ {
Japanese = 1, Japanese = 1,
English = 2, English = 2,
German = 4, German = 4,
French = 8 French = 8
}; };
enum ObjKind : uint8_t enum ObjKind : uint8_t
{ {
None = 0x00, None = 0x00,
Player = 0x01, Player = 0x01,
BattleNpc = 0x02, BattleNpc = 0x02,
@ -60,26 +60,26 @@ enum ObjKind : uint8_t
Housing = 0x0C, Housing = 0x0C,
Cutscene = 0x0D, Cutscene = 0x0D,
CardStand = 0x0E, CardStand = 0x0E,
}; };
enum Stance : uint8_t enum Stance : uint8_t
{ {
Passive = 0, Passive = 0,
Active = 1, Active = 1,
}; };
enum class DisplayFlags : uint16_t enum class DisplayFlags : uint16_t
{ {
ActiveStance = 0x001, ActiveStance = 0x001,
Invisible = 0x020, Invisible = 0x020,
HideHead = 0x040, HideHead = 0x040,
HideWeapon = 0x080, HideWeapon = 0x080,
Faded = 0x100, Faded = 0x100,
Visor = 0x800, Visor = 0x800,
}; };
enum struct ActorStatus : uint8_t enum struct ActorStatus : uint8_t
{ {
Idle = 0x01, Idle = 0x01,
Dead = 0x02, Dead = 0x02,
Sitting = 0x03, Sitting = 0x03,
@ -90,10 +90,10 @@ enum struct ActorStatus : uint8_t
SMachine = 0x08, SMachine = 0x08,
Carry = 0x09, Carry = 0x09,
EmoteMode = 0x0B EmoteMode = 0x0B
}; };
enum GearSetSlot : uint8_t enum GearSetSlot : uint8_t
{ {
MainHand = 0, MainHand = 0,
OffHand = 1, OffHand = 1,
Head = 2, Head = 2,
@ -108,10 +108,10 @@ enum GearSetSlot : uint8_t
Ring1 = 11, Ring1 = 11,
Ring2 = 12, Ring2 = 12,
SoulCrystal = 13, SoulCrystal = 13,
}; };
enum GearModelSlot : int8_t enum GearModelSlot : int8_t
{ {
ModelInvalid = -1, ModelInvalid = -1,
ModelHead = 0, ModelHead = 0,
ModelBody = 1, ModelBody = 1,
@ -123,10 +123,10 @@ enum GearModelSlot : int8_t
ModelWrist = 7, ModelWrist = 7,
ModelRing1 = 8, ModelRing1 = 8,
ModelRing2 = 9 ModelRing2 = 9
}; };
enum EquipSlotCategory : uint8_t enum EquipSlotCategory : uint8_t
{ {
Unequippable = 0, Unequippable = 0,
// main slots // main slots
@ -163,10 +163,10 @@ enum EquipSlotCategory : uint8_t
BodyDisallowHands = 20, BodyDisallowHands = 20,
/*! Cannot equip gear to legs & feet slots */ /*! Cannot equip gear to legs & feet slots */
BodyDisallowLegsFeet = 21, BodyDisallowLegsFeet = 21,
}; };
enum InventoryType : uint16_t enum InventoryType : uint16_t
{ {
Bag0 = 0, Bag0 = 0,
Bag1 = 1, Bag1 = 1,
Bag2 = 2, Bag2 = 2,
@ -215,20 +215,20 @@ enum InventoryType : uint16_t
FreeCompanyBag2 = 20002, FreeCompanyBag2 = 20002,
FreeCompanyGil = 22000, FreeCompanyGil = 22000,
FreeCompanyCrystal = 22001 FreeCompanyCrystal = 22001
}; };
enum ContainerType : uint16_t enum ContainerType : uint16_t
{ {
Unknown = 0, Unknown = 0,
Bag = 1, Bag = 1,
GearSet = 2, GearSet = 2,
CurrencyCrystal = 3, CurrencyCrystal = 3,
Armory = 4 Armory = 4
}; };
enum CurrencyType : uint8_t enum CurrencyType : uint8_t
{ {
Gil = 0x01, Gil = 0x01,
StormSeal = 0x02, StormSeal = 0x02,
SerpentSeal = 0x03, SerpentSeal = 0x03,
@ -243,10 +243,10 @@ enum CurrencyType : uint8_t
TomestoneLaw = 0x0C, TomestoneLaw = 0x0C,
TomestoneEso = 0x0D, TomestoneEso = 0x0D,
TomestoneLore = 0x0E TomestoneLore = 0x0E
}; };
enum CrystalType : uint8_t enum CrystalType : uint8_t
{ {
FireShard = 0x01, FireShard = 0x01,
IceShard = 0x02, IceShard = 0x02,
WindShard = 0x03, WindShard = 0x03,
@ -267,33 +267,33 @@ enum CrystalType : uint8_t
EarthCluster = 0x10, EarthCluster = 0x10,
LightningCluster = 0x11, LightningCluster = 0x11,
WaterCluster = 0x12 WaterCluster = 0x12
}; };
enum struct ZoneingType : uint8_t enum struct ZoneingType : uint8_t
{ {
None = 1, None = 1,
Teleport = 2, Teleport = 2,
Return = 3, Return = 3,
ReturnDead = 4, ReturnDead = 4,
FadeIn = 5, FadeIn = 5,
}; };
enum struct ResurrectType : uint8_t enum struct ResurrectType : uint8_t
{ {
None = 0, None = 0,
RaiseSpell = 5, RaiseSpell = 5,
Return = 8 Return = 8
}; };
enum Gender : uint8_t enum Gender : uint8_t
{ {
Male = 0, Male = 0,
Female = 1, Female = 1,
}; };
enum struct GCRank : uint8_t enum struct GCRank : uint8_t
{ {
None = 0, None = 0,
PrivateThirdClass = 1, PrivateThirdClass = 1,
PrivateSecondClass = 2, PrivateSecondClass = 2,
@ -314,23 +314,23 @@ enum struct GCRank : uint8_t
Marshal = 17, Marshal = 17,
GrandMarshal = 18, GrandMarshal = 18,
Champion = 19, Champion = 19,
}; };
/** /**
* Structural representation of the packet sent by the server * Structural representation of the packet sent by the server
* Send the entire StatusEffect list * Send the entire StatusEffect list
*/ */
struct StatusEffect struct StatusEffect
{ {
uint16_t effect_id; uint16_t effect_id;
uint16_t unknown1; uint16_t unknown1;
float duration; float duration;
uint32_t sourceActorId; uint32_t sourceActorId;
}; };
enum CharaLook : enum CharaLook :
uint8_t uint8_t
{ {
Race = 0x00, Race = 0x00,
Gender = 0x01, Gender = 0x01,
Tribe = 0x04, Tribe = 0x04,
@ -358,28 +358,28 @@ enum CharaLook :
Facepaint = 0x18, Facepaint = 0x18,
FacepaintColor = 0x19, FacepaintColor = 0x19,
}; };
enum MoveType : enum MoveType :
uint8_t uint8_t
{ {
Running = 0x00, Running = 0x00,
Walking = 0x02, Walking = 0x02,
Strafing = 0x04, Strafing = 0x04,
Jumping = 0x10, Jumping = 0x10,
BackWalk = 0x06, BackWalk = 0x06,
}; };
enum MoveState : enum MoveState :
uint8_t uint8_t
{ {
No = 0x00, No = 0x00,
Land = 0x02, Land = 0x02,
Fall = 0x04, Fall = 0x04,
}; };
struct QuestActive struct QuestActive
{ {
QuestActive() QuestActive()
{ {
c.questId = 0; c.questId = 0;
@ -469,11 +469,11 @@ struct QuestActive
}; };
}; };
enum struct ActionAspect : enum struct ActionAspect :
uint8_t uint8_t
{ {
None = 0, // Doesn't imply unaspected None = 0, // Doesn't imply unaspected
Fire = 1, Fire = 1,
Ice = 2, Ice = 2,
@ -482,11 +482,11 @@ enum struct ActionAspect :
Lightning = 5, Lightning = 5,
Water = 6, Water = 6,
Unaspected = 7 // Doesn't imply magical unaspected damage - could be unaspected physical Unaspected = 7 // Doesn't imply magical unaspected damage - could be unaspected physical
}; };
enum class ActionType : enum class ActionType :
int8_t int8_t
{ {
WeaponOverride = -1, // Needs more investigation (takes the damage type of the equipped weapon)? WeaponOverride = -1, // Needs more investigation (takes the damage type of the equipped weapon)?
Unknown_0 = 0, Unknown_0 = 0,
Slashing = 1, Slashing = 1,
@ -497,11 +497,11 @@ enum class ActionType :
Darkness = 6, Darkness = 6,
Unknown_7 = 7, Unknown_7 = 7,
LimitBreak = 8, LimitBreak = 8,
}; };
enum ActionEffectType : enum ActionEffectType :
uint8_t uint8_t
{ {
Nothing = 0, Nothing = 0,
Miss = 1, Miss = 1,
FullResist = 2, FullResist = 2,
@ -519,30 +519,30 @@ enum ActionEffectType :
GpGain = 14, GpGain = 14,
Knockback = 33, Knockback = 33,
Mount = 38 Mount = 38
}; };
enum class ActionHitSeverityType : enum class ActionHitSeverityType :
uint8_t uint8_t
{ {
NormalDamage = 0, NormalDamage = 0,
CritHeal = 0, CritHeal = 0,
CritDamage = 1, CritDamage = 1,
NormalHeal = 1, NormalHeal = 1,
DirectHitDamage = 2, DirectHitDamage = 2,
CritDirectHitDamage = 3 CritDirectHitDamage = 3
}; };
enum ActionEffectDisplayType : enum ActionEffectDisplayType :
uint8_t uint8_t
{ {
HideActionName = 0, HideActionName = 0,
ShowActionName = 1, ShowActionName = 1,
ShowItemName = 2, ShowItemName = 2,
}; };
enum class ActionCollisionType : enum class ActionCollisionType :
uint8_t uint8_t
{ {
None, None,
SingleTarget, SingleTarget,
Circle, Circle,
@ -552,35 +552,35 @@ enum class ActionCollisionType :
Unknown2, Unknown2,
PersistentArea, // for when you set aoe like asylum PersistentArea, // for when you set aoe like asylum
Unknown3 Unknown3
}; };
enum HandleActionType : enum HandleActionType :
uint8_t uint8_t
{ {
Event, Event,
Spell, Spell,
Teleport Teleport
}; };
enum HandleSkillType : enum HandleSkillType :
uint8_t uint8_t
{ {
StdDamage, StdDamage,
StdHeal, StdHeal,
StdDot, StdDot,
}; };
enum InvincibilityType : enum InvincibilityType :
uint8_t uint8_t
{ {
InvincibilityNone, InvincibilityNone,
InvincibilityRefill, InvincibilityRefill,
InvincibilityStayAlive, InvincibilityStayAlive,
}; };
enum PlayerStateFlag : enum PlayerStateFlag :
uint8_t uint8_t
{ {
HideUILockChar = 0, // as the name suggests, hides the ui and logs the char... HideUILockChar = 0, // as the name suggests, hides the ui and logs the char...
InCombat = 1, // in Combat, locks gearchange/return/teleport InCombat = 1, // in Combat, locks gearchange/return/teleport
Casting = 2, Casting = 2,
@ -593,20 +593,20 @@ enum PlayerStateFlag :
WatchingCutscene = 50, // this is actually just a dummy, this id is different WatchingCutscene = 50, // this is actually just a dummy, this id is different
}; };
enum struct FateStatus : enum struct FateStatus :
uint8_t uint8_t
{ {
Active = 2, Active = 2,
Inactive = 4, Inactive = 4,
Preparing = 7, Preparing = 7,
Completed = 8, Completed = 8,
}; };
enum struct ChatType : enum struct ChatType :
uint16_t uint16_t
{ {
LogKindError, LogKindError,
ServerDebug, ServerDebug,
ServerUrgent, ServerUrgent,
@ -708,11 +708,11 @@ enum struct ChatType :
Unused98, Unused98,
Unused99, Unused99,
Unused100 Unused100
}; };
enum EquipDisplayFlags : enum EquipDisplayFlags :
uint8_t uint8_t
{ {
HideNothing = 0x0, HideNothing = 0x0,
HideHead = 0x1, HideHead = 0x1,
HideWeapon = 0x2, HideWeapon = 0x2,
@ -722,18 +722,17 @@ enum EquipDisplayFlags :
StoreCraftedItemsInInventory = 0x20, StoreCraftedItemsInInventory = 0x20,
Visor = 0x40, Visor = 0x40,
}; };
enum SkillType : enum SkillType :
uint8_t uint8_t
{ {
Normal = 0x1, Normal = 0x1,
MountSkill = 0xD, MountSkill = 0xD,
}; };
typedef std::vector< PlayerStateFlag > PlayerStateFlagList; using PlayerStateFlagList = std::vector< PlayerStateFlag >;
} /* Common */ }
} /* Core */
#endif #endif

View file

@ -7,10 +7,11 @@
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
namespace Core { namespace Core
class ConfigMgr
{ {
public: class ConfigMgr
{
public:
ConfigMgr() = default; ConfigMgr() = default;
~ConfigMgr() = default; ~ConfigMgr() = default;
@ -55,7 +56,7 @@ public:
//m_propTree.put( name, defaultValue ); //m_propTree.put( name, defaultValue );
} }
private: private:
bool copyDefaultConfig( const std::string& configName ); bool copyDefaultConfig( const std::string& configName );
std::unique_ptr< INIReader > m_pInih; std::unique_ptr< INIReader > m_pInih;
@ -63,7 +64,7 @@ private:
const std::string m_globalConfigFile = "global.ini"; const std::string m_globalConfigFile = "global.ini";
const std::string m_configFolderRoot = "./config/"; const std::string m_configFolderRoot = "./config/";
const std::string m_configDefaultSuffix = ".default"; const std::string m_configDefaultSuffix = ".default";
}; };
} }
#endif //SAPPHIRE_CONFIGMGR_H #endif //SAPPHIRE_CONFIGMGR_H

View file

@ -1,10 +1,10 @@
#include <string> #include <string>
namespace Core { namespace Core::Util
namespace Util { {
std::string base64_encode( uint8_t const*, uint32_t len ); std::string base64_encode( uint8_t const*, uint32_t len );
std::string base64_decode( std::string const& s ); std::string base64_decode( const std::string& s );
}
} }

View file

@ -3,25 +3,25 @@
#include <stdint.h> #include <stdint.h>
namespace Core { namespace Core::Util
namespace Util {
using md5_context = struct
{ {
using md5_context = struct
{
uint32_t total[2]; uint32_t total[2];
uint32_t state[4]; uint32_t state[4];
uint8_t buffer[64]; uint8_t buffer[64];
}; };
void md5( uint8_t* text, uint8_t* hash, int32_t size ); void md5( uint8_t* text, uint8_t* hash, int32_t size );
void md5_starts( md5_context* ctx ); void md5_starts( md5_context* ctx );
void md5_update( md5_context* ctx, uint8_t* input, uint32_t length ); void md5_update( md5_context* ctx, uint8_t* input, uint32_t length );
void md5_finish( md5_context* ctx, uint8_t digest[16] ); void md5_finish( md5_context* ctx, uint8_t digest[16] );
static const char* msg[] = static const char* msg[] =
{ {
"", "",
"a", "a",
@ -33,7 +33,7 @@ static const char* msg[] =
"345678901234567890" "345678901234567890"
}; };
static const char* val[] = static const char* val[] =
{ {
"d41d8cd98f00b204e9800998ecf8427e", "d41d8cd98f00b204e9800998ecf8427e",
"0cc175b9c0f1b6a831c399e269772661", "0cc175b9c0f1b6a831c399e269772661",
@ -45,7 +45,7 @@ static const char* val[] =
}; };
} }
}
#endif /* md5.h */ #endif /* md5.h */

View file

@ -8,37 +8,31 @@
#include <vector> #include <vector>
#include "Util/LockedWaitQueue.h" #include "Util/LockedWaitQueue.h"
namespace Mysql { namespace Mysql
class Connection; {
class Connection;
class ResultSet; class ResultSet;
class PreparedResultSet;
class PreparedResultSet; class PreparedStatement;
class PreparedStatement;
} }
namespace Core { namespace Core::Db
namespace Db {
class DatabaseWorker;
class PreparedStatement;
class Operation;
class DbWorker;
using PreparedStmtScopedPtr = std::unique_ptr< PreparedStatement >;
enum ConnectionFlags
{ {
class DatabaseWorker;
class PreparedStatement;
class Operation;
class DbWorker;
using PreparedStmtScopedPtr = std::unique_ptr< PreparedStatement >;
enum ConnectionFlags
{
CONNECTION_ASYNC = 0x1, CONNECTION_ASYNC = 0x1,
CONNECTION_SYNC = 0x2, CONNECTION_SYNC = 0x2,
CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC
}; };
struct ConnectionInfo struct ConnectionInfo
{ {
std::string user; std::string user;
std::string password; std::string password;
std::string database; std::string database;
@ -46,14 +40,14 @@ struct ConnectionInfo
uint16_t port; uint16_t port;
uint8_t syncThreads; uint8_t syncThreads;
uint8_t asyncThreads; uint8_t asyncThreads;
}; };
using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >; using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >;
class DbConnection : class DbConnection :
public std::enable_shared_from_this< DbConnection > public std::enable_shared_from_this< DbConnection >
{ {
public: public:
// Constructor for synchronous connections. // Constructor for synchronous connections.
DbConnection( ConnectionInfo& connInfo ); DbConnection( ConnectionInfo& connInfo );
@ -101,13 +95,13 @@ public:
virtual void doPrepareStatements() = 0; virtual void doPrepareStatements() = 0;
protected: protected:
std::vector< std::shared_ptr< Mysql::PreparedStatement > > m_stmts; std::vector< std::shared_ptr< Mysql::PreparedStatement > > m_stmts;
PreparedStatementMap m_queries; PreparedStatementMap m_queries;
bool m_reconnecting; bool m_reconnecting;
bool m_prepareError; bool m_prepareError;
private: private:
LockedWaitQueue< std::shared_ptr< Operation > >* m_queue; LockedWaitQueue< std::shared_ptr< Operation > >* m_queue;
std::shared_ptr< DbWorker > m_worker; std::shared_ptr< DbWorker > m_worker;
std::shared_ptr< Mysql::Connection > m_pConnection; std::shared_ptr< Mysql::Connection > m_pConnection;
@ -118,10 +112,8 @@ private:
DbConnection( DbConnection const& right ) = delete; DbConnection( DbConnection const& right ) = delete;
DbConnection& operator=( DbConnection const& right ) = delete; DbConnection& operator=( DbConnection const& right ) = delete;
}; };
} }
}
#endif #endif

View file

@ -8,15 +8,15 @@
#include <string> #include <string>
#include "DbConnection.h" #include "DbConnection.h"
namespace Core { namespace Core::Db
namespace Db {
template< class T >
class DbWorkerPool;
class DbLoader
{ {
public:
template< class T >
class DbWorkerPool;
class DbLoader
{
public:
DbLoader(); DbLoader();
template< class T > template< class T >
@ -31,7 +31,7 @@ public:
DATABASE_MASK_ALL = DATABASE_CHARACTER DATABASE_MASK_ALL = DATABASE_CHARACTER
}; };
private: private:
bool openDatabases(); bool openDatabases();
bool prepareStatements(); bool prepareStatements();
@ -44,8 +44,7 @@ private:
std::queue< Predicate > m_open; std::queue< Predicate > m_open;
std::queue< Predicate > m_prepare; std::queue< Predicate > m_prepare;
std::stack< Closer > m_close; std::stack< Closer > m_close;
}; };
}
} }
#endif //SAPPHIRE_DBLOADER_H #endif //SAPPHIRE_DBLOADER_H

View file

@ -6,20 +6,19 @@
#include "Util/LockedWaitQueue.h" #include "Util/LockedWaitQueue.h"
#include <memory> #include <memory>
namespace Core { namespace Core::Db
namespace Db {
class DbConnection;
class Operation;
class DbWorker
{ {
public: class DbConnection;
class Operation;
class DbWorker
{
public:
DbWorker( LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* connection ); DbWorker( LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* connection );
~DbWorker(); ~DbWorker();
private: private:
LockedWaitQueue< std::shared_ptr< Operation > >* m_queue; LockedWaitQueue< std::shared_ptr< Operation > >* m_queue;
DbConnection* m_pConn; DbConnection* m_pConn;
@ -32,9 +31,7 @@ private:
DbWorker( DbWorker const& right ) = delete; DbWorker( DbWorker const& right ) = delete;
DbWorker& operator=( DbWorker const& right ) = delete; DbWorker& operator=( DbWorker const& right ) = delete;
}; };
} }
}
#endif //SAPPHIRE_DBWORKER_H #endif //SAPPHIRE_DBWORKER_H

View file

@ -8,22 +8,22 @@
#include "Util/LockedWaitQueue.h" #include "Util/LockedWaitQueue.h"
#include "DbConnection.h" #include "DbConnection.h"
namespace Core { namespace Core::Db
namespace Db {
template< typename T >
class LockedWaitQueue;
class Operation;
class PreparedStatement;
struct ConnectionInfo;
template< class T >
class DbWorkerPool
{ {
private:
template< typename T >
class LockedWaitQueue;
class Operation;
class PreparedStatement;
struct ConnectionInfo;
template< class T >
class DbWorkerPool
{
private:
enum InternalIndex enum InternalIndex
{ {
IDX_ASYNC, IDX_ASYNC,
@ -31,7 +31,7 @@ private:
IDX_SIZE IDX_SIZE
}; };
public: public:
DbWorkerPool(); DbWorkerPool();
~DbWorkerPool(); ~DbWorkerPool();
@ -72,7 +72,7 @@ public:
void keepAlive(); void keepAlive();
private: private:
uint32_t openConnections( InternalIndex type, uint8_t numConnections ); uint32_t openConnections( InternalIndex type, uint8_t numConnections );
unsigned long escapeString( char* to, const char* from, unsigned long length ); unsigned long escapeString( char* to, const char* from, unsigned long length );
@ -88,9 +88,8 @@ private:
ConnectionInfo m_connectionInfo; ConnectionInfo m_connectionInfo;
uint8_t m_asyncThreads; uint8_t m_asyncThreads;
uint8_t m_synchThreads; uint8_t m_synchThreads;
}; };
}
} }
#endif //SAPPHIRE_DBWORKERPOOL_H #endif //SAPPHIRE_DBWORKERPOOL_H

View file

@ -1,19 +1,20 @@
#ifndef SAPPHIRE_OPERATION_H #ifndef SAPPHIRE_OPERATION_H
#define SAPPHIRE_OPERATION_H #define SAPPHIRE_OPERATION_H
namespace Mysql { namespace Mysql
class Connection; {
class Connection;
} }
namespace Core { namespace Core::Db
namespace Db {
class DbConnection;
class PreparedStatement;
class Operation
{ {
public: class DbConnection;
class PreparedStatement;
class Operation
{
public:
Operation() : Operation() :
m_pConn( nullptr ) m_pConn( nullptr )
{ {
@ -38,14 +39,11 @@ public:
DbConnection* m_pConn; DbConnection* m_pConn;
private: private:
Operation( Operation const& right ) = delete; Operation( Operation const& right ) = delete;
Operation& operator=( Operation const& right ) = delete; Operation& operator=( Operation const& right ) = delete;
}; };
}
} }
#endif //SAPPHIRE_OPERATION_H #endif //SAPPHIRE_OPERATION_H

View file

@ -7,24 +7,25 @@
#include <memory> #include <memory>
#include "Operation.h" #include "Operation.h"
namespace Mysql { namespace Mysql
class PreparedStatement; {
class PreparedStatement;
} }
namespace Core { namespace Core::Db
namespace Db {
union PreparedStatementDataUnion
{ {
union PreparedStatementDataUnion
{
bool boolean; bool boolean;
uint32_t ui32; uint32_t ui32;
int32_t i32; int32_t i32;
uint64_t ui64; uint64_t ui64;
int64_t i64; int64_t i64;
double d; double d;
}; };
enum PreparedStatementValueType enum PreparedStatementValueType
{ {
TYPE_BOOL, TYPE_BOOL,
TYPE_UI, TYPE_UI,
TYPE_UI64, TYPE_UI64,
@ -34,18 +35,18 @@ enum PreparedStatementValueType
TYPE_STRING, TYPE_STRING,
TYPE_BINARY, TYPE_BINARY,
TYPE_NULL TYPE_NULL
}; };
struct PreparedStatementData struct PreparedStatementData
{ {
PreparedStatementDataUnion data; PreparedStatementDataUnion data;
PreparedStatementValueType type; PreparedStatementValueType type;
std::vector< uint8_t > binary; std::vector< uint8_t > binary;
}; };
class PreparedStatement class PreparedStatement
{ {
public: public:
explicit PreparedStatement( uint32_t index ); explicit PreparedStatement( uint32_t index );
~PreparedStatement(); ~PreparedStatement();
@ -74,7 +75,7 @@ public:
void bindParameters(); void bindParameters();
protected: protected:
std::shared_ptr< Mysql::PreparedStatement > m_stmt; std::shared_ptr< Mysql::PreparedStatement > m_stmt;
uint32_t m_index; uint32_t m_index;
std::vector< PreparedStatementData > m_statementData; std::vector< PreparedStatementData > m_statementData;
@ -82,10 +83,7 @@ protected:
PreparedStatement( PreparedStatement const& right ) = delete; PreparedStatement( PreparedStatement const& right ) = delete;
PreparedStatement& operator=( PreparedStatement const& right ) = delete; PreparedStatement& operator=( PreparedStatement const& right ) = delete;
}; };
}
} }

View file

@ -5,14 +5,14 @@
#include "Operation.h" #include "Operation.h"
#include <memory> #include <memory>
namespace Core { namespace Core::Db
namespace Db {
class PreparedStatement;
class StatementTask :
public Operation
{ {
public: class PreparedStatement;
class StatementTask :
public Operation
{
public:
StatementTask( const std::string& sql, bool async = false ); StatementTask( const std::string& sql, bool async = false );
@ -25,16 +25,16 @@ public:
// return m_result->get_future(); // return m_result->get_future();
// } // }
private: private:
std::string m_sql; std::string m_sql;
bool m_hasResult; bool m_hasResult;
// QueryResultPromise *m_result; // QueryResultPromise *m_result;
}; };
class PreparedStatementTask : class PreparedStatementTask :
public Operation public Operation
{ {
public: public:
PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false ); PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false );
~PreparedStatementTask(); ~PreparedStatementTask();
@ -42,14 +42,13 @@ public:
bool execute() override; bool execute() override;
//PreparedQueryResultFuture getFuture() { return m_result->get_future(); } //PreparedQueryResultFuture getFuture() { return m_result->get_future(); }
protected: protected:
std::shared_ptr< PreparedStatement > m_stmt; std::shared_ptr< PreparedStatement > m_stmt;
bool m_hasResult; bool m_hasResult;
//PreparedQueryResultPromise* m_result; //PreparedQueryResultPromise* m_result;
}; };
} }
}
#endif //SAPPHIRE_STATEMENTTASK_H #endif //SAPPHIRE_STATEMENTTASK_H

View file

@ -3,12 +3,12 @@
#include "DbConnection.h" #include "DbConnection.h"
namespace Core { namespace Core::Db
namespace Db {
class DbConnectionInfo;
enum ZoneDbStatements : uint32_t
{ {
class DbConnectionInfo;
enum ZoneDbStatements : uint32_t
{
CHARA_SEL, CHARA_SEL,
CHARA_SEL_MINIMAL, CHARA_SEL_MINIMAL,
CHARA_SEL_SEARCHINFO, CHARA_SEL_SEARCHINFO,
@ -79,11 +79,11 @@ enum ZoneDbStatements : uint32_t
ZONE_SEL_BNPCTEMPLATES, ZONE_SEL_BNPCTEMPLATES,
MAX_STATEMENTS MAX_STATEMENTS
}; };
class ZoneDbConnection : public DbConnection class ZoneDbConnection : public DbConnection
{ {
public: public:
using Statements = ZoneDbStatements; using Statements = ZoneDbStatements;
ZoneDbConnection( ConnectionInfo& connInfo ); ZoneDbConnection( ConnectionInfo& connInfo );
@ -94,9 +94,8 @@ public:
void doPrepareStatements() override; void doPrepareStatements() override;
}; };
}
} }
#endif //SAPPHIRE_CHARACONNECTION_H #endif //SAPPHIRE_CHARACONNECTION_H

View file

@ -13,8 +13,8 @@
#include <set> #include <set>
#include <variant> #include <variant>
namespace Core { namespace Core::Data
namespace Data { {
class ExdDataGenerated; class ExdDataGenerated;
@ -8694,7 +8694,6 @@ const std::set< uint32_t >& getZoneSharedGroupIdList()
}; };
} }
}
#endif #endif

View file

@ -3,34 +3,30 @@
#include <memory> #include <memory>
namespace Core { namespace Core
{
class ConfigMgr; class ConfigMgr;
using ConfigMgrPtr = std::shared_ptr< ConfigMgr >;
typedef std::shared_ptr< ConfigMgr > ConfigMgrPtr; namespace Network
{
class Hive;
class Acceptor;
class Connection;
using HivePtr = std::shared_ptr< Hive >;
using AcceptorPtr = std::shared_ptr< Acceptor >;
using ConnectionPtr = std::shared_ptr< Connection >;
namespace Packets
{
class GamePacket;
class FFXIVPacketBase;
using GamePacketPtr = std::shared_ptr< GamePacket >;
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
}
namespace Network { }
class Hive;
class Acceptor;
class Connection;
typedef std::shared_ptr< Hive > HivePtr;
typedef std::shared_ptr< Acceptor > AcceptorPtr;
typedef std::shared_ptr< Connection > ConnectionPtr;
namespace Packets {
class GamePacket;
class FFXIVPacketBase;
typedef std::shared_ptr< GamePacket > GamePacketPtr;
typedef std::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
}
}
} }

View file

@ -7,14 +7,15 @@
#include <memory> #include <memory>
#include <cassert> #include <cassert>
namespace Core { namespace Core
class Framework
{ {
class Framework
{
using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >; using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >;
TypenameToObject ObjectMap; TypenameToObject ObjectMap;
public: public:
template< typename T > template< typename T >
std::shared_ptr< T > get() std::shared_ptr< T > get()
{ {
@ -29,7 +30,7 @@ public:
assert( value ); // why would anyone store nullptrs.... assert( value ); // why would anyone store nullptrs....
ObjectMap[ typeid( T ) ] = value; ObjectMap[ typeid( T ) ] = value;
} }
}; };
} }

View file

@ -48,11 +48,6 @@ void Logger::init()
spdlog::flush_on( spdlog::level::critical ); spdlog::flush_on( spdlog::level::critical );
} }
void Logger::Log( LoggingSeverity logSev, const std::string& text )
{
}
void Logger::error( const std::string& text ) void Logger::error( const std::string& text )
{ {
spdlog::get( "logger" )->error( text ); spdlog::get( "logger" )->error( text );

View file

@ -3,33 +3,22 @@
#include <string> #include <string>
namespace Core { namespace Core
enum struct LoggingSeverity : uint8_t
{
trace = 0,
debug = 1,
info = 2,
warning = 3,
error = 4,
fatal = 5
};
class Logger
{ {
private: class Logger
{
private:
std::string m_logFile; std::string m_logFile;
public: public:
Logger(); Logger();
~Logger(); ~Logger();
void init(); void init();
void Log( LoggingSeverity logSev, const std::string& text );
void error( const std::string& text ); void error( const std::string& text );
void info( const std::string& text ); void info( const std::string& text );
@ -40,8 +29,7 @@ public:
void setLogPath( const std::string& logPath ); void setLogPath( const std::string& logPath );
}; };
} }

View file

@ -13,22 +13,22 @@
#include <vector> #include <vector>
namespace Core { namespace Core::Network
namespace Network {
class Connection;
class Acceptor : public std::enable_shared_from_this< Acceptor >
{ {
class Connection;
class Acceptor : public std::enable_shared_from_this< Acceptor >
{
friend class Hive; friend class Hive;
private: private:
HivePtr m_hive; HivePtr m_hive;
asio::ip::tcp::acceptor m_acceptor; asio::ip::tcp::acceptor m_acceptor;
asio::strand m_io_strand; asio::strand m_io_strand;
std::atomic< uint32_t > m_error_state; std::atomic< uint32_t > m_error_state;
private: private:
Acceptor( const Acceptor& rhs ); Acceptor( const Acceptor& rhs );
Acceptor& operator=( const Acceptor& rhs ); Acceptor& operator=( const Acceptor& rhs );
@ -39,7 +39,7 @@ private:
void HandleAccept( const asio::error_code& error, ConnectionPtr connection ); void HandleAccept( const asio::error_code& error, ConnectionPtr connection );
private: private:
// Called when a connection has connected to the server. This function // Called when a connection has connected to the server. This function
// should return true to invoke the connection's OnAccept function if the // should return true to invoke the connection's OnAccept function if the
// connection will be kept. If the connection will not be kept, the // connection will be kept. If the connection will not be kept, the
@ -52,7 +52,7 @@ private:
// called on an address that is not available. // called on an address that is not available.
virtual void OnError( const asio::error_code& error ); virtual void OnError( const asio::error_code& error );
public: public:
Acceptor( HivePtr hive ); Acceptor( HivePtr hive );
virtual ~Acceptor(); virtual ~Acceptor();
@ -69,7 +69,7 @@ public:
// Returns true if this object has an error associated with it. // Returns true if this object has an error associated with it.
bool HasError(); bool HasError();
public: public:
// Begin listening on the specific network interface. // Begin listening on the specific network interface.
void Listen( const std::string& host, const uint16_t& port ); void Listen( const std::string& host, const uint16_t& port );
@ -80,8 +80,7 @@ public:
// Stop the Acceptor from listening. // Stop the Acceptor from listening.
void Stop(); void Stop();
}; };
}
} }
#endif #endif

View file

@ -5,52 +5,51 @@
#include <vector> #include <vector>
#include "PacketDef/Ipcs.h" #include "PacketDef/Ipcs.h"
namespace Core { namespace Core::Network::Packets
namespace Network {
namespace Packets {
/**
* Anticipated usage:
* ==================
* Set up a stream buffer to collect the bytes to be transmitted as a packet.
* Now, you can do the following (given you have the structs filled out already).
*
* FFXIVARR_PACKET_HEADER pkt_hdr = { . . . };
* FFXIVARR_PACKET_SEGMENT_HEADER pkt_seg_hdr[n] = { . . . };
*
* std::stringstream buf;
* buf << pkt_hdr;
* for( int i = 0; i < n; i++ )
* {
* buf << pkt_seg_hdr[i];
* buf << {pkt_seg_data[i]};
* }
*
* The reverse can be done parsing a packet. Remember to validate the packet
* type before parsing the headers.
*
* Compression and Encryption:
* ===========================
* By using std::iostream's, you can support stream filters. Simply create a
* stream that performs the compression or encryption, and use that stream to
* read and write.
*/
/**
* Structure representing the common header for all FFXIVARR packets.
*
* 0 4 8 12 14 16
* +-------------------------------+---------------+-------+-------+
* | unknown_0 | unknown_8 |
* +-------------------------------+---------------+-------+-------+
* | timestamp | size | cType | count |
* +---+---+-------+---------------+---------------+-------+-------+
* | ? |CMP| ? | ? |
* +---+---+-------+---------------+
* (followed by /count/ FFXIVARR_PACKET_SEGMENTs)
*/
struct FFXIVARR_PACKET_HEADER
{ {
/**
* Anticipated usage:
* ==================
* Set up a stream buffer to collect the bytes to be transmitted as a packet.
* Now, you can do the following (given you have the structs filled out already).
*
* FFXIVARR_PACKET_HEADER pkt_hdr = { . . . };
* FFXIVARR_PACKET_SEGMENT_HEADER pkt_seg_hdr[n] = { . . . };
*
* std::stringstream buf;
* buf << pkt_hdr;
* for( int i = 0; i < n; i++ )
* {
* buf << pkt_seg_hdr[i];
* buf << {pkt_seg_data[i]};
* }
*
* The reverse can be done parsing a packet. Remember to validate the packet
* type before parsing the headers.
*
* Compression and Encryption:
* ===========================
* By using std::iostream's, you can support stream filters. Simply create a
* stream that performs the compression or encryption, and use that stream to
* read and write.
*/
/**
* Structure representing the common header for all FFXIVARR packets.
*
* 0 4 8 12 14 16
* +-------------------------------+---------------+-------+-------+
* | unknown_0 | unknown_8 |
* +-------------------------------+---------------+-------+-------+
* | timestamp | size | cType | count |
* +---+---+-------+---------------+---------------+-------+-------+
* | ? |CMP| ? | ? |
* +---+---+-------+---------------+
* (followed by /count/ FFXIVARR_PACKET_SEGMENTs)
*/
struct FFXIVARR_PACKET_HEADER
{
/** Unknown data, no actual use has been determined */ /** Unknown data, no actual use has been determined */
uint64_t unknown_0; uint64_t unknown_0;
uint64_t unknown_8; uint64_t unknown_8;
@ -66,35 +65,35 @@ struct FFXIVARR_PACKET_HEADER
/** Indicates if the data segments of this packet are compressed. */ /** Indicates if the data segments of this packet are compressed. */
uint8_t isCompressed; uint8_t isCompressed;
uint32_t unknown_24; uint32_t unknown_24;
}; };
inline std::ostream& operator<<( std::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 std::istream& operator>>( std::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 );
} }
/** /**
* Structure representing the header portion of a packet segment. * Structure representing the header portion of a packet segment.
* *
* NOTE: If the main packet header indicated the packet is compressed, this * NOTE: If the main packet header indicated the packet is compressed, this
* header will be compressed as well! The header will NOT ever be encrypted. * header will be compressed as well! The header will NOT ever be encrypted.
* *
* 0 4 8 12 16 * 0 4 8 12 16
* +---------------+---------------+---------------+-------+-------+ * +---------------+---------------+---------------+-------+-------+
* | size | source_actor | target_actor | type | pad | * | size | source_actor | target_actor | type | pad |
* +---------------+---------------+---------------+-------+-------+ * +---------------+---------------+---------------+-------+-------+
* | | * | |
* : type-specific data of length, size, follows : * : type-specific data of length, size, follows :
* | (NOTE: Some segments MAY be encrypted) | * | (NOTE: Some segments MAY be encrypted) |
* +---------------------------------------------------------------+ * +---------------------------------------------------------------+
*/ */
struct FFXIVARR_PACKET_SEGMENT_HEADER struct FFXIVARR_PACKET_SEGMENT_HEADER
{ {
/** The size of the segment header and its data. */ /** The size of the segment header and its data. */
uint32_t size; uint32_t size;
/** The session ID this segment describes. */ /** The session ID this segment describes. */
@ -104,83 +103,81 @@ struct FFXIVARR_PACKET_SEGMENT_HEADER
/** The segment type. (1, 2, 3, 7, 8, 9, 10) */ /** The segment type. (1, 2, 3, 7, 8, 9, 10) */
uint16_t type; uint16_t type;
uint16_t padding; uint16_t padding;
}; };
inline std::ostream& operator<<( std::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 std::istream& operator>>( std::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 );
} }
template< int T > template< int T >
struct FFXIVIpcBasePacket struct FFXIVIpcBasePacket
{ {
/** Creates a constant representing the IPC type */ /** Creates a constant representing the IPC type */
enum enum
{ {
_ServerIpcType = T _ServerIpcType = T
}; };
}; };
struct FFXIVARR_PACKET_RAW struct FFXIVARR_PACKET_RAW
{ {
FFXIVARR_PACKET_SEGMENT_HEADER segHdr; FFXIVARR_PACKET_SEGMENT_HEADER segHdr;
std::vector< uint8_t > data; std::vector< uint8_t > data;
}; };
/** /**
* Indicates the type of the segment * Indicates the type of the segment
* IPC type will contain an additional header: FFXIVARR_PACKET_SEGMENT_HEADER + FFXIVARR_IPC_HEADER + data * IPC type will contain an additional header: FFXIVARR_PACKET_SEGMENT_HEADER + FFXIVARR_IPC_HEADER + data
* The remaining types don't contain an additonal header, FFXIVARR_PACKET_SEGMENT_HEADER + data * The remaining types don't contain an additonal header, FFXIVARR_PACKET_SEGMENT_HEADER + data
*/ */
enum FFXIVARR_SEGMENT_TYPE enum FFXIVARR_SEGMENT_TYPE
{ {
SEGMENTTYPE_SESSIONINIT = 1, SEGMENTTYPE_SESSIONINIT = 1,
SEGMENTTYPE_IPC = 3, SEGMENTTYPE_IPC = 3,
SEGMENTTYPE_KEEPALIVE = 7, SEGMENTTYPE_KEEPALIVE = 7,
//SEGMENTTYPE_RESPONSE = 8, //SEGMENTTYPE_RESPONSE = 8,
SEGMENTTYPE_ENCRYPTIONINIT = 9, SEGMENTTYPE_ENCRYPTIONINIT = 9,
}; };
/** /**
* Structural representation of the common header for IPC packet segments. * Structural representation of the common header for IPC packet segments.
* NOTE: This is packet segment type 3. * NOTE: This is packet segment type 3.
* *
* 0 4 6 8 12 16 * 0 4 6 8 12 16
* +-------+-------+------+----------+---------------+---------------+ * +-------+-------+------+----------+---------------+---------------+
* | 14 00 | type | pad | serverId | timestamp | pad1 | * | 14 00 | type | pad | serverId | timestamp | pad1 |
* +-------+-------+------+----------+---------------+---------------+ * +-------+-------+------+----------+---------------+---------------+
* | | * | |
* : data : * : data :
* | | * | |
* +-----------------------------------------------------------------+ * +-----------------------------------------------------------------+
*/ */
struct FFXIVARR_IPC_HEADER struct FFXIVARR_IPC_HEADER
{ {
uint16_t reserved; uint16_t reserved;
uint16_t type; uint16_t type;
uint16_t padding; uint16_t padding;
uint16_t serverId; uint16_t serverId;
uint32_t timestamp; uint32_t timestamp;
uint32_t padding1; uint32_t padding1;
}; };
inline std::ostream& operator<<( std::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 std::istream& operator>>( std::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 );
} }
} /* Packets */ }
} /* Network */
} /* Core */
#endif /*_CORE_NETWORK_PACKETS_COMMON_H*/ #endif /*_CORE_NETWORK_PACKETS_COMMON_H*/

View file

@ -12,25 +12,24 @@
#include "Acceptor.h" #include "Acceptor.h"
#include <memory> #include <memory>
namespace Core { namespace Core::Network
namespace Network {
//-----------------------------------------------------------------------------
class Hive;
class Acceptor;
class Connection;
//-----------------------------------------------------------------------------
class Connection : public std::enable_shared_from_this< Connection >
{ {
class Hive;
class Acceptor;
class Connection;
//-----------------------------------------------------------------------------
class Connection : public std::enable_shared_from_this< Connection >
{
friend class Acceptor; friend class Acceptor;
friend class Hive; friend class Hive;
protected: protected:
HivePtr m_hive; HivePtr m_hive;
asio::ip::tcp::socket m_socket; asio::ip::tcp::socket m_socket;
asio::strand m_io_strand; asio::strand m_io_strand;
@ -45,7 +44,7 @@ protected:
virtual ~Connection(); virtual ~Connection();
private: private:
Connection( const Connection& rhs ); Connection( const Connection& rhs );
Connection& operator=( const Connection& rhs ); Connection& operator=( const Connection& rhs );
@ -67,7 +66,7 @@ private:
void HandleRecv( const asio::error_code& error, int32_t actual_bytes ); void HandleRecv( const asio::error_code& error, int32_t actual_bytes );
private: private:
// Called when the connection has successfully connected to the local host. // Called when the connection has successfully connected to the local host.
virtual void OnAccept( const std::string& host, uint16_t port ) virtual void OnAccept( const std::string& host, uint16_t port )
{ {
@ -98,7 +97,7 @@ private:
{ {
}; };
public: public:
// Returns the Hive object. // Returns the Hive object.
HivePtr GetHive(); HivePtr GetHive();
@ -138,15 +137,15 @@ public:
// Posts an asynchronous disconnect event for the object to process. // Posts an asynchronous disconnect event for the object to process.
void Disconnect(); void Disconnect();
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template< class T > 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 )
{ {
try try
{ {
AcceptorPtr acceptor( new Acceptor( pHive ) ); AcceptorPtr acceptor( new Acceptor( pHive ) );
@ -159,10 +158,7 @@ std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port
{ {
throw; throw;
} }
} }
}
} }
#endif #endif

View file

@ -14,57 +14,56 @@
#include "CommonNetwork.h" #include "CommonNetwork.h"
#include "PacketDef/Ipcs.h" #include "PacketDef/Ipcs.h"
namespace Core { namespace Core::Network::Packets
namespace Network {
namespace Packets {
// Must forward define these in order to enable the compiler to produce the
// correct template functions.
template< typename T, typename T1 >
class FFXIVIpcPacket;
template< class T >
using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >;
template< class T >
using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >;
template< class T >
using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
template< class T, typename... Args >
std::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
{ {
// Must forward define these in order to enable the compiler to produce the
// correct template functions.
template< typename T, typename T1 >
class FFXIVIpcPacket;
template< class T >
using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >;
template< class T >
using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >;
template< class T >
using LobbyChannelPacket = FFXIVIpcPacket< T, ServerLobbyIpcType >;
template< class T, typename... Args >
std::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
{
return std::make_shared< ZoneChannelPacket< T > >( args... ); return std::make_shared< ZoneChannelPacket< T > >( args... );
} }
template< class T, typename... Args > template< class T, typename... Args >
std::shared_ptr< T > makeWrappedPacket( Args... args ) std::shared_ptr< T > makeWrappedPacket( Args... args )
{ {
return std::make_shared< T >( args... ); return std::make_shared< T >( args... );
} }
template< class T, typename... Args > template< class T, typename... Args >
std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args ) std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
{ {
return std::make_shared< ChatChannelPacket< T > >( args... ); return std::make_shared< ChatChannelPacket< T > >( args... );
} }
template< class T, typename... Args > template< class T, typename... Args >
std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args ) std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args )
{ {
return std::make_shared< LobbyChannelPacket< T > >( args... ); return std::make_shared< LobbyChannelPacket< T > >( args... );
} }
/** /**
* The base implementation of a game packet. Needed for parsing packets. * The base implementation of a game packet. Needed for parsing packets.
*/ */
template< typename T1 > template< typename T1 >
class FFXIVIpcPacketBase class FFXIVIpcPacketBase
{ {
public: public:
virtual ~FFXIVIpcPacketBase() = default; virtual ~FFXIVIpcPacketBase() = default;
/** /**
@ -72,13 +71,13 @@ public:
* type of a parsed packet.) * type of a parsed packet.)
*/ */
virtual T1 ipcType() = 0; virtual T1 ipcType() = 0;
}; };
////////////////////////////////////////////////7 ////////////////////////////////////////////////7
class FFXIVPacketBase class FFXIVPacketBase
{ {
public: public:
FFXIVPacketBase() : FFXIVPacketBase() :
m_segmentType( 0 ) m_segmentType( 0 )
{ {
@ -103,12 +102,12 @@ public:
return {}; return {};
} }
protected: protected:
/** The segment header */ /** The segment header */
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr; FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
uint16_t m_segmentType; uint16_t m_segmentType;
public: public:
virtual uint32_t getContentSize() virtual uint32_t getContentSize()
{ {
return 0; return 0;
@ -174,13 +173,13 @@ public:
m_segHdr.type = getSegmentType(); m_segHdr.type = getSegmentType();
} }
}; };
template< typename T, typename T1 > template< typename T, typename T1 >
class FFXIVIpcPacket : class FFXIVIpcPacket :
public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase
{ {
public: public:
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) : FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) :
FFXIVPacketBase( 3, sourceActorId, targetActorId ) FFXIVPacketBase( 3, sourceActorId, targetActorId )
{ {
@ -249,7 +248,7 @@ public:
return m_data; return m_data;
} }
protected: protected:
/** Initializes the fields of the header structures */ /** Initializes the fields of the header structures */
virtual void initialize() virtual void initialize()
{ {
@ -263,18 +262,18 @@ protected:
m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
}; };
protected: protected:
/** The IPC packet header */ /** The IPC packet header */
FFXIVARR_IPC_HEADER m_ipcHdr; FFXIVARR_IPC_HEADER m_ipcHdr;
/** The underlying data portion of the packet as a structure */ /** The underlying data portion of the packet as a structure */
T m_data; T m_data;
}; };
class FFXIVRawPacket : class FFXIVRawPacket :
public FFXIVPacketBase public FFXIVPacketBase
{ {
public: public:
FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) : FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) :
m_data( std::vector< uint8_t >( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ) ), m_data( std::vector< uint8_t >( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ) ),
FFXIVPacketBase( type, sourceActorId, targetActorId ) FFXIVPacketBase( type, sourceActorId, targetActorId )
@ -318,7 +317,7 @@ public:
return m_data; return m_data;
}; };
protected: protected:
/** Initializes the fields of the header structures */ /** Initializes the fields of the header structures */
virtual void initialize() virtual void initialize()
{ {
@ -326,14 +325,12 @@ protected:
memset( &m_data[ 0 ], 0, m_data.size() ); memset( &m_data[ 0 ], 0, m_data.size() );
}; };
protected: protected:
/** The underlying data portion of the packet as a structure */ /** The underlying data portion of the packet as a structure */
std::vector< uint8_t > m_data; std::vector< uint8_t > m_data;
}; };
} /* Packets */ }
} /* Network */
} /* Core */
#endif /*_CORE_NETWORK_PACKETS_CGAMEPACKETNEW_H*/ #endif /*_CORE_NETWORK_PACKETS_CGAMEPACKETNEW_H*/

View file

@ -3,12 +3,11 @@
#include "CommonNetwork.h" #include "CommonNetwork.h"
namespace Core { namespace Core::Network::Packets
namespace Network {
namespace Packets {
enum PacketParseResult
{ {
enum PacketParseResult
{
/// Dissected game packet successfully /// Dissected game packet successfully
Success, Success,
@ -17,37 +16,34 @@ enum PacketParseResult
/// Invalid data detected. /// Invalid data detected.
Malformed Malformed
}; };
/// Read packet header from buffer with given offset. /// Read packet header from buffer with given offset.
/// Buffer with given offset must be pointing to start of the new FFXIV packet. /// Buffer with given offset must be pointing to start of the new FFXIV packet.
PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset, PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
FFXIVARR_PACKET_HEADER& header ); FFXIVARR_PACKET_HEADER& header );
/// Read packet header from buffer with given offset. /// Read packet header from buffer with given offset.
/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data. /// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed. /// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed.
PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset, PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset,
FFXIVARR_PACKET_SEGMENT_HEADER& header ); FFXIVARR_PACKET_SEGMENT_HEADER& header );
/// Read packets from the buffer with given offset. /// Read packets from the buffer with given offset.
/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data. /// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data.
PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset, PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset,
const FFXIVARR_PACKET_HEADER& header, const FFXIVARR_PACKET_HEADER& header,
std::vector< Packets::FFXIVARR_PACKET_RAW >& packets ); std::vector< Packets::FFXIVARR_PACKET_RAW >& packets );
/// Read single packet from the buffer with given offset. /// Read single packet from the buffer with given offset.
/// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data. /// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data.
PacketParseResult getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset, PacketParseResult getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset,
FFXIVARR_PACKET_RAW& packet ); FFXIVARR_PACKET_RAW& packet );
bool checkHeader( const FFXIVARR_PACKET_HEADER& header ); bool checkHeader( const FFXIVARR_PACKET_HEADER& header );
bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header ); bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header );
} }
}
}
#endif #endif

View file

@ -5,22 +5,22 @@
#include <atomic> #include <atomic>
#include <memory> #include <memory>
namespace Core { namespace Core:: Network
namespace Network {
class Hive : public std::enable_shared_from_this< Hive >
{ {
private:
class Hive : public std::enable_shared_from_this< Hive >
{
private:
asio::io_service m_io_service; asio::io_service m_io_service;
std::shared_ptr< asio::io_service::work > m_work_ptr; std::shared_ptr< asio::io_service::work > m_work_ptr;
std::atomic< uint32_t > m_shutdown; std::atomic< uint32_t > m_shutdown;
private: private:
Hive( const Hive& rhs ); Hive( const Hive& rhs );
Hive& operator=( const Hive& rhs ); Hive& operator=( const Hive& rhs );
public: public:
Hive(); Hive();
virtual ~Hive(); virtual ~Hive();
@ -48,9 +48,7 @@ public:
// Restarts the networking system after Stop as been called. A new work // Restarts the networking system after Stop as been called. A new work
// object is created ad the shutdown flag is cleared. // object is created ad the shutdown flag is cleared.
void Reset(); void Reset();
}; };
} }
}
//-----------------------------------------------------------------------------
#endif #endif

View file

@ -8,15 +8,14 @@
#include "GamePacketNew.h" #include "GamePacketNew.h"
#include "Forwards.h" #include "Forwards.h"
namespace Core { namespace Core::Network::Packets
namespace Network {
namespace Packets {
typedef std::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr;
class PacketContainer
{ {
public:
using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >;
class PacketContainer
{
public:
PacketContainer( uint32_t segmentTargetOverride = 0 ); PacketContainer( uint32_t segmentTargetOverride = 0 );
~PacketContainer(); ~PacketContainer();
@ -31,13 +30,11 @@ public:
void fillSendBuffer( std::vector< uint8_t >& sendBuffer ); void fillSendBuffer( std::vector< uint8_t >& sendBuffer );
private: private:
uint32_t m_segmentTargetOverride; uint32_t m_segmentTargetOverride;
}; };
}
}
} }
#endif #endif

View file

@ -7,12 +7,13 @@
#include <algorithm> #include <algorithm>
#include <utility> #include <utility>
namespace Core { namespace Core
template< class T >
class LockedQueue
{ {
public:
template< class T >
class LockedQueue
{
public:
LockedQueue(); LockedQueue();
~LockedQueue(); ~LockedQueue();
@ -33,37 +34,37 @@ public:
std::size_t size(); std::size_t size();
protected: protected:
std::queue< T > m_queue; std::queue< T > m_queue;
std::mutex m_mutex; std::mutex m_mutex;
}; };
template< class T > template< class T >
LockedQueue< T >::LockedQueue() LockedQueue< T >::LockedQueue()
{ {
} }
template< class T > template< class T >
std::size_t LockedQueue< T >::size() std::size_t LockedQueue< T >::size()
{ {
std::lock_guard< std::mutex > lock( m_mutex ); std::lock_guard< std::mutex > lock( m_mutex );
return m_queue.size(); return m_queue.size();
} }
template< class T > template< class T >
LockedQueue< T >::~LockedQueue() LockedQueue< T >::~LockedQueue()
{ {
} }
template< class T > template< class T >
T LockedQueue< T >::pop() T LockedQueue< T >::pop()
{ {
std::lock_guard< std::mutex > lock( m_mutex ); std::lock_guard< std::mutex > lock( m_mutex );
if( m_queue.empty() ) if( m_queue.empty() )
@ -76,18 +77,18 @@ T LockedQueue< T >::pop()
m_queue.pop(); m_queue.pop();
return result; return result;
} }
template< class T > template< class T >
void LockedQueue< T >::push( const T object ) void LockedQueue< T >::push( const T object )
{ {
std::lock_guard< std::mutex > lock( m_mutex ); std::lock_guard< std::mutex > lock( m_mutex );
m_queue.push( object ); m_queue.push( object );
} }
template< class T > template< class T >
void LockedQueue< T >::push_swap( T& object ) void LockedQueue< T >::push_swap( T& object )
{ {
std::lock_guard< std::mutex > lock( m_mutex ); std::lock_guard< std::mutex > lock( m_mutex );
m_queue.push( object ); m_queue.push( object );
@ -105,11 +106,11 @@ void LockedQueue< T >::push_swap( T& object )
// this will allow that the object on the queue is the *last* shared_ptr // this will allow that the object on the queue is the *last* shared_ptr
// in existance by the time this function returns. // in existance by the time this function returns.
} }
template< class T > template< class T >
void LockedQueue< T >::push_reset( T& object ) void LockedQueue< T >::push_reset( T& object )
{ {
std::lock_guard< std::mutex > lock( m_mutex ); std::lock_guard< std::mutex > lock( m_mutex );
m_queue.push( object ); m_queue.push( object );
@ -123,6 +124,6 @@ void LockedQueue< T >::push_reset( T& object )
// this will allow that the object on the queue is the *last* shared_ptr // this will allow that the object on the queue is the *last* shared_ptr
// in existance by the time this function returns. // in existance by the time this function returns.
} }
} }

View file

@ -8,18 +8,19 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
namespace Core { namespace Core
template< typename T >
class LockedWaitQueue
{ {
private:
template< typename T >
class LockedWaitQueue
{
private:
std::mutex m_queueLock; std::mutex m_queueLock;
std::queue< T > m_queue; std::queue< T > m_queue;
std::condition_variable m_condition; std::condition_variable m_condition;
std::atomic< bool > m_shutdown; std::atomic< bool > m_shutdown;
public: public:
LockedWaitQueue< T >() : LockedWaitQueue< T >() :
m_shutdown( false ) m_shutdown( false )
@ -88,7 +89,7 @@ public:
m_condition.notify_all(); m_condition.notify_all();
} }
private: private:
template< typename E = T > template< typename E = T >
typename std::enable_if< std::is_pointer< E >::value >::type deleteQueuedObject( E& obj ) typename std::enable_if< std::is_pointer< E >::value >::type deleteQueuedObject( E& obj )
{ {
@ -99,7 +100,7 @@ private:
typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& ) typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& )
{ {
} }
}; };
} }
#endif #endif

View file

@ -5,12 +5,14 @@
#include <unordered_map> #include <unordered_map>
#include <type_traits> #include <type_traits>
namespace Core { namespace Core::Util
namespace Util {
template< typename T, typename ActorIdType = uint32_t >
class SpawnIndexAllocator
{ {
public:
template< typename T, typename ActorIdType = uint32_t >
class SpawnIndexAllocator
{
public:
static_assert( std::is_same< T, uint8_t >::value || std::is_same< T, uint16_t >::value || static_assert( std::is_same< T, uint8_t >::value || std::is_same< T, uint16_t >::value ||
std::is_same< T, uint32_t >::value || std::is_same< T, uint64_t >::value, std::is_same< T, uint32_t >::value || std::is_same< T, uint64_t >::value,
"T must be uint8_t, uint16_t, uint32_t, uint64_t" ); "T must be uint8_t, uint16_t, uint32_t, uint64_t" );
@ -76,7 +78,7 @@ public:
return static_cast< T >( -1 ); return static_cast< T >( -1 );
} }
protected: protected:
void setupQueue() void setupQueue()
{ {
assert( m_maxSlotId != 0 ); assert( m_maxSlotId != 0 );
@ -100,9 +102,7 @@ protected:
T m_maxSlotId; T m_maxSlotId;
bool m_reserveFirstSlot; bool m_reserveFirstSlot;
}; };
} }
}
#endif //SAPPHIRE_SPAWNINDEXALLOCATOR_H #endif //SAPPHIRE_SPAWNINDEXALLOCATOR_H

View file

@ -5,33 +5,34 @@
#include <string> #include <string>
#include <functional> #include <functional>
namespace Core::Util { namespace Core::Util
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
void eraseAll( std::string& inOutStr, char remove );
void eraseAllIn( std::string& inOutStr, std::string& remove );
std::string toLowerCopy( const std::string& inStr );
uint64_t getTimeMs();
int64_t getTimeSeconds();
uint64_t getEorzeanTimeStamp();
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
template <class T>
inline void hashCombine( std::size_t& seed, const T& v )
{ {
std::hash<T> hasher;
std::string binaryToHexString( uint8_t* pBinData, uint16_t size );
std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
void eraseAll( std::string& inOutStr, char remove );
void eraseAllIn( std::string& inOutStr, std::string& remove );
std::string toLowerCopy( const std::string& inStr );
uint64_t getTimeMs();
int64_t getTimeSeconds();
uint64_t getEorzeanTimeStamp();
void valueToFlagByteIndexValue( uint32_t inVal, uint8_t& outVal, uint16_t& outIndex );
template <class T>
inline void hashCombine( std::size_t& seed, const T& v )
{
std::hash< T > hasher;
seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ); seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
} }
} }

View file

@ -5,31 +5,30 @@
#define PI 3.14159265358979323846f #define PI 3.14159265358979323846f
namespace Core { namespace Core::Math::Util
namespace Math {
namespace Util {
float distanceSq( float x, float y, float z, float x1, float y1, float z1 );
float distance( float x, float y, float z, float x1, float y1, float z1 );
float distance2DSq( float x, float y, float x1, float y1 );
float distance2D( float x, float y, float x1, float y1 );
float calcAngTo( float x, float y, float x1, float y1 );
float calcAngFrom( float x, float y, float x1, float y1 );
uint16_t floatToUInt16( float val );
uint16_t floatToUInt16Rot( float val );
uint8_t floatToUInt8Rot( float val );
template < typename T >
T clamp( T val, T minimum, T maximum )
{ {
float distanceSq( float x, float y, float z, float x1, float y1, float z1 );
float distance( float x, float y, float z, float x1, float y1, float z1 );
float distance2DSq( float x, float y, float x1, float y1 );
float distance2D( float x, float y, float x1, float y1 );
float calcAngTo( float x, float y, float x1, float y1 );
float calcAngFrom( float x, float y, float x1, float y1 );
uint16_t floatToUInt16( float val );
uint16_t floatToUInt16Rot( float val );
uint8_t floatToUInt8Rot( float val );
template < typename T >
T clamp( T val, T minimum, T maximum )
{
if( val > maximum ) if( val > maximum )
return maximum; return maximum;
@ -37,10 +36,8 @@ T clamp( T val, T minimum, T maximum )
return minimum; return minimum;
return val; return val;
} }
}
}
} }
#endif #endif

View file

@ -3,13 +3,10 @@
#include <string> #include <string>
namespace Core { namespace Core::Version
namespace Version { {
extern const std::string GIT_HASH;
extern const std::string GIT_HASH; extern const std::string VERSION;
extern const std::string VERSION; }
} /* Version */
} /* Core */
#endif #endif

View file

@ -56,7 +56,7 @@ foreach(_scriptDir ${children})
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp")
cotire("script_${_name}") #cotire("script_${_name}")
if(MSVC) if(MSVC)
add_custom_command(TARGET "script_${_name}" POST_BUILD add_custom_command(TARGET "script_${_name}" POST_BUILD

View file

@ -10,6 +10,8 @@
#define AETHERYTE_MENU_FAVORITE_POINT 4 #define AETHERYTE_MENU_FAVORITE_POINT 4
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5 #define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
using namespace Core;
class Aethernet : class Aethernet :
public EventScript public EventScript
{ {

View file

@ -12,6 +12,8 @@
#define AETHERYTE_MENU_FAVORITE_POINT 4 #define AETHERYTE_MENU_FAVORITE_POINT 4
#define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5 #define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5
using namespace Core;
class Aetheryte : class Aetheryte :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefCutSceneReplay : class CmnDefCutSceneReplay :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefHousingSignboard : class CmnDefHousingSignboard :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefInnBed : class CmnDefInnBed :
public EventScript public EventScript
{ {

View file

@ -5,6 +5,8 @@
#define ACTION_RENAME 3 #define ACTION_RENAME 3
#define ACTION_REMOVE 4 #define ACTION_REMOVE 4
using namespace Core;
class CmnDefLinkShell : class CmnDefLinkShell :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefMarketBoardGridania : class CmnDefMarketBoardGridania :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefMogLetter : class CmnDefMogLetter :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefNpcRepair : class CmnDefNpcRepair :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class CmnDefWeatherForeCast : class CmnDefWeatherForeCast :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class ComDefMobHuntBoard : class ComDefMobHuntBoard :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class GilShop : class GilShop :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class HouFurOrchestrion : class HouFurOrchestrion :
public EventScript public EventScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors101110 : class ThePalaceoftheDeadFloors101110 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors110 : class ThePalaceoftheDeadFloors110 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors111120 : class ThePalaceoftheDeadFloors111120 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors1120 : class ThePalaceoftheDeadFloors1120 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors121130 : class ThePalaceoftheDeadFloors121130 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors131140 : class ThePalaceoftheDeadFloors131140 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors141150 : class ThePalaceoftheDeadFloors141150 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors151160 : class ThePalaceoftheDeadFloors151160 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors161170 : class ThePalaceoftheDeadFloors161170 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors171180 : class ThePalaceoftheDeadFloors171180 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors181190 : class ThePalaceoftheDeadFloors181190 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors191200 : class ThePalaceoftheDeadFloors191200 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors2130 : class ThePalaceoftheDeadFloors2130 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors3140 : class ThePalaceoftheDeadFloors3140 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors4150 : class ThePalaceoftheDeadFloors4150 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors5160 : class ThePalaceoftheDeadFloors5160 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors6170 : class ThePalaceoftheDeadFloors6170 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors7180 : class ThePalaceoftheDeadFloors7180 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors8190 : class ThePalaceoftheDeadFloors8190 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ThePalaceoftheDeadFloors91100 : class ThePalaceoftheDeadFloors91100 :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class AlaMhigo : class AlaMhigo :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class AmdaporKeep : class AmdaporKeep :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class AmdaporKeepHard : class AmdaporKeepHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class BaelsarsWall : class BaelsarsWall :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class BardamsMettle : class BardamsMettle :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class BrayfloxsLongstop : class BrayfloxsLongstop :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class BrayfloxsLongstopHard : class BrayfloxsLongstopHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class CastrumAbania : class CastrumAbania :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class CastrumMeridianum : class CastrumMeridianum :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class CopperbellMines : class CopperbellMines :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class CopperbellMinesHard : class CopperbellMinesHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class CuttersCry : class CuttersCry :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class DomaCastle : class DomaCastle :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class DzemaelDarkhold : class DzemaelDarkhold :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class Halatali : class Halatali :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class HalataliHard : class HalataliHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class HaukkeManor : class HaukkeManor :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class HaukkeManorHard : class HaukkeManorHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class HellsLid : class HellsLid :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class HullbreakerIsle : class HullbreakerIsle :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class HullbreakerIsleHard : class HullbreakerIsleHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class KuganeCastle : class KuganeCastle :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class Neverreap : class Neverreap :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class PharosSirius : class PharosSirius :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class PharosSiriusHard : class PharosSiriusHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class SaintMociannesArboretum : class SaintMociannesArboretum :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -2,6 +2,8 @@
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
#include <Actor/Player.h> #include <Actor/Player.h>
using namespace Core;
class Sastasha : class Sastasha :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class SastashaHard : class SastashaHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class ShisuioftheVioletTides : class ShisuioftheVioletTides :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class Snowcloak : class Snowcloak :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class SohmAl : class SohmAl :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class SohmAlHard : class SohmAlHard :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class SohrKhai : class SohrKhai :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class TheAery : class TheAery :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class TheAetherochemicalResearchFacility : class TheAetherochemicalResearchFacility :
public InstanceContentScript public InstanceContentScript
{ {

View file

@ -1,6 +1,8 @@
#include <ScriptObject.h> #include <ScriptObject.h>
#include <Zone/InstanceContent.h> #include <Zone/InstanceContent.h>
using namespace Core;
class TheAntitower : class TheAntitower :
public InstanceContentScript public InstanceContentScript
{ {

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