summaryrefslogtreecommitdiff
path: root/src/map/status.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-11-30 02:58:47 +0100
committerHaru <haru@dotalux.com>2016-12-03 15:38:55 +0100
commitcfa4ae95efca5557d085c56815259f47e6f380fb (patch)
treee08b55a2c9fb546f7f2ed41977f1e0bb8041e445 /src/map/status.c
parentb0fde17b0ee155f1123e9ae6148ddd2df88cd965 (diff)
downloadhercules-cfa4ae95efca5557d085c56815259f47e6f380fb.tar.gz
hercules-cfa4ae95efca5557d085c56815259f47e6f380fb.tar.bz2
hercules-cfa4ae95efca5557d085c56815259f47e6f380fb.tar.xz
hercules-cfa4ae95efca5557d085c56815259f47e6f380fb.zip
Clarify some Job Class vs MapID confusion (1/2)
This commit ensures that `sd->status.class` and related variables only contain Job Classes (i.e. the client-compatible values, where High Novice 4001) and are never checked against the bitmask-based MapID values. As a rule of thumb, from now on, when a variable is named `class`, it is intended to contain a Job Class ID and not a MapID. The type of such variable shall be a signed `int16` or `int`. To ensure that related third party code is also verified when this commit is merged, the variable `struct mmo_charstatus::class_ (i.e. `sd->status.class_`) is renamed to `class`. Some issues in related lines are also fixed, including: - A wrong check in the char server would prevent the correct detection of babies in code related to the family exp sharing. - Baby Arch Bishops would not be affected by Eucharistica. - A wrong check would cause the `questinfo()` script command not to display its information for most classes (except 1-1 classes). - Map IDs and Job Classes were mixed up in `itemdb_jobid2mapid()` and `itemdb_jobmask2mapid()` for 1-1 classes (causing currently no harm, since they just happen to coincide). - The Baby Sura class would not cause parties to be marked as containing a monk type character (for SLS Team Up purposes). - Baby Geneticists would bypass the cart check when trying to equip ammunitions. - Baby Mechanics would bypass the Mado Gear check when trying to equip ammunitions. - Transcendent Shadow Chasers would lose the Stalkers' ability to clone transcendent skills. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/status.c')
-rw-r--r--src/map/status.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/map/status.c b/src/map/status.c
index 729b10f52..6f8c7a9e8 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2269,7 +2269,7 @@ unsigned int status_get_base_maxsp(const struct map_session_data *sd, const stru
nullpo_ret(sd);
nullpo_ret(st);
- val = pc->class2idx(sd->status.class_);
+ val = pc->class2idx(sd->status.class);
val = status->dbs->SP_table[val][sd->status.base_level];
if ( sd->class_&JOBL_UPPER )
@@ -2290,7 +2290,7 @@ unsigned int status_get_base_maxhp(const struct map_session_data *sd, const stru
nullpo_ret(sd);
nullpo_ret(st);
- val = pc->class2idx(sd->status.class_);
+ val = pc->class2idx(sd->status.class);
val = status->dbs->HP_table[val][sd->status.base_level];
if ( (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99 )
@@ -2342,7 +2342,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
pc->calc_skilltree(sd); // SkillTree calculation
- sd->max_weight = status->dbs->max_weight_base[pc->class2idx(sd->status.class_)]+sd->status.str*300;
+ sd->max_weight = status->dbs->max_weight_base[pc->class2idx(sd->status.class)]+sd->status.str*300;
if(opt&SCO_FIRST) {
//Load Hp/SP from char-received data.
@@ -2686,7 +2686,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
// ----- STATS CALCULATION -----
// Job bonuses
- index = pc->class2idx(sd->status.class_);
+ index = pc->class2idx(sd->status.class);
for (i = 0; i < sd->status.job_level && i < MAX_LEVEL; i++) {
if(!status->dbs->job_bonus[index][i])
continue;
@@ -4287,11 +4287,11 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
nullpo_ret(sd);
nullpo_ret(st);
- amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1];
+ amotion = status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1];
if ( sd->status.weapon > MAX_SINGLE_WEAPON_TYPE)
- amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2] / 4;
+ amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2] / 4;
if ( sd->status.shield )
- amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class_)][MAX_SINGLE_WEAPON_TYPE];
+ amotion += status->dbs->aspd_base[pc->class2idx(sd->status.class)][MAX_SINGLE_WEAPON_TYPE];
switch ( sd->status.weapon ) {
case W_BOW:
case W_MUSICAL:
@@ -4315,8 +4315,8 @@ int status_base_amotion_pc(struct map_session_data *sd, struct status_data *st)
#else
// base weapon delay
amotion = (sd->status.weapon < MAX_SINGLE_WEAPON_TYPE)
- ? (status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
- : (status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype1] + status->dbs->aspd_base[pc->class2idx(sd->status.class_)][sd->weapontype2]) * 7 / 10; // dual-wield
+ ? (status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->status.weapon]) // single weapon
+ : (status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype1] + status->dbs->aspd_base[pc->class2idx(sd->status.class)][sd->weapontype2]) * 7 / 10; // dual-wield
// percentual delay reduction from stats
amotion -= amotion * (4 * st->agi + st->dex) / 1000;
@@ -6430,7 +6430,7 @@ int status_get_class(const struct block_list *bl)
{
nullpo_ret(bl);
switch (bl->type) {
- case BL_PC: return BL_UCCAST(BL_PC, bl)->status.class_;
+ case BL_PC: return BL_UCCAST(BL_PC, bl)->status.class;
case BL_MOB: return BL_UCCAST(BL_MOB, bl)->vd->class_; //Class used on all code should be the view class of the mob.
case BL_PET: return BL_UCCAST(BL_PET, bl)->pet.class_;
case BL_HOM: return BL_UCCAST(BL_HOM, bl)->homunculus.class_;
@@ -13070,15 +13070,15 @@ void status_read_job_db(void) /* [malufett/Hercules] */
return;
while ( (jdb = libconfig->setting_get_elem(job_db_conf.root, i++)) ) {
- int class_, idx;
+ int class, idx;
const char *name = config_setting_name(jdb);
- if ( (class_ = pc->check_job_name(name)) == -1 ) {
+ if ((class = pc->check_job_name(name)) == -1) {
ShowWarning("pc_read_job_db: '%s' unknown job name!\n", name);
continue;
}
- idx = pc->class2idx(class_);
+ idx = pc->class2idx(class);
status->read_job_db_sub(idx, name, jdb);
}
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", i, config_filename);
@@ -13087,17 +13087,16 @@ void status_read_job_db(void) /* [malufett/Hercules] */
bool status_readdb_job2(char* fields[], int columns, int current)
{
- int idx, class_, i;
+ int idx, class, i;
nullpo_retr(false, fields);
- class_ = atoi(fields[0]);
+ class = atoi(fields[0]);
- if(!pc->db_checkid(class_))
- {
- ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class_);
+ if (!pc->db_checkid(class)) {
+ ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class);
return false;
}
- idx = pc->class2idx(class_);
+ idx = pc->class2idx(class);
for(i = 1; i < columns; i++)
{