Advertisement
Guest User

Untitled

a guest
Jan 31st, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.19 KB | None | 0 0
  1. Index: conf/battle/battle.conf
  2. ===================================================================
  3. --- conf/battle/battle.conf (revision 17156)
  4. +++ conf/battle/battle.conf (working copy)
  5. @@ -141,3 +141,10 @@
  6.  // range. For example, Sonic Blow requires a 2 cell distance before autocasting is allowed.
  7.  // This setting also affects autospellwhenhit.
  8.  autospell_check_range: no
  9. +
  10. +// [Cydh]
  11. +// If you want to player can't warp, go, recalled, relog on battle for a while
  12. +// You can use this to give them delay
  13. +// Battle means while player attacking, using skills, receiving damage
  14. +// Delay in milisecond
  15. +prevent_warponbattle: 5000
  16. Index: conf/msg_conf/map_msg.conf
  17. ===================================================================
  18. --- conf/msg_conf/map_msg.conf  (revision 17156)
  19. +++ conf/msg_conf/map_msg.conf  (working copy)
  20. @@ -1409,5 +1409,8 @@
  21.  // @skillid (extension)
  22.  1398: -- Displaying first %d partial matches:
  23.  
  24. +// warpgo delay
  25. +1399: You must wait %.1f sec. before %s.
  26. +
  27.  //Custom translations
  28.  import: conf/import/msg_conf.txt
  29. Index: src/map/atcommand.c
  30. ===================================================================
  31. --- src/map/atcommand.c (revision 17156)
  32. +++ src/map/atcommand.c (working copy)
  33. @@ -379,6 +379,7 @@
  34.     unsigned short mapindex;
  35.     short x = 0, y = 0;
  36.     int16 m = -1;
  37. +   int diff_tick, tick = gettick();    //warp on battle
  38.  
  39.     nullpo_retr(-1, sd);
  40.  
  41. @@ -392,6 +393,14 @@
  42.             return -1;
  43.     }
  44.  
  45. +   //warp on battle
  46. +   if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
  47. +   {
  48. +       sprintf(atcmd_output, msg_txt(1555), diff_tick/1000., command);
  49. +       clif_displaymessage(fd, atcmd_output);
  50. +       return -1;
  51. +   }
  52. +
  53.     mapindex = mapindex_name2id(map_name);
  54.     if (mapindex)
  55.         m = map_mapindex2mapid(mapindex);
  56. @@ -1676,6 +1685,7 @@
  57.     int town;
  58.     char map_name[MAP_NAME_LENGTH];
  59.     int16 m;
  60. +   int diff_tick, tick = gettick();    //warp on battle
  61.  
  62.     const struct {
  63.         char map[MAP_NAME_LENGTH];
  64. @@ -1730,6 +1740,14 @@
  65.         return 0;
  66.     }
  67.  
  68. +   //warp on battle
  69. +   if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
  70. +   {
  71. +       sprintf(atcmd_output, msg_txt(1555), diff_tick/1000., command);
  72. +       clif_displaymessage(fd, atcmd_output);
  73. +       return -1;
  74. +   }
  75. +
  76.     memset(map_name, '\0', sizeof(map_name));
  77.     memset(atcmd_output, '\0', sizeof(atcmd_output));
  78.  
  79. @@ -2669,6 +2687,7 @@
  80.   *
  81.   *------------------------------------------*/
  82.  ACMD_FUNC(recall) {
  83. +   int diff_tick, tick = gettick();    //warp on battle
  84.     struct map_session_data *pl_sd = NULL;
  85.  
  86.     nullpo_retr(-1, sd);
  87. @@ -2684,6 +2703,14 @@
  88.         return -1;
  89.     }
  90.  
  91. +   //warp on battle
  92. +   if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(pl_sd, PC_PERM_WARP_ANYWHERE))
  93. +   {
  94. +       sprintf(atcmd_output, msg_txt(1555), diff_tick/1000., "recall this player");
  95. +       clif_displaymessage(fd, atcmd_output);
  96. +       return -1;
  97. +   }
  98. +
  99.     if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
  100.     {
  101.         clif_displaymessage(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player.
  102. Index: src/map/battle.c
  103. ===================================================================
  104. --- src/map/battle.c    (revision 17156)
  105. +++ src/map/battle.c    (working copy)
  106. @@ -5898,6 +5898,7 @@
  107.     { "skill_trap_type",                    &battle_config.skill_trap_type,                 0,      0,      1,              },
  108.     { "item_restricted_consumption_type",   &battle_config.item_restricted_consumption_type,1,      0,      1,              },
  109.     { "max_walk_path",                      &battle_config.max_walk_path,                   17,     1,      MAX_WALKPATH,   },
  110. +   { "prevent_warponbattle",               &battle_config.prevent_warponbattle,           10000,    0,      INT_MAX,       }//warp on battle
  111.  };
  112.  #ifndef STATS_OPT_OUT
  113.  /**
  114. Index: src/map/battle.h
  115. ===================================================================
  116. --- src/map/battle.h    (revision 17156)
  117. +++ src/map/battle.h    (working copy)
  118. @@ -486,6 +486,8 @@
  119.     int skill_trap_type;
  120.     int item_restricted_consumption_type;
  121.     int max_walk_path;
  122. +
  123. +   int prevent_warponbattle;   //warp on battle
  124.     } battle_config;
  125.  
  126.  void do_init_battle(void);
  127. Index: src/map/pc.c
  128. ===================================================================
  129. --- src/map/pc.c    (revision 17156)
  130. +++ src/map/pc.c    (working copy)
  131. @@ -982,6 +982,7 @@
  132.     sd->cantalk_tick = tick;
  133.     sd->canskill_tick = tick;
  134.     sd->cansendmail_tick = tick;
  135. +   sd->canwarp_tick =  tick;   //warp on battle
  136.  
  137.     for(i = 0; i < MAX_SKILL_LEVEL; i++)
  138.         sd->spirit_timer[i] = INVALID_TIMER;
  139. @@ -6505,6 +6506,7 @@
  140.         elemental_set_target(sd,src);
  141.  
  142.     sd->canlog_tick = gettick();
  143. +   sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;  //warp on battle
  144.  }
  145.  
  146.  /*==========================================
  147. @@ -6842,6 +6844,11 @@
  148.     //Reset "can log out" tick.
  149.     if( battle_config.prevent_logout )
  150.         sd->canlog_tick = gettick() - battle_config.prevent_logout;
  151. +
  152. +   //warp on battle
  153. +   if( battle_config.prevent_warponbattle )
  154. +       sd->canwarp_tick = gettick() - battle_config.prevent_warponbattle;
  155. +
  156.     return 1;
  157.  }
  158.  
  159. Index: src/map/pc.h
  160. ===================================================================
  161. --- src/map/pc.h    (revision 17156)
  162. +++ src/map/pc.h    (working copy)
  163. @@ -216,6 +216,7 @@
  164.     unsigned int cansendmail_tick; // [Mail System Flood Protection]
  165.     unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
  166.      unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection]
  167. +   unsigned int canwarp_tick;  //delay for player when warp after attacking, receving damage, or using skill.  //warp on battle
  168.  
  169.     struct {
  170.         short nameid;
  171. Index: src/map/skill.c
  172. ===================================================================
  173. --- src/map/skill.c (revision 17156)
  174. +++ src/map/skill.c (working copy)
  175. @@ -7276,6 +7276,8 @@
  176.             int dx[9]={-1, 1, 0, 0,-1, 1,-1, 1, 0};
  177.             int dy[9]={ 0, 0, 1,-1, 1,-1,-1, 1, 0};
  178.             int j = 0;
  179. +           int diff_tick, tick = gettick();    //warp on battle
  180. +           char output[CHAT_SIZE_MAX]; //warp on battle
  181.             struct guild *g;
  182.             // i don't know if it actually summons in a circle, but oh well. ;P
  183.             g = sd?sd->state.gmaster_flag:guild_search(status_get_guild_id(src));
  184. @@ -7287,6 +7289,13 @@
  185.                 if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) {
  186.                     if (map[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m))
  187.                         continue;
  188. +                   //warp on battle
  189. +                   if((diff_tick = DIFF_TICK(sd->canwarp_tick,tick)) > 0 && !pc_has_permission(dstsd, PC_PERM_WARP_ANYWHERE))
  190. +                   {
  191. +                       sprintf(output, msg_txt(1555), diff_tick/1000., "get called by EMERGENCY CALL");
  192. +                       clif_displaymessage(dstsd->fd, output);
  193. +                       continue;
  194. +                   }
  195.                     if(map_getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
  196.                         dx[j] = dy[j] = 0;
  197.                     pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
  198. Index: src/map/unit.c
  199. ===================================================================
  200. --- src/map/unit.c  (revision 17156)
  201. +++ src/map/unit.c  (working copy)
  202. @@ -1368,6 +1368,9 @@
  203.     else
  204.         skill_castend_id(ud->skilltimer,tick,src->id,0);
  205.  
  206. +   if(sd)  //warp on battle
  207. +       sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
  208. +
  209.     return 1;
  210.  }
  211.  
  212. @@ -1505,6 +1508,10 @@
  213.         ud->skilltimer = INVALID_TIMER;
  214.         skill_castend_pos(ud->skilltimer,tick,src->id,0);
  215.     }
  216. +
  217. +   if(sd)  //warp on battle
  218. +       sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
  219. +
  220.     return 1;
  221.  }
  222.  
  223. @@ -1586,6 +1593,9 @@
  224.             unit_stop_attack(src);
  225.             return 0;
  226.         }
  227. +       //warp on battle
  228. +       if(battle_config.prevent_warponbattle)
  229. +           sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
  230.     }
  231.     if( battle_check_target(src,target,BCT_ENEMY) <= 0 || !status_check_skilluse(src, target, 0, 0) ) {
  232.         unit_unattackable(src);
  233. @@ -1879,7 +1889,14 @@
  234.     struct block_list *bl;
  235.     bl = map_id2bl(id);
  236.     if(bl && unit_attack_timer_sub(bl, tid, tick) == 0)
  237. +   {
  238. +       //warp on battle
  239. +       TBL_PC* sd = (TBL_PC*)bl;
  240. +       if(sd && battle_config.prevent_warponbattle)
  241. +           sd->canwarp_tick = gettick() + battle_config.prevent_warponbattle;
  242. +
  243.         unit_unattackable(bl);
  244. +   }
  245.     return 0;
  246.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement