[Commands] Assign #opcode to a #reload alias (#3401)

* [Commands] Assign #opcode to a #reload alias

# Notes
- Can use `#reload opcodes

* Add ServerOP_ReloadOpcodes
This commit is contained in:
Alex King 2023-06-12 18:42:39 -04:00 committed by GitHub
parent f06a37a009
commit 18eff726d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 88 additions and 105 deletions

View File

@ -235,18 +235,19 @@
#define ServerOP_ReloadMerchants 0x4109
#define ServerOP_ReloadNPCEmotes 0x4110
#define ServerOP_ReloadObjects 0x4111
#define ServerOP_ReloadPerlExportSettings 0x4112
#define ServerOP_ReloadRules 0x4113
#define ServerOP_ReloadStaticZoneData 0x4114
#define ServerOP_ReloadTasks 0x4115
#define ServerOP_ReloadTitles 0x4116
#define ServerOP_ReloadTraps 0x4117
#define ServerOP_ReloadVariables 0x4118
#define ServerOP_ReloadVeteranRewards 0x4119
#define ServerOP_ReloadWorld 0x4120
#define ServerOP_ReloadZonePoints 0x4121
#define ServerOP_ReloadDzTemplates 0x4122
#define ServerOP_ReloadZoneData 0x4123
#define ServerOP_ReloadOpcodes 0x4112
#define ServerOP_ReloadPerlExportSettings 0x4113
#define ServerOP_ReloadRules 0x4114
#define ServerOP_ReloadStaticZoneData 0x4115
#define ServerOP_ReloadTasks 0x4116
#define ServerOP_ReloadTitles 0x4117
#define ServerOP_ReloadTraps 0x4118
#define ServerOP_ReloadVariables 0x4119
#define ServerOP_ReloadVeteranRewards 0x4120
#define ServerOP_ReloadWorld 0x4121
#define ServerOP_ReloadZonePoints 0x4122
#define ServerOP_ReloadDzTemplates 0x4123
#define ServerOP_ReloadZoneData 0x4124
#define ServerOP_CZDialogueWindow 0x4500
#define ServerOP_CZLDoNUpdate 0x4501

View File

@ -146,6 +146,7 @@ std::vector<Reload> reload_types = {
Reload{.command = "merchants", .opcode = ServerOP_ReloadMerchants, .desc = "Merchants"},
Reload{.command = "npc_emotes", .opcode = ServerOP_ReloadNPCEmotes, .desc = "NPC Emotes"},
Reload{.command = "objects", .opcode = ServerOP_ReloadObjects, .desc = "Objects"},
Reload{.command = "opcodes", .opcode = ServerOP_ReloadOpcodes, .desc = "Opcodes"},
Reload{.command = "perl_export", .opcode = ServerOP_ReloadPerlExportSettings, .desc = "Perl Event Export Settings"},
Reload{.command = "rules", .opcode = ServerOP_ReloadRules, .desc = "Rules"},
Reload{.command = "static", .opcode = ServerOP_ReloadStaticZoneData, .desc = "Static Zone Data"},

View File

@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/content/world_content_service.h"
#include "../common/repositories/player_event_logs_repository.h"
#include "../common/events/player_event_logs.h"
#include "../common/patches/patches.h"
extern ClientList client_list;
extern GroupLFPList LFPGroupList;
@ -1296,6 +1297,10 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
QSLink.SendPacket(pack);
break;
}
case ServerOP_ReloadOpcodes: {
ReloadAllPatches();
break;
}
case ServerOP_CZDialogueWindow:
case ServerOP_CZLDoNUpdate:
case ServerOP_CZMarquee:

View File

@ -9476,6 +9476,7 @@ void Client::ShowDevToolsMenu()
menu_reload_five += Saylink::Silent("#reload merchants", "Merchants");
menu_reload_five += " | " + Saylink::Silent("#reload npc_emotes", "NPC Emotes");
menu_reload_five += " | " + Saylink::Silent("#reload objects", "Objects");
menu_reload_five += " | " + Saylink::Silent("#reload opcodes", "Opcodes");
menu_reload_six += Saylink::Silent("#reload perl_export", "Perl Event Export Settings");
menu_reload_six += " | " + Saylink::Silent("#reload quest", "Quests");
@ -11483,6 +11484,16 @@ void Client::SendReloadCommandMessages() {
).c_str()
);
auto opcodes_link = Saylink::Silent("#reload opcodes");
Message(
Chat::White,
fmt::format(
"Usage: {} - Reloads Opcodes globally",
opcodes_link
).c_str()
);
auto perl_export_link = Saylink::Silent("#reload perl_export");
Message(

View File

@ -232,7 +232,7 @@ int command_init(void)
command_add("nukeitem", "[Item ID] - Removes the specified Item ID from you or your player target's inventory", AccountStatus::GMLeadAdmin, command_nukeitem) ||
command_add("object", "List|Add|Edit|Move|Rotate|Copy|Save|Undo|Delete - Manipulate static and tradeskill objects within the zone", AccountStatus::GMAdmin, command_object) ||
command_add("oocmute", "[0|1] - Enable or Disable Server OOC", AccountStatus::GMMgmt, command_oocmute) ||
command_add("opcode", "Reloads all server patches", AccountStatus::GMImpossible, command_opcode) ||
command_add("opcode", "Reloads all opcodes from server patch files", AccountStatus::GMMgmt, command_reload) ||
command_add("path", "view and edit pathing", AccountStatus::GMMgmt, command_path) ||
command_add("peekinv", "[equip/gen/cursor/poss/limbo/curlim/trib/bank/shbank/allbank/trade/world/all] - Print out contents of your player target's inventory", AccountStatus::GMAdmin, command_peekinv) ||
command_add("peqzone", "[Zone ID|Zone Short Name] - Teleports you to the specified zone if you meet the requirements.", AccountStatus::Player, command_peqzone) ||
@ -1073,7 +1073,6 @@ void command_bot(Client *c, const Seperator *sep)
#include "gm_commands/nukeitem.cpp"
#include "gm_commands/object.cpp"
#include "gm_commands/oocmute.cpp"
#include "gm_commands/opcode.cpp"
#include "gm_commands/path.cpp"
#include "gm_commands/peekinv.cpp"
#include "gm_commands/peqzone.cpp"

View File

@ -182,7 +182,6 @@ void command_nukebuffs(Client *c, const Seperator *sep);
void command_nukeitem(Client *c, const Seperator *sep);
void command_object(Client *c, const Seperator *sep);
void command_oocmute(Client *c, const Seperator *sep);
void command_opcode(Client *c, const Seperator *sep);
#ifdef PACKET_PROFILER
void command_packetprofile(Client *c, const Seperator *sep);

View File

@ -1,9 +0,0 @@
#include "../client.h"
#include "../../common/patches/patches.h"
void command_opcode(Client *c, const Seperator *sep)
{
ReloadAllPatches();
c->Message(Chat::White, "Opcodes for all patches have been reloaded");
}

View File

@ -1,16 +1,18 @@
#include "../client.h"
#include "../../common/patches/patches.h"
void command_reload(Client *c, const Seperator *sep)
{
std::string command = sep->arg[0] ? sep->arg[0] : "";
int arguments = sep->argnum;
const auto arguments = sep->argnum;
if (!arguments && Strings::Contains(command, "#reload")) {
c->SendReloadCommandMessages();
return;
}
bool is_rq_alias = sep->arg[0] && Strings::Contains(command, "#rq");
bool is_logs_reload_alias = sep->arg[0] && Strings::Contains(command, "#rl");
bool is_opcodes_reload_alias = sep->arg[0] && Strings::Contains(command, "#opcode");
bool is_rq_alias = sep->arg[0] && Strings::Contains(command, "#rq");
bool is_aa = !strcasecmp(sep->arg[1], "aa");
bool is_alternate_currencies = !strcasecmp(sep->arg[1], "alternate_currencies");
bool is_blocked_spells = !strcasecmp(sep->arg[1], "blocked_spells");
@ -24,6 +26,7 @@ void command_reload(Client *c, const Seperator *sep)
bool is_merchants = !strcasecmp(sep->arg[1], "merchants");
bool is_npc_emotes = !strcasecmp(sep->arg[1], "npc_emotes");
bool is_objects = !strcasecmp(sep->arg[1], "objects");
bool is_opcodes = !strcasecmp(sep->arg[1], "opcodes") || is_opcodes_reload_alias;
bool is_perl_export = !strcasecmp(sep->arg[1], "perl_export");
bool is_quest = !strcasecmp(sep->arg[1], "quest") || (is_rq_alias);
bool is_rules = !strcasecmp(sep->arg[1], "rules");
@ -51,6 +54,7 @@ void command_reload(Client *c, const Seperator *sep)
!is_merchants &&
!is_npc_emotes &&
!is_objects &&
!is_opcodes &&
!is_perl_export &&
!is_quest &&
!is_rules &&
@ -63,7 +67,7 @@ void command_reload(Client *c, const Seperator *sep)
!is_world &&
!is_zone &&
!is_zone_points
) {
) {
c->SendReloadCommandMessages();
return;
}
@ -73,36 +77,28 @@ void command_reload(Client *c, const Seperator *sep)
if (is_aa) {
c->Message(Chat::White, "Attempting to reload Alternate Advancement Data globally.");
pack = new ServerPacket(ServerOP_ReloadAAData, 0);
}
else if (is_alternate_currencies) {
} else if (is_alternate_currencies) {
c->Message(Chat::White, "Attempting to reload Alternate Currencies globally.");
pack = new ServerPacket(ServerOP_ReloadAlternateCurrencies, 0);
}
else if (is_blocked_spells) {
} else if (is_blocked_spells) {
c->Message(Chat::White, "Attempting to reload Blocked Spells globally.");
pack = new ServerPacket(ServerOP_ReloadBlockedSpells, 0);
}
else if (is_commands) {
} else if (is_commands) {
c->Message(Chat::White, "Attempting to reload Commands globally.");
pack = new ServerPacket(ServerOP_ReloadCommands, 0);
}
else if (is_content_flags) {
} else if (is_content_flags) {
c->Message(Chat::White, "Attempting to reload Content Flags globally.");
pack = new ServerPacket(ServerOP_ReloadContentFlags, 0);
}
else if (is_doors) {
} else if (is_doors) {
c->Message(Chat::White, "Attempting to reload Doors globally.");
pack = new ServerPacket(ServerOP_ReloadDoors, 0);
}
else if (is_dztemplates) {
} else if (is_dztemplates) {
c->Message(Chat::White, "Attempting to reload Dynamic Zone Templates globally.");
pack = new ServerPacket(ServerOP_ReloadDzTemplates, 0);
}
else if (is_ground_spawns) {
} else if (is_ground_spawns) {
c->Message(Chat::White, "Attempting to reload Ground Spawns globally.");
pack = new ServerPacket(ServerOP_ReloadGroundSpawns, 0);
}
else if (is_level_mods) {
} else if (is_level_mods) {
if (!RuleB(Zone, LevelBasedEXPMods)) {
c->Message(Chat::White, "Level Based Experience Modifiers are disabled.");
return;
@ -110,75 +106,60 @@ void command_reload(Client *c, const Seperator *sep)
c->Message(Chat::White, "Attempting to reload Level Based Experience Modifiers globally.");
pack = new ServerPacket(ServerOP_ReloadLevelEXPMods, 0);
}
else if (is_logs) {
} else if (is_logs) {
c->Message(Chat::White, "Attempting to reload Log Settings globally.");
pack = new ServerPacket(ServerOP_ReloadLogs, 0);
}
else if (is_merchants) {
} else if (is_merchants) {
c->Message(Chat::White, "Attempting to reload Merchants globally.");
pack = new ServerPacket(ServerOP_ReloadMerchants, 0);
}
else if (is_npc_emotes) {
} else if (is_npc_emotes) {
c->Message(Chat::White, "Attempting to reload NPC Emotes globally.");
pack = new ServerPacket(ServerOP_ReloadNPCEmotes, 0);
}
else if (is_objects) {
} else if (is_objects) {
c->Message(Chat::White, "Attempting to reload Objects globally.");
pack = new ServerPacket(ServerOP_ReloadObjects, 0);
}
else if (is_perl_export) {
} else if (is_opcodes) {
c->Message(Chat::White, "Attempting to reload Opcodes globally.");
pack = new ServerPacket(ServerOP_ReloadOpcodes, 0);
} else if (is_perl_export) {
c->Message(Chat::White, "Attempting to reload Perl Event Export Settings globally.");
pack = new ServerPacket(ServerOP_ReloadPerlExportSettings, 0);
}
else if (is_quest) {
bool stop_timers = false;
if (sep->IsNumber(2)) {
stop_timers = Strings::ToInt(sep->arg[2]) != 0 ? true : false;
}
std::string stop_timers_message = stop_timers ? " and timers stopped" : "";
} else if (is_quest) {
const auto stop_timers = sep->IsNumber(2) ? Strings::ToBool(sep->arg[2]) : false;
c->Message(
Chat::Yellow,
fmt::format(
"Quests reloaded{} for {}.",
stop_timers_message,
stop_timers ? " and timers stopped" : "",
zone->GetZoneDescription()
).c_str()
);
entity_list.ClearAreas();
parse->ReloadQuests(stop_timers);
}
else if (is_rules) {
} else if (is_rules) {
c->Message(Chat::White, "Attempting to reload Rules globally.");
pack = new ServerPacket(ServerOP_ReloadRules, 0);
}
else if (is_static) {
} else if (is_static) {
c->Message(Chat::White, "Attempting to reload Static Zone Data globally.");
pack = new ServerPacket(ServerOP_ReloadStaticZoneData, 0);
}
else if (is_tasks) {
} else if (is_tasks) {
uint32 task_id = 0;
if (!sep->IsNumber(2)) {
c->Message(Chat::White, "Attempting to reload Tasks globally.");
pack = new ServerPacket(ServerOP_ReloadTasks, sizeof(ReloadTasks_Struct));
}
else {
} else {
task_id = Strings::ToUnsignedInt(sep->arg[2]);
}
auto rts = (ReloadTasks_Struct *) pack->pBuffer;
rts->reload_type = RELOADTASKS;
rts->task_id = task_id;
}
else if (is_titles) {
} else if (is_titles) {
c->Message(Chat::White, "Attempting to reload Titles globally.");
pack = new ServerPacket(ServerOP_ReloadTitles, 0);
}
else if (is_traps) {
} else if (is_traps) {
if (arguments < 2 || !sep->IsNumber(2)) {
entity_list.UpdateAllTraps(true, true);
c->Message(
@ -191,7 +172,7 @@ void command_reload(Client *c, const Seperator *sep)
return;
}
bool global = Strings::ToInt(sep->arg[2]) ? true : false;
const auto global = Strings::ToBool(sep->arg[2]);
if (!global) {
entity_list.UpdateAllTraps(true, true);
@ -207,16 +188,13 @@ void command_reload(Client *c, const Seperator *sep)
c->Message(Chat::White, "Attempting to reload Traps globally.");
pack = new ServerPacket(ServerOP_ReloadTraps, 0);
}
else if (is_variables) {
} else if (is_variables) {
c->Message(Chat::White, "Attempting to reload Variables globally.");
pack = new ServerPacket(ServerOP_ReloadVariables, 0);
}
else if (is_veteran_rewards) {
} else if (is_veteran_rewards) {
c->Message(Chat::White, "Attempting to reload Veteran Rewards globally.");
pack = new ServerPacket(ServerOP_ReloadVeteranRewards, 0);
}
else if (is_world) {
} else if (is_world) {
uint8 global_repop = ReloadWorld::NoRepop;
if (sep->IsNumber(2)) {
@ -233,12 +211,12 @@ void command_reload(Client *c, const Seperator *sep)
"Attempting to reload Quests {}worldwide.",
(
global_repop ?
(
global_repop == ReloadWorld::Repop ?
"and repop NPCs " :
"and forcefully repop NPCs "
) :
""
(
global_repop == ReloadWorld::Repop ?
"and repop NPCs " :
"and forcefully repop NPCs "
) :
""
)
).c_str()
);
@ -246,8 +224,7 @@ void command_reload(Client *c, const Seperator *sep)
pack = new ServerPacket(ServerOP_ReloadWorld, sizeof(ReloadWorld_Struct));
auto RW = (ReloadWorld_Struct *) pack->pBuffer;
RW->global_repop = global_repop;
}
else if (is_zone) {
} else if (is_zone) {
zone_store.LoadZones(content_db);
if (arguments < 2) {
@ -257,8 +234,8 @@ void command_reload(Client *c, const Seperator *sep)
"Zone Header Load {} | Zone: {}",
(
zone->LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion()) ?
"Succeeded" :
"Failed"
"Succeeded" :
"Failed"
),
zone->GetZoneDescription()
).c_str()
@ -268,8 +245,8 @@ void command_reload(Client *c, const Seperator *sep)
auto zone_id = (
sep->IsNumber(2) ?
Strings::ToUnsignedInt(sep->arg[2]) :
ZoneID(sep->arg[2])
Strings::ToUnsignedInt(sep->arg[2]) :
ZoneID(sep->arg[2])
);
if (!zone_id) {
c->Message(
@ -286,8 +263,8 @@ void command_reload(Client *c, const Seperator *sep)
auto zone_long_name = ZoneLongName(zone_id);
auto version = (
sep->IsNumber(3) ?
Strings::ToUnsignedInt(sep->arg[3]) :
0
Strings::ToUnsignedInt(sep->arg[3]) :
0
);
auto outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
@ -301,23 +278,22 @@ void command_reload(Client *c, const Seperator *sep)
"Zone Header Load {} | Zone: {} ({}){}",
(
zone->LoadZoneCFG(zone_short_name, version) ?
"Succeeded" :
"Failed"
"Succeeded" :
"Failed"
),
zone_long_name,
zone_short_name,
(
version ?
fmt::format(
" Version: {}",
version
) :
""
fmt::format(
" Version: {}",
version
) :
""
)
).c_str()
);
}
else if (is_zone_points) {
} else if (is_zone_points) {
c->Message(Chat::White, "Attempting to reloading Zone Points globally.");
pack = new ServerPacket(ServerOP_ReloadZonePoints, 0);
}