diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.cpp | 252 | ||||
-rw-r--r-- | src/map/battle.cpp | 13 | ||||
-rw-r--r-- | src/map/chrif.cpp | 28 | ||||
-rw-r--r-- | src/map/clif.cpp | 217 | ||||
-rw-r--r-- | src/map/map.hpp | 2 | ||||
-rw-r--r-- | src/map/map.t.hpp | 11 | ||||
-rw-r--r-- | src/map/mob.cpp | 88 | ||||
-rw-r--r-- | src/map/mob.hpp | 3 | ||||
-rw-r--r-- | src/map/pc.cpp | 541 | ||||
-rw-r--r-- | src/map/pc.hpp | 10 | ||||
-rw-r--r-- | src/map/script.cpp | 4 | ||||
-rw-r--r-- | src/map/skill.cpp | 7 |
12 files changed, 109 insertions, 1067 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index bc19cd8..13685df 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -363,157 +363,6 @@ AtCommandInfo atcommand_info[] = { {AtCommand_Unknown, NULL, 1, NULL} }; -/*==================================================== - * This function return the name of the job (by [Yor]) - *---------------------------------------------------- - */ -static -const char *job_name(int pc_class) -{ - switch (pc_class) - { - case 0: - return "Novice"; - case 1: - return "Swordsman"; - case 2: - return "Mage"; - case 3: - return "Archer"; - case 4: - return "Acolyte"; - case 5: - return "Merchant"; - case 6: - return "Thief"; - case 7: - return "Knight"; - case 8: - return "Priest"; - case 9: - return "Wizard"; - case 10: - return "Blacksmith"; - case 11: - return "Hunter"; - case 12: - return "Assassin"; - case 13: - return "Knight 2"; - case 14: - return "Crusader"; - case 15: - return "Monk"; - case 16: - return "Sage"; - case 17: - return "Rogue"; - case 18: - return "Alchemist"; - case 19: - return "Bard"; - case 20: - return "Dancer"; - case 21: - return "Crusader 2"; - case 22: - return "Wedding"; - case 23: - return "Super Novice"; - case 4001: - return "Novice High"; - case 4002: - return "Swordsman High"; - case 4003: - return "Mage High"; - case 4004: - return "Archer High"; - case 4005: - return "Acolyte High"; - case 4006: - return "Merchant High"; - case 4007: - return "Thief High"; - case 4008: - return "Lord Knight"; - case 4009: - return "High Priest"; - case 4010: - return "High Wizard"; - case 4011: - return "Whitesmith"; - case 4012: - return "Sniper"; - case 4013: - return "Assassin Cross"; - case 4014: - return "Peko Knight"; - case 4015: - return "Paladin"; - case 4016: - return "Champion"; - case 4017: - return "Professor"; - case 4018: - return "Stalker"; - case 4019: - return "Creator"; - case 4020: - return "Clown"; - case 4021: - return "Gypsy"; - case 4022: - return "Peko Paladin"; - case 4023: - return "Baby Novice"; - case 4024: - return "Baby Swordsman"; - case 4025: - return "Baby Mage"; - case 4026: - return "Baby Archer"; - case 4027: - return "Baby Acolyte"; - case 4028: - return "Baby Merchant"; - case 4029: - return "Baby Thief"; - case 4030: - return "Baby Knight"; - case 4031: - return "Baby Priest"; - case 4032: - return "Baby Wizard"; - case 4033: - return "Baby Blacksmith"; - case 4034: - return "Baby Hunter"; - case 4035: - return "Baby Assassin"; - case 4036: - return "Baby Peco Knight"; - case 4037: - return "Baby Crusader"; - case 4038: - return "Baby Monk"; - case 4039: - return "Baby Sage"; - case 4040: - return "Baby Rogue"; - case 4041: - return "Baby Alchemist"; - case 4042: - return "Baby Bard"; - case 4043: - return "Baby Dancer"; - case 4044: - return "Baby Peco Crusader"; - case 4045: - return "Super Baby"; - } - return "Unknown Job"; -} - /*========================================== * get_atcommand_level @コマンドの必要レベルを取得 *------------------------------------------ @@ -1433,7 +1282,7 @@ int atcommand_whogm(const int fd, struct map_session_data *sd, output = STRPRINTF( " BLvl: %d | Job: %s (Lvl: %d)", pl_sd->status.base_level, - job_name(pl_sd->status.pc_class), + "Novice/Human", pl_sd->status.job_level); clif_displaymessage(fd, output); p = party_search(pl_sd->status.party_id); @@ -1602,21 +1451,6 @@ int atcommand_option(const int fd, struct map_session_data *sd, sd->opt1 = param1; sd->opt2 = param2; sd->status.option = param3; - // fix pecopeco display - if (sd->status.pc_class == 13 || sd->status.pc_class == 21 - || sd->status.pc_class == 4014 || sd->status.pc_class == 4022) - { - { // sd have the new value... - if (sd->status.pc_class == 13) - sd->status.pc_class = sd->view_class = 7; - else if (sd->status.pc_class == 21) - sd->status.pc_class = sd->view_class = 14; - else if (sd->status.pc_class == 4014) - sd->status.pc_class = sd->view_class = 4008; - else if (sd->status.pc_class == 4022) - sd->status.pc_class = sd->view_class = 4015; - } - } clif_changeoption(&sd->bl); pc_calcstatus(sd, 0); @@ -1950,6 +1784,8 @@ int atcommand_baselevelup(const int fd, struct map_session_data *sd, * *------------------------------------------ */ +// TODO: merge this with pc_setparam(SP_JOBLEVEL) +// then fix the funny 50 and/or 10 limitation. int atcommand_joblevelup(const int fd, struct map_session_data *sd, const char *, const char *message) { @@ -1962,11 +1798,7 @@ int atcommand_joblevelup(const int fd, struct map_session_data *sd, return -1; } - if (sd->status.pc_class == 0 || sd->status.pc_class == 4001) - up_level -= 40; - else if ((sd->status.pc_class > 4007 && sd->status.pc_class < 4024) - || sd->status.pc_class == 23) - up_level += 20; + up_level -= 40; if (level > 0) { @@ -2205,15 +2037,6 @@ int atcommand_model(const int fd, struct map_session_data *sd, hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR && cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { - //服の色変更 - if (cloth_color != 0 && sd->status.sex == 1 - && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) - { - //服の色未実装職の判定 - clif_displaymessage(fd, "You can't use this command with this class."); - return -1; - } - else { pc_changelook(sd, LOOK_HAIR, hair_style); pc_changelook(sd, LOOK_HAIR_COLOR, hair_color); @@ -2250,13 +2073,6 @@ int atcommand_dye(const int fd, struct map_session_data *sd, if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { - if (cloth_color != 0 && sd->status.sex == 1 - && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) - { - clif_displaymessage(fd, "You can't use this command with this class."); - return -1; - } - else { pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color); clif_displaymessage(fd, "Appearence changed."); @@ -2291,13 +2107,6 @@ int atcommand_hair_style(const int fd, struct map_session_data *sd, if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) { - if (hair_style != 0 && sd->status.sex == 1 - && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) - { - clif_displaymessage(fd, "You can't use this command with this class."); - return -1; - } - else { pc_changelook(sd, LOOK_HAIR, hair_style); clif_displaymessage(fd, "Appearence changed."); @@ -2332,13 +2141,6 @@ int atcommand_hair_color(const int fd, struct map_session_data *sd, if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) { - if (hair_color != 0 && sd->status.sex == 1 - && (sd->status.pc_class == 12 || sd->status.pc_class == 17)) - { - clif_displaymessage(fd, "You can't use this command with this class."); - return -1; - } - else { pc_changelook(sd, LOOK_HAIR_COLOR, hair_color); clif_displaymessage(fd, "Appearence changed."); @@ -2974,8 +2776,7 @@ int atcommand_character_stats(const int fd, struct map_session_data *, clif_displaymessage(fd, output); output = STRPRINTF("Base Level - %d", pl_sd->status.base_level), clif_displaymessage(fd, output); - output = STRPRINTF("Job - %s (level %d)", - job_name(pl_sd->status.pc_class), pl_sd->status.job_level); + output = STRPRINTF("Job - Novice/Human (level %d)", pl_sd->status.job_level); clif_displaymessage(fd, output); output = STRPRINTF("Hp - %d", pl_sd->status.hp); clif_displaymessage(fd, output); @@ -3035,9 +2836,9 @@ int atcommand_character_stats_all(const int fd, struct map_session_data *, std::string output; output = STRPRINTF( - "Name: %s | BLvl: %d | Job: %s (Lvl: %d) | HP: %d/%d | SP: %d/%d", + "Name: %s | BLvl: %d | Job: Novice/Human (Lvl: %d) | HP: %d/%d | SP: %d/%d", pl_sd->status.name, pl_sd->status.base_level, - job_name(pl_sd->status.pc_class), pl_sd->status.job_level, + pl_sd->status.job_level, pl_sd->status.hp, pl_sd->status.max_hp, pl_sd->status.sp, pl_sd->status.max_sp); clif_displaymessage(fd, output); @@ -3098,25 +2899,12 @@ int atcommand_character_option(const int fd, struct map_session_data *sd, if ((pl_sd = map_nick2sd(character)) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) - { // you can change option only to lower or same level + { + // you can change option only to lower or same level pl_sd->opt1 = opt1; pl_sd->opt2 = opt2; pl_sd->status.option = opt3; - // fix pecopeco display - if (pl_sd->status.pc_class == 13 || pl_sd->status.pc_class == 21 - || pl_sd->status.pc_class == 4014 || pl_sd->status.pc_class == 4022) - { - { // pl_sd have the new value... - if (pl_sd->status.pc_class == 13) - pl_sd->status.pc_class = pl_sd->view_class = 7; - else if (pl_sd->status.pc_class == 21) - pl_sd->status.pc_class = pl_sd->view_class = 14; - else if (pl_sd->status.pc_class == 4014) - pl_sd->status.pc_class = pl_sd->view_class = 4008; - else if (pl_sd->status.pc_class == 4022) - pl_sd->status.pc_class = pl_sd->view_class = 4015; - } - } + clif_changeoption(&pl_sd->bl); pc_calcstatus(pl_sd, 0); clif_displaymessage(fd, "Character's options changed."); @@ -3749,8 +3537,6 @@ int atcommand_character_joblevel(const int fd, struct map_session_data *sd, struct map_session_data *pl_sd; char character[100]; int max_level = 50, level = 0; - //転生や養子の場合の元の職業を算出する - struct pc_base_job pl_s_class; memset(character, '\0', sizeof(character)); @@ -3765,13 +3551,10 @@ int atcommand_character_joblevel(const int fd, struct map_session_data *sd, if ((pl_sd = map_nick2sd(character)) != NULL) { - pl_s_class = pc_calc_base_job(pl_sd->status.pc_class); if (pc_isGM(sd) >= pc_isGM(pl_sd)) - { // you can change job level only lower or same gm level - if (pl_s_class.job == 0) - max_level -= 40; - if ((pl_s_class.job == 23) || (pl_s_class.upper == 1 && pl_s_class.type == 2)) //スパノビと転生職はJobレベルの最高が70 - max_level += 20; + { + // you can change job level only lower or same gm level + max_level -= 40; if (level > 0) { @@ -4473,15 +4256,6 @@ int atcommand_charmodel(const int fd, struct map_session_data *, hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR && cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) { - - if (cloth_color != 0 && - pl_sd->status.sex == 1 && - (pl_sd->status.pc_class == 12 || pl_sd->status.pc_class == 17)) - { - clif_displaymessage(fd, "You can't use this command with this class."); - return -1; - } - else { pc_changelook(pl_sd, LOOK_HAIR, hair_style); pc_changelook(pl_sd, LOOK_HAIR_COLOR, hair_color); diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 39aa62d..1e5ca05 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -49,10 +49,10 @@ int battle_counttargeted(struct block_list *bl, struct block_list *src, int battle_get_class(struct block_list *bl) { nullpo_ret(bl); - if (bl->type == BL_MOB && (struct mob_data *) bl) + if (bl->type == BL_MOB) return ((struct mob_data *) bl)->mob_class; - else if (bl->type == BL_PC && (struct map_session_data *) bl) - return ((struct map_session_data *) bl)->status.pc_class; + else if (bl->type == BL_PC) + return 0; else return 0; } @@ -2779,7 +2779,7 @@ struct Damage battle_calc_pc_weapon_attack(struct block_list *src, //特定Class用補正処理左手(少女の日記→ボンゴン用?) for (int i = 0; i < tsd->add_def_class_count; i++) { - if (tsd->add_def_classid[i] == sd->status.pc_class) + if (tsd->add_def_classid[i] == 0) { cardfix = cardfix * (100 - tsd->add_def_classrate[i]) / 100; break; @@ -3857,10 +3857,7 @@ int battle_check_target(struct block_list *src, struct block_list *target, { // [MouseJstr] if (su && su->group->target_flag == BCT_NOENEMY) return 1; - else if (battle_config.pk_mode - && (((struct map_session_data *) ss)->status.pc_class == 0 - || ((struct map_session_data *) target)-> - status.pc_class == 0)) + else if (battle_config.pk_mode) return 1; // prevent novice engagement in pk_mode [Valaris] else if (map[ss->m].flag.pvp_noparty && s_p > 0 && t_p > 0 && s_p == t_p) diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index ee8113a..ef4c160 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -640,7 +640,6 @@ int chrif_changedsex(int fd) { int acc, sex, i; struct map_session_data *sd; - struct pc_base_job s_class; acc = RFIFOL(fd, 2); sex = RFIFOL(fd, 6); @@ -651,17 +650,7 @@ int chrif_changedsex(int fd) { if (sd != NULL && sd->status.sex != sex) { - s_class = pc_calc_base_job(sd->status.pc_class); - if (sd->status.sex == 0) - { - sd->status.sex = 1; - sd->sex = 1; - } - else if (sd->status.sex == 1) - { - sd->status.sex = 0; - sd->sex = 0; - } + sd->sex = sd->status.sex = !sd->status.sex; // to avoid any problem with equipment and invalid sex, equipment is unequiped. for (i = 0; i < MAX_INVENTORY; i++) { @@ -669,21 +658,6 @@ int chrif_changedsex(int fd) && bool(sd->status.inventory[i].equip)) pc_unequipitem(sd, i, CalcStatus::NOW); } - // reset skill of some job - if (s_class.job == 19 || s_class.job == 4020 - || s_class.job == 4042 || s_class.job == 20 - || s_class.job == 4021 || s_class.job == 4043) - { - - clif_updatestatus(sd, SP_SKILLPOINT); - // change job if necessary - if (s_class.job == 20 || s_class.job == 4021 - || s_class.job == 4043) - sd->status.pc_class -= 1; - else if (s_class.job == 19 || s_class.job == 4020 - || s_class.job == 4042) - sd->status.pc_class += 1; - } // save character chrif_save(sd); sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters diff --git a/src/map/clif.cpp b/src/map/clif.cpp index af681d4..f715210 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -742,48 +742,23 @@ int current_weapon(struct map_session_data *sd) static int clif_set0078(struct map_session_data *sd, unsigned char *buf) { - int level = 0; - nullpo_ret(sd); - if (sd->disguise > 23 && sd->disguise < 4001) - { // mob disguises [Valaris] - WBUFW(buf, 0) = 0x78; - WBUFL(buf, 2) = sd->bl.id; - WBUFW(buf, 6) = battle_get_speed(&sd->bl); - WBUFW(buf, 8) = uint16_t(sd->opt1); - WBUFW(buf, 10) = uint16_t(sd->opt2); - WBUFW(buf, 12) = uint16_t(sd->status.option); - WBUFW(buf, 14) = sd->disguise; - WBUFW(buf, 42) = 0; - WBUFB(buf, 44) = 0; - WBUFPOS(buf, 46, sd->bl.x, sd->bl.y); - WBUFB(buf, 48) |= sd->dir & 0x0f; - WBUFB(buf, 49) = 5; - WBUFB(buf, 50) = 5; - WBUFB(buf, 51) = 0; - WBUFW(buf, 52) = - ((level = - battle_get_lv(&sd->bl)) > - battle_config.max_lv) ? battle_config.max_lv : level; - - return packet_len_table[0x78]; - } - WBUFW(buf, 0) = 0x1d8; WBUFL(buf, 2) = sd->bl.id; WBUFW(buf, 6) = sd->speed; WBUFW(buf, 8) = uint16_t(sd->opt1); WBUFW(buf, 10) = uint16_t(sd->opt2); WBUFW(buf, 12) = uint16_t(sd->status.option); - WBUFW(buf, 14) = sd->view_class; + WBUFW(buf, 14) = sd->status.species; WBUFW(buf, 16) = sd->status.hair; if (sd->attack_spell_override) + // should be WBUFW ? WBUFB(buf, 18) = sd->attack_spell_look_override; else { - if (sd->equip_index[EQUIP::WEAPON] >= 0 && sd->inventory_data[sd->equip_index[EQUIP::WEAPON]] - && sd->view_class != 22) + if (sd->equip_index[EQUIP::WEAPON] >= 0 + && sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]) { if (sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]->view_id > 0) WBUFW(buf, 18) = @@ -795,8 +770,9 @@ int clif_set0078(struct map_session_data *sd, unsigned char *buf) else WBUFW(buf, 18) = 0; } - if (sd->equip_index[EQUIP::SHIELD] >= 0 && sd->equip_index[EQUIP::SHIELD] != sd->equip_index[EQUIP::WEAPON] - && sd->inventory_data[sd->equip_index[EQUIP::SHIELD]] && sd->view_class != 22) + if (sd->equip_index[EQUIP::SHIELD] >= 0 + && sd->equip_index[EQUIP::SHIELD] != sd->equip_index[EQUIP::WEAPON] + && sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]) { if (sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]->view_id > 0) WBUFW(buf, 20) = sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]->view_id; @@ -833,43 +809,18 @@ int clif_set0078(struct map_session_data *sd, unsigned char *buf) static int clif_set007b(struct map_session_data *sd, unsigned char *buf) { - int level = 0; nullpo_ret(sd); - if (sd->disguise > 23 && sd->disguise < 4001) - { // mob disguises [Valaris] - WBUFW(buf, 0) = 0x7b; - WBUFL(buf, 2) = sd->bl.id; - WBUFW(buf, 6) = battle_get_speed(&sd->bl); - WBUFW(buf, 8) = uint16_t(sd->opt1); - WBUFW(buf, 10) = uint16_t(sd->opt2); - WBUFW(buf, 12) = uint16_t(sd->status.option); - WBUFW(buf, 14) = sd->disguise; - WBUFL(buf, 22) = gettick(); - WBUFW(buf, 46) = 0; - WBUFB(buf, 48) = 0; - WBUFPOS2(buf, 50, sd->bl.x, sd->bl.y, sd->to_x, sd->to_y); - WBUFB(buf, 55) = 0; - WBUFB(buf, 56) = 5; - WBUFB(buf, 57) = 5; - WBUFW(buf, 58) = - ((level = - battle_get_lv(&sd->bl)) > - battle_config.max_lv) ? battle_config.max_lv : level; - - return packet_len_table[0x7b]; - } - WBUFW(buf, 0) = 0x1da; WBUFL(buf, 2) = sd->bl.id; WBUFW(buf, 6) = sd->speed; WBUFW(buf, 8) = uint16_t(sd->opt1); WBUFW(buf, 10) = uint16_t(sd->opt2); WBUFW(buf, 12) = uint16_t(sd->status.option); - WBUFW(buf, 14) = sd->view_class; + WBUFW(buf, 14) = sd->status.species; WBUFW(buf, 16) = sd->status.hair; - if (sd->equip_index[EQUIP::WEAPON] >= 0 && sd->inventory_data[sd->equip_index[EQUIP::WEAPON]] - && sd->view_class != 22) + if (sd->equip_index[EQUIP::WEAPON] >= 0 + && sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]) { if (sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]->view_id > 0) WBUFW(buf, 18) = sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]->view_id; @@ -878,8 +829,9 @@ int clif_set007b(struct map_session_data *sd, unsigned char *buf) } else WBUFW(buf, 18) = 0; - if (sd->equip_index[EQUIP::SHIELD] >= 0 && sd->equip_index[EQUIP::SHIELD] != sd->equip_index[EQUIP::WEAPON] - && sd->inventory_data[sd->equip_index[EQUIP::SHIELD]] && sd->view_class != 22) + if (sd->equip_index[EQUIP::SHIELD] >= 0 + && sd->equip_index[EQUIP::SHIELD] != sd->equip_index[EQUIP::WEAPON] + && sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]) { if (sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]->view_id > 0) WBUFW(buf, 20) = sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]->view_id; @@ -928,23 +880,8 @@ int clif_mob0078(struct mob_data *md, unsigned char *buf) WBUFW(buf, 8) = uint16_t(md->opt1); WBUFW(buf, 10) = uint16_t(md->opt2); WBUFW(buf, 12) = uint16_t(md->option); - WBUFW(buf, 14) = mob_get_viewclass(md->mob_class); - if ((mob_get_viewclass(md->mob_class) <= 23) - || (mob_get_viewclass(md->mob_class) == 812) - || (mob_get_viewclass(md->mob_class) >= 4001)) - { - WBUFW(buf, 12) |= mob_db[md->mob_class].option; - WBUFW(buf, 16) = mob_get_hair(md->mob_class); - WBUFW(buf, 18) = mob_get_weapon(md->mob_class); - WBUFW(buf, 20) = mob_get_head_buttom(md->mob_class); - WBUFW(buf, 22) = mob_get_shield(md->mob_class); - WBUFW(buf, 24) = mob_get_head_top(md->mob_class); - WBUFW(buf, 26) = mob_get_head_mid(md->mob_class); - WBUFW(buf, 28) = mob_get_hair_color(md->mob_class); - WBUFW(buf, 30) = mob_get_clothes_color(md->mob_class); //Add for player monster dye - Valaris - WBUFB(buf, 45) = mob_get_sex(md->mob_class); - } - + WBUFW(buf, 14) = md->mob_class; + // snip: stuff do do with disguise as a PC WBUFPOS(buf, 46, md->bl.x, md->bl.y); WBUFB(buf, 48) |= md->dir & 0x0f; WBUFB(buf, 49) = 5; @@ -976,24 +913,9 @@ int clif_mob007b(struct mob_data *md, unsigned char *buf) WBUFW(buf, 8) = uint16_t(md->opt1); WBUFW(buf, 10) = uint16_t(md->opt2); WBUFW(buf, 12) = uint16_t(md->option); - WBUFW(buf, 14) = mob_get_viewclass(md->mob_class); - if ((mob_get_viewclass(md->mob_class) < 24) - || (mob_get_viewclass(md->mob_class) > 4000)) - { - WBUFW(buf, 12) |= mob_db[md->mob_class].option; - WBUFW(buf, 16) = mob_get_hair(md->mob_class); - WBUFW(buf, 18) = mob_get_weapon(md->mob_class); - WBUFW(buf, 20) = mob_get_head_buttom(md->mob_class); - WBUFL(buf, 22) = gettick(); - WBUFW(buf, 26) = mob_get_shield(md->mob_class); - WBUFW(buf, 28) = mob_get_head_top(md->mob_class); - WBUFW(buf, 30) = mob_get_head_mid(md->mob_class); - WBUFW(buf, 32) = mob_get_hair_color(md->mob_class); - WBUFW(buf, 34) = mob_get_clothes_color(md->mob_class); //Add for player monster dye - Valaris - WBUFB(buf, 49) = mob_get_sex(md->mob_class); - } - else - WBUFL(buf, 22) = gettick(); + WBUFW(buf, 14) = md->mob_class; + // snip: stuff for monsters disguised as PCs + WBUFL(buf, 22) = gettick(); WBUFPOS2(buf, 50, md->bl.x, md->bl.y, md->to_x, md->to_y); WBUFB(buf, 56) = 5; @@ -1059,34 +981,6 @@ int clif_spawnpc(struct map_session_data *sd) nullpo_ret(sd); - if (sd->disguise > 23 && sd->disguise < 4001) - { // mob disguises [Valaris] - clif_clearchar(&sd->bl, 9); - - memset(buf, 0, packet_len_table[0x119]); - - WBUFW(buf, 0) = 0x119; - WBUFL(buf, 2) = sd->bl.id; - WBUFW(buf, 6) = 0; - WBUFW(buf, 8) = 0; - WBUFW(buf, 10) = 0x40; - WBUFB(buf, 12) = 0; - - clif_send(buf, packet_len_table[0x119], &sd->bl, SELF); - - memset(buf, 0, packet_len_table[0x7c]); - - WBUFW(buf, 0) = 0x7c; - WBUFL(buf, 2) = sd->bl.id; - WBUFW(buf, 6) = sd->speed; - WBUFW(buf, 8) = uint16_t(sd->opt1); - WBUFW(buf, 10) = uint16_t(sd->opt2); - WBUFW(buf, 12) = uint16_t(sd->status.option); - WBUFW(buf, 20) = sd->disguise; - WBUFPOS(buf, 36, sd->bl.x, sd->bl.y); - clif_send(buf, packet_len_table[0x7c], &sd->bl, AREA); - } - clif_set0078(sd, buf); WBUFW(buf, 0) = 0x1d9; @@ -1187,7 +1081,6 @@ int clif_spawnmob(struct mob_data *md) nullpo_ret(md); - if (mob_get_viewclass(md->mob_class) > 23) { memset(buf, 0, packet_len_table[0x7c]); @@ -1197,7 +1090,7 @@ int clif_spawnmob(struct mob_data *md) WBUFW(buf, 8) = uint16_t(md->opt1); WBUFW(buf, 10) = uint16_t(md->opt2); WBUFW(buf, 12) = uint16_t(md->option); - WBUFW(buf, 20) = mob_get_viewclass(md->mob_class); + WBUFW(buf, 20) = md->mob_class; WBUFPOS(buf, 36, md->bl.x, md->bl.y); clif_send(buf, packet_len_table[0x7c], &md->bl, AREA); } @@ -1260,13 +1153,7 @@ int clif_movechar(struct map_session_data *sd) len = clif_set007b(sd, buf); - if (sd->disguise > 23 && sd->disguise < 4001) - { - clif_send(buf, len, &sd->bl, AREA); - return 0; - } - else - clif_send(buf, len, &sd->bl, AREA_WOS); + clif_send(buf, len, &sd->bl, AREA_WOS); if (battle_config.save_clothcolor == 1 && sd->status.clothes_color > 0) clif_changelook(&sd->bl, LOOK_CLOTHES_COLOR, @@ -1323,9 +1210,6 @@ int clif_changemap(struct map_session_data *sd, const char *mapname, int x, int WFIFOW(fd, 20) = y; WFIFOSET(fd, packet_len_table[0x91]); - if (sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris] - clif_spawnpc(sd); - return 0; } @@ -2158,9 +2042,6 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, if (bl->type == BL_PC) sd = (struct map_session_data *) bl; - if (sd && sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris] - return 0; - if (sd && bool(sd->status.option & Option::INVISIBILITY)) return 0; @@ -2199,8 +2080,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, else { if (sd->equip_index[EQUIP::WEAPON] >= 0 - && sd->inventory_data[sd->equip_index[EQUIP::WEAPON]] - && sd->view_class != 22) + && sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]) { if (sd->inventory_data[sd->equip_index[EQUIP::WEAPON]]->view_id > 0) WBUFW(buf, 7) = @@ -2214,8 +2094,7 @@ int clif_changelook_towards(struct block_list *bl, LOOK type, int val, } if (sd->equip_index[EQUIP::SHIELD] >= 0 && sd->equip_index[EQUIP::SHIELD] != sd->equip_index[EQUIP::WEAPON] - && sd->inventory_data[sd->equip_index[EQUIP::SHIELD]] - && sd->view_class != 22) + && sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]) { if (sd->inventory_data[sd->equip_index[EQUIP::SHIELD]]->view_id > 0) WBUFW(buf, 9) = @@ -2445,19 +2324,7 @@ int clif_changeoption(struct block_list *bl) WBUFW(buf, 10) = uint16_t(option); WBUFB(buf, 12) = 0; // ?? - if (bl->type == BL_PC) - { // disguises [Valaris] - struct map_session_data *sd = ((struct map_session_data *) bl); - if (sd && sd->disguise > 23 && sd->disguise < 4001) - { - clif_send(buf, packet_len_table[0x119], bl, AREA_WOS); - clif_spawnpc(sd); - } - else - clif_send(buf, packet_len_table[0x119], bl, AREA); - } - else - clif_send(buf, packet_len_table[0x119], bl, AREA); + clif_send(buf, packet_len_table[0x119], bl, AREA); return 0; } @@ -3457,13 +3324,6 @@ int clif_resurrection(struct block_list *bl, int type) nullpo_ret(bl); - if (bl->type == BL_PC) - { // disguises [Valaris] - struct map_session_data *sd = ((struct map_session_data *) bl); - if (sd && sd->disguise > 23 && sd->disguise < 4001) - clif_spawnpc(sd); - } - WBUFW(buf, 0) = 0x148; WBUFL(buf, 2) = bl->id; WBUFW(buf, 6) = type; @@ -4051,12 +3911,7 @@ void clif_parse_LoadEndAck(int, struct map_session_data *sd) sd->pvp_timer = -1; } - if (sd->state.connect_new) - { - sd->state.connect_new = 0; - if (sd->status.pc_class != sd->view_class) - clif_changelook(&sd->bl, LOOK_BASE, sd->view_class); - } + sd->state.connect_new = 0; // view equipment item clif_changelook(&sd->bl, LOOK_WEAPON, 0); @@ -4415,10 +4270,8 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) WBUFL(buf, 2) = sd->bl.id; WBUFW(buf, 6) = 0; WBUFB(buf, 8) = dir; - if (sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris] - clif_send(buf, packet_len_table[0x9c], &sd->bl, AREA); - else - clif_send(buf, packet_len_table[0x9c], &sd->bl, AREA_WOS); + + clif_send(buf, packet_len_table[0x9c], &sd->bl, AREA_WOS); } @@ -4494,7 +4347,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { case 0x00: // once attack case 0x07: // continuous attack - if (sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == 22 + if (sd->sc_data[SC_WEDDING].timer != -1 || bool(sd->status.option & Option::HIDE)) return; if (!battle_config.sdelay_attack_enable) @@ -5042,8 +4895,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if (sd->sc_data[SC_TRICKDEAD].timer != -1 || sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 - || sd->sc_data[SC_WEDDING].timer != -1 - || sd->view_class == 22) + || sd->sc_data[SC_WEDDING].timer != -1) return; if (sd->invincible_timer != -1) pc_delinvincibletimer(sd); @@ -5115,7 +4967,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) || sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 - || sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == 22) + || sd->sc_data[SC_WEDDING].timer != -1) return; if (sd->invincible_timer != -1) pc_delinvincibletimer(sd); @@ -5150,12 +5002,11 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data *sd) if (sd->chatID) return; - if (sd->npc_id != 0 || ( - (sd->sc_data[SC_TRICKDEAD].timer != -1 || - sd->sc_data[SC_BERSERK].timer != -1 || - sd->sc_data[SC_NOCHAT].timer != -1 || - sd->sc_data[SC_WEDDING].timer != -1 || - sd->view_class == 22))) + if (sd->npc_id != 0 + || sd->sc_data[SC_TRICKDEAD].timer != -1 + || sd->sc_data[SC_BERSERK].timer != -1 + || sd->sc_data[SC_NOCHAT].timer != -1 + || sd->sc_data[SC_WEDDING].timer != -1) return; if (sd->invincible_timer != -1) diff --git a/src/map/map.hpp b/src/map/map.hpp index 4bd0b4f..d4f1445 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -299,9 +299,7 @@ struct map_session_data int berserkdamagetick; int fame; - short view_class; short weapontype1, weapontype2; - short disguiseflag, disguise; // [Valaris] earray<int, ATTR, ATTR::COUNT> paramb, paramc, parame, paramcard; int hit, flee, flee2, aspd, amotion, dmotion; int watk, watk2, atkmods[3]; diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp index 12e7cc0..4110f05 100644 --- a/src/map/map.t.hpp +++ b/src/map/map.t.hpp @@ -191,6 +191,7 @@ enum class SP : uint16_t #define SP_JOBEXP SP::JOBEXP KARMA = 3, #define SP_KARMA SP::KARMA + HP = 5, #define SP_HP SP::HP MAXHP = 6, @@ -201,6 +202,7 @@ enum class SP : uint16_t #define SP_MAXSP SP::MAXSP STATUSPOINT = 9, #define SP_STATUSPOINT SP::STATUSPOINT + BASELEVEL = 11, #define SP_BASELEVEL SP::BASELEVEL SKILLPOINT = 12, @@ -231,6 +233,7 @@ enum class SP : uint16_t #define SP_WEIGHT SP::WEIGHT MAXWEIGHT = 25, #define SP_MAXWEIGHT SP::MAXWEIGHT + USTR = 32, #define SP_USTR SP::USTR UAGI = 33, @@ -243,6 +246,7 @@ enum class SP : uint16_t #define SP_UDEX SP::UDEX ULUK = 37, #define SP_ULUK SP::ULUK + ATK1 = 41, #define SP_ATK1 SP::ATK1 ATK2 = 42, @@ -269,10 +273,10 @@ enum class SP : uint16_t #define SP_CRITICAL SP::CRITICAL ASPD = 53, #define SP_ASPD SP::ASPD + JOBLEVEL = 55, #define SP_JOBLEVEL SP::JOBLEVEL - UPPER = 56, -#define SP_UPPER SP::UPPER + PARTNER = 57, #define SP_PARTNER SP::PARTNER CART = 58, @@ -281,6 +285,7 @@ enum class SP : uint16_t #define SP_FAME SP::FAME UNBREAKABLE = 60, #define SP_UNBREAKABLE SP::UNBREAKABLE + DEAF = 70, #define SP_DEAF SP::DEAF @@ -441,8 +446,6 @@ enum class SP : uint16_t #define SP_AGI_DEX_STR SP::AGI_DEX_STR PERFECT_HIDE = 1076, #define SP_PERFECT_HIDE SP::PERFECT_HIDE - DISGUISE = 1077, -#define SP_DISGUISE SP::DISGUISE RESTART_FULL_RECORVER = 2000, #define SP_RESTART_FULL_RECORVER SP::RESTART_FULL_RECORVER diff --git a/src/map/mob.cpp b/src/map/mob.cpp index e528fd7..75e59d8 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -546,15 +546,6 @@ int mob_spawn_guardian(struct map_session_data *sd, const char *mapname, return (amount > 0) ? md->bl.id : 0; } -/*========================================== - * Appearance income of mob - *------------------------------------------ - */ -int mob_get_viewclass(int mob_class) -{ - return mob_db[mob_class].view_class; -} - int mob_get_sex(int mob_class) { return mob_db[mob_class].sex; @@ -2408,8 +2399,6 @@ int mob_delete(struct mob_data *md) mob_changestate(md, MS_DEAD, 0); clif_clearchar_area(&md->bl, 1); map_delblock(&md->bl); - if (mob_get_viewclass(md->mob_class) <= 1000) - clif_clearchar_delay(gettick() + 3000, &md->bl, 0); mob_deleteslave(md); mob_setdelayspawn(md->bl.id); return 0; @@ -2963,8 +2952,6 @@ int mob_damage(struct block_list *src, struct mob_data *md, int damage, clif_clearchar_area(&md->bl, 1); map_delblock(&md->bl); - if (mob_get_viewclass(md->mob_class) <= 1000) - clif_clearchar_delay(tick + 3000, &md->bl, 0); mob_deleteslave(md); mob_setdelayspawn(md->bl.id); map_freeblock_unlock(); @@ -4108,7 +4095,6 @@ int mob_readdb(void) if (mob_class <= 1000 || mob_class > 2000) continue; - mob_db[mob_class].view_class = mob_class; memcpy(mob_db[mob_class].name, str[1], 24); memcpy(mob_db[mob_class].jname, str[2], 24); mob_db[mob_class].lv = atoi(str[3]); @@ -4242,79 +4228,6 @@ int mob_readdb(void) } /*========================================== - * MOB display graphic change data reading - *------------------------------------------ - */ -static -int mob_readdb_mobavail(void) -{ - FILE *fp; - char line[1024]; - int ln = 0; - int mob_class, j, k; - char *str[20], *p, *np; - - if ((fp = fopen_("db/mob_avail.txt", "r")) == NULL) - { - PRINTF("can't read db/mob_avail.txt\n"); - return -1; - } - - while (fgets(line, 1020, fp)) - { - if (line[0] == '/' && line[1] == '/') - continue; - memset(str, 0, sizeof(str)); - - for (j = 0, p = line; j < 12; j++) - { - if ((np = strchr(p, ',')) != NULL) - { - str[j] = p; - *np = 0; - p = np + 1; - } - else - str[j] = p; - } - - if (str[0] == NULL) - continue; - - mob_class = atoi(str[0]); - - if (mob_class <= 1000 || mob_class > 2000) // 値が異常なら処理しない。 - continue; - k = atoi(str[1]); - if (k >= 0) - mob_db[mob_class].view_class = k; - - if ((mob_db[mob_class].view_class < 24) - || (mob_db[mob_class].view_class > 4000)) - { - mob_db[mob_class].sex = atoi(str[2]); - mob_db[mob_class].hair = atoi(str[3]); - mob_db[mob_class].hair_color = atoi(str[4]); - mob_db[mob_class].weapon = atoi(str[5]); - mob_db[mob_class].shield = atoi(str[6]); - mob_db[mob_class].head_top = atoi(str[7]); - mob_db[mob_class].head_mid = atoi(str[8]); - mob_db[mob_class].head_buttom = atoi(str[9]); - mob_db[mob_class].option = atoi(str[10]) & ~0x46; - mob_db[mob_class].clothes_color = atoi(str[11]); // Monster player dye option - Valaris - } - - else if (atoi(str[2]) > 0) - mob_db[mob_class].equip = atoi(str[2]); // mob equipment [Valaris] - - ln++; - } - fclose_(fp); - PRINTF("read db/mob_avail.txt done (count=%d)\n", ln); - return 0; -} - -/*========================================== * Reading of random monster data *------------------------------------------ */ @@ -4581,7 +4494,6 @@ int do_init_mob(void) { mob_readdb(); - mob_readdb_mobavail(); mob_read_randommonster(); mob_readskilldb(); diff --git a/src/map/mob.hpp b/src/map/mob.hpp index 6cedb1e..b8b1128 100644 --- a/src/map/mob.hpp +++ b/src/map/mob.hpp @@ -49,7 +49,7 @@ struct mob_db { int nameid, p; } mvpitem[3]; - int view_class, sex; + int sex; short hair, hair_color, weapon, shield, head_top, head_mid, head_buttom, option, clothes_color; // [Valaris] int equip; // [Valaris] int summonper[MAX_RANDOMMONSTER]; @@ -77,7 +77,6 @@ int mob_spawn(int); int mob_damage(struct block_list *, struct mob_data *, int, int); int mob_changestate(struct mob_data *md, MS state, int type); int mob_heal(struct mob_data *, int); -int mob_get_viewclass(int); int mob_get_sex(int); short mob_get_hair(int); short mob_get_hair_color(int); diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 6961f47..b136ba4 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -128,8 +128,6 @@ int pc_checkoverhp(struct map_session_data *sd); static int pc_checkoversp(struct map_session_data *sd); static -int pc_equiplookall(struct map_session_data *sd); -static int pc_nextbaseafter(struct map_session_data *sd); static int pc_nextjobafter(struct map_session_data *sd); @@ -350,13 +348,8 @@ int pc_delspiritball(struct map_session_data *sd, int count, int) int pc_setrestartvalue(struct map_session_data *sd, int type) { - //転生や養子の場合の元の職業を算出する - struct pc_base_job s_class; - nullpo_ret(sd); - s_class = pc_calc_base_job(sd->status.pc_class); - //----------------------- // 死亡した if (sd->special_state.restart_full_recover) @@ -366,10 +359,8 @@ int pc_setrestartvalue(struct map_session_data *sd, int type) } else { - if (s_class.job == 0 && battle_config.restart_hp_rate < 50) - { //ノビは半分回復 + if (battle_config.restart_hp_rate < 50) sd->status.hp = (sd->status.max_hp) / 2; - } else { if (battle_config.restart_hp_rate <= 0) @@ -394,21 +385,6 @@ int pc_setrestartvalue(struct map_session_data *sd, int type) if (type & 1) clif_updatestatus(sd, SP_SP); - /* removed exp penalty on spawn [Valaris] */ - - if (type & 2 && sd->status.pc_class != 0 && battle_config.zeny_penalty > 0 - && !map[sd->bl.m].flag.nozenypenalty) - { - int zeny = - (int)((double) sd->status.zeny * - (double) battle_config.zeny_penalty / 10000.); - if (zeny < 1) - zeny = 1; - sd->status.zeny -= zeny; - if (sd->status.zeny < 0) - sd->status.zeny = 0; - clif_updatestatus(sd, SP_ZENY); - } sd->heal_xp = 0; // [Fate] Set gainable xp for healing this player to 0 return 0; @@ -531,25 +507,12 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, EPOS pc_equippoint(struct map_session_data *sd, int n) { - //転生や養子の場合の元の職業を算出する - struct pc_base_job s_class; - nullpo_retr(EPOS::ZERO, sd); if (!sd->inventory_data[n]) return EPOS::ZERO; - s_class = pc_calc_base_job(sd->status.pc_class); - EPOS ep = sd->inventory_data[n]->equip; - if ((sd->inventory_data[n]->look == 1 - || sd->inventory_data[n]->look == 2 - || sd->inventory_data[n]->look == 6) - && (ep == EPOS::WEAPON - && (s_class.job == 12))) - { - return EPOS::SHIELD | EPOS::WEAPON; - } return ep; } @@ -655,7 +618,6 @@ int pc_isequip(struct map_session_data *sd, int n) item = sd->inventory_data[n]; sc_data = battle_get_sc_data(&sd->bl); - //s_class = pc_calc_base_job(sd->status.class); if (battle_config.gm_allequip > 0 && pc_isGM(sd) >= battle_config.gm_allequip) @@ -814,7 +776,6 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, sd->bl.prev = sd->bl.next = NULL; sd->weapontype1 = sd->weapontype2 = 0; - sd->view_class = sd->status.pc_class; sd->speed = DEFAULT_WALK_SPEED; sd->state.dead_sit = 0; sd->dir = 0; @@ -1037,149 +998,43 @@ int pc_calc_skillpoint(struct map_session_data *sd) * 覚えられるスキルの計算 *------------------------------------------ */ +// TODO see if this can be removed static -int pc_calc_skilltree(struct map_session_data *sd) +void pc_calc_skilltree(struct map_session_data *sd) { - int flag; - int c = 0, s = 0; - //転生や養子の場合の元の職業を算出する - struct pc_base_job s_class; - - nullpo_ret(sd); - - s_class = pc_calc_base_job(sd->status.pc_class); - c = s_class.job; - s = (s_class.upper == 1) ? 1 : 0; //ソ転生以外は通常のスキル? - - if ((battle_config.skillup_limit) - && ((c >= 0 && c < 23) || (c >= 4001 && c < 4023) - || (c >= 4023 && c < 4045))) - { - int skill_point = pc_calc_skillpoint(sd); - if (skill_point < 9) - c = 0; - else if ((sd->status.skill_point >= sd->status.job_level - && skill_point < 58) && ((c > 6 && c < 23) || (c > 4007 - && c < 4023) - || (c > 4029 && c < 4045))) - { - switch (c) - { - case 7: - case 14: - c = 1; - break; - case 8: - case 15: - c = 4; - break; - case 9: - case 16: - c = 2; - break; - case 10: - case 18: - c = 5; - break; - case 11: - case 19: - case 20: - c = 3; - break; - case 12: - case 17: - c = 6; - break; - case 4008: - case 4015: - c = 4002; - break; - case 4009: - case 4016: - c = 4005; - break; - case 4010: - case 4017: - c = 4003; - break; - case 4011: - case 4019: - c = 4006; - break; - case 4012: - case 4020: - case 4021: - c = 4004; - break; - case 4013: - case 4018: - c = 4007; - break; - case 4030: - case 4037: - c = 4024; - break; - case 4031: - case 4038: - c = 4027; - break; - case 4032: - case 4039: - c = 4025; - break; - case 4033: - case 4040: - c = 4028; - break; - case 4034: - case 4041: - case 4042: - c = 4026; - break; - case 4035: - case 4043: - c = 4029; - break; - - } - } - } + nullpo_retv(sd); + int flag; + // 通常の計算 + do { - // 通常の計算 - do + flag = 0; + SkillID id; + for (int i = 0; + (id = skill_tree[0][0][i].id) != SkillID::ZERO + && id != SkillID::NEGATIVE; + i++) { - flag = 0; - SkillID id; - for (int i = 0; - (id = skill_tree[s][c][i].id) != SkillID::ZERO - && id != SkillID::NEGATIVE; - i++) + int j, f = 1; + if (!battle_config.skillfree) { - int j, f = 1; - if (!battle_config.skillfree) + for (j = 0; j < 5; j++) { - for (j = 0; j < 5; j++) - { - if (skill_tree[s][c][i].need[j].id != SkillID::ZERO - && pc_checkskill(sd, - skill_tree[s][c][i].need[j].id) < - skill_tree[s][c][i].need[j].lv) - f = 0; - } - } - if (f && sd->status.skill[id].id == SkillID::ZERO) - { - sd->status.skill[id].id = id; - flag = 1; + if (skill_tree[0][0][i].need[j].id != SkillID::ZERO + && pc_checkskill(sd, + skill_tree[0][0][i].need[j].id) < \ + skill_tree[0][0][i].need[j].lv) + f = 0; } } + if (f && sd->status.skill[id].id == SkillID::ZERO) + { + sd->status.skill[id].id = id; + flag = 1; + } } - while (flag); } -// if(battle_config.etc_log) -// PRINTF("calc skill_tree\n"); - return 0; + while (flag); } /*========================================== @@ -1243,19 +1098,15 @@ int pc_calcstatus(struct map_session_data *sd, int first) int b_speed, b_max_hp, b_max_sp, b_hp, b_sp, b_weight, b_max_weight, b_hit, b_flee; int b_aspd, b_watk, b_def, b_watk2, b_def2, b_flee2, b_critical, - b_attackrange, b_matk1, b_matk2, b_mdef, b_mdef2, b_class; + b_attackrange, b_matk1, b_matk2, b_mdef, b_mdef2; int b_base_atk; earray<struct skill, SkillID, MAX_SKILL> b_skill; int bl, index; int aspd_rate, wele, wele_, def_ele, refinedef = 0; int str, dstr, dex; - struct pc_base_job s_class; nullpo_ret(sd); - //転生や養子の場合の元の職業を算出する - s_class = pc_calc_base_job(sd->status.pc_class); - b_speed = sd->speed; b_max_hp = sd->status.max_hp; b_max_sp = sd->status.max_sp; @@ -1280,13 +1131,11 @@ int pc_calcstatus(struct map_session_data *sd, int first) b_matk2 = sd->matk2; b_mdef = sd->mdef; b_mdef2 = sd->mdef2; - b_class = sd->view_class; - sd->view_class = sd->status.pc_class; b_base_atk = sd->base_atk; pc_calc_skilltree(sd); // スキルツリーの計算 - sd->max_weight = max_weight_base[s_class.job] + sd->status.attrs[ATTR::STR] * 300; + sd->max_weight = max_weight_base[0] + sd->status.attrs[ATTR::STR] * 300; if (first & 1) { @@ -1431,18 +1280,6 @@ int pc_calcstatus(struct map_session_data *sd, int first) sd->magic_damage_return = 0; //AppleGirl Was Here sd->random_attack_increase_add = sd->random_attack_increase_per = 0; - if (!sd->disguiseflag && sd->disguise) - { - sd->disguise = 0; - pc_set_weapon_look(sd); - clif_changelook(&sd->bl, LOOK_SHIELD, sd->status.shield); - clif_changelook(&sd->bl, LOOK_HEAD_BOTTOM, sd->status.head_bottom); - clif_changelook(&sd->bl, LOOK_HEAD_TOP, sd->status.head_top); - clif_changelook(&sd->bl, LOOK_HEAD_MID, sd->status.head_mid); - clif_clearchar(&sd->bl, 9); - pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3); - } - sd->spellpower_bonus_target = 0; for (EQUIP i : EQUIPs_noarrow) @@ -1828,17 +1665,17 @@ int pc_calcstatus(struct map_session_data *sd, int first) // 二刀流 ASPD 修正 if (sd->status.weapon <= 16) - sd->aspd += aspd_base[s_class.job][sd->status.weapon] + sd->aspd += aspd_base[0][sd->status.weapon] - (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX]) - * aspd_base[s_class.job][sd->status.weapon] / 1000; + * aspd_base[0][sd->status.weapon] / 1000; else sd->aspd += ( - (aspd_base[s_class.job][sd->weapontype1] + (aspd_base[0][sd->weapontype1] - (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX]) - * aspd_base[s_class.job][sd->weapontype1] / 1000) - + (aspd_base[s_class.job][sd->weapontype2] + * aspd_base[0][sd->weapontype1] / 1000) + + (aspd_base[0][sd->weapontype2] - (sd->paramc[ATTR::AGI] * 4 + sd->paramc[ATTR::DEX]) - * aspd_base[s_class.job][sd->weapontype2] / 1000) + * aspd_base[0][sd->weapontype2] / 1000) ) * 140 / 200; @@ -1871,12 +1708,10 @@ int pc_calcstatus(struct map_session_data *sd, int first) sd->status.max_hp += ( 3500 - + bl * hp_coefficient2[s_class.job] - + hp_sigma_val[s_class.job][(bl > 0) ? bl - 1 : 0] + + bl * hp_coefficient2[0] + + hp_sigma_val[0][(bl > 0) ? bl - 1 : 0] ) / 100 * (100 + sd->paramc[ATTR::VIT]) / 100 + (sd->parame[ATTR::VIT] - sd->paramcard[ATTR::VIT]); - if (s_class.upper == 1) // [MouseJstr] - sd->status.max_hp = sd->status.max_hp * 130 / 100; if (sd->hprate != 100) sd->status.max_hp = sd->status.max_hp * sd->hprate / 100; @@ -1889,10 +1724,6 @@ int pc_calcstatus(struct map_session_data *sd, int first) if (sd->status.hp > battle_config.max_hp) // removed negative max hp bug by Valaris sd->status.hp = battle_config.max_hp; } - if (s_class.job == 23 && sd->status.base_level >= 99) - { - sd->status.max_hp = sd->status.max_hp + 2000; - } if (sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris sd->status.max_hp = battle_config.max_hp; @@ -1900,11 +1731,9 @@ int pc_calcstatus(struct map_session_data *sd, int first) sd->status.max_hp = 1; // end // 最大SP計算 - sd->status.max_sp += ((sp_coefficient[s_class.job] * bl) + 1000) + sd->status.max_sp += ((sp_coefficient[0] * bl) + 1000) / 100 * (100 + sd->paramc[ATTR::INT]) / 100 + (sd->parame[ATTR::INT] - sd->paramcard[ATTR::INT]); - if (s_class.upper == 1) // [MouseJstr] - sd->status.max_sp = sd->status.max_sp * 130 / 100; if (sd->sprate != 100) sd->status.max_sp = sd->status.max_sp * sd->sprate / 100; @@ -2197,10 +2026,7 @@ int pc_calcstatus(struct map_session_data *sd, int first) if (sd->sc_data[SC_EXPLOSIONSPIRITS].timer != -1) { // 爆裂波動 - if (s_class.job == 23) - sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val1 * 100; - else - sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val2; + sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val2; } if (sd->sc_data[SC_STEELBODY].timer != -1) @@ -2277,12 +2103,6 @@ int pc_calcstatus(struct map_session_data *sd, int first) return 0; } - if (b_class != sd->view_class) - { - clif_changelook(&sd->bl, LOOK_BASE, sd->view_class); - clif_changelook(&sd->bl, LOOK_WEAPON, 0); - } - if (memcmp(&b_skill, &sd->status.skill, sizeof(sd->status.skill)) || b_attackrange != sd->attackrange) clif_skillinfoblock(sd); // スキル送信 @@ -2710,14 +2530,6 @@ int pc_bonus(struct map_session_data *sd, SP type, int val) sd->perfect_hiding = 1; } break; - case SP_DISGUISE: // Disguise script for items [Valaris] - if (sd->state.lr_flag != 2 && sd->disguiseflag == 0) - { - sd->disguise = val; - clif_clearchar(&sd->bl, 9); - pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3); - } - break; case SP_UNBREAKABLE: if (sd->state.lr_flag != 2) { @@ -3650,7 +3462,7 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y int clrtype) { char mapname[24]; - int m = 0, c = 0, disguise = 0; + int m = 0, c = 0; nullpo_ret(sd); @@ -3685,13 +3497,6 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y if (sd->sc_data[SC_DANCING].timer != -1) // clear dance effect when warping [Valaris] skill_stop_dancing(&sd->bl, 0); - if (sd->disguise) - { // clear disguises when warping [Valaris] - clif_clearchar(&sd->bl, 9); - disguise = sd->disguise; - sd->disguise = 0; - } - memcpy(mapname, mapname_org, 24); mapname[16] = 0; if (strstr(mapname, ".gat") == NULL && strlen(mapname) < 16) @@ -3761,9 +3566,6 @@ int pc_setpos(struct map_session_data *sd, const char *mapname_org, int x, int y clif_changemap(sd, map[m].name, x, y); // [MouseJstr] } - if (disguise) // disguise teleport fix [Valaris] - sd->disguise = disguise; - memcpy(sd->mapname, mapname, 24); sd->bl.m = m; sd->to_x = x; @@ -4264,56 +4066,6 @@ int pc_checkequip(struct map_session_data *sd, EPOS pos) } /*========================================== - * 転生職や養子職の元の職業を返す - *------------------------------------------ - */ -struct pc_base_job pc_calc_base_job(int b_class) -{ - struct pc_base_job bj; - //転生や養子の場合の元の職業を算出する - if (b_class < MAX_PC_CLASS) - { //通常 - bj.job = b_class; - bj.upper = 0; - } - else if (b_class >= 4001 && b_class < 4023) - { //転生職 - bj.job = b_class - 4001; - bj.upper = 1; - } - else if (b_class == 23 + 4023 - 1) - { //養子スパノビ - bj.job = b_class - (4023 - 1); - bj.upper = 2; - } - else - { //養子スパノビ以外の養子 - bj.job = b_class - 4023; - bj.upper = 2; - } - - if (battle_config.enable_upper_class == 0) - { //confで無効になっていたらupper=0 - bj.upper = 0; - } - - if (bj.job == 0) - { - bj.type = 0; - } - else if (bj.job < 7) - { - bj.type = 1; - } - else - { - bj.type = 2; - } - - return bj; -} - -/*========================================== * PCの攻撃 (timer関数) *------------------------------------------ */ @@ -4710,29 +4462,12 @@ int pc_extract_healer_exp(struct map_session_data *sd, int max) */ int pc_nextbaseexp(struct map_session_data *sd) { - int i; - nullpo_ret(sd); if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0) return 0; - if (sd->status.pc_class == 0) - i = 0; - else if (sd->status.pc_class <= 6) - i = 1; - else if (sd->status.pc_class <= 22) - i = 2; - else if (sd->status.pc_class == 23) - i = 3; - else if (sd->status.pc_class == 4001) - i = 4; - else if (sd->status.pc_class <= 4007) - i = 5; - else - i = 6; - - return exp_table[i][sd->status.base_level - 1]; + return exp_table[0][sd->status.base_level - 1]; } /*========================================== @@ -4755,29 +4490,12 @@ int pc_nextjobexp(struct map_session_data *sd) */ int pc_nextbaseafter(struct map_session_data *sd) { - int i; - nullpo_ret(sd); if (sd->status.base_level >= MAX_LEVEL || sd->status.base_level <= 0) return 0; - if (sd->status.pc_class == 0) - i = 0; - else if (sd->status.pc_class <= 6) - i = 1; - else if (sd->status.pc_class <= 22) - i = 2; - else if (sd->status.pc_class == 23) - i = 3; - else if (sd->status.pc_class == 4001) - i = 4; - else if (sd->status.pc_class <= 4007) - i = 5; - else - i = 6; - - return exp_table[i][sd->status.base_level]; + return exp_table[0][sd->status.base_level]; } /*========================================== @@ -4786,36 +4504,19 @@ int pc_nextbaseafter(struct map_session_data *sd) */ int pc_nextjobafter(struct map_session_data *sd) { - int i; - nullpo_ret(sd); if (sd->status.job_level >= MAX_LEVEL || sd->status.job_level <= 0) return 0; - if (sd->status.pc_class == 0) - i = 7; - else if (sd->status.pc_class <= 6) - i = 8; - else if (sd->status.pc_class <= 22) - i = 9; - else if (sd->status.pc_class == 23) - i = 10; - else if (sd->status.pc_class == 4001) - i = 11; - else if (sd->status.pc_class <= 4007) - i = 12; - else - i = 13; - - return exp_table[i][sd->status.job_level]; + return exp_table[7][sd->status.job_level]; } /*========================================== - * 必要ステータスポイント計算 *------------------------------------------ */ +// TODO: replace SP by ATTR int pc_need_status_point(struct map_session_data *sd, SP type) { int val; @@ -4925,23 +4626,15 @@ int pc_skillup(struct map_session_data *sd, SkillID skill_num) */ int pc_allskillup(struct map_session_data *sd) { - int c = 0, s = 0; - //転生や養子の場合の元の職業を算出する - struct pc_base_job s_class; - nullpo_ret(sd); - s_class = pc_calc_base_job(sd->status.pc_class); - c = s_class.job; - s = (s_class.upper == 1) ? 1 : 0; //転生以外は通常のスキル? - for (SkillID i : erange(SkillID(), MAX_SKILL)) sd->status.skill[i].id = SkillID::ZERO; { SkillID id; for (int i = 0; - (id = skill_tree[s][c][i].id) != SkillID::ZERO + (id = skill_tree[0][0][i].id) != SkillID::ZERO && id != SkillID::NEGATIVE; i++) { @@ -4979,8 +4672,6 @@ int pc_resetlvl(struct map_session_data *sd, int type) for (ATTR attr : ATTRs) sd->status.attrs[attr] = 1; - if (sd->status.pc_class == 4001) - sd->status.status_point = 100; } if (type == 2) @@ -5103,12 +4794,9 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, int damage) { int i = 0, j = 0; - struct pc_base_job s_class; nullpo_ret(sd); - //転生や養子の場合の元の職業を算出する - s_class = pc_calc_base_job(sd->status.pc_class); // 既に死んでいたら無効 if (pc_isdead(sd)) return 0; @@ -5373,9 +5061,6 @@ int pc_damage(struct block_list *src, struct map_session_data *sd, int pc_readparam(struct map_session_data *sd, SP type) { int val = 0; - struct pc_base_job s_class; - - s_class = pc_calc_base_job(sd->status.pc_class); nullpo_ret(sd); @@ -5397,13 +5082,7 @@ int pc_readparam(struct map_session_data *sd, SP type) val = sd->status.job_level; break; case SP_CLASS: - if (val >= 24 && val < 45) - val += 3978; - else - val = sd->status.pc_class; - break; - case SP_UPPER: - val = s_class.upper; + val = sd->status.species; break; case SP_SEX: val = sd->sex; @@ -5461,12 +5140,9 @@ int pc_readparam(struct map_session_data *sd, SP type) int pc_setparam(struct map_session_data *sd, SP type, int val) { int i = 0, up_level = 50; - struct pc_base_job s_class; nullpo_ret(sd); - s_class = pc_calc_base_job(sd->status.pc_class); - switch (type) { case SP_BASELEVEL: @@ -5486,11 +5162,7 @@ int pc_setparam(struct map_session_data *sd, SP type, int val) pc_heal(sd, sd->status.max_hp, sd->status.max_sp); break; case SP_JOBLEVEL: - if (sd->status.pc_class == 0) - up_level -= 40; - if ((sd->status.pc_class == 23) - || (sd->status.pc_class >= 4001 && sd->status.pc_class <= 4022)) - up_level += 20; + up_level -= 40; if (val >= sd->status.job_level) { if (val > up_level) @@ -5843,105 +5515,6 @@ int pc_percentheal(struct map_session_data *sd, int hp, int sp) } /*========================================== - * 職変更 - * 引数 job 職業 0〜23 - * upper 通常 0, 転生 1, 養子 2, そのまま -1 - *------------------------------------------ - */ -int pc_jobchange(struct map_session_data *sd, int job, int upper) -{ - int b_class = 0; - //転生や養子の場合の元の職業を算出する - struct pc_base_job s_class = pc_calc_base_job(sd->status.pc_class); - - nullpo_ret(sd); - - if ((job > 23) && (job < 68)) - job += 3977; - - if ((job > 69) && (job < 4000)) - return 1; - - if (upper < 0) //現在転生かどうかを判断する - upper = s_class.upper; - - if (upper == 0) - { //通常職ならjobそのまんま - b_class = job; - } - else if (upper == 1) - { - if (job == 23) - { //転生にスパノビは存在しないのでお断り - return 1; - } - else - { - b_class = job + 4001; - } - } - else if (upper == 2) - { //養子に結婚はないけどどうせ次で蹴られるからいいや - b_class = (job == 23) ? job + 4022 : job + 4023; - } - else - { - return 1; - } - - if ((sd->status.sex == 0 && job == 19) || (sd->status.sex == 1 && job == 20) || - (sd->status.sex == 0 && job == 4020) || (sd->status.sex == 1 && job == 4021) || - job == 22 || sd->status.pc_class == b_class) //♀はバードになれない、♂はダンサーになれない、結婚衣裳もお断り - return 1; - - sd->status.pc_class = sd->view_class = b_class; - - sd->status.job_level = 1; - sd->status.job_exp = 0; - clif_updatestatus(sd, SP_JOBLEVEL); - clif_updatestatus(sd, SP_JOBEXP); - clif_updatestatus(sd, SP_NEXTJOBEXP); - - for (EQUIP i : EQUIPs) - { - if (sd->equip_index[i] >= 0) - if (!pc_isequip(sd, sd->equip_index[i])) - pc_unequipitem(sd, sd->equip_index[i], CalcStatus::LATER); // 装備外し - } - - clif_changelook(&sd->bl, LOOK_BASE, sd->view_class); // move sprite update to prevent client crashes with incompatible equipment [Valaris] - if (sd->status.clothes_color > 0) - clif_changelook(&sd->bl, LOOK_CLOTHES_COLOR, - sd->status.clothes_color); - - pc_calcstatus(sd, 0); - pc_checkallowskill(sd); - pc_equiplookall(sd); - clif_equiplist(sd); - - return 0; -} - -/*========================================== - * 見た目変更 - *------------------------------------------ - */ -int pc_equiplookall(struct map_session_data *sd) -{ - nullpo_ret(sd); - - clif_changelook(&sd->bl, LOOK_WEAPON, 0); -// clif_changelook(&sd->bl,LOOK_SHOES,0); - clif_changelook(&sd->bl, LOOK_HEAD_BOTTOM, sd->status.head_bottom); - clif_changelook(&sd->bl, LOOK_HEAD_TOP, sd->status.head_top); - clif_changelook(&sd->bl, LOOK_HEAD_MID, sd->status.head_mid); - - clif_changelook_accessories(&sd->bl, NULL); - - return 0; -} - -/*========================================== * 見た目変更 *------------------------------------------ */ @@ -6514,20 +6087,6 @@ int pc_equipitem(struct map_session_data *sd, int n, EPOS) pos = (epor == EPOS::CAPE ? EPOS::MISC2 : EPOS::CAPE); } - // 二刀流処理 - if ((pos == (EPOS::SHIELD | EPOS::WEAPON)) // 一応、装備要求箇所が二刀流武器かチェックする - && (id->equip == EPOS::WEAPON) // 単 手武器 - && (sd->status.pc_class == 12)) // 左手修錬有 - { - EPOS tpos = EPOS::ZERO; - if (sd->equip_index[EQUIP::SHIELD] >= 0) - tpos |= sd->status.inventory[sd->equip_index[EQUIP::SHIELD]].equip; - if (sd->equip_index[EQUIP::WEAPON] >= 0) - tpos |= sd->status.inventory[sd->equip_index[EQUIP::WEAPON]].equip; - tpos &= EPOS::WEAPON; - pos = tpos == EPOS::WEAPON ? EPOS::SHIELD : EPOS::WEAPON; - } - // TODO: make this code do what it's supposed to do, // instead of what it does arrow = pc_search_inventory(sd, pc_checkequip(sd, EPOS::LEGS | EPOS::CAPE)); // Added by RoVeRT @@ -7222,11 +6781,7 @@ int pc_natural_heal_sp(struct map_session_data *sd) if (sd->inchealsptick >= battle_config.natural_heal_skill_interval && sd->status.sp < sd->status.max_sp) { - struct pc_base_job s_class = pc_calc_base_job(sd->status.pc_class); - if (sd->doridori_counter && s_class.job == 23) - bonus = sd->nshealsp * 2; - else - bonus = sd->nshealsp; + bonus = sd->nshealsp; sd->doridori_counter = 0; while (sd->inchealsptick >= battle_config.natural_heal_skill_interval) diff --git a/src/map/pc.hpp b/src/map/pc.hpp index 83c3309..56a6f1c 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -132,7 +132,6 @@ int pc_damage(struct block_list *, struct map_session_data *, int); int pc_heal(struct map_session_data *, int, int); int pc_itemheal(struct map_session_data *sd, int hp, int sp); int pc_percentheal(struct map_session_data *sd, int, int); -int pc_jobchange(struct map_session_data *, int, int); int pc_setoption(struct map_session_data *, Option); int pc_changelook(struct map_session_data *, LOOK, int); @@ -168,15 +167,6 @@ int pc_set_gm_level(int account_id, int level); void pc_setstand(struct map_session_data *sd); void pc_cleanup(struct map_session_data *sd); // [Fate] Clean up after a logged-out PC -struct pc_base_job -{ - int job; //職業、ただし転生職や養子職の場合は元の職業を返す(廃プリ→プリ) - int type; //ノビ 0, 一次職 1, 二次職 2, スパノビ 3 - int upper; //通常 0, 転生 1, 養子 2 -}; - -struct pc_base_job pc_calc_base_job(int b_class); //転生や養子職の元の職業を返す - int pc_read_gm_account(int fd); int pc_setinvincibletimer(struct map_session_data *sd, int); int pc_delinvincibletimer(struct map_session_data *sd); diff --git a/src/map/script.cpp b/src/map/script.cpp index d8c7c51..e774080 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -3307,15 +3307,11 @@ void builtin_changesex(ScriptState *st) { sd->status.sex = 1; sd->sex = 1; - if (sd->status.pc_class == 20 || sd->status.pc_class == 4021) - sd->status.pc_class -= 1; } else if (sd->status.sex == 1) { sd->status.sex = 0; sd->sex = 0; - if (sd->status.pc_class == 19 || sd->status.pc_class == 4020) - sd->status.pc_class += 1; } chrif_char_ask_name(-1, sd->status.name, 5, 0, 0, 0, 0, 0, 0); // type: 5 - changesex chrif_save(sd); diff --git a/src/map/skill.cpp b/src/map/skill.cpp index 725bdb8..aef0712 100644 --- a/src/map/skill.cpp +++ b/src/map/skill.cpp @@ -1740,16 +1740,9 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, { int heal = skill_calc_heal(src, skilllv); int heal_get_jobexp; - struct pc_base_job s_class; if (dstsd && dstsd->special_state.no_magic_damage) heal = 0; /* 黄金蟲カード(ヒール量0) */ - if (sd) - { - s_class = pc_calc_base_job(sd->status.pc_class); - if (sd && dstsd && sd->status.partner_id == dstsd->status.char_id && s_class.job == 23 && sd->status.sex == 0) //自分も対象もPC、対象が自分のパートナー、自分がスパノビ、自分が♀なら - heal = heal * 2; //スパノビの嫁が旦那にヒールすると2倍になる - } heal_get_jobexp = battle_heal(NULL, bl, heal, 0, 0); |