Skip to content

Commit

Permalink
add a built-in gm log delay option
Browse files Browse the repository at this point in the history
  • Loading branch information
Helianthella committed Apr 15, 2019
1 parent 1886d63 commit ec0e692
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/map/atcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,24 @@ bool asplit(ZString raw, F *first_arg, R *... rest_args)
static
io::AppendFile *get_gm_log();

void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd)
static
void real_log_atcommand(TimerData *, tick_t, AString cmd)
{
io::AppendFile *fp = get_gm_log();
if (!fp)
return;
FPRINTF(*fp, "%s\n"_fmt, cmd);
}

void log_atcommand(dumb_ptr<map_session_data> sd, ZString cmd)
{
timestamp_seconds_buffer tmpstr;
stamp_time(tmpstr);
MapName map = (sd->bl_m->name_);
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,
cmd);
AString str = STRPRINTF("[%s] %s(%d,%d) %s(%d) : %s"_fmt, tmpstr,
map, sd->bl_x, sd->bl_y, sd->status_key.name,
sd->status_key.account_id, cmd);
Timer(gettick() + battle_config.gm_log_delay, std::bind(real_log_atcommand, ph::_1, ph::_2, str)).detach();
}

io::AppendFile *get_gm_log()
Expand Down
2 changes: 2 additions & 0 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,8 @@ def build_config():
battle_conf.opt('itemheal_regeneration_factor', i32, '1')
battle_conf.opt('mob_splash_radius', i32, '-1', min='-1')

battle_conf.opt('gm_log_delay', milliseconds, '60_min')

return rv

def main():
Expand Down

0 comments on commit ec0e692

Please sign in to comment.