From 1886d63ef5986a3e613b4880dc7ae00636435e0a Mon Sep 17 00:00:00 2001 From: gumi Date: Fri, 12 Apr 2019 12:12:38 -0400 Subject: add gm automod tool --- src/map/pc.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/map/pc.cpp') diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 3986113..b9b41d9 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -833,6 +833,8 @@ int pc_authok(AccountId id, int login_id2, ClientVersion client_version, sd->mute.whisper = 0; sd->mute.guild = 0; + sd->automod = AutoMod::off; + for (tick_t& t : sd->flood_rates) t = tick_t(); sd->packet_flood_reset_due = tick_t(); @@ -2414,6 +2416,27 @@ void pc_walk(TimerData *, tick_t tick, BlockId id, unsigned char data) return; } + // Prsm-sitting countermeasures + dumb_ptr d_bl = sd->bl_m->blocks.ref((x + dx) / BLOCK_SIZE, (y + dy) / BLOCK_SIZE).normal; + for (; d_bl; d_bl = d_bl->bl_next) + { + if (d_bl->bl_type == BL::PC && d_bl->bl_x == (x + dx) && d_bl->bl_y == (y + dy)) + { + dumb_ptr d_sd = d_bl->is_player(); + + if (pc_issit(d_sd)) + { + switch (d_sd->automod) + { + case AutoMod::autoblock: + clif_update_collision(sd, x + dx, y + dy, x + dx, y + dy, sd->bl_m->name_, 5); // BlockType::PLAYERWALL + pc_stop_walking(sd, 1); + return; + } + } + } + } + moveblock = (x / BLOCK_SIZE != (x + dx) / BLOCK_SIZE || y / BLOCK_SIZE != (y + dy) / BLOCK_SIZE); @@ -3571,6 +3594,9 @@ int pc_readparam(dumb_ptr bl, SP type) case SP::MUTE_GUILD: val = sd ? sd->mute.guild : 0; break; + case SP::AUTOMOD: + val = sd ? (int)sd->automod : 0; + break; } return val; @@ -3816,6 +3842,10 @@ int pc_setparam(dumb_ptr bl, SP type, int val) nullpo_retz(sd); sd->mute.guild = (val == 1); break; + case SP::AUTOMOD: + nullpo_retz(sd); + sd->automod = (AutoMod)val; + break; } return 0; @@ -5205,6 +5235,9 @@ void pc_setstand(dumb_ptr sd) nullpo_retv(sd); sd->state.dead_sit = 0; + + if (sd->automod == AutoMod::autoblock) + clif_gm_collision(sd, 0); } static -- cgit v1.2.3-60-g2f50