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 | |
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')
-rw-r--r-- | src/map/battle.c | 2 | ||||
-rw-r--r-- | src/map/guild.c | 4 | ||||
-rw-r--r-- | src/map/skill.c | 16 | ||||
-rw-r--r-- | src/map/skill.h | 4 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 5f56599d7..49cc78f7e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6955,7 +6955,7 @@ static const struct battle_data { { "chase_range_rate", &battle_config.chase_range_rate, 100, 0, INT_MAX, }, { "gtb_sc_immunity", &battle_config.gtb_sc_immunity, 50, 0, INT_MAX, }, { "guild_max_castles", &battle_config.guild_max_castles, 0, 0, INT_MAX, }, - { "guild_skill_relog_delay", &battle_config.guild_skill_relog_delay, 0, 0, 1, }, + { "guild_skill_relog_delay", &battle_config.guild_skill_relog_delay, 0, 0, 2, }, { "emergency_call", &battle_config.emergency_call, 11, 0, 31, }, { "atcommand_spawn_quantity_limit", &battle_config.atc_spawn_quantity_limit, 100, 0, INT_MAX, }, { "atcommand_slave_clone_limit", &battle_config.atc_slave_clone_limit, 25, 0, INT_MAX, }, diff --git a/src/map/guild.c b/src/map/guild.c index d33df5e08..d9833a2f4 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -552,7 +552,7 @@ int guild_recv_info(const struct guild *sg) if ((sd = map->nick2sd(sg->master)) != NULL) { //If the guild master is online the first time the guild_info is received, //that means he was the first to join, so apply guild skill blocking here. - if( battle_config.guild_skill_relog_delay ) + if( battle_config.guild_skill_relog_delay == 1) guild->block_skill(sd, 300000); //Also set the guild master flag. @@ -760,7 +760,7 @@ void guild_member_joined(struct map_session_data *sd) // set the Guild Master flag sd->state.gmaster_flag = 1; // prevent Guild Skills from being used directly after relog - if( battle_config.guild_skill_relog_delay ) + if( battle_config.guild_skill_relog_delay == 1 ) guild->block_skill(sd, 300000); } i = guild->getindex(g, sd->status.account_id, sd->status.char_id); 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; } } diff --git a/src/map/skill.h b/src/map/skill.h index d7590921a..3de7f7bdf 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1842,9 +1842,7 @@ struct s_skill_magicmushroom_db { struct skill_cd_entry { int duration;//milliseconds -#if PACKETVER >= 20120604 - int total;/* used for display on newer clients */ -#endif + int total;/* used when reducing offline cooldown and for display on newer clients */ short skidx;//the skill index entries belong to int64 started;/* gettick() of when it started, used vs duration to measure how much left upon logout */ int timer;/* timer id */ |