diff options
author | Haru <haru@dotalux.com> | 2018-04-23 03:14:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-23 03:14:29 +0200 |
commit | efeb386abc51baffa561f32d7d3b30868af767cd (patch) | |
tree | 9de101741e8195c8c6c9b7cf5526172054ea1c03 /src/map/skill.c | |
parent | 14432c034f4c87e06651e89f04df714dc76036a1 (diff) | |
parent | 57ba23012d78b8bae37953d65831e932d1365283 (diff) | |
download | hercules-efeb386abc51baffa561f32d7d3b30868af767cd.tar.gz hercules-efeb386abc51baffa561f32d7d3b30868af767cd.tar.bz2 hercules-efeb386abc51baffa561f32d7d3b30868af767cd.tar.xz hercules-efeb386abc51baffa561f32d7d3b30868af767cd.zip |
Merge pull request #2005 from guilherme-gm/guildskillcd
Allow guild skills cooldown to continue when logged out
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 9108b6575..87e869ec7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -19030,9 +19030,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; @@ -19064,9 +19062,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; @@ -19715,8 +19711,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; } } |