Adds support for sharing battle-type Achievements (#5021)

* Fixes #5018.
* Adds support for sharing battle-type Achievements when killing monsters.
* The behavior mimics Quest objectives.
* Adds a battle_config to easily toggle (off by default until confirmed on kRO).
Thanks to @MccloudBR's suggestion!
This commit is contained in:
Aleos
2020-06-12 13:02:50 -04:00
committed by GitHub
parent c875ebd5e2
commit 5647c875d6
6 changed files with 41 additions and 2 deletions

View File

@@ -3006,8 +3006,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
else if (sd->avail_quests)
quest_update_objective(sd, md->mob_id);
if (achievement_db.mobexists(md->mob_id))
achievement_update_objective(sd, AG_BATTLE, 1, md->mob_id);
if (achievement_db.mobexists(md->mob_id)) {
if (battle_config.achievement_mob_share > 0 && sd->status.party_id > 0)
map_foreachinallrange(achievement_update_objective_sub, &md->bl, AREA_SIZE, BL_PC, sd->status.party_id, md->mob_id);
else
achievement_update_objective(sd, AG_BATTLE, 1, md->mob_id);
}
// The master or Mercenary can increase the kill count
if (sd->md && src && (src->type == BL_PC || src->type == BL_MER) && mob_db(md->mob_id)->lv > sd->status.base_level / 2)