earthlingz

0x970 Character Creation

Mar 10th, 2012
1,431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.93 KB | None | 0 0
  1. Index: char/char.c
  2. ===================================================================
  3. --- char/char.c (revision 15668)
  4. +++ char/char.c (working copy)
  5. @@ -1320,8 +1320,14 @@
  6.  //-----------------------------------
  7.  // Function to create a new character
  8.  //-----------------------------------
  9. +#if PACKETVER >= 20120307
  10. +int make_new_char_sql(struct char_session_data* sd, char* name_, int slot, int hair_color, int hair_style)
  11. +{
  12. +   int str = 5, agi = 5, vit = 5, int_ = 5, dex = 5,luk = 5;
  13. +#else
  14.  int make_new_char_sql(struct char_session_data* sd, char* name_, int str, int agi, int vit, int int_, int dex, int luk, int slot, int hair_color, int hair_style)
  15.  {
  16. +#endif
  17.     char name[NAME_LENGTH];
  18.     char esc_name[NAME_LENGTH*2+1];
  19.     int char_id, flag;
  20. @@ -1335,10 +1341,14 @@
  21.         return flag;
  22.  
  23.     //check other inputs
  24. +#if PACKETVER >= 20120307
  25. +   if(slot >= MAX_CHARS)
  26. +#else
  27.     if((slot >= MAX_CHARS) // slots
  28.     || (str + agi + vit + int_ + dex + luk != 6*5 ) // stats
  29.     || (str < 1 || str > 9 || agi < 1 || agi > 9 || vit < 1 || vit > 9 || int_ < 1 || int_ > 9 || dex < 1 || dex > 9 || luk < 1 || luk > 9) // individual stat values
  30.     || (str + int_ != 10 || agi + luk != 10 || vit + dex != 10) ) // pairs
  31. +#endif
  32.         return -2; // invalid input
  33.  
  34.     // check the number of already existing chars in this account
  35. @@ -3672,14 +3682,24 @@
  36.         break;
  37.  
  38.         // create new char
  39. +#if PACKETVER < 20120307
  40.         // S 0067 <name>.24B <str>.B <agi>.B <vit>.B <int>.B <dex>.B <luk>.B <slot>.B <hair color>.W <hair style>.W
  41.         case 0x67:
  42.             FIFOSD_CHECK(37);
  43. +#else
  44. +       // S 0970 <name>.24B <slot>.B <hair color>.W <hair style>.W
  45. +       case 0x970:
  46. +           FIFOSD_CHECK(31);
  47. +#endif
  48.  
  49.             if( !char_new ) //turn character creation on/off [Kevin]
  50.                 i = -2;
  51.             else
  52. +#if PACKETVER >= 20120307
  53. +               i = make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOW(fd,27),RFIFOW(fd,29));
  54. +#else
  55.                 i = make_new_char_sql(sd, (char*)RFIFOP(fd,2),RFIFOB(fd,26),RFIFOB(fd,27),RFIFOB(fd,28),RFIFOB(fd,29),RFIFOB(fd,30),RFIFOB(fd,31),RFIFOB(fd,32),RFIFOW(fd,33),RFIFOW(fd,35));
  56. +#endif
  57.  
  58.             //'Charname already exists' (-1), 'Char creation denied' (-2) and 'You are underaged' (-3)
  59.             if (i < 0)
  60. @@ -3711,8 +3731,11 @@
  61.                 if( ch < MAX_CHARS )
  62.                     sd->found_char[ch] = i; // the char_id of the new char
  63.             }
  64. -
  65. +#if PACKETVER >= 20120307
  66. +           RFIFOSKIP(fd,31);
  67. +#else
  68.             RFIFOSKIP(fd,37);
  69. +#endif
  70.         break;
  71.  
  72.         // delete char
  73. Index: common/mmo.h
  74. ===================================================================
  75. --- common/mmo.h    (revision 15668)
  76. +++ common/mmo.h    (working copy)
  77. @@ -43,9 +43,10 @@
  78.  // 20110111 - 2011-01-11aRagexeRE+ - 0x6b, 0x6d
  79.  // 20110928 - 2011-09-28aRagexeRE+ - 0x6b, 0x6d
  80.  // 20111025 - 2011-10-25aRagexeRE+ - 0x6b, 0x6d
  81. +// 20120307 - 2012-03-07aRagexeRE+ - 0x970 Character creation packet
  82.  
  83.  #ifndef PACKETVER
  84. -   #define PACKETVER 20111116
  85. +   #define PACKETVER 20120307
  86.     //#define PACKETVER 20100730
  87.  #endif
Add Comment
Please, Sign In to add comment