|
@@ -560,7 +560,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
|
|
|
// it significantly reduces cpu load on the database server.
|
|
|
|
|
|
StringBuf_Init(&buf);
|
|
|
- StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`");
|
|
|
+ StringBuf_AppendStr(&buf, "SELECT `id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`, `enchantgrade`");
|
|
|
if (tableswitch == TABLE_INVENTORY) {
|
|
|
StringBuf_Printf(&buf, ", `favorite`, `equip_switch`");
|
|
|
offset = 2;
|
|
@@ -586,7 +586,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
|
|
|
}
|
|
|
|
|
|
SqlStmt_BindColumn(stmt, 0, SQLDT_INT, &item.id, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &item.nameid, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 1, SQLDT_UINT, &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);
|
|
@@ -595,16 +595,17 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
|
|
|
SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
|
|
|
SqlStmt_BindColumn(stmt, 8, SQLDT_UINT, &item.bound, 0, NULL, NULL);
|
|
|
SqlStmt_BindColumn(stmt, 9, SQLDT_UINT64, &item.unique_id, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt,10, SQLDT_INT8, &item.enchantgrade,0, NULL, NULL);
|
|
|
if (tableswitch == TABLE_INVENTORY){
|
|
|
- SqlStmt_BindColumn(stmt, 10, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 11, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 11, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 12, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
|
|
|
}
|
|
|
for( i = 0; i < MAX_SLOTS; ++i )
|
|
|
- SqlStmt_BindColumn(stmt, 10+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 11+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL);
|
|
|
for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) {
|
|
|
- SqlStmt_BindColumn(stmt, 10+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 13+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, NULL, NULL);
|
|
|
}
|
|
|
// bit array indicating which inventory items have already been matched
|
|
|
flag = (bool*) aCalloc(max, sizeof(bool));
|
|
@@ -639,14 +640,15 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
|
|
|
items[i].attribute == item.attribute &&
|
|
|
items[i].expire_time == item.expire_time &&
|
|
|
items[i].bound == item.bound &&
|
|
|
+ items[i].enchantgrade == item.enchantgrade &&
|
|
|
(tableswitch != TABLE_INVENTORY || (items[i].favorite == item.favorite && items[i].equipSwitch == item.equipSwitch)) )
|
|
|
; //Do nothing.
|
|
|
else
|
|
|
{
|
|
|
// update all fields.
|
|
|
StringBuf_Clear(&buf);
|
|
|
- StringBuf_Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d', `unique_id`='%" PRIu64 "'",
|
|
|
- tablename, 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);
|
|
|
+ StringBuf_Printf(&buf, "UPDATE `%s` SET `amount`='%d', `equip`='%u', `identify`='%d', `refine`='%d',`attribute`='%d', `expire_time`='%u', `bound`='%d', `unique_id`='%" PRIu64 "', `enchantgrade`='%d'",
|
|
|
+ tablename, 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, items[i].enchantgrade);
|
|
|
if (tableswitch == TABLE_INVENTORY)
|
|
|
StringBuf_Printf(&buf, ", `favorite`='%d', `equip_switch`='%u'", items[i].favorite, items[i].equipSwitch);
|
|
|
for( j = 0; j < MAX_SLOTS; ++j )
|
|
@@ -681,7 +683,7 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
|
|
|
SqlStmt_Free(stmt);
|
|
|
|
|
|
StringBuf_Clear(&buf);
|
|
|
- StringBuf_Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`", tablename, selectoption);
|
|
|
+ StringBuf_Printf(&buf, "INSERT INTO `%s`(`%s`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `expire_time`, `bound`, `unique_id`, `enchantgrade`", tablename, selectoption);
|
|
|
if (tableswitch == TABLE_INVENTORY)
|
|
|
StringBuf_Printf(&buf, ", `favorite`, `equip_switch`");
|
|
|
for( j = 0; j < MAX_SLOTS; ++j )
|
|
@@ -706,8 +708,8 @@ int char_memitemdata_to_sql(const struct item items[], int max, int id, enum sto
|
|
|
else
|
|
|
found = true;
|
|
|
|
|
|
- StringBuf_Printf(&buf, "('%d', '%u', '%d', '%u', '%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);
|
|
|
+ StringBuf_Printf(&buf, "('%d', '%u', '%d', '%u', '%d', '%d', '%d', '%u', '%d', '%" PRIu64 "', '%d'",
|
|
|
+ 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, items[i].enchantgrade);
|
|
|
if (tableswitch == TABLE_INVENTORY)
|
|
|
StringBuf_Printf(&buf, ", '%d', '%u'", items[i].favorite, items[i].equipSwitch);
|
|
|
for( j = 0; j < MAX_SLOTS; ++j )
|
|
@@ -787,7 +789,7 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag
|
|
|
}
|
|
|
|
|
|
StringBuf_Init(&buf);
|
|
|
- StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`expire_time`,`bound`,`unique_id`");
|
|
|
+ StringBuf_AppendStr(&buf, "SELECT `id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`expire_time`,`bound`,`unique_id`,`enchantgrade`");
|
|
|
if (tableswitch == TABLE_INVENTORY) {
|
|
|
StringBuf_Printf(&buf, ", `favorite`, `equip_switch`");
|
|
|
offset = 2;
|
|
@@ -821,16 +823,17 @@ bool char_memitemdata_from_sql(struct s_storage* p, int max, int id, enum storag
|
|
|
SqlStmt_BindColumn(stmt, 7, SQLDT_UINT, &item.expire_time, 0, NULL, NULL);
|
|
|
SqlStmt_BindColumn(stmt, 8, SQLDT_CHAR, &item.bound, 0, NULL, NULL);
|
|
|
SqlStmt_BindColumn(stmt, 9, SQLDT_ULONGLONG, &item.unique_id, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt,10, SQLDT_INT8, &item.enchantgrade, 0, NULL, NULL);
|
|
|
if (tableswitch == TABLE_INVENTORY){
|
|
|
- SqlStmt_BindColumn(stmt, 10, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 11, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 11, SQLDT_CHAR, &item.favorite, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 12, SQLDT_UINT, &item.equipSwitch, 0, NULL, NULL);
|
|
|
}
|
|
|
for( i = 0; i < MAX_SLOTS; ++i )
|
|
|
- SqlStmt_BindColumn(stmt, 10+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 11+offset+i, SQLDT_UINT, &item.card[i], 0, NULL, NULL);
|
|
|
for( i = 0; i < MAX_ITEM_RDM_OPT; ++i ) {
|
|
|
- SqlStmt_BindColumn(stmt, 10+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
|
|
|
- SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 11+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].id, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 12+offset+MAX_SLOTS+i*3, SQLDT_SHORT, &item.option[i].value, 0, NULL, NULL);
|
|
|
+ SqlStmt_BindColumn(stmt, 13+offset+MAX_SLOTS+i*3, SQLDT_CHAR, &item.option[i].param, 0, NULL, NULL);
|
|
|
}
|
|
|
|
|
|
for( i = 0; i < max && SQL_SUCCESS == SqlStmt_NextRow(stmt); ++i )
|
|
@@ -2439,7 +2442,7 @@ bool char_checkdb(void){
|
|
|
}
|
|
|
//checking mail_attachment_db
|
|
|
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `id`,`index`,`nameid`,`amount`,`refine`,`attribute`,`identify`,"
|
|
|
- "`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`unique_id`, `bound`"
|
|
|
+ "`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`unique_id`, `bound`, `enchantgrade`"
|
|
|
" FROM `%s` LIMIT 1;", schema_config.mail_attachment_db) ){
|
|
|
Sql_ShowDebug(sql_handle);
|
|
|
return false;
|
|
@@ -2448,7 +2451,7 @@ bool char_checkdb(void){
|
|
|
//checking auction_db
|
|
|
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `auction_id`,`seller_id`,`seller_name`,`buyer_id`,`buyer_name`,"
|
|
|
"`price`,`buynow`,`hours`,`timestamp`,`nameid`,`item_name`,`type`,`refine`,`attribute`,`card0`,`card1`,"
|
|
|
- "`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`unique_id` "
|
|
|
+ "`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`unique_id`, `enchantgrade` "
|
|
|
"FROM `%s` LIMIT 1;", schema_config.auction_db) ){
|
|
|
Sql_ShowDebug(sql_handle);
|
|
|
return false;
|
|
@@ -2501,14 +2504,14 @@ bool char_checkdb(void){
|
|
|
}
|
|
|
//checking cart_db
|
|
|
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `id`,`char_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,"
|
|
|
- "`attribute`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`expire_time`,`bound`,`unique_id`"
|
|
|
+ "`attribute`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`expire_time`,`bound`,`unique_id`,`enchantgrade`"
|
|
|
" FROM `%s` LIMIT 1;", schema_config.cart_db) ){
|
|
|
Sql_ShowDebug(sql_handle);
|
|
|
return false;
|
|
|
}
|
|
|
//checking inventory_db
|
|
|
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `id`,`char_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,"
|
|
|
- "`attribute`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`expire_time`,`bound`,`unique_id`"
|
|
|
+ "`attribute`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`expire_time`,`bound`,`unique_id`,`enchantgrade`"
|
|
|
",`favorite`,`equip_switch`"
|
|
|
" FROM `%s` LIMIT 1;", schema_config.inventory_db) ){
|
|
|
Sql_ShowDebug(sql_handle);
|
|
@@ -2516,7 +2519,7 @@ bool char_checkdb(void){
|
|
|
}
|
|
|
//checking guild_storage_db
|
|
|
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `id`,`guild_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,"
|
|
|
- "`attribute`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`expire_time`,`bound`,`unique_id`"
|
|
|
+ "`attribute`,`card0`,`card1`,`card2`,`card3`,`option_id0`,`option_val0`,`option_parm0`,`option_id1`,`option_val1`,`option_parm1`,`option_id2`,`option_val2`,`option_parm2`,`option_id3`,`option_val3`,`option_parm3`,`option_id4`,`option_val4`,`option_parm4`,`expire_time`,`bound`,`unique_id`,`enchantgrade`"
|
|
|
" FROM `%s` LIMIT 1;", schema_config.guild_storage_db) ){
|
|
|
Sql_ShowDebug(sql_handle);
|
|
|
return false;
|