viewing paste ra_warns2.diff | Diff

Posted on the
  1. # This patch file was generated by NetBeans IDE
  2. # Following Index: paths are relative to: /home/lighta/Documents/Myscript/RO/Servs/ra2
  3. # This patch can be applied using context Tools: Patch action on respective folder.
  4. # It uses platform neutral UTF-8 encoding and \n newlines.
  5. # Above lines and this line are ignored by the patching process.
  6. Index: 3rdparty/libconfig/libconfig.c
  7. --- 3rdparty/libconfig/libconfig.c Base (BASE)
  8. +++ 3rdparty/libconfig/libconfig.c Locally Modified (Based On LOCAL)
  9. @@ -300,7 +300,7 @@
  10.  
  11.        if(list)
  12.        {
  13. -        int len = list->length;
  14. +        unsigned int len = list->length;
  15.          config_setting_t **s;
  16.  
  17.          for(s = list->elements; len--; s++)
  18. @@ -764,7 +764,7 @@
  19.    setting = _new(config_setting_t);
  20.    setting->parent = parent;
  21.    setting->name = (name == NULL) ? NULL : strdup(name);
  22. -  setting->type = type;
  23. +  setting->type =(short) type;
  24.    setting->config = parent->config;
  25.    setting->hook = NULL;
  26.    setting->line = 0;
  27. @@ -1131,8 +1131,7 @@
  28.  
  29.  short config_setting_get_format(const config_setting_t *setting)
  30.  {
  31. -  return(setting->format != 0 ? setting->format
  32. -         : setting->config->default_format);
  33. +  return((short) (setting->format != 0 ? setting->format: setting->config->default_format) );
  34.  }
  35.  
  36.  /* ------------------------------------------------------------------------- */
  37. Index: 3rdparty/mt19937ar/mt19937ar.c
  38. --- 3rdparty/mt19937ar/mt19937ar.c Base (BASE)
  39. +++ 3rdparty/mt19937ar/mt19937ar.c Locally Modified (Based On LOCAL)
  40. @@ -61,8 +61,7 @@
  41.  {
  42.      mt[0]= s & 0xffffffffUL;
  43.      for (mti=1; mti<N; mti++) {
  44. -        mt[mti] = 
  45. -	    (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti); 
  46. +        mt[mti] = (1812433253UL * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
  47.          /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
  48.          /* In the previous versions, MSBs of the seed affect   */
  49.          /* only MSBs of the array mt[].                        */
  50. Index: CMakeLists.txt
  51. --- CMakeLists.txt Base (BASE)
  52. +++ CMakeLists.txt Locally Modified (Based On LOCAL)
  53. @@ -14,7 +14,7 @@
  54.  #   ENABLE_* : option to use an internal feature/code or not
  55.  #   HAVE_*   : internal variable indicating if we have and are using something
  56.  #
  57. -# Maintainer: Fl�vio J. Saraiva (feel free to send complaints or suggestions)
  58. +# Maintainer: Flávio J. Saraiva (feel free to send complaints or suggestions)
  59.  #   flaviojs @ rAthena forum/irc
  60.  #   flaviojs2005 \A-T/ gmail <D.o,T> com
  61.  #
  62. Index: conf/help.txt
  63. --- conf/help.txt Base (BASE)
  64. +++ conf/help.txt Locally Modified (Based On LOCAL)
  65. @@ -96,10 +96,10 @@
  66.  	"4068 Minstrel            4069 Wanderer              4070 Sura                 4071 Genetic\n"
  67.  	"4072 Shadow Chaser\n"
  68.  	"----- 3rd Class (Transcendent) -----\n"
  69. -	"4060 Rune Knight    4061 Warlock                 4062 Ranger             4063 Arch Bishop\n"
  70. -	"4064 Mechanic         4065 Guillotine Cross  4073 Royal Guard    4074 Sorcerer\n"
  71. -	"4075 Minstrel            4076 Wanderer              4077 Sura                  4078 Genetic\n"
  72. -	"4079 Shadow Chaser\n"
  73. +	"4060 Rune Knight T   4061 Warlock T                 4062 Ranger T             4063 Arch Bishop T\n"
  74. +	"4064 Mechanic T        4065 Guillotine Cross T  4073 Royal Guard T   4074 Sorcerer T\n"
  75. +	"4075 Minstrel T           4076 Wanderer T             4077 Sura T                 4078 Genetic T\n"
  76. +	"4079 Shadow Chaser T\n"
  77.  	"----- Expanded Class -----\n"
  78.  	"     23 Super Novice      24 Gunslinger              25 Ninja                 4045 Super Baby\n"
  79.  	"4046 Taekwon           4047 Star Gladiator     4049 Soul Linker            4050 Gangsi\n"
  80. Index: configure
  81. --- configure Base (BASE)
  82. +++ configure Locally Modified (Based On LOCAL)
  83. @@ -4423,7 +4423,7 @@
  84.  
  85.  
  86.  
  87. -CFLAGS="$CFLAGS -pipe -ffast-math -Wall -Wno-sign-compare"
  88. +CFLAGS="$CFLAGS -pipe -ffast-math -Wall"
  89.  CPPFLAGS="$CPPFLAGS -I../common"
  90.  
  91.  
  92. @@ -4784,7 +4784,7 @@
  93.  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-unused-parameter" >&5
  94.  $as_echo_n "checking whether $CC supports -Wno-unused-parameter... " >&6; }
  95.  OLD_CFLAGS="$CFLAGS"
  96. -CFLAGS="$CFLAGS -Wno-unused-parameter"
  97. +#CFLAGS="$CFLAGS -Wno-unused-parameter"
  98.  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  99.  /* end confdefs.h.  */
  100.  int foo;
  101. @@ -4854,8 +4854,8 @@
  102.  
  103.  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wno-pointer-sign" >&5
  104.  $as_echo_n "checking whether $CC supports -Wno-pointer-sign... " >&6; }
  105. -OLD_CFLAGS="$CFLAGS"
  106. -CFLAGS="$CFLAGS -Wno-pointer-sign"
  107. +#OLD_CFLAGS="$CFLAGS"
  108. +#CFLAGS="$CFLAGS -Wno-pointer-sign"
  109.  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  110.  /* end confdefs.h.  */
  111.  int foo;
  112. @@ -4868,7 +4868,7 @@
  113.  $as_echo_n "checking whether $CC can actually use -Wno-pointer-sign... " >&6; }
  114.  		# This option causes warnings in C++ mode
  115.  		# Note: -Werror must be before -Wno-pointer-sign, otherwise it does not do anything
  116. -		CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
  117. +#		CFLAGS="$OLD_CFLAGS -Werror -Wno-pointer-sign"
  118.  		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
  119.  /* end confdefs.h.  */
  120.  int foo;
  121. @@ -4877,13 +4877,13 @@
  122.  
  123.  				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
  124.  $as_echo "yes" >&6; }
  125. -				CFLAGS="$OLD_CFLAGS -Wno-pointer-sign"
  126. +#				CFLAGS="$OLD_CFLAGS -Wno-pointer-sign"
  127.  
  128.  else
  129.  
  130.  				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  131.  $as_echo "no" >&6; }
  132. -				CFLAGS="$OLD_CFLAGS"
  133. +#				CFLAGS="$OLD_CFLAGS"
  134.  
  135.  
  136.  fi
  137. @@ -4893,7 +4893,7 @@
  138.  
  139.  		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  140.  $as_echo "no" >&6; }
  141. -		CFLAGS="$OLD_CFLAGS"
  142. +#		CFLAGS="$OLD_CFLAGS"
  143.  
  144.  
  145.  fi
  146. @@ -5112,7 +5112,7 @@
  147.  		CFLAGS="$CFLAGS -Wno-unused -Wno-parentheses"
  148.  		;;
  149.  	"yes")
  150. -		CFLAGS="$CFLAGS -g -DDEBUG"
  151. +		CFLAGS="$CFLAGS -g -DDEBUG -Wconversion"
  152.  		;;
  153.  	"gdb")
  154.  		CFLAGS="$CFLAGS -ggdb -DDEBUG"
  155. @@ -7202,3 +7202,4 @@
  156.  $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
  157.  fi
  158.  
  159. +echo "Configure finish, CFLAG= $CFLAGS "
  160. \ No newline at end of file
  161. Index: src/char/char.c
  162. --- src/char/char.c Base (BASE)
  163. +++ src/char/char.c Locally Modified (Based On LOCAL)
  164. @@ -68,7 +68,7 @@
  165.  // show loading/saving messages
  166.  int save_log = 1;
  167.  
  168. -static DBMap *char_db_; // int char_id -> struct mmo_charstatus*
  169. +static DBMap *char_db_; // uint32 char_id -> struct mmo_charstatus*
  170.  
  171.  char db_path[1024] = "db";
  172.  
  173. @@ -122,11 +122,12 @@
  174.  
  175.  struct char_session_data {
  176.      bool auth; // whether the session is authed or not
  177. -    int account_id, login_id1, login_id2, sex;
  178. +    uint32 account_id, login_id1, login_id2;
  179. +    uint8 sex;
  180.      int found_char[MAX_CHARS]; // ids of chars on this account
  181.      char email[40]; // e-mail (default: a@a.com) by [Yor]
  182.      time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
  183. -    int group_id; // permission
  184. +    uint8 group_id; // permission [0-255]
  185.      uint32 version;
  186.      uint8 clienttype;
  187.      char new_name[NAME_LENGTH];
  188. @@ -167,34 +168,33 @@
  189.  #define AUTH_TIMEOUT 30000
  190.  
  191.  struct auth_node {
  192. -    int account_id;
  193. -    int char_id;
  194. +    uint32 account_id;
  195. +    uint32 char_id;
  196.      uint32 login_id1;
  197.      uint32 login_id2;
  198.      uint32 ip;
  199. -    int sex;
  200. +    uint8 sex;
  201.      time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
  202. -    int group_id;
  203. +    uint8 group_id;
  204.      unsigned changing_mapservers : 1;
  205.  };
  206.  
  207. -static DBMap *auth_db; // int account_id -> struct auth_node*
  208. +static DBMap *auth_db; // uint32 account_id -> struct auth_node*
  209.  
  210.  //-----------------------------------------------------
  211.  // Online User Database
  212.  //-----------------------------------------------------
  213.  
  214.  struct online_char_data {
  215. -    int account_id;
  216. -    int char_id;
  217. +    uint32 account_id, char_id;
  218.      int fd;
  219.      int waiting_disconnect;
  220.      short server; // -2: unknown server, -1: not connected, 0+: id of server
  221.  };
  222.  
  223. -static DBMap *online_char_db; // int account_id -> struct online_char_data*
  224. +static DBMap *online_char_db; // uint32 account_id -> struct online_char_data*
  225.  static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_t data);
  226. -int delete_char_sql(int char_id);
  227. +int delete_char_sql(uint32 char_id);
  228.  
  229.  /**
  230.   * @see DBCreateData
  231. @@ -211,7 +211,7 @@
  232.      return db_ptr2data(character);
  233.  }
  234.  
  235. -void set_char_charselect(int account_id)
  236. +void set_char_charselect(uint32 account_id)
  237.  {
  238.      struct online_char_data *character;
  239.  
  240. @@ -232,13 +232,13 @@
  241.      if (login_fd > 0 && !session[login_fd]->flag.eof) {
  242.          WFIFOHEAD(login_fd,6);
  243.          WFIFOW(login_fd,0) = 0x272b;
  244. -        WFIFOL(login_fd,2) = account_id;
  245. +        WFIFOL(login_fd,2) = (uint32) account_id;
  246.          WFIFOSET(login_fd,6);
  247.      }
  248.  
  249.  }
  250.  
  251. -void set_char_online(int map_id, int char_id, int account_id)
  252. +void set_char_online(short map_id, uint32 char_id, uint32 account_id)
  253.  {
  254.      struct online_char_data *character;
  255.      struct mmo_charstatus *cp;
  256. @@ -281,7 +281,7 @@
  257.      }
  258.  }
  259.  
  260. -void set_char_offline(int char_id, int account_id)
  261. +void set_char_offline(uint32 char_id, uint32 account_id)
  262.  {
  263.      struct online_char_data *character;
  264.  
  265. @@ -407,7 +407,7 @@
  266.  
  267.  int inventory_to_sql(const struct item items[], int max, int id);
  268.  
  269. -int mmo_char_tosql(int char_id, struct mmo_charstatus *p)
  270. +int mmo_char_tosql(uint32 char_id, struct mmo_charstatus *p)
  271.  {
  272.      int i = 0;
  273.      int count = 0;
  274. @@ -1040,7 +1040,7 @@
  275.  }
  276.  
  277.  //=====================================================================================================
  278. -int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, bool load_everything)
  279. +int mmo_char_fromsql(uint32 char_id, struct mmo_charstatus *p, bool load_everything)
  280.  {
  281.      int i,j;
  282.      char t_msg[128] = "";
  283. @@ -1318,7 +1318,7 @@
  284.  //-----------------------------------
  285.  // Function to change chararcter's names
  286.  //-----------------------------------
  287. -int rename_char_sql(struct char_session_data *sd, int char_id)
  288. +int rename_char_sql(struct char_session_data *sd, uint32 char_id)
  289.  {
  290.      struct mmo_charstatus char_dat;
  291.      char esc_name[NAME_LENGTH*2+1];
  292. @@ -1427,7 +1427,7 @@
  293.  
  294.      char name[NAME_LENGTH];
  295.      char esc_name[NAME_LENGTH*2+1];
  296. -    int char_id, flag;
  297. +    uint32 char_id, flag;
  298.  
  299.      safestrncpy(name, name_, NAME_LENGTH);
  300.      normalize_name(name,TRIM_CHARS);
  301. @@ -1535,11 +1535,12 @@
  302.  /* Returns 0 if successful
  303.   * Returns < 0 for error
  304.   */
  305. -int delete_char_sql(int char_id)
  306. +int delete_char_sql(uint32 char_id)
  307.  {
  308.      char name[NAME_LENGTH];
  309.      char esc_name[NAME_LENGTH*2+1]; //Name needs be escaped.
  310. -    int account_id, party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id;
  311. +    uint32 account_id;
  312. +    int party_id, guild_id, hom_id, base_level, partner_id, father_id, mother_id, elemental_id;
  313.      char *data;
  314.      size_t len;
  315.  
  316. @@ -1893,7 +1894,7 @@
  317.  //----------------------------------------------------------------------
  318.  // Force disconnection of an online player (with account value) by [Yor]
  319.  //----------------------------------------------------------------------
  320. -void disconnect_player(int account_id)
  321. +void disconnect_player(uint32 account_id)
  322.  {
  323.      int i;
  324.      struct char_session_data *sd;
  325. @@ -2062,12 +2063,12 @@
  326.                  if (RFIFOREST(fd) < 25)
  327.                      return 0;
  328.                  {
  329. -                    int account_id = RFIFOL(fd,2);
  330. +                    uint32 account_id = RFIFOL(fd,2);
  331.                      uint32 login_id1 = RFIFOL(fd,6);
  332.                      uint32 login_id2 = RFIFOL(fd,10);
  333.                      uint8 sex = RFIFOB(fd,14);
  334.                      uint8 result = RFIFOB(fd,15);
  335. -                    int request_id = RFIFOL(fd,16);
  336. +                    uint32 request_id = RFIFOL(fd,16);
  337.                      uint32 version = RFIFOL(fd,20);
  338.                      uint8 clienttype = RFIFOB(fd,24);
  339.                      RFIFOSKIP(fd,25);
  340. @@ -2146,15 +2147,15 @@
  341.                  {
  342.                      unsigned char buf[7];
  343.  
  344. -                    int acc = RFIFOL(fd,2);
  345. -                    int sex = RFIFOB(fd,6);
  346. +                    uint32 acc = RFIFOL(fd,2);
  347. +                    uint8 sex = RFIFOB(fd,6);
  348.                      RFIFOSKIP(fd,7);
  349.  
  350.                      if (acc > 0) {
  351.                          // TODO: Is this even possible?
  352. -                        int char_id[MAX_CHARS];
  353. -                        int class_[MAX_CHARS];
  354. -                        int guild_id[MAX_CHARS];
  355. +                        uint32 char_id[MAX_CHARS];
  356. +                        short class_[MAX_CHARS];
  357. +                        uint32 guild_id[MAX_CHARS];
  358.                          int num;
  359.                          char *data;
  360.  
  361. @@ -2349,7 +2350,7 @@
  362.      }
  363.  }
  364.  
  365. -int request_accreg2(int account_id, int char_id)
  366. +int request_accreg2(uint32 account_id, uint32 char_id)
  367.  {
  368.      if (login_fd > 0) {
  369.          WFIFOHEAD(login_fd,10);
  370. @@ -2480,7 +2481,7 @@
  371.  
  372.  //Loads a character's name and stores it in the buffer given (must be NAME_LENGTH in size)
  373.  //Returns 1 on found, 0 on not found (buffer is filled with Unknown char name)
  374. -int char_loadName(int char_id, char *name)
  375. +int char_loadName(uint32 char_id, char *name)
  376.  {
  377.      char *data;
  378.      size_t len;
  379. @@ -2768,7 +2769,7 @@
  380.                  {
  381.                      struct auth_node *node;
  382.  
  383. -                    int account_id = RFIFOL(fd,2);
  384. +                    uint32 account_id = RFIFOL(fd,2);
  385.                      uint32 login_id1 = RFIFOL(fd,6);
  386.                      uint32 login_id2 = RFIFOL(fd,10);
  387.                      uint32 ip = RFIFOL(fd,14);
  388. @@ -2809,7 +2810,8 @@
  389.                  if (RFIFOREST(fd) < 39)
  390.                      return 0;
  391.                  {
  392. -                    int map_id, map_fd = -1;
  393. +                    short map_id;
  394. +                    int map_fd = -1;
  395.                      struct online_char_data *data;
  396.                      struct mmo_charstatus *char_data;
  397.                      struct mmo_charstatus char_dat;
  398. @@ -2873,7 +2875,7 @@
  399.                  if (RFIFOREST(fd) < 10)
  400.                      return 0;
  401.                  {
  402. -                    int char_id, friend_id;
  403. +                    uint32 char_id, friend_id;
  404.                      char_id = RFIFOL(fd,2);
  405.                      friend_id = RFIFOL(fd,6);
  406.                      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `char_id`='%d' AND `friend_id`='%d' LIMIT 1",
  407. @@ -2938,7 +2940,7 @@
  408.                      //FIXME: set proper result value?
  409.                      else {
  410.                          char name[NAME_LENGTH];
  411. -                        int account_id;
  412. +                        uint32 account_id;
  413.                          char *data;
  414.  
  415.                          Sql_GetData(sql_handle, 0, &data, NULL);
  416. @@ -3169,10 +3171,10 @@
  417.                      return 0;
  418.  
  419.                  {
  420. -                    int account_id;
  421. -                    int char_id;
  422. -                    int login_id1;
  423. -                    char sex;
  424. +                    uint32 account_id;
  425. +                    uint32 char_id;
  426. +                    uint32 login_id1;
  427. +                    uint8 sex;
  428.                      uint32 ip;
  429.                      struct auth_node *node;
  430.                      struct mmo_charstatus *cd;
  431. @@ -3348,7 +3350,7 @@
  432.  /// 4 (0x71a): To delete a character you must withdraw from the guild.
  433.  /// 5 (0x71b): To delete a character you must withdraw from the party.
  434.  /// Any (0x718): An unknown error has occurred.
  435. -void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date)
  436. +void char_delete2_ack(int fd, uint32 char_id, uint32 result, time_t delete_date)
  437.  {
  438.      // HC: <0828>.W <char id>.L <Msg:0-5>.L <deleteDate>.L
  439.      WFIFOHEAD(fd,14);
  440. @@ -3368,7 +3370,7 @@
  441.  /// 4 (0x71d): Deleting not yet possible time.
  442.  /// 5 (0x71e): Date of birth do not match.
  443.  /// Any (0x718): An unknown error has occurred.
  444. -void char_delete2_accept_ack(int fd, int char_id, uint32 result)
  445. +void char_delete2_accept_ack(int fd, uint32 char_id, uint32 result)
  446.  {
  447.      // HC: <082a>.W <char id>.L <Msg:0-5>.L
  448.      WFIFOHEAD(fd,10);
  449. @@ -3383,7 +3385,7 @@
  450.  /// 1 (0x718): none/success, (if char id not in deletion process): An unknown error has occurred.
  451.  /// 2 (0x719): A database error occurred.
  452.  /// Any (0x718): An unknown error has occurred.
  453. -void char_delete2_cancel_ack(int fd, int char_id, uint32 result)
  454. +void char_delete2_cancel_ack(int fd, uint32 char_id, uint32 result)
  455.  {
  456.      // HC: <082c>.W <char id>.L <Msg:1-2>.L
  457.      WFIFOHEAD(fd,10);
  458. @@ -3397,7 +3399,8 @@
  459.  static void char_delete2_req(int fd, struct char_session_data *sd)
  460.  {
  461.      // CH: <0827>.W <char id>.L
  462. -    int char_id, i;
  463. +    uint32 char_id;
  464. +    int i;
  465.      char *data;
  466.      time_t delete_date;
  467.  
  468. @@ -3458,7 +3461,8 @@
  469.  {
  470.      // CH: <0829>.W <char id>.L <birth date:YYMMDD>.6B
  471.      char birthdate[8+1];
  472. -    int char_id, i, k;
  473. +    uint32 char_id;
  474. +    int i, k;
  475.      unsigned int base_level;
  476.      char *data;
  477.      time_t delete_date;
  478. @@ -3534,7 +3538,7 @@
  479.  static void char_delete2_cancel(int fd, struct char_session_data *sd)
  480.  {
  481.      // CH: <082b>.W <char id>.L
  482. -    int char_id, i;
  483. +    uint32 char_id, i;
  484.  
  485.      char_id = RFIFOL(fd,2);
  486.  
  487. @@ -3601,10 +3605,10 @@
  488.                  {
  489.                      struct auth_node *node;
  490.  
  491. -                    int account_id = RFIFOL(fd,2);
  492. +                    uint32 account_id = RFIFOL(fd,2);
  493.                      uint32 login_id1 = RFIFOL(fd,6);
  494.                      uint32 login_id2 = RFIFOL(fd,10);
  495. -                    int sex = RFIFOB(fd,16);
  496. +                    uint8 sex = RFIFOB(fd,16);
  497.                      RFIFOSKIP(fd,17);
  498.  
  499.                      ShowInfo("request connect - account_id:%d/login_id1:%d/login_id2:%d\n", account_id, login_id1, login_id2);
  500. @@ -3676,7 +3680,7 @@
  501.                      struct mmo_charstatus char_dat;
  502.                      struct mmo_charstatus *cd;
  503.                      char *data;
  504. -                    int char_id;
  505. +                    uint32 char_id;
  506.                      uint32 subnet_map_ip;
  507.                      struct auth_node *node;
  508.  
  509. Index: src/char/char.h
  510. --- src/char/char.h Base (BASE)
  511. +++ src/char/char.h Locally Modified (Based On LOCAL)
  512. @@ -35,7 +35,7 @@
  513.  int char_child(int parent_id, int child_id);
  514.  int char_family(int pl1,int pl2,int pl3);
  515.  
  516. -int request_accreg2(int account_id, int char_id);
  517. +int request_accreg2(uint32 account_id, uint32 char_id);
  518.  int save_accreg2(unsigned char *buf, int len);
  519.  
  520.  extern int char_name_option;
  521. Index: src/char/int_auction.c
  522. --- src/char/int_auction.c Base (BASE)
  523. +++ src/char/int_auction.c Locally Modified (Based On LOCAL)
  524. @@ -23,7 +23,7 @@
  525.  void auction_delete(struct auction_data *auction);
  526.  static int auction_end_timer(int tid, unsigned int tick, int id, intptr_t data);
  527.  
  528. -static int auction_count(int char_id, bool buy)
  529. +static int auction_count(uint32 char_id, bool buy)
  530.  {
  531.      int i = 0;
  532.      struct auction_data *auction;
  533. @@ -119,7 +119,7 @@
  534.      return auction->auction_id;
  535.  }
  536.  
  537. -static void mapif_Auction_message(int char_id, unsigned char result)
  538. +static void mapif_Auction_message(uint32 char_id, unsigned char result)
  539.  {
  540.      unsigned char buf[74];
  541.  
  542. @@ -239,7 +239,7 @@
  543.      Sql_FreeResult(sql_handle);
  544.  }
  545.  
  546. -static void mapif_Auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf)
  547. +static void mapif_Auction_sendlist(int fd, uint32 char_id, short count, short pages, unsigned char *buf)
  548.  {
  549.      int len = (sizeof(struct auction_data) * count) + 12;
  550.  
  551. @@ -256,7 +256,8 @@
  552.  static void mapif_parse_Auction_requestlist(int fd)
  553.  {
  554.      char searchtext[NAME_LENGTH];
  555. -    int char_id = RFIFOL(fd,4), len = sizeof(struct auction_data);
  556. +    uint32 char_id = RFIFOL(fd,4);
  557. +    int len = sizeof(struct auction_data);
  558.      int price = RFIFOL(fd,10);
  559.      short type = RFIFOW(fd,8), page = max(1,RFIFOW(fd,14));
  560.      unsigned char buf[5 * sizeof(struct auction_data)];
  561. @@ -319,7 +320,7 @@
  562.      mapif_Auction_register(fd, &auction);
  563.  }
  564.  
  565. -static void mapif_Auction_cancel(int fd, int char_id, unsigned char result)
  566. +static void mapif_Auction_cancel(int fd, uint32 char_id, unsigned char result)
  567.  {
  568.      WFIFOHEAD(fd,7);
  569.      WFIFOW(fd,0) = 0x3852;
  570. @@ -330,7 +331,7 @@
  571.  
  572.  static void mapif_parse_Auction_cancel(int fd)
  573.  {
  574. -    int char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
  575. +    uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
  576.      struct auction_data *auction;
  577.  
  578.      if ((auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL) {
  579. @@ -354,7 +355,7 @@
  580.      mapif_Auction_cancel(fd, char_id, 0); // The auction has been canceled
  581.  }
  582.  
  583. -static void mapif_Auction_close(int fd, int char_id, unsigned char result)
  584. +static void mapif_Auction_close(int fd, uint32 char_id, unsigned char result)
  585.  {
  586.      WFIFOHEAD(fd,7);
  587.      WFIFOW(fd,0) = 0x3853;
  588. @@ -365,7 +366,7 @@
  589.  
  590.  static void mapif_parse_Auction_close(int fd)
  591.  {
  592. -    int char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
  593. +    uint32 char_id = RFIFOL(fd,2), auction_id = RFIFOL(fd,6);
  594.      struct auction_data *auction;
  595.  
  596.      if ((auction = (struct auction_data *)idb_get(auction_db_, auction_id)) == NULL) {
  597. @@ -393,7 +394,7 @@
  598.      mapif_Auction_close(fd, char_id, 0); // You have ended the auction
  599.  }
  600.  
  601. -static void mapif_Auction_bid(int fd, int char_id, int bid, unsigned char result)
  602. +static void mapif_Auction_bid(int fd, uint32 char_id, int bid, unsigned char result)
  603.  {
  604.      WFIFOHEAD(fd,11);
  605.      WFIFOW(fd,0) = 0x3855;
  606. @@ -405,7 +406,7 @@
  607.  
  608.  static void mapif_parse_Auction_bid(int fd)
  609.  {
  610. -    int char_id = RFIFOL(fd,4), bid = RFIFOL(fd,12);
  611. +    uint32 char_id = RFIFOL(fd,4), bid = RFIFOL(fd,12);
  612.      unsigned int auction_id = RFIFOL(fd,8);
  613.      struct auction_data *auction;
  614.  
  615. Index: src/char/int_elemental.c
  616. --- src/char/int_elemental.c Base (BASE)
  617. +++ src/char/int_elemental.c Locally Modified (Based On LOCAL)
  618. @@ -41,7 +41,7 @@
  619.      return flag;
  620.  }
  621.  
  622. -bool mapif_elemental_load(int ele_id, int char_id, struct s_elemental *ele)
  623. +bool mapif_elemental_load(int ele_id, uint32 char_id, struct s_elemental *ele)
  624.  {
  625.      char *data;
  626.  
  627. @@ -122,7 +122,7 @@
  628.      mapif_elemental_send(fd, ele, result);
  629.  }
  630.  
  631. -static void mapif_parse_elemental_load(int fd, int ele_id, int char_id)
  632. +static void mapif_parse_elemental_load(int fd, int ele_id, uint32 char_id)
  633.  {
  634.      struct s_elemental ele;
  635.      bool result = mapif_elemental_load(ele_id, char_id, &ele);
  636. Index: src/char/int_guild.c
  637. --- src/char/int_guild.c Base (BASE)
  638. +++ src/char/int_guild.c Locally Modified (Based On LOCAL)
  639. @@ -31,16 +31,16 @@
  640.  static const char dataToHex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  641.  
  642.  //Guild cache
  643. -static DBMap *guild_db_; // int guild_id -> struct guild*
  644. +static DBMap *guild_db_; // uint32 guild_id -> struct guild*
  645.  static DBMap *castle_db;
  646.  
  647.  static unsigned int guild_exp[100];
  648.  
  649. -int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int flag,const char *mes);
  650. -int mapif_guild_broken(int guild_id,int flag);
  651. +int mapif_parse_GuildLeave(int fd,uint32 guild_id,uint32 account_id,uint32 char_id,int flag,const char *mes);
  652. +int mapif_guild_broken(uint32 guild_id,int flag);
  653.  static bool guild_check_empty(struct guild *g);
  654.  int guild_calcinfo(struct guild *g);
  655. -int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len);
  656. +int mapif_guild_basicinfochanged(uint32 guild_id,int type,const void *data,int len);
  657.  int mapif_guild_info(int fd,struct guild *g);
  658.  int guild_break_sub(int key,void *data,va_list ap);
  659.  int inter_guild_tosql(struct guild *g,int flag);
  660. @@ -86,7 +86,7 @@
  661.      return 0;
  662.  }
  663.  
  664. -int inter_guild_removemember_tosql(int account_id, int char_id)
  665. +int inter_guild_removemember_tosql(uint32 account_id, uint32 char_id)
  666.  {
  667.      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE from `%s` where `account_id` = '%d' and `char_id` = '%d'", guild_member_db, account_id, char_id))
  668.          Sql_ShowDebug(sql_handle);
  669. @@ -314,7 +314,7 @@
  670.  }
  671.  
  672.  // Read guild from sql
  673. -struct guild *inter_guild_fromsql(int guild_id) {
  674. +struct guild *inter_guild_fromsql(uint32 guild_id) {
  675.      struct guild *g;
  676.      char *data;
  677.      size_t len;
  678. @@ -637,7 +637,7 @@
  679.  }
  680.  
  681.  
  682. -int inter_guild_CharOnline(int char_id, int guild_id)
  683. +int inter_guild_CharOnline(uint32 char_id, uint32 guild_id)
  684.  {
  685.      struct guild *g;
  686.      int i;
  687. @@ -682,7 +682,7 @@
  688.      return 1;
  689.  }
  690.  
  691. -int inter_guild_CharOffline(int char_id, int guild_id)
  692. +int inter_guild_CharOffline(uint32 char_id, uint32 guild_id)
  693.  {
  694.      struct guild *g=NULL;
  695.      int online_count, i;
  696. @@ -769,7 +769,7 @@
  697.  // Get guild_id by its name. Returns 0 if not found, -1 on error.
  698.  int search_guildname(char *str)
  699.  {
  700. -    int guild_id;
  701. +    uint32 guild_id;
  702.      char esc_name[NAME_LENGTH*2+1];
  703.  
  704.      Sql_EscapeStringLen(sql_handle, esc_name, str, safestrnlen(str, NAME_LENGTH));
  705. @@ -884,7 +884,7 @@
  706.  //-------------------------------------------------------------------
  707.  // Packet sent to map server
  708.  
  709. -int mapif_guild_created(int fd,int account_id,struct guild *g)
  710. +int mapif_guild_created(int fd,uint32 account_id,struct guild *g)
  711.  {
  712.      WFIFOHEAD(fd, 10);
  713.      WFIFOW(fd,0)=0x3830;
  714. @@ -900,7 +900,7 @@
  715.  }
  716.  
  717.  // Guild not found
  718. -int mapif_guild_noinfo(int fd,int guild_id)
  719. +int mapif_guild_noinfo(int fd,uint32 guild_id)
  720.  {
  721.      unsigned char buf[12];
  722.      WBUFW(buf,0)=0x3831;
  723. @@ -929,7 +929,7 @@
  724.  }
  725.  
  726.  // ACK member add
  727. -int mapif_guild_memberadded(int fd,int guild_id,int account_id,int char_id,int flag)
  728. +int mapif_guild_memberadded(int fd,uint32 guild_id,uint32 account_id,uint32 char_id,int flag)
  729.  {
  730.      WFIFOHEAD(fd, 15);
  731.      WFIFOW(fd,0)=0x3832;
  732. @@ -942,7 +942,7 @@
  733.  }
  734.  
  735.  // ACK member leave
  736. -int mapif_guild_withdraw(int guild_id,int account_id,int char_id,int flag, const char *name, const char *mes)
  737. +int mapif_guild_withdraw(uint32 guild_id,uint32 account_id,uint32 char_id,int flag, const char *name, const char *mes)
  738.  {
  739.      unsigned char buf[55+NAME_LENGTH];
  740.      WBUFW(buf, 0)=0x3834;
  741. @@ -973,7 +973,7 @@
  742.  }
  743.  
  744.  // Send guild broken
  745. -int mapif_guild_broken(int guild_id,int flag)
  746. +int mapif_guild_broken(uint32 guild_id,int flag)
  747.  {
  748.      unsigned char buf[7];
  749.      WBUFW(buf,0)=0x3836;
  750. @@ -985,7 +985,7 @@
  751.  }
  752.  
  753.  // Send guild message
  754. -int mapif_guild_message(int guild_id,int account_id,char *mes,int len, int sfd)
  755. +int mapif_guild_message(uint32 guild_id,uint32 account_id,char *mes,int len, int sfd)
  756.  {
  757.      unsigned char buf[512];
  758.      if (len > 500)
  759. @@ -1000,7 +1000,7 @@
  760.  }
  761.  
  762.  // Send basic info
  763. -int mapif_guild_basicinfochanged(int guild_id,int type,const void *data,int len)
  764. +int mapif_guild_basicinfochanged(uint32 guild_id,int type,const void *data,int len)
  765.  {
  766.      unsigned char buf[2048];
  767.      if (len > 2038)
  768. @@ -1015,7 +1015,7 @@
  769.  }
  770.  
  771.  // Send member info
  772. -int mapif_guild_memberinfochanged(int guild_id,int account_id,int char_id, int type,const void *data,int len)
  773. +int mapif_guild_memberinfochanged(uint32 guild_id,uint32 account_id,uint32 char_id, int type,const void *data,int len)
  774.  {
  775.      unsigned char buf[2048];
  776.      if (len > 2030)
  777. @@ -1032,19 +1032,19 @@
  778.  }
  779.  
  780.  // ACK guild skill up
  781. -int mapif_guild_skillupack(int guild_id,int skill_num,int account_id)
  782. +int mapif_guild_skillupack(uint32 guild_id, uint16 skill_id, uint32 account_id)
  783.  {
  784.      unsigned char buf[14];
  785.      WBUFW(buf, 0)=0x383c;
  786.      WBUFL(buf, 2)=guild_id;
  787. -    WBUFL(buf, 6)=skill_num;
  788. +    WBUFL(buf, 6)=skill_id;
  789.      WBUFL(buf,10)=account_id;
  790.      mapif_sendall(buf,14);
  791.      return 0;
  792.  }
  793.  
  794.  // ACK guild alliance
  795. -int mapif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2)
  796. +int mapif_guild_alliance(uint32 guild_id1,uint32 guild_id2,uint32 account_id1,uint32 account_id2,int flag,const char *name1,const char *name2)
  797.  {
  798.      unsigned char buf[19+2*NAME_LENGTH];
  799.      WBUFW(buf, 0)=0x383d;
  800. @@ -1131,7 +1131,7 @@
  801.  
  802.  
  803.  // Guild creation request
  804. -int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member *master)
  805. +int mapif_parse_CreateGuild(int fd,uint32 account_id,char *name,struct guild_member *master)
  806.  {
  807.      struct guild *g;
  808.      int i=0;
  809. @@ -1210,7 +1210,7 @@
  810.  }
  811.  
  812.  // Return guild info to client
  813. -int mapif_parse_GuildInfo(int fd,int guild_id)
  814. +int mapif_parse_GuildInfo(int fd,uint32 guild_id)
  815.  {
  816.      struct guild *g = inter_guild_fromsql(guild_id);  //We use this because on start-up the info of castle-owned guilds is requied. [Skotlex]
  817.      if (g) {
  818. @@ -1222,7 +1222,7 @@
  819.  }
  820.  
  821.  // Add member to guild
  822. -int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m)
  823. +int mapif_parse_GuildAddMember(int fd,uint32 guild_id,struct guild_member *m)
  824.  {
  825.      struct guild *g;
  826.      int i;
  827. @@ -1256,7 +1256,7 @@
  828.  }
  829.  
  830.  // Delete member from guild
  831. -int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, int flag, const char *mes)
  832. +int mapif_parse_GuildLeave(int fd, uint32 guild_id, uint32 account_id, uint32 char_id, int flag, const char *mes)
  833.  {
  834.      int i, j;
  835.  
  836. @@ -1310,7 +1310,7 @@
  837.  }
  838.  
  839.  // Change member info
  840. -int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id,int account_id,int char_id,int online,int lv,int class_)
  841. +int mapif_parse_GuildChangeMemberInfoShort(int fd,uint32 guild_id,uint32 account_id,uint32 char_id,int online,int lv,short class_)
  842.  {
  843.      // Could speed up by manipulating only guild_member
  844.      struct guild *g;
  845. @@ -1359,7 +1359,7 @@
  846.  }
  847.  
  848.  // BreakGuild
  849. -int mapif_parse_BreakGuild(int fd,int guild_id)
  850. +int mapif_parse_BreakGuild(int fd,uint32 guild_id)
  851.  {
  852.      struct guild *g;
  853.  
  854. @@ -1408,13 +1408,13 @@
  855.  }
  856.  
  857.  // Forward Guild message to others map servers
  858. -int mapif_parse_GuildMessage(int fd,int guild_id,int account_id,char *mes,int len)
  859. +int mapif_parse_GuildMessage(int fd,uint32 guild_id,uint32 account_id,char *mes,int len)
  860.  {
  861.      return mapif_guild_message(guild_id,account_id,mes,len, fd);
  862.  }
  863.  
  864.  // Modification of the guild
  865. -int mapif_parse_GuildBasicInfoChange(int fd,int guild_id,int type,const char *data,int len)
  866. +int mapif_parse_GuildBasicInfoChange(int fd,uint32 guild_id,int type,const char *data,int len)
  867.  {
  868.      struct guild *g;
  869.      short dw=*((short *)data);
  870. @@ -1441,7 +1441,7 @@
  871.  }
  872.  
  873.  // Modification of the guild
  874. -int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int char_id,int type,const char *data,int len)
  875. +int mapif_parse_GuildMemberInfoChange(int fd,uint32 guild_id,uint32 account_id,uint32 char_id,int type,const char *data,int len)
  876.  {
  877.      // Could make some improvement in speed, because only change guild_member
  878.      int i;
  879. @@ -1540,12 +1540,12 @@
  880.      return 0;
  881.  }
  882.  
  883. -int inter_guild_sex_changed(int guild_id,int account_id,int char_id, short gender)
  884. +int inter_guild_sex_changed(uint32 guild_id,uint32 account_id,uint32 char_id, short gender)
  885.  {
  886.      return mapif_parse_GuildMemberInfoChange(0, guild_id, account_id, char_id, GMI_GENDER, (const char *)&gender, sizeof(gender));
  887.  }
  888.  
  889. -int inter_guild_charname_changed(int guild_id,int account_id, int char_id, char *name)
  890. +int inter_guild_charname_changed(uint32 guild_id,uint32 account_id, uint32 char_id, char *name)
  891.  {
  892.      struct guild *g;
  893.      int i, flag = 0;
  894. @@ -1579,7 +1579,7 @@
  895.  }
  896.  
  897.  // Change a position desc
  898. -int mapif_parse_GuildPosition(int fd,int guild_id,int idx,struct guild_position *p)
  899. +int mapif_parse_GuildPosition(int fd,uint32 guild_id,int idx,struct guild_position *p)
  900.  {
  901.      // Could make some improvement in speed, because only change guild_position
  902.      struct guild *g;
  903. @@ -1596,10 +1596,10 @@
  904.  }
  905.  
  906.  // Guild Skill UP
  907. -int mapif_parse_GuildSkillUp(int fd,int guild_id,int skill_num,int account_id,int max)
  908. +int mapif_parse_GuildSkillUp(int fd,uint32 guild_id,uint16 skill_id,uint32 account_id,int max)
  909.  {
  910.      struct guild *g;
  911. -    int idx = skill_num - GD_SKILLBASE;
  912. +    int idx = skill_id - GD_SKILLBASE;
  913.  
  914.      g = inter_guild_fromsql(guild_id);
  915.      if (g == NULL || idx < 0 || idx >= MAX_GUILDSKILL)
  916. @@ -1610,14 +1610,14 @@
  917.          g->skill_point--;
  918.          if (!guild_calcinfo(g))
  919.              mapif_guild_info(-1,g);
  920. -        mapif_guild_skillupack(guild_id,skill_num,account_id);
  921. +        mapif_guild_skillupack(guild_id,skill_id,account_id);
  922.          g->save_flag |= (GS_LEVEL|GS_SKILL); // Change guild & guild_skill
  923.      }
  924.      return 0;
  925.  }
  926.  
  927.  //Manual deletion of an alliance when partnering guild does not exists. [Skotlex]
  928. -static int mapif_parse_GuildDeleteAlliance(struct guild *g, int guild_id, int account_id1, int account_id2, int flag)
  929. +static int mapif_parse_GuildDeleteAlliance(struct guild *g, uint32 guild_id, uint32 account_id1, uint32 account_id2, int flag)
  930.  {
  931.      int i;
  932.      char name[NAME_LENGTH];
  933. @@ -1635,7 +1635,7 @@
  934.  }
  935.  
  936.  // Alliance modification
  937. -int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2,int account_id1,int account_id2,int flag)
  938. +int mapif_parse_GuildAlliance(int fd,uint32 guild_id1,uint32 guild_id2,uint32 account_id1,uint32 account_id2,int flag)
  939.  {
  940.      // Could speed up
  941.      struct guild *g[2];
  942. @@ -1680,7 +1680,7 @@
  943.  }
  944.  
  945.  // Change guild message
  946. -int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes2)
  947. +int mapif_parse_GuildNotice(int fd,uint32 guild_id,const char *mes1,const char *mes2)
  948.  {
  949.      struct guild *g;
  950.  
  951. @@ -1694,7 +1694,7 @@
  952.      return mapif_guild_notice(g);
  953.  }
  954.  
  955. -int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *data)
  956. +int mapif_parse_GuildEmblem(int fd,int len,uint32 guild_id,int dummy,const char *data)
  957.  {
  958.      struct guild *g;
  959.  
  960. @@ -1772,7 +1772,7 @@
  961.      return 0;
  962.  }
  963.  
  964. -int mapif_parse_GuildMasterChange(int fd, int guild_id, const char *name, int len)
  965. +int mapif_parse_GuildMasterChange(int fd, uint32 guild_id, const char *name, int len)
  966.  {
  967.      struct guild *g;
  968.      struct guild_member gm;
  969. @@ -1880,12 +1880,12 @@
  970.  }
  971.  
  972.  //Leave request from the server (for deleting character from guild)
  973. -int inter_guild_leave(int guild_id, int account_id, int char_id)
  974. +int inter_guild_leave(uint32 guild_id, uint32 account_id, uint32 char_id)
  975.  {
  976.      return mapif_parse_GuildLeave(-1, guild_id, account_id, char_id, 0, "** Character Deleted **");
  977.  }
  978.  
  979. -int inter_guild_broken(int guild_id)
  980. +int inter_guild_broken(uint32 guild_id)
  981.  {
  982.      return mapif_guild_broken(guild_id, 0);
  983.  }
  984. Index: src/char/int_guild.h
  985. --- src/char/int_guild.h Base (BASE)
  986. +++ src/char/int_guild.h Locally Modified (Based On LOCAL)
  987. @@ -26,12 +26,12 @@
  988.  int inter_guild_parse_frommap(int fd);
  989.  int inter_guild_sql_init(void);
  990.  void inter_guild_sql_final(void);
  991. -int inter_guild_leave(int guild_id,int account_id,int char_id);
  992. -int mapif_parse_BreakGuild(int fd,int guild_id);
  993. -int inter_guild_broken(int guild_id);
  994. -int inter_guild_sex_changed(int guild_id,int account_id,int char_id, short gender);
  995. -int inter_guild_charname_changed(int guild_id,int account_id, int char_id, char *name);
  996. -int inter_guild_CharOnline(int char_id, int guild_id);
  997. -int inter_guild_CharOffline(int char_id, int guild_id);
  998. +int inter_guild_leave(uint32 guild_id,uint32 account_id,uint32 char_id);
  999. +int mapif_parse_BreakGuild(int fd,uint32 guild_id);
  1000. +int inter_guild_broken(uint32 guild_id);
  1001. +int inter_guild_sex_changed(uint32 guild_id,uint32 account_id,uint32 char_id, short gender);
  1002. +int inter_guild_charname_changed(uint32 guild_id,uint32 account_id, uint32 char_id, char *name);
  1003. +int inter_guild_CharOnline(uint32 char_id, uint32 guild_id);
  1004. +int inter_guild_CharOffline(uint32 char_id, uint32 guild_id);
  1005.  
  1006.  #endif /* _INT_GUILD_SQL_H_ */
  1007. Index: src/char/int_homun.c
  1008. --- src/char/int_homun.c Base (BASE)
  1009. +++ src/char/int_homun.c Locally Modified (Based On LOCAL)
  1010. @@ -25,7 +25,7 @@
  1011.      return;
  1012.  }
  1013.  
  1014. -static void mapif_homunculus_created(int fd, int account_id, struct s_homunculus *sh, unsigned char flag)
  1015. +static void mapif_homunculus_created(int fd, uint32 account_id, struct s_homunculus *sh, unsigned char flag)
  1016.  {
  1017.      WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
  1018.      WFIFOW(fd,0) = 0x3890;
  1019. @@ -44,7 +44,7 @@
  1020.      WFIFOSET(fd, 3);
  1021.  }
  1022.  
  1023. -static void mapif_homunculus_loaded(int fd, int account_id, struct s_homunculus *hd)
  1024. +static void mapif_homunculus_loaded(int fd, uint32 account_id, struct s_homunculus *hd)
  1025.  {
  1026.      WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
  1027.      WFIFOW(fd,0) = 0x3891;
  1028. @@ -60,7 +60,7 @@
  1029.      WFIFOSET(fd, sizeof(struct s_homunculus)+9);
  1030.  }
  1031.  
  1032. -static void mapif_homunculus_saved(int fd, int account_id, bool flag)
  1033. +static void mapif_homunculus_saved(int fd, uint32 account_id, bool flag)
  1034.  {
  1035.      WFIFOHEAD(fd, 7);
  1036.      WFIFOW(fd,0) = 0x3892;
  1037. @@ -69,7 +69,7 @@
  1038.      WFIFOSET(fd, 7);
  1039.  }
  1040.  
  1041. -static void mapif_homunculus_renamed(int fd, int account_id, int char_id, unsigned char flag, char *name)
  1042. +static void mapif_homunculus_renamed(int fd, uint32 account_id, uint32 char_id, unsigned char flag, char *name)
  1043.  {
  1044.      WFIFOHEAD(fd, NAME_LENGTH+12);
  1045.      WFIFOW(fd, 0) = 0x3894;
  1046. @@ -264,7 +264,7 @@
  1047.  }
  1048.  
  1049.  
  1050. -static void mapif_parse_homunculus_create(int fd, int len, int account_id, struct s_homunculus *phd)
  1051. +static void mapif_parse_homunculus_create(int fd, int len, uint32 account_id, struct s_homunculus *phd)
  1052.  {
  1053.      bool result = mapif_homunculus_save(phd);
  1054.      mapif_homunculus_created(fd, account_id, phd, result);
  1055. @@ -276,20 +276,20 @@
  1056.      mapif_homunculus_deleted(fd, result);
  1057.  }
  1058.  
  1059. -static void mapif_parse_homunculus_load(int fd, int account_id, int homun_id)
  1060. +static void mapif_parse_homunculus_load(int fd, uint32 account_id, int homun_id)
  1061.  {
  1062.      struct s_homunculus hd;
  1063.      bool result = mapif_homunculus_load(homun_id, &hd);
  1064.      mapif_homunculus_loaded(fd, account_id, (result ? &hd : NULL));
  1065.  }
  1066.  
  1067. -static void mapif_parse_homunculus_save(int fd, int len, int account_id, struct s_homunculus *phd)
  1068. +static void mapif_parse_homunculus_save(int fd, int len, uint32 account_id, struct s_homunculus *phd)
  1069.  {
  1070.      bool result = mapif_homunculus_save(phd);
  1071.      mapif_homunculus_saved(fd, account_id, result);
  1072.  }
  1073.  
  1074. -static void mapif_parse_homunculus_rename(int fd, int account_id, int char_id, char *name)
  1075. +static void mapif_parse_homunculus_rename(int fd, uint32 account_id, uint32 char_id, char *name)
  1076.  {
  1077.      bool result = mapif_homunculus_rename(name);
  1078.      mapif_homunculus_renamed(fd, account_id, char_id, result, name);
  1079. Index: src/char/int_mail.c
  1080. --- src/char/int_mail.c Base (BASE)
  1081. +++ src/char/int_mail.c Locally Modified (Based On LOCAL)
  1082. @@ -15,7 +15,7 @@
  1083.  #include <string.h>
  1084.  #include <stdlib.h>
  1085.  
  1086. -static int mail_fromsql(int char_id, struct mail_data *md)
  1087. +static int mail_fromsql(uint32 char_id, struct mail_data *md)
  1088.  {
  1089.      int i, j;
  1090.      struct mail_message *msg;
  1091. @@ -214,7 +214,7 @@
  1092.  /*==========================================
  1093.   * Client Inbox Request
  1094.   *------------------------------------------*/
  1095. -static void mapif_Mail_sendinbox(int fd, int char_id, unsigned char flag)
  1096. +static void mapif_Mail_sendinbox(int fd, uint32 char_id, unsigned char flag)
  1097.  {
  1098.      struct mail_data md;
  1099.      mail_fromsql(char_id, &md);
  1100. @@ -269,7 +269,7 @@
  1101.      return true;
  1102.  }
  1103.  
  1104. -static void mapif_Mail_getattach(int fd, int char_id, int mail_id)
  1105. +static void mapif_Mail_getattach(int fd, uint32 char_id, int mail_id)
  1106.  {
  1107.      struct mail_message msg;
  1108.  
  1109. @@ -305,7 +305,7 @@
  1110.  /*==========================================
  1111.   * Delete Mail
  1112.   *------------------------------------------*/
  1113. -static void mapif_Mail_delete(int fd, int char_id, int mail_id)
  1114. +static void mapif_Mail_delete(int fd, uint32 char_id, int mail_id)
  1115.  {
  1116.      bool failed = false;
  1117.      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id)) {
  1118. @@ -347,7 +347,7 @@
  1119.  /*==========================================
  1120.   * Return Mail
  1121.   *------------------------------------------*/
  1122. -static void mapif_Mail_return(int fd, int char_id, int mail_id)
  1123. +static void mapif_Mail_return(int fd, uint32 char_id, int mail_id)
  1124.  {
  1125.      struct mail_message msg;
  1126.      int new_mail = 0;
  1127. @@ -409,7 +409,7 @@
  1128.  {
  1129.      struct mail_message msg;
  1130.      char esc_name[NAME_LENGTH*2+1];
  1131. -    int account_id = 0;
  1132. +    uint32 account_id = 0;
  1133.  
  1134.      if (RFIFOW(fd,2) != 8 + sizeof(struct mail_message))
  1135.          return;
  1136. Index: src/char/int_mercenary.c
  1137. --- src/char/int_mercenary.c Base (BASE)
  1138. +++ src/char/int_mercenary.c Locally Modified (Based On LOCAL)
  1139. @@ -15,7 +15,7 @@
  1140.  #include <stdlib.h>
  1141.  #include <string.h>
  1142.  
  1143. -bool mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status)
  1144. +bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status)
  1145.  {
  1146.      char *data;
  1147.  
  1148. @@ -48,7 +48,7 @@
  1149.      return true;
  1150.  }
  1151.  
  1152. -bool mercenary_owner_tosql(int char_id, struct mmo_charstatus *status)
  1153. +bool mercenary_owner_tosql(uint32 char_id, struct mmo_charstatus *status)
  1154.  {
  1155.      if (SQL_ERROR == Sql_Query(sql_handle, "REPLACE INTO `%s` (`char_id`, `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
  1156.                                 mercenary_owner_db, char_id, status->mer_id, status->arch_calls, status->arch_faith, status->spear_calls, status->spear_faith, status->sword_calls, status->sword_faith)) {
  1157. @@ -59,7 +59,7 @@
  1158.      return true;
  1159.  }
  1160.  
  1161. -bool mercenary_owner_delete(int char_id)
  1162. +bool mercenary_owner_delete(uint32 char_id)
  1163.  {
  1164.      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id))
  1165.          Sql_ShowDebug(sql_handle);
  1166. @@ -94,7 +94,7 @@
  1167.      return flag;
  1168.  }
  1169.  
  1170. -bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc)
  1171. +bool mapif_mercenary_load(int merc_id, uint32 char_id, struct s_mercenary *merc)
  1172.  {
  1173.      char *data;
  1174.  
  1175. @@ -157,7 +157,7 @@
  1176.      mapif_mercenary_send(fd, merc, result);
  1177.  }
  1178.  
  1179. -static void mapif_parse_mercenary_load(int fd, int merc_id, int char_id)
  1180. +static void mapif_parse_mercenary_load(int fd, int merc_id, uint32 char_id)
  1181.  {
  1182.      struct s_mercenary merc;
  1183.      bool result = mapif_mercenary_load(merc_id, char_id, &merc);
  1184. Index: src/char/int_mercenary.h
  1185. --- src/char/int_mercenary.h Base (BASE)
  1186. +++ src/char/int_mercenary.h Locally Modified (Based On LOCAL)
  1187. @@ -11,9 +11,9 @@
  1188.  int inter_mercenary_parse_frommap(int fd);
  1189.  
  1190.  // Mercenary Owner Database
  1191. -bool mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status);
  1192. -bool mercenary_owner_tosql(int char_id, struct mmo_charstatus *status);
  1193. -bool mercenary_owner_delete(int char_id);
  1194. +bool mercenary_owner_fromsql(uint32 char_id, struct mmo_charstatus *status);
  1195. +bool mercenary_owner_tosql(uint32 char_id, struct mmo_charstatus *status);
  1196. +bool mercenary_owner_delete(uint32 char_id);
  1197.  
  1198.  bool mapif_mercenary_delete(int merc_id);
  1199.  
  1200. Index: src/char/int_party.c
  1201. --- src/char/int_party.c Base (BASE)
  1202. +++ src/char/int_party.c Locally Modified (Based On LOCAL)
  1203. @@ -28,11 +28,11 @@
  1204.  static struct party_data *party_pt;
  1205.  static DBMap *party_db_; // int party_id -> struct party_data*
  1206.  
  1207. -int mapif_party_broken(int party_id,int flag);
  1208. +int mapif_party_broken(uint32 party_id,int flag);
  1209.  int party_check_empty(struct party_data *p);
  1210. -int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id);
  1211. +int mapif_parse_PartyLeave(int fd, uint32 party_id, uint32 account_id, uint32 char_id);
  1212.  int party_check_exp_share(struct party_data *p);
  1213. -int mapif_party_optionchanged(int fd,struct party *p, int account_id, int flag);
  1214. +int mapif_party_optionchanged(int fd,struct party *p, uint32 account_id, int flag);
  1215.  
  1216.  //Updates party's level range and unsets even share if broken.
  1217.  static int int_party_check_lv(struct party_data *p)
  1218. @@ -185,7 +185,7 @@
  1219.  }
  1220.  
  1221.  // Read party from mysql
  1222. -struct party_data *inter_party_fromsql(int party_id) {
  1223. +struct party_data *inter_party_fromsql(uint32 party_id) {
  1224.      int leader_id = 0;
  1225.      int leader_char = 0;
  1226.      struct party_data *p;
  1227. @@ -333,7 +333,7 @@
  1228.  
  1229.  
  1230.  // Create a party whether or not
  1231. -int mapif_party_created(int fd,int account_id,int char_id,struct party *p)
  1232. +int mapif_party_created(int fd,uint32 account_id,uint32 char_id,struct party *p)
  1233.  {
  1234.      WFIFOHEAD(fd, 39);
  1235.      WFIFOW(fd,0)=0x3820;
  1236. @@ -355,7 +355,7 @@
  1237.  }
  1238.  
  1239.  //Party information not found
  1240. -static void mapif_party_noinfo(int fd, int party_id, int char_id)
  1241. +static void mapif_party_noinfo(int fd, uint32 party_id, uint32 char_id)
  1242.  {
  1243.      WFIFOHEAD(fd, 12);
  1244.      WFIFOW(fd,0) = 0x3821;
  1245. @@ -367,7 +367,7 @@
  1246.  }
  1247.  
  1248.  //Digest party information
  1249. -static void mapif_party_info(int fd, struct party *p, int char_id)
  1250. +static void mapif_party_info(int fd, struct party *p, uint32 char_id)
  1251.  {
  1252.      unsigned char buf[8 + sizeof(struct party)];
  1253.      WBUFW(buf,0) = 0x3821;
  1254. @@ -382,7 +382,7 @@
  1255.  }
  1256.  
  1257.  //Whether or not additional party members
  1258. -int mapif_party_memberadded(int fd, int party_id, int account_id, int char_id, int flag)
  1259. +int mapif_party_memberadded(int fd, uint32 party_id, uint32 account_id, uint32 char_id, int flag)
  1260.  {
  1261.      WFIFOHEAD(fd, 15);
  1262.      WFIFOW(fd,0) = 0x3822;
  1263. @@ -396,7 +396,7 @@
  1264.  }
  1265.  
  1266.  // Party setting change notification
  1267. -int mapif_party_optionchanged(int fd,struct party *p,int account_id,int flag)
  1268. +int mapif_party_optionchanged(int fd,struct party *p,uint32 account_id,int flag)
  1269.  {
  1270.      unsigned char buf[16];
  1271.      WBUFW(buf,0)=0x3823;
  1272. @@ -413,7 +413,7 @@
  1273.  }
  1274.  
  1275.  //Withdrawal notification party
  1276. -int mapif_party_withdraw(int party_id,int account_id, int char_id)
  1277. +int mapif_party_withdraw(uint32 party_id,uint32 account_id, uint32 char_id)
  1278.  {
  1279.      unsigned char buf[16];
  1280.  
  1281. @@ -442,7 +442,7 @@
  1282.  }
  1283.  
  1284.  //Dissolution party notification
  1285. -int mapif_party_broken(int party_id,int flag)
  1286. +int mapif_party_broken(uint32 party_id,int flag)
  1287.  {
  1288.      unsigned char buf[16];
  1289.      WBUFW(buf,0)=0x3826;
  1290. @@ -454,7 +454,7 @@
  1291.  }
  1292.  
  1293.  //Remarks in the party
  1294. -int mapif_party_message(int party_id,int account_id,char *mes,int len, int sfd)
  1295. +int mapif_party_message(int party_id,uint32 account_id,char *mes,int len, int sfd)
  1296.  {
  1297.      unsigned char buf[512];
  1298.      WBUFW(buf,0)=0x3827;
  1299. @@ -520,7 +520,7 @@
  1300.  }
  1301.  
  1302.  // Party information request
  1303. -static void mapif_parse_PartyInfo(int fd, int party_id, int char_id)
  1304. +static void mapif_parse_PartyInfo(int fd, uint32 party_id, uint32 char_id)
  1305.  {
  1306.      struct party_data *p;
  1307.      p = inter_party_fromsql(party_id);
  1308. @@ -532,7 +532,7 @@
  1309.  }
  1310.  
  1311.  // Add a player to party request
  1312. -int mapif_parse_PartyAddMember(int fd, int party_id, struct party_member *member)
  1313. +int mapif_parse_PartyAddMember(int fd, uint32 party_id, struct party_member *member)
  1314.  {
  1315.      struct party_data *p;
  1316.      int i;
  1317. @@ -570,7 +570,7 @@
  1318.  }
  1319.  
  1320.  //Party setting change request
  1321. -int mapif_parse_PartyChangeOption(int fd,int party_id,int account_id,int exp,int item)
  1322. +int mapif_parse_PartyChangeOption(int fd,uint32 party_id,uint32 account_id,int exp,int item)
  1323.  {
  1324.      struct party_data *p;
  1325.      int flag = 0;
  1326. @@ -591,7 +591,7 @@
  1327.  }
  1328.  
  1329.  //Request leave party
  1330. -int mapif_parse_PartyLeave(int fd, int party_id, int account_id, int char_id)
  1331. +int mapif_parse_PartyLeave(int fd, uint32 party_id, uint32 account_id, uint32 char_id)
  1332.  {
  1333.      struct party_data *p;
  1334.      int i,j=-1;
  1335. @@ -641,7 +641,7 @@
  1336.      return 0;
  1337.  }
  1338.  // When member goes to other map or levels up.
  1339. -int mapif_parse_PartyChangeMap(int fd, int party_id, int account_id, int char_id, unsigned short map, int online, unsigned int lv)
  1340. +int mapif_parse_PartyChangeMap(int fd, uint32 party_id, uint32 account_id, uint32 char_id, unsigned short map, int online, unsigned int lv)
  1341.  {
  1342.      struct party_data *p;
  1343.      int i;
  1344. @@ -695,7 +695,7 @@
  1345.  }
  1346.  
  1347.  //Request party dissolution
  1348. -int mapif_parse_BreakParty(int fd,int party_id)
  1349. +int mapif_parse_BreakParty(int fd,uint32 party_id)
  1350.  {
  1351.      struct party_data *p;
  1352.  
  1353. @@ -709,12 +709,12 @@
  1354.  }
  1355.  
  1356.  //Party sending the message
  1357. -int mapif_parse_PartyMessage(int fd,int party_id,int account_id,char *mes,int len)
  1358. +int mapif_parse_PartyMessage(int fd,uint32 party_id,uint32 account_id,char *mes,int len)
  1359.  {
  1360.      return mapif_party_message(party_id,account_id,mes,len, fd);
  1361.  }
  1362.  
  1363. -int mapif_parse_PartyLeaderChange(int fd,int party_id,int account_id,int char_id)
  1364. +int mapif_parse_PartyLeaderChange(int fd,uint32 party_id,uint32 account_id,uint32 char_id)
  1365.  {
  1366.      struct party_data *p;
  1367.      int i;
  1368. @@ -782,12 +782,12 @@
  1369.  }
  1370.  
  1371.  //Leave request from the server (for delete character)
  1372. -int inter_party_leave(int party_id,int account_id, int char_id)
  1373. +int inter_party_leave(uint32 party_id,uint32 account_id, uint32 char_id)
  1374.  {
  1375.      return mapif_parse_PartyLeave(-1,party_id,account_id, char_id);
  1376.  }
  1377.  
  1378. -int inter_party_CharOnline(int char_id, int party_id)
  1379. +int inter_party_CharOnline(uint32 char_id, uint32 party_id)
  1380.  {
  1381.      struct party_data *p;
  1382.      int i;
  1383. @@ -833,7 +833,7 @@
  1384.      return 1;
  1385.  }
  1386.  
  1387. -int inter_party_CharOffline(int char_id, int party_id)
  1388. +int inter_party_CharOffline(uint32 char_id, uint32 party_id)
  1389.  {
  1390.      struct party_data *p=NULL;
  1391.      int i;
  1392. Index: src/char/int_party.h
  1393. --- src/char/int_party.h Base (BASE)
  1394. +++ src/char/int_party.h Locally Modified (Based On LOCAL)
  1395. @@ -19,8 +19,8 @@
  1396.  int inter_party_parse_frommap(int fd);
  1397.  int inter_party_sql_init(void);
  1398.  void inter_party_sql_final(void);
  1399. -int inter_party_leave(int party_id,int account_id, int char_id);
  1400. -int inter_party_CharOnline(int char_id, int party_id);
  1401. -int inter_party_CharOffline(int char_id, int party_id);
  1402. +int inter_party_leave(uint32 party_id,uint32 account_id, uint32 char_id);
  1403. +int inter_party_CharOnline(uint32 char_id, uint32 party_id);
  1404. +int inter_party_CharOffline(uint32 char_id, uint32 party_id);
  1405.  
  1406.  #endif /* _INT_PARTY_SQL_H_ */
  1407. Index: src/char/int_pet.c
  1408. --- src/char/int_pet.c Base (BASE)
  1409. +++ src/char/int_pet.c Locally Modified (Based On LOCAL)
  1410. @@ -128,7 +128,7 @@
  1411.      return 0;
  1412.  }
  1413.  //------------------------------------------------------
  1414. -int mapif_pet_created(int fd, int account_id, struct s_pet *p)
  1415. +int mapif_pet_created(int fd, uint32 account_id, struct s_pet *p)
  1416.  {
  1417.      WFIFOHEAD(fd, 11);
  1418.      WFIFOW(fd, 0) =0x3880;
  1419. @@ -146,7 +146,7 @@
  1420.      return 0;
  1421.  }
  1422.  
  1423. -int mapif_pet_info(int fd, int account_id, struct s_pet *p)
  1424. +int mapif_pet_info(int fd, uint32 account_id, struct s_pet *p)
  1425.  {
  1426.      WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
  1427.      WFIFOW(fd, 0) =0x3881;
  1428. @@ -159,7 +159,7 @@
  1429.      return 0;
  1430.  }
  1431.  
  1432. -int mapif_pet_noinfo(int fd, int account_id)
  1433. +int mapif_pet_noinfo(int fd, uint32 account_id)
  1434.  {
  1435.      WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
  1436.      WFIFOW(fd, 0) =0x3881;
  1437. @@ -172,7 +172,7 @@
  1438.      return 0;
  1439.  }
  1440.  
  1441. -int mapif_save_pet_ack(int fd, int account_id, int flag)
  1442. +int mapif_save_pet_ack(int fd, uint32 account_id, int flag)
  1443.  {
  1444.      WFIFOHEAD(fd, 7);
  1445.      WFIFOW(fd, 0) =0x3882;
  1446. @@ -193,7 +193,7 @@
  1447.      return 0;
  1448.  }
  1449.  
  1450. -int mapif_create_pet(int fd, int account_id, int char_id, short pet_class, short pet_lv, short pet_egg_id,
  1451. +int mapif_create_pet(int fd, uint32 account_id, uint32 char_id, short pet_class, short pet_lv, short pet_egg_id,
  1452.                       short pet_equip, short intimate, short hungry, char rename_flag, char incuvate, char *pet_name)
  1453.  {
  1454.      memset(pet_pt, 0, sizeof(struct s_pet));
  1455. @@ -231,7 +231,7 @@
  1456.      return 0;
  1457.  }
  1458.  
  1459. -int mapif_load_pet(int fd, int account_id, int char_id, int pet_id)
  1460. +int mapif_load_pet(int fd, uint32 account_id, uint32 char_id, uint32 pet_id)
  1461.  {
  1462.      memset(pet_pt, 0, sizeof(struct s_pet));
  1463.  
  1464. @@ -251,7 +251,7 @@
  1465.      return 0;
  1466.  }
  1467.  
  1468. -int mapif_save_pet(int fd, int account_id, struct s_pet *data)
  1469. +int mapif_save_pet(int fd, uint32 account_id, struct s_pet *data)
  1470.  {
  1471.      //here process pet save request.
  1472.      int len;
  1473. @@ -277,7 +277,7 @@
  1474.      return 0;
  1475.  }
  1476.  
  1477. -int mapif_delete_pet(int fd, int pet_id)
  1478. +int mapif_delete_pet(int fd, uint32 pet_id)
  1479.  {
  1480.      mapif_delete_pet_ack(fd, inter_pet_delete(pet_id));
  1481.  
  1482. Index: src/char/int_quest.c
  1483. --- src/char/int_quest.c Base (BASE)
  1484. +++ src/char/int_quest.c Locally Modified (Based On LOCAL)
  1485. @@ -19,7 +19,7 @@
  1486.  #include <stdlib.h>
  1487.  
  1488.  //Load entire questlog for a character
  1489. -int mapif_quests_fromsql(int char_id, struct quest questlog[])
  1490. +int mapif_quests_fromsql(uint32 char_id, struct quest questlog[])
  1491.  {
  1492.      int i;
  1493.      struct quest tmp_quest;
  1494. @@ -52,7 +52,7 @@
  1495.  }
  1496.  
  1497.  //Delete a quest
  1498. -bool mapif_quest_delete(int char_id, int quest_id)
  1499. +bool mapif_quest_delete(uint32 char_id, int quest_id)
  1500.  {
  1501.      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, quest_id, char_id)) {
  1502.          Sql_ShowDebug(sql_handle);
  1503. @@ -63,7 +63,7 @@
  1504.  }
  1505.  
  1506.  //Add a quest to a questlog
  1507. -bool mapif_quest_add(int char_id, struct quest qd)
  1508. +bool mapif_quest_add(uint32 char_id, struct quest qd)
  1509.  {
  1510.      if (SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s`(`quest_id`, `char_id`, `state`, `time`, `count1`, `count2`, `count3`) VALUES ('%d', '%d', '%d','%d', '%d', '%d', '%d')", quest_db, qd.quest_id, char_id, qd.state, qd.time, qd.count[0], qd.count[1], qd.count[2])) {
  1511.          Sql_ShowDebug(sql_handle);
  1512. @@ -74,7 +74,7 @@
  1513.  }
  1514.  
  1515.  //Update a questlog
  1516. -bool mapif_quest_update(int char_id, struct quest qd)
  1517. +bool mapif_quest_update(uint32 char_id, struct quest qd)
  1518.  {
  1519.      if (SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `state`='%d', `count1`='%d', `count2`='%d', `count3`='%d' WHERE `quest_id` = '%d' AND `char_id` = '%d'", quest_db, qd.state, qd.count[0], qd.count[1], qd.count[2], qd.quest_id, char_id)) {
  1520.          Sql_ShowDebug(sql_handle);
  1521. @@ -88,7 +88,7 @@
  1522.  int mapif_parse_quest_save(int fd)
  1523.  {
  1524.      int i, j, k, num2, num1 = (RFIFOW(fd,2)-8)/sizeof(struct quest);
  1525. -    int char_id = RFIFOL(fd,4);
  1526. +    uint32 char_id = RFIFOL(fd,4);
  1527.      struct quest qd1[MAX_QUEST_DB],qd2[MAX_QUEST_DB];
  1528.      bool success = true;
  1529.  
  1530. @@ -129,7 +129,7 @@
  1531.  //Send questlog to map server
  1532.  int mapif_parse_quest_load(int fd)
  1533.  {
  1534. -    int char_id = RFIFOL(fd,2);
  1535. +    uint32 char_id = RFIFOL(fd,2);
  1536.      struct quest tmp_questlog[MAX_QUEST_DB];
  1537.      int num_quests, i, num_complete = 0;
  1538.      int complete[MAX_QUEST_DB];
  1539. Index: src/char/int_storage.c
  1540. --- src/char/int_storage.c Base (BASE)
  1541. +++ src/char/int_storage.c Locally Modified (Based On LOCAL)
  1542. @@ -18,14 +18,14 @@
  1543.  #define STORAGE_MEMINC  16
  1544.  
  1545.  /// Save storage data to sql
  1546. -int storage_tosql(int account_id, struct storage_data *p)
  1547. +int storage_tosql(uint32 account_id, struct storage_data *p)
  1548.  {
  1549.      memitemdata_to_sql(p->items, MAX_STORAGE, account_id, TABLE_STORAGE);
  1550.      return 0;
  1551.  }
  1552.  
  1553.  /// Load storage data to mem
  1554. -int storage_fromsql(int account_id, struct storage_data *p)
  1555. +int storage_fromsql(uint32 account_id, struct storage_data *p)
  1556.  {
  1557.      StringBuf buf;
  1558.      struct item *item;
  1559. @@ -79,7 +79,7 @@
  1560.  }
  1561.  
  1562.  /// Save guild_storage data to sql
  1563. -int guild_storage_tosql(int guild_id, struct guild_storage *p)
  1564. +int guild_storage_tosql(uint32 guild_id, struct guild_storage *p)
  1565.  {
  1566.      memitemdata_to_sql(p->items, MAX_GUILD_STORAGE, guild_id, TABLE_GUILD_STORAGE);
  1567.      ShowInfo("guild storage save to DB - guild: %d\n", guild_id);
  1568. @@ -87,7 +87,7 @@
  1569.  }
  1570.  
  1571.  /// Load guild_storage data to mem
  1572. -int guild_storage_fromsql(int guild_id, struct guild_storage *p)
  1573. +int guild_storage_fromsql(uint32 guild_id, struct guild_storage *p)
  1574.  {
  1575.      StringBuf buf;
  1576.      struct item *item;
  1577. @@ -153,13 +153,13 @@
  1578.  }
  1579.  
  1580.  // q?f[^?
  1581. -int inter_storage_delete(int account_id)
  1582. +int inter_storage_delete(uint32 account_id)
  1583.  {
  1584.      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `account_id`='%d'", storage_db, account_id))
  1585.          Sql_ShowDebug(sql_handle);
  1586.      return 0;
  1587.  }
  1588. -int inter_guild_storage_delete(int guild_id)
  1589. +int inter_guild_storage_delete(uint32 guild_id)
  1590.  {
  1591.      if (SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE `guild_id`='%d'", guild_storage_db, guild_id))
  1592.          Sql_ShowDebug(sql_handle);
  1593. @@ -169,7 +169,7 @@
  1594.  //---------------------------------------------------------
  1595.  // packet from map server
  1596.  
  1597. -int mapif_load_guild_storage(int fd,int account_id,int guild_id)
  1598. +int mapif_load_guild_storage(int fd,uint32 account_id,uint32 guild_id)
  1599.  {
  1600.      if (SQL_ERROR == Sql_Query(sql_handle, "SELECT `guild_id` FROM `%s` WHERE `guild_id`='%d'", guild_db, guild_id))
  1601.          Sql_ShowDebug(sql_handle);
  1602. @@ -194,7 +194,7 @@
  1603.      WFIFOSET(fd, 12);
  1604.      return 0;
  1605.  }
  1606. -int mapif_save_guild_storage_ack(int fd,int account_id,int guild_id,int fail)
  1607. +int mapif_save_guild_storage_ack(int fd,uint32 account_id,uint32 guild_id,int fail)
  1608.  {
  1609.      WFIFOHEAD(fd,11);
  1610.      WFIFOW(fd,0)=0x3819;
  1611. @@ -217,7 +217,7 @@
  1612.  
  1613.  int mapif_parse_SaveGuildStorage(int fd)
  1614.  {
  1615. -    int guild_id;
  1616. +    uint32 guild_id;
  1617.      int len;
  1618.  
  1619.      RFIFOHEAD(fd);
  1620. Index: src/char/int_storage.h
  1621. --- src/char/int_storage.h Base (BASE)
  1622. +++ src/char/int_storage.h Locally Modified (Based On LOCAL)
  1623. @@ -9,14 +9,14 @@
  1624.  
  1625.  int inter_storage_sql_init(void);
  1626.  void inter_storage_sql_final(void);
  1627. -int inter_storage_delete(int account_id);
  1628. -int inter_guild_storage_delete(int guild_id);
  1629. +int inter_storage_delete(uint32 account_id);
  1630. +int inter_guild_storage_delete(uint32 guild_id);
  1631.  
  1632.  int inter_storage_parse_frommap(int fd);
  1633.  
  1634.  //Exported for use in the TXT-SQL converter.
  1635. -int storage_fromsql(int account_id, struct storage_data *p);
  1636. -int storage_tosql(int account_id,struct storage_data *p);
  1637. -int guild_storage_tosql(int guild_id, struct guild_storage *p);
  1638. +int storage_fromsql(uint32 account_id, struct storage_data *p);
  1639. +int storage_tosql(uint32 account_id,struct storage_data *p);
  1640. +int guild_storage_tosql(uint32 guild_id, struct guild_storage *p);
  1641.  
  1642.  #endif /* _INT_STORAGE_SQL_H_ */
  1643. Index: src/char/inter.c
  1644. --- src/char/inter.c Base (BASE)
  1645. +++ src/char/inter.c Locally Modified (Based On LOCAL)
  1646. @@ -135,7 +135,7 @@
  1647.          aFree(msg_table[i]);
  1648.  }
  1649.  /* from pc.c due to @accinfo. any ideas to replace this crap are more than welcome. */
  1650. -const char *job_name(int class_)
  1651. +const char *job_name(short class_)
  1652.  {
  1653.      switch (class_) {
  1654.          case JOB_NOVICE:
  1655. @@ -452,7 +452,7 @@
  1656.  {
  1657.      int u_fd = RFIFOL(fd,2), aid = RFIFOL(fd,6), castergroup = RFIFOL(fd,10);
  1658.      char query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1];
  1659. -    int account_id;
  1660. +    uint32 account_id;
  1661.      char *data;
  1662.  
  1663.      safestrncpy(query, (char *) RFIFOP(fd,14), NAME_LENGTH);
  1664. @@ -481,7 +481,7 @@
  1665.              } else {// more than one, listing... [Dekamaster/Nightroad]
  1666.                  inter_to_fd(fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)Sql_NumRows(sql_handle));
  1667.                  while (SQL_SUCCESS == Sql_NextRow(sql_handle)) {
  1668. -                    int class_;
  1669. +                    short class_;
  1670.                      short base_level, job_level, online;
  1671.                      char name[NAME_LENGTH];
  1672.  
  1673. @@ -568,7 +568,8 @@
  1674.  
  1675.          } else {
  1676.              while (SQL_SUCCESS == Sql_NextRow(sql_handle)) {
  1677. -                int char_id, class_;
  1678. +                uint32 char_id;
  1679. +                short class_;
  1680.                  short char_num, base_level, job_level, online;
  1681.                  char name[NAME_LENGTH];
  1682.  
  1683. @@ -597,7 +598,7 @@
  1684.  }
  1685.  //--------------------------------------------------------
  1686.  // Save registry to sql
  1687. -int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type)
  1688. +int inter_accreg_tosql(uint32 account_id, uint32 char_id, struct accreg *reg, int type)
  1689.  {
  1690.      struct global_reg *r;
  1691.      StringBuf buf;
  1692. @@ -660,7 +661,7 @@
  1693.  }
  1694.  
  1695.  // Load account_reg from sql (type=2)
  1696. -int inter_accreg_fromsql(int account_id,int char_id, struct accreg *reg, int type)
  1697. +int inter_accreg_fromsql(uint32 account_id,uint32 char_id, struct accreg *reg, int type)
  1698.  {
  1699.      struct global_reg *r;
  1700.      char *data;
  1701. @@ -903,7 +904,7 @@
  1702.  }
  1703.  
  1704.  // Send the requested account_reg
  1705. -int mapif_account_reg_reply(int fd,int account_id,int char_id, int type)
  1706. +int mapif_account_reg_reply(int fd,uint32 account_id,uint32 char_id, int type)
  1707.  {
  1708.      struct accreg *reg=accreg_pt;
  1709.      WFIFOHEAD(fd, 13 + 5000);
  1710. @@ -930,7 +931,7 @@
  1711.  }
  1712.  
  1713.  //Request to kick char from a certain map server. [Skotlex]
  1714. -int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
  1715. +int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason)
  1716.  {
  1717.      if (fd >= 0) {
  1718.          WFIFOHEAD(fd,7);
  1719. @@ -1142,21 +1143,23 @@
  1720.      return 1;
  1721.  }
  1722.  
  1723. -static void mapif_namechange_ack(int fd, int account_id, int char_id, int type, int flag, char *name)
  1724. +static void mapif_namechange_ack(int fd, uint32 account_id, uint32 char_id, int type, int flag, char *name)
  1725.  {
  1726.      WFIFOHEAD(fd, NAME_LENGTH+13);
  1727.      WFIFOW(fd, 0) = 0x3806;
  1728.      WFIFOL(fd, 2) = account_id;
  1729.      WFIFOL(fd, 6) = char_id;
  1730. -    WFIFOB(fd,10) = type;
  1731. -    WFIFOB(fd,11) = flag;
  1732. +    WFIFOB(fd,10) =(uint8) type;
  1733. +    WFIFOB(fd,11) =(uint8) flag;
  1734.      memcpy(WFIFOP(fd, 12), name, NAME_LENGTH);
  1735.      WFIFOSET(fd, NAME_LENGTH+13);
  1736.  }
  1737.  
  1738.  int mapif_parse_NameChangeRequest(int fd)
  1739.  {
  1740. -    int account_id, char_id, type;
  1741. +    uint32 account_id;
  1742. +    uint32 char_id;
  1743. +    uint8 type;
  1744.      char *name;
  1745.      int i;
  1746.  
  1747. Index: src/char/inter.h
  1748. --- src/char/inter.h Base (BASE)
  1749. +++ src/char/inter.h Locally Modified (Based On LOCAL)
  1750. @@ -12,7 +12,7 @@
  1751.  int inter_parse_frommap(int fd);
  1752.  int inter_mapif_init(int fd);
  1753.  int mapif_send_gmaccounts(void);
  1754. -int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason);
  1755. +int mapif_disconnectplayer(int fd, uint32 account_id, uint32 char_id, int reason);
  1756.  
  1757.  int inter_log(char *fmt,...);
  1758.  
  1759. @@ -25,6 +25,6 @@
  1760.  
  1761.  extern char main_chat_nick[16];
  1762.  
  1763. -int inter_accreg_tosql(int account_id, int char_id, struct accreg *reg, int type);
  1764. +int inter_accreg_tosql(uint32 account_id, uint32 char_id, struct accreg *reg, int type);
  1765.  
  1766.  #endif /* _INTER_SQL_H_ */
  1767. Index: src/common/core.c
  1768. --- src/common/core.c Base (BASE)
  1769. +++ src/common/core.c Locally Modified (Based On LOCAL)
  1770. @@ -181,20 +181,22 @@
  1771.          const char *postfix = "/"EXPAND_AND_QUOTE(SVNNODEPATH)")"; // there should exist only 1 entry like this
  1772.          size_t prefix_len = strlen(prefix);
  1773.          size_t postfix_len = strlen(postfix);
  1774. -        size_t i,j,len;
  1775. +        size_t i,j, slen;
  1776. +        long int len;
  1777.          char *buffer;
  1778.  
  1779.          // read file to buffer
  1780.          fseek(fp, 0, SEEK_END);
  1781.          len = ftell(fp);
  1782. -        buffer = (char *)aMalloc(len + 1);
  1783. +        slen = sizeof(len);
  1784. +        buffer = (char *)aMalloc(slen + 1);
  1785.          fseek(fp, 0, SEEK_SET);
  1786. -        len = fread(buffer, 1, len, fp);
  1787. -        buffer[len] = '\0';
  1788. +        slen = fread(buffer, 1, slen, fp);
  1789. +        buffer[slen] = '\0';
  1790.          fclose(fp);
  1791.  
  1792.          // parse buffer
  1793. -        for (i = prefix_len + 1; i + postfix_len <= len; ++i) {
  1794. +        for (i = prefix_len + 1; i + postfix_len <= slen; ++i) {
  1795.              if (buffer[i] != postfix[0] || memcmp(buffer + i, postfix, postfix_len) != 0)
  1796.                  continue; // postfix missmatch
  1797.              for (j = i; j > 0; --j) {
  1798. Index: src/common/grfio.c
  1799. --- src/common/grfio.c Base (BASE)
  1800. +++ src/common/grfio.c Locally Modified (Based On LOCAL)
  1801. @@ -198,7 +198,7 @@
  1802.      scycle = 7;
  1803.  
  1804.      // so decrypt/de-shuffle periodically
  1805. -    j = -1; // 0, adjusted to fit the ++j step
  1806. +    j =(size_t) -1; // 0, adjusted to fit the ++j step
  1807.      for (i = 20; i < nblocks; ++i) {
  1808.          if (i % dcycle == 0) {
  1809.              // decrypt block
  1810. @@ -414,7 +414,7 @@
  1811.      FILELIST *entry = filelist_find(fname);
  1812.      if (entry == NULL || entry->gentry <= 0) { // LocalFileCheck
  1813.          char lfname[256];
  1814. -        int declen;
  1815. +        unsigned int declen;
  1816.          FILE *in;
  1817.          grfio_localpath_create(lfname, sizeof(lfname), (entry && entry->fnd) ? entry->fnd : fname);
  1818.  
  1819. @@ -443,7 +443,7 @@
  1820.          char *grfname = gentry_table[entry->gentry - 1];
  1821.          FILE *in = fopen(grfname, "rb");
  1822.          if (in != NULL) {
  1823. -            int fsize = entry->srclen_aligned;
  1824. +            unsigned int fsize = entry->srclen_aligned;
  1825.              unsigned char *buf = (unsigned char *)aMalloc(fsize);
  1826.              fseek(in, entry->srcpos, 0);
  1827.              if (fread(buf, 1, fsize, in) != fsize) ShowError("An error occured in fread in grfio_reads, grfname=%s\n",grfname);
  1828. @@ -513,7 +513,8 @@
  1829.  /// @param gentry index of the grf file name in the gentry_table
  1830.  static int grfio_entryread(const char *grfname, int gentry)
  1831.  {
  1832. -    long grf_size,list_size;
  1833. +    long grf_size;
  1834. +	unsigned int list_size;
  1835.      unsigned char grf_header[0x2e];
  1836.      int entry,entrys,ofs,grf_version;
  1837.      unsigned char *grf_filelist;
  1838. @@ -578,7 +579,7 @@
  1839.  #ifdef  GRFIO_LOCAL
  1840.                  aentry.gentry         = -(gentry+1);    // As Flag for making it a negative number carrying out the first time LocalFileCheck
  1841.  #else
  1842. -                aentry.gentry         = gentry+1;       // With no first time LocalFileCheck
  1843. +                aentry.gentry         =(char) gentry+1;       // With no first time LocalFileCheck
  1844.  #endif
  1845.                  filelist_modify(&aentry);
  1846.              }
  1847. @@ -630,13 +631,13 @@
  1848.                  aentry.srclen_aligned = getlong(grf_filelist+ofs2+4);
  1849.                  aentry.declen         = getlong(grf_filelist+ofs2+8);
  1850.                  aentry.srcpos         = getlong(grf_filelist+ofs2+13)+0x2e;
  1851. -                aentry.type           = type;
  1852. +                aentry.type           =(char) type;
  1853.                  safestrncpy(aentry.fn, fname, sizeof(aentry.fn));
  1854.                  aentry.fnd            = NULL;
  1855.  #ifdef  GRFIO_LOCAL
  1856.                  aentry.gentry         = -(gentry+1);    // As Flag for making it a negative number carrying out the first time LocalFileCheck
  1857.  #else
  1858. -                aentry.gentry         = gentry+1;       // With no first time LocalFileCheck
  1859. +                aentry.gentry         =(char) gentry+1;       // With no first time LocalFileCheck
  1860.  #endif
  1861.                  filelist_modify(&aentry);
  1862.              }
  1863. Index: src/common/malloc.c
  1864. --- src/common/malloc.c Base (BASE)
  1865. +++ src/common/malloc.c Locally Modified (Based On LOCAL)
  1866. @@ -208,8 +208,7 @@
  1867.      if (size <= BLOCK_DATA_SIZE1) {
  1868.          return (unsigned short)(size + BLOCK_ALIGNMENT1 - 1) / BLOCK_ALIGNMENT1;
  1869.      } else if (size <= BLOCK_DATA_SIZE) {
  1870. -        return (unsigned short)(size - BLOCK_DATA_SIZE1 + BLOCK_ALIGNMENT2 - 1) / BLOCK_ALIGNMENT2
  1871. -               + BLOCK_DATA_COUNT1;
  1872. +        return (unsigned short)( (size - BLOCK_DATA_SIZE1 + BLOCK_ALIGNMENT2 - 1) / BLOCK_ALIGNMENT2 + BLOCK_DATA_COUNT1);
  1873.      } else {
  1874.          return 0xffff;  // �u���b�N���ⴂ���ꍇ�� hash �ɂ��Ȃ�
  1875.      }
  1876. @@ -227,7 +226,7 @@
  1877.  void *_mmalloc(size_t size, const char *file, int line, const char *func)
  1878.  {
  1879.      struct block *block;
  1880. -    short size_hash = size2hash(size);
  1881. +    unsigned short size_hash = size2hash(size);
  1882.      struct unit_head *head;
  1883.  
  1884.      if (((long) size) < 0) {
  1885. @@ -249,7 +248,7 @@
  1886.              p->unit_head.block = NULL;
  1887.              p->unit_head.size  = 0;
  1888.              p->unit_head.file  = file;
  1889. -            p->unit_head.line  = line;
  1890. +            p->unit_head.line  =(unsigned short) line;
  1891.              p->prev = NULL;
  1892.              if (unit_head_large_first == NULL)
  1893.                  p->next = NULL;
  1894. @@ -318,7 +317,7 @@
  1895.  
  1896.      head->block = block;
  1897.      head->file  = file;
  1898. -    head->line  = line;
  1899. +    head->line  = (unsigned short)line;
  1900.      head->size  = (unsigned short)size;
  1901.      *(long *)((char *)head + sizeof(struct unit_head) - sizeof(long) + size) = 0xdeadbeaf;
  1902.      return (char *)head + sizeof(struct unit_head) - sizeof(long);
  1903. @@ -415,7 +414,7 @@
  1904.  #ifdef DEBUG_MEMMGR
  1905.              memset(ptr, 0xfd, block->unit_size - sizeof(struct unit_head) + sizeof(long));
  1906.              head->file = file;
  1907. -            head->line = line;
  1908. +            head->line = (unsigned short) line;
  1909.  #endif
  1910.              memmgr_assert(block->unit_used > 0);
  1911.              if (--block->unit_used == 0) {
  1912. @@ -484,7 +483,7 @@
  1913.      p->unfill_next  = NULL;
  1914.      p->unit_size    = (unsigned short)(hash2size(hash) + sizeof(struct unit_head));
  1915.      p->unit_hash    = hash;
  1916. -    p->unit_count   = BLOCK_DATA_SIZE / p->unit_size;
  1917. +    p->unit_count   = (unsigned short) (BLOCK_DATA_SIZE / p->unit_size);
  1918.      p->unit_used    = 0;
  1919.      p->unit_unfill  = 0xFFFF;
  1920.      p->unit_maxused = 0;
  1921. Index: src/common/mapindex.c
  1922. --- src/common/mapindex.c Base (BASE)
  1923. +++ src/common/mapindex.c Locally Modified (Based On LOCAL)
  1924. @@ -117,7 +117,7 @@
  1925.  unsigned short mapindex_name2id(const char *name)
  1926.  {
  1927.      //TODO: Perhaps use a db to speed this up? [Skotlex]
  1928. -    int i;
  1929. +    unsigned short i;
  1930.  
  1931.      char map_name[MAP_NAME_LENGTH];
  1932.      mapindex_getmapname(name, map_name);
  1933. Index: src/common/mmo.h
  1934. --- src/common/mmo.h Base (BASE)
  1935. +++ src/common/mmo.h Locally Modified (Based On LOCAL)
  1936. @@ -229,7 +229,8 @@
  1937.  
  1938.  //Holds array of global registries, used by the char server and converter.
  1939.  struct accreg {
  1940. -    int account_id, char_id;
  1941. +    uint32 account_id;
  1942. +    uint32 char_id;
  1943.      int reg_num;
  1944.      struct global_reg reg[MAX_REG_NUM];
  1945.  };
  1946. @@ -247,16 +248,16 @@
  1947.  
  1948.  struct guild_storage {
  1949.      int dirty;
  1950. -    int guild_id;
  1951. +    uint32 guild_id;
  1952.      short storage_status;
  1953.      short storage_amount;
  1954.      struct item items[MAX_GUILD_STORAGE];
  1955.  };
  1956.  
  1957.  struct s_pet {
  1958. -    int account_id;
  1959. -    int char_id;
  1960. -    int pet_id;
  1961. +    uint32 account_id;
  1962. +    uint32 char_id;
  1963. +    uint32 pet_id;
  1964.      short class_;
  1965.      short level;
  1966.      short egg_id;//pet egg id
  1967. @@ -270,8 +271,8 @@
  1968.  
  1969.  struct s_homunculus {   //[orn]
  1970.      char name[NAME_LENGTH];
  1971. -    int hom_id;
  1972. -    int char_id;
  1973. +    uint32 hom_id;
  1974. +    uint32 char_id;
  1975.      short class_;
  1976.      short prev_class;
  1977.      int hp,max_hp,sp,max_sp;
  1978. @@ -283,17 +284,12 @@
  1979.      unsigned int exp;
  1980.      short rename_flag;
  1981.      short vaporize; //albator
  1982. -    int str ;
  1983. -    int agi ;
  1984. -    int vit ;
  1985. -    int int_ ;
  1986. -    int dex ;
  1987. -    int luk ;
  1988. +    unsigned short str, agi, vit, int_, dex, luk;
  1989.  };
  1990.  
  1991.  struct s_mercenary {
  1992. -    int mercenary_id;
  1993. -    int char_id;
  1994. +    uint32 mercenary_id;
  1995. +    uint32 char_id;
  1996.      short class_;
  1997.      int hp, sp;
  1998.      unsigned int kill_count;
  1999. @@ -301,17 +297,18 @@
  2000.  };
  2001.  
  2002.  struct s_elemental {
  2003. -    int elemental_id;
  2004. -    int char_id;
  2005. +    uint32 elemental_id;
  2006. +    uint32 char_id;
  2007.      short class_;
  2008.      int mode;
  2009. -    int hp, sp, max_hp, max_sp, str, agi, vit, int_, dex, luk;
  2010. -    int life_time;
  2011. +    unsigned int hp, sp, max_hp, max_sp;
  2012. +    unsigned short str, agi, vit, int_, dex, luk;
  2013. +    unsigned int life_time;
  2014.  };
  2015.  
  2016.  struct s_friend {
  2017. -    int account_id;
  2018. -    int char_id;
  2019. +    uint32 account_id;
  2020. +    uint32 char_id;
  2021.      char name[NAME_LENGTH];
  2022.  };
  2023.  
  2024. @@ -324,8 +321,8 @@
  2025.  #endif
  2026.  
  2027.  struct mmo_charstatus {
  2028. -    int char_id;
  2029. -    int account_id;
  2030. +    uint32 char_id;
  2031. +    uint32 account_id;
  2032.      int partner_id;
  2033.      int father;
  2034.      int mother;
  2035. @@ -341,7 +338,7 @@
  2036.      short manner;
  2037.      unsigned char karma;
  2038.      short hair,hair_color,clothes_color;
  2039. -    int party_id,guild_id,pet_id,hom_id,mer_id,ele_id;
  2040. +    uint32 party_id,guild_id,pet_id,hom_id,mer_id,ele_id;
  2041.      int fame;
  2042.  
  2043.      // Mercenary Guilds Rank
  2044. @@ -355,9 +352,10 @@
  2045.      short robe;
  2046.  
  2047.      char name[NAME_LENGTH];
  2048. -    unsigned int base_level,job_level;
  2049. +    uint16 base_level,job_level;
  2050.      short str,agi,vit,int_,dex,luk;
  2051. -    unsigned char slot,sex;
  2052. +    unsigned char slot;
  2053. +    uint8 sex;
  2054.  
  2055.      uint32 mapip;
  2056.      uint16 mapport;
  2057. @@ -434,8 +432,8 @@
  2058.  };
  2059.  
  2060.  struct party_member {
  2061. -    int account_id;
  2062. -    int char_id;
  2063. +    uint32 account_id;
  2064. +    uint32 char_id;
  2065.      char name[NAME_LENGTH];
  2066.      unsigned short class_;
  2067.      unsigned short map;
  2068. @@ -455,7 +453,8 @@
  2069.  
  2070.  struct map_session_data;
  2071.  struct guild_member {
  2072. -    int account_id, char_id;
  2073. +    uint32 account_id;
  2074. +    uint32 char_id;
  2075.      short hair,hair_color,gender,class_,lv;
  2076.      uint64 exp;
  2077.      int exp_payper;
  2078. @@ -474,14 +473,14 @@
  2079.  
  2080.  struct guild_alliance {
  2081.      int opposition;
  2082. -    int guild_id;
  2083. +    uint32 guild_id;
  2084.      char name[NAME_LENGTH];
  2085.  };
  2086.  
  2087.  struct guild_expulsion {
  2088.      char name[NAME_LENGTH];
  2089.      char mes[40];
  2090. -    int account_id;
  2091. +    uint32 account_id;
  2092.  };
  2093.  
  2094.  struct guild_skill {
  2095. @@ -489,7 +488,7 @@
  2096.  };
  2097.  
  2098.  struct guild {
  2099. -    int guild_id;
  2100. +    uint32 guild_id;
  2101.      short guild_lv, connect_member, max_member, average_lv;
  2102.      uint64 exp;
  2103.      unsigned int next_exp;
  2104. @@ -512,7 +511,7 @@
  2105.      int mapindex;
  2106.      char castle_name[NAME_LENGTH];
  2107.      char castle_event[NAME_LENGTH];
  2108. -    int guild_id;
  2109. +    uint32 guild_id;
  2110.      int economy;
  2111.      int defense;
  2112.      int triggerE;
  2113. Index: src/common/socket.c
  2114. --- src/common/socket.c Base (BASE)
  2115. +++ src/common/socket.c Locally Modified (Based On LOCAL)
  2116. @@ -18,6 +18,9 @@
  2117.  #include "../common/winapi.h"
  2118.  #else
  2119.  #include <errno.h>
  2120. +#ifdef __linux__
  2121. +        #include <sys/select.h>
  2122. +#endif
  2123.  #include <sys/socket.h>
  2124.  #include <netinet/in.h>
  2125.  #include <netinet/tcp.h>
  2126. Index: src/common/socket.h
  2127. --- src/common/socket.h Base (BASE)
  2128. +++ src/common/socket.h Locally Modified (Based On LOCAL)
  2129. @@ -73,9 +73,9 @@
  2130.  
  2131.  struct socket_data {
  2132.      struct {
  2133. -        unsigned char eof : 1;
  2134. -        unsigned char server : 1;
  2135. -        unsigned char ping : 2;
  2136. +        int eof : 1;
  2137. +        int server : 1;
  2138. +        int ping : 2;
  2139.      } flag;
  2140.  
  2141.      uint32 client_addr; // remote client address
  2142. Index: src/login/account.h
  2143. --- src/login/account.h Base (BASE)
  2144. +++ src/login/account.h Locally Modified (Based On LOCAL)
  2145. @@ -35,12 +35,12 @@
  2146.  
  2147.  
  2148.  struct mmo_account {
  2149. -    int account_id;
  2150. +    uint32 account_id;
  2151.      char userid[NAME_LENGTH];
  2152.      char pass[32+1];        // 23+1 for plaintext, 32+1 for md5-ed passwords
  2153. -    char sex;               // gender (M/F/S)
  2154. +    uint8 sex;               // gender (M/F/S)
  2155.      char email[40];         // e-mail (by default: a@a.com)
  2156. -    int group_id;           // player group id
  2157. +    uint8 group_id;           // player group id
  2158.      unsigned int state;     // packet 0x006a value + 1 (0: compte OK)
  2159.      time_t unban_time;      // (timestamp): ban time limit of the account (0 = no ban)
  2160.      time_t expiration_time; // (timestamp): validity limit of the account (0 = unlimited)
  2161. @@ -116,7 +116,7 @@
  2162.      /// @param self Database
  2163.      /// @param account_id Account id
  2164.      /// @return true if successful
  2165. -    bool (*remove)(AccountDB *self, const int account_id);
  2166. +    bool (*remove)(AccountDB *self, const uint32 account_id);
  2167.  
  2168.      /// Modifies the data of an existing account.
  2169.      /// Uses acc->account_id to identify the account.
  2170. @@ -132,7 +132,7 @@
  2171.      /// @param acc Pointer that receives the account data
  2172.      /// @param account_id Target account id
  2173.      /// @return true if successful
  2174. -    bool (*load_num)(AccountDB *self, struct mmo_account *acc, const int account_id);
  2175. +    bool (*load_num)(AccountDB *self, struct mmo_account *acc, const uint32 account_id);
  2176.  
  2177.      /// Finds an account with userid and copies it to acc.
  2178.      ///
  2179. Index: src/login/account_sql.c
  2180. --- src/login/account_sql.c Base (BASE)
  2181. +++ src/login/account_sql.c Locally Modified (Based On LOCAL)
  2182. @@ -55,15 +55,15 @@
  2183.  static bool account_db_sql_get_property(AccountDB *self, const char *key, char *buf, size_t buflen);
  2184.  static bool account_db_sql_set_property(AccountDB *self, const char *option, const char *value);
  2185.  static bool account_db_sql_create(AccountDB *self, struct mmo_account *acc);
  2186. -static bool account_db_sql_remove(AccountDB *self, const int account_id);
  2187. +static bool account_db_sql_remove(AccountDB *self, const uint32 account_id);
  2188.  static bool account_db_sql_save(AccountDB *self, const struct mmo_account *acc);
  2189. -static bool account_db_sql_load_num(AccountDB *self, struct mmo_account *acc, const int account_id);
  2190. +static bool account_db_sql_load_num(AccountDB *self, struct mmo_account *acc, const uint32 account_id);
  2191.  static bool account_db_sql_load_str(AccountDB *self, struct mmo_account *acc, const char *userid);
  2192.  static AccountDBIterator *account_db_sql_iterator(AccountDB *self);
  2193.  static void account_db_sql_iter_destroy(AccountDBIterator *self);
  2194.  static bool account_db_sql_iter_next(AccountDBIterator *self, struct mmo_account *acc);
  2195.  
  2196. -static bool mmo_auth_fromsql(AccountDB_SQL *db, struct mmo_account *acc, int account_id);
  2197. +static bool mmo_auth_fromsql(AccountDB_SQL *db, struct mmo_account *acc, uint32 account_id);
  2198.  static bool mmo_auth_tosql(AccountDB_SQL *db, const struct mmo_account *acc, bool is_new);
  2199.  
  2200.  /// public constructor
  2201. @@ -279,7 +279,7 @@
  2202.          else if (strcmpi(key, "codepage") == 0)
  2203.              safestrncpy(db->codepage, value, sizeof(db->codepage));
  2204.          else if (strcmpi(key, "case_sensitive") == 0)
  2205. -            db->case_sensitive = config_switch(value);
  2206. +            db->case_sensitive =(bool) config_switch(value);
  2207.          else if (strcmpi(key, "account_db") == 0)
  2208.              safestrncpy(db->account_db, value, sizeof(db->account_db));
  2209.          else if (strcmpi(key, "accreg_db") == 0)
  2210. @@ -301,7 +301,7 @@
  2211.      Sql *sql_handle = db->accounts;
  2212.  
  2213.      // decide on the account id to assign
  2214. -    int account_id;
  2215. +    uint32 account_id;
  2216.      if (acc->account_id != -1) {
  2217.          // caller specifies it manually
  2218.          account_id = acc->account_id;
  2219. @@ -343,7 +343,7 @@
  2220.  }
  2221.  
  2222.  /// delete an existing account entry + its regs
  2223. -static bool account_db_sql_remove(AccountDB *self, const int account_id)
  2224. +static bool account_db_sql_remove(AccountDB *self, const uint32 account_id)
  2225.  {
  2226.      AccountDB_SQL *db = (AccountDB_SQL *)self;
  2227.      Sql *sql_handle = db->accounts;
  2228. @@ -369,7 +369,7 @@
  2229.  }
  2230.  
  2231.  /// retrieve data from db and store it in the provided data structure
  2232. -static bool account_db_sql_load_num(AccountDB *self, struct mmo_account *acc, const int account_id)
  2233. +static bool account_db_sql_load_num(AccountDB *self, struct mmo_account *acc, const uint32 account_id)
  2234.  {
  2235.      AccountDB_SQL *db = (AccountDB_SQL *)self;
  2236.      return mmo_auth_fromsql(db, acc, account_id);
  2237. @@ -381,7 +381,7 @@
  2238.      AccountDB_SQL *db = (AccountDB_SQL *)self;
  2239.      Sql *sql_handle = db->accounts;
  2240.      char esc_userid[2*NAME_LENGTH+1];
  2241. -    int account_id;
  2242. +    uint32 account_id;
  2243.      char *data;
  2244.  
  2245.      Sql_EscapeString(sql_handle, esc_userid, userid);
  2246. @@ -445,7 +445,7 @@
  2247.      AccountDBIterator_SQL *iter = (AccountDBIterator_SQL *)self;
  2248.      AccountDB_SQL *db = (AccountDB_SQL *)iter->db;
  2249.      Sql *sql_handle = db->accounts;
  2250. -    int account_id;
  2251. +    uint32 account_id;
  2252.      char *data;
  2253.  
  2254.      // get next account ID
  2255. @@ -471,7 +471,7 @@
  2256.  }
  2257.  
  2258.  
  2259. -static bool mmo_auth_fromsql(AccountDB_SQL *db, struct mmo_account *acc, int account_id)
  2260. +static bool mmo_auth_fromsql(AccountDB_SQL *db, struct mmo_account *acc, uint32 account_id)
  2261.  {
  2262.      Sql *sql_handle = db->accounts;
  2263.      char *data;
  2264. Index: src/login/login.c
  2265. --- src/login/login.c Base (BASE)
  2266. +++ src/login/login.c Locally Modified (Based On LOCAL)
  2267. @@ -73,16 +73,16 @@
  2268.  
  2269.  struct auth_node {
  2270.  
  2271. -    int account_id;
  2272. +    uint32 account_id;
  2273.      uint32 login_id1;
  2274.      uint32 login_id2;
  2275.      uint32 ip;
  2276. -    char sex;
  2277. +    uint8 sex;
  2278.      uint32 version;
  2279.      uint8 clienttype;
  2280.  };
  2281.  
  2282. -static DBMap *auth_db; // int account_id -> struct auth_node*
  2283. +static DBMap *auth_db; // uint32 account_id -> struct auth_node*
  2284.  
  2285.  
  2286.  //-----------------------------------------------------
  2287. @@ -90,12 +90,12 @@
  2288.  //-----------------------------------------------------
  2289.  struct online_login_data {
  2290.  
  2291. -    int account_id;
  2292. +    uint32 account_id;
  2293.      int waiting_disconnect;
  2294.      int char_server;
  2295.  };
  2296.  
  2297. -static DBMap *online_db; // int account_id -> struct online_login_data*
  2298. +static DBMap *online_db; // uint32 account_id -> struct online_login_data*
  2299.  static int waiting_disconnect_timer(int tid, unsigned int tick, int id, intptr_t data);
  2300.  
  2301.  /**
  2302. @@ -111,7 +111,7 @@
  2303.      return db_ptr2data(p);
  2304.  }
  2305.  
  2306. -struct online_login_data *add_online_user(int char_server, int account_id) {
  2307. +struct online_login_data *add_online_user(int char_server, uint32 account_id) {
  2308.      struct online_login_data *p;
  2309.      p = idb_ensure(online_db, account_id, create_online_user);
  2310.      p->char_server = char_server;
  2311. @@ -122,7 +122,7 @@
  2312.      return p;
  2313.  }
  2314.  
  2315. -void remove_online_user(int account_id)
  2316. +void remove_online_user(uint32 account_id)
  2317.  {
  2318.      struct online_login_data *p;
  2319.      p = (struct online_login_data *)idb_get(online_db, account_id);
  2320. @@ -428,12 +428,12 @@
  2321.                  {
  2322.                      struct auth_node *node;
  2323.  
  2324. -                    int account_id = RFIFOL(fd,2);
  2325. +                    uint32 account_id = RFIFOL(fd,2);
  2326.                      uint32 login_id1 = RFIFOL(fd,6);
  2327.                      uint32 login_id2 = RFIFOL(fd,10);
  2328.                      uint8 sex = RFIFOB(fd,14);
  2329.                      //uint32 ip_ = ntohl(RFIFOL(fd,15));
  2330. -                    int request_id = RFIFOL(fd,19);
  2331. +                    uint32 request_id = RFIFOL(fd,19);
  2332.                      RFIFOSKIP(fd,23);
  2333.  
  2334.                      node = (struct auth_node *)idb_get(auth_db, account_id);
  2335. @@ -503,7 +503,7 @@
  2336.                      struct mmo_account acc;
  2337.                      char email[40];
  2338.  
  2339. -                    int account_id = RFIFOL(fd,2);
  2340. +                    uint32 account_id = RFIFOL(fd,2);
  2341.                      safestrncpy(email, (char *)RFIFOP(fd,6), 40);
  2342.                      remove_control_chars(email);
  2343.                      RFIFOSKIP(fd,46);
  2344. @@ -528,10 +528,10 @@
  2345.                      struct mmo_account acc;
  2346.                      time_t expiration_time = 0;
  2347.                      char email[40] = "";
  2348. -                    int group_id = 0;
  2349. +                    uint8 group_id = 0;
  2350.                      char birthdate[10+1] = "";
  2351.  
  2352. -                    int account_id = RFIFOL(fd,2);
  2353. +                    uint32 account_id = RFIFOL(fd,2);
  2354.                      RFIFOSKIP(fd,6);
  2355.  
  2356.                      if (!accounts->load_num(accounts, &acc, account_id))
  2357. @@ -571,7 +571,7 @@
  2358.                      char actual_email[40];
  2359.                      char new_email[40];
  2360.  
  2361. -                    int account_id = RFIFOL(fd,2);
  2362. +                    uint32 account_id = RFIFOL(fd,2);
  2363.                      safestrncpy(actual_email, (char *)RFIFOP(fd,6), 40);
  2364.                      safestrncpy(new_email, (char *)RFIFOP(fd,46), 40);
  2365.                      RFIFOSKIP(fd, 86);
  2366. @@ -601,7 +601,7 @@
  2367.                  {
  2368.                      struct mmo_account acc;
  2369.  
  2370. -                    int account_id = RFIFOL(fd,2);
  2371. +                    uint32 account_id = RFIFOL(fd,2);
  2372.                      unsigned int state = RFIFOL(fd,6);
  2373.                      RFIFOSKIP(fd,10);
  2374.  
  2375. @@ -635,7 +635,7 @@
  2376.                  {
  2377.                      struct mmo_account acc;
  2378.  
  2379. -                    int account_id = RFIFOL(fd,2);
  2380. +                    uint32 account_id = RFIFOL(fd,2);
  2381.                      int year = (short)RFIFOW(fd,6);
  2382.                      int month = (short)RFIFOW(fd,8);
  2383.                      int mday = (short)RFIFOW(fd,10);
  2384. @@ -692,7 +692,7 @@
  2385.                  {
  2386.                      struct mmo_account acc;
  2387.  
  2388. -                    int account_id = RFIFOL(fd,2);
  2389. +                    uint32 account_id = RFIFOL(fd,2);
  2390.                      RFIFOSKIP(fd,6);
  2391.  
  2392.                      if (!accounts->load_num(accounts, &acc, account_id))
  2393. @@ -724,7 +724,7 @@
  2394.                  {
  2395.                      struct mmo_account acc;
  2396.  
  2397. -                    int account_id = RFIFOL(fd,4);
  2398. +                    uint32 account_id = RFIFOL(fd,4);
  2399.  
  2400.                      if (!accounts->load_num(accounts, &acc, account_id))
  2401.                          ShowStatus("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d not found, ip: %s).\n", server[id].name, account_id, ip);
  2402. @@ -761,7 +761,7 @@
  2403.                  {
  2404.                      struct mmo_account acc;
  2405.  
  2406. -                    int account_id = RFIFOL(fd,2);
  2407. +                    uint32 account_id = RFIFOL(fd,2);
  2408.                      RFIFOSKIP(fd,6);
  2409.  
  2410.                      if (!accounts->load_num(accounts, &acc, account_id))
  2411. @@ -819,8 +819,8 @@
  2412.                      struct mmo_account acc;
  2413.                      size_t off;
  2414.  
  2415. -                    int account_id = RFIFOL(fd,2);
  2416. -                    int char_id = RFIFOL(fd,6);
  2417. +                    uint32 account_id = RFIFOL(fd,2);
  2418. +                    uint32 char_id = RFIFOL(fd,6);
  2419.                      RFIFOSKIP(fd,10);
  2420.  
  2421.                      WFIFOHEAD(fd,ACCOUNT_REG2_NUM*sizeof(struct global_reg));
  2422. Index: src/login/login.h
  2423. --- src/login/login.h Base (BASE)
  2424. +++ src/login/login.h Locally Modified (Based On LOCAL)
  2425. @@ -20,10 +20,10 @@
  2426.  #define PASSWORDENC 3
  2427.  
  2428.  struct login_session_data {
  2429. -    int account_id;
  2430. -    long login_id1;
  2431. -    long login_id2;
  2432. -    char sex;// 'F','M','S'
  2433. +    uint32 account_id;
  2434. +    uint32 login_id1;
  2435. +    uint32 login_id2;
  2436. +    uint8 sex;// 'F','M','S'
  2437.  
  2438.      char userid[NAME_LENGTH];
  2439.      char passwd[32+1]; // 23+1 for plaintext, 32+1 for md5-ed passwords
  2440. @@ -54,7 +54,7 @@
  2441.  };
  2442.  
  2443.  struct client_hash_node {
  2444. -    int group_id;
  2445. +    uint8 group_id;
  2446.      uint8 hash[16];
  2447.      struct client_hash_node *next;
  2448.  };
  2449. @@ -71,7 +71,7 @@
  2450.      bool new_account_flag,new_acc_length_limit;     // autoregistration via _M/_F ? / if yes minimum length is 4?
  2451.      int start_limited_time;                         // new account expiration time (-1: unlimited)
  2452.      bool use_md5_passwds;                           // work with password hashes instead of plaintext passwords?
  2453. -    int group_id_to_connect;                        // required group id to connect
  2454. +    int8 group_id_to_connect;                        // required group id to connect
  2455.      int min_group_id_to_connect;                    // minimum group id to connect
  2456.      bool check_client_version;                      // check the clientversion set in the clientinfo ?
  2457.      uint32 client_version_to_connect;               // the client version needed to connect (if checking is enabled)
  2458. Index: src/map/atcommand.c
  2459. --- src/map/atcommand.c Base (BASE)
  2460. +++ src/map/atcommand.c Locally Modified (Based On LOCAL)
  2461. @@ -271,7 +271,7 @@
  2462.              len=SHRT_MAX-4; // maximum length
  2463.              off=4;
  2464.          }
  2465. -        WFIFOHEAD(fd, len);
  2466. +        WFIFOHEAD(fd, sizeof(len));
  2467.          WFIFOW(fd,0)=TOW(type);
  2468.  
  2469.          // parse packet contents
  2470. @@ -415,7 +415,7 @@
  2471.                  // terminate the string
  2472.                  if (off < end) {
  2473.                      // fill the rest with 0's
  2474. -                    memset(WFIFOP(fd,off),0,end-off);
  2475. +                    memset(WFIFOP(fd,off),0,sizeof(end)-sizeof(off));
  2476.                      off=end;
  2477.                  }
  2478.              } else {
  2479. @@ -429,12 +429,12 @@
  2480.          if (packet_db[sd->packet_ver][type].len == -1) {
  2481.              // send dynamic packet
  2482.              WFIFOW(fd,2)=TOW(off);
  2483. -            WFIFOSET(fd,off);
  2484. +            WFIFOSET(fd,sizeof(off));
  2485.          } else {
  2486.              // send static packet
  2487.              if (off < len)
  2488. -                memset(WFIFOP(fd,off),0,len-off);
  2489. -            WFIFOSET(fd,len);
  2490. +                memset(WFIFOP(fd,off),0,sizeof(len)-sizeof(off));
  2491. +            WFIFOSET(fd,sizeof(len));
  2492.          }
  2493.      } else {
  2494.          clif_displaymessage(fd, msg_txt(259)); // Invalid packet
  2495. @@ -457,7 +457,7 @@
  2496.      char map_name[MAP_NAME_LENGTH_EXT];
  2497.      unsigned short mapindex;
  2498.      short x = 0, y = 0;
  2499. -    int m = -1;
  2500. +    short m = -1;
  2501.  
  2502.      nullpo_retr(-1, sd);
  2503.  
  2504. @@ -629,7 +629,7 @@
  2505.       * 3 = @who3 : [CID/AID] Player name [Title], Map, X, Y
  2506.       */
  2507.      int display_type = 1;
  2508. -    int map_id = -1;
  2509. +    short map_id = -1;
  2510.  
  2511.      nullpo_retr(-1, sd);
  2512.  
  2513. @@ -736,7 +736,7 @@
  2514.      if (sscanf(message, "%199[^\n]", match_text) < 1)
  2515.          strcpy(match_text, "");
  2516.      for (j = 0; match_text[j]; j++)
  2517. -        match_text[j] = TOLOWER(match_text[j]);
  2518. +        match_text[j] =(char) TOLOWER(match_text[j]);
  2519.  
  2520.      count = 0;
  2521.      level = pc_get_group_level(sd);
  2522. @@ -750,7 +750,7 @@
  2523.          if (match_text[0]) {
  2524.              memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
  2525.              for (j = 0; player_name[j]; j++)
  2526. -                player_name[j] = TOLOWER(player_name[j]);
  2527. +                player_name[j] =(char) TOLOWER(player_name[j]);
  2528.              // search with no case sensitive
  2529.              if (strstr(player_name, match_text) == NULL)
  2530.                  continue;
  2531. @@ -820,7 +820,7 @@
  2532.   *------------------------------------------*/
  2533.  ACMD_FUNC(load)
  2534.  {
  2535. -    int m;
  2536. +    short m;
  2537.  
  2538.      nullpo_retr(-1, sd);
  2539.  
  2540. @@ -845,19 +845,19 @@
  2541.   *------------------------------------------*/
  2542.  ACMD_FUNC(speed)
  2543.  {
  2544. -    int speed;
  2545. +    unsigned short speed;
  2546.  
  2547.      nullpo_retr(-1, sd);
  2548.  
  2549.      memset(atcmd_output, '\0', sizeof(atcmd_output));
  2550.  
  2551. -    if (!message || !*message || sscanf(message, "%d", &speed) < 1) {
  2552. +    if (!message || !*message || sscanf(message, "%hui", &speed) < 1) {
  2553.          sprintf(atcmd_output, msg_txt(918), MIN_WALK_SPEED, MAX_WALK_SPEED); // Please enter a speed value (usage: @speed <%d-%d>).
  2554.          clif_displaymessage(fd, atcmd_output);
  2555.          return -1;
  2556.      }
  2557.  
  2558. -    sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
  2559. +    sd->base_status.speed =(unsigned short) cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
  2560.      status_calc_bl(&sd->bl, SCB_SPEED);
  2561.      clif_displaymessage(fd, msg_txt(8)); // Speed changed.
  2562.      return 0;
  2563. @@ -920,10 +920,11 @@
  2564.   *------------------------------------------*/
  2565.  ACMD_FUNC(option)
  2566.  {
  2567. -    int param1 = 0, param2 = 0, param3 = 0;
  2568. +    unsigned short param1 = 0, param2 = 0;
  2569. +    int param3 = 0;
  2570.      nullpo_retr(-1, sd);
  2571.  
  2572. -    if (!message || !*message || sscanf(message, "%d %d %d", &param1, &param2, &param3) < 1 || param1 < 0 || param2 < 0 || param3 < 0) {
  2573. +    if (!message || !*message || sscanf(message, "%hu %hu %d", &param1, &param2, &param3) < 1 || param1 < 0 || param2 < 0 || param3 < 0) {
  2574.          // failed to match the parameters so inform the user of the options
  2575.          const char *text = NULL;
  2576.  
  2577. @@ -957,7 +958,7 @@
  2578.  {
  2579.      nullpo_retr(-1, sd);
  2580.      if (sd->sc.option & OPTION_INVISIBLE) {
  2581. -        sd->sc.option &= ~OPTION_INVISIBLE;
  2582. +        sd->sc.option &= ~(sd->sc.option&OPTION_INVISIBLE);
  2583.          if (sd->disguise)
  2584.              status_set_viewdata(&sd->bl, sd->disguise);
  2585.          else
  2586. @@ -1002,7 +1003,8 @@
  2587.      nullpo_retr(-1, sd);
  2588.  
  2589.      if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) {
  2590. -        int i, found = 0;
  2591. +        short i;
  2592. +        char found = 0;
  2593.  
  2594.          for (i = JOB_NOVICE; i < JOB_MAX; ++i) {
  2595.              if (strncmpi(message, job_name(i), 16) == 0) {
  2596. @@ -1092,9 +1094,9 @@
  2597.  
  2598.          sscanf(message, "%199[^\n]", atcmd_output);
  2599.          if (strstr(command, "l") != NULL)
  2600. -            clif_broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, 0, ALL_SAMEMAP);
  2601. +            clif_broadcast(&sd->bl, atcmd_output,(int)strlen(atcmd_output) + 1, 0, ALL_SAMEMAP);
  2602.          else
  2603. -            intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? 0x10 : 0);
  2604. +            intif_broadcast(atcmd_output,(int)strlen(atcmd_output) + 1, (*(command + 5) == 'b' || *(command + 5) == 'B') ? 0x10 : 0);
  2605.      } else {
  2606.          if (!message || !*message || (sscanf(message, "%lx %199[^\n]", &color, atcmd_output) < 2)) {
  2607.              clif_displaymessage(fd, msg_txt(981)); // Please enter color and message (usage: @kamic <color> <message>).
  2608. @@ -1105,7 +1107,7 @@
  2609.              clif_displaymessage(fd, msg_txt(982)); // Invalid color.
  2610.              return -1;
  2611.          }
  2612. -        intif_broadcast2(atcmd_output, strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0);
  2613. +        intif_broadcast2(atcmd_output, (int)strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0);
  2614.      }
  2615.      return 0;
  2616.  }
  2617. @@ -1174,7 +1176,8 @@
  2618.  ACMD_FUNC(item)
  2619.  {
  2620.      char item_name[100];
  2621. -    int number = 0, item_id, flag = 0;
  2622. +    int number = 0, flag = 0;
  2623. +	short item_id;
  2624.      struct item item_tmp;
  2625.      struct item_data *item_data;
  2626.      int get_count, i;
  2627. @@ -1210,7 +1213,7 @@
  2628.          if (!pet_create_egg(sd, item_id)) {
  2629.              memset(&item_tmp, 0, sizeof(item_tmp));
  2630.              item_tmp.nameid = item_id;
  2631. -            item_tmp.identify = 1;
  2632. +            item_tmp.identify = (short) 1;
  2633.  
  2634.              if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
  2635.                  clif_additem(sd, 0, 0, flag);
  2636. @@ -1230,18 +1233,19 @@
  2637.      struct item item_tmp;
  2638.      struct item_data *item_data;
  2639.      char item_name[100];
  2640. -    int item_id, number = 0;
  2641. -    int identify = 0, refine = 0, attr = 0;
  2642. -    int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  2643. +    int number = 0;
  2644. +    short c1 = 0, c2 = 0, c3 = 0, c4 = 0;
  2645.      int flag = 0;
  2646.      int loop, get_count, i;
  2647. +    short item_id;
  2648. +    char identify = 0, refine = 0, attr=0;
  2649.      nullpo_retr(-1, sd);
  2650.  
  2651.      memset(item_name, '\0', sizeof(item_name));
  2652.  
  2653.      if (!message || !*message || (
  2654. -            sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 &&
  2655. -            sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
  2656. +            sscanf(message, "\"%99[^\"]\" %d %c %c %c %hd %hd %hd %hd", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 &&
  2657. +            sscanf(message, "%99s %d %c %c %c %hd %hd %hd %hd", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
  2658.          )) {
  2659.          clif_displaymessage(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity>
  2660.          clif_displaymessage(fd, msg_txt(985)); //   <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4>).
  2661. @@ -1273,7 +1277,8 @@
  2662.                  refine = MAX_REFINE;
  2663.          } else {
  2664.              identify = 1;
  2665. -            refine = attr = 0;
  2666. +            refine = 0;
  2667. +			attr = 0;
  2668.          }
  2669.          for (i = 0; i < loop; i++) {
  2670.              memset(&item_tmp, 0, sizeof(item_tmp));
  2671. @@ -1322,27 +1327,30 @@
  2672.   *------------------------------------------*/
  2673.  ACMD_FUNC(baselevelup)
  2674.  {
  2675. -    int level=0, i=0, status_point=0;
  2676. +    int16 level=0, i=0;
  2677. +    unsigned int status_point=0;
  2678.      nullpo_retr(-1, sd);
  2679. -    level = atoi(message);
  2680.  
  2681. +    sscanf(message, "%hd", &level);
  2682. +
  2683.      if (!message || !*message || !level) {
  2684.          clif_displaymessage(fd, msg_txt(986)); // Please enter a level adjustment (usage: @lvup/@blevel/@baselvlup <number of levels>).
  2685.          return -1;
  2686.      }
  2687.  
  2688.      if (level > 0) {
  2689. +        uint16 lvl = (uint16)level;
  2690.          if (sd->status.base_level >= pc_maxbaselv(sd)) { // check for max level by Valaris
  2691.              clif_displaymessage(fd, msg_txt(47)); // Base level can't go any higher.
  2692.              return -1;
  2693.          } // End Addition
  2694. -        if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
  2695. -            level = pc_maxbaselv(sd) - sd->status.base_level;
  2696. +        if (level > pc_maxbaselv(sd) || level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
  2697. +            lvl = (uint16)(pc_maxbaselv(sd) - sd->status.base_level);
  2698.          for (i = 0; i < level; i++)
  2699. -            status_point += pc_gets_status_point(sd->status.base_level + i);
  2700. +            status_point += pc_gets_status_point((uint16)(sd->status.base_level + (uint16)i));
  2701.  
  2702.          sd->status.status_point += status_point;
  2703. -        sd->status.base_level += (unsigned int)level;
  2704. +        sd->status.base_level += (uint16)lvl;
  2705.          status_percent_heal(&sd->bl, 100, 100);
  2706.          clif_misceffect(&sd->bl, 0);
  2707.          clif_displaymessage(fd, msg_txt(21)); // Base level raised.
  2708. @@ -1351,18 +1359,18 @@
  2709.              clif_displaymessage(fd, msg_txt(158)); // Base level can't go any lower.
  2710.              return -1;
  2711.          }
  2712. -        level*=-1;
  2713. -        if ((unsigned int)level >= sd->status.base_level)
  2714. +        level *= -1;
  2715. +        if (level >= sd->status.base_level)
  2716.              level = sd->status.base_level-1;
  2717.          for (i = 0; i > -level; i--)
  2718. -            status_point += pc_gets_status_point(sd->status.base_level + i - 1);
  2719. +            status_point += pc_gets_status_point((uint16)(sd->status.base_level + (uint16)i-1));
  2720.          if (sd->status.status_point < status_point)
  2721.              pc_resetstate(sd);
  2722.          if (sd->status.status_point < status_point)
  2723.              sd->status.status_point = 0;
  2724.          else
  2725.              sd->status.status_point -= status_point;
  2726. -        sd->status.base_level -= (unsigned int)level;
  2727. +        sd->status.base_level -= level;
  2728.          clif_displaymessage(fd, msg_txt(22)); // Base level lowered.
  2729.      }
  2730.      sd->status.base_exp = 0;
  2731. @@ -1745,7 +1753,7 @@
  2732.      int i;
  2733.      int town;
  2734.      char map_name[MAP_NAME_LENGTH];
  2735. -    int m;
  2736. +    short m;
  2737.  
  2738.      const struct {
  2739.          char map[MAP_NAME_LENGTH];
  2740. @@ -1826,7 +1834,7 @@
  2741.      // get possible name of the city
  2742.      map_name[MAP_NAME_LENGTH-1] = '\0';
  2743.      for (i = 0; map_name[i]; i++)
  2744. -        map_name[i] = TOLOWER(map_name[i]);
  2745. +        map_name[i] = (char) TOLOWER(map_name[i]);
  2746.      // try to identify the map name
  2747.      if (strncmp(map_name, "prontera", 3) == 0) {
  2748.          town = 0;
  2749. @@ -2056,7 +2064,8 @@
  2750.  
  2751.  ACMD_FUNC(killmonster)
  2752.  {
  2753. -    int map_id, drop_flag;
  2754. +    short map_id;
  2755. +    int drop_flag;
  2756.      char map_name[MAP_NAME_LENGTH_EXT];
  2757.      nullpo_retr(-1, sd);
  2758.  
  2759. @@ -2083,13 +2092,14 @@
  2760.   *------------------------------------------*/
  2761.  ACMD_FUNC(refine)
  2762.  {
  2763. -    int i,j, position = 0, refine = 0, current_position, final_refine;
  2764. +    int i,j, position = 0, current_position;
  2765. +	char final_refine, refine = 0;
  2766.      int count;
  2767.      nullpo_retr(-1, sd);
  2768.  
  2769.      memset(atcmd_output, '\0', sizeof(atcmd_output));
  2770.  
  2771. -    if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) {
  2772. +    if (!message || !*message || sscanf(message, "%d %c", &position, &refine) < 2) {
  2773.          clif_displaymessage(fd, msg_txt(996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>).
  2774.          sprintf(atcmd_output, msg_txt(997), EQP_HEAD_LOW); // %d: Lower Headgear
  2775.          clif_displaymessage(fd, atcmd_output);
  2776. @@ -2162,7 +2172,8 @@
  2777.  ACMD_FUNC(produce)
  2778.  {
  2779.      char item_name[100];
  2780. -    int item_id, attribute = 0, star = 0;
  2781. +	short attribute = 0, item_id=0;
  2782. +    int star = 0;
  2783.      int flag = 0;
  2784.      struct item_data *item_data;
  2785.      struct item tmp_item;
  2786. @@ -2172,8 +2183,8 @@
  2787.      memset(item_name, '\0', sizeof(item_name));
  2788.  
  2789.      if (!message || !*message || (
  2790. -            sscanf(message, "\"%99[^\"]\" %d %d", item_name, &attribute, &star) < 1 &&
  2791. -            sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1
  2792. +            sscanf(message, "\"%99[^\"]\" %hi %d", item_name, &attribute, &star) < 1 &&
  2793. +            sscanf(message, "%99s %hi %d", item_name, &attribute, &star) < 1
  2794.          )) {
  2795.          clif_displaymessage(fd, msg_txt(1007)); // Please enter at least one item name/ID (usage: @produce <equip name/ID> <element> <# of very's>).
  2796.          return -1;
  2797. @@ -2197,8 +2208,7 @@
  2798.          tmp_item.amount = 1;
  2799.          tmp_item.identify = 1;
  2800.          tmp_item.card[0] = CARD0_FORGE;
  2801. -        tmp_item.card[1] = item_data->type==IT_WEAPON?
  2802. -                           ((star*5) << 8) + attribute:0;
  2803. +        tmp_item.card[1] = ((short) item_data->type==IT_WEAPON?((star*5) << 8) + attribute:0);
  2804.          tmp_item.card[2] = GetWord(sd->status.char_id, 0);
  2805.          tmp_item.card[3] = GetWord(sd->status.char_id, 1);
  2806.          clif_produceeffect(sd, 0, item_id);
  2807. @@ -2404,7 +2414,8 @@
  2808.   *------------------------------------------*/
  2809.  ACMD_FUNC(param)
  2810.  {
  2811. -    int i, value = 0, new_value, max;
  2812. +    int i;
  2813. +    short value = 0, new_value, max;
  2814.      const char *param[] = { "str", "agi", "vit", "int", "dex", "luk" };
  2815.      short *status[6];
  2816.      //we don't use direct initialization because it isn't part of the c standard.
  2817. @@ -2412,7 +2423,7 @@
  2818.  
  2819.      memset(atcmd_output, '\0', sizeof(atcmd_output));
  2820.  
  2821. -    if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) {
  2822. +    if (!message || !*message || sscanf(message, "%hi", &value) < 1 || value == 0) {
  2823.          clif_displaymessage(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>).
  2824.          return -1;
  2825.      }
  2826. @@ -2466,8 +2477,8 @@
  2827.   *------------------------------------------*/
  2828.  ACMD_FUNC(stat_all)
  2829.  {
  2830. -    int index, count, value, max, new_value;
  2831. -    short *status[6];
  2832. +    int index, count;
  2833. +    short *status[6], new_value, value, max;
  2834.      //we don't use direct initialization because it isn't part of the c standard.
  2835.      nullpo_retr(-1, sd);
  2836.  
  2837. @@ -2478,19 +2489,17 @@
  2838.      status[4] = &sd->status.dex;
  2839.      status[5] = &sd->status.luk;
  2840.  
  2841. -    if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) {
  2842. +    if (!message || !*message || sscanf(message, "%hi", &value) < 1) {
  2843.          value = pc_maxparameter(sd);
  2844. -        max = pc_maxparameter(sd);
  2845. -    } else {
  2846. +    }
  2847. +
  2848.          if (battle_config.atcommand_max_stat_bypass)
  2849.              max = SHRT_MAX;
  2850.          else
  2851.              max = pc_maxparameter(sd);
  2852. -    }
  2853.  
  2854.      count = 0;
  2855.      for (index = 0; index < ARRAYLENGTH(status); index++) {
  2856. -
  2857.          if (value > 0 && *status[index] > max - value)
  2858.              new_value = max;
  2859.          else if (value < 0 && *status[index] <= -value)
  2860. @@ -2621,11 +2630,11 @@
  2861.   *------------------------------------------*/
  2862.  ACMD_FUNC(petfriendly)
  2863.  {
  2864. -    int friendly;
  2865. +    short friendly;
  2866.      struct pet_data *pd;
  2867.      nullpo_retr(-1, sd);
  2868.  
  2869. -    if (!message || !*message || (friendly = atoi(message)) < 0) {
  2870. +    if (!message || !*message || sscanf(message, "%hi", &friendly) < 1) {
  2871.          clif_displaymessage(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>).
  2872.          return -1;
  2873.      }
  2874. @@ -2657,11 +2666,11 @@
  2875.   *------------------------------------------*/
  2876.  ACMD_FUNC(pethungry)
  2877.  {
  2878. -    int hungry;
  2879. +    short hungry;
  2880.      struct pet_data *pd;
  2881.      nullpo_retr(-1, sd);
  2882.  
  2883. -    if (!message || !*message || (hungry = atoi(message)) < 0) {
  2884. +    if (!message || !*message || sscanf(message, "%hi", &hungry) < 1) {
  2885.          clif_displaymessage(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>).
  2886.          return -1;
  2887.      }
  2888. @@ -3124,7 +3133,7 @@
  2889.   *------------------------------------------*/
  2890.  ACMD_FUNC(questskill)
  2891.  {
  2892. -    int skill_id;
  2893. +    uint16 skill_id;
  2894.      nullpo_retr(-1, sd);
  2895.  
  2896.      if (!message || !*message || (skill_id = atoi(message)) < 0) {
  2897. @@ -3168,7 +3177,7 @@
  2898.   *------------------------------------------*/
  2899.  ACMD_FUNC(lostskill)
  2900.  {
  2901. -    int skill_id;
  2902. +    uint16 skill_id;
  2903.      nullpo_retr(-1, sd);
  2904.  
  2905.      if (!message || !*message || (skill_id = atoi(message)) < 0) {
  2906. @@ -3214,11 +3223,11 @@
  2907.   *------------------------------------------*/
  2908.  ACMD_FUNC(spiritball)
  2909.  {
  2910. -    int max_spiritballs;
  2911. -    int number;
  2912. +    short max_spiritballs;
  2913. +    short number;
  2914.      nullpo_retr(-1, sd);
  2915.  
  2916. -    max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
  2917. +    max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), SHRT_MAX);
  2918.  
  2919.      if (!message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs) {
  2920.          char msg[CHAT_SIZE_MAX];
  2921. @@ -5262,12 +5271,11 @@
  2922.  {
  2923.      struct map_session_data *pl_sd = NULL;
  2924.      struct block_list *bl;
  2925. -    int skillnum;
  2926. -    int skilllv;
  2927. +    uint16 skill_id, skill_lv;
  2928.      char target[100];
  2929.      nullpo_retr(-1, sd);
  2930.  
  2931. -    if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &skillnum, &skilllv, target) != 3) {
  2932. +    if (!message || !*message || sscanf(message, "%hi %hi %23[^\n]", &skill_id, &skill_lv, target) != 3) {
  2933.          clif_displaymessage(fd, msg_txt(1165)); // Usage: @useskill <skill ID> <skill level> <target>
  2934.          return -1;
  2935.      }
  2936. @@ -5282,16 +5290,16 @@
  2937.          return -1;
  2938.      }
  2939.  
  2940. -    if (skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE+MAX_HOMUNSKILL
  2941. +    if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE+MAX_HOMUNSKILL
  2942.          && sd->hd && merc_is_hom_active(sd->hd)) // (If used with @useskill, put the homunc as dest)
  2943.          bl = &sd->hd->bl;
  2944.      else
  2945.          bl = &sd->bl;
  2946.  
  2947. -    if (skill_get_inf(skillnum)&INF_GROUND_SKILL)
  2948. -        unit_skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skillnum, skilllv);
  2949. +    if (skill_get_inf(skill_id)&INF_GROUND_SKILL)
  2950. +        unit_skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skill_id, skill_lv);
  2951.      else
  2952. -        unit_skilluse_id(bl, pl_sd->bl.id, skillnum, skilllv);
  2953. +        unit_skilluse_id(bl, pl_sd->bl.id, skill_id, skill_lv);
  2954.  
  2955.      return 0;
  2956.  }
  2957. @@ -5305,19 +5313,18 @@
  2958.  {
  2959.      struct status_data *status;
  2960.      unsigned int tick;
  2961. -    int skillnum;
  2962. -    int skilllv = 1;
  2963. +    uint16 skill_id, skill_lv = 1;
  2964.      nullpo_retr(-1, sd);
  2965.  
  2966. -    if (!message || !*message || sscanf(message, "%d %d", &skillnum, &skilllv) < 1) {
  2967. +    if (!message || !*message || sscanf(message, "%hd %hd", &skill_id, &skill_lv) < 1) {
  2968.          clif_displaymessage(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>}
  2969.          return -1;
  2970.      }
  2971.      status = status_get_status_data(&sd->bl);
  2972.      tick = gettick();
  2973. -    clif_skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skillnum, skilllv, 5);
  2974. -    clif_skill_nodamage(&sd->bl, &sd->bl, skillnum, skilllv, 1);
  2975. -    clif_skill_poseffect(&sd->bl, skillnum, skilllv, sd->bl.x, sd->bl.y, tick);
  2976. +    clif_skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skill_id, skill_lv, 5);
  2977. +    clif_skill_nodamage(&sd->bl, &sd->bl, skill_id, skill_lv, 1);
  2978. +    clif_skill_poseffect(&sd->bl, skill_id, skill_lv, sd->bl.x, sd->bl.y, tick);
  2979.      return 0;
  2980.  }
  2981.  
  2982. @@ -5328,13 +5335,13 @@
  2983.  ACMD_FUNC(skilltree)
  2984.  {
  2985.      struct map_session_data *pl_sd = NULL;
  2986. -    int skillnum;
  2987. +    uint16 skill_id;
  2988.      int meets, j, c=0;
  2989.      char target[NAME_LENGTH];
  2990.      struct skill_tree_entry *ent;
  2991.      nullpo_retr(-1, sd);
  2992.  
  2993. -    if (!message || !*message || sscanf(message, "%d %23[^\r\n]", &skillnum, target) != 2) {
  2994. +    if (!message || !*message || sscanf(message, "%hd %23[^\r\n]", &skill_id, target) != 2) {
  2995.          clif_displaymessage(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target>
  2996.          return -1;
  2997.      }
  2998. @@ -5350,7 +5357,7 @@
  2999.      sprintf(atcmd_output, msg_txt(1168), job_name(c), pc_checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
  3000.      clif_displaymessage(fd, atcmd_output);
  3001.  
  3002. -    ARR_FIND(0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skillnum);
  3003. +    ARR_FIND(0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skill_id);
  3004.      if (j == MAX_SKILL_TREE || skill_tree[c][j].id == 0) {
  3005.          clif_displaymessage(fd, msg_txt(1169)); // The player cannot use that skill.
  3006.          return 0;
  3007. @@ -5376,7 +5383,8 @@
  3008.  // Hand a ring with partners name on it to this char
  3009.  void getring(struct map_session_data *sd)
  3010.  {
  3011. -    int flag, item_id;
  3012. +    int flag;
  3013. +	short item_id;
  3014.      struct item item_tmp;
  3015.      item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
  3016.  
  3017. @@ -5384,7 +5392,7 @@
  3018.      item_tmp.nameid = item_id;
  3019.      item_tmp.identify = 1;
  3020.      item_tmp.card[0] = 255;
  3021. -    item_tmp.card[2] = sd->status.partner_id;
  3022. +    item_tmp.card[2] = sd->status.partner_id & 0xF;
  3023.      item_tmp.card[3] = sd->status.partner_id >> 16;
  3024.  
  3025.      if ((flag = pc_additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
  3026. @@ -7589,7 +7597,7 @@
  3027.   *------------------------------------------*/
  3028.  ACMD_FUNC(invite)
  3029.  {
  3030. -    unsigned int did = sd->duel_group;
  3031. +    int did = sd->duel_group;
  3032.      struct map_session_data *target_sd = map_nick2sd((char *)message);
  3033.  
  3034.      if (did <= 0)    {
  3035. @@ -8284,18 +8292,20 @@
  3036.   *------------------------------------------*/
  3037.  ACMD_FUNC(font)
  3038.  {
  3039. -    int font_id;
  3040. +    unsigned short font_id;
  3041.      nullpo_retr(-1,sd);
  3042.  
  3043. -    font_id = atoi(message);
  3044. +	if (!message || !*message || (sscanf(message, "%hui", &font_id) < 1 )) {
  3045. +            clif_displaymessage(fd, msg_txt(1357)); // Use @font <1-9> to change your message font.
  3046. +            clif_displaymessage(fd, msg_txt(1358)); // Use 0 or no parameter to return to normal font.
  3047. +			return -1;
  3048. +    }
  3049. +
  3050.      if (font_id == 0) {
  3051.          if (sd->user_font) {
  3052.              sd->user_font = 0;
  3053.              clif_displaymessage(fd, msg_txt(1356)); // Returning to normal font.
  3054.              clif_font(sd);
  3055. -        } else {
  3056. -            clif_displaymessage(fd, msg_txt(1357)); // Use @font <1-9> to change your message font.
  3057. -            clif_displaymessage(fd, msg_txt(1358)); // Use 0 or no parameter to return to normal font.
  3058.          }
  3059.      } else if (font_id < 0 || font_id > 9)
  3060.          clif_displaymessage(fd, msg_txt(1359)); // Invalid font. Use a value from 0 to 9.
  3061. @@ -9285,7 +9295,7 @@
  3062.      ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' command aliases in '"CL_WHITE"%s"CL_RESET"'.\n", num_aliases, config_filename);
  3063.      return;
  3064.  }
  3065. -void atcommand_db_load_groups(int *group_ids)
  3066. +void atcommand_db_load_groups(uint32 *group_ids)
  3067.  {
  3068.      DBIterator *iter = db_iterator(atcommand_db);
  3069.      AtCommandInfo *cmd;
  3070. Index: src/map/atcommand.h
  3071. --- src/map/atcommand.h Base (BASE)
  3072. +++ src/map/atcommand.h Locally Modified (Based On LOCAL)
  3073. @@ -26,7 +26,7 @@
  3074.  
  3075.  void do_init_atcommand(void);
  3076.  void do_final_atcommand(void);
  3077. -void atcommand_db_load_groups(int *group_ids);
  3078. +void atcommand_db_load_groups(uint32 *group_ids);
  3079.  
  3080.  bool atcommand_exists(const char *name);
  3081.  
  3082. Index: src/map/battle.c
  3083. --- src/map/battle.c Base (BASE)
  3084. +++ src/map/battle.c Locally Modified (Based On LOCAL)
  3085. @@ -51,7 +51,7 @@
  3086.  
  3087.      ud = unit_bl2ud(bl);
  3088.  
  3089. -    return ud?ud->skillid:0;
  3090. +    return ud?ud->skill_id:0;
  3091.  }
  3092.  
  3093.  /*==========================================
  3094. @@ -193,7 +193,7 @@
  3095.  }
  3096.  
  3097.  // Pick a random enemy
  3098. -struct block_list *battle_getenemyarea(struct block_list *src, int x, int y, int range, int type, int ignore_id) {
  3099. +struct block_list *battle_getenemyarea(struct block_list *src, short x, short y, short range, int type, int ignore_id) {
  3100.      struct block_list *bl_list[24];
  3101.      int c = 0;
  3102.  
  3103. @@ -214,9 +214,9 @@
  3104.      int target_id;
  3105.      int damage;
  3106.      int delay;
  3107. -    unsigned short distance;
  3108. -    unsigned short skill_lv;
  3109. -    unsigned short skill_id;
  3110. +    uint16 distance;
  3111. +    uint16 skill_lv;
  3112. +    uint16 skill_id;
  3113.      enum damage_lv dmg_lv;
  3114.      unsigned short attack_type;
  3115.  };
  3116. @@ -259,7 +259,7 @@
  3117.      return 0;
  3118.  }
  3119.  
  3120. -int battle_delay_damage(unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay)
  3121. +int battle_delay_damage(unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int damage, enum damage_lv dmg_lv, int ddelay)
  3122.  {
  3123.      struct delay_damage *dat;
  3124.      struct status_change *sc;
  3125. @@ -734,7 +734,7 @@
  3126.   * ATK may be MISS, BLOCKED FAIL, reduc, increase, end status...
  3127.   * After this we apply bg/gvg reduction
  3128.   *------------------------------------------*/
  3129. -int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,int skill_num,int skill_lv)
  3130. +int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 skill_lv)
  3131.  {
  3132.      struct map_session_data *sd = NULL;
  3133.      struct status_change *sc;
  3134. @@ -768,7 +768,7 @@
  3135.      if (sc && sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF])
  3136.          return 1;
  3137.  
  3138. -    if (skill_num == PA_PRESSURE)
  3139. +    if (skill_id == PA_PRESSURE)
  3140.          return damage; //This skill bypass everything else.
  3141.  
  3142.      if (sc && sc->count) {
  3143. @@ -777,14 +777,14 @@
  3144.              d->dmg_lv = ATK_BLOCK;
  3145.              return 0;
  3146.          }
  3147. -        if (sc->data[SC_WHITEIMPRISON] && skill_num != HW_GRAVITATION) {  // Gravitation and Pressure do damage without removing the effect
  3148. -            if (skill_num == MG_NAPALMBEAT ||
  3149. -                skill_num == MG_SOULSTRIKE ||
  3150. -                skill_num == WL_SOULEXPANSION ||
  3151. -                (skill_num && skill_get_ele(skill_num, skill_lv) == ELE_GHOST) ||
  3152. -                (!skill_num && (status_get_status_data(src))->rhw.ele == ELE_GHOST)
  3153. +        if (sc->data[SC_WHITEIMPRISON] && skill_id != HW_GRAVITATION) {  // Gravitation and Pressure do damage without removing the effect
  3154. +            if (skill_id == MG_NAPALMBEAT ||
  3155. +                skill_id == MG_SOULSTRIKE ||
  3156. +                skill_id == WL_SOULEXPANSION ||
  3157. +                (skill_id && skill_get_ele(skill_id, skill_lv) == ELE_GHOST) ||
  3158. +                (!skill_id && (status_get_status_data(src))->rhw.ele == ELE_GHOST)
  3159.                 ) {
  3160. -                if (skill_num == WL_SOULEXPANSION)
  3161. +                if (skill_id == WL_SOULEXPANSION)
  3162.                      damage <<= 1; // If used against a player in White Imprison, the skill deals double damage.
  3163.                  status_change_end(bl,SC_WHITEIMPRISON,INVALID_TIMER); // Those skills do damage and removes effect
  3164.              } else {
  3165. @@ -801,7 +801,7 @@
  3166.  
  3167.          if (sc->data[SC_SAFETYWALL] && (flag&(BF_SHORT|BF_MAGIC))==BF_SHORT) {
  3168.              struct skill_unit_group *group = skill_id2group(sc->data[SC_SAFETYWALL]->val3);
  3169. -            int skill_id = sc->data[SC_SAFETYWALL]->val2;
  3170. +            uint16 skill_id = sc->data[SC_SAFETYWALL]->val2;
  3171.              if (group) {
  3172.                  if (skill_id == MH_STEINWAND) {
  3173.                      if (--group->val2<=0)
  3174. @@ -840,7 +840,7 @@
  3175.              sc_start2(bl,SC_COMBO,100,GC_WEAPONBLOCKING,src->id,2000);
  3176.              return 0;
  3177.          }
  3178. -        if ((sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill_get_nk(skill_num)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2) {
  3179. +        if ((sce=sc->data[SC_AUTOGUARD]) && flag&BF_WEAPON && !(skill_get_nk(skill_id)&NK_NO_CARDFIX_ATK) && rnd()%100 < sce->val2) {
  3180.              int delay;
  3181.              clif_skill_nodamage(bl,bl,CR_AUTOGUARD,sce->val1,1);
  3182.              // different delay depending on skill level [celest]
  3183. @@ -875,7 +875,7 @@
  3184.          }
  3185.  
  3186.  
  3187. -        if ((sce=sc->data[SC_PARRYING]) && flag&BF_WEAPON && skill_num != WS_CARTTERMINATION && rnd()%100 < sce->val2) {
  3188. +        if ((sce=sc->data[SC_PARRYING]) && flag&BF_WEAPON && skill_id != WS_CARTTERMINATION && rnd()%100 < sce->val2) {
  3189.              // attack blocked by Parrying
  3190.              clif_skill_nodamage(bl, bl, LK_PARRYING, sce->val1,1);
  3191.              return 0;
  3192. @@ -906,7 +906,7 @@
  3193.              //Kaupe blocks damage (skill or otherwise) from players, mobs, homuns, mercenaries.
  3194.              clif_specialeffect(bl, 462, AREA);
  3195.              //Shouldn't end until Breaker's non-weapon part connects.
  3196. -            if (skill_num != ASC_BREAKER || !(flag&BF_WEAPON))
  3197. +            if (skill_id != ASC_BREAKER || !(flag&BF_WEAPON))
  3198.                  if (--(sce->val3) <= 0) //We make it work like Safety Wall, even though it only blocks 1 time.
  3199.                      status_change_end(bl, SC_KAUPE, INVALID_TIMER);
  3200.              return 0;
  3201. @@ -918,11 +918,11 @@
  3202.          }
  3203.  
  3204.          if (((sce=sc->data[SC_UTSUSEMI]) || sc->data[SC_BUNSINJYUTSU])
  3205. -            && flag&BF_WEAPON && !(skill_get_nk(skill_num)&NK_NO_CARDFIX_ATK)) {
  3206. +            && flag&BF_WEAPON && !(skill_get_nk(skill_id)&NK_NO_CARDFIX_ATK)) {
  3207.  
  3208. -            skill_additional_effect(src, bl, skill_num, skill_lv, flag, ATK_BLOCK, gettick());
  3209. +            skill_additional_effect(src, bl, skill_id, skill_lv, flag, ATK_BLOCK, gettick());
  3210.              if (!status_isdead(src))
  3211. -                skill_counter_additional_effect(src, bl, skill_num, skill_lv, flag, gettick());
  3212. +                skill_counter_additional_effect(src, bl, skill_id, skill_lv, flag, gettick());
  3213.              if (sce) {
  3214.                  clif_specialeffect(bl, 462, AREA);
  3215.                  skill_blown(src,bl,sce->val3,-1,0);
  3216. @@ -937,11 +937,11 @@
  3217.          }
  3218.  
  3219.          //Now damage increasing effects
  3220. -        if (sc->data[SC_AETERNA] && skill_num != PF_SOULBURN) {
  3221. -            if (src->type != BL_MER || skill_num == 0)
  3222. +        if (sc->data[SC_AETERNA] && skill_id != PF_SOULBURN) {
  3223. +            if (src->type != BL_MER || skill_id == 0)
  3224.                  damage <<= 1; // Lex Aeterna only doubles damage of regular attacks from mercenaries
  3225.  
  3226. -            if (skill_num != ASC_BREAKER || !(flag&BF_WEAPON))
  3227. +            if (skill_id != ASC_BREAKER || !(flag&BF_WEAPON))
  3228.                  status_change_end(bl, SC_AETERNA, INVALID_TIMER); //Shouldn't end until Breaker's non-weapon part connects.
  3229.          }
  3230.  
  3231. @@ -1009,7 +1009,7 @@
  3232.              (flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON))
  3233.              damage -= 20*damage/100;
  3234.  
  3235. -        if (sc->data[SC_FOGWALL] && skill_num != RK_DRAGONBREATH) {
  3236. +        if (sc->data[SC_FOGWALL] && skill_id != RK_DRAGONBREATH) {
  3237.              if (flag&BF_SKILL) //25% reduction
  3238.                  damage -= 25*damage/100;
  3239.              else if ((flag&(BF_LONG|BF_WEAPON)) == (BF_LONG|BF_WEAPON))
  3240. @@ -1038,9 +1038,9 @@
  3241.              damage -= damage*sc->data[SC_ARMOR]->val2/100;
  3242.  
  3243.  #ifdef RENEWAL
  3244. -        if (sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_num != WS_CARTTERMINATION)
  3245. +        if (sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION)
  3246.  #else
  3247. -        if (sc->data[SC_ENERGYCOAT] && flag&BF_WEAPON && skill_num != WS_CARTTERMINATION)
  3248. +        if (sc->data[SC_ENERGYCOAT] && flag&BF_WEAPON && skill_id != WS_CARTTERMINATION)
  3249.  #endif
  3250.          {
  3251.              struct status_data *status = status_get_status_data(bl);
  3252. @@ -1072,7 +1072,7 @@
  3253.  #endif
  3254.  
  3255.          //Finally added to remove the status of immobile when aimedbolt is used. [Jobbie]
  3256. -        if (skill_num == RA_AIMEDBOLT && (sc->data[SC_BITE] || sc->data[SC_ANKLE] || sc->data[SC_ELECTRICSHOCKER])) {
  3257. +        if (skill_id == RA_AIMEDBOLT && (sc->data[SC_BITE] || sc->data[SC_ANKLE] || sc->data[SC_ELECTRICSHOCKER])) {
  3258.              status_change_end(bl, SC_BITE, INVALID_TIMER);
  3259.              status_change_end(bl, SC_ANKLE, INVALID_TIMER);
  3260.              status_change_end(bl, SC_ELECTRICSHOCKER, INVALID_TIMER);
  3261. @@ -1081,13 +1081,13 @@
  3262.          //Finally Kyrie because it may, or not, reduce damage to 0.
  3263.          if ((sce = sc->data[SC_KYRIE]) && damage > 0) {
  3264.              sce->val2-=damage;
  3265. -            if (flag&BF_WEAPON || skill_num == TF_THROWSTONE) {
  3266. +            if (flag&BF_WEAPON || skill_id == TF_THROWSTONE) {
  3267.                  if (sce->val2>=0)
  3268.                      damage=0;
  3269.                  else
  3270.                      damage=-sce->val2;
  3271.              }
  3272. -            if ((--sce->val3)<=0 || (sce->val2<=0) || skill_num == AL_HOLYLIGHT)
  3273. +            if ((--sce->val3)<=0 || (sce->val2<=0) || skill_id == AL_HOLYLIGHT)
  3274.                  status_change_end(bl, SC_KYRIE, INVALID_TIMER);
  3275.          }
  3276.  
  3277. @@ -1175,7 +1175,7 @@
  3278.                          break;
  3279.                      }
  3280.          }
  3281. -        if (sc->data[SC_POISONINGWEAPON] && skill_num != GC_VENOMPRESSURE && (flag&BF_WEAPON) && damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3)
  3282. +        if (sc->data[SC_POISONINGWEAPON] && skill_id != GC_VENOMPRESSURE && (flag&BF_WEAPON) && damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3)
  3283.              sc_start(bl,sc->data[SC_POISONINGWEAPON]->val2,100,sc->data[SC_POISONINGWEAPON]->val1,skill_get_time2(GC_POISONINGWEAPON, 1));
  3284.          if (sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1)
  3285.              status_change_spread(src, bl);
  3286. @@ -1213,13 +1213,13 @@
  3287.      if (bl->type == BL_MOB && !status_isdead(bl) && src != bl) {
  3288.          if (damage > 0)
  3289.              mobskill_event((TBL_MOB *)bl,src,gettick(),flag);
  3290. -        if (skill_num)
  3291. -            mobskill_event((TBL_MOB *)bl,src,gettick(),MSC_SKILLUSED|(skill_num<<16));
  3292. +        if (skill_id)
  3293. +            mobskill_event((TBL_MOB *)bl,src,gettick(),MSC_SKILLUSED|(skill_id<<16));
  3294.      }
  3295.      if (sd) {
  3296.          if (pc_ismadogear(sd) && rnd()%100 < 50) {
  3297. -            short element = skill_get_ele(skill_num, skill_lv);
  3298. -            if (!skill_num || element == -1) {  //Take weapon's element
  3299. +            short element = skill_get_ele(skill_id, skill_lv);
  3300. +            if (!skill_id || element == -1) {  //Take weapon's element
  3301.                  struct status_data *sstatus = NULL;
  3302.                  if (src->type == BL_PC && ((TBL_PC *)src)->bonus.arrow_ele)
  3303.                      element = ((TBL_PC *)src)->bonus.arrow_ele;
  3304. @@ -1241,7 +1241,7 @@
  3305.  /*==========================================
  3306.   * Calculates BG related damage adjustments.
  3307.   *------------------------------------------*/
  3308. -int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int damage, int div_, int skill_num, int skill_lv, int flag)
  3309. +int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int damage, int div_, uint16 skill_id, uint16 skill_lv, int flag)
  3310.  {
  3311.      if (!damage)
  3312.          return 0;
  3313. @@ -1252,7 +1252,7 @@
  3314.              return 0; // Crystal cannot receive skill damage on battlegrounds
  3315.      }
  3316.  
  3317. -    switch (skill_num) {
  3318. +    switch (skill_id) {
  3319.          case PA_PRESSURE:
  3320.          case HW_GRAVITATION:
  3321.          case NJ_ZENYNAGE:
  3322. @@ -1284,10 +1284,10 @@
  3323.  /*==========================================
  3324.   * Calculates GVG related damage adjustments.
  3325.   *------------------------------------------*/
  3326. -int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag)
  3327. +int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag)
  3328.  {
  3329.      struct mob_data *md = BL_CAST(BL_MOB, bl);
  3330. -    int class_ = status_get_class(bl);
  3331. +    short class_ = status_get_class(bl);
  3332.  
  3333.      if (!damage) //No reductions to make.
  3334.          return 0;
  3335. @@ -1295,7 +1295,7 @@
  3336.      if (md && md->guardian_data) {
  3337.          if (class_ == MOBID_EMPERIUM && flag&BF_SKILL) {
  3338.              //Skill immunity.
  3339. -            switch (skill_num) {
  3340. +            switch (skill_id) {
  3341.  #ifndef RENEWAL
  3342.                  case MO_TRIPLEATTACK:
  3343.  #endif
  3344. @@ -1316,7 +1316,7 @@
  3345.          }
  3346.      }
  3347.  
  3348. -    switch (skill_num) {
  3349. +    switch (skill_id) {
  3350.              //Skills with no damage reduction.
  3351.          case PA_PRESSURE:
  3352.          case HW_GRAVITATION:
  3353. @@ -1571,14 +1571,14 @@
  3354.  /*==========================================
  3355.   * Consumes ammo for the given skill.
  3356.   *------------------------------------------*/
  3357. -void battle_consume_ammo(TBL_PC *sd, int skill, int lv)
  3358. +void battle_consume_ammo(TBL_PC *sd, uint16 skill_id, uint16 skill_lv)
  3359.  {
  3360.      int qty=1;
  3361.      if (!battle_config.arrow_decrement)
  3362.          return;
  3363.  
  3364. -    if (skill) {
  3365. -        qty = skill_get_ammo_qty(skill, lv);
  3366. +    if (skill_id) {
  3367. +        qty = skill_get_ammo_qty(skill_id, skill_lv);
  3368.          if (!qty) qty = 1;
  3369.      }
  3370.  
  3371. @@ -1590,7 +1590,7 @@
  3372.  
  3373.  static int battle_range_type(
  3374.      struct block_list *src, struct block_list *target,
  3375. -    int skill_num, int skill_lv)
  3376. +    uint16 skill_id, uint16 skill_lv)
  3377.  {
  3378.      //Skill Range Criteria
  3379.      if (battle_config.skillrange_by_distance &&
  3380. @@ -1601,33 +1601,33 @@
  3381.          return BF_LONG;
  3382.      }
  3383.      //based on used skill's range
  3384. -    if (skill_get_range2(src, skill_num, skill_lv) < 5)
  3385. +    if (skill_get_range2(src, skill_id, skill_lv) < 5)
  3386.          return BF_SHORT;
  3387.      return BF_LONG;
  3388.  }
  3389.  
  3390. -static int battle_blewcount_bonus(struct map_session_data *sd, int skill_num)
  3391. +static int battle_blewcount_bonus(struct map_session_data *sd, uint16 skill_id)
  3392.  {
  3393.      int i;
  3394.      if (!sd->skillblown[0].id)
  3395.          return 0;
  3396.      //Apply the bonus blewcount. [Skotlex]
  3397.      for (i = 0; i < ARRAYLENGTH(sd->skillblown) && sd->skillblown[i].id; i++) {
  3398. -        if (sd->skillblown[i].id == skill_num)
  3399. +        if (sd->skillblown[i].id == skill_id)
  3400.              return sd->skillblown[i].val;
  3401.      }
  3402.      return 0;
  3403.  }
  3404.  
  3405. -struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);
  3406. -struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);
  3407. +struct Damage battle_calc_magic_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int mflag);
  3408. +struct Damage battle_calc_misc_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int mflag);
  3409.  
  3410.  //For quick div adjustment.
  3411.  #define damage_div_fix(dmg, div) { if (div > 1) (dmg)*=div; else if (div < 0) (div)*=-1; }
  3412.  /*==========================================
  3413.   * battle_calc_weapon_attack (by Skotlex)
  3414.   *------------------------------------------*/
  3415. -static struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int wflag) {
  3416. +static struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int wflag) {
  3417.      unsigned int skillratio = 100;  //Skill dmg modifiers.
  3418.      short skill=0;
  3419.      short s_ele, s_ele_, t_class;
  3420. @@ -1664,9 +1664,9 @@
  3421.      //Initial flag
  3422.      flag.rh=1;
  3423.      flag.weapon=1;
  3424. -    flag.infdef=(tstatus->mode&MD_PLANT && skill_num != RA_CLUSTERBOMB
  3425. +    flag.infdef=(tstatus->mode&MD_PLANT && skill_id != RA_CLUSTERBOMB
  3426.  #ifdef RENEWAL
  3427. -                 && skill_num != HT_FREEZINGTRAP
  3428. +                 && skill_id != HT_FREEZINGTRAP
  3429.  #endif
  3430.                   ?1:0);
  3431.      if (target->type == BL_SKILL) {
  3432. @@ -1677,17 +1677,17 @@
  3433.  
  3434.      //Initial Values
  3435.      wd.type=0; //Normal attack
  3436. -    wd.div_=skill_num?skill_get_num(skill_num,skill_lv):1;
  3437. -    wd.amotion=(skill_num && skill_get_inf(skill_num)&INF_GROUND_SKILL)?0:sstatus->amotion; //Amotion should be 0 for ground skills.
  3438. -    if (skill_num == KN_AUTOCOUNTER)
  3439. +    wd.div_=skill_id?skill_get_num(skill_id,skill_lv):1;
  3440. +    wd.amotion=(skill_id && skill_get_inf(skill_id)&INF_GROUND_SKILL)?0:sstatus->amotion; //Amotion should be 0 for ground skills.
  3441. +    if (skill_id == KN_AUTOCOUNTER)
  3442.          wd.amotion >>= 1;
  3443.      wd.dmotion=tstatus->dmotion;
  3444. -    wd.blewcount=skill_get_blewcount(skill_num,skill_lv);
  3445. +    wd.blewcount=skill_get_blewcount(skill_id,skill_lv);
  3446.      wd.flag = BF_WEAPON; //Initial Flag
  3447. -    wd.flag |= (skill_num||wflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish]
  3448. +    wd.flag |= (skill_id||wflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish]
  3449.      wd.dmg_lv=ATK_DEF;  //This assumption simplifies the assignation later
  3450. -    nk = skill_get_nk(skill_num);
  3451. -    if (!skill_num && wflag)  //If flag, this is splash damage from Baphomet Card and it always hits.
  3452. +    nk = skill_get_nk(skill_id);
  3453. +    if (!skill_id && wflag)  //If flag, this is splash damage from Baphomet Card and it always hits.
  3454.          nk |= NK_NO_CARDFIX_ATK|NK_IGNORE_FLEE;
  3455.      flag.hit = nk &NK_IGNORE_FLEE?1:0;
  3456.      flag.idef = flag.idef2 = nk &NK_IGNORE_DEF?1:0;
  3457. @@ -1701,18 +1701,18 @@
  3458.      tsd = BL_CAST(BL_PC, target);
  3459.  
  3460.      if (sd)
  3461. -        wd.blewcount += battle_blewcount_bonus(sd, skill_num);
  3462. +        wd.blewcount += battle_blewcount_bonus(sd, skill_id);
  3463.  
  3464.      //Set miscellaneous data that needs be filled regardless of hit/miss
  3465.      if (
  3466.          (sd && sd->state.arrow_atk) ||
  3467. -        (!sd && ((skill_num && skill_get_ammotype(skill_num)) || sstatus->rhw.range>3))
  3468. +        (!sd && ((skill_id && skill_get_ammotype(skill_id)) || sstatus->rhw.range>3))
  3469.      )
  3470.          flag.arrow = 1;
  3471.  
  3472. -    if (skill_num) {
  3473. -        wd.flag |= battle_range_type(src, target, skill_num, skill_lv);
  3474. -        switch (skill_num) {
  3475. +    if (skill_id) {
  3476. +        wd.flag |= battle_range_type(src, target, skill_id, skill_lv);
  3477. +        switch (skill_id) {
  3478.              case MO_FINGEROFFENSIVE:
  3479.                  if (sd) {
  3480.                      if (battle_config.finger_offensive_type)
  3481. @@ -1769,7 +1769,7 @@
  3482.      } else //Range for normal attacks.
  3483.          wd.flag |= flag.arrow?BF_LONG:BF_SHORT;
  3484.  
  3485. -    if ((!skill_num || skill_num == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2) {
  3486. +    if ((!skill_id || skill_id == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2) {
  3487.          //Check for Lucky Dodge
  3488.          wd.type=0x0b;
  3489.          wd.dmg_lv=ATK_LUCKY;
  3490. @@ -1778,8 +1778,8 @@
  3491.      }
  3492.  
  3493.      t_class = status_get_class(target);
  3494. -    s_ele = s_ele_ = skill_get_ele(skill_num, skill_lv);
  3495. -    if (!skill_num || s_ele == -1) {
  3496. +    s_ele = s_ele_ = skill_get_ele(skill_id, skill_lv);
  3497. +    if (!skill_id || s_ele == -1) {
  3498.          //Take weapon's element
  3499.          s_ele = sstatus->rhw.ele;
  3500.          s_ele_ = sstatus->lhw.ele;
  3501. @@ -1795,7 +1795,7 @@
  3502.          s_ele = s_ele_ = status_get_attack_sc_element(src,sc);
  3503.      else if (s_ele == -3)  //Use random element
  3504.          s_ele = s_ele_ = rnd()%ELE_MAX;
  3505. -    switch (skill_num) {
  3506. +    switch (skill_id) {
  3507.          case GS_GROUNDDRIFT:
  3508.              s_ele = s_ele_ = wflag; //element comes in flag.
  3509.              break;
  3510. @@ -1807,12 +1807,12 @@
  3511.      if (!(nk &NK_NO_ELEFIX) && !n_ele)
  3512.          if (src->type == BL_HOM)
  3513.              n_ele = true; //skill is "not elemental"
  3514. -    if (sc && sc->data[SC_GOLDENE_FERSE] && ((!skill_num && (rnd() % 100 < sc->data[SC_GOLDENE_FERSE]->val4)) || skill_num == MH_STAHL_HORN)) {
  3515. +    if (sc && sc->data[SC_GOLDENE_FERSE] && ((!skill_id && (rnd() % 100 < sc->data[SC_GOLDENE_FERSE]->val4)) || skill_id == MH_STAHL_HORN)) {
  3516.          s_ele = s_ele_ = ELE_HOLY;
  3517.          n_ele = false;
  3518.      }
  3519.  
  3520. -    if (!skill_num) {
  3521. +    if (!skill_id) {
  3522.          //Skills ALWAYS use ONLY your right-hand weapon (tested on Aegis 10.2)
  3523.          if (sd && sd->weapontype1 == 0 && sd->weapontype2 > 0) {
  3524.              flag.rh=0;
  3525. @@ -1822,7 +1822,7 @@
  3526.              flag.lh=1;
  3527.      }
  3528.  
  3529. -    if (sd && !skill_num) {  //Check for double attack.
  3530. +    if (sd && !skill_id) {  //Check for double attack.
  3531.          if (((skill_lv = pc_checkskill(sd,TF_DOUBLE)) > 0 && sd->weapontype1 == W_DAGGER)
  3532.              || (sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST)   //Will fail bare-handed
  3533.              || (sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST)) { // Need confirmation
  3534. @@ -1852,10 +1852,10 @@
  3535.  
  3536.      //Check for critical
  3537.      if (!flag.cri && !(wd.type&0x08) && sstatus->cri &&
  3538. -        (!skill_num ||
  3539. -         skill_num == KN_AUTOCOUNTER ||
  3540. -         skill_num == SN_SHARPSHOOTING || skill_num == MA_SHARPSHOOTING ||
  3541. -         skill_num == NJ_KIRIKAGE)) {
  3542. +        (!skill_id ||
  3543. +         skill_id == KN_AUTOCOUNTER ||
  3544. +         skill_id == SN_SHARPSHOOTING || skill_id == MA_SHARPSHOOTING ||
  3545. +         skill_id == NJ_KIRIKAGE)) {
  3546.          short cri = sstatus->cri;
  3547.          if (sd) {
  3548.              cri+= sd->critaddrace[tstatus->race];
  3549. @@ -1871,7 +1871,7 @@
  3550.          if (tsc && tsc->data[SC_SLEEP]) {
  3551.              cri <<= 1;
  3552.          }
  3553. -        switch (skill_num) {
  3554. +        switch (skill_id) {
  3555.              case KN_AUTOCOUNTER:
  3556.                  if (battle_config.auto_counter_type &&
  3557.                      (battle_config.auto_counter_type&src->type))
  3558. @@ -1903,7 +1903,7 @@
  3559.              flag.idef = flag.idef2 = 1; //def ignore [Komurka]
  3560.          }
  3561.          if (!flag.hit)
  3562. -            switch (skill_num) {
  3563. +            switch (skill_id) {
  3564.                  case AS_SPLASHER:
  3565.                      if (!wflag)  // Always hits the one exploding.
  3566.                          flag.hit = 1;
  3567. @@ -1941,7 +1941,7 @@
  3568.  
  3569.          hitrate+= sstatus->hit - flee;
  3570.  
  3571. -        if (wd.flag&BF_LONG && !skill_num && //Fogwall's hit penalty is only for normal ranged attacks.
  3572. +        if (wd.flag&BF_LONG && !skill_id && //Fogwall's hit penalty is only for normal ranged attacks.
  3573.              tsc && tsc->data[SC_FOGWALL])
  3574.              hitrate -= 50;
  3575.  
  3576. @@ -1951,8 +1951,8 @@
  3577.          if (sd)  //in Renewal hit bonus from Vultures Eye is not anymore shown in status window
  3578.              hitrate += pc_checkskill(sd,AC_VULTURE);
  3579.  #endif
  3580. -        if (skill_num)
  3581. -            switch (skill_num) {
  3582. +        if (skill_id)
  3583. +            switch (skill_id) {
  3584.                      //Hit skill modifiers
  3585.                      //It is proven that bonus is applied on final hitrate, not hit.
  3586.                  case SM_BASH:
  3587. @@ -2028,7 +2028,7 @@
  3588.  #define ATK_ADD( a ) { wd.damage+= a; if (flag.lh) wd.damage2+= a; }
  3589.  #define ATK_ADD2( a , b ) { wd.damage+= a; if (flag.lh) wd.damage2+= b; }
  3590.  
  3591. -        switch (skill_num) {
  3592. +        switch (skill_id) {
  3593.                  //Calc base damage according to skill
  3594.              case NJ_ISSEN:
  3595.                  wd.damage = 40*sstatus->str +skill_lv*(sstatus->hp/10 + 35);
  3596. @@ -2090,9 +2090,9 @@
  3597.              default: {
  3598.                      i = (flag.cri?1:0)|
  3599.                          (flag.arrow?2:0)|
  3600. -                        (skill_num == HW_MAGICCRASHER?4:0)|
  3601. -                        (!skill_num && sc && sc->data[SC_CHANGE]?4:0)|
  3602. -                        (skill_num == MO_EXTREMITYFIST?8:0)|
  3603. +                        (skill_id == HW_MAGICCRASHER?4:0)|
  3604. +                        (!skill_id && sc && sc->data[SC_CHANGE]?4:0)|
  3605. +                        (skill_id == MO_EXTREMITYFIST?8:0)|
  3606.                          (sc && sc->data[SC_WEAPONPERFECTION]?8:0);
  3607.                      if (flag.arrow && sd)
  3608.                          switch (sd->status.weapon) {
  3609. @@ -2113,7 +2113,7 @@
  3610.                          if (wflag>0)
  3611.                              wd.damage/= wflag;
  3612.                          else
  3613. -                            ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num));
  3614. +                            ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id));
  3615.                      }
  3616.  
  3617.                      //Add any bonuses that modify the base baseatk+watk (pre-skills)
  3618. @@ -2131,10 +2131,10 @@
  3619.                      }
  3620.                      break;
  3621.                  }   //End default case
  3622. -        } //End switch(skill_num)
  3623. +        } //End switch(skill_id)
  3624.  
  3625.          //Skill damage modifiers that stack linearly
  3626. -        if (sc && skill_num != PA_SACRIFICE) {
  3627. +        if (sc && skill_id != PA_SACRIFICE) {
  3628.              if (sc->data[SC_OVERTHRUST])
  3629.                  skillratio += sc->data[SC_OVERTHRUST]->val3;
  3630.              if (sc->data[SC_MAXOVERTHRUST])
  3631. @@ -2144,10 +2144,10 @@
  3632.              if (sc->data[SC_ZENKAI] && sstatus->rhw.ele == sc->data[SC_ZENKAI]->val2)
  3633.                  skillratio += sc->data[SC_ZENKAI]->val1 * 2;
  3634.          }
  3635. -        if (!skill_num) {
  3636. +        if (!skill_id) {
  3637.              ATK_RATE(skillratio);
  3638.          } else {
  3639. -            switch (skill_num) {
  3640. +            switch (skill_id) {
  3641.                  case SM_BASH:
  3642.                  case MS_BASH:
  3643.                      skillratio += 30*skill_lv;
  3644. @@ -2398,7 +2398,7 @@
  3645.                      break;
  3646.                  case TK_JUMPKICK:
  3647.                      skillratio += -70 + 10*skill_lv;
  3648. -                    if (sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_num)
  3649. +                    if (sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_id)
  3650.                          skillratio += 10*status_get_lv(src)/3; //Tumble bonus
  3651.                      if (wflag) {
  3652.                          skillratio += 10*status_get_lv(src)/3; //Running bonus (TODO: What is the real bonus?)
  3653. @@ -2792,8 +2792,8 @@
  3654.                  case WM_GREAT_ECHO:
  3655.                      skillratio += 800 + 100 * skill_lv;
  3656.                      if (sd) {    // Still need official value [pakpil]
  3657. -                        short lv = (short)skill_lv;
  3658. -                        skillratio += 100 * skill_check_pc_partner(sd,skill_num,&lv,skill_get_splash(skill_num,skill_lv),0);
  3659. +                        uint16 lv = skill_lv;
  3660. +                        skillratio += 100 * skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),0);
  3661.                      }
  3662.                      break;
  3663.                  case WM_SOUND_OF_DESTRUCTION:
  3664. @@ -2904,7 +2904,7 @@
  3665.              ATK_RATE(skillratio);
  3666.  
  3667.              //Constant/misc additions from skills
  3668. -            switch (skill_num) {
  3669. +            switch (skill_id) {
  3670.                  case MO_EXTREMITYFIST:
  3671.                      ATK_ADD(250 + 150*skill_lv);
  3672.                      break;
  3673. @@ -2941,8 +2941,8 @@
  3674.                      break;
  3675.                  case LG_RAYOFGENESIS:
  3676.                      if (sc && sc->data[SC_BANDING]) { // Increase only if the RG is under Banding.
  3677. -                        short lv = (short)skill_lv;
  3678. -                        ATK_ADDRATE(190 * ((sd) ? skill_check_pc_partner(sd,(short)skill_num,&lv,skill_get_splash(skill_num,skill_lv),0) : 1));
  3679. +                        uint16 lv = skill_lv;
  3680. +                        ATK_ADDRATE(190 * ((sd) ? skill_check_pc_partner(sd,skill_id,&lv,skill_get_splash(skill_id,skill_lv),0) : 1));
  3681.                      }
  3682.                      break;
  3683.                  case SR_GATEOFHELL:
  3684. @@ -2993,12 +2993,12 @@
  3685.              if (sc->data[SC_TRUESIGHT])
  3686.                  ATK_ADDRATE(2*sc->data[SC_TRUESIGHT]->val1);
  3687.              if (sc->data[SC_GLOOMYDAY_SK] &&
  3688. -                (skill_num == LK_SPIRALPIERCE || skill_num == KN_BRANDISHSPEAR ||
  3689. -                 skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN ||
  3690. -                 skill_num == LG_SHIELDPRESS))
  3691. +                (skill_id == LK_SPIRALPIERCE || skill_id == KN_BRANDISHSPEAR ||
  3692. +                 skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN ||
  3693. +                 skill_id == LG_SHIELDPRESS))
  3694.                  ATK_ADDRATE(sc->data[SC_GLOOMYDAY_SK]->val2);
  3695.              if (sc->data[SC_EDP]) {
  3696. -                switch (skill_num) {
  3697. +                switch (skill_id) {
  3698.                      case AS_SPLASHER:
  3699.                      case AS_VENOMKNIFE:
  3700.                      case AS_GRIMTOOTH:
  3701. @@ -3025,7 +3025,7 @@
  3702.  
  3703.          }
  3704.  
  3705. -        switch (skill_num) {
  3706. +        switch (skill_id) {
  3707.              case AS_SONICBLOW:
  3708.                  if (sc && sc->data[SC_SPIRIT] &&
  3709.                      sc->data[SC_SPIRIT]->val2 == SL_ASSASIN)
  3710. @@ -3046,10 +3046,10 @@
  3711.          }
  3712.  
  3713.          if (sd) {
  3714. -            if (skill_num && (i = pc_skillatk_bonus(sd, skill_num)))
  3715. +            if (skill_id && (i = pc_skillatk_bonus(sd, skill_id)))
  3716.                  ATK_ADDRATE(i);
  3717.  
  3718. -            if (skill_num != PA_SACRIFICE && skill_num != MO_INVESTIGATE && skill_num != CR_GRANDCROSS && skill_num != NPC_GRANDDARKNESS && skill_num != PA_SHIELDCHAIN && !flag.cri) {
  3719. +            if (skill_id != PA_SACRIFICE && skill_id != MO_INVESTIGATE && skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS && skill_id != PA_SHIELDCHAIN && !flag.cri) {
  3720.                  //Elemental/Racial adjustments
  3721.                  if (sd->right_weapon.def_ratio_atk_ele & (1<<tstatus->def_ele) ||
  3722.                      sd->right_weapon.def_ratio_atk_race & (1<<tstatus->race) ||
  3723. @@ -3069,7 +3069,7 @@
  3724.                  }
  3725.              }
  3726.  
  3727. -            if (skill_num != CR_GRANDCROSS && skill_num != NPC_GRANDDARKNESS) {
  3728. +            if (skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS) {
  3729.                  //Ignore Defense?
  3730.                  if (!flag.idef && (
  3731.                          sd->right_weapon.ignore_def_ele & (1<<tstatus->def_ele) ||
  3732. @@ -3136,7 +3136,7 @@
  3733.                          def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num;
  3734.                      }
  3735.                  }
  3736. -                if (skill_num == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex]
  3737. +                if (skill_id == AM_ACIDTERROR) def1 = 0; //Acid Terror ignores only armor defense. [Skotlex]
  3738.                  if (def2 < 1) def2 = 1;
  3739.              }
  3740.              //Vitality reduction from rodatazone: http://rodatazone.simgaming.net/mechanics/substats.php#def
  3741. @@ -3189,12 +3189,12 @@
  3742.              //SC skill damages
  3743.              if (sc->data[SC_AURABLADE]
  3744.  #ifndef RENEWAL
  3745. -                && skill_num != LK_SPIRALPIERCE && skill_num != ML_SPIRALPIERCE
  3746. +                && skill_id != LK_SPIRALPIERCE && skill_id != ML_SPIRALPIERCE
  3747.  #endif
  3748.                 ) {
  3749.                  int lv = sc->data[SC_AURABLADE]->val1;
  3750.  #ifdef RENEWAL
  3751. -                lv *= ((skill_num == LK_SPIRALPIERCE || skill_num == ML_SPIRALPIERCE)?wd.div_:1); // +100 per hit in lv 5
  3752. +                lv *= ((skill_id == LK_SPIRALPIERCE || skill_id == ML_SPIRALPIERCE)?wd.div_:1); // +100 per hit in lv 5
  3753.  #endif
  3754.                  ATK_ADD(20*lv);
  3755.              }
  3756. @@ -3213,9 +3213,9 @@
  3757.          }
  3758.  
  3759.          //Refine bonus
  3760. -        if (sd && flag.weapon && skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST) {
  3761. +        if (sd && flag.weapon && skill_id != MO_INVESTIGATE && skill_id != MO_EXTREMITYFIST) {
  3762.              // Counts refine bonus multiple times
  3763. -            if (skill_num == MO_FINGEROFFENSIVE) {
  3764. +            if (skill_id == MO_FINGEROFFENSIVE) {
  3765.                  ATK_ADD2(wd.div_*sstatus->rhw.atk2, wd.div_*sstatus->lhw.atk2);
  3766.              } else {
  3767.                  ATK_ADD2(sstatus->rhw.atk2, sstatus->lhw.atk2);
  3768. @@ -3227,11 +3227,11 @@
  3769.          if (flag.lh && wd.damage2 < 1) wd.damage2 = 1;
  3770.  
  3771.          if (sd && flag.weapon &&
  3772. -            skill_num != MO_INVESTIGATE &&
  3773. -            skill_num != MO_EXTREMITYFIST &&
  3774. -            skill_num != CR_GRANDCROSS) {
  3775. +            skill_id != MO_INVESTIGATE &&
  3776. +            skill_id != MO_EXTREMITYFIST &&
  3777. +            skill_id != CR_GRANDCROSS) {
  3778.              //Add mastery damage
  3779. -            if (skill_num != ASC_BREAKER && sd->status.weapon == W_KATAR &&
  3780. +            if (skill_id != ASC_BREAKER && sd->status.weapon == W_KATAR &&
  3781.                  (skill=pc_checkskill(sd,ASC_KATAR)) > 0) {
  3782.                  //Adv Katar Mastery is does not applies to ASC_BREAKER,
  3783.                  // but other masteries DO apply >_>
  3784. @@ -3252,9 +3252,9 @@
  3785.                      skillratio /= 12-3*skill;
  3786.                  ATK_ADDRATE(skillratio);
  3787.              }
  3788. -            if (skill_num == NJ_SYURIKEN && (skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0)
  3789. +            if (skill_id == NJ_SYURIKEN && (skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0)
  3790.                  ATK_ADD(3*skill);
  3791. -            if (skill_num == NJ_KUNAI)
  3792. +            if (skill_id == NJ_KUNAI)
  3793.                  ATK_ADD(60);
  3794.          }
  3795.      } //Here ends flag.hit section, the rest of the function applies to both hitting and missing attacks
  3796. @@ -3264,16 +3264,16 @@
  3797.      if (sd && (skill=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0)
  3798.          ATK_ADD(skill*2);
  3799.  
  3800. -    if (skill_num==TF_POISON)
  3801. +    if (skill_id==TF_POISON)
  3802.          ATK_ADD(15*skill_lv);
  3803.  
  3804.      if (!(nk &NK_NO_ELEFIX) && !n_ele) {
  3805.          //Elemental attribute fix
  3806.          if (wd.damage > 0) {
  3807.              wd.damage=battle_attr_fix(src,target,wd.damage,s_ele,tstatus->def_ele, tstatus->ele_lv);
  3808. -            if (skill_num == MC_CARTREVOLUTION)  //Cart Revolution applies the element fix once more with neutral element
  3809. +            if (skill_id == MC_CARTREVOLUTION)  //Cart Revolution applies the element fix once more with neutral element
  3810.                  wd.damage = battle_attr_fix(src,target,wd.damage,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv);
  3811. -            if (skill_num== GS_GROUNDDRIFT)  //Additional 50*lv Neutral damage.
  3812. +            if (skill_id== GS_GROUNDDRIFT)  //Additional 50*lv Neutral damage.
  3813.                  wd.damage += battle_attr_fix(src,target,50*skill_lv,ELE_NEUTRAL,tstatus->def_ele, tstatus->ele_lv);
  3814.          }
  3815.          if (flag.lh && wd.damage2 > 0)
  3816. @@ -3293,18 +3293,18 @@
  3817.           * In RE Shield Bommerang takes weapon element only for damage calculation,
  3818.           * - resist calculation is always against neutral
  3819.           **/
  3820. -        if (skill_num == CR_SHIELDBOOMERANG)
  3821. +        if (skill_id == CR_SHIELDBOOMERANG)
  3822.              s_ele = s_ele_ = ELE_NEUTRAL;
  3823.  #endif
  3824.      }
  3825.  
  3826. -    if (skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS)
  3827. +    if (skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS)
  3828.          return wd; //Enough, rest is not needed.
  3829.  
  3830.      if (sd) {
  3831. -        if (skill_num != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus.
  3832. +        if (skill_id != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus.
  3833.              ATK_ADD2(wd.div_*sd->right_weapon.star, wd.div_*sd->left_weapon.star);
  3834. -        if (skill_num==MO_FINGEROFFENSIVE) { //The finger offensive spheres on moment of attack do count. [Skotlex]
  3835. +        if (skill_id==MO_FINGEROFFENSIVE) { //The finger offensive spheres on moment of attack do count. [Skotlex]
  3836.              ATK_ADD(wd.div_*sd->spiritball_old*3);
  3837.          } else {
  3838.              ATK_ADD(wd.div_*sd->spiritball*3);
  3839. @@ -3315,7 +3315,7 @@
  3840.          if( flag.lh )
  3841.              wd.damage2 = battle_calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag);
  3842.  
  3843. -        if (skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN) {
  3844. +        if (skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN) {
  3845.              //Refine bonus applies after cards and elements.
  3846.              short index= sd->equip_index[EQI_HAND_L];
  3847.              if (index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR)
  3848. @@ -3337,10 +3337,10 @@
  3849.          if (flag.hit && class_ == MOBID_EMPERIUM) {
  3850.              if (wd.damage2 > 0) {
  3851.                  wd.damage2 = battle_attr_fix(src,target,wd.damage2,s_ele_,tstatus->def_ele, tstatus->ele_lv);
  3852. -                wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
  3853. +                wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_id,skill_lv,wd.flag);
  3854.              } else if (wd.damage > 0) {
  3855.                  wd.damage = battle_attr_fix(src,target,wd.damage,s_ele_,tstatus->def_ele, tstatus->ele_lv);
  3856. -                wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
  3857. +                wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag);
  3858.              }
  3859.              return wd;
  3860.          }
  3861. @@ -3370,7 +3370,7 @@
  3862.                      wd.damage2 = wd.damage2 * (50 + (skill * 10))/100;
  3863.                  if (wd.damage2 < 1) wd.damage2 = 1;
  3864.              }
  3865. -        } else if (sd->status.weapon == W_KATAR && !skill_num) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2)
  3866. +        } else if (sd->status.weapon == W_KATAR && !skill_id) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2)
  3867.              skill = pc_checkskill(sd,TF_DOUBLE);
  3868.              wd.damage2 = wd.damage * (1 + (skill * 2))/100;
  3869.  
  3870. @@ -3388,24 +3388,24 @@
  3871.      if (wd.damage + wd.damage2) {
  3872.          //There is a total damage value
  3873.          if (!wd.damage2) {
  3874. -            wd.damage = battle_calc_damage(src,target,&wd,wd.damage,skill_num,skill_lv);
  3875. +            wd.damage = battle_calc_damage(src,target,&wd,wd.damage,skill_id,skill_lv);
  3876.              if (map_flag_gvg2(target->m))
  3877. -                wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
  3878. +                wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag);
  3879.              else if (map[target->m].flag.battleground)
  3880. -                wd.damage=battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
  3881. +                wd.damage=battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag);
  3882.          } else if (!wd.damage) {
  3883. -            wd.damage2 = battle_calc_damage(src,target,&wd,wd.damage2,skill_num,skill_lv);
  3884. +            wd.damage2 = battle_calc_damage(src,target,&wd,wd.damage2,skill_id,skill_lv);
  3885.              if (map_flag_gvg2(target->m))
  3886. -                wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
  3887. +                wd.damage2 = battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_id,skill_lv,wd.flag);
  3888.              else if (map[target->m].flag.battleground)
  3889. -                wd.damage = battle_calc_bg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
  3890. +                wd.damage = battle_calc_bg_damage(src,target,wd.damage2,wd.div_,skill_id,skill_lv,wd.flag);
  3891.          } else {
  3892.              int d1 = wd.damage + wd.damage2,d2 = wd.damage2;
  3893. -            wd.damage = battle_calc_damage(src,target,&wd,d1,skill_num,skill_lv);
  3894. +            wd.damage = battle_calc_damage(src,target,&wd,d1,skill_id,skill_lv);
  3895.              if (map_flag_gvg2(target->m))
  3896. -                wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
  3897. +                wd.damage = battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag);
  3898.              else if (map[target->m].flag.battleground)
  3899. -                wd.damage = battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
  3900. +                wd.damage = battle_calc_bg_damage(src,target,wd.damage,wd.div_,skill_id,skill_lv,wd.flag);
  3901.              wd.damage2 = (d2*100/d1)*wd.damage/100;
  3902.              if (wd.damage > 1 && wd.damage2 < 1) wd.damage2 = 1;
  3903.              wd.damage-=wd.damage2;
  3904. @@ -3426,8 +3426,8 @@
  3905.          if (--(tsc->data[SC_REJECTSWORD]->val3) <= 0)
  3906.              status_change_end(target, SC_REJECTSWORD, INVALID_TIMER);
  3907.      }
  3908. -    if (skill_num == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?)
  3909. -        struct Damage md = battle_calc_misc_attack(src, target, skill_num, skill_lv, wflag);
  3910. +    if (skill_id == ASC_BREAKER) { //Breaker's int-based damage (a misc attack?)
  3911. +        struct Damage md = battle_calc_misc_attack(src, target, skill_id, skill_lv, wflag);
  3912.          wd.damage += md.damage;
  3913.      }
  3914.      if (sc) {
  3915. @@ -3445,7 +3445,7 @@
  3916.          /**
  3917.           * affecting non-skills
  3918.           **/
  3919. -        if (!skill_num) {
  3920. +        if (!skill_id) {
  3921.              /**
  3922.               * RK Enchant Blade
  3923.               **/
  3924. @@ -3456,8 +3456,8 @@
  3925.          }
  3926.          status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER);
  3927.      }
  3928. -    if (skill_num == LG_RAYOFGENESIS) {
  3929. -        struct Damage md = battle_calc_magic_attack(src, target, skill_num, skill_lv, wflag);
  3930. +    if (skill_id == LG_RAYOFGENESIS) {
  3931. +        struct Damage md = battle_calc_magic_attack(src, target, skill_id, skill_lv, wflag);
  3932.          wd.damage += md.damage;
  3933.      }
  3934.  
  3935. @@ -3467,7 +3467,7 @@
  3936.  /*==========================================
  3937.   * battle_calc_magic_attack [DracoRPG]
  3938.   *------------------------------------------*/
  3939. -struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag) {
  3940. +struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,uint16 skill_id,uint16 skill_lv,int mflag) {
  3941.      int i, nk;
  3942.      short s_ele = 0;
  3943.      unsigned int skillratio = 100;  //Skill dmg modifiers.
  3944. @@ -3490,19 +3490,19 @@
  3945.          return ad;
  3946.      }
  3947.      //Initial Values
  3948. -    ad.div_=skill_get_num(skill_num,skill_lv);
  3949. -    ad.amotion=skill_get_inf(skill_num) &INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills.
  3950. +    ad.div_=skill_get_num(skill_id,skill_lv);
  3951. +    ad.amotion=skill_get_inf(skill_id) &INF_GROUND_SKILL?0:sstatus->amotion; //Amotion should be 0 for ground skills.
  3952.      ad.dmotion=tstatus->dmotion;
  3953. -    ad.blewcount = skill_get_blewcount(skill_num,skill_lv);
  3954. +    ad.blewcount = skill_get_blewcount(skill_id,skill_lv);
  3955.      ad.flag=BF_MAGIC|BF_SKILL;
  3956.      ad.dmg_lv=ATK_DEF;
  3957. -    nk = skill_get_nk(skill_num);
  3958. +    nk = skill_get_nk(skill_id);
  3959.      flag.imdef = nk &NK_IGNORE_DEF?1:0;
  3960.  
  3961.      sd = BL_CAST(BL_PC, src);
  3962.  //    tsd = BL_CAST(BL_PC, target);
  3963.  
  3964. -    if (skill_num == SO_PSYCHIC_WAVE) {
  3965. +    if (skill_id == SO_PSYCHIC_WAVE) {
  3966.          struct status_change *sc = status_get_sc(src);
  3967.          if (sc && sc->count && (sc->data[SC_HEATER_OPTION] || sc->data[SC_COOLER_OPTION] ||
  3968.                                  sc->data[SC_BLAST_OPTION] || sc->data[SC_CURSED_SOIL_OPTION])) {
  3969. @@ -3514,7 +3514,7 @@
  3970.              //#HALP# I didn't get a clue on how to do this without unnecessary adding a overhead of status_change on every call while this is a per-skill case.
  3971.              //, - so i duplicated this code. make yourself comfortable to fix if you have any better ideas.
  3972.              //Initialize variables that will be used afterwards
  3973. -            s_ele = skill_get_ele(skill_num, skill_lv);
  3974. +            s_ele = skill_get_ele(skill_id, skill_lv);
  3975.  
  3976.              if (s_ele == -1) // pl=-1 : the skill takes the weapon's element
  3977.                  s_ele = sstatus->rhw.ele;
  3978. @@ -3525,7 +3525,7 @@
  3979.          }
  3980.      } else {
  3981.          //Initialize variables that will be used afterwards
  3982. -        s_ele = skill_get_ele(skill_num, skill_lv);
  3983. +        s_ele = skill_get_ele(skill_id, skill_lv);
  3984.  
  3985.          if (s_ele == -1) { // pl=-1 : the skill takes the weapon's element
  3986.              s_ele = sstatus->rhw.ele;
  3987. @@ -3541,11 +3541,11 @@
  3988.      //Set miscellaneous data that needs be filled
  3989.      if (sd) {
  3990.          sd->state.arrow_atk = 0;
  3991. -        ad.blewcount += battle_blewcount_bonus(sd, skill_num);
  3992. +        ad.blewcount += battle_blewcount_bonus(sd, skill_id);
  3993.      }
  3994.  
  3995.      //Skill Range Criteria
  3996. -    ad.flag |= battle_range_type(src, target, skill_num, skill_lv);
  3997. +    ad.flag |= battle_range_type(src, target, skill_id, skill_lv);
  3998.      flag.infdef=(tstatus->mode&MD_PLANT?1:0);
  3999.      if (target->type == BL_SKILL) {
  4000.          TBL_SKILL *su = (TBL_SKILL *)target;
  4001. @@ -3553,7 +3553,7 @@
  4002.              flag.infdef = 1;
  4003.      }
  4004.  
  4005. -    switch (skill_num) {
  4006. +    switch (skill_id) {
  4007.          case MG_FIREWALL:
  4008.          case NJ_KAENSIN:
  4009.              ad.dmotion = 0; //No flinch animation.
  4010. @@ -3574,7 +3574,7 @@
  4011.          //Adds an absolute value to damage. 100 = +100 damage
  4012.  #define MATK_ADD( a ) { ad.damage+= a; }
  4013.  
  4014. -        switch (skill_num) {
  4015. +        switch (skill_id) {
  4016.                  //Calc base damage according to skill
  4017.              case AL_HEAL:
  4018.              case PR_BENEDICTIO:
  4019. @@ -3583,7 +3583,7 @@
  4020.                   * Arch Bishop
  4021.                   **/
  4022.              case AB_HIGHNESSHEAL:
  4023. -                ad.damage = skill_calc_heal(src, target, skill_num, skill_lv, false);
  4024. +                ad.damage = skill_calc_heal(src, target, skill_id, skill_lv, false);
  4025.                  break;
  4026.              case PR_ASPERSIO:
  4027.                  ad.damage = 40;
  4028. @@ -3635,10 +3635,10 @@
  4029.                          if (mflag>0)
  4030.                              ad.damage/= mflag;
  4031.                          else
  4032. -                            ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num));
  4033. +                            ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id));
  4034.                      }
  4035.  
  4036. -                    switch (skill_num) {
  4037. +                    switch (skill_id) {
  4038.                          case MG_NAPALMBEAT:
  4039.                              skillratio += skill_lv*10-30;
  4040.                              break;
  4041. @@ -4031,7 +4031,7 @@
  4042.                      MATK_RATE(skillratio);
  4043.  
  4044.                      //Constant/misc additions from skills
  4045. -                    if (skill_num == WZ_FIREPILLAR)
  4046. +                    if (skill_id == WZ_FIREPILLAR)
  4047.                          MATK_ADD(50);
  4048.                  }
  4049.          }
  4050. @@ -4040,7 +4040,7 @@
  4051.  #endif
  4052.          if (sd) {
  4053.              //Damage bonuses
  4054. -            if ((i = pc_skillatk_bonus(sd, skill_num)))
  4055. +            if ((i = pc_skillatk_bonus(sd, skill_id)))
  4056.                  ad.damage += ad.damage*i/100;
  4057.  
  4058.              //Ignore Defense?
  4059. @@ -4080,13 +4080,13 @@
  4060.  #endif
  4061.          }
  4062.  
  4063. -        if (skill_num == NPC_EARTHQUAKE) {
  4064. +        if (skill_id == NPC_EARTHQUAKE) {
  4065.              //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex]
  4066.              //Also divide the extra bonuses from atk2 based on the number in range [Kevin]
  4067.              if (mflag>0)
  4068.                  ad.damage+= (sstatus->rhw.atk2*skillratio/100)/mflag;
  4069.              else
  4070. -                ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num));
  4071. +                ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id));
  4072.          }
  4073.  
  4074.          if (ad.damage<1)
  4075. @@ -4095,9 +4095,9 @@
  4076.          if (!(nk&NK_NO_ELEFIX))
  4077.              ad.damage=battle_attr_fix(src, target, ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
  4078.  
  4079. -        if (skill_num == CR_GRANDCROSS || skill_num == NPC_GRANDDARKNESS) {
  4080. +        if (skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS) {
  4081.              //Apply the physical part of the skill's damage. [Skotlex]
  4082. -            struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag);
  4083. +            struct Damage wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag);
  4084.              ad.damage = battle_attr_fix(src, target, wd.damage + ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv) * (100 + 40*skill_lv)/100;
  4085.              if (src == target) {
  4086.                  if (src->type == BL_PC)
  4087. @@ -4117,15 +4117,15 @@
  4088.      if (flag.infdef && ad.damage)
  4089.          ad.damage = ad.damage>0?1:-1;
  4090.  
  4091. -    ad.damage=battle_calc_damage(src,target,&ad,ad.damage,skill_num,skill_lv);
  4092. +    ad.damage=battle_calc_damage(src,target,&ad,ad.damage,skill_id,skill_lv);
  4093.      if (map_flag_gvg2(target->m))
  4094. -        ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
  4095. +        ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_id,skill_lv,ad.flag);
  4096.      else if (map[target->m].flag.battleground)
  4097. -        ad.damage=battle_calc_bg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
  4098. +        ad.damage=battle_calc_bg_damage(src,target,ad.damage,ad.div_,skill_id,skill_lv,ad.flag);
  4099.  
  4100. -    switch (skill_num) {  /* post-calc modifiers */
  4101. +    switch (skill_id) {  /* post-calc modifiers */
  4102.          case SO_VARETYR_SPEAR: { // Physical damage.
  4103. -                struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag);
  4104. +                struct Damage wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag);
  4105.                  ad.damage += wd.damage;
  4106.                  break;
  4107.              }
  4108. @@ -4136,9 +4136,9 @@
  4109.  }
  4110.  
  4111.  /*==========================================
  4112. - * Calculate Misc dammage for skillid
  4113. + * Calculate Misc dammage for skill_id
  4114.   *------------------------------------------*/
  4115. -struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag) {
  4116. +struct Damage battle_calc_misc_attack(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, int mflag) {
  4117.      int skill;
  4118.      short i, nk;
  4119.      short s_ele;
  4120. @@ -4156,33 +4156,33 @@
  4121.      }
  4122.  
  4123.      //Some initial values
  4124. -    md.amotion=skill_get_inf(skill_num) &INF_GROUND_SKILL?0:sstatus->amotion;
  4125. +    md.amotion=skill_get_inf(skill_id) &INF_GROUND_SKILL?0:sstatus->amotion;
  4126.      md.dmotion=tstatus->dmotion;
  4127. -    md.div_=skill_get_num(skill_num,skill_lv);
  4128. -    md.blewcount=skill_get_blewcount(skill_num,skill_lv);
  4129. +    md.div_=skill_get_num(skill_id,skill_lv);
  4130. +    md.blewcount=skill_get_blewcount(skill_id,skill_lv);
  4131.      md.dmg_lv=ATK_DEF;
  4132.      md.flag=BF_MISC|BF_SKILL;
  4133.  
  4134. -    nk = skill_get_nk(skill_num);
  4135. +    nk = skill_get_nk(skill_id);
  4136.  
  4137.      sd = BL_CAST(BL_PC, src);
  4138.      tsd = BL_CAST(BL_PC, target);
  4139.  
  4140.      if (sd) {
  4141.          sd->state.arrow_atk = 0;
  4142. -        md.blewcount += battle_blewcount_bonus(sd, skill_num);
  4143. +        md.blewcount += battle_blewcount_bonus(sd, skill_id);
  4144.      }
  4145.  
  4146. -    s_ele = skill_get_ele(skill_num, skill_lv);
  4147. +    s_ele = skill_get_ele(skill_id, skill_lv);
  4148.      if (s_ele < 0 && s_ele != -3) //Attack that takes weapon's element for misc attacks? Make it neutral [Skotlex]
  4149.          s_ele = ELE_NEUTRAL;
  4150.      else if (s_ele == -3) //Use random element
  4151.          s_ele = rnd()%ELE_MAX;
  4152.  
  4153.      //Skill Range Criteria
  4154. -    md.flag |= battle_range_type(src, target, skill_num, skill_lv);
  4155. +    md.flag |= battle_range_type(src, target, skill_id, skill_lv);
  4156.  
  4157. -    switch (skill_num) {
  4158. +    switch (skill_id) {
  4159.  #ifdef RENEWAL
  4160.          case HT_LANDMINE:
  4161.          case MA_LANDMINE:
  4162. @@ -4213,7 +4213,7 @@
  4163.              if (mflag > 1) //Autocasted Blitz.
  4164.                  nk|=NK_SPLASHSPLIT;
  4165.  
  4166. -            if (skill_num == SN_FALCONASSAULT) {
  4167. +            if (skill_id == SN_FALCONASSAULT) {
  4168.                  //Div fix of Blitzbeat
  4169.                  skill = skill_get_num(HT_BLITZBEAT, 5);
  4170.                  damage_div_fix(md.damage, skill);
  4171. @@ -4259,11 +4259,11 @@
  4172.              break;
  4173.          case NJ_ZENYNAGE:
  4174.          case KO_MUCHANAGE:
  4175. -            md.damage = skill_get_zeny(skill_num ,skill_lv);
  4176. +            md.damage = skill_get_zeny(skill_id ,skill_lv);
  4177.              if (!md.damage) md.damage = 2;
  4178. -            md.damage = rand()%md.damage + md.damage / (skill_num==NJ_ZENYNAGE?1:2) ;
  4179. +            md.damage = rand()%md.damage + md.damage / (skill_id==NJ_ZENYNAGE?1:2) ;
  4180.              if (is_boss(target))
  4181. -                md.damage=md.damage / (skill_num==NJ_ZENYNAGE?3:2);
  4182. +                md.damage=md.damage / (skill_id==NJ_ZENYNAGE?3:2);
  4183.              else if (tsd) // need confirmation for KO_MUCHANAGE
  4184.                  md.damage=md.damage/2;
  4185.              break;
  4186. @@ -4282,7 +4282,7 @@
  4187.              md.dmotion = 0; //No flinch animation.
  4188.              break;
  4189.          case NPC_EVILLAND:
  4190. -            md.damage = skill_calc_heal(src,target,skill_num,skill_lv,false);
  4191. +            md.damage = skill_calc_heal(src,target,skill_id,skill_lv,false);
  4192.              break;
  4193.          case RK_DRAGONBREATH:
  4194.              md.damage = ((status_get_hp(src) / 50) + (status_get_max_sp(src) / 4)) * skill_lv;
  4195. @@ -4299,7 +4299,7 @@
  4196.              md.damage = skill_lv * sstatus->dex + sstatus->int_ * 5 ;
  4197.              RE_LVL_TMDMOD();
  4198.              md.damage = md.damage * (20 * (sd ? pc_checkskill(sd,RA_RESEARCHTRAP) : 10));
  4199. -            md.damage = (md.damage?md.damage:1) / (skill_num == RA_CLUSTERBOMB?50:100);
  4200. +            md.damage = (md.damage?md.damage:1) / (skill_id == RA_CLUSTERBOMB?50:100);
  4201.              break;
  4202.              /**
  4203.               * Mechanic
  4204. @@ -4319,7 +4319,7 @@
  4205.              md.damage = (skill_lv * status_get_lv(src) * 10) + (sstatus->int_ * 7 / 2) * (18 + (sd?sd->status.job_level:0) / 4) * (5 / (10 - (sd?pc_checkskill(sd,AM_CANNIBALIZE):0)));
  4206.              break;
  4207.          case KO_HAPPOKUNAI: {
  4208. -                struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag);
  4209. +                struct Damage wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag);
  4210.                  short totaldef = tstatus->def2 + (short)status_get_def(target);
  4211.                  md.damage = wd.damage * 60 * (5 + skill_lv) / 100;
  4212.                  md.damage -= totaldef;
  4213. @@ -4334,7 +4334,7 @@
  4214.          if (mflag>0)
  4215.              md.damage/= mflag;
  4216.          else
  4217. -            ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_num, skill_get_name(skill_num));
  4218. +            ShowError("0 enemies targeted by %d:%s, divide per 0 avoided!\n", skill_id, skill_get_name(skill_id));
  4219.      }
  4220.  
  4221.      damage_div_fix(md.damage, md.div_);
  4222. @@ -4383,13 +4383,13 @@
  4223.  
  4224.      md.damage =  battle_calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
  4225.  
  4226. -    if (sd && (i = pc_skillatk_bonus(sd, skill_num)))
  4227. +    if (sd && (i = pc_skillatk_bonus(sd, skill_id)))
  4228.          md.damage += md.damage *i/100;
  4229.  
  4230.      if (md.damage < 0)
  4231.          md.damage = 0;
  4232.      else if (md.damage && tstatus->mode &MD_PLANT) {
  4233. -        switch (skill_num) {
  4234. +        switch (skill_id) {
  4235.              case HT_LANDMINE:
  4236.              case MA_LANDMINE:
  4237.              case HT_BLASTMINE:
  4238. @@ -4410,19 +4410,19 @@
  4239.      if (!(nk &NK_NO_ELEFIX))
  4240.          md.damage=battle_attr_fix(src, target, md.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
  4241.  
  4242. -    md.damage=battle_calc_damage(src,target,&md,md.damage,skill_num,skill_lv);
  4243. +    md.damage=battle_calc_damage(src,target,&md,md.damage,skill_id,skill_lv);
  4244.      if (map_flag_gvg2(target->m))
  4245. -        md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);
  4246. +        md.damage=battle_calc_gvg_damage(src,target,md.damage,md.div_,skill_id,skill_lv,md.flag);
  4247.      else if (map[target->m].flag.battleground)
  4248. -        md.damage=battle_calc_bg_damage(src,target,md.damage,md.div_,skill_num,skill_lv,md.flag);
  4249. +        md.damage=battle_calc_bg_damage(src,target,md.damage,md.div_,skill_id,skill_lv,md.flag);
  4250.  
  4251. -    switch (skill_num) {
  4252. +    switch (skill_id) {
  4253.          case RA_FIRINGTRAP:
  4254.          case RA_ICEBOUNDTRAP:
  4255.              if (md.damage == 1) break;
  4256.          case RA_CLUSTERBOMB: {
  4257.                  struct Damage wd;
  4258. -                wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag);
  4259. +                wd = battle_calc_weapon_attack(src,target,skill_id,skill_lv,mflag);
  4260.                  md.damage += wd.damage;
  4261.              }
  4262.              break;
  4263. @@ -4440,17 +4440,17 @@
  4264.  /*==========================================
  4265.   * Battle main entry, from skill_attack
  4266.   *------------------------------------------*/
  4267. -struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int count) {
  4268. +struct Damage battle_calc_attack(int attack_type,struct block_list *bl, struct block_list *target, uint16 skill_id, uint16 skill_lv, int count) {
  4269.      struct Damage d;
  4270.      switch (attack_type) {
  4271.          case BF_WEAPON:
  4272. -            d = battle_calc_weapon_attack(bl,target,skill_num,skill_lv,count);
  4273. +            d = battle_calc_weapon_attack(bl,target,skill_id,skill_lv,count);
  4274.              break;
  4275.          case BF_MAGIC:
  4276. -            d = battle_calc_magic_attack(bl,target,skill_num,skill_lv,count);
  4277. +            d = battle_calc_magic_attack(bl,target,skill_id,skill_lv,count);
  4278.              break;
  4279.          case BF_MISC:
  4280. -            d = battle_calc_misc_attack(bl,target,skill_num,skill_lv,count);
  4281. +            d = battle_calc_misc_attack(bl,target,skill_id,skill_lv,count);
  4282.              break;
  4283.          default:
  4284.              ShowError("battle_calc_attack: unknown attack type! %d\n",attack_type);
  4285. @@ -4469,7 +4469,7 @@
  4286.  }
  4287.  
  4288.  //Calculates BF_WEAPON returned damage.
  4289. -int battle_calc_return_damage(struct block_list *bl, struct block_list *src, int *dmg, int flag, int skillid)
  4290. +int battle_calc_return_damage(struct block_list *bl, struct block_list *src, int *dmg, int flag, uint16 skill_id)
  4291.  {
  4292.      struct map_session_data *sd = NULL;
  4293.      int rdamage = 0, damage = *dmg;
  4294. @@ -4500,11 +4500,11 @@
  4295.              if (rdamage < 1) rdamage = 1;
  4296.          }
  4297.          if (sc && sc->count) {
  4298. -            if (sc->data[SC_REFLECTSHIELD] && skillid != WS_CARTTERMINATION) {
  4299. +            if (sc->data[SC_REFLECTSHIELD] && skill_id != WS_CARTTERMINATION) {
  4300.                  rdamage += damage * sc->data[SC_REFLECTSHIELD]->val2 / 100;
  4301.                  if (rdamage < 1) rdamage = 1;
  4302.              }
  4303. -            if (sc->data[SC_DEATHBOUND] && skillid != WS_CARTTERMINATION && !(src->type == BL_MOB && is_boss(src))) {
  4304. +            if (sc->data[SC_DEATHBOUND] && skill_id != WS_CARTTERMINATION && !(src->type == BL_MOB && is_boss(src))) {
  4305.                  int dir = map_calc_dir(bl,src->x,src->y),
  4306.                      t_dir = unit_getdir(bl), rd1 = 0;
  4307.  
  4308. @@ -4695,24 +4695,24 @@
  4309.          int t_dir = unit_getdir(target);
  4310.          int dist = distance_bl(src, target);
  4311.          if (dist <= 0 || (!map_check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1)) {
  4312. -            int skilllv = tsc->data[SC_AUTOCOUNTER]->val1;
  4313. +            uint16 skill_lv = tsc->data[SC_AUTOCOUNTER]->val1;
  4314.              clif_skillcastcancel(target); //Remove the casting bar. [Skotlex]
  4315.              clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
  4316.              status_change_end(target, SC_AUTOCOUNTER, INVALID_TIMER);
  4317. -            skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skilllv,tick,0);
  4318. +            skill_attack(BF_WEAPON,target,target,src,KN_AUTOCOUNTER,skill_lv,tick,0);
  4319.              return ATK_BLOCK;
  4320.          }
  4321.      }
  4322.  
  4323.      if (tsc && tsc->data[SC_BLADESTOP_WAIT] && !is_boss(src) && (src->type == BL_PC || tsd == NULL || distance_bl(src, target) <= (tsd->status.weapon == W_FIST ? 1 : 2))) {
  4324. -        int skilllv = tsc->data[SC_BLADESTOP_WAIT]->val1;
  4325. -        int duration = skill_get_time2(MO_BLADESTOP,skilllv);
  4326. +        uint16 skill_lv = tsc->data[SC_BLADESTOP_WAIT]->val1;
  4327. +        int duration = skill_get_time2(MO_BLADESTOP,skill_lv);
  4328.          status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
  4329.          if (sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration)) {
  4330.              //Target locked.
  4331.              clif_damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
  4332.              clif_bladestop(target, src->id, 1);
  4333. -            sc_start4(target, SC_BLADESTOP, 100, skilllv, 0, 0, src->id, duration);
  4334. +            sc_start4(target, SC_BLADESTOP, 100, skill_lv, 0, 0, src->id, duration);
  4335.              return ATK_BLOCK;
  4336.          }
  4337.      }
  4338. @@ -4732,7 +4732,7 @@
  4339.  
  4340.      if (sc) {
  4341.          if (sc->data[SC_SACRIFICE]) {
  4342. -            int skilllv = sc->data[SC_SACRIFICE]->val1;
  4343. +            uint16 skill_lv = sc->data[SC_SACRIFICE]->val1;
  4344.              damage_lv ret_val;
  4345.  
  4346.              if (--sc->data[SC_SACRIFICE]->val2 <= 0)
  4347. @@ -4742,7 +4742,7 @@
  4348.               * We need to calculate the DMG before the hp reduction, because it can kill the source.
  4349.               * For futher information: bugreport:4950
  4350.               **/
  4351. -            ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skilllv,tick,0);
  4352. +            ret_val = (damage_lv)skill_attack(BF_WEAPON,src,src,target,PA_SACRIFICE,skill_lv,tick,0);
  4353.  
  4354.              status_zap(src, sstatus->max_hp*9/100, 0);//Damage to self is always 9%
  4355.              if (ret_val == ATK_NONE)
  4356. @@ -4801,12 +4801,12 @@
  4357.      if (damage > 0 && src != target) {
  4358.          if (sc && sc->data[SC_DUPLELIGHT] && (wd.flag&BF_SHORT) && rnd()%100 <= 10+2*sc->data[SC_DUPLELIGHT]->val1) {
  4359.              // Activates it only from melee damage
  4360. -            int skillid;
  4361. +            uint16 skill_id;
  4362.              if (rnd()%2 == 1)
  4363. -                skillid = AB_DUPLELIGHT_MELEE;
  4364. +                skill_id = AB_DUPLELIGHT_MELEE;
  4365.              else
  4366. -                skillid = AB_DUPLELIGHT_MAGIC;
  4367. -            skill_attack(skill_get_type(skillid), src, src, target, skillid, sc->data[SC_DUPLELIGHT]->val1, tick, SD_LEVEL);
  4368. +                skill_id = AB_DUPLELIGHT_MAGIC;
  4369. +            skill_attack(skill_get_type(skill_id), src, src, target, skill_id, sc->data[SC_DUPLELIGHT]->val1, tick, SD_LEVEL);
  4370.          }
  4371.  
  4372.          rdamage = battle_calc_return_damage(target,src, &damage, wd.flag, 0);
  4373. @@ -4867,26 +4867,26 @@
  4374.      }
  4375.      if (sc && sc->data[SC_AUTOSPELL] && rnd()%100 < sc->data[SC_AUTOSPELL]->val4) {
  4376.          int sp = 0;
  4377. -        int skillid = sc->data[SC_AUTOSPELL]->val2;
  4378. -        int skilllv = sc->data[SC_AUTOSPELL]->val3;
  4379. +        uint16 skill_id = sc->data[SC_AUTOSPELL]->val2;
  4380. +        uint16 skill_lv = sc->data[SC_AUTOSPELL]->val3;
  4381.          int i = rnd()%100;
  4382.          if (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_SAGE)
  4383. -            i = 0; //Max chance, no skilllv reduction. [Skotlex]
  4384. -        if (i >= 50) skilllv -= 2;
  4385. -        else if (i >= 15) skilllv--;
  4386. -        if (skilllv < 1) skilllv = 1;
  4387. -        sp = skill_get_sp(skillid,skilllv) * 2 / 3;
  4388. +            i = 0; //Max chance, no skill_lv reduction. [Skotlex]
  4389. +        if (i >= 50) skill_lv -= 2;
  4390. +        else if (i >= 15) skill_lv--;
  4391. +        if (skill_lv < 1) skill_lv = 1;
  4392. +        sp = skill_get_sp(skill_id,skill_lv) * 2 / 3;
  4393.  
  4394.          if (status_charge(src, 0, sp)) {
  4395. -            switch (skill_get_casttype(skillid)) {
  4396. +            switch (skill_get_casttype(skill_id)) {
  4397.                  case CAST_GROUND:
  4398. -                    skill_castend_pos2(src, target->x, target->y, skillid, skilllv, tick, flag);
  4399. +                    skill_castend_pos2(src, target->x, target->y, skill_id, skill_lv, tick, flag);
  4400.                      break;
  4401.                  case CAST_NODAMAGE:
  4402. -                    skill_castend_nodamage_id(src, target, skillid, skilllv, tick, flag);
  4403. +                    skill_castend_nodamage_id(src, target, skill_id, skill_lv, tick, flag);
  4404.                      break;
  4405.                  case CAST_DAMAGE:
  4406. -                    skill_castend_damage_id(src, target, skillid, skilllv, tick, flag);
  4407. +                    skill_castend_damage_id(src, target, skill_id, skill_lv, tick, flag);
  4408.                      break;
  4409.              }
  4410.          }
  4411. @@ -5046,7 +5046,8 @@
  4412.   *------------------------------------------*/
  4413.  int battle_check_target(struct block_list *src, struct block_list *target,int flag)
  4414.  {
  4415. -    int m,state = 0; //Initial state none
  4416. +    short m;
  4417. +    int state = 0; //Initial state none
  4418.      int strip_enemy = 1; //Flag which marks whether to remove the BCT_ENEMY status if it's also friend/ally.
  4419.      struct block_list *s_bl = src, *t_bl = target;
  4420.  
  4421. Index: src/map/battle.h
  4422. --- src/map/battle.h Base (BASE)
  4423. +++ src/map/battle.h Locally Modified (Based On LOCAL)
  4424. @@ -33,9 +33,9 @@
  4425.  
  4426.  // Damage Calculation
  4427.  
  4428. -struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int count);
  4429. +struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int count);
  4430.  
  4431. -int battle_calc_return_damage(struct block_list *bl, struct block_list *src, int *, int flag, int skillid);
  4432. +int battle_calc_return_damage(struct block_list *bl, struct block_list *src, int *, int flag, uint16 skill_id);
  4433.  
  4434.  void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss);
  4435.  
  4436. @@ -44,9 +44,9 @@
  4437.  int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_list *target, int nk, int s_ele, int s_ele_, int damage, int left, int flag);
  4438.  
  4439.  // Final calculation Damage
  4440. -int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,int skill_num,int skill_lv);
  4441. -int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
  4442. -int battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
  4443. +int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 skill_lv);
  4444. +int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag);
  4445. +int battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,uint16 skill_id,uint16 skill_lv,int flag);
  4446.  
  4447.  enum {  // Flag of the final calculation
  4448.      BF_WEAPON   = 0x0001,
  4449. @@ -61,7 +61,7 @@
  4450.      BF_SKILLMASK= 0x0f00,
  4451.  };
  4452.  
  4453. -int battle_delay_damage(unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay);
  4454. +int battle_delay_damage(unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int damage, enum damage_lv dmg_lv, int ddelay);
  4455.  
  4456.  // Summary normal attack treatment (basic attack)
  4457.  enum damage_lv battle_weapon_attack(struct block_list *bl,struct block_list *target,unsigned int tick,int flag);
  4458. @@ -93,7 +93,7 @@
  4459.  int battle_check_target(struct block_list *src, struct block_list *target,int flag);
  4460.  bool battle_check_range(struct block_list *src,struct block_list *bl,int range);
  4461.  
  4462. -void battle_consume_ammo(struct map_session_data *sd, int skill, int lv);
  4463. +void battle_consume_ammo(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
  4464.  // Settings
  4465.  
  4466.  #define MIN_HAIR_STYLE battle_config.min_hair_style
  4467. @@ -493,7 +493,7 @@
  4468.  int battle_get_value(const char *w1);
  4469.  
  4470.  //
  4471. -struct block_list *battle_getenemyarea(struct block_list *src, int x, int y, int range, int type, int ignore_id);
  4472. +struct block_list *battle_getenemyarea(struct block_list *src, short x, short y, short range, int type, int ignore_id);
  4473.  /**
  4474.   * Royal Guard
  4475.   **/
  4476. Index: src/map/buyingstore.c
  4477. --- src/map/buyingstore.c Base (BASE)
  4478. +++ src/map/buyingstore.c Locally Modified (Based On LOCAL)
  4479. @@ -206,7 +206,7 @@
  4480.  }
  4481.  
  4482.  
  4483. -void buyingstore_open(struct map_session_data *sd, int account_id)
  4484. +void buyingstore_open(struct map_session_data *sd, uint32 account_id)
  4485.  {
  4486.      struct map_session_data *pl_sd;
  4487.  
  4488. @@ -236,7 +236,7 @@
  4489.  }
  4490.  
  4491.  
  4492. -void buyingstore_trade(struct map_session_data *sd, int account_id, unsigned int buyer_id, const uint8 *itemlist, unsigned int count)
  4493. +void buyingstore_trade(struct map_session_data *sd, uint32 account_id, unsigned int buyer_id, const uint8 *itemlist, unsigned int count)
  4494.  {
  4495.      int zeny = 0;
  4496.      unsigned int i, weight, listidx, k;
  4497. Index: src/map/buyingstore.h
  4498. --- src/map/buyingstore.h Base (BASE)
  4499. +++ src/map/buyingstore.h Locally Modified (Based On LOCAL)
  4500. @@ -23,8 +23,8 @@
  4501.  bool buyingstore_setup(struct map_session_data *sd, unsigned char slots);
  4502.  void buyingstore_create(struct map_session_data *sd, int zenylimit, unsigned char result, const char *storename, const uint8 *itemlist, unsigned int count);
  4503.  void buyingstore_close(struct map_session_data *sd);
  4504. -void buyingstore_open(struct map_session_data *sd, int account_id);
  4505. -void buyingstore_trade(struct map_session_data *sd, int account_id, unsigned int buyer_id, const uint8 *itemlist, unsigned int count);
  4506. +void buyingstore_open(struct map_session_data *sd, uint32 account_id);
  4507. +void buyingstore_trade(struct map_session_data *sd, uint32 account_id, unsigned int buyer_id, const uint8 *itemlist, unsigned int count);
  4508.  bool buyingstore_search(struct map_session_data *sd, unsigned short nameid);
  4509.  bool buyingstore_searchall(struct map_session_data *sd, const struct s_search_store_search *s);
  4510.  
  4511. Index: src/map/chrif.c
  4512. --- src/map/chrif.c Base (BASE)
  4513. +++ src/map/chrif.c Locally Modified (Based On LOCAL)
  4514. @@ -135,17 +135,17 @@
  4515.      runflag = CORE_ST_STOP;
  4516.  }
  4517.  
  4518. -struct auth_node *chrif_search(int account_id) {
  4519. +struct auth_node *chrif_search(uint32 account_id) {
  4520.      return (struct auth_node *)idb_get(auth_db, account_id);
  4521.  }
  4522.  
  4523. -struct auth_node *chrif_auth_check(int account_id, int char_id, enum sd_state state) {
  4524. +struct auth_node *chrif_auth_check(uint32 account_id, uint32 char_id, enum sd_state state) {
  4525.      struct auth_node *node = chrif_search(account_id);
  4526.  
  4527.      return (node && node->char_id == char_id && node->state == state) ? node : NULL;
  4528.  }
  4529.  
  4530. -bool chrif_auth_delete(int account_id, int char_id, enum sd_state state)
  4531. +bool chrif_auth_delete(uint32 account_id, uint32 char_id, enum sd_state state)
  4532.  {
  4533.      struct auth_node *node;
  4534.  
  4535. @@ -445,7 +445,7 @@
  4536.  
  4537.  /// map-server change request acknowledgement (positive or negative)
  4538.  /// R 2b06 <account_id>.L <login_id1>.L <login_id2>.L <char_id>.L <map_index>.W <x>.W <y>.W <ip>.L <port>.W
  4539. -int chrif_changemapserverack(int account_id, int login_id1, int login_id2, int char_id, short map_index, short x, short y, uint32 ip, uint16 port)
  4540. +int chrif_changemapserverack(uint32 account_id, uint32 login_id1, uint32 login_id2, uint32 char_id, short map_index, short x, short y, uint32 ip, uint16 port)
  4541.  {
  4542.      struct auth_node *node;
  4543.  
  4544. @@ -573,7 +573,7 @@
  4545.  /*==========================================
  4546.   * Request sc_data from charserver [Skotlex]
  4547.   *------------------------------------------*/
  4548. -int chrif_scdata_request(int account_id, int char_id)
  4549. +int chrif_scdata_request(uint32 account_id, uint32 char_id)
  4550.  {
  4551.  
  4552.  #ifdef ENABLE_SC_SAVING
  4553. @@ -617,8 +617,8 @@
  4554.   *------------------------------------------*/
  4555.  void chrif_authok(int fd)
  4556.  {
  4557. -    int account_id, group_id, char_id;
  4558. -    uint32 login_id1,login_id2;
  4559. +    uint32 account_id, char_id, login_id1, login_id2;
  4560. +    uint32 group_id;
  4561.      time_t expiration_time;
  4562.      struct mmo_charstatus *status;
  4563.      struct auth_node *node;
  4564. @@ -681,7 +681,7 @@
  4565.  // client authentication failed
  4566.  void chrif_authfail(int fd)  /* HELLO WORLD. ip in RFIFOL 15 is not being used (but is available) */
  4567.  {
  4568. -    int account_id, char_id;
  4569. +    uint32 account_id, char_id;
  4570.      uint32 login_id1;
  4571.      char sex;
  4572.      struct auth_node *node;
  4573. @@ -767,7 +767,7 @@
  4574.  /*==========================================
  4575.   * Search Char trough id on char serv
  4576.   *------------------------------------------*/
  4577. -int chrif_searchcharid(int char_id)
  4578. +int chrif_searchcharid(uint32 char_id)
  4579.  {
  4580.  
  4581.      if (!char_id)
  4582. @@ -865,15 +865,15 @@
  4583.   *   2: gm level too low
  4584.   *   3: login-server offline
  4585.   *------------------------------------------*/
  4586. -static void chrif_char_ask_name_answer(int acc, const char *player_name, uint16 type, uint16 answer)
  4587. +static void chrif_char_ask_name_answer(uint32 account_id, const char *player_name, uint16 type, uint16 answer)
  4588.  {
  4589.      struct map_session_data *sd;
  4590.      char action[25];
  4591.      char output[256];
  4592.  
  4593. -    sd = map_id2sd(acc);
  4594. +    sd = map_id2sd(account_id);
  4595.  
  4596. -    if (acc < 0 || sd == NULL) {
  4597. +    if (account_id < 0 || sd == NULL) {
  4598.          ShowError("chrif_char_ask_name_answer failed - player not online.\n");
  4599.          return;
  4600.      }
  4601. @@ -909,16 +909,18 @@
  4602.   *------------------------------------------*/
  4603.  int chrif_changedsex(int fd)
  4604.  {
  4605. -    int acc, sex, i;
  4606. +    uint32 account_id;
  4607. +    uint8 sex;
  4608. +    uint16 i;
  4609.      struct map_session_data *sd;
  4610.  
  4611. -    acc = RFIFOL(fd,2);
  4612. -    sex = RFIFOL(fd,6);
  4613. +    account_id = RFIFOL(fd,2);
  4614. +    sex = RFIFOB(fd,6);
  4615.  
  4616.      if (battle_config.etc_log)
  4617. -        ShowNotice("chrif_changedsex %d.\n", acc);
  4618. +        ShowNotice("chrif_changedsex %d.\n", account_id);
  4619.  
  4620. -    sd = map_id2sd(acc);
  4621. +    sd = map_id2sd(account_id);
  4622.      if (sd) {   //Normally there should not be a char logged on right now!
  4623.          if (sd->status.sex == sex)
  4624.              return 0; //Do nothing? Likely safe.
  4625. @@ -962,7 +964,7 @@
  4626.  /*==========================================
  4627.   * Request Char Server to Divorce Players
  4628.   *------------------------------------------*/
  4629. -int chrif_divorce(int partner_id1, int partner_id2)
  4630. +int chrif_divorce(uint32 partner_id1, uint32 partner_id2)
  4631.  {
  4632.      chrif_check(-1);
  4633.  
  4634. @@ -979,7 +981,7 @@
  4635.   * Divorce players
  4636.   * only used if 'partner_id' is offline
  4637.   *------------------------------------------*/
  4638. -int chrif_divorceack(int char_id, int partner_id)
  4639. +int chrif_divorceack(uint32 char_id, uint32 partner_id)
  4640.  {
  4641.      struct map_session_data *sd;
  4642.      int i;
  4643. @@ -1006,7 +1008,7 @@
  4644.  /*==========================================
  4645.   * Removes Baby from parents
  4646.   *------------------------------------------*/
  4647. -int chrif_deadopt(int father_id, int mother_id, int child_id)
  4648. +int chrif_deadopt(uint32 father_id, uint32 mother_id, uint32 child_id)
  4649.  {
  4650.      struct map_session_data *sd;
  4651.  
  4652. @@ -1077,7 +1079,7 @@
  4653.  int chrif_disconnectplayer(int fd)
  4654.  {
  4655.      struct map_session_data *sd;
  4656. -    int account_id = RFIFOL(fd, 2);
  4657. +    uint32 account_id = RFIFOL(fd, 2);
  4658.  
  4659.      sd = map_id2sd(account_id);
  4660.      if (sd == NULL) {
  4661. @@ -1351,7 +1353,7 @@
  4662.  
  4663.      return 0;
  4664.  }
  4665. -int chrif_char_offline_nsd(int account_id, int char_id)
  4666. +int chrif_char_offline_nsd(uint32 account_id, uint32 char_id)
  4667.  {
  4668.      chrif_check(-1);
  4669.  
  4670. @@ -1676,7 +1678,7 @@
  4671.  /*==========================================
  4672.   * Asks char server to remove friend_id from the friend list of char_id
  4673.   *------------------------------------------*/
  4674. -int chrif_removefriend(int char_id, int friend_id)
  4675. +int chrif_removefriend(uint32 char_id, uint32 friend_id)
  4676.  {
  4677.  
  4678.      chrif_check(-1);
  4679. Index: src/map/chrif.h
  4680. --- src/map/chrif.h Base (BASE)
  4681. +++ src/map/chrif.h Locally Modified (Based On LOCAL)
  4682. @@ -9,8 +9,9 @@
  4683.  
  4684.  enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE };
  4685.  struct auth_node {
  4686. -    int account_id, char_id;
  4687. -    int login_id1, login_id2, sex, fd;
  4688. +    uint32 account_id, char_id, login_id1, login_id2;
  4689. +    uint8 sex;
  4690. +    int fd;
  4691.      time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited)
  4692.      struct map_session_data *sd;    //Data from logged on char.
  4693.      struct mmo_charstatus *char_dat;    //Data from char server.
  4694. @@ -30,19 +31,19 @@
  4695.  extern int chrif_connected;
  4696.  extern int other_mapserver_count;
  4697.  
  4698. -struct auth_node *chrif_search(int account_id);
  4699. -struct auth_node *chrif_auth_check(int account_id, int char_id, enum sd_state state);
  4700. -bool chrif_auth_delete(int account_id, int char_id, enum sd_state state);
  4701. +struct auth_node *chrif_search(uint32 account_id);
  4702. +struct auth_node *chrif_auth_check(uint32 account_id, uint32 char_id, enum sd_state state);
  4703. +bool chrif_auth_delete(uint32 account_id, uint32 char_id, enum sd_state state);
  4704.  bool chrif_auth_finished(struct map_session_data *sd);
  4705.  
  4706.  void chrif_authreq(struct map_session_data *sd);
  4707.  void chrif_authok(int fd);
  4708. -int chrif_scdata_request(int account_id, int char_id);
  4709. +int chrif_scdata_request(uint32 account_id, uint32 char_id);
  4710.  int chrif_save(struct map_session_data *sd, int flag);
  4711.  int chrif_charselectreq(struct map_session_data *sd, uint32 s_ip);
  4712.  int chrif_changemapserver(struct map_session_data *sd, uint32 ip, uint16 port);
  4713.  
  4714. -int chrif_searchcharid(int char_id);
  4715. +int chrif_searchcharid(uint32 char_id);
  4716.  int chrif_changeemail(int id, const char *actual_email, const char *new_email);
  4717.  int chrif_char_ask_name(int acc, const char *character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second);
  4718.  int chrif_updatefamelist(struct map_session_data *sd);
  4719. @@ -50,15 +51,15 @@
  4720.  int chrif_save_scdata(struct map_session_data *sd);
  4721.  int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate);
  4722.  int chrif_char_offline(struct map_session_data *sd);
  4723. -int chrif_char_offline_nsd(int account_id, int char_id);
  4724. +int chrif_char_offline_nsd(uint32 account_id, uint32 char_id);
  4725.  int chrif_char_reset_offline(void);
  4726.  int send_users_tochar(void);
  4727.  int chrif_char_online(struct map_session_data *sd);
  4728.  int chrif_changesex(struct map_session_data *sd);
  4729.  int chrif_chardisconnect(struct map_session_data *sd);
  4730. -int chrif_divorce(int partner_id1, int partner_id2);
  4731. +int chrif_divorce(uint32 partner_id1, uint32 partner_id2);
  4732.  
  4733. -int chrif_removefriend(int char_id, int friend_id);
  4734. +int chrif_removefriend(uint32 char_id, uint32 friend_id);
  4735.  void chrif_send_report(char *buf, int len);
  4736.  
  4737.  int do_final_chrif(void);
  4738. Index: src/map/clif.c
  4739. --- src/map/clif.c Base (BASE)
  4740. +++ src/map/clif.c Locally Modified (Based On LOCAL)
  4741. @@ -1209,7 +1209,7 @@
  4742.  /// 01b0 <id>.L <type>.B <value>.L
  4743.  /// type:
  4744.  ///     unused
  4745. -void clif_class_change(struct block_list *bl,int class_,int type)
  4746. +void clif_class_change(struct block_list *bl,short class_,int type)
  4747.  {
  4748.      unsigned char buf[16];
  4749.  
  4750. @@ -1257,7 +1257,7 @@
  4751.   *------------------------------------------*/
  4752.  static void clif_weather_check(struct map_session_data *sd)
  4753.  {
  4754. -    int m = sd->bl.m, fd = sd->fd;
  4755. +    short m = sd->bl.m, fd = sd->fd;
  4756.  
  4757.      if (map[m].flag.snow
  4758.          || map[m].flag.clouds
  4759. @@ -1297,7 +1297,7 @@
  4760.  /**
  4761.   * Run when the weather on a map changes, throws all players in map id 'm' to clif_weather_check function
  4762.   **/
  4763. -void clif_weather(int m)
  4764. +void clif_weather(short m)
  4765.  {
  4766.      struct s_mapiterator *iter;
  4767.      struct map_session_data *sd=NULL;
  4768. @@ -1509,24 +1509,24 @@
  4769.      return 0;
  4770.  }
  4771.  
  4772. -void clif_homskillup(struct map_session_data *sd, int skill_num)
  4773. +void clif_homskillup(struct map_session_data *sd, uint16 skill_id)
  4774.  {
  4775.      //[orn]
  4776.      struct homun_data *hd;
  4777. -    int fd, skillid;
  4778. +    int fd, skill_idx;
  4779.      nullpo_retv(sd);
  4780. -    skillid = skill_num - HM_SKILLBASE;
  4781. +    skill_idx = skill_id - HM_SKILLBASE;
  4782.  
  4783.      fd=sd->fd;
  4784.      hd=sd->hd;
  4785.  
  4786.      WFIFOHEAD(fd, packet_len(0x239));
  4787.      WFIFOW(fd,0) = 0x239;
  4788. -    WFIFOW(fd,2) = skill_num;
  4789. -    WFIFOW(fd,4) = hd->homunculus.hskill[skillid].lv;
  4790. -    WFIFOW(fd,6) = skill_get_sp(skill_num,hd->homunculus.hskill[skillid].lv);
  4791. -    WFIFOW(fd,8) = skill_get_range2(&hd->bl, skill_num,hd->homunculus.hskill[skillid].lv);
  4792. -    WFIFOB(fd,10) = (hd->homunculus.hskill[skillid].lv < skill_get_max(hd->homunculus.hskill[skillid].id)) ? 1 : 0;
  4793. +    WFIFOW(fd,2) = skill_id;
  4794. +    WFIFOW(fd,4) = hd->homunculus.hskill[skill_idx].lv;
  4795. +    WFIFOW(fd,6) = skill_get_sp(skill_id,hd->homunculus.hskill[skill_idx].lv);
  4796. +    WFIFOW(fd,8) = skill_get_range2(&hd->bl, skill_id,hd->homunculus.hskill[skill_idx].lv);
  4797. +    WFIFOB(fd,10) = (hd->homunculus.hskill[skill_idx].lv < skill_get_max(hd->homunculus.hskill[skill_idx].id)) ? 1 : 0;
  4798.      WFIFOSET(fd,packet_len(0x239));
  4799.  }
  4800.  
  4801. @@ -4283,7 +4283,7 @@
  4802.  
  4803.  /// Inform client(s) about a map-cell change (ZC_UPDATE_MAPINFO).
  4804.  /// 0192 <x>.W <y>.W <type>.W <map name>.16B
  4805. -void clif_changemapcell(int fd, int m, int x, int y, int type, enum send_target target)
  4806. +void clif_changemapcell(int fd, short m, short x, short y, int type, enum send_target target)
  4807.  {
  4808.      unsigned char buf[32];
  4809.  
  4810. @@ -4646,7 +4646,7 @@
  4811.  
  4812.  /// Updates a skill in the skill tree (ZC_SKILLINFO_UPDATE).
  4813.  /// 010e <skill id>.W <level>.W <sp cost>.W <attack range>.W <upgradable>.B
  4814. -void clif_skillup(struct map_session_data *sd,int skill_num)
  4815. +void clif_skillup(struct map_session_data *sd, uint16 skill_id)
  4816.  {
  4817.      int fd;
  4818.  
  4819. @@ -4655,11 +4655,11 @@
  4820.      fd=sd->fd;
  4821.      WFIFOHEAD(fd,packet_len(0x10e));
  4822.      WFIFOW(fd,0) = 0x10e;
  4823. -    WFIFOW(fd,2) = skill_num;
  4824. -    WFIFOW(fd,4) = sd->status.skill[skill_num].lv;
  4825. -    WFIFOW(fd,6) = skill_get_sp(skill_num,sd->status.skill[skill_num].lv);
  4826. -    WFIFOW(fd,8) = skill_get_range2(&sd->bl,skill_num,sd->status.skill[skill_num].lv);
  4827. -    WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_tree_get_max(sd->status.skill[skill_num].id, sd->status.class_)) ? 1 : 0;
  4828. +    WFIFOW(fd,2) = skill_id;
  4829. +    WFIFOW(fd,4) = sd->status.skill[skill_id].lv;
  4830. +    WFIFOW(fd,6) = skill_get_sp(skill_id,sd->status.skill[skill_id].lv);
  4831. +    WFIFOW(fd,8) = skill_get_range2(&sd->bl,skill_id,sd->status.skill[skill_id].lv);
  4832. +    WFIFOB(fd,10) = (sd->status.skill[skill_id].lv < skill_tree_get_max(sd->status.skill[skill_id].id, sd->status.class_)) ? 1 : 0;
  4833.      WFIFOSET(fd,packet_len(0x10e));
  4834.  }
  4835.  
  4836. @@ -4700,7 +4700,7 @@
  4837.  /// is disposable:
  4838.  ///     0 = yellow chat text "[src name] will use skill [skill name]."
  4839.  ///     1 = no text
  4840. -void clif_skillcasting(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, int skill_num, int property, int casttime)
  4841. +void clif_skillcasting(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime)
  4842.  {
  4843.  #if PACKETVER < 20091124
  4844.      const int cmd = 0x13e;
  4845. @@ -4714,7 +4714,7 @@
  4846.      WBUFL(buf,6) = dst_id;
  4847.      WBUFW(buf,10) = dst_x;
  4848.      WBUFW(buf,12) = dst_y;
  4849. -    WBUFW(buf,14) = skill_num;
  4850. +    WBUFW(buf,14) = skill_id;
  4851.      WBUFL(buf,16) = property<0?0:property; //Avoid sending negatives as element [Skotlex]
  4852.      WBUFL(buf,20) = casttime;
  4853.  #if PACKETVER >= 20091124
  4854. @@ -4767,7 +4767,7 @@
  4855.  /// if(result!=0) doesn't display any of the previous messages
  4856.  /// Note: when this packet is received an unknown flag is always set to 0,
  4857.  /// suggesting this is an ACK packet for the UseSkill packets and should be sent on success too [FlavioJS]
  4858. -void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail_cause cause,int btype)
  4859. +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype)
  4860.  {
  4861.      int fd;
  4862.  
  4863. @@ -4803,7 +4803,7 @@
  4864.  
  4865.  /// Skill cooldown display icon (ZC_SKILL_POSTDELAY).
  4866.  /// 043d <skill ID>.W <tick>.L
  4867. -void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int tick)
  4868. +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick)
  4869.  {
  4870.  #if PACKETVER>=20081112
  4871.      int fd;
  4872. @@ -4813,7 +4813,7 @@
  4873.      fd=sd->fd;
  4874.      WFIFOHEAD(fd,packet_len(0x43d));
  4875.      WFIFOW(fd,0) = 0x43d;
  4876. -    WFIFOW(fd,2) = skillid;
  4877. +    WFIFOW(fd,2) = skill_id;
  4878.      WFIFOL(fd,4) = tick;
  4879.      WFIFOSET(fd,packet_len(0x43d));
  4880.  #endif
  4881. @@ -4823,7 +4823,7 @@
  4882.  /// Skill attack effect and damage.
  4883.  /// 0114 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.W <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL)
  4884.  /// 01de <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <damage>.L <level>.W <div>.W <type>.B (ZC_NOTIFY_SKILL2)
  4885. -int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type)
  4886. +int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type)
  4887.  {
  4888.      unsigned char buf[64];
  4889.      struct status_change *sc;
  4890. @@ -4910,7 +4910,7 @@
  4891.  /// Ground skill attack effect and damage (ZC_NOTIFY_SKILL_POSITION).
  4892.  /// 0115 <skill id>.W <src id>.L <dst id>.L <tick>.L <src delay>.L <dst delay>.L <x>.W <y>.W <damage>.W <level>.W <div>.W <type>.B
  4893.  /*
  4894. -int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type)
  4895. +int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type)
  4896.  {
  4897.      unsigned char buf[64];
  4898.      struct status_change *sc;
  4899. @@ -4968,7 +4968,7 @@
  4900.  
  4901.  /// Non-damaging skill effect (ZC_USE_SKILL).
  4902.  /// 011a <skill id>.W <skill lv>.W <dst id>.L <src id>.L <result>.B
  4903. -int clif_skill_nodamage(struct block_list *src,struct block_list *dst,int skill_id,int heal,int fail)
  4904. +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail)
  4905.  {
  4906.      unsigned char buf[32];
  4907.  
  4908. @@ -5001,7 +5001,7 @@
  4909.  
  4910.  /// Non-damaging ground skill effect (ZC_NOTIFY_GROUNDSKILL).
  4911.  /// 0117 <skill id>.W <src id>.L <level>.W <x>.W <y>.W <tick>.L
  4912. -void clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y,int tick)
  4913. +void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,short x,short y,int tick)
  4914.  {
  4915.      unsigned char buf[32];
  4916.  
  4917. @@ -5069,7 +5069,7 @@
  4918.  
  4919.  /// Presents a list of available warp destinations (ZC_WARPLIST).
  4920.  /// 011c <skill id>.W { <map name>.16B }*4
  4921. -void clif_skill_warppoint(struct map_session_data *sd, short skill_num, short skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4)
  4922. +void clif_skill_warppoint(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4)
  4923.  {
  4924.      int fd;
  4925.      nullpo_retv(sd);
  4926. @@ -5077,7 +5077,7 @@
  4927.  
  4928.      WFIFOHEAD(fd,packet_len(0x11c));
  4929.      WFIFOW(fd,0) = 0x11c;
  4930. -    WFIFOW(fd,2) = skill_num;
  4931. +    WFIFOW(fd,2) = skill_id;
  4932.      memset(WFIFOP(fd,4), 0x00, 4*MAP_NAME_LENGTH_EXT);
  4933.      if (map1 == (unsigned short)-1) strcpy((char *)WFIFOP(fd,4), "Random");
  4934.      else // normal map name
  4935. @@ -5087,8 +5087,8 @@
  4936.      if (map4 > 0) mapindex_getmapname_ext(mapindex_id2name(map4), (char *)WFIFOP(fd,52));
  4937.      WFIFOSET(fd,packet_len(0x11c));
  4938.  
  4939. -    sd->menuskill_id = skill_num;
  4940. -    if (skill_num == AL_WARP)
  4941. +    sd->menuskill_id = skill_id;
  4942. +    if (skill_id == AL_WARP)
  4943.          sd->menuskill_val = (sd->ud.skillx<<16)|sd->ud.skilly; //Store warp position here.
  4944.      else
  4945.          sd->menuskill_val = skill_lv;
  4946. @@ -5181,15 +5181,15 @@
  4947.  /// 018d <packet len>.W { <name id>.W { <material id>.W }*3 }*
  4948.  /// material id:
  4949.  ///     unused by the client
  4950. -void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid , int trigger)
  4951. +void clif_skill_produce_mix_list(struct map_session_data *sd, uint16 skill_id , int trigger)
  4952.  {
  4953.      int i,c,view,fd;
  4954.      nullpo_retv(sd);
  4955.  
  4956. -    if (sd->menuskill_id == skillid)
  4957. +    if (sd->menuskill_id == skill_id)
  4958.          return; //Avoid resending the menu twice or more times...
  4959. -    if (skillid == GC_CREATENEWPOISON)
  4960. -        skillid = GC_RESEARCHNEWPOISON;
  4961. +    if (skill_id == GC_CREATENEWPOISON)
  4962. +        skill_id = GC_RESEARCHNEWPOISON;
  4963.  
  4964.      fd=sd->fd;
  4965.      WFIFOHEAD(fd, MAX_SKILL_PRODUCE_DB * 8 + 8);
  4966. @@ -5197,7 +5197,7 @@
  4967.  
  4968.      for (i=0,c=0; i<MAX_SKILL_PRODUCE_DB; i++) {
  4969.          if (skill_can_produce_mix(sd,skill_produce_db[i].nameid, trigger, 1) &&
  4970. -            ((skillid > 0 && skill_produce_db[i].req_skill == skillid) || skillid < 0)
  4971. +            ((skill_id > 0 && skill_produce_db[i].req_skill == skill_id) || skill_id < 0)
  4972.             ) {
  4973.              if ((view = itemdb_viewid(skill_produce_db[i].nameid)) > 0)
  4974.                  WFIFOW(fd,c*8+ 4)= view;
  4975. @@ -5212,7 +5212,7 @@
  4976.      WFIFOW(fd, 2)=c*8+8;
  4977.      WFIFOSET(fd,WFIFOW(fd,2));
  4978.      if (c > 0) {
  4979. -        sd->menuskill_id = skillid;
  4980. +        sd->menuskill_id = skill_id;
  4981.          sd->menuskill_val = trigger;
  4982.          return;
  4983.      }
  4984. @@ -5228,7 +5228,7 @@
  4985.  ///     4 = GN_MIX_COOKING
  4986.  ///     5 = GN_MAKEBOMB
  4987.  ///     6 = GN_S_PHARMACY
  4988. -void clif_cooking_list(struct map_session_data *sd, int trigger, int skill_id, int qty, int list_type)
  4989. +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type)
  4990.  {
  4991.      int fd;
  4992.      int i, c;
  4993. @@ -5795,7 +5795,7 @@
  4994.          sd->menuskill_val = dstsd->bl.id;
  4995.          sd->menuskill_val2 = lv;
  4996.      } else
  4997. -        clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
  4998. +        clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
  4999.  }
  5000.  
  5001.  
  5002. @@ -5843,13 +5843,13 @@
  5003.  {
  5004.      int i,c;
  5005.      int fd;
  5006. -    int skilllv;
  5007. +    uint16 skill_lv;
  5008.      int wlv;
  5009.      int refine_item[5];
  5010.  
  5011.      nullpo_retv(sd);
  5012.  
  5013. -    skilllv = pc_checkskill(sd,WS_WEAPONREFINE);
  5014. +    skill_lv = pc_checkskill(sd,WS_WEAPONREFINE);
  5015.  
  5016.      fd=sd->fd;
  5017.  
  5018. @@ -5861,7 +5861,7 @@
  5019.      WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4);
  5020.      WFIFOW(fd,0)=0x221;
  5021.      for (i=c=0; i<MAX_INVENTORY; i++) {
  5022. -        if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].refine < skilllv &&
  5023. +        if (sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].refine < skill_lv &&
  5024.              sd->status.inventory[i].identify && (wlv=itemdb_wlv(sd->status.inventory[i].nameid)) >=1 &&
  5025.              refine_item[wlv]!=-1 && !(sd->status.inventory[i].equip&EQP_ARMS)) {
  5026.              WFIFOW(fd,c*13+ 4)=i+2;
  5027. @@ -5875,14 +5875,14 @@
  5028.      WFIFOSET(fd,WFIFOW(fd,2));
  5029.      if (c > 0) {
  5030.          sd->menuskill_id = WS_WEAPONREFINE;
  5031. -        sd->menuskill_val = skilllv;
  5032. +        sd->menuskill_val = skill_lv;
  5033.      }
  5034.  }
  5035.  
  5036.  
  5037.  /// Notification of an auto-casted skill (ZC_AUTORUN_SKILL).
  5038.  /// 0147 <skill id>.W <type>.L <level>.W <sp cost>.W <atk range>.W <skill name>.24B <upgradable>.B
  5039. -void clif_item_skill(struct map_session_data *sd,int skillid,int skilllv)
  5040. +void clif_item_skill(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv)
  5041.  {
  5042.      int fd;
  5043.  
  5044. @@ -5891,13 +5891,13 @@
  5045.      fd=sd->fd;
  5046.      WFIFOHEAD(fd,packet_len(0x147));
  5047.      WFIFOW(fd, 0)=0x147;
  5048. -    WFIFOW(fd, 2)=skillid;
  5049. -    WFIFOW(fd, 4)=skill_get_inf(skillid);
  5050. +    WFIFOW(fd, 2)=skill_id;
  5051. +    WFIFOW(fd, 4)=skill_get_inf(skill_id);
  5052.      WFIFOW(fd, 6)=0;
  5053. -    WFIFOW(fd, 8)=skilllv;
  5054. -    WFIFOW(fd,10)=skill_get_sp(skillid,skilllv);
  5055. -    WFIFOW(fd,12)=skill_get_range2(&sd->bl, skillid,skilllv);
  5056. -    safestrncpy((char *)WFIFOP(fd,14),skill_get_name(skillid),NAME_LENGTH);
  5057. +    WFIFOW(fd, 8)=skill_lv;
  5058. +    WFIFOW(fd,10)=skill_get_sp(skill_id,skill_lv);
  5059. +    WFIFOW(fd,12)=skill_get_range2(&sd->bl, skill_id,skill_lv);
  5060. +    safestrncpy((char *)WFIFOP(fd,14),skill_get_name(skill_id),NAME_LENGTH);
  5061.      WFIFOB(fd,38)=0;
  5062.      WFIFOSET(fd,packet_len(0x147));
  5063.  }
  5064. @@ -6390,7 +6390,7 @@
  5065.  ///     1 = expel
  5066.  ///     2 = cannot leave party on this map
  5067.  ///     3 = cannot expel from party on this map
  5068. -void clif_party_withdraw(struct party_data *p, struct map_session_data *sd, int account_id, const char *name, int flag)
  5069. +void clif_party_withdraw(struct party_data *p, struct map_session_data *sd, uint32 account_id, const char *name, int flag)
  5070.  {
  5071.      unsigned char buf[64];
  5072.      int i;
  5073. @@ -6418,7 +6418,7 @@
  5074.  
  5075.  /// Party chat message (ZC_NOTIFY_CHAT_PARTY).
  5076.  /// 0109 <packet len>.W <account id>.L <message>.?B
  5077. -void clif_party_message(struct party_data *p, int account_id, const char *mes, int len)
  5078. +void clif_party_message(struct party_data *p, uint32 account_id, const char *mes, int len)
  5079.  {
  5080.      struct map_session_data *sd;
  5081.      int i;
  5082. @@ -6753,7 +6753,7 @@
  5083.  
  5084.  /// Presents a list of skills that can be auto-spelled (ZC_AUTOSPELLLIST).
  5085.  /// 01cd { <skill id>.L }*7
  5086. -void clif_autospell(struct map_session_data *sd,int skilllv)
  5087. +void clif_autospell(struct map_session_data *sd, uint16 skill_lv)
  5088.  {
  5089.      int fd;
  5090.  
  5091. @@ -6763,38 +6763,38 @@
  5092.      WFIFOHEAD(fd,packet_len(0x1cd));
  5093.      WFIFOW(fd, 0)=0x1cd;
  5094.  
  5095. -    if (skilllv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0)
  5096. +    if (skill_lv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0)
  5097.          WFIFOL(fd,2)= MG_NAPALMBEAT;
  5098.      else
  5099.          WFIFOL(fd,2)= 0x00000000;
  5100. -    if (skilllv>1 && pc_checkskill(sd,MG_COLDBOLT)>0)
  5101. +    if (skill_lv>1 && pc_checkskill(sd,MG_COLDBOLT)>0)
  5102.          WFIFOL(fd,6)= MG_COLDBOLT;
  5103.      else
  5104.          WFIFOL(fd,6)= 0x00000000;
  5105. -    if (skilllv>1 && pc_checkskill(sd,MG_FIREBOLT)>0)
  5106. +    if (skill_lv>1 && pc_checkskill(sd,MG_FIREBOLT)>0)
  5107.          WFIFOL(fd,10)= MG_FIREBOLT;
  5108.      else
  5109.          WFIFOL(fd,10)= 0x00000000;
  5110. -    if (skilllv>1 && pc_checkskill(sd,MG_LIGHTNINGBOLT)>0)
  5111. +    if (skill_lv>1 && pc_checkskill(sd,MG_LIGHTNINGBOLT)>0)
  5112.          WFIFOL(fd,14)= MG_LIGHTNINGBOLT;
  5113.      else
  5114.          WFIFOL(fd,14)= 0x00000000;
  5115. -    if (skilllv>4 && pc_checkskill(sd,MG_SOULSTRIKE)>0)
  5116. +    if (skill_lv>4 && pc_checkskill(sd,MG_SOULSTRIKE)>0)
  5117.          WFIFOL(fd,18)= MG_SOULSTRIKE;
  5118.      else
  5119.          WFIFOL(fd,18)= 0x00000000;
  5120. -    if (skilllv>7 && pc_checkskill(sd,MG_FIREBALL)>0)
  5121. +    if (skill_lv>7 && pc_checkskill(sd,MG_FIREBALL)>0)
  5122.          WFIFOL(fd,22)= MG_FIREBALL;
  5123.      else
  5124.          WFIFOL(fd,22)= 0x00000000;
  5125. -    if (skilllv>9 && pc_checkskill(sd,MG_FROSTDIVER)>0)
  5126. +    if (skill_lv>9 && pc_checkskill(sd,MG_FROSTDIVER)>0)
  5127.          WFIFOL(fd,26)= MG_FROSTDIVER;
  5128.      else
  5129.          WFIFOL(fd,26)= 0x00000000;
  5130.  
  5131.      WFIFOSET(fd,packet_len(0x1cd));
  5132.      sd->menuskill_id = SA_AUTOSPELL;
  5133. -    sd->menuskill_val = skilllv;
  5134. +    sd->menuskill_val = skill_lv;
  5135.  }
  5136.  
  5137.  
  5138. @@ -7475,7 +7475,7 @@
  5139.  /// Notifies clients of a guild of an expelled member.
  5140.  /// 015c <char name>.24B <reason>.40B <account name>.24B (ZC_ACK_BAN_GUILD)
  5141.  /// 0839 <char name>.24B <reason>.40B (ZC_ACK_BAN_GUILD_SSO)
  5142. -void clif_guild_expulsion(struct map_session_data *sd, const char *name, const char *mes, int account_id)
  5143. +void clif_guild_expulsion(struct map_session_data *sd, const char *name, const char *mes, uint32 account_id)
  5144.  {
  5145.      unsigned char buf[128];
  5146.  #if PACKETVER < 20100803
  5147. @@ -7540,7 +7540,7 @@
  5148.  
  5149.  /// Guild chat message (ZC_GUILD_CHAT).
  5150.  /// 017f <packet len>.W <message>.?B
  5151. -void clif_guild_message(struct guild *g,int account_id,const char *mes,int len)
  5152. +void clif_guild_message(struct guild *g,uint32 account_id,const char *mes,int len)
  5153.  {
  5154.      // TODO: account_id is not used, candidate for deletion? [Ai4rei]
  5155.      struct map_session_data *sd;
  5156. @@ -7563,9 +7563,9 @@
  5157.  
  5158.  
  5159.  /*==========================================
  5160. - * Server tells client 'sd' that his guild skill 'skill_num' gone to level 'lv'
  5161. + * Server tells client 'sd' that his guild skill 'skillid' gone to level 'lv'
  5162.   *------------------------------------------*/
  5163. -int clif_guild_skillup(struct map_session_data *sd,int skill_num,int lv)
  5164. +int clif_guild_skillup(struct map_session_data *sd, uint16 skill_id,int lv)
  5165.  {
  5166.      // TODO: Merge with clif_skillup (same packet).
  5167.      int fd;
  5168. @@ -7575,10 +7575,10 @@
  5169.      fd=sd->fd;
  5170.      WFIFOHEAD(fd,11);
  5171.      WFIFOW(fd,0) = 0x10e;
  5172. -    WFIFOW(fd,2) = skill_num;
  5173. +    WFIFOW(fd,2) = skill_id;
  5174.      WFIFOW(fd,4) = lv;
  5175. -    WFIFOW(fd,6) = skill_get_sp(skill_num,lv);
  5176. -    WFIFOW(fd,8) = skill_get_range(skill_num,lv);
  5177. +    WFIFOW(fd,6) = skill_get_sp(skill_id,lv);
  5178. +    WFIFOW(fd,8) = skill_get_range(skill_id,lv);
  5179.      WFIFOB(fd,10) = 1;
  5180.      WFIFOSET(fd,11);
  5181.      return 0;
  5182. @@ -7587,7 +7587,7 @@
  5183.  
  5184.  /// Request for guild alliance (ZC_REQ_ALLY_GUILD).
  5185.  /// 0171 <inviter account id>.L <guild name>.24B
  5186. -void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name)
  5187. +void clif_guild_reqalliance(struct map_session_data *sd,uint32 account_id,const char *name)
  5188.  {
  5189.      int fd;
  5190.  
  5191. @@ -7630,7 +7630,7 @@
  5192.  /// relation:
  5193.  ///     0 = Ally
  5194.  ///     1 = Enemy
  5195. -void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
  5196. +void clif_guild_delalliance(struct map_session_data *sd,uint32 guild_id,int flag)
  5197.  {
  5198.      int fd;
  5199.  
  5200. @@ -8538,7 +8538,7 @@
  5201.   * Info about Star Glaldiator hate mob [Komurka]
  5202.   * type: 1: Register mob, 0: Information.
  5203.   *------------------------------------------*/
  5204. -void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type)
  5205. +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,short class_, unsigned char type)
  5206.  {
  5207.      if (pcdb_checkid(class_)) {
  5208.          clif_starskill(sd, job_name(class_), class_, hate_level, type ? 10 : 11);
  5209. @@ -8709,7 +8709,7 @@
  5210.  ///
  5211.  /// NOTE: Message has following format and is printed in color 0xCDCDFF (purple):
  5212.  ///       "[SkillName] Message"
  5213. -void clif_msg_skill(struct map_session_data *sd, unsigned short skill_id, int msg_id)
  5214. +void clif_msg_skill(struct map_session_data *sd, uint16 skill_id, int msg_id)
  5215.  {
  5216.      int fd = sd->fd;
  5217.  
  5218. @@ -8909,7 +8909,9 @@
  5219.  {
  5220.      struct block_list *bl;
  5221.      struct auth_node *node;
  5222. -    int cmd, account_id, char_id, login_id1, sex;
  5223. +    int cmd;
  5224. +    uint32 account_id, char_id, login_id1;
  5225. +    uint8 sex;
  5226.      unsigned int client_tick; //The client tick is a tick, therefore it needs be unsigned. [Skotlex]
  5227.      int packet_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor])
  5228.  
  5229. @@ -10551,92 +10553,92 @@
  5230.      pc_skillup(sd,RFIFOW(fd,2));
  5231.  }
  5232.  
  5233. -static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, int target_id)
  5234. +static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
  5235.  {
  5236.      int lv;
  5237.  
  5238.      if (!hd)
  5239.          return;
  5240. -    if (skillnotok_hom(skillnum, hd))
  5241. +    if (skillnotok_hom(skill_id, hd))
  5242.          return;
  5243. -    if (hd->bl.id != target_id && skill_get_inf(skillnum)&INF_SELF_SKILL)
  5244. +    if (hd->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL)
  5245.          target_id = hd->bl.id;
  5246.      if (hd->ud.skilltimer != INVALID_TIMER) {
  5247. -        if (skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST) return;
  5248. +        if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return;
  5249.      } else if (DIFF_TICK(tick, hd->ud.canact_tick) < 0)
  5250.          return;
  5251.  
  5252. -    lv = merc_hom_checkskill(hd, skillnum);
  5253. -    if (skilllv > lv)
  5254. -        skilllv = lv;
  5255. -    if (skilllv)
  5256. -        unit_skilluse_id(&hd->bl, target_id, skillnum, skilllv);
  5257. +    lv = merc_hom_checkskill(hd, skill_id);
  5258. +    if (skill_lv > lv)
  5259. +        skill_lv = lv;
  5260. +    if (skill_lv)
  5261. +        unit_skilluse_id(&hd->bl, target_id, skill_id, skill_lv);
  5262.  }
  5263.  
  5264. -static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, short x, short y, int skillmoreinfo)
  5265. +static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
  5266.  {
  5267.      int lv;
  5268.      if (!hd)
  5269.          return;
  5270. -    if (skillnotok_hom(skillnum, hd))
  5271. +    if (skillnotok_hom(skill_id, hd))
  5272.          return;
  5273.      if (hd->ud.skilltimer != INVALID_TIMER) {
  5274. -        if (skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST) return;
  5275. +        if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return;
  5276.      } else if (DIFF_TICK(tick, hd->ud.canact_tick) < 0)
  5277.          return;
  5278.  
  5279.      if (hd->sc.data[SC_BASILICA])
  5280.          return;
  5281. -    lv = merc_hom_checkskill(hd, skillnum);
  5282. -    if (skilllv > lv)
  5283. -        skilllv = lv;
  5284. -    if (skilllv)
  5285. -        unit_skilluse_pos(&hd->bl, x, y, skillnum, skilllv);
  5286. +    lv = merc_hom_checkskill(hd, skill_id);
  5287. +    if (skill_lv > lv)
  5288. +        skill_lv = lv;
  5289. +    if (skill_lv)
  5290. +        unit_skilluse_pos(&hd->bl, x, y, skill_id, skill_lv);
  5291.  }
  5292.  
  5293. -static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, int target_id)
  5294. +static void clif_parse_UseSkillToId_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
  5295.  {
  5296.      int lv;
  5297.  
  5298.      if (!md)
  5299.          return;
  5300. -    if (skillnotok_mercenary(skillnum, md))
  5301. +    if (skillnotok_mercenary(skill_id, md))
  5302.          return;
  5303. -    if (md->bl.id != target_id && skill_get_inf(skillnum)&INF_SELF_SKILL)
  5304. +    if (md->bl.id != target_id && skill_get_inf(skill_id)&INF_SELF_SKILL)
  5305.          target_id = md->bl.id;
  5306.      if (md->ud.skilltimer != INVALID_TIMER) {
  5307. -        if (skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST) return;
  5308. +        if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST) return;
  5309.      } else if (DIFF_TICK(tick, md->ud.canact_tick) < 0)
  5310.          return;
  5311.  
  5312. -    lv = mercenary_checkskill(md, skillnum);
  5313. -    if (skilllv > lv)
  5314. -        skilllv = lv;
  5315. -    if (skilllv)
  5316. -        unit_skilluse_id(&md->bl, target_id, skillnum, skilllv);
  5317. +    lv = mercenary_checkskill(md, skill_id);
  5318. +    if (skill_lv > lv)
  5319. +        skill_lv = lv;
  5320. +    if (skill_lv)
  5321. +        unit_skilluse_id(&md->bl, target_id, skill_id, skill_lv);
  5322.  }
  5323.  
  5324. -static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, short x, short y, int skillmoreinfo)
  5325. +static void clif_parse_UseSkillToPos_mercenary(struct mercenary_data *md, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, short x, short y, int skillmoreinfo)
  5326.  {
  5327.      int lv;
  5328.      if (!md)
  5329.          return;
  5330. -    if (skillnotok_mercenary(skillnum, md))
  5331. +    if (skillnotok_mercenary(skill_id, md))
  5332.          return;
  5333.      if (md->ud.skilltimer != INVALID_TIMER)
  5334.          return;
  5335.      if (DIFF_TICK(tick, md->ud.canact_tick) < 0) {
  5336. -        clif_skill_fail(md->master, skillnum, USESKILL_FAIL_SKILLINTERVAL, 0);
  5337. +        clif_skill_fail(md->master, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0);
  5338.          return;
  5339.      }
  5340.  
  5341.      if (md->sc.data[SC_BASILICA])
  5342.          return;
  5343. -    lv = mercenary_checkskill(md, skillnum);
  5344. -    if (skilllv > lv)
  5345. -        skilllv = lv;
  5346. -    if (skilllv)
  5347. -        unit_skilluse_pos(&md->bl, x, y, skillnum, skilllv);
  5348. +    lv = mercenary_checkskill(md, skill_id);
  5349. +    if (skill_lv > lv)
  5350. +        skill_lv = lv;
  5351. +    if (skill_lv)
  5352. +        unit_skilluse_pos(&md->bl, x, y, skill_id, skill_lv);
  5353.  }
  5354.  
  5355.  
  5356. @@ -10646,39 +10648,39 @@
  5357.  /// There are various variants of this packet, some of them have padding between fields.
  5358.  void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
  5359.  {
  5360. -    short skillnum, skilllv;
  5361. +    uint16 skill_id, skill_lv;
  5362.      int tmp, target_id;
  5363.      unsigned int tick = gettick();
  5364.  
  5365. -    skilllv = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
  5366. -    skillnum = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
  5367. +    skill_lv = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
  5368. +    skill_id = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
  5369.      target_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[2]);
  5370.  
  5371. -    if (skilllv < 1) skilllv = 1;  //No clue, I have seen the client do this with guild skills :/ [Skotlex]
  5372. +    if (skill_lv < 1) skill_lv = 1;  //No clue, I have seen the client do this with guild skills :/ [Skotlex]
  5373.  
  5374. -    tmp = skill_get_inf(skillnum);
  5375. +    tmp = skill_get_inf(skill_id);
  5376.      if (tmp&INF_GROUND_SKILL || !tmp)
  5377.          return; //Using a ground/passive skill on a target? WRONG.
  5378.  
  5379. -    if (skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE + MAX_HOMUNSKILL) {
  5380. -        clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skillnum, skilllv, target_id);
  5381. +    if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL) {
  5382. +        clif_parse_UseSkillToId_homun(sd->hd, sd, tick, skill_id, skill_lv, target_id);
  5383.          return;
  5384.      }
  5385.  
  5386. -    if (skillnum >= MC_SKILLBASE && skillnum < MC_SKILLBASE + MAX_MERCSKILL) {
  5387. -        clif_parse_UseSkillToId_mercenary(sd->md, sd, tick, skillnum, skilllv, target_id);
  5388. +    if (skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL) {
  5389. +        clif_parse_UseSkillToId_mercenary(sd->md, sd, tick, skill_id, skill_lv, target_id);
  5390.          return;
  5391.      }
  5392.  
  5393.      // Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
  5394.      sd->idletime = last_tick;
  5395.  
  5396. -    if( pc_cant_act(sd) && skillnum != RK_REFRESH && !(skillnum == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) )
  5397. +    if( pc_cant_act(sd) && skill_id != RK_REFRESH && !(skill_id == SR_GENTLETOUCH_CURE && (sd->sc.opt1 == OPT1_STONE || sd->sc.opt1 == OPT1_FREEZE || sd->sc.opt1 == OPT1_STUN)) )
  5398.          return;
  5399.      if (pc_issit(sd))
  5400.          return;
  5401.  
  5402. -    if (skillnotok(skillnum, sd))
  5403. +    if (skillnotok(skill_id, sd))
  5404.          return;
  5405.  
  5406.      if (sd->bl.id != target_id && tmp&INF_SELF_SKILL)
  5407. @@ -10688,11 +10690,11 @@
  5408.          target_id = sd->bl.id;
  5409.  
  5410.      if (sd->ud.skilltimer != INVALID_TIMER) {
  5411. -        if (skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST)
  5412. +        if (skill_id != SA_CASTCANCEL && skill_id != SO_SPELLFIST)
  5413.              return;
  5414.      } else if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
  5415. -        if (sd->skillitem != skillnum) {
  5416. -            clif_skill_fail(sd, skillnum, USESKILL_FAIL_SKILLINTERVAL, 0);
  5417. +        if (sd->skillitem != skill_id) {
  5418. +            clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0);
  5419.              return;
  5420.          }
  5421.      }
  5422. @@ -10700,7 +10702,7 @@
  5423.      if (sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER))
  5424.          return;
  5425.  
  5426. -    if (sd->sc.data[SC_BASILICA] && (skillnum != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id))
  5427. +    if (sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id))
  5428.          return; // On basilica only caster can use Basilica again to stop it.
  5429.  
  5430.      if (sd->menuskill_id) {
  5431. @@ -10709,62 +10711,62 @@
  5432.          } else if (sd->menuskill_id != SA_AUTOSPELL)
  5433.              return; //Can't use skills while a menu is open.
  5434.      }
  5435. -    if (sd->skillitem == skillnum) {
  5436. -        if (skilllv != sd->skillitemlv)
  5437. -            skilllv = sd->skillitemlv;
  5438. +    if (sd->skillitem == skill_id) {
  5439. +        if (skill_lv != sd->skillitemlv)
  5440. +            skill_lv = sd->skillitemlv;
  5441.          if (!(tmp&INF_SELF_SKILL))
  5442.              pc_delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish]
  5443. -        unit_skilluse_id(&sd->bl, target_id, skillnum, skilllv);
  5444. +        unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
  5445.          return;
  5446.      }
  5447.  
  5448.      sd->skillitem = sd->skillitemlv = 0;
  5449.  
  5450. -    if (skillnum >= GD_SKILLBASE) {
  5451. +    if (skill_id >= GD_SKILLBASE) {
  5452.          if (sd->state.gmaster_flag)
  5453. -            skilllv = guild_checkskill(sd->state.gmaster_flag, skillnum);
  5454. +            skill_lv = guild_checkskill(sd->state.gmaster_flag, skill_id);
  5455.          else
  5456. -            skilllv = 0;
  5457. +            skill_lv = 0;
  5458.      } else {
  5459. -        tmp = pc_checkskill(sd, skillnum);
  5460. -        if (skilllv > tmp)
  5461. -            skilllv = tmp;
  5462. +        tmp = pc_checkskill(sd, skill_id);
  5463. +        if (skill_lv > tmp)
  5464. +            skill_lv = tmp;
  5465.      }
  5466.  
  5467.      pc_delinvincibletimer(sd);
  5468.  
  5469. -    if (skilllv)
  5470. -        unit_skilluse_id(&sd->bl, target_id, skillnum, skilllv);
  5471. +    if (skill_lv)
  5472. +        unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
  5473.  }
  5474.  
  5475.  /*==========================================
  5476. - * Client tells server he'd like to use AoE skill id 'skillnum' of level 'skilllv' on 'x','y' location
  5477. + * Client tells server he'd like to use AoE skill id 'skillid' of level 'skill_lv' on 'x','y' location
  5478.   *------------------------------------------*/
  5479. -static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, short skilllv, short skillnum, short x, short y, int skillmoreinfo)
  5480. +static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo)
  5481.  {
  5482.      unsigned int tick = gettick();
  5483.  
  5484. -    if (!(skill_get_inf(skillnum)&INF_GROUND_SKILL))
  5485. +    if (!(skill_get_inf(skill_id)&INF_GROUND_SKILL))
  5486.          return; //Using a target skill on the ground? WRONG.
  5487.  
  5488. -    if (skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE + MAX_HOMUNSKILL) {
  5489. -        clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skillnum, skilllv, x, y, skillmoreinfo);
  5490. +    if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE + MAX_HOMUNSKILL) {
  5491. +        clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo);
  5492.          return;
  5493.      }
  5494.  
  5495. -    if (skillnum >= MC_SKILLBASE && skillnum < MC_SKILLBASE + MAX_MERCSKILL) {
  5496. -        clif_parse_UseSkillToPos_mercenary(sd->md, sd, tick, skillnum, skilllv, x, y, skillmoreinfo);
  5497. +    if (skill_id >= MC_SKILLBASE && skill_id < MC_SKILLBASE + MAX_MERCSKILL) {
  5498. +        clif_parse_UseSkillToPos_mercenary(sd->md, sd, tick, skill_id, skill_lv, x, y, skillmoreinfo);
  5499.          return;
  5500.      }
  5501.  
  5502.      //Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
  5503.      sd->idletime = last_tick;
  5504.  
  5505. -    if (skillnotok(skillnum, sd))
  5506. +    if (skillnotok(skill_id, sd))
  5507.          return;
  5508.      if (skillmoreinfo != -1) {
  5509.          if (pc_issit(sd)) {
  5510. -            clif_skill_fail(sd, skillnum, USESKILL_FAIL_LEVEL, 0);
  5511. +            clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
  5512.              return;
  5513.          }
  5514.          //You can't use Graffiti/TalkieBox AND have a vending open, so this is safe.
  5515. @@ -10775,8 +10777,8 @@
  5516.          return;
  5517.  
  5518.      if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
  5519. -        if (sd->skillitem != skillnum) {
  5520. -            clif_skill_fail(sd, skillnum, USESKILL_FAIL_SKILLINTERVAL, 0);
  5521. +        if (sd->skillitem != skill_id) {
  5522. +            clif_skill_fail(sd, skill_id, USESKILL_FAIL_SKILLINTERVAL, 0);
  5523.              return;
  5524.          }
  5525.      }
  5526. @@ -10784,7 +10786,7 @@
  5527.      if (sd->sc.option&(OPTION_WEDDING|OPTION_XMAS|OPTION_SUMMER))
  5528.          return;
  5529.  
  5530. -    if (sd->sc.data[SC_BASILICA] && (skillnum != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id))
  5531. +    if (sd->sc.data[SC_BASILICA] && (skill_id != HP_BASILICA || sd->sc.data[SC_BASILICA]->val4 != sd->bl.id))
  5532.          return; // On basilica only caster can use Basilica again to stop it.
  5533.  
  5534.      if (sd->menuskill_id) {
  5535. @@ -10796,17 +10798,17 @@
  5536.  
  5537.      pc_delinvincibletimer(sd);
  5538.  
  5539. -    if (sd->skillitem == skillnum) {
  5540. -        if (skilllv != sd->skillitemlv)
  5541. -            skilllv = sd->skillitemlv;
  5542. -        unit_skilluse_pos(&sd->bl, x, y, skillnum, skilllv);
  5543. +    if (sd->skillitem == skill_id) {
  5544. +        if (skill_lv != sd->skillitemlv)
  5545. +            skill_lv = sd->skillitemlv;
  5546. +        unit_skilluse_pos(&sd->bl, x, y, skill_id, skill_lv);
  5547.      } else {
  5548.          int lv;
  5549.          sd->skillitem = sd->skillitemlv = 0;
  5550. -        if ((lv = pc_checkskill(sd, skillnum)) > 0) {
  5551. -            if (skilllv > lv)
  5552. -                skilllv = lv;
  5553. -            unit_skilluse_pos(&sd->bl, x, y, skillnum,skilllv);
  5554. +        if ((lv = pc_checkskill(sd, skill_id)) > 0) {
  5555. +            if (skill_lv > lv)
  5556. +                skill_lv = lv;
  5557. +            unit_skilluse_pos(&sd->bl, x, y, skill_id,skill_lv);
  5558.          }
  5559.      }
  5560.  }
  5561. @@ -10858,11 +10860,11 @@
  5562.  /// 011b <skill id>.W <map name>.16B
  5563.  void clif_parse_UseSkillMap(int fd, struct map_session_data *sd)
  5564.  {
  5565. -    short skill_num = RFIFOW(fd,2);
  5566. +    uint16 skill_id = RFIFOW(fd,2);
  5567.      char map_name[MAP_NAME_LENGTH];
  5568.      mapindex_getmapname((char *)RFIFOP(fd,4), map_name);
  5569.  
  5570. -    if (skill_num != sd->menuskill_id)
  5571. +    if (skill_id != sd->menuskill_id)
  5572.          return;
  5573.  
  5574.      if (pc_cant_act(sd)) {
  5575. @@ -10871,7 +10873,7 @@
  5576.      }
  5577.  
  5578.      pc_delinvincibletimer(sd);
  5579. -    skill_castend_map(sd,skill_num,map_name);
  5580. +    skill_castend_map(sd,skill_id,map_name);
  5581.  }
  5582.  
  5583.  
  5584. @@ -10899,7 +10901,7 @@
  5585.      }
  5586.      if (pc_istrading(sd)) {
  5587.          //Make it fail to avoid shop exploits where you sell something different than you see.
  5588. -        clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
  5589. +        clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
  5590.          clif_menuskill_clear(sd);
  5591.          return;
  5592.      }
  5593. @@ -10928,7 +10930,7 @@
  5594.  
  5595.      if (pc_istrading(sd)) {
  5596.          //Make it fail to avoid shop exploits where you sell something different than you see.
  5597. -        clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
  5598. +        clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
  5599.          clif_menuskill_clear(sd);
  5600.          return;
  5601.      }
  5602. @@ -10946,7 +10948,7 @@
  5603.          return;
  5604.      if (pc_istrading(sd)) {
  5605.          //Make it fail to avoid shop exploits where you sell something different than you see.
  5606. -        clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
  5607. +        clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
  5608.          clif_menuskill_clear(sd);
  5609.          return;
  5610.      }
  5611. @@ -10965,7 +10967,7 @@
  5612.          return;
  5613.      if (pc_istrading(sd)) {
  5614.          //Make it fail to avoid shop exploits where you sell something different than you see.
  5615. -        clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
  5616. +        clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
  5617.          clif_menuskill_clear(sd);
  5618.          return;
  5619.      }
  5620. @@ -11070,7 +11072,7 @@
  5621.  {
  5622.      if (pc_istrading(sd)) {
  5623.          //Make it fail to avoid shop exploits where you sell something different than you see.
  5624. -        clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
  5625. +        clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
  5626.          clif_menuskill_clear(sd);
  5627.          return;
  5628.      }
  5629. @@ -11879,7 +11881,7 @@
  5630.  void clif_parse_GuildRequestEmblem(int fd,struct map_session_data *sd)
  5631.  {
  5632.      struct guild *g;
  5633. -    int guild_id = RFIFOL(fd,2);
  5634. +    uint32 guild_id = RFIFOL(fd,2);
  5635.  
  5636.      if ((g = guild_search(guild_id)) != NULL)
  5637.          clif_guild_emblem(sd,g);
  5638. @@ -11926,7 +11928,7 @@
  5639.  /// 016e <guild id>.L <msg1>.60B <msg2>.120B
  5640.  void clif_parse_GuildChangeNotice(int fd, struct map_session_data *sd)
  5641.  {
  5642. -    int guild_id = RFIFOL(fd,2);
  5643. +    uint32 guild_id = RFIFOL(fd,2);
  5644.      char *msg1 = (char *)RFIFOP(fd,6);
  5645.      char *msg2 = (char *)RFIFOP(fd,66);
  5646.  
  5647. @@ -12309,7 +12311,7 @@
  5648.  /// 0843 <account id>.L
  5649.  void clif_parse_GMRemove2(int fd, struct map_session_data *sd)
  5650.  {
  5651. -    int account_id;
  5652. +    uint32 account_id;
  5653.      struct map_session_data *pl_sd;
  5654.  
  5655.      account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
  5656. @@ -12347,7 +12349,7 @@
  5657.  /// 0842 <account id>.L
  5658.  void clif_parse_GMRecall2(int fd, struct map_session_data *sd)
  5659.  {
  5660. -    int account_id;
  5661. +    uint32 account_id;
  5662.      struct map_session_data *pl_sd;
  5663.  
  5664.      account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
  5665. @@ -12451,7 +12453,7 @@
  5666.  
  5667.  /// Result of request to resolve account name (ZC_ACK_ACCOUNTNAME).
  5668.  /// 01e0 <account id>.L <account name>.24B
  5669. -void clif_account_name(struct map_session_data *sd, int account_id, const char *accname)
  5670. +void clif_account_name(struct map_session_data *sd, uint32 account_id, const char *accname)
  5671.  {
  5672.      int fd = sd->fd;
  5673.  
  5674. @@ -12467,7 +12469,7 @@
  5675.  /// 01df <account id>.L
  5676.  void clif_parse_GMReqAccountName(int fd, struct map_session_data *sd)
  5677.  {
  5678. -    int account_id = RFIFOL(fd,2);
  5679. +    uint32 account_id = RFIFOL(fd,2);
  5680.  
  5681.      //TODO: find out if this works for any player or only for authorized GMs
  5682.      clif_account_name(sd, account_id, ""); // insert account name here >_<
  5683. @@ -12672,7 +12674,7 @@
  5684.  /// state:
  5685.  ///     0 = online
  5686.  ///     1 = offline
  5687. -void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int char_id, int online)
  5688. +void clif_friendslist_toggle(struct map_session_data *sd,uint32 account_id, uint32 char_id, int online)
  5689.  {
  5690.      int i, fd = sd->fd;
  5691.  
  5692. @@ -12695,7 +12697,8 @@
  5693.  //Subfunction called from clif_foreachclient to toggle friends on/off [Skotlex]
  5694.  int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap)
  5695.  {
  5696. -    int account_id, char_id, online;
  5697. +    uint32 account_id, char_id;
  5698. +    int online;
  5699.      account_id = va_arg(ap, int);
  5700.      char_id = va_arg(ap, int);
  5701.      online = va_arg(ap, int);
  5702. @@ -12759,7 +12762,7 @@
  5703.  
  5704.  /// Asks a player for permission to be added as friend (ZC_REQ_ADD_FRIENDS).
  5705.  /// 0207 <req account id>.L <req char id>.L <req char name>.24B
  5706. -void clif_friendlist_req(struct map_session_data *sd, int account_id, int char_id, const char *name)
  5707. +void clif_friendlist_req(struct map_session_data *sd, uint32 account_id, uint32 char_id, const char *name)
  5708.  {
  5709.      int fd = sd->fd;
  5710.  
  5711. @@ -12830,7 +12833,7 @@
  5712.  void clif_parse_FriendsListReply(int fd, struct map_session_data *sd)
  5713.  {
  5714.      struct map_session_data *f_sd;
  5715. -    int account_id;
  5716. +    uint32 account_id;
  5717.      char reply;
  5718.  
  5719.      account_id = RFIFOL(fd,2);
  5720. @@ -12895,7 +12898,7 @@
  5721.  void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
  5722.  {
  5723.      struct map_session_data *f_sd = NULL;
  5724. -    int account_id, char_id;
  5725. +    uint32 account_id, char_id;
  5726.      int i, j;
  5727.  
  5728.      account_id = RFIFOL(fd,2);
  5729. @@ -13191,14 +13194,14 @@
  5730.  ///     0 = sun
  5731.  ///     1 = moon
  5732.  ///     2 = star
  5733. -void clif_feel_req(int fd, struct map_session_data *sd, int skilllv)
  5734. +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv)
  5735.  {
  5736.      WFIFOHEAD(fd,packet_len(0x253));
  5737.      WFIFOW(fd,0)=0x253;
  5738. -    WFIFOB(fd,2)=TOB(skilllv-1);
  5739. +    WFIFOB(fd,2)=TOB(skill_lv-1);
  5740.      WFIFOSET(fd, packet_len(0x253));
  5741.      sd->menuskill_id = SG_FEEL;
  5742. -    sd->menuskill_val = skilllv;
  5743. +    sd->menuskill_val = skill_lv;
  5744.  }
  5745.  
  5746.  
  5747. @@ -14910,7 +14913,7 @@
  5748.  
  5749.  /// Notifies client of a battleground score change (ZC_BATTLEFIELD_NOTIFY_POINT).
  5750.  /// 02de <camp A points>.W <camp B points>.W
  5751. -void clif_bg_updatescore(int m)
  5752. +void clif_bg_updatescore(short m)
  5753.  {
  5754.      struct block_list bl;
  5755.      unsigned char buf[6];
  5756. @@ -15408,7 +15411,7 @@
  5757.  /// 0817 <account id>.L
  5758.  static void clif_parse_ReqClickBuyingStore(int fd, struct map_session_data *sd)
  5759.  {
  5760. -    int account_id;
  5761. +    uint32 account_id;
  5762.  
  5763.      account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
  5764.  
  5765. @@ -15447,7 +15450,7 @@
  5766.  {
  5767.      const unsigned int blocksize = 6;
  5768.      uint8 *itemlist;
  5769. -    int account_id;
  5770. +    uint32 account_id;
  5771.      unsigned int count, packet_len, buyer_id;
  5772.      struct s_packet_db *info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
  5773.  
  5774. @@ -15710,7 +15713,7 @@
  5775.  static void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data *sd)
  5776.  {
  5777.      unsigned short nameid;
  5778. -    int account_id, store_id;
  5779. +    uint32 account_id, store_id;
  5780.      struct s_packet_db *info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
  5781.  
  5782.      account_id = RFIFOL(fd,info->pos[0]);
  5783. @@ -15852,7 +15855,7 @@
  5784.  /*==========================================
  5785.   * Magic Decoy Material List
  5786.   *------------------------------------------*/
  5787. -int clif_magicdecoy_list(struct map_session_data *sd, int skill_lv, short x, short y)
  5788. +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y)
  5789.  {
  5790.      int i, c;
  5791.      int fd;
  5792. @@ -15889,7 +15892,7 @@
  5793.  /*==========================================
  5794.   * Guillotine Cross Poisons List
  5795.   *------------------------------------------*/
  5796. -int clif_poison_list(struct map_session_data *sd, int skill_lv)
  5797. +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv)
  5798.  {
  5799.      int i, c;
  5800.      int fd;
  5801. @@ -15955,7 +15958,7 @@
  5802.   * Skill list for Four Elemental Analysis
  5803.   * and Change Material skills.
  5804.   *------------------------------------------*/
  5805. -int clif_skill_itemlistwindow(struct map_session_data *sd, int skill_id, int skill_lv)
  5806. +int clif_skill_itemlistwindow(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv)
  5807.  {
  5808.  #if PACKETVER >= 20090922
  5809.      int fd;
  5810. @@ -16049,7 +16052,7 @@
  5811.          return;
  5812.  
  5813.      if (pc_istrading(sd)) {
  5814. -        clif_skill_fail(sd,sd->ud.skillid,0,0);
  5815. +        clif_skill_fail(sd,sd->ud.skill_id,0,0);
  5816.          clif_menuskill_clear(sd);
  5817.          return;
  5818.      }
  5819. Index: src/map/clif.h
  5820. --- src/map/clif.h Base (BASE)
  5821. +++ src/map/clif.h Locally Modified (Based On LOCAL)
  5822. @@ -419,29 +419,29 @@
  5823.  int clif_insight(struct block_list *bl,va_list ap); // map_forallinmovearea callback
  5824.  int clif_outsight(struct block_list *bl,va_list ap);    // map_forallinmovearea callback
  5825.  
  5826. -void clif_class_change(struct block_list *bl,int class_,int type);
  5827. +void clif_class_change(struct block_list *bl,short class_,int type);
  5828.  #define clif_mob_class_change(md, class_) clif_class_change(&md->bl, class_, 1)
  5829.  
  5830.  void clif_skillinfoblock(struct map_session_data *sd);
  5831. -void clif_skillup(struct map_session_data *sd,int skill_num);
  5832. +void clif_skillup(struct map_session_data *sd,uint16 skill_id);
  5833.  void clif_skillinfo(struct map_session_data *sd,int skill, int inf);
  5834.  void clif_addskill(struct map_session_data *sd, int id);
  5835.  void clif_deleteskill(struct map_session_data *sd, int id);
  5836.  
  5837. -void clif_skillcasting(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, int skill_num, int property, int casttime);
  5838. +void clif_skillcasting(struct block_list *bl, int src_id, int dst_id, int dst_x, int dst_y, uint16 skill_id, int property, int casttime);
  5839.  void clif_skillcastcancel(struct block_list *bl);
  5840. -void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail_cause cause,int btype);
  5841. -void clif_skill_cooldown(struct map_session_data *sd, int skillid, unsigned int tick);
  5842. -int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type);
  5843. -//int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,int skill_id,int skill_lv,int type);
  5844. -int clif_skill_nodamage(struct block_list *src,struct block_list *dst,int skill_id,int heal,int fail);
  5845. -void clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y,int tick);
  5846. +void clif_skill_fail(struct map_session_data *sd,uint16 skill_id,enum useskill_fail_cause cause,int btype);
  5847. +void clif_skill_cooldown(struct map_session_data *sd, uint16 skill_id, unsigned int tick);
  5848. +int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,uint16 skill_lv,int type);
  5849. +//int clif_skill_damage2(struct block_list *src,struct block_list *dst,unsigned int tick,int sdelay,int ddelay,int damage,int div,uint16 skill_id,int skill_lv,int type);
  5850. +int clif_skill_nodamage(struct block_list *src,struct block_list *dst,uint16 skill_id,int heal,int fail);
  5851. +void clif_skill_poseffect(struct block_list *src,uint16 skill_id,int val,short x,short y,int tick);
  5852.  void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst);
  5853. -void clif_skill_warppoint(struct map_session_data *sd, short skill_num, short skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4);
  5854. +void clif_skill_warppoint(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4);
  5855.  void clif_skill_memomessage(struct map_session_data *sd, int type);
  5856.  void clif_skill_teleportmessage(struct map_session_data *sd, int type);
  5857. -void clif_skill_produce_mix_list(struct map_session_data *sd, int skillid, int trigger);
  5858. -void clif_cooking_list(struct map_session_data *sd, int trigger, int skill_id, int qty, int list_type);
  5859. +void clif_skill_produce_mix_list(struct map_session_data *sd, uint16 skill_id, int trigger);
  5860. +void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type);
  5861.  
  5862.  void clif_produceeffect(struct map_session_data *sd,int flag,int nameid);
  5863.  
  5864. @@ -450,12 +450,12 @@
  5865.  
  5866.  void clif_skillunit_update(struct block_list *bl);
  5867.  
  5868. -void clif_autospell(struct map_session_data *sd,int skilllv);
  5869. +void clif_autospell(struct map_session_data *sd,uint16 skill_lv);
  5870.  void clif_devotion(struct block_list *src, struct map_session_data *tsd);
  5871.  void clif_spiritball(struct block_list *bl);
  5872.  void clif_combo_delay(struct block_list *bl,int wait);
  5873.  void clif_bladestop(struct block_list *src, int dst_id, int active);
  5874. -void clif_changemapcell(int fd, int m, int x, int y, int type, enum send_target target);
  5875. +void clif_changemapcell(int fd, short m, short x, short y, int type, enum send_target target);
  5876.  
  5877.  #define clif_status_load(bl, type, flag) clif_status_change((bl), (type), (flag), 0, 0, 0, 0)
  5878.  void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val1, int val2, int val3);
  5879. @@ -485,7 +485,7 @@
  5880.  void clif_item_damaged(struct map_session_data *sd, unsigned short position);
  5881.  void clif_item_refine_list(struct map_session_data *sd);
  5882.  
  5883. -void clif_item_skill(struct map_session_data *sd,int skillid,int skilllv);
  5884. +void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv);
  5885.  
  5886.  void clif_mvp_effect(struct map_session_data *sd);
  5887.  void clif_mvp_item(struct map_session_data *sd,int nameid);
  5888. @@ -511,8 +511,8 @@
  5889.  void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd);
  5890.  void clif_party_inviteack(struct map_session_data *sd, const char *nick, int result);
  5891.  void clif_party_option(struct party_data *p,struct map_session_data *sd,int flag);
  5892. -void clif_party_withdraw(struct party_data *p, struct map_session_data *sd, int account_id, const char *name, int flag);
  5893. -void clif_party_message(struct party_data *p, int account_id, const char *mes, int len);
  5894. +void clif_party_withdraw(struct party_data *p, struct map_session_data *sd, uint32 account_id, const char *name, int flag);
  5895. +void clif_party_message(struct party_data *p, uint32 account_id, const char *mes, int len);
  5896.  void clif_party_xy(struct map_session_data *sd);
  5897.  void clif_party_xy_single(int fd, struct map_session_data *sd);
  5898.  void clif_party_hp(struct map_session_data *sd);
  5899. @@ -531,17 +531,17 @@
  5900.  void clif_guild_invite(struct map_session_data *sd,struct guild *g);
  5901.  void clif_guild_inviteack(struct map_session_data *sd,int flag);
  5902.  void clif_guild_leave(struct map_session_data *sd,const char *name,const char *mes);
  5903. -void clif_guild_expulsion(struct map_session_data *sd, const char *name, const char *mes, int account_id);
  5904. +void clif_guild_expulsion(struct map_session_data *sd, const char *name, const char *mes, uint32 account_id);
  5905.  void clif_guild_positionchanged(struct guild *g,int idx);
  5906.  void clif_guild_memberpositionchanged(struct guild *g,int idx);
  5907.  void clif_guild_emblem(struct map_session_data *sd,struct guild *g);
  5908.  void clif_guild_emblem_area(struct block_list *bl);
  5909.  void clif_guild_notice(struct map_session_data *sd, struct guild *g);
  5910. -void clif_guild_message(struct guild *g,int account_id,const char *mes,int len);
  5911. -int clif_guild_skillup(struct map_session_data *sd,int skill_num,int lv);
  5912. -void clif_guild_reqalliance(struct map_session_data *sd,int account_id,const char *name);
  5913. +void clif_guild_message(struct guild *g,uint32 account_id,const char *mes,int len);
  5914. +int clif_guild_skillup(struct map_session_data *sd,uint16 skill_id,int lv);
  5915. +void clif_guild_reqalliance(struct map_session_data *sd,uint32 account_id,const char *name);
  5916.  void clif_guild_allianceack(struct map_session_data *sd,int flag);
  5917. -void clif_guild_delalliance(struct map_session_data *sd,int guild_id,int flag);
  5918. +void clif_guild_delalliance(struct map_session_data *sd,uint32 guild_id,int flag);
  5919.  void clif_guild_oppositionack(struct map_session_data *sd,int flag);
  5920.  void clif_guild_broken(struct map_session_data *sd,int flag);
  5921.  void clif_guild_xy(struct map_session_data *sd);
  5922. @@ -553,7 +553,7 @@
  5923.  void clif_bg_xy(struct map_session_data *sd);
  5924.  void clif_bg_xy_remove(struct map_session_data *sd);
  5925.  void clif_bg_message(struct battleground_data *bg, int src_id, const char *name, const char *mes, int len);
  5926. -void clif_bg_updatescore(int m);
  5927. +void clif_bg_updatescore(short m);
  5928.  void clif_bg_updatescore_single(struct map_session_data *sd);
  5929.  void clif_sendbgemblem_area(struct map_session_data *sd);
  5930.  void clif_sendbgemblem_single(int fd, struct map_session_data *sd);
  5931. @@ -598,7 +598,7 @@
  5932.  void clif_friendslist_send(struct map_session_data *sd);
  5933.  void clif_friendslist_reqack(struct map_session_data *sd, struct map_session_data *f_sd, int type);
  5934.  
  5935. -void clif_weather(int m); // [Valaris]
  5936. +void clif_weather(short m); // [Valaris]
  5937.  void clif_specialeffect(struct block_list *bl, int type, enum send_target target); // special effects [Valaris]
  5938.  void clif_specialeffect_single(struct block_list *bl, int type, int fd);
  5939.  void clif_messagecolor(struct block_list *bl, unsigned long color, const char *msg); // Mob/Npc color talk [SnakeDrak]
  5940. @@ -616,17 +616,17 @@
  5941.  
  5942.  void clif_party_xy_remove(struct map_session_data *sd); //Fix for minimap [Kevin]
  5943.  void clif_gospel_info(struct map_session_data *sd, int type);
  5944. -void clif_feel_req(int fd, struct map_session_data *sd, int skilllv);
  5945. +void clif_feel_req(int fd, struct map_session_data *sd, uint16 skill_lv);
  5946.  void clif_starskill(struct map_session_data *sd, const char *mapname, int monster_id, unsigned char star, unsigned char result);
  5947.  void clif_feel_info(struct map_session_data *sd, unsigned char feel_level, unsigned char type);
  5948. -void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type);
  5949. +void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,short class_, unsigned char type);
  5950.  void clif_mission_info(struct map_session_data *sd, int mob_id, unsigned char progress);
  5951.  void clif_feel_hate_reset(struct map_session_data *sd);
  5952.  
  5953.  // [blackhole89]
  5954.  void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag);
  5955.  int clif_homskillinfoblock(struct map_session_data *sd);
  5956. -void clif_homskillup(struct map_session_data *sd, int skill_num);   //[orn]
  5957. +void clif_homskillup(struct map_session_data *sd, uint16 skill_id);   //[orn]
  5958.  int clif_hom_food(struct map_session_data *sd,int foodid,int fail); //[orn]
  5959.  void clif_send_homdata(struct map_session_data *sd, int state, int param);  //[orn]
  5960.  
  5961. @@ -637,7 +637,7 @@
  5962.  
  5963.  void clif_msg(struct map_session_data *sd, unsigned short id);
  5964.  void clif_msg_value(struct map_session_data *sd, unsigned short id, int value);
  5965. -void clif_msg_skill(struct map_session_data *sd, unsigned short skill_id, int msg_id);
  5966. +void clif_msg_skill(struct map_session_data *sd, uint16 skill_id, int msg_id);
  5967.  
  5968.  //quest system [Kevin] [Inkfish]
  5969.  void clif_quest_send_list(struct map_session_data *sd);
  5970. @@ -735,9 +735,9 @@
  5971.  
  5972.  int clif_spellbook_list(struct map_session_data *sd);
  5973.  
  5974. -int clif_magicdecoy_list(struct map_session_data *sd, int skill_lv, short x, short y);
  5975. +int clif_magicdecoy_list(struct map_session_data *sd, uint16 skill_lv, short x, short y);
  5976.  
  5977. -int clif_poison_list(struct map_session_data *sd, int skill_lv);
  5978. +int clif_poison_list(struct map_session_data *sd, uint16 skill_lv);
  5979.  
  5980.  int clif_autoshadowspell_list(struct map_session_data *sd);
  5981.  
  5982. @@ -745,7 +745,7 @@
  5983.  int clif_status_load_single(int fd, int id,int type,int flag,int val1, int val2, int val3);
  5984.  
  5985.  
  5986. -int clif_skill_itemlistwindow(struct map_session_data *sd, int skill_id, int skill_lv);
  5987. +int clif_skill_itemlistwindow(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
  5988.  void clif_elemental_info(struct map_session_data *sd);
  5989.  void clif_elemental_updatestatus(struct map_session_data *sd, int type);
  5990.  
  5991. Index: src/map/duel.c
  5992. --- src/map/duel.c Base (BASE)
  5993. +++ src/map/duel.c Locally Modified (Based On LOCAL)
  5994. @@ -52,7 +52,7 @@
  5995.      if (sd->duel_group != ssd->duel_group) return 0;
  5996.  
  5997.      sprintf(output, "      %d. %s", ++(*p), sd->status.name);
  5998. -    clif_disp_onlyself(ssd, output, strlen(output));
  5999. +    clif_disp_onlyself(ssd, output,(int) strlen(output));
  6000.      return 1;
  6001.  }
  6002.  
  6003. @@ -73,7 +73,7 @@
  6004.                  duel_list[did].members_count,
  6005.                  duel_list[did].members_count + duel_list[did].invites_count);
  6006.  
  6007. -    clif_disp_onlyself(sd, output, strlen(output));
  6008. +    clif_disp_onlyself(sd, output,(int) strlen(output));
  6009.      map_foreachpc(duel_showinfo_sub, sd, &p);
  6010.  }
  6011.  
  6012. @@ -92,27 +92,27 @@
  6013.      duel_list[i].max_players_limit = maxpl;
  6014.  
  6015.      strcpy(output, msg_txt(372)); // " -- Duel has been created (@invite/@leave) --"
  6016. -    clif_disp_onlyself(sd, output, strlen(output));
  6017. +    clif_disp_onlyself(sd, output, (int) strlen(output));
  6018.  
  6019.      clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
  6020.      //clif_misceffect2(&sd->bl, 159);
  6021.      return i;
  6022.  }
  6023.  
  6024. -void duel_invite(const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd)
  6025. +void duel_invite(const int did, struct map_session_data *sd, struct map_session_data *target_sd)
  6026.  {
  6027.      char output[256];
  6028.  
  6029.      // " -- Player %s invites %s to duel --"
  6030.      sprintf(output, msg_txt(373), sd->status.name, target_sd->status.name);
  6031. -    clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
  6032. +    clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS);
  6033.  
  6034.      target_sd->duel_invite = did;
  6035.      duel_list[did].invites_count++;
  6036.  
  6037.      // "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
  6038.      sprintf(output, msg_txt(374), sd->status.name);
  6039. -    clif_broadcast((struct block_list *)target_sd, output, strlen(output)+1, 0x10, SELF);
  6040. +    clif_broadcast((struct block_list *)target_sd, output,(int) strlen(output)+1, 0x10, SELF);
  6041.  }
  6042.  
  6043.  static int duel_leave_sub(struct map_session_data *sd, va_list va)
  6044. @@ -129,7 +129,7 @@
  6045.  
  6046.      // " <- Player %s has left duel --"
  6047.      sprintf(output, msg_txt(375), sd->status.name);
  6048. -    clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
  6049. +    clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS);
  6050.  
  6051.      duel_list[did].members_count--;
  6052.  
  6053. @@ -154,7 +154,7 @@
  6054.  
  6055.      // " -> Player %s has accepted duel --"
  6056.      sprintf(output, msg_txt(376), sd->status.name);
  6057. -    clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
  6058. +    clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS);
  6059.  
  6060.      clif_map_property(sd, MAPPROPERTY_FREEPVPZONE);
  6061.      //clif_misceffect2(&sd->bl, 159);
  6062. @@ -166,7 +166,7 @@
  6063.  
  6064.      // " -- Player %s has rejected duel --"
  6065.      sprintf(output, msg_txt(377), sd->status.name);
  6066. -    clif_disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
  6067. +    clif_disp_message(&sd->bl, output,(int) strlen(output), DUEL_WOS);
  6068.  
  6069.      duel_list[did].invites_count--;
  6070.      sd->duel_invite = 0;
  6071. Index: src/map/duel.h
  6072. --- src/map/duel.h Base (BASE)
  6073. +++ src/map/duel.h Locally Modified (Based On LOCAL)
  6074. @@ -7,7 +7,7 @@
  6075.  struct duel {
  6076.      int members_count;
  6077.      int invites_count;
  6078. -    int max_players_limit;
  6079. +    unsigned int max_players_limit;
  6080.  };
  6081.  
  6082.  #define MAX_DUEL 1024
  6083. @@ -16,7 +16,7 @@
  6084.  
  6085.  //Duel functions // [LuzZza]
  6086.  int duel_create(struct map_session_data *sd, const unsigned int maxpl);
  6087. -void duel_invite(const unsigned int did, struct map_session_data *sd, struct map_session_data *target_sd);
  6088. +void duel_invite(const int did, struct map_session_data *sd, struct map_session_data *target_sd);
  6089.  void duel_accept(const unsigned int did, struct map_session_data *sd);
  6090.  void duel_reject(const unsigned int did, struct map_session_data *sd);
  6091.  void duel_leave(const unsigned int did, struct map_session_data *sd);
  6092. Index: src/map/elemental.c
  6093. --- src/map/elemental.c Base (BASE)
  6094. +++ src/map/elemental.c Locally Modified (Based On LOCAL)
  6095. @@ -39,19 +39,19 @@
  6096.  
  6097.  struct s_elemental_db elemental_db[MAX_ELEMENTAL_CLASS]; // Elemental Database
  6098.  
  6099. -int elemental_search_index(int class_)
  6100. +int elemental_search_index(short class_)
  6101.  {
  6102.      int i;
  6103.      ARR_FIND(0, MAX_ELEMENTAL_CLASS, i, elemental_db[i].class_ == class_);
  6104.      return (i == MAX_ELEMENTAL_CLASS)?-1:i;
  6105.  }
  6106.  
  6107. -bool elemental_class(int class_)
  6108. +bool elemental_class(short class_)
  6109.  {
  6110.      return (bool)(elemental_search_index(class_) > -1);
  6111.  }
  6112.  
  6113. -struct view_data *elemental_get_viewdata(int class_) {
  6114. +struct view_data *elemental_get_viewdata(short class_) {
  6115.      int i = elemental_search_index(class_);
  6116.      if (i < 0)
  6117.          return 0;
  6118. @@ -59,7 +59,7 @@
  6119.      return &elemental_db[i].vd;
  6120.  }
  6121.  
  6122. -int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime)
  6123. +int elemental_create(struct map_session_data *sd, short class_, unsigned int lifetime)
  6124.  {
  6125.      struct s_elemental ele;
  6126.      struct s_elemental_db *db;
  6127. @@ -86,7 +86,7 @@
  6128.      return 1;
  6129.  }
  6130.  
  6131. -int elemental_get_lifetime(struct elemental_data *ed)
  6132. +unsigned int elemental_get_lifetime(struct elemental_data *ed)
  6133.  {
  6134.      const struct TimerData *td;
  6135.      if (ed == NULL || ed->summon_timer == INVALID_TIMER)
  6136. @@ -226,10 +226,10 @@
  6137.      return 1;
  6138.  }
  6139.  
  6140. -int elemental_clean_single_effect(struct elemental_data *ed, int skill_num)
  6141. +int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id)
  6142.  {
  6143.      struct block_list *bl;
  6144. -    sc_type type = status_skill2sc(skill_num);
  6145. +    sc_type type = status_skill2sc(skill_id);
  6146.  
  6147.      nullpo_ret(ed);
  6148.  
  6149. @@ -270,7 +270,7 @@
  6150.                  break;
  6151.          }
  6152.      }
  6153. -    if (skill_get_unit_id(skill_num,0))
  6154. +    if (skill_get_unit_id(skill_id,0))
  6155.          skill_clear_unitgroup(&ed->bl);
  6156.  
  6157.      return 1;
  6158. @@ -341,7 +341,7 @@
  6159.  
  6160.  int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick)
  6161.  {
  6162. -    short skillnum, skilllv;
  6163. +    uint16 skill_id, skill_lv;
  6164.      int i;
  6165.  
  6166.      nullpo_ret(ed);
  6167. @@ -357,10 +357,10 @@
  6168.      if (i == MAX_ELESKILLTREE)
  6169.          return 0;
  6170.  
  6171. -    skillnum = ed->db->skill[i].id;
  6172. -    skilllv = ed->db->skill[i].lv;
  6173. +    skill_id = ed->db->skill[i].id;
  6174. +    skill_lv = ed->db->skill[i].lv;
  6175.  
  6176. -    if (elemental_skillnotok(skillnum, ed))
  6177. +    if (elemental_skillnotok(skill_id, ed))
  6178.          return 0;
  6179.  
  6180.      if (ed->ud.skilltimer != INVALID_TIMER)
  6181. @@ -372,17 +372,17 @@
  6182.      ed->last_thinktime = tick;
  6183.  
  6184.      // Not in skill range.
  6185. -    if (!battle_check_range(&ed->bl,bl,skill_get_range(skillnum,skilllv))) {
  6186. +    if (!battle_check_range(&ed->bl,bl,skill_get_range(skill_id,skill_lv))) {
  6187.          // Try to walk to the target.
  6188. -        if (!unit_walktobl(&ed->bl, bl, skill_get_range(skillnum,skilllv), 2))
  6189. +        if (!unit_walktobl(&ed->bl, bl, skill_get_range(skill_id,skill_lv), 2))
  6190.              elemental_unlocktarget(ed);
  6191.          else {
  6192.              // Walking, waiting to be in range. Client don't handle it, then we must handle it here.
  6193. -            int walk_dist = distance_bl(&ed->bl,bl) - skill_get_range(skillnum,skilllv);
  6194. -            ed->ud.skillid = skillnum;
  6195. -            ed->ud.skilllv = skilllv;
  6196. +            int walk_dist = distance_bl(&ed->bl,bl) - skill_get_range(skill_id,skill_lv);
  6197. +            ed->ud.skill_id = skill_id;
  6198. +            ed->ud.skill_lv = skill_lv;
  6199.  
  6200. -            if (skill_get_inf(skillnum) & INF_GROUND_SKILL)
  6201. +            if (skill_get_inf(skill_id) & INF_GROUND_SKILL)
  6202.                  ed->ud.skilltimer = add_timer(tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_pos, ed->bl.id, 0);
  6203.              else
  6204.                  ed->ud.skilltimer = add_timer(tick+status_get_speed(&ed->bl)*walk_dist, skill_castend_id, ed->bl.id, 0);
  6205. @@ -391,10 +391,10 @@
  6206.  
  6207.      }
  6208.      //Otherwise, just cast the skill.
  6209. -    if (skill_get_inf(skillnum) & INF_GROUND_SKILL)
  6210. -        unit_skilluse_pos(&ed->bl, bl->x, bl->y, skillnum, skilllv);
  6211. +    if (skill_get_inf(skill_id) & INF_GROUND_SKILL)
  6212. +        unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv);
  6213.      else
  6214. -        unit_skilluse_id(&ed->bl, bl->id, skillnum, skilllv);
  6215. +        unit_skilluse_id(&ed->bl, bl->id, skill_id, skill_lv);
  6216.  
  6217.      // Reset target.
  6218.      ed->target_id = 0;
  6219. @@ -409,7 +409,7 @@
  6220.  int elemental_change_mode_ack(struct elemental_data *ed, int mode)
  6221.  {
  6222.      struct block_list *bl = &ed->master->bl;
  6223. -    short skillnum, skilllv;
  6224. +    uint16 skill_id, skill_lv;
  6225.      int i;
  6226.  
  6227.      nullpo_ret(ed);
  6228. @@ -422,10 +422,10 @@
  6229.      if (i == MAX_ELESKILLTREE)
  6230.          return 0;
  6231.  
  6232. -    skillnum = ed->db->skill[i].id;
  6233. -    skilllv = ed->db->skill[i].lv;
  6234. +    skill_id = ed->db->skill[i].id;
  6235. +    skill_lv = ed->db->skill[i].lv;
  6236.  
  6237. -    if (elemental_skillnotok(skillnum, ed))
  6238. +    if (elemental_skillnotok(skill_id, ed))
  6239.          return 0;
  6240.  
  6241.      if (ed->ud.skilltimer != INVALID_TIMER)
  6242. @@ -436,10 +436,10 @@
  6243.      ed->target_id = bl->id; // Set new target
  6244.      ed->last_thinktime = gettick();
  6245.  
  6246. -    if (skill_get_inf(skillnum) & INF_GROUND_SKILL)
  6247. -        unit_skilluse_pos(&ed->bl, bl->x, bl->y, skillnum, skilllv);
  6248. +    if (skill_get_inf(skill_id) & INF_GROUND_SKILL)
  6249. +        unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv);
  6250.      else
  6251. -        unit_skilluse_id(&ed->bl,bl->id,skillnum,skilllv);
  6252. +        unit_skilluse_id(&ed->bl,bl->id,skill_id,skill_lv);
  6253.  
  6254.      ed->target_id = 0;  // Reset target after casting the skill  to avoid continious attack.
  6255.  
  6256. @@ -496,15 +496,15 @@
  6257.      return 0;
  6258.  }
  6259.  
  6260. -int elemental_skillnotok(int skillid, struct elemental_data *ed)
  6261. +int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed)
  6262.  {
  6263. -    int i = skill_get_index(skillid);
  6264. +    int i = skill_get_index(skill_id);
  6265.      nullpo_retr(1,ed);
  6266.  
  6267.      if (i == 0)
  6268.          return 1; // invalid skill id
  6269.  
  6270. -    return skillnotok(skillid, ed->master);
  6271. +    return skillnotok(skill_id, ed->master);
  6272.  }
  6273.  
  6274.  int elemental_set_target(struct map_session_data *sd, struct block_list *bl)
  6275. @@ -566,7 +566,8 @@
  6276.  static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_data *sd, unsigned int tick)
  6277.  {
  6278.      struct block_list *target = NULL;
  6279. -    int master_dist, view_range, mode;
  6280. +    unsigned int master_dist;
  6281. +    int view_range, mode;
  6282.  
  6283.      nullpo_ret(ed);
  6284.      nullpo_ret(sd);
  6285. @@ -667,7 +668,8 @@
  6286.      FILE *fp;
  6287.      char line[1024], *p;
  6288.      char *str[26];
  6289. -    int i, j = 0, k = 0, ele;
  6290. +    int i, j = 0, k = 0;
  6291. +    unsigned char ele;
  6292.      struct s_elemental_db *db;
  6293.      struct status_data *status;
  6294.  
  6295. @@ -759,8 +761,9 @@
  6296.      char line[1024], *p;
  6297.      char *str[4];
  6298.      struct s_elemental_db *db;
  6299. -    int i, j = 0, k = 0, class_;
  6300. -    int skillid, skilllv, skillmode;
  6301. +    int i, j = 0, k = 0;
  6302. +    uint16 skill_id, skill_lv, class_;
  6303. +    short skillmode;
  6304.  
  6305.      sprintf(line, "%s/%s", db_path, "elemental_skill_db.txt");
  6306.      fp = fopen(line, "r");
  6307. @@ -788,34 +791,34 @@
  6308.              continue;
  6309.          }
  6310.  
  6311. -        class_ = atoi(str[0]);
  6312. +        class_ =(unsigned short) atoi(str[0]);
  6313.          ARR_FIND(0, MAX_ELEMENTAL_CLASS, i, class_ == elemental_db[i].class_);
  6314.          if (i == MAX_ELEMENTAL_CLASS) {
  6315.              ShowError("read_elemental_skilldb : Class not found in elemental_db for skill entry, line %d.\n", k);
  6316.              continue;
  6317.          }
  6318.  
  6319. -        skillid = atoi(str[1]);
  6320. -        if (skillid < EL_SKILLBASE || skillid >= EL_SKILLBASE + MAX_ELEMENTALSKILL) {
  6321. +        skill_id =(unsigned short) atoi(str[1]);
  6322. +        if (skill_id < EL_SKILLBASE || skill_id >= EL_SKILLBASE + MAX_ELEMENTALSKILL) {
  6323.              ShowError("read_elemental_skilldb : Skill out of range, line %d.\n", k);
  6324.              continue;
  6325.          }
  6326.  
  6327.          db = &elemental_db[i];
  6328. -        skilllv = atoi(str[2]);
  6329. +        skill_lv = (unsigned short) atoi(str[2]);
  6330.  
  6331.          skillmode = atoi(str[3]);
  6332.          if (skillmode < EL_SKILLMODE_PASIVE || skillmode > EL_SKILLMODE_AGGRESSIVE) {
  6333.              ShowError("read_elemental_skilldb : Skillmode out of range, line %d.\n",k);
  6334.              continue;
  6335.          }
  6336. -        ARR_FIND(0, MAX_ELESKILLTREE, i, db->skill[i].id == 0 || db->skill[i].id == skillid);
  6337. +        ARR_FIND(0, MAX_ELESKILLTREE, i, db->skill[i].id == 0 || db->skill[i].id == skill_id);
  6338.          if (i == MAX_ELESKILLTREE) {
  6339. -            ShowWarning("Unable to load skill %d into Elemental %d's tree. Maximum number of skills per elemental has been reached.\n", skillid, class_);
  6340. +            ShowWarning("Unable to load skill %d into Elemental %d's tree. Maximum number of skills per elemental has been reached.\n", skill_id, class_);
  6341.              continue;
  6342.          }
  6343. -        db->skill[i].id = skillid;
  6344. -        db->skill[i].lv = skilllv;
  6345. +        db->skill[i].id = skill_id;
  6346. +        db->skill[i].lv = skill_lv;
  6347.          db->skill[i].mode = skillmode;
  6348.          j++;
  6349.      }
  6350. Index: src/map/elemental.h
  6351. --- src/map/elemental.h Base (BASE)
  6352. +++ src/map/elemental.h Locally Modified (Based On LOCAL)
  6353. @@ -25,7 +25,7 @@
  6354.  };
  6355.  
  6356.  struct s_elemental_db {
  6357. -    int class_;
  6358. +    short class_;
  6359.      char sprite[NAME_LENGTH], name[NAME_LENGTH];
  6360.      unsigned short lv;
  6361.      short range2, range3;
  6362. @@ -56,10 +56,10 @@
  6363.      int target_id, attacked_id;
  6364.  };
  6365.  
  6366. -bool elemental_class(int class_);
  6367. -struct view_data *elemental_get_viewdata(int class_);
  6368. +bool elemental_class(short class_);
  6369. +struct view_data *elemental_get_viewdata(short class_);
  6370.  
  6371. -int elemental_create(struct map_session_data *sd, int class_, unsigned int lifetime);
  6372. +int elemental_create(struct map_session_data *sd, short class_, unsigned int lifetime);
  6373.  int elemental_data_received(struct s_elemental *ele, bool flag);
  6374.  int elemental_save(struct elemental_data *ed);
  6375.  
  6376. @@ -72,12 +72,12 @@
  6377.  int elemental_delete(struct elemental_data *ed, int reply);
  6378.  void elemental_summon_stop(struct elemental_data *ed);
  6379.  
  6380. -int elemental_get_lifetime(struct elemental_data *ed);
  6381. +unsigned int elemental_get_lifetime(struct elemental_data *ed);
  6382.  
  6383.  int elemental_unlocktarget(struct elemental_data *ed);
  6384. -int elemental_skillnotok(int skillid, struct elemental_data *ed);
  6385. +int elemental_skillnotok(uint16 skill_id, struct elemental_data *ed);
  6386.  int elemental_set_target(struct map_session_data *sd, struct block_list *bl);
  6387. -int elemental_clean_single_effect(struct elemental_data *ed, int skill_num);
  6388. +int elemental_clean_single_effect(struct elemental_data *ed, uint16 skill_id);
  6389.  int elemental_clean_effect(struct elemental_data *ed);
  6390.  int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned int tick);
  6391.  
  6392. Index: src/map/guild.c
  6393. --- src/map/guild.c Base (BASE)
  6394. +++ src/map/guild.c Locally Modified (Based On LOCAL)
  6395. @@ -29,10 +29,10 @@
  6396.  #include <string.h>
  6397.  
  6398.  
  6399. -static DBMap *guild_db; // int guild_id -> struct guild*
  6400. +static DBMap *guild_db; // uint32 guild_id -> struct guild*
  6401.  static DBMap *castle_db; // int castle_id -> struct guild_castle*
  6402. -static DBMap *guild_expcache_db; // int char_id -> struct guild_expcache*
  6403. -static DBMap *guild_infoevent_db; // int guild_id -> struct eventlist*
  6404. +static DBMap *guild_expcache_db; // uint32 char_id -> struct guild_expcache*
  6405. +static DBMap *guild_infoevent_db; // uint32 guild_id -> struct eventlist*
  6406.  
  6407.  struct eventlist {
  6408.      char name[EVENT_NAME_LENGTH];
  6409. @@ -47,7 +47,7 @@
  6410.  //Guild EXP cache
  6411.  
  6412.  struct guild_expcache {
  6413. -    int guild_id, account_id, char_id;
  6414. +    uint32 guild_id, account_id, char_id;
  6415.      uint64 exp;
  6416.  };
  6417.  static struct eri *expcache_ers; //For handling of guild exp payment.
  6418. @@ -72,7 +72,7 @@
  6419.  /*==========================================
  6420.   * Retrieves and validates the sd pointer for this guild member [Skotlex]
  6421.   *------------------------------------------*/
  6422. -static TBL_PC *guild_sd_check(int guild_id, int account_id, int char_id)
  6423. +static TBL_PC *guild_sd_check(uint32 guild_id, uint32 account_id, uint32 char_id)
  6424.  {
  6425.      TBL_PC *sd = map_id2sd(account_id);
  6426.  
  6427. @@ -96,7 +96,7 @@
  6428.      return guild_skill_tree[id-GD_SKILLBASE].max;
  6429.  }
  6430.  
  6431. -// Retrive skilllv learned by guild
  6432. +// Retrive skill_lv learned by guild
  6433.  
  6434.  int guild_checkskill(struct guild *g, int id)
  6435.  {
  6436. @@ -112,17 +112,18 @@
  6437.  static bool guild_read_guildskill_tree_db(char *split[], int columns, int current)
  6438.  {
  6439.      // <skill id>,<max lv>,<req id1>,<req lv1>,<req id2>,<req lv2>,<req id3>,<req lv3>,<req id4>,<req lv4>,<req id5>,<req lv5>
  6440. -    int k, id, skillid;
  6441. +    int k, id;
  6442. +    uint16 skill_id;
  6443.  
  6444. -    skillid = atoi(split[0]);
  6445. -    id = skillid - GD_SKILLBASE;
  6446. +    skill_id = atoi(split[0]);
  6447. +    id = skill_id - GD_SKILLBASE;
  6448.  
  6449.      if (id < 0 || id >= MAX_GUILDSKILL) {
  6450. -        ShowWarning("guild_read_guildskill_tree_db: Invalid skill id %d.\n", skillid);
  6451. +        ShowWarning("guild_read_guildskill_tree_db: Invalid skill id %d.\n", skill_id);
  6452.          return false;
  6453.      }
  6454.  
  6455. -    guild_skill_tree[id].id = skillid;
  6456. +    guild_skill_tree[id].id = skill_id;
  6457.      guild_skill_tree[id].max = atoi(split[1]);
  6458.  
  6459.      if (guild_skill_tree[id].id == GD_GLORYGUILD && battle_config.require_glory_guild && guild_skill_tree[id].max == 0) {
  6460. @@ -183,7 +184,7 @@
  6461.  }
  6462.  
  6463.  /// lookup: guild id -> guild*
  6464. -struct guild *guild_search(int guild_id) {
  6465. +struct guild *guild_search(uint32 guild_id) {
  6466.      return (struct guild *)idb_get(guild_db,guild_id);
  6467.  }
  6468.  
  6469. @@ -235,7 +236,7 @@
  6470.  }
  6471.  
  6472.  /// lookup: player AID/CID -> member index
  6473. -int guild_getindex(struct guild *g,int account_id,int char_id)
  6474. +int guild_getindex(struct guild *g, uint32 account_id, uint32 char_id)
  6475.  {
  6476.      int i;
  6477.  
  6478. @@ -390,7 +391,7 @@
  6479.  }
  6480.  
  6481.  //Whether or not to create guild
  6482. -int guild_created(int account_id,int guild_id)
  6483. +int guild_created(uint32 account_id, uint32 guild_id)
  6484.  {
  6485.      struct map_session_data *sd=map_id2sd(account_id);
  6486.  
  6487. @@ -409,13 +410,13 @@
  6488.  }
  6489.  
  6490.  //Information request
  6491. -int guild_request_info(int guild_id)
  6492. +int guild_request_info(uint32 guild_id)
  6493.  {
  6494.      return intif_guild_request_info(guild_id);
  6495.  }
  6496.  
  6497.  //Information request with event
  6498. -int guild_npc_request_info(int guild_id,const char *event)
  6499. +int guild_npc_request_info(uint32 guild_id,const char *event)
  6500.  {
  6501.      if (guild_search(guild_id)) {
  6502.          if (event && *event)
  6503. @@ -464,7 +465,7 @@
  6504.  }
  6505.  
  6506.  //Delete association with guild_id for all characters
  6507. -int guild_recv_noinfo(int guild_id)
  6508. +int guild_recv_noinfo(uint32 guild_id)
  6509.  {
  6510.      struct map_session_data *sd;
  6511.      struct s_mapiterator *iter;
  6512. @@ -622,7 +623,7 @@
  6513.  
  6514.  /// Guild invitation reply.
  6515.  /// flag: 0:rejected, 1:accepted
  6516. -int guild_reply_invite(struct map_session_data *sd, int guild_id, int flag)
  6517. +int guild_reply_invite(struct map_session_data *sd, uint32 guild_id, int flag)
  6518.  {
  6519.      struct map_session_data *tsd;
  6520.  
  6521. @@ -703,7 +704,7 @@
  6522.  /*==========================================
  6523.   * Add a player to a given guild_id
  6524.   *----------------------------------------*/
  6525. -int guild_member_added(int guild_id,int account_id,int char_id,int flag)
  6526. +int guild_member_added(uint32 guild_id, uint32 account_id, uint32 char_id,int flag)
  6527.  {
  6528.      struct map_session_data *sd= map_id2sd(account_id),*sd2;
  6529.      struct guild *g;
  6530. @@ -750,7 +751,7 @@
  6531.  /*==========================================
  6532.   * Player request leaving a given guild_id
  6533.   *----------------------------------------*/
  6534. -int guild_leave(struct map_session_data *sd, int guild_id, int account_id, int char_id, const char *mes)
  6535. +int guild_leave(struct map_session_data *sd, uint32 guild_id, uint32 account_id, uint32 char_id, const char *mes)
  6536.  {
  6537.      struct guild *g;
  6538.  
  6539. @@ -773,7 +774,7 @@
  6540.  /*==========================================
  6541.   * Request remove a player to a given guild_id
  6542.   *----------------------------------------*/
  6543. -int guild_expulsion(struct map_session_data *sd, int guild_id, int account_id, int char_id, const char *mes)
  6544. +int guild_expulsion(struct map_session_data *sd, uint32 guild_id, uint32 account_id, uint32 char_id, const char *mes)
  6545.  {
  6546.      struct map_session_data *tsd;
  6547.      struct guild *g;
  6548. @@ -806,7 +807,7 @@
  6549.      return 0;
  6550.  }
  6551.  
  6552. -int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, const char *name, const char *mes)
  6553. +int guild_member_withdraw(uint32 guild_id, uint32 account_id, uint32 char_id, int flag, const char *name, const char *mes)
  6554.  {
  6555.      int i;
  6556.      struct guild *g = guild_search(guild_id);
  6557. @@ -883,7 +884,7 @@
  6558.      return 0;
  6559.  }
  6560.  
  6561. -int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
  6562. +int guild_recv_memberinfoshort(uint32 guild_id, uint32 account_id, uint32 char_id,int online,int lv,short class_)
  6563.  {
  6564.      // cleaned up [LuzZza]
  6565.  
  6566. @@ -968,7 +969,7 @@
  6567.  /*====================================================
  6568.   * Guild receive a message, will be displayed to whole member
  6569.   *---------------------------------------------------*/
  6570. -int guild_recv_message(int guild_id,int account_id,const char *mes,int len)
  6571. +int guild_recv_message(uint32 guild_id,uint32 account_id,const char *mes,int len)
  6572.  {
  6573.      struct guild *g;
  6574.      if ((g=guild_search(guild_id))==NULL)
  6575. @@ -980,7 +981,7 @@
  6576.  /*====================================================
  6577.   * Member changing position in guild
  6578.   *---------------------------------------------------*/
  6579. -int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx)
  6580. +int guild_change_memberposition(uint32 guild_id, uint32 account_id, uint32 char_id,short idx)
  6581.  {
  6582.      return intif_guild_change_memberinfo(guild_id,account_id,char_id,GMI_POSITION,&idx,sizeof(idx));
  6583.  }
  6584. @@ -1004,7 +1005,7 @@
  6585.  /*====================================================
  6586.   * Change guild title or member
  6587.   *---------------------------------------------------*/
  6588. -int guild_change_position(int guild_id,int idx,
  6589. +int guild_change_position(uint32 guild_id,int idx,
  6590.                            int mode,int exp_mode,const char *name)
  6591.  {
  6592.      struct guild_position p;
  6593. @@ -1021,7 +1022,7 @@
  6594.  /*====================================================
  6595.   * Notification of member has changed his guild title
  6596.   *---------------------------------------------------*/
  6597. -int guild_position_changed(int guild_id,int idx,struct guild_position *p)
  6598. +int guild_position_changed(uint32 guild_id,int idx,struct guild_position *p)
  6599.  {
  6600.      struct guild *g=guild_search(guild_id);
  6601.      int i;
  6602. @@ -1040,7 +1041,7 @@
  6603.  /*====================================================
  6604.   * Change guild notice
  6605.   *---------------------------------------------------*/
  6606. -int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2)
  6607. +int guild_change_notice(struct map_session_data *sd, uint32 guild_id,const char *mes1,const char *mes2)
  6608.  {
  6609.      nullpo_ret(sd);
  6610.  
  6611. @@ -1052,7 +1053,7 @@
  6612.  /*====================================================
  6613.   * Notification of guild has changed his notice
  6614.   *---------------------------------------------------*/
  6615. -int guild_notice_changed(int guild_id,const char *mes1,const char *mes2)
  6616. +int guild_notice_changed(uint32 guild_id,const char *mes1,const char *mes2)
  6617.  {
  6618.      int i;
  6619.      struct map_session_data *sd;
  6620. @@ -1090,7 +1091,7 @@
  6621.  /*====================================================
  6622.   * Notification of guild emblem changed
  6623.   *---------------------------------------------------*/
  6624. -int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
  6625. +int guild_emblem_changed(int len,uint32 guild_id,int emblem_id,const char *data)
  6626.  {
  6627.      int i;
  6628.      struct map_session_data *sd;
  6629. @@ -1219,13 +1220,13 @@
  6630.  }
  6631.  
  6632.  /*====================================================
  6633. - * Ask to increase guildskill skill_num
  6634. + * Ask to increase guildskill skillid
  6635.   *---------------------------------------------------*/
  6636. -int guild_skillup(TBL_PC *sd, int skill_num)
  6637. +int guild_skillup(TBL_PC *sd, uint16 skill_id)
  6638.  {
  6639.      struct guild *g;
  6640. -    int idx = skill_num - GD_SKILLBASE;
  6641. -    int max = guild_skill_get_max(skill_num);
  6642. +    int idx = skill_id - GD_SKILLBASE;
  6643. +    int max = guild_skill_get_max(skill_id);
  6644.  
  6645.      nullpo_ret(sd);
  6646.  
  6647. @@ -1237,15 +1238,15 @@
  6648.      if (g->skill_point > 0 &&
  6649.          g->skill[idx].id != 0 &&
  6650.          g->skill[idx].lv < max)
  6651. -        intif_guild_skillup(g->guild_id, skill_num, sd->status.account_id, max);
  6652. +        intif_guild_skillup(g->guild_id, skill_id, sd->status.account_id, max);
  6653.  
  6654.      return 0;
  6655.  }
  6656.  
  6657.  /*====================================================
  6658. - * Notification of guildskill skill_num increase request
  6659. + * Notification of guildskill skillid increase request
  6660.   *---------------------------------------------------*/
  6661. -int guild_skillupack(int guild_id,int skill_num,int account_id)
  6662. +int guild_skillupack(uint32 guild_id,uint16 skill_id,uint32 account_id)
  6663.  {
  6664.      struct map_session_data *sd=map_id2sd(account_id);
  6665.      struct guild *g=guild_search(guild_id);
  6666. @@ -1253,15 +1254,15 @@
  6667.      if (g==NULL)
  6668.          return 0;
  6669.      if (sd != NULL) {
  6670. -        clif_guild_skillup(sd,skill_num,g->skill[skill_num-GD_SKILLBASE].lv);
  6671. +        clif_guild_skillup(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv);
  6672.  
  6673.          /* Guild Aura handling */
  6674. -        switch (skill_num) {
  6675. +        switch (skill_id) {
  6676.              case GD_LEADERSHIP:
  6677.              case GD_GLORYWOUNDS:
  6678.              case GD_SOULCOLD:
  6679.              case GD_HAWKEYES:
  6680. -                guild_guildaura_refresh(sd,skill_num,g->skill[skill_num-GD_SKILLBASE].lv);
  6681. +                guild_guildaura_refresh(sd,skill_id,g->skill[skill_id-GD_SKILLBASE].lv);
  6682.                  break;
  6683.          }
  6684.      }
  6685. @@ -1274,10 +1275,10 @@
  6686.      return 0;
  6687.  }
  6688.  
  6689. -void guild_guildaura_refresh(struct map_session_data *sd, int skill_num, int skill_lv)
  6690. +void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv)
  6691.  {
  6692.      struct skill_unit_group *group = NULL;
  6693. -    int type = status_skill2sc(skill_num);
  6694. +    int type = status_skill2sc(skill_id);
  6695.      if (!(battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) &&
  6696.          !(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)))
  6697.          return;
  6698. @@ -1287,7 +1288,7 @@
  6699.          skill_delunitgroup(group);
  6700.          status_change_end(&sd->bl,type,INVALID_TIMER);
  6701.      }
  6702. -    group = skill_unitsetting(&sd->bl,skill_num,skill_lv,sd->bl.x,sd->bl.y,0);
  6703. +    group = skill_unitsetting(&sd->bl,skill_id,skill_lv,sd->bl.x,sd->bl.y,0);
  6704.      if (group) {
  6705.          sc_start4(&sd->bl,type,100,(battle_config.guild_aura&16)?0:skill_lv,0,0,group->group_id,600000);//duration doesn't matter these status never end with val4
  6706.      }
  6707. @@ -1317,10 +1318,10 @@
  6708.  // Blocks all guild skills which have a common delay time.
  6709.  void guild_block_skill(struct map_session_data *sd, int time)
  6710.  {
  6711. -    int skill_num[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
  6712. +    uint16 skill_id[] = { GD_BATTLEORDER, GD_REGENERATION, GD_RESTORE, GD_EMERGENCYCALL };
  6713.      int i;
  6714.      for (i = 0; i < 4; i++)
  6715. -        skill_blockpc_start_(sd, skill_num[i], time , true);
  6716. +        skill_blockpc_start_(sd, skill_id[i], time , true);
  6717.  }
  6718.  
  6719.  /*====================================================
  6720. @@ -1330,7 +1331,7 @@
  6721.   *  1 = enemy
  6722.   * Returns true if yes.
  6723.   *---------------------------------------------------*/
  6724. -int guild_check_alliance(int guild_id1, int guild_id2, int flag)
  6725. +int guild_check_alliance(uint32 guild_id1, uint32 guild_id2, int flag)
  6726.  {
  6727.      struct guild *g;
  6728.      int i;
  6729. @@ -1404,7 +1405,7 @@
  6730.  /*====================================================
  6731.   * Player sd, answer to player tsd (account_id) for an alliance request
  6732.   *---------------------------------------------------*/
  6733. -int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
  6734. +int guild_reply_reqalliance(struct map_session_data *sd,uint32 account_id,int flag)
  6735.  {
  6736.      struct map_session_data *tsd;
  6737.  
  6738. @@ -1465,7 +1466,7 @@
  6739.  /*====================================================
  6740.   * Player sd asking to break alliance with guild guild_id
  6741.   *---------------------------------------------------*/
  6742. -int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
  6743. +int guild_delalliance(struct map_session_data *sd,uint32 guild_id,int flag)
  6744.  {
  6745.      nullpo_ret(sd);
  6746.  
  6747. @@ -1524,10 +1525,10 @@
  6748.  /*====================================================
  6749.   * Notification of a relationship between 2 guilds
  6750.   *---------------------------------------------------*/
  6751. -int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag,const char *name1,const char *name2)
  6752. +int guild_allianceack(uint32 guild_id1,uint32 guild_id2,uint32 account_id1,uint32 account_id2,int flag,const char *name1,const char *name2)
  6753.  {
  6754.      struct guild *g[2];
  6755. -    int guild_id[2];
  6756. +    uint32 guild_id[2];
  6757.      const char *guild_name[2];
  6758.      struct map_session_data *sd[2];
  6759.      int j,i;
  6760. @@ -1603,7 +1604,7 @@
  6761.  int guild_broken_sub(DBKey key, DBData *data, va_list ap)
  6762.  {
  6763.      struct guild *g = db_data2ptr(data);
  6764. -    int guild_id=va_arg(ap,int);
  6765. +    uint32 guild_id=va_arg(ap,int);
  6766.      int i,j;
  6767.      struct map_session_data *sd=NULL;
  6768.  
  6769. @@ -1629,7 +1630,7 @@
  6770.  {
  6771.      char name[EVENT_NAME_LENGTH];
  6772.      struct guild_castle *gc = db_data2ptr(data);
  6773. -    int guild_id = va_arg(ap, int);
  6774. +    uint32 guild_id = va_arg(ap, int);
  6775.  
  6776.      nullpo_ret(gc);
  6777.  
  6778. @@ -1646,7 +1647,7 @@
  6779.  }
  6780.  
  6781.  //Invoked on /breakguild "Guild name"
  6782. -int guild_broken(int guild_id,int flag)
  6783. +int guild_broken(uint32 guild_id,int flag)
  6784.  {
  6785.      struct guild *g = guild_search(guild_id);
  6786.      struct map_session_data *sd = NULL;
  6787. @@ -1673,7 +1674,7 @@
  6788.  }
  6789.  
  6790.  //Changes the Guild Master to the specified player. [Skotlex]
  6791. -int guild_gm_change(int guild_id, struct map_session_data *sd)
  6792. +int guild_gm_change(uint32 guild_id, struct map_session_data *sd)
  6793.  {
  6794.      struct guild *g;
  6795.      nullpo_ret(sd);
  6796. @@ -1694,7 +1695,7 @@
  6797.  }
  6798.  
  6799.  //Notification from Char server that a guild's master has changed. [Skotlex]
  6800. -int guild_gm_changed(int guild_id, int account_id, int char_id)
  6801. +int guild_gm_changed(uint32 guild_id, uint32 account_id, uint32 char_id)
  6802.  {
  6803.      struct guild *g;
  6804.      struct guild_member gm;
  6805. @@ -1997,7 +1998,7 @@
  6806.  }
  6807.  
  6808.  // Are these two guilds allied?
  6809. -bool guild_isallied(int guild_id, int guild_id2)
  6810. +bool guild_isallied(uint32 guild_id, uint32 guild_id2)
  6811.  {
  6812.      int i;
  6813.      struct guild *g = guild_search(guild_id);
  6814. Index: src/map/guild.h
  6815. --- src/map/guild.h Base (BASE)
  6816. +++ src/map/guild.h Locally Modified (Based On LOCAL)
  6817. @@ -16,7 +16,7 @@
  6818.  //For quick linking to a guardian's info. [Skotlex]
  6819.  struct guardian_data {
  6820.      int number; //0-MAX_GUARDIANS-1 = Guardians. MAX_GUARDIANS = Emperium.
  6821. -    int guild_id;
  6822. +    uint32 guild_id;
  6823.      int emblem_id;
  6824.      int guardup_lv; //Level of GD_GUARDUP skill.
  6825.      char guild_name[NAME_LENGTH];
  6826. @@ -28,10 +28,10 @@
  6827.  int guild_checkskill(struct guild *g,int id);
  6828.  int guild_check_skill_require(struct guild *g,int id); // [Komurka]
  6829.  int guild_checkcastles(struct guild *g); // [MouseJstr]
  6830. -bool guild_isallied(int guild_id, int guild_id2); //Checks alliance based on guild Ids. [Skotlex]
  6831. +bool guild_isallied(uint32 guild_id, uint32 guild_id2); //Checks alliance based on guild Ids. [Skotlex]
  6832.  
  6833.  void do_init_guild(void);
  6834. -struct guild *guild_search(int guild_id);
  6835. +struct guild *guild_search(uint32 guild_id);
  6836.  struct guild *guild_searchname(char *str);
  6837.  struct guild_castle *guild_castle_search(int gcid);
  6838.  
  6839. @@ -39,56 +39,56 @@
  6840.  struct guild_castle *guild_mapindex2gc(short mapindex);
  6841.  
  6842.  struct map_session_data *guild_getavailablesd(struct guild *g);
  6843. -int guild_getindex(struct guild *g,int account_id,int char_id);
  6844. +int guild_getindex(struct guild *g,uint32 account_id,uint32 char_id);
  6845.  int guild_getposition(struct guild *g, struct map_session_data *sd);
  6846.  unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp);
  6847.  int guild_getexp(struct map_session_data *sd,int exp); // [Celest]
  6848.  
  6849.  int guild_create(struct map_session_data *sd, const char *name);
  6850. -int guild_created(int account_id,int guild_id);
  6851. -int guild_request_info(int guild_id);
  6852. -int guild_recv_noinfo(int guild_id);
  6853. +int guild_created(uint32 account_id,uint32 guild_id);
  6854. +int guild_request_info(uint32 guild_id);
  6855. +int guild_recv_noinfo(uint32 guild_id);
  6856.  int guild_recv_info(struct guild *sg);
  6857. -int guild_npc_request_info(int guild_id,const char *ev);
  6858. +int guild_npc_request_info(uint32 guild_id,const char *ev);
  6859.  int guild_invite(struct map_session_data *sd,struct map_session_data *tsd);
  6860. -int guild_reply_invite(struct map_session_data *sd,int guild_id,int flag);
  6861. +int guild_reply_invite(struct map_session_data *sd,uint32 guild_id,int flag);
  6862.  void guild_member_joined(struct map_session_data *sd);
  6863. -int guild_member_added(int guild_id,int account_id,int char_id,int flag);
  6864. -int guild_leave(struct map_session_data *sd,int guild_id,
  6865. -                int account_id,int char_id,const char *mes);
  6866. -int guild_member_withdraw(int guild_id,int account_id,int char_id,int flag,
  6867. +int guild_member_added(uint32 guild_id,uint32 account_id,uint32 char_id,int flag);
  6868. +int guild_leave(struct map_session_data *sd,uint32 guild_id,
  6869. +                uint32 account_id,uint32 char_id,const char *mes);
  6870. +int guild_member_withdraw(uint32 guild_id,uint32 account_id,uint32 char_id,int flag,
  6871.                            const char *name,const char *mes);
  6872. -int guild_expulsion(struct map_session_data *sd,int guild_id,
  6873. -                    int account_id,int char_id,const char *mes);
  6874. -int guild_skillup(struct map_session_data *sd, int skill_num);
  6875. +int guild_expulsion(struct map_session_data *sd,uint32 guild_id,
  6876. +                    uint32 account_id,uint32 char_id,const char *mes);
  6877. +int guild_skillup(struct map_session_data *sd, uint16 skill_id);
  6878.  void guild_block_skill(struct map_session_data *sd, int time);
  6879.  int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd);
  6880. -int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag);
  6881. -int guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2);
  6882. -int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id2,
  6883. +int guild_reply_reqalliance(struct map_session_data *sd,uint32 account_id,int flag);
  6884. +int guild_alliance(uint32 guild_id1,uint32 guild_id2,uint32 account_id1,uint32 account_id2);
  6885. +int guild_allianceack(uint32 guild_id1,uint32 guild_id2,uint32 account_id1,uint32 account_id2,
  6886.                        int flag,const char *name1,const char *name2);
  6887. -int guild_delalliance(struct map_session_data *sd,int guild_id,int flag);
  6888. +int guild_delalliance(struct map_session_data *sd,uint32 guild_id,int flag);
  6889.  int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd);
  6890. -int guild_check_alliance(int guild_id1, int guild_id2, int flag);
  6891. +int guild_check_alliance(uint32 guild_id1, uint32 guild_id2, int flag);
  6892.  
  6893.  int guild_send_memberinfoshort(struct map_session_data *sd,int online);
  6894. -int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_);
  6895. -int guild_change_memberposition(int guild_id,int account_id,int char_id,short idx);
  6896. +int guild_recv_memberinfoshort(uint32 guild_id,uint32 account_id,uint32 char_id,int online,int lv,short class_);
  6897. +int guild_change_memberposition(uint32 guild_id,uint32 account_id,uint32 char_id,short idx);
  6898.  int guild_memberposition_changed(struct guild *g,int idx,int pos);
  6899. -int guild_change_position(int guild_id,int idx,int mode,int exp_mode,const char *name);
  6900. -int guild_position_changed(int guild_id,int idx,struct guild_position *p);
  6901. -int guild_change_notice(struct map_session_data *sd,int guild_id,const char *mes1,const char *mes2);
  6902. -int guild_notice_changed(int guild_id,const char *mes1,const char *mes2);
  6903. +int guild_change_position(uint32 guild_id,int idx,int mode,int exp_mode,const char *name);
  6904. +int guild_position_changed(uint32 guild_id,int idx,struct guild_position *p);
  6905. +int guild_change_notice(struct map_session_data *sd,uint32 guild_id,const char *mes1,const char *mes2);
  6906. +int guild_notice_changed(uint32 guild_id,const char *mes1,const char *mes2);
  6907.  int guild_change_emblem(struct map_session_data *sd,int len,const char *data);
  6908. -int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data);
  6909. +int guild_emblem_changed(int len,uint32 guild_id,int emblem_id,const char *data);
  6910.  int guild_send_message(struct map_session_data *sd,const char *mes,int len);
  6911. -int guild_recv_message(int guild_id,int account_id,const char *mes,int len);
  6912. +int guild_recv_message(uint32 guild_id,uint32 account_id,const char *mes,int len);
  6913.  int guild_send_dot_remove(struct map_session_data *sd);
  6914. -int guild_skillupack(int guild_id,int skill_num,int account_id);
  6915. +int guild_skillupack(uint32 guild_id,uint16 skill_id,uint32 account_id);
  6916.  int guild_break(struct map_session_data *sd,char *name);
  6917. -int guild_broken(int guild_id,int flag);
  6918. -int guild_gm_change(int guild_id, struct map_session_data *sd);
  6919. -int guild_gm_changed(int guild_id, int account_id, int char_id);
  6920. +int guild_broken(uint32 guild_id,int flag);
  6921. +int guild_gm_change(uint32 guild_id, struct map_session_data *sd);
  6922. +int guild_gm_changed(uint32 guild_id, uint32 account_id, uint32 char_id);
  6923.  
  6924.  void guild_castle_map_init(void);
  6925.  int guild_castledatasave(int castle_id,int index,int value);
  6926. @@ -105,7 +105,7 @@
  6927.  void guild_flag_remove(struct npc_data *nd);
  6928.  void guild_flags_clear(void);
  6929.  
  6930. -void guild_guildaura_refresh(struct map_session_data *sd, int skill_num, int skill_lv);
  6931. +void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
  6932.  
  6933.  void do_final_guild(void);
  6934.  
  6935. Index: src/map/homunculus.c
  6936. --- src/map/homunculus.c Base (BASE)
  6937. +++ src/map/homunculus.c Locally Modified (Based On LOCAL)
  6938. @@ -49,7 +49,7 @@
  6939.  //For holding the view data of npc classes. [Skotlex]
  6940.  static struct view_data hom_viewdb[MAX_HOMUNCULUS_CLASS];
  6941.  
  6942. -struct view_data *merc_get_hom_viewdata(int class_) {
  6943. +struct view_data *merc_get_hom_viewdata(short class_) {
  6944.      //Returns the viewdata for homunculus
  6945.      if (homdb_checkid(class_))
  6946.          return &hom_viewdb[class_-HM_CLASS_BASE];
  6947. @@ -273,7 +273,7 @@
  6948.      return 0;
  6949.  }
  6950.  
  6951. -int merc_hom_checkskill(struct homun_data *hd,int skill_id)
  6952. +int merc_hom_checkskill(struct homun_data *hd, uint16 skill_id)
  6953.  {
  6954.      int i = skill_id - HM_SKILLBASE;
  6955.      if (!hd)
  6956. @@ -287,15 +287,16 @@
  6957.  
  6958.  int merc_skill_tree_get_max(int id, int b_class)
  6959.  {
  6960. -    int i, skillid;
  6961. +    int i;
  6962. +    uint16 skill_id;
  6963.      b_class -= HM_CLASS_BASE;
  6964. -    for (i=0; (skillid=hskill_tree[b_class][i].id)>0; i++)
  6965. -        if (id == skillid)
  6966. +    for (i=0; (skill_id=hskill_tree[b_class][i].id)>0; i++)
  6967. +        if (id == skill_id)
  6968.              return hskill_tree[b_class][i].max;
  6969.      return skill_get_max(id);
  6970.  }
  6971.  
  6972. -void merc_hom_skillup(struct homun_data *hd,int skillnum)
  6973. +void merc_hom_skillup(struct homun_data *hd,uint16 skill_id)
  6974.  {
  6975.      int i = 0 ;
  6976.      nullpo_retv(hd);
  6977. @@ -303,17 +304,17 @@
  6978.      if (hd->homunculus.vaporize)
  6979.          return;
  6980.  
  6981. -    i = skillnum - HM_SKILLBASE;
  6982. +    i = skill_id - HM_SKILLBASE;
  6983.      if (hd->homunculus.skillpts > 0 &&
  6984.          hd->homunculus.hskill[i].id &&
  6985.          hd->homunculus.hskill[i].flag == SKILL_FLAG_PERMANENT && //Don't allow raising while you have granted skills. [Skotlex]
  6986. -        hd->homunculus.hskill[i].lv < merc_skill_tree_get_max(skillnum, hd->homunculus.class_)
  6987. +        hd->homunculus.hskill[i].lv < merc_skill_tree_get_max(skill_id, hd->homunculus.class_)
  6988.         ) {
  6989.          hd->homunculus.hskill[i].lv++;
  6990.          hd->homunculus.skillpts-- ;
  6991.          status_calc_homunculus(hd,0);
  6992.          if (hd->master) {
  6993. -            clif_homskillup(hd->master, skillnum);
  6994. +            clif_homskillup(hd->master, skill_id);
  6995.              clif_hominfo(hd->master,hd,0);
  6996.              clif_homskillinfoblock(hd->master);
  6997.          }
  6998. @@ -853,7 +854,7 @@
  6999.  }
  7000.  
  7001.  // Recv homunculus data from char server
  7002. -int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag)
  7003. +int merc_hom_recv_data(uint32 account_id, struct s_homunculus *sh, int flag)
  7004.  {
  7005.      struct map_session_data *sd;
  7006.      struct homun_data *hd;
  7007. @@ -893,7 +894,7 @@
  7008.  }
  7009.  
  7010.  // Ask homunculus creation to char server
  7011. -int merc_create_homunculus_request(struct map_session_data *sd, int class_)
  7012. +int merc_create_homunculus_request(struct map_session_data *sd, short class_)
  7013.  {
  7014.      struct s_homunculus homun;
  7015.      struct h_stats *base;
  7016. @@ -1279,7 +1280,7 @@
  7017.  
  7018.  int do_init_merc(void)
  7019.  {
  7020. -    int class_;
  7021. +    short class_;
  7022.      read_homunculusdb();
  7023.      read_homunculus_expdb();
  7024.      read_homunculus_skilldb();
  7025. Index: src/map/homunculus.h
  7026. --- src/map/homunculus.h Base (BASE)
  7027. +++ src/map/homunculus.h Locally Modified (Based On LOCAL)
  7028. @@ -90,14 +90,14 @@
  7029.  // merc_is_hom_alive(struct homun_data *)
  7030.  #define merc_is_hom_active(x) (x && x->homunculus.vaporize != 1 && x->battle_status.hp > 0)
  7031.  int do_init_merc(void);
  7032. -int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag); //albator
  7033. -struct view_data *merc_get_hom_viewdata(int class_);
  7034. +int merc_hom_recv_data(uint32 account_id, struct s_homunculus *sh, int flag); //albator
  7035. +struct view_data *merc_get_hom_viewdata(short class_);
  7036.  int hom_class2mapid(int hom_class);
  7037.  void merc_damage(struct homun_data *hd);
  7038.  int merc_hom_dead(struct homun_data *hd);
  7039. -void merc_hom_skillup(struct homun_data *hd,int skillnum);
  7040. +void merc_hom_skillup(struct homun_data *hd,uint16 skill_id);
  7041.  int merc_hom_calc_skilltree(struct homun_data *hd, int flag_evolve);
  7042. -int merc_hom_checkskill(struct homun_data *hd,int skill_id);
  7043. +int merc_hom_checkskill(struct homun_data *hd,uint16 skill_id);
  7044.  int merc_hom_gainexp(struct homun_data *hd,int exp);
  7045.  int merc_hom_levelup(struct homun_data *hd);
  7046.  int merc_hom_evolution(struct homun_data *hd);
  7047. @@ -110,7 +110,7 @@
  7048.  int merc_hom_shuffle(struct homun_data *hd); // [Zephyrus]
  7049.  void merc_save(struct homun_data *hd);
  7050.  int merc_call_homunculus(struct map_session_data *sd);
  7051. -int merc_create_homunculus_request(struct map_session_data *sd, int class_);
  7052. +int merc_create_homunculus_request(struct map_session_data *sd, short class_);
  7053.  int search_homunculusDB_index(int key,int type);
  7054.  int merc_menu(struct map_session_data *sd,int menunum);
  7055.  int merc_hom_food(struct map_session_data *sd, struct homun_data *hd);
  7056. Index: src/map/instance.c
  7057. --- src/map/instance.c Base (BASE)
  7058. +++ src/map/instance.c Locally Modified (Based On LOCAL)
  7059. @@ -96,7 +96,7 @@
  7060.   *--------------------------------------*/
  7061.  int instance_add_map(const char *name, int instance_id, bool usebasename)
  7062.  {
  7063. -    int m = map_mapname2mapid(name), i, im = -1;
  7064. +    short m = map_mapname2mapid(name), i, im = -1;
  7065.      size_t num_cell, size;
  7066.  
  7067.      if (m < 0)
  7068. @@ -165,7 +165,7 @@
  7069.   * party_id : source party of this instance
  7070.   * type : result (0 = map id | 1 = instance id)
  7071.   *--------------------------------------*/
  7072. -int instance_map2imap(int m, int instance_id)
  7073. +int instance_map2imap(short m, int instance_id)
  7074.  {
  7075.      int i;
  7076.  
  7077. @@ -185,7 +185,7 @@
  7078.   * instance_id : where to search
  7079.   * result : mapid of map "m" in this instance
  7080.   *--------------------------------------*/
  7081. -int instance_mapid2imapid(int m, int instance_id)
  7082. +int instance_mapid2imapid(short m, int instance_id)
  7083.  {
  7084.      if (map[m].flag.src4instance == 0)
  7085.          return m; // not instances found for this map
  7086. @@ -208,7 +208,7 @@
  7087.  int instance_map_npcsub(struct block_list *bl, va_list args)
  7088.  {
  7089.      struct npc_data *nd = (struct npc_data *)bl;
  7090. -    int m = va_arg(args, int); // Destination Map
  7091. +    short m = va_arg(args, int); // Destination Map
  7092.  
  7093.      npc_duplicate4instance(nd, m);
  7094.      return 1;
  7095. @@ -237,7 +237,7 @@
  7096.   *--------------------------------------*/
  7097.  int instance_del_load(struct map_session_data *sd, va_list args)
  7098.  {
  7099. -    int m = va_arg(args,int);
  7100. +    short m = va_arg(args,int);
  7101.      if (!sd || sd->bl.m != m)
  7102.          return 0;
  7103.  
  7104. @@ -277,7 +277,7 @@
  7105.  /*--------------------------------------
  7106.   * Removes a simple instance map
  7107.   *--------------------------------------*/
  7108. -void instance_del_map(int m)
  7109. +void instance_del_map(short m)
  7110.  {
  7111.      int i;
  7112.      if (m <= 0 || !map[m].instance_id) {
  7113. @@ -441,7 +441,7 @@
  7114.   *--------------------------------------*/
  7115.  void instance_check_kick(struct map_session_data *sd)
  7116.  {
  7117. -    int m = sd->bl.m;
  7118. +    short m = sd->bl.m;
  7119.  
  7120.      clif_instance_leave(sd->fd);
  7121.      if (map[m].instance_id) {
  7122. Index: src/map/instance.h
  7123. --- src/map/instance.h Base (BASE)
  7124. +++ src/map/instance.h Locally Modified (Based On LOCAL)
  7125. @@ -35,9 +35,9 @@
  7126.  
  7127.  int instance_create(int party_id, const char *name);
  7128.  int instance_add_map(const char *name, int instance_id, bool usebasename);
  7129. -void instance_del_map(int m);
  7130. -int instance_map2imap(int m, int instance_id);
  7131. -int instance_mapid2imapid(int m, int instance_id);
  7132. +void instance_del_map(short m);
  7133. +int instance_map2imap(short m, int instance_id);
  7134. +int instance_mapid2imapid(short m, int instance_id);
  7135.  void instance_destroy(int instance_id);
  7136.  void instance_init(int instance_id);
  7137.  
  7138. Index: src/map/intif.c
  7139. --- src/map/intif.c Base (BASE)
  7140. +++ src/map/intif.c Locally Modified (Based On LOCAL)
  7141. @@ -58,7 +58,7 @@
  7142.  }
  7143.  
  7144.  // pet
  7145. -int intif_create_pet(int account_id,int char_id,short pet_class,short pet_lv,short pet_egg_id,
  7146. +int intif_create_pet(uint32 account_id,uint32 char_id,short pet_class,short pet_lv,short pet_egg_id,
  7147.                       short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name)
  7148.  {
  7149.      if (CheckForCharServer())
  7150. @@ -81,7 +81,7 @@
  7151.      return 0;
  7152.  }
  7153.  
  7154. -int intif_request_petdata(int account_id,int char_id,int pet_id)
  7155. +int intif_request_petdata(uint32 account_id,uint32 char_id,uint32 pet_id)
  7156.  {
  7157.      if (CheckForCharServer())
  7158.          return 0;
  7159. @@ -95,7 +95,7 @@
  7160.      return 0;
  7161.  }
  7162.  
  7163. -int intif_save_petdata(int account_id,struct s_pet *p)
  7164. +int intif_save_petdata(uint32 account_id,struct s_pet *p)
  7165.  {
  7166.      if (CheckForCharServer())
  7167.          return 0;
  7168. @@ -109,7 +109,7 @@
  7169.      return 0;
  7170.  }
  7171.  
  7172. -int intif_delete_petdata(int pet_id)
  7173. +int intif_delete_petdata(uint32 pet_id)
  7174.  {
  7175.      if (CheckForCharServer())
  7176.          return 0;
  7177. @@ -361,7 +361,7 @@
  7178.      return 0;
  7179.  }
  7180.  
  7181. -int intif_request_guild_storage(int account_id,int guild_id)
  7182. +int intif_request_guild_storage(uint32 account_id,uint32 guild_id)
  7183.  {
  7184.      if (CheckForCharServer())
  7185.          return 0;
  7186. @@ -372,7 +372,7 @@
  7187.      WFIFOSET(inter_fd,10);
  7188.      return 0;
  7189.  }
  7190. -int intif_send_guild_storage(int account_id,struct guild_storage *gstor)
  7191. +int intif_send_guild_storage(uint32 account_id,struct guild_storage *gstor)
  7192.  {
  7193.      if (CheckForCharServer())
  7194.          return 0;
  7195. @@ -405,7 +405,7 @@
  7196.  }
  7197.  
  7198.  // Party information request
  7199. -int intif_request_partyinfo(int party_id, int char_id)
  7200. +int intif_request_partyinfo(int party_id, uint32 char_id)
  7201.  {
  7202.      if (CheckForCharServer())
  7203.          return 0;
  7204. @@ -432,7 +432,7 @@
  7205.  }
  7206.  
  7207.  // Request to change party configuration (exp,item share)
  7208. -int intif_party_changeoption(int party_id,int account_id,int exp,int item)
  7209. +int intif_party_changeoption(int party_id,uint32 account_id,int exp,int item)
  7210.  {
  7211.      if (CheckForCharServer())
  7212.          return 0;
  7213. @@ -447,7 +447,7 @@
  7214.  }
  7215.  
  7216.  // Request to leave party
  7217. -int intif_party_leave(int party_id,int account_id, int char_id)
  7218. +int intif_party_leave(int party_id,uint32 account_id, uint32 char_id)
  7219.  {
  7220.      if (CheckForCharServer())
  7221.          return 0;
  7222. @@ -463,7 +463,7 @@
  7223.  // Request keeping party for new map ??
  7224.  int intif_party_changemap(struct map_session_data *sd,int online)
  7225.  {
  7226. -    int m, mapindex;
  7227. +    short m, mapindex;
  7228.  
  7229.      if (CheckForCharServer())
  7230.          return 0;
  7231. @@ -500,7 +500,7 @@
  7232.  }
  7233.  
  7234.  // Sending party chat
  7235. -int intif_party_message(int party_id,int account_id,const char *mes,int len)
  7236. +int intif_party_message(int party_id,uint32 account_id,const char *mes,int len)
  7237.  {
  7238.      if (CheckForCharServer())
  7239.          return 0;
  7240. @@ -519,7 +519,7 @@
  7241.  }
  7242.  
  7243.  // Request a new leader for party
  7244. -int intif_party_leaderchange(int party_id,int account_id,int char_id)
  7245. +int intif_party_leaderchange(int party_id,uint32 account_id,uint32 char_id)
  7246.  {
  7247.      if (CheckForCharServer())
  7248.          return 0;
  7249. @@ -550,7 +550,7 @@
  7250.  }
  7251.  
  7252.  // Request Guild information
  7253. -int intif_guild_request_info(int guild_id)
  7254. +int intif_guild_request_info(uint32 guild_id)
  7255.  {
  7256.      if (CheckForCharServer())
  7257.          return 0;
  7258. @@ -562,7 +562,7 @@
  7259.  }
  7260.  
  7261.  // Request to add member to the guild
  7262. -int intif_guild_addmember(int guild_id,struct guild_member *m)
  7263. +int intif_guild_addmember(uint32 guild_id,struct guild_member *m)
  7264.  {
  7265.      if (CheckForCharServer())
  7266.          return 0;
  7267. @@ -576,7 +576,7 @@
  7268.  }
  7269.  
  7270.  // Request a new leader for guild
  7271. -int intif_guild_change_gm(int guild_id, const char *name, int len)
  7272. +int intif_guild_change_gm(uint32 guild_id, const char *name, int len)
  7273.  {
  7274.      if (CheckForCharServer())
  7275.          return 0;
  7276. @@ -590,7 +590,7 @@
  7277.  }
  7278.  
  7279.  // Request to leave guild
  7280. -int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const char *mes)
  7281. +int intif_guild_leave(uint32 guild_id,uint32 account_id,uint32 char_id,int flag,const char *mes)
  7282.  {
  7283.      if (CheckForCharServer())
  7284.          return 0;
  7285. @@ -606,7 +606,7 @@
  7286.  }
  7287.  
  7288.  //Update request / Lv online status of the guild members
  7289. -int intif_guild_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_)
  7290. +int intif_guild_memberinfoshort(uint32 guild_id,uint32 account_id,uint32 char_id,int online,int lv,short class_)
  7291.  {
  7292.      if (CheckForCharServer())
  7293.          return 0;
  7294. @@ -623,7 +623,7 @@
  7295.  }
  7296.  
  7297.  //Guild disbanded notification
  7298. -int intif_guild_break(int guild_id)
  7299. +int intif_guild_break(uint32 guild_id)
  7300.  {
  7301.      if (CheckForCharServer())
  7302.          return 0;
  7303. @@ -635,7 +635,7 @@
  7304.  }
  7305.  
  7306.  // Send a guild message
  7307. -int intif_guild_message(int guild_id,int account_id,const char *mes,int len)
  7308. +int intif_guild_message(uint32 guild_id,uint32 account_id,const char *mes,int len)
  7309.  {
  7310.      if (CheckForCharServer())
  7311.          return 0;
  7312. @@ -655,7 +655,7 @@
  7313.  }
  7314.  
  7315.  // Request a change of Guild basic information
  7316. -int intif_guild_change_basicinfo(int guild_id,int type,const void *data,int len)
  7317. +int intif_guild_change_basicinfo(uint32 guild_id,int type,const void *data,int len)
  7318.  {
  7319.      if (CheckForCharServer())
  7320.          return 0;
  7321. @@ -670,7 +670,7 @@
  7322.  }
  7323.  
  7324.  // Request a change of Guild member information
  7325. -int intif_guild_change_memberinfo(int guild_id,int account_id,int char_id,
  7326. +int intif_guild_change_memberinfo(uint32 guild_id,uint32 account_id,uint32 char_id,
  7327.                                    int type,const void *data,int len)
  7328.  {
  7329.      if (CheckForCharServer())
  7330. @@ -688,7 +688,7 @@
  7331.  }
  7332.  
  7333.  // Request a change of Guild title
  7334. -int intif_guild_position(int guild_id,int idx,struct guild_position *p)
  7335. +int intif_guild_position(uint32 guild_id,int idx,struct guild_position *p)
  7336.  {
  7337.      if (CheckForCharServer())
  7338.          return 0;
  7339. @@ -702,15 +702,15 @@
  7340.      return 0;
  7341.  }
  7342.  
  7343. -// Request an update of Guildskill skillnum
  7344. -int intif_guild_skillup(int guild_id, int skill_num, int account_id, int max)
  7345. +// Request an update of Guildskill skillid
  7346. +int intif_guild_skillup(uint32 guild_id, uint16 skill_id, uint32 account_id, int max)
  7347.  {
  7348.      if (CheckForCharServer())
  7349.          return 0;
  7350.      WFIFOHEAD(inter_fd, 18);
  7351.      WFIFOW(inter_fd, 0)  = 0x303c;
  7352.      WFIFOL(inter_fd, 2)  = guild_id;
  7353. -    WFIFOL(inter_fd, 6)  = skill_num;
  7354. +    WFIFOL(inter_fd, 6)  = skill_id;
  7355.      WFIFOL(inter_fd, 10) = account_id;
  7356.      WFIFOL(inter_fd, 14) = max;
  7357.      WFIFOSET(inter_fd, 18);
  7358. @@ -718,7 +718,7 @@
  7359.  }
  7360.  
  7361.  // Request a new guild relationship
  7362. -int intif_guild_alliance(int guild_id1,int guild_id2,int account_id1,int account_id2,int flag)
  7363. +int intif_guild_alliance(uint32 guild_id1,uint32 guild_id2,uint32 account_id1,uint32 account_id2,int flag)
  7364.  {
  7365.      if (CheckForCharServer())
  7366.          return 0;
  7367. @@ -734,7 +734,7 @@
  7368.  }
  7369.  
  7370.  // Request to change guild notice
  7371. -int intif_guild_notice(int guild_id,const char *mes1,const char *mes2)
  7372. +int intif_guild_notice(uint32 guild_id,const char *mes1,const char *mes2)
  7373.  {
  7374.      if (CheckForCharServer())
  7375.          return 0;
  7376. @@ -748,7 +748,7 @@
  7377.  }
  7378.  
  7379.  // Request to change guild emblem
  7380. -int intif_guild_emblem(int guild_id,int len,const char *data)
  7381. +int intif_guild_emblem(uint32 guild_id,int len,const char *data)
  7382.  {
  7383.      if (CheckForCharServer())
  7384.          return 0;
  7385. @@ -800,7 +800,7 @@
  7386.  // Homunculus Packets send to Inter server [albator]
  7387.  //-----------------------------------------------------------------
  7388.  
  7389. -int intif_homunculus_create(int account_id, struct s_homunculus *sh)
  7390. +int intif_homunculus_create(uint32 account_id, struct s_homunculus *sh)
  7391.  {
  7392.      if (CheckForCharServer())
  7393.          return 0;
  7394. @@ -813,7 +813,7 @@
  7395.      return 0;
  7396.  }
  7397.  
  7398. -int intif_homunculus_requestload(int account_id, int homun_id)
  7399. +int intif_homunculus_requestload(uint32 account_id, int homun_id)
  7400.  {
  7401.      if (CheckForCharServer())
  7402.          return 0;
  7403. @@ -825,7 +825,7 @@
  7404.      return 1;
  7405.  }
  7406.  
  7407. -int intif_homunculus_requestsave(int account_id, struct s_homunculus *sh)
  7408. +int intif_homunculus_requestsave(uint32 account_id, struct s_homunculus *sh)
  7409.  {
  7410.      if (CheckForCharServer())
  7411.          return 0;
  7412. @@ -953,7 +953,7 @@
  7413.      struct map_session_data *sd;
  7414.      struct global_reg *reg;
  7415.      int *qty;
  7416. -    int account_id = RFIFOL(fd,4), char_id = RFIFOL(fd,8);
  7417. +    uint32 account_id = RFIFOL(fd,4), char_id = RFIFOL(fd,8);
  7418.      struct auth_node *node = chrif_auth_check(account_id, char_id, ST_LOGIN);
  7419.      if (node)
  7420.          sd = node->sd;
  7421. @@ -1005,7 +1005,7 @@
  7422.  {
  7423.      struct guild_storage *gstor;
  7424.      struct map_session_data *sd;
  7425. -    int guild_id;
  7426. +    uint32 guild_id;
  7427.  
  7428.      guild_id = RFIFOL(fd,8);
  7429.      if (guild_id <= 0)
  7430. @@ -1172,8 +1172,8 @@
  7431.  int intif_parse_GuildBasicInfoChanged(int fd)
  7432.  {
  7433.      //int len = RFIFOW(fd,2) - 10;
  7434. -    int guild_id = RFIFOL(fd,4);
  7435. -    int type = RFIFOW(fd,8);
  7436. +    uint32 guild_id = RFIFOL(fd,4);
  7437. +    uint16 type = RFIFOW(fd,8);
  7438.      //void* data = RFIFOP(fd,10);
  7439.  
  7440.      struct guild *g = guild_search(guild_id);
  7441. @@ -1200,10 +1200,10 @@
  7442.  int intif_parse_GuildMemberInfoChanged(int fd)
  7443.  {
  7444.      //int len = RFIFOW(fd,2) - 18;
  7445. -    int guild_id = RFIFOL(fd,4);
  7446. -    int account_id = RFIFOL(fd,8);
  7447. -    int char_id = RFIFOL(fd,12);
  7448. -    int type = RFIFOW(fd,16);
  7449. +    uint32 guild_id = RFIFOL(fd,4);
  7450. +    uint32 account_id = RFIFOL(fd,8);
  7451. +    uint32 char_id = RFIFOL(fd,12);
  7452. +    uint16 type = RFIFOW(fd,16);
  7453.      //void* data = RFIFOP(fd,18);
  7454.  
  7455.      struct guild *g;
  7456. @@ -1427,7 +1427,7 @@
  7457.  
  7458.  int intif_parse_questlog(int fd)
  7459.  {
  7460. -    int char_id = RFIFOL(fd, 4);
  7461. +    uint32 char_id = RFIFOL(fd, 4);
  7462.      int i;
  7463.      TBL_PC *sd = map_charid2sd(char_id);
  7464.  
  7465. @@ -1503,7 +1503,7 @@
  7466.   * Inbox Request
  7467.   * flag: 0 Update Inbox | 1 OpenMail
  7468.   *------------------------------------------*/
  7469. -int intif_Mail_requestinbox(int char_id, unsigned char flag)
  7470. +int intif_Mail_requestinbox(uint32 char_id, unsigned char flag)
  7471.  {
  7472.      if (CheckForCharServer())
  7473.          return 0;
  7474. @@ -1550,7 +1550,7 @@
  7475.  /*------------------------------------------
  7476.   * Mail Read
  7477.   *------------------------------------------*/
  7478. -int intif_Mail_read(int mail_id)
  7479. +int intif_Mail_read(uint32 mail_id)
  7480.  {
  7481.      if (CheckForCharServer())
  7482.          return 0;
  7483. @@ -1565,7 +1565,7 @@
  7484.  /*------------------------------------------
  7485.   * Get Attachment
  7486.   *------------------------------------------*/
  7487. -int intif_Mail_getattach(int char_id, int mail_id)
  7488. +int intif_Mail_getattach(uint32 char_id, uint32 mail_id)
  7489.  {
  7490.      if (CheckForCharServer())
  7491.          return 0;
  7492. @@ -1605,7 +1605,7 @@
  7493.  /*------------------------------------------
  7494.   * Delete Message
  7495.   *------------------------------------------*/
  7496. -int intif_Mail_delete(int char_id, int mail_id)
  7497. +int intif_Mail_delete(uint32 char_id, uint32 mail_id)
  7498.  {
  7499.      if (CheckForCharServer())
  7500.          return 0;
  7501. @@ -1621,8 +1621,8 @@
  7502.  
  7503.  int intif_parse_Mail_delete(int fd)
  7504.  {
  7505. -    int char_id = RFIFOL(fd,2);
  7506. -    int mail_id = RFIFOL(fd,6);
  7507. +    uint32 char_id = RFIFOL(fd,2);
  7508. +    uint32 mail_id = RFIFOL(fd,6);
  7509.      bool failed = RFIFOB(fd,10);
  7510.  
  7511.      struct map_session_data *sd = map_charid2sd(char_id);
  7512. @@ -1649,7 +1649,7 @@
  7513.  /*------------------------------------------
  7514.   * Return Message