summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c6
-rw-r--r--src/map/buyingstore.c2
-rw-r--r--src/map/clif.c12
-rw-r--r--src/map/itemdb.c246
-rw-r--r--src/map/itemdb.h82
-rw-r--r--src/map/mob.c4
-rw-r--r--src/map/npc.c8
-rw-r--r--src/map/pc.c14
-rw-r--r--src/map/script.c20
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/storage.c4
-rw-r--r--src/map/trade.c4
12 files changed, 233 insertions, 171 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index f13ad0a4e..2466c2cca 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1157,7 +1157,7 @@ ACMD(item)
item_id = item_data->nameid;
get_count = number;
//Check if it's stackable.
- if (!itemdb_isstackable2(item_data))
+ if (!itemdb->isstackable2(item_data))
get_count = 1;
for (i = 0; i < number; i += get_count) {
@@ -2138,7 +2138,7 @@ ACMD(produce)
item_id = item_data->nameid;
- if (itemdb_isequip2(item_data)) {
+ if (itemdb->isequip2(item_data)) {
int flag = 0;
if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE)
attribute = ATTRIBUTE_NORMAL;
@@ -7222,7 +7222,7 @@ ACMD(iteminfo)
item_data = item_array[i];
sprintf(atcmd_output, msg_txt(1277), // Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s
item_data->name,item_data->jname,item_data->slot,item_data->nameid,
- itemdb_typename(item_data->type),
+ itemdb->typename(item_data->type),
(item_data->script==NULL)? msg_txt(1278) : msg_txt(1279) // None / With script
);
clif->message(fd, atcmd_output);
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 73c50b0bf..5edf9a321 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -147,7 +147,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
break;
}
- if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, pc->get_group_level(sd), pc->get_group_level(sd)) || ( idx = pc->search_inventory(sd, nameid) ) == -1 )
+ if( !id->flag.buyingstore || !itemdb->cantrade_sub(id, pc->get_group_level(sd), pc->get_group_level(sd)) || ( idx = pc->search_inventory(sd, nameid) ) == -1 )
{// restrictions: allowed, no character-bound items and at least one must be owned
break;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index da8af5543..bdb7eefc7 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2326,7 +2326,7 @@ void clif_inventorylist(struct map_session_data *sd) {
if( sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL )
continue;
- if( !itemdb_isstackable2(sd->inventory_data[i]) )
+ if( !itemdb->isstackable2(sd->inventory_data[i]) )
{ //Non-stackable (Equippable)
WBUFW(bufe,ne*se+4)=i+2;
clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc->equippoint(sd,i));
@@ -2415,7 +2415,7 @@ void clif_equiplist(struct map_session_data *sd)
if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL)
continue;
- if(itemdb_isstackable2(sd->inventory_data[i]))
+ if(itemdb->isstackable2(sd->inventory_data[i]))
continue;
//Equippable
WBUFW(buf,n*cmd+4)=i+2;
@@ -2473,7 +2473,7 @@ void clif_storagelist(struct map_session_data* sd, struct item* items, int items
if( items[i].nameid <= 0 )
continue;
id = itemdb->search(items[i].nameid);
- if( !itemdb_isstackable2(id) )
+ if( !itemdb->isstackable2(id) )
{ //Equippable
WBUFW(bufe,ne*cmd+4)=i+1;
clif->item_sub(bufe, ne*cmd+6, &items[i], id, id->equip);
@@ -2553,7 +2553,7 @@ void clif_cartlist(struct map_session_data *sd)
if( sd->status.cart[i].nameid <= 0 )
continue;
id = itemdb->search(sd->status.cart[i].nameid);
- if( !itemdb_isstackable2(id) )
+ if( !itemdb->isstackable2(id) )
{ //Equippable
WBUFW(bufe,ne*cmd+4)=i+2;
clif->item_sub(bufe, ne*cmd+6, &sd->status.cart[i], id, id->equip);
@@ -9012,7 +9012,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
{
if (tsd->status.inventory[i].nameid <= 0 || tsd->inventory_data[i] == NULL) // Item doesn't exist
continue;
- if (!itemdb_isequip2(tsd->inventory_data[i])) // Is not equippable
+ if (!itemdb->isequip2(tsd->inventory_data[i])) // Is not equippable
continue;
// Inventory position
@@ -17314,7 +17314,7 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) {
get_count = qty;
- if (!itemdb_isstackable2(data))
+ if (!itemdb->isstackable2(data))
get_count = 1;
pc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki]
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 7045bd358..c2a25c2d4 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -19,11 +19,6 @@
#include <stdlib.h>
#include <string.h>
-static struct item_data* itemdb_array[MAX_ITEMDB];
-static DBMap* itemdb_other;// int nameid -> struct item_data*
-
-struct item_data dummy_item; //This is the default dummy item used for non-existant items. [Skotlex]
-
struct itemdb_interface itemdb_s;
/**
@@ -31,14 +26,14 @@ struct itemdb_interface itemdb_s;
* name = item alias, so we should find items aliases first. if not found then look for "jname" (full name)
* @see DBApply
*/
-static int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
+int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
{
struct item_data *item = DB->data2ptr(data), **dst, **dst2;
char *str;
str=va_arg(ap,char *);
dst=va_arg(ap,struct item_data **);
dst2=va_arg(ap,struct item_data **);
- if(item == &dummy_item) return 0;
+ if(item == &itemdb->dummy) return 0;
//Absolute priority to Aegis code name.
if (*dst != NULL) return 0;
@@ -60,8 +55,8 @@ struct item_data* itemdb_searchname(const char *str) {
struct item_data* item2=NULL;
int i;
- for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) {
- item = itemdb_array[i];
+ for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) {
+ item = itemdb->array[i];
if( item == NULL )
continue;
@@ -75,7 +70,7 @@ struct item_data* itemdb_searchname(const char *str) {
}
item = NULL;
- itemdb_other->foreach(itemdb_other,itemdb_searchname_sub,str,&item,&item2);
+ itemdb->other->foreach(itemdb->other,itemdb->searchname_sub,str,&item,&item2);
return item?item:item2;
}
/* name to item data */
@@ -86,12 +81,12 @@ struct item_data* itemdb_name2id(const char *str) {
/**
* @see DBMatcher
*/
-static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
+int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
{
struct item_data *item = DB->data2ptr(&data);
char *str;
str=va_arg(ap,char *);
- if (item == &dummy_item)
+ if (item == &itemdb->dummy)
return 1; //Invalid item.
if(stristr(item->jname,str))
return 0;
@@ -112,9 +107,9 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str,
int count=0;
// Search in the array
- for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i )
+ for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i )
{
- item = itemdb_array[i];
+ item = itemdb->array[i];
if( item == NULL )
continue;
@@ -133,7 +128,7 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str,
DBData *db_data[MAX_SEARCH];
int db_count = 0;
size -= count;
- db_count = itemdb_other->getall(itemdb_other, (DBData**)&db_data, size, itemdb_searchname_array_sub, str);
+ db_count = itemdb->other->getall(itemdb->other, (DBData**)&db_data, size, itemdb->searchname_array_sub, str);
for (i = 0; i < db_count; i++)
data[count++] = DB->data2ptr(db_data[i]);
count += db_count;
@@ -190,7 +185,7 @@ void itemdb_package_item(struct map_session_data *sd, struct item_package *packa
if( package->must_items[i].announce )
clif->package_announce(sd,package->must_items[i].id,package->id);
- get_count = itemdb_isstackable(package->must_items[i].id) ? package->must_items[i].qty : 1;
+ get_count = itemdb->isstackable(package->must_items[i].id) ? package->must_items[i].qty : 1;
it.amount = get_count == 1 ? 1 : get_count;
@@ -231,7 +226,7 @@ void itemdb_package_item(struct map_session_data *sd, struct item_package *packa
if( entry->announce )
clif->package_announce(sd,entry->id,package->id);
- get_count = itemdb_isstackable(entry->id) ? entry->qty : 1;
+ get_count = itemdb->isstackable(entry->id) ? entry->qty : 1;
it.amount = get_count == 1 ? 1 : get_count;
@@ -274,10 +269,10 @@ struct item_data* itemdb_exists(int nameid)
{
struct item_data* item;
- if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
- return itemdb_array[nameid];
- item = (struct item_data*)idb_get(itemdb_other,nameid);
- if( item == &dummy_item )
+ if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb->array) )
+ return itemdb->array[nameid];
+ item = (struct item_data*)idb_get(itemdb->other,nameid);
+ if( item == &itemdb->dummy )
return NULL;// dummy data, doesn't exist
return item;
}
@@ -307,7 +302,7 @@ const char* itemdb_typename(int type)
* Converts the jobid from the format in itemdb
* to the format used by the map server. [Skotlex]
*------------------------------------------*/
-static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
+void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
{
int i;
bclass[0]= bclass[1]= bclass[2]= 0;
@@ -373,19 +368,19 @@ static void itemdb_jobid2mapid(unsigned int *bclass, unsigned int jobmask)
bclass[1] |= 1<<MAPID_NINJA;
}
-static void create_dummy_data(void)
+void create_dummy_data(void)
{
- memset(&dummy_item, 0, sizeof(struct item_data));
- dummy_item.nameid=500;
- dummy_item.weight=1;
- dummy_item.value_sell=1;
- dummy_item.type=IT_ETC; //Etc item
- safestrncpy(dummy_item.name,"UNKNOWN_ITEM",sizeof(dummy_item.name));
- safestrncpy(dummy_item.jname,"UNKNOWN_ITEM",sizeof(dummy_item.jname));
- dummy_item.view_id=UNKNOWN_ITEM_ID;
+ memset(&itemdb->dummy, 0, sizeof(struct item_data));
+ itemdb->dummy.nameid=500;
+ itemdb->dummy.weight=1;
+ itemdb->dummy.value_sell=1;
+ itemdb->dummy.type=IT_ETC; //Etc item
+ safestrncpy(itemdb->dummy.name,"UNKNOWN_ITEM",sizeof(itemdb->dummy.name));
+ safestrncpy(itemdb->dummy.jname,"UNKNOWN_ITEM",sizeof(itemdb->dummy.jname));
+ itemdb->dummy.view_id=UNKNOWN_ITEM_ID;
}
-static struct item_data* create_item_data(int nameid)
+struct item_data* create_item_data(int nameid)
{
struct item_data *id;
CREATE(id, struct item_data, 1);
@@ -401,19 +396,19 @@ static struct item_data* create_item_data(int nameid)
struct item_data* itemdb_load(int nameid) {
struct item_data *id;
- if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
+ if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb->array) )
{
- id = itemdb_array[nameid];
- if( id == NULL || id == &dummy_item )
- id = itemdb_array[nameid] = create_item_data(nameid);
+ id = itemdb->array[nameid];
+ if( id == NULL || id == &itemdb->dummy )
+ id = itemdb->array[nameid] = itemdb->create_item_data(nameid);
return id;
}
- id = (struct item_data*)idb_get(itemdb_other, nameid);
- if( id == NULL || id == &dummy_item )
+ id = (struct item_data*)idb_get(itemdb->other, nameid);
+ if( id == NULL || id == &itemdb->dummy )
{
- id = create_item_data(nameid);
- idb_put(itemdb_other, nameid, id);
+ id = itemdb->create_item_data(nameid);
+ idb_put(itemdb->other, nameid, id);
}
return id;
}
@@ -424,16 +419,16 @@ struct item_data* itemdb_load(int nameid) {
struct item_data* itemdb_search(int nameid)
{
struct item_data* id;
- if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb_array) )
- id = itemdb_array[nameid];
+ if( nameid >= 0 && nameid < ARRAYLENGTH(itemdb->array) )
+ id = itemdb->array[nameid];
else
- id = (struct item_data*)idb_get(itemdb_other, nameid);
+ id = (struct item_data*)idb_get(itemdb->other, nameid);
if( id == NULL )
{
ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", nameid);
- id = &dummy_item;
- dummy_item.nameid = nameid;
+ id = &itemdb->dummy;
+ itemdb->dummy.nameid = nameid;
}
return id;
}
@@ -546,7 +541,7 @@ int itemdb_canauction_sub(struct item_data* item, int gmlv, int unused) {
int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int))
{
- struct item_data* item_data = itemdb_search(item->nameid);
+ struct item_data* item_data = itemdb->search(item->nameid);
int i;
if (!func(item_data, gmlv, gmlv2))
@@ -557,7 +552,7 @@ int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(stru
for(i = 0; i < item_data->slot; i++) {
if (!item->card[i]) continue;
- if (!func(itemdb_search(item->card[i]), gmlv, gmlv2))
+ if (!func(itemdb->search(item->card[i]), gmlv, gmlv2))
return 0;
}
return 1;
@@ -594,7 +589,7 @@ int itemdb_isidentified2(struct item_data *data) {
* Search by name for the override flags available items
* (Give item another sprite)
*------------------------------------------*/
-static bool itemdb_read_itemavail(char* str[], int columns, int current)
+bool itemdb_read_itemavail(char* str[], int columns, int current)
{// <nameid>,<sprite>
int nameid, sprite;
struct item_data *id;
@@ -1202,7 +1197,7 @@ void itemdb_read_chains(void) {
/*==========================================
* Reads item trade restrictions [Skotlex]
*------------------------------------------*/
-static bool itemdb_read_itemtrade(char* str[], int columns, int current)
+bool itemdb_read_itemtrade(char* str[], int columns, int current)
{// <nameid>,<mask>,<gm level>
int nameid, flag, gmlv;
struct item_data *id;
@@ -1239,7 +1234,7 @@ static bool itemdb_read_itemtrade(char* str[], int columns, int current)
/*==========================================
* Reads item delay amounts [Paradox924X]
*------------------------------------------*/
-static bool itemdb_read_itemdelay(char* str[], int columns, int current)
+bool itemdb_read_itemdelay(char* str[], int columns, int current)
{// <nameid>,<delay>
int nameid, delay;
struct item_data *id;
@@ -1268,7 +1263,7 @@ static bool itemdb_read_itemdelay(char* str[], int columns, int current)
/*==================================================================
* Reads item stacking restrictions
*----------------------------------------------------------------*/
-static bool itemdb_read_stack(char* fields[], int columns, int current)
+bool itemdb_read_stack(char* fields[], int columns, int current)
{// <item id>,<stack limit amount>,<type>
unsigned short nameid, amount;
unsigned int type;
@@ -1282,7 +1277,7 @@ static bool itemdb_read_stack(char* fields[], int columns, int current)
return false;
}
- if( !itemdb_isstackable2(id) )
+ if( !itemdb->isstackable2(id) )
{
ShowWarning("itemdb_read_stack: Item id '%hu' is not stackable.\n", nameid);
return false;
@@ -1307,7 +1302,7 @@ static bool itemdb_read_stack(char* fields[], int columns, int current)
/// Reads items allowed to be sold in buying stores
-static bool itemdb_read_buyingstore(char* fields[], int columns, int current)
+bool itemdb_read_buyingstore(char* fields[], int columns, int current)
{// <nameid>
int nameid;
struct item_data* id;
@@ -1320,7 +1315,7 @@ static bool itemdb_read_buyingstore(char* fields[], int columns, int current)
return false;
}
- if( !itemdb_isstackable2(id) )
+ if( !itemdb->isstackable2(id) )
{
ShowWarning("itemdb_read_buyingstore: Non-stackable item id %d cannot be enabled for buying store.\n", nameid);
return false;
@@ -1334,7 +1329,7 @@ static bool itemdb_read_buyingstore(char* fields[], int columns, int current)
/*******************************************
** Item usage restriction (item_nouse.txt)
********************************************/
-static bool itemdb_read_nouse(char* fields[], int columns, int current)
+bool itemdb_read_nouse(char* fields[], int columns, int current)
{// <nameid>,<flag>,<override>
int nameid, flag, override;
struct item_data* id;
@@ -1443,7 +1438,7 @@ void itemdb_read_combos() {
struct item_data * id = NULL;
int idx = 0;
- if((retcount = itemdb_combo_split_atoi(str[0], items)) < 2) {
+ if((retcount = itemdb->combo_split_atoi(str[0], items)) < 2) {
ShowError("itemdb_read_combos: line %d of \"%s\" doesn't have enough items to make for a combo (min:2), skipping.\n", lines, path);
continue;
}
@@ -1524,7 +1519,7 @@ void itemdb_read_combos() {
/*======================================
* Applies gender restrictions according to settings. [Skotlex]
*======================================*/
-static int itemdb_gendercheck(struct item_data *id)
+int itemdb_gendercheck(struct item_data *id)
{
if (id->nameid == WEDDING_RING_M) //Grom Ring
return 1;
@@ -1588,7 +1583,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
}
//ID,Name,Jname,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Job Upper,Gender,Loc,wLV,eLV,refineable,View
- id = itemdb_load(nameid);
+ id = itemdb->load(nameid);
safestrncpy(id->name, str[1], sizeof(id->name));
safestrncpy(id->jname, str[2], sizeof(id->jname));
@@ -1637,7 +1632,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
id->matk = atoi(str[8]);
offset += 1;
} else
- itemdb_re_split_atoi(str[7],&id->atk,&id->matk);
+ itemdb->re_split_atoi(str[7],&id->atk,&id->matk);
#else
id->atk = atoi(str[7]);
#endif
@@ -1650,12 +1645,12 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
id->slot = MAX_SLOTS;
}
- itemdb_jobid2mapid(id->class_base, (unsigned int)strtoul(str[11+offset],NULL,0));
+ itemdb->jobid2mapid(id->class_base, (unsigned int)strtoul(str[11+offset],NULL,0));
id->class_upper = atoi(str[12+offset]);
id->sex = atoi(str[13+offset]);
id->equip = atoi(str[14+offset]);
- if (!id->equip && itemdb_isequip2(id)) {
+ 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);
id->type = IT_ETC;
}
@@ -1667,7 +1662,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
id->elvmax = atoi(str[17+offset]);
offset += 1;
} else
- itemdb_re_split_atoi(str[16],&id->elv,&id->elvmax);
+ itemdb->re_split_atoi(str[16],&id->elv,&id->elvmax);
#else
id->elv = atoi(str[16]);
#endif
@@ -1676,7 +1671,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
id->flag.available = 1;
id->view_id = 0;
- id->sex = itemdb_gendercheck(id); //Apply gender filtering.
+ id->sex = itemdb->gendercheck(id); //Apply gender filtering.
if (id->script) {
script->free_code(id->script);
@@ -1705,7 +1700,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt)
* Reading item from item db
* item_db2 overwriting item_db
*------------------------------------------*/
-static int itemdb_readdb(void)
+int itemdb_readdb(void)
{
const char* filename[] = {
DBPATH"item_db.txt",
@@ -1831,7 +1826,7 @@ static int itemdb_readdb(void)
/*======================================
* item_db table reading
*======================================*/
-static int itemdb_read_sqldb(void) {
+int itemdb_read_sqldb(void) {
const char* item_db_name[] = {
#ifdef RENEWAL
@@ -1914,7 +1909,7 @@ int itemdb_uid_load() {
}
SQL->GetData(mmysql_handle, 0, &uid, NULL);
- itemdb_unique_id(1, (uint64)strtoull(uid, NULL, 10));
+ itemdb->unique_id(1, (uint64)strtoull(uid, NULL, 10));
SQL->FreeResult(mmysql_handle);
return 0;
@@ -1923,37 +1918,37 @@ int itemdb_uid_load() {
/*====================================
* read all item-related databases
*------------------------------------*/
-static void itemdb_read(void) {
+void itemdb_read(void) {
int i;
DBData prev;
if (iMap->db_use_sql_item_db)
- itemdb_read_sqldb();
+ itemdb->read_sqldb();
else
- itemdb_readdb();
+ itemdb->readdb();
- for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) {
- if( itemdb_array[i] ) {
- if( itemdb->names->put(itemdb->names,DB->str2key(itemdb_array[i]->name),DB->ptr2data(itemdb_array[i]),&prev) ) {
+ for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i ) {
+ if( itemdb->array[i] ) {
+ if( itemdb->names->put(itemdb->names,DB->str2key(itemdb->array[i]->name),DB->ptr2data(itemdb->array[i]),&prev) ) {
struct item_data *data = DB->data2ptr(&prev);
- ShowError("itemdb_read: duplicate AegisName '%s' in item ID %d and %d\n",itemdb_array[i]->name,itemdb_array[i]->nameid,data->nameid);
+ ShowError("itemdb_read: duplicate AegisName '%s' in item ID %d and %d\n",itemdb->array[i]->name,itemdb->array[i]->nameid,data->nameid);
}
}
}
- itemdb_read_combos();
+ itemdb->read_combos();
itemdb->read_groups();
itemdb->read_chains();
itemdb->read_packages();
- sv->readdb(iMap->db_path, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail);
- sv->readdb(iMap->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade);
- sv->readdb(iMap->db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay);
- sv->readdb(iMap->db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack);
- sv->readdb(iMap->db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore);
- sv->readdb(iMap->db_path, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse);
+ sv->readdb(iMap->db_path, "item_avail.txt", ',', 2, 2, -1, itemdb->read_itemavail);
+ sv->readdb(iMap->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, itemdb->read_itemtrade);
+ sv->readdb(iMap->db_path, "item_delay.txt", ',', 2, 2, -1, itemdb->read_itemdelay);
+ sv->readdb(iMap->db_path, "item_stack.txt", ',', 3, 3, -1, itemdb->read_stack);
+ sv->readdb(iMap->db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, itemdb->read_buyingstore);
+ sv->readdb(iMap->db_path, "item_nouse.txt", ',', 3, 3, -1, itemdb->read_nouse);
- itemdb_uid_load();
+ itemdb->uid_load();
}
/*==========================================
@@ -1961,7 +1956,7 @@ static void itemdb_read(void) {
*------------------------------------------*/
/// Destroys the item_data.
-static void destroy_item_data(struct item_data* self, int free_self)
+void destroy_item_data(struct item_data* self, int free_self)
{
if( self == NULL )
return;
@@ -1995,12 +1990,12 @@ static void destroy_item_data(struct item_data* self, int free_self)
/**
* @see DBApply
*/
-static int itemdb_final_sub(DBKey key, DBData *data, va_list ap)
+int itemdb_final_sub(DBKey key, DBData *data, va_list ap)
{
struct item_data *id = DB->data2ptr(data);
- if( id != &dummy_item )
- destroy_item_data(id, 1);
+ if( id != &itemdb->dummy )
+ itemdb->destroy_item_data(id, 1);
return 0;
}
@@ -2012,9 +2007,9 @@ void itemdb_reload(void) {
int i,d,k;
// clear the previous itemdb data
- for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i )
- if( itemdb_array[i] )
- destroy_item_data(itemdb_array[i], 1);
+ for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i )
+ if( itemdb->array[i] )
+ itemdb->destroy_item_data(itemdb->array[i], 1);
for( i = 0; i < itemdb->group_count; i++ ) {
if( itemdb->groups[i].nameid )
@@ -2054,14 +2049,14 @@ void itemdb_reload(void) {
itemdb->packages = NULL;
itemdb->package_count = 0;
- itemdb_other->clear(itemdb_other, itemdb_final_sub);
+ itemdb->other->clear(itemdb->other, itemdb->final_sub);
- memset(itemdb_array, 0, sizeof(itemdb_array));
+ memset(itemdb->array, 0, sizeof(itemdb->array));
db_clear(itemdb->names);
// read new data
- itemdb_read();
+ itemdb->read();
//Epoque's awesome @reloaditemdb fix - thanks! [Ind]
//- Fixes the need of a @reloadmobdb after a @reloaditemdb to re-link monster drop data
@@ -2074,7 +2069,7 @@ void itemdb_reload(void) {
struct item_data *id;
if( !entry->dropitem[d].nameid )
continue;
- id = itemdb_search(entry->dropitem[d].nameid);
+ id = itemdb->search(entry->dropitem[d].nameid);
for (k = 0; k < MAX_SEARCH; k++) {
if (id->mob[k].chance <= entry->dropitem[d].p)
@@ -2132,9 +2127,9 @@ void itemdb_force_name_constants(void) {
void do_final_itemdb(void) {
int i;
- for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i )
- if( itemdb_array[i] )
- destroy_item_data(itemdb_array[i], 1);
+ for( i = 0; i < ARRAYLENGTH(itemdb->array); ++i )
+ if( itemdb->array[i] )
+ itemdb->destroy_item_data(itemdb->array[i], 1);
for( i = 0; i < itemdb->group_count; i++ ) {
if( itemdb->groups[i].nameid )
@@ -2165,26 +2160,25 @@ void do_final_itemdb(void) {
if( itemdb->packages )
aFree(itemdb->packages);
- itemdb_other->destroy(itemdb_other, itemdb_final_sub);
- destroy_item_data(&dummy_item, 0);
+ itemdb->other->destroy(itemdb->other, itemdb->final_sub);
+ itemdb->destroy_item_data(&itemdb->dummy, 0);
db_destroy(itemdb->names);
}
void do_init_itemdb(void) {
- memset(itemdb_array, 0, sizeof(itemdb_array));
- itemdb_other = idb_alloc(DB_OPT_BASE);
+ memset(itemdb->array, 0, sizeof(itemdb->array));
+ itemdb->other = idb_alloc(DB_OPT_BASE);
itemdb->names = strdb_alloc(DB_OPT_BASE,ITEM_NAME_LENGTH);
- create_dummy_data(); //Dummy data item.
- itemdb_read();
+ itemdb->create_dummy_data(); //Dummy data item.
+ itemdb->read();
clif->cashshop_load();
}
-/* incomplete */
void itemdb_defaults(void) {
itemdb = &itemdb_s;
itemdb->init = do_init_itemdb;
itemdb->final = do_final_itemdb;
- itemdb->reload = itemdb_reload;//incomplete
+ itemdb->reload = itemdb_reload;
itemdb->name_constants = itemdb_name_constants;
itemdb->force_name_constants = itemdb_force_name_constants;
/* */
@@ -2199,6 +2193,10 @@ void itemdb_defaults(void) {
/* */
itemdb->names = NULL;
/* */
+ /* itemdb->array is cleared on itemdb->init() */
+ itemdb->other = NULL;
+ memset(&itemdb->dummy, 0, sizeof(struct item_data));
+ /* */
itemdb->read_groups = itemdb_read_groups;
itemdb->read_chains = itemdb_read_chains;
itemdb->read_packages = itemdb_read_packages;
@@ -2212,9 +2210,49 @@ void itemdb_defaults(void) {
itemdb->load = itemdb_load;
itemdb->search = itemdb_search;
itemdb->parse_dbrow = itemdb_parse_dbrow;
- itemdb->exists = itemdb_exists;//incomplete
+ itemdb->exists = itemdb_exists;
itemdb->in_group = itemdb_in_group;
itemdb->group_item = itemdb_searchrandomid;
itemdb->chain_item = itemdb_chain_item;
itemdb->package_item = itemdb_package_item;
+ itemdb->searchname_sub = itemdb_searchname_sub;
+ itemdb->searchname_array_sub = itemdb_searchname_array_sub;
+ itemdb->searchrandomid = itemdb_searchrandomid;
+ itemdb->typename = itemdb_typename;
+ itemdb->jobid2mapid = itemdb_jobid2mapid;
+ itemdb->create_dummy_data = create_dummy_data;
+ itemdb->create_item_data = create_item_data;
+ itemdb->isequip = itemdb_isequip;
+ itemdb->isequip2 = itemdb_isequip2;
+ itemdb->isstackable = itemdb_isstackable;
+ itemdb->isstackable2 = itemdb_isstackable2;
+ itemdb->isdropable_sub = itemdb_isdropable_sub;
+ itemdb->cantrade_sub = itemdb_cantrade_sub;
+ itemdb->canpartnertrade_sub = itemdb_canpartnertrade_sub;
+ itemdb->cansell_sub = itemdb_cansell_sub;
+ itemdb->cancartstore_sub = itemdb_cancartstore_sub;
+ itemdb->canstore_sub = itemdb_canstore_sub;
+ itemdb->canguildstore_sub = itemdb_canguildstore_sub;
+ itemdb->canmail_sub = itemdb_canmail_sub;
+ itemdb->canauction_sub = itemdb_canauction_sub;
+ itemdb->isrestricted = itemdb_isrestricted;
+ itemdb->isidentified = itemdb_isidentified;
+ itemdb->isidentified2 = itemdb_isidentified2;
+ itemdb->read_itemavail = itemdb_read_itemavail;
+ itemdb->read_itemtrade = itemdb_read_itemtrade;
+ itemdb->read_itemdelay = itemdb_read_itemdelay;
+ itemdb->read_stack = itemdb_read_stack;
+ itemdb->read_buyingstore = itemdb_read_buyingstore;
+ itemdb->read_nouse = itemdb_read_nouse;
+ itemdb->combo_split_atoi = itemdb_combo_split_atoi;
+ itemdb->read_combos = itemdb_read_combos;
+ itemdb->gendercheck = itemdb_gendercheck;
+ itemdb->re_split_atoi = itemdb_re_split_atoi;
+ itemdb->readdb = itemdb_readdb;
+ itemdb->read_sqldb = itemdb_read_sqldb;
+ itemdb->unique_id = itemdb_unique_id;
+ itemdb->uid_load = itemdb_uid_load;
+ itemdb->read = itemdb_read;
+ itemdb->destroy_item_data = destroy_item_data;
+ itemdb->final_sub = itemdb_final_sub;
}
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 126ba6334..fe67ebbef 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -240,41 +240,21 @@ struct item_package {
#define itemdb_iscashfood(id) ( (id) >= 12202 && (id) <= 12207 )
#define itemdb_is_GNbomb(n) (n >= 13260 && n <= 13267)
#define itemdb_is_GNthrowable(n) (n >= 13268 && n <= 13290)
-const char* itemdb_typename(int type);
#define itemdb_value_buy(n) itemdb->search(n)->value_buy
#define itemdb_value_sell(n) itemdb->search(n)->value_sell
#define itemdb_canrefine(n) (!itemdb->search(n)->flag.no_refine)
//Item trade restrictions [Skotlex]
-int itemdb_isdropable_sub(struct item_data *, int, int);
-int itemdb_cantrade_sub(struct item_data*, int, int);
-int itemdb_canpartnertrade_sub(struct item_data*, int, int);
-int itemdb_cansell_sub(struct item_data*,int, int);
-int itemdb_cancartstore_sub(struct item_data*, int, int);
-int itemdb_canstore_sub(struct item_data*, int, int);
-int itemdb_canguildstore_sub(struct item_data*, int, int);
-int itemdb_canmail_sub(struct item_data*, int, int);
-int itemdb_canauction_sub(struct item_data*, int, int);
-int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int));
-#define itemdb_isdropable(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_isdropable_sub)
-#define itemdb_cantrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_cantrade_sub)
-#define itemdb_canpartnertrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_canpartnertrade_sub)
-#define itemdb_cansell(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_cansell_sub)
-#define itemdb_cancartstore(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_cancartstore_sub)
-#define itemdb_canstore(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_canstore_sub)
-#define itemdb_canguildstore(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canguildstore_sub)
-#define itemdb_canmail(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canmail_sub)
-#define itemdb_canauction(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canauction_sub)
+#define itemdb_isdropable(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->isdropable_sub)
+#define itemdb_cantrade(item, gmlv, gmlv2) itemdb->isrestricted(item, gmlv, gmlv2, itemdb->cantrade_sub)
+#define itemdb_canpartnertrade(item, gmlv, gmlv2) itemdb->isrestricted(item, gmlv, gmlv2, itemdb->canpartnertrade_sub)
+#define itemdb_cansell(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->cansell_sub)
+#define itemdb_cancartstore(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->cancartstore_sub)
+#define itemdb_canstore(item, gmlv) itemdb->isrestricted(item, gmlv, 0, itemdb->canstore_sub)
+#define itemdb_canguildstore(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canguildstore_sub)
+#define itemdb_canmail(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canmail_sub)
+#define itemdb_canauction(item, gmlv) itemdb->isrestricted(item , gmlv, 0, itemdb->canauction_sub)
-int itemdb_isequip(int);
-int itemdb_isequip2(struct item_data *);
-int itemdb_isidentified(int);
-int itemdb_isidentified2(struct item_data *data);
-int itemdb_isstackable(int);
-int itemdb_isstackable2(struct item_data *);
-uint64 itemdb_unique_id(int8 flag, int64 value); // Unique Item ID
-
-/* incomplete */
struct itemdb_interface {
void (*init) (void);
void (*final) (void);
@@ -294,6 +274,10 @@ struct itemdb_interface {
/* */
DBMap *names;
/* */
+ struct item_data *array[MAX_ITEMDB];
+ DBMap *other;// int nameid -> struct item_data*
+ struct item_data dummy; //This is the default dummy item used for non-existant items. [Skotlex]
+ /* */
void (*read_groups) (void);
void (*read_chains) (void);
void (*read_packages) (void);
@@ -312,6 +296,46 @@ struct itemdb_interface {
int (*group_item) (struct item_group *group);
int (*chain_item) (unsigned short chain_id, int *rate);
void (*package_item) (struct map_session_data *sd, struct item_package *package);
+ int (*searchname_sub) (DBKey key, DBData *data, va_list ap);
+ int (*searchname_array_sub) (DBKey key, DBData data, va_list ap);
+ int (*searchrandomid) (struct item_group *group);
+ const char* (*typename) (int type);
+ void (*jobid2mapid) (unsigned int *bclass, unsigned int jobmask);
+ void (*create_dummy_data) (void);
+ struct item_data* (*create_item_data) (int nameid);
+ int (*isequip) (int nameid);
+ int (*isequip2) (struct item_data *data);
+ int (*isstackable) (int nameid);
+ int (*isstackable2) (struct item_data *data);
+ int (*isdropable_sub) (struct item_data *item, int gmlv, int unused);
+ int (*cantrade_sub) (struct item_data *item, int gmlv, int gmlv2);
+ int (*canpartnertrade_sub) (struct item_data *item, int gmlv, int gmlv2);
+ int (*cansell_sub) (struct item_data *item, int gmlv, int unused);
+ int (*cancartstore_sub) (struct item_data *item, int gmlv, int unused);
+ int (*canstore_sub) (struct item_data *item, int gmlv, int unused);
+ int (*canguildstore_sub) (struct item_data *item, int gmlv, int unused);
+ int (*canmail_sub) (struct item_data *item, int gmlv, int unused);
+ int (*canauction_sub) (struct item_data *item, int gmlv, int unused);
+ int (*isrestricted) (struct item *item, int gmlv, int gmlv2, int(*func)(struct item_data *, int, int));
+ int (*isidentified) (int nameid);
+ int (*isidentified2) (struct item_data *data);
+ bool (*read_itemavail) (char *str[], int columns, int current);
+ bool (*read_itemtrade) (char *str[], int columns, int current);
+ bool (*read_itemdelay) (char *str[], int columns, int current);
+ bool (*read_stack) (char *fields[], int columns, int current);
+ bool (*read_buyingstore) (char *fields[], int columns, int current);
+ bool (*read_nouse) (char *fields[], int columns, int current);
+ int (*combo_split_atoi) (char *str, int *val);
+ void (*read_combos) ();
+ int (*gendercheck) (struct item_data *id);
+ void (*re_split_atoi) (char *str, int *atk, int *matk);
+ int (*readdb) (void);
+ int (*read_sqldb) (void);
+ uint64 (*unique_id) (int8 flag, int64 value);
+ int (*uid_load) ();
+ void (*read) (void);
+ void (*destroy_item_data) (struct item_data *self, int free_self);
+ int (*final_sub) (DBKey key, DBData *data, va_list ap);
};
struct itemdb_interface *itemdb;
diff --git a/src/map/mob.c b/src/map/mob.c
index 3b3ff0797..146f82239 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1786,7 +1786,7 @@ struct item_drop* mob_setdropitem(int nameid, int qty, struct item_data *data) {
memset(&drop->item_data, 0, sizeof(struct item));
drop->item_data.nameid = nameid;
drop->item_data.amount = qty;
- drop->item_data.identify = data ? itemdb_isidentified2(data) : itemdb_isidentified(nameid);
+ drop->item_data.identify = data ? itemdb->isidentified2(data) : itemdb->isidentified(nameid);
drop->next = NULL;
return drop;
}
@@ -2513,7 +2513,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
memset(&item,0,sizeof(item));
item.nameid=mdrop_id[i];
- item.identify= itemdb_isidentified2(data);
+ item.identify= itemdb->isidentified2(data);
clif->mvp_item(mvp_sd,item.nameid);
log_mvp[0] = item.nameid;
diff --git a/src/map/npc.c b/src/map/npc.c
index bb3a4b38e..13a625f07 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -1296,7 +1296,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
if( j == nd->u.shop.count || nd->u.shop.shop_item[j].value <= 0 )
return 5;
- if( !itemdb_isstackable(nameid) && amount > 1 )
+ 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);
amount = item_list[i*2+0] = 1;
@@ -1402,7 +1402,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
if( nd->u.shop.shop_item[i].value <= 0 )
return 5;
- if(!itemdb_isstackable(nameid) && amount > 1)
+ 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);
@@ -1495,7 +1495,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
if( !itemdb->exists(nameid) )
return 3; // item no longer in itemdb
- if( !itemdb_isstackable(nameid) && amount > 1 ) {
+ 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",
sd->status.name, sd->status.account_id, sd->status.char_id, amount, nameid);
@@ -1605,7 +1605,7 @@ int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* item_li
script->setarray_pc(sd, "@sold_nameid", i, (void*)(intptr_t)sd->status.inventory[idx].nameid, &key_nameid);
script->setarray_pc(sd, "@sold_quantity", i, (void*)(intptr_t)item_list[i*2+1], &key_amount);
- if( itemdb_isequip(sd->status.inventory[idx].nameid) )
+ if( itemdb->isequip(sd->status.inventory[idx].nameid) )
{// process equipment based information into the arrays
script->setarray_pc(sd, "@sold_refine", i, (void*)(intptr_t)sd->status.inventory[idx].refine, &key_refine);
script->setarray_pc(sd, "@sold_attribute", i, (void*)(intptr_t)sd->status.inventory[idx].attribute, &key_attribute);
diff --git a/src/map/pc.c b/src/map/pc.c
index dc52c88e1..6399d9f25 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -652,7 +652,7 @@ int pc_equippoint(struct map_session_data *sd,int n)
if(!sd->inventory_data[n])
return 0;
- if (!itemdb_isequip2(sd->inventory_data[n]))
+ if (!itemdb->isequip2(sd->inventory_data[n]))
return 0; //Not equippable by players.
ep = sd->inventory_data[n]->equip;
@@ -3699,7 +3699,7 @@ int pc_checkadditem(struct map_session_data *sd,int nameid,int amount)
data = itemdb->search(nameid);
- if(!itemdb_isstackable2(data))
+ if(!itemdb->isstackable2(data))
return ADDITEM_NEW;
if( data->stack.inventory && amount > data->stack.amount )
@@ -3945,7 +3945,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
i = MAX_INVENTORY;
- if( itemdb_isstackable2(data) && item_data->expire_time == 0 )
+ if( itemdb->isstackable2(data) && item_data->expire_time == 0 )
{ // Stackable | Non Rental
for( i = 0; i < MAX_INVENTORY; i++ )
{
@@ -3976,8 +3976,8 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
clif->additem(sd,i,amount,0);
}
#ifdef NSI_UNIQUE_ID
- if( !itemdb_isstackable2(data) && !item_data->unique_id )
- sd->status.inventory[i].unique_id = itemdb_unique_id(0,0);
+ if( !itemdb->isstackable2(data) && !item_data->unique_id )
+ sd->status.inventory[i].unique_id = itemdb->unique_id(0,0);
#endif
logs->pick_pc(sd, log_type, amount, &sd->status.inventory[i],sd->inventory_data[i]);
@@ -4517,7 +4517,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
return 1;
i = MAX_CART;
- if( itemdb_isstackable2(data) && !item_data->expire_time )
+ if( itemdb->isstackable2(data) && !item_data->expire_time )
{
ARR_FIND( 0, MAX_CART, i,
sd->status.cart[i].nameid == item_data->nameid &&
@@ -4731,7 +4731,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = itemid;
tmp_item.amount = 1;
- tmp_item.identify = itemdb_isidentified2(data);
+ tmp_item.identify = itemdb->isidentified2(data);
flag = pc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER);
//TODO: Should we disable stealing when the item you stole couldn't be added to your inventory? Perhaps players will figure out a way to exploit this behaviour otherwise?
diff --git a/src/map/script.c b/src/map/script.c
index 3ea26694e..efd743d13 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5759,7 +5759,7 @@ BUILDIN(checkweight)
// item is already in inventory, but there is still space for the requested amount
break;
case ADDITEM_NEW:
- if( itemdb_isstackable(nameid) ) {// stackable
+ if( itemdb->isstackable(nameid) ) {// stackable
amount2++;
if( slots < amount2 ) {
script_pushint(st,0);
@@ -5864,7 +5864,7 @@ BUILDIN(checkweight2)
// item is already in inventory, but there is still space for the requested amount
break;
case ADDITEM_NEW:
- if( itemdb_isstackable(nameid) ){// stackable
+ if( itemdb->isstackable(nameid) ){// stackable
amount2++;
if( slots < amount2 )
fail = 1;
@@ -5932,7 +5932,7 @@ BUILDIN(getitem)
if(!flag)
it.identify=1;
else
- it.identify=itemdb_isidentified2(item_data);
+ it.identify=itemdb->isidentified2(item_data);
if( script_hasdata(st,4) )
sd=iMap->id2sd(script_getnum(st,4)); // <Account ID>
@@ -5943,7 +5943,7 @@ BUILDIN(getitem)
return true;
//Check if it's stackable.
- if (!itemdb_isstackable(nameid))
+ if (!itemdb->isstackable(nameid))
get_count = 1;
else
get_count = amount;
@@ -6041,7 +6041,7 @@ BUILDIN(getitem2)
item_tmp.card[3]=(short)c4;
//Check if it's stackable.
- if (!itemdb_isstackable(nameid))
+ if (!itemdb->isstackable(nameid))
get_count = 1;
else
get_count = amount;
@@ -6157,7 +6157,7 @@ BUILDIN(getnameditem)
}else
nameid = script->conv_num(st,data);
- if(!itemdb->exists(nameid)/* || itemdb_isstackable(nameid)*/)
+ if(!itemdb->exists(nameid)/* || itemdb->isstackable(nameid)*/)
{ //Even though named stackable items "could" be risky, they are required for certain quests.
script_pushint(st,0);
return true;
@@ -6275,7 +6275,7 @@ BUILDIN(makeitem)
if(!flag)
item_tmp.identify=1;
else
- item_tmp.identify=itemdb_isidentified2(item_data);
+ item_tmp.identify=itemdb->isidentified2(item_data);
iMap->addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
@@ -13220,7 +13220,7 @@ BUILDIN(autoequip)
return false;
}
- if( !itemdb_isequip2(item_data) )
+ if( !itemdb->isequip2(item_data) )
{
ShowError("buildin_autoequip: Item '%d' cannot be equipped.\n", nameid);
return false;
@@ -17037,9 +17037,9 @@ BUILDIN(getrandgroupitem) {
nameid = itemdb->group_item(data->group);
it.nameid = nameid;
- it.identify = itemdb_isidentified(nameid);
+ it.identify = itemdb->isidentified(nameid);
- if (!itemdb_isstackable(nameid))
+ if (!itemdb->isstackable(nameid))
get_count = 1;
else
get_count = count;
diff --git a/src/map/skill.c b/src/map/skill.c
index ecd672319..ded169677 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -16125,7 +16125,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
}while( j>=0 && x>0 );
}
- if( (equip = (itemdb_isequip(nameid) && skill_id != GN_CHANGEMATERIAL && skill_id != GN_MAKEBOMB )) )
+ if( (equip = (itemdb->isequip(nameid) && skill_id != GN_CHANGEMATERIAL && skill_id != GN_MAKEBOMB )) )
wlv = itemdb_wlv(nameid);
if(!equip) {
switch(skill_id){
diff --git a/src/map/storage.c b/src/map/storage.c
index 81d746cc8..2fe7607c3 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -152,7 +152,7 @@ int storage_additem(struct map_session_data* sd, struct item* item_data, int amo
return 1;
}
- if( itemdb_isstackable2(data) )
+ if( itemdb->isstackable2(data) )
{//Stackable
for( i = 0; i < MAX_STORAGE; i++ )
{
@@ -448,7 +448,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
return 1;
}
- if(itemdb_isstackable2(data)){ //Stackable
+ if(itemdb->isstackable2(data)){ //Stackable
for(i=0;i<MAX_GUILD_STORAGE;i++){
if(compare_item(&stor->items[i], item_data)) {
if( amount > MAX_AMOUNT - stor->items[i].amount || ( data->stack.guildstorage && amount > data->stack.amount - stor->items[i].amount ) )
diff --git a/src/map/trade.c b/src/map/trade.c
index 9bf63c428..3134fa3e4 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -261,7 +261,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
data = itemdb->search(inventory[n].nameid);
i = MAX_INVENTORY;
- if (itemdb_isstackable2(data)) { //Stackable item.
+ if (itemdb->isstackable2(data)) { //Stackable item.
for(i = 0; i < MAX_INVENTORY; i++)
if (inventory2[i].nameid == inventory[n].nameid &&
inventory2[i].card[0] == inventory[n].card[0] && inventory2[i].card[1] == inventory[n].card[1] &&
@@ -292,7 +292,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd)
// search if it's possible to add item (for full inventory)
data = itemdb->search(inventory2[n].nameid);
i = MAX_INVENTORY;
- if (itemdb_isstackable2(data)) {
+ if (itemdb->isstackable2(data)) {
for(i = 0; i < MAX_INVENTORY; i++)
if (inventory[i].nameid == inventory2[n].nameid &&
inventory[i].card[0] == inventory2[n].card[0] && inventory[i].card[1] == inventory2[n].card[1] &&