diff --git a/src/map/pc.c b/src/map/pc.c index d0036af98d..b9604fcf95 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3045,7 +3045,12 @@ void pc_bonus(struct map_session_data *sd,int type,int val) sd->bonus.weapon_matk_rate += val; break; default: - ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); + if (running_npc_stat_calc_event) { + ShowWarning("pc_bonus: unknown bonus type %d %d in OnPCStatCalcEvent!\n", type, val); + } + else { + ShowWarning("pc_bonus: unknown bonus type %d %d in item #%d\n", type, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid); + } break; } } @@ -3692,7 +3697,12 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->ignore_mdef_by_race2[type2] += val; break; default: - ShowWarning("pc_bonus2: unknown type %d %d %d!\n",type,type2,val); + if (running_npc_stat_calc_event) { + ShowWarning("pc_bonus2: unknown bonus type %d %d %d in OnPCStatCalcEvent!\n", type, type2, val); + } + else { + ShowWarning("pc_bonus2: unknown bonus type %d %d %d in item #%d\n", type, type2, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid); + } break; } } @@ -3807,7 +3817,12 @@ void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) sd->norecover_state_race[type2].tick = val; break; default: - ShowWarning("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val); + if (running_npc_stat_calc_event) { + ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in OnPCStatCalcEvent!\n", type, type2, type3, val); + } + else { + ShowWarning("pc_bonus3: unknown bonus type %d %d %d %d in item #%d\n", type, type2, type3, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid); + } break; } } @@ -3882,7 +3897,12 @@ void pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type break; default: - ShowWarning("pc_bonus4: unknown type %d %d %d %d %d!\n",type,type2,type3,type4,val); + if (running_npc_stat_calc_event) { + ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in OnPCStatCalcEvent!\n", type, type2, type3, type4, val); + } + else { + ShowWarning("pc_bonus4: unknown bonus type %d %d %d %d %d in item #%d\n", type, type2, type3, type4, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid); + } break; } } @@ -3923,7 +3943,12 @@ void pc_bonus5(struct map_session_data *sd,int type,int type2,int type3,int type break; default: - ShowWarning("pc_bonus5: unknown type %d %d %d %d %d %d!\n",type,type2,type3,type4,type5,val); + if (running_npc_stat_calc_event) { + ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in OnPCStatCalcEvent!\n", type, type2, type3, type4, type5, val); + } + else { + ShowWarning("pc_bonus5: unknown bonus type %d %d %d %d %d %d in item #%d\n", type, type2, type3, type4, type5, val, current_equip_card_id ? current_equip_card_id : sd->inventory_data[current_equip_item_index]->nameid); + } break; } } diff --git a/src/map/status.c b/src/map/status.c index 50b3cd7b04..9f57e5e9a4 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -48,6 +48,7 @@ static struct status_data dummy_status; short current_equip_item_index; /// Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus] unsigned int current_equip_combo_pos; /// For combo items we need to save the position of all involved items here int current_equip_card_id; /// To prevent card-stacking (from jA) [Skotlex] +char running_npc_stat_calc_event; /// Indicate if OnPCStatCalcEvent is running. // We need it for new cards 15 Feb 2005, to check if the combo cards are insrerted into the CURRENT weapon only to avoid cards exploits unsigned int SCDisabled[SC_MAX]; ///< List of disabled SC on map zones. [Cydh] @@ -3205,7 +3206,9 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) pc_itemgrouphealrate_clear(sd); + running_npc_stat_calc_event = 1; npc_script_event(sd, NPCE_STATCALC); + running_npc_stat_calc_event = 0; // Parse equipment for (i = 0; i < EQI_MAX; i++) { @@ -3398,6 +3401,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt) } } } + current_equip_card_id = 0; // Clear stored card ID [Secret] if( sc->count && sc->data[SC_ITEMSCRIPT] ) { struct item_data *data = itemdb_exists(sc->data[SC_ITEMSCRIPT]->val1); diff --git a/src/map/status.h b/src/map/status.h index cc718b9d6e..2c5101e6f4 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -1704,6 +1704,7 @@ enum e_joint_break extern short current_equip_item_index; extern unsigned int current_equip_combo_pos; extern int current_equip_card_id; +extern char running_npc_stat_calc_event; /// Mode definitions to clear up code reading. [Skotlex] enum e_mode {