mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-31 18:42:27 +00:00
First pass
This commit is contained in:
parent
e8ab176d4a
commit
b7983d4c20
@ -76,7 +76,7 @@
|
|||||||
|
|
||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern TaskManager *taskmanager;
|
extern TaskManager *p_task_manager;
|
||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -258,7 +258,7 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
tgb = false;
|
tgb = false;
|
||||||
tribute_master_id = 0xFFFFFFFF;
|
tribute_master_id = 0xFFFFFFFF;
|
||||||
tribute_timer.Disable();
|
tribute_timer.Disable();
|
||||||
taskstate = nullptr;
|
task_state = nullptr;
|
||||||
TotalSecondsPlayed = 0;
|
TotalSecondsPlayed = 0;
|
||||||
keyring.clear();
|
keyring.clear();
|
||||||
bind_sight_target = nullptr;
|
bind_sight_target = nullptr;
|
||||||
@ -452,7 +452,7 @@ Client::~Client() {
|
|||||||
// will need this data right away
|
// will need this data right away
|
||||||
Save(2); // This fails when database destructor is called first on shutdown
|
Save(2); // This fails when database destructor is called first on shutdown
|
||||||
|
|
||||||
safe_delete(taskstate);
|
safe_delete(task_state);
|
||||||
safe_delete(KarmaUpdateTimer);
|
safe_delete(KarmaUpdateTimer);
|
||||||
safe_delete(GlobalChatLimiterTimer);
|
safe_delete(GlobalChatLimiterTimer);
|
||||||
safe_delete(qGlobals);
|
safe_delete(qGlobals);
|
||||||
|
|||||||
283
zone/client.h
283
zone/client.h
@ -86,7 +86,7 @@ namespace EQ
|
|||||||
#define XTARGET_HARDCAP 20
|
#define XTARGET_HARDCAP 20
|
||||||
|
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern TaskManager *taskmanager;
|
extern TaskManager *p_task_manager;
|
||||||
|
|
||||||
class CLIENTPACKET
|
class CLIENTPACKET
|
||||||
{
|
{
|
||||||
@ -1006,7 +1006,7 @@ public:
|
|||||||
uint32 GetSpellIDByBookSlot(int book_slot);
|
uint32 GetSpellIDByBookSlot(int book_slot);
|
||||||
int GetNextAvailableSpellBookSlot(int starting_slot = 0);
|
int GetNextAvailableSpellBookSlot(int starting_slot = 0);
|
||||||
inline uint32 GetSpellByBookSlot(int book_slot) { return m_pp.spell_book[book_slot]; }
|
inline uint32 GetSpellByBookSlot(int book_slot) { return m_pp.spell_book[book_slot]; }
|
||||||
inline bool HasSpellScribed(int spellid) { return (FindSpellBookSlotBySpellID(spellid) != -1 ? true : false); }
|
inline bool HasSpellScribed(int spellid) { return FindSpellBookSlotBySpellID(spellid) != -1; }
|
||||||
uint16 GetMaxSkillAfterSpecializationRules(EQ::skills::SkillType skillid, uint16 maxSkill);
|
uint16 GetMaxSkillAfterSpecializationRules(EQ::skills::SkillType skillid, uint16 maxSkill);
|
||||||
void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0);
|
void SendPopupToClient(const char *Title, const char *Text, uint32 PopupID = 0, uint32 Buttons = 0, uint32 Duration = 0);
|
||||||
void SendFullPopup(const char *Title, const char *Text, uint32 PopupID = 0, uint32 NegativeID = 0, uint32 Buttons = 0, uint32 Duration = 0, const char *ButtonName0 = 0, const char *ButtonName1 = 0, uint32 SoundControls = 0);
|
void SendFullPopup(const char *Title, const char *Text, uint32 PopupID = 0, uint32 NegativeID = 0, uint32 Buttons = 0, uint32 Duration = 0, const char *ButtonName0 = 0, const char *ButtonName1 = 0, uint32 SoundControls = 0);
|
||||||
@ -1021,48 +1021,241 @@ public:
|
|||||||
// Task System Methods
|
// Task System Methods
|
||||||
void LoadClientTaskState();
|
void LoadClientTaskState();
|
||||||
void RemoveClientTaskState();
|
void RemoveClientTaskState();
|
||||||
void SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex, TaskType type, int TaskIncomplete=1);
|
void SendTaskActivityComplete(int task_id, int activity_id, int task_index, TaskType task_type, int task_incomplete=1);
|
||||||
void SendTaskFailed(int TaskID, int TaskIndex, TaskType type);
|
void SendTaskFailed(int task_id, int task_index, TaskType task_type);
|
||||||
void SendTaskComplete(int TaskIndex);
|
void SendTaskComplete(int task_index);
|
||||||
inline ClientTaskState *GetTaskState() const { return taskstate; }
|
inline ClientTaskState *GetTaskState() const { return task_state; }
|
||||||
|
inline void CancelTask(int TaskIndex, TaskType type)
|
||||||
inline void CancelTask(int TaskIndex, TaskType type) { if(taskstate) taskstate->CancelTask(this, TaskIndex, type); }
|
{
|
||||||
inline bool SaveTaskState() { return (taskmanager ? taskmanager->SaveClientState(this, taskstate) : false); }
|
if (task_state) {
|
||||||
inline bool IsTaskStateLoaded() { return taskstate != nullptr; }
|
task_state->CancelTask(
|
||||||
inline bool IsTaskActive(int TaskID) { return (taskstate ? taskstate->IsTaskActive(TaskID) : false); }
|
this,
|
||||||
inline bool IsTaskActivityActive(int TaskID, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityActive(TaskID, ActivityID) : false); }
|
TaskIndex,
|
||||||
inline ActivityState GetTaskActivityState(TaskType type, int index, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityState(type, index, ActivityID) : ActivityHidden); }
|
type
|
||||||
inline void UpdateTaskActivity(int TaskID, int ActivityID, int Count, bool ignore_quest_update = false) { if (taskstate) taskstate->UpdateTaskActivity(this, TaskID, ActivityID, Count, ignore_quest_update); }
|
);
|
||||||
inline void RemoveTaskByTaskID(uint32 task_id) { if (taskstate) taskstate->RemoveTaskByTaskID(this, task_id); }
|
}
|
||||||
inline void ResetTaskActivity(int TaskID, int ActivityID) { if(taskstate) taskstate->ResetTaskActivity(this, TaskID, ActivityID); }
|
}
|
||||||
inline void UpdateTasksOnKill(int NPCTypeID) { if(taskstate) taskstate->UpdateTasksOnKill(this, NPCTypeID); }
|
inline bool SaveTaskState()
|
||||||
inline void UpdateTasksForItem(ActivityType Type, int ItemID, int Count=1) { if(taskstate) taskstate->UpdateTasksForItem(this, Type, ItemID, Count); }
|
{
|
||||||
inline void UpdateTasksOnExplore(int ExploreID) { if(taskstate) taskstate->UpdateTasksOnExplore(this, ExploreID); }
|
return p_task_manager != nullptr && p_task_manager->SaveClientState(this, task_state);
|
||||||
inline bool UpdateTasksOnSpeakWith(int NPCTypeID) { if(taskstate) return taskstate->UpdateTasksOnSpeakWith(this, NPCTypeID); else return false; }
|
}
|
||||||
inline bool UpdateTasksOnDeliver(std::list<EQ::ItemInstance*>& Items, int Cash, int NPCTypeID) { if (taskstate) return taskstate->UpdateTasksOnDeliver(this, Items, Cash, NPCTypeID); else return false; }
|
inline bool IsTaskStateLoaded() { return task_state != nullptr; }
|
||||||
inline void TaskSetSelector(Mob *mob, int TaskSetID) { if(taskmanager) taskmanager->TaskSetSelector(this, taskstate, mob, TaskSetID); }
|
inline bool IsTaskActive(int TaskID) { return task_state != nullptr && task_state->IsTaskActive(TaskID); }
|
||||||
inline void TaskQuestSetSelector(Mob *mob, int count, int *tasks) { if(taskmanager) taskmanager->TaskQuestSetSelector(this, taskstate, mob, count, tasks); }
|
inline bool IsTaskActivityActive(int TaskID, int ActivityID)
|
||||||
inline void EnableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->EnableTask(CharacterID(), TaskCount, TaskList); }
|
{
|
||||||
inline void DisableTask(int TaskCount, int *TaskList) { if(taskstate) taskstate->DisableTask(CharacterID(), TaskCount, TaskList); }
|
return task_state != nullptr &&
|
||||||
inline bool IsTaskEnabled(int TaskID) { return (taskstate ? taskstate->IsTaskEnabled(TaskID) : false); }
|
task_state->IsTaskActivityActive(
|
||||||
inline void ProcessTaskProximities(float X, float Y, float Z) { if(taskstate) taskstate->ProcessTaskProximities(this, X, Y, Z); }
|
TaskID,
|
||||||
inline void AssignTask(int TaskID, int NPCID, bool enforce_level_requirement = false) { if (taskstate) taskstate->AcceptNewTask(this, TaskID, NPCID, enforce_level_requirement); }
|
ActivityID
|
||||||
inline int ActiveSpeakTask(int NPCID) { if(taskstate) return taskstate->ActiveSpeakTask(NPCID); else return 0; }
|
);
|
||||||
inline int ActiveSpeakActivity(int NPCID, int TaskID) { if(taskstate) return taskstate->ActiveSpeakActivity(NPCID, TaskID); else return 0; }
|
}
|
||||||
inline void FailTask(int TaskID) { if(taskstate) taskstate->FailTask(this, TaskID); }
|
inline ActivityState GetTaskActivityState(TaskType task_type, int index, int activity_id)
|
||||||
inline int TaskTimeLeft(int TaskID) { return (taskstate ? taskstate->TaskTimeLeft(TaskID) : 0); }
|
{
|
||||||
inline int EnabledTaskCount(int TaskSetID) { return (taskstate ? taskstate->EnabledTaskCount(TaskSetID) : -1); }
|
return (task_state ? task_state->GetTaskActivityState(task_type, index, activity_id) : ActivityHidden);
|
||||||
inline int IsTaskCompleted(int TaskID) { return (taskstate ? taskstate->IsTaskCompleted(TaskID) : -1); }
|
}
|
||||||
inline void ShowClientTasks() { if(taskstate) taskstate->ShowClientTasks(this); }
|
inline void UpdateTaskActivity(
|
||||||
inline void CancelAllTasks() { if(taskstate) taskstate->CancelAllTasks(this); }
|
int task_id,
|
||||||
inline int GetActiveTaskCount() { return (taskstate ? taskstate->GetActiveTaskCount() : 0); }
|
int activity_id,
|
||||||
inline int GetActiveTaskID(int index) { return (taskstate ? taskstate->GetActiveTaskID(index) : -1); }
|
int count,
|
||||||
inline int GetTaskStartTime(TaskType type, int index) { return (taskstate ? taskstate->GetTaskStartTime(type, index) : -1); }
|
bool ignore_quest_update = false
|
||||||
inline bool IsTaskActivityCompleted(TaskType type, int index, int ActivityID) { return (taskstate ? taskstate->IsTaskActivityCompleted(type, index, ActivityID) : false); }
|
)
|
||||||
inline int GetTaskActivityDoneCount(TaskType type, int ClientTaskIndex, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCount(type, ClientTaskIndex, ActivityID) :0); }
|
{
|
||||||
inline int GetTaskActivityDoneCountFromTaskID(int TaskID, int ActivityID) { return (taskstate ? taskstate->GetTaskActivityDoneCountFromTaskID(TaskID, ActivityID) :0); }
|
if (task_state) {
|
||||||
inline int ActiveTasksInSet(int TaskSet) { return (taskstate ? taskstate->ActiveTasksInSet(TaskSet) :0); }
|
task_state->UpdateTaskActivity(this, task_id, activity_id, count, ignore_quest_update);
|
||||||
inline int CompletedTasksInSet(int TaskSet) { return (taskstate ? taskstate->CompletedTasksInSet(TaskSet) :0); }
|
}
|
||||||
|
}
|
||||||
|
inline void RemoveTaskByTaskID(uint32 task_id) {
|
||||||
|
if (task_state) {
|
||||||
|
task_state->RemoveTaskByTaskID(this, task_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void ResetTaskActivity(int task_id, int activity_id)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->ResetTaskActivity(
|
||||||
|
this,
|
||||||
|
task_id,
|
||||||
|
activity_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void UpdateTasksOnKill(int npc_type_id)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->UpdateTasksOnKill(
|
||||||
|
this,
|
||||||
|
npc_type_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void UpdateTasksForItem(
|
||||||
|
ActivityType activity_type,
|
||||||
|
int item_id,
|
||||||
|
int count = 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->UpdateTasksForItem(this, activity_type, item_id, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void UpdateTasksOnExplore(int explore_id)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->UpdateTasksOnExplore(
|
||||||
|
this,
|
||||||
|
explore_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline bool UpdateTasksOnSpeakWith(int npc_type_id)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
return task_state->UpdateTasksOnSpeakWith(
|
||||||
|
this,
|
||||||
|
npc_type_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else { return false; }
|
||||||
|
}
|
||||||
|
inline bool UpdateTasksOnDeliver(
|
||||||
|
std::list<EQ::ItemInstance *> &items,
|
||||||
|
int cash,
|
||||||
|
int npc_type_id
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
return task_state->UpdateTasksOnDeliver(
|
||||||
|
this,
|
||||||
|
items,
|
||||||
|
cash,
|
||||||
|
npc_type_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else { return false; }
|
||||||
|
}
|
||||||
|
inline void TaskSetSelector(Mob *mob, int task_set_id)
|
||||||
|
{
|
||||||
|
if (p_task_manager) {
|
||||||
|
p_task_manager->TaskSetSelector(
|
||||||
|
this,
|
||||||
|
task_state,
|
||||||
|
mob,
|
||||||
|
task_set_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void TaskQuestSetSelector(Mob *mob, int count, int *tasks)
|
||||||
|
{
|
||||||
|
if (p_task_manager) {
|
||||||
|
p_task_manager->TaskQuestSetSelector(
|
||||||
|
this,
|
||||||
|
task_state,
|
||||||
|
mob,
|
||||||
|
count,
|
||||||
|
tasks
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void EnableTask(int task_count, int *task_list)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->EnableTask(
|
||||||
|
CharacterID(),
|
||||||
|
task_count,
|
||||||
|
task_list
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void DisableTask(int task_count, int *task_list)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->DisableTask(
|
||||||
|
CharacterID(),
|
||||||
|
task_count,
|
||||||
|
task_list
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline bool IsTaskEnabled(int task_id) {
|
||||||
|
return task_state != nullptr && task_state->IsTaskEnabled(task_id);
|
||||||
|
}
|
||||||
|
inline void ProcessTaskProximities(float X, float Y, float Z)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
task_state->ProcessTaskProximities(
|
||||||
|
this,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
Z
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline void AssignTask(
|
||||||
|
int task_id,
|
||||||
|
int npc_id,
|
||||||
|
bool enforce_level_requirement = false
|
||||||
|
) {
|
||||||
|
if (task_state) {
|
||||||
|
task_state->AcceptNewTask(this, task_id, npc_id, enforce_level_requirement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline int ActiveSpeakTask(int npc_type_id)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
return task_state->ActiveSpeakTask(npc_type_id);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inline int ActiveSpeakActivity(int npc_type_id, int task_id)
|
||||||
|
{
|
||||||
|
if (task_state) {
|
||||||
|
return task_state->ActiveSpeakActivity(
|
||||||
|
npc_type_id,
|
||||||
|
task_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else { return 0; }
|
||||||
|
}
|
||||||
|
inline void FailTask(int task_id) { if (task_state) { task_state->FailTask(this, task_id); }}
|
||||||
|
inline int TaskTimeLeft(int task_id) { return (task_state ? task_state->TaskTimeLeft(task_id) : 0); }
|
||||||
|
inline int EnabledTaskCount(int task_set_id)
|
||||||
|
{
|
||||||
|
return (task_state ? task_state->EnabledTaskCount(task_set_id) : -1);
|
||||||
|
}
|
||||||
|
inline int IsTaskCompleted(int task_id) { return (task_state ? task_state->IsTaskCompleted(task_id) : -1); }
|
||||||
|
inline void ShowClientTasks() { if (task_state) { task_state->ShowClientTasks(this); }}
|
||||||
|
inline void CancelAllTasks() { if (task_state) { task_state->CancelAllTasks(this); }}
|
||||||
|
inline int GetActiveTaskCount() { return (task_state ? task_state->GetActiveTaskCount() : 0); }
|
||||||
|
inline int GetActiveTaskID(int index) { return (task_state ? task_state->GetActiveTaskID(index) : -1); }
|
||||||
|
inline int GetTaskStartTime(TaskType task_type, int index)
|
||||||
|
{
|
||||||
|
return (task_state ? task_state->GetTaskStartTime(
|
||||||
|
task_type,
|
||||||
|
index
|
||||||
|
) : -1);
|
||||||
|
}
|
||||||
|
inline bool IsTaskActivityCompleted(TaskType task_type, int index, int activity_id)
|
||||||
|
{
|
||||||
|
return task_state != nullptr && task_state->IsTaskActivityCompleted(task_type, index, activity_id);
|
||||||
|
}
|
||||||
|
inline int GetTaskActivityDoneCount(TaskType task_type, int client_task_index, int activity_id)
|
||||||
|
{
|
||||||
|
return (task_state ? task_state->GetTaskActivityDoneCount(task_type, client_task_index, activity_id) : 0);
|
||||||
|
}
|
||||||
|
inline int GetTaskActivityDoneCountFromTaskID(int task_id, int activity_id)
|
||||||
|
{
|
||||||
|
return (task_state ? task_state->GetTaskActivityDoneCountFromTaskID(task_id, activity_id) : 0);
|
||||||
|
}
|
||||||
|
inline int ActiveTasksInSet(int task_set_id)
|
||||||
|
{
|
||||||
|
return (task_state ? task_state->ActiveTasksInSet(task_set_id) : 0);
|
||||||
|
}
|
||||||
|
inline int CompletedTasksInSet(int task_set_id)
|
||||||
|
{
|
||||||
|
return (task_state ? task_state->CompletedTasksInSet(task_set_id) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
inline const EQ::versions::ClientVersion ClientVersion() const { return m_ClientVersion; }
|
inline const EQ::versions::ClientVersion ClientVersion() const { return m_ClientVersion; }
|
||||||
inline const uint32 ClientVersionBit() const { return m_ClientVersionBit; }
|
inline const uint32 ClientVersionBit() const { return m_ClientVersionBit; }
|
||||||
@ -1645,7 +1838,7 @@ private:
|
|||||||
|
|
||||||
std::set<uint32> zone_flags;
|
std::set<uint32> zone_flags;
|
||||||
|
|
||||||
ClientTaskState *taskstate;
|
ClientTaskState *task_state;
|
||||||
int TotalSecondsPlayed;
|
int TotalSecondsPlayed;
|
||||||
|
|
||||||
//Anti Spam Stuff
|
//Anti Spam Stuff
|
||||||
|
|||||||
@ -1821,8 +1821,8 @@ void Client::Handle_OP_AcceptNewTask(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
AcceptNewTask_Struct *ant = (AcceptNewTask_Struct*)app->pBuffer;
|
AcceptNewTask_Struct *ant = (AcceptNewTask_Struct*)app->pBuffer;
|
||||||
|
|
||||||
if (ant->task_id > 0 && RuleB(TaskSystem, EnableTaskSystem) && taskstate)
|
if (ant->task_id > 0 && RuleB(TaskSystem, EnableTaskSystem) && task_state)
|
||||||
taskstate->AcceptNewTask(this, ant->task_id, ant->task_master_id);
|
task_state->AcceptNewTask(this, ant->task_id, ant->task_master_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app)
|
void Client::Handle_OP_AdventureInfoRequest(const EQApplicationPacket *app)
|
||||||
@ -4004,8 +4004,8 @@ void Client::Handle_OP_CancelTask(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
CancelTask_Struct *cts = (CancelTask_Struct*)app->pBuffer;
|
CancelTask_Struct *cts = (CancelTask_Struct*)app->pBuffer;
|
||||||
|
|
||||||
if (RuleB(TaskSystem, EnableTaskSystem) && taskstate)
|
if (RuleB(TaskSystem, EnableTaskSystem) && task_state)
|
||||||
taskstate->CancelTask(this, cts->SequenceNumber, static_cast<TaskType>(cts->type));
|
task_state->CancelTask(this, cts->SequenceNumber, static_cast<TaskType>(cts->type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app)
|
void Client::Handle_OP_CancelTrade(const EQApplicationPacket *app)
|
||||||
@ -13996,8 +13996,8 @@ void Client::Handle_OP_TaskHistoryRequest(const EQApplicationPacket *app)
|
|||||||
}
|
}
|
||||||
TaskHistoryRequest_Struct *ths = (TaskHistoryRequest_Struct*)app->pBuffer;
|
TaskHistoryRequest_Struct *ths = (TaskHistoryRequest_Struct*)app->pBuffer;
|
||||||
|
|
||||||
if (RuleB(TaskSystem, EnableTaskSystem) && taskstate)
|
if (RuleB(TaskSystem, EnableTaskSystem) && task_state)
|
||||||
taskstate->SendTaskHistory(this, ths->TaskIndex);
|
task_state->SendTaskHistory(this, ths->TaskIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_Taunt(const EQApplicationPacket *app)
|
void Client::Handle_OP_Taunt(const EQApplicationPacket *app)
|
||||||
|
|||||||
@ -158,8 +158,8 @@ bool Client::Process() {
|
|||||||
CalcItemScale();
|
CalcItemScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TaskPeriodic_Timer.Check() && taskstate)
|
if (TaskPeriodic_Timer.Check() && task_state)
|
||||||
taskstate->TaskPeriodicChecks(this);
|
task_state->TaskPeriodicChecks(this);
|
||||||
|
|
||||||
if (dynamiczone_removal_timer.Check() && zone && zone->GetInstanceID() != 0)
|
if (dynamiczone_removal_timer.Check() && zone && zone->GetInstanceID() != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern TaskManager *taskmanager;
|
extern TaskManager *p_task_manager;
|
||||||
extern FastMath g_Math;
|
extern FastMath g_Math;
|
||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
|
|
||||||
|
|||||||
@ -3900,7 +3900,7 @@ void EntityList::ProcessProximitySay(const char *Message, Client *c, uint8 langu
|
|||||||
|
|
||||||
void EntityList::SaveAllClientsTaskState()
|
void EntityList::SaveAllClientsTaskState()
|
||||||
{
|
{
|
||||||
if (!taskmanager)
|
if (!p_task_manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto it = client_list.begin();
|
auto it = client_list.begin();
|
||||||
@ -3915,7 +3915,7 @@ void EntityList::SaveAllClientsTaskState()
|
|||||||
|
|
||||||
void EntityList::ReloadAllClientsTaskState(int TaskID)
|
void EntityList::ReloadAllClientsTaskState(int TaskID)
|
||||||
{
|
{
|
||||||
if (!taskmanager)
|
if (!p_task_manager)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto it = client_list.begin();
|
auto it = client_list.begin();
|
||||||
@ -3928,7 +3928,7 @@ void EntityList::ReloadAllClientsTaskState(int TaskID)
|
|||||||
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName());
|
Log(Logs::General, Logs::Tasks, "[CLIENTLOAD] Reloading Task State For Client %s", client->GetName());
|
||||||
client->RemoveClientTaskState();
|
client->RemoveClientTaskState();
|
||||||
client->LoadClientTaskState();
|
client->LoadClientTaskState();
|
||||||
taskmanager->SendActiveTasksToClient(client);
|
p_task_manager->SendActiveTasksToClient(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@ -115,8 +115,8 @@ char errorname[32];
|
|||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
npcDecayTimes_Struct npcCorpseDecayTimes[100];
|
npcDecayTimes_Struct npcCorpseDecayTimes[100];
|
||||||
TitleManager title_manager;
|
TitleManager title_manager;
|
||||||
QueryServ *QServ = 0;
|
QueryServ *QServ = 0;
|
||||||
TaskManager *taskmanager = 0;
|
TaskManager *p_task_manager = 0;
|
||||||
NpcScaleManager *npc_scale_manager;
|
NpcScaleManager *npc_scale_manager;
|
||||||
QuestParserCollection *parse = 0;
|
QuestParserCollection *parse = 0;
|
||||||
EQEmuLogSys LogSys;
|
EQEmuLogSys LogSys;
|
||||||
@ -427,8 +427,8 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
||||||
Log(Logs::General, Logs::Tasks, "[INIT] Loading Tasks");
|
Log(Logs::General, Logs::Tasks, "[INIT] Loading Tasks");
|
||||||
taskmanager = new TaskManager;
|
p_task_manager = new TaskManager;
|
||||||
taskmanager->LoadTasks();
|
p_task_manager->LoadTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
parse = new QuestParserCollection();
|
parse = new QuestParserCollection();
|
||||||
@ -607,7 +607,7 @@ int main(int argc, char** argv) {
|
|||||||
if (zone != 0)
|
if (zone != 0)
|
||||||
Zone::Shutdown(true);
|
Zone::Shutdown(true);
|
||||||
//Fix for Linux world server problem.
|
//Fix for Linux world server problem.
|
||||||
safe_delete(taskmanager);
|
safe_delete(p_task_manager);
|
||||||
command_deinit();
|
command_deinit();
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
bot_command_deinit();
|
bot_command_deinit();
|
||||||
|
|||||||
@ -2223,27 +2223,27 @@ bool QuestManager::createBot(const char *name, const char *lastname, uint8 level
|
|||||||
|
|
||||||
void QuestManager::taskselector(int taskcount, int *tasks) {
|
void QuestManager::taskselector(int taskcount, int *tasks) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && p_task_manager)
|
||||||
initiator->TaskQuestSetSelector(owner, taskcount, tasks);
|
initiator->TaskQuestSetSelector(owner, taskcount, tasks);
|
||||||
}
|
}
|
||||||
void QuestManager::enabletask(int taskcount, int *tasks) {
|
void QuestManager::enabletask(int taskcount, int *tasks) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && p_task_manager)
|
||||||
initiator->EnableTask(taskcount, tasks);
|
initiator->EnableTask(taskcount, tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuestManager::disabletask(int taskcount, int *tasks) {
|
void QuestManager::disabletask(int taskcount, int *tasks) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && p_task_manager)
|
||||||
initiator->DisableTask(taskcount, tasks);
|
initiator->DisableTask(taskcount, tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QuestManager::istaskenabled(int taskid) {
|
bool QuestManager::istaskenabled(int taskid) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && p_task_manager)
|
||||||
return initiator->IsTaskEnabled(taskid);
|
return initiator->IsTaskEnabled(taskid);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -2252,7 +2252,7 @@ bool QuestManager::istaskenabled(int taskid) {
|
|||||||
void QuestManager::tasksetselector(int tasksetid) {
|
void QuestManager::tasksetselector(int tasksetid) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid);
|
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskSetSelector called for task set %i", tasksetid);
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && owner && p_task_manager)
|
||||||
initiator->TaskSetSelector(owner, tasksetid);
|
initiator->TaskSetSelector(owner, tasksetid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2341,8 +2341,8 @@ int QuestManager::enabledtaskcount(int taskset) {
|
|||||||
int QuestManager::firsttaskinset(int taskset) {
|
int QuestManager::firsttaskinset(int taskset) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && p_task_manager)
|
||||||
return taskmanager->FirstTaskInSet(taskset);
|
return p_task_manager->FirstTaskInSet(taskset);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2350,8 +2350,8 @@ int QuestManager::firsttaskinset(int taskset) {
|
|||||||
int QuestManager::lasttaskinset(int taskset) {
|
int QuestManager::lasttaskinset(int taskset) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && p_task_manager)
|
||||||
return taskmanager->LastTaskInSet(taskset);
|
return p_task_manager->LastTaskInSet(taskset);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2359,8 +2359,8 @@ int QuestManager::lasttaskinset(int taskset) {
|
|||||||
int QuestManager::nexttaskinset(int taskset, int taskid) {
|
int QuestManager::nexttaskinset(int taskset, int taskid) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && p_task_manager)
|
||||||
return taskmanager->NextTaskInSet(taskset, taskid);
|
return p_task_manager->NextTaskInSet(taskset, taskid);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2412,8 +2412,8 @@ int QuestManager::completedtasksinset(int taskset) {
|
|||||||
bool QuestManager::istaskappropriate(int task) {
|
bool QuestManager::istaskappropriate(int task) {
|
||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && taskmanager)
|
if(RuleB(TaskSystem, EnableTaskSystem) && initiator && p_task_manager)
|
||||||
return taskmanager->AppropriateLevel(task, initiator->GetLevel());
|
return p_task_manager->ValidateLevel(task, initiator->GetLevel());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2422,7 +2422,7 @@ std::string QuestManager::gettaskname(uint32 task_id) {
|
|||||||
QuestManagerCurrentQuestVars();
|
QuestManagerCurrentQuestVars();
|
||||||
|
|
||||||
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
||||||
return taskmanager->GetTaskName(task_id);
|
return p_task_manager->GetTaskName(task_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::string();
|
return std::string();
|
||||||
|
|||||||
3343
zone/tasks.cpp
3343
zone/tasks.cpp
File diff suppressed because it is too large
Load Diff
292
zone/tasks.h
292
zone/tasks.h
@ -39,23 +39,22 @@ Copyright (C) 2001-2004 EQEMu Development Team (http://eqemulator.net)
|
|||||||
#define TASKSLOTEMPTY 0
|
#define TASKSLOTEMPTY 0
|
||||||
|
|
||||||
// Command Codes for worldserver ServerOP_ReloadTasks
|
// Command Codes for worldserver ServerOP_ReloadTasks
|
||||||
//
|
#define RELOADTASKS 0
|
||||||
#define RELOADTASKS 0
|
#define RELOADTASKGOALLISTS 1
|
||||||
#define RELOADTASKGOALLISTS 1
|
#define RELOADTASKPROXIMITIES 2
|
||||||
#define RELOADTASKPROXIMITIES 2
|
#define RELOADTASKSETS 3
|
||||||
#define RELOADTASKSETS 3
|
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
|
|
||||||
class Mob;
|
class Mob;
|
||||||
|
|
||||||
namespace EQ
|
namespace EQ {
|
||||||
{
|
|
||||||
class ItemInstance;
|
class ItemInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TaskGoalList_Struct {
|
struct TaskGoalList_Struct {
|
||||||
int ListID;
|
int ListID;
|
||||||
int Min, Max;
|
int Min, Max;
|
||||||
std::vector<int> GoalItemEntries;
|
std::vector<int> GoalItemEntries;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,11 +76,11 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector<TaskGoalList_Struct> TaskGoalLists;
|
std::vector<TaskGoalList_Struct> TaskGoalLists;
|
||||||
int NumberOfLists;
|
int NumberOfLists;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int ExploreID;
|
int ExploreID;
|
||||||
float MinX, MaxX, MinY, MaxY, MinZ, MaxZ;
|
float MinX, MaxX, MinY, MaxY, MinZ, MaxZ;
|
||||||
} TaskProximity;
|
} TaskProximity;
|
||||||
|
|
||||||
@ -98,99 +97,122 @@ private:
|
|||||||
std::vector<TaskProximity> TaskProximities;
|
std::vector<TaskProximity> TaskProximities;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum { METHODSINGLEID = 0, METHODLIST = 1, METHODQUEST = 2 } TaskMethodType;
|
typedef enum {
|
||||||
|
METHODSINGLEID = 0,
|
||||||
|
METHODLIST = 1,
|
||||||
|
METHODQUEST = 2
|
||||||
|
} TaskMethodType;
|
||||||
|
|
||||||
struct ActivityInformation {
|
struct ActivityInformation {
|
||||||
int StepNumber;
|
int StepNumber;
|
||||||
int Type;
|
int Type;
|
||||||
std::string target_name; // name mob, location -- default empty
|
std::string target_name; // name mob, location -- default empty
|
||||||
std::string item_list; // likely defaults to empty
|
std::string item_list; // likely defaults to empty
|
||||||
std::string skill_list; // IDs ; separated -- default -1
|
std::string skill_list; // IDs ; separated -- default -1
|
||||||
std::string spell_list; // IDs ; separated -- default 0
|
std::string spell_list; // IDs ; separated -- default 0
|
||||||
std::string desc_override; // overrides auto generated description -- default empty
|
std::string desc_override; // overrides auto generated description -- default empty
|
||||||
int skill_id; // older clients, first id from above
|
int skill_id; // older clients, first id from above
|
||||||
int spell_id; // older clients, first id from above
|
int spell_id; // older clients, first id from above
|
||||||
int GoalID;
|
int GoalID;
|
||||||
TaskMethodType GoalMethod;
|
TaskMethodType GoalMethod;
|
||||||
int GoalCount;
|
int GoalCount;
|
||||||
int DeliverToNPC;
|
int DeliverToNPC;
|
||||||
std::vector<int> ZoneIDs;
|
std::vector<int> ZoneIDs;
|
||||||
std::string zones; // IDs ; searated, ZoneID is the first in this list for older clients -- default empty string
|
std::string zones; // IDs ; searated, ZoneID is the first in this list for older clients -- default empty string
|
||||||
bool Optional;
|
bool Optional;
|
||||||
|
|
||||||
inline bool CheckZone(int zone_id) {
|
inline bool CheckZone(int zone_id)
|
||||||
if (ZoneIDs.empty())
|
{
|
||||||
|
if (ZoneIDs.empty()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return std::find(ZoneIDs.begin(), ZoneIDs.end(), zone_id) != ZoneIDs.end();
|
return std::find(ZoneIDs.begin(), ZoneIDs.end(), zone_id) != ZoneIDs.end();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum { ActivitiesSequential = 0, ActivitiesStepped = 1 } SequenceType;
|
typedef enum {
|
||||||
|
ActivitiesSequential = 0, ActivitiesStepped = 1
|
||||||
|
} SequenceType;
|
||||||
|
|
||||||
enum class TaskType {
|
enum class TaskType {
|
||||||
Task = 0, // can have at max 1
|
Task = 0, // can have at max 1
|
||||||
Shared = 1, // can have at max 1
|
Shared = 1, // can have at max 1
|
||||||
Quest = 2, // can have at max 19 or 29 depending on client
|
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
|
E = 3 // can have at max 19 or 29 depending on client, not present in live anymore
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DurationCode {
|
enum class DurationCode {
|
||||||
None = 0,
|
None = 0,
|
||||||
Short = 1,
|
Short = 1,
|
||||||
Medium = 2,
|
Medium = 2,
|
||||||
Long = 3
|
Long = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TaskInformation {
|
struct TaskInformation {
|
||||||
TaskType type;
|
TaskType type;
|
||||||
int Duration;
|
int duration;
|
||||||
DurationCode dur_code; // description for time investment for when Duration == 0
|
DurationCode duration_code; // description for time investment for when duration == 0
|
||||||
std::string Title; // max length 64
|
std::string title; // max length 64
|
||||||
std::string Description; // max length 4000, 2048 on Tit
|
std::string description; // max length 4000, 2048 on Tit
|
||||||
std::string Reward;
|
std::string reward;
|
||||||
std::string item_link; // max length 128 older clients, item link gets own string
|
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!
|
std::string completion_emote; // emote after completing task, yellow. Maybe should make more generic ... but yellow for now!
|
||||||
int RewardID;
|
int reward_id;
|
||||||
int CashReward; // Expressed in copper
|
int cash_reward; // Expressed in copper
|
||||||
int XPReward;
|
int experience_reward;
|
||||||
int faction_reward; // just a npc_faction_id
|
int faction_reward; // just a npc_faction_id
|
||||||
TaskMethodType RewardMethod;
|
TaskMethodType reward_method;
|
||||||
int ActivityCount;
|
int activity_count;
|
||||||
SequenceType SequenceMode;
|
SequenceType sequence_mode;
|
||||||
int LastStep;
|
int last_step;
|
||||||
short MinLevel;
|
short min_level;
|
||||||
short MaxLevel;
|
short max_level;
|
||||||
bool Repeatable;
|
bool repeatable;
|
||||||
ActivityInformation Activity[MAXACTIVITIESPERTASK];
|
ActivityInformation activity_information[MAXACTIVITIESPERTASK];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum { ActivityHidden = 0, ActivityActive = 1, ActivityCompleted = 2 } ActivityState;
|
typedef enum {
|
||||||
|
ActivityHidden = 0,
|
||||||
typedef enum { ActivityDeliver = 1, ActivityKill = 2, ActivityLoot = 3, ActivitySpeakWith = 4, ActivityExplore = 5,
|
ActivityActive = 1,
|
||||||
ActivityTradeSkill = 6, ActivityFish = 7, ActivityForage = 8, ActivityCastOn = 9, ActivitySkillOn = 10,
|
ActivityCompleted = 2
|
||||||
ActivityTouch = 11, ActivityCollect = 13, ActivityGiveCash = 100 } ActivityType;
|
} ActivityState;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ActivityDeliver = 1,
|
||||||
|
ActivityKill = 2,
|
||||||
|
ActivityLoot = 3,
|
||||||
|
ActivitySpeakWith = 4,
|
||||||
|
ActivityExplore = 5,
|
||||||
|
ActivityTradeSkill = 6,
|
||||||
|
ActivityFish = 7,
|
||||||
|
ActivityForage = 8,
|
||||||
|
ActivityCastOn = 9,
|
||||||
|
ActivitySkillOn = 10,
|
||||||
|
ActivityTouch = 11,
|
||||||
|
ActivityCollect = 13,
|
||||||
|
ActivityGiveCash = 100
|
||||||
|
} ActivityType;
|
||||||
|
|
||||||
struct ClientActivityInformation {
|
struct ClientActivityInformation {
|
||||||
int ActivityID;
|
int activity_id;
|
||||||
int DoneCount;
|
int done_count;
|
||||||
ActivityState State;
|
ActivityState activity_state;
|
||||||
bool Updated; // Flag so we know if we need to update the database
|
bool updated; // Flag so we know if we need to updated the database
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ClientTaskInformation {
|
struct ClientTaskInformation {
|
||||||
int slot; // intrusive, but makes things easier :P
|
int slot; // intrusive, but makes things easier :P
|
||||||
int TaskID;
|
int task_id;
|
||||||
int CurrentStep;
|
int current_step;
|
||||||
int AcceptedTime;
|
int accepted_time;
|
||||||
bool Updated;
|
bool updated;
|
||||||
ClientActivityInformation Activity[MAXACTIVITIESPERTASK];
|
ClientActivityInformation activity[MAXACTIVITIESPERTASK];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CompletedTaskInformation {
|
struct CompletedTaskInformation {
|
||||||
int TaskID;
|
int task_id;
|
||||||
int CompletedTime;
|
int completed_time;
|
||||||
bool ActivityDone[MAXACTIVITIESPERTASK];
|
bool activity_done[MAXACTIVITIESPERTASK];
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClientTaskState {
|
class ClientTaskState {
|
||||||
@ -199,7 +221,7 @@ public:
|
|||||||
ClientTaskState();
|
ClientTaskState();
|
||||||
~ClientTaskState();
|
~ClientTaskState();
|
||||||
void ShowClientTasks(Client *c);
|
void ShowClientTasks(Client *c);
|
||||||
inline int GetActiveTaskCount() { return ActiveTaskCount; }
|
inline int GetActiveTaskCount() { return active_task_count; }
|
||||||
int GetActiveTaskID(int index);
|
int GetActiveTaskID(int index);
|
||||||
bool IsTaskActivityCompleted(TaskType type, int index, int ActivityID);
|
bool IsTaskActivityCompleted(TaskType type, int index, int ActivityID);
|
||||||
int GetTaskActivityDoneCount(TaskType type, int index, int ActivityID);
|
int GetTaskActivityDoneCount(TaskType type, int index, int ActivityID);
|
||||||
@ -218,67 +240,76 @@ public:
|
|||||||
void CancelAllTasks(Client *c);
|
void CancelAllTasks(Client *c);
|
||||||
void RemoveTask(Client *c, int SequenceNumber, TaskType type);
|
void RemoveTask(Client *c, int SequenceNumber, TaskType type);
|
||||||
void RemoveTaskByTaskID(Client *c, uint32 task_id);
|
void RemoveTaskByTaskID(Client *c, uint32 task_id);
|
||||||
bool UpdateTasksByNPC(Client *c, int ActivityType, int NPCTypeID);
|
bool UpdateTasksByNPC(Client *c, int activity_type, int npc_type_id);
|
||||||
void UpdateTasksOnKill(Client *c, int NPCTypeID);
|
void UpdateTasksOnKill(Client *c, int NPCTypeID);
|
||||||
void UpdateTasksForItem(Client *c, ActivityType Type, int ItemID, int Count=1);
|
void UpdateTasksForItem(Client *c, ActivityType Type, int ItemID, int Count = 1);
|
||||||
void UpdateTasksOnExplore(Client *c, int ExploreID);
|
void UpdateTasksOnExplore(Client *c, int ExploreID);
|
||||||
bool UpdateTasksOnSpeakWith(Client *c, int NPCTypeID);
|
bool UpdateTasksOnSpeakWith(Client *c, int NPCTypeID);
|
||||||
bool UpdateTasksOnDeliver(Client *c, std::list<EQ::ItemInstance*>& Items, int Cash, int NPCTypeID);
|
bool UpdateTasksOnDeliver(Client *c, std::list<EQ::ItemInstance *> &Items, int Cash, int NPCTypeID);
|
||||||
void UpdateTasksOnTouch(Client *c, int ZoneID);
|
void UpdateTasksOnTouch(Client *c, int ZoneID);
|
||||||
void ProcessTaskProximities(Client *c, float X, float Y, float Z);
|
void ProcessTaskProximities(Client *c, float X, float Y, float Z);
|
||||||
bool TaskOutOfTime(TaskType type, int Index);
|
bool TaskOutOfTime(TaskType type, int Index);
|
||||||
void TaskPeriodicChecks(Client *c);
|
void TaskPeriodicChecks(Client *c);
|
||||||
void SendTaskHistory(Client *c, int TaskIndex);
|
void SendTaskHistory(Client *c, int TaskIndex);
|
||||||
void RewardTask(Client *c, TaskInformation *Task);
|
void RewardTask(Client *c, TaskInformation *Task);
|
||||||
void EnableTask(int CharID, int TaskCount, int *TaskList);
|
void EnableTask(int character_id, int task_count, int *TaskList);
|
||||||
void DisableTask(int CharID, int TaskCount, int *TaskList);
|
void DisableTask(int character_id, int task_count, int *task_list);
|
||||||
bool IsTaskEnabled(int TaskID);
|
bool IsTaskEnabled(int TaskID);
|
||||||
int EnabledTaskCount(int TaskSetID);
|
int EnabledTaskCount(int TaskSetID);
|
||||||
int ActiveSpeakTask(int NPCID);
|
int ActiveSpeakTask(int npc_type_id);
|
||||||
int ActiveSpeakActivity(int NPCID, int TaskID);
|
int ActiveSpeakActivity(int npc_type_id, int task_id);
|
||||||
int ActiveTasksInSet(int TaskSetID);
|
int ActiveTasksInSet(int TaskSetID);
|
||||||
int CompletedTasksInSet(int TaskSetID);
|
int CompletedTasksInSet(int TaskSetID);
|
||||||
bool HasSlotForTask(TaskInformation *task);
|
bool HasSlotForTask(TaskInformation *task);
|
||||||
|
|
||||||
inline bool HasFreeTaskSlot() { return ActiveTask.TaskID == TASKSLOTEMPTY; }
|
inline bool HasFreeTaskSlot() { return active_task.task_id == TASKSLOTEMPTY; }
|
||||||
|
|
||||||
friend class TaskManager;
|
friend class TaskManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool UnlockActivities(int CharID, ClientTaskInformation &task_info);
|
bool UnlockActivities(int character_id, ClientTaskInformation &task_info);
|
||||||
void IncrementDoneCount(Client *c, TaskInformation *Task, int TaskIndex, int ActivityID, int Count = 1, bool ignore_quest_update = false);
|
void IncrementDoneCount(
|
||||||
|
Client *c,
|
||||||
|
TaskInformation *Task,
|
||||||
|
int TaskIndex,
|
||||||
|
int ActivityID,
|
||||||
|
int Count = 1,
|
||||||
|
bool ignore_quest_update = false
|
||||||
|
);
|
||||||
inline ClientTaskInformation *GetClientTaskInfo(TaskType type, int index)
|
inline ClientTaskInformation *GetClientTaskInfo(TaskType type, int index)
|
||||||
{
|
{
|
||||||
ClientTaskInformation *info = nullptr;
|
ClientTaskInformation *info = nullptr;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TaskType::Task:
|
case TaskType::Task:
|
||||||
if (index == 0)
|
if (index == 0) {
|
||||||
info = &ActiveTask;
|
info = &active_task;
|
||||||
break;
|
}
|
||||||
case TaskType::Shared:
|
break;
|
||||||
break;
|
case TaskType::Shared:
|
||||||
case TaskType::Quest:
|
break;
|
||||||
if (index < MAXACTIVEQUESTS)
|
case TaskType::Quest:
|
||||||
info = &ActiveQuests[index];
|
if (index < MAXACTIVEQUESTS) {
|
||||||
break;
|
info = &active_quests[index];
|
||||||
default:
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
int ActiveTaskCount;
|
int active_task_count;
|
||||||
union { // easier to loop over
|
union { // easier to loop over
|
||||||
struct {
|
struct {
|
||||||
ClientTaskInformation ActiveTask; // only one
|
ClientTaskInformation active_task; // only one
|
||||||
ClientTaskInformation ActiveQuests[MAXACTIVEQUESTS];
|
ClientTaskInformation active_quests[MAXACTIVEQUESTS];
|
||||||
};
|
};
|
||||||
ClientTaskInformation ActiveTasks[MAXACTIVEQUESTS + 1];
|
ClientTaskInformation ActiveTasks[MAXACTIVEQUESTS + 1];
|
||||||
};
|
};
|
||||||
// Shared tasks should be limited to 1 as well
|
// Shared tasks should be limited to 1 as well
|
||||||
std::vector<int> EnabledTasks;
|
std::vector<int> enabled_tasks;
|
||||||
std::vector<CompletedTaskInformation> CompletedTasks;
|
std::vector<CompletedTaskInformation> completed_tasks;
|
||||||
int LastCompletedTaskLoaded;
|
int last_completed_task_loaded;
|
||||||
bool CheckedTouchActivities;
|
bool checked_touch_activities;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -289,7 +320,7 @@ public:
|
|||||||
~TaskManager();
|
~TaskManager();
|
||||||
int GetActivityCount(int TaskID);
|
int GetActivityCount(int TaskID);
|
||||||
bool LoadSingleTask(int TaskID);
|
bool LoadSingleTask(int TaskID);
|
||||||
bool LoadTasks(int SingleTask=0);
|
bool LoadTasks(int SingleTask = 0);
|
||||||
void ReloadGoalLists();
|
void ReloadGoalLists();
|
||||||
inline void LoadProximities(int ZoneID) { ProximityManager.LoadProximities(ZoneID); }
|
inline void LoadProximities(int ZoneID) { ProximityManager.LoadProximities(ZoneID); }
|
||||||
bool LoadTaskSets();
|
bool LoadTaskSets();
|
||||||
@ -297,35 +328,58 @@ public:
|
|||||||
bool SaveClientState(Client *c, ClientTaskState *state);
|
bool SaveClientState(Client *c, ClientTaskState *state);
|
||||||
void SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *TaskList);
|
void SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *TaskList);
|
||||||
void SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList);
|
void SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *TaskList);
|
||||||
bool AppropriateLevel(int TaskID, int PlayerLevel);
|
bool ValidateLevel(int TaskID, int PlayerLevel);
|
||||||
int GetTaskMinLevel(int TaskID);
|
int GetTaskMinLevel(int TaskID);
|
||||||
int GetTaskMaxLevel(int TaskID);
|
int GetTaskMaxLevel(int TaskID);
|
||||||
std::string GetTaskName(uint32 task_id);
|
std::string GetTaskName(uint32 task_id);
|
||||||
TaskType GetTaskType(uint32 task_id);
|
TaskType GetTaskType(uint32 task_id);
|
||||||
void TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, int TaskSetID);
|
void TaskSetSelector(Client *c, ClientTaskState *state, Mob *mob, int TaskSetID);
|
||||||
void TaskQuestSetSelector(Client *c, ClientTaskState *state, Mob *mob, int count, int *tasks); // task list provided by QuestManager (perl/lua)
|
void TaskQuestSetSelector(
|
||||||
void SendActiveTasksToClient(Client *c, bool TaskComplete=false);
|
Client *c,
|
||||||
void SendSingleActiveTaskToClient(Client *c, ClientTaskInformation &task_info, bool TaskComplete, bool BringUpTaskJournal = false);
|
ClientTaskState *state,
|
||||||
|
Mob *mob,
|
||||||
|
int count,
|
||||||
|
int *tasks
|
||||||
|
); // task list provided by QuestManager (perl/lua)
|
||||||
|
void SendActiveTasksToClient(Client *c, bool TaskComplete = false);
|
||||||
|
void SendSingleActiveTaskToClient(
|
||||||
|
Client *c,
|
||||||
|
ClientTaskInformation &task_info,
|
||||||
|
bool TaskComplete,
|
||||||
|
bool BringUpTaskJournal = false
|
||||||
|
);
|
||||||
void SendTaskActivityShort(Client *c, int TaskID, int ActivityID, int ClientTaskIndex);
|
void SendTaskActivityShort(Client *c, int TaskID, int ActivityID, int ClientTaskIndex);
|
||||||
void SendTaskActivityLong(Client *c, int TaskID, int ActivityID, int ClientTaskIndex,
|
void SendTaskActivityLong(
|
||||||
bool Optional, bool TaskComplete=false);
|
Client *c, int TaskID, int ActivityID, int ClientTaskIndex,
|
||||||
void SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int ClientTaskIndex,
|
bool Optional, bool TaskComplete = false
|
||||||
bool Optional, bool TaskComplete=false);
|
);
|
||||||
|
void SendTaskActivityNew(
|
||||||
|
Client *c, int TaskID, int ActivityID, int ClientTaskIndex,
|
||||||
|
bool Optional, bool TaskComplete = false
|
||||||
|
);
|
||||||
void SendCompletedTasksToClient(Client *c, ClientTaskState *state);
|
void SendCompletedTasksToClient(Client *c, ClientTaskState *state);
|
||||||
void ExplainTask(Client *c, int TaskID);
|
void ExplainTask(Client *c, int TaskID);
|
||||||
int FirstTaskInSet(int TaskSet);
|
int FirstTaskInSet(int TaskSet);
|
||||||
int LastTaskInSet(int TaskSet);
|
int LastTaskInSet(int TaskSet);
|
||||||
int NextTaskInSet(int TaskSet, int TaskID);
|
int NextTaskInSet(int TaskSet, int TaskID);
|
||||||
bool IsTaskRepeatable(int TaskID);
|
bool IsTaskRepeatable(int TaskID);
|
||||||
|
|
||||||
friend class ClientTaskState;
|
friend class ClientTaskState;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskGoalListManager GoalListManager;
|
TaskGoalListManager GoalListManager;
|
||||||
TaskProximityManager ProximityManager;
|
TaskProximityManager ProximityManager;
|
||||||
TaskInformation* Tasks[MAXTASKS];
|
TaskInformation *Tasks[MAXTASKS];
|
||||||
std::vector<int> TaskSets[MAXTASKSETS];
|
std::vector<int> TaskSets[MAXTASKSETS];
|
||||||
void SendActiveTaskDescription(Client *c, int TaskID, ClientTaskInformation &task_info, int StartTime, int Duration, bool BringUpTaskJournal=false);
|
void SendActiveTaskDescription(
|
||||||
|
Client *c,
|
||||||
|
int TaskID,
|
||||||
|
ClientTaskInformation &task_info,
|
||||||
|
int StartTime,
|
||||||
|
int Duration,
|
||||||
|
bool BringUpTaskJournal = false
|
||||||
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -3100,16 +3100,16 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack)
|
|||||||
|
|
||||||
if (rts->Parameter == 0) {
|
if (rts->Parameter == 0) {
|
||||||
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload ALL tasks");
|
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload ALL tasks");
|
||||||
safe_delete(taskmanager);
|
safe_delete(p_task_manager);
|
||||||
taskmanager = new TaskManager;
|
p_task_manager = new TaskManager;
|
||||||
taskmanager->LoadTasks();
|
p_task_manager->LoadTasks();
|
||||||
if (zone)
|
if (zone)
|
||||||
taskmanager->LoadProximities(zone->GetZoneID());
|
p_task_manager->LoadProximities(zone->GetZoneID());
|
||||||
entity_list.ReloadAllClientsTaskState();
|
entity_list.ReloadAllClientsTaskState();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter);
|
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload only task %i", rts->Parameter);
|
||||||
taskmanager->LoadTasks(rts->Parameter);
|
p_task_manager->LoadTasks(rts->Parameter);
|
||||||
entity_list.ReloadAllClientsTaskState(rts->Parameter);
|
entity_list.ReloadAllClientsTaskState(rts->Parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3118,18 +3118,18 @@ void WorldServer::HandleReloadTasks(ServerPacket *pack)
|
|||||||
case RELOADTASKPROXIMITIES:
|
case RELOADTASKPROXIMITIES:
|
||||||
if (zone) {
|
if (zone) {
|
||||||
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task proximities");
|
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task proximities");
|
||||||
taskmanager->LoadProximities(zone->GetZoneID());
|
p_task_manager->LoadProximities(zone->GetZoneID());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RELOADTASKGOALLISTS:
|
case RELOADTASKGOALLISTS:
|
||||||
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task goal lists");
|
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task goal lists");
|
||||||
taskmanager->ReloadGoalLists();
|
p_task_manager->ReloadGoalLists();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RELOADTASKSETS:
|
case RELOADTASKSETS:
|
||||||
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task sets");
|
Log(Logs::General, Logs::Tasks, "[GLOBALLOAD] Reload task sets");
|
||||||
taskmanager->LoadTaskSets();
|
p_task_manager->LoadTaskSets();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -964,7 +964,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
|||||||
lootvar = 0;
|
lootvar = 0;
|
||||||
|
|
||||||
if(RuleB(TaskSystem, EnableTaskSystem)) {
|
if(RuleB(TaskSystem, EnableTaskSystem)) {
|
||||||
taskmanager->LoadProximities(zoneid);
|
p_task_manager->LoadProximities(zoneid);
|
||||||
}
|
}
|
||||||
|
|
||||||
short_name = strcpy(new char[strlen(in_short_name)+1], in_short_name);
|
short_name = strcpy(new char[strlen(in_short_name)+1], in_short_name);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user