From e55fb1cafda90fbf5a8337f71b47a022c48eef73 Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Sat, 8 Jul 2023 11:06:25 -0400 Subject: [PATCH] [Commands] Consolidate #show commands into a singular #show command (#3478) * [Cleanup] Consolidate #show commands into a singular #show command # Notes - All `#show` commands like `#showbuffs` are now subcommands of `#show`. - All aliases like `#showbuffs` still function. * Push up progress. * Final push. * Cleanup. * Update ip_lookup.cpp * emotes not emote * Cleanup * Update servertalk.h * Update show.cpp * Fix * Final push. * #aggro * #who --- common/servertalk.h | 5 + world/zoneserver.cpp | 3 +- zone/client_packet.cpp | 18 +- zone/command.cpp | 145 ++++----- zone/command.h | 49 +-- zone/entity.h | 2 +- zone/gm_commands/aggro.cpp | 28 -- zone/gm_commands/checklos.cpp | 23 -- zone/gm_commands/cvs.cpp | 14 - zone/gm_commands/distance.cpp | 22 -- zone/gm_commands/flags.cpp | 17 - zone/gm_commands/fov.cpp | 43 --- .../getplayerburiedcorpsecount.cpp | 26 -- zone/gm_commands/getvariable.cpp | 31 -- zone/gm_commands/ginfo.cpp | 78 ----- zone/gm_commands/globalview.cpp | 80 ----- zone/gm_commands/iplookup.cpp | 23 -- zone/gm_commands/listpetition.cpp | 22 -- zone/gm_commands/netstats.cpp | 169 ---------- zone/gm_commands/network.cpp | 175 ----------- zone/gm_commands/npcstats.cpp | 18 -- zone/gm_commands/peqzone_flags.cpp | 17 - zone/gm_commands/petitioninfo.cpp | 39 --- zone/gm_commands/proximity.cpp | 74 ----- zone/gm_commands/questerrors.cpp | 33 -- zone/gm_commands/serverinfo.cpp | 126 -------- zone/gm_commands/show.cpp | 142 +++++++++ zone/gm_commands/show/aggro.cpp | 22 ++ .../{showbuffs.cpp => show/buffs.cpp} | 5 +- zone/gm_commands/show/buried_corpse_count.cpp | 23 ++ .../show/client_version_summary.cpp | 16 + zone/gm_commands/show/currencies.cpp | 136 ++++++++ zone/gm_commands/show/distance.cpp | 23 ++ .../{emoteview.cpp => show/emotes.cpp} | 33 +- zone/gm_commands/show/field_of_view.cpp | 23 ++ zone/gm_commands/show/flags.cpp | 16 + zone/gm_commands/show/group_info.cpp | 89 ++++++ zone/gm_commands/{ => show}/hatelist.cpp | 8 +- .../{peekinv.cpp => show/inventory.cpp} | 68 ++-- zone/gm_commands/show/ip_lookup.cpp | 25 ++ zone/gm_commands/show/line_of_sight.cpp | 22 ++ zone/gm_commands/show/network.cpp | 138 ++++++++ zone/gm_commands/show/network_stats.cpp | 297 ++++++++++++++++++ .../npc_global_loot.cpp} | 5 +- zone/gm_commands/show/npc_stats.cpp | 17 + zone/gm_commands/show/npc_type.cpp | 35 +++ zone/gm_commands/show/peqzone_flags.cpp | 15 + zone/gm_commands/show/petition.cpp | 69 ++++ zone/gm_commands/show/petition_info.cpp | 79 +++++ zone/gm_commands/show/proximity.cpp | 73 +++++ zone/gm_commands/show/quest_errors.cpp | 35 +++ zone/gm_commands/show/quest_globals.cpp | 76 +++++ .../{viewrecipe.cpp => show/recipe.cpp} | 48 ++- zone/gm_commands/show/server_info.cpp | 106 +++++++ zone/gm_commands/show/skills.cpp | 42 +++ zone/gm_commands/show/spawn_status.cpp | 147 +++++++++ zone/gm_commands/show/spells.cpp | 30 ++ zone/gm_commands/show/spells_list.cpp | 13 + .../{showstats.cpp => show/stats.cpp} | 5 +- zone/gm_commands/{ => show}/timers.cpp | 24 +- zone/gm_commands/show/traps.cpp | 6 + zone/gm_commands/show/uptime.cpp | 19 ++ zone/gm_commands/show/variable.cpp | 33 ++ zone/gm_commands/show/version.cpp | 35 +++ .../{wpinfo.cpp => show/waypoints.cpp} | 14 +- zone/gm_commands/show/who.cpp | 235 ++++++++++++++ zone/gm_commands/{ => show}/xtargets.cpp | 10 +- zone/gm_commands/show/zone_data.cpp | 276 ++++++++++++++++ zone/gm_commands/show/zone_global_loot.cpp | 6 + zone/gm_commands/show/zone_loot.cpp | 102 ++++++ .../zone_points.cpp} | 107 ++++--- zone/gm_commands/show/zone_status.cpp | 16 + zone/gm_commands/showskills.cpp | 98 ------ zone/gm_commands/showspells.cpp | 37 --- zone/gm_commands/showspellslist.cpp | 13 - zone/gm_commands/showzonegloballoot.cpp | 7 - zone/gm_commands/spawnstatus.cpp | 137 -------- zone/gm_commands/trapinfo.cpp | 7 - zone/gm_commands/uptime.cpp | 22 -- zone/gm_commands/version.cpp | 18 -- zone/gm_commands/viewcurrencies.cpp | 129 -------- zone/gm_commands/viewnpctype.cpp | 32 -- zone/gm_commands/viewpetition.cpp | 31 -- zone/gm_commands/viewzoneloot.cpp | 116 ------- zone/gm_commands/who.cpp | 233 -------------- zone/gm_commands/zonestatus.cpp | 19 -- zone/gm_commands/zstats.cpp | 205 ------------ zone/mob.cpp | 151 ++++----- zone/trap.cpp | 18 +- zone/zoning.cpp | 39 ++- 90 files changed, 2766 insertions(+), 2590 deletions(-) delete mode 100755 zone/gm_commands/aggro.cpp delete mode 100755 zone/gm_commands/checklos.cpp delete mode 100755 zone/gm_commands/cvs.cpp delete mode 100755 zone/gm_commands/distance.cpp delete mode 100755 zone/gm_commands/flags.cpp delete mode 100755 zone/gm_commands/fov.cpp delete mode 100755 zone/gm_commands/getplayerburiedcorpsecount.cpp delete mode 100755 zone/gm_commands/getvariable.cpp delete mode 100755 zone/gm_commands/ginfo.cpp delete mode 100755 zone/gm_commands/globalview.cpp delete mode 100755 zone/gm_commands/iplookup.cpp delete mode 100755 zone/gm_commands/listpetition.cpp delete mode 100755 zone/gm_commands/netstats.cpp delete mode 100755 zone/gm_commands/network.cpp delete mode 100755 zone/gm_commands/npcstats.cpp delete mode 100644 zone/gm_commands/peqzone_flags.cpp delete mode 100755 zone/gm_commands/petitioninfo.cpp delete mode 100755 zone/gm_commands/proximity.cpp delete mode 100755 zone/gm_commands/questerrors.cpp delete mode 100755 zone/gm_commands/serverinfo.cpp create mode 100755 zone/gm_commands/show.cpp create mode 100755 zone/gm_commands/show/aggro.cpp rename zone/gm_commands/{showbuffs.cpp => show/buffs.cpp} (51%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/buried_corpse_count.cpp create mode 100644 zone/gm_commands/show/client_version_summary.cpp create mode 100644 zone/gm_commands/show/currencies.cpp create mode 100644 zone/gm_commands/show/distance.cpp rename zone/gm_commands/{emoteview.cpp => show/emotes.cpp} (62%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/field_of_view.cpp create mode 100644 zone/gm_commands/show/flags.cpp create mode 100644 zone/gm_commands/show/group_info.cpp rename zone/gm_commands/{ => show}/hatelist.cpp (50%) mode change 100755 => 100644 rename zone/gm_commands/{peekinv.cpp => show/inventory.cpp} (81%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/ip_lookup.cpp create mode 100644 zone/gm_commands/show/line_of_sight.cpp create mode 100644 zone/gm_commands/show/network.cpp create mode 100644 zone/gm_commands/show/network_stats.cpp rename zone/gm_commands/{shownpcgloballoot.cpp => show/npc_global_loot.cpp} (71%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/npc_stats.cpp create mode 100644 zone/gm_commands/show/npc_type.cpp create mode 100644 zone/gm_commands/show/peqzone_flags.cpp create mode 100644 zone/gm_commands/show/petition.cpp create mode 100644 zone/gm_commands/show/petition_info.cpp create mode 100644 zone/gm_commands/show/proximity.cpp create mode 100644 zone/gm_commands/show/quest_errors.cpp create mode 100644 zone/gm_commands/show/quest_globals.cpp rename zone/gm_commands/{viewrecipe.cpp => show/recipe.cpp} (62%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/server_info.cpp create mode 100644 zone/gm_commands/show/skills.cpp create mode 100644 zone/gm_commands/show/spawn_status.cpp create mode 100644 zone/gm_commands/show/spells.cpp create mode 100644 zone/gm_commands/show/spells_list.cpp rename zone/gm_commands/{showstats.cpp => show/stats.cpp} (51%) mode change 100755 => 100644 rename zone/gm_commands/{ => show}/timers.cpp (57%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/traps.cpp create mode 100644 zone/gm_commands/show/uptime.cpp create mode 100644 zone/gm_commands/show/variable.cpp create mode 100644 zone/gm_commands/show/version.cpp rename zone/gm_commands/{wpinfo.cpp => show/waypoints.cpp} (54%) mode change 100755 => 100644 create mode 100755 zone/gm_commands/show/who.cpp rename zone/gm_commands/{ => show}/xtargets.cpp (78%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/zone_data.cpp create mode 100644 zone/gm_commands/show/zone_global_loot.cpp create mode 100644 zone/gm_commands/show/zone_loot.cpp rename zone/gm_commands/{showzonepoints.cpp => show/zone_points.cpp} (57%) mode change 100755 => 100644 create mode 100644 zone/gm_commands/show/zone_status.cpp delete mode 100755 zone/gm_commands/showskills.cpp delete mode 100755 zone/gm_commands/showspells.cpp delete mode 100755 zone/gm_commands/showspellslist.cpp delete mode 100755 zone/gm_commands/showzonegloballoot.cpp delete mode 100755 zone/gm_commands/spawnstatus.cpp delete mode 100755 zone/gm_commands/trapinfo.cpp delete mode 100755 zone/gm_commands/uptime.cpp delete mode 100755 zone/gm_commands/version.cpp delete mode 100644 zone/gm_commands/viewcurrencies.cpp delete mode 100755 zone/gm_commands/viewnpctype.cpp delete mode 100755 zone/gm_commands/viewpetition.cpp delete mode 100755 zone/gm_commands/viewzoneloot.cpp delete mode 100755 zone/gm_commands/who.cpp delete mode 100755 zone/gm_commands/zonestatus.cpp delete mode 100755 zone/gm_commands/zstats.cpp diff --git a/common/servertalk.h b/common/servertalk.h index 7f14a1f6c0..f9740752f6 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -1824,6 +1824,11 @@ struct ServerOOCMute_Struct { bool is_muted; }; +struct ServerZoneStatus_Struct { + char name[64]; + int16 admin; +}; + #pragma pack() #endif diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index bfd8ecd6f6..c79debaafe 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -748,7 +748,8 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) { } case ServerOP_ZoneStatus: { if (pack->size >= 1) { - zoneserver_list.SendZoneStatus((char *)&pack->pBuffer[1], (uint8)pack->pBuffer[0], this); + auto z = (ServerZoneStatus_Struct*) pack->pBuffer; + zoneserver_list.SendZoneStatus(z->name, z->admin, this); } break; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index fb3b00a6bb..d52b26cb44 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -6779,16 +6779,14 @@ void Client::Handle_OP_GMSearchCorpse(const EQApplicationPacket *app) void Client::Handle_OP_GMServers(const EQApplicationPacket *app) { - if (!worldserver.Connected()) - Message(Chat::Red, "Error: World server disconnected"); - else { - auto pack = new ServerPacket(ServerOP_ZoneStatus, strlen(GetName()) + 2); - memset(pack->pBuffer, (uint8)admin, 1); - strcpy((char *)&pack->pBuffer[1], GetName()); - worldserver.SendPacket(pack); - safe_delete(pack); - } - return; + auto pack = new ServerPacket(ServerOP_ZoneStatus, sizeof(ServerZoneStatus_Struct)); + + auto z = (ServerZoneStatus_Struct *) pack->pBuffer; + z->admin = Admin(); + strn0cpy(z->name, GetName(), sizeof(z->name)); + + worldserver.SendPacket(pack); + delete pack; } void Client::Handle_OP_GMSummon(const EQApplicationPacket *app) diff --git a/zone/command.cpp b/zone/command.cpp index 3bb662d0c9..9284d67223 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -86,7 +86,6 @@ int command_init(void) if ( command_add("acceptrules", "[acceptrules] - Accept the EQEmu Agreement", AccountStatus::Player, command_acceptrules) || command_add("advnpcspawn", "[maketype|makegroup|addgroupentry|addgroupspawn][removegroupspawn|movespawn|editgroupbox|cleargroupbox]", AccountStatus::GMLeadAdmin, command_advnpcspawn) || - command_add("aggro", "[Distance] [-v] - Display aggro information for all mobs 'Distance' distance from your target. (-v is verbose Faction Information)", AccountStatus::QuestTroupe, command_aggro) || command_add("aggrozone", "[aggro] - Aggro every mob in the zone with X aggro. Default is 0. Not recommend if you're not invulnerable.", AccountStatus::GMAdmin, command_aggrozone) || command_add("ai", "[factionid/spellslist/con/guard/roambox/stop/start] - Modify AI on NPC target", AccountStatus::GMAdmin, command_ai) || command_add("appearance", "[type] [value] - Send an appearance packet for you or your target", AccountStatus::GMLeadAdmin, command_appearance) || @@ -101,12 +100,10 @@ int command_init(void) command_add("camerashake", "[Duration (Milliseconds)] [Intensity (1-10)] - Shakes the camera on everyone's screen globally.", AccountStatus::QuestTroupe, command_camerashake) || command_add("castspell", "[Spell ID] [Instant (0 = False, 1 = True, Default is 1 if Unused)] - Cast a spell", AccountStatus::Guide, command_castspell) || command_add("chat", "[Channel ID] [Message] - Send a channel message to all zones", AccountStatus::GMMgmt, command_chat) || - command_add("checklos", "Check for line of sight to your target", AccountStatus::Guide, command_checklos) || command_add("copycharacter", "[source_char_name] [dest_char_name] [dest_account_name] - Copies character to destination account", AccountStatus::GMImpossible, command_copycharacter) || command_add("corpse", "Manipulate corpses, use with no arguments for help", AccountStatus::Guide, command_corpse) || command_add("corpsefix", "Attempts to bring corpses from underneath the ground within close proximity of the player", AccountStatus::Player, command_corpsefix) || command_add("countitem", "[Item ID] - Counts the specified Item ID in your or your target's inventory", AccountStatus::GMLeadAdmin, command_countitem) || - command_add("cvs", "Summary of client versions currently online.", AccountStatus::GMMgmt, command_cvs) || command_add("damage", "[Amount] - Damage yourself or your target", AccountStatus::GMAdmin, command_damage) || command_add("databuckets", "View|Delete [key] [limit]- View data buckets, limit 50 default or Delete databucket by key", AccountStatus::QuestTroupe, command_databuckets) || command_add("date", "[Year] [Month] [Day] [Hour] [Minute] - Set EQ time (Hour and Minute are optional)", AccountStatus::EQSupport, command_date) || @@ -118,7 +115,6 @@ int command_init(void) 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) || command_add("door", "Door editing command", AccountStatus::QuestTroupe, command_door) || command_add("doanim", "[Animation ID|Animation Name] [Speed] - Send an animation by ID or name at the specified speed to you or your target (Speed is optional)", AccountStatus::Guide, command_doanim) || command_add("dye", "[slot|'help'] [red] [green] [blue] [use_tint] - Dyes the specified armor slot to Red, Green, and Blue provided, allows you to bypass darkness limits.", AccountStatus::ApprenticeGuide, command_dye) || @@ -126,7 +122,6 @@ int command_init(void) command_add("dzkickplayers", "Removes all players from current expedition. (/kickplayers alternative for pre-RoF clients)", AccountStatus::Player, command_dzkickplayers) || command_add("editmassrespawn", "[name-search] [second-value] - Mass (Zone wide) NPC respawn timer editing command", AccountStatus::GMAdmin, command_editmassrespawn) || command_add("emote", "[Name|World|Zone] [type] [message] - Send an emote message by name, to the world, or to your zone (^ separator allows multiple messages to be sent at once)", AccountStatus::QuestTroupe, command_emote) || - command_add("emoteview", "Lists all NPC Emotes", AccountStatus::QuestTroupe, command_emoteview) || command_add("emptyinventory", "Clears your or your target's entire inventory (Equipment, General, Bank, and Shared Bank)", AccountStatus::GMImpossible, command_emptyinventory) || command_add("enablerecipe", "[Recipe ID] - Enables a Recipe", AccountStatus::QuestTroupe, command_enablerecipe) || command_add("endurance", "Restores your or your target's endurance.", AccountStatus::Guide, command_endurance) || @@ -140,19 +135,13 @@ int command_init(void) command_add("fixmob", "[race|gender|texture|helm|face|hair|haircolor|beard|beardcolor|heritage|tattoo|detail] [next|prev] - Manipulate appearance of your target", AccountStatus::QuestTroupe, command_fixmob) || command_add("flag", "[Status] [Account Name] - Refresh your admin status, or set an account's Admin status if arguments provided", AccountStatus::Player, command_flag) || command_add("flagedit", "Edit zone flags on your target. Use #flagedit help for more info.", AccountStatus::GMAdmin, command_flagedit) || - command_add("flags", "displays the Zone Flags of you or your target", AccountStatus::Player, command_flags) || command_add("flymode", "[0/1/2/3/4/5] - Set your or your player target's flymode to ground/flying/levitate/water/floating/levitate_running", AccountStatus::Guide, command_flymode) || - command_add("fov", "Check wether you're behind or in your target's field of view", AccountStatus::QuestTroupe, command_fov) || command_add("freeze", "Freeze your target", AccountStatus::QuestTroupe, command_freeze) || command_add("gassign", "[Grid ID] - Assign targetted NPC to predefined wandering grid id", AccountStatus::GMAdmin, command_gassign) || command_add("gearup", "Developer tool to quickly equip yourself or your target", AccountStatus::GMMgmt, command_gearup) || command_add("gender", "[0/1/2] - Change your or your target's gender to male/female/neuter", AccountStatus::Guide, command_gender) || - command_add("getplayerburiedcorpsecount", "Get your or your target's total number of buried player corpses.", AccountStatus::GMAdmin, command_getplayerburiedcorpsecount) || - command_add("getvariable", "[Variable Name] - Get the value of a variable from the database", AccountStatus::GMMgmt, command_getvariable) || - command_add("ginfo", "get group info on target.", AccountStatus::ApprenticeGuide, command_ginfo) || command_add("giveitem", "[itemid] [charges] - Summon an item onto your target's cursor. Charges are optional.", AccountStatus::GMMgmt, command_giveitem) || command_add("givemoney", "[Platinum] [Gold] [Silver] [Copper] - Gives specified amount of money to you or your player target", AccountStatus::GMMgmt, command_givemoney) || - command_add("globalview", "Lists all qglobals in cache if you were to do a quest with this target.", AccountStatus::QuestTroupe, command_globalview) || command_add("gm", "[On|Off] - Modify your or your target's GM Flag", AccountStatus::QuestTroupe, command_gm) || command_add("gmspeed", "[On|Off] - Turn GM Speed On or Off for you or your player target", AccountStatus::GMAdmin, command_gmspeed) || command_add("gmzone", "[Zone ID|Zone Short Name] [Version] [Instance Identifier] - Zones to a private GM instance (Version defaults to 0 and Instance Identifier defaults to 'gmzone' if not used)", AccountStatus::GMAdmin, command_gmzone) || @@ -161,7 +150,6 @@ int command_init(void) command_add("grid", "[add/delete] [grid_num] [wandertype] [pausetype] - Create/delete a wandering grid", AccountStatus::GMAreas, command_grid) || command_add("guild", "Guild manipulation commands. Use argument help for more info.", AccountStatus::Steward, command_guild) || command_add("haste", "[Percentage] - Set your or your target's GM Bonus Haste (100 is 100% more Attack Speed)", AccountStatus::GMAdmin, command_haste) || - command_add("hatelist", "Display hate list for NPC.", AccountStatus::QuestTroupe, command_hatelist) || command_add("heal", "Completely heal your target", AccountStatus::Steward, command_heal) || command_add("help", "[Search Criteria] - List available commands and their description, specify partial command as argument to search", AccountStatus::Player, command_help) || command_add("heromodel", "[Hero Model] [Slot] - Set your or your target's appearance to a full set of Hero's Forge Armor, if slot is set, sends exact model just to slot.", AccountStatus::GMMgmt, command_heromodel) || @@ -175,14 +163,12 @@ int command_init(void) command_add("invsnapshot", "Manipulates inventory snapshots for your current target", AccountStatus::QuestTroupe, command_invsnapshot) || command_add("invul", "[On|Off]] - Turn player target's or your invulnerable flag on or off", AccountStatus::QuestTroupe, command_invul) || command_add("ipban", "[IP] - Ban IP", AccountStatus::GMMgmt, command_ipban) || - command_add("iplookup", "[charname] - Look up IP address of charname", AccountStatus::GMMgmt, command_iplookup) || command_add("kick", "[Character Name] - Disconnect a player by name", AccountStatus::GMLeadAdmin, command_kick) || command_add("kill", "Kill your target", AccountStatus::GMAdmin, command_kill) || command_add("killallnpcs", "[npc_name] - Kills all npcs by search name, leave blank for all attackable NPC's", AccountStatus::GMMgmt, command_killallnpcs) || command_add("lastname", "[Last Name] - Set your or your player target's last name (use \"-1\" to remove last name)", AccountStatus::Guide, command_lastname) || command_add("level", "[Level] - Set your or your target's level", AccountStatus::Steward, command_level) || command_add("list", "[npcs|players|corpses|doors|objects] [search] - Search entities", AccountStatus::ApprenticeGuide, command_list) || - command_add("listpetition", "List petitions", AccountStatus::Guide, command_listpetition) || command_add("lootsim", "[npc_type_id] [loottable_id] [iterations] - Runs benchmark simulations using real loot logic to report numbers and data", AccountStatus::GMImpossible, command_lootsim) || command_add("load_shared_memory", "[shared_memory_name] - Reloads shared memory and uses the input as output", AccountStatus::GMImpossible, command_load_shared_memory) || command_add("loc", "Print out your or your target's current location and heading", AccountStatus::Player, command_loc) || @@ -200,8 +186,6 @@ int command_init(void) command_add("mysql", "[Help|Query] [SQL Query] - Mysql CLI, see 'Help' for options.", AccountStatus::GMImpossible, command_mysql) || command_add("mystats", "Show details about you or your pet", AccountStatus::Guide, command_mystats) || command_add("name", "[New Name] - Rename your player target", AccountStatus::GMLeadAdmin, command_name) || - command_add("netstats", "Gets the network stats for a stream.", AccountStatus::GMMgmt, command_netstats) || - command_add("network", "Admin commands for the udp network interface.", AccountStatus::GMImpossible, command_network) || command_add("npccast", "[targetname/entityid] [spellid] - Causes NPC target to cast spellid on targetname/entityid", AccountStatus::QuestTroupe, command_npccast) || command_add("npcedit", "[column] [value] - Mega NPC editing command", AccountStatus::GMAdmin, command_npcedit) || command_add("npceditmass", "[name-search] [column] [value] - Mass (Zone wide) NPC data editing command", AccountStatus::GMAdmin, command_npceditmass) || @@ -210,7 +194,6 @@ int command_init(void) command_add("npcsay", "[Message] - Make your NPC target say a message.", AccountStatus::GMLeadAdmin, command_npcsay) || command_add("npcshout", "[Message] - Make your NPC target shout a message.", AccountStatus::GMLeadAdmin, command_npcshout) || command_add("npcspawn", "[create/add/update/remove/delete] - Manipulate spawn DB", AccountStatus::GMAreas, command_npcspawn) || - command_add("npcstats", "Show stats about target NPC", AccountStatus::QuestTroupe, command_npcstats) || command_add("npctypespawn", "[NPC ID] [Faction ID] - Spawn an NPC by ID from the database with an option of setting its Faction ID", AccountStatus::Steward, command_npctypespawn) || command_add("nudge", "Nudge your target's current position by specific values", AccountStatus::QuestTroupe, command_nudge) || command_add("nukebuffs", "[Beneficial|Detrimental|Help] - Strip all buffs by type on you or your target (no argument to remove all buffs)", AccountStatus::Guide, command_nukebuffs) || @@ -219,21 +202,16 @@ int command_init(void) command_add("oocmute", "[0|1] - Enable or Disable Server OOC", AccountStatus::GMMgmt, command_oocmute) || 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) || - command_add("peqzone_flags", "displays the PEQZone Flags of you or your target", AccountStatus::Player, command_peqzone_flags) || command_add("permaclass", "[Class ID] - Change your or your player target's class, changed client is disconnected", AccountStatus::QuestTroupe, command_permaclass) || command_add("permagender", "[Gender ID] - Change your or your player target's gender", AccountStatus::QuestTroupe, command_permagender) || command_add("permarace", "[Race ID] - Change your or your player target's race", AccountStatus::QuestTroupe, command_permarace) || command_add("petitems", "View your pet's items if you have one", AccountStatus::ApprenticeGuide, command_petitems) || - command_add("petitioninfo", "[petition number] - Get info about a petition", AccountStatus::ApprenticeGuide, command_petitioninfo) || command_add("picklock", "Analog for ldon pick lock for the newer clients since we still don't have it working.", AccountStatus::Player, command_picklock) || command_add("profanity", "Manage censored language.", AccountStatus::GMLeadAdmin, command_profanity) || command_add("push", "[Back Push] [Up Push] - Lets you do spell push on an NPC", AccountStatus::GMLeadAdmin, command_push) || - command_add("proximity", "Shows NPC proximity", AccountStatus::GMLeadAdmin, command_proximity) || command_add("pvp", "[On|Off] - Set you or your player target's PVP status", AccountStatus::GMAdmin, command_pvp) || command_add("qglobal", "[On|Off|View] - Toggles quest global functionality for your NPC target", AccountStatus::GMAdmin, command_qglobal) || - command_add("questerrors", "Shows quest errors.", AccountStatus::GMAdmin, command_questerrors) || command_add("race", "[racenum] - Change your or your target's race. Use racenum 0 to return to normal", AccountStatus::Guide, command_race) || command_add("raidloot", "[All|GroupLeader|RaidLeader|Selected] - Sets your Raid Loot Type if you have permission to do so.", AccountStatus::Player, command_raidloot) || command_add("randomfeatures", "Temporarily randomizes the Facial Features of your target", AccountStatus::QuestTroupe, command_randomfeatures) || @@ -255,7 +233,6 @@ int command_init(void) command_add("scribespells", "[Max level] [Min level] - Scribe all spells for you or your player target that are usable by them, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_scribespells) || command_add("sendzonespawns", "Refresh spawn list for all clients in zone", AccountStatus::GMLeadAdmin, command_sendzonespawns) || command_add("sensetrap", "Analog for ldon sense trap for the newer clients since we still don't have it working.", AccountStatus::Player, command_sensetrap) || - command_add("serverinfo", "Get CPU, Operating System, and Process Information about the server", AccountStatus::GMMgmt, command_serverinfo) || command_add("serverlock", "[0|1] - Lock or Unlock the World Server (0 = Unlocked, 1 = Locked)", AccountStatus::GMLeadAdmin, command_serverlock) || command_add("serverrules", "Read this server's rules", AccountStatus::Player, command_serverrules) || command_add("setaapts", "[AA|Group|Raid] [AA Amount] - Set your or your player target's Available AA Points by Type", AccountStatus::GMAdmin, command_setaapts) || @@ -278,19 +255,11 @@ int command_init(void) command_add("setstartzone", "[Zone ID|Zone Short Name] - Sets your or your target's starting zone (Use '0' or 'Reset' to allow the player use of /setstartcity)", AccountStatus::QuestTroupe, command_setstartzone) || command_add("setstat", "Sets the stats to a specific value.", AccountStatus::Max, command_setstat) || command_add("setxp", "[value] - Set your or your player target's experience", AccountStatus::GMAdmin, command_setxp) || - command_add("showbuffs", "List buffs active on your target or you if no target", AccountStatus::Guide, command_showbuffs) || - command_add("shownpcgloballoot", "Show global loot entries for your target NPC", AccountStatus::Guide, command_shownpcgloballoot) || - command_add("showskills", "[Start Skill ID] [All] - Show the values of your or your player target's skills in a popup 50 at a time, use 'all' as second argument to show non-usable skill's values", AccountStatus::Guide, command_showskills) || - command_add("showspells", "[disciplines|spells] - Show your or your target's memorized spells or learned disciplines", AccountStatus::GMAdmin, command_showspells) || - command_add("showspellslist", "Shows spell list of targeted NPC", AccountStatus::GMAdmin, command_showspellslist) || - command_add("showstats", "Show details about you or your target", AccountStatus::Guide, command_showstats) || - command_add("showzonegloballoot", "Show global loot entries for your current zone", AccountStatus::Guide, command_showzonegloballoot) || - command_add("showzonepoints", "Show zone points for current zone", AccountStatus::Guide, command_showzonepoints) || + command_add("show", "List command used to show various things", AccountStatus::Guide, command_show) || command_add("shutdown", "Shut this zone process down", AccountStatus::GMLeadAdmin, command_shutdown) || command_add("spawn", "[name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid] - Spawn an NPC", AccountStatus::Steward, command_spawn) || command_add("spawneditmass", "[Search Criteria] [Edit Option] [Edit Value] [Apply] Mass editing spawn command (Apply is optional, 0 = False, 1 = True, default is False)", AccountStatus::GMLeadAdmin, command_spawneditmass) || command_add("spawnfix", "Find targeted NPC in database based on its X/Y/heading and update the database to make it spawn at your current location/heading.", AccountStatus::GMAreas, command_spawnfix) || - command_add("spawnstatus", "[All|Disabled|Enabled|Spawn ID] - Show respawn timer status", AccountStatus::GMAdmin, command_spawnstatus) || command_add("stun", "[duration] - Stuns you or your target for duration", AccountStatus::GMAdmin, command_stun) || command_add("summon", "[Character Name] - Summons your corpse, NPC, or player target, or by character name if specified", AccountStatus::QuestTroupe, command_summon) || command_add("summonburiedplayercorpse", "Summons the target's oldest buried corpse, if any exist.", AccountStatus::GMAdmin, command_summonburiedplayercorpse) || @@ -302,12 +271,10 @@ int command_init(void) command_add("petname", "[newname] - Temporarily renames your pet. Leave name blank to restore the original name.", AccountStatus::GMAdmin, command_petname) || command_add("texture", "[Texture] [Helmet Texture] - Change your or your target's texture (Helmet Texture defaults to 0 if not used)", AccountStatus::Steward, command_texture) || command_add("time", "[Hour] [Minute] - Set world time to specified time", AccountStatus::EQSupport, command_time) || - command_add("timers", "Display persistent timers for target", AccountStatus::GMMgmt, command_timers) || command_add("timezone", "[Hour] [Minutes] - Set timezone (Minutes are optional)", AccountStatus::EQSupport, command_timezone) || command_add("title", "[Title] - Set your or your player target's title (use \"-1\" to remove title)", AccountStatus::Guide, command_title) || command_add("titlesuffix", "[Title Suffix] - Set your or your player target's title suffix (use \"-1\" to remove title suffix)", AccountStatus::Guide, command_titlesuffix) || command_add("traindisc", "[level] - Trains all the disciplines usable by the target, up to level specified. (may freeze client for a few seconds)", AccountStatus::GMLeadAdmin, command_traindisc) || - command_add("trapinfo", "Gets infomation about the traps currently spawned in the zone.", AccountStatus::QuestTroupe, command_trapinfo) || command_add("tune", "Calculate statistical values related to combat.", AccountStatus::GMAdmin, command_tune) || command_add("undye", "Remove dye from all of your or your target's armor slots", AccountStatus::GMAdmin, command_undye) || command_add("unfreeze", "Unfreeze your target", AccountStatus::QuestTroupe, command_unfreeze) || @@ -318,22 +285,12 @@ int command_init(void) command_add("untraindisc", "[Spell ID] - Untrain your or your target's discipline by Spell ID", AccountStatus::GMCoder, command_untraindisc) || command_add("untraindiscs", "Untrains all disciplines from your target.", AccountStatus::GMCoder, command_untraindiscs) || command_add("updatechecksum", "update client checksum", AccountStatus::GMImpossible, command_updatechecksum) || - command_add("uptime", "[zone server id] - Get uptime of worldserver, or zone server if argument provided", AccountStatus::Steward, command_uptime) || - command_add("version", "Display current version of EQEmu server", AccountStatus::Player, command_version) || - command_add("viewcurrencies", "View your or your target's currencies", AccountStatus::GMAdmin, command_viewcurrencies) || - command_add("viewnpctype", "[NPC ID] - Show stats for an NPC by NPC ID", AccountStatus::GMAdmin, command_viewnpctype) || - command_add("viewpetition", "[petition number] - View a petition", AccountStatus::ApprenticeGuide, command_viewpetition) || - command_add("viewrecipe", "[Recipe ID] - Show a recipe's entries", AccountStatus::GMAdmin, command_viewrecipe) || - command_add("viewzoneloot", "[item id] - Allows you to search a zone's loot for a specific item ID. (0 shows all loot in the zone)", AccountStatus::QuestTroupe, command_viewzoneloot) || command_add("wc", "[Slot ID] [Material] [Hero Forge Model] [Elite Material] - Sets the specified slot for you or your target to a material, Hero Forge Model and Elite Material are optional", AccountStatus::GMMgmt, command_wc) || command_add("weather", "[0/1/2/3] (Off/Rain/Snow/Manual) - Change the weather", AccountStatus::QuestTroupe, command_weather) || - command_add("who", "[search]", AccountStatus::ApprenticeGuide, command_who) || command_add("worldshutdown", "Shut down world and all zones", AccountStatus::GMMgmt, command_worldshutdown) || command_add("wp", "[add|delete] [grid_id] [pause] [waypoint_id] [-h] - Add or delete a waypoint by grid ID. (-h to use current heading)", AccountStatus::GMAreas, command_wp) || command_add("wpadd", "[pause] [-h] - Add your current location as a waypoint to your NPC target's AI path. (-h to use current heading)", AccountStatus::GMAreas, command_wpadd) || - command_add("wpinfo", "Show waypoint info about your NPC target", AccountStatus::GMAreas, command_wpinfo) || command_add("worldwide", "Performs world-wide GM functions such as cast (can be extended for other commands). Use caution", AccountStatus::GMImpossible, command_worldwide) || - command_add("xtargets", "[New Max XTargets] - Show your or your target's XTargets and optionally set max XTargets.", AccountStatus::GMImpossible, command_xtargets) || command_add("zclip", "[Minimum Clip] [Maximum Clip] [Fog Minimum Clip] [Fog Maximum Clip] [Permanent (0 = False, 1 = True)] - Change zone clipping", AccountStatus::QuestTroupe, command_zclip) || command_add("zcolor", "[Red] [Green] [Blue] [Permanent (0 = False, 1 = True)] - Change sky color", AccountStatus::QuestTroupe, command_zcolor) || command_add("zheader", "[Zone ID|Zone Short Name] [Version] - Load a zone header from the database", AccountStatus::QuestTroupe, command_zheader) || @@ -342,12 +299,10 @@ int command_init(void) command_add("zoneinstance", "[Instance ID] [X] [Y] [Z] - Teleport to specified Instance by ID (coordinates are optional)", AccountStatus::Guide, command_zone_instance) || command_add("zonelock", "[List|Lock|Unlock] [Zone ID|Zone Short Name] - Set or get lock status of a Zone by ID or Short Name", AccountStatus::GMAdmin, command_zonelock) || command_add("zoneshutdown", "[shortname] - Shut down a zone server", AccountStatus::GMLeadAdmin, command_zoneshutdown) || - command_add("zonestatus", "Show connected zoneservers, synonymous with /servers", AccountStatus::GMLeadAdmin, command_zonestatus) || command_add("zopp", "Troubleshooting command - Sends a fake item packet to you. No server reference is created.", AccountStatus::GMImpossible, command_zopp) || command_add("zsafecoords", "[X] [Y] [Z] [Heading] [Permanent (0 = False, 1 = True)] - Set the current zone's safe coordinates", AccountStatus::QuestTroupe, command_zsafecoords) || command_add("zsave", " Saves zheader to the database", AccountStatus::QuestTroupe, command_zsave) || command_add("zsky", "[Sky Type] [Permanent (0 = False, 1 = True)] - Change zone sky type", AccountStatus::QuestTroupe, command_zsky) || - command_add("zstats", "Show info about zone header", AccountStatus::QuestTroupe, command_zstats) || command_add("zunderworld", "[Z] [Permanent (0 = False, 1 = True)] - Change zone underworld Z", AccountStatus::QuestTroupe, command_zunderworld) ) { command_deinit(); @@ -393,6 +348,57 @@ int command_init(void) "findzone", } }, + { + .command = "show", + .aliases = { + "aggro", + "checklos", + "cvs", + "distance", + "emoteview", + "flags", + "fov", + "getplayerburiedcorpsecount", + "getvariable", + "ginfo", + "globalview", + "hatelist", + "iplookup", + "listpetition", + "network", + "netstats", + "npcstats", + "peekinv", + "petitioninfo", + "peqzone_flags", + "proximity", + "questerrors", + "serverinfo", + "showbuffs", + "shownpcgloballoot", + "showskills", + "showspells", + "showspellslist", + "showstats", + "showzonegloballoot", + "showzonepoints", + "spawnstatus", + "timers", + "trapinfo", + "uptime", + "version", + "viewcurrencies", + "viewnpctype", + "viewpetition", + "viewrecipe", + "viewzoneloot", + "who", + "wpinfo", + "xtargets", + "zonestatus", + "zstats" + } + }, }; // inject static aliases @@ -963,7 +969,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/acceptrules.cpp" #include "gm_commands/advnpcspawn.cpp" -#include "gm_commands/aggro.cpp" #include "gm_commands/aggrozone.cpp" #include "gm_commands/ai.cpp" #include "gm_commands/appearance.cpp" @@ -976,12 +981,10 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/camerashake.cpp" #include "gm_commands/castspell.cpp" #include "gm_commands/chat.cpp" -#include "gm_commands/checklos.cpp" #include "gm_commands/copycharacter.cpp" #include "gm_commands/corpse.cpp" #include "gm_commands/corpsefix.cpp" #include "gm_commands/countitem.cpp" -#include "gm_commands/cvs.cpp" #include "gm_commands/damage.cpp" #include "gm_commands/databuckets.cpp" #include "gm_commands/date.cpp" @@ -993,7 +996,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/devtools.cpp" #include "gm_commands/disablerecipe.cpp" #include "gm_commands/disarmtrap.cpp" -#include "gm_commands/distance.cpp" #include "gm_commands/doanim.cpp" #include "gm_commands/door.cpp" #include "gm_commands/door_manipulation.cpp" @@ -1002,7 +1004,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/dzkickplayers.cpp" #include "gm_commands/editmassrespawn.cpp" #include "gm_commands/emote.cpp" -#include "gm_commands/emoteview.cpp" #include "gm_commands/emptyinventory.cpp" #include "gm_commands/enablerecipe.cpp" #include "gm_commands/endurance.cpp" @@ -1014,19 +1015,13 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/fixmob.cpp" #include "gm_commands/flag.cpp" #include "gm_commands/flagedit.cpp" -#include "gm_commands/flags.cpp" #include "gm_commands/flymode.cpp" -#include "gm_commands/fov.cpp" #include "gm_commands/freeze.cpp" #include "gm_commands/gassign.cpp" #include "gm_commands/gearup.cpp" #include "gm_commands/gender.cpp" -#include "gm_commands/getplayerburiedcorpsecount.cpp" -#include "gm_commands/getvariable.cpp" -#include "gm_commands/ginfo.cpp" #include "gm_commands/giveitem.cpp" #include "gm_commands/givemoney.cpp" -#include "gm_commands/globalview.cpp" #include "gm_commands/gm.cpp" #include "gm_commands/gmspeed.cpp" #include "gm_commands/gmzone.cpp" @@ -1035,7 +1030,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/grid.cpp" #include "gm_commands/guild.cpp" #include "gm_commands/haste.cpp" -#include "gm_commands/hatelist.cpp" #include "gm_commands/heal.cpp" #include "gm_commands/heromodel.cpp" #include "gm_commands/hideme.cpp" @@ -1047,14 +1041,12 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/invsnapshot.cpp" #include "gm_commands/invul.cpp" #include "gm_commands/ipban.cpp" -#include "gm_commands/iplookup.cpp" #include "gm_commands/kick.cpp" #include "gm_commands/kill.cpp" #include "gm_commands/killallnpcs.cpp" #include "gm_commands/lastname.cpp" #include "gm_commands/level.cpp" #include "gm_commands/list.cpp" -#include "gm_commands/listpetition.cpp" #include "gm_commands/lootsim.cpp" #include "gm_commands/loc.cpp" #include "gm_commands/logs.cpp" @@ -1071,8 +1063,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/mysql.cpp" #include "gm_commands/mystats.cpp" #include "gm_commands/name.cpp" -#include "gm_commands/netstats.cpp" -#include "gm_commands/network.cpp" #include "gm_commands/npccast.cpp" #include "gm_commands/npcedit.cpp" #include "gm_commands/npceditmass.cpp" @@ -1081,7 +1071,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/npcsay.cpp" #include "gm_commands/npcshout.cpp" #include "gm_commands/npcspawn.cpp" -#include "gm_commands/npcstats.cpp" #include "gm_commands/npctypespawn.cpp" #include "gm_commands/nudge.cpp" #include "gm_commands/nukebuffs.cpp" @@ -1089,22 +1078,17 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/object.cpp" #include "gm_commands/oocmute.cpp" #include "gm_commands/path.cpp" -#include "gm_commands/peekinv.cpp" #include "gm_commands/peqzone.cpp" -#include "gm_commands/peqzone_flags.cpp" #include "gm_commands/permaclass.cpp" #include "gm_commands/permagender.cpp" #include "gm_commands/permarace.cpp" #include "gm_commands/petitems.cpp" -#include "gm_commands/petitioninfo.cpp" #include "gm_commands/petname.cpp" #include "gm_commands/picklock.cpp" #include "gm_commands/profanity.cpp" -#include "gm_commands/proximity.cpp" #include "gm_commands/push.cpp" #include "gm_commands/pvp.cpp" #include "gm_commands/qglobal.cpp" -#include "gm_commands/questerrors.cpp" #include "gm_commands/race.cpp" #include "gm_commands/raidloot.cpp" #include "gm_commands/randomfeatures.cpp" @@ -1124,7 +1108,6 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/scribespells.cpp" #include "gm_commands/sendzonespawns.cpp" #include "gm_commands/sensetrap.cpp" -#include "gm_commands/serverinfo.cpp" #include "gm_commands/serverlock.cpp" #include "gm_commands/serverrules.cpp" #include "gm_commands/set_adventure_points.cpp" @@ -1147,19 +1130,11 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/setstartzone.cpp" #include "gm_commands/setstat.cpp" #include "gm_commands/setxp.cpp" -#include "gm_commands/showbuffs.cpp" -#include "gm_commands/shownpcgloballoot.cpp" -#include "gm_commands/showskills.cpp" -#include "gm_commands/showspells.cpp" -#include "gm_commands/showspellslist.cpp" -#include "gm_commands/showstats.cpp" -#include "gm_commands/showzonegloballoot.cpp" -#include "gm_commands/showzonepoints.cpp" +#include "gm_commands/show.cpp" #include "gm_commands/shutdown.cpp" #include "gm_commands/spawn.cpp" #include "gm_commands/spawneditmass.cpp" #include "gm_commands/spawnfix.cpp" -#include "gm_commands/spawnstatus.cpp" #include "gm_commands/faction_association.cpp" #include "gm_commands/stun.cpp" #include "gm_commands/summon.cpp" @@ -1171,12 +1146,10 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/tempname.cpp" #include "gm_commands/texture.cpp" #include "gm_commands/time.cpp" -#include "gm_commands/timers.cpp" #include "gm_commands/timezone.cpp" #include "gm_commands/title.cpp" #include "gm_commands/titlesuffix.cpp" #include "gm_commands/traindisc.cpp" -#include "gm_commands/trapinfo.cpp" #include "gm_commands/tune.cpp" #include "gm_commands/undye.cpp" #include "gm_commands/unfreeze.cpp" @@ -1187,22 +1160,12 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/updatechecksum.cpp" #include "gm_commands/untraindisc.cpp" #include "gm_commands/untraindiscs.cpp" -#include "gm_commands/uptime.cpp" -#include "gm_commands/version.cpp" -#include "gm_commands/viewcurrencies.cpp" -#include "gm_commands/viewnpctype.cpp" -#include "gm_commands/viewpetition.cpp" -#include "gm_commands/viewrecipe.cpp" -#include "gm_commands/viewzoneloot.cpp" #include "gm_commands/wc.cpp" #include "gm_commands/weather.cpp" -#include "gm_commands/who.cpp" #include "gm_commands/worldshutdown.cpp" #include "gm_commands/worldwide.cpp" #include "gm_commands/wp.cpp" #include "gm_commands/wpadd.cpp" -#include "gm_commands/wpinfo.cpp" -#include "gm_commands/xtargets.cpp" #include "gm_commands/zclip.cpp" #include "gm_commands/zcolor.cpp" #include "gm_commands/zheader.cpp" @@ -1210,11 +1173,9 @@ void command_bot(Client *c, const Seperator *sep) #include "gm_commands/zonebootup.cpp" #include "gm_commands/zonelock.cpp" #include "gm_commands/zoneshutdown.cpp" -#include "gm_commands/zonestatus.cpp" #include "gm_commands/zone_instance.cpp" #include "gm_commands/zopp.cpp" #include "gm_commands/zsafecoords.cpp" #include "gm_commands/zsave.cpp" #include "gm_commands/zsky.cpp" -#include "gm_commands/zstats.cpp" #include "gm_commands/zunderworld.cpp" diff --git a/zone/command.h b/zone/command.h index c746cf21ff..34cad6fad1 100644 --- a/zone/command.h +++ b/zone/command.h @@ -33,12 +33,11 @@ std::string GetModifyNPCStatDescription(std::string stat); void SendNPCEditSubCommands(Client *c); void SendRuleSubCommands(Client *c); void SendGuildSubCommands(Client *c); -void SendPeekInvSubCommands(Client *c); +void SendShowInventorySubCommands(Client *c); // Commands void command_acceptrules(Client *c, const Seperator *sep); void command_advnpcspawn(Client *c, const Seperator *sep); -void command_aggro(Client *c, const Seperator *sep); void command_aggrozone(Client *c, const Seperator *sep); void command_ai(Client *c, const Seperator *sep); void command_appearance(Client *c, const Seperator *sep); @@ -52,12 +51,10 @@ void command_bugs(Client *c, const Seperator *sep); void command_camerashake(Client *c, const Seperator *sep); void command_castspell(Client *c, const Seperator *sep); void command_chat(Client *c, const Seperator *sep); -void command_checklos(Client *c, const Seperator *sep); void command_copycharacter(Client *c, const Seperator *sep); void command_corpse(Client *c, const Seperator *sep); void command_corpsefix(Client *c, const Seperator *sep); void command_countitem(Client *c, const Seperator *sep); -void command_cvs(Client *c, const Seperator *sep); void command_damage(Client *c, const Seperator *sep); void command_databuckets(Client *c, const Seperator *sep); void command_date(Client *c, const Seperator *sep); @@ -70,14 +67,12 @@ void command_devtools(Client *c, const Seperator *sep); void command_disablerecipe(Client *c, const Seperator *sep); void command_disarmtrap(Client *c, const Seperator *sep); void command_door(Client *c, const Seperator *sep); -void command_distance(Client *c, const Seperator *sep); void command_doanim(Client *c, const Seperator *sep); void command_dye(Client *c, const Seperator *sep); void command_dz(Client *c, const Seperator *sep); void command_dzkickplayers(Client *c, const Seperator *sep); void command_editmassrespawn(Client *c, const Seperator *sep); void command_emote(Client *c, const Seperator *sep); -void command_emoteview(Client *c, const Seperator *sep); void command_emptyinventory(Client *c, const Seperator *sep); void command_enablerecipe(Client *c, const Seperator *sep); void command_endurance(Client *c, const Seperator *sep); @@ -90,19 +85,13 @@ void command_find(Client *c, const Seperator *sep); void command_fixmob(Client *c, const Seperator *sep); void command_flag(Client *c, const Seperator *sep); void command_flagedit(Client *c, const Seperator *sep); -void command_flags(Client *c, const Seperator *sep); void command_flymode(Client *c, const Seperator *sep); -void command_fov(Client *c, const Seperator *sep); void command_freeze(Client *c, const Seperator *sep); void command_gassign(Client *c, const Seperator *sep); void command_gearup(Client *c, const Seperator *sep); void command_gender(Client *c, const Seperator *sep); -void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep); -void command_getvariable(Client *c, const Seperator *sep); -void command_ginfo(Client *c, const Seperator *sep); void command_giveitem(Client *c, const Seperator *sep); void command_givemoney(Client *c, const Seperator *sep); -void command_globalview(Client *c, const Seperator *sep); void command_gm(Client *c, const Seperator *sep); void command_gmspeed(Client *c, const Seperator *sep); void command_gmzone(Client *c, const Seperator *sep); @@ -111,7 +100,6 @@ void command_goto(Client *c, const Seperator *sep); void command_grid(Client *c, const Seperator *sep); void command_guild(Client *c, const Seperator *sep); void command_haste(Client *c, const Seperator *sep); -void command_hatelist(Client *c, const Seperator *sep); void command_heal(Client *c, const Seperator *sep); void command_help(Client *c, const Seperator *sep); void command_heromodel(Client *c, const Seperator *sep); @@ -125,14 +113,12 @@ void command_interrupt(Client *c, const Seperator *sep); void command_invsnapshot(Client *c, const Seperator *sep); void command_invul(Client *c, const Seperator *sep); void command_ipban(Client *c, const Seperator *sep); -void command_iplookup(Client *c, const Seperator *sep); void command_kick(Client *c, const Seperator *sep); void command_killallnpcs(Client *c, const Seperator *sep); void command_kill(Client *c, const Seperator *sep); void command_lastname(Client *c, const Seperator *sep); void command_level(Client *c, const Seperator *sep); void command_list(Client *c, const Seperator *sep); -void command_listpetition(Client *c, const Seperator *sep); void command_lootsim(Client *c, const Seperator *sep); void command_load_shared_memory(Client *c, const Seperator *sep); void command_loc(Client *c, const Seperator *sep); @@ -150,8 +136,6 @@ void command_myskills(Client *c, const Seperator *sep); void command_mysql(Client *c, const Seperator *sep); void command_mystats(Client *c, const Seperator *sep); void command_name(Client *c, const Seperator *sep); -void command_netstats(Client *c, const Seperator *sep); -void command_network(Client *c, const Seperator *sep); void command_npccast(Client *c, const Seperator *sep); void command_npcedit(Client *c, const Seperator *sep); void command_npceditmass(Client *c, const Seperator *sep); @@ -160,7 +144,6 @@ void command_npcloot(Client *c, const Seperator *sep); void command_npcsay(Client *c, const Seperator *sep); void command_npcshout(Client *c, const Seperator *sep); void command_npcspawn(Client *c, const Seperator *sep); -void command_npcstats(Client *c, const Seperator *sep); void command_npctypespawn(Client *c, const Seperator *sep); void command_nudge(Client *c, const Seperator *sep); void command_nukebuffs(Client *c, const Seperator *sep); @@ -168,21 +151,16 @@ 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_path(Client *c, const Seperator *sep); -void command_peekinv(Client *c, const Seperator *sep); void command_peqzone(Client *c, const Seperator *sep); -void command_peqzone_flags(Client *c, const Seperator *sep); void command_permaclass(Client *c, const Seperator *sep); void command_permagender(Client *c, const Seperator *sep); void command_permarace(Client *c, const Seperator *sep); void command_petitems(Client *c, const Seperator *sep); -void command_petitioninfo(Client *c, const Seperator *sep); void command_picklock(Client *c, const Seperator *sep); void command_profanity(Client *c, const Seperator *sep); -void command_proximity(Client *c, const Seperator *sep); void command_push(Client *c, const Seperator *sep); void command_pvp(Client *c, const Seperator *sep); void command_qglobal(Client *c, const Seperator *sep); -void command_questerrors(Client *c, const Seperator *sep); void command_race(Client *c, const Seperator *sep); void command_raidloot(Client* c, const Seperator* sep); void command_randomfeatures(Client *c, const Seperator *sep); @@ -203,7 +181,6 @@ void command_scribespell(Client *c, const Seperator *sep); void command_scribespells(Client *c, const Seperator *sep); void command_sendzonespawns(Client *c, const Seperator *sep); void command_sensetrap(Client *c, const Seperator *sep); -void command_serverinfo(Client *c, const Seperator *sep); void command_serverrules(Client *c, const Seperator *sep); void command_set_adventure_points(Client *c, const Seperator *sep); void command_setaapts(Client *c, const Seperator *sep); @@ -225,19 +202,11 @@ void command_setskillall(Client *c, const Seperator *sep); void command_setstartzone(Client *c, const Seperator *sep); void command_setstat(Client *c, const Seperator *sep); void command_setxp(Client *c, const Seperator *sep); -void command_showbuffs(Client *c, const Seperator *sep); -void command_shownpcgloballoot(Client *c, const Seperator *sep); -void command_showskills(Client *c, const Seperator *sep); -void command_showspells(Client *c, const Seperator *sep); -void command_showspellslist(Client *c, const Seperator *sep); -void command_showstats(Client *c, const Seperator *sep); -void command_showzonegloballoot(Client *c, const Seperator *sep); -void command_showzonepoints(Client *c, const Seperator *sep); +void command_show(Client *c, const Seperator *sep); void command_shutdown(Client *c, const Seperator *sep); void command_spawn(Client *c, const Seperator *sep); void command_spawneditmass(Client *c, const Seperator *sep); void command_spawnfix(Client *c, const Seperator *sep); -void command_spawnstatus(Client *c, const Seperator *sep); void command_stun(Client *c, const Seperator *sep); void command_summon(Client *c, const Seperator *sep); void command_summonburiedplayercorpse(Client *c, const Seperator *sep); @@ -249,12 +218,10 @@ void command_tempname(Client *c, const Seperator *sep); void command_petname(Client *c, const Seperator *sep); void command_texture(Client *c, const Seperator *sep); void command_time(Client *c, const Seperator *sep); -void command_timers(Client *c, const Seperator *sep); void command_timezone(Client *c, const Seperator *sep); void command_title(Client *c, const Seperator *sep); void command_titlesuffix(Client *c, const Seperator *sep); void command_traindisc(Client *c, const Seperator *sep); -void command_trapinfo(Client *c, const Seperator *sep); void command_tune(Client *c, const Seperator *sep); void command_undye(Client *c, const Seperator *sep); void command_unfreeze(Client *c, const Seperator *sep); @@ -265,22 +232,12 @@ void command_unscribespells(Client *c, const Seperator *sep); void command_untraindisc(Client *c, const Seperator *sep); void command_untraindiscs(Client *c, const Seperator *sep); void command_updatechecksum(Client* c, const Seperator* sep); -void command_uptime(Client *c, const Seperator *sep); -void command_version(Client *c, const Seperator *sep); -void command_viewcurrencies(Client *c, const Seperator *sep); -void command_viewnpctype(Client *c, const Seperator *sep); -void command_viewpetition(Client *c, const Seperator *sep); -void command_viewrecipe(Client *c, const Seperator *sep); -void command_viewzoneloot(Client *c, const Seperator *sep); void command_wc(Client *c, const Seperator *sep); void command_weather(Client *c, const Seperator *sep); -void command_who(Client *c, const Seperator *sep); void command_worldshutdown(Client *c, const Seperator *sep); void command_wp(Client *c, const Seperator *sep); void command_wpadd(Client *c, const Seperator *sep); -void command_wpinfo(Client *c, const Seperator *sep); void command_worldwide(Client *c, const Seperator *sep); -void command_xtargets(Client *c, const Seperator *sep); void command_zclip(Client *c, const Seperator *sep); void command_zcolor(Client *c, const Seperator *sep); void command_zheader(Client *c, const Seperator *sep); @@ -289,12 +246,10 @@ void command_zone_instance(Client *c, const Seperator *sep); void command_zonebootup(Client *c, const Seperator *sep); void command_zonelock(Client *c, const Seperator *sep); void command_zoneshutdown(Client *c, const Seperator *sep); -void command_zonestatus(Client *c, const Seperator *sep); void command_zopp(Client *c, const Seperator *sep); void command_zsafecoords(Client *c, const Seperator *sep); void command_zsave(Client *c, const Seperator *sep); void command_zsky(Client *c, const Seperator *sep); -void command_zstats(Client *c, const Seperator *sep); void command_zunderworld(Client *c, const Seperator *sep); #include "bot.h" diff --git a/zone/entity.h b/zone/entity.h index 3f0800d24f..3bf128fc78 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -553,7 +553,7 @@ class EntityList bool add_self_to_other_lists = false ); - void GetTrapInfo(Client* client); + void GetTrapInfo(Client* c); bool IsTrapGroupSpawned(uint32 trap_id, uint8 group); void UpdateAllTraps(bool respawn, bool repopnow = false); void ClearTrapPointers(); diff --git a/zone/gm_commands/aggro.cpp b/zone/gm_commands/aggro.cpp deleted file mode 100755 index 926904131c..0000000000 --- a/zone/gm_commands/aggro.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "../client.h" - -void command_aggro(Client *c, const Seperator *sep) -{ - int arguments = sep->argnum; - if (!arguments || !sep->IsNumber(1)) { - c->Message(Chat::White, "Usage: #aggro [Distance] [-v] (-v is verbose Faction Information)"); - return; - } - - if ( - !c->GetTarget() || - ( - c->GetTarget() && - !c->GetTarget()->IsNPC() - ) - ) { - c->Message(Chat::White, "You must target an NPC to use this command."); - return; - } - - NPC* target = c->GetTarget()->CastToNPC(); - - float distance = Strings::ToFloat(sep->arg[1]); - bool verbose = !strcasecmp("-v", sep->arg[2]); - entity_list.DescribeAggro(c, target, distance, verbose); -} - diff --git a/zone/gm_commands/checklos.cpp b/zone/gm_commands/checklos.cpp deleted file mode 100755 index 150e746490..0000000000 --- a/zone/gm_commands/checklos.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "../client.h" - -void command_checklos(Client *c, const Seperator *sep) -{ - if (!c->GetTarget()) { - c->Message(Chat::White, "You must have a target to use this command."); - return; - } - - auto target = c->GetTarget(); - - bool has_los = c->CheckLosFN(target); - - c->Message( - Chat::White, - fmt::format( - "You {}have line of sight to {}.", - has_los ? "" : "do not ", - c->GetTargetDescription(target) - ).c_str() - ); -} - diff --git a/zone/gm_commands/cvs.cpp b/zone/gm_commands/cvs.cpp deleted file mode 100755 index a9f99c3696..0000000000 --- a/zone/gm_commands/cvs.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "../client.h" -#include "../worldserver.h" - -extern WorldServer worldserver; - -void command_cvs(Client *c, const Seperator *sep) -{ - auto pack = new ServerPacket(ServerOP_ClientVersionSummary, sizeof(ServerRequestClientVersionSummary_Struct)); - auto srcvss = (ServerRequestClientVersionSummary_Struct *) pack->pBuffer; - strn0cpy(srcvss->Name, c->GetName(), sizeof(srcvss->Name)); - worldserver.SendPacket(pack); - safe_delete(pack); -} - diff --git a/zone/gm_commands/distance.cpp b/zone/gm_commands/distance.cpp deleted file mode 100755 index f694461296..0000000000 --- a/zone/gm_commands/distance.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "../client.h" - -void command_distance(Client *c, const Seperator *sep) -{ - if (c->GetTarget()) { - Mob *target = c->GetTarget(); - if (c != target) { - c->Message( - Chat::White, - fmt::format( - "{} is {:.2f} units from you.", - c->GetTargetDescription(target), - Distance( - c->GetPosition(), - target->GetPosition() - ) - ).c_str() - ); - } - } -} - diff --git a/zone/gm_commands/flags.cpp b/zone/gm_commands/flags.cpp deleted file mode 100755 index 8b28c7d690..0000000000 --- a/zone/gm_commands/flags.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "../client.h" - -void command_flags(Client *c, const Seperator *sep) -{ - Client *target = c; - - if ( - c->GetTarget() && - c->GetTarget()->IsClient() && - c->Admin() >= minStatusToSeeOthersZoneFlags - ) { - target = c->GetTarget()->CastToClient(); - } - - target->SendZoneFlagInfo(c); -} - diff --git a/zone/gm_commands/fov.cpp b/zone/gm_commands/fov.cpp deleted file mode 100755 index bfb8397c30..0000000000 --- a/zone/gm_commands/fov.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "../client.h" - -void command_fov(Client *c, const Seperator *sep) -{ - if (!c->GetTarget()) { - c->Message(Chat::White, "You must have a target to use this command."); - return; - } - - auto target = c->GetTarget(); - - std::string behind_message = ( - c->BehindMob( - target, - c->GetX(), - c->GetY() - ) ? - "behind" : - "not behind" - ); - - std::string gender_message = ( - target->GetGender() == MALE ? - "he" : - ( - target->GetGender() == FEMALE ? - "she" : - "it" - ) - ); - - c->Message( - Chat::White, - fmt::format( - "You are {} {}, {} has a heading of {}.", - behind_message, - c->GetTargetDescription(target), - gender_message, - target->GetHeading() - ).c_str() - ); -} - diff --git a/zone/gm_commands/getplayerburiedcorpsecount.cpp b/zone/gm_commands/getplayerburiedcorpsecount.cpp deleted file mode 100755 index 8692c7d3ee..0000000000 --- a/zone/gm_commands/getplayerburiedcorpsecount.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "../client.h" -#include "../corpse.h" - -void command_getplayerburiedcorpsecount(Client *c, const Seperator *sep) -{ - Client *target = c; - if (c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM()) { - target = c->GetTarget()->CastToClient(); - } - - uint32 corpse_count = database.GetCharacterBuriedCorpseCount(target->CharacterID()); - c->Message( - Chat::White, - fmt::format( - "{} {} {} buried corpse{}.", - c->GetTargetDescription(target, TargetDescriptionType::UCYou), - c == target ? "have" : "has", - ( - corpse_count ? - std::to_string(corpse_count) : - "no" - ), - corpse_count != 1 ? "s" : "" - ).c_str() - ); -} diff --git a/zone/gm_commands/getvariable.cpp b/zone/gm_commands/getvariable.cpp deleted file mode 100755 index 7b26ccfb0d..0000000000 --- a/zone/gm_commands/getvariable.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "../client.h" - -void command_getvariable(Client *c, const Seperator *sep) -{ - std::string variable = sep->argplus[1]; - if (variable.empty()) { - c->Message(Chat::White, "Usage: #getvariable [Variable Name]"); - return; - } - - std::string message; - std::string value; - if (database.GetVariable(variable, value)) { - message = fmt::format( - "Variable {}: {}", - variable, - value - ); - } else { - message = fmt::format( - "Variable '{}' does not exist.", - variable - ); - } - - c->Message( - Chat::White, - message.c_str() - ); -} - diff --git a/zone/gm_commands/ginfo.cpp b/zone/gm_commands/ginfo.cpp deleted file mode 100755 index 3850c6b919..0000000000 --- a/zone/gm_commands/ginfo.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "../client.h" -#include "../groups.h" - -void command_ginfo(Client *c, const Seperator *sep) -{ - Client *target = c; - if (c->GetTarget() && c->GetTarget()->IsClient()) { - target = c->GetTarget()->CastToClient(); - } - - auto target_group = target->GetGroup(); - if (!target_group) { - c->Message( - Chat::White, - fmt::format( - "{} {} not in a group.", - c->GetTargetDescription(target, TargetDescriptionType::UCYou), - c == target ? "are" : "is" - ).c_str() - ); - return; - } - - std::string popup_title = fmt::format( - "Group Info for {}", - c->GetTargetDescription(target, TargetDescriptionType::UCSelf) - ); - std::string popup_text = ""; - popup_text += fmt::format( - "", - target_group->GetID(), - target_group->GroupCount() - ); - popup_text += "

"; - popup_text += ""; - popup_text += ""; - popup_text += ""; - popup_text += ""; - popup_text += ""; - popup_text += ""; - popup_text += ""; - popup_text += ""; - - for (int group_member = 0; group_member < MAX_GROUP_MEMBERS; group_member++) { - if (target_group->membername[group_member][0] == '\0') { - continue; - } - - bool is_assist = target_group->MemberRoles[group_member] & RoleAssist; - bool is_puller = target_group->MemberRoles[group_member] & RolePuller; - bool is_tank = target_group->MemberRoles[group_member] & RoleTank; - - popup_text += fmt::format( - "", - group_member, - ( - strcmp(target_group->membername[group_member], c->GetCleanName()) ? - target_group->membername[group_member] : - fmt::format( - "{} (You)", - target_group->membername[group_member] - ) - ), - target_group->members[group_member] ? "Y" : "N", - is_assist ? "Y" : "N", - is_puller ? "Y" : "N", - is_tank ? "Y" : "N" - ); - } - - popup_text += "
Group ID{}Members{}
IndexNameIn ZoneAssistPullerTank
{}{}{}{}{}{}
"; - - c->SendPopupToClient( - popup_title.c_str(), - popup_text.c_str() - ); -} - diff --git a/zone/gm_commands/globalview.cpp b/zone/gm_commands/globalview.cpp deleted file mode 100755 index 948ecd3532..0000000000 --- a/zone/gm_commands/globalview.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "../client.h" - -void command_globalview(Client *c, const Seperator *sep) -{ - NPC *npcmob = nullptr; - - if (c->GetTarget() && c->GetTarget()->IsNPC()) { - npcmob = c->GetTarget()->CastToNPC(); - QGlobalCache *npc_c = nullptr; - QGlobalCache *char_c = nullptr; - QGlobalCache *zone_c = nullptr; - - if (npcmob) { - npc_c = npcmob->GetQGlobals(); - } - - char_c = c->GetQGlobals(); - zone_c = zone->GetQGlobals(); - - std::list globalMap; - uint32 ntype = 0; - - if (npcmob) { - ntype = npcmob->GetNPCTypeID(); - } - - if (npc_c) { - QGlobalCache::Combine(globalMap, npc_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); - } - - if (char_c) { - QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); - } - - if (zone_c) { - QGlobalCache::Combine(globalMap, zone_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); - } - - auto iter = globalMap.begin(); - uint32 gcount = 0; - - c->Message(Chat::White, "Name, Value"); - while (iter != globalMap.end()) { - c->Message(Chat::White, "%s %s", (*iter).name.c_str(), (*iter).value.c_str()); - ++iter; - ++gcount; - } - c->Message(Chat::White, "%u globals loaded.", gcount); - } - else { - QGlobalCache *char_c = nullptr; - QGlobalCache *zone_c = nullptr; - - char_c = c->GetQGlobals(); - zone_c = zone->GetQGlobals(); - - std::list globalMap; - uint32 ntype = 0; - - if (char_c) { - QGlobalCache::Combine(globalMap, char_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); - } - - if (zone_c) { - QGlobalCache::Combine(globalMap, zone_c->GetBucket(), ntype, c->CharacterID(), zone->GetZoneID()); - } - - auto iter = globalMap.begin(); - uint32 gcount = 0; - - c->Message(Chat::White, "Name, Value"); - while (iter != globalMap.end()) { - c->Message(Chat::White, "%s %s", (*iter).name.c_str(), (*iter).value.c_str()); - ++iter; - ++gcount; - } - c->Message(Chat::White, "%u globals loaded.", gcount); - } -} - diff --git a/zone/gm_commands/iplookup.cpp b/zone/gm_commands/iplookup.cpp deleted file mode 100755 index 1595a5ee66..0000000000 --- a/zone/gm_commands/iplookup.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "../client.h" -#include "../worldserver.h" - -extern WorldServer worldserver; - -void command_iplookup(Client *c, const Seperator *sep) -{ - auto pack = - new ServerPacket( - ServerOP_IPLookup, - sizeof(ServerGenericWorldQuery_Struct) + - strlen(sep->argplus[1]) + 1 - ); - ServerGenericWorldQuery_Struct *s = (ServerGenericWorldQuery_Struct *) pack->pBuffer; - strcpy(s->from, c->GetName()); - s->admin = c->Admin(); - if (sep->argplus[1][0] != 0) { - strcpy(s->query, sep->argplus[1]); - } - worldserver.SendPacket(pack); - safe_delete(pack); -} - diff --git a/zone/gm_commands/listpetition.cpp b/zone/gm_commands/listpetition.cpp deleted file mode 100755 index 110809deb6..0000000000 --- a/zone/gm_commands/listpetition.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "../client.h" - -void command_listpetition(Client *c, const Seperator *sep) -{ - std::string query = "SELECT petid, charname, accountname FROM petitions ORDER BY petid"; - auto results = database.QueryDatabase(query); - if (!results.Success()) { - return; - } - - LogInfo("Petition list requested by [{}]", c->GetName()); - - if (results.RowCount() == 0) { - return; - } - - c->Message(Chat::Red, " ID : Character Name , Account Name"); - - for (auto row = results.begin(); row != results.end(); ++row) - c->Message(Chat::Yellow, " %s: %s , %s ", row[0], row[1], row[2]); -} - diff --git a/zone/gm_commands/netstats.cpp b/zone/gm_commands/netstats.cpp deleted file mode 100755 index 87fd11a4c1..0000000000 --- a/zone/gm_commands/netstats.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "../client.h" - -void command_netstats(Client *c, const Seperator *sep) -{ - bool is_full = !strcasecmp(sep->arg[1], "full"); - bool is_reset = !strcasecmp(sep->arg[1], "reset"); - - if (is_reset) { - auto connection = c->Connection(); - c->Message(Chat::White, "Resetting client stats (packet loss will not read correctly after reset)."); - connection->ResetStats(); - return; - } - - auto connection = c->Connection(); - auto opts = connection->GetManager()->GetOptions(); - auto eqs_stats = connection->GetStats(); - auto &stats = eqs_stats.DaybreakStats; - auto now = EQ::Net::Clock::now(); - auto sec_since_stats_reset = std::chrono::duration_cast>( - now - stats.created - ).count(); - - std::string popup_text = ""; - - popup_text += fmt::format( - "", - stats.sent_bytes, - stats.sent_bytes / sec_since_stats_reset - ); - - popup_text += fmt::format( - "", - stats.recv_bytes, - stats.recv_bytes / sec_since_stats_reset - ); - - popup_text += "

"; - - popup_text += fmt::format( - "", - stats.bytes_before_encode, - static_cast(stats.bytes_before_encode - stats.sent_bytes) / - static_cast(stats.bytes_before_encode) * 100.0 - ); - - popup_text += fmt::format( - "", - stats.bytes_after_decode, - static_cast(stats.bytes_after_decode - stats.recv_bytes) / - static_cast(stats.bytes_after_decode) * 100.0 - ); - - popup_text += "

"; - - popup_text += fmt::format("
", stats.min_ping); - popup_text += fmt::format("", stats.max_ping); - popup_text += fmt::format("", stats.last_ping); - popup_text += fmt::format("", stats.avg_ping); - - popup_text += "

"; - - popup_text += fmt::format( - "", - stats.recv_packets, - stats.recv_packets / sec_since_stats_reset - ); - - popup_text += fmt::format( - "", - stats.sent_packets, - stats.sent_packets / sec_since_stats_reset - ); - - popup_text += "

"; - - popup_text += fmt::format("", stats.sync_recv_packets); - popup_text += fmt::format("", stats.sync_sent_packets); - popup_text += fmt::format("", stats.sync_remote_recv_packets); - popup_text += fmt::format("", stats.sync_remote_sent_packets); - - popup_text += "

"; - - popup_text += fmt::format( - "", - (100.0 * (1.0 - static_cast(stats.sync_recv_packets) / static_cast(stats.sync_remote_sent_packets))) - ); - - popup_text += fmt::format( - "", - (100.0 * (1.0 - static_cast(stats.sync_remote_recv_packets) / static_cast(stats.sync_sent_packets))) - ); - - popup_text += "

"; - - popup_text += fmt::format( - "
", - stats.resent_packets, - stats.resent_packets / sec_since_stats_reset - ); - - popup_text += fmt::format( - "", - stats.resent_fragments, - stats.resent_fragments / sec_since_stats_reset - ); - - popup_text += fmt::format( - "", - stats.resent_full, - stats.resent_full / sec_since_stats_reset - ); - - popup_text += "

"; - - popup_text += fmt::format( - "", - stats.dropped_datarate_packets, - stats.dropped_datarate_packets / sec_since_stats_reset - ); - - if (opts.daybreak_options.outgoing_data_rate > 0.0) { - popup_text += fmt::format( - "", - (100.0 * (1.0 - ((opts.daybreak_options.outgoing_data_rate - stats.datarate_remaining) / opts.daybreak_options.outgoing_data_rate))), - opts.daybreak_options.outgoing_data_rate - ); - } - - if (is_full) { - popup_text += "

"; - - popup_text += ""; - for (auto i = 0; i < _maxEmuOpcode; ++i) { - auto cnt = eqs_stats.SentCount[i]; - if (cnt > 0) { - popup_text += fmt::format( - "", - OpcodeNames[i], - cnt, - cnt / sec_since_stats_reset - ); - } - } - - popup_text += "

"; - - popup_text += ""; - for (auto i = 0; i < _maxEmuOpcode; ++i) { - auto cnt = eqs_stats.RecvCount[i]; - if (cnt > 0) { - popup_text += fmt::format( - "", - OpcodeNames[i], - cnt, - cnt / sec_since_stats_reset - ); - } - } - } - - popup_text += "
Sent Bytes{} ({:.2f} Per Second)
Received Bytes{} ({:.2f} Per Second)
Bytes Before Encode (Sent){}Compression Rate{:.2f}%%
Bytes After Decode (Received){}Compression Rate{:.2f}%%
Min Ping{}
Max Ping{}
Last Ping{}
Average Ping{}
(Realtime) Received Packets{} ({:.2f} Per Second)
(Realtime) Sent Packets{} ({:.2f} Per Second)
(Sync) Received Packets{}
(Sync) Sent Packets{}
(Sync) Remote Received Packets{}
(Sync) Remote Sent Packets{}
Packet Loss In{:.2f}%%
Packet Loss Out{:.2f}%%
Resent Packets{} ({:.2f} Per Second)
Resent Fragments{} ({:.2f} Per Second)
Resent Non-Fragments{} ({:.2f} Per Second)
Dropped Datarate Packets{} ({:.2f} Per Second)
Outgoing Link Saturation{:.2f}%% ({:.2f}kb Per Second)
Sent Packet Types
{}{} ({:.2f} Per Second)
Received Packet Types
{}{} ({:.2f} Per Second)
"; - - c->SendPopupToClient( - "Network Statistics", - popup_text.c_str() - ); -} - diff --git a/zone/gm_commands/network.cpp b/zone/gm_commands/network.cpp deleted file mode 100755 index 7f18e86ac8..0000000000 --- a/zone/gm_commands/network.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "../client.h" - -void command_network(Client *c, const Seperator *sep) -{ - if (!strcasecmp(sep->arg[1], "getopt")) { - auto eqsi = c->Connection(); - auto manager = eqsi->GetManager(); - auto opts = manager->GetOptions(); - - if (!strcasecmp(sep->arg[2], "all")) { - c->Message(Chat::White, "max_packet_size: %llu", (uint64_t) opts.daybreak_options.max_packet_size); - c->Message( - Chat::White, - "max_connection_count: %llu", - (uint64_t) opts.daybreak_options.max_connection_count - ); - c->Message(Chat::White, "keepalive_delay_ms: %llu", (uint64_t) opts.daybreak_options.keepalive_delay_ms); - c->Message(Chat::White, "resend_delay_factor: %.2f", opts.daybreak_options.resend_delay_factor); - c->Message(Chat::White, "resend_delay_ms: %llu", (uint64_t) opts.daybreak_options.resend_delay_ms); - c->Message(Chat::White, "resend_delay_min: %llu", (uint64_t) opts.daybreak_options.resend_delay_min); - c->Message(Chat::White, "resend_delay_max: %llu", (uint64_t) opts.daybreak_options.resend_delay_max); - c->Message(Chat::White, "connect_delay_ms: %llu", (uint64_t) opts.daybreak_options.connect_delay_ms); - c->Message(Chat::White, "connect_stale_ms: %llu", (uint64_t) opts.daybreak_options.connect_stale_ms); - c->Message(Chat::White, "stale_connection_ms: %llu", (uint64_t) opts.daybreak_options.stale_connection_ms); - c->Message(Chat::White, "crc_length: %llu", (uint64_t) opts.daybreak_options.crc_length); - c->Message(Chat::White, "hold_size: %llu", (uint64_t) opts.daybreak_options.hold_size); - c->Message(Chat::White, "hold_length_ms: %llu", (uint64_t) opts.daybreak_options.hold_length_ms); - c->Message( - Chat::White, - "simulated_in_packet_loss: %llu", - (uint64_t) opts.daybreak_options.simulated_in_packet_loss - ); - c->Message( - Chat::White, - "simulated_out_packet_loss: %llu", - (uint64_t) opts.daybreak_options.simulated_out_packet_loss - ); - c->Message(Chat::White, "tic_rate_hertz: %.2f", opts.daybreak_options.tic_rate_hertz); - c->Message(Chat::White, "resend_timeout: %llu", (uint64_t) opts.daybreak_options.resend_timeout); - c->Message( - Chat::White, - "connection_close_time: %llu", - (uint64_t) opts.daybreak_options.connection_close_time - ); - c->Message(Chat::White, "encode_passes[0]: %llu", (uint64_t) opts.daybreak_options.encode_passes[0]); - c->Message(Chat::White, "encode_passes[1]: %llu", (uint64_t) opts.daybreak_options.encode_passes[1]); - c->Message(Chat::White, "port: %llu", (uint64_t) opts.daybreak_options.port); - } - else { - c->Message(Chat::White, "Unknown get option: %s", sep->arg[2]); - c->Message(Chat::White, "Available options:"); - //Todo the rest of these when im less lazy. - //c->Message(Chat::White, "max_packet_size"); - //c->Message(Chat::White, "max_connection_count"); - //c->Message(Chat::White, "keepalive_delay_ms"); - //c->Message(Chat::White, "resend_delay_factor"); - //c->Message(Chat::White, "resend_delay_ms"); - //c->Message(Chat::White, "resend_delay_min"); - //c->Message(Chat::White, "resend_delay_max"); - //c->Message(Chat::White, "connect_delay_ms"); - //c->Message(Chat::White, "connect_stale_ms"); - //c->Message(Chat::White, "stale_connection_ms"); - //c->Message(Chat::White, "crc_length"); - //c->Message(Chat::White, "hold_size"); - //c->Message(Chat::White, "hold_length_ms"); - //c->Message(Chat::White, "simulated_in_packet_loss"); - //c->Message(Chat::White, "simulated_out_packet_loss"); - //c->Message(Chat::White, "tic_rate_hertz"); - //c->Message(Chat::White, "resend_timeout"); - //c->Message(Chat::White, "connection_close_time"); - //c->Message(Chat::White, "encode_passes[0]"); - //c->Message(Chat::White, "encode_passes[1]"); - //c->Message(Chat::White, "port"); - c->Message(Chat::White, "all"); - } - } - else if (!strcasecmp(sep->arg[1], "setopt")) { - auto eqsi = c->Connection(); - auto manager = eqsi->GetManager(); - auto opts = manager->GetOptions(); - - if (!strcasecmp(sep->arg[3], "")) { - c->Message(Chat::White, "Missing value for set"); - return; - } - - std::string value = sep->arg[3]; - if (!strcasecmp(sep->arg[2], "max_connection_count")) { - opts.daybreak_options.max_connection_count = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "keepalive_delay_ms")) { - opts.daybreak_options.keepalive_delay_ms = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "resend_delay_factor")) { - opts.daybreak_options.resend_delay_factor = std::stod(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "resend_delay_ms")) { - opts.daybreak_options.resend_delay_ms = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "resend_delay_min")) { - opts.daybreak_options.resend_delay_min = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "resend_delay_max")) { - opts.daybreak_options.resend_delay_max = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "connect_delay_ms")) { - opts.daybreak_options.connect_delay_ms = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "connect_stale_ms")) { - opts.daybreak_options.connect_stale_ms = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "stale_connection_ms")) { - opts.daybreak_options.stale_connection_ms = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "hold_size")) { - opts.daybreak_options.hold_size = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "hold_length_ms")) { - opts.daybreak_options.hold_length_ms = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "simulated_in_packet_loss")) { - opts.daybreak_options.simulated_in_packet_loss = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "simulated_out_packet_loss")) { - opts.daybreak_options.simulated_out_packet_loss = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "resend_timeout")) { - opts.daybreak_options.resend_timeout = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else if (!strcasecmp(sep->arg[2], "connection_close_time")) { - opts.daybreak_options.connection_close_time = Strings::ToUnsignedBigInt(value); - manager->SetOptions(opts); - } - else { - c->Message(Chat::White, "Unknown set option: %s", sep->arg[2]); - c->Message(Chat::White, "Available options:"); - c->Message(Chat::White, "max_connection_count"); - c->Message(Chat::White, "keepalive_delay_ms"); - c->Message(Chat::White, "resend_delay_factor"); - c->Message(Chat::White, "resend_delay_ms"); - c->Message(Chat::White, "resend_delay_min"); - c->Message(Chat::White, "resend_delay_max"); - c->Message(Chat::White, "connect_delay_ms"); - c->Message(Chat::White, "connect_stale_ms"); - c->Message(Chat::White, "stale_connection_ms"); - c->Message(Chat::White, "hold_size"); - c->Message(Chat::White, "hold_length_ms"); - c->Message(Chat::White, "simulated_in_packet_loss"); - c->Message(Chat::White, "simulated_out_packet_loss"); - c->Message(Chat::White, "resend_timeout"); - c->Message(Chat::White, "connection_close_time"); - } - } - else { - c->Message(Chat::White, "Unknown command: %s", sep->arg[1]); - c->Message(Chat::White, "Network commands avail:"); - c->Message(Chat::White, "getopt optname - Retrieve the current option value set."); - c->Message(Chat::White, "setopt optname - Set the current option allowed."); - } -} - diff --git a/zone/gm_commands/npcstats.cpp b/zone/gm_commands/npcstats.cpp deleted file mode 100755 index 9f903d1f74..0000000000 --- a/zone/gm_commands/npcstats.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "../client.h" - -void command_npcstats(Client *c, const Seperator *sep) -{ - if (c->GetTarget() && c->GetTarget()->IsNPC()) { - NPC *target = c->GetTarget()->CastToNPC(); - - // Stats - target->ShowStats(c); - - // Loot Data - target->QueryLoot(c); - } - else { - c->Message(Chat::White, "You must target an NPC to use this command."); - } -} - diff --git a/zone/gm_commands/peqzone_flags.cpp b/zone/gm_commands/peqzone_flags.cpp deleted file mode 100644 index cde3eb4cdc..0000000000 --- a/zone/gm_commands/peqzone_flags.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "../client.h" - -void command_peqzone_flags(Client *c, const Seperator *sep) -{ - Client *target = c; - - if ( - c->GetTarget() && - c->GetTarget()->IsClient() && - c->Admin() >= minStatusToSeeOthersZoneFlags - ) { - target = c->GetTarget()->CastToClient(); - } - - target->SendPEQZoneFlagInfo(c); -} - diff --git a/zone/gm_commands/petitioninfo.cpp b/zone/gm_commands/petitioninfo.cpp deleted file mode 100755 index c9c1e49f51..0000000000 --- a/zone/gm_commands/petitioninfo.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "../client.h" - -void command_petitioninfo(Client *c, const Seperator *sep) -{ - if (sep->arg[1][0] == 0) { - c->Message(Chat::White, "Usage: #petitioninfo (petition number) Type #listpetition for a list"); - return; - } - - std::string query = "SELECT petid, charname, accountname, zone, charclass, charrace, charlevel FROM petitions ORDER BY petid"; - auto results = database.QueryDatabase(query); - if (!results.Success()) { - return; - } - - LogInfo("Petition information request from [{}], petition number:", c->GetName(), Strings::ToInt(sep->argplus[1])); - - if (results.RowCount() == 0) { - c->Message(Chat::Red, "There was an error in your request: ID not found! Please check the Id and try again."); - return; - } - - for (auto row = results.begin(); row != results.end(); ++row) - if (strcasecmp(row[0], sep->argplus[1]) == 0) { - c->Message( - Chat::Red, - " ID : %s Character Name: %s Account Name: %s Zone: %s Character Class: %s Character Race: %s Character Level: %s", - row[0], - row[1], - row[2], - row[3], - row[4], - row[5], - row[6] - ); - } - -} - diff --git a/zone/gm_commands/proximity.cpp b/zone/gm_commands/proximity.cpp deleted file mode 100755 index 3db0a714e6..0000000000 --- a/zone/gm_commands/proximity.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "../client.h" - -void command_proximity(Client *c, const Seperator *sep) -{ - if (!c->GetTarget() || (c->GetTarget() && !c->GetTarget()->IsNPC())) { - c->Message(Chat::White, "You must target an NPC"); - return; - } - - for (auto &iter : entity_list.GetNPCList()) { - auto npc = iter.second; - std::string name = npc->GetName(); - - if (name.find("Proximity") != std::string::npos) { - npc->Depop(); - } - } - - NPC *npc = c->GetTarget()->CastToNPC(); - - std::vector points; - - FindPerson_Point p{}; - - if (npc->IsProximitySet()) { - glm::vec4 position; - position.w = npc->GetHeading(); - position.x = npc->GetProximityMinX(); - position.y = npc->GetProximityMinY(); - position.z = npc->GetZ(); - - position.x = npc->GetProximityMinX(); - position.y = npc->GetProximityMinY(); - NPC::SpawnNodeNPC("Proximity", "", position); - - position.x = npc->GetProximityMinX(); - position.y = npc->GetProximityMaxY(); - NPC::SpawnNodeNPC("Proximity", "", position); - - position.x = npc->GetProximityMaxX(); - position.y = npc->GetProximityMinY(); - NPC::SpawnNodeNPC("Proximity", "", position); - - position.x = npc->GetProximityMaxX(); - position.y = npc->GetProximityMaxY(); - NPC::SpawnNodeNPC("Proximity", "", position); - - p.x = npc->GetProximityMinX(); - p.y = npc->GetProximityMinY(); - p.z = npc->GetZ(); - points.push_back(p); - - p.x = npc->GetProximityMinX(); - p.y = npc->GetProximityMaxY(); - points.push_back(p); - - p.x = npc->GetProximityMaxX(); - p.y = npc->GetProximityMaxY(); - points.push_back(p); - - p.x = npc->GetProximityMaxX(); - p.y = npc->GetProximityMinY(); - points.push_back(p); - - p.x = npc->GetProximityMinX(); - p.y = npc->GetProximityMinY(); - points.push_back(p); - } - - if (c->ClientVersion() >= EQ::versions::ClientVersion::RoF) { - c->SendPathPacket(points); - } -} - diff --git a/zone/gm_commands/questerrors.cpp b/zone/gm_commands/questerrors.cpp deleted file mode 100755 index 4be3b19a37..0000000000 --- a/zone/gm_commands/questerrors.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include "../client.h" -#include "../quest_parser_collection.h" - -void command_questerrors(Client *c, const Seperator *sep) -{ - std::list quest_errors; - parse->GetErrors(quest_errors); - - if (quest_errors.size()) { - c->Message(Chat::White, "Quest errors currently are as follows:"); - - int error_index = 0; - for (auto quest_error : quest_errors) { - if (error_index >= RuleI(World, MaximumQuestErrors)) { - c->Message( - Chat::White, - fmt::format( - "Maximum of {} error{} shown.", - RuleI(World, MaximumQuestErrors), - RuleI(World, MaximumQuestErrors) != 1 ? "s" : "" - ).c_str() - ); - break; - } - - c->Message(Chat::White, quest_error.c_str()); - error_index++; - } - } else { - c->Message(Chat::White, "There are no Quest errors currently."); - } -} - diff --git a/zone/gm_commands/serverinfo.cpp b/zone/gm_commands/serverinfo.cpp deleted file mode 100755 index 3832aa7d3c..0000000000 --- a/zone/gm_commands/serverinfo.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "../client.h" -#include "../dialogue_window.h" -#include "../../common/serverinfo.h" - -void command_serverinfo(Client *c, const Seperator *sep) -{ - auto os = EQ::GetOS(); - auto cpus = EQ::GetCPUs(); - auto process_id = EQ::GetPID(); - auto rss = EQ::GetRSS() / 1048576.0; - auto uptime = static_cast(EQ::GetUptime()); - - std::string popup_table; - auto popup_text = DialogueWindow::CenterMessage( - DialogueWindow::ColorMessage("green", "Operating System Information") - ); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("Machine") + - DialogueWindow::TableCell(os.machine) - ).c_str() - ); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("System") + - DialogueWindow::TableCell(os.sysname) - ).c_str() - ); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("Release") + - DialogueWindow::TableCell(os.release) - ).c_str() - ); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("Uptime") + - DialogueWindow::TableCell(Strings::SecondsToTime(uptime)) - ).c_str() - ); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("Version") + - DialogueWindow::TableCell(os.version) - ).c_str() - ); - - popup_text.append(DialogueWindow::Table(popup_table)); - - popup_table = std::string(); - - popup_text.append(DialogueWindow::Break()); - - popup_text.append( - DialogueWindow::CenterMessage( - DialogueWindow::ColorMessage("green", "CPU Information") - ) - ); - - for (size_t cpu = 0; cpu < cpus.size(); ++cpu) { - auto ¤t_cpu = cpus[cpu]; - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell( - fmt::format( - "CPU {}", - cpu - ) - ) + - DialogueWindow::TableCell( - fmt::format( - "{} ({:.2f}GHz)", - current_cpu.model, - current_cpu.speed - ) - ) - ) - ); - } - - popup_text.append(DialogueWindow::Table(popup_table)); - - popup_table = std::string(); - - popup_text.append(DialogueWindow::Break()); - - popup_text.append( - DialogueWindow::CenterMessage( - DialogueWindow::ColorMessage("green", "CPU Information") - ) - ); - - popup_text.append(""); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("Process ID") + - DialogueWindow::TableCell(std::to_string(process_id)) - ) - ); - - popup_table.append( - DialogueWindow::TableRow( - DialogueWindow::TableCell("RSS") + - DialogueWindow::TableCell( - fmt::format( - "{:.2f} MB", - rss - ) - ) - ) - ); - - popup_text.append(DialogueWindow::Table(popup_table)); - - c->SendPopupToClient( - "Server Information", - popup_text.c_str() - ); -} - diff --git a/zone/gm_commands/show.cpp b/zone/gm_commands/show.cpp new file mode 100755 index 0000000000..d884109846 --- /dev/null +++ b/zone/gm_commands/show.cpp @@ -0,0 +1,142 @@ +#include "../client.h" +#include "show/aggro.cpp" +#include "show/buffs.cpp" +#include "show/buried_corpse_count.cpp" +#include "show/client_version_summary.cpp" +#include "show/currencies.cpp" +#include "show/distance.cpp" +#include "show/emotes.cpp" +#include "show/field_of_view.cpp" +#include "show/flags.cpp" +#include "show/group_info.cpp" +#include "show/hatelist.cpp" +#include "show/inventory.cpp" +#include "show/ip_lookup.cpp" +#include "show/line_of_sight.cpp" +#include "show/network.cpp" +#include "show/network_stats.cpp" +#include "show/npc_global_loot.cpp" +#include "show/npc_stats.cpp" +#include "show/npc_type.cpp" +#include "show/peqzone_flags.cpp" +#include "show/petition.cpp" +#include "show/petition_info.cpp" +#include "show/proximity.cpp" +#include "show/quest_errors.cpp" +#include "show/quest_globals.cpp" +#include "show/recipe.cpp" +#include "show/server_info.cpp" +#include "show/skills.cpp" +#include "show/spawn_status.cpp" +#include "show/spells.cpp" +#include "show/spells_list.cpp" +#include "show/stats.cpp" +#include "show/timers.cpp" +#include "show/traps.cpp" +#include "show/uptime.cpp" +#include "show/variable.cpp" +#include "show/version.cpp" +#include "show/waypoints.cpp" +#include "show/who.cpp" +#include "show/xtargets.cpp" +#include "show/zone_data.cpp" +#include "show/zone_global_loot.cpp" +#include "show/zone_loot.cpp" +#include "show/zone_points.cpp" +#include "show/zone_status.cpp" + +void command_show(Client *c, const Seperator *sep) +{ + struct Cmd { + std::string cmd{}; // command + std::string u{}; // usage + void (*fn)(Client *c, const Seperator *sep) = nullptr; // function + std::vector a{}; // aliases + }; + + std::vector commands = { + Cmd{.cmd = "aggro", .u = "aggro [Distance] [-v] (-v is verbose Faction Information)", .fn = ShowAggro, .a = {"#aggro"}}, + Cmd{.cmd = "buffs", .u = "buffs", .fn = ShowBuffs, .a = {"#showbuffs"}}, + Cmd{.cmd = "buried_corpse_count", .u = "buried_corpse_count", .fn = ShowBuriedCorpseCount, .a = {"#getplayerburiedcorpsecount"}}, + Cmd{.cmd = "client_version_summary", .u = "client_version_summary", .fn = ShowClientVersionSummary, .a = {"#cvs"}}, + Cmd{.cmd = "currencies", .u = "currencies", .fn = ShowCurrencies, .a = {"#viewcurrencies"}}, + Cmd{.cmd = "distance", .u = "distance", .fn = ShowDistance, .a = {"#distance"}}, + Cmd{.cmd = "emotes", .u = "emotes", .fn = ShowEmotes, .a = {"#emoteview"}}, + Cmd{.cmd = "field_of_view", .u = "field_of_view", .fn = ShowFieldOfView, .a = {"#fov"}}, + Cmd{.cmd = "flags", .u = "flags", .fn = ShowFlags, .a = {"#flags"}}, + Cmd{.cmd = "group_info", .u = "group_info", .fn = ShowGroupInfo, .a = {"#ginfo"}}, + Cmd{.cmd = "hatelist", .u = "hatelist", .fn = ShowHateList, .a = {"#hatelist"}}, + Cmd{.cmd = "inventory", .u = "inventory", .fn = ShowInventory, .a = {"#peekinv"}}, + Cmd{.cmd = "ip_lookup", .u = "ip_lookup", .fn = ShowIPLookup, .a = {"#iplookup"}}, + Cmd{.cmd = "line_of_sight", .u = "line_of_sight", .fn = ShowLineOfSight, .a = {"#checklos"}}, + Cmd{.cmd = "network", .u = "network", .fn = ShowNetwork, .a = {"#network"}}, + Cmd{.cmd = "network_stats", .u = "network_stats", .fn = ShowNetworkStats, .a = {"#netstats"}}, + Cmd{.cmd = "npc_global_loot", .u = "npc_global_loot", .fn = ShowNPCGlobalLoot, .a = {"#shownpcgloballoot"}}, + Cmd{.cmd = "npc_stats", .u = "npc_stats", .fn = ShowNPCStats, .a = {"#npcstats"}}, + Cmd{.cmd = "npc_type", .u = "npc_type [NPC ID]", .fn = ShowNPCType, .a = {"#viewnpctype"}}, + Cmd{.cmd = "peqzone_flags", .u = "peqzone_flags", .fn = ShowPEQZoneFlags, .a = {"#peqzone_flags"}}, + Cmd{.cmd = "petition", .u = "petition", .fn = ShowPetition, .a = {"#listpetition", "#viewpetition"}}, + Cmd{.cmd = "petition_info", .u = "petition_info", .fn = ShowPetitionInfo, .a = {"#petitioninfo"}}, + Cmd{.cmd = "proximity", .u = "proximity", .fn = ShowProximity, .a = {"#proximity"}}, + Cmd{.cmd = "quest_errors", .u = "quest_errors", .fn = ShowQuestErrors, .a = {"#questerrors"}}, + Cmd{.cmd = "quest_globals", .u = "quest_globals", .fn = ShowQuestGlobals, .a = {"#globalview"}}, + Cmd{.cmd = "recipe", .u = "recipe [Recipe ID]", .fn = ShowRecipe, .a = {"#viewrecipe"}}, + Cmd{.cmd = "server_info", .u = "server_info", .fn = ShowServerInfo, .a = {"#serverinfo"}}, + Cmd{.cmd = "skills", .u = "skills", .fn = ShowSkills, .a = {"#showskills"}}, + Cmd{.cmd = "spawn_status", .u = "spawn_status [all|disabled|enabled|Spawn ID]", .fn = ShowSpawnStatus, .a = {"#spawnstatus"}}, + Cmd{.cmd = "spells", .u = "spells [disciplines|spells]", .fn = ShowSpells, .a = {"#showspells"}}, + Cmd{.cmd = "spells_list", .u = "spells_list", .fn = ShowSpellsList, .a = {"#showspellslist"}}, + Cmd{.cmd = "stats", .u = "stats", .fn = ShowStats, .a = {"#showstats"}}, + Cmd{.cmd = "timers", .u = "timers", .fn = ShowTimers, .a = {"#timers"}}, + Cmd{.cmd = "traps", .u = "traps", .fn = ShowTraps, .a = {"#trapinfo"}}, + Cmd{.cmd = "uptime", .u = "uptime [Zone Server ID] (Zone Server ID is optional)", .fn = ShowUptime, .a = {"#uptime"}}, + Cmd{.cmd = "variable", .u = "variable [Variable Name]", .fn = ShowVariable, .a = {"#getvariable"}}, + Cmd{.cmd = "version", .u = "version", .fn = ShowVersion, .a = {"#version"}}, + Cmd{.cmd = "waypoints", .u = "waypoints", .fn = ShowWaypoints, .a = {"#wpinfo"}}, + Cmd{.cmd = "who", .u = "who [Search Criteria] (Search criteria is optional)", .fn = ShowWho, .a = {"#who"}}, + Cmd{.cmd = "xtargets", .u = "xtargets [Amount] (Amount is optional)", .fn = ShowXTargets, .a = {"#xtargets"}}, + Cmd{.cmd = "zone_data", .u = "zone_data", .fn = ShowZoneData, .a = {"#zstats"}}, + Cmd{.cmd = "zone_global_loot", .u = "zone_global_loot", .fn = ShowZoneGlobalLoot, .a = {"#showzonegloballoot"}}, + Cmd{.cmd = "zone_loot", .u = "zone_loot", .fn = ShowZoneLoot, .a = {"#viewzoneloot"}}, + Cmd{.cmd = "zone_points", .u = "zone_points", .fn = ShowZonePoints, .a = {"#showzonepoints"}}, + Cmd{.cmd = "zone_status", .u = "zone_status", .fn = ShowZoneStatus, .a = {"#zonestatus"}}, + }; + + // Check for arguments + const auto arguments = sep->argnum; + + // look for alias or command + for (const auto &cmd: commands) { + // Check for alias first + for (const auto &alias: cmd.a) { + if (!alias.empty() && Strings::EqualFold(alias, sep->arg[0])) { + // build string from sep args + std::vector args = {}; + + // skip the first arg + for (auto i = 1; i <= arguments; i++) { + args.emplace_back(sep->arg[i]); + } + + // build the rewrite string + const std::string& rewrite = fmt::format("#show {} {}", cmd.cmd, Strings::Join(args, " ")); + + // rewrite to #show + c->SendGMCommand(rewrite); + return; + } + } + + // Check for command + if (cmd.cmd == Strings::ToLower(sep->arg[1])) { + cmd.fn(c, sep); + return; + } + } + + // Command not found + c->Message(Chat::White, "Command not found. Usage: #show [command]"); + for (const auto &cmd: commands) { + c->Message(Chat::White, fmt::format("Usage: #show {}", cmd.u).c_str()); + } +} diff --git a/zone/gm_commands/show/aggro.cpp b/zone/gm_commands/show/aggro.cpp new file mode 100755 index 0000000000..c579dc4c37 --- /dev/null +++ b/zone/gm_commands/show/aggro.cpp @@ -0,0 +1,22 @@ +#include "../../client.h" + +void ShowAggro(Client *c, const Seperator *sep) +{ + const auto arguments = sep->argnum; + if (arguments < 2 || !sep->IsNumber(2)) { + c->Message(Chat::White, "Usage: #show aggro [Distance] [-v] (-v is verbose Faction Information)"); + return; + } + + if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { + c->Message(Chat::White, "You must target an NPC to use this command."); + return; + } + + const auto t = c->GetTarget()->CastToNPC(); + + const float distance = Strings::ToFloat(sep->arg[2]); + const bool is_verbose = Strings::EqualFold(sep->arg[3], "-v"); + + entity_list.DescribeAggro(c, t, distance, is_verbose); +} diff --git a/zone/gm_commands/showbuffs.cpp b/zone/gm_commands/show/buffs.cpp old mode 100755 new mode 100644 similarity index 51% rename from zone/gm_commands/showbuffs.cpp rename to zone/gm_commands/show/buffs.cpp index 16626df191..eec2451d6f --- a/zone/gm_commands/showbuffs.cpp +++ b/zone/gm_commands/show/buffs.cpp @@ -1,6 +1,6 @@ -#include "../client.h" +#include "../../client.h" -void command_showbuffs(Client *c, const Seperator *sep) +void ShowBuffs(Client *c, const Seperator *sep) { Mob* t = c; if (c->GetTarget()) { @@ -9,4 +9,3 @@ void command_showbuffs(Client *c, const Seperator *sep) t->ShowBuffs(c); } - diff --git a/zone/gm_commands/show/buried_corpse_count.cpp b/zone/gm_commands/show/buried_corpse_count.cpp new file mode 100644 index 0000000000..863abc18a9 --- /dev/null +++ b/zone/gm_commands/show/buried_corpse_count.cpp @@ -0,0 +1,23 @@ +#include "../../client.h" +#include "../../corpse.h" + +void ShowBuriedCorpseCount(Client *c, const Seperator *sep) +{ + auto t = c; + if (c->GetTarget() && c->GetTarget()->IsClient() && c->GetGM()) { + t = c->GetTarget()->CastToClient(); + } + + const uint32 corpse_count = database.GetCharacterBuriedCorpseCount(t->CharacterID()); + + c->Message( + Chat::White, + fmt::format( + "{} {} {} buried corpse{}.", + c->GetTargetDescription(t, TargetDescriptionType::UCYou), + c == t ? "have" : "has", + corpse_count, + corpse_count != 1 ? "s" : "" + ).c_str() + ); +} diff --git a/zone/gm_commands/show/client_version_summary.cpp b/zone/gm_commands/show/client_version_summary.cpp new file mode 100644 index 0000000000..98b5d4f52c --- /dev/null +++ b/zone/gm_commands/show/client_version_summary.cpp @@ -0,0 +1,16 @@ +#include "../../client.h" +#include "../../worldserver.h" + +extern WorldServer worldserver; + +void ShowClientVersionSummary(Client *c, const Seperator *sep) +{ + auto pack = new ServerPacket(ServerOP_ClientVersionSummary, sizeof(ServerRequestClientVersionSummary_Struct)); + + auto s = (ServerRequestClientVersionSummary_Struct *) pack->pBuffer; + strn0cpy(s->Name, c->GetName(), sizeof(s->Name)); + + worldserver.SendPacket(pack); + safe_delete(pack); +} + diff --git a/zone/gm_commands/show/currencies.cpp b/zone/gm_commands/show/currencies.cpp new file mode 100644 index 0000000000..affda79bc1 --- /dev/null +++ b/zone/gm_commands/show/currencies.cpp @@ -0,0 +1,136 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowCurrencies(Client *c, const Seperator *sep) +{ + auto t = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + t = c->GetTarget()->CastToClient(); + } + + const uint32 platinum = ( + t->GetMoney(3, 0) + + t->GetMoney(3, 1) + + t->GetMoney(3, 2) + + t->GetMoney(3, 3) + ); + + const uint32 gold = ( + t->GetMoney(2, 0) + + t->GetMoney(2, 1) + + t->GetMoney(2, 2) + ); + + const uint32 silver = ( + t->GetMoney(1, 0) + + t->GetMoney(1, 1) + + t->GetMoney(1, 2) + ); + + const uint32 copper = ( + t->GetMoney(0, 0) + + t->GetMoney(0, 1) + + t->GetMoney(0, 2) + ); + + std::string currency_table; + + bool has_currency = false; + + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Currency") + + DialogueWindow::TableCell("Amount") + ); + + if ( + platinum || + gold || + silver || + copper + ) { + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Money") + + DialogueWindow::TableCell(Strings::Money(platinum, gold, silver, copper)) + ); + + has_currency = true; + } + + const uint32 ebon_crystals = t->GetEbonCrystals(); + if (ebon_crystals) { + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Ebon Crystals") + + DialogueWindow::TableCell(Strings::Commify(ebon_crystals)) + ); + + has_currency = true; + } + + const uint32 radiant_crystals = t->GetRadiantCrystals(); + if (radiant_crystals) { + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Radiant Crystals") + + DialogueWindow::TableCell(Strings::Commify(radiant_crystals)) + ); + + has_currency = true; + } + + for (const auto& a : zone->AlternateCurrencies) { + const uint32 currency_value = t->GetAlternateCurrencyValue(a.id); + if (currency_value) { + const auto* d = database.GetItem(a.item_id); + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell(d->Name) + + DialogueWindow::TableCell(Strings::Commify(currency_value)) + ); + + has_currency = true; + } + } + + for (const auto& l : EQ::constants::GetLDoNThemeMap()) { + const uint32 ldon_currency_value = t->GetLDoNPointsTheme(l.first); + if (ldon_currency_value) { + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell(l.second) + + DialogueWindow::TableCell(Strings::Commify(ldon_currency_value)) + ); + + has_currency = true; + } + } + + const uint32 pvp_points = t->GetPVPPoints(); + if (pvp_points) { + currency_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("PVP Points") + + DialogueWindow::TableCell(Strings::Commify(pvp_points)) + ); + + has_currency = true; + } + + currency_table = DialogueWindow::Table(currency_table); + + if (!has_currency) { + c->Message( + Chat::White, + fmt::format( + "{} {} not have any currencies.", + c->GetTargetDescription(t, TargetDescriptionType::UCYou), + c == t ? "do" : "does" + ).c_str() + ); + + return; + } + + c->SendPopupToClient( + fmt::format( + "Currency for {}", + c->GetTargetDescription(t, TargetDescriptionType::UCSelf) + ).c_str(), + currency_table.c_str() + ); +} diff --git a/zone/gm_commands/show/distance.cpp b/zone/gm_commands/show/distance.cpp new file mode 100644 index 0000000000..aece8494ea --- /dev/null +++ b/zone/gm_commands/show/distance.cpp @@ -0,0 +1,23 @@ +#include "../../client.h" + +void ShowDistance(Client *c, const Seperator *sep) +{ + if (!c->GetTarget() || c->GetTarget() == c) { + c->Message(Chat::White, "You must have a target to use this command."); + return; + } + + const auto t = c->GetTarget(); + + c->Message( + Chat::White, + fmt::format( + "{} is {:.2f} units from you.", + c->GetTargetDescription(t), + Distance( + c->GetPosition(), + t->GetPosition() + ) + ).c_str() + ); +} diff --git a/zone/gm_commands/emoteview.cpp b/zone/gm_commands/show/emotes.cpp old mode 100755 new mode 100644 similarity index 62% rename from zone/gm_commands/emoteview.cpp rename to zone/gm_commands/show/emotes.cpp index c1116f026f..9e7e58e74b --- a/zone/gm_commands/emoteview.cpp +++ b/zone/gm_commands/show/emotes.cpp @@ -1,29 +1,27 @@ -#include "../client.h" +#include "../../client.h" -void command_emoteview(Client *c, const Seperator *sep) +void ShowEmotes(Client *c, const Seperator *sep) { if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { c->Message(Chat::White, "You must target an NPC to view their emotes."); return; } - auto target = c->GetTarget()->CastToNPC(); + const auto t = c->GetTarget()->CastToNPC(); - auto emote_count = 0; - auto emote_id = target->GetEmoteID(); - - auto emote_number = 1; + uint32 emote_count = 0; + const uint32 emote_id = t->GetEmoteID(); LinkedListIterator iterator(zone->NPCEmoteList); iterator.Reset(); while (iterator.MoreElements()) { - auto &e = iterator.GetData(); + const auto& e = iterator.GetData(); if (emote_id == e->emoteid) { c->Message( Chat::White, fmt::format( "Emote {} | Event: {} ({}) Type: {} ({})", - emote_number, + e->emoteid, EQ::constants::GetEmoteEventTypeName(e->event_), e->event_, EQ::constants::GetEmoteTypeName(e->type), @@ -35,35 +33,22 @@ void command_emoteview(Client *c, const Seperator *sep) Chat::White, fmt::format( "Emote {} | Text: {}", - emote_number, + e->emoteid, e->text ).c_str() ); emote_count++; - emote_number++; } iterator.Advance(); } - if (!emote_count) { - c->Message( - Chat::White, - fmt::format( - "{} has no emotes on Emote ID {}.", - c->GetTargetDescription(target), - emote_id - ).c_str() - ); - return; - } - c->Message( Chat::White, fmt::format( "{} has {} emote{} on Emote ID {}.", - c->GetTargetDescription(target), + c->GetTargetDescription(t), emote_count, emote_count != 1 ? "s" : "", emote_id diff --git a/zone/gm_commands/show/field_of_view.cpp b/zone/gm_commands/show/field_of_view.cpp new file mode 100644 index 0000000000..dfa617a35b --- /dev/null +++ b/zone/gm_commands/show/field_of_view.cpp @@ -0,0 +1,23 @@ +#include "../../client.h" + +void ShowFieldOfView(Client *c, const Seperator *sep) +{ + if (!c->GetTarget() || c->GetTarget() == c) { + c->Message(Chat::White, "You must have a target to use this command."); + return; + } + + const auto t = c->GetTarget(); + + const bool is_behind = c->BehindMob(t, c->GetX(), c->GetY()); + + c->Message( + Chat::White, + fmt::format( + "You are {}behind {}, they have a heading of {}.", + is_behind ? "" : "not ", + c->GetTargetDescription(t), + t->GetHeading() + ).c_str() + ); +} diff --git a/zone/gm_commands/show/flags.cpp b/zone/gm_commands/show/flags.cpp new file mode 100644 index 0000000000..27a4345efd --- /dev/null +++ b/zone/gm_commands/show/flags.cpp @@ -0,0 +1,16 @@ +#include "../../client.h" + +void ShowFlags(Client *c, const Seperator *sep) +{ + auto t = c; + + if ( + c->GetTarget() && + c->GetTarget()->IsClient() && + c->Admin() >= minStatusToSeeOthersZoneFlags + ) { + t = c->GetTarget()->CastToClient(); + } + + t->SendZoneFlagInfo(c); +} diff --git a/zone/gm_commands/show/group_info.cpp b/zone/gm_commands/show/group_info.cpp new file mode 100644 index 0000000000..7aab3464cd --- /dev/null +++ b/zone/gm_commands/show/group_info.cpp @@ -0,0 +1,89 @@ +#include "../../client.h" +#include "../../dialogue_window.h" +#include "../../groups.h" + +void ShowGroupInfo(Client *c, const Seperator *sep) +{ + auto t = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + t = c->GetTarget()->CastToClient(); + } + + auto g = t->GetGroup(); + if (!g) { + c->Message( + Chat::White, + fmt::format( + "{} {} not in a group.", + c->GetTargetDescription(t, TargetDescriptionType::UCYou), + c == t ? "are" : "is" + ).c_str() + ); + return; + } + + std::string popup_table; + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Group ID") + + DialogueWindow::TableCell(Strings::Commify(g->GetID())) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Members") + + DialogueWindow::TableCell(std::to_string(g->GroupCount())) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Index") + + DialogueWindow::TableCell("Name") + + DialogueWindow::TableCell("In Zone") + + DialogueWindow::TableCell("Assist") + + DialogueWindow::TableCell("Puller") + + DialogueWindow::TableCell("Tank") + ); + + const std::string yes = DialogueWindow::ColorMessage("forest_green", "Y"); + const std::string no = DialogueWindow::ColorMessage("red1", "N"); + + for (int group_member = 0; group_member < MAX_GROUP_MEMBERS; group_member++) { + if (g->membername[group_member][0] == '\0') { + continue; + } + + const bool is_assist = g->MemberRoles[group_member] & RoleAssist; + const bool is_puller = g->MemberRoles[group_member] & RolePuller; + const bool is_tank = g->MemberRoles[group_member] & RoleTank; + + popup_table += DialogueWindow::TableRow( + fmt::format( + "{}{}{}{}{}{}", + group_member, + ( + strcmp(g->membername[group_member], c->GetCleanName()) ? + g->membername[group_member] : + fmt::format( + "{} (You)", + g->membername[group_member] + ) + ), + g->members[group_member] ? yes : no, + is_assist ? yes : no, + is_puller ? yes : no, + is_tank ? yes : no + ) + ); + } + + popup_table = DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + fmt::format( + "Group Info for {}", + c->GetTargetDescription(t, TargetDescriptionType::UCSelf) + ).c_str(), + popup_table.c_str() + ); +} diff --git a/zone/gm_commands/hatelist.cpp b/zone/gm_commands/show/hatelist.cpp old mode 100755 new mode 100644 similarity index 50% rename from zone/gm_commands/hatelist.cpp rename to zone/gm_commands/show/hatelist.cpp index 83fe75e20e..225ad16f42 --- a/zone/gm_commands/hatelist.cpp +++ b/zone/gm_commands/show/hatelist.cpp @@ -1,13 +1,13 @@ -#include "../client.h" +#include "../../client.h" -void command_hatelist(Client *c, const Seperator *sep) +void ShowHateList(Client *c, const Seperator *sep) { if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { c->Message(Chat::White, "You must target an NPC to use this command."); return; } - auto target = c->GetTarget(); + const auto t = c->GetTarget(); - target->PrintHateListToClient(c); + t->PrintHateListToClient(c); } diff --git a/zone/gm_commands/peekinv.cpp b/zone/gm_commands/show/inventory.cpp old mode 100755 new mode 100644 similarity index 81% rename from zone/gm_commands/peekinv.cpp rename to zone/gm_commands/show/inventory.cpp index 596ad27bcc..cbb5a03fc5 --- a/zone/gm_commands/peekinv.cpp +++ b/zone/gm_commands/show/inventory.cpp @@ -1,11 +1,11 @@ -#include "../client.h" -#include "../object.h" +#include "../../client.h" +#include "../../object.h" -void command_peekinv(Client *c, const Seperator *sep) +void ShowInventory(Client *c, const Seperator *sep) { - auto arguments = sep->argnum; - if (!arguments) { - SendPeekInvSubCommands(c); + const auto arguments = sep->argnum; + if (arguments < 2) { + SendShowInventorySubCommands(c); return; } @@ -50,19 +50,19 @@ void command_peekinv(Client *c, const Seperator *sep) int scope_mask = peekNone; - const bool is_all = !strcasecmp(sep->arg[1], "all"); - const bool is_all_bank = !strcasecmp(sep->arg[1], "allbank"); - const bool is_bank = !strcasecmp(sep->arg[1], "bank"); - const bool is_cursor = !strcasecmp(sep->arg[1], "cursor"); - const bool is_cursor_limbo = !strcasecmp(sep->arg[1], "curlimbo"); - const bool is_equipment = !strcasecmp(sep->arg[1], "equip"); - const bool is_general = !strcasecmp(sep->arg[1], "gen"); - const bool is_limbo = !strcasecmp(sep->arg[1], "limbo"); - const bool is_possessions = !strcasecmp(sep->arg[1], "poss"); - const bool is_shared_bank = !strcasecmp(sep->arg[1], "shbank"); - const bool is_trade = !strcasecmp(sep->arg[1], "trade"); - const bool is_tribute = !strcasecmp(sep->arg[1], "trib"); - const bool is_world = !strcasecmp(sep->arg[1], "world"); + const bool is_all = !strcasecmp(sep->arg[2], "all"); + const bool is_all_bank = !strcasecmp(sep->arg[2], "allbank"); + const bool is_bank = !strcasecmp(sep->arg[2], "bank"); + const bool is_cursor = !strcasecmp(sep->arg[2], "cursor"); + const bool is_cursor_limbo = !strcasecmp(sep->arg[2], "curlimbo"); + const bool is_equipment = !strcasecmp(sep->arg[2], "equip"); + const bool is_general = !strcasecmp(sep->arg[2], "gen"); + const bool is_limbo = !strcasecmp(sep->arg[2], "limbo"); + const bool is_possessions = !strcasecmp(sep->arg[2], "poss"); + const bool is_shared_bank = !strcasecmp(sep->arg[2], "shbank"); + const bool is_trade = !strcasecmp(sep->arg[2], "trade"); + const bool is_tribute = !strcasecmp(sep->arg[2], "trib"); + const bool is_world = !strcasecmp(sep->arg[2], "world"); if (is_all) { scope_mask = (peekOutOfScope - 1); @@ -91,7 +91,7 @@ void command_peekinv(Client *c, const Seperator *sep) } else if (is_world) { scope_mask |= peekWorld; } else { - SendPeekInvSubCommands(c); + SendShowInventorySubCommands(c); return; } @@ -433,18 +433,18 @@ void command_peekinv(Client *c, const Seperator *sep) } } -void SendPeekInvSubCommands(Client* c) { - c->Message(Chat::White, "Usage: #peekinv equip - Shows items in Equipment slots"); - c->Message(Chat::White, "Usage: #peekinv gen - Shows items in General slots"); - c->Message(Chat::White, "Usage: #peekinv cursor - Shows items in Cursor slots"); - c->Message(Chat::White, "Usage: #peekinv poss - Shows items in Equipment, General, and Cursor slots"); - c->Message(Chat::White, "Usage: #peekinv limbo - Shows items in Limbo slots"); - c->Message(Chat::White, "Usage: #peekinv curlim - Shows items in Cursor and Limbo slots"); - c->Message(Chat::White, "Usage: #peekinv trib - Shows items in Tribute slots"); - c->Message(Chat::White, "Usage: #peekinv bank - Shows items in Bank slots"); - c->Message(Chat::White, "Usage: #peekinv shbank - Shows items in Shared Bank slots"); - c->Message(Chat::White, "Usage: #peekinv allbank - Shows items in Bank and Shared Bank slots"); - c->Message(Chat::White, "Usage: #peekinv trade - Shows items in Trade slots"); - c->Message(Chat::White, "Usage: #peekinv world - Shows items in World slots"); - c->Message(Chat::White, "Usage: #peekinv all - Shows items in all slots"); +void SendShowInventorySubCommands(Client* c) { + c->Message(Chat::White, "Usage: #show inventory equip - Shows items in Equipment slots"); + c->Message(Chat::White, "Usage: #show inventory gen - Shows items in General slots"); + c->Message(Chat::White, "Usage: #show inventory cursor - Shows items in Cursor slots"); + c->Message(Chat::White, "Usage: #show inventory poss - Shows items in Equipment, General, and Cursor slots"); + c->Message(Chat::White, "Usage: #show inventory limbo - Shows items in Limbo slots"); + c->Message(Chat::White, "Usage: #show inventory curlim - Shows items in Cursor and Limbo slots"); + c->Message(Chat::White, "Usage: #show inventory trib - Shows items in Tribute slots"); + c->Message(Chat::White, "Usage: #show inventory bank - Shows items in Bank slots"); + c->Message(Chat::White, "Usage: #show inventory shbank - Shows items in Shared Bank slots"); + c->Message(Chat::White, "Usage: #show inventory allbank - Shows items in Bank and Shared Bank slots"); + c->Message(Chat::White, "Usage: #show inventory trade - Shows items in Trade slots"); + c->Message(Chat::White, "Usage: #show inventory world - Shows items in World slots"); + c->Message(Chat::White, "Usage: #show inventory all - Shows items in all slots"); } diff --git a/zone/gm_commands/show/ip_lookup.cpp b/zone/gm_commands/show/ip_lookup.cpp new file mode 100644 index 0000000000..b020541b47 --- /dev/null +++ b/zone/gm_commands/show/ip_lookup.cpp @@ -0,0 +1,25 @@ +#include "../../client.h" +#include "../../worldserver.h" + +extern WorldServer worldserver; + +void ShowIPLookup(Client *c, const Seperator *sep) +{ + const uint32 ip_length = strlen(sep->argplus[2]); + + auto pack = new ServerPacket( + ServerOP_IPLookup, + sizeof(ServerGenericWorldQuery_Struct) + ip_length + 1 + ); + + auto s = (ServerGenericWorldQuery_Struct *) pack->pBuffer; + strn0cpy(s->from, c->GetName(), sizeof(s->from)); + s->admin = c->Admin(); + + if (ip_length) { + strcpy(s->query, sep->argplus[2]); + } + + worldserver.SendPacket(pack); + safe_delete(pack); +} diff --git a/zone/gm_commands/show/line_of_sight.cpp b/zone/gm_commands/show/line_of_sight.cpp new file mode 100644 index 0000000000..bf56c88663 --- /dev/null +++ b/zone/gm_commands/show/line_of_sight.cpp @@ -0,0 +1,22 @@ +#include "../../client.h" + +void ShowLineOfSight(Client *c, const Seperator *sep) +{ + if (!c->GetTarget() || c->GetTarget() == c) { + c->Message(Chat::White, "You must have a target to use this command."); + return; + } + + const auto t = c->GetTarget(); + + const bool has_los = c->CheckLosFN(t); + + c->Message( + Chat::White, + fmt::format( + "You {}have line of sight to {}.", + has_los ? "" : "do not ", + c->GetTargetDescription(t) + ).c_str() + ); +} diff --git a/zone/gm_commands/show/network.cpp b/zone/gm_commands/show/network.cpp new file mode 100644 index 0000000000..d9eff2c165 --- /dev/null +++ b/zone/gm_commands/show/network.cpp @@ -0,0 +1,138 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowNetwork(Client *c, const Seperator *sep) +{ + auto eqsi = c->Connection(); + auto manager = eqsi->GetManager(); + auto opts = manager->GetOptions(); + + std::string popup_table; + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Option") + + DialogueWindow::TableCell("Value") + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Max Packet Size") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.max_packet_size)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Max Connection Count") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.max_connection_count)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Keep Alive Delay") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.keepalive_delay_ms)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resend Delay Factor") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}", + opts.daybreak_options.resend_delay_factor + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resend Delay") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_ms)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resend Delay Minimum") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_min)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resend Delay Maximum") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_max)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Connect Delay") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connect_delay_ms)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Connect Stale") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connect_stale_ms)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Stale Connection") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.stale_connection_ms)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("CRC Length") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.crc_length)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Hold Size") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.hold_size)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Hold Length") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.hold_length_ms)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Simulated In Packet Loss") + + DialogueWindow::TableCell(std::to_string(opts.daybreak_options.simulated_in_packet_loss)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Simulated Out Packet Loss") + + DialogueWindow::TableCell(std::to_string(opts.daybreak_options.simulated_out_packet_loss)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Tic Rate (Hz)") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}", + opts.daybreak_options.tic_rate_hertz + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resend Timeout") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_timeout)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Connection Close Time") + + DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connection_close_time)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Encode Passes (1)") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.encode_passes[0])) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Encode Passes (2)") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.encode_passes[1])) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Port") + + DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.port)) + ); + + popup_table = DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + "Network Information", + popup_table.c_str() + ); +} diff --git a/zone/gm_commands/show/network_stats.cpp b/zone/gm_commands/show/network_stats.cpp new file mode 100644 index 0000000000..8d51e8f692 --- /dev/null +++ b/zone/gm_commands/show/network_stats.cpp @@ -0,0 +1,297 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowNetworkStats(Client *c, const Seperator *sep) +{ + const auto connection = c->Connection(); + const auto opts = connection->GetManager()->GetOptions(); + const auto eqs_stats = connection->GetStats(); + + const auto& stats = eqs_stats.DaybreakStats; + + const auto sec_since_stats_reset = std::chrono::duration_cast>( + EQ::Net::Clock::now() - stats.created + ).count(); + + std::string popup_table; + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sent Bytes") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.sent_bytes), + stats.sent_bytes / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Received Bytes") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.recv_bytes), + stats.recv_bytes / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sent Bytes Before Encode") + + DialogueWindow::TableCell(Strings::Commify(stats.bytes_before_encode)) + + DialogueWindow::TableCell("Compression Rate") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}%%", + static_cast(stats.bytes_before_encode - stats.sent_bytes) / + static_cast(stats.bytes_before_encode) * 100.0 + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sent Bytes After Encode") + + DialogueWindow::TableCell(Strings::Commify(stats.bytes_after_decode)) + + DialogueWindow::TableCell("Compression Rate") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}%%", + static_cast(stats.bytes_after_decode - stats.recv_bytes) / + static_cast(stats.bytes_after_decode) * 100.0 + ) + ) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Minimum Ping") + + DialogueWindow::TableCell(Strings::Commify(stats.min_ping)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Maximum Ping") + + DialogueWindow::TableCell(Strings::Commify(stats.max_ping)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Last Ping") + + DialogueWindow::TableCell(Strings::Commify(stats.last_ping)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Average Ping") + + DialogueWindow::TableCell(Strings::Commify(stats.avg_ping)) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Real Time Received Packets") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.recv_packets), + stats.recv_packets / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Real Time Sent Packets") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.sent_packets), + stats.sent_packets / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sync Received Packets") + + DialogueWindow::TableCell(Strings::Commify(stats.sync_recv_packets)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sync Sent Packets") + + DialogueWindow::TableCell(Strings::Commify(stats.sync_sent_packets)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sync Remote Received Packets") + + DialogueWindow::TableCell(Strings::Commify(stats.sync_remote_recv_packets)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sync Remote Sent Packets") + + DialogueWindow::TableCell(Strings::Commify(stats.sync_remote_sent_packets)) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Packet Loss In") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}%%", + ( + 100.0 * + ( + 1.0 - + static_cast(stats.sync_recv_packets) / + static_cast(stats.sync_remote_sent_packets) + ) + ) + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Packet Loss Out") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}%%", + ( + 100.0 * + ( + 1.0 - + static_cast(stats.sync_remote_recv_packets) / + static_cast(stats.sync_sent_packets) + ) + ) + ) + ) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resent Packets") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.resent_packets), + stats.resent_packets / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resent Fragments") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.resent_fragments), + stats.resent_fragments / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Resent Non-Fragments") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.resent_full), + stats.resent_full / sec_since_stats_reset + ) + ) + ); + + popup_table += DialogueWindow::Break(2); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Dropped Datarate Packets") + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(stats.dropped_datarate_packets), + stats.dropped_datarate_packets / sec_since_stats_reset + ) + ) + ); + + if (opts.daybreak_options.outgoing_data_rate > 0.0) { + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Outgoing Link Saturation") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}%% ({:.2f}kb Per Second)", + ( + 100.0 * + ( + 1.0 - + ( + ( + opts.daybreak_options.outgoing_data_rate - + stats.datarate_remaining + ) / + opts.daybreak_options.outgoing_data_rate + ) + ) + ), + opts.daybreak_options.outgoing_data_rate + ) + ) + ); + } + + popup_table += DialogueWindow::Break(2); + + std::string sent_rows; + + for (int i = 0; i < _maxEmuOpcode; ++i) { + const int count = eqs_stats.SentCount[i]; + if (count) { + sent_rows += DialogueWindow::TableRow( + DialogueWindow::TableCell(OpcodeNames[i]) + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(count), + count / sec_since_stats_reset + ) + ) + ); + } + } + + std::string recv_rows; + + for (int i = 0; i < _maxEmuOpcode; ++i) { + const int count = eqs_stats.RecvCount[i]; + if (count) { + recv_rows += DialogueWindow::TableRow( + DialogueWindow::TableCell(OpcodeNames[i]) + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f} Per Second)", + Strings::Commify(count), + count / sec_since_stats_reset + ) + ) + ); + } + } + + popup_table += DialogueWindow::TableRow(DialogueWindow::TableCell("Sent Packet Types")); + + popup_table += sent_rows; + + popup_table += DialogueWindow::TableRow(DialogueWindow::TableCell("Received Packet Types")); + + popup_table += recv_rows; + + popup_table = DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + "Network Statistics", + popup_table.c_str() + ); +} diff --git a/zone/gm_commands/shownpcgloballoot.cpp b/zone/gm_commands/show/npc_global_loot.cpp old mode 100755 new mode 100644 similarity index 71% rename from zone/gm_commands/shownpcgloballoot.cpp rename to zone/gm_commands/show/npc_global_loot.cpp index e8c1026cd3..6167550c23 --- a/zone/gm_commands/shownpcgloballoot.cpp +++ b/zone/gm_commands/show/npc_global_loot.cpp @@ -1,6 +1,6 @@ -#include "../client.h" +#include "../../client.h" -void command_shownpcgloballoot(Client *c, const Seperator *sep) +void ShowNPCGlobalLoot(Client *c, const Seperator *sep) { if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { c->Message(Chat::White, "You must target an NPC to use this command."); @@ -11,4 +11,3 @@ void command_shownpcgloballoot(Client *c, const Seperator *sep) zone->ShowNPCGlobalLoot(c, t); } - diff --git a/zone/gm_commands/show/npc_stats.cpp b/zone/gm_commands/show/npc_stats.cpp new file mode 100644 index 0000000000..65254e3bb8 --- /dev/null +++ b/zone/gm_commands/show/npc_stats.cpp @@ -0,0 +1,17 @@ +#include "../../client.h" + +void ShowNPCStats(Client *c, const Seperator *sep) +{ + if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { + c->Message(Chat::White, "You must target an NPC to use this command."); + return; + } + + const auto t = c->GetTarget()->CastToNPC(); + + // Stats + t->ShowStats(c); + + // Loot Data + t->QueryLoot(c); +} diff --git a/zone/gm_commands/show/npc_type.cpp b/zone/gm_commands/show/npc_type.cpp new file mode 100644 index 0000000000..f70b19e885 --- /dev/null +++ b/zone/gm_commands/show/npc_type.cpp @@ -0,0 +1,35 @@ +#include "../../client.h" + +void ShowNPCType(Client *c, const Seperator *sep) +{ + if (!sep->IsNumber(2)) { + c->Message(Chat::White, "Usage: #show npc_type [NPC ID]"); + return; + } + + const uint32 npc_id = Strings::ToUnsignedInt(sep->arg[2]); + const auto d = content_db.LoadNPCTypesData(npc_id); + + if (!d) { + c->Message( + Chat::White, + fmt::format( + "NPC ID {} was not found.", + npc_id + ).c_str() + ); + + return; + } + + auto npc = new NPC( + d, + nullptr, + c->GetPosition(), + GravityBehavior::Water + ); + + npc->ShowStats(c); + + safe_delete(npc); +} diff --git a/zone/gm_commands/show/peqzone_flags.cpp b/zone/gm_commands/show/peqzone_flags.cpp new file mode 100644 index 0000000000..9efa6e09f3 --- /dev/null +++ b/zone/gm_commands/show/peqzone_flags.cpp @@ -0,0 +1,15 @@ +#include "../../client.h" + +void ShowPEQZoneFlags(Client *c, const Seperator *sep) +{ + auto t = c; + if ( + c->GetTarget() && + c->GetTarget()->IsClient() && + c->Admin() >= minStatusToSeeOthersZoneFlags + ) { + t = c->GetTarget()->CastToClient(); + } + + t->SendPEQZoneFlagInfo(c); +} diff --git a/zone/gm_commands/show/petition.cpp b/zone/gm_commands/show/petition.cpp new file mode 100644 index 0000000000..5010005201 --- /dev/null +++ b/zone/gm_commands/show/petition.cpp @@ -0,0 +1,69 @@ +#include "../../client.h" +#include "../../common/repositories/petitions_repository.h" + +void ShowPetition(Client *c, const Seperator *sep) +{ + if (!sep->IsNumber(2)) { + const auto& l = PetitionsRepository::All(database); + + uint32 found_count = 0; + + for (const auto& e : l) { + c->Message( + Chat::White, + fmt::format( + "Petition {} | Name: {} Text: {}", + e.petid, + e.charname, + e.petitiontext + ).c_str() + ); + + found_count++; + + if (found_count == 50) { + break; + } + } + + if (found_count == 50) { + c->Message(Chat::White, "50 Petitions found, max reached."); + } + + c->Message( + Chat::White, + fmt::format( + "{} Petition{} found.", + found_count, + found_count != 1 ? "s" : "" + ).c_str() + ); + + return; + } + + const uint32 petition_id = Strings::ToUnsignedInt(sep->arg[2]); + + const auto& l = PetitionsRepository::GetWhere(database, fmt::format("petition_id = {}", petition_id)); + if (l.empty()) { + c->Message( + Chat::White, + fmt::format( + "Petition ID {} was not found.", + petition_id + ).c_str() + ); + + return; + } + + c->Message( + Chat::White, + fmt::format( + "Petition {} | Name: {} Text: {}", + l[0].petid, + l[0].charname, + l[0].petitiontext + ).c_str() + ); +} diff --git a/zone/gm_commands/show/petition_info.cpp b/zone/gm_commands/show/petition_info.cpp new file mode 100644 index 0000000000..68cd11cf27 --- /dev/null +++ b/zone/gm_commands/show/petition_info.cpp @@ -0,0 +1,79 @@ +#include "../../client.h" +#include "../../common/repositories/petitions_repository.h" + +void ShowPetitionInfo(Client *c, const Seperator *sep) +{ + if (!sep->IsNumber(2)) { + const auto& l = PetitionsRepository::All(database); + + uint32 found_count = 0; + + for (const auto& e : l) { + c->Message( + Chat::White, + fmt::format( + "Petition {} | Name: {} Text: {} Account: {} Zone: {} Class: {} Race: {} Level: {}", + e.petid, + e.charname, + e.petitiontext, + e.accountname, + e.zone, + GetClassIDName(static_cast(e.charclass)), + GetRaceIDName(static_cast(e.charrace)), + e.charlevel + ).c_str() + ); + + found_count++; + + if (found_count == 50) { + break; + } + } + + if (found_count == 50) { + c->Message(Chat::White, "50 Petitions found, max reached."); + } + + c->Message( + Chat::White, + fmt::format( + "{} Petition{} found.", + found_count, + found_count != 1 ? "s" : "" + ).c_str() + ); + + return; + } + + const uint32 petition_id = Strings::ToUnsignedInt(sep->arg[2]); + + const auto& l = PetitionsRepository::GetWhere(database, fmt::format("petition_id = {}", petition_id)); + if (l.empty()) { + c->Message( + Chat::White, + fmt::format( + "Petition ID {} was not found.", + petition_id + ).c_str() + ); + + return; + } + + c->Message( + Chat::White, + fmt::format( + "Petition {} | Name: {} Text: {} Account: {} Zone: {} Class: {} Race: {} Level: {}", + l[0].petid, + l[0].charname, + l[0].petitiontext, + l[0].accountname, + l[0].zone, + GetClassIDName(static_cast(l[0].charclass)), + GetRaceIDName(static_cast(l[0].charrace)), + l[0].charlevel + ).c_str() + ); +} diff --git a/zone/gm_commands/show/proximity.cpp b/zone/gm_commands/show/proximity.cpp new file mode 100644 index 0000000000..3b8076d291 --- /dev/null +++ b/zone/gm_commands/show/proximity.cpp @@ -0,0 +1,73 @@ +#include "../../client.h" + +void ShowProximity(Client *c, const Seperator *sep) +{ + if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { + c->Message(Chat::White, "You must target an NPC to use this command."); + return; + } + + for (const auto& n : entity_list.GetNPCList()) { + if ( + n.second && + Strings::Contains(n.second->GetName(), "Proximity") + ) { + n.second->Depop(); + } + } + + const auto t = c->GetTarget()->CastToNPC(); + + std::vector v; + + FindPerson_Point p {}; + + if (t->IsProximitySet()) { + glm::vec4 position; + position.w = t->GetHeading(); + position.x = t->GetProximityMinX(); + position.y = t->GetProximityMinY(); + position.z = t->GetZ(); + + position.x = t->GetProximityMinX(); + position.y = t->GetProximityMinY(); + NPC::SpawnNodeNPC("Proximity", "", position); + + position.x = t->GetProximityMinX(); + position.y = t->GetProximityMaxY(); + NPC::SpawnNodeNPC("Proximity", "", position); + + position.x = t->GetProximityMaxX(); + position.y = t->GetProximityMinY(); + NPC::SpawnNodeNPC("Proximity", "", position); + + position.x = t->GetProximityMaxX(); + position.y = t->GetProximityMaxY(); + NPC::SpawnNodeNPC("Proximity", "", position); + + p.x = t->GetProximityMinX(); + p.y = t->GetProximityMinY(); + p.z = t->GetZ(); + v.push_back(p); + + p.x = t->GetProximityMinX(); + p.y = t->GetProximityMaxY(); + v.push_back(p); + + p.x = t->GetProximityMaxX(); + p.y = t->GetProximityMaxY(); + v.push_back(p); + + p.x = t->GetProximityMaxX(); + p.y = t->GetProximityMinY(); + v.push_back(p); + + p.x = t->GetProximityMinX(); + p.y = t->GetProximityMinY(); + v.push_back(p); + } + + if (c->ClientVersion() >= EQ::versions::ClientVersion::RoF) { + c->SendPathPacket(v); + } +} diff --git a/zone/gm_commands/show/quest_errors.cpp b/zone/gm_commands/show/quest_errors.cpp new file mode 100644 index 0000000000..7a1bf4d9b8 --- /dev/null +++ b/zone/gm_commands/show/quest_errors.cpp @@ -0,0 +1,35 @@ +#include "../../client.h" +#include "../../quest_parser_collection.h" + +void ShowQuestErrors(Client *c, const Seperator *sep) +{ + std::list l; + parse->GetErrors(l); + + if (!l.size()) { + c->Message(Chat::White, "There are no Quest errors currently."); + return; + } + + c->Message(Chat::White, "Quest errors currently are as follows:"); + + uint32 error_count = 0; + + for (const auto& e : l) { + if (error_count >= RuleI(World, MaximumQuestErrors)) { + c->Message( + Chat::White, + fmt::format( + "Maximum of {} error{} shown.", + RuleI(World, MaximumQuestErrors), + RuleI(World, MaximumQuestErrors) != 1 ? "s" : "" + ).c_str() + ); + break; + } + + c->Message(Chat::White, e.c_str()); + + error_count++; + } +} diff --git a/zone/gm_commands/show/quest_globals.cpp b/zone/gm_commands/show/quest_globals.cpp new file mode 100644 index 0000000000..63396352b9 --- /dev/null +++ b/zone/gm_commands/show/quest_globals.cpp @@ -0,0 +1,76 @@ +#include "../../client.h" + +void ShowQuestGlobals(Client *c, const Seperator *sep) +{ + Mob* t = c; + if (c->GetTarget()) { + t = c->GetTarget(); + } + + QGlobalCache* char_cache = c->GetQGlobals(); + QGlobalCache* npc_cache = t->IsNPC() ? t->CastToNPC()->GetQGlobals() : nullptr; + QGlobalCache* zone_cache = zone->GetQGlobals(); + + std::list global_map; + + uint32 character_id = c->CharacterID(); + uint32 npc_id = t->IsNPC() ? t->CastToNPC()->GetNPCTypeID() : 0; + uint32 zone_id = zone->GetZoneID(); + + if (npc_cache) { + QGlobalCache::Combine( + global_map, + npc_cache->GetBucket(), + npc_id, + character_id, + zone_id + ); + } + + if (char_cache) { + QGlobalCache::Combine( + global_map, + char_cache->GetBucket(), + npc_id, + character_id, + zone_id + ); + } + + if (zone_cache) { + QGlobalCache::Combine( + global_map, + zone_cache->GetBucket(), + npc_id, + character_id, + zone_id + ); + } + + uint32 global_count = 0; + uint32 global_number = 1; + + for (const auto& g : global_map) { + c->Message( + Chat::White, + fmt::format( + "Quest Global {} | Name: {} Value: {}", + global_number, + g.name, + g.value + ).c_str() + ); + + global_count++; + global_number++; + } + + c->Message( + Chat::White, + fmt::format( + "{} Quest Global{} found.", + global_count, + global_count != 1 ? "s" : "" + ).c_str() + ); +} diff --git a/zone/gm_commands/viewrecipe.cpp b/zone/gm_commands/show/recipe.cpp old mode 100755 new mode 100644 similarity index 62% rename from zone/gm_commands/viewrecipe.cpp rename to zone/gm_commands/show/recipe.cpp index 74035de2a2..0bc9803161 --- a/zone/gm_commands/viewrecipe.cpp +++ b/zone/gm_commands/show/recipe.cpp @@ -1,32 +1,33 @@ -#include "../client.h" -#include "../command.h" +#include "../../client.h" +#include "../../command.h" #include "../../common/repositories/tradeskill_recipe_repository.h" #include "../../common/repositories/tradeskill_recipe_entries_repository.h" -void command_viewrecipe(Client *c, const Seperator *sep) +void ShowRecipe(Client *c, const Seperator *sep) { - int arguments = sep->argnum; - if (!arguments || !sep->IsNumber(1)) { - c->Message(Chat::White, "Command Syntax: #viewrecipe [Recipe ID]"); + if (!sep->IsNumber(2)) { + c->Message(Chat::White, "Command Syntax: #show recipe [Recipe ID]"); return; } - auto recipe_id = static_cast(Strings::ToUnsignedInt(sep->arg[1])); - auto re = TradeskillRecipeEntriesRepository::GetWhere( + const uint16 recipe_id = static_cast(Strings::ToUnsignedInt(sep->arg[2])); + + const auto& re = TradeskillRecipeEntriesRepository::GetWhere( database, fmt::format("recipe_id = {} ORDER BY id ASC", recipe_id) ); - auto r = TradeskillRecipeRepository::GetWhere( + + const auto& r = TradeskillRecipeRepository::GetWhere( database, fmt::format("id = {}", recipe_id) ); - if (re.empty() || r.empty() || !re[0].id || !r[0].id) { + if (re.empty() || r.empty()) { c->Message( Chat::White, fmt::format( "Recipe ID {} has no entries or could not be found.", - Strings::Commify(std::to_string(recipe_id)) + Strings::Commify(recipe_id) ).c_str() ); return; @@ -36,13 +37,13 @@ void command_viewrecipe(Client *c, const Seperator *sep) Chat::White, fmt::format( "Recipe {} | {}", - Strings::Commify(std::to_string(recipe_id)), + Strings::Commify(recipe_id), r[0].name ).c_str() ); - auto entry_number = 1; - bool can_summon_items = c->Admin() >= GetCommandStatus(c, "summonitem"); + uint32 entry_number = 1; + const bool can_summon_items = c->Admin() >= GetCommandStatus(c, "summonitem"); for (const auto& e : re) { c->Message( @@ -51,8 +52,22 @@ void command_viewrecipe(Client *c, const Seperator *sep) "Entry {}{} | {}{}", entry_number, e.iscontainer > 0 ? " (Container)" : "", - e.item_id > 1000 ? database.CreateItemLink(e.item_id) : EQ::constants::GetObjectTypeName(e.item_id), - can_summon_items && e.item_id > 1000 ? fmt::format(" | {}", Saylink::Silent(fmt::format("#si {}", e.item_id), "Summon")) : "" + ( + e.item_id > 1000 ? + database.CreateItemLink(e.item_id) : + EQ::constants::GetObjectTypeName(e.item_id) + ), + ( + can_summon_items && e.item_id > 1000 ? + fmt::format( + " | {}", + Saylink::Silent( + fmt::format("#si {}", e.item_id), + "Summon" + ) + ) : + "" + ) ).c_str() ); @@ -117,4 +132,3 @@ void command_viewrecipe(Client *c, const Seperator *sep) entry_number++; } } - diff --git a/zone/gm_commands/show/server_info.cpp b/zone/gm_commands/show/server_info.cpp new file mode 100644 index 0000000000..ff3070aa79 --- /dev/null +++ b/zone/gm_commands/show/server_info.cpp @@ -0,0 +1,106 @@ +#include "../../client.h" +#include "../../dialogue_window.h" +#include "../../common/serverinfo.h" + +void ShowServerInfo(Client *c, const Seperator *sep) +{ + auto os = EQ::GetOS(); + auto cpus = EQ::GetCPUs(); + const uint32 process_id = EQ::GetPID(); + const double rss = EQ::GetRSS() / 1048576.0; + const uint32 uptime = static_cast(EQ::GetUptime()); + + std::string popup_table; + + std::string popup_text; + + popup_text += DialogueWindow::CenterMessage( + DialogueWindow::ColorMessage("green", "Operating System Information") + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Machine") + + DialogueWindow::TableCell(os.machine) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("System") + + DialogueWindow::TableCell(os.sysname) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Release") + + DialogueWindow::TableCell(os.release) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Uptime") + + DialogueWindow::TableCell(Strings::SecondsToTime(uptime)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Version") + + DialogueWindow::TableCell(os.version) + ); + + popup_text += DialogueWindow::Table(popup_table); + + popup_table = std::string(); + + popup_text += DialogueWindow::Break(); + + popup_text += DialogueWindow::CenterMessage( + DialogueWindow::ColorMessage("green", "CPU Information") + ); + + for (size_t cpu = 0; cpu < cpus.size(); ++cpu) { + auto ¤t_cpu = cpus[cpu]; + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell( + fmt::format( + "CPU {}", + cpu + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "{} ({:.2f}GHz)", + current_cpu.model, + current_cpu.speed + ) + ) + ); + } + + popup_text += DialogueWindow::Table(popup_table); + + popup_table = std::string(); + + popup_text += DialogueWindow::Break(); + + popup_text += DialogueWindow::CenterMessage( + DialogueWindow::ColorMessage("green", "CPU Information") + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Process ID") + + DialogueWindow::TableCell(Strings::Commify(process_id)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("RSS") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f} MB", + rss + ) + ) + ); + + popup_text += DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + "Server Information", + popup_text.c_str() + ); +} diff --git a/zone/gm_commands/show/skills.cpp b/zone/gm_commands/show/skills.cpp new file mode 100644 index 0000000000..20705ac162 --- /dev/null +++ b/zone/gm_commands/show/skills.cpp @@ -0,0 +1,42 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowSkills(Client *c, const Seperator *sep) +{ + auto t = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + t = c->GetTarget()->CastToClient(); + } + + std::string popup_table; + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("ID") + + DialogueWindow::TableCell("Name") + + DialogueWindow::TableCell("Current") + + DialogueWindow::TableCell("Max") + + DialogueWindow::TableCell("Raw") + ); + + for (const auto& s : EQ::skills::GetSkillTypeMap()) { + if (t->CanHaveSkill(s.first) && t->MaxSkill(s.first)) { + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell(std::to_string(s.first)) + + DialogueWindow::TableCell(s.second) + + DialogueWindow::TableCell(std::to_string(t->GetSkill(s.first))) + + DialogueWindow::TableCell(std::to_string(t->MaxSkill(s.first))) + + DialogueWindow::TableCell(std::to_string(t->GetRawSkill(s.first))) + ); + } + } + + popup_table = DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + fmt::format( + "Skills for {}", + c->GetTargetDescription(t, TargetDescriptionType::UCSelf) + ).c_str(), + popup_table.c_str() + ); +} diff --git a/zone/gm_commands/show/spawn_status.cpp b/zone/gm_commands/show/spawn_status.cpp new file mode 100644 index 0000000000..1fd59a20f9 --- /dev/null +++ b/zone/gm_commands/show/spawn_status.cpp @@ -0,0 +1,147 @@ +#include "../../client.h" + +void ShowSpawnStatus(Client *c, const Seperator *sep) +{ + const auto arguments = sep->argnum; + if (arguments < 2) { + c->Message(Chat::White, "Usage: #show spawn_status all - Show all spawn statuses for your current zone"); + c->Message(Chat::White, "Usage: #show spawn_status disabled - Show all disabled spawn statuses for your current zone"); + c->Message(Chat::White, "Usage: #show spawn_status enabled - Show all enabled spawn statuses for your current zone"); + c->Message(Chat::White, "Usage: #show spawn_status [Spawn ID] - Show spawn status by ID for your current zone"); + return; + } + + const bool is_all = !strcasecmp(sep->arg[2], "all"); + const bool is_disabled = !strcasecmp(sep->arg[2], "disabled"); + const bool is_enabled = !strcasecmp(sep->arg[2], "enabled"); + const bool is_search = sep->IsNumber(2); + + if ( + !is_all && + !is_disabled && + !is_enabled && + !is_search + ) { + c->Message(Chat::White, "Usage: #show spawn_status all - Show all spawn statuses for your current zone"); + c->Message(Chat::White, "Usage: #show spawn_status disabled - Show all disabled spawn statuses for your current zone"); + c->Message(Chat::White, "Usage: #show spawn_status enabled - Show all enabled spawn statuses for your current zone"); + c->Message(Chat::White, "Usage: #show spawn_status [Spawn ID] - Show spawn status by ID for your current zone"); + return; + } + + std::string filter_type; + if (is_disabled) { + filter_type = "Disabled"; + } else if (is_enabled) { + filter_type = "Enabled"; + } + + const uint32 spawn_id = ( + is_search ? + Strings::ToUnsignedInt(sep->arg[2]) : + 0 + ); + + LinkedListIterator iterator(zone->spawn2_list); + iterator.Reset(); + + uint32 filtered_count = 0; + uint32 spawn_count = 0; + uint32 spawn_number = 1; + + while (iterator.MoreElements()) { + const auto& e = iterator.GetData(); + + const uint32 time_remaining = e->GetTimer().GetRemainingTime(); + + if ( + is_all || + ( + is_disabled && + time_remaining == UINT32_MAX + ) || + ( + is_enabled && + time_remaining != UINT32_MAX + ) || + ( + is_search && + e->GetID() == spawn_id + ) + ) { + c->Message( + Chat::White, + fmt::format( + "Spawn {} | ID: {} Coordinates: {:.2f}, {:.2f}, {:.2f}, {:.2f}", + spawn_number, + e->GetID(), + e->GetX(), + e->GetY(), + e->GetZ(), + e->GetHeading() + ).c_str() + ); + + if (time_remaining != UINT32_MAX) { + const uint32 seconds_remaining = (time_remaining / 1000); + + c->Message( + Chat::White, + fmt::format( + "Spawn {} | Respawn: {}", + spawn_number, + Strings::SecondsToTime(seconds_remaining) + ).c_str() + ); + } + + filtered_count++; + spawn_number++; + } + + spawn_count++; + iterator.Advance(); + } + + if (!spawn_count) { + c->Message(Chat::White, "No spawns were found."); + return; + } + + if ( + (is_disabled || is_enabled) && + !filtered_count + ) { + c->Message( + Chat::White, + fmt::format( + "No {} spawns were found.", + filter_type + ).c_str() + ); + return; + } + + if (is_all) { + c->Message( + Chat::White, + fmt::format( + "{} Spawn{} found.", + spawn_count, + spawn_count != 1 ? "s" : "" + ).c_str() + ); + + return; + } + + c->Message( + Chat::White, + fmt::format( + "{} of {} spawn{} found.", + filtered_count, + spawn_count, + spawn_count != 1 ? "s" : "" + ).c_str() + ); +} diff --git a/zone/gm_commands/show/spells.cpp b/zone/gm_commands/show/spells.cpp new file mode 100644 index 0000000000..7d522be95e --- /dev/null +++ b/zone/gm_commands/show/spells.cpp @@ -0,0 +1,30 @@ +#include "../../client.h" + +void ShowSpells(Client *c, const Seperator *sep) +{ + auto t = c; + if (c->GetTarget() && c->GetTarget()->IsClient()) { + t = c->GetTarget()->CastToClient(); + } + + const auto is_disciplines = !strcasecmp(sep->arg[2], "disciplines"); + const auto is_spells = !strcasecmp(sep->arg[2], "spells"); + if ( + !is_disciplines && + !is_spells + ) { + c->Message(Chat::White, "Usages: #show spells disciplines - Show your or your target's learned disciplines"); + c->Message(Chat::White, "Usages: #show spells spells - Show your or your target's memorized spells"); + return; + } + + ShowSpellType show_spell_type; + + if (is_disciplines) { + show_spell_type = ShowSpellType::Disciplines; + } else if (is_spells) { + show_spell_type = ShowSpellType::Spells; + } + + t->ShowSpells(c, show_spell_type); +} diff --git a/zone/gm_commands/show/spells_list.cpp b/zone/gm_commands/show/spells_list.cpp new file mode 100644 index 0000000000..fb94306c11 --- /dev/null +++ b/zone/gm_commands/show/spells_list.cpp @@ -0,0 +1,13 @@ +#include "../../client.h" + +void ShowSpellsList(Client *c, const Seperator *sep) +{ + if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { + c->Message(Chat::White, "You must target an NPC to use this command."); + return; + } + + const auto t = c->GetTarget()->CastToNPC(); + + t->AISpellsList(c); +} diff --git a/zone/gm_commands/showstats.cpp b/zone/gm_commands/show/stats.cpp old mode 100755 new mode 100644 similarity index 51% rename from zone/gm_commands/showstats.cpp rename to zone/gm_commands/show/stats.cpp index 9e43b6f5a8..be1f4d40d7 --- a/zone/gm_commands/showstats.cpp +++ b/zone/gm_commands/show/stats.cpp @@ -1,6 +1,6 @@ -#include "../client.h" +#include "../../client.h" -void command_showstats(Client *c, const Seperator *sep) +void ShowStats(Client *c, const Seperator *sep) { Mob* t = c; if (c->GetTarget()) { @@ -9,4 +9,3 @@ void command_showstats(Client *c, const Seperator *sep) t->ShowStats(c); } - diff --git a/zone/gm_commands/timers.cpp b/zone/gm_commands/show/timers.cpp old mode 100755 new mode 100644 similarity index 57% rename from zone/gm_commands/timers.cpp rename to zone/gm_commands/show/timers.cpp index efee6da55d..b31d8eac40 --- a/zone/gm_commands/timers.cpp +++ b/zone/gm_commands/show/timers.cpp @@ -1,7 +1,7 @@ -#include "../client.h" -#include "../dialogue_window.h" +#include "../../client.h" +#include "../../dialogue_window.h" -void command_timers(Client *c, const Seperator *sep) +void ShowTimers(Client *c, const Seperator *sep) { auto t = c; if (c->GetTarget() && c->GetTarget()->IsClient()) { @@ -23,26 +23,30 @@ void command_timers(Client *c, const Seperator *sep) return; } - auto m = DialogueWindow::TableRow( + std::string popup_table; + + popup_table += DialogueWindow::TableRow( DialogueWindow::TableCell("Timer ID") + DialogueWindow::TableCell("Remaining Time") ); for (const auto& e : l) { - auto r = e.second->GetRemainingTime(); - if (r) { - m += DialogueWindow::TableRow( - DialogueWindow::TableCell(std::to_string(e.first)) + - DialogueWindow::TableCell(Strings::SecondsToTime(r)) + const uint32 remaining_time = e.second->GetRemainingTime(); + if (remaining_time) { + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell(Strings::Commify(e.first)) + + DialogueWindow::TableCell(Strings::SecondsToTime(remaining_time)) ); } } + popup_table = DialogueWindow::Table(popup_table); + c->SendPopupToClient( fmt::format( "Recast Timers for {}", c->GetTargetDescription(t, TargetDescriptionType::UCSelf) ).c_str(), - DialogueWindow::Table(m).c_str() + popup_table.c_str() ); } diff --git a/zone/gm_commands/show/traps.cpp b/zone/gm_commands/show/traps.cpp new file mode 100644 index 0000000000..28a6215d7f --- /dev/null +++ b/zone/gm_commands/show/traps.cpp @@ -0,0 +1,6 @@ +#include "../../client.h" + +void ShowTraps(Client *c, const Seperator *sep) +{ + entity_list.GetTrapInfo(c); +} diff --git a/zone/gm_commands/show/uptime.cpp b/zone/gm_commands/show/uptime.cpp new file mode 100644 index 0000000000..c95bcff2aa --- /dev/null +++ b/zone/gm_commands/show/uptime.cpp @@ -0,0 +1,19 @@ +#include "../../client.h" +#include "../../worldserver.h" + +extern WorldServer worldserver; + +void ShowUptime(Client *c, const Seperator *sep) +{ + auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); + + auto s = (ServerUptime_Struct *) pack->pBuffer; + strn0cpy(s->adminname, c->GetName(), sizeof(s->adminname)); + + if (sep->IsNumber(2) && Strings::ToUnsignedInt(sep->arg[2]) > 0) { + s->zoneserverid = Strings::ToUnsignedInt(sep->arg[2]); + } + + worldserver.SendPacket(pack); + safe_delete(pack); +} diff --git a/zone/gm_commands/show/variable.cpp b/zone/gm_commands/show/variable.cpp new file mode 100644 index 0000000000..98418c14b3 --- /dev/null +++ b/zone/gm_commands/show/variable.cpp @@ -0,0 +1,33 @@ +#include "../../client.h" + +void ShowVariable(Client *c, const Seperator *sep) +{ + const auto arguments = sep->argnum; + if (arguments < 2) { + c->Message(Chat::White, "Usage: #show variable [Variable Name]"); + return; + } + + const std::string& variable = sep->argplus[2]; + + std::string value; + if (!database.GetVariable(variable, value)) { + c->Message( + Chat::White, + fmt::format( + "Variable '{}' was not found.", + variable + ).c_str() + ); + return; + } + + c->Message( + Chat::White, + fmt::format( + "Variable {} | {}", + variable, + value + ).c_str() + ); +} diff --git a/zone/gm_commands/show/version.cpp b/zone/gm_commands/show/version.cpp new file mode 100644 index 0000000000..e9b55d5496 --- /dev/null +++ b/zone/gm_commands/show/version.cpp @@ -0,0 +1,35 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowVersion(Client *c, const Seperator *sep) +{ + std::string popup_table; + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Version") + + DialogueWindow::TableCell(CURRENT_VERSION) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Compiled") + + DialogueWindow::TableCell( + fmt::format( + "{} {}", + COMPILE_DATE, + COMPILE_TIME + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Last Modified") + + DialogueWindow::TableCell(LAST_MODIFIED) + ); + + popup_table = DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + "Server Version", + popup_table.c_str() + ); +} diff --git a/zone/gm_commands/wpinfo.cpp b/zone/gm_commands/show/waypoints.cpp old mode 100755 new mode 100644 similarity index 54% rename from zone/gm_commands/wpinfo.cpp rename to zone/gm_commands/show/waypoints.cpp index 4c1774c083..262489fca3 --- a/zone/gm_commands/wpinfo.cpp +++ b/zone/gm_commands/show/waypoints.cpp @@ -1,25 +1,25 @@ -#include "../client.h" +#include "../../client.h" -void command_wpinfo(Client *c, const Seperator *sep) +void ShowWaypoints(Client *c, const Seperator *sep) { if (!c->GetTarget() || !c->GetTarget()->IsNPC()) { c->Message(Chat::White, "You must target an NPC to use this command."); return; } - auto target = c->GetTarget()->CastToNPC(); + auto t = c->GetTarget()->CastToNPC(); - if (!target->GetGrid()) { + if (!t->GetGrid()) { c->Message( Chat::White, fmt::format( "{} is not a part of any grid.", - c->GetTargetDescription(target) + c->GetTargetDescription(t) ).c_str() ); + return; } - target->DisplayWaypointInfo(c); + t->DisplayWaypointInfo(c); } - diff --git a/zone/gm_commands/show/who.cpp b/zone/gm_commands/show/who.cpp new file mode 100755 index 0000000000..003a2af706 --- /dev/null +++ b/zone/gm_commands/show/who.cpp @@ -0,0 +1,235 @@ +#include "../../client.h" + +void ShowWho(Client *c, const Seperator *sep) +{ + const std::string& query = SQL( + SELECT + character_data.name, + character_data.zone_id, + character_data.zone_instance, + COALESCE( + ( + SELECT guilds.name FROM guilds WHERE id = ( + ( + SELECT guild_id FROM guild_members WHERE char_id = character_data.id + ) + ) + ), + "" + ) AS guild_name, + character_data.level, + character_data.race, + character_data.class, + COALESCE( + ( + SELECT account.status FROM account WHERE account.id = character_data.account_id LIMIT 1 + ), + 0 + ) AS account_status, + COALESCE( + ( + SELECT account.name FROM account WHERE account.id = character_data.account_id LIMIT 1 + ), + 0 + ) AS account_name, + COALESCE( + ( + SELECT account_ip.ip FROM account_ip WHERE account_ip.accid = character_data.account_id ORDER BY account_ip.lastused DESC LIMIT 1 + ), + "" + ) AS account_ip + FROM + character_data + WHERE + last_login > (UNIX_TIMESTAMP() - 600) + ORDER BY + character_data.name; + ); + + auto results = database.QueryDatabase(query); + if (!results.Success() || !results.RowCount()) { + return; + } + + bool is_filtered = false; + + std::string search_criteria; + + if (sep->arg[2]) { + search_criteria = Strings::ToLower(sep->arg[2]); + } + + uint32 found_count = 0; + + c->Message(Chat::Who, "Players in EverQuest:"); + c->Message(Chat::Who, "------------------------------"); + + for (auto row : results) { + const std::string& player_name = row[0]; + const uint32 zone_id = Strings::ToUnsignedInt(row[1]); + const std::string& zone_short_name = ZoneName(zone_id); + const std::string& zone_long_name = ZoneLongName(zone_id); + const uint8 zone_instance = Strings::ToUnsignedInt(row[2]); + const std::string& guild_name = row[3]; + const uint8 player_level = Strings::ToUnsignedInt(row[4]); + const uint16 player_race = Strings::ToUnsignedInt(row[5]); + const uint8 player_class = Strings::ToUnsignedInt(row[6]); + const uint8 account_status = Strings::ToUnsignedInt(row[7]); + const std::string& account_name = row[8]; + const std::string& account_ip = row[9]; + const std::string& base_class_name = GetClassIDName(player_class); + const std::string& displayed_race_name = GetRaceIDName(player_race); + + if (!search_criteria.empty()) { + is_filtered = true; + + const bool found = ( + Strings::Contains(Strings::ToLower(player_name), search_criteria) || + Strings::Contains(Strings::ToLower(zone_short_name), search_criteria) || + Strings::Contains(Strings::ToLower(displayed_race_name), search_criteria) || + Strings::Contains(Strings::ToLower(base_class_name), search_criteria) || + Strings::Contains(Strings::ToLower(guild_name), search_criteria) || + Strings::Contains(Strings::ToLower(account_name), search_criteria) || + Strings::Contains(Strings::ToLower(account_ip), search_criteria) + ); + + if (!found) { + continue; + } + } + + std::string displayed_guild_name; + if (!guild_name.empty()) { + displayed_guild_name = Saylink::Silent( + fmt::format( + "#who \"{}\"", + guild_name + ), + fmt::format( + "<{}>", + guild_name + ) + ); + } + + const std::string& goto_saylink = Saylink::Silent( + fmt::format( + "#goto {}", + player_name + ), + "Goto" + ); + + const std::string& summon_saylink = Saylink::Silent( + fmt::format( + "#summon {}", + player_name + ), + "Summon" + ); + + const std::string& display_class_name = GetClassIDName(player_class, player_level); + + const std::string& class_saylink = Saylink::Silent( + fmt::format( + "#who {}", + base_class_name + ), + display_class_name + ); + + const std::string& race_saylink = Saylink::Silent( + fmt::format( + "#who {}", + displayed_race_name + ), + displayed_race_name + ); + + const std::string& zone_saylink = Saylink::Silent( + fmt::format( + "#who {}", + zone_short_name + ), + zone_long_name + ); + + const std::string& account_saylink = Saylink::Silent( + fmt::format( + "#who {}", + account_name + ), + account_name + ); + + const std::string& account_ip_saylink = Saylink::Silent( + fmt::format( + "#who {}", + account_ip + ), + account_ip + ); + + const std::string& status_level = ( + account_status ? + fmt::format( + "* {} * ", + EQ::constants::GetAccountStatusName(account_status) + ) : + "" + ); + + const std::string& version_string = ( + zone_instance ? + fmt::format( + " ({})", + zone_instance + ) : + "" + ); + + c->Message( + Chat::Who, + fmt::format( + "{}[{} {} ({})] {} ({}) ({}) ({}) {} ZONE: {}{} ({} | {})", + status_level, + player_level, + class_saylink, + base_class_name, + player_name, + race_saylink, + account_saylink, + account_ip_saylink, + displayed_guild_name, + zone_saylink, + version_string, + goto_saylink, + summon_saylink + ).c_str() + ); + + found_count++; + } + + const std::string& filter_string = is_filtered ? " that match those filters" : ""; + + const std::string& message = ( + found_count ? + fmt::format( + "There {} {} player{} in EverQuest{}.", + found_count != 1 ? "are" : "is", + found_count, + found_count != 1 ? "s" : "", + filter_string + ) : + fmt::format( + "There are no players in EverQuest{}.", + filter_string + ) + ); + + c->Message( + Chat::Who, + message.c_str() + ); +} diff --git a/zone/gm_commands/xtargets.cpp b/zone/gm_commands/show/xtargets.cpp old mode 100755 new mode 100644 similarity index 78% rename from zone/gm_commands/xtargets.cpp rename to zone/gm_commands/show/xtargets.cpp index 3ae8a6236b..b3416b561d --- a/zone/gm_commands/xtargets.cpp +++ b/zone/gm_commands/show/xtargets.cpp @@ -1,20 +1,20 @@ -#include "../client.h" +#include "../../client.h" #include "../../common/data_verification.h" -void command_xtargets(Client *c, const Seperator *sep) +void ShowXTargets(Client *c, const Seperator *sep) { auto t = c; if (c->GetTarget() && c->GetTarget()->IsClient()) { t = c->GetTarget()->CastToClient(); } - auto arguments = sep->argnum; - if (!arguments || !sep->IsNumber(1)) { + const auto arguments = sep->argnum; + if (arguments < 2 || !sep->IsNumber(2)) { t->ShowXTargets(c); return; } - const auto new_max = static_cast(Strings::ToUnsignedInt(sep->arg[1])); + const auto new_max = static_cast(Strings::ToUnsignedInt(sep->arg[2])); if (!EQ::ValueWithin(new_max, 5, XTARGET_HARDCAP)) { c->Message( diff --git a/zone/gm_commands/show/zone_data.cpp b/zone/gm_commands/show/zone_data.cpp new file mode 100644 index 0000000000..1e8e2c7ff3 --- /dev/null +++ b/zone/gm_commands/show/zone_data.cpp @@ -0,0 +1,276 @@ +#include "../../client.h" +#include "../../dialogue_window.h" + +void ShowZoneData(Client *c, const Seperator *sep) +{ + std::string popup_table; + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Type") + + DialogueWindow::TableCell(std::to_string(zone->newzone_data.ztype)) + ); + + for (uint8 fog_index = 0; fog_index < 4; fog_index++) { + const uint8 fog_number = (fog_index + 1); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell( + fmt::format( + "Fog {} Colors", + fog_number + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "{} {} {}", + DialogueWindow::ColorMessage( + "red1", + std::to_string(zone->newzone_data.fog_red[fog_index]) + ), + DialogueWindow::ColorMessage( + "forest_green", + std::to_string(zone->newzone_data.fog_green[fog_index]) + ), + DialogueWindow::ColorMessage( + "royal_blue", + std::to_string(zone->newzone_data.fog_blue[fog_index]) + ) + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell( + fmt::format( + "Fog {} Clipping", + fog_number + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "{} to {}", + zone->newzone_data.fog_minclip[fog_index], + zone->newzone_data.fog_maxclip[fog_index] + ) + ) + ); + } + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Fog Density") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}", + zone->newzone_data.fog_density + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Gravity") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}", + zone->newzone_data.gravity + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Time Type") + + DialogueWindow::TableCell(std::to_string(zone->newzone_data.time_type)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Time Type") + + DialogueWindow::TableCell(std::to_string(zone->newzone_data.time_type)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Experience Multiplier") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}%%", + (zone->newzone_data.zone_exp_multiplier * 100) + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Safe Coordinates") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}, {:.2f}, {:.2f}", + zone->newzone_data.safe_x, + zone->newzone_data.safe_y, + zone->newzone_data.safe_z + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Max Z") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}", + zone->newzone_data.max_z + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Underworld Z") + + DialogueWindow::TableCell( + fmt::format( + "{:.2f}", + zone->newzone_data.underworld + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Clipping Distance") + + DialogueWindow::TableCell( + fmt::format( + "{} to {}", + zone->newzone_data.minclip, + zone->newzone_data.maxclip + ) + ) + ); + + // Weather Data + for (uint8 weather_index = 0; weather_index < 4; weather_index++) { + const uint8 weather_number = (weather_index + 1); + + if ( + zone->newzone_data.rain_chance[weather_index] || + zone->newzone_data.rain_duration[weather_index] + ) { + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell( + fmt::format( + "Rain {}", + weather_number + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "Chance: {}", + zone->newzone_data.rain_chance[weather_index] + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "Duration: {}", + zone->newzone_data.rain_duration[weather_index] + ) + ) + ); + } + + if ( + zone->newzone_data.snow_chance[weather_index] || + zone->newzone_data.snow_duration[weather_index] + ) { + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell( + fmt::format( + "Snow {}", + weather_number + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "Chance: {}", + zone->newzone_data.snow_chance[weather_index] + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "Duration: {}", + zone->newzone_data.snow_duration[weather_index] + ) + ) + ); + } + } + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Sky") + + DialogueWindow::TableCell(std::to_string(zone->newzone_data.sky)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Suspend Buffs") + + DialogueWindow::TableCell( + zone->newzone_data.suspend_buffs ? + DialogueWindow::ColorMessage("forest_green", "Y") : + DialogueWindow::ColorMessage("red1", "N") + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Health Regen") + + DialogueWindow::TableCell( + fmt::format( + "{} ({})", + Strings::Commify(zone->newzone_data.fast_regen_hp), + Strings::SecondsToTime(zone->newzone_data.fast_regen_hp) + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Mana Regen") + + DialogueWindow::TableCell( + fmt::format( + "{} ({})", + Strings::Commify(zone->newzone_data.fast_regen_mana), + Strings::SecondsToTime(zone->newzone_data.fast_regen_mana) + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Endurance Regen") + + DialogueWindow::TableCell( + fmt::format( + "{} ({})", + Strings::Commify(zone->newzone_data.fast_regen_endurance), + Strings::SecondsToTime(zone->newzone_data.fast_regen_endurance) + ) + ) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Maximum Aggro Distance") + + DialogueWindow::TableCell(Strings::Commify(zone->newzone_data.npc_aggro_max_dist)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Underworld Teleport Index") + + DialogueWindow::TableCell(Strings::Commify(zone->newzone_data.underworld_teleport_index)) + ); + + popup_table += DialogueWindow::TableRow( + DialogueWindow::TableCell("Lava Damage") + + DialogueWindow::TableCell( + fmt::format( + "{} to {}", + Strings::Commify(zone->newzone_data.min_lava_damage), + Strings::Commify(zone->newzone_data.lava_damage) + ) + ) + ); + + popup_table = DialogueWindow::Table(popup_table); + + c->SendPopupToClient( + fmt::format( + "Zone Data for {}", + zone->GetZoneDescription() + ).c_str(), + popup_table.c_str() + ); +} diff --git a/zone/gm_commands/show/zone_global_loot.cpp b/zone/gm_commands/show/zone_global_loot.cpp new file mode 100644 index 0000000000..6a05fdc198 --- /dev/null +++ b/zone/gm_commands/show/zone_global_loot.cpp @@ -0,0 +1,6 @@ +#include "../../client.h" + +void ShowZoneGlobalLoot(Client *c, const Seperator *sep) +{ + zone->ShowZoneGlobalLoot(c); +} diff --git a/zone/gm_commands/show/zone_loot.cpp b/zone/gm_commands/show/zone_loot.cpp new file mode 100644 index 0000000000..53222cf455 --- /dev/null +++ b/zone/gm_commands/show/zone_loot.cpp @@ -0,0 +1,102 @@ +#include "../../client.h" + +void ShowZoneLoot(Client *c, const Seperator *sep) +{ + if (!sep->IsNumber(2)) { + c->Message( + Chat::White, + "Usage: #show zone_loot [Item ID]" + ); + return; + } + + const uint32 search_item_id = Strings::ToUnsignedInt(sep->arg[2]); + + std::vector> v; + + uint32 loot_count = 0; + uint32 loot_number = 1; + + for (auto npc_entity: entity_list.GetNPCList()) { + auto il = npc_entity.second->GetItemList(); + v.emplace_back(std::make_pair(npc_entity.second, il)); + } + + for (const auto &e: v) { + NPC *n = e.first; + const auto &l = e.second; + + std::string npc_link; + if (n) { + const uint32 instance_id = zone->GetInstanceID(); + const uint32 zone_id = zone->GetZoneID(); + + const std::string &command_link = Saylink::Silent( + fmt::format( + "#{} {} {} {} {}", + (instance_id != 0 ? "zoneinstance" : "zone"), + (instance_id != 0 ? instance_id : zone_id), + n->GetX(), + n->GetY(), + n->GetZ() + ), + "Goto" + ); + + npc_link = fmt::format( + "NPC: {} (ID {}) [{}]", + n->GetCleanName(), + n->GetID(), + command_link + ); + } + + for (const auto &i: l) { + if (!search_item_id || i->item_id == search_item_id) { + EQ::SayLinkEngine linker; + linker.SetLinkType(EQ::saylink::SayLinkLootItem); + linker.SetLootData(i); + + c->Message( + Chat::White, + fmt::format( + "{}. {} ({}) {}", + loot_number, + linker.GenerateLink(), + Strings::Commify(i->item_id), + npc_link + ).c_str() + ); + + loot_number++; + loot_count++; + } + } + } + + + if (search_item_id) { + c->Message( + Chat::White, + fmt::format( + "{} ({}) is dropping in {} place{}.", + database.CreateItemLink(search_item_id), + Strings::Commify(search_item_id), + loot_count, + loot_count != 1 ? "s" : "" + ).c_str() + ); + + return; + } + + c->Message( + Chat::White, + fmt::format( + "{} Item {} {} dropping.", + loot_count, + loot_count != 1 ? "s" : "", + loot_count != 1 ? "are" : "is" + ).c_str() + ); +} diff --git a/zone/gm_commands/showzonepoints.cpp b/zone/gm_commands/show/zone_points.cpp old mode 100755 new mode 100644 similarity index 57% rename from zone/gm_commands/showzonepoints.cpp rename to zone/gm_commands/show/zone_points.cpp index 4b98217a0a..447370231b --- a/zone/gm_commands/showzonepoints.cpp +++ b/zone/gm_commands/show/zone_points.cpp @@ -1,24 +1,24 @@ -#include "../client.h" +#include "../../client.h" -void command_showzonepoints(Client *c, const Seperator *sep) +void ShowZonePoints(Client *c, const Seperator *sep) { - auto &mob_list = entity_list.GetMobList(); - for (auto itr : mob_list) { - Mob *mob = itr.second; + for (const auto& m : entity_list.GetMobList()) { + Mob* mob = m.second; if (mob->IsNPC() && mob->GetRace() == RACE_NODE_2254) { mob->Depop(); } } - int found_zone_points = 0; + uint32 found_count = 0; c->Message(Chat::White, "Listing zone points..."); + c->SendChatLineBreak(); for (auto &p : zone->virtual_zone_point_list) { - std::string zone_long_name = ZoneLongName(p.target_zone_id); + const std::string& zone_long_name = ZoneLongName(p.target_zone_id); - std::string saylink = fmt::format( + const std::string& saylink = fmt::format( "#goto {:.0f} {:.0f} {:.0f}", p.x, p.y, @@ -45,83 +45,92 @@ void command_showzonepoints(Client *c, const Seperator *sep) ).c_str() ); - std::string node_name = fmt::format("ZonePoint To [{}]", zone_long_name); + const std::string& node_name = fmt::format("ZonePoint To [{}]", zone_long_name); float half_width = ((float) p.width / 2); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x + half_width, - (float) p.y + half_width, + p.x + half_width, + p.y + half_width, p.z, p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x + half_width, - (float) p.y - half_width, + p.x + half_width, + p.y - half_width, p.z, p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x - half_width, - (float) p.y - half_width, + p.x - half_width, + p.y - half_width, p.z, p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x - half_width, - (float) p.y + half_width, + p.x - half_width, + p.y + half_width, p.z, p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x + half_width, - (float) p.y + half_width, - (float) p.z + (float) p.height, + p.x + half_width, + p.y + half_width, + p.z + static_cast(p.height), p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x + half_width, - (float) p.y - half_width, - (float) p.z + (float) p.height, + p.x + half_width, + p.y - half_width, + p.z + static_cast(p.height), p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x - half_width, - (float) p.y - half_width, - (float) p.z + (float) p.height, + p.x - half_width, + p.y - half_width, + p.z + static_cast(p.height), p.heading - )); + ) + ); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( - (float) p.x - half_width, - (float) p.y + half_width, - (float) p.z + (float) p.height, + p.x - half_width, + p.y + half_width, + p.z + static_cast(p.height), p.heading - )); + ) + ); - found_zone_points++; + found_count++; } LinkedListIterator iterator(zone->zone_point_list); iterator.Reset(); while (iterator.MoreElements()) { - ZonePoint *p = iterator.GetData(); - std::string zone_long_name = ZoneLongName(p->target_zone_id); - std::string node_name = fmt::format("ZonePoint To [{}]", zone_long_name); + const auto &p = iterator.GetData(); + + const std::string& zone_long_name = ZoneLongName(p->target_zone_id); + const std::string& node_name = fmt::format("ZonePoint To [{}]", zone_long_name); NPC::SpawnZonePointNodeNPC( node_name, glm::vec4( @@ -132,9 +141,7 @@ void command_showzonepoints(Client *c, const Seperator *sep) ) ); - // {:.0f} - - std::string saylink = fmt::format( + const std::string& saylink = fmt::format( "#goto {:.0f} {:.0f} {:.0f}", p->x, p->y, @@ -145,13 +152,13 @@ void command_showzonepoints(Client *c, const Seperator *sep) Chat::White, fmt::format( "Client Side Zone Point [{}] x [{}] y [{}] z [{}] h [{}] number [{}] | To [{}] ({}) x [{}] y [{}] z [{}] h [{}]", - Saylink::Silent(saylink, "Goto").c_str(), + Saylink::Silent(saylink, "Goto"), p->x, p->y, p->z, p->heading, p->number, - zone_long_name.c_str(), + zone_long_name, p->target_zone_id, p->target_x, p->target_y, @@ -162,14 +169,12 @@ void command_showzonepoints(Client *c, const Seperator *sep) iterator.Advance(); - found_zone_points++; + found_count++; } - if (found_zone_points == 0) { - c->Message(Chat::White, "There were no zone points found..."); + if (!found_count) { + c->Message(Chat::White, "There were no zone points found."); } c->SendChatLineBreak(); - } - diff --git a/zone/gm_commands/show/zone_status.cpp b/zone/gm_commands/show/zone_status.cpp new file mode 100644 index 0000000000..4ad2ea0efa --- /dev/null +++ b/zone/gm_commands/show/zone_status.cpp @@ -0,0 +1,16 @@ +#include "../../client.h" +#include "../../worldserver.h" + +extern WorldServer worldserver; + +void ShowZoneStatus(Client *c, const Seperator *sep) +{ + auto pack = new ServerPacket(ServerOP_ZoneStatus, sizeof(ServerZoneStatus_Struct)); + + auto z = (ServerZoneStatus_Struct *) pack->pBuffer; + z->admin = c->Admin(); + strn0cpy(z->name, c->GetName(), sizeof(z->name)); + + worldserver.SendPacket(pack); + delete pack; +} diff --git a/zone/gm_commands/showskills.cpp b/zone/gm_commands/showskills.cpp deleted file mode 100755 index d70df99741..0000000000 --- a/zone/gm_commands/showskills.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "../client.h" - -void command_showskills(Client *c, const Seperator *sep) -{ - auto target = c; - if (c->GetTarget() && c->GetTarget()->IsClient()) { - target = c->GetTarget()->CastToClient(); - } - - uint32 start_skill_id = 0; - if (sep->IsNumber(1)) { - start_skill_id = Strings::ToUnsignedInt(sep->arg[1]); - } - - bool show_all = !strcasecmp(sep->arg[2], "all"); - - uint32 max_skill_id = (start_skill_id + 49); - - std::string popup_text = "
"; - - popup_text += ""; - - for ( - EQ::skills::SkillType skill_id = (EQ::skills::SkillType) start_skill_id; - skill_id <= (EQ::skills::SkillType) max_skill_id; - skill_id = (EQ::skills::SkillType) (skill_id + 1) - ) { - if ((EQ::skills::SkillType) skill_id >= EQ::skills::SkillCount) { - max_skill_id = (EQ::skills::SkillCount - 1); - break; - } - - if (show_all || (target->CanHaveSkill(skill_id) && target->MaxSkill(skill_id))) { - popup_text += fmt::format( - "", - skill_id, - EQ::skills::GetSkillName(skill_id), - target->GetSkill(skill_id), - target->MaxSkill(skill_id), - target->GetRawSkill(skill_id) - ); - } - } - - popup_text += "
IDNameCurrentMaxRaw
{}{}{}{}{}
"; - - std::string popup_title = fmt::format( - "Skills for {} [{} to {}]", - c->GetTargetDescription(target, TargetDescriptionType::UCSelf), - start_skill_id, - max_skill_id - ); - - c->SendPopupToClient( - popup_title.c_str(), - popup_text.c_str() - ); - - - c->Message( - Chat::White, - fmt::format( - "Viewing skill levels from {} ({}) to {} ({}) for {}.", - EQ::skills::GetSkillName((EQ::skills::SkillType) start_skill_id), - start_skill_id, - EQ::skills::GetSkillName((EQ::skills::SkillType) max_skill_id), - max_skill_id, - c->GetTargetDescription(target) - ).c_str() - ); - - int next_skill_id = (max_skill_id + 1); - if ((EQ::skills::SkillType) next_skill_id < EQ::skills::SkillCount) { - auto next_list_string = fmt::format( - "#showskills {}", - next_skill_id - ); - - auto next_list_link = Saylink::Silent(next_list_string, next_list_string); - - auto next_list_all_string = fmt::format( - "#showskills {} all", - next_skill_id - ); - - auto next_list_all_link = Saylink::Silent(next_list_all_string, next_list_all_string); - - c->Message( - Chat::White, - fmt::format( - "To view the next 50 skill levels, you can use {} or {} to show skills the player cannot normally have.", - next_list_link, - next_list_all_link - ).c_str() - ); - } -} - diff --git a/zone/gm_commands/showspells.cpp b/zone/gm_commands/showspells.cpp deleted file mode 100755 index 3cfbe8cd7b..0000000000 --- a/zone/gm_commands/showspells.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "../client.h" - -void command_showspells(Client *c, const Seperator *sep) -{ - const auto arguments = sep->argnum; - if (!arguments) { - c->Message(Chat::White, "Usages: #showspells disciplines - Show your or your target's learned disciplines"); - c->Message(Chat::White, "Usages: #showspells spells - Show your or your target's memorized spells"); - return; - } - - auto t = c; - if (c->GetTarget() && c->GetTarget()->IsClient()) { - t = c->GetTarget()->CastToClient(); - } - - const auto is_disciplines = !strcasecmp(sep->arg[1], "disciplines"); - const auto is_spells = !strcasecmp(sep->arg[1], "spells"); - if ( - !is_disciplines && - !is_spells - ) { - c->Message(Chat::White, "Usages: #showspells disciplines - Show your or your target's learned disciplines"); - c->Message(Chat::White, "Usages: #showspells spells - Show your or your target's memorized spells"); - } - - ShowSpellType show_spell_type; - - if (is_disciplines) { - show_spell_type = ShowSpellType::Disciplines; - } else if (is_spells) { - show_spell_type = ShowSpellType::Spells; - } - - t->ShowSpells(c, show_spell_type); -} - diff --git a/zone/gm_commands/showspellslist.cpp b/zone/gm_commands/showspellslist.cpp deleted file mode 100755 index 2b50864e6a..0000000000 --- a/zone/gm_commands/showspellslist.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "../client.h" - -void command_showspellslist(Client *c, const Seperator *sep) -{ - Mob *target = c->GetTarget(); - if (!target || !target->IsNPC()) { - c->Message(Chat::White, "You must target an NPC to use this command."); - return; - } - target->CastToNPC()->AISpellsList(c); - return; -} - diff --git a/zone/gm_commands/showzonegloballoot.cpp b/zone/gm_commands/showzonegloballoot.cpp deleted file mode 100755 index 95e364d24b..0000000000 --- a/zone/gm_commands/showzonegloballoot.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "../client.h" - -void command_showzonegloballoot(Client *c, const Seperator *sep) -{ - zone->ShowZoneGlobalLoot(c); -} - diff --git a/zone/gm_commands/spawnstatus.cpp b/zone/gm_commands/spawnstatus.cpp deleted file mode 100755 index 5b88e6c50c..0000000000 --- a/zone/gm_commands/spawnstatus.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#include "../client.h" - -void command_spawnstatus(Client *c, const Seperator *sep) -{ - int arguments = sep->argnum; - if (!arguments) { - c->Message(Chat::White, "Usage: #spawnstatus all - Show all spawn statuses for your current zone"); - c->Message(Chat::White, "Usage: #spawnstatus disabled - Show all disabled spawn statuses for your current zone"); - c->Message(Chat::White, "Usage: #spawnstatus enabled - Show all enabled spawn statuses for your current zone"); - c->Message(Chat::White, "Usage: #spawnstatus [Spawn ID] - Show spawn status by ID for your current zone"); - return; - } - - bool is_all = !strcasecmp(sep->arg[1], "all"); - bool is_disabled = !strcasecmp(sep->arg[1], "disabled"); - bool is_enabled = !strcasecmp(sep->arg[1], "enabled"); - bool is_search = sep->IsNumber(1); - - if ( - !is_all && - !is_disabled && - !is_enabled && - !is_search - ) { - c->Message(Chat::White, "Usage: #spawnstatus all - Show all spawn statuses for your current zone"); - c->Message(Chat::White, "Usage: #spawnstatus disabled - Show all disabled spawn statuses for your current zone"); - c->Message(Chat::White, "Usage: #spawnstatus enabled - Show all enabled spawn statuses for your current zone"); - c->Message(Chat::White, "Usage: #spawnstatus [Spawn ID] - Show spawn status by ID for your current zone"); - return; - } - - std::string filter_type; - if (is_disabled) { - filter_type = "Disabled"; - } else if (is_enabled) { - filter_type = "Enabled"; - } - - uint32 spawn_id = 0; - if (is_search) { - spawn_id = Strings::ToUnsignedInt(sep->arg[1]); - } - - LinkedListIterator iterator(zone->spawn2_list); - iterator.Reset(); - - uint32 filtered_count = 0; - uint32 spawn_count = 0; - uint32 spawn_number = 1; - while (iterator.MoreElements()) { - auto e = iterator.GetData(); - auto time_remaining = e->GetTimer().GetRemainingTime(); - if ( - is_all || - ( - is_disabled && - time_remaining == 0xFFFFFFFF - ) || - ( - is_enabled && - time_remaining != 0xFFFFFFFF - ) || - ( - is_search && - e->GetID() == spawn_id - ) - ) { - c->Message( - Chat::White, - fmt::format( - "Spawn {} | ID: {} Coordinates: {:.2f}, {:.2f}, {:.2f}, {:.2f}", - spawn_number, - e->GetID(), - e->GetX(), - e->GetY(), - e->GetZ(), - e->GetHeading() - ).c_str() - ); - if (time_remaining != 0xFFFFFFFF) { - auto seconds_remaining = (time_remaining / 1000); - c->Message( - Chat::White, - fmt::format( - "Spawn {} | Respawn: {} ({} Second{})", - spawn_number, - Strings::SecondsToTime(seconds_remaining), - seconds_remaining, - seconds_remaining != 1 ? "s" : "" - ).c_str() - ); - } - filtered_count++; - spawn_number++; - } - spawn_count++; - iterator.Advance(); - } - - if (!spawn_count) { - c->Message(Chat::White, "No spawns were found in this zone."); - return; - } - - if (!is_all && !is_search && !filtered_count) { - c->Message( - Chat::White, - fmt::format( - "No {} spawns were found in this zone.", - filter_type - ).c_str() - ); - return; - } - - if (is_all) { - c->Message( - Chat::White, - fmt::format( - "{} spawn{} listed.", - spawn_count, - spawn_count != 1 ? "s" : "" - ).c_str() - ); - } else { - c->Message( - Chat::White, - fmt::format( - "{} of {} spawn{} listed.", - filtered_count, - spawn_count, - spawn_count != 1 ? "s" : "" - ).c_str() - ); - } -} - diff --git a/zone/gm_commands/trapinfo.cpp b/zone/gm_commands/trapinfo.cpp deleted file mode 100755 index 6d2d8fcf1c..0000000000 --- a/zone/gm_commands/trapinfo.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "../client.h" - -void command_trapinfo(Client *c, const Seperator *sep) -{ - entity_list.GetTrapInfo(c); -} - diff --git a/zone/gm_commands/uptime.cpp b/zone/gm_commands/uptime.cpp deleted file mode 100755 index 00b247d9f6..0000000000 --- a/zone/gm_commands/uptime.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "../client.h" -#include "../worldserver.h" - -extern WorldServer worldserver; - -void command_uptime(Client *c, const Seperator *sep) -{ - if (!worldserver.Connected()) { - c->Message(Chat::White, "Error: World server disconnected"); - } - else { - auto pack = new ServerPacket(ServerOP_Uptime, sizeof(ServerUptime_Struct)); - ServerUptime_Struct *sus = (ServerUptime_Struct *) pack->pBuffer; - strcpy(sus->adminname, c->GetName()); - if (sep->IsNumber(1) && Strings::ToInt(sep->arg[1]) > 0) { - sus->zoneserverid = Strings::ToInt(sep->arg[1]); - } - worldserver.SendPacket(pack); - safe_delete(pack); - } -} - diff --git a/zone/gm_commands/version.cpp b/zone/gm_commands/version.cpp deleted file mode 100755 index cc5d0a5312..0000000000 --- a/zone/gm_commands/version.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "../client.h" - -void command_version(Client *c, const Seperator *sep) -{ - std::string popup_text = ""; - - popup_text += fmt::format("", CURRENT_VERSION); - popup_text += fmt::format("", COMPILE_DATE, COMPILE_TIME); - popup_text += fmt::format("", LAST_MODIFIED); - - popup_text += "
Version{}
Compiled{} {}
Last Modified{}
"; - - c->SendPopupToClient( - "Server Version Information", - popup_text.c_str() - ); -} - diff --git a/zone/gm_commands/viewcurrencies.cpp b/zone/gm_commands/viewcurrencies.cpp deleted file mode 100644 index e06376927f..0000000000 --- a/zone/gm_commands/viewcurrencies.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "../client.h" - -void command_viewcurrencies(Client *c, const Seperator *sep) -{ - auto t = c; - if (c->GetTarget() && c->GetTarget()->IsClient()) { - t = c->GetTarget()->CastToClient(); - } - - const auto platinum = ( - t->GetMoney(3, 0) + - t->GetMoney(3, 1) + - t->GetMoney(3, 2) + - t->GetMoney(3, 3) - ); - - const auto gold = ( - t->GetMoney(2, 0) + - t->GetMoney(2, 1) + - t->GetMoney(2, 2) - ); - - const auto silver = ( - t->GetMoney(1, 0) + - t->GetMoney(1, 1) + - t->GetMoney(1, 2) - ); - - const auto copper = ( - t->GetMoney(0, 0) + - t->GetMoney(0, 1) + - t->GetMoney(0, 2) - ); - - std::string currency_table; - - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell("Currency"), - DialogueWindow::TableCell("Amount") - ) - ); - - if ( - platinum || - gold || - silver || - copper - ) { - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell("Money"), - DialogueWindow::TableCell(Strings::Money(platinum, gold, silver, copper)) - ) - ); - } - - const auto ebon_crystals = t->GetEbonCrystals(); - if (ebon_crystals) { - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell("Ebon Crystals"), - DialogueWindow::TableCell(Strings::Commify(ebon_crystals)) - ) - ); - } - - const auto radiant_crystals = t->GetRadiantCrystals(); - if (radiant_crystals) { - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell("Radiant Crystals"), - DialogueWindow::TableCell(Strings::Commify(radiant_crystals)) - ) - ); - } - - for (const auto& a : zone->AlternateCurrencies) { - const auto currency_value = t->GetAlternateCurrencyValue(a.id); - if (currency_value) { - const auto* d = database.GetItem(a.item_id); - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell(d->Name), - DialogueWindow::TableCell(Strings::Commify(currency_value)) - ) - ); - } - } - - for (const auto& l : EQ::constants::GetLDoNThemeMap()) { - const auto ldon_currency_value = t->GetLDoNPointsTheme(l.first); - if (ldon_currency_value) { - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell(l.second), - DialogueWindow::TableCell(Strings::Commify(ldon_currency_value)) - ) - ); - } - } - - auto pvp_points = t->GetPVPPoints(); - if (pvp_points) { - currency_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell("PVP Points"), - DialogueWindow::TableCell(Strings::Commify(pvp_points)) - ) - ); - } - - currency_table = DialogueWindow::Table(currency_table); - - c->SendPopupToClient( - fmt::format( - "Currency for {}", - c->GetTargetDescription(t, TargetDescriptionType::UCSelf) - ).c_str(), - currency_table.c_str() - ); -} diff --git a/zone/gm_commands/viewnpctype.cpp b/zone/gm_commands/viewnpctype.cpp deleted file mode 100755 index 80c73bfefd..0000000000 --- a/zone/gm_commands/viewnpctype.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "../client.h" - -void command_viewnpctype(Client *c, const Seperator *sep) -{ - if (sep->IsNumber(1)) { - uint32 npc_id = Strings::ToUnsignedInt(sep->arg[1]); - const NPCType *npc_type_data = content_db.LoadNPCTypesData(npc_id); - if (npc_type_data) { - auto npc = new NPC( - npc_type_data, - nullptr, - c->GetPosition(), - GravityBehavior::Water - ); - npc->ShowStats(c); - safe_delete(npc); - } - else { - c->Message( - Chat::White, - fmt::format( - "NPC ID {} was not found.", - npc_id - ).c_str() - ); - } - } - else { - c->Message(Chat::White, "Usage: #viewnpctype [NPC ID]"); - } -} - diff --git a/zone/gm_commands/viewpetition.cpp b/zone/gm_commands/viewpetition.cpp deleted file mode 100755 index eaff518a97..0000000000 --- a/zone/gm_commands/viewpetition.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "../client.h" - -void command_viewpetition(Client *c, const Seperator *sep) -{ - if (sep->arg[1][0] == 0) { - c->Message(Chat::White, "Usage: #viewpetition (petition number) Type #listpetition for a list"); - return; - } - - c->Message(Chat::Red, " ID : Character Name , Petition Text"); - - std::string query = "SELECT petid, charname, petitiontext FROM petitions ORDER BY petid"; - auto results = database.QueryDatabase(query); - if (!results.Success()) { - return; - } - - LogInfo("View petition request from [{}], petition number: [{}]", c->GetName(), Strings::ToInt(sep->argplus[1])); - - if (results.RowCount() == 0) { - c->Message(Chat::Red, "There was an error in your request: ID not found! Please check the Id and try again."); - return; - } - - for (auto row = results.begin(); row != results.end(); ++row) - if (strcasecmp(row[0], sep->argplus[1]) == 0) { - c->Message(Chat::Yellow, " %s: %s , %s ", row[0], row[1], row[2]); - } - -} - diff --git a/zone/gm_commands/viewzoneloot.cpp b/zone/gm_commands/viewzoneloot.cpp deleted file mode 100755 index 3f48a38475..0000000000 --- a/zone/gm_commands/viewzoneloot.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "../client.h" - -void command_viewzoneloot(Client *c, const Seperator *sep) -{ - std::map zone_loot_list; - auto npc_list = entity_list.GetNPCList(); - uint32 loot_amount = 0, loot_id = 1, search_item_id = 0; - if (sep->argnum == 1 && sep->IsNumber(1)) { - search_item_id = Strings::ToInt(sep->arg[1]); - } - else if (sep->argnum == 1 && !sep->IsNumber(1)) { - c->Message( - Chat::Yellow, - "Usage: #viewzoneloot [item id]" - ); - return; - } - - for (auto npc_entity : npc_list) { - auto current_npc_item_list = npc_entity.second->GetItemList(); - zone_loot_list.insert({npc_entity.second->GetID(), current_npc_item_list}); - } - - for (auto loot_item : zone_loot_list) { - uint32 current_entity_id = loot_item.first; - auto current_item_list = loot_item.second; - auto current_npc = entity_list.GetNPCByID(current_entity_id); - std::string npc_link; - if (current_npc) { - std::string npc_name = current_npc->GetCleanName(); - uint32 instance_id = zone->GetInstanceID(); - uint32 zone_id = zone->GetZoneID(); - std::string command_link = Saylink::Silent( - fmt::format( - "#{} {} {} {} {}", - (instance_id != 0 ? "zoneinstance" : "zone"), - (instance_id != 0 ? instance_id : zone_id), - current_npc->GetX(), - current_npc->GetY(), - current_npc->GetZ() - ), - "Goto" - ); - npc_link = fmt::format( - " NPC: {} (ID {}) [{}]", - npc_name, - current_entity_id, - command_link - ); - } - - for (auto current_item : current_item_list) { - if (search_item_id == 0 || current_item->item_id == search_item_id) { - EQ::SayLinkEngine linker; - linker.SetLinkType(EQ::saylink::SayLinkLootItem); - linker.SetLootData(current_item); - c->Message( - Chat::White, - fmt::format( - "{}. {} ({}){}", - loot_id, - linker.GenerateLink(), - current_item->item_id, - npc_link - ).c_str() - ); - loot_id++; - loot_amount++; - } - } - } - - - if (search_item_id != 0) { - std::string drop_string = ( - loot_amount > 0 ? - fmt::format( - "dropping in {} {}", - loot_amount, - (loot_amount > 1 ? "places" : "place") - ) : - "not dropping" - ); - - c->Message( - Chat::White, - fmt::format( - "{} ({}) is {}.", - database.CreateItemLink(search_item_id), - search_item_id, - drop_string - ).c_str() - ); - } - else { - std::string drop_string = ( - loot_amount > 0 ? - fmt::format( - "{} {} dropping", - (loot_amount > 1 ? "items" : "item"), - (loot_amount > 1 ? "are" : "is") - ) : - "items are dropping" - ); - - c->Message( - Chat::White, - fmt::format( - "{} {}.", - loot_amount, - drop_string - ).c_str() - ); - } -} - diff --git a/zone/gm_commands/who.cpp b/zone/gm_commands/who.cpp deleted file mode 100755 index a67cc27994..0000000000 --- a/zone/gm_commands/who.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "../client.h" - -void command_who(Client *c, const Seperator *sep) -{ - std::string query = SQL( - SELECT - character_data.account_id, - character_data.name, - character_data.zone_id, - character_data.zone_instance, - COALESCE( - ( - SELECT guilds.name FROM guilds WHERE id = ( - ( - SELECT guild_id FROM guild_members WHERE char_id = character_data.id - ) - ) - ), - "" - ) AS guild_name, - character_data.level, - character_data.race, - character_data.class, - COALESCE( - ( - SELECT account.status FROM account WHERE account.id = character_data.account_id LIMIT 1 - ), - 0 - ) AS account_status, - COALESCE( - ( - SELECT account.name FROM account WHERE account.id = character_data.account_id LIMIT 1 - ), - 0 - ) AS account_name, - COALESCE( - ( - SELECT account_ip.ip FROM account_ip WHERE account_ip.accid = character_data.account_id ORDER BY account_ip.lastused DESC LIMIT 1 - ), - "" - ) AS account_ip - FROM - character_data - WHERE - last_login > (UNIX_TIMESTAMP() - 600) - ORDER BY - character_data.name; - ); - - auto results = database.QueryDatabase(query); - if (!results.Success() || !results.RowCount()) { - return; - } - - std::string search_string; - - if (sep->arg[1]) { - search_string = Strings::ToLower(sep->arg[1]); - } - - int found_count = 0; - - c->Message(Chat::Who, "Players in EverQuest:"); - c->Message(Chat::Who, "------------------------------"); - - for (auto row : results) { - auto account_id = Strings::ToUnsignedInt(row[0]); - std::string player_name = row[1]; - auto zone_id = Strings::ToUnsignedInt(row[2]); - std::string zone_short_name = ZoneName(zone_id); - std::string zone_long_name = ZoneLongName(zone_id); - auto zone_instance = Strings::ToUnsignedInt(row[3]); - std::string guild_name = row[4]; - auto player_level = Strings::ToUnsignedInt(row[5]); - auto player_race = Strings::ToUnsignedInt(row[6]); - auto player_class = Strings::ToUnsignedInt(row[7]); - auto account_status = Strings::ToUnsignedInt(row[8]); - std::string account_name = row[9]; - std::string account_ip = row[10]; - std::string base_class_name = GetClassIDName(static_cast(player_class)); - std::string displayed_race_name = GetRaceIDName(static_cast(player_race)); - - if (search_string.length()) { - bool found_search_term = ( - Strings::ToLower(player_name).find(search_string) != std::string::npos || - Strings::ToLower(zone_short_name).find(search_string) != std::string::npos || - Strings::ToLower(displayed_race_name).find(search_string) != std::string::npos || - Strings::ToLower(base_class_name).find(search_string) != std::string::npos || - Strings::ToLower(guild_name).find(search_string) != std::string::npos || - Strings::ToLower(account_name).find(search_string) != std::string::npos || - Strings::ToLower(account_ip).find(search_string) != std::string::npos - ); - - if (!found_search_term) { - continue; - } - } - - std::string displayed_guild_name; - if (guild_name.length()) { - displayed_guild_name = Saylink::Silent( - fmt::format( - "#who \"{}\"", - guild_name - ), - fmt::format( - "<{}>", - guild_name - ) - ); - } - - auto goto_saylink = Saylink::Silent( - fmt::format( - "#goto {}", - player_name - ), - "Goto" - ); - - auto summon_saylink = Saylink::Silent( - fmt::format( - "#summon {}", - player_name - ), - "Summon" - ); - - std::string display_class_name = GetClassIDName( - static_cast(player_class), - static_cast(player_level) - ); - - auto class_saylink = Saylink::Silent( - fmt::format( - "#who {}", - base_class_name - ), - display_class_name - ); - - auto race_saylink = Saylink::Silent( - fmt::format( - "#who %s", - displayed_race_name - ), - displayed_race_name - ); - - auto zone_saylink = Saylink::Silent( - fmt::format( - "#who {}", - zone_short_name - ), - zone_long_name - ); - - auto account_saylink = Saylink::Silent( - fmt::format( - "#who {}", - account_name - ), - account_name - ); - - auto account_ip_saylink = Saylink::Silent( - fmt::format( - "#who {}", - account_ip - ), - account_ip - ); - - auto status_level = ( - account_status ? - fmt::format( - "* {} * ", - EQ::constants::GetAccountStatusName(account_status) - ) : - "" - ); - - auto version_string = ( - zone_instance ? - fmt::format( - " ({})", - zone_instance - ) : - "" - ); - - c->Message( - Chat::Who, - fmt::format( - "{}[{} {} ({})] {} ({}) ({}) ({}) {} ZONE: {}{} ({} | {})", - status_level, - player_level, - class_saylink, - base_class_name, - player_name, - race_saylink, - account_saylink, - account_ip_saylink, - displayed_guild_name, - zone_saylink, - version_string, - goto_saylink, - summon_saylink - ).c_str() - ); - - found_count++; - } - - std::string count_string = found_count == 1 ? "is" : "are"; - - std::string message = ( - found_count ? - fmt::format( - "There {} {} player{} in EverQuest.", - count_string, - found_count, - found_count > 1 ? "s" : "" - ) : - "There are no players in EverQuest that match those filters." - ); - - c->Message( - Chat::Who, - message.c_str() - ); -} - diff --git a/zone/gm_commands/zonestatus.cpp b/zone/gm_commands/zonestatus.cpp deleted file mode 100755 index 51c5f763eb..0000000000 --- a/zone/gm_commands/zonestatus.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "../client.h" -#include "../worldserver.h" - -extern WorldServer worldserver; - -void command_zonestatus(Client *c, const Seperator *sep) -{ - if (!worldserver.Connected()) { - c->Message(Chat::White, "Error: World server disconnected"); - } - else { - auto pack = new ServerPacket(ServerOP_ZoneStatus, strlen(c->GetName()) + 2); - memset(pack->pBuffer, (uint8) c->Admin(), 1); - strcpy((char *) &pack->pBuffer[1], c->GetName()); - worldserver.SendPacket(pack); - delete pack; - } -} - diff --git a/zone/gm_commands/zstats.cpp b/zone/gm_commands/zstats.cpp deleted file mode 100755 index ab9c65ec95..0000000000 --- a/zone/gm_commands/zstats.cpp +++ /dev/null @@ -1,205 +0,0 @@ -#include "../client.h" - -void command_zstats(Client *c, const Seperator *sep) -{ - // Zone - c->Message( - Chat::White, - fmt::format( - "Zone | {}", - zone->GetZoneDescription() - ).c_str() - ); - - // Type - c->Message( - Chat::White, - fmt::format( - "Type: {}", - zone->newzone_data.ztype - ).c_str() - ); - - // Fog Data - for (int fog_index = 0; fog_index < 4; fog_index++) { - int fog_number = (fog_index + 1); - c->Message( - Chat::White, - fmt::format( - "Fog {} Colors | Red: {} Blue: {} Green: {} ", - fog_number, - zone->newzone_data.fog_red[fog_index], - zone->newzone_data.fog_green[fog_index], - zone->newzone_data.fog_blue[fog_index] - ).c_str() - ); - - c->Message( - Chat::White, - fmt::format( - "Fog {} Clipping Distance | Min: {} Max: {}", - fog_number, - zone->newzone_data.fog_minclip[fog_index], - zone->newzone_data.fog_maxclip[fog_index] - ).c_str() - ); - } - - // Fog Density - c->Message( - Chat::White, - fmt::format( - "Fog Density: {}", - zone->newzone_data.fog_density - ).c_str() - ); - - - // Gravity - c->Message( - Chat::White, - fmt::format( - "Gravity: {}", - zone->newzone_data.gravity - ).c_str() - ); - - // Time Type - c->Message( - Chat::White, - fmt::format( - "Time Type: {}", - zone->newzone_data.time_type - ).c_str() - ); - - // Experience Multiplier - c->Message( - Chat::White, - fmt::format( - "Experience Multiplier: {}", - zone->newzone_data.zone_exp_multiplier - ).c_str() - ); - - // Safe Coordinates - c->Message( - Chat::White, - fmt::format( - "Safe Coordinates: {}, {}, {}", - zone->newzone_data.safe_x, - zone->newzone_data.safe_y, - zone->newzone_data.safe_z - ).c_str() - ); - - // Max Z - c->Message( - Chat::White, - fmt::format( - "Max Z: {}", - zone->newzone_data.max_z - ).c_str() - ); - - // Underworld Z - c->Message( - Chat::White, - fmt::format( - "Underworld Z: {}", - zone->newzone_data.underworld - ).c_str() - ); - - // Clipping Distance - c->Message( - Chat::White, - fmt::format( - "Clipping Distance | Min: {} Max: {}", - zone->newzone_data.minclip, - zone->newzone_data.maxclip - ).c_str() - ); - - // Weather Data - for (int weather_index = 0; weather_index < 4; weather_index++) { - int weather_number = (weather_index + 1); - c->Message( - Chat::White, - fmt::format( - "Rain {} | Chance: {} Duration: {} ", - weather_number, - zone->newzone_data.rain_chance[weather_index], - zone->newzone_data.rain_duration[weather_index] - ).c_str() - ); - - c->Message( - Chat::White, - fmt::format( - "Snow {} | Chance: {} Duration: {}", - weather_number, - zone->newzone_data.snow_chance[weather_index], - zone->newzone_data.snow_duration[weather_index] - ).c_str() - ); - } - - // Sky Type - c->Message( - Chat::White, - fmt::format( - "Sky Type: {}", - zone->newzone_data.sky - ).c_str() - ); - - // Suspend Buffs - c->Message( - Chat::White, - fmt::format( - "Suspend Buffs: {}", - zone->newzone_data.suspend_buffs - ).c_str() - ); - - // Regeneration Data - c->Message( - Chat::White, - fmt::format( - "Regen | Health: {} Mana: {} Endurance: {}", - zone->newzone_data.fast_regen_hp, - zone->newzone_data.fast_regen_mana, - zone->newzone_data.fast_regen_endurance - ).c_str() - ); - - // NPC Max Aggro Distance - c->Message( - Chat::White, - fmt::format( - "NPC Max Aggro Distance: {}", - zone->newzone_data.npc_aggro_max_dist - ).c_str() - ); - - // Underworld Teleport Index - c->Message( - Chat::White, - fmt::format( - "Underworld Teleport Index: {}", - zone->newzone_data.underworld_teleport_index - ).c_str() - ); - - // Lava Damage - c->Message( - Chat::White, - fmt::format( - "Lava Damage | Min: {} Max: {}", - zone->newzone_data.min_lava_damage, - zone->newzone_data.lava_damage - ).c_str() - ); -} - diff --git a/zone/mob.cpp b/zone/mob.cpp index 5621c2703c..8aa0a71a77 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1793,15 +1793,12 @@ void Mob::SendStatsWindow(Client* c, bool use_window) } regen_string += DialogueWindow::TableRow( - fmt::format( - "{}{}{}{}{}{}", - DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, regen_row_header)), - DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, base_regen_field)), - DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, fmt::format("{} ({})", item_regen_field, cap_regen_field))), - DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, spell_regen_field)), - DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, aa_regen_field)), - DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, total_regen_field)) - ) + DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, regen_row_header)) + + DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, base_regen_field)) + + DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, fmt::format("{} ({})", item_regen_field, cap_regen_field))) + + DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, spell_regen_field)) + + DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, aa_regen_field)) + + DialogueWindow::TableCell(DialogueWindow::ColorMessage(regen_row_color, total_regen_field)) ); } @@ -1907,23 +1904,20 @@ void Mob::SendStatsWindow(Client* c, bool use_window) } stat_table += DialogueWindow::TableRow( - fmt::format( - "{}{}{}{}", - DialogueWindow::TableCell(a_stat_name), - DialogueWindow::TableCell( - fmt::format( - "{} {}", - a_stat, - DialogueWindow::ColorMessage(heroic_color, fmt::format("+{}", h_stat)) - ) - ), - DialogueWindow::TableCell(a_resist_name), - DialogueWindow::TableCell( - fmt::format( - "{} {}", - a_resist, - DialogueWindow::ColorMessage(heroic_color, fmt::format("+{}", h_resist_field)) - ) + DialogueWindow::TableCell(a_stat_name) + + DialogueWindow::TableCell( + fmt::format( + "{} {}", + a_stat, + DialogueWindow::ColorMessage(heroic_color, fmt::format("+{}", h_stat)) + ) + ) + + DialogueWindow::TableCell(a_resist_name) + + DialogueWindow::TableCell( + fmt::format( + "{} {}", + a_resist, + DialogueWindow::ColorMessage(heroic_color, fmt::format("+{}", h_resist_field)) ) ) ); @@ -2026,23 +2020,20 @@ void Mob::SendStatsWindow(Client* c, bool use_window) } mod2_table += DialogueWindow::TableRow( - fmt::format( - "{}{}", - DialogueWindow::TableCell( - fmt::format( - "{}: {} / {}", - mod2a_name, - Strings::Commify(mod2a), - Strings::Commify(mod2a_cap) - ) - ), - DialogueWindow::TableCell( - fmt::format( - "{}: {} / {}", - mod2b_name, - Strings::Commify(mod2b), - Strings::Commify(mod2b_cap) - ) + DialogueWindow::TableCell( + fmt::format( + "{}: {} / {}", + mod2a_name, + Strings::Commify(mod2a), + Strings::Commify(mod2a_cap) + ) + ) + + DialogueWindow::TableCell( + fmt::format( + "{}: {} / {}", + mod2b_name, + Strings::Commify(mod2b), + Strings::Commify(mod2b_cap) ) ) ); @@ -2208,12 +2199,9 @@ void Mob::SendStatsWindow(Client* c, bool use_window) // Class, Level, and Race final_string += DialogueWindow::Table( DialogueWindow::TableRow( - fmt::format( - "{}{}{}", - DialogueWindow::TableCell(fmt::format("Race: {}", GetPlayerRaceAbbreviation(GetBaseRace()))), - DialogueWindow::TableCell(fmt::format("Class: {}", GetPlayerClassAbbreviation(GetClass()))), - DialogueWindow::TableCell(fmt::format("Level: {}", std::to_string(GetLevel()))) - ) + DialogueWindow::TableCell(fmt::format("Race: {}", GetPlayerRaceAbbreviation(GetBaseRace()))) + + DialogueWindow::TableCell(fmt::format("Class: {}", GetPlayerClassAbbreviation(GetClass()))) + + DialogueWindow::TableCell(fmt::format("Level: {}", std::to_string(GetLevel()))) ) ); @@ -2221,15 +2209,12 @@ void Mob::SendStatsWindow(Client* c, bool use_window) if (rune_number || magic_rune_number) { final_string += DialogueWindow::Table( DialogueWindow::TableRow( - fmt::format( - "{}{}{}", - DialogueWindow::TableCell( - fmt::format("Rune: {}", rune_number) - ), - DialogueWindow::TableCell(""), - DialogueWindow::TableCell( - fmt::format("Spell Rune: {}", magic_rune_number) - ) + DialogueWindow::TableCell( + fmt::format("Rune: {}", rune_number) + ) + + DialogueWindow::TableCell("") + + DialogueWindow::TableCell( + fmt::format("Spell Rune: {}", magic_rune_number) ) ) ); @@ -2313,21 +2298,21 @@ void Mob::SendStatsWindow(Client* c, bool use_window) fmt::format( "{}{}", DialogueWindow::TableRow( - fmt::format( - "{}{}{}{}", - DialogueWindow::TableCell("Item"), - DialogueWindow::TableCell("Spell"), - DialogueWindow::TableCell("Over"), - DialogueWindow::TableCell("Total (Cap)") - ) + DialogueWindow::TableCell("Item") + + DialogueWindow::TableCell("Spell") + + DialogueWindow::TableCell("Over") + + DialogueWindow::TableCell("Total (Cap)") ), DialogueWindow::TableRow( - fmt::format( - "{}{}{}{}", - DialogueWindow::TableCell(Strings::Commify(itembonuses.haste)), - DialogueWindow::TableCell(Strings::Commify(spellbonuses.haste + spellbonuses.hastetype2)), - DialogueWindow::TableCell(Strings::Commify(spellbonuses.hastetype3 + ExtraHaste)), - DialogueWindow::TableCell(fmt::format("{} ({})", Strings::Commify(GetHaste()), Strings::Commify(RuleI(Character, HasteCap)))) + DialogueWindow::TableCell(Strings::Commify(itembonuses.haste)) + + DialogueWindow::TableCell(Strings::Commify(spellbonuses.haste + spellbonuses.hastetype2)) + + DialogueWindow::TableCell(Strings::Commify(spellbonuses.hastetype3 + ExtraHaste)) + + DialogueWindow::TableCell( + fmt::format( + "{} ({})", + Strings::Commify(GetHaste()), + Strings::Commify(RuleI(Character, HasteCap)) + ) ) ) ) @@ -2339,21 +2324,15 @@ void Mob::SendStatsWindow(Client* c, bool use_window) final_string += DialogueWindow::CenterMessage("Regen"); const auto& regen_table = DialogueWindow::Table( - fmt::format( - "{}{}", - DialogueWindow::TableRow( - fmt::format( - "{}{}{}{}{}{}", - DialogueWindow::TableCell("Type"), - DialogueWindow::TableCell("Base"), - DialogueWindow::TableCell("Items (Cap)"), - DialogueWindow::TableCell("Spell"), - DialogueWindow::TableCell("AAs"), - DialogueWindow::TableCell("Total") - ) - ), - regen_string - ) + DialogueWindow::TableRow( + DialogueWindow::TableCell("Type") + + DialogueWindow::TableCell("Base") + + DialogueWindow::TableCell("Items (Cap)") + + DialogueWindow::TableCell("Spell") + + DialogueWindow::TableCell("AAs") + + DialogueWindow::TableCell("Total") + ) + + regen_string ); // Regen diff --git a/zone/trap.cpp b/zone/trap.cpp index 0c447a2d20..cb2fe23637 100644 --- a/zone/trap.cpp +++ b/zone/trap.cpp @@ -360,17 +360,17 @@ void EntityList::UpdateAllTraps(bool respawn, bool repopnow) Log(Logs::General, Logs::Traps, "All traps updated."); } -void EntityList::GetTrapInfo(Client* client) +void EntityList::GetTrapInfo(Client* c) { - uint32 trap_count = 0; + uint32 trap_count = 0; uint32 trap_number = 1; for (const auto& trap : trap_list) { auto t = trap.second; if (t->IsTrap()) { - bool is_set = (t->chkarea_timer.Enabled() && !t->reset_timer.Enabled()); + const bool is_set = (t->chkarea_timer.Enabled() && !t->reset_timer.Enabled()); - client->Message( + c->Message( Chat::White, fmt::format( "Trap {} | ID: {} Active: {} Coordinates: {:.2f}, {:.2f}, {:.2f}", @@ -383,7 +383,7 @@ void EntityList::GetTrapInfo(Client* client) ).c_str() ); - client->Message( + c->Message( Chat::White, fmt::format( "Trap {} | Times Triggered: {} Group: {}", @@ -394,7 +394,7 @@ void EntityList::GetTrapInfo(Client* client) ); if (!t->message.empty()) { - client->Message( + c->Message( Chat::White, fmt::format( "Trap {} | Message: {}", @@ -410,14 +410,14 @@ void EntityList::GetTrapInfo(Client* client) } if (!trap_count) { - client->Message(Chat::White, "No traps were found in this zone."); + c->Message(Chat::White, "No traps were found."); return; } - client->Message( + c->Message( Chat::White, fmt::format( - "{} trap{} found.", + "{} Trap{} found.", trap_count, trap_count != 1 ? "s" : "" ).c_str() diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 1f9375ef10..6c59d14ff6 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -1023,8 +1023,8 @@ void Client::SendZoneFlagInfo(Client *to) const { to->Message( Chat::White, fmt::format( - "{} {} no Zone Flags.", - to == this ? "You" : GetName(), + "{} {} no zone flags.", + to->GetTargetDescription(const_cast(CastToMob()), TargetDescriptionType::UCYou), to == this ? "have" : "has" ).c_str() ); @@ -1034,32 +1034,29 @@ void Client::SendZoneFlagInfo(Client *to) const { to->Message( Chat::White, fmt::format( - "{} {} the following Zone Flags:", - to == this ? "You" : GetName(), + "{} {} the following zone flags:", + to->GetTargetDescription(const_cast(CastToMob()), TargetDescriptionType::UCYou), to == this ? "have" : "has" ).c_str() ); - int flag_count = 0; + uint32 flag_count = 0; + for (const auto& zone_id : zone_flags) { - int flag_number = (flag_count + 1); - const char* zone_short_name = ZoneName(zone_id, true); - if (strncmp(zone_short_name, "UNKNOWN", strlen(zone_short_name)) != 0) { - std::string zone_long_name = ZoneLongName(zone_id); - std::string flag_name = "ERROR"; + const uint32 flag_number = (flag_count + 1); - auto z = GetZone(zone_id); - if (z) { - flag_name = z->flag_needed; - } + const auto& z = GetZone(zone_id); + + if (z) { + const std::string& flag_name = z->flag_needed; to->Message( Chat::White, fmt::format( - "Flag {} | Zone: {} ({}) ID: {}", + "Flag {} | Zone: {} ({}) ID: {}{}", flag_number, - zone_long_name, - zone_short_name, + z->long_name, + z->short_name, zone_id, ( !flag_name.empty() ? @@ -1078,10 +1075,10 @@ void Client::SendZoneFlagInfo(Client *to) const { to->Message( Chat::White, fmt::format( - "{} {} {} Zone Flags.", - to == this ? "You" : GetName(), - to == this ? "have" : "has", - flag_count + "{} Zone flag{} found for {}.", + flag_count, + flag_count != 1 ? "s" : "", + to->GetTargetDescription(const_cast(CastToMob())) ).c_str() ); }