summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/char/char.c68
-rw-r--r--src/char/int_guild.c12
-rw-r--r--src/char/int_party.c4
-rw-r--r--src/char/inter.c52
-rw-r--r--src/char/inter.h2
-rw-r--r--src/char/mapif.c2
-rw-r--r--src/char/mapif.h2
-rw-r--r--src/common/mmo.h8
-rw-r--r--src/map/atcommand.c8
-rw-r--r--src/map/battle.c11
-rw-r--r--src/map/clif.c26
-rw-r--r--src/map/guild.c8
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/intif.c6
-rw-r--r--src/map/intif.h2
-rw-r--r--src/map/itemdb.c33
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/party.c5
-rw-r--r--src/map/pc.c209
-rw-r--r--src/map/pc.h12
-rw-r--r--src/map/script.c28
-rw-r--r--src/map/skill.c25
-rw-r--r--src/map/skill.h2
-rw-r--r--src/map/status.c37
25 files changed, 297 insertions, 273 deletions
diff --git a/src/char/char.c b/src/char/char.c
index d69ea0d53..9314e8c81 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -519,7 +519,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
if (
(p->hair != cp->hair) || (p->hair_color != cp->hair_color) ||
(p->clothes_color != cp->clothes_color) || (p->body != cp->body) ||
- (p->class_ != cp->class_) ||
+ (p->class != cp->class) ||
(p->partner_id != cp->partner_id) || (p->father != cp->father) ||
(p->mother != cp->mother) || (p->child != cp->child) ||
(p->karma != cp->karma) || (p->manner != cp->manner) ||
@@ -531,7 +531,7 @@ int char_mmo_char_tosql(int char_id, struct mmo_charstatus* p)
"`partner_id`='%d', `father`='%d', `mother`='%d', `child`='%d',"
"`karma`='%d', `manner`='%d', `fame`='%d'"
" WHERE `account_id`='%d' AND `char_id` = '%d'",
- char_db, p->class_,
+ char_db, p->class,
p->hair, p->hair_color, p->clothes_color, p->body,
p->partner_id, p->father, p->mother, p->child,
p->karma, p->manner, p->fame,
@@ -961,7 +961,7 @@ int char_mmo_chars_fromsql(struct char_session_data* sd, uint8* buf)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &p.char_id, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_UCHAR, &p.slot, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_STRING, &p.name, sizeof(p.name), NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class_, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_SHORT, &p.class, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_INT, &p.base_level, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p.job_level, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_UINT, &p.base_exp, 0, NULL, NULL)
@@ -1072,7 +1072,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &p->account_id, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 2, SQLDT_UCHAR, &p->slot, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 3, SQLDT_STRING, &p->name, sizeof(p->name), NULL, NULL)
- || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class_, 0, NULL, NULL)
+ || SQL_ERROR == SQL->StmtBindColumn(stmt, 4, SQLDT_SHORT, &p->class, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 5, SQLDT_INT, &p->base_level, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 6, SQLDT_INT, &p->job_level, 0, NULL, NULL)
|| SQL_ERROR == SQL->StmtBindColumn(stmt, 7, SQLDT_UINT, &p->base_exp, 0, NULL, NULL)
@@ -1544,7 +1544,7 @@ int char_check_char_name(char * name, char * esc_name)
* -5: 'Symbols in Character Names are forbidden'
* char_id: Success
**/
-int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, short starting_job)
+int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style, int16 starting_class)
{
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1];
@@ -1560,7 +1560,7 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int
if (flag < 0)
return flag;
- switch (starting_job) {
+ switch (starting_class) {
case JOB_SUMMONER:
case JOB_NOVICE:
break;
@@ -1592,7 +1592,7 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int
if (SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `status_point`,`str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`,"
"`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES ("
"'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')",
- char_db, sd->account_id , slot, esc_name, starting_job, start_zeny, 48, str, agi, vit, int_, dex, luk,
+ char_db, sd->account_id , slot, esc_name, starting_class, start_zeny, 48, str, agi, vit, int_, dex, luk,
(40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color,
mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) )
{
@@ -1604,7 +1604,7 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int
if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`account_id`, `char_num`, `name`, `class`, `zeny`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `max_hp`, `hp`,"
"`max_sp`, `sp`, `hair`, `hair_color`, `last_map`, `last_x`, `last_y`, `save_map`, `save_x`, `save_y`) VALUES ("
"'%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d','%d', '%d','%d', '%d', '%s', '%d', '%d', '%s', '%d', '%d')",
- char_db, sd->account_id , slot, esc_name, starting_job, start_zeny, str, agi, vit, int_, dex, luk,
+ char_db, sd->account_id , slot, esc_name, starting_class, start_zeny, str, agi, vit, int_, dex, luk,
(40 * (100 + vit)/100) , (40 * (100 + vit)/100 ), (11 * (100 + int_)/100), (11 * (100 + int_)/100), hair_style, hair_color,
mapindex_id2name(start_point.map), start_point.x, start_point.y, mapindex_id2name(start_point.map), start_point.x, start_point.y) )
{
@@ -1623,7 +1623,7 @@ int char_make_new_char_sql(struct char_session_data *sd, const char *name_, int
if (SQL_ERROR == SQL->Query(inter->sql_handle,
"INSERT INTO `%s` (`time`, `char_msg`, `account_id`, `char_id`, `char_num`, `class`, `name`, `str`, `agi`, `vit`, `int`, `dex`, `luk`, `hair`, `hair_color`)"
"VALUES (NOW(), '%s', '%d', '%d', '%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
- charlog_db, "make new char", sd->account_id, char_id, slot, starting_job, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color))
+ charlog_db, "make new char", sd->account_id, char_id, slot, starting_class, esc_name, str, agi, vit, int_, dex, luk, hair_style, hair_color))
Sql_ShowDebug(inter->sql_handle);
}
@@ -1890,7 +1890,7 @@ int char_mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) {
WBUFW(buf,46) = min(p->sp, INT16_MAX);
WBUFW(buf,48) = min(p->max_sp, INT16_MAX);
WBUFW(buf,50) = DEFAULT_WALK_SPEED; // p->speed;
- WBUFW(buf,52) = p->class_;
+ WBUFW(buf,52) = p->class;
WBUFW(buf,54) = p->hair;
#if PACKETVER >= 20141022
WBUFW(buf,56) = p->body;
@@ -2326,33 +2326,33 @@ void char_changesex(int account_id, int sex)
* @param sex The new sex (SEX_MALE or SEX_FEMALE).
* @param acc The character's account ID.
* @param char_id The character ID.
- * @param class_ The character's current job class.
+ * @param class The character's current job class.
* @param guild_id The character's guild ID.
*/
-void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id)
+void char_change_sex_sub(int sex, int acc, int char_id, int class, int guild_id)
{
// job modification
- if (class_ == JOB_BARD || class_ == JOB_DANCER)
- class_ = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER);
- else if (class_ == JOB_CLOWN || class_ == JOB_GYPSY)
- class_ = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY);
- else if (class_ == JOB_BABY_BARD || class_ == JOB_BABY_DANCER)
- class_ = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER);
- else if (class_ == JOB_MINSTREL || class_ == JOB_WANDERER)
- class_ = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER);
- else if (class_ == JOB_MINSTREL_T || class_ == JOB_WANDERER_T)
- class_ = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T);
- else if (class_ == JOB_BABY_MINSTREL || class_ == JOB_BABY_WANDERER)
- class_ = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER);
- else if (class_ == JOB_KAGEROU || class_ == JOB_OBORO)
- class_ = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO);
+ if (class == JOB_BARD || class == JOB_DANCER)
+ class = (sex == SEX_MALE ? JOB_BARD : JOB_DANCER);
+ else if (class == JOB_CLOWN || class == JOB_GYPSY)
+ class = (sex == SEX_MALE ? JOB_CLOWN : JOB_GYPSY);
+ else if (class == JOB_BABY_BARD || class == JOB_BABY_DANCER)
+ class = (sex == SEX_MALE ? JOB_BABY_BARD : JOB_BABY_DANCER);
+ else if (class == JOB_MINSTREL || class == JOB_WANDERER)
+ class = (sex == SEX_MALE ? JOB_MINSTREL : JOB_WANDERER);
+ else if (class == JOB_MINSTREL_T || class == JOB_WANDERER_T)
+ class = (sex == SEX_MALE ? JOB_MINSTREL_T : JOB_WANDERER_T);
+ else if (class == JOB_BABY_MINSTREL || class == JOB_BABY_WANDERER)
+ class = (sex == SEX_MALE ? JOB_BABY_MINSTREL : JOB_BABY_WANDERER);
+ else if (class == JOB_KAGEROU || class == JOB_OBORO)
+ class = (sex == SEX_MALE ? JOB_KAGEROU : JOB_OBORO);
if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `equip`='0' WHERE `char_id`='%d'", inventory_db, char_id))
Sql_ShowDebug(inter->sql_handle);
if (SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `class`='%d', `weapon`='0', `shield`='0', "
"`head_top`='0', `head_mid`='0', `head_bottom`='0' WHERE `char_id`='%d'",
- char_db, class_, char_id))
+ char_db, class, char_id))
Sql_ShowDebug(inter->sql_handle);
if (guild_id) // If there is a guild, update the guild_member data [Skotlex]
inter_guild->sex_changed(guild_id, acc, char_id, sex);
@@ -2360,7 +2360,7 @@ void char_change_sex_sub(int sex, int acc, int char_id, int class_, int guild_id
int char_parse_fromlogin_changesex_reply(int fd)
{
- int char_id = 0, class_ = 0, guild_id = 0;
+ int char_id = 0, class = 0, guild_id = 0;
int i;
struct char_auth_node *node;
struct SqlStmt *stmt;
@@ -2389,11 +2389,11 @@ int char_parse_fromlogin_changesex_reply(int fd)
SQL->StmtFree(stmt);
}
SQL->StmtBindColumn(stmt, 0, SQLDT_INT, &char_id, 0, NULL, NULL);
- SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class_, 0, NULL, NULL);
+ SQL->StmtBindColumn(stmt, 1, SQLDT_INT, &class, 0, NULL, NULL);
SQL->StmtBindColumn(stmt, 2, SQLDT_INT, &guild_id, 0, NULL, NULL);
for (i = 0; i < MAX_CHARS && SQL_SUCCESS == SQL->StmtNextRow(stmt); ++i) {
- char_change_sex_sub(sex, acc, char_id, class_, guild_id);
+ char_change_sex_sub(sex, acc, char_id, class, guild_id);
}
SQL->StmtFree(stmt);
@@ -3371,7 +3371,7 @@ void char_ask_name_ack(int fd, int acc, const char* name, int type, int result)
*/
int char_changecharsex(int char_id, int sex)
{
- int class_ = 0, guild_id = 0, account_id = 0;
+ int class = 0, guild_id = 0, account_id = 0;
char *data;
// get character data
@@ -3384,7 +3384,7 @@ int char_changecharsex(int char_id, int sex)
return 1;
}
SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data);
- SQL->GetData(inter->sql_handle, 1, &data, NULL); class_ = atoi(data);
+ SQL->GetData(inter->sql_handle, 1, &data, NULL); class = atoi(data);
SQL->GetData(inter->sql_handle, 2, &data, NULL); guild_id = atoi(data);
SQL->FreeResult(inter->sql_handle);
@@ -3392,7 +3392,7 @@ int char_changecharsex(int char_id, int sex)
Sql_ShowDebug(inter->sql_handle);
return 1;
}
- char_change_sex_sub(sex, account_id, char_id, class_, guild_id);
+ char_change_sex_sub(sex, account_id, char_id, class, guild_id);
// disconnect player if online on char-server
chr->disconnect_player(account_id);
@@ -5039,7 +5039,7 @@ int char_parse_char(int fd)
// create new char
#if PACKETVER >= 20151001
- // S 0a39 <name>.24B <slot>.B <hair color>.W <hair style>.W <starting job ID>.W <Unknown>.(W or 2 B's)??? <sex>.B
+ // S 0a39 <name>.24B <slot>.B <hair color>.W <hair style>.W <starting job class ID>.W <Unknown>.(W or 2 B's)??? <sex>.B
case 0xa39:
{
FIFOSD_CHECK(36);
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index dcc1ed7cb..b4b4bdde4 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -251,7 +251,7 @@ int inter_guild_tosql(struct guild *g,int flag)
"VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%"PRIu64"','%d','%d','%d','%s')",
guild_member_db, g->guild_id, m->account_id, m->char_id,
m->hair, m->hair_color, m->gender,
- m->class_, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) )
+ m->class, m->lv, m->exp, m->exp_payper, m->online, m->position, esc_name) )
Sql_ShowDebug(inter->sql_handle);
if (m->modified&GS_MEMBER_NEW || new_guild == 1)
{
@@ -433,7 +433,7 @@ struct guild * inter_guild_fromsql(int guild_id)
SQL->GetData(inter->sql_handle, 2, &data, NULL); m->hair = atoi(data);
SQL->GetData(inter->sql_handle, 3, &data, NULL); m->hair_color = atoi(data);
SQL->GetData(inter->sql_handle, 4, &data, NULL); m->gender = atoi(data);
- SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class_ = atoi(data);
+ SQL->GetData(inter->sql_handle, 5, &data, NULL); m->class = atoi(data);
SQL->GetData(inter->sql_handle, 6, &data, NULL); m->lv = atoi(data);
SQL->GetData(inter->sql_handle, 7, &data, NULL); m->exp = strtoull(data, NULL, 10);
SQL->GetData(inter->sql_handle, 8, &data, NULL); m->exp_payper = (unsigned int)atoi(data);
@@ -984,7 +984,7 @@ int mapif_guild_memberinfoshort(struct guild *g, int idx)
WBUFL(buf,10)=g->member[idx].char_id;
WBUFB(buf,14)=(unsigned char)g->member[idx].online;
WBUFW(buf,15)=g->member[idx].lv;
- WBUFW(buf,17)=g->member[idx].class_;
+ WBUFW(buf,17)=g->member[idx].class;
mapif->sendall(buf,19);
return 0;
}
@@ -1349,7 +1349,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in
}
// Change member info
-int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_)
+int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class)
{
// Could speed up by manipulating only guild_member
struct guild * g;
@@ -1365,7 +1365,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id,
{
g->member[i].online = online;
g->member[i].lv = lv;
- g->member[i].class_ = class_;
+ g->member[i].class = class;
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfoshort(g,i);
}
@@ -1602,7 +1602,7 @@ int mapif_parse_GuildMemberInfoChange(int fd, int guild_id, int account_id, int
}
case GMI_CLASS:
{
- g->member[i].class_ = *(const short *)data;
+ g->member[i].class = *(const int16 *)data;
g->member[i].modified = GS_MEMBER_MODIFIED;
mapif->guild_memberinfochanged(guild_id,account_id,char_id,type,data,len);
g->save_flag |= GS_MEMBER; //Save new data.
diff --git a/src/char/int_party.c b/src/char/int_party.c
index e2be9f3ca..2fc39c328 100644
--- a/src/char/int_party.c
+++ b/src/char/int_party.c
@@ -89,7 +89,7 @@ static void inter_party_calc_state(struct party_data *p)
// FIXME[Haru]: What if the occupied positions aren't the first three? It can happen if some party members leave. This is the reason why family sharing some times stops working until you recreate your party
if( p->size == 2 && ( chr->char_child(p->party.member[0].char_id,p->party.member[1].char_id) || chr->char_child(p->party.member[1].char_id,p->party.member[0].char_id) ) ) {
//Child should be able to share with either of their parents [RoM]
- if(p->party.member[0].class_&JOBL_BABY) //first slot is the child?
+ if (p->party.member[0].class >= JOB_BABY && p->party.member[0].class <= JOB_SUPER_BABY) //first slot is the child?
p->family = p->party.member[0].char_id;
else
p->family = p->party.member[1].char_id;
@@ -252,7 +252,7 @@ struct party_data *inter_party_fromsql(int party_id)
SQL->GetData(inter->sql_handle, 3, &data, NULL); m->lv = atoi(data);
SQL->GetData(inter->sql_handle, 4, &data, NULL); m->map = mapindex->name2id(data);
SQL->GetData(inter->sql_handle, 5, &data, NULL); m->online = (atoi(data) ? 1 : 0);
- SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class_ = atoi(data);
+ SQL->GetData(inter->sql_handle, 6, &data, NULL); m->class = atoi(data);
m->leader = (m->account_id == leader_id && m->char_id == leader_char ? 1 : 0);
}
SQL->FreeResult(inter->sql_handle);
diff --git a/src/char/inter.c b/src/char/inter.c
index fd3fe8c16..d076bb657 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -168,9 +168,9 @@ void inter_do_final_msg(void)
aFree(msg_table[i]);
}
/* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */
-const char* inter_job_name(int class_)
+const char* inter_job_name(int class)
{
- switch (class_) {
+ switch (class) {
case JOB_NOVICE: // 550
case JOB_SWORDMAN: // 551
case JOB_MAGE: // 552
@@ -178,7 +178,7 @@ const char* inter_job_name(int class_)
case JOB_ACOLYTE: // 554
case JOB_MERCHANT: // 555
case JOB_THIEF: // 556
- return inter->msg_txt(550 - JOB_NOVICE+class_);
+ return inter->msg_txt(550 - JOB_NOVICE + class);
case JOB_KNIGHT: // 557
case JOB_PRIEST: // 558
@@ -186,7 +186,7 @@ const char* inter_job_name(int class_)
case JOB_BLACKSMITH: // 560
case JOB_HUNTER: // 561
case JOB_ASSASSIN: // 562
- return inter->msg_txt(557 - JOB_KNIGHT+class_);
+ return inter->msg_txt(557 - JOB_KNIGHT + class);
case JOB_KNIGHT2:
return inter->msg_txt(557);
@@ -198,7 +198,7 @@ const char* inter_job_name(int class_)
case JOB_ALCHEMIST: // 567
case JOB_BARD: // 568
case JOB_DANCER: // 569
- return inter->msg_txt(563 - JOB_CRUSADER+class_);
+ return inter->msg_txt(563 - JOB_CRUSADER + class);
case JOB_CRUSADER2:
return inter->msg_txt(563);
@@ -208,7 +208,7 @@ const char* inter_job_name(int class_)
case JOB_GUNSLINGER: // 572
case JOB_NINJA: // 573
case JOB_XMAS: // 574
- return inter->msg_txt(570 - JOB_WEDDING+class_);
+ return inter->msg_txt(570 - JOB_WEDDING + class);
case JOB_SUMMER:
return inter->msg_txt(621);
@@ -220,7 +220,7 @@ const char* inter_job_name(int class_)
case JOB_ACOLYTE_HIGH: // 579
case JOB_MERCHANT_HIGH: // 580
case JOB_THIEF_HIGH: // 581
- return inter->msg_txt(575 - JOB_NOVICE_HIGH+class_);
+ return inter->msg_txt(575 - JOB_NOVICE_HIGH + class);
case JOB_LORD_KNIGHT: // 582
case JOB_HIGH_PRIEST: // 583
@@ -228,7 +228,7 @@ const char* inter_job_name(int class_)
case JOB_WHITESMITH: // 585
case JOB_SNIPER: // 586
case JOB_ASSASSIN_CROSS: // 587
- return inter->msg_txt(582 - JOB_LORD_KNIGHT+class_);
+ return inter->msg_txt(582 - JOB_LORD_KNIGHT + class);
case JOB_LORD_KNIGHT2:
return inter->msg_txt(582);
@@ -240,7 +240,7 @@ const char* inter_job_name(int class_)
case JOB_CREATOR: // 592
case JOB_CLOWN: // 593
case JOB_GYPSY: // 594
- return inter->msg_txt(588 - JOB_PALADIN + class_);
+ return inter->msg_txt(588 - JOB_PALADIN + class);
case JOB_PALADIN2:
return inter->msg_txt(588);
@@ -252,7 +252,7 @@ const char* inter_job_name(int class_)
case JOB_BABY_ACOLYTE: // 599
case JOB_BABY_MERCHANT: // 600
case JOB_BABY_THIEF: // 601
- return inter->msg_txt(595 - JOB_BABY + class_);
+ return inter->msg_txt(595 - JOB_BABY + class);
case JOB_BABY_KNIGHT: // 602
case JOB_BABY_PRIEST: // 603
@@ -260,7 +260,7 @@ const char* inter_job_name(int class_)
case JOB_BABY_BLACKSMITH: // 605
case JOB_BABY_HUNTER: // 606
case JOB_BABY_ASSASSIN: // 607
- return inter->msg_txt(602 - JOB_BABY_KNIGHT + class_);
+ return inter->msg_txt(602 - JOB_BABY_KNIGHT + class);
case JOB_BABY_KNIGHT2:
return inter->msg_txt(602);
@@ -272,7 +272,7 @@ const char* inter_job_name(int class_)
case JOB_BABY_ALCHEMIST: // 612
case JOB_BABY_BARD: // 613
case JOB_BABY_DANCER: // 614
- return inter->msg_txt(608 - JOB_BABY_CRUSADER + class_);
+ return inter->msg_txt(608 - JOB_BABY_CRUSADER + class);
case JOB_BABY_CRUSADER2:
return inter->msg_txt(608);
@@ -291,7 +291,7 @@ const char* inter_job_name(int class_)
case JOB_GANGSI: // 622
case JOB_DEATH_KNIGHT: // 623
case JOB_DARK_COLLECTOR: // 624
- return inter->msg_txt(622 - JOB_GANGSI+class_);
+ return inter->msg_txt(622 - JOB_GANGSI + class);
case JOB_RUNE_KNIGHT: // 625
case JOB_WARLOCK: // 626
@@ -299,7 +299,7 @@ const char* inter_job_name(int class_)
case JOB_ARCH_BISHOP: // 628
case JOB_MECHANIC: // 629
case JOB_GUILLOTINE_CROSS: // 630
- return inter->msg_txt(625 - JOB_RUNE_KNIGHT+class_);
+ return inter->msg_txt(625 - JOB_RUNE_KNIGHT + class);
case JOB_RUNE_KNIGHT_T: // 656
case JOB_WARLOCK_T: // 657
@@ -307,7 +307,7 @@ const char* inter_job_name(int class_)
case JOB_ARCH_BISHOP_T: // 659
case JOB_MECHANIC_T: // 660
case JOB_GUILLOTINE_CROSS_T: // 661
- return inter->msg_txt(656 - JOB_RUNE_KNIGHT_T+class_);
+ return inter->msg_txt(656 - JOB_RUNE_KNIGHT_T + class);
case JOB_ROYAL_GUARD: // 631
case JOB_SORCERER: // 632
@@ -316,7 +316,7 @@ const char* inter_job_name(int class_)
case JOB_SURA: // 635
case JOB_GENETIC: // 636
case JOB_SHADOW_CHASER: // 637
- return inter->msg_txt(631 - JOB_ROYAL_GUARD+class_);
+ return inter->msg_txt(631 - JOB_ROYAL_GUARD + class);
case JOB_ROYAL_GUARD_T: // 662
case JOB_SORCERER_T: // 663
@@ -325,7 +325,7 @@ const char* inter_job_name(int class_)
case JOB_SURA_T: // 666
case JOB_GENETIC_T: // 667
case JOB_SHADOW_CHASER_T: // 668
- return inter->msg_txt(662 - JOB_ROYAL_GUARD_T+class_);
+ return inter->msg_txt(662 - JOB_ROYAL_GUARD_T + class);
case JOB_RUNE_KNIGHT2:
return inter->msg_txt(625);
@@ -364,7 +364,7 @@ const char* inter_job_name(int class_)
case JOB_BABY_SURA: // 648
case JOB_BABY_GENETIC: // 649
case JOB_BABY_CHASER: // 650
- return inter->msg_txt(638 - JOB_BABY_RUNE+class_);
+ return inter->msg_txt(638 - JOB_BABY_RUNE + class);
case JOB_BABY_RUNE2:
return inter->msg_txt(638);
@@ -380,11 +380,11 @@ const char* inter_job_name(int class_)
case JOB_SUPER_NOVICE_E: // 651
case JOB_SUPER_BABY_E: // 652
- return inter->msg_txt(651 - JOB_SUPER_NOVICE_E+class_);
+ return inter->msg_txt(651 - JOB_SUPER_NOVICE_E + class);
case JOB_KAGEROU: // 653
case JOB_OBORO: // 654
- return inter->msg_txt(653 - JOB_KAGEROU+class_);
+ return inter->msg_txt(653 - JOB_KAGEROU + class);
case JOB_REBELLION:
return inter->msg_txt(655);
@@ -477,18 +477,18 @@ void mapif_parse_accinfo(int fd)
} else {// more than one, listing... [Dekamaster/Nightroad]
inter->msg_to_fd(fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)SQL->NumRows(inter->sql_handle));
while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) {
- int class_;
+ int class;
int base_level, job_level, online;
char name[NAME_LENGTH];
SQL->GetData(inter->sql_handle, 0, &data, NULL); account_id = atoi(data);
SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name));
- SQL->GetData(inter->sql_handle, 2, &data, NULL); class_ = atoi(data);
+ SQL->GetData(inter->sql_handle, 2, &data, NULL); class = atoi(data);
SQL->GetData(inter->sql_handle, 3, &data, NULL); base_level = atoi(data);
SQL->GetData(inter->sql_handle, 4, &data, NULL); job_level = atoi(data);
SQL->GetData(inter->sql_handle, 5, &data, NULL); online = atoi(data);
- inter->msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class_), base_level, job_level, online?"Online":"Offline");
+ inter->msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, inter->job_name(class), base_level, job_level, online?"Online":"Offline");
}
SQL->FreeResult(inter->sql_handle);
return;
@@ -549,19 +549,19 @@ void mapif_parse_accinfo2(bool success, int map_fd, int u_fd, int u_aid, int acc
} else {
while ( SQL_SUCCESS == SQL->NextRow(inter->sql_handle) ) {
char *data;
- int char_id, class_;
+ int char_id, class;
int char_num, base_level, job_level, online;
char name[NAME_LENGTH];
SQL->GetData(inter->sql_handle, 0, &data, NULL); char_id = atoi(data);
SQL->GetData(inter->sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name));
SQL->GetData(inter->sql_handle, 2, &data, NULL); char_num = atoi(data);
- SQL->GetData(inter->sql_handle, 3, &data, NULL); class_ = atoi(data);
+ SQL->GetData(inter->sql_handle, 3, &data, NULL); class = atoi(data);
SQL->GetData(inter->sql_handle, 4, &data, NULL); base_level = atoi(data);
SQL->GetData(inter->sql_handle, 5, &data, NULL); job_level = atoi(data);
SQL->GetData(inter->sql_handle, 6, &data, NULL); online = atoi(data);
- inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class_), base_level, job_level, online?"On":"Off");
+ inter->msg_to_fd(map_fd, u_fd, u_aid, "[Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s", char_num, char_id, name, inter->job_name(class), base_level, job_level, online?"On":"Off");
}
}
SQL->FreeResult(inter->sql_handle);
diff --git a/src/char/inter.h b/src/char/inter.h
index dbbc6f4e8..796f89a96 100644
--- a/src/char/inter.h
+++ b/src/char/inter.h
@@ -39,7 +39,7 @@ struct inter_interface {
const char* (*msg_txt) (int msg_number);
bool (*msg_config_read) (const char *cfg_name, bool allow_override);
void (*do_final_msg) (void);
- const char* (*job_name) (int class_);
+ const char* (*job_name) (int class);
void (*vmsg_to_fd) (int fd, int u_fd, int aid, char* msg, va_list ap);
void (*msg_to_fd) (int fd, int u_fd, int aid, char *msg, ...) __attribute__((format(printf, 4, 5)));
void (*savereg) (int account_id, int char_id, const char *key, unsigned int index, intptr_t val, bool is_string);
diff --git a/src/char/mapif.c b/src/char/mapif.c
index 0c0a68654..1dafb79c3 100644
--- a/src/char/mapif.c
+++ b/src/char/mapif.c
@@ -89,7 +89,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, const char *name, const stru
int mapif_parse_GuildInfo(int fd, int guild_id);
int mapif_parse_GuildAddMember(int fd, int guild_id, const struct guild_member *m);
int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes);
-int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_);
+int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class);
int mapif_parse_BreakGuild(int fd, int guild_id);
int mapif_parse_GuildMessage(int fd, int guild_id, int account_id, const char *mes, int len);
int mapif_parse_GuildBasicInfoChange(int fd, int guild_id, int type, const void *data, int len);
diff --git a/src/char/mapif.h b/src/char/mapif.h
index 7f1d53b3e..ebbddead0 100644
--- a/src/char/mapif.h
+++ b/src/char/mapif.h
@@ -83,7 +83,7 @@ struct mapif_interface {
int (*parse_GuildInfo) (int fd, int guild_id);
int (*parse_GuildAddMember) (int fd, int guild_id, const struct guild_member *m);
int (*parse_GuildLeave) (int fd, int guild_id, int account_id, int char_id, int flag, const char *mes);
- int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_);
+ int (*parse_GuildChangeMemberInfoShort) (int fd, int guild_id, int account_id, int char_id, int online, int lv, int16 class);
int (*parse_BreakGuild) (int fd, int guild_id);
int (*parse_GuildMessage) (int fd, int guild_id, int account_id, const char *mes, int len);
int (*parse_GuildBasicInfoChange) (int fd, int guild_id, int type, const void *data, int len);
diff --git a/src/common/mmo.h b/src/common/mmo.h
index e5da16550..6b886aa41 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -566,7 +566,7 @@ struct mmo_charstatus {
int zeny;
int bank_vault;
- short class_;
+ int16 class;
int status_point, skill_point;
int hp,max_hp,sp,max_sp;
unsigned int option;
@@ -670,7 +670,7 @@ struct party_member {
int account_id;
int char_id;
char name[NAME_LENGTH];
- unsigned short class_;
+ int16 class;
unsigned short map;
unsigned short lv;
unsigned leader : 1,
@@ -689,7 +689,9 @@ struct party {
struct map_session_data;
struct guild_member {
int account_id, char_id;
- short hair,hair_color,gender,class_,lv;
+ short hair,hair_color,gender;
+ int16 class;
+ short lv;
uint64 exp;
int exp_payper;
short online,position;
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3f916eb42..0da3b7729 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -639,7 +639,7 @@ ACMD(who) {
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
StrBuf->Printf(&buf, msg_fd(fd,344), pcg->get_name(pl_sd->group)); // "(%s) "
StrBuf->Printf(&buf, msg_fd(fd,347), pl_sd->status.base_level, pl_sd->status.job_level,
- pc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
+ pc->job_name(pl_sd->status.class)); // "| Lv:%d/%d | Job: %s"
break;
}
case 3: {
@@ -748,7 +748,7 @@ ACMD(whogm)
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,915), // BLvl: %d | Job: %s (Lvl: %d)
pl_sd->status.base_level,
- pc->job_name(pl_sd->status.class_), pl_sd->status.job_level);
+ pc->job_name(pl_sd->status.class), pl_sd->status.job_level);
clif->message(fd, atcmd_output);
p = party->search(pl_sd->status.party_id);
@@ -937,7 +937,7 @@ ACMD(hide) {
if (sd->disguise != -1 )
status->set_viewdata(&sd->bl, sd->disguise);
else
- status->set_viewdata(&sd->bl, sd->status.class_);
+ status->set_viewdata(&sd->bl, sd->status.class);
clif->message(fd, msg_fd(fd,10)); // Invisible: Off
// increment the number of pvp players on the map
@@ -8210,7 +8210,7 @@ ACMD(stats)
output_table[14].value = sd->change_level_2nd;
output_table[15].value = sd->change_level_3rd;
- sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)");
+ sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class), "(level %d)");
sprintf(output, msg_fd(fd,53), sd->status.name); // '%s' stats:
clif->message(fd, output);
diff --git a/src/map/battle.c b/src/map/battle.c
index 8c1a3f364..812d588aa 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -892,7 +892,7 @@ int64 battle_calc_masteryfix(struct block_list *src, struct block_list *target,
damage += damage * ratio / 100;
}
- if( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ){
+ if ((sd->class_ & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) {
if((skill2_lv = pc->checkskill(sd,AB_EUCHARISTICA)) > 0 &&
(tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) )
damage += damage * skill2_lv / 100;
@@ -3760,10 +3760,11 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
//Constant/misc additions from skills
if (skill_id == WZ_FIREPILLAR)
MATK_ADD(100+50*skill_lv);
- if( sd && ( sd->status.class_ == JOB_ARCH_BISHOP_T || sd->status.class_ == JOB_ARCH_BISHOP ) &&
- (i=pc->checkskill(sd,AB_EUCHARISTICA)) > 0 &&
- (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK) )
- MATK_ADDRATE(i);
+ if (sd != NULL && (sd->class_ & MAPID_THIRDMASK) == MAPID_ARCH_BISHOP) {
+ int eucharistica_level = pc->checkskill(sd,AB_EUCHARISTICA);
+ if (eucharistica_level > 0 && (tstatus->race == RC_DEMON || tstatus->def_ele == ELE_DARK))
+ MATK_ADDRATE(eucharistica_level);
+ }
}
}
#ifndef HMAP_ZONE_DAMAGE_CAP_TYPE
diff --git a/src/map/clif.c b/src/map/clif.c
index 5d9802b57..f29a1357e 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -1220,7 +1220,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
#endif
if (clif->isdisguised(bl)) {
nullpo_retv(sd);
- if( sd->status.class_ != sd->disguise )
+ if (sd->status.class != sd->disguise)
clif->send(&p,sizeof(p),bl,target);
#if PACKETVER >= 20091103
p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE
@@ -4799,7 +4799,7 @@ void clif_skillinfoblock(struct map_session_data *sd)
}
safestrncpy(WFIFOP(fd,len+12), skill->get_name(id), NAME_LENGTH);
if(sd->status.skill[i].flag == SKILL_FLAG_PERMANENT)
- WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_))? 1:0;
+ WFIFOB(fd,len+36) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class))? 1:0;
else
WFIFOB(fd,len+36) = 0;
len += 37;
@@ -4850,7 +4850,7 @@ void clif_addskill(struct map_session_data *sd, int id)
}
safestrncpy(WFIFOP(fd,14), skill->get_name(id), NAME_LENGTH);
if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT)
- WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class_))? 1:0;
+ WFIFOB(fd,38) = (skill_lv < skill->tree_get_max(id, sd->status.class))? 1:0;
else
WFIFOB(fd,38) = 0;
WFIFOSET(fd,packet_len(0x111));
@@ -4895,7 +4895,7 @@ void clif_skillup(struct map_session_data *sd, uint16 skill_id, int skill_lv, in
WFIFOW(fd, 6) = skill->get_sp(skill_id, skill_lv);
WFIFOW(fd, 8) = (flag)?skill->get_range2(&sd->bl, skill_id, skill_lv) : skill->get_range(skill_id, skill_lv);
if( flag )
- WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0;
+ WFIFOB(fd,10) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class)) ? 1 : 0;
else
WFIFOB(fd,10) = 1;
@@ -4928,7 +4928,7 @@ void clif_skillinfo(struct map_session_data *sd,int skill_id, int inf)
WFIFOW(fd,12) = 0;
}
if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT)
- WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_))? 1:0;
+ WFIFOB(fd,14) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class))? 1:0;
else
WFIFOB(fd,14) = 0;
WFIFOSET(fd,packet_len(0x7e1));
@@ -7482,7 +7482,7 @@ void clif_guild_memberlist(struct map_session_data *sd)
WFIFOW(fd,c*104+12)=m->hair;
WFIFOW(fd,c*104+14)=m->hair_color;
WFIFOW(fd,c*104+16)=m->gender;
- WFIFOW(fd,c*104+18)=m->class_;
+ WFIFOW(fd,c*104+18)=m->class;
WFIFOW(fd,c*104+20)=m->lv;
WFIFOL(fd,c*104+22)=(int)cap_value(m->exp,0,INT32_MAX);
WFIFOL(fd,c*104+26)=m->online;
@@ -8913,7 +8913,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
safestrncpy(viewequip_list.characterName, tsd->status.name, NAME_LENGTH);
- viewequip_list.job = tsd->status.class_;
+ viewequip_list.job = tsd->status.class;
viewequip_list.head = tsd->vd.hair_style;
viewequip_list.accessory = tsd->vd.head_bottom;
viewequip_list.accessory2 = tsd->vd.head_mid;
@@ -9628,7 +9628,7 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
struct questinfo *qi = &map->list[sd->bl.m].qi_data[i];
if( quest->check(sd, qi->quest_id, HAVEQUEST) == -1 ) {// Check if quest is not started
if( qi->hasJob ) { // Check if quest is job-specific, check is user is said job class.
- if( sd->class_ == qi->job )
+ if (sd->status.class == qi->job)
clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
} else {
clif->quest_show_event(sd, &qi->nd->bl, qi->icon, qi->color);
@@ -9870,7 +9870,7 @@ int clif_undisguise_timer(int tid, int64 tick, int id, intptr_t data) {
struct map_session_data * sd;
if( (sd = map->id2sd(id)) ) {
sd->fontcolor_tid = INVALID_TIMER;
- if( sd->fontcolor && sd->disguise == sd->status.class_ )
+ if (sd->fontcolor && sd->disguise == sd->status.class)
pc->disguise(sd,-1);
}
return 0;
@@ -9921,12 +9921,12 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd)
if (sd->disguise == -1) {
sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0);
- pc->disguise(sd,sd->status.class_);
+ pc->disguise(sd,sd->status.class);
if (pc_isdead(sd))
clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd);
if (unit->is_walking(&sd->bl))
clif->move(&sd->ud);
- } else if (sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER) {
+ } else if (sd->disguise == sd->status.class && sd->fontcolor_tid != INVALID_TIMER) {
const struct TimerData *td;
if ((td = timer->get(sd->fontcolor_tid)) != NULL)
timer->settick(sd->fontcolor_tid, td->tick+5000);
@@ -12568,7 +12568,7 @@ void clif_PartyBookingVolunteerInfo(int index, struct map_session_data *sd)
nullpo_retv(sd);
WBUFW(buf, 0) = 0x8f2;
WBUFL(buf, 2) = sd->status.account_id;
- WBUFL(buf, 6) = sd->status.class_;
+ WBUFL(buf, 6) = sd->status.class;
WBUFW(buf, 10) = sd->status.base_level;
memcpy(WBUFP(buf, 12), sd->status.name, NAME_LENGTH);
@@ -16251,7 +16251,7 @@ void clif_bg_xy(struct map_session_data *sd)
WBUFW(buf,0)=0x2df;
WBUFL(buf,2)=sd->status.account_id;
memcpy(WBUFP(buf,6), sd->status.name, NAME_LENGTH);
- WBUFW(buf,30)=sd->status.class_;
+ WBUFW(buf,30)=sd->status.class;
WBUFW(buf,32)=sd->bl.x;
WBUFW(buf,34)=sd->bl.y;
diff --git a/src/map/guild.c b/src/map/guild.c
index 5de8d5d02..6e5b1c539 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -268,7 +268,7 @@ void guild_makemember(struct guild_member *m,struct map_session_data *sd)
m->hair = sd->status.hair;
m->hair_color = sd->status.hair_color;
m->gender = sd->status.sex;
- m->class_ = sd->status.class_;
+ m->class = sd->status.class;
m->lv = sd->status.base_level;
//m->exp = 0;
//m->exp_payper = 0;
@@ -977,7 +977,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
return 0;
intif->guild_memberinfoshort(g->guild_id,
- sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class_);
+ sd->status.account_id,sd->status.char_id,online,sd->status.base_level,sd->status.class);
if(!online){
int i = guild->getindex(g,sd->status.account_id,sd->status.char_id);
@@ -996,7 +996,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online)
return 0;
}
-int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
+int guild_recv_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class)
{ // cleaned up [LuzZza]
int i, alv, c, idx = INDEX_NOT_FOUND, om = 0, oldonline = -1;
struct guild *g = guild->search(guild_id);
@@ -1011,7 +1011,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
oldonline=m->online;
m->online=online;
m->lv=lv;
- m->class_=class_;
+ m->class = class;
idx=i;
}
alv+=m->lv;
diff --git a/src/map/guild.h b/src/map/guild.h
index feb374e4a..cdb28a37b 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -126,7 +126,7 @@ struct guild_interface {
int (*check_alliance) (int guild_id1, int guild_id2, int flag);
/* */
int (*send_memberinfoshort) (struct map_session_data *sd,int online);
- int (*recv_memberinfoshort) (int guild_id,int account_id,int char_id,int online,int lv,int class_);
+ int (*recv_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int16 class);
int (*change_memberposition) (int guild_id,int account_id,int char_id,short idx);
int (*memberposition_changed) (struct guild *g,int idx,int pos);
int (*change_position) (int guild_id,int idx,int mode,int exp_mode,const char *name);
diff --git a/src/map/intif.c b/src/map/intif.c
index 55a5f8340..10a9ea8a9 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -693,7 +693,7 @@ int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const cha
}
//Update request / Lv online status of the guild members
-int intif_guild_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
+int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int16 class)
{
if (intif->CheckForCharServer())
return 0;
@@ -704,7 +704,7 @@ int intif_guild_memberinfoshort(int guild_id,int account_id,int char_id,int onli
WFIFOL(inter_fd,10) = char_id;
WFIFOB(inter_fd,14) = online;
WFIFOW(inter_fd,15) = lv;
- WFIFOW(inter_fd,17) = class_;
+ WFIFOW(inter_fd,17) = class;
WFIFOSET(inter_fd,19);
return 0;
}
@@ -1359,7 +1359,7 @@ void intif_parse_GuildMemberInfoChanged(int fd) {
case GMI_HAIR: g->member[idx].hair = RFIFOW(fd,18); break;
case GMI_HAIR_COLOR: g->member[idx].hair_color = RFIFOW(fd,18); break;
case GMI_GENDER: g->member[idx].gender = RFIFOW(fd,18); break;
- case GMI_CLASS: g->member[idx].class_ = RFIFOW(fd,18); break;
+ case GMI_CLASS: g->member[idx].class = RFIFOW(fd,18); break;
case GMI_LEVEL: g->member[idx].lv = RFIFOW(fd,18); break;
}
}
diff --git a/src/map/intif.h b/src/map/intif.h
index c4d960256..b20acf029 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -81,7 +81,7 @@ struct intif_interface {
int (*guild_request_info) (int guild_id);
int (*guild_addmember) (int guild_id, struct guild_member *m);
int (*guild_leave) (int guild_id, int account_id, int char_id, int flag, const char *mes);
- int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_);
+ int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int16 class);
int (*guild_break) (int guild_id);
int (*guild_message) (int guild_id, int account_id, const char *mes, int len);
int (*guild_change_gm) (int guild_id, const char *name, int len);
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 58397a2ee..445307aeb 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -352,14 +352,14 @@ const char* itemdb_typename(int type)
*
* @author Dastgir
*/
-void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable)
+void itemdb_jobid2mapid(uint64 *bclass, int job_class, bool enable)
{
uint64 mask[3] = { 0 };
int i;
nullpo_retv(bclass);
- switch(job_id) {
+ switch (job_class) {
// Base Classes
case JOB_NOVICE:
case JOB_SUPER_NOVICE:
@@ -367,12 +367,22 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable)
mask[1] = 1ULL << MAPID_NOVICE;
break;
case JOB_SWORDMAN:
+ mask[0] = 1ULL << MAPID_SWORDMAN;
+ break;
case JOB_MAGE:
+ mask[0] = 1ULL << MAPID_MAGE;
+ break;
case JOB_ARCHER:
+ mask[0] = 1ULL << MAPID_ARCHER;
+ break;
case JOB_ACOLYTE:
+ mask[0] = 1ULL << MAPID_ACOLYTE;
+ break;
case JOB_MERCHANT:
+ mask[0] = 1ULL << MAPID_MERCHANT;
+ break;
case JOB_THIEF:
- mask[0] = 1ULL << (MAPID_NOVICE+job_id);
+ mask[0] = 1ULL << MAPID_THIEF;
break;
// 2-1 Classes
case JOB_KNIGHT:
@@ -471,7 +481,6 @@ void itemdb_jobid2mapid(uint64 *bclass, int job_id, bool enable)
*/
void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask)
{
- int i;
nullpo_retv(bclass);
bclass[0] = bclass[1] = bclass[2] = 0;
//Base classes
@@ -480,10 +489,18 @@ void itemdb_jobmask2mapid(uint64 *bclass, uint64 jobmask)
bclass[0] |= 1ULL<<MAPID_NOVICE;
bclass[1] |= 1ULL<<MAPID_NOVICE;
}
- for (i = JOB_NOVICE+1; i <= JOB_THIEF; i++) {
- if (jobmask & 1ULL<<i)
- bclass[0] |= 1ULL<<(MAPID_NOVICE+i);
- }
+ if (jobmask & 1ULL<<JOB_SWORDMAN)
+ bclass[0] |= 1ULL<<MAPID_SWORDMAN;
+ if (jobmask & 1ULL<<JOB_MAGE)
+ bclass[0] |= 1ULL<<MAPID_MAGE;
+ if (jobmask & 1ULL<<JOB_ARCHER)
+ bclass[0] |= 1ULL<<MAPID_ARCHER;
+ if (jobmask & 1ULL<<JOB_ACOLYTE)
+ bclass[0] |= 1ULL<<MAPID_ACOLYTE;
+ if (jobmask & 1ULL<<JOB_MERCHANT)
+ bclass[0] |= 1ULL<<MAPID_MERCHANT;
+ if (jobmask & 1ULL<<JOB_THIEF)
+ bclass[0] |= 1ULL<<MAPID_THIEF;
//2-1 classes
if (jobmask & 1ULL<<JOB_KNIGHT)
bclass[1] |= 1ULL<<MAPID_SWORDMAN;
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 77e702638..571512e49 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -619,7 +619,7 @@ struct itemdb_interface {
int (*searchrandomid) (struct item_group *group);
const char* (*typename) (int type);
void (*jobmask2mapid) (uint64 *bclass, uint64 jobmask);
- void (*jobid2mapid) (uint64 *bclass, int job_id, bool enable);
+ void (*jobid2mapid) (uint64 *bclass, int job_class, bool enable);
void (*create_dummy_data) (void);
struct item_data* (*create_item_data) (int nameid);
int (*isequip) (int nameid);
diff --git a/src/map/mob.c b/src/map/mob.c
index 0aadd989d..9bfa81857 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -3491,8 +3491,8 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
//Go Backwards to give better priority to advanced skills.
for (i=0,j = MAX_SKILL_TREE-1;j>=0 && i< MAX_MOBSKILL ;j--) {
- int idx = pc->skill_tree[pc->class2idx(sd->status.class_)][j].idx;
- int skill_id = pc->skill_tree[pc->class2idx(sd->status.class_)][j].id;
+ int idx = pc->skill_tree[pc->class2idx(sd->status.class)][j].idx;
+ int skill_id = pc->skill_tree[pc->class2idx(sd->status.class)][j].id;
if (!skill_id || sd->status.skill[idx].lv < 1 ||
(skill->dbs->db[idx].inf2&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL))
)
diff --git a/src/map/party.c b/src/map/party.c
index 1c505bacc..6489242fe 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -64,7 +64,7 @@ void party_fill_member(struct party_member* member, struct map_session_data* sd,
member->account_id = sd->status.account_id;
member->char_id = sd->status.char_id;
safestrncpy(member->name, sd->status.name, NAME_LENGTH);
- member->class_ = sd->status.class_;
+ member->class = sd->status.class;
member->map = sd->mapindex;
member->lv = sd->status.base_level;
member->online = 1;
@@ -238,12 +238,13 @@ void party_check_state(struct party_data *p) {
memset(&p->state, 0, sizeof(p->state));
for (i = 0; i < MAX_PARTY; i++) {
if (!p->party.member[i].online) continue; //Those not online shouldn't apart to skill usage and all that.
- switch (p->party.member[i].class_) {
+ switch (p->party.member[i].class) {
case JOB_MONK:
case JOB_BABY_MONK:
case JOB_CHAMPION:
case JOB_SURA:
case JOB_SURA_T:
+ case JOB_BABY_SURA:
p->state.monk = 1;
break;
case JOB_STAR_GLADIATOR:
diff --git a/src/map/pc.c b/src/map/pc.c
index 674eeb90f..6f260f776 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -80,12 +80,13 @@ struct pc_interface *pc;
//Converts a class to its array index for CLASS_COUNT defined arrays.
//Note that it does not do a validity check for speed purposes, where parsing
//player input make sure to use a pc->db_checkid first!
-int pc_class2idx(int class_) {
- if (class_ >= JOB_NOVICE_HIGH) {
- class_ += - JOB_NOVICE_HIGH + JOB_MAX_BASIC;
+int pc_class2idx(int class)
+{
+ if (class >= JOB_NOVICE_HIGH) {
+ class += - JOB_NOVICE_HIGH + JOB_MAX_BASIC;
}
- Assert_ret(class_ >= 0 && class_ < CLASS_COUNT);
- return class_;
+ Assert_ret(class >= 0 && class < CLASS_COUNT);
+ return class;
}
/**
@@ -887,7 +888,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd
return false;
}
- if( !( ( b_sd->status.class_ >= JOB_NOVICE && b_sd->status.class_ <= JOB_THIEF ) || b_sd->status.class_ == JOB_SUPER_NOVICE ) )
+ if (!(b_sd->status.class >= JOB_NOVICE && b_sd->status.class <= JOB_THIEF) && b_sd->status.class != JOB_SUPER_NOVICE)
return false;
return true;
@@ -898,7 +899,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd
*------------------------------------------*/
bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd)
{
- int job, joblevel;
+ int class, joblevel;
unsigned int jobexp;
if( !pc->can_Adopt(p1_sd, p2_sd, b_sd) )
@@ -909,9 +910,9 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
joblevel = b_sd->status.job_level;
jobexp = b_sd->status.job_exp;
- job = pc->mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex);
- if( job != -1 && !pc->jobchange(b_sd, job, 0) )
- { // Success, proceed to configure parents and baby skills
+ class = pc->mapid2jobid(b_sd->job | JOBL_BABY, b_sd->status.sex);
+ if (class != -1 && !pc->jobchange(b_sd, class, 0)) {
+ // Success, proceed to configure parents and baby skills
p1_sd->status.child = b_sd->status.char_id;
p2_sd->status.child = b_sd->status.char_id;
b_sd->status.father = p1_sd->status.char_id;
@@ -972,12 +973,11 @@ int pc_isequip(struct map_session_data *sd,int n)
return 0;
if ( item->equip & EQP_AMMO ) {
- if ( (sd->state.active && !pc_iscarton(sd)) // check if sc data is already loaded.
- && (sd->status.class_ == JOB_GENETIC_T || sd->status.class_ == JOB_GENETIC) ) {
+ if (sd->state.active && !pc_iscarton(sd) && (sd->class_ & MAPID_THIRDMASK) == MAPID_GENETIC) { // check if sc data is already loaded.
clif->msgtable(sd, MSG_ITEM_NEED_CART);
return 0;
}
- if ( !pc_ismadogear(sd) && (sd->status.class_ == JOB_MECHANIC_T || sd->status.class_ == JOB_MECHANIC) ) {
+ if (!pc_ismadogear(sd) && (sd->class_ & MAPID_THIRDMASK) == MAPID_MECHANIC) {
clif->msgtable(sd, MSG_ITEM_NEED_MADO);
return 0;
}
@@ -1075,13 +1075,16 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
}
//Set the map-server used job id. [Skotlex]
- i = pc->jobid2mapid(sd->status.class_);
- if (i == -1) { //Invalid class?
- ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id);
- sd->status.class_ = JOB_NOVICE;
- sd->class_ = MAPID_NOVICE;
- } else
- sd->class_ = i;
+ {
+ int job = pc->jobid2mapid(sd->status.class);
+ if (job == -1) {
+ ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class, sd->status.name, sd->status.account_id, sd->status.char_id);
+ sd->status.class = JOB_NOVICE;
+ sd->class_ = MAPID_NOVICE;
+ } else {
+ sd->class_ = job;
+ }
+ }
// Checks and fixes to character status data, that are required
// in case of configuration change or stuff, which cannot be
@@ -1162,7 +1165,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->sc.option = sd->status.option; //This is the actual option used in battle.
//Set here because we need the inventory data for weapon sprite parsing.
- status->set_viewdata(&sd->bl, sd->status.class_);
+ status->set_viewdata(&sd->bl, sd->status.class);
unit->dataset(&sd->bl);
sd->guild_x = -1;
@@ -1635,7 +1638,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
sd->status.skill[idx].flag = SKILL_FLAG_REPLACED_LV_0 + sd->status.skill[idx].lv; // Remember original level
}
- sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_);
+ sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class);
}
}
@@ -1841,34 +1844,36 @@ int pc_updateweightstatus(struct map_session_data *sd)
return 0;
}
-int pc_disguise(struct map_session_data *sd, int class_) {
+int pc_disguise(struct map_session_data *sd, int class)
+{
nullpo_ret(sd);
- if (class_ == -1 && sd->disguise == -1)
+ if (class == -1 && sd->disguise == -1)
return 0;
- if (class_ >= 0 && sd->disguise == class_)
+ if (class >= 0 && sd->disguise == class)
return 0;
if (pc_isinvisible(sd)) { //Character is invisible. Stealth class-change. [Skotlex]
- sd->disguise = class_; //viewdata is set on uncloaking.
+ sd->disguise = class; //viewdata is set on uncloaking.
return 2;
}
if (sd->bl.prev != NULL) {
- if( class_ == -1 && sd->disguise == sd->status.class_ ) {
+ if (class == -1 && sd->disguise == sd->status.class) {
clif->clearunit_single(-sd->bl.id,CLR_OUTSIGHT,sd->fd);
- } else if ( class_ != sd->status.class_ ) {
+ } else if (class != sd->status.class) {
pc_stop_walking(sd, STOPWALKING_FLAG_NONE);
clif->clearunit_area(&sd->bl, CLR_OUTSIGHT);
}
}
- if (class_ == -1) {
+ if (class == -1) {
sd->disguise = -1;
- class_ = sd->status.class_;
- } else
- sd->disguise = class_;
+ class = sd->status.class;
+ } else {
+ sd->disguise = class;
+ }
- status->set_viewdata(&sd->bl, class_);
+ status->set_viewdata(&sd->bl, class);
clif->changeoption(&sd->bl);
// We need to update the client so it knows that a costume is being used
if( sd->sc.option&OPTION_COSTUME ) {
@@ -1880,7 +1885,7 @@ int pc_disguise(struct map_session_data *sd, int class_) {
if (sd->bl.prev != NULL) {
clif->spawn(&sd->bl);
- if (class_ == sd->status.class_ && pc_iscarton(sd)) {
+ if (class == sd->status.class && pc_iscarton(sd)) {
//It seems the cart info is lost on undisguise.
clif->cartlist(sd);
clif->updatestatus(sd,SP_CARTINFO);
@@ -5863,10 +5868,9 @@ int pc_checkequip(struct map_session_data *sd,int pos)
* Convert's from the client's lame Job ID system
* to the map server's 'makes sense' system. [Skotlex]
*------------------------------------------*/
-int pc_jobid2mapid(unsigned short b_class)
+int pc_jobid2mapid(int16 class)
{
- switch(b_class)
- {
+ switch (class) {
//Novice And 1-1 Jobs
case JOB_NOVICE: return MAPID_NOVICE;
case JOB_SWORDMAN: return MAPID_SWORDMAN;
@@ -6144,9 +6148,9 @@ int pc_mapid2jobid(unsigned short class_, int sex)
/*====================================================
* This function return the name of the job (by [Yor])
*----------------------------------------------------*/
-const char* job_name(int class_)
+const char *job_name(int class)
{
- switch (class_) {
+ switch (class) {
case JOB_NOVICE: // 550
case JOB_SWORDMAN: // 551
case JOB_MAGE: // 552
@@ -6154,7 +6158,7 @@ const char* job_name(int class_)
case JOB_ACOLYTE: // 554
case JOB_MERCHANT: // 555
case JOB_THIEF: // 556
- return msg_txt(550 - JOB_NOVICE+class_);
+ return msg_txt(550 - JOB_NOVICE + class);
case JOB_KNIGHT: // 557
case JOB_PRIEST: // 558
@@ -6162,7 +6166,7 @@ const char* job_name(int class_)
case JOB_BLACKSMITH: // 560
case JOB_HUNTER: // 561
case JOB_ASSASSIN: // 562
- return msg_txt(557 - JOB_KNIGHT+class_);
+ return msg_txt(557 - JOB_KNIGHT + class);
case JOB_KNIGHT2:
return msg_txt(557);
@@ -6174,7 +6178,7 @@ const char* job_name(int class_)
case JOB_ALCHEMIST: // 567
case JOB_BARD: // 568
case JOB_DANCER: // 569
- return msg_txt(563 - JOB_CRUSADER+class_);
+ return msg_txt(563 - JOB_CRUSADER + class);
case JOB_CRUSADER2:
return msg_txt(563);
@@ -6184,7 +6188,7 @@ const char* job_name(int class_)
case JOB_GUNSLINGER: // 572
case JOB_NINJA: // 573
case JOB_XMAS: // 574
- return msg_txt(570 - JOB_WEDDING+class_);
+ return msg_txt(570 - JOB_WEDDING + class);
case JOB_SUMMER:
return msg_txt(621);
@@ -6196,7 +6200,7 @@ const char* job_name(int class_)
case JOB_ACOLYTE_HIGH: // 579
case JOB_MERCHANT_HIGH: // 580
case JOB_THIEF_HIGH: // 581
- return msg_txt(575 - JOB_NOVICE_HIGH+class_);
+ return msg_txt(575 - JOB_NOVICE_HIGH + class);
case JOB_LORD_KNIGHT: // 582
case JOB_HIGH_PRIEST: // 583
@@ -6204,7 +6208,7 @@ const char* job_name(int class_)
case JOB_WHITESMITH: // 585
case JOB_SNIPER: // 586
case JOB_ASSASSIN_CROSS: // 587
- return msg_txt(582 - JOB_LORD_KNIGHT+class_);
+ return msg_txt(582 - JOB_LORD_KNIGHT + class);
case JOB_LORD_KNIGHT2:
return msg_txt(582);
@@ -6216,7 +6220,7 @@ const char* job_name(int class_)
case JOB_CREATOR: // 592
case JOB_CLOWN: // 593
case JOB_GYPSY: // 594
- return msg_txt(588 - JOB_PALADIN + class_);
+ return msg_txt(588 - JOB_PALADIN + class);
case JOB_PALADIN2:
return msg_txt(588);
@@ -6228,7 +6232,7 @@ const char* job_name(int class_)
case JOB_BABY_ACOLYTE: // 599
case JOB_BABY_MERCHANT: // 600
case JOB_BABY_THIEF: // 601
- return msg_txt(595 - JOB_BABY + class_);
+ return msg_txt(595 - JOB_BABY + class);
case JOB_BABY_KNIGHT: // 602
case JOB_BABY_PRIEST: // 603
@@ -6236,7 +6240,7 @@ const char* job_name(int class_)
case JOB_BABY_BLACKSMITH: // 605
case JOB_BABY_HUNTER: // 606
case JOB_BABY_ASSASSIN: // 607
- return msg_txt(602 - JOB_BABY_KNIGHT + class_);
+ return msg_txt(602 - JOB_BABY_KNIGHT + class);
case JOB_BABY_KNIGHT2:
return msg_txt(602);
@@ -6248,7 +6252,7 @@ const char* job_name(int class_)
case JOB_BABY_ALCHEMIST: // 612
case JOB_BABY_BARD: // 613
case JOB_BABY_DANCER: // 614
- return msg_txt(608 - JOB_BABY_CRUSADER + class_);
+ return msg_txt(608 - JOB_BABY_CRUSADER + class);
case JOB_BABY_CRUSADER2:
return msg_txt(608);
@@ -6267,7 +6271,7 @@ const char* job_name(int class_)
case JOB_GANGSI: // 622
case JOB_DEATH_KNIGHT: // 623
case JOB_DARK_COLLECTOR: // 624
- return msg_txt(622 - JOB_GANGSI+class_);
+ return msg_txt(622 - JOB_GANGSI + class);
case JOB_RUNE_KNIGHT: // 625
case JOB_WARLOCK: // 626
@@ -6275,7 +6279,7 @@ const char* job_name(int class_)
case JOB_ARCH_BISHOP: // 628
case JOB_MECHANIC: // 629
case JOB_GUILLOTINE_CROSS: // 630
- return msg_txt(625 - JOB_RUNE_KNIGHT+class_);
+ return msg_txt(625 - JOB_RUNE_KNIGHT + class);
case JOB_RUNE_KNIGHT_T: // 656
case JOB_WARLOCK_T: // 657
@@ -6283,7 +6287,7 @@ const char* job_name(int class_)
case JOB_ARCH_BISHOP_T: // 659
case JOB_MECHANIC_T: // 660
case JOB_GUILLOTINE_CROSS_T: // 661
- return msg_txt(656 - JOB_RUNE_KNIGHT_T+class_);
+ return msg_txt(656 - JOB_RUNE_KNIGHT_T + class);
case JOB_ROYAL_GUARD: // 631
case JOB_SORCERER: // 632
@@ -6292,7 +6296,7 @@ const char* job_name(int class_)
case JOB_SURA: // 635
case JOB_GENETIC: // 636
case JOB_SHADOW_CHASER: // 637
- return msg_txt(631 - JOB_ROYAL_GUARD+class_);
+ return msg_txt(631 - JOB_ROYAL_GUARD + class);
case JOB_ROYAL_GUARD_T: // 662
case JOB_SORCERER_T: // 663
@@ -6301,7 +6305,7 @@ const char* job_name(int class_)
case JOB_SURA_T: // 666
case JOB_GENETIC_T: // 667
case JOB_SHADOW_CHASER_T: // 668
- return msg_txt(662 - JOB_ROYAL_GUARD_T+class_);
+ return msg_txt(662 - JOB_ROYAL_GUARD_T + class);
case JOB_RUNE_KNIGHT2:
return msg_txt(625);
@@ -6340,7 +6344,7 @@ const char* job_name(int class_)
case JOB_BABY_SURA: // 648
case JOB_BABY_GENETIC: // 649
case JOB_BABY_CHASER: // 650
- return msg_txt(638 - JOB_BABY_RUNE+class_);
+ return msg_txt(638 - JOB_BABY_RUNE + class);
case JOB_BABY_RUNE2:
return msg_txt(638);
@@ -6356,11 +6360,11 @@ const char* job_name(int class_)
case JOB_SUPER_NOVICE_E: // 651
case JOB_SUPER_BABY_E: // 652
- return msg_txt(651 - JOB_SUPER_NOVICE_E+class_);
+ return msg_txt(651 - JOB_SUPER_NOVICE_E + class);
case JOB_KAGEROU: // 653
case JOB_OBORO: // 654
- return msg_txt(653 - JOB_KAGEROU+class_);
+ return msg_txt(653 - JOB_KAGEROU + class);
case JOB_REBELLION:
return msg_txt(655);
@@ -6837,12 +6841,12 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in
*------------------------------------------*/
int pc_maxbaselv(const struct map_session_data *sd)
{
- return pc->max_level[pc->class2idx(sd->status.class_)][0];
+ return pc->max_level[pc->class2idx(sd->status.class)][0];
}
int pc_maxjoblv(const struct map_session_data *sd)
{
- return pc->max_level[pc->class2idx(sd->status.class_)][1];
+ return pc->max_level[pc->class2idx(sd->status.class)][1];
}
/*==========================================
@@ -6857,7 +6861,7 @@ unsigned int pc_nextbaseexp(const struct map_session_data *sd)
if (sd->status.base_level >= pc->maxbaselv(sd) || sd->status.base_level <= 0)
return 0;
- return pc->exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-1];
+ return pc->exp_table[pc->class2idx(sd->status.class)][0][sd->status.base_level-1];
}
//Base exp needed for this level.
@@ -6866,7 +6870,7 @@ unsigned int pc_thisbaseexp(const struct map_session_data *sd)
if (sd->status.base_level > pc->maxbaselv(sd) || sd->status.base_level <= 1)
return 0;
- return pc->exp_table[pc->class2idx(sd->status.class_)][0][sd->status.base_level-2];
+ return pc->exp_table[pc->class2idx(sd->status.class)][0][sd->status.base_level-2];
}
/*==========================================
@@ -6883,7 +6887,7 @@ unsigned int pc_nextjobexp(const struct map_session_data *sd)
if (sd->status.job_level >= pc->maxjoblv(sd) || sd->status.job_level <= 0)
return 0;
- return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-1];
+ return pc->exp_table[pc->class2idx(sd->status.class)][1][sd->status.job_level-1];
}
//Job exp needed for this level.
@@ -6891,7 +6895,7 @@ unsigned int pc_thisjobexp(const struct map_session_data *sd)
{
if (sd->status.job_level > pc->maxjoblv(sd) || sd->status.job_level <= 1)
return 0;
- return pc->exp_table[pc->class2idx(sd->status.class_)][1][sd->status.job_level-2];
+ return pc->exp_table[pc->class2idx(sd->status.class)][1][sd->status.job_level-2];
}
/// Returns the value of the specified stat.
@@ -7122,7 +7126,7 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
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]
- sd->status.skill[index].lv < skill->tree_get_max(skill_id, sd->status.class_) )
+ sd->status.skill[index].lv < skill->tree_get_max(skill_id, sd->status.class) )
{
sd->status.skill[index].lv++;
sd->status.skill_point--;
@@ -7184,8 +7188,8 @@ int pc_allskillup(struct map_session_data *sd)
}
} else {
int id;
- for (i = 0; i < MAX_SKILL_TREE && (id=pc->skill_tree[pc->class2idx(sd->status.class_)][i].id) > 0; i++) {
- int idx = pc->skill_tree[pc->class2idx(sd->status.class_)][i].idx;
+ for (i = 0; i < MAX_SKILL_TREE && (id=pc->skill_tree[pc->class2idx(sd->status.class)][i].id) > 0; i++) {
+ int idx = pc->skill_tree[pc->class2idx(sd->status.class)][i].idx;
int inf2 = skill->dbs->db[idx].inf2;
if (
(inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) ||
@@ -7195,7 +7199,7 @@ int pc_allskillup(struct map_session_data *sd)
continue; //Cannot be learned normally.
sd->status.skill[idx].id = id;
- sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class_); // celest
+ sd->status.skill[idx].lv = skill->tree_get_max(id, sd->status.class); // celest
}
}
status_calc_pc(sd,SCO_NONE);
@@ -7232,7 +7236,7 @@ int pc_resetlvl(struct map_session_data* sd,int type)
sd->status.int_=1;
sd->status.dex=1;
sd->status.luk=1;
- if(sd->status.class_ == JOB_NOVICE_HIGH) {
+ if (sd->status.class == JOB_NOVICE_HIGH) {
sd->status.status_point=100; // not 88 [celest]
// give platinum skills upon changing
pc->skill(sd, NV_FIRSTAID, 1, SKILL_GRANT_PERMANENT);
@@ -8012,7 +8016,7 @@ int pc_readparam(const struct map_session_data *sd, int type)
case SP_ZENY: val = sd->status.zeny; break;
case SP_BASELEVEL: val = sd->status.base_level; break;
case SP_JOBLEVEL: val = sd->status.job_level; break;
- case SP_CLASS: val = sd->status.class_; break;
+ case SP_CLASS: val = sd->status.class; break;
case SP_BASEJOB: val = pc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type.
case SP_UPPER: val = (sd->class_&JOBL_UPPER) ? 1 : ((sd->class_&JOBL_BABY) ? 2 : 0); break;
case SP_BASECLASS: val = pc->mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex]
@@ -8473,44 +8477,43 @@ int jobchange_killclone(struct block_list *bl, va_list ap)
* Called when player changes job
* Rewrote to make it tidider [Celest]
*------------------------------------------*/
-int pc_jobchange(struct map_session_data *sd,int job, int upper)
+int pc_jobchange(struct map_session_data *sd, int class, int upper)
{
int i, fame_flag=0;
- int b_class, idx = 0;
+ int job, idx = 0;
nullpo_ret(sd);
- if (job < 0)
+ if (class < 0)
return 1;
//Normalize job.
- b_class = pc->jobid2mapid(job);
- if (b_class == -1)
+ job = pc->jobid2mapid(class);
+ if (job == -1)
return 1;
switch (upper) {
case 1:
- b_class|= JOBL_UPPER;
+ job |= JOBL_UPPER;
break;
case 2:
- b_class|= JOBL_BABY;
+ job |= JOBL_BABY;
break;
}
//This will automatically adjust bard/dancer classes to the correct gender
//That is, if you try to jobchange into dancer, it will turn you to bard.
- job = pc->mapid2jobid(b_class, sd->status.sex);
- if (job == -1)
+ class = pc->mapid2jobid(job, sd->status.sex);
+ if (class == -1)
return 1;
- if ((unsigned short)b_class == sd->class_)
+ if ((uint16)job == sd->class_)
return 1; //Nothing to change.
- // changing from 1st to 2nd job
- if ((b_class&JOBL_2) && !(sd->class_&JOBL_2) && (b_class&MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) {
+ if ((job & JOBL_2) != 0 && (sd->class_ & JOBL_2) == 0 && (job & MAPID_UPPERMASK) != MAPID_SUPER_NOVICE) {
+ // changing from 1st to 2nd job
sd->change_level_2nd = sd->status.job_level;
pc_setglobalreg(sd, script->add_str("jobchange_level"), sd->change_level_2nd);
- }
- // changing from 2nd to 3rd job
- else if((b_class&JOBL_THIRD) && !(sd->class_&JOBL_THIRD)) {
+ } else if((job & JOBL_THIRD) != 0 && (sd->class_ & JOBL_THIRD) == 0) {
+ // changing from 2nd to 3rd job
sd->change_level_3rd = sd->status.job_level;
pc_setglobalreg(sd, script->add_str("jobchange_level_3rd"), sd->change_level_3rd);
}
@@ -8541,10 +8544,10 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
pc_setglobalreg(sd, script->add_str("REPRODUCE_SKILL_LV"),0);
}
- if ( (b_class&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK) ) { //Things to remove when changing class tree.
- const int class_ = pc->class2idx(sd->status.class_);
+ if ((job & MAPID_UPPERMASK) != (sd->class_ & MAPID_UPPERMASK)) { //Things to remove when changing class tree.
+ const int class_idx = pc->class2idx(sd->status.class);
short id;
- for(i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[class_][i].id) > 0; i++) {
+ for (i = 0; i < MAX_SKILL_TREE && (id = pc->skill_tree[class_idx][i].id) > 0; i++) {
//Remove status specific to your current tree skills.
enum sc_type sc = status->skill2sc(id);
if (sc > SC_COMMON_MAX && sd->sc.data[sc])
@@ -8552,14 +8555,14 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
}
}
- if( (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (b_class&MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) {
+ if ((sd->class_ & MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (job & MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) {
/* going off star glad lineage, reset feel to not store no-longer-used vars in the database */
pc->resetfeel(sd);
}
- sd->status.class_ = job;
- fame_flag = pc->famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK);
- sd->class_ = (unsigned short)b_class;
+ sd->status.class = class;
+ fame_flag = pc->famerank(sd->status.char_id, sd->class_);
+ sd->class_ = (uint16)job;
sd->status.job_level=1;
sd->status.job_exp=0;
@@ -8588,7 +8591,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if (sd->disguise != -1)
pc->disguise(sd, -1);
- status->set_viewdata(&sd->bl, job);
+ status->set_viewdata(&sd->bl, class);
clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris]
if(sd->vd.cloth_color)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
@@ -8835,7 +8838,7 @@ int pc_setoption(struct map_session_data *sd,int type)
return 0; //Disguises break sprite changes
if (new_look < 0) { //Restore normal look.
- status->set_viewdata(&sd->bl, sd->status.class_);
+ status->set_viewdata(&sd->bl, sd->status.class);
new_look = sd->vd.class_;
}
@@ -11654,16 +11657,16 @@ void pc_update_idle_time(struct map_session_data* sd, enum e_battle_config_idlet
//Checks if the given class value corresponds to a player class. [Skotlex]
//JOB_NOVICE isn't checked for class_ is supposed to be unsigned
-bool pc_db_checkid(unsigned int class_)
-{
- return class_ < JOB_MAX_BASIC
- || (class_ >= JOB_NOVICE_HIGH && class_ <= JOB_DARK_COLLECTOR )
- || (class_ >= JOB_RUNE_KNIGHT && class_ <= JOB_MECHANIC_T2 )
- || (class_ >= JOB_BABY_RUNE && class_ <= JOB_BABY_MECHANIC2 )
- || (class_ >= JOB_SUPER_NOVICE_E && class_ <= JOB_SUPER_BABY_E )
- || (class_ >= JOB_KAGEROU && class_ <= JOB_OBORO )
- || (class_ == JOB_REBELLION)
- || (class_ >= JOB_SUMMONER && class_ < JOB_MAX );
+bool pc_db_checkid(int class)
+{
+ return class < JOB_MAX_BASIC
+ || (class >= JOB_NOVICE_HIGH && class <= JOB_DARK_COLLECTOR )
+ || (class >= JOB_RUNE_KNIGHT && class <= JOB_MECHANIC_T2 )
+ || (class >= JOB_BABY_RUNE && class <= JOB_BABY_MECHANIC2 )
+ || (class >= JOB_SUPER_NOVICE_E && class <= JOB_SUPER_BABY_E )
+ || (class >= JOB_KAGEROU && class <= JOB_OBORO )
+ || (class == JOB_REBELLION)
+ || (class >= JOB_SUMMONER && class < JOB_MAX );
}
/**
diff --git a/src/map/pc.h b/src/map/pc.h
index 5d1404b2a..c68be7b97 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -824,7 +824,7 @@ END_ZEROED_BLOCK; /* End */
void (*final) (void);
struct map_session_data* (*get_dummy_sd) (void);
- int (*class2idx) (int class_);
+ int (*class2idx) (int class);
bool (*can_talk) (struct map_session_data *sd);
bool (*can_attack) ( struct map_session_data *sd, int target_id );
@@ -948,7 +948,7 @@ END_ZEROED_BLOCK; /* End */
void (*heal) (struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
int (*itemheal) (struct map_session_data *sd,int itemid, int hp,int sp);
int (*percentheal) (struct map_session_data *sd,int hp,int sp);
- int (*jobchange) (struct map_session_data *sd,int job, int upper);
+ int (*jobchange) (struct map_session_data *sd, int class, int upper);
int (*setoption) (struct map_session_data *sd,int type);
int (*setcart) (struct map_session_data* sd, int type);
void (*setfalcon) (struct map_session_data *sd, bool flag);
@@ -992,10 +992,10 @@ END_ZEROED_BLOCK; /* End */
void (*setstand) (struct map_session_data *sd);
int (*candrop) (struct map_session_data *sd,struct item *item);
- int (*jobid2mapid) (unsigned short b_class); // Skotlex
+ int (*jobid2mapid) (int16 class); // Skotlex
int (*mapid2jobid) (unsigned short class_, int sex); // Skotlex
- const char * (*job_name) (int class_);
+ const char * (*job_name) (int class);
void (*setinvincibletimer) (struct map_session_data* sd, int val);
void (*delinvincibletimer) (struct map_session_data* sd);
@@ -1015,7 +1015,7 @@ END_ZEROED_BLOCK; /* End */
int (*inventory_rental_clear) (struct map_session_data *sd);
void (*inventory_rental_add) (struct map_session_data *sd, int seconds);
- int (*disguise) (struct map_session_data *sd, int class_);
+ int (*disguise) (struct map_session_data *sd, int class);
bool (*isautolooting) (struct map_session_data *sd, int nameid);
void (*overheat) (struct map_session_data *sd, int val);
@@ -1074,7 +1074,7 @@ END_ZEROED_BLOCK; /* End */
int (*global_expiration_timer) (int tid, int64 tick, int id, intptr_t data);
void (*expire_check) (struct map_session_data *sd);
- bool (*db_checkid) (unsigned int class_);
+ bool (*db_checkid) (int class);
void (*validate_levels) (void);
diff --git a/src/map/script.c b/src/map/script.c
index 5d9198123..e2f5cf364 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6742,18 +6742,18 @@ BUILDIN(percentheal)
*------------------------------------------*/
BUILDIN(jobchange)
{
- int job, upper=-1;
+ int class, upper=-1;
- job=script_getnum(st,2);
+ class = script_getnum(st,2);
if( script_hasdata(st,3) )
upper=script_getnum(st,3);
- if (pc->db_checkid(job)) {
+ if (pc->db_checkid(class)) {
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- pc->jobchange(sd, job, upper);
+ pc->jobchange(sd, class, upper);
}
return true;
@@ -6764,8 +6764,8 @@ BUILDIN(jobchange)
*------------------------------------------*/
BUILDIN(jobname)
{
- int class_=script_getnum(st,2);
- script_pushconststr(st, pc->job_name(class_));
+ int class = script_getnum(st,2);
+ script_pushconststr(st, pc->job_name(class));
return true;
}
@@ -8561,7 +8561,7 @@ BUILDIN(getpartyleader)
switch (type) {
case 1: script_pushint(st,p->party.member[i].account_id); break;
case 2: script_pushint(st,p->party.member[i].char_id); break;
- case 3: script_pushint(st,p->party.member[i].class_); break;
+ case 3: script_pushint(st,p->party.member[i].class); break;
case 4: script_pushstrcopy(st,mapindex_id2name(p->party.member[i].map)); break;
case 5: script_pushint(st,p->party.member[i].lv); break;
default: script_pushstrcopy(st,p->party.member[i].name); break;
@@ -11767,16 +11767,16 @@ BUILDIN(homunculus_shuffle)
//These two functions bring the eA MAPID_* class functionality to scripts.
BUILDIN(eaclass)
{
- int class_;
+ int class;
if (script_hasdata(st,2)) {
- class_ = script_getnum(st,2);
+ class = script_getnum(st,2);
} else {
struct map_session_data *sd = script->rid2sd(st);
if (sd == NULL)
return true;
- class_ = sd->status.class_;
+ class = sd->status.class;
}
- script_pushint(st,pc->jobid2mapid(class_));
+ script_pushint(st,pc->jobid2mapid(class));
return true;
}
@@ -13841,14 +13841,14 @@ BUILDIN(undisguise)
* @type unused
*------------------------------------------*/
BUILDIN(classchange) {
- int class_,type;
+ int class, type;
struct block_list *bl=map->id2bl(st->oid);
if(bl==NULL) return true;
- class_=script_getnum(st,2);
+ class = script_getnum(st,2);
type=script_getnum(st,3);
- clif->class_change(bl,class_,type);
+ clif->class_change(bl, class, type);
return true;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index b2d788b57..596d6527d 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -219,14 +219,14 @@ int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ) {
#endif
}
-int skill_tree_get_max(uint16 skill_id, int b_class)
+int skill_tree_get_max(uint16 skill_id, int class)
{
int i;
- b_class = pc->class2idx(b_class);
+ int class_idx = pc->class2idx(class);
- ARR_FIND( 0, MAX_SKILL_TREE, i, pc->skill_tree[b_class][i].id == 0 || pc->skill_tree[b_class][i].id == skill_id );
- if( i < MAX_SKILL_TREE && pc->skill_tree[b_class][i].id == skill_id )
- return pc->skill_tree[b_class][i].max;
+ ARR_FIND( 0, MAX_SKILL_TREE, i, pc->skill_tree[class_idx][i].id == 0 || pc->skill_tree[class_idx][i].id == skill_id );
+ if( i < MAX_SKILL_TREE && pc->skill_tree[class_idx][i].id == skill_id )
+ return pc->skill_tree[class_idx][i].max;
else
return skill->get_max(skill_id);
}
@@ -459,13 +459,14 @@ int can_copy (struct map_session_data *sd, uint16 skill_id, struct block_list* b
if (skill->get_inf2(skill_id)&(INF2_NPC_SKILL|INF2_WEDDING_SKILL))
return 0;
- // High-class skills
- if((skill_id >= LK_AURABLADE && skill_id <= ASC_CDP) || (skill_id >= ST_PRESERVE && skill_id <= CR_CULTIVATION))
- {
- if(battle_config.copyskill_restrict == 2)
+ // Transcendent-class skills
+ if((skill_id >= LK_AURABLADE && skill_id <= ASC_CDP) || (skill_id >= ST_PRESERVE && skill_id <= CR_CULTIVATION)) {
+ if (battle_config.copyskill_restrict == 2) {
return 0;
- else if(battle_config.copyskill_restrict)
- return (sd->status.class_ == JOB_STALKER);
+ } else if (battle_config.copyskill_restrict == 1) {
+ if ((sd->class_ & (MAPID_UPPERMASK | JOBL_UPPER)) != MAPID_STALKER)
+ return 0;
+ }
}
//Added so plagarize can't copy agi/bless if you're undead since it damages you
@@ -15649,7 +15650,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
per = status->get_refine_chance(ditem->wlv, (int)item->refine) * 10;
// Aegis leaked formula. [malufett]
- if( sd->status.class_ == JOB_MECHANIC_T )
+ if (sd->status.class == JOB_MECHANIC_T)
per += 100;
else
per += 5 * (sd->status.job_level - 50);
diff --git a/src/map/skill.h b/src/map/skill.h
index 5203c137b..bba440107 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -1970,7 +1970,7 @@ struct skill_interface {
int (*get_unit_layout_type) ( uint16 skill_id ,uint16 skill_lv );
int (*get_unit_range) ( uint16 skill_id, uint16 skill_lv );
int (*get_cooldown) ( uint16 skill_id, uint16 skill_lv );
- int (*tree_get_max) ( uint16 skill_id, int b_class );
+ int (*tree_get_max) (uint16 skill_id, int class);
const char *(*get_name) ( uint16 skill_id );
const char *(*get_desc) ( uint16 skill_id );
/* check */
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++)
{