From efbd5d0dd7dbf038333d65d59d0becad59e6e2a4 Mon Sep 17 00:00:00 2001 From: momacabu Date: Fri, 23 Nov 2012 18:15:21 +0000 Subject: Partial fix for bugreport:4337. A new field was added to homun_skill_tree.txt containing the minimum level of intimacy to unlock a skill. This is used in some skills where the homunculus has to reach a amount of 910 of intimacy. The default value is 0 and it should only affect evolved homunculus. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16954 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 3 +++ src/map/homunculus.c | 15 ++++++++++----- src/map/homunculus.h | 14 +++++++++++++- src/map/status.c | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 75cc51a24..5ed1dc694 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1478,6 +1478,9 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) void clif_send_homdata(struct map_session_data *sd, int state, int param) { //[orn] int fd = sd->fd; + + if ( (state == SP_INTIMATE) && (param >= 910) && (sd->hd->homunculus.class_ == sd->hd->homunculusDB->evo_class) ) + merc_hom_calc_skilltree(sd->hd, 0); WFIFOHEAD(fd, packet_len(0x230)); WFIFOW(fd,0)=0x230; diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 0bb41ebe4..ab3d811b2 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -40,7 +40,7 @@ #include struct s_homunculus_db homunculus_db[MAX_HOMUNCULUS_CLASS]; //[orn] -struct skill_tree_entry hskill_tree[MAX_HOMUNCULUS_CLASS][MAX_SKILL_TREE]; +struct homun_skill_tree_entry hskill_tree[MAX_HOMUNCULUS_CLASS][MAX_SKILL_TREE]; static int merc_hom_hungry(int tid, unsigned int tick, int id, intptr_t data); @@ -194,7 +194,7 @@ int merc_hom_delete(struct homun_data *hd, int emote) return unit_remove_map(&hd->bl,CLR_OUTSIGHT); } -int merc_hom_calc_skilltree(struct homun_data *hd) +int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve) { int i, id = 0; int j, f = 1; @@ -229,6 +229,9 @@ int merc_hom_calc_skilltree(struct homun_data *hd) for( i = 0; i < MAX_SKILL_TREE && ( id = hskill_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; + if( j < hskill_tree[c][i].intimacylv ) + continue; if(!battle_config.skillfree) { for( j = 0; j < MAX_PC_SKILL_REQUIRE; j++ ) { if( hskill_tree[c][i].need[j].id && @@ -368,7 +371,7 @@ int merc_hom_change_class(struct homun_data *hd, short class_) hd->homunculusDB = &homunculus_db[i]; hd->homunculus.class_ = class_; status_set_viewdata(&hd->bl, class_); - merc_hom_calc_skilltree(hd); + merc_hom_calc_skilltree(hd, 1); return 1; } @@ -1164,7 +1167,7 @@ int read_homunculusdb(void) } static bool read_homunculus_skilldb_sub(char* split[], int columns, int current) -{// ,,[,],,,,,,,,,, +{// ,,[,],,,,,,,,,,, int k, classid; int j; int minJobLevelPresent = 0; @@ -1199,6 +1202,8 @@ static bool read_homunculus_skilldb_sub(char* split[], int columns, int current) hskill_tree[classid][j].need[k].id = atoi(split[3+k*2+minJobLevelPresent]); hskill_tree[classid][j].need[k].lv = atoi(split[3+k*2+minJobLevelPresent+1]); } + + hskill_tree[classid][j].intimacylv = atoi(split[13+minJobLevelPresent]); return true; } @@ -1206,7 +1211,7 @@ static bool read_homunculus_skilldb_sub(char* split[], int columns, int current) int read_homunculus_skilldb(void) { memset(hskill_tree,0,sizeof(hskill_tree)); - sv_readdb(db_path, "homun_skill_tree.txt", ',', 13, 14, -1, &read_homunculus_skilldb_sub); + sv_readdb(db_path, "homun_skill_tree.txt", ',', 13, 15, -1, &read_homunculus_skilldb_sub); return 0; } diff --git a/src/map/homunculus.h b/src/map/homunculus.h index fb18d3394..e46420692 100644 --- a/src/map/homunculus.h +++ b/src/map/homunculus.h @@ -49,6 +49,18 @@ struct homun_data { int spiritball; //for homun S [lighta] }; +#define MAX_HOM_SKILL_REQUIRE 5 +struct homun_skill_tree_entry { + short id; + unsigned char max; + unsigned char joblv; + short intimacylv; + struct { + short id; + unsigned char lv; + } need[MAX_HOM_SKILL_REQUIRE]; +}; // Celest + #define HOM_EVO 0x100 //256 #define HOM_S 0x200 //512 @@ -84,7 +96,7 @@ int hom_class2mapid(int hom_class); void merc_damage(struct homun_data *hd); int merc_hom_dead(struct homun_data *hd); void merc_hom_skillup(struct homun_data *hd,int skillnum); -int merc_hom_calc_skilltree(struct homun_data *hd); +int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve); int merc_hom_checkskill(struct homun_data *hd,int skill_id); int merc_hom_gainexp(struct homun_data *hd,int exp); int merc_hom_levelup(struct homun_data *hd); diff --git a/src/map/status.c b/src/map/status.c index 9b4a58676..3d3062fb3 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -3175,7 +3175,7 @@ int status_calc_homunculus_(struct homun_data *hd, bool first) status->max_hp = hom->max_hp ; status->max_sp = hom->max_sp ; - merc_hom_calc_skilltree(hd); + merc_hom_calc_skilltree(hd, 0); if((skill=merc_hom_checkskill(hd,HAMI_SKIN)) > 0) status->def += skill * 4; -- cgit v1.2.3-70-g09d2