From faf42d2f8cf432df2993b031f079b0b8c6d7dbe7 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sun, 22 Jan 2023 17:38:47 -0600 Subject: [PATCH] cleanup enums to make them more consistent --- dChatServer/ChatPacketHandler.cpp | 56 +++---- dChatServer/ChatPacketHandler.h | 4 +- dCommon/dEnums/ItemSetPassiveAbilityID.h | 105 ------------- dCommon/dEnums/MissionLockState.h | 13 -- dCommon/dEnums/MissionState.h | 56 ------- dCommon/dEnums/MissionTaskType.h | 31 ---- dCommon/dEnums/PermissionMap.h | 42 ------ dCommon/dEnums/RacingTaskParam.h | 20 --- ...esponseCode.h => eAddFriendResponseCode.h} | 6 +- ...esponseType.h => eAddFriendResponseType.h} | 8 +- dCommon/dEnums/eBubbleType.h | 4 +- dCommon/dEnums/eHelpType.h | 41 +++++ dCommon/dEnums/eItemSetPassiveAbilityID.h | 58 +++++++ dCommon/dEnums/eItemType.h | 50 +++--- dCommon/dEnums/eMissionLockState.h | 12 ++ dCommon/dEnums/eMissionState.h | 56 +++++++ dCommon/dEnums/eMissionTaskType.h | 43 ++++++ dCommon/dEnums/ePackageType.h | 13 ++ dCommon/dEnums/ePermissionMap.h | 46 ++++++ dCommon/dEnums/eRacingTaskParam.h | 25 +++ dGame/Character.cpp | 16 +- dGame/Character.h | 9 +- dGame/Entity.cpp | 5 +- dGame/TradingManager.cpp | 5 +- dGame/dComponents/AchievementCacheKey.h | 10 +- dGame/dComponents/DestroyableComponent.cpp | 15 +- dGame/dComponents/InventoryComponent.cpp | 27 ++-- dGame/dComponents/InventoryComponent.h | 10 +- dGame/dComponents/MissionComponent.cpp | 19 +-- dGame/dComponents/MissionComponent.h | 18 +-- dGame/dComponents/MissionOfferComponent.cpp | 9 +- dGame/dComponents/PetComponent.cpp | 4 +- .../PropertyManagementComponent.cpp | 3 +- dGame/dComponents/RacingControlComponent.cpp | 19 +-- dGame/dComponents/RebuildComponent.cpp | 6 +- .../dComponents/ScriptedActivityComponent.cpp | 3 +- dGame/dGameMessages/GameMessageHandler.cpp | 3 +- dGame/dGameMessages/GameMessages.cpp | 55 +++---- dGame/dInventory/Inventory.cpp | 51 ++++--- dGame/dInventory/Item.cpp | 6 +- dGame/dInventory/ItemSet.cpp | 3 +- dGame/dInventory/ItemSetPassiveAbility.cpp | 142 +++++++++--------- dGame/dMission/Mission.cpp | 70 +++++---- dGame/dMission/Mission.h | 15 +- dGame/dMission/MissionPrerequisites.cpp | 4 +- dGame/dMission/MissionTask.cpp | 51 ++++--- dGame/dMission/MissionTask.h | 4 +- dGame/dUtilities/Loot.cpp | 10 +- dGame/dUtilities/Mail.cpp | 5 +- dGame/dUtilities/Preconditions.cpp | 10 +- dGame/dUtilities/SlashCommandHandler.cpp | 3 +- dNet/ClientPackets.cpp | 2 +- .../02_server/Equipment/BootyDigServer.cpp | 7 +- .../Equipment/MaestromExtracticatorServer.cpp | 3 +- .../02_server/Map/AG/NpcAgCourseStarter.cpp | 4 +- dScripts/02_server/Map/AG/NpcCowboyServer.cpp | 14 +- dScripts/02_server/Map/AG/NpcCowboyServer.h | 2 +- .../02_server/Map/AG/NpcEpsilonServer.cpp | 2 +- dScripts/02_server/Map/AG/NpcEpsilonServer.h | 2 +- .../02_server/Map/AG/NpcNjAssistantServer.cpp | 9 +- .../02_server/Map/AG/NpcNjAssistantServer.h | 2 +- dScripts/02_server/Map/AG/NpcPirateServer.cpp | 8 +- dScripts/02_server/Map/AG/NpcPirateServer.h | 2 +- dScripts/02_server/Map/AG/NpcWispServer.cpp | 10 +- dScripts/02_server/Map/AG/NpcWispServer.h | 2 +- .../02_server/Map/AG/RemoveRentalGear.cpp | 6 +- dScripts/02_server/Map/AG/RemoveRentalGear.h | 2 +- .../02_server/Map/AM/AmDropshipComputer.cpp | 3 +- dScripts/02_server/Map/FV/FvFong.cpp | 6 +- dScripts/02_server/Map/FV/FvFong.h | 2 +- .../02_server/Map/FV/ImgBrickConsoleQB.cpp | 5 +- dScripts/02_server/Map/GF/GfTikiTorch.cpp | 3 +- .../02_server/Map/General/ExplodingAsset.cpp | 5 +- .../02_server/Map/General/GrowingFlower.cpp | 12 +- .../General/ImaginationBackpackHealServer.cpp | 6 +- .../02_server/Map/General/PetDigServer.cpp | 7 +- .../02_server/Map/General/PropertyDevice.cpp | 3 +- .../Map/General/TouchMissionUpdateServer.cpp | 3 +- .../02_server/Map/NT/NtAssemblyTubeServer.cpp | 4 +- dScripts/02_server/Map/NT/NtDukeServer.cpp | 7 +- dScripts/02_server/Map/NT/NtDukeServer.h | 2 +- .../02_server/Map/NT/NtParadoxPanelServer.cpp | 3 +- .../02_server/Map/NT/NtParadoxTeleServer.cpp | 3 +- .../Map/NT/NtSentinelWalkwayServer.cpp | 3 +- dScripts/02_server/Map/NT/NtVandaServer.cpp | 6 +- dScripts/02_server/Map/NT/NtVandaServer.h | 2 +- .../Map/NT/NtVentureSpeedPadServer.cpp | 3 +- .../02_server/Map/PR/SpawnGryphonServer.cpp | 3 +- .../Map/Property/AG_Small/ZoneAgProperty.cpp | 11 +- .../02_server/Map/SS/SsModularBuildServer.cpp | 3 +- .../02_server/Map/VE/VeBricksampleServer.cpp | 3 +- dScripts/02_server/Map/VE/VeEpsilonServer.cpp | 6 +- dScripts/02_server/Map/VE/VeEpsilonServer.h | 2 +- dScripts/02_server/Map/njhub/NjColeNPC.cpp | 5 +- dScripts/02_server/Map/njhub/NjColeNPC.h | 2 +- .../02_server/Map/njhub/NjJayMissionItems.cpp | 2 +- .../02_server/Map/njhub/NjJayMissionItems.h | 2 +- .../Map/njhub/NjNPCMissionSpinjitzuServer.cpp | 7 +- .../Map/njhub/NjNPCMissionSpinjitzuServer.h | 2 +- dScripts/02_server/Map/njhub/NjWuNPC.cpp | 11 +- dScripts/02_server/Map/njhub/NjWuNPC.h | 2 +- dScripts/BasePropertyServer.cpp | 6 +- dScripts/BaseSurvivalServer.cpp | 11 +- dScripts/BaseWavesServer.cpp | 23 +-- dScripts/CppScripts.h | 8 +- dScripts/Darkitect.cpp | 3 +- dScripts/NPCAddRemoveItem.cpp | 8 +- dScripts/NPCAddRemoveItem.h | 2 +- dScripts/NtFactionSpyServer.cpp | 3 +- dScripts/ai/AG/ActSharkPlayerDeathTrigger.cpp | 4 +- dScripts/ai/FV/FvFreeGfNinjas.cpp | 7 +- dScripts/ai/FV/FvFreeGfNinjas.h | 2 +- dScripts/ai/GENERAL/LegoDieRoll.cpp | 3 +- dScripts/ai/GF/GfJailkeepMission.cpp | 9 +- dScripts/ai/GF/GfJailkeepMission.h | 2 +- dScripts/ai/GF/PetDigBuild.cpp | 3 +- dScripts/ai/GF/PirateRep.cpp | 6 +- dScripts/ai/GF/PirateRep.h | 2 +- .../ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp | 9 +- dScripts/ai/NP/NpcNpSpacemanBob.cpp | 5 +- dScripts/ai/NP/NpcNpSpacemanBob.h | 2 +- dScripts/ai/NS/NsConcertInstrument.cpp | 6 +- dScripts/ai/NS/NsJohnnyMissionServer.cpp | 5 +- dScripts/ai/NS/NsJohnnyMissionServer.h | 2 +- dScripts/ai/NS/NsModularBuild.cpp | 3 +- dScripts/ai/PROPERTY/AG/AgPropGuard.cpp | 11 +- dScripts/ai/PROPERTY/AG/AgPropGuard.h | 2 +- dScripts/ai/PROPERTY/AgPropguards.cpp | 8 +- dScripts/ai/PROPERTY/AgPropguards.h | 2 +- .../OBJECTS/FvRaceSmashEggImagineServer.cpp | 7 +- .../RACING/OBJECTS/RaceImagineCrateServer.cpp | 5 +- .../ai/RACING/OBJECTS/RaceImaginePowerup.cpp | 5 +- .../ai/RACING/OBJECTS/RaceSmashServer.cpp | 7 +- 133 files changed, 898 insertions(+), 808 deletions(-) delete mode 100644 dCommon/dEnums/ItemSetPassiveAbilityID.h delete mode 100644 dCommon/dEnums/MissionLockState.h delete mode 100644 dCommon/dEnums/MissionState.h delete mode 100644 dCommon/dEnums/MissionTaskType.h delete mode 100644 dCommon/dEnums/PermissionMap.h delete mode 100644 dCommon/dEnums/RacingTaskParam.h rename dCommon/dEnums/{AddFriendResponseCode.h => eAddFriendResponseCode.h} (50%) rename dCommon/dEnums/{AddFriendResponseType.h => eAddFriendResponseType.h} (59%) create mode 100644 dCommon/dEnums/eHelpType.h create mode 100644 dCommon/dEnums/eItemSetPassiveAbilityID.h create mode 100644 dCommon/dEnums/eMissionLockState.h create mode 100644 dCommon/dEnums/eMissionState.h create mode 100644 dCommon/dEnums/eMissionTaskType.h create mode 100644 dCommon/dEnums/ePackageType.h create mode 100644 dCommon/dEnums/ePermissionMap.h create mode 100644 dCommon/dEnums/eRacingTaskParam.h diff --git a/dChatServer/ChatPacketHandler.cpp b/dChatServer/ChatPacketHandler.cpp index 119083ee..592c3870 100644 --- a/dChatServer/ChatPacketHandler.cpp +++ b/dChatServer/ChatPacketHandler.cpp @@ -8,8 +8,8 @@ #include "dServer.h" #include "GeneralUtils.h" #include "dLogger.h" -#include "AddFriendResponseCode.h" -#include "AddFriendResponseType.h" +#include "eAddFriendResponseCode.h" +#include "eAddFriendResponseType.h" #include "RakString.h" #include "dConfig.h" @@ -115,7 +115,7 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) { auto requestor = playerContainer.GetPlayerData(requestorPlayerID); if (requestor->playerName == playerName) { - SendFriendResponse(requestor, requestor, AddFriendResponseType::MYTHRAN); + SendFriendResponse(requestor, requestor, eAddFriendResponseType::MYTHRAN); return; }; std::unique_ptr requestee(playerContainer.GetPlayerData(playerName)); @@ -153,7 +153,7 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) { requestee.reset(new PlayerData()); requestee->playerName = playerName; - SendFriendResponse(requestor, requestee.get(), result->next() ? AddFriendResponseType::NOTONLINE : AddFriendResponseType::INVALIDCHARACTER); + SendFriendResponse(requestor, requestee.get(), result->next() ? eAddFriendResponseType::NOTONLINE : eAddFriendResponseType::INVALIDCHARACTER); return; } @@ -197,10 +197,10 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) { if (oldBestFriendStatus != bestFriendStatus) { if (requestee->countOfBestFriends >= maxNumberOfBestFriends || requestor->countOfBestFriends >= maxNumberOfBestFriends) { if (requestee->countOfBestFriends >= maxNumberOfBestFriends) { - SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::THEIRFRIENDLISTFULL, false); + SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::THEIRFRIENDLISTFULL, false); } if (requestor->countOfBestFriends >= maxNumberOfBestFriends) { - SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::YOURFRIENDSLISTFULL, false); + SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::YOURFRIENDSLISTFULL, false); } } else { // Then update the database with this new info. @@ -215,8 +215,8 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) { if (bestFriendStatus == 3U) { requestee->countOfBestFriends += 1; requestor->countOfBestFriends += 1; - if (requestee->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestee.get(), requestor, AddFriendResponseType::ACCEPTED, false, true); - if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::ACCEPTED, false, true); + if (requestee->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestee.get(), requestor, eAddFriendResponseType::ACCEPTED, false, true); + if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::ACCEPTED, false, true); for (auto& friendData : requestor->friends) { if (friendData.friendID == requestee->playerID) { friendData.isBestFriend = true; @@ -230,7 +230,7 @@ void ChatPacketHandler::HandleFriendRequest(Packet* packet) { } } } else { - if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), AddFriendResponseType::WAITINGAPPROVAL, true, true); + if (requestor->sysAddr != UNASSIGNED_SYSTEM_ADDRESS) SendFriendResponse(requestor, requestee.get(), eAddFriendResponseType::WAITINGAPPROVAL, true, true); } } else { // Do not send this if we are requesting to be a best friend. @@ -247,7 +247,7 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) { inStream.Read(playerID); inStream.Read(playerID); - AddFriendResponseCode clientResponseCode = static_cast(packet->data[0x14]); + eAddFriendResponseCode clientResponseCode = static_cast(packet->data[0x14]); std::string friendName = PacketUtils::ReadString(0x15, packet, true); //Now to try and find both of these: @@ -255,29 +255,29 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) { auto requestee = playerContainer.GetPlayerData(friendName); if (!requestor || !requestee) return; - AddFriendResponseType serverResponseCode{}; + eAddFriendResponseType serverResponseCode{}; uint8_t isAlreadyBestFriends = 0U; // We need to convert this response code to one we can actually send back to the client. switch (clientResponseCode) { - case AddFriendResponseCode::ACCEPTED: - serverResponseCode = AddFriendResponseType::ACCEPTED; + case eAddFriendResponseCode::ACCEPTED: + serverResponseCode = eAddFriendResponseType::ACCEPTED; break; - case AddFriendResponseCode::BUSY: - serverResponseCode = AddFriendResponseType::BUSY; + case eAddFriendResponseCode::BUSY: + serverResponseCode = eAddFriendResponseType::BUSY; break; - case AddFriendResponseCode::CANCELLED: - serverResponseCode = AddFriendResponseType::CANCELLED; + case eAddFriendResponseCode::CANCELLED: + serverResponseCode = eAddFriendResponseType::CANCELLED; break; - case AddFriendResponseCode::REJECTED: - serverResponseCode = AddFriendResponseType::DECLINED; + case eAddFriendResponseCode::REJECTED: + serverResponseCode = eAddFriendResponseType::DECLINED; break; } // Now that we have handled the base cases, we need to check the other cases. - if (serverResponseCode == AddFriendResponseType::ACCEPTED) { + if (serverResponseCode == eAddFriendResponseType::ACCEPTED) { for (auto friendData : requestor->friends) { if (friendData.friendID == requestee->playerID) { - serverResponseCode = AddFriendResponseType::ALREADYFRIEND; + serverResponseCode = eAddFriendResponseType::ALREADYFRIEND; if (friendData.isBestFriend) { isAlreadyBestFriends = 1U; } @@ -286,7 +286,7 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) { } // This message is NOT sent for best friends and is handled differently for those requests. - if (serverResponseCode == AddFriendResponseType::ACCEPTED) { + if (serverResponseCode == eAddFriendResponseType::ACCEPTED) { // Add the each player to the others friend list. FriendData requestorData; requestorData.zoneID = requestor->zoneID; @@ -313,8 +313,8 @@ void ChatPacketHandler::HandleFriendResponse(Packet* packet) { statement->execute(); } - if (serverResponseCode != AddFriendResponseType::DECLINED) SendFriendResponse(requestor, requestee, serverResponseCode, isAlreadyBestFriends); - if (serverResponseCode != AddFriendResponseType::ALREADYFRIEND) SendFriendResponse(requestee, requestor, serverResponseCode, isAlreadyBestFriends); + if (serverResponseCode != eAddFriendResponseType::DECLINED) SendFriendResponse(requestor, requestee, serverResponseCode, isAlreadyBestFriends); + if (serverResponseCode != eAddFriendResponseType::ALREADYFRIEND) SendFriendResponse(requestee, requestor, serverResponseCode, isAlreadyBestFriends); } void ChatPacketHandler::HandleRemoveFriend(Packet* packet) { @@ -922,7 +922,7 @@ void ChatPacketHandler::SendFriendRequest(PlayerData* receiver, PlayerData* send //Make sure people aren't requesting people that they're already friends with: for (auto fr : receiver->friends) { if (fr.friendID == sender->playerID) { - SendFriendResponse(sender, receiver, AddFriendResponseType::ALREADYFRIEND, fr.isBestFriend); + SendFriendResponse(sender, receiver, eAddFriendResponseType::ALREADYFRIEND, fr.isBestFriend); return; //we have this player as a friend, yeet this function so it doesn't send another request. } } @@ -940,7 +940,7 @@ void ChatPacketHandler::SendFriendRequest(PlayerData* receiver, PlayerData* send SEND_PACKET; } -void ChatPacketHandler::SendFriendResponse(PlayerData* receiver, PlayerData* sender, AddFriendResponseType responseCode, uint8_t isBestFriendsAlready, uint8_t isBestFriendRequest) { +void ChatPacketHandler::SendFriendResponse(PlayerData* receiver, PlayerData* sender, eAddFriendResponseType responseCode, uint8_t isBestFriendsAlready, uint8_t isBestFriendRequest) { if (!receiver || !sender) return; CBITSTREAM; @@ -951,11 +951,11 @@ void ChatPacketHandler::SendFriendResponse(PlayerData* receiver, PlayerData* sen PacketUtils::WriteHeader(bitStream, CLIENT, MSG_CLIENT_ADD_FRIEND_RESPONSE); bitStream.Write(responseCode); // For all requests besides accepted, write a flag that says whether or not we are already best friends with the receiver. - bitStream.Write(responseCode != AddFriendResponseType::ACCEPTED ? isBestFriendsAlready : sender->sysAddr != UNASSIGNED_SYSTEM_ADDRESS); + bitStream.Write(responseCode != eAddFriendResponseType::ACCEPTED ? isBestFriendsAlready : sender->sysAddr != UNASSIGNED_SYSTEM_ADDRESS); // Then write the player name PacketUtils::WritePacketWString(sender->playerName.c_str(), 33, &bitStream); // Then if this is an acceptance code, write the following extra info. - if (responseCode == AddFriendResponseType::ACCEPTED) { + if (responseCode == eAddFriendResponseType::ACCEPTED) { bitStream.Write(sender->playerID); bitStream.Write(sender->zoneID); bitStream.Write(isBestFriendRequest); //isBFF diff --git a/dChatServer/ChatPacketHandler.h b/dChatServer/ChatPacketHandler.h index fffd1ca4..f2d83502 100644 --- a/dChatServer/ChatPacketHandler.h +++ b/dChatServer/ChatPacketHandler.h @@ -4,7 +4,7 @@ #include "BitStream.h" struct PlayerData; -enum class AddFriendResponseType : uint8_t; +enum class eAddFriendResponseType : uint8_t; namespace ChatPacketHandler { void HandleFriendlistRequest(Packet* packet); @@ -35,6 +35,6 @@ namespace ChatPacketHandler { void SendFriendUpdate(PlayerData* friendData, PlayerData* playerData, uint8_t notifyType, uint8_t isBestFriend); void SendFriendRequest(PlayerData* receiver, PlayerData* sender); - void SendFriendResponse(PlayerData* receiver, PlayerData* sender, AddFriendResponseType responseCode, uint8_t isBestFriendsAlready = 0U, uint8_t isBestFriendRequest = 0U); + void SendFriendResponse(PlayerData* receiver, PlayerData* sender, eAddFriendResponseType responseCode, uint8_t isBestFriendsAlready = 0U, uint8_t isBestFriendRequest = 0U); void SendRemoveFriend(PlayerData* receiver, std::string& personToRemove, bool isSuccessful); }; diff --git a/dCommon/dEnums/ItemSetPassiveAbilityID.h b/dCommon/dEnums/ItemSetPassiveAbilityID.h deleted file mode 100644 index 92caea19..00000000 --- a/dCommon/dEnums/ItemSetPassiveAbilityID.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -/** -2 Engineer (Rank 1) Item Set -3 Engineer (Rank 2) Item Set -4 Engineer (Rank 3) Item Set -7 Knight (Rank 1) Item Set -8 Knight (Rank 2) Item Set -9 Knight (Rank 3) Item Set -10 Space Ranger (Rank 1) Item Set -11 Space Ranger (Rank 2) Item Set -12 Space Ranger (Rank 3) Item Set -13 Samurai (Rank 1) Item Set -14 Samurai (Rank 2) Item Set -15 Samurai (Rank 3) Item Set -16 Sorcerer (Rank 1) Item Set -17 Sorcerer (Rank 2) Item Set -18 Sorcerer (Rank 3) Item Set -19 Space Marauder (Rank 1) Item Set -20 Space Marauder (Rank 2) Item Set -21 Space Marauder (Rank 3) Item Set -22 Shinobi (Rank 1) Item Set -23 Shinobi (Rank 2) Item Set -24 Shinobi (Rank 3) Item Set -25 Inventor (Rank 1) Item Set -26 Inventor (Rank 2) Item Set -27 Inventor (Rank 3) Item Set -28 Summoner (Rank 1) Item Set -29 Summoner (Rank 2) Item Set -30 Summoner (Rank 3) Item Set -31 Adventurer (Rank 1) Item Set -32 Adventurer (Rank 2) Item Set -33 Adventurer (Rank 3) Item Set -34 Daredevil (Rank 1) Item Set -35 Daredevil (Rank 2) Item Set -36 Daredevil (Rank 3) Item Set -37 Buccaneer (Rank 1) Item Set -38 Buccaneer (Rank 2) Item Set -39 Buccaneer (Rank 3) Item Set -40 Bone Suit Item Set -41 Imagination Spinjitzu Item Set -42 Bat Lord Item Set -43 Mosaic Jester Item Set -44 Explorien Bot Item Set -45 [Unnamed] Item Set -46 [Unnamed] Item Set -47 [Unnamed] Item Set -48 Earth Spinjitzu Item Set -49 [Unnamed] Item Set -50 Fire Spinjitzu Item Set -51 Ice Spinjitzu Item Set -52 Lightning Spinjitzu Item Set - */ -enum class ItemSetPassiveAbilityID -{ - EngineerRank1 = 2, - EngineerRank2 = 3, - EngineerRank3 = 4, - KnightRank1 = 7, - KnightRank2 = 8, - KnightRank3 = 9, - SpaceRangerRank1 = 10, - SpaceRangerRank2 = 11, - SpaceRangerRank3 = 12, - SamuraiRank1 = 13, - SamuraiRank2 = 14, - SamuraiRank3 = 15, - SorcererRank1 = 16, - SorcererRank2 = 17, - SorcererRank3 = 18, - SpaceMarauderRank1 = 19, - SpaceMarauderRank2 = 20, - SpaceMarauderRank3 = 21, - ShinobiRank1 = 22, - ShinobiRank2 = 23, - ShinobiRank3 = 24, - InventorRank1 = 25, - InventorRank2 = 26, - InventorRank3 = 27, - SummonerRank1 = 28, - SummonerRank2 = 29, - SummonerRank3 = 30, - AdventurerRank1 = 31, - AdventurerRank2 = 32, - AdventurerRank3 = 33, - DaredevilRank1 = 34, - DaredevilRank2 = 35, - DaredevilRank3 = 36, - BuccaneerRank1 = 37, - BuccaneerRank2 = 38, - BuccaneerRank3 = 39, - BoneSuit = 40, - ImaginationSpinjitzu = 41, - BatLord = 42, - MosaicJester = 43, - ExplorienBot = 44, - Unnamed1 = 45, - Unnamed2 = 46, - Unnamed3 = 47, - EarthSpinjitzu = 48, - Unnamed4 = 49, - FireSpinjitzu = 50, - IceSpinjitzu = 51, - LightningSpinjitzu = 52 -}; diff --git a/dCommon/dEnums/MissionLockState.h b/dCommon/dEnums/MissionLockState.h deleted file mode 100644 index 9fd2252a..00000000 --- a/dCommon/dEnums/MissionLockState.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifndef MISSIONLOCKSTATE_H -#define MISSIONLOCKSTATE_H - -enum class MissionLockState : int -{ - MISSION_LOCK_LOCKED, - MISSION_LOCK_NEW, - MISSION_LOCK_UNLOCKED, -}; - -#endif diff --git a/dCommon/dEnums/MissionState.h b/dCommon/dEnums/MissionState.h deleted file mode 100644 index f040d33a..00000000 --- a/dCommon/dEnums/MissionState.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#ifndef __MISSIONSTATE__H__ -#define __MISSIONSTATE__H__ - -/** - * Represents the possible states a mission can be in - */ -enum class MissionState : int32_t { - /** - * The mission state is unknown - */ - MISSION_STATE_UNKNOWN = -1, - - /** - * The mission is yielding rewards - */ - MISSION_STATE_REWARDING = 0, - - /** - * The mission can be accepted - */ - MISSION_STATE_AVAILABLE = 1, - - /** - * The mission has been accepted but not yet completed - */ - MISSION_STATE_ACTIVE = 2, - - /** - * All the tasks for the mission have been completed and the entity can turn the mission in to complete it - */ - MISSION_STATE_READY_TO_COMPLETE = 4, //!< The mission is ready to complete - - /** - * The mission has been completed - */ - MISSION_STATE_COMPLETE = 8, - - /** - * The mission is available again and has been completed before. Used for daily missions. - */ - MISSION_STATE_COMPLETE_AVAILABLE = 9, - - /** - * The mission is active and has been completed before. Used for daily missions. - */ - MISSION_STATE_COMPLETE_ACTIVE = 10, - - /** - * The mission has been completed before and has now been completed again. Used for daily missions. - */ - MISSION_STATE_COMPLETE_READY_TO_COMPLETE = 12 -}; - -#endif //!__MISSIONSTATE__H__ diff --git a/dCommon/dEnums/MissionTaskType.h b/dCommon/dEnums/MissionTaskType.h deleted file mode 100644 index 6c9b2668..00000000 --- a/dCommon/dEnums/MissionTaskType.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#ifndef MISSIONTASKTYPE_H -#define MISSIONTASKTYPE_H - -//! An enum for mission task types -enum class MissionTaskType : int { - MISSION_TASK_TYPE_UNKNOWN = -1, //!< The task type is unknown - MISSION_TASK_TYPE_SMASH = 0, //!< A task for smashing something - MISSION_TASK_TYPE_SCRIPT = 1, //!< A task handled by a server LUA script - MISSION_TASK_TYPE_ACTIVITY = 2, //!< A task for completing a quickbuild - MISSION_TASK_TYPE_ENVIRONMENT = 3, //!< A task for something in the environment - MISSION_TASK_TYPE_MISSION_INTERACTION = 4, //!< A task for interacting with a mission - MISSION_TASK_TYPE_EMOTE = 5, //!< A task for playing an emote - MISSION_TASK_TYPE_FOOD = 9, //!< A task for eating food - MISSION_TASK_TYPE_SKILL = 10, //!< A task for performing a skill - MISSION_TASK_TYPE_ITEM_COLLECTION = 11, //!< A task for collecting an item - MISSION_TASK_TYPE_LOCATION = 12, //!< A task for finding a location - MISSION_TASK_TYPE_MINIGAME = 14, //!< A task for doing something in a minigame - MISSION_TASK_TYPE_NON_MISSION_INTERACTION = 15, //!< A task for interacting with a non-mission - MISSION_TASK_TYPE_MISSION_COMPLETE = 16, //!< A task for completing a mission - MISSION_TASK_TYPE_EARN_REPUTATION = 17, //!< A task for earning reputation - MISSION_TASK_TYPE_POWERUP = 21, //!< A task for collecting a powerup - MISSION_TASK_TYPE_PET_TAMING = 22, //!< A task for taming a pet - MISSION_TASK_TYPE_RACING = 23, //!< A task for racing - MISSION_TASK_TYPE_PLAYER_FLAG = 24, //!< A task for setting a player flag - MISSION_TASK_TYPE_PLACE_MODEL = 25, //!< A task for picking up a model - MISSION_TASK_TYPE_VISIT_PROPERTY = 30 //!< A task for visiting a property -}; - -#endif diff --git a/dCommon/dEnums/PermissionMap.h b/dCommon/dEnums/PermissionMap.h deleted file mode 100644 index 8c271f17..00000000 --- a/dCommon/dEnums/PermissionMap.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include - -/** - * Bitmap of permissions and restrictions for characters. - */ -enum class PermissionMap : uint64_t -{ - /** - * Reserved for future use, bit 0-3. - */ - - /** - * The character has restricted trade acccess, bit 4. - */ - RestrictedTradeAccess = 0x1 << 4, - - /** - * The character has restricted mail access, bit 5. - */ - RestrictedMailAccess = 0x1 << 5, - - /** - * The character has restricted chat access, bit 6. - */ - RestrictedChatAccess = 0x1 << 6, - - // - // Combined permissions - // - - /** - * The character is marked as 'old', restricted from trade and mail. - */ - Old = RestrictedTradeAccess | RestrictedMailAccess, - - /** - * The character is soft banned, restricted from trade, mail, and chat. - */ - SoftBanned = RestrictedTradeAccess | RestrictedMailAccess | RestrictedChatAccess, -}; diff --git a/dCommon/dEnums/RacingTaskParam.h b/dCommon/dEnums/RacingTaskParam.h deleted file mode 100644 index 5958cb5a..00000000 --- a/dCommon/dEnums/RacingTaskParam.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include - -enum class RacingTaskParam : int32_t { - RACING_TASK_PARAM_FINISH_WITH_PLACEMENT = 1, // -enum class AddFriendResponseCode : uint8_t { +enum class eAddFriendResponseCode : uint8_t { ACCEPTED = 0, REJECTED, BUSY, diff --git a/dCommon/dEnums/AddFriendResponseType.h b/dCommon/dEnums/eAddFriendResponseType.h similarity index 59% rename from dCommon/dEnums/AddFriendResponseType.h rename to dCommon/dEnums/eAddFriendResponseType.h index 305796e8..5568aafb 100644 --- a/dCommon/dEnums/AddFriendResponseType.h +++ b/dCommon/dEnums/eAddFriendResponseType.h @@ -1,11 +1,11 @@ #pragma once -#ifndef __ADDFRIENDRESPONSETYPE__H__ -#define __ADDFRIENDRESPONSETYPE__H__ +#ifndef __EADDFRIENDRESPONSETYPE__H__ +#define __EADDFRIENDRESPONSETYPE__H__ #include -enum class AddFriendResponseType : uint8_t { +enum class eAddFriendResponseType : uint8_t { ACCEPTED = 0, ALREADYFRIEND, INVALIDCHARACTER, @@ -21,4 +21,4 @@ enum class AddFriendResponseType : uint8_t { FRIENDISFREETRIAL }; -#endif //!__ADDFRIENDRESPONSETYPE__H__ +#endif //!__EADDFRIENDRESPONSETYPE__H__ diff --git a/dCommon/dEnums/eBubbleType.h b/dCommon/dEnums/eBubbleType.h index 4aa6fad1..9ceef4b5 100644 --- a/dCommon/dEnums/eBubbleType.h +++ b/dCommon/dEnums/eBubbleType.h @@ -7,8 +7,8 @@ enum class eBubbleType : uint32_t { DEFAULT = 0, - ENERGY = 1, - SKUNK = 2, + ENERGY, + SKUNK }; #endif //!__EBUBBLETYPE__H__ diff --git a/dCommon/dEnums/eHelpType.h b/dCommon/dEnums/eHelpType.h new file mode 100644 index 00000000..d1838cc6 --- /dev/null +++ b/dCommon/dEnums/eHelpType.h @@ -0,0 +1,41 @@ + +#ifndef __EHELPTYPE__H__ +#define __EHELPTYPE__H__ + +#include + +enum class eHelpType : int32_t { + NONE = 0, + UNLOCK_MINIMAP = 2, + TOGGLETOOLTIP_OUTOFTIME_REBUILD = 3, + TOGGLETOOLTIP_LEAVELOSE_REBUILD = 4, + TOGGLECONTROLSTUTORIAL_WALKING = 6, + DISPLAYTUTORIAL_PASSPORT_1ST_SMASH = 7, + TOOLTIP_1ST_IMAGINATION_PICKUP = 8, + UNKNOWN9 = 9, + PETTAMINGMINIGAME_TUTORIAL_01 = 15, + PR_BOUNCER_TUTORIAL_03 = 16, + PR_TOOLTIP_1ST_PET_JUMPED_ON_SWITCH = 17, + PR_DIG_TUTORIAL_01 = 18, + PR_DIG_TUTORIAL_03 = 19, + PR_BOUNCER_TUTORIAL_01 = 20, + PR_NO_IMAGINATION_HIBERNATE = 21, + UNKNOWN22 = 22, + TOGGLECONTROLSTUTORIAL_JUMPING = 26, + TOGGLECONTROLSTUTORIAL_DOUBLEJUMPING = 27, + TOGGLECONTROLSTUTORIAL_CAMERA = 28, + TOGGLECONTROLSTUTORIAL_SMASH = 30, + UNKNOWN38 = 38, + UI_MOD_BUILD_PUT_ON_HAT = 40, + UI_MOD_BUILD_EQUIP_FIRST_MODULE = 41, + UNKNOWN42 = 42, + UNKNOWN43 = 43, + UI_MOD_BUILD_GO_LAUNCH_ROCKET = 44, + UI_MOD_BUILD_TALK_TO_SKYLANE = 45, + UNKNOWN53 = 53, + PET_DESPAWN_BY_OWNER_HIBERNATE = 69, + PET_DESPAWN_TAMING_NEW_PET = 70, + UI_INVENTORY_FULL_CANNOT_PICKUP_ITEM = 86 +}; + +#endif //!__EHELPTYPE__H__ diff --git a/dCommon/dEnums/eItemSetPassiveAbilityID.h b/dCommon/dEnums/eItemSetPassiveAbilityID.h new file mode 100644 index 00000000..8641d0f2 --- /dev/null +++ b/dCommon/dEnums/eItemSetPassiveAbilityID.h @@ -0,0 +1,58 @@ +#pragma once + +#ifndef __EITEMSETPASSIVEABILITYID__H__ +#define __EITEMSETPASSIVEABILITYID__H__ + +enum class eItemSetPassiveAbilityID { + EngineerRank1 = 2, + EngineerRank2 = 3, + EngineerRank3 = 4, + KnightRank1 = 7, + KnightRank2 = 8, + KnightRank3 = 9, + SpaceRangerRank1 = 10, + SpaceRangerRank2 = 11, + SpaceRangerRank3 = 12, + SamuraiRank1 = 13, + SamuraiRank2 = 14, + SamuraiRank3 = 15, + SorcererRank1 = 16, + SorcererRank2 = 17, + SorcererRank3 = 18, + SpaceMarauderRank1 = 19, + SpaceMarauderRank2 = 20, + SpaceMarauderRank3 = 21, + ShinobiRank1 = 22, + ShinobiRank2 = 23, + ShinobiRank3 = 24, + InventorRank1 = 25, + InventorRank2 = 26, + InventorRank3 = 27, + SummonerRank1 = 28, + SummonerRank2 = 29, + SummonerRank3 = 30, + AdventurerRank1 = 31, + AdventurerRank2 = 32, + AdventurerRank3 = 33, + DaredevilRank1 = 34, + DaredevilRank2 = 35, + DaredevilRank3 = 36, + BuccaneerRank1 = 37, + BuccaneerRank2 = 38, + BuccaneerRank3 = 39, + BoneSuit = 40, + ImaginationSpinjitzu = 41, + BatLord = 42, + MosaicJester = 43, + ExplorienBot = 44, + Unnamed1 = 45, + Unnamed2 = 46, + Unnamed3 = 47, + EarthSpinjitzu = 48, + Unnamed4 = 49, + FireSpinjitzu = 50, + IceSpinjitzu = 51, + LightningSpinjitzu = 52 +}; + +#endif //!__EITEMSETPASSIVEABILITYID__H__ diff --git a/dCommon/dEnums/eItemType.h b/dCommon/dEnums/eItemType.h index e68ce695..69eb18e9 100644 --- a/dCommon/dEnums/eItemType.h +++ b/dCommon/dEnums/eItemType.h @@ -6,31 +6,31 @@ #include enum class eItemType : int32_t { - ITEM_TYPE_UNKNOWN = -1, //!< An unknown item type - ITEM_TYPE_BRICK = 1, //!< A brick - ITEM_TYPE_HAT = 2, //!< A hat / head item - ITEM_TYPE_HAIR = 3, //!< A hair item - ITEM_TYPE_NECK = 4, //!< A neck item - ITEM_TYPE_LEFT_HAND = 5, //!< A left handed item - ITEM_TYPE_RIGHT_HAND = 6, //!< A right handed item - ITEM_TYPE_LEGS = 7, //!< A pants item - ITEM_TYPE_LEFT_TRINKET = 8, //!< A left handled trinket item - ITEM_TYPE_RIGHT_TRINKET = 9, //!< A right handed trinket item - ITEM_TYPE_BEHAVIOR = 10, //!< A behavior - ITEM_TYPE_PROPERTY = 11, //!< A property - ITEM_TYPE_MODEL = 12, //!< A model - ITEM_TYPE_COLLECTIBLE = 13, //!< A collectible item - ITEM_TYPE_CONSUMABLE = 14, //!< A consumable item - ITEM_TYPE_CHEST = 15, //!< A chest item - ITEM_TYPE_EGG = 16, //!< An egg - ITEM_TYPE_PET_FOOD = 17, //!< A pet food item - ITEM_TYPE_QUEST_OBJECT = 18, //!< A quest item - ITEM_TYPE_PET_INVENTORY_ITEM = 19, //!< A pet inventory item - ITEM_TYPE_PACKAGE = 20, //!< A package - ITEM_TYPE_LOOT_MODEL = 21, //!< A loot model - ITEM_TYPE_VEHICLE = 22, //!< A vehicle - ITEM_TYPE_CURRENCY = 23, //!< Currency - ITEM_TYPE_MOUNT = 24 //!< A Mount + UNKNOWN = -1, + BRICK, + HAT, + HAIR, + NECK, + LEFT_HAND, + RIGHT_HAND, + LEGS, + LEFT_TRINKET, + RIGHT_TRINKET, + BEHAVIOR, + PROPERTY, + MODEL, + COLLECTIBLE, + CONSUMABLE, + CHEST, + EGG, + PET_FOOD, + QUEST_OBJECT, + PET_INVENTORY_ITEM, + PACKAGE, + LOOT_MODEL, + VEHICLE, + LUP_MODEL, + MOUNT }; #endif //!__EITEMTYPE__H__ diff --git a/dCommon/dEnums/eMissionLockState.h b/dCommon/dEnums/eMissionLockState.h new file mode 100644 index 00000000..52752767 --- /dev/null +++ b/dCommon/dEnums/eMissionLockState.h @@ -0,0 +1,12 @@ +#pragma once + +#ifndef __EMISSIONLOCKSTATE__H__ +#define __EMISSIONLOCKSTATE__H__ + +enum class eMissionLockState : int { + LOCKED, + NEW, + UNLOCKED, +}; + +#endif //!__EMISSIONLOCKSTATE__H__ diff --git a/dCommon/dEnums/eMissionState.h b/dCommon/dEnums/eMissionState.h new file mode 100644 index 00000000..e080f455 --- /dev/null +++ b/dCommon/dEnums/eMissionState.h @@ -0,0 +1,56 @@ +#pragma once + +#ifndef __MISSIONSTATE__H__ +#define __MISSIONSTATE__H__ + +/** + * Represents the possible states a mission can be in + */ +enum class eMissionState : int { + /** + * The mission state is unknown + */ + UNKNOWN = -1, + + /** + * The mission is yielding rewards + */ + REWARDING = 0, + + /** + * The mission can be accepted + */ + AVAILABLE = 1, + + /** + * The mission has been accepted but not yet completed + */ + ACTIVE = 2, + + /** + * All the tasks for the mission have been completed and the entity can turn the mission in to complete it + */ + READY_TO_COMPLETE = 4, //!< The mission is ready to complete + + /** + * The mission has been completed + */ + COMPLETE = 8, + + /** + * The mission is available again and has been completed before. Used for daily missions. + */ + COMPLETE_AVAILABLE = 9, + + /** + * The mission is active and has been completed before. Used for daily missions. + */ + COMPLETE_ACTIVE = 10, + + /** + * The mission has been completed before and has now been completed again. Used for daily missions. + */ + COMPLETE_READY_TO_COMPLETE = 12 +}; + +#endif //!__MISSIONSTATE__H__ diff --git a/dCommon/dEnums/eMissionTaskType.h b/dCommon/dEnums/eMissionTaskType.h new file mode 100644 index 00000000..2636f88c --- /dev/null +++ b/dCommon/dEnums/eMissionTaskType.h @@ -0,0 +1,43 @@ +#pragma once + +#ifndef __EMISSIONTASKTYPE__H__ +#define __EMISSIONTASKTYPE__H__ + +enum class eMissionTaskType : int { + UNKNOWN = -1, + SMASH, + SCRIPT, + ACTIVITY, + COLLECTION, + TALK_TO_NPC, + EMOTE, + SHASH_CHAIN, + BUY, + SELL, + USE_ITEM, + USE_SKILL, + GATHER, + EXPLORE, + DELIVERY, + PERFORM_ACTIVITY, + INTERACT, + META, + EARN_REPUTATION, + VOTING, + SHOWCASE_DELIVERY, + REVIECE_CAST, + POWERUP, + PET_TAMING, + RACING, + PLAYER_FLAG, + PLACE_MODEL, + REMOVE_MODEL, + ADD_BEHAVIOR, + REMOVE_BEHAVIOR, + CLAIM_PROPERTY, + VISIT_PROPERTY, + TIME_PLAYED, + DONATION +}; + +#endif //!__EMISSIONTASKTYPE__H__ diff --git a/dCommon/dEnums/ePackageType.h b/dCommon/dEnums/ePackageType.h new file mode 100644 index 00000000..2c1c9977 --- /dev/null +++ b/dCommon/dEnums/ePackageType.h @@ -0,0 +1,13 @@ +#ifndef __EPACKAGETYPE__H__ +#define __EPACKAGETYPE__H__ + +enum class ePackageType { + INVALID = -1, + ITEM, + BRICKS, + MODELS, + CAR_MODELS +}; + + +#endif //!__EPACKAGETYPE__H__ diff --git a/dCommon/dEnums/ePermissionMap.h b/dCommon/dEnums/ePermissionMap.h new file mode 100644 index 00000000..d15c9fd3 --- /dev/null +++ b/dCommon/dEnums/ePermissionMap.h @@ -0,0 +1,46 @@ +#pragma once + +#include + +#ifndef __EPERMISSIONMAP__H__ +#define __EPERMISSIONMAP__H__ + +/** + * Bitmap of permissions and restrictions for characters. + */ +enum class ePermissionMap : uint64_t { + /** + * Reserved for future use, bit 0-3. + */ + + /** + * The character has restricted trade acccess, bit 4. + */ + RestrictedTradeAccess = 0x1 << 4, + + /** + * The character has restricted mail access, bit 5. + */ + RestrictedMailAccess = 0x1 << 5, + + /** + * The character has restricted chat access, bit 6. + */ + RestrictedChatAccess = 0x1 << 6, + + // + // Combined permissions + // + + /** + * The character is marked as 'old', restricted from trade and mail. + */ + Old = RestrictedTradeAccess | RestrictedMailAccess, + + /** + * The character is soft banned, restricted from trade, mail, and chat. + */ + SoftBanned = RestrictedTradeAccess | RestrictedMailAccess | RestrictedChatAccess, +}; + +#endif //!__EPERMISSIONMAP__H__ diff --git a/dCommon/dEnums/eRacingTaskParam.h b/dCommon/dEnums/eRacingTaskParam.h new file mode 100644 index 00000000..df50e382 --- /dev/null +++ b/dCommon/dEnums/eRacingTaskParam.h @@ -0,0 +1,25 @@ +#pragma once + +#ifndef __ERACINGTASKPARAM__H__ +#define __ERACINGTASKPARAM__H__ + +#include + +enum class eRacingTaskParam : int32_t { + FINISH_WITH_PLACEMENT = 1, + LAP_TIME, + TOTAL_TRACK_TIME, + COMPLETE_ANY_RACING_TASK, + COMPLETE_TRACK_TASKS, + MODULAR_BUILDING, + SAFE_DRIVER = 10, + SMASHABLES, + COLLECT_IMAGINATION, + COMPETED_IN_RACE, + WIN_RACE_IN_WORLD, + FIRST_PLACE_MULTIPLE_TRACKS, + LAST_PLACE_FINISH, + SMASH_SPECIFIC_SMASHABLE +}; + +#endif //!__ERACINGTASKPARAM__H__ diff --git a/dGame/Character.cpp b/dGame/Character.cpp index 67a0bf1b..572a3e9e 100644 --- a/dGame/Character.cpp +++ b/dGame/Character.cpp @@ -16,6 +16,8 @@ #include "ChatPackets.h" #include "Inventory.h" #include "InventoryComponent.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" Character::Character(uint32_t id, User* parentUser) { //First load the name, etc: @@ -34,7 +36,7 @@ Character::Character(uint32_t id, User* parentUser) { m_UnapprovedName = res->getString(2).c_str(); m_NameRejected = res->getBoolean(3); m_PropertyCloneID = res->getUInt(4); - m_PermissionMap = static_cast(res->getUInt64(5)); + m_PermissionMap = static_cast(res->getUInt64(5)); } delete res; @@ -93,7 +95,7 @@ void Character::UpdateFromDatabase() { m_UnapprovedName = res->getString(2).c_str(); m_NameRejected = res->getBoolean(3); m_PropertyCloneID = res->getUInt(4); - m_PermissionMap = static_cast(res->getUInt64(5)); + m_PermissionMap = static_cast(res->getUInt64(5)); } delete res; @@ -423,7 +425,7 @@ void Character::SetPlayerFlag(const uint32_t flagId, const bool value) { auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_PLAYER_FLAG, flagId); + missionComponent->Progress(eMissionTaskType::PLAYER_FLAG, flagId); } } } @@ -535,7 +537,7 @@ void Character::OnZoneLoad() { if (missionComponent != nullptr) { // Fix the monument race flag - if (missionComponent->GetMissionState(319) >= MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (missionComponent->GetMissionState(319) >= eMissionState::READY_TO_COMPLETE) { SetPlayerFlag(33, true); } } @@ -550,7 +552,7 @@ void Character::OnZoneLoad() { /** * Restrict old character to 1 million coins */ - if (HasPermission(PermissionMap::Old)) { + if (HasPermission(ePermissionMap::Old)) { if (GetCoins() > 1000000) { SetCoins(1000000, eLootSourceType::LOOT_SOURCE_NONE); } @@ -568,11 +570,11 @@ void Character::OnZoneLoad() { } } -PermissionMap Character::GetPermissionMap() const { +ePermissionMap Character::GetPermissionMap() const { return m_PermissionMap; } -bool Character::HasPermission(PermissionMap permission) const { +bool Character::HasPermission(ePermissionMap permission) const { return (static_cast(m_PermissionMap) & static_cast(permission)) != 0; } diff --git a/dGame/Character.h b/dGame/Character.h index 07bde36c..abded1b3 100644 --- a/dGame/Character.h +++ b/dGame/Character.h @@ -9,11 +9,12 @@ #include "NiPoint3.h" #include "NiQuaternion.h" -#include "PermissionMap.h" +#include "ePermissionMap.h" class User; struct Packet; class Entity; +enum class ePermissionMap : uint64_t; /** * Meta information about a character, like their name and style @@ -385,14 +386,14 @@ public: * Gets the permissions of the character, determining what actions a character may do * @return the permissions for this character */ - PermissionMap GetPermissionMap() const; + ePermissionMap GetPermissionMap() const; /** * Check if this character has a certain permission * @param permission the ID of the permission to check for * @return whether the character has the specified permission */ - bool HasPermission(PermissionMap permission) const; + bool HasPermission(ePermissionMap permission) const; /** * Gets all the emotes this character has unlocked so far @@ -481,7 +482,7 @@ private: /** * Bitmap of permission attributes this character has. */ - PermissionMap m_PermissionMap; + ePermissionMap m_PermissionMap; /** * The default name of this character diff --git a/dGame/Entity.cpp b/dGame/Entity.cpp index c0f71324..eefa5107 100644 --- a/dGame/Entity.cpp +++ b/dGame/Entity.cpp @@ -22,6 +22,7 @@ #include "EntityTimer.h" #include "EntityCallbackTimer.h" #include "Loot.h" +#include "eMissionTaskType.h" //Component includes: #include "Component.h" @@ -1318,7 +1319,7 @@ void Entity::OnCollisionPhantom(const LWOOBJID otherEntity) { auto* missionComponent = other->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_LOCATION, 0, 0, GeneralUtils::UTF16ToWTF8(poi)); + missionComponent->Progress(eMissionTaskType::EXPLORE, 0, 0, GeneralUtils::UTF16ToWTF8(poi)); } } @@ -1614,7 +1615,7 @@ void Entity::PickupItem(const LWOOBJID& objectID) { auto* missionComponent = GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_POWERUP, skill.skillID); + missionComponent->Progress(eMissionTaskType::POWERUP, skill.skillID); } } } else { diff --git a/dGame/TradingManager.cpp b/dGame/TradingManager.cpp index ed55f217..e1eac422 100644 --- a/dGame/TradingManager.cpp +++ b/dGame/TradingManager.cpp @@ -9,6 +9,7 @@ #include "Character.h" #include "CharacterComponent.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" TradingManager* TradingManager::m_Address = nullptr; @@ -161,14 +162,14 @@ void Trade::Complete() { for (const auto& tradeItem : m_ItemsA) { auto* itemToRemove = inventoryA->FindItemById(tradeItem.itemId); if (itemToRemove) itemToRemove->SetCount(itemToRemove->GetCount() - tradeItem.itemCount); - missionsA->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, tradeItem.itemLot, LWOOBJID_EMPTY, "", -tradeItem.itemCount); + missionsA->Progress(eMissionTaskType::GATHER, tradeItem.itemLot, LWOOBJID_EMPTY, "", -tradeItem.itemCount); inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE); } for (const auto& tradeItem : m_ItemsB) { auto* itemToRemove = inventoryB->FindItemById(tradeItem.itemId); if (itemToRemove) itemToRemove->SetCount(itemToRemove->GetCount() - tradeItem.itemCount); - missionsB->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, tradeItem.itemLot, LWOOBJID_EMPTY, "", -tradeItem.itemCount); + missionsB->Progress(eMissionTaskType::GATHER, tradeItem.itemLot, LWOOBJID_EMPTY, "", -tradeItem.itemCount); inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE); } diff --git a/dGame/dComponents/AchievementCacheKey.h b/dGame/dComponents/AchievementCacheKey.h index d8892197..398e0231 100644 --- a/dGame/dComponents/AchievementCacheKey.h +++ b/dGame/dComponents/AchievementCacheKey.h @@ -1,3 +1,5 @@ +#include "eMissionTaskType.h" + #ifndef __ACHIEVEMENTCACHEKEY__H__ #define __ACHIEVEMENTCACHEKEY__H__ @@ -6,7 +8,7 @@ public: AchievementCacheKey() { targets = ""; value = 0; - type = MissionTaskType::MISSION_TASK_TYPE_UNKNOWN; + type = eMissionTaskType::UNKNOWN; }; bool operator==(const AchievementCacheKey& point) const { @@ -14,15 +16,15 @@ public: }; void SetTargets(const std::string value) { this->targets = value; }; void SetValue(uint32_t value) { this->value = value; }; - void SetType(MissionTaskType value) { this->type = value; }; + void SetType(eMissionTaskType value) { this->type = value; }; std::string GetTargets() const { return this->targets; }; uint32_t GetValue() const { return this->value; }; - MissionTaskType GetType() const { return this->type; }; + eMissionTaskType GetType() const { return this->type; }; private: std::string targets; uint32_t value; - MissionTaskType type; + eMissionTaskType type; }; diff --git a/dGame/dComponents/DestroyableComponent.cpp b/dGame/dComponents/DestroyableComponent.cpp index 1455ce58..4763c863 100644 --- a/dGame/dComponents/DestroyableComponent.cpp +++ b/dGame/dComponents/DestroyableComponent.cpp @@ -32,6 +32,7 @@ #include "InventoryComponent.h" #include "dZoneManager.h" #include "WorldConfig.h" +#include "eMissionTaskType.h" DestroyableComponent::DestroyableComponent(Entity* parent) : Component(parent) { m_iArmor = 0; @@ -467,9 +468,9 @@ bool DestroyableComponent::IsKnockbackImmune() const { if (characterComponent != nullptr && inventoryComponent != nullptr && characterComponent->GetCurrentActivity() == eGameActivities::ACTIVITY_QUICKBUILDING) { const auto hasPassive = inventoryComponent->HasAnyPassive({ - ItemSetPassiveAbilityID::EngineerRank2, ItemSetPassiveAbilityID::EngineerRank3, - ItemSetPassiveAbilityID::SummonerRank2, ItemSetPassiveAbilityID::SummonerRank3, - ItemSetPassiveAbilityID::InventorRank2, ItemSetPassiveAbilityID::InventorRank3, + eItemSetPassiveAbilityID::EngineerRank2, eItemSetPassiveAbilityID::EngineerRank3, + eItemSetPassiveAbilityID::SummonerRank2, eItemSetPassiveAbilityID::SummonerRank3, + eItemSetPassiveAbilityID::InventorRank2, eItemSetPassiveAbilityID::InventorRank3, }, 5); if (hasPassive) { @@ -736,12 +737,12 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType if (memberMissions == nullptr) continue; - memberMissions->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, m_Parent->GetLOT()); - memberMissions->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, m_Parent->GetLOT(), skillID); + memberMissions->Progress(eMissionTaskType::SMASH, m_Parent->GetLOT()); + memberMissions->Progress(eMissionTaskType::USE_SKILL, m_Parent->GetLOT(), skillID); } } else { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, m_Parent->GetLOT()); - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, m_Parent->GetLOT(), skillID); + missions->Progress(eMissionTaskType::SMASH, m_Parent->GetLOT()); + missions->Progress(eMissionTaskType::USE_SKILL, m_Parent->GetLOT(), skillID); } } } diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index e5ff2f2a..8925554e 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -28,6 +28,7 @@ #include "eItemType.h" #include "eUnequippableActiveType.h" #include "CppScripts.h" +#include "eMissionTaskType.h" InventoryComponent::InventoryComponent(Entity* parent, tinyxml2::XMLDocument* document): Component(parent) { this->m_Dirty = true; @@ -196,7 +197,7 @@ void InventoryComponent::AddItem( auto* item = new Item(lot, inventory, slot, count, config, parent, showFlyingLoot, isModMoveAndEquip, subKey, bound, lootSourceType); if (missions != nullptr && !IsTransferInventory(inventoryType)) { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, lot, LWOOBJID_EMPTY, "", count, IsTransferInventory(inventorySourceType)); + missions->Progress(eMissionTaskType::GATHER, lot, LWOOBJID_EMPTY, "", count, IsTransferInventory(inventorySourceType)); } return; @@ -284,7 +285,7 @@ void InventoryComponent::AddItem( } if (missions != nullptr && !IsTransferInventory(inventoryType)) { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, lot, LWOOBJID_EMPTY, "", count - outOfSpace, IsTransferInventory(inventorySourceType)); + missions->Progress(eMissionTaskType::GATHER, lot, LWOOBJID_EMPTY, "", count - outOfSpace, IsTransferInventory(inventorySourceType)); } } @@ -373,7 +374,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in if (missionComponent != nullptr) { if (IsTransferInventory(inventory)) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, lot, LWOOBJID_EMPTY, "", -static_cast(count)); + missionComponent->Progress(eMissionTaskType::GATHER, lot, LWOOBJID_EMPTY, "", -static_cast(count)); } } } @@ -841,9 +842,9 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) { const auto type = static_cast(item->GetInfo().itemType); - if (!building && (item->GetLot() == 6086 || type == eItemType::ITEM_TYPE_LOOT_MODEL || type == eItemType::ITEM_TYPE_VEHICLE)) return; + if (!building && (item->GetLot() == 6086 || type == eItemType::LOOT_MODEL || type == eItemType::VEHICLE)) return; - if (type != eItemType::ITEM_TYPE_LOOT_MODEL && type != eItemType::ITEM_TYPE_MODEL) { + if (type != eItemType::LOOT_MODEL && type != eItemType::MODEL) { if (!item->GetBound() && !item->GetPreconditionExpression()->Check(m_Parent)) { return; } @@ -1202,14 +1203,14 @@ void InventoryComponent::TriggerPassiveAbility(PassiveAbilityTrigger trigger, En } } -bool InventoryComponent::HasAnyPassive(const std::vector& passiveIDs, int32_t equipmentRequirement) const { +bool InventoryComponent::HasAnyPassive(const std::vector& passiveIDs, int32_t equipmentRequirement) const { for (auto* set : m_Itemsets) { if (set->GetEquippedCount() < equipmentRequirement) { continue; } // Check if the set has any of the passive abilities - if (std::find(passiveIDs.begin(), passiveIDs.end(), static_cast(set->GetID())) != passiveIDs.end()) { + if (std::find(passiveIDs.begin(), passiveIDs.end(), static_cast(set->GetID())) != passiveIDs.end()) { return true; } } @@ -1285,15 +1286,15 @@ void InventoryComponent::RemoveDatabasePet(LWOOBJID id) { BehaviorSlot InventoryComponent::FindBehaviorSlot(const eItemType type) { switch (type) { - case eItemType::ITEM_TYPE_HAT: + case eItemType::HAT: return BehaviorSlot::Head; - case eItemType::ITEM_TYPE_NECK: + case eItemType::NECK: return BehaviorSlot::Neck; - case eItemType::ITEM_TYPE_LEFT_HAND: + case eItemType::LEFT_HAND: return BehaviorSlot::Offhand; - case eItemType::ITEM_TYPE_RIGHT_HAND: + case eItemType::RIGHT_HAND: return BehaviorSlot::Primary; - case eItemType::ITEM_TYPE_CONSUMABLE: + case eItemType::CONSUMABLE: return BehaviorSlot::Consumable; default: return BehaviorSlot::Invalid; @@ -1343,7 +1344,7 @@ std::vector InventoryComponent::FindBuffs(Item* item, bool castOnEquip } if (missions != nullptr && castOnEquip) { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, result.skillID); + missions->Progress(eMissionTaskType::USE_SKILL, result.skillID); } // If item is not a proxy, add its buff to the added buffs. diff --git a/dGame/dComponents/InventoryComponent.h b/dGame/dComponents/InventoryComponent.h index f63a8d70..b660de15 100644 --- a/dGame/dComponents/InventoryComponent.h +++ b/dGame/dComponents/InventoryComponent.h @@ -17,7 +17,7 @@ #include "DatabasePet.h" #include "Component.h" #include "ItemSetPassiveAbility.h" -#include "ItemSetPassiveAbilityID.h" +#include "eItemSetPassiveAbilityID.h" #include "PossessorComponent.h" #include "eInventoryType.h" @@ -291,7 +291,7 @@ public: * @param equipmentRequirement the number of equipment required to be allowed to have the ability * @return if the entity has any of the passed passive abilities equipped */ - bool HasAnyPassive(const std::vector& passiveIDs, int32_t equipmentRequirement) const; + bool HasAnyPassive(const std::vector& passiveIDs, int32_t equipmentRequirement) const; /** * Despawns the currently active pet, if any @@ -354,14 +354,14 @@ public: /** * Call this when you equip an item. This calls OnFactionTriggerItemEquipped for any scripts found on the items. - * + * * @param equippedItem The item script to lookup and call equip on */ void EquipScripts(Item* equippedItem); - + /** * Call this when you unequip an item. This calls OnFactionTriggerItemUnequipped for any scripts found on the items. - * + * * @param unequippedItem The item script to lookup and call unequip on */ void UnequipScripts(Item* unequippedItem); diff --git a/dGame/dComponents/MissionComponent.cpp b/dGame/dComponents/MissionComponent.cpp index 2ef6c2f6..cbae7f9f 100644 --- a/dGame/dComponents/MissionComponent.cpp +++ b/dGame/dComponents/MissionComponent.cpp @@ -18,6 +18,7 @@ #include "Mail.h" #include "MissionPrerequisites.h" #include "AchievementCacheKey.h" +#include "eMissionState.h" // MARK: Mission Component @@ -53,11 +54,11 @@ Mission* MissionComponent::GetMission(const uint32_t missionId) const { } -MissionState MissionComponent::GetMissionState(const uint32_t missionId) const { +eMissionState MissionComponent::GetMissionState(const uint32_t missionId) const { auto* mission = GetMission(missionId); if (mission == nullptr) { - return CanAccept(missionId) ? MissionState::MISSION_STATE_AVAILABLE : MissionState::MISSION_STATE_UNKNOWN; + return CanAccept(missionId) ? eMissionState::AVAILABLE : eMissionState::UNKNOWN; } return mission->GetMissionState(); @@ -143,7 +144,7 @@ void MissionComponent::RemoveMission(uint32_t missionId) { m_Missions.erase(missionId); } -void MissionComponent::Progress(MissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count, bool ignoreAchievements) { +void MissionComponent::Progress(eMissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count, bool ignoreAchievements) { for (const auto& pair : m_Missions) { auto* mission = pair.second; @@ -215,7 +216,7 @@ void MissionComponent::ForceProgressTaskType(const uint32_t missionId, const uin } for (auto* element : mission->GetTasks()) { - if (element->GetType() != static_cast(taskType)) continue; + if (element->GetType() != static_cast(taskType)) continue; element->AddProgress(value); } @@ -253,7 +254,7 @@ void MissionComponent::ForceProgressValue(uint32_t missionId, uint32_t taskType, } for (auto* element : mission->GetTasks()) { - if (element->GetType() != static_cast(taskType) || !element->InAllTargets(value)) continue; + if (element->GetType() != static_cast(taskType) || !element->InAllTargets(value)) continue; element->AddProgress(1); } @@ -281,7 +282,7 @@ bool MissionComponent::GetMissionInfo(uint32_t missionId, CDMissions& result) { #define MISSION_NEW_METHOD -bool MissionComponent::LookForAchievements(MissionTaskType type, int32_t value, bool progress, LWOOBJID associate, const std::string& targets, int32_t count) { +bool MissionComponent::LookForAchievements(eMissionTaskType type, int32_t value, bool progress, LWOOBJID associate, const std::string& targets, int32_t count) { #ifdef MISSION_NEW_METHOD // Query for achievments, using the cache const auto& result = QueryAchievements(type, value, targets); @@ -390,7 +391,7 @@ bool MissionComponent::LookForAchievements(MissionTaskType type, int32_t value, #endif } -const std::vector& MissionComponent::QueryAchievements(MissionTaskType type, int32_t value, const std::string targets) { +const std::vector& MissionComponent::QueryAchievements(eMissionTaskType type, int32_t value, const std::string targets) { // Create a hash which represent this query for achievements AchievementCacheKey toFind; toFind.SetType(type); @@ -484,7 +485,7 @@ bool MissionComponent::RequiresItem(const LOT lot) { } for (auto* task : mission->GetTasks()) { - if (task->IsComplete() || task->GetType() != MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) { + if (task->IsComplete() || task->GetType() != eMissionTaskType::GATHER) { continue; } @@ -496,7 +497,7 @@ bool MissionComponent::RequiresItem(const LOT lot) { } } - const auto required = LookForAchievements(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, lot, false); + const auto required = LookForAchievements(eMissionTaskType::GATHER, lot, false); return required; } diff --git a/dGame/dComponents/MissionComponent.h b/dGame/dComponents/MissionComponent.h index a3e39a88..231b3321 100644 --- a/dGame/dComponents/MissionComponent.h +++ b/dGame/dComponents/MissionComponent.h @@ -19,11 +19,11 @@ class AchievementCacheKey; -/** - * The mission inventory of an entity. Tracks mission state for each mission that can be accepted and allows for - * progression of each of the mission task types (see MissionTaskType). - */ -class MissionComponent: public Component + /** + * The mission inventory of an entity. Tracks mission state for each mission that can be accepted and allows for + * progression of each of the mission task types (see eMissionTaskType). + */ +class MissionComponent : public Component { public: static const uint32_t ComponentType = COMPONENT_TYPE_MISSION; @@ -52,7 +52,7 @@ public: * @param missionId the ID of the mission to get the mission state for * @return the mission state of the mission specified by the ID */ - MissionState GetMissionState(uint32_t missionId) const; + eMissionState GetMissionState(uint32_t missionId) const; /** * Checks if the entity has all the requirements for accepting the mission specified by the ID. @@ -93,7 +93,7 @@ public: * @param count the number to progress by, for example the number of items * @param ignoreAchievements do not progress achievements */ - void Progress(MissionTaskType type, int32_t value, LWOOBJID associate = 0, const std::string& targets = "", int32_t count = 1, bool ignoreAchievements = false); + void Progress(eMissionTaskType type, int32_t value, LWOOBJID associate = 0, const std::string& targets = "", int32_t count = 1, bool ignoreAchievements = false); /** * Forces progression for a mission and task, ignoring checks @@ -140,7 +140,7 @@ public: * @param count the number of values to progress by (differs by task type) * @return true if a achievement was accepted, false otherwise */ - bool LookForAchievements(MissionTaskType type, int32_t value, bool progress = true, LWOOBJID associate = LWOOBJID_EMPTY, const std::string& targets = "", int32_t count = 1); + bool LookForAchievements(eMissionTaskType type, int32_t value, bool progress = true, LWOOBJID associate = LWOOBJID_EMPTY, const std::string& targets = "", int32_t count = 1); /** * Checks if there's a mission active that requires the collection of the specified LOT @@ -188,7 +188,7 @@ private: * @param targets optional targets to progress with * @return list of mission IDs (achievements) that can be progressed for the given parameters */ - static const std::vector& QueryAchievements(MissionTaskType type, int32_t value, const std::string targets); + static const std::vector& QueryAchievements(eMissionTaskType type, int32_t value, const std::string targets); /** * As achievements can be hard to query, we here store a list of all the mission IDs that can be unlocked for a diff --git a/dGame/dComponents/MissionOfferComponent.cpp b/dGame/dComponents/MissionOfferComponent.cpp index 2f2ed0f0..f8446868 100644 --- a/dGame/dComponents/MissionOfferComponent.cpp +++ b/dGame/dComponents/MissionOfferComponent.cpp @@ -14,6 +14,7 @@ #include "dLogger.h" #include "Game.h" #include "MissionPrerequisites.h" +#include "eMissionState.h" OfferedMission::OfferedMission(const uint32_t missionId, const bool offersMission, const bool acceptsMission) { this->missionId = missionId; @@ -170,10 +171,10 @@ void MissionOfferComponent::OfferMissions(Entity* entity, const uint32_t specifi for (const auto sample : randomMissionPool) { const auto state = missionComponent->GetMissionState(sample); - if (state == MissionState::MISSION_STATE_ACTIVE || - state == MissionState::MISSION_STATE_COMPLETE_ACTIVE || - state == MissionState::MISSION_STATE_READY_TO_COMPLETE || - state == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE || + if (state == eMissionState::ACTIVE || + state == eMissionState::COMPLETE_ACTIVE || + state == eMissionState::READY_TO_COMPLETE || + state == eMissionState::COMPLETE_READY_TO_COMPLETE || sample == specifiedMissionId) { mission = missionComponent->GetMission(sample); diff --git a/dGame/dComponents/PetComponent.cpp b/dGame/dComponents/PetComponent.cpp index 771a9cc1..5549f952 100644 --- a/dGame/dComponents/PetComponent.cpp +++ b/dGame/dComponents/PetComponent.cpp @@ -21,6 +21,8 @@ #include "dChatFilter.h" #include "Database.h" #include "EntityInfo.h" +#include "eMissionTaskType.h" + std::unordered_map PetComponent::buildCache{}; std::unordered_map PetComponent::currentActivities{}; @@ -602,7 +604,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) { auto* missionComponent = tamer->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_PET_TAMING, m_Parent->GetLOT()); + missionComponent->Progress(eMissionTaskType::PET_TAMING, m_Parent->GetLOT()); } SetStatus(1); diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index 8d23c17e..ce2c8e5e 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -18,6 +18,7 @@ #include "RocketLaunchpadControlComponent.h" #include "PropertyEntranceComponent.h" #include "InventoryComponent.h" +#include "eMissionTaskType.h" #include #include "CppScripts.h" @@ -404,7 +405,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N }); // Progress place model missions auto missionComponent = entity->GetComponent(); - if (missionComponent != nullptr) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_PLACE_MODEL, 0); + if (missionComponent != nullptr) missionComponent->Progress(eMissionTaskType::PLACE_MODEL, 0); } void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int deleteReason) { diff --git a/dGame/dComponents/RacingControlComponent.cpp b/dGame/dComponents/RacingControlComponent.cpp index f64dbc15..4b27ac0f 100644 --- a/dGame/dComponents/RacingControlComponent.cpp +++ b/dGame/dComponents/RacingControlComponent.cpp @@ -15,13 +15,14 @@ #include "Player.h" #include "PossessableComponent.h" #include "PossessorComponent.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" #include "Spawner.h" #include "VehiclePhysicsComponent.h" #include "dServer.h" #include "dZoneManager.h" #include "dConfig.h" #include "Loot.h" +#include "eMissionTaskType.h" #ifndef M_PI #define M_PI 3.14159265358979323846264338327950288 @@ -395,18 +396,18 @@ void RacingControlComponent::HandleMessageBoxResponse(Entity* player, if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPETED_IN_RACE); // Progress task for competing in a race - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->smashedTimes, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SAFE_DRIVER); // Finish a race without being smashed. + missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::COMPETED_IN_RACE); // Progress task for competing in a race + missionComponent->Progress(eMissionTaskType::RACING, data->smashedTimes, (LWOOBJID)eRacingTaskParam::SAFE_DRIVER); // Finish a race without being smashed. // If solo racing is enabled OR if there are 3 players in the race, progress placement tasks. if (m_SoloRacing || m_LoadedPlayers > 2) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, data->finished, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FINISH_WITH_PLACEMENT); // Finish in 1st place on a race + missionComponent->Progress(eMissionTaskType::RACING, data->finished, (LWOOBJID)eRacingTaskParam::FINISH_WITH_PLACEMENT); // Finish in 1st place on a race if (data->finished == 1) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_WIN_RACE_IN_WORLD); // Finished first place in specific world. + missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::FIRST_PLACE_MULTIPLE_TRACKS); // Finish in 1st place on multiple tracks. + missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::WIN_RACE_IN_WORLD); // Finished first place in specific world. } if (data->finished == m_LoadedPlayers) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_LAST_PLACE_FINISH); // Finished first place in specific world. + missionComponent->Progress(eMissionTaskType::RACING, dZoneManager::Instance()->GetZone()->GetWorldID(), (LWOOBJID)eRacingTaskParam::LAST_PLACE_FINISH); // Finished first place in specific world. } } } else if (id == "ACT_RACE_EXIT_THE_RACE?" || id == "Exit") { @@ -828,7 +829,7 @@ void RacingControlComponent::Update(float deltaTime) { if (missionComponent != nullptr) { // Progress lap time tasks - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, (lapTime) * 1000, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_LAP_TIME); + missionComponent->Progress(eMissionTaskType::RACING, (lapTime) * 1000, (LWOOBJID)eRacingTaskParam::LAP_TIME); if (player.lap == 3) { m_Finished++; @@ -844,7 +845,7 @@ void RacingControlComponent::Update(float deltaTime) { raceTime, raceTime * 1000); // Entire race time - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, (raceTime) * 1000, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_TOTAL_TRACK_TIME); + missionComponent->Progress(eMissionTaskType::RACING, (raceTime) * 1000, (LWOOBJID)eRacingTaskParam::TOTAL_TRACK_TIME); auto* characterComponent = playerEntity->GetComponent(); if (characterComponent != nullptr) { diff --git a/dGame/dComponents/RebuildComponent.cpp b/dGame/dComponents/RebuildComponent.cpp index 83ae818e..bf7bd3e5 100644 --- a/dGame/dComponents/RebuildComponent.cpp +++ b/dGame/dComponents/RebuildComponent.cpp @@ -7,7 +7,7 @@ #include "dLogger.h" #include "CharacterComponent.h" #include "MissionComponent.h" -#include "MissionTaskType.h" +#include "eMissionTaskType.h" #include "dServer.h" #include "PacketUtils.h" @@ -473,12 +473,12 @@ void RebuildComponent::CompleteRebuild(Entity* user) { auto* member = EntityManager::Instance()->GetEntity(memberId); if (member) { auto* missionComponent = member->GetComponent(); - if (missionComponent) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityId); + if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId); } } } else{ auto* missionComponent = builder->GetComponent(); - if (missionComponent) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityId); + if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId); } LootGenerator::Instance().DropActivityLoot(builder, m_Parent, m_ActivityId, 1); } diff --git a/dGame/dComponents/ScriptedActivityComponent.cpp b/dGame/dComponents/ScriptedActivityComponent.cpp index a03dddbe..067446e7 100644 --- a/dGame/dComponents/ScriptedActivityComponent.cpp +++ b/dGame/dComponents/ScriptedActivityComponent.cpp @@ -20,6 +20,7 @@ #include "DestroyableComponent.h" #include "dMessageIdentifiers.h" #include "Loot.h" +#include "eMissionTaskType.h" ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activityID) : Component(parent) { m_ActivityID = activityID; @@ -552,7 +553,7 @@ void ActivityInstance::StartZone() { void ActivityInstance::RewardParticipant(Entity* participant) { auto* missionComponent = participant->GetComponent(); if (missionComponent) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityInfo.ActivityID); + missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityInfo.ActivityID); } // First, get the activity data diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index a91a1e2a..16942ecc 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -31,6 +31,7 @@ #include "StartSkill.h" #include "EchoStartSkill.h" #include "EchoSyncSkill.h" +#include "eMissionTaskType.h" using namespace std; @@ -281,7 +282,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System MissionComponent* comp = entity->GetComponent(); if (comp) { - comp->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, startSkill.skillID); + comp->Progress(eMissionTaskType::USE_SKILL, startSkill.skillID); } CDSkillBehaviorTable* skillTable = CDClientManager::Instance()->GetTable("SkillBehavior"); diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 9aafd0fc..58d72d3c 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -31,7 +31,9 @@ #include "LeaderboardManager.h" #include "AMFFormat.h" #include "Loot.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" #include #include @@ -3264,7 +3266,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream* inStream, Entity* // Check if the player has restricted trade access auto* character = entity->GetCharacter(); - if (character->HasPermission(PermissionMap::RestrictedTradeAccess)) { + if (character->HasPermission(ePermissionMap::RestrictedTradeAccess)) { // Send a message to the player ChatPackets::SendSystemMessage( sysAddr, @@ -3284,7 +3286,7 @@ void GameMessages::HandleClientTradeRequest(RakNet::BitStream* inStream, Entity* if (invitee != nullptr && invitee->IsPlayer()) { character = invitee->GetCharacter(); - if (character->HasPermission(PermissionMap::RestrictedTradeAccess)) { + if (character->HasPermission(ePermissionMap::RestrictedTradeAccess)) { // Send a message to the player ChatPackets::SendSystemMessage( sysAddr, @@ -4707,25 +4709,10 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti LOT tokenId = -1; - if (missionComponent->GetMissionState(545) == MissionState::MISSION_STATE_COMPLETE) // "Join Assembly!" - { - tokenId = 8318; // "Assembly Token" - } - - if (missionComponent->GetMissionState(556) == MissionState::MISSION_STATE_COMPLETE) // "Join Venture League!" - { - tokenId = 8321; // "Venture League Token" - } - - if (missionComponent->GetMissionState(567) == MissionState::MISSION_STATE_COMPLETE) // "Join The Sentinels!" - { - tokenId = 8319; // "Sentinels Token" - } - - if (missionComponent->GetMissionState(578) == MissionState::MISSION_STATE_COMPLETE) // "Join Paradox!" - { - tokenId = 8320; // "Paradox Token" - } + if (missionComponent->GetMissionState(545) == eMissionState::COMPLETE) tokenId = 8318; // "Assembly Token" + if (missionComponent->GetMissionState(556) == eMissionState::COMPLETE) tokenId = 8321; // "Venture League Token" + if (missionComponent->GetMissionState(567) == eMissionState::COMPLETE) tokenId = 8319; // "Sentinels Token" + if (missionComponent->GetMissionState(578) == eMissionState::COMPLETE) tokenId = 8320; // "Paradox Token" const uint32_t altCurrencyCost = itemComp.commendationCost * count; @@ -5031,8 +5018,8 @@ void GameMessages::HandleRequestUse(RakNet::BitStream* inStream, Entity* entity, if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MISSION_INTERACTION, interactedObject->GetLOT(), interactedObject->GetObjectID()); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_NON_MISSION_INTERACTION, interactedObject->GetLOT(), interactedObject->GetObjectID()); + missionComponent->Progress(eMissionTaskType::TALK_TO_NPC, interactedObject->GetLOT(), interactedObject->GetObjectID()); + missionComponent->Progress(eMissionTaskType::INTERACT, interactedObject->GetLOT(), interactedObject->GetObjectID()); } void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity) { @@ -5059,7 +5046,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity) if (targetEntity != nullptr) { targetEntity->OnEmoteReceived(emoteID, entity); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_EMOTE, emoteID, targetID); + missionComponent->Progress(eMissionTaskType::EMOTE, emoteID, targetID); } } else { Game::logger->LogDebug("GameMessages", "Target ID is empty, using backup"); @@ -5071,7 +5058,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity) if (Vector3::DistanceSquared(scripted->GetPosition(), referencePoint) > 5.0f * 5.0f) continue; scripted->OnEmoteReceived(emoteID, entity); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_EMOTE, emoteID, scripted->GetObjectID()); + missionComponent->Progress(eMissionTaskType::EMOTE, emoteID, scripted->GetObjectID()); } } @@ -5163,7 +5150,7 @@ void GameMessages::HandleRespondToMission(RakNet::BitStream* inStream, Entity* e void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* entity) { bool bIsComplete{}; - MissionState iMissionState{}; + eMissionState iMissionState{}; int missionID{}; LWOOBJID responder{}; Entity* player = nullptr; @@ -5185,9 +5172,9 @@ void GameMessages::HandleMissionDialogOK(RakNet::BitStream* inStream, Entity* en return; } - if (iMissionState == MissionState::MISSION_STATE_AVAILABLE || iMissionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) { + if (iMissionState == eMissionState::AVAILABLE || iMissionState == eMissionState::COMPLETE_AVAILABLE) { missionComponent->AcceptMission(missionID); - } else if (iMissionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || iMissionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + } else if (iMissionState == eMissionState::READY_TO_COMPLETE || iMissionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { missionComponent->CompleteMission(missionID); } } @@ -5219,7 +5206,7 @@ void GameMessages::HandleHasBeenCollected(RakNet::BitStream* inStream, Entity* e MissionComponent* missionComponent = static_cast(player->GetComponent(COMPONENT_TYPE_MISSION)); if (missionComponent) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT, entity->GetLOT(), entity->GetObjectID()); + missionComponent->Progress(eMissionTaskType::COLLECTION, entity->GetLOT(), entity->GetObjectID()); } } @@ -5438,7 +5425,7 @@ void GameMessages::HandleRemoveItemFromInventory(RakNet::BitStream* inStream, En auto* missionComponent = entity->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, item->GetLot(), LWOOBJID_EMPTY, "", -iStackCount); + missionComponent->Progress(eMissionTaskType::GATHER, item->GetLot(), LWOOBJID_EMPTY, "", -iStackCount); } } } @@ -5593,8 +5580,8 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* if (entity->GetLOT() != 9980 || Game::server->GetZoneID() != 1200) { if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, entity->GetLOT(), entity->GetObjectID()); - if (count >= 7 && everyPieceSwapped) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, LWOOBJID_EMPTY, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_MODULAR_BUILDING); + missionComponent->Progress(eMissionTaskType::SCRIPT, entity->GetLOT(), entity->GetObjectID()); + if (count >= 7 && everyPieceSwapped) missionComponent->Progress(eMissionTaskType::RACING, LWOOBJID_EMPTY, (LWOOBJID)eRacingTaskParam::MODULAR_BUILDING); } } } @@ -5826,7 +5813,7 @@ void GameMessages::HandleClientItemConsumed(RakNet::BitStream* inStream, Entity* auto* missions = static_cast(entity->GetComponent(COMPONENT_TYPE_MISSION)); if (missions != nullptr) { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_FOOD, itemLot); + missions->Progress(eMissionTaskType::USE_ITEM, itemLot); } } diff --git a/dGame/dInventory/Inventory.cpp b/dGame/dInventory/Inventory.cpp index 990b08f3..69a643ae 100644 --- a/dGame/dInventory/Inventory.cpp +++ b/dGame/dInventory/Inventory.cpp @@ -231,41 +231,42 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot) { const auto itemType = static_cast(itemComponent.itemType); switch (itemType) { - case eItemType::ITEM_TYPE_BRICK: + case eItemType::BRICK: return BRICKS; - case eItemType::ITEM_TYPE_BEHAVIOR: + case eItemType::BEHAVIOR: return BEHAVIORS; - case eItemType::ITEM_TYPE_PROPERTY: + case eItemType::PROPERTY: return PROPERTY_DEEDS; - case eItemType::ITEM_TYPE_MODEL: - case eItemType::ITEM_TYPE_VEHICLE: - case eItemType::ITEM_TYPE_LOOT_MODEL: - case eItemType::ITEM_TYPE_MOUNT: + case eItemType::MODEL: + case eItemType::VEHICLE: + case eItemType::LOOT_MODEL: + case eItemType::LUP_MODEL: + case eItemType::MOUNT: return MODELS; - case eItemType::ITEM_TYPE_HAT: - case eItemType::ITEM_TYPE_HAIR: - case eItemType::ITEM_TYPE_NECK: - case eItemType::ITEM_TYPE_LEFT_HAND: - case eItemType::ITEM_TYPE_RIGHT_HAND: - case eItemType::ITEM_TYPE_LEGS: - case eItemType::ITEM_TYPE_LEFT_TRINKET: - case eItemType::ITEM_TYPE_RIGHT_TRINKET: - case eItemType::ITEM_TYPE_COLLECTIBLE: - case eItemType::ITEM_TYPE_CONSUMABLE: - case eItemType::ITEM_TYPE_CHEST: - case eItemType::ITEM_TYPE_EGG: - case eItemType::ITEM_TYPE_PET_FOOD: - case eItemType::ITEM_TYPE_PET_INVENTORY_ITEM: - case eItemType::ITEM_TYPE_PACKAGE: - case eItemType::ITEM_TYPE_CURRENCY: + case eItemType::HAT: + case eItemType::HAIR: + case eItemType::NECK: + case eItemType::LEFT_HAND: + case eItemType::RIGHT_HAND: + case eItemType::LEGS: + case eItemType::LEFT_TRINKET: + case eItemType::RIGHT_TRINKET: + case eItemType::COLLECTIBLE: + case eItemType::CONSUMABLE: + case eItemType::CHEST: + case eItemType::EGG: + case eItemType::PET_FOOD: + case eItemType::PET_INVENTORY_ITEM: + case eItemType::PACKAGE: + return ITEMS; - case eItemType::ITEM_TYPE_QUEST_OBJECT: - case eItemType::ITEM_TYPE_UNKNOWN: + case eItemType::QUEST_OBJECT: + case eItemType::UNKNOWN: default: return QUEST; } diff --git a/dGame/dInventory/Item.cpp b/dGame/dInventory/Item.cpp index d6721bdd..2a054ae8 100644 --- a/dGame/dInventory/Item.cpp +++ b/dGame/dInventory/Item.cpp @@ -76,7 +76,7 @@ Item::Item( const auto type = static_cast(info->itemType); - if (type == eItemType::ITEM_TYPE_MOUNT) { + if (type == eItemType::MOUNT) { id = GeneralUtils::SetBit(id, OBJECT_BIT_CLIENT); } @@ -283,10 +283,10 @@ void Item::UseNonEquip(Item* item) { } const auto type = static_cast(info->itemType); - if (type == eItemType::ITEM_TYPE_MOUNT) { + if (type == eItemType::MOUNT) { playerInventoryComponent->HandlePossession(this); // TODO Check if mounts are allowed to be spawned - } else if (type == eItemType::ITEM_TYPE_PET_INVENTORY_ITEM && subKey != LWOOBJID_EMPTY) { + } else if (type == eItemType::PET_INVENTORY_ITEM && subKey != LWOOBJID_EMPTY) { const auto& databasePet = playerInventoryComponent->GetDatabasePet(subKey); if (databasePet.lot != LOT_NULL) { playerInventoryComponent->SpawnPet(this); diff --git a/dGame/dInventory/ItemSet.cpp b/dGame/dInventory/ItemSet.cpp index 1c67f6d6..e246f9f7 100644 --- a/dGame/dInventory/ItemSet.cpp +++ b/dGame/dInventory/ItemSet.cpp @@ -6,6 +6,7 @@ #include "CDClientDatabase.h" #include "Game.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" #include ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent) { @@ -130,7 +131,7 @@ void ItemSet::OnEquip(const LOT lot) { const auto behaviorId = skillTable->GetSkillByID(skill).behaviorID; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, skill); + missionComponent->Progress(eMissionTaskType::USE_SKILL, skill); skillComponent->HandleUnmanaged(behaviorId, m_InventoryComponent->GetParent()->GetObjectID()); } diff --git a/dGame/dInventory/ItemSetPassiveAbility.cpp b/dGame/dInventory/ItemSetPassiveAbility.cpp index 83db4405..bf7c19cb 100644 --- a/dGame/dInventory/ItemSetPassiveAbility.cpp +++ b/dGame/dInventory/ItemSetPassiveAbility.cpp @@ -3,7 +3,7 @@ #include "DestroyableComponent.h" #include "SkillComponent.h" #include "ItemSet.h" -#include "ItemSetPassiveAbilityID.h" +#include "eItemSetPassiveAbilityID.h" ItemSetPassiveAbility::ItemSetPassiveAbility(PassiveAbilityTrigger trigger, Entity* parent, ItemSet* itemSet) { m_Trigger = trigger; @@ -46,31 +46,31 @@ void ItemSetPassiveAbility::Activate(Entity* target) { EntityManager::Instance()->SerializeEntity(m_Parent); - const auto id = static_cast(m_ItemSet->GetID()); + const auto id = static_cast(m_ItemSet->GetID()); const auto parentID = m_Parent->GetObjectID(); const auto equippedCount = m_ItemSet->GetEquippedCount(); switch (id) { // Assembly - case ItemSetPassiveAbilityID::InventorRank1: - case ItemSetPassiveAbilityID::SummonerRank1: - case ItemSetPassiveAbilityID::EngineerRank1: { + case eItemSetPassiveAbilityID::InventorRank1: + case eItemSetPassiveAbilityID::SummonerRank1: + case eItemSetPassiveAbilityID::EngineerRank1: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(394, 4401, parentID); break; } - case ItemSetPassiveAbilityID::InventorRank2: - case ItemSetPassiveAbilityID::SummonerRank2: - case ItemSetPassiveAbilityID::EngineerRank2: { + case eItemSetPassiveAbilityID::InventorRank2: + case eItemSetPassiveAbilityID::SummonerRank2: + case eItemSetPassiveAbilityID::EngineerRank2: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(581, 9433, parentID); break; } - case ItemSetPassiveAbilityID::InventorRank3: - case ItemSetPassiveAbilityID::SummonerRank3: - case ItemSetPassiveAbilityID::EngineerRank3: { + case eItemSetPassiveAbilityID::InventorRank3: + case eItemSetPassiveAbilityID::SummonerRank3: + case eItemSetPassiveAbilityID::EngineerRank3: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(582, 9435, parentID); @@ -78,57 +78,57 @@ void ItemSetPassiveAbility::Activate(Entity* target) { } // Sentinel - case ItemSetPassiveAbilityID::KnightRank1: { + case eItemSetPassiveAbilityID::KnightRank1: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(559, 8884, parentID); break; } - case ItemSetPassiveAbilityID::KnightRank2: { + case eItemSetPassiveAbilityID::KnightRank2: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(560, 8885, parentID); break; } - case ItemSetPassiveAbilityID::KnightRank3: { + case eItemSetPassiveAbilityID::KnightRank3: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(561, 8890, parentID); break; } - case ItemSetPassiveAbilityID::SpaceRangerRank1: { + case eItemSetPassiveAbilityID::SpaceRangerRank1: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(1101, 24612, parentID); break; } - case ItemSetPassiveAbilityID::SpaceRangerRank2: { + case eItemSetPassiveAbilityID::SpaceRangerRank2: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(1102, 24617, parentID); break; } - case ItemSetPassiveAbilityID::SpaceRangerRank3: { + case eItemSetPassiveAbilityID::SpaceRangerRank3: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(1103, 24622, parentID); break; } - case ItemSetPassiveAbilityID::SamuraiRank1: { + case eItemSetPassiveAbilityID::SamuraiRank1: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(562, 8899, parentID); break; } - case ItemSetPassiveAbilityID::SamuraiRank2: { + case eItemSetPassiveAbilityID::SamuraiRank2: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(563, 8904, parentID); break; } - case ItemSetPassiveAbilityID::SamuraiRank3: { + case eItemSetPassiveAbilityID::SamuraiRank3: { if (equippedCount < 4) return; m_Cooldown = 11.0f; skillComponent->CalculateBehavior(564, 8909, parentID); @@ -143,47 +143,47 @@ void ItemSetPassiveAbility::Activate(Entity* target) { std::vector ItemSetPassiveAbility::FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet) { std::vector abilities; - switch (static_cast(itemSetID)) { + switch (static_cast(itemSetID)) { // Assembly - case ItemSetPassiveAbilityID::SummonerRank1: - case ItemSetPassiveAbilityID::SummonerRank2: - case ItemSetPassiveAbilityID::SummonerRank3: - case ItemSetPassiveAbilityID::InventorRank1: - case ItemSetPassiveAbilityID::InventorRank2: - case ItemSetPassiveAbilityID::InventorRank3: - case ItemSetPassiveAbilityID::EngineerRank1: - case ItemSetPassiveAbilityID::EngineerRank2: - case ItemSetPassiveAbilityID::EngineerRank3: { + case eItemSetPassiveAbilityID::SummonerRank1: + case eItemSetPassiveAbilityID::SummonerRank2: + case eItemSetPassiveAbilityID::SummonerRank3: + case eItemSetPassiveAbilityID::InventorRank1: + case eItemSetPassiveAbilityID::InventorRank2: + case eItemSetPassiveAbilityID::InventorRank3: + case eItemSetPassiveAbilityID::EngineerRank1: + case eItemSetPassiveAbilityID::EngineerRank2: + case eItemSetPassiveAbilityID::EngineerRank3: { abilities.emplace_back(PassiveAbilityTrigger::AssemblyImagination, parent, itemSet); break; } // Sentinel - case ItemSetPassiveAbilityID::KnightRank1: - case ItemSetPassiveAbilityID::KnightRank2: - case ItemSetPassiveAbilityID::KnightRank3: - case ItemSetPassiveAbilityID::SpaceRangerRank1: - case ItemSetPassiveAbilityID::SpaceRangerRank2: - case ItemSetPassiveAbilityID::SpaceRangerRank3: - case ItemSetPassiveAbilityID::SamuraiRank1: - case ItemSetPassiveAbilityID::SamuraiRank2: - case ItemSetPassiveAbilityID::SamuraiRank3: { + case eItemSetPassiveAbilityID::KnightRank1: + case eItemSetPassiveAbilityID::KnightRank2: + case eItemSetPassiveAbilityID::KnightRank3: + case eItemSetPassiveAbilityID::SpaceRangerRank1: + case eItemSetPassiveAbilityID::SpaceRangerRank2: + case eItemSetPassiveAbilityID::SpaceRangerRank3: + case eItemSetPassiveAbilityID::SamuraiRank1: + case eItemSetPassiveAbilityID::SamuraiRank2: + case eItemSetPassiveAbilityID::SamuraiRank3: { abilities.emplace_back(PassiveAbilityTrigger::SentinelArmor, parent, itemSet); abilities.emplace_back(PassiveAbilityTrigger::EnemySmashed, parent, itemSet); break; } // Paradox - case ItemSetPassiveAbilityID::BatLord: - case ItemSetPassiveAbilityID::SpaceMarauderRank1: - case ItemSetPassiveAbilityID::SpaceMarauderRank2: - case ItemSetPassiveAbilityID::SpaceMarauderRank3: - case ItemSetPassiveAbilityID::SorcererRank1: - case ItemSetPassiveAbilityID::SorcererRank2: - case ItemSetPassiveAbilityID::SorcererRank3: - case ItemSetPassiveAbilityID::ShinobiRank1: - case ItemSetPassiveAbilityID::ShinobiRank2: - case ItemSetPassiveAbilityID::ShinobiRank3: { + case eItemSetPassiveAbilityID::BatLord: + case eItemSetPassiveAbilityID::SpaceMarauderRank1: + case eItemSetPassiveAbilityID::SpaceMarauderRank2: + case eItemSetPassiveAbilityID::SpaceMarauderRank3: + case eItemSetPassiveAbilityID::SorcererRank1: + case eItemSetPassiveAbilityID::SorcererRank2: + case eItemSetPassiveAbilityID::SorcererRank3: + case eItemSetPassiveAbilityID::ShinobiRank1: + case eItemSetPassiveAbilityID::ShinobiRank2: + case eItemSetPassiveAbilityID::ShinobiRank3: { abilities.emplace_back(PassiveAbilityTrigger::EnemySmashed, parent, itemSet); break; @@ -205,110 +205,110 @@ void ItemSetPassiveAbility::OnEnemySmshed(Entity* target) { EntityManager::Instance()->SerializeEntity(m_Parent); - const auto id = static_cast(m_ItemSet->GetID()); + const auto id = static_cast(m_ItemSet->GetID()); const auto parentID = m_Parent->GetObjectID(); const auto equippedCount = m_ItemSet->GetEquippedCount(); switch (id) { // Bat Lord - case ItemSetPassiveAbilityID::BatLord: { + case eItemSetPassiveAbilityID::BatLord: { if (equippedCount < 5) return; destroyableComponent->Heal(3); break; } // Sentinel - case ItemSetPassiveAbilityID::KnightRank1: { + case eItemSetPassiveAbilityID::KnightRank1: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::KnightRank2: { + case eItemSetPassiveAbilityID::KnightRank2: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::KnightRank3: { + case eItemSetPassiveAbilityID::KnightRank3: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::SpaceRangerRank1: { + case eItemSetPassiveAbilityID::SpaceRangerRank1: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::SpaceRangerRank2: { + case eItemSetPassiveAbilityID::SpaceRangerRank2: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::SpaceRangerRank3: { + case eItemSetPassiveAbilityID::SpaceRangerRank3: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::SamuraiRank1: { + case eItemSetPassiveAbilityID::SamuraiRank1: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::SamuraiRank2: { + case eItemSetPassiveAbilityID::SamuraiRank2: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } - case ItemSetPassiveAbilityID::SamuraiRank3: { + case eItemSetPassiveAbilityID::SamuraiRank3: { if (equippedCount < 5) return; destroyableComponent->Repair(1); break; } // Paradox - case ItemSetPassiveAbilityID::SpaceMarauderRank1: { + case eItemSetPassiveAbilityID::SpaceMarauderRank1: { if (equippedCount < 4) return; destroyableComponent->Imagine(1); break; } - case ItemSetPassiveAbilityID::SpaceMarauderRank2: { + case eItemSetPassiveAbilityID::SpaceMarauderRank2: { if (equippedCount < 4) return; destroyableComponent->Imagine(2); break; } - case ItemSetPassiveAbilityID::SpaceMarauderRank3: { + case eItemSetPassiveAbilityID::SpaceMarauderRank3: { if (equippedCount < 4) return; destroyableComponent->Imagine(3); break; } - case ItemSetPassiveAbilityID::ShinobiRank1: { + case eItemSetPassiveAbilityID::ShinobiRank1: { if (equippedCount < 4) return; destroyableComponent->Imagine(1); break; } - case ItemSetPassiveAbilityID::ShinobiRank2: { + case eItemSetPassiveAbilityID::ShinobiRank2: { if (equippedCount < 4) return; destroyableComponent->Imagine(2); break; } - case ItemSetPassiveAbilityID::ShinobiRank3: { - if (equippedCount < 4 || !target) return; - skillComponent->CalculateBehavior(695, 11399, target->GetObjectID()); + case eItemSetPassiveAbilityID::ShinobiRank3: { + if (equippedCount < 4) return; + destroyableComponent->Imagine(3); break; } - case ItemSetPassiveAbilityID::SorcererRank1: { + case eItemSetPassiveAbilityID::SorcererRank1: { if (equippedCount < 4) return; destroyableComponent->Imagine(1); break; } - case ItemSetPassiveAbilityID::SorcererRank2: { + case eItemSetPassiveAbilityID::SorcererRank2: { if (equippedCount < 4) return; destroyableComponent->Imagine(2); break; } - case ItemSetPassiveAbilityID::SorcererRank3: { + case eItemSetPassiveAbilityID::SorcererRank3: { if (equippedCount < 4) return; destroyableComponent->Imagine(3); break; diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index df1b16d7..0e1acdac 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -12,7 +12,7 @@ #include "GameMessages.h" #include "Mail.h" #include "MissionComponent.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" #include "dLogger.h" #include "dServer.h" #include "dZoneManager.h" @@ -20,6 +20,10 @@ #include "User.h" #include "Database.h" #include "WorldConfig.h" +#include "eMissionState.h" +#include "eMissionTaskType.h" +#include "eMissionLockState.h" + Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { m_MissionComponent = missionComponent; @@ -32,7 +36,7 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { m_Reward = 0; - m_State = MissionState::MISSION_STATE_UNKNOWN; + m_State = eMissionState::UNKNOWN; auto* missionsTable = CDClientManager::Instance()->GetTable("Missions"); @@ -60,7 +64,7 @@ Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { void Mission::LoadFromXml(tinyxml2::XMLElement* element) { // Start custom XML if (element->Attribute("state") != nullptr) { - m_State = static_cast(std::stoul(element->Attribute("state"))); + m_State = static_cast(std::stoul(element->Attribute("state"))); } // End custom XML @@ -85,8 +89,8 @@ void Mission::LoadFromXml(tinyxml2::XMLElement* element) { const auto type = m_Tasks[index]->GetType(); - if (type == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT || - type == MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY) { + if (type == eMissionTaskType::COLLECTION || + type == eMissionTaskType::VISIT_PROPERTY) { std::vector uniques; const auto value = std::stoul(task->Attribute("v")); @@ -100,7 +104,7 @@ void Mission::LoadFromXml(tinyxml2::XMLElement* element) { uniques.push_back(unique); - if (m_MissionComponent != nullptr && type == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT) { + if (m_MissionComponent != nullptr && type == eMissionTaskType::COLLECTION) { m_MissionComponent->AddCollectible(unique); } @@ -144,8 +148,8 @@ void Mission::UpdateXml(tinyxml2::XMLElement* element) { } for (auto* task : m_Tasks) { - if (task->GetType() == MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT || - task->GetType() == MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY) { + if (task->GetType() == eMissionTaskType::COLLECTION || + task->GetType() == eMissionTaskType::VISIT_PROPERTY) { auto* child = element->GetDocument()->NewElement("sv"); @@ -229,7 +233,7 @@ std::vector Mission::GetTasks() const { return m_Tasks; } -MissionState Mission::GetMissionState() const { +eMissionState Mission::GetMissionState() const { return m_State; } @@ -246,47 +250,47 @@ bool Mission::IsRepeatable() const { } bool Mission::IsComplete() const { - return m_State == MissionState::MISSION_STATE_COMPLETE; + return m_State == eMissionState::COMPLETE; } bool Mission::IsActive() const { - return m_State == MissionState::MISSION_STATE_ACTIVE || m_State == MissionState::MISSION_STATE_COMPLETE_AVAILABLE; + return m_State == eMissionState::ACTIVE || m_State == eMissionState::COMPLETE_AVAILABLE; } void Mission::MakeActive() { - SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_ACTIVE : MissionState::MISSION_STATE_COMPLETE_ACTIVE); + SetMissionState(m_Completions == 0 ? eMissionState::ACTIVE : eMissionState::COMPLETE_ACTIVE); } bool Mission::IsReadyToComplete() const { - return m_State == MissionState::MISSION_STATE_READY_TO_COMPLETE || m_State == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE; + return m_State == eMissionState::READY_TO_COMPLETE || m_State == eMissionState::COMPLETE_READY_TO_COMPLETE; } void Mission::MakeReadyToComplete() { - SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_READY_TO_COMPLETE : MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE); + SetMissionState(m_Completions == 0 ? eMissionState::READY_TO_COMPLETE : eMissionState::COMPLETE_READY_TO_COMPLETE); } bool Mission::IsAvalible() const { - return m_State == MissionState::MISSION_STATE_AVAILABLE || m_State == MissionState::MISSION_STATE_COMPLETE_AVAILABLE; + return m_State == eMissionState::AVAILABLE || m_State == eMissionState::COMPLETE_AVAILABLE; } bool Mission::IsFetchMission() const { - return m_Tasks.size() == 1 && m_Tasks[0]->GetType() == MissionTaskType::MISSION_TASK_TYPE_MISSION_INTERACTION; + return m_Tasks.size() == 1 && m_Tasks[0]->GetType() == eMissionTaskType::TALK_TO_NPC; } void Mission::MakeAvalible() { - SetMissionState(m_Completions == 0 ? MissionState::MISSION_STATE_AVAILABLE : MissionState::MISSION_STATE_COMPLETE_AVAILABLE); + SetMissionState(m_Completions == 0 ? eMissionState::AVAILABLE : eMissionState::COMPLETE_AVAILABLE); } void Mission::Accept() { - SetMissionTypeState(MissionLockState::MISSION_LOCK_NEW, info->defined_type, info->defined_subtype); + SetMissionTypeState(eMissionLockState::NEW, info->defined_type, info->defined_subtype); - SetMissionState(m_Completions > 0 ? MissionState::MISSION_STATE_COMPLETE_ACTIVE : MissionState::MISSION_STATE_ACTIVE); + SetMissionState(m_Completions > 0 ? eMissionState::COMPLETE_ACTIVE : eMissionState::ACTIVE); Catchup(); } void Mission::Complete(const bool yieldRewards) { - if (m_State != MissionState::MISSION_STATE_ACTIVE && m_State != MissionState::MISSION_STATE_COMPLETE_ACTIVE) { + if (m_State != eMissionState::ACTIVE && m_State != eMissionState::COMPLETE_ACTIVE) { // If we are accepting a mission here there is no point to giving it a unique ID since we just complete it immediately. Accept(); } @@ -295,13 +299,13 @@ void Mission::Complete(const bool yieldRewards) { task->Complete(); } - SetMissionState(MissionState::MISSION_STATE_REWARDING, true); + SetMissionState(eMissionState::REWARDING, true); if (yieldRewards) { YieldRewards(); } - SetMissionState(MissionState::MISSION_STATE_COMPLETE); + SetMissionState(eMissionState::COMPLETE); m_Completions++; @@ -320,11 +324,11 @@ void Mission::Complete(const bool yieldRewards) { auto* missionComponent = entity->GetComponent(); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MISSION_COMPLETE, info->id); + missionComponent->Progress(eMissionTaskType::META, info->id); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, info->id, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK); + missionComponent->Progress(eMissionTaskType::RACING, info->id, (LWOOBJID)eRacingTaskParam::COMPLETE_ANY_RACING_TASK); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, info->id, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COMPLETE_TRACK_TASKS); + missionComponent->Progress(eMissionTaskType::RACING, info->id, (LWOOBJID)eRacingTaskParam::COMPLETE_TRACK_TASKS); auto* missionEmailTable = CDClientManager::Instance()->GetTable("MissionEmail"); @@ -371,7 +375,7 @@ void Mission::Catchup() { for (auto* task : m_Tasks) { const auto type = task->GetType(); - if (type == MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) { + if (type == eMissionTaskType::GATHER) { for (auto target : task->GetAllTargets()) { const auto count = inventory->GetLotCountNonTransfer(target); @@ -381,7 +385,7 @@ void Mission::Catchup() { } } - if (type == MissionTaskType::MISSION_TASK_TYPE_PLAYER_FLAG) { + if (type == eMissionTaskType::PLAYER_FLAG) { for (auto target : task->GetAllTargets()) { const auto flag = GetUser()->GetLastUsedChar()->GetPlayerFlag(target); @@ -416,7 +420,7 @@ void Mission::YieldRewards() { // Remove mission items for (auto* task : m_Tasks) { - if (task->GetType() != MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION) { + if (task->GetType() != eMissionTaskType::GATHER) { continue; } @@ -429,7 +433,7 @@ void Mission::YieldRewards() { inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::ITEMS); inventoryComponent->RemoveItem(target, task->GetClientInfo().targetValue, eInventoryType::QUEST); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, target, LWOOBJID_EMPTY, "", -task->GetClientInfo().targetValue); + missionComponent->Progress(eMissionTaskType::GATHER, target, LWOOBJID_EMPTY, "", -task->GetClientInfo().targetValue); } } } @@ -525,7 +529,7 @@ void Mission::YieldRewards() { } if (info->reward_reputation > 0) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_EARN_REPUTATION, 0, 0L, "", info->reward_reputation); + missionComponent->Progress(eMissionTaskType::EARN_REPUTATION, 0, 0L, "", info->reward_reputation); auto character = entity->GetComponent(); if (character) { character->SetReputation(character->GetReputation() + info->reward_reputation); @@ -560,7 +564,7 @@ void Mission::YieldRewards() { } } -void Mission::Progress(MissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count) { +void Mission::Progress(eMissionTaskType type, int32_t value, LWOOBJID associate, const std::string& targets, int32_t count) { const auto isRemoval = count < 0; if (isRemoval && (IsComplete() || IsAchievement())) { @@ -584,7 +588,7 @@ void Mission::Progress(MissionTaskType type, int32_t value, LWOOBJID associate, } } -void Mission::SetMissionState(const MissionState state, const bool sendingRewards) { +void Mission::SetMissionState(const eMissionState state, const bool sendingRewards) { this->m_State = state; auto* entity = GetAssociate(); @@ -596,7 +600,7 @@ void Mission::SetMissionState(const MissionState state, const bool sendingReward GameMessages::SendNotifyMission(entity, entity->GetParentUser()->GetSystemAddress(), info->id, static_cast(state), sendingRewards); } -void Mission::SetMissionTypeState(MissionLockState state, const std::string& type, const std::string& subType) { +void Mission::SetMissionTypeState(eMissionLockState state, const std::string& type, const std::string& subType) { // TODO } diff --git a/dGame/dMission/Mission.h b/dGame/dMission/Mission.h index f9902a06..b04c3548 100644 --- a/dGame/dMission/Mission.h +++ b/dGame/dMission/Mission.h @@ -10,13 +10,12 @@ #include "MissionTask.h" #include "dCommonVars.h" #include "Entity.h" -#include "MissionState.h" -#include "MissionLockState.h" namespace tinyxml2 { class XMLElement; }; - +enum class eMissionState : int; +enum class eMissionLockState : int; class MissionComponent; /** @@ -53,7 +52,7 @@ public: * Returns the current state of this mission * @return the current state of this mission */ - MissionState GetMissionState() const; + eMissionState GetMissionState() const; /** * Returns the database information that represents to this mission. @@ -102,12 +101,12 @@ public: * @param state the mission state to set * @param sendingRewards a flag indicating to the client that rewards wil lfollow */ - void SetMissionState(MissionState state, bool sendingRewards = false); + void SetMissionState(eMissionState state, bool sendingRewards = false); /** * Currently unimplemented */ - void SetMissionTypeState(MissionLockState state, const std::string& type, const std::string& subType); + void SetMissionTypeState(eMissionLockState state, const std::string& type, const std::string& subType); /** * Returns whether this mission is an achievement @@ -208,7 +207,7 @@ public: * @param targets optional multiple targets that need to be met for progression * @param count optional count to progress with */ - void Progress(MissionTaskType type, int32_t value, LWOOBJID associate = 0, const std::string& targets = "", int32_t count = 1); + void Progress(eMissionTaskType type, int32_t value, LWOOBJID associate = 0, const std::string& targets = "", int32_t count = 1); /** * Returns if the mission ID that's given belongs to an existing mission @@ -251,7 +250,7 @@ private: /** * The current state this mission is in */ - MissionState m_State; + eMissionState m_State; /** * The number of times the entity has completed this mission diff --git a/dGame/dMission/MissionPrerequisites.cpp b/dGame/dMission/MissionPrerequisites.cpp index 46fa73a6..6b55151c 100644 --- a/dGame/dMission/MissionPrerequisites.cpp +++ b/dGame/dMission/MissionPrerequisites.cpp @@ -106,8 +106,8 @@ bool PrerequisiteExpression::Execute(const std::unordered_mapsub != 0) { // Special case for one Wisp Lee repeatable mission. a = mission->GetClientInfo().id == 1883 ? - mission->GetMissionState() == static_cast(this->sub) : - mission->GetMissionState() >= static_cast(this->sub); + mission->GetMissionState() == static_cast(this->sub) : + mission->GetMissionState() >= static_cast(this->sub); } else if (mission->IsComplete()) { a = true; } diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index d52e6e95..e339d232 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -13,6 +13,7 @@ #include "dZoneManager.h" #include "InventoryComponent.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask) { this->info = info; @@ -42,8 +43,8 @@ MissionTask::MissionTask(Mission* mission, CDMissionTasks* info, uint32_t mask) } -MissionTaskType MissionTask::GetType() const { - return static_cast(info->taskType); +eMissionTaskType MissionTask::GetType() const { + return static_cast(info->taskType); } @@ -187,7 +188,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& const auto type = GetType(); if (count < 0) { - if (mission->IsMission() && type == MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION && InAllTargets(value)) { + if (mission->IsMission() && type == eMissionTaskType::GATHER && InAllTargets(value)) { if (parameters.size() > 0 && (parameters[0] & 1) != 0) { return; } @@ -218,10 +219,10 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& std::vector settings; switch (type) { - case MissionTaskType::MISSION_TASK_TYPE_UNKNOWN: + case eMissionTaskType::UNKNOWN: break; - case MissionTaskType::MISSION_TASK_TYPE_ACTIVITY: + case eMissionTaskType::ACTIVITY: { if (InAllTargets(value)) { AddProgress(count); @@ -256,8 +257,8 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_FOOD: - case MissionTaskType::MISSION_TASK_TYPE_MISSION_INTERACTION: + case eMissionTaskType::USE_ITEM: + case eMissionTaskType::TALK_TO_NPC: { if (GetTarget() != value) break; @@ -266,7 +267,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_EMOTE: + case eMissionTaskType::EMOTE: { if (!InParameters(value)) break; @@ -287,7 +288,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_SKILL: + case eMissionTaskType::USE_SKILL: { // This is a complicated check because for some missions we need to check for the associate being in the parameters instead of the value being in the parameters. if (associate == LWOOBJID_EMPTY && GetAllTargets().size() == 1 && GetAllTargets()[0] == -1) { @@ -298,7 +299,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_MINIGAME: + case eMissionTaskType::PERFORM_ACTIVITY: { auto* minigameManager = EntityManager::Instance()->GetEntity(associate); if (minigameManager == nullptr) @@ -327,7 +328,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY: + case eMissionTaskType::VISIT_PROPERTY: { if (!InAllTargets(value)) break; @@ -340,7 +341,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_ENVIRONMENT: + case eMissionTaskType::COLLECTION: { if (!InAllTargets(value)) break; @@ -375,7 +376,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_LOCATION: + case eMissionTaskType::EXPLORE: { if (info->targetGroup != targets) break; @@ -384,9 +385,9 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_RACING: + case eMissionTaskType::RACING: { - // The meaning of associate can be found in RacingTaskParam.h + // The meaning of associate can be found in eRacingTaskParam.h if (parameters.empty()) break; if (!InAllTargets(dZoneManager::Instance()->GetZone()->GetWorldID()) && !(parameters[0] == 4 || parameters[0] == 5) && !InAllTargets(value)) break; @@ -426,15 +427,15 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_PET_TAMING: - case MissionTaskType::MISSION_TASK_TYPE_SCRIPT: - case MissionTaskType::MISSION_TASK_TYPE_NON_MISSION_INTERACTION: - case MissionTaskType::MISSION_TASK_TYPE_MISSION_COMPLETE: - case MissionTaskType::MISSION_TASK_TYPE_POWERUP: - case MissionTaskType::MISSION_TASK_TYPE_SMASH: - case MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION: - case MissionTaskType::MISSION_TASK_TYPE_PLAYER_FLAG: - case MissionTaskType::MISSION_TASK_TYPE_EARN_REPUTATION: + case eMissionTaskType::PET_TAMING: + case eMissionTaskType::SCRIPT: + case eMissionTaskType::INTERACT: + case eMissionTaskType::META: + case eMissionTaskType::POWERUP: + case eMissionTaskType::SMASH: + case eMissionTaskType::GATHER: + case eMissionTaskType::PLAYER_FLAG: + case eMissionTaskType::EARN_REPUTATION: { if (!InAllTargets(value)) break; @@ -442,7 +443,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - case MissionTaskType::MISSION_TASK_TYPE_PLACE_MODEL: + case eMissionTaskType::PLACE_MODEL: { AddProgress(count); break; diff --git a/dGame/dMission/MissionTask.h b/dGame/dMission/MissionTask.h index ea4b8a05..f867b632 100644 --- a/dGame/dMission/MissionTask.h +++ b/dGame/dMission/MissionTask.h @@ -4,9 +4,9 @@ #define MISSIONTASK_H #include "CDMissionTasksTable.h" -#include "MissionTaskType.h" #include "dCommonVars.h" +enum class eMissionTaskType : int; class Mission; /** @@ -57,7 +57,7 @@ public: * Returns the type of this task * @return the type of this task */ - MissionTaskType GetType() const; + eMissionTaskType GetType() const; /** * Returns the value that should be progressed to, to complete the mission (the target value) diff --git a/dGame/dUtilities/Loot.cpp b/dGame/dUtilities/Loot.cpp index 784d873f..44e35a91 100644 --- a/dGame/dUtilities/Loot.cpp +++ b/dGame/dUtilities/Loot.cpp @@ -13,6 +13,8 @@ #include "GeneralUtils.h" #include "InventoryComponent.h" #include "MissionComponent.h" +#include "eMissionState.h" + LootGenerator::LootGenerator() { CDLootTableTable* lootTableTable = CDClientManager::Instance()->GetTable("LootTable"); @@ -186,13 +188,13 @@ std::unordered_map LootGenerator::RollLootMatrix(Entity* player, u // convert faction token proxy if (drop.itemID == 13763) { - if (missionComponent->GetMissionState(545) == MissionState::MISSION_STATE_COMPLETE) + if (missionComponent->GetMissionState(545) == eMissionState::COMPLETE) drop.itemID = 8318; // "Assembly Token" - else if (missionComponent->GetMissionState(556) == MissionState::MISSION_STATE_COMPLETE) + else if (missionComponent->GetMissionState(556) == eMissionState::COMPLETE) drop.itemID = 8321; // "Venture League Token" - else if (missionComponent->GetMissionState(567) == MissionState::MISSION_STATE_COMPLETE) + else if (missionComponent->GetMissionState(567) == eMissionState::COMPLETE) drop.itemID = 8319; // "Sentinels Token" - else if (missionComponent->GetMissionState(578) == MissionState::MISSION_STATE_COMPLETE) + else if (missionComponent->GetMissionState(578) == eMissionState::COMPLETE) drop.itemID = 8320; // "Paradox Token" } diff --git a/dGame/dUtilities/Mail.cpp b/dGame/dUtilities/Mail.cpp index a4ac63e1..48f21a5d 100644 --- a/dGame/dUtilities/Mail.cpp +++ b/dGame/dUtilities/Mail.cpp @@ -24,6 +24,7 @@ #include "Character.h" #include "dZoneManager.h" #include "WorldConfig.h" +#include "eMissionTaskType.h" void Mail::SendMail(const Entity* recipient, const std::string& subject, const std::string& body, const LOT attachment, const uint16_t attachmentCount) { @@ -165,7 +166,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd if (!character) return; - if (character->HasPermission(PermissionMap::RestrictedMailAccess)) { + if (character->HasPermission(ePermissionMap::RestrictedMailAccess)) { // Send a message to the player ChatPackets::SendSystemMessage( sysAddr, @@ -268,7 +269,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd auto* missionCompoent = entity->GetComponent(); if (missionCompoent != nullptr) { - missionCompoent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, itemLOT, LWOOBJID_EMPTY, "", -attachmentCount); + missionCompoent->Progress(eMissionTaskType::GATHER, itemLOT, LWOOBJID_EMPTY, "", -attachmentCount); } } diff --git a/dGame/dUtilities/Preconditions.cpp b/dGame/dUtilities/Preconditions.cpp index c23ac53b..8602586c 100644 --- a/dGame/dUtilities/Preconditions.cpp +++ b/dGame/dUtilities/Preconditions.cpp @@ -12,7 +12,7 @@ #include "LevelProgressionComponent.h" #include "DestroyableComponent.h" #include "GameMessages.h" - +#include "eMissionState.h" std::map Preconditions::cache = {}; @@ -142,19 +142,19 @@ bool Precondition::CheckValue(Entity* player, const uint32_t value, bool evaluat case PreconditionType::HasAchievement: mission = missionComponent->GetMission(value); - return mission == nullptr || mission->GetMissionState() >= MissionState::MISSION_STATE_COMPLETE; + return mission == nullptr || mission->GetMissionState() >= eMissionState::COMPLETE; case PreconditionType::MissionAvailable: mission = missionComponent->GetMission(value); - return mission == nullptr || mission->GetMissionState() >= MissionState::MISSION_STATE_AVAILABLE; + return mission == nullptr || mission->GetMissionState() >= eMissionState::AVAILABLE; case PreconditionType::OnMission: mission = missionComponent->GetMission(value); - return mission == nullptr || mission->GetMissionState() >= MissionState::MISSION_STATE_ACTIVE; + return mission == nullptr || mission->GetMissionState() >= eMissionState::ACTIVE; case PreconditionType::MissionComplete: mission = missionComponent->GetMission(value); - return mission == nullptr ? false : mission->GetMissionState() >= MissionState::MISSION_STATE_COMPLETE; + return mission == nullptr ? false : mission->GetMissionState() >= eMissionState::COMPLETE; case PreconditionType::PetDeployed: return false; // TODO case PreconditionType::HasFlag: diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 70637990..1bd3f6f3 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -72,6 +72,7 @@ #include "AMFFormat.h" #include "MovingPlatformComponent.h" #include "dMessageIdentifiers.h" +#include "eMissionState.h" void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entity* entity, const SystemAddress& sysAddr) { std::string chatCommand; @@ -685,7 +686,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit return; } - mission->SetMissionState(MissionState::MISSION_STATE_ACTIVE); + mission->SetMissionState(eMissionState::ACTIVE); return; } diff --git a/dNet/ClientPackets.cpp b/dNet/ClientPackets.cpp index 61267971..9e8153cc 100644 --- a/dNet/ClientPackets.cpp +++ b/dNet/ClientPackets.cpp @@ -268,7 +268,7 @@ void ClientPackets::HandleChatModerationRequest(const SystemAddress& sysAddr, Pa // Check if the player has restricted chat access auto* character = entity->GetCharacter(); - if (character->HasPermission(PermissionMap::RestrictedChatAccess)) { + if (character->HasPermission(ePermissionMap::RestrictedChatAccess)) { // Send a message to the player ChatPackets::SendSystemMessage( sysAddr, diff --git a/dScripts/02_server/Equipment/BootyDigServer.cpp b/dScripts/02_server/Equipment/BootyDigServer.cpp index 73d96b1f..375bc4e5 100644 --- a/dScripts/02_server/Equipment/BootyDigServer.cpp +++ b/dScripts/02_server/Equipment/BootyDigServer.cpp @@ -2,7 +2,8 @@ #include "EntityManager.h" #include "RenderComponent.h" #include "MissionComponent.h" -#include "MissionTaskType.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" #include "Loot.h" void BootyDigServer::OnStartup(Entity* self) { @@ -37,8 +38,8 @@ BootyDigServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { auto* mission = missionComponent->GetMission(1881); - if (mission != nullptr && (mission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE || mission->GetMissionState() == MissionState::MISSION_STATE_COMPLETE_ACTIVE)) { - mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + if (mission != nullptr && (mission->GetMissionState() == eMissionState::ACTIVE || mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) { + mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); auto* renderComponent = self->GetComponent(); if (renderComponent != nullptr) diff --git a/dScripts/02_server/Equipment/MaestromExtracticatorServer.cpp b/dScripts/02_server/Equipment/MaestromExtracticatorServer.cpp index caaba28f..c01d2362 100644 --- a/dScripts/02_server/Equipment/MaestromExtracticatorServer.cpp +++ b/dScripts/02_server/Equipment/MaestromExtracticatorServer.cpp @@ -3,6 +3,7 @@ #include "GeneralUtils.h" #include "EntityManager.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void MaestromExtracticatorServer::OnStartup(Entity* self) { //self:SetNetworkVar("current_anim", failAnim) @@ -24,7 +25,7 @@ void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* se auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, 14718); + missionComponent->Progress(eMissionTaskType::SMASH, 14718); CollectSample(self, sender->GetObjectID()); sender->ScheduleKillAfterUpdate(); } diff --git a/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp b/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp index 503d966a..d2cc647e 100644 --- a/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp +++ b/dScripts/02_server/Map/AG/NpcAgCourseStarter.cpp @@ -3,6 +3,8 @@ #include "ScriptedActivityComponent.h" #include "GameMessages.h" #include "LeaderboardManager.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" #include "MissionComponent.h" #include @@ -89,7 +91,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std auto* missionComponent = sender->GetComponent(); if (missionComponent != nullptr) { missionComponent->ForceProgressTaskType(1884, 1, 1, false); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, -finish, self->GetObjectID(), + missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, -finish, self->GetObjectID(), "performact_time"); } diff --git a/dScripts/02_server/Map/AG/NpcCowboyServer.cpp b/dScripts/02_server/Map/AG/NpcCowboyServer.cpp index c4940e4d..c5a0e8f9 100644 --- a/dScripts/02_server/Map/AG/NpcCowboyServer.cpp +++ b/dScripts/02_server/Map/AG/NpcCowboyServer.cpp @@ -1,8 +1,8 @@ #include "NpcCowboyServer.h" -#include "MissionState.h" +#include "eMissionState.h" #include "InventoryComponent.h" -void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionID != 1880) { return; } @@ -13,14 +13,14 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss return; } - if (missionState == MissionState::MISSION_STATE_COMPLETE_ACTIVE || - missionState == MissionState::MISSION_STATE_ACTIVE || - missionState == MissionState::MISSION_STATE_AVAILABLE || - missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) { + if (missionState == eMissionState::COMPLETE_ACTIVE || + missionState == eMissionState::ACTIVE || + missionState == eMissionState::AVAILABLE || + missionState == eMissionState::COMPLETE_AVAILABLE) { if (inventoryComponent->GetLotCount(14378) == 0) { inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_NONE); } - } else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + } else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { inventoryComponent->RemoveItem(14378, 1); } } diff --git a/dScripts/02_server/Map/AG/NpcCowboyServer.h b/dScripts/02_server/Map/AG/NpcCowboyServer.h index e600d798..4493315c 100644 --- a/dScripts/02_server/Map/AG/NpcCowboyServer.h +++ b/dScripts/02_server/Map/AG/NpcCowboyServer.h @@ -3,5 +3,5 @@ class NpcCowboyServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; }; diff --git a/dScripts/02_server/Map/AG/NpcEpsilonServer.cpp b/dScripts/02_server/Map/AG/NpcEpsilonServer.cpp index f6b8f5c4..a928e9d9 100644 --- a/dScripts/02_server/Map/AG/NpcEpsilonServer.cpp +++ b/dScripts/02_server/Map/AG/NpcEpsilonServer.cpp @@ -1,7 +1,7 @@ #include "NpcEpsilonServer.h" #include "GameMessages.h" -void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NpcEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { //If we are completing the Nexus Force join mission, play the celebration for it: if (missionID == 1851) { diff --git a/dScripts/02_server/Map/AG/NpcEpsilonServer.h b/dScripts/02_server/Map/AG/NpcEpsilonServer.h index 798da33e..4de76bcd 100644 --- a/dScripts/02_server/Map/AG/NpcEpsilonServer.h +++ b/dScripts/02_server/Map/AG/NpcEpsilonServer.h @@ -2,6 +2,6 @@ #include "CppScripts.h" class NpcEpsilonServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState); + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState); }; diff --git a/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp b/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp index a53d8ba3..183765d7 100644 --- a/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp +++ b/dScripts/02_server/Map/AG/NpcNjAssistantServer.cpp @@ -3,24 +3,25 @@ #include "InventoryComponent.h" #include "MissionComponent.h" #include "Item.h" +#include "eMissionState.h" -void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NpcNjAssistantServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionID != mailMission) return; - if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) { GameMessages::SendNotifyClientObject(self->GetObjectID(), u"switch", 0, 0, LWOOBJID_EMPTY, "", target->GetSystemAddress()); auto* inv = static_cast(target->GetComponent(COMPONENT_TYPE_INVENTORY)); // If we are ready to complete our missions, we take the kit from you: - if (inv && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (inv && missionState == eMissionState::READY_TO_COMPLETE) { auto* id = inv->FindItemByLot(14397); //the kit's lot if (id != nullptr) { inv->RemoveItem(id->GetLot(), id->GetCount()); } } - } else if (missionState == MissionState::MISSION_STATE_AVAILABLE) { + } else if (missionState == eMissionState::AVAILABLE) { auto* missionComponent = static_cast(target->GetComponent(COMPONENT_TYPE_MISSION)); missionComponent->CompleteMission(mailAchievement, true); } diff --git a/dScripts/02_server/Map/AG/NpcNjAssistantServer.h b/dScripts/02_server/Map/AG/NpcNjAssistantServer.h index 7ba847d0..1f932752 100644 --- a/dScripts/02_server/Map/AG/NpcNjAssistantServer.h +++ b/dScripts/02_server/Map/AG/NpcNjAssistantServer.h @@ -2,7 +2,7 @@ #include "CppScripts.h" class NpcNjAssistantServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState); + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState); private: int mailMission = 1728; //mission to get the item out of your mailbox diff --git a/dScripts/02_server/Map/AG/NpcPirateServer.cpp b/dScripts/02_server/Map/AG/NpcPirateServer.cpp index 154fe2bc..6e7e696c 100644 --- a/dScripts/02_server/Map/AG/NpcPirateServer.cpp +++ b/dScripts/02_server/Map/AG/NpcPirateServer.cpp @@ -1,17 +1,17 @@ #include "NpcPirateServer.h" -#include "MissionState.h" +#include "eMissionState.h" #include "InventoryComponent.h" -void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NpcPirateServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* inventory = target->GetComponent(); if (inventory != nullptr && missionID == 1881) { auto* luckyShovel = inventory->FindItemByLot(14591); // Add or remove the lucky shovel based on whether the mission was completed or started - if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) + if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE) && luckyShovel == nullptr) { inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_NONE); - } else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + } else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { inventory->RemoveItem(14591, 1); } } diff --git a/dScripts/02_server/Map/AG/NpcPirateServer.h b/dScripts/02_server/Map/AG/NpcPirateServer.h index dcb399c5..118aec89 100644 --- a/dScripts/02_server/Map/AG/NpcPirateServer.h +++ b/dScripts/02_server/Map/AG/NpcPirateServer.h @@ -2,5 +2,5 @@ #include "CppScripts.h" class NpcPirateServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; }; diff --git a/dScripts/02_server/Map/AG/NpcWispServer.cpp b/dScripts/02_server/Map/AG/NpcWispServer.cpp index d6eab34c..99345973 100644 --- a/dScripts/02_server/Map/AG/NpcWispServer.cpp +++ b/dScripts/02_server/Map/AG/NpcWispServer.cpp @@ -3,9 +3,9 @@ #include "EntityManager.h" #include "Entity.h" #include "GameMessages.h" -#include "MissionState.h" +#include "eMissionState.h" -void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionID != 1849 && missionID != 1883) return; @@ -17,16 +17,16 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio auto* maelstromVacuum = inventory->FindItemByLot(maelstromVacuumLot); // For the daily we add the maelstrom vacuum if the player doesn't have it yet - if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE) + if (missionID == 1883 && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE) && maelstromVacuum == nullptr) { inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_NONE); - } else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + } else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { inventory->RemoveItem(maelstromVacuumLot, 1); } // Next up hide or show the samples based on the mission state auto visible = 1; - if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { visible = 0; } diff --git a/dScripts/02_server/Map/AG/NpcWispServer.h b/dScripts/02_server/Map/AG/NpcWispServer.h index 86c9c33d..6eaa09e9 100644 --- a/dScripts/02_server/Map/AG/NpcWispServer.h +++ b/dScripts/02_server/Map/AG/NpcWispServer.h @@ -2,5 +2,5 @@ #include "CppScripts.h" class NpcWispServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState); + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState); }; diff --git a/dScripts/02_server/Map/AG/RemoveRentalGear.cpp b/dScripts/02_server/Map/AG/RemoveRentalGear.cpp index fbb00c79..6e7bd4de 100644 --- a/dScripts/02_server/Map/AG/RemoveRentalGear.cpp +++ b/dScripts/02_server/Map/AG/RemoveRentalGear.cpp @@ -1,7 +1,7 @@ #include "RemoveRentalGear.h" #include "InventoryComponent.h" #include "Item.h" -#include "MissionState.h" +#include "eMissionState.h" #include "Character.h" /* @@ -17,10 +17,10 @@ -------------------------------------------------------------- */ -void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { if (missionID != defaultMission && missionID != 313) return; - if (missionState == MissionState::MISSION_STATE_COMPLETE || missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) { auto inv = static_cast(target->GetComponent(COMPONENT_TYPE_INVENTORY)); if (!inv) return; diff --git a/dScripts/02_server/Map/AG/RemoveRentalGear.h b/dScripts/02_server/Map/AG/RemoveRentalGear.h index 49ca0860..cc33b5f6 100644 --- a/dScripts/02_server/Map/AG/RemoveRentalGear.h +++ b/dScripts/02_server/Map/AG/RemoveRentalGear.h @@ -2,7 +2,7 @@ #include "CppScripts.h" class RemoveRentalGear : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState); + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState); private: int defaultMission = 768; //mission to remove gearSets on completion diff --git a/dScripts/02_server/Map/AM/AmDropshipComputer.cpp b/dScripts/02_server/Map/AM/AmDropshipComputer.cpp index 909beaaf..15ca7267 100644 --- a/dScripts/02_server/Map/AM/AmDropshipComputer.cpp +++ b/dScripts/02_server/Map/AM/AmDropshipComputer.cpp @@ -3,6 +3,7 @@ #include "RebuildComponent.h" #include "InventoryComponent.h" #include "dZoneManager.h" +#include "eMissionState.h" void AmDropshipComputer::OnStartup(Entity* self) { self->AddTimer("reset", 45.0f); @@ -22,7 +23,7 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user) { return; } - if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == MissionState::MISSION_STATE_COMPLETE) { + if (inventoryComponent->GetLotCount(m_NexusTalonDataCard) != 0 || missionComponent->GetMission(979)->GetMissionState() == eMissionState::COMPLETE) { return; } diff --git a/dScripts/02_server/Map/FV/FvFong.cpp b/dScripts/02_server/Map/FV/FvFong.cpp index 7f63e5e5..13c637e7 100644 --- a/dScripts/02_server/Map/FV/FvFong.cpp +++ b/dScripts/02_server/Map/FV/FvFong.cpp @@ -1,9 +1,9 @@ #include "FvFong.h" #include "Darkitect.h" -#include "MissionState.h" +#include "eMissionState.h" -void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { - if (missionID == 734 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) { +void FvFong::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { + if (missionID == 734 && missionState == eMissionState::READY_TO_COMPLETE) { Darkitect Baron; Baron.Reveal(self, target); } diff --git a/dScripts/02_server/Map/FV/FvFong.h b/dScripts/02_server/Map/FV/FvFong.h index 074e6d8c..c0b6d48b 100644 --- a/dScripts/02_server/Map/FV/FvFong.h +++ b/dScripts/02_server/Map/FV/FvFong.h @@ -4,5 +4,5 @@ class FvFong : public CppScripts::Script { public: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; }; diff --git a/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp b/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp index 4a12324f..9c7b858f 100644 --- a/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp +++ b/dScripts/02_server/Map/FV/ImgBrickConsoleQB.cpp @@ -4,6 +4,7 @@ #include "EntityManager.h" #include "GameMessages.h" #include "MissionComponent.h" +#include "eMissionState.h" #include "InventoryComponent.h" int32_t ImgBrickConsoleQB::ResetBricks = 30; @@ -71,13 +72,13 @@ void ImgBrickConsoleQB::OnUse(Entity* self, Entity* user) { auto* inventoryComponent = player->GetComponent(); if (missionComponent != nullptr && inventoryComponent != nullptr) { - if (missionComponent->GetMissionState(1302) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(1302) == eMissionState::ACTIVE) { inventoryComponent->RemoveItem(13074, 1); missionComponent->ForceProgressTaskType(1302, 1, 1); } - if (missionComponent->GetMissionState(1926) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(1926) == eMissionState::ACTIVE) { inventoryComponent->RemoveItem(14472, 1); missionComponent->ForceProgressTaskType(1926, 1, 1); diff --git a/dScripts/02_server/Map/GF/GfTikiTorch.cpp b/dScripts/02_server/Map/GF/GfTikiTorch.cpp index 3a06b054..db7ee6b5 100644 --- a/dScripts/02_server/Map/GF/GfTikiTorch.cpp +++ b/dScripts/02_server/Map/GF/GfTikiTorch.cpp @@ -3,6 +3,7 @@ #include "EntityManager.h" #include "MissionComponent.h" #include "RenderComponent.h" +#include "eMissionTaskType.h" void GfTikiTorch::OnStartup(Entity* self) { LightTorch(self); @@ -65,7 +66,7 @@ void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::str auto* casterMissionComponent = caster->GetComponent(); if (casterMissionComponent != nullptr) { for (const auto missionID : m_missions) { - casterMissionComponent->ForceProgressTaskType(missionID, static_cast(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1); + casterMissionComponent->ForceProgressTaskType(missionID, static_cast(eMissionTaskType::SCRIPT), 1); } } diff --git a/dScripts/02_server/Map/General/ExplodingAsset.cpp b/dScripts/02_server/Map/General/ExplodingAsset.cpp index 46ff1522..16340ee6 100644 --- a/dScripts/02_server/Map/General/ExplodingAsset.cpp +++ b/dScripts/02_server/Map/General/ExplodingAsset.cpp @@ -3,6 +3,7 @@ #include "GameMessages.h" #include "MissionComponent.h" #include "SkillComponent.h" +#include "eMissionTaskType.h" //TODO: this has to be updated so that you only get killed if you're in a certain radius. //And so that all entities in a certain radius are killed, not just the attacker. @@ -51,14 +52,14 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) { if (missionComponent != nullptr) { if (missionID != 0) { missionComponent->ForceProgressValue(missionID, - static_cast(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), + static_cast(eMissionTaskType::SCRIPT), self->GetLOT(), false); } if (!achievementIDs.empty()) { for (const auto& achievementID : GeneralUtils::SplitString(achievementIDs, u'_')) { missionComponent->ForceProgressValue(std::stoi(GeneralUtils::UTF16ToWTF8(achievementID)), - static_cast(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), + static_cast(eMissionTaskType::SCRIPT), self->GetLOT()); } } diff --git a/dScripts/02_server/Map/General/GrowingFlower.cpp b/dScripts/02_server/Map/General/GrowingFlower.cpp index 61bfbc30..ad88528f 100644 --- a/dScripts/02_server/Map/General/GrowingFlower.cpp +++ b/dScripts/02_server/Map/General/GrowingFlower.cpp @@ -1,5 +1,7 @@ #include "GrowingFlower.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" #include "Loot.h" void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::string& message) { @@ -16,13 +18,13 @@ void GrowingFlower::OnSkillEventFired(Entity* self, Entity* target, const std::s auto* missionComponent = target->GetComponent(); if (missionComponent != nullptr) { for (const auto mission : achievementIDs) - missionComponent->ForceProgressTaskType(mission, static_cast(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1); + missionComponent->ForceProgressTaskType(mission, static_cast(eMissionTaskType::SCRIPT), 1); - if (mission1 && missionComponent->GetMissionState(mission1) == MissionState::MISSION_STATE_ACTIVE) - missionComponent->ForceProgressTaskType(mission1, static_cast(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1); + if (mission1 && missionComponent->GetMissionState(mission1) == eMissionState::ACTIVE) + missionComponent->ForceProgressTaskType(mission1, static_cast(eMissionTaskType::SCRIPT), 1); - if (mission2 && missionComponent->GetMissionState(mission2) == MissionState::MISSION_STATE_ACTIVE) - missionComponent->ForceProgressTaskType(mission2, static_cast(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1); + if (mission2 && missionComponent->GetMissionState(mission2) == eMissionState::ACTIVE) + missionComponent->ForceProgressTaskType(mission2, static_cast(eMissionTaskType::SCRIPT), 1); } } } diff --git a/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp b/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp index 1e0d35cf..8b3da9fa 100644 --- a/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp +++ b/dScripts/02_server/Map/General/ImaginationBackpackHealServer.cpp @@ -1,6 +1,8 @@ #include "ImaginationBackpackHealServer.h" #include "GameMessages.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) { if (message == "CastImaginationBackpack") { @@ -11,8 +13,8 @@ void ImaginationBackpackHealServer::OnSkillEventFired(Entity* self, Entity* cast return; auto* missionComponent = caster->GetComponent(); - if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == MissionState::MISSION_STATE_ACTIVE) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + if (missionComponent != nullptr && missionComponent->GetMissionState(healMission) == eMissionState::ACTIVE) { + missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ClearMaelstrom", 0, 0, caster->GetObjectID(), "", caster->GetSystemAddress()); } diff --git a/dScripts/02_server/Map/General/PetDigServer.cpp b/dScripts/02_server/Map/General/PetDigServer.cpp index 0d62ff04..81d70faf 100644 --- a/dScripts/02_server/Map/General/PetDigServer.cpp +++ b/dScripts/02_server/Map/General/PetDigServer.cpp @@ -5,6 +5,7 @@ #include "Character.h" #include "PetComponent.h" #include "User.h" +#include "eMissionState.h" std::vector PetDigServer::treasures{}; @@ -163,13 +164,13 @@ void PetDigServer::ProgressPetDigMissions(const Entity* owner, const Entity* che if (missionComponent != nullptr) { // Can You Dig It progress const auto digMissionState = missionComponent->GetMissionState(843); - if (digMissionState == MissionState::MISSION_STATE_ACTIVE) { + if (digMissionState == eMissionState::ACTIVE) { missionComponent->ForceProgress(843, 1216, 1); } // Pet Excavator progress const auto excavatorMissionState = missionComponent->GetMissionState(505); - if (excavatorMissionState == MissionState::MISSION_STATE_ACTIVE) { + if (excavatorMissionState == eMissionState::ACTIVE) { if (chest->HasVar(u"PetDig")) { int32_t playerFlag = 1260 + chest->GetVarAs(u"PetDig"); Character* player = owner->GetCharacter(); @@ -193,7 +194,7 @@ void PetDigServer::SpawnPet(Entity* self, const Entity* owner, const DigInfo dig // Some treasures require a mission to be active if (digInfo.requiredMission >= 0) { auto* missionComponent = owner->GetComponent(); - if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < eMissionState::ACTIVE) { return; } } diff --git a/dScripts/02_server/Map/General/PropertyDevice.cpp b/dScripts/02_server/Map/General/PropertyDevice.cpp index 64771de1..0ad9f5c9 100644 --- a/dScripts/02_server/Map/General/PropertyDevice.cpp +++ b/dScripts/02_server/Map/General/PropertyDevice.cpp @@ -2,6 +2,7 @@ #include "GameMessages.h" #include "EntityManager.h" #include "MissionComponent.h" +#include "eMissionState.h" void PropertyDevice::OnStartup(Entity* self) { auto* zoneControl = EntityManager::Instance()->GetZoneControlEntity(); @@ -17,7 +18,7 @@ void PropertyDevice::OnRebuildComplete(Entity* self, Entity* target) { auto* missionComponent = target->GetComponent(); if (missionComponent != nullptr) { - if (missionComponent->GetMissionState(m_PropertyMissionID) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(m_PropertyMissionID) == eMissionState::ACTIVE) { GameMessages::SendPlayFXEffect(self->GetObjectID(), 641, u"create", "callhome"); missionComponent->ForceProgress(m_PropertyMissionID, 1793, self->GetLOT()); } diff --git a/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp b/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp index f732305e..00c1b900 100644 --- a/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp +++ b/dScripts/02_server/Map/General/TouchMissionUpdateServer.cpp @@ -3,6 +3,7 @@ #include "Entity.h" #include "GameMessages.h" #include "MissionComponent.h" +#include "eMissionState.h" void TouchMissionUpdateServer::OnStartup(Entity* self) { self->SetProximityRadius(20, "touchCheck"); // Those does not have a collider for some reason? @@ -29,7 +30,7 @@ void TouchMissionUpdateServer::OnCollisionPhantom(Entity* self, Entity* target) const auto state = mission->GetMissionState(); - if (state >= MissionState::MISSION_STATE_COMPLETE || mission->GetCompletions() > 1) { + if (state >= eMissionState::COMPLETE || mission->GetCompletions() > 1) { return; } diff --git a/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp b/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp index 5410047d..b4d75296 100644 --- a/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp +++ b/dScripts/02_server/Map/NT/NtAssemblyTubeServer.cpp @@ -2,6 +2,8 @@ #include "GameMessages.h" #include "EntityManager.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" void NtAssemblyTubeServer::OnStartup(Entity* self) { self->SetProximityRadius(5, "teleport"); @@ -22,7 +24,7 @@ void NtAssemblyTubeServer::OnProximityUpdate(Entity* self, Entity* entering, std auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } diff --git a/dScripts/02_server/Map/NT/NtDukeServer.cpp b/dScripts/02_server/Map/NT/NtDukeServer.cpp index 327d3290..d48d50c7 100644 --- a/dScripts/02_server/Map/NT/NtDukeServer.cpp +++ b/dScripts/02_server/Map/NT/NtDukeServer.cpp @@ -1,6 +1,7 @@ #include "NtDukeServer.h" #include "InventoryComponent.h" #include "MissionComponent.h" +#include "eMissionState.h" void NtDukeServer::SetVariables(Entity* self) { self->SetVar(m_SpyProximityVariable, 35.0f); @@ -19,7 +20,7 @@ void NtDukeServer::SetVariables(Entity* self) { self->SetVar>(m_SpyCinematicObjectsVariable, { self->GetObjectID() }); } -void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { // Handles adding and removing the sword for the Crux Prime Sword mission auto* missionComponent = target->GetComponent(); @@ -29,9 +30,9 @@ void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int mission auto state = missionComponent->GetMissionState(m_SwordMissionID); auto lotCount = inventoryComponent->GetLotCount(m_SwordLot); - if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) { + if ((state == eMissionState::AVAILABLE || state == eMissionState::ACTIVE) && lotCount < 1) { inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_NONE); - } else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) { + } else if (state == eMissionState::READY_TO_COMPLETE) { inventoryComponent->RemoveItem(m_SwordLot, lotCount); } } diff --git a/dScripts/02_server/Map/NT/NtDukeServer.h b/dScripts/02_server/Map/NT/NtDukeServer.h index 0878e86c..2103ba8d 100644 --- a/dScripts/02_server/Map/NT/NtDukeServer.h +++ b/dScripts/02_server/Map/NT/NtDukeServer.h @@ -3,7 +3,7 @@ class NtDukeServer : public NtFactionSpyServer { void SetVariables(Entity* self) override; - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; const uint32_t m_SwordMissionID = 1448; const LOT m_SwordLot = 13777; }; diff --git a/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp b/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp index 8d14050b..0cb0bec4 100644 --- a/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp +++ b/dScripts/02_server/Map/NT/NtParadoxPanelServer.cpp @@ -3,6 +3,7 @@ #include "MissionComponent.h" #include "EntityManager.h" #include "Character.h" +#include "eMissionState.h" void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) { GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress()); @@ -16,7 +17,7 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) { const auto playerID = user->GetObjectID(); for (const auto mission : tPlayerOnMissions) { - if (missionComponent->GetMissionState(mission) != MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(mission) != eMissionState::ACTIVE) { continue; } diff --git a/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp b/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp index 64af4d34..8b4f19fe 100644 --- a/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp +++ b/dScripts/02_server/Map/NT/NtParadoxTeleServer.cpp @@ -2,6 +2,7 @@ #include "GameMessages.h" #include "EntityManager.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void NtParadoxTeleServer::OnStartup(Entity* self) { self->SetProximityRadius(5, "teleport"); @@ -44,7 +45,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std: auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } diff --git a/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp b/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp index 7b943172..66bfe46f 100644 --- a/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp +++ b/dScripts/02_server/Map/NT/NtSentinelWalkwayServer.cpp @@ -2,6 +2,7 @@ #include "PhantomPhysicsComponent.h" #include "EntityManager.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void NtSentinelWalkwayServer::OnStartup(Entity* self) { auto* phantomPhysicsComponent = self->GetComponent(); @@ -38,6 +39,6 @@ void NtSentinelWalkwayServer::OnProximityUpdate(Entity* self, Entity* entering, auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } diff --git a/dScripts/02_server/Map/NT/NtVandaServer.cpp b/dScripts/02_server/Map/NT/NtVandaServer.cpp index e5653005..7750d566 100644 --- a/dScripts/02_server/Map/NT/NtVandaServer.cpp +++ b/dScripts/02_server/Map/NT/NtVandaServer.cpp @@ -1,11 +1,11 @@ #include "NtVandaServer.h" #include "InventoryComponent.h" -#include "MissionState.h" +#include "eMissionState.h" -void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NtVandaServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { // Removes the alien parts after completing the mission - if (missionID == m_AlienPartMissionID && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (missionID == m_AlienPartMissionID && missionState == eMissionState::READY_TO_COMPLETE) { auto* inventoryComponent = target->GetComponent(); for (const auto& alienPartLot : m_AlienPartLots) { inventoryComponent->RemoveItem(alienPartLot, 1); diff --git a/dScripts/02_server/Map/NT/NtVandaServer.h b/dScripts/02_server/Map/NT/NtVandaServer.h index 69e868f5..58162cd9 100644 --- a/dScripts/02_server/Map/NT/NtVandaServer.h +++ b/dScripts/02_server/Map/NT/NtVandaServer.h @@ -2,7 +2,7 @@ #include "CppScripts.h" class NtVandaServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; const uint32_t m_AlienPartMissionID = 1183; const std::vector m_AlienPartLots = { 12479, 12480, 12481 }; }; diff --git a/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp b/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp index 0995d1df..07d33555 100644 --- a/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp +++ b/dScripts/02_server/Map/NT/NtVentureSpeedPadServer.cpp @@ -1,6 +1,7 @@ #include "NtVentureSpeedPadServer.h" #include "SkillComponent.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void NtVentureSpeedPadServer::OnStartup(Entity* self) { self->SetProximityRadius(3, "speedboost"); @@ -17,7 +18,7 @@ void NtVentureSpeedPadServer::OnProximityUpdate(Entity* self, Entity* entering, auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } auto* skillComponent = player->GetComponent(); diff --git a/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp b/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp index 22e5ff59..2b7e3904 100644 --- a/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp +++ b/dScripts/02_server/Map/PR/SpawnGryphonServer.cpp @@ -2,6 +2,7 @@ #include "InventoryComponent.h" #include "GameMessages.h" #include "MissionComponent.h" +#include "eMissionState.h" void SpawnGryphonServer::SetVariables(Entity* self) { self->SetVar(u"petLOT", 12433); @@ -17,7 +18,7 @@ void SpawnGryphonServer::OnUse(Entity* self, Entity* user) { // Little extra for handling the case of the egg being placed the first time if (missionComponent != nullptr && inventoryComponent != nullptr - && missionComponent->GetMissionState(1391) == MissionState::MISSION_STATE_ACTIVE) { + && missionComponent->GetMissionState(1391) == eMissionState::ACTIVE) { inventoryComponent->RemoveItem(12483, inventoryComponent->GetLotCount(12483)); GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID()); return; diff --git a/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp b/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp index db2bb78a..b6172df1 100644 --- a/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp +++ b/dScripts/02_server/Map/Property/AG_Small/ZoneAgProperty.cpp @@ -6,6 +6,7 @@ #include "dZoneManager.h" #include "RenderComponent.h" #include "MissionComponent.h" +#include "eMissionState.h" void ZoneAgProperty::SetGameVariables(Entity* self) { self->SetVar(GuardGroup, "Guard"); @@ -80,7 +81,7 @@ void ZoneAgProperty::PropGuardCheck(Entity* self, Entity* player) { const auto state = missionComponent->GetMissionState(self->GetVar(guardMissionFlag)); const auto firstState = missionComponent->GetMissionState(self->GetVar(guardFirstMissionFlag)); - if (firstState < MissionState::MISSION_STATE_COMPLETE || (state != MissionState::MISSION_STATE_COMPLETE && state != MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)) + if (firstState < eMissionState::COMPLETE || (state != eMissionState::COMPLETE && state != eMissionState::COMPLETE_READY_TO_COMPLETE)) ActivateSpawner(self->GetVar(PropertyMGSpawner)); } @@ -304,13 +305,13 @@ void ZoneAgProperty::OnZonePropertyModelPlaced(Entity* self, Entity* player) { if (!character->GetPlayerFlag(101)) { BaseZonePropertyModelPlaced(self, player); character->SetPlayerFlag(101, true); - if (missionComponent->GetMissionState(871) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(871) == eMissionState::ACTIVE) { self->SetNetworkVar(u"Tooltip", u"AnotherModel"); } } else if (!character->GetPlayerFlag(102)) { character->SetPlayerFlag(102, true); - if (missionComponent->GetMissionState(871) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(871) == eMissionState::ACTIVE) { self->SetNetworkVar(u"Tooltip", u"TwoMoreModels"); } @@ -331,7 +332,7 @@ void ZoneAgProperty::OnZonePropertyModelPickedUp(Entity* self, Entity* player) { if (!character->GetPlayerFlag(109)) { character->SetPlayerFlag(109, true); - if (missionComponent->GetMissionState(891) == MissionState::MISSION_STATE_ACTIVE && !character->GetPlayerFlag(110)) { + if (missionComponent->GetMissionState(891) == eMissionState::ACTIVE && !character->GetPlayerFlag(110)) { self->SetNetworkVar(u"Tooltip", u"Rotate"); } } @@ -353,7 +354,7 @@ void ZoneAgProperty::OnZonePropertyModelRotated(Entity* self, Entity* player) { if (!character->GetPlayerFlag(110)) { character->SetPlayerFlag(110, true); - if (missionComponent->GetMissionState(891) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(891) == eMissionState::ACTIVE) { self->SetNetworkVar(u"Tooltip", u"PlaceModel"); self->SetVar(u"tutorial", "place_model"); } diff --git a/dScripts/02_server/Map/SS/SsModularBuildServer.cpp b/dScripts/02_server/Map/SS/SsModularBuildServer.cpp index d5b6da50..82c802cc 100644 --- a/dScripts/02_server/Map/SS/SsModularBuildServer.cpp +++ b/dScripts/02_server/Map/SS/SsModularBuildServer.cpp @@ -1,5 +1,6 @@ #include "SsModularBuildServer.h" #include "MissionComponent.h" +#include "eMissionState.h" void SsModularBuildServer::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector modules) { int missionNum = 1732; @@ -8,7 +9,7 @@ void SsModularBuildServer::OnModularBuildExit(Entity* self, Entity* player, bool MissionComponent* mission = static_cast(player->GetComponent(COMPONENT_TYPE_MISSION)); Mission* rocketMission = mission->GetMission(missionNum); - if (rocketMission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE) { + if (rocketMission->GetMissionState() == eMissionState::ACTIVE) { mission->ForceProgress(missionNum, 2478, 1); } } diff --git a/dScripts/02_server/Map/VE/VeBricksampleServer.cpp b/dScripts/02_server/Map/VE/VeBricksampleServer.cpp index 5166d0c3..36306d07 100644 --- a/dScripts/02_server/Map/VE/VeBricksampleServer.cpp +++ b/dScripts/02_server/Map/VE/VeBricksampleServer.cpp @@ -3,10 +3,11 @@ #include "EntityManager.h" #include "MissionComponent.h" #include "GameMessages.h" +#include "eMissionState.h" void VeBricksampleServer::OnUse(Entity* self, Entity* user) { auto* missionComponent = user->GetComponent(); - if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == eMissionState::ACTIVE) { const auto loot = self->GetVar(m_LootVariable); auto* inventoryComponent = user->GetComponent(); diff --git a/dScripts/02_server/Map/VE/VeEpsilonServer.cpp b/dScripts/02_server/Map/VE/VeEpsilonServer.cpp index 4a2f1bbf..c69f9cc2 100644 --- a/dScripts/02_server/Map/VE/VeEpsilonServer.cpp +++ b/dScripts/02_server/Map/VE/VeEpsilonServer.cpp @@ -2,17 +2,17 @@ #include "Character.h" #include "EntityManager.h" #include "GameMessages.h" -#include "MissionState.h" +#include "eMissionState.h" #include "Entity.h" -void VeEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void VeEpsilonServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* character = target->GetCharacter(); if (character == nullptr) return; // Resets the player flags that track which consoles they've used if ((missionID == m_ConsoleMissionID || missionID == m_ConsoleRepeatMissionID) - && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)) { + && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)) { for (auto i = 0; i < 10; i++) { character->SetPlayerFlag(m_ConsoleBaseFlag + i, false); diff --git a/dScripts/02_server/Map/VE/VeEpsilonServer.h b/dScripts/02_server/Map/VE/VeEpsilonServer.h index d1236e96..971cd93e 100644 --- a/dScripts/02_server/Map/VE/VeEpsilonServer.h +++ b/dScripts/02_server/Map/VE/VeEpsilonServer.h @@ -2,7 +2,7 @@ #include "CppScripts.h" class VeEpsilonServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; const uint32_t m_ConsoleMissionID = 1220; const uint32_t m_ConsoleRepeatMissionID = 1225; const uint32_t m_ConsoleBaseFlag = 1010; diff --git a/dScripts/02_server/Map/njhub/NjColeNPC.cpp b/dScripts/02_server/Map/njhub/NjColeNPC.cpp index f151db40..672fdd95 100644 --- a/dScripts/02_server/Map/njhub/NjColeNPC.cpp +++ b/dScripts/02_server/Map/njhub/NjColeNPC.cpp @@ -1,6 +1,7 @@ #include "NjColeNPC.h" #include "MissionComponent.h" #include "InventoryComponent.h" +#include "eMissionState.h" void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) { if (emote != 393) { @@ -26,10 +27,10 @@ void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) { missionComponent->ForceProgressTaskType(1818, 1, 1); } -void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState); - if (missionID == 1818 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (missionID == 1818 && missionState >= eMissionState::READY_TO_COMPLETE) { auto* missionComponent = target->GetComponent(); auto* inventoryComponent = target->GetComponent(); diff --git a/dScripts/02_server/Map/njhub/NjColeNPC.h b/dScripts/02_server/Map/njhub/NjColeNPC.h index cf8e67e1..a2536e32 100644 --- a/dScripts/02_server/Map/njhub/NjColeNPC.h +++ b/dScripts/02_server/Map/njhub/NjColeNPC.h @@ -3,5 +3,5 @@ class NjColeNPC : public NjNPCMissionSpinjitzuServer { void OnEmoteReceived(Entity* self, int32_t emote, Entity* target) override; - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; }; diff --git a/dScripts/02_server/Map/njhub/NjJayMissionItems.cpp b/dScripts/02_server/Map/njhub/NjJayMissionItems.cpp index cc871b86..46131446 100644 --- a/dScripts/02_server/Map/njhub/NjJayMissionItems.cpp +++ b/dScripts/02_server/Map/njhub/NjJayMissionItems.cpp @@ -1,6 +1,6 @@ #include "NjJayMissionItems.h" -void NjJayMissionItems::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NjJayMissionItems::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState); NPCAddRemoveItem::OnMissionDialogueOK(self, target, missionID, missionState); } diff --git a/dScripts/02_server/Map/njhub/NjJayMissionItems.h b/dScripts/02_server/Map/njhub/NjJayMissionItems.h index c49f49ea..bdaee3ea 100644 --- a/dScripts/02_server/Map/njhub/NjJayMissionItems.h +++ b/dScripts/02_server/Map/njhub/NjJayMissionItems.h @@ -5,6 +5,6 @@ #include class NjJayMissionItems : public NjNPCMissionSpinjitzuServer, NPCAddRemoveItem { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; std::map> GetSettings() override; }; diff --git a/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.cpp b/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.cpp index 69838dc8..30bba804 100644 --- a/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.cpp +++ b/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.cpp @@ -1,13 +1,12 @@ #include "NjNPCMissionSpinjitzuServer.h" #include "Character.h" #include "EntityManager.h" -#include "MissionState.h" +#include "eMissionState.h" -void NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, - MissionState missionState) { +void NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { const auto& element = self->GetVar(ElementVariable); - if (missionID == ElementMissions.at(element) && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) { + if (missionID == ElementMissions.at(element) && missionState >= eMissionState::READY_TO_COMPLETE) { const auto targetID = target->GetObjectID(); diff --git a/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.h b/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.h index 8f25a86a..3c705925 100644 --- a/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.h +++ b/dScripts/02_server/Map/njhub/NjNPCMissionSpinjitzuServer.h @@ -18,7 +18,7 @@ static std::map ElementMissions = { class NjNPCMissionSpinjitzuServer : public CppScripts::Script { public: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; private: const std::u16string ElementVariable = u"element"; }; diff --git a/dScripts/02_server/Map/njhub/NjWuNPC.cpp b/dScripts/02_server/Map/njhub/NjWuNPC.cpp index 855e4433..9efc623b 100644 --- a/dScripts/02_server/Map/njhub/NjWuNPC.cpp +++ b/dScripts/02_server/Map/njhub/NjWuNPC.cpp @@ -3,8 +3,9 @@ #include "Character.h" #include "EntityManager.h" #include "GameMessages.h" +#include "eMissionState.h" -void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { // The Dragon statue daily mission if (missionID == m_MainDragonMissionID) { @@ -14,8 +15,8 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, M return; switch (missionState) { - case MissionState::MISSION_STATE_AVAILABLE: - case MissionState::MISSION_STATE_COMPLETE_AVAILABLE: + case eMissionState::AVAILABLE: + case eMissionState::COMPLETE_AVAILABLE: { // Reset the sub missions for (const auto& subMissionID : m_SubDragonMissionIDs) { @@ -33,8 +34,8 @@ void NjWuNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, M return; } - case MissionState::MISSION_STATE_READY_TO_COMPLETE: - case MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE: + case eMissionState::READY_TO_COMPLETE: + case eMissionState::COMPLETE_READY_TO_COMPLETE: { character->SetPlayerFlag(NJ_WU_SHOW_DAILY_CHEST, true); diff --git a/dScripts/02_server/Map/njhub/NjWuNPC.h b/dScripts/02_server/Map/njhub/NjWuNPC.h index d0cd750b..f8c52303 100644 --- a/dScripts/02_server/Map/njhub/NjWuNPC.h +++ b/dScripts/02_server/Map/njhub/NjWuNPC.h @@ -2,7 +2,7 @@ #include "AmTemplateSkillVolume.h" class NjWuNPC : public AmTemplateSkillVolume { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; const uint32_t m_MainDragonMissionID = 2040; const std::vector m_SubDragonMissionIDs = { 2064, 2065, 2066, 2067 }; diff --git a/dScripts/BasePropertyServer.cpp b/dScripts/BasePropertyServer.cpp index a182c9c1..7552eeca 100644 --- a/dScripts/BasePropertyServer.cpp +++ b/dScripts/BasePropertyServer.cpp @@ -8,6 +8,8 @@ #include "RenderComponent.h" #include "PropertyManagementComponent.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" void BasePropertyServer::SetGameVariables(Entity* self) { self->SetVar(ClaimMarkerGroup, ""); @@ -97,7 +99,7 @@ void BasePropertyServer::BasePlayerLoaded(Entity* self, Entity* player) { if (missionComponent != nullptr) { missionComponent->Progress( - MissionTaskType::MISSION_TASK_TYPE_VISIT_PROPERTY, + eMissionTaskType::VISIT_PROPERTY, mapID.GetMapID(), mapID.GetCloneID() ); @@ -150,7 +152,7 @@ void BasePropertyServer::PropGuardCheck(Entity* self, Entity* player) { auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr - && missionComponent->GetMissionState(self->GetVar(guardMissionFlag)) != MissionState::MISSION_STATE_COMPLETE) { + && missionComponent->GetMissionState(self->GetVar(guardMissionFlag)) != eMissionState::COMPLETE) { ActivateSpawner(self->GetVar(PropertyMGSpawner)); } } diff --git a/dScripts/BaseSurvivalServer.cpp b/dScripts/BaseSurvivalServer.cpp index 270b6741..3d72628d 100644 --- a/dScripts/BaseSurvivalServer.cpp +++ b/dScripts/BaseSurvivalServer.cpp @@ -4,7 +4,8 @@ #include "EntityManager.h" #include "dZoneManager.h" #include "Player.h" -#include "MissionTaskType.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" #include "MissionComponent.h" #include "Character.h" @@ -361,16 +362,16 @@ void BaseSurvivalServer::GameOver(Entity* self) { // Update all mission progression auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, time, self->GetObjectID(), + missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, time, self->GetObjectID(), self->GetVar(MissionTypeVariable)); for (const auto& survivalMission : missionsToUpdate) { auto* mission = missionComponent->GetMission(survivalMission.first); if (mission != nullptr && (uint32_t)time >= survivalMission.second - && (mission->GetMissionState() == MissionState::MISSION_STATE_ACTIVE - || mission->GetMissionState() == MissionState::MISSION_STATE_COMPLETE_ACTIVE)) { + && (mission->GetMissionState() == eMissionState::ACTIVE + || mission->GetMissionState() == eMissionState::COMPLETE_ACTIVE)) { - mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } } diff --git a/dScripts/BaseWavesServer.cpp b/dScripts/BaseWavesServer.cpp index 8c32f984..ad40a77d 100644 --- a/dScripts/BaseWavesServer.cpp +++ b/dScripts/BaseWavesServer.cpp @@ -4,7 +4,8 @@ #include "EntityManager.h" #include "dZoneManager.h" #include "Player.h" -#include "MissionTaskType.h" +#include "eMissionTaskType.h" +#include "eMissionState.h" #include "MissionComponent.h" #include "Character.h" @@ -373,7 +374,7 @@ void BaseWavesServer::GameOver(Entity* self, bool won) { // Update all mission progression auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, time, self->GetObjectID(), self->GetVar(MissionTypeVariable)); + missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, time, self->GetObjectID(), self->GetVar(MissionTypeVariable)); } StopActivity(self, playerID, wave, time, score); @@ -510,15 +511,15 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3 // Get the mission state auto missionState = missionComponent->GetMissionState(missionID); // For some reason these achievements are not accepted by default, so we accept them here if they arent already. - if (missionState != MissionState::MISSION_STATE_COMPLETE && missionState != MissionState::MISSION_STATE_UNKNOWN) { + if (missionState != eMissionState::COMPLETE && missionState != eMissionState::UNKNOWN) { missionComponent->AcceptMission(missionID); missionState = missionComponent->GetMissionState(missionID); } - if (missionState != MissionState::MISSION_STATE_COMPLETE) { + if (missionState != eMissionState::COMPLETE) { auto mission = missionComponent->GetMission(missionID); if (mission != nullptr) { - mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } } @@ -528,15 +529,15 @@ bool BaseWavesServer::UpdateSpawnedEnemies(Entity* self, LWOOBJID enemyID, uint3 // Get the mission state auto missionState = missionComponent->GetMissionState(missionID); // For some reason these achievements are not accepted by default, so we accept them here if they arent already. - if (missionState != MissionState::MISSION_STATE_COMPLETE && missionState != MissionState::MISSION_STATE_UNKNOWN) { + if (missionState != eMissionState::COMPLETE && missionState != eMissionState::UNKNOWN) { missionComponent->AcceptMission(missionID); missionState = missionComponent->GetMissionState(missionID); } - if (missionState != MissionState::MISSION_STATE_COMPLETE) { + if (missionState != eMissionState::COMPLETE) { auto mission = missionComponent->GetMission(missionID); if (mission != nullptr) { - mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } } @@ -564,14 +565,14 @@ void BaseWavesServer::UpdateMissionForAllPlayers(Entity* self, uint32_t missionI // Get the mission state auto missionState = missionComponent->GetMissionState(missionID); // For some reason these achievements are not accepted by default, so we accept them here if they arent already. - if (missionState != MissionState::MISSION_STATE_COMPLETE && missionState != MissionState::MISSION_STATE_UNKNOWN) { + if (missionState != eMissionState::COMPLETE && missionState != eMissionState::UNKNOWN) { missionComponent->AcceptMission(missionID); missionState = missionComponent->GetMissionState(missionID); } - if (missionState != MissionState::MISSION_STATE_COMPLETE) { + if (missionState != eMissionState::COMPLETE) { auto mission = missionComponent->GetMission(missionID); if (mission != nullptr) { - mission->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + mission->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } } } diff --git a/dScripts/CppScripts.h b/dScripts/CppScripts.h index eb9b7a04..21ff8427 100644 --- a/dScripts/CppScripts.h +++ b/dScripts/CppScripts.h @@ -7,7 +7,7 @@ class User; class Entity; class NiPoint3; -enum class MissionState : int32_t; +enum class eMissionState : int32_t; namespace CppScripts { /** @@ -49,7 +49,7 @@ namespace CppScripts { * * Equivalent to 'function onMissionDialogueOK(self, msg)' */ - virtual void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {}; + virtual void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {}; /** * Invoked when the client or the server invoked an event server-side. @@ -327,7 +327,7 @@ namespace CppScripts { /** * Used by items to tell their owner that they were equipped. - * + * * @param itemOwner The owner of the item * @param itemObjId The items Object ID */ @@ -335,7 +335,7 @@ namespace CppScripts { /** * Used by items to tell their owner that they were unequipped. - * + * * @param itemOwner The owner of the item * @param itemObjId The items Object ID */ diff --git a/dScripts/Darkitect.cpp b/dScripts/Darkitect.cpp index 323d0247..b4364332 100644 --- a/dScripts/Darkitect.cpp +++ b/dScripts/Darkitect.cpp @@ -4,6 +4,7 @@ #include "EntityManager.h" #include "GameMessages.h" #include "Character.h" +#include "eMissionState.h" void Darkitect::Reveal(Entity* self, Entity* player) { const auto playerID = player->GetObjectID(); @@ -24,7 +25,7 @@ void Darkitect::Reveal(Entity* self, Entity* player) { destroyableComponent->SetHealth(1); destroyableComponent->SetImagination(0); - if (missionComponent->GetMissionState(1295) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(1295) == eMissionState::ACTIVE) { character->SetPlayerFlag(1911, true); } diff --git a/dScripts/NPCAddRemoveItem.cpp b/dScripts/NPCAddRemoveItem.cpp index 1985a02b..f1ef8c0d 100644 --- a/dScripts/NPCAddRemoveItem.cpp +++ b/dScripts/NPCAddRemoveItem.cpp @@ -1,8 +1,8 @@ #include "NPCAddRemoveItem.h" #include "InventoryComponent.h" -#include "MissionState.h" +#include "eMissionState.h" -void NPCAddRemoveItem::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void NPCAddRemoveItem::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* inventory = target->GetComponent(); if (inventory == nullptr) return; @@ -11,9 +11,9 @@ void NPCAddRemoveItem::OnMissionDialogueOK(Entity* self, Entity* target, int mis if (missionSetting.first == missionID) { for (const auto& itemSetting : missionSetting.second) { for (const auto& lot : itemSetting.items) { - if (itemSetting.add && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)) { + if (itemSetting.add && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)) { inventory->AddItem(lot, 1, eLootSourceType::LOOT_SOURCE_NONE); - } else if (itemSetting.remove && (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)) { + } else if (itemSetting.remove && (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE)) { inventory->RemoveItem(lot, 1); } } diff --git a/dScripts/NPCAddRemoveItem.h b/dScripts/NPCAddRemoveItem.h index a266f817..73a7f2c9 100644 --- a/dScripts/NPCAddRemoveItem.h +++ b/dScripts/NPCAddRemoveItem.h @@ -12,7 +12,7 @@ struct ItemSetting { */ class NPCAddRemoveItem : public CppScripts::Script { protected: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; virtual std::map> GetSettings(); private: void OnStartup(Entity* self) override; diff --git a/dScripts/NtFactionSpyServer.cpp b/dScripts/NtFactionSpyServer.cpp index ac068a32..684e6a0e 100644 --- a/dScripts/NtFactionSpyServer.cpp +++ b/dScripts/NtFactionSpyServer.cpp @@ -4,6 +4,7 @@ #include "InventoryComponent.h" #include "GameMessages.h" #include "MissionComponent.h" +#include "eMissionState.h" void NtFactionSpyServer::OnStartup(Entity* self) { SetVariables(self); @@ -54,7 +55,7 @@ bool NtFactionSpyServer::IsSpy(Entity* self, Entity* possibleSpy) { auto* character = possibleSpy->GetCharacter(); // A player is a spy if they have the spy mission, have the spy equipment equipped and don't have the spy flag set yet - return missionComponent != nullptr && missionComponent->GetMissionState(spyData.missionID) == MissionState::MISSION_STATE_ACTIVE + return missionComponent != nullptr && missionComponent->GetMissionState(spyData.missionID) == eMissionState::ACTIVE && inventoryComponent != nullptr && inventoryComponent->IsEquipped(spyData.itemID) && character != nullptr && !character->GetPlayerFlag(spyData.flagID); } diff --git a/dScripts/ai/AG/ActSharkPlayerDeathTrigger.cpp b/dScripts/ai/AG/ActSharkPlayerDeathTrigger.cpp index 420fc4d7..49fb6b87 100644 --- a/dScripts/ai/AG/ActSharkPlayerDeathTrigger.cpp +++ b/dScripts/ai/AG/ActSharkPlayerDeathTrigger.cpp @@ -1,6 +1,6 @@ #include "ActSharkPlayerDeathTrigger.h" #include "MissionComponent.h" -#include "MissionTaskType.h" +#include "eMissionTaskType.h" #include "Entity.h" void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, @@ -9,7 +9,7 @@ void ActSharkPlayerDeathTrigger::OnFireEventServerSide(Entity* self, Entity* sen auto missionComponent = sender->GetComponent(); if (!missionComponent) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, 8419); + missionComponent->Progress(eMissionTaskType::SCRIPT, 8419); if (sender->GetIsDead() || !sender->GetPlayerReadyForUpdates()) return; //Don't kill already dead players or players not ready diff --git a/dScripts/ai/FV/FvFreeGfNinjas.cpp b/dScripts/ai/FV/FvFreeGfNinjas.cpp index 1751b6a7..d690a6f7 100644 --- a/dScripts/ai/FV/FvFreeGfNinjas.cpp +++ b/dScripts/ai/FV/FvFreeGfNinjas.cpp @@ -1,9 +1,10 @@ #include "FvFreeGfNinjas.h" #include "Character.h" #include "MissionComponent.h" +#include "eMissionState.h" -void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { - if (missionID == 705 && missionState == MissionState::MISSION_STATE_AVAILABLE) { +void FvFreeGfNinjas::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { + if (missionID == 705 && missionState == eMissionState::AVAILABLE) { auto* missionComponent = target->GetComponent(); if (missionComponent == nullptr) return; @@ -29,7 +30,7 @@ void FvFreeGfNinjas::OnUse(Entity* self, Entity* user) { if (missionComponent == nullptr) return; - if (missionComponent->GetMissionState(705) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(705) == eMissionState::ACTIVE) { auto* character = user->GetCharacter(); if (character != nullptr) character->SetPlayerFlag(68, true); diff --git a/dScripts/ai/FV/FvFreeGfNinjas.h b/dScripts/ai/FV/FvFreeGfNinjas.h index c7e4876e..01b0b6bd 100644 --- a/dScripts/ai/FV/FvFreeGfNinjas.h +++ b/dScripts/ai/FV/FvFreeGfNinjas.h @@ -3,6 +3,6 @@ class FvFreeGfNinjas : public CppScripts::Script { public: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; void OnUse(Entity* self, Entity* user) override; }; diff --git a/dScripts/ai/GENERAL/LegoDieRoll.cpp b/dScripts/ai/GENERAL/LegoDieRoll.cpp index e86550f9..89819271 100644 --- a/dScripts/ai/GENERAL/LegoDieRoll.cpp +++ b/dScripts/ai/GENERAL/LegoDieRoll.cpp @@ -2,6 +2,7 @@ #include "Entity.h" #include "GameMessages.h" #include "MissionComponent.h" +#include "eMissionState.h" void LegoDieRoll::OnStartup(Entity* self) { self->AddTimer("DoneRolling", 10.0f); @@ -39,7 +40,7 @@ void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) { if (missionComponent != nullptr) { const auto rollMissionState = missionComponent->GetMissionState(756); - if (rollMissionState == MissionState::MISSION_STATE_ACTIVE) { + if (rollMissionState == eMissionState::ACTIVE) { missionComponent->ForceProgress(756, 1103, 1); } } diff --git a/dScripts/ai/GF/GfJailkeepMission.cpp b/dScripts/ai/GF/GfJailkeepMission.cpp index eaa8c73d..b8d4cd30 100644 --- a/dScripts/ai/GF/GfJailkeepMission.cpp +++ b/dScripts/ai/GF/GfJailkeepMission.cpp @@ -1,18 +1,19 @@ #include "GfJailkeepMission.h" #include "MissionComponent.h" #include "Character.h" +#include "eMissionState.h" -void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void GfJailkeepMission::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* missionComponent = target->GetComponent(); if (missionComponent == nullptr) return; - if (missionID == 385 && missionState == MissionState::MISSION_STATE_AVAILABLE) { + if (missionID == 385 && missionState == eMissionState::AVAILABLE) { missionComponent->AcceptMission(386, true); missionComponent->AcceptMission(387, true); missionComponent->AcceptMission(388, true); missionComponent->AcceptMission(390, true); - } else if (missionID == 385 && missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + } else if (missionID == 385 && missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { auto* character = target->GetCharacter(); if (character != nullptr && character->GetPlayerFlag(68)) { missionComponent->AcceptMission(701); @@ -28,7 +29,7 @@ void GfJailkeepMission::OnUse(Entity* self, Entity* user) { if (missionComponent == nullptr) return; - if (missionComponent->GetMissionState(385) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent->GetMissionState(385) == eMissionState::ACTIVE) { missionComponent->AcceptMission(386, true); missionComponent->AcceptMission(387, true); missionComponent->AcceptMission(388, true); diff --git a/dScripts/ai/GF/GfJailkeepMission.h b/dScripts/ai/GF/GfJailkeepMission.h index a120d29b..651a6e1b 100644 --- a/dScripts/ai/GF/GfJailkeepMission.h +++ b/dScripts/ai/GF/GfJailkeepMission.h @@ -5,5 +5,5 @@ class GfJailkeepMission final : public CppScripts::Script { public: void OnUse(Entity* self, Entity* user) override; - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; }; diff --git a/dScripts/ai/GF/PetDigBuild.cpp b/dScripts/ai/GF/PetDigBuild.cpp index 32e5b2e3..2c3da9fc 100644 --- a/dScripts/ai/GF/PetDigBuild.cpp +++ b/dScripts/ai/GF/PetDigBuild.cpp @@ -2,6 +2,7 @@ #include "EntityManager.h" #include "EntityInfo.h" #include "MissionComponent.h" +#include "eMissionState.h" void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) { auto flagNumber = self->GetVar(u"flagNum"); @@ -22,7 +23,7 @@ void PetDigBuild::OnRebuildComplete(Entity* self, Entity* target) { info.settings.push_back(new LDFData(u"groupID", u"Flag" + flagNumber)); } else { auto* missionComponent = target->GetComponent(); - if (missionComponent != nullptr && missionComponent->GetMissionState(746) == MissionState::MISSION_STATE_ACTIVE) { + if (missionComponent != nullptr && missionComponent->GetMissionState(746) == eMissionState::ACTIVE) { info.lot = 9307; // Special Captain Jack treasure that drops a mission item } else { info.lot = 3495; // Normal AG treasure diff --git a/dScripts/ai/GF/PirateRep.cpp b/dScripts/ai/GF/PirateRep.cpp index 81d69672..ccfa7af6 100644 --- a/dScripts/ai/GF/PirateRep.cpp +++ b/dScripts/ai/GF/PirateRep.cpp @@ -1,10 +1,10 @@ #include "PirateRep.h" #include "Character.h" -#include "MissionState.h" +#include "eMissionState.h" #include "Entity.h" -void PirateRep::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { - if (missionID == m_PirateRepMissionID && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) { +void PirateRep::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { + if (missionID == m_PirateRepMissionID && missionState >= eMissionState::READY_TO_COMPLETE) { auto* character = target->GetCharacter(); if (character) { character->SetPlayerFlag(ePlayerFlags::GF_PIRATE_REP, true); diff --git a/dScripts/ai/GF/PirateRep.h b/dScripts/ai/GF/PirateRep.h index 8fc82c5e..754971be 100644 --- a/dScripts/ai/GF/PirateRep.h +++ b/dScripts/ai/GF/PirateRep.h @@ -3,7 +3,7 @@ class PirateRep : public CppScripts::Script { public: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; private: const int m_PirateRepMissionID = 301; }; diff --git a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp index f9146ec4..2948ae3d 100644 --- a/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp +++ b/dScripts/ai/MINIGAME/SG_GF/SERVER/SGCannon.cpp @@ -13,6 +13,7 @@ #include "MissionComponent.h" #include "Loot.h" #include "InventoryComponent.h" +#include "eMissionTaskType.h" void SGCannon::OnStartup(Entity* self) { Game::logger->Log("SGCannon", "OnStartup"); @@ -554,9 +555,9 @@ void SGCannon::StopGame(Entity* self, bool cancel) { auto* missionComponent = player->GetComponent(); if (missionComponent != nullptr) { - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar(TotalScoreVariable), self->GetObjectID(), "performact_score"); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar(MaxStreakVariable), self->GetObjectID(), "performact_streak"); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_CannonLot, 0, "", self->GetVar(TotalScoreVariable)); + missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar(TotalScoreVariable), self->GetObjectID(), "performact_score"); + missionComponent->Progress(eMissionTaskType::PERFORM_ACTIVITY, self->GetVar(MaxStreakVariable), self->GetObjectID(), "performact_streak"); + missionComponent->Progress(eMissionTaskType::ACTIVITY, m_CannonLot, 0, "", self->GetVar(TotalScoreVariable)); } LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar(TotalScoreVariable)); @@ -666,7 +667,7 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time auto missionComponent = player->GetComponent(); if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, spawnInfo.lot, self->GetObjectID()); + missionComponent->Progress(eMissionTaskType::SMASH, spawnInfo.lot, self->GetObjectID()); } void SGCannon::UpdateStreak(Entity* self) { diff --git a/dScripts/ai/NP/NpcNpSpacemanBob.cpp b/dScripts/ai/NP/NpcNpSpacemanBob.cpp index 5157e488..d242d08f 100644 --- a/dScripts/ai/NP/NpcNpSpacemanBob.cpp +++ b/dScripts/ai/NP/NpcNpSpacemanBob.cpp @@ -1,9 +1,10 @@ #include "NpcNpSpacemanBob.h" #include "DestroyableComponent.h" #include "MissionComponent.h" +#include "eMissionState.h" -void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { - if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE && missionID == 173) { +void NpcNpSpacemanBob::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { + if (missionState == eMissionState::READY_TO_COMPLETE && missionID == 173) { DestroyableComponent* destroyable = static_cast(target->GetComponent(COMPONENT_TYPE_DESTROYABLE)); destroyable->SetImagination(6); MissionComponent* mission = static_cast(target->GetComponent(COMPONENT_TYPE_MISSION)); diff --git a/dScripts/ai/NP/NpcNpSpacemanBob.h b/dScripts/ai/NP/NpcNpSpacemanBob.h index 08cc850d..84c59deb 100644 --- a/dScripts/ai/NP/NpcNpSpacemanBob.h +++ b/dScripts/ai/NP/NpcNpSpacemanBob.h @@ -4,6 +4,6 @@ class NpcNpSpacemanBob : public CppScripts::Script { public: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState); + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState); }; diff --git a/dScripts/ai/NS/NsConcertInstrument.cpp b/dScripts/ai/NS/NsConcertInstrument.cpp index bba3986d..c7478a05 100644 --- a/dScripts/ai/NS/NsConcertInstrument.cpp +++ b/dScripts/ai/NS/NsConcertInstrument.cpp @@ -7,6 +7,8 @@ #include "SoundTriggerComponent.h" #include "InventoryComponent.h" #include "MissionComponent.h" +#include "eMissionState.h" +#include "eMissionTaskType.h" // Constants are at the bottom @@ -146,8 +148,8 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) { // Player might be null if they left if (player != nullptr) { auto* missions = player->GetComponent(); - if (missions != nullptr && missions->GetMissionState(176) == MissionState::MISSION_STATE_ACTIVE) { - missions->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT()); + if (missions != nullptr && missions->GetMissionState(176) == eMissionState::ACTIVE) { + missions->Progress(eMissionTaskType::SCRIPT, self->GetLOT()); } GameMessages::SendEndCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS, 1.0f); diff --git a/dScripts/ai/NS/NsJohnnyMissionServer.cpp b/dScripts/ai/NS/NsJohnnyMissionServer.cpp index 2d9ae93c..107d3c44 100644 --- a/dScripts/ai/NS/NsJohnnyMissionServer.cpp +++ b/dScripts/ai/NS/NsJohnnyMissionServer.cpp @@ -1,8 +1,9 @@ #include "NsJohnnyMissionServer.h" #include "MissionComponent.h" +#include "eMissionState.h" -void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { - if (missionID == 773 && missionState <= MissionState::MISSION_STATE_ACTIVE) { +void NsJohnnyMissionServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { + if (missionID == 773 && missionState <= eMissionState::ACTIVE) { auto* missionComponent = target->GetComponent(); if (missionComponent != nullptr) { missionComponent->AcceptMission(774); diff --git a/dScripts/ai/NS/NsJohnnyMissionServer.h b/dScripts/ai/NS/NsJohnnyMissionServer.h index 8de39afa..c37ea06c 100644 --- a/dScripts/ai/NS/NsJohnnyMissionServer.h +++ b/dScripts/ai/NS/NsJohnnyMissionServer.h @@ -2,5 +2,5 @@ #include "CppScripts.h" class NsJohnnyMissionServer : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; }; diff --git a/dScripts/ai/NS/NsModularBuild.cpp b/dScripts/ai/NS/NsModularBuild.cpp index 065d061e..2e00aa19 100644 --- a/dScripts/ai/NS/NsModularBuild.cpp +++ b/dScripts/ai/NS/NsModularBuild.cpp @@ -1,11 +1,12 @@ #include "NsModularBuild.h" #include "MissionComponent.h" +#include "eMissionState.h" void NsModularBuild::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector modules) { if (bCompleted) { MissionComponent* mission = static_cast(player->GetComponent(COMPONENT_TYPE_MISSION)); - if (mission->GetMissionState(m_MissionNum) == MissionState::MISSION_STATE_ACTIVE) { + if (mission->GetMissionState(m_MissionNum) == eMissionState::ACTIVE) { for (LOT mod : modules) { if (mod == 9516 || mod == 9517 || mod == 9518) { mission->ForceProgress(m_MissionNum, 1178, 1); diff --git a/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp b/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp index 51f76a27..853da92d 100644 --- a/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp +++ b/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp @@ -5,18 +5,19 @@ #include "InventoryComponent.h" #include "MissionComponent.h" #include "Item.h" +#include "eMissionState.h" -void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* character = target->GetCharacter(); auto* missionComponent = target->GetComponent(); auto* inventoryComponent = target->GetComponent(); const auto state = missionComponent->GetMissionState(320); - if (missionID == 768 && missionState == MissionState::MISSION_STATE_AVAILABLE) { + if (missionID == 768 && missionState == eMissionState::AVAILABLE) { if (!character->GetPlayerFlag(71)) { // TODO: Cinematic "MissionCam" } - } else if (missionID == 768 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) { + } else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) { //remove the inventory items for (int item : gearSets) { auto* id = inventoryComponent->FindItemByLot(item); @@ -27,8 +28,8 @@ void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionI } } } else if ( - (missionID == 320 && state == MissionState::MISSION_STATE_AVAILABLE) /*|| - (state == MissionState::MISSION_STATE_COMPLETE && missionID == 891 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE)*/ + (missionID == 320 && state == eMissionState::AVAILABLE) /*|| + (state == eMissionState::COMPLETE && missionID == 891 && missionState == eMissionState::READY_TO_COMPLETE)*/ ) { //GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress()); diff --git a/dScripts/ai/PROPERTY/AG/AgPropGuard.h b/dScripts/ai/PROPERTY/AG/AgPropGuard.h index f68573dd..2b41f006 100644 --- a/dScripts/ai/PROPERTY/AG/AgPropGuard.h +++ b/dScripts/ai/PROPERTY/AG/AgPropGuard.h @@ -4,7 +4,7 @@ class AgPropGuard final : public CppScripts::Script { public: - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; private: std::vector gearSets = { 14359,14321,14353,14315 }; diff --git a/dScripts/ai/PROPERTY/AgPropguards.cpp b/dScripts/ai/PROPERTY/AgPropguards.cpp index 2bcfcf94..9fc6010a 100644 --- a/dScripts/ai/PROPERTY/AgPropguards.cpp +++ b/dScripts/ai/PROPERTY/AgPropguards.cpp @@ -3,9 +3,9 @@ #include "GameMessages.h" #include "EntityManager.h" #include "dZoneManager.h" -#include "MissionState.h" +#include "eMissionState.h" -void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) { +void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) { auto* character = target->GetCharacter(); if (character == nullptr) return; @@ -14,11 +14,11 @@ void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int mission if (flag == 0) return; - if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_ACTIVE) + if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::ACTIVE) && !character->GetPlayerFlag(flag)) { // If the player just started the mission, play a cinematic highlighting the target GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress()); - } else if (missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) { + } else if (missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) { // Makes the guard disappear once the mission has been completed const auto zoneControlID = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(); GameMessages::SendNotifyClientObject(zoneControlID, u"GuardChat", 0, 0, self->GetObjectID(), diff --git a/dScripts/ai/PROPERTY/AgPropguards.h b/dScripts/ai/PROPERTY/AgPropguards.h index 511b7b6a..25701f86 100644 --- a/dScripts/ai/PROPERTY/AgPropguards.h +++ b/dScripts/ai/PROPERTY/AgPropguards.h @@ -2,7 +2,7 @@ #include "CppScripts.h" class AgPropguards : public CppScripts::Script { - void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) override; + void OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) override; private: static uint32_t GetFlagForMission(uint32_t missionID); }; diff --git a/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp b/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp index 32dbf619..f69a3eb6 100644 --- a/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp +++ b/dScripts/ai/RACING/OBJECTS/FvRaceSmashEggImagineServer.cpp @@ -3,8 +3,9 @@ #include "DestroyableComponent.h" #include "EntityManager.h" #include "PossessableComponent.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) { if (killer != nullptr) { @@ -29,8 +30,8 @@ void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) { } if (missionComponent == nullptr) return; // Dragon eggs have their own smash server so we handle mission progression for them here. - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES); - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE); + missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES); + missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE); } } diff --git a/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp b/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp index a35007b4..6a29f9a8 100644 --- a/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp +++ b/dScripts/ai/RACING/OBJECTS/RaceImagineCrateServer.cpp @@ -3,9 +3,10 @@ #include "EntityManager.h" #include "PossessableComponent.h" #include "RaceImagineCrateServer.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" #include "MissionComponent.h" #include "SkillComponent.h" +#include "eMissionTaskType.h" void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) { if (self->GetVar(u"bIsDead")) { @@ -49,7 +50,7 @@ void RaceImagineCrateServer::OnDie(Entity* self, Entity* killer) { // Progress racing smashable missions if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES); + missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES); } } } diff --git a/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp b/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp index 9bdd0813..92a50873 100644 --- a/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp +++ b/dScripts/ai/RACING/OBJECTS/RaceImaginePowerup.cpp @@ -2,8 +2,9 @@ #include "EntityManager.h" #include "PossessorComponent.h" #include "RaceImaginePowerup.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { @@ -31,6 +32,6 @@ void RaceImaginePowerup::OnFireEventServerSide(Entity* self, Entity* sender, std auto* missionComponent = sender->GetComponent(); if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_COLLECT_IMAGINATION); + missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::COLLECT_IMAGINATION); } } diff --git a/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp b/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp index d0dc3d78..295f38ee 100644 --- a/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp +++ b/dScripts/ai/RACING/OBJECTS/RaceSmashServer.cpp @@ -2,8 +2,9 @@ #include "EntityManager.h" #include "PossessableComponent.h" #include "RaceSmashServer.h" -#include "RacingTaskParam.h" +#include "eRacingTaskParam.h" #include "MissionComponent.h" +#include "eMissionTaskType.h" void RaceSmashServer::OnDie(Entity* self, Entity* killer) { // Crate is smashed by the car @@ -22,9 +23,9 @@ void RaceSmashServer::OnDie(Entity* self, Entity* killer) { // Progress racing smashable missions if (missionComponent == nullptr) return; - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, 0, (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASHABLES); + missionComponent->Progress(eMissionTaskType::RACING, 0, (LWOOBJID)eRacingTaskParam::SMASHABLES); // Progress missions that ask us to smash a specific smashable. - missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_RACING, self->GetLOT(), (LWOOBJID)RacingTaskParam::RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE); + missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), (LWOOBJID)eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE); } } }