diff options
author | Haru <haru@dotalux.com> | 2020-02-09 18:09:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-09 18:09:36 +0100 |
commit | f6b34b065b1d90abc5ff4731ae3bed261ec0079a (patch) | |
tree | a0d41c65621c8cc38fd38fd0b2e68e74b203beea /src/map/duel.c | |
parent | 3687a79c5ab173abf6263a003d9473d9c2938309 (diff) | |
parent | f58e97c04ebf0377c4cb599a24e59f3cf25ae610 (diff) | |
download | hercules-f6b34b065b1d90abc5ff4731ae3bed261ec0079a.tar.gz hercules-f6b34b065b1d90abc5ff4731ae3bed261ec0079a.tar.bz2 hercules-f6b34b065b1d90abc5ff4731ae3bed261ec0079a.tar.xz hercules-f6b34b065b1d90abc5ff4731ae3bed261ec0079a.zip |
Merge pull request #1495 from Emistry/dual_cooldown
Update Duel System Cooldown
Diffstat (limited to 'src/map/duel.c')
-rw-r--r-- | src/map/duel.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/map/duel.c b/src/map/duel.c index dca040f83..c66fd6fc2 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -41,27 +41,12 @@ struct duel_interface *duel; *------------------------------------------*/ static void duel_savetime(struct map_session_data *sd) { - time_t clock; - struct tm *t; - - time(&clock); - t = localtime(&clock); - - pc_setglobalreg(sd, script->add_variable("PC_LAST_DUEL_TIME"), t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min); + pc_setglobalreg(sd, script->add_variable("PC_LAST_DUEL_TIME"), (int)time(NULL)); } -static int duel_checktime(struct map_session_data *sd) +static int64 duel_difftime(struct map_session_data *sd) { - int diff; - time_t clock; - struct tm *t; - - time(&clock); - t = localtime(&clock); - - diff = t->tm_mday*24*60 + t->tm_hour*60 + t->tm_min - pc_readglobalreg(sd, script->add_variable("PC_LAST_DUEL_TIME") ); - - return !(diff >= 0 && diff < battle_config.duel_time_interval); + return (pc_readglobalreg(sd, script->add_variable("PC_LAST_DUEL_TIME")) + battle_config.duel_time_interval - (int)time(NULL)); } static int duel_showinfo_sub(struct map_session_data *sd, va_list va) @@ -233,7 +218,7 @@ void duel_defaults(void) duel->reject = duel_reject; duel->leave = duel_leave; duel->showinfo = duel_showinfo; - duel->checktime = duel_checktime; + duel->difftime = duel_difftime; duel->init = do_init_duel; duel->final = do_final_duel; |