diff options
Diffstat (limited to 'src/char/int_mercenary.c')
-rw-r--r-- | src/char/int_mercenary.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/char/int_mercenary.c b/src/char/int_mercenary.c index 3fd01b3f6..0e91b6785 100644 --- a/src/char/int_mercenary.c +++ b/src/char/int_mercenary.c @@ -27,36 +27,36 @@ bool inter_mercenary_owner_fromsql(int char_id, struct mmo_charstatus *status) { char* data; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith` FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith` FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return false; } - SQL->GetData(sql_handle, 0, &data, NULL); status->mer_id = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); status->arch_calls = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); status->arch_faith = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); status->spear_calls = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); status->spear_faith = atoi(data); - SQL->GetData(sql_handle, 5, &data, NULL); status->sword_calls = atoi(data); - SQL->GetData(sql_handle, 6, &data, NULL); status->sword_faith = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 0, &data, NULL); status->mer_id = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); status->arch_calls = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); status->arch_faith = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); status->spear_calls = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); status->spear_faith = atoi(data); + SQL->GetData(inter->sql_handle, 5, &data, NULL); status->sword_calls = atoi(data); + SQL->GetData(inter->sql_handle, 6, &data, NULL); status->sword_faith = atoi(data); + SQL->FreeResult(inter->sql_handle); return true; } bool inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) { - if( SQL_ERROR == SQL->Query(sql_handle, "REPLACE INTO `%s` (`char_id`, `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", + if( SQL_ERROR == SQL->Query(inter->sql_handle, "REPLACE INTO `%s` (`char_id`, `merc_id`, `arch_calls`, `arch_faith`, `spear_calls`, `spear_faith`, `sword_calls`, `sword_faith`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", mercenary_owner_db, char_id, status->mer_id, status->arch_calls, status->arch_faith, status->spear_calls, status->spear_faith, status->sword_calls, status->sword_faith) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } @@ -65,11 +65,11 @@ bool inter_mercenary_owner_tosql(int char_id, struct mmo_charstatus *status) bool inter_mercenary_owner_delete(int char_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_owner_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_db, char_id) ) - Sql_ShowDebug(sql_handle); + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `char_id` = '%d'", mercenary_db, char_id) ) + Sql_ShowDebug(inter->sql_handle); return true; } @@ -80,21 +80,21 @@ bool mapif_mercenary_save(struct s_mercenary* merc) if( merc->mercenary_id == 0 ) { // Create new DB entry - if( SQL_ERROR == SQL->Query(sql_handle, + if( SQL_ERROR == SQL->Query(inter->sql_handle, "INSERT INTO `%s` (`char_id`,`class`,`hp`,`sp`,`kill_counter`,`life_time`) VALUES ('%d','%d','%d','%d','%u','%u')", mercenary_db, merc->char_id, merc->class_, merc->hp, merc->sp, merc->kill_count, merc->life_time) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } else - merc->mercenary_id = (int)SQL->LastInsertId(sql_handle); + merc->mercenary_id = (int)SQL->LastInsertId(inter->sql_handle); } - else if( SQL_ERROR == SQL->Query(sql_handle, + else if( SQL_ERROR == SQL->Query(inter->sql_handle, "UPDATE `%s` SET `char_id` = '%d', `class` = '%d', `hp` = '%d', `sp` = '%d', `kill_counter` = '%u', `life_time` = '%u' WHERE `mer_id` = '%d'", mercenary_db, merc->char_id, merc->class_, merc->hp, merc->sp, merc->kill_count, merc->life_time, merc->mercenary_id) ) { // Update DB entry - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); flag = false; } @@ -109,24 +109,24 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) merc->mercenary_id = merc_id; merc->char_id = char_id; - if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `class`, `hp`, `sp`, `kill_counter`, `life_time` FROM `%s` WHERE `mer_id` = '%d' AND `char_id` = '%d'", mercenary_db, merc_id, char_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "SELECT `class`, `hp`, `sp`, `kill_counter`, `life_time` FROM `%s` WHERE `mer_id` = '%d' AND `char_id` = '%d'", mercenary_db, merc_id, char_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } - if( SQL_SUCCESS != SQL->NextRow(sql_handle) ) + if( SQL_SUCCESS != SQL->NextRow(inter->sql_handle) ) { - SQL->FreeResult(sql_handle); + SQL->FreeResult(inter->sql_handle); return false; } - SQL->GetData(sql_handle, 0, &data, NULL); merc->class_ = atoi(data); - SQL->GetData(sql_handle, 1, &data, NULL); merc->hp = atoi(data); - SQL->GetData(sql_handle, 2, &data, NULL); merc->sp = atoi(data); - SQL->GetData(sql_handle, 3, &data, NULL); merc->kill_count = atoi(data); - SQL->GetData(sql_handle, 4, &data, NULL); merc->life_time = atoi(data); - SQL->FreeResult(sql_handle); + SQL->GetData(inter->sql_handle, 0, &data, NULL); merc->class_ = atoi(data); + SQL->GetData(inter->sql_handle, 1, &data, NULL); merc->hp = atoi(data); + SQL->GetData(inter->sql_handle, 2, &data, NULL); merc->sp = atoi(data); + SQL->GetData(inter->sql_handle, 3, &data, NULL); merc->kill_count = atoi(data); + SQL->GetData(inter->sql_handle, 4, &data, NULL); merc->life_time = atoi(data); + SQL->FreeResult(inter->sql_handle); if( save_log ) ShowInfo("Mercenary loaded (%d - %d).\n", merc->mercenary_id, merc->char_id); @@ -135,9 +135,9 @@ bool mapif_mercenary_load(int merc_id, int char_id, struct s_mercenary *merc) bool mapif_mercenary_delete(int merc_id) { - if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", mercenary_db, merc_id) ) + if( SQL_ERROR == SQL->Query(inter->sql_handle, "DELETE FROM `%s` WHERE `mer_id` = '%d'", mercenary_db, merc_id) ) { - Sql_ShowDebug(sql_handle); + Sql_ShowDebug(inter->sql_handle); return false; } |