summaryrefslogtreecommitdiff
path: root/src/plugins/db2sql.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/db2sql.c')
-rw-r--r--src/plugins/db2sql.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c
index ebd2a9ee5..d769a601e 100644
--- a/src/plugins/db2sql.c
+++ b/src/plugins/db2sql.c
@@ -49,17 +49,17 @@ int db2sql(char** str, const char* source, int line, int scriptopt) {
struct item_data *it = NULL;
unsigned char offset = 0;
#ifdef RENEWAL
- if( iMap->db_use_sql_item_db ) offset = 1;
-#endif
+ if( map->db_use_sql_item_db ) offset = 1;
+#endif // RENEWAL
if( (it = itemdb->exists(parse_dbrow(str,source,line,scriptopt))) ) {
/* renewal has the 'matk' and 'equip_level' is now 'equip_level_min', and there is a new 'equip_level_max' field */
#ifdef RENEWAL
- if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "REPLACE INTO `%s` (`id`,`name_english`,`name_japanese`,`type`,`price_buy`,`price_sell`,`weight`,`atk`,`matk`,`defence`,`range`,`slots`,`equip_jobs`,`equip_upper`,`equip_genders`,`equip_locations`,`weapon_level`,`equip_level_min`,`equip_level_max`,`refineable`,`view`,`script`,`equip_script`,`unequip_script`) VALUES ('%u',?,?,'%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u',?,?,?)",iMap->item_db_re_db,
- it->nameid,it->flag.delay_consume?IT_DELAYCONSUME:it->type,it->value_buy,it->value_sell,it->weight,it->atk,it->matk,it->def,it->range,it->slot,(unsigned int)strtoul(str[11+offset],NULL,0),atoi(str[12+offset]),atoi(str[13+offset]),atoi(str[14+offset]),it->wlv,it->elv,it->elvmax,atoi(str[17+offset]),it->look) )
-#else
- if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "REPLACE INTO `%s` (`id`,`name_english`,`name_japanese`,`type`,`price_buy`,`price_sell`,`weight`,`atk`,`defence`,`range`,`slots`,`equip_jobs`,`equip_upper`,`equip_genders`,`equip_locations`,`weapon_level`,`equip_level`,`refineable`,`view`,`script`,`equip_script`,`unequip_script`) VALUES ('%u',?,?,'%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u',?,?,?)",iMap->item_db_db,
- it->nameid,it->flag.delay_consume?IT_DELAYCONSUME:it->type,it->value_buy,it->value_sell,it->weight,it->atk,it->def,it->range,it->slot,(unsigned int)strtoul(str[11],NULL,0),atoi(str[12]),atoi(str[13]),atoi(str[14]),it->wlv,it->elv,atoi(str[17]),it->look) )
-#endif
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "REPLACE INTO `%s` (`id`,`name_english`,`name_japanese`,`type`,`price_buy`,`price_sell`,`weight`,`atk`,`matk`,`defence`,`range`,`slots`,`equip_jobs`,`equip_upper`,`equip_genders`,`equip_locations`,`weapon_level`,`equip_level_min`,`equip_level_max`,`refineable`,`view`,`script`,`equip_script`,`unequip_script`) VALUES ('%u',?,?,'%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u',?,?,?)",map->item_db_re_db,
+ it->nameid,it->flag.delay_consume?IT_DELAYCONSUME:it->type,it->value_buy,it->value_sell,it->weight,it->atk,it->matk,it->def,it->range,it->slot,(unsigned int)strtoul(str[11+offset],NULL,0),atoi(str[12+offset]),atoi(str[13+offset]),atoi(str[14+offset]),it->wlv,it->elv,it->elvmax,atoi(str[17+offset]),it->look) )
+#else // not RENEWAL
+ if( SQL_SUCCESS != SQL->StmtPrepare(stmt, "REPLACE INTO `%s` (`id`,`name_english`,`name_japanese`,`type`,`price_buy`,`price_sell`,`weight`,`atk`,`defence`,`range`,`slots`,`equip_jobs`,`equip_upper`,`equip_genders`,`equip_locations`,`weapon_level`,`equip_level`,`refineable`,`view`,`script`,`equip_script`,`unequip_script`) VALUES ('%u',?,?,'%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u','%u',?,?,?)",map->item_db_db,
+ it->nameid,it->flag.delay_consume?IT_DELAYCONSUME:it->type,it->value_buy,it->value_sell,it->weight,it->atk,it->def,it->range,it->slot,(unsigned int)strtoul(str[11],NULL,0),atoi(str[12]),atoi(str[13]),atoi(str[14]),it->wlv,it->elv,atoi(str[17]),it->look) )
+#endif // RENEWAL
SqlStmt_ShowDebug(stmt);
else {
if ( SQL_SUCCESS != SQL->StmtBindParam(stmt, 0, SQLDT_STRING, it->name, strlen(it->name)) )
@@ -68,9 +68,9 @@ int db2sql(char** str, const char* source, int line, int scriptopt) {
if ( SQL_SUCCESS != SQL->StmtBindParam(stmt, 1, SQLDT_STRING, it->jname, strlen(it->jname)) )
SqlStmt_ShowDebug(stmt);
else {
- #ifdef RENEWAL
- if( iMap->db_use_sql_item_db ) offset += 1;
- #endif
+#ifdef RENEWAL
+ if( map->db_use_sql_item_db ) offset += 1;
+#endif // RENEWAL
if( it->script ) trimbraces(str[19+offset]);
if ( SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, it->script?str[19+offset]:"", it->script?strlen(str[19+offset]):0) )
SqlStmt_ShowDebug(stmt);
@@ -98,7 +98,7 @@ int db2sql(char** str, const char* source, int line, int scriptopt) {
CPCMD(db2sql) {
- if( iMap->db_use_sql_item_db ) {
+ if( map->db_use_sql_item_db ) {
ShowInfo("db2sql: this should not be used with 'db_use_sql_item_db' enabled, skipping...\n");
return;
}
@@ -114,10 +114,10 @@ CPCMD(db2sql) {
itemdb->parse_dbrow = db2sql;
/* empty table */
#ifdef RENEWAL
- if ( SQL_ERROR == SQL->Query(mysql_handle, "DELETE FROM `%s`", iMap->item_db_re_db ) )
-#else
- if ( SQL_ERROR == SQL->Query(mysql_handle, "DELETE FROM `%s`", iMap->item_db_db) )
-#endif
+ if ( SQL_ERROR == SQL->Query(mysql_handle, "DELETE FROM `%s`", map->item_db_re_db ) )
+#else // not RENEWAL
+ if ( SQL_ERROR == SQL->Query(mysql_handle, "DELETE FROM `%s`", map->item_db_db) )
+#endif // RENEWAL
Sql_ShowDebug(mysql_handle);
else {
itemdb->reload();
@@ -131,7 +131,7 @@ CPCMD(db2sql) {
HPExport void plugin_init (void) {
SQL = GET_SYMBOL("SQL");
itemdb = GET_SYMBOL("itemdb");
- iMap = GET_SYMBOL("iMap");
+ map = GET_SYMBOL("map");
strlib = GET_SYMBOL("strlib");
HPMi->addCPCommand("server:tools:db2sql",CPCMD_A(db2sql));