From 13dc04ebb557a08e94dfb4ebcd40bac6d5690aa3 Mon Sep 17 00:00:00 2001 From: Mordred Date: Sun, 28 Oct 2018 21:53:21 +0100 Subject: [PATCH] Refactoring and modernizing --- src/common/Common.h | 1389 ++++++------ src/common/Config/ConfigMgr.h | 99 +- src/common/Crypt/base64.h | 10 +- src/common/Crypt/md5.h | 28 +- src/common/Database/DbConnection.h | 194 +- src/common/Database/DbLoader.h | 63 +- src/common/Database/DbWorker.h | 39 +- src/common/Database/DbWorkerPool.h | 157 +- src/common/Database/Operation.h | 84 +- src/common/Database/PreparedStatement.h | 112 +- src/common/Database/StatementTask.h | 65 +- src/common/Database/ZoneDbConnection.h | 159 +- src/common/Exd/ExdDataGenerated.h | 5 +- src/common/Forwards.h | 44 +- src/common/Framework.h | 39 +- src/common/Logging/Logger.cpp | 5 - src/common/Logging/Logger.h | 42 +- src/common/Network/Acceptor.h | 101 +- src/common/Network/CommonNetwork.h | 331 ++- src/common/Network/Connection.h | 276 ++- src/common/Network/GamePacketNew.h | 635 +++--- src/common/Network/GamePacketParser.h | 66 +- src/common/Network/Hive.h | 68 +- src/common/Network/PacketContainer.h | 37 +- src/common/Util/LockedQueue.h | 207 +- src/common/Util/LockedWaitQueue.h | 157 +- src/common/Util/SpawnIndexAllocator.h | 158 +- src/common/Util/Util.h | 53 +- src/common/Util/UtilMath.h | 61 +- src/common/Version.h | 13 +- src/servers/Scripts/CMakeLists.txt | 2 +- src/servers/Scripts/common/Aethernet.cpp | 2 + src/servers/Scripts/common/Aetheryte.cpp | 2 + .../Scripts/common/CmnDefCutSceneReplay.cpp | 2 + .../Scripts/common/CmnDefHousingSignboard.cpp | 2 + src/servers/Scripts/common/CmnDefInnBed.cpp | 2 + .../Scripts/common/CmnDefLinkShell.cpp | 2 + .../common/CmnDefMarketBoardGridania.cpp | 2 + .../Scripts/common/CmnDefMogLetter.cpp | 2 + .../Scripts/common/CmnDefNpcRepair.cpp | 2 + .../Scripts/common/CmnDefWeatherForeCast.cpp | 2 + .../Scripts/common/ComDefMobHuntBoard.cpp | 2 + src/servers/Scripts/common/GilShop.cpp | 2 + .../Scripts/common/HouFurOrchestrion.cpp | 2 + .../ThePalaceoftheDeadFloors101110.cpp | 2 + .../ThePalaceoftheDeadFloors110.cpp | 2 + .../ThePalaceoftheDeadFloors111120.cpp | 2 + .../ThePalaceoftheDeadFloors1120.cpp | 2 + .../ThePalaceoftheDeadFloors121130.cpp | 2 + .../ThePalaceoftheDeadFloors131140.cpp | 2 + .../ThePalaceoftheDeadFloors141150.cpp | 2 + .../ThePalaceoftheDeadFloors151160.cpp | 2 + .../ThePalaceoftheDeadFloors161170.cpp | 2 + .../ThePalaceoftheDeadFloors171180.cpp | 2 + .../ThePalaceoftheDeadFloors181190.cpp | 2 + .../ThePalaceoftheDeadFloors191200.cpp | 2 + .../ThePalaceoftheDeadFloors2130.cpp | 2 + .../ThePalaceoftheDeadFloors3140.cpp | 2 + .../ThePalaceoftheDeadFloors4150.cpp | 2 + .../ThePalaceoftheDeadFloors5160.cpp | 2 + .../ThePalaceoftheDeadFloors6170.cpp | 2 + .../ThePalaceoftheDeadFloors7180.cpp | 2 + .../ThePalaceoftheDeadFloors8190.cpp | 2 + .../ThePalaceoftheDeadFloors91100.cpp | 2 + .../Scripts/instances/dungeons/AlaMhigo.cpp | 2 + .../instances/dungeons/AmdaporKeep.cpp | 2 + .../instances/dungeons/AmdaporKeepHard.cpp | 2 + .../instances/dungeons/BaelsarsWall.cpp | 2 + .../instances/dungeons/BardamsMettle.cpp | 2 + .../instances/dungeons/BrayfloxsLongstop.cpp | 2 + .../dungeons/BrayfloxsLongstopHard.cpp | 2 + .../instances/dungeons/CastrumAbania.cpp | 2 + .../instances/dungeons/CastrumMeridianum.cpp | 2 + .../instances/dungeons/CopperbellMines.cpp | 2 + .../dungeons/CopperbellMinesHard.cpp | 2 + .../Scripts/instances/dungeons/CuttersCry.cpp | 2 + .../Scripts/instances/dungeons/DomaCastle.cpp | 2 + .../instances/dungeons/DzemaelDarkhold.cpp | 2 + .../Scripts/instances/dungeons/Halatali.cpp | 2 + .../instances/dungeons/HalataliHard.cpp | 2 + .../instances/dungeons/HaukkeManor.cpp | 2 + .../instances/dungeons/HaukkeManorHard.cpp | 2 + .../Scripts/instances/dungeons/HellsLid.cpp | 2 + .../instances/dungeons/HullbreakerIsle.cpp | 2 + .../dungeons/HullbreakerIsleHard.cpp | 2 + .../instances/dungeons/KuganeCastle.cpp | 2 + .../Scripts/instances/dungeons/Neverreap.cpp | 2 + .../instances/dungeons/PharosSirius.cpp | 2 + .../instances/dungeons/PharosSiriusHard.cpp | 2 + .../dungeons/SaintMociannesArboretum.cpp | 2 + .../Scripts/instances/dungeons/Sastasha.cpp | 2 + .../instances/dungeons/SastashaHard.cpp | 2 + .../dungeons/ShisuioftheVioletTides.cpp | 2 + .../Scripts/instances/dungeons/Snowcloak.cpp | 2 + .../Scripts/instances/dungeons/SohmAl.cpp | 2 + .../Scripts/instances/dungeons/SohmAlHard.cpp | 2 + .../Scripts/instances/dungeons/SohrKhai.cpp | 2 + .../Scripts/instances/dungeons/TheAery.cpp | 2 + .../TheAetherochemicalResearchFacility.cpp | 2 + .../instances/dungeons/TheAntitower.cpp | 2 + .../instances/dungeons/TheAurumVale.cpp | 2 + .../dungeons/TheDrownedCityofSkalla.cpp | 2 + .../instances/dungeons/TheDuskVigil.cpp | 2 + .../dungeons/TheFractalContinuum.cpp | 2 + .../dungeons/TheFractalContinuumHard.cpp | 2 + .../dungeons/TheGreatGubalLibrary.cpp | 2 + .../dungeons/TheGreatGubalLibraryHard.cpp | 2 + .../instances/dungeons/TheKeeperoftheLake.cpp | 2 + .../dungeons/TheLostCityofAmdapor.cpp | 2 + .../dungeons/TheLostCityofAmdaporHard.cpp | 2 + .../instances/dungeons/ThePraetorium.cpp | 2 + .../instances/dungeons/TheSirensongSea.cpp | 2 + .../instances/dungeons/TheStoneVigil.cpp | 2 + .../instances/dungeons/TheStoneVigilHard.cpp | 2 + .../dungeons/TheSunkenTempleofQarn.cpp | 2 + .../dungeons/TheSunkenTempleofQarnHard.cpp | 2 + .../dungeons/TheTamTaraDeepcroft.cpp | 2 + .../dungeons/TheTamTaraDeepcroftHard.cpp | 2 + .../instances/dungeons/TheTempleoftheFist.cpp | 2 + .../dungeons/TheThousandMawsofTotoRak.cpp | 2 + .../Scripts/instances/dungeons/TheVault.cpp | 2 + .../instances/dungeons/TheWanderersPalace.cpp | 2 + .../dungeons/TheWanderersPalaceHard.cpp | 2 + .../Scripts/instances/dungeons/Xelphatol.cpp | 2 + .../instances/events/TheHauntedManor.cpp | 2 + .../events/TheValentionesCeremony.cpp | 2 + .../guildhests/AllsWellthatEndsintheWell.cpp | 2 + .../instances/guildhests/AnnoytheVoid.cpp | 2 + .../guildhests/BasicTrainingEnemyParties.cpp | 2 + .../BasicTrainingEnemyStrongholds.cpp | 2 + .../FlickingSticksandTakingNames.cpp | 2 + .../guildhests/HeroontheHalfShell.cpp | 2 + .../instances/guildhests/LongLivetheQueen.cpp | 2 + .../instances/guildhests/MorethanaFeeler.cpp | 2 + .../guildhests/PullingPoisonPosies.cpp | 2 + .../instances/guildhests/ShadowandClaw.cpp | 2 + .../instances/guildhests/SolemnTrinity.cpp | 2 + .../instances/guildhests/StingingBack.cpp | 2 + .../instances/guildhests/UndertheArmor.cpp | 2 + .../Scripts/instances/guildhests/WardUp.cpp | 2 + .../AccrueEnmityfromMultipleTargets.cpp | 2 + .../AssistAlliesinDefeatingaTarget.cpp | 2 + .../AvoidAreaofEffectAttacks.cpp | 2 + .../hallofthenovice/AvoidEngagedTargets.cpp | 2 + .../DefeatanOccupiedTarget.cpp | 2 + .../EngageEnemyReinforcements.cpp | 2 + .../hallofthenovice/EngageMultipleTargets.cpp | 2 + .../hallofthenovice/ExecuteaComboinBattle.cpp | 2 + .../ExecuteaCombotoIncreaseEnmity.cpp | 2 + .../ExecuteaRangedAttacktoIncreaseEnmity.cpp | 2 + .../hallofthenovice/FinalExercise.cpp | 2 + .../hallofthenovice/HealMultipleAllies.cpp | 2 + .../instances/hallofthenovice/HealanAlly.cpp | 2 + .../InteractwiththeBattlefield.cpp | 2 + .../Scripts/instances/pvp/Astragalos.cpp | 2 + .../Scripts/instances/pvp/SealRockSeize.cpp | 2 + .../pvp/TheBorderlandRuinsSecure.cpp | 2 + .../instances/pvp/TheFeast4on4LightParty.cpp | 2 + .../instances/pvp/TheFeast4on4Ranked.cpp | 2 + .../instances/pvp/TheFeast4on4Training.cpp | 2 + .../pvp/TheFeastCustomMatchCrystalTower.cpp | 2 + .../TheFeastCustomMatchFeastingGrounds.cpp | 2 + .../pvp/TheFeastCustomMatchLichenweed.cpp | 2 + .../Scripts/instances/pvp/TheFeastRanked.cpp | 2 + .../instances/pvp/TheFeastTeamRanked.cpp | 2 + .../instances/pvp/TheFeastTraining.cpp | 2 + .../instances/pvp/TheFieldsofGloryShatter.cpp | 2 + .../instances/questbattles/ABloodyReunion.cpp | 2 + .../questbattles/ASpectaclefortheAges.cpp | 2 + .../instances/questbattles/BloodDragoon.cpp | 2 + .../instances/questbattles/BloodontheDeck.cpp | 2 + .../CuriousGorgeMeetsHisMatch.cpp | 2 + .../instances/questbattles/DarkwingDragon.cpp | 2 + .../instances/questbattles/InThalsName.cpp | 2 + .../questbattles/InterdimensionalRift.cpp | 2 + .../questbattles/ItsProbablyaTrap.cpp | 2 + .../instances/questbattles/MatsubaMayhem.cpp | 2 + .../Scripts/instances/questbattles/Naadam.cpp | 2 + .../questbattles/OneLifeforOneWorld.cpp | 2 + .../instances/questbattles/OurCompromise.cpp | 2 + .../questbattles/OurUnsungHeroes.cpp | 2 + .../questbattles/RaisingtheSword.cpp | 2 + .../questbattles/ReturnoftheBull.cpp | 2 + .../questbattles/TheBattleonBekko.cpp | 2 + .../TheCarteneauFlatsHeliodrome.cpp | 2 + .../questbattles/TheFaceofTrueEvil.cpp | 2 + .../questbattles/TheHeartoftheProblem.cpp | 2 + .../TheOrphansandtheBrokenBlade.cpp | 2 + .../instances/questbattles/TheResonant.cpp | 2 + .../questbattles/WhenClansCollide.cpp | 2 + .../questbattles/WithHeartandSteel.cpp | 2 + .../raids/AlexanderTheArmoftheFather.cpp | 2 + .../AlexanderTheArmoftheFatherSavage.cpp | 2 + .../raids/AlexanderTheArmoftheSon.cpp | 2 + .../raids/AlexanderTheArmoftheSonSavage.cpp | 2 + .../raids/AlexanderTheBreathoftheCreator.cpp | 2 + .../AlexanderTheBreathoftheCreatorSavage.cpp | 2 + .../raids/AlexanderTheBurdenoftheFather.cpp | 2 + .../AlexanderTheBurdenoftheFatherSavage.cpp | 2 + .../raids/AlexanderTheBurdenoftheSon.cpp | 2 + .../AlexanderTheBurdenoftheSonSavage.cpp | 2 + .../raids/AlexanderTheCuffoftheFather.cpp | 2 + .../AlexanderTheCuffoftheFatherSavage.cpp | 2 + .../raids/AlexanderTheCuffoftheSon.cpp | 2 + .../raids/AlexanderTheCuffoftheSonSavage.cpp | 2 + .../raids/AlexanderTheEyesoftheCreator.cpp | 2 + .../AlexanderTheEyesoftheCreatorSavage.cpp | 2 + .../raids/AlexanderTheFistoftheFather.cpp | 2 + .../AlexanderTheFistoftheFatherSavage.cpp | 2 + .../raids/AlexanderTheFistoftheSon.cpp | 2 + .../raids/AlexanderTheFistoftheSonSavage.cpp | 2 + .../raids/AlexanderTheHeartoftheCreator.cpp | 2 + .../AlexanderTheHeartoftheCreatorSavage.cpp | 2 + .../raids/AlexanderTheSouloftheCreator.cpp | 2 + .../AlexanderTheSouloftheCreatorSavage.cpp | 2 + .../Scripts/instances/raids/DeltascapeV10.cpp | 2 + .../instances/raids/DeltascapeV10Savage.cpp | 2 + .../Scripts/instances/raids/DeltascapeV20.cpp | 2 + .../instances/raids/DeltascapeV20Savage.cpp | 2 + .../Scripts/instances/raids/DeltascapeV30.cpp | 2 + .../instances/raids/DeltascapeV30Savage.cpp | 2 + .../Scripts/instances/raids/DeltascapeV40.cpp | 2 + .../instances/raids/DeltascapeV40Savage.cpp | 2 + .../Scripts/instances/raids/DunScaith.cpp | 2 + .../Scripts/instances/raids/SigmascapeV10.cpp | 2 + .../instances/raids/SigmascapeV10Savage.cpp | 2 + .../Scripts/instances/raids/SigmascapeV20.cpp | 2 + .../instances/raids/SigmascapeV20Savage.cpp | 2 + .../Scripts/instances/raids/SigmascapeV30.cpp | 2 + .../instances/raids/SigmascapeV30Savage.cpp | 2 + .../Scripts/instances/raids/SigmascapeV40.cpp | 2 + .../instances/raids/SigmascapeV40Savage.cpp | 2 + .../Scripts/instances/raids/SyrcusTower.cpp | 2 + .../raids/TheBindingCoilofBahamutTurn1.cpp | 2 + .../raids/TheBindingCoilofBahamutTurn2.cpp | 2 + .../raids/TheBindingCoilofBahamutTurn3.cpp | 2 + .../raids/TheBindingCoilofBahamutTurn4.cpp | 2 + .../raids/TheBindingCoilofBahamutTurn5.cpp | 2 + .../raids/TheFinalCoilofBahamutTurn1.cpp | 2 + .../raids/TheFinalCoilofBahamutTurn2.cpp | 2 + .../raids/TheFinalCoilofBahamutTurn3.cpp | 2 + .../raids/TheFinalCoilofBahamutTurn4.cpp | 2 + .../raids/TheLabyrinthoftheAncients.cpp | 2 + .../raids/TheRoyalCityofRabanastre.cpp | 2 + .../TheSecondCoilofBahamutSavageTurn1.cpp | 2 + .../TheSecondCoilofBahamutSavageTurn2.cpp | 2 + .../TheSecondCoilofBahamutSavageTurn3.cpp | 2 + .../TheSecondCoilofBahamutSavageTurn4.cpp | 2 + .../raids/TheSecondCoilofBahamutTurn1.cpp | 2 + .../raids/TheSecondCoilofBahamutTurn2.cpp | 2 + .../raids/TheSecondCoilofBahamutTurn3.cpp | 2 + .../raids/TheSecondCoilofBahamutTurn4.cpp | 2 + .../TheUnendingCoilofBahamutUltimate.cpp | 2 + .../Scripts/instances/raids/TheVoidArk.cpp | 2 + .../raids/TheWeaponsRefrainUltimate.cpp | 2 + .../instances/raids/TheWeepingCityofMhach.cpp | 2 + .../instances/raids/TheWorldofDarkness.cpp | 2 + .../instances/treasurehunt/TheAquapolis.cpp | 2 + .../treasurehunt/TheHiddenCanalsofUznair.cpp | 2 + .../treasurehunt/TheLostCanalsofUznair.cpp | 2 + .../trials/ARelicReborntheChimera.cpp | 2 + .../instances/trials/ARelicReborntheHydra.cpp | 2 + .../AkhAfahAmphitheatreExtreme.cpp | 8 +- .../trials/AkhAfahAmphitheatreHard.cpp | 2 + .../instances/trials/BattleintheBigKeep.cpp | 2 + .../instances/trials/BattleontheBigBridge.cpp | 2 + .../Scripts/instances/trials/CapeWestwind.cpp | 2 + .../instances/trials/ContainmentBayP1T6.cpp | 2 + .../trials/ContainmentBayP1T6Extreme.cpp | 2 + .../instances/trials/ContainmentBayS1T7.cpp | 2 + .../trials/ContainmentBayS1T7Extreme.cpp | 2 + .../instances/trials/ContainmentBayZ1T9.cpp | 2 + .../trials/ContainmentBayZ1T9Extreme.cpp | 2 + .../Scripts/instances/trials/Emanation.cpp | 2 + .../instances/trials/EmanationExtreme.cpp | 2 + .../instances/trials/SpecialEventI.cpp | 2 + .../instances/trials/SpecialEventII.cpp | 2 + .../instances/trials/SpecialEventIII.cpp | 2 + .../instances/trials/TheBowlofEmbers.cpp | 2 + .../trials/TheBowlofEmbersExtreme.cpp | 2 + .../instances/trials/TheBowlofEmbersHard.cpp | 2 + .../Scripts/instances/trials/TheChrysalis.cpp | 2 + .../instances/trials/TheDragonsNeck.cpp | 2 + .../instances/trials/TheFinalStepsofFaith.cpp | 2 + .../instances/trials/TheHowlingEye.cpp | 2 + .../instances/trials/TheHowlingEyeExtreme.cpp | 2 + .../instances/trials/TheHowlingEyeHard.cpp | 2 + .../Scripts/instances/trials/TheJadeStoa.cpp | 2 + .../instances/trials/TheJadeStoaExtreme.cpp | 2 + .../trials/TheLimitlessBlueExtreme.cpp | 2 + .../instances/trials/TheLimitlessBlueHard.cpp | 2 + .../trials/TheMinstrelsBalladNidhoggsRage.cpp | 2 + .../TheMinstrelsBalladShinryusDomain.cpp | 2 + .../TheMinstrelsBalladThordansReign.cpp | 2 + .../trials/TheMinstrelsBalladUltimasBane.cpp | 2 + .../Scripts/instances/trials/TheNavel.cpp | 2 + .../instances/trials/TheNavelExtreme.cpp | 2 + .../Scripts/instances/trials/TheNavelHard.cpp | 2 + .../instances/trials/ThePoolofTribute.cpp | 2 + .../trials/ThePoolofTributeExtreme.cpp | 2 + .../instances/trials/TheRoyalMenagerie.cpp | 2 + .../trials/TheSingularityReactor.cpp | 2 + .../instances/trials/TheStepsofFaith.cpp | 2 + .../trials/TheStrikingTreeExtreme.cpp | 2 + .../instances/trials/TheStrikingTreeHard.cpp | 2 + .../instances/trials/TheWhorleaterExtreme.cpp | 2 + .../instances/trials/TheWhorleaterHard.cpp | 2 + .../instances/trials/ThokastThokExtreme.cpp | 2 + .../instances/trials/ThokastThokHard.cpp | 2 + .../instances/trials/ThornmarchExtreme.cpp | 2 + .../instances/trials/ThornmarchHard.cpp | 2 + .../Scripts/instances/trials/UrthsFount.cpp | 2 + .../Scripts/opening/OpeningGridania.cpp | 5 +- src/servers/Scripts/opening/OpeningLimsa.cpp | 2 + src/servers/Scripts/opening/OpeningUldah.cpp | 5 +- src/servers/Scripts/quest/ManFst001.cpp | 2 + src/servers/Scripts/quest/ManFst002.cpp | 2 + src/servers/Scripts/quest/ManFst003.cpp | 2 + src/servers/Scripts/quest/ManFst004.cpp | 2 + src/servers/Scripts/quest/ManSea001.cpp | 2 + src/servers/Scripts/quest/ManSea002.cpp | 2 + src/servers/Scripts/quest/ManSea003.cpp | 2 + src/servers/Scripts/quest/ManWil001.cpp | 2 + src/servers/Scripts/quest/ManWil002.cpp | 2 + .../quest/subquest/gridania/SubFst001.cpp | 2 + .../quest/subquest/gridania/SubFst002.cpp | 2 + .../quest/subquest/gridania/SubFst003.cpp | 2 + .../quest/subquest/gridania/SubFst004.cpp | 2 + .../quest/subquest/gridania/SubFst008.cpp | 2 + .../quest/subquest/gridania/SubFst009.cpp | 2 + .../quest/subquest/gridania/SubFst010.cpp | 2 + .../quest/subquest/gridania/SubFst011.cpp | 2 + .../quest/subquest/gridania/SubFst013.cpp | 2 + .../quest/subquest/gridania/SubFst014.cpp | 2 + .../quest/subquest/gridania/SubFst015.cpp | 2 + .../quest/subquest/gridania/SubFst019.cpp | 2 + .../quest/subquest/gridania/SubFst026.cpp | 2 + .../quest/subquest/gridania/SubFst029.cpp | 2 + .../quest/subquest/gridania/SubFst030.cpp | 2 + .../quest/subquest/gridania/SubFst041.cpp | 2 + .../quest/subquest/limsa/SubSea001.cpp | 2 + .../quest/subquest/uldah/SubWil000.cpp | 2 + .../quest/subquest/uldah/SubWil001.cpp | 2 + .../quest/subquest/uldah/SubWil002.cpp | 2 + .../quest/subquest/uldah/SubWil004.cpp | 2 + .../quest/subquest/uldah/SubWil006.cpp | 2 + .../quest/subquest/uldah/SubWil007.cpp | 2 + .../quest/subquest/uldah/SubWil018.cpp | 2 + .../quest/subquest/uldah/SubWil019.cpp | 2 + .../quest/subquest/uldah/SubWil021.cpp | 2 + .../quest/subquest/uldah/SubWil022.cpp | 2 + .../quest/subquest/uldah/SubWil027.cpp | 2 + .../quest/subquest/uldah/SubWil028.cpp | 2 + .../quest/subquest/uldah/SubWil029.cpp | 2 + src/servers/sapphire_api/Forwards.h | 162 +- src/servers/sapphire_api/LoginSession.h | 85 +- src/servers/sapphire_api/PlayerMinimal.h | 311 ++- src/servers/sapphire_api/SapphireAPI.h | 80 +- src/servers/sapphire_api/Session.h | 35 +- src/servers/sapphire_api/client_http.hpp | 3 +- src/servers/sapphire_lobby/Forwards.h | 32 +- src/servers/sapphire_lobby/GameConnection.cpp | 13 +- src/servers/sapphire_lobby/GameConnection.h | 76 +- .../sapphire_lobby/LobbyPacketContainer.h | 39 +- src/servers/sapphire_lobby/LobbySession.h | 81 +- src/servers/sapphire_lobby/RestConnector.h | 70 +- src/servers/sapphire_lobby/ServerLobby.h | 75 +- src/servers/sapphire_zone/Action/Action.h | 112 +- src/servers/sapphire_zone/Action/ActionCast.h | 28 +- .../sapphire_zone/Action/ActionCollision.h | 54 +- .../sapphire_zone/Action/ActionMount.h | 28 +- .../sapphire_zone/Action/ActionTeleport.h | 32 +- .../sapphire_zone/Action/EventAction.h | 38 +- .../sapphire_zone/Action/EventItemAction.h | 37 +- src/servers/sapphire_zone/Actor/Actor.h | 159 +- src/servers/sapphire_zone/Actor/BNpc.h | 71 +- .../sapphire_zone/Actor/BNpcTemplate.h | 102 +- src/servers/sapphire_zone/Actor/Chara.h | 335 ++- src/servers/sapphire_zone/Actor/EventObject.h | 67 +- src/servers/sapphire_zone/Actor/Npc.h | 27 +- src/servers/sapphire_zone/Actor/Player.h | 1982 ++++++++--------- src/servers/sapphire_zone/Actor/SpawnGroup.h | 26 +- src/servers/sapphire_zone/Actor/SpawnPoint.h | 48 +- .../sapphire_zone/DebugCommand/DebugCommand.h | 83 +- .../DebugCommand/DebugCommandHandler.cpp | 6 +- .../DebugCommand/DebugCommandHandler.h | 62 +- src/servers/sapphire_zone/Event/Director.h | 327 ++- src/servers/sapphire_zone/Event/EventDefs.h | 148 +- .../sapphire_zone/Event/EventHandler.h | 233 +- src/servers/sapphire_zone/Event/EventHelper.h | 10 +- src/servers/sapphire_zone/Inventory/Item.h | 101 +- .../sapphire_zone/Inventory/ItemContainer.h | 63 +- .../sapphire_zone/Inventory/ItemUtil.h | 24 +- .../sapphire_zone/Linkshell/Linkshell.h | 78 +- .../sapphire_zone/Linkshell/LinkshellMgr.h | 31 +- src/servers/sapphire_zone/Math/CalcBattle.h | 17 +- src/servers/sapphire_zone/Math/CalcStats.h | 23 +- .../sapphire_zone/Network/GameConnection.h | 177 +- .../PacketWrappers/ActorControlPacket142.h | 72 +- .../PacketWrappers/ActorControlPacket143.h | 78 +- .../PacketWrappers/ActorControlPacket144.h | 78 +- .../Network/PacketWrappers/ChatPacket.h | 46 +- .../PacketWrappers/DirectorPlayScenePacket.h | 110 +- .../Network/PacketWrappers/EffectPacket.h | 80 +- .../PacketWrappers/EventFinishPacket.h | 60 +- .../Network/PacketWrappers/EventPlayPacket.h | 80 +- .../Network/PacketWrappers/EventStartPacket.h | 71 +- .../Network/PacketWrappers/ExaminePacket.h | 116 +- .../Network/PacketWrappers/InitUIPacket.h | 142 +- .../Network/PacketWrappers/ModelEquipPacket.h | 69 +- .../Network/PacketWrappers/MoveActorPacket.h | 63 +- .../Network/PacketWrappers/NpcSpawnPacket.h | 219 +- .../Network/PacketWrappers/PingPacket.h | 43 +- .../PacketWrappers/PlayerSpawnPacket.h | 263 ++- .../PacketWrappers/PlayerStateFlagsPacket.h | 72 +- .../PacketWrappers/QuestMessagePacket.h | 52 +- .../PacketWrappers/ServerNoticePacket.h | 43 +- .../PacketWrappers/UpdateHpMpTpPacket.h | 47 +- .../UpdateInventorySlotPacket.h | 84 +- .../sapphire_zone/Script/NativeScriptApi.h | 50 +- .../sapphire_zone/Script/NativeScriptMgr.h | 224 +- src/servers/sapphire_zone/Script/ScriptInfo.h | 82 +- .../sapphire_zone/Script/ScriptLoader.h | 147 +- .../sapphire_zone/Script/ScriptMgr.cpp | 2 +- src/servers/sapphire_zone/Script/ScriptMgr.h | 123 +- 425 files changed, 6922 insertions(+), 6542 deletions(-) rename src/servers/Scripts/instances/{ => trials}/AkhAfahAmphitheatreExtreme.cpp (92%) diff --git a/src/common/Common.h b/src/common/Common.h index 0847aac9..f729f5ba 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -10,730 +10,729 @@ // The following enumerations are structures to require their type be included. // They are also defined within the Core::Common namespace to avoid collisions. // +--------------------------------------------------------------------------- -namespace Core { -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 +namespace Core::Common { - float x; - float y; - float z; -}; -enum InventoryOperation : uint8_t -{ - Discard = 0x07, - Move = 0x08, - Swap = 0x09, - Merge = 0x0C, - Split = 0x0A -}; + // 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; -enum ClientLanguage : uint8_t -{ - Japanese = 1, - English = 2, - German = 4, - French = 8 -}; + const int32_t INVALID_GAME_OBJECT_ID = 0xE0000000; -enum ObjKind : uint8_t -{ - None = 0x00, - Player = 0x01, - BattleNpc = 0x02, - EventNpc = 0x03, - Treasure = 0x04, - Aetheryte = 0x05, - GatheringPoint = 0x06, - EventObj = 0x07, - MountType = 0x08, - Companion = 0x09, // this probably actually means minion - Retainer = 0x0A, - Area = 0x0B, - Housing = 0x0C, - Cutscene = 0x0D, - CardStand = 0x0E, -}; - -enum Stance : uint8_t -{ - Passive = 0, - Active = 1, -}; - -enum class DisplayFlags : uint16_t -{ - ActiveStance = 0x001, - Invisible = 0x020, - HideHead = 0x040, - HideWeapon = 0x080, - Faded = 0x100, - Visor = 0x800, -}; - -enum struct ActorStatus : uint8_t -{ - Idle = 0x01, - Dead = 0x02, - Sitting = 0x03, - Mounted = 0x04, - Crafting = 0x05, - Gathering = 0x06, - Melding = 0x07, - SMachine = 0x08, - Carry = 0x09, - EmoteMode = 0x0B -}; - -enum GearSetSlot : uint8_t -{ - MainHand = 0, - OffHand = 1, - Head = 2, - Body = 3, - Hands = 4, - Waist = 5, - Legs = 6, - Feet = 7, - Ear = 8, - Neck = 9, - Wrist = 10, - Ring1 = 11, - Ring2 = 12, - SoulCrystal = 13, -}; - -enum GearModelSlot : int8_t -{ - ModelInvalid = -1, - ModelHead = 0, - ModelBody = 1, - ModelHands = 2, - ModelLegs = 3, - ModelFeet = 4, - ModelEar = 5, - ModelNeck = 6, - ModelWrist = 7, - ModelRing1 = 8, - ModelRing2 = 9 -}; - -enum EquipSlotCategory : uint8_t -{ - Unequippable = 0, - - // main slots - - CharaMainHand = 1, - CharaOffHand = 2, - CharaHead = 3, - CharaBody = 4, - CharaHands = 5, - CharaWaist = 6, - CharaLegs = 7, - CharaFeet = 8, - CharaEars = 9, - CharaNeck = 10, - CharaWrist = 11, - CharaRing = 12, - CharaSoulCrystal = 17, - - // specials - - /*! Cannot equip gear to offhand slot */ - MainTwoHandedWeapon = 13, - /*! Can be equipped in either main or offhand slot */ - MainOrOffHand = 14, // unused - /*! Cannot equip gear to head */ - BodyDisallowHead = 15, - /*! Cannot equip gear to hands, legs and feet slots */ - BodyDisallowHandsLegsFeet = 16, - /*! Cannot equip gear to feet slot */ - LegsDisallowFeet = 18, - /*! Cannot equp gear to head, hands, legs, feet slots */ - BodyDisallowAll = 19, - /*! Cannot equip gear to hands slot */ - BodyDisallowHands = 20, - /*! Cannot equip gear to legs & feet slots */ - BodyDisallowLegsFeet = 21, -}; - -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, - HandIn = 2005, - DamagedGear = 2007, - //UNKNOWN_1 = 2008, - - ArmoryOff = 3200, - ArmoryHead = 3201, - ArmoryBody = 3202, - ArmoryHand = 3203, - ArmoryWaist = 3204, - ArmoryLegs = 3205, - ArmoryFeet = 3206, - ArmoryNeck = 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 ContainerType : uint16_t -{ - Unknown = 0, - Bag = 1, - GearSet = 2, - CurrencyCrystal = 3, - Armory = 4 -}; - - -enum CurrencyType : uint8_t -{ - Gil = 0x01, - StormSeal = 0x02, - SerpentSeal = 0x03, - FlameSeal = 0x04, - TomestonePhilo = 0x05, - TomestoneMytho = 0x06, - WolfMark = 0x07, - TomestoneSold = 0x08, - AlliedSeal = 0x09, - TomestonePoet = 0x0A, - Mgp = 0x0B, - TomestoneLaw = 0x0C, - TomestoneEso = 0x0D, - TomestoneLore = 0x0E -}; - -enum CrystalType : uint8_t -{ - FireShard = 0x01, - IceShard = 0x02, - WindShard = 0x03, - EarthShard = 0x04, - LightningShard = 0x05, - WaterShard = 0x06, - - FireCrystal = 0x07, - IceCrystal = 0x08, - WindCrystal = 0x09, - EarthCrystal = 0x0A, - LightningCrystal = 0x0B, - WaterCrystal = 0x0C, - - FireCluster = 0x0D, - IceCluster = 0x0E, - WindCluster = 0x0F, - EarthCluster = 0x10, - LightningCluster = 0x11, - WaterCluster = 0x12 -}; - -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 : - uint8_t -{ - Running = 0x00, - Walking = 0x02, - Strafing = 0x04, - Jumping = 0x10, - BackWalk = 0x06, -}; - -enum MoveState : - uint8_t -{ - No = 0x00, - Land = 0x02, - Fall = 0x04, -}; - -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 InventoryOperation : 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; + Discard = 0x07, + Move = 0x08, + Swap = 0x09, + Merge = 0x0C, + Split = 0x0A + }; - 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 ClientLanguage : uint8_t + { + Japanese = 1, + English = 2, + German = 4, + French = 8 + }; - 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; + enum ObjKind : uint8_t + { + None = 0x00, + Player = 0x01, + BattleNpc = 0x02, + EventNpc = 0x03, + Treasure = 0x04, + Aetheryte = 0x05, + GatheringPoint = 0x06, + EventObj = 0x07, + MountType = 0x08, + Companion = 0x09, // this probably actually means minion + Retainer = 0x0A, + Area = 0x0B, + Housing = 0x0C, + Cutscene = 0x0D, + CardStand = 0x0E, + }; - //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; + enum Stance : uint8_t + { + Passive = 0, + Active = 1, + }; - //struct - //{ - // uint8_t padding; - // uint32_t UI32A; - // uint16_t padding2; - //} e; + enum class DisplayFlags : uint16_t + { + ActiveStance = 0x001, + Invisible = 0x020, + HideHead = 0x040, + HideWeapon = 0x080, + Faded = 0x100, + Visor = 0x800, + }; + + enum struct ActorStatus : uint8_t + { + Idle = 0x01, + Dead = 0x02, + Sitting = 0x03, + Mounted = 0x04, + Crafting = 0x05, + Gathering = 0x06, + Melding = 0x07, + SMachine = 0x08, + Carry = 0x09, + EmoteMode = 0x0B + }; + + enum GearSetSlot : uint8_t + { + MainHand = 0, + OffHand = 1, + Head = 2, + Body = 3, + Hands = 4, + Waist = 5, + Legs = 6, + Feet = 7, + Ear = 8, + Neck = 9, + Wrist = 10, + Ring1 = 11, + Ring2 = 12, + SoulCrystal = 13, + }; + + enum GearModelSlot : int8_t + { + ModelInvalid = -1, + ModelHead = 0, + ModelBody = 1, + ModelHands = 2, + ModelLegs = 3, + ModelFeet = 4, + ModelEar = 5, + ModelNeck = 6, + ModelWrist = 7, + ModelRing1 = 8, + ModelRing2 = 9 + }; + + enum EquipSlotCategory : uint8_t + { + Unequippable = 0, + + // main slots + + CharaMainHand = 1, + CharaOffHand = 2, + CharaHead = 3, + CharaBody = 4, + CharaHands = 5, + CharaWaist = 6, + CharaLegs = 7, + CharaFeet = 8, + CharaEars = 9, + CharaNeck = 10, + CharaWrist = 11, + CharaRing = 12, + CharaSoulCrystal = 17, + + // specials + + /*! Cannot equip gear to offhand slot */ + MainTwoHandedWeapon = 13, + /*! Can be equipped in either main or offhand slot */ + MainOrOffHand = 14, // unused + /*! Cannot equip gear to head */ + BodyDisallowHead = 15, + /*! Cannot equip gear to hands, legs and feet slots */ + BodyDisallowHandsLegsFeet = 16, + /*! Cannot equip gear to feet slot */ + LegsDisallowFeet = 18, + /*! Cannot equp gear to head, hands, legs, feet slots */ + BodyDisallowAll = 19, + /*! Cannot equip gear to hands slot */ + BodyDisallowHands = 20, + /*! Cannot equip gear to legs & feet slots */ + BodyDisallowLegsFeet = 21, + }; + + 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, + HandIn = 2005, + DamagedGear = 2007, + //UNKNOWN_1 = 2008, + + ArmoryOff = 3200, + ArmoryHead = 3201, + ArmoryBody = 3202, + ArmoryHand = 3203, + ArmoryWaist = 3204, + ArmoryLegs = 3205, + ArmoryFeet = 3206, + ArmoryNeck = 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 ContainerType : uint16_t + { + Unknown = 0, + Bag = 1, + GearSet = 2, + CurrencyCrystal = 3, + Armory = 4 }; -}; + enum CurrencyType : uint8_t + { + Gil = 0x01, + StormSeal = 0x02, + SerpentSeal = 0x03, + FlameSeal = 0x04, + TomestonePhilo = 0x05, + TomestoneMytho = 0x06, + WolfMark = 0x07, + TomestoneSold = 0x08, + AlliedSeal = 0x09, + TomestonePoet = 0x0A, + Mgp = 0x0B, + TomestoneLaw = 0x0C, + TomestoneEso = 0x0D, + TomestoneLore = 0x0E + }; -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 CrystalType : uint8_t + { + FireShard = 0x01, + IceShard = 0x02, + WindShard = 0x03, + EarthShard = 0x04, + LightningShard = 0x05, + WaterShard = 0x06, -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, -}; + FireCrystal = 0x07, + IceCrystal = 0x08, + WindCrystal = 0x09, + EarthCrystal = 0x0A, + LightningCrystal = 0x0B, + WaterCrystal = 0x0C, -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, - Knockback = 33, - Mount = 38 -}; + FireCluster = 0x0D, + IceCluster = 0x0E, + WindCluster = 0x0F, + EarthCluster = 0x10, + LightningCluster = 0x11, + WaterCluster = 0x12 + }; -enum class ActionHitSeverityType : - uint8_t -{ - NormalDamage = 0, - CritHeal = 0, - CritDamage = 1, - NormalHeal = 1, - DirectHitDamage = 2, - CritDirectHitDamage = 3 -}; + enum struct ZoneingType : uint8_t + { + None = 1, + Teleport = 2, + Return = 3, + ReturnDead = 4, + FadeIn = 5, + }; -enum ActionEffectDisplayType : - uint8_t -{ - HideActionName = 0, - ShowActionName = 1, - ShowItemName = 2, -}; + enum struct ResurrectType : uint8_t + { + None = 0, + RaiseSpell = 5, + Return = 8 + }; -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 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, + }; -enum struct FateStatus : - uint8_t -{ - Active = 2, - Inactive = 4, - Preparing = 7, - Completed = 8, -}; + /** + * 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 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 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 EquipDisplayFlags : - uint8_t -{ - HideNothing = 0x0, - HideHead = 0x1, - HideWeapon = 0x2, - HideLegacyMark = 0x4, + }; - StoreNewItemsInArmouryChest = 0x10, - StoreCraftedItemsInInventory = 0x20, + enum MoveType : + uint8_t + { + Running = 0x00, + Walking = 0x02, + Strafing = 0x04, + Jumping = 0x10, + BackWalk = 0x06, + }; - Visor = 0x40, -}; + enum MoveState : + uint8_t + { + No = 0x00, + Land = 0x02, + Fall = 0x04, + }; -enum SkillType : - uint8_t -{ - Normal = 0x1, - MountSkill = 0xD, -}; + 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; + } -typedef std::vector< PlayerStateFlag > PlayerStateFlagList; -} /* Common */ -} /* Core */ + 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, + Knockback = 33, + Mount = 38 + }; + + enum class ActionHitSeverityType : + uint8_t + { + NormalDamage = 0, + CritHeal = 0, + CritDamage = 1, + NormalHeal = 1, + DirectHitDamage = 2, + CritDirectHitDamage = 3 + }; + + enum ActionEffectDisplayType : + uint8_t + { + HideActionName = 0, + ShowActionName = 1, + ShowItemName = 2, + }; + + 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 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, + HideLegacyMark = 0x4, + + StoreNewItemsInArmouryChest = 0x10, + StoreCraftedItemsInInventory = 0x20, + + Visor = 0x40, + }; + + enum SkillType : + uint8_t + { + Normal = 0x1, + MountSkill = 0xD, + }; + + using PlayerStateFlagList = std::vector< PlayerStateFlag >; + +} #endif diff --git a/src/common/Config/ConfigMgr.h b/src/common/Config/ConfigMgr.h index eec0625a..a28b2da4 100644 --- a/src/common/Config/ConfigMgr.h +++ b/src/common/Config/ConfigMgr.h @@ -7,63 +7,64 @@ #include #include -namespace Core { -class ConfigMgr +namespace Core { -public: - ConfigMgr() = default; + class ConfigMgr + { + public: + ConfigMgr() = default; - ~ConfigMgr() = default; + ~ConfigMgr() = default; - bool loadConfig( const std::string& configName ); - - template struct always_false : std::false_type {}; + bool loadConfig( const std::string& configName ); - template< class T > - T getValue( const std::string& section, const std::string& name, T defaultValue = T() ) - { - if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetInteger( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetReal( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetReal( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->Get( section, name, defaultValue ); - else if constexpr (std::is_same_v) - return m_pInih->GetBoolean( section, name, defaultValue ); - else - static_assert(always_false::value, "non-exhaustive getter!"); - } + template struct always_false : std::false_type {}; - template< class T > - void setValue( const std::string& name, T defaultValue = T() ) - { - // TODO: reimplement this... - //m_propTree.put( name, defaultValue ); - } + template< class T > + T getValue( const std::string& section, const std::string& name, T defaultValue = T() ) + { + if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetInteger( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetReal( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetReal( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->Get( section, name, defaultValue ); + else if constexpr (std::is_same_v) + return m_pInih->GetBoolean( section, name, defaultValue ); + else + static_assert(always_false::value, "non-exhaustive getter!"); + } -private: - bool copyDefaultConfig( const std::string& configName ); + template< class T > + void setValue( const std::string& name, T defaultValue = T() ) + { + // TODO: reimplement this... + //m_propTree.put( name, defaultValue ); + } - std::unique_ptr< INIReader > m_pInih; + private: + bool copyDefaultConfig( const std::string& configName ); - const std::string m_globalConfigFile = "global.ini"; - const std::string m_configFolderRoot = "./config/"; - const std::string m_configDefaultSuffix = ".default"; -}; + std::unique_ptr< INIReader > m_pInih; + + const std::string m_globalConfigFile = "global.ini"; + const std::string m_configFolderRoot = "./config/"; + const std::string m_configDefaultSuffix = ".default"; + }; } #endif //SAPPHIRE_CONFIGMGR_H diff --git a/src/common/Crypt/base64.h b/src/common/Crypt/base64.h index 77ba23bb..b1b9a153 100644 --- a/src/common/Crypt/base64.h +++ b/src/common/Crypt/base64.h @@ -1,10 +1,10 @@ #include -namespace Core { -namespace Util { -std::string base64_encode( uint8_t const*, uint32_t len ); +namespace Core::Util +{ + 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 ); } + diff --git a/src/common/Crypt/md5.h b/src/common/Crypt/md5.h index fc604b34..69bc6274 100644 --- a/src/common/Crypt/md5.h +++ b/src/common/Crypt/md5.h @@ -3,25 +3,25 @@ #include -namespace Core { -namespace Util { -using md5_context = struct +namespace Core::Util { - uint32_t total[2]; - uint32_t state[4]; - uint8_t buffer[64]; -}; + using md5_context = struct + { + uint32_t total[2]; + uint32_t state[4]; + 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", @@ -33,7 +33,7 @@ static const char* msg[] = "345678901234567890" }; -static const char* val[] = + static const char* val[] = { "d41d8cd98f00b204e9800998ecf8427e", "0cc175b9c0f1b6a831c399e269772661", @@ -45,7 +45,7 @@ static const char* val[] = }; } -} + #endif /* md5.h */ diff --git a/src/common/Database/DbConnection.h b/src/common/Database/DbConnection.h index 750a07c7..7d64437c 100644 --- a/src/common/Database/DbConnection.h +++ b/src/common/Database/DbConnection.h @@ -8,120 +8,112 @@ #include #include "Util/LockedWaitQueue.h" -namespace Mysql { -class Connection; - -class ResultSet; - -class PreparedResultSet; - -class PreparedStatement; +namespace Mysql +{ + class Connection; + class ResultSet; + class PreparedResultSet; + class PreparedStatement; } -namespace Core { -namespace Db { -class DatabaseWorker; - -class PreparedStatement; - -class Operation; - -class DbWorker; - -using PreparedStmtScopedPtr = std::unique_ptr< PreparedStatement >; - -enum ConnectionFlags +namespace Core::Db { - CONNECTION_ASYNC = 0x1, - CONNECTION_SYNC = 0x2, - CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC -}; + class DatabaseWorker; + class PreparedStatement; + class Operation; + class DbWorker; + using PreparedStmtScopedPtr = std::unique_ptr< PreparedStatement >; -struct ConnectionInfo -{ - std::string user; - std::string password; - std::string database; - std::string host; - uint16_t port; - uint8_t syncThreads; - uint8_t asyncThreads; -}; - -using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >; - -class DbConnection : - public std::enable_shared_from_this< DbConnection > -{ -public: - // Constructor for synchronous connections. - DbConnection( ConnectionInfo& connInfo ); - - // Constructor for asynchronous connections. - DbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* queue, ConnectionInfo& connInfo ); - - virtual ~DbConnection(); - - virtual uint32_t open(); - - void close(); - - bool prepareStatements(); - - bool execute( const std::string& sql ); - - bool execute( std::shared_ptr< PreparedStatement > stmt ); - - std::shared_ptr< Mysql::ResultSet > query( const std::string& sql ); - - std::shared_ptr< Mysql::ResultSet > query( std::shared_ptr< PreparedStatement > stmt ); - - void beginTransaction(); - - void rollbackTransaction(); - - void commitTransaction(); - - bool ping(); - - uint32_t getLastError(); - - bool lockIfReady(); - - void unlock(); - - std::shared_ptr< Mysql::Connection > getConnection() + enum ConnectionFlags { - return m_pConnection; - } + CONNECTION_ASYNC = 0x1, + CONNECTION_SYNC = 0x2, + CONNECTION_BOTH = CONNECTION_ASYNC | CONNECTION_SYNC + }; - std::shared_ptr< Mysql::PreparedStatement > getPreparedStatement( uint32_t index ); + struct ConnectionInfo + { + std::string user; + std::string password; + std::string database; + std::string host; + uint16_t port; + uint8_t syncThreads; + uint8_t asyncThreads; + }; - void prepareStatement( uint32_t index, const std::string& sql, ConnectionFlags flags ); + using PreparedStatementMap = std::map< uint32_t, std::pair< std::string, ConnectionFlags > >; - virtual void doPrepareStatements() = 0; + class DbConnection : + public std::enable_shared_from_this< DbConnection > + { + public: + // Constructor for synchronous connections. + DbConnection( ConnectionInfo& connInfo ); -protected: - std::vector< std::shared_ptr< Mysql::PreparedStatement > > m_stmts; - PreparedStatementMap m_queries; - bool m_reconnecting; - bool m_prepareError; + // Constructor for asynchronous connections. + DbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* queue, ConnectionInfo& connInfo ); -private: - LockedWaitQueue< std::shared_ptr< Operation > >* m_queue; - std::shared_ptr< DbWorker > m_worker; - std::shared_ptr< Mysql::Connection > m_pConnection; - ConnectionInfo& m_connectionInfo; - ConnectionFlags m_connectionFlags; - std::mutex m_mutex; + virtual ~DbConnection(); - DbConnection( DbConnection const& right ) = delete; + virtual uint32_t open(); - DbConnection& operator=( DbConnection const& right ) = delete; -}; + void close(); + + bool prepareStatements(); + + bool execute( const std::string& sql ); + + bool execute( std::shared_ptr< PreparedStatement > stmt ); + + std::shared_ptr< Mysql::ResultSet > query( const std::string& sql ); + + std::shared_ptr< Mysql::ResultSet > query( std::shared_ptr< PreparedStatement > stmt ); + + void beginTransaction(); + + void rollbackTransaction(); + + void commitTransaction(); + + bool ping(); + + uint32_t getLastError(); + + bool lockIfReady(); + + void unlock(); + + std::shared_ptr< Mysql::Connection > getConnection() + { + return m_pConnection; + } + + std::shared_ptr< Mysql::PreparedStatement > getPreparedStatement( uint32_t index ); + + void prepareStatement( uint32_t index, const std::string& sql, ConnectionFlags flags ); + + virtual void doPrepareStatements() = 0; + + protected: + std::vector< std::shared_ptr< Mysql::PreparedStatement > > m_stmts; + PreparedStatementMap m_queries; + bool m_reconnecting; + bool m_prepareError; + + private: + LockedWaitQueue< std::shared_ptr< Operation > >* m_queue; + std::shared_ptr< DbWorker > m_worker; + std::shared_ptr< Mysql::Connection > m_pConnection; + ConnectionInfo& m_connectionInfo; + ConnectionFlags m_connectionFlags; + std::mutex m_mutex; + + DbConnection( DbConnection const& right ) = delete; + + DbConnection& operator=( DbConnection const& right ) = delete; + }; } -} - #endif diff --git a/src/common/Database/DbLoader.h b/src/common/Database/DbLoader.h index 46070de5..a7b6ff9c 100644 --- a/src/common/Database/DbLoader.h +++ b/src/common/Database/DbLoader.h @@ -8,44 +8,43 @@ #include #include "DbConnection.h" -namespace Core { -namespace Db { - -template< class T > -class DbWorkerPool; - -class DbLoader +namespace Core::Db { -public: - DbLoader(); template< class T > - DbLoader& addDb( DbWorkerPool< T >& pool, const ConnectionInfo& info ); + class DbWorkerPool; - bool initDbs(); - - enum DbTypeFlags + class DbLoader { - DATABASE_NONE = 0, - DATABASE_CHARACTER = 1, - DATABASE_MASK_ALL = DATABASE_CHARACTER + public: + DbLoader(); + + template< class T > + DbLoader& addDb( DbWorkerPool< T >& pool, const ConnectionInfo& info ); + + bool initDbs(); + + enum DbTypeFlags + { + DATABASE_NONE = 0, + DATABASE_CHARACTER = 1, + DATABASE_MASK_ALL = DATABASE_CHARACTER + }; + + private: + bool openDatabases(); + + bool prepareStatements(); + + using Predicate = std::function< bool() >; + using Closer = std::function< void() >; + + bool process( std::queue< Predicate >& queue ); + + std::queue< Predicate > m_open; + std::queue< Predicate > m_prepare; + std::stack< Closer > m_close; }; - -private: - bool openDatabases(); - - bool prepareStatements(); - - using Predicate = std::function< bool() >; - using Closer = std::function< void() >; - - bool process( std::queue< Predicate >& queue ); - - std::queue< Predicate > m_open; - std::queue< Predicate > m_prepare; - std::stack< Closer > m_close; -}; -} } #endif //SAPPHIRE_DBLOADER_H diff --git a/src/common/Database/DbWorker.h b/src/common/Database/DbWorker.h index 7240cab1..30b9c1e8 100644 --- a/src/common/Database/DbWorker.h +++ b/src/common/Database/DbWorker.h @@ -6,35 +6,32 @@ #include "Util/LockedWaitQueue.h" #include -namespace Core { -namespace Db { -class DbConnection; - -class Operation; - -class DbWorker +namespace Core::Db { -public: - DbWorker( LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* connection ); + class DbConnection; + class Operation; - ~DbWorker(); + class DbWorker + { + public: + DbWorker( LockedWaitQueue< std::shared_ptr< Operation > >* newQueue, DbConnection* connection ); -private: - LockedWaitQueue< std::shared_ptr< Operation > >* m_queue; - DbConnection* m_pConn; + ~DbWorker(); - void workerThread(); + private: + LockedWaitQueue< std::shared_ptr< Operation > >* m_queue; + DbConnection* m_pConn; - std::thread m_workerThread; + void workerThread(); - std::atomic< bool > m_cancelationToken; + std::thread m_workerThread; - DbWorker( DbWorker const& right ) = delete; + std::atomic< bool > m_cancelationToken; - DbWorker& operator=( DbWorker const& right ) = delete; -}; + DbWorker( DbWorker const& right ) = delete; + + DbWorker& operator=( DbWorker const& right ) = delete; + }; } -} - #endif //SAPPHIRE_DBWORKER_H diff --git a/src/common/Database/DbWorkerPool.h b/src/common/Database/DbWorkerPool.h index 58723877..c23bf31f 100644 --- a/src/common/Database/DbWorkerPool.h +++ b/src/common/Database/DbWorkerPool.h @@ -8,89 +8,88 @@ #include "Util/LockedWaitQueue.h" #include "DbConnection.h" -namespace Core { -namespace Db { - -template< typename T > -class LockedWaitQueue; - -class Operation; - -class PreparedStatement; - -struct ConnectionInfo; - -template< class T > -class DbWorkerPool +namespace Core::Db { -private: - enum InternalIndex + + template< typename T > + class LockedWaitQueue; + + class Operation; + + class PreparedStatement; + + struct ConnectionInfo; + + template< class T > + class DbWorkerPool { - IDX_ASYNC, - IDX_SYNCH, - IDX_SIZE + private: + enum InternalIndex + { + IDX_ASYNC, + IDX_SYNCH, + IDX_SIZE + }; + + public: + DbWorkerPool(); + + ~DbWorkerPool(); + + void setConnectionInfo( const ConnectionInfo& info, uint8_t asyncThreads, uint8_t synchThreads ); + + uint32_t open(); + + void close(); + + bool prepareStatements(); + + inline ConnectionInfo getConnectionInfo() const + { + return m_connectionInfo; + } + + // Async execution + void execute( const std::string& sql ); + + void execute( std::shared_ptr< PreparedStatement > stmt ); + + // Sync execution + void directExecute( const std::string& sql ); + + void directExecute( std::shared_ptr< PreparedStatement > stmt ); + + std::shared_ptr< Mysql::ResultSet > + query( const std::string& sql, std::shared_ptr< T > connection = nullptr ); + + std::shared_ptr< Mysql::PreparedResultSet > query( std::shared_ptr< PreparedStatement > stmt ); + + using PreparedStatementIndex = typename T::Statements; + + std::shared_ptr< PreparedStatement > getPreparedStatement( PreparedStatementIndex index ); + + void escapeString( std::string& str ); + + void keepAlive(); + + private: + uint32_t openConnections( InternalIndex type, uint8_t numConnections ); + + unsigned long escapeString( char* to, const char* from, unsigned long length ); + + void enqueue( std::shared_ptr< Operation > op ); + + std::shared_ptr< T > getFreeConnection(); + + const std::string& getDatabaseName() const; + + std::unique_ptr< Core::LockedWaitQueue< std::shared_ptr< Operation > > > m_queue; + std::array< std::vector< std::shared_ptr< T > >, IDX_SIZE > m_connections; + ConnectionInfo m_connectionInfo; + uint8_t m_asyncThreads; + uint8_t m_synchThreads; }; -public: - DbWorkerPool(); - - ~DbWorkerPool(); - - void setConnectionInfo( const ConnectionInfo& info, uint8_t asyncThreads, uint8_t synchThreads ); - - uint32_t open(); - - void close(); - - bool prepareStatements(); - - inline ConnectionInfo getConnectionInfo() const - { - return m_connectionInfo; - } - - // Async execution - void execute( const std::string& sql ); - - void execute( std::shared_ptr< PreparedStatement > stmt ); - - // Sync execution - void directExecute( const std::string& sql ); - - void directExecute( std::shared_ptr< PreparedStatement > stmt ); - - std::shared_ptr< Mysql::ResultSet > - query( const std::string& sql, std::shared_ptr< T > connection = nullptr ); - - std::shared_ptr< Mysql::PreparedResultSet > query( std::shared_ptr< PreparedStatement > stmt ); - - using PreparedStatementIndex = typename T::Statements; - - std::shared_ptr< PreparedStatement > getPreparedStatement( PreparedStatementIndex index ); - - void escapeString( std::string& str ); - - void keepAlive(); - -private: - uint32_t openConnections( InternalIndex type, uint8_t numConnections ); - - unsigned long escapeString( char* to, const char* from, unsigned long length ); - - void enqueue( std::shared_ptr< Operation > op ); - - std::shared_ptr< T > getFreeConnection(); - - const std::string& getDatabaseName() const; - - std::unique_ptr< Core::LockedWaitQueue< std::shared_ptr< Operation > > > m_queue; - std::array< std::vector< std::shared_ptr< T > >, IDX_SIZE > m_connections; - ConnectionInfo m_connectionInfo; - uint8_t m_asyncThreads; - uint8_t m_synchThreads; -}; - -} } #endif //SAPPHIRE_DBWORKERPOOL_H diff --git a/src/common/Database/Operation.h b/src/common/Database/Operation.h index f79ebf06..1ce0a0d7 100644 --- a/src/common/Database/Operation.h +++ b/src/common/Database/Operation.h @@ -1,51 +1,49 @@ #ifndef SAPPHIRE_OPERATION_H #define SAPPHIRE_OPERATION_H -namespace Mysql { -class Connection; -} - -namespace Core { -namespace Db { -class DbConnection; - -class PreparedStatement; - -class Operation +namespace Mysql { -public: - Operation() : - m_pConn( nullptr ) - { - } - - virtual ~Operation() - { - } - - virtual int call() - { - execute(); - return 0; - } - - virtual bool execute() = 0; - - virtual void setConnection( DbConnection* pCon ) - { - m_pConn = pCon; - } - - DbConnection* m_pConn; - -private: - Operation( Operation const& right ) = delete; - - Operation& operator=( Operation const& right ) = delete; -}; - - + class Connection; } + +namespace Core::Db +{ + class DbConnection; + + class PreparedStatement; + + class Operation + { + public: + Operation() : + m_pConn( nullptr ) + { + } + + virtual ~Operation() + { + } + + virtual int call() + { + execute(); + return 0; + } + + virtual bool execute() = 0; + + virtual void setConnection( DbConnection* pCon ) + { + m_pConn = pCon; + } + + DbConnection* m_pConn; + + private: + Operation( Operation const& right ) = delete; + + Operation& operator=( Operation const& right ) = delete; + }; } #endif //SAPPHIRE_OPERATION_H diff --git a/src/common/Database/PreparedStatement.h b/src/common/Database/PreparedStatement.h index d6127c6d..798d90e4 100644 --- a/src/common/Database/PreparedStatement.h +++ b/src/common/Database/PreparedStatement.h @@ -7,85 +7,83 @@ #include #include "Operation.h" -namespace Mysql { -class PreparedStatement; +namespace Mysql +{ + class PreparedStatement; } -namespace Core { -namespace Db { -union PreparedStatementDataUnion +namespace Core::Db { - bool boolean; - uint32_t ui32; - int32_t i32; - uint64_t ui64; - int64_t i64; - double d; -}; + union PreparedStatementDataUnion + { + bool boolean; + uint32_t ui32; + int32_t i32; + uint64_t ui64; + int64_t i64; + double d; + }; -enum PreparedStatementValueType -{ - TYPE_BOOL, - TYPE_UI, - TYPE_UI64, - TYPE_I, - TYPE_I64, - TYPE_DOUBLE, - TYPE_STRING, - TYPE_BINARY, - TYPE_NULL -}; + enum PreparedStatementValueType + { + TYPE_BOOL, + TYPE_UI, + TYPE_UI64, + TYPE_I, + TYPE_I64, + TYPE_DOUBLE, + TYPE_STRING, + TYPE_BINARY, + TYPE_NULL + }; -struct PreparedStatementData -{ - PreparedStatementDataUnion data; - PreparedStatementValueType type; - std::vector< uint8_t > binary; -}; + struct PreparedStatementData + { + PreparedStatementDataUnion data; + PreparedStatementValueType type; + std::vector< uint8_t > binary; + }; -class PreparedStatement -{ -public: - explicit PreparedStatement( uint32_t index ); + class PreparedStatement + { + public: + explicit PreparedStatement( uint32_t index ); - ~PreparedStatement(); + ~PreparedStatement(); - void setBool( uint8_t index, bool value ); + void setBool( uint8_t index, bool value ); - void setUInt( uint8_t index, uint32_t value ); + void setUInt( uint8_t index, uint32_t value ); - void setUInt64( uint8_t index, uint64_t value ); + void setUInt64( uint8_t index, uint64_t value ); - void setInt( uint8_t index, int32_t value ); + void setInt( uint8_t index, int32_t value ); - void setInt64( uint8_t index, int64_t value ); + void setInt64( uint8_t index, int64_t value ); - void setDouble( uint8_t index, double value ); + void setDouble( uint8_t index, double value ); - void setString( uint8_t index, const std::string& value ); + void setString( uint8_t index, const std::string& value ); - void setBinary( uint8_t index, const std::vector< uint8_t >& value ); + void setBinary( uint8_t index, const std::vector< uint8_t >& value ); - void setNull( uint8_t index ); + void setNull( uint8_t index ); - uint32_t getIndex() const; + uint32_t getIndex() const; - void setMysqlPS( std::shared_ptr< Mysql::PreparedStatement > pStmt ); + void setMysqlPS( std::shared_ptr< Mysql::PreparedStatement > pStmt ); - void bindParameters(); + void bindParameters(); -protected: - std::shared_ptr< Mysql::PreparedStatement > m_stmt; - uint32_t m_index; - std::vector< PreparedStatementData > m_statementData; + protected: + std::shared_ptr< Mysql::PreparedStatement > m_stmt; + uint32_t m_index; + std::vector< PreparedStatementData > m_statementData; - PreparedStatement( PreparedStatement const& right ) = delete; + PreparedStatement( PreparedStatement const& right ) = delete; - PreparedStatement& operator=( PreparedStatement const& right ) = delete; -}; - - -} + PreparedStatement& operator=( PreparedStatement const& right ) = delete; + }; } diff --git a/src/common/Database/StatementTask.h b/src/common/Database/StatementTask.h index 782e0f52..7054dbb8 100644 --- a/src/common/Database/StatementTask.h +++ b/src/common/Database/StatementTask.h @@ -5,50 +5,49 @@ #include "Operation.h" #include -namespace Core { -namespace Db { -class PreparedStatement; - -class StatementTask : - public Operation +namespace Core::Db { -public: + class PreparedStatement; - StatementTask( const std::string& sql, bool async = false ); + class StatementTask : + public Operation + { + public: - ~StatementTask(); + StatementTask( const std::string& sql, bool async = false ); - bool execute() override; + ~StatementTask(); - // QueryResultFuture getFuture() const - // { - // return m_result->get_future(); - // } + bool execute() override; -private: - std::string m_sql; - bool m_hasResult; -// QueryResultPromise *m_result; -}; + // QueryResultFuture getFuture() const + // { + // return m_result->get_future(); + // } -class PreparedStatementTask : - public Operation -{ -public: - PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false ); + private: + std::string m_sql; + bool m_hasResult; + // QueryResultPromise *m_result; + }; - ~PreparedStatementTask(); + class PreparedStatementTask : + public Operation + { + public: + PreparedStatementTask( std::shared_ptr< PreparedStatement > stmt, bool async = false ); - bool execute() override; - //PreparedQueryResultFuture getFuture() { return m_result->get_future(); } + ~PreparedStatementTask(); -protected: - std::shared_ptr< PreparedStatement > m_stmt; - bool m_hasResult; - //PreparedQueryResultPromise* m_result; -}; + bool execute() override; + //PreparedQueryResultFuture getFuture() { return m_result->get_future(); } + + protected: + std::shared_ptr< PreparedStatement > m_stmt; + bool m_hasResult; + //PreparedQueryResultPromise* m_result; + }; -} } diff --git a/src/common/Database/ZoneDbConnection.h b/src/common/Database/ZoneDbConnection.h index 1bf61944..b89e27e9 100644 --- a/src/common/Database/ZoneDbConnection.h +++ b/src/common/Database/ZoneDbConnection.h @@ -3,100 +3,99 @@ #include "DbConnection.h" -namespace Core { -namespace Db { -class DbConnectionInfo; - -enum ZoneDbStatements : uint32_t +namespace Core::Db { - CHARA_SEL, - CHARA_SEL_MINIMAL, - CHARA_SEL_SEARCHINFO, - CHARA_SEL_QUEST, - CHARA_INS, - CHARA_UP, - CHARA_UP_NAME, - CHARA_UP_HPMP, - CHARA_UP_MODE, - CHARA_UP_MOUNT, - CHARA_UP_INVINCIBLE, - CHARA_UP_CUSTOMIZE, - CHARA_UP_MODELMAINWEAP, - CHARA_UP_MODELSUBWEAP, - CHARA_UP_MODELSYSWEAP, - CHARA_UP_MODELEQUIP, - CHARA_UP_EMOTEMODETYPE, - CHARA_UP_FIRSTLOGINTIME, - CHARA_UP_LANGUAGE, - CHARA_UP_ISNEWGAME, - CHARA_UP_ISNEWADV, - CHARA_UP_TERRITORY, - CHARA_UP_POS, - CHARA_UP_CLASS, - CHARA_UP_STATUS, - CHARA_UP_TOTALPLAYTIME, - CHARA_UP_HOMEPOINT, - CHARA_UP_FAVOPOINT, - CHARA_UP_TITLE, - CHARA_UP_TITLELIST, - CHARA_UP_ACHIEVEMENTS, - CHARA_UP_AETHERYTE, - CHARA_UP_HOWTO, - CHARA_UP_MINIONS, - CHARA_UP_MOUNTS, - CHARA_UP_GEARSET, - CHARA_UP_CONFIGFLAGS, - CHARA_UP_QUESTCOMPLETE, - CHARA_UP_OPENINGSEQ, - CHARA_UP_QUESTTRACKING, - CHARA_UP_GRANDCOMPANY, - CHARA_UP_GRANDCOMPANYRANKS, - CHARA_UP_DISCOVERY, - CHARA_UP_GMRANK, - CHARA_UP_EQUIPDISPLAYFLAGS, - CHARA_UP_UNLOCKS, - CHARA_UP_CFPENATLY, - CHARA_SEARCHINFO_INS, - CHARA_SEARCHINFO_UP_SELECTCLASS, - CHARA_SEARCHINFO_UP_SELECTREGION, - CHARA_SEARCHINFO_UP_SEARCHCOMMENT, + class DbConnectionInfo; - CHARA_QUEST_INS, - CHARA_QUEST_UP, - CHARA_QUEST_DEL, + enum ZoneDbStatements : uint32_t + { + CHARA_SEL, + CHARA_SEL_MINIMAL, + CHARA_SEL_SEARCHINFO, + CHARA_SEL_QUEST, + CHARA_INS, + CHARA_UP, + CHARA_UP_NAME, + CHARA_UP_HPMP, + CHARA_UP_MODE, + CHARA_UP_MOUNT, + CHARA_UP_INVINCIBLE, + CHARA_UP_CUSTOMIZE, + CHARA_UP_MODELMAINWEAP, + CHARA_UP_MODELSUBWEAP, + CHARA_UP_MODELSYSWEAP, + CHARA_UP_MODELEQUIP, + CHARA_UP_EMOTEMODETYPE, + CHARA_UP_FIRSTLOGINTIME, + CHARA_UP_LANGUAGE, + CHARA_UP_ISNEWGAME, + CHARA_UP_ISNEWADV, + CHARA_UP_TERRITORY, + CHARA_UP_POS, + CHARA_UP_CLASS, + CHARA_UP_STATUS, + CHARA_UP_TOTALPLAYTIME, + CHARA_UP_HOMEPOINT, + CHARA_UP_FAVOPOINT, + CHARA_UP_TITLE, + CHARA_UP_TITLELIST, + CHARA_UP_ACHIEVEMENTS, + CHARA_UP_AETHERYTE, + CHARA_UP_HOWTO, + CHARA_UP_MINIONS, + CHARA_UP_MOUNTS, + CHARA_UP_GEARSET, + CHARA_UP_CONFIGFLAGS, + CHARA_UP_QUESTCOMPLETE, + CHARA_UP_OPENINGSEQ, + CHARA_UP_QUESTTRACKING, + CHARA_UP_GRANDCOMPANY, + CHARA_UP_GRANDCOMPANYRANKS, + CHARA_UP_DISCOVERY, + CHARA_UP_GMRANK, + CHARA_UP_EQUIPDISPLAYFLAGS, + CHARA_UP_UNLOCKS, + CHARA_UP_CFPENATLY, + CHARA_SEARCHINFO_INS, + CHARA_SEARCHINFO_UP_SELECTCLASS, + CHARA_SEARCHINFO_UP_SELECTREGION, + CHARA_SEARCHINFO_UP_SEARCHCOMMENT, - CHARA_CLASS_SEL, - CHARA_CLASS_INS, - CHARA_CLASS_UP, - CHARA_CLASS_DEL, + CHARA_QUEST_INS, + CHARA_QUEST_UP, + CHARA_QUEST_DEL, - CHARA_ITEMINV_INS, + CHARA_CLASS_SEL, + CHARA_CLASS_INS, + CHARA_CLASS_UP, + CHARA_CLASS_DEL, - CHARA_ITEMGLOBAL_INS, - CHARA_ITEMGLOBAL_UP, - CHARA_ITEMGLOBAL_DELETE, + CHARA_ITEMINV_INS, - ZONE_SEL_BNPCTEMPLATES, + CHARA_ITEMGLOBAL_INS, + CHARA_ITEMGLOBAL_UP, + CHARA_ITEMGLOBAL_DELETE, - MAX_STATEMENTS -}; + ZONE_SEL_BNPCTEMPLATES, -class ZoneDbConnection : public DbConnection -{ -public: - using Statements = ZoneDbStatements; + MAX_STATEMENTS + }; - ZoneDbConnection( ConnectionInfo& connInfo ); + class ZoneDbConnection : public DbConnection + { + public: + using Statements = ZoneDbStatements; - ZoneDbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* q, ConnectionInfo& connInfo ); + ZoneDbConnection( ConnectionInfo& connInfo ); - ~ZoneDbConnection(); + ZoneDbConnection( Core::LockedWaitQueue< std::shared_ptr< Operation > >* q, ConnectionInfo& connInfo ); - void doPrepareStatements() override; + ~ZoneDbConnection(); -}; + void doPrepareStatements() override; + + }; -} } #endif //SAPPHIRE_CHARACONNECTION_H diff --git a/src/common/Exd/ExdDataGenerated.h b/src/common/Exd/ExdDataGenerated.h index 36d08caf..ea74b624 100644 --- a/src/common/Exd/ExdDataGenerated.h +++ b/src/common/Exd/ExdDataGenerated.h @@ -13,8 +13,8 @@ #include #include -namespace Core { -namespace Data { +namespace Core::Data +{ class ExdDataGenerated; @@ -8694,7 +8694,6 @@ const std::set< uint32_t >& getZoneSharedGroupIdList() }; } -} #endif diff --git a/src/common/Forwards.h b/src/common/Forwards.h index 15a5c7c0..54f11073 100644 --- a/src/common/Forwards.h +++ b/src/common/Forwards.h @@ -3,34 +3,30 @@ #include -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; -} - -} + } } diff --git a/src/common/Framework.h b/src/common/Framework.h index 70543813..e5450129 100644 --- a/src/common/Framework.h +++ b/src/common/Framework.h @@ -7,29 +7,30 @@ #include #include -namespace Core { - -class Framework +namespace Core { - using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >; - TypenameToObject ObjectMap; -public: - template< typename T > - std::shared_ptr< T > get() + class Framework { - auto iType = ObjectMap.find( typeid( T ) ); - assert( !( iType == ObjectMap.end() ) ); - return std::static_pointer_cast< T >( iType->second ); - } + using TypenameToObject = std::map< std::type_index, std::shared_ptr< void > >; + TypenameToObject ObjectMap; - template< typename T > - void set( std::shared_ptr< T > value ) - { - assert( value ); // why would anyone store nullptrs.... - ObjectMap[ typeid( T ) ] = value; - } -}; + public: + template< typename T > + std::shared_ptr< T > get() + { + auto iType = ObjectMap.find( typeid( T ) ); + assert( !( iType == ObjectMap.end() ) ); + return std::static_pointer_cast< T >( iType->second ); + } + + template< typename T > + void set( std::shared_ptr< T > value ) + { + assert( value ); // why would anyone store nullptrs.... + ObjectMap[ typeid( T ) ] = value; + } + }; } diff --git a/src/common/Logging/Logger.cpp b/src/common/Logging/Logger.cpp index 0f8c2c24..96225ebd 100644 --- a/src/common/Logging/Logger.cpp +++ b/src/common/Logging/Logger.cpp @@ -48,11 +48,6 @@ void Logger::init() spdlog::flush_on( spdlog::level::critical ); } - -void Logger::Log( LoggingSeverity logSev, const std::string& text ) -{ -} - void Logger::error( const std::string& text ) { spdlog::get( "logger" )->error( text ); diff --git a/src/common/Logging/Logger.h b/src/common/Logging/Logger.h index f866b9c5..b35f3b9d 100644 --- a/src/common/Logging/Logger.h +++ b/src/common/Logging/Logger.h @@ -3,45 +3,33 @@ #include -namespace Core { - -enum struct LoggingSeverity : uint8_t -{ - trace = 0, - debug = 1, - info = 2, - warning = 3, - error = 4, - fatal = 5 -}; - -class Logger +namespace Core { -private: - std::string m_logFile; + class Logger + { -public: - Logger(); + private: + std::string m_logFile; - ~Logger(); + public: + Logger(); - void init(); + ~Logger(); - void Log( LoggingSeverity logSev, const std::string& text ); + void init(); - void error( const std::string& text ); + void error( const std::string& text ); - void info( const std::string& text ); + void info( const std::string& text ); - void debug( const std::string& text ); + void debug( const std::string& text ); - void fatal( const std::string& text ); + void fatal( const std::string& text ); - void setLogPath( const std::string& logPath ); - -}; + void setLogPath( const std::string& logPath ); + }; } diff --git a/src/common/Network/Acceptor.h b/src/common/Network/Acceptor.h index d1bda12c..1670d8a2 100644 --- a/src/common/Network/Acceptor.h +++ b/src/common/Network/Acceptor.h @@ -13,75 +13,74 @@ #include -namespace Core { -namespace Network { - -class Connection; - -class Acceptor : public std::enable_shared_from_this< Acceptor > +namespace Core::Network { - friend class Hive; -private: - HivePtr m_hive; - asio::ip::tcp::acceptor m_acceptor; - asio::strand m_io_strand; - std::atomic< uint32_t > m_error_state; + class Connection; -private: - Acceptor( const Acceptor& rhs ); + class Acceptor : public std::enable_shared_from_this< Acceptor > + { + friend class Hive; - Acceptor& operator=( const Acceptor& rhs ); + private: + HivePtr m_hive; + asio::ip::tcp::acceptor m_acceptor; + asio::strand m_io_strand; + std::atomic< uint32_t > m_error_state; - void StartError( const asio::error_code& error ); + private: + Acceptor( const Acceptor& rhs ); - void DispatchAccept( ConnectionPtr connection ); + Acceptor& operator=( const Acceptor& rhs ); - void HandleAccept( const asio::error_code& error, ConnectionPtr connection ); + void StartError( const asio::error_code& error ); -private: - // Called when a connection has connected to the server. This function - // 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's Disconnect function should be called and the function - // should return false. - virtual bool OnAccept( ConnectionPtr connection, const std::string& host, uint16_t port ); + void DispatchAccept( ConnectionPtr connection ); - // Called when an error is encountered. Most typically, this is when the - // acceptor is being closed via the Stop function or if the Listen is - // called on an address that is not available. - virtual void OnError( const asio::error_code& error ); + void HandleAccept( const asio::error_code& error, ConnectionPtr connection ); -public: - Acceptor( HivePtr hive ); + private: + // Called when a connection has connected to the server. This function + // 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's Disconnect function should be called and the function + // should return false. + virtual bool OnAccept( ConnectionPtr connection, const std::string& host, uint16_t port ); - virtual ~Acceptor(); + // Called when an error is encountered. Most typically, this is when the + // acceptor is being closed via the Stop function or if the Listen is + // called on an address that is not available. + virtual void OnError( const asio::error_code& error ); - // Returns the Hive object. - HivePtr GetHive(); + public: + Acceptor( HivePtr hive ); - // Returns the acceptor object. - asio::ip::tcp::acceptor& GetAcceptor(); + virtual ~Acceptor(); - // Returns the strand object. - asio::strand& GetStrand(); + // Returns the Hive object. + HivePtr GetHive(); - // Returns true if this object has an error associated with it. - bool HasError(); + // Returns the acceptor object. + asio::ip::tcp::acceptor& GetAcceptor(); -public: - // Begin listening on the specific network interface. - void Listen( const std::string& host, const uint16_t& port ); + // Returns the strand object. + asio::strand& GetStrand(); - // Posts the connection to the listening interface. The next client that - // connections will be given this connection. If multiple calls to Accept - // are called at a time, then they are accepted in a FIFO order. - void Accept( ConnectionPtr connection ); + // Returns true if this object has an error associated with it. + bool HasError(); - // Stop the Acceptor from listening. - void Stop(); -}; + public: + // Begin listening on the specific network interface. + void Listen( const std::string& host, const uint16_t& port ); + + // Posts the connection to the listening interface. The next client that + // connections will be given this connection. If multiple calls to Accept + // are called at a time, then they are accepted in a FIFO order. + void Accept( ConnectionPtr connection ); + + // Stop the Acceptor from listening. + void Stop(); + }; -} } #endif diff --git a/src/common/Network/CommonNetwork.h b/src/common/Network/CommonNetwork.h index f8be9aeb..ede5be3f 100644 --- a/src/common/Network/CommonNetwork.h +++ b/src/common/Network/CommonNetwork.h @@ -5,182 +5,179 @@ #include #include "PacketDef/Ipcs.h" -namespace Core { -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 +namespace Core::Network::Packets { - /** Unknown data, no actual use has been determined */ - uint64_t unknown_0; - uint64_t unknown_8; - /** Represents the number of milliseconds since epoch that the packet was sent. */ - uint64_t timestamp; - /** The size of the packet header and its payload */ - uint32_t size; - /** The type of this connection - 1 zone, 2 chat*/ - uint16_t connectionType; - /** The number of packet segments that follow. */ - uint16_t count; - uint8_t unknown_20; - /** Indicates if the data segments of this packet are compressed. */ - uint8_t isCompressed; - uint32_t unknown_24; -}; -inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_HEADER& hdr ) -{ - return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr ); -} + /** + * 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. + */ -inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_HEADER& hdr ) -{ - return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); -} - -/** -* Structure representing the header portion of a packet segment. -* -* 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. -* -* 0 4 8 12 16 -* +---------------+---------------+---------------+-------+-------+ -* | size | source_actor | target_actor | type | pad | -* +---------------+---------------+---------------+-------+-------+ -* | | -* : type-specific data of length, size, follows : -* | (NOTE: Some segments MAY be encrypted) | -* +---------------------------------------------------------------+ -*/ -struct FFXIVARR_PACKET_SEGMENT_HEADER -{ - /** The size of the segment header and its data. */ - uint32_t size; - /** The session ID this segment describes. */ - uint32_t source_actor; - /** The session ID this packet is being delivered to. */ - uint32_t target_actor; - /** The segment type. (1, 2, 3, 7, 8, 9, 10) */ - uint16_t type; - uint16_t padding; -}; - -inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr ) -{ - return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr ); -} - -inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr ) -{ - return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); -} - -template< int T > -struct FFXIVIpcBasePacket -{ - /** Creates a constant representing the IPC type */ - enum + /** + * 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 { - _ServerIpcType = T + /** Unknown data, no actual use has been determined */ + uint64_t unknown_0; + uint64_t unknown_8; + /** Represents the number of milliseconds since epoch that the packet was sent. */ + uint64_t timestamp; + /** The size of the packet header and its payload */ + uint32_t size; + /** The type of this connection - 1 zone, 2 chat*/ + uint16_t connectionType; + /** The number of packet segments that follow. */ + uint16_t count; + uint8_t unknown_20; + /** Indicates if the data segments of this packet are compressed. */ + uint8_t isCompressed; + uint32_t unknown_24; }; -}; -struct FFXIVARR_PACKET_RAW -{ - FFXIVARR_PACKET_SEGMENT_HEADER segHdr; - std::vector< uint8_t > data; -}; + inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_HEADER& hdr ) + { + return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr ); + } -/** - * Indicates the type of the segment - * 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 - */ -enum FFXIVARR_SEGMENT_TYPE -{ - SEGMENTTYPE_SESSIONINIT = 1, - SEGMENTTYPE_IPC = 3, - SEGMENTTYPE_KEEPALIVE = 7, - //SEGMENTTYPE_RESPONSE = 8, - SEGMENTTYPE_ENCRYPTIONINIT = 9, -}; + inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_HEADER& hdr ) + { + return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); + } -/** -* Structural representation of the common header for IPC packet segments. -* NOTE: This is packet segment type 3. -* -* 0 4 6 8 12 16 -* +-------+-------+------+----------+---------------+---------------+ -* | 14 00 | type | pad | serverId | timestamp | pad1 | -* +-------+-------+------+----------+---------------+---------------+ -* | | -* : data : -* | | -* +-----------------------------------------------------------------+ -*/ -struct FFXIVARR_IPC_HEADER -{ - uint16_t reserved; - uint16_t type; - uint16_t padding; - uint16_t serverId; - uint32_t timestamp; - uint32_t padding1; -}; + /** + * Structure representing the header portion of a packet segment. + * + * 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. + * + * 0 4 8 12 16 + * +---------------+---------------+---------------+-------+-------+ + * | size | source_actor | target_actor | type | pad | + * +---------------+---------------+---------------+-------+-------+ + * | | + * : type-specific data of length, size, follows : + * | (NOTE: Some segments MAY be encrypted) | + * +---------------------------------------------------------------+ + */ + struct FFXIVARR_PACKET_SEGMENT_HEADER + { + /** The size of the segment header and its data. */ + uint32_t size; + /** The session ID this segment describes. */ + uint32_t source_actor; + /** The session ID this packet is being delivered to. */ + uint32_t target_actor; + /** The segment type. (1, 2, 3, 7, 8, 9, 10) */ + uint16_t type; + uint16_t padding; + }; + + inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_PACKET_SEGMENT_HEADER& hdr ) + { + return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr ); + } + + inline std::istream& operator>>( std::istream& is, FFXIVARR_PACKET_SEGMENT_HEADER& hdr ) + { + return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); + } + + template< int T > + struct FFXIVIpcBasePacket + { + /** Creates a constant representing the IPC type */ + enum + { + _ServerIpcType = T + }; + }; + + struct FFXIVARR_PACKET_RAW + { + FFXIVARR_PACKET_SEGMENT_HEADER segHdr; + std::vector< uint8_t > data; + }; + + /** + * Indicates the type of the segment + * 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 + */ + enum FFXIVARR_SEGMENT_TYPE + { + SEGMENTTYPE_SESSIONINIT = 1, + SEGMENTTYPE_IPC = 3, + SEGMENTTYPE_KEEPALIVE = 7, + //SEGMENTTYPE_RESPONSE = 8, + SEGMENTTYPE_ENCRYPTIONINIT = 9, + }; + + /** + * Structural representation of the common header for IPC packet segments. + * NOTE: This is packet segment type 3. + * + * 0 4 6 8 12 16 + * +-------+-------+------+----------+---------------+---------------+ + * | 14 00 | type | pad | serverId | timestamp | pad1 | + * +-------+-------+------+----------+---------------+---------------+ + * | | + * : data : + * | | + * +-----------------------------------------------------------------+ + */ + struct FFXIVARR_IPC_HEADER + { + uint16_t reserved; + uint16_t type; + uint16_t padding; + uint16_t serverId; + uint32_t timestamp; + uint32_t padding1; + }; + + inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_IPC_HEADER& hdr ) + { + return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr ); + } + + inline std::istream& operator>>( std::istream& is, FFXIVARR_IPC_HEADER& hdr ) + { + return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); + } -inline std::ostream& operator<<( std::ostream& os, const FFXIVARR_IPC_HEADER& hdr ) -{ - return os.write( reinterpret_cast< const char* >( &hdr ), sizeof hdr ); } -inline std::istream& operator>>( std::istream& is, FFXIVARR_IPC_HEADER& hdr ) -{ - return is.read( reinterpret_cast< char* >( &hdr ), sizeof hdr ); -} - -} /* Packets */ -} /* Network */ -} /* Core */ - #endif /*_CORE_NETWORK_PACKETS_COMMON_H*/ diff --git a/src/common/Network/Connection.h b/src/common/Network/Connection.h index dda75bfe..e4e77381 100644 --- a/src/common/Network/Connection.h +++ b/src/common/Network/Connection.h @@ -12,157 +12,153 @@ #include "Acceptor.h" #include -namespace Core { -namespace Network { -//----------------------------------------------------------------------------- - -class Hive; - -class Acceptor; - -class Connection; - -//----------------------------------------------------------------------------- - -class Connection : public std::enable_shared_from_this< Connection > +namespace Core::Network { - friend class Acceptor; - friend class Hive; + class Hive; -protected: - HivePtr m_hive; - asio::ip::tcp::socket m_socket; - asio::strand m_io_strand; - std::vector< uint8_t > m_recv_buffer; - std::list< int32_t > m_pending_recvs; - std::list< std::vector< uint8_t > > m_pending_sends; - int32_t m_receive_buffer_size; - std::atomic< uint32_t > m_error_state; + class Acceptor; + class Connection; - Connection( HivePtr hive ); + //----------------------------------------------------------------------------- - virtual ~Connection(); - -private: - Connection( const Connection& rhs ); - - Connection& operator=( const Connection& rhs ); - - void StartSend(); - - void StartRecv( int32_t total_bytes ); - - void StartError( const asio::error_code& error ); - - void DispatchSend( std::vector< uint8_t > buffer ); - - void DispatchRecv( int32_t total_bytes ); - - void HandleConnect( const asio::error_code& error ); - - void HandleSend( const asio::error_code& error, std::list< std::vector< uint8_t > >::iterator itr ); - - void HandleRecv( const asio::error_code& error, int32_t actual_bytes ); - - -private: - // Called when the connection has successfully connected to the local host. - virtual void OnAccept( const std::string& host, uint16_t port ) + class Connection : public std::enable_shared_from_this< Connection > { + friend class Acceptor; + + friend class Hive; + + protected: + HivePtr m_hive; + asio::ip::tcp::socket m_socket; + asio::strand m_io_strand; + std::vector< uint8_t > m_recv_buffer; + std::list< int32_t > m_pending_recvs; + std::list< std::vector< uint8_t > > m_pending_sends; + int32_t m_receive_buffer_size; + std::atomic< uint32_t > m_error_state; + + + Connection( HivePtr hive ); + + virtual ~Connection(); + + private: + Connection( const Connection& rhs ); + + Connection& operator=( const Connection& rhs ); + + void StartSend(); + + void StartRecv( int32_t total_bytes ); + + void StartError( const asio::error_code& error ); + + void DispatchSend( std::vector< uint8_t > buffer ); + + void DispatchRecv( int32_t total_bytes ); + + void HandleConnect( const asio::error_code& error ); + + void HandleSend( const asio::error_code& error, std::list< std::vector< uint8_t > >::iterator itr ); + + void HandleRecv( const asio::error_code& error, int32_t actual_bytes ); + + + private: + // Called when the connection has successfully connected to the local host. + virtual void OnAccept( const std::string& host, uint16_t port ) + { + }; + + // Called when the connection has successfully connected to the remote host. + virtual void OnConnect( const std::string& host, uint16_t port ) + { + }; + + // Called when data has been sent by the connection. + virtual void OnSend( const std::vector< uint8_t >& buffer ) + { + }; + + // Called when data has been received by the connection. + virtual void OnRecv( std::vector< uint8_t >& buffer ) + { + }; + + // Called when an error is encountered. + virtual void OnError( const asio::error_code& error ) + { + }; + + // Called when the connection has been disconnected + virtual void OnDisconnect() + { + }; + + public: + // Returns the Hive object. + HivePtr GetHive(); + + // Returns the socket object. + asio::ip::tcp::socket& GetSocket(); + + // Returns the strand object. + asio::strand& GetStrand(); + + // Sets the application specific receive buffer size used. For stream + // based protocols such as HTTP, you want this to be pretty large, like + // 64kb. For packet based protocols, then it will be much smaller, + // usually 512b - 8kb depending on the protocol. The default value is + // 4kb. + void SetReceiveBufferSize( int32_t size ); + + // Returns the size of the receive buffer size of the current object. + int32_t GetReceiveBufferSize() const; + + // Returns true if this object has an error associated with it. + bool HasError(); + + // Binds the socket to the specified interface. + void Bind( const std::string& ip, uint16_t port ); + + // Starts an a/synchronous connect. + void Connect( const std::string& host, uint16_t port ); + + // Posts data to be sent to the connection. + void Send( const std::vector< uint8_t >& buffer ); + + // Posts a recv for the connection to process. If total_bytes is 0, then + // as many bytes as possible up to GetReceiveBufferSize() will be + // waited for. If Recv is not 0, then the connection will wait for exactly + // total_bytes before invoking OnRecv. + void Recv( int32_t total_bytes = 0 ); + + // Posts an asynchronous disconnect event for the object to process. + void Disconnect(); }; - // Called when the connection has successfully connected to the remote host. - virtual void OnConnect( const std::string& host, uint16_t port ) + //----------------------------------------------------------------------------- + + //----------------------------------------------------------------------------- + + template< class T > + std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive ) { - }; - - // Called when data has been sent by the connection. - virtual void OnSend( const std::vector< uint8_t >& buffer ) - { - }; - - // Called when data has been received by the connection. - virtual void OnRecv( std::vector< uint8_t >& buffer ) - { - }; - - // Called when an error is encountered. - virtual void OnError( const asio::error_code& error ) - { - }; - - // Called when the connection has been disconnected - virtual void OnDisconnect() - { - }; - -public: - // Returns the Hive object. - HivePtr GetHive(); - - // Returns the socket object. - asio::ip::tcp::socket& GetSocket(); - - // Returns the strand object. - asio::strand& GetStrand(); - - // Sets the application specific receive buffer size used. For stream - // based protocols such as HTTP, you want this to be pretty large, like - // 64kb. For packet based protocols, then it will be much smaller, - // usually 512b - 8kb depending on the protocol. The default value is - // 4kb. - void SetReceiveBufferSize( int32_t size ); - - // Returns the size of the receive buffer size of the current object. - int32_t GetReceiveBufferSize() const; - - // Returns true if this object has an error associated with it. - bool HasError(); - - // Binds the socket to the specified interface. - void Bind( const std::string& ip, uint16_t port ); - - // Starts an a/synchronous connect. - void Connect( const std::string& host, uint16_t port ); - - // Posts data to be sent to the connection. - void Send( const std::vector< uint8_t >& buffer ); - - // Posts a recv for the connection to process. If total_bytes is 0, then - // as many bytes as possible up to GetReceiveBufferSize() will be - // waited for. If Recv is not 0, then the connection will wait for exactly - // total_bytes before invoking OnRecv. - void Recv( int32_t total_bytes = 0 ); - - // Posts an asynchronous disconnect event for the object to process. - void Disconnect(); -}; - -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- - -template< class T > -std::shared_ptr< T > addServerToHive( const std::string& listenIp, uint32_t port, HivePtr pHive ) -{ - try - { - AcceptorPtr acceptor( new Acceptor( pHive ) ); - acceptor->Listen( listenIp, port ); - std::shared_ptr< T > connection( new T( pHive, acceptor ) ); - acceptor->Accept( connection ); - return connection; + try + { + AcceptorPtr acceptor( new Acceptor( pHive ) ); + acceptor->Listen( listenIp, port ); + std::shared_ptr< T > connection( new T( pHive, acceptor ) ); + acceptor->Accept( connection ); + return connection; + } + catch( std::runtime_error e ) + { + throw; + } } - catch( std::runtime_error e ) - { - throw; - } -} - -} - } #endif diff --git a/src/common/Network/GamePacketNew.h b/src/common/Network/GamePacketNew.h index 3de6c5b0..15ff798d 100644 --- a/src/common/Network/GamePacketNew.h +++ b/src/common/Network/GamePacketNew.h @@ -14,326 +14,323 @@ #include "CommonNetwork.h" #include "PacketDef/Ipcs.h" -namespace Core { -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 ) +namespace Core::Network::Packets { - return std::make_shared< ZoneChannelPacket< T > >( 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... ); + } + + template< class T, typename... Args > + std::shared_ptr< T > makeWrappedPacket( Args... args ) + { + return std::make_shared< T >( args... ); + } + + template< class T, typename... Args > + std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args ) + { + return std::make_shared< ChatChannelPacket< T > >( args... ); + } + + template< class T, typename... Args > + std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args ) + { + return std::make_shared< LobbyChannelPacket< T > >( args... ); + } + + /** + * The base implementation of a game packet. Needed for parsing packets. + */ + template< typename T1 > + class FFXIVIpcPacketBase + { + public: + virtual ~FFXIVIpcPacketBase() = default; + + /** + * @brief Gets the IPC type of this packet. (Useful for determining the + * type of a parsed packet.) + */ + virtual T1 ipcType() = 0; + }; + + ////////////////////////////////////////////////7 + + class FFXIVPacketBase + { + public: + FFXIVPacketBase() : + m_segmentType( 0 ) + { + initializeSegmentHeader(); + } + + FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) : + m_segmentType( segmentType ) + { + initializeSegmentHeader(); + setSourceActor( sourceActorId ); + setTargetActor( targetActorId ); + } + + std::size_t getSize() const + { + return m_segHdr.size; + } + + virtual std::vector< uint8_t > getData() const + { + return {}; + } + + protected: + /** The segment header */ + FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr; + uint16_t m_segmentType; + + public: + virtual uint32_t getContentSize() + { + return 0; + }; + + virtual std::vector< uint8_t > getContent() + { + return {}; + }; + + /** + * @brief Gets the segment type of this packet. + */ + uint16_t getSegmentType() const + { + return m_segmentType; + } + + /** + * @brief Sets the source actor id for this packet. + * @param actorId The source actor id. + */ + void setSourceActor( uint32_t actorId ) + { + m_segHdr.source_actor = actorId; + }; + + /** + * @brief Gets the source actor id for this packet. + * @return The source actor id. + */ + uint32_t getSourceActor() const + { + return m_segHdr.source_actor; + }; + + /** + * @brief Sets the target actor id for this packet. + * @param actorId The target actor id. + */ + void setTargetActor( uint32_t actorId ) + { + m_segHdr.target_actor = actorId; + }; + + /** + * @brief Gets the target actor id for this packet. + */ + uint32_t getTargetActor( void ) const + { + return m_segHdr.target_actor; + }; + + /** Initializes the fields of the segment header structure */ + virtual void initializeSegmentHeader( void ) + { + // Zero out the structure. + memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ); + + // Set the values of static fields. + // The size must be the sum of the segment header and the content + m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize(); + m_segHdr.type = getSegmentType(); + } + + }; + + template< typename T, typename T1 > + class FFXIVIpcPacket : + public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase + { + public: + FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) : + FFXIVPacketBase( 3, sourceActorId, targetActorId ) + { + initialize(); + }; + + FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) : + FFXIVPacketBase( 3, sourceActorId, sourceActorId ) + { + initialize(); + }; + + FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket ) + { + auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER ); + auto copySize = std::min< uint32_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize ); + + memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ); + memcpy( &m_data, &rawPacket.data[ 0 ] + ipcHdrSize, copySize ); + + memset( &m_ipcHdr, 0, ipcHdrSize ); + m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType ); + } + + uint32_t getContentSize() override + { + return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T ); + } + + std::vector< uint8_t > getContent() override + { + std::vector< uint8_t > content( getContentSize() ); + memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) ); + memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) ); + return content; + } + + std::vector< uint8_t > getData() const override + { + auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); + auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER ); + auto dataSize = sizeof( m_data ); + + std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize ); + + memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize ); + memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize ); + memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize ); + + return data; + } + + T1 ipcType() override + { + return static_cast< T1 >( m_data._ServerIpcType ); + }; + + /** Gets a reference to the underlying IPC data structure. */ + T& data() + { + return m_data; + }; + + const T& data() const + { + return m_data; + } + + protected: + /** Initializes the fields of the header structures */ + virtual void initialize() + { + // Zero out the structures. + memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) ); + memset( &m_data, 0, sizeof( T ) ); + + // The IPC type itself. + m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType ); + m_ipcHdr.timestamp = static_cast< uint32_t >( Util::getTimeSeconds() ); + m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); + }; + + protected: + /** The IPC packet header */ + FFXIVARR_IPC_HEADER m_ipcHdr; + /** The underlying data portion of the packet as a structure */ + T m_data; + }; + + + class FFXIVRawPacket : + public FFXIVPacketBase + { + public: + 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 ) ) ), + FFXIVPacketBase( type, sourceActorId, targetActorId ) + { + initialize(); + m_segHdr.size = size; + }; + + FFXIVRawPacket( char* data, uint16_t size ) : + m_data( std::vector< uint8_t >( size ) ) + { + auto segmentHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); + + memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize ); + memcpy( &m_segHdr, data, segmentHdrSize ); + } + + uint32_t getContentSize() override + { + return m_data.size(); + } + + std::vector< uint8_t > getContent() override + { + return m_data; + } + + virtual std::vector< uint8_t > getData() const override + { + std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() ); + + memcpy( &data[ 0 ], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ); + memcpy( &data[ sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ], &m_data[ 0 ], m_data.size() ); + + return data; + } + + /** Gets a reference to the underlying IPC data structure. */ + std::vector< uint8_t >& data() + { + return m_data; + }; + + protected: + /** Initializes the fields of the header structures */ + virtual void initialize() + { + // Zero out the structures. + memset( &m_data[ 0 ], 0, m_data.size() ); + }; + + protected: + /** The underlying data portion of the packet as a structure */ + std::vector< uint8_t > m_data; + }; + + } -template< class T, typename... Args > -std::shared_ptr< T > makeWrappedPacket( Args... args ) -{ - return std::make_shared< T >( args... ); -} - -template< class T, typename... Args > -std::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args ) -{ - return std::make_shared< ChatChannelPacket< T > >( args... ); -} - -template< class T, typename... Args > -std::shared_ptr< LobbyChannelPacket< T > > makeLobbyPacket( Args... args ) -{ - return std::make_shared< LobbyChannelPacket< T > >( args... ); -} - -/** -* The base implementation of a game packet. Needed for parsing packets. -*/ -template< typename T1 > -class FFXIVIpcPacketBase -{ -public: - virtual ~FFXIVIpcPacketBase() = default; - - /** - * @brief Gets the IPC type of this packet. (Useful for determining the - * type of a parsed packet.) - */ - virtual T1 ipcType() = 0; -}; - -////////////////////////////////////////////////7 - -class FFXIVPacketBase -{ -public: - FFXIVPacketBase() : - m_segmentType( 0 ) - { - initializeSegmentHeader(); - } - - FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) : - m_segmentType( segmentType ) - { - initializeSegmentHeader(); - setSourceActor( sourceActorId ); - setTargetActor( targetActorId ); - } - - std::size_t getSize() const - { - return m_segHdr.size; - } - - virtual std::vector< uint8_t > getData() const - { - return {}; - } - -protected: - /** The segment header */ - FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr; - uint16_t m_segmentType; - -public: - virtual uint32_t getContentSize() - { - return 0; - }; - - virtual std::vector< uint8_t > getContent() - { - return {}; - }; - - /** - * @brief Gets the segment type of this packet. - */ - uint16_t getSegmentType() const - { - return m_segmentType; - } - - /** - * @brief Sets the source actor id for this packet. - * @param actorId The source actor id. - */ - void setSourceActor( uint32_t actorId ) - { - m_segHdr.source_actor = actorId; - }; - - /** - * @brief Gets the source actor id for this packet. - * @return The source actor id. - */ - uint32_t getSourceActor() const - { - return m_segHdr.source_actor; - }; - - /** - * @brief Sets the target actor id for this packet. - * @param actorId The target actor id. - */ - void setTargetActor( uint32_t actorId ) - { - m_segHdr.target_actor = actorId; - }; - - /** - * @brief Gets the target actor id for this packet. - */ - uint32_t getTargetActor( void ) const - { - return m_segHdr.target_actor; - }; - - /** Initializes the fields of the segment header structure */ - virtual void initializeSegmentHeader( void ) - { - // Zero out the structure. - memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ); - - // Set the values of static fields. - // The size must be the sum of the segment header and the content - m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize(); - m_segHdr.type = getSegmentType(); - } - -}; - -template< typename T, typename T1 > -class FFXIVIpcPacket : - public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase -{ -public: - FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) : - FFXIVPacketBase( 3, sourceActorId, targetActorId ) - { - initialize(); - }; - - FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) : - FFXIVPacketBase( 3, sourceActorId, sourceActorId ) - { - initialize(); - }; - - FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket ) - { - auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER ); - auto copySize = std::min< uint32_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize ); - - memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ); - memcpy( &m_data, &rawPacket.data[ 0 ] + ipcHdrSize, copySize ); - - memset( &m_ipcHdr, 0, ipcHdrSize ); - m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType ); - } - - uint32_t getContentSize() override - { - return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T ); - } - - std::vector< uint8_t > getContent() override - { - std::vector< uint8_t > content( getContentSize() ); - memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) ); - memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) ); - return content; - } - - std::vector< uint8_t > getData() const override - { - auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); - auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER ); - auto dataSize = sizeof( m_data ); - - std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize ); - - memcpy( &data[ 0 ], &m_segHdr, segmentHeaderSize ); - memcpy( &data[ segmentHeaderSize ], &m_ipcHdr, ipcHeaderSize ); - memcpy( &data[ segmentHeaderSize + ipcHeaderSize ], &m_data, dataSize ); - - return data; - } - - T1 ipcType() override - { - return static_cast< T1 >( m_data._ServerIpcType ); - }; - - /** Gets a reference to the underlying IPC data structure. */ - T& data() - { - return m_data; - }; - - const T& data() const - { - return m_data; - } - -protected: - /** Initializes the fields of the header structures */ - virtual void initialize() - { - // Zero out the structures. - memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) ); - memset( &m_data, 0, sizeof( T ) ); - - // The IPC type itself. - m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType ); - m_ipcHdr.timestamp = static_cast< uint32_t >( Util::getTimeSeconds() ); - m_segHdr.size = sizeof( T ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); - }; - -protected: - /** The IPC packet header */ - FFXIVARR_IPC_HEADER m_ipcHdr; - /** The underlying data portion of the packet as a structure */ - T m_data; -}; - - -class FFXIVRawPacket : - public FFXIVPacketBase -{ -public: - 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 ) ) ), - FFXIVPacketBase( type, sourceActorId, targetActorId ) - { - initialize(); - m_segHdr.size = size; - }; - - FFXIVRawPacket( char* data, uint16_t size ) : - m_data( std::vector< uint8_t >( size ) ) - { - auto segmentHdrSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ); - - memcpy( &m_data[ 0 ], data + segmentHdrSize, size - segmentHdrSize ); - memcpy( &m_segHdr, data, segmentHdrSize ); - } - - uint32_t getContentSize() override - { - return m_data.size(); - } - - std::vector< uint8_t > getContent() override - { - return m_data; - } - - virtual std::vector< uint8_t > getData() const override - { - std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() ); - - memcpy( &data[ 0 ], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ); - memcpy( &data[ sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) ], &m_data[ 0 ], m_data.size() ); - - return data; - } - - /** Gets a reference to the underlying IPC data structure. */ - std::vector< uint8_t >& data() - { - return m_data; - }; - -protected: - /** Initializes the fields of the header structures */ - virtual void initialize() - { - // Zero out the structures. - memset( &m_data[ 0 ], 0, m_data.size() ); - }; - -protected: - /** The underlying data portion of the packet as a structure */ - std::vector< uint8_t > m_data; -}; - - -} /* Packets */ -} /* Network */ -} /* Core */ - #endif /*_CORE_NETWORK_PACKETS_CGAMEPACKETNEW_H*/ diff --git a/src/common/Network/GamePacketParser.h b/src/common/Network/GamePacketParser.h index 2a2ce58c..d90d9396 100644 --- a/src/common/Network/GamePacketParser.h +++ b/src/common/Network/GamePacketParser.h @@ -3,51 +3,47 @@ #include "CommonNetwork.h" -namespace Core { -namespace Network { -namespace Packets { - -enum PacketParseResult +namespace Core::Network::Packets { - /// Dissected game packet successfully - Success, - /// Buffer is too short to dissect a message. - Incomplete, + enum PacketParseResult + { + /// Dissected game packet successfully + Success, - /// Invalid data detected. - Malformed -}; + /// Buffer is too short to dissect a message. + Incomplete, -/// Read packet header from buffer with given offset. -/// Buffer with given offset must be pointing to start of the new FFXIV packet. -PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset, - FFXIVARR_PACKET_HEADER& header ); + /// Invalid data detected. + Malformed + }; -/// Read packet header from buffer with given offset. -/// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data. -/// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed. -PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset, - FFXIVARR_PACKET_SEGMENT_HEADER& header ); + /// Read packet header from buffer with given offset. + /// Buffer with given offset must be pointing to start of the new FFXIV packet. + PacketParseResult getHeader( const std::vector< uint8_t >& buffer, const uint32_t offset, + FFXIVARR_PACKET_HEADER& header ); -/// Read packets from the buffer with given offset. -/// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data. -PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset, - const FFXIVARR_PACKET_HEADER& header, - std::vector< Packets::FFXIVARR_PACKET_RAW >& packets ); + /// Read packet header from buffer with given offset. + /// Buffer with given offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data. + /// Keep in mind that this function does check for data validity. Call checkSegmentHeader() if that's needed. + PacketParseResult getSegmentHeader( const std::vector< uint8_t >& buffer, const uint32_t offset, + FFXIVARR_PACKET_SEGMENT_HEADER& header ); -/// Read single packet from the buffer with given offset. -/// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data. -PacketParseResult getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset, - FFXIVARR_PACKET_RAW& packet ); + /// Read packets from the buffer with given offset. + /// Buffer with given offset must be pointing to end of FFXIVARR_PACKET_HEADER data. + PacketParseResult getPackets( const std::vector< uint8_t >& buffer, const uint32_t offset, + const FFXIVARR_PACKET_HEADER& header, + std::vector< Packets::FFXIVARR_PACKET_RAW >& packets ); -bool checkHeader( const FFXIVARR_PACKET_HEADER& header ); + /// Read single packet from the buffer with given offset. + /// Buffer with an offset must be pointing to start of FFXIVARR_PACKET_SEGMENT_HEADER data. + PacketParseResult getPacket( const std::vector< uint8_t >& buffer, const uint32_t offset, + FFXIVARR_PACKET_RAW& packet ); -bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header ); + bool checkHeader( const FFXIVARR_PACKET_HEADER& header ); + + bool checkSegmentHeader( const FFXIVARR_PACKET_SEGMENT_HEADER& header ); } -} -} - #endif \ No newline at end of file diff --git a/src/common/Network/Hive.h b/src/common/Network/Hive.h index 9516d99f..40da87ac 100644 --- a/src/common/Network/Hive.h +++ b/src/common/Network/Hive.h @@ -5,52 +5,50 @@ #include #include -namespace Core { -namespace Network { - -class Hive : public std::enable_shared_from_this< Hive > +namespace Core:: Network { -private: - asio::io_service m_io_service; - std::shared_ptr< asio::io_service::work > m_work_ptr; - std::atomic< uint32_t > m_shutdown; -private: - Hive( const Hive& rhs ); + class Hive : public std::enable_shared_from_this< Hive > + { + private: + asio::io_service m_io_service; + std::shared_ptr< asio::io_service::work > m_work_ptr; + std::atomic< uint32_t > m_shutdown; - Hive& operator=( const Hive& rhs ); + private: + Hive( const Hive& rhs ); -public: - Hive(); + Hive& operator=( const Hive& rhs ); - virtual ~Hive(); + public: + Hive(); - // Returns the io_service of this object. - asio::io_service& GetService(); + virtual ~Hive(); - // Returns true if the Stop function has been called. - bool HasStopped(); + // Returns the io_service of this object. + asio::io_service& GetService(); - // Polls the networking subsystem once from the current thread and - // returns. - void Poll(); + // Returns true if the Stop function has been called. + bool HasStopped(); - // Runs the networking system on the current thread. This function blocks - // until the networking system is stopped, so do not call on a single - // threaded application with no other means of being able to call Stop - // unless you code in such logic. - void Run(); + // Polls the networking subsystem once from the current thread and + // returns. + void Poll(); - // Stops the networking system. All work is finished and no more - // networking interactions will be possible afterwards until Reset is called. - void Stop(); + // Runs the networking system on the current thread. This function blocks + // until the networking system is stopped, so do not call on a single + // threaded application with no other means of being able to call Stop + // unless you code in such logic. + void Run(); - // Restarts the networking system after Stop as been called. A new work - // object is created ad the shutdown flag is cleared. - void Reset(); -}; + // Stops the networking system. All work is finished and no more + // networking interactions will be possible afterwards until Reset is called. + void Stop(); + + // Restarts the networking system after Stop as been called. A new work + // object is created ad the shutdown flag is cleared. + void Reset(); + }; } -} -//----------------------------------------------------------------------------- #endif diff --git a/src/common/Network/PacketContainer.h b/src/common/Network/PacketContainer.h index 2d317d1e..322c808f 100644 --- a/src/common/Network/PacketContainer.h +++ b/src/common/Network/PacketContainer.h @@ -8,36 +8,33 @@ #include "GamePacketNew.h" #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { - -typedef std::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr; - -class PacketContainer +namespace Core::Network::Packets { -public: - PacketContainer( uint32_t segmentTargetOverride = 0 ); - ~PacketContainer(); + using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >; - void addPacket( FFXIVPacketBasePtr entry ); + class PacketContainer + { + public: + PacketContainer( uint32_t segmentTargetOverride = 0 ); - FFXIVARR_PACKET_HEADER m_ipcHdr; + ~PacketContainer(); - std::vector< FFXIVPacketBasePtr > m_entryList; + void addPacket( FFXIVPacketBasePtr entry ); - std::string toString(); + FFXIVARR_PACKET_HEADER m_ipcHdr; - void fillSendBuffer( std::vector< uint8_t >& sendBuffer ); + std::vector< FFXIVPacketBasePtr > m_entryList; -private: - uint32_t m_segmentTargetOverride; + std::string toString(); -}; + void fillSendBuffer( std::vector< uint8_t >& sendBuffer ); + + private: + uint32_t m_segmentTargetOverride; + + }; -} -} } #endif diff --git a/src/common/Util/LockedQueue.h b/src/common/Util/LockedQueue.h index 04083607..d50b14f7 100644 --- a/src/common/Util/LockedQueue.h +++ b/src/common/Util/LockedQueue.h @@ -7,122 +7,123 @@ #include #include -namespace Core { - -template< class T > -class LockedQueue -{ -public: - LockedQueue(); - - ~LockedQueue(); - - T pop(); - - //we can pass this in by reference, instead of copying - void push( const T object ); - - //we can pass this in by reference - //this will push it onto the queue, and swap the object - // with a default-constructed T at the same time. - void push_swap( T& object ); - - void push_reset( T& object ); - - - std::size_t size(); - - -protected: - std::queue< T > m_queue; - std::mutex m_mutex; - -}; - -template< class T > -LockedQueue< T >::LockedQueue() +namespace Core { -} - -template< class T > -std::size_t LockedQueue< T >::size() -{ - std::lock_guard< std::mutex > lock( m_mutex ); - return m_queue.size(); -} - - -template< class T > -LockedQueue< T >::~LockedQueue() -{ - - -} - - -template< class T > -T LockedQueue< T >::pop() -{ - std::lock_guard< std::mutex > lock( m_mutex ); - - if( m_queue.empty() ) + template< class T > + class LockedQueue { - return T(); + public: + LockedQueue(); + + ~LockedQueue(); + + T pop(); + + //we can pass this in by reference, instead of copying + void push( const T object ); + + //we can pass this in by reference + //this will push it onto the queue, and swap the object + // with a default-constructed T at the same time. + void push_swap( T& object ); + + void push_reset( T& object ); + + + std::size_t size(); + + + protected: + std::queue< T > m_queue; + std::mutex m_mutex; + + }; + + template< class T > + LockedQueue< T >::LockedQueue() + { + } - T result = m_queue.front(); + template< class T > + std::size_t LockedQueue< T >::size() + { + std::lock_guard< std::mutex > lock( m_mutex ); + return m_queue.size(); + } - m_queue.pop(); - return result; -} + template< class T > + LockedQueue< T >::~LockedQueue() + { -template< class T > -void LockedQueue< T >::push( const T object ) -{ - std::lock_guard< std::mutex > lock( m_mutex ); - m_queue.push( object ); -} -template< class T > -void LockedQueue< T >::push_swap( T& object ) -{ - std::lock_guard< std::mutex > lock( m_mutex ); + } - m_queue.push( object ); - T default_ctored_object = T(); - //this is a special swap that will do a legit naive swap normally, - // except if there exists a function called T::swap(), which is - // specialized and possibly faster. - std::swap( object, default_ctored_object ); + template< class T > + T LockedQueue< T >::pop() + { + std::lock_guard< std::mutex > lock( m_mutex ); + + if( m_queue.empty() ) + { + return T(); + } + + T result = m_queue.front(); + + m_queue.pop(); + + return result; + } + + template< class T > + void LockedQueue< T >::push( const T object ) + { + std::lock_guard< std::mutex > lock( m_mutex ); + m_queue.push( object ); + } + + template< class T > + void LockedQueue< T >::push_swap( T& object ) + { + std::lock_guard< std::mutex > lock( m_mutex ); + + m_queue.push( object ); + + T default_ctored_object = T(); + //this is a special swap that will do a legit naive swap normally, + // except if there exists a function called T::swap(), which is + // specialized and possibly faster. + std::swap( object, default_ctored_object ); - //default_ctored_object is now the value of object, and it will go out - // of scope here. In the case that T is a shared_ptr of some kind, - // this will allow that the object on the queue is the *last* shared_ptr - // in existance by the time this function returns. - -} - -template< class T > -void LockedQueue< T >::push_reset( T& object ) -{ - std::lock_guard< std::mutex > lock( m_mutex ); - - m_queue.push( object ); - - T default_ctored_object = T(); - - object.reset(); - - //default_ctored_object is now the value of object, and it will go out - // of scope here. In the case that T is a shared_ptr of some kind, - // this will allow that the object on the queue is the *last* shared_ptr - // in existance by the time this function returns. - -} + //default_ctored_object is now the value of object, and it will go out + // of scope here. In the case that T is a shared_ptr of some kind, + // this will allow that the object on the queue is the *last* shared_ptr + // in existance by the time this function returns. + + } + + template< class T > + void LockedQueue< T >::push_reset( T& object ) + { + std::lock_guard< std::mutex > lock( m_mutex ); + + m_queue.push( object ); + + T default_ctored_object = T(); + + object.reset(); + + //default_ctored_object is now the value of object, and it will go out + // of scope here. In the case that T is a shared_ptr of some kind, + // this will allow that the object on the queue is the *last* shared_ptr + // in existance by the time this function returns. + + } } diff --git a/src/common/Util/LockedWaitQueue.h b/src/common/Util/LockedWaitQueue.h index e07103cf..22445920 100644 --- a/src/common/Util/LockedWaitQueue.h +++ b/src/common/Util/LockedWaitQueue.h @@ -8,98 +8,99 @@ #include #include -namespace Core { - -template< typename T > -class LockedWaitQueue +namespace Core { -private: - std::mutex m_queueLock; - std::queue< T > m_queue; - std::condition_variable m_condition; - std::atomic< bool > m_shutdown; -public: - - LockedWaitQueue< T >() : - m_shutdown( false ) + template< typename T > + class LockedWaitQueue { - } + private: + std::mutex m_queueLock; + std::queue< T > m_queue; + std::condition_variable m_condition; + std::atomic< bool > m_shutdown; - void push( const T& value ) - { - std::lock_guard< std::mutex > lock( m_queueLock ); - m_queue.push( std::move( value ) ); + public: - m_condition.notify_one(); - } - - bool empty() - { - std::lock_guard< std::mutex > lock( m_queueLock ); - - return m_queue.empty(); - } - - bool pop( T& value ) - { - std::lock_guard< std::mutex > lock( m_queueLock ); - - if( m_queue.empty() || m_shutdown ) - return false; - - value = m_queue.front(); - - m_queue.pop(); - - return true; - } - - void waitAndPop( T& value ) - { - std::unique_lock< std::mutex > lock( m_queueLock ); - - while( m_queue.empty() && !m_shutdown ) - m_condition.wait( lock ); - - if( m_queue.empty() || m_shutdown ) - return; - - value = m_queue.front(); - - m_queue.pop(); - } - - void cancel() - { - std::unique_lock< std::mutex > lock( m_queueLock ); - - while( !m_queue.empty() ) + LockedWaitQueue< T >() : + m_shutdown( false ) { - T& value = m_queue.front(); + } - deleteQueuedObject( value ); + void push( const T& value ) + { + std::lock_guard< std::mutex > lock( m_queueLock ); + m_queue.push( std::move( value ) ); + + m_condition.notify_one(); + } + + bool empty() + { + std::lock_guard< std::mutex > lock( m_queueLock ); + + return m_queue.empty(); + } + + bool pop( T& value ) + { + std::lock_guard< std::mutex > lock( m_queueLock ); + + if( m_queue.empty() || m_shutdown ) + return false; + + value = m_queue.front(); + + m_queue.pop(); + + return true; + } + + void waitAndPop( T& value ) + { + std::unique_lock< std::mutex > lock( m_queueLock ); + + while( m_queue.empty() && !m_shutdown ) + m_condition.wait( lock ); + + if( m_queue.empty() || m_shutdown ) + return; + + value = m_queue.front(); m_queue.pop(); } - m_shutdown = true; + void cancel() + { + std::unique_lock< std::mutex > lock( m_queueLock ); - m_condition.notify_all(); - } + while( !m_queue.empty() ) + { + T& value = m_queue.front(); -private: - template< typename E = T > - typename std::enable_if< std::is_pointer< E >::value >::type deleteQueuedObject( E& obj ) - { - delete obj; - } + deleteQueuedObject( value ); - template< typename E = T > - typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& ) - { - } -}; + m_queue.pop(); + } + + m_shutdown = true; + + m_condition.notify_all(); + } + + private: + template< typename E = T > + typename std::enable_if< std::is_pointer< E >::value >::type deleteQueuedObject( E& obj ) + { + delete obj; + } + + template< typename E = T > + typename std::enable_if< !std::is_pointer< E >::value >::type deleteQueuedObject( E const& ) + { + } + }; } #endif diff --git a/src/common/Util/SpawnIndexAllocator.h b/src/common/Util/SpawnIndexAllocator.h index dad5fdf8..b7304fed 100644 --- a/src/common/Util/SpawnIndexAllocator.h +++ b/src/common/Util/SpawnIndexAllocator.h @@ -5,104 +5,104 @@ #include #include -namespace Core { -namespace Util { -template< typename T, typename ActorIdType = uint32_t > -class SpawnIndexAllocator +namespace Core::Util { -public: - 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, - "T must be uint8_t, uint16_t, uint32_t, uint64_t" ); - SpawnIndexAllocator() : - m_maxSlotId( 0 ), - m_reserveFirstSlot( false ) + 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 || + 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" ); - void init( T maxSlotId, bool reserveFirstSlot = false ) - { - m_maxSlotId = maxSlotId; - m_reserveFirstSlot = reserveFirstSlot; + SpawnIndexAllocator() : + m_maxSlotId( 0 ), + m_reserveFirstSlot( false ) + { + } - setupQueue(); + void init( T maxSlotId, bool reserveFirstSlot = false ) + { + m_maxSlotId = maxSlotId; + m_reserveFirstSlot = reserveFirstSlot; - // todo: reserve max slot id in map to prevent any runtime reshashing - } + setupQueue(); - T freeUsedSpawnIndex( ActorIdType actorId ) - { - auto it = m_actorIdToAllocatedMap.find( actorId ); - if( it == m_actorIdToAllocatedMap.end() ) - return 0; + // todo: reserve max slot id in map to prevent any runtime reshashing + } - auto index = it->second; - m_availableIds.push( index ); - m_actorIdToAllocatedMap.erase( it ); + T freeUsedSpawnIndex( ActorIdType actorId ) + { + auto it = m_actorIdToAllocatedMap.find( actorId ); + if( it == m_actorIdToAllocatedMap.end() ) + return 0; - return index; - } + auto index = it->second; + m_availableIds.push( index ); + m_actorIdToAllocatedMap.erase( it ); - T getNextFreeSpawnIndex( ActorIdType actorId ) - { - assert( m_maxSlotId != 0 ); + return index; + } - if( m_availableIds.empty() ) - return getAllocFailId(); + T getNextFreeSpawnIndex( ActorIdType actorId ) + { + assert( m_maxSlotId != 0 ); - auto nextId = m_availableIds.front(); - m_availableIds.pop(); + if( m_availableIds.empty() ) + return getAllocFailId(); - m_actorIdToAllocatedMap[ actorId ] = nextId; - - return nextId; - } - - void freeAllSpawnIndexes() - { - setupQueue(); - - m_actorIdToAllocatedMap.clear(); - } - - bool isSpawnIndexValid( T spawnIndex ) - { - return spawnIndex != getAllocFailId(); - } - - constexpr T getAllocFailId() const - { - return static_cast< T >( -1 ); - } - -protected: - void setupQueue() - { - assert( m_maxSlotId != 0 ); - - while( !m_availableIds.empty() ) + auto nextId = m_availableIds.front(); m_availableIds.pop(); - uint32_t start = 0; + m_actorIdToAllocatedMap[ actorId ] = nextId; - // slot 0 is reserved when used for spawning actors/players otherwise the local player actor spawnIndex - // will be used by another actor and despawn the local player - if( m_reserveFirstSlot ) - start = 1; + return nextId; + } - for( uint32_t i = start; i < m_maxSlotId; i++ ) - m_availableIds.push( i ); - } + void freeAllSpawnIndexes() + { + setupQueue(); - std::queue< T > m_availableIds; - std::unordered_map< ActorIdType, T > m_actorIdToAllocatedMap; + m_actorIdToAllocatedMap.clear(); + } - T m_maxSlotId; - bool m_reserveFirstSlot; -}; + bool isSpawnIndexValid( T spawnIndex ) + { + return spawnIndex != getAllocFailId(); + } + + constexpr T getAllocFailId() const + { + return static_cast< T >( -1 ); + } + + protected: + void setupQueue() + { + assert( m_maxSlotId != 0 ); + + while( !m_availableIds.empty() ) + m_availableIds.pop(); + + uint32_t start = 0; + + // slot 0 is reserved when used for spawning actors/players otherwise the local player actor spawnIndex + // will be used by another actor and despawn the local player + if( m_reserveFirstSlot ) + start = 1; + + for( uint32_t i = start; i < m_maxSlotId; i++ ) + m_availableIds.push( i ); + } + + std::queue< T > m_availableIds; + std::unordered_map< ActorIdType, T > m_actorIdToAllocatedMap; + + T m_maxSlotId; + bool m_reserveFirstSlot; + }; } -} - #endif //SAPPHIRE_SPAWNINDEXALLOCATOR_H diff --git a/src/common/Util/Util.h b/src/common/Util/Util.h index 5d1947d0..c76250e7 100644 --- a/src/common/Util/Util.h +++ b/src/common/Util/Util.h @@ -5,33 +5,34 @@ #include #include -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 -inline void hashCombine( std::size_t& seed, const T& v ) +namespace Core::Util { - std::hash hasher; - seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ); -} + + 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 + inline void hashCombine( std::size_t& seed, const T& v ) + { + std::hash< T > hasher; + seed ^= hasher( v ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ); + } } diff --git a/src/common/Util/UtilMath.h b/src/common/Util/UtilMath.h index fb089867..b6f3340d 100644 --- a/src/common/Util/UtilMath.h +++ b/src/common/Util/UtilMath.h @@ -5,42 +5,39 @@ #define PI 3.14159265358979323846f -namespace Core { -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 ) +namespace Core::Math::Util { - if( val > maximum ) - return maximum; - if( val < minimum ) - return minimum; + float distanceSq( float x, float y, float z, float x1, float y1, float z1 ); - return val; -} + 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 ) + return maximum; + + if( val < minimum ) + return minimum; + + return val; + } -} -} } #endif diff --git a/src/common/Version.h b/src/common/Version.h index 3b795fc6..9f3b481b 100644 --- a/src/common/Version.h +++ b/src/common/Version.h @@ -3,13 +3,10 @@ #include -namespace Core { -namespace Version { - -extern const std::string GIT_HASH; -extern const std::string VERSION; - -} /* Version */ -} /* Core */ +namespace Core::Version +{ + extern const std::string GIT_HASH; + extern const std::string VERSION; +} #endif diff --git a/src/servers/Scripts/CMakeLists.txt b/src/servers/Scripts/CMakeLists.txt index ceb6fadb..a80e7821 100644 --- a/src/servers/Scripts/CMakeLists.txt +++ b/src/servers/Scripts/CMakeLists.txt @@ -56,7 +56,7 @@ foreach(_scriptDir ${children}) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ScriptLoader.cpp.in" "${_scriptDir}/ScriptLoader.cpp") - cotire("script_${_name}") + #cotire("script_${_name}") if(MSVC) add_custom_command(TARGET "script_${_name}" POST_BUILD diff --git a/src/servers/Scripts/common/Aethernet.cpp b/src/servers/Scripts/common/Aethernet.cpp index 3391049b..68903bce 100644 --- a/src/servers/Scripts/common/Aethernet.cpp +++ b/src/servers/Scripts/common/Aethernet.cpp @@ -10,6 +10,8 @@ #define AETHERYTE_MENU_FAVORITE_POINT 4 #define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5 +using namespace Core; + class Aethernet : public EventScript { diff --git a/src/servers/Scripts/common/Aetheryte.cpp b/src/servers/Scripts/common/Aetheryte.cpp index 39c920e7..e7b9df75 100644 --- a/src/servers/Scripts/common/Aetheryte.cpp +++ b/src/servers/Scripts/common/Aetheryte.cpp @@ -12,6 +12,8 @@ #define AETHERYTE_MENU_FAVORITE_POINT 4 #define AETHERYTE_MENU_FAVORITE_POINT_SECURITY_TOKEN 5 +using namespace Core; + class Aetheryte : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefCutSceneReplay.cpp b/src/servers/Scripts/common/CmnDefCutSceneReplay.cpp index 746fa79d..460add24 100644 --- a/src/servers/Scripts/common/CmnDefCutSceneReplay.cpp +++ b/src/servers/Scripts/common/CmnDefCutSceneReplay.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefCutSceneReplay : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefHousingSignboard.cpp b/src/servers/Scripts/common/CmnDefHousingSignboard.cpp index 3b990e2d..901c0f56 100644 --- a/src/servers/Scripts/common/CmnDefHousingSignboard.cpp +++ b/src/servers/Scripts/common/CmnDefHousingSignboard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefHousingSignboard : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefInnBed.cpp b/src/servers/Scripts/common/CmnDefInnBed.cpp index f1b59824..bb9c262b 100644 --- a/src/servers/Scripts/common/CmnDefInnBed.cpp +++ b/src/servers/Scripts/common/CmnDefInnBed.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefInnBed : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefLinkShell.cpp b/src/servers/Scripts/common/CmnDefLinkShell.cpp index 0faba511..6c15df52 100644 --- a/src/servers/Scripts/common/CmnDefLinkShell.cpp +++ b/src/servers/Scripts/common/CmnDefLinkShell.cpp @@ -5,6 +5,8 @@ #define ACTION_RENAME 3 #define ACTION_REMOVE 4 +using namespace Core; + class CmnDefLinkShell : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefMarketBoardGridania.cpp b/src/servers/Scripts/common/CmnDefMarketBoardGridania.cpp index 47c7c8b6..14864b6b 100644 --- a/src/servers/Scripts/common/CmnDefMarketBoardGridania.cpp +++ b/src/servers/Scripts/common/CmnDefMarketBoardGridania.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefMarketBoardGridania : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefMogLetter.cpp b/src/servers/Scripts/common/CmnDefMogLetter.cpp index 1a921c1b..22922887 100644 --- a/src/servers/Scripts/common/CmnDefMogLetter.cpp +++ b/src/servers/Scripts/common/CmnDefMogLetter.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefMogLetter : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefNpcRepair.cpp b/src/servers/Scripts/common/CmnDefNpcRepair.cpp index 08656651..1a2e609e 100644 --- a/src/servers/Scripts/common/CmnDefNpcRepair.cpp +++ b/src/servers/Scripts/common/CmnDefNpcRepair.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefNpcRepair : public EventScript { diff --git a/src/servers/Scripts/common/CmnDefWeatherForeCast.cpp b/src/servers/Scripts/common/CmnDefWeatherForeCast.cpp index 82305449..2efd1fdb 100644 --- a/src/servers/Scripts/common/CmnDefWeatherForeCast.cpp +++ b/src/servers/Scripts/common/CmnDefWeatherForeCast.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CmnDefWeatherForeCast : public EventScript { diff --git a/src/servers/Scripts/common/ComDefMobHuntBoard.cpp b/src/servers/Scripts/common/ComDefMobHuntBoard.cpp index c328bb5d..7a36eaa9 100644 --- a/src/servers/Scripts/common/ComDefMobHuntBoard.cpp +++ b/src/servers/Scripts/common/ComDefMobHuntBoard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ComDefMobHuntBoard : public EventScript { diff --git a/src/servers/Scripts/common/GilShop.cpp b/src/servers/Scripts/common/GilShop.cpp index 4181e5c0..2d1baee7 100644 --- a/src/servers/Scripts/common/GilShop.cpp +++ b/src/servers/Scripts/common/GilShop.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class GilShop : public EventScript { diff --git a/src/servers/Scripts/common/HouFurOrchestrion.cpp b/src/servers/Scripts/common/HouFurOrchestrion.cpp index bfdc35b6..fc93006c 100644 --- a/src/servers/Scripts/common/HouFurOrchestrion.cpp +++ b/src/servers/Scripts/common/HouFurOrchestrion.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HouFurOrchestrion : public EventScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors101110.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors101110.cpp index f5030961..02471170 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors101110.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors101110.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors101110 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors110.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors110.cpp index 0b13ff79..c572f7a4 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors110.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors110.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors110 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors111120.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors111120.cpp index 1b4a904b..caff9745 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors111120.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors111120.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors111120 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors1120.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors1120.cpp index 51a8eae2..8dc281b9 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors1120.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors1120.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors1120 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors121130.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors121130.cpp index 67089369..c28741e6 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors121130.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors121130.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors121130 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors131140.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors131140.cpp index 29d00cd1..6be59559 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors131140.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors131140.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors131140 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors141150.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors141150.cpp index 3607b3ff..fde06fce 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors141150.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors141150.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors141150 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors151160.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors151160.cpp index cbf9ef60..90ea9137 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors151160.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors151160.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors151160 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors161170.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors161170.cpp index 521c63e0..34a5d948 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors161170.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors161170.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors161170 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors171180.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors171180.cpp index b0a9337c..8e588e97 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors171180.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors171180.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors171180 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors181190.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors181190.cpp index 86e16dd9..9b398925 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors181190.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors181190.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors181190 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors191200.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors191200.cpp index b4e8f66e..56583f60 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors191200.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors191200.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors191200 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors2130.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors2130.cpp index c91696de..8371b711 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors2130.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors2130.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors2130 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors3140.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors3140.cpp index 493f2f3f..b153f460 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors3140.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors3140.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors3140 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors4150.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors4150.cpp index c89b2c1b..c6ccb56f 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors4150.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors4150.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors4150 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors5160.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors5160.cpp index 77d1f9d4..fbaffaae 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors5160.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors5160.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors5160 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors6170.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors6170.cpp index d3dec50e..e97cf024 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors6170.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors6170.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors6170 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors7180.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors7180.cpp index 7642c7d3..2e7bdd6a 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors7180.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors7180.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors7180 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors8190.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors8190.cpp index 1f21f2dd..1d27f666 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors8190.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors8190.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors8190 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors91100.cpp b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors91100.cpp index 86aa9594..f8888a87 100644 --- a/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors91100.cpp +++ b/src/servers/Scripts/instances/deepdungeon/ThePalaceoftheDeadFloors91100.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePalaceoftheDeadFloors91100 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/AlaMhigo.cpp b/src/servers/Scripts/instances/dungeons/AlaMhigo.cpp index 89237978..8d65094f 100644 --- a/src/servers/Scripts/instances/dungeons/AlaMhigo.cpp +++ b/src/servers/Scripts/instances/dungeons/AlaMhigo.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlaMhigo : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/AmdaporKeep.cpp b/src/servers/Scripts/instances/dungeons/AmdaporKeep.cpp index 527291ac..26ebd5e3 100644 --- a/src/servers/Scripts/instances/dungeons/AmdaporKeep.cpp +++ b/src/servers/Scripts/instances/dungeons/AmdaporKeep.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AmdaporKeep : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/AmdaporKeepHard.cpp b/src/servers/Scripts/instances/dungeons/AmdaporKeepHard.cpp index 27cf8230..f2d1687c 100644 --- a/src/servers/Scripts/instances/dungeons/AmdaporKeepHard.cpp +++ b/src/servers/Scripts/instances/dungeons/AmdaporKeepHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AmdaporKeepHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/BaelsarsWall.cpp b/src/servers/Scripts/instances/dungeons/BaelsarsWall.cpp index 29aeaebb..6edf0424 100644 --- a/src/servers/Scripts/instances/dungeons/BaelsarsWall.cpp +++ b/src/servers/Scripts/instances/dungeons/BaelsarsWall.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BaelsarsWall : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/BardamsMettle.cpp b/src/servers/Scripts/instances/dungeons/BardamsMettle.cpp index d05ad9e1..01904a31 100644 --- a/src/servers/Scripts/instances/dungeons/BardamsMettle.cpp +++ b/src/servers/Scripts/instances/dungeons/BardamsMettle.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BardamsMettle : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/BrayfloxsLongstop.cpp b/src/servers/Scripts/instances/dungeons/BrayfloxsLongstop.cpp index 70a6b83b..876a66a8 100644 --- a/src/servers/Scripts/instances/dungeons/BrayfloxsLongstop.cpp +++ b/src/servers/Scripts/instances/dungeons/BrayfloxsLongstop.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BrayfloxsLongstop : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/BrayfloxsLongstopHard.cpp b/src/servers/Scripts/instances/dungeons/BrayfloxsLongstopHard.cpp index 2460fec0..58899405 100644 --- a/src/servers/Scripts/instances/dungeons/BrayfloxsLongstopHard.cpp +++ b/src/servers/Scripts/instances/dungeons/BrayfloxsLongstopHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BrayfloxsLongstopHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/CastrumAbania.cpp b/src/servers/Scripts/instances/dungeons/CastrumAbania.cpp index e733abcd..1db6bc4a 100644 --- a/src/servers/Scripts/instances/dungeons/CastrumAbania.cpp +++ b/src/servers/Scripts/instances/dungeons/CastrumAbania.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CastrumAbania : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/CastrumMeridianum.cpp b/src/servers/Scripts/instances/dungeons/CastrumMeridianum.cpp index 71318436..7de5c4b3 100644 --- a/src/servers/Scripts/instances/dungeons/CastrumMeridianum.cpp +++ b/src/servers/Scripts/instances/dungeons/CastrumMeridianum.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CastrumMeridianum : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/CopperbellMines.cpp b/src/servers/Scripts/instances/dungeons/CopperbellMines.cpp index 38436bae..de5494a3 100644 --- a/src/servers/Scripts/instances/dungeons/CopperbellMines.cpp +++ b/src/servers/Scripts/instances/dungeons/CopperbellMines.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CopperbellMines : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/CopperbellMinesHard.cpp b/src/servers/Scripts/instances/dungeons/CopperbellMinesHard.cpp index 0354b449..7cf4c7c8 100644 --- a/src/servers/Scripts/instances/dungeons/CopperbellMinesHard.cpp +++ b/src/servers/Scripts/instances/dungeons/CopperbellMinesHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CopperbellMinesHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/CuttersCry.cpp b/src/servers/Scripts/instances/dungeons/CuttersCry.cpp index ae170f84..2cbfa2b2 100644 --- a/src/servers/Scripts/instances/dungeons/CuttersCry.cpp +++ b/src/servers/Scripts/instances/dungeons/CuttersCry.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CuttersCry : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/DomaCastle.cpp b/src/servers/Scripts/instances/dungeons/DomaCastle.cpp index 640e01c0..c9287448 100644 --- a/src/servers/Scripts/instances/dungeons/DomaCastle.cpp +++ b/src/servers/Scripts/instances/dungeons/DomaCastle.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DomaCastle : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/DzemaelDarkhold.cpp b/src/servers/Scripts/instances/dungeons/DzemaelDarkhold.cpp index 28ffd8f7..582de6e5 100644 --- a/src/servers/Scripts/instances/dungeons/DzemaelDarkhold.cpp +++ b/src/servers/Scripts/instances/dungeons/DzemaelDarkhold.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DzemaelDarkhold : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/Halatali.cpp b/src/servers/Scripts/instances/dungeons/Halatali.cpp index 64012f02..800cc92a 100644 --- a/src/servers/Scripts/instances/dungeons/Halatali.cpp +++ b/src/servers/Scripts/instances/dungeons/Halatali.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Halatali : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/HalataliHard.cpp b/src/servers/Scripts/instances/dungeons/HalataliHard.cpp index fb54d7d6..d87558b5 100644 --- a/src/servers/Scripts/instances/dungeons/HalataliHard.cpp +++ b/src/servers/Scripts/instances/dungeons/HalataliHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HalataliHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/HaukkeManor.cpp b/src/servers/Scripts/instances/dungeons/HaukkeManor.cpp index 00ef8180..db5cd593 100644 --- a/src/servers/Scripts/instances/dungeons/HaukkeManor.cpp +++ b/src/servers/Scripts/instances/dungeons/HaukkeManor.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HaukkeManor : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/HaukkeManorHard.cpp b/src/servers/Scripts/instances/dungeons/HaukkeManorHard.cpp index 09f95923..c743ec11 100644 --- a/src/servers/Scripts/instances/dungeons/HaukkeManorHard.cpp +++ b/src/servers/Scripts/instances/dungeons/HaukkeManorHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HaukkeManorHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/HellsLid.cpp b/src/servers/Scripts/instances/dungeons/HellsLid.cpp index 96df6ce5..fcc0f239 100644 --- a/src/servers/Scripts/instances/dungeons/HellsLid.cpp +++ b/src/servers/Scripts/instances/dungeons/HellsLid.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HellsLid : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/HullbreakerIsle.cpp b/src/servers/Scripts/instances/dungeons/HullbreakerIsle.cpp index e105e6eb..98d8f160 100644 --- a/src/servers/Scripts/instances/dungeons/HullbreakerIsle.cpp +++ b/src/servers/Scripts/instances/dungeons/HullbreakerIsle.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HullbreakerIsle : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/HullbreakerIsleHard.cpp b/src/servers/Scripts/instances/dungeons/HullbreakerIsleHard.cpp index 3d9d46b0..1dd359fa 100644 --- a/src/servers/Scripts/instances/dungeons/HullbreakerIsleHard.cpp +++ b/src/servers/Scripts/instances/dungeons/HullbreakerIsleHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HullbreakerIsleHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/KuganeCastle.cpp b/src/servers/Scripts/instances/dungeons/KuganeCastle.cpp index 51ed857e..5d5016c9 100644 --- a/src/servers/Scripts/instances/dungeons/KuganeCastle.cpp +++ b/src/servers/Scripts/instances/dungeons/KuganeCastle.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class KuganeCastle : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/Neverreap.cpp b/src/servers/Scripts/instances/dungeons/Neverreap.cpp index 5c525c42..7e9e0c84 100644 --- a/src/servers/Scripts/instances/dungeons/Neverreap.cpp +++ b/src/servers/Scripts/instances/dungeons/Neverreap.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Neverreap : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/PharosSirius.cpp b/src/servers/Scripts/instances/dungeons/PharosSirius.cpp index a07b2643..cf3abe42 100644 --- a/src/servers/Scripts/instances/dungeons/PharosSirius.cpp +++ b/src/servers/Scripts/instances/dungeons/PharosSirius.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class PharosSirius : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/PharosSiriusHard.cpp b/src/servers/Scripts/instances/dungeons/PharosSiriusHard.cpp index fb5c5d9f..16524234 100644 --- a/src/servers/Scripts/instances/dungeons/PharosSiriusHard.cpp +++ b/src/servers/Scripts/instances/dungeons/PharosSiriusHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class PharosSiriusHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/SaintMociannesArboretum.cpp b/src/servers/Scripts/instances/dungeons/SaintMociannesArboretum.cpp index bf12946f..34aa9434 100644 --- a/src/servers/Scripts/instances/dungeons/SaintMociannesArboretum.cpp +++ b/src/servers/Scripts/instances/dungeons/SaintMociannesArboretum.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SaintMociannesArboretum : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/Sastasha.cpp b/src/servers/Scripts/instances/dungeons/Sastasha.cpp index 5c0314fc..43d9692e 100644 --- a/src/servers/Scripts/instances/dungeons/Sastasha.cpp +++ b/src/servers/Scripts/instances/dungeons/Sastasha.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + class Sastasha : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/SastashaHard.cpp b/src/servers/Scripts/instances/dungeons/SastashaHard.cpp index c49b1d9d..626443a4 100644 --- a/src/servers/Scripts/instances/dungeons/SastashaHard.cpp +++ b/src/servers/Scripts/instances/dungeons/SastashaHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SastashaHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/ShisuioftheVioletTides.cpp b/src/servers/Scripts/instances/dungeons/ShisuioftheVioletTides.cpp index 240f574d..0cbb3949 100644 --- a/src/servers/Scripts/instances/dungeons/ShisuioftheVioletTides.cpp +++ b/src/servers/Scripts/instances/dungeons/ShisuioftheVioletTides.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ShisuioftheVioletTides : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/Snowcloak.cpp b/src/servers/Scripts/instances/dungeons/Snowcloak.cpp index e4bf7996..48f3f82e 100644 --- a/src/servers/Scripts/instances/dungeons/Snowcloak.cpp +++ b/src/servers/Scripts/instances/dungeons/Snowcloak.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Snowcloak : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/SohmAl.cpp b/src/servers/Scripts/instances/dungeons/SohmAl.cpp index ce0a4a8d..ad467f86 100644 --- a/src/servers/Scripts/instances/dungeons/SohmAl.cpp +++ b/src/servers/Scripts/instances/dungeons/SohmAl.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SohmAl : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/SohmAlHard.cpp b/src/servers/Scripts/instances/dungeons/SohmAlHard.cpp index 091d3cb1..e94ef1f1 100644 --- a/src/servers/Scripts/instances/dungeons/SohmAlHard.cpp +++ b/src/servers/Scripts/instances/dungeons/SohmAlHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SohmAlHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/SohrKhai.cpp b/src/servers/Scripts/instances/dungeons/SohrKhai.cpp index 11ac00b9..026b7c7c 100644 --- a/src/servers/Scripts/instances/dungeons/SohrKhai.cpp +++ b/src/servers/Scripts/instances/dungeons/SohrKhai.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SohrKhai : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheAery.cpp b/src/servers/Scripts/instances/dungeons/TheAery.cpp index 21ff18b3..dc3438b5 100644 --- a/src/servers/Scripts/instances/dungeons/TheAery.cpp +++ b/src/servers/Scripts/instances/dungeons/TheAery.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheAery : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheAetherochemicalResearchFacility.cpp b/src/servers/Scripts/instances/dungeons/TheAetherochemicalResearchFacility.cpp index da1ab337..89fe39ec 100644 --- a/src/servers/Scripts/instances/dungeons/TheAetherochemicalResearchFacility.cpp +++ b/src/servers/Scripts/instances/dungeons/TheAetherochemicalResearchFacility.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheAetherochemicalResearchFacility : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheAntitower.cpp b/src/servers/Scripts/instances/dungeons/TheAntitower.cpp index c572adf7..be9c9120 100644 --- a/src/servers/Scripts/instances/dungeons/TheAntitower.cpp +++ b/src/servers/Scripts/instances/dungeons/TheAntitower.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheAntitower : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheAurumVale.cpp b/src/servers/Scripts/instances/dungeons/TheAurumVale.cpp index 9333d849..965decfa 100644 --- a/src/servers/Scripts/instances/dungeons/TheAurumVale.cpp +++ b/src/servers/Scripts/instances/dungeons/TheAurumVale.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheAurumVale : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheDrownedCityofSkalla.cpp b/src/servers/Scripts/instances/dungeons/TheDrownedCityofSkalla.cpp index 0ddb3298..654f35be 100644 --- a/src/servers/Scripts/instances/dungeons/TheDrownedCityofSkalla.cpp +++ b/src/servers/Scripts/instances/dungeons/TheDrownedCityofSkalla.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheDrownedCityofSkalla : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheDuskVigil.cpp b/src/servers/Scripts/instances/dungeons/TheDuskVigil.cpp index 740353ae..ca7eadc6 100644 --- a/src/servers/Scripts/instances/dungeons/TheDuskVigil.cpp +++ b/src/servers/Scripts/instances/dungeons/TheDuskVigil.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheDuskVigil : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheFractalContinuum.cpp b/src/servers/Scripts/instances/dungeons/TheFractalContinuum.cpp index 8b15827c..88a37fa2 100644 --- a/src/servers/Scripts/instances/dungeons/TheFractalContinuum.cpp +++ b/src/servers/Scripts/instances/dungeons/TheFractalContinuum.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFractalContinuum : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheFractalContinuumHard.cpp b/src/servers/Scripts/instances/dungeons/TheFractalContinuumHard.cpp index ab5323b5..9674bdf6 100644 --- a/src/servers/Scripts/instances/dungeons/TheFractalContinuumHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheFractalContinuumHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFractalContinuumHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheGreatGubalLibrary.cpp b/src/servers/Scripts/instances/dungeons/TheGreatGubalLibrary.cpp index 1d6397be..87e8d879 100644 --- a/src/servers/Scripts/instances/dungeons/TheGreatGubalLibrary.cpp +++ b/src/servers/Scripts/instances/dungeons/TheGreatGubalLibrary.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheGreatGubalLibrary : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheGreatGubalLibraryHard.cpp b/src/servers/Scripts/instances/dungeons/TheGreatGubalLibraryHard.cpp index 7062d5c0..ef8d2cc5 100644 --- a/src/servers/Scripts/instances/dungeons/TheGreatGubalLibraryHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheGreatGubalLibraryHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheGreatGubalLibraryHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheKeeperoftheLake.cpp b/src/servers/Scripts/instances/dungeons/TheKeeperoftheLake.cpp index e49b3015..e60ff386 100644 --- a/src/servers/Scripts/instances/dungeons/TheKeeperoftheLake.cpp +++ b/src/servers/Scripts/instances/dungeons/TheKeeperoftheLake.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheKeeperoftheLake : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheLostCityofAmdapor.cpp b/src/servers/Scripts/instances/dungeons/TheLostCityofAmdapor.cpp index b0d24236..4e12cf38 100644 --- a/src/servers/Scripts/instances/dungeons/TheLostCityofAmdapor.cpp +++ b/src/servers/Scripts/instances/dungeons/TheLostCityofAmdapor.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheLostCityofAmdapor : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheLostCityofAmdaporHard.cpp b/src/servers/Scripts/instances/dungeons/TheLostCityofAmdaporHard.cpp index 4240a3ee..41116fc1 100644 --- a/src/servers/Scripts/instances/dungeons/TheLostCityofAmdaporHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheLostCityofAmdaporHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheLostCityofAmdaporHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/ThePraetorium.cpp b/src/servers/Scripts/instances/dungeons/ThePraetorium.cpp index 65ec8a85..a037490e 100644 --- a/src/servers/Scripts/instances/dungeons/ThePraetorium.cpp +++ b/src/servers/Scripts/instances/dungeons/ThePraetorium.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePraetorium : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheSirensongSea.cpp b/src/servers/Scripts/instances/dungeons/TheSirensongSea.cpp index 3a6b16a2..65aeba85 100644 --- a/src/servers/Scripts/instances/dungeons/TheSirensongSea.cpp +++ b/src/servers/Scripts/instances/dungeons/TheSirensongSea.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSirensongSea : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheStoneVigil.cpp b/src/servers/Scripts/instances/dungeons/TheStoneVigil.cpp index ccbf91fa..6a8d40e8 100644 --- a/src/servers/Scripts/instances/dungeons/TheStoneVigil.cpp +++ b/src/servers/Scripts/instances/dungeons/TheStoneVigil.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheStoneVigil : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheStoneVigilHard.cpp b/src/servers/Scripts/instances/dungeons/TheStoneVigilHard.cpp index 2c9922fc..e77c72a0 100644 --- a/src/servers/Scripts/instances/dungeons/TheStoneVigilHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheStoneVigilHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheStoneVigilHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarn.cpp b/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarn.cpp index c3afe439..c09aeb04 100644 --- a/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarn.cpp +++ b/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarn.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSunkenTempleofQarn : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarnHard.cpp b/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarnHard.cpp index 2f131d49..a824afb5 100644 --- a/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarnHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheSunkenTempleofQarnHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSunkenTempleofQarnHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroft.cpp b/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroft.cpp index 1645ce8b..7bf8565a 100644 --- a/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroft.cpp +++ b/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroft.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheTamTaraDeepcroft : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroftHard.cpp b/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroftHard.cpp index 26498411..2308224d 100644 --- a/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroftHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheTamTaraDeepcroftHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheTamTaraDeepcroftHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheTempleoftheFist.cpp b/src/servers/Scripts/instances/dungeons/TheTempleoftheFist.cpp index 5c7b5c46..daee6636 100644 --- a/src/servers/Scripts/instances/dungeons/TheTempleoftheFist.cpp +++ b/src/servers/Scripts/instances/dungeons/TheTempleoftheFist.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheTempleoftheFist : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheThousandMawsofTotoRak.cpp b/src/servers/Scripts/instances/dungeons/TheThousandMawsofTotoRak.cpp index f25044b6..7d9f7e6b 100644 --- a/src/servers/Scripts/instances/dungeons/TheThousandMawsofTotoRak.cpp +++ b/src/servers/Scripts/instances/dungeons/TheThousandMawsofTotoRak.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheThousandMawsofTotoRak : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheVault.cpp b/src/servers/Scripts/instances/dungeons/TheVault.cpp index 278a6e94..fa1df40a 100644 --- a/src/servers/Scripts/instances/dungeons/TheVault.cpp +++ b/src/servers/Scripts/instances/dungeons/TheVault.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheVault : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheWanderersPalace.cpp b/src/servers/Scripts/instances/dungeons/TheWanderersPalace.cpp index 7bfbe408..346138c6 100644 --- a/src/servers/Scripts/instances/dungeons/TheWanderersPalace.cpp +++ b/src/servers/Scripts/instances/dungeons/TheWanderersPalace.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWanderersPalace : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/TheWanderersPalaceHard.cpp b/src/servers/Scripts/instances/dungeons/TheWanderersPalaceHard.cpp index 11044623..c761ff6a 100644 --- a/src/servers/Scripts/instances/dungeons/TheWanderersPalaceHard.cpp +++ b/src/servers/Scripts/instances/dungeons/TheWanderersPalaceHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWanderersPalaceHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/dungeons/Xelphatol.cpp b/src/servers/Scripts/instances/dungeons/Xelphatol.cpp index 50d51f3e..5136736b 100644 --- a/src/servers/Scripts/instances/dungeons/Xelphatol.cpp +++ b/src/servers/Scripts/instances/dungeons/Xelphatol.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Xelphatol : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/events/TheHauntedManor.cpp b/src/servers/Scripts/instances/events/TheHauntedManor.cpp index 9aaf91d0..8a356c6f 100644 --- a/src/servers/Scripts/instances/events/TheHauntedManor.cpp +++ b/src/servers/Scripts/instances/events/TheHauntedManor.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheHauntedManor : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/events/TheValentionesCeremony.cpp b/src/servers/Scripts/instances/events/TheValentionesCeremony.cpp index 09bdf12d..cfbe4e8f 100644 --- a/src/servers/Scripts/instances/events/TheValentionesCeremony.cpp +++ b/src/servers/Scripts/instances/events/TheValentionesCeremony.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheValentionesCeremony : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/AllsWellthatEndsintheWell.cpp b/src/servers/Scripts/instances/guildhests/AllsWellthatEndsintheWell.cpp index 601fcad7..012a4d39 100644 --- a/src/servers/Scripts/instances/guildhests/AllsWellthatEndsintheWell.cpp +++ b/src/servers/Scripts/instances/guildhests/AllsWellthatEndsintheWell.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AllsWellthatEndsintheWell : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/AnnoytheVoid.cpp b/src/servers/Scripts/instances/guildhests/AnnoytheVoid.cpp index eb43ae50..429311e0 100644 --- a/src/servers/Scripts/instances/guildhests/AnnoytheVoid.cpp +++ b/src/servers/Scripts/instances/guildhests/AnnoytheVoid.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AnnoytheVoid : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyParties.cpp b/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyParties.cpp index 99dad474..5af95852 100644 --- a/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyParties.cpp +++ b/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyParties.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BasicTrainingEnemyParties : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyStrongholds.cpp b/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyStrongholds.cpp index af6a3a18..3215caac 100644 --- a/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyStrongholds.cpp +++ b/src/servers/Scripts/instances/guildhests/BasicTrainingEnemyStrongholds.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BasicTrainingEnemyStrongholds : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/FlickingSticksandTakingNames.cpp b/src/servers/Scripts/instances/guildhests/FlickingSticksandTakingNames.cpp index 4f68f5a8..2bd2ef61 100644 --- a/src/servers/Scripts/instances/guildhests/FlickingSticksandTakingNames.cpp +++ b/src/servers/Scripts/instances/guildhests/FlickingSticksandTakingNames.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class FlickingSticksandTakingNames : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/HeroontheHalfShell.cpp b/src/servers/Scripts/instances/guildhests/HeroontheHalfShell.cpp index b7624e99..a76e7be0 100644 --- a/src/servers/Scripts/instances/guildhests/HeroontheHalfShell.cpp +++ b/src/servers/Scripts/instances/guildhests/HeroontheHalfShell.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HeroontheHalfShell : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/LongLivetheQueen.cpp b/src/servers/Scripts/instances/guildhests/LongLivetheQueen.cpp index 959340b4..42a6bb69 100644 --- a/src/servers/Scripts/instances/guildhests/LongLivetheQueen.cpp +++ b/src/servers/Scripts/instances/guildhests/LongLivetheQueen.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class LongLivetheQueen : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/MorethanaFeeler.cpp b/src/servers/Scripts/instances/guildhests/MorethanaFeeler.cpp index d893b680..1fb2194a 100644 --- a/src/servers/Scripts/instances/guildhests/MorethanaFeeler.cpp +++ b/src/servers/Scripts/instances/guildhests/MorethanaFeeler.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class MorethanaFeeler : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/PullingPoisonPosies.cpp b/src/servers/Scripts/instances/guildhests/PullingPoisonPosies.cpp index a82acbb9..92b9d05e 100644 --- a/src/servers/Scripts/instances/guildhests/PullingPoisonPosies.cpp +++ b/src/servers/Scripts/instances/guildhests/PullingPoisonPosies.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class PullingPoisonPosies : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/ShadowandClaw.cpp b/src/servers/Scripts/instances/guildhests/ShadowandClaw.cpp index 3604227a..d42e25df 100644 --- a/src/servers/Scripts/instances/guildhests/ShadowandClaw.cpp +++ b/src/servers/Scripts/instances/guildhests/ShadowandClaw.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ShadowandClaw : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/SolemnTrinity.cpp b/src/servers/Scripts/instances/guildhests/SolemnTrinity.cpp index 40059594..620f3626 100644 --- a/src/servers/Scripts/instances/guildhests/SolemnTrinity.cpp +++ b/src/servers/Scripts/instances/guildhests/SolemnTrinity.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SolemnTrinity : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/StingingBack.cpp b/src/servers/Scripts/instances/guildhests/StingingBack.cpp index 1719cdb5..229a0f0f 100644 --- a/src/servers/Scripts/instances/guildhests/StingingBack.cpp +++ b/src/servers/Scripts/instances/guildhests/StingingBack.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class StingingBack : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/UndertheArmor.cpp b/src/servers/Scripts/instances/guildhests/UndertheArmor.cpp index 45bda089..1176cfe6 100644 --- a/src/servers/Scripts/instances/guildhests/UndertheArmor.cpp +++ b/src/servers/Scripts/instances/guildhests/UndertheArmor.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class UndertheArmor : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/guildhests/WardUp.cpp b/src/servers/Scripts/instances/guildhests/WardUp.cpp index dee18e3f..f54f91c8 100644 --- a/src/servers/Scripts/instances/guildhests/WardUp.cpp +++ b/src/servers/Scripts/instances/guildhests/WardUp.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class WardUp : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/AccrueEnmityfromMultipleTargets.cpp b/src/servers/Scripts/instances/hallofthenovice/AccrueEnmityfromMultipleTargets.cpp index a0a3fb8d..52108b10 100644 --- a/src/servers/Scripts/instances/hallofthenovice/AccrueEnmityfromMultipleTargets.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/AccrueEnmityfromMultipleTargets.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AccrueEnmityfromMultipleTargets : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/AssistAlliesinDefeatingaTarget.cpp b/src/servers/Scripts/instances/hallofthenovice/AssistAlliesinDefeatingaTarget.cpp index 02b97476..3d710127 100644 --- a/src/servers/Scripts/instances/hallofthenovice/AssistAlliesinDefeatingaTarget.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/AssistAlliesinDefeatingaTarget.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AssistAlliesinDefeatingaTarget : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/AvoidAreaofEffectAttacks.cpp b/src/servers/Scripts/instances/hallofthenovice/AvoidAreaofEffectAttacks.cpp index e82eb156..4ad02423 100644 --- a/src/servers/Scripts/instances/hallofthenovice/AvoidAreaofEffectAttacks.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/AvoidAreaofEffectAttacks.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AvoidAreaofEffectAttacks : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/AvoidEngagedTargets.cpp b/src/servers/Scripts/instances/hallofthenovice/AvoidEngagedTargets.cpp index 071ed2c3..9f459614 100644 --- a/src/servers/Scripts/instances/hallofthenovice/AvoidEngagedTargets.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/AvoidEngagedTargets.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AvoidEngagedTargets : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/DefeatanOccupiedTarget.cpp b/src/servers/Scripts/instances/hallofthenovice/DefeatanOccupiedTarget.cpp index a4d4ab80..b028bc5f 100644 --- a/src/servers/Scripts/instances/hallofthenovice/DefeatanOccupiedTarget.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/DefeatanOccupiedTarget.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DefeatanOccupiedTarget : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/EngageEnemyReinforcements.cpp b/src/servers/Scripts/instances/hallofthenovice/EngageEnemyReinforcements.cpp index 2873b5c3..5177c8a1 100644 --- a/src/servers/Scripts/instances/hallofthenovice/EngageEnemyReinforcements.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/EngageEnemyReinforcements.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class EngageEnemyReinforcements : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/EngageMultipleTargets.cpp b/src/servers/Scripts/instances/hallofthenovice/EngageMultipleTargets.cpp index 3c0516fb..2e658b69 100644 --- a/src/servers/Scripts/instances/hallofthenovice/EngageMultipleTargets.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/EngageMultipleTargets.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class EngageMultipleTargets : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/ExecuteaComboinBattle.cpp b/src/servers/Scripts/instances/hallofthenovice/ExecuteaComboinBattle.cpp index 560af13b..0a11ae4b 100644 --- a/src/servers/Scripts/instances/hallofthenovice/ExecuteaComboinBattle.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/ExecuteaComboinBattle.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ExecuteaComboinBattle : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/ExecuteaCombotoIncreaseEnmity.cpp b/src/servers/Scripts/instances/hallofthenovice/ExecuteaCombotoIncreaseEnmity.cpp index 18370750..dfd6fc50 100644 --- a/src/servers/Scripts/instances/hallofthenovice/ExecuteaCombotoIncreaseEnmity.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/ExecuteaCombotoIncreaseEnmity.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ExecuteaCombotoIncreaseEnmity : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/ExecuteaRangedAttacktoIncreaseEnmity.cpp b/src/servers/Scripts/instances/hallofthenovice/ExecuteaRangedAttacktoIncreaseEnmity.cpp index 7daeb8d3..52e56663 100644 --- a/src/servers/Scripts/instances/hallofthenovice/ExecuteaRangedAttacktoIncreaseEnmity.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/ExecuteaRangedAttacktoIncreaseEnmity.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ExecuteaRangedAttacktoIncreaseEnmity : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/FinalExercise.cpp b/src/servers/Scripts/instances/hallofthenovice/FinalExercise.cpp index 05f1a343..f128070e 100644 --- a/src/servers/Scripts/instances/hallofthenovice/FinalExercise.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/FinalExercise.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class FinalExercise : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/HealMultipleAllies.cpp b/src/servers/Scripts/instances/hallofthenovice/HealMultipleAllies.cpp index f8755628..24710a26 100644 --- a/src/servers/Scripts/instances/hallofthenovice/HealMultipleAllies.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/HealMultipleAllies.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HealMultipleAllies : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/HealanAlly.cpp b/src/servers/Scripts/instances/hallofthenovice/HealanAlly.cpp index f81514c6..ade09f40 100644 --- a/src/servers/Scripts/instances/hallofthenovice/HealanAlly.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/HealanAlly.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class HealanAlly : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/hallofthenovice/InteractwiththeBattlefield.cpp b/src/servers/Scripts/instances/hallofthenovice/InteractwiththeBattlefield.cpp index 10f746bd..c3f98a30 100644 --- a/src/servers/Scripts/instances/hallofthenovice/InteractwiththeBattlefield.cpp +++ b/src/servers/Scripts/instances/hallofthenovice/InteractwiththeBattlefield.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class InteractwiththeBattlefield : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/Astragalos.cpp b/src/servers/Scripts/instances/pvp/Astragalos.cpp index dd1ae49f..76fb376b 100644 --- a/src/servers/Scripts/instances/pvp/Astragalos.cpp +++ b/src/servers/Scripts/instances/pvp/Astragalos.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Astragalos : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/SealRockSeize.cpp b/src/servers/Scripts/instances/pvp/SealRockSeize.cpp index ae34c0dd..c25e5df3 100644 --- a/src/servers/Scripts/instances/pvp/SealRockSeize.cpp +++ b/src/servers/Scripts/instances/pvp/SealRockSeize.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SealRockSeize : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheBorderlandRuinsSecure.cpp b/src/servers/Scripts/instances/pvp/TheBorderlandRuinsSecure.cpp index 4e3799a1..d7057b62 100644 --- a/src/servers/Scripts/instances/pvp/TheBorderlandRuinsSecure.cpp +++ b/src/servers/Scripts/instances/pvp/TheBorderlandRuinsSecure.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBorderlandRuinsSecure : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeast4on4LightParty.cpp b/src/servers/Scripts/instances/pvp/TheFeast4on4LightParty.cpp index 800713cf..08b72289 100644 --- a/src/servers/Scripts/instances/pvp/TheFeast4on4LightParty.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeast4on4LightParty.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeast4on4LightParty : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeast4on4Ranked.cpp b/src/servers/Scripts/instances/pvp/TheFeast4on4Ranked.cpp index eddd483c..672663b6 100644 --- a/src/servers/Scripts/instances/pvp/TheFeast4on4Ranked.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeast4on4Ranked.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeast4on4Ranked : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeast4on4Training.cpp b/src/servers/Scripts/instances/pvp/TheFeast4on4Training.cpp index d83d1360..e9924ca0 100644 --- a/src/servers/Scripts/instances/pvp/TheFeast4on4Training.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeast4on4Training.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeast4on4Training : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeastCustomMatchCrystalTower.cpp b/src/servers/Scripts/instances/pvp/TheFeastCustomMatchCrystalTower.cpp index 2f8ed69a..29c63074 100644 --- a/src/servers/Scripts/instances/pvp/TheFeastCustomMatchCrystalTower.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeastCustomMatchCrystalTower.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeastCustomMatchCrystalTower : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeastCustomMatchFeastingGrounds.cpp b/src/servers/Scripts/instances/pvp/TheFeastCustomMatchFeastingGrounds.cpp index 275a654f..ea726cfa 100644 --- a/src/servers/Scripts/instances/pvp/TheFeastCustomMatchFeastingGrounds.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeastCustomMatchFeastingGrounds.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeastCustomMatchFeastingGrounds : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeastCustomMatchLichenweed.cpp b/src/servers/Scripts/instances/pvp/TheFeastCustomMatchLichenweed.cpp index eca3aa6d..71380cba 100644 --- a/src/servers/Scripts/instances/pvp/TheFeastCustomMatchLichenweed.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeastCustomMatchLichenweed.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeastCustomMatchLichenweed : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeastRanked.cpp b/src/servers/Scripts/instances/pvp/TheFeastRanked.cpp index ad095559..829334a0 100644 --- a/src/servers/Scripts/instances/pvp/TheFeastRanked.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeastRanked.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeastRanked : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeastTeamRanked.cpp b/src/servers/Scripts/instances/pvp/TheFeastTeamRanked.cpp index d5b2cfeb..5a5630c3 100644 --- a/src/servers/Scripts/instances/pvp/TheFeastTeamRanked.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeastTeamRanked.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeastTeamRanked : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFeastTraining.cpp b/src/servers/Scripts/instances/pvp/TheFeastTraining.cpp index cef07558..61bcb9df 100644 --- a/src/servers/Scripts/instances/pvp/TheFeastTraining.cpp +++ b/src/servers/Scripts/instances/pvp/TheFeastTraining.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFeastTraining : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/pvp/TheFieldsofGloryShatter.cpp b/src/servers/Scripts/instances/pvp/TheFieldsofGloryShatter.cpp index 12b6bd20..1ac9d496 100644 --- a/src/servers/Scripts/instances/pvp/TheFieldsofGloryShatter.cpp +++ b/src/servers/Scripts/instances/pvp/TheFieldsofGloryShatter.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFieldsofGloryShatter : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/ABloodyReunion.cpp b/src/servers/Scripts/instances/questbattles/ABloodyReunion.cpp index 28388cbb..6f321795 100644 --- a/src/servers/Scripts/instances/questbattles/ABloodyReunion.cpp +++ b/src/servers/Scripts/instances/questbattles/ABloodyReunion.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ABloodyReunion : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/ASpectaclefortheAges.cpp b/src/servers/Scripts/instances/questbattles/ASpectaclefortheAges.cpp index e35a95be..1391996d 100644 --- a/src/servers/Scripts/instances/questbattles/ASpectaclefortheAges.cpp +++ b/src/servers/Scripts/instances/questbattles/ASpectaclefortheAges.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ASpectaclefortheAges : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/BloodDragoon.cpp b/src/servers/Scripts/instances/questbattles/BloodDragoon.cpp index d4846762..134acf7b 100644 --- a/src/servers/Scripts/instances/questbattles/BloodDragoon.cpp +++ b/src/servers/Scripts/instances/questbattles/BloodDragoon.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BloodDragoon : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/BloodontheDeck.cpp b/src/servers/Scripts/instances/questbattles/BloodontheDeck.cpp index f495d081..52798fc6 100644 --- a/src/servers/Scripts/instances/questbattles/BloodontheDeck.cpp +++ b/src/servers/Scripts/instances/questbattles/BloodontheDeck.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BloodontheDeck : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/CuriousGorgeMeetsHisMatch.cpp b/src/servers/Scripts/instances/questbattles/CuriousGorgeMeetsHisMatch.cpp index 031d2469..e9a5219d 100644 --- a/src/servers/Scripts/instances/questbattles/CuriousGorgeMeetsHisMatch.cpp +++ b/src/servers/Scripts/instances/questbattles/CuriousGorgeMeetsHisMatch.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CuriousGorgeMeetsHisMatch : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/DarkwingDragon.cpp b/src/servers/Scripts/instances/questbattles/DarkwingDragon.cpp index 52050fa8..ee13738d 100644 --- a/src/servers/Scripts/instances/questbattles/DarkwingDragon.cpp +++ b/src/servers/Scripts/instances/questbattles/DarkwingDragon.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DarkwingDragon : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/InThalsName.cpp b/src/servers/Scripts/instances/questbattles/InThalsName.cpp index 5d44f670..11c9acb0 100644 --- a/src/servers/Scripts/instances/questbattles/InThalsName.cpp +++ b/src/servers/Scripts/instances/questbattles/InThalsName.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class InThalsName : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/InterdimensionalRift.cpp b/src/servers/Scripts/instances/questbattles/InterdimensionalRift.cpp index 00833902..24c4620a 100644 --- a/src/servers/Scripts/instances/questbattles/InterdimensionalRift.cpp +++ b/src/servers/Scripts/instances/questbattles/InterdimensionalRift.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class InterdimensionalRift : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/ItsProbablyaTrap.cpp b/src/servers/Scripts/instances/questbattles/ItsProbablyaTrap.cpp index 1f7940dd..7d650ed6 100644 --- a/src/servers/Scripts/instances/questbattles/ItsProbablyaTrap.cpp +++ b/src/servers/Scripts/instances/questbattles/ItsProbablyaTrap.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ItsProbablyaTrap : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/MatsubaMayhem.cpp b/src/servers/Scripts/instances/questbattles/MatsubaMayhem.cpp index 02fddf53..2ef58362 100644 --- a/src/servers/Scripts/instances/questbattles/MatsubaMayhem.cpp +++ b/src/servers/Scripts/instances/questbattles/MatsubaMayhem.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class MatsubaMayhem : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/Naadam.cpp b/src/servers/Scripts/instances/questbattles/Naadam.cpp index caf4fb95..5710af45 100644 --- a/src/servers/Scripts/instances/questbattles/Naadam.cpp +++ b/src/servers/Scripts/instances/questbattles/Naadam.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Naadam : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/OneLifeforOneWorld.cpp b/src/servers/Scripts/instances/questbattles/OneLifeforOneWorld.cpp index 7301c8ad..4240d125 100644 --- a/src/servers/Scripts/instances/questbattles/OneLifeforOneWorld.cpp +++ b/src/servers/Scripts/instances/questbattles/OneLifeforOneWorld.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class OneLifeforOneWorld : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/OurCompromise.cpp b/src/servers/Scripts/instances/questbattles/OurCompromise.cpp index aa1b863f..933b80b6 100644 --- a/src/servers/Scripts/instances/questbattles/OurCompromise.cpp +++ b/src/servers/Scripts/instances/questbattles/OurCompromise.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class OurCompromise : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/OurUnsungHeroes.cpp b/src/servers/Scripts/instances/questbattles/OurUnsungHeroes.cpp index cdb99a30..b1d0ace6 100644 --- a/src/servers/Scripts/instances/questbattles/OurUnsungHeroes.cpp +++ b/src/servers/Scripts/instances/questbattles/OurUnsungHeroes.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class OurUnsungHeroes : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/RaisingtheSword.cpp b/src/servers/Scripts/instances/questbattles/RaisingtheSword.cpp index 9fd28249..d6213de7 100644 --- a/src/servers/Scripts/instances/questbattles/RaisingtheSword.cpp +++ b/src/servers/Scripts/instances/questbattles/RaisingtheSword.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class RaisingtheSword : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/ReturnoftheBull.cpp b/src/servers/Scripts/instances/questbattles/ReturnoftheBull.cpp index 45ace5b3..2c9977d2 100644 --- a/src/servers/Scripts/instances/questbattles/ReturnoftheBull.cpp +++ b/src/servers/Scripts/instances/questbattles/ReturnoftheBull.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ReturnoftheBull : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/TheBattleonBekko.cpp b/src/servers/Scripts/instances/questbattles/TheBattleonBekko.cpp index b7cec9d3..58db4e72 100644 --- a/src/servers/Scripts/instances/questbattles/TheBattleonBekko.cpp +++ b/src/servers/Scripts/instances/questbattles/TheBattleonBekko.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBattleonBekko : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/TheCarteneauFlatsHeliodrome.cpp b/src/servers/Scripts/instances/questbattles/TheCarteneauFlatsHeliodrome.cpp index a6d30fe7..3296c99a 100644 --- a/src/servers/Scripts/instances/questbattles/TheCarteneauFlatsHeliodrome.cpp +++ b/src/servers/Scripts/instances/questbattles/TheCarteneauFlatsHeliodrome.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheCarteneauFlatsHeliodrome : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/TheFaceofTrueEvil.cpp b/src/servers/Scripts/instances/questbattles/TheFaceofTrueEvil.cpp index 399bd529..357807d8 100644 --- a/src/servers/Scripts/instances/questbattles/TheFaceofTrueEvil.cpp +++ b/src/servers/Scripts/instances/questbattles/TheFaceofTrueEvil.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFaceofTrueEvil : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/TheHeartoftheProblem.cpp b/src/servers/Scripts/instances/questbattles/TheHeartoftheProblem.cpp index 1013210f..4301b69b 100644 --- a/src/servers/Scripts/instances/questbattles/TheHeartoftheProblem.cpp +++ b/src/servers/Scripts/instances/questbattles/TheHeartoftheProblem.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheHeartoftheProblem : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/TheOrphansandtheBrokenBlade.cpp b/src/servers/Scripts/instances/questbattles/TheOrphansandtheBrokenBlade.cpp index d85856ec..d0616873 100644 --- a/src/servers/Scripts/instances/questbattles/TheOrphansandtheBrokenBlade.cpp +++ b/src/servers/Scripts/instances/questbattles/TheOrphansandtheBrokenBlade.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheOrphansandtheBrokenBlade : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/TheResonant.cpp b/src/servers/Scripts/instances/questbattles/TheResonant.cpp index e17f0ec6..191cc6c8 100644 --- a/src/servers/Scripts/instances/questbattles/TheResonant.cpp +++ b/src/servers/Scripts/instances/questbattles/TheResonant.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheResonant : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/WhenClansCollide.cpp b/src/servers/Scripts/instances/questbattles/WhenClansCollide.cpp index d9feda85..4f956918 100644 --- a/src/servers/Scripts/instances/questbattles/WhenClansCollide.cpp +++ b/src/servers/Scripts/instances/questbattles/WhenClansCollide.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class WhenClansCollide : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/questbattles/WithHeartandSteel.cpp b/src/servers/Scripts/instances/questbattles/WithHeartandSteel.cpp index 3d227158..4fbeafc2 100644 --- a/src/servers/Scripts/instances/questbattles/WithHeartandSteel.cpp +++ b/src/servers/Scripts/instances/questbattles/WithHeartandSteel.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class WithHeartandSteel : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFather.cpp b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFather.cpp index 25f9416d..614b1f7d 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFather.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFather.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheArmoftheFather : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFatherSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFatherSavage.cpp index ca6dd6ab..c2c4fac9 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFatherSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheFatherSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheArmoftheFatherSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSon.cpp b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSon.cpp index 5569847c..51b3dff7 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSon.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSon.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheArmoftheSon : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSonSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSonSavage.cpp index 71571c9d..b888dd35 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSonSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheArmoftheSonSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheArmoftheSonSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreator.cpp b/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreator.cpp index 78db0df9..4d6f98ee 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreator.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreator.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheBreathoftheCreator : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreatorSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreatorSavage.cpp index ecd88e6f..901dee86 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreatorSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheBreathoftheCreatorSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheBreathoftheCreatorSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFather.cpp b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFather.cpp index dd8315cd..2444c360 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFather.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFather.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheBurdenoftheFather : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFatherSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFatherSavage.cpp index 05b57379..04d41b7a 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFatherSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheFatherSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheBurdenoftheFatherSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSon.cpp b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSon.cpp index bdfabc6f..807283a9 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSon.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSon.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheBurdenoftheSon : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSonSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSonSavage.cpp index e19a95c8..2c7c212b 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSonSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheBurdenoftheSonSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheBurdenoftheSonSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFather.cpp b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFather.cpp index d0fca8dd..36707b42 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFather.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFather.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheCuffoftheFather : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFatherSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFatherSavage.cpp index 519d6970..2d1dbae7 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFatherSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheFatherSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheCuffoftheFatherSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSon.cpp b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSon.cpp index 0651488e..833cbcbb 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSon.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSon.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheCuffoftheSon : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSonSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSonSavage.cpp index 11ecab11..abb2e61d 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSonSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheCuffoftheSonSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheCuffoftheSonSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreator.cpp b/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreator.cpp index e658ffe7..937182be 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreator.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreator.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheEyesoftheCreator : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreatorSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreatorSavage.cpp index 6d29ed1f..db24d92a 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreatorSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheEyesoftheCreatorSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheEyesoftheCreatorSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFather.cpp b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFather.cpp index b1f17518..4fe1a928 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFather.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFather.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheFistoftheFather : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFatherSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFatherSavage.cpp index ee5a214f..2db154b0 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFatherSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheFatherSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheFistoftheFatherSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSon.cpp b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSon.cpp index fae14861..ac3e9d83 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSon.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSon.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheFistoftheSon : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSonSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSonSavage.cpp index a0c3ea5d..2a04d874 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSonSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheFistoftheSonSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheFistoftheSonSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreator.cpp b/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreator.cpp index cf10c286..da84d428 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreator.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreator.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheHeartoftheCreator : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreatorSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreatorSavage.cpp index 3cd0816a..3946f873 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreatorSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheHeartoftheCreatorSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheHeartoftheCreatorSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreator.cpp b/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreator.cpp index 325083f6..151f02bf 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreator.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreator.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheSouloftheCreator : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreatorSavage.cpp b/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreatorSavage.cpp index a16e2253..61a1a7be 100644 --- a/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreatorSavage.cpp +++ b/src/servers/Scripts/instances/raids/AlexanderTheSouloftheCreatorSavage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AlexanderTheSouloftheCreatorSavage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV10.cpp b/src/servers/Scripts/instances/raids/DeltascapeV10.cpp index 1ffee190..cd73672d 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV10.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV10.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV10 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV10Savage.cpp b/src/servers/Scripts/instances/raids/DeltascapeV10Savage.cpp index c17d9a87..9a2da733 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV10Savage.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV10Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV10Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV20.cpp b/src/servers/Scripts/instances/raids/DeltascapeV20.cpp index 8098d0b8..5a5b7b92 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV20.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV20.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV20 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV20Savage.cpp b/src/servers/Scripts/instances/raids/DeltascapeV20Savage.cpp index 2ad50735..8f1cad21 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV20Savage.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV20Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV20Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV30.cpp b/src/servers/Scripts/instances/raids/DeltascapeV30.cpp index b38cccc4..6c886233 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV30.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV30.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV30 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV30Savage.cpp b/src/servers/Scripts/instances/raids/DeltascapeV30Savage.cpp index bac1dbe6..dc54d1bc 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV30Savage.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV30Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV30Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV40.cpp b/src/servers/Scripts/instances/raids/DeltascapeV40.cpp index ca29cf35..6181a52b 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV40.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV40.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV40 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DeltascapeV40Savage.cpp b/src/servers/Scripts/instances/raids/DeltascapeV40Savage.cpp index a839a324..63b753c1 100644 --- a/src/servers/Scripts/instances/raids/DeltascapeV40Savage.cpp +++ b/src/servers/Scripts/instances/raids/DeltascapeV40Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DeltascapeV40Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/DunScaith.cpp b/src/servers/Scripts/instances/raids/DunScaith.cpp index 49b1b1a0..09bbe8bb 100644 --- a/src/servers/Scripts/instances/raids/DunScaith.cpp +++ b/src/servers/Scripts/instances/raids/DunScaith.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class DunScaith : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV10.cpp b/src/servers/Scripts/instances/raids/SigmascapeV10.cpp index 148c283b..b68624d6 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV10.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV10.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV10 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV10Savage.cpp b/src/servers/Scripts/instances/raids/SigmascapeV10Savage.cpp index f04564ce..d97cfa73 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV10Savage.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV10Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV10Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV20.cpp b/src/servers/Scripts/instances/raids/SigmascapeV20.cpp index e9f7899e..1dca0d5d 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV20.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV20.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV20 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV20Savage.cpp b/src/servers/Scripts/instances/raids/SigmascapeV20Savage.cpp index d976f853..cf17ed24 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV20Savage.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV20Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV20Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV30.cpp b/src/servers/Scripts/instances/raids/SigmascapeV30.cpp index 3a497bcc..6e7c3121 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV30.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV30.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV30 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV30Savage.cpp b/src/servers/Scripts/instances/raids/SigmascapeV30Savage.cpp index 2ac3604a..b2029d55 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV30Savage.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV30Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV30Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV40.cpp b/src/servers/Scripts/instances/raids/SigmascapeV40.cpp index 2fbb3989..1acffe7c 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV40.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV40.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV40 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SigmascapeV40Savage.cpp b/src/servers/Scripts/instances/raids/SigmascapeV40Savage.cpp index 200c05ec..c9b3c203 100644 --- a/src/servers/Scripts/instances/raids/SigmascapeV40Savage.cpp +++ b/src/servers/Scripts/instances/raids/SigmascapeV40Savage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SigmascapeV40Savage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/SyrcusTower.cpp b/src/servers/Scripts/instances/raids/SyrcusTower.cpp index 788b9d14..2cc0ac36 100644 --- a/src/servers/Scripts/instances/raids/SyrcusTower.cpp +++ b/src/servers/Scripts/instances/raids/SyrcusTower.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SyrcusTower : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn1.cpp b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn1.cpp index c862527d..4f2755d2 100644 --- a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn1.cpp +++ b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn1.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBindingCoilofBahamutTurn1 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn2.cpp b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn2.cpp index dacdfbd5..843aefbe 100644 --- a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn2.cpp +++ b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn2.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBindingCoilofBahamutTurn2 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn3.cpp b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn3.cpp index ad7a4e58..f479e526 100644 --- a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn3.cpp +++ b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn3.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBindingCoilofBahamutTurn3 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn4.cpp b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn4.cpp index c1d85f90..3bb539b5 100644 --- a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn4.cpp +++ b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn4.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBindingCoilofBahamutTurn4 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn5.cpp b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn5.cpp index 05e36969..1cbffc8e 100644 --- a/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn5.cpp +++ b/src/servers/Scripts/instances/raids/TheBindingCoilofBahamutTurn5.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBindingCoilofBahamutTurn5 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn1.cpp b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn1.cpp index 8845b8c6..e7e10311 100644 --- a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn1.cpp +++ b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn1.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFinalCoilofBahamutTurn1 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn2.cpp b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn2.cpp index db8b7ba4..eec5679d 100644 --- a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn2.cpp +++ b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn2.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFinalCoilofBahamutTurn2 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn3.cpp b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn3.cpp index 5704b291..d69ba344 100644 --- a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn3.cpp +++ b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn3.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFinalCoilofBahamutTurn3 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn4.cpp b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn4.cpp index b6921d0e..f76a2c3f 100644 --- a/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn4.cpp +++ b/src/servers/Scripts/instances/raids/TheFinalCoilofBahamutTurn4.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFinalCoilofBahamutTurn4 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheLabyrinthoftheAncients.cpp b/src/servers/Scripts/instances/raids/TheLabyrinthoftheAncients.cpp index 981e844d..d4213145 100644 --- a/src/servers/Scripts/instances/raids/TheLabyrinthoftheAncients.cpp +++ b/src/servers/Scripts/instances/raids/TheLabyrinthoftheAncients.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheLabyrinthoftheAncients : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheRoyalCityofRabanastre.cpp b/src/servers/Scripts/instances/raids/TheRoyalCityofRabanastre.cpp index 0336e666..2498ebeb 100644 --- a/src/servers/Scripts/instances/raids/TheRoyalCityofRabanastre.cpp +++ b/src/servers/Scripts/instances/raids/TheRoyalCityofRabanastre.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheRoyalCityofRabanastre : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn1.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn1.cpp index c54a8c76..c96eb64f 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn1.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn1.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutSavageTurn1 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn2.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn2.cpp index 33a627e0..d8aac76b 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn2.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn2.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutSavageTurn2 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn3.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn3.cpp index 9345cf4b..1909401c 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn3.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn3.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutSavageTurn3 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn4.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn4.cpp index 94ea3f2e..4bb2fcd6 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn4.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutSavageTurn4.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutSavageTurn4 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn1.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn1.cpp index b053b609..4e1f4ecf 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn1.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn1.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutTurn1 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn2.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn2.cpp index f071b21b..602a7d23 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn2.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn2.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutTurn2 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn3.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn3.cpp index eccbc875..245d077f 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn3.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn3.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutTurn3 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn4.cpp b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn4.cpp index 2a18157d..bfd1657f 100644 --- a/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn4.cpp +++ b/src/servers/Scripts/instances/raids/TheSecondCoilofBahamutTurn4.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSecondCoilofBahamutTurn4 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheUnendingCoilofBahamutUltimate.cpp b/src/servers/Scripts/instances/raids/TheUnendingCoilofBahamutUltimate.cpp index 24ed0439..b9286341 100644 --- a/src/servers/Scripts/instances/raids/TheUnendingCoilofBahamutUltimate.cpp +++ b/src/servers/Scripts/instances/raids/TheUnendingCoilofBahamutUltimate.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheUnendingCoilofBahamutUltimate : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheVoidArk.cpp b/src/servers/Scripts/instances/raids/TheVoidArk.cpp index 2255517b..b359da00 100644 --- a/src/servers/Scripts/instances/raids/TheVoidArk.cpp +++ b/src/servers/Scripts/instances/raids/TheVoidArk.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheVoidArk : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheWeaponsRefrainUltimate.cpp b/src/servers/Scripts/instances/raids/TheWeaponsRefrainUltimate.cpp index c6acf655..3c2d117a 100644 --- a/src/servers/Scripts/instances/raids/TheWeaponsRefrainUltimate.cpp +++ b/src/servers/Scripts/instances/raids/TheWeaponsRefrainUltimate.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWeaponsRefrainUltimate : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheWeepingCityofMhach.cpp b/src/servers/Scripts/instances/raids/TheWeepingCityofMhach.cpp index f8cd3779..13595708 100644 --- a/src/servers/Scripts/instances/raids/TheWeepingCityofMhach.cpp +++ b/src/servers/Scripts/instances/raids/TheWeepingCityofMhach.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWeepingCityofMhach : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/raids/TheWorldofDarkness.cpp b/src/servers/Scripts/instances/raids/TheWorldofDarkness.cpp index 3b029253..f185a110 100644 --- a/src/servers/Scripts/instances/raids/TheWorldofDarkness.cpp +++ b/src/servers/Scripts/instances/raids/TheWorldofDarkness.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWorldofDarkness : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/treasurehunt/TheAquapolis.cpp b/src/servers/Scripts/instances/treasurehunt/TheAquapolis.cpp index 1838b6ee..e56ff057 100644 --- a/src/servers/Scripts/instances/treasurehunt/TheAquapolis.cpp +++ b/src/servers/Scripts/instances/treasurehunt/TheAquapolis.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheAquapolis : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/treasurehunt/TheHiddenCanalsofUznair.cpp b/src/servers/Scripts/instances/treasurehunt/TheHiddenCanalsofUznair.cpp index 3b343355..4f5ac3bb 100644 --- a/src/servers/Scripts/instances/treasurehunt/TheHiddenCanalsofUznair.cpp +++ b/src/servers/Scripts/instances/treasurehunt/TheHiddenCanalsofUznair.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheHiddenCanalsofUznair : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/treasurehunt/TheLostCanalsofUznair.cpp b/src/servers/Scripts/instances/treasurehunt/TheLostCanalsofUznair.cpp index 57070cfa..063678af 100644 --- a/src/servers/Scripts/instances/treasurehunt/TheLostCanalsofUznair.cpp +++ b/src/servers/Scripts/instances/treasurehunt/TheLostCanalsofUznair.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheLostCanalsofUznair : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ARelicReborntheChimera.cpp b/src/servers/Scripts/instances/trials/ARelicReborntheChimera.cpp index e2f45f2e..75290e8f 100644 --- a/src/servers/Scripts/instances/trials/ARelicReborntheChimera.cpp +++ b/src/servers/Scripts/instances/trials/ARelicReborntheChimera.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ARelicReborntheChimera : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ARelicReborntheHydra.cpp b/src/servers/Scripts/instances/trials/ARelicReborntheHydra.cpp index e2b81eb2..b0901b37 100644 --- a/src/servers/Scripts/instances/trials/ARelicReborntheHydra.cpp +++ b/src/servers/Scripts/instances/trials/ARelicReborntheHydra.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ARelicReborntheHydra : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/AkhAfahAmphitheatreExtreme.cpp b/src/servers/Scripts/instances/trials/AkhAfahAmphitheatreExtreme.cpp similarity index 92% rename from src/servers/Scripts/instances/AkhAfahAmphitheatreExtreme.cpp rename to src/servers/Scripts/instances/trials/AkhAfahAmphitheatreExtreme.cpp index ee9b597c..893379f5 100644 --- a/src/servers/Scripts/instances/AkhAfahAmphitheatreExtreme.cpp +++ b/src/servers/Scripts/instances/trials/AkhAfahAmphitheatreExtreme.cpp @@ -1,12 +1,12 @@ #include #include -class AkhAfahAmphitheatreExtreme : - public InstanceContentScript +using namespace Core; + +class AkhAfahAmphitheatreExtreme : public InstanceContentScript { public: - AkhAfahAmphitheatreExtreme() : - InstanceContentScript( 20025 ) + AkhAfahAmphitheatreExtreme() : InstanceContentScript( 20025 ) { } diff --git a/src/servers/Scripts/instances/trials/AkhAfahAmphitheatreHard.cpp b/src/servers/Scripts/instances/trials/AkhAfahAmphitheatreHard.cpp index be109248..5f983199 100644 --- a/src/servers/Scripts/instances/trials/AkhAfahAmphitheatreHard.cpp +++ b/src/servers/Scripts/instances/trials/AkhAfahAmphitheatreHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class AkhAfahAmphitheatreHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/BattleintheBigKeep.cpp b/src/servers/Scripts/instances/trials/BattleintheBigKeep.cpp index 538965a3..d0c3d279 100644 --- a/src/servers/Scripts/instances/trials/BattleintheBigKeep.cpp +++ b/src/servers/Scripts/instances/trials/BattleintheBigKeep.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BattleintheBigKeep : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/BattleontheBigBridge.cpp b/src/servers/Scripts/instances/trials/BattleontheBigBridge.cpp index f460afcc..b849d7a4 100644 --- a/src/servers/Scripts/instances/trials/BattleontheBigBridge.cpp +++ b/src/servers/Scripts/instances/trials/BattleontheBigBridge.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class BattleontheBigBridge : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/CapeWestwind.cpp b/src/servers/Scripts/instances/trials/CapeWestwind.cpp index 60ef9d96..ad755e7b 100644 --- a/src/servers/Scripts/instances/trials/CapeWestwind.cpp +++ b/src/servers/Scripts/instances/trials/CapeWestwind.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class CapeWestwind : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ContainmentBayP1T6.cpp b/src/servers/Scripts/instances/trials/ContainmentBayP1T6.cpp index 7b364104..6b3f8da8 100644 --- a/src/servers/Scripts/instances/trials/ContainmentBayP1T6.cpp +++ b/src/servers/Scripts/instances/trials/ContainmentBayP1T6.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ContainmentBayP1T6 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ContainmentBayP1T6Extreme.cpp b/src/servers/Scripts/instances/trials/ContainmentBayP1T6Extreme.cpp index 2233c641..793e3cf6 100644 --- a/src/servers/Scripts/instances/trials/ContainmentBayP1T6Extreme.cpp +++ b/src/servers/Scripts/instances/trials/ContainmentBayP1T6Extreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ContainmentBayP1T6Extreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ContainmentBayS1T7.cpp b/src/servers/Scripts/instances/trials/ContainmentBayS1T7.cpp index ea1a1c46..48fb5198 100644 --- a/src/servers/Scripts/instances/trials/ContainmentBayS1T7.cpp +++ b/src/servers/Scripts/instances/trials/ContainmentBayS1T7.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ContainmentBayS1T7 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ContainmentBayS1T7Extreme.cpp b/src/servers/Scripts/instances/trials/ContainmentBayS1T7Extreme.cpp index e14aa856..0bd7ee35 100644 --- a/src/servers/Scripts/instances/trials/ContainmentBayS1T7Extreme.cpp +++ b/src/servers/Scripts/instances/trials/ContainmentBayS1T7Extreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ContainmentBayS1T7Extreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ContainmentBayZ1T9.cpp b/src/servers/Scripts/instances/trials/ContainmentBayZ1T9.cpp index d9fd7ced..77ba04ec 100644 --- a/src/servers/Scripts/instances/trials/ContainmentBayZ1T9.cpp +++ b/src/servers/Scripts/instances/trials/ContainmentBayZ1T9.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ContainmentBayZ1T9 : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ContainmentBayZ1T9Extreme.cpp b/src/servers/Scripts/instances/trials/ContainmentBayZ1T9Extreme.cpp index 9d2d8f3b..6987135c 100644 --- a/src/servers/Scripts/instances/trials/ContainmentBayZ1T9Extreme.cpp +++ b/src/servers/Scripts/instances/trials/ContainmentBayZ1T9Extreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ContainmentBayZ1T9Extreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/Emanation.cpp b/src/servers/Scripts/instances/trials/Emanation.cpp index 049dd810..3af527e8 100644 --- a/src/servers/Scripts/instances/trials/Emanation.cpp +++ b/src/servers/Scripts/instances/trials/Emanation.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class Emanation : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/EmanationExtreme.cpp b/src/servers/Scripts/instances/trials/EmanationExtreme.cpp index d5d13ae0..11849d3c 100644 --- a/src/servers/Scripts/instances/trials/EmanationExtreme.cpp +++ b/src/servers/Scripts/instances/trials/EmanationExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class EmanationExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/SpecialEventI.cpp b/src/servers/Scripts/instances/trials/SpecialEventI.cpp index e6778180..af4eef79 100644 --- a/src/servers/Scripts/instances/trials/SpecialEventI.cpp +++ b/src/servers/Scripts/instances/trials/SpecialEventI.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SpecialEventI : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/SpecialEventII.cpp b/src/servers/Scripts/instances/trials/SpecialEventII.cpp index 3b08d377..e76d49e9 100644 --- a/src/servers/Scripts/instances/trials/SpecialEventII.cpp +++ b/src/servers/Scripts/instances/trials/SpecialEventII.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SpecialEventII : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/SpecialEventIII.cpp b/src/servers/Scripts/instances/trials/SpecialEventIII.cpp index 95bea8a0..864edc8e 100644 --- a/src/servers/Scripts/instances/trials/SpecialEventIII.cpp +++ b/src/servers/Scripts/instances/trials/SpecialEventIII.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class SpecialEventIII : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheBowlofEmbers.cpp b/src/servers/Scripts/instances/trials/TheBowlofEmbers.cpp index bc0cfe0e..e02da370 100644 --- a/src/servers/Scripts/instances/trials/TheBowlofEmbers.cpp +++ b/src/servers/Scripts/instances/trials/TheBowlofEmbers.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBowlofEmbers : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheBowlofEmbersExtreme.cpp b/src/servers/Scripts/instances/trials/TheBowlofEmbersExtreme.cpp index 748594a7..57e2f0f4 100644 --- a/src/servers/Scripts/instances/trials/TheBowlofEmbersExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheBowlofEmbersExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBowlofEmbersExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheBowlofEmbersHard.cpp b/src/servers/Scripts/instances/trials/TheBowlofEmbersHard.cpp index 96471b06..4d3eeea1 100644 --- a/src/servers/Scripts/instances/trials/TheBowlofEmbersHard.cpp +++ b/src/servers/Scripts/instances/trials/TheBowlofEmbersHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheBowlofEmbersHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheChrysalis.cpp b/src/servers/Scripts/instances/trials/TheChrysalis.cpp index 499c4975..9ab2c0ee 100644 --- a/src/servers/Scripts/instances/trials/TheChrysalis.cpp +++ b/src/servers/Scripts/instances/trials/TheChrysalis.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheChrysalis : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheDragonsNeck.cpp b/src/servers/Scripts/instances/trials/TheDragonsNeck.cpp index f0b8c17e..1ac06a84 100644 --- a/src/servers/Scripts/instances/trials/TheDragonsNeck.cpp +++ b/src/servers/Scripts/instances/trials/TheDragonsNeck.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheDragonsNeck : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheFinalStepsofFaith.cpp b/src/servers/Scripts/instances/trials/TheFinalStepsofFaith.cpp index b3f3ac92..59fc233a 100644 --- a/src/servers/Scripts/instances/trials/TheFinalStepsofFaith.cpp +++ b/src/servers/Scripts/instances/trials/TheFinalStepsofFaith.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheFinalStepsofFaith : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheHowlingEye.cpp b/src/servers/Scripts/instances/trials/TheHowlingEye.cpp index 06054df1..f552b5ca 100644 --- a/src/servers/Scripts/instances/trials/TheHowlingEye.cpp +++ b/src/servers/Scripts/instances/trials/TheHowlingEye.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheHowlingEye : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheHowlingEyeExtreme.cpp b/src/servers/Scripts/instances/trials/TheHowlingEyeExtreme.cpp index d56af2dd..d79fa4c0 100644 --- a/src/servers/Scripts/instances/trials/TheHowlingEyeExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheHowlingEyeExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheHowlingEyeExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheHowlingEyeHard.cpp b/src/servers/Scripts/instances/trials/TheHowlingEyeHard.cpp index 51e430fc..61f070f3 100644 --- a/src/servers/Scripts/instances/trials/TheHowlingEyeHard.cpp +++ b/src/servers/Scripts/instances/trials/TheHowlingEyeHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheHowlingEyeHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheJadeStoa.cpp b/src/servers/Scripts/instances/trials/TheJadeStoa.cpp index 185c4595..d54a5d7d 100644 --- a/src/servers/Scripts/instances/trials/TheJadeStoa.cpp +++ b/src/servers/Scripts/instances/trials/TheJadeStoa.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheJadeStoa : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheJadeStoaExtreme.cpp b/src/servers/Scripts/instances/trials/TheJadeStoaExtreme.cpp index 01e63480..269fe63f 100644 --- a/src/servers/Scripts/instances/trials/TheJadeStoaExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheJadeStoaExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheJadeStoaExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheLimitlessBlueExtreme.cpp b/src/servers/Scripts/instances/trials/TheLimitlessBlueExtreme.cpp index 2f914e32..c127cd30 100644 --- a/src/servers/Scripts/instances/trials/TheLimitlessBlueExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheLimitlessBlueExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheLimitlessBlueExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheLimitlessBlueHard.cpp b/src/servers/Scripts/instances/trials/TheLimitlessBlueHard.cpp index 1271e610..622a5392 100644 --- a/src/servers/Scripts/instances/trials/TheLimitlessBlueHard.cpp +++ b/src/servers/Scripts/instances/trials/TheLimitlessBlueHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheLimitlessBlueHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheMinstrelsBalladNidhoggsRage.cpp b/src/servers/Scripts/instances/trials/TheMinstrelsBalladNidhoggsRage.cpp index 604715c2..e8e9d250 100644 --- a/src/servers/Scripts/instances/trials/TheMinstrelsBalladNidhoggsRage.cpp +++ b/src/servers/Scripts/instances/trials/TheMinstrelsBalladNidhoggsRage.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheMinstrelsBalladNidhoggsRage : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheMinstrelsBalladShinryusDomain.cpp b/src/servers/Scripts/instances/trials/TheMinstrelsBalladShinryusDomain.cpp index e36016db..659f80a0 100644 --- a/src/servers/Scripts/instances/trials/TheMinstrelsBalladShinryusDomain.cpp +++ b/src/servers/Scripts/instances/trials/TheMinstrelsBalladShinryusDomain.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheMinstrelsBalladShinryusDomain : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheMinstrelsBalladThordansReign.cpp b/src/servers/Scripts/instances/trials/TheMinstrelsBalladThordansReign.cpp index 954cffc3..a2ea4f9e 100644 --- a/src/servers/Scripts/instances/trials/TheMinstrelsBalladThordansReign.cpp +++ b/src/servers/Scripts/instances/trials/TheMinstrelsBalladThordansReign.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheMinstrelsBalladThordansReign : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheMinstrelsBalladUltimasBane.cpp b/src/servers/Scripts/instances/trials/TheMinstrelsBalladUltimasBane.cpp index 01cc8765..cda5a938 100644 --- a/src/servers/Scripts/instances/trials/TheMinstrelsBalladUltimasBane.cpp +++ b/src/servers/Scripts/instances/trials/TheMinstrelsBalladUltimasBane.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheMinstrelsBalladUltimasBane : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheNavel.cpp b/src/servers/Scripts/instances/trials/TheNavel.cpp index 8c7d0345..efafa11f 100644 --- a/src/servers/Scripts/instances/trials/TheNavel.cpp +++ b/src/servers/Scripts/instances/trials/TheNavel.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheNavel : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheNavelExtreme.cpp b/src/servers/Scripts/instances/trials/TheNavelExtreme.cpp index 8a56af6f..888eca76 100644 --- a/src/servers/Scripts/instances/trials/TheNavelExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheNavelExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheNavelExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheNavelHard.cpp b/src/servers/Scripts/instances/trials/TheNavelHard.cpp index 41f79165..c2853340 100644 --- a/src/servers/Scripts/instances/trials/TheNavelHard.cpp +++ b/src/servers/Scripts/instances/trials/TheNavelHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheNavelHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ThePoolofTribute.cpp b/src/servers/Scripts/instances/trials/ThePoolofTribute.cpp index f2654337..3a947f25 100644 --- a/src/servers/Scripts/instances/trials/ThePoolofTribute.cpp +++ b/src/servers/Scripts/instances/trials/ThePoolofTribute.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePoolofTribute : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ThePoolofTributeExtreme.cpp b/src/servers/Scripts/instances/trials/ThePoolofTributeExtreme.cpp index ff4ec030..8853d0e2 100644 --- a/src/servers/Scripts/instances/trials/ThePoolofTributeExtreme.cpp +++ b/src/servers/Scripts/instances/trials/ThePoolofTributeExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThePoolofTributeExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheRoyalMenagerie.cpp b/src/servers/Scripts/instances/trials/TheRoyalMenagerie.cpp index 2a12ea4e..982b1a38 100644 --- a/src/servers/Scripts/instances/trials/TheRoyalMenagerie.cpp +++ b/src/servers/Scripts/instances/trials/TheRoyalMenagerie.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheRoyalMenagerie : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheSingularityReactor.cpp b/src/servers/Scripts/instances/trials/TheSingularityReactor.cpp index 5fd20a8a..b02fed9a 100644 --- a/src/servers/Scripts/instances/trials/TheSingularityReactor.cpp +++ b/src/servers/Scripts/instances/trials/TheSingularityReactor.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheSingularityReactor : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheStepsofFaith.cpp b/src/servers/Scripts/instances/trials/TheStepsofFaith.cpp index 87db0a55..7c553c5d 100644 --- a/src/servers/Scripts/instances/trials/TheStepsofFaith.cpp +++ b/src/servers/Scripts/instances/trials/TheStepsofFaith.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheStepsofFaith : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheStrikingTreeExtreme.cpp b/src/servers/Scripts/instances/trials/TheStrikingTreeExtreme.cpp index 3a7116f2..01573c6d 100644 --- a/src/servers/Scripts/instances/trials/TheStrikingTreeExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheStrikingTreeExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheStrikingTreeExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheStrikingTreeHard.cpp b/src/servers/Scripts/instances/trials/TheStrikingTreeHard.cpp index c019f898..378b2844 100644 --- a/src/servers/Scripts/instances/trials/TheStrikingTreeHard.cpp +++ b/src/servers/Scripts/instances/trials/TheStrikingTreeHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheStrikingTreeHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheWhorleaterExtreme.cpp b/src/servers/Scripts/instances/trials/TheWhorleaterExtreme.cpp index d25e232a..be095d69 100644 --- a/src/servers/Scripts/instances/trials/TheWhorleaterExtreme.cpp +++ b/src/servers/Scripts/instances/trials/TheWhorleaterExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWhorleaterExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/TheWhorleaterHard.cpp b/src/servers/Scripts/instances/trials/TheWhorleaterHard.cpp index e3468cdc..961de4ec 100644 --- a/src/servers/Scripts/instances/trials/TheWhorleaterHard.cpp +++ b/src/servers/Scripts/instances/trials/TheWhorleaterHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class TheWhorleaterHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ThokastThokExtreme.cpp b/src/servers/Scripts/instances/trials/ThokastThokExtreme.cpp index c0043829..203b6e7f 100644 --- a/src/servers/Scripts/instances/trials/ThokastThokExtreme.cpp +++ b/src/servers/Scripts/instances/trials/ThokastThokExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThokastThokExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ThokastThokHard.cpp b/src/servers/Scripts/instances/trials/ThokastThokHard.cpp index aec7e3fe..12bf19d9 100644 --- a/src/servers/Scripts/instances/trials/ThokastThokHard.cpp +++ b/src/servers/Scripts/instances/trials/ThokastThokHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThokastThokHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ThornmarchExtreme.cpp b/src/servers/Scripts/instances/trials/ThornmarchExtreme.cpp index 8fad525c..ad744b82 100644 --- a/src/servers/Scripts/instances/trials/ThornmarchExtreme.cpp +++ b/src/servers/Scripts/instances/trials/ThornmarchExtreme.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThornmarchExtreme : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/ThornmarchHard.cpp b/src/servers/Scripts/instances/trials/ThornmarchHard.cpp index 78f005b4..b0b66420 100644 --- a/src/servers/Scripts/instances/trials/ThornmarchHard.cpp +++ b/src/servers/Scripts/instances/trials/ThornmarchHard.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class ThornmarchHard : public InstanceContentScript { diff --git a/src/servers/Scripts/instances/trials/UrthsFount.cpp b/src/servers/Scripts/instances/trials/UrthsFount.cpp index f865cb15..58f03d00 100644 --- a/src/servers/Scripts/instances/trials/UrthsFount.cpp +++ b/src/servers/Scripts/instances/trials/UrthsFount.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + class UrthsFount : public InstanceContentScript { diff --git a/src/servers/Scripts/opening/OpeningGridania.cpp b/src/servers/Scripts/opening/OpeningGridania.cpp index db1a9a36..294fd939 100644 --- a/src/servers/Scripts/opening/OpeningGridania.cpp +++ b/src/servers/Scripts/opening/OpeningGridania.cpp @@ -1,8 +1,9 @@ #include #include -class OpeningGridania : - public EventScript +using namespace Core; + +class OpeningGridania : public EventScript { private: static constexpr auto ERANGE_HOWTO_ANN_AND_QUEST = 2117539; diff --git a/src/servers/Scripts/opening/OpeningLimsa.cpp b/src/servers/Scripts/opening/OpeningLimsa.cpp index de685b39..13ab9a94 100644 --- a/src/servers/Scripts/opening/OpeningLimsa.cpp +++ b/src/servers/Scripts/opening/OpeningLimsa.cpp @@ -1,6 +1,8 @@ #include #include +using namespace Core; + // Opening Script: OpeningLimsaLominsa // Quest Name: OpeningLimsaLominsa // Quest ID: 1245185 diff --git a/src/servers/Scripts/opening/OpeningUldah.cpp b/src/servers/Scripts/opening/OpeningUldah.cpp index 1b26ec1b..18eb3a89 100644 --- a/src/servers/Scripts/opening/OpeningUldah.cpp +++ b/src/servers/Scripts/opening/OpeningUldah.cpp @@ -1,8 +1,9 @@ #include #include -class OpeningUldah : - public EventScript +using namespace Core; + +class OpeningUldah : public EventScript { private: static constexpr auto ERANGE_HOWTO_ANN_AND_QUEST = 4101650; diff --git a/src/servers/Scripts/quest/ManFst001.cpp b/src/servers/Scripts/quest/ManFst001.cpp index 53372d95..7b2cae4d 100644 --- a/src/servers/Scripts/quest/ManFst001.cpp +++ b/src/servers/Scripts/quest/ManFst001.cpp @@ -9,6 +9,8 @@ // Start NPC: 1001148 // End NPC: 1001140 +using namespace Core; + class ManFst001 : public EventScript { diff --git a/src/servers/Scripts/quest/ManFst002.cpp b/src/servers/Scripts/quest/ManFst002.cpp index 831a4fca..f8165da3 100644 --- a/src/servers/Scripts/quest/ManFst002.cpp +++ b/src/servers/Scripts/quest/ManFst002.cpp @@ -9,6 +9,8 @@ // Start NPC: 1001140 // End NPC: 1000100 +using namespace Core; + class ManFst002 : public EventScript { private: diff --git a/src/servers/Scripts/quest/ManFst003.cpp b/src/servers/Scripts/quest/ManFst003.cpp index 7048b2a6..aa8631f1 100644 --- a/src/servers/Scripts/quest/ManFst003.cpp +++ b/src/servers/Scripts/quest/ManFst003.cpp @@ -8,6 +8,8 @@ // Start NPC: 1001140 // End NPC: 1000100 +using namespace Core; + class ManFst003 : public EventScript { diff --git a/src/servers/Scripts/quest/ManFst004.cpp b/src/servers/Scripts/quest/ManFst004.cpp index 5e208e03..d6c2b44b 100644 --- a/src/servers/Scripts/quest/ManFst004.cpp +++ b/src/servers/Scripts/quest/ManFst004.cpp @@ -8,6 +8,8 @@ // Start NPC: 1001140 // End NPC: 1000100 +using namespace Core; + class ManFst004 : public EventScript { diff --git a/src/servers/Scripts/quest/ManSea001.cpp b/src/servers/Scripts/quest/ManSea001.cpp index 2ad910cb..41d6ff89 100644 --- a/src/servers/Scripts/quest/ManSea001.cpp +++ b/src/servers/Scripts/quest/ManSea001.cpp @@ -8,6 +8,8 @@ // Start NPC: 1001028 // End NPC: 1002697 +using namespace Core; + class ManSea001 : public EventScript { diff --git a/src/servers/Scripts/quest/ManSea002.cpp b/src/servers/Scripts/quest/ManSea002.cpp index 524e10be..2478e254 100644 --- a/src/servers/Scripts/quest/ManSea002.cpp +++ b/src/servers/Scripts/quest/ManSea002.cpp @@ -8,6 +8,8 @@ // Start NPC: 1002697 // End NPC: 1000972 +using namespace Core; + class ManSea002 : public EventScript { diff --git a/src/servers/Scripts/quest/ManSea003.cpp b/src/servers/Scripts/quest/ManSea003.cpp index e2a11715..c1d3a077 100644 --- a/src/servers/Scripts/quest/ManSea003.cpp +++ b/src/servers/Scripts/quest/ManSea003.cpp @@ -8,6 +8,8 @@ // Start NPC: 1002697 // End NPC: 1000972 +using namespace Core; + class ManSea003 : public EventScript { diff --git a/src/servers/Scripts/quest/ManWil001.cpp b/src/servers/Scripts/quest/ManWil001.cpp index 7a50a6e4..b70abf12 100644 --- a/src/servers/Scripts/quest/ManWil001.cpp +++ b/src/servers/Scripts/quest/ManWil001.cpp @@ -8,6 +8,8 @@ // Start NPC: 1003987 // End NPC: 1003988 +using namespace Core; + class ManWil001 : public EventScript { diff --git a/src/servers/Scripts/quest/ManWil002.cpp b/src/servers/Scripts/quest/ManWil002.cpp index a28f7f0a..b58256d9 100644 --- a/src/servers/Scripts/quest/ManWil002.cpp +++ b/src/servers/Scripts/quest/ManWil002.cpp @@ -8,6 +8,8 @@ // Start NPC: 1003988 // End NPC: 1001353 +using namespace Core; + class ManWil002 : public EventScript { diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst001.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst001.cpp index 0d157863..f9a46c43 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst001.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst001.cpp @@ -2,6 +2,8 @@ #include "Event/EventHelper.h" #include +using namespace Core; + // Quest Script: SubFst001_00024 // Quest Name: Coarse Correspondence // Quest ID: 65560 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst002.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst002.cpp index ef05cc93..8206de6b 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst002.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst002.cpp @@ -2,6 +2,8 @@ #include "Event/EventHelper.h" #include +using namespace Core; + // Quest Script: SubFst002_00025 // Quest Name: Quarrels with Squirrels // Quest ID: 65561 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst003.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst003.cpp index 69065634..62dd4425 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst003.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst003.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst003_00026 // Quest Name: Once Bitten, Twice Shy // Quest ID: 65562 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst004.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst004.cpp index 3ebb600d..89fcb0df 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst004.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst004.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst004_00027 // Quest Name: Preserving the Past // Quest ID: 65563 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst008.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst008.cpp index 42c8940b..f0a70157 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst008.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst008.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst008_00032 // Quest Name: A Hard Nut to Crack // Quest ID: 65568 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst009.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst009.cpp index 9a971596..b1cb6e61 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst009.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst009.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst009_00034 // Quest Name: Derision of Labor // Quest ID: 65570 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst010.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst010.cpp index 0503a73f..782848c1 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst010.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst010.cpp @@ -2,6 +2,8 @@ #include "Event/EventHelper.h" #include +using namespace Core; + // Quest Script: SubFst010_00001 // Quest Name: A Good Adventurer Is Hard to Find // Quest ID: 65537 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst011.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst011.cpp index 07b2310b..5caf16ab 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst011.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst011.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst011_00037 // Quest Name: Population Control // Quest ID: 65573 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst013.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst013.cpp index 0c52bc5c..93b6f3b2 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst013.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst013.cpp @@ -2,6 +2,8 @@ #include #include "Event/EventHelper.h" +using namespace Core; + // Quest Script: SubFst013_00040 // Quest Name: For Friendship // Quest ID: 65576 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst014.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst014.cpp index 7a86bdb8..45db93ad 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst014.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst014.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst014_00041 // Quest Name: Covered in Roses // Quest ID: 65577 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst015.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst015.cpp index 515895c2..1c221595 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst015.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst015.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst015_00042 // Quest Name: Sylphic Gratitude // Quest ID: 65578 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst019.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst019.cpp index 13b6a6ff..bbccc753 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst019.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst019.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst019_00049 // Quest Name: I Am Millicent, Hear Me Roar // Quest ID: 65585 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst026.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst026.cpp index 06993186..908c2ff5 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst026.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst026.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst026_00170 // Quest Name: Jumping at Shadows // Quest ID: 65706 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst029.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst029.cpp index 8c180d4b..045ac1ba 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst029.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst029.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst029_00172 // Quest Name: More than a Flesh Wound // Quest ID: 65708 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst030.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst030.cpp index 32464e95..ea27aac3 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst030.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst030.cpp @@ -3,6 +3,8 @@ #include "Event/EventHelper.h" #include +using namespace Core; + // Quest Script: SubFst030_00173 // Quest Name: The Nose Knows // Quest ID: 65709 diff --git a/src/servers/Scripts/quest/subquest/gridania/SubFst041.cpp b/src/servers/Scripts/quest/subquest/gridania/SubFst041.cpp index 00fea0e4..d120d80c 100644 --- a/src/servers/Scripts/quest/subquest/gridania/SubFst041.cpp +++ b/src/servers/Scripts/quest/subquest/gridania/SubFst041.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubFst041_00197 // Quest Name: Splitting Shells // Quest ID: 65733 diff --git a/src/servers/Scripts/quest/subquest/limsa/SubSea001.cpp b/src/servers/Scripts/quest/subquest/limsa/SubSea001.cpp index 058f2675..a35c5967 100644 --- a/src/servers/Scripts/quest/subquest/limsa/SubSea001.cpp +++ b/src/servers/Scripts/quest/subquest/limsa/SubSea001.cpp @@ -3,6 +3,8 @@ #include "Event/EventHelper.h" #include +using namespace Core; + // Quest Script: SubSea001_00111 // Quest Name: Making a Name // Quest ID: 65647 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil000.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil000.cpp index 6bd322ae..4b5e3c35 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil000.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil000.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil000_00149 // Quest Name: Due Diligence // Quest ID: 65685 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil001.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil001.cpp index a028eb69..2a461cb2 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil001.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil001.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil001_00150 // Quest Name: Motivational Speaking // Quest ID: 65686 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil002.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil002.cpp index 8d9ec19d..3087c84f 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil002.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil002.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil002_00151 // Quest Name: Gil for Gold // Quest ID: 65687 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil004.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil004.cpp index 33f6ecac..4b558331 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil004.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil004.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil004_00153 // Quest Name: Unholy Matrimony // Quest ID: 65689 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil006.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil006.cpp index 0812a1d3..e1a11261 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil006.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil006.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil006_00165 // Quest Name: The Great Gladiator // Quest ID: 65701 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil007.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil007.cpp index 820c9022..0a873bf9 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil007.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil007.cpp @@ -3,6 +3,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil007_00167 // Quest Name: With Open Arms // Quest ID: 65703 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil018.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil018.cpp index 234670fb..e2e78206 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil018.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil018.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil018_00396 // Quest Name: No Lady Is an Island // Quest ID: 65932 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil019.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil019.cpp index b4542e13..4754adce 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil019.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil019.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil019_00392 // Quest Name: Decisions, Decisions // Quest ID: 65928 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil021.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil021.cpp index 9bdc0d8a..f4947d51 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil021.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil021.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil021_00394 // Quest Name: A Luxury Long Lost // Quest ID: 65930 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil022.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil022.cpp index 7aa7c1f0..ced80b96 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil022.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil022.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil022_00395 // Quest Name: The Wealth of Nations // Quest ID: 65931 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil027.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil027.cpp index 437e3bd4..d79f36af 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil027.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil027.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil027_00595 // Quest Name: We Must Rebuild // Quest ID: 66131 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil028.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil028.cpp index 7a44725b..7215484e 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil028.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil028.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil028_00389 // Quest Name: Fantastic Voyage // Quest ID: 65925 diff --git a/src/servers/Scripts/quest/subquest/uldah/SubWil029.cpp b/src/servers/Scripts/quest/subquest/uldah/SubWil029.cpp index f9b4923c..778d645d 100644 --- a/src/servers/Scripts/quest/subquest/uldah/SubWil029.cpp +++ b/src/servers/Scripts/quest/subquest/uldah/SubWil029.cpp @@ -2,6 +2,8 @@ #include #include +using namespace Core; + // Quest Script: SubWil029_00390 // Quest Name: Catch Your Breath // Quest ID: 65926 diff --git a/src/servers/sapphire_api/Forwards.h b/src/servers/sapphire_api/Forwards.h index 7788db1b..cf8c0a4c 100644 --- a/src/servers/sapphire_api/Forwards.h +++ b/src/servers/sapphire_api/Forwards.h @@ -3,107 +3,87 @@ #include -namespace Core { +namespace Core +{ + class Cell; + class Zone; + class Item; + class ItemContainer; + class Inventory; + class Session; + class ZonePosition; + using ZonePtr = std::shared_ptr< Zone >; + using ItemPtr = std::shared_ptr< Item >; + using ItemContainerPtr = std::shared_ptr< ItemContainer >; + using InventoryPtr = std::shared_ptr< Inventory >; + using SessionPtr = std::shared_ptr< Session >; + using ZonePositionPtr = std::shared_ptr< ZonePosition >; -class Cell; + namespace StatusEffect + { + class StatusEffect; + class StatusEffectContainer; + using StatusEffectPtr = std::shared_ptr< StatusEffect >; + using StatusEffectContainerPtr = std::shared_ptr< StatusEffectContainer >; + } -class Zone; + namespace Entity + { + class Chara; + class Player; + class BattleNpc; + using ActorPtr = std::shared_ptr< Chara >; + using PlayerPtr = std::shared_ptr< Player >; + using BattleNpcPtr = std::shared_ptr< BattleNpc >; + } -class Item; + namespace Event + { + class EventHandler; + using EventPtr = std::shared_ptr< EventHandler >; + } -class ItemContainer; + namespace Action + { + class Action; + class ActionTeleport; + class EventAction; + using ActionPtr = std::shared_ptr< Action >; + using ActionTeleportPtr = std::shared_ptr< ActionTeleport >; + using EventActionPtr = std::shared_ptr< EventAction >; + } -class Inventory; + namespace Network + { + class Hive; + class Acceptor; + class Connection; + class WorldConnection; + class SessionConnection; + class ZoneConnection; + using HivePtr = std::shared_ptr< Hive >; + using AcceptorPtr = std::shared_ptr< Acceptor >; + using ConnectionPtr = std::shared_ptr< Connection >; + using WorldConnectionPtr = std::shared_ptr< WorldConnection >; + using ZoneConnectionPtr = std::shared_ptr< ZoneConnection >; + using SessionConnectionPtr = std::shared_ptr< SessionConnection >; -class Session; + namespace Packets + { + class GamePacket; + using GamePacketPtr = std::shared_ptr< GamePacket >; + } -class ZonePosition; + } -typedef std::shared_ptr< Zone > ZonePtr; -typedef std::shared_ptr< Item > ItemPtr; -typedef std::shared_ptr< ItemContainer > ItemContainerPtr; -typedef std::shared_ptr< Inventory > InventoryPtr; -typedef std::shared_ptr< Session > SessionPtr; -typedef std::shared_ptr< ZonePosition > ZonePositionPtr; - -namespace StatusEffect { -class StatusEffect; - -class StatusEffectContainer; - -typedef std::shared_ptr< StatusEffect > StatusEffectPtr; -typedef std::shared_ptr< StatusEffectContainer > StatusEffectContainerPtr; -} - -namespace Entity { -class Chara; - -class Player; - -class BattleNpc; - -typedef std::shared_ptr< Chara > ActorPtr; -typedef std::shared_ptr< Player > PlayerPtr; -typedef std::shared_ptr< BattleNpc > BattleNpcPtr; -} - -namespace Event { -class EventHandler; - -typedef std::shared_ptr< EventHandler > EventPtr; -} - -namespace Action { -class Action; - -class ActionTeleport; - -class EventAction; - -typedef std::shared_ptr< Action > ActionPtr; -typedef std::shared_ptr< ActionTeleport > ActionTeleportPtr; -typedef std::shared_ptr< EventAction > EventActionPtr; -} - - -namespace Network { -class Hive; - -class Acceptor; - -class Connection; - -class WorldConnection; - -class SessionConnection; - -class ZoneConnection; - -typedef std::shared_ptr< Hive > HivePtr; -typedef std::shared_ptr< Acceptor > AcceptorPtr; -typedef std::shared_ptr< Connection > ConnectionPtr; -typedef std::shared_ptr< WorldConnection > WorldConnectionPtr; -typedef std::shared_ptr< ZoneConnection > ZoneConnectionPtr; -typedef std::shared_ptr< SessionConnection > SessionConnectionPtr; - -namespace Packets { -class GamePacket; - - -typedef std::shared_ptr< GamePacket > GamePacketPtr; + namespace Scripting + { + using EventReturnCallback = std::function< void( Entity::Player&, uint32_t, uint16_t, uint16_t, uint16_t, + uint16_t ) >; + } + using ActionCallback = std::function< void( Entity::Player&, uint32_t, uint64_t ) >; } -} - -namespace Scripting { -using EventReturnCallback = std::function< void( Entity::Player&, uint32_t, uint16_t, uint16_t, uint16_t, - uint16_t ) >; -} - -using ActionCallback = std::function< void( Entity::Player&, uint32_t, uint64_t ) >; - -} - #endif diff --git a/src/servers/sapphire_api/LoginSession.h b/src/servers/sapphire_api/LoginSession.h index 3b71802a..e5493c7a 100644 --- a/src/servers/sapphire_api/LoginSession.h +++ b/src/servers/sapphire_api/LoginSession.h @@ -7,59 +7,58 @@ #include #include -namespace Core { - -class LoginSession +namespace Core { -private: - uint32_t m_IP; - uint32_t m_accountID; - - uint8_t m_sessionId[56]; - -public: - - std::string newCharName; - - LoginSession( void ); - - ~LoginSession( void ); - - uint32_t getIP() + class LoginSession { - return m_IP; - } - void setSessionId( uint8_t* sessionId ) - { - memcpy( m_sessionId, sessionId, 56 ); - } + private: + uint32_t m_IP; + uint32_t m_accountID; + uint8_t m_sessionId[56]; - void setIP( uint32_t iP ) - { - m_IP = iP; - } + public: + std::string newCharName; - uint32_t getAccountID() - { - return m_accountID; - } + LoginSession( void ); - void setAccountID( uint32_t iD ) - { - m_accountID = iD; - } + ~LoginSession( void ); - /*INLINE CLobbySocket* getSocket() { - return m_pGS; - } + uint32_t getIP() + { + return m_IP; + } - INLINE void setSocket(CLobbySocket * pS) { - m_pGS = pS; - }*/ + void setSessionId( uint8_t* sessionId ) + { + memcpy( m_sessionId, sessionId, 56 ); + } -}; + void setIP( uint32_t iP ) + { + m_IP = iP; + } + + uint32_t getAccountID() + { + return m_accountID; + } + + void setAccountID( uint32_t iD ) + { + m_accountID = iD; + } + + /*INLINE CLobbySocket* getSocket() { + return m_pGS; + } + + INLINE void setSocket(CLobbySocket * pS) { + m_pGS = pS; + }*/ + + }; } diff --git a/src/servers/sapphire_api/PlayerMinimal.h b/src/servers/sapphire_api/PlayerMinimal.h index 4bbe8036..df8efd7c 100644 --- a/src/servers/sapphire_api/PlayerMinimal.h +++ b/src/servers/sapphire_api/PlayerMinimal.h @@ -5,204 +5,203 @@ #include #include -namespace Core { - - -class PlayerMinimal +namespace Core { -public: - PlayerMinimal( void ); - ~PlayerMinimal( void ); - - // write player to the database - void write(); - - // load player from db, by id - void load( uint32_t charId ); - - void saveAsNew(); - - std::string getLookString(); - - std::string getInfoJson(); - - std::string getModelString(); - - std::string getClassString(); - - uint8_t getClassLevel(); - - // return the id of the actor - uint32_t getId() const + class PlayerMinimal { - return m_id; - } + public: + PlayerMinimal( void ); - void setId( uint32_t id ) - { - m_id = id; - } + ~PlayerMinimal( void ); - void setContentId( uint64_t id ) - { - m_contentId = id; - } + // write player to the database + void write(); - uint64_t getContentId() const - { - return m_contentId; - } + // load player from db, by id + void load( uint32_t charId ); + + void saveAsNew(); + + std::string getLookString(); + + std::string getInfoJson(); + + std::string getModelString(); + + std::string getClassString(); + + uint8_t getClassLevel(); + + // return the id of the actor + uint32_t getId() const + { + return m_id; + } + + void setId( uint32_t id ) + { + m_id = id; + } + + void setContentId( uint64_t id ) + { + m_contentId = id; + } + + uint64_t getContentId() const + { + return m_contentId; + } - uint32_t getAccountId() const - { - return m_accountId; - } + uint32_t getAccountId() const + { + return m_accountId; + } - void setAccountId( uint32_t accountId ) - { - m_accountId = accountId; - } + void setAccountId( uint32_t accountId ) + { + m_accountId = accountId; + } - // return the actors name - char* getName() - { - return m_name; - } + // return the actors name + char* getName() + { + return m_name; + } - void setLook( uint8_t index, uint32_t value ) - { - m_lookMap[ index ] = value; - } + void setLook( uint8_t index, uint32_t value ) + { + m_lookMap[ index ] = value; + } - // return the actors name - void setName( const char* name ) - { - strcpy( m_name, name ); - } + // return the actors name + void setName( const char* name ) + { + strcpy( m_name, name ); + } - void setClass( uint8_t classId ) - { - m_class = classId; - } + void setClass( uint8_t classId ) + { + m_class = classId; + } - uint8_t getClass() const - { - return m_class; - } + uint8_t getClass() const + { + return m_class; + } - uint8_t getGuardianDeity() const - { - return m_guardianDeity; - } + uint8_t getGuardianDeity() const + { + return m_guardianDeity; + } - void setGuardianDeity( uint8_t guardianId ) - { - m_guardianDeity = guardianId; - } + void setGuardianDeity( uint8_t guardianId ) + { + m_guardianDeity = guardianId; + } - void setBirthDay( uint8_t day, uint8_t month ) - { - m_birthDay = day; - m_birthMonth = month; - } + void setBirthDay( uint8_t day, uint8_t month ) + { + m_birthDay = day; + m_birthMonth = month; + } - uint8_t getBirthDay() const - { - return m_birthDay; - } + uint8_t getBirthDay() const + { + return m_birthDay; + } - uint8_t getBirthMonth() const - { - return m_birthMonth; - } + uint8_t getBirthMonth() const + { + return m_birthMonth; + } - uint8_t getVoice() const - { - return m_birthMonth; - } + uint8_t getVoice() const + { + return m_birthMonth; + } - void setVoice( uint8_t voice ) - { - m_voice = voice; - } + void setVoice( uint8_t voice ) + { + m_voice = voice; + } - uint32_t getZoneId() const - { - return m_zoneId; - } + uint32_t getZoneId() const + { + return m_zoneId; + } - uint32_t getTribe() const - { - return m_tribe; - } + uint32_t getTribe() const + { + return m_tribe; + } - void setTribe( uint8_t tribe ) - { - m_tribe = tribe; - } + void setTribe( uint8_t tribe ) + { + m_tribe = tribe; + } - uint8_t getGmRank() const - { - return m_gmRank; - } + uint8_t getGmRank() const + { + return m_gmRank; + } - void setGmRank( uint8_t rank ) - { - m_gmRank = rank; - } + void setGmRank( uint8_t rank ) + { + m_gmRank = rank; + } - bool getGmInvis() const - { - return m_gmInvis; - } + bool getGmInvis() const + { + return m_gmInvis; + } - void setGmInvis( bool invis ) - { - m_gmInvis = invis; - } + void setGmInvis( bool invis ) + { + m_gmInvis = invis; + } - void createInvDbContainer( uint16_t slot ) const; + void createInvDbContainer( uint16_t slot ) const; - uint32_t m_modelEquip[10]; + uint32_t m_modelEquip[10]; - uint64_t getNextUId64() const; + uint64_t getNextUId64() const; -private: - uint32_t m_accountId; - uint32_t m_id; - uint64_t m_contentId; + private: + uint32_t m_accountId; + uint32_t m_id; + uint64_t m_contentId; - uint8_t m_guardianDeity; - uint8_t m_birthMonth; - uint8_t m_birthDay; - uint8_t m_class; - uint8_t m_classLevel; + uint8_t m_guardianDeity; + uint8_t m_birthMonth; + uint8_t m_birthDay; + uint8_t m_class; + uint8_t m_classLevel; - uint8_t m_voice; + uint8_t m_voice; - uint8_t m_tribe; + uint8_t m_tribe; - uint16_t m_zoneId; + uint16_t m_zoneId; - uint64_t m_modelMainWeapon; - uint64_t m_modelSubWeapon; - uint8_t m_equipDisplayFlags; + uint64_t m_modelMainWeapon; + uint64_t m_modelSubWeapon; + uint8_t m_equipDisplayFlags; - std::map< uint8_t, uint8_t > m_lookMap; - std::map< uint8_t, uint16_t > m_classMap; - uint8_t m_look[26]; + std::map< uint8_t, uint8_t > m_lookMap; + std::map< uint8_t, uint16_t > m_classMap; + uint8_t m_look[26]; + uint8_t m_gmRank; + bool m_gmInvis; - uint8_t m_gmRank; - bool m_gmInvis; + char m_name[34]; - char m_name[34]; - - void insertDbGlobalItem( uint32_t itemId, uint64_t uniqueId ) const; -}; + void insertDbGlobalItem( uint32_t itemId, uint64_t uniqueId ) const; + }; } #endif diff --git a/src/servers/sapphire_api/SapphireAPI.h b/src/servers/sapphire_api/SapphireAPI.h index e78dbe1a..be9df44c 100644 --- a/src/servers/sapphire_api/SapphireAPI.h +++ b/src/servers/sapphire_api/SapphireAPI.h @@ -7,47 +7,49 @@ #include #include "PlayerMinimal.h" -namespace Core { -class Session; - -namespace Network { - -class SapphireAPI +namespace Core { -public: - SapphireAPI(); - - ~SapphireAPI(); - - using SessionMap = std::map< std::string, std::shared_ptr< Session > >; - - bool login( const std::string& username, const std::string& pass, std::string& sId ); - - bool createAccount( const std::string& username, const std::string& pass, std::string& sId ); - - int32_t - createCharacter( const int& accountId, const std::string& name, const std::string& infoJson, const int& gmRank ); - - void deleteCharacter( std::string name, uint32_t accountId ); - - bool insertSession( const uint32_t& accountId, std::string& sId ); - - std::vector< Core::PlayerMinimal > getCharList( uint32_t accountId ); - - bool checkNameTaken( std::string name ); - - uint32_t getNextCharId(); - - uint64_t getNextContentId(); - - int32_t checkSession( const std::string& sId ); - - bool removeSession( const std::string& sId ); - - SessionMap m_sessionMap; - -}; + class Session; } + +namespace Core::Network +{ + + class SapphireAPI + { + public: + SapphireAPI(); + + ~SapphireAPI(); + + using SessionMap = std::map< std::string, std::shared_ptr< Session > >; + + bool login( const std::string& username, const std::string& pass, std::string& sId ); + + bool createAccount( const std::string& username, const std::string& pass, std::string& sId ); + + int32_t createCharacter( const int& accountId, const std::string& name, + const std::string& infoJson, const int& gmRank ); + + void deleteCharacter( std::string name, uint32_t accountId ); + + bool insertSession( const uint32_t& accountId, std::string& sId ); + + std::vector< Core::PlayerMinimal > getCharList( uint32_t accountId ); + + bool checkNameTaken( std::string name ); + + uint32_t getNextCharId(); + + uint64_t getNextContentId(); + + int32_t checkSession( const std::string& sId ); + + bool removeSession( const std::string& sId ); + + SessionMap m_sessionMap; + + }; } #endif diff --git a/src/servers/sapphire_api/Session.h b/src/servers/sapphire_api/Session.h index 58551c1a..66c44578 100644 --- a/src/servers/sapphire_api/Session.h +++ b/src/servers/sapphire_api/Session.h @@ -5,36 +5,35 @@ #include #include -namespace Core { - -class Session +namespace Core { -private: - uint32_t m_ip; - uint32_t m_accountId; + class Session + { - uint8_t m_sessionId[56]; + private: + uint32_t m_ip; + uint32_t m_accountId; + uint8_t m_sessionId[56]; -public: + public: + std::string newCharName; - std::string newCharName; + Session(); - Session(); + ~Session(); - ~Session(); + uint32_t getIp() const; - uint32_t getIp() const; + void setSessionId( uint8_t* sessionId ); - void setSessionId( uint8_t* sessionId ); + void setIp( uint32_t ip ); - void setIp( uint32_t ip ); + uint32_t getAccountId() const; - uint32_t getAccountId() const; + void setAccountId( uint32_t id ); - void setAccountId( uint32_t id ); - -}; + }; } diff --git a/src/servers/sapphire_api/client_http.hpp b/src/servers/sapphire_api/client_http.hpp index 7cc8cf53..5c4f4578 100644 --- a/src/servers/sapphire_api/client_http.hpp +++ b/src/servers/sapphire_api/client_http.hpp @@ -10,7 +10,8 @@ #include -namespace SimpleWeb { +namespace SimpleWeb +{ template class Client; diff --git a/src/servers/sapphire_lobby/Forwards.h b/src/servers/sapphire_lobby/Forwards.h index 71dd6c57..38fef5f3 100644 --- a/src/servers/sapphire_lobby/Forwards.h +++ b/src/servers/sapphire_lobby/Forwards.h @@ -12,27 +12,23 @@ x ## Ptr make_ ## x( Args &&...args ) { \ return std::make_shared< x >( std::forward< Args >( args ) ... ); }\ typedef std::vector< x > x ## PtrList; -namespace Core { -TYPE_FORWARD( LobbySession ); - -namespace Network { -TYPE_FORWARD( Hive ); - -TYPE_FORWARD( Acceptor ); - -TYPE_FORWARD( Connection ); - -TYPE_FORWARD( GameConnection ); - -namespace Packets { -TYPE_FORWARD( GamePacket ); - -TYPE_FORWARD( FFXIVPacketBase ); -} +namespace Core +{ + TYPE_FORWARD( LobbySession ); } - +namespace Core::Network +{ + TYPE_FORWARD( Hive ); + TYPE_FORWARD( Acceptor ); + TYPE_FORWARD( Connection ); + TYPE_FORWARD( GameConnection ); } +namespace Core::Network::Packets +{ + TYPE_FORWARD( GamePacket ); + TYPE_FORWARD( FFXIVPacketBase ); +} #endif diff --git a/src/servers/sapphire_lobby/GameConnection.cpp b/src/servers/sapphire_lobby/GameConnection.cpp index e143b3dc..c56850ce 100644 --- a/src/servers/sapphire_lobby/GameConnection.cpp +++ b/src/servers/sapphire_lobby/GameConnection.cpp @@ -253,14 +253,12 @@ bool Core::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW& session->setAccountID( 0 ); session->setSessionId( ( uint8_t* ) &packet.data[ 0 ] + 0x20 ); pSession = session; - g_log.Log( LoggingSeverity::info, - "Allowed connection with no session: " + std::string( ( char* ) &packet.data[ 0 ] + 0x20 ) ); + g_log.info( "Allowed connection with no session: " + std::string( ( char* ) &packet.data[ 0 ] + 0x20 ) ); } if( pSession != nullptr ) { - g_log.Log( LoggingSeverity::info, - "Found session linked to accountId: " + std::to_string( pSession->getAccountID() ) ); + g_log.info( "Found session linked to accountId: " + std::to_string( pSession->getAccountID() ) ); m_pSession = pSession; auto serviceIdInfoPacket = makeLobbyPacket< FFXIVIpcServiceIdInfo >( tmpId ); @@ -276,8 +274,7 @@ bool Core::Network::GameConnection::sendServiceAccountList( FFXIVARR_PACKET_RAW& } else { - g_log.Log( LoggingSeverity::info, - "Could not retrieve session: " + std::string( ( char* ) &packet.data[ 0 ] + 0x20 ) ); + g_log.info( "Could not retrieve session: " + std::string( ( char* ) &packet.data[ 0 ] + 0x20 ) ); sendError( 1, 5006, 13001, tmpId ); return true; @@ -302,7 +299,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac { name = std::string( ( char* ) &packet.data[ 0 ] + 0x2C ); - g_log.Log( LoggingSeverity::info, "[" + std::to_string( m_pSession->getAccountID() ) + "] Type 1: " + name ); + g_log.info( "[" + std::to_string( m_pSession->getAccountID() ) + "] Type 1: " + name ); Packets::LobbyPacketContainer pRP( m_encKey ); @@ -331,7 +328,7 @@ bool Core::Network::GameConnection::createOrModifyChar( FFXIVARR_PACKET_RAW& pac else if( type == 2 ) //Character creation finalize { std::string charDetails( ( char* ) &packet.data[ 0 ] + 0x4C ); - g_log.Log( LoggingSeverity::info, "[" + std::to_string( m_pSession->getAccountID() ) + "] Type 2: " + charDetails ); + g_log.info( "[" + std::to_string( m_pSession->getAccountID() ) + "] Type 2: " + charDetails ); if( g_restConnector.createCharacter( ( char* ) m_pSession->getSessionId(), m_pSession->newCharName, charDetails ) != -1 ) diff --git a/src/servers/sapphire_lobby/GameConnection.h b/src/servers/sapphire_lobby/GameConnection.h index 99313bb7..1778cb91 100644 --- a/src/servers/sapphire_lobby/GameConnection.h +++ b/src/servers/sapphire_lobby/GameConnection.h @@ -16,73 +16,71 @@ #define DECLARE_HANDLER( x ) void x( Packets::GamePacketPtr pInPacket, Entity::PlayerPtr pPlayer ) -namespace Core { -namespace Network { - -class GameConnection : public Connection +namespace Core::Network { -private: - // TODO move the next three params to the session, makes more sense there - // encryption key - uint8_t m_encKey[0x10]; + class GameConnection : public Connection + { - // base key, the encryption key is generated from this - uint8_t m_baseKey[0x2C]; + private: + // TODO move the next three params to the session, makes more sense there + // encryption key + uint8_t m_encKey[0x10]; - bool m_bEncryptionInitialized; + // base key, the encryption key is generated from this + uint8_t m_baseKey[0x2C]; - AcceptorPtr m_pAcceptor; + bool m_bEncryptionInitialized; - LobbySessionPtr m_pSession; + AcceptorPtr m_pAcceptor; - LockedQueue< Packets::GamePacketPtr > m_inQueue; - LockedQueue< Packets::GamePacketPtr > m_outQueue; + LobbySessionPtr m_pSession; -public: - GameConnection( HivePtr pHive, AcceptorPtr pAcceptor ); + LockedQueue< Packets::GamePacketPtr > m_inQueue; + LockedQueue< Packets::GamePacketPtr > m_outQueue; - ~GameConnection(); + public: + GameConnection( HivePtr pHive, AcceptorPtr pAcceptor ); - void generateEncryptionKey( uint32_t key, const std::string& keyPhrase ); + ~GameConnection(); - // overwrite the parents onConnect for our game socket needs - void OnAccept( const std::string& host, uint16_t port ) override; + void generateEncryptionKey( uint32_t key, const std::string& keyPhrase ); - void OnDisconnect() override; + // overwrite the parents onConnect for our game socket needs + void OnAccept( const std::string& host, uint16_t port ) override; - void OnRecv( std::vector< uint8_t >& buffer ) override; + void OnDisconnect() override; - void OnError( const asio::error_code& error ) override; + void OnRecv( std::vector< uint8_t >& buffer ) override; - void sendError( uint64_t sequence, uint32_t errorcode, uint16_t messageId, uint32_t tmpId ); + void OnError( const asio::error_code& error ) override; - void getCharList( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + void sendError( uint64_t sequence, uint32_t errorcode, uint16_t messageId, uint32_t tmpId ); - void enterWorld( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + void getCharList( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - bool sendServiceAccountList( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + void enterWorld( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - bool createOrModifyChar( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); + bool sendServiceAccountList( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - void handlePackets( const Packets::FFXIVARR_PACKET_HEADER& ipcHeader, - const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData ); + bool createOrModifyChar( Packets::FFXIVARR_PACKET_RAW& packet, uint32_t tmpId ); - void handleGamePacket( Packets::FFXIVARR_PACKET_RAW& pPacket ); + void handlePackets( const Packets::FFXIVARR_PACKET_HEADER& ipcHeader, + const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData ); - void handlePacket( Packets::FFXIVPacketBasePtr pPacket ); + void handleGamePacket( Packets::FFXIVARR_PACKET_RAW& pPacket ); - void sendPackets( Packets::PacketContainer* pPacket ); + void handlePacket( Packets::FFXIVPacketBasePtr pPacket ); - void sendPacket( Packets::LobbyPacketContainer& pLpc ); + void sendPackets( Packets::PacketContainer* pPacket ); - void sendSinglePacket( Packets::FFXIVPacketBasePtr pPacket ); + void sendPacket( Packets::LobbyPacketContainer& pLpc ); + + void sendSinglePacket( Packets::FFXIVPacketBasePtr pPacket ); -}; + }; - -} } diff --git a/src/servers/sapphire_lobby/LobbyPacketContainer.h b/src/servers/sapphire_lobby/LobbyPacketContainer.h index 5cef66de..45bd2fee 100644 --- a/src/servers/sapphire_lobby/LobbyPacketContainer.h +++ b/src/servers/sapphire_lobby/LobbyPacketContainer.h @@ -9,37 +9,34 @@ #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { - -typedef std::shared_ptr< FFXIVPacketBase > FFXIVPacketBasePtr; - -class LobbyPacketContainer +namespace Core::Network::Packets { -public: - LobbyPacketContainer( uint8_t* encKey = nullptr ); - ~LobbyPacketContainer(); + using FFXIVPacketBasePtr = std::shared_ptr< FFXIVPacketBase >; - void addPacket( FFXIVPacketBasePtr pEntry ); + class LobbyPacketContainer + { + public: + LobbyPacketContainer( uint8_t* encKey = nullptr ); - uint16_t getSize() const; + ~LobbyPacketContainer(); - uint8_t* getRawData( bool addstuff = true ); + void addPacket( FFXIVPacketBasePtr pEntry ); -private: - Core::Network::Packets::FFXIVARR_PACKET_HEADER m_header; + uint16_t getSize() const; - uint8_t* m_encKey; + uint8_t* getRawData( bool addstuff = true ); - std::vector< FFXIVPacketBasePtr > m_entryList; + private: + Core::Network::Packets::FFXIVARR_PACKET_HEADER m_header; - uint8_t m_dataBuf[0x2000]; + uint8_t* m_encKey; -}; + std::vector< FFXIVPacketBasePtr > m_entryList; + + uint8_t m_dataBuf[0x2000]; + + }; -} -} } #endif diff --git a/src/servers/sapphire_lobby/LobbySession.h b/src/servers/sapphire_lobby/LobbySession.h index 96bd84a1..43226269 100644 --- a/src/servers/sapphire_lobby/LobbySession.h +++ b/src/servers/sapphire_lobby/LobbySession.h @@ -7,56 +7,55 @@ #include #include -namespace Core { - -class LobbySession +namespace Core { -private: - uint32_t m_IP; - uint32_t m_accountID; - - uint8_t m_sessionId[56]; - -public: - - std::string newCharName; - - LobbySession( void ); - - ~LobbySession( void ); - - uint32_t getIP() + class LobbySession { - return m_IP; - } - uint8_t* getSessionId() - { - return m_sessionId; - } + private: + uint32_t m_IP; + uint32_t m_accountID; + uint8_t m_sessionId[56]; - void setSessionId( uint8_t* sessionId ) - { - memcpy( m_sessionId, sessionId, 56 ); - } + public: + std::string newCharName; - void setIP( uint32_t iP ) - { - m_IP = iP; - } + LobbySession( void ); - uint32_t getAccountID() - { - return m_accountID; - } + ~LobbySession( void ); - void setAccountID( uint32_t iD ) - { - m_accountID = iD; - } + uint32_t getIP() + { + return m_IP; + } -}; + uint8_t* getSessionId() + { + return m_sessionId; + } + + void setSessionId( uint8_t* sessionId ) + { + memcpy( m_sessionId, sessionId, 56 ); + } + + void setIP( uint32_t iP ) + { + m_IP = iP; + } + + uint32_t getAccountID() + { + return m_accountID; + } + + void setAccountID( uint32_t iD ) + { + m_accountID = iD; + } + + }; } diff --git a/src/servers/sapphire_lobby/RestConnector.h b/src/servers/sapphire_lobby/RestConnector.h index 9ff29c47..e56bdd32 100644 --- a/src/servers/sapphire_lobby/RestConnector.h +++ b/src/servers/sapphire_lobby/RestConnector.h @@ -7,43 +7,45 @@ #include "client_http.hpp" #include "Forwards.h" -typedef SimpleWeb::Client< SimpleWeb::HTTP > HttpClient; -typedef std::shared_ptr< SimpleWeb::ClientBase< SimpleWeb::HTTP >::Response > HttpResponse; +using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >; +using HttpResponse = std::shared_ptr< SimpleWeb::ClientBase< SimpleWeb::HTTP >::Response >; -namespace Core { -class Session; - -namespace Network { -class LobbySession; - -class RestConnector +namespace Core { -public: - RestConnector(); - - ~RestConnector(); - - HttpResponse requestApi( std::string endpoint, std::string data ); - - LobbySessionPtr getSession( char* sId ); - - int32_t createCharacter( char* sId, std::string name, std::string infoJson ); - - std::vector< std::tuple< std::string, uint32_t, uint64_t, std::string>> getCharList( char* sId ); - - bool deleteCharacter( char* sId, std::string name ); - - bool checkNameTaken( std::string name ); - - uint32_t getNextCharId(); - - uint64_t getNextContentId(); - - std::string serverSecret; - std::string restHost; - -}; + class Session; } + +namespace Core::Network +{ + class LobbySession; + + class RestConnector + { + public: + RestConnector(); + + ~RestConnector(); + + HttpResponse requestApi( std::string endpoint, std::string data ); + + LobbySessionPtr getSession( char* sId ); + + int32_t createCharacter( char* sId, std::string name, std::string infoJson ); + + std::vector< std::tuple< std::string, uint32_t, uint64_t, std::string>> getCharList( char* sId ); + + bool deleteCharacter( char* sId, std::string name ); + + bool checkNameTaken( std::string name ); + + uint32_t getNextCharId(); + + uint64_t getNextContentId(); + + std::string serverSecret; + std::string restHost; + + }; } #endif diff --git a/src/servers/sapphire_lobby/ServerLobby.h b/src/servers/sapphire_lobby/ServerLobby.h index 8ce10759..f927fc78 100644 --- a/src/servers/sapphire_lobby/ServerLobby.h +++ b/src/servers/sapphire_lobby/ServerLobby.h @@ -1,7 +1,5 @@ -#pragma once - -#ifndef _CSERVERLOBBY_H_ -#define _CSERVERLOBBY_H_ +#ifndef _SERVERLOBBY_H_ +#define _SERVERLOBBY_H_ #include #include @@ -10,50 +8,49 @@ const std::string LOBBY_VERSION = "0.0.5"; -namespace Core { -class LobbySession; - -class ConfigMgr; - -typedef std::map< std::string, LobbySessionPtr > LobbySessionMap; - -class ServerLobby +namespace Core { + class LobbySession; + class ConfigMgr; - friend class LobbyConnection; + using LobbySessionMap = std::map< std::string, LobbySessionPtr >; -private: - - LobbySessionMap m_sessionMap; - std::string m_configPath; - - uint16_t m_port; - std::string m_ip; - - std::shared_ptr< ConfigMgr > m_pConfig; - -public: - ServerLobby( const std::string& configPath ); - - ~ServerLobby( void ); - - void run( int32_t argc, char* argv[] ); - - bool loadSettings( int32_t argc, char* argv[] ); - - void addSession( char* sessionId, LobbySessionPtr pSession ) + class ServerLobby { - m_sessionMap[ std::string( sessionId ) ] = pSession; - } - std::shared_ptr< ConfigMgr > getConfig() const; + friend class LobbyConnection; - LobbySessionPtr getSession( char* sessionId ); + private: - uint32_t m_numConnections; + LobbySessionMap m_sessionMap; + std::string m_configPath; -}; + uint16_t m_port; + std::string m_ip; + std::shared_ptr< ConfigMgr > m_pConfig; + + public: + ServerLobby( const std::string& configPath ); + + ~ServerLobby( void ); + + void run( int32_t argc, char* argv[] ); + + bool loadSettings( int32_t argc, char* argv[] ); + + void addSession( char* sessionId, LobbySessionPtr pSession ) + { + m_sessionMap[ std::string( sessionId ) ] = pSession; + } + + std::shared_ptr< ConfigMgr > getConfig() const; + + LobbySessionPtr getSession( char* sessionId ); + + uint32_t m_numConnections; + + }; } diff --git a/src/servers/sapphire_zone/Action/Action.h b/src/servers/sapphire_zone/Action/Action.h index 436d3d48..1c559507 100644 --- a/src/servers/sapphire_zone/Action/Action.h +++ b/src/servers/sapphire_zone/Action/Action.h @@ -4,67 +4,65 @@ #include #include "ForwardsZone.h" -namespace Core { -namespace Action { - -class Action +namespace Core::Action { -public: - Action(); - - virtual ~Action(); - - uint16_t getId() const; - - Common::HandleActionType getHandleActionType() const; - - Entity::CharaPtr getTargetChara() const; - - bool isInterrupted() const; - - void setInterrupted(); - - uint64_t getStartTime() const; - - void setStartTime( uint64_t startTime ); - - uint32_t getCastTime() const; - - void setCastTime( uint32_t castTime ); - - Entity::CharaPtr getActionSource() const; - - virtual void onStart() + class Action { + + public: + Action(); + + virtual ~Action(); + + uint16_t getId() const; + + Common::HandleActionType getHandleActionType() const; + + Entity::CharaPtr getTargetChara() const; + + bool isInterrupted() const; + + void setInterrupted(); + + uint64_t getStartTime() const; + + void setStartTime( uint64_t startTime ); + + uint32_t getCastTime() const; + + void setCastTime( uint32_t castTime ); + + Entity::CharaPtr getActionSource() const; + + virtual void onStart() + { + }; + + virtual void onFinish() + { + }; + + virtual void onInterrupt() + { + }; + + // update action, if returns true, action is done and has to be removed from the actor + virtual bool update(); + + protected: + uint16_t m_id; + Common::HandleActionType m_handleActionType; + + uint64_t m_startTime; + uint32_t m_castTime; + + Entity::CharaPtr m_pSource; + Entity::CharaPtr m_pTarget; + + bool m_bInterrupt; + }; - - virtual void onFinish() - { - }; - - virtual void onInterrupt() - { - }; - - // update action, if returns true, action is done and has to be removed from the actor - virtual bool update(); - -protected: - uint16_t m_id; - Common::HandleActionType m_handleActionType; - - uint64_t m_startTime; - uint32_t m_castTime; - - Entity::CharaPtr m_pSource; - Entity::CharaPtr m_pTarget; - - bool m_bInterrupt; - -}; - -} } #endif diff --git a/src/servers/sapphire_zone/Action/ActionCast.h b/src/servers/sapphire_zone/Action/ActionCast.h index 4bb8cb54..3ec9ce01 100644 --- a/src/servers/sapphire_zone/Action/ActionCast.h +++ b/src/servers/sapphire_zone/Action/ActionCast.h @@ -4,30 +4,28 @@ #include "ForwardsZone.h" #include "Action.h" -namespace Core { -namespace Action { - -class ActionCast : - public Action +namespace Core::Action { -private: -public: - ActionCast(); + class ActionCast : public Action + { + private: - ~ActionCast(); + public: + ActionCast(); - ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId ); + ~ActionCast(); - void onStart() override; + ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId ); - void onFinish() override; + void onStart() override; - void onInterrupt() override; + void onFinish() override; -}; + void onInterrupt() override; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Action/ActionCollision.h b/src/servers/sapphire_zone/Action/ActionCollision.h index 1232b58f..f16f9be2 100644 --- a/src/servers/sapphire_zone/Action/ActionCollision.h +++ b/src/servers/sapphire_zone/Action/ActionCollision.h @@ -4,43 +4,43 @@ #include #include "ForwardsZone.h" -namespace Core { -namespace Data { -struct Action; +namespace Core::Data +{ + struct Action; } -namespace Entity { - -enum class TargetFilter +namespace Core::Entity { - All, // All actors in the AoE are applicable for collision - Players, // Only players - Allies, // Only allies (players, ally NPCs) - Party, // Only party members - Enemies // Only enemies -}; -class ActionCollision -{ -public: + enum class TargetFilter + { + All, // All actors in the AoE are applicable for collision + Players, // Only players + Allies, // Only allies (players, ally NPCs) + Party, // Only party members + Enemies // Only enemies + }; - static bool isActorApplicable( Actor& actor, TargetFilter targetFilter ); + class ActionCollision + { + public: - static std::set< ActorPtr > getActorsHitFromAction( Common::FFXIVARR_POSITION3 aoePosition, - std::set< ActorPtr > actorsInRange, - std::shared_ptr< Data::Action > actionInfo, - TargetFilter targetFilter ); + static bool isActorApplicable( Actor& actor, TargetFilter targetFilter ); -private: - static bool radiusCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition, - uint16_t radius ); + static std::set< ActorPtr > getActorsHitFromAction( Common::FFXIVARR_POSITION3 aoePosition, + std::set< ActorPtr > actorsInRange, + std::shared_ptr< Data::Action > actionInfo, + TargetFilter targetFilter ); - static bool boxCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition, - uint16_t width, uint16_t height ); + private: + static bool radiusCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition, + uint16_t radius ); -}; + static bool boxCollision( Common::FFXIVARR_POSITION3 actorPosition, Common::FFXIVARR_POSITION3 aoePosition, + uint16_t width, uint16_t height ); + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Action/ActionMount.h b/src/servers/sapphire_zone/Action/ActionMount.h index 0c08eb61..689832ce 100644 --- a/src/servers/sapphire_zone/Action/ActionMount.h +++ b/src/servers/sapphire_zone/Action/ActionMount.h @@ -4,30 +4,28 @@ #include "ForwardsZone.h" #include "Action.h" -namespace Core { -namespace Action { - -class ActionMount : - public Action +namespace Core::Action { -private: -public: - ActionMount(); + class ActionMount : public Action + { + private: - ~ActionMount(); + public: + ActionMount(); - ActionMount( Entity::CharaPtr pActor, uint16_t mountId ); + ~ActionMount(); - void onStart() override; + ActionMount( Entity::CharaPtr pActor, uint16_t mountId ); - void onFinish() override; + void onStart() override; - void onInterrupt() override; + void onFinish() override; -}; + void onInterrupt() override; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Action/ActionTeleport.h b/src/servers/sapphire_zone/Action/ActionTeleport.h index 7ec04265..21c9fb7b 100644 --- a/src/servers/sapphire_zone/Action/ActionTeleport.h +++ b/src/servers/sapphire_zone/Action/ActionTeleport.h @@ -4,32 +4,30 @@ #include "ForwardsZone.h" #include "Action.h" -namespace Core { -namespace Action { - -class ActionTeleport : - public Action +namespace Core::Action { -private: - uint16_t m_targetAetheryte; - uint16_t m_cost; -public: - ActionTeleport(); + class ActionTeleport : public Action + { + private: + uint16_t m_targetAetheryte; + uint16_t m_cost; - ~ActionTeleport(); + public: + ActionTeleport(); - ActionTeleport( Entity::CharaPtr pActor, uint16_t action, uint16_t cost ); + ~ActionTeleport(); - void onStart() override; + ActionTeleport( Entity::CharaPtr pActor, uint16_t action, uint16_t cost ); - void onFinish() override; + void onStart() override; - void onInterrupt() override; + void onFinish() override; -}; + void onInterrupt() override; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Action/EventAction.h b/src/servers/sapphire_zone/Action/EventAction.h index f7822d27..728231d0 100644 --- a/src/servers/sapphire_zone/Action/EventAction.h +++ b/src/servers/sapphire_zone/Action/EventAction.h @@ -6,37 +6,35 @@ #include "ForwardsZone.h" #include "Action.h" -namespace Core { -namespace Action { - -class EventAction : - public Action +namespace Core::Action { -public: - EventAction(); + class EventAction : public Action + { - ~EventAction(); + public: + EventAction(); - EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action, - ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional ); + ~EventAction(); - void onStart() override; + EventAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action, + ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional ); - void onFinish() override; + void onStart() override; - void onInterrupt() override; + void onFinish() override; -private: - uint32_t m_eventId; - uint64_t m_additional; + void onInterrupt() override; - ActionCallback m_onActionFinishClb; - ActionCallback m_onActionInterruptClb; + private: + uint32_t m_eventId; + uint64_t m_additional; -}; + ActionCallback m_onActionFinishClb; + ActionCallback m_onActionInterruptClb; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Action/EventItemAction.h b/src/servers/sapphire_zone/Action/EventItemAction.h index faf01ac3..cdf29aca 100644 --- a/src/servers/sapphire_zone/Action/EventItemAction.h +++ b/src/servers/sapphire_zone/Action/EventItemAction.h @@ -4,36 +4,35 @@ #include "ForwardsZone.h" #include "Action.h" -namespace Core { -namespace Action { - -class EventItemAction : public Action +namespace Core::Action { -public: - EventItemAction(); + class EventItemAction : public Action + { - ~EventItemAction(); + public: + EventItemAction(); - EventItemAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action, - ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional ); + ~EventItemAction(); - void onStart() override; + EventItemAction( Entity::CharaPtr pActor, uint32_t eventId, uint16_t action, + ActionCallback finishRef, ActionCallback interruptRef, uint64_t additional ); - void onFinish() override; + void onStart() override; - void onInterrupt() override; + void onFinish() override; -private: - uint32_t m_eventId; - uint64_t m_additional; + void onInterrupt() override; - ActionCallback m_onActionFinishClb; - ActionCallback m_onActionInterruptClb; + private: + uint32_t m_eventId; + uint64_t m_additional; -}; + ActionCallback m_onActionFinishClb; + ActionCallback m_onActionInterruptClb; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Actor/Actor.h b/src/servers/sapphire_zone/Actor/Actor.h index fcc47a7b..c5f3eb5a 100644 --- a/src/servers/sapphire_zone/Actor/Actor.h +++ b/src/servers/sapphire_zone/Actor/Actor.h @@ -9,132 +9,131 @@ #include #include -namespace Core { -namespace Entity { - -/*! -\class GameObject -\brief Base class for all actor/objects - -*/ -class Actor : public std::enable_shared_from_this< Actor > +namespace Core::Entity { -protected: - /*! Position of the object */ - Common::FFXIVARR_POSITION3 m_pos; - /*! Rotation of the object */ - float m_rot; - /*! Id of the actor */ - uint32_t m_id; - /*! Type of the actor */ - Common::ObjKind m_objKind; - /*! Id of the zone the actor currently is in */ - uint32_t m_zoneId; - /*! Ptr to the ZoneObj the actor belongs to */ - ZonePtr m_pCurrentZone; + /*! + \class GameObject + \brief Base class for all actor/objects - /*! list of various actors in range */ - std::set< ActorPtr > m_inRangeActor; - std::set< PlayerPtr > m_inRangePlayers; - std::set< BNpcPtr > m_inRangeBNpc; + */ + class Actor : public std::enable_shared_from_this< Actor > + { - /*! Parent cell in the zone */ - Core::Cell* m_pCell; + protected: + /*! Position of the object */ + Common::FFXIVARR_POSITION3 m_pos; + /*! Rotation of the object */ + float m_rot; + /*! Id of the actor */ + uint32_t m_id; + /*! Type of the actor */ + Common::ObjKind m_objKind; + /*! Id of the zone the actor currently is in */ + uint32_t m_zoneId; + /*! Ptr to the ZoneObj the actor belongs to */ + ZonePtr m_pCurrentZone; -public: - explicit Actor( Common::ObjKind type ); + /*! list of various actors in range */ + std::set< ActorPtr > m_inRangeActor; + std::set< PlayerPtr > m_inRangePlayers; + std::set< BNpcPtr > m_inRangeBNpc; - virtual ~Actor() {}; + /*! Parent cell in the zone */ + Core::Cell* m_pCell; - virtual void spawn( PlayerPtr pTarget ) {} + public: + explicit Actor( Common::ObjKind type ); - virtual void despawn( PlayerPtr pTarget ) {} + virtual ~Actor() {}; - uint32_t getId() const; + virtual void spawn( PlayerPtr pTarget ) {} - void setId( uint32_t id ); + virtual void despawn( PlayerPtr pTarget ) {} - Common::ObjKind getObjKind() const; + uint32_t getId() const; - Common::FFXIVARR_POSITION3& getPos(); + void setId( uint32_t id ); - void setPos( const Common::FFXIVARR_POSITION3& pos ); + Common::ObjKind getObjKind() const; - void setPos( float x, float y, float z ); + Common::FFXIVARR_POSITION3& getPos(); - float getRot() const; + void setPos( const Common::FFXIVARR_POSITION3& pos ); - void setRot( float rot ); + void setPos( float x, float y, float z ); - bool isChara() const; + float getRot() const; - bool isPlayer() const; + void setRot( float rot ); - bool isEventNpc() const; + bool isChara() const; - bool isBattleNpc() const; + bool isPlayer() const; - bool isRetainer() const; + bool isEventNpc() const; - bool isCompanion() const; + bool isBattleNpc() const; - bool isEventObj() const; + bool isRetainer() const; - bool isHousingEventObj() const; + bool isCompanion() const; - bool isAetheryte() const; + bool isEventObj() const; - ///// IN RANGE LOGIC /////////////////////////////// - virtual void onRemoveInRangeActor( Actor& pActor ) {} + bool isHousingEventObj() const; - // check if another actor is in the actors in range set - bool isInRangeSet( ActorPtr pActor ) const; + bool isAetheryte() const; - ActorPtr getClosestActor(); + ///// IN RANGE LOGIC /////////////////////////////// + virtual void onRemoveInRangeActor( Actor& pActor ) {} - void sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf = false ); + // check if another actor is in the actors in range set + bool isInRangeSet( ActorPtr pActor ) const; - // add an actor to in range set - void addInRangeActor( ActorPtr pActor ); + ActorPtr getClosestActor(); - // remove an actor from the in range set - void removeInRangeActor( Actor& actor ); + void sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf = false ); - // return true if there is at least one actor in the in range set - bool hasInRangeActor() const; + // add an actor to in range set + void addInRangeActor( ActorPtr pActor ); - void removeFromInRange(); + // remove an actor from the in range set + void removeInRangeActor( Actor& actor ); - // clear the whole in range set, this does no cleanup - virtual void clearInRangeSet(); + // return true if there is at least one actor in the in range set + bool hasInRangeActor() const; - std::set< ActorPtr > getInRangeActors( bool includeSelf = false ); + void removeFromInRange(); - //////////////////////////////////////////////////// + // clear the whole in range set, this does no cleanup + virtual void clearInRangeSet(); - CharaPtr getAsChara(); + std::set< ActorPtr > getInRangeActors( bool includeSelf = false ); - PlayerPtr getAsPlayer(); + //////////////////////////////////////////////////// - EventObjectPtr getAsEventObj(); + CharaPtr getAsChara(); - BNpcPtr getAsBNpc(); + PlayerPtr getAsPlayer(); - ZonePtr getCurrentZone() const; + EventObjectPtr getAsEventObj(); - void setCurrentZone( ZonePtr currZone ); + BNpcPtr getAsBNpc(); - InstanceContentPtr getCurrentInstance() const; + ZonePtr getCurrentZone() const; - // get the current cell of a region the actor is in - Cell* getCellPtr(); + void setCurrentZone( ZonePtr currZone ); - // set the current cell - void setCell( Cell* pCell ); + InstanceContentPtr getCurrentInstance() const; -}; + // get the current cell of a region the actor is in + Cell* getCellPtr(); + + // set the current cell + void setCell( Cell* pCell ); + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Actor/BNpc.h b/src/servers/sapphire_zone/Actor/BNpc.h index e670f21f..674a4313 100644 --- a/src/servers/sapphire_zone/Actor/BNpc.h +++ b/src/servers/sapphire_zone/Actor/BNpc.h @@ -10,53 +10,52 @@ #include #include -namespace Core { -namespace Entity { - -/*! -\class BNpc -\brief Base class for all BNpcs - -*/ -class BNpc : public Npc +namespace Core::Entity { -public: - BNpc(); - BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level ); + /*! + \class BNpc + \brief Base class for all BNpcs - virtual ~BNpc() override; + */ + class BNpc : public Npc + { - void spawn( PlayerPtr pTarget ) override; + public: + BNpc(); + BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level ); - uint16_t getModelChara() const; - uint8_t getLevel() const override; + virtual ~BNpc() override; - uint32_t getBNpcBaseId() const; - uint32_t getBNpcNameId() const; + void spawn( PlayerPtr pTarget ) override; - uint8_t getEnemyType() const; + uint16_t getModelChara() const; + uint8_t getLevel() const override; - uint64_t getWeaponMain() const; - uint64_t getWeaponSub() const; + uint32_t getBNpcBaseId() const; + uint32_t getBNpcNameId() const; - uint8_t getAggressionMode() const; + uint8_t getEnemyType() const; -private: - uint32_t m_bNpcBaseId; - uint32_t m_bNpcNameId; - uint64_t m_weaponMain; - uint64_t m_weaponSub; - uint8_t m_aggressionMode; - uint8_t m_enemyType; - uint8_t m_onlineStatus; - uint8_t m_pose; - uint16_t m_modelChara; - uint32_t m_displayFlags; - uint8_t m_level; + uint64_t getWeaponMain() const; + uint64_t getWeaponSub() const; -}; + uint8_t getAggressionMode() const; + + private: + uint32_t m_bNpcBaseId; + uint32_t m_bNpcNameId; + uint64_t m_weaponMain; + uint64_t m_weaponSub; + uint8_t m_aggressionMode; + uint8_t m_enemyType; + uint8_t m_onlineStatus; + uint8_t m_pose; + uint16_t m_modelChara; + uint32_t m_displayFlags; + uint8_t m_level; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Actor/BNpcTemplate.h b/src/servers/sapphire_zone/Actor/BNpcTemplate.h index 9bf024db..b8558a3c 100644 --- a/src/servers/sapphire_zone/Actor/BNpcTemplate.h +++ b/src/servers/sapphire_zone/Actor/BNpcTemplate.h @@ -3,89 +3,87 @@ #include -namespace Core { -namespace Entity { - - -class BNpcTemplate +namespace Core::Entity { -private: - uint32_t m_id; - uint32_t m_bNpcBaseId; - uint32_t m_bNpcNameId; - uint64_t m_weaponMain; - uint64_t m_weaponSub; - uint8_t m_aggressionMode; - uint8_t m_enemyType; - uint8_t m_onlineStatus; - uint8_t m_pose; - uint16_t m_modelChara; - uint32_t m_displayFlags; - uint32_t m_modelEquip[10]; - uint8_t m_customize[26]; + class BNpcTemplate + { -public: - BNpcTemplate() {}; + private: + uint32_t m_id; + uint32_t m_bNpcBaseId; + uint32_t m_bNpcNameId; + uint64_t m_weaponMain; + uint64_t m_weaponSub; + uint8_t m_aggressionMode; + uint8_t m_enemyType; + uint8_t m_onlineStatus; + uint8_t m_pose; + uint16_t m_modelChara; + uint32_t m_displayFlags; + uint32_t m_modelEquip[10]; + uint8_t m_customize[26]; - BNpcTemplate( uint32_t id, uint32_t baseId, uint32_t nameId, uint64_t weaponMain, uint64_t weaponSub, uint8_t aggressionMode, - uint8_t enemyType, uint8_t onlineStatus, uint8_t pose, uint16_t modelChara, - uint32_t displayFlags = 0, - uint32_t* modelEquip = nullptr, uint8_t* customize = nullptr ); + public: + BNpcTemplate() {}; - virtual ~BNpcTemplate(); + BNpcTemplate( uint32_t id, uint32_t baseId, uint32_t nameId, uint64_t weaponMain, uint64_t weaponSub, uint8_t aggressionMode, + uint8_t enemyType, uint8_t onlineStatus, uint8_t pose, uint16_t modelChara, + uint32_t displayFlags = 0, + uint32_t* modelEquip = nullptr, uint8_t* customize = nullptr ); - uint32_t getId() const; + virtual ~BNpcTemplate(); - void setId( uint32_t id ); + uint32_t getId() const; - uint32_t getBNpcBaseId() const; + void setId( uint32_t id ); - void setBNpcBaseId( uint32_t bNpcBaseId ); + uint32_t getBNpcBaseId() const; - uint32_t getBNpcNameId() const; + void setBNpcBaseId( uint32_t bNpcBaseId ); - void setBNpcNameId( uint32_t bNpcNameId ); + uint32_t getBNpcNameId() const; - uint64_t getWeaponMain() const; + void setBNpcNameId( uint32_t bNpcNameId ); - void setWeaponMain( uint64_t weaponMain ); + uint64_t getWeaponMain() const; - uint64_t getWeaponSub() const; + void setWeaponMain( uint64_t weaponMain ); - void setWeaponSub( uint64_t weaponSub ); + uint64_t getWeaponSub() const; - uint8_t getAggressionMode() const; + void setWeaponSub( uint64_t weaponSub ); - void setAggressionMode( uint8_t aggressionMode ); + uint8_t getAggressionMode() const; - uint8_t getEnemyType() const; + void setAggressionMode( uint8_t aggressionMode ); - void setEnemyType( uint8_t enemyType ); + uint8_t getEnemyType() const; - uint8_t getOnlineStatus() const; + void setEnemyType( uint8_t enemyType ); - void setOnlineStatus( uint8_t m_onlineStatus ); + uint8_t getOnlineStatus() const; - uint8_t getPose() const; + void setOnlineStatus( uint8_t m_onlineStatus ); - void setPose( uint8_t m_pose ); + uint8_t getPose() const; - uint16_t getModelChara() const; + void setPose( uint8_t m_pose ); - void setModelChara( uint16_t modelChara ); + uint16_t getModelChara() const; - uint32_t getDisplayFlags() const; + void setModelChara( uint16_t modelChara ); - void setDisplayFlags( uint32_t displayFlags ); + uint32_t getDisplayFlags() const; - const uint32_t* getModelEquip() const; + void setDisplayFlags( uint32_t displayFlags ); - const uint8_t* getCustomize() const; -}; + const uint32_t* getModelEquip() const; + + const uint8_t* getCustomize() const; + }; -} } #endif //SAPPHIRE_BNPCTEMPLATE_H diff --git a/src/servers/sapphire_zone/Actor/Chara.h b/src/servers/sapphire_zone/Actor/Chara.h index 7f6ab960..c07c7758 100644 --- a/src/servers/sapphire_zone/Actor/Chara.h +++ b/src/servers/sapphire_zone/Actor/Chara.h @@ -9,241 +9,240 @@ #include #include -namespace Core { -namespace Entity { - -/*! -\class Chara -\brief Base class for all animate actors - -*/ -class Chara : public Actor +namespace Core::Entity { -public: - struct ActorStats + + /*! + \class Chara + \brief Base class for all animate actors + + */ + class Chara : public Actor { - uint32_t max_mp = 0; - uint32_t max_hp = 0; - - uint32_t str = 0; - uint32_t dex = 0; - uint32_t vit = 0; - uint32_t inte = 0; - uint32_t mnd = 0; - uint32_t pie = 0; - - uint32_t tenacity = 0; - uint32_t attack = 0; - uint32_t defense = 0; - uint32_t accuracy = 0; - uint32_t spellSpeed = 0; - uint32_t magicDefense = 0; - uint32_t critHitRate = 0; - uint32_t resistSlash = 0; - uint32_t resistPierce = 0; - uint32_t resistBlunt = 0; - uint32_t attackPotMagic = 0; - uint32_t healingPotMagic = 0; - uint32_t determination = 0; - uint32_t skillSpeed = 0; - - uint32_t resistSlow = 0; - uint32_t resistSilence = 0; - uint32_t resistBlind = 0; - uint32_t resistPoison = 0; - uint32_t resistStun = 0; - uint32_t resistSleep = 0; - uint32_t resistBind = 0; - uint32_t resistHeavy = 0; - - uint32_t resistFire = 0; - uint32_t resistIce = 0; - uint32_t resistWind = 0; - uint32_t resistEarth = 0; - uint32_t resistLightning = 0; - uint32_t resistWater = 0; - - } m_baseStats; - -protected: - char m_name[34]; - /*! Last tick time for the actor ( in ms ) */ - uint64_t m_lastTickTime; - /*! Last time the actor performed an autoAttack ( in ms ) */ - uint64_t m_lastAttack; - /*! Last time the actor was updated ( in ms ) */ - uint64_t m_lastUpdate; - /*! Current stance of the actor */ - Common::Stance m_currentStance; - /*! Current staus of the actor */ - Common::ActorStatus m_status; - /*! Max HP of the actor ( based on job / class ) */ - uint32_t m_maxHp; - /*! Max MP of the actor ( based on job / class ) */ - uint32_t m_maxMp; - /*! Current HP of the actor */ - uint32_t m_hp; - /*! Current MP of the actor */ - uint32_t m_mp; - /*! Current TP of the actor */ - uint16_t m_tp; - /*! Current GP of the actor */ - uint16_t m_gp; - /*! Additional look info of the actor */ - uint8_t m_customize[26]; - /*! Additional model info */ - uint32_t m_modelEquip[10]; - /*! Current class of the actor */ - Common::ClassJob m_class; - /*! Id of the currently selected target actor */ - uint64_t m_targetId; - /*! Ptr to a queued action */ - Action::ActionPtr m_pCurrentAction; - /*! Invincibility type */ - Common::InvincibilityType m_invincibilityType; + public: + struct ActorStats + { + uint32_t max_mp = 0; + uint32_t max_hp = 0; + + uint32_t str = 0; + uint32_t dex = 0; + uint32_t vit = 0; + uint32_t inte = 0; + uint32_t mnd = 0; + uint32_t pie = 0; + + uint32_t tenacity = 0; + uint32_t attack = 0; + uint32_t defense = 0; + uint32_t accuracy = 0; + uint32_t spellSpeed = 0; + uint32_t magicDefense = 0; + uint32_t critHitRate = 0; + uint32_t resistSlash = 0; + uint32_t resistPierce = 0; + uint32_t resistBlunt = 0; + uint32_t attackPotMagic = 0; + uint32_t healingPotMagic = 0; + uint32_t determination = 0; + uint32_t skillSpeed = 0; + + uint32_t resistSlow = 0; + uint32_t resistSilence = 0; + uint32_t resistBlind = 0; + uint32_t resistPoison = 0; + uint32_t resistStun = 0; + uint32_t resistSleep = 0; + uint32_t resistBind = 0; + uint32_t resistHeavy = 0; + + uint32_t resistFire = 0; + uint32_t resistIce = 0; + uint32_t resistWind = 0; + uint32_t resistEarth = 0; + uint32_t resistLightning = 0; + uint32_t resistWater = 0; + + } m_baseStats; + + protected: + char m_name[34]; + /*! Last tick time for the actor ( in ms ) */ + uint64_t m_lastTickTime; + /*! Last time the actor performed an autoAttack ( in ms ) */ + uint64_t m_lastAttack; + /*! Last time the actor was updated ( in ms ) */ + uint64_t m_lastUpdate; + /*! Current stance of the actor */ + Common::Stance m_currentStance; + /*! Current staus of the actor */ + Common::ActorStatus m_status; + /*! Max HP of the actor ( based on job / class ) */ + uint32_t m_maxHp; + /*! Max MP of the actor ( based on job / class ) */ + uint32_t m_maxMp; + /*! Current HP of the actor */ + uint32_t m_hp; + /*! Current MP of the actor */ + uint32_t m_mp; + /*! Current TP of the actor */ + uint16_t m_tp; + /*! Current GP of the actor */ + uint16_t m_gp; + /*! Additional look info of the actor */ + uint8_t m_customize[26]; + /*! Additional model info */ + uint32_t m_modelEquip[10]; + /*! Current class of the actor */ + Common::ClassJob m_class; + /*! Id of the currently selected target actor */ + uint64_t m_targetId; + /*! Ptr to a queued action */ + Action::ActionPtr m_pCurrentAction; + /*! Invincibility type */ + Common::InvincibilityType m_invincibilityType; - uint8_t m_pose; + uint8_t m_pose; - /*! Status effects */ - const uint8_t MAX_STATUS_EFFECTS = 30; - std::queue< uint8_t > m_statusEffectFreeSlotQueue; - std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList; - std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap; + /*! Status effects */ + const uint8_t MAX_STATUS_EFFECTS = 30; + std::queue< uint8_t > m_statusEffectFreeSlotQueue; + std::vector< std::pair< uint8_t, uint32_t > > m_statusEffectList; + std::map< uint8_t, StatusEffect::StatusEffectPtr > m_statusEffectMap; -public: - Chara( Common::ObjKind type ); + public: + Chara( Common::ObjKind type ); - virtual ~Chara() override; + virtual ~Chara() override; - virtual void calculateStats() {}; + virtual void calculateStats() {}; - /// Status effect functions - void addStatusEffect( StatusEffect::StatusEffectPtr pEffect ); + /// Status effect functions + void addStatusEffect( StatusEffect::StatusEffectPtr pEffect ); - void removeStatusEffect( uint8_t effectSlotId ); + void removeStatusEffect( uint8_t effectSlotId ); - void removeSingleStatusEffectById( uint32_t id ); + void removeSingleStatusEffectById( uint32_t id ); - void updateStatusEffects(); + void updateStatusEffects(); - bool hasStatusEffect( uint32_t id ); + bool hasStatusEffect( uint32_t id ); - int8_t getStatusEffectFreeSlot(); + int8_t getStatusEffectFreeSlot(); - void statusEffectFreeSlot( uint8_t slotId ); + void statusEffectFreeSlot( uint8_t slotId ); - uint8_t getPose() const; + uint8_t getPose() const; - void setPose( uint8_t pose ); + void setPose( uint8_t pose ); - std::map< uint8_t, Core::StatusEffect::StatusEffectPtr > getStatusEffectMap() const; + std::map< uint8_t, Core::StatusEffect::StatusEffectPtr > getStatusEffectMap() const; - void sendStatusEffectUpdate(); + void sendStatusEffectUpdate(); - /*! return a const pointer to the look array */ - const uint8_t* getLookArray() const; + /*! return a const pointer to the look array */ + const uint8_t* getLookArray() const; - const uint32_t* getModelArray() const; + const uint32_t* getModelArray() const; - // add a status effect by id - void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 ); + // add a status effect by id + void addStatusEffectById( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 ); - // add a status effect by id if it doesn't exist - void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 ); + // add a status effect by id if it doesn't exist + void addStatusEffectByIdIfNotExist( uint32_t id, int32_t duration, Entity::Chara& source, uint16_t param = 0 ); - // remove a status effect by id - void removeSingleStatusEffectFromId( uint32_t id ); - /// End Status Effect Functions + // remove a status effect by id + void removeSingleStatusEffectFromId( uint32_t id ); + /// End Status Effect Functions - std::string getName() const; + std::string getName() const; - bool face( const Common::FFXIVARR_POSITION3& p ); + bool face( const Common::FFXIVARR_POSITION3& p ); - Common::Stance getStance() const; + Common::Stance getStance() const; - void setStance( Common::Stance stance ); + void setStance( Common::Stance stance ); - ActorStats getStats() const; + ActorStats getStats() const; - uint32_t getHp() const; + uint32_t getHp() const; - uint32_t getMp() const; + uint32_t getMp() const; - uint16_t getTp() const; + uint16_t getTp() const; - uint16_t getGp() const; + uint16_t getGp() const; - Common::InvincibilityType getInvincibilityType() const; + Common::InvincibilityType getInvincibilityType() const; - Common::ClassJob getClass() const; + Common::ClassJob getClass() const; - uint8_t getClassAsInt() const; + uint8_t getClassAsInt() const; - void setClass( Common::ClassJob classJob ); + void setClass( Common::ClassJob classJob ); - void setTargetId( uint64_t targetId ); + void setTargetId( uint64_t targetId ); - uint64_t getTargetId() const; + uint64_t getTargetId() const; - bool isAlive() const; + bool isAlive() const; - virtual uint32_t getMaxHp() const; + virtual uint32_t getMaxHp() const; - virtual uint32_t getMaxMp() const; + virtual uint32_t getMaxMp() const; - void resetHp(); + void resetHp(); - void resetMp(); + void resetMp(); - void setHp( uint32_t hp ); + void setHp( uint32_t hp ); - void setMp( uint32_t mp ); + void setMp( uint32_t mp ); - void setGp( uint32_t gp ); + void setGp( uint32_t gp ); - void setInvincibilityType( Common::InvincibilityType type ); + void setInvincibilityType( Common::InvincibilityType type ); - void die(); + void die(); - Common::ActorStatus getStatus() const; + Common::ActorStatus getStatus() const; - void setStatus( Common::ActorStatus status ); + void setStatus( Common::ActorStatus status ); - void - handleScriptSkill( uint32_t type, uint16_t actionId, uint64_t param1, uint64_t param2, Entity::Chara& target ); + void + handleScriptSkill( uint32_t type, uint16_t actionId, uint64_t param1, uint64_t param2, Entity::Chara& target ); - virtual void autoAttack( CharaPtr pTarget ); + virtual void autoAttack( CharaPtr pTarget ); - virtual void onDeath() {}; + virtual void onDeath() {}; - virtual void onDamageTaken( Chara& pSource ) {}; + virtual void onDamageTaken( Chara& pSource ) {}; - virtual void onActionHostile( Chara& source ) {}; + virtual void onActionHostile( Chara& source ) {}; - virtual void onActionFriendly( Chara& pSource ) {}; + virtual void onActionFriendly( Chara& pSource ) {}; - virtual void onTick() {}; + virtual void onTick() {}; - virtual void changeTarget( uint64_t targetId ); + virtual void changeTarget( uint64_t targetId ); - virtual uint8_t getLevel() const; + virtual uint8_t getLevel() const; - virtual void sendStatusUpdate( bool toSelf = true ); + virtual void sendStatusUpdate( bool toSelf = true ); - virtual void takeDamage( uint32_t damage ); + virtual void takeDamage( uint32_t damage ); - virtual void heal( uint32_t amount ); + virtual void heal( uint32_t amount ); - virtual bool checkAction(); + virtual bool checkAction(); - virtual void update( int64_t currTime ) {}; + virtual void update( int64_t currTime ) {}; - Action::ActionPtr getCurrentAction() const; + Action::ActionPtr getCurrentAction() const; - void setCurrentAction( Action::ActionPtr pAction ); + void setCurrentAction( Action::ActionPtr pAction ); -}; + }; -} } #endif diff --git a/src/servers/sapphire_zone/Actor/EventObject.h b/src/servers/sapphire_zone/Actor/EventObject.h index 1bdb0473..5ce5de54 100644 --- a/src/servers/sapphire_zone/Actor/EventObject.h +++ b/src/servers/sapphire_zone/Actor/EventObject.h @@ -3,60 +3,59 @@ #include "Actor.h" -namespace Core { -namespace Entity { - -class EventObject : public Actor +namespace Core::Entity { -public: - EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId, uint8_t initialState, - Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" ); - using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, - InstanceContentPtr, uint64_t ) >; + class EventObject : public Actor + { + public: + EventObject( uint32_t actorId, uint32_t objectId, uint32_t gimmickId, uint8_t initialState, + Common::FFXIVARR_POSITION3 pos, float rotation, const std::string& givenName = "none" ); - uint32_t getGimmickId() const; + using OnTalkEventHandler = std::function< void( Entity::Player&, Entity::EventObjectPtr, + InstanceContentPtr, uint64_t ) >; - void setGimmickId( uint32_t gimmickId ); + uint32_t getGimmickId() const; - uint8_t getState() const; + void setGimmickId( uint32_t gimmickId ); - void setState( uint8_t state ); + uint8_t getState() const; - float getScale() const; + void setState( uint8_t state ); - void setScale( float scale ); + float getScale() const; - void setOnTalkHandler( OnTalkEventHandler handler ); + void setScale( float scale ); - OnTalkEventHandler getOnTalkHandler() const; + void setOnTalkHandler( OnTalkEventHandler handler ); - uint32_t getObjectId() const; + OnTalkEventHandler getOnTalkHandler() const; - const std::string& getName() const; + uint32_t getObjectId() const; - InstanceContentPtr getParentInstance() const; + const std::string& getName() const; - void setParentInstance( InstanceContentPtr instance ); + InstanceContentPtr getParentInstance() const; - void spawn( PlayerPtr pTarget ) override; + void setParentInstance( InstanceContentPtr instance ); - void despawn( PlayerPtr pTarget ) override; + void spawn( PlayerPtr pTarget ) override; - void setAnimationFlag( uint32_t flag, uint32_t animationFlag ); + void despawn( PlayerPtr pTarget ) override; -protected: - uint32_t m_gimmickId; - uint32_t m_objectId; - uint8_t m_state; - float m_scale; - std::string m_name; - InstanceContentPtr m_parentInstance; - OnTalkEventHandler m_onTalkEventHandler; + void setAnimationFlag( uint32_t flag, uint32_t animationFlag ); + + protected: + uint32_t m_gimmickId; + uint32_t m_objectId; + uint8_t m_state; + float m_scale; + std::string m_name; + InstanceContentPtr m_parentInstance; + OnTalkEventHandler m_onTalkEventHandler; -}; -} + }; } #endif //SAPPHIRE_INSTANCEOBJECT_H diff --git a/src/servers/sapphire_zone/Actor/Npc.h b/src/servers/sapphire_zone/Actor/Npc.h index 4dac91dc..aef2e75c 100644 --- a/src/servers/sapphire_zone/Actor/Npc.h +++ b/src/servers/sapphire_zone/Actor/Npc.h @@ -9,24 +9,23 @@ #include #include -namespace Core { -namespace Entity { - -/*! -\class Npc -\brief Base class for all Npcs - -*/ -class Npc : public Chara +namespace Core::Entity { -public: - Npc( Common::ObjKind type ); + /*! + \class Npc + \brief Base class for all Npcs - virtual ~Npc() override; + */ + class Npc : public Chara + { -}; + public: + Npc( Common::ObjKind type ); + + virtual ~Npc() override; + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Actor/Player.h b/src/servers/sapphire_zone/Actor/Player.h index 4f62b976..672836a3 100644 --- a/src/servers/sapphire_zone/Actor/Player.h +++ b/src/servers/sapphire_zone/Actor/Player.h @@ -11,1020 +11,1018 @@ #include #include -namespace Core { - -namespace Entity { - -struct QueuedZoning +namespace Core::Entity { - uint16_t m_targetZone; - Common::FFXIVARR_POSITION3 m_targetPosition; - float m_targetRotation; - uint64_t m_queueTime; - QueuedZoning( uint16_t targetZone, const Common::FFXIVARR_POSITION3& targetPosition, - uint64_t queuedTime, float targetRotation ) : - m_targetZone( targetZone ), - m_targetPosition( targetPosition ), - m_queueTime( queuedTime ), - m_targetRotation( targetRotation ) + struct QueuedZoning { - } -}; - -/** Class representing the Player -* Inheriting from Actor -* -*/ -class Player : public Chara -{ -public: - /*! Contructor */ - Player(); - - /*! Destructor */ - ~Player(); - - void autoAttack( CharaPtr pTarget ) override; - - void injectPacket( std::string path ); - - // EventHandlers - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! start an event action */ - void eventActionStart( uint32_t eventId, uint32_t action, ActionCallback finishCallback, - ActionCallback interruptCallback, uint64_t additional ); - - /*! start an event item action */ - void eventItemActionStart( uint32_t eventId, uint32_t action, ActionCallback finishCallback, - ActionCallback interruptCallback, uint64_t additional ); - - /*! start/register a normal event */ - void - eventStart( uint64_t actorId, uint32_t eventId, Event::EventHandler::EventType eventParam, uint8_t eventParam1, - uint32_t eventParam2 ); - - /*! play a subevent */ - void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 ); - - void playGilShop( uint32_t eventId, uint32_t flags, - Event::EventHandler::SceneReturnCallback eventCallback ); - - void - directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, - uint32_t eventParam5 = 0 ); - - /*! play a subevent */ - void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, - uint32_t eventParam2, uint32_t eventParam3, - Event::EventHandler::SceneReturnCallback eventReturnCallback ); - - /*! play a subevent */ - void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, - uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4, - Event::EventHandler::SceneReturnCallback eventReturnCallback ); - - /*! play a subevent */ - void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, - Event::EventHandler::SceneReturnCallback eventReturnCallback ); - - /*! play a subevent */ - void playScene( uint32_t eventId, uint32_t scene, uint32_t flags ); - - /*! play a subevent */ - void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags, - uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4, - Event::EventHandler::SceneChainCallback sceneChainCallback ); - - /*! play a subevent */ - void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags, - uint32_t eventParam2, uint32_t eventParam3, - Event::EventHandler::SceneChainCallback sceneChainCallback ); - - /*! play a subevent */ - void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags, - Event::EventHandler::SceneChainCallback sceneChainCallback ); - - /*! setup the event and return a ptr to it */ - Event::EventHandlerPtr bootstrapSceneEvent( uint32_t eventId, uint32_t flags ); - - /*! finish / unregister an event */ - void eventFinish( uint32_t eventId, uint32_t freePlayer ); - - /*! add an event to the event array */ - void addEvent( Event::EventHandlerPtr pEvent ); - - /*! retrieve an event from the event array */ - Event::EventHandlerPtr getEvent( uint32_t eventId ); - - /*! get number of active events */ - size_t getEventCount(); - - /*! remove an event from the event array */ - void removeEvent( uint32_t eventId ); - - /*! return the eventlist */ - std::map< uint32_t, Event::EventHandlerPtr >& eventList(); - - void checkEvent( uint32_t eventId ); - - - - // Events - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! Event to be called when zoning process gets triggered */ - void onZoneStart(); - - /*! Event to be called when zoning process is finished */ - void onZoneDone(); - - /*! Event to be called on login */ - void onLogin(); - - /*! Event to be called on update tick */ - void onTick() override; - - /*! Event to be called upon player death */ - void onDeath() override; - - /*! Event called on every session iteration */ - void update( int64_t currTime ) override; - - /*! Event to be called upon Bnpc kill */ - void onMobKill( uint16_t nameId ); - - - // Quest - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! load data for currently active quests */ - bool loadActiveQuests(); - - /*! update quest ( register it as active quest if new ) */ - void updateQuest( uint16_t questId, uint8_t sequence ); - - /*! return true if quest is currently active */ - bool hasQuest( uint32_t questId ); - - /*! return the current quest sequence */ - uint8_t getQuestSeq( uint16_t questId ); - - /*! send the quest tracker packet */ - void sendQuestTracker(); - - /*! set quest tracker flag for a specified slot */ - void setQuestTracker( uint16_t index, int16_t flag ); - - /*! return the index of a given quest in the players quest list */ - int8_t getQuestIndex( uint16_t questId ); - - /*! finish a given quest */ - void finishQuest( uint16_t questId ); - - /*! finish a given quest */ - void unfinishQuest( uint16_t questId ); - - /*! remove a given quest */ - void removeQuest( uint16_t questId ); - - /*! add a quest to the completed quests mask */ - void updateQuestsCompleted( uint32_t questId ); - - /*! remove a quest from the completed quest mask */ - void removeQuestsCompleted( uint32_t questId ); - - /*! get the curent opening sequence */ - uint8_t getOpeningSequence() const; - - /*! set te current opening sequence */ - void setOpeningSequence( uint8_t seq ); - - bool giveQuestRewards( uint32_t questId, uint32_t optionalChoice ); - - std::shared_ptr< Common::QuestActive > getQuestActive( uint16_t index ); - - uint8_t getQuestUI8A( uint16_t questId ); - - uint8_t getQuestUI8B( uint16_t questId ); - - uint8_t getQuestUI8C( uint16_t questId ); - - uint8_t getQuestUI8D( uint16_t questId ); - - uint8_t getQuestUI8E( uint16_t questId ); - - uint8_t getQuestUI8F( uint16_t questId ); - - uint8_t getQuestUI8AH( uint16_t questId ); - - uint8_t getQuestUI8BH( uint16_t questId ); - - uint8_t getQuestUI8CH( uint16_t questId ); - - uint8_t getQuestUI8DH( uint16_t questId ); - - uint8_t getQuestUI8EH( uint16_t questId ); - - uint8_t getQuestUI8FH( uint16_t questId ); - - uint8_t getQuestUI8AL( uint16_t questId ); - - uint8_t getQuestUI8BL( uint16_t questId ); - - uint8_t getQuestUI8CL( uint16_t questId ); - - uint8_t getQuestUI8DL( uint16_t questId ); - - uint8_t getQuestUI8EL( uint16_t questId ); - - uint8_t getQuestUI8FL( uint16_t questId ); - - uint16_t getQuestUI16A( uint16_t questId ); - - uint16_t getQuestUI16B( uint16_t questId ); - - uint16_t getQuestUI16C( uint16_t questId ); - - uint32_t getQuestUI32A( uint16_t questId ); - - bool getQuestBitFlag8( uint16_t questId, uint8_t index ); - - bool getQuestBitFlag16( uint16_t questId, uint8_t index ); - - bool getQuestBitFlag24( uint16_t questId, uint8_t index ); - - bool getQuestBitFlag32( uint16_t questId, uint8_t index ); - - bool getQuestBitFlag40( uint16_t questId, uint8_t index ); - - bool getQuestBitFlag48( uint16_t questId, uint8_t index ); - - - void setQuestUI8A( uint16_t questId, uint8_t val ); - - void setQuestUI8B( uint16_t questId, uint8_t val ); - - void setQuestUI8C( uint16_t questId, uint8_t val ); - - void setQuestUI8D( uint16_t questId, uint8_t val ); - - void setQuestUI8E( uint16_t questId, uint8_t val ); - - void setQuestUI8F( uint16_t questId, uint8_t val ); - - void setQuestUI8AH( uint16_t questId, uint8_t val ); - - void setQuestUI8BH( uint16_t questId, uint8_t val ); - - void setQuestUI8CH( uint16_t questId, uint8_t val ); - - void setQuestUI8DH( uint16_t questId, uint8_t val ); - - void setQuestUI8EH( uint16_t questId, uint8_t val ); - - void setQuestUI8FH( uint16_t questId, uint8_t val ); - - void setQuestUI8AL( uint16_t questId, uint8_t val ); - - void setQuestUI8BL( uint16_t questId, uint8_t val ); - - void setQuestUI8CL( uint16_t questId, uint8_t val ); - - void setQuestUI8DL( uint16_t questId, uint8_t val ); - - void setQuestUI8EL( uint16_t questId, uint8_t val ); - - void setQuestUI8FL( uint16_t questId, uint8_t val ); - - void setQuestUI16A( uint16_t questId, uint16_t val ); - - void setQuestUI16B( uint16_t questId, uint16_t val ); - - void setQuestUI16C( uint16_t questId, uint16_t val ); - - void setQuestUI32A( uint16_t questId, uint32_t val ); - - void setQuestBitFlag8( uint16_t questId, uint8_t index, bool val ); - - void setQuestBitFlag16( uint16_t questId, uint8_t index, bool val ); - - void setQuestBitFlag24( uint16_t questId, uint8_t index, bool val ); - - void setQuestBitFlag32( uint16_t questId, uint8_t index, bool val ); - - void setQuestBitFlag40( uint16_t questId, uint8_t index, bool val ); - - void setQuestBitFlag48( uint16_t questId, uint8_t index, bool val ); - - // Inventory / Item / Currency - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! equip an item to a specified slot */ - void equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendModel ); - - /*! remove an item from an equipment slot */ - void unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem ); - - /*! equip a weapon, possibly forcing a job change */ - void equipWeapon( ItemPtr pItem, bool updateClass ); - - /*! equip a soul crystal, possibly forcing a job change*/ - void equipSoulCrystal( ItemPtr pItem, bool updateClass ); - - /*! unequip a soul crystal, returning to the base class*/ - void unequipSoulCrystal( ItemPtr pItem ); - - /*! get player ilvl */ - uint16_t getItemLevel() const; - - /*! send player ilvl */ - void sendItemLevel(); - - /*! get the current main hand model */ - uint64_t getModelMainWeapon() const; - - /*! get the current off hand model */ - uint64_t getModelSubWeapon() const; - - /*! get the current system hand model */ - uint64_t getModelSystemWeapon() const; - - /*! return a const pointer to the model array */ - const uint32_t* getModelArray() const; - - /*! return the equipment model in a specified equipment slot */ - uint32_t getModelForSlot( Common::GearModelSlot slot ); - - /*! add amount to the currency of type */ - void addCurrency( Common::CurrencyType type, uint32_t amount ); - - /*! remove amount from the currency of type */ - void removeCurrency( Common::CurrencyType type, uint32_t amount ); - - /*! return the current amount of crystals of type */ - uint32_t getCrystal( uint8_t type ) const; - - void updateModels( Common::GearSetSlot equipSlotId, const Core::ItemPtr& pItem, bool updateClass ); - - Common::GearModelSlot equipSlotToModelSlot( Common::GearSetSlot slot ); - - /*! - * Collect real item handins from container - * @param itemIds a vector of each catalog id to collect - * @return true if all items were handed in + uint16_t m_targetZone; + Common::FFXIVARR_POSITION3 m_targetPosition; + float m_targetRotation; + uint64_t m_queueTime; + + QueuedZoning( uint16_t targetZone, const Common::FFXIVARR_POSITION3& targetPosition, + uint64_t queuedTime, float targetRotation ) : + m_targetZone( targetZone ), + m_targetPosition( targetPosition ), + m_queueTime( queuedTime ), + m_targetRotation( targetRotation ) + { + } + }; + + /** Class representing the Player + * Inheriting from Actor + * */ - bool collectHandInItems( std::vector< uint32_t > itemIds ); - - // Class / Job / Exp - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! returns the level of the currently active class / job */ - uint8_t getLevel() const override; - - /*! returns the level of the provided class / job */ - uint8_t getLevelForClass( Common::ClassJob pClass ) const; - - /*! returns if the classjob is unlocked */ - bool isClassJobUnlocked( Common::ClassJob classJob ) const; - - /*! returns the exp of the currently active class / job */ - uint32_t getExp() const; - - /*! sets the exp of the currently active class / job */ - void setExp( uint32_t amount ); - - /*! adds exp to the currently active class / job */ - void gainExp( uint32_t amount ); - - /*! gain a level on the currently active class / job */ - void gainLevel(); - - /*! set level on the currently active class / job to given level */ - void setLevel( uint8_t level ); - - /*! set level on the provided class / job to given level */ - void setLevelForClass( uint8_t level, Common::ClassJob classjob ); - - /*! change class or job to given class / job */ - void setClassJob( Common::ClassJob classJob ); - - /*! returns a pointer to the class array */ - uint16_t* getClassArray(); - - /*! returns a const pointer to the class array */ - const uint16_t* getClassArray() const; - - /*! returns a pointer to the exp array */ - uint32_t* getExpArray(); - - /*! returns a const pointer to the exp array */ - const uint32_t* getExpArray() const; - - // Base Look / Stats / Params - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! return the birth day */ - uint8_t getBirthDay() const; - - /*! return the birth month */ - uint8_t getBirthMonth() const; - - /*! return the guardian diety Id */ - uint8_t getGuardianDeity() const; - - /*! get look at specified index */ - uint8_t getLookAt( uint8_t index ) const; - - /*! return the race */ - uint8_t getRace() const; - - /*! return gender 0 male, 1 female */ - uint8_t getGender() const; - - /*! return the id of the home town */ - uint8_t getStartTown() const; - - /*! return the voice id */ - uint8_t getVoiceId() const; - - /*! return the grand company */ - uint8_t getGc() const; - - /*! return the grand company rank */ - const uint8_t* getGcRankArray() const; - - /*! set look at index */ - void setLookAt( uint8_t index, uint8_t value ); - - /*! set the voice Id */ - void setVoiceId( uint8_t voiceId ); - - /*! set the grand company */ - void setGc( uint8_t gc ); - - /*! set the grand company rank */ - void setGcRankAt( uint8_t index, uint8_t rank ); - - /*! returns true if the player is currently in combat */ - bool isInCombat() const; - - /*! sets players combat state */ - void setInCombat( bool mode ); - - /*! return current online status depending on current state / activity */ - Common::OnlineStatus getOnlineStatus() const; - - /*! sets the players zone, initiating a zoning process */ - void setZone( uint32_t zoneId ); - - /*! sets the players instance & initiates zoning process */ - bool setInstance( uint32_t instanceContentId ); - - /*! sets the players instance & initiates zoning process */ - bool setInstance( ZonePtr instance ); - - /*! returns the player to their position before zoning into an instance */ - bool exitInstance(); - - /*! sets the players territoryId */ - void setTerritoryId( uint32_t territoryId ); - - /*! gets the players territoryId */ - uint32_t getTerritoryId() const; - - void forceZoneing( uint32_t zoneId ); - - /*! return player to preset homepoint */ - void returnToHomepoint(); - - /*! change position, sends update too */ - void changePosition( float x, float y, float z, float o ); - - /*! return the contentId */ - uint64_t getContentId() const; - - /*! return max hp */ - uint32_t getMaxHp(); - - /*! return max mp */ - uint32_t getMaxMp(); - - /*! return a players total play time */ - uint32_t getPlayTime() const; - - /*! return true if the player has "new adventurere" status */ - bool isNewAdventurer() const; - - /*! change the players "new adventurere" status */ - void setNewAdventurer( bool state ); - - /*! sets the list of current online status */ - void setOnlineStatusMask( uint64_t status ); - - /*! returns the current online status */ - uint64_t getOnlineStatusMask() const; - - /*! perform a teleport of a specified type ( teleport,return,aethernet ) */ - void teleport( uint16_t aetheryteId, uint8_t type = 1 ); - - /*! query teleport of a specified type */ - void teleportQuery( uint16_t aetheryteId ); - - /*! prepares zoning / fades out the screen */ - void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 ); - - /*! get player's title list (available titles) */ - uint8_t* getTitleList(); - - const uint8_t* getTitleList() const; - - /*! get player's active title */ - uint16_t getTitle() const; - - /*! add title to player title list */ - void addTitle( uint16_t titleId ); - - /*! change player's active title */ - void setTitle( uint16_t titleId ); - - /*! send the players title list */ - void sendTitleList(); - - /*! change gear param state */ - void setEquipDisplayFlags( uint8_t state ); - - /*! get gear param state */ - uint8_t getEquipDisplayFlags() const; - - /*! mount the specified mount and send the packets */ - void mount( uint32_t id ); - - /*! dismount the current mount and send the packets */ - void dismount(); - - /*! get the current mount */ - uint8_t getCurrentMount() const; - - /*! set current persistent emote */ - void setPersistentEmote( uint32_t emoteId ); - - /*! get current persistent emote */ - uint32_t getPersistentEmote() const; - - void calculateStats() override; - - void sendStats(); - - - // Aetheryte / Action / Attribute bitmasks - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! register aetheryte aetheryteId and send update */ - void registerAetheryte( uint8_t aetheryteId ); - - /*! check if aetheryte is already registered */ - bool isAetheryteRegistered( uint8_t aetheryteId ) const; - - /*! return a const pointer to the aetheryte unlock bitmask array */ - int8_t getAetheryteMaskAt( uint8_t index ) const; - - /*! return a pointer to the aetheryte unlock bitmask array */ - uint8_t* getAetheryteArray(); - - /*! set homepoint */ - void setHomepoint( uint8_t aetheryteId ); - - /*! get homepoint */ - uint8_t getHomepoint() const; - - /*! discover subarea subid fo map map_id, also send udpate packet */ - void discover( int16_t map_id, int16_t sub_id ); - - /*! return a pointer to the discovery bitmask array */ - uint8_t* getDiscoveryBitmask(); - - /*! helper/debug function to reset all discovered areas */ - void resetDiscovery(); - - /*! get a pointer to the howto bitmask array */ - uint8_t* getHowToArray(); - - /*! get a const pointer to the howto bitmask array */ - const uint8_t* getHowToArray() const; - - /*! update bitmask for how-to's seen */ - void updateHowtosSeen( uint32_t howToId ); - - /*! learn an action / update the unlock bitmask. */ - void learnAction( uint16_t actionId ); - - /*! learn a song / update the unlock bitmask. */ - void learnSong( uint8_t songId, uint32_t itemId ); - - /*! check if an action is already unlocked in the bitmask. */ - bool isActionLearned( uint8_t actionId ) const; - - /*! return a const pointer to the unlock bitmask array */ - const uint8_t* getUnlockBitmask() const; - - /*! return a const pointer to the orchestrion bitmask array */ - const uint8_t* getOrchestrionBitmask() const; - - /*! return a const pointer to the mount guide bitmask array */ - const uint8_t* getMountGuideBitmask() const; - - - // Spawn handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! initialize the spawnId queue */ - void initSpawnIdQueue(); - - /*! get the spawn id mapped to a specific actorId */ - uint8_t getSpawnIdForActorId( uint32_t actorId ); - - /*! frees the spawnId assigned to the given actor */ - void freePlayerSpawnId( uint32_t actorId ); - - /*! checks if the given spawn id is valid */ - bool isActorSpawnIdValid( uint8_t spawnId ); - - /*! send spawn packets to pTarget */ - void spawn( PlayerPtr pTarget ) override; - - /*! send despawn packets to pTarget */ - void despawn( PlayerPtr pTarget ) override; - - // Player State Handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /* return a const pointer to the state flag array */ - const uint8_t* getStateFlags() const; - - /* set a specified state flag */ - void setStateFlag( Common::PlayerStateFlag flag ); - - /* set a specified state flag */ - void setStateFlags( std::vector< Common::PlayerStateFlag > flags ); - - /* check if a specified flag is set */ - bool hasStateFlag( Common::PlayerStateFlag flag ) const; - - /* reset a specified flag */ - void unsetStateFlag( Common::PlayerStateFlag flag ); - - // Player Session Handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! return the userlevel */ - uint8_t getUserLevel() const; - - /*! set timestamp for last received ping */ - void setLastPing( uint32_t ping ); - - /*! get timestamp of last received ping */ - uint32_t getLastPing() const; - - // Player Database Handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! generate the update sql based on update flags */ - void updateSql(); - - /*! load player from db, by id */ - bool load( uint32_t charId, SessionPtr pSession ); - - /*! load active class data */ - bool loadClassData(); - - /*! load search info */ - bool loadSearchInfo(); - - // Player Network Handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! send current models ( equipment ) */ - void sendModel(); - - /*! send active state flags */ - void sendStateFlags(); - - /*! send status update */ - void sendStatusUpdate( bool toSelf = true ) override; - - /*! send the entire inventory sequence */ - void sendInventory(); - - /*! send active quest list */ - void sendQuestInfo(); - - /*! send a quest specific message */ - void sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 ); - - /*! queue a packet for the player */ - void queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket ); - - /*! queue a char connection packet for the player */ - void queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket ); - - /*! returns true if loading is complete ( 0x69 has been received ) */ - bool isLoadingComplete() const; - - /*! set the loading complete bool */ - void setLoadingComplete( bool bComplete ); - - /*! mark this player for zoning, notify worldserver */ - void performZoning( uint16_t zoneId, const Common::FFXIVARR_POSITION3& pos, float rotation ); - - /*! return true if the player is marked for zoning */ - bool isMarkedForZoning() const; - - void emote( uint32_t emoteId, uint64_t targetId, bool isSilent ); - - void emoteInterrupt(); - - - void sendZoneInPackets( uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, bool pSetStatus ); - - void finishZoning(); - - void sendZonePackets(); - - Common::ZoneingType getZoningType() const; - - void setZoningType( Common::ZoneingType zoneingType ); - - void setSearchInfo( uint8_t selectRegion, uint8_t selectClass, const char* searchMessage ); - - const char* getSearchMessage() const; - - uint8_t getSearchSelectRegion() const; - - uint8_t getSearchSelectClass() const; - - void sendNotice( const std::string& message ); - - void sendUrgent( const std::string& message ); - - void sendDebug( const std::string& message ); - - bool isDirectorInitialized() const; - - void setDirectorInitialized( bool isInitialized ); - - // Player Battle Handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - void initHateSlotQueue(); - - void sendHateList(); - - bool actionHasCastTime( uint32_t actionId ); - - Core::Entity::ActorPtr lookupTargetById( uint64_t targetId ); - - bool isLogin() const; - - void setIsLogin( bool bIsLogin ); - - uint16_t getZoneId() const; - - uint8_t getGmRank() const; - - void setGmRank( uint8_t rank ); - - bool getGmInvis() const; - - void setGmInvis( bool invis ); - - bool isActingAsGm() const; - - uint8_t getMode() const; - - void setMode( uint8_t mode ); - - void setAutoattack( bool mode ); - - bool isAutoattackOn() const; - - // Content Finder handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - /*! Get an unix time when the player can register into content finder again. */ - uint32_t getCFPenaltyTimestamp() const; - - /*! Set an unix time when the player can register into content finder again. */ - void setCFPenaltyTimestamp( uint32_t timestamp ); - - uint32_t getCFPenaltyMinutes() const; - - void setCFPenaltyMinutes( uint32_t minutes ); - - void setEorzeaTimeOffset( uint64_t timestamp ); - - // Database - void updateDbAllQuests() const; - - void deleteQuest( uint16_t questId ) const; - - void insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const; - - void updateDbSearchInfo() const; - - void updateDbClass() const; - - void insertDbClass( const uint8_t classJobIndex ) const; - - void setMarkedForRemoval(); - - bool isMarkedForRemoval() const; - - void setOnEnterEventDone( bool isDone ); - - bool isOnEnterEventDone() const; - - /*! gets the next available obj count */ - uint8_t getNextObjSpawnIndexForActorId( uint32_t actorId ); - - /*! resets the players obj count */ - void resetObjSpawnIndex(); - - /*! frees an obj count to be used by another eobj */ - void freeObjSpawnIndexForActorId( uint32_t actorId ); - - /*! checks if a spawn index is valid */ - bool isObjSpawnIndexValid( uint8_t index ); - - - // Inventory Handling - ////////////////////////////////////////////////////////////////////////////////////////////////////// - void initInventory(); - - using InvSlotPair = std::pair< uint16_t, int8_t >; - using InvSlotPairVec = std::vector< InvSlotPair >; - - ItemPtr createItem( uint32_t catalogId, uint32_t quantity = 1 ); - - bool loadInventory(); - - InvSlotPairVec getSlotsOfItemsInInventory( uint32_t catalogId ); - - InvSlotPair getFreeBagSlot(); - - Core::ItemPtr addItem( uint32_t catalogId, uint32_t quantity = 1, bool isHq = false, bool slient = false ); - - void moveItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot ); - - void swapItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot ); - - void discardItem( uint16_t fromInventoryId, uint8_t fromSlotId ); - - void splitItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot, - uint16_t splitCount ); - - void mergeItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot ); - - ItemPtr getItemAt( uint16_t containerId, uint8_t slotId ); - - bool updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem ); - - /*! calculate and return player ilvl based off equipped gear */ - uint16_t calculateEquippedGearItemLevel(); - - /*! return the current amount of currency of type */ - uint32_t getCurrency( Common::CurrencyType type ); - - void writeInventory( Common::InventoryType type ); - - void writeItem( ItemPtr pItem ) const; - - void deleteItemDb( ItemPtr pItem ) const; - - /*! return the crystal amount of currency of type */ - uint32_t getCrystal( Common::CrystalType type ); - - /*! add amount to the crystal of type */ - void addCrystal( Common::CrystalType type, uint32_t amount ); - - /*! remove amount from the crystals of type */ - void removeCrystal( Common::CrystalType type, uint32_t amount ); - - bool isObtainable( uint32_t catalogId, uint8_t quantity ); - - void send(); - - uint8_t getFreeSlotsInBags(); - - ////////////////////////////////////////////////////////////////////////////////////////////////////// - - uint64_t m_lastMoveTime; - uint8_t m_lastMoveflag; - -private: - uint32_t m_lastWrite; - uint32_t m_lastPing; - - bool m_bIsLogin; - - uint64_t m_contentId; // This id will be the name of the folder for character settings in "My Games" - - uint8_t m_mode; - - bool m_markedForRemoval; - - bool m_directorInitialized; - - bool m_onEnterEventDone; - -private: - using InventoryMap = std::map< uint16_t, Core::ItemContainerPtr >; - - InventoryMap m_storageMap; - - Common::FFXIVARR_POSITION3 m_prevPos; - uint32_t m_prevZoneType; - uint32_t m_prevZoneId; - float m_prevRot; - - uint8_t m_voice; - - uint64_t m_modelMainWeapon; - uint64_t m_modelSubWeapon; - uint64_t m_modelSystemWeapon; - - bool m_bNewGame; - - uint8_t m_guardianDeity; - uint8_t m_birthDay; - uint8_t m_birthMonth; - - struct RetainerInfo + class Player : public Chara { - uint32_t retainerId; - char retainerName[32]; - uint32_t createUnixTime; - bool isActive; - bool isRename; - uint8_t status; - } m_retainerInfo[8]; + public: + /*! Contructor */ + Player(); - uint16_t m_activeTitle; - uint8_t m_titleList[48]; - uint8_t m_howTo[33]; - uint8_t m_minions[40]; - uint8_t m_mountGuide[17]; - uint8_t m_homePoint; - uint8_t m_startTown; - uint16_t m_townWarpFstFlags; - uint8_t m_questCompleteFlags[396]; - uint8_t m_discovery[421]; - uint32_t m_playTime; + /*! Destructor */ + ~Player(); - uint16_t m_classArray[25]; - uint32_t m_expArray[25]; - uint8_t m_aetheryte[17]; - uint8_t m_unlocks[64]; - uint8_t m_orchestrion[40]; + void autoAttack( CharaPtr pTarget ) override; - uint8_t m_openingSequence; + void injectPacket( std::string path ); - uint16_t m_itemLevel; - std::map< uint32_t, Event::EventHandlerPtr > m_eventHandlerMap; + // EventHandlers + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! start an event action */ + void eventActionStart( uint32_t eventId, uint32_t action, ActionCallback finishCallback, + ActionCallback interruptCallback, uint64_t additional ); - std::queue< uint8_t > m_freeHateSlotQueue; // queue with "hate slots" free to be assigned - std::map< uint32_t, uint8_t > m_actorIdTohateSlotMap; + /*! start an event item action */ + void eventItemActionStart( uint32_t eventId, uint32_t action, ActionCallback finishCallback, + ActionCallback interruptCallback, uint64_t additional ); - std::map< uint32_t, uint8_t > m_questIdToQuestIdx; // quest mapping, quest id to quest container index - std::map< uint8_t, uint32_t > m_questIdxToQuestId; // quest mapping, quest container index to questId - std::shared_ptr< Common::QuestActive > m_activeQuests[30]; - int16_t m_questTracking[5]; + /*! start/register a normal event */ + void + eventStart( uint64_t actorId, uint32_t eventId, Event::EventHandler::EventType eventParam, uint8_t eventParam1, + uint32_t eventParam2 ); - uint8_t m_stateFlags[12]; - uint8_t m_gmRank; - uint16_t zoneId; - bool m_gmInvis = false; + /*! play a subevent */ + void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam2, uint32_t eventParam3 ); - uint8_t m_equipDisplayFlags; + void playGilShop( uint32_t eventId, uint32_t flags, + Event::EventHandler::SceneReturnCallback eventCallback ); - bool m_bInCombat; - bool m_bLoadingComplete; - bool m_bAutoattack; + void + directorPlayScene( uint32_t eventId, uint32_t scene, uint32_t flags, uint32_t eventParam3, uint32_t eventParam4, + uint32_t eventParam5 = 0 ); - Common::ZoneingType m_zoningType; + /*! play a subevent */ + void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, + uint32_t eventParam2, uint32_t eventParam3, + Event::EventHandler::SceneReturnCallback eventReturnCallback ); - bool m_bMarkedForZoning; - bool m_bNewAdventurer; - uint64_t m_onlineStatus; - std::shared_ptr< QueuedZoning > m_queuedZoneing; + /*! play a subevent */ + void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, + uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4, + Event::EventHandler::SceneReturnCallback eventReturnCallback ); - // search info - char m_searchMessage[193]; // searchmessage to show in profile - uint8_t m_searchSelectRegion; // regions selected to show up in profile - uint8_t m_searchSelectClass; // class selected to show up in profile + /*! play a subevent */ + void playScene( uint32_t eventId, uint32_t scene, uint32_t flags, + Event::EventHandler::SceneReturnCallback eventReturnCallback ); - // gc info - uint8_t m_gc; - uint8_t m_gcRank[3]; + /*! play a subevent */ + void playScene( uint32_t eventId, uint32_t scene, uint32_t flags ); - // content finder info - uint32_t m_cfPenaltyUntil; // unix time + /*! play a subevent */ + void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags, + uint32_t eventParam2, uint32_t eventParam3, uint32_t eventParam4, + Event::EventHandler::SceneChainCallback sceneChainCallback ); - uint32_t m_mount; - uint32_t m_emoteMode; + /*! play a subevent */ + void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags, + uint32_t eventParam2, uint32_t eventParam3, + Event::EventHandler::SceneChainCallback sceneChainCallback ); - Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator; - Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator; -}; + /*! play a subevent */ + void playSceneChain( uint32_t eventId, uint32_t scene, uint32_t flags, + Event::EventHandler::SceneChainCallback sceneChainCallback ); + + /*! setup the event and return a ptr to it */ + Event::EventHandlerPtr bootstrapSceneEvent( uint32_t eventId, uint32_t flags ); + + /*! finish / unregister an event */ + void eventFinish( uint32_t eventId, uint32_t freePlayer ); + + /*! add an event to the event array */ + void addEvent( Event::EventHandlerPtr pEvent ); + + /*! retrieve an event from the event array */ + Event::EventHandlerPtr getEvent( uint32_t eventId ); + + /*! get number of active events */ + size_t getEventCount(); + + /*! remove an event from the event array */ + void removeEvent( uint32_t eventId ); + + /*! return the eventlist */ + std::map< uint32_t, Event::EventHandlerPtr >& eventList(); + + void checkEvent( uint32_t eventId ); + + + + // Events + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! Event to be called when zoning process gets triggered */ + void onZoneStart(); + + /*! Event to be called when zoning process is finished */ + void onZoneDone(); + + /*! Event to be called on login */ + void onLogin(); + + /*! Event to be called on update tick */ + void onTick() override; + + /*! Event to be called upon player death */ + void onDeath() override; + + /*! Event called on every session iteration */ + void update( int64_t currTime ) override; + + /*! Event to be called upon Bnpc kill */ + void onMobKill( uint16_t nameId ); + + + // Quest + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! load data for currently active quests */ + bool loadActiveQuests(); + + /*! update quest ( register it as active quest if new ) */ + void updateQuest( uint16_t questId, uint8_t sequence ); + + /*! return true if quest is currently active */ + bool hasQuest( uint32_t questId ); + + /*! return the current quest sequence */ + uint8_t getQuestSeq( uint16_t questId ); + + /*! send the quest tracker packet */ + void sendQuestTracker(); + + /*! set quest tracker flag for a specified slot */ + void setQuestTracker( uint16_t index, int16_t flag ); + + /*! return the index of a given quest in the players quest list */ + int8_t getQuestIndex( uint16_t questId ); + + /*! finish a given quest */ + void finishQuest( uint16_t questId ); + + /*! finish a given quest */ + void unfinishQuest( uint16_t questId ); + + /*! remove a given quest */ + void removeQuest( uint16_t questId ); + + /*! add a quest to the completed quests mask */ + void updateQuestsCompleted( uint32_t questId ); + + /*! remove a quest from the completed quest mask */ + void removeQuestsCompleted( uint32_t questId ); + + /*! get the curent opening sequence */ + uint8_t getOpeningSequence() const; + + /*! set te current opening sequence */ + void setOpeningSequence( uint8_t seq ); + + bool giveQuestRewards( uint32_t questId, uint32_t optionalChoice ); + + std::shared_ptr< Common::QuestActive > getQuestActive( uint16_t index ); + + uint8_t getQuestUI8A( uint16_t questId ); + + uint8_t getQuestUI8B( uint16_t questId ); + + uint8_t getQuestUI8C( uint16_t questId ); + + uint8_t getQuestUI8D( uint16_t questId ); + + uint8_t getQuestUI8E( uint16_t questId ); + + uint8_t getQuestUI8F( uint16_t questId ); + + uint8_t getQuestUI8AH( uint16_t questId ); + + uint8_t getQuestUI8BH( uint16_t questId ); + + uint8_t getQuestUI8CH( uint16_t questId ); + + uint8_t getQuestUI8DH( uint16_t questId ); + + uint8_t getQuestUI8EH( uint16_t questId ); + + uint8_t getQuestUI8FH( uint16_t questId ); + + uint8_t getQuestUI8AL( uint16_t questId ); + + uint8_t getQuestUI8BL( uint16_t questId ); + + uint8_t getQuestUI8CL( uint16_t questId ); + + uint8_t getQuestUI8DL( uint16_t questId ); + + uint8_t getQuestUI8EL( uint16_t questId ); + + uint8_t getQuestUI8FL( uint16_t questId ); + + uint16_t getQuestUI16A( uint16_t questId ); + + uint16_t getQuestUI16B( uint16_t questId ); + + uint16_t getQuestUI16C( uint16_t questId ); + + uint32_t getQuestUI32A( uint16_t questId ); + + bool getQuestBitFlag8( uint16_t questId, uint8_t index ); + + bool getQuestBitFlag16( uint16_t questId, uint8_t index ); + + bool getQuestBitFlag24( uint16_t questId, uint8_t index ); + + bool getQuestBitFlag32( uint16_t questId, uint8_t index ); + + bool getQuestBitFlag40( uint16_t questId, uint8_t index ); + + bool getQuestBitFlag48( uint16_t questId, uint8_t index ); + + + void setQuestUI8A( uint16_t questId, uint8_t val ); + + void setQuestUI8B( uint16_t questId, uint8_t val ); + + void setQuestUI8C( uint16_t questId, uint8_t val ); + + void setQuestUI8D( uint16_t questId, uint8_t val ); + + void setQuestUI8E( uint16_t questId, uint8_t val ); + + void setQuestUI8F( uint16_t questId, uint8_t val ); + + void setQuestUI8AH( uint16_t questId, uint8_t val ); + + void setQuestUI8BH( uint16_t questId, uint8_t val ); + + void setQuestUI8CH( uint16_t questId, uint8_t val ); + + void setQuestUI8DH( uint16_t questId, uint8_t val ); + + void setQuestUI8EH( uint16_t questId, uint8_t val ); + + void setQuestUI8FH( uint16_t questId, uint8_t val ); + + void setQuestUI8AL( uint16_t questId, uint8_t val ); + + void setQuestUI8BL( uint16_t questId, uint8_t val ); + + void setQuestUI8CL( uint16_t questId, uint8_t val ); + + void setQuestUI8DL( uint16_t questId, uint8_t val ); + + void setQuestUI8EL( uint16_t questId, uint8_t val ); + + void setQuestUI8FL( uint16_t questId, uint8_t val ); + + void setQuestUI16A( uint16_t questId, uint16_t val ); + + void setQuestUI16B( uint16_t questId, uint16_t val ); + + void setQuestUI16C( uint16_t questId, uint16_t val ); + + void setQuestUI32A( uint16_t questId, uint32_t val ); + + void setQuestBitFlag8( uint16_t questId, uint8_t index, bool val ); + + void setQuestBitFlag16( uint16_t questId, uint8_t index, bool val ); + + void setQuestBitFlag24( uint16_t questId, uint8_t index, bool val ); + + void setQuestBitFlag32( uint16_t questId, uint8_t index, bool val ); + + void setQuestBitFlag40( uint16_t questId, uint8_t index, bool val ); + + void setQuestBitFlag48( uint16_t questId, uint8_t index, bool val ); + + // Inventory / Item / Currency + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! equip an item to a specified slot */ + void equipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem, bool sendModel ); + + /*! remove an item from an equipment slot */ + void unequipItem( Common::GearSetSlot equipSlotId, ItemPtr pItem ); + + /*! equip a weapon, possibly forcing a job change */ + void equipWeapon( ItemPtr pItem, bool updateClass ); + + /*! equip a soul crystal, possibly forcing a job change*/ + void equipSoulCrystal( ItemPtr pItem, bool updateClass ); + + /*! unequip a soul crystal, returning to the base class*/ + void unequipSoulCrystal( ItemPtr pItem ); + + /*! get player ilvl */ + uint16_t getItemLevel() const; + + /*! send player ilvl */ + void sendItemLevel(); + + /*! get the current main hand model */ + uint64_t getModelMainWeapon() const; + + /*! get the current off hand model */ + uint64_t getModelSubWeapon() const; + + /*! get the current system hand model */ + uint64_t getModelSystemWeapon() const; + + /*! return a const pointer to the model array */ + const uint32_t* getModelArray() const; + + /*! return the equipment model in a specified equipment slot */ + uint32_t getModelForSlot( Common::GearModelSlot slot ); + + /*! add amount to the currency of type */ + void addCurrency( Common::CurrencyType type, uint32_t amount ); + + /*! remove amount from the currency of type */ + void removeCurrency( Common::CurrencyType type, uint32_t amount ); + + /*! return the current amount of crystals of type */ + uint32_t getCrystal( uint8_t type ) const; + + void updateModels( Common::GearSetSlot equipSlotId, const Core::ItemPtr& pItem, bool updateClass ); + + Common::GearModelSlot equipSlotToModelSlot( Common::GearSetSlot slot ); + + /*! + * Collect real item handins from container + * @param itemIds a vector of each catalog id to collect + * @return true if all items were handed in + */ + bool collectHandInItems( std::vector< uint32_t > itemIds ); + + // Class / Job / Exp + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! returns the level of the currently active class / job */ + uint8_t getLevel() const override; + + /*! returns the level of the provided class / job */ + uint8_t getLevelForClass( Common::ClassJob pClass ) const; + + /*! returns if the classjob is unlocked */ + bool isClassJobUnlocked( Common::ClassJob classJob ) const; + + /*! returns the exp of the currently active class / job */ + uint32_t getExp() const; + + /*! sets the exp of the currently active class / job */ + void setExp( uint32_t amount ); + + /*! adds exp to the currently active class / job */ + void gainExp( uint32_t amount ); + + /*! gain a level on the currently active class / job */ + void gainLevel(); + + /*! set level on the currently active class / job to given level */ + void setLevel( uint8_t level ); + + /*! set level on the provided class / job to given level */ + void setLevelForClass( uint8_t level, Common::ClassJob classjob ); + + /*! change class or job to given class / job */ + void setClassJob( Common::ClassJob classJob ); + + /*! returns a pointer to the class array */ + uint16_t* getClassArray(); + + /*! returns a const pointer to the class array */ + const uint16_t* getClassArray() const; + + /*! returns a pointer to the exp array */ + uint32_t* getExpArray(); + + /*! returns a const pointer to the exp array */ + const uint32_t* getExpArray() const; + + // Base Look / Stats / Params + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! return the birth day */ + uint8_t getBirthDay() const; + + /*! return the birth month */ + uint8_t getBirthMonth() const; + + /*! return the guardian diety Id */ + uint8_t getGuardianDeity() const; + + /*! get look at specified index */ + uint8_t getLookAt( uint8_t index ) const; + + /*! return the race */ + uint8_t getRace() const; + + /*! return gender 0 male, 1 female */ + uint8_t getGender() const; + + /*! return the id of the home town */ + uint8_t getStartTown() const; + + /*! return the voice id */ + uint8_t getVoiceId() const; + + /*! return the grand company */ + uint8_t getGc() const; + + /*! return the grand company rank */ + const uint8_t* getGcRankArray() const; + + /*! set look at index */ + void setLookAt( uint8_t index, uint8_t value ); + + /*! set the voice Id */ + void setVoiceId( uint8_t voiceId ); + + /*! set the grand company */ + void setGc( uint8_t gc ); + + /*! set the grand company rank */ + void setGcRankAt( uint8_t index, uint8_t rank ); + + /*! returns true if the player is currently in combat */ + bool isInCombat() const; + + /*! sets players combat state */ + void setInCombat( bool mode ); + + /*! return current online status depending on current state / activity */ + Common::OnlineStatus getOnlineStatus() const; + + /*! sets the players zone, initiating a zoning process */ + void setZone( uint32_t zoneId ); + + /*! sets the players instance & initiates zoning process */ + bool setInstance( uint32_t instanceContentId ); + + /*! sets the players instance & initiates zoning process */ + bool setInstance( ZonePtr instance ); + + /*! returns the player to their position before zoning into an instance */ + bool exitInstance(); + + /*! sets the players territoryId */ + void setTerritoryId( uint32_t territoryId ); + + /*! gets the players territoryId */ + uint32_t getTerritoryId() const; + + void forceZoneing( uint32_t zoneId ); + + /*! return player to preset homepoint */ + void returnToHomepoint(); + + /*! change position, sends update too */ + void changePosition( float x, float y, float z, float o ); + + /*! return the contentId */ + uint64_t getContentId() const; + + /*! return max hp */ + uint32_t getMaxHp(); + + /*! return max mp */ + uint32_t getMaxMp(); + + /*! return a players total play time */ + uint32_t getPlayTime() const; + + /*! return true if the player has "new adventurere" status */ + bool isNewAdventurer() const; + + /*! change the players "new adventurere" status */ + void setNewAdventurer( bool state ); + + /*! sets the list of current online status */ + void setOnlineStatusMask( uint64_t status ); + + /*! returns the current online status */ + uint64_t getOnlineStatusMask() const; + + /*! perform a teleport of a specified type ( teleport,return,aethernet ) */ + void teleport( uint16_t aetheryteId, uint8_t type = 1 ); + + /*! query teleport of a specified type */ + void teleportQuery( uint16_t aetheryteId ); + + /*! prepares zoning / fades out the screen */ + void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadoutTime = 0, uint16_t animation = 0 ); + + /*! get player's title list (available titles) */ + uint8_t* getTitleList(); + + const uint8_t* getTitleList() const; + + /*! get player's active title */ + uint16_t getTitle() const; + + /*! add title to player title list */ + void addTitle( uint16_t titleId ); + + /*! change player's active title */ + void setTitle( uint16_t titleId ); + + /*! send the players title list */ + void sendTitleList(); + + /*! change gear param state */ + void setEquipDisplayFlags( uint8_t state ); + + /*! get gear param state */ + uint8_t getEquipDisplayFlags() const; + + /*! mount the specified mount and send the packets */ + void mount( uint32_t id ); + + /*! dismount the current mount and send the packets */ + void dismount(); + + /*! get the current mount */ + uint8_t getCurrentMount() const; + + /*! set current persistent emote */ + void setPersistentEmote( uint32_t emoteId ); + + /*! get current persistent emote */ + uint32_t getPersistentEmote() const; + + void calculateStats() override; + + void sendStats(); + + + // Aetheryte / Action / Attribute bitmasks + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! register aetheryte aetheryteId and send update */ + void registerAetheryte( uint8_t aetheryteId ); + + /*! check if aetheryte is already registered */ + bool isAetheryteRegistered( uint8_t aetheryteId ) const; + + /*! return a const pointer to the aetheryte unlock bitmask array */ + int8_t getAetheryteMaskAt( uint8_t index ) const; + + /*! return a pointer to the aetheryte unlock bitmask array */ + uint8_t* getAetheryteArray(); + + /*! set homepoint */ + void setHomepoint( uint8_t aetheryteId ); + + /*! get homepoint */ + uint8_t getHomepoint() const; + + /*! discover subarea subid fo map map_id, also send udpate packet */ + void discover( int16_t map_id, int16_t sub_id ); + + /*! return a pointer to the discovery bitmask array */ + uint8_t* getDiscoveryBitmask(); + + /*! helper/debug function to reset all discovered areas */ + void resetDiscovery(); + + /*! get a pointer to the howto bitmask array */ + uint8_t* getHowToArray(); + + /*! get a const pointer to the howto bitmask array */ + const uint8_t* getHowToArray() const; + + /*! update bitmask for how-to's seen */ + void updateHowtosSeen( uint32_t howToId ); + + /*! learn an action / update the unlock bitmask. */ + void learnAction( uint16_t actionId ); + + /*! learn a song / update the unlock bitmask. */ + void learnSong( uint8_t songId, uint32_t itemId ); + + /*! check if an action is already unlocked in the bitmask. */ + bool isActionLearned( uint8_t actionId ) const; + + /*! return a const pointer to the unlock bitmask array */ + const uint8_t* getUnlockBitmask() const; + + /*! return a const pointer to the orchestrion bitmask array */ + const uint8_t* getOrchestrionBitmask() const; + + /*! return a const pointer to the mount guide bitmask array */ + const uint8_t* getMountGuideBitmask() const; + + + // Spawn handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! initialize the spawnId queue */ + void initSpawnIdQueue(); + + /*! get the spawn id mapped to a specific actorId */ + uint8_t getSpawnIdForActorId( uint32_t actorId ); + + /*! frees the spawnId assigned to the given actor */ + void freePlayerSpawnId( uint32_t actorId ); + + /*! checks if the given spawn id is valid */ + bool isActorSpawnIdValid( uint8_t spawnId ); + + /*! send spawn packets to pTarget */ + void spawn( PlayerPtr pTarget ) override; + + /*! send despawn packets to pTarget */ + void despawn( PlayerPtr pTarget ) override; + + // Player State Handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /* return a const pointer to the state flag array */ + const uint8_t* getStateFlags() const; + + /* set a specified state flag */ + void setStateFlag( Common::PlayerStateFlag flag ); + + /* set a specified state flag */ + void setStateFlags( std::vector< Common::PlayerStateFlag > flags ); + + /* check if a specified flag is set */ + bool hasStateFlag( Common::PlayerStateFlag flag ) const; + + /* reset a specified flag */ + void unsetStateFlag( Common::PlayerStateFlag flag ); + + // Player Session Handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! return the userlevel */ + uint8_t getUserLevel() const; + + /*! set timestamp for last received ping */ + void setLastPing( uint32_t ping ); + + /*! get timestamp of last received ping */ + uint32_t getLastPing() const; + + // Player Database Handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! generate the update sql based on update flags */ + void updateSql(); + + /*! load player from db, by id */ + bool load( uint32_t charId, SessionPtr pSession ); + + /*! load active class data */ + bool loadClassData(); + + /*! load search info */ + bool loadSearchInfo(); + + // Player Network Handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! send current models ( equipment ) */ + void sendModel(); + + /*! send active state flags */ + void sendStateFlags(); + + /*! send status update */ + void sendStatusUpdate( bool toSelf = true ) override; + + /*! send the entire inventory sequence */ + void sendInventory(); + + /*! send active quest list */ + void sendQuestInfo(); + + /*! send a quest specific message */ + void sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 ); + + /*! queue a packet for the player */ + void queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket ); + + /*! queue a char connection packet for the player */ + void queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket ); + + /*! returns true if loading is complete ( 0x69 has been received ) */ + bool isLoadingComplete() const; + + /*! set the loading complete bool */ + void setLoadingComplete( bool bComplete ); + + /*! mark this player for zoning, notify worldserver */ + void performZoning( uint16_t zoneId, const Common::FFXIVARR_POSITION3& pos, float rotation ); + + /*! return true if the player is marked for zoning */ + bool isMarkedForZoning() const; + + void emote( uint32_t emoteId, uint64_t targetId, bool isSilent ); + + void emoteInterrupt(); + + + void sendZoneInPackets( uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, bool pSetStatus ); + + void finishZoning(); + + void sendZonePackets(); + + Common::ZoneingType getZoningType() const; + + void setZoningType( Common::ZoneingType zoneingType ); + + void setSearchInfo( uint8_t selectRegion, uint8_t selectClass, const char* searchMessage ); + + const char* getSearchMessage() const; + + uint8_t getSearchSelectRegion() const; + + uint8_t getSearchSelectClass() const; + + void sendNotice( const std::string& message ); + + void sendUrgent( const std::string& message ); + + void sendDebug( const std::string& message ); + + bool isDirectorInitialized() const; + + void setDirectorInitialized( bool isInitialized ); + + // Player Battle Handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + void initHateSlotQueue(); + + void sendHateList(); + + bool actionHasCastTime( uint32_t actionId ); + + Core::Entity::ActorPtr lookupTargetById( uint64_t targetId ); + + bool isLogin() const; + + void setIsLogin( bool bIsLogin ); + + uint16_t getZoneId() const; + + uint8_t getGmRank() const; + + void setGmRank( uint8_t rank ); + + bool getGmInvis() const; + + void setGmInvis( bool invis ); + + bool isActingAsGm() const; + + uint8_t getMode() const; + + void setMode( uint8_t mode ); + + void setAutoattack( bool mode ); + + bool isAutoattackOn() const; + + // Content Finder handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + /*! Get an unix time when the player can register into content finder again. */ + uint32_t getCFPenaltyTimestamp() const; + + /*! Set an unix time when the player can register into content finder again. */ + void setCFPenaltyTimestamp( uint32_t timestamp ); + + uint32_t getCFPenaltyMinutes() const; + + void setCFPenaltyMinutes( uint32_t minutes ); + + void setEorzeaTimeOffset( uint64_t timestamp ); + + // Database + void updateDbAllQuests() const; + + void deleteQuest( uint16_t questId ) const; + + void insertQuest( uint16_t questId, uint8_t index, uint8_t seq ) const; + + void updateDbSearchInfo() const; + + void updateDbClass() const; + + void insertDbClass( const uint8_t classJobIndex ) const; + + void setMarkedForRemoval(); + + bool isMarkedForRemoval() const; + + void setOnEnterEventDone( bool isDone ); + + bool isOnEnterEventDone() const; + + /*! gets the next available obj count */ + uint8_t getNextObjSpawnIndexForActorId( uint32_t actorId ); + + /*! resets the players obj count */ + void resetObjSpawnIndex(); + + /*! frees an obj count to be used by another eobj */ + void freeObjSpawnIndexForActorId( uint32_t actorId ); + + /*! checks if a spawn index is valid */ + bool isObjSpawnIndexValid( uint8_t index ); + + + // Inventory Handling + ////////////////////////////////////////////////////////////////////////////////////////////////////// + void initInventory(); + + using InvSlotPair = std::pair< uint16_t, int8_t >; + using InvSlotPairVec = std::vector< InvSlotPair >; + + ItemPtr createItem( uint32_t catalogId, uint32_t quantity = 1 ); + + bool loadInventory(); + + InvSlotPairVec getSlotsOfItemsInInventory( uint32_t catalogId ); + + InvSlotPair getFreeBagSlot(); + + Core::ItemPtr addItem( uint32_t catalogId, uint32_t quantity = 1, bool isHq = false, bool slient = false ); + + void moveItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot ); + + void swapItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot ); + + void discardItem( uint16_t fromInventoryId, uint8_t fromSlotId ); + + void splitItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot, + uint16_t splitCount ); + + void mergeItem( uint16_t fromInventoryId, uint8_t fromSlotId, uint16_t toInventoryId, uint8_t toSlot ); + + ItemPtr getItemAt( uint16_t containerId, uint8_t slotId ); + + bool updateContainer( uint16_t storageId, uint8_t slotId, ItemPtr pItem ); + + /*! calculate and return player ilvl based off equipped gear */ + uint16_t calculateEquippedGearItemLevel(); + + /*! return the current amount of currency of type */ + uint32_t getCurrency( Common::CurrencyType type ); + + void writeInventory( Common::InventoryType type ); + + void writeItem( ItemPtr pItem ) const; + + void deleteItemDb( ItemPtr pItem ) const; + + /*! return the crystal amount of currency of type */ + uint32_t getCrystal( Common::CrystalType type ); + + /*! add amount to the crystal of type */ + void addCrystal( Common::CrystalType type, uint32_t amount ); + + /*! remove amount from the crystals of type */ + void removeCrystal( Common::CrystalType type, uint32_t amount ); + + bool isObtainable( uint32_t catalogId, uint8_t quantity ); + + void send(); + + uint8_t getFreeSlotsInBags(); + + ////////////////////////////////////////////////////////////////////////////////////////////////////// + + uint64_t m_lastMoveTime; + uint8_t m_lastMoveflag; + + private: + uint32_t m_lastWrite; + uint32_t m_lastPing; + + bool m_bIsLogin; + + uint64_t m_contentId; // This id will be the name of the folder for character settings in "My Games" + + uint8_t m_mode; + + bool m_markedForRemoval; + + bool m_directorInitialized; + + bool m_onEnterEventDone; + + private: + using InventoryMap = std::map< uint16_t, Core::ItemContainerPtr >; + + InventoryMap m_storageMap; + + Common::FFXIVARR_POSITION3 m_prevPos; + uint32_t m_prevZoneType; + uint32_t m_prevZoneId; + float m_prevRot; + + uint8_t m_voice; + + uint64_t m_modelMainWeapon; + uint64_t m_modelSubWeapon; + uint64_t m_modelSystemWeapon; + + bool m_bNewGame; + + uint8_t m_guardianDeity; + uint8_t m_birthDay; + uint8_t m_birthMonth; + + struct RetainerInfo + { + uint32_t retainerId; + char retainerName[32]; + uint32_t createUnixTime; + bool isActive; + bool isRename; + uint8_t status; + } m_retainerInfo[8]; + + uint16_t m_activeTitle; + uint8_t m_titleList[48]; + uint8_t m_howTo[33]; + uint8_t m_minions[40]; + uint8_t m_mountGuide[17]; + uint8_t m_homePoint; + uint8_t m_startTown; + uint16_t m_townWarpFstFlags; + uint8_t m_questCompleteFlags[396]; + uint8_t m_discovery[421]; + uint32_t m_playTime; + + uint16_t m_classArray[25]; + uint32_t m_expArray[25]; + uint8_t m_aetheryte[17]; + uint8_t m_unlocks[64]; + uint8_t m_orchestrion[40]; + + uint8_t m_openingSequence; + + uint16_t m_itemLevel; + std::map< uint32_t, Event::EventHandlerPtr > m_eventHandlerMap; + + std::queue< uint8_t > m_freeHateSlotQueue; // queue with "hate slots" free to be assigned + std::map< uint32_t, uint8_t > m_actorIdTohateSlotMap; + + std::map< uint32_t, uint8_t > m_questIdToQuestIdx; // quest mapping, quest id to quest container index + std::map< uint8_t, uint32_t > m_questIdxToQuestId; // quest mapping, quest container index to questId + std::shared_ptr< Common::QuestActive > m_activeQuests[30]; + int16_t m_questTracking[5]; + + uint8_t m_stateFlags[12]; + uint8_t m_gmRank; + uint16_t zoneId; + bool m_gmInvis = false; + + uint8_t m_equipDisplayFlags; + + bool m_bInCombat; + bool m_bLoadingComplete; + bool m_bAutoattack; + + Common::ZoneingType m_zoningType; + + bool m_bMarkedForZoning; + bool m_bNewAdventurer; + uint64_t m_onlineStatus; + std::shared_ptr< QueuedZoning > m_queuedZoneing; + + // search info + char m_searchMessage[193]; // searchmessage to show in profile + uint8_t m_searchSelectRegion; // regions selected to show up in profile + uint8_t m_searchSelectClass; // class selected to show up in profile + + // gc info + uint8_t m_gc; + uint8_t m_gcRank[3]; + + // content finder info + uint32_t m_cfPenaltyUntil; // unix time + + uint32_t m_mount; + uint32_t m_emoteMode; + + Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator; + Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator; + }; -} } #endif diff --git a/src/servers/sapphire_zone/Actor/SpawnGroup.h b/src/servers/sapphire_zone/Actor/SpawnGroup.h index decfdf9f..6ba85a50 100644 --- a/src/servers/sapphire_zone/Actor/SpawnGroup.h +++ b/src/servers/sapphire_zone/Actor/SpawnGroup.h @@ -3,26 +3,24 @@ #include "ForwardsZone.h" -namespace Core { -namespace Entity { - -class SpawnGroup +namespace Core::Entity { -private: - BNpcTemplatePtr m_bNpcTemplate; - uint32_t m_level; - uint32_t m_spawnCount; + class SpawnGroup + { + private: + BNpcTemplatePtr m_bNpcTemplate; - std::vector< SpawnPointPtr > m_spawnPoints; + uint32_t m_level; + uint32_t m_spawnCount; -public: - SpawnGroup(); + std::vector< SpawnPointPtr > m_spawnPoints; -}; + public: + SpawnGroup(); + + }; } -} - #endif //SAPPHIRE_SPAWNGROUP_H diff --git a/src/servers/sapphire_zone/Actor/SpawnPoint.h b/src/servers/sapphire_zone/Actor/SpawnPoint.h index baf619c0..122ad4a7 100644 --- a/src/servers/sapphire_zone/Actor/SpawnPoint.h +++ b/src/servers/sapphire_zone/Actor/SpawnPoint.h @@ -3,39 +3,37 @@ #include "ForwardsZone.h" -namespace Core { -namespace Entity { - -class SpawnPoint +namespace Core::Entity { -private: - float m_posX; - float m_posY; - float m_posZ; - float m_rotation; - uint32_t m_gimmickId; - uint32_t m_lastSpawn; - BNpcPtr m_pLinkedBnpc; + class SpawnPoint + { + private: + float m_posX; + float m_posY; + float m_posZ; + float m_rotation; + uint32_t m_gimmickId; -public: - SpawnPoint(); - SpawnPoint( float x, float y, float z, float rot, uint32_t gimmickId ); + uint32_t m_lastSpawn; + BNpcPtr m_pLinkedBnpc; - float getPosX() const; - float getPosY() const; - float getPosZ() const; - float getRotation() const; + public: + SpawnPoint(); + SpawnPoint( float x, float y, float z, float rot, uint32_t gimmickId ); - uint32_t getGimmickId() const; + float getPosX() const; + float getPosY() const; + float getPosZ() const; + float getRotation() const; - BNpcPtr getLinkedBNpc(); - void setLinkedBNpc( BNpcPtr pBnpc ); + uint32_t getGimmickId() const; -}; + BNpcPtr getLinkedBNpc(); + void setLinkedBNpc( BNpcPtr pBnpc ); + + }; } -} - #endif //SAPPHIRE_SPAWNPOINT_H diff --git a/src/servers/sapphire_zone/DebugCommand/DebugCommand.h b/src/servers/sapphire_zone/DebugCommand/DebugCommand.h index 98ead02c..5f1394d5 100644 --- a/src/servers/sapphire_zone/DebugCommand/DebugCommand.h +++ b/src/servers/sapphire_zone/DebugCommand/DebugCommand.h @@ -5,57 +5,58 @@ #include "ForwardsZone.h" -namespace Core { - -class DebugCommandHandler; - -class DebugCommand +namespace Core { -public: - using pFunc = void ( DebugCommandHandler::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > ); + class DebugCommandHandler; - // String for the command - std::string m_commandName; - - // command callback - pFunc m_pFunc; - - // helptext - std::string m_helpText; - - // userlevel needed to execute the command - uint8_t m_gmLevel; - - DebugCommand( const std::string& n, pFunc functionPtr, const std::string& hText, uint8_t uLevel ) + class DebugCommand { - m_commandName = n; - m_pFunc = functionPtr; - m_helpText = hText; - m_gmLevel = uLevel; - } + public: - ~DebugCommand() - { + using pFunc = void ( DebugCommandHandler::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > ); - } + // String for the command + std::string m_commandName; - const std::string& getName() const - { - return m_commandName; - } + // command callback + pFunc m_pFunc; - const std::string& getHelpText() const - { - return m_helpText; - } + // helptext + std::string m_helpText; - uint8_t getRequiredGmLevel() const - { - return m_gmLevel; - } + // userlevel needed to execute the command + uint8_t m_gmLevel; -}; + DebugCommand( const std::string& n, pFunc functionPtr, const std::string& hText, uint8_t uLevel ) + { + m_commandName = n; + m_pFunc = functionPtr; + m_helpText = hText; + m_gmLevel = uLevel; + } + + ~DebugCommand() + { + + } + + const std::string& getName() const + { + return m_commandName; + } + + const std::string& getHelpText() const + { + return m_helpText; + } + + uint8_t getRequiredGmLevel() const + { + return m_gmLevel; + } + + }; } diff --git a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp index 784ed338..15059049 100644 --- a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp +++ b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.cpp @@ -38,9 +38,9 @@ extern Core::Framework g_fw; -using namespace Network; -using namespace Network::Packets; -using namespace Network::Packets::Server; +using namespace Core::Network; +using namespace Core::Network::Packets; +using namespace Core::Network::Packets::Server; // instanciate and initialize commands Core::DebugCommandHandler::DebugCommandHandler() diff --git a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.h b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.h index d7894646..89373038 100644 --- a/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.h +++ b/src/servers/sapphire_zone/DebugCommand/DebugCommandHandler.h @@ -7,55 +7,55 @@ #include "DebugCommand.h" #include "ForwardsZone.h" -namespace Core { - - -// handler for in game commands -class DebugCommandHandler +namespace Core { -private: - // container mapping command string to command object - std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap; -public: - DebugCommandHandler(); + // handler for in game commands + class DebugCommandHandler + { + private: + // container mapping command string to command object + std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap; - ~DebugCommandHandler(); + public: + DebugCommandHandler(); - // register command to command map - void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel ); + ~DebugCommandHandler(); - // execute command if registered - void execCommand( char* data, Entity::Player& player ); + // register command to command map + void registerCommand( const std::string& n, DebugCommand::pFunc, const std::string& hText, uint8_t uLevel ); - // help command - void help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + // execute command if registered + void execCommand( char* data, Entity::Player& player ); - // command handler callbacks - void set( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + // help command + void help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void get( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + // command handler callbacks + void set( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - //void debug( char * data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void get( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void injectPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + //void debug( char * data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void injectChatPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void injectPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void replay( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void injectChatPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void replay( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void serverInfo( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void unlockCharacter( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void serverInfo( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void unlockCharacter( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); - void script( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + void instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); -}; + void script( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command ); + + }; } #endif diff --git a/src/servers/sapphire_zone/Event/Director.h b/src/servers/sapphire_zone/Event/Director.h index 346c1e4a..a5ac3914 100644 --- a/src/servers/sapphire_zone/Event/Director.h +++ b/src/servers/sapphire_zone/Event/Director.h @@ -5,177 +5,174 @@ #include "ForwardsZone.h" -namespace Core { -namespace Event { - -/*! -\class Director -\brief Base class for all Directors implements sequence and variables - -*/ - -class Director +namespace Core::Event { -public: - enum DirectorType + /*! + \class Director + \brief Base class for all Directors implements sequence and variables + + */ + + class Director { - BattleLeve = 0x8001, - GatheringLeve = 0x8002, - InstanceContent = 0x8003, // used for dungeons/raids - PublicContent = 0x8004, - QuestBattle = 0x8006, - CompanyLeve = 0x8007, - GoldSaucer = 0x800A, - DpsChallange = 0x800D, - Fate = 0x801A + + public: + enum DirectorType + { + BattleLeve = 0x8001, + GatheringLeve = 0x8002, + InstanceContent = 0x8003, // used for dungeons/raids + PublicContent = 0x8004, + QuestBattle = 0x8006, + CompanyLeve = 0x8007, + GoldSaucer = 0x800A, + DpsChallange = 0x800D, + Fate = 0x801A + + }; + + Director( DirectorType type, uint16_t contentId ); + + uint32_t getDirectorId() const; + + uint16_t getContentId() const; + + DirectorType getType() const; + + uint8_t getSequence() const; + + uint8_t getBranch() const; + + void sendDirectorInit( Entity::Player& player ) const; + + void sendDirectorClear( Entity::Player& player ) const; + + void sendDirectorVars( Entity::Player& player ) const; + + void setDirectorUI8AL( uint8_t value ); + + void setDirectorUI8AH( uint8_t value ); + + void setDirectorUI8BL( uint8_t value ); + + void setDirectorUI8BH( uint8_t value ); + + void setDirectorUI8CL( uint8_t value ); + + void setDirectorUI8CH( uint8_t value ); + + void setDirectorUI8DL( uint8_t value ); + + void setDirectorUI8DH( uint8_t value ); + + void setDirectorUI8EL( uint8_t value ); + + void setDirectorUI8EH( uint8_t value ); + + void setDirectorUI8FL( uint8_t value ); + + void setDirectorUI8FH( uint8_t value ); + + void setDirectorUI8GL( uint8_t value ); + + void setDirectorUI8GH( uint8_t value ); + + void setDirectorUI8HL( uint8_t value ); + + void setDirectorUI8HH( uint8_t value ); + + void setDirectorUI8IL( uint8_t value ); + + void setDirectorUI8IH( uint8_t value ); + + void setDirectorUI8JL( uint8_t value ); + + void setDirectorUI8JH( uint8_t value ); + + void setDirectorSequence( uint8_t value ); + + void setDirectorBranch( uint8_t value ); + + private: + /*! Id of the content of the director */ + uint16_t m_contentId; + + /*! DirectorType | ContentId */ + uint32_t m_directorId; + + /*! currect sequence */ + uint8_t m_sequence; + + /*! current branch */ + uint8_t m_branch; + + union + { + struct UI8LH + { + 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 UI8GL : 4; + uint8_t UI8GH : 4; + uint8_t UI8HL : 4; + uint8_t UI8HH : 4; + uint8_t UI8IL : 4; + uint8_t UI8IH : 4; + uint8_t UI8JL : 4; + uint8_t UI8JH : 4; + } ui8lh; + + struct UI8 + { + uint8_t UI8A; + uint8_t UI8B; + uint8_t UI8C; + uint8_t UI8D; + uint8_t UI8E; + uint8_t UI8F; + uint8_t UI8G; + uint8_t UI8H; + uint8_t UI8I; + uint8_t UI8J; + } ui8; + + struct FLAGS + { + uint8_t flags80; + uint8_t flags72; + uint8_t flags64; + uint8_t flags56; + uint8_t flags48; + uint8_t flags40; + uint8_t flags32; + uint8_t flags24; + uint8_t flags16; + uint8_t flags8; + } flags; + + /*! raw storage for flags/vars */ + uint8_t arrData[10]; + } m_unionData; + + /*! type of the director */ + DirectorType m_type; + + uint32_t m_elapsedTime; + }; - Director( DirectorType type, uint16_t contentId ); - - uint32_t getDirectorId() const; - - uint16_t getContentId() const; - - DirectorType getType() const; - - uint8_t getSequence() const; - - uint8_t getBranch() const; - - void sendDirectorInit( Entity::Player& player ) const; - - void sendDirectorClear( Entity::Player& player ) const; - - void sendDirectorVars( Entity::Player& player ) const; - - void setDirectorUI8AL( uint8_t value ); - - void setDirectorUI8AH( uint8_t value ); - - void setDirectorUI8BL( uint8_t value ); - - void setDirectorUI8BH( uint8_t value ); - - void setDirectorUI8CL( uint8_t value ); - - void setDirectorUI8CH( uint8_t value ); - - void setDirectorUI8DL( uint8_t value ); - - void setDirectorUI8DH( uint8_t value ); - - void setDirectorUI8EL( uint8_t value ); - - void setDirectorUI8EH( uint8_t value ); - - void setDirectorUI8FL( uint8_t value ); - - void setDirectorUI8FH( uint8_t value ); - - void setDirectorUI8GL( uint8_t value ); - - void setDirectorUI8GH( uint8_t value ); - - void setDirectorUI8HL( uint8_t value ); - - void setDirectorUI8HH( uint8_t value ); - - void setDirectorUI8IL( uint8_t value ); - - void setDirectorUI8IH( uint8_t value ); - - void setDirectorUI8JL( uint8_t value ); - - void setDirectorUI8JH( uint8_t value ); - - void setDirectorSequence( uint8_t value ); - - void setDirectorBranch( uint8_t value ); - -private: - /*! Id of the content of the director */ - uint16_t m_contentId; - - /*! DirectorType | ContentId */ - uint32_t m_directorId; - - /*! currect sequence */ - uint8_t m_sequence; - - /*! current branch */ - uint8_t m_branch; - - union - { - struct UI8LH - { - 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 UI8GL : 4; - uint8_t UI8GH : 4; - uint8_t UI8HL : 4; - uint8_t UI8HH : 4; - uint8_t UI8IL : 4; - uint8_t UI8IH : 4; - uint8_t UI8JL : 4; - uint8_t UI8JH : 4; - } ui8lh; - - struct UI8 - { - uint8_t UI8A; - uint8_t UI8B; - uint8_t UI8C; - uint8_t UI8D; - uint8_t UI8E; - uint8_t UI8F; - uint8_t UI8G; - uint8_t UI8H; - uint8_t UI8I; - uint8_t UI8J; - } ui8; - - struct FLAGS - { - uint8_t flags80; - uint8_t flags72; - uint8_t flags64; - uint8_t flags56; - uint8_t flags48; - uint8_t flags40; - uint8_t flags32; - uint8_t flags24; - uint8_t flags16; - uint8_t flags8; - } flags; - - /*! raw storage for flags/vars */ - uint8_t arrData[10]; - } m_unionData; - - /*! type of the director */ - DirectorType m_type; - - uint32_t m_elapsedTime; - - -}; - - } -} - #endif //SAPPHIRE_DIRECTOR_H diff --git a/src/servers/sapphire_zone/Event/EventDefs.h b/src/servers/sapphire_zone/Event/EventDefs.h index 2d140ade..26247b34 100644 --- a/src/servers/sapphire_zone/Event/EventDefs.h +++ b/src/servers/sapphire_zone/Event/EventDefs.h @@ -1,83 +1,83 @@ #ifndef SAPPHIRE_EVENTDEFS_H #define SAPPHIRE_EVENTDEFS_H -namespace Core { -enum EventFlags +namespace Core { - NONE = 0, - NO_DEFAULT_CAMERA = 0x00000001, - FADE_OUT = 0x00000002, - INVIS_ENPC = 0x00000004, - INVIS_EOBJ = 0x00000008, - INVIS_BNPC = 0x00000010, - INVIS_OTHER_PC = 0x00000020, - INVIS_PARTY_PC = 0x00000040, - INVIS_PARTY_BUDDY = 0x10000000, - INVIS_GATHERING_POINT = 0x00000080, - INVIS_AETHERYTE = 0x00000100, - INVIS_TREASURE = 0x00000200, - CONDITION_CUTSCENE = 0x00000400, - HIDE_UI = 0x00000800, - INVIS_ALL = 0xF80003FC, - AUTO_LOC_CAMERA = 0x00001000, - HIDE_HOTBAR = 0x00002000, - INVINCIBLE = 0x00004000, - SILENT_ENTER_TERRI_ENV = 0x00008000, - SILENT_ENTER_TERRI_BGM = 0x00010000, - SILENT_ENTER_TERRI_SE = 0x00020000, - SILENT_ENTER_TERRI_ALL = 0x00038000, - DISABLE_SKIP = 0x00080000, - HIDE_FESTIVAL = 0x00200000, - DISABLE_STEALTH = 0x00400000, - ROLLBACK_HIDE_UI = 0x00800000, - LOCK_HUD = 0x01000000, - LOCK_HOTBAR = 0x02000000, - DISABLE_CANCEL_EMOTE = 0x04000000, - INVIS_AOE = 0x08000000, - INVIS_ALLIANCE_PC = 0x20000000, - INVIS_ALLIANCE_BUDDY = 0x40000000, - INVIS_COMPANION = 0x80000000, - SET_BASE = 0xF8400EFB, - SET_INVIS_BASE = 0xF8400FFF, - SET_EOBJ_BASE = 0xF8400EF3 -}; + enum EventFlags + { + NONE = 0, + NO_DEFAULT_CAMERA = 0x00000001, + FADE_OUT = 0x00000002, + INVIS_ENPC = 0x00000004, + INVIS_EOBJ = 0x00000008, + INVIS_BNPC = 0x00000010, + INVIS_OTHER_PC = 0x00000020, + INVIS_PARTY_PC = 0x00000040, + INVIS_PARTY_BUDDY = 0x10000000, + INVIS_GATHERING_POINT = 0x00000080, + INVIS_AETHERYTE = 0x00000100, + INVIS_TREASURE = 0x00000200, + CONDITION_CUTSCENE = 0x00000400, + HIDE_UI = 0x00000800, + INVIS_ALL = 0xF80003FC, + AUTO_LOC_CAMERA = 0x00001000, + HIDE_HOTBAR = 0x00002000, + INVINCIBLE = 0x00004000, + SILENT_ENTER_TERRI_ENV = 0x00008000, + SILENT_ENTER_TERRI_BGM = 0x00010000, + SILENT_ENTER_TERRI_SE = 0x00020000, + SILENT_ENTER_TERRI_ALL = 0x00038000, + DISABLE_SKIP = 0x00080000, + HIDE_FESTIVAL = 0x00200000, + DISABLE_STEALTH = 0x00400000, + ROLLBACK_HIDE_UI = 0x00800000, + LOCK_HUD = 0x01000000, + LOCK_HOTBAR = 0x02000000, + DISABLE_CANCEL_EMOTE = 0x04000000, + INVIS_AOE = 0x08000000, + INVIS_ALLIANCE_PC = 0x20000000, + INVIS_ALLIANCE_BUDDY = 0x40000000, + INVIS_COMPANION = 0x80000000, + SET_BASE = 0xF8400EFB, + SET_INVIS_BASE = 0xF8400FFF, + SET_EOBJ_BASE = 0xF8400EF3 + }; -enum EventTypes -{ - EVENT_TALK = 1, - EVENT_EMOTE = 2, - EVENT_DISTANCE_BELOW = 3, - EVENT_DISTANCE_OVER = 4, - EVENT_BATTLE_REWARD = 5, - EVENT_CRAFT = 6, - EVENT_NEST = 7, - EVENT_EVENT_ITEM = 8, - EVENT_DROP = 9, - EVENT_WITHIN_RANGE = 10, - EVENT_OUTSIDE_RANGE = 11, - EVENT_GAME_START = 12, - EVENT_GAME_PROGRESS = 13, - EVENT_ENTER_TERRITORY = 15, - EVENT_GAME_COME_BACK = 17, - EVENT_ACTION_RESULT = 18, - EVENT_MATERIA_CRAFT = 19, - EVENT_FISHING = 20, - EVENT_UI = 21, - EVENT_HOUSING = 22, - EVENT_SAY = 23, - EVENT_TABLE_GAME = 24 -}; - -enum DamageType -{ - STD_DAMAGE = 0X03, - STD_HEAL = 0X04, - STD_MP_LOSS = 0X0A, - STD_MP_GAIN = 0X0B, - STD_TP_LOSS = 0X0C, - STD_TP_GAIN = 0X0D -}; + enum EventTypes + { + EVENT_TALK = 1, + EVENT_EMOTE = 2, + EVENT_DISTANCE_BELOW = 3, + EVENT_DISTANCE_OVER = 4, + EVENT_BATTLE_REWARD = 5, + EVENT_CRAFT = 6, + EVENT_NEST = 7, + EVENT_EVENT_ITEM = 8, + EVENT_DROP = 9, + EVENT_WITHIN_RANGE = 10, + EVENT_OUTSIDE_RANGE = 11, + EVENT_GAME_START = 12, + EVENT_GAME_PROGRESS = 13, + EVENT_ENTER_TERRITORY = 15, + EVENT_GAME_COME_BACK = 17, + EVENT_ACTION_RESULT = 18, + EVENT_MATERIA_CRAFT = 19, + EVENT_FISHING = 20, + EVENT_UI = 21, + EVENT_HOUSING = 22, + EVENT_SAY = 23, + EVENT_TABLE_GAME = 24 + }; + enum DamageType + { + STD_DAMAGE = 0X03, + STD_HEAL = 0X04, + STD_MP_LOSS = 0X0A, + STD_MP_GAIN = 0X0B, + STD_TP_LOSS = 0X0C, + STD_TP_GAIN = 0X0D + }; } diff --git a/src/servers/sapphire_zone/Event/EventHandler.h b/src/servers/sapphire_zone/Event/EventHandler.h index 219142e3..513986f8 100644 --- a/src/servers/sapphire_zone/Event/EventHandler.h +++ b/src/servers/sapphire_zone/Event/EventHandler.h @@ -3,130 +3,129 @@ #include "ForwardsZone.h" -namespace Core { -namespace Event { - -struct SceneResult +namespace Core::Event { - uint32_t eventId; - uint16_t param1; - uint16_t param2; - uint16_t param3; - uint16_t param4; -}; -class EventHandler -{ -public: - enum EventType : uint8_t + struct SceneResult { - Talk = 1, - Emote = 2, - DistanceBelow = 3, - DistanceOver = 4, - BattleReward = 5, - Craft = 6, - Nest = 7, - Item = 8, - Drop = 9, - WithinRange = 10, - OutsideRange = 11, - GameStart = 12, - GameProgress = 13, - EnterTerritory = 15, - GameComeBack = 17, - ActionResult = 18, - MateriaCraft = 19, - Fishing = 20, - UI = 21, - Housing = 22, - Say = 23, - TableGame = 24, + uint32_t eventId; + uint16_t param1; + uint16_t param2; + uint16_t param3; + uint16_t param4; }; - enum EventHandlerType : uint16_t + class EventHandler { - Quest = 0x0001, - Warp = 0x0002, - Unknown = 0x0003, // Came up in the client with "Begin" unsure that means - Shop = 0x0004, - Aetheryte = 0x0005, - GuildLeveAssignment = 0x0006, - DefaultTalk = 0x0009, - CustomTalk = 0x000B, - CompanyLeveOfficer = 0x000C, - CraftLeve = 0x000E, - GimmickAccessor = 0x000F, - GimmickBill = 0x0010, - GimmickRect = 0x0011, - ChocoboTaxiStand = 0x0012, - Opening = 0x0013, - ExitRange = 0x0014, - GCShop = 0x0016, - GuildOrderGuide = 0x0017, - GuildOrderOfficer = 0x0018, - ContentNpc = 0x0019, - Story = 0x001A, - SpecialShop = 0x001B, - BahamutGuide = 0x001C, - FcTalk = 0x001F, - ICDirector = 0x8003, + public: + enum EventType : uint8_t + { + Talk = 1, + Emote = 2, + DistanceBelow = 3, + DistanceOver = 4, + BattleReward = 5, + Craft = 6, + Nest = 7, + Item = 8, + Drop = 9, + WithinRange = 10, + OutsideRange = 11, + GameStart = 12, + GameProgress = 13, + EnterTerritory = 15, + GameComeBack = 17, + ActionResult = 18, + MateriaCraft = 19, + Fishing = 20, + UI = 21, + Housing = 22, + Say = 23, + TableGame = 24, + }; + + enum EventHandlerType : uint16_t + { + Quest = 0x0001, + Warp = 0x0002, + Unknown = 0x0003, // Came up in the client with "Begin" unsure that means + Shop = 0x0004, + Aetheryte = 0x0005, + GuildLeveAssignment = 0x0006, + DefaultTalk = 0x0009, + CustomTalk = 0x000B, + CompanyLeveOfficer = 0x000C, + CraftLeve = 0x000E, + GimmickAccessor = 0x000F, + GimmickBill = 0x0010, + GimmickRect = 0x0011, + ChocoboTaxiStand = 0x0012, + Opening = 0x0013, + ExitRange = 0x0014, + GCShop = 0x0016, + GuildOrderGuide = 0x0017, + GuildOrderOfficer = 0x0018, + ContentNpc = 0x0019, + Story = 0x001A, + SpecialShop = 0x001B, + BahamutGuide = 0x001C, + FcTalk = 0x001F, + ICDirector = 0x8003, + }; + + using SceneReturnCallback = std::function< void( Entity::Player&, const SceneResult& ) >; + using SceneChainCallback = std::function< void( Entity::Player& ) >; + + EventHandler( Entity::Player* pOwner, uint64_t actorId, uint32_t eventId, EventType eventType, + uint32_t eventParam ); + + ~EventHandler() + { + } + + uint64_t getActorId() const; + + uint32_t getId() const; + + uint16_t getType() const; + + uint16_t getEntryId() const; + + uint8_t getEventType() const; + + uint32_t getEventParam() const; + + bool hasPlayedScene() const; + + void setPlayedScene( bool playedScene ); + + SceneReturnCallback getEventReturnCallback() const; + + void setEventReturnCallback( SceneReturnCallback callback ); + + SceneChainCallback getSceneChainCallback() const; + + void setSceneChainCallback( SceneChainCallback callback ); + + bool hasNestedEvent() const; + + void removeNestedEvent(); + + + protected: + Entity::Player* m_pOwner; + + uint64_t m_actorId; + uint32_t m_eventId; + uint16_t m_entryId; + uint16_t m_type; + uint8_t m_eventType; + uint32_t m_eventParam; + EventHandlerPtr m_pNestedEvent; + bool m_playedScene; + SceneReturnCallback m_returnCallback; + SceneChainCallback m_chainCallback; }; - using SceneReturnCallback = std::function< void( Entity::Player&, const SceneResult& ) >; - using SceneChainCallback = std::function< void( Entity::Player& ) >; - - EventHandler( Entity::Player* pOwner, uint64_t actorId, uint32_t eventId, EventType eventType, - uint32_t eventParam ); - - ~EventHandler() - { - } - - uint64_t getActorId() const; - - uint32_t getId() const; - - uint16_t getType() const; - - uint16_t getEntryId() const; - - uint8_t getEventType() const; - - uint32_t getEventParam() const; - - bool hasPlayedScene() const; - - void setPlayedScene( bool playedScene ); - - SceneReturnCallback getEventReturnCallback() const; - - void setEventReturnCallback( SceneReturnCallback callback ); - - SceneChainCallback getSceneChainCallback() const; - - void setSceneChainCallback( SceneChainCallback callback ); - - bool hasNestedEvent() const; - - void removeNestedEvent(); - - -protected: - Entity::Player* m_pOwner; - - uint64_t m_actorId; - uint32_t m_eventId; - uint16_t m_entryId; - uint16_t m_type; - uint8_t m_eventType; - uint32_t m_eventParam; - EventHandlerPtr m_pNestedEvent; - bool m_playedScene; - SceneReturnCallback m_returnCallback; - SceneChainCallback m_chainCallback; -}; - -} } #endif diff --git a/src/servers/sapphire_zone/Event/EventHelper.h b/src/servers/sapphire_zone/Event/EventHelper.h index e74b431f..8beaac35 100644 --- a/src/servers/sapphire_zone/Event/EventHelper.h +++ b/src/servers/sapphire_zone/Event/EventHelper.h @@ -4,12 +4,12 @@ #include #include -namespace Core { -namespace Event { +namespace Core::Event +{ -std::string getEventName( uint32_t eventId ); + std::string getEventName( uint32_t eventId ); + uint32_t mapEventActorToRealActor( uint32_t eventActorId ); -uint32_t mapEventActorToRealActor( uint32_t eventActorId ); -} } + #endif diff --git a/src/servers/sapphire_zone/Inventory/Item.h b/src/servers/sapphire_zone/Inventory/Item.h index ba6c56c5..9927d126 100644 --- a/src/servers/sapphire_zone/Inventory/Item.h +++ b/src/servers/sapphire_zone/Inventory/Item.h @@ -3,91 +3,92 @@ #include -namespace Core { - -class Item +namespace Core { -public: - Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, bool isHq = false ); + class Item + { - ~Item() = default; + public: + Item( uint64_t uId, uint32_t catalogId, uint64_t model1, uint64_t model2, bool isHq = false ); - uint32_t getId() const; + ~Item() = default; - void setId( uint32_t id ); + uint32_t getId() const; - uint64_t getUId() const; + void setId( uint32_t id ); - void setUId( uint64_t id ); + uint64_t getUId() const; - void setStackSize( uint32_t size ); + void setUId( uint64_t id ); - uint32_t getStackSize() const; + void setStackSize( uint32_t size ); - void setCategory( Common::ItemUICategory categoryId ); + uint32_t getStackSize() const; - Common::ItemUICategory getCategory() const; + void setCategory( Common::ItemUICategory categoryId ); - void setModelIds( uint64_t model1, uint64_t model2 ); + Common::ItemUICategory getCategory() const; - uint64_t getModelId1() const; + void setModelIds( uint64_t model1, uint64_t model2 ); - uint64_t getModelId2() const; + uint64_t getModelId1() const; - bool isHq() const; + uint64_t getModelId2() const; - void setHq( bool isHq ); + bool isHq() const; - uint16_t getDelay() const; + void setHq( bool isHq ); - uint16_t getPhysicalDmg() const; + uint16_t getDelay() const; - uint16_t getMagicalDmg() const; + uint16_t getPhysicalDmg() const; - uint16_t getWeaponDmg() const; + uint16_t getMagicalDmg() const; - bool isWeapon() const; + uint16_t getWeaponDmg() const; - float getAutoAttackDmg() const; + bool isWeapon() const; - uint16_t getItemLevel() const; + float getAutoAttackDmg() const; - uint32_t getMaxStackSize() const; + uint16_t getItemLevel() const; - uint16_t getDurability() const; - void setDurability( uint16_t durability ); + uint32_t getMaxStackSize() const; - uint16_t getStain() const; - void setStain( uint16_t stain ); + uint16_t getDurability() const; + void setDurability( uint16_t durability ); + + uint16_t getStain() const; + void setStain( uint16_t stain ); -protected: - uint32_t m_id; + protected: + uint32_t m_id; - uint64_t m_uId; + uint64_t m_uId; - Common::ItemUICategory m_category; + Common::ItemUICategory m_category; - uint32_t m_stackSize; - uint32_t m_maxStackSize; - std::vector< uint8_t > m_classJobList; + uint32_t m_stackSize; + uint32_t m_maxStackSize; + std::vector< uint8_t > m_classJobList; - uint64_t m_model1; - uint64_t m_model2; + uint64_t m_model1; + uint64_t m_model2; - bool m_isHq; + bool m_isHq; - uint16_t m_delayMs; - uint16_t m_physicalDmg; - uint16_t m_magicalDmg; - uint16_t m_weaponDmg; - float m_autoAttackDmg; - uint16_t m_itemLevel; - uint16_t m_durability; - uint16_t m_stain; + uint16_t m_delayMs; + uint16_t m_physicalDmg; + uint16_t m_magicalDmg; + uint16_t m_weaponDmg; + float m_autoAttackDmg; + uint16_t m_itemLevel; + uint16_t m_durability; + uint16_t m_stain; -}; + }; } diff --git a/src/servers/sapphire_zone/Inventory/ItemContainer.h b/src/servers/sapphire_zone/Inventory/ItemContainer.h index 3cb987b8..d463087e 100644 --- a/src/servers/sapphire_zone/Inventory/ItemContainer.h +++ b/src/servers/sapphire_zone/Inventory/ItemContainer.h @@ -2,57 +2,56 @@ #define _ITEMCONTAINER_H_ #include - #include - #include "ForwardsZone.h" -namespace Core { - -using ItemMap = std::map< uint8_t, ItemPtr >; - -class ItemContainer +namespace Core { -public: - ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName, bool isMultiStorage, - bool isPersistentStorage = true ); + using ItemMap = std::map< uint8_t, ItemPtr >; - ~ItemContainer(); + class ItemContainer + { - uint16_t getId() const; + public: + ItemContainer( uint16_t storageId, uint8_t maxSize, const std::string& tableName, bool isMultiStorage, + bool isPersistentStorage = true ); - uint8_t getEntryCount() const; + ~ItemContainer(); - void removeItem( uint8_t slotId ); + uint16_t getId() const; - ItemMap& getItemMap(); + uint8_t getEntryCount() const; - const ItemMap& getItemMap() const; + void removeItem( uint8_t slotId ); - ItemPtr getItem( uint8_t slotId ); + ItemMap& getItemMap(); - void setItem( uint8_t slotId, ItemPtr item ); + const ItemMap& getItemMap() const; - int8_t getFreeSlot(); + ItemPtr getItem( uint8_t slotId ); - uint8_t getMaxSize() const; + void setItem( uint8_t slotId, ItemPtr item ); - std::string getTableName() const; + int8_t getFreeSlot(); - bool isMultiStorage() const; + uint8_t getMaxSize() const; - bool isPersistentStorage() const; + std::string getTableName() const; -private: - uint16_t m_id; - uint8_t m_size; - std::string m_tableName; - bool m_bMultiStorage; - bool m_isPersistentStorage; - ItemMap m_itemMap; - Entity::PlayerPtr m_pOwner; -}; + bool isMultiStorage() const; + + bool isPersistentStorage() const; + + private: + uint16_t m_id; + uint8_t m_size; + std::string m_tableName; + bool m_bMultiStorage; + bool m_isPersistentStorage; + ItemMap m_itemMap; + Entity::PlayerPtr m_pOwner; + }; } diff --git a/src/servers/sapphire_zone/Inventory/ItemUtil.h b/src/servers/sapphire_zone/Inventory/ItemUtil.h index 16fdaed4..b8d46c38 100644 --- a/src/servers/sapphire_zone/Inventory/ItemUtil.h +++ b/src/servers/sapphire_zone/Inventory/ItemUtil.h @@ -4,28 +4,24 @@ #include #include "ForwardsZone.h" -namespace Core { -namespace Items { -namespace Util { +namespace Core::Items::Util +{ -ItemPtr loadItem( uint64_t uId ); + ItemPtr loadItem( uint64_t uId ); -/*! check if weapon category qualifies the weapon as onehanded */ -bool isOneHandedWeapon( Common::ItemUICategory weaponCategory ); + /*! check if weapon category qualifies the weapon as onehanded */ + bool isOneHandedWeapon( Common::ItemUICategory weaponCategory ); -bool isArmory( uint16_t containerId ); + bool isArmory( uint16_t containerId ); -bool isEquipment( uint16_t containerId ); + bool isEquipment( uint16_t containerId ); -uint16_t getCharaEquipSlotCategoryToArmoryId( uint8_t slotId ); + uint16_t getCharaEquipSlotCategoryToArmoryId( uint8_t slotId ); -Common::ContainerType getContainerType( uint32_t containerId ); + Common::ContainerType getContainerType( uint32_t containerId ); -uint32_t getNextUId(); + uint32_t getNextUId(); } -} -} - #endif //SAPPHIRE_ITEMMGR_H diff --git a/src/servers/sapphire_zone/Linkshell/Linkshell.h b/src/servers/sapphire_zone/Linkshell/Linkshell.h index 2f4137c0..af153dad 100644 --- a/src/servers/sapphire_zone/Linkshell/Linkshell.h +++ b/src/servers/sapphire_zone/Linkshell/Linkshell.h @@ -4,64 +4,64 @@ #include #include -namespace Core { - -class Linkshell +namespace Core { -private: - /*! unique ID of the linkshell */ - uint64_t m_linkshellId; - /*! ID of the master character */ - uint64_t m_masterCharacterId; - /*! ID list of all linkshell members */ - std::set< uint64_t > m_memberIds; - /*! Name of the linkshell */ - std::string m_name; - /*! List of member IDs with leader rank */ - std::set< uint64_t > m_leaderIds; - /*! list of IDs of pending character invites */ - std::set< uint64_t > m_inviteIds; -public: - Linkshell( uint64_t id, - const std::string& name, - uint64_t masterId, - const std::set< uint64_t >& members, - const std::set< uint64_t >& leaders, - const std::set< uint64_t >& invites ); + class Linkshell + { + private: + /*! unique ID of the linkshell */ + uint64_t m_linkshellId; + /*! ID of the master character */ + uint64_t m_masterCharacterId; + /*! ID list of all linkshell members */ + std::set< uint64_t > m_memberIds; + /*! Name of the linkshell */ + std::string m_name; + /*! List of member IDs with leader rank */ + std::set< uint64_t > m_leaderIds; + /*! list of IDs of pending character invites */ + std::set< uint64_t > m_inviteIds; - uint64_t getId() const; + public: + Linkshell( uint64_t id, + const std::string& name, + uint64_t masterId, + const std::set< uint64_t >& members, + const std::set< uint64_t >& leaders, + const std::set< uint64_t >& invites ); - const std::string& getName() const; + uint64_t getId() const; - uint64_t getMasterId() const; + const std::string& getName() const; - const std::set< uint64_t >& getMemberIdList() const; + uint64_t getMasterId() const; - std::set< uint64_t >& getMemberIdList(); + const std::set< uint64_t >& getMemberIdList() const; - const std::set< uint64_t >& getLeaderIdList() const; + std::set< uint64_t >& getMemberIdList(); - std::set< uint64_t >& getLeaderIdList(); + const std::set< uint64_t >& getLeaderIdList() const; - const std::set< uint64_t >& getInviteIdList() const; + std::set< uint64_t >& getLeaderIdList(); - std::set< uint64_t >& getInviteIdList(); + const std::set< uint64_t >& getInviteIdList() const; - void addMember( uint64_t memberId ); + std::set< uint64_t >& getInviteIdList(); - void removeMember( uint64_t memberId ); + void addMember( uint64_t memberId ); - void addLeader( uint64_t memberId ); + void removeMember( uint64_t memberId ); - void removeLeader( uint64_t memberId ); + void addLeader( uint64_t memberId ); - void addInvite( uint64_t memberId ); + void removeLeader( uint64_t memberId ); - void removeInvite( uint64_t memberId ); + void addInvite( uint64_t memberId ); + void removeInvite( uint64_t memberId ); -}; + }; } #endif //SAPPHIRE_LINKSHELL_H diff --git a/src/servers/sapphire_zone/Linkshell/LinkshellMgr.h b/src/servers/sapphire_zone/Linkshell/LinkshellMgr.h index f9fba3da..dedd3c70 100644 --- a/src/servers/sapphire_zone/Linkshell/LinkshellMgr.h +++ b/src/servers/sapphire_zone/Linkshell/LinkshellMgr.h @@ -4,26 +4,27 @@ #include #include -namespace Core { -class Linkshell; - -using LinkshellPtr = std::shared_ptr< Linkshell >; - -class LinkshellMgr +namespace Core { -private: - std::map< uint64_t, LinkshellPtr > m_linkshellIdMap; - std::map< std::string, LinkshellPtr > m_linkshellNameMap; + class Linkshell; - LinkshellPtr getLinkshellByName( const std::string& name ); + using LinkshellPtr = std::shared_ptr< Linkshell >; - LinkshellPtr getLinkshellById( uint64_t lsId ); + class LinkshellMgr + { + private: + std::map< uint64_t, LinkshellPtr > m_linkshellIdMap; + std::map< std::string, LinkshellPtr > m_linkshellNameMap; -public: - LinkshellMgr(); + LinkshellPtr getLinkshellByName( const std::string& name ); - bool loadLinkshells(); -}; + LinkshellPtr getLinkshellById( uint64_t lsId ); + + public: + LinkshellMgr(); + + bool loadLinkshells(); + }; } #endif //CORE_LINKSHELLMGR_H diff --git a/src/servers/sapphire_zone/Math/CalcBattle.h b/src/servers/sapphire_zone/Math/CalcBattle.h index 46887774..36f33c77 100644 --- a/src/servers/sapphire_zone/Math/CalcBattle.h +++ b/src/servers/sapphire_zone/Math/CalcBattle.h @@ -4,21 +4,16 @@ #include #include "Forwards.h" -using namespace Core::Entity; - -namespace Core { -namespace Math { - -class CalcBattle +namespace Core::Math { -public: - static uint32_t calculateHealValue( PlayerPtr pPlayer, uint32_t potency ); -private: + class CalcBattle + { + public: + static uint32_t calculateHealValue( Core::Entity::PlayerPtr pPlayer, uint32_t potency ); -}; + }; -} } #endif diff --git a/src/servers/sapphire_zone/Math/CalcStats.h b/src/servers/sapphire_zone/Math/CalcStats.h index 2c9f5785..9e19477c 100644 --- a/src/servers/sapphire_zone/Math/CalcStats.h +++ b/src/servers/sapphire_zone/Math/CalcStats.h @@ -4,25 +4,22 @@ #include #include "Forwards.h" -using namespace Core::Entity; - -namespace Core { -namespace Math { - -class CalcStats +namespace Core::Math { -public: - static float calculateBaseStat( PlayerPtr pPlayer ); - static uint32_t calculateMaxMp( PlayerPtr pPlayer ); + class CalcStats + { + public: + static float calculateBaseStat( Core::Entity::PlayerPtr pPlayer ); - static uint32_t calculateMaxHp( PlayerPtr pPlayer ); + static uint32_t calculateMaxMp( Core::Entity::PlayerPtr pPlayer ); -private: + static uint32_t calculateMaxHp( Core::Entity::PlayerPtr pPlayer ); -}; + private: + + }; -} } #endif diff --git a/src/servers/sapphire_zone/Network/GameConnection.h b/src/servers/sapphire_zone/Network/GameConnection.h index 8d735e86..1138a5fc 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.h +++ b/src/servers/sapphire_zone/Network/GameConnection.h @@ -11,162 +11,161 @@ #define DECLARE_HANDLER( x ) void x( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket, Entity::Player& player ) -namespace Core { -namespace Network { -namespace Packets { -class GamePacket; -} -enum ConnectionType : - uint8_t +namespace Core::Network::Packets { - Zone = 1, - Chat = 2, - Lobby = 3, - None -}; + class GamePacket; +} -class GameConnection : public Connection +namespace Core::Network { -private: - typedef void ( GameConnection::* Handler )( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket, - Entity::Player& player ); + enum ConnectionType : uint8_t + { + Zone = 1, + Chat = 2, + Lobby = 3, + None + }; - using HandlerMap = std::map< uint16_t, Handler >; - using HandlerStrMap = std::map< uint16_t, std::string >; + class GameConnection : public Connection + { - AcceptorPtr m_pAcceptor; + private: + typedef void ( GameConnection::* Handler )( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket, + Entity::Player& player ); - // handler for game packets ( main type 0x03, connection type 1 ) - HandlerMap m_zoneHandlerMap; - HandlerStrMap m_zoneHandlerStrMap; + using HandlerMap = std::map< uint16_t, Handler >; + using HandlerStrMap = std::map< uint16_t, std::string >; - // handler for game packets ( main type 0x03, connection type 2 ) - HandlerMap m_chatHandlerMap; - HandlerStrMap m_chatHandlerStrMap; + AcceptorPtr m_pAcceptor; - SessionPtr m_pSession; + // handler for game packets ( main type 0x03, connection type 1 ) + HandlerMap m_zoneHandlerMap; + HandlerStrMap m_zoneHandlerStrMap; - LockedQueue< Core::Network::Packets::FFXIVARR_PACKET_RAW > m_inQueue; - LockedQueue< Packets::FFXIVPacketBasePtr > m_outQueue; + // handler for game packets ( main type 0x03, connection type 2 ) + HandlerMap m_chatHandlerMap; + HandlerStrMap m_chatHandlerStrMap; -public: - ConnectionType m_conType; + SessionPtr m_pSession; - GameConnection( HivePtr pHive, AcceptorPtr pAcceptor ); + LockedQueue< Core::Network::Packets::FFXIVARR_PACKET_RAW > m_inQueue; + LockedQueue< Packets::FFXIVPacketBasePtr > m_outQueue; - ~GameConnection(); + public: + ConnectionType m_conType; - // overwrite the parents onConnect for our game socket needs - void OnAccept( const std::string& host, uint16_t port ) override; + GameConnection( HivePtr pHive, AcceptorPtr pAcceptor ); - void OnDisconnect() override; + ~GameConnection(); - void OnRecv( std::vector< uint8_t >& buffer ) override; + // overwrite the parents onConnect for our game socket needs + void OnAccept( const std::string& host, uint16_t port ) override; - void OnError( const asio::error_code& error ) override; + void OnDisconnect() override; - void handlePackets( const Packets::FFXIVARR_PACKET_HEADER& ipcHeader, - const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData ); + void OnRecv( std::vector< uint8_t >& buffer ) override; - void queueInPacket( Core::Network::Packets::FFXIVARR_PACKET_RAW inPacket ); + void OnError( const asio::error_code& error ) override; - void queueOutPacket( Packets::FFXIVPacketBasePtr outPacket ); + void handlePackets( const Packets::FFXIVARR_PACKET_HEADER& ipcHeader, + const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData ); - void processInQueue(); + void queueInPacket( Core::Network::Packets::FFXIVARR_PACKET_RAW inPacket ); - void processOutQueue(); + void queueOutPacket( Packets::FFXIVPacketBasePtr outPacket ); - void handlePacket( Core::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); + void processInQueue(); - void handleZonePacket( Core::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); + void processOutQueue(); - void handleChatPacket( Core::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); + void handlePacket( Core::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); - void sendPackets( Packets::PacketContainer* pPacket ); + void handleZonePacket( Core::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); - void sendSinglePacket( Core::Network::Packets::FFXIVPacketBasePtr pPacket ); + void handleChatPacket( Core::Network::Packets::FFXIVARR_PACKET_RAW& pPacket ); - void injectPacket( const std::string& packetpath, Entity::Player& player ); + void sendPackets( Packets::PacketContainer* pPacket ); - DECLARE_HANDLER( initHandler ); + void sendSinglePacket( Core::Network::Packets::FFXIVPacketBasePtr pPacket ); - DECLARE_HANDLER( finishLoadingHandler ); + void injectPacket( const std::string& packetpath, Entity::Player& player ); - DECLARE_HANDLER( blackListHandler ); + DECLARE_HANDLER( initHandler ); - DECLARE_HANDLER( socialListHandler ); + DECLARE_HANDLER( finishLoadingHandler ); - DECLARE_HANDLER( linkshellListHandler ); + DECLARE_HANDLER( blackListHandler ); - DECLARE_HANDLER( playTimeHandler ); + DECLARE_HANDLER( socialListHandler ); - DECLARE_HANDLER( pingHandler ); + DECLARE_HANDLER( linkshellListHandler ); - DECLARE_HANDLER( fcInfoReqHandler ); + DECLARE_HANDLER( playTimeHandler ); - DECLARE_HANDLER( setSearchInfoHandler ); + DECLARE_HANDLER( pingHandler ); - DECLARE_HANDLER( reqSearchInfoHandler ); + DECLARE_HANDLER( fcInfoReqHandler ); - DECLARE_HANDLER( reqExamineSearchCommentHandler ); + DECLARE_HANDLER( setSearchInfoHandler ); - DECLARE_HANDLER( reqExamineFcInfo ); + DECLARE_HANDLER( reqSearchInfoHandler ); - DECLARE_HANDLER( updatePositionHandler ); + DECLARE_HANDLER( reqExamineSearchCommentHandler ); - DECLARE_HANDLER( chatHandler ); + DECLARE_HANDLER( reqExamineFcInfo ); - DECLARE_HANDLER( zoneLineHandler ); + DECLARE_HANDLER( updatePositionHandler ); - DECLARE_HANDLER( clientTriggerHandler ); + DECLARE_HANDLER( chatHandler ); - DECLARE_HANDLER( inventoryModifyHandler ); + DECLARE_HANDLER( zoneLineHandler ); - DECLARE_HANDLER( discoveryHandler ); + DECLARE_HANDLER( clientTriggerHandler ); - DECLARE_HANDLER( eventHandlerTalk ); + DECLARE_HANDLER( inventoryModifyHandler ); - DECLARE_HANDLER( eventHandlerEmote ); + DECLARE_HANDLER( discoveryHandler ); - DECLARE_HANDLER( eventHandlerWithinRange ); + DECLARE_HANDLER( eventHandlerTalk ); - DECLARE_HANDLER( eventHandlerOutsideRange ); + DECLARE_HANDLER( eventHandlerEmote ); - DECLARE_HANDLER( eventHandlerEnterTerritory ); + DECLARE_HANDLER( eventHandlerWithinRange ); - DECLARE_HANDLER( eventHandlerReturn ); + DECLARE_HANDLER( eventHandlerOutsideRange ); - DECLARE_HANDLER( eventHandlerLinkshell ); + DECLARE_HANDLER( eventHandlerEnterTerritory ); - DECLARE_HANDLER( logoutHandler ); + DECLARE_HANDLER( eventHandlerReturn ); - DECLARE_HANDLER( cfDutyInfoRequest ); + DECLARE_HANDLER( eventHandlerLinkshell ); - DECLARE_HANDLER( cfRegisterDuty ); + DECLARE_HANDLER( logoutHandler ); - DECLARE_HANDLER( cfRegisterRoulette ); + DECLARE_HANDLER( cfDutyInfoRequest ); - DECLARE_HANDLER( cfDutyAccepted ); + DECLARE_HANDLER( cfRegisterDuty ); + + DECLARE_HANDLER( cfRegisterRoulette ); + + DECLARE_HANDLER( cfDutyAccepted ); - DECLARE_HANDLER( actionHandler ); + DECLARE_HANDLER( actionHandler ); - DECLARE_HANDLER( gm1Handler ); + DECLARE_HANDLER( gm1Handler ); - DECLARE_HANDLER( gm2Handler ); + DECLARE_HANDLER( gm2Handler ); - DECLARE_HANDLER( reqEquipDisplayFlagsHandler ); + DECLARE_HANDLER( reqEquipDisplayFlagsHandler ); - DECLARE_HANDLER( performNoteHandler ); + DECLARE_HANDLER( performNoteHandler ); - DECLARE_HANDLER( tellHandler ); - -}; + DECLARE_HANDLER( tellHandler ); + }; } -} - #endif diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket142.h b/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket142.h index 36e195fe..a68ac4f5 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket142.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket142.h @@ -5,51 +5,45 @@ #include #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Ping response packet. -*/ -class ActorControlPacket142 : - public ZoneChannelPacket< FFXIVIpcActorControl142 > +namespace Core::Network::Packets::Server { -public: - ActorControlPacket142( uint32_t actorId, - uint16_t category, - uint32_t param1 = 0, - uint32_t param2 = 0, - uint32_t param3 = 0, - uint32_t param4 = 0, - uint32_t padding1 = 0 ) : - ZoneChannelPacket< FFXIVIpcActorControl142 >( actorId, actorId ) + + /** + * @brief The Ping response packet. + */ + class ActorControlPacket142 : public ZoneChannelPacket< FFXIVIpcActorControl142 > { - initialize( category, param1, param2, param3, param4 ); + public: + ActorControlPacket142( uint32_t actorId, + uint16_t category, + uint32_t param1 = 0, + uint32_t param2 = 0, + uint32_t param3 = 0, + uint32_t param4 = 0, + uint32_t padding1 = 0 ) : + ZoneChannelPacket< FFXIVIpcActorControl142 >( actorId, actorId ) + { + initialize( category, param1, param2, param3, param4 ); + }; + + private: + void initialize( uint16_t category, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4 ) + { + m_data.padding = 0; + m_data.category = category; + m_data.param1 = param1; + m_data.param2 = param2; + m_data.param3 = param3; + m_data.param4 = param4; + }; }; -private: - void initialize( uint16_t category, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4 ) + template< typename... Args > + std::shared_ptr< ActorControlPacket142 > makeActorControl142( Args... args ) { - m_data.padding = 0; - m_data.category = category; - m_data.param1 = param1; - m_data.param2 = param2; - m_data.param3 = param3; - m_data.param4 = param4; - }; -}; + return std::make_shared< ActorControlPacket142 >( args... ); + } -template< typename... Args > -std::shared_ptr< ActorControlPacket142 > makeActorControl142( Args... args ) -{ - return std::make_shared< ActorControlPacket142 >( args... ); -} - -} -} -} } #endif /*_ACTORCONTROL142_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket143.h b/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket143.h index 3c306e6a..e920ef15 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket143.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket143.h @@ -6,54 +6,48 @@ #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Ping response packet. -*/ -class ActorControlPacket143 : - public ZoneChannelPacket< FFXIVIpcActorControl143 > +namespace Core::Network::Packets::Server { -public: - ActorControlPacket143( uint32_t actorId, - uint16_t category, - uint32_t param1 = 0, - uint32_t param2 = 0, - uint32_t param3 = 0, - uint32_t param4 = 0, - uint32_t param5 = 0, - uint32_t padding1 = 0 ) : - ZoneChannelPacket< FFXIVIpcActorControl143 >( actorId, actorId ) + + /** + * @brief The Ping response packet. + */ + class ActorControlPacket143 : public ZoneChannelPacket< FFXIVIpcActorControl143 > { - initialize( category, param1, param2, param3, param4, param5 ); + public: + ActorControlPacket143( uint32_t actorId, + uint16_t category, + uint32_t param1 = 0, + uint32_t param2 = 0, + uint32_t param3 = 0, + uint32_t param4 = 0, + uint32_t param5 = 0, + uint32_t padding1 = 0 ) : + ZoneChannelPacket< FFXIVIpcActorControl143 >( actorId, actorId ) + { + initialize( category, param1, param2, param3, param4, param5 ); + }; + + private: + void initialize( uint16_t category, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, + uint32_t param5 ) + { + m_data.padding = 0; + m_data.category = category; + m_data.param1 = param1; + m_data.param2 = param2; + m_data.param3 = param3; + m_data.param4 = param4; + m_data.param5 = param5; + }; }; -private: - void initialize( uint16_t category, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, - uint32_t param5 ) + template< typename... Args > + std::shared_ptr< ActorControlPacket143 > makeActorControl143( Args... args ) { - m_data.padding = 0; - m_data.category = category; - m_data.param1 = param1; - m_data.param2 = param2; - m_data.param3 = param3; - m_data.param4 = param4; - m_data.param5 = param5; - }; -}; + return std::make_shared< ActorControlPacket143 >( args... ); + } -template< typename... Args > -std::shared_ptr< ActorControlPacket143 > makeActorControl143( Args... args ) -{ - return std::make_shared< ActorControlPacket143 >( args... ); -} - -} -} -} } #endif /*_ACTORCONTROL143_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket144.h b/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket144.h index 00673945..8950cff9 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket144.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ActorControlPacket144.h @@ -4,54 +4,48 @@ #include #include -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Ping response packet. -*/ -class ActorControlPacket144 : - public ZoneChannelPacket< FFXIVIpcActorControl144 > +namespace Core::Network::Packets::Server { -public: - ActorControlPacket144( uint32_t actorId, - uint16_t category, - uint32_t param1 = 0, - uint32_t param2 = 0, - uint32_t param3 = 0, - uint32_t param4 = 0, - uint64_t targetId = 0, - uint32_t padding1 = 0 ) : - ZoneChannelPacket< FFXIVIpcActorControl144 >( actorId, actorId ) + + /** + * @brief The Ping response packet. + */ + class ActorControlPacket144 : public ZoneChannelPacket< FFXIVIpcActorControl144 > { - initialize( category, param1, param2, param3, param4, targetId ); + public: + ActorControlPacket144( uint32_t actorId, + uint16_t category, + uint32_t param1 = 0, + uint32_t param2 = 0, + uint32_t param3 = 0, + uint32_t param4 = 0, + uint64_t targetId = 0, + uint32_t padding1 = 0 ) : + ZoneChannelPacket< FFXIVIpcActorControl144 >( actorId, actorId ) + { + initialize( category, param1, param2, param3, param4, targetId ); + }; + + private: + void initialize( uint16_t category, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, + uint64_t targetId ) + { + m_data.padding = 0; + m_data.category = category; + m_data.param1 = param1; + m_data.param2 = param2; + m_data.param3 = param3; + m_data.param4 = param4; + m_data.targetId = targetId; + }; }; -private: - void initialize( uint16_t category, uint32_t param1, uint32_t param2, uint32_t param3, uint32_t param4, - uint64_t targetId ) + template< typename... Args > + std::shared_ptr< ActorControlPacket144 > makeActorControl144( Args... args ) { - m_data.padding = 0; - m_data.category = category; - m_data.param1 = param1; - m_data.param2 = param2; - m_data.param3 = param3; - m_data.param4 = param4; - m_data.targetId = targetId; - }; -}; + return std::make_shared< ActorControlPacket144 >( args... ); + } -template< typename... Args > -std::shared_ptr< ActorControlPacket144 > makeActorControl144( Args... args ) -{ - return std::make_shared< ActorControlPacket144 >( args... ); -} - -} -} -} } #endif /*_ACTORCONTROL144_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ChatPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/ChatPacket.h index 9a6d5b14..08e2394e 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ChatPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ChatPacket.h @@ -6,36 +6,30 @@ #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Chat packet. -*/ -class ChatPacket : - public ZoneChannelPacket< FFXIVIpcChat > +namespace Core::Network::Packets::Server { -public: - ChatPacket( Entity::Player& player, Common::ChatType chatType, const std::string& msg ) : - ZoneChannelPacket< FFXIVIpcChat >( player.getId(), player.getId() ) + + /** + * @brief The Chat packet. + */ + class ChatPacket : public ZoneChannelPacket< FFXIVIpcChat > { - initialize( player, chatType, msg ); + public: + ChatPacket( Entity::Player& player, Common::ChatType chatType, const std::string& msg ) : + ZoneChannelPacket< FFXIVIpcChat >( player.getId(), player.getId() ) + { + initialize( player, chatType, msg ); + }; + + private: + void initialize( Entity::Player& player, Common::ChatType chatType, const std::string& msg ) + { + m_data.chatType = chatType; + strcpy( m_data.name, player.getName().c_str() ); + strcpy( m_data.msg, msg.c_str() ); + }; }; -private: - void initialize( Entity::Player& player, Common::ChatType chatType, const std::string& msg ) - { - m_data.chatType = chatType; - strcpy( m_data.name, player.getName().c_str() ); - strcpy( m_data.msg, msg.c_str() ); - }; -}; - -} -} -} } #endif /*_CHATPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/DirectorPlayScenePacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/DirectorPlayScenePacket.h index 6a5ae1b6..268279bf 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/DirectorPlayScenePacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/DirectorPlayScenePacket.h @@ -4,68 +4,62 @@ #include #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The packet sent to play an event. -*/ -class DirectorPlayScenePacket : - public ZoneChannelPacket< FFXIVIpcDirectorPlayScene > +namespace Core::Network::Packets::Server { -public: - DirectorPlayScenePacket( uint32_t playerId, - uint64_t actorId, - uint32_t eventId, - uint16_t scene, - uint32_t flags, - uint8_t param3, - uint32_t param4 = 0, - uint32_t param5 = 0 ) : - ZoneChannelPacket< FFXIVIpcDirectorPlayScene >( playerId, playerId ) + + /** + * @brief The packet sent to play an event. + */ + class DirectorPlayScenePacket : public ZoneChannelPacket< FFXIVIpcDirectorPlayScene > { - initialize( actorId, eventId, scene, flags, param3, param4, param5 ); + public: + DirectorPlayScenePacket( uint32_t playerId, + uint64_t actorId, + uint32_t eventId, + uint16_t scene, + uint32_t flags, + uint8_t param3, + uint32_t param4 = 0, + uint32_t param5 = 0 ) : + ZoneChannelPacket< FFXIVIpcDirectorPlayScene >( playerId, playerId ) + { + initialize( actorId, eventId, scene, flags, param3, param4, param5 ); + }; + + private: + void initialize( uint64_t actorId, + uint32_t eventId, + uint16_t scene, + uint32_t flags, + uint8_t param3, + uint32_t param4, + uint32_t param5 ) + { + m_data.actorId = actorId; + m_data.eventId = eventId; + m_data.scene = scene; + m_data.flags = flags; + m_data.param3 = param3; + m_data.param4 = param4; + m_data.param5 = param5; + m_data.unknown[ 0 ] = 0x05; + m_data.unknown[ 4 ] = 0x22; + m_data.unknown[ 5 ] = 0xD6; + m_data.unknown[ 6 ] = 0x62; + m_data.unknown[ 7 ] = 0x59; + m_data.unknown[ 0x14 ] = 0x08; + m_data.unknown[ 0x15 ] = 0x02; + + // time remaining in sec + m_data.unknown[ 0x18 ] = 0x19; + m_data.unknown[ 0x19 ] = 0x14; + + m_data.unknown[ 0x1C ] = 0x23; + m_data.unknown[ 0x20 ] = 0x40; + m_data.unknown[ 0x24 ] = 0x80; + }; }; -private: - void initialize( uint64_t actorId, - uint32_t eventId, - uint16_t scene, - uint32_t flags, - uint8_t param3, - uint32_t param4, - uint32_t param5 ) - { - m_data.actorId = actorId; - m_data.eventId = eventId; - m_data.scene = scene; - m_data.flags = flags; - m_data.param3 = param3; - m_data.param4 = param4; - m_data.param5 = param5; - m_data.unknown[ 0 ] = 0x05; - m_data.unknown[ 4 ] = 0x22; - m_data.unknown[ 5 ] = 0xD6; - m_data.unknown[ 6 ] = 0x62; - m_data.unknown[ 7 ] = 0x59; - m_data.unknown[ 0x14 ] = 0x08; - m_data.unknown[ 0x15 ] = 0x02; - - // time remaining in sec - m_data.unknown[ 0x18 ] = 0x19; - m_data.unknown[ 0x19 ] = 0x14; - - m_data.unknown[ 0x1C ] = 0x23; - m_data.unknown[ 0x20 ] = 0x40; - m_data.unknown[ 0x24 ] = 0x80; - }; -}; - -} -} -} } #endif /*_EVENTPLAY_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/EffectPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/EffectPacket.h index 245f8792..ddc48343 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/EffectPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/EffectPacket.h @@ -8,61 +8,55 @@ #include #include -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -class EffectPacket : - public ZoneChannelPacket< FFXIVIpcEffect > +namespace Core::Network::Packets::Server { -public: - EffectPacket( uint64_t sourceId, uint32_t targetId, uint32_t actionId ) : - ZoneChannelPacket< FFXIVIpcEffect >( static_cast< uint32_t >( sourceId ), targetId ) + + class EffectPacket : public ZoneChannelPacket< FFXIVIpcEffect > { - m_data.header.actionId = actionId; - m_data.header.actionAnimationId = static_cast< uint16_t >( actionId ); + public: + EffectPacket( uint64_t sourceId, uint32_t targetId, uint32_t actionId ) : + ZoneChannelPacket< FFXIVIpcEffect >( static_cast< uint32_t >( sourceId ), targetId ) + { + m_data.header.actionId = actionId; + m_data.header.actionAnimationId = static_cast< uint16_t >( actionId ); - m_data.header.animationTargetId = targetId; - m_data.effectTargetId = targetId; + m_data.header.animationTargetId = targetId; + m_data.effectTargetId = targetId; - m_data.header.effectDisplayType = Common::ActionEffectDisplayType::ShowActionName; - } + m_data.header.effectDisplayType = Common::ActionEffectDisplayType::ShowActionName; + } - void addEffect( const Server::EffectEntry& effect ) - { - assert( m_data.header.effectCount <= 8 ); + void addEffect( const Server::EffectEntry& effect ) + { + assert( m_data.header.effectCount <= 8 ); - std::memcpy( &m_data.effects[ m_data.header.effectCount++ ], &effect, sizeof( Server::EffectEntry ) ); - } + std::memcpy( &m_data.effects[ m_data.header.effectCount++ ], &effect, sizeof( Server::EffectEntry ) ); + } - void setAnimationId( uint16_t animationId ) - { - m_data.header.actionAnimationId = animationId; - } + void setAnimationId( uint16_t animationId ) + { + m_data.header.actionAnimationId = animationId; + } - void setEffectFlags( uint32_t effectFlags ) - { - m_data.effectFlags = effectFlags; - } + void setEffectFlags( uint32_t effectFlags ) + { + m_data.effectFlags = effectFlags; + } - void setRotation( uint16_t rotation ) - { - m_data.header.rotation = rotation; - } + void setRotation( uint16_t rotation ) + { + m_data.header.rotation = rotation; + } - void setTargetActor( const uint32_t targetId ) - { - m_data.header.animationTargetId = targetId; - m_data.effectTargetId = targetId; + void setTargetActor( const uint32_t targetId ) + { + m_data.header.animationTargetId = targetId; + m_data.effectTargetId = targetId; - FFXIVPacketBase::setTargetActor( targetId ); - } -}; + FFXIVPacketBase::setTargetActor( targetId ); + } + }; -} -} -} } #endif //SAPPHIRE_EFFECTPACKET_H diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/EventFinishPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/EventFinishPacket.h index 82038691..d6de2a35 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/EventFinishPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/EventFinishPacket.h @@ -3,43 +3,37 @@ #include -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The packet sent to finish an event. -*/ -class EventFinishPacket : - public ZoneChannelPacket< FFXIVIpcEventFinish > +namespace Core::Network::Packets::Server { -public: - EventFinishPacket( uint32_t playerId, - uint32_t eventId, + + /** + * @brief The packet sent to finish an event. + */ + class EventFinishPacket : public ZoneChannelPacket< FFXIVIpcEventFinish > + { + public: + EventFinishPacket( uint32_t playerId, + uint32_t eventId, + uint8_t param1, + uint32_t param3 ) : + ZoneChannelPacket< FFXIVIpcEventFinish >( playerId, playerId ) + { + initialize( eventId, param1, param3 ); + }; + + private: + void initialize( uint32_t eventId, uint8_t param1, - uint32_t param3 ) : - ZoneChannelPacket< FFXIVIpcEventFinish >( playerId, playerId ) - { - initialize( eventId, param1, param3 ); + uint32_t param3 ) + { + m_data.eventId = eventId; + m_data.param1 = param1; + m_data.param2 = 1; + m_data.param3 = param3; + + }; }; -private: - void initialize( uint32_t eventId, - uint8_t param1, - uint32_t param3 ) - { - m_data.eventId = eventId; - m_data.param1 = param1; - m_data.param2 = 1; - m_data.param3 = param3; - - }; -}; - -} -} -} } #endif /*_EVENTFINISH_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/EventPlayPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/EventPlayPacket.h index 3567bc03..748946d7 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/EventPlayPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/EventPlayPacket.h @@ -4,53 +4,47 @@ #include #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The packet sent to play an event. -*/ -class EventPlayPacket : - public ZoneChannelPacket< FFXIVIpcEventPlay > +namespace Core::Network::Packets::Server { -public: - EventPlayPacket( uint32_t playerId, - uint64_t actorId, - uint32_t eventId, - uint16_t scene, - uint32_t flags, - uint8_t param3, - uint32_t param4 = 0, - uint32_t param5 = 0 ) : - ZoneChannelPacket< FFXIVIpcEventPlay >( playerId, playerId ) + + /** + * @brief The packet sent to play an event. + */ + class EventPlayPacket : public ZoneChannelPacket< FFXIVIpcEventPlay > { - initialize( actorId, eventId, scene, flags, param3, param4, param5 ); + public: + EventPlayPacket( uint32_t playerId, + uint64_t actorId, + uint32_t eventId, + uint16_t scene, + uint32_t flags, + uint8_t param3, + uint32_t param4 = 0, + uint32_t param5 = 0 ) : + ZoneChannelPacket< FFXIVIpcEventPlay >( playerId, playerId ) + { + initialize( actorId, eventId, scene, flags, param3, param4, param5 ); + }; + + private: + void initialize( uint64_t actorId, + uint32_t eventId, + uint16_t scene, + uint32_t flags, + uint8_t param3, + uint32_t param4, + uint32_t param5 ) + { + m_data.actorId = actorId; + m_data.eventId = eventId; + m_data.scene = scene; + m_data.flags = flags; + m_data.param3 = param3; + m_data.param4 = param4; + m_data.param5 = param5; + }; }; -private: - void initialize( uint64_t actorId, - uint32_t eventId, - uint16_t scene, - uint32_t flags, - uint8_t param3, - uint32_t param4, - uint32_t param5 ) - { - m_data.actorId = actorId; - m_data.eventId = eventId; - m_data.scene = scene; - m_data.flags = flags; - m_data.param3 = param3; - m_data.param4 = param4; - m_data.param5 = param5; - }; -}; - -} -} -} } #endif /*_EVENTPLAY_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/EventStartPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/EventStartPacket.h index 7bae3514..935693fc 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/EventStartPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/EventStartPacket.h @@ -4,48 +4,41 @@ #include #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The packet sent to start an event. -*/ -class EventStartPacket : - public ZoneChannelPacket< FFXIVIpcEventStart > +namespace Core::Network::Packets::Server { -public: - EventStartPacket( uint32_t playerId, - uint64_t actorId, - uint32_t eventId, - uint8_t param1 = 0, - uint8_t param2 = 0, - uint32_t param3 = 0 ) : - ZoneChannelPacket< FFXIVIpcEventStart >( playerId, playerId ) + + /** + * @brief The packet sent to start an event. + */ + class EventStartPacket : public ZoneChannelPacket< FFXIVIpcEventStart > { - initialize( actorId, eventId, param1, param2, param3 ); + public: + EventStartPacket( uint32_t playerId, + uint64_t actorId, + uint32_t eventId, + uint8_t param1 = 0, + uint8_t param2 = 0, + uint32_t param3 = 0 ) : + ZoneChannelPacket< FFXIVIpcEventStart >( playerId, playerId ) + { + initialize( actorId, eventId, param1, param2, param3 ); + }; + + private: + void initialize( uint64_t actorId, + uint32_t eventId, + uint8_t param1, + uint8_t param2, + uint32_t param3 ) + { + m_data.actorId = actorId; + m_data.eventId = eventId; + m_data.param1 = param1; + m_data.param2 = param2; + m_data.param3 = param3; + + }; }; -private: - void initialize( uint64_t actorId, - uint32_t eventId, - uint8_t param1, - uint8_t param2, - uint32_t param3 ) - { - m_data.actorId = actorId; - m_data.eventId = eventId; - m_data.param1 = param1; - m_data.param2 = param2; - m_data.param3 = param3; - - }; -}; - } -} -} -} - #endif /*_EVENTSTART_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ExaminePacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/ExaminePacket.h index d60bda96..dd446296 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ExaminePacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ExaminePacket.h @@ -10,78 +10,72 @@ #include "StatusEffect/StatusEffect.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Examine response packet. -*/ -class ExaminePacket : - public ZoneChannelPacket< FFXIVIpcExamine > +namespace Core::Network::Packets::Server { -public: - ExaminePacket( Entity::Player& player, Entity::PlayerPtr pTarget ) : - ZoneChannelPacket< FFXIVIpcExamine >( pTarget->getId(), player.getId() ) - { - initialize( player, pTarget ); - }; -private: - void initialize( Entity::Player& player, Entity::PlayerPtr pTarget ) + /** + * @brief The Examine response packet. + */ + class ExaminePacket : public ZoneChannelPacket< FFXIVIpcExamine > { - assert( pTarget ); + public: + ExaminePacket( Entity::Player& player, Entity::PlayerPtr pTarget ) : + ZoneChannelPacket< FFXIVIpcExamine >( pTarget->getId(), player.getId() ) { - // todo: this packet needs mapping out - strcpy( m_data.name, pTarget->getName().c_str() ); - m_data.classJob = static_cast< uint8_t >( pTarget->getClass() ); - m_data.level = pTarget->getLevel(); + initialize( player, pTarget ); + }; - m_data.unkFlag1 = 4; - m_data.unkFlag2 = 1; - - m_data.titleId = pTarget->getTitle(); - m_data.grandCompany = pTarget->getGc(); - m_data.grandCompanyRank = pTarget->getGcRankArray()[m_data.grandCompany]; - - m_data.mainWeaponModel = pTarget->getModelMainWeapon(); - m_data.secWeaponModel = pTarget->getModelSubWeapon(); - - memcpy( m_data.look, pTarget->getLookArray(), sizeof( m_data.look ) ); - - m_data.models[ Common::GearModelSlot::ModelHead ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelHead ); - m_data.models[ Common::GearModelSlot::ModelBody ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelBody ); - m_data.models[ Common::GearModelSlot::ModelHands ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelHands ); - m_data.models[ Common::GearModelSlot::ModelLegs ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelLegs ); - m_data.models[ Common::GearModelSlot::ModelFeet ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelFeet ); - m_data.models[ Common::GearModelSlot::ModelNeck ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelNeck ); - m_data.models[ Common::GearModelSlot::ModelEar ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelEar ); - m_data.models[ Common::GearModelSlot::ModelRing1 ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelRing1 ); - m_data.models[ Common::GearModelSlot::ModelRing2 ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelRing2 ); - m_data.models[ Common::GearModelSlot::ModelWrist ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelWrist ); - - // todo: main/sub/other stuff too - - for( auto i = 0; i < Common::GearSetSlot::SoulCrystal + 1; ++i ) + private: + void initialize( Entity::Player& player, Entity::PlayerPtr pTarget ) + { + assert( pTarget ); { - auto pItem = pTarget->getItemAt( Common::InventoryType::GearSet0, i ); - if( pItem ) + // todo: this packet needs mapping out + strcpy( m_data.name, pTarget->getName().c_str() ); + m_data.classJob = static_cast< uint8_t >( pTarget->getClass() ); + m_data.level = pTarget->getLevel(); + + m_data.unkFlag1 = 4; + m_data.unkFlag2 = 1; + + m_data.titleId = pTarget->getTitle(); + m_data.grandCompany = pTarget->getGc(); + m_data.grandCompanyRank = pTarget->getGcRankArray()[m_data.grandCompany]; + + m_data.mainWeaponModel = pTarget->getModelMainWeapon(); + m_data.secWeaponModel = pTarget->getModelSubWeapon(); + + memcpy( m_data.look, pTarget->getLookArray(), sizeof( m_data.look ) ); + + m_data.models[ Common::GearModelSlot::ModelHead ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelHead ); + m_data.models[ Common::GearModelSlot::ModelBody ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelBody ); + m_data.models[ Common::GearModelSlot::ModelHands ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelHands ); + m_data.models[ Common::GearModelSlot::ModelLegs ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelLegs ); + m_data.models[ Common::GearModelSlot::ModelFeet ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelFeet ); + m_data.models[ Common::GearModelSlot::ModelNeck ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelNeck ); + m_data.models[ Common::GearModelSlot::ModelEar ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelEar ); + m_data.models[ Common::GearModelSlot::ModelRing1 ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelRing1 ); + m_data.models[ Common::GearModelSlot::ModelRing2 ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelRing2 ); + m_data.models[ Common::GearModelSlot::ModelWrist ] = pTarget->getModelForSlot( Common::GearModelSlot::ModelWrist ); + + // todo: main/sub/other stuff too + + for( auto i = 0; i < Common::GearSetSlot::SoulCrystal + 1; ++i ) { - auto& entry = m_data.entries[i]; - entry.catalogId = pItem->getId(); - entry.quality = pItem->isHq(); - //entry.appearanceCatalogId = pItem->getGlamourId() - // todo: glamour/materia etc. + auto pItem = pTarget->getItemAt( Common::InventoryType::GearSet0, i ); + if( pItem ) + { + auto& entry = m_data.entries[i]; + entry.catalogId = pItem->getId(); + entry.quality = pItem->isHq(); + //entry.appearanceCatalogId = pItem->getGlamourId() + // todo: glamour/materia etc. + } } } - } + }; }; -}; -} -} -} } #endif /*_CORE_NETWORK_PACKETS_EXAMINEPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h index a9505653..a6a7b186 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/InitUIPacket.h @@ -6,94 +6,88 @@ #include "Actor/Player.h" #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Client UI Initialization packet. This must be sent to the client -* once upon connection to configure the UI. -*/ -class InitUIPacket : - public ZoneChannelPacket< FFXIVIpcInitUI > +namespace Core::Network::Packets::Server { -public: - InitUIPacket( Entity::Player& player ) : - ZoneChannelPacket< FFXIVIpcInitUI >( player.getId(), player.getId() ) + + /** + * @brief The Client UI Initialization packet. This must be sent to the client + * once upon connection to configure the UI. + */ + class InitUIPacket : public ZoneChannelPacket< FFXIVIpcInitUI > { - initialize( player ); - }; - -private: - void initialize( Entity::Player& player ) - { - m_data.contentId = player.getContentId(); - - // TODO: Support rested experience. - m_data.restedExp = 0; - //m_data.padding = 0x100; - m_data.charId = player.getId(); - m_data.race = player.getLookAt( Common::CharaLook::Race ); - m_data.tribe = player.getLookAt( Common::CharaLook::Tribe ); - m_data.gender = player.getLookAt( Common::CharaLook::Gender ); - m_data.currentClass = static_cast< uint8_t >( player.getClass() ); - m_data.currentJob = static_cast< uint8_t >( player.getClass() ); - m_data.maxLevel = player.getLevel(); - m_data.deity = static_cast< uint8_t >( player.getGuardianDeity() ); - m_data.namedayMonth = player.getBirthMonth(); - m_data.namedayDay = player.getBirthDay(); - // TODO: Support grand company status. - m_data.cityState = player.getStartTown(); - //m_data.gcRank = GCRank::None; - - m_data.homepoint = player.getHomepoint(); - m_data.pose = player.getPose(); - - memset( &m_data.name[ 0 ], 0, sizeof( m_data.name ) ); - - strcpy( &m_data.name[ 0 ], player.getName().c_str() ); - - memcpy( m_data.aetheryte, player.getAetheryteArray(), sizeof( m_data.aetheryte ) ); - - // Set the class levels and exp. - for( uint8_t i = 0; i < 25; i++ ) + public: + InitUIPacket( Entity::Player& player ) : + ZoneChannelPacket< FFXIVIpcInitUI >( player.getId(), player.getId() ) { - m_data.levels[ i ] = player.getClassArray()[ i ]; - m_data.exp[ i ] = player.getExpArray()[ i ]; - } + initialize( player ); + }; - memcpy( m_data.orchestrionMask, player.getOrchestrionBitmask(), sizeof( m_data.orchestrionMask ) ); + private: + void initialize( Entity::Player& player ) + { + m_data.contentId = player.getContentId(); - memcpy( m_data.mountGuideMask, player.getMountGuideBitmask(), sizeof( m_data.mountGuideMask ) ); + // TODO: Support rested experience. + m_data.restedExp = 0; + //m_data.padding = 0x100; + m_data.charId = player.getId(); + m_data.race = player.getLookAt( Common::CharaLook::Race ); + m_data.tribe = player.getLookAt( Common::CharaLook::Tribe ); + m_data.gender = player.getLookAt( Common::CharaLook::Gender ); + m_data.currentClass = static_cast< uint8_t >( player.getClass() ); + m_data.currentJob = static_cast< uint8_t >( player.getClass() ); + m_data.maxLevel = player.getLevel(); + m_data.deity = static_cast< uint8_t >( player.getGuardianDeity() ); + m_data.namedayMonth = player.getBirthMonth(); + m_data.namedayDay = player.getBirthDay(); + // TODO: Support grand company status. + m_data.cityState = player.getStartTown(); + //m_data.gcRank = GCRank::None; - memcpy( m_data.unlockBitmask, player.getUnlockBitmask(), sizeof( m_data.unlockBitmask ) ); + m_data.homepoint = player.getHomepoint(); + m_data.pose = player.getPose(); - memcpy( m_data.discovery, player.getDiscoveryBitmask(), sizeof( m_data.discovery ) ); + memset( &m_data.name[ 0 ], 0, sizeof( m_data.name ) ); - memcpy( m_data.howto, player.getHowToArray(), sizeof( m_data.howto ) ); + strcpy( &m_data.name[ 0 ], player.getName().c_str() ); - // possibly max level or current level - m_data.maxLevel = 0x46; - m_data.expansion = 2; + memcpy( m_data.aetheryte, player.getAetheryteArray(), sizeof( m_data.aetheryte ) ); - // df stuff - // todo: actually do this properly -// m_data.unknown70[4] = 1; // enable df + // Set the class levels and exp. + for( uint8_t i = 0; i < 25; i++ ) + { + m_data.levels[ i ] = player.getClassArray()[ i ]; + m_data.exp[ i ] = player.getExpArray()[ i ]; + } - // enable all raids/guildhests/dungeons - memset( m_data.unlockedDungeons, 0xFF, sizeof( m_data.unlockedDungeons ) ); - memset( m_data.unlockedGuildhests, 0xFF, sizeof( m_data.unlockedGuildhests ) ); - memset( m_data.unlockedPvp, 0xFF, sizeof( m_data.unlockedPvp ) ); - memset( m_data.unlockedRaids, 0xFF, sizeof( m_data.unlockedRaids ) ); - memset( m_data.unlockedTrials, 0xFF, sizeof( m_data.unlockedTrials ) ); + memcpy( m_data.orchestrionMask, player.getOrchestrionBitmask(), sizeof( m_data.orchestrionMask ) ); + memcpy( m_data.mountGuideMask, player.getMountGuideBitmask(), sizeof( m_data.mountGuideMask ) ); + + memcpy( m_data.unlockBitmask, player.getUnlockBitmask(), sizeof( m_data.unlockBitmask ) ); + + memcpy( m_data.discovery, player.getDiscoveryBitmask(), sizeof( m_data.discovery ) ); + + memcpy( m_data.howto, player.getHowToArray(), sizeof( m_data.howto ) ); + + // possibly max level or current level + m_data.maxLevel = 0x46; + m_data.expansion = 2; + + // df stuff + // todo: actually do this properly + // m_data.unknown70[4] = 1; // enable df + + // enable all raids/guildhests/dungeons + memset( m_data.unlockedDungeons, 0xFF, sizeof( m_data.unlockedDungeons ) ); + memset( m_data.unlockedGuildhests, 0xFF, sizeof( m_data.unlockedGuildhests ) ); + memset( m_data.unlockedPvp, 0xFF, sizeof( m_data.unlockedPvp ) ); + memset( m_data.unlockedRaids, 0xFF, sizeof( m_data.unlockedRaids ) ); + memset( m_data.unlockedTrials, 0xFF, sizeof( m_data.unlockedTrials ) ); + + }; }; -}; -} -} -} } #endif /*_CORE_NETWORK_PACKETS_CINITUIPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h index f0bb7ebe..1cbed7b7 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ModelEquipPacket.h @@ -5,47 +5,42 @@ #include "Actor/Player.h" #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The update model packet. -*/ -class ModelEquipPacket : - public ZoneChannelPacket< FFXIVIpcModelEquip > +namespace Core::Network::Packets::Server { -public: - ModelEquipPacket( Entity::Player& player ) : - ZoneChannelPacket< FFXIVIpcModelEquip >( player.getId(), player.getId() ) + + /** + * @brief The update model packet. + */ + class ModelEquipPacket : + public ZoneChannelPacket< FFXIVIpcModelEquip > { - initialize( player ); + public: + ModelEquipPacket( Entity::Player& player ) : + ZoneChannelPacket< FFXIVIpcModelEquip >( player.getId(), player.getId() ) + { + initialize( player ); + }; + + private: + void initialize( Entity::Player& player ) + { + m_data.mainWeapon = player.getModelMainWeapon(); + m_data.offWeapon = player.getModelSubWeapon(); + m_data.classJobId = static_cast< uint8_t >( player.getClass() ); + m_data.level = player.getLevel(); + m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead ); + m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody ); + m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands ); + m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs ); + m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet ); + m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck ); + m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar ); + m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 ); + m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 ); + m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist ); + }; }; -private: - void initialize( Entity::Player& player ) - { - m_data.mainWeapon = player.getModelMainWeapon(); - m_data.offWeapon = player.getModelSubWeapon(); - m_data.classJobId = static_cast< uint8_t >( player.getClass() ); - m_data.level = player.getLevel(); - m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead ); - m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody ); - m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands ); - m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs ); - m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet ); - m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck ); - m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar ); - m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 ); - m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 ); - m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist ); - }; -}; - -} -} -} } #endif /*_MODELEQUIPPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/MoveActorPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/MoveActorPacket.h index e9b5817b..eb228045 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/MoveActorPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/MoveActorPacket.h @@ -8,44 +8,39 @@ #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Client UI Initialization packet. This must be sent to the client -* once upon connection to configure the UI. -*/ -class MoveActorPacket : - public ZoneChannelPacket< FFXIVIpcActorMove > +namespace Core::Network::Packets::Server { -public: - MoveActorPacket( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) : - ZoneChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() ) + + /** + * @brief The Client UI Initialization packet. This must be sent to the client + * once upon connection to configure the UI. + */ + class MoveActorPacket : + public ZoneChannelPacket< FFXIVIpcActorMove > { - initialize( actor, unk1, unk2, unk3, unk4 ); + public: + MoveActorPacket( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) : + ZoneChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() ) + { + initialize( actor, unk1, unk2, unk3, unk4 ); + }; + + private: + void initialize( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) + { + + m_data.rotation = Math::Util::floatToUInt8Rot( actor.getRot() ); + m_data.unknown_1 = unk1; + m_data.unknown_2 = unk2; + m_data.unknown_3 = unk3; + m_data.unknown_4 = unk4; + m_data.posX = Math::Util::floatToUInt16( actor.getPos().x ); + m_data.posY = Math::Util::floatToUInt16( actor.getPos().y ); + m_data.posZ = Math::Util::floatToUInt16( actor.getPos().z ); + + }; }; -private: - void initialize( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) - { - - m_data.rotation = Math::Util::floatToUInt8Rot( actor.getRot() ); - m_data.unknown_1 = unk1; - m_data.unknown_2 = unk2; - m_data.unknown_3 = unk3; - m_data.unknown_4 = unk4; - m_data.posX = Math::Util::floatToUInt16( actor.getPos().x ); - m_data.posY = Math::Util::floatToUInt16( actor.getPos().y ); - m_data.posZ = Math::Util::floatToUInt16( actor.getPos().z ); - - }; -}; - -} -} -} } #endif /*_MOVEACTORPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/NpcSpawnPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/NpcSpawnPacket.h index 7e2885b2..5b538b36 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/NpcSpawnPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/NpcSpawnPacket.h @@ -10,122 +10,117 @@ #include "Inventory/Item.h" #include "StatusEffect/StatusEffect.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The packet sent to spawn a player. -*/ -class NpcSpawnPacket : public ZoneChannelPacket< FFXIVIpcNpcSpawn > +namespace Core::Network::Packets::Server { -public: - NpcSpawnPacket( Entity::BNpc& bnpc, Entity::Player& target ) : - ZoneChannelPacket< FFXIVIpcNpcSpawn >( bnpc.getId(), target.getId() ) + + /** + * @brief The packet sent to spawn a player. + */ + class NpcSpawnPacket : public ZoneChannelPacket< FFXIVIpcNpcSpawn > { - initialize( bnpc, target ); + public: + NpcSpawnPacket( Entity::BNpc& bnpc, Entity::Player& target ) : + ZoneChannelPacket< FFXIVIpcNpcSpawn >( bnpc.getId(), target.getId() ) + { + initialize( bnpc, target ); + }; + + private: + void initialize( Entity::BNpc& bnpc, Entity::Player& target ) + { + // todo: figure out unkown offsets + m_data.classJob = static_cast< uint8_t >( bnpc.getClass() ); + //m_data.status = static_cast< uint8_t >( pPlayer->getStatus() ); + + m_data.hPCurr = bnpc.getHp(); + m_data.mPCurr = bnpc.getMp(); + m_data.tPCurr = bnpc.getTp(); + m_data.hPMax = bnpc.getMaxHp(); + m_data.mPMax = bnpc.getMaxMp(); + m_data.subtype = 5; + + //m_data.tPMax = 3000; + m_data.level = bnpc.getLevel(); + m_data.pose = bnpc.getPose(); + + memcpy( m_data.look, bnpc.getLookArray(), sizeof( m_data.look ) ); + + auto models = bnpc.getModelArray(); + memcpy( m_data.models, bnpc.getModelArray(), sizeof( m_data.models ) ); + + memcpy( m_data.look, bnpc.getLookArray(), sizeof( m_data.look ) ); + + m_data.pos.x = bnpc.getPos().x; + m_data.pos.y = bnpc.getPos().y; + m_data.pos.z = bnpc.getPos().z; + m_data.rotation = Math::Util::floatToUInt16Rot( bnpc.getRot() ); + + m_data.enemyType = bnpc.getEnemyType(); + m_data.mainWeaponModel = bnpc.getWeaponMain(); + m_data.secWeaponModel = bnpc.getWeaponSub(); + m_data.aggressionMode = bnpc.getAggressionMode(); + + m_data.classJob = 0; + //m_data.voice = bnpc.getVoiceId(); + //m_data.currentMount = bnpc.getCurrentMount(); + + //m_data.onlineStatus = static_cast< uint8_t >( bnpc.getOnlineStatus() ); + + //m_data.u23 = 0x04; + //m_data.u24 = 256; + m_data.state = static_cast< uint8_t >( bnpc.getStatus() ); + m_data.modelType = bnpc.getObjKind(); + m_data.modelChara = bnpc.getModelChara(); + + m_data.bNPCBase = bnpc.getBNpcBaseId(); + m_data.bNPCName = bnpc.getBNpcNameId(); + + m_data.state = 1; + if( target.getId() == bnpc.getId() ) + { + m_data.spawnIndex = 0x00; + } + else + { + m_data.spawnIndex = target.getSpawnIdForActorId( bnpc.getId() ); + + if( !target.isActorSpawnIdValid( m_data.spawnIndex ) ) + return; + } + // 0x20 == spawn hidden to be displayed by the spawneffect control + //m_data.displayFlags = bnpc.getDisplayFlags(); + + /*if( bnpc.getZoningType() != Common::ZoneingType::None ) + { + m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::Invisible ); + }*/ + + //m_data.currentMount = bnpc.getCurrentMount(); + //m_data.persistentEmote = bnpc.getPersistentEmote(); + + m_data.targetId = static_cast< uint64_t >( bnpc.getTargetId() ); + //m_data.type = 1; + //m_data.unknown_33 = 4; + //m_data.unknown_38 = 0x70; + //m_data.unknown_60 = 3; + //m_data.unknown_61 = 7; + + + uint64_t currentTimeMs = Core::Util::getTimeMs(); + + for( auto const& effect : bnpc.getStatusEffectMap() ) + { + m_data.effect[ effect.first ].effect_id = effect.second->getId(); + m_data.effect[ effect.first ].duration = static_cast< float >( effect.second->getDuration() - + ( currentTimeMs - + effect.second->getStartTimeMs() ) ) / 1000; + m_data.effect[ effect.first ].sourceActorId = effect.second->getSrcActorId(); + m_data.effect[ effect.first ].unknown1 = effect.second->getParam(); + } + + }; }; -private: - void initialize( Entity::BNpc& bnpc, Entity::Player& target ) - { - // todo: figure out unkown offsets - m_data.classJob = static_cast< uint8_t >( bnpc.getClass() ); - //m_data.status = static_cast< uint8_t >( pPlayer->getStatus() ); - - m_data.hPCurr = bnpc.getHp(); - m_data.mPCurr = bnpc.getMp(); - m_data.tPCurr = bnpc.getTp(); - m_data.hPMax = bnpc.getMaxHp(); - m_data.mPMax = bnpc.getMaxMp(); - m_data.subtype = 5; - - //m_data.tPMax = 3000; - m_data.level = bnpc.getLevel(); - m_data.pose = bnpc.getPose(); - - memcpy( m_data.look, bnpc.getLookArray(), sizeof( m_data.look ) ); - - auto models = bnpc.getModelArray(); - memcpy( m_data.models, bnpc.getModelArray(), sizeof( m_data.models ) ); - - memcpy( m_data.look, bnpc.getLookArray(), sizeof( m_data.look ) ); - - m_data.pos.x = bnpc.getPos().x; - m_data.pos.y = bnpc.getPos().y; - m_data.pos.z = bnpc.getPos().z; - m_data.rotation = Math::Util::floatToUInt16Rot( bnpc.getRot() ); - - m_data.enemyType = bnpc.getEnemyType(); - m_data.mainWeaponModel = bnpc.getWeaponMain(); - m_data.secWeaponModel = bnpc.getWeaponSub(); - m_data.aggressionMode = bnpc.getAggressionMode(); - - m_data.classJob = 0; - //m_data.voice = bnpc.getVoiceId(); - //m_data.currentMount = bnpc.getCurrentMount(); - - //m_data.onlineStatus = static_cast< uint8_t >( bnpc.getOnlineStatus() ); - - //m_data.u23 = 0x04; - //m_data.u24 = 256; - m_data.state = static_cast< uint8_t >( bnpc.getStatus() ); - m_data.modelType = bnpc.getObjKind(); - m_data.modelChara = bnpc.getModelChara(); - - m_data.bNPCBase = bnpc.getBNpcBaseId(); - m_data.bNPCName = bnpc.getBNpcNameId(); - - m_data.state = 1; - if( target.getId() == bnpc.getId() ) - { - m_data.spawnIndex = 0x00; - } - else - { - m_data.spawnIndex = target.getSpawnIdForActorId( bnpc.getId() ); - - if( !target.isActorSpawnIdValid( m_data.spawnIndex ) ) - return; - } - // 0x20 == spawn hidden to be displayed by the spawneffect control - //m_data.displayFlags = bnpc.getDisplayFlags(); - - /*if( bnpc.getZoningType() != Common::ZoneingType::None ) - { - m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::Invisible ); - }*/ - - //m_data.currentMount = bnpc.getCurrentMount(); - //m_data.persistentEmote = bnpc.getPersistentEmote(); - - m_data.targetId = static_cast< uint64_t >( bnpc.getTargetId() ); - //m_data.type = 1; - //m_data.unknown_33 = 4; - //m_data.unknown_38 = 0x70; - //m_data.unknown_60 = 3; - //m_data.unknown_61 = 7; - - - uint64_t currentTimeMs = Core::Util::getTimeMs(); - - for( auto const& effect : bnpc.getStatusEffectMap() ) - { - m_data.effect[ effect.first ].effect_id = effect.second->getId(); - m_data.effect[ effect.first ].duration = static_cast< float >( effect.second->getDuration() - - ( currentTimeMs - - effect.second->getStartTimeMs() ) ) / 1000; - m_data.effect[ effect.first ].sourceActorId = effect.second->getSrcActorId(); - m_data.effect[ effect.first ].unknown1 = effect.second->getParam(); - } - - }; -}; - -} -} -} } #endif /*_PlayerSpawn_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/PingPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/PingPacket.h index 1250e3f4..44330d62 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/PingPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/PingPacket.h @@ -5,34 +5,29 @@ #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Ping response packet. -*/ -class PingPacket : - public ZoneChannelPacket< FFXIVIpcPing > +namespace Core::Network::Packets::Server { -public: - PingPacket( Entity::Player& player, int32_t inVal ) : - ZoneChannelPacket< FFXIVIpcPing >( player.getId(), player.getId() ) + + /** + * @brief The Ping response packet. + */ + class PingPacket : + public ZoneChannelPacket< FFXIVIpcPing > { - initialize( player, inVal ); + public: + PingPacket( Entity::Player& player, int32_t inVal ) : + ZoneChannelPacket< FFXIVIpcPing >( player.getId(), player.getId() ) + { + initialize( player, inVal ); + }; + + private: + void initialize( Entity::Player& player, int32_t inVal ) + { + m_data.timeInMilliseconds = 0x000014D00000000 + inVal; + }; }; -private: - void initialize( Entity::Player& player, int32_t inVal ) - { - m_data.timeInMilliseconds = 0x000014D00000000 + inVal; - }; -}; - -} -} -} } #endif /*_CORE_NETWORK_PACKETS_CPINGPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/PlayerSpawnPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/PlayerSpawnPacket.h index 3138acba..36c4cabd 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/PlayerSpawnPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/PlayerSpawnPacket.h @@ -9,144 +9,139 @@ #include "Inventory/Item.h" #include "StatusEffect/StatusEffect.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The packet sent to spawn a player. -*/ -class PlayerSpawnPacket : public ZoneChannelPacket< FFXIVIpcPlayerSpawn > +namespace Core::Network::Packets::Server { -public: - PlayerSpawnPacket( Entity::Player& player, Entity::Player& target ) : - ZoneChannelPacket< FFXIVIpcPlayerSpawn >( player.getId(), target.getId() ) + + /** + * @brief The packet sent to spawn a player. + */ + class PlayerSpawnPacket : public ZoneChannelPacket< FFXIVIpcPlayerSpawn > { - initialize( player, target ); + public: + PlayerSpawnPacket( Entity::Player& player, Entity::Player& target ) : + ZoneChannelPacket< FFXIVIpcPlayerSpawn >( player.getId(), target.getId() ) + { + initialize( player, target ); + }; + + private: + void initialize( Entity::Player& player, Entity::Player& target ) + { + // todo: figure out unkown offsets + m_data.classJob = static_cast< uint8_t >( player.getClass() ); + //m_data.status = static_cast< uint8_t >( pPlayer->getStatus() ); + + m_data.hPCurr = player.getHp(); + m_data.mPCurr = player.getMp(); + m_data.tPCurr = player.getTp(); + m_data.hPMax = player.getMaxHp(); + m_data.mPMax = player.getMaxMp(); + + //m_data.tPMax = 3000; + m_data.level = player.getLevel(); + m_data.gmRank = player.getGmRank(); + m_data.pose = player.getPose(); + + memcpy( m_data.look, player.getLookArray(), sizeof( m_data.look ) ); + + auto item = player.getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand ); + if( item ) + m_data.mainWeaponModel = item->getModelId1(); + m_data.secWeaponModel = player.getModelSubWeapon(); + + m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead ); + m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody ); + m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands ); + m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs ); + m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet ); + m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck ); + m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar ); + m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 ); + m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 ); + m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist ); + + strcpy( m_data.name, player.getName().c_str() ); + + m_data.pos.x = player.getPos().x; + m_data.pos.y = player.getPos().y; + m_data.pos.z = player.getPos().z; + m_data.rotation = Math::Util::floatToUInt16Rot( player.getRot() ); + + + m_data.title = player.getTitle(); + m_data.voice = player.getVoiceId(); + m_data.currentMount = player.getCurrentMount(); + + m_data.onlineStatus = static_cast< uint8_t >( player.getOnlineStatus() ); + + //m_data.u23 = 0x04; + //m_data.u24 = 256; + m_data.state = static_cast< uint8_t >( player.getStatus() ); + m_data.modelType = player.getObjKind(); + if( target.getId() == player.getId() ) + { + m_data.spawnIndex = 0x00; + } + else + { + m_data.spawnIndex = target.getSpawnIdForActorId( player.getId() ); + + if( !target.isActorSpawnIdValid( m_data.spawnIndex ) ) + return; + } + // 0x20 == spawn hidden to be displayed by the spawneffect control + m_data.displayFlags = player.getStance(); + + if( player.getZoningType() != Common::ZoneingType::None || player.getGmInvis() == true ) + { + m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::Invisible ); + } + + if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead ) + { + m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::HideHead ); + } + + if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon ) + { + m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::HideWeapon ); + } + + if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor ) + { + m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::Visor ); + } + + if( !( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideLegacyMark ) ) + { + m_data.look[ 0xC ] = m_data.look[ 0xC ] | 1 << 7; + } + + m_data.currentMount = player.getCurrentMount(); + m_data.persistentEmote = player.getPersistentEmote(); + + m_data.targetId = player.getTargetId(); + //m_data.type = 1; + //m_data.unknown_33 = 4; + //m_data.unknown_38 = 0x70; + //m_data.unknown_60 = 3; + //m_data.unknown_61 = 7; + + uint64_t currentTimeMs = Core::Util::getTimeMs(); + + for( auto const& effect : player.getStatusEffectMap() ) + { + m_data.effect[ effect.first ].effect_id = effect.second->getId(); + m_data.effect[ effect.first ].duration = static_cast< float >( effect.second->getDuration() - + ( currentTimeMs - + effect.second->getStartTimeMs() ) ) / 1000; + m_data.effect[ effect.first ].sourceActorId = effect.second->getSrcActorId(); + m_data.effect[ effect.first ].unknown1 = effect.second->getParam(); + } + + }; }; -private: - void initialize( Entity::Player& player, Entity::Player& target ) - { - // todo: figure out unkown offsets - m_data.classJob = static_cast< uint8_t >( player.getClass() ); - //m_data.status = static_cast< uint8_t >( pPlayer->getStatus() ); - - m_data.hPCurr = player.getHp(); - m_data.mPCurr = player.getMp(); - m_data.tPCurr = player.getTp(); - m_data.hPMax = player.getMaxHp(); - m_data.mPMax = player.getMaxMp(); - - //m_data.tPMax = 3000; - m_data.level = player.getLevel(); - m_data.gmRank = player.getGmRank(); - m_data.pose = player.getPose(); - - memcpy( m_data.look, player.getLookArray(), sizeof( m_data.look ) ); - - auto item = player.getItemAt( Common::GearSet0, Common::GearSetSlot::MainHand ); - if( item ) - m_data.mainWeaponModel = item->getModelId1(); - m_data.secWeaponModel = player.getModelSubWeapon(); - - m_data.models[ Common::GearModelSlot::ModelHead ] = player.getModelForSlot( Common::GearModelSlot::ModelHead ); - m_data.models[ Common::GearModelSlot::ModelBody ] = player.getModelForSlot( Common::GearModelSlot::ModelBody ); - m_data.models[ Common::GearModelSlot::ModelHands ] = player.getModelForSlot( Common::GearModelSlot::ModelHands ); - m_data.models[ Common::GearModelSlot::ModelLegs ] = player.getModelForSlot( Common::GearModelSlot::ModelLegs ); - m_data.models[ Common::GearModelSlot::ModelFeet ] = player.getModelForSlot( Common::GearModelSlot::ModelFeet ); - m_data.models[ Common::GearModelSlot::ModelNeck ] = player.getModelForSlot( Common::GearModelSlot::ModelNeck ); - m_data.models[ Common::GearModelSlot::ModelEar ] = player.getModelForSlot( Common::GearModelSlot::ModelEar ); - m_data.models[ Common::GearModelSlot::ModelRing1 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing1 ); - m_data.models[ Common::GearModelSlot::ModelRing2 ] = player.getModelForSlot( Common::GearModelSlot::ModelRing2 ); - m_data.models[ Common::GearModelSlot::ModelWrist ] = player.getModelForSlot( Common::GearModelSlot::ModelWrist ); - - strcpy( m_data.name, player.getName().c_str() ); - - m_data.pos.x = player.getPos().x; - m_data.pos.y = player.getPos().y; - m_data.pos.z = player.getPos().z; - m_data.rotation = Math::Util::floatToUInt16Rot( player.getRot() ); - - - m_data.title = player.getTitle(); - m_data.voice = player.getVoiceId(); - m_data.currentMount = player.getCurrentMount(); - - m_data.onlineStatus = static_cast< uint8_t >( player.getOnlineStatus() ); - - //m_data.u23 = 0x04; - //m_data.u24 = 256; - m_data.state = static_cast< uint8_t >( player.getStatus() ); - m_data.modelType = player.getObjKind(); - if( target.getId() == player.getId() ) - { - m_data.spawnIndex = 0x00; - } - else - { - m_data.spawnIndex = target.getSpawnIdForActorId( player.getId() ); - - if( !target.isActorSpawnIdValid( m_data.spawnIndex ) ) - return; - } - // 0x20 == spawn hidden to be displayed by the spawneffect control - m_data.displayFlags = player.getStance(); - - if( player.getZoningType() != Common::ZoneingType::None || player.getGmInvis() == true ) - { - m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::Invisible ); - } - - if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideHead ) - { - m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::HideHead ); - } - - if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideWeapon ) - { - m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::HideWeapon ); - } - - if( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::Visor ) - { - m_data.displayFlags |= static_cast< uint16_t >( Common::DisplayFlags::Visor ); - } - - if( !( player.getEquipDisplayFlags() & Core::Common::EquipDisplayFlags::HideLegacyMark ) ) - { - m_data.look[ 0xC ] = m_data.look[ 0xC ] | 1 << 7; - } - - m_data.currentMount = player.getCurrentMount(); - m_data.persistentEmote = player.getPersistentEmote(); - - m_data.targetId = player.getTargetId(); - //m_data.type = 1; - //m_data.unknown_33 = 4; - //m_data.unknown_38 = 0x70; - //m_data.unknown_60 = 3; - //m_data.unknown_61 = 7; - - uint64_t currentTimeMs = Core::Util::getTimeMs(); - - for( auto const& effect : player.getStatusEffectMap() ) - { - m_data.effect[ effect.first ].effect_id = effect.second->getId(); - m_data.effect[ effect.first ].duration = static_cast< float >( effect.second->getDuration() - - ( currentTimeMs - - effect.second->getStartTimeMs() ) ) / 1000; - m_data.effect[ effect.first ].sourceActorId = effect.second->getSrcActorId(); - m_data.effect[ effect.first ].unknown1 = effect.second->getParam(); - } - - }; -}; - -} -} -} } #endif /*_PlayerSpawn_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/PlayerStateFlagsPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/PlayerStateFlagsPacket.h index 9d7aa21b..e7ce2c8f 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/PlayerStateFlagsPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/PlayerStateFlagsPacket.h @@ -5,54 +5,48 @@ #include "Actor/Player.h" #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief Packet sent to set a players state, this impacts which actions he can perform. -*/ -class PlayerStateFlagsPacket : - public ZoneChannelPacket< FFXIVIpcPlayerStateFlags > +namespace Core::Network::Packets::Server { -public: - PlayerStateFlagsPacket( Entity::Player& player ) : - ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() ) - { - initialize( player.getStateFlags() ); - } - PlayerStateFlagsPacket( Entity::Player& player, std::vector< Common::PlayerStateFlag > flags ) : - ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() ) + /** + * @brief Packet sent to set a players state, this impacts which actions he can perform. + */ + class PlayerStateFlagsPacket : public ZoneChannelPacket< FFXIVIpcPlayerStateFlags > { - uint8_t newFlags[12]; - memset( newFlags, 0, 12 ); - - for( auto& flag : flags ) + public: + PlayerStateFlagsPacket( Entity::Player& player ) : + ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() ) { - int32_t iFlag = static_cast< uint32_t >( flag ); - uint8_t index = iFlag / 8; - uint8_t bitIndex = iFlag % 8; - - uint8_t value = 1 << bitIndex; - - newFlags[ index ] |= value; + initialize( player.getStateFlags() ); } - initialize( newFlags ); - } + PlayerStateFlagsPacket( Entity::Player& player, std::vector< Common::PlayerStateFlag > flags ) : + ZoneChannelPacket< FFXIVIpcPlayerStateFlags >( player.getId(), player.getId() ) + { + uint8_t newFlags[12]; + memset( newFlags, 0, 12 ); -private: - void initialize( const uint8_t* flags ) - { - memcpy( m_data.flags, flags, 12 ); + for( auto& flag : flags ) + { + int32_t iFlag = static_cast< uint32_t >( flag ); + uint8_t index = iFlag / 8; + uint8_t bitIndex = iFlag % 8; + + uint8_t value = 1 << bitIndex; + + newFlags[ index ] |= value; + } + + initialize( newFlags ); + } + + private: + void initialize( const uint8_t* flags ) + { + memcpy( m_data.flags, flags, 12 ); + }; }; -}; -} -} -} } #endif /*_PLAYERSTATE_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/QuestMessagePacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/QuestMessagePacket.h index c07d7b38..059b5596 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/QuestMessagePacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/QuestMessagePacket.h @@ -5,39 +5,33 @@ #include "Actor/Player.h" #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief Packet to display a quest specific info message. -*/ -class QuestMessagePacket : - public ZoneChannelPacket< FFXIVIpcQuestMessage > +namespace Core::Network::Packets::Server { -public: - QuestMessagePacket( Entity::ActorPtr pActor, uint32_t questId, int8_t msgId, - uint8_t type = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) : - ZoneChannelPacket< FFXIVIpcQuestMessage >( pActor->getId(), pActor->getId() ) + + /** + * @brief Packet to display a quest specific info message. + */ + class QuestMessagePacket : public ZoneChannelPacket< FFXIVIpcQuestMessage > { - initialize( questId, msgId, type, var1, var2 ); + public: + QuestMessagePacket( Entity::ActorPtr pActor, uint32_t questId, int8_t msgId, + uint8_t type = 0, uint32_t var1 = 0, uint32_t var2 = 0 ) : + ZoneChannelPacket< FFXIVIpcQuestMessage >( pActor->getId(), pActor->getId() ) + { + initialize( questId, msgId, type, var1, var2 ); + }; + + private: + void initialize( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 ) + { + m_data.questId = questId; + m_data.msgId = msgId; + m_data.type = type; + m_data.var1 = var1; + m_data.var2 = var2; + }; }; -private: - void initialize( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 ) - { - m_data.questId = questId; - m_data.msgId = msgId; - m_data.type = type; - m_data.var1 = var1; - m_data.var2 = var2; - }; -}; - -} -} -} } #endif /* _QUESTMESSAGE_H */ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/ServerNoticePacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/ServerNoticePacket.h index 9f8af3f3..933cce0e 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/ServerNoticePacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/ServerNoticePacket.h @@ -5,34 +5,29 @@ #include #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Ping response packet. -*/ -class ServerNoticePacket : - public ZoneChannelPacket< FFXIVIpcServerNotice > +namespace Core::Network::Packets::Server { -public: - ServerNoticePacket( uint32_t playerId, const std::string& message ) : - ZoneChannelPacket< FFXIVIpcServerNotice >( playerId, playerId ) + + /** + * @brief The Ping response packet. + */ + class ServerNoticePacket : + public ZoneChannelPacket< FFXIVIpcServerNotice > { - initialize( message ); + public: + ServerNoticePacket( uint32_t playerId, const std::string& message ) : + ZoneChannelPacket< FFXIVIpcServerNotice >( playerId, playerId ) + { + initialize( message ); + }; + + private: + void initialize( const std::string& message ) + { + strcpy( m_data.message, message.c_str() ); + }; }; -private: - void initialize( const std::string& message ) - { - strcpy( m_data.message, message.c_str() ); - }; -}; - -} -} -} } #endif /*_SERVERNOTICEPACKET_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/UpdateHpMpTpPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/UpdateHpMpTpPacket.h index 342e30e5..64957ce7 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/UpdateHpMpTpPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/UpdateHpMpTpPacket.h @@ -5,36 +5,31 @@ #include #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The Ping response packet. -*/ -class UpdateHpMpTpPacket : - public ZoneChannelPacket< FFXIVIpcUpdateHpMpTp > +namespace Core::Network::Packets::Server { -public: - UpdateHpMpTpPacket( Entity::Chara& actor ) : - ZoneChannelPacket< FFXIVIpcUpdateHpMpTp >( actor.getId(), actor.getId() ) + + /** + * @brief The Ping response packet. + */ + class UpdateHpMpTpPacket : + public ZoneChannelPacket< FFXIVIpcUpdateHpMpTp > { - initialize( actor ); + public: + UpdateHpMpTpPacket( Entity::Chara& actor ) : + ZoneChannelPacket< FFXIVIpcUpdateHpMpTp >( actor.getId(), actor.getId() ) + { + initialize( actor ); + }; + + private: + void initialize( Entity::Chara& actor ) + { + m_data.hp = actor.getHp(); + m_data.mp = actor.getMp(); + m_data.tp = actor.getTp(); + }; }; -private: - void initialize( Entity::Chara& actor ) - { - m_data.hp = actor.getHp(); - m_data.mp = actor.getMp(); - m_data.tp = actor.getTp(); - }; -}; - -} -} -} } #endif /*_UPDATEHPMPTP_H*/ diff --git a/src/servers/sapphire_zone/Network/PacketWrappers/UpdateInventorySlotPacket.h b/src/servers/sapphire_zone/Network/PacketWrappers/UpdateInventorySlotPacket.h index d49b7e21..289e0b05 100644 --- a/src/servers/sapphire_zone/Network/PacketWrappers/UpdateInventorySlotPacket.h +++ b/src/servers/sapphire_zone/Network/PacketWrappers/UpdateInventorySlotPacket.h @@ -6,55 +6,49 @@ #include "Inventory/Item.h" #include "Forwards.h" -namespace Core { -namespace Network { -namespace Packets { -namespace Server { - -/** -* @brief The update inventory-slot packet. -*/ -class UpdateInventorySlotPacket : - public ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > +namespace Core::Network::Packets::Server { -public: - UpdateInventorySlotPacket( uint32_t playerId, uint8_t slot, uint16_t storageId, const Item& item ) : - ZoneChannelPacket< FFXIVIpcUpdateInventorySlot >( playerId, playerId ) + + /** + * @brief The update inventory-slot packet. + */ + class UpdateInventorySlotPacket : public ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > { - initialize( slot, storageId, item ); + public: + UpdateInventorySlotPacket( uint32_t playerId, uint8_t slot, uint16_t storageId, const Item& item ) : + ZoneChannelPacket< FFXIVIpcUpdateInventorySlot >( playerId, playerId ) + { + initialize( slot, storageId, item ); + }; + + private: + void initialize( uint8_t slot, uint16_t storageId, const Item& item ) + { + m_data.sequence = 0; + m_data.containerId = storageId; + m_data.slot = slot; + m_data.quantity = item.getStackSize(); + m_data.catalogId = item.getId(); + m_data.reservedFlag = 0; // no idea + m_data.signatureId = 0; + m_data.hqFlag = item.isHq() ? 1 : 0; + m_data.condition = 60000; // 200% + m_data.spiritBond = 0; + m_data.color = 0; + m_data.glamourCatalogId = 0; + m_data.materia1 = 0; + m_data.materia2 = 0; + m_data.materia3 = 0; + m_data.materia4 = 0; + m_data.materia5 = 0; + //m_data.buffer1; + //uint8_t buffer2; + //uint8_t buffer3; + //uint8_t buffer4; + //uint8_t buffer5; + }; }; -private: - void initialize( uint8_t slot, uint16_t storageId, const Item& item ) - { - m_data.sequence = 0; - m_data.containerId = storageId; - m_data.slot = slot; - m_data.quantity = item.getStackSize(); - m_data.catalogId = item.getId(); - m_data.reservedFlag = 0; // no idea - m_data.signatureId = 0; - m_data.hqFlag = item.isHq() ? 1 : 0; - m_data.condition = 60000; // 200% - m_data.spiritBond = 0; - m_data.color = 0; - m_data.glamourCatalogId = 0; - m_data.materia1 = 0; - m_data.materia2 = 0; - m_data.materia3 = 0; - m_data.materia4 = 0; - m_data.materia5 = 0; - //m_data.buffer1; - //uint8_t buffer2; - //uint8_t buffer3; - //uint8_t buffer4; - //uint8_t buffer5; - }; -}; - -} -} -} } #endif /*_MODELEQUIPPACKET_H*/ diff --git a/src/servers/sapphire_zone/Script/NativeScriptApi.h b/src/servers/sapphire_zone/Script/NativeScriptApi.h index c2eac89a..64c8e79a 100644 --- a/src/servers/sapphire_zone/Script/NativeScriptApi.h +++ b/src/servers/sapphire_zone/Script/NativeScriptApi.h @@ -10,8 +10,6 @@ #define EXPORT __attribute__((visibility("default"))) #endif -using namespace Core; - // todo: this is shit // constant script ids for certain events #define EVENTSCRIPT_AETHERYTE_ID 0x50000 @@ -62,28 +60,28 @@ public: * * @param actor the actor the status effect is ticking on */ - virtual void onTick( Entity::Chara& actor ); + virtual void onTick( Core::Entity::Chara& actor ); /*! * @brief Called when the status effect is applied to an actor * * @param actor the actor on which the status effect was applied to */ - virtual void onApply( Entity::Chara& actor ); + virtual void onApply( Core::Entity::Chara& actor ); /*! * @brief Called when the actor (usually a player) removes the status effect by right clicking it * * @param actor The actor on which the effect was removed from */ - virtual void onRemove( Entity::Chara& actor ); + virtual void onRemove( Core::Entity::Chara& actor ); /*! * @brief Called when the status effect expires * * @param actor The actor on which the efect expired on */ - virtual void onExpire( Entity::Chara& actor ); + virtual void onExpire( Core::Entity::Chara& actor ); /*! * @brief Called when the player with the status effect collides with another player, eg. hot potato @@ -91,28 +89,28 @@ public: * @param actor The actor which has status effect * @param actorHit The actor who collided with the status effect owner */ - virtual void onPlayerCollision( Entity::Chara& actor, Entity::Chara& actorHit ); + virtual void onPlayerCollision( Core::Entity::Chara& actor, Core::Entity::Chara& actorHit ); /*! * @brief Called when the owner finishes a cast * * @param actor The actor who finished a cast */ - virtual void onPlayerFinishCast( Entity::Chara& actor ); + virtual void onPlayerFinishCast( Core::Entity::Chara& actor ); /*! * @brief Called when the status effect owner was damaged * * @param actor The actor that was damaged */ - virtual void onPlayerDamaged( Entity::Chara& actor ); + virtual void onPlayerDamaged( Core::Entity::Chara& actor ); /*! * @brief Called when the status effect owner dies * * @param actor The actor that died */ - virtual void onPlayerDeath( Entity::Chara& actor ); + virtual void onPlayerDeath( Core::Entity::Chara& actor ); }; @@ -124,11 +122,11 @@ class ActionScript : public ScriptObject public: explicit ActionScript( uint32_t abilityId ); - virtual void onStart( Entity::Chara& sourceActor, Entity::Chara& targetActor ); + virtual void onStart( Core::Entity::Chara& sourceActor, Core::Entity::Chara& targetActor ); - virtual void onCastFinish( Entity::Player& player, Entity::Chara& targetActor ); + virtual void onCastFinish( Core::Entity::Player& player, Core::Entity::Chara& targetActor ); - virtual void onInterrupt( Entity::Chara& sourceActor/*, Core::Entity::Chara targetActor*/ ); + virtual void onInterrupt( Core::Entity::Chara& sourceActor/*, Core::Entity::Chara targetActor*/ ); }; /*! @@ -139,7 +137,7 @@ class EventScript : public ScriptObject { protected: template< typename Ret, class Obj > - inline std::function< void( Entity::Player& ) > bindScene( Ret ( Obj::*f )( Entity::Player& ) ) + inline std::function< void( Core::Entity::Player& ) > bindScene( Ret ( Obj::*f )( Core::Entity::Player& ) ) { return std::bind( f, static_cast< Obj* >( this ), std::placeholders::_1 ); } @@ -147,22 +145,22 @@ protected: public: explicit EventScript( uint32_t questId ); - virtual void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ); + virtual void onTalk( uint32_t eventId, Core::Entity::Player& player, uint64_t actorId ); - virtual void onNpcKill( uint32_t npcId, Entity::Player& player ); + virtual void onNpcKill( uint32_t npcId, Core::Entity::Player& player ); - virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Entity::Player& player ); + virtual void onEmote( uint64_t actorId, uint32_t eventId, uint32_t emoteId, Core::Entity::Player& player ); - virtual void onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ); + virtual void onEnterTerritory( Core::Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ); - virtual void onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); + virtual void onWithinRange( Core::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); - virtual void onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); + virtual void onOutsideRange( Core::Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); virtual void - onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId ); + onEventItem( Core::Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, uint64_t targetId ); - virtual void onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, + virtual void onEventHandlerTradeReturn( Core::Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, uint32_t catalogId ); }; @@ -195,12 +193,12 @@ class InstanceContentScript : public ScriptObject public: explicit InstanceContentScript( uint32_t instanceContentId ); - virtual void onInit( InstanceContentPtr instance ); + virtual void onInit( Core::InstanceContentPtr instance ); - virtual void onUpdate( InstanceContentPtr instance, uint32_t currTime ); + virtual void onUpdate( Core::InstanceContentPtr instance, uint32_t currTime ); - virtual void onEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1, - uint16_t param2 ); + virtual void onEnterTerritory( Core::InstanceContentPtr instance, Core::Entity::Player& player, uint32_t eventId, + uint16_t param1, uint16_t param2 ); }; #endif diff --git a/src/servers/sapphire_zone/Script/NativeScriptMgr.h b/src/servers/sapphire_zone/Script/NativeScriptMgr.h index aac29439..d3294e54 100644 --- a/src/servers/sapphire_zone/Script/NativeScriptMgr.h +++ b/src/servers/sapphire_zone/Script/NativeScriptMgr.h @@ -7,126 +7,124 @@ #include "ScriptLoader.h" -namespace Core { -namespace Scripting { - -/*! - * @brief Contains all the functionality for easily loading, unloading, reloading and generally accessing scripts. - */ -class NativeScriptMgr +namespace Core::Scripting { -protected: - /*! - * @brief An internal list that maps script types to another list containing scripts indexed by their assoicated id - */ - std::unordered_map< std::size_t, std::unordered_map< uint32_t, ScriptObject* > > m_scripts; - - - ScriptLoader m_loader; /*! - * @brief The queue that scripts to be reloaded are placed into. + * @brief Contains all the functionality for easily loading, unloading, reloading and generally accessing scripts. */ - std::queue< std::string > m_scriptLoadQueue; - - /*! - * @brief Used to unload a script - * - * Used to unload a script, clears m_scripts of any scripts assoicated with a ScriptInfo and then unloads that module - * - * @param info A pointer to the ScriptInfo object that is to be erased - * @return true if successful, false if not - */ - bool unloadScript( ScriptInfo* info ); - -public: - NativeScriptMgr() = default; - - /*! - * @brief Loads a script from a path - * - * This will populate m_scripts if it is successful and scripts will be available as soon as this returns. - * - * @param path The path to the module to load - * @return true if successful, false if not - */ - bool loadScript( const std::string& path ); - - /*! - * @brief Unloads a script - * - * @param name The module name of the script to unload - * @return true if successful - */ - bool unloadScript( const std::string& name ); - - /*! - * @brief Queues a script module to be reloaded - * - * Due to the nature of how this works, there's no return. - * It will just silently fail over and over again to infinity and beyond until the server restarts... not that should ever happen under normal circumstances. - * - * @param name The name of the module to be reloaded. - */ - void queueScriptReload( const std::string& name ); - - /*! - * @brief Case-insensitive search for modules, useful for debug commands - * - * @param scripts a set of ScriptInfo ptrs - * @param search the search term - */ - void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search ); - - /*! - * @brief Called on a regular interval, allows for scripts to be loaded from the internal load queue. - */ - void processLoadQueue(); - - /*! - * @brief Gets the module file extention for the current platform (windows, linux, osx) - * - * @return The file extension for the current platform - */ - const std::string getModuleExtension(); - - /*! - * @brief Checks to see if a module with the specified name exists - * - * @param name The module name to lookup - * @return true if loaded, false if not - */ - bool isModuleLoaded( const std::string& name ); - - /*! - * @brief Get a specific script from the internal table - * - * @tparam T The type of the script to search for - * @param scriptId The ID of the script to search for - * @return T* if successful, nullptr if the script doesn't exist - */ - template< typename T > - T* getScript( uint32_t scriptId ) + class NativeScriptMgr { - auto type = typeid( T ).hash_code(); - - auto script = m_scripts[ type ].find( scriptId ); - if( script == m_scripts[ type ].end() ) - return nullptr; - - return dynamic_cast< T* >( script->second ); - } -}; + protected: + /*! + * @brief An internal list that maps script types to another list containing scripts indexed by their assoicated id + */ + std::unordered_map< std::size_t, std::unordered_map< uint32_t, ScriptObject* > > m_scripts; -/*! - * @brief Creates an instance of NativeScriptMgr - * - * @return a std::shared_ptr to NativeScriptMgr - */ -std::shared_ptr< NativeScriptMgr > createNativeScriptMgr(); + ScriptLoader m_loader; + + /*! + * @brief The queue that scripts to be reloaded are placed into. + */ + std::queue< std::string > m_scriptLoadQueue; + + /*! + * @brief Used to unload a script + * + * Used to unload a script, clears m_scripts of any scripts assoicated with a ScriptInfo and then unloads that module + * + * @param info A pointer to the ScriptInfo object that is to be erased + * @return true if successful, false if not + */ + bool unloadScript( ScriptInfo* info ); + + public: + NativeScriptMgr() = default; + + /*! + * @brief Loads a script from a path + * + * This will populate m_scripts if it is successful and scripts will be available as soon as this returns. + * + * @param path The path to the module to load + * @return true if successful, false if not + */ + bool loadScript( const std::string& path ); + + /*! + * @brief Unloads a script + * + * @param name The module name of the script to unload + * @return true if successful + */ + bool unloadScript( const std::string& name ); + + /*! + * @brief Queues a script module to be reloaded + * + * Due to the nature of how this works, there's no return. + * It will just silently fail over and over again to infinity and beyond until the server restarts... not that should ever happen under normal circumstances. + * + * @param name The name of the module to be reloaded. + */ + void queueScriptReload( const std::string& name ); + + /*! + * @brief Case-insensitive search for modules, useful for debug commands + * + * @param scripts a set of ScriptInfo ptrs + * @param search the search term + */ + void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search ); + + /*! + * @brief Called on a regular interval, allows for scripts to be loaded from the internal load queue. + */ + void processLoadQueue(); + + /*! + * @brief Gets the module file extention for the current platform (windows, linux, osx) + * + * @return The file extension for the current platform + */ + const std::string getModuleExtension(); + + /*! + * @brief Checks to see if a module with the specified name exists + * + * @param name The module name to lookup + * @return true if loaded, false if not + */ + bool isModuleLoaded( const std::string& name ); + + /*! + * @brief Get a specific script from the internal table + * + * @tparam T The type of the script to search for + * @param scriptId The ID of the script to search for + * @return T* if successful, nullptr if the script doesn't exist + */ + template< typename T > + T* getScript( uint32_t scriptId ) + { + auto type = typeid( T ).hash_code(); + + auto script = m_scripts[ type ].find( scriptId ); + if( script == m_scripts[ type ].end() ) + return nullptr; + + return dynamic_cast< T* >( script->second ); + } + }; + + + /*! + * @brief Creates an instance of NativeScriptMgr + * + * @return a std::shared_ptr to NativeScriptMgr + */ + std::shared_ptr< NativeScriptMgr > createNativeScriptMgr(); } -} - #endif diff --git a/src/servers/sapphire_zone/Script/ScriptInfo.h b/src/servers/sapphire_zone/Script/ScriptInfo.h index db9488dc..058860ee 100644 --- a/src/servers/sapphire_zone/Script/ScriptInfo.h +++ b/src/servers/sapphire_zone/Script/ScriptInfo.h @@ -10,59 +10,59 @@ #include -typedef HMODULE ModuleHandle; +using ModuleHandle = HMODULE; #else -typedef void* ModuleHandle; +using ModuleHandle = void*; #endif -namespace Core { -namespace Scripting { - -/*! - * @brief An internal class used to track information about loaded modules and their scripts. - * - * The main purpose of this is to maintain easy access to the module handle and the pointers to scripts that are loaded. - * Furthermore, allows for quick and easy cross platform access to the module paths associated with the runtime module cache and its original path. - */ -class ScriptInfo +namespace Core::Scripting { -public: - ScriptInfo() = default; /*! - * @brief The file name of the loaded library. + * @brief An internal class used to track information about loaded modules and their scripts. * - * On all platforms, this will be the full filename of the module, eg: - * - script_instances.dll on Windows - * - libscript_instances.so on Linux + * The main purpose of this is to maintain easy access to the module handle and the pointers to scripts that are loaded. + * Furthermore, allows for quick and easy cross platform access to the module paths associated with the runtime module cache and its original path. */ - std::string library_name; + class ScriptInfo + { + public: + ScriptInfo() = default; - /*! - * @brief The path to the module currently loaded in memory from the cached location. - */ - std::string cache_path; + /*! + * @brief The file name of the loaded library. + * + * On all platforms, this will be the full filename of the module, eg: + * - script_instances.dll on Windows + * - libscript_instances.so on Linux + */ + std::string library_name; - /*! - * @brief The original path of the module before it was copied to the cache location. - */ - std::string library_path; + /*! + * @brief The path to the module currently loaded in memory from the cached location. + */ + std::string cache_path; - /*! - * @brief A handle to the module. - * - * The underlying type for this depends on platform. On Windows it's some stupid shit, on everything else it's a void*. - */ - ModuleHandle handle; + /*! + * @brief The original path of the module before it was copied to the cache location. + */ + std::string library_path; + + /*! + * @brief A handle to the module. + * + * The underlying type for this depends on platform. On Windows it's some stupid shit, on everything else it's a void*. + */ + ModuleHandle handle; + + /*! + * @brief An internal list of all the pointers to each ScriptObject + * + * This is tracked so when we unload this module we can call delete on each ScriptObject and correctly free it from memory. + */ + std::vector< ScriptObject* > scripts; + }; - /*! - * @brief An internal list of all the pointers to each ScriptObject - * - * This is tracked so when we unload this module we can call delete on each ScriptObject and correctly free it from memory. - */ - std::vector< ScriptObject* > scripts; -}; -} } diff --git a/src/servers/sapphire_zone/Script/ScriptLoader.h b/src/servers/sapphire_zone/Script/ScriptLoader.h index c1392315..11d399c4 100644 --- a/src/servers/sapphire_zone/Script/ScriptLoader.h +++ b/src/servers/sapphire_zone/Script/ScriptLoader.h @@ -18,94 +18,93 @@ using ModuleHandle = HMODULE; using ModuleHandle = void*; #endif -namespace Core { -namespace Scripting { - -/*! - * @brief Provides low level functionality for loading modules on different platforms along with managing those loaded modules. - */ -class ScriptLoader +namespace Core::Scripting { -protected: - /*! - * @brief The internal list of all modules that are loaded. - */ - std::unordered_map< std::string, ScriptInfo* > m_scriptMap; /*! - * @brief Unload a loaded module from it's ModuleHandle - * - * @return true if the unload was successful, false if not + * @brief Provides low level functionality for loading modules on different platforms along with managing those loaded modules. */ - bool unloadModule( ModuleHandle ); + class ScriptLoader + { + protected: + /*! + * @brief The internal list of all modules that are loaded. + */ + std::unordered_map< std::string, ScriptInfo* > m_scriptMap; -public: - ScriptLoader() = default; + /*! + * @brief Unload a loaded module from it's ModuleHandle + * + * @return true if the unload was successful, false if not + */ + bool unloadModule( ModuleHandle ); - /*! - * @brief Gets the module file extention for the current platform (windows, linux, osx) - * - * @return The file extension for the current platform - */ - const std::string getModuleExtension(); + public: + ScriptLoader() = default; - /*! - * @brief Load a module from a path - * - * Internally, this will also copy the module from it's original folder into the cache folder. - * - * @return A pointer to ScriptInfo if the load was successful, nullptr if it failed - */ - ScriptInfo* loadModule( const std::string& ); + /*! + * @brief Gets the module file extention for the current platform (windows, linux, osx) + * + * @return The file extension for the current platform + */ + const std::string getModuleExtension(); - /*! - * @brief Unload a script from it's ScriptInfo object - * - * @return true if successful, false if not - */ - bool unloadScript( ScriptInfo* ); + /*! + * @brief Load a module from a path + * + * Internally, this will also copy the module from it's original folder into the cache folder. + * + * @return A pointer to ScriptInfo if the load was successful, nullptr if it failed + */ + ScriptInfo* loadModule( const std::string& ); - /*! - * @brief Unload a script via it's module handle - * - * @return true if successful, false if not - */ - bool unloadScript( ModuleHandle ); + /*! + * @brief Unload a script from it's ScriptInfo object + * + * @return true if successful, false if not + */ + bool unloadScript( ScriptInfo* ); - /*! - * @brief Look up a ScriptInfo* by a module name - * - * @param name The exact module name to search for, case-sensitive - * @return The ScriptInfo ptr if successful, nullptr if it wasn't found - */ - ScriptInfo* getScriptInfo( std::string name ); + /*! + * @brief Unload a script via it's module handle + * + * @return true if successful, false if not + */ + bool unloadScript( ModuleHandle ); - /*! - * @brief Get all scripts assoicated with a module - * - * @param handle The handle to the module - * @return An array of unknown size ending with nullptr if success, nullptr if not - */ - ScriptObject** getScripts( ModuleHandle handle ); + /*! + * @brief Look up a ScriptInfo* by a module name + * + * @param name The exact module name to search for, case-sensitive + * @return The ScriptInfo ptr if successful, nullptr if it wasn't found + */ + ScriptInfo* getScriptInfo( std::string name ); - /*! - * @brief Checks to see if a module with the specified name exists - * - * @param name The module name to lookup - * @return true if loaded, false if not - */ - bool isModuleLoaded( std::string name ); + /*! + * @brief Get all scripts assoicated with a module + * + * @param handle The handle to the module + * @return An array of unknown size ending with nullptr if success, nullptr if not + */ + ScriptObject** getScripts( ModuleHandle handle ); - /*! - * @brief Case-insensitive search for modules, useful for debug commands - * - * @param scripts a set of ScriptInfo ptrs - * @param search the search term - */ - void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search ); -}; + /*! + * @brief Checks to see if a module with the specified name exists + * + * @param name The module name to lookup + * @return true if loaded, false if not + */ + bool isModuleLoaded( std::string name ); + + /*! + * @brief Case-insensitive search for modules, useful for debug commands + * + * @param scripts a set of ScriptInfo ptrs + * @param search the search term + */ + void findScripts( std::set< Core::Scripting::ScriptInfo* >& scripts, const std::string& search ); + }; -} } diff --git a/src/servers/sapphire_zone/Script/ScriptMgr.cpp b/src/servers/sapphire_zone/Script/ScriptMgr.cpp index 1c163ead..cb228af9 100644 --- a/src/servers/sapphire_zone/Script/ScriptMgr.cpp +++ b/src/servers/sapphire_zone/Script/ScriptMgr.cpp @@ -407,7 +407,7 @@ bool Core::Scripting::ScriptMgr::onInstanceEnterTerritory( InstanceContentPtr in return false; } -Scripting::NativeScriptMgr& Core::Scripting::ScriptMgr::getNativeScriptHandler() +Core::Scripting::NativeScriptMgr& Core::Scripting::ScriptMgr::getNativeScriptHandler() { return *m_nativeScriptMgr; } diff --git a/src/servers/sapphire_zone/Script/ScriptMgr.h b/src/servers/sapphire_zone/Script/ScriptMgr.h index 112843f6..89b0ab2f 100644 --- a/src/servers/sapphire_zone/Script/ScriptMgr.h +++ b/src/servers/sapphire_zone/Script/ScriptMgr.h @@ -8,95 +8,94 @@ #include #include "Forwards.h" -namespace Core { -namespace Scripting { - -class ScriptMgr +namespace Core::Scripting { -private: - /*! - * @brief A shared ptr to NativeScriptMgr, used for accessing and managing the native script system. - */ - std::shared_ptr< NativeScriptMgr > m_nativeScriptMgr; - std::function< std::string( Entity::Player & ) > m_onFirstEnterWorld; + class ScriptMgr + { + private: + /*! + * @brief A shared ptr to NativeScriptMgr, used for accessing and managing the native script system. + */ + std::shared_ptr< NativeScriptMgr > m_nativeScriptMgr; - /*! - * @brief Used to ignore the first change notification that Watchdog emits. - * Because reasons, it likes to emit an initial notification with all the files that match the filter, we don't want that so we ignore it. - */ - bool m_firstScriptChangeNotificiation; + std::function< std::string( Entity::Player & ) > m_onFirstEnterWorld; -public: - ScriptMgr(); + /*! + * @brief Used to ignore the first change notification that Watchdog emits. + * Because reasons, it likes to emit an initial notification with all the files that match the filter, we don't want that so we ignore it. + */ + bool m_firstScriptChangeNotificiation; - ~ScriptMgr(); + public: + ScriptMgr(); - /*! - * @brief Loads all the script modules and readies the ScriptMgr - * - * This gets all the modules inside the specified scripts folder and then attempts to load each one. - * After that, it starts the directory watcher so the server can reload modules at runtime when changes occur. - * - * @return true if init success - */ - bool init(); + ~ScriptMgr(); - /*! - * @brief Called on each tick or at a regular interval. Allows for the NativeScriptMgr to process module loading and reloading. - */ - void update(); + /*! + * @brief Loads all the script modules and readies the ScriptMgr + * + * This gets all the modules inside the specified scripts folder and then attempts to load each one. + * After that, it starts the directory watcher so the server can reload modules at runtime when changes occur. + * + * @return true if init success + */ + bool init(); - /*! - * @brief Registers a directory watcher which allows for script modules to be reloaded when changes to the modules occur - */ - void watchDirectories(); + /*! + * @brief Called on each tick or at a regular interval. Allows for the NativeScriptMgr to process module loading and reloading. + */ + void update(); - void onPlayerFirstEnterWorld( Entity::Player& player ); + /*! + * @brief Registers a directory watcher which allows for script modules to be reloaded when changes to the modules occur + */ + void watchDirectories(); - bool onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId ); + void onPlayerFirstEnterWorld( Entity::Player& player ); - bool onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ); + bool onTalk( Entity::Player& player, uint64_t actorId, uint32_t eventId ); - bool onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); + bool onEnterTerritory( Entity::Player& player, uint32_t eventId, uint16_t param1, uint16_t param2 ); - bool onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); + bool onWithinRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); - bool onEmote( Entity::Player& player, uint64_t actorId, uint32_t eventId, uint8_t emoteId ); + bool onOutsideRange( Entity::Player& player, uint32_t eventId, uint32_t param1, float x, float y, float z ); - bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, - uint64_t targetId ); + bool onEmote( Entity::Player& player, uint64_t actorId, uint32_t eventId, uint8_t emoteId ); - bool onMobKill( Entity::Player& player, uint16_t nameId ); + bool onEventItem( Entity::Player& player, uint32_t eventItemId, uint32_t eventId, uint32_t castTime, + uint64_t targetId ); - bool onCastFinish( Entity::Player& pPlayer, Entity::CharaPtr pTarget, uint32_t actionId ); + bool onMobKill( Entity::Player& player, uint16_t nameId ); - bool onStatusReceive( Entity::CharaPtr pActor, uint32_t effectId ); + bool onCastFinish( Entity::Player& pPlayer, Entity::CharaPtr pTarget, uint32_t actionId ); - bool onStatusTick( Entity::CharaPtr pActor, Core::StatusEffect::StatusEffect& effect ); + bool onStatusReceive( Entity::CharaPtr pActor, uint32_t effectId ); - bool onStatusTimeOut( Entity::CharaPtr pActor, uint32_t effectId ); + bool onStatusTick( Entity::CharaPtr pActor, Core::StatusEffect::StatusEffect& effect ); - bool onZoneInit( ZonePtr pZone ); + bool onStatusTimeOut( Entity::CharaPtr pActor, uint32_t effectId ); - bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1, - uint16_t param2, uint16_t param3 ); + bool onZoneInit( ZonePtr pZone ); - bool onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, - uint32_t catalogId ); + bool onEventHandlerReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param1, + uint16_t param2, uint16_t param3 ); - bool onInstanceInit( InstanceContentPtr instance ); + bool onEventHandlerTradeReturn( Entity::Player& player, uint32_t eventId, uint16_t subEvent, uint16_t param, + uint32_t catalogId ); - bool onInstanceUpdate( InstanceContentPtr instance, uint32_t currTime ); + bool onInstanceInit( InstanceContentPtr instance ); - bool - onInstanceEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1, - uint16_t param2 ); + bool onInstanceUpdate( InstanceContentPtr instance, uint32_t currTime ); - bool loadDir( const std::string& dirname, std::set< std::string >& files, const std::string& ext ); + bool + onInstanceEnterTerritory( InstanceContentPtr instance, Entity::Player& player, uint32_t eventId, uint16_t param1, + uint16_t param2 ); - NativeScriptMgr& getNativeScriptHandler(); -}; -} + bool loadDir( const std::string& dirname, std::set< std::string >& files, const std::string& ext ); + + NativeScriptMgr& getNativeScriptHandler(); + }; } #endif