diff options
Diffstat (limited to 'src/map/atcommand.cpp')
-rw-r--r-- | src/map/atcommand.cpp | 1894 |
1 files changed, 948 insertions, 946 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 240df8b..11f6eb1 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -20,10 +20,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -#include <cmath> -#include <cstring> #include <ctime> +#include <algorithm> + #include "../conf/version.hpp" #include "../compat/nullpo.hpp" @@ -35,19 +35,23 @@ #include "../strings/xstring.hpp" #include "../strings/vstring.hpp" +#include "../generic/db.hpp" #include "../generic/random.hpp" #include "../io/cxxstdio.hpp" #include "../io/read.hpp" #include "../io/write.hpp" +#include "../net/socket.hpp" +#include "../net/timer.hpp" + #include "../mmo/config_parse.hpp" #include "../mmo/core.hpp" #include "../mmo/extract.hpp" #include "../mmo/human_time_diff.hpp" +#include "../mmo/ids.hpp" #include "../mmo/mmo.hpp" -#include "../mmo/socket.hpp" -#include "../mmo/timer.hpp" +#include "../mmo/utils.hpp" #include "../mmo/version.hpp" #include "battle.hpp" @@ -60,7 +64,6 @@ #include "npc.hpp" #include "party.hpp" #include "pc.hpp" -#include "script.hpp" #include "skill.hpp" #include "storage.hpp" #include "tmw.hpp" @@ -69,6 +72,8 @@ #include "../poison.hpp" +namespace tmwa +{ enum class ATCE { OKAY, @@ -81,12 +86,12 @@ enum class ATCE struct AtCommandInfo { ZString args; - int level; + GmLevel level; ATCE (*proc)(Session *s, dumb_ptr<map_session_data> sd, ZString message); ZString help; - AtCommandInfo(ZString a, int l, ATCE (*p)(Session *s, dumb_ptr<map_session_data>, ZString), ZString h) - : args(a), level(l), proc(p), help(h) + AtCommandInfo(ZString a, uint32_t l, ATCE (*p)(Session *s, dumb_ptr<map_session_data>, ZString), ZString h) + : args(a), level(GmLevel::from(l)), proc(p), help(h) {} }; @@ -121,23 +126,23 @@ void atcommand_config_write(ZString cfgName) if (!out.is_open()) { - FPRINTF(stderr, "Failed to write atcommand config: %s\n", cfgName); + FPRINTF(stderr, "Failed to write atcommand config: %s\n"_fmt, cfgName); return; } - FPRINTF(out, "// Generated by %s\n", CURRENT_VERSION_STRING); + FPRINTF(out, "// Generated by %s\n"_fmt, CURRENT_VERSION_STRING); for (const auto& pair : atcommand_info) { // This XString is really a ZString, but not declared as one // in order to allow non-heterogenous lookup by XString. - const char *cmd = &*pair.first.begin(); + auto cmd = ZString(strings::really_construct_from_a_pointer, &*pair.first.begin(), nullptr); const AtCommandInfo& info = pair.second; FPRINTF(out, "\n" "// %s\n" "// Usage: @%s %s\n" - "%s: %d\n", + "%s: %d\n"_fmt, info.help, cmd, info.args, cmd, info.level); @@ -198,8 +203,8 @@ void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd) stamp_time(tmpstr); MapName map = (sd->bl_m ? sd->bl_m->name_ - : stringish<MapName>("undefined.gat")); - FPRINTF(*fp, "[%s] %s(%d,%d) %s(%d) : %s\n", + : stringish<MapName>("undefined.gat"_s)); + FPRINTF(*fp, "[%s] %s(%d,%d) %s(%d) : %s\n"_fmt, tmpstr, map, sd->bl_x, sd->bl_y, sd->status_key.name, sd->status_key.account_id, @@ -211,7 +216,7 @@ AString gm_log; io::AppendFile *get_gm_log() { if (!gm_log) - return NULL; + return nullptr; struct tm ctime = TimeT::now(); @@ -225,7 +230,7 @@ io::AppendFile *get_gm_log() return gm_logfile.get(); last_logfile_nr = logfile_nr; - AString fullname = STRPRINTF("%s.%04d-%02d", + AString fullname = STRPRINTF("%s.%04d-%02d"_fmt, gm_log, year, month); if (gm_logfile) @@ -242,7 +247,7 @@ io::AppendFile *get_gm_log() } bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd, - ZString message, int gmlvl) + ZString message, GmLevel gmlvl) { nullpo_retr(false, sd); @@ -259,22 +264,22 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd, gmlvl = pc_isGM(sd); if (battle_config.atcommand_gm_only != 0 && !gmlvl) { - AString output = STRPRINTF("GM command is level 0, but this server disables level 0 commands: %s", + AString output = STRPRINTF("GM command is level 0, but this server disables level 0 commands: %s"_fmt, AString(command)); clif_displaymessage(s, output); return true; } if (!info) { - AString output = STRPRINTF("GM command not found: %s", + AString output = STRPRINTF("GM command not found: %s"_fmt, AString(command)); clif_displaymessage(s, output); return true; // don't show in chat } - if (info->level > gmlvl) + if (!(gmlvl.satisfies(info->level))) { - AString output = STRPRINTF("GM command is level %d, but you are level %d: %s", + AString output = STRPRINTF("GM command is level %d, but you are level %d: %s"_fmt, info->level, gmlvl, AString(command)); clif_displaymessage(s, output); @@ -292,17 +297,17 @@ bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd, log_atcommand(sd, message); break; case ATCE::USAGE: - clif_displaymessage(s, "Command failed: usage error"); - clif_displaymessage(s, STRPRINTF("Usage: %s %s", AString(command), info->args)); + clif_displaymessage(s, "Command failed: usage error"_s); + clif_displaymessage(s, STRPRINTF("Usage: %s %s"_fmt, AString(command), info->args)); break; case ATCE::EXIST: - clif_displaymessage(s, "Command failed: something does not exist (or already exists)"); + clif_displaymessage(s, "Command failed: something does not exist (or already exists)"_s); break; case ATCE::RANGE: - clif_displaymessage(s, "Command failed: value out of range"); + clif_displaymessage(s, "Command failed: value out of range"_s); break; case ATCE::PERM: - clif_displaymessage(s, "Command failed: permission denied"); + clif_displaymessage(s, "Command failed: permission denied"_s); break; default: abort(); @@ -331,7 +336,7 @@ void atkillmonster_sub(dumb_ptr<block_list> bl, int flag) dumb_ptr<mob_data> md = bl->is_mob(); if (flag) - mob_damage(NULL, md, md->hp, 2); + mob_damage(nullptr, md, md->hp, 2); else mob_delete(md); } @@ -347,7 +352,7 @@ bool atcommand_config_read(ZString cfgName) io::ReadFile in(cfgName); if (!in.is_open()) { - PRINTF("At commands configuration file not found: %s\n", cfgName); + PRINTF("At commands configuration file not found: %s\n"_fmt, cfgName); return false; } @@ -361,24 +366,20 @@ bool atcommand_config_read(ZString cfgName) ZString w2; if (!config_split(line, &w1, &w2)) { - PRINTF("Bad config line: %s\n", line); + PRINTF("Bad config line: %s\n"_fmt, line); rv = false; continue; } AtCommandInfo *p = get_atcommandinfo_byname(w1); - if (p != NULL) + if (p != nullptr) { - p->level = atoi(w2.c_str()); - if (p->level > 100) - p->level = 100; - else if (p->level < 0) - p->level = 0; + p->level = GmLevel::from(static_cast<uint32_t>(atoi(w2.c_str()))); } - else if (w1 == "import") + else if (w1 == "import"_s) rv &= atcommand_config_read(w2); else { - PRINTF("%s: bad line: %s\n", cfgName, line); + PRINTF("%s: bad line: %s\n"_fmt, cfgName, line); rv = false; } } @@ -389,14 +390,16 @@ bool atcommand_config_read(ZString cfgName) /// @ command processing functions static -void atc_do_help(Session *s, const char *cmd, const AtCommandInfo& info) +void atc_do_help(Session *s, ZString cmd, const AtCommandInfo& info) { - auto msg = STRPRINTF("\u2007\u2007%d: @%s %s", info.level, cmd, info.args); + // TODO convert to hex or something + uint32_t level = info.level.get_all_bits(); + auto msg = STRPRINTF("\u2007\u2007%d: @%s %s"_fmt, info.level, cmd, info.args); // manually padding because *space* size_t ll = 1; - if (info.level >= 10) + if (level >= 10) ++ll; - if (info.level >= 100) + if (level >= 100) ++ll; clif_displaymessage(s, msg.xslice_t((ll - 1) * 3)); } @@ -407,9 +410,9 @@ ATCE atcommand_help(Session *s, dumb_ptr<map_session_data>, { if (!message) { - clif_displaymessage(s, "There is too much help to display it all at once"); - clif_displaymessage(s, "Try @help <@command> or @help <category> or @help <level[-level]>"); - clif_displaymessage(s, "Right now the only category is 'all'"); + clif_displaymessage(s, "There is too much help to display it all at once"_s); + clif_displaymessage(s, "Try @help <@command> or @help <category> or @help <level[-level]>"_s); + clif_displaymessage(s, "Right now the only category is 'all'"_s); return ATCE::OKAY; } @@ -419,37 +422,51 @@ ATCE atcommand_help(Session *s, dumb_ptr<map_session_data>, const AtCommandInfo *info = atcommand_info.search(cmd); if (!info) return ATCE::EXIST; - clif_displaymessage(s, STRPRINTF("Usage: @%s %s", cmd, info->args)); + clif_displaymessage(s, STRPRINTF("Usage: @%s %s"_fmt, cmd, info->args)); clif_displaymessage(s, info->help); return ATCE::OKAY; } - if (message == "all") + if (message == "all"_s) { - clif_displaymessage(s, "Synopses of GM commands in category 'all':"); + clif_displaymessage(s, "Synopses of GM commands in category 'all':"_s); for (const auto& pair : atcommand_info) { - const char *cmd = &*pair.first.begin(); + auto cmd = ZString(strings::really_construct_from_a_pointer, &*pair.first.begin(), nullptr); const AtCommandInfo& info = pair.second; atc_do_help(s, cmd, info); } return ATCE::OKAY; } - int low = 0, high; + // previous logic is silly + // + // @help N: list all commands available at level N + // @help M-N: list all commands available at level N that were not at level M + GmLevel low, high; + bool pass; if (extract(message, &high)) - ++high; - else if (!extract(message, record<'-'>(&low, &high))) + { + pass = true; + } + else if (extract(message, record<'-'>(&low, &high))) + { + pass = false; + } + else return ATCE::USAGE; - if (low < 0 || high > 100 || low >= high) + if (low.obsoletes(high)) return ATCE::RANGE; - clif_displaymessage(s, STRPRINTF("Synopses of GM commands in level [%d, %d):", low, high)); + if (pass) + clif_displaymessage(s, STRPRINTF("Synopses of GM commands available at level %u:"_fmt, high)); + else + clif_displaymessage(s, STRPRINTF("Synopses of GM commands available at level %u, but not at level %u:"_fmt, high, low)); for (const auto& pair : atcommand_info) { - const char *cmd = &*pair.first.begin(); + auto cmd = ZString(strings::really_construct_from_a_pointer, &*pair.first.begin(), nullptr); const AtCommandInfo& info = pair.second; - if (low <= info.level && info.level < high) + if ((!low.satisfies(info.level) || pass) && high.satisfies(info.level)) atc_do_help(s, cmd, info); } return ATCE::OKAY; @@ -467,25 +484,25 @@ ATCE atcommand_setup(Session *s, dumb_ptr<map_session_data> sd, level--; AString buf; - buf = STRPRINTF("-255 %s", character); + buf = STRPRINTF("-255 %s"_fmt, character); atcommand_character_baselevel(s, sd, buf); - buf = STRPRINTF("%d %s", level, character); + buf = STRPRINTF("%d %s"_fmt, level, character); atcommand_character_baselevel(s, sd, buf); // Emote skill - buf = STRPRINTF("1 1 %s", character); + buf = STRPRINTF("1 1 %s"_fmt, character); atcommand_skill_learn(s, sd, buf); // Trade skill - buf = STRPRINTF("2 1 %s", character); + buf = STRPRINTF("2 1 %s"_fmt, character); atcommand_skill_learn(s, sd, buf); // Party skill - STRPRINTF("2 2 %s", character); + STRPRINTF("2 2 %s"_fmt, character); atcommand_skill_learn(s, sd, buf); - STRPRINTF("018-1.gat 24 98 %s", character); + STRPRINTF("018-1.gat 24 98 %s"_fmt, character); atcommand_charwarp(s, sd, buf); return ATCE::OKAY; @@ -510,52 +527,52 @@ ATCE atcommand_charwarp(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); if (pl_sd) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can rura+ only lower or same GM level if (x > 0 && x < 800 && y > 0 && y < 800) { map_local *m = map_mapname2mapid(map_name); if (m != nullptr && m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level)))) { clif_displaymessage(s, - "You are not authorised to warp someone to this map."); + "You are not authorised to warp someone to this map."_s); return ATCE::PERM; } if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp this player from its actual map."); + "You are not authorised to warp this player from its actual map."_s); return ATCE::PERM; } if (pc_setpos(pl_sd, map_name, x, y, BeingRemoveWhy::WARPED) == 0) { - clif_displaymessage(pl_sd->sess, "Warped."); - clif_displaymessage(s, "Player warped (message sends to player too)."); + clif_displaymessage(pl_sd->sess, "Warped."_s); + clif_displaymessage(s, "Player warped (message sends to player too)."_s); } else { - clif_displaymessage(s, "Map not found."); + clif_displaymessage(s, "Map not found."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "Coordinates out of range."); + clif_displaymessage(s, "Coordinates out of range."_s); return ATCE::RANGE; } } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -573,7 +590,7 @@ ATCE atcommand_warp(Session *s, dumb_ptr<map_session_data> sd, || !extract(message, record<' ', 1>(&map_name, &x, &y))) { clif_displaymessage(s, - "Please, enter a map (usage: @warp <mapname> <x> <y>)."); + "Please, enter a map (usage: @warp <mapname> <x> <y>)."_s); return ATCE::USAGE; } @@ -586,30 +603,30 @@ ATCE atcommand_warp(Session *s, dumb_ptr<map_session_data> sd, { map_local *m = map_mapname2mapid(map_name); if (m != nullptr && m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you to this map."); + "You are not authorised to warp you to this map."_s); return ATCE::PERM; } if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you from your actual map."); + "You are not authorised to warp you from your actual map."_s); return ATCE::PERM; } if (pc_setpos(sd, map_name, x, y, BeingRemoveWhy::WARPED) == 0) - clif_displaymessage(s, "Warped."); + clif_displaymessage(s, "Warped."_s); else { - clif_displaymessage(s, "Map not found."); + clif_displaymessage(s, "Map not found."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "Coordinates out of range."); + clif_displaymessage(s, "Coordinates out of range."_s); return ATCE::RANGE; } @@ -624,20 +641,20 @@ ATCE atcommand_where(Session *s, dumb_ptr<map_session_data> sd, extract(message, &character); dumb_ptr<map_session_data> pl_sd = character.to__actual() ? map_nick2sd(character) : sd; - if (pl_sd != NULL && + if (pl_sd != nullptr && !((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) - && (pc_isGM(pl_sd) > pc_isGM(sd)))) + && !(pc_isGM(sd).detects(pc_isGM(pl_sd))))) { // you can look only lower or same level - AString output = STRPRINTF("%s: %s (%d,%d)", + AString output = STRPRINTF("%s: %s (%d,%d)"_fmt, pl_sd->status_key.name, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -653,34 +670,34 @@ ATCE atcommand_goto(Session *s, dumb_ptr<map_session_data> sd, if (!asplit(message, &character)) { clif_displaymessage(s, - "Please, enter a player name (usage: @jumpto/@warpto/@goto <char name>)."); + "Please, enter a player name (usage: @jumpto/@warpto/@goto <char name>)."_s); return ATCE::USAGE; } dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you to the map of this player."); + "You are not authorised to warp you to the map of this player."_s); return ATCE::PERM; } if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you from your actual map."); + "You are not authorised to warp you from your actual map."_s); return ATCE::PERM; } pc_setpos(sd, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED); - AString output = STRPRINTF("Jump to %s", character); + AString output = STRPRINTF("Jump to %s"_fmt, character); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -702,26 +719,26 @@ ATCE atcommand_jump(Session *s, dumb_ptr<map_session_data> sd, if (x > 0 && x < 800 && y > 0 && y < 800) { if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you to your actual map."); + "You are not authorised to warp you to your actual map."_s); return ATCE::PERM; } if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you from your actual map."); + "You are not authorised to warp you from your actual map."_s); return ATCE::PERM; } pc_setpos(sd, sd->mapname_, x, y, BeingRemoveWhy::WARPED); - AString output = STRPRINTF("Jump to %d %d", x, y); + AString output = STRPRINTF("Jump to %d %d"_fmt, x, y); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Coordinates out of range."); + clif_displaymessage(s, "Coordinates out of range."_s); return ATCE::RANGE; } @@ -733,12 +750,11 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd, ZString message) { int count; - int pl_GM_level, GM_level; VString<23> match_text = message; match_text = match_text.to_lower(); count = 0; - GM_level = pc_isGM(sd); + GmLevel gm_level = pc_isGM(sd); for (io::FD i : iter_fds()) { Session *s2 = get_session(i); @@ -747,11 +763,11 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); + GmLevel pl_gm_level = pc_isGM(pl_sd); if (! ((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) - && (pl_GM_level > GM_level))) + && !(gm_level.detects(pl_gm_level)))) { // you can look only lower or same level VString<23> player_name = pl_sd->status_key.name.to__lower(); @@ -759,14 +775,14 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd, { // search with no case sensitive AString output; - if (pl_GM_level > 0) + if (pl_gm_level) output = STRPRINTF( - "Name: %s (GM:%d) | Location: %s %d %d", - pl_sd->status_key.name, pl_GM_level, + "Name: %s (GM:%u) | Location: %s %d %d"_fmt, + pl_sd->status_key.name, pl_gm_level, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); else output = STRPRINTF( - "Name: %s | Location: %s %d %d", + "Name: %s | Location: %s %d %d"_fmt, pl_sd->status_key.name, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(s, output); @@ -777,12 +793,12 @@ ATCE atcommand_who(Session *s, dumb_ptr<map_session_data> sd, } if (count == 0) - clif_displaymessage(s, "No player found."); + clif_displaymessage(s, "No player found."_s); else if (count == 1) - clif_displaymessage(s, "1 player found."); + clif_displaymessage(s, "1 player found."_s); else { - AString output = STRPRINTF("%d players found.", count); + AString output = STRPRINTF("%d players found."_fmt, count); clif_displaymessage(s, output); } @@ -794,14 +810,13 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd, ZString message) { int count; - int pl_GM_level, GM_level; - struct party *p; + PartyPair p; VString<23> match_text = message; match_text = match_text.to_lower(); count = 0; - GM_level = pc_isGM(sd); + GmLevel gm_level = pc_isGM(sd); for (io::FD i : iter_fds()) { Session *s2 = get_session(i); @@ -810,11 +825,11 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); + GmLevel pl_gm_level = pc_isGM(pl_sd); if (! ((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) - && (pl_GM_level > GM_level))) + && (!(gm_level.detects(pl_gm_level))))) { // you can look only lower or same level VString<23> player_name = pl_sd->status_key.name.to__lower(); @@ -822,12 +837,12 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd, { // search with no case sensitive p = party_search(pl_sd->status.party_id); - PartyName temp0 = p ? p->name : stringish<PartyName>("None"); + PartyName temp0 = p ? p->name : stringish<PartyName>("None"_s); AString output; - if (pl_GM_level > 0) + if (pl_gm_level) output = STRPRINTF( - "Name: %s (GM:%d) | Party: '%s'", - pl_sd->status_key.name, pl_GM_level, temp0); + "Name: %s (GM:%d) | Party: '%s'"_fmt, + pl_sd->status_key.name, pl_gm_level, temp0); clif_displaymessage(s, output); count++; } @@ -836,12 +851,12 @@ ATCE atcommand_whogroup(Session *s, dumb_ptr<map_session_data> sd, } if (count == 0) - clif_displaymessage(s, "No player found."); + clif_displaymessage(s, "No player found."_s); else if (count == 1) - clif_displaymessage(s, "1 player found."); + clif_displaymessage(s, "1 player found."_s); else { - AString output = STRPRINTF("%d players found.", count); + AString output = STRPRINTF("%d players found."_fmt, count); clif_displaymessage(s, output); } @@ -853,7 +868,6 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd, ZString message) { int count; - int pl_GM_level, GM_level; map_local *map_id; { @@ -865,7 +879,7 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd, } count = 0; - GM_level = pc_isGM(sd); + GmLevel gm_level = pc_isGM(sd); for (io::FD i : iter_fds()) { Session *s2 = get_session(i); @@ -874,24 +888,24 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); + GmLevel pl_gm_level = pc_isGM(pl_sd); if (! ((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) - && (pl_GM_level > GM_level))) + && (!(gm_level.detects(pl_gm_level))))) { // you can look only lower or same level if (pl_sd->bl_m == map_id) { AString output; - if (pl_GM_level > 0) + if (pl_gm_level) output = STRPRINTF( - "Name: %s (GM:%d) | Location: %s %d %d", - pl_sd->status_key.name, pl_GM_level, + "Name: %s (GM:%d) | Location: %s %d %d"_fmt, + pl_sd->status_key.name, pl_gm_level, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); else output = STRPRINTF( - "Name: %s | Location: %s %d %d", + "Name: %s | Location: %s %d %d"_fmt, pl_sd->status_key.name, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(s, output); @@ -901,7 +915,7 @@ ATCE atcommand_whomap(Session *s, dumb_ptr<map_session_data> sd, } } - AString output = STRPRINTF("%d players found in map '%s'.", + AString output = STRPRINTF("%d players found in map '%s'."_fmt, count, map_id->name_); clif_displaymessage(s, output); @@ -913,8 +927,7 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd, ZString message) { int count; - int pl_GM_level, GM_level; - struct party *p; + PartyPair p; map_local *map_id; { @@ -926,7 +939,7 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd, } count = 0; - GM_level = pc_isGM(sd); + GmLevel gm_level = pc_isGM(sd); for (io::FD i : iter_fds()) { Session *s2 = get_session(i); @@ -935,23 +948,23 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); + GmLevel pl_gm_level = pc_isGM(pl_sd); if (! ((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) - && (pl_GM_level > GM_level))) + && (!(gm_level.detects(pl_gm_level))))) { // you can look only lower or same level if (pl_sd->bl_m == map_id) { p = party_search(pl_sd->status.party_id); - PartyName temp0 = p ? p->name : stringish<PartyName>("None"); + PartyName temp0 = p ? p->name : stringish<PartyName>("None"_s); AString output; - if (pl_GM_level > 0) - output = STRPRINTF("Name: %s (GM:%d) | Party: '%s'", - pl_sd->status_key.name, pl_GM_level, temp0); + if (pl_gm_level) + output = STRPRINTF("Name: %s (GM:%d) | Party: '%s'"_fmt, + pl_sd->status_key.name, pl_gm_level, temp0); else - output = STRPRINTF("Name: %s | Party: '%s'", + output = STRPRINTF("Name: %s | Party: '%s'"_fmt, pl_sd->status_key.name, temp0); clif_displaymessage(s, output); count++; @@ -962,12 +975,12 @@ ATCE atcommand_whomapgroup(Session *s, dumb_ptr<map_session_data> sd, AString output; if (count == 0) - output = STRPRINTF("No player found in map '%s'.", map_id->name_); + output = STRPRINTF("No player found in map '%s'."_fmt, map_id->name_); else if (count == 1) - output = STRPRINTF("1 player found in map '%s'.", map_id->name_); + output = STRPRINTF("1 player found in map '%s'."_fmt, map_id->name_); else { - output = STRPRINTF("%d players found in map '%s'.", count, map_id->name_); + output = STRPRINTF("%d players found in map '%s'."_fmt, count, map_id->name_); } clif_displaymessage(s, output); @@ -979,14 +992,13 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd, ZString message) { int count; - int pl_GM_level, GM_level; - struct party *p; + PartyPair p; VString<23> match_text = message; match_text = match_text.to_lower(); count = 0; - GM_level = pc_isGM(sd); + GmLevel gm_level = pc_isGM(sd); for (io::FD i : iter_fds()) { Session *s2 = get_session(i); @@ -995,13 +1007,13 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth) { - pl_GM_level = pc_isGM(pl_sd); - if (pl_GM_level > 0) + GmLevel pl_gm_level = pc_isGM(pl_sd); + if (pl_gm_level) { if (! ((battle_config.hide_GM_session || bool(pl_sd->status.option & Option::HIDE)) - && (pl_GM_level > GM_level))) + && (!(gm_level.detects(pl_gm_level))))) { // you can look only lower or same level VString<23> player_name = pl_sd->status_key.name.to__lower(); @@ -1010,20 +1022,20 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd, // search with no case sensitive AString output; output = STRPRINTF( - "Name: %s (GM:%d) | Location: %s %d %d", - pl_sd->status_key.name, pl_GM_level, + "Name: %s (GM:%d) | Location: %s %d %d"_fmt, + pl_sd->status_key.name, pl_gm_level, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(s, output); output = STRPRINTF( - " BLvl: %d | Job: %s (Lvl: %d)", + " BLvl: %d | Job: %s (Lvl: %d)"_fmt, pl_sd->status.base_level, - "Novice/Human", + "Novice/Human"_s, pl_sd->status.job_level); clif_displaymessage(s, output); p = party_search(pl_sd->status.party_id); - PartyName temp0 = p ? p->name : stringish<PartyName>("None"); + PartyName temp0 = p ? p->name : stringish<PartyName>("None"_s); output = STRPRINTF( - " Party: '%s'", + " Party: '%s'"_fmt, temp0); clif_displaymessage(s, output); count++; @@ -1034,12 +1046,12 @@ ATCE atcommand_whogm(Session *s, dumb_ptr<map_session_data> sd, } if (count == 0) - clif_displaymessage(s, "No GM found."); + clif_displaymessage(s, "No GM found."_s); else if (count == 1) - clif_displaymessage(s, "1 GM found."); + clif_displaymessage(s, "1 GM found."_s); else { - AString output = STRPRINTF("%d GMs found.", count); + AString output = STRPRINTF("%d GMs found."_fmt, count); clif_displaymessage(s, output); } @@ -1053,7 +1065,7 @@ ATCE atcommand_save(Session *s, dumb_ptr<map_session_data> sd, pc_setsavepoint(sd, sd->mapname_, sd->bl_x, sd->bl_y); pc_makesavestatus(sd); chrif_save(sd); - clif_displaymessage(s, "Character data respawn point saved."); + clif_displaymessage(s, "Character data respawn point saved."_s); return ATCE::OKAY; } @@ -1064,17 +1076,17 @@ ATCE atcommand_load(Session *s, dumb_ptr<map_session_data> sd, { map_local *m = map_mapname2mapid(sd->status.save_point.map_); if (m != nullptr && m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you to your save map."); + "You are not authorised to warp you to your save map."_s); return ATCE::PERM; } if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you from your actual map."); + "You are not authorised to warp you from your actual map."_s); return ATCE::PERM; } @@ -1089,7 +1101,7 @@ ATCE atcommand_load(Session *s, dumb_ptr<map_session_data> sd, pc_setpos(sd, sd->status.save_point.map_, sd->status.save_point.x, sd->status.save_point.y, BeingRemoveWhy::GONE); } - clif_displaymessage(s, "Warping to respawn point."); + clif_displaymessage(s, "Warping to respawn point."_s); return ATCE::OKAY; } @@ -1101,7 +1113,7 @@ ATCE atcommand_speed(Session *s, dumb_ptr<map_session_data> sd, if (!message) { AString output = STRPRINTF( - "Please, enter a speed value (usage: @speed <%d-%d>).", + "Please, enter a speed value (usage: @speed <%d-%d>)."_fmt, static_cast<uint32_t>(MIN_WALK_SPEED.count()), static_cast<uint32_t>(MAX_WALK_SPEED.count())); clif_displaymessage(s, output); @@ -1115,12 +1127,12 @@ ATCE atcommand_speed(Session *s, dumb_ptr<map_session_data> sd, //sd->walktimer = x; //この文を追加 by れ clif_updatestatus(sd, SP::SPEED); - clif_displaymessage(s, "Speed changed."); + clif_displaymessage(s, "Speed changed."_s); } else { AString output = STRPRINTF( - "Please, enter a valid speed value (usage: @speed <%d-%d>).", + "Please, enter a valid speed value (usage: @speed <%d-%d>)."_fmt, static_cast<uint32_t>(MIN_WALK_SPEED.count()), static_cast<uint32_t>(MAX_WALK_SPEED.count())); clif_displaymessage(s, output); @@ -1134,18 +1146,18 @@ static ATCE atcommand_storage(Session *s, dumb_ptr<map_session_data> sd, ZString) { - struct storage *stor; + Storage *stor; if (sd->state.storage_open) { - clif_displaymessage(s, "msg_table[250]"); + clif_displaymessage(s, "msg_table[250]"_s); return ATCE::EXIST; } - if ((stor = account2storage2(sd->status_key.account_id)) != NULL + if ((stor = account2storage2(sd->status_key.account_id)) != nullptr && stor->storage_status == 1) { - clif_displaymessage(s, "msg_table[250]"); + clif_displaymessage(s, "msg_table[250]"_s); return ATCE::EXIST; } @@ -1171,7 +1183,7 @@ ATCE atcommand_option(Session *s, dumb_ptr<map_session_data> sd, clif_changeoption(sd); pc_calcstatus(sd, 0); - clif_displaymessage(s, "Options changed."); + clif_displaymessage(s, "Options changed."_s); return ATCE::OKAY; } @@ -1183,12 +1195,12 @@ ATCE atcommand_hide(Session *s, dumb_ptr<map_session_data> sd, if (bool(sd->status.option & Option::HIDE)) { sd->status.option &= ~Option::HIDE; - clif_displaymessage(s, "Invisible: Off."); + clif_displaymessage(s, "Invisible: Off."_s); } else { sd->status.option |= Option::HIDE; - clif_displaymessage(s, "Invisible: On."); + clif_displaymessage(s, "Invisible: On."_s); } clif_changeoption(sd); @@ -1199,8 +1211,8 @@ static ATCE atcommand_die(Session *s, dumb_ptr<map_session_data> sd, ZString) { - pc_damage(NULL, sd, sd->status.hp + 1); - clif_displaymessage(s, "A pity! You've died."); + pc_damage(nullptr, sd, sd->status.hp + 1); + clif_displaymessage(s, "A pity! You've died."_s); return ATCE::OKAY; } @@ -1215,23 +1227,23 @@ ATCE atcommand_kill(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can kill only lower or same level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); - clif_displaymessage(s, "Character killed."); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); + clif_displaymessage(s, "Character killed."_s); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -1250,7 +1262,7 @@ ATCE atcommand_alive(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(sd, SP::HP); clif_updatestatus(sd, SP::SP); clif_resurrection(sd, 1); - clif_displaymessage(s, "You've been revived! It's a miracle!"); + clif_displaymessage(s, "You've been revived! It's a miracle!"_s); return ATCE::OKAY; } @@ -1304,13 +1316,13 @@ ATCE atcommand_heal(Session *s, dumb_ptr<map_session_data> sd, { pc_heal(sd, hp, sp); if (hp >= 0 && sp >= 0) - clif_displaymessage(s, "HP, SP recovered."); + clif_displaymessage(s, "HP, SP recovered."_s); else - clif_displaymessage(s, "HP or/and SP modified."); + clif_displaymessage(s, "HP or/and SP modified."_s); } else { - clif_displaymessage(s, "HP and SP are already with the good value."); + clif_displaymessage(s, "HP and SP are already with the good value."_s); return ATCE::RANGE; } @@ -1322,29 +1334,29 @@ ATCE atcommand_item(Session *s, dumb_ptr<map_session_data> sd, ZString message) { XString item_name; - int number = 0, item_id; - struct item_data *item_data = NULL; + int number = 0; + ItemNameId item_id; + struct item_data *item_data = nullptr; int get_count, i; if (!extract(message, record<' ', 1>(&item_name, &number))) { clif_displaymessage(s, - "Please, enter an item name/id (usage: @item <item name or ID> [quantity])."); + "Please, enter an item name/id (usage: @item <item name or ID> [quantity])."_s); return ATCE::USAGE; } if (number <= 0) number = 1; - item_id = 0; - if ((item_data = itemdb_searchname(item_name)) != NULL) + if ((item_data = itemdb_searchname(item_name)) != nullptr) item_id = item_data->nameid; - else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != NULL) + else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != nullptr) item_id = item_data->nameid; else - item_id = 0; + return ATCE::EXIST; - if (item_id >= 500) + if (item_id) { get_count = number; if (item_data->type == ItemType::WEAPON @@ -1356,18 +1368,18 @@ ATCE atcommand_item(Session *s, dumb_ptr<map_session_data> sd, } for (i = 0; i < number; i += get_count) { - struct item item_tmp {}; + Item item_tmp {}; item_tmp.nameid = item_id; PickupFail flag; if ((flag = pc_additem(sd, &item_tmp, get_count)) != PickupFail::OKAY) - clif_additem(sd, 0, 0, flag); + clif_additem(sd, IOff0::from(0), 0, flag); } - clif_displaymessage(s, "Item created."); + clif_displaymessage(s, "Item created."_s); } else { - clif_displaymessage(s, "Invalid item ID or name."); + clif_displaymessage(s, "Invalid item ID or name."_s); return ATCE::EXIST; } @@ -1378,15 +1390,13 @@ static ATCE atcommand_itemreset(Session *s, dumb_ptr<map_session_data> sd, ZString) { - int i; - - for (i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == EPOS::ZERO) pc_delitem(sd, i, sd->status.inventory[i].amount, 0); } - clif_displaymessage(s, "All of your items have been removed."); + clif_displaymessage(s, "All of your items have been removed."_s); return ATCE::OKAY; } @@ -1409,7 +1419,7 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd, if (!extract(message, &level) || !level) { clif_displaymessage(s, - "Please, enter a level adjustement (usage: @blvl <number of levels>)."); + "Please, enter a level adjustement (usage: @blvl <number of levels>)."_s); return ATCE::USAGE; } @@ -1417,7 +1427,7 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd, { if (sd->status.base_level == battle_config.maximum_level) { - clif_displaymessage(s, "Base level can't go any higher."); + clif_displaymessage(s, "Base level can't go any higher."_s); return ATCE::RANGE; } if (level > battle_config.maximum_level || level > (battle_config.maximum_level - sd->status.base_level)) @@ -1432,13 +1442,13 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd, pc_calcstatus(sd, 0); pc_heal(sd, sd->status.max_hp, sd->status.max_sp); clif_misceffect(sd, 0); - clif_displaymessage(s, "Base level raised."); + clif_displaymessage(s, "Base level raised."_s); } else { if (sd->status.base_level == 1) { - clif_displaymessage(s, "Base level can't go any lower."); + clif_displaymessage(s, "Base level can't go any lower."_s); return ATCE::USAGE; } if (level < -battle_config.maximum_level || level < (1 - sd->status.base_level)) @@ -1458,7 +1468,7 @@ ATCE atcommand_baselevelup(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(sd, SP::BASELEVEL); clif_updatestatus(sd, SP::NEXTBASEEXP); pc_calcstatus(sd, 0); - clif_displaymessage(s, "Base level lowered."); + clif_displaymessage(s, "Base level lowered."_s); } return ATCE::OKAY; @@ -1481,7 +1491,7 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr<map_session_data> sd, { if (sd->status.job_level == up_level) { - clif_displaymessage(s, "Job level can't go any higher."); + clif_displaymessage(s, "Job level can't go any higher."_s); return ATCE::RANGE; } if (level > up_level || level > (up_level - sd->status.job_level)) @@ -1494,13 +1504,13 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(sd, SP::SKILLPOINT); pc_calcstatus(sd, 0); clif_misceffect(sd, 1); - clif_displaymessage(s, "Job level raised."); + clif_displaymessage(s, "Job level raised."_s); } else { if (sd->status.job_level == 1) { - clif_displaymessage(s, "Job level can't go any lower."); + clif_displaymessage(s, "Job level can't go any lower."_s); return ATCE::RANGE; } if (level < -up_level || level < (1 - sd->status.job_level)) @@ -1518,7 +1528,7 @@ ATCE atcommand_joblevelup(Session *s, dumb_ptr<map_session_data> sd, } // to add: remove status points from skills pc_calcstatus(sd, 0); - clif_displaymessage(s, "Job level lowered."); + clif_displaymessage(s, "Job level lowered."_s); } return ATCE::OKAY; @@ -1534,7 +1544,7 @@ ATCE atcommand_gm(Session *s, dumb_ptr<map_session_data> sd, if (pc_isGM(sd)) { // a GM can not use this function. only a normal player (become gm is not for gm!) - clif_displaymessage(s, "You already have some GM powers."); + clif_displaymessage(s, "You already have some GM powers."_s); return ATCE::PERM; } else @@ -1550,7 +1560,7 @@ ATCE atcommand_pvpoff(Session *s, dumb_ptr<map_session_data> sd, if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] - clif_displaymessage(s, "This option cannot be used in PK Mode."); + clif_displaymessage(s, "This option cannot be used in PK Mode."_s); return ATCE::EXIST; } @@ -1571,11 +1581,11 @@ ATCE atcommand_pvpoff(Session *s, dumb_ptr<map_session_data> sd, } } } - clif_displaymessage(s, "PvP: Off."); + clif_displaymessage(s, "PvP: Off."_s); } else { - clif_displaymessage(s, "PvP is already Off."); + clif_displaymessage(s, "PvP is already Off."_s); return ATCE::EXIST; } @@ -1589,7 +1599,7 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd, if (battle_config.pk_mode) { //disable command if server is in PK mode [Valaris] - clif_displaymessage(s, "This option cannot be used in PK Mode."); + clif_displaymessage(s, "This option cannot be used in PK Mode."_s); return ATCE::EXIST; } @@ -1606,7 +1616,7 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd, { if (sd->bl_m == pl_sd->bl_m && !pl_sd->pvp_timer) { - pl_sd->pvp_timer = Timer(gettick() + std::chrono::milliseconds(200), + pl_sd->pvp_timer = Timer(gettick() + 200_ms, std::bind(pc_calc_pvprank_timer, ph::_1, ph::_2, pl_sd->bl_id)); pl_sd->pvp_rank = 0; pl_sd->pvp_lastusers = 0; @@ -1614,11 +1624,11 @@ ATCE atcommand_pvpon(Session *s, dumb_ptr<map_session_data> sd, } } } - clif_displaymessage(s, "PvP: On."); + clif_displaymessage(s, "PvP: On."_s); } else { - clif_displaymessage(s, "PvP is already On."); + clif_displaymessage(s, "PvP is already On."_s); return ATCE::EXIST; } @@ -1642,7 +1652,7 @@ ATCE atcommand_model(Session *s, dumb_ptr<map_session_data> sd, pc_changelook(sd, LOOK::HAIR, hair_style); pc_changelook(sd, LOOK::HAIR_COLOR, hair_color); pc_changelook(sd, LOOK::CLOTHES_COLOR, cloth_color); - clif_displaymessage(s, "Appearence changed."); + clif_displaymessage(s, "Appearence changed."_s); } } else @@ -1664,7 +1674,7 @@ ATCE atcommand_dye(Session *s, dumb_ptr<map_session_data> sd, { { pc_changelook(sd, LOOK::CLOTHES_COLOR, cloth_color); - clif_displaymessage(s, "Appearence changed."); + clif_displaymessage(s, "Appearence changed."_s); } } else @@ -1686,7 +1696,7 @@ ATCE atcommand_hair_style(Session *s, dumb_ptr<map_session_data> sd, { { pc_changelook(sd, LOOK::HAIR, hair_style); - clif_displaymessage(s, "Appearence changed."); + clif_displaymessage(s, "Appearence changed."_s); } } else @@ -1708,7 +1718,7 @@ ATCE atcommand_hair_color(Session *s, dumb_ptr<map_session_data> sd, { { pc_changelook(sd, LOOK::HAIR_COLOR, hair_color); - clif_displaymessage(s, "Appearence changed."); + clif_displaymessage(s, "Appearence changed."_s); } } else @@ -1722,22 +1732,21 @@ ATCE atcommand_spawn(Session *s, dumb_ptr<map_session_data> sd, ZString message) { MobName monster; - int mob_id; + Species mob_id; int number = 0; int x = 0, y = 0; int count; - int i, j, k; int mx, my, range; if (!extract(message, record<' ', 1>(&monster, &number, &x, &y))) return ATCE::USAGE; // If monster identifier/name argument is a name - if ((mob_id = mobdb_searchname(monster)) == 0) + if ((mob_id = mobdb_searchname(monster)) == Species()) // check name first (to avoid possible name begining by a number) - mob_id = mobdb_checkid(atoi(monster.c_str())); + mob_id = mobdb_checkid(wrap<Species>(atoi(monster.c_str()))); - if (mob_id == 0) + if (mob_id == Species()) return ATCE::EXIST; if (number <= 0) @@ -1749,18 +1758,18 @@ ATCE atcommand_spawn(Session *s, dumb_ptr<map_session_data> sd, number = battle_config.atcommand_spawn_quantity_limit; if (battle_config.etc_log) - PRINTF("@spawn monster='%s' id=%d count=%d (%d,%d)\n", + PRINTF("@spawn monster='%s' id=%d count=%d (%d,%d)\n"_fmt, monster, mob_id, number, x, y); count = 0; range = sqrt(number) / 2; range = range * 2 + 5; // calculation of an odd number (+ 4 area around) - for (i = 0; i < number; i++) + for (int i = 0; i < number; i++) { - j = 0; - k = 0; - while (j++ < 8 && k == 0) + int j = 0; + BlockId k; + while (j++ < 8 && !k) { // try 8 times to spawn the monster (needed for close area) if (x <= 0) @@ -1773,21 +1782,21 @@ ATCE atcommand_spawn(Session *s, dumb_ptr<map_session_data> sd, my = y; k = mob_once_spawn(sd, MOB_THIS_MAP, mx, my, MobName(), mob_id, 1, NpcEvent()); } - count += (k != 0) ? 1 : 0; + count += k ? 1 : 0; } if (count != 0) if (number == count) - clif_displaymessage(s, "All monster summoned!"); + clif_displaymessage(s, "All monster summoned!"_s); else { - AString output = STRPRINTF("%d monster(s) summoned!", + AString output = STRPRINTF("%d monster(s) summoned!"_fmt, count); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Invalid monster ID or name."); + clif_displaymessage(s, "Invalid monster ID or name."_s); return ATCE::EXIST; } @@ -1813,7 +1822,7 @@ void atcommand_killmonster_sub(Session *s, dumb_ptr<map_session_data> sd, map_id->xs, map_id->ys, BL::MOB); - clif_displaymessage(s, "All monsters killed!"); + clif_displaymessage(s, "All monsters killed!"_s); } static @@ -1830,7 +1839,7 @@ void atlist_nearby_sub(dumb_ptr<block_list> bl, Session *s) { nullpo_retv(bl); - AString buf = STRPRINTF(" - \"%s\"", + AString buf = STRPRINTF(" - \"%s\""_fmt, bl->is_player()->status_key.name); clif_displaymessage(s, buf); } @@ -1839,7 +1848,7 @@ static ATCE atcommand_list_nearby(Session *s, dumb_ptr<map_session_data> sd, ZString) { - clif_displaymessage(s, "Nearby players:"); + clif_displaymessage(s, "Nearby players:"_s); map_foreachinarea(std::bind(atlist_nearby_sub, ph::_1, s), sd->bl_m, sd->bl_x - 1, sd->bl_y - 1, @@ -1867,7 +1876,7 @@ ATCE atcommand_gat(Session *s, dumb_ptr<map_session_data> sd, for (y = 2; y >= -2; y--) { AString output = STRPRINTF( - "%s (x= %d, y= %d) %02X %02X %02X %02X %02X", + "%s (x= %d, y= %d) %02X %02X %02X %02X %02X"_fmt, sd->bl_m->name_, sd->bl_x - 2, sd->bl_y + y, map_getcell(sd->bl_m, sd->bl_x - 2, sd->bl_y + y), map_getcell(sd->bl_m, sd->bl_x - 1, sd->bl_y + y), @@ -1916,7 +1925,7 @@ ATCE atcommand_statuspoint(Session *s, dumb_ptr<map_session_data> sd, { sd->status.status_point = new_status_point; clif_updatestatus(sd, SP::STATUSPOINT); - clif_displaymessage(s, "Number of status points changed!"); + clif_displaymessage(s, "Number of status points changed!"_s); } else return ATCE::RANGE; @@ -1945,7 +1954,7 @@ ATCE atcommand_skillpoint(Session *s, dumb_ptr<map_session_data> sd, { sd->status.skill_point = new_skill_point; clif_updatestatus(sd, SP::SKILLPOINT); - clif_displaymessage(s, "Number of skill points changed!"); + clif_displaymessage(s, "Number of skill points changed!"_s); } else return ATCE::RANGE; @@ -1974,7 +1983,7 @@ ATCE atcommand_zeny(Session *s, dumb_ptr<map_session_data> sd, { sd->status.zeny = new_zeny; clif_updatestatus(sd, SP::ZENY); - clif_displaymessage(s, "Number of zenys changed!"); + clif_displaymessage(s, "Number of zenys changed!"_s); } else return ATCE::RANGE; @@ -2006,7 +2015,7 @@ ATCE atcommand_param(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(sd, attr_to_sp(attr)); clif_updatestatus(sd, attr_to_usp(attr)); pc_calcstatus(sd, 0); - clif_displaymessage(s, "Stat changed."); + clif_displaymessage(s, "Stat changed."_s); } else return ATCE::RANGE; @@ -2047,7 +2056,7 @@ ATCE atcommand_all_stats(Session *s, dumb_ptr<map_session_data> sd, if (count > 0) // if at least 1 stat modified - clif_displaymessage(s, "All stats changed!"); + clif_displaymessage(s, "All stats changed!"_s); else return ATCE::RANGE; @@ -2064,38 +2073,38 @@ ATCE atcommand_recall(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can recall only lower or same level if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp somenone to your actual map."); + "You are not authorised to warp somenone to your actual map."_s); return ATCE::PERM; } if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp this player from its actual map."); + "You are not authorised to warp this player from its actual map."_s); return ATCE::PERM; } pc_setpos(pl_sd, sd->mapname_, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT); - AString output = STRPRINTF("%s recalled!", character); + AString output = STRPRINTF("%s recalled!"_fmt, character); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2112,7 +2121,7 @@ ATCE atcommand_revive(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { pl_sd->status.hp = pl_sd->status.max_hp; pc_setstand(pl_sd); @@ -2121,11 +2130,11 @@ ATCE atcommand_revive(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(pl_sd, SP::HP); clif_updatestatus(pl_sd, SP::SP); clif_resurrection(pl_sd, 1); - clif_displaymessage(s, "Character revived."); + clif_displaymessage(s, "Character revived."_s); } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2142,41 +2151,41 @@ ATCE atcommand_character_stats(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { AString output; - output = STRPRINTF("'%s' stats:", pl_sd->status_key.name); + output = STRPRINTF("'%s' stats:"_fmt, pl_sd->status_key.name); clif_displaymessage(s, output); - output = STRPRINTF("Base Level - %d", pl_sd->status.base_level), + output = STRPRINTF("Base Level - %d"_fmt, pl_sd->status.base_level); clif_displaymessage(s, output); - output = STRPRINTF("Job - Novice/Human (level %d)", pl_sd->status.job_level); + output = STRPRINTF("Job - Novice/Human (level %d)"_fmt, pl_sd->status.job_level); clif_displaymessage(s, output); - output = STRPRINTF("Hp - %d", pl_sd->status.hp); + output = STRPRINTF("Hp - %d"_fmt, pl_sd->status.hp); clif_displaymessage(s, output); - output = STRPRINTF("MaxHp - %d", pl_sd->status.max_hp); + output = STRPRINTF("MaxHp - %d"_fmt, pl_sd->status.max_hp); clif_displaymessage(s, output); - output = STRPRINTF("Sp - %d", pl_sd->status.sp); + output = STRPRINTF("Sp - %d"_fmt, pl_sd->status.sp); clif_displaymessage(s, output); - output = STRPRINTF("MaxSp - %d", pl_sd->status.max_sp); + output = STRPRINTF("MaxSp - %d"_fmt, pl_sd->status.max_sp); clif_displaymessage(s, output); - output = STRPRINTF("Str - %3d", pl_sd->status.attrs[ATTR::STR]); + output = STRPRINTF("Str - %3d"_fmt, pl_sd->status.attrs[ATTR::STR]); clif_displaymessage(s, output); - output = STRPRINTF("Agi - %3d", pl_sd->status.attrs[ATTR::AGI]); + output = STRPRINTF("Agi - %3d"_fmt, pl_sd->status.attrs[ATTR::AGI]); clif_displaymessage(s, output); - output = STRPRINTF("Vit - %3d", pl_sd->status.attrs[ATTR::VIT]); + output = STRPRINTF("Vit - %3d"_fmt, pl_sd->status.attrs[ATTR::VIT]); clif_displaymessage(s, output); - output = STRPRINTF("Int - %3d", pl_sd->status.attrs[ATTR::INT]); + output = STRPRINTF("Int - %3d"_fmt, pl_sd->status.attrs[ATTR::INT]); clif_displaymessage(s, output); - output = STRPRINTF("Dex - %3d", pl_sd->status.attrs[ATTR::DEX]); + output = STRPRINTF("Dex - %3d"_fmt, pl_sd->status.attrs[ATTR::DEX]); clif_displaymessage(s, output); - output = STRPRINTF("Luk - %3d", pl_sd->status.attrs[ATTR::LUK]); + output = STRPRINTF("Luk - %3d"_fmt, pl_sd->status.attrs[ATTR::LUK]); clif_displaymessage(s, output); - output = STRPRINTF("Zeny - %d", pl_sd->status.zeny); + output = STRPRINTF("Zeny - %d"_fmt, pl_sd->status.zeny); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2199,41 +2208,41 @@ ATCE atcommand_character_stats_all(Session *s, dumb_ptr<map_session_data>, if (pl_sd && pl_sd->state.auth) { AString gmlevel; - if (pc_isGM(pl_sd) > 0) - gmlevel = STRPRINTF("| GM Lvl: %d", pc_isGM(pl_sd)); + if (GmLevel pl_gm_level = pc_isGM(pl_sd)) + gmlevel = STRPRINTF("| GM Lvl: %d"_fmt, pl_gm_level); else - gmlevel = " "; + gmlevel = " "_s; AString output; output = STRPRINTF( - "Name: %s | BLvl: %d | Job: Novice/Human (Lvl: %d) | HP: %d/%d | SP: %d/%d", + "Name: %s | BLvl: %d | Job: Novice/Human (Lvl: %d) | HP: %d/%d | SP: %d/%d"_fmt, pl_sd->status_key.name, pl_sd->status.base_level, pl_sd->status.job_level, pl_sd->status.hp, pl_sd->status.max_hp, pl_sd->status.sp, pl_sd->status.max_sp); clif_displaymessage(s, output); - output = STRPRINTF("STR: %d | AGI: %d | VIT: %d | INT: %d | DEX: %d | LUK: %d | Zeny: %d %s", - pl_sd->status.attrs[ATTR::STR], - pl_sd->status.attrs[ATTR::AGI], - pl_sd->status.attrs[ATTR::VIT], - pl_sd->status.attrs[ATTR::INT], - pl_sd->status.attrs[ATTR::DEX], - pl_sd->status.attrs[ATTR::LUK], - pl_sd->status.zeny, - gmlevel); + output = STRPRINTF("STR: %d | AGI: %d | VIT: %d | INT: %d | DEX: %d | LUK: %d | Zeny: %d %s"_fmt, + pl_sd->status.attrs[ATTR::STR], + pl_sd->status.attrs[ATTR::AGI], + pl_sd->status.attrs[ATTR::VIT], + pl_sd->status.attrs[ATTR::INT], + pl_sd->status.attrs[ATTR::DEX], + pl_sd->status.attrs[ATTR::LUK], + pl_sd->status.zeny, + gmlevel); clif_displaymessage(s, output); - clif_displaymessage(s, "--------"); + clif_displaymessage(s, "--------"_s); count++; } } if (count == 0) - clif_displaymessage(s, "No player found."); + clif_displaymessage(s, "No player found."_s); else if (count == 1) - clif_displaymessage(s, "1 player found."); + clif_displaymessage(s, "1 player found."_s); else { - AString output = STRPRINTF("%d players found.", count); + AString output = STRPRINTF("%d players found."_fmt, count); clif_displaymessage(s, output); } @@ -2252,9 +2261,9 @@ ATCE atcommand_character_option(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can change option only to lower or same level pl_sd->opt1 = opt1; @@ -2263,17 +2272,17 @@ ATCE atcommand_character_option(Session *s, dumb_ptr<map_session_data> sd, clif_changeoption(pl_sd); pc_calcstatus(pl_sd, 0); - clif_displaymessage(s, "Character's options changed."); + clif_displaymessage(s, "Character's options changed."_s); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2292,7 +2301,7 @@ ATCE atcommand_char_change_sex(Session *s, dumb_ptr<map_session_data> sd, { chrif_char_ask_name(sd->status_key.account_id, character, 5, HumanTimeDiff()); // type: 5 - changesex - clif_displaymessage(s, "Character name sends to char-server to ask it."); + clif_displaymessage(s, "Character name sends to char-server to ask it."_s); } return ATCE::OKAY; @@ -2310,7 +2319,7 @@ ATCE atcommand_char_block(Session *s, dumb_ptr<map_session_data> sd, { chrif_char_ask_name(sd->status_key.account_id, character, 1, HumanTimeDiff()); // type: 1 - block - clif_displaymessage(s, "Character name sends to char-server to ask it."); + clif_displaymessage(s, "Character name sends to char-server to ask it."_s); } return ATCE::OKAY; @@ -2330,7 +2339,7 @@ ATCE atcommand_char_ban(Session *s, dumb_ptr<map_session_data> sd, { chrif_char_ask_name(sd->status_key.account_id, character, 2, modif); // type: 2 - ban - clif_displaymessage(s, "Character name sends to char-server to ask it."); + clif_displaymessage(s, "Character name sends to char-server to ask it."_s); } return ATCE::OKAY; @@ -2349,7 +2358,7 @@ ATCE atcommand_char_unblock(Session *s, dumb_ptr<map_session_data> sd, // send answer to login server via char-server chrif_char_ask_name(sd->status_key.account_id, character, 3, HumanTimeDiff()); // type: 3 - unblock - clif_displaymessage(s, "Character name sends to char-server to ask it."); + clif_displaymessage(s, "Character name sends to char-server to ask it."_s); } return ATCE::OKAY; @@ -2368,7 +2377,7 @@ ATCE atcommand_char_unban(Session *s, dumb_ptr<map_session_data> sd, // send answer to login server via char-server chrif_char_ask_name(sd->status_key.account_id, character, 4, HumanTimeDiff()); // type: 4 - unban - clif_displaymessage(s, "Character name sends to char-server to ask it."); + clif_displaymessage(s, "Character name sends to char-server to ask it."_s); } return ATCE::OKAY; @@ -2387,39 +2396,39 @@ ATCE atcommand_character_save(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can change save point only to lower or same gm level map_local *m = map_mapname2mapid(map_name); if (m == nullptr) { - clif_displaymessage(s, "Map not found."); + clif_displaymessage(s, "Map not found."_s); return ATCE::EXIST; } else { if (m != nullptr && m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to set this map as a save map."); + "You are not authorised to set this map as a save map."_s); return ATCE::PERM; } pc_setsavepoint(pl_sd, map_name, x, y); - clif_displaymessage(s, "Character's respawn point changed."); + clif_displaymessage(s, "Character's respawn point changed."_s); } } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2438,14 +2447,14 @@ ATCE atcommand_doom(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth && s2 != s - && pc_isGM(sd) >= pc_isGM(pl_sd)) + && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can doom only lower or same gm level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); - clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); + clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s); } } - clif_displaymessage(s, "Judgement was made."); + clif_displaymessage(s, "Judgement was made."_s); return ATCE::OKAY; } @@ -2462,14 +2471,14 @@ ATCE atcommand_doommap(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth && s2 != s && sd->bl_m == pl_sd->bl_m - && pc_isGM(sd) >= pc_isGM(pl_sd)) + && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can doom only lower or same gm level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); - clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); + clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s); } } - clif_displaymessage(s, "Judgement was made."); + clif_displaymessage(s, "Judgement was made."_s); return ATCE::OKAY; } @@ -2485,7 +2494,7 @@ void atcommand_raise_sub(dumb_ptr<map_session_data> sd) clif_updatestatus(sd, SP::HP); clif_updatestatus(sd, SP::SP); clif_resurrection(sd, 1); - clif_displaymessage(sd->sess, "Mercy has been shown."); + clif_displaymessage(sd->sess, "Mercy has been shown."_s); } } @@ -2501,7 +2510,7 @@ ATCE atcommand_raise(Session *s, dumb_ptr<map_session_data>, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); atcommand_raise_sub(pl_sd); } - clif_displaymessage(s, "Mercy has been granted."); + clif_displaymessage(s, "Mercy has been granted."_s); return ATCE::OKAY; } @@ -2520,7 +2529,7 @@ ATCE atcommand_raisemap(Session *s, dumb_ptr<map_session_data> sd, && pl_sd->state.auth && sd->bl_m == pl_sd->bl_m) atcommand_raise_sub(pl_sd); } - clif_displaymessage(s, "Mercy has been granted."); + clif_displaymessage(s, "Mercy has been granted."_s); return ATCE::OKAY; } @@ -2537,16 +2546,16 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can change base level only lower or same gm level if (level > 0) { if (pl_sd->status.base_level == battle_config.maximum_level) { - clif_displaymessage(s, "Character's base level can't go any higher."); + clif_displaymessage(s, "Character's base level can't go any higher."_s); return ATCE::RANGE; } if (level > battle_config.maximum_level || level > (battle_config.maximum_level - pl_sd->status.base_level)) @@ -2564,13 +2573,13 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd, pc_calcstatus(pl_sd, 0); pc_heal(pl_sd, pl_sd->status.max_hp, pl_sd->status.max_sp); clif_misceffect(pl_sd, 0); - clif_displaymessage(s, "Character's base level raised."); + clif_displaymessage(s, "Character's base level raised."_s); } else { if (pl_sd->status.base_level == 1) { - clif_displaymessage(s, "Character's base level can't go any lower."); + clif_displaymessage(s, "Character's base level can't go any lower."_s); return ATCE::RANGE; } if (level < -battle_config.maximum_level || level < (1 - pl_sd->status.base_level)) @@ -2592,20 +2601,20 @@ ATCE atcommand_character_baselevel(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(pl_sd, SP::NEXTBASEEXP); clif_updatestatus(pl_sd, SP::BASEEXP); pc_calcstatus(pl_sd, 0); - clif_displaymessage(s, "Character's base level lowered."); + clif_displaymessage(s, "Character's base level lowered."_s); } // Reset their stat points to prevent extra points from stacking atcommand_charstreset(s, sd, character.to__actual()); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2624,9 +2633,9 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can change job level only lower or same gm level max_level -= 40; @@ -2635,7 +2644,7 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd, { if (pl_sd->status.job_level == max_level) { - clif_displaymessage(s, "Character's job level can't go any higher."); + clif_displaymessage(s, "Character's job level can't go any higher."_s); return ATCE::RANGE; } if (pl_sd->status.job_level + level > max_level) @@ -2647,13 +2656,13 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(pl_sd, SP::SKILLPOINT); pc_calcstatus(pl_sd, 0); clif_misceffect(pl_sd, 1); - clif_displaymessage(s, "character's job level raised."); + clif_displaymessage(s, "character's job level raised."_s); } else { if (pl_sd->status.job_level == 1) { - clif_displaymessage(s, "Character's job level can't go any lower."); + clif_displaymessage(s, "Character's job level can't go any lower."_s); return ATCE::RANGE; } if (pl_sd->status.job_level + level < 1) @@ -2670,18 +2679,18 @@ ATCE atcommand_character_joblevel(Session *s, dumb_ptr<map_session_data> sd, } // to add: remove status points from skills pc_calcstatus(pl_sd, 0); - clif_displaymessage(s, "Character's job level lowered."); + clif_displaymessage(s, "Character's job level lowered."_s); } } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2698,20 +2707,20 @@ ATCE atcommand_kick(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) // you can kick only lower or same gm level clif_GM_kick(sd, pl_sd, 1); else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -2729,7 +2738,7 @@ ATCE atcommand_kickall(Session *s, dumb_ptr<map_session_data> sd, continue; dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd - && pl_sd->state.auth && pc_isGM(sd) >= pc_isGM(pl_sd)) + && pl_sd->state.auth && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can kick only lower or same gm level if (sd->status_key.account_id != pl_sd->status_key.account_id) @@ -2737,7 +2746,7 @@ ATCE atcommand_kickall(Session *s, dumb_ptr<map_session_data> sd, } } - clif_displaymessage(s, "All players have been kicked!"); + clif_displaymessage(s, "All players have been kicked!"_s); return ATCE::OKAY; } @@ -2758,23 +2767,23 @@ ATCE atcommand_questskill(Session *s, dumb_ptr<map_session_data> sd, if (pc_checkskill(sd, skill_id) == 0) { pc_skill(sd, skill_id, 1, 0); - clif_displaymessage(s, "You have learned the skill."); + clif_displaymessage(s, "You have learned the skill."_s); } else { - clif_displaymessage(s, "You already have this quest skill."); + clif_displaymessage(s, "You already have this quest skill."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."); + clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s); return ATCE::RANGE; } } else { - clif_displaymessage(s, "This skill number doesn't exist."); + clif_displaymessage(s, "This skill number doesn't exist."_s); return ATCE::RANGE; } @@ -2796,34 +2805,34 @@ ATCE atcommand_charquestskill(Session *s, dumb_ptr<map_session_data>, if (skill_get_inf2(skill_id) & 0x01) { dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_checkskill(pl_sd, skill_id) == 0) { pc_skill(pl_sd, skill_id, 1, 0); - clif_displaymessage(s, "This player has learned the skill."); + clif_displaymessage(s, "This player has learned the skill."_s); } else { - clif_displaymessage(s, "This player already has this quest skill."); + clif_displaymessage(s, "This player already has this quest skill."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."); + clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s); return ATCE::RANGE; } } else { - clif_displaymessage(s, "This skill number doesn't exist."); + clif_displaymessage(s, "This skill number doesn't exist."_s); return ATCE::RANGE; } @@ -2848,23 +2857,23 @@ ATCE atcommand_lostskill(Session *s, dumb_ptr<map_session_data> sd, sd->status.skill[skill_id].lv = 0; sd->status.skill[skill_id].flags = SkillFlags::ZERO; clif_skillinfoblock(sd); - clif_displaymessage(s, "You have forgotten the skill."); + clif_displaymessage(s, "You have forgotten the skill."_s); } else { - clif_displaymessage(s, "You don't have this quest skill."); + clif_displaymessage(s, "You don't have this quest skill."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."); + clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s); return ATCE::RANGE; } } else { - clif_displaymessage(s, "This skill number doesn't exist."); + clif_displaymessage(s, "This skill number doesn't exist."_s); return ATCE::RANGE; } @@ -2886,36 +2895,36 @@ ATCE atcommand_charlostskill(Session *s, dumb_ptr<map_session_data>, if (skill_get_inf2(skill_id) & 0x01) { dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (pc_checkskill(pl_sd, skill_id) > 0) { pl_sd->status.skill[skill_id].lv = 0; pl_sd->status.skill[skill_id].flags = SkillFlags::ZERO; clif_skillinfoblock(pl_sd); - clif_displaymessage(s, "This player has forgotten the skill."); + clif_displaymessage(s, "This player has forgotten the skill."_s); } else { - clif_displaymessage(s, "This player doesn't have this quest skill."); + clif_displaymessage(s, "This player doesn't have this quest skill."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."); + clif_displaymessage(s, "This skill number doesn't exist or isn't a quest skill."_s); return ATCE::RANGE; } } else { - clif_displaymessage(s, "This skill number doesn't exist."); + clif_displaymessage(s, "This skill number doesn't exist."_s); return ATCE::RANGE; } @@ -2964,26 +2973,26 @@ ATCE atcommand_idsearch(Session *s, dumb_ptr<map_session_data>, ZString message) { ItemName item_name; - int i, match; + int match; struct item_data *item; if (!extract(message, &item_name) || !item_name) return ATCE::USAGE; - AString output = STRPRINTF("The reference result of '%s' (name: id):", item_name); + AString output = STRPRINTF("The reference result of '%s' (name: id):"_fmt, item_name); clif_displaymessage(s, output); match = 0; - for (i = 0; i < 20000; i++) + for (ItemNameId i = wrap<ItemNameId>(0); i < wrap<ItemNameId>(-1); i = next(i)) { - if ((item = itemdb_exists(i)) != NULL + if ((item = itemdb_exists(i)) != nullptr && item->jname.contains_seq(item_name)) { match++; - output = STRPRINTF("%s: %d", item->jname, item->nameid); + output = STRPRINTF("%s: %d"_fmt, item->jname, item->nameid); clif_displaymessage(s, output); } } - output = STRPRINTF("It is %d affair above.", match); + output = STRPRINTF("It is %d affair above."_fmt, match); clif_displaymessage(s, output); return ATCE::OKAY; @@ -2999,25 +3008,25 @@ ATCE atcommand_charskreset(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can reset skill points only lower or same gm level pc_resetskill(pl_sd); AString output = STRPRINTF( - "'%s' skill points reseted!", character); + "'%s' skill points reseted!"_fmt, character); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3034,26 +3043,26 @@ ATCE atcommand_charstreset(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can reset stats points only lower or same gm level pc_resetstate(pl_sd); AString output = STRPRINTF( - "'%s' stats points reseted!", + "'%s' stats points reseted!"_fmt, character); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3070,30 +3079,30 @@ ATCE atcommand_charreset(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can reset a character only for lower or same GM level pc_resetstate(pl_sd); pc_resetskill(pl_sd); - pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"), 0); + pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"_s), 0); // [Fate] Reset magic quest variables - pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"), 0); + pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"_s), 0); // [Fate] Reset magic experience AString output = STRPRINTF( - "'%s' skill and stats points reseted!", character); + "'%s' skill and stats points reseted!"_fmt, character); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3110,12 +3119,11 @@ ATCE atcommand_char_wipe(Session *s, dumb_ptr<map_session_data> sd, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can reset a character only for lower or same GM level - int i; // Reset base level pl_sd->status.base_level = 1; @@ -3136,7 +3144,7 @@ ATCE atcommand_char_wipe(Session *s, dumb_ptr<map_session_data> sd, clif_updatestatus(pl_sd, SP::ZENY); // Clear inventory - for (i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { if (sd->status.inventory[i].amount) { @@ -3147,33 +3155,33 @@ ATCE atcommand_char_wipe(Session *s, dumb_ptr<map_session_data> sd, } // Give knife and shirt - struct item item; - item.nameid = 1201; + Item item; + item.nameid = wrap<ItemNameId>(1201); pc_additem(pl_sd, &item, 1); - item.nameid = 1202; + item.nameid = wrap<ItemNameId>(1202); pc_additem(pl_sd, &item, 1); // Reset stats and skills pc_calcstatus(pl_sd, 0); pc_resetstate(pl_sd); pc_resetskill(pl_sd); - pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"), 0); + pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_FLAGS"_s), 0); // [Fate] Reset magic quest variables - pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"), 0); + pc_setglobalreg(pl_sd, stringish<VarName>("MAGIC_EXP"_s), 0); // [Fate] Reset magic experience - AString output = STRPRINTF("%s: wiped.", character); + AString output = STRPRINTF("%s: wiped."_fmt, character); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3191,7 +3199,7 @@ ATCE atcommand_charmodel(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE && hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR && @@ -3201,7 +3209,7 @@ ATCE atcommand_charmodel(Session *s, dumb_ptr<map_session_data>, pc_changelook(pl_sd, LOOK::HAIR, hair_style); pc_changelook(pl_sd, LOOK::HAIR_COLOR, hair_color); pc_changelook(pl_sd, LOOK::CLOTHES_COLOR, cloth_color); - clif_displaymessage(s, "Appearence changed."); + clif_displaymessage(s, "Appearence changed."_s); } } else @@ -3209,7 +3217,7 @@ ATCE atcommand_charmodel(Session *s, dumb_ptr<map_session_data>, } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3229,7 +3237,7 @@ ATCE atcommand_charskpoint(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { new_skill_point = pl_sd->status.skill_point + point; if (point > 0 && (point > 0x7FFF || new_skill_point > 0x7FFF)) @@ -3242,14 +3250,14 @@ ATCE atcommand_charskpoint(Session *s, dumb_ptr<map_session_data>, { pl_sd->status.skill_point = new_skill_point; clif_updatestatus(pl_sd, SP::SKILLPOINT); - clif_displaymessage(s, "Character's number of skill points changed!"); + clif_displaymessage(s, "Character's number of skill points changed!"_s); } else return ATCE::RANGE; } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3269,7 +3277,7 @@ ATCE atcommand_charstpoint(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { new_status_point = pl_sd->status.status_point + point; if (point > 0 && (point > 0x7FFF || new_status_point > 0x7FFF)) @@ -3282,14 +3290,14 @@ ATCE atcommand_charstpoint(Session *s, dumb_ptr<map_session_data>, { pl_sd->status.status_point = new_status_point; clif_updatestatus(pl_sd, SP::STATUSPOINT); - clif_displaymessage(s, "Character's number of status points changed!"); + clif_displaymessage(s, "Character's number of status points changed!"_s); } else return ATCE::RANGE; } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3307,7 +3315,7 @@ ATCE atcommand_charzeny(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { new_zeny = pl_sd->status.zeny + zeny; if (zeny > 0 && (zeny > MAX_ZENY || new_zeny > MAX_ZENY)) @@ -3320,14 +3328,14 @@ ATCE atcommand_charzeny(Session *s, dumb_ptr<map_session_data>, { pl_sd->status.zeny = new_zeny; clif_updatestatus(pl_sd, SP::ZENY); - clif_displaymessage(s, "Character's number of zenys changed!"); + clif_displaymessage(s, "Character's number of zenys changed!"_s); } else return ATCE::RANGE; } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3341,10 +3349,10 @@ ATCE atcommand_recallall(Session *s, dumb_ptr<map_session_data> sd, int count; if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp somenone to your actual map."); + "You are not authorised to warp somenone to your actual map."_s); return ATCE::PERM; } @@ -3358,22 +3366,22 @@ ATCE atcommand_recallall(Session *s, dumb_ptr<map_session_data> sd, if (pl_sd && pl_sd->state.auth && sd->status_key.account_id != pl_sd->status_key.account_id - && pc_isGM(sd) >= pc_isGM(pl_sd)) + && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can recall only lower or same level if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) count++; else pc_setpos(pl_sd, sd->mapname_, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT); } } - clif_displaymessage(s, "All characters recalled!"); + clif_displaymessage(s, "All characters recalled!"_s); if (count) { AString output = STRPRINTF( - "Because you are not authorised to warp from some maps, %d player(s) have not been recalled.", + "Because you are not authorised to warp from some maps, %d player(s) have not been recalled."_fmt, count); clif_displaymessage(s, output); } @@ -3386,23 +3394,23 @@ ATCE atcommand_partyrecall(Session *s, dumb_ptr<map_session_data> sd, ZString message) { PartyName party_name; - struct party *p; + PartyPair p; int count; if (!extract(message, &party_name) || !party_name) return ATCE::USAGE; if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp somenone to your actual map."); + "You are not authorised to warp somenone to your actual map."_s); return ATCE::PERM; } - if ((p = party_searchname(party_name)) != NULL || + if ((p = party_searchname(party_name)) || // name first to avoid error when name begin with a number - (p = party_search(atoi(message.c_str()))) != NULL) + (p = party_search(wrap<PartyId>(static_cast<uint32_t>(atoi(message.c_str())))))) { count = 0; for (io::FD i : iter_fds()) @@ -3413,28 +3421,28 @@ ATCE atcommand_partyrecall(Session *s, dumb_ptr<map_session_data> sd, dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get())); if (pl_sd && pl_sd->state.auth && sd->status_key.account_id != pl_sd->status_key.account_id - && pl_sd->status.party_id == p->party_id) + && pl_sd->status.party_id == p.party_id) { if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) count++; else pc_setpos(pl_sd, sd->mapname_, sd->bl_x, sd->bl_y, BeingRemoveWhy::QUIT); } } - AString output = STRPRINTF("All online characters of the %s party are near you.", p->name); + AString output = STRPRINTF("All online characters of the %s party are near you."_fmt, p->name); clif_displaymessage(s, output); if (count) { output = STRPRINTF( - "Because you are not authorised to warp from some maps, %d player(s) have not been recalled.", + "Because you are not authorised to warp from some maps, %d player(s) have not been recalled."_fmt, count); clif_displaymessage(s, output); } } else { - clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online."); + clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online."_s); return ATCE::EXIST; } @@ -3445,9 +3453,9 @@ static ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd, ZString message) { - dumb_ptr<npc_data> nd = NULL; + dumb_ptr<npc_data> nd = nullptr; MapName map_name; - const char *direction = NULL; + LString direction = ""_s; int list = 0; extract(message, record<' '>(&list, &map_name)); @@ -3462,35 +3470,35 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd, if (m_id != nullptr) return ATCE::EXIST; - clif_displaymessage(s, "------ Map Info ------"); - AString output = STRPRINTF("Map Name: %s", map_name); + clif_displaymessage(s, "------ Map Info ------"_s); + AString output = STRPRINTF("Map Name: %s"_fmt, map_name); clif_displaymessage(s, output); - output = STRPRINTF("Players In Map: %d", m_id->users); + output = STRPRINTF("Players In Map: %d"_fmt, m_id->users); clif_displaymessage(s, output); - output = STRPRINTF("NPCs In Map: %d", m_id->npc_num); + output = STRPRINTF("NPCs In Map: %d"_fmt, m_id->npc_num); clif_displaymessage(s, output); - clif_displaymessage(s, "------ Map Flags ------"); - output = STRPRINTF("Player vs Player: %s | No Party: %s", - (m_id->flag.get(MapFlag::PVP)) ? "True" : "False", - (m_id->flag.get(MapFlag::PVP_NOPARTY)) ? "True" : "False"); + clif_displaymessage(s, "------ Map Flags ------"_s); + output = STRPRINTF("Player vs Player: %s | No Party: %s"_fmt, + (m_id->flag.get(MapFlag::PVP)) ? "True"_s : "False"_s, + (m_id->flag.get(MapFlag::PVP_NOPARTY)) ? "True"_s : "False"_s); clif_displaymessage(s, output); - output = STRPRINTF("No Penalty: %s", - (m_id->flag.get(MapFlag::NOPENALTY)) ? "True" : "False"); + output = STRPRINTF("No Penalty: %s"_fmt, + (m_id->flag.get(MapFlag::NOPENALTY)) ? "True"_s : "False"_s); clif_displaymessage(s, output); - output = STRPRINTF("No Return: %s", - (m_id->flag.get(MapFlag::NORETURN)) ? "True" : "False"); + output = STRPRINTF("No Return: %s"_fmt, + (m_id->flag.get(MapFlag::NORETURN)) ? "True"_s : "False"_s); clif_displaymessage(s, output); - output = STRPRINTF("No Save: %s", - (m_id->flag.get(MapFlag::NOSAVE)) ? "True" : "False"); + output = STRPRINTF("No Save: %s"_fmt, + (m_id->flag.get(MapFlag::NOSAVE)) ? "True"_s : "False"_s); clif_displaymessage(s, output); - output = STRPRINTF("Re Save: %s", - (m_id->flag.get(MapFlag::RESAVE)) ? "True" : "False"); + output = STRPRINTF("Re Save: %s"_fmt, + (m_id->flag.get(MapFlag::RESAVE)) ? "True"_s : "False"_s); clif_displaymessage(s, output); - output = STRPRINTF("No Teleport: %s", - (m_id->flag.get(MapFlag::NOTELEPORT)) ? "True" : "False"); + output = STRPRINTF("No Teleport: %s"_fmt, + (m_id->flag.get(MapFlag::NOTELEPORT)) ? "True"_s : "False"_s); clif_displaymessage(s, output); - output = STRPRINTF("No Monster Teleport: %s", - (m_id->flag.get(MapFlag::MONSTER_NOTELEPORT)) ? "True" : "False"); + output = STRPRINTF("No Monster Teleport: %s"_fmt, + (m_id->flag.get(MapFlag::MONSTER_NOTELEPORT)) ? "True"_s : "False"_s); clif_displaymessage(s, output); switch (list) @@ -3499,7 +3507,7 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd, // Do nothing. It's list 0, no additional display. break; case 1: - clif_displaymessage(s, "----- Players in Map -----"); + clif_displaymessage(s, "----- Players in Map -----"_s); for (io::FD i : iter_fds()) { Session *s2 = get_session(i); @@ -3510,54 +3518,54 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd, && pl_sd->mapname_ == map_name) { output = STRPRINTF( - "Player '%s' (session #%d) | Location: %d,%d", + "Player '%s' (session #%d) | Location: %d,%d"_fmt, pl_sd->status_key.name, s2, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(s, output); } } break; case 2: - clif_displaymessage(s, "----- NPCs in Map -----"); + clif_displaymessage(s, "----- NPCs in Map -----"_s); for (int i = 0; i < m_id->npc_num;) { nd = m_id->npc[i]; switch (nd->dir) { case DIR::S: - direction = "North"; + direction = "North"_s; break; case DIR::SW: - direction = "North West"; + direction = "North West"_s; break; case DIR::W: - direction = "West"; + direction = "West"_s; break; case DIR::NW: - direction = "South West"; + direction = "South West"_s; break; case DIR::N: - direction = "South"; + direction = "South"_s; break; case DIR::NE: - direction = "South East"; + direction = "South East"_s; break; case DIR::E: - direction = "East"; + direction = "East"_s; break; case DIR::SE: - direction = "North East"; + direction = "North East"_s; break; #if 0 case 9: - direction = "North"; + direction = "North"_s; break; #endif default: - direction = "Unknown"; + direction = "Unknown"_s; break; } output = STRPRINTF( - "NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d", + "NPC %d: %s | Direction: %s | Sprite: %d | Location: %d %d"_fmt, ++i, nd->name, direction, nd->npc_class, nd->bl_x, nd->bl_y); clif_displaymessage(s, output); @@ -3566,7 +3574,7 @@ ATCE atcommand_mapinfo(Session *s, dumb_ptr<map_session_data> sd, default: // normally impossible to arrive here clif_displaymessage(s, - "Please, enter at least a valid list number (usage: @mapinfo <0-2> [map])."); + "Please, enter at least a valid list number (usage: @mapinfo <0-2> [map])."_s); return ATCE::USAGE; } @@ -3582,27 +3590,27 @@ ATCE atcommand_partyspy(Session *s, dumb_ptr<map_session_data> sd, if (!extract(message, &party_name)) return ATCE::USAGE; - struct party *p; - if ((p = party_searchname(party_name)) != NULL || + PartyPair p; + if ((p = party_searchname(party_name)) || // name first to avoid error when name begin with a number - (p = party_search(atoi(message.c_str()))) != NULL) + (p = party_search(wrap<PartyId>(static_cast<uint32_t>(atoi(message.c_str())))))) { - if (sd->partyspy == p->party_id) + if (sd->partyspy == p.party_id) { - sd->partyspy = 0; - AString output = STRPRINTF("No longer spying on the %s party.", p->name); + sd->partyspy = PartyId(); + AString output = STRPRINTF("No longer spying on the %s party."_fmt, p->name); clif_displaymessage(s, output); } else { - sd->partyspy = p->party_id; - AString output = STRPRINTF("Spying on the %s party.", p->name); + sd->partyspy = p.party_id; + AString output = STRPRINTF("Spying on the %s party."_fmt, p->name); clif_displaymessage(s, output); } } else { - clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online."); + clif_displaymessage(s, "Incorrect name or ID, or no one from the party is online."_s); return ATCE::EXIST; } @@ -3618,14 +3626,14 @@ ATCE atcommand_enablenpc(Session *s, dumb_ptr<map_session_data>, if (!extract(message, &NPCname) || !NPCname) return ATCE::USAGE; - if (npc_name2id(NPCname) != NULL) + if (npc_name2id(NPCname) != nullptr) { npc_enable(NPCname, 1); - clif_displaymessage(s, "Npc Enabled."); + clif_displaymessage(s, "Npc Enabled."_s); } else { - clif_displaymessage(s, "This NPC doesn't exist."); + clif_displaymessage(s, "This NPC doesn't exist."_s); return ATCE::EXIST; } @@ -3641,14 +3649,14 @@ ATCE atcommand_disablenpc(Session *s, dumb_ptr<map_session_data>, if (!extract(message, &NPCname) || !NPCname) return ATCE::USAGE; - if (npc_name2id(NPCname) != NULL) + if (npc_name2id(NPCname) != nullptr) { npc_enable(NPCname, 0); - clif_displaymessage(s, "Npc Disabled."); + clif_displaymessage(s, "Npc Disabled."_s); } else { - clif_displaymessage(s, "This NPC doesn't exist."); + clif_displaymessage(s, "This NPC doesn't exist."_s); return ATCE::EXIST; } @@ -3661,7 +3669,7 @@ ATCE atcommand_servertime(Session *s, dumb_ptr<map_session_data>, { timestamp_seconds_buffer tsbuf; stamp_time(tsbuf); - AString temp = STRPRINTF("Server time: %s", tsbuf); + AString temp = STRPRINTF("Server time: %s"_fmt, tsbuf); clif_displaymessage(s, temp); return ATCE::OKAY; @@ -3673,33 +3681,32 @@ ATCE atcommand_chardelitem(Session *s, dumb_ptr<map_session_data> sd, { CharName character; XString item_name; - int i, number = 0, item_id, item_position, count; + int i, number = 0; + ItemNameId item_id; + int count; struct item_data *item_data; if (!asplit(message, &item_name, &number, &character) || number < 1) return ATCE::USAGE; - item_id = 0; - if ((item_data = itemdb_searchname(item_name)) != NULL) + if ((item_data = itemdb_searchname(item_name)) != nullptr) item_id = item_data->nameid; - else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != NULL) + else if (extract(item_name, &item_id) && (item_data = itemdb_exists(item_id)) != nullptr) item_id = item_data->nameid; - else - item_id = 0; - if (item_id > 500) + if (item_id) { dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can kill only lower or same level - item_position = pc_search_inventory(pl_sd, item_id); - if (item_position >= 0) + IOff0 item_position = pc_search_inventory(pl_sd, item_id); + if (item_position.ok()) { count = 0; - for (i = 0; i < number && item_position >= 0; i++) + for (i = 0; i < number && item_position.ok(); i++) { pc_delitem(pl_sd, item_position, 1, 0); count++; @@ -3707,37 +3714,37 @@ ATCE atcommand_chardelitem(Session *s, dumb_ptr<map_session_data> sd, // for next loop } AString output = STRPRINTF( - "%d item(s) removed by a GM.", + "%d item(s) removed by a GM."_fmt, count); clif_displaymessage(pl_sd->sess, output); if (number == count) - output = STRPRINTF("%d item(s) removed from the player.", count); + output = STRPRINTF("%d item(s) removed from the player."_fmt, count); else - output = STRPRINTF("%d item(s) removed. Player had only %d on %d items.", count, count, number); + output = STRPRINTF("%d item(s) removed. Player had only %d on %d items."_fmt, count, count, number); clif_displaymessage(s, output); } else { - clif_displaymessage(s, "Character does not have the item."); + clif_displaymessage(s, "Character does not have the item."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } } else { - clif_displaymessage(s, "Invalid item ID or name."); + clif_displaymessage(s, "Invalid item ID or name."_s); return ATCE::RANGE; } @@ -3751,7 +3758,7 @@ ATCE atcommand_broadcast(Session *, dumb_ptr<map_session_data> sd, if (!message) return ATCE::USAGE; - AString output = STRPRINTF("%s : %s", sd->status_key.name, message); + AString output = STRPRINTF("%s : %s"_fmt, sd->status_key.name, message); intif_GMmessage(output); return ATCE::OKAY; @@ -3764,7 +3771,7 @@ ATCE atcommand_localbroadcast(Session *, dumb_ptr<map_session_data> sd, if (!message) return ATCE::USAGE; - AString output = STRPRINTF("%s : %s", sd->status_key.name, message); + AString output = STRPRINTF("%s : %s"_fmt, sd->status_key.name, message); clif_GMmessage(sd, output, 1); @@ -3783,28 +3790,28 @@ ATCE atcommand_email(Session *s, dumb_ptr<map_session_data> sd, if (!e_mail_check(actual_email)) { - clif_displaymessage(s, "Invalid actual email. If you have default e-mail, type a@a.com."); + clif_displaymessage(s, "Invalid actual email. If you have default e-mail, type a@a.com."_s); return ATCE::RANGE; } else if (!e_mail_check(new_email)) { - clif_displaymessage(s, "Invalid new email. Please enter a real e-mail."); + clif_displaymessage(s, "Invalid new email. Please enter a real e-mail."_s); return ATCE::RANGE; } else if (new_email == DEFAULT_EMAIL) { - clif_displaymessage(s, "New email must be a real e-mail."); + clif_displaymessage(s, "New email must be a real e-mail."_s); return ATCE::RANGE; } else if (actual_email == new_email) { - clif_displaymessage(s, "New email must be different of the actual e-mail."); + clif_displaymessage(s, "New email must be different of the actual e-mail."_s); return ATCE::RANGE; } else { chrif_changeemail(sd->status_key.account_id, actual_email, new_email); - clif_displaymessage(s, "Information sended to login-server via char-server."); + clif_displaymessage(s, "Information sended to login-server via char-server."_s); } return ATCE::OKAY; @@ -3821,7 +3828,7 @@ ATCE atcommand_effect(Session *s, dumb_ptr<map_session_data> sd, if (flag <= 0) { clif_specialeffect(sd, type, flag); - clif_displaymessage(s, "Your Effect Has Changed."); + clif_displaymessage(s, "Your Effect Has Changed."_s); } else { @@ -3834,7 +3841,7 @@ ATCE atcommand_effect(Session *s, dumb_ptr<map_session_data> sd, if (pl_sd && pl_sd->state.auth) { clif_specialeffect(pl_sd, type, flag); - clif_displaymessage(pl_sd->sess, "Your Effect Has Changed."); + clif_displaymessage(pl_sd->sess, "Your Effect Has Changed."_s); } } } @@ -3846,34 +3853,34 @@ static ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, ZString message) { - struct item_data *item_data = NULL; - int i, count, counter; + struct item_data *item_data = nullptr; + int count, counter; CharName character; if (!asplit(message, &character)) return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can look items only lower or same level counter = 0; count = 0; - for (i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { - if (pl_sd->status.inventory[i].nameid > 0 + if (pl_sd->status.inventory[i].nameid && (item_data = itemdb_search(pl_sd->status.inventory[i].nameid)) != - NULL) + nullptr) { counter = counter + pl_sd->status.inventory[i].amount; count++; if (count == 1) { AString output = STRPRINTF( - "------ Items list of '%s' ------", + "------ Items list of '%s' ------"_fmt, pl_sd->status_key.name); clif_displaymessage(s, output); } @@ -3881,35 +3888,35 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, MString equipstr; if (bool(equip)) { - equipstr += "| equiped: "; + equipstr += "| equiped: "_s; if (bool(equip & EPOS::GLOVES)) - equipstr += "robe/gargment, "; + equipstr += "robe/gargment, "_s; if (bool(equip & EPOS::CAPE)) - equipstr += "left accessory, "; + equipstr += "left accessory, "_s; if (bool(equip & EPOS::MISC1)) - equipstr += "body/armor, "; + equipstr += "body/armor, "_s; if ((equip & (EPOS::WEAPON | EPOS::SHIELD)) == EPOS::WEAPON) - equipstr += "right hand, "; + equipstr += "right hand, "_s; if ((equip & (EPOS::WEAPON | EPOS::SHIELD)) == EPOS::SHIELD) - equipstr += "left hand, "; + equipstr += "left hand, "_s; if ((equip & (EPOS::WEAPON | EPOS::SHIELD)) == (EPOS::WEAPON | EPOS::SHIELD)) - equipstr += "both hands, "; + equipstr += "both hands, "_s; if (bool(equip & EPOS::SHOES)) - equipstr += "feet, "; + equipstr += "feet, "_s; if (bool(equip & EPOS::MISC2)) - equipstr += "right accessory, "; + equipstr += "right accessory, "_s; if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == EPOS::LEGS) - equipstr += "lower head, "; + equipstr += "lower head, "_s; if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == EPOS::HAT) - equipstr += "top head, "; + equipstr += "top head, "_s; if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == (EPOS::HAT | EPOS::LEGS)) - equipstr += "lower/top head, "; + equipstr += "lower/top head, "_s; if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == EPOS::TORSO) - equipstr += "mid head, "; + equipstr += "mid head, "_s; if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == (EPOS::TORSO | EPOS::LEGS)) - equipstr += "lower/mid head, "; + equipstr += "lower/mid head, "_s; if ((equip & (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) == (EPOS::TORSO | EPOS::HAT | EPOS::LEGS)) - equipstr += "lower/mid/top head, "; + equipstr += "lower/mid/top head, "_s; // remove final ', ' equipstr.pop_back(2); } @@ -3918,35 +3925,35 @@ ATCE atcommand_character_item_list(Session *s, dumb_ptr<map_session_data> sd, AString output; if (true) - output = STRPRINTF("%d %s (%s, id: %d) %s", - pl_sd->status.inventory[i].amount, - item_data->name, item_data->jname, - pl_sd->status.inventory[i].nameid, - AString(equipstr)); + output = STRPRINTF("%d %s (%s, id: %d) %s"_fmt, + pl_sd->status.inventory[i].amount, + item_data->name, item_data->jname, + pl_sd->status.inventory[i].nameid, + AString(equipstr)); clif_displaymessage(s, output); // snip cards } } if (count == 0) - clif_displaymessage(s, "No item found on this player."); + clif_displaymessage(s, "No item found on this player."_s); else { AString output = STRPRINTF( - "%d item(s) found in %d kind(s) of items.", + "%d item(s) found in %d kind(s) of items."_fmt, counter, count); clif_displaymessage(s, output); } } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -3957,74 +3964,74 @@ static ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd, ZString message) { - struct storage *stor; - struct item_data *item_data = NULL; - int i, count, counter; + Storage *stor; + struct item_data *item_data = nullptr; + int count, counter; CharName character; if (!asplit(message, &character)) return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) + if (pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can look items only lower or same level - if ((stor = account2storage2(pl_sd->status_key.account_id)) != NULL) + if ((stor = account2storage2(pl_sd->status_key.account_id)) != nullptr) { counter = 0; count = 0; - for (i = 0; i < MAX_STORAGE; i++) + for (SOff0 i : SOff0::iter()) { - if (stor->storage_[i].nameid > 0 + if (stor->storage_[i].nameid && (item_data = - itemdb_search(stor->storage_[i].nameid)) != NULL) + itemdb_search(stor->storage_[i].nameid)) != nullptr) { counter = counter + stor->storage_[i].amount; count++; if (count == 1) { AString output = STRPRINTF( - "------ Storage items list of '%s' ------", + "------ Storage items list of '%s' ------"_fmt, pl_sd->status_key.name); clif_displaymessage(s, output); } AString output; if (true) - output = STRPRINTF("%d %s (%s, id: %d)", - stor->storage_[i].amount, - item_data->name, item_data->jname, - stor->storage_[i].nameid); + output = STRPRINTF("%d %s (%s, id: %d)"_fmt, + stor->storage_[i].amount, + item_data->name, item_data->jname, + stor->storage_[i].nameid); clif_displaymessage(s, output); } } if (count == 0) clif_displaymessage(s, - "No item found in the storage of this player."); + "No item found in the storage of this player."_s); else { AString output = STRPRINTF( - "%d item(s) found in %d kind(s) of items.", + "%d item(s) found in %d kind(s) of items."_fmt, counter, count); clif_displaymessage(s, output); } } else { - clif_displaymessage(s, "This player has no storage."); + clif_displaymessage(s, "This player has no storage."_s); return ATCE::OKAY; } } else { - clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."); + clif_displaymessage(s, "Your GM level don't authorise you to do this action on this player."_s); return ATCE::PERM; } } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -4038,9 +4045,9 @@ ATCE atcommand_killer(Session *s, dumb_ptr<map_session_data> sd, sd->special_state.killer = !sd->special_state.killer; if (sd->special_state.killer) - clif_displaymessage(s, "You be a killa..."); + clif_displaymessage(s, "You be a killa..."_s); else - clif_displaymessage(s, "You gonna be own3d..."); + clif_displaymessage(s, "You gonna be own3d..."_s); return ATCE::OKAY; } @@ -4055,20 +4062,20 @@ ATCE atcommand_charkiller(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; pl_sd->special_state.killer = !pl_sd->special_state.killer; if (pl_sd->special_state.killer) { - clif_displaymessage(s, "The player is now a killer"); - clif_displaymessage(pl_sd->sess, "You are now a killer"); + clif_displaymessage(s, "The player is now a killer"_s); + clif_displaymessage(pl_sd->sess, "You are now a killer"_s); } else { - clif_displaymessage(s, "The player is no longer a killer"); - clif_displaymessage(pl_sd->sess, "You are no longer a killer"); + clif_displaymessage(s, "The player is no longer a killer"_s); + clif_displaymessage(pl_sd->sess, "You are no longer a killer"_s); } return ATCE::OKAY; @@ -4081,9 +4088,9 @@ ATCE atcommand_killable(Session *s, dumb_ptr<map_session_data> sd, sd->special_state.killable = !sd->special_state.killable; if (sd->special_state.killable) - clif_displaymessage(s, "You gonna be own3d..."); + clif_displaymessage(s, "You gonna be own3d..."_s); else - clif_displaymessage(s, "You be a killa..."); + clif_displaymessage(s, "You be a killa..."_s); return ATCE::OKAY; } @@ -4098,15 +4105,15 @@ ATCE atcommand_charkillable(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; pl_sd->special_state.killable = !pl_sd->special_state.killable; if (pl_sd->special_state.killable) - clif_displaymessage(s, "The player is now killable"); + clif_displaymessage(s, "The player is now killable"_s); else - clif_displaymessage(s, "The player is no longer killable"); + clif_displaymessage(s, "The player is no longer killable"_s); return ATCE::OKAY; } @@ -4117,13 +4124,13 @@ ATCE atcommand_npcmove(Session *, dumb_ptr<map_session_data>, { NpcName character; int x = 0, y = 0; - dumb_ptr<npc_data> nd = 0; + dumb_ptr<npc_data> nd = nullptr; if (!asplit(message, &x, &y, &character)) return ATCE::USAGE; nd = npc_name2id(character); - if (nd == NULL) + if (nd == nullptr) return ATCE::EXIST; npc_enable(character, 0); @@ -4146,17 +4153,17 @@ ATCE atcommand_addwarp(Session *s, dumb_ptr<map_session_data> sd, if (!extract(message, record<' '>(&mapname, &x, &y))) return ATCE::USAGE; - AString w1 = STRPRINTF("%s,%d,%d", sd->mapname_, sd->bl_x, sd->bl_y); - AString w3 = STRPRINTF("%s%d%d%d%d", mapname, sd->bl_x, sd->bl_y, x, y); - AString w4 = STRPRINTF("1,1,%s.gat,%d,%d", mapname, x, y); + AString w1 = STRPRINTF("%s,%d,%d"_fmt, sd->mapname_, sd->bl_x, sd->bl_y); + AString w3 = STRPRINTF("%s%d%d%d%d"_fmt, mapname, sd->bl_x, sd->bl_y, x, y); + AString w4 = STRPRINTF("1,1,%s.gat,%d,%d"_fmt, mapname, x, y); NpcName w3name = stringish<NpcName>(w3); - int ret = npc_parse_warp(w1, ZString("warp"), w3name, w4); + int ret = npc_parse_warp(w1, "warp"_s, w3name, w4); if (ret) // warp failed return ATCE::RANGE; - AString output = STRPRINTF("New warp NPC => %s", w3); + AString output = STRPRINTF("New warp NPC => %s"_fmt, w3); clif_displaymessage(s, output); return ATCE::OKAY; @@ -4173,11 +4180,11 @@ ATCE atcommand_chareffect(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(target); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; clif_specialeffect(pl_sd, type, 0); - clif_displaymessage(s, "Your Effect Has Changed."); + clif_displaymessage(s, "Your Effect Has Changed."_s); return ATCE::OKAY; } @@ -4186,8 +4193,7 @@ static ATCE atcommand_dropall(Session *, dumb_ptr<map_session_data> sd, ZString) { - int i; - for (i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { if (sd->status.inventory[i].amount) { @@ -4208,9 +4214,9 @@ ATCE atcommand_chardropall(Session *s, dumb_ptr<map_session_data>, if (!asplit(message, &character)) return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; - for (int i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { if (pl_sd->status.inventory[i].amount) { @@ -4220,9 +4226,8 @@ ATCE atcommand_chardropall(Session *s, dumb_ptr<map_session_data>, } } - clif_displaymessage(pl_sd->sess, "Ever play 52 card pickup?"); - clif_displaymessage(s, "It is done"); - //clif_displaymessage(s, "It is offical.. your a jerk"); + clif_displaymessage(pl_sd->sess, "Ever play 52 card pickup?"_s); + clif_displaymessage(s, "It is official.. you're a jerk."_s); return ATCE::OKAY; } @@ -4231,8 +4236,6 @@ static ATCE atcommand_storeall(Session *s, dumb_ptr<map_session_data> sd, ZString) { - int i; - if (!sd->state.storage_open) { //Open storage. @@ -4240,16 +4243,16 @@ ATCE atcommand_storeall(Session *s, dumb_ptr<map_session_data> sd, { case 2: //Try again - clif_displaymessage(s, "run this command again.."); + clif_displaymessage(s, "run this command again.."_s); return ATCE::OKAY; case 1: //Failure clif_displaymessage(s, - "You can't open the storage currently."); + "You can't open the storage currently."_s); return ATCE::EXIST; } } - for (i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { if (sd->status.inventory[i].amount) { @@ -4260,7 +4263,7 @@ ATCE atcommand_storeall(Session *s, dumb_ptr<map_session_data> sd, } storage_storageclose(sd); - clif_displaymessage(s, "It is done"); + clif_displaymessage(s, "It is done"_s); return ATCE::OKAY; } @@ -4273,7 +4276,7 @@ ATCE atcommand_charstoreall(Session *s, dumb_ptr<map_session_data> sd, if (!asplit(message, &character)) return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; if (storage_storageopen(pl_sd) == 1) @@ -4281,11 +4284,11 @@ ATCE atcommand_charstoreall(Session *s, dumb_ptr<map_session_data> sd, // TODO figure out what the hell this is talking about, // and especially why it's different from the other one. clif_displaymessage(s, - "Had to open the characters storage window..."); - clif_displaymessage(s, "run this command again.."); + "Had to open the characters storage window..."_s); + clif_displaymessage(s, "run this command again.."_s); return ATCE::OKAY; } - for (int i = 0; i < MAX_INVENTORY; i++) + for (IOff0 i : IOff0::iter()) { if (pl_sd->status.inventory[i].amount) { @@ -4297,12 +4300,12 @@ ATCE atcommand_charstoreall(Session *s, dumb_ptr<map_session_data> sd, storage_storageclose(pl_sd); clif_displaymessage(pl_sd->sess, - "Everything you own has been put away for safe keeping."); + "Everything you own has been put away for safe keeping."_s); clif_displaymessage(pl_sd->sess, - "go to the nearest kafka to retrieve it.."); - clif_displaymessage(pl_sd->sess, " -- the management"); + "go to the nearest kafka to retrieve it.."_s); + clif_displaymessage(pl_sd->sess, " -- the management"_s); - clif_displaymessage(s, "It is done"); + clif_displaymessage(s, "It is done"_s); return ATCE::OKAY; } @@ -4383,31 +4386,30 @@ ATCE atcommand_summon(Session *, dumb_ptr<map_session_data> sd, ZString message) { MobName name; - int mob_id = 0; + Species mob_id; int x = 0; int y = 0; - int id = 0; tick_t tick = gettick(); if (!extract(message, &name) || !name) return ATCE::USAGE; - if ((mob_id = atoi(name.c_str())) == 0) + if ((mob_id = wrap<Species>(static_cast<uint16_t>(atoi(name.c_str())))) == Species()) mob_id = mobdb_searchname(name); - if (mob_id == 0) + if (mob_id == Species()) return ATCE::EXIST; x = sd->bl_x + random_::in(-5, 4); y = sd->bl_y + random_::in(-5, 4); - id = mob_once_spawn(sd, MOB_THIS_MAP, x, y, JAPANESE_NAME, mob_id, 1, NpcEvent()); + BlockId id = mob_once_spawn(sd, MOB_THIS_MAP, x, y, JAPANESE_NAME, mob_id, 1, NpcEvent()); dumb_ptr<mob_data> md = map_id_is_mob(id); if (md) { md->master_id = sd->bl_id; md->state.special_mob_ai = 1; - md->mode = mob_db[md->mob_class].mode | MobMode::AGGRESSIVE; - md->deletetimer = Timer(tick + std::chrono::minutes(1), + md->mode = get_mob_db(md->mob_class).mode | MobMode::AGGRESSIVE; + md->deletetimer = Timer(tick + 1_min, std::bind(mob_timer_delete, ph::_1, ph::_2, id)); clif_misceffect(md, 344); @@ -4420,12 +4422,12 @@ static ATCE atcommand_adjcmdlvl(Session *s, dumb_ptr<map_session_data>, ZString message) { - int newlev; + GmLevel newlev; XString cmd; if (!extract(message, record<' '>(&newlev, &cmd))) { - clif_displaymessage(s, "usage: @adjcmdlvl <lvl> <command>."); + clif_displaymessage(s, "usage: @adjcmdlvl <lvl> <command>."_s); return ATCE::USAGE; } @@ -4434,12 +4436,12 @@ ATCE atcommand_adjcmdlvl(Session *s, dumb_ptr<map_session_data>, if (it) { it->level = newlev; - clif_displaymessage(s, "@command level changed."); + clif_displaymessage(s, "@command level changed."_s); return ATCE::OKAY; } } - clif_displaymessage(s, "@command not found."); + clif_displaymessage(s, "@command not found."_s); return ATCE::EXIST; } @@ -4447,18 +4449,17 @@ static ATCE atcommand_adjgmlvl(Session *s, dumb_ptr<map_session_data>, ZString message) { - int newlev; + GmLevel newlev; CharName user; - if (!asplit(message, &newlev, &user) - || newlev < 0 || newlev > 99) + if (!asplit(message, &newlev, &user)) { - clif_displaymessage(s, "usage: @adjgmlvl <lvl> <user>."); + clif_displaymessage(s, "usage: @adjgmlvl <lvl> <user>."_s); return ATCE::USAGE; } dumb_ptr<map_session_data> pl_sd = map_nick2sd(user); - if (pl_sd == NULL) + if (pl_sd == nullptr) return ATCE::EXIST; pc_set_gm_level(pl_sd->status_key.account_id, newlev); @@ -4501,14 +4502,14 @@ constexpr size_t magic_skills_nr = sizeof(magic_skills) / sizeof(magic_skills[0]); static -ZString magic_skill_names[magic_skills_nr] = +LString magic_skill_names[magic_skills_nr] = { - {"magic"}, - {"life"}, - {"war"}, - {"transmute"}, - {"nature"}, - {"astral"}, + "magic"_s, + "life"_s, + "war"_s, + "transmute"_s, + "nature"_s, + "astral"_s, }; static @@ -4524,7 +4525,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>, if (pl_sd) { AString buf = STRPRINTF( - "`%s' has the following magic skills:", + "`%s' has the following magic skills:"_fmt, character); clif_displaymessage(s, buf); @@ -4532,7 +4533,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>, { SkillID sk = magic_skills[i]; buf = STRPRINTF( - "%d in %s", + "%d in %s"_fmt, pl_sd->status.skill[sk].lv, magic_skill_names[i]); if (pl_sd->status.skill[sk].lv) @@ -4542,7 +4543,7 @@ ATCE atcommand_magic_info(Session *s, dumb_ptr<map_session_data>, return ATCE::OKAY; } - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -4563,12 +4564,12 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>, if (!asplit(message, &magic_type, &value, &character)) { clif_displaymessage(s, - "Usage: @setmagic <school> <value> <char-name>, where <school> is either `magic', one of the school names, or `all'."); + "Usage: @setmagic <school> <value> <char-name>, where <school> is either `magic', one of the school names, or `all'."_s); return ATCE::USAGE; } SkillID skill_index = SkillID::NEGATIVE; - if ("all" == magic_type) + if ("all"_s == magic_type) skill_index = SkillID::ZERO; else { @@ -4585,12 +4586,12 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>, if (skill_index == SkillID::NEGATIVE) { clif_displaymessage(s, - "Incorrect school of magic. Use `magic', `nature', `life', `war', `transmute', `ether', or `all'."); + "Incorrect school of magic. Use `magic', `nature', `life', `war', `transmute', `ether', or `all'."_s); return ATCE::RANGE; } dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (skill_index == SkillID::ZERO) for (SkillID sk : magic_skills) @@ -4602,7 +4603,7 @@ ATCE atcommand_set_magic(Session *s, dumb_ptr<map_session_data>, return ATCE::OKAY; } - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -4661,21 +4662,21 @@ ATCE atcommand_jump_iterate(Session *s, dumb_ptr<map_session_data> sd, } if (pl_sd->bl_m && pl_sd->bl_m->flag.get(MapFlag::NOWARPTO) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you to the map of this player."); + "You are not authorised to warp you to the map of this player."_s); return ATCE::PERM; } if (sd->bl_m && sd->bl_m->flag.get(MapFlag::NOWARP) - && battle_config.any_warp_GM_min_level > pc_isGM(sd)) + && !(pc_isGM(sd).satisfies(GmLevel::from(static_cast<uint32_t>(battle_config.any_warp_GM_min_level))))) { clif_displaymessage(s, - "You are not authorised to warp you from your actual map."); + "You are not authorised to warp you from your actual map."_s); return ATCE::PERM; } pc_setpos(sd, pl_sd->bl_m->name_, pl_sd->bl_x, pl_sd->bl_y, BeingRemoveWhy::WARPED); - AString output = STRPRINTF("Jump to %s", pl_sd->status_key.name); + AString output = STRPRINTF("Jump to %s"_fmt, pl_sd->status_key.name); clif_displaymessage(s, output); sd->followtarget = pl_sd->bl_id; @@ -4702,9 +4703,9 @@ ATCE atcommand_wgm(Session *s, dumb_ptr<map_session_data> sd, if (tmw_CheckChatSpam(sd, message)) return ATCE::OKAY; - tmw_GmHackMsg(STRPRINTF("[GM] %s: %s", sd->status_key.name, message)); + tmw_GmHackMsg(STRPRINTF("[GM] %s: %s"_fmt, sd->status_key.name, message)); if (!pc_isGM(sd)) - clif_displaymessage(s, "Message sent."); + clif_displaymessage(s, "Message sent."_s); return ATCE::OKAY; } @@ -4720,26 +4721,26 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { SkillID pool_skills[MAX_SKILL_POOL]; int pool_skills_nr = skill_pool(pl_sd, pool_skills); int i; AString buf = STRPRINTF( - "Active skills %d out of %d for %s:", + "Active skills %d out of %d for %s:"_fmt, pool_skills_nr, skill_pool_max(pl_sd), character); clif_displaymessage(s, buf); for (i = 0; i < pool_skills_nr; ++i) { - buf = STRPRINTF(" - %s [%d]: power %d", + buf = STRPRINTF(" - %s [%d]: power %d"_fmt, skill_name(pool_skills[i]), pool_skills[i], skill_power(pl_sd, pool_skills[i])); clif_displaymessage(s, buf); } - buf = STRPRINTF("Learned skills out of %d for %s:", + buf = STRPRINTF("Learned skills out of %d for %s:"_fmt, skill_pool_skills_size, character); clif_displaymessage(s, buf); @@ -4750,7 +4751,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>, if (lvl) { - buf = STRPRINTF(" - %s [%d]: lvl %d", + buf = STRPRINTF(" - %s [%d]: lvl %d"_fmt, name, skill_pool_skills[i], lvl); clif_displaymessage(s, buf); } @@ -4759,7 +4760,7 @@ ATCE atcommand_skillpool_info(Session *s, dumb_ptr<map_session_data>, } else { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -4775,20 +4776,20 @@ ATCE atcommand_skillpool_focus(Session *s, dumb_ptr<map_session_data>, if (!asplit(message, &skill, &character)) { - clif_displaymessage(s, "Usage: @sp-focus <skill-nr> <char_name>"); + clif_displaymessage(s, "Usage: @sp-focus <skill-nr> <char_name>"_s); return ATCE::USAGE; } dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (skill_pool_activate(pl_sd, skill)) - clif_displaymessage(s, "Activation failed."); + clif_displaymessage(s, "Activation failed."_s); else - clif_displaymessage(s, "Activation successful."); + clif_displaymessage(s, "Activation successful."_s); } else - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::OKAY; } @@ -4804,15 +4805,15 @@ ATCE atcommand_skillpool_unfocus(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { if (skill_pool_deactivate(pl_sd, skill)) - clif_displaymessage(s, "Deactivation failed."); + clif_displaymessage(s, "Deactivation failed."_s); else - clif_displaymessage(s, "Deactivation successful."); + clif_displaymessage(s, "Deactivation successful."_s); } else - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::OKAY; } @@ -4829,13 +4830,13 @@ ATCE atcommand_skill_learn(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd != NULL) + if (pl_sd != nullptr) { set_skill(pl_sd, skill, level); clif_skillinfoblock(pl_sd); } else - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::OKAY; } @@ -4850,9 +4851,9 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>, return ATCE::USAGE; dumb_ptr<map_session_data> pl_sd = map_nick2sd(character); - if (pl_sd == NULL) + if (pl_sd == nullptr) { - clif_displaymessage(s, "Character not found."); + clif_displaymessage(s, "Character not found."_s); return ATCE::EXIST; } @@ -4873,7 +4874,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>, if (ip == pl_sd->get_ip()) { AString output = STRPRINTF( - "Name: %s | Location: %s %d %d", + "Name: %s | Location: %s %d %d"_fmt, pl_sd->status_key.name, pl_sd->mapname_, pl_sd->bl_x, pl_sd->bl_y); clif_displaymessage(s, output); @@ -4881,7 +4882,7 @@ ATCE atcommand_ipcheck(Session *s, dumb_ptr<map_session_data>, } } - clif_displaymessage(s, "End of list"); + clif_displaymessage(s, "End of list"_s); return ATCE::OKAY; } @@ -4898,14 +4899,14 @@ ATCE atcommand_doomspot(Session *s, dumb_ptr<map_session_data> sd, if (pl_sd && pl_sd->state.auth && s2 != s && sd->bl_m == pl_sd->bl_m && sd->bl_x == pl_sd->bl_x && sd->bl_y == pl_sd->bl_y - && pc_isGM(sd) >= pc_isGM(pl_sd)) + && pc_isGM(sd).overwhelms(pc_isGM(pl_sd))) { // you can doom only lower or same gm level - pc_damage(NULL, pl_sd, pl_sd->status.hp + 1); - clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."); + pc_damage(nullptr, pl_sd, pl_sd->status.hp + 1); + clif_displaymessage(pl_sd->sess, "The holy messenger has given judgement."_s); } } - clif_displaymessage(s, "Judgement was made."); + clif_displaymessage(s, "Judgement was made."_s); return ATCE::OKAY; } @@ -4915,13 +4916,13 @@ ATCE atcommand_source(Session *s, dumb_ptr<map_session_data>, ZString) { clif_displaymessage(s, - "This server code consists of Free Software under GPL3&AGPL3"); + "This server code consists of Free Software under GPL3&AGPL3"_s); clif_displaymessage(s, - "This is commit " VERSION_HASH ", also known as " VERSION_FULL); + "This is commit " VERSION_HASH ", also known as " VERSION_FULL ""_s); clif_displaymessage(s, - "The version is " VERSION_STRING); + "The version is " VERSION_STRING ""_s); clif_displaymessage(s, - "For source, see " VENDOR_SOURCE); + "For source, see " VENDOR_SOURCE ""_s); return ATCE::OKAY; } @@ -4931,424 +4932,425 @@ ATCE atcommand_source(Session *s, dumb_ptr<map_session_data>, // declared extern above Map<XString, AtCommandInfo> atcommand_info = { - {"help", {"[level[-level]|category|@command]", + {"help"_s, {"[level[-level]|category|@command]"_s, 0, atcommand_help, - "Show help"}}, - {"setup", {"<level> <charname>", + "Show help"_s}}, + {"setup"_s, {"<level> <charname>"_s, 40, atcommand_setup, - "Safely set a chars levels and warp them to a special place (for TAW)"}}, - {"charwarp", {"<mapname> <x> <y> <charname>", + "Safely set a chars levels and warp them to a special place (for TAW)"_s}}, + {"charwarp"_s, {"<mapname> <x> <y> <charname>"_s, 60, atcommand_charwarp, - "Warp a character to a point on another map"}}, - {"warp", {"<mapname> [x] [y]", + "Warp a character to a point on another map"_s}}, + {"warp"_s, {"<mapname> [x] [y]"_s, 40, atcommand_warp, - "Warp yourself to another map"}}, - {"where", {"[charname]", + "Warp yourself to another map"_s}}, + {"where"_s, {"[charname]"_s, 40, atcommand_where, - "Show location of a character or yourself"}}, - {"goto", {"<charname>", + "Show location of a character or yourself"_s}}, + {"goto"_s, {"<charname>"_s, 40, atcommand_goto, - "Warp yourself to another character"}}, - {"jump", {"[x] [y]", + "Warp yourself to another character"_s}}, + {"jump"_s, {"[x] [y]"_s, 40, atcommand_jump, - "Warp yourself within a map"}}, - {"who", {"[subsequence]", + "Warp yourself within a map"_s}}, + {"who"_s, {"[subsequence]"_s, 40, atcommand_who, - "List matching players online, with location info"}}, - {"whogroup", {"[subsequence]", + "List matching players online, with location info"_s}}, + {"whogroup"_s, {"[subsequence]"_s, 40, atcommand_whogroup, - "List matching players online, with party info"}}, - {"whomap", {"[mapname]", + "List matching players online, with party info"_s}}, + {"whomap"_s, {"[mapname]"_s, 40, atcommand_whomap, - "List all players on the map, with location info"}}, - {"whomapgroup", {"[mapname]", + "List all players on the map, with location info"_s}}, + {"whomapgroup"_s, {"[mapname]"_s, 40, atcommand_whomapgroup, - "List all players on the map, with party info"}}, - {"whogm", {"[subsequence]", + "List all players on the map, with party info"_s}}, + {"whogm"_s, {"[subsequence]"_s, 40, atcommand_whogm, - "List matching GM players, with location, level, and party info"}}, - {"save", {"", + "List matching GM players, with location, level, and party info"_s}}, + {"save"_s, {""_s, 40, atcommand_save, - "Set your respawn point to your current location"}}, - {"return", {"", + "Set your respawn point to your current location"_s}}, + {"return"_s, {""_s, 40, atcommand_load, - "Return to your respawn point"}}, - {"load", {"", + "Return to your respawn point"_s}}, + {"load"_s, {""_s, 40, atcommand_load, - "Return to your respawn point"}}, - {"speed", {"<rate>", + "Return to your respawn point"_s}}, + {"speed"_s, {"<rate>"_s, 60, atcommand_speed, - "Set walk rate"}}, - {"storage", {"", + "Set walk rate"_s}}, + {"storage"_s, {""_s, 99, atcommand_storage, - "Open your storage"}}, - {"option", {"<opt1> [opt2] [option]", + "Open your storage"_s}}, + {"option"_s, {"<opt1> [opt2] [option]"_s, 80, atcommand_option, - "Set your 'option' status flags"}}, - {"hide", {"", + "Set your 'option' status flags"_s}}, + {"hide"_s, {""_s, 40, atcommand_hide, - "Toggle invisibility from monsters and certain commands"}}, - {"die", {"", + "Toggle invisibility from monsters and certain commands"_s}}, + {"die"_s, {""_s, 40, atcommand_die, - "Cause fatal damage to yourself"}}, - {"kill", {"<charname>", + "Cause fatal damage to yourself"_s}}, + {"kill"_s, {"<charname>"_s, 60, atcommand_kill, - "Cause fatal damage to another player"}}, - {"alive", {"", + "Cause fatal damage to another player"_s}}, + {"alive"_s, {""_s, 60, atcommand_alive, - "Restore life to yourself"}}, - {"kami", {"<message ...>", + "Restore life to yourself"_s}}, + {"kami"_s, {"<message ...>"_s, 99, atcommand_kami, - "Send an anonymous broadcast"}}, - {"heal", {"[hp] [sp]", + "Send an anonymous broadcast"_s}}, + {"heal"_s, {"[hp] [sp]"_s, 40, atcommand_heal, - "Restore or destroy your health"}}, - {"item", {"<item-name-or-id> [count]", + "Restore or destroy your health"_s}}, + {"item"_s, {"<item-name-or-id> [count]"_s, 80, atcommand_item, - "Summon items out of the void"}}, - {"itemreset", {"", + "Summon items out of the void"_s}}, + {"itemreset"_s, {""_s, 40, atcommand_itemreset, - "Cast all of your itens into the void (why would you ever want this?)"}}, - {"itemcheck", {"", + "Cast all of your itens into the void (why would you ever want this?)"_s}}, + {"itemcheck"_s, {""_s, 80, atcommand_itemcheck, - "Perform an internal integrity check on your items"}}, - {"blvl", {"<delta>", + "Perform an internal integrity check on your items"_s}}, + {"blvl"_s, {"<delta>"_s, 60, atcommand_baselevelup, - "Adjust your level"}}, - {"jlvl", {"<delta>", + "Adjust your level"_s}}, + {"jlvl"_s, {"<delta>"_s, 60, atcommand_joblevelup, - "Adjust your job level"}}, - {"gm", {"<password>", + "Adjust your job level"_s}}, + {"gm"_s, {"<password>"_s, 100, atcommand_gm, - "Receive GM powers"}}, - {"pvpoff", {"", + "Receive GM powers"_s}}, + {"pvpoff"_s, {""_s, 60, atcommand_pvpoff, - "Enable PvP on your map"}}, - {"pvpon", {"", + "Enable PvP on your map"_s}}, + {"pvpon"_s, {""_s, 60, atcommand_pvpon, - "Disable PvP on your map"}}, - {"model", {"<style> [color] [dye]", + "Disable PvP on your map"_s}}, + {"model"_s, {"<style> [color] [dye]"_s, 99, atcommand_model, - "Change your hairstyle and hair color"}}, - {"spawn", {"<mob-name-or-id> [count] [x] [y]", + "Change your hairstyle and hair color"_s}}, + {"spawn"_s, {"<mob-name-or-id> [count] [x] [y]"_s, 50, atcommand_spawn, - "Spawn normal monsters at location."}}, - {"killmonster", {"[map]", + "Spawn normal monsters at location."_s}}, + {"killmonster"_s, {"[map]"_s, 60, atcommand_killmonster, - "Kill all monsters (with drops)"}}, - {"killmonster2", {"[map]", + "Kill all monsters (with drops)"_s}}, + {"killmonster2"_s, {"[map]"_s, 60, atcommand_killmonster2, - "Kill all monsters (no drops)"}}, - {"gat", {"", + "Kill all monsters (no drops)"_s}}, + {"gat"_s, {""_s, 99, atcommand_gat, - "Dump the local walkmap"}}, - {"packet", {"<type> <flag>", + "Dump the local walkmap"_s}}, + {"packet"_s, {"<type> <flag>"_s, 99, atcommand_packet, - "Force a status change"}}, - {"stpoint", {"<amount>", + "Force a status change"_s}}, + {"stpoint"_s, {"<amount>"_s, 60, atcommand_statuspoint, - "Increase your stat points"}}, - {"skpoint", {"<amount>", + "Increase your stat points"_s}}, + {"skpoint"_s, {"<amount>"_s, 60, atcommand_skillpoint, - "Increase your skill points"}}, - {"zeny", {"<amount>", + "Increase your skill points"_s}}, + {"zeny"_s, {"<amount>"_s, 80, atcommand_zeny, - "Change how much money you have"}}, - {"str", {"<delta>", + "Change how much money you have"_s}}, + {"str"_s, {"<delta>"_s, 60, atcommand_param<ATTR::STR>, - "Adjust your strength"}}, - {"agi", {"<delta>", + "Adjust your strength"_s}}, + {"agi"_s, {"<delta>"_s, 60, atcommand_param<ATTR::AGI>, - "Adjust your agility"}}, - {"vit", {"<delta>", + "Adjust your agility"_s}}, + {"vit"_s, {"<delta>"_s, 60, atcommand_param<ATTR::VIT>, - "Adjust your vitality"}}, - {"int", {"<delta>", + "Adjust your vitality"_s}}, + {"int"_s, {"<delta>"_s, 60, atcommand_param<ATTR::INT>, - "Adjust your intelligence\0(TODO make this work in real life, I'm lonely)"}}, - {"dex", {"<delta>", + "Adjust your intelligence\0(TODO make this work in real life, I'm lonely)"_s}}, + {"dex"_s, {"<delta>"_s, 60, atcommand_param<ATTR::DEX>, - "Adjust your dexterity"}}, - {"luk", {"<delta>", + "Adjust your dexterity"_s}}, + {"luk"_s, {"<delta>"_s, 60, atcommand_param<ATTR::LUK>, - "Adjust your luck"}}, - {"recall", {"<charname>", + "Adjust your luck"_s}}, + {"recall"_s, {"<charname>"_s, 60, atcommand_recall, - "Warp a player to you"}}, - {"revive", {"<charname>", + "Warp a player to you"_s}}, + {"revive"_s, {"<charname>"_s, 60, atcommand_revive, - "Restore a player to full health"}}, - {"charstats", {"<charname>", + "Restore a player to full health"_s}}, + {"charstats"_s, {"<charname>"_s, 40, atcommand_character_stats, - "Show a bunch of stats about a single user"}}, - {"charstatsall", {"", + "Show a bunch of stats about a single user"_s}}, + {"charstatsall"_s, {""_s, 60, atcommand_character_stats_all, - "Show a bunch of stats about all online users"}}, - {"charoption", {"<opt1> <opt2> <opt3> <charname>", + "Show a bunch of stats about all online users"_s}}, + {"charoption"_s, {"<opt1> <opt2> <opt3> <charname>"_s, 80, atcommand_character_option, - "Set option flags on another character"}}, - {"charsave", {"<map> <x> <y> <charname>", + "Set option flags on another character"_s}}, + {"charsave"_s, {"<map> <x> <y> <charname>"_s, 60, atcommand_character_save, - "Set another character's save point"}}, - {"doom", {"", + "Set another character's save point"_s}}, + {"doom"_s, {""_s, 80, atcommand_doom, - "Kill everyone on the server"}}, - {"doommap", {"", + "Kill everyone on the server"_s}}, + {"doommap"_s, {""_s, 80, atcommand_doommap, - "Kill everyone on your map"}}, - {"raise", {"", + "Kill everyone on your map"_s}}, + {"raise"_s, {""_s, 80, atcommand_raise, - "Resurrect all players on the server"}}, - {"raisemap", {"", + "Resurrect all players on the server"_s}}, + {"raisemap"_s, {""_s, 80, atcommand_raisemap, - "Resurrect all players on your map"}}, - {"charbaselvl", {"<delta> <charname>", + "Resurrect all players on your map"_s}}, + {"charbaselvl"_s, {"<delta> <charname>"_s, 60, atcommand_character_baselevel, - "Adjust another character's level"}}, - {"charjlvl", {"<delta> <charname>", + "Adjust another character's level"_s}}, + {"charjlvl"_s, {"<delta> <charname>"_s, 60, atcommand_character_joblevel, - "Adjust another character's job level"}}, - {"kick", {"<charname>", + "Adjust another character's job level"_s}}, + {"kick"_s, {"<charname>"_s, 40, atcommand_kick, - "Transiently kick a player off the server"}}, - {"kickall", {"", + "Transiently kick a player off the server"_s}}, + {"kickall"_s, {""_s, 99, atcommand_kickall, - "Transiently kick all players off the server"}}, - {"questskill", {"<skill-id>", + "Transiently kick all players off the server"_s}}, + {"questskill"_s, {"<skill-id>"_s, 99, atcommand_questskill, - "Give yourself a quest (?) skill"}}, - {"charquestskill", {"<skill-id> <charname>", + "Give yourself a quest (?) skill"_s}}, + {"charquestskill"_s, {"<skill-id> <charname>"_s, 99, atcommand_charquestskill, - "Give another player a quest (?) skill"}}, - {"lostskill", {"<skill-id>", + "Give another player a quest (?) skill"_s}}, + {"lostskill"_s, {"<skill-id>"_s, 80, atcommand_lostskill, - "Take away one of your quest (?) skills"}}, - {"charlostskill", {"<skill-id> <charname>", + "Take away one of your quest (?) skills"_s}}, + {"charlostskill"_s, {"<skill-id> <charname>"_s, 99, atcommand_charlostskill, - "Take away one of another player's quest (?) skills"}}, - {"party", {"<name>", + "Take away one of another player's quest (?) skills"_s}}, + {"party"_s, {"<name>"_s, 99, atcommand_party, - "Create a new party"}}, - {"mapexit", {"", + "Create a new party"_s}}, + {"mapexit"_s, {""_s, 99, atcommand_mapexit, - "Try to kill the server kindly"}}, - {"idsearch", {"<item-subseq>", + "Try to kill the server kindly"_s}}, + {"idsearch"_s, {"<item-subseq>"_s, 80, atcommand_idsearch, - "Search for some items that might match"}}, - {"mapmove", {"<mapname> [x] [y]", + "Search for some items that might match"_s}}, + {"mapmove"_s, {"<mapname> [x] [y]"_s, 40, atcommand_warp, - "Warp to a different map"}}, - {"broadcast", {"<message ...>", + "Warp to a different map"_s}}, + {"broadcast"_s, {"<message ...>"_s, 40, atcommand_broadcast, - "Broadcast a message from you"}}, - {"localbroadcast", {"<message ...>", + "Broadcast a message from you"_s}}, + {"localbroadcast"_s, {"<message ...>"_s, 40, atcommand_localbroadcast, - "Broadcast a message from you locally"}}, - {"recallall", {"", + "Broadcast a message from you locally"_s}}, + {"recallall"_s, {""_s, 80, atcommand_recallall, - "Warp every online player to your current map"}}, - {"charskreset", {"<charname>", + "Warp every online player to your current map"_s}}, + {"charskreset"_s, {"<charname>"_s, 60, atcommand_charskreset, - "Reset a player's skill points"}}, - {"charstreset", {"<charname>", + "Reset a player's skill points"_s}}, + {"charstreset"_s, {"<charname>"_s, 60, atcommand_charstreset, - "Reset a player's stat points"}}, - {"charreset", {"<charname>", + "Reset a player's stat points"_s}}, + {"charreset"_s, {"<charname>"_s, 60, atcommand_charreset, - "Reset a player's skills, stats, and magic"}}, - {"charmodel", {"<hairstyle> <hair-color> <dye> <charname>", + "Reset a player's skills, stats, and magic"_s}}, + {"charmodel"_s, {"<hairstyle> <hair-color> <dye> <charname>"_s, 99, atcommand_charmodel, - "Change another character's appearance"}}, - {"charskpoint", {"<amount> <charname>", + "Change another character's appearance"_s}}, + {"charskpoint"_s, {"<amount> <charname>"_s, 60, atcommand_charskpoint, - "Adjust another player's skill points"}}, - {"charstpoint", {"<amount> <charname>", + "Adjust another player's skill points"_s}}, + {"charstpoint"_s, {"<amount> <charname>"_s, 60, atcommand_charstpoint, - "Adjust another player's stat points"}}, - {"charzeny", {"<delta> <charname>", + "Adjust another player's stat points"_s}}, + {"charzeny"_s, {"<delta> <charname>"_s, 80, atcommand_charzeny, - "Adjust another player's money"}}, - {"mapinfo", {"<0-2> [map]", + "Adjust another player's money"_s}}, + {"mapinfo"_s, {"<0-2> [map]"_s, 99, atcommand_mapinfo, - "Show some stats for the map. 1 also shows players, 2 also shows NPCs"}}, - {"dye", {"<dye>", + "Show some stats for the map. 1 also shows players, 2 also shows NPCs"_s}}, + {"dye"_s, {"<dye>"_s, 40, atcommand_dye, - "Don't use"}}, - {"ccolor", {"<dye>", + "Don't use"_s}}, + {"ccolor"_s, {"<dye>"_s, 40, atcommand_dye, - "Don't use"}}, - {"hairstyle", {"<style>", + "Don't use"_s}}, + {"hairstyle"_s, {"<style>"_s, 40, atcommand_hair_style, - "Change your hairstyle"}}, - {"haircolor", {"<color>", + "Change your hairstyle"_s}}, + {"haircolor"_s, {"<color>"_s, 40, atcommand_hair_color, - "Change your hair color"}}, - {"allstats", {"[value]", + "Change your hair color"_s}}, + {"allstats"_s, {"[value]"_s, 60, atcommand_all_stats, - "Adjust all stats by value (or maximum)"}}, - {"charchangesex", {"<charname>", + "Adjust all stats by value (or maximum)"_s}}, + {"charchangesex"_s, {"<charname>"_s, 60, atcommand_char_change_sex, - "Flip a characters sex and disconnect them"}}, - {"block", {"<charname>", + "Flip a characters sex and disconnect them"_s}}, + {"block"_s, {"<charname>"_s, 60, atcommand_char_block, - "Permanently block a player's account from the server"}}, - {"unblock", {"<charname>", + "Permanently block a player's account from the server"_s}}, + {"unblock"_s, {"<charname>"_s, 60, atcommand_char_unblock, - "Remove a permanent block from a player's account"}}, - {"ban", {"<timedelta> <charname>", + "Remove a permanent block from a player's account"_s}}, + {"ban"_s, {"<timedelta> <charname>"_s, 60, atcommand_char_ban, - "Ban a player's account from the server for a limited time"}}, - {"unban", {"<timedelta> <charname>", + "Ban a player's account from the server for a limited time"_s}}, + {"unban"_s, {"<timedelta> <charname>"_s, 60, atcommand_char_unban, - "Remove a limited ban from a player's account"}}, - {"partyspy", {"<party-name-or-id>", + "Remove a limited ban from a player's account"_s}}, + {"partyspy"_s, {"<party-name-or-id>"_s, 99, atcommand_partyspy, - "Listen to all chat within a party"}}, - {"partyrecall", {"<party-name-or-id>", + "Listen to all chat within a party"_s}}, + {"partyrecall"_s, {"<party-name-or-id>"_s, 99, atcommand_partyrecall, - "Warp all members of a party to you"}}, - {"enablenpc", {"<npc-name>", + "Warp all members of a party to you"_s}}, + {"enablenpc"_s, {"<npc-name>"_s, 80, atcommand_enablenpc, - "Enable an NPC for visibility"}}, - {"disablenpc", {"<npc-name>", + "Enable an NPC for visibility"_s}}, + {"disablenpc"_s, {"<npc-name>"_s, 80, atcommand_disablenpc, - "Disable an NPC for visibility"}}, - {"servertime", {"", + "Disable an NPC for visibility"_s}}, + {"servertime"_s, {""_s, 0, atcommand_servertime, - "Print the server's idea of the current time"}}, - {"chardelitem", {"<item-name-or-id> <count> <charname>", + "Print the server's idea of the current time"_s}}, + {"chardelitem"_s, {"<item-name-or-id> <count> <charname>"_s, 60, atcommand_chardelitem, - "Delete items from a player's inventory"}}, - {"listnearby", {"", + "Delete items from a player's inventory"_s}}, + {"listnearby"_s, {""_s, 40, atcommand_list_nearby, - "Print name of all nearby players"}}, - {"email", {"<actual@email> <new@email>", + "Print name of all nearby players"_s}}, + {"email"_s, {"<actual@email> <new@email>"_s, 0, atcommand_email, - "Changed your account's email"}}, - {"effect", {"<type> <flag>", + "Changed your account's email"_s}}, + {"effect"_s, {"<type> <flag>"_s, 99, atcommand_effect, - "Apply a special effect to yourself (or everyone! wtf?)"}}, - {"charitemlist", {"<charname>", + "Apply a special effect to yourself (or everyone! wtf?)"_s}}, + {"charitemlist"_s, {"<charname>"_s, 99, atcommand_character_item_list, - "List a player's items"}}, - {"charstoragelist", {"<charname>", + "List a player's items"_s}}, + {"charstoragelist"_s, {"<charname>"_s, 99, atcommand_character_storage_list, - "List a player's storage"}}, - {"addwarp", {"<mapname> <x> <y>", + "List a player's storage"_s}}, + {"addwarp"_s, {"<mapname> <x> <y>"_s, 80, atcommand_addwarp, - "Create a new permanent warp"}}, - {"killer", {"", + "Create a new permanent warp"_s}}, + {"killer"_s, {""_s, 60, atcommand_killer, - "Toggle whether you are a killer"}}, - {"charkiller", {"<charname>", + "Toggle whether you are a killer"_s}}, + {"charkiller"_s, {"<charname>"_s, 60, atcommand_charkiller, - "Toggle whether a player is a killer"}}, - {"npcmove", {"<x> <y> <npc-name>", + "Toggle whether a player is a killer"_s}}, + {"npcmove"_s, {"<x> <y> <npc-name>"_s, 80, atcommand_npcmove, - "Force an NPC to move on the map"}}, - {"killable", {"", + "Force an NPC to move on the map"_s}}, + {"killable"_s, {""_s, 60, atcommand_killable, - "Toggle whether you are killable"}}, - {"charkillable", {"<charname>", + "Toggle whether you are killable"_s}}, + {"charkillable"_s, {"<charname>"_s, 60, atcommand_charkillable, - "Toggle whether a player is killable"}}, - {"chareffect", {"<type> <target>", + "Toggle whether a player is killable"_s}}, + {"chareffect"_s, {"<type> <target>"_s, 40, atcommand_chareffect, - "Apply effect type with arg 0 to a player"}}, - {"dropall", {"", + "Apply effect type with arg 0 to a player"_s}}, + {"dropall"_s, {""_s, 99, atcommand_dropall, - "Drop all of your items"}}, - {"chardropall", {"<charname>", + "Drop all of your items"_s}}, + {"chardropall"_s, {"<charname>"_s, 60, atcommand_chardropall, - "Force a player to drop all of their items"}}, - {"storeall", {"", + "Force a player to drop all of their items"_s}}, + {"storeall"_s, {""_s, 60, atcommand_storeall, - "Store all of your items"}}, - {"charstoreall", {"<charname>", + "Store all of your items"_s}}, + {"charstoreall"_s, {"<charname>"_s, 60, atcommand_charstoreall, - "Store all of a player's items"}}, - {"rain", {"", + "Store all of a player's items"_s}}, + {"rain"_s, {""_s, 99, atcommand_rain, - "Enable the rain mapflag"}}, - {"snow", {"", + "Enable the rain mapflag"_s}}, + {"snow"_s, {""_s, 99, atcommand_snow, - "Enable the snow mapflag"}}, - {"sakura", {"", + "Enable the snow mapflag"_s}}, + {"sakura"_s, {""_s, 99, atcommand_sakura, - "Enable the sakura mapflag"}}, - {"fog", {"", + "Enable the sakura mapflag"_s}}, + {"fog"_s, {""_s, 99, atcommand_fog, - "Enable the fog mapflag"}}, - {"leaves", {"", + "Enable the fog mapflag"_s}}, + {"leaves"_s, {""_s, 99, atcommand_leaves, - "Enable the leaves mapflag"}}, - {"summon", {"<mob-id-or-name>", + "Enable the leaves mapflag"_s}}, + {"summon"_s, {"<mob-id-or-name>"_s, 50, atcommand_summon, - "Summon a slave monster temporarily"}}, - {"adjgmlvl", {"<level> <cmd>", + "Summon a slave monster temporarily"_s}}, + {"adjgmlvl"_s, {"<level> <cmd>"_s, 99, atcommand_adjgmlvl, - "Temporarily adjust the GM level of a command"}}, - {"adjcmdlvl", {"<level> <charname>", + "Temporarily adjust the GM level of a command"_s}}, + {"adjcmdlvl"_s, {"<level> <charname>"_s, 99, atcommand_adjcmdlvl, - "Temporarily adjust the GM level of a player"}}, - {"trade", {"<charname>", + "Temporarily adjust the GM level of a player"_s}}, + {"trade"_s, {"<charname>"_s, 60, atcommand_trade, - "Initiate trade with a player anywhere"}}, - {"charwipe", {"<charname>", + "Initiate trade with a player anywhere"_s}}, + {"charwipe"_s, {"<charname>"_s, 60, atcommand_char_wipe, - "Reset a character almost completely"}}, - {"setmagic", {"<school> <value> <charname>", + "Reset a character almost completely"_s}}, + {"setmagic"_s, {"<school> <value> <charname>"_s, 80, atcommand_set_magic, - "Force magic skill level"}}, - {"magicinfo", {"<charname>", + "Force magic skill level"_s}}, + {"magicinfo"_s, {"<charname>"_s, 80, atcommand_magic_info, - "Show magic skills of a palyer"}}, - {"log", {"<message ...>", + "Show magic skills of a palyer"_s}}, + {"log"_s, {"<message ...>"_s, 40, atcommand_log, - "Write something directly to the log"}}, - {"l", {"<message ...>", + "Write something directly to the log"_s}}, + {"l"_s, {"<message ...>"_s, 40, atcommand_log, - "Write something directly to the log"}}, - {"tee", {"<message ...>", + "Write something directly to the log"_s}}, + {"tee"_s, {"<message ...>"_s, 40, atcommand_tee, - "Duplicate a message to the log and public chat"}}, - {"t", {"<message ...>", + "Duplicate a message to the log and public chat"_s}}, + {"t"_s, {"<message ...>"_s, 40, atcommand_tee, - "Duplicate a message to the log and public chat"}}, - {"invisible", {"", + "Duplicate a message to the log and public chat"_s}}, + {"invisible"_s, {""_s, 50, atcommand_invisible, - "Make yourself invisible to players"}}, - {"visible", {"", + "Make yourself invisible to players"_s}}, + {"visible"_s, {""_s, 50, atcommand_visible, - "Make yourself visible to players"}}, - {"hugo", {"", + "Make yourself visible to players"_s}}, + {"hugo"_s, {""_s, 60, atcommand_iterate_forward_over_players, - "Jump to the next player"}}, - {"linus", {"", + "Jump to the next player"_s}}, + {"linus"_s, {""_s, 60, atcommand_iterate_backwards_over_players, - "Jump to the previous player"}}, - {"sp-info", {"<charname>", + "Jump to the previous player"_s}}, + {"sp-info"_s, {"<charname>"_s, 40, atcommand_skillpool_info, - "Show info about pool skills"}}, - {"sp-focus", {"<skill-id> <charname>", + "Show info about pool skills"_s}}, + {"sp-focus"_s, {"<skill-id> <charname>"_s, 80, atcommand_skillpool_focus, - "Focus on a pool skill"}}, - {"sp-unfocus", {"<skill-id> <charname>", + "Focus on a pool skill"_s}}, + {"sp-unfocus"_s, {"<skill-id> <charname>"_s, 80, atcommand_skillpool_unfocus, - "Unfocus off of a pool skill"}}, - {"skill-learn", {"<skill-id> <level> <charname>", + "Unfocus off of a pool skill"_s}}, + {"skill-learn"_s, {"<skill-id> <level> <charname>"_s, 80, atcommand_skill_learn, - "Change a skill level"}}, - {"wgm", {"<message ...>", + "Change a skill level"_s}}, + {"wgm"_s, {"<message ...>"_s, 0, atcommand_wgm, - "Send a message to online GMs"}}, - {"ipcheck", {"<charname>", + "Send a message to online GMs"_s}}, + {"ipcheck"_s, {"<charname>"_s, 60, atcommand_ipcheck, - "List players on the same IP address"}}, - {"doomspot", {"", + "List players on the same IP address"_s}}, + {"doomspot"_s, {""_s, 60, atcommand_doomspot, - "Kill all players on the same tile"}}, - {"source", {"", + "Kill all players on the same tile"_s}}, + {"source"_s, {""_s, 0, atcommand_source, - "Legal information about source code (must be a level 0 command!)"}}, + "Legal information about source code (must be a level 0 command!)"_s}}, }; +} // namespace tmwa |