summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-07-21 14:34:08 -0300
committershennetsind <ind@henn.et>2013-07-21 14:34:08 -0300
commitd680d0ccd5207a0f858b93d2c28997148bcc5f55 (patch)
tree20e07ff54be1fb315f96b4763231b43effc14c85 /src/map
parent9bcb1423969870a6b60819e6f3846fe0235e28a9 (diff)
downloadhercules-d680d0ccd5207a0f858b93d2c28997148bcc5f55.tar.gz
hercules-d680d0ccd5207a0f858b93d2c28997148bcc5f55.tar.bz2
hercules-d680d0ccd5207a0f858b93d2c28997148bcc5f55.tar.xz
hercules-d680d0ccd5207a0f858b93d2c28997148bcc5f55.zip
Fixed Bug #7520
Added code to ensure 1st/2nd tabs are meeting the conditions; Special Thanks to Haruna, ToiletMaster http://hercules.ws/board/tracker/issue-7520-skill-point-error/ Also - Follow up 9bcb1423969870a6b60819e6f3846fe0235e28a9 extending it to cached item packages. Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/itemdb.c4
-rw-r--r--src/map/pc.c84
2 files changed, 71 insertions, 17 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index a863ed1ab..139a62e06 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -707,7 +707,7 @@ void itemdb_read_groups(void) {
config_destroy(&item_group_conf);
aFree(gsize);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"' ("CL_GREEN"C"CL_RESET").\n", count, config_filename);
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, config_filename);
}
/* [Ind/Hercules] - HCache for Packages */
void itemdb_write_cached_packages(const char *config_filename) {
@@ -900,7 +900,7 @@ bool itemdb_read_cached_packages(const char *config_filename) {
fclose(file);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", pcount, config_filename);
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"' ("CL_GREEN"C"CL_RESET").\n", pcount, config_filename);
return true;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 5a8b77cd3..d1ff57978 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1445,7 +1445,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
continue; //Cannot be learned via normal means. Note this check DOES allows raising already known skills.
sd->status.skill[idx].id = id;
-
+
if(inf2&INF2_SPIRIT_SKILL) { //Spirit skills cannot be learned, they will only show up on your tree when you get buffed.
sd->status.skill[idx].lv = 1; // need to manually specify a skill level
sd->status.skill[idx].flag = SKILL_FLAG_TEMPORARY; //So it is not saved, and tagged as a "bonus" skill.
@@ -1536,6 +1536,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill_id)
continue; //Cannot be learned via normal means.
sd->status.skill[idx].id = id;
+
flag = 1;
}
} while(flag);
@@ -6139,7 +6140,74 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
if( !(index = skill->get_index(skill_id)) )
return 0;
+
+ if( battle_config.skillup_limit ) {
+ /* [Ind/Hercules] */
+ if( (sd->class_&JOBL_2) && (sd->class_&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE ){
+ while(1) {
+ int c, i = 0, k = 0, pts = 0, pts_second = 0, id = 0;
+ bool can_skip = false;
+
+ c = sd->class_ & MAPID_BASEMASK;
+
+ k = pc_class2idx(pc_mapid2jobid(c, sd->status.sex));
+
+ for(i = 0; i < MAX_SKILL_TREE && (id=skill_tree[k][i].id) > 0 ; i++){
+ int inf2 = skill->get_inf2(id), idx = skill_tree[k][i].idx;
+
+ if( skill_id == id ) {
+ can_skip = true;
+ break;/* its oki we can skip */
+ }
+
+ if ( inf2&INF2_QUEST_SKILL || (inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) || id == NV_BASIC )
+ continue;
+
+ if( sd->status.skill[idx].id && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT )
+ pts += pc_checkskill(sd, id);
+ }
+
+ if( can_skip ) break;
+
+ if( pts < 40 ) {
+ clif->msg_value(sd, 0x61E, 40 - pts);
+ return 0;
+ }
+
+ if( sd->class_&JOBL_THIRD ) {
+ bool is_trans = sd->class_&JOBL_UPPER? true : false;
+
+ c = is_trans ? (sd->class_ &~ JOBL_THIRD)/* find fancy way */ : sd->class_ & MAPID_UPPERMASK;
+ k = pc_class2idx(pc_mapid2jobid(c, sd->status.sex));
+
+ for(i = 0; i < MAX_SKILL_TREE && (id=skill_tree[k][i].id) > 0 ; i++){
+ int inf2 = skill->get_inf2(id), idx = skill_tree[k][i].idx;
+
+ if( skill_id == id ) {
+ can_skip = true;
+ break;/* its oki we can skip */
+ }
+
+ if ( inf2&INF2_QUEST_SKILL || (inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) || id == NV_BASIC )
+ continue;
+
+ if( sd->status.skill[idx].id && sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT )
+ pts_second += pc_checkskill(sd, id);
+ }
+
+ if( can_skip ) break;
+
+ if( pts_second - pts < ( is_trans ? 70 : 50 ) ) {
+ clif->msg_value(sd, 0x61F, ( is_trans ? 70 : 50 ) - (pts_second - pts));
+ return 0;
+ }
+ }
+ break;
+ }
+ }
+ }
+
if( sd->status.skill_point > 0 &&
sd->status.skill[index].id &&
sd->status.skill[index].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex]
@@ -6160,21 +6228,7 @@ 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 ){
- int pts = 0, i, id;
- for(i = 0; i < MAX_SKILL_TREE && (id=skill_tree[pc_class2idx(sd->status.class_)][i].id) > 0 ; i++){
- int inf2 = skill->get_inf2(id);
- if ( inf2&INF2_QUEST_SKILL || (inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) || id == NV_BASIC )
- continue;
- if( sd->status.skill[id].id && sd->status.skill[id].flag == SKILL_FLAG_PERMANENT )
- pts += pc_checkskill(sd, id);
- }
- if( pts < sd->change_level_2nd )
- clif->msg_value(sd, 0x61E, sd->change_level_2nd-pts);
- else if( pts < (sd->change_level_3rd + sd->change_level_2nd) )
- clif->msg_value(sd, 0x61F, sd->change_level_3rd - (pts - sd->change_level_2nd));
}
-
return 0;
}