diff options
author | malufett <malufett.eat.my.binaries@gmail.com> | 2015-04-10 18:03:51 +0800 |
---|---|---|
committer | malufett <malufett.eat.my.binaries@gmail.com> | 2015-04-10 18:03:51 +0800 |
commit | b59b9d1ab4c5a21081cdd2af126997ed7093d743 (patch) | |
tree | 8c664218befd543821d7f1f5256af8e23f956a8c /src | |
parent | df1bcac8ef95885019adc1ee03cb2ed9c663c0df (diff) | |
parent | 08cbaa1e87760f9b1efb5e3bf8aad36c3bf67a57 (diff) | |
download | hercules-b59b9d1ab4c5a21081cdd2af126997ed7093d743.tar.gz hercules-b59b9d1ab4c5a21081cdd2af126997ed7093d743.tar.bz2 hercules-b59b9d1ab4c5a21081cdd2af126997ed7093d743.tar.xz hercules-b59b9d1ab4c5a21081cdd2af126997ed7093d743.zip |
Merge pull request #493 from HerculesWS/JobDBRedesign
Hercules 'job_db1.txt' Redesign
-http://hercules.ws/board/topic/9082-job-db1txt-redesign/
Diffstat (limited to 'src')
-rw-r--r-- | src/map/pc.c | 310 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/skill.c | 4 | ||||
-rw-r--r-- | src/map/status.c | 399 | ||||
-rw-r--r-- | src/map/status.h | 13 | ||||
-rw-r--r-- | src/map/unit.c | 9 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 32 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 8 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 138 |
9 files changed, 515 insertions, 400 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 29baf0c84..6567c2a4f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5869,6 +5869,138 @@ const char* job_name(int class_) } } +int pc_check_job_name(const char *name) { + int i, len; + struct { + const char *name; + int id; + } names[] = { + { "Novice", JOB_NOVICE }, + { "Swordsman", JOB_SWORDMAN }, + { "Magician", JOB_MAGE }, + { "Archer", JOB_ARCHER }, + { "Acolyte", JOB_ACOLYTE }, + { "Merchant", JOB_MERCHANT }, + { "Thief", JOB_THIEF }, + { "Knight", JOB_KNIGHT }, + { "Priest", JOB_PRIEST }, + { "Wizard", JOB_WIZARD }, + { "Blacksmith", JOB_BLACKSMITH }, + { "Hunter", JOB_HUNTER }, + { "Assassin", JOB_ASSASSIN }, + { "Crusader", JOB_CRUSADER }, + { "Monk", JOB_MONK }, + { "Sage", JOB_SAGE }, + { "Rogue", JOB_ROGUE }, + { "Alchemist", JOB_ALCHEMIST }, + { "Bard", JOB_BARD }, + { "Dancer", JOB_DANCER }, + { "Super_Novice", JOB_SUPER_NOVICE }, + { "Gunslinger", JOB_GUNSLINGER }, + { "Ninja", JOB_NINJA }, + { "Novice_High", JOB_NOVICE_HIGH }, + { "Swordsman_High", JOB_SWORDMAN_HIGH }, + { "Magician_High", JOB_MAGE_HIGH }, + { "Archer_High", JOB_ARCHER_HIGH }, + { "Acolyte_High", JOB_ACOLYTE_HIGH }, + { "Merchant_High", JOB_MERCHANT_HIGH }, + { "Thief_High", JOB_THIEF_HIGH }, + { "Lord_Knight", JOB_LORD_KNIGHT }, + { "High_Priest", JOB_HIGH_PRIEST }, + { "High_Wizard", JOB_HIGH_WIZARD }, + { "Whitesmith", JOB_WHITESMITH }, + { "Sniper", JOB_SNIPER }, + { "Assassin_Cross", JOB_ASSASSIN_CROSS }, + { "Paladin", JOB_PALADIN }, + { "Champion", JOB_CHAMPION }, + { "Professor", JOB_PROFESSOR }, + { "Stalker", JOB_STALKER }, + { "Creator", JOB_CREATOR }, + { "Clown", JOB_CLOWN }, + { "Gypsy", JOB_GYPSY }, + { "Baby_Novice", JOB_BABY }, + { "Baby_Swordsman", JOB_BABY_SWORDMAN }, + { "Baby_Magician", JOB_BABY_MAGE }, + { "Baby_Archer", JOB_BABY_ARCHER }, + { "Baby_Acolyte", JOB_BABY_ACOLYTE }, + { "Baby_Merchant", JOB_BABY_MERCHANT }, + { "Baby_Thief", JOB_BABY_THIEF }, + { "Baby_Knight", JOB_BABY_KNIGHT }, + { "Baby_Priest", JOB_BABY_PRIEST }, + { "Baby_Wizard", JOB_BABY_WIZARD }, + { "Baby_Blacksmith", JOB_BABY_BLACKSMITH }, + { "Baby_Hunter", JOB_BABY_HUNTER }, + { "Baby_Assassin", JOB_BABY_ASSASSIN }, + { "Baby_Crusader", JOB_BABY_CRUSADER }, + { "Baby_Monk", JOB_BABY_MONK }, + { "Baby_Sage", JOB_BABY_SAGE }, + { "Baby_Rogue", JOB_BABY_ROGUE }, + { "Baby_Alchemist", JOB_BABY_ALCHEMIST }, + { "Baby_Bard", JOB_BABY_BARD }, + { "Baby_Dancer", JOB_BABY_DANCER }, + { "Super_Baby", JOB_SUPER_BABY }, + { "Taekwon", JOB_TAEKWON }, + { "Star_Gladiator", JOB_STAR_GLADIATOR }, + { "Soul_Linker", JOB_SOUL_LINKER }, + { "Gangsi", JOB_GANGSI }, + { "Death_Knight", JOB_DEATH_KNIGHT }, + { "Dark_Collector", JOB_DARK_COLLECTOR }, + { "Rune_Knight", JOB_RUNE_KNIGHT }, + { "Warlock", JOB_WARLOCK }, + { "Ranger", JOB_RANGER }, + { "Arch_Bishop", JOB_ARCH_BISHOP }, + { "Mechanic", JOB_MECHANIC }, + { "Guillotine_Cross", JOB_GUILLOTINE_CROSS }, + { "Rune_Knight_Trans", JOB_RUNE_KNIGHT_T }, + { "Warlock_Trans", JOB_WARLOCK_T }, + { "Ranger_Trans", JOB_RANGER_T }, + { "Arch_Bishop_Trans", JOB_ARCH_BISHOP_T }, + { "Mechanic_Trans", JOB_MECHANIC_T }, + { "Guillotine_Cross_Trans", JOB_GUILLOTINE_CROSS_T }, + { "Royal_Guard", JOB_ROYAL_GUARD }, + { "Sorcerer", JOB_SORCERER }, + { "Minstrel", JOB_MINSTREL }, + { "Wanderer", JOB_WANDERER }, + { "Sura", JOB_SURA }, + { "Genetic", JOB_GENETIC }, + { "Shadow_Chaser", JOB_SHADOW_CHASER }, + { "Royal_Guard_Trans", JOB_ROYAL_GUARD_T }, + { "Sorcerer_Trans", JOB_SORCERER_T }, + { "Minstrel_Trans", JOB_MINSTREL_T }, + { "Wanderer_Trans", JOB_WANDERER_T }, + { "Sura_Trans", JOB_SURA_T }, + { "Genetic_Trans", JOB_GENETIC_T }, + { "Shadow_Chaser_Trans", JOB_SHADOW_CHASER_T }, + { "Baby_Rune_Knight", JOB_BABY_RUNE }, + { "Baby_Warlock", JOB_BABY_WARLOCK }, + { "Baby_Ranger", JOB_BABY_RANGER }, + { "Baby_Arch_Bishop", JOB_BABY_BISHOP }, + { "Baby_Mechanic", JOB_BABY_MECHANIC }, + { "Baby_Guillotine_Cross", JOB_BABY_CROSS }, + { "Baby_Royal_Guard", JOB_BABY_GUARD }, + { "Baby_Sorcerer", JOB_BABY_SORCERER }, + { "Baby_Minstrel", JOB_BABY_MINSTREL }, + { "Baby_Wanderer", JOB_BABY_WANDERER }, + { "Baby_Sura", JOB_BABY_SURA }, + { "Baby_Genetic", JOB_BABY_GENETIC }, + { "Baby_Shadow_Chaser", JOB_BABY_CHASER }, + { "Expanded_Super_Novice", JOB_SUPER_NOVICE_E }, + { "Expanded_Super_Baby", JOB_SUPER_BABY_E }, + { "Kagerou", JOB_KAGEROU }, + { "Oboro", JOB_OBORO }, + { "Rebellion", JOB_REBELLION }, + }; + + len = ARRAYLENGTH(names); + + ARR_FIND(0, len, i, strcmpi(names[i].name, name) == 0); + + if ( i == len ) + return -1; + + return names[i].id; +} + int pc_follow_timer(int tid, int64 tick, int id, intptr_t data) { struct map_session_data *sd; struct block_list *tbl; @@ -10051,148 +10183,24 @@ void pc_read_skill_tree(void) { int i = 0, jnamelen = 0; struct s_mapiterator *iter; struct map_session_data *sd; - struct { - const char *name; - int id; - } jnames[] = { - { "Novice", JOB_NOVICE }, - { "Swordsman", JOB_SWORDMAN }, - { "Magician", JOB_MAGE }, - { "Archer", JOB_ARCHER }, - { "Acolyte", JOB_ACOLYTE }, - { "Merchant", JOB_MERCHANT }, - { "Thief", JOB_THIEF }, - { "Knight", JOB_KNIGHT }, - { "Priest", JOB_PRIEST }, - { "Wizard", JOB_WIZARD }, - { "Blacksmith", JOB_BLACKSMITH }, - { "Hunter", JOB_HUNTER }, - { "Assassin", JOB_ASSASSIN }, - { "Crusader", JOB_CRUSADER }, - { "Monk", JOB_MONK }, - { "Sage", JOB_SAGE }, - { "Rogue", JOB_ROGUE }, - { "Alchemist", JOB_ALCHEMIST }, - { "Bard", JOB_BARD }, - { "Dancer", JOB_DANCER }, - { "Super_Novice", JOB_SUPER_NOVICE }, - { "Gunslinger", JOB_GUNSLINGER }, - { "Ninja", JOB_NINJA }, - { "Novice_High", JOB_NOVICE_HIGH }, - { "Swordsman_High", JOB_SWORDMAN_HIGH }, - { "Magician_High", JOB_MAGE_HIGH }, - { "Archer_High", JOB_ARCHER_HIGH }, - { "Acolyte_High", JOB_ACOLYTE_HIGH }, - { "Merchant_High", JOB_MERCHANT_HIGH }, - { "Thief_High", JOB_THIEF_HIGH }, - { "Lord_Knight", JOB_LORD_KNIGHT }, - { "High_Priest", JOB_HIGH_PRIEST }, - { "High_Wizard", JOB_HIGH_WIZARD }, - { "Whitesmith", JOB_WHITESMITH }, - { "Sniper", JOB_SNIPER }, - { "Assassin_Cross", JOB_ASSASSIN_CROSS }, - { "Paladin", JOB_PALADIN }, - { "Champion", JOB_CHAMPION }, - { "Professor", JOB_PROFESSOR }, - { "Stalker", JOB_STALKER }, - { "Creator", JOB_CREATOR }, - { "Clown", JOB_CLOWN }, - { "Gypsy", JOB_GYPSY }, - { "Baby_Novice", JOB_BABY }, - { "Baby_Swordsman", JOB_BABY_SWORDMAN }, - { "Baby_Magician", JOB_BABY_MAGE }, - { "Baby_Archer", JOB_BABY_ARCHER }, - { "Baby_Acolyte", JOB_BABY_ACOLYTE }, - { "Baby_Merchant", JOB_BABY_MERCHANT }, - { "Baby_Thief", JOB_BABY_THIEF }, - { "Baby_Knight", JOB_BABY_KNIGHT }, - { "Baby_Priest", JOB_BABY_PRIEST }, - { "Baby_Wizard", JOB_BABY_WIZARD }, - { "Baby_Blacksmith", JOB_BABY_BLACKSMITH }, - { "Baby_Hunter", JOB_BABY_HUNTER }, - { "Baby_Assassin", JOB_BABY_ASSASSIN }, - { "Baby_Crusader", JOB_BABY_CRUSADER }, - { "Baby_Monk", JOB_BABY_MONK }, - { "Baby_Sage", JOB_BABY_SAGE }, - { "Baby_Rogue", JOB_BABY_ROGUE }, - { "Baby_Alchemist", JOB_BABY_ALCHEMIST }, - { "Baby_Bard", JOB_BABY_BARD }, - { "Baby_Dancer", JOB_BABY_DANCER }, - { "Super_Baby", JOB_SUPER_BABY }, - { "Taekwon", JOB_TAEKWON }, - { "Star_Gladiator", JOB_STAR_GLADIATOR }, - { "Soul_Linker", JOB_SOUL_LINKER }, - { "Gangsi", JOB_GANGSI }, - { "Death_Knight", JOB_DEATH_KNIGHT }, - { "Dark_Collector", JOB_DARK_COLLECTOR }, - { "Rune_Knight", JOB_RUNE_KNIGHT }, - { "Warlock", JOB_WARLOCK }, - { "Ranger", JOB_RANGER }, - { "Arch_Bishop", JOB_ARCH_BISHOP }, - { "Mechanic", JOB_MECHANIC }, - { "Guillotine_Cross", JOB_GUILLOTINE_CROSS }, - { "Rune_Knight_Trans", JOB_RUNE_KNIGHT_T }, - { "Warlock_Trans", JOB_WARLOCK_T }, - { "Ranger_Trans", JOB_RANGER_T }, - { "Arch_Bishop_Trans", JOB_ARCH_BISHOP_T }, - { "Mechanic_Trans", JOB_MECHANIC_T }, - { "Guillotine_Cross_Trans", JOB_GUILLOTINE_CROSS_T }, - { "Royal_Guard", JOB_ROYAL_GUARD }, - { "Sorcerer", JOB_SORCERER }, - { "Minstrel", JOB_MINSTREL }, - { "Wanderer", JOB_WANDERER }, - { "Sura", JOB_SURA }, - { "Genetic", JOB_GENETIC }, - { "Shadow_Chaser", JOB_SHADOW_CHASER }, - { "Royal_Guard_Trans", JOB_ROYAL_GUARD_T }, - { "Sorcerer_Trans", JOB_SORCERER_T }, - { "Minstrel_Trans", JOB_MINSTREL_T }, - { "Wanderer_Trans", JOB_WANDERER_T }, - { "Sura_Trans", JOB_SURA_T }, - { "Genetic_Trans", JOB_GENETIC_T }, - { "Shadow_Chaser_Trans", JOB_SHADOW_CHASER_T }, - { "Baby_Rune_Knight", JOB_BABY_RUNE }, - { "Baby_Warlock", JOB_BABY_WARLOCK }, - { "Baby_Ranger", JOB_BABY_RANGER }, - { "Baby_Arch_Bishop", JOB_BABY_BISHOP }, - { "Baby_Mechanic", JOB_BABY_MECHANIC }, - { "Baby_Guillotine_Cross", JOB_BABY_CROSS }, - { "Baby_Royal_Guard", JOB_BABY_GUARD }, - { "Baby_Sorcerer", JOB_BABY_SORCERER }, - { "Baby_Minstrel", JOB_BABY_MINSTREL }, - { "Baby_Wanderer", JOB_BABY_WANDERER }, - { "Baby_Sura", JOB_BABY_SURA }, - { "Baby_Genetic", JOB_BABY_GENETIC }, - { "Baby_Shadow_Chaser", JOB_BABY_CHASER }, - { "Expanded_Super_Novice", JOB_SUPER_NOVICE_E }, - { "Expanded_Super_Baby", JOB_SUPER_BABY_E }, - { "Kagerou", JOB_KAGEROU }, - { "Oboro", JOB_OBORO }, - { "Rebellion", JOB_REBELLION }, - }; if (libconfig->read_file(&skill_tree_conf, config_filename)) { ShowError("can't read %s\n", config_filename); return; } - - jnamelen = ARRAYLENGTH(jnames); - + while ((skt = libconfig->setting_get_elem(skill_tree_conf.root,i++))) { int k; const char *name = config_setting_name(skt); - ARR_FIND(0, jnamelen, k, strcmpi(jnames[k].name,name) == 0 ); - - if( k == jnamelen ) { - ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n",name); + if ( (k = pc->check_job_name(name)) == -1 ) { + ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n", name); continue; } - - + if( ( skills = libconfig->setting_get_member(skt,"skills") ) ) { int c = 0; - int idx = pc->class2idx(jnames[k].id); + int idx = pc->class2idx(k); while ((sk = libconfig->setting_get_elem(skills,c++))) { const char *sk_name = config_setting_name(sk); @@ -10206,7 +10214,7 @@ void pc_read_skill_tree(void) { ShowWarning("pc_read_skill_tree: Unable to load skill %d (%s) into '%s's tree. Maximum number of skills per class has been reached.\n", skill_id, sk_name, name); continue; } else if (pc->skill_tree[idx][skidx].id) { - ShowNotice("pc_read_skill_tree: Overwriting %d for '%s' (%d)\n", skill_id, name, jnames[k].id); + ShowNotice("pc_read_skill_tree: Overwriting %d for '%s' (%d)\n", skill_id, name, k); } pc->skill_tree[idx][skidx].id = skill_id; @@ -10250,46 +10258,42 @@ void pc_read_skill_tree(void) { while( (skt = libconfig->setting_get_elem(skill_tree_conf.root,i++)) ) { int k, idx; const char *name = config_setting_name(skt); - - - ARR_FIND(0, jnamelen, k, strcmpi(jnames[k].name,name) == 0 ); - if( k == jnamelen ) { - ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n",name); + if ( (k = pc->check_job_name(name)) == -1 ) { + ShowWarning("pc_read_skill_tree: '%s' unknown job name!\n", name); continue; } - idx = pc->class2idx(jnames[k].id); + + idx = pc->class2idx(k); if( ( inherit = libconfig->setting_get_member(skt,"inherit") ) ) { const char *iname; int v = 0; - while ((iname = libconfig->setting_get_string_elem(inherit, v++))) { + while ( (iname = libconfig->setting_get_string_elem(inherit, v++)) ) { int b = 0, a, d, f, fidx; - ARR_FIND(0, jnamelen, b, strcmpi(jnames[b].name,iname) == 0 ); - - if( b == jnamelen ) { - ShowWarning("pc_read_skill_tree: '%s' trying to inherit unknown '%s'!\n",name,iname); + if ( (b = pc->check_job_name(iname)) == -1 ) { + ShowWarning("pc_read_skill_tree: '%s' trying to inherit unknown '%s'!\n", name, iname); continue; } - - fidx = pc->class2idx(jnames[b].id); - - ARR_FIND( 0, MAX_SKILL_TREE, d, pc->skill_tree[fidx][d].id == 0 ); - for( f = 0; f < d; f++ ) { - - ARR_FIND( 0, MAX_SKILL_TREE, a, pc->skill_tree[idx][a].id == 0 || pc->skill_tree[idx][a].id == pc->skill_tree[fidx][f].id ); + fidx = pc->class2idx(b); + + ARR_FIND(0, MAX_SKILL_TREE, d, pc->skill_tree[fidx][d].id == 0); + + for ( f = 0; f < d; f++ ) { - if( a == MAX_SKILL_TREE ) { - ShowWarning("pc_read_skill_tree: '%s' can't inherit '%s', skill tree is full!\n", name,iname); + ARR_FIND(0, MAX_SKILL_TREE, a, pc->skill_tree[idx][a].id == 0 || pc->skill_tree[idx][a].id == pc->skill_tree[fidx][f].id); + + if ( a == MAX_SKILL_TREE ) { + ShowWarning("pc_read_skill_tree: '%s' can't inherit '%s', skill tree is full!\n", name, iname); break; - } else if ( pc->skill_tree[idx][a].id || ( pc->skill_tree[idx][a].id == NV_TRICKDEAD && ((pc->jobid2mapid(jnames[k].id)&(MAPID_BASEMASK|JOBL_2))!=MAPID_NOVICE) ) ) /* we skip trickdead for non-novices */ + } else if ( pc->skill_tree[idx][a].id || (pc->skill_tree[idx][a].id == NV_TRICKDEAD && ((pc->jobid2mapid(k)&(MAPID_BASEMASK | JOBL_2)) != MAPID_NOVICE)) ) /* we skip trickdead for non-novices */ continue;/* skip */ memcpy(&pc->skill_tree[idx][a], &pc->skill_tree[fidx][f], sizeof(pc->skill_tree[fidx][f])); pc->skill_tree[idx][a].inherited = 1; } - + } } @@ -11294,4 +11298,6 @@ void pc_defaults(void) { pc->autotrade_start = pc_autotrade_start; pc->autotrade_prepare = pc_autotrade_prepare; pc->autotrade_populate = pc_autotrade_populate; + + pc->check_job_name = pc_check_job_name; } diff --git a/src/map/pc.h b/src/map/pc.h index 9e9aa4673..39b705b8f 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -1035,6 +1035,8 @@ struct pc_interface { void (*autotrade_start) (struct map_session_data *sd); void (*autotrade_prepare) (struct map_session_data *sd); void (*autotrade_populate) (struct map_session_data *sd); + + int (*check_job_name) (const char *name); }; struct pc_interface *pc; diff --git a/src/map/skill.c b/src/map/skill.c index 3140b720c..4c8ecb40f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4866,7 +4866,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { if( sd && ud->skilltimer != INVALID_TIMER && (pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) ) {// restore original walk speed ud->skilltimer = INVALID_TIMER; - status_calc_bl(&sd->bl, SCB_SPEED); + status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD); } ud->skilltimer = INVALID_TIMER; @@ -9878,7 +9878,7 @@ int skill_castend_pos(int tid, int64 tick, int id, intptr_t data) if( sd && ud->skilltimer != INVALID_TIMER && ( pc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) ) {// restore original walk speed ud->skilltimer = INVALID_TIMER; - status_calc_bl(&sd->bl, SCB_SPEED); + status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD); } ud->skilltimer = INVALID_TIMER; diff --git a/src/map/status.c b/src/map/status.c index a7c809c6d..4e4398c49 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2081,64 +2081,42 @@ int status_calc_pet_(struct pet_data *pd, enum e_status_calc_opt opt) return 1; } -/// Helper function for status_base_pc_maxhp(), used to pre-calculate the hp_sigma_val[] array -void status_calc_sigma(void) -{ - int i,j; +unsigned int status_get_base_maxsp(struct map_session_data* sd, struct status_data *st) { + uint64 val = pc->class2idx(sd->status.class_); - for(i = 0; i < CLASS_COUNT; i++) - { - unsigned int k = 0; - status->hp_sigma_val[i][0] = status->hp_sigma_val[i][1] = 0; - for(j = 2; j <= MAX_LEVEL; j++) - { - k += (status->hp_coefficient[i]*j + 50) / 100; - status->hp_sigma_val[i][j] = k; - if (k >= INT_MAX) - break; //Overflow protection. [Skotlex] - } - for(; j <= MAX_LEVEL; j++) - status->hp_sigma_val[i][j] = INT_MAX; - } + val = status->SP_table[val][sd->status.base_level]; + + if ( sd->class_&JOBL_UPPER ) + val += val * 25 / 100; + else if ( sd->class_&JOBL_BABY ) + val = val * 70 / 100; + if ( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) + val *= 3; //Triple max SP for top ranking Taekwons over level 90. + + val += val * st->int_ / 100; + + return (unsigned int)cap_value(val, 0, UINT_MAX); } -/// Calculates base MaxHP value according to class and base level -/// The recursive equation used to calculate level bonus is (using integer operations) -/// f(0) = 35 | f(x+1) = f(x) + A + (x + B)*C/D -/// which reduces to something close to -/// f(x) = 35 + x*(A + B*C/D) + sum(i=2..x){ i*C/D } -unsigned int status_base_pc_maxhp(struct map_session_data *sd, struct status_data *st) { +unsigned int status_get_base_maxhp(struct map_session_data *sd, struct status_data *st) { uint64 val = pc->class2idx(sd->status.class_); - val = 35 + sd->status.base_level*(int64)status->hp_coefficient2[val]/100 + status->hp_sigma_val[val][sd->status.base_level]; - - if((sd->class_&MAPID_UPPERMASK) == MAPID_NINJA || (sd->class_&MAPID_UPPERMASK) == MAPID_GUNSLINGER || (sd->class_&MAPID_UPPERMASK) == MAPID_REBELLION) - val += 100; //Since their HP can't be approximated well enough without this. - if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON)) - val *= 3; //Triple max HP for top ranking Taekwons over level 90. - if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99) - val += 2000; //Supernovice lvl99 hp bonus. - val += val * st->vit/100; // +1% per each point of VIT + val = status->HP_table[val][sd->status.base_level]; - if (sd->class_&JOBL_UPPER) - val += val * 25/100; //Trans classes get a 25% hp bonus - else if (sd->class_&JOBL_BABY) - val -= val * 30/100; //Baby classes get a 30% hp penalty - return (unsigned int)cap_value(val,0,UINT_MAX); -} + if ( (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99 ) + val += 2000; //Supernovice lvl99 hp bonus. + if ( (sd->class_&MAPID_THIRDMASK) == MAPID_SUPER_NOVICE_E && sd->status.base_level >= 150 ) + val += 2000; //Extented Supernovice lvl150 hp bonus. -unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct status_data *st) { - uint64 val; + if ( sd->class_&JOBL_UPPER ) + val += val * 25 / 100; //Trans classes get a 25% hp bonus + else if ( sd->class_&JOBL_BABY ) + val = val * 70 / 100; //Baby classes get a 30% hp penalty - val = 10 + sd->status.base_level*(int64)status->sp_coefficient[pc->class2idx(sd->status.class_)]/100; - val += val * st->int_/100; + if ( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON) ) + val *= 3; //Triple max HP for top ranking Taekwons over level 90. - if (sd->class_&JOBL_UPPER) - val += val * 25/100; - else if (sd->class_&JOBL_BABY) - val -= val * 30/100; - if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc->famerank(sd->status.char_id, MAPID_TAEKWON)) - val *= 3; //Triple max SP for top ranking Taekwons over level 90. + val += val * st->vit / 100; // +1% per each point of VIT return (unsigned int)cap_value(val,0,UINT_MAX); } @@ -2630,7 +2608,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { // Basic MaxHP value //We hold the standard Max HP here to make it faster to recalculate on vit changes. - sd->status.max_hp = status->base_pc_maxhp(sd,bstatus); + sd->status.max_hp = status->get_base_maxhp(sd,bstatus); //This is done to handle underflows from negative Max HP bonuses i64 = sd->status.max_hp + (int)bstatus->max_hp; bstatus->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX); @@ -2655,7 +2633,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { // ----- SP MAX CALCULATION ----- // Basic MaxSP value - sd->status.max_sp = status->base_pc_maxsp(sd,bstatus); + sd->status.max_sp = status->get_base_maxsp(sd,bstatus); //This is done to handle underflows from negative Max SP bonuses i64 = sd->status.max_sp + (int)bstatus->max_sp; bstatus->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX); @@ -2842,17 +2820,12 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) { else if (pc_isridingdragon(sd)) bstatus->aspd_rate += 250-50*pc->checkskill(sd,RK_DRAGONTRAINING); #else // needs more info - if((skill_lv=pc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK) - bstatus->aspd_rate += 5*skill_lv; - if((skill_lv = pc->checkskill(sd,SG_DEVIL)) > 0 && !pc->nextjobexp(sd)) - bstatus->aspd_rate += 30*skill_lv; - if((skill_lv=pc->checkskill(sd,GS_SINGLEACTION))>0 && - (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)) - bstatus->aspd_rate += ((skill_lv+1)/2) * 10; - if (pc_isridingpeco(sd)) - bstatus->aspd_rate -= 500-100*pc->checkskill(sd,KN_CAVALIERMASTERY); - else if (pc_isridingdragon(sd)) - bstatus->aspd_rate -= 250-50*pc->checkskill(sd,RK_DRAGONTRAINING); + if ( (skill_lv = pc->checkskill(sd, SG_DEVIL)) > 0 && !pc->nextjobexp(sd) ) + bstatus->aspd_rate += 30 * skill_lv; + if ( pc_isridingpeco(sd) ) + bstatus->aspd_rate -= 500 - 100 * pc->checkskill(sd, KN_CAVALIERMASTERY); + else if ( pc_isridingdragon(sd) ) + bstatus->aspd_rate -= 250 - 50 * pc->checkskill(sd, RK_DRAGONTRAINING); #endif bstatus->adelay = 2*bstatus->amotion; @@ -3656,7 +3629,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { if(flag&SCB_MAXHP) { if( bl->type&BL_PC ) { - st->max_hp = status->base_pc_maxhp(sd,st); + st->max_hp = status->get_base_maxhp(sd,st); if (sd) st->max_hp += bst->max_hp - sd->status.max_hp; @@ -3677,7 +3650,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { if(flag&SCB_MAXSP) { if( bl->type&BL_PC ) { - st->max_sp = status->base_pc_maxsp(sd,st); + st->max_sp = status->get_base_maxsp(sd,st); if (sd) st->max_sp += bst->max_sp - sd->status.max_sp; @@ -3744,19 +3717,14 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { amotion = status->base_amotion_pc(sd, st); #ifndef RENEWAL_ASPD st->aspd_rate = status->calc_aspd_rate(bl, sc, bst->aspd_rate); - - if(st->aspd_rate != 1000) - amotion = amotion*st->aspd_rate/1000; -#else - // aspd = baseaspd + floor(sqrt((agi^2/2) + (dex^2/5))/4 + (potskillbonus*agi/200)) - amotion -= (int)(sqrt((pow(st->agi, 2) / 2) + (pow(st->dex, 2) / 5)) / 4 + ((float)status->calc_aspd(bl, sc, 1) * st->agi / 200)) * 10; - - if ( (status->calc_aspd(bl, sc, 2) + st->aspd_rate2) != 0 ) // RE ASPD percertage modifier - amotion -= ((amotion - ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd)) - * (status->calc_aspd(bl, sc, 2) + st->aspd_rate2) / 10 + 5) / 10; - +#endif if ( st->aspd_rate != 1000 ) // absolute percentage modifier - amotion = (200 - (200 - amotion / 10) * st->aspd_rate / 1000) * 10; + amotion = amotion * st->aspd_rate / 1000; + if ( sd && sd->ud.skilltimer != INVALID_TIMER && pc->checkskill(sd, SA_FREECAST) > 0 ) + amotion = amotion * 5 * (pc->checkskill(sd, SA_FREECAST) + 10) / 100; +#ifdef RENEWAL_ASPD + amotion += (max(0xc3 - amotion, 2) * (st->aspd_rate2 + status->calc_aspd(bl, sc, 2))) / 100; + amotion = 10 * (200 - amotion) + sd->bonus.aspd_add; #endif amotion = status->calc_fix_aspd(bl, sc, amotion); st->amotion = cap_value(amotion, ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd), 2000); @@ -4011,31 +3979,30 @@ int status_check_visibility(struct block_list *src, struct block_list *target) { // Basic ASPD value int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) { int amotion; -#ifdef RENEWAL_ASPD - short mod = -1; - - switch ( sd->weapontype2 ) { // adjustment for dual wielding - case W_DAGGER: - mod = 0; - break; // 0, 1, 1 - case W_1HSWORD: - case W_1HAXE: - mod = 1; - if ( (sd->class_&MAPID_THIRDMASK) == MAPID_GUILLOTINE_CROSS ) // 0, 2, 3 - mod = sd->weapontype2 / W_1HSWORD + W_1HSWORD / sd->weapontype2; - } - - amotion = (sd->status.weapon < MAX_WEAPON_TYPE && mod < 0) - ? (status->aspd_base[pc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon - : ((status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] // dual-wield - + status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod - - status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] - + status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1]); - +#ifdef RENEWAL_ASPD /* [malufett/Hercules] */ + float temp; + int skill_lv, val = 0; + amotion = status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1]; + if ( sd->status.weapon > MAX_WEAPON_TYPE ) + amotion += status->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] / 4; if ( sd->status.shield ) - amotion += (2000 - status->aspd_base[pc->class2idx(sd->status.class_)][W_FIST]) + - (status->aspd_base[pc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE] - 2000); - + amotion += status->aspd_base[pc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE]; + switch ( sd->status.weapon ) { + case W_BOW: case W_MUSICAL: + case W_WHIP: case W_REVOLVER: + case W_RIFLE: case W_GATLING: + case W_SHOTGUN: case W_GRENADE: + temp = st->dex * st->dex / 7.0f + st->agi * st->agi * 0.5f; + break; + default: + temp = st->dex * st->dex / 5.0f + st->agi * st->agi * 0.5f; + } + temp = (float)(sqrt(temp) * 0.25f) + 0xc4; + if ( (skill_lv = pc->checkskill(sd, SA_ADVANCEDBOOK)) > 0 && sd->status.weapon == W_BOOK ) + val += (skill_lv - 1) / 2 + 1; + if ( (skill_lv = pc->checkskill(sd, GS_SINGLEACTION)) > 0 ) + val += ((skill_lv + 1) / 2); + amotion = ((int)(temp + ((float)(status->calc_aspd(&sd->bl, &sd->sc, 1) + val) * st->agi / 200)) - min(amotion, 200)); #else // base weapon delay amotion = (sd->status.weapon < MAX_WEAPON_TYPE) @@ -4044,9 +4011,10 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st) // percentual delay reduction from stats amotion -= amotion * (4 * st->agi + st->dex) / 1000; -#endif + // raw delay adjustment from bAspd bonus amotion += sd->bonus.aspd_add; +#endif /* angra manyu disregards aspd_base and similar */ if ( sd->equip_index[EQI_HAND_R] >= 0 && sd->status.inventory[sd->equip_index[EQI_HAND_R]].nameid == ITEMID_ANGRA_MANYU ) @@ -12086,33 +12054,178 @@ int status_get_sc_type(sc_type type) { * size_fix.txt - size adjustment table for weapons * refine_db.txt - refining data table *------------------------------------------*/ -bool status_readdb_job1(char* fields[], int columns, int current) -{// Job-specific values (weight, HP, SP, ASPD) - int idx, class_; - unsigned int i; - - class_ = atoi(fields[0]); +void status_read_job_db(void) { /* [malufett/Hercules] */ + int i = 0; + config_t job_db_conf; + config_setting_t *jdb = NULL; + const char *config_filename = "db/"DBPATH"job_db.conf"; + struct { + const char *name; + int id; + } wnames[] = { + { "Fist", W_FIST }, + { "Dagger", W_DAGGER }, + { "Sword", W_1HSWORD }, + { "TwoHandSword", W_2HSWORD }, + { "Spear", W_1HSPEAR }, + { "TwoHandSpear", W_2HSPEAR }, + { "Axe", W_1HAXE }, + { "TwoHandAxe", W_2HAXE }, + { "Mace", W_MACE }, + { "TwoHandMace", W_2HMACE }, + { "Rod", W_STAFF }, + { "Bow", W_BOW }, + { "Knuckle", W_KNUCKLE }, + { "Instrument", W_MUSICAL }, + { "Whip", W_WHIP }, + { "Book", W_BOOK }, + { "Katar", W_KATAR }, + { "Revolver", W_REVOLVER }, + { "Rifle", W_RIFLE }, + { "GatlingGun", W_GATLING }, + { "Shotgun", W_SHOTGUN }, + { "GrenadeLauncher", W_GRENADE }, + { "FuumaShuriken", W_HUUMA }, + { "TwoHandRod", W_2HSTAFF }, +#ifdef RENEWAL_ASPD + { "Shield", MAX_WEAPON_TYPE } +#endif + }; - if(!pc->db_checkid(class_)) - { - ShowWarning("status_readdb_job1: Invalid job class %d specified.\n", class_); - return false; + if ( libconfig->read_file(&job_db_conf, config_filename) ) { + ShowError("can't read %s\n", config_filename); + return; } - idx = pc->class2idx(class_); + while ( (jdb = libconfig->setting_get_elem(job_db_conf.root, i++)) ) { + int class_, idx, i32 = 0; + config_setting_t *temp = NULL; + const char *name = config_setting_name(jdb); - status->max_weight_base[idx] = atoi(fields[1]); - status->hp_coefficient[idx] = atoi(fields[2]); - status->hp_coefficient2[idx] = atoi(fields[3]); - status->sp_coefficient[idx] = atoi(fields[4]); -#ifdef RENEWAL_ASPD - for(i = 0; i <= MAX_WEAPON_TYPE; i++) -#else - for(i = 0; i < MAX_WEAPON_TYPE; i++) -#endif - { - status->aspd_base[idx][i] = atoi(fields[i+5]); + if ( (class_ = pc->check_job_name(name)) == -1 ) { + ShowWarning("pc_read_job_db: '%s' unknown job name!\n", name); + continue; + } + + idx = pc->class2idx(class_); + if ( (temp = libconfig->setting_get_member(jdb, "Inherit")) ) { + int nidx = 0, iidx, w; + const char *iname; + while ( (iname = libconfig->setting_get_string_elem(temp, nidx++)) ) { + int iclass, ave, total = 0; + if ( (iclass = pc->check_job_name(iname)) == -1 ) { + ShowWarning("status_read_job_db: '%s' trying to inherit unknown '%s'!\n", name, iname); + continue; + } + iidx = pc->class2idx(iclass); + status->max_weight_base[idx] = status->max_weight_base[iidx]; + memcpy(&status->aspd_base[idx], &status->aspd_base[iidx], sizeof(status->aspd_base[iidx])); + for ( w = 1; w <= MAX_LEVEL && status->HP_table[iidx][w]; w++ ) { + status->HP_table[idx][w] = status->HP_table[iidx][w]; + total += status->HP_table[idx][w]; + } + ave = total / (w - 1); + for ( ; w <= pc->max_level[idx][0]; w++ ) { + status->HP_table[idx][w] = min(ave * w, battle_config.max_hp); + } + for ( w = 1; w <= MAX_LEVEL && status->SP_table[iidx][w]; w++ ) { + status->SP_table[idx][w] = status->SP_table[iidx][w]; + total += status->SP_table[idx][w]; + } + ave = total / (w - 1); + for ( ; w <= pc->max_level[idx][0]; w++ ) { + status->SP_table[idx][w] = min(ave * w, battle_config.max_sp); + } + } + } + if ( (temp = libconfig->setting_get_member(jdb, "InheritHP")) ) { + int nidx = 0, iidx; + const char *iname; + while ( (iname = libconfig->setting_get_string_elem(temp, nidx++)) ) { + int iclass, w, ave, total = 0; + if ( (iclass = pc->check_job_name(iname)) == -1 ) { + ShowWarning("status_read_job_db: '%s' trying to inherit unknown '%s' HP!\n", name, iname); + continue; + } + iidx = pc->class2idx(iclass); + for ( w = 1; w <= MAX_LEVEL && status->HP_table[iidx][w]; w++ ) { + status->HP_table[idx][w] = status->HP_table[iidx][w]; + total += status->HP_table[idx][w]; + } + ave = total / (w - 1); + for ( ; w <= pc->max_level[idx][0]; w++ ) { + status->HP_table[idx][w] = min(ave * w, battle_config.max_hp); + } + } + } + if ( (temp = libconfig->setting_get_member(jdb, "InheritSP")) ) { + int nidx = 0, iidx, ave, total = 0; + const char *iname; + while ( (iname = libconfig->setting_get_string_elem(temp, nidx++)) ) { + int iclass, w; + if ( (iclass = pc->check_job_name(iname)) == -1 ) { + ShowWarning("status_read_job_db: '%s' trying to inherit unknown '%s' SP!\n", name, iname); + continue; + } + iidx = pc->class2idx(iclass); + for ( w = 1; w <= MAX_LEVEL && status->SP_table[iidx][w]; w++ ) { + status->SP_table[idx][w] = status->SP_table[iidx][w]; + total += status->SP_table[idx][w]; + } + ave = total / (w - 1); + for ( ; w <= pc->max_level[idx][0]; w++ ) { + status->SP_table[idx][w] = min(ave * w, battle_config.max_sp); + } + } + } + + if ( libconfig->setting_lookup_int(jdb, "Weight", &i32) ) + status->max_weight_base[idx] = i32; + else if ( !status->max_weight_base[idx] ) + status->max_weight_base[idx] = 20000; + + if ( (temp = libconfig->setting_get_member(jdb, "BaseASPD")) ) { + int widx = 0; + config_setting_t *wpn = NULL; + while ( (wpn = libconfig->setting_get_elem(temp, widx++)) ) { + int w, wlen = ARRAYLENGTH(wnames); + const char *wname = config_setting_name(wpn); + + ARR_FIND(0, wlen, w, strcmp(wnames[w].name, wname) == 0); + if ( w != wlen ) { + status->aspd_base[idx][wnames[w].id] = libconfig->setting_get_int(wpn); + } else { + ShowWarning("status_read_job_db: unknown weapon type '%s'!\n", wname); + } + } + } + + if ( (temp = libconfig->setting_get_member(jdb, "HPTable")) ) { + int level = 0, ave, total = 0; + config_setting_t *hp = NULL; + while ( (hp = libconfig->setting_get_elem(temp, level++)) ) { + status->HP_table[idx][level] = i32 = min(libconfig->setting_get_int(hp), battle_config.max_hp); + total += i32 - status->HP_table[idx][level - 1]; + } + ave = total / (level - 1); + for ( ; level <= pc->max_level[idx][0]; level++ ) { /* limit only to possible maximum level of the given class */ + status->HP_table[idx][level] = min(ave * level, battle_config.max_hp); /* some are still empty? then let's use the average increase */ + } + } + + if ( (temp = libconfig->setting_get_member(jdb, "SPTable")) ) { + int level = 0, ave, total = 0; + config_setting_t *sp = NULL; + while ( (sp = libconfig->setting_get_elem(temp, level++)) ) { + status->SP_table[idx][level] = i32 = min(libconfig->setting_get_int(sp), battle_config.max_sp); + total += i32 - status->SP_table[idx][level - 1]; + } + ave = total / (level - 1); + for ( ; level <= pc->max_level[idx][0]; level++ ) { + status->SP_table[idx][level] = min(ave * level, battle_config.max_sp); + } + } } - return true; + libconfig->destroy(&job_db_conf); } bool status_readdb_job2(char* fields[], int columns, int current) @@ -12207,15 +12320,21 @@ int status_readdb(void) // initialize databases to default // if( runflag == MAPSERVER_ST_RUNNING ) {//not necessary during boot - // reset job_db1.txt data + // reset job_db.conf data memset(status->max_weight_base, 0, sizeof(status->max_weight_base)); - memset(status->hp_coefficient, 0, sizeof(status->hp_coefficient)); - memset(status->hp_coefficient2, 0, sizeof(status->hp_coefficient2)); - memset(status->sp_coefficient, 0, sizeof(status->sp_coefficient)); - memset(status->aspd_base, 0, sizeof(status->aspd_base)); + memset(status->HP_table, 0, sizeof(status->HP_table)); + memset(status->SP_table, 0, sizeof(status->SP_table)); // reset job_db2.txt data memset(status->job_bonus,0,sizeof(status->job_bonus)); // Job-specific stats bonus } + for ( i = 0; i < CLASS_COUNT; i++ ) { + for ( j = 0; j < MAX_WEAPON_TYPE; j++ ) + status->aspd_base[i][j] = 2000; +#ifdef RENEWAL_ASPD + status->aspd_base[i][MAX_WEAPON_TYPE] = 0; +#endif + } + // size_fix.txt for(i = 0; i < ARRAYLENGTH(status->atkmods); i++) for(j = 0; j < MAX_WEAPON_TYPE; j++) @@ -12232,17 +12351,11 @@ int status_readdb(void) // read databases // - - -#ifdef RENEWAL_ASPD - sv->readdb(map->db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, status->readdb_job1); -#else - sv->readdb(map->db_path, "pre-re/job_db1.txt", ',', 5+MAX_WEAPON_TYPE, 5+MAX_WEAPON_TYPE, -1, status->readdb_job1); -#endif sv->readdb(map->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, status->readdb_job2); sv->readdb(map->db_path, DBPATH"size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(status->atkmods), status->readdb_sizefix); sv->readdb(map->db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(status->refine_info), status->readdb_refine); sv->readdb(map->db_path, "sc_config.txt", ',', 2, 2, SC_MAX, status->readdb_scconfig); + status->read_job_db(); return 0; } @@ -12260,7 +12373,6 @@ int do_init_status(bool minimal) { status->initChangeTables(); status->initDummyData(); status->readdb(); - status->calc_sigma(); status->natural_heal_prev_tick = timer->gettick(); status->data_ers = ers_new(sizeof(struct status_change_entry),"status.c::data_ers",ERS_OPT_NONE); timer->add_interval(status->natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, status->natural_heal_timer, 0, 0, NATURAL_HEAL_INTERVAL); @@ -12285,10 +12397,8 @@ void status_defaults(void) { status->current_equip_card_id = 0; //To prevent card-stacking (from jA) [Skotlex] memset(status->max_weight_base,0,sizeof(status->max_weight_base) - + sizeof(status->hp_coefficient) - + sizeof(status->hp_coefficient2) - + sizeof(status->hp_sigma_val) - + sizeof(status->sp_coefficient) + + sizeof(status->HP_table) + + sizeof(status->SP_table) + sizeof(status->aspd_base) + sizeof(status->Skill2SCTable) + sizeof(status->IconChangeTable) @@ -12396,9 +12506,8 @@ void status_defaults(void) { status->initDummyData = initDummyData; status->base_amotion_pc = status_base_amotion_pc; status->base_atk = status_base_atk; - status->calc_sigma = status_calc_sigma; - status->base_pc_maxhp = status_base_pc_maxhp; - status->base_pc_maxsp = status_base_pc_maxsp; + status->get_base_maxhp = status_get_base_maxhp; + status->get_base_maxsp = status_get_base_maxsp; status->calc_npc_ = status_calc_npc_; status->calc_str = status_calc_str; status->calc_agi = status_calc_agi; @@ -12428,9 +12537,9 @@ void status_defaults(void) { status->display_remove = status_display_remove; status->natural_heal = status_natural_heal; status->natural_heal_timer = status_natural_heal_timer; - status->readdb_job1 = status_readdb_job1; status->readdb_job2 = status_readdb_job2; status->readdb_sizefix = status_readdb_sizefix; status->readdb_refine = status_readdb_refine; status->readdb_scconfig = status_readdb_scconfig; + status->read_job_db = status_read_job_db; } diff --git a/src/map/status.h b/src/map/status.h index f0624587e..98d5d415c 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1982,10 +1982,8 @@ struct status_interface { int current_equip_card_id; /* */ int max_weight_base[CLASS_COUNT]; - int hp_coefficient[CLASS_COUNT]; - int hp_coefficient2[CLASS_COUNT]; - int hp_sigma_val[CLASS_COUNT][MAX_LEVEL+1]; - int sp_coefficient[CLASS_COUNT]; + int HP_table[CLASS_COUNT][MAX_LEVEL + 1]; + int SP_table[CLASS_COUNT][MAX_LEVEL + 1]; int aspd_base[CLASS_COUNT][MAX_WEAPON_TYPE+1]; // +1 for RENEWAL_ASPD sc_type Skill2SCTable[MAX_SKILL]; // skill -> status int IconChangeTable[SC_MAX]; // status -> "icon" (icon is a bit of a misnomer, since there exist values with no icon associated) @@ -2082,9 +2080,8 @@ struct status_interface { void (*initDummyData) (void); int (*base_amotion_pc) (struct map_session_data *sd, struct status_data *st); unsigned short (*base_atk) (const struct block_list *bl, const struct status_data *st); - void (*calc_sigma) (void); - unsigned int (*base_pc_maxhp) (struct map_session_data *sd, struct status_data *st); - unsigned int (*base_pc_maxsp) (struct map_session_data *sd, struct status_data *st); + unsigned int (*get_base_maxhp) (struct map_session_data *sd, struct status_data *st); + unsigned int (*get_base_maxsp) (struct map_session_data *sd, struct status_data *st); int (*calc_npc_) (struct npc_data *nd, enum e_status_calc_opt opt); unsigned short (*calc_str) (struct block_list *bl, struct status_change *sc, int str); unsigned short (*calc_agi) (struct block_list *bl, struct status_change *sc, int agi); @@ -2114,11 +2111,11 @@ struct status_interface { void (*display_remove) (struct map_session_data *sd, enum sc_type type); int (*natural_heal) (struct block_list *bl, va_list args); int (*natural_heal_timer) (int tid, int64 tick, int id, intptr_t data); - bool (*readdb_job1) (char *fields[], int columns, int current); bool (*readdb_job2) (char *fields[], int columns, int current); bool (*readdb_sizefix) (char *fields[], int columns, int current); bool (*readdb_refine) (char *fields[], int columns, int current); bool (*readdb_scconfig) (char *fields[], int columns, int current); + void (*read_job_db) (void); }; struct status_interface *status; diff --git a/src/map/unit.c b/src/map/unit.c index 2e96e9c20..2dba10aeb 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -1604,7 +1604,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui unit->setdir(src, map->calc_dir(src, target->x, target->y)); ud->skilltimer = timer->add( tick+casttime, skill->castend_id, src->id, 0 ); if( sd && (pc->checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) ) - status_calc_bl(&sd->bl, SCB_SPEED); + status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD); } else skill->castend_id(ud->skilltimer,tick,src->id,0); @@ -1747,8 +1747,9 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui if( casttime > 0 ) { unit->setdir(src, map->calc_dir(src, skill_x, skill_y)); ud->skilltimer = timer->add( tick+casttime, skill->castend_pos, src->id, 0 ); - if( (sd && pc->checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK) - status_calc_bl(&sd->bl, SCB_SPEED); + if ( (sd && pc->checkskill(sd, SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK ) { + status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD); + } } else { ud->skilltimer = INVALID_TIMER; skill->castend_pos(ud->skilltimer,tick,src->id,0); @@ -2231,7 +2232,7 @@ int unit_skillcastcancel(struct block_list *bl,int type) ud->skilltimer = INVALID_TIMER; if( sd && pc->checkskill(sd,SA_FREECAST) > 0 ) - status_calc_bl(&sd->bl, SCB_SPEED); + status_calc_bl(&sd->bl, SCB_SPEED|SCB_ASPD); if( sd ) { switch( skill_id ) { diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 651b8efc3..d7a6cf672 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3989,6 +3989,8 @@ struct { struct HPMHookPoint *HP_pc_autotrade_prepare_post; struct HPMHookPoint *HP_pc_autotrade_populate_pre; struct HPMHookPoint *HP_pc_autotrade_populate_post; + struct HPMHookPoint *HP_pc_check_job_name_pre; + struct HPMHookPoint *HP_pc_check_job_name_post; struct HPMHookPoint *HP_pet_init_pre; struct HPMHookPoint *HP_pet_init_post; struct HPMHookPoint *HP_pet_final_pre; @@ -4979,12 +4981,10 @@ struct { struct HPMHookPoint *HP_status_base_amotion_pc_post; struct HPMHookPoint *HP_status_base_atk_pre; struct HPMHookPoint *HP_status_base_atk_post; - struct HPMHookPoint *HP_status_calc_sigma_pre; - struct HPMHookPoint *HP_status_calc_sigma_post; - struct HPMHookPoint *HP_status_base_pc_maxhp_pre; - struct HPMHookPoint *HP_status_base_pc_maxhp_post; - struct HPMHookPoint *HP_status_base_pc_maxsp_pre; - struct HPMHookPoint *HP_status_base_pc_maxsp_post; + struct HPMHookPoint *HP_status_get_base_maxhp_pre; + struct HPMHookPoint *HP_status_get_base_maxhp_post; + struct HPMHookPoint *HP_status_get_base_maxsp_pre; + struct HPMHookPoint *HP_status_get_base_maxsp_post; struct HPMHookPoint *HP_status_calc_npc__pre; struct HPMHookPoint *HP_status_calc_npc__post; struct HPMHookPoint *HP_status_calc_str_pre; @@ -5043,8 +5043,6 @@ struct { struct HPMHookPoint *HP_status_natural_heal_post; struct HPMHookPoint *HP_status_natural_heal_timer_pre; struct HPMHookPoint *HP_status_natural_heal_timer_post; - struct HPMHookPoint *HP_status_readdb_job1_pre; - struct HPMHookPoint *HP_status_readdb_job1_post; struct HPMHookPoint *HP_status_readdb_job2_pre; struct HPMHookPoint *HP_status_readdb_job2_post; struct HPMHookPoint *HP_status_readdb_sizefix_pre; @@ -5053,6 +5051,8 @@ struct { struct HPMHookPoint *HP_status_readdb_refine_post; struct HPMHookPoint *HP_status_readdb_scconfig_pre; struct HPMHookPoint *HP_status_readdb_scconfig_post; + struct HPMHookPoint *HP_status_read_job_db_pre; + struct HPMHookPoint *HP_status_read_job_db_post; struct HPMHookPoint *HP_storage_reconnect_pre; struct HPMHookPoint *HP_storage_reconnect_post; struct HPMHookPoint *HP_storage_delitem_pre; @@ -9196,6 +9196,8 @@ struct { int HP_pc_autotrade_prepare_post; int HP_pc_autotrade_populate_pre; int HP_pc_autotrade_populate_post; + int HP_pc_check_job_name_pre; + int HP_pc_check_job_name_post; int HP_pet_init_pre; int HP_pet_init_post; int HP_pet_final_pre; @@ -10186,12 +10188,10 @@ struct { int HP_status_base_amotion_pc_post; int HP_status_base_atk_pre; int HP_status_base_atk_post; - int HP_status_calc_sigma_pre; - int HP_status_calc_sigma_post; - int HP_status_base_pc_maxhp_pre; - int HP_status_base_pc_maxhp_post; - int HP_status_base_pc_maxsp_pre; - int HP_status_base_pc_maxsp_post; + int HP_status_get_base_maxhp_pre; + int HP_status_get_base_maxhp_post; + int HP_status_get_base_maxsp_pre; + int HP_status_get_base_maxsp_post; int HP_status_calc_npc__pre; int HP_status_calc_npc__post; int HP_status_calc_str_pre; @@ -10250,8 +10250,6 @@ struct { int HP_status_natural_heal_post; int HP_status_natural_heal_timer_pre; int HP_status_natural_heal_timer_post; - int HP_status_readdb_job1_pre; - int HP_status_readdb_job1_post; int HP_status_readdb_job2_pre; int HP_status_readdb_job2_post; int HP_status_readdb_sizefix_pre; @@ -10260,6 +10258,8 @@ struct { int HP_status_readdb_refine_post; int HP_status_readdb_scconfig_pre; int HP_status_readdb_scconfig_post; + int HP_status_read_job_db_pre; + int HP_status_read_job_db_post; int HP_storage_reconnect_pre; int HP_storage_reconnect_post; int HP_storage_delitem_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 5cbc20541..05ceb4ab1 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2026,6 +2026,7 @@ struct HookingPointData HookingPoints[] = { { HP_POP(pc->autotrade_start, HP_pc_autotrade_start) }, { HP_POP(pc->autotrade_prepare, HP_pc_autotrade_prepare) }, { HP_POP(pc->autotrade_populate, HP_pc_autotrade_populate) }, + { HP_POP(pc->check_job_name, HP_pc_check_job_name) }, /* pet */ { HP_POP(pet->init, HP_pet_init) }, { HP_POP(pet->final, HP_pet_final) }, @@ -2527,9 +2528,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(status->initDummyData, HP_status_initDummyData) }, { HP_POP(status->base_amotion_pc, HP_status_base_amotion_pc) }, { HP_POP(status->base_atk, HP_status_base_atk) }, - { HP_POP(status->calc_sigma, HP_status_calc_sigma) }, - { HP_POP(status->base_pc_maxhp, HP_status_base_pc_maxhp) }, - { HP_POP(status->base_pc_maxsp, HP_status_base_pc_maxsp) }, + { HP_POP(status->get_base_maxhp, HP_status_get_base_maxhp) }, + { HP_POP(status->get_base_maxsp, HP_status_get_base_maxsp) }, { HP_POP(status->calc_npc_, HP_status_calc_npc_) }, { HP_POP(status->calc_str, HP_status_calc_str) }, { HP_POP(status->calc_agi, HP_status_calc_agi) }, @@ -2559,11 +2559,11 @@ struct HookingPointData HookingPoints[] = { { HP_POP(status->display_remove, HP_status_display_remove) }, { HP_POP(status->natural_heal, HP_status_natural_heal) }, { HP_POP(status->natural_heal_timer, HP_status_natural_heal_timer) }, - { HP_POP(status->readdb_job1, HP_status_readdb_job1) }, { HP_POP(status->readdb_job2, HP_status_readdb_job2) }, { HP_POP(status->readdb_sizefix, HP_status_readdb_sizefix) }, { HP_POP(status->readdb_refine, HP_status_readdb_refine) }, { HP_POP(status->readdb_scconfig, HP_status_readdb_scconfig) }, + { HP_POP(status->read_job_db, HP_status_read_job_db) }, /* storage */ { HP_POP(storage->reconnect, HP_storage_reconnect) }, { HP_POP(storage->delitem, HP_storage_delitem) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 3b2c3f08f..8f7c4f0b4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -53389,6 +53389,33 @@ void HP_pc_autotrade_populate(struct map_session_data *sd) { } return; } +int HP_pc_check_job_name(const char *name) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_pc_check_job_name_pre ) { + int (*preHookFunc) (const char *name); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_job_name_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_pc_check_job_name_pre[hIndex].func; + retVal___ = preHookFunc(name); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.pc.check_job_name(name); + } + if( HPMHooks.count.HP_pc_check_job_name_post ) { + int (*postHookFunc) (int retVal___, const char *name); + for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_check_job_name_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_pc_check_job_name_post[hIndex].func; + retVal___ = postHookFunc(retVal___, name); + } + } + return retVal___; +} /* pet */ int HP_pet_init(bool minimal) { int hIndex = 0; @@ -66962,40 +66989,14 @@ unsigned short HP_status_base_atk(const struct block_list *bl, const struct stat } return retVal___; } -void HP_status_calc_sigma(void) { - int hIndex = 0; - if( HPMHooks.count.HP_status_calc_sigma_pre ) { - void (*preHookFunc) (void); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_sigma_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_status_calc_sigma_pre[hIndex].func; - preHookFunc(); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.status.calc_sigma(); - } - if( HPMHooks.count.HP_status_calc_sigma_post ) { - void (*postHookFunc) (void); - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_calc_sigma_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_status_calc_sigma_post[hIndex].func; - postHookFunc(); - } - } - return; -} -unsigned int HP_status_base_pc_maxhp(struct map_session_data *sd, struct status_data *st) { +unsigned int HP_status_get_base_maxhp(struct map_session_data *sd, struct status_data *st) { int hIndex = 0; unsigned int retVal___ = 0; - if( HPMHooks.count.HP_status_base_pc_maxhp_pre ) { + if( HPMHooks.count.HP_status_get_base_maxhp_pre ) { unsigned int (*preHookFunc) (struct map_session_data *sd, struct status_data *st); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxhp_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_status_base_pc_maxhp_pre[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxhp_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_status_get_base_maxhp_pre[hIndex].func; retVal___ = preHookFunc(sd, st); } if( *HPMforce_return ) { @@ -67004,25 +67005,25 @@ unsigned int HP_status_base_pc_maxhp(struct map_session_data *sd, struct status_ } } { - retVal___ = HPMHooks.source.status.base_pc_maxhp(sd, st); + retVal___ = HPMHooks.source.status.get_base_maxhp(sd, st); } - if( HPMHooks.count.HP_status_base_pc_maxhp_post ) { + if( HPMHooks.count.HP_status_get_base_maxhp_post ) { unsigned int (*postHookFunc) (unsigned int retVal___, struct map_session_data *sd, struct status_data *st); - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxhp_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_status_base_pc_maxhp_post[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxhp_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_status_get_base_maxhp_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, st); } } return retVal___; } -unsigned int HP_status_base_pc_maxsp(struct map_session_data *sd, struct status_data *st) { +unsigned int HP_status_get_base_maxsp(struct map_session_data *sd, struct status_data *st) { int hIndex = 0; unsigned int retVal___ = 0; - if( HPMHooks.count.HP_status_base_pc_maxsp_pre ) { + if( HPMHooks.count.HP_status_get_base_maxsp_pre ) { unsigned int (*preHookFunc) (struct map_session_data *sd, struct status_data *st); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxsp_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_status_base_pc_maxsp_pre[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxsp_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_status_get_base_maxsp_pre[hIndex].func; retVal___ = preHookFunc(sd, st); } if( *HPMforce_return ) { @@ -67031,12 +67032,12 @@ unsigned int HP_status_base_pc_maxsp(struct map_session_data *sd, struct status_ } } { - retVal___ = HPMHooks.source.status.base_pc_maxsp(sd, st); + retVal___ = HPMHooks.source.status.get_base_maxsp(sd, st); } - if( HPMHooks.count.HP_status_base_pc_maxsp_post ) { + if( HPMHooks.count.HP_status_get_base_maxsp_post ) { unsigned int (*postHookFunc) (unsigned int retVal___, struct map_session_data *sd, struct status_data *st); - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_base_pc_maxsp_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_status_base_pc_maxsp_post[hIndex].func; + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_get_base_maxsp_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_status_get_base_maxsp_post[hIndex].func; retVal___ = postHookFunc(retVal___, sd, st); } } @@ -67828,33 +67829,6 @@ int HP_status_natural_heal_timer(int tid, int64 tick, int id, intptr_t data) { } return retVal___; } -bool HP_status_readdb_job1(char *fields[], int columns, int current) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_status_readdb_job1_pre ) { - bool (*preHookFunc) (char *fields[], int *columns, int *current); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_job1_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_status_readdb_job1_pre[hIndex].func; - retVal___ = preHookFunc(fields, &columns, ¤t); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.status.readdb_job1(fields, columns, current); - } - if( HPMHooks.count.HP_status_readdb_job1_post ) { - bool (*postHookFunc) (bool retVal___, char *fields[], int *columns, int *current); - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_job1_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_status_readdb_job1_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fields, &columns, ¤t); - } - } - return retVal___; -} bool HP_status_readdb_job2(char *fields[], int columns, int current) { int hIndex = 0; bool retVal___ = false; @@ -67963,6 +67937,32 @@ bool HP_status_readdb_scconfig(char *fields[], int columns, int current) { } return retVal___; } +void HP_status_read_job_db(void) { + int hIndex = 0; + if( HPMHooks.count.HP_status_read_job_db_pre ) { + void (*preHookFunc) (void); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_read_job_db_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_status_read_job_db_pre[hIndex].func; + preHookFunc(); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return; + } + } + { + HPMHooks.source.status.read_job_db(); + } + if( HPMHooks.count.HP_status_read_job_db_post ) { + void (*postHookFunc) (void); + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_read_job_db_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_status_read_job_db_post[hIndex].func; + postHookFunc(); + } + } + return; +} /* storage */ void HP_storage_reconnect(void) { int hIndex = 0; |