diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 30 | ||||
-rw-r--r-- | src/map/battle.c | 438 | ||||
-rw-r--r-- | src/map/buyingstore.c | 4 | ||||
-rw-r--r-- | src/map/chrif.c | 190 | ||||
-rw-r--r-- | src/map/chrif.h | 104 | ||||
-rw-r--r-- | src/map/clif.c | 28 | ||||
-rw-r--r-- | src/map/intif.c | 16 | ||||
-rw-r--r-- | src/map/map.c | 40 | ||||
-rw-r--r-- | src/map/npc.c | 3 | ||||
-rw-r--r-- | src/map/packets_struct.h | 3 | ||||
-rw-r--r-- | src/map/party.c | 7 | ||||
-rw-r--r-- | src/map/pc.c | 31 | ||||
-rw-r--r-- | src/map/pet.c | 2 | ||||
-rw-r--r-- | src/map/quest.c | 8 | ||||
-rw-r--r-- | src/map/script.c | 2 | ||||
-rw-r--r-- | src/map/skill.c | 96 | ||||
-rw-r--r-- | src/map/status.c | 51 | ||||
-rw-r--r-- | src/map/status.h | 10 | ||||
-rw-r--r-- | src/map/storage.c | 12 | ||||
-rw-r--r-- | src/map/trade.c | 10 | ||||
-rw-r--r-- | src/map/vending.c | 4 |
21 files changed, 652 insertions, 437 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b199a63dc..f1b4a3ed6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -745,7 +745,7 @@ ACMD(save) if (sd->status.pet_id > 0 && sd->pd) intif_save_petdata(sd->status.account_id, &sd->pd->pet); - chrif_save(sd,0); + chrif->save(sd,0); clif->message(fd, msg_txt(6)); // Your save point has been changed. @@ -2745,7 +2745,7 @@ ACMD(char_block) return false; } - chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block + chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return true; @@ -2842,7 +2842,7 @@ ACMD(char_ban) return false; } - chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 2, year, month, day, hour, minute, second); // type: 2 - ban + chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 2, year, month, day, hour, minute, second); // type: 2 - ban clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return true; @@ -2863,7 +2863,7 @@ ACMD(char_unblock) } // send answer to login server via char-server - chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock + chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return true; @@ -2884,7 +2884,7 @@ ACMD(char_unban) } // send answer to login server via char-server - chrif_char_ask_name(sd->status.account_id, atcmd_player_name, 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban + chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it. return true; @@ -3688,7 +3688,7 @@ ACMD(reloadbattleconf) ) { // Exp or Drop rates changed. mob_reload(); //Needed as well so rate changes take effect. - chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); + chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); } clif->message(fd, msg_txt(255)); return true; @@ -5010,7 +5010,7 @@ ACMD(email) return false; } - chrif_changeemail(sd->status.account_id, actual_email, new_email); + chrif->changeemail(sd->status.account_id, actual_email, new_email); clif->message(fd, msg_txt(148)); // Information sended to login-server via char-server. return true; } @@ -6513,7 +6513,7 @@ ACMD(changesex) // to avoid any problem with equipment and invalid sex, equipment is unequiped. for( i=0; i<EQI_MAX; i++ ) if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3); - chrif_changesex(sd); + chrif->changesex(sd); return true; } @@ -9047,11 +9047,17 @@ ACMD(channel) { return false; } - if( sub2[0] == '\0' || ( pl_sd = iMap->nick2sd(sub2) ) == NULL ) { - sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found - clif->message(fd, atcmd_output); - return false; + if (!message || !*message || sscanf(message, "%s %s %24[^\n]", key, sub1, sub2) < 1) { + sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found + clif->message(fd, atcmd_output); + return false; } + + if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) { + sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found + clif->message(fd, atcmd_output); + return false; + } if( pc_has_permission(pl_sd, PC_PERM_HCHSYS_ADMIN) ) { clif->message(fd, msg_txt(1464)); // Ban failed, not possible to ban this user. diff --git a/src/map/battle.c b/src/map/battle.c index 9e65146e2..d67684e7b 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -429,18 +429,19 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin damage = battle->calc_sizefix(sd, damage, EQI_HAND_R, size, flag&8); else damage = battle->calc_sizefix(sd, damage, EQI_HAND_L, size, flag&8); + + if( flag&2 && sd->bonus.arrow_atk ) + damage += sd->bonus.arrow_atk; if( sd->bonus.eatk > 0 ) eatk = sd->bonus.eatk; - if( flag&2 && sd->bonus.arrow_atk ) - eatk += sd->bonus.arrow_atk; } - + if( sc && sc->count ){ if( sc->data[SC_ZENKAI] && watk->ele == sc->data[SC_ZENKAI]->val2 ) eatk += 200; #ifdef RENEWAL_EDP - if( sc->data[SC_EDP] && skill_id != AS_GRIMTOOTH && skill_id != AS_VENOMKNIFE ){ + if( sc->data[SC_EDP] && skill_id != AS_GRIMTOOTH && skill_id != AS_VENOMKNIFE && skill_id != ASC_BREAKER ){ eatk = eatk * sc->data[SC_EDP]->val3 / 100; // 400% damage = damage * sc->data[SC_EDP]->val4 / 100; // 500% damage--; // temporary until we find the correct formula [malufett] @@ -448,19 +449,14 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin #endif } - /* [malufett] - some unknown factors that needs to be discovered. PS: it's something related with ranged attacks - if( eatk ){ - eatk += unknown value; - eatk = eatk * (unknown value) / 100; + if( skill_id != ASC_METEORASSAULT ){ + if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) // Temporary. [malufett] + damage += damage * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; } - */ - if( sc && sc->data[SC_WATK_ELEMENT] ) - damage = damage + eatk; - else - damage = battle->calc_elefix(src, bl, skill_id, skill_lv, damage + eatk, nk, n_ele, s_ele, s_ele_, false, flag); - + // Temporary. [malufett] + damage = battle->calc_elefix(src, bl, skill_id, skill_lv, damage, nk, n_ele, s_ele, s_ele_, type == EQI_HAND_L, flag); + /** * In RE Shield Bommerang takes weapon element only for damage calculation, * - resist calculation is always against neutral @@ -468,11 +464,12 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin if ( skill_id == CR_SHIELDBOOMERANG ) s_ele = s_ele_ = ELE_NEUTRAL; - if( type == EQI_HAND_R ) - damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 2, flag2); - else - damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 3, flag2); + // attacker side + damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 2|(type == EQI_HAND_L), flag2); + // target side + damage = battle->calc_cardfix(BF_WEAPON, src, bl, nk, s_ele, s_ele_, damage, 0, flag2); + return damage; } #endif @@ -488,18 +485,13 @@ int battle_calc_weapon_damage(struct block_list *src, struct block_list *bl, uin * &8: Skip target size adjustment (Extremity Fist?) *&16: Arrow attack but BOW, REVOLVER, RIFLE, SHOTGUN, GATLING or GRENADE type weapon not equipped (i.e. shuriken, kunai and venom knives not affected by DEX) */ - #ifdef RENEWAL int battle_calc_base_damage(struct block_list *src, struct block_list *bl, uint16 skill_id, uint16 skill_lv, int nk, bool n_ele, short s_ele, short s_ele_, int type, int flag, int flag2) { int damage, batk; - struct status_change *sc = status_get_sc(src); struct status_data *status = status_get_status_data(src); - if( sc && sc->data[SC_TK_SEVENWIND] && !sc->data[SC_WATK_ELEMENT] ) - batk = battle->calc_elefix(src, bl, skill_id, skill_lv, status->batk, nk, n_ele, s_ele, s_ele_, false, flag); - else - batk = status->batk; + batk = battle->calc_elefix(src, bl, skill_id, skill_lv, status_calc_batk(bl, status_get_sc(src), status->batk, false), nk, n_ele, ELE_NEUTRAL, ELE_NEUTRAL, false, flag); if( type == EQI_HAND_L ) damage = batk + 3 * battle->calc_weapon_damage(src, bl, skill_id, skill_lv, &status->lhw, nk, n_ele, s_ele, s_ele_, status_get_size(bl), type, flag, flag2) / 4; @@ -732,13 +724,19 @@ int battle_calc_masteryfix(struct block_list *src, struct block_list *target, ui case CR_ACIDDEMONSTRATION: return damage; case NJ_SYURIKEN: - if( (skill = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0 && weapon ) + if( (skill = pc->checkskill(sd,NJ_TOBIDOUGU)) > 0 +#ifndef RENEWAL + && weapon +#endif + ) damage += 3 * skill; break; +#ifndef RENEWAL case NJ_KUNAI: if( weapon ) damage += 60; break; +#endif case RA_WUGDASH: case RA_WUGSTRIKE: case RA_WUGBITE: @@ -816,35 +814,26 @@ int battle_calc_elefix(struct block_list *src, struct block_list *target, uint16 damage += battle_attr_fix(src,target,50*skill_lv,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv); } } - if( sc && sc->data[SC_WATK_ELEMENT] ) - { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex] - damage = #ifndef RENEWAL - battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) -#else - battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) -#endif - * sc->data[SC_WATK_ELEMENT]->val2 / 100; - - damage += battle->attr_fix(src, target, damage, sc->data[SC_WATK_ELEMENT]->val1, tstatus->def_ele, tstatus->ele_lv); + if( sc && sc->data[SC_SUB_WEAPONPROPERTY] ) + { // Descriptions indicate this means adding a percent of a normal attack in another element. [Skotlex] + damage = battle->calc_base_damage(sstatus, &sstatus->rhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; + damage += battle->attr_fix(src, target, damage, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv); if( left ){ - damage = -#ifndef RENEWAL - battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) -#else - battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, (flag?2:0)|(sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), 0) -#endif - * sc->data[SC_WATK_ELEMENT]->val2 / 100; - damage += battle->attr_fix(src, target, damage, sc->data[SC_WATK_ELEMENT]->val1, tstatus->def_ele, tstatus->ele_lv); + damage = battle->calc_base_damage(sstatus, &sstatus->lhw, sc, tstatus->size, BL_CAST(BL_PC, src), (flag?2:0)) * sc->data[SC_SUB_WEAPONPROPERTY]->val2 / 100; + damage += battle->attr_fix(src, target, damage, sc->data[SC_SUB_WEAPONPROPERTY]->val1, tstatus->def_ele, tstatus->ele_lv); } } - +#endif return damage; } /*========================================== * Calculates card bonuses damage adjustments. + * cflag(cardfix flag): + * &1 - calc for left hand. + * &2 - atker side cardfix(BF_WEAPON) otherwise target side(BF_WEAPON). *------------------------------------------*/ -int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int left, int flag){ +int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int cflag, int wflag){ struct map_session_data *sd, *tsd; short cardfix = 1000, t_class, s_class, s_race2, t_race2; struct status_data *sstatus, *tstatus; @@ -863,19 +852,19 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li sstatus = status_get_status_data(src); tstatus = status_get_status_data(target); s_race2 = status_get_race2(src); - + switch(attack_type){ case BF_MAGIC: if ( sd && !(nk&NK_NO_CARDFIX_ATK) ) { - cardfix=cardfix*(100+sd->magic_addrace[tstatus->race])/100; + cardfix = cardfix * (100 + sd->magic_addrace[tstatus->race]) / 100; if (!(nk&NK_NO_ELEFIX)) - cardfix=cardfix*(100+sd->magic_addele[tstatus->def_ele])/100; - cardfix=cardfix*(100+sd->magic_addsize[tstatus->size])/100; - cardfix=cardfix*(100+sd->magic_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100; - cardfix=cardfix*(100+sd->magic_atk_ele[s_ele])/100; - for(i=0; i< ARRAYLENGTH(sd->add_mdmg) && sd->add_mdmg[i].rate;i++) { + cardfix = cardfix*(100+sd->magic_addele[tstatus->def_ele]) / 100; + cardfix = cardfix * (100 + sd->magic_addsize[tstatus->size]) / 100; + cardfix = cardfix * (100 + sd->magic_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; + cardfix = cardfix * (100 + sd->magic_atk_ele[s_ele])/100; + for(i=0; i< ARRAYLENGTH(sd->add_mdmg) && sd->add_mdmg[i].rate; i++) { if(sd->add_mdmg[i].class_ == t_class) { - cardfix=cardfix*(100+sd->add_mdmg[i].rate)/100; + cardfix = cardfix * (100 + sd->add_mdmg[i].rate) / 100; break; } } @@ -891,29 +880,29 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) { if(tsd->subele2[i].ele != s_ele) continue; - if(!(tsd->subele2[i].flag&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) + if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && + tsd->subele2[i].flag&wflag&BF_RANGEMASK && + tsd->subele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix += tsd->subele2[i].rate; } - cardfix=cardfix*(100-ele_fix)/100; + cardfix = cardfix * (100 - ele_fix) / 100; } - cardfix=cardfix*(100-tsd->subsize[sstatus->size])/100; - cardfix=cardfix*(100-tsd->subrace2[s_race2])/100; - cardfix=cardfix*(100-tsd->subrace[sstatus->race])/100; - cardfix=cardfix*(100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS])/100; + cardfix = cardfix * (100 - tsd->subsize[sstatus->size]) / 100; + cardfix = cardfix * (100 - tsd->subrace2[s_race2]) / 100; + cardfix = cardfix * (100 - tsd->subrace[sstatus->race]) / 100; + cardfix = cardfix * (100 - tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS]) / 100; if( sstatus->race != RC_DEMIHUMAN ) - cardfix=cardfix*(100-tsd->subrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100-tsd->subrace[RC_NONDEMIHUMAN]) / 100; for(i=0; i < ARRAYLENGTH(tsd->add_mdef) && tsd->add_mdef[i].rate;i++) { if(tsd->add_mdef[i].class_ == s_class) { - cardfix=cardfix*(100-tsd->add_mdef[i].rate)/100; + cardfix = cardfix * (100-tsd->add_mdef[i].rate) / 100; break; } } //It was discovered that ranged defense also counts vs magic! [Skotlex] - if ( flag&BF_SHORT ) + if ( wflag&BF_SHORT ) cardfix = cardfix * ( 100 - tsd->bonus.near_attack_def_rate ) / 100; else cardfix = cardfix * ( 100 - tsd->bonus.long_attack_def_rate ) / 100; @@ -923,78 +912,78 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li if( tsd->sc.data[SC_PROTECT_MDEF] ) cardfix = cardfix * ( 100 - tsd->sc.data[SC_PROTECT_MDEF]->val1 ) / 100; - if (cardfix != 1000) + if( cardfix != 1000 ) damage = damage * cardfix / 1000; } break; case BF_WEAPON: t_race2 = status_get_race2(target); - if( sd && !(nk&NK_NO_CARDFIX_ATK) && (left&2) ) + if( cflag&2 && sd && !(nk&NK_NO_CARDFIX_ATK) ) { short cardfix_ = 1000; if(sd->state.arrow_atk) { - cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race]+sd->arrow_addrace[tstatus->race])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->arrow_addrace[tstatus->race]) / 100; if (!(nk&NK_NO_ELEFIX)) { int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->arrow_addele[tstatus->def_ele]; for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->right_weapon.addele2[i].flag&flag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix += sd->right_weapon.addele2[i].rate; } - cardfix=cardfix*(100+ele_fix)/100; + cardfix = cardfix * (100 + ele_fix) / 100; } - cardfix=cardfix*(100+sd->right_weapon.addsize[tstatus->size]+sd->arrow_addsize[tstatus->size])/100; - cardfix=cardfix*(100+sd->right_weapon.addrace2[t_race2])/100; - cardfix=cardfix*(100+sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]+sd->arrow_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100; + cardfix = cardfix * (100 + sd->right_weapon.addsize[tstatus->size]+sd->arrow_addsize[tstatus->size]) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addrace2[t_race2]) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->arrow_addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) - cardfix=cardfix*(100+sd->right_weapon.addrace[RC_NONDEMIHUMAN]+sd->arrow_addrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]+sd->arrow_addrace[RC_NONDEMIHUMAN]) / 100; } else { // Melee attack if( !battle_config.left_cardfix_to_right ) { - cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race])/100; + cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race])/100; if (!(nk&NK_NO_ELEFIX)) { int ele_fix = sd->right_weapon.addele[tstatus->def_ele]; for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->right_weapon.addele2[i].flag&flag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix += sd->right_weapon.addele2[i].rate; } - cardfix=cardfix*(100+ele_fix)/100; + cardfix = cardfix * (100+ele_fix) / 100; } - cardfix=cardfix*(100+sd->right_weapon.addsize[tstatus->size])/100; - cardfix=cardfix*(100+sd->right_weapon.addrace2[t_race2])/100; - cardfix=cardfix*(100+sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100; + cardfix = cardfix * (100+sd->right_weapon.addsize[tstatus->size]) / 100; + cardfix = cardfix * (100+sd->right_weapon.addrace2[t_race2]) / 100; + cardfix = cardfix * (100+sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) - cardfix=cardfix*(100+sd->right_weapon.addrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[RC_NONDEMIHUMAN]) / 100; - if( left&1 ) + if( cflag&1 ) { - cardfix_=cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; + cardfix_=cardfix_*(100+sd->left_weapon.addrace[tstatus->race])/100; if (!(nk&NK_NO_ELEFIX)) { - int ele_fix_lh = sd->left_weapon.addele[tstatus->def_ele]; + int ele_fix_lh = sd->left_weapon.addele[tstatus->def_ele]; for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++) { if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->left_weapon.addele2[i].flag&flag&BF_WEAPONMASK && - sd->left_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->left_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix_lh += sd->left_weapon.addele2[i].rate; } - cardfix=cardfix*(100+ele_fix_lh)/100; + cardfix = cardfix * (100+ele_fix_lh) / 100; } - cardfix_=cardfix_*(100+sd->left_weapon.addsize[tstatus->size])/100; - cardfix_=cardfix_*(100+sd->left_weapon.addrace2[t_race2])/100; - cardfix_=cardfix_*(100+sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100; + cardfix_ = cardfix_ * (100+sd->left_weapon.addsize[tstatus->size]) / 100; + cardfix_ = cardfix_ * (100+sd->left_weapon.addrace2[t_race2]) / 100; + cardfix_ = cardfix_ * (100+sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) cardfix_=cardfix_*(100+sd->left_weapon.addrace[RC_NONDEMIHUMAN])/100; } @@ -1002,114 +991,122 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li else { int ele_fix = sd->right_weapon.addele[tstatus->def_ele] + sd->left_weapon.addele[tstatus->def_ele]; - for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { + for (i = 0; ARRAYLENGTH(sd->right_weapon.addele2) > i && sd->right_weapon.addele2[i].rate != 0; i++) { if (sd->right_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->right_weapon.addele2[i].flag&flag&BF_WEAPONMASK && - sd->right_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->right_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + if(!(sd->right_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->right_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix += sd->right_weapon.addele2[i].rate; } for (i = 0; ARRAYLENGTH(sd->left_weapon.addele2) > i && sd->left_weapon.addele2[i].rate != 0; i++) { if (sd->left_weapon.addele2[i].ele != tstatus->def_ele) continue; - if(!(sd->left_weapon.addele2[i].flag&flag&BF_WEAPONMASK && - sd->left_weapon.addele2[i].flag&flag&BF_RANGEMASK && - sd->left_weapon.addele2[i].flag&flag&BF_SKILLMASK)) + if(!(sd->left_weapon.addele2[i].flag&wflag&BF_WEAPONMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_RANGEMASK && + sd->left_weapon.addele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix += sd->left_weapon.addele2[i].rate; } - cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race]+sd->left_weapon.addrace[tstatus->race])/100; - cardfix=cardfix*(100+ele_fix)/100; - cardfix=cardfix*(100+sd->right_weapon.addsize[tstatus->size]+sd->left_weapon.addsize[tstatus->size])/100; - cardfix=cardfix*(100+sd->right_weapon.addrace2[t_race2]+sd->left_weapon.addrace2[t_race2])/100; - cardfix=cardfix*(100+sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]+sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[tstatus->race] + sd->left_weapon.addrace[tstatus->race]) / 100; + cardfix = cardfix * (100 + ele_fix) / 100; + cardfix = cardfix * (100 + sd->right_weapon.addsize[tstatus->size] + sd->left_weapon.addsize[tstatus->size])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace2[t_race2] + sd->left_weapon.addrace2[t_race2])/100; + cardfix = cardfix * (100 + sd->right_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS] + sd->left_weapon.addrace[is_boss(target)?RC_BOSS:RC_NONBOSS]) / 100; if( tstatus->race != RC_DEMIHUMAN ) - cardfix=cardfix*(100+sd->right_weapon.addrace[RC_NONDEMIHUMAN]+sd->left_weapon.addrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100+sd->right_weapon.addrace[RC_NONDEMIHUMAN] + sd->left_weapon.addrace[RC_NONDEMIHUMAN]) / 100; } } + for( i = 0; i < ARRAYLENGTH(sd->right_weapon.add_dmg) && sd->right_weapon.add_dmg[i].rate; i++ ) { if( sd->right_weapon.add_dmg[i].class_ == t_class ) { - cardfix=cardfix*(100+sd->right_weapon.add_dmg[i].rate)/100; + cardfix = cardfix * (100 + sd->right_weapon.add_dmg[i].rate) / 100; break; } } - if( left&1 ) + if( cflag&1 ) { for( i = 0; i < ARRAYLENGTH(sd->left_weapon.add_dmg) && sd->left_weapon.add_dmg[i].rate; i++ ) { if( sd->left_weapon.add_dmg[i].class_ == t_class ) { - cardfix_=cardfix_*(100+sd->left_weapon.add_dmg[i].rate)/100; + cardfix_ = cardfix_ * (100 + sd->left_weapon.add_dmg[i].rate) / 100; break; } } } - if( flag&BF_LONG ) - cardfix = cardfix * ( 100 + sd->bonus.long_attack_atk_rate ) / 100; - if( (left&1) && cardfix_ != 1000 ) + if( wflag&BF_LONG ) + cardfix = cardfix * (100 + sd->bonus.long_attack_atk_rate) / 100; + + if( (cflag&1) && cardfix_ != 1000 ) damage = damage * cardfix_ / 1000; else if( cardfix != 1000 ) damage = damage * cardfix / 1000; - }else if( tsd && !(nk&NK_NO_CARDFIX_DEF) ){ - if( !(nk&NK_NO_ELEFIX) ) + break; // end Attacker side + } + // Target side + if( tsd && !(nk&NK_NO_CARDFIX_DEF) ) { - int ele_fix = tsd->subele[s_ele]; - for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) - { - if(tsd->subele2[i].ele != s_ele) continue; - if(!(tsd->subele2[i].flag&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) - continue; - ele_fix += tsd->subele2[i].rate; - } - cardfix=cardfix*(100-ele_fix)/100; - if( left&1 && s_ele_ != s_ele ) + if( !(nk&NK_NO_ELEFIX) ) { - int ele_fix_lh = tsd->subele[s_ele_]; + int ele_fix = tsd->subele[s_ele]; for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) { - if(tsd->subele2[i].ele != s_ele_) continue; - if(!(tsd->subele2[i].flag&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) + if(tsd->subele2[i].ele != s_ele) continue; + if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && + tsd->subele2[i].flag&wflag&BF_RANGEMASK && + tsd->subele2[i].flag&wflag&BF_SKILLMASK)) continue; - ele_fix_lh += tsd->subele2[i].rate; + ele_fix += tsd->subele2[i].rate; + } + cardfix=cardfix*(100-ele_fix)/100; + if( cflag&1 && s_ele_ != s_ele ) + { + int ele_fix_lh = tsd->subele[s_ele_]; + for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) + { + if(tsd->subele2[i].ele != s_ele_) continue; + if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && + tsd->subele2[i].flag&wflag&BF_RANGEMASK && + tsd->subele2[i].flag&wflag&BF_SKILLMASK)) + continue; + ele_fix_lh += tsd->subele2[i].rate; + } + cardfix = cardfix * (100 - ele_fix_lh) / 100; } - cardfix=cardfix*(100-ele_fix_lh)/100; } - } - cardfix=cardfix*(100-tsd->subsize[sstatus->size])/100; - cardfix=cardfix*(100-tsd->subrace2[s_race2])/100; - cardfix=cardfix*(100-tsd->subrace[sstatus->race])/100; - cardfix=cardfix*(100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS])/100; - if( sstatus->race != RC_DEMIHUMAN ) - cardfix=cardfix*(100-tsd->subrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100-tsd->subsize[sstatus->size]) / 100; + cardfix = cardfix * (100-tsd->subrace2[s_race2]) / 100; + cardfix = cardfix * (100-tsd->subrace[sstatus->race]) / 100; + cardfix = cardfix * (100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS]) / 100; + if( sstatus->race != RC_DEMIHUMAN ) + cardfix = cardfix * (100-tsd->subrace[RC_NONDEMIHUMAN]) / 100; - for( i = 0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++ ) { - if( tsd->add_def[i].class_ == s_class ) { - cardfix=cardfix*(100-tsd->add_def[i].rate)/100; - break; + for( i = 0; i < ARRAYLENGTH(tsd->add_def) && tsd->add_def[i].rate;i++ ) + { + if( tsd->add_def[i].class_ == s_class ) + { + cardfix = cardfix * (100 - tsd->add_def[i].rate) / 100; + break; + } } - } - if( flag&BF_SHORT ) - cardfix = cardfix * ( 100 - tsd->bonus.near_attack_def_rate ) / 100; - else // BF_LONG (there's no other choice) - cardfix = cardfix * ( 100 - tsd->bonus.long_attack_def_rate ) / 100; + if( wflag&BF_SHORT ) + cardfix = cardfix * (100 - tsd->bonus.near_attack_def_rate) / 100; + else // BF_LONG (there's no other choice) + cardfix = cardfix * (100 - tsd->bonus.near_attack_def_rate) / 100; - if( tsd->sc.data[SC_PROTECT_DEF] ) - cardfix = cardfix * ( 100 - tsd->sc.data[SC_PROTECT_DEF]->val1 ) / 100; + if( tsd->sc.data[SC_PROTECT_DEF] ) + cardfix = cardfix * (100 - tsd->sc.data[SC_PROTECT_DEF]->val1) / 100; - if( cardfix != 1000 ) - damage = damage * cardfix / 1000; - } + if( cardfix != 1000 ) + damage = damage * cardfix / 1000; + } break; case BF_MISC: if( tsd && !(nk&NK_NO_CARDFIX_DEF) ){ @@ -1120,25 +1117,25 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li for (i = 0; ARRAYLENGTH(tsd->subele2) > i && tsd->subele2[i].rate != 0; i++) { if(tsd->subele2[i].ele != s_ele) continue; - if(!(tsd->subele2[i].flag&flag&BF_WEAPONMASK && - tsd->subele2[i].flag&flag&BF_RANGEMASK && - tsd->subele2[i].flag&flag&BF_SKILLMASK)) + if(!(tsd->subele2[i].flag&wflag&BF_WEAPONMASK && + tsd->subele2[i].flag&wflag&BF_RANGEMASK && + tsd->subele2[i].flag&wflag&BF_SKILLMASK)) continue; ele_fix += tsd->subele2[i].rate; } - cardfix=cardfix*(100-ele_fix)/100; + cardfix = cardfix * (100 - ele_fix) / 100; } - cardfix=cardfix*(100-tsd->subsize[sstatus->size])/100; - cardfix=cardfix*(100-tsd->subrace2[s_race2])/100; - cardfix=cardfix*(100-tsd->subrace[sstatus->race])/100; - cardfix=cardfix*(100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS])/100; + cardfix = cardfix*(100-tsd->subsize[sstatus->size]) / 100; + cardfix = cardfix*(100-tsd->subrace2[s_race2]) / 100; + cardfix = cardfix*(100-tsd->subrace[sstatus->race]) / 100; + cardfix = cardfix*(100-tsd->subrace[is_boss(src)?RC_BOSS:RC_NONBOSS]) / 100; if( sstatus->race != RC_DEMIHUMAN ) - cardfix=cardfix*(100-tsd->subrace[RC_NONDEMIHUMAN])/100; + cardfix = cardfix * (100 - tsd->subrace[RC_NONDEMIHUMAN]) / 100; cardfix = cardfix * ( 100 - tsd->bonus.misc_def_rate ) / 100; - if( flag&BF_SHORT ) + if( wflag&BF_SHORT ) cardfix = cardfix * ( 100 - tsd->bonus.near_attack_def_rate ) / 100; - else // BF_LONG (there's no other choice) + else // BF_LONG (there's no other choice) cardfix = cardfix * ( 100 - tsd->bonus.long_attack_def_rate ) / 100; if (cardfix != 1000) @@ -1260,12 +1257,12 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li #ifdef RENEWAL /** * RE DEF Reduction - * Damage = Attack * (4000+eDEF)/(4000+eDEF*10) - sDEF * Pierce defence gains 1 atk per def/2 **/ - if( def1 == -400 ) /* being hit by a gazillion units, you hit the jackpot and got -400 which creates a division by 0 and subsequently crashes */ - def1 = -399; + if( def1 < -399 ) // it stops at -399 + def1 = 399; // in aegis it set to 1 but in our case it may lead to exploitation so limit it to 399 + //return 1; if( flag&2 ) damage += def1 >> 1; @@ -1274,7 +1271,7 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li if( flag&4 ) damage -= (def1 + vit_def); else - damage = damage * (4000+def1) / (4000+10*def1) - vit_def; + damage = (int)((100.0f - def1 / (def1 + 400.0f) * 90.0f) / 100.0f * damage - vit_def); } #else @@ -1318,9 +1315,12 @@ int battle_calc_defense(int attack_type, struct block_list *src, struct block_li #ifdef RENEWAL /** * RE MDEF Reduction - * Damage = Magic Attack * (1000+eMDEF)/(1000+eMDEF) - sMDEF **/ - damage = damage * (1000 + mdef) / (1000 + mdef * 10) - mdef2; + if( mdef < -99 ) // it stops at -99 + mdef = 99; // in aegis it set to 1 but in our case it may lead to exploitation so limit it to 99 + //return 1; + + damage = (int)((100.0f - mdef / (mdef + 100.0f) * 90.0f) / 100.0f * damage - mdef2); #else if(battle_config.magic_defense_type) damage = damage - mdef*battle_config.magic_defense_type - mdef2; @@ -1489,7 +1489,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += 300 + 100 * skill_lv + status_get_int(src); RE_LVL_DMOD(100); break; - case WL_FROSTMISTY: // MATK [{( Skill Level x 100 ) + 200 } x ( Caster’s Base Level / 100 )] % + case WL_FROSTMISTY: // MATK [{( Skill Level x 100 ) + 200 } x ( Caster�s Base Level / 100 )] % skillratio += 100 + 100 * skill_lv; RE_LVL_DMOD(100); break; @@ -1975,7 +1975,12 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block skillratio += 100 * (skill_lv+1); break; case GS_PIERCINGSHOT: - skillratio += 20 * skill_lv; +#ifdef RENEWAL + if( sd && sd->weapontype1 == W_RIFLE ) + skillratio += 50 + 30 * skill_lv; + else +#endif + skillratio += 20 * skill_lv; break; case GS_RAPIDSHOWER: skillratio += 10 * skill_lv; @@ -2008,6 +2013,11 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block case NJ_KIRIKAGE: skillratio += 100 * (skill_lv-1); break; +#ifdef RENEWAL + case NJ_KUNAI: + skillratio += 50 + 150 * skill_lv; + break; +#endif case KN_CHARGEATK: { int k = (flag-1)/3; //+100% every 3 cells of distance @@ -2070,7 +2080,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block } break; case RK_STORMBLAST: - skillratio += -100 + 100 * (sd ? pc->checkskill(sd,RK_RUNEMASTERY) : 1) + 100 * (status_get_int(src) / 4); + skillratio += -100 + 100 *(sd ? pc->checkskill(sd,RK_RUNEMASTERY) : 1) + status_get_int(src) / 8; break; case RK_PHANTOMTHRUST: skillratio += -100 + 50 * skill_lv + 10 * ( sd ? pc->checkskill(sd,KN_SPEARMASTERY) : 10); @@ -2090,7 +2100,6 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block //ATK [{(Skill Level x 100) + 300} x Caster's Base Level / 120]% + ATK [(AGI x 2) + (Caster's Job Level x 4)]% skillratio += 200 + (100 * skill_lv); RE_LVL_DMOD(120); - skillratio += status_get_agi(src) * 2 + (sd?sd->status.job_level:0) * 4; break; case GC_ROLLINGCUTTER: skillratio += -50 + 50 * skill_lv; @@ -3439,7 +3448,6 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list ad.damage = 0; } } - #ifndef RENEWAL ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag); #endif @@ -3585,7 +3593,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * case PA_GOSPEL: md.damage = 1+rnd()%9999; break; - case CR_ACIDDEMONSTRATION: + case CR_ACIDDEMONSTRATION: #ifdef RENEWAL {// [malufett] int matk=0, atk; @@ -4338,12 +4346,18 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Adds an absolute value to damage. 100 = +100 damage #define ATK_ADD( a ) { wd.damage+= a; if (flag.lh) wd.damage2+= a; } #define ATK_ADD2( a , b ) { wd.damage+= a; if (flag.lh) wd.damage2+= b; } - +#ifdef RENEWAL +#define GET_NORMAL_ATTACK( f ) { wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, f, wd.flag); } +#define GET_NORMAL_ATTACK2( f ) { wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, f, wd.flag); } +#endif switch (skill_id) { //Calc base damage according to skill case PA_SACRIFICE: wd.damage = sstatus->max_hp* 9/100; wd.damage2 = 0; +#ifdef RENEWAL + wd.damage = battle->calc_elefix(src, target, skill_id, skill_lv, wd.damage, nk, n_ele, s_ele, s_ele_, false, wd.flag); // temporary [malufett] +#endif break; case NJ_ISSEN: // [malufett] #ifndef RENEWAL @@ -4353,21 +4367,29 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list { short totaldef = status_get_total_def(target); i = 0; - wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0), wd.flag); + GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); if( sc && sc->data[SC_NJ_BUNSINJYUTSU] && (i=sc->data[SC_NJ_BUNSINJYUTSU]->val2) > 0 ) wd.div_ = ~( i++ + 2 ) + 1; - wd.damage *= sstatus->hp * skill_lv; - wd.damage = wd.damage / sstatus->max_hp + sstatus->hp + i * (wd.damage / sstatus->max_hp + sstatus->hp) / 5; + if( wd.damage ){ + wd.damage *= sstatus->hp * skill_lv; + wd.damage = wd.damage / sstatus->max_hp + sstatus->hp + i * (wd.damage / sstatus->max_hp + sstatus->hp) / 5; + } ATK_ADD(-totaldef); if( is_boss(target) ) ATK_RATE(50); flag.idef = 1; } break; + case NJ_SYURIKEN: // [malufett] + GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|(sc && sc->data[SC_WEAPONPERFECT]?8:0) ); + wd.damage += battle->calc_masteryfix(src, target, skill_id, skill_lv, 4 * skill_lv + (sd ? sd->bonus.arrow_atk : 0), wd.div_, 0, flag.weapon) - status_get_total_def(target); + flag.idef = 1; + break; case MO_EXTREMITYFIST: // [malufett] - wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8, wd.flag); + GET_NORMAL_ATTACK( (sc && sc->data[SC_MAXIMIZEPOWER]?1:0)|8 ); // first value is still not confirm. - wd.damage = status_get_sp(src) + 10 * status_get_sp(src) * wd.damage / 100 + 8 * wd.damage; + if( wd.damage ) + wd.damage = status_get_sp(src) + 10 * status_get_sp(src) * wd.damage / 100 + 8 * wd.damage + 250 + 150 * skill_lv; flag.tdef = 1; #endif break; @@ -4445,10 +4467,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list i |= 16; // for ex. shuriken must not be influenced by DEX } #ifdef RENEWAL - wd.damage = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_R, i, wd.flag); + GET_NORMAL_ATTACK( i ); wd.damage = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage, wd.div_, 0, flag.weapon); if (flag.lh){ - wd.damage2 = battle->calc_base_damage(src, target, skill_id, skill_lv, nk, n_ele, s_ele, s_ele_, EQI_HAND_L, i, wd.flag); + GET_NORMAL_ATTACK2( i ); wd.damage2 = battle->calc_masteryfix(src, target, skill_id, skill_lv, wd.damage2, wd.div_, 1, flag.weapon); } #else @@ -4500,6 +4522,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sc->data[SC_UNLIMIT] && wd.flag&BF_LONG ) ATK_ADD( 50 * sc->data[SC_UNLIMIT]->val1 ); } + if( tsc && skill_id != PA_SACRIFICE ){ if( tsc->data[SC_DARKCROW] && wd.flag&BF_SHORT ) ATK_ADD( 30 * tsc->data[SC_DARKCROW]->val1 ); @@ -4511,6 +4534,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } else { + + #ifdef RENEWAL + if( sd && skill_id == NJ_KUNAI ){ + flag.tdef = 1; + ATK_ADD( sd->bonus.arrow_atk ); + } + #endif switch(skill_id){ #ifdef RENEWAL case LK_SPIRALPIERCE: @@ -4535,13 +4565,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list //Constant/misc additions from skills switch (skill_id) { - case MO_EXTREMITYFIST: - ATK_ADD(250 + 150*skill_lv); - break; #ifdef RENEWAL case HW_MAGICCRASHER: ATK_ADD(battle->calc_magic_attack(src, target, skill_id, skill_lv, wflag).damage / 5); break; +#else + case MO_EXTREMITYFIST: + ATK_ADD(250 + 150*skill_lv); + break; #endif case TK_DOWNKICK: case TK_STORMKICK: @@ -4559,8 +4590,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list ATK_ADD( battle->calc_magic_attack(src, target, skill_id, skill_lv, wflag).damage ); flag.tdef = 1; #endif +#ifndef RENEWAL case NJ_SYURIKEN: ATK_ADD(4*skill_lv); +#endif break; case HT_FREEZINGTRAP: if(sd) @@ -4570,6 +4603,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list if( sd && sd->weight ) ATK_ADD( sd->weight / 8 ); break; + case GC_COUNTERSLASH: + ATK_ADD( status_get_agi(src) * 2 + (sd?sd->status.job_level:0) * 4 ); + break; case SR_TIGERCANNON: // (Tiger Cannon skill level x 240) + (Target Base Level x 40) ATK_ADD( skill_lv * 240 + status_get_lv(target) * 40 ); if( sc && sc->data[SC_COMBOATTACK] @@ -4611,18 +4647,20 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list skill_id == LG_SHIELDPRESS || skill_id == RK_HUNDREDSPEAR || skill_id == CR_SHIELDCHARGE ) ) ATK_ADDRATE(sc->data[SC_GLOOMYDAY_SK]->val2); + +#ifndef RENEWAL_EDP if( sc->data[SC_EDP] ){ switch(skill_id){ -#ifndef RENEWAL_EDP - case AS_SPLASHER: case AS_VENOMKNIFE: + case AS_SPLASHER: case AS_GRIMTOOTH: - break; + case ASC_BREAKER: + case AS_VENOMKNIFE: case ASC_METEORASSAULT: break; default: ATK_ADDRATE(sc->data[SC_EDP]->val3); -#endif } } +#endif if(sc->data[SC_STYLE_CHANGE]){ TBL_HOM *hd = BL_CAST(BL_HOM,src); if (hd) ATK_ADD(hd->homunculus.spiritball * 3); @@ -4799,6 +4837,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } } #endif + #ifndef RENEWAL if (sd) { if (skill_id != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus. @@ -4825,9 +4864,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list } //Card Fix, tsd side if(tsd){ //if player on player then it was already measured above - wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag); - if( flag.lh ) - wd.damage2 = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag); + wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, (flag.lh?1:0), wd.flag); } #endif if( flag.infdef ) { //Plants receive 1 damage when hit @@ -5763,6 +5800,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f case ASC_METEORASSAULT: case RG_RAID: case MC_CARTREVOLUTION: + case HT_CLAYMORETRAP: + case RA_ICEBOUNDTRAP: + case RA_FIRINGTRAP: #endif state |= BCT_ENEMY; strip_enemy = 0; @@ -6536,14 +6576,14 @@ void Hercules_report(char* date, char *time_c) { WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + BFLAG_LENGTH + ( i * ( BFLAG_LENGTH + 4 ) ) ) = *battle_data[i].val; } - chrif_send_report(buf, 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) ); + chrif->send_report(buf, 6 + 12 + 9 + 24 + 41 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) ); aFree(buf); #undef BFLAG_LENGTH } static int Hercules_report_timer(int tid, unsigned int tick, int id, intptr_t data) { - if( chrif_isconnected() ) {/* char server relays it, so it must be online. */ + if( chrif->isconnected() ) {/* char server relays it, so it must be online. */ Hercules_report(__DATE__,__TIME__); } return 0; diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index dc07c2409..7041042df 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -384,8 +384,8 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int } if( iMap->save_settings&128 ) { - chrif_save(sd, 0); - chrif_save(pl_sd, 0); + chrif->save(sd, 0); + chrif->save(pl_sd, 0); } // check whether or not there is still something to buy diff --git a/src/map/chrif.c b/src/map/chrif.c index a95193363..9e8b18d3b 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -53,39 +53,39 @@ static const int packet_len_table[0x3d] = { // U - used, F - free //2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)' //2afa: Outgoing, chrif_sendmap -> 'sending our maps' //2afb: Incoming, chrif_sendmapack -> 'Maps received successfully / or not ..' -//2afc: Outgoing, chrif_scdata_request -> request sc_data for pc->authok'ed char. <- new command reuses previous one. -//2afd: Incoming, chrif_authok -> 'client authentication ok' +//2afc: Outgoing, chrif->scdata_request -> request sc_data for pc->authok'ed char. <- new command reuses previous one. +//2afd: Incoming, chrif->authok -> 'client authentication ok' //2afe: Outgoing, send_usercount_tochar -> 'sends player count of this map server to charserver' -//2aff: Outgoing, send_users_tochar -> 'sends all actual connected character ids to charserver' +//2aff: Outgoing, chrif->send_users_tochar -> 'sends all actual connected character ids to charserver' //2b00: Incoming, iMap->setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure) -//2b01: Outgoing, chrif_save -> 'charsave of char XY account XY (complete struct)' -//2b02: Outgoing, chrif_charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure) +//2b01: Outgoing, chrif->save -> 'charsave of char XY account XY (complete struct)' +//2b02: Outgoing, chrif->charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure) //2b03: Incoming, clif_charselectok -> '' (i think its the packet after enterworld?) (not sure) //2b04: Incoming, chrif_recvmap -> 'getting maps from charserver of other mapserver's' -//2b05: Outgoing, chrif_changemapserver -> 'Tell the charserver the mapchange / quest for ok...' +//2b05: Outgoing, chrif->changemapserver -> 'Tell the charserver the mapchange / quest for ok...' //2b06: Incoming, chrif_changemapserverack -> 'awnser of 2b05, ok/fail, data: dunno^^' -//2b07: Outgoing, chrif_removefriend -> 'Tell charserver to remove friend_id from char_id friend list' -//2b08: Outgoing, chrif_searchcharid -> '...' +//2b07: Outgoing, chrif->removefriend -> 'Tell charserver to remove friend_id from char_id friend list' +//2b08: Outgoing, chrif->searchcharid -> '...' //2b09: Incoming, map_addchariddb -> 'Adds a name to the nick db' //2b0a: Incoming/Outgoing, socket_datasync() //2b0b: Outgoing, update charserv skillid2idx -//2b0c: Outgoing, chrif_changeemail -> 'change mail address ...' +//2b0c: Outgoing, chrif->changeemail -> 'change mail address ...' //2b0d: Incoming, chrif_changedsex -> 'Change sex of acc XY' -//2b0e: Outgoing, chrif_char_ask_name -> 'Do some operations (change sex, ban / unban etc)' +//2b0e: Outgoing, chrif->char_ask_name -> 'Do some operations (change sex, ban / unban etc)' //2b0f: Incoming, chrif_char_ask_name_answer -> 'answer of the 2b0e' -//2b10: Outgoing, chrif_updatefamelist -> 'Update the fame ranking lists and send them' -//2b11: Outgoing, chrif_divorce -> 'tell the charserver to do divorce' +//2b10: Outgoing, chrif->updatefamelist -> 'Update the fame ranking lists and send them' +//2b11: Outgoing, chrif->divorce -> 'tell the charserver to do divorce' //2b12: Incoming, chrif_divorceack -> 'divorce chars //2b13: FREE //2b14: Incoming, chrif_accountban -> 'not sure: kick the player with message XY' //2b15: FREE -//2b16: Outgoing, chrif_ragsrvinfo -> 'sends base / job / drop rates ....' -//2b17: Outgoing, chrif_char_offline -> 'tell the charserver that the char is now offline' -//2b18: Outgoing, chrif_char_reset_offline -> 'set all players OFF!' -//2b19: Outgoing, chrif_char_online -> 'tell the charserver that the char .. is online' -//2b1a: Outgoing, chrif_buildfamelist -> 'Build the fame ranking lists and send them' +//2b16: Outgoing, chrif->ragsrvinfo -> 'sends base / job / drop rates ....' +//2b17: Outgoing, chrif->char_offline -> 'tell the charserver that the char is now offline' +//2b18: Outgoing, chrif->char_reset_offline -> 'set all players OFF!' +//2b19: Outgoing, chrif->char_online -> 'tell the charserver that the char .. is online' +//2b1a: Outgoing, chrif->buildfamelist -> 'Build the fame ranking lists and send them' //2b1b: Incoming, chrif_recvfamelist -> 'Receive fame ranking lists' -//2b1c: Outgoing, chrif_save_scdata -> 'Send sc_data of player for saving.' +//2b1c: Outgoing, chrif->save_scdata -> 'Send sc_data of player for saving.' //2b1d: Incoming, chrif_load_scdata -> 'received sc_data of player for loading.' //2b1e: Incoming, chrif_update_ip -> 'Reqest forwarded from char-server for interserver IP sync.' [Lance] //2b1f: Incoming, chrif_disconnectplayer -> 'disconnects a player (aid X) with the message XY ... 0x81 ..' [Sirius] @@ -95,10 +95,9 @@ static const int packet_len_table[0x3d] = { // U - used, F - free //2b23: Outgoing, chrif_keepalive. charserver ping. //2b24: Incoming, chrif_keepalive_ack. charserver ping reply. //2b25: Incoming, chrif_deadopt -> 'Removes baby from Father ID and Mother ID' -//2b26: Outgoing, chrif_authreq -> 'client authentication request' +//2b26: Outgoing, chrif->authreq -> 'client authentication request' //2b27: Incoming, chrif_authfail -> 'client authentication failed' -int chrif_connected = 0; int char_fd = -1; int srvinfo; static char char_ip_str[128]; @@ -106,14 +105,13 @@ static uint32 char_ip = 0; static uint16 char_port = 6121; static char userid[NAME_LENGTH], passwd[NAME_LENGTH]; static int chrif_state = 0; -int other_mapserver_count=0; //Holds count of how many other map servers are online (apart of this instance) [Skotlex] //Interval at which map server updates online listing. [Valaris] #define CHECK_INTERVAL 3600000 //Interval at which map server sends number of connected users. [Skotlex] #define UPDATE_INTERVAL 10000 //This define should spare writing the check in every function. [Skotlex] -#define chrif_check(a) { if(!chrif_isconnected()) return a; } +#define chrif_check(a) { if(!chrif->isconnected()) return a; } /// Resets all the data. @@ -139,7 +137,7 @@ struct auth_node* chrif_search(int account_id) { } struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state) { - struct auth_node *node = chrif_search(account_id); + struct auth_node *node = chrif->search(account_id); return ( node && node->char_id == char_id && node->state == state ) ? node : NULL; } @@ -147,7 +145,7 @@ struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state st bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { struct auth_node *node; - if ( (node = chrif_auth_check(account_id, char_id, state) ) ) { + if ( (node = chrif->auth_check(account_id, char_id, state) ) ) { int fd = node->sd ? node->sd->fd : node->fd; if ( session[fd] && session[fd]->session_data == node->sd ) @@ -171,7 +169,7 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { static bool chrif_sd_to_auth(TBL_PC* sd, enum sd_state state) { struct auth_node *node; - if ( chrif_search(sd->status.account_id) ) + if ( chrif->search(sd->status.account_id) ) return false; //Already exists? node = ers_alloc(auth_db_ers, struct auth_node); @@ -208,12 +206,12 @@ static bool chrif_auth_logout(TBL_PC* sd, enum sd_state state) { } bool chrif_auth_finished(TBL_PC* sd) { - struct auth_node *node= chrif_search(sd->status.account_id); + struct auth_node *node= chrif->search(sd->status.account_id); if ( node && node->sd == sd && node->state == ST_LOGIN ) { node->sd = NULL; - return chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); + return chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); } return false; @@ -276,8 +274,8 @@ int chrif_save(struct map_session_data *sd, int flag) { if (flag && sd->state.active) { //Store player data which is quitting //FIXME: SC are lost if there's no connection at save-time because of the way its related data is cleared immediately after this function. [Skotlex] - if ( chrif_isconnected() ) - chrif_save_scdata(sd); + if ( chrif->isconnected() ) + chrif->save_scdata(sd); if ( !chrif_auth_logout(sd,flag == 1 ? ST_LOGOUT : ST_MAPCHANGE) ) ShowError("chrif_save: Failed to set up player %d:%d for proper quitting!\n", sd->status.account_id, sd->status.char_id); } @@ -367,7 +365,7 @@ int chrif_recvmap(int fd) { if (battle_config.etc_log) ShowStatus("Received maps from %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j); - other_mapserver_count++; + chrif->other_mapserver_count++; return 0; } @@ -381,7 +379,7 @@ int chrif_removemap(int fd) { for(i = 10, j = 0; i < RFIFOW(fd, 2); i += 4, j++) iMap->eraseipport(RFIFOW(fd, i), ip, port); - other_mapserver_count--; + chrif->other_mapserver_count--; if(battle_config.etc_log) ShowStatus("remove map of server %d.%d.%d.%d:%d (%d maps)\n", CONVIP(ip), port, j); @@ -391,15 +389,15 @@ int chrif_removemap(int fd) { // received after a character has been "final saved" on the char-server static void chrif_save_ack(int fd) { - chrif_auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT); - chrif_check_shutdown(); + chrif->auth_delete(RFIFOL(fd,2), RFIFOL(fd,6), ST_LOGOUT); + chrif->check_shutdown(); } // request to move a character between mapservers int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) { nullpo_retr(-1, sd); - if (other_mapserver_count < 1) {//No other map servers are online! + if (chrif->other_mapserver_count < 1) {//No other map servers are online! clif->authfail_fd(sd->fd, 0); return -1; } @@ -430,7 +428,7 @@ int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port) { int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port) { struct auth_node *node; - if ( !( node = chrif_auth_check(account_id, char_id, ST_MAPCHANGE) ) ) + if ( !( node = chrif->auth_check(account_id, char_id, ST_MAPCHANGE) ) ) return -1; if ( !login_id1 ) { @@ -440,7 +438,7 @@ int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int c clif->changemapserver(node->sd, map_index, x, y, ntohl(ip), ntohs(port)); //Player has been saved already, remove him from memory. [Skotlex] - chrif_auth_delete(account_id, char_id, ST_MAPCHANGE); + chrif->auth_delete(account_id, char_id, ST_MAPCHANGE); return 0; } @@ -458,7 +456,7 @@ int chrif_connectack(int fd) { ShowStatus("Successfully logged on to Char Server (Connection: '"CL_WHITE"%d"CL_RESET"').\n",fd); chrif_state = 1; - chrif_connected = 1; + chrif->chrif_connected = 1; chrif_sendmap(fd); @@ -470,7 +468,7 @@ int chrif_connectack(int fd) { } socket_datasync(fd, true); - chrif_skillid2idx(fd); + chrif->skillid2idx(fd); return 0; } @@ -485,13 +483,13 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) { case ST_LOGIN: if ( node->sd && node->char_dat == NULL ) {//Since there is no way to request the char auth, make it fail. pc->authfail(node->sd); - chrif_char_offline(node->sd); - chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); + chrif->char_offline(node->sd); + chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); } break; case ST_LOGOUT: //Re-send final save - chrif_save(node->sd, 1); + chrif->save(node->sd, 1); break; case ST_MAPCHANGE: { //Re-send map-change request. struct map_session_data *sd = node->sd; @@ -499,7 +497,7 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) { uint16 port; if( iMap->mapname2ipport(sd->mapindex,&ip,&port) == 0 ) - chrif_changemapserver(sd, ip, port); + chrif->changemapserver(sd, ip, port); else //too much lag/timeout is the closest explanation for this error. clif->authfail_fd(sd->fd, 3); @@ -517,10 +515,10 @@ void chrif_on_ready(void) { chrif_state = 2; - chrif_check_shutdown(); + chrif->check_shutdown(); //If there are players online, send them to the char-server. [Skotlex] - send_users_tochar(); + chrif->send_users_tochar(); //Auth db reconnect handling auth_db->foreach(auth_db,chrif_reconnect); @@ -572,9 +570,9 @@ int chrif_scdata_request(int account_id, int char_id) { * Request auth confirmation *------------------------------------------*/ void chrif_authreq(struct map_session_data *sd) { - struct auth_node *node= chrif_search(sd->bl.id); + struct auth_node *node= chrif->search(sd->bl.id); - if( node != NULL || !chrif_isconnected() ) { + if( node != NULL || !chrif->isconnected() ) { set_eof(sd->fd); return; } @@ -622,7 +620,7 @@ void chrif_authok(int fd) { if ( ( sd = iMap->id2sd(account_id) ) != NULL ) return; - if ( ( node = chrif_search(account_id) ) == NULL ) + if ( ( node = chrif->search(account_id) ) == NULL ) return; // should not happen if ( node->state != ST_LOGIN ) @@ -632,7 +630,7 @@ void chrif_authok(int fd) { /* //When we receive double login info and the client has not connected yet, //discard the older one and keep the new one. - chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); + chrif->auth_delete(node->account_id, node->char_id, ST_LOGIN); */ return; // should not happen } @@ -651,8 +649,8 @@ void chrif_authok(int fd) { pc->authfail(sd); } - chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already. - chrif_auth_delete(account_id, char_id, ST_LOGIN); + chrif->char_offline(sd); //Set him offline, the char server likely has it set as online already. + chrif->auth_delete(account_id, char_id, ST_LOGIN); } // client authentication failed @@ -667,7 +665,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( login_id1 = RFIFOL(fd,10); sex = RFIFOB(fd,14); - node = chrif_search(account_id); + node = chrif->search(account_id); if( node != NULL && node->account_id == account_id && @@ -677,7 +675,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( node->state == ST_LOGIN ) {// found a match clif->authfail_fd(node->fd, 0); - chrif_auth_delete(account_id, char_id, ST_LOGIN); + chrif->auth_delete(account_id, char_id, ST_LOGIN); } } @@ -695,13 +693,13 @@ int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) { case ST_LOGOUT: //Re-save attempt (->sd should never be null here). node->node_created = iTimer->gettick(); //Refresh tick (avoid char-server load if connection is really bad) - chrif_save(node->sd, 1); + chrif->save(node->sd, 1); break; default: //Clear data. any connected players should have timed out by now. ShowInfo("auth_db: Node (state %s) timed out for %d:%d\n", states[node->state], node->account_id, node->char_id); - chrif_char_offline_nsd(node->account_id, node->char_id); - chrif_auth_delete(node->account_id, node->char_id, node->state); + chrif->char_offline_nsd(node->account_id, node->char_id); + chrif->auth_delete(node->account_id, node->char_id, node->state); break; } return 1; @@ -825,7 +823,7 @@ int chrif_changesex(struct map_session_data *sd) { /*========================================== * R 2b0f <accid>.l <name>.24B <type>.w <answer>.w - * Processing a reply to chrif_char_ask_name() (request to modify an account). + * Processing a reply to chrif->char_ask_name() (request to modify an account). * type of operation: * 1: block, 2: ban, 3: unblock, 4: unban, 5: changesex * type of answer: @@ -1037,9 +1035,9 @@ int chrif_disconnectplayer(int fd) { sd = iMap->id2sd(account_id); if( sd == NULL ) { - struct auth_node* auth = chrif_search(account_id); + struct auth_node* auth = chrif->search(account_id); - if( auth != NULL && chrif_auth_delete(account_id, auth->char_id, ST_LOGIN) ) + if( auth != NULL && chrif->auth_delete(account_id, auth->char_id, ST_LOGIN) ) return 0; return -1; @@ -1333,11 +1331,11 @@ int chrif_char_online(struct map_session_data *sd) { /// Called when the connection to Char Server is disconnected. void chrif_on_disconnect(void) { - if( chrif_connected != 1 ) + if( chrif->chrif_connected != 1 ) ShowWarning("Connection to Char Server lost.\n\n"); - chrif_connected = 0; + chrif->chrif_connected = 0; - other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect. + chrif->other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect. iMap->eraseallipport(); //Attempt to reconnect in a second. [Skotlex] @@ -1447,7 +1445,7 @@ int chrif_parse(int fd) { switch(cmd) { case 0x2af9: chrif_connectack(fd); break; case 0x2afb: chrif_sendmapack(fd); break; - case 0x2afd: chrif_authok(fd); break; + case 0x2afd: chrif->authok(fd); break; case 0x2b00: iMap->setusers(RFIFOL(fd,2)); chrif_keepalive(fd); break; case 0x2b03: clif->charselectok(RFIFOL(fd,2), RFIFOB(fd,6)); break; case 0x2b04: chrif_recvmap(fd); break; @@ -1546,15 +1544,15 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_ realloc_fifo(char_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK); chrif_connect(char_fd); - chrif_connected = (chrif_state == 2); + chrif->chrif_connected = (chrif_state == 2); srvinfo = 0; } else { if (srvinfo == 0) { - chrif_ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); + chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common); srvinfo = 1; } } - if ( chrif_isconnected() ) + if ( chrif->isconnected() ) displayed = 0; return 0; } @@ -1648,3 +1646,65 @@ int do_init_chrif(void) { return 0; } + +/*===================================== +* Default Functions : chrif.h +* Generated by HerculesInterfaceMaker +* created by Susu +*-------------------------------------*/ +void chrif_defaults(void) { + chrif = &chrif_s; + + /* vars */ + + chrif->chrif_connected = 0; + chrif->other_mapserver_count = 0; + + /* funcs */ + + chrif->setuserid = chrif_setuserid; + chrif->setpasswd = chrif_setpasswd; + chrif->checkdefaultlogin = chrif_checkdefaultlogin; + chrif->setip = chrif_setip; + chrif->setport = chrif_setport; + + chrif->isconnected = chrif_isconnected; + chrif->check_shutdown = chrif_check_shutdown; + + chrif->search = chrif_search; + chrif->auth_check = chrif_auth_check; + chrif->auth_delete = chrif_auth_delete; + chrif->auth_finished = chrif_auth_finished; + + chrif->authreq = chrif_authreq; + chrif->authok = chrif_authok; + chrif->scdata_request = chrif_scdata_request; + chrif->save = chrif_save; + chrif->charselectreq = chrif_charselectreq; + chrif->changemapserver = chrif_changemapserver; + + chrif->searchcharid = chrif_searchcharid; + chrif->changeemail = chrif_changeemail; + chrif->char_ask_name = chrif_char_ask_name; + chrif->updatefamelist = chrif_updatefamelist; + chrif->buildfamelist = chrif_buildfamelist; + chrif->save_scdata = chrif_save_scdata; + chrif->ragsrvinfo = chrif_ragsrvinfo; + chrif->char_offline = chrif_char_offline; + chrif->char_offline_nsd = chrif_char_offline_nsd; + chrif->char_reset_offline = chrif_char_reset_offline; + chrif->send_users_tochar = send_users_tochar; + chrif->char_online = chrif_char_online; + chrif->changesex = chrif_changesex; + //chrif->chardisconnect = chrif_chardisconnect; + chrif->divorce = chrif_divorce; + + chrif->removefriend = chrif_removefriend; + chrif->send_report = chrif_send_report; + + chrif->do_final_chrif = do_final_chrif; + chrif->do_init_chrif = do_init_chrif; + + chrif->flush_fifo = chrif_flush_fifo; + chrif->skillid2idx = chrif_skillid2idx; +} diff --git a/src/map/chrif.h b/src/map/chrif.h index 9c7142905..faabedeed 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -1,13 +1,10 @@ // Copyright (c) Hercules Dev Team, licensed under GNU GPL. // See the LICENSE file // Portions Copyright (c) Athena Dev Teams - #ifndef _CHRIF_H_ #define _CHRIF_H_ - #include "../common/cbasetypes.h" #include <time.h> - enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE }; struct auth_node { int account_id, char_id; @@ -19,53 +16,72 @@ struct auth_node { enum sd_state state; //To track whether player was login in/out or changing maps. }; -void chrif_setuserid(char* id); -void chrif_setpasswd(char* pwd); -void chrif_checkdefaultlogin(void); -int chrif_setip(const char* ip); -void chrif_setport(uint16 port); - -int chrif_isconnected(void); -void chrif_check_shutdown(void); -extern int chrif_connected; -extern int other_mapserver_count; -struct auth_node* chrif_search(int account_id); -struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state state); -bool chrif_auth_delete(int account_id, int char_id, enum sd_state state); -bool chrif_auth_finished(struct map_session_data* sd); -void chrif_authreq(struct map_session_data* sd); -void chrif_authok(int fd); -int chrif_scdata_request(int account_id, int char_id); -int chrif_save(struct map_session_data* sd, int flag); -int chrif_charselectreq(struct map_session_data* sd, uint32 s_ip); -int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port); +/*===================================== +* Interface : chrif.h +* Generated by HerculesInterfaceMaker +* created by Susu +*-------------------------------------*/ +struct chrif_interface { -int chrif_searchcharid(int char_id); -int chrif_changeemail(int id, const char *actual_email, const char *new_email); -int chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second); -int chrif_updatefamelist(struct map_session_data *sd); -int chrif_buildfamelist(void); -int chrif_save_scdata(struct map_session_data *sd); -int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate); -int chrif_char_offline(struct map_session_data *sd); -int chrif_char_offline_nsd(int account_id, int char_id); -int chrif_char_reset_offline(void); -int send_users_tochar(void); -int chrif_char_online(struct map_session_data *sd); -int chrif_changesex(struct map_session_data *sd); -int chrif_chardisconnect(struct map_session_data *sd); -int chrif_divorce(int partner_id1, int partner_id2); + /* vars */ + + int chrif_connected; + int other_mapserver_count; //Holds count of how many other map servers are online (apart of this instance) [Skotlex] -int chrif_removefriend(int char_id, int friend_id); -void chrif_send_report(char* buf, int len); + /* funcs */ + + void (*setuserid) (char* id); + void (*setpasswd) (char* pwd); + void (*checkdefaultlogin) (void); + int (*setip) (const char* ip); + void (*setport) (uint16 port); + + int (*isconnected) (void); + void (*check_shutdown) (void); + + struct auth_node* (*search) (int account_id); + struct auth_node* (*auth_check) (int account_id, int char_id, enum sd_state state); + bool (*auth_delete) (int account_id, int char_id, enum sd_state state); + bool (*auth_finished) (struct map_session_data* sd); + + void (*authreq) (struct map_session_data* sd); + void (*authok) (int fd); + int (*scdata_request) (int account_id, int char_id); + int (*save) (struct map_session_data* sd, int flag); + int (*charselectreq) (struct map_session_data* sd, uint32 s_ip); + int (*changemapserver) (struct map_session_data* sd, uint32 ip, uint16 port); + + int (*searchcharid) (int char_id); + int (*changeemail) (int id, const char *actual_email, const char *new_email); + int (*char_ask_name) (int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second); + int (*updatefamelist) (struct map_session_data *sd); + int (*buildfamelist) (void); + int (*save_scdata) (struct map_session_data *sd); + int (*ragsrvinfo) (int base_rate,int job_rate, int drop_rate); + int (*char_offline) (struct map_session_data *sd); + int (*char_offline_nsd) (int account_id, int char_id); + int (*char_reset_offline) (void); + int (*send_users_tochar) (void); + int (*char_online) (struct map_session_data *sd); + int (*changesex) (struct map_session_data *sd); + int (*chardisconnect) (struct map_session_data *sd); + int (*divorce) (int partner_id1, int partner_id2); + + int (*removefriend) (int char_id, int friend_id); + void (*send_report) (char* buf, int len); + + int (*do_final_chrif) (void); + int (*do_init_chrif) (void); + + int (*flush_fifo) (void); + void (*skillid2idx) (int fd); +} chrif_s; -int do_final_chrif(void); -int do_init_chrif(void); +struct chrif_interface *chrif; -int chrif_flush_fifo(void); -void chrif_skillid2idx(int fd); +void chrif_defaults(void); #endif /* _CHRIF_H_ */ diff --git a/src/map/clif.c b/src/map/clif.c index 3e01230b2..06363c8a2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9295,7 +9295,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { } if (bl || - ((node=chrif_search(account_id)) && //An already existing node is valid only if it is for this login. + ((node=chrif->search(account_id)) && //An already existing node is valid only if it is for this login. !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) { clif->authfail_fd(fd, 8); //Still recognizes last connection @@ -9321,7 +9321,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { WFIFOSET(fd,packet_len(0x283)); #endif - chrif_authreq(sd); + chrif->authreq(sd); } void clif_hercules_chsys_mjoin(struct map_session_data *sd) { if( !map[sd->bl.m].channel ) { @@ -10334,7 +10334,7 @@ void clif_parse_Restart(int fd, struct map_session_data *sd) { if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] && (!battle_config.prevent_logout || DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) ) { //Send to char-server for character selection. - chrif_charselectreq(sd, session[fd]->client_addr); + chrif->charselectreq(sd, session[fd]->client_addr); } else { clif->disconnect_ack(sd, 1); } @@ -13869,7 +13869,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd) } } else { //friend not online -- ask char server to delete from his friendlist - if(chrif_removefriend(char_id,sd->status.char_id)) { // char-server offline, abort + if(chrif->removefriend(char_id,sd->status.char_id)) { // char-server offline, abort clif->message(fd, msg_txt(673)); //"This action can't be performed at the moment. Please try again later." return; } @@ -14560,7 +14560,7 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) int i; bool fail = false; - if( !chrif_isconnected() ) + if( !chrif->isconnected() ) return; if( mail_id <= 0 ) return; @@ -14621,7 +14621,7 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd) int mail_id = RFIFOL(fd,2); int i; - if( !chrif_isconnected() ) + if( !chrif->isconnected() ) return; if( mail_id <= 0 ) return; @@ -14670,7 +14670,7 @@ void clif_parse_Mail_setattach(int fd, struct map_session_data *sd) int amount = RFIFOL(fd,4); unsigned char flag; - if( !chrif_isconnected() ) + if( !chrif->isconnected() ) return; if (idx < 0 || amount < 0) return; @@ -14704,7 +14704,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) struct mail_message msg; int body_len; - if( !chrif_isconnected() ) + if( !chrif->isconnected() ) return; if( sd->state.trading ) return; @@ -17445,18 +17445,20 @@ void clif_scriptclear(struct map_session_data *sd, int npcid) { clif->send(&p,sizeof(p), &sd->bl, SELF); } - +/* Made Possible Thanks to Yommy! */ void clif_package_item_announce(struct map_session_data *sd, unsigned short nameid, unsigned short containerid) { struct packet_package_item_announce p; p.PacketType = package_item_announceType; - p.PacketLength = 10+NAME_LENGTH; + p.PacketLength = 11+NAME_LENGTH; p.type = 0x0; - p.ItemID = containerid; + p.ItemID = nameid; p.len = NAME_LENGTH; safestrncpy(p.Name, sd->status.name, sizeof(p.Name)); - p.BoxItemID = nameid; - clif->send(&p,p.PacketLength, &sd->bl, ALL_CLIENT); + p.unknown = 0x2; // some strange byte, IDA shows.. BYTE3(BoxItemIDLength) = 2; + p.BoxItemID = containerid; + + clif->send(&p,sizeof(p), &sd->bl, ALL_CLIENT); } /* */ unsigned short clif_decrypt_cmd( int cmd, struct map_session_data *sd ) { diff --git a/src/map/intif.c b/src/map/intif.c index e364f5c25..294d79656 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -147,7 +147,7 @@ int intif_broadcast(const char* mes, int len, int type) if (CheckForCharServer()) return 0; - if (other_mapserver_count < 1) + if (chrif->other_mapserver_count < 1) return 0; //No need to send. WFIFOHEAD(inter_fd, 16 + lp + len); @@ -175,7 +175,7 @@ int intif_broadcast2(const char* mes, int len, unsigned long fontColor, short fo if (CheckForCharServer()) return 0; - if (other_mapserver_count < 1) + if (chrif->other_mapserver_count < 1) return 0; //No need to send. WFIFOHEAD(inter_fd, 16 + len); @@ -219,7 +219,7 @@ int intif_wis_message(struct map_session_data *sd, char *nick, char *mes, int me if (CheckForCharServer()) return 0; - if (other_mapserver_count < 1) + if (chrif->other_mapserver_count < 1) { //Character not found. clif->wis_end(sd->fd, 1); return 0; @@ -502,7 +502,7 @@ int intif_party_message(int party_id,int account_id,const char *mes,int len) if (CheckForCharServer()) return 0; - if (other_mapserver_count < 1) + if (chrif->other_mapserver_count < 1) return 0; //No need to send. WFIFOHEAD(inter_fd,len + 12); @@ -637,7 +637,7 @@ int intif_guild_message(int guild_id,int account_id,const char *mes,int len) if (CheckForCharServer()) return 0; - if (other_mapserver_count < 1) + if (chrif->other_mapserver_count < 1) return 0; //No need to send. WFIFOHEAD(inter_fd, len + 12); @@ -950,7 +950,7 @@ int intif_parse_Registers(int fd) struct global_reg *reg; int *qty; int account_id = RFIFOL(fd,4), char_id = RFIFOL(fd,8); - struct auth_node *node = chrif_auth_check(account_id, char_id, ST_LOGIN); + struct auth_node *node = chrif->auth_check(account_id, char_id, ST_LOGIN); if (node) sd = node->sd; else { //Normally registries should arrive for in log-in chars. @@ -1723,7 +1723,7 @@ static void intif_parse_Mail_send(int fd) { clif->mail_send(sd->fd, false); if( iMap->save_settings&16 ) - chrif_save(sd, 0); + chrif->save(sd, 0); } } } @@ -1814,7 +1814,7 @@ static void intif_parse_Auction_register(int fd) { clif->auction_message(sd->fd, 1); // Confirmation Packet ?? if( iMap->save_settings&32 ) - chrif_save(sd,0); + chrif->save(sd,0); } else { diff --git a/src/map/map.c b/src/map/map.c index 74e2c74e0..ee56f140f 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1566,7 +1566,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid) CREATE(req, struct charid_request, 1); req->next = p->requests; p->requests = req; - chrif_searchcharid(charid); + chrif->searchcharid(charid); } /*========================================== @@ -1629,11 +1629,11 @@ int map_quit(struct map_session_data *sd) { int i; if(!sd->state.active) { //Removing a player that is not active. - struct auth_node *node = chrif_search(sd->status.account_id); + struct auth_node *node = chrif->search(sd->status.account_id); if (node && node->char_id == sd->status.char_id && node->state != ST_LOGOUT) //Except when logging out, clear the auth-connect data immediately. - chrif_auth_delete(node->account_id, node->char_id, node->state); + chrif->auth_delete(node->account_id, node->char_id, node->state); //Non-active players should not have loaded any data yet (or it was cleared already) so no additional cleanups are needed. return 0; } @@ -1728,7 +1728,7 @@ int map_quit(struct map_session_data *sd) { party->booking_delete(sd); // Party Booking [Spiria] pc->makesavestatus(sd); pc->clean_skilltree(sd); - chrif_save(sd,1); + chrif->save(sd,1); unit_free_pc(sd); return 0; } @@ -1790,7 +1790,7 @@ const char* map_charid2nick(int charid) if( *p->nick ) return p->nick;// name in nick_db - chrif_searchcharid(charid);// request the name + chrif->searchcharid(charid);// request the name return NULL; } @@ -3354,13 +3354,13 @@ int map_config_read(char *cfgName) { if( msg_silent ) // only bother if its actually enabled ShowInfo("Console Silent Setting: %d\n", atoi(w2)); } else if (strcmpi(w1, "userid")==0) - chrif_setuserid(w2); + chrif->setuserid(w2); else if (strcmpi(w1, "passwd") == 0) - chrif_setpasswd(w2); + chrif->setpasswd(w2); else if (strcmpi(w1, "char_ip") == 0) - char_ip_set = chrif_setip(w2); + char_ip_set = chrif->setip(w2); else if (strcmpi(w1, "char_port") == 0) - chrif_setport(atoi(w2)); + chrif->setport(atoi(w2)); else if (strcmpi(w1, "map_ip") == 0) map_ip_set = clif->setip(w2); else if (strcmpi(w1, "bind_ip") == 0) @@ -5018,12 +5018,12 @@ void do_final(void) ShowStatus("Cleaned up %d maps."CL_CLL"\n", iMap->map_num); id_db->foreach(id_db,cleanup_db_sub); - chrif_char_reset_offline(); - chrif_flush_fifo(); + chrif->char_reset_offline(); + chrif->flush_fifo(); atcommand->final(); battle->final(); - do_final_chrif(); + chrif->do_final_chrif(); ircbot->final();/* before clif. */ clif->final(); do_final_npc(); @@ -5075,7 +5075,7 @@ void do_final(void) static int map_abort_sub(struct map_session_data* sd, va_list ap) { - chrif_save(sd,1); + chrif->save(sd,1); return 1; } @@ -5093,7 +5093,7 @@ void do_abort(void) return; } run = 1; - if (!chrif_isconnected()) + if (!chrif->isconnected()) { if (pc_db->size(pc_db)) ShowFatalError("Server has crashed without a connection to the char-server, %u characters can't be saved!\n", pc_db->size(pc_db)); @@ -5101,7 +5101,7 @@ void do_abort(void) } ShowError("Server received crash signal! Attempting to save all online characters!\n"); iMap->map_foreachpc(map_abort_sub); - chrif_flush_fifo(); + chrif->flush_fifo(); } /*====================================================== @@ -5161,7 +5161,7 @@ void do_shutdown(void) mapit->free(iter); flush_fifos(); } - chrif_check_shutdown(); + chrif->check_shutdown(); } } @@ -5233,6 +5233,7 @@ void map_hp_symbols(void) { HPM->share(bg,"battlegrounds"); HPM->share(buyingstore,"buyingstore"); HPM->share(clif,"clif"); + HPM->share(chrif,"chrif"); HPM->share(guild,"guild"); HPM->share(gstorage,"gstorage"); HPM->share(homun,"homun"); @@ -5266,6 +5267,7 @@ void load_defaults(void) { battleground_defaults(); buyingstore_defaults(); clif_defaults(); + chrif_defaults(); guild_defaults(); gstorage_defaults(); homunculus_defaults(); @@ -5398,7 +5400,7 @@ int do_init(int argc, char *argv[]) // loads npcs iMap->reloadnpc(false); - chrif_checkdefaultlogin(); + chrif->checkdefaultlogin(); if (!map_ip_set || !char_ip_set) { char ip_str[16]; @@ -5416,7 +5418,7 @@ int do_init(int argc, char *argv[]) if (!map_ip_set) clif->setip(ip_str); if (!char_ip_set) - chrif_setip(ip_str); + chrif->setip(ip_str); } battle->config_read(iMap->BATTLE_CONF_FILENAME); @@ -5461,7 +5463,7 @@ int do_init(int argc, char *argv[]) atcommand->init(); battle->init(); instance->init(); - do_init_chrif(); + chrif->do_init_chrif(); clif->init(); ircbot->init(); script->init(); diff --git a/src/map/npc.c b/src/map/npc.c index 94ad1667c..df9a9426f 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3849,9 +3849,6 @@ int npc_reload(void) { npc->motd = npc_name2id("HerculesMOTD"); /* [Ind/Hercules] */ - /* re-insert */ - itemdb->name_constants(); - //Re-read the NPC Script Events cache. npc_read_event_script(); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1a52040a8..d77784dc5 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -459,7 +459,7 @@ struct packet_script_clear { short PacketType; unsigned int NpcID; } __attribute__((packed)); - +/* made possible thanks to Yommy!! */ struct packet_package_item_announce { short PacketType; short PacketLength; @@ -467,6 +467,7 @@ struct packet_package_item_announce { unsigned short ItemID; char len; char Name[NAME_LENGTH]; + char unknown; unsigned short BoxItemID; } __attribute__((packed)); diff --git a/src/map/party.c b/src/map/party.c index 306c68e3e..154f84207 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -585,7 +585,12 @@ int party_member_withdraw(int party_id, int account_id, int char_id) if( p->instances ) instance->check_kick(sd); } - + if (sd && sd->sc.data[SC_DANCING]) { + status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER); + status_change_end(&sd->bl, SC_DRUMBATTLE, INVALID_TIMER); + status_change_end(&sd->bl, SC_NIBELUNGEN, INVALID_TIMER); + status_change_end(&sd->bl, SC_SIEGFRIED, INVALID_TIMER); + } return 0; } diff --git a/src/map/pc.c b/src/map/pc.c index 0d1a99175..10c7642c5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -18,6 +18,7 @@ #include "atcommand.h" // get_atcommand_level() #include "battle.h" // battle_config #include "battleground.h" +#include "chat.h" #include "chrif.h" #include "clif.h" #include "date.h" // is_day_of_*() @@ -360,7 +361,7 @@ void pc_addfame(struct map_session_data *sd,int count) clif->fame_taekwon(sd,count); break; } - chrif_updatefamelist(sd); + chrif->updatefamelist(sd); } // Check whether a player ID is in the fame rankers' list of its job, returns his/her position if so, 0 else @@ -1238,13 +1239,13 @@ int pc_reg_received(struct map_session_data *sd) iMap->addiddb(&sd->bl); iMap->delnickdb(sd->status.char_id, sd->status.name); - if (!chrif_auth_finished(sd)) + if (!chrif->auth_finished(sd)) ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id); pc->load_combo(sd); status_calc_pc(sd,1); - chrif_scdata_request(sd->status.account_id, sd->status.char_id); + chrif->scdata_request(sd->status.account_id, sd->status.char_id); intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox intif_request_questlog(sd); @@ -1692,6 +1693,13 @@ int pc_disguise(struct map_session_data *sd, int class_) { clif->cartlist(sd); clif->updatestatus(sd,SP_CARTINFO); } + if (sd->chatID) { + struct chat_data* cd; + nullpo_retr(1, sd); + cd = (struct chat_data*)map_id2bl(sd->chatID); + if( cd != NULL || (struct block_list*)sd == cd->owner ) + clif->dispchat(cd,0); + } } return 1; } @@ -4838,8 +4846,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y sd->bl.x=x; sd->bl.y=y; pc->clean_skilltree(sd); - chrif_save(sd,2); - chrif_changemapserver(sd, ip, (short)port); + chrif->save(sd,2); + chrif->changemapserver(sd, ip, (short)port); //Free session data from this map server [Kevin] unit_free_pc(sd); @@ -5048,6 +5056,7 @@ int pc_checkallowskill(struct map_session_data *sd) SC_DANCING, SC_GS_GATLINGFEVER, #ifdef RENEWAL + SC_LKCONCENTRATION, SC_EDP, #endif SC_FEARBREEZE @@ -7579,16 +7588,16 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) //if you were previously famous, not anymore. if (fame_flag) { - chrif_save(sd,0); - chrif_buildfamelist(); + chrif->save(sd,0); + chrif->buildfamelist(); } else if (sd->status.fame > 0) { //It may be that now they are famous? switch (sd->class_&MAPID_UPPERMASK) { case MAPID_BLACKSMITH: case MAPID_ALCHEMIST: case MAPID_TAEKWON: - chrif_save(sd,0); - chrif_buildfamelist(); + chrif->save(sd,0); + chrif->buildfamelist(); break; } } @@ -9032,7 +9041,7 @@ int pc_divorce(struct map_session_data *sd) if( (p_sd = iMap->charid2sd(sd->status.partner_id)) == NULL ) { // Lets char server do the divorce - if( chrif_divorce(sd->status.char_id, sd->status.partner_id) ) + if( chrif->divorce(sd->status.char_id, sd->status.partner_id) ) return -1; // No char server connected return 0; @@ -9210,7 +9219,7 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data) last_save_id = sd->bl.id; save_flag = 2; - chrif_save(sd,0); + chrif->save(sd,0); break; } mapit->free(iter); diff --git a/src/map/pet.c b/src/map/pet.c index 8ed88c46c..e6ef0a488 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -408,7 +408,7 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet) intif_save_petdata(sd->status.account_id,pet); if (iMap->save_settings&8) - chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex] + chrif->save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex] if(sd->bl.prev != NULL) { iMap->addblock(&sd->pd->bl); diff --git a/src/map/quest.c b/src/map/quest.c index b56088886..3776d603f 100644 --- a/src/map/quest.c +++ b/src/map/quest.c @@ -100,7 +100,7 @@ int quest_add(TBL_PC * sd, int quest_id) clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]); if( iMap->save_settings&64 ) - chrif_save(sd,0); + chrif->save(sd,0); return 0; } @@ -148,7 +148,7 @@ int quest_change(TBL_PC * sd, int qid1, int qid2) clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]); if( iMap->save_settings&64 ) - chrif_save(sd,0); + chrif->save(sd,0); return 0; } @@ -179,7 +179,7 @@ int quest_delete(TBL_PC * sd, int quest_id) clif->quest_delete(sd, quest_id); if( iMap->save_settings&64 ) - chrif_save(sd,0); + chrif->save(sd,0); return 0; } @@ -250,7 +250,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) { clif->quest_delete(sd, quest_id); if( iMap->save_settings&64 ) - chrif_save(sd,0); + chrif->save(sd,0); return 0; } diff --git a/src/map/script.c b/src/map/script.c index fdebcb452..f63202834 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9966,7 +9966,7 @@ BUILDIN(changesex) // to avoid any problem with equipment and invalid sex, equipment is unequiped. for( i=0; i<EQI_MAX; i++ ) if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3); - chrif_changesex(sd); + chrif->changesex(sd); return true; } diff --git a/src/map/skill.c b/src/map/skill.c index 509de6f4a..1431d27a7 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3781,6 +3781,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; case SR_TIGERCANNON: + case GC_COUNTERSLASH: + case GC_ROLLINGCUTTER: flag |= SD_ANIMATION; case LG_MOONSLASHER: clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6); @@ -5314,6 +5316,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui status_kill(bl); break; case SA_REVERSEORCISH: + case ALL_REVERSEORCISH: clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv))); break; @@ -5460,7 +5463,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill->castend_damage_id); clif->skill_nodamage (src,src,skill_id,skill_lv,1); // Initiate 10% of your damage becomes fire element. - sc_start4(src,SC_WATK_ELEMENT,100,3,20,0,0,skill->get_time2(skill_id, skill_lv)); + sc_start4(src,SC_SUB_WEAPONPROPERTY,100,3,20,0,0,skill->get_time2(skill_id, skill_lv)); if( sd ) skill->blockpc_start(sd, skill_id, skill->get_time(skill_id, skill_lv), false); else if( bl->type == BL_MER ) @@ -5564,6 +5567,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui case RK_VITALITYACTIVATION: case RK_ABUNDANCE: case RK_CRUSHSTRIKE: + case ALL_ODINS_POWER: clif->skill_nodamage(src,bl,skill_id,skill_lv, sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); break; @@ -5634,6 +5638,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill->blockpc_start (sd, skill_id, skill->get_time2(skill_id,skill_lv), false); break; + case ALL_ANGEL_PROTECT: + if( dstsd ) + clif->skill_nodamage(src,bl,skill_id,skill_lv, + sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); + else if( sd ) + clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); + break; case AS_ENCHANTPOISON: // Prevent spamming [Valaris] if (sd && dstsd && dstsd->sc.count) { if (dstsd->sc.data[SC_PROPERTYFIRE] || @@ -7703,6 +7714,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case NPC_TALK: case ALL_WEWISH: + case ALL_CATCRY: + case ALL_DREAM_SUMMERNIGHT: clif->skill_nodamage(src,bl,skill_id,skill_lv,1); break; case ALL_BUYING_STORE: @@ -10025,6 +10038,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui if (!sg) break; if (sce) status_change_end(src, type, INVALID_TIMER); //Was under someone else's Gospel. [Skotlex] + status_change_clear_buffs(src,3); sc_start4(src,type,100,skill_lv,0,sg->group_id,BCT_SELF,skill->get_time(skill_id,skill_lv)); clif->skill_poseffect(src, skill_id, skill_lv, 0, 0, tick); // PA_GOSPEL music packet } @@ -11374,14 +11388,17 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( bl->id == ss->id )// it won't trigger on caster break; case UNT_LANDMINE: - case UNT_CLAYMORETRAP: case UNT_BLASTMINE: case UNT_SHOCKWAVE: case UNT_SANDMAN: case UNT_FLASHER: case UNT_FREEZINGTRAP: case UNT_FIREPILLAR_ACTIVE: - iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); + case UNT_CLAYMORETRAP: + if( sg->unit_id == UNT_FIRINGTRAP || sg->unit_id == UNT_ICEBOUNDTRAP || sg->unit_id == UNT_CLAYMORETRAP ) + iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &src->bl,tick); + else + iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick); if (sg->unit_id != UNT_FIREPILLAR_ACTIVE) clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS); sg->limit=DIFF_TICK(tick,sg->tick)+1500 + @@ -14640,16 +14657,23 @@ int skill_detonator(struct block_list *bl, va_list ap) case UNT_CLUSTERBOMB: case UNT_FIRINGTRAP: case UNT_ICEBOUNDTRAP: - if( unit_id == UNT_TALKIEBOX ) { - clif->talkiebox(bl,unit->group->valstr); - unit->group->val2 = -1; - } else - iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick); - - clif->changetraplook(bl,unit_id == UNT_FIRINGTRAP ? UNT_DUMMYSKILL : UNT_USED_TRAPS); - unit->group->unit_id = UNT_USED_TRAPS; + switch(unit_id){ + case UNT_TALKIEBOX: + clif->talkiebox(bl,unit->group->valstr); + unit->group->val2 = -1; + break; + case UNT_CLAYMORETRAP: + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag|BL_SKILL|~BCT_SELF,bl,unit->group->tick); + break; + default: + iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick); + } + clif->changetraplook(bl, UNT_USED_TRAPS); unit->group->limit = DIFF_TICK(iTimer->gettick(),unit->group->tick) + - (unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : 1500) ); + (unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : (unit_id == UNT_FIRINGTRAP ? 0 : 1500)) ); + unit->group->unit_id = UNT_USED_TRAPS; break; } return 0; @@ -14831,12 +14855,6 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { case UNT_ELECTRICSHOCKER: clif->skill_damage(src,bl,tick,0,0,-30000,1,sg->skill_id,sg->skill_lv,5); break; - case UNT_FIRINGTRAP: - case UNT_ICEBOUNDTRAP: - case UNT_CLUSTERBOMB: - if( ss != bl ) - skill->attack(BF_MISC,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1|SD_LEVEL); - break; case UNT_MAGENTATRAP: case UNT_COBALTTRAP: case UNT_MAIZETRAP: @@ -14848,6 +14866,38 @@ int skill_trap_splash (struct block_list *bl, va_list ap) { skill->addtimerskill(ss,tick+50,bl->id,0,0,WM_REVERBERATION_MELEE,sg->skill_lv,BF_WEAPON,0); // for proper skill delay animation when use with Dominion Impulse skill->addtimerskill(ss,tick+250,bl->id,0,0,WM_REVERBERATION_MAGIC,sg->skill_lv,BF_MAGIC,0); break; + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + if( src->id == bl->id ) break; + if( bl->type == BL_SKILL ){ + struct skill_unit *su = (struct skill_unit *)bl; + if( su->group->unit_id == UNT_USED_TRAPS ) + break; + } + case UNT_CLUSTERBOMB: + if( ss != bl ) + skill->attack(BF_MISC,ss,src,bl,sg->skill_id,sg->skill_lv,tick,sg->val1|SD_LEVEL); + break; + case UNT_CLAYMORETRAP: + if( src->id == bl->id ) break; + if( bl->type == BL_SKILL ){ + struct skill_unit *su = (struct skill_unit *)bl; + switch( su->group->unit_id ){ + case UNT_CLAYMORETRAP: + case UNT_LANDMINE: + case UNT_BLASTMINE: + case UNT_SHOCKWAVE: + case UNT_SANDMAN: + case UNT_FLASHER: + case UNT_FREEZINGTRAP: + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + clif->changetraplook(bl, UNT_USED_TRAPS); + su->group->limit = DIFF_TICK(iTimer->gettick(),su->group->tick) + 1500; + su->group->unit_id = UNT_USED_TRAPS; + } + break; + } default: skill->attack(skill->get_type(sg->skill_id),ss,src,bl,sg->skill_id,sg->skill_lv,tick,0); break; @@ -16789,16 +16839,18 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) { if (su->alive && (sg = su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP) { switch( sg->unit_id ) { - case UNT_LANDMINE: case UNT_CLAYMORETRAP: + case UNT_FIRINGTRAP: + case UNT_ICEBOUNDTRAP: + iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag|BL_SKILL|~BCT_SELF, &su->bl,tick); + break; + case UNT_LANDMINE: case UNT_BLASTMINE: case UNT_SHOCKWAVE: case UNT_SANDMAN: case UNT_FLASHER: case UNT_FREEZINGTRAP: case UNT_CLUSTERBOMB: - case UNT_FIRINGTRAP: - case UNT_ICEBOUNDTRAP: iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick); break; } @@ -17845,7 +17897,7 @@ void skill_reload (void) { } } } - chrif_skillid2idx(0); + chrif->skillid2idx(0); /* lets update all players skill tree : so that if any skill modes were changed they're properly updated */ iter = mapit_getallusers(); for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) diff --git a/src/map/status.c b/src/map/status.c index fdee5b954..dc5d5c5bd 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -196,7 +196,7 @@ void initChangeTables(void) { //The main status definitions add_sc( SM_BASH , SC_STUN ); set_sc( SM_PROVOKE , SC_PROVOKE , SI_PROVOKE , SCB_DEF|SCB_DEF2|SCB_BATK|SCB_WATK ); - add_sc( SM_MAGNUM , SC_WATK_ELEMENT ); + add_sc( SM_MAGNUM , SC_SUB_WEAPONPROPERTY ); set_sc( SM_ENDURE , SC_ENDURE , SI_ENDURE , SCB_MDEF|SCB_DSPD ); add_sc( MG_SIGHT , SC_SIGHT ); add_sc( MG_SAFETYWALL , SC_SAFETYWALL ); @@ -348,9 +348,9 @@ void initChangeTables(void) { set_sc( LK_AURABLADE , SC_AURABLADE , SI_AURABLADE , SCB_NONE ); set_sc( LK_PARRYING , SC_PARRYING , SI_PARRYING , SCB_NONE ); #ifndef RENEWAL - set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_CONCENTRATION , SCB_BATK|SCB_WATK|SCB_HIT|SCB_DEF|SCB_DEF2); + set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_LKCONCENTRATION , SCB_BATK|SCB_WATK|SCB_HIT|SCB_DEF|SCB_DEF2); #else - set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_CONCENTRATION , SCB_HIT|SCB_DEF); + set_sc( LK_CONCENTRATION , SC_LKCONCENTRATION , SI_LKCONCENTRATION , SCB_HIT|SCB_DEF); #endif set_sc( LK_TENSIONRELAX , SC_TENSIONRELAX , SI_TENSIONRELAX , SCB_REGEN ); set_sc( LK_BERSERK , SC_BERSERK , SI_BERSERK , SCB_DEF|SCB_DEF2|SCB_MDEF|SCB_MDEF2|SCB_FLEE|SCB_SPEED|SCB_ASPD|SCB_MAXHP|SCB_REGEN ); @@ -511,7 +511,7 @@ void initChangeTables(void) { add_sc( MER_CRASH , SC_STUN ); set_sc( MER_PROVOKE , SC_PROVOKE , SI_PROVOKE , SCB_DEF|SCB_DEF2|SCB_BATK|SCB_WATK ); - add_sc( MS_MAGNUM , SC_WATK_ELEMENT ); + add_sc( MS_MAGNUM , SC_SUB_WEAPONPROPERTY ); add_sc( MER_SIGHT , SC_SIGHT ); set_sc( MER_DECAGI , SC_DEC_AGI , SI_DEC_AGI , SCB_AGI|SCB_SPEED ); set_sc( MER_MAGNIFICAT , SC_MAGNIFICAT , SI_MAGNIFICAT , SCB_REGEN ); @@ -757,6 +757,9 @@ void initChangeTables(void) { set_sc( ALL_FULL_THROTTLE , SC_FULL_THROTTLE , SI_FULL_THROTTLE , SCB_SPEED|SCB_STR|SCB_AGI|SCB_VIT|SCB_INT|SCB_DEX|SCB_LUK ); + add_sc( ALL_REVERSEORCISH , SC_ORCISH ); + set_sc( ALL_ANGEL_PROTECT , SC_ANGEL_PROTECT , SI_ANGEL_PROTECT , SCB_REGEN ); + // Storing the target job rather than simply SC_SOULLINK simplifies code later on. SkillStatusChangeTable[SL_ALCHEMIST] = (sc_type)MAPID_ALCHEMIST, SkillStatusChangeTable[SL_MONK] = (sc_type)MAPID_MONK, @@ -3295,7 +3298,6 @@ static unsigned short status_calc_vit(struct block_list *,struct status_change * static unsigned short status_calc_int(struct block_list *,struct status_change *,int); static unsigned short status_calc_dex(struct block_list *,struct status_change *,int); static unsigned short status_calc_luk(struct block_list *,struct status_change *,int); -static unsigned short status_calc_batk(struct block_list *,struct status_change *,int,bool); static unsigned short status_calc_watk(struct block_list *,struct status_change *,int,bool); static unsigned short status_calc_matk(struct block_list *,struct status_change *,int,bool); static signed short status_calc_hit(struct block_list *,struct status_change *,int,bool); @@ -3316,6 +3318,8 @@ static unsigned char status_calc_element_lv(struct block_list *bl, struct status static unsigned short status_calc_mode(struct block_list *bl, struct status_change *sc, int mode); #ifdef RENEWAL static unsigned short status_calc_ematk(struct block_list *,struct status_change *,int); +#else +static unsigned short status_calc_batk(struct block_list *,struct status_change *,int,bool); #endif //Calculates base regen values. @@ -4397,19 +4401,25 @@ static unsigned short status_calc_luk(struct block_list *bl, struct status_chang return (unsigned short)cap_value(luk,0,USHRT_MAX); } - +#ifdef RENEWAL +unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) +#else static unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk, bool viewable) +#endif { if(!sc || !sc->count) return cap_value(batk,0,USHRT_MAX); if( !viewable ){ /* some statuses that are hidden in the status window */ + if(sc->data[SC_PLUSATTACKPOWER]) + batk += sc->data[SC_PLUSATTACKPOWER]->val1; return (unsigned short)cap_value(batk,0,USHRT_MAX); } - +#ifndef RENEWAL if(sc->data[SC_PLUSATTACKPOWER]) batk += sc->data[SC_PLUSATTACKPOWER]->val1; +#endif if(sc->data[SC_BATKFOOD]) batk += sc->data[SC_BATKFOOD]->val1; if(sc->data[SC_GS_GATLINGFEVER]) @@ -6576,6 +6586,15 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val undead_flag = battle->check_undead(status->race,status->def_ele); //Check for inmunities / sc fails switch (type) { + case SC_DRUMBATTLE: + case SC_NIBELUNGEN: + case SC_INTOABYSS: + case SC_SIEGFRIED: + if( bl->type == BL_PC) { + struct map_session_data *sd = BL_CAST(BL_PC,bl); + if (!sd->status.party_id) return 0; + } + break; case SC_ANGRIFFS_MODUS: case SC_GOLDENE_FERSE: if ((type==SC_GOLDENE_FERSE && sc->data[SC_ANGRIFFS_MODUS]) @@ -10863,7 +10882,7 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl struct status_change *sc = status_get_sc(bl); if ( bl->type == BL_PC && watk->atk ){ - if ( flag&16 ) + if ( flag&2 ) dstr = status_get_dex(bl); else dstr = status_get_str(bl); @@ -10884,10 +10903,10 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl else max = min; } - - if( bl->type == BL_PC && ((TBL_PC*)bl)->right_weapon.overrefine > 0) - max += rnd()%((TBL_PC*)bl)->right_weapon.overrefine + 1; + if( bl->type == BL_PC && ((TBL_PC*)bl)->right_weapon.overrefine > 0 && !(flag&2) ) + max += rnd()%((TBL_PC*)bl)->right_weapon.overrefine + 1; + max = status_calc_watk(bl, sc, max, false); return max; @@ -11000,11 +11019,15 @@ int status_change_clear_buffs (struct block_list* bl, int type) if( !sc->data[i] || !status_get_sc_type(i) ) continue; - if( type&1 && !(status_get_sc_type(i)&SC_BUFF) ) + if( type&3 && !(status_get_sc_type(i)&SC_BUFF) && !(status_get_sc_type(i)&SC_DEBUFF) ) continue; - if( type&2 && !(status_get_sc_type(i)&SC_DEBUFF) ) - continue; + if( !(type&3) ){ + if( type&1 && !(status_get_sc_type(i)&SC_BUFF) ) + continue; + if( type&2 && !(status_get_sc_type(i)&SC_DEBUFF) ) + continue; + } switch (i) { case SC_DEEP_SLEEP: diff --git a/src/map/status.h b/src/map/status.h index fbce95f17..a469dc71f 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -147,7 +147,7 @@ typedef enum sc_type { SC_VOLCANO, //100, SC_DELUGE, SC_VIOLENTGALE, - SC_WATK_ELEMENT, + SC_SUB_WEAPONPROPERTY, SC_ARMOR, SC_ARMORPROPERTY, SC_NOCHAT, @@ -672,6 +672,7 @@ typedef enum sc_type { SC_HANBOK, SC_MONSTER_TRANSFORM, + SC_ANGEL_PROTECT, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. } sc_type; @@ -993,7 +994,7 @@ enum si_type { SI_INVINCIBLE = 311, SI_CASH_PLUSONLYJOBEXP = 312, SI_PARTYFLEE = 313, -// SI_ANGEL_PROTECT = 314, + SI_ANGEL_PROTECT = 314, // SI_ENDURE_MDEF = 315, SI_ENCHANTBLADE = 316, SI_DEATHBOUND = 317, @@ -1850,11 +1851,12 @@ int status_check_visibility(struct block_list *src, struct block_list *target); int status_change_spread( struct block_list *src, struct block_list *bl ); defType status_calc_def(struct block_list *bl, struct status_change *sc, int, bool); -signed short status_calc_def2(struct block_list *,struct status_change *, int, bool); +signed short status_calc_def2(struct block_list *, struct status_change *, int, bool); defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int, bool); -signed short status_calc_mdef2(struct block_list *,struct status_change *, int, bool); +signed short status_calc_mdef2(struct block_list *, struct status_change *, int, bool); #ifdef RENEWAL +unsigned short status_calc_batk(struct block_list *, struct status_change *, int, bool); unsigned short status_base_matk(const struct status_data* status, int level); int status_get_weapon_atk(struct block_list *src, struct weapon_atk *watk, int flag); int status_get_total_mdef(struct block_list *src); diff --git a/src/map/storage.c b/src/map/storage.c index e3fa073af..5b3c75d58 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -321,7 +321,7 @@ void storage_storageclose(struct map_session_data* sd) clif->storageclose(sd); if( iMap->save_settings&4 ) - chrif_save(sd,0); //Invokes the storage saving as well. + chrif->save(sd,0); //Invokes the storage saving as well. sd->state.storage_flag = 0; } @@ -334,7 +334,7 @@ void storage_storage_quit(struct map_session_data* sd, int flag) nullpo_retv(sd); if (iMap->save_settings&4) - chrif_save(sd, flag); //Invokes the storage saving as well. + chrif->save(sd, flag); //Invokes the storage saving as well. sd->state.storage_flag = 0; } @@ -688,7 +688,7 @@ int storage_guild_storageclose(struct map_session_data* sd) if (stor->storage_status) { if (iMap->save_settings&4) - chrif_save(sd, 0); //This one also saves the storage. [Skotlex] + chrif->save(sd, 0); //This one also saves the storage. [Skotlex] else gstorage->save(sd->status.account_id, sd->status.guild_id,0); stor->storage_status=0; @@ -711,13 +711,13 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag) stor->storage_status = 0; clif->storageclose(sd); if (iMap->save_settings&4) - chrif_save(sd,0); + chrif->save(sd,0); return 0; } if(stor->storage_status) { if (iMap->save_settings&4) - chrif_save(sd,0); + chrif->save(sd,0); else gstorage->save(sd->status.account_id,sd->status.guild_id,1); } @@ -762,4 +762,4 @@ void gstorage_defaults(void) { gstorage->pc_quit = storage_guild_storage_quit; gstorage->save = storage_guild_storagesave; gstorage->saved = storage_guild_storagesaved; -}
\ No newline at end of file +} diff --git a/src/map/trade.c b/src/map/trade.c index a2a29651b..c44f04884 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -206,13 +206,13 @@ int impossible_trade_check(struct map_session_data *sd) intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm); // if we block people if (battle_config.ban_hack_trade < 0) { - chrif_char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block + chrif->char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block set_eof(sd->fd); // forced to disconnect because of the hack // message about the ban strcpy(message_to_gm, msg_txt(540)); // This player has been definitively blocked. // if we ban people } else if (battle_config.ban_hack_trade > 0) { - chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second) + chrif->char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_hack_trade, 0); // type: 2 - ban (year, month, day, hour, minute, second) set_eof(sd->fd); // forced to disconnect because of the hack // message about the ban sprintf(message_to_gm, msg_txt(507), battle_config.ban_hack_trade); // This player has been banned for %d minute(s). @@ -603,8 +603,8 @@ void trade_tradecommit(struct map_session_data *sd) // save both player to avoid crash: they always have no advantage/disadvantage between the 2 players if (iMap->save_settings&1) { - chrif_save(sd,0); - chrif_save(tsd,0); + chrif->save(sd,0); + chrif->save(tsd,0); } } @@ -621,4 +621,4 @@ void trade_defaults(void) trade->ok = trade_tradeok; trade->cancel = trade_tradecancel; trade->commit = trade_tradecommit; -}
\ No newline at end of file +} diff --git a/src/map/vending.c b/src/map/vending.c index b9575c8dd..898008a3a 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -198,8 +198,8 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid, //Always save BOTH: buyer and customer if( iMap->save_settings&2 ) { - chrif_save(sd,0); - chrif_save(vsd,0); + chrif->save(sd,0); + chrif->save(vsd,0); } //check for @AUTOTRADE users [durf] |