diff options
Diffstat (limited to 'src/map/homunculus.c')
-rw-r--r-- | src/map/homunculus.c | 265 |
1 files changed, 169 insertions, 96 deletions
diff --git a/src/map/homunculus.c b/src/map/homunculus.c index bda8fd9e6..65c457283 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -2,8 +2,8 @@ * This file is part of Hercules. * http://herc.ws - http://github.com/HerculesWS/Hercules * - * Copyright (C) 2012-2016 Hercules Dev Team - * Copyright (C) Athena Dev Teams + * Copyright (C) 2012-2020 Hercules Dev Team + * Copyright (C) Athena Dev Teams * * Hercules is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,6 +37,7 @@ #include "map/party.h" #include "map/pc.h" #include "map/pet.h" +#include "map/quest.h" #include "map/script.h" #include "map/skill.h" #include "map/status.h" @@ -58,19 +59,21 @@ #include <stdlib.h> #include <string.h> -struct homunculus_interface homunculus_s; -struct homun_dbs homundbs; +static struct homunculus_interface homunculus_s; +static struct homun_dbs homundbs; struct homunculus_interface *homun; //Returns the viewdata for homunculus -struct view_data* homunculus_get_viewdata(int class_) { +static struct view_data *homunculus_get_viewdata(int class_) +{ Assert_retr(NULL, homdb_checkid(class_)); return &homun->dbs->viewdb[class_-HM_CLASS_BASE]; } -enum homun_type homunculus_class2type(int class_) { +static enum homun_type homunculus_class2type(int class_) +{ switch(class_) { // Normal Homunculus case HOMID_LIF: @@ -104,7 +107,8 @@ enum homun_type homunculus_class2type(int class_) { } } -void homunculus_addspiritball(struct homun_data *hd, int max) { +static void homunculus_addspiritball(struct homun_data *hd, int max) +{ nullpo_retv(hd); if (max > MAX_SKILL_LEVEL) @@ -121,7 +125,8 @@ void homunculus_addspiritball(struct homun_data *hd, int max) { clif->spiritball(&hd->bl); } -void homunculus_delspiritball(struct homun_data *hd, int count, int type) { +static void homunculus_delspiritball(struct homun_data *hd, int count, int type) +{ nullpo_retv(hd); if (hd->homunculus.spiritball <= 0) { @@ -140,11 +145,13 @@ void homunculus_delspiritball(struct homun_data *hd, int count, int type) { clif->spiritball(&hd->bl); } -void homunculus_damaged(struct homun_data *hd) { +static void homunculus_damaged(struct homun_data *hd) +{ clif->hominfo(hd->master,hd,0); } -int homunculus_dead(struct homun_data *hd) { +static int homunculus_dead(struct homun_data *hd) +{ //There's no intimacy penalties on death (from Tharis) struct map_session_data *sd; @@ -165,25 +172,26 @@ int homunculus_dead(struct homun_data *hd) { } //Vaporize a character's homun. If flag, HP needs to be 80% or above. -int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag) { +static int homunculus_vaporize(struct map_session_data *sd, enum homun_state state, bool force) +{ struct homun_data *hd; nullpo_ret(sd); hd = sd->hd; - if (!hd || hd->homunculus.vaporize != HOM_ST_ACTIVE) + if (hd == NULL || hd->bl.prev == NULL || hd->homunculus.vaporize != HOM_ST_ACTIVE) return 0; if (status->isdead(&hd->bl)) return 0; //Can't vaporize a dead homun. - if (flag == HOM_ST_REST && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80) + if (!force && get_percentage(hd->battle_status.hp, hd->battle_status.max_hp) < 80) return 0; hd->regen.state.block = 3; //Block regen while vaporized. //Delete timers when vaporized. homun->hunger_timer_delete(hd); - hd->homunculus.vaporize = flag; + hd->homunculus.vaporize = state; if(battle_config.hom_setting&0x40) memset(hd->blockskill, 0, sizeof(hd->blockskill)); clif->hominfo(sd, sd->hd, 0); @@ -193,7 +201,8 @@ int homunculus_vaporize(struct map_session_data *sd, enum homun_state flag) { //delete a homunculus, completely "killing it". //Emote is the emotion the master should use, send negative to disable. -int homunculus_delete(struct homun_data *hd, int emote) { +static int homunculus_delete(struct homun_data *hd, int emote) +{ struct map_session_data *sd; nullpo_ret(hd); sd = hd->master; @@ -212,7 +221,8 @@ int homunculus_delete(struct homun_data *hd, int emote) { return unit->remove_map(&hd->bl,CLR_OUTSIGHT, ALC_MARK); } -int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) { +static int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) +{ int i, id = 0; int j, f = 1; int c = 0; @@ -248,7 +258,7 @@ int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) { for( i = 0; i < MAX_SKILL_TREE && ( id = homun->dbs->skill_tree[c][i].id ) > 0; i++ ) { if( hd->homunculus.hskill[ id - HM_SKILLBASE ].id ) continue; //Skill already known. - j = ( flag_evolve ) ? 10 : hd->homunculus.intimacy; + j = ( flag_evolve ) ? 1000 : hd->homunculus.intimacy; if( j < homun->dbs->skill_tree[c][i].intimacylv ) continue; if(!battle_config.skillfree) { @@ -269,7 +279,8 @@ int homunculus_calc_skilltree(struct homun_data *hd, int flag_evolve) { return 0; } -int homunculus_checkskill(struct homun_data *hd,uint16 skill_id) { +static int homunculus_checkskill(struct homun_data *hd, uint16 skill_id) +{ int i = skill_id - HM_SKILLBASE; if(!hd) return 0; @@ -281,7 +292,8 @@ int homunculus_checkskill(struct homun_data *hd,uint16 skill_id) { return 0; } -int homunculus_skill_tree_get_max(int id, int b_class) { +static int homunculus_skill_tree_get_max(int id, int b_class) +{ int i, skill_id; b_class -= HM_CLASS_BASE; Assert_ret(b_class >= 0 && b_class < MAX_HOMUNCULUS_CLASS); @@ -291,7 +303,8 @@ int homunculus_skill_tree_get_max(int id, int b_class) { return skill->get_max(id); } -void homunculus_skillup(struct homun_data *hd,uint16 skill_id) { +static void homunculus_skillup(struct homun_data *hd, uint16 skill_id) +{ int i = 0 ; nullpo_retv(hd); @@ -317,7 +330,8 @@ void homunculus_skillup(struct homun_data *hd,uint16 skill_id) { } } -bool homunculus_levelup(struct homun_data *hd) { +static bool homunculus_levelup(struct homun_data *hd) +{ struct s_homunculus *hom; struct h_stats *min, *max; int growth_str, growth_agi, growth_vit, growth_int, growth_dex, growth_luk ; @@ -356,14 +370,14 @@ bool homunculus_levelup(struct homun_data *hd) { max = &hd->homunculusDB->gmax; min = &hd->homunculusDB->gmin; - growth_max_hp = rnd_value(min->HP, max->HP); - growth_max_sp = rnd_value(min->SP, max->SP); - growth_str = rnd_value(min->str, max->str); - growth_agi = rnd_value(min->agi, max->agi); - growth_vit = rnd_value(min->vit, max->vit); - growth_dex = rnd_value(min->dex, max->dex); - growth_int = rnd_value(min->int_,max->int_); - growth_luk = rnd_value(min->luk, max->luk); + growth_max_hp = rnd->value(min->HP, max->HP); + growth_max_sp = rnd->value(min->SP, max->SP); + growth_str = rnd->value(min->str, max->str); + growth_agi = rnd->value(min->agi, max->agi); + growth_vit = rnd->value(min->vit, max->vit); + growth_dex = rnd->value(min->dex, max->dex); + growth_int = rnd->value(min->int_,max->int_); + growth_luk = rnd->value(min->luk, max->luk); //Aegis discards the decimals in the stat growth values! growth_str-=growth_str%10; @@ -387,16 +401,18 @@ bool homunculus_levelup(struct homun_data *hd) { if ( battle_config.homunculus_show_growth ) { char output[256] ; sprintf(output, - "Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) ", + msg_sd(hd->master, 892), // Growth: hp:%d sp:%d str(%.2f) agi(%.2f) vit(%.2f) int(%.2f) dex(%.2f) luk(%.2f) growth_max_hp, growth_max_sp, growth_str/10.0, growth_agi/10.0, growth_vit/10.0, growth_int/10.0, growth_dex/10.0, growth_luk/10.0); - clif_disp_onlyself(hd->master,output,strlen(output)); + clif_disp_onlyself(hd->master, output); } + quest->questinfo_refresh(hd->master); return true; } -int homunculus_change_class(struct homun_data *hd, short class_) { +static int homunculus_change_class(struct homun_data *hd, int class_) +{ int i = homun->db_search(class_,HOMUNCULUS_CLASS); nullpo_retr(0, hd); if (i == INDEX_NOT_FOUND) @@ -405,10 +421,12 @@ int homunculus_change_class(struct homun_data *hd, short class_) { hd->homunculus.class_ = class_; status->set_viewdata(&hd->bl, class_); homun->calc_skilltree(hd, 1); + quest->questinfo_refresh(hd->master); return 1; } -bool homunculus_evolve(struct homun_data *hd) { +static bool homunculus_evolve(struct homun_data *hd) +{ struct s_homunculus *hom; struct h_stats *max, *min; struct map_session_data *sd; @@ -432,14 +450,14 @@ bool homunculus_evolve(struct homun_data *hd) { hom = &hd->homunculus; max = &hd->homunculusDB->emax; min = &hd->homunculusDB->emin; - hom->max_hp += rnd_value(min->HP, max->HP); - hom->max_sp += rnd_value(min->SP, max->SP); - hom->str += 10*rnd_value(min->str, max->str); - hom->agi += 10*rnd_value(min->agi, max->agi); - hom->vit += 10*rnd_value(min->vit, max->vit); - hom->int_+= 10*rnd_value(min->int_,max->int_); - hom->dex += 10*rnd_value(min->dex, max->dex); - hom->luk += 10*rnd_value(min->luk, max->luk); + hom->max_hp += rnd->value(min->HP, max->HP); + hom->max_sp += rnd->value(min->SP, max->SP); + hom->str += 10*rnd->value(min->str, max->str); + hom->agi += 10*rnd->value(min->agi, max->agi); + hom->vit += 10*rnd->value(min->vit, max->vit); + hom->int_+= 10*rnd->value(min->int_,max->int_); + hom->dex += 10*rnd->value(min->dex, max->dex); + hom->luk += 10*rnd->value(min->luk, max->luk); hom->intimacy = 500; unit->remove_map(&hd->bl, CLR_OUTSIGHT, ALC_MARK); @@ -456,11 +474,12 @@ bool homunculus_evolve(struct homun_data *hd) { if (!(battle_config.hom_setting&0x2)) skill->unit_move(&sd->hd->bl,timer->gettick(),1); // apply land skills immediately - + quest->questinfo_refresh(sd); return true; } -bool homunculus_mutate(struct homun_data *hd, int homun_id) { +static bool homunculus_mutate(struct homun_data *hd, int homun_id) +{ struct s_homunculus *hom; struct map_session_data *sd; int prev_class = 0; @@ -506,7 +525,23 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) { return true; } -int homunculus_gainexp(struct homun_data *hd,unsigned int exp) { +static int homunculus_gainexp_real(struct homun_data *hd, unsigned int exp) +{ + nullpo_ret(hd); + nullpo_ret(hd->master); + + hd->homunculus.exp += exp; + + if (hd->master->state.showexp && hd->exp_next > 0) { + char output[256]; + sprintf(output, msg_fd(hd->master->fd, 449), exp, ((float)exp / (float)hd->exp_next * (float)100)); + clif_disp_onlyself(hd->master, output); + } + return 1; +} + +static int homunculus_gainexp(struct homun_data *hd, unsigned int exp) +{ enum homun_type htype; nullpo_ret(hd); @@ -530,10 +565,10 @@ int homunculus_gainexp(struct homun_data *hd,unsigned int exp) { break; } - hd->homunculus.exp += exp; + homun->gainexp_real(hd, exp); - if(hd->homunculus.exp < hd->exp_next) { - clif->hominfo(hd->master,hd,0); + if (hd->homunculus.exp < hd->exp_next) { + clif->hominfo(hd->master, hd, 0); return 0; } @@ -550,7 +585,8 @@ int homunculus_gainexp(struct homun_data *hd,unsigned int exp) { } // Return the new value -unsigned int homunculus_add_intimacy(struct homun_data *hd, unsigned int value) { +static unsigned int homunculus_add_intimacy(struct homun_data *hd, unsigned int value) +{ nullpo_ret(hd); if (battle_config.homunculus_friendly_rate != 100) value = (value * battle_config.homunculus_friendly_rate) / 100; @@ -563,7 +599,8 @@ unsigned int homunculus_add_intimacy(struct homun_data *hd, unsigned int value) } // Return 0 if decrease fails or intimacy became 0 else the new value -unsigned int homunculus_consume_intimacy(struct homun_data *hd, unsigned int value) { +static unsigned int homunculus_consume_intimacy(struct homun_data *hd, unsigned int value) +{ nullpo_ret(hd); if (hd->homunculus.intimacy >= value) hd->homunculus.intimacy -= value; @@ -573,12 +610,14 @@ unsigned int homunculus_consume_intimacy(struct homun_data *hd, unsigned int val return hd->homunculus.intimacy; } -void homunculus_healed (struct homun_data *hd) { +static void homunculus_healed(struct homun_data *hd) +{ nullpo_retv(hd); clif->hominfo(hd->master,hd,0); } -void homunculus_save(struct homun_data *hd) { +static void homunculus_save(struct homun_data *hd) +{ // copy data that must be saved in homunculus struct ( hp / sp ) struct map_session_data *sd = NULL; //Do not check for max_hp/max_sp caps as current could be higher to max due @@ -592,7 +631,8 @@ void homunculus_save(struct homun_data *hd) { intif->homunculus_requestsave(sd->status.account_id, &hd->homunculus); } -unsigned char homunculus_menu(struct map_session_data *sd,unsigned char menu_num) { +static unsigned char homunculus_menu(struct map_session_data *sd, unsigned char menu_num) +{ nullpo_ret(sd); if (sd->hd == NULL) return 1; @@ -613,7 +653,8 @@ unsigned char homunculus_menu(struct map_session_data *sd,unsigned char menu_num return 0; } -bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) { +static bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) +{ int i, foodID, emotion; nullpo_retr(false, hd); @@ -661,7 +702,8 @@ bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) { return true; } -int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) { +static int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) +{ struct map_session_data *sd; struct homun_data *hd; @@ -683,7 +725,12 @@ int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) { } else if(hd->homunculus.hunger == 75) { clif->emotion(&hd->bl, E_OK); } - + if (battle_config.feature_enable_homun_autofeed != 0) { + if (hd->homunculus.autofeed) { + if (hd->homunculus.hunger < 30) + homun->feed(sd, hd); + } + } if(hd->homunculus.hunger < 0) { hd->homunculus.hunger = 0; // Delete the homunculus if intimacy <= 100 @@ -697,7 +744,8 @@ int homunculus_hunger_timer(int tid, int64 tick, int id, intptr_t data) { return 0; } -void homunculus_hunger_timer_delete(struct homun_data *hd) { +static void homunculus_hunger_timer_delete(struct homun_data *hd) +{ nullpo_retv(hd); if(hd->hungry_timer != INVALID_TIMER) { timer->delete(hd->hungry_timer,homun->hunger_timer); @@ -705,7 +753,7 @@ void homunculus_hunger_timer_delete(struct homun_data *hd) { } } -int homunculus_change_name(struct map_session_data *sd, const char *name) +static int homunculus_change_name(struct map_session_data *sd, const char *name) { int i; struct homun_data *hd; @@ -726,7 +774,7 @@ int homunculus_change_name(struct map_session_data *sd, const char *name) return intif_rename_hom(sd, name); } -bool homunculus_change_name_ack(struct map_session_data *sd, const char *name, int flag) +static bool homunculus_change_name_ack(struct map_session_data *sd, const char *name, int flag) { struct homun_data *hd; char *newname = NULL; @@ -746,13 +794,14 @@ bool homunculus_change_name_ack(struct map_session_data *sd, const char *name, i } safestrncpy(hd->homunculus.name, newname, NAME_LENGTH); aFree(newname); - clif->charnameack (0,&hd->bl); + clif->blname_ack(0,&hd->bl); hd->homunculus.rename_flag = 1; clif->hominfo(sd,hd,0); return true; } -int homunculus_db_search(int key,int type) { +static int homunculus_db_search(int key, int type) +{ int i; for(i=0;i<MAX_HOMUNCULUS_CLASS;i++) { @@ -786,7 +835,7 @@ int homunculus_db_search(int key,int type) { * @param hom The homunculus source data. * @retval false in case of errors. */ -bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom) +static bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *hom, bool is_new) { struct homun_data *hd; int i = 0; @@ -830,25 +879,29 @@ bool homunculus_create(struct map_session_data *sd, const struct s_homunculus *h map->addiddb(&hd->bl); status_calc_homunculus(hd,SCO_FIRST); - status_percent_heal(&hd->bl, 100, 100); + if (is_new) { + status_percent_heal(&hd->bl, 100, 100); + } hd->hungry_timer = INVALID_TIMER; return true; } -void homunculus_init_timers(struct homun_data * hd) { +static void homunculus_init_timers(struct homun_data *hd) +{ nullpo_retv(hd); if (hd->hungry_timer == INVALID_TIMER) hd->hungry_timer = timer->add(timer->gettick()+hd->homunculusDB->hungryDelay,homun->hunger_timer,hd->master->bl.id,0); hd->regen.state.block = 0; //Restore HP/SP block. } -bool homunculus_call(struct map_session_data *sd) { +static bool homunculus_call(struct map_session_data *sd) +{ struct homun_data *hd; nullpo_retr(false, sd); if (!sd->status.hom_id) //Create a new homun. - return homun->creation_request(sd, HM_CLASS_BASE + rnd_value(0, 7)); + return homun->creation_request(sd, HM_CLASS_BASE + rnd->value(0, 7)); // If homunc not yet loaded, load it if (!sd->hd) @@ -881,10 +934,11 @@ bool homunculus_call(struct map_session_data *sd) { } // Receive homunculus data from char server -bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int flag) +static bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int flag) { struct map_session_data *sd; struct homun_data *hd; + bool is_new = false; nullpo_retr(false, sh); @@ -900,15 +954,17 @@ bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int fla if (sd->status.char_id != sh->char_id && sd->status.hom_id != sh->hom_id) return false; - if (sd->status.hom_id == 0) //Hom just created. + if (sd->status.hom_id == 0) { // Hom just created. sd->status.hom_id = sh->hom_id; + is_new = true; + } if (sd->hd != NULL) { //uh? Overwrite the data. memcpy(&sd->hd->homunculus, sh, sizeof sd->hd->homunculus); sd->hd->homunculus.char_id = sd->status.char_id; // Correct char id if necessary. } else { - homun->create(sd, sh); + homun->create(sd, sh, is_new); } hd = sd->hd; @@ -940,7 +996,8 @@ bool homunculus_recv_data(int account_id, const struct s_homunculus *sh, int fla } // Ask homunculus creation to char server -bool homunculus_creation_request(struct map_session_data *sd, int class_) { +static bool homunculus_creation_request(struct map_session_data *sd, int class_) +{ struct s_homunculus hom; struct h_stats *base; int i; @@ -976,7 +1033,8 @@ bool homunculus_creation_request(struct map_session_data *sd, int class_) { return true; } -bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short x, short y) { +static bool homunculus_ressurect(struct map_session_data *sd, unsigned char per, short x, short y) +{ struct homun_data* hd; nullpo_retr(false,sd); @@ -1009,7 +1067,8 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short return true; } -void homunculus_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) { +static void homunculus_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) +{ struct map_session_data *sd; nullpo_retv(hd); @@ -1023,7 +1082,8 @@ void homunculus_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) clif->homskillinfoblock(sd); } //Resets a homunc stats back to zero (but doesn't touches hunger or intimacy) -void homunculus_stat_reset(struct homun_data *hd) { +static void homunculus_stat_reset(struct homun_data *hd) +{ struct s_homunculus_db *db; struct s_homunculus *hom; struct h_stats *base; @@ -1047,7 +1107,8 @@ void homunculus_stat_reset(struct homun_data *hd) { hd->homunculus.skillpts = 0; } -bool homunculus_shuffle(struct homun_data *hd) { +static bool homunculus_shuffle(struct homun_data *hd) +{ struct map_session_data *sd; int lv, skillpts; unsigned int exp; @@ -1075,14 +1136,14 @@ bool homunculus_shuffle(struct homun_data *hd) { //Evolved bonuses struct s_homunculus *hom = &hd->homunculus; struct h_stats *max = &hd->homunculusDB->emax, *min = &hd->homunculusDB->emin; - hom->max_hp += rnd_value(min->HP, max->HP); - hom->max_sp += rnd_value(min->SP, max->SP); - hom->str += 10*rnd_value(min->str, max->str); - hom->agi += 10*rnd_value(min->agi, max->agi); - hom->vit += 10*rnd_value(min->vit, max->vit); - hom->int_+= 10*rnd_value(min->int_,max->int_); - hom->dex += 10*rnd_value(min->dex, max->dex); - hom->luk += 10*rnd_value(min->luk, max->luk); + hom->max_hp += rnd->value(min->HP, max->HP); + hom->max_sp += rnd->value(min->SP, max->SP); + hom->str += 10*rnd->value(min->str, max->str); + hom->agi += 10*rnd->value(min->agi, max->agi); + hom->vit += 10*rnd->value(min->vit, max->vit); + hom->int_+= 10*rnd->value(min->int_,max->int_); + hom->dex += 10*rnd->value(min->dex, max->dex); + hom->luk += 10*rnd->value(min->luk, max->luk); } hd->homunculus.exp = exp; @@ -1096,7 +1157,8 @@ bool homunculus_shuffle(struct homun_data *hd) { return true; } -bool homunculus_read_db_sub(char* str[], int columns, int current) { +static bool homunculus_read_db_sub(char *str[], int columns, int current) +{ int classid; struct s_homunculus_db *db; @@ -1207,7 +1269,8 @@ bool homunculus_read_db_sub(char* str[], int columns, int current) { return true; } -void homunculus_read_db(void) { +static void homunculus_read_db(void) +{ int i; const char *filename[]={DBPATH"homunculus_db.txt","homunculus_db2.txt"}; memset(homun->dbs->db, 0, sizeof(homun->dbs->db)); @@ -1215,7 +1278,7 @@ void homunculus_read_db(void) { if( i > 0 ) { char filepath[256]; - sprintf(filepath, "%s/%s", map->db_path, filename[i]); + safesnprintf(filepath, 256, "%s/%s", map->db_path, filename[i]); if( !exists(filepath) ) { continue; @@ -1227,7 +1290,8 @@ void homunculus_read_db(void) { } // <hom class>,<skill id>,<max level>[,<job level>],<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>,<intimacy lv req> -bool homunculus_read_skill_db_sub(char* split[], int columns, int current) { +static bool homunculus_read_skill_db_sub(char *split[], int columns, int current) +{ int k, classid; int j; int minJobLevelPresent = 0; @@ -1262,12 +1326,13 @@ bool homunculus_read_skill_db_sub(char* split[], int columns, int current) { homun->dbs->skill_tree[classid][j].need[k].lv = atoi(split[3+k*2+minJobLevelPresent+1]); } - homun->dbs->skill_tree[classid][j].intimacylv = atoi(split[13+minJobLevelPresent]); + homun->dbs->skill_tree[classid][j].intimacylv = atoi(split[13+minJobLevelPresent]) * 100; return true; } -int8 homunculus_get_intimacy_grade(struct homun_data *hd) { +static int8 homunculus_get_intimacy_grade(struct homun_data *hd) +{ unsigned int val; nullpo_ret(hd); val = hd->homunculus.intimacy / 100; @@ -1287,12 +1352,14 @@ int8 homunculus_get_intimacy_grade(struct homun_data *hd) { return 0; } -void homunculus_skill_db_read(void) { +static void homunculus_skill_db_read(void) +{ memset(homun->dbs->skill_tree, 0, sizeof(homun->dbs->skill_tree)); sv->readdb(map->db_path, "homun_skill_tree.txt", ',', 13, 15, -1, homun->read_skill_db_sub); } -void homunculus_exp_db_read(void) { +static void homunculus_exp_db_read(void) +{ char line[1024]; int i, j=0; char *filename[]={ @@ -1322,20 +1389,23 @@ void homunculus_exp_db_read(void) { homun->dbs->exptable[MAX_LEVEL - 1] = 0; } fclose(fp); - ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' levels in '"CL_WHITE"%s"CL_RESET"'.\n", j, filename[i]); + ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' levels in '"CL_WHITE"%s/%s"CL_RESET"'.\n", j, map->db_path, filename[i]); } } -void homunculus_reload(void) { +static void homunculus_reload(void) +{ homun->read_db(); homun->exp_db_read(); } -void homunculus_skill_reload(void) { +static void homunculus_skill_reload(void) +{ homun->skill_db_read(); } -void do_init_homunculus(bool minimal) { +static void do_init_homunculus(bool minimal) +{ int class_; if (minimal) @@ -1350,14 +1420,16 @@ void do_init_homunculus(bool minimal) { //Stock view data for homuncs memset(homun->dbs->viewdb, 0, sizeof(homun->dbs->viewdb)); for (class_ = 0; class_ < MAX_HOMUNCULUS_CLASS; class_++) - homun->dbs->viewdb[class_].class_ = HM_CLASS_BASE+class_; + homun->dbs->viewdb[class_].class = HM_CLASS_BASE + class_; } -void do_final_homunculus(void) { +static void do_final_homunculus(void) +{ } -void homunculus_defaults(void) { +void homunculus_defaults(void) +{ homun = &homunculus_s; homun->dbs = &homundbs; @@ -1381,6 +1453,7 @@ void homunculus_defaults(void) { homun->evolve = homunculus_evolve; homun->mutate = homunculus_mutate; homun->gainexp = homunculus_gainexp; + homun->gainexp_real = homunculus_gainexp_real; homun->add_intimacy = homunculus_add_intimacy; homun->consume_intimacy = homunculus_consume_intimacy; homun->healed = homunculus_healed; |