mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +00:00
* Shared tasks WIP; lots of logging; shared tasks and tasks work internally the same for now; lots to cleanup yet * Update task_manager.cpp * Add tables * World message handler * Zone message handler * More messaging * More rearranging * Task creation work (wip) * Tweaks * Decoupled things, added a shared task manager, moved logic to the manager, created the shared task object, now creating a sense of state on creation and members, zero validation, happy path * Cleanup unnecessary getter * More work on shared task persistence and state loading * Add int64 support into repositories * More state handling, creation loads all tables * Wrap up shared task state creation and removal * Move more lookup operations to preloading (memory). Restore shared task state during world bootup * Implement shared task updates * Add members other than just leader in task confirmations * Update shared_task_manager.cpp * Hook task cancellation for shared task removal (middleware) * Remove dynamic_zone_id from SharedTasks model in repositories (for now) since we will likely be one to many with DZ objects * Get members to show up in the window on creation * Add opcodes, cleanup * Add opcode handlers * Split some methods out, self removal of shared task and updating members * Implement offline shared task sync * Style changes * Send memberlist on initial login; implement remove player from shared task window * Refactorings, cleanup * Implement make leader in shared tasks window * Implement add player, sync shared task state after add * Add opcodes for remaining clients * Shared task invite dialogue window implementation and response handling (including validation) * Logging * Remove comment * Some cleanup * Pass NPC context through shared task request logic * Remove extra SharedTaskMember fields * Add message constants * Remove static * Only use dz for expedition request This passes expedition creation parameters through DynamicZone instead of injecting ExpeditionRequest since it can hold creation data now * Store expedition leader on dz This shifts to using the leader object that exists in the core dynamic zone object. It will be moved to the dynamic zone table later with other columns that should just be on the dz to make loading easier. Expeditions are probably the only dz type that will use this for window updates and command auth. Other systems on live do fill the window but don't keep it updated * Store expedition name on dz This uses the name stored on dz (for window packets) instead of duplicating it. This will be moved completely to dz table later * Store uuid on dynamic zone This lets dynamic zones generate the uuid instead of expeditions. Other dz type systems may want to make use of this. Lockouts should also be moved to dynamic zones at some point in the future so this will be necessary for that * Move expedition db columns to dz These columns should just belong to the core dynamic zone. This will simplify loading from the database and in the future a separate expedition table may no longer be necessary. * Move window packet methods to dz It makes more sense for these methods to be in the core This will also allow support for other systems to use the window, though live behavior that updates the window for shared task missions when not in an expedition is likely unintended since it's not updated on changes. * Store dynamic zone ids on clients These will now be used for client dynamic zone lookups to remove dependency on any dz type system caches * Move member management to dz This moves server messaging for adding and removing members to internal dynamic zone methods Set default dz member status to Unknown * Move member status caching to dz This moves world member status caching into internal dz methods Zone member updates for created expeditions are now async and sent after world replies with member statuses. Prior to this two memberlist packets were sent to members in other zones on creation to update statuses. This also fixes a bug with member statuses being wrong for offline raid members in the zone that created an expedition. Note that live kicks offline players out of raids so this is only to support emu behavior. * Move member status updates to dz * Set dz member status on all client dzs This also renames the zone entry dz update method and moves window update to a dynamic zone method. Eventually expedition components should just be merged with dz and handled as another dz type * Save instance safe return on characters Add character_instance_safereturns table and repository Previously dz safe return only worked for online characters via the dz kicktimer or offline characters with a workaround that moved them when an expedition was deleted. There were various edge cases that would cause characters to be moved to bind instead (succoring after removal, camping before kick timer, removed while offline, bulk kickplayers removal with some offline) This updates a character's instance safereturn every time they enter a zone. If a character enters world in an instance that expired or are no longer part of they'll be moved to their instance safereturn (if the safereturn data is for the same zone-instance). Bind is still a fallback This may also be used for non-dz instancing so it's named generically This removes the expedition MoveMembersToSafeReturn workaround which deprecates the is_current_member column of dynamic_zone_members and will be removed in a followup patch. * Remove is_current_member from dz members This was only being used in the workaround to move past members to dz safereturns if they were still inside the dz but not online * Let dz check leader in world This moves expedition leader processing in world to the dynamic zone. This is a step in phasing out the separate expedition class for things that can run off the dynamic zone core with simple dz type checks This greatly simplifies checking leader on member and status changes without needing callbacks. Other dz types that may use the dz leader object can just handle it directly on the dz the same as expeditions * Let dz handle member expire warnings This moves expire warning checks to dz. This will make it easier for other dz types to issue expire warnings if needed * Use separate dynamic zone cache Dynamic zones are no longer member objects of expeditions and have been placed into their own cache. This was done so other dz types can be cached without relying on their systems. Client and zone dz Lookups are now independent of any system This continues the process of phasing out a separate expedition cache. Eventually expeditions can just be run directly as dynamic zones internally with a few dz type checks. Add dz serialization methods (cereal) for passing server dz creation Modify #dz list to show cache and database separately. Also adds #dz cache reload. This command will reload expeditions too since they currently hold references to the dz in their own zone cache. Add a dynamic zone processing class to world to process all types and move expedition processing to it * Move expedition makeleader processing to dz * Let dz handle expedition deletions This removes the need for separate expedition cache in world This will greatly simplify world dynamic zone caching and processing. Dynamic zones that are expeditions can just handle this directly. Once lockouts and other components are completely moved to dynamic zones the separate expedition cache in zone will also no longer be necessary * Remove ExpeditionBase class Since world no longer caches expeditions this will not be necessary * Fix windows compile * Implement task dz creation Prototype dz creation for shared tasks * Add and remove shared task members from dz Also keep leader updated (used in choose zone window) * Fix client crash on failed shared task * Fix linux compile and warning * Check client nullptr for dz message This was accidently removed when expedition makeleader was moved * Disable dz creation for solo tasks * Add shared task repository headers to CMakeLists * Add shared task dynamic zones table * Add shared task dz database persistence * Get members from db on shared task dz creation This fixes a case where removing a member from a shared task dz would fail if the member's name was empty. This could happen if the shared task dz was created while a member was offline. This also changes the dz member removal method to only check id. It might be possible to change all dz member validations to only check ids since names are primarily for window updates, but shared task dz member names need to be non-empty anyway to support possible live-like dz window usage in the future. * Add character message methods to world Add simple and eqstr message methods to ClientList Add shared task manager methods to message all members or leader * Add SyncClientSharedTaskState and nested sync strategies to cover M3 work * Fix whitespace * Implement task request cooldown timer This implements the task request cooldown (15 seconds) that live uses when a task is accepted. This will also need to be set when shared tasks are offered (likely due to additional group/raid validations) * Implement shared task selector validation This implements the validation and filtering that occurs before the task selection window is sent to a client for shared tasks To keep things live-like, task selectors that contain a shared task will be run through shared task validation and drop non-shared tasks. Live doesn't mix types in task selections and this makes validation simpler. Also note that live sends shared task selectors via a different opcode than solo tasks but that has not been implemented yet * Add separate shared task select opcodes Live uses separate opcodes for solo and shared task selection windows * Convert ActivityType to enum class * Refactor task selector serialization This adds serializer methods to task and task objective structs for the task selection windows. This combines the duplicate task selector methods to reduce code duplication and simplify serialization * Add shared task selector This sends shared task selection window using the shared task specific opcode and adds an opcode handler for shared task accepts which are sent by client in response to setting selection window to shared task type. * Refactor task objective serialization This adds a serialization method to the task objective struct for serializing objectives in the window list and combines the separate client-based methods to reduce duplicated code. * Add task level spread and player count columns * Implement shared task accept validation This adds a common method for shared task character request queries * Add task replay and request timer columns * Add character task timers table * Use shared task accept time on clients This overrides client task accept time with shared task's creation time. This is needed for accurate window task timers and lockout messages especially for characters added to shared tasks post creation * Implement task timer lockouts This implements replay and request task timers for solo and shared tasks * Add solo and shared task timer validation * Remove logging of padding array This gets interpreted as a c string which may not be null terminated * Implement /kickplayers task This also fixes current CancelTask behavior for leader which was performing kickplayers functionality through the remove task button * Implement /taskquit command * Implement shared task invite validation Remove active invitation before invite accept validation * Remove local client db persistence during SyncClientSharedTaskRemoveLocalIfNotExists * Add missing accept time arg to assign task * Only validate non-zero task invite requirements * Fix task error log crash * Separate task cooldown timer messaging * Use method to check for client shared task * Avoid unneeded task invite validation query Only need to query character data for levels for non-zero level spread * Implement /tasktimers command May want to add some type of throttled caching mechanism for this in the future * Add /tasktimers rate limiter * Intercept shared task completion; more work to come * Change SharedTaskActivityState and SharedTasks time objects to datetime * Add updated_time updates to SharedTaskActivities * Mark shared tasks as complete when all activities are completed * Save a database query on shared task completion and use the active record in memory * Don't record shared task completions to the quest log * Implement RecordSharedTaskCompletion, add tables, repositories * Update shared_task_manager.cpp * Update shared_task_manager.cpp * Add shared task replay timers This is still not feature complete. On live any past members that ever joined the shared task will receive a replay timer when it's completed * Create FindCharactersInSharedTasks that searches through memory * Remove namespace shorthand and formatting * More minor cleanup * Implement PurgeAllSharedTasks via #task command * Add #task purgetimers * Decrease m_keepalive time between processes * Remove type ordering in /tasktimer query * Add comment for task packet reward multiplier This is likely a reward multiplier that changes text color based on value to represent any scaled bonus or penalty * Add replay timers to past members This implements the live behavior that adds replay timers to any previous member of a shared task. This likely exists to avoid possible exploits. Shared task member history is stored in memory and is used to assign replay timers. This history will be lost on world crashes or restarts but is simpler than saving past member state in database. This also makes world send shared task replay timer messages since past members need to be messaged now * Move PurgeTaskTimers client method to tasks.cpp * Remove dz members when purging shared tasks Server dz states need to be updated before shared tasks are deleted * Use exact name in shared task invites This removes the wildcards from shared task invite character queries which was sometimes selecting the wrong character Taskadd validation is called even for invalid characters to allow for proper messages to occur * Clear declined active shared task invitations This also notifies leader for declined shared task invites * Store shared task member names This adds back the character name field to SharedTaskMember. This should make serialization easier in the future and reduce database lookups when names are needed for /task commands * Implement /taskplayerlist command * Replace queries with member name lookups Now that shared task members store names these queries are unnecessary This also adds not-a-member messages for /taskremove and /taskmakeleader * Implement shared task member change packet This avoids sending the full member list to members when a single member is added or removed and lets the client generate chat messages for it. * Serialize shared task member list from world This uses cereal to serialize the full member list from world and removes the zone query workarounds * Initialize client task state array This was causing sql query errors on client state reloads The client task information array was uninitialized resulting in being filled with 0xcdcdcdcd values in msvc debug builds. Under release builds this may have resulted in indeterminate values A better fix would be to refactor some of this legacy code * Add shared task command messages Add messages for non-leader task commands This adds taskadd, taskremove, taskmakeleader, and taskquit messages The leader receives double messages for taskremove like live due to the client generated message as well as the explicit one. It also receives double server messages if the leader /taskremoves self. * Replace some task messages with eqstrs This also updates to use live colors * Avoid shared task invite leader lookup query Since member names are stored now this query is also unnecessary * Avoid reloading client state on shared task accept This was unnecessarily reloading client task state when added to a shared task. This also resulted in all active tasks being resent to shared task members on creation. The shared task itself is the only task that needs to be sent which is handled by AcceptNewTask. * Remove active shared task invite on zone Live doesn't re-send shared task invites after zoning like it does for expeditions so there's no need to keep these around. This fixes active invitations never getting reset on characters that zone or go offline. * Choose new shared task leader if leader removed * Add separate shared task kickplayers method * Enable EVENT_CAST_ON for clients This will be required for a shared task objective (The Creator) in DoN * Revert "Avoid reloading client state on shared task accept" This reverts commit 3af14fee2de8b109ffb6c2b2fc67731e1531a665. Without this clients added to a task after some objectives have been completed don't get updated state. Will need to investigate this later * Disallow looting inside a dz by non-members Non-members of a dynamic zone should not be allowed to loot npcs inside it. This should have been disabled for expeditions already but was still allowed due to an oversight (or live behavior changed). This is less critical for shared tasks since members can be added and removed at will without leaving a dz but still an important feature. * Change load where criteria * Increase task completion emote column size * Use eqstr for task item reward message * Implement radiant and ebon crystal rewards This adds reward columns for radiant and ebon crystals to the tasks table and updates task description serialization * Send task completion emote before rewards This matches live and makes it a little easier to see item rewards when tasks have a long completion emote. This also changes it to send via the same normal message opcode that live uses. * Do not send a shared task in completed task history * Allow EVENT_TASK_STAGE_COMPLETE for quest goals This invokes event_task_stage_complete for task elements flagged with a quest controlled goal method. It should be expected behavior that a completed task stage always fires this event even if a quest controls it * Add SyncSharedTaskZoneClientDoneCountState * Swap return for continue in this case * Formatting * Simplify * Formatting * Formatting * Formatting * Remove errant check * Formatting, add setter for shared tasks * Remove debugging * Comments in PR * More PR follow up * Formatting * Cleanup * Update packet comments * Comments * More cleanup * Send command error message if not in shared task /taskadd is the only command with this feedback on live. Newer live clients also generate this instead of the server sending the message * Implement expire_time on SharedTask object and add a purge on world bootup * Comment * Add SyncClientSharedTaskStateToLocal where clients fall out of sync and no longer have a task locally * Clamp shared task activity updates to max done count and discard updates out of bounds * Fix packet send * Revert packet send * Adjust clamping OOO for completed time check. Add completed tables to purge truncation * Refactor kill update logic so that shared task kill updates only update one client instead of all clients * Cleanup how we're checking for active tasks * Forward task sets that contain shared tasks This forwards task sets that contain a shared task to shared task selector validation like normal task selectors * Change eqstr for empty solo task offers This is the message live appears to use if all task offers are filtered out by solo task validation * Fix max active tasks client message This message starts at the third argument. It was maybe intended to be an npc say message but live just sends it as a normal eqstr with the first two arguments nulled. * Load client task state after zoning complete This fixes a possible race where a character removed from a shared task while zoning would be stuck with an incorrect character activities state after zoning was completed. This was caused by the character loading task state to early on zone entry but never receiving the remove player message from world since they are missing from the world cle until zoning is completed. Loading client state after zone connection is completed makes sure the client has the latest state and available to the world cle * Send message to clients removed while zoning This message should usually only be sent to characters that were removed from a shared task while zoning but will occur for any sync state removals where a message wouldn't have already occured. * Post rebase fix * HG comment for checking active task * Addressing HG comments around zeroing out a shared task id * Remove errant comment * Post rebase database manifest updates * Update eqemu_logsys_log_aliases.h * More rebase catches * Bump database version for last commit Co-authored-by: hg <4683435+hgtw@users.noreply.github.com>
446 lines
25 KiB
C++
446 lines
25 KiB
C++
#ifndef EQEMU_TASKS_H
|
|
#define EQEMU_TASKS_H
|
|
|
|
#include "serialize_buffer.h"
|
|
|
|
#define MAXTASKS 10000
|
|
#define MAXTASKSETS 1000
|
|
#define MAXACTIVEQUESTS 19 // The Client has a hard cap of 19 active quests, 29 in SoD+
|
|
#define MAXCHOOSERENTRIES 40 // The Max Chooser (Task Selector entries) is capped at 40 in the Titanium Client.
|
|
#define MAXACTIVITIESPERTASK 20 // The Client has a hard cap of 20 activities per task.
|
|
#define TASKSLOTEMPTY 0 // This is used to determine if a client's active task slot is empty.
|
|
|
|
#define TASKSLOTTASK 0
|
|
#define TASKSLOTSHAREDTASK 0
|
|
|
|
// Command Codes for worldserver ServerOP_ReloadTasks
|
|
#define RELOADTASKS 0
|
|
#define RELOADTASKGOALLISTS 1
|
|
#define RELOADTASKPROXIMITIES 2
|
|
#define RELOADTASKSETS 3
|
|
|
|
typedef enum {
|
|
METHODSINGLEID = 0,
|
|
METHODLIST = 1,
|
|
METHODQUEST = 2
|
|
} TaskMethodType;
|
|
|
|
enum class TaskActivityType : int32_t // task element/objective
|
|
{
|
|
Unknown = -1, // hidden
|
|
None = 0,
|
|
Deliver = 1,
|
|
Kill = 2,
|
|
Loot = 3,
|
|
SpeakWith = 4,
|
|
Explore = 5,
|
|
TradeSkill = 6,
|
|
Fish = 7,
|
|
Forage = 8,
|
|
CastOn = 9,
|
|
SkillOn = 10,
|
|
Touch = 11,
|
|
Collect = 13,
|
|
GiveCash = 100
|
|
};
|
|
|
|
enum class TaskTimerType
|
|
{
|
|
Replay = 0,
|
|
Request
|
|
};
|
|
|
|
struct ActivityInformation {
|
|
int step_number;
|
|
TaskActivityType activity_type;
|
|
std::string target_name; // name mob, location -- default empty, max length 64
|
|
std::string item_list; // likely defaults to empty
|
|
std::string skill_list; // IDs ; separated -- default -1
|
|
std::string spell_list; // IDs ; separated -- default 0
|
|
std::string description_override; // overrides auto generated description -- default empty, max length 128
|
|
int skill_id; // older clients, first id from above
|
|
int spell_id; // older clients, first id from above
|
|
int goal_id;
|
|
TaskMethodType goal_method;
|
|
int goal_count;
|
|
int deliver_to_npc;
|
|
std::vector<int> zone_ids;
|
|
std::string zones; // IDs ; separated, ZoneID is the first in this list for older clients -- default empty string, max length 64
|
|
bool optional;
|
|
|
|
inline bool CheckZone(int zone_id)
|
|
{
|
|
if (zone_ids.empty()) {
|
|
return true;
|
|
}
|
|
return std::find(zone_ids.begin(), zone_ids.end(), zone_id) != zone_ids.end();
|
|
}
|
|
|
|
void SerializeSelector(SerializeBuffer& out, EQ::versions::ClientVersion client_version) const
|
|
{
|
|
out.WriteInt32(static_cast<int32_t>(activity_type));
|
|
out.WriteInt32(0); // solo/group/raid request type? (no longer in live)
|
|
out.WriteString(target_name); // target name used in objective type string (max 64)
|
|
|
|
if (client_version >= EQ::versions::ClientVersion::RoF)
|
|
{
|
|
out.WriteLengthString(item_list); // used in objective type string (can be empty for none)
|
|
out.WriteInt32(activity_type == TaskActivityType::GiveCash ? 1 : goal_count);
|
|
out.WriteLengthString(skill_list); // used in SkillOn objective type string, "-1" for none
|
|
out.WriteLengthString(spell_list); // used in CastOn objective type string, "0" for none
|
|
out.WriteString(zones); // used in objective zone column and task select "begins in" (may have multiple, "0" for "unknown zone", empty for "ALL")
|
|
}
|
|
else
|
|
{
|
|
out.WriteString(item_list);
|
|
out.WriteInt32(activity_type == TaskActivityType::GiveCash ? 1 : goal_count);
|
|
out.WriteInt32(skill_id);
|
|
out.WriteInt32(spell_id);
|
|
out.WriteInt32(zone_ids.empty() ? 0 : zone_ids.front());
|
|
}
|
|
|
|
out.WriteString(description_override);
|
|
|
|
if (client_version >= EQ::versions::ClientVersion::RoF) {
|
|
out.WriteString(zones); // serialized again after description (seems unused)
|
|
}
|
|
}
|
|
|
|
void SerializeObjective(SerializeBuffer& out, EQ::versions::ClientVersion client_version, int done_count) const
|
|
{
|
|
// cash objectives internally repurpose goal_count to store cash amount and
|
|
// done_count as a boolean (should not be sent as actual completed/goal counts)
|
|
int real_goal_count = goal_count;
|
|
if (activity_type == TaskActivityType::GiveCash)
|
|
{
|
|
done_count = (done_count >= goal_count) ? 1 : 0;
|
|
real_goal_count = 1;
|
|
}
|
|
|
|
out.WriteInt32(static_cast<int32_t>(activity_type));
|
|
|
|
if (client_version >= EQ::versions::ClientVersion::RoF) {
|
|
out.WriteInt8(optional ? 1 : 0);
|
|
} else {
|
|
out.WriteInt32(optional ? 1 : 0);
|
|
}
|
|
|
|
out.WriteInt32(0); // solo/group/raid request type? (no longer in live)
|
|
out.WriteString(target_name); // target name used in objective type string (max 64)
|
|
|
|
if (client_version >= EQ::versions::ClientVersion::RoF)
|
|
{
|
|
out.WriteLengthString(item_list); // used in objective type string (can be empty for none)
|
|
out.WriteInt32(real_goal_count);
|
|
out.WriteLengthString(skill_list); // used in SkillOn objective type string, "-1" for none
|
|
out.WriteLengthString(spell_list); // used in CastOn objective type string, "0" for none
|
|
out.WriteString(zones); // used in objective zone column and task select "begins in" ("0" for "unknown zone", empty for "ALL")
|
|
}
|
|
else
|
|
{
|
|
out.WriteString(item_list);
|
|
out.WriteInt32(real_goal_count);
|
|
out.WriteInt32(skill_id);
|
|
out.WriteInt32(spell_id);
|
|
out.WriteInt32(zone_ids.empty() ? 0 : zone_ids.front());
|
|
}
|
|
|
|
out.WriteInt32(0); // unknown id
|
|
out.WriteString(description_override);
|
|
out.WriteInt32(done_count);
|
|
out.WriteInt8(1); // unknown
|
|
|
|
if (client_version >= EQ::versions::ClientVersion::RoF)
|
|
{
|
|
out.WriteString(zones); // serialized again after description (seems unused)
|
|
}
|
|
}
|
|
};
|
|
|
|
typedef enum {
|
|
ActivitiesSequential = 0,
|
|
ActivitiesStepped = 1
|
|
} SequenceType;
|
|
|
|
enum class TaskType {
|
|
Task = 0, // can have at max 1
|
|
Shared = 1, // can have at max 1
|
|
Quest = 2, // can have at max 19 or 29 depending on client
|
|
E = 3 // can have at max 19 or 29 depending on client, not present in live anymore
|
|
};
|
|
|
|
static const uint8 TASK_TYPE_TASK = 0;
|
|
static const uint8 TASK_TYPE_SHARED = 1;
|
|
static const uint8 TASK_TYPE_QUEST = 2;
|
|
|
|
enum class DurationCode {
|
|
None = 0,
|
|
Short = 1,
|
|
Medium = 2,
|
|
Long = 3
|
|
};
|
|
|
|
struct TaskInformation {
|
|
TaskType type;
|
|
int duration{};
|
|
DurationCode duration_code; // description for time investment for when duration == 0
|
|
std::string title{}; // max length 64
|
|
std::string description{}; // max length 4000, 2048 on Tit
|
|
std::string reward{};
|
|
std::string item_link{}; // max length 128 older clients, item link gets own string
|
|
std::string completion_emote{}; // emote after completing task, yellow. Maybe should make more generic ... but yellow for now!
|
|
int reward_id{};
|
|
int cash_reward{}; // Expressed in copper
|
|
int experience_reward{};
|
|
int faction_reward{}; // just a npc_faction_id
|
|
TaskMethodType reward_method;
|
|
int reward_radiant_crystals;
|
|
int reward_ebon_crystals;
|
|
int activity_count{};
|
|
SequenceType sequence_mode;
|
|
int last_step{};
|
|
short min_level{};
|
|
short max_level{};
|
|
int level_spread;
|
|
int min_players;
|
|
int max_players;
|
|
bool repeatable{};
|
|
int replay_timer_seconds;
|
|
int request_timer_seconds;
|
|
ActivityInformation activity_information[MAXACTIVITIESPERTASK];
|
|
|
|
void SerializeSelector(SerializeBuffer& out, EQ::versions::ClientVersion client_version) const
|
|
{
|
|
if (client_version != EQ::versions::ClientVersion::Titanium) {
|
|
out.WriteFloat(1.0f); // reward multiplier (affects color, <1.0: yellow-red, 1.0: white, >1.0: lightgreen-green)
|
|
}
|
|
|
|
out.WriteUInt32(duration); // task duration (seconds) (0: task_duration_code used, "Unlimited" on live)
|
|
out.WriteUInt32(static_cast<int>(duration_code)); // 1: Short 2: Medium 3: Long anything else Unlimited (no longer in live)
|
|
out.WriteString(title); // max 64 with null
|
|
out.WriteString(description); // max 4000 with null
|
|
|
|
if (client_version != EQ::versions::ClientVersion::Titanium) {
|
|
out.WriteUInt8(0); // 0: no rewards 1: enables "Reward Preview" button
|
|
}
|
|
|
|
// selector only needs to send the first objective to fill description starting zone
|
|
out.WriteUInt32(std::min(activity_count, 1)); // number of task objectives
|
|
if (activity_count > 0)
|
|
{
|
|
out.WriteUInt32(0); // objective index
|
|
activity_information[0].SerializeSelector(out, client_version);
|
|
}
|
|
}
|
|
};
|
|
|
|
typedef enum {
|
|
ActivityHidden = 0,
|
|
ActivityActive = 1,
|
|
ActivityCompleted = 2
|
|
} ActivityState;
|
|
|
|
struct ClientActivityInformation {
|
|
int activity_id;
|
|
int done_count;
|
|
ActivityState activity_state;
|
|
bool updated; // Flag so we know if we need to updated the database
|
|
};
|
|
|
|
struct ClientTaskInformation {
|
|
int slot; // intrusive, but makes things easier :P
|
|
int task_id;
|
|
int current_step;
|
|
int accepted_time;
|
|
bool updated;
|
|
ClientActivityInformation activity[MAXACTIVITIESPERTASK];
|
|
};
|
|
|
|
struct CompletedTaskInformation {
|
|
int task_id;
|
|
int completed_time;
|
|
bool activity_done[MAXACTIVITIESPERTASK];
|
|
};
|
|
|
|
namespace Tasks {
|
|
|
|
inline int GetActivityStateIdentifier(ActivityState activity_state)
|
|
{
|
|
switch (activity_state) {
|
|
case ActivityHidden:
|
|
return 0;
|
|
case ActivityActive:
|
|
return 1;
|
|
case ActivityCompleted:
|
|
return 2;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
inline std::string GetActivityStateDescription(ActivityState activity_state)
|
|
{
|
|
switch (activity_state) {
|
|
case ActivityHidden:
|
|
return "Hidden";
|
|
case ActivityActive:
|
|
return "Active";
|
|
case ActivityCompleted:
|
|
return "Completed";
|
|
default:
|
|
return "Hidden";
|
|
}
|
|
}
|
|
|
|
inline int GetTaskTypeIdentifier(TaskType task_type)
|
|
{
|
|
switch (task_type) {
|
|
case TaskType::Task:
|
|
return 0;
|
|
case TaskType::Shared:
|
|
return 1;
|
|
case TaskType::Quest:
|
|
return 2;
|
|
case TaskType::E:
|
|
return 3;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
inline std::string GetTaskTypeDescription(TaskType task_type)
|
|
{
|
|
switch (task_type) {
|
|
case TaskType::Task:
|
|
return "Task";
|
|
case TaskType::Shared:
|
|
return "Shared";
|
|
case TaskType::Quest:
|
|
return "Quest";
|
|
case TaskType::E:
|
|
return "E";
|
|
default:
|
|
return "Task";
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace SharedTaskMessage {
|
|
constexpr uint16 TASK_ASSIGN_WAIT_REPLAY_TIMER = 8017; // This task can not be assigned to you because you must wait %1d:%2h:%3m before you can do another task of this type.
|
|
constexpr uint16 COULD_NOT_USE_COMMAND = 8272; // You could not use this command because you are not currently assigned to a shared task.
|
|
constexpr uint16 AVG_LVL_LOW = 8553; // You can not be assigned this shared task because your party's average level is too low.
|
|
constexpr uint16 AVG_LVL_HIGH = 8889; // You can not be assigned this shared task because your party's average level is too high.
|
|
constexpr uint16 LVL_SPREAD_HIGH = 8890; // You can not be assigned this shared task because your party's level spread is too high.
|
|
constexpr uint16 PARTY_EXCEED_MAX_PLAYER = 8891; // You can not be assigned this shared task because your party exceeds the maximum allowed number of players.
|
|
constexpr uint16 LEADER_NOT_MEET_REQUIREMENTS = 8892; // You can not be assigned this shared task because the leader does not meet the shared task requirements.
|
|
constexpr uint16 SHARED_TASK_NOT_MEET_MIN_NUM_PLAYER = 8895; // You can not be assigned this shared task because your party does not contain the minimum required number of players.
|
|
constexpr uint16 WILL_REMOVE_ZONE_TWO_MIN_RAID_NOT_MIN_NUM_PLAYER = 8908; // %1 will be removed from their zone in two minutes because your raid does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 WILL_REMOVE_ZONE_TWO_MIN_GROUP_NOT_MIN_NUM_PLAYER = 8909; // %1 will be removed from their zone in two minutes because your group does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 WILL_REMOVE_AREA_TWO_MIN_RAID_NOT_MIN_NUM_PLAYER = 8910; // %1 will be removed from their area in two minutes because your raid does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 WILL_REMOVE_AREA_TWO_MIN_GROUP_NOT_MIN_NUM_PLAYER = 8911; // %1 will be removed from their area in two minutes because your group does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 HAS_REMOVED_ZONE_TWO_MIN_RAID_NOT_MIN_NUM_PLAYER = 8912; // %1 has been removed from their zone because your raid does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 HAS_REMOVED_ZONE_TWO_MIN_GROUP_NOT_MIN_NUM_PLAYER = 8913; // %1 has been removed from their zone because your group does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 HAS_REMOVED_AREA_TWO_MIN_RAID_NOT_MIN_NUM_PLAYER = 8914; // %1 has been removed from their area because your raid does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 HAS_REMOVED_AREA_TWO_MIN_GROUP_NOT_MIN_NUM_PLAYER = 8915; // %1 has been removed from their area because your group does not meet the minimum requirement of qualified players.
|
|
constexpr uint16 SEND_INVITE_TO = 8916; // Sending a shared task invitation to %1.
|
|
constexpr uint16 COULD_NOT_BE_INVITED = 8917; // %1 could not be invited to join you.
|
|
constexpr uint16 YOU_ARE_NOT_LEADER_COMMAND_ISSUE = 8919; // You are not the shared task leader. Only %1 can issue this command.
|
|
constexpr uint16 SWAP_SENDING_INVITATION_TO = 8920; // Sending an invitation to: %1. They must accept in order to swap party members.
|
|
constexpr uint16 SWAP_ACCEPTED_OFFER = 8921; // %1 has accepted your offer to join your shared task. Swapping %1 for %2.
|
|
constexpr uint16 IS_NOT_MEMBER = 8922; // %1 is not a member of this shared task.
|
|
constexpr uint16 NOT_ALLOW_PLAYER_REMOVE = 8923; // The shared task is not allowing players to be removed from it at this time.
|
|
constexpr uint16 PLAYER_HAS_BEEN_REMOVED = 8924; // %1 has been removed from your shared task, '%2'.
|
|
constexpr uint16 TRANSFER_LEADERSHIP_NOT_ONLINE = 8925; // %1 is not currently online. You can only transfer leadership to an online member of the shared task.
|
|
constexpr uint16 MADE_LEADER = 8926; // %1 has been made the leader for this shared task.
|
|
constexpr uint16 YOU_MADE_LEADER = 8927; // You have been made the leader of this shared task.
|
|
constexpr uint16 LEADER_PRINT = 8928; // Shared Task Leader: %1
|
|
constexpr uint16 MEMBERS_PRINT = 8929; // Shared Task Members: %1
|
|
constexpr uint16 PLAYER_ACCEPTED_OFFER_JOIN = 8930; // %1 has accepted your offer to join your shared task.
|
|
constexpr uint16 PLAYER_HAS_BEEN_ADDED = 8931; // %1 has been added to your shared task, '%2'.
|
|
constexpr uint16 ACCEPTED_OFFER_TO_JOIN_BUT_COULD_NOT = 8932; // %1 accepted your offer to join your shared task but could not.
|
|
constexpr uint16 PLAYER_DECLINED_OFFER = 8933; // %1 has declined your offer to join your shared task.
|
|
constexpr uint16 PLAYER_HAS_ASKED_YOU_TO_JOIN = 8934; // %1 has asked you to join the shared task '%2'. Would you like to join?
|
|
constexpr uint16 NO_REQUEST_BECAUSE_HAVE_ONE = 8935; // You may not request a shared task because you already have one.
|
|
constexpr uint16 NO_REQUEST_BECAUSE_RAID_HAS_ONE = 8936; // You may not request a shared task because someone in your raid, %1, already has one.
|
|
constexpr uint16 NO_REQUEST_BECAUSE_GROUP_HAS_ONE = 8937; // You may not request a shared task because someone in your group, %1, already has one.
|
|
constexpr uint16 YOU_DO_NOT_MEET_REQ_AVAILABLE = 8938; // You do not meet the requirements for any available shared tasks.
|
|
constexpr uint16 YOUR_RAID_DOES_NOT_MEET_REQ = 8939; // Your raid does not meet the requirements for any available shared tasks.
|
|
constexpr uint16 YOUR_GROUP_DOES_NOT_MEET_REQ = 8940; // Your group does not meet the requirements for any available shared tasks.
|
|
constexpr uint16 YOUR_GROUP__RAID_DOES_NOT_MEET_REQ = 8941; // You can not be assigned this shared task because the raid or group does not meet the shared task requirements.
|
|
constexpr uint16 YOU_NO_LONGER_MEMBER = 8942; // You are no longer a member of the shared task.
|
|
constexpr uint16 YOU_MAY_NOT_REQUEST_EXPANSION = 8943; // You may not request this shared task because you do not have the required expansion.
|
|
constexpr uint16 PLAYER_MAY_NOT_REQUEST_EXPANSION = 8944; // You may not request this shared task because %1 does not have the required expansion.
|
|
constexpr uint16 TWO_MIN_REQ_TASK_TERMINATED = 8945; // If your party does not meet the requirements in two minutes, the shared task will be terminated.
|
|
constexpr uint16 YOU_MUST_WAIT_REPLAY_TIMER = 8946; // You may not request this shared task because you must wait %1d:%2h:%3m before you can do another task of this type.
|
|
constexpr uint16 PLAYER_MUST_WAIT_REPLAY_TIMER = 8947; // You may not request this shared task because %1 must wait %2d:%3h:%4m before they can do another task of this type.
|
|
constexpr uint16 PLAYER_NOW_LEADER = 8948; // %1 is now the leader of your shared task, '%2'.
|
|
constexpr uint16 HAS_ENDED = 8951; // Your shared task, '%1', has ended.
|
|
constexpr uint16 YOU_ALREADY_LEADER = 8952; // You are already the leader of the shared task.
|
|
constexpr uint16 TASK_NO_LONGER_ACTIVE = 8953; // Your shared task, '%1', is no longer active.
|
|
constexpr uint16 YOU_HAVE_BEEN_ADDED_TO_TASK = 8954; // You have been added to the shared task '%1'.
|
|
constexpr uint16 YOU_ARE_NOW_LEADER = 8955; // You are now the leader of your shared task, '%1'.
|
|
constexpr uint16 YOU_HAVE_BEEN_REMOVED = 8956; // You have been removed from the shared task '%1'.
|
|
constexpr uint16 YOU_ARE_NO_LONGER_A_MEMBER = 8960; // You are no longer a member of the shared task, '%1'.
|
|
constexpr uint16 YOUR_TASK_NOW_LOCKED = 8961; // Your shared task is now locked. You may no longer add or remove players.
|
|
constexpr uint16 TASK_NOT_ALLOWING_PLAYERS_AT_TIME = 8962; // The shared task is not allowing players to be added at this time.
|
|
constexpr uint16 PLAYER_NOT_ONLINE_TO_ADD = 8963; // %1 is not currently online. A player needs to be online to be added to a shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_ALREADY_MEMBER = 8964; // You can not add %1 because they are already a member of this shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_ALREADY_ASSIGNED = 8965; // You can not add %1 because they are already assigned to another shared task.
|
|
constexpr uint16 PLAYER_ALREADY_OUTSTANDING_INVITATION_THIS = 8966; // %1 already has an outstanding invitation to join this shared task.
|
|
constexpr uint16 PLAYER_ALREADY_OUTSTANDING_ANOTHER = 8967; // %1 already has an outstanding invitation to join another shared task. Players may only have one invitation outstanding.
|
|
constexpr uint16 CANT_ADD_PLAYER_MAX_PLAYERS = 8968; // You can not add another player since you currently have the maximum number of players allowed (%1) in this shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_MAX_LEVEL_SPREAD = 8969; // You can not add this player because you would exceed the maximum level spread (%1) for this shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_MAX_AVERAGE_LEVEL = 8970; // You can not add this player because you would exceed the maximum average level for this shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_FALL_MIN_AVG_LEVEL = 8971; // You can not add this player because you would fall below the minimum average level for this shared task.
|
|
constexpr uint16 PLAYER_DOES_NOT_OWN_EXPANSION = 8972; // %1 does not own the expansion needed for this shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_PARTY_FILTER_REQ_FOR_TASK = 8973; // You can not add this player because your party would no longer meet the filter requirements for this shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_ONE_OF_GROUP_RAID_HAS_TASK = 8977; // You can not add %1 because they or one of their group or raid members is in another shared task.
|
|
constexpr uint16 CANT_JOIN_GROUP_ACTIVE_TASK = 8978; // You can not join that group because you have an active shared task.
|
|
constexpr uint16 CANT_ADD_PLAYER_REPLAY_TIMER = 8979; // You may not add %1 because they must wait %2d:%3h:%4m before they can do another task of this type.
|
|
constexpr uint16 CANT_LOOT_BECAUSE_TASK_LOCKED_BELONG = 8980; // You may not loot that corpse because you are not in the shared task the corpse belongs to.
|
|
constexpr uint16 CANT_ADD_PLAYER_BECAUSE_GROUP_RAID_BELONG_TASK = 8981; // The player could not be added to the raid because they or one of their group members is in a different shared task.
|
|
constexpr uint16 PLAYER_CANT_ADD_GROUP_BECAUSE_DIFF_TASK = 8982; // %1 can not be added to the group because they are in a different shared task.
|
|
constexpr uint16 YOU_CANT_ADD_TO_GROUP_BECAUSE_DIFF_TASK = 8983; // You can not be added to the group because you are in a different shared task.
|
|
constexpr uint16 PLAYER_CANT_ADD_RAID_BECAUSE_DIFF_TASK = 8984; // %1 can not be added to the raid because they are in a different shared task.
|
|
constexpr uint16 YOU_CANT_ADD_RAID_BECAUSE_DIFF_TASK = 8985; // You can not be added to the raid because you are in a different shared task.
|
|
constexpr uint16 REPLAY_TIMER_REMAINING = 8987; // '%1' replay timer: %2d:%3h:%4m remaining.
|
|
constexpr uint16 YOU_NO_CURRENT_REPLAY_TIMERS = 8989; // You do not currently have any task replay timers.
|
|
constexpr uint16 SURE_QUIT_TASK = 8995; // Are you sure you want to quit the task '%1'?
|
|
constexpr uint16 SURE_REMOVE_SELF_FROM_TASK = 8996; // Are you sure you want to remove yourself from the shared task '%1'
|
|
constexpr uint16 TASK_ASSIGN_WAIT_REQUEST_TIMER = 14506; // This task can not be assigned to you because you must wait %1d:%2h:%3m before you can request another task of this type.
|
|
constexpr uint16 REQUEST_TIMER_REMAINING = 14507; // '%1' request timer: %2d:%3h:%4m remaining.
|
|
constexpr uint16 YOU_MUST_WAIT_REQUEST_TIMER = 14508; // You may not request this shared task because you must wait %1d:%2h:%3m before you can request another task of this type.
|
|
constexpr uint16 RECEIVED_REQUEST_TIMER = 14509; // You have received a request timer for '%1': %2d:%3h:%4m remaining.
|
|
constexpr uint16 RECEIVED_REPLAY_TIMER = 14510; // You have received a replay timer for '%1': %2d:%3h:%4m remaining.
|
|
constexpr uint16 PLAYER_MUST_WAIT_REQUEST_TIMER = 14511; // You may not request this shared task because %1 must wait %2d:%3h:%4m before they can request another task of this type.
|
|
constexpr uint16 CANT_ADD_PLAYER_REQUEST_TIMER = 14512; // You may not add %1 because they must wait %2d:%3h:%4m before they can request another task of this type.
|
|
|
|
// for eqstrs not in current emu clients (some are also used by non-shared tasks)
|
|
constexpr auto GetEQStr(uint16 eqstr_id)
|
|
{
|
|
switch (eqstr_id)
|
|
{
|
|
case SharedTaskMessage::COULD_NOT_USE_COMMAND:
|
|
return "You could not use this command because you are not currently assigned to a shared task.";
|
|
case SharedTaskMessage::TASK_ASSIGN_WAIT_REQUEST_TIMER:
|
|
return "This task can not be assigned to you because you must wait {}d:{}h:{}m before you can request another task of this type.";
|
|
case SharedTaskMessage::REQUEST_TIMER_REMAINING:
|
|
return "'{}' request timer: {}d:{}h:{}m remaining.";
|
|
case SharedTaskMessage::YOU_MUST_WAIT_REQUEST_TIMER:
|
|
return "You may not request this shared task because you must wait {}d:{}h:{}m before you can request another task of this type.";
|
|
case SharedTaskMessage::RECEIVED_REQUEST_TIMER:
|
|
return "You have received a request timer for '{}': {}d:{}h:{}m remaining.";
|
|
case SharedTaskMessage::RECEIVED_REPLAY_TIMER:
|
|
return "You have received a replay timer for '{}': {}d:{}h:{}m remaining.";
|
|
case SharedTaskMessage::PLAYER_MUST_WAIT_REQUEST_TIMER:
|
|
return "You may not request this shared task because {} must wait {}d:{}h:{}m before they can request another task of this type.";
|
|
case SharedTaskMessage::CANT_ADD_PLAYER_REQUEST_TIMER:
|
|
return "You may not add {} because they must wait {}d:{}h:{}m before they can request another task of this type.";
|
|
default:
|
|
LogTasks("[GetEQStr] Unhandled eqstr id [{}]", eqstr_id);
|
|
break;
|
|
}
|
|
return "Unknown EQStr";
|
|
}
|
|
}
|
|
|
|
#endif //EQEMU_TASKS_H
|