Merge pull request #963 from DarkflameUniverse/enum-cleanup

cleanup enums to make them more consistent style wise
This commit is contained in:
Aaron Kimbrell 2023-01-24 16:38:41 -06:00 committed by GitHub
commit ac5f08f601
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
134 changed files with 901 additions and 808 deletions

View File

@ -6,3 +6,6 @@
# convert to unix line endings
72477e01e2711e0f61cdb192ee266e5e21b8846f
# enum cleanup
faf42d2f8cf432df2993b031f079b0b8c6d7dbe7

View File

@ -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<PlayerData> 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<AddFriendResponseCode>(packet->data[0x14]);
eAddFriendResponseCode clientResponseCode = static_cast<eAddFriendResponseCode>(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<uint8_t>(responseCode != AddFriendResponseType::ACCEPTED ? isBestFriendsAlready : sender->sysAddr != UNASSIGNED_SYSTEM_ADDRESS);
bitStream.Write<uint8_t>(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

View File

@ -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);
};

View File

@ -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
};

View File

@ -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

View File

@ -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__

View File

@ -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

View File

@ -1,42 +0,0 @@
#pragma once
#include <cstdint>
/**
* 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,
};

View File

@ -1,20 +0,0 @@
#pragma once
#include <cstdint>
enum class RacingTaskParam : int32_t {
RACING_TASK_PARAM_FINISH_WITH_PLACEMENT = 1, //<! A task param for finishing with a specific placement.
RACING_TASK_PARAM_LAP_TIME = 2, //<! A task param for finishing with a specific lap time.
RACING_TASK_PARAM_TOTAL_TRACK_TIME = 3, //<! A task param for finishing with a specific track time.
RACING_TASK_PARAM_COMPLETE_ANY_RACING_TASK = 4, //<! A task param for completing a racing task.
RACING_TASK_PARAM_COMPLETE_TRACK_TASKS = 5, //<! A task param for completing a task for a specific track.
RACING_TASK_PARAM_MODULAR_BUILDING = 6, //<! A task param for modular building with racing builds.
RACING_TASK_PARAM_SAFE_DRIVER = 10, //<! A task param for completing a race without smashing.
RACING_TASK_PARAM_SMASHABLES = 11, //<! A task param for smashing entities during a race.
RACING_TASK_PARAM_COLLECT_IMAGINATION = 12, //<! A task param for collecting imagination during a race.
RACING_TASK_PARAM_COMPETED_IN_RACE = 13, //<! A task param for competing in a race.
RACING_TASK_PARAM_WIN_RACE_IN_WORLD = 14, //<! A task param for winning a race in a specific world.
RACING_TASK_PARAM_FIRST_PLACE_MULTIPLE_TRACKS = 15, //<! A task param for finishing in first place on multiple tracks.
RACING_TASK_PARAM_LAST_PLACE_FINISH = 16, //<! A task param for finishing in last place.
RACING_TASK_PARAM_SMASH_SPECIFIC_SMASHABLE = 17 //<! A task param for smashing dragon eggs during a race.
};

View File

@ -1,11 +1,11 @@
#pragma once
#ifndef __ADDFRIENDRESPONSECODE__H__
#define __ADDFRIENDRESPONSECODE__H__
#ifndef __EADDFRIENDRESPONSECODE__H__
#define __EADDFRIENDRESPONSECODE__H__
#include <cstdint>
enum class AddFriendResponseCode : uint8_t {
enum class eAddFriendResponseCode : uint8_t {
ACCEPTED = 0,
REJECTED,
BUSY,

View File

@ -1,11 +1,11 @@
#pragma once
#ifndef __ADDFRIENDRESPONSETYPE__H__
#define __ADDFRIENDRESPONSETYPE__H__
#ifndef __EADDFRIENDRESPONSETYPE__H__
#define __EADDFRIENDRESPONSETYPE__H__
#include <cstdint>
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__

View File

@ -7,8 +7,8 @@
enum class eBubbleType : uint32_t {
DEFAULT = 0,
ENERGY = 1,
SKUNK = 2,
ENERGY,
SKUNK
};
#endif //!__EBUBBLETYPE__H__

View File

@ -0,0 +1,41 @@
#ifndef __EHELPTYPE__H__
#define __EHELPTYPE__H__
#include <cstdint>
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__

View File

@ -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__

View File

@ -6,31 +6,31 @@
#include <cstdint>
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__

View File

@ -0,0 +1,12 @@
#pragma once
#ifndef __EMISSIONLOCKSTATE__H__
#define __EMISSIONLOCKSTATE__H__
enum class eMissionLockState : int {
LOCKED,
NEW,
UNLOCKED,
};
#endif //!__EMISSIONLOCKSTATE__H__

View File

@ -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__

View File

@ -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__

View File

@ -0,0 +1,13 @@
#ifndef __EPACKAGETYPE__H__
#define __EPACKAGETYPE__H__
enum class ePackageType {
INVALID = -1,
ITEM,
BRICKS,
MODELS,
CAR_MODELS
};
#endif //!__EPACKAGETYPE__H__

View File

@ -0,0 +1,46 @@
#pragma once
#include <cstdint>
#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__

View File

@ -0,0 +1,25 @@
#pragma once
#ifndef __ERACINGTASKPARAM__H__
#define __ERACINGTASKPARAM__H__
#include <cstdint>
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__

View File

@ -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<PermissionMap>(res->getUInt64(5));
m_PermissionMap = static_cast<ePermissionMap>(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<PermissionMap>(res->getUInt64(5));
m_PermissionMap = static_cast<ePermissionMap>(res->getUInt64(5));
}
delete res;
@ -423,7 +425,7 @@ void Character::SetPlayerFlag(const uint32_t flagId, const bool value) {
auto* missionComponent = player->GetComponent<MissionComponent>();
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<uint64_t>(m_PermissionMap) & static_cast<uint64_t>(permission)) != 0;
}

View File

@ -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

View File

@ -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<MissionComponent>();
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<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_POWERUP, skill.skillID);
missionComponent->Progress(eMissionTaskType::POWERUP, skill.skillID);
}
}
} else {

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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);
}
}
}

View File

@ -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<int32_t>(count));
missionComponent->Progress(eMissionTaskType::GATHER, lot, LWOOBJID_EMPTY, "", -static_cast<int32_t>(count));
}
}
}
@ -841,9 +842,9 @@ void InventoryComponent::EquipItem(Item* item, const bool skipChecks) {
const auto type = static_cast<eItemType>(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<ItemSetPassiveAbilityID>& passiveIDs, int32_t equipmentRequirement) const {
bool InventoryComponent::HasAnyPassive(const std::vector<eItemSetPassiveAbilityID>& 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<ItemSetPassiveAbilityID>(set->GetID())) != passiveIDs.end()) {
if (std::find(passiveIDs.begin(), passiveIDs.end(), static_cast<eItemSetPassiveAbilityID>(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<uint32_t> 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.

View File

@ -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<ItemSetPassiveAbilityID>& passiveIDs, int32_t equipmentRequirement) const;
bool HasAnyPassive(const std::vector<eItemSetPassiveAbilityID>& 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);

View File

@ -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<MissionTaskType>(taskType)) continue;
if (element->GetType() != static_cast<eMissionTaskType>(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<MissionTaskType>(taskType) || !element->InAllTargets(value)) continue;
if (element->GetType() != static_cast<eMissionTaskType>(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<uint32_t>& MissionComponent::QueryAchievements(MissionTaskType type, int32_t value, const std::string targets) {
const std::vector<uint32_t>& 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;
}

View File

@ -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<uint32_t>& QueryAchievements(MissionTaskType type, int32_t value, const std::string targets);
static const std::vector<uint32_t>& 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

View File

@ -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);

View File

@ -21,6 +21,8 @@
#include "dChatFilter.h"
#include "Database.h"
#include "EntityInfo.h"
#include "eMissionTaskType.h"
std::unordered_map<LOT, PetComponent::PetPuzzleData> PetComponent::buildCache{};
std::unordered_map<LWOOBJID, LWOOBJID> PetComponent::currentActivities{};
@ -602,7 +604,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
auto* missionComponent = tamer->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_PET_TAMING, m_Parent->GetLOT());
missionComponent->Progress(eMissionTaskType::PET_TAMING, m_Parent->GetLOT());
}
SetStatus(1);

View File

@ -18,6 +18,7 @@
#include "RocketLaunchpadControlComponent.h"
#include "PropertyEntranceComponent.h"
#include "InventoryComponent.h"
#include "eMissionTaskType.h"
#include <vector>
#include "CppScripts.h"
@ -404,7 +405,7 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
});
// Progress place model missions
auto missionComponent = entity->GetComponent<MissionComponent>();
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) {

View File

@ -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<CharacterComponent>();
if (characterComponent != nullptr) {

View File

@ -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<MissionComponent>();
if (missionComponent) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityId);
if (missionComponent) missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityId);
}
}
} else{
auto* missionComponent = builder->GetComponent<MissionComponent>();
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);
}

View File

@ -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<MissionComponent>();
if (missionComponent) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_ActivityInfo.ActivityID);
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityInfo.ActivityID);
}
// First, get the activity data

View File

@ -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<MissionComponent>();
if (comp) {
comp->Progress(MissionTaskType::MISSION_TASK_TYPE_SKILL, startSkill.skillID);
comp->Progress(eMissionTaskType::USE_SKILL, startSkill.skillID);
}
CDSkillBehaviorTable* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior");

View File

@ -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 <sstream>
#include <future>
@ -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<MissionComponent*>(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<MissionComponent>();
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<MissionComponent*>(entity->GetComponent(COMPONENT_TYPE_MISSION));
if (missions != nullptr) {
missions->Progress(MissionTaskType::MISSION_TASK_TYPE_FOOD, itemLot);
missions->Progress(eMissionTaskType::USE_ITEM, itemLot);
}
}

View File

@ -231,41 +231,42 @@ eInventoryType Inventory::FindInventoryTypeForLot(const LOT lot) {
const auto itemType = static_cast<eItemType>(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;
}

View File

@ -76,7 +76,7 @@ Item::Item(
const auto type = static_cast<eItemType>(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<eItemType>(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);

View File

@ -6,6 +6,7 @@
#include "CDClientDatabase.h"
#include "Game.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include <algorithm>
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());
}

View File

@ -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<ItemSetPassiveAbilityID>(m_ItemSet->GetID());
const auto id = static_cast<eItemSetPassiveAbilityID>(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> ItemSetPassiveAbility::FindAbilities(uint32_t itemSetID, Entity* parent, ItemSet* itemSet) {
std::vector<ItemSetPassiveAbility> abilities;
switch (static_cast<ItemSetPassiveAbilityID>(itemSetID)) {
switch (static_cast<eItemSetPassiveAbilityID>(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<ItemSetPassiveAbilityID>(m_ItemSet->GetID());
const auto id = static_cast<eItemSetPassiveAbilityID>(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;

View File

@ -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<CDMissionsTable>("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<MissionState>(std::stoul(element->Attribute("state")));
m_State = static_cast<eMissionState>(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<uint32_t> 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<MissionTask*> 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>();
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<CDMissionEmailTable>("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<CharacterComponent>();
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<int>(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
}

View File

@ -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

View File

@ -106,8 +106,8 @@ bool PrerequisiteExpression::Execute(const std::unordered_map<uint32_t, Mission*
if (this->sub != 0) {
// Special case for one Wisp Lee repeatable mission.
a = mission->GetClientInfo().id == 1883 ?
mission->GetMissionState() == static_cast<MissionState>(this->sub) :
mission->GetMissionState() >= static_cast<MissionState>(this->sub);
mission->GetMissionState() == static_cast<eMissionState>(this->sub) :
mission->GetMissionState() >= static_cast<eMissionState>(this->sub);
} else if (mission->IsComplete()) {
a = true;
}

View File

@ -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<MissionTaskType>(info->taskType);
eMissionTaskType MissionTask::GetType() const {
return static_cast<eMissionTaskType>(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<LDFBaseData*> 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;

View File

@ -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)

View File

@ -13,6 +13,8 @@
#include "GeneralUtils.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
LootGenerator::LootGenerator() {
CDLootTableTable* lootTableTable = CDClientManager::Instance()->GetTable<CDLootTableTable>("LootTable");
@ -186,13 +188,13 @@ std::unordered_map<LOT, int32_t> 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"
}

View File

@ -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<MissionComponent>();
if (missionCompoent != nullptr) {
missionCompoent->Progress(MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION, itemLOT, LWOOBJID_EMPTY, "", -attachmentCount);
missionCompoent->Progress(eMissionTaskType::GATHER, itemLOT, LWOOBJID_EMPTY, "", -attachmentCount);
}
}

View File

@ -12,7 +12,7 @@
#include "LevelProgressionComponent.h"
#include "DestroyableComponent.h"
#include "GameMessages.h"
#include "eMissionState.h"
std::map<uint32_t, Precondition*> 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:

View File

@ -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;
}

View File

@ -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,

View File

@ -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<MissionComponent>();
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<RenderComponent>();
if (renderComponent != nullptr)

View File

@ -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<MissionComponent>();
if (missionComponent == nullptr) return;
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, 14718);
missionComponent->Progress(eMissionTaskType::SMASH, 14718);
CollectSample(self, sender->GetObjectID());
sender->ScheduleKillAfterUpdate();
}

View File

@ -3,6 +3,8 @@
#include "ScriptedActivityComponent.h"
#include "GameMessages.h"
#include "LeaderboardManager.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "MissionComponent.h"
#include <ctime>
@ -89,7 +91,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
auto* missionComponent = sender->GetComponent<MissionComponent>();
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");
}

View File

@ -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);
}
}

View File

@ -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;
};

View File

@ -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) {

View File

@ -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);
};

View File

@ -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<InventoryComponent*>(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<MissionComponent*>(target->GetComponent(COMPONENT_TYPE_MISSION));
missionComponent->CompleteMission(mailAchievement, true);
}

View File

@ -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

View File

@ -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<InventoryComponent>();
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);
}
}

View File

@ -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;
};

View File

@ -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;
}

View File

@ -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);
};

View File

@ -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<InventoryComponent*>(target->GetComponent(COMPONENT_TYPE_INVENTORY));
if (!inv) return;

View File

@ -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

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
};

View File

@ -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<InventoryComponent>();
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);

View File

@ -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<MissionComponent>();
if (casterMissionComponent != nullptr) {
for (const auto missionID : m_missions) {
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
casterMissionComponent->ForceProgressTaskType(missionID, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
}
}

View File

@ -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<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT),
static_cast<uint32_t>(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<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT),
static_cast<uint32_t>(eMissionTaskType::SCRIPT),
self->GetLOT());
}
}

View File

@ -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<MissionComponent>();
if (missionComponent != nullptr) {
for (const auto mission : achievementIDs)
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
missionComponent->ForceProgressTaskType(mission, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
if (mission1 && missionComponent->GetMissionState(mission1) == MissionState::MISSION_STATE_ACTIVE)
missionComponent->ForceProgressTaskType(mission1, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
if (mission1 && missionComponent->GetMissionState(mission1) == eMissionState::ACTIVE)
missionComponent->ForceProgressTaskType(mission1, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
if (mission2 && missionComponent->GetMissionState(mission2) == MissionState::MISSION_STATE_ACTIVE)
missionComponent->ForceProgressTaskType(mission2, static_cast<uint32_t>(MissionTaskType::MISSION_TASK_TYPE_SCRIPT), 1);
if (mission2 && missionComponent->GetMissionState(mission2) == eMissionState::ACTIVE)
missionComponent->ForceProgressTaskType(mission2, static_cast<uint32_t>(eMissionTaskType::SCRIPT), 1);
}
}
}

View File

@ -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<MissionComponent>();
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());
}

View File

@ -5,6 +5,7 @@
#include "Character.h"
#include "PetComponent.h"
#include "User.h"
#include "eMissionState.h"
std::vector<LWOOBJID> 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<int32_t>(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<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent != nullptr && missionComponent->GetMissionState(digInfo.requiredMission) < eMissionState::ACTIVE) {
return;
}
}

View File

@ -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<MissionComponent>();
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());
}

View File

@ -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;
}

View File

@ -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<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}

View File

@ -1,6 +1,7 @@
#include "NtDukeServer.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<float_t>(m_SpyProximityVariable, 35.0f);
@ -19,7 +20,7 @@ void NtDukeServer::SetVariables(Entity* self) {
self->SetVar<std::vector<LWOOBJID>>(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<MissionComponent>();
@ -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);
}
}

View File

@ -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;
};

View File

@ -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;
}

View File

@ -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<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}

View File

@ -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<PhantomPhysicsComponent>();
@ -38,6 +39,6 @@ void NtSentinelWalkwayServer::OnProximityUpdate(Entity* self, Entity* entering,
auto* missionComponent = player->GetComponent<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
}

View File

@ -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<InventoryComponent>();
for (const auto& alienPartLot : m_AlienPartLots) {
inventoryComponent->RemoveItem(alienPartLot, 1);

View File

@ -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<LOT> m_AlienPartLots = { 12479, 12480, 12481 };
};

View File

@ -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<MissionComponent>();
if (missionComponent != nullptr) {
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SCRIPT, self->GetLOT());
missionComponent->Progress(eMissionTaskType::SCRIPT, self->GetLOT());
}
auto* skillComponent = player->GetComponent<SkillComponent>();

View File

@ -2,6 +2,7 @@
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void SpawnGryphonServer::SetVariables(Entity* self) {
self->SetVar<LOT>(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;

View File

@ -6,6 +6,7 @@
#include "dZoneManager.h"
#include "RenderComponent.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void ZoneAgProperty::SetGameVariables(Entity* self) {
self->SetVar<std::string>(GuardGroup, "Guard");
@ -80,7 +81,7 @@ void ZoneAgProperty::PropGuardCheck(Entity* self, Entity* player) {
const auto state = missionComponent->GetMissionState(self->GetVar<uint32_t>(guardMissionFlag));
const auto firstState = missionComponent->GetMissionState(self->GetVar<uint32_t>(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<std::string>(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<std::u16string>(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<std::u16string>(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<std::u16string>(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<std::u16string>(u"Tooltip", u"PlaceModel");
self->SetVar<std::string>(u"tutorial", "place_model");
}

View File

@ -1,5 +1,6 @@
#include "SsModularBuildServer.h"
#include "MissionComponent.h"
#include "eMissionState.h"
void SsModularBuildServer::OnModularBuildExit(Entity* self, Entity* player, bool bCompleted, std::vector<LOT> modules) {
int missionNum = 1732;
@ -8,7 +9,7 @@ void SsModularBuildServer::OnModularBuildExit(Entity* self, Entity* player, bool
MissionComponent* mission = static_cast<MissionComponent*>(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);
}
}

View File

@ -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<MissionComponent>();
if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == MissionState::MISSION_STATE_ACTIVE) {
if (missionComponent != nullptr && missionComponent->GetMissionState(1183) == eMissionState::ACTIVE) {
const auto loot = self->GetVar<int32_t>(m_LootVariable);
auto* inventoryComponent = user->GetComponent<InventoryComponent>();

View File

@ -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);

View File

@ -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;

View File

@ -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<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();

View File

@ -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;
};

View File

@ -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);
}

View File

@ -5,6 +5,6 @@
#include <map>
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<uint32_t, std::vector<ItemSetting>> GetSettings() override;
};

View File

@ -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<std::u16string>(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();

View File

@ -18,7 +18,7 @@ static std::map<std::u16string, uint32_t> 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";
};

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