Index: conf/battle/battle.conf
===================================================================
--- conf/battle/battle.conf (revision 17156)
+++ conf/battle/battle.conf (working copy)
@@ -141,3 +141,10 @@
// range. For example, Sonic Blow requires a 2 cell distance before autocasting is allowed.
// This setting also affects autospellwhenhit.
autospell_check_range: no
+
+// [Cydh]
+// If you want to player can't warp, go, recalled, relog on battle for a while
+// You can use this to give them delay
+// Battle means while player attacking, using skills, receiving damage
+// Delay in milisecond
+prevent_warponbattle: 5000
Index: conf/msg_conf/map_msg.conf
===================================================================
--- conf/msg_conf/map_msg.conf (revision 17156)
+++ conf/msg_conf/map_msg.conf (working copy)
@@ -1409,5 +1409,8 @@
// @skillid (extension)
1398: -- Displaying first %d partial matches:
+// warpgo delay
+1399: You must wait %.1f sec. before %s.
+
//Custom translations
import: conf/import/msg_conf.txt
Index: src/map/atcommand.c
===================================================================
--- src/map/atcommand.c (revision 17156)
+++ src/map/atcommand.c (working copy)
@@ -379,6 +379,7 @@
unsigned short mapindex;
short x = 0, y = 0;
int16 m = -1;
+ int diff_tick, tick = gettick(); //warp on battle
nullpo_retr(-1, sd);
@@ -392,6 +393,14 @@
return -1;
}
+ //warp on battle
+ if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
+ {
+ sprintf(atcmd_output, msg_txt(1555), diff_tick/1000., command);
+ clif_displaymessage(fd, atcmd_output);
+ return -1;
+ }
+
mapindex = mapindex_name2id(map_name);
if (mapindex)
m = map_mapindex2mapid(mapindex);
@@ -1676,6 +1685,7 @@
int town;
char map_name[MAP_NAME_LENGTH];
int16 m;
+ int diff_tick, tick = gettick(); //warp on battle
const struct {
char map[MAP_NAME_LENGTH];
@@ -1730,6 +1740,14 @@
return 0;
}
+ //warp on battle
+ if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
+ {
+ sprintf(atcmd_output, msg_txt(1555), diff_tick/1000., command);
+ clif_displaymessage(fd, atcmd_output);
+ return -1;
+ }
+
memset(map_name, '\0', sizeof(map_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -2669,6 +2687,7 @@
*
*------------------------------------------*/
ACMD_FUNC(recall) {
+ int diff_tick, tick = gettick(); //warp on battle
struct map_session_data *pl_sd = NULL;
nullpo_retr(-1, sd);
@@ -2684,6 +2703,14 @@
return -1;
}
+ //warp on battle
+ if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(pl_sd, PC_PERM_WARP_ANYWHERE))
+ {
+ sprintf(atcmd_output, msg_txt(1555), diff_tick/1000., "recall this player");
+ clif_displaymessage(fd, atcmd_output);
+ return -1;
+ }
+
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
clif_displaymessage(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player.
Index: src/map/battle.c
===================================================================
--- src/map/battle.c (revision 17156)
+++ src/map/battle.c (working copy)
@@ -5898,6 +5898,7 @@
{ "skill_trap_type", &battle_config.skill_trap_type, 0, 0, 1, },
{ "item_restricted_consumption_type", &battle_config.item_restricted_consumption_type,1, 0, 1, },
{ "max_walk_path", &battle_config.max_walk_path, 17, 1, MAX_WALKPATH, },
+ { "prevent_warponbattle", &battle_config.prevent_warponbattle, 10000, 0, INT_MAX, }, //warp on battle
};
#ifndef STATS_OPT_OUT
/**
Index: src/map/battle.h
===================================================================
--- src/map/battle.h (revision 17156)
+++ src/map/battle.h (working copy)
@@ -486,6 +486,8 @@
int skill_trap_type;
int item_restricted_consumption_type;
int max_walk_path;
+
+ int prevent_warponbattle; //warp on battle
} battle_config;
void do_init_battle(void);
Index: src/map/pc.c
===================================================================
--- src/map/pc.c (revision 17156)
+++ src/map/pc.c (working copy)
@@ -982,6 +982,7 @@
sd->cantalk_tick = tick;
sd->canskill_tick = tick;
sd->cansendmail_tick = tick;
+ sd->canwarp_tick = tick; //warp on battle
for(i = 0; i < MAX_SKILL_LEVEL; i++)
sd->spirit_timer[i] = INVALID_TIMER;
@@ -6505,6 +6506,7 @@
elemental_set_target(sd,src);
sd->canlog_tick = gettick();
+ sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle; //warp on battle
}
/*==========================================
@@ -6842,6 +6844,11 @@
//Reset "can log out" tick.
if( battle_config.prevent_logout )
sd->canlog_tick = gettick() - battle_config.prevent_logout;
+
+ //warp on battle
+ if( battle_config.prevent_warponbattle )
+ sd->canwarp_tick = gettick() - battle_config.prevent_warponbattle;
+
return 1;
}
Index: src/map/pc.h
===================================================================
--- src/map/pc.h (revision 17156)
+++ src/map/pc.h (working copy)
@@ -216,6 +216,7 @@
unsigned int cansendmail_tick; // [Mail System Flood Protection]
unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection]
+ unsigned int canwarp_tick; //delay for player when warp after attacking, receving damage, or using skill. //warp on battle
struct {
short nameid;
Index: src/map/skill.c
===================================================================
--- src/map/skill.c (revision 17156)
+++ src/map/skill.c (working copy)
@@ -7276,6 +7276,8 @@
int dx[9]={-1, 1, 0, 0,-1, 1,-1, 1, 0};
int dy[9]={ 0, 0, 1,-1, 1,-1,-1, 1, 0};
int j = 0;
+ int diff_tick, tick = gettick(); //warp on battle
+ char output[CHAT_SIZE_MAX]; //warp on battle
struct guild *g;
// i don't know if it actually summons in a circle, but oh well. ;P
g = sd?sd->state.gmaster_flag:guild_search(status_get_guild_id(src));
@@ -7287,6 +7289,13 @@
if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) {
if (map[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m))
continue;
+ //warp on battle
+ if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(dstsd, PC_PERM_WARP_ANYWHERE))
+ {
+ sprintf(output, msg_txt(1555), diff_tick/1000., "get called by EMERGENCY CALL");
+ clif_displaymessage(dstsd->fd, output);
+ continue;
+ }
if(map_getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
Index: src/map/unit.c
===================================================================
--- src/map/unit.c (revision 17156)
+++ src/map/unit.c (working copy)
@@ -1368,6 +1368,9 @@
else
skill_castend_id(ud->skilltimer,tick,src->id,0);
+ if(sd) //warp on battle
+ sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
+
return 1;
}
@@ -1505,6 +1508,10 @@
ud->skilltimer = INVALID_TIMER;
skill_castend_pos(ud->skilltimer,tick,src->id,0);
}
+
+ if(sd) //warp on battle
+ sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
+
return 1;
}
@@ -1586,6 +1593,9 @@
unit_stop_attack(src);
return 0;
}
+ //warp on battle
+ if(battle_config.prevent_warponbattle)
+ sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
}
if( battle_check_target(src,target,BCT_ENEMY) <= 0 || !status_check_skilluse(src, target, 0, 0) ) {
unit_unattackable(src);
@@ -1879,7 +1889,14 @@
struct block_list *bl;
bl = map_id2bl(id);
if(bl && unit_attack_timer_sub(bl, tid, tick) == 0)
+ {
+ //warp on battle
+ TBL_PC* sd = (TBL_PC*)bl;
+ if(sd && battle_config.prevent_warponbattle)
+ sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
+
unit_unattackable(bl);
+ }
return 0;
}