Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 22nd, 2012  |  syntax: Diff  |  size: 5.88 KB  |  hits: 102  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Index: src/map/atcommand.c
  2. ===================================================================
  3. --- src/map/atcommand.c (revision 15938)
  4. +++ src/map/atcommand.c (working copy)
  5. @@ -8457,6 +8457,45 @@
  6.         return 0;
  7.  }
  8.  
  9. +ACMD_FUNC(lockedwalk)
  10. +{
  11. +       int x, y;
  12. +
  13. +       if (sd == NULL)
  14. +               return 0;
  15. +
  16. +       if (sscanf(message, "%d %d", &x, &y) == 2)
  17. +       {
  18. +               pc_locked_walk(sd, x, y);
  19. +       }
  20. +       else
  21. +       {
  22. +               clif_displaymessage(sd->fd, "usage: @lockedwalk x y");
  23. +       }
  24. +
  25. +       return 0;
  26. +}
  27. +
  28. +ACMD_FUNC(lockedfollow)
  29. +{
  30. +       struct block_list *tbl;
  31. +
  32. +       if (sd == NULL)
  33. +               return 0;
  34. +
  35. +       tbl = (struct block_list *)npc_name2id(message);
  36. +      
  37. +       if (tbl == NULL || tbl == (struct block_list *)sd)
  38. +               tbl = (struct block_list *)map_nick2sd(message);
  39. +
  40. +       if (tbl == NULL || tbl == (struct block_list *)sd)
  41. +               return 0;
  42. +
  43. +       pc_locked_follow(sd, tbl->id);
  44. +
  45. +       return 0;
  46. +}
  47. +
  48.  /**
  49.   * Fills the reference of available commands in atcommand DBMap
  50.   **/
  51. @@ -8467,6 +8506,8 @@
  52.          * Command reference list, place the base of your commands here
  53.          **/
  54.         AtCommandInfo atcommand_base[] = {
  55. +               ACMD_DEF(lockedwalk),
  56. +               ACMD_DEF(lockedfollow),
  57.                 ACMD_DEF2("warp", mapmove),
  58.                 ACMD_DEF(where),
  59.                 ACMD_DEF(jumpto),
  60. Index: src/map/pc.c
  61. ===================================================================
  62. --- src/map/pc.c        (revision 15938)
  63. +++ src/map/pc.c        (working copy)
  64. @@ -5260,6 +5260,9 @@
  65.         }
  66.         sd->followtarget = -1;
  67.  
  68. +       if (sd->state.locked_walk)
  69. +               sd->state.locked_walk = 0;
  70. +
  71.         return 0;
  72.  }
  73.  
  74. @@ -5277,6 +5280,22 @@
  75.         return 0;
  76.  }
  77.  
  78. +int pc_locked_follow(struct map_session_data *sd,int target_id)
  79. +{
  80. +       pc_follow(sd, target_id);
  81. +       sd->state.locked_walk = 1;
  82. +
  83. +       return 0;
  84. +}
  85. +
  86. +int pc_locked_walk(struct map_session_data *sd,int x,int y)
  87. +{
  88. +       if (unit_walktoxy(&sd->bl,x,y,4))
  89. +               sd->state.locked_walk = 1;
  90. +
  91. +       return 0;
  92. +}
  93. +
  94.  int pc_checkbaselevelup(struct map_session_data *sd)
  95.  {
  96.         unsigned int next = pc_nextbaseexp(sd);
  97. Index: src/map/pc.h
  98. ===================================================================
  99. --- src/map/pc.h        (revision 15938)
  100. +++ src/map/pc.h        (working copy)
  101. @@ -146,6 +146,9 @@
  102.                 struct guild *gmaster_flag;
  103.                 unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
  104.                 unsigned int warping : 1;//states whether you're in the middle of a warp processing
  105. +
  106. +               // Locked follow/walk [GreenBox]
  107. +               unsigned int locked_walk : 1;
  108.         } state;
  109.         struct {
  110.                 unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
  111. @@ -605,7 +608,7 @@
  112.  #define pc_issit(sd)          ( (sd)->vd.dead_sit == 2 )
  113.  #define pc_isidle(sd)         ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
  114.  #define pc_istrading(sd)      ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
  115. -#define pc_cant_act(sd)       ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag )
  116. +#define pc_cant_act(sd)       ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.locked_walk )
  117.  #define pc_setdir(sd,b,h)     ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
  118.  #define pc_setchatid(sd,n)    ( (sd)->chatID = n )
  119.  #define pc_ishiding(sd)       ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
  120. @@ -753,8 +756,11 @@
  121.  int pc_modifysellvalue(struct map_session_data*,int);
  122.  
  123.  int pc_follow(struct map_session_data*, int); // [MouseJstr]
  124. +int pc_locked_follow(struct map_session_data *sd,int target_id); // [GreenBox]
  125.  int pc_stop_following(struct map_session_data*);
  126.  
  127. +int pc_locked_walk(struct map_session_data *sd,int x,int y); // [GreenBox]
  128. +
  129.  unsigned int pc_maxbaselv(struct map_session_data *sd);
  130.  unsigned int pc_maxjoblv(struct map_session_data *sd);
  131.  int pc_checkbaselevelup(struct map_session_data *sd);
  132. Index: src/map/script.c
  133. ===================================================================
  134. --- src/map/script.c    (revision 15938)
  135. +++ src/map/script.c    (working copy)
  136. @@ -15887,6 +15887,48 @@
  137.  BUILDIN_FUNC(deletepset);
  138.  #endif
  139.  
  140. +BUILDIN_FUNC(lockedwalk)
  141. +{
  142. +       int x, y;
  143. +       struct map_session_data *sd;
  144. +
  145. +       if((sd = script_rid2sd(st)) == NULL)
  146. +               return 0;
  147. +
  148. +       if (!script_hasdata(st,2) || !script_hasdata(st,3))
  149. +       {
  150. +               ShowError("buildin_lockedwalk: Missing parameters!");
  151. +               return 0;
  152. +       }
  153. +
  154. +       x = script_hasdata(st,2);
  155. +       y = script_hasdata(st,3);
  156. +
  157. +       pc_locked_walk(sd, x, y);
  158. +
  159. +       return 0;
  160. +}
  161. +
  162. +BUILDIN_FUNC(lockedfollow)
  163. +{
  164. +       int id, targetid;
  165. +       TBL_PC *sd = NULL;
  166. +
  167. +
  168. +       id = script_getnum(st,2);
  169. +       targetid = script_getnum(st,3);
  170. +
  171. +       if(id)
  172. +               sd = map_id2sd(id);
  173. +       else
  174. +               sd = script_rid2sd(st);
  175. +
  176. +       if(sd)
  177. +               pc_locked_follow(sd, targetid);
  178. +
  179. +    return 0;
  180. +}
  181. +
  182.  /// script command definitions
  183.  /// for an explanation on args, see add_buildin_func
  184.  struct script_function buildin_func[] = {
  185. @@ -16315,5 +16357,10 @@
  186.         BUILDIN_DEF(checkquest, "i?"),
  187.         BUILDIN_DEF(changequest, "ii"),
  188.         BUILDIN_DEF(showevent, "ii"),
  189. +
  190. +       // Locked follow/walk [GreenBox]
  191. +       BUILDIN_DEF(lockedwalk,"ii"),
  192. +       BUILDIN_DEF(lockedfollow,"ii"),
  193. +
  194.         {NULL,NULL,NULL},
  195.  };
  196. Index: src/map/unit.c
  197. ===================================================================
  198. --- src/map/unit.c      (revision 15938)
  199. +++ src/map/unit.c      (working copy)
  200. @@ -185,6 +185,9 @@
  201.                 {// mercenary is too far from the master so warp the master's position
  202.                         unit_warp( &sd->md->bl, sd->bl.m, sd->bl.x, sd->bl.y, CLR_TELEPORT );
  203.                 }
  204. +
  205. +               if (sd->state.locked_walk && ud->to_x == sd->bl.x && ud->to_y == sd->bl.y)
  206. +                       sd->state.locked_walk = 0;
  207.         } else if (md) {
  208.                 if( map_getcell(bl->m,x,y,CELL_CHKNPC) ) {
  209.                         if( npc_touch_areanpc2(md) ) return 0; // Warped