From 2a581450a6ff87c5a183be3855e68b3f2e1b53f3 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 24 Mar 2016 15:10:40 -0400 Subject: improvements, cleanup, bug fixes --- src/map/pc.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/map/pc.cpp') diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 929143c..db3b372 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -2731,7 +2731,8 @@ int pc_attack(dumb_ptr sd, BlockId target_id, int type) if (bl->bl_type == BL::NPC) { // monster npcs [Valaris] - npc_click(sd, target_id); + if (battle_get_class(bl) != INVISIBLE_CLASS && !pc_isdead(sd)) + npc_click(sd, target_id); return 0; } @@ -3352,13 +3353,10 @@ int pc_damage(dumb_ptr src, dumb_ptr sd, if (src && src->bl_type == BL::PC) { // [Fate] PK death, trigger scripts - argrec_t arg[3] = + argrec_t arg[1] = { - {"@killerrid"_s, static_cast(unwrap(src->bl_id))}, {"@victimrid"_s, static_cast(unwrap(sd->bl_id))}, - {"@victimlvl"_s, sd->status.base_level}, }; - npc_event_doall_l(stringish("OnPCKilledEvent"_s), sd->bl_id, arg); npc_event_doall_l(stringish("OnPCKillEvent"_s), src->bl_id, arg); sd->state.pvp_rank = 0; @@ -3487,7 +3485,10 @@ int pc_readparam(dumb_ptr bl, SP type) case SP::INT: case SP::DEX: case SP::LUK: - val = battle_get_stat(type, bl); + if (bl && bl->bl_type == BL::PC) + val = bl->is_player()->status.attrs[sp_to_attr(type)]; + else + val = battle_get_stat(type, bl); break; case SP::SPEED: val = battle_get_speed(bl).count(); @@ -3531,6 +3532,12 @@ int pc_readparam(dumb_ptr bl, SP type) case SP::CHAR_ID: val = sd ? unwrap(sd->status_key.char_id) : 0; break; + case SP::ELTLVL: + val = static_cast(battle_get_element(sd).level); + break; + case SP::ELTTYPE: + val = static_cast(battle_get_element(sd).element); + break; } return val; -- cgit v1.2.3-60-g2f50