mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Improve GM command interface UI
This commit is contained in:
parent
053bdb8646
commit
5fba138a5a
@ -1227,7 +1227,7 @@ public:
|
||||
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 ShowClientTasks(Client *client) { if (task_state) { task_state->ShowClientTasks(client); }}
|
||||
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); }
|
||||
|
||||
139
zone/command.cpp
139
zone/command.cpp
@ -10169,76 +10169,135 @@ void command_rules(Client *c, const Seperator *sep) {
|
||||
void command_task(Client *c, const Seperator *sep) {
|
||||
//super-command for managing tasks
|
||||
if(sep->arg[1][0] == '\0' || !strcasecmp(sep->arg[1], "help")) {
|
||||
c->Message(Chat::White, "Syntax: #task [subcommand].");
|
||||
c->Message(Chat::White, "-- Task System Commands --");
|
||||
c->Message(Chat::White, "...show - List active tasks for a client");
|
||||
c->Message(Chat::White, "...update <TaskID> <ActivityID> [Count]");
|
||||
c->Message(Chat::White, "...reloadall - Reload all Task information from the database");
|
||||
c->Message(Chat::White, "...reload task <TaskID> - Reload Task and Activity informnation for a single task");
|
||||
c->Message(Chat::White, "...reload lists - Reload goal/reward list information");
|
||||
c->Message(Chat::White, "...reload prox - Reload proximity information");
|
||||
c->Message(Chat::White, "...reload sets - Reload task set information");
|
||||
c->Message(Chat::White, "Syntax: #task [subcommand]");
|
||||
c->Message(Chat::White, "------------------------------------------------");
|
||||
c->Message(Chat::White, "# Task System Commands");
|
||||
c->Message(Chat::White, "------------------------------------------------");
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"--- [{}] List active tasks for a client",
|
||||
EQ::SayLinkEngine::GenerateQuestSaylink("#task show", false, "show")
|
||||
).c_str()
|
||||
);
|
||||
c->Message(Chat::White, "--- update <task_id> <activity_id> [count] | Updates task");
|
||||
c->Message(Chat::White, "--- assign <task_id> | Assigns task to client");
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"--- [{}] Reload all Task information from the database",
|
||||
EQ::SayLinkEngine::GenerateQuestSaylink("#task reloadall", false, "reloadall")
|
||||
).c_str()
|
||||
);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"--- [{}] <task_id> Reload Task and Activity informnation for a single task",
|
||||
EQ::SayLinkEngine::GenerateQuestSaylink("#task reload task", false, "reload task")
|
||||
).c_str()
|
||||
);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"--- [{}] Reload goal/reward list information",
|
||||
EQ::SayLinkEngine::GenerateQuestSaylink("#task reload lists", false, "reload lists")
|
||||
).c_str()
|
||||
);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"--- [{}] Reload proximity information",
|
||||
EQ::SayLinkEngine::GenerateQuestSaylink("#task reload prox", false, "reload prox")
|
||||
).c_str()
|
||||
);
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"--- [{}] Reload task set information",
|
||||
EQ::SayLinkEngine::GenerateQuestSaylink("#task reload sets", false, "reload sets")
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!strcasecmp(sep->arg[1], "show")) {
|
||||
if(c->GetTarget() && c->GetTarget()->IsClient())
|
||||
c->GetTarget()->CastToClient()->ShowClientTasks();
|
||||
else
|
||||
c->ShowClientTasks();
|
||||
Client *client_target = c;
|
||||
if (c->GetTarget() && c->GetTarget()->IsClient()) {
|
||||
client_target = c->GetTarget()->CastToClient();
|
||||
}
|
||||
|
||||
if (!strcasecmp(sep->arg[1], "show")) {
|
||||
c->ShowClientTasks(client_target);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!strcasecmp(sep->arg[1], "update")) {
|
||||
if(sep->argnum>=3) {
|
||||
int TaskID = atoi(sep->arg[2]);
|
||||
int ActivityID = atoi(sep->arg[3]);
|
||||
int Count=1;
|
||||
if (!strcasecmp(sep->arg[1], "update")) {
|
||||
if (sep->argnum >= 3) {
|
||||
int task_id = atoi(sep->arg[2]);
|
||||
int activity_id = atoi(sep->arg[3]);
|
||||
int count = 1;
|
||||
|
||||
if(sep->argnum>=4) {
|
||||
Count = atoi(sep->arg[4]);
|
||||
if(Count <= 0)
|
||||
Count = 1;
|
||||
if (sep->argnum >= 4) {
|
||||
count = atoi(sep->arg[4]);
|
||||
if (count <= 0) {
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
c->Message(Chat::Yellow, "Updating Task %i, Activity %i, Count %i", TaskID, ActivityID, Count);
|
||||
c->UpdateTaskActivity(TaskID, ActivityID, Count);
|
||||
c->Message(
|
||||
Chat::Yellow,
|
||||
"Updating Task [%i] Activity [%i] Count [%i] for client [%s]",
|
||||
task_id,
|
||||
activity_id,
|
||||
count,
|
||||
client_target->GetCleanName()
|
||||
);
|
||||
client_target->UpdateTaskActivity(task_id, activity_id, count);
|
||||
c->ShowClientTasks(client_target);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!strcasecmp(sep->arg[1], "reloadall")) {
|
||||
|
||||
if (!strcasecmp(sep->arg[1], "assign")) {
|
||||
int task_id = atoi(sep->arg[2]);
|
||||
if ((task_id > 0) && (task_id < MAXTASKS)) {
|
||||
client_target->AssignTask(task_id, 0, false);
|
||||
c->Message(Chat::Yellow, "Assigned task [%i] to [%s]", task_id, client_target->GetCleanName());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcasecmp(sep->arg[1], "reloadall")) {
|
||||
c->Message(Chat::Yellow, "Sending reloadtasks to world");
|
||||
worldserver.SendReloadTasks(RELOADTASKS);
|
||||
c->Message(Chat::Yellow, "Back again");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!strcasecmp(sep->arg[1], "reload")) {
|
||||
if(sep->arg[2][0] != '\0') {
|
||||
if(!strcasecmp(sep->arg[2], "lists")) {
|
||||
if (!strcasecmp(sep->arg[1], "reload")) {
|
||||
if (sep->arg[2][0] != '\0') {
|
||||
if (!strcasecmp(sep->arg[2], "lists")) {
|
||||
c->Message(Chat::Yellow, "Sending reload lists to world");
|
||||
worldserver.SendReloadTasks(RELOADTASKGOALLISTS);
|
||||
c->Message(Chat::Yellow, "Back again");
|
||||
c->Message(Chat::Yellow, "Reloaded");
|
||||
return;
|
||||
}
|
||||
if(!strcasecmp(sep->arg[2], "prox")) {
|
||||
if (!strcasecmp(sep->arg[2], "prox")) {
|
||||
c->Message(Chat::Yellow, "Sending reload proximities to world");
|
||||
worldserver.SendReloadTasks(RELOADTASKPROXIMITIES);
|
||||
c->Message(Chat::Yellow, "Back again");
|
||||
c->Message(Chat::Yellow, "Reloaded");
|
||||
return;
|
||||
}
|
||||
if(!strcasecmp(sep->arg[2], "sets")) {
|
||||
if (!strcasecmp(sep->arg[2], "sets")) {
|
||||
c->Message(Chat::Yellow, "Sending reload task sets to world");
|
||||
worldserver.SendReloadTasks(RELOADTASKSETS);
|
||||
c->Message(Chat::Yellow, "Back again");
|
||||
c->Message(Chat::Yellow, "Reloaded");
|
||||
return;
|
||||
}
|
||||
if(!strcasecmp(sep->arg[2], "task") && (sep->arg[3][0] != '\0')) {
|
||||
int TaskID = atoi(sep->arg[3]);
|
||||
if((TaskID > 0) && (TaskID < MAXTASKS)) {
|
||||
c->Message(Chat::Yellow, "Sending reload task %i to world", TaskID);
|
||||
worldserver.SendReloadTasks(RELOADTASKS, TaskID);
|
||||
c->Message(Chat::Yellow, "Back again");
|
||||
if (!strcasecmp(sep->arg[2], "task") && (sep->arg[3][0] != '\0')) {
|
||||
int task_id = atoi(sep->arg[3]);
|
||||
if ((task_id > 0) && (task_id < MAXTASKS)) {
|
||||
c->Message(Chat::Yellow, "Sending reload task %i to world", task_id);
|
||||
worldserver.SendReloadTasks(RELOADTASKS, task_id);
|
||||
c->Message(Chat::Yellow, "Reloaded");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1052,7 +1052,6 @@ void ClientTaskState::IncrementDoneCount(
|
||||
Log(Logs::General, Logs::Tasks, "[UPDATE] IncrementDoneCount");
|
||||
|
||||
auto info = GetClientTaskInfo(task_information->type, task_index);
|
||||
|
||||
if (info == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -1557,7 +1556,9 @@ void ClientTaskState::ResetTaskActivity(Client *client, int task_id, int activit
|
||||
|
||||
void ClientTaskState::ShowClientTasks(Client *client)
|
||||
{
|
||||
client->Message(Chat::White, "Task Information:");
|
||||
client->Message(Chat::White, "------------------------------------------------");
|
||||
client->Message(Chat::White, "# Task Information | Client [%s]", client->GetCleanName());
|
||||
// client->Message(Chat::White, "------------------------------------------------");
|
||||
if (active_task.task_id != TASKSLOTEMPTY) {
|
||||
client->Message(
|
||||
Chat::White,
|
||||
@ -1586,27 +1587,51 @@ void ClientTaskState::ShowClientTasks(Client *client)
|
||||
continue;
|
||||
}
|
||||
|
||||
client->Message(Chat::White, "------------------------------------------------");
|
||||
client->Message(
|
||||
Chat::White, "Quest: %i %s", active_quest.task_id,
|
||||
Chat::White, "# Quest | task_id [%i] title [%s]",
|
||||
active_quest.task_id,
|
||||
p_task_manager->p_task_data[active_quest.task_id]->title.c_str()
|
||||
);
|
||||
client->Message(Chat::White, "------------------------------------------------");
|
||||
|
||||
client->Message(
|
||||
Chat::White,
|
||||
" description: [%s]\n",
|
||||
" -- Description [%s]\n",
|
||||
p_task_manager->p_task_data[active_quest.task_id]->description.c_str()
|
||||
);
|
||||
|
||||
for (int activity_id = 0; activity_id < p_task_manager->GetActivityCount(active_quest.task_id); activity_id++) {
|
||||
std::vector<std::string> update_increments = {"1", "5", "50"};
|
||||
std::string update_saylinks;
|
||||
|
||||
for (auto &increment: update_increments) {
|
||||
auto task_update_saylink = EQ::SayLinkEngine::GenerateQuestSaylink(
|
||||
fmt::format(
|
||||
"#task update {} {} {}",
|
||||
active_quest.task_id,
|
||||
active_quest.activity[activity_id].activity_id,
|
||||
increment
|
||||
),
|
||||
false,
|
||||
increment
|
||||
);
|
||||
|
||||
update_saylinks += "[" + task_update_saylink + "] ";
|
||||
}
|
||||
|
||||
client->Message(
|
||||
Chat::White,
|
||||
" activity_information: %2d, done_count: %2d, Status: %d (0=Hidden, 1=Active, 2=Complete)",
|
||||
" --- activity_id [%i] done_count [%i] state [%d] (0=hidden 1=active 2=complete) | Update %s",
|
||||
active_quest.activity[activity_id].activity_id,
|
||||
active_quest.activity[activity_id].done_count,
|
||||
active_quest.activity[activity_id].activity_state
|
||||
active_quest.activity[activity_id].activity_state,
|
||||
update_saylinks.c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
client->Message(Chat::White, "------------------------------------------------");
|
||||
}
|
||||
|
||||
// TODO: Shared Task
|
||||
|
||||
@ -1392,16 +1392,20 @@ bool TaskManager::LoadClientState(Client *client, ClientTaskState *client_task_s
|
||||
auto type = static_cast<TaskType>(character_task.type);
|
||||
|
||||
if ((task_id < 0) || (task_id >= MAXTASKS)) {
|
||||
LogTasks("[LoadClientState] Error: task_id [{}] out of range while loading character tasks from database",
|
||||
task_id);
|
||||
LogTasks(
|
||||
"[LoadClientState] Error: task_id [{}] out of range while loading character tasks from database",
|
||||
task_id
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
// client data bucket pointer
|
||||
auto task_info = client_task_state->GetClientTaskInfo(type, slot);
|
||||
|
||||
if (task_info == nullptr) {
|
||||
LogTasks("[LoadClientState] Error: slot [{}] out of range while loading character tasks from database",
|
||||
slot);
|
||||
LogTasks(
|
||||
"[LoadClientState] Error: slot [{}] out of range while loading character tasks from database",
|
||||
slot
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user