[Commands] Cleanup #devtools Command. (#2538)

* [Commands] Cleanup #devtools Command.

- Cleanup messages and logic.

* Update client.cpp
This commit is contained in:
Kinglykrab 2022-11-14 14:06:36 -05:00 committed by GitHub
parent aa506110e1
commit df57138a61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 29 deletions

View File

@ -9368,6 +9368,14 @@ bool Client::IsDevToolsEnabled() const
void Client::SetDevToolsEnabled(bool in_dev_tools_enabled)
{
const auto dev_tools_key = fmt::format("{}-dev-tools-disabled", AccountID());
if (in_dev_tools_enabled) {
DataBucket::DeleteData(dev_tools_key);
} else {
DataBucket::SetData(dev_tools_key, "true");
}
Client::dev_tools_enabled = in_dev_tools_enabled;
}

View File

@ -1725,8 +1725,8 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
* DevTools Load Settings
*/
if (Admin() >= EQ::DevTools::GM_ACCOUNT_STATUS_LEVEL) {
std::string dev_tools_window_key = StringFormat("%i-dev-tools-disabled", AccountID());
if (DataBucket::GetData(dev_tools_window_key) == "true") {
const auto dev_tools_key = fmt::format("{}-dev-tools-disabled", AccountID());
if (DataBucket::GetData(dev_tools_key) == "true") {
dev_tools_enabled = false;
}
}

View File

@ -122,7 +122,7 @@ int command_init(void)
command_add("delpetition", "[petition number] - Delete a petition", AccountStatus::ApprenticeGuide, command_delpetition) ||
command_add("depop", "[Start Spawn Timer] - Depop your NPC target and optionally start their spawn timer (false by default)", AccountStatus::Guide, command_depop) ||
command_add("depopzone", "Depop the zone", AccountStatus::GMAdmin, command_depopzone) ||
command_add("devtools", "Manages devtools", AccountStatus::GMMgmt, command_devtools) ||
command_add("devtools", "[Enable|Disable] - Manages Developer Tools (send no parameter for menu)", AccountStatus::GMMgmt, command_devtools) ||
command_add("disablerecipe", "[Recipe ID] - Disables a Recipe", AccountStatus::QuestTroupe, command_disablerecipe) ||
command_add("disarmtrap", "Analog for ldon disarm trap for the newer clients since we still don't have it working.", AccountStatus::QuestTroupe, command_disarmtrap) ||
command_add("distance", "Reports the distance between you and your target.", AccountStatus::QuestTroupe, command_distance) ||

View File

@ -3,18 +3,11 @@
void command_devtools(Client *c, const Seperator *sep)
{
std::string dev_tools_key = StringFormat("%i-dev-tools-disabled", c->AccountID());
bool is_disable = !strcasecmp(sep->arg[1], "disable");
bool is_enable = !strcasecmp(sep->arg[1], "enable");
/**
* Handle window toggle
*/
if (strcasecmp(sep->arg[1], "disable") == 0) {
DataBucket::SetData(dev_tools_key, "true");
c->SetDevToolsEnabled(false);
}
if (strcasecmp(sep->arg[1], "enable") == 0) {
DataBucket::DeleteData(dev_tools_key);
c->SetDevToolsEnabled(true);
if (is_disable || is_enable) {
c->SetDevToolsEnabled(is_enable);
}
c->ShowDevToolsMenu();