diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-12-13 17:42:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-12-13 17:42:54 +0300 |
commit | cada1361b6225b4bafcab0f54400b24ce74678f6 (patch) | |
tree | d81d12f018c5c16c349c76f8b3c62d119cf3b0f0 | |
parent | 84e7b04c06143973ca06a165b17e910f6a488bfb (diff) | |
download | evol-hercules-cada1361b6225b4bafcab0f54400b24ce74678f6.tar.gz evol-hercules-cada1361b6225b4bafcab0f54400b24ce74678f6.tar.bz2 evol-hercules-cada1361b6225b4bafcab0f54400b24ce74678f6.tar.xz evol-hercules-cada1361b6225b4bafcab0f54400b24ce74678f6.zip |
Fix plugin after server update.
-rw-r--r-- | src/echar/char.c | 2 | ||||
-rw-r--r-- | src/emap/clif.c | 32 | ||||
-rw-r--r-- | src/emap/pc.c | 57 | ||||
-rw-r--r-- | src/emap/script_buildins.c | 6 | ||||
-rw-r--r-- | src/emap/status.c | 2 |
5 files changed, 52 insertions, 47 deletions
diff --git a/src/echar/char.c b/src/echar/char.c index b3f58e2..91d7356 100644 --- a/src/echar/char.c +++ b/src/echar/char.c @@ -77,7 +77,7 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data **sdP if (sd->version >= 4) { - char_dat.class_ = race; + char_dat.class = race; char_dat.sex = sex; char_dat.clothes_color = look; diff --git a/src/emap/clif.c b/src/emap/clif.c index a62c47f..54df930 100644 --- a/src/emap/clif.c +++ b/src/emap/clif.c @@ -801,13 +801,13 @@ static inline unsigned char clif_bl_type_old(struct block_list *bl) nullpo_retr(0x1, bl); switch (bl->type) { - case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class_))? 0x1:0x0; //PC_TYPE + case BL_PC: return (disguised(bl) && !pc->db_checkid(status->get_viewdata(bl)->class))? 0x1:0x0; //PC_TYPE case BL_ITEM: return 0x2; //ITEM_TYPE case BL_SKILL: return 0x3; //SKILL_TYPE case BL_CHAT: return 0x4; //UNKNOWN_TYPE - case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x5; //NPC_MOB_TYPE - case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x6; //NPC_EVT_TYPE - case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class_)?0x0:0x7; //NPC_PET_TYPE + case BL_MOB: return pc->db_checkid(status->get_viewdata(bl)->class)?0x0:0x5; //NPC_MOB_TYPE + case BL_NPC: return pc->db_checkid(status->get_viewdata(bl)->class)?0x0:0x6; //NPC_EVT_TYPE + case BL_PET: return pc->db_checkid(status->get_viewdata(bl)->class)?0x0:0x7; //NPC_PET_TYPE case BL_HOM: return 0x8; //NPC_HOM_TYPE case BL_MER: return 0x9; //NPC_MERSOL_TYPE case BL_ELEM: return 0xa; //NPC_ELEMENTAL_TYPE @@ -847,13 +847,13 @@ void eclif_set_unit_idle_old(struct block_list* bl, p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS) + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { //The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); @@ -891,7 +891,7 @@ void eclif_set_unit_idle_old(struct block_list* bl, if (disguised(bl)) { - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; clif->send(&p,sizeof(p),bl,SELF); } @@ -920,13 +920,13 @@ void eclif_spawn_unit_old(struct block_list* bl, enum send_target target) p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; p.accessory2 = vd->head_top; p.accessory3 = vd->head_mid; - if (bl->type == BL_NPC && vd->class_ == FLAG_CLASS) + if (bl->type == BL_NPC && vd->class == FLAG_CLASS) { //The hell, why flags work like this? p.accessory = status->get_emblem_id(bl); p.accessory2 = GetWord(g_id, 1); @@ -961,9 +961,9 @@ void eclif_spawn_unit_old(struct block_list* bl, enum send_target target) if (disguised(bl)) { nullpo_retv(sd); - if (sd->status.class_ != sd->disguise) + if (sd->status.class != sd->disguise) clif->send(&p, sizeof(p), bl, target); - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; clif->send(&p, sizeof(p), bl, SELF); } @@ -999,7 +999,7 @@ void eclif_set_unit_walking_old(struct block_list* bl, p.bodyState = (sc) ? sc->opt1 : 0; p.healthState = (sc) ? sc->opt2 : 0; p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0; - p.job = vd->class_; + p.job = vd->class; p.head = vd->hair_style; p.weapon = vd->weapon; p.accessory = vd->head_bottom; @@ -1037,7 +1037,7 @@ void eclif_set_unit_walking_old(struct block_list* bl, if (disguised(bl)) { - p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE + p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE p.GID = -bl->id; clif->send(&p, sizeof(p), bl, SELF); } @@ -1632,7 +1632,7 @@ void eclif_skillinfoblock_pre(struct map_session_data **sdPtr) } safestrncpy(WFIFOP(fd, len + 16), skill->get_name(id), NAME_LENGTH); if (sd->status.skill[i].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd, len + 40) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class_)) ? 1 : 0; + WFIFOB(fd, len + 40) = (sd->status.skill[i].lv < skill->tree_get_max(id, sd->status.class)) ? 1 : 0; else WFIFOB(fd, len + 40) = 0; len += skillSize; @@ -1704,7 +1704,7 @@ void eclif_addskill_pre(struct map_session_data **sdPtr, } safestrncpy(WFIFOP(fd, 20), skill->get_name(id), NAME_LENGTH); if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd, 44) = (skill_lv < skill->tree_get_max(id, sd->status.class_)) ? 1 : 0; + WFIFOB(fd, 44) = (skill_lv < skill->tree_get_max(id, sd->status.class)) ? 1 : 0; else WFIFOB(fd, 44) = 0; WFIFOSET(fd, sz); @@ -1749,7 +1749,7 @@ void eclif_skillinfo_pre(struct map_session_data **sdPtr, WFIFOW(fd, 18) = 0; } if (sd->status.skill[idx].flag == SKILL_FLAG_PERMANENT) - WFIFOB(fd, 20) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class_)) ? 1 : 0; + WFIFOB(fd, 20) = (skill_lv < skill->tree_get_max(skill_id, sd->status.class)) ? 1 : 0; else WFIFOB(fd, 20) = 0; WFIFOSET(fd, sz); diff --git a/src/emap/pc.c b/src/emap/pc.c index 8c372f0..92e6fca 100644 --- a/src/emap/pc.c +++ b/src/emap/pc.c @@ -781,51 +781,51 @@ int epc_dead_post(int retVal, * Rewrote to make it tidider [Celest] *------------------------------------------*/ int epc_jobchange(struct map_session_data *sd, - int job, + int class, int upper __attribute__ ((unused))) { 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->job) 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) && !(sd->job & JOBL_2) && (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->job & 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); } @@ -862,9 +862,9 @@ int epc_jobchange(struct map_session_data *sd, } /* - if ((b_class&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK)) + if ((job & MAPID_UPPERMASK) != (sd->job & MAPID_UPPERMASK)) { //Things to remove when changing class tree. - const int class_ = pc->class2idx(sd->status.class_); + 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++) { @@ -875,16 +875,21 @@ int epc_jobchange(struct map_session_data *sd, } } - if ((sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (b_class&MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) + if ((sd->job & 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; + { + int fame_list_type = pc->famelist_type(sd->job); + if (fame_list_type != RANKTYPE_UNKNOWN) + fame_flag = pc->fame_rank(sd->status.char_id, fame_list_type); + } + sd->job = (uint16)job; + // sd->status.job_level = 1; // sd->status.job_exp = 0; @@ -917,9 +922,9 @@ int epc_jobchange(struct map_session_data *sd, if (sd->disguise != -1) pc->disguise(sd, -1); - status->set_viewdata(&sd->bl, job); - send_changelook2(sd, &sd->bl, sd->bl.id, LOOK_BASE, sd->vd.class_, 0, NULL, 0, AREA); -// clif->changelook(&sd->bl, LOOK_BASE, sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris] + status->set_viewdata(&sd->bl, class); + send_changelook2(sd, &sd->bl, sd->bl.id, LOOK_BASE, sd->vd.class, 0, NULL, 0, AREA); +// 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); if (sd->vd.body_style) @@ -938,7 +943,7 @@ int epc_jobchange(struct map_session_data *sd, //Remove peco/cart/falcon i = sd->sc.option; - if (i & OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT)) + if (i & OPTION_RIDING && (!pc->checkskill(sd, KN_RIDING) || (sd->job & MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT)) i &= ~ OPTION_RIDING; if (i & OPTION_FALCON && !pc->checkskill(sd, HT_FALCON)) i &= ~ OPTION_FALCON; @@ -974,7 +979,7 @@ int epc_jobchange(struct map_session_data *sd, pc->equiplookall(sd); //if you were previously famous, not anymore. - if (fame_flag) + if (fame_flag != 0) { chrif->save(sd, 0); chrif->buildfamelist(); @@ -982,7 +987,7 @@ int epc_jobchange(struct map_session_data *sd, else if (sd->status.fame > 0) { //It may be that now they are famous? - switch (sd->class_&MAPID_UPPERMASK) + switch (sd->job & MAPID_UPPERMASK) { case MAPID_BLACKSMITH: case MAPID_ALCHEMIST: diff --git a/src/emap/script_buildins.c b/src/emap/script_buildins.c index 2a152df..a50caf7 100644 --- a/src/emap/script_buildins.c +++ b/src/emap/script_buildins.c @@ -1245,13 +1245,13 @@ BUILDIN(successRefIndex) switch (sd->inventory_data[n]->wlv) { case 1: - pc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point + pc->addfame(sd, RANKTYPE_BLACKSMITH, 1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point break; case 2: - pc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point + pc->addfame(sd, RANKTYPE_BLACKSMITH, 25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point break; case 3: - pc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point + pc->addfame(sd, RANKTYPE_BLACKSMITH, 1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point break; } } diff --git a/src/emap/status.c b/src/emap/status.c index f6f0a51..29721fc 100644 --- a/src/emap/status.c +++ b/src/emap/status.c @@ -110,7 +110,7 @@ int estatus_calc_pc__post(int retVal, if (!sd->state.permanent_speed) { - const int idx = pc->class2idx(sd->status.class_); + const int idx = pc->class2idx(sd->status.class); sd->base_status.speed = class_move_speed[idx]; } return retVal; |