diff options
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 722 |
1 files changed, 434 insertions, 288 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 0872c85e1..0aad00a56 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() @@ -76,15 +77,15 @@ #include <string.h> #include <time.h> -struct pc_interface pc_s; +static struct pc_interface pc_s; struct pc_interface *pc; -struct class_exp_tables exptables; +static struct class_exp_tables exptables; //Converts a class to its array index for CLASS_COUNT defined arrays. //Note that it does not do a validity check for speed purposes, where parsing //player input make sure to use a pc->db_checkid first! -int pc_class2idx(int class) +static int pc_class2idx(int class) { if (class >= JOB_NOVICE_HIGH) { class += - JOB_NOVICE_HIGH + JOB_MAX_BASIC; @@ -99,7 +100,7 @@ int pc_class2idx(int class) * required to provide a session. * Caller must release dummy on its own when it's no longer needed. */ -struct map_session_data* pc_get_dummy_sd(void) +static struct map_session_data *pc_get_dummy_sd(void) { struct map_session_data *dummy_sd; CREATE(dummy_sd, struct map_session_data, 1); @@ -113,7 +114,7 @@ struct map_session_data* pc_get_dummy_sd(void) * @param group_id Group ID * @return 1 on error, 0 on success */ -int pc_set_group(struct map_session_data *sd, int group_id) +static int pc_set_group(struct map_session_data *sd, int group_id) { GroupSettings *group = pcg->id2group(group_id); nullpo_retr(1, sd); @@ -127,13 +128,13 @@ int pc_set_group(struct map_session_data *sd, int group_id) /** * Checks if commands used by player should be logged. */ -bool pc_should_log_commands(struct map_session_data *sd) +static bool pc_should_log_commands(struct map_session_data *sd) { nullpo_retr(true, sd); return pcg->should_log_commands(sd->group); } -int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) +static int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) { struct map_session_data *sd = map->id2sd(id); @@ -150,7 +151,7 @@ int pc_invincible_timer(int tid, int64 tick, int id, intptr_t data) return 0; } -void pc_setinvincibletimer(struct map_session_data* sd, int val) +static void pc_setinvincibletimer(struct map_session_data *sd, int val) { nullpo_retv(sd); @@ -161,7 +162,7 @@ void pc_setinvincibletimer(struct map_session_data* sd, int val) sd->invincible_timer = timer->add(timer->gettick()+val,pc->invincible_timer,sd->bl.id,0); } -void pc_delinvincibletimer(struct map_session_data* sd) +static void pc_delinvincibletimer(struct map_session_data *sd) { nullpo_retv(sd); @@ -173,7 +174,8 @@ void pc_delinvincibletimer(struct map_session_data* sd) } } -int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); int i; @@ -205,12 +207,13 @@ int pc_spiritball_timer(int tid, int64 tick, int id, intptr_t data) { } /** -* Get the possible number of spiritball that a player can call. -* @param sd the affected player structure -* @param min the minimum number of spiritball regardless the level of MO_CALLSPIRITS -* @retval total number of spiritball -**/ -int pc_getmaxspiritball(struct map_session_data *sd, int min) { + * Get the possible number of spiritball that a player can call. + * @param sd the affected player structure + * @param min the minimum number of spiritball regardless the level of MO_CALLSPIRITS + * @retval total number of spiritball + */ +static int pc_getmaxspiritball(struct map_session_data *sd, int min) +{ int result; nullpo_ret(sd); @@ -226,7 +229,7 @@ int pc_getmaxspiritball(struct map_session_data *sd, int min) { return result; } -int pc_addspiritball(struct map_session_data *sd,int interval,int max) +static int pc_addspiritball(struct map_session_data *sd, int interval, int max) { int tid, i; @@ -257,7 +260,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max) return 0; } -int pc_addspiritball_sub(struct map_session_data *sd) +static int pc_addspiritball_sub(struct map_session_data *sd) { nullpo_ret(sd); if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) @@ -267,7 +270,7 @@ int pc_addspiritball_sub(struct map_session_data *sd) return 0; } -int pc_delspiritball(struct map_session_data *sd,int count,int type) +static int pc_delspiritball(struct map_session_data *sd, int count, int type) { int i; @@ -303,7 +306,7 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type) return 0; } -int pc_delspiritball_sub(struct map_session_data *sd) +static int pc_delspiritball_sub(struct map_session_data *sd) { nullpo_ret(sd); if ((sd->job & MAPID_THIRDMASK) == MAPID_ROYAL_GUARD) @@ -313,7 +316,7 @@ int pc_delspiritball_sub(struct map_session_data *sd) return 0; } -int pc_check_banding(struct block_list *bl, va_list ap) +static int pc_check_banding(struct block_list *bl, va_list ap) { int *c, *b_sd; struct block_list *src; @@ -341,7 +344,8 @@ int pc_check_banding(struct block_list *bl, va_list ap) return 0; } -int pc_banding(struct map_session_data *sd, uint16 skill_lv) { +static int pc_banding(struct map_session_data *sd, uint16 skill_lv) +{ int c; int b_sd[MAX_PARTY]; // In case of a full Royal Guard party. int i, j, hp, extra_hp = 0, tmp_qty = 0; @@ -416,7 +420,7 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) { * @param type The fame list type (@see enum fame_list_type). * @param count The amount of points to add. */ -void pc_addfame(struct map_session_data *sd, int ranktype, int count) +static void pc_addfame(struct map_session_data *sd, int ranktype, int count) { nullpo_retv(sd); @@ -456,7 +460,7 @@ void pc_addfame(struct map_session_data *sd, int ranktype, int count) * @return The rank position (1-based index) * @retval 0 if the character isn't in the specified list. */ -int pc_fame_rank(int char_id, int ranktype) +static int pc_fame_rank(int char_id, int ranktype) { int i; @@ -495,7 +499,8 @@ int pc_fame_rank(int char_id, int ranktype) * @return the appropriate fame list type (@see enum fame_list_type). * @retval RANKTYPE_UNKNOWN if no appropriate type exists. */ -int pc_famelist_type(uint16 job_mapid) { +static int pc_famelist_type(uint16 job_mapid) +{ switch (job_mapid & MAPID_UPPERMASK) { case MAPID_BLACKSMITH: return RANKTYPE_BLACKSMITH; @@ -508,7 +513,8 @@ int pc_famelist_type(uint16 job_mapid) { } } -int pc_setrestartvalue(struct map_session_data *sd,int type) { +static int pc_setrestartvalue(struct map_session_data *sd, int type) +{ struct status_data *st, *bst; nullpo_ret(sd); @@ -531,7 +537,8 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) { /*========================================== Rental System *------------------------------------------*/ -int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) { +static int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); if( sd == NULL ) return 0; @@ -545,7 +552,7 @@ int pc_inventory_rental_end(int tid, int64 tick, int id, intptr_t data) { return 1; } -int pc_inventory_rental_clear(struct map_session_data *sd) +static int pc_inventory_rental_clear(struct map_session_data *sd) { nullpo_ret(sd); if( sd->rental_timer != INVALID_TIMER ) @@ -557,8 +564,9 @@ int pc_inventory_rental_clear(struct map_session_data *sd) return 1; } /* assumes i is valid (from default areas where it is called, it is) */ -void pc_rental_expire(struct map_session_data *sd, int i) { - short nameid; +static void pc_rental_expire(struct map_session_data *sd, int i) +{ + int nameid; nullpo_retv(sd); Assert_retv(i >= 0 && i < MAX_INVENTORY); @@ -628,7 +636,7 @@ void pc_rental_expire(struct map_session_data *sd, int i) { clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid); pc->delitem(sd, i, sd->status.inventory[i].amount, 0, DELITEM_NORMAL, LOG_TYPE_RENTAL); } -void pc_inventory_rentals(struct map_session_data *sd) +static void pc_inventory_rentals(struct map_session_data *sd) { int i, c = 0; int64 expire_tick, next_tick = INT64_MAX; @@ -657,7 +665,7 @@ void pc_inventory_rentals(struct map_session_data *sd) sd->rental_timer = INVALID_TIMER; } -void pc_inventory_rental_add(struct map_session_data *sd, int seconds) +static void pc_inventory_rental_add(struct map_session_data *sd, int seconds) { int tick = seconds * 1000; @@ -681,7 +689,7 @@ void pc_inventory_rental_add(struct map_session_data *sd, int seconds) /*========================================== * prepares character for saving. *------------------------------------------*/ -int pc_makesavestatus(struct map_session_data *sd) +static int pc_makesavestatus(struct map_session_data *sd) { nullpo_ret(sd); @@ -747,7 +755,7 @@ int pc_makesavestatus(struct map_session_data *sd) /*========================================== * Off init ? Connection? *------------------------------------------*/ -int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd) +static int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int login_id1, unsigned int client_tick, int sex, int fd) { nullpo_ret(sd); @@ -770,7 +778,7 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo } // [4144] probably pc_equippoint should be replaced to pc_item_equippoint -int pc_equippoint(struct map_session_data *sd,int n) +static int pc_equippoint(struct map_session_data *sd, int n) { int ep = 0; @@ -802,7 +810,7 @@ int pc_equippoint(struct map_session_data *sd,int n) return ep; } -int pc_item_equippoint(struct map_session_data *sd, struct item_data* id) +static int pc_item_equippoint(struct map_session_data *sd, struct item_data *id) { int ep = 0; @@ -829,7 +837,7 @@ int pc_item_equippoint(struct map_session_data *sd, struct item_data* id) return ep; } -int pc_setinventorydata(struct map_session_data *sd) +static int pc_setinventorydata(struct map_session_data *sd) { int i; @@ -842,7 +850,7 @@ int pc_setinventorydata(struct map_session_data *sd) return 0; } -int pc_calcweapontype(struct map_session_data *sd) +static int pc_calcweapontype(struct map_session_data *sd) { nullpo_ret(sd); @@ -886,7 +894,7 @@ int pc_calcweapontype(struct map_session_data *sd) return 2; } -int pc_setequipindex(struct map_session_data *sd) +static int pc_setequipindex(struct map_session_data *sd) { int i,j; @@ -935,7 +943,7 @@ int pc_setequipindex(struct map_session_data *sd) return 0; } -bool pc_isequipped(struct map_session_data *sd, int nameid) +static bool pc_isequipped(struct map_session_data *sd, int nameid) { int i, j; @@ -961,7 +969,7 @@ bool pc_isequipped(struct map_session_data *sd, int nameid) return false; } -bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd ) +static bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) { if( !p1_sd || !p2_sd || !b_sd ) return false; @@ -1011,7 +1019,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd /*========================================== * Adoption Process *------------------------------------------*/ -bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) +static bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd) { int class, joblevel; uint64 jobexp; @@ -1046,6 +1054,11 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, 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; } @@ -1056,7 +1069,7 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, * Checks if the player can equip the item at index n in inventory. * Returns 0 (no) or 1 (yes). *------------------------------------------------*/ -int pc_isequip(struct map_session_data *sd,int n) +static int pc_isequip(struct map_session_data *sd, int n) { struct item_data *item; @@ -1183,7 +1196,7 @@ int pc_isequip(struct map_session_data *sd,int n) * No problem with the session id * set the status that has been sent from char server *------------------------------------------*/ -bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers) +static bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers) { int i; int64 tick = timer->gettick(); @@ -1318,6 +1331,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim 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); @@ -1365,6 +1379,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim pc->setpos(sd,sd->status.last_point.map,0,0,CLR_OUTSIGHT); } + clif->overweight_percent(sd); clif->authok(sd); //Prevent S. Novices from getting the no-death bonus just yet. [Skotlex] @@ -1377,6 +1392,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim " 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); @@ -1398,16 +1414,6 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y); } - /** - * Check if player have any cool downs on - **/ - skill->cooldown_load(sd); - - /** - * Check if player have any item cooldowns on - **/ - pc->itemcd_do(sd,true); - #ifdef GP_BOUND_ITEMS if( sd->status.party_id == 0 ) pc->bound_clear(sd,IBT_PARTY); @@ -1425,7 +1431,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim /*========================================== * Closes a connection because it failed to be authenticated from the char server. *------------------------------------------*/ -void pc_authfail(struct map_session_data *sd) +static void pc_authfail(struct map_session_data *sd) { nullpo_retv(sd); clif->authfail_fd(sd->fd, 0); @@ -1433,7 +1439,7 @@ void pc_authfail(struct map_session_data *sd) } //Attempts to set a mob. -int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) +static int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) { int class_; if (!sd || !bl || pos < 0 || pos >= MAX_PC_FEELHATE) @@ -1461,13 +1467,12 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) /*========================================== * Invoked once after the char/account/account2 registry variables are received. [Skotlex] *------------------------------------------*/ -int pc_reg_received(struct map_session_data *sd) +static int pc_reg_received(struct map_session_data *sd) { int i, idx = 0; 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")); @@ -1547,6 +1552,10 @@ int pc_reg_received(struct map_session_data *sd) if (!chrif->auth_finished(sd)) ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id); + // Restore any cooldowns + skill->cooldown_load(sd); + pc->itemcd_do(sd, true); + pc->load_combo(sd); status_calc_pc(sd,SCO_FIRST|SCO_FORCE); @@ -1586,10 +1595,14 @@ 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; } -int pc_calc_skillpoint(struct map_session_data* sd) { +static int pc_calc_skillpoint(struct map_session_data *sd) +{ int i,inf2,skill_point=0; nullpo_ret(sd); @@ -1612,7 +1625,7 @@ int pc_calc_skillpoint(struct map_session_data* sd) { return skill_point; } -void pc_calc_skilltree_clear(struct map_session_data *sd) +static void pc_calc_skilltree_clear(struct map_session_data *sd) { int i; @@ -1639,7 +1652,7 @@ void pc_calc_skilltree_clear(struct map_session_data *sd) /*========================================== * Calculation of skill level. *------------------------------------------*/ -int pc_calc_skilltree(struct map_session_data *sd) +static int pc_calc_skilltree(struct map_session_data *sd) { int i,id=0,flag; int class = 0, classidx = 0; @@ -1786,7 +1799,7 @@ int pc_calc_skilltree(struct map_session_data *sd) return 0; } -void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) +static void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) { int i; int id = 0; @@ -1822,7 +1835,7 @@ void pc_calc_skilltree_bonus(struct map_session_data *sd, int classidx) } //Checks if you can learn a new skill after having leveled up a skill. -void pc_check_skilltree(struct map_session_data *sd, int skill_id) +static void pc_check_skilltree(struct map_session_data *sd, int skill_id) { int i,id=0,flag; int c=0; @@ -1893,7 +1906,7 @@ void pc_check_skilltree(struct map_session_data *sd, int skill_id) // Make sure all the skills are in the correct condition // before persisting to the backend.. [MouseJstr] -int pc_clean_skilltree(struct map_session_data *sd) +static int pc_clean_skilltree(struct map_session_data *sd) { int i; nullpo_ret(sd); @@ -1911,7 +1924,7 @@ int pc_clean_skilltree(struct map_session_data *sd) return 0; } -int pc_calc_skilltree_normalize_job(struct map_session_data *sd) +static int pc_calc_skilltree_normalize_job(struct map_session_data *sd) { int skill_point, novice_skills; uint16 job; @@ -1987,7 +2000,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) * 2: overweight 90% * It's assumed that SC_WEIGHTOVER50 and SC_WEIGHTOVER90 are only started/stopped here. */ -int pc_updateweightstatus(struct map_session_data *sd) +static int pc_updateweightstatus(struct map_session_data *sd) { int old_overweight; int new_overweight; @@ -2018,7 +2031,7 @@ int pc_updateweightstatus(struct map_session_data *sd) return 0; } -int pc_disguise(struct map_session_data *sd, int class) +static int pc_disguise(struct map_session_data *sd, int class) { nullpo_ret(sd); if (class == -1 && sd->disguise == -1) @@ -2074,7 +2087,7 @@ int pc_disguise(struct map_session_data *sd, int class) return 1; } -int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id) +static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, int card_id) { int i; @@ -2112,7 +2125,7 @@ int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, s return 1; } -int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id) +static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, int card_id) { int i; @@ -2153,7 +2166,7 @@ int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_ski * @retval 1 on success. * @retval 0 on failure. */ -int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration) +static int pc_bonus_addeff(struct s_addeffect *effect, int max, enum sc_type id, int16 rate, int16 arrow_rate, uint8 flag, uint16 duration) { int i; @@ -2185,7 +2198,8 @@ int pc_bonus_addeff(struct s_addeffect* effect, int max, enum sc_type id, int16 return 1; } -int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target) { +static int pc_bonus_addeff_onskill(struct s_addeffectonskill *effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target) +{ int i; nullpo_ret(effect); @@ -2206,7 +2220,8 @@ int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_ return 1; } -int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race_mask, int rate) { +static int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race_mask, int rate) +{ int i; nullpo_ret(drop); @@ -2254,7 +2269,8 @@ int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short return 1; } -int pc_addautobonus(struct s_autobonus *bonus,char max,const char *bonus_script,short rate,unsigned int dur,short flag,const char *other_script,unsigned short pos,bool onskill) { +static int pc_addautobonus(struct s_autobonus *bonus, char max, const char *bonus_script, short rate, unsigned int dur, short flag, const char *other_script, unsigned short pos, bool onskill) +{ int i; nullpo_ret(bonus); @@ -2291,7 +2307,7 @@ int pc_addautobonus(struct s_autobonus *bonus,char max,const char *bonus_script, return 1; } -int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,char max,bool restore) +static int pc_delautobonus(struct map_session_data *sd, struct s_autobonus *autobonus, char max, bool restore) { int i; nullpo_ret(sd); @@ -2329,7 +2345,7 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c return 0; } -int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus) +static int pc_exeautobonus(struct map_session_data *sd, struct s_autobonus *autobonus) { nullpo_ret(sd); nullpo_ret(autobonus); @@ -2349,7 +2365,8 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus) return 0; } -int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) { +static int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); struct s_autobonus *autobonus = (struct s_autobonus *)data; @@ -2362,7 +2379,7 @@ int pc_endautobonus(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, short flag) +static int pc_bonus_addele(struct map_session_data *sd, unsigned char ele, short rate, short flag) { int i; struct weapon_data* wd; @@ -2397,7 +2414,7 @@ int pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, return 0; } -int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, short flag) +static int pc_bonus_subele(struct map_session_data *sd, unsigned char ele, short rate, short flag) { int i; @@ -2443,7 +2460,8 @@ int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, /*========================================== * Add a bonus(type) to player sd *------------------------------------------*/ -int pc_bonus(struct map_session_data *sd,int type,int val) { +static int pc_bonus(struct map_session_data *sd, int type, int val) +{ struct status_data *bst; int bonus; int i; @@ -3109,7 +3127,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val) { /*========================================== * Player bonus (type) with args type2 and val, called trough bonus2 (npc) *------------------------------------------*/ -int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) +static int pc_bonus2(struct map_session_data *sd, int type, int type2, int val) { int i; @@ -3899,7 +3917,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) return 0; } -int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) +static int pc_bonus3(struct map_session_data *sd, int type, int type2, int type3, int val) { int i; nullpo_ret(sd); @@ -4073,7 +4091,8 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) return 0; } -int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val) { +static int pc_bonus4(struct map_session_data *sd, int type, int type2, int type3, int type4, int val) +{ int i; nullpo_ret(sd); @@ -4168,7 +4187,8 @@ int pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4 return 0; } -int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4,int type5,int val) { +static int pc_bonus5(struct map_session_data *sd, int type, int type2, int type3, int type4, int type5, int val) +{ nullpo_ret(sd); switch(type){ @@ -4202,7 +4222,7 @@ int pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type4 * Grants a player a given skill. * Flag values: @see enum pc_skill_flag *------------------------------------------*/ -int pc_skill(struct map_session_data *sd, int id, int level, int flag) +static int pc_skill(struct map_session_data *sd, int id, int level, int flag) { int index = 0; nullpo_ret(sd); @@ -4281,7 +4301,7 @@ int pc_skill(struct map_session_data *sd, int id, int level, int flag) * @param idx_equip The target equipment's inventory index. * @retval true if the card can be inserted. */ -bool pc_can_insert_card_into(struct map_session_data* sd, int idx_card, int idx_equip) +static bool pc_can_insert_card_into(struct map_session_data *sd, int idx_card, int idx_equip) { int i; @@ -4317,7 +4337,7 @@ bool pc_can_insert_card_into(struct map_session_data* sd, int idx_card, int idx_ * @param idx_card The card's inventory index. * @retval true if the card can be inserted. */ -bool pc_can_insert_card(struct map_session_data* sd, int idx_card) +static bool pc_can_insert_card(struct map_session_data *sd, int idx_card) { nullpo_ret(sd); @@ -4336,7 +4356,7 @@ bool pc_can_insert_card(struct map_session_data* sd, int idx_card) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip) +static int pc_insert_card(struct map_session_data *sd, int idx_card, int idx_equip) { int nameid; @@ -4378,7 +4398,7 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip) /*========================================== * Update buying value by skills *------------------------------------------*/ -int pc_modifybuyvalue(struct map_session_data *sd, int orig_value) +static int pc_modifybuyvalue(struct map_session_data *sd, int orig_value) { int skill_lv, rate1 = 0, rate2 = 0; if (orig_value <= 0) @@ -4399,7 +4419,7 @@ int pc_modifybuyvalue(struct map_session_data *sd, int orig_value) /*========================================== * Update selling value by skills *------------------------------------------*/ -int pc_modifysellvalue(struct map_session_data *sd, int orig_value) +static int pc_modifysellvalue(struct map_session_data *sd, int orig_value) { int skill_lv, rate = 0; if (orig_value <= 0) @@ -4417,7 +4437,7 @@ int pc_modifysellvalue(struct map_session_data *sd, int orig_value) * Checking if we have enough place on inventory for new item * Make sure to take 30k as limit (for client I guess) *------------------------------------------*/ -int pc_checkadditem(struct map_session_data *sd,int nameid,int amount) +static int pc_checkadditem(struct map_session_data *sd, int nameid, int amount) { int i; struct item_data* data; @@ -4451,7 +4471,7 @@ int pc_checkadditem(struct map_session_data *sd,int nameid,int amount) * Return number of available place in inventory * Each non stackable item will reduce place by 1 *------------------------------------------*/ -int pc_inventoryblank(struct map_session_data *sd) +static int pc_inventoryblank(struct map_session_data *sd) { int i,b; @@ -4468,7 +4488,7 @@ int pc_inventoryblank(struct map_session_data *sd) /*========================================== * attempts to remove zeny from player (sd) *------------------------------------------*/ -int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, struct map_session_data *tsd) +static int pc_payzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd) { nullpo_retr(-1,sd); @@ -4485,6 +4505,8 @@ int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, 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 ) { @@ -4505,7 +4527,7 @@ int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, * @return points Leftover kafra points. */ //Changed Kafrapoints calculation. [Normynator] -int pc_paycash(struct map_session_data *sd, int price, int points) +static int pc_paycash(struct map_session_data *sd, int price, int points) { int cash; int mempoints; @@ -4545,7 +4567,7 @@ int pc_paycash(struct map_session_data *sd, int price, int points) return points; } -int pc_getcash(struct map_session_data *sd, int cash, int points) +static int pc_getcash(struct map_session_data *sd, int cash, int points) { char output[128]; nullpo_retr(-1,sd); @@ -4604,7 +4626,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points) * Attempts to give zeny to player (sd) * tsd (optional) from who for log (if null take sd) *------------------------------------------*/ -int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, struct map_session_data *tsd) +static int pc_getzeny(struct map_session_data *sd, int zeny, enum e_log_pick_type type, struct map_session_data *tsd) { nullpo_retr(-1,sd); @@ -4621,6 +4643,8 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, 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 ) { @@ -4643,7 +4667,8 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type, * @return the inventory index of the first instance of the requested item. * @retval INDEX_NOT_FOUND if the item wasn't found. */ -int pc_search_inventory(struct map_session_data *sd, int item_id) { +static int pc_search_inventory(struct map_session_data *sd, int item_id) +{ int i; nullpo_retr(INDEX_NOT_FOUND, sd); @@ -4663,7 +4688,7 @@ int pc_search_inventory(struct map_session_data *sd, int item_id) { * 6 = ? * 7 = stack limitation *------------------------------------------*/ -int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type) +static int pc_additem(struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type) { struct item_data *data; int i; @@ -4744,6 +4769,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l 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 ) @@ -4751,6 +4777,8 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l 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 @@ -4767,6 +4795,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l pc->inventory_rental_add(sd, seconds); } } + quest->questinfo_refresh(sd); return 0; } @@ -4782,7 +4811,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l * 0 = success * 1 = invalid itemid or negative amount *------------------------------------------*/ -int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reason, e_log_pick_type log_type) +static int pc_delitem(struct map_session_data *sd, int n, int amount, int type, short reason, e_log_pick_type log_type) { nullpo_retr(1, sd); Assert_retr(1, n >= 0 && n < MAX_INVENTORY); @@ -4804,6 +4833,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reas clif->delitem(sd,n,amount,reason); if(!(type&2)) clif->updatestatus(sd,SP_WEIGHT); + quest->questinfo_refresh(sd); return 0; } @@ -4814,7 +4844,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reas * 0 = fail * 1 = success *------------------------------------------*/ -int pc_dropitem(struct map_session_data *sd,int n,int amount) +static int pc_dropitem(struct map_session_data *sd, int n, int amount) { nullpo_retr(1, sd); @@ -4857,7 +4887,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) +static int pc_takeitem(struct map_session_data *sd, struct flooritem_data *fitem) { int flag=0; int64 tick = timer->gettick(); @@ -4923,7 +4953,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) * 0 = no * 1 = yes *------------------------------------------*/ -int pc_isUseitem(struct map_session_data *sd,int n) +static int pc_isUseitem(struct map_session_data *sd, int n) { struct item_data *item; int nameid; @@ -5158,7 +5188,8 @@ int pc_isUseitem(struct map_session_data *sd,int n) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_useitem(struct map_session_data *sd,int n) { +static int pc_useitem(struct map_session_data *sd, int n) +{ int64 tick = timer->gettick(); int amount, nameid, i; bool removeItem = false; @@ -5328,7 +5359,7 @@ int pc_useitem(struct map_session_data *sd,int n) { * 0 = success * 1 = fail *------------------------------------------*/ -int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type) +static int pc_cart_additem(struct map_session_data *sd, struct item *item_data, int amount, e_log_pick_type log_type) { struct item_data *data; int i,w; @@ -5397,7 +5428,8 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun * 0 = success * 1 = fail *------------------------------------------*/ -int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type) { +static int pc_cart_delitem(struct map_session_data *sd, int n, int amount, int type, e_log_pick_type log_type) +{ struct item_data * data; nullpo_retr(1, sd); Assert_retr(1, n >= 0 && n < MAX_INVENTORY); @@ -5427,7 +5459,7 @@ int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_ * 0 = fail * 1 = succes *------------------------------------------*/ -int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) +static int pc_putitemtocart(struct map_session_data *sd, int idx, int amount) { struct item *item_data; int flag; @@ -5454,7 +5486,7 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) * -1 = itemid not found or no amount found * x = remaining itemid on cart after get *------------------------------------------*/ -int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount) +static int pc_cartitem_amount(struct map_session_data *sd, int idx, int amount) { struct item* item_data; @@ -5474,7 +5506,7 @@ int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount) * 0 = player not found or (FIXME) succes (from pc->cart_delitem) * 1 = failure *------------------------------------------*/ -int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) +static int pc_getitemfromcart(struct map_session_data *sd, int idx, int amount) { struct item *item_data; int flag; @@ -5495,7 +5527,7 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) return flag; } -void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) +static void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) { int i; @@ -5532,7 +5564,7 @@ void pc_bound_clear(struct map_session_data *sd, enum e_item_bound_type type) /*========================================== * Display item stolen msg to player sd *------------------------------------------*/ -int pc_show_steal(struct block_list *bl,va_list ap) +static int pc_show_steal(struct block_list *bl, va_list ap) { struct map_session_data *sd = NULL, *tsd = NULL; int itemid; @@ -5562,7 +5594,7 @@ int pc_show_steal(struct block_list *bl,va_list ap) * 0 = fail * 1 = succes *------------------------------------------*/ -int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv) +static int pc_steal_item(struct map_session_data *sd, struct block_list *bl, uint16 skill_lv) { int i,itemid,flag; int rate; @@ -5641,7 +5673,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil * * @return Amount of stolen zeny (0 in case of failure) */ -int pc_steal_coin(struct map_session_data *sd, struct block_list *target, uint16 skill_lv) +static int pc_steal_coin(struct map_session_data *sd, struct block_list *target, uint16 skill_lv) { int rate; struct mob_data *md = BL_CAST(BL_MOB, target); @@ -5673,7 +5705,8 @@ int pc_steal_coin(struct map_session_data *sd, struct block_list *target, uint16 * 1 - Invalid map index. * 2 - Map not in this map-server, and failed to locate alternate map-server. *------------------------------------------*/ -int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int y, clr_type clrtype) { +static int pc_setpos(struct map_session_data *sd, unsigned short map_index, int x, int y, clr_type clrtype) +{ int16 m; nullpo_ret(sd); @@ -5909,7 +5942,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short map_index, int x, int * 0 = fail or FIXME success (from pc->setpos) * x(1|2) = fail *------------------------------------------*/ -int pc_randomwarp(struct map_session_data *sd, clr_type type) { +static int pc_randomwarp(struct map_session_data *sd, clr_type type) +{ int x,y,i=0; int16 m; @@ -5935,7 +5969,8 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type) { * Records a memo point at sd's current position * pos - entry to replace, (-1: shift oldest entry out) *------------------------------------------*/ -int pc_memo(struct map_session_data* sd, int pos) { +static int pc_memo(struct map_session_data *sd, int pos) +{ int skill_lv; nullpo_ret(sd); @@ -5985,7 +6020,8 @@ int pc_memo(struct map_session_data* sd, int pos) { /*========================================== * Return player sd skill_lv learned for given skill *------------------------------------------*/ -int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { +static int pc_checkskill(struct map_session_data *sd, uint16 skill_id) +{ int index = 0; if(sd == NULL) return 0; if( skill_id >= GD_SKILLBASE && skill_id < GD_MAX ) { @@ -6004,7 +6040,8 @@ int pc_checkskill(struct map_session_data *sd,uint16 skill_id) { return 0; } -int pc_checkskill2(struct map_session_data *sd,uint16 index) { +static int pc_checkskill2(struct map_session_data *sd, uint16 index) +{ if (sd == NULL) return 0; if (index >= MAX_SKILL_DB) { @@ -6030,7 +6067,7 @@ int pc_checkskill2(struct map_session_data *sd,uint16 index) { * Return * 0 - No status found or all done *------------------------------------------*/ -int pc_checkallowskill(struct map_session_data *sd) +static int pc_checkallowskill(struct map_session_data *sd) { const enum sc_type scw_list[] = { SC_TWOHANDQUICKEN, @@ -6088,7 +6125,7 @@ int pc_checkallowskill(struct map_session_data *sd) * -1 : mean nothing equiped * idx : (this index could be used in inventory to found item_data) *------------------------------------------*/ -int pc_checkequip(struct map_session_data *sd,int pos) +static int pc_checkequip(struct map_session_data *sd, int pos) { int i; @@ -6106,7 +6143,7 @@ int pc_checkequip(struct map_session_data *sd,int pos) * Convert's from the client's lame Job ID system * to the map server's 'makes sense' system. [Skotlex] *------------------------------------------*/ -int pc_jobid2mapid(int16 class) +static int pc_jobid2mapid(int16 class) { switch (class) { //Novice And 1-1 Jobs @@ -6248,7 +6285,7 @@ int pc_jobid2mapid(int16 class) } //Reverts the map-style class id to the client-style one. -int pc_mapid2jobid(uint16 job, int sex) +static int pc_mapid2jobid(uint16 job, int sex) { switch (job) { //Novice And 1-1 Jobs @@ -6385,7 +6422,7 @@ int pc_mapid2jobid(uint16 job, int sex) /*==================================================== * This function return the name of the job (by [Yor]) *----------------------------------------------------*/ -const char *job_name(int class) +static const char *job_name(int class) { switch (class) { case JOB_NOVICE: // 550 @@ -6614,7 +6651,8 @@ const char *job_name(int class) } } -int pc_check_job_name(const char *name) { +static int pc_check_job_name(const char *name) +{ int i, len; struct { const char *name; @@ -6748,7 +6786,8 @@ int pc_check_job_name(const char *name) { return names[i].id; } -int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct block_list *tbl; @@ -6786,7 +6825,7 @@ int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pc_stop_following (struct map_session_data *sd) +static int pc_stop_following(struct map_session_data *sd) { nullpo_ret(sd); @@ -6802,7 +6841,8 @@ int pc_stop_following (struct map_session_data *sd) return 0; } -int pc_follow(struct map_session_data *sd,int target_id) { +static int pc_follow(struct map_session_data *sd, int target_id) +{ struct block_list *bl = map->id2bl(target_id); nullpo_retr(1, sd); if (bl == NULL /*|| bl->type != BL_PC*/) @@ -6816,7 +6856,7 @@ int pc_follow(struct map_session_data *sd,int target_id) { return 0; } -int pc_checkbaselevelup(struct map_session_data *sd) +static int pc_checkbaselevelup(struct map_session_data *sd) { uint64 next = pc->nextbaseexp(sd); @@ -6851,14 +6891,19 @@ 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; } -void pc_checkbaselevelup_sc(struct map_session_data *sd) +static void pc_checkbaselevelup_sc(struct map_session_data *sd) { nullpo_retv(sd); @@ -6876,7 +6921,8 @@ void pc_checkbaselevelup_sc(struct map_session_data *sd) } } -void pc_baselevelchanged(struct map_session_data *sd) { +static void pc_baselevelchanged(struct map_session_data *sd) +{ int i; nullpo_retv(sd); for( i = 0; i < EQI_MAX; i++ ) { @@ -6887,7 +6933,7 @@ void pc_baselevelchanged(struct map_session_data *sd) { } } -int pc_checkjoblevelup(struct map_session_data *sd) +static int pc_checkjoblevelup(struct map_session_data *sd) { uint64 next = pc->nextjobexp(sd); @@ -6916,13 +6962,19 @@ 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; } /** * Alters EXP based on self bonuses that do not get shared with the party **/ -void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src) { +static void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src) +{ int buff_ratio = 0, buff_job_ratio = 0, race_ratio = 0, pk_ratio = 0; int64 jexp, bexp; @@ -6997,7 +7049,7 @@ void pc_calcexp(struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, * @param is_quest Used to let client know that the EXP was from a quest (clif->displayexp) PACKETVER >= 20091027 * @retval true success **/ -bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest) +static bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base_exp, uint64 job_exp, bool is_quest) { float nextbp = 0, nextjp = 0; uint64 nextb = 0, nextj = 0; @@ -7086,14 +7138,14 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, uint64 base /*========================================== * Returns max level for this character. *------------------------------------------*/ -int pc_maxbaselv(const struct map_session_data *sd) +static int pc_maxbaselv(const struct map_session_data *sd) { nullpo_ret(sd); return pc->dbs->class_exp_table[pc->class2idx(sd->status.class)][CLASS_EXP_TABLE_BASE]->max_level; } -int pc_maxjoblv(const struct map_session_data *sd) +static int pc_maxjoblv(const struct map_session_data *sd) { nullpo_ret(sd); @@ -7105,7 +7157,7 @@ int pc_maxjoblv(const struct map_session_data *sd) *------------------------------------------*/ //Base exp needed for next level. -uint64 pc_nextbaseexp(const struct map_session_data *sd) +static uint64 pc_nextbaseexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7122,7 +7174,7 @@ uint64 pc_nextbaseexp(const struct map_session_data *sd) } //Base exp needed for this level. -uint64 pc_thisbaseexp(const struct map_session_data *sd) +static uint64 pc_thisbaseexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7146,7 +7198,7 @@ uint64 pc_thisbaseexp(const struct map_session_data *sd) *------------------------------------------*/ //Job exp needed for next level. -uint64 pc_nextjobexp(const struct map_session_data *sd) +static uint64 pc_nextjobexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7163,7 +7215,7 @@ uint64 pc_nextjobexp(const struct map_session_data *sd) } //Job exp needed for this level. -uint64 pc_thisjobexp(const struct map_session_data *sd) +static uint64 pc_thisjobexp(const struct map_session_data *sd) { const struct class_exp_group *exp_group = NULL; @@ -7178,7 +7230,7 @@ uint64 pc_thisjobexp(const struct map_session_data *sd) } /// Returns the value of the specified stat. -int pc_getstat(struct map_session_data* sd, int type) +static int pc_getstat(struct map_session_data *sd, int type) { nullpo_retr(-1, sd); @@ -7196,7 +7248,7 @@ int pc_getstat(struct map_session_data* sd, int type) /// Sets the specified stat to the specified value. /// Returns the new value. -int pc_setstat(struct map_session_data* sd, int type, int val) +static int pc_setstat(struct map_session_data *sd, int type, int val) { nullpo_retr(-1, sd); @@ -7211,11 +7263,13 @@ 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; } // Calculates the number of status points PC gets when leveling up (from level to level+1) -int pc_gets_status_point(int level) +static int pc_gets_status_point(int level) { if (battle_config.use_statpoint_table) //Use values from "db/statpoint.txt" return (pc->statp[level+1] - pc->statp[level]); @@ -7226,7 +7280,7 @@ int pc_gets_status_point(int level) /// Returns the number of stat points needed to change the specified stat by val. /// If val is negative, returns the number of stat points that would be needed to /// raise the specified stat from (current value - val) to current value. -int pc_need_status_point(struct map_session_data* sd, int type, int val) +static int pc_need_status_point(struct map_session_data *sd, int type, int val) { int low, high, sp = 0; @@ -7261,7 +7315,8 @@ int pc_need_status_point(struct map_session_data* sd, int type, int val) * @param type Stat to verify. * @return Maximum value the stat could grow by. */ -int pc_maxparameterincrease(struct map_session_data* sd, int type) { +static int pc_maxparameterincrease(struct map_session_data *sd, int type) +{ int base, final, status_points = sd->status.status_point; base = final = pc->getstat(sd, type); @@ -7291,7 +7346,8 @@ int pc_maxparameterincrease(struct map_session_data* sd, int type) { * @retval true if the stat was increased by any amount. * @retval false if there were no changes. */ -bool pc_statusup(struct map_session_data* sd, int type, int increase) { +static bool pc_statusup(struct map_session_data *sd, int type, int increase) +{ int max_increase = 0, current = 0, needed_points = 0, final_value = 0; nullpo_ret(sd); @@ -7350,7 +7406,7 @@ bool pc_statusup(struct map_session_data* sd, int type, int increase) { * @return the stat increase amount. * @retval 0 if no changes were made. */ -int pc_statusup2(struct map_session_data* sd, int type, int val) +static int pc_statusup2(struct map_session_data *sd, int type, int val) { int max, need; nullpo_ret(sd); @@ -7385,7 +7441,8 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) * Update skill_lv for player sd * Skill point allocation *------------------------------------------*/ -int pc_skillup(struct map_session_data *sd,uint16 skill_id) { +static int pc_skillup(struct map_session_data *sd, uint16 skill_id) +{ int index = 0; nullpo_ret(sd); @@ -7423,17 +7480,18 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) { clif->updatestatus(sd,SP_CARTINFO); if (!pc_has_permission(sd, PC_PERM_ALL_SKILL)) // may skill everything at any time anyways, and this would cause a huge slowdown clif->skillinfoblock(sd); - } else if( battle_config.skillup_limit ){ - if (sd->sktree.second != 0) + } else if (battle_config.skillup_limit) { + if (sd->sktree.second != 0) { #if PACKETVER >= 20090805 clif->msgtable_num(sd, MSG_UPGRADESKILLERROR_MORE_FIRSTJOBSKILL, sd->sktree.second); #endif - else if (sd->sktree.third != 0) + } else if (sd->sktree.third != 0) { #if PACKETVER >= 20091013 clif->msgtable_num(sd, MSG_UPGRADESKILLERROR_MORE_SECONDJOBSKILL, sd->sktree.third); #endif - else if (pc->calc_skillpoint(sd) < 9) /* TODO: official response? */ + } else if (pc->calc_skillpoint(sd) < 9) { /* TODO: official response? */ clif->messagecolor_self(sd->fd, COLOR_RED, "You need the basic skills"); + } } return 0; } @@ -7441,7 +7499,7 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) { /*========================================== * /allskill *------------------------------------------*/ -int pc_allskillup(struct map_session_data *sd) +static int pc_allskillup(struct map_session_data *sd) { int i; @@ -7496,7 +7554,7 @@ int pc_allskillup(struct map_session_data *sd) /*========================================== * /resetlvl *------------------------------------------*/ -int pc_resetlvl(struct map_session_data* sd,int type) +static int pc_resetlvl(struct map_session_data *sd, int type) { int i; @@ -7584,7 +7642,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) /*========================================== * /resetstate *------------------------------------------*/ -int pc_resetstate(struct map_session_data* sd) +static int pc_resetstate(struct map_session_data *sd) { nullpo_ret(sd); @@ -7650,7 +7708,7 @@ int pc_resetstate(struct map_session_data* sd) * /resetskill * @param flag: @see enum pc_resetskill_flag *------------------------------------------*/ -int pc_resetskill(struct map_session_data* sd, int flag) +static int pc_resetskill(struct map_session_data *sd, int flag) { int i, inf2, skill_point=0; nullpo_ret(sd); @@ -7762,7 +7820,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) return skill_point; } -bool pc_resetskill_job(struct map_session_data* sd, int index) +static bool pc_resetskill_job(struct map_session_data *sd, int index) { uint16 skill_id; @@ -7789,7 +7847,7 @@ bool pc_resetskill_job(struct map_session_data* sd, int index) /*========================================== * /resetfeel [Komurka] *------------------------------------------*/ -int pc_resetfeel(struct map_session_data* sd) +static int pc_resetfeel(struct map_session_data *sd) { int i; nullpo_ret(sd); @@ -7804,7 +7862,7 @@ int pc_resetfeel(struct map_session_data* sd) return 0; } -int pc_resethate(struct map_session_data* sd) +static int pc_resethate(struct map_session_data *sd) { int i; nullpo_ret(sd); @@ -7816,7 +7874,7 @@ int pc_resethate(struct map_session_data* sd) return 0; } -int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) +static int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = 0; nullpo_ret(sd); @@ -7830,7 +7888,7 @@ int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id) return bonus; } -int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) +static int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) { int i, bonus = sd->bonus.add_heal_rate; @@ -7871,7 +7929,8 @@ int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id) return bonus; } -int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) { +static int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) +{ int i, bonus = sd->bonus.add_heal2_rate; ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == skill_id); @@ -7882,7 +7941,7 @@ int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id) { return bonus; } -void pc_respawn(struct map_session_data* sd, clr_type clrtype) +static void pc_respawn(struct map_session_data *sd, clr_type clrtype) { if( !pc_isdead(sd) ) return; // not applicable @@ -7895,7 +7954,8 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype) clif->resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet. } -int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); if( sd != NULL ) { @@ -7909,7 +7969,7 @@ int pc_respawn_timer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Invoked when a player has received damage *------------------------------------------*/ -void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp) +static void pc_damage(struct map_session_data *sd, struct block_list *src, unsigned int hp, unsigned int sp) { if (sp) clif->updatestatus(sd,SP_SP); if (hp) clif->updatestatus(sd,SP_HP); @@ -7936,12 +7996,21 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h 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); + } } /*========================================== * Invoked when a player has negative current hp *------------------------------------------*/ -int pc_dead(struct map_session_data *sd,struct block_list *src) { +static int pc_dead(struct map_session_data *sd, struct block_list *src) +{ int i=0,j=0; int64 tick = timer->gettick(); @@ -8030,6 +8099,9 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { } pc_setdead(sd); + + clif->party_dead_notification(sd); + //Reset menu skills/item skills if (sd->skillitem) sd->skillitem = sd->skillitemlv = 0; @@ -8085,6 +8157,8 @@ 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) @@ -8297,12 +8371,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { return 1; } -bool pc_isDeathPenaltyJob(uint16 job) +static bool pc_isDeathPenaltyJob(uint16 job) { return (job & MAPID_UPPERMASK) != MAPID_NOVICE; // only novices will receive no penalty } -void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { +static void pc_revive(struct map_session_data *sd, unsigned int hp, unsigned int sp) +{ nullpo_retv(sd); if(hp) clif->updatestatus(sd,SP_HP); if(sp) clif->updatestatus(sd,SP_SP); @@ -8323,7 +8398,7 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { /*========================================== * script reading pc status registry *------------------------------------------*/ -int64 pc_readparam(const struct map_session_data *sd, int type) +static int64 pc_readparam(const struct map_session_data *sd, int type) { int64 val = 0; @@ -8476,7 +8551,7 @@ int64 pc_readparam(const struct map_session_data *sd, int type) /*========================================== * script set pc status registry *------------------------------------------*/ -int pc_setparam(struct map_session_data *sd, int type, int64 val) +static int pc_setparam(struct map_session_data *sd, int type, int64 val) { int delta; nullpo_ret(sd); @@ -8653,7 +8728,7 @@ int pc_setparam(struct map_session_data *sd, int type, int64 val) /*========================================== * HP/SP Healing. If flag is passed, the heal type is through clif->heal, otherwise update status. *------------------------------------------*/ -void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type) +static void pc_heal(struct map_session_data *sd, unsigned int hp, unsigned int sp, int type) { nullpo_retv(sd); if (type) { @@ -8675,7 +8750,7 @@ void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int ty * Heal player hp and/or sp linearly. * Calculate bonus by status. *------------------------------------------*/ -int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) +static int pc_itemheal(struct map_session_data *sd, int itemid, int hp, int sp) { int bonus, tmp; @@ -8758,7 +8833,7 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) * HP/SP Recovery * Heal player hp nad/or sp by rate *------------------------------------------*/ -int pc_percentheal(struct map_session_data *sd,int hp,int sp) +static int pc_percentheal(struct map_session_data *sd, int hp, int sp) { nullpo_ret(sd); @@ -8793,7 +8868,7 @@ int pc_percentheal(struct map_session_data *sd,int hp,int sp) return 0; } -int jobchange_killclone(struct block_list *bl, va_list ap) +static int jobchange_killclone(struct block_list *bl, va_list ap) { struct mob_data *md = NULL; int flag = va_arg(ap, int); @@ -8811,7 +8886,7 @@ int jobchange_killclone(struct block_list *bl, va_list ap) * Called when player changes job * Rewrote to make it tidider [Celest] *------------------------------------------*/ -int pc_jobchange(struct map_session_data *sd, int class, int upper) +static int pc_jobchange(struct map_session_data *sd, int class, int upper) { int i, fame_flag=0; int job, idx = 0; @@ -9000,6 +9075,9 @@ int pc_jobchange(struct map_session_data *sd, int class, int upper) break; } } + quest->questinfo_refresh(sd); + + achievement->validate_jobchange(sd); // Achievements [Smokexyz/Hercules] return 0; } @@ -9007,7 +9085,7 @@ int pc_jobchange(struct map_session_data *sd, int class, int upper) /*========================================== * Tell client player sd has change equipement *------------------------------------------*/ -int pc_equiplookall(struct map_session_data *sd) +static int pc_equiplookall(struct map_session_data *sd) { nullpo_ret(sd); @@ -9024,7 +9102,7 @@ int pc_equiplookall(struct map_session_data *sd) /*========================================== * Tell client player sd has change look (hair,equip...) *------------------------------------------*/ -int pc_changelook(struct map_session_data *sd,int type,int val) +static int pc_changelook(struct map_session_data *sd, int type, int val) { nullpo_ret(sd); @@ -9097,7 +9175,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) /*========================================== * Give an option (type) to player (sd) and display it to client *------------------------------------------*/ -int pc_setoption(struct map_session_data *sd,int type) +static int pc_setoption(struct map_session_data *sd, int type) { int p_type, new_look=0; nullpo_ret(sd); @@ -9195,7 +9273,8 @@ int pc_setoption(struct map_session_data *sd,int type) /*========================================== * Give player a cart *------------------------------------------*/ -int pc_setcart(struct map_session_data *sd,int type) { +static int pc_setcart(struct map_session_data *sd, int type) +{ #ifndef NEW_CARTS int cart[6] = {OPTION_NOTHING,OPTION_CART1,OPTION_CART2,OPTION_CART3,OPTION_CART4,OPTION_CART5}; int option; @@ -9258,7 +9337,7 @@ int pc_setcart(struct map_session_data *sd,int type) { * @param sd Target player. * @param flag New state. **/ -void pc_setfalcon(struct map_session_data *sd, bool flag) +static void pc_setfalcon(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9277,7 +9356,7 @@ void pc_setfalcon(struct map_session_data *sd, bool flag) * @param sd Target player. * @param flag New state. **/ -void pc_setridingpeco(struct map_session_data *sd, bool flag) +static void pc_setridingpeco(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9296,7 +9375,7 @@ void pc_setridingpeco(struct map_session_data *sd, bool flag) * @param sd Target player. * @param flag New state. **/ -void pc_setmadogear(struct map_session_data *sd, bool flag) +static void pc_setmadogear(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9315,7 +9394,7 @@ void pc_setmadogear(struct map_session_data *sd, bool flag) * @param sd Target player. * @param type New state. This must be a valid OPTION_DRAGON* or 0. **/ -void pc_setridingdragon(struct map_session_data *sd, unsigned int type) +static void pc_setridingdragon(struct map_session_data *sd, unsigned int type) { nullpo_retv(sd); if (type&OPTION_DRAGON) { @@ -9348,7 +9427,7 @@ void pc_setridingdragon(struct map_session_data *sd, unsigned int type) * @param sd Target player. * @param flag New state. **/ -void pc_setridingwug(struct map_session_data *sd, bool flag) +static void pc_setridingwug(struct map_session_data *sd, bool flag) { nullpo_retv(sd); if (flag) { @@ -9367,7 +9446,8 @@ void pc_setridingwug(struct map_session_data *sd, bool flag) * Called from unit_attack and unit_attack_timer_sub * @retval true Can attack **/ -bool pc_can_attack( struct map_session_data *sd, int target_id ) { +static bool pc_can_attack(struct map_session_data *sd, int target_id) +{ nullpo_retr(false, sd); if( sd->sc.data[SC_BASILICA] || @@ -9393,7 +9473,8 @@ bool pc_can_attack( struct map_session_data *sd, int target_id ) { * Called from clif_parse_GlobalMessage and clif_parse_WisMessage * @retval true Can talk **/ -bool pc_can_talk( struct map_session_data *sd ) { +static bool pc_can_talk(struct map_session_data *sd) +{ nullpo_retr(false, sd); if( sd->sc.data[SC_BERSERK] || @@ -9408,7 +9489,7 @@ bool pc_can_talk( struct map_session_data *sd ) { /*========================================== * Check if player can drop an item *------------------------------------------*/ -int pc_candrop(struct map_session_data *sd, struct item *item) +static int pc_candrop(struct map_session_data *sd, struct item *item) { if( item && (item->expire_time || (item->bound && !pc_can_give_bound_items(sd))) ) return 0; @@ -9419,14 +9500,16 @@ int pc_candrop(struct map_session_data *sd, struct item *item) /** * For '@type' variables (temporary numeric char reg) **/ -int pc_readreg(struct map_session_data* sd, int64 reg) { +static int pc_readreg(struct map_session_data *sd, int64 reg) +{ nullpo_ret(sd); return i64db_iget(sd->regs.vars, reg); } /** * For '@type' variables (temporary numeric char reg) **/ -void pc_setreg(struct map_session_data* sd, int64 reg, int val) { +static void pc_setreg(struct map_session_data *sd, int64 reg, int val) +{ unsigned int index = script_getvaridx(reg); nullpo_retv(sd); @@ -9444,7 +9527,8 @@ void pc_setreg(struct map_session_data* sd, int64 reg, int val) { /** * For '@type$' variables (temporary string char reg) **/ -char* pc_readregstr(struct map_session_data* sd, int64 reg) { +static char *pc_readregstr(struct map_session_data *sd, int64 reg) +{ struct script_reg_str *p = NULL; nullpo_retr(NULL, sd); @@ -9455,7 +9539,8 @@ char* pc_readregstr(struct map_session_data* sd, int64 reg) { /** * For '@type$' variables (temporary string char reg) **/ -void pc_setregstr(struct map_session_data* sd, int64 reg, const char* str) { +static void pc_setregstr(struct map_session_data *sd, int64 reg, const char *str) +{ struct script_reg_str *p = NULL; unsigned int index = script_getvaridx(reg); struct DBData prev; @@ -9494,7 +9579,8 @@ void pc_setregstr(struct map_session_data* sd, int64 reg, const char* str) { * - '#type' (permanent numeric account reg) * - '##type' (permanent numeric account reg2) **/ -int pc_readregistry(struct map_session_data *sd, int64 reg) { +static int pc_readregistry(struct map_session_data *sd, int64 reg) +{ struct script_reg_num *p = NULL; nullpo_ret(sd); @@ -9516,7 +9602,8 @@ int pc_readregistry(struct map_session_data *sd, int64 reg) { * - '#type$' (permanent str account reg) * - '##type$' (permanent str account reg2) **/ -char* pc_readregistry_str(struct map_session_data *sd, int64 reg) { +static char *pc_readregistry_str(struct map_session_data *sd, int64 reg) +{ struct script_reg_str *p = NULL; nullpo_retr(NULL, sd); @@ -9538,7 +9625,8 @@ char* pc_readregistry_str(struct map_session_data *sd, int64 reg) { * - '#type' (permanent numeric account reg) * - '##type' (permanent numeric account reg2) **/ -int pc_setregistry(struct map_session_data *sd, int64 reg, int val) { +static int pc_setregistry(struct map_session_data *sd, int64 reg, int val) +{ struct script_reg_num *p = NULL; const char *regname = script->get_str( script_getvarid(reg) ); unsigned int index = script_getvaridx(reg); @@ -9614,7 +9702,8 @@ int pc_setregistry(struct map_session_data *sd, int64 reg, int val) { * - '#type$' (permanent str account reg) * - '##type$' (permanent str account reg2) **/ -int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) { +static int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) +{ struct script_reg_str *p = NULL; const char *regname = script->get_str( script_getvarid(reg) ); unsigned int index = script_getvaridx(reg); @@ -9670,7 +9759,8 @@ int pc_setregistry_str(struct map_session_data *sd, int64 reg, const char *val) /*========================================== * Exec eventtimer for player sd (retrieved from map_session (id)) *------------------------------------------*/ -int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) { +static int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd=map->id2sd(id); char *p = (char *)data; int i; @@ -9694,7 +9784,7 @@ int pc_eventtimer(int tid, int64 tick, int id, intptr_t data) { /*========================================== * Add eventtimer for player sd ? *------------------------------------------*/ -int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name) +static int pc_addeventtimer(struct map_session_data *sd, int tick, const char *name) { int i; nullpo_ret(sd); @@ -9713,7 +9803,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name) /*========================================== * Del eventtimer for player sd ? *------------------------------------------*/ -int pc_deleventtimer(struct map_session_data *sd,const char *name) +static int pc_deleventtimer(struct map_session_data *sd, const char *name) { char* p = NULL; int i; @@ -9744,7 +9834,7 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name) /*========================================== * Update eventtimer count for player sd *------------------------------------------*/ -int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick) +static int pc_addeventtimercount(struct map_session_data *sd, const char *name, int tick) { int i; @@ -9763,7 +9853,7 @@ int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick) /*========================================== * Remove all eventtimer for player sd *------------------------------------------*/ -int pc_cleareventtimer(struct map_session_data *sd) +static int pc_cleareventtimer(struct map_session_data *sd) { int i; @@ -9783,7 +9873,8 @@ int pc_cleareventtimer(struct map_session_data *sd) return 0; } /* called when a item with combo is worn */ -int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { +static int pc_checkcombo(struct map_session_data *sd, struct item_data *data) +{ int i, j, k, z; int index, success = 0; struct pc_combos *combo; @@ -9862,7 +9953,8 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { } /* called when a item with combo is removed */ -int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { +static int pc_removecombo(struct map_session_data *sd, struct item_data *data) +{ int i, retval = 0; nullpo_ret(sd); @@ -9909,7 +10001,8 @@ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { return retval; } -int pc_load_combo(struct map_session_data *sd) { +static int pc_load_combo(struct map_session_data *sd) +{ int i, ret = 0; nullpo_ret(sd); for( i = 0; i < EQI_MAX; i++ ) { @@ -9936,13 +10029,13 @@ int pc_load_combo(struct map_session_data *sd) { } /** -* Equip item at given position. -* @param sd the affected player structure. Must be checked before. -* @param id item structure for equip. Must be checked before. -* @param n inventory item position. Must be checked before. -* @param pos slot position. Must be checked before. -**/ -void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, int pos) + * Equip item at given position. + * @param sd the affected player structure. Must be checked before. + * @param id item structure for equip. Must be checked before. + * @param n inventory item position. Must be checked before. + * @param pos slot position. Must be checked before. + */ +static void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, int pos) { nullpo_retv(sd); if ((!map_no_view(sd->bl.m,EQP_SHADOW_WEAPON) && pos & EQP_SHADOW_WEAPON) || @@ -10041,7 +10134,7 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int n, * 0 = fail * 1 = success *------------------------------------------*/ -int pc_equipitem(struct map_session_data *sd,int n,int req_pos) +static int pc_equipitem(struct map_session_data *sd, int n, int req_pos) { int i,pos,flag=0,iflag; struct item_data *id; @@ -10176,12 +10269,12 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } /** -* Unrquip item ad given position. -* @param sd the affected player structure. Must be checked before. -* @param n inventory item position. Must be checked before. -* @param pos slot position. Must be checked before. -**/ -void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) + * Unequip an item at the given position. + * @param sd the affected player structure. Must be checked before. + * @param n inventory item position. Must be checked before. + * @param pos slot position. Must be checked before. + */ +static void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) { nullpo_retv(sd); if (pos & EQP_HAND_R) { @@ -10248,7 +10341,7 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) * 0 = fail * 1 = success *------------------------------------------*/ -int pc_unequipitem(struct map_session_data *sd,int n,int flag) +static int pc_unequipitem(struct map_session_data *sd, int n, int flag) { int i, iflag; bool status_calc = false; @@ -10332,7 +10425,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) } /* Item Options checking */ for (i = 0; i < MAX_ITEM_OPTIONS; i++) { - struct item_option *ito = NULL; + struct itemdb_option *ito = NULL; int16 item_option = sd->status.inventory[n].option[i].index; if (item_option <= 0) @@ -10395,7 +10488,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) * Checking if player (sd) have unauthorize, invalide item * on inventory, cart, equiped for the map (item_noequip) *------------------------------------------*/ -int pc_checkitem(struct map_session_data *sd) +static int pc_checkitem(struct map_session_data *sd) { int i, calc_flag = 0; @@ -10539,7 +10632,7 @@ int pc_checkitem(struct map_session_data *sd) /*========================================== * Update PVP rank for sd1 in cmp to sd2 *------------------------------------------*/ -int pc_calc_pvprank_sub(struct block_list *bl, va_list ap) +static int pc_calc_pvprank_sub(struct block_list *bl, va_list ap) { struct map_session_data *sd1 = NULL; struct map_session_data *sd2 = va_arg(ap,struct map_session_data *); @@ -10562,7 +10655,8 @@ int pc_calc_pvprank_sub(struct block_list *bl, va_list ap) * Calculate new rank beetween all present players (map->foreachinarea) * and display result *------------------------------------------*/ -int pc_calc_pvprank(struct map_session_data *sd) { +static int pc_calc_pvprank(struct map_session_data *sd) +{ int old; struct map_data *m; nullpo_ret(sd); @@ -10577,7 +10671,8 @@ int pc_calc_pvprank(struct map_session_data *sd) { /*========================================== * Calculate next sd ranking calculation from config *------------------------------------------*/ -int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; sd=map->id2sd(id); @@ -10601,7 +10696,7 @@ int pc_calc_pvprank_timer(int tid, int64 tick, int id, intptr_t data) { * partner_id = yes * 0 = no *------------------------------------------*/ -int pc_ismarried(struct map_session_data *sd) +static int pc_ismarried(struct map_session_data *sd) { if(sd == NULL) return -1; @@ -10616,7 +10711,7 @@ int pc_ismarried(struct map_session_data *sd) * -1 = fail * 0 = success *------------------------------------------*/ -int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) +static int pc_marriage(struct map_session_data *sd, struct map_session_data *dstsd) { if(sd == NULL || dstsd == NULL || sd->status.partner_id > 0 || dstsd->status.partner_id > 0 || @@ -10624,6 +10719,11 @@ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) 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; } @@ -10633,7 +10733,7 @@ int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd) * -1 = fail * 0 = success *------------------------------------------*/ -int pc_divorce(struct map_session_data *sd) +static int pc_divorce(struct map_session_data *sd) { struct map_session_data *p_sd; int i; @@ -10672,7 +10772,8 @@ int pc_divorce(struct map_session_data *sd) /*========================================== * Get sd partner charid. (Married partner) *------------------------------------------*/ -struct map_session_data *pc_get_partner(struct map_session_data *sd) { +static struct map_session_data *pc_get_partner(struct map_session_data *sd) +{ if (sd && pc->ismarried(sd)) // charid2sd returns NULL if not found return map->charid2sd(sd->status.partner_id); @@ -10683,7 +10784,8 @@ struct map_session_data *pc_get_partner(struct map_session_data *sd) { /*========================================== * Get sd father charid. (Need to be baby) *------------------------------------------*/ -struct map_session_data *pc_get_father(struct map_session_data *sd) { +static struct map_session_data *pc_get_father(struct map_session_data *sd) +{ if (sd && (sd->job & JOBL_BABY) != 0 && sd->status.father > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.father); @@ -10694,7 +10796,8 @@ struct map_session_data *pc_get_father(struct map_session_data *sd) { /*========================================== * Get sd mother charid. (Need to be baby) *------------------------------------------*/ -struct map_session_data *pc_get_mother(struct map_session_data *sd) { +static struct map_session_data *pc_get_mother(struct map_session_data *sd) +{ if (sd && (sd->job & JOBL_BABY) != 0 && sd->status.mother > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.mother); @@ -10705,7 +10808,8 @@ struct map_session_data *pc_get_mother(struct map_session_data *sd) { /*========================================== * Get sd children charid. (Need to be married) *------------------------------------------*/ -struct map_session_data *pc_get_child(struct map_session_data *sd) { +static struct map_session_data *pc_get_child(struct map_session_data *sd) +{ if (sd && pc->ismarried(sd) && sd->status.child > 0) // charid2sd returns NULL if not found return map->charid2sd(sd->status.child); @@ -10716,7 +10820,7 @@ struct map_session_data *pc_get_child(struct map_session_data *sd) { /*========================================== * Set player sd to bleed. (losing hp and/or sp each diff_tick) *------------------------------------------*/ -void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) +static void pc_bleeding(struct map_session_data *sd, unsigned int diff_tick) { int hp = 0, sp = 0; @@ -10751,7 +10855,8 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) //Character regen. Flag is used to know which types of regen can take place. //&1: HP regen //&2: SP regen -void pc_regen (struct map_session_data *sd, unsigned int diff_tick) { +static void pc_regen(struct map_session_data *sd, unsigned int diff_tick) +{ int hp = 0, sp = 0; nullpo_retv(sd); @@ -10780,7 +10885,8 @@ void pc_regen (struct map_session_data *sd, unsigned int diff_tick) { /*========================================== * Memo player sd savepoint. (map,x,y) *------------------------------------------*/ -int pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int y) { +static int pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int y) +{ nullpo_ret(sd); sd->status.save_point.map = map_index; @@ -10793,7 +10899,8 @@ int pc_setsavepoint(struct map_session_data *sd, short map_index, int x, int y) /*========================================== * Save 1 player data at autosave intervall *------------------------------------------*/ -int pc_autosave(int tid, int64 tick, int id, intptr_t data) { +static int pc_autosave(int tid, int64 tick, int id, intptr_t data) +{ int interval; struct s_mapiterator* iter; struct map_session_data* sd; @@ -10831,7 +10938,8 @@ int pc_autosave(int tid, int64 tick, int id, intptr_t data) { return 0; } -int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) { +static int pc_daynight_timer_sub(struct map_session_data *sd, va_list ap) +{ nullpo_ret(sd); if (sd->state.night != map->night_flag && map->list[sd->bl.m].flag.nightenabled) { //Night/day state does not match. clif->status_change(&sd->bl, SI_SKE, map->night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex] @@ -10844,7 +10952,8 @@ int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap) { * timer to do the day [Yor] * data: 0 = called by timer, 1 = gmcommand/script *------------------------------------------------*/ -int map_day_timer(int tid, int64 tick, int id, intptr_t data) { +static int map_day_timer(int tid, int64 tick, int id, intptr_t data) +{ char tmp_soutput[1024]; if (data == 0 && battle_config.day_duration <= 0) // if we want a day @@ -10864,7 +10973,8 @@ int map_day_timer(int tid, int64 tick, int id, intptr_t data) { * timer to do the night [Yor] * data: 0 = called by timer, 1 = gmcommand/script *------------------------------------------------*/ -int map_night_timer(int tid, int64 tick, int id, intptr_t data) { +static int map_night_timer(int tid, int64 tick, int id, intptr_t data) +{ char tmp_soutput[1024]; if (data == 0 && battle_config.night_duration <= 0) // if we want a night @@ -10880,20 +10990,27 @@ int map_night_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void pc_setstand(struct map_session_data *sd) { +static void pc_setstand(struct map_session_data *sd) +{ nullpo_retv(sd); status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER); clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT); //Reset sitting tick. sd->ssregen.tick.hp = sd->ssregen.tick.sp = 0; - sd->state.dead_sit = sd->vd.dead_sit = 0; + if (pc_isdead(sd)) { + sd->state.dead_sit = sd->vd.dead_sit = 0; + clif->party_dead_notification(sd); + } else { + sd->state.dead_sit = sd->vd.dead_sit = 0; + } } /** * Mechanic (MADO GEAR) **/ -void pc_overheat(struct map_session_data *sd, int val) { +static void pc_overheat(struct map_session_data *sd, int val) +{ int heat = val, skill_lv, limit[] = { 10, 20, 28, 46, 66 }; @@ -10919,7 +11036,7 @@ void pc_overheat(struct map_session_data *sd, int val) { /** * Check if player is autolooting given itemID. */ -bool pc_isautolooting(struct map_session_data *sd, int nameid) +static bool pc_isautolooting(struct map_session_data *sd, int nameid) { int i = 0; @@ -10940,7 +11057,8 @@ bool pc_isautolooting(struct map_session_data *sd, int nameid) * @param sd Player map session data * @param command Command name with @/# and without params */ -bool pc_can_use_command(struct map_session_data *sd, const char *command) { +static bool pc_can_use_command(struct map_session_data *sd, const char *command) +{ return atcommand->can_use(sd,command); } @@ -10949,7 +11067,7 @@ bool pc_can_use_command(struct map_session_data *sd, const char *command) { * * @see TimerFunc */ -int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) +static int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) { struct map_session_data *sd = map->id2sd(id); int i; @@ -10990,7 +11108,7 @@ int pc_charm_timer(int tid, int64 tick, int id, intptr_t data) * @param max Maximum amount of charms to add. * @param type Charm type (@see spirit_charm_types) */ -void pc_add_charm(struct map_session_data *sd, int interval, int max, int type) +static void pc_add_charm(struct map_session_data *sd, int interval, int max, int type) { int tid, i; @@ -11032,7 +11150,7 @@ void pc_add_charm(struct map_session_data *sd, int interval, int max, int type) * @param count Amount of charms to remove. * @param type Type of charm to remove. */ -void pc_del_charm(struct map_session_data *sd, int count, int type) +static void pc_del_charm(struct map_session_data *sd, int count, int type) { int i; @@ -11079,7 +11197,7 @@ void pc_del_charm(struct map_session_data *sd, int count, int type) * @param type Modifier type (1=exp 2=itemdrop) * @return The percent rate modifier (100 = 100%) */ -int pc_level_penalty_mod(int diff, unsigned char race, uint32 mode, int type) +static int pc_level_penalty_mod(int diff, unsigned char race, uint32 mode, int type) { #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) int rate = 100, i; @@ -11109,7 +11227,7 @@ int pc_level_penalty_mod(int diff, unsigned char race, uint32 mode, int type) #endif } -bool pc_read_skill_job_skip(short skill_id, int job_id) +static bool pc_read_skill_job_skip(short skill_id, int job_id) { return skill_id == NV_TRICKDEAD && ((pc->jobid2mapid(job_id) & (MAPID_BASEMASK | JOBL_2)) != MAPID_NOVICE); // skip trickdead for non-novices } @@ -11127,7 +11245,7 @@ bool pc_read_skill_job_skip(short skill_id, int job_id) * * @author [Ind/Hercules] */ -void pc_read_skill_tree(void) +static void pc_read_skill_tree(void) { struct config_t skill_tree_conf; struct config_setting_t *skt = NULL; @@ -11324,7 +11442,7 @@ void pc_read_skill_tree(void) /** * Clears the skill tree and frees any allocated memory. */ -void pc_clear_skill_tree(void) +static void pc_clear_skill_tree(void) { int i; for (i = 0; i < CLASS_COUNT; i++) { @@ -11338,7 +11456,8 @@ void pc_clear_skill_tree(void) memset(pc->skill_tree, 0, sizeof(pc->skill_tree)); } -bool pc_readdb_levelpenalty(char* fields[], int columns, int current) { +static bool pc_readdb_levelpenalty(char *fields[], int columns, int current) +{ #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP) int type, race, diff; @@ -11367,7 +11486,7 @@ bool pc_readdb_levelpenalty(char* fields[], int columns, int current) { return true; } -bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) +static bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) { struct class_exp_group entry = { { 0 } }; struct config_setting_t *exp_t = NULL; @@ -11414,12 +11533,12 @@ bool pc_read_exp_db_sub_class(struct config_setting_t *t, bool base) } /** - * Description: Helper function to read a root configuration in the exp_db.conf file. + * Description: Helper function to read a root configuration in the exp_group_db.conf file. * @param[in] t pointer to the root config setting * @param[in] base boolean switch determining whether to read either base or job exp. * @return total number of valid entries read from the setting. */ -int pc_read_exp_db_sub(struct config_setting_t *t, bool base) +static int pc_read_exp_db_sub(struct config_setting_t *t, bool base) { int i = 0, entry_count = 0; struct config_setting_t *tt = NULL; @@ -11438,7 +11557,7 @@ int pc_read_exp_db_sub(struct config_setting_t *t, bool base) * Description: Initiates reading of the exp_group_db.conf. * @return true success, false on failure. */ -bool pc_read_exp_db(void) +static bool pc_read_exp_db(void) { struct config_t exp_db_conf; struct config_setting_t *edb = NULL; @@ -11477,12 +11596,13 @@ bool pc_read_exp_db(void) } /*========================================== - * pc DB reading. - * exp.txt - required experience values - * skill_tree.txt - skill tree for every class - * attr_fix.txt - elemental adjustment table + * PC DB reading. + * exp_group_db.conf - required experience values + * skill_tree.txt - skill tree for every class + * attr_fix.txt - elemental adjustment table *------------------------------------------*/ -int pc_readdb(void) { +static int pc_readdb(void) +{ int i,j,k; unsigned int count = 0; FILE *fp; @@ -11607,7 +11727,7 @@ int pc_readdb(void) { return 0; } -bool pc_job_is_dummy(int job) +static bool pc_job_is_dummy(int job) { if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER @@ -11620,7 +11740,8 @@ bool pc_job_is_dummy(int job) return false; } -void pc_validate_levels(void) { +static void pc_validate_levels(void) +{ int i; int j; for (i = 0; i < JOB_MAX; i++) { @@ -11635,7 +11756,8 @@ void pc_validate_levels(void) { } } -void pc_itemcd_do(struct map_session_data *sd, bool load) { +static void pc_itemcd_do(struct map_session_data *sd, bool load) +{ int i,cursor = 0; struct item_cd* cd = NULL; @@ -11670,7 +11792,8 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) { return; } -void pc_bank_deposit(struct map_session_data *sd, int money) { +static void pc_bank_deposit(struct map_session_data *sd, int money) +{ unsigned int limit_check; nullpo_retv(sd); @@ -11693,7 +11816,8 @@ void pc_bank_deposit(struct map_session_data *sd, int money) { clif->bank_deposit(sd,BDA_SUCCESS); } } -void pc_bank_withdraw(struct map_session_data *sd, int money) { +static void pc_bank_withdraw(struct map_session_data *sd, int money) +{ unsigned int limit_check; nullpo_retv(sd); @@ -11720,7 +11844,8 @@ void pc_bank_withdraw(struct map_session_data *sd, int money) { } } /* status change data arrived from char-server */ -void pc_scdata_received(struct map_session_data *sd) { +static void pc_scdata_received(struct map_session_data *sd) +{ nullpo_retv(sd); pc->inventory_rentals(sd); clif->show_modifiers(sd); @@ -11740,7 +11865,8 @@ void pc_scdata_received(struct map_session_data *sd) { pc->autotrade_start(sd); } } -int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd = map->id2sd(id); if( !sd ) return 0; @@ -11756,7 +11882,8 @@ int pc_expiration_timer(int tid, int64 tick, int id, intptr_t data) { } /* This timer exists only when a character with an expire timer > 24h is online */ /* It loops through online players once an hour to check whether a new < 24h is available */ -int pc_global_expiration_timer(int tid, int64 tick, int id, intptr_t data) { +static int pc_global_expiration_timer(int tid, int64 tick, int id, intptr_t data) +{ struct s_mapiterator* iter; struct map_session_data* sd; @@ -11769,7 +11896,8 @@ int pc_global_expiration_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void pc_expire_check(struct map_session_data *sd) { +static void pc_expire_check(struct map_session_data *sd) +{ nullpo_retv(sd); /* ongoing timer */ if( sd->expiration_tid != INVALID_TIMER ) @@ -11790,7 +11918,7 @@ void pc_expire_check(struct map_session_data *sd) { /** * Loads autotraders ***/ -void pc_autotrade_load(void) +static void pc_autotrade_load(void) { char *data; @@ -11823,7 +11951,8 @@ void pc_autotrade_load(void) /** * Loads vending data and sets it up, is triggered when char server data that pc_autotrade_load requested arrives **/ -void pc_autotrade_start(struct map_session_data *sd) { +static void pc_autotrade_start(struct map_session_data *sd) +{ unsigned int count = 0; int i; char *data; @@ -11870,7 +11999,8 @@ void pc_autotrade_start(struct map_session_data *sd) { /** * Perform a autotrade action **/ -void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update_action action) { +static void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update_action action) +{ int i; nullpo_retv(sd); @@ -11920,7 +12050,8 @@ void pc_autotrade_update(struct map_session_data *sd, enum e_pc_autotrade_update /** * Handles characters upon @autotrade usage **/ -void pc_autotrade_prepare(struct map_session_data *sd) { +static void pc_autotrade_prepare(struct map_session_data *sd) +{ struct autotrade_vending *data; int i, cursor = 0; int account_id, char_id; @@ -11970,7 +12101,8 @@ void pc_autotrade_prepare(struct map_session_data *sd) { /** * Prepares autotrade data from pc->at_db from a player that has already returned from char server **/ -void pc_autotrade_populate(struct map_session_data *sd) { +static void pc_autotrade_populate(struct map_session_data *sd) +{ struct autotrade_vending *data; int i, j, k, cursor = 0; @@ -12014,7 +12146,7 @@ void pc_autotrade_populate(struct map_session_data *sd) { /** * @see DBApply */ -int pc_autotrade_final(union DBKey key, struct DBData *data, va_list ap) +static int pc_autotrade_final(union DBKey key, struct DBData *data, va_list ap) { struct autotrade_vending* at_v = DB->data2ptr(data); nullpo_ret(at_v); @@ -12022,7 +12154,7 @@ int pc_autotrade_final(union DBKey key, struct DBData *data, va_list ap) return 0; } -void pc_update_idle_time(struct map_session_data* sd, enum e_battle_config_idletime type) +static void pc_update_idle_time(struct map_session_data *sd, enum e_battle_config_idletime type) { nullpo_retv(sd); if (battle_config.idletime_criteria&type) @@ -12031,7 +12163,7 @@ void pc_update_idle_time(struct map_session_data* sd, enum e_battle_config_idlet //Checks if the given class value corresponds to a player class. [Skotlex] //JOB_NOVICE isn't checked for class is supposed to be unsigned -bool pc_db_checkid(int class) +static bool pc_db_checkid(int class) { return class < JOB_MAX_BASIC || (class >= JOB_NOVICE_HIGH && class <= JOB_DARK_COLLECTOR ) @@ -12048,7 +12180,7 @@ bool pc_db_checkid(int class) * @param sd map_session_data of Player * @return index of magnifer, INDEX_NOT_FOUND if it is not found */ -int pc_have_magnifier(struct map_session_data *sd) +static int pc_have_magnifier(struct map_session_data *sd) { int n; n = pc->search_inventory(sd, ITEMID_SPECTACLES); @@ -12063,7 +12195,8 @@ int pc_have_magnifier(struct map_session_data *sd) * @param level Required Level of Novice Skill * @return bool true, if requirement is satisfied */ -bool pc_check_basicskill(struct map_session_data *sd, int level) { +static bool pc_check_basicskill(struct map_session_data *sd, int level) +{ if (pc->checkskill(sd, NV_BASIC) >= level || pc->checkskill(sd, SU_BASIC_SKILL)) return true; return false; @@ -12077,7 +12210,7 @@ bool pc_check_basicskill(struct map_session_data *sd, int level) { * @param message The message text. * @return Whether the message is a valid chat message. */ -bool pc_process_chat_message(struct map_session_data *sd, const char *message) +static bool pc_process_chat_message(struct map_session_data *sd, const char *message) { nullpo_retr(false, sd); if (atcommand->exec(sd->fd, sd, message, true)) { @@ -12109,7 +12242,7 @@ bool pc_process_chat_message(struct map_session_data *sd, const char *message) * @param sd The sender character. * @param message The message text. */ -void pc_check_supernovice_call(struct map_session_data *sd, const char *message) +static void pc_check_supernovice_call(struct map_session_data *sd, const char *message) { uint64 next = pc->nextbaseexp(sd); int percent = 0; @@ -12153,7 +12286,7 @@ void pc_check_supernovice_call(struct map_session_data *sd, const char *message) } } -void pc_update_job_and_level(struct map_session_data *sd) +static void pc_update_job_and_level(struct map_session_data *sd) { nullpo_retv(sd); @@ -12171,7 +12304,7 @@ void pc_update_job_and_level(struct map_session_data *sd) } } -void pc_clear_exp_groups(void) +static void pc_clear_exp_groups(void) { int i, k, size; for (k = 0; k < 2; k++) { @@ -12183,7 +12316,7 @@ void pc_clear_exp_groups(void) } } -void pc_init_exp_groups(void) +static void pc_init_exp_groups(void) { int i; for (i = 0; i < 2; i++) { @@ -12191,7 +12324,16 @@ void pc_init_exp_groups(void) } } -void do_final_pc(void) +static bool pc_has_second_costume(struct map_session_data *sd) +{ + nullpo_retr(false, sd); + + if ((sd->job & JOBL_THIRD) != 0) + return true; + return false; +} + +static void do_final_pc(void) { db_destroy(pc->itemcd_db); @@ -12210,7 +12352,8 @@ void do_final_pc(void) return; } -void do_init_pc(bool minimal) { +static void do_init_pc(bool minimal) +{ if (minimal) return; @@ -12258,12 +12401,14 @@ void do_init_pc(bool minimal) { ers_chunk_size(pc->num_reg_ers, 300); ers_chunk_size(pc->str_reg_ers, 50); } + /*===================================== -* Default Functions : pc.h -* Generated by HerculesInterfaceMaker -* created by Susu -*-------------------------------------*/ -void pc_defaults(void) { + * Default Functions : pc.h + * Generated by HerculesInterfaceMaker + * created by Susu + *-------------------------------------*/ +void pc_defaults(void) +{ const struct sg_data sg_info[MAX_PC_FEELHATE] = { { SG_SUN_ANGER, SG_SUN_BLESS, SG_SUN_COMFORT, "PC_FEEL_SUN", "PC_HATE_MOB_SUN", is_day_of_sun }, { SG_MOON_ANGER, SG_MOON_BLESS, SG_MOON_COMFORT, "PC_FEEL_MOON", "PC_HATE_MOB_MOON", is_day_of_moon }, @@ -12589,4 +12734,5 @@ void pc_defaults(void) { pc->check_basicskill = pc_check_basicskill; pc->isDeathPenaltyJob = pc_isDeathPenaltyJob; + pc->has_second_costume = pc_has_second_costume; } |