diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 8 | ||||
-rw-r--r-- | src/map/battle.c | 11 | ||||
-rw-r--r-- | src/map/clif.c | 26 | ||||
-rw-r--r-- | src/map/guild.c | 8 | ||||
-rw-r--r-- | src/map/guild.h | 2 | ||||
-rw-r--r-- | src/map/intif.c | 6 | ||||
-rw-r--r-- | src/map/intif.h | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 33 | ||||
-rw-r--r-- | src/map/itemdb.h | 2 | ||||
-rw-r--r-- | src/map/mob.c | 4 | ||||
-rw-r--r-- | src/map/party.c | 5 | ||||
-rw-r--r-- | src/map/pc.c | 209 | ||||
-rw-r--r-- | src/map/pc.h | 12 | ||||
-rw-r--r-- | src/map/script.c | 28 | ||||
-rw-r--r-- | src/map/skill.c | 25 | ||||
-rw-r--r-- | src/map/skill.h | 2 | ||||
-rw-r--r-- | src/map/status.c | 37 |
17 files changed, 221 insertions, 199 deletions
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++) { |