viewing paste Unknown #12075 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
 sql-files/main.sql                          | 48 ++++++++++++++---------------
 src/common/mmo.h                            |  6 +++-
 src/map/buyingstore.h                       |  6 +++-
 src/map/clif.c                              |  6 +++-
 src/map/itemdb.h                            |  4 ++-
 src/map/npc.h                               |  6 +++-
 src/map/packets_struct.h                    | 12 ++++++--
 src/map/pc.c                                |  2 +-
 src/map/pc.h                                | 24 +++++++++++----
 src/map/pet.c                               |  2 +-
 src/map/script.c                            |  7 ++---
 src/map/searchstore.h                       |  6 +++-
 src/plugins/HPMHooking/HPMHooking.Hooks.inc |  6 ++--
 13 files changed, 88 insertions(+), 47 deletions(-)
 
diff --git a/sql-files/main.sql b/sql-files/main.sql
index 2504522..1efcd5f 100644
--- a/sql-files/main.sql
+++ b/sql-files/main.sql
@@ -17,10 +17,10 @@ CREATE TABLE IF NOT EXISTS `auction` (
   `type` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(11) NOT NULL default '0',
-  `card1` smallint(11) NOT NULL default '0',
-  `card2` smallint(11) NOT NULL default '0',
-  `card3` smallint(11) NOT NULL default '0',
+  `card0` mediumint(11) NOT NULL default '0',
+  `card1` mediumint(11) NOT NULL default '0',
+  `card2` mediumint(11) NOT NULL default '0',
+  `card3` mediumint(11) NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
   PRIMARY KEY  (`auction_id`)
 ) ENGINE=MyISAM;
@@ -38,10 +38,10 @@ CREATE TABLE IF NOT EXISTS `cart_inventory` (
   `identify` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) NOT NULL default '0',
-  `card0` smallint(11) NOT NULL default '0',
-  `card1` smallint(11) NOT NULL default '0',
-  `card2` smallint(11) NOT NULL default '0',
-  `card3` smallint(11) NOT NULL default '0',
+  `card0` mediumint(11) NOT NULL default '0',
+  `card1` mediumint(11) NOT NULL default '0',
+  `card2` mediumint(11) NOT NULL default '0',
+  `card3` mediumint(11) NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `bound` tinyint(1) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
@@ -327,10 +327,10 @@ CREATE TABLE IF NOT EXISTS `guild_storage` (
   `identify` smallint(6) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(11) NOT NULL default '0',
-  `card1` smallint(11) NOT NULL default '0',
-  `card2` smallint(11) NOT NULL default '0',
-  `card3` smallint(11) NOT NULL default '0',
+  `card0` mediumint(11) NOT NULL default '0',
+  `card1` mediumint(11) NOT NULL default '0',
+  `card2` mediumint(11) NOT NULL default '0',
+  `card3` mediumint(11) NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `bound` tinyint(1) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
@@ -391,10 +391,10 @@ CREATE TABLE IF NOT EXISTS `inventory` (
   `identify` smallint(6) NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(11) NOT NULL default '0',
-  `card1` smallint(11) NOT NULL default '0',
-  `card2` smallint(11) NOT NULL default '0',
-  `card3` smallint(11) NOT NULL default '0',
+  `card0` mediumint(11) NOT NULL default '0',
+  `card1` mediumint(11) NOT NULL default '0',
+  `card2` mediumint(11) NOT NULL default '0',
+  `card3` mediumint(11) NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `favorite` tinyint(3) unsigned NOT NULL default '0',
   `bound` tinyint(1) unsigned NOT NULL default '0',
@@ -494,10 +494,10 @@ CREATE TABLE IF NOT EXISTS `mail` (
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
   `identify` smallint(6) NOT NULL default '0',
-  `card0` smallint(11) NOT NULL default '0',
-  `card1` smallint(11) NOT NULL default '0',
-  `card2` smallint(11) NOT NULL default '0',
-  `card3` smallint(11) NOT NULL default '0',
+  `card0` mediumint(11) NOT NULL default '0',
+  `card1` mediumint(11) NOT NULL default '0',
+  `card2` mediumint(11) NOT NULL default '0',
+  `card3` mediumint(11) NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM;
@@ -692,10 +692,10 @@ CREATE TABLE IF NOT EXISTS `storage` (
   `identify` smallint(6) unsigned NOT NULL default '0',
   `refine` tinyint(3) unsigned NOT NULL default '0',
   `attribute` tinyint(4) unsigned NOT NULL default '0',
-  `card0` smallint(11) NOT NULL default '0',
-  `card1` smallint(11) NOT NULL default '0',
-  `card2` smallint(11) NOT NULL default '0',
-  `card3` smallint(11) NOT NULL default '0',
+  `card0` mediumint(11) NOT NULL default '0',
+  `card1` mediumint(11) NOT NULL default '0',
+  `card2` mediumint(11) NOT NULL default '0',
+  `card3` mediumint(11) NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `bound` tinyint(1) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 07a0567..108d3c4 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -217,7 +217,11 @@ struct quest {
 
 struct item {
    int id;
-   short nameid;
+   #ifdef ITEMDB_OVER65K
+       int nameid;
+   #else
+       unsigned short nameid;
+   #endif
    short amount;
    unsigned int equip; // Location(s) where item is equipped (using enum equip_pos for bitmasking).
    char identify;
diff --git a/src/map/buyingstore.h b/src/map/buyingstore.h
index 5141a10..d3e2306 100644
--- a/src/map/buyingstore.h
+++ b/src/map/buyingstore.h
@@ -40,7 +40,11 @@ enum e_buyingstore_failure {
 struct s_buyingstore_item {
    int price;
    unsigned short amount;
-   unsigned short nameid;
+   #ifdef ITEMDB_OVER65K
+       int nameid;
+   #else
+       unsigned short nameid;
+   #endif
 };
 
 struct s_buyingstore {
diff --git a/src/map/clif.c b/src/map/clif.c
index 2fbf64e..7e2aacf 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17088,7 +17088,11 @@ void clif_parse_CloseSearchStoreInfo(int fd, struct map_session_data* sd)
 /// 083c <account id>.L <store id>.L <nameid>.W
 void clif_parse_SearchStoreInfoListItemClick(int fd, struct map_session_data* sd)
 {
-   unsigned short nameid;
+   #ifdef ITEMDB_OVER65K
+       int nameid;
+   #else
+       unsigned short nameid;
+   #endif
    int account_id, store_id;
    struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
 
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 77fb2e2..b4f07ce 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -18,7 +18,9 @@ struct item_package;
 /**
  * Defines
  **/
-#define MAX_ITEMDB 0x8000 // 32k array entries in array (the rest goes to the db)
+#define MAX_ITEMDB 0x10000 // 65K array entries in array (the rest goes to the db)
+//If you define MAX_ITEMDB over 65k arrays entries (item ids), you have to define the flag bellow AND apply the sql patch patch_itemdb_over65k.sql located insed of sql forlder to your database.
+//#define ITEMDB_OVER65K
 #define MAX_ITEMDELAYS 10 // The maximum number of item delays
 #define MAX_SEARCH 5 //Designed for search functions, species max number of matches to display.
 #define MAX_ITEMS_PER_COMBO 6 /* maximum amount of items a combo may require */
diff --git a/src/map/npc.h b/src/map/npc.h
index 346a9f8..6aa67e3 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -37,7 +37,11 @@ struct npc_label_list {
    int pos;
 };
 struct npc_item_list {
-   unsigned short nameid;
+   #ifdef ITEMDB_OVER65K
+       int nameid;
+   #else
+       unsigned short nameid;
+   #endif
    unsigned int value;
    unsigned int qty;
 };
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 55006db..4ba6763 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -316,7 +316,11 @@ struct packet_additem {
    short PacketType;
    unsigned short Index;
    unsigned short count;
-   unsigned short nameid;
+   #ifdef ITEMDB_OVER65K
+       int nameid;
+   #else
+       unsigned short nameid;
+   #endif
    uint8 IsIdentified;
    uint8 IsDamaged;
    unsigned char refiningLevel;
@@ -938,7 +942,11 @@ struct packet_npc_market_open {
    short PacketLength;
    /* inner struct figured by Ind after some annoying hour of debugging (data Thanks to Yommy) */
    struct {
-       unsigned short nameid;
+       #ifdef ITEMDB_OVER65K
+           int nameid;
+       #else
+           unsigned short nameid;
+       #endif
        unsigned char type;
        unsigned int price;
        unsigned int qty;
diff --git a/src/map/pc.c b/src/map/pc.c
index ba66bf7..c46c9b0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1887,7 +1887,7 @@ int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, enum sc_
    return 1;
 }
 
-int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) {
+int pc_bonus_item_drop(struct s_add_drop *drop, const short max, int id, short group, int race, int rate) {
    int i;
 
    //Apply config rate adjustment settings.
diff --git a/src/map/pc.h b/src/map/pc.h
index 70df9ca..b61eed4 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -101,7 +101,12 @@ struct s_addeffectonskill {
    unsigned char target;
 };
 struct s_add_drop {
-   short id, group;
+   #ifdef ITEMDB_OVER65K
+       unsigned int id;
+   #else
+       unsigned short id;
+   #endif
+   short group;
    int race, rate;
 };
 struct s_autobonus {
@@ -254,7 +259,11 @@ struct map_session_data {
    int64 cansendmail_tick;     /// Mail System Flood Protection
    int64 ks_floodprotect_tick; /// [Kill Steal Protection]
    struct {
-       short nameid;
+       #ifdef ITEMDB_OVER65K
+           int nameid;
+       #else
+           unsigned short nameid;
+       #endif
        int64 tick;
    } item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
    short weapontype1,weapontype2;
@@ -304,8 +313,7 @@ struct map_session_data {
    }   add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
    struct s_add_drop add_drop[MAX_PC_BONUS];
    struct {
-       int nameid;
-       int rate;
+       int nameid, rate;
    } itemhealrate[MAX_PC_BONUS];
    struct {
        short flag, rate;
@@ -435,7 +443,11 @@ struct map_session_data {
 
    // Mail System [Zephyrus]
    struct {
-       short nameid;
+       #ifdef ITEMDB_OVER65K
+           int nameid;
+       #else
+           unsigned short nameid;
+       #endif
        int index, amount, zeny;
        struct mail_data inbox;
        bool changed; // if true, should sync with charserver on next mailbox request
@@ -980,7 +992,7 @@ struct pc_interface {
    int (*bonus_autospell_onskill) (struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id);
    int (*bonus_addeff) (struct s_addeffect* effect, int max, enum sc_type id, short rate, short arrow_rate, unsigned char flag);
    int (*bonus_addeff_onskill) (struct s_addeffectonskill* effect, int max, enum sc_type id, short rate, short skill_id, unsigned char target);
-   int (*bonus_item_drop) (struct s_add_drop *drop, const short max, short id, short group, int race, int rate);
+   int (*bonus_item_drop) (struct s_add_drop *drop, const short max, int id, short group, int race, int rate);
    void (*calcexp) (struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src);
    int (*respawn_timer) (int tid, int64 tick, int id, intptr_t data);
    int (*jobchange_killclone) (struct block_list *bl, va_list ap);
diff --git a/src/map/pet.c b/src/map/pet.c
index b5870a8..5d998ba 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -1205,7 +1205,7 @@ int read_petdb()
 {
    char* filename[] = {"pet_db.txt","pet_db2.txt"};
    FILE *fp;
-   int nameid,i,j,k; 
+   int nameid,i,j,k;
 
    // Remove any previous scripts in case reloaddb was invoked.
    for( j = 0; j < MAX_PET_DB; j++ )
diff --git a/src/map/script.c b/src/map/script.c
index 3e11a51..b03e766 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -6469,7 +6469,7 @@ int script_array_index_cmp(const void *a, const void *b) {
  * getitembound "<item id>",<amount>,<type>{,<account ID>};
  *------------------------------------------*/
 BUILDIN(getitem) {
-   int nameid,amount,get_count,i,flag = 0, offset = 0;
+   int nameid, amount,get_count,i,flag = 0, offset = 0;
    struct item it;
    TBL_PC *sd;
    struct item_data *item_data;
@@ -6554,7 +6554,7 @@ int script_array_index_cmp(const void *a, const void *b) {
  *
  *------------------------------------------*/
 BUILDIN(getitem2) {
-   int nameid,amount,i,flag = 0, offset = 0;
+   int nameid, amount,i,flag = 0, offset = 0;
    int iden,ref,attr,c1,c2,c3,c4, bound = 0;
    TBL_PC *sd;
 
@@ -14983,8 +14983,7 @@ int buildin_query_sql_sub(struct script_state* st, Sql* handle)
 {
    const char* npcname = script_getstr(st,2);
    struct npc_data* nd = npc->name2id(npcname);
-   unsigned int nameid;
-   int n, i;
+   int nameid, n, i;
    int amount;
    int size;
 
diff --git a/src/map/searchstore.h b/src/map/searchstore.h
index 827e390..bbfff92 100644
--- a/src/map/searchstore.h
+++ b/src/map/searchstore.h
@@ -50,7 +50,11 @@ struct s_search_store_info_item {
    unsigned int store_id;
    int account_id;
    char store_name[MESSAGE_SIZE];
-   unsigned short nameid;
+   #ifdef ITEMDB_OVER65K
+       int nameid;
+   #else
+       unsigned short nameid;
+   #endif
    unsigned short amount;
    unsigned int price;
    short card[MAX_SLOTS];
diff --git a/src/plugins/HPMHooking/HPMHooking.Hooks.inc b/src/plugins/HPMHooking/HPMHooking.Hooks.inc
index 23f00ea..fed226b 100644
--- a/src/plugins/HPMHooking/HPMHooking.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Hooks.inc
@@ -49593,11 +49593,11 @@ int HP_pc_bonus_addeff_onskill(struct s_addeffectonskill *effect, int max, enum
    }
    return retVal___;
 }
-int HP_pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, short group, int race, int rate) {
+int HP_pc_bonus_item_drop(struct s_add_drop *drop, const short max, int id, short group, int race, int rate) {
    int hIndex = 0;
    int retVal___ = 0;
    if( HPMHooks.count.HP_pc_bonus_item_drop_pre ) {
-       int (*preHookFunc) (struct s_add_drop *drop, const short *max, short *id, short *group, int *race, int *rate);
+       int (*preHookFunc) (struct s_add_drop *drop, const short *max, int *id, short *group, int *race, int *rate);
        for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_item_drop_pre; hIndex++ ) {
            preHookFunc = HPMHooks.list.HP_pc_bonus_item_drop_pre[hIndex].func;
            retVal___ = preHookFunc(drop, &max, &id, &group, &race, &rate);
@@ -49611,7 +49611,7 @@ int HP_pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id, sh
        retVal___ = HPMHooks.source.pc.bonus_item_drop(drop, max, id, group, race, rate);
    }
    if( HPMHooks.count.HP_pc_bonus_item_drop_post ) {
-       int (*postHookFunc) (int retVal___, struct s_add_drop *drop, const short *max, short *id, short *group, int *race, int *rate);
+       int (*postHookFunc) (int retVal___, struct s_add_drop *drop, const short *max, int *id, short *group, int *race, int *rate);
        for(hIndex = 0; hIndex < HPMHooks.count.HP_pc_bonus_item_drop_post; hIndex++ ) {
            postHookFunc = HPMHooks.list.HP_pc_bonus_item_drop_post[hIndex].func;
            retVal___ = postHookFunc(retVal___, drop, &max, &id, &group, &race, &rate);
 
Viewed 852 times, submitted by Guest.