diff options
-rw-r--r-- | src/map/pc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 5db11ca..5814c08 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -817,7 +817,8 @@ int pc_authok (int id, int login_id2, time_t connect_until_time, sd->canact_tick = tick; sd->canmove_tick = tick; sd->attackabletime = tick; - sd->cast_tick = tick; + /* We don't want players bypassing spell restrictions. [remoitnane] */ + sd->cast_tick = tick + pc_readglobalreg (sd, "MAGIC_CAST_TICK"); sd->doridori_counter = 0; @@ -9009,11 +9010,25 @@ void pc_invisibility (struct map_session_data *sd, int enabled) int pc_logout (struct map_session_data *sd) // [fate] Player logs out { + unsigned int tick = gettick (); + if (!sd) return 0; if (sd->sc_data[SC_POISON].timer != -1) sd->status.hp = 1; // Logging out while poisoned -> bad + /* + * Trying to rapidly sign out/in or switch characters to avoid a spell's + * cast time is also bad. [remoitnane] + */ + if (sd->cast_tick > tick) + { + if (pc_setglobalreg (sd, "MAGIC_CAST_TICK", sd->cast_tick - tick)) + sd->status.sp = 1; + } + else + pc_setglobalreg (sd, "MAGIC_CAST_TICK", 0); + MAP_LOG_STATS (sd, "LOGOUT") return 0; } |