Advertisement
Guest User

r15115,r15116,r15118

a guest
Jul 24th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 21.75 KB | None | 0 0
  1. Index: src/map/clif.c
  2. ===================================================================
  3. --- src/map/clif.c  (revisão 16496)
  4. +++ src/map/clif.c  (cópia de trabalho)
  5. @@ -5821,20 +5821,21 @@
  6.  
  7.  /// Notifies the client about the result of a item repair request (ZC_ACK_ITEMREPAIR).
  8.  /// 01fe <index>.W <result>.B
  9. -void clif_item_repaireffect(struct map_session_data *sd,int nameid,int flag)
  10. +/// index:
  11. +///     ignored (inventory index)
  12. +/// result:
  13. +///     0 = Item repair success.
  14. +///     1 = Item repair failure.
  15. +void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag)
  16.  {
  17. -   int view,fd;
  18. +   int fd;
  19.  
  20.     nullpo_retv(sd);
  21.     fd=sd->fd;
  22.  
  23.     WFIFOHEAD(fd,packet_len(0x1fe));
  24.     WFIFOW(fd, 0)=0x1fe;
  25. -   // FIXME: this is inventory index
  26. -   if((view = itemdb_viewid(nameid)) > 0)
  27. -       WFIFOW(fd, 2)=view;
  28. -   else
  29. -       WFIFOW(fd, 2)=nameid;
  30. +   WFIFOW(fd, 2)=idx+2;
  31.     WFIFOB(fd, 4)=flag;
  32.     WFIFOSET(fd,packet_len(0x1fe));
  33.  }
  34. @@ -9364,6 +9365,19 @@
  35.  }
  36.  
  37.  
  38. +/// Server's tick (ZC_NOTIFY_TIME).
  39. +/// 007f <time>.L
  40. +void clif_notify_time(struct map_session_data* sd, unsigned long time)
  41. +{
  42. +   int fd = sd->fd;
  43. +
  44. +   WFIFOHEAD(fd,packet_len(0x7f));
  45. +   WFIFOW(fd,0) = 0x7f;
  46. +   WFIFOL(fd,2) = time;
  47. +   WFIFOSET(fd,packet_len(0x7f));
  48. +}
  49. +
  50. +
  51.  /// Request for server's tick.
  52.  /// 007e <client tick>.L (CZ_REQUEST_TIME)
  53.  /// 0360 <client tick>.L (CZ_REQUEST_TIME2)
  54. @@ -9372,12 +9386,7 @@
  55.  {
  56.     sd->client_tick = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
  57.  
  58. -   WFIFOHEAD(fd, packet_len(0x7f));
  59. -   WFIFOW(fd,0)=0x7f;
  60. -   WFIFOL(fd,2)=gettick();
  61. -   WFIFOSET(fd,packet_len(0x7f));
  62. -   // removed until the socket problems are fixed. [FlavioJS]
  63. -   //flush_fifo(fd); // try to send immediatly so the client gets more accurate "pings"
  64. +   clif_notify_time(sd, gettick());
  65.  }
  66.  
  67.  
  68. @@ -9499,25 +9508,38 @@
  69.  }
  70.  
  71.  
  72. +/// Notification about the result of a disconnect request (ZC_ACK_REQ_DISCONNECT).
  73. +/// 018b <result>.W
  74. +/// result:
  75. +///     0 = disconnect (quit)
  76. +///     1 = cannot disconnect (wait 10 seconds)
  77. +///     ? = ignored
  78. +void clif_disconnect_ack(struct map_session_data* sd, short result)
  79. +{
  80. +   int fd = sd->fd;
  81. +
  82. +   WFIFOHEAD(fd,packet_len(0x18b));
  83. +   WFIFOW(fd,0) = 0x18b;
  84. +   WFIFOW(fd,2) = result;
  85. +   WFIFOSET(fd,packet_len(0x18b));
  86. +}
  87. +
  88. +
  89.  /// Request to disconnect from server (CZ_REQ_DISCONNECT).
  90.  /// 018a <type>.W
  91.  /// type:
  92.  ///     0 = quit
  93.  void clif_parse_QuitGame(int fd, struct map_session_data *sd)
  94.  {
  95. -   WFIFOHEAD(fd,packet_len(0x18b));
  96. -   WFIFOW(fd,0) = 0x18b;
  97. -
  98.     /*  Rovert's prevent logout option fixed [Valaris]  */
  99.     if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] &&
  100.         (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
  101.     {
  102.         set_eof(fd);
  103. -       WFIFOW(fd,2)=0;
  104. +       clif_disconnect_ack(sd, 0);
  105.     } else {
  106. -       WFIFOW(fd,2)=1;
  107. +       clif_disconnect_ack(sd, 1);
  108.     }
  109. -   WFIFOSET(fd,packet_len(0x18b));
  110.  }
  111.  
  112.  
  113. @@ -9727,15 +9749,25 @@
  114.  }
  115.  
  116.  
  117. +/// Amount of currently online players, reply to /w /who (ZC_USER_COUNT).
  118. +/// 00c2 <count>.L
  119. +void clif_user_count(struct map_session_data* sd, int count)
  120. +{
  121. +   int fd = sd->fd;
  122. +
  123. +   WFIFOHEAD(fd,packet_len(0xc2));
  124. +   WFIFOW(fd,0) = 0xc2;
  125. +   WFIFOL(fd,2) = count;
  126. +   WFIFOSET(fd,packet_len(0xc2));
  127. +}
  128. +
  129. +
  130.  /// /w /who (CZ_REQ_USER_COUNT).
  131.  /// Request to display amount of currently connected players.
  132.  /// 00c1
  133.  void clif_parse_HowManyConnections(int fd, struct map_session_data *sd)
  134.  {
  135. -   WFIFOHEAD(fd,packet_len(0xc2));
  136. -   WFIFOW(fd,0) = 0xc2;
  137. -   WFIFOL(fd,2) = map_getusers();
  138. -   WFIFOSET(fd,packet_len(0xc2));
  139. +   clif_user_count(sd, map_getusers());
  140.  }
  141.  
  142.  
  143. @@ -9864,11 +9896,7 @@
  144.         {   //Send to char-server for character selection.
  145.             chrif_charselectreq(sd, session[fd]->client_addr);
  146.         } else {
  147. -           WFIFOHEAD(fd,packet_len(0x18b));
  148. -           WFIFOW(fd,0)=0x18b;
  149. -           WFIFOW(fd,2)=1;
  150. -
  151. -           WFIFOSET(fd,packet_len(0x018b));
  152. +           clif_disconnect_ack(sd, 1);
  153.         }
  154.         break;
  155.     }
  156. @@ -10244,14 +10272,26 @@
  157.  }
  158.  
  159.  
  160. +/// Notification about the result of a purchase attempt from an NPC shop (ZC_PC_PURCHASE_RESULT).
  161. +/// 00ca <result>.B
  162. +/// result:
  163. +///     0 = "The deal has successfully completed."
  164. +///     1 = "You do not have enough zeny."
  165. +///     2 = "You are over your Weight Limit."
  166. +///     3 = "Out of the maximum capacity, you have too many items."
  167. +void clif_npc_buy_result(struct map_session_data* sd, unsigned char result)
  168. +{
  169. +   int fd = sd->fd;
  170. +
  171. +   WFIFOHEAD(fd,packet_len(0xca));
  172. +   WFIFOW(fd,0) = 0xca;
  173. +   WFIFOB(fd,2) = result;
  174. +   WFIFOSET(fd,packet_len(0xca));
  175. +}
  176. +
  177. +
  178.  /// Request to buy chosen items from npc shop (CZ_PC_PURCHASE_ITEMLIST).
  179.  /// 00c8 <packet len>.W { <amount>.W <name id>.W }*
  180. -///
  181. -/// R 00ca <result>.b
  182. -/// result = 00 -> "The deal has successfully completed."
  183. -/// result = 01 -> "You do not have enough zeny."
  184. -/// result = 02 -> "You are over your Weight Limit."
  185. -/// result = 03 -> "Out of the maximum capacity, you have too many items."
  186.  void clif_parse_NpcBuyListSend(int fd, struct map_session_data* sd)
  187.  {
  188.     int n = (RFIFOW(fd,2)-4) /4;
  189. @@ -10265,19 +10305,28 @@
  190.  
  191.     sd->npc_shopid = 0; //Clear shop data.
  192.  
  193. -   WFIFOHEAD(fd,packet_len(0xca));
  194. -   WFIFOW(fd,0) = 0xca;
  195. +   clif_npc_buy_result(sd, result);
  196. +}
  197. +
  198. +
  199. +/// Notification about the result of a sell attempt to an NPC shop (ZC_PC_SELL_RESULT).
  200. +/// 00cb <result>.B
  201. +/// result:
  202. +///     0 = "The deal has successfully completed."
  203. +///     1 = "The deal has failed."
  204. +void clif_npc_sell_result(struct map_session_data* sd, unsigned char result)
  205. +{
  206. +   int fd = sd->fd;
  207. +
  208. +   WFIFOHEAD(fd,packet_len(0xcb));
  209. +   WFIFOW(fd,0) = 0xcb;
  210.     WFIFOB(fd,2) = result;
  211. -   WFIFOSET(fd,packet_len(0xca));
  212. +   WFIFOSET(fd,packet_len(0xcb));
  213.  }
  214.  
  215.  
  216.  /// Request to sell chosen items to npc shop (CZ_PC_SELL_ITEMLIST).
  217.  /// 00c9 <packet len>.W { <index>.W <amount>.W }*
  218. -///
  219. -/// S 00cb <result>.B
  220. -/// result = 00 -> "The deal has successfully completed."
  221. -/// result = 01 -> "The deal has failed."
  222.  void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd)
  223.  {
  224.     int fail=0,n;
  225. @@ -10293,10 +10342,7 @@
  226.    
  227.     sd->npc_shopid = 0; //Clear shop data.
  228.  
  229. -   WFIFOHEAD(fd,packet_len(0xcb));
  230. -   WFIFOW(fd,0)=0xcb;
  231. -   WFIFOB(fd,2)=fail;
  232. -   WFIFOSET(fd,packet_len(0xcb));
  233. +   clif_npc_sell_result(sd, fail);
  234.  }
  235.  
  236.  
  237. @@ -12507,25 +12553,31 @@
  238.  }
  239.  
  240.  
  241. -/// GM requesting account name (for right-click gm menu) (CZ_REQ_ACCOUNTNAME).
  242. -/// 01df <account id>.L
  243.  /// Result of request to resolve account name (ZC_ACK_ACCOUNTNAME).
  244.  /// 01e0 <account id>.L <account name>.24B
  245. -void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd)
  246. +void clif_account_name(struct map_session_data* sd, int account_id, const char* accname)
  247.  {
  248. -   int tid;
  249. -   tid = RFIFOL(fd,2);
  250. +   int fd = sd->fd;
  251.  
  252. -   //TODO: find out if this works for any player or only for authorized GMs
  253. -
  254.     WFIFOHEAD(fd,packet_len(0x1e0));
  255.     WFIFOW(fd,0) = 0x1e0;
  256. -   WFIFOL(fd,2) = tid;
  257. -   safestrncpy((char*)WFIFOP(fd,6), "", 24); // insert account name here >_<
  258. -   WFIFOSET(fd, packet_len(0x1e0));
  259. +   WFIFOL(fd,2) = account_id;
  260. +   safestrncpy((char*)WFIFOP(fd,6), accname, NAME_LENGTH);
  261. +   WFIFOSET(fd,packet_len(0x1e0));
  262.  }
  263.  
  264.  
  265. +/// GM requesting account name (for right-click gm menu) (CZ_REQ_ACCOUNTNAME).
  266. +/// 01df <account id>.L
  267. +void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd)
  268. +{
  269. +   int account_id = RFIFOL(fd,2);
  270. +
  271. +   //TODO: find out if this works for any player or only for authorized GMs
  272. +   clif_account_name(sd, account_id, ""); // insert account name here >_<
  273. +}
  274. +
  275. +
  276.  /// /changemaptype <x> <y> <type> (CZ_CHANGE_MAPTYPE).
  277.  /// GM single cell type change request.
  278.  /// 0198 <x>.W <y>.W <type>.W
  279. @@ -12564,17 +12616,11 @@
  280.     nick = (char*)RFIFOP(fd,2); // speed up
  281.     nick[NAME_LENGTH-1] = '\0'; // to be sure that the player name has at most 23 characters
  282.     type = RFIFOB(fd,26);
  283. -
  284. -   // FIXME: Use clif_wisexin.
  285. -   WFIFOHEAD(fd,packet_len(0xd1));
  286. -   WFIFOW(fd,0) = 0x0d1;
  287. -   WFIFOB(fd,2) = type;
  288.    
  289.     if( type == 0 )
  290.     {   // Add name to ignore list (block)
  291.         if (strcmp(wisp_server_name, nick) == 0) {
  292. -           WFIFOB(fd,3) = 1; // fail
  293. -           WFIFOSET(fd, packet_len(0x0d1));
  294. +           clif_wisexin(sd, type, 1); // fail
  295.             return;
  296.         }
  297.  
  298. @@ -12582,22 +12628,18 @@
  299.         ARR_FIND( 0, MAX_IGNORE_LIST, i, sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0 );
  300.         if( i == MAX_IGNORE_LIST )
  301.         {// no space for new entry
  302. -           WFIFOB(fd,3) = 2; // fail
  303. -           WFIFOSET(fd, packet_len(0x0d1));
  304. +           clif_wisexin(sd, type, 2); // too many blocks
  305.             return;
  306.         }
  307.         if( sd->ignore[i].name[0] != '\0' )
  308.         {// name already exists
  309. -           WFIFOB(fd,3) = 0; // Aegis reports success.
  310. -           WFIFOSET(fd, packet_len(0x0d1));
  311. +           clif_wisexin(sd, type, 0); // Aegis reports success.
  312.             return;
  313.         }
  314.  
  315.         //Insert in position i
  316.         safestrncpy(sd->ignore[i].name, nick, NAME_LENGTH);
  317.  
  318. -       WFIFOB(fd,3) = 0; // success
  319. -       WFIFOSET(fd, packet_len(0x0d1));
  320.     }
  321.     else
  322.     {   // Remove name from ignore list (unblock)
  323. @@ -12606,18 +12648,16 @@
  324.         ARR_FIND( 0, MAX_IGNORE_LIST, i, sd->ignore[i].name[0] == '\0' || strcmp(sd->ignore[i].name, nick) == 0 );
  325.         if( i == MAX_IGNORE_LIST || sd->ignore[i].name[i] == '\0' )
  326.         { //Not found
  327. -           WFIFOB(fd,3) = 1; // fail
  328. -           WFIFOSET(fd, packet_len(0x0d1));
  329. +           clif_wisexin(sd, type, 1); // fail
  330.             return;
  331.         }
  332.         // move everything one place down to overwrite removed entry
  333.         memmove(sd->ignore[i].name, sd->ignore[i+1].name, (MAX_IGNORE_LIST-i-1)*sizeof(sd->ignore[0].name));
  334.         // wipe last entry
  335.         memset(sd->ignore[MAX_IGNORE_LIST-1].name, 0, sizeof(sd->ignore[0].name));
  336. +   }
  337.  
  338. -       WFIFOB(fd,3) = 0; // success
  339. -       WFIFOSET(fd, packet_len(0x0d1));
  340. -   }
  341. +   clif_wisexin(sd, type, 0); // success
  342.  }
  343.  
  344.  
  345. @@ -12629,57 +12669,64 @@
  346.  ///     1 = (/inall) allow all speech
  347.  void clif_parse_PMIgnoreAll(int fd, struct map_session_data *sd)
  348.  {
  349. -   // FIXME: Use clif_wisall.
  350. -   WFIFOHEAD(fd,packet_len(0xd2));
  351. -   WFIFOW(fd,0) = 0x0d2;
  352. -   WFIFOB(fd,2) = RFIFOB(fd,2);
  353. +   int type = RFIFOB(fd,2), flag;
  354.  
  355. -   if( RFIFOB(fd,2) == 0 )
  356. +   if( type == 0 )
  357.     {// Deny all
  358.         if( sd->state.ignoreAll ) {
  359. -           WFIFOB(fd,3) = 1; // fail
  360. +           flag = 1; // fail
  361.         } else {
  362.             sd->state.ignoreAll = 1;
  363. -           WFIFOB(fd,3) = 0; // success
  364. +           flag = 0; // success
  365.         }
  366.     }
  367.     else
  368.     {//Unblock everyone
  369.         if( sd->state.ignoreAll ) {
  370.             sd->state.ignoreAll = 0;
  371. -           WFIFOB(fd,3) = 0; // success
  372. +           flag = 0; // success
  373.         } else {
  374.             if (sd->ignore[0].name[0] != '\0')
  375.             {  //Wipe the ignore list.
  376.                 memset(sd->ignore, 0, sizeof(sd->ignore));
  377. -               WFIFOB(fd,3) = 0; // success
  378. +               flag = 0; // success
  379.             } else {
  380. -               WFIFOB(fd,3) = 1; // fail
  381. +               flag = 1; // fail
  382.             }
  383.         }
  384.     }
  385.  
  386. -   WFIFOSET(fd, packet_len(0x0d2));
  387. +   clif_wisall(sd, type, flag);
  388.  }
  389.  
  390.  
  391. -/// Whisper ignore list request (CZ_REQ_WHISPER_LIST).
  392. -/// 00d3
  393. -void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd)
  394. +/// Whisper ignore list (ZC_WHISPER_LIST).
  395. +/// 00d4 <packet len>.W { <char name>.24B }*
  396. +void clif_PMIgnoreList(struct map_session_data* sd)
  397.  {
  398. -   int i;
  399. +   int i, fd = sd->fd;
  400.  
  401. -   WFIFOHEAD(fd, 4 + (NAME_LENGTH * MAX_IGNORE_LIST));
  402. +   WFIFOHEAD(fd,4+ARRAYLENGTH(sd->ignore)*NAME_LENGTH);
  403.     WFIFOW(fd,0) = 0xd4;
  404.  
  405. -   for(i = 0; i < MAX_IGNORE_LIST && sd->ignore[i].name[0] != '\0'; i++)
  406. -       memcpy(WFIFOP(fd, 4 + i * NAME_LENGTH),sd->ignore[i].name, NAME_LENGTH);
  407. +   for( i = 0; i < ARRAYLENGTH(sd->ignore) && sd->ignore[i].name[0]; i++ )
  408. +   {
  409. +       memcpy(WFIFOP(fd,4+i*NAME_LENGTH), sd->ignore[i].name, NAME_LENGTH);
  410. +   }
  411.  
  412. -   WFIFOW(fd,2) = 4 + i * NAME_LENGTH;
  413. -   WFIFOSET(fd, WFIFOW(fd,2));
  414. +   WFIFOW(fd,2) = 4+i*NAME_LENGTH;
  415. +   WFIFOSET(fd,WFIFOW(fd,2));
  416.  }
  417.  
  418.  
  419. +/// Whisper ignore list request (CZ_REQ_WHISPER_LIST).
  420. +/// 00d3
  421. +void clif_parse_PMIgnoreList(int fd,struct map_session_data *sd)
  422. +{
  423. +   clif_PMIgnoreList(sd);
  424. +}
  425. +
  426. +
  427.  /// Request to invoke the /doridori recovery bonus (CZ_DORIDORI).
  428.  /// 01e7
  429.  void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd)
  430. @@ -12823,12 +12870,27 @@
  431.  }
  432.  
  433.  
  434. +/// Asks a player for permission to be added as friend (ZC_REQ_ADD_FRIENDS).
  435. +/// 0207 <req account id>.L <req char id>.L <req char name>.24B
  436. +void clif_friendlist_req(struct map_session_data* sd, int account_id, int char_id, const char* name)
  437. +{
  438. +   int fd = sd->fd;
  439. +
  440. +   WFIFOHEAD(fd,packet_len(0x207));
  441. +   WFIFOW(fd,0) = 0x207;
  442. +   WFIFOL(fd,2) = account_id;
  443. +   WFIFOL(fd,6) = char_id;
  444. +   memcpy(WFIFOP(fd,10), name, NAME_LENGTH);
  445. +   WFIFOSET(fd,packet_len(0x207));
  446. +}
  447. +
  448. +
  449.  /// Request to add a player as friend (CZ_ADD_FRIENDS).
  450.  /// 0202 <name>.24B
  451.  void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd)
  452.  {
  453.     struct map_session_data *f_sd;
  454. -   int i, f_fd;
  455. +   int i;
  456.  
  457.     f_sd = map_nick2sd((char*)RFIFOP(fd,2));
  458.  
  459. @@ -12865,16 +12927,13 @@
  460.         }
  461.     }
  462.  
  463. -   f_sd->friend_req = sd->status.char_id;
  464. -   sd->friend_req   = f_sd->status.char_id;
  465. +   if (i == MAX_FRIENDS) {
  466. +       //No space, list full.
  467. +       clif_friendslist_reqack(sd, f_sd, 2);
  468. +       return;
  469. +   }
  470.  
  471. -   f_fd = f_sd->fd;
  472. -   WFIFOHEAD(f_fd,packet_len(0x207));
  473. -   WFIFOW(f_fd,0) = 0x207;
  474. -   WFIFOL(f_fd,2) = sd->status.account_id;
  475. -   WFIFOL(f_fd,6) = sd->status.char_id;
  476. -   memcpy(WFIFOP(f_fd,10), sd->status.name, NAME_LENGTH);
  477. -   WFIFOSET(f_fd, packet_len(0x207));
  478. +   clif_friendlist_req(f_sd, sd->status.account_id, sd->status.char_id, sd->status.name);
  479.  }
  480.  
  481.  
  482. @@ -13011,12 +13070,12 @@
  483.  }
  484.  
  485.  
  486. -/// /pvpinfo (CZ_REQ_PVPPOINT).
  487. -/// 020f <char id>.L <account id>.L
  488.  /// /pvpinfo list (ZC_ACK_PVPPOINT).
  489.  /// 0210 <char id>.L <account id>.L <win point>.L <lose point>.L <point>.L
  490. -void clif_parse_PVPInfo(int fd,struct map_session_data *sd)
  491. +void clif_PVPInfo(struct map_session_data* sd)
  492.  {
  493. +   int fd = sd->fd;
  494. +
  495.     WFIFOHEAD(fd,packet_len(0x210));
  496.     WFIFOW(fd,0) = 0x210;
  497.     WFIFOL(fd,2) = sd->status.char_id;
  498. @@ -13028,13 +13087,20 @@
  499.  }
  500.  
  501.  
  502. -/// /blacksmith (CZ_BLACKSMITH_RANK).
  503. -/// 0217
  504. +/// /pvpinfo (CZ_REQ_PVPPOINT).
  505. +/// 020f <char id>.L <account id>.L
  506. +void clif_parse_PVPInfo(int fd,struct map_session_data *sd)
  507. +{
  508. +   // TODO: Is there a way to use this on an another player (char/acc id)?
  509. +   clif_PVPInfo(sd);
  510. +}
  511. +
  512. +
  513.  /// /blacksmith list (ZC_BLACKSMITH_RANK).
  514.  /// 0219 { <name>.24B }*10 { <point>.L }*10
  515. -void clif_parse_Blacksmith(int fd,struct map_session_data *sd)
  516. +void clif_blacksmith(struct map_session_data* sd)
  517.  {
  518. -   int i;
  519. +   int i, fd = sd->fd;
  520.     const char* name;
  521.  
  522.     WFIFOHEAD(fd,packet_len(0x219));
  523. @@ -13061,11 +13127,20 @@
  524.  }
  525.  
  526.  
  527. +/// /blacksmith (CZ_BLACKSMITH_RANK).
  528. +/// 0217
  529. +void clif_parse_Blacksmith(int fd,struct map_session_data *sd)
  530. +{
  531. +   clif_blacksmith(sd);
  532. +}
  533. +
  534. +
  535.  /// Notification about backsmith points (ZC_BLACKSMITH_POINT).
  536.  /// 021b <points>.L <total points>.L
  537.  void clif_fame_blacksmith(struct map_session_data *sd, int points)
  538.  {
  539.     int fd = sd->fd;
  540. +
  541.     WFIFOHEAD(fd,packet_len(0x21b));
  542.     WFIFOW(fd,0) = 0x21b;
  543.     WFIFOL(fd,2) = points;
  544. @@ -13074,13 +13149,11 @@
  545.  }
  546.  
  547.  
  548. -/// /alchemist (CZ_ALCHEMIST_RANK).
  549. -/// 0218
  550.  /// /alchemist list (ZC_ALCHEMIST_RANK).
  551.  /// 021a { <name>.24B }*10 { <point>.L }*10
  552. -void clif_parse_Alchemist(int fd,struct map_session_data *sd)
  553. +void clif_alchemist(struct map_session_data* sd)
  554.  {
  555. -   int i;
  556. +   int i, fd = sd->fd;
  557.     const char* name;
  558.  
  559.     WFIFOHEAD(fd,packet_len(0x21a));
  560. @@ -13107,11 +13180,20 @@
  561.  }
  562.  
  563.  
  564. +/// /alchemist (CZ_ALCHEMIST_RANK).
  565. +/// 0218
  566. +void clif_parse_Alchemist(int fd,struct map_session_data *sd)
  567. +{
  568. +   clif_alchemist(sd);
  569. +}
  570. +
  571. +
  572.  /// Notification about alchemist points (ZC_ALCHEMIST_POINT).
  573.  /// 021c <points>.L <total points>.L
  574.  void clif_fame_alchemist(struct map_session_data *sd, int points)
  575.  {
  576.     int fd = sd->fd;
  577. +
  578.     WFIFOHEAD(fd,packet_len(0x21c));
  579.     WFIFOW(fd,0) = 0x21c;
  580.     WFIFOL(fd,2) = points;
  581. @@ -13120,13 +13202,11 @@
  582.  }
  583.  
  584.  
  585. -/// /taekwon (CZ_TAEKWON_RANK).
  586. -/// 0225
  587.  /// /taekwon list (ZC_TAEKWON_RANK).
  588.  /// 0226 { <name>.24B }*10 { <point>.L }*10
  589. -void clif_parse_Taekwon(int fd,struct map_session_data *sd)
  590. +void clif_taekwon(struct map_session_data* sd)
  591.  {
  592. -   int i;
  593. +   int i, fd = sd->fd;
  594.     const char* name;
  595.  
  596.     WFIFOHEAD(fd,packet_len(0x226));
  597. @@ -13152,11 +13232,20 @@
  598.  }
  599.  
  600.  
  601. +/// /taekwon (CZ_TAEKWON_RANK).
  602. +/// 0225
  603. +void clif_parse_Taekwon(int fd,struct map_session_data *sd)
  604. +{
  605. +   clif_taekwon(sd);
  606. +}
  607. +
  608. +
  609.  /// Notification about taekwon points (ZC_TAEKWON_POINT).
  610.  /// 0224 <points>.L <total points>.L
  611.  void clif_fame_taekwon(struct map_session_data *sd, int points)
  612.  {
  613.     int fd = sd->fd;
  614. +
  615.     WFIFOHEAD(fd,packet_len(0x224));
  616.     WFIFOW(fd,0) = 0x224;
  617.     WFIFOL(fd,2) = points;
  618. @@ -13165,13 +13254,11 @@
  619.  }
  620.  
  621.  
  622. -/// /pk (CZ_KILLER_RANK).
  623. -/// 0237
  624.  /// /pk list (ZC_KILLER_RANK).
  625.  /// 0238 { <name>.24B }*10 { <point>.L }*10
  626. -void clif_parse_RankingPk(int fd,struct map_session_data *sd)
  627. +void clif_ranking_pk(struct map_session_data* sd)
  628.  {
  629. -   int i;
  630. +   int i, fd = sd->fd;
  631.  
  632.     WFIFOHEAD(fd,packet_len(0x238));
  633.     WFIFOW(fd,0) = 0x238;
  634. @@ -13183,6 +13270,14 @@
  635.  }
  636.  
  637.  
  638. +/// /pk (CZ_KILLER_RANK).
  639. +/// 0237
  640. +void clif_parse_RankingPk(int fd,struct map_session_data *sd)
  641. +{
  642. +   clif_ranking_pk(sd);
  643. +}
  644. +
  645. +
  646.  /// SG Feel save OK [Komurka] (CZ_AGREE_STARPLACE).
  647.  /// 0254 <which>.B
  648.  /// which:
  649. Index: src/map/clif.h
  650. ===================================================================
  651. --- src/map/clif.h  (revisão 16496)
  652. +++ src/map/clif.h  (cópia de trabalho)
  653. @@ -469,7 +469,7 @@
  654.  void clif_item_identify_list(struct map_session_data *sd);
  655.  void clif_item_identified(struct map_session_data *sd,int idx,int flag);
  656.  void clif_item_repair_list(struct map_session_data *sd, struct map_session_data *dstsd);
  657. -void clif_item_repaireffect(struct map_session_data *sd, int nameid, int flag);
  658. +void clif_item_repaireffect(struct map_session_data *sd, int idx, int flag);
  659.  void clif_item_damaged(struct map_session_data* sd, unsigned short position);
  660.  void clif_item_refine_list(struct map_session_data *sd);
  661.  
  662. Index: src/map/map.c
  663. ===================================================================
  664. --- src/map/map.c   (revisão 16496)
  665. +++ src/map/map.c   (cópia de trabalho)
  666. @@ -265,7 +265,7 @@
  667.   * These pair of functions update the counter of how many objects
  668.   * lie on a tile.
  669.   *------------------------------------------*/
  670. -void map_addblcell(struct block_list *bl)
  671. +static void map_addblcell(struct block_list *bl)
  672.  {
  673.     if( bl->m<0 || bl->x<0 || bl->x>=map[bl->m].xs || bl->y<0 || bl->y>=map[bl->m].ys || !(bl->type&BL_CHAR) )
  674.         return;
  675. @@ -273,7 +273,7 @@
  676.     return;
  677.  }
  678.  
  679. -void map_delblcell(struct block_list *bl)
  680. +static void map_delblcell(struct block_list *bl)
  681.  {
  682.     if( bl->m <0 || bl->x<0 || bl->x>=map[bl->m].xs || bl->y<0 || bl->y>=map[bl->m].ys || !(bl->type&BL_CHAR) )
  683.         return;
  684. @@ -694,21 +694,16 @@
  685.         return 0;
  686.     if (x1 < x0)
  687.     {   //Swap range
  688. -       bx = x0;
  689. -       x0 = x1;
  690. -       x1 = bx;
  691. +       swap(x0, x1);
  692.     }
  693.     if (y1 < y0)
  694.     {
  695. -       bx = y0;
  696. -       y0 = y1;
  697. -       y1 = bx;
  698. +       swap(y0, y1);
  699.     }
  700. -   if (x0 < 0) x0 = 0;
  701. -   if (y0 < 0) y0 = 0;
  702. -   if (x1 >= map[m].xs) x1 = map[m].xs-1;
  703. -   if (y1 >= map[m].ys) y1 = map[m].ys-1;
  704. -  
  705. +   x0 = max(x0, 0);
  706. +   y0 = max(y0, 0);
  707. +   x1 = min(x1, map[m].xs-1);
  708. +   y1 = min(y1, map[m].ys-1);
  709.     if (type&~BL_MOB)
  710.         for(by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++)
  711.             for(bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++)
  712. @@ -821,21 +816,17 @@
  713.         return 0;
  714.     if (x1 < x0)
  715.     {   //Swap range
  716. -       bx = x0;
  717. -       x0 = x1;
  718. -       x1 = bx;
  719. +       swap(x0, x1);
  720.     }
  721.     if (y1 < y0)
  722.     {
  723. -       bx = y0;
  724. -       y0 = y1;
  725. -       y1 = bx;
  726. +       swap(y0, y1);
  727.     }
  728. -   if (x0 < 0) x0 = 0;
  729. -   if (y0 < 0) y0 = 0;
  730. -   if (x1 >= map[m].xs) x1 = map[m].xs-1;
  731. -   if (y1 >= map[m].ys) y1 = map[m].ys-1;
  732. -  
  733. +   x0 = max(x0, 0);
  734. +   y0 = max(y0, 0);
  735. +   x1 = min(x1, map[m].xs-1);
  736. +   y1 = min(y1, map[m].ys-1);
  737. +
  738.     if (type&~BL_MOB)
  739.         for(by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++)
  740.             for(bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++)
  741. @@ -898,15 +889,11 @@
  742.  
  743.     if (x1 < x0)
  744.     {   //Swap range
  745. -       bx = x0;
  746. -       x0 = x1;
  747. -       x1 = bx;
  748. +       swap(x0, x1);
  749.     }
  750.     if (y1 < y0)
  751.     {
  752. -       bx = y0;
  753. -       y0 = y1;
  754. -       y1 = bx;
  755. +       swap(y0, y1);
  756.     }
  757.     if(dx==0 || dy==0){
  758.         //Movement along one axis only.
  759. @@ -921,10 +908,10 @@
  760.             else //East
  761.                 x1=x0+dx-1;
  762.         }
  763. -       if(x0<0) x0=0;
  764. -       if(y0<0) y0=0;
  765. -       if(x1>=map[m].xs) x1=map[m].xs-1;
  766. -       if(y1>=map[m].ys) y1=map[m].ys-1;
  767. +       x0 = max(x0, 0);
  768. +       y0 = max(y0, 0);
  769. +       x1 = min(x1, map[m].xs-1);
  770. +       y1 = min(y1, map[m].ys-1);
  771.         for(by=y0/BLOCK_SIZE;by<=y1/BLOCK_SIZE;by++){
  772.             for(bx=x0/BLOCK_SIZE;bx<=x1/BLOCK_SIZE;bx++){
  773.                 if (type&~BL_MOB) {
  774. @@ -950,10 +937,10 @@
  775.         }
  776.     }else{
  777.         // Diagonal movement
  778. -       if(x0<0) x0=0;
  779. -       if(y0<0) y0=0;
  780. -       if(x1>=map[m].xs) x1=map[m].xs-1;
  781. -       if(y1>=map[m].ys) y1=map[m].ys-1;
  782. +       x0 = max(x0, 0);
  783. +       y0 = max(y0, 0);
  784. +       x1 = min(x1, map[m].xs-1);
  785. +       y1 = min(y1, map[m].ys-1);
  786.         for(by=y0/BLOCK_SIZE;by<=y1/BLOCK_SIZE;by++){
  787.             for(bx=x0/BLOCK_SIZE;bx<=x1/BLOCK_SIZE;bx++){
  788.                 if (type & ~BL_MOB) {
  789. Index: src/map/skill.c
  790. ===================================================================
  791. --- src/map/skill.c (revisão 16496)
  792. +++ src/map/skill.c (cópia de trabalho)
  793. @@ -13447,7 +13447,7 @@
  794.         return; //Again invalid item....
  795.  
  796.     if(sd!=target_sd && !battle_check_range(&sd->bl,&target_sd->bl,skill_get_range2(&sd->bl, sd->menuskill_id,pc_checkskill(sd, sd->menuskill_id)))){
  797. -       clif_item_repaireffect(sd,item->nameid,1);
  798. +       clif_item_repaireffect(sd,idx,1);
  799.         return;
  800.     }
  801.  
  802. @@ -13463,9 +13463,9 @@
  803.     item->attribute=0;
  804.     clif_equiplist(target_sd);
  805.     pc_delitem(sd,pc_search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
  806. -   clif_item_repaireffect(sd,item->nameid,0);
  807. +   clif_item_repaireffect(sd,idx,0);
  808.     if(sd!=target_sd)
  809. -       clif_item_repaireffect(target_sd,item->nameid,0);
  810. +       clif_item_repaireffect(target_sd,idx,0);
  811.  }
  812.  
  813.  /*==========================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement