Explorar el Código

Increased item ID array size.
- Increased limit from 32,767 to 65,535.
- Still uses same amount of memory with doubled usable size.
- Adjusted CARD0_PET from -256 to 256.
- Please run both SQL files after applying this update to avoid values becoming corrupt.
- Tested and works on clients 2012-04-10 and up thanks to Cydh.
- Removed an unused SQL file.

aleos89 hace 11 años
padre
commit
7cd82d00db

+ 11 - 11
conf/msg_conf/map_msg.conf

@@ -179,7 +179,7 @@
 166: No item has been refined.
 167: 1 item has been refined.
 168: %d items have been refined.
-169: The item (%d: '%s') is not equipable.
+169: The item (%hu: '%s') is not equipable.
 170: The item is not equipable.
 171: %d - void
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -546,7 +546,7 @@
 
 // Trade Spoof Messages
 538: Hack on trade: character '%s' (account: %d) try to trade more items that he has.
-539: This player has %d of a kind of item (id: %d), and tried to trade %d of them.
+539: This player has %d of a kind of item (id: %hu), and tried to trade %d of them.
 540: This player has been definitivly blocked.
 
 // Rare Items Drop/Steal announce
@@ -731,14 +731,14 @@
 707: You are VIP until: %s
 708: The player is now VIP until: %s
 
-709: Item %d has been removed from your inventory.
-710: Item %d has been removed from your cart.
-711: Item %d has been removed from your storage.
+709: Item %hu has been removed from your inventory.
+710: Item %hu has been removed from your cart.
+711: Item %hu has been removed from your storage.
 
 // Item shop
-712: You do not have enough %s (%d).
+712: You do not have enough %s (%hu).
 713: You do not have enough '%s'.
-714: Item Shop List: %s (%d)
+714: Item Shop List: %s (%hu)
 715: Point Shop List: '%s'
 716: Your '%s' now: %d
 
@@ -1135,9 +1135,9 @@
 1189: Item not found.
 1190: You're already autolooting this item.
 1191: Your autolootitem list is full. Remove some items first with @autolootid -<item name or ID>.
-1192: Autolooting item: '%s'/'%s' {%d}
+1192: Autolooting item: '%s'/'%s' {%hu}
 1193: You're currently not autolooting this item.
-1194: Removed item: '%s'/'%s' {%d} from your autolootitem list.
+1194: Removed item: '%s'/'%s' {%hu} from your autolootitem list.
 1195: You can have %d items on your autolootitem list.
 1196: To add an item to the list, use "@alootid +<item name or ID>". To remove an item, use "@alootid -<item name or ID>".
 1197: "@alootid reset" will clear your autolootitem list.
@@ -1286,7 +1286,7 @@
 
 // @iteminfo
 1276: Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
-1277: Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
+1277: Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
 1278: None
 1279: With script
 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f
@@ -1296,7 +1296,7 @@
 
 // @whodrops
 1284: Please enter item name/ID (usage: @whodrops <item name/ID>).
-1285: Item: '%s'[%d] (ID:%d)
+1285: Item: '%s'[%d] (ID:%hu)
 1286:  - Item is not dropped by mobs.
 1287:  - Common mobs with highest drop chance (only max %d are listed):
 

+ 5 - 5
conf/msg_conf/map_msg_frn.conf

@@ -183,7 +183,7 @@
 166: Aucun équipement n'a été raffiné.
 167: 1 objet raffiné.
 168: %d objets raffinés.
-169: L'objet (%d: '%s') ne peut pas s'équiper.
+169: L'objet (%hu: '%s') ne peut pas s'équiper.
 170: L'objet ne peut pas s'équiper.
 171: %d - void
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -513,7 +513,7 @@
 537: Personnage '%s' (compte: %d) essaie d'utiliser un bot (il essaie de détecter un faux mob).
 // Trade Spoof Messages
 538: Hack sur échange: Personnage '%s' (account: %d) essaie d'échanger plus d'Objets qu'il ne possède.
-539: Ce Joueur a %d d'une sorte d'Objet (id: %d), et tente d'en échanger %d.
+539: Ce Joueur a %d d'une sorte d'Objet (id: %hu), et tente d'en échanger %d.
 540: Joueur définitivement bloqué.
 // Rare Items Drop/Steal announce
 541: '%s' obtient de %s l'Objet %s (chance: %0.02f%%)
@@ -1047,9 +1047,9 @@
 1189: Objet trouvable.
 1190: Vous ramasser déjà automatiquement cet Objet.
 1191: Votre liste d'Objet à ramasser est pleine. Supprimez des Objets avec @autolootid -<nom_ou_ID_Objet>.
-1192: Ramassage automatique de: '%s'/'%s' {%d}
+1192: Ramassage automatique de: '%s'/'%s' {%hu}
 1193: Actuellement vous ne ramassez pas automatiquement cet Objet.
-1194: Onjet supprimé: '%s'/'%s' {%d} de votre liste de 'autolootitem'.
+1194: Onjet supprimé: '%s'/'%s' {%hu} de votre liste de 'autolootitem'.
 1195: Vous pouvez avoir %d Objets dans votre liste d'Objets ramassés automatiquement avec 'autolootitem'.
 1196: Pour ajouter un Objet à votre liste, utilisez "@alootid +<nom_ou_ID_Objet>". Pour supprimer un Objet de la liste, utilisez "@alootid -<nom_ou_ID_Objet>".
 1197: "@alootid reset" videra votre liste d'Objets ramassés automatiquement avec 'autolootitem'.
@@ -1198,7 +1198,7 @@
 
 // @iteminfo
 1276: Entrez un nom/ID d'objet (usage: @ii/@iteminfo <nom/ID>).
-1277: Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
+1277: Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
 1278: Aucun
 1279: Avec script
 1280: NPC Acheté:%dz, Vendu:%dz | Poids: %.1f 

+ 8 - 8
conf/msg_conf/map_msg_idn.conf

@@ -179,7 +179,7 @@
 166: Tidak ada item yang ditempa.
 167: 1 item berhasil ditempa.
 168: %d item berhasil ditempa.
-169: Item (%d: '%s') tidak bisa dipakai.
+169: Item (%hu: '%s') tidak bisa dipakai.
 170: Item ini tidak bisa dipakai.
 171: %d - sudah habis
 //172: Kamu sudah mengganti posisi memo %d - %s (%d,%d).
@@ -525,7 +525,7 @@
 
 // Pesan tentang pelanggaran transaksi.
 538: Hack pada transaksi: Karakter '%s' (akun: %d) sedang mencoba mentransaksikan item lebih dari yang dia punya.
-539: Pemain ini memiliki %d jenis item (id: %d), dan sedang mencoba untuk mentransaksikan %d item.
+539: Pemain ini memiliki %d jenis item (id: %hu), dan sedang mencoba untuk mentransaksikan %d item.
 540: Pemain ini sudah diblok.
 
 // Pesan tentang item langka yang berhasil didapatkan atau dicuri.
@@ -710,9 +710,9 @@
 707: VIP anda berlaku hingga: %s
 708: Status VIP pemain aktif hingga: %s
 
-709: Item %d telah dihapus dari inventory-mu.
-710: Item %d telah dihapus dari cart-mu.
-711: Item %d telah dihapus dari storage-mu.
+709: Item %hu telah dihapus dari inventory-mu.
+710: Item %hu telah dihapus dari cart-mu.
+711: Item %hu telah dihapus dari storage-mu.
 
 //Item shop
 712: %s (%d) yang kamu miliki tidak cukup.
@@ -1112,9 +1112,9 @@
 1189: Item tidak ditemukan.
 1190: Kamu sudah mengambil secara otomatis item ini.
 1191: Daftar autolooitem penuh. Hilangkan sebagian terlebih dahulu dengan @autolootid -<nama/ID item>.
-1192: Mengambil item secara otomatis: '%s'/'%s' {%d}
+1192: Mengambil item secara otomatis: '%s'/'%s' {%hu}
 1193: Kamu saat ini sedang tidak mengambil item ini secara otomatis.
-1194: Item dihilangkan: '%s'/'%s' {%d} dari daftar pengambilan otomatismu.
+1194: Item dihilangkan: '%s'/'%s' {%hu} dari daftar pengambilan otomatismu.
 1195: Kamu hanya memiliki item %d di daftarmu.
 1196: Untuk menambahkan item ke daftar, gunakan "@alootid +<ID atau nama item>". Untuk menghilangkannya, gunakan "@alootid -<ID atau nama item>".
 1197: "@alootid reset" akan membersihkan daftar autolootitem.
@@ -1263,7 +1263,7 @@
 
 // @iteminfo
 1276: Harap masukkan nama/ID item. (Penggunaan: @ii/@iteminfo <nama/ID item>).
-1277: Item: '%s'/'%s'[%d] (%d) Jenis: %s | Efek tambahan: %s
+1277: Item: '%s'/'%s'[%d] (%hu) Jenis: %s | Efek tambahan: %s
 1278: Tidak ada
 1279: Dengan script.
 1280: NPC Harga Beli:%dz, Harga jual:%dz | Berat: %.1f 

+ 5 - 5
conf/msg_conf/map_msg_por.conf

@@ -188,7 +188,7 @@
 166: Nenhum item foi refinado.
 167: 1 item foi refinado.
 168: %d itens foram refinados.
-169: O item (%d: '%s') não é equipável.
+169: O item (%hu: '%s') não é equipável.
 170: O item não é equipável.
 171: %d - vazio
 //172: Você substituiu o ponto de memorização %d - %s (%d,%d).
@@ -499,7 +499,7 @@
 537: Personagem '%s' (account: %d) está tentando utilizar um bot (tentativa de detecção de monstro falso).
 // Mensagens de tentativa de Spoof em Negociações
 538: Hack em negociação: personagem '%s' (account: %d) tentou negociar mais itens que possuía.
-539: Este jogador possui %d unidades de um item (id: %d), e tentou negociar %d destes.
+539: Este jogador possui %d unidades de um item (id: %hu), e tentou negociar %d destes.
 540: Este jogador foi bloqueado indefinidamente.
 // Anúncio de drop de Itens Raros/Furtar
 541: '%s' conseguiu %s's %s (chance: %0.02f%%)
@@ -1028,9 +1028,9 @@
 1189: Item não encontrado.
 1190: Você já está autorrecolhendo este item.
 1191: Sua lista de autorrecolhimento está cheia. Remova alguns itens com @autolootid -<nome ou ID do item>.
-1192: Autorrecolhendo item: '%s'/'%s' {%d}
+1192: Autorrecolhendo item: '%s'/'%s' {%hu}
 1193: Você atualmente não está autorrecolhendo este item.
-1194: Removido item: '%s'/'%s' {%d} da sua lista de autorrecolhimento.
+1194: Removido item: '%s'/'%s' {%hu} da sua lista de autorrecolhimento.
 1195: Você pode possuir %d itens na sua lista de autorrecolhimento.
 1196: Para adicionar um item a lista, use "@alootid +<nome ou ID do item>". Para remover um item, use "@alootid -<nome ou ID do item>".
 1197: "@alootid reset" irá limpar a sua lista de autorrecolhimento.
@@ -1179,7 +1179,7 @@
 
 // @iteminfo
 1276: Digite o nome/ID de um item (uso: @ii/@iteminfo <nome do item/ID>).
-1277: Item: '%s'/'%s'[%d] (%d) Tipo: %s | Efeito Extra: %s
+1277: Item: '%s'/'%s'[%d] (%hu) Tipo: %s | Efeito Extra: %s
 1278: Nenhum
 1279: Com script
 1280: NPC Compra:%dz, Venda:%dz | Peso: %.1f 

+ 5 - 5
conf/msg_conf/map_msg_rus.conf

@@ -181,7 +181,7 @@
 166: Ни один предмет не был заточен.
 167: 1 предмет заточен.
 168: %d предметов заточено.
-169: Предмет (%d: '%s') невозможно надеть.
+169: Предмет (%hu: '%s') невозможно надеть.
 170: Предмет невозможно надеть.
 171: %d - пусто
 //172: НЕ ИСПОЛЬЗУЕТСЯ
@@ -513,7 +513,7 @@
 537: Персонаж '%s' (account: %d) пытается использовать бота (попытка определения поддельного монстра).
 // Сообщения о хаках при торгах
 538: Хак при торге: персонаж '%s' (account: %d) попытался выменять больше предметов чем у него есть.
-539: У игрока есть %d штук (id: %d), и пытался выменять %d из них.
+539: У игрока есть %d штук (id: %hu), и пытался выменять %d из них.
 540: Этот игрок был навсегда заблокирован.
 // Объявления о выбивании/краже редких предметов
 541: '%s' выбил %s's %s (шанс: %0.02f%%)
@@ -1046,9 +1046,9 @@
 1189: Предмет не найден.
 1190: Этот предмет вы уже собираете автоматически.
 1191: Список автоматической сборки полон. Удалите некоторые предметы через команду @autolootid -<ID/название предмета>.
-1192: Автоматическое поднятие предмета: '%s'/'%s' {%d}
+1192: Автоматическое поднятие предмета: '%s'/'%s' {%hu}
 1193: Этот предмет вы не собираете автоматически.
-1194: Предмет: '%s'/'%s' {%d} удалён из списка автоматической сборки предметов.
+1194: Предмет: '%s'/'%s' {%hu} удалён из списка автоматической сборки предметов.
 1195: Вы можете иметь %d предметов в списке автоматической сборки предметов.
 1196: Чтобы добавить предмет в список используйте "@alootid +<ID/название предмета>". Чтобы удалить предмет из списка: "@alootid -<ID/название предмета>".
 1197: Команда "@alootid reset" очистит список.
@@ -1197,7 +1197,7 @@
 
 // @iteminfo
 1276: Введите ID/название предмета (Использование: @ii/@iteminfo <ID/название предмета>).
-1277: Предмет: '%s'/'%s'[%d] (%d) Тип: %s | Доп. эффект: %s
+1277: Предмет: '%s'/'%s'[%d] (%hu) Тип: %s | Доп. эффект: %s
 1278: Пусто
 1279: Скрипт
 1280: НИП покупка:%d зени, продажа:%d зени | Вес: %.1f 

+ 5 - 5
conf/msg_conf/map_msg_spn.conf

@@ -183,7 +183,7 @@
 166: No se ha refinado ningún objeto.
 167: Se ha refinado 1 objeto.
 168: Se han refinado %d objetos.
-169: El objeto (%d: '%s') no puede ser equipado.
+169: El objeto (%hu: '%s') no puede ser equipado.
 170: No puedes equiparte ese objeto.
 171: %d - vacío
 //172: Has reemplazado tu lugar memorizado %d - %s (%d,%d).
@@ -500,7 +500,7 @@
 537: El personaje '%s' (cuenta: %d) está intentando utilizar un bot (intentando detectar a un monstruo falso).
 // Mensajes del sistema de intercambio de objetos
 538: Se ha detectado una irregularidad en el intercambio de objetos del personaje '%s' (cuenta: %d), está intentando intercambiar más de lo que tiene.
-539: Ese jugador tiene %d unidades del objeto (id: %d), pero ha intentado intercambiar %d.
+539: Ese jugador tiene %d unidades del objeto (id: %hu), pero ha intentado intercambiar %d.
 540: Ese jugador ha sido bloqueado.
 // Anuncios de consecución de objetos poco comunes y robos de objetos.
 541: '%s' ha conseguido de %s un %s (probabilidad: %0.02f%%)
@@ -1033,9 +1033,9 @@
 1189: Ese objeto no existe.
 1190: Ese objeto ya estaba programado para ser recogido automáticamente.
 1191: Tu lista de recogida de objetos de forma automática está llena. Elimina alguno de esos objetos con @autolootid <nombre/ID del objeto>.
-1192: Recogiendo: '%s'/'%s' {%d}
+1192: Recogiendo: '%s'/'%s' {%hu}
 1193: No estás recogiendo ese objeto.
-1194: Has eliminado '%s'/'%s' {%d} de tu lista de recogida de objetos.
+1194: Has eliminado '%s'/'%s' {%hu} de tu lista de recogida de objetos.
 1195: Puedes almacenar %d objetos en tu lista de recogida de objetos.
 1196: Para añadir un nuevo objeto a la lista utiliza @alootid <nombre/ID del objeto>. Para eliminar un objeto utiliza @alootid <nombre/ID del objeto>.
 1197: @alootid reset reiniciará tu lista de recogida de objetos.
@@ -1184,7 +1184,7 @@
 
 // @iteminfo
 1276: Introduce el nombre/ID de un objeto (Instrucciones: @ii/@iteminfo <nombre/ID del objeto>).
-1277: Objeto: '%s'/'%s'[%d] (%d) Tipo: %s | Efecto: %s
+1277: Objeto: '%s'/'%s'[%d] (%hu) Tipo: %s | Efecto: %s
 1278: Ninguno
 1279: Contiene código
 1280: Compra en NPC:%dz, Venta:%dz | Peso: %.1f

+ 5 - 5
conf/msg_conf/map_msg_tha.conf

@@ -183,7 +183,7 @@
 166: äÁèÁÕ Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 167: ÁÕ 1 Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
 168: ÁÕ %d Item ·Õèä´éÃѺ¡ÒÃÍѾà¡Ãµ.
-169: Item (%d: '%s') ¹ÕéäÁèãªèÍØ»¡Ã³ìÊÇÁãÊè.
+169: Item (%hu: '%s') ¹ÕéäÁèãªèÍØ»¡Ã³ìÊÇÁãÊè.
 170: äÁ辺 Item ªÔé¹¹Õéã¹°Ò¹¢éÍÁÙÅ.
 171: %d - ÇèÒ§
 //172: You replace previous memo position %d - %s (%d,%d).
@@ -507,7 +507,7 @@
 537: µÑÇÅФà '%s' (account: %d) ¾ÂÒÂÒÁ·Õè¨Ðãªé bot (Áѹ¾ÂÒÂÒÁ·Õè¨ÐµÃǨ¾º monster »ÅÍÁ).
 // Trade Spoof Messages
 538: Hack on trade: µÑÇÅФà '%s' (account: %d) ¾ÂÒÂÒÁ·Õè¨ÐáÅ¡à»ÅÕè¹ item ¨Ó¹Ç¹ÁÒ¡¡ÇèÒ·ÕèÁÕÍÂÙè.
-539: ¼ÙéàÅè¹ÁÕ item ¨Ó¹Ç¹ %d (id: %d), áÅоÂÒÂÒÁ¨ÐáÅ¡à»ÅÕè¹㹨ӹǹ %d.
+539: ¼ÙéàÅè¹ÁÕ item ¨Ó¹Ç¹ %d (id: %hu), áÅоÂÒÂÒÁ¨ÐáÅ¡à»ÅÕè¹㹨ӹǹ %d.
 540: ¼ÙéàÅè¹¹Õé¶Ù¡ËéÒÁáÅ¡à»ÅÕè¹.
 // Rare Items Drop/Steal announce
 541: '%s' à¡çº %s's %s (âÍ¡ÒÊ: %0.02f%%)
@@ -1040,9 +1040,9 @@
 1189: äÁ辺 Item ´Ñ§¡ÅèÒÇ.
 1190: ¤Ø³ä´éºÑ¹·Ö¡ item ¹Õéŧã¹ÃÒ¡ÒÃä»àÃÕºÃéÍÂáÅéÇ.
 1191: ÃÒ¡Òà autolootitem ¢Í§¤Ø³àµçÁáÅéÇ. ź item ºÒ§ÃÒ¡ÒÃÍÍ¡¡è͹´éÇ @autolootid -<ª×èÍ/ID item>.
-1192: ºÑ¹·Ö¡ item : '%s'/'%s' {%d} ŧÃÒ¡Òà autolootitem ¢Í§¤Ø³.
+1192: ºÑ¹·Ö¡ item : '%s'/'%s' {%hu} ŧÃÒ¡Òà autolootitem ¢Í§¤Ø³.
 1193: ¤Ø³äÁèä´éºÑ¹·Ö¡ item ¹Õéŧã¹ÃÒ¡ÒÃÍÂÙèáÅéÇ.
-1194: ź item : '%s'/'%s' {%d} ¨Ò¡ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
+1194: ź item : '%s'/'%s' {%hu} ¨Ò¡ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
 1195: ¤Ø³ÊÒÁÒöºÑ¹·Ö¡ä´é %d item 㹡ÒÃÃÒ¡Òà autolootitem.
 1196: 㹡ÒÃà¾ÔèÁÃÒ¡ÒÃ, ãªé "@alootid +<ª×èÍ/ID item>". 㹡ÒÃźÃÒ¡ÒÃ, ãªé "@alootid -<ª×èÍ/ID item>".
 1197: "@alootid reset" 㹡ÒÃÅéÒ§ÃÒ¡Òà autolootitem ¢Í§¤Ø³.
@@ -1191,7 +1191,7 @@
 
 // @iteminfo
 1276: â»Ã´Ãкت×èÍ/ID item (ÇÔ¸Õãªé: @ii/@iteminfo <ª×èÍ/ID item>).
-1277: Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
+1277: Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
 1278: None
 1279: With script
 1280: NPC Buy:%dz, Sell:%dz | Weight: %.1f

+ 6 - 6
sql-files/logs.sql

@@ -11,13 +11,13 @@ CREATE TABLE IF NOT EXISTS `picklog` (
   `time` datetime NOT NULL default '0000-00-00 00:00:00',
   `char_id` int(11) NOT NULL default '0',
   `type` enum('M','P','L','T','V','S','N','C','A','R','G','E','B','O','I','X','D','U','$') NOT NULL default 'P',
-  `nameid` int(11) NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `amount` int(11) NOT NULL default '1',
   `refine` tinyint(3) unsigned NOT NULL default '0',
-  `card0` int(11) NOT NULL default '0',
-  `card1` int(11) NOT NULL default '0',
-  `card2` int(11) NOT NULL default '0',
-  `card3` int(11) NOT NULL default '0',
+  `card0` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
   `map` varchar(11) NOT NULL default '',
   PRIMARY KEY  (`id`),
@@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS `mvplog` (
   `mvp_date` datetime NOT NULL default '0000-00-00 00:00:00',
   `kill_char_id` int(11) NOT NULL default '0',
   `monster_id` smallint(6) NOT NULL default '0',
-  `prize` int(11) NOT NULL default '0',
+  `prize` smallint(5) unsigned NOT NULL default '0',
   `mvpexp` mediumint(9) NOT NULL default '0',
   `map` varchar(11) NOT NULL default '',
   PRIMARY KEY  (`mvp_id`)

+ 31 - 31
sql-files/main.sql

@@ -26,15 +26,15 @@ CREATE TABLE IF NOT EXISTS `auction` (
   `buynow` int(11) unsigned NOT NULL default '0',
   `hours` smallint(6) NOT NULL default '0',
   `timestamp` int(11) unsigned NOT NULL default '0',
-  `nameid` int(11) unsigned NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `item_name` varchar(50) NOT NULL default '',
   `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` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
   PRIMARY KEY  (`auction_id`)
 ) ENGINE=MyISAM;
@@ -46,16 +46,16 @@ CREATE TABLE IF NOT EXISTS `auction` (
 CREATE TABLE IF NOT EXISTS `cart_inventory` (
   `id` int(11) NOT NULL auto_increment,
   `char_id` int(11) NOT NULL default '0',
-  `nameid` int(11) NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `amount` int(11) NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `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` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `bound` tinyint(3) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
@@ -346,16 +346,16 @@ CREATE TABLE IF NOT EXISTS `guild_skill` (
 CREATE TABLE IF NOT EXISTS `guild_storage` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `guild_id` int(11) unsigned NOT NULL default '0',
-  `nameid` int(11) unsigned NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `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` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `bound` tinyint(3) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
@@ -410,16 +410,16 @@ CREATE TABLE IF NOT EXISTS `interlog` (
 CREATE TABLE IF NOT EXISTS `inventory` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `char_id` int(11) unsigned NOT NULL default '0',
-  `nameid` int(11) unsigned NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `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` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `favorite` tinyint(3) unsigned NOT NULL default '0',
   `bound` tinyint(3) unsigned NOT NULL default '0',
@@ -517,15 +517,15 @@ CREATE TABLE IF NOT EXISTS `mail` (
   `time` int(11) unsigned NOT NULL default '0',
   `status` tinyint(2) NOT NULL default '0',
   `zeny` int(11) unsigned NOT NULL default '0',
-  `nameid` int(11) unsigned NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `amount` int(11) unsigned NOT NULL default '0',
   `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` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM;
@@ -600,7 +600,7 @@ CREATE TABLE IF NOT EXISTS `pet` (
   `account_id` int(11) unsigned NOT NULL default '0',
   `char_id` int(11) unsigned NOT NULL default '0',
   `level` smallint(4) unsigned NOT NULL default '0',
-  `egg_id` smallint(11) unsigned NOT NULL default '0',
+  `egg_id` smallint(5) unsigned NOT NULL default '0',
   `equip` mediumint(8) unsigned NOT NULL default '0',
   `intimate` smallint(9) unsigned NOT NULL default '0',
   `hungry` smallint(9) unsigned NOT NULL default '0',
@@ -676,16 +676,16 @@ CREATE TABLE IF NOT EXISTS `sstatus` (
 CREATE TABLE IF NOT EXISTS `storage` (
   `id` int(11) unsigned NOT NULL auto_increment,
   `account_id` int(11) unsigned NOT NULL default '0',
-  `nameid` int(11) unsigned NOT NULL default '0',
+  `nameid` smallint(5) unsigned NOT NULL default '0',
   `amount` smallint(11) unsigned NOT NULL default '0',
   `equip` int(11) unsigned NOT NULL default '0',
   `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` smallint(5) unsigned NOT NULL default '0',
+  `card1` smallint(5) unsigned NOT NULL default '0',
+  `card2` smallint(5) unsigned NOT NULL default '0',
+  `card3` smallint(5) unsigned NOT NULL default '0',
   `expire_time` int(11) unsigned NOT NULL default '0',
   `bound` tinyint(3) unsigned NOT NULL default '0',
   `unique_id` bigint(20) unsigned NOT NULL default '0',

+ 13 - 13
sql-files/mob_db.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(9) unsigned NOT NULL default '0',
+  `MVP1id` smallint(5) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(9) unsigned NOT NULL default '0',
+  `MVP2id` smallint(5) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(9) unsigned NOT NULL default '0',
+  `MVP3id` smallint(5) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(9) unsigned NOT NULL default '0',
+  `Drop1id` smallint(5) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(9) unsigned NOT NULL default '0',
+  `Drop2id` smallint(5) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(9) unsigned NOT NULL default '0',
+  `Drop3id` smallint(5) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(9) unsigned NOT NULL default '0',
+  `Drop4id` smallint(5) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(9) unsigned NOT NULL default '0',
+  `Drop5id` smallint(5) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(9) unsigned NOT NULL default '0',
+  `Drop6id` smallint(5) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(9) unsigned NOT NULL default '0',
+  `Drop7id` smallint(5) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(9) unsigned NOT NULL default '0',
+  `Drop8id` smallint(5) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(9) unsigned NOT NULL default '0',
+  `Drop9id` smallint(5) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(9) unsigned NOT NULL default '0',
+  `DropCardid` smallint(5) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`)
 ) ENGINE=MyISAM;

+ 13 - 13
sql-files/mob_db2.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db2` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(9) unsigned NOT NULL default '0',
+  `MVP1id` smallint(5) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(9) unsigned NOT NULL default '0',
+  `MVP2id` smallint(5) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(9) unsigned NOT NULL default '0',
+  `MVP3id` smallint(5) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(9) unsigned NOT NULL default '0',
+  `Drop1id` smallint(5) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(9) unsigned NOT NULL default '0',
+  `Drop2id` smallint(5) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(9) unsigned NOT NULL default '0',
+  `Drop3id` smallint(5) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(9) unsigned NOT NULL default '0',
+  `Drop4id` smallint(5) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(9) unsigned NOT NULL default '0',
+  `Drop5id` smallint(5) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(9) unsigned NOT NULL default '0',
+  `Drop6id` smallint(5) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(9) unsigned NOT NULL default '0',
+  `Drop7id` smallint(5) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(9) unsigned NOT NULL default '0',
+  `Drop8id` smallint(5) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(9) unsigned NOT NULL default '0',
+  `Drop9id` smallint(5) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(9) unsigned NOT NULL default '0',
+  `DropCardid` smallint(5) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`)
 ) ENGINE=MyISAM;

+ 13 - 13
sql-files/mob_db2_re.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db2_re` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(9) unsigned NOT NULL default '0',
+  `MVP1id` smallint(5) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(9) unsigned NOT NULL default '0',
+  `MVP2id` smallint(5) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(9) unsigned NOT NULL default '0',
+  `MVP3id` smallint(5) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(9) unsigned NOT NULL default '0',
+  `Drop1id` smallint(5) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(9) unsigned NOT NULL default '0',
+  `Drop2id` smallint(5) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(9) unsigned NOT NULL default '0',
+  `Drop3id` smallint(5) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(9) unsigned NOT NULL default '0',
+  `Drop4id` smallint(5) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(9) unsigned NOT NULL default '0',
+  `Drop5id` smallint(5) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(9) unsigned NOT NULL default '0',
+  `Drop6id` smallint(5) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(9) unsigned NOT NULL default '0',
+  `Drop7id` smallint(5) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(9) unsigned NOT NULL default '0',
+  `Drop8id` smallint(5) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(9) unsigned NOT NULL default '0',
+  `Drop9id` smallint(5) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(9) unsigned NOT NULL default '0',
+  `DropCardid` smallint(5) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`)
 ) ENGINE=MyISAM;

+ 13 - 13
sql-files/mob_db_re.sql

@@ -35,31 +35,31 @@ CREATE TABLE `mob_db_re` (
   `aMotion` smallint(6) unsigned NOT NULL default '0',
   `dMotion` smallint(6) unsigned NOT NULL default '0',
   `MEXP` mediumint(9) unsigned NOT NULL default '0',
-  `MVP1id` smallint(9) unsigned NOT NULL default '0',
+  `MVP1id` smallint(5) unsigned NOT NULL default '0',
   `MVP1per` smallint(9) unsigned NOT NULL default '0',
-  `MVP2id` smallint(9) unsigned NOT NULL default '0',
+  `MVP2id` smallint(5) unsigned NOT NULL default '0',
   `MVP2per` smallint(9) unsigned NOT NULL default '0',
-  `MVP3id` smallint(9) unsigned NOT NULL default '0',
+  `MVP3id` smallint(5) unsigned NOT NULL default '0',
   `MVP3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop1id` smallint(9) unsigned NOT NULL default '0',
+  `Drop1id` smallint(5) unsigned NOT NULL default '0',
   `Drop1per` smallint(9) unsigned NOT NULL default '0',
-  `Drop2id` smallint(9) unsigned NOT NULL default '0',
+  `Drop2id` smallint(5) unsigned NOT NULL default '0',
   `Drop2per` smallint(9) unsigned NOT NULL default '0',
-  `Drop3id` smallint(9) unsigned NOT NULL default '0',
+  `Drop3id` smallint(5) unsigned NOT NULL default '0',
   `Drop3per` smallint(9) unsigned NOT NULL default '0',
-  `Drop4id` smallint(9) unsigned NOT NULL default '0',
+  `Drop4id` smallint(5) unsigned NOT NULL default '0',
   `Drop4per` smallint(9) unsigned NOT NULL default '0',
-  `Drop5id` smallint(9) unsigned NOT NULL default '0',
+  `Drop5id` smallint(5) unsigned NOT NULL default '0',
   `Drop5per` smallint(9) unsigned NOT NULL default '0',
-  `Drop6id` smallint(9) unsigned NOT NULL default '0',
+  `Drop6id` smallint(5) unsigned NOT NULL default '0',
   `Drop6per` smallint(9) unsigned NOT NULL default '0',
-  `Drop7id` smallint(9) unsigned NOT NULL default '0',
+  `Drop7id` smallint(5) unsigned NOT NULL default '0',
   `Drop7per` smallint(9) unsigned NOT NULL default '0',
-  `Drop8id` smallint(9) unsigned NOT NULL default '0',
+  `Drop8id` smallint(5) unsigned NOT NULL default '0',
   `Drop8per` smallint(9) unsigned NOT NULL default '0',
-  `Drop9id` smallint(9) unsigned NOT NULL default '0',
+  `Drop9id` smallint(5) unsigned NOT NULL default '0',
   `Drop9per` smallint(9) unsigned NOT NULL default '0',
-  `DropCardid` smallint(9) unsigned NOT NULL default '0',
+  `DropCardid` smallint(5) unsigned NOT NULL default '0',
   `DropCardper` smallint(9) unsigned NOT NULL default '0',
   PRIMARY KEY  (`ID`)
 ) ENGINE=MyISAM;

+ 0 - 0
sql-files/upgrades/upgrade_20131229.sql


+ 94 - 0
sql-files/upgrades/upgrade_20140612.sql

@@ -0,0 +1,94 @@
+ALTER TABLE `auction` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `auction` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `auction` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `auction` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `auction` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `cart_inventory` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `cart_inventory` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `cart_inventory` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `cart_inventory` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `cart_inventory` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `guild_storage` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `guild_storage` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `guild_storage` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `guild_storage` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `guild_storage` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `inventory` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `inventory` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `inventory` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `inventory` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `inventory` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mail` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mail` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mail` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mail` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mail` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `pet` MODIFY `egg_id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `storage` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `storage` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `storage` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `storage` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `storage` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db2` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db2_re` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db2_re` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';
+
+ALTER TABLE `mob_db_re` MODIFY `MVP1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `MVP2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `MVP3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop1id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop2id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop3id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop4id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop5id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop6id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop7id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop8id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `Drop9id` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mob_db_re` MODIFY `DropCardid` smallint(5) unsigned NOT NULL default '0';
+
+UPDATE `auction` SET `card0` = 256 WHERE `card0` = -256;
+UPDATE `cart_inventory` SET `card0` = 256 WHERE `card0` = -256;
+UPDATE `guild_storage` SET `card0` = 256 WHERE `card0` = -256;
+UPDATE `inventory` SET `card0` = 256 WHERE `card0` = -256;
+UPDATE `mail` SET `card0` = 256 WHERE `card0` = -256;
+UPDATE `storage` SET `card0` = 256 WHERE `card0` = -256;

+ 8 - 0
sql-files/upgrades/upgrade_20140612_log.sql

@@ -0,0 +1,8 @@
+ALTER TABLE `picklog` MODIFY `nameid` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `picklog` MODIFY `card0` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `picklog` MODIFY `card1` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `picklog` MODIFY `card2` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `picklog` MODIFY `card3` smallint(5) unsigned NOT NULL default '0';
+ALTER TABLE `mvplog` MODIFY `prize` smallint(5) unsigned NOT NULL default '0';
+
+UPDATE `picklog` SET `card0` = 256 WHERE `card0` = -256;

+ 10 - 10
src/char/char.c

@@ -604,7 +604,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
 	}
 
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT,     &item.nameid,      0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,    &item.nameid,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
@@ -694,7 +694,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, int tabl
 		else
 			found = true;
 
-		StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%"PRIu64"'",
+		StringBuf_Printf(&buf, "('%d', '%hu', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%"PRIu64"'",
 			id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].bound, items[i].unique_id);
 		for( j = 0; j < MAX_SLOTS; ++j )
 			StringBuf_Printf(&buf, ", '%d'", items[i].card[j]);
@@ -750,7 +750,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
 	}
 
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT,     &item.nameid,      0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,    &item.nameid,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
@@ -835,7 +835,7 @@ int char_inventory_to_sql(const struct item items[], int max, int id) {
 		else
 			found = true;
 
-		StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%d', '%"PRIu64"'",
+		StringBuf_Printf(&buf, "('%d', '%hu', '%d', '%d', '%d', '%d', '%d', '%u', '%d', '%d', '%"PRIu64"'",
 						 id, items[i].nameid, items[i].amount, items[i].equip, items[i].identify, items[i].refine, items[i].attribute, items[i].expire_time, items[i].favorite, items[i].bound, items[i].unique_id);
 		for( j = 0; j < MAX_SLOTS; ++j )
 			StringBuf_Printf(&buf, ", '%d'", items[i].card[j]);
@@ -1112,7 +1112,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
 	||	SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
 	||	SQL_ERROR == SqlStmt_Execute(stmt)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &tmp_item.id, 0, NULL, NULL)
-	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT,     &tmp_item.nameid, 0, NULL, NULL)
+	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,    &tmp_item.nameid, 0, NULL, NULL)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &tmp_item.amount, 0, NULL, NULL)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,      &tmp_item.equip, 0, NULL, NULL)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &tmp_item.identify, 0, NULL, NULL)
@@ -1144,7 +1144,7 @@ int char_mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_every
 	||	SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_INT, &char_id, 0)
 	||	SQL_ERROR == SqlStmt_Execute(stmt)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 0, SQLDT_INT,         &tmp_item.id, 0, NULL, NULL)
-	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT,       &tmp_item.nameid, 0, NULL, NULL)
+	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,      &tmp_item.nameid, 0, NULL, NULL)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,       &tmp_item.amount, 0, NULL, NULL)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 3, SQLDT_UINT,        &tmp_item.equip, 0, NULL, NULL)
 	||	SQL_ERROR == SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,        &tmp_item.identify, 0, NULL, NULL)
@@ -1443,7 +1443,7 @@ int char_make_new_char_sql(struct char_session_data* sd, char* name_, int str, i
 	char_id = (int)Sql_LastInsertId(sql_handle);
 	//Give the char the default items
 	for (k = 0; k <= MAX_STARTITEM && start_items[k].nameid != 0; k ++) {
-		if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `equip`, `identify`) VALUES ('%d', '%d', '%d', '%d', '%d')", schema_config.inventory_db, char_id, start_items[k].nameid, start_items[k].amount, start_items[k].pos, 1) )
+		if( SQL_ERROR == Sql_Query(sql_handle, "INSERT INTO `%s` (`char_id`,`nameid`, `amount`, `equip`, `identify`) VALUES ('%d', '%hu', '%d', '%d', '%d')", schema_config.inventory_db, char_id, start_items[k].nameid, start_items[k].amount, start_items[k].pos, 1) )
 			Sql_ShowDebug(sql_handle);
 	}
 
@@ -1457,7 +1457,7 @@ int char_make_new_char_sql(struct char_session_data* sd, char* name_, int str, i
 int char_divorce_char_sql(int partner_id1, int partner_id2){
 	if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `partner_id`='0' WHERE `char_id`='%d' OR `char_id`='%d' LIMIT 2", schema_config.char_db, partner_id1, partner_id2) )
 		Sql_ShowDebug(sql_handle);
-	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%d' OR `nameid`='%d') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", schema_config.inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
+	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` WHERE (`nameid`='%hu' OR `nameid`='%hu') AND (`char_id`='%d' OR `char_id`='%d') LIMIT 2", schema_config.inventory_db, WEDDING_RING_M, WEDDING_RING_F, partner_id1, partner_id2) )
 		Sql_ShowDebug(sql_handle);
 	chmapif_send_ackdivorce(partner_id1, partner_id2);
 	return 0;
@@ -1540,9 +1540,9 @@ int char_delete_char_sql(int char_id){
 		Sql_ShowDebug(sql_handle);
 
 	//Delete all pets that are stored in eggs (inventory + cart)
-	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", schema_config.pet_db, schema_config.pet_db, schema_config.inventory_db, schema_config.inventory_db, char_id) )
+	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = 256", schema_config.pet_db, schema_config.pet_db, schema_config.inventory_db, schema_config.inventory_db, char_id) )
 		Sql_ShowDebug(sql_handle);
-	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = -256", schema_config.pet_db, schema_config.pet_db, schema_config.cart_db, schema_config.cart_db, char_id) )
+	if( SQL_ERROR == Sql_Query(sql_handle, "DELETE FROM `%s` USING `%s` JOIN `%s` ON `pet_id` = `card1`|`card2`<<16 WHERE `%s`.char_id = '%d' AND card0 = 256", schema_config.pet_db, schema_config.pet_db, schema_config.cart_db, schema_config.cart_db, char_id) )
 		Sql_ShowDebug(sql_handle);
 
 	/* remove homunculus */

+ 2 - 2
src/char/int_auction.c

@@ -50,7 +50,7 @@ void auction_save(struct auction_data *auction)
 		return;
 
 	StringBuf_Init(&buf);
-	StringBuf_Printf(&buf, "UPDATE `%s` SET `seller_id` = '%d', `seller_name` = ?, `buyer_id` = '%d', `buyer_name` = ?, `price` = '%d', `buynow` = '%d', `hours` = '%d', `timestamp` = '%lu', `nameid` = '%d', `item_name` = ?, `type` = '%d', `refine` = '%d', `attribute` = '%d'",
+	StringBuf_Printf(&buf, "UPDATE `%s` SET `seller_id` = '%d', `seller_name` = ?, `buyer_id` = '%d', `buyer_name` = ?, `price` = '%d', `buynow` = '%d', `hours` = '%d', `timestamp` = '%lu', `nameid` = '%hu', `item_name` = ?, `type` = '%d', `refine` = '%d', `attribute` = '%d'",
 		schema_config.auction_db, auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute);
 	for( j = 0; j < MAX_SLOTS; j++ )
 		StringBuf_Printf(&buf, ", `card%d` = '%d'", j, auction->item.card[j]);
@@ -85,7 +85,7 @@ unsigned int auction_create(struct auction_data *auction)
 	StringBuf_Printf(&buf, "INSERT INTO `%s` (`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`unique_id`", schema_config.auction_db);
 	for( j = 0; j < MAX_SLOTS; j++ )
 		StringBuf_Printf(&buf, ",`card%d`", j);
-	StringBuf_Printf(&buf, ") VALUES ('%d',?,'%d',?,'%d','%d','%d','%lu','%d',?,'%d','%d','%d','%"PRIu64"'",
+	StringBuf_Printf(&buf, ") VALUES ('%d',?,'%d',?,'%d','%d','%d','%lu','%hu',?,'%d','%d','%d','%"PRIu64"'",
 		auction->seller_id, auction->buyer_id, auction->price, auction->buynow, auction->hours, (unsigned long)auction->timestamp, auction->item.nameid, auction->type, auction->item.refine, auction->item.attribute, auction->item.unique_id);
 	for( j = 0; j < MAX_SLOTS; j++ )
 		StringBuf_Printf(&buf, ",'%d'", auction->item.card[j]);

+ 1 - 1
src/char/int_mail.c

@@ -112,7 +112,7 @@ int mail_savemessage(struct mail_message* msg)
 	StringBuf_Printf(&buf, "INSERT INTO `%s` (`send_name`, `send_id`, `dest_name`, `dest_id`, `title`, `message`, `time`, `status`, `zeny`, `amount`, `nameid`, `refine`, `attribute`, `identify`, `unique_id`", schema_config.mail_db);
 	for (j = 0; j < MAX_SLOTS; j++)
 		StringBuf_Printf(&buf, ", `card%d`", j);
-	StringBuf_Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%"PRIu64"'",
+	StringBuf_Printf(&buf, ") VALUES (?, '%d', ?, '%d', ?, ?, '%lu', '%d', '%d', '%d', '%hu', '%d', '%d', '%d', '%"PRIu64"'",
 		msg->send_id, msg->dest_id, (unsigned long)msg->timestamp, msg->status, msg->zeny, msg->item.amount, msg->item.nameid, msg->item.refine, msg->item.attribute, msg->item.identify, msg->item.unique_id);
 	for (j = 0; j < MAX_SLOTS; j++)
 		StringBuf_Printf(&buf, ", '%d'", msg->item.card[j]);

+ 2 - 2
src/char/int_storage.c

@@ -277,7 +277,7 @@ int mapif_parse_itembound_retrieve(int fd)
 	}
 
 	SqlStmt_BindColumn(stmt, 0, SQLDT_INT,       &item.id,          0, NULL, NULL);
-	SqlStmt_BindColumn(stmt, 1, SQLDT_SHORT,     &item.nameid,      0, NULL, NULL);
+	SqlStmt_BindColumn(stmt, 1, SQLDT_USHORT,    &item.nameid,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 2, SQLDT_SHORT,     &item.amount,      0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 3, SQLDT_USHORT,    &item.equip,       0, NULL, NULL);
 	SqlStmt_BindColumn(stmt, 4, SQLDT_CHAR,      &item.identify,    0, NULL, NULL);
@@ -398,7 +398,7 @@ int mapif_parse_itembound_retrieve(int fd)
 		else
 			found = true;
 
-		StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
+		StringBuf_Printf(&buf, "('%d', '%hu', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
 			guild_id, items[j].nameid, items[j].amount, items[j].equip, items[j].identify, items[j].refine,
 			items[j].attribute, items[j].expire_time, items[j].bound);
 		for( s = 0; s < MAX_SLOTS; ++s )

+ 2 - 2
src/common/mmo.h

@@ -175,13 +175,13 @@ struct quest {
 
 struct item {
 	int id;
-	short nameid;
+	unsigned short nameid;
 	short amount;
 	unsigned int equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
 	char identify;
 	char refine;
 	char attribute;
-	short card[MAX_SLOTS];
+	unsigned short card[MAX_SLOTS];
 	unsigned int expire_time;
 	char favorite, bound;
 	uint64 unique_id;

+ 13 - 9
src/map/atcommand.c

@@ -1243,7 +1243,7 @@ ACMD_FUNC(item)
 	get_count = number;
 
 	for(j--; j>=0; j--){ //produce items in list
-		int16 item_id = item_data[j]->nameid;
+		unsigned short item_id = item_data[j]->nameid;
 		//Check if it's stackable.
 		if (!itemdb_isstackable2(item_data[j]))
 			get_count = 1;
@@ -1275,7 +1275,8 @@ ACMD_FUNC(item2)
 	struct item item_tmp;
 	struct item_data *item_data;
 	char item_name[100];
-	int item_id, number = 0, bound = BOUND_NONE;
+	unsigned short item_id;
+	int number = 0, bound = BOUND_NONE;
 	int identify = 0, refine = 0, attr = 0;
 	int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
 	nullpo_retr(-1, sd);
@@ -2234,7 +2235,8 @@ ACMD_FUNC(refine)
 ACMD_FUNC(produce)
 {
 	char item_name[100];
-	int item_id, attribute = 0, star = 0;
+	unsigned short item_id;
+	int attribute = 0, star = 0;
 	struct item_data *item_data;
 	struct item tmp_item;
 	nullpo_retr(-1, sd);
@@ -2279,7 +2281,7 @@ ACMD_FUNC(produce)
 		if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
 			clif_additem(sd, 0, 0, flag);
 	} else {
-		sprintf(atcmd_output, msg_txt(sd,169), item_id, item_data->name); // The item (%d: '%s') is not equipable.
+		sprintf(atcmd_output, msg_txt(sd,169), item_id, item_data->name); // The item (%hu: '%s') is not equipable.
 		clif_displaymessage(fd, atcmd_output);
 		return -1;
 	}
@@ -5631,7 +5633,8 @@ ACMD_FUNC(skilltree)
 // Hand a ring with partners name on it to this char
 void getring (struct map_session_data* sd)
 {
-	int flag, item_id;
+	int flag;
+	unsigned short item_id;
 	struct item item_tmp;
 	item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
 
@@ -5987,7 +5990,7 @@ ACMD_FUNC(autolootitem)
 					ShowDebug("Non-existant item %d on autolootitem list (account_id: %d, char_id: %d)", sd->state.autolootid[i], sd->status.account_id, sd->status.char_id);
 					continue;
 				}
-				sprintf(atcmd_output, "'%s'/'%s' {%d}", item_data->name, item_data->jname, item_data->nameid);
+				sprintf(atcmd_output, "'%s'/'%s' {%hu}", item_data->name, item_data->jname, item_data->nameid);
 				clif_displaymessage(fd, atcmd_output);
 			}
 		}
@@ -7478,7 +7481,7 @@ ACMD_FUNC(iteminfo)
 	}
 	for (i = 0; i < count; i++) {
 		struct item_data * item_data = item_array[i];
-		sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
+		sprintf(atcmd_output, msg_txt(sd,1277), // Item: '%s'/'%s'[%d] (%hu) Type: %s | Extra Effect: %s
 			item_data->name,item_data->jname,item_data->slot,item_data->nameid,
 			(item_data->type != IT_AMMO) ? itemdb_typename((enum item_types)item_data->type) : itemdb_typename_ammo((enum e_item_ammo)item_data->look),
 			(item_data->script==NULL)? msg_txt(sd,1278) : msg_txt(sd,1279) // None / With script
@@ -7527,7 +7530,7 @@ ACMD_FUNC(whodrops)
 	}
 	for (i = 0; i < count; i++) {
 		item_data = item_array[i];
-		sprintf(atcmd_output, msg_txt(sd,1285), item_data->jname, item_data->slot, item_data->nameid); // Item: '%s'[%d] (ID:%d)
+		sprintf(atcmd_output, msg_txt(sd,1285), item_data->jname, item_data->slot, item_data->nameid); // Item: '%s'[%d] (ID:%hu)
 		clif_displaymessage(fd, atcmd_output);
 
 		if (item_data->mob[0].chance == 0) {
@@ -8646,7 +8649,8 @@ ACMD_FUNC(stats)
 ACMD_FUNC(delitem)
 {
 	char item_name[100];
-	int nameid, amount = 0, total, idx;
+	unsigned short nameid;
+	int amount = 0, total, idx;
 	struct item_data* id;
 
 	nullpo_retr(-1, sd);

+ 3 - 3
src/map/buyingstore.c

@@ -21,7 +21,7 @@
 struct s_autotrade_entry {
 	uint16 amount;
 	int price;
-	uint16 item_id;
+	unsigned short item_id;
 };
 
 /// Struct of autotrader
@@ -228,7 +228,7 @@ bool buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
 	}
 
 	for( i = 0; i < sd->buyingstore.slots; i++ ){
-		if( Sql_Query( mmysql_handle, "INSERT INTO `%s`(`buyingstore_id`,`index`,`item_id`,`amount`,`price`) VALUES( %d, %d, %d, %d, %d );", buyingstore_items_db, sd->buyer_id, i, sd->buyingstore.items[i].nameid, sd->buyingstore.items[i].amount, sd->buyingstore.items[i].price ) != SQL_SUCCESS ){
+		if( Sql_Query( mmysql_handle, "INSERT INTO `%s`(`buyingstore_id`,`index`,`item_id`,`amount`,`price`) VALUES( %d, %d, %hu, %d, %d );", buyingstore_items_db, sd->buyer_id, i, sd->buyingstore.items[i].nameid, sd->buyingstore.items[i].amount, sd->buyingstore.items[i].price ) != SQL_SUCCESS ){
 			Sql_ShowDebug(mmysql_handle);
 		}
 	}
@@ -564,7 +564,7 @@ void buyingstore_reopen( struct map_session_data* sd ){
 
 		for (j = 0, p = data, count = autotraders[i]->count; j < autotraders[i]->count; j++) {
 			struct s_autotrade_entry *entry = autotraders[i]->entries[j];
-			uint16 *item_id = (uint16*)(p + 0);
+			unsigned short *item_id = (uint16*)(p + 0);
 			uint16 *amount = (uint16*)(p + 2);
 			uint32 *price = (uint32*)(p + 4);
 

+ 5 - 5
src/map/cashshop.c

@@ -27,7 +27,7 @@ extern char item_cash_db2_db[32];
  *  1 = success
  */
 static int cashshop_parse_dbrow( char** str, const char* source, int line ){
-	uint32 nameid = atoi( str[1] );
+	unsigned short nameid = atoi( str[1] );
 
 	if( itemdb_exists( nameid ) ){
 		uint16 tab = atoi( str[0] );
@@ -58,7 +58,7 @@ static int cashshop_parse_dbrow( char** str, const char* source, int line ){
 
 		return 1;
 	}else{
-		ShowWarning( "cashshop_parse_dbrow: Invalid ID %d in line %d of \"%s\", skipping...\n", nameid, line, source );
+		ShowWarning( "cashshop_parse_dbrow: Invalid ID %hu in line %d of \"%s\", skipping...\n", nameid, line, source );
 	}
 
 	return 0;
@@ -216,7 +216,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u
 	new_ = 0;
 
 	for( i = 0; i < n; ++i ){
-		uint32 nameid = *( item_list + i * 5 );
+		unsigned short nameid = *( item_list + i * 5 );
 		uint32 quantity = *( item_list + i * 5 + 2 );
 		uint16 tab = *( item_list + i * 5 + 4 );
 		int j;
@@ -233,7 +233,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u
 			return false;
 		}else if( !itemdb_isstackable( nameid ) && quantity > 1 ){
 			uint32* quantity_ptr = (uint32*)item_list + i * 5 + 2;
-			ShowWarning( "Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable cash item %d!\n", sd->status.name, sd->status.account_id, sd->status.char_id, quantity, nameid );
+			ShowWarning( "Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable cash item %hu!\n", sd->status.name, sd->status.account_id, sd->status.char_id, quantity, nameid );
 			*quantity_ptr = 1;
 		}
 
@@ -268,7 +268,7 @@ bool cashshop_buylist( struct map_session_data* sd, uint32 kafrapoints, int n, u
 	}
 
 	for( i = 0; i < n; ++i ){
-		uint32 nameid = *( item_list + i * 5 );
+		unsigned short nameid = *( item_list + i * 5 );
 		uint32 quantity = *( item_list + i * 5 + 2 );
 
 		if( itemdb_type( nameid ) == IT_PETEGG ){

+ 1 - 1
src/map/cashshop.h

@@ -44,7 +44,7 @@ enum CASHSHOP_BUY_RESULT{
 
 
 struct cash_item_data{
-	uint32 nameid;
+	unsigned short nameid;
 	uint32 price;
 };
 

+ 12 - 12
src/map/clif.c

@@ -70,7 +70,7 @@ int packet_db_ack[MAX_PACKET_VER + 1][MAX_ACK_FUNC + 1];
 * @param nameid: Item ID
 * @return item type. For IT_PETEGG will be displayed as IT_WEAPON. If Shadow Weapon of IT_SHADOWGEAR as IT_WEAPON and else as IT_ARMOR
 */
-static inline int itemtype(int nameid) {
+static inline int itemtype(unsigned short nameid) {
 	struct item_data* id = itemdb_search(nameid); //Use itemdb_search, so non-existance item will use dummy data and won't crash the server. bugreport:8468
 	int type = id->type;
 	if( type == IT_SHADOWGEAR ) {
@@ -5854,7 +5854,7 @@ void clif_refine(int fd, int fail, int index, int val)
 ///     1 = "weapon upgraded: %s" MsgStringTable[912] in rgb(0,205,205)
 ///     2 = "cannot upgrade %s until you level up the upgrade weapon skill" MsgStringTable[913] in rgb(255,200,200)
 ///     3 = "you lack the item %s to upgrade the weapon" MsgStringTable[914] in rgb(255,200,200)
-void clif_upgrademessage(int fd, int result, int item_id)
+void clif_upgrademessage(int fd, int result, unsigned short item_id)
 {
 	WFIFOHEAD(fd,packet_len(0x223));
 	WFIFOW(fd,0)=0x223;
@@ -6058,7 +6058,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *
 {
 	int i,c;
 	int fd;
-	int nameid;
+	unsigned short nameid;
 
 	nullpo_retv(sd);
 	nullpo_retv(dstsd);
@@ -7085,7 +7085,7 @@ void clif_movetoattack(struct map_session_data *sd,struct block_list *bl)
 ///     1 = failure
 ///     2 = success (alchemist)
 ///     3 = failure (alchemist)
-void clif_produceeffect(struct map_session_data* sd,int flag,int nameid)
+void clif_produceeffect(struct map_session_data* sd,int flag, unsigned short nameid)
 {
 	int view,fd;
 
@@ -7430,7 +7430,7 @@ void clif_mvp_effect(struct map_session_data *sd)
 
 /// MVP item reward message (ZC_MVP_GETTING_ITEM).
 /// 010a <name id>.W
-void clif_mvp_item(struct map_session_data *sd,int nameid)
+void clif_mvp_item(struct map_session_data *sd, unsigned short nameid)
 {
 	int view,fd;
 
@@ -11547,7 +11547,7 @@ void clif_parse_RequestMemo(int fd,struct map_session_data *sd)
 /// 018e <name id>.W { <material id>.W }*3
 void clif_parse_ProduceMix(int fd,struct map_session_data *sd){
 	struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
-	int nameid = RFIFOW(fd,info->pos[0]);
+	unsigned short nameid = RFIFOW(fd,info->pos[0]);
 	int slot1  = RFIFOW(fd,info->pos[1]);
 	int slot2  = RFIFOW(fd,info->pos[2]);
 	int slot3  = RFIFOW(fd,info->pos[3]);
@@ -11584,7 +11584,7 @@ void clif_parse_ProduceMix(int fd,struct map_session_data *sd){
 void clif_parse_Cooking(int fd,struct map_session_data *sd) {
 	struct s_packet_db* info = &packet_db[sd->packet_ver][RFIFOW(fd,0)];
 	int type = RFIFOW(fd,info->pos[0]);
-	int nameid = RFIFOW(fd,info->pos[1]);
+	unsigned short nameid = RFIFOW(fd,info->pos[1]);
 	int amount = sd->menuskill_val2?sd->menuskill_val2:1;
 	if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY )
 		return;
@@ -11741,7 +11741,7 @@ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd)
 /// Answer to arrow crafting item selection dialog (CZ_REQ_MAKINGARROW).
 /// 01ae <name id>.W
 void clif_parse_SelectArrow(int fd,struct map_session_data *sd){
-	int nameid = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
+	unsigned short nameid = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
 	if (pc_istrading(sd)) {
 	//Make it fail to avoid shop exploits where you sell something different than you see.
 		clif_skill_fail(sd,sd->ud.skill_id,USESKILL_FAIL_LEVEL,0);
@@ -15115,7 +15115,7 @@ void clif_cashshop_ack(struct map_session_data* sd, int error)
 	WFIFOSET(fd, packet_len(0x289));
 }
 
-void clif_cashshop_result( struct map_session_data *sd, uint16 item_id, uint16 result ){
+void clif_cashshop_result( struct map_session_data *sd, unsigned short item_id, uint16 result ){
 	WFIFOHEAD( sd->fd, 16 );
 	WFIFOW( sd->fd, 0 ) = 0x849;
 	WFIFOL( sd->fd, 2 ) = item_id;
@@ -15143,7 +15143,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) {
 		return;
 	} else {
 #if PACKETVER < 20101116
-		short nameid = RFIFOW(fd,info->pos[0]);
+		unsigned short nameid = RFIFOW(fd,info->pos[0]);
 		short amount = RFIFOW(fd,info->pos[1]);
 		int points   = RFIFOL(fd,info->pos[2]);
 
@@ -15687,7 +15687,7 @@ void clif_mercenary_message(struct map_session_data* sd, int message){
 
 /// Notification about the remaining time of a rental item (ZC_CASH_TIME_COUNTER).
 /// 0298 <name id>.W <seconds>.L
-void clif_rental_time(int fd, int nameid, int seconds)
+void clif_rental_time(int fd, unsigned short nameid, int seconds)
 { // '<ItemName>' item will disappear in <seconds/60> minutes.
 	WFIFOHEAD(fd,packet_len(0x298));
 	WFIFOW(fd,0) = 0x298;
@@ -15699,7 +15699,7 @@ void clif_rental_time(int fd, int nameid, int seconds)
 
 /// Deletes a rental item from client's inventory (ZC_CASH_ITEM_DELETE).
 /// 0299 <index>.W <name id>.W
-void clif_rental_expired(int fd, int index, int nameid)
+void clif_rental_expired(int fd, int index, unsigned short nameid)
 { // '<ItemName>' item has been deleted from the Inventory
 	WFIFOHEAD(fd,packet_len(0x299));
 	WFIFOW(fd,0) = 0x299;

+ 6 - 6
src/map/clif.h

@@ -523,7 +523,7 @@ void clif_skill_teleportmessage(struct map_session_data *sd, int type);
 void clif_skill_produce_mix_list(struct map_session_data *sd, int skill_id, int trigger);
 void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id, int qty, int list_type);
 
-void clif_produceeffect(struct map_session_data* sd,int flag,int nameid);
+void clif_produceeffect(struct map_session_data* sd,int flag, unsigned short nameid);
 
 void clif_skill_setunit(struct skill_unit *unit);
 void clif_skill_delunit(struct skill_unit *unit);
@@ -570,7 +570,7 @@ void clif_item_refine_list(struct map_session_data *sd);
 void clif_item_skill(struct map_session_data *sd,uint16 skill_id,uint16 skill_lv);
 
 void clif_mvp_effect(struct map_session_data *sd);
-void clif_mvp_item(struct map_session_data *sd,int nameid);
+void clif_mvp_item(struct map_session_data *sd, unsigned short nameid);
 void clif_mvp_exp(struct map_session_data *sd, unsigned int exp);
 void clif_mvp_noitem(struct map_session_data* sd);
 void clif_changed_dir(struct block_list *bl, enum send_target target);
@@ -661,7 +661,7 @@ void clif_maptypeproperty2(struct block_list *bl,enum send_target t);
 void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum,int type);
 void clif_map_property_mapall(int map, enum map_property property);
 void clif_refine(int fd, int fail, int index, int val);
-void clif_upgrademessage(int fd, int result, int item_id);
+void clif_upgrademessage(int fd, int result, unsigned short item_id);
 
 //petsystem
 void clif_catch_process(struct map_session_data *sd);
@@ -763,8 +763,8 @@ void clif_mercenary_message(struct map_session_data* sd, int message);
 void clif_mercenary_updatestatus(struct map_session_data *sd, int type);
 
 // RENTAL SYSTEM
-void clif_rental_time(int fd, int nameid, int seconds);
-void clif_rental_expired(int fd, int index, int nameid);
+void clif_rental_time(int fd, unsigned short nameid, int seconds);
+void clif_rental_expired(int fd, int index, unsigned short nameid);
 
 // BOOK READING
 void clif_readbook(int fd, int book_id, int page);
@@ -815,7 +815,7 @@ void clif_open_search_store_info(struct map_session_data* sd);
 void clif_search_store_info_click_ack(struct map_session_data* sd, short x, short y);
 
 /// Cash Shop
-void clif_cashshop_result( struct map_session_data* sd, uint16 item_id, uint16 result );
+void clif_cashshop_result( struct map_session_data* sd, unsigned short item_id, uint16 result );
 void clif_cashshop_open( struct map_session_data* sd );
 
 void clif_display_pinfo(struct map_session_data *sd, int type);

+ 36 - 34
src/map/itemdb.c

@@ -21,7 +21,7 @@
 static struct item_data* itemdb_array[MAX_ITEMDB];
 struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex]
 
-static DBMap* itemdb_other;// int nameid -> struct item_data*
+static DBMap* itemdb_other;// unsigned short nameid -> struct item_data*
 static DBMap *itemdb_combo;
 static DBMap *itemdb_group;
 
@@ -178,7 +178,7 @@ unsigned short itemdb_searchrandomid(uint16 group_id, uint8 sub_group)
 * @param nameid: The target item will be found
 * @return amount
 */
-uint16 itemdb_get_randgroupitem_count(uint16 group_id, uint8 sub_group, uint16 nameid) {
+uint16 itemdb_get_randgroupitem_count(uint16 group_id, uint8 sub_group, unsigned short nameid) {
 	uint16 i, amt = 1;
 	struct s_item_group_db *group = (struct s_item_group_db *) idb_get(itemdb_group, group_id);
 	
@@ -282,7 +282,7 @@ char itemdb_pc_get_itemgroup(uint16 group_id, struct map_session_data *sd) {
 
 /// Searches for the item_data.
 /// Returns the item_data or NULL if it does not exist.
-struct item_data* itemdb_exists(int nameid)
+struct item_data* itemdb_exists(unsigned short nameid)
 {
 	struct item_data* item;
 
@@ -417,7 +417,7 @@ static void create_dummy_data(void)
 	dummy_item.view_id=UNKNOWN_ITEM_ID;
 }
 
-static struct item_data* create_item_data(int nameid)
+static struct item_data* create_item_data(unsigned short nameid)
 {
 	struct item_data *id;
 	CREATE(id, struct item_data, 1);
@@ -430,7 +430,7 @@ static struct item_data* create_item_data(int nameid)
 /*==========================================
  * Loads (and creates if not found) an item from the db.
  *------------------------------------------*/
-struct item_data* itemdb_load(int nameid)
+struct item_data* itemdb_load(unsigned short nameid)
 {
 	struct item_data *id;
 
@@ -454,7 +454,7 @@ struct item_data* itemdb_load(int nameid)
 /*==========================================
  * Loads an item from the db. If not found, it will return the dummy item.
  *------------------------------------------*/
-struct item_data* itemdb_search(int nameid)
+struct item_data* itemdb_search(unsigned short nameid)
 {
 	struct item_data* id;
 	if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
@@ -464,7 +464,7 @@ struct item_data* itemdb_search(int nameid)
 
 	if( id == NULL )
 	{
-		ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", nameid);
+		ShowWarning("itemdb_search: Item ID %hu does not exists in the item_db. Using dummy data.\n", nameid);
 		id = &dummy_item;
 		dummy_item.nameid = nameid;
 	}
@@ -570,7 +570,7 @@ bool itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(str
 /** Specifies if item-type should drop unidentified.
 * @param nameid ID of item
 */
-char itemdb_isidentified(int nameid) {
+char itemdb_isidentified(unsigned short nameid) {
 	int type=itemdb_type(nameid);
 	switch (type) {
 		case IT_WEAPON:
@@ -587,14 +587,14 @@ char itemdb_isidentified(int nameid) {
 * Structure: <nameid>,<sprite>
 */
 static bool itemdb_read_itemavail(char* str[], int columns, int current) {
-	int nameid, sprite;
+	unsigned short nameid, sprite;
 	struct item_data *id;
 
 	nameid = atoi(str[0]);
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
-		ShowWarning("itemdb_read_itemavail: Invalid item id %d.\n", nameid);
+		ShowWarning("itemdb_read_itemavail: Invalid item id %hu.\n", nameid);
 		return false;
 	}
 
@@ -630,7 +630,8 @@ static void itemdb_read_itemgroup_sub(const char* filename, bool silent)
 	while (fgets(line,sizeof(line),fp)) {
 		int group_id = -1;
 		unsigned int j, prob = 1;
-		uint16 nameid, amt = 1, dur = 0;
+		unsigned short nameid;
+		uint16 amt = 1, dur = 0;
 		uint8 rand_group = 1;
 		char *str[9], *p, announced = 0, named = 0, bound = BOUND_NONE;
 		struct s_item_group_random *random = NULL;
@@ -783,14 +784,14 @@ static void itemdb_read_itemgroup(const char* basedir, bool silent) {
 * Structure: <nameid>,<mode>
 */
 static bool itemdb_read_noequip(char* str[], int columns, int current) {
-	int nameid;
+	unsigned short nameid;
 	struct item_data *id;
 
 	nameid = atoi(str[0]);
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
-		ShowWarning("itemdb_read_noequip: Invalid item id %d.\n", nameid);
+		ShowWarning("itemdb_read_noequip: Invalid item id %hu.\n", nameid);
 		return false;
 	}
 
@@ -803,7 +804,7 @@ static bool itemdb_read_noequip(char* str[], int columns, int current) {
 * Structure: <nameid>,<mask>,<gm level>
 */
 static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
-	int nameid, flag, gmlv;
+	unsigned short nameid, flag, gmlv;
 	struct item_data *id;
 
 	nameid = atoi(str[0]);
@@ -820,12 +821,12 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
 	gmlv = atoi(str[2]);
 
 	if( flag < 0 || flag > 511 ) {//Check range
-		ShowWarning("itemdb_read_itemtrade: Invalid trading mask %d for item id %d.\n", flag, nameid);
+		ShowWarning("itemdb_read_itemtrade: Invalid trading mask %hu for item id %hu.\n", flag, nameid);
 		return false;
 	}
 	if( gmlv < 1 )
 	{
-		ShowWarning("itemdb_read_itemtrade: Invalid override GM level %d for item id %d.\n", gmlv, nameid);
+		ShowWarning("itemdb_read_itemtrade: Invalid override GM level %hu for item id %hu.\n", gmlv, nameid);
 		return false;
 	}
 
@@ -839,14 +840,15 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current) {
 * Structure: <nameid>,<delay>
 */
 static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
-	int nameid, delay;
+	unsigned short nameid;
+	int delay;
 	struct item_data *id;
 
 	nameid = atoi(str[0]);
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
-		ShowWarning("itemdb_read_itemdelay: Invalid item id %d.\n", nameid);
+		ShowWarning("itemdb_read_itemdelay: Invalid item id %hu.\n", nameid);
 		return false;
 	}
 
@@ -854,7 +856,7 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current) {
 
 	if( delay < 0 )
 	{
-		ShowWarning("itemdb_read_itemdelay: Invalid delay %d for item id %d.\n", id->delay, nameid);
+		ShowWarning("itemdb_read_itemdelay: Invalid delay %d for item id %hu.\n", id->delay, nameid);
 		return false;
 	}
 
@@ -906,20 +908,20 @@ static bool itemdb_read_stack(char* fields[], int columns, int current) {
 * <nameid>
 */
 static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
-	int nameid;
+	unsigned short nameid;
 	struct item_data* id;
 
 	nameid = atoi(fields[0]);
 
 	if( ( id = itemdb_exists(nameid) ) == NULL )
 	{
-		ShowWarning("itemdb_read_buyingstore: Invalid item id %d.\n", nameid);
+		ShowWarning("itemdb_read_buyingstore: Invalid item id %hu.\n", nameid);
 		return false;
 	}
 
 	if( !itemdb_isstackable2(id) )
 	{
-		ShowWarning("itemdb_read_buyingstore: Non-stackable item id %d cannot be enabled for buying store.\n", nameid);
+		ShowWarning("itemdb_read_buyingstore: Non-stackable item id %hu cannot be enabled for buying store.\n", nameid);
 		return false;
 	}
 
@@ -932,13 +934,13 @@ static bool itemdb_read_buyingstore(char* fields[], int columns, int current) {
 * <nameid>,<flag>,<override>
 */
 static bool itemdb_read_nouse(char* fields[], int columns, int current) {
-	int nameid, flag, override;
+	unsigned short nameid, flag, override;
 	struct item_data* id;
 
 	nameid = atoi(fields[0]);
 
 	if( ( id = itemdb_exists(nameid) ) == NULL ) {
-		ShowWarning("itemdb_read_nouse: Invalid item id %d.\n", nameid);
+		ShowWarning("itemdb_read_nouse: Invalid item id %hu.\n", nameid);
 		return false;
 	}
 
@@ -957,13 +959,13 @@ static bool itemdb_read_nouse(char* fields[], int columns, int current) {
 * &2 - As item container
 */
 static bool itemdb_read_flag(char* fields[], int columns, int current) {
-	uint16 nameid = atoi(fields[0]);
+	unsigned short nameid = atoi(fields[0]);
 	uint8 flag;
 	bool set;
 	struct item_data *id;
 
 	if (!(id = itemdb_exists(nameid))) {
-		ShowError("itemdb_read_flag: Invalid item item with id %d\n", nameid);
+		ShowError("itemdb_read_flag: Invalid item item with id %hu\n", nameid);
 		return true;
 	}
 	
@@ -1185,13 +1187,13 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 		| id | name_english | name_japanese | type | price_buy | price_sell | weight | attack | defence | range | slots | equip_jobs | equip_upper | equip_genders | equip_locations | weapon_level | equip_level | refineable | view | script | equip_script | unequip_script |
 		+----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+-------------+---------------+-----------------+--------------+-------------+------------+------+--------+--------------+----------------+
 	*/
-	int nameid;
+	unsigned short nameid;
 	struct item_data* id;
 
 	nameid = atoi(str[0]);
 	if( nameid <= 0 )
 	{
-		ShowWarning("itemdb_parse_dbrow: Invalid id %d in line %d of \"%s\", skipping.\n", nameid, line, source);
+		ShowWarning("itemdb_parse_dbrow: Invalid id %hu in line %d of \"%s\", skipping.\n", nameid, line, source);
 		return false;
 	}
 
@@ -1204,7 +1206,7 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 
 	if( id->type < 0 || id->type == IT_UNKNOWN || id->type == IT_UNKNOWN2 || ( id->type > IT_SHADOWGEAR && id->type < IT_CASH ) || id->type >= IT_MAX )
 	{// catch invalid item types
-		ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %d. IT_ETC will be used.\n", id->type, nameid);
+		ShowWarning("itemdb_parse_dbrow: Invalid item type %d for item %hu. IT_ETC will be used.\n", id->type, nameid);
 		id->type = IT_ETC;
 	}
 
@@ -1229,13 +1231,13 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 	/*
 	if ( !str[4][0] && !str[5][0])
 	{
-		ShowWarning("itemdb_parse_dbrow: No buying/selling price defined for item %d (%s), using 20/10z\n",       nameid, id->jname);
+		ShowWarning("itemdb_parse_dbrow: No buying/selling price defined for item %hu (%s), using 20/10z\n", nameid, id->jname);
 		id->value_buy = 20;
 		id->value_sell = 10;
 	} else
 	*/
 	if (id->value_buy/124. < id->value_sell/75.)
-		ShowWarning("itemdb_parse_dbrow: Buying/Selling [%d/%d] price of item %d (%s) allows Zeny making exploit  through buying/selling at discounted/overcharged prices!\n",
+		ShowWarning("itemdb_parse_dbrow: Buying/Selling [%d/%d] price of item %hu (%s) allows Zeny making exploit  through buying/selling at discounted/overcharged prices!\n",
 			id->value_buy, id->value_sell, nameid, id->jname);
 
 	id->weight = atoi(str[6]);
@@ -1250,7 +1252,7 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 
 	if (id->slot > MAX_SLOTS)
 	{
-		ShowWarning("itemdb_parse_dbrow: Item %d (%s) specifies %d slots, but the server only supports up to %d. Using %d slots.\n", nameid, id->jname, id->slot, MAX_SLOTS, MAX_SLOTS);
+		ShowWarning("itemdb_parse_dbrow: Item %hu (%s) specifies %d slots, but the server only supports up to %d. Using %d slots.\n", nameid, id->jname, id->slot, MAX_SLOTS, MAX_SLOTS);
 		id->slot = MAX_SLOTS;
 	}
 
@@ -1261,13 +1263,13 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr
 
 	if (!id->equip && itemdb_isequip2(id))
 	{
-		ShowWarning("Item %d (%s) is an equipment with no equip-field! Making it an etc item.\n", nameid, id->jname);
+		ShowWarning("Item %hu (%s) is an equipment with no equip-field! Making it an etc item.\n", nameid, id->jname);
 		id->type = IT_ETC;
 	}
 
 	if( id->type != IT_SHADOWGEAR && id->equip&EQP_SHADOW_GEAR )
 	{
-		ShowWarning("Item %d (%s) have invalid equipment slot! Making it an etc item.\n", nameid, id->jname);
+		ShowWarning("Item %hu (%s) have invalid equipment slot! Making it an etc item.\n", nameid, id->jname);
 		id->type = IT_ETC;
 	}
 

+ 10 - 10
src/map/itemdb.h

@@ -8,8 +8,8 @@
 #include "../common/mmo.h" // ITEM_NAME_LENGTH
 #include "map.h"
 
-/// 32k array entries in array (the rest goes to the db)
-#define MAX_ITEMDB 0x8000
+/// 65,535 entries in array (the rest goes to the db)
+#define MAX_ITEMDB 0x10000
 ///Use apple for unknown items.
 #define UNKNOWN_ITEM_ID 512
 /// The maximum number of item delays
@@ -27,7 +27,7 @@
 
 #define CARD0_FORGE 0x00FF
 #define CARD0_CREATE 0x00FE
-#define CARD0_PET ((short)0xFF00)
+#define CARD0_PET ((unsigned short)0xFF00)
 
 ///Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex]
 #define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET)
@@ -328,7 +328,7 @@ struct item_combo {
 
 /// Struct of item group entry
 struct s_item_group_entry {
-	uint16 nameid, /// Item ID
+	unsigned short nameid, /// Item ID
 		duration; /// Duration if item as rental item (in minutes)
 	uint16 amount; /// Amount of item will be obtained
 	bool isAnnounced, /// Broadcast if player get this item
@@ -352,7 +352,7 @@ struct s_item_group_db {
 
 ///Main item data struct
 struct item_data {
-	uint16 nameid;
+	unsigned short nameid;
 	char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];
 
 	//Do not add stuff between value_buy and view_id (see how getiteminfo works)
@@ -418,9 +418,9 @@ struct item_data {
 
 struct item_data* itemdb_searchname(const char *name);
 int itemdb_searchname_array(struct item_data** data, int size, const char *str);
-struct item_data* itemdb_load(int nameid);
-struct item_data* itemdb_search(int nameid);
-struct item_data* itemdb_exists(int nameid);
+struct item_data* itemdb_load(unsigned short nameid);
+struct item_data* itemdb_search(unsigned short nameid);
+struct item_data* itemdb_exists(unsigned short nameid);
 #define itemdb_name(n) itemdb_search(n)->name
 #define itemdb_jname(n) itemdb_search(n)->jname
 #define itemdb_type(n) itemdb_search(n)->type
@@ -477,14 +477,14 @@ bool itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(str
 
 bool itemdb_isequip2(struct item_data *id);
 #define itemdb_isequip(nameid) itemdb_isequip2(itemdb_search(nameid))
-char itemdb_isidentified(int);
+char itemdb_isidentified(unsigned short);
 bool itemdb_isstackable2(struct item_data *id);
 #define itemdb_isstackable(nameid) itemdb_isstackable2(itemdb_search(nameid))
 uint64 itemdb_unique_id(int8 flag, int64 value); // Unique Item ID
 bool itemdb_isNoEquip(struct item_data *id, uint16 m);
 
 char itemdb_pc_get_itemgroup(uint16 group_id, struct map_session_data *sd);
-uint16 itemdb_get_randgroupitem_count(uint16 group_id, uint8 sub_group, uint16 nameid);
+uint16 itemdb_get_randgroupitem_count(uint16 group_id, uint8 sub_group, unsigned short nameid);
 
 DBMap * itemdb_get_combodb();
 DBMap * itemdb_get_groupdb();

+ 7 - 7
src/map/log.c

@@ -114,7 +114,7 @@ static char log_cashtype2char( e_log_cash_type type ){
 }
 
 /// check if this item should be logged according the settings
-static bool should_log_item(int nameid, int amount, int refine)
+static bool should_log_item(unsigned short nameid, int amount, int refine)
 {
 	int filter = log_config.filter;
 	struct item_data* id;
@@ -201,11 +201,11 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it
 #ifdef BETA_THREAD_TEST
 		char entry[512];
 		int e_length = 0;
-		e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%"PRIu64"')",
+		e_length = sprintf(entry, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) VALUES (NOW(), '%d', '%c', '%hu', '%d', '%d', '%hu', '%hu', '%hu', '%hu', '%s', '%"PRIu64"')",
 				log_config.log_pick, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id);
 		queryThread_log(entry,e_length);
 #else
-		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s', '%"PRIu64"')",
+		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) VALUES (NOW(), '%d', '%c', '%hu', '%d', '%d', '%hu', '%hu', '%hu', '%hu', '%s', '%"PRIu64"')",
 			log_config.log_pick, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id) )
 		{
 			Sql_ShowDebug(logmysql_handle);
@@ -223,7 +223,7 @@ void log_pick(int id, int16 m, e_log_pick_type type, int amount, struct item* it
 			return;
 		time(&curtime);
 		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
-		fprintf(logfp,"%s - %d\t%c\t%d,%d,%d,%d,%d,%d,%d,%s,'%"PRIu64"'\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id);
+		fprintf(logfp,"%s - %d\t%c\t%hu,%d,%d,%hu,%hu,%hu,%hu,%s,'%"PRIu64"'\n", timestring, id, log_picktype2char(type), itm->nameid, amount, itm->refine, itm->card[0], itm->card[1], itm->card[2], itm->card[3], map[m].name?map[m].name:"", itm->unique_id);
 		fclose(logfp);
 	}
 }
@@ -297,11 +297,11 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
 #ifdef BETA_THREAD_TEST
 		char entry[512];
 		int e_length = 0;
-		e_length = sprintf(entry,  LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
+		e_length = sprintf(entry,  LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%hu', '%d', '%s') ",
 						   log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex));
 		queryThread_log(entry,e_length);
 #else
-		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%s') ",
+		if( SQL_ERROR == Sql_Query(logmysql_handle, LOG_QUERY " INTO `%s` (`mvp_date`, `kill_char_id`, `monster_id`, `prize`, `mvpexp`, `map`) VALUES (NOW(), '%d', '%d', '%hu', '%d', '%s') ",
 			log_config.log_mvpdrop, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1], mapindex_id2name(sd->mapindex)) )
 		{
 			Sql_ShowDebug(logmysql_handle);
@@ -319,7 +319,7 @@ void log_mvpdrop(struct map_session_data* sd, int monster_id, int* log_mvp)
 			return;
 		time(&curtime);
 		strftime(timestring, sizeof(timestring), "%m/%d/%Y %H:%M:%S", localtime(&curtime));
-		fprintf(logfp,"%s - %s[%d:%d]\t%d\t%d,%d\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1]);
+		fprintf(logfp,"%s - %s[%d:%d]\t%d\t%hu,%d\n", timestring, sd->status.name, sd->status.account_id, sd->status.char_id, monster_id, log_mvp[0], log_mvp[1]);
 		fclose(logfp);
 	}
 }

+ 5 - 4
src/map/mob.c

@@ -1802,7 +1802,7 @@ static int mob_ai_hard(int tid, unsigned int tick, int id, intptr_t data)
 /*==========================================
  * Initializes the delay drop structure for mob-dropped items.
  *------------------------------------------*/
-static struct item_drop* mob_setdropitem(int nameid, int qty)
+static struct item_drop* mob_setdropitem(unsigned short nameid, int qty)
 {
 	struct item_drop *drop = ers_alloc(item_drop_ers, struct item_drop);
 	memset(&drop->item_data, 0, sizeof(struct item));
@@ -3668,7 +3668,7 @@ static unsigned int mob_drop_adjust(int baserate, int rate_adjust, unsigned shor
  * @param mob_id ID of the monster
  * @param rate_adjust pointer to store ratio if found
  */
-static void item_dropratio_adjust(int nameid, int mob_id, int *rate_adjust)
+static void item_dropratio_adjust(unsigned short nameid, int mob_id, int *rate_adjust)
 {
 	if( item_drop_ratio_db[nameid] ) {
 		if( item_drop_ratio_db[nameid]->mob_id[0] ) { // only for listed mobs
@@ -4529,12 +4529,13 @@ static bool mob_readdb_race2(char* fields[], int columns, int current)
  */
 static bool mob_readdb_itemratio(char* str[], int columns, int current)
 {
-	int nameid, ratio, i;
+	unsigned short nameid;
+	int ratio, i;
 	nameid = atoi(str[0]);
 
 	if( itemdb_exists(nameid) == NULL )
 	{
-		ShowWarning("itemdb_read_itemratio: Invalid item id %d.\n", nameid);
+		ShowWarning("itemdb_read_itemratio: Invalid item id %hu.\n", nameid);
 		return false;
 	}
 

+ 8 - 2
src/map/mob.h

@@ -102,8 +102,14 @@ struct mob_db {
 	short range2,range3;
 	short race2;	// celest
 	unsigned short lv;
-	struct { int nameid,p; } dropitem[MAX_MOB_DROP];
-	struct { int nameid,p; } mvpitem[MAX_MVP_DROP];
+	struct {
+		unsigned short nameid;
+		int p;
+	} dropitem[MAX_MOB_DROP];
+	struct {
+		unsigned short nameid;
+		int p;
+	} mvpitem[MAX_MVP_DROP];
 	struct status_data status;
 	struct view_data vd;
 	unsigned int option;

+ 23 - 18
src/map/npc.c

@@ -1308,7 +1308,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
 		memset(output,'\0',sizeof(output));
 
 		if (id) {
-			sprintf(output,msg_txt(sd,714),id->jname,id->nameid); // Item Shop List: %s (%d)
+			sprintf(output,msg_txt(sd,714),id->jname,id->nameid); // Item Shop List: %s (%hu)
 			clif_broadcast(&sd->bl,output,strlen(output) + 1,BC_BLUE,SELF);
 		}
 	} else if (nd->subtype == POINTSHOP) {
@@ -1336,7 +1336,8 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
 *------------------------------------------*/
 int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, unsigned short* item_list)
 {
-    int i, j, nameid, amount, new_, w, vt;
+    int i, j, amount, new_, w, vt;
+	unsigned short nameid;
     struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 
     if( !nd || nd->subtype != CASHSHOP )
@@ -1364,7 +1365,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
 
         if( !itemdb_isstackable(nameid) && amount > 1 )
         {
-            ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %d!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
+            ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n", sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
             amount = item_list[i*2+0] = 1;
         }
 
@@ -1442,7 +1443,7 @@ static int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* i
 /*==========================================
  * Cash Shop Buy
  *------------------------------------------*/
-int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points)
+int npc_cashshop_buy(struct map_session_data *sd, unsigned short nameid, int amount, int points)
 {
 	struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
 	struct item_data *item;
@@ -1471,7 +1472,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
 
 	if(!itemdb_isstackable(nameid) && amount > 1)
 	{
-		ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %d!\n",
+		ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n",
 			sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 		amount = 1;
 	}
@@ -1492,7 +1493,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
 
 	if( (double)nd->u.shop.shop_item[i].value * amount > INT_MAX )
 	{
-		ShowWarning("npc_cashshop_buy: Item '%s' (%d) price overflow attempt!\n", item->name, nameid);
+		ShowWarning("npc_cashshop_buy: Item '%s' (%hu) price overflow attempt!\n", item->name, nameid);
 		ShowDebug("(NPC:'%s' (%s,%d,%d), player:'%s' (%d/%d), value:%d, amount:%d)\n",
 					nd->exname, map[nd->bl.m].name, nd->bl.x, nd->bl.y, sd->status.name, sd->status.account_id, sd->status.char_id, nd->u.shop.shop_item[i].value, amount);
 		return 5;
@@ -1546,7 +1547,8 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
 	// process entries in buy list, one by one
 	for( i = 0; i < n; ++i )
 	{
-		int nameid, amount, value;
+		unsigned short nameid;
+		int amount, value;
 
 		// find this entry in the shop's sell list
 		ARR_FIND( 0, nd->u.shop.count, j,
@@ -1566,7 +1568,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
 
 		if( !itemdb_isstackable(nameid) && amount > 1 )
 		{	//Exploit? You can't buy more than 1 of equipment types o.O
-			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %d!\n",
+			ShowWarning("Player %s (%d:%d) sent a hexed packet trying to buy %d of nonstackable item %hu!\n",
 				sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
 			amount = item_list[i*2+0] = 1;
 		}
@@ -1668,7 +1670,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
 
 	for( i = 0; i < n; ++i )
 	{
-		int nameid = item_list[i*2+1];
+		unsigned short nameid = item_list[i*2+1];
 		int amount = item_list[i*2+0];
 		struct item item_tmp;
 
@@ -1788,7 +1790,8 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
 	// verify the sell list
 	for( i = 0; i < n; i++ )
 	{
-		int nameid, amount, idx, value;
+		unsigned short nameid;
+		int amount, idx, value;
 
 		idx    = item_list[i*2]-2;
 		amount = item_list[i*2+1];
@@ -2374,7 +2377,8 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
 static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const char* start, const char* buffer, const char* filepath)
 {
 	char *p, point_str[32];
-	int x, y, dir, m, nameid = 0, is_discount = 0;
+	int x, y, dir, m, is_discount = 0;
+	unsigned short nameid = 0;
 	struct npc_data *nd;
 	enum npc_subtype type;
 
@@ -2414,12 +2418,12 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 
 	switch(type) {
 		case ITEMSHOP: {
-			if (sscanf(p,",%d:%d,",&nameid,&is_discount) < 1) {
+			if (sscanf(p,",%hu:%d,",&nameid,&is_discount) < 1) {
 				ShowError("npc_parse_shop: Invalid item cost definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
 				return strchr(start,'\n'); // skip and continue
 			}
 			if (itemdb_exists(nameid) == NULL) {
-				ShowWarning("npc_parse_shop: Invalid item ID cost in file '%s', line '%d' (id '%d').\n", filepath, strline(buffer,start-buffer), nameid);
+				ShowWarning("npc_parse_shop: Invalid item ID cost in file '%s', line '%d' (id '%hu').\n", filepath, strline(buffer,start-buffer), nameid);
 				return strchr(start,'\n'); // skip and continue
 			}
 			p = strchr(p+1,',');
@@ -2454,17 +2458,18 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 
 	nd->u.shop.count = 0;
 	while ( p ) {
-		int nameid, value;
+		unsigned short nameid;
+		int value;
 		struct item_data* id;
 		if( p == NULL )
 			break;
-		if( sscanf(p, ",%d:%d", &nameid, &value) != 2 ) {
+		if( sscanf(p, ",%hu:%d", &nameid, &value) != 2 ) {
 			ShowError("npc_parse_shop: Invalid item definition in file '%s', line '%d'. Ignoring the rest of the line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
 			break;
 		}
 
 		if( (id = itemdb_exists(nameid)) == NULL ) {
-			ShowWarning("npc_parse_shop: Invalid sell item in file '%s', line '%d' (id '%d').\n", filepath, strline(buffer,start-buffer), nameid);
+			ShowWarning("npc_parse_shop: Invalid sell item in file '%s', line '%d' (id '%hu').\n", filepath, strline(buffer,start-buffer), nameid);
 			p = strchr(p+1,',');
 			continue;
 		}
@@ -2475,11 +2480,11 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
 		}
 
 		if( (type == SHOP || type == ITEMSHOP || type == POINTSHOP) && value == 0 ) { // NPC selling items for free!
-			ShowWarning("npc_parse_shop: Item %s [%d] is being sold for FREE in file '%s', line '%d'.\n",
+			ShowWarning("npc_parse_shop: Item %s [%hu] is being sold for FREE in file '%s', line '%d'.\n",
 				id->name, nameid, filepath, strline(buffer,start-buffer));
 		}
 		if( type == SHOP && value*0.75 < id->value_sell*1.24 ) { // Exploit possible: you can buy and sell back with profit
-			ShowWarning("npc_parse_shop: Item %s [%d] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) at file '%s', line '%d'.\n",
+			ShowWarning("npc_parse_shop: Item %s [%hu] discounted buying price (%d->%d) is less than overcharged selling price (%d->%d) at file '%s', line '%d'.\n",
 				id->name, nameid, value, (int)(value*0.75), id->value_sell, (int)(id->value_sell*1.24), filepath, strline(buffer,start-buffer));
 		}
 		//for logs filters, atcommands and iteminfo script command

+ 4 - 3
src/map/npc.h

@@ -20,7 +20,8 @@ struct npc_label_list {
 	int pos;
 };
 struct npc_item_list {
-	unsigned int nameid,value;
+	unsigned short nameid;
+	unsigned int value;
 };
 
 struct npc_data {
@@ -58,7 +59,7 @@ struct npc_data {
 		struct {
 			struct npc_item_list *shop_item;
 			uint16 count;
-			int itemshop_nameid; // Item Shop cost item ID
+			unsigned short itemshop_nameid; // Item Shop cost item ID
 			char pointshop_str[32]; // Point Shop cost variable name
 			bool discount;
 		} shop;
@@ -173,7 +174,7 @@ int npc_script_event(struct map_session_data* sd, enum npce_event type);
 
 int npc_duplicate4instance(struct npc_data *snd, int16 m);
 int npc_instanceinit(struct npc_data* nd);
-int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points);
+int npc_cashshop_buy(struct map_session_data *sd, unsigned short nameid, int amount, int points);
 
 extern struct npc_data* fake_nd;
 

+ 28 - 27
src/map/pc.c

@@ -91,10 +91,10 @@ const struct sg_data sg_info[MAX_PC_FEELHATE] = {
  * to keep cooldowns in memory between player log-ins.
  * All cooldowns are reset when server is restarted.
  **/
-DBMap* itemcd_db = NULL; // char_id -> struct skill_cd
+DBMap* itemcd_db = NULL; // char_id -> struct item_cd
 struct item_cd {
-	unsigned int tick[MAX_ITEMDELAYS];//tick
-	short nameid[MAX_ITEMDELAYS];//skill id
+	unsigned int tick[MAX_ITEMDELAYS]; //tick
+	unsigned short nameid[MAX_ITEMDELAYS]; //item id
 };
 
 //Converts a class to its array index for CLASS_COUNT defined arrays.
@@ -462,7 +462,7 @@ int pc_inventory_rental_clear(struct map_session_data *sd)
 /* Assumes I is valid (from default areas where it is called, it is) */
 void pc_rental_expire(struct map_session_data *sd, int i)
 {
-	short nameid = sd->status.inventory[i].nameid;
+	unsigned short nameid = sd->status.inventory[i].nameid;
 
 	/* Soon to be dropped, we got plans to integrate it with item db */
 	switch( nameid ) {
@@ -697,7 +697,7 @@ int pc_setinventorydata(struct map_session_data *sd)
 	nullpo_retr(1,sd);
 
 	for(i=0;i<MAX_INVENTORY;i++) {
-		uint16 id = sd->status.inventory[i].nameid;
+		unsigned short id = sd->status.inventory[i].nameid;
 		sd->inventory_data[i] = id?itemdb_search(id):NULL;
 	}
 	return 0;
@@ -812,7 +812,7 @@ int pc_setequipindex(struct map_session_data *sd)
  * @param nameid : itemid
  * @return 1:yes, 0:no
  */
-bool pc_isequipped(struct map_session_data *sd, int nameid)
+bool pc_isequipped(struct map_session_data *sd, unsigned short nameid)
 {
 	uint8 i;
 
@@ -1873,7 +1873,7 @@ int pc_disguise(struct map_session_data *sd, int class_)
 	return 1;
 }
 
-static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, short card_id)
+static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, short lv, short rate, short flag, unsigned short card_id)
 {
 	int i;
 
@@ -1909,7 +1909,7 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor
 	return 1;
 }
 
-static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, short card_id)
+static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short src_skill, short id, short lv, short rate, unsigned short card_id)
 {
 	int i;
 
@@ -1995,11 +1995,11 @@ static int pc_bonus_addeff_onskill(struct s_addeffectonskill* effect, int max, e
 * @param race: target race. if < 0, means monster_id
 * @param rate: rate value: 1 ~ 10000. If < 0, it will be multiplied with mob level/10
 */
-static void pc_bonus_item_drop(struct s_add_drop *drop, const short max, uint16 nameid, uint16 group, int class_, short race, int rate)
+static void pc_bonus_item_drop(struct s_add_drop *drop, const short max, unsigned short nameid, uint16 group, int class_, short race, int rate)
 {
 	uint8 i;
 	if (nameid && !group && !itemdb_exists(nameid)) {
-		ShowWarning("pc_bonus_item_drop: Invalid item id\n",nameid);
+		ShowWarning("pc_bonus_item_drop: Invalid item id %hu\n",nameid);
 		return;
 	}
 	//Apply config rate adjustment settings.
@@ -2038,7 +2038,7 @@ static void pc_bonus_item_drop(struct s_add_drop *drop, const short max, uint16
 	}
 	ARR_FIND(0,max,i,!&drop[i] || (drop[i].nameid == 0 && drop[i].group == 0));
 	if (i >= max) {
-		ShowWarning("pc_bonus_item_drop: Reached max (%d) number of added drops per character! (nameid:%d group:%d class_:%d race:%d rate:%d)\n",max,nameid,group,class_,race,rate);
+		ShowWarning("pc_bonus_item_drop: Reached max (%d) number of added drops per character! (nameid:%hu group:%d class_:%d race:%d rate:%d)\n",max,nameid,group,class_,race,rate);
 		return;
 	}
 	drop[i].nameid = nameid;
@@ -3832,7 +3832,7 @@ int pc_skill(TBL_PC* sd, int id, int level, int flag)
 int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
 {
 	int i;
-	int nameid;
+	unsigned short nameid;
 
 	nullpo_ret(sd);
 
@@ -3924,7 +3924,7 @@ int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
  * Checking if we have enough place on inventory for new item
  * Make sure to take 30k as limit (for client I guess)
  *------------------------------------------*/
-int pc_checkadditem(struct map_session_data *sd,int nameid,int amount)
+int pc_checkadditem(struct map_session_data *sd, unsigned short nameid, int amount)
 {
 	int i;
 	struct item_data* data;
@@ -4151,7 +4151,7 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type,
  * @param nameid Find this Item!
  * @return Stored index in inventory, or -1 if not found.
  **/
-short pc_search_inventory(struct map_session_data *sd, uint16 nameid) {
+short pc_search_inventory(struct map_session_data *sd, unsigned short nameid) {
 	int16 i;
 	nullpo_retr(-1, sd);
 
@@ -4416,7 +4416,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
 int pc_isUseitem(struct map_session_data *sd,int n)
 {
 	struct item_data *item;
-	int nameid;
+	unsigned short nameid;
 
 	nullpo_ret(sd);
 
@@ -4599,7 +4599,8 @@ int pc_isUseitem(struct map_session_data *sd,int n)
 int pc_useitem(struct map_session_data *sd,int n)
 {
 	unsigned int tick = gettick();
-	int amount, nameid;
+	int amount;
+	unsigned short nameid;
 	struct script_code *script;
 	struct item item;
 	struct item_data *id;
@@ -4669,7 +4670,7 @@ int pc_useitem(struct map_session_data *sd,int n)
 			if( !(nameid == ITEMID_REINS_OF_MOUNT && sd->sc.option&(OPTION_WUGRIDER|OPTION_RIDING|OPTION_DRAGON|OPTION_MADOGEAR)) )
 				sd->item_delay[i].tick = tick + sd->inventory_data[n]->delay;
 		} else {// should not happen
-			ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%d, char_id=%d)\n", nameid, sd->status.char_id);
+			ShowError("pc_useitem: Exceeded item delay array capacity! (nameid=%hu, char_id=%d)\n", nameid, sd->status.char_id);
 		}
 		//clean up used delays so we can give room for more
 		for(i = 0; i < MAX_ITEMDELAYS; i++) {
@@ -5443,7 +5444,7 @@ short pc_checkequip(struct map_session_data *sd,int pos)
  * @max : see pc.h enum equip_index for @min to ?
  * -return true,false
  *------------------------------------------*/
-bool pc_checkequip2(struct map_session_data *sd,int nameid, int min, int max){
+bool pc_checkequip2(struct map_session_data *sd, unsigned short nameid, int min, int max){
 	int i;
 	for(i=min;i<max;i++){
 		if(equip_pos[i]){
@@ -8961,7 +8962,7 @@ bool pc_equipitem(struct map_session_data *sd,int n,int req_pos)
 	pos = pc_equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
 
 	if(battle_config.battle_log)
-		ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos);
+		ShowInfo("equip %hu(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos);
 
 	if(!pc_isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
 		// FIXME: pc_isequip: equip level failure uses 2 instead of 0
@@ -9376,9 +9377,9 @@ void pc_check_available_item(struct map_session_data *sd) {
 			it = sd->status.inventory[i].nameid;
 
 			if( it && !itemdb_available(it) ) {
-				sprintf(output, msg_txt(sd, 709), it); // Item %d has been removed from your inventory.
+				sprintf(output, msg_txt(sd, 709), it); // Item %hu has been removed from your inventory.
 				clif_displaymessage(sd->fd, output);
-				ShowWarning("Removed invalid/disabled item id %d from inventory (amount=%d, char_id=%d).\n", it, sd->status.inventory[i].amount, sd->status.char_id);
+				ShowWarning("Removed invalid/disabled item id %hu from inventory (amount=%d, char_id=%d).\n", it, sd->status.inventory[i].amount, sd->status.char_id);
 				pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
 			}
 		}
@@ -9389,9 +9390,9 @@ void pc_check_available_item(struct map_session_data *sd) {
 			it = sd->status.cart[i].nameid;
 
 			if( it && !itemdb_available(it) ) {
-				sprintf(output, msg_txt(sd, 710), it); // Item %d has been removed from your cart.
+				sprintf(output, msg_txt(sd, 710), it); // Item %hu has been removed from your cart.
 				clif_displaymessage(sd->fd, output);
-				ShowWarning("Removed invalid/disabled item id %d from cart (amount=%d, char_id=%d).\n", it, sd->status.cart[i].amount, sd->status.char_id);
+				ShowWarning("Removed invalid/disabled item id %hu from cart (amount=%d, char_id=%d).\n", it, sd->status.cart[i].amount, sd->status.char_id);
 				pc_cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
 			}
 		}
@@ -9402,9 +9403,9 @@ void pc_check_available_item(struct map_session_data *sd) {
 			it = sd->status.storage.items[i].nameid;
 
 			if( it && !itemdb_available(it) ) {
-				sprintf(output, msg_txt(sd, 711), it); // Item %d has been removed from your storage.
+				sprintf(output, msg_txt(sd, 711), it); // Item %hu has been removed from your storage.
 				clif_displaymessage(sd->fd, output);
-				ShowWarning("Removed invalid/disabled item id %d from storage (amount=%d, char_id=%d).\n", it, sd->status.storage.items[i].amount, sd->status.char_id);
+				ShowWarning("Removed invalid/disabled item id %hu from storage (amount=%d, char_id=%d).\n", it, sd->status.storage.items[i].amount, sd->status.char_id);
 				storage_delitem(sd, i, sd->status.storage.items[i].amount);
 			}
  		}
@@ -9793,7 +9794,7 @@ void pc_overheat(struct map_session_data *sd, int val) {
 /**
  * Check if player is autolooting given itemID.
  */
-bool pc_isautolooting(struct map_session_data *sd, int nameid)
+bool pc_isautolooting(struct map_session_data *sd, unsigned short nameid)
 {
 	uint8 i = 0;
 
@@ -10909,7 +10910,7 @@ short pc_maxparameter(struct map_session_data *sd, enum e_params param) {
 * @param nameid Item ID
 * @return Heal rate
 **/
-short pc_get_itemgroup_bonus(struct map_session_data* sd, uint16 nameid) {
+short pc_get_itemgroup_bonus(struct map_session_data* sd, unsigned short nameid) {
 	short bonus = 0;
 	uint8 i;
 

+ 12 - 11
src/map/pc.h

@@ -97,7 +97,8 @@ struct weapon_data {
 };
 
 struct s_autospell {
-	short id, lv, rate, card_id, flag;
+	short id, lv, rate, flag;
+	unsigned short card_id;
 	bool lock;  // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
 };
 
@@ -115,7 +116,7 @@ struct s_addeffectonskill {
 
 ///Struct of add drop item/group rate
 struct s_add_drop {
-	uint16 nameid, ///Item ID
+	unsigned short nameid, ///Item ID
 		group; ///Group ID
 	int rate; ///Rate, 1 ~ 10000, -1 ~ -100000
 	short race; ///Target Race, bitwise value of 1<<x. if < 0 means Monster ID
@@ -291,7 +292,7 @@ struct map_session_data {
 	unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
 
 	struct s_item_delay {
-		short nameid;
+		unsigned short nameid;
 		unsigned int tick;
 	} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
 
@@ -351,7 +352,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 s_healrate {
-		int nameid;
+		unsigned short nameid;
 		int rate;
 	} itemhealrate[MAX_PC_BONUS];
 	struct s_subele2 {
@@ -507,7 +508,7 @@ struct map_session_data {
 
 	// Mail System [Zephyrus]
 	struct s_mail {
-		short nameid;
+		unsigned short nameid;
 		int index, amount, zeny;
 		struct mail_data inbox;
 		bool changed; // if true, should sync with charserver on next mailbox request
@@ -829,7 +830,7 @@ int pc_setinventorydata(struct map_session_data *sd);
 int pc_get_skillcooldown(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
 int pc_checkskill(struct map_session_data *sd,uint16 skill_id);
 short pc_checkequip(struct map_session_data *sd,int pos);
-bool pc_checkequip2(struct map_session_data *sd,int nameid,int min, int max);
+bool pc_checkequip2(struct map_session_data *sd, unsigned short nameid, int min, int max);
 
 void pc_scdata_received(struct map_session_data *sd);
 int pc_expiration_timer(int tid, unsigned int tick, int id, intptr_t data);
@@ -848,9 +849,9 @@ void pc_setsavepoint(struct map_session_data *sd, short mapindex,int x,int y);
 int pc_randomwarp(struct map_session_data *sd,clr_type type);
 int pc_memo(struct map_session_data* sd, int pos);
 
-int pc_checkadditem(struct map_session_data*,int,int);
+int pc_checkadditem(struct map_session_data*, unsigned short, int);
 int pc_inventoryblank(struct map_session_data*);
-short pc_search_inventory(struct map_session_data *sd, uint16 nameid);
+short pc_search_inventory(struct map_session_data *sd, unsigned short nameid);
 int pc_payzeny(struct map_session_data*,int, enum e_log_pick_type type, struct map_session_data*);
 char pc_additem(struct map_session_data *sd,struct item *item,int amount,e_log_pick_type log_type);
 int pc_getzeny(struct map_session_data*,int, enum e_log_pick_type, struct map_session_data*);
@@ -872,7 +873,7 @@ int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
 int pc_takeitem(struct map_session_data*,struct flooritem_data*);
 int pc_dropitem(struct map_session_data*,int,int);
 
-bool pc_isequipped(struct map_session_data *sd, int nameid);
+bool pc_isequipped(struct map_session_data *sd, unsigned short nameid);
 bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd );
 bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
 
@@ -1060,7 +1061,7 @@ void pc_rental_expire(struct map_session_data *sd, int i);
 
 int pc_read_motd(void); // [Valaris]
 int pc_disguise(struct map_session_data *sd, int class_);
-bool pc_isautolooting(struct map_session_data *sd, int nameid);
+bool pc_isautolooting(struct map_session_data *sd, unsigned short nameid);
 
 void pc_overheat(struct map_session_data *sd, int val);
 
@@ -1092,7 +1093,7 @@ void pc_bonus_script_clear(struct map_session_data *sd, uint16 flag);
 void pc_cell_basilica(struct map_session_data *sd);
 
 void pc_itemgrouphealrate_clear(struct map_session_data *sd);
-short pc_get_itemgroup_bonus(struct map_session_data* sd, uint16 nameid);
+short pc_get_itemgroup_bonus(struct map_session_data* sd, unsigned short nameid);
 short pc_get_itemgroup_bonus_group(struct map_session_data* sd, uint16 group_id);
 
 #if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)

+ 6 - 5
src/map/pet.c

@@ -71,7 +71,7 @@ void pet_set_intimate(struct pet_data *pd, int value)
 		status_calc_pc(sd,SCO_NONE);
 }
 
-int pet_create_egg(struct map_session_data *sd, int item_id)
+int pet_create_egg(struct map_session_data *sd, unsigned short item_id)
 {
 	int pet_id = search_petDB_index(item_id, PET_EGG);
 	if (pet_id < 0) return 0; //No pet egg here.
@@ -669,7 +669,7 @@ int pet_change_name_ack(struct map_session_data *sd, char* name, int flag)
 int pet_equipitem(struct map_session_data *sd,int index)
 {
 	struct pet_data *pd;
-	int nameid;
+	unsigned short nameid;
 
 	nullpo_retr(1, sd);
 	pd = sd->pd;
@@ -706,7 +706,7 @@ int pet_equipitem(struct map_session_data *sd,int index)
 static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
 {
 	struct item tmp_item;
-	int nameid,flag;
+	unsigned short nameid, flag;
 
 	if(pd->pet.equip == 0)
 		return 1;
@@ -1211,7 +1211,8 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
 void read_petdb(){
 	char* filename[] = {"pet_db.txt",DBIMPORT"/pet_db.txt"};
 	FILE *fp;
-	int nameid,i,j,k;
+	unsigned short nameid;
+	int i,j,k;
 
 	// Remove any previous scripts in case reloaddb was invoked.
 	for( j = 0; j < MAX_PET_DB; j++ )
@@ -1304,7 +1305,7 @@ void read_petdb(){
 
 			if( !mobdb_checkid(nameid) )
 			{
-				ShowWarning("pet_db reading: Invalid mob-class %d, pet not read.\n", nameid);
+				ShowWarning("pet_db reading: Invalid mob-class %hu, pet not read.\n", nameid);
 				continue;
 			}
 

+ 1 - 1
src/map/pet.h

@@ -101,7 +101,7 @@ struct pet_data {
 
 
 
-int pet_create_egg(struct map_session_data *sd, int item_id);
+int pet_create_egg(struct map_session_data *sd, unsigned short item_id);
 int pet_hungry_val(struct pet_data *pd);
 void pet_set_intimate(struct pet_data *pd, int value);
 int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type);

+ 47 - 35
src/map/script.c

@@ -6212,13 +6212,14 @@ BUILDIN_FUNC(countitem)
 	}
 
 	if( !i ) { // For count/cart/storagecountitem function
-		int nameid = id->nameid;
+		unsigned short nameid = id->nameid;
 		for( i = 0; i < size; i++ )
 			if( &items[i] && items[i].nameid == nameid )
 				count += items[i].amount;
 	}
 	else { // For count/cart/storagecountitem2 function
-		int nameid, iden, ref, attr, c1, c2, c3, c4;
+		unsigned short nameid;
+		int iden, ref, attr, c1, c2, c3, c4;
 
 		nameid = id->nameid;
 		iden = script_getnum(st,3);
@@ -6244,10 +6245,11 @@ BUILDIN_FUNC(countitem)
 	return SCRIPT_CMD_SUCCESS;
 }
 
-int checkweight_sub(TBL_PC *sd,int nbargs,int32 *eitemid,int32 *eamount)
+int checkweight_sub(TBL_PC *sd, int nbargs, unsigned short *eitemid, int32 *eamount)
 {
 	struct item_data* id = NULL;
-	int nameid,amount;
+	unsigned short nameid;
+	int amount;
 	uint32 weight=0;
 	uint16 amount2=0,slots,i;
 
@@ -6258,7 +6260,7 @@ int checkweight_sub(TBL_PC *sd,int nbargs,int32 *eitemid,int32 *eamount)
 			continue;
 		id = itemdb_exists(eitemid[i]);
 		if( id == NULL ) {
-			ShowError("checkweight_sub: Invalid item '%d'.\n", eitemid[i]);
+			ShowError("checkweight_sub: Invalid item '%hu'.\n", eitemid[i]);
 			return 0;
 		}
 		nameid = id->nameid;
@@ -6303,7 +6305,8 @@ BUILDIN_FUNC(checkweight)
 	struct map_session_data* sd;
 	struct script_data* data;
 	struct item_data* id = NULL;
-	int32 nameid[SCRIPT_MAX_ARRAYSIZE], amount[SCRIPT_MAX_ARRAYSIZE];
+	unsigned short nameid[SCRIPT_MAX_ARRAYSIZE];
+	int32 amount[SCRIPT_MAX_ARRAYSIZE];
 	uint16 nbargs,i,j=0;
 
 	if( ( sd = script_rid2sd(st) ) == NULL )
@@ -6339,7 +6342,8 @@ BUILDIN_FUNC(checkweight)
 
 BUILDIN_FUNC(checkweight2){
 	//variable sub checkweight
-	int32 nameid[SCRIPT_MAX_ARRAYSIZE], amount[SCRIPT_MAX_ARRAYSIZE], i;
+	unsigned short nameid[SCRIPT_MAX_ARRAYSIZE];
+	int32 amount[SCRIPT_MAX_ARRAYSIZE], i;
 
 	//variable for array parsing
 	struct script_data* data_it;
@@ -6618,7 +6622,8 @@ BUILDIN_FUNC(rentitem) {
 	struct script_data *data;
 	struct item it;
 	int seconds;
-	int nameid = 0, flag;
+	unsigned short nameid = 0;
+	int flag;
 
 	data = script_getdata(st,2);
 	get_val(st,data);
@@ -6640,9 +6645,9 @@ BUILDIN_FUNC(rentitem) {
 	else if( data_isint(data) )
 	{
 		nameid = conv_num(st,data);
-		if( nameid <= 0 || !itemdb_exists(nameid) )
+		if( nameid == 0 || !itemdb_exists(nameid) )
 		{
-			ShowError("buildin_rentitem: Nonexistant item %d requested.\n", nameid);
+			ShowError("buildin_rentitem: Nonexistant item %hu requested.\n", nameid);
 			return SCRIPT_CMD_FAILURE;
 		}
 	}
@@ -6677,7 +6682,7 @@ BUILDIN_FUNC(rentitem2) {
 	struct item it;
 	struct item_data *id;
 	int seconds, flag;
-	uint16 nameid = 0;
+	unsigned short nameid = 0;
 	int iden,ref,attr,c1,c2,c3,c4;
 
 	data = script_getdata(st,2);
@@ -6698,7 +6703,7 @@ BUILDIN_FUNC(rentitem2) {
 	else if( data_isint(data) ) {
 		nameid = conv_num(st,data);
 		if( !(id = itemdb_search(nameid))) {
-			ShowError("buildin_rentitem2: Nonexistant item %d requested.\n", nameid);
+			ShowError("buildin_rentitem2: Nonexistant item %hu requested.\n", nameid);
 			return SCRIPT_CMD_FAILURE;
 		}
 	}
@@ -6756,7 +6761,7 @@ BUILDIN_FUNC(rentitem2) {
  *------------------------------------------*/
 BUILDIN_FUNC(getnameditem)
 {
-	int nameid;
+	unsigned short nameid;
 	struct item item_tmp;
 	TBL_PC *sd, *tsd;
 	struct script_data *data;
@@ -7204,7 +7209,7 @@ BUILDIN_FUNC(delitem)
 		it.nameid = conv_num(st,data);// <item id>
 		if( !itemdb_exists( it.nameid ) )
 		{
-			ShowError("buildin_%s: unknown item \"%d\".\n", command, it.nameid);
+			ShowError("buildin_%s: unknown item \"%hu\".\n", command, it.nameid);
 			st->state = END;
 			return 1;
 		}
@@ -7220,7 +7225,7 @@ BUILDIN_FUNC(delitem)
 		return SCRIPT_CMD_SUCCESS;
 	}
 
-	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%d).\n", command, it.amount, sd->status.account_id, it.nameid);
+	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%hu).\n", command, it.amount, sd->status.account_id, it.nameid);
 	st->state = END;
 	st->mes_active = 0;
 	clif_scriptclose(sd, st->oid);
@@ -7292,7 +7297,7 @@ BUILDIN_FUNC(delitem2)
 		it.nameid = conv_num(st,data);// <item id>
 		if( !itemdb_exists( it.nameid ) )
 		{
-			ShowError("buildin_%s: unknown item \"%d\".\n", command, it.nameid);
+			ShowError("buildin_%s: unknown item \"%hu\".\n", command, it.nameid);
 			st->state = END;
 			return 1;
 		}
@@ -7315,7 +7320,7 @@ BUILDIN_FUNC(delitem2)
 		return SCRIPT_CMD_SUCCESS;
 	}
 
-	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%d).\n", command, it.amount, sd->status.account_id, it.nameid);
+	ShowError("buildin_%s: failed to delete %d items (AID=%d item_id=%hu).\n", command, it.amount, sd->status.account_id, it.nameid);
 	st->state = END;
 	st->mes_active = 0;
 	clif_scriptclose(sd, st->oid);
@@ -12399,7 +12404,7 @@ BUILDIN_FUNC(guardianinfo)
  *------------------------------------------*/
 BUILDIN_FUNC(getitemname)
 {
-	int item_id=0;
+	unsigned short item_id = 0;
 	struct item_data *i_data;
 	char *item_name;
 	struct script_data *data;
@@ -12433,7 +12438,7 @@ BUILDIN_FUNC(getitemname)
  *------------------------------------------*/
 BUILDIN_FUNC(getitemslots)
 {
-	int item_id;
+	unsigned short item_id;
 	struct item_data *i_data;
 
 	item_id=script_getnum(st,2);
@@ -12473,7 +12478,7 @@ BUILDIN_FUNC(getitemslots)
  *------------------------------------------*/
 BUILDIN_FUNC(getiteminfo)
 {
-	int item_id,n;
+	unsigned short item_id,n;
 	int *item_arr;
 	struct item_data *i_data;
 
@@ -12514,7 +12519,8 @@ BUILDIN_FUNC(getiteminfo)
  *------------------------------------------*/
 BUILDIN_FUNC(setiteminfo)
 {
-	int item_id,n,value;
+	unsigned short item_id;
+	int n,value;
 	int *item_arr;
 	struct item_data *i_data;
 
@@ -14168,7 +14174,8 @@ BUILDIN_FUNC(unequip)
 
 BUILDIN_FUNC(equip)
 {
-	int nameid=0,i;
+	unsigned short nameid = 0;
+	int i;
 	TBL_PC *sd;
 	struct item_data *item_data;
 
@@ -14177,7 +14184,7 @@ BUILDIN_FUNC(equip)
 	nameid=script_getnum(st,2);
 	if((item_data = itemdb_exists(nameid)) == NULL)
 	{
-		ShowError("wrong item ID : equipitem(%i)\n",nameid);
+		ShowError("wrong item ID : equipitem(%hu)\n",nameid);
 		return 1;
 	}
 	ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid );
@@ -14189,20 +14196,21 @@ BUILDIN_FUNC(equip)
 
 BUILDIN_FUNC(autoequip)
 {
-	int nameid, flag;
+	unsigned short nameid;
+	int flag;
 	struct item_data *item_data;
 	nameid=script_getnum(st,2);
 	flag=script_getnum(st,3);
 
 	if( ( item_data = itemdb_exists(nameid) ) == NULL )
 	{
-		ShowError("buildin_autoequip: Invalid item '%d'.\n", nameid);
+		ShowError("buildin_autoequip: Invalid item '%hu'.\n", nameid);
 		return SCRIPT_CMD_FAILURE;
 	}
 
 	if( !itemdb_isequip2(item_data) )
 	{
-		ShowError("buildin_autoequip: Item '%d' cannot be equipped.\n", nameid);
+		ShowError("buildin_autoequip: Item '%hu' cannot be equipped.\n", nameid);
 		return SCRIPT_CMD_FAILURE;
 	}
 
@@ -15497,7 +15505,7 @@ BUILDIN_FUNC(npcshopdelitem)
 {
 	const char* npcname = script_getstr(st,2);
 	struct npc_data* nd = npc_name2id(npcname);
-	unsigned int nameid;
+	unsigned short nameid;
 	int n, i;
 	int amount;
 	int size;
@@ -15567,7 +15575,8 @@ BUILDIN_FUNC(npcshopattach)
  *------------------------------------------*/
 BUILDIN_FUNC(setitemscript)
 {
-	int item_id,n=0;
+	unsigned short item_id;
+	int n = 0;
 	const char *script;
 	struct item_data *i_data;
 	struct script_code **dstscript;
@@ -15615,7 +15624,8 @@ BUILDIN_FUNC(addmonsterdrop)
 {
 	struct mob_db *mob;
 	struct script_data *data;
-	int item_id,rate,i,c = 0;
+	unsigned short item_id;
+	int rate,i,c = 0;
 
 	data = script_getdata(st, 2);
 	get_val(st, data); // Convert into value in case of a variable
@@ -15628,7 +15638,7 @@ BUILDIN_FUNC(addmonsterdrop)
 	rate=script_getnum(st,4);
 
 	if(!itemdb_exists(item_id)){
-		ShowError("addmonsterdrop: Nonexistant item %d requested.\n", item_id );
+		ShowError("addmonsterdrop: Nonexistant item %hu requested.\n", item_id );
 		return 1;
 	}
 
@@ -15670,7 +15680,8 @@ BUILDIN_FUNC(delmonsterdrop)
 {
 	struct mob_db *mob;
 	struct script_data *data;
-	int item_id,i;
+	unsigned short item_id;
+	int i;
 
 	data = script_getdata(st, 2);
 	get_val(st, data); // Convert into value in case of a variable
@@ -15682,7 +15693,7 @@ BUILDIN_FUNC(delmonsterdrop)
 	item_id=script_getnum(st,3);
 
 	if(!itemdb_exists(item_id)){
-		ShowError("delmonsterdrop: Nonexistant item %d requested.\n", item_id );
+		ShowError("delmonsterdrop: Nonexistant item %hu requested.\n", item_id );
 		return 1;
 	}
 
@@ -17990,7 +18001,8 @@ BUILDIN_FUNC(checkre)
 BUILDIN_FUNC(getrandgroupitem) {
 	TBL_PC* sd;
 	int i, get_count = 0, flag;
-	uint16 nameid, group = script_getnum(st,2), qty = script_getnum(st,3);
+	unsigned short nameid;
+	uint16 group = script_getnum(st,2), qty = script_getnum(st,3);
 	uint8 sub_group = script_getnum(st,4);
 	struct item item_tmp;
 
@@ -18167,10 +18179,10 @@ BUILDIN_FUNC(consumeitem)
 			return SCRIPT_CMD_FAILURE;
 		}
 	}else if( data_isint( data ) ){
-		int nameid = conv_num( st, data );
+		unsigned short nameid = conv_num( st, data );
 
 		if( ( item_data = itemdb_exists( nameid ) ) == NULL ){
-			ShowError("buildin_consumeitem: Nonexistant item %d requested.\n", nameid );
+			ShowError("buildin_consumeitem: Nonexistant item %hu requested.\n", nameid );
 			return SCRIPT_CMD_FAILURE;
 		}
 	}else{

+ 1 - 1
src/map/searchstore.c

@@ -343,7 +343,7 @@ void searchstore_clearremote(struct map_session_data* sd) {
 
 
 /// receives results from a store-specific callback
-bool searchstore_result(struct map_session_data* sd, int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine)
+bool searchstore_result(struct map_session_data* sd, int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const unsigned short* card, unsigned char refine)
 {
 	struct s_search_store_info_item* ssitem;
 

+ 2 - 2
src/map/searchstore.h

@@ -24,7 +24,7 @@ struct s_search_store_info_item {
 	unsigned short nameid;
 	unsigned short amount;
 	unsigned int price;
-	short card[MAX_SLOTS];
+	unsigned short card[MAX_SLOTS];
 	unsigned char refine;
 };
 
@@ -49,6 +49,6 @@ void searchstore_close(struct map_session_data* sd);
 void searchstore_click(struct map_session_data* sd, int account_id, int store_id, unsigned short nameid);
 bool searchstore_queryremote(struct map_session_data* sd, int account_id);
 void searchstore_clearremote(struct map_session_data* sd);
-bool searchstore_result(struct map_session_data* sd, int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const short* card, unsigned char refine);
+bool searchstore_result(struct map_session_data* sd, int store_id, int account_id, const char* store_name, unsigned short nameid, unsigned short amount, unsigned int price, const unsigned short* card, unsigned char refine);
 
 #endif  // _SEARCHSTORE_H_

+ 16 - 14
src/map/skill.c

@@ -91,7 +91,7 @@ struct s_skill_changematerial_db skill_changematerial_db[MAX_SKILL_PRODUCE_DB];
 
 //Warlock
 struct s_skill_spellbook_db {
-	int nameid;
+	unsigned short nameid;
 	uint16 skill_id;
 	int point;
 };
@@ -17451,13 +17451,13 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
 /*==========================================
  *
  *------------------------------------------*/
-int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, int qty)
+int skill_can_produce_mix (struct map_session_data *sd, unsigned short nameid, int trigger, int qty)
 {
 	int i,j;
 
 	nullpo_ret(sd);
 
-	if(nameid<=0)
+	if(nameid == 0)
 		return 0;
 
 	for(i=0;i<MAX_SKILL_PRODUCE_DB;i++){
@@ -17515,7 +17515,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
 /*==========================================
  *
  *------------------------------------------*/
-int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty)
+int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, unsigned short nameid, int slot1, int slot2, int slot3, int qty)
 {
 	int slot[3];
 	int i,sc,ele,idx,equip,wlv,make_per = 0,flag = 0,skill_lv = 0;
@@ -18099,14 +18099,14 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
 	return 0;
 }
 
-int skill_arrow_create (struct map_session_data *sd, int nameid)
+int skill_arrow_create (struct map_session_data *sd, unsigned short nameid)
 {
 	int i,j,flag,index=-1;
 	struct item tmp_item;
 
 	nullpo_ret(sd);
 
-	if(nameid <= 0)
+	if(nameid == 0)
 		return 1;
 
 	for(i=0;i<MAX_SKILL_ARROW_DB;i++)
@@ -18140,7 +18140,7 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
 
 	return 0;
 }
-int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
+int skill_poisoningweapon( struct map_session_data *sd, unsigned short nameid) {
 	sc_type type;
 	int chance, i;
 	//uint16 msg = 1443; //Official is using msgstringtable.txt
@@ -18149,7 +18149,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
 
 	nullpo_ret(sd);
 
-	if( nameid <= 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
+	if( nameid == 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
 		clif_skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0);
 		return 0;
 	}
@@ -18206,13 +18206,13 @@ static void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id)
 }
 
 
-int skill_magicdecoy(struct map_session_data *sd, int nameid) {
+int skill_magicdecoy(struct map_session_data *sd, unsigned short nameid) {
 	int x, y, i, class_, skill;
 	struct mob_data *md;
 	nullpo_ret(sd);
 	skill = sd->menuskill_val;
 
-	if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
+	if( nameid == 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
 		clif_skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0);
 		return 0;
 	}
@@ -18254,7 +18254,7 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
 }
 
 // Warlock Spellbooks. [LimitLine/3CeAM]
-int skill_spellbook (struct map_session_data *sd, int nameid) {
+int skill_spellbook (struct map_session_data *sd, unsigned short nameid) {
 	int i, max_preserve, skill_id, point;
 	struct status_change *sc;
 
@@ -18335,7 +18335,8 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
 		return 1;
 
 	for( i = 0; i < n; i++ ) {
-		int nameid, add_amount, del_amount, idx, product;
+		unsigned short nameid;
+		int add_amount, del_amount, idx, product;
 		struct item tmp_item;
 
 		idx = item_list[i*2+0]-2;
@@ -18395,7 +18396,8 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
 }
 
 int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list) {
-	int i, j, k, c, p = 0, nameid, amount;
+	int i, j, k, c, p = 0, amount;
+	unsigned short nameid;
 
 	nullpo_ret(sd);
 	nullpo_ret(item_list);
@@ -19598,7 +19600,7 @@ static bool skill_parse_row_spellbookdb(char* split[], int columns, int current)
 
 	uint16 skill_id = atoi(split[0]);
 	int points = atoi(split[1]);
-	int nameid = atoi(split[2]);
+	unsigned short nameid = atoi(split[2]);
 
 	if( !skill_get_index(skill_id) || !skill_get_max(skill_id) )
 		ShowError("spellbook_db: Invalid skill ID %d\n", skill_id);

+ 10 - 8
src/map/skill.h

@@ -270,7 +270,8 @@ enum {
 
 /// Create Database item
 struct s_skill_produce_db {
-	int nameid, trigger;
+	unsigned short nameid;
+	int trigger;
 	int req_skill,req_skill_lv,itemlv;
 	int mat_id[MAX_PRODUCE_RESOURCE],mat_amount[MAX_PRODUCE_RESOURCE];
 };
@@ -278,7 +279,8 @@ extern struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB];
 
 /// Creating database arrow
 struct s_skill_arrow_db {
-	int nameid, trigger;
+	unsigned short nameid;
+	int trigger;
 	int cre_id[MAX_ARROW_RESOURCE],cre_amount[MAX_ARROW_RESOURCE];
 };
 extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB];
@@ -430,10 +432,10 @@ bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skil
 int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap);
 
 // Item creation
-int skill_can_produce_mix( struct map_session_data *sd, int nameid, int trigger, int qty);
-int skill_produce_mix( struct map_session_data *sd, uint16 skill_id, int nameid, int slot1, int slot2, int slot3, int qty );
+int skill_can_produce_mix( struct map_session_data *sd, unsigned short nameid, int trigger, int qty);
+int skill_produce_mix( struct map_session_data *sd, uint16 skill_id, unsigned short nameid, int slot1, int slot2, int slot3, int qty );
 
-int skill_arrow_create( struct map_session_data *sd,int nameid);
+int skill_arrow_create( struct map_session_data *sd, unsigned short nameid);
 
 // skills for the mob
 int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,unsigned int tick,int flag );
@@ -1963,7 +1965,7 @@ enum wl_spheres {
 	WLS_WATER,
 	WLS_STONE,
 };
-int skill_spellbook (struct map_session_data *sd, int nameid);
+int skill_spellbook (struct map_session_data *sd, unsigned short nameid);
 int skill_block_check(struct block_list *bl, enum sc_type type, uint16 skill_id);
 /**
  * Guilottine Cross
@@ -1983,11 +1985,11 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
 /**
  * Mechanic
  **/
-int skill_magicdecoy(struct map_session_data *sd, int nameid);
+int skill_magicdecoy(struct map_session_data *sd, unsigned short nameid);
 /**
  * Guiltoine Cross
  **/
-int skill_poisoningweapon( struct map_session_data *sd, int nameid);
+int skill_poisoningweapon( struct map_session_data *sd, unsigned short nameid);
 /**
  * Auto Shadow Spell (Shadow Chaser)
  **/

+ 5 - 5
src/map/storage.c

@@ -503,7 +503,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
 	nullpo_retr(1, stor);
 	nullpo_retr(1, item_data);
 
-	if(item_data->nameid <= 0 || amount <= 0)
+	if(item_data->nameid == 0 || amount <= 0)
 		return 1;
 
 	data = itemdb_search(item_data->nameid);
@@ -597,7 +597,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
 	if( index<0 || index>=MAX_INVENTORY )
 		return 0;
 
-	if( sd->status.inventory[index].nameid <= 0 )
+	if( sd->status.inventory[index].nameid == 0 )
 		return 0;
 
 	if( amount < 1 || amount > sd->status.inventory[index].amount )
@@ -639,7 +639,7 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
 	if(index<0 || index>=MAX_GUILD_STORAGE)
 		return 0;
 
-	if(stor->items[index].nameid <= 0)
+	if(stor->items[index].nameid == 0)
 		return 0;
 
 	if(amount < 1 || amount > stor->items[index].amount)
@@ -681,7 +681,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
 	if( index < 0 || index >= MAX_CART )
 		return 0;
 
-	if( sd->status.cart[index].nameid <= 0 )
+	if( sd->status.cart[index].nameid == 0 )
 		return 0;
 
 	if( amount < 1 || amount > sd->status.cart[index].amount )
@@ -714,7 +714,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
 	if(index<0 || index>=MAX_GUILD_STORAGE)
 	  	return 0;
 
-	if(stor->items[index].nameid<=0)
+	if(stor->items[index].nameid == 0)
 		return 0;
 
 	if(amount < 1 || amount > stor->items[index].amount)