From 5abd5bd1f8f53b73560cecd4496bfd4bc2acc226 Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 26 Dec 2006 15:07:18 +0000 Subject: - Cleaned up some more the code so it works for -DTURBO - Cleaned the pvpoff @ and script commands. - mob_get_random_id now has two additional flags to specify that the monster to acquire should not be a boss type (4) or that it should give exp (8). - TK_MISSION will now pick any mob from the DB as long as it is not a boss type and it gives base exp. - Fixed the double-stone issue when hitting a petrified character. - Minor cleanups git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9573 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/map/atcommand.c') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a6c92a593..cd4ed4dbd 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3013,6 +3013,16 @@ int atcommand_gm( return 0; } +static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap) { + TBL_PC* sd = (TBL_PC*)bl; + clif_pvpset(sd, 0, 0, 2); + if (sd->pvp_timer != UINT_MAX) { + delete_timer(sd->pvp_timer, pc_calc_pvprank_timer); + sd->pvp_timer = UINT_MAX; + } + return 0; +} + /*========================================== * *------------------------------------------ @@ -3030,26 +3040,15 @@ int atcommand_pvpoff( return -1; } - if (map[sd->bl.m].flag.pvp) { - map[sd->bl.m].flag.pvp = 0; - clif_send0199(sd->bl.m, 0); - - pl_allsd = map_getallusers(&users); - for (i = 0; i < users; i++) { //人数分ループ - if ((pl_sd = pl_allsd[i]) && sd->bl.m == pl_sd->bl.m) { - clif_pvpset(pl_sd, 0, 0, 2); - if (pl_sd->pvp_timer != -1) { - delete_timer(pl_sd->pvp_timer, pc_calc_pvprank_timer); - pl_sd->pvp_timer = -1; - } - } - } - clif_displaymessage(fd, msg_txt(31)); // PvP: Off. - } else { + if (!map[sd->bl.m].flag.pvp) { clif_displaymessage(fd, msg_txt(160)); // PvP is already Off. return -1; } + map[sd->bl.m].flag.pvp = 0; + clif_send0199(sd->bl.m, 0); + map_foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC); + clif_displaymessage(fd, msg_txt(31)); // PvP: Off. return 0; } -- cgit v1.2.3-60-g2f50