diff options
author | Haru <haru@dotalux.com> | 2018-07-28 03:21:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-28 03:21:42 +0200 |
commit | 621611e6e90af0c5551b4daca75ba1267d8e8478 (patch) | |
tree | 92ca087267778474df4c3589e22ec801f4c34622 /src/map/pc.c | |
parent | 164e79976b926da35612ce28cf84ebd9c2ac3d3e (diff) | |
parent | 7f5b041efd88bae052c98e1bd1c5e28676c73272 (diff) | |
download | hercules-621611e6e90af0c5551b4daca75ba1267d8e8478.tar.gz hercules-621611e6e90af0c5551b4daca75ba1267d8e8478.tar.bz2 hercules-621611e6e90af0c5551b4daca75ba1267d8e8478.tar.xz hercules-621611e6e90af0c5551b4daca75ba1267d8e8478.zip |
Merge pull request #2067 from dastgirp/1-achievement
Implemented Achievement System and Title System
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index d89abcca8..ff8f18489 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -55,6 +55,7 @@ #include "map/skill.h" #include "map/status.h" // struct status_data #include "map/storage.h" +#include "map/achievement.h" #include "common/cbasetypes.h" #include "common/conf.h" #include "common/core.h" // get_svn_revision() @@ -1053,6 +1054,11 @@ static bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data pc->skill(p1_sd, WE_CALLBABY, 1, SKILL_GRANT_PERMANENT); pc->skill(p2_sd, WE_CALLBABY, 1, SKILL_GRANT_PERMANENT); + // Achievements [Smokexyz/Hercules] + achievement->validate_adopt(p1_sd, true); // Parent 1 + achievement->validate_adopt(p2_sd, true); // Parent 2 + achievement->validate_adopt(b_sd, false); // Baby + return true; } @@ -1325,6 +1331,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat sd->bg_queue.type = 0; VECTOR_INIT(sd->script_queues); + VECTOR_INIT(sd->achievement); // Achievements [Smokexyz/Hercules] VECTOR_INIT(sd->storage.item); // initialize storage item vector. VECTOR_INIT(sd->hatEffectId); @@ -1384,6 +1391,7 @@ static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expirat " Group '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id, sd->status.char_id, CONVIP(ip), sd->group_id); + // Send friends list clif->friendslist_send(sd); @@ -1474,7 +1482,6 @@ static int pc_reg_received(struct map_session_data *sd) nullpo_ret(sd); sd->vars_ok = true; - sd->change_level_2nd = pc_readglobalreg(sd,script->add_str("jobchange_level")); sd->change_level_3rd = pc_readglobalreg(sd,script->add_str("jobchange_level_3rd")); sd->die_counter = pc_readglobalreg(sd,script->add_str("PC_DIE_COUNTER")); @@ -1593,6 +1600,9 @@ static int pc_reg_received(struct map_session_data *sd) if( npc->motd ) /* [Ind/Hercules] */ script->run(npc->motd->u.scr.script, 0, sd->bl.id, npc->fake_nd->bl.id); + // Achievements [Smokexyz/Hercules] + intif->achievements_request(sd); + return 1; } @@ -4500,6 +4510,8 @@ static int pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_typ sd->status.zeny -= zeny; clif->updatestatus(sd,SP_ZENY); + achievement->validate_zeny(sd, -zeny); // Achievements [Smokexyz/Hercules] + if(!tsd) tsd = sd; logs->zeny(sd, type, tsd, -zeny); if( zeny > 0 && sd->state.showzeny ) { @@ -4636,6 +4648,8 @@ static int pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_typ sd->status.zeny += zeny; clif->updatestatus(sd,SP_ZENY); + achievement->validate_zeny(sd, zeny); // Achievements [Smokexyz/Hercules] + if(!tsd) tsd = sd; logs->zeny(sd, type, tsd, zeny); if( zeny > 0 && sd->state.showzeny ) { @@ -4760,6 +4774,7 @@ static int pc_additem(struct map_session_data *sd, struct item *item_data, int a sd->status.inventory[i].amount = amount; sd->inventory_data[i] = data; clif->additem(sd,i,amount,0); + } if( ( !itemdb->isstackable2(data) || data->flag.force_serial || data->type == IT_CASH) && !item_data->unique_id ) @@ -4767,6 +4782,8 @@ static int pc_additem(struct map_session_data *sd, struct item *item_data, int a logs->pick_pc(sd, log_type, amount, &sd->status.inventory[i],sd->inventory_data[i]); + achievement->validate_item_get(sd, sd->status.inventory[i].nameid, sd->status.inventory[i].amount); // Achievements [Smokexyz/Hercules] + sd->weight += w; clif->updatestatus(sd,SP_WEIGHT); //Auto-equip @@ -6879,11 +6896,15 @@ static int pc_checkbaselevelup(struct map_session_data *sd) clif->misceffect(&sd->bl,0); npc->script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT - if(sd->status.party_id) + if (sd->status.party_id) party->send_levelup(sd); pc->baselevelchanged(sd); + quest->questinfo_refresh(sd); + + achievement->validate_stats(sd, SP_BASELEVEL, sd->status.base_level); + return 1; } @@ -6946,7 +6967,11 @@ static int pc_checkjoblevelup(struct map_session_data *sd) clif->status_change(&sd->bl,SI_DEVIL1, 1, 0, 0, 0, 1); //Permanent blind effect from SG_DEVIL. npc->script_event(sd, NPCE_JOBLVUP); + quest->questinfo_refresh(sd); + + achievement->validate_stats(sd, SP_BASELEVEL, sd->status.job_level); + return 1; } @@ -7243,6 +7268,8 @@ static int pc_setstat(struct map_session_data *sd, int type, int val) return -1; } + achievement->validate_stats(sd, type, val); // Achievements [Smokexyz/Hercules] + return val; } @@ -7974,6 +8001,14 @@ static void pc_damage(struct map_session_data *sd, struct block_list *src, unsig if (battle_config.prevent_logout_trigger & PLT_DAMAGE) sd->canlog_tick = timer->gettick(); + + // Achievements [Smokexyz/Hercules] + if (src != NULL) { + if (src->type == BL_PC) + achievement->validate_pc_damage(BL_UCAST(BL_PC, src), sd, hp); + else if (src->type == BL_MOB) + achievement->validate_mob_damage(sd, hp, true); + } } /*========================================== @@ -8124,6 +8159,8 @@ static int pc_dead(struct map_session_data *sd, struct block_list *src) pc->setparam(ssd, SP_KILLEDRID, sd->bl.id); npc->script_event(ssd, NPCE_KILLPC); + achievement->validate_pc_kill(ssd, sd); // Achievements [Smokexyz/Hercules] + if (battle_config.pk_mode&2) { ssd->status.manner -= 5; if(ssd->status.manner < 0) @@ -9042,6 +9079,8 @@ static int pc_jobchange(struct map_session_data *sd, int class, int upper) } quest->questinfo_refresh(sd); + achievement->validate_jobchange(sd); // Achievements [Smokexyz/Hercules] + return 0; } @@ -10682,6 +10721,11 @@ static int pc_marriage(struct map_session_data *sd, struct map_session_data *dst return -1; sd->status.partner_id = dstsd->status.char_id; dstsd->status.partner_id = sd->status.char_id; + + // Achievements [Smokexyz/Hercules] + achievement->validate_marry(sd); + achievement->validate_marry(dstsd); + return 0; } |