diff options
-rw-r--r-- | sql-files/logs.sql | 2 | ||||
-rw-r--r-- | sql-files/main.sql | 14 | ||||
-rw-r--r-- | sql-files/upgrades/upgrade_svn17086.sql | 11 | ||||
-rw-r--r-- | src/char/char.c | 24 | ||||
-rw-r--r-- | src/char/int_auction.c | 10 | ||||
-rw-r--r-- | src/char/int_mail.c | 14 | ||||
-rw-r--r-- | src/char/int_storage.c | 8 | ||||
-rw-r--r-- | src/char/inter.h | 4 | ||||
-rw-r--r-- | src/common/mmo.h | 2 | ||||
-rw-r--r-- | src/map/itemdb.c | 8 | ||||
-rw-r--r-- | src/map/itemdb.h | 2 | ||||
-rw-r--r-- | src/map/log.c | 10 | ||||
-rw-r--r-- | src/map/pc.c | 4 |
13 files changed, 62 insertions, 51 deletions
diff --git a/sql-files/logs.sql b/sql-files/logs.sql index 90e8924ca..a281d632e 100644 --- a/sql-files/logs.sql +++ b/sql-files/logs.sql @@ -18,7 +18,7 @@ CREATE TABLE `picklog` ( `card1` int(11) NOT NULL default '0', `card2` int(11) NOT NULL default '0', `card3` int(11) NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', `map` varchar(11) NOT NULL default '', PRIMARY KEY (`id`), INDEX (`type`) diff --git a/sql-files/main.sql b/sql-files/main.sql index f2c574c79..f159260f1 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS `auction` ( `card1` smallint(11) NOT NULL default '0', `card2` smallint(11) NOT NULL default '0', `card3` smallint(11) NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`auction_id`) ) ENGINE=MyISAM; @@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS `cart_inventory` ( `card2` smallint(11) NOT NULL default '0', `card3` smallint(11) NOT NULL default '0', `expire_time` int(11) unsigned NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `char_id` (`char_id`) ) ENGINE=MyISAM; @@ -343,7 +343,7 @@ CREATE TABLE IF NOT EXISTS `guild_storage` ( `card2` smallint(11) NOT NULL default '0', `card3` smallint(11) NOT NULL default '0', `expire_time` int(11) unsigned NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `guild_id` (`guild_id`) ) ENGINE=MyISAM; @@ -407,7 +407,7 @@ CREATE TABLE IF NOT EXISTS `inventory` ( `card3` smallint(11) NOT NULL default '0', `expire_time` int(11) unsigned NOT NULL default '0', `favorite` tinyint(3) unsigned NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `char_id` (`char_id`) ) ENGINE=MyISAM; @@ -504,7 +504,7 @@ CREATE TABLE IF NOT EXISTS `mail` ( `card1` smallint(11) NOT NULL default '0', `card2` smallint(11) NOT NULL default '0', `card3` smallint(11) NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM; @@ -666,7 +666,7 @@ CREATE TABLE IF NOT EXISTS `storage` ( `card2` smallint(11) NOT NULL default '0', `card3` smallint(11) NOT NULL default '0', `expire_time` int(11) unsigned NOT NULL default '0', - `nsiuid` bigint(20) unsigned NOT NULL default '0', + `unique_id` bigint(20) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `account_id` (`account_id`) ) ENGINE=MyISAM; @@ -677,4 +677,4 @@ CREATE TABLE IF NOT EXISTS `interreg` ( PRIMARY KEY (`varname`) ) ENGINE=InnoDB; INSERT INTO `interreg` (`varname`, `value`) VALUES -('nsiuid', '0'); +('unique_id', '0'); diff --git a/sql-files/upgrades/upgrade_svn17086.sql b/sql-files/upgrades/upgrade_svn17086.sql new file mode 100644 index 000000000..b61511b98 --- /dev/null +++ b/sql-files/upgrades/upgrade_svn17086.sql @@ -0,0 +1,11 @@ +UPDATE `interreg` SET `varname` = 'unique_id' WHERE `interreg`.`varname` = 'nsiuid';
+
+
+ALTER TABLE `auction` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
+ALTER TABLE `cart_inventory` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
+ALTER TABLE `guild_storage` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
+ALTER TABLE `inventory` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
+ALTER TABLE `mail` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
+ALTER TABLE `storage` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
+
+ALTER TABLE `picklog` CHANGE `nsiuid` `unique_id` BIGINT( 20 ) NOT NULL DEFAULT '0';
\ No newline at end of file diff --git a/src/char/char.c b/src/char/char.c index 1aa6ee734..8bf2dee38 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -811,7 +811,7 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit SqlStmt_Free(stmt); StringBuf_Clear(&buf); - StringBuf_Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `nsiuid`", tablename, selectoption); + StringBuf_Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `unique_id`", tablename, selectoption); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ", `card%d`", j); StringBuf_AppendStr(&buf, ") VALUES "); @@ -830,12 +830,12 @@ int memitemdata_to_sql(const struct item items[], int max, int id, int tableswit found = true; StringBuf_Printf(&buf, "('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u', '%"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].nsiuid); + 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].unique_id); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ", '%d'", items[i].card[j]); StringBuf_AppendStr(&buf, ")"); - updateLastUid(items[i].nsiuid); // Unique Non Stackable Item ID + updateLastUid(items[i].unique_id); // Unique Non Stackable Item ID } dbUpdateUid(sql_handle); // Unique Non Stackable Item ID @@ -951,7 +951,7 @@ int inventory_to_sql(const struct item items[], int max, int id) { SqlStmt_Free(stmt); StringBuf_Clear(&buf); - StringBuf_Printf(&buf, "INSERT INTO `%s` (`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `nsiuid`", inventory_db); + StringBuf_Printf(&buf, "INSERT INTO `%s` (`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `unique_id`", inventory_db); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ", `card%d`", j); StringBuf_AppendStr(&buf, ") VALUES "); @@ -969,12 +969,12 @@ int inventory_to_sql(const struct item items[], int max, int id) { found = true; StringBuf_Printf(&buf, "('%d', '%d', '%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].favorite, items[i].nsiuid); + 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].unique_id); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ", '%d'", items[i].card[j]); StringBuf_AppendStr(&buf, ")"); - updateLastUid(items[i].nsiuid);// Unique Non Stackable Item ID + updateLastUid(items[i].unique_id);// Unique Non Stackable Item ID } dbUpdateUid(sql_handle); @@ -1209,9 +1209,9 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything strcat(t_msg, " memo"); //read inventory - //`inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `expire_time`, `favorite`, `nsiuid`) + //`inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `expire_time`, `favorite`, `unique_id`) StringBuf_Init(&buf); - StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `nsiuid`"); + StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `favorite`, `unique_id`"); for( i = 0; i < MAX_SLOTS; ++i ) StringBuf_Printf(&buf, ", `card%d`", i); StringBuf_Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", inventory_db, MAX_INVENTORY); @@ -1228,7 +1228,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &tmp_item.favorite, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &tmp_item.nsiuid, 0, NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) ) SqlStmt_ShowDebug(stmt); for( i = 0; i < MAX_SLOTS; ++i ) if( SQL_ERROR == SqlStmt_BindColumn(stmt, 10+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) ) @@ -1240,9 +1240,9 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything strcat(t_msg, " inventory"); //read cart - //`cart_inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, expire_time`, `nsiuid`) + //`cart_inventory` (`id`,`char_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, expire_time`, `unique_id`) StringBuf_Clear(&buf); - StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `nsiuid`"); + StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `unique_id`"); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ", `card%d`", j); StringBuf_Printf(&buf, " FROM `%s` WHERE `char_id`=? LIMIT %d", cart_db, MAX_CART); @@ -1258,7 +1258,7 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything || SQL_ERROR == SqlStmt_BindColumn(stmt, 5, SQLDT_CHAR, &tmp_item.refine, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 6, SQLDT_CHAR, &tmp_item.attribute, 0, NULL, NULL) || SQL_ERROR == SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &tmp_item.expire_time, 0, NULL, NULL) - || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_ULONGLONG, &tmp_item.nsiuid, 0, NULL, NULL) ) + || SQL_ERROR == SqlStmt_BindColumn(stmt, 8, SQLDT_ULONGLONG, &tmp_item.unique_id, 0, NULL, NULL) ) SqlStmt_ShowDebug(stmt); for( i = 0; i < MAX_SLOTS; ++i ) if( SQL_ERROR == SqlStmt_BindColumn(stmt, 9+i, SQLDT_SHORT, &tmp_item.card[i], 0, NULL, NULL) ) diff --git a/src/char/int_auction.c b/src/char/int_auction.c index e0373c936..34aed5bf7 100644 --- a/src/char/int_auction.c +++ b/src/char/int_auction.c @@ -81,17 +81,17 @@ unsigned int auction_create(struct auction_data *auction) auction->timestamp = time(NULL) + (auction->hours * 3600); StringBuf_Init(&buf); - StringBuf_Printf(&buf, "INSERT INTO `%s` (`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`nsiuid`", auction_db); + 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`", 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"'", - 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.nsiuid); + 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]); StringBuf_AppendStr(&buf, ")"); //Unique Non Stackable Item ID - updateLastUid(auction->item.nsiuid); + updateLastUid(auction->item.unique_id); dbUpdateUid(sql_handle); stmt = SqlStmt_Malloc(sql_handle); @@ -186,7 +186,7 @@ void inter_auctions_fromsql(void) StringBuf_Init(&buf); StringBuf_AppendStr(&buf, "SELECT `auction_id`,`seller_id`,`seller_name`,`buyer_id`,`buyer_name`," - "`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`nsiuid`"); + "`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`unique_id`"); for( i = 0; i < MAX_SLOTS; i++ ) StringBuf_Printf(&buf, ",`card%d`", i); StringBuf_Printf(&buf, " FROM `%s` ORDER BY `auction_id` DESC", auction_db); @@ -216,7 +216,7 @@ void inter_auctions_fromsql(void) Sql_GetData(sql_handle,12, &data, NULL); item->refine = atoi(data); Sql_GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data); - Sql_GetData(sql_handle,14, &data, NULL); item->nsiuid = strtoull(data, NULL, 10); + Sql_GetData(sql_handle,14, &data, NULL); item->unique_id = strtoull(data, NULL, 10); item->identify = 1; item->amount = 1; diff --git a/src/char/int_mail.c b/src/char/int_mail.c index f327bb8a3..8d50c713f 100644 --- a/src/char/int_mail.c +++ b/src/char/int_mail.c @@ -29,7 +29,7 @@ static int mail_fromsql(int char_id, struct mail_data* md) StringBuf_Init(&buf); StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`," - "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`,`nsiuid`"); + "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`,`unique_id`"); for (i = 0; i < MAX_SLOTS; i++) StringBuf_Printf(&buf, ",`card%d`", i); @@ -61,7 +61,7 @@ static int mail_fromsql(int char_id, struct mail_data* md) Sql_GetData(sql_handle,12, &data, NULL); item->refine = atoi(data); Sql_GetData(sql_handle,13, &data, NULL); item->attribute = atoi(data); Sql_GetData(sql_handle,14, &data, NULL); item->identify = atoi(data); - Sql_GetData(sql_handle,15, &data, NULL); item->nsiuid = strtoull(data, NULL, 10); + Sql_GetData(sql_handle,15, &data, NULL); item->unique_id = strtoull(data, NULL, 10); item->expire_time = 0; for (j = 0; j < MAX_SLOTS; j++) @@ -107,17 +107,17 @@ int mail_savemessage(struct mail_message* msg) // build message save query StringBuf_Init(&buf); - StringBuf_Printf(&buf, "INSERT INTO `%s` (`send_name`, `send_id`, `dest_name`, `dest_id`, `title`, `message`, `time`, `status`, `zeny`, `amount`, `nameid`, `refine`, `attribute`, `identify`, `nsiuid`", mail_db); + 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`", 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"'", - 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.nsiuid); + 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]); StringBuf_AppendStr(&buf, ")"); //Unique Non Stackable Item ID - updateLastUid(msg->item.nsiuid); + updateLastUid(msg->item.unique_id); dbUpdateUid(sql_handle); // prepare and execute query @@ -149,7 +149,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg) StringBuf_Init(&buf); StringBuf_AppendStr(&buf, "SELECT `id`,`send_name`,`send_id`,`dest_name`,`dest_id`,`title`,`message`,`time`,`status`," - "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`,`nsiuid`"); + "`zeny`,`amount`,`nameid`,`refine`,`attribute`,`identify`,`unique_id`"); for( j = 0; j < MAX_SLOTS; j++ ) StringBuf_Printf(&buf, ",`card%d`", j); StringBuf_Printf(&buf, " FROM `%s` WHERE `id` = '%d'", mail_db, mail_id); @@ -181,7 +181,7 @@ static bool mail_loadmessage(int mail_id, struct mail_message* msg) Sql_GetData(sql_handle,12, &data, NULL); msg->item.refine = atoi(data); Sql_GetData(sql_handle,13, &data, NULL); msg->item.attribute = atoi(data); Sql_GetData(sql_handle,14, &data, NULL); msg->item.identify = atoi(data); - Sql_GetData(sql_handle,15, &data, NULL); msg->item.nsiuid = strtoull(data, NULL, 10); + Sql_GetData(sql_handle,15, &data, NULL); msg->item.unique_id = strtoull(data, NULL, 10); msg->item.expire_time = 0; for( j = 0; j < MAX_SLOTS; j++ ) diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 23189916f..68b588087 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -38,7 +38,7 @@ int storage_fromsql(int account_id, struct storage_data* p) // storage {`account_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`} StringBuf_Init(&buf); - StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`expire_time`,`nsiuid`"); + StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`expire_time`,`unique_id`"); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ",`card%d`", j); StringBuf_Printf(&buf, " FROM `%s` WHERE `account_id`='%d' ORDER BY `nameid`", storage_db, account_id); @@ -59,7 +59,7 @@ int storage_fromsql(int account_id, struct storage_data* p) Sql_GetData(sql_handle, 5, &data, NULL); item->refine = atoi(data); Sql_GetData(sql_handle, 6, &data, NULL); item->attribute = atoi(data); Sql_GetData(sql_handle, 7, &data, NULL); item->expire_time = (unsigned int)atoi(data); - Sql_GetData(sql_handle, 8, &data, NULL); item->nsiuid = strtoull(data, NULL, 10); + Sql_GetData(sql_handle, 8, &data, NULL); item->unique_id = strtoull(data, NULL, 10); for( j = 0; j < MAX_SLOTS; ++j ) { Sql_GetData(sql_handle, 9+j, &data, NULL); item->card[j] = atoi(data); @@ -95,7 +95,7 @@ int guild_storage_fromsql(int guild_id, struct guild_storage* p) // storage {`guild_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`} StringBuf_Init(&buf); - StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`nsiuid`"); + StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`unique_id`"); for( j = 0; j < MAX_SLOTS; ++j ) StringBuf_Printf(&buf, ",`card%d`", j); StringBuf_Printf(&buf, " FROM `%s` WHERE `guild_id`='%d' ORDER BY `nameid`", guild_storage_db, guild_id); @@ -115,7 +115,7 @@ int guild_storage_fromsql(int guild_id, struct guild_storage* p) Sql_GetData(sql_handle, 4, &data, NULL); item->identify = atoi(data); Sql_GetData(sql_handle, 5, &data, NULL); item->refine = atoi(data); Sql_GetData(sql_handle, 6, &data, NULL); item->attribute = atoi(data); - Sql_GetData(sql_handle, 7, &data, NULL); item->nsiuid = strtoull(data, NULL, 10); + Sql_GetData(sql_handle, 7, &data, NULL); item->unique_id = strtoull(data, NULL, 10); item->expire_time = 0; for( j = 0; j < MAX_SLOTS; ++j ) { diff --git a/src/char/inter.h b/src/char/inter.h index e5bfa1572..7ea9cf25c 100644 --- a/src/char/inter.h +++ b/src/char/inter.h @@ -32,8 +32,8 @@ uint64 inter_chk_lastuid(int8 flag, uint64 value); #define updateLastUid(val_) inter_chk_lastuid(1, val_) #define dbUpdateUid(handler_)\ { \ - uint64 nsiuid_ = inter_chk_lastuid(0, 0); \ - if (nsiuid_ && SQL_ERROR == Sql_Query(handler_, "UPDATE `interreg` SET `value`='%"PRIu64"' WHERE `varname`='nsiuid'", nsiuid_)) \ + uint64 unique_id_ = inter_chk_lastuid(0, 0); \ + if (unique_id_ && SQL_ERROR == Sql_Query(handler_, "UPDATE `interreg` SET `value`='%"PRIu64"' WHERE `varname`='unique_id'", unique_id_)) \ Sql_ShowDebug(handler_);\ } #else diff --git a/src/common/mmo.h b/src/common/mmo.h index e83967404..493f87691 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -201,7 +201,7 @@ struct item { short card[MAX_SLOTS]; unsigned int expire_time; char favorite; - uint64 nsiuid; + uint64 unique_id; }; struct point { diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 810e85a4a..68baae1e1 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1261,7 +1261,7 @@ static int itemdb_read_sqldb(void) { * 2 set new value bypassing anything * 3/other return last value *------------------------------------------*/ -uint64 itemdb_nsiuid(int8 flag, int64 value) { +uint64 itemdb_unique_id(int8 flag, int64 value) { static uint64 item_uid = 0; if(flag) @@ -1280,18 +1280,18 @@ uint64 itemdb_nsiuid(int8 flag, int64 value) { int itemdb_uid_load(){ char * uid; - if (SQL_ERROR == Sql_Query(mmysql_handle, "SELECT `value` FROM `interreg` WHERE `varname`='nsiuid'")) + if (SQL_ERROR == Sql_Query(mmysql_handle, "SELECT `value` FROM `interreg` WHERE `varname`='unique_id'")) Sql_ShowDebug(mmysql_handle); if( SQL_SUCCESS != Sql_NextRow(mmysql_handle) ) { - ShowError("itemdb_uid_load: Unable to fetch nsiuid data\n"); + ShowError("itemdb_uid_load: Unable to fetch unique_id data\n"); Sql_FreeResult(mmysql_handle); return -1; } Sql_GetData(mmysql_handle, 0, &uid, NULL); - itemdb_nsiuid(1, (uint64)strtoull(uid, NULL, 10)); + itemdb_unique_id(1, (uint64)strtoull(uid, NULL, 10)); Sql_FreeResult(mmysql_handle); return 0; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index e8c6d6487..e308b248b 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -219,7 +219,7 @@ int itemdb_isequip2(struct item_data *); int itemdb_isidentified(int); int itemdb_isstackable(int); int itemdb_isstackable2(struct item_data *); -uint64 itemdb_nsiuid(int8 flag, int64 value); // Unique Item ID +uint64 itemdb_unique_id(int8 flag, int64 value); // Unique Item ID void itemdb_reload(void); diff --git a/src/map/log.c b/src/map/log.c index 9d50be62a..ca10c97ab 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -188,12 +188,12 @@ 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`, `nsiuid`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%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->nsiuid); + 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"')", + 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`, `nsiuid`) VALUES (NOW(), '%d', '%c', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%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->nsiuid) ) + 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"')", + 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); return; @@ -210,7 +210,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->nsiuid); + 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); fclose(logfp); } } diff --git a/src/map/pc.c b/src/map/pc.c index 5c839385b..f06d48779 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3837,8 +3837,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->nsiuid ) - sd->status.inventory[i].nsiuid = itemdb_nsiuid(0,0); + if( !itemdb_isstackable2(data) && !item_data->unique_id ) + sd->status.inventory[i].unique_id = itemdb_unique_id(0,0); #endif log_pick_pc(sd, log_type, amount, &sd->status.inventory[i]); |