diff --git a/CMakeLists.txt b/CMakeLists.txt index 055e39b3..8fb79881 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,14 +16,14 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) # set(Boost_DEBUG 1) -if(NOT SAPPHIRE_BOOST_VER) - set(SAPPHIRE_BOOST_VER 1.60.0) +if( NOT SAPPHIRE_BOOST_VER ) + set( SAPPHIRE_BOOST_VER 1.63.0 ) endif() -set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_60_0) +set( SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0 ) ########################################################################## # Common and library path -set(LIBRARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/libraries") +set( LIBRARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/libraries" ) ########################################################################## # Dependencies and compiler settings @@ -34,22 +34,22 @@ include( "cmake/cotire.cmake" ) ############################## # Git # ############################## -include(GetGitRevisionDescription) -get_git_head_revision(GIT_REFSPEC GIT_SHA1) -git_describe(VERSION --all --dirty=-d) -configure_file("src/common/Version.cpp.in" - "src/common/Version.cpp" @ONLY) +include( GetGitRevisionDescription ) +get_git_head_revision( GIT_REFSPEC GIT_SHA1 ) +git_describe( VERSION --all --dirty=-d ) +configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/common/Version.cpp.in" + "${CMAKE_CURRENT_SOURCE_DIR}/src/common/Version.cpp" @ONLY ) ########################################################################## -add_subdirectory("src/libraries/sapphire/datReader") -add_subdirectory("src/libraries/sapphire/mysqlConnector") -add_subdirectory("src/common") +add_subdirectory( "src/libraries/sapphire/datReader" ) +add_subdirectory( "src/libraries/sapphire/mysqlConnector" ) +add_subdirectory( "src/common" ) -add_subdirectory("src/servers") +add_subdirectory( "src/servers" ) -add_subdirectory("src/tools/exd_common_gen") -add_subdirectory("src/tools/exd_struct_gen") -add_subdirectory("src/tools/exd_struct_test") -add_subdirectory("src/tools/quest_parser") +add_subdirectory( "src/tools/exd_common_gen" ) +add_subdirectory( "src/tools/exd_struct_gen" ) +add_subdirectory( "src/tools/exd_struct_test" ) +add_subdirectory( "src/tools/quest_parser" ) #add_subdirectory("src/tools/pcb_reader") #add_subdirectory("src/tools/event_object_parser") diff --git a/src/common/Common.h b/src/common/Common.h index d1a8810d..f99a7c77 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -12,704 +12,736 @@ // They are also defined within the Core::Common namespace to avoid collisions. // +--------------------------------------------------------------------------- namespace Core { -namespace 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; + // 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; + const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000; - struct FFXIVARR_POSITION3 - { - float x; - float y; - float z; - }; - - enum EquipSlot : uint8_t - { - MainHand = 0, - OffHand = 1, - Head = 2, - Body = 3, - Hands = 4, - Waist = 5, - Legs = 6, - Feet = 7, - Neck = 8, - Ear = 9, - Wrist = 10, - Ring1 = 11, - Ring2 = 12, - SoulCrystal = 13, - }; - - enum InventoryType : uint16_t - { - Bag0 = 0, - Bag1 = 1, - Bag2 = 2, - Bag3 = 3, - - GearSet0 = 1000, - GearSet1 = 1001, - - Currency = 2000, - Crystal = 2001, - //UNKNOWN_0 = 2003, - KeyItem = 2004, - DamagedGear = 2007, - //UNKNOWN_1 = 2008, - - ArmoryOff = 3200, - ArmoryHead = 3201, - ArmoryBody = 3202, - ArmoryHand = 3203, - ArmoryWaist = 3204, - ArmoryLegs = 3205, - ArmoryFeet = 3206, - ArmotyNeck = 3207, - ArmoryEar = 3208, - ArmoryWrist = 3209, - ArmoryRing = 3300, - - ArmorySoulCrystal = 3400, - ArmoryMain = 3500, - - RetainerBag0 = 10000, - RetainerBag1 = 10001, - RetainerBag2 = 10002, - RetainerBag3 = 10003, - RetainerBag4 = 10004, - RetainerBag5 = 10005, - RetainerBag6 = 10006, - RetainerEquippedGear = 11000, - RetainerGil = 12000, - RetainerCrystal = 12001, - RetainerMarket = 12002, - - FreeCompanyBag0 = 20000, - FreeCompanyBag1 = 20001, - FreeCompanyBag2 = 20002, - FreeCompanyGil = 22000, - FreeCompanyCrystal = 22001 - }; - - - enum struct ZoneingType : uint8_t - { - None = 1, - Teleport = 2, - Return = 3, - ReturnDead = 4, - FadeIn = 5, - }; - - enum struct ResurrectType : uint8_t - { - None = 0, - RaiseSpell = 5, - Return = 8 - }; - - enum Gender : uint8_t - { - Male = 0, - Female = 1, - }; - - - - enum struct GCRank : uint8_t - { - None = 0, - PrivateThirdClass = 1, - PrivateSecondClass = 2, - PrivateFirstClass = 3, - Corporal = 4, - SergeantThirdClass = 5, - SergeantSecondClass = 6, - SergeantFirstClass = 7, - ChiefSergeant = 8, - SecondLieutenant = 9, - FirstLieutenant = 10, - Captain = 11, - SecondCommander = 12, - FirstCommander = 13, - HighCommander = 14, - RearMarshal = 15, - ViceMarshal = 16, - Marshal = 17, - GrandMarshal = 18, - Champion = 19, - }; - - /** - * Structural representation of the packet sent by the server - * Send the entire StatusEffect list - */ - struct StatusEffect - { - uint16_t effect_id; - uint16_t unknown1; - float duration; - uint32_t sourceActorId; - }; - - enum CharaLook : uint8_t - { - Race = 0x00, - Gender = 0x01, - Tribe = 0x04, - Height = 0x03, - ModelType = 0x02, // Au Ra: changes horns/tails, everything else: seems to drastically change appearance (flip between two sets, odd/even numbers). sometimes retains hairstyle and other features - FaceType = 0x05, - HairStyle = 0x06, - HasHighlights = 0x07, // negative to enable, positive to disable - SkinColor = 0x08, - EyeColor = 0x09, // color of character's right eye - HairColor = 0x0A, // main color - HairColor2 = 0x0B, // highlights color - FaceFeatures = 0x0C, // seems to be a toggle, (-odd and +even for large face covering), opposite for small - FaceFeaturesColor = 0x0D, - Eyebrows = 0x0E, - EyeColor2 = 0x0F, // color of character's left eye - EyeShape = 0x10, - NoseShape = 0x11, - JawShape = 0x12, - LipStyle = 0x13, // lip colour depth and shape (negative values around -120 darker/more noticeable, positive no colour) - LipColor = 0x14, - RaceFeatureSize = 0x15, - RaceFeatureType = 0x16, // negative or out of range tail shapes for race result in no tail (e.g. Au Ra has max of 4 tail shapes), incorrect value can crash client - BustSize = 0x17, // char creator allows up to max of 100, i set to 127 cause who wouldnt but no visible difference - Facepaint = 0x18, - FacepaintColor = 0x19, - - }; - - enum MoveType : uint16_t - { - Run = 0x00, - Walk = 0x02, - Strafe = 0x04, - Jump = 0x100, - Fall = 0x400, - Land = 0x200, - }; - - struct QuestActive - { - QuestActive() + struct FFXIVARR_POSITION3 { - c.questId = 0; - c.sequence = 0; - c.flags = 0; - c.UI8A = 0; - c.UI8B = 0; - c.UI8C = 0; - c.UI8D = 0; - c.UI8E = 0; - c.UI8F = 0; - c.padding = 0; - } + float x; + float y; + float z; + }; - - union + enum EquipSlot : uint8_t { - struct - { - uint16_t questId; - uint8_t sequence; - uint8_t flags; - uint8_t padding; - uint8_t BitFlag48; - uint8_t BitFlag40; - uint8_t BitFlag32; - uint8_t BitFlag24; - uint8_t BitFlag16; - uint8_t BitFlag8; - uint8_t padding1; - } a; + MainHand = 0, + OffHand = 1, + Head = 2, + Body = 3, + Hands = 4, + Waist = 5, + Legs = 6, + Feet = 7, + Neck = 8, + Ear = 9, + Wrist = 10, + Ring1 = 11, + Ring2 = 12, + SoulCrystal = 13, + }; - struct - { - uint16_t questId; - uint8_t sequence; - uint8_t flags; - uint8_t padding; - uint8_t UI8AL : 4; - uint8_t UI8AH : 4; - uint8_t UI8BL : 4; - uint8_t UI8BH : 4; - uint8_t UI8CL : 4; - uint8_t UI8CH : 4; - uint8_t UI8DL : 4; - uint8_t UI8DH : 4; - uint8_t UI8EL : 4; - uint8_t UI8EH : 4; - uint8_t UI8FL : 4; - uint8_t UI8FH : 4; - uint8_t padding1; - } b; + enum InventoryType : uint16_t + { + Bag0 = 0, + Bag1 = 1, + Bag2 = 2, + Bag3 = 3, - struct - { - uint16_t questId; - uint8_t sequence; - uint8_t flags; - uint8_t padding; - uint8_t UI8A; - uint8_t UI8B; - uint8_t UI8C; - uint8_t UI8D; - uint8_t UI8E; - uint8_t UI8F; - uint8_t padding1; - } c; + GearSet0 = 1000, + GearSet1 = 1001, - //struct - //{ - // uint16_t questId; - // uint8_t sequence; - // uint8_t flags; - // uint8_t padding; - // uint16_t UI16A; - // uint16_t UI16B; - // uint16_t UI16C; - // uint8_t padding1; - //} d; + Currency = 2000, + Crystal = 2001, + //UNKNOWN_0 = 2003, + KeyItem = 2004, + DamagedGear = 2007, + //UNKNOWN_1 = 2008, - //struct - //{ - // uint8_t padding; - // uint32_t UI32A; - // uint16_t padding2; - //} e; + ArmoryOff = 3200, + ArmoryHead = 3201, + ArmoryBody = 3202, + ArmoryHand = 3203, + ArmoryWaist = 3204, + ArmoryLegs = 3205, + ArmoryFeet = 3206, + ArmotyNeck = 3207, + ArmoryEar = 3208, + ArmoryWrist = 3209, + ArmoryRing = 3300, + + ArmorySoulCrystal = 3400, + ArmoryMain = 3500, + + RetainerBag0 = 10000, + RetainerBag1 = 10001, + RetainerBag2 = 10002, + RetainerBag3 = 10003, + RetainerBag4 = 10004, + RetainerBag5 = 10005, + RetainerBag6 = 10006, + RetainerEquippedGear = 11000, + RetainerGil = 12000, + RetainerCrystal = 12001, + RetainerMarket = 12002, + + FreeCompanyBag0 = 20000, + FreeCompanyBag1 = 20001, + FreeCompanyBag2 = 20002, + FreeCompanyGil = 22000, + FreeCompanyCrystal = 22001 }; - }; - - enum struct ActionAspect : uint8_t - { - None = 0, // Doesn't imply unaspected - Fire = 1, - Ice = 2, - Wind = 3, - Stone = 4, - Lightning = 5, - Water = 6, - Unaspected = 7 // Doesn't imply magical unaspected damage - could be unaspected physical - }; - - enum class ActionType : int8_t - { - WeaponOverride = -1, // Needs more investigation (takes the damage type of the equipped weapon)? - Unknown_0 = 0, - Slashing = 1, - Piercing = 2, - Blunt = 3, - Unknown_4 = 4, - Magical = 5, - Darkness = 6, - Unknown_7 = 7, - LimitBreak = 8, - }; - - enum ActionEffectType : uint8_t - { - Nothing = 0, - Miss = 1, - FullResist = 2, - Damage = 3, - Heal = 4, - BlockedDamage = 5, - ParriedDamage = 6, - Invulnerable = 7, - NoEffectText = 8, - Unknown_0 = 9, - MpLoss = 10, - MpGain = 11, - TpLoss = 12, - TpGain = 13, - GpGain = 14, - Mount = 38 - }; - - enum class ActionHitSeverityType : uint8_t - { - NormalDamage = 0, - CritHeal = 0, - CritDamage = 1, - NormalHeal = 1, - DirectHitDamage = 2, - CritDirectHitDamage = 3 - }; - - enum class ActionCollisionType : uint8_t - { - None, - SingleTarget, - Circle, - Cone, - Box, - Unknown, - Unknown2, - PersistentArea, // for when you set aoe like asylum - Unknown3 - }; - - enum HandleActionType : uint8_t - { - Event, - Spell, - Teleport - }; - - enum HandleSkillType : uint8_t - { - StdDamage, - StdHeal, - StdDot, - }; - - enum InvincibilityType : uint8_t - { - InvincibilityNone, - InvincibilityRefill, - InvincibilityStayAlive, - }; - - enum PlayerStateFlag : uint8_t - { - HideUILockChar = 0, // as the name suggests, hides the ui and logs the char... - InCombat = 1, // in Combat, locks gearchange/return/teleport - Casting = 2, - InNpcEvent = 7, // when talking to an npc, locks ui giving "occupied" message - - InNpcEvent1 = 10, // Sent together with InNpcEvent, when waiting for input? just a guess... - - BetweenAreas = 24, - BoundByDuty = 28, - WatchingCutscene = 50, // this is actually just a dummy, this id is different - - - }; - - enum struct FateStatus : uint8_t - { - Active = 2, - Inactive = 4, - Preparing = 7, - Completed = 8, - }; - - enum ActorControlType : uint16_t - { - ToggleWeapon = 0x01, - SetStatus = 0x02, - CastStart = 0x03, - ToggleAggro = 0x04, - ClassJobChange = 0x05, - DefeatMsg = 0x06, - GainExpMsg = 0x07, - - LevelUpEffect = 0x0A, - - ExpChainMsg = 0x0C, - HpSetStat = 0x0D, - DeathAnimation = 0x0E, - CastInterrupt = 0x0F, - - ActionStart = 0x11, - - StatusEffectGain = 0x14, - StatusEffectLose = 0x15, - - HPFloatingText = 0x17, - UpdateRestedExp = 0x018, - Unk2 = 0x19, + enum struct ZoneingType : uint8_t + { + None = 1, + Teleport = 2, + Return = 3, + ReturnDead = 4, + FadeIn = 5, + }; + + enum struct ResurrectType : uint8_t + { + None = 0, + RaiseSpell = 5, + Return = 8 + }; + + enum Gender : uint8_t + { + Male = 0, + Female = 1, + }; + + + + enum struct GCRank : uint8_t + { + None = 0, + PrivateThirdClass = 1, + PrivateSecondClass = 2, + PrivateFirstClass = 3, + Corporal = 4, + SergeantThirdClass = 5, + SergeantSecondClass = 6, + SergeantFirstClass = 7, + ChiefSergeant = 8, + SecondLieutenant = 9, + FirstLieutenant = 10, + Captain = 11, + SecondCommander = 12, + FirstCommander = 13, + HighCommander = 14, + RearMarshal = 15, + ViceMarshal = 16, + Marshal = 17, + GrandMarshal = 18, + Champion = 19, + }; + + /** + * Structural representation of the packet sent by the server + * Send the entire StatusEffect list + */ + struct StatusEffect + { + uint16_t effect_id; + uint16_t unknown1; + float duration; + uint32_t sourceActorId; + }; + + enum CharaLook : uint8_t + { + Race = 0x00, + Gender = 0x01, + Tribe = 0x04, + Height = 0x03, + ModelType = 0x02, // Au Ra: changes horns/tails, everything else: seems to drastically change appearance (flip between two sets, odd/even numbers). sometimes retains hairstyle and other features + FaceType = 0x05, + HairStyle = 0x06, + HasHighlights = 0x07, // negative to enable, positive to disable + SkinColor = 0x08, + EyeColor = 0x09, // color of character's right eye + HairColor = 0x0A, // main color + HairColor2 = 0x0B, // highlights color + FaceFeatures = 0x0C, // seems to be a toggle, (-odd and +even for large face covering), opposite for small + FaceFeaturesColor = 0x0D, + Eyebrows = 0x0E, + EyeColor2 = 0x0F, // color of character's left eye + EyeShape = 0x10, + NoseShape = 0x11, + JawShape = 0x12, + LipStyle = 0x13, // lip colour depth and shape (negative values around -120 darker/more noticeable, positive no colour) + LipColor = 0x14, + RaceFeatureSize = 0x15, + RaceFeatureType = 0x16, // negative or out of range tail shapes for race result in no tail (e.g. Au Ra has max of 4 tail shapes), incorrect value can crash client + BustSize = 0x17, // char creator allows up to max of 100, i set to 127 cause who wouldnt but no visible difference + Facepaint = 0x18, + FacepaintColor = 0x19, + + }; + + enum MoveType : uint16_t + { + Run = 0x00, + Walk = 0x02, + Strafe = 0x04, + Jump = 0x100, + Fall = 0x400, + Land = 0x200, + }; + + struct QuestActive + { + QuestActive() + { + c.questId = 0; + c.sequence = 0; + c.flags = 0; + c.UI8A = 0; + c.UI8B = 0; + c.UI8C = 0; + c.UI8D = 0; + c.UI8E = 0; + c.UI8F = 0; + c.padding = 0; + } + + + union + { + struct + { + uint16_t questId; + uint8_t sequence; + uint8_t flags; + uint8_t padding; + uint8_t BitFlag48; + uint8_t BitFlag40; + uint8_t BitFlag32; + uint8_t BitFlag24; + uint8_t BitFlag16; + uint8_t BitFlag8; + uint8_t padding1; + } a; + + struct + { + uint16_t questId; + uint8_t sequence; + uint8_t flags; + uint8_t padding; + uint8_t UI8AL : 4; + uint8_t UI8AH : 4; + uint8_t UI8BL : 4; + uint8_t UI8BH : 4; + uint8_t UI8CL : 4; + uint8_t UI8CH : 4; + uint8_t UI8DL : 4; + uint8_t UI8DH : 4; + uint8_t UI8EL : 4; + uint8_t UI8EH : 4; + uint8_t UI8FL : 4; + uint8_t UI8FH : 4; + uint8_t padding1; + } b; + + struct + { + uint16_t questId; + uint8_t sequence; + uint8_t flags; + uint8_t padding; + uint8_t UI8A; + uint8_t UI8B; + uint8_t UI8C; + uint8_t UI8D; + uint8_t UI8E; + uint8_t UI8F; + uint8_t padding1; + } c; + + //struct + //{ + // uint16_t questId; + // uint8_t sequence; + // uint8_t flags; + // uint8_t padding; + // uint16_t UI16A; + // uint16_t UI16B; + // uint16_t UI16C; + // uint8_t padding1; + //} d; + + //struct + //{ + // uint8_t padding; + // uint32_t UI32A; + // uint16_t padding2; + //} e; + }; + + + }; + + enum struct ActionAspect : uint8_t + { + None = 0, // Doesn't imply unaspected + Fire = 1, + Ice = 2, + Wind = 3, + Stone = 4, + Lightning = 5, + Water = 6, + Unaspected = 7 // Doesn't imply magical unaspected damage - could be unaspected physical + }; + + enum class ActionType : int8_t + { + WeaponOverride = -1, // Needs more investigation (takes the damage type of the equipped weapon)? + Unknown_0 = 0, + Slashing = 1, + Piercing = 2, + Blunt = 3, + Unknown_4 = 4, + Magical = 5, + Darkness = 6, + Unknown_7 = 7, + LimitBreak = 8, + }; + + enum ActionEffectType : uint8_t + { + Nothing = 0, + Miss = 1, + FullResist = 2, + Damage = 3, + Heal = 4, + BlockedDamage = 5, + ParriedDamage = 6, + Invulnerable = 7, + NoEffectText = 8, + Unknown_0 = 9, + MpLoss = 10, + MpGain = 11, + TpLoss = 12, + TpGain = 13, + GpGain = 14, + Mount = 38 + }; + + enum class ActionHitSeverityType : uint8_t + { + NormalDamage = 0, + CritHeal = 0, + CritDamage = 1, + NormalHeal = 1, + DirectHitDamage = 2, + CritDirectHitDamage = 3 + }; + + enum class ActionCollisionType : uint8_t + { + None, + SingleTarget, + Circle, + Cone, + Box, + Unknown, + Unknown2, + PersistentArea, // for when you set aoe like asylum + Unknown3 + }; + + enum HandleActionType : uint8_t + { + Event, + Spell, + Teleport + }; + + enum HandleSkillType : uint8_t + { + StdDamage, + StdHeal, + StdDot, + }; + + enum InvincibilityType : uint8_t + { + InvincibilityNone, + InvincibilityRefill, + InvincibilityStayAlive, + }; + + enum PlayerStateFlag : uint8_t + { + HideUILockChar = 0, // as the name suggests, hides the ui and logs the char... + InCombat = 1, // in Combat, locks gearchange/return/teleport + Casting = 2, + InNpcEvent = 7, // when talking to an npc, locks ui giving "occupied" message + + InNpcEvent1 = 10, // Sent together with InNpcEvent, when waiting for input? just a guess... + + BetweenAreas = 24, + BoundByDuty = 28, + WatchingCutscene = 50, // this is actually just a dummy, this id is different + + + }; + + enum struct FateStatus : uint8_t + { + Active = 2, + Inactive = 4, + Preparing = 7, + Completed = 8, + }; + + enum ActorControlType : uint16_t + { + ToggleWeapon = 0x01, + SetStatus = 0x02, + CastStart = 0x03, + ToggleAggro = 0x04, + ClassJobChange = 0x05, + DefeatMsg = 0x06, + GainExpMsg = 0x07, + + LevelUpEffect = 0x0A, + + ExpChainMsg = 0x0C, + HpSetStat = 0x0D, + DeathAnimation = 0x0E, + CastInterrupt = 0x0F, + + ActionStart = 0x11, + + StatusEffectGain = 0x14, + StatusEffectLose = 0x15, + + HPFloatingText = 0x17, + UpdateRestedExp = 0x018, + Unk2 = 0x19, - Flee = 0x1B, + Flee = 0x1B, - Unk3 = 0x20, // Animation related? + Unk3 = 0x20, // Animation related? - CombatIndicationShow = 0x22, + CombatIndicationShow = 0x22, - SpawnEffect = 0x25, - ToggleInvisible = 0x26, + SpawnEffect = 0x25, + ToggleInvisible = 0x26, - ToggleActionUnlock = 0x29, + ToggleActionUnlock = 0x29, - UpdateUiExp = 0x2B, - DmgTakenMsg = 0x2D, + UpdateUiExp = 0x2B, + DmgTakenMsg = 0x2D, - SetTarget = 0x32, - ToggleNameHidden = 0x36, + SetTarget = 0x32, + ToggleNameHidden = 0x36, - LimitbreakStart = 0x47, - LimitbreakPartyStart = 0x48, - BubbleText = 0x49, + LimitbreakStart = 0x47, + LimitbreakPartyStart = 0x48, + BubbleText = 0x49, - DamageEffect = 0x50, - RaiseAnimation = 0x51, - TreasureScreenMsg = 0x57, - SetOwnerId = 0x59, - ItemRepairMsg = 0x5C, + DamageEffect = 0x50, + RaiseAnimation = 0x51, + TreasureScreenMsg = 0x57, + SetOwnerId = 0x59, + ItemRepairMsg = 0x5C, - DirectorInit = 0x64, - DirectorClear = 0x65, + DirectorInit = 0x64, + DirectorClear = 0x65, - LeveStartAnim = 0x66, - LeveStartError = 0x67, - DirectorEObjMod = 0x6A, + LeveStartAnim = 0x66, + LeveStartError = 0x67, + DirectorEObjMod = 0x6A, - DirectorUpdate = 0x6D, + DirectorUpdate = 0x6D, - ItemObtainMsg = 0x75, - DutyQuestScreenMsg = 0x7B, + ItemObtainMsg = 0x75, + DutyQuestScreenMsg = 0x7B, - ItemObtainIcon = 0x84, - FateItemFailMsg = 0x85, - ItemFailMsg = 0x86, - ActionLearnMsg1 = 0x87, + ItemObtainIcon = 0x84, + FateItemFailMsg = 0x85, + ItemFailMsg = 0x86, + ActionLearnMsg1 = 0x87, - FreeEventPos = 0x8A, + FreeEventPos = 0x8A, - UnlockAetherCurrentMsg = 0xA4, + UnlockAetherCurrentMsg = 0xA4, - RemoveName = 0xA8, + RemoveName = 0xA8, - ScreenFadeOut = 0xAA, + ScreenFadeOut = 0xAA, - ZoneIn = 0xC8, - ZoneInDefaultPos = 0xC9, + ZoneIn = 0xC8, + ZoneInDefaultPos = 0xC9, - TeleportStart = 0xCB, + TeleportStart = 0xCB, - TeleportDone = 0xCD, - TeleportDoneFadeOut = 0xCE, - DespawnZoneScreenMsg = 0xCF, + TeleportDone = 0xCD, + TeleportDoneFadeOut = 0xCE, + DespawnZoneScreenMsg = 0xCF, - InstanceSelectDlg = 0xD2, - ActorDespawnEffect = 0xD4, + InstanceSelectDlg = 0xD2, + ActorDespawnEffect = 0xD4, - CompanionUnlock = 0xFD, - ObtainBarding = 0xFE, - EquipBarding = 0xFF, + CompanionUnlock = 0xFD, + ObtainBarding = 0xFE, + EquipBarding = 0xFF, - CompanionMsg1 = 0x102, - CompanionMsg2 = 0x103, - ShowPetHotbar = 0x104, + CompanionMsg1 = 0x102, + CompanionMsg2 = 0x103, + ShowPetHotbar = 0x104, - ActionLearnMsg = 0x109, - ActorFadeOut = 0x10A, - ActorFadeIn = 0x10B, - WithdrawMsg = 0x10C, - OrderMinion = 0x10D, - ToggleMinion = 0x10E, - LearnMinion = 0x10F, - ActorFateOut1 = 0x110, + ActionLearnMsg = 0x109, + ActorFadeOut = 0x10A, + ActorFadeIn = 0x10B, + WithdrawMsg = 0x10C, + OrderMinion = 0x10D, + ToggleMinion = 0x10E, + LearnMinion = 0x10F, + ActorFateOut1 = 0x110, - Emote = 0x122, + Emote = 0x122, - SetPose = 0x127, + SetPose = 0x127, - CraftingUnk = 0x12C, + CraftingUnk = 0x12C, - GatheringSenseMsg = 0x130, - PartyMsg = 0x131, - GatheringSenseMsg1 = 0x132, + GatheringSenseMsg = 0x130, + PartyMsg = 0x131, + GatheringSenseMsg1 = 0x132, - GatheringSenseMsg2 = 0x138, + GatheringSenseMsg2 = 0x138, - FishingMsg = 0x140, + FishingMsg = 0x140, - FishingBaitMsg = 0x145, + FishingBaitMsg = 0x145, - FishingReachMsg = 0x147, - FishingFailMsg = 0x148, + FishingReachMsg = 0x147, + FishingFailMsg = 0x148, - MateriaConvertMsg = 0x15E, - MeldSuccessMsg = 0x15F, - MeldFailMsg = 0x160, - MeldModeToggle = 0x161, + MateriaConvertMsg = 0x15E, + MeldSuccessMsg = 0x15F, + MeldFailMsg = 0x160, + MeldModeToggle = 0x161, - AetherRestoreMsg = 0x163, + AetherRestoreMsg = 0x163, - DyeMsg = 0x168, + DyeMsg = 0x168, - ToggleCrestMsg = 0x16A, - ToggleBulkCrestMsg = 0x16B, - MateriaRemoveMsg = 0x16C, - GlamourCastMsg = 0x16D, - GlamourRemoveMsg = 0x16E, - - RelicInfuseMsg = 0x179, - - AetherReductionDlg = 0x17D, - - Unk6 = 0x19C, - - SetTitle = 0x1F4, - - SetStatusIcon = 0x1F8, - - SetHomepoint = 0x1FB, - SetFavorite = 0x1FC, - LearnTeleport = 0x1FD, - - ArmoryErrorMsg = 0x201, - - AchievementPopup = 0x203, - - Unk7 = 0x205, // LogMessage? - AchievementMsg = 0x206, - - SetItemLevel = 0x209, - - ChallengeEntryCompleteMsg = 0x20B, - ChallengeEntryUnlockMsg = 0x20C, - - GilTrailMsg = 0x211, - - SetMaxGearSets = 0x230, - - SetCharaGearParamUI = 0x260, - - GearSetEquipMsg = 0x321, - - DisableCurrentFestival = 0x386, - - ToggleOrchestrionUnlock = 0x396, - Dismount = 0x3a0 - }; - - enum struct ChatType : uint16_t - { - LogKindError, - ServerDebug, - ServerUrgent, - ServerNotice, - Unused4, - Unused5, - Unused6, - Unused7, - Unused8, - Unused9, - Say, - Shout, - Tell, - TellReceive, - Party, - Alliance, - LS1, - LS2, - LS3, - LS4, - LS5, - LS6, - LS7, - LS8, - FreeCompany, - Unused25, - Unused26, - NoviceNetwork, - CustomEmote, - StandardEmote, - Yell, - Unknown31, - PartyUnk2, - Unused33, - Unused34, - Unused35, - Unused36, - Unused37, - Unused38, - Unused39, - Unused40, - BattleDamage, - BattleFailed, - BattleActions, - BattleItems, - BattleHealing, - BattleBeneficial, - BattleDetrimental, - BattleUnk48, - BattleUnk49, - Unused50, - Unused51, - Unused52, - Unused53, - Unused54, - Unused55, - Echo, - SystemMessage, - SystemErrorMessage, - BattleSystem, - GatheringSystem, - NPCMessage, - LootMessage, - Unused63, - CharProgress, - Loot, - Crafting, - Gathering, - NPCAnnouncement, - FCAnnouncement, - FCLogin, - RetainerSale, - PartySearch, - PCSign, - DiceRoll, - NoviceNetworkNotice, - Unknown76, - Unused77, - Unused78, - Unused79, - GMTell, - GMSay, - GMShout, - GMYell, - GMParty, - GMFreeCompany, - GMLS1, - GMLS2, - GMLS3, - GMLS4, - GMLS5, - GMLS6, - GMLS7, - GMLS8, - GMNoviceNetwork, - Unused95, - Unused96, - Unused97, - Unused98, - Unused99, - Unused100 - }; - - enum EquipDisplayFlags : uint8_t - { - HideNothing = 0x0, - HideHead = 0x1, - HideWeapon = 0x2, - LegacyMark = 0x4, - - Visor = 0x40, - }; - - enum SkillType : uint8_t - { - Normal = 0x1, - MountSkill = 0xD, - }; - - typedef std::vector< PlayerStateFlag > PlayerStateFlagList; - -} /* Common */ + ToggleCrestMsg = 0x16A, + ToggleBulkCrestMsg = 0x16B, + MateriaRemoveMsg = 0x16C, + GlamourCastMsg = 0x16D, + GlamourRemoveMsg = 0x16E, + + RelicInfuseMsg = 0x179, + + AetherReductionDlg = 0x17D, + + Unk6 = 0x19C, + + SetTitle = 0x1F4, + + SetStatusIcon = 0x1F8, + + SetHomepoint = 0x1FB, + SetFavorite = 0x1FC, + LearnTeleport = 0x1FD, + + ArmoryErrorMsg = 0x201, + + AchievementPopup = 0x203, + + Unk7 = 0x205, // LogMessage? + AchievementMsg = 0x206, + + SetItemLevel = 0x209, + + ChallengeEntryCompleteMsg = 0x20B, + ChallengeEntryUnlockMsg = 0x20C, + + GilTrailMsg = 0x211, + + SetMaxGearSets = 0x230, + + SetCharaGearParamUI = 0x260, + + GearSetEquipMsg = 0x321, + + DisableCurrentFestival = 0x386, + + ToggleOrchestrionUnlock = 0x396, + Dismount = 0x3a0 + }; + + enum struct ChatType : uint16_t + { + LogKindError, + ServerDebug, + ServerUrgent, + ServerNotice, + Unused4, + Unused5, + Unused6, + Unused7, + Unused8, + Unused9, + Say, + Shout, + Tell, + TellReceive, + Party, + Alliance, + LS1, + LS2, + LS3, + LS4, + LS5, + LS6, + LS7, + LS8, + FreeCompany, + Unused25, + Unused26, + NoviceNetwork, + CustomEmote, + StandardEmote, + Yell, + Unknown31, + PartyUnk2, + Unused33, + Unused34, + Unused35, + Unused36, + Unused37, + Unused38, + Unused39, + Unused40, + BattleDamage, + BattleFailed, + BattleActions, + BattleItems, + BattleHealing, + BattleBeneficial, + BattleDetrimental, + BattleUnk48, + BattleUnk49, + Unused50, + Unused51, + Unused52, + Unused53, + Unused54, + Unused55, + Echo, + SystemMessage, + SystemErrorMessage, + BattleSystem, + GatheringSystem, + NPCMessage, + LootMessage, + Unused63, + CharProgress, + Loot, + Crafting, + Gathering, + NPCAnnouncement, + FCAnnouncement, + FCLogin, + RetainerSale, + PartySearch, + PCSign, + DiceRoll, + NoviceNetworkNotice, + Unknown76, + Unused77, + Unused78, + Unused79, + GMTell, + GMSay, + GMShout, + GMYell, + GMParty, + GMFreeCompany, + GMLS1, + GMLS2, + GMLS3, + GMLS4, + GMLS5, + GMLS6, + GMLS7, + GMLS8, + GMNoviceNetwork, + Unused95, + Unused96, + Unused97, + Unused98, + Unused99, + Unused100 + }; + + enum EquipDisplayFlags : uint8_t + { + HideNothing = 0x0, + HideHead = 0x1, + HideWeapon = 0x2, + LegacyMark = 0x4, + + Visor = 0x40, + }; + + enum SkillType : uint8_t + { + Normal = 0x1, + MountSkill = 0xD, + }; + + enum SocialCategory : uint8_t + { + Party = 1, + Friends = 2, + FreeCompanyPetition = 4, + FreeCompany = 5, + }; + + enum SocialListType : uint8_t + { + PartyList = 0x02, + FriendList = 0x0b, + SearchList = 0x0e, + }; + + + // todo: rename SocialRequestAction and SocialRequestResponse cause they seem ambiguous + enum class SocialRequestAction : uint8_t + { + Invite = 1, + Cancel = 2, + Accept = 3, + Decline = 4, + }; + + enum class SocialRequestResponse : uint8_t + { + Decline, + Accept, + Cancel, + }; + + typedef std::vector< PlayerStateFlag > PlayerStateFlagList; + + } /* Common */ } /* Core */ #endif diff --git a/src/common/Database/DbConnection.cpp b/src/common/Database/DbConnection.cpp index a4353394..366fc954 100644 --- a/src/common/Database/DbConnection.cpp +++ b/src/common/Database/DbConnection.cpp @@ -1,13 +1,13 @@ #include "DbConnection.h" #include "DbWorker.h" #include - #include "Logging/Logger.h" + #include "PreparedStatement.h" #include +#include "Framework.h" - -extern Core::Logger g_log; +extern Core::Framework g_fw; Core::Db::DbConnection::DbConnection( ConnectionInfo &connInfo ) : m_reconnecting( false ), @@ -67,7 +67,7 @@ uint32_t Core::Db::DbConnection::open() } catch( std::runtime_error& e ) { - g_log.error( e.what() ); + g_fw.get< Logger >()->error( e.what() ); return 1; } @@ -119,7 +119,7 @@ bool Core::Db::DbConnection::execute( const std::string& sql ) } catch( std::runtime_error& e ) { - g_log.error( e.what() ); + g_fw.get< Logger >()->error( e.what() ); return false; } } @@ -134,7 +134,7 @@ boost::shared_ptr< Mysql::ResultSet > Core::Db::DbConnection::query( const std:: } catch( std::runtime_error& e ) { - g_log.error( e.what() ); + g_fw.get< Logger >()->error( e.what() ); return nullptr; } } @@ -148,13 +148,11 @@ boost::shared_ptr< Mysql::ResultSet > Core::Db::DbConnection::query( boost::shar if( !ping() ) { - g_log.error( "MysqlConnection went down" ); // naivly reconnect and hope for the best open(); lockIfReady(); if( !prepareStatements() ) - g_log.error( "Mysql Statements failed to prepare..." ); - g_log.info( "MysqlConnection reestablished" ); + return nullptr; } uint32_t index = stmt->getIndex(); @@ -172,7 +170,7 @@ boost::shared_ptr< Mysql::ResultSet > Core::Db::DbConnection::query( boost::shar } catch( std::runtime_error& e ) { - g_log.error( e.what() ); + g_fw.get< Logger >()->error( e.what() ); return nullptr; } @@ -198,7 +196,7 @@ bool Core::Db::DbConnection::execute( boost::shared_ptr< Core::Db::PreparedState } catch( std::runtime_error& e ) { - g_log.error( e.what() ); + g_fw.get< Logger >()->error( e.what() ); return false; } } @@ -234,7 +232,7 @@ void Core::Db::DbConnection::prepareStatement( uint32_t index, const std::string } catch( std::runtime_error& e ) { - g_log.error( e.what() ); + g_fw.get< Logger >()->error( e.what() ); m_prepareError = true; } diff --git a/src/common/Database/DbLoader.cpp b/src/common/Database/DbLoader.cpp index 376d7b77..56cd4be2 100644 --- a/src/common/Database/DbLoader.cpp +++ b/src/common/Database/DbLoader.cpp @@ -3,8 +3,9 @@ #include "CharaDbConnection.h" #include "DbWorkerPool.h" #include "Logging/Logger.h" +#include "Framework.h" -extern Core::Logger g_log; +extern Core::Framework g_fw; Core::Db::DbLoader::DbLoader() { @@ -16,12 +17,14 @@ Core::Db::DbLoader& Core::Db::DbLoader::addDb( Core::Db::DbWorkerPool< T >& pool m_open.push([this, info, &pool]() -> bool { + + auto pLog = g_fw.get< Logger >(); const uint8_t asyncThreads = info.asyncThreads; const uint8_t synchThreads = info.syncThreads; if( asyncThreads < 1 || asyncThreads > 32 ) { - g_log.error( "database: invalid number of worker threads specified. Please pick a value between 1 and 32." ); + pLog->error( "database: invalid number of worker threads specified. Please pick a value between 1 and 32." ); return false; } @@ -36,7 +39,7 @@ Core::Db::DbLoader& Core::Db::DbLoader::addDb( Core::Db::DbWorkerPool< T >& pool if( error ) { - g_log.error( "DatabasePool failed to open." ); + pLog->error( "DatabasePool failed to open." ); return false; } } @@ -50,7 +53,8 @@ Core::Db::DbLoader& Core::Db::DbLoader::addDb( Core::Db::DbWorkerPool< T >& pool { if( !pool.prepareStatements() ) { - g_log.error( "Could not prepare statements of the database, see log for details." ); + auto pLog = g_fw.get< Logger >(); + pLog->error( "Could not prepare statements of the database, see log for details." ); return false; } return true; @@ -104,5 +108,5 @@ bool Core::Db::DbLoader::process( std::queue< Predicate >& queue ) template Core::Db::DbLoader& Core::Db::DbLoader::addDb< Core::Db::CharaDbConnection >( Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >&, - const ConnectionInfo& ); + const ConnectionInfo& ); diff --git a/src/common/Database/DbWorkerPool.cpp b/src/common/Database/DbWorkerPool.cpp index 24529f01..785b857d 100644 --- a/src/common/Database/DbWorkerPool.cpp +++ b/src/common/Database/DbWorkerPool.cpp @@ -6,9 +6,11 @@ #include "Operation.h" #include "CharaDbConnection.h" #include +#include "Framework.h" #include "Logging/Logger.h" -extern Core::Logger g_log; + +extern Core::Framework g_fw; class PingOperation : public Core::Db::Operation { @@ -46,7 +48,8 @@ void Core::Db::DbWorkerPool< T >::setConnectionInfo( const ConnectionInfo& info, template< class T > uint32_t Core::Db::DbWorkerPool< T >::open() { - g_log.info( "[DbPool] Opening DatabasePool " + getDatabaseName() + + auto pLog = g_fw.get< Logger >(); + pLog->info( "[DbPool] Opening DatabasePool " + getDatabaseName() + " Asynchronous connections: " + std::to_string( m_asyncThreads ) + " Synchronous connections: " + std::to_string( m_synchThreads ) ); @@ -59,7 +62,7 @@ uint32_t Core::Db::DbWorkerPool< T >::open() if( !error ) { - g_log.info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " + + pLog->info( "[DbPool] DatabasePool " + getDatabaseName() + " opened successfully. " + std::to_string( ( m_connections[IDX_SYNCH].size() + m_connections[IDX_ASYNC].size() ) ) + " total connections running." ); } @@ -70,10 +73,11 @@ uint32_t Core::Db::DbWorkerPool< T >::open() template< class T > void Core::Db::DbWorkerPool< T >::close() { - g_log.info("[DbPool] Closing down DatabasePool " + getDatabaseName() ); + auto pLog = g_fw.get< Logger >(); + pLog->info("[DbPool] Closing down DatabasePool " + getDatabaseName() ); m_connections[IDX_ASYNC].clear(); m_connections[IDX_SYNCH].clear(); - g_log.info("[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." ); + pLog->info("[DbPool] All connections on DatabasePool " + getDatabaseName() + "closed." ); } template< class T > diff --git a/src/common/Forwards.h b/src/common/Forwards.h index 515bfe0e..0325e222 100644 --- a/src/common/Forwards.h +++ b/src/common/Forwards.h @@ -2,6 +2,11 @@ #define _COMMON_FORWARDS_H #include +#include + +using namespace std::chrono_literals; +using time_point = std::chrono::steady_clock::time_point; +using duration = std::chrono::steady_clock::duration; namespace Core { diff --git a/src/common/Framework.cpp b/src/common/Framework.cpp new file mode 100644 index 00000000..9951e8a2 --- /dev/null +++ b/src/common/Framework.cpp @@ -0,0 +1,5 @@ +#include "Framework.h" + +#include +#include +#include diff --git a/src/common/Framework.h b/src/common/Framework.h new file mode 100644 index 00000000..d6e57fbc --- /dev/null +++ b/src/common/Framework.h @@ -0,0 +1,37 @@ +#ifndef _CORE_FRAMEWORK_H +#define _CORE_FRAMEWORK_H + +#include +#include +#include +#include +#include + +namespace Core +{ + + class Framework + { + using TypenameToObject = std::map< std::type_index, boost::shared_ptr< void > >; + TypenameToObject ObjectMap; + + public: + template< typename T > + boost::shared_ptr< T > get() + { + auto iType = ObjectMap.find( typeid( T ) ); + assert( !( iType == ObjectMap.end() ) ); + return boost::static_pointer_cast< T >( iType->second ); + } + + template< typename T > + void set( boost::shared_ptr< T > value ) + { + assert( value ); // why would anyone store nullptrs.... + ObjectMap[typeid( T )] = value; + } + }; + +} + +#endif // _CORE_FRAMEWORK_H diff --git a/src/common/Network/PacketDef/Ipcs.h b/src/common/Network/PacketDef/Ipcs.h index fe3785af..0c565c60 100644 --- a/src/common/Network/PacketDef/Ipcs.h +++ b/src/common/Network/PacketDef/Ipcs.h @@ -1,7 +1,7 @@ #ifndef _CORE_NETWORK_PACKETS_IPCS_H #define _CORE_NETWORK_PACKETS_IPCS_H -#include +#include namespace Core { namespace Network { @@ -72,9 +72,10 @@ namespace Packets { Playtime = 0x00DF, // updated 4.2 CFRegistered = 0x00B8, // updated 4.1 - SocialRequestResponse = 0x00BB, // updated 4.1 CancelAllianceForming = 0x00C6, // updated 4.2 Chat = 0x00E1, // updated 4.2 + SocialRequestResponse = 0x00E5, // updated 4.1 + SocialRequestReceive = 0x00E6, // updated 4.2 SocialList = 0x00E7, // updated 4.2 UpdateSearchInfo = 0x00EA, // updated 4.2 diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index a5ffa9b5..c86bbccf 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -81,19 +81,64 @@ struct FFXIVIpcPlayTime : FFXIVIpcBasePacket */ struct PlayerEntry { uint64_t contentId; - uint8_t bytes[12]; + uint32_t timestamp; + uint8_t bytes[4]; + uint8_t status; // bitmask. friend: if it's a request, if added, recipient/sender + uint8_t unknown; // maybe bitmask? a value of 4 sets it to linkshell request + uint8_t entryIcon; // observed in friend group icon, sideffects for displaying text + uint8_t unavailable; // bool uint16_t zoneId; - uint16_t zoneId1; - char bytes1[8]; + uint8_t grandCompany; + uint8_t clientLanguage; + uint8_t knownLanguages; // bitmask, J 0x01, E 0x02, D 0x04, F 0x08 + uint8_t searchComment; // bool + char bytes1[6]; uint64_t onlineStatusMask; - uint8_t classJob; + Common::ClassJob classJob; uint8_t padding; - uint8_t level; - uint8_t padding1; + uint16_t level; uint16_t padding2; uint8_t one; char name[0x20]; - char fcTag[9]; + char fcTag[5]; +}; + +struct FFXIVIpcSocialRequestReceive : FFXIVIpcBasePacket +{ + uint32_t actorId; // actor id of player which initiated request + uint16_t unknown; + uint16_t unknown2; + uint32_t timestamp; // must be greater than current time + uint8_t unknown3; + uint8_t unknown4; // Very likely cross-world related + Common::SocialCategory category; // 1 - party invite, 2 - friends request, 3 - ??, 4 - fc signature request, 5 - fc invite, + uint8_t unknown5; + Common::SocialRequestAction action; // 0 - ??, 1 - received, 2 - canceled, 4 - friend accept/fc sign/fc join, 5 - refuse fc petition/decline invite + uint8_t unknown6; + char name[0x20]; + uint16_t unknown7; + uint16_t unknown8; + uint16_t unknown9; +}; + +struct FFXIVIpcSocialRequestError : FFXIVIpcBasePacket +{ + uint32_t messageId; // if 0 then type's message is used (type must 2/4/5 or it wont print) + Common::SocialCategory category; // 2 - friend request, 4 - fc petition, 5 - fc invitation, anything else and wont print + uint8_t unknown; // possibly padding + char name[0x20]; + uint8_t unknown3[2]; // probably padding + +}; + +struct FFXIVIpcSocialRequestResponse : FFXIVIpcBasePacket +{ + uint64_t contentId; + uint32_t unknown; + Common::SocialCategory category; // Common::SocialCategory + Common::SocialRequestResponse response; // Common::SocialRequestResponse + char name[0x20]; + uint16_t padding; }; struct FFXIVIpcSocialList : FFXIVIpcBasePacket diff --git a/src/common/Util/SpawnIndexAllocator.h b/src/common/Util/SpawnIndexAllocator.h index 732f652c..d6af5a40 100644 --- a/src/common/Util/SpawnIndexAllocator.h +++ b/src/common/Util/SpawnIndexAllocator.h @@ -72,7 +72,7 @@ namespace Util return spawnIndex != getAllocFailId(); } - constexpr T getAllocFailId() + constexpr T getAllocFailId() const { return static_cast< T >( -1 ); } diff --git a/src/common/Version.cpp.in b/src/common/Version.cpp.in index 4a7bacda..b2de470a 100644 --- a/src/common/Version.cpp.in +++ b/src/common/Version.cpp.in @@ -1,10 +1,10 @@ #include "Version.h" namespace Core { - namespace Version { +namespace Version { - const std::string GIT_HASH = "@GIT_SHA1@"; - const std::string VERSION = "@VERSION@"; +const std::string GIT_HASH = "@GIT_SHA1@"; +const std::string VERSION = "@VERSION@"; - } /* Version */ +} /* Version */ } /* Core */ diff --git a/src/libraries b/src/libraries index 732e26b4..67b949df 160000 --- a/src/libraries +++ b/src/libraries @@ -1 +1 @@ -Subproject commit 732e26b4bfb15875d71ae4ec13b8bd6155013840 +Subproject commit 67b949dfe3ffbbba7963b0861670ab4bb1819991 diff --git a/src/servers/CMakeLists.txt b/src/servers/CMakeLists.txt index 82613bd6..28e43594 100644 --- a/src/servers/CMakeLists.txt +++ b/src/servers/CMakeLists.txt @@ -12,3 +12,4 @@ include_directories("${PROJECT_SOURCE_DIR}") add_subdirectory(${PROJECT_SOURCE_DIR}/sapphire_lobby) add_subdirectory(${PROJECT_SOURCE_DIR}/sapphire_api) add_subdirectory(${PROJECT_SOURCE_DIR}/sapphire_zone) +add_subdirectory(${PROJECT_SOURCE_DIR}/Scripts) diff --git a/src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt b/src/servers/Scripts/CMakeLists.txt similarity index 82% rename from src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt rename to src/servers/Scripts/CMakeLists.txt index 2647b366..5f938985 100644 --- a/src/servers/sapphire_zone/Script/Scripts/CMakeLists.txt +++ b/src/servers/Scripts/CMakeLists.txt @@ -3,8 +3,6 @@ project(Sapphire_Script) file(GLOB SCRIPT_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.h") -include_directories("${CMAKE_SOURCE_DIR}/src/servers/") - message("exec: ${EXECUTABLE_OUTPUT_DIRECTORY}") set(SCRIPT_LIB_DIR "${EXECUTABLE_OUTPUT_DIRECTORY}/compiledscripts/" ) @@ -38,14 +36,11 @@ foreach(_scriptDir ${children}) endforeach() add_library("script_${_name}" MODULE ${SCRIPT_BUILD_FILES} "${SCRIPT_INCLUDE_FILES}" "${_scriptDir}/ScriptLoader.cpp") - target_link_libraries("script_${_name}" sapphire_zone) + target_link_libraries( "script_${_name}" sapphire_zone ) if(MSVC) - target_link_libraries("script_${_name}" ${Boost_LIBRARIES}) - endif() - - if(MSVC) - set_target_properties("script_${_name}" PROPERTIES + target_link_libraries( "script_${_name}" ${Boost_LIBRARIES}) + set_target_properties( "script_${_name}" PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS ON @@ -56,10 +51,7 @@ foreach(_scriptDir ${children}) ) endif() target_include_directories("script_${_name}" PUBLIC "${CMAKE_SOURCE_DIR}/src/servers/sapphire_zone/") - target_include_directories("script_${_name}" PUBLIC "${CMAKE_SOURCE_DIR}/src/servers/sapphire_zone/Script") - target_include_directories("script_${_name}" PUBLIC "${CMAKE_SOURCE_DIR}/src/servers/sapphire_zone/Script/Scripts") - target_include_directories("script_${_name}" PUBLIC "${CMAKE_SOURCE_DIR}/src/") - target_include_directories("script_${_name}" PUBLIC "${CMAKE_SOURCE_DIR}/src/common") + target_include_directories("script_${_name}" PUBLIC "${CMAKE_SOURCE_DIR}/src/servers/Script/Scripts") target_include_directories("script_${_name}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories("script_${_name}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/Scripts") diff --git a/src/servers/sapphire_zone/Script/Scripts/ScriptLoader.cpp.in b/src/servers/Scripts/ScriptLoader.cpp.in similarity index 100% rename from src/servers/sapphire_zone/Script/Scripts/ScriptLoader.cpp.in rename to src/servers/Scripts/ScriptLoader.cpp.in diff --git a/src/servers/sapphire_zone/Script/Scripts/ScriptObject.h b/src/servers/Scripts/ScriptObject.h similarity index 100% rename from src/servers/sapphire_zone/Script/Scripts/ScriptObject.h rename to src/servers/Scripts/ScriptObject.h diff --git a/src/servers/sapphire_zone/Script/Scripts/action/ActionSprint3.cpp b/src/servers/Scripts/action/ActionSprint3.cpp similarity index 100% rename from src/servers/sapphire_zone/Script/Scripts/action/ActionSprint3.cpp rename to src/servers/Scripts/action/ActionSprint3.cpp diff --git a/src/servers/Scripts/action/ScriptLoader.cpp b/src/servers/Scripts/action/ScriptLoader.cpp new file mode 100644 index 00000000..e7ba87ee --- /dev/null +++ b/src/servers/Scripts/action/ScriptLoader.cpp @@ -0,0 +1,15 @@ +#include