summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c598
1 files changed, 216 insertions, 382 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 440c684f4..21588a12d 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -395,7 +395,7 @@ int pc_makesavestatus(struct map_session_data *sd)
//Only copy the Cart/Peco/Falcon options, the rest are handled via
//status change load/saving. [Skotlex]
- sd->status.option = sd->sc.option&(OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON);
+ sd->status.option = sd->sc.option&(OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUGRIDER|OPTION_WUG|OPTION_MADOGEAR|OPTION_MOUNTING);
if (sd->sc.data[SC_JAILED])
{ //When Jailed, do not move last point.
@@ -765,10 +765,14 @@ int pc_isequip(struct map_session_data *sd,int n)
//Not equipable by class. [Skotlex]
if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
return 0;
-
- //Not equipable by upper class. [Skotlex]
- if(!(1<<((sd->class_&JOBL_UPPER)?1:((sd->class_&JOBL_BABY)?2:0))&item->class_upper))
+ //Not usable by upper class. [Inkfish]
+ while( 1 ) {
+ if( item->class_upper&1 && !(sd->class_&(JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) ) break;
+ if( item->class_upper&2 && sd->class_&(JOBL_UPPER|JOBL_THIRD) ) break;
+ if( item->class_upper&4 && sd->class_&JOBL_BABY ) break;
+ if( item->class_upper&8 && sd->class_&JOBL_THIRD ) break;
return 0;
+ }
return 1;
}
@@ -825,7 +829,17 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->invincible_timer = INVALID_TIMER;
sd->npc_timer_id = INVALID_TIMER;
sd->pvp_timer = INVALID_TIMER;
-
+ /**
+ * For the Secure NPC Timeout option (check config/Secure.h) [RR]
+ **/
+#if SECURE_NPCTIMEOUT
+ /**
+ * Initialize to defaults/expected
+ **/
+ sd->npc_idle_timer = INVALID_TIMER;
+ sd->npc_idle_tick = tick;
+#endif
+
sd->canuseitem_tick = tick;
sd->canusecashfood_tick = tick;
sd->canequip_tick = tick;
@@ -915,7 +929,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if (battle_config.display_version == 1){
char buf[256];
- sprintf(buf, "eAthena SVN version: %s", get_svn_revision());
+ sprintf(buf, "SVN version: %s", get_svn_revision());
clif_displaymessage(sd->fd, buf);
}
@@ -1814,14 +1828,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_BASE_ATK:
if(sd->state.lr_flag != 2) {
- bonus = status->equipment_atk + val;
- status->equipment_atk = cap_value(bonus, 0, USHRT_MAX);
+ bonus = status->batk + val;
+ status->batk = cap_value(bonus, 0, USHRT_MAX);
}
break;
case SP_DEF1:
if(sd->state.lr_flag != 2) {
bonus = status->def + val;
- status->def = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ status->def = cap_value(bonus, CHAR_MIN, CHAR_MAX);
}
break;
case SP_DEF2:
@@ -1833,7 +1847,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
case SP_MDEF1:
if(sd->state.lr_flag != 2) {
bonus = status->mdef + val;
- status->mdef = cap_value(bonus, SHRT_MIN, SHRT_MAX);
+ status->mdef = cap_value(bonus, CHAR_MIN, CHAR_MAX);
}
break;
case SP_MDEF2:
@@ -1925,10 +1939,6 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
if(sd->state.lr_flag != 2)
sd->castrate+=val;
break;
- case SP_FIXEDCASTRATE:
- if(sd->state.lr_flag != 2)
- sd->fixedcastrate+=val;
- break;
case SP_MAXHPRATE:
if(sd->state.lr_flag != 2)
sd->hprate+=val;
@@ -1976,7 +1986,7 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
break;
case SP_ASPD_RATE: //Stackable increase - Made it linear as per rodatazone
if(sd->state.lr_flag != 2)
- status->aspd_rate -= 10 * val;
+ status->aspd_rate -= 10*val;
break;
case SP_HP_RECOV_RATE:
if(sd->state.lr_flag != 2)
@@ -2010,14 +2020,6 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
if(sd->state.lr_flag != 2)
sd->matk_rate += val;
break;
- case SP_WEAPON_MATK:
- if(sd->state.lr_flag != 2)
- sd->weapon_matk += val;
- break;
- case SP_EQUIPMENT_MATK:
- if(sd->state.lr_flag != 2)
- sd->equipment_matk += val;
- break;
case SP_IGNORE_DEF_ELE:
if(val >= ELE_MAX) {
ShowError("pc_bonus: SP_IGNORE_DEF_ELE: Invalid element %d\n", val);
@@ -2713,23 +2715,6 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
}
break;
- case SP_FIXEDCASTRATE:
- if(sd->state.lr_flag == 2)
- break;
- ARR_FIND(0, ARRAYLENGTH(sd->fixedskillcast), i, sd->fixedskillcast[i].id == 0 || sd->fixedskillcast[i].id == type2);
- if (i == ARRAYLENGTH(sd->fixedskillcast))
- { //Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("run_script: bonus2 bFixedCastRate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->fixedskillcast), type2, val);
- break;
- }
- if(sd->fixedskillcast[i].id == type2)
- sd->fixedskillcast[i].val += val;
- else {
- sd->fixedskillcast[i].id = type2;
- sd->fixedskillcast[i].val = val;
- }
- break;
-
case SP_HP_LOSS_RATE:
if(sd->state.lr_flag != 2) {
sd->hp_loss.value = type2;
@@ -3199,25 +3184,19 @@ int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
int pc_checkadditem(struct map_session_data *sd,int nameid,int amount)
{
int i;
- struct item_data* data;
nullpo_ret(sd);
if(amount > MAX_AMOUNT)
return ADDITEM_OVERAMOUNT;
- data = itemdb_search(nameid);
-
- if(!itemdb_isstackable2(data))
+ if(!itemdb_isstackable(nameid))
return ADDITEM_NEW;
- if( data->stack.inventory && amount > data->stack.amount )
- return ADDITEM_OVERAMOUNT;
-
for(i=0;i<MAX_INVENTORY;i++){
// FIXME: This does not consider the checked item's cards, thus could check a wrong slot for stackability.
if(sd->status.inventory[i].nameid==nameid){
- if( amount > MAX_AMOUNT - sd->status.inventory[i].amount || ( data->stack.inventory && amount > data->stack.amount - sd->status.inventory[i].amount ) )
+ if(sd->status.inventory[i].amount+amount > MAX_AMOUNT)
return ADDITEM_OVERAMOUNT;
return ADDITEM_EXIST;
}
@@ -3411,16 +3390,18 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount)
return 5;
data = itemdb_search(item_data->nameid);
-
- if( data->stack.inventory && amount > data->stack.amount )
- {// item stack limitation
- return 7;
- }
-
w = data->weight*amount;
if(sd->weight + w > sd->max_weight)
return 2;
-
+ if( itemdb_is_rune(item_data->nameid) ) {
+ int rune = pc_search_inventory(sd,item_data->nameid);
+ if( ( rune >= 0 && sd->status.inventory[rune].amount + amount > MAX_RUNE ) ||
+ ( rune == -1 && amount > MAX_RUNE )
+ ) {
+ clif_msgtable(sd->fd,0x61b);
+ return 1;
+ }
+ }
i = MAX_INVENTORY;
if( itemdb_isstackable2(data) && item_data->expire_time == 0 )
@@ -3429,7 +3410,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount)
{
if( sd->status.inventory[i].nameid == item_data->nameid && memcmp(&sd->status.inventory[i].card, &item_data->card, sizeof(item_data->card)) == 0 )
{
- if( amount > MAX_AMOUNT - sd->status.inventory[i].amount || ( data->stack.inventory && amount > data->stack.amount - sd->status.inventory[i].amount ) )
+ if( amount > MAX_AMOUNT - sd->status.inventory[i].amount )
return 5;
sd->status.inventory[i].amount += amount;
clif_additem(sd,i,amount,0);
@@ -3615,7 +3596,6 @@ int pc_isUseitem(struct map_session_data *sd,int n)
//Not consumable item
if( item->type != IT_HEALING && item->type != IT_USABLE && item->type != IT_CASH )
return 0;
- // This contradicts official behavior. Items with no scripts should be consumed regardless. [L0ne_W0lf]
if( !item->script ) //if it has no script, you can't really consume it!
return 0;
@@ -3694,6 +3674,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if( nameid == 12243 && sd->md->db->lv < 80 )
return 0;
break;
+
case 12213: //Neuralizer
if( !map[sd->bl.m].flag.reset )
return 0;
@@ -3703,7 +3684,15 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if( nameid >= 12153 && nameid <= 12182 && sd->md != NULL )
return 0; // Mercenary Scrolls
- if (nameid >= 12725 && nameid <= 12733 && !pc_isUseitem_check_runeskill(sd, sd->status.inventory[n].nameid) )
+ /**
+ * Only Rune Knights may use runes
+ **/
+ if( itemdb_is_rune(nameid) && (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
+ return 0;
+ /**
+ * Only GCross may use poisons
+ **/
+ else if( itemdb_is_poison(nameid) && (sd->class_&MAPID_THIRDMASK) != MAPID_GUILLOTINE_CROSS )
return 0;
//added item_noequip.txt items check by Maya&[Lupus]
@@ -3729,13 +3718,14 @@ int pc_isUseitem(struct map_session_data *sd,int n)
(item->class_base[sd->class_&JOBL_2_1?1:(sd->class_&JOBL_2_2?2:0)])
))
return 0;
-
- //Not usable by upper class. [Skotlex]
- if(!(
- (1<<(sd->class_&JOBL_UPPER?1:(sd->class_&JOBL_BABY?2:0))) &
- item->class_upper
- ))
+ //Not usable by upper class. [Inkfish]
+ while( 1 ) {
+ if( item->class_upper&1 && !(sd->class_&(JOBL_UPPER|JOBL_THIRD|JOBL_BABY)) ) break;
+ if( item->class_upper&2 && sd->class_&(JOBL_UPPER|JOBL_THIRD) ) break;
+ if( item->class_upper&4 && sd->class_&JOBL_BABY ) break;
+ if( item->class_upper&8 && sd->class_&JOBL_THIRD ) break;
return 0;
+ }
//Dead Branch & Bloody Branch & Porings Box
if((log_config.branch > 0) && (nameid == 604 || nameid == 12103 || nameid == 12109))
@@ -3744,45 +3734,6 @@ int pc_isUseitem(struct map_session_data *sd,int n)
return 1;
}
-
-int pc_isUseitem_check_runeskill(TBL_PC *sd, int nameid)
-{
- struct {
- int runeid;
- int skillid;
- } rune2skill_table[] = {
- { 12725, RK_REFRESH },
- { 12726, RK_CRUSHSTRIKE },
- { 12727, RK_MILLENNIUMSHIELD },
- { 12728, RK_VITALITYACTIVATION },
- { 12729, RK_FIGHTINGSPIRIT },
- { 12730, RK_ABUNDANCE },
- { 12731, RK_GIANTGROWTH },
- { 12732, RK_STORMBLAST },
- { 12733, RK_STONEHARDSKIN },
- };
-
- int i;
- int skillid;
-
- nullpo_retr(0, sd);
-
- ARR_FIND(0, ARRAYLENGTH(rune2skill_table), i, rune2skill_table[i].runeid == nameid);
- if ( i == ARRAYLENGTH(rune2skill_table) ) {
- ShowError("pc_isUseitem_check_runeskill: rune %d skill not found.\n", nameid);
- return 0;
- }
-
- skillid = rune2skill_table[i].skillid;
- if ( battle_config.rune_block_by_skill && skillnotok(skillid, sd) )
- return 0;
- if ( battle_config.rune_block_by_status && status_skill2sc(skillid) != SC_NONE && sd->sc.data[status_skill2sc(skillid)] )
- return 0;
-
- return 1;
-}
-
-
/*==========================================
* アイテムを使う
*------------------------------------------*/
@@ -3904,11 +3855,6 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
return 1;
data = itemdb_search(item_data->nameid);
- if( data->stack.cart && amount > data->stack.amount )
- {// item stack limitation
- return 1;
- }
-
if( !itemdb_cancartstore(item_data, pc_isGM(sd)) )
{ // Check item trade restrictions [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
@@ -3929,7 +3875,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
if( i < MAX_CART )
{// item already in cart, stack it
- if( amount > MAX_AMOUNT - sd->status.cart[i].amount || ( data->stack.cart && amount > data->stack.amount - sd->status.cart[i].amount ) )
+ if(sd->status.cart[i].amount+amount > MAX_AMOUNT)
return 1; // no room
sd->status.cart[i].amount+=amount;
@@ -4575,21 +4521,6 @@ int pc_jobid2mapid(unsigned short b_class)
case JOB_ALCHEMIST: return MAPID_ALCHEMIST;
case JOB_ROGUE: return MAPID_ROGUE;
case JOB_SOUL_LINKER: return MAPID_SOUL_LINKER;
- //3_1 classes
- case JOB_RUNE_KNIGHT: return MAPID_RUNE_KNIGHT;
- case JOB_WARLOCK: return MAPID_WARLOCK;
- case JOB_RANGER: return MAPID_RANGER;
- case JOB_ARCHBISHOP: return MAPID_ARCHBISHOP;
- case JOB_MECHANIC: return MAPID_MECHANIC;
- case JOB_GUILLOTINE_CROSS: return MAPID_GUILLOTINE_CROSS;
- //3_2 classes
- case JOB_ROYAL_GUARD: return MAPID_ROYAL_GUARD;
- case JOB_SORCERER: return MAPID_SORCERER;
- case JOB_MINSTREL:
- case JOB_WANDERER: return MAPID_MINSTRELWANDERER;
- case JOB_SURA: return MAPID_SURA;
- case JOB_GENETIC: return MAPID_GENETIC;
- case JOB_SHADOW_CHASER: return MAPID_SHADOW_CHASER;
//1st: advanced
case JOB_NOVICE_HIGH: return MAPID_NOVICE_HIGH;
case JOB_SWORDMAN_HIGH: return MAPID_SWORDMAN_HIGH;
@@ -4613,21 +4544,6 @@ int pc_jobid2mapid(unsigned short b_class)
case JOB_CHAMPION: return MAPID_CHAMPION;
case JOB_CREATOR: return MAPID_CREATOR;
case JOB_STALKER: return MAPID_STALKER;
- //3_1 advanced
- case JOB_RUNE_KNIGHT_H: return MAPID_RUNE_KNIGHT_H;
- case JOB_WARLOCK_H: return MAPID_WARLOCK_H;
- case JOB_RANGER_H: return MAPID_RANGER_H;
- case JOB_ARCHBISHOP_H: return MAPID_ARCHBISHOP_H;
- case JOB_MECHANIC_H: return MAPID_MECHANIC_H;
- case JOB_GUILLOTINE_CROSS_H:return MAPID_GUILLOTINE_CROSS_H;
- //3_2 advanced
- case JOB_ROYAL_GUARD_H: return MAPID_ROYAL_GUARD_H;
- case JOB_SORCERER_H: return MAPID_SORCERER_H;
- case JOB_MINSTREL_H:
- case JOB_WANDERER_H: return MAPID_MINSTRELWANDERER_H;
- case JOB_SURA_H: return MAPID_SURA_H;
- case JOB_GENETIC_H: return MAPID_GENETIC_H;
- case JOB_SHADOW_CHASER_H: return MAPID_SHADOW_CHASER_H;
//1-1 baby
case JOB_BABY: return MAPID_BABY;
case JOB_BABY_SWORDMAN: return MAPID_BABY_SWORDMAN;
@@ -4652,21 +4568,36 @@ int pc_jobid2mapid(unsigned short b_class)
case JOB_BABY_MONK: return MAPID_BABY_MONK;
case JOB_BABY_ALCHEMIST: return MAPID_BABY_ALCHEMIST;
case JOB_BABY_ROGUE: return MAPID_BABY_ROGUE;
- //3_1 baby classes
- case JOB_BABY_RUNE: return MAPID_BABY_RUNE;
- case JOB_BABY_WARLOCK: return MAPID_BABY_WARLOCK;
- case JOB_BABY_RANGER: return MAPID_BABY_RANGER;
- case JOB_BABY_BISHOP: return MAPID_BABY_BISHOP;
- case JOB_BABY_MECHANIC: return MAPID_BABY_MECHANIC;
- case JOB_BABY_CROSS: return MAPID_BABY_CROSS;
- //3_2 baby classes
- case JOB_BABY_GUARD: return MAPID_BABY_GUARD;
- case JOB_BABY_SORCERER: return MAPID_BABY_SORCERER;
- case JOB_BABY_WANDERER:
- case JOB_BABY_MINSTREL: return MAPID_BABY_MINSTRELWANDERER;
- case JOB_BABY_SURA: return MAPID_BABY_SURA;
- case JOB_BABY_GENETIC: return MAPID_BABY_GENETIC;
- case JOB_BABY_CHASER: return MAPID_BABY_CHASER;
+ //3.1 non-trans
+ case JOB_RUNE_KNIGHT: return MAPID_RUNE_KNIGHT;
+ case JOB_WARLOCK: return MAPID_WARLOCK;
+ case JOB_RANGER: return MAPID_RANGER;
+ case JOB_ARCH_BISHOP: return MAPID_ARCH_BISHOP;
+ case JOB_MECHANIC: return MAPID_MECHANIC;
+ case JOB_GUILLOTINE_CROSS: return MAPID_GUILLOTINE_CROSS;
+ //3.1 trans
+ case JOB_RUNE_KNIGHT_T: return MAPID_RUNE_KNIGHT_T;
+ case JOB_WARLOCK_T: return MAPID_WARLOCK_T;
+ case JOB_RANGER_T: return MAPID_RANGER_T;
+ case JOB_ARCH_BISHOP_T: return MAPID_ARCH_BISHOP_T;
+ case JOB_MECHANIC_T: return MAPID_MECHANIC_T;
+ case JOB_GUILLOTINE_CROSS_T:return MAPID_GUILLOTINE_CROSS_T;
+ //3.2 non-trans
+ case JOB_ROYAL_GUARD: return MAPID_ROYAL_GUARD;
+ case JOB_SORCERER: return MAPID_SORCERER;
+ case JOB_MINSTREL: return MAPID_MINSTRELWANDERER;
+ case JOB_WANDERER: return MAPID_MINSTRELWANDERER;
+ case JOB_SURA: return MAPID_SURA;
+ case JOB_GENETIC: return MAPID_GENETIC;
+ case JOB_SHADOW_CHASER: return MAPID_SHADOW_CHASER;
+ //3.2 trans
+ case JOB_ROYAL_GUARD_T: return MAPID_ROYAL_GUARD_T;
+ case JOB_SORCERER_T: return MAPID_SORCERER_T;
+ case JOB_MINSTREL_T: return MAPID_MINSTRELWANDERER_T;
+ case JOB_WANDERER_T: return MAPID_MINSTRELWANDERER_T;
+ case JOB_SURA_T: return MAPID_SURA_T;
+ case JOB_GENETIC_T: return MAPID_GENETIC_T;
+ case JOB_SHADOW_CHASER_T: return MAPID_SHADOW_CHASER_T;
default:
return -1;
}
@@ -4708,20 +4639,6 @@ int pc_mapid2jobid(unsigned short class_, int sex)
case MAPID_ALCHEMIST: return JOB_ALCHEMIST;
case MAPID_ROGUE: return JOB_ROGUE;
case MAPID_SOUL_LINKER: return JOB_SOUL_LINKER;
- //3_1 classes
- case MAPID_RUNE_KNIGHT: return JOB_RUNE_KNIGHT;
- case MAPID_WARLOCK: return JOB_WARLOCK;
- case MAPID_RANGER: return JOB_RANGER;
- case MAPID_ARCHBISHOP: return JOB_ARCHBISHOP;
- case MAPID_MECHANIC: return JOB_MECHANIC;
- case MAPID_GUILLOTINE_CROSS:return JOB_GUILLOTINE_CROSS;
- //3_2 classes
- case MAPID_ROYAL_GUARD: return JOB_ROYAL_GUARD;
- case MAPID_SORCERER: return JOB_SORCERER;
- case MAPID_MINSTRELWANDERER:return sex?JOB_MINSTREL:JOB_WANDERER;
- case MAPID_SURA: return JOB_SURA;
- case MAPID_GENETIC: return JOB_GENETIC;
- case MAPID_SHADOW_CHASER: return JOB_SHADOW_CHASER;
//1st: advanced
case MAPID_NOVICE_HIGH: return JOB_NOVICE_HIGH;
case MAPID_SWORDMAN_HIGH: return JOB_SWORDMAN_HIGH;
@@ -4744,20 +4661,6 @@ int pc_mapid2jobid(unsigned short class_, int sex)
case MAPID_CHAMPION: return JOB_CHAMPION;
case MAPID_CREATOR: return JOB_CREATOR;
case MAPID_STALKER: return JOB_STALKER;
- //3_1 advanced
- case MAPID_RUNE_KNIGHT_H: return JOB_RUNE_KNIGHT_H;
- case MAPID_WARLOCK_H: return JOB_WARLOCK_H;
- case MAPID_RANGER_H: return JOB_RANGER_H;
- case MAPID_ARCHBISHOP_H: return JOB_ARCHBISHOP_H;
- case MAPID_MECHANIC_H: return JOB_MECHANIC_H;
- case MAPID_GUILLOTINE_CROSS_H: return JOB_GUILLOTINE_CROSS_H;
- //3_2 advanced
- case MAPID_ROYAL_GUARD_H: return JOB_ROYAL_GUARD_H;
- case MAPID_SORCERER_H: return JOB_SORCERER_H;
- case MAPID_MINSTRELWANDERER_H: return sex?JOB_MINSTREL_H:JOB_WANDERER_H;
- case MAPID_SURA_H: return JOB_SURA_H;
- case MAPID_GENETIC_H: return JOB_GENETIC_H;
- case MAPID_SHADOW_CHASER_H: return JOB_SHADOW_CHASER_H;
//1-1 baby
case MAPID_BABY: return JOB_BABY;
case MAPID_BABY_SWORDMAN: return JOB_BABY_SWORDMAN;
@@ -4781,20 +4684,34 @@ int pc_mapid2jobid(unsigned short class_, int sex)
case MAPID_BABY_MONK: return JOB_BABY_MONK;
case MAPID_BABY_ALCHEMIST: return JOB_BABY_ALCHEMIST;
case MAPID_BABY_ROGUE: return JOB_BABY_ROGUE;
- //3_1 baby classes
- case MAPID_BABY_RUNE: return JOB_BABY_RUNE;
- case MAPID_BABY_WARLOCK: return JOB_BABY_WARLOCK;
- case MAPID_BABY_RANGER: return JOB_BABY_RANGER;
- case MAPID_BABY_BISHOP: return JOB_BABY_BISHOP;
- case MAPID_BABY_MECHANIC: return JOB_BABY_MECHANIC;
- case MAPID_BABY_CROSS: return JOB_BABY_CROSS;
- //3_2 baby classes
- case MAPID_BABY_GUARD: return JOB_BABY_GUARD;
- case MAPID_BABY_SORCERER: return JOB_BABY_SORCERER;
- case MAPID_BABY_MINSTRELWANDERER: return sex?JOB_BABY_MINSTREL:JOB_BABY_WANDERER;
- case MAPID_BABY_SURA: return JOB_BABY_SURA;
- case MAPID_BABY_GENETIC: return JOB_BABY_GENETIC;
- case MAPID_BABY_CHASER: return JOB_BABY_CHASER;
+ //3.1 non-trans
+ case MAPID_RUNE_KNIGHT: return JOB_RUNE_KNIGHT;
+ case MAPID_WARLOCK: return JOB_WARLOCK;
+ case MAPID_RANGER: return JOB_RANGER;
+ case MAPID_ARCH_BISHOP: return JOB_ARCH_BISHOP;
+ case MAPID_MECHANIC: return JOB_MECHANIC;
+ case MAPID_GUILLOTINE_CROSS:return JOB_GUILLOTINE_CROSS;
+ //3.1 trans
+ case MAPID_RUNE_KNIGHT_T: return JOB_RUNE_KNIGHT_T;
+ case MAPID_WARLOCK_T: return JOB_WARLOCK_T;
+ case MAPID_RANGER_T: return JOB_RANGER_T;
+ case MAPID_ARCH_BISHOP_T: return JOB_ARCH_BISHOP_T;
+ case MAPID_MECHANIC_T: return JOB_MECHANIC_T;
+ case MAPID_GUILLOTINE_CROSS_T:return JOB_GUILLOTINE_CROSS_T;
+ //3.2 non-trans
+ case MAPID_ROYAL_GUARD: return JOB_ROYAL_GUARD;
+ case MAPID_SORCERER: return JOB_SORCERER;
+ case MAPID_MINSTRELWANDERER:return sex?JOB_MINSTREL:JOB_WANDERER;
+ case MAPID_SURA: return JOB_SURA;
+ case MAPID_GENETIC: return JOB_GENETIC;
+ case MAPID_SHADOW_CHASER: return JOB_SHADOW_CHASER;
+ //3.2 trans
+ case MAPID_ROYAL_GUARD_T: return JOB_ROYAL_GUARD_T;
+ case MAPID_SORCERER_T: return JOB_SORCERER_T;
+ case MAPID_MINSTRELWANDERER_T:return sex?JOB_MINSTREL_T:JOB_WANDERER_T;
+ case MAPID_SURA_T: return JOB_SURA_T;
+ case MAPID_GENETIC_T: return JOB_GENETIC_T;
+ case MAPID_SHADOW_CHASER_T: return JOB_SHADOW_CHASER_T;
default:
return -1;
}
@@ -4922,86 +4839,9 @@ const char* job_name(int class_)
return msg_txt(617);
case JOB_SOUL_LINKER:
return msg_txt(618);
-
- case JOB_RUNE_KNIGHT:
- case JOB_WARLOCK:
- case JOB_RANGER:
- case JOB_ARCHBISHOP:
- case JOB_MECHANIC:
- case JOB_GUILLOTINE_CROSS:
- return msg_txt(625 - JOB_RUNE_KNIGHT +class_);
-
- case JOB_RUNE_KNIGHT_H:
- case JOB_WARLOCK_H:
- case JOB_RANGER_H:
- case JOB_ARCHBISHOP_H:
- case JOB_MECHANIC_H:
- case JOB_GUILLOTINE_CROSS_H:
- return msg_txt(625 - JOB_RUNE_KNIGHT_H +class_);
-
- case JOB_ROYAL_GUARD:
- case JOB_SORCERER:
- case JOB_MINSTREL:
- case JOB_WANDERER:
- case JOB_SURA:
- case JOB_GENETIC:
- case JOB_SHADOW_CHASER:
- return msg_txt(631 - JOB_ROYAL_GUARD +class_);
-
- case JOB_ROYAL_GUARD_H:
- case JOB_SORCERER_H:
- case JOB_MINSTREL_H:
- case JOB_WANDERER_H:
- case JOB_SURA_H:
- case JOB_GENETIC_H:
- case JOB_SHADOW_CHASER_H:
- return msg_txt(631 - JOB_ROYAL_GUARD_H +class_);
-
- case JOB_RUNE_KNIGHT2:
- case JOB_RUNE_KNIGHT_H2:
- return msg_txt(625);
-
- case JOB_ROYAL_GUARD2:
- case JOB_ROYAL_GUARD_H2:
- return msg_txt(631);
-
- case JOB_RANGER2:
- case JOB_RANGER_H2:
- return msg_txt(627);
-
- case JOB_MECHANIC2:
- case JOB_MECHANIC_H2:
- return msg_txt(629);
-
- case JOB_BABY_RUNE:
- case JOB_BABY_WARLOCK:
- case JOB_BABY_RANGER:
- case JOB_BABY_BISHOP:
- case JOB_BABY_MECHANIC:
- case JOB_BABY_CROSS:
- case JOB_BABY_GUARD:
- case JOB_BABY_SORCERER:
- case JOB_BABY_MINSTREL:
- case JOB_BABY_WANDERER:
- case JOB_BABY_SURA:
- case JOB_BABY_GENETIC:
- case JOB_BABY_CHASER:
- return msg_txt(638 - JOB_BABY_RUNE +class_);
-
- case JOB_BABY_RUNE2:
- return msg_txt(638);
-
- case JOB_BABY_GUARD2:
- return msg_txt(644);
-
- case JOB_BABY_RANGER2:
- return msg_txt(640);
-
- case JOB_BABY_MECHANIC2:
- return msg_txt(642);
-
+
default:
- return msg_txt(651);
+ return msg_txt(650);
}
}
@@ -5150,7 +4990,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
status_calc_pc(sd,0);
clif_misceffect(&sd->bl,1);
if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
- clif_status_change(&sd->bl,SI_DEVIL, 1, 0); //Permanent blind effect from SG_DEVIL.
+ clif_status_change(&sd->bl,SI_DEVIL, 1, 0, 0, 0, 1); //Permanent blind effect from SG_DEVIL.
npc_script_event(sd, NPCE_JOBLVUP);
return 1;
@@ -5191,7 +5031,6 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
{
float nextbp=0, nextjp=0;
unsigned int nextb=0, nextj=0;
- int leveldiff = src ? ( sd->status.base_level - status_get_lv(src) ) : 0, modifier = 100;
nullpo_ret(sd);
if(sd->bl.prev == NULL || pc_isdead(sd))
@@ -5230,52 +5069,6 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
}
}
- /*Adjust exp by mob level difference vs player level.
- Higher level creatures give more exp, lower level creatures give less
- and you'll get normal experience if they're very close to your level.
-
- -2 to +5 = 100%
- -3 = 105%
- -4 = 110%
- -5 = 115%
- -6 = 120%
- -7 = 125%
- -8 = 130%
- -9 = 135%
- -10 = 140%
- -11 or lower = 40%
-
- +6 to +10 = 95%
- +11 to +15 = 90%
- +15 to +20 = 85%
- +21 to +25 = 60%
- +26 to +30 = 35%
- +31 or higher = 10% */
-
- if (leveldiff >= 6 && leveldiff <= 10)
- modifier = -5;
- if (leveldiff >= 11 && leveldiff <= 15)
- modifier = -10;
- if (leveldiff >= 16 && leveldiff <= 20)
- modifier = -15;
- if (leveldiff >= 21 && leveldiff <= 25)
- modifier = -40;
- if (leveldiff >= 26 && leveldiff <= 30)
- modifier = -65;
- if (leveldiff > 30)
- modifier = -90;
- if (leveldiff <= -3 && leveldiff >= -10)
- modifier = ((leveldiff * -5)-10);
- if (leveldiff <= -10)
- modifier = -60;
-
- if ( modifier < 0 )
- modifier = modifier * -1;
- if ( modifier != 100 ) {
- base_exp = (int)((float)base_exp - (((float)modifier/100) * (float)base_exp));
- job_exp = (int)((float)job_exp - (((float)modifier/100) * (float)job_exp));
- }
-
//Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex]
if (base_exp) {
nextb = nextb?UINT_MAX:pc_thisbaseexp(sd);
@@ -5410,12 +5203,7 @@ int pc_gets_status_point(int level)
if (battle_config.use_statpoint_table) //Use values from "db/statpoint.txt"
return (statp[level+1] - statp[level]);
else //Default increase
- {
- if (level < 100)
- return ((level+15) / 5);
- else
- return ((level+130) / 10);
- }
+ return ((level+15) / 5);
}
/// Returns the number of stat points needed to change the specified stat by val.
@@ -5429,18 +5217,17 @@ int pc_need_status_point(struct map_session_data* sd, int type, int val)
return 0;
low = pc_getstat(sd,type);
- if ( low >= pc_maxparameter(sd) && val > 0 )
- return 0; // Official servers show '0' when max is reached
high = low + val;
if ( val < 0 )
swap(low, high);
for ( ; low < high; low++ )
- if( low < 100 )
- sp += ( 1 + (low + 9) / 10 );
- else
- sp += ( 16 + 4*((low - 100) / 5) );
+#if RRMODE //Renewal Stat Cost Formula
+ sp += (low < 100) ? (2 + (low - 1) / 10) : (16 + 4 * ((low - 100) / 5));
+#else
+ sp += ( 1 + (low + 9) / 10 );
+#endif
return sp;
}
@@ -5789,9 +5576,16 @@ int pc_resetskill(struct map_session_data* sd, int flag)
i &= ~OPTION_CART;
if( i&OPTION_FALCON && pc_checkskill(sd, HT_FALCON) )
i &= ~OPTION_FALCON;
- if( i&OPTION_DRAGON && pc_checkskill(sd, KN_RIDING) ) //RK_DRAGONTRAINING not needed for riding (bug?), assuming KN_RIDING is.
- i&=~OPTION_DRAGON;
-
+ if( i&OPTION_DRAGON && pc_checkskill(sd, RK_DRAGONTRAINING) )
+ i &= ~OPTION_DRAGON;
+ if( i&OPTION_WUG && pc_checkskill(sd, RA_WUGMASTERY) )
+ i &= ~OPTION_WUG;
+ if( i&OPTION_WUGRIDER && pc_checkskill(sd, RA_WUGRIDER) )
+ i &= ~OPTION_WUGRIDER;
+ if( i&OPTION_MADOGEAR && ( sd->class_&MAPID_THIRDMASK ) == MAPID_MECHANIC )
+ i &= ~OPTION_MADOGEAR;
+ if( i&OPTION_MOUNTING )
+ i &= ~OPTION_MOUNTING;
if( i != sd->sc.option )
pc_setoption(sd, i);
@@ -6565,13 +6359,6 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
sp -= sp * sd->sc.data[SC_CRITICALWOUND]->val2 / 100;
}
- if (sd->sc.data[SC_VITALITYACTIVATION])
- {
- hp += hp * sd->sc.data[SC_VITALITYACTIVATION]->val2 / 100; //HP +50%
- sp -= sp * sd->sc.data[SC_VITALITYACTIVATION]->val3 / 100; //SP -50%
- }
-
-
return status_heal(&sd->bl, hp, sp, 1);
}
@@ -6690,14 +6477,6 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
clif_updatestatus(sd,SP_JOBEXP);
clif_updatestatus(sd,SP_NEXTJOBEXP);
- //New job may have new max_parameter, so update stat points needed to raise a stat
- clif_updatestatus(sd,SP_USTR);
- clif_updatestatus(sd,SP_UAGI);
- clif_updatestatus(sd,SP_UVIT);
- clif_updatestatus(sd,SP_UINT);
- clif_updatestatus(sd,SP_UDEX);
- clif_updatestatus(sd,SP_ULUK);
-
for(i=0;i<EQI_MAX;i++) {
if(sd->equip_index[i] >= 0)
if(!pc_isequip(sd,sd->equip_index[i]))
@@ -6726,9 +6505,14 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
i&=~OPTION_CART;
if(i&OPTION_FALCON && !pc_checkskill(sd, HT_FALCON))
i&=~OPTION_FALCON;
- if(i&OPTION_DRAGON && !pc_checkskill(sd, KN_RIDING)) //RK_DRAGONTRAINING not needed for riding (bug?), assuming KN_RIDING is.
+ if( i&OPTION_DRAGON && !pc_checkskill(sd,RK_DRAGONTRAINING) )
i&=~OPTION_DRAGON;
-
+ if( i&OPTION_WUGRIDER && !pc_checkskill(sd,RA_WUGMASTERY) )
+ i&=~OPTION_WUGRIDER;
+ if( i&OPTION_WUG && !pc_checkskill(sd,RA_WUGMASTERY) )
+ i&=~OPTION_WUG;
+ if( i&OPTION_MADOGEAR ) //You do not need a skill for this.
+ i&=~OPTION_MADOGEAR;
if(i != sd->sc.option)
pc_setoption(sd, i);
@@ -6856,19 +6640,15 @@ int pc_setoption(struct map_session_data *sd,int type)
sd->sc.option=type;
clif_changeoption(&sd->bl);
- if (((type&OPTION_RIDING && !(p_type&OPTION_RIDING)) // Knight and Crusader/Royal Guard
- || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON))) // Rune Knight Dragon
- && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
- { //We are going to mount. [Skotlex]
+ if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc_checkskill(sd,RK_DRAGONTRAINING) > 0) )
+ { // Mounting
clif_status_load(&sd->bl,SI_RIDING,1);
- status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds.
+ status_calc_pc(sd,0);
}
- else if (((!(type&OPTION_RIDING) && p_type&OPTION_RIDING) //Knight and Crusader/Royal Guard
- || (!(type&OPTION_DRAGON) && p_type&OPTION_DRAGON)) // Rune Knight Dragon
- && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
- { //We are going to dismount.
+ else if( (!(type&OPTION_RIDING) && p_type&OPTION_RIDING) || (!(type&OPTION_DRAGON) && p_type&OPTION_DRAGON && pc_checkskill(sd,RK_DRAGONTRAINING) > 0) )
+ { // Dismount
clif_status_load(&sd->bl,SI_RIDING,0);
- status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds.
+ status_calc_pc(sd,0);
}
if(type&OPTION_CART && !(p_type&OPTION_CART))
@@ -6885,11 +6665,49 @@ int pc_setoption(struct map_session_data *sd,int type)
status_calc_pc(sd,0); //Remove speed penalty.
}
+ if (type&OPTION_MOUNTING && !(p_type&OPTION_MOUNTING)) {
+ clif_status_load_notick(&sd->bl,SI_ALL_RIDING,2,1,0,0);
+ status_calc_pc(sd,0);
+ } else if (!(type&OPTION_MOUNTING) && p_type&OPTION_MOUNTING) {
+ clif_status_load_notick(&sd->bl,SI_ALL_RIDING,0,0,0,0);
+ status_calc_pc(sd,0);
+ }
+
+
if (type&OPTION_FALCON && !(p_type&OPTION_FALCON)) //Falcon ON
clif_status_load(&sd->bl,SI_FALCON,1);
else if (!(type&OPTION_FALCON) && p_type&OPTION_FALCON) //Falcon OFF
clif_status_load(&sd->bl,SI_FALCON,0);
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER ) {
+ if( type&OPTION_WUGRIDER && !(p_type&OPTION_WUGRIDER) ) { // Mounting
+ clif_status_load(&sd->bl,SI_WUGRIDER,1);
+ status_calc_pc(sd,0);
+ } else if( !(type&OPTION_WUGRIDER) && p_type&OPTION_WUGRIDER ) { // Dismount
+ clif_status_load(&sd->bl,SI_WUGRIDER,0);
+ status_calc_pc(sd,0);
+ }
+ }
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
+ if( type&OPTION_MADOGEAR && !(p_type&OPTION_MADOGEAR) ) {
+ status_calc_pc(sd, 0);
+ status_change_end(&sd->bl,SC_MAXIMIZEPOWER,-1);
+ status_change_end(&sd->bl,SC_OVERTHRUST,-1);
+ status_change_end(&sd->bl,SC_WEAPONPERFECTION,-1);
+ status_change_end(&sd->bl,SC_ADRENALINE,-1);
+ status_change_end(&sd->bl,SC_CARTBOOST,-1);
+ status_change_end(&sd->bl,SC_MELTDOWN,-1);
+ status_change_end(&sd->bl,SC_MAXOVERTHRUST,-1);
+ } else if( !(type&OPTION_MADOGEAR) && p_type&OPTION_MADOGEAR ) {
+ status_calc_pc(sd, 0);
+ status_change_end(&sd->bl,SC_SHAPESHIFT,-1);
+ status_change_end(&sd->bl,SC_HOVERING,-1);
+ status_change_end(&sd->bl,SC_ACCELERATION,-1);
+ status_change_end(&sd->bl,SC_OVERHEAT_LIMITPOINT,-1);
+ status_change_end(&sd->bl,SC_OVERHEAT,-1);
+ }
+ }
+
if (type&OPTION_FLYING && !(p_type&OPTION_FLYING))
new_look = JOB_STAR_GLADIATOR2;
else if (!(type&OPTION_FLYING) && p_type&OPTION_FLYING)
@@ -6976,29 +6794,13 @@ int pc_setriding(TBL_PC* sd, int flag)
if( pc_checkskill(sd,KN_RIDING) > 0 ) // ライディングスキル所持
pc_setoption(sd, sd->sc.option|OPTION_RIDING);
} else if( pc_isriding(sd) ){
- pc_setoption(sd, sd->sc.option&~OPTION_RIDING);
+ pc_setoption(sd, sd->sc.option&~OPTION_RIDING);
}
return 0;
}
/*==========================================
- * Enable Riding Dragons for Rune Knight class.
- *------------------------------------------*/
-int pc_setdragon(TBL_PC* sd, int flag, int color)
-{
- int dragon[5] = {OPTION_DRAGON1,OPTION_DRAGON2,OPTION_DRAGON3,OPTION_DRAGON4,OPTION_DRAGON5};
-
- if( flag ){
- if( pc_checkskill(sd,KN_RIDING) > 0 ) //Possible to rent dragons without RK_DRAGONTRAINING; Source, iRO. (Bug?)
- pc_setoption(sd, sd->sc.option|dragon[color]);
- } else if( pc_isdragon(sd) ){
- pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
- }
-
- return 0;
-}
-/*==========================================
* アイテムドロップ可不可判定
*------------------------------------------*/
int pc_candrop(struct map_session_data *sd,struct item *item)
@@ -8149,6 +7951,30 @@ void pc_setstand(struct map_session_data *sd){
sd->state.dead_sit = sd->vd.dead_sit = 0;
}
+/**
+ * Mechanic (MADO GEAR)
+ **/
+void pc_overheat(struct map_session_data *sd, int val) {
+ int heat = val, skill,
+ limit[] = { 10, 20, 28, 46, 66 };
+
+ if( !(sd->sc.option&OPTION_MADOGEAR) || sd->sc.data[SC_OVERHEAT] )
+ return; // already burning
+
+ skill = cap_value(pc_checkskill(sd,NC_MAINFRAME),0,4);
+ if( sd->sc.data[SC_OVERHEAT_LIMITPOINT] ) {
+ heat += sd->sc.data[SC_OVERHEAT_LIMITPOINT]->val1;
+ status_change_end(&sd->bl,SC_OVERHEAT_LIMITPOINT,-1);
+ }
+
+ heat = max(0,heat); // Avoid negative HEAT
+ if( heat >= limit[skill] )
+ sc_start(&sd->bl,SC_OVERHEAT,100,0,1000);
+ else
+ sc_start(&sd->bl,SC_OVERHEAT_LIMITPOINT,100,heat,30000);
+
+ return;
+}
int pc_split_str(char *str,char **val,int num)
{
int i;
@@ -8408,7 +8234,11 @@ int pc_readdb(void)
// スキルツリ?
memset(statp,0,sizeof(statp));
i=1;
+#if RRMODE
+ sprintf(line, "%s/statpoint_renewal.txt", db_path);
+#else
sprintf(line, "%s/statpoint.txt", db_path);
+#endif
fp=fopen(line,"r");
if(fp == NULL){
ShowWarning("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line);
@@ -8427,7 +8257,11 @@ int pc_readdb(void)
i++;
}
fclose(fp);
+ #if RRMODE
+ ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","statpoint_renewal.txt");
+ #else
ShowStatus("Done reading '"CL_WHITE"%s"CL_RESET"'.\n","statpoint.txt");
+ #endif
}
// generate the remaining parts of the db if necessary
k = battle_config.use_statpoint_table; //save setting