diff options
author | Wushin <pasekei@gmail.com> | 2015-04-13 21:13:52 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2015-04-13 21:13:52 -0500 |
commit | bf54afff27cd03ed535859009baa0b4c4fa663e9 (patch) | |
tree | 92b3e0ab2e6e668da98cc023b27858e7c5fef419 /src/map/pc.cpp | |
parent | c776b7a5d8075ede4a364bfdd0c6fb3cb6f6c5fa (diff) | |
parent | 8e8876474eddefe474528c73851b3af2c6d9327f (diff) | |
download | tmwa-bf54afff27cd03ed535859009baa0b4c4fa663e9.tar.gz tmwa-bf54afff27cd03ed535859009baa0b4c4fa663e9.tar.bz2 tmwa-bf54afff27cd03ed535859009baa0b4c4fa663e9.tar.xz tmwa-bf54afff27cd03ed535859009baa0b4c4fa663e9.zip |
Merge pull request #41 from wushin/pvp-script-persistance
Make killer & killable script builtins
Diffstat (limited to 'src/map/pc.cpp')
-rw-r--r-- | src/map/pc.cpp | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 7d04785..8b0391b 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -288,16 +288,12 @@ int pc_iskiller(dumb_ptr<map_session_data> src, { nullpo_retz(src); - if (src->bl_type != BL::PC) + if (src->bl_type != BL::PC || target->bl_type != BL::PC) return 0; - if (src->special_state.killer) + if ((src->state.pvpchannel == 1) && (target->state.pvpchannel == 1) && !src->bl_m->flag.get(MapFlag::NOPVP)) return 1; - - if (target->bl_type != BL::PC) - return 0; - if (target->special_state.killable) + if ((src->state.pvpchannel > 1) && (target->state.pvpchannel == src->state.pvpchannel)) // this one does not respect NOPVP return 1; - return 0; } @@ -320,6 +316,33 @@ int distance(int x0, int y0, int x1, int y1) } static +void pc_pvp_timer(TimerData *, tick_t, BlockId id) +{ + dumb_ptr<map_session_data> sd = map_id2sd(id); + + assert (sd != nullptr); + assert (sd->bl_type == BL::PC); +} + +int pc_setpvptimer(dumb_ptr<map_session_data> sd, interval_t val) +{ + nullpo_retz(sd); + + sd->pvp_timer = Timer(gettick() + val, + std::bind(pc_pvp_timer, ph::_1, ph::_2, + sd->bl_id)); + return 0; +} + +int pc_delpvptimer(dumb_ptr<map_session_data> sd) +{ + nullpo_retz(sd); + + sd->pvp_timer.cancel(); + return 0; +} + +static void pc_invincible_timer(TimerData *, tick_t, BlockId id) { dumb_ptr<map_session_data> sd = map_id2sd(id); @@ -378,7 +401,6 @@ int pc_setrestartvalue(dumb_ptr<map_session_data> sd, int type) clif_updatestatus(sd, SP::SP); sd->heal_xp = 0; // [Fate] Set gainable xp for healing this player to 0 - return 0; } @@ -899,6 +921,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) int bl; int aspd_rate, refinedef = 0; int str, dstr, dex; + int b_pvpchannel = 0; nullpo_retz(sd); @@ -927,6 +950,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) b_mdef = sd->mdef; b_mdef2 = sd->mdef2; b_base_atk = sd->base_atk; + if (!pc_isdead(sd) && sd->state.pvpchannel == 1) + b_pvpchannel = sd->state.pvpchannel; sd->max_weight = max_weight_base_0 + sd->status.attrs[ATTR::STR] * 300; @@ -1399,6 +1424,8 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) clif_updatestatus(sd, SP::HP); if (b_sp != sd->status.sp) clif_updatestatus(sd, SP::SP); + if (b_pvpchannel != sd->state.pvpchannel) + sd->state.pvpchannel = b_pvpchannel; return 0; } |