summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorGuilherme G. Menaldo <guilherme.menaldo@outlook.com>2018-03-29 01:25:50 -0300
committerGuilherme G. Menaldo <guilherme.menaldo@outlook.com>2018-04-08 10:26:29 -0300
commit57ba23012d78b8bae37953d65831e932d1365283 (patch)
tree28aec1aed5c3112b2fbd6a6800f2c036826f4f5b /src/map/skill.c
parent38527550c17241e1c905f8077f6589413091087e (diff)
downloadhercules-57ba23012d78b8bae37953d65831e932d1365283.tar.gz
hercules-57ba23012d78b8bae37953d65831e932d1365283.tar.bz2
hercules-57ba23012d78b8bae37953d65831e932d1365283.tar.xz
hercules-57ba23012d78b8bae37953d65831e932d1365283.zip
Allow guild skills cooldown to continue when logged out
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 3d541bf76..1258e9aaf 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -19032,9 +19032,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
if (DIFF_TICK32(cd->entry[i]->started + cd->entry[i]->duration, now) > tick)
return 0;
cd->entry[i]->duration = tick;
-#if PACKETVER >= 20120604
cd->entry[i]->total = tick;
-#endif
cd->entry[i]->started = now;
if( timer->settick(cd->entry[i]->timer,now+tick) != -1 )
return 0;
@@ -19066,9 +19064,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick)
cd->entry[cd->cursor] = ers_alloc(skill->cd_entry_ers,struct skill_cd_entry);
cd->entry[cd->cursor]->duration = tick;
-#if PACKETVER >= 20120604
cd->entry[cd->cursor]->total = tick;
-#endif
cd->entry[cd->cursor]->skidx = idx;
cd->entry[cd->cursor]->skill_id = skill_id;
cd->entry[cd->cursor]->started = now;
@@ -19717,8 +19713,16 @@ void skill_cooldown_load(struct map_session_data * sd)
// process each individual cooldown associated with the character
for( i = 0; i < cd->cursor; i++ ) {
- cd->entry[i]->started = now;
- cd->entry[i]->timer = timer->add(timer->gettick()+cd->entry[i]->duration,skill->blockpc_end,sd->bl.id,cd->entry[i]->skidx);
+ int64 remaining;
+
+ if (battle_config.guild_skill_relog_delay == 2 && cd->entry[i]->skill_id >= GD_SKILLBASE && cd->entry[i]->skill_id < GD_MAX) {
+ remaining = cd->entry[i]->started + cd->entry[i]->total - now;
+ remaining = max(1, remaining); // expired cooldowns will be 1, so they'll expire in the normal way just after this.
+ } else {
+ cd->entry[i]->started = now;
+ remaining = cd->entry[i]->duration;
+ }
+ cd->entry[i]->timer = timer->add(timer->gettick() + remaining, skill->blockpc_end, sd->bl.id, cd->entry[i]->skidx);
sd->blockskill[cd->entry[i]->skidx] = true;
}
}