From 14509fcc4e4572788906cb6ebf75d34c3861112e Mon Sep 17 00:00:00 2001 From: Chris Miles Date: Sun, 14 Jan 2024 00:10:13 -0600 Subject: [PATCH] [Repositories] Fix datetime zero-value save behavior (#3976) --- .../base/base_aa_ability_repository.h | 73 +- .../base/base_aa_rank_effects_repository.h | 19 +- .../base/base_aa_rank_prereqs_repository.h | 13 +- .../base/base_aa_ranks_repository.h | 73 +- .../base/base_account_ip_repository.h | 18 +- .../base/base_account_repository.h | 52 +- .../base/base_adventure_details_repository.h | 6 +- .../base/base_adventure_template_repository.h | 6 +- .../base/base_alternate_currency_repository.h | 12 +- .../repositories/base/base_auras_repository.h | 60 +- .../base/base_blocked_spells_repository.h | 30 +- .../repositories/base/base_books_repository.h | 12 +- .../base/base_bug_reports_repository.h | 104 +- .../repositories/base/base_bugs_repository.h | 6 +- .../repositories/base/base_buyer_repository.h | 30 +- .../base/base_char_recipe_list_repository.h | 18 +- .../base_character_activities_repository.h | 6 +- .../base/base_character_auras_repository.h | 18 +- .../base_character_bandolier_repository.h | 6 +- .../base/base_character_bind_repository.h | 6 +- .../base/base_character_buffs_repository.h | 42 +- .../base_character_corpse_items_repository.h | 13 +- .../base/base_character_corpses_repository.h | 35 +- .../base/base_character_data_repository.h | 22 +- .../base_character_exp_modifiers_repository.h | 19 +- ...character_expedition_lockouts_repository.h | 10 +- ...haracter_instance_safereturns_repository.h | 18 +- .../base_character_peqzone_flags_repository.h | 12 +- .../base_character_pet_buffs_repository.h | 54 +- .../base/base_character_pet_info_repository.h | 42 +- .../base_character_pet_inventory_repository.h | 24 +- .../base_character_stats_record_repository.h | 428 ++--- .../base_character_task_timers_repository.h | 22 +- .../base/base_character_tasks_repository.h | 12 +- .../base/base_character_tribute_repository.h | 6 +- ...se_chatchannel_reserved_names_repository.h | 6 +- .../base/base_chatchannels_repository.h | 12 +- ...ed_shared_task_activity_state_repository.h | 32 +- ...completed_shared_task_members_repository.h | 6 +- .../base_completed_shared_tasks_repository.h | 42 +- .../base/base_completed_tasks_repository.h | 6 +- .../base/base_content_flags_repository.h | 12 +- .../base/base_db_str_repository.h | 12 +- .../base/base_discord_webhooks_repository.h | 26 +- .../base/base_discovered_items_repository.h | 6 +- .../repositories/base/base_doors_repository.h | 114 +- .../base_dynamic_zone_templates_repository.h | 54 +- .../base/base_dynamic_zones_repository.h | 12 +- .../base_expedition_lockouts_repository.h | 10 +- .../base_faction_association_repository.h | 66 +- .../base/base_faction_base_data_repository.h | 36 +- .../base/base_faction_list_mod_repository.h | 6 +- .../base/base_faction_list_repository.h | 12 +- .../base/base_faction_values_repository.h | 24 +- .../base/base_fishing_repository.h | 54 +- .../base/base_forage_repository.h | 42 +- .../base/base_global_loot_repository.h | 1 - .../base/base_gm_ips_repository.h | 6 +- .../base/base_graveyard_repository.h | 12 +- .../base/base_grid_entries_repository.h | 30 +- .../repositories/base/base_grid_repository.h | 24 +- .../base/base_ground_spawns_repository.h | 18 +- .../base/base_group_id_repository.h | 18 +- .../base/base_group_leaders_repository.h | 18 +- .../base/base_guild_members_repository.h | 6 +- .../base/base_guild_relations_repository.h | 6 +- .../base/base_guilds_repository.h | 18 +- .../base/base_horses_repository.h | 30 +- .../base/base_instance_list_repository.h | 6 +- .../base/base_inventory_repository.h | 12 +- .../base_inventory_snapshots_repository.h | 12 +- .../base/base_ip_exemptions_repository.h | 12 +- .../repositories/base/base_items_repository.h | 1530 ++++++++--------- .../base/base_level_exp_mods_repository.h | 6 +- .../base/base_login_accounts_repository.h | 30 +- .../base/base_login_api_tokens_repository.h | 38 +- .../base_login_server_admins_repository.h | 10 +- .../base_login_world_servers_repository.h | 28 +- .../base/base_logsys_categories_repository.h | 36 +- .../base/base_lootdrop_entries_repository.h | 6 +- .../base/base_lootdrop_repository.h | 12 +- .../base/base_loottable_repository.h | 18 +- .../repositories/base/base_mail_repository.h | 12 +- .../base/base_merc_buffs_repository.h | 42 +- .../base/base_name_filter_repository.h | 6 +- .../base/base_npc_emotes_repository.h | 18 +- .../base_npc_faction_entries_repository.h | 18 +- .../base/base_npc_faction_repository.h | 18 +- .../base_npc_scale_global_base_repository.h | 156 +- ...se_npc_spells_effects_entries_repository.h | 30 +- .../base/base_npc_spells_entries_repository.h | 42 +- .../base/base_npc_spells_repository.h | 36 +- .../base/base_npc_types_repository.h | 366 ++-- .../base/base_object_contents_repository.h | 23 +- .../base/base_object_repository.h | 96 +- ...se_perl_event_export_settings_repository.h | 36 +- .../base/base_petitions_repository.h | 42 +- ...ase_pets_equipmentset_entries_repository.h | 18 +- .../base/base_pets_equipmentset_repository.h | 12 +- .../repositories/base/base_pets_repository.h | 48 +- ...ase_player_event_log_settings_repository.h | 18 +- .../base/base_player_event_logs_repository.h | 28 +- .../base/base_quest_globals_repository.h | 30 +- .../base/base_raid_details_repository.h | 18 +- .../base/base_raid_members_repository.h | 48 +- .../base/base_respawn_times_repository.h | 25 +- .../base/base_saylink_repository.h | 6 +- .../base_server_scheduled_events_repository.h | 86 +- ...se_shared_task_activity_state_repository.h | 32 +- .../base_shared_task_members_repository.h | 6 +- .../base/base_shared_tasks_repository.h | 42 +- .../base/base_spawn2_disabled_repository.h | 18 +- .../base/base_spawn2_repository.h | 60 +- .../base/base_spawn_conditions_repository.h | 6 +- .../base/base_spawn_events_repository.h | 18 +- .../base/base_spawnentry_repository.h | 48 +- .../base/base_spawngroup_repository.h | 37 +- .../base/base_spell_globals_repository.h | 6 +- .../base/base_spells_new_repository.h | 1356 +++++++-------- .../base/base_start_zones_repository.h | 54 +- .../base/base_starting_items_repository.h | 24 +- .../base/base_task_activities_repository.h | 48 +- .../repositories/base/base_tasks_repository.h | 54 +- .../base/base_timers_repository.h | 12 +- .../base/base_titles_repository.h | 66 +- .../base/base_trader_repository.h | 6 +- ...ase_tradeskill_recipe_entries_repository.h | 48 +- .../base/base_tradeskill_recipe_repository.h | 72 +- .../repositories/base/base_traps_repository.h | 90 +- .../base/base_tributes_repository.h | 6 +- .../base/base_variables_repository.h | 12 +- .../base/base_zone_points_repository.h | 42 +- .../generators/repository-generator.pl | 4 +- 133 files changed, 3647 insertions(+), 3658 deletions(-) diff --git a/common/repositories/base/base_aa_ability_repository.h b/common/repositories/base/base_aa_ability_repository.h index 7a94eb716..923a3ca36 100644 --- a/common/repositories/base/base_aa_ability_repository.h +++ b/common/repositories/base/base_aa_ability_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseAaAbilityRepository { public: struct AaAbility { @@ -174,19 +173,19 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; - e.category = static_cast(atoi(row[2])); - e.classes = static_cast(atoi(row[3])); - e.races = static_cast(atoi(row[4])); - e.drakkin_heritage = static_cast(atoi(row[5])); - e.deities = static_cast(atoi(row[6])); - e.status = static_cast(atoi(row[7])); - e.type = static_cast(atoi(row[8])); - e.charges = static_cast(atoi(row[9])); - e.grant_only = static_cast(atoi(row[10])); - e.first_rank_id = static_cast(atoi(row[11])); + e.category = row[2] ? static_cast(atoi(row[2])) : -1; + e.classes = row[3] ? static_cast(atoi(row[3])) : 131070; + e.races = row[4] ? static_cast(atoi(row[4])) : 65535; + e.drakkin_heritage = row[5] ? static_cast(atoi(row[5])) : 127; + e.deities = row[6] ? static_cast(atoi(row[6])) : 131071; + e.status = row[7] ? static_cast(atoi(row[7])) : 0; + e.type = row[8] ? static_cast(atoi(row[8])) : 0; + e.charges = row[9] ? static_cast(atoi(row[9])) : 0; + e.grant_only = row[10] ? static_cast(atoi(row[10])) : 0; + e.first_rank_id = row[11] ? static_cast(atoi(row[11])) : -1; e.enabled = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 1; - e.reset_on_death = static_cast(atoi(row[13])); - e.auto_grant_enabled = static_cast(atoi(row[14])); + e.reset_on_death = row[13] ? static_cast(atoi(row[13])) : 0; + e.auto_grant_enabled = row[14] ? static_cast(atoi(row[14])) : 0; return e; } @@ -350,19 +349,19 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; - e.category = static_cast(atoi(row[2])); - e.classes = static_cast(atoi(row[3])); - e.races = static_cast(atoi(row[4])); - e.drakkin_heritage = static_cast(atoi(row[5])); - e.deities = static_cast(atoi(row[6])); - e.status = static_cast(atoi(row[7])); - e.type = static_cast(atoi(row[8])); - e.charges = static_cast(atoi(row[9])); - e.grant_only = static_cast(atoi(row[10])); - e.first_rank_id = static_cast(atoi(row[11])); + e.category = row[2] ? static_cast(atoi(row[2])) : -1; + e.classes = row[3] ? static_cast(atoi(row[3])) : 131070; + e.races = row[4] ? static_cast(atoi(row[4])) : 65535; + e.drakkin_heritage = row[5] ? static_cast(atoi(row[5])) : 127; + e.deities = row[6] ? static_cast(atoi(row[6])) : 131071; + e.status = row[7] ? static_cast(atoi(row[7])) : 0; + e.type = row[8] ? static_cast(atoi(row[8])) : 0; + e.charges = row[9] ? static_cast(atoi(row[9])) : 0; + e.grant_only = row[10] ? static_cast(atoi(row[10])) : 0; + e.first_rank_id = row[11] ? static_cast(atoi(row[11])) : -1; e.enabled = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 1; - e.reset_on_death = static_cast(atoi(row[13])); - e.auto_grant_enabled = static_cast(atoi(row[14])); + e.reset_on_death = row[13] ? static_cast(atoi(row[13])) : 0; + e.auto_grant_enabled = row[14] ? static_cast(atoi(row[14])) : 0; all_entries.push_back(e); } @@ -389,19 +388,19 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; - e.category = static_cast(atoi(row[2])); - e.classes = static_cast(atoi(row[3])); - e.races = static_cast(atoi(row[4])); - e.drakkin_heritage = static_cast(atoi(row[5])); - e.deities = static_cast(atoi(row[6])); - e.status = static_cast(atoi(row[7])); - e.type = static_cast(atoi(row[8])); - e.charges = static_cast(atoi(row[9])); - e.grant_only = static_cast(atoi(row[10])); - e.first_rank_id = static_cast(atoi(row[11])); + e.category = row[2] ? static_cast(atoi(row[2])) : -1; + e.classes = row[3] ? static_cast(atoi(row[3])) : 131070; + e.races = row[4] ? static_cast(atoi(row[4])) : 65535; + e.drakkin_heritage = row[5] ? static_cast(atoi(row[5])) : 127; + e.deities = row[6] ? static_cast(atoi(row[6])) : 131071; + e.status = row[7] ? static_cast(atoi(row[7])) : 0; + e.type = row[8] ? static_cast(atoi(row[8])) : 0; + e.charges = row[9] ? static_cast(atoi(row[9])) : 0; + e.grant_only = row[10] ? static_cast(atoi(row[10])) : 0; + e.first_rank_id = row[11] ? static_cast(atoi(row[11])) : -1; e.enabled = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 1; - e.reset_on_death = static_cast(atoi(row[13])); - e.auto_grant_enabled = static_cast(atoi(row[14])); + e.reset_on_death = row[13] ? static_cast(atoi(row[13])) : 0; + e.auto_grant_enabled = row[14] ? static_cast(atoi(row[14])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_aa_rank_effects_repository.h b/common/repositories/base/base_aa_rank_effects_repository.h index 4db406a82..5ce73f2fe 100644 --- a/common/repositories/base/base_aa_rank_effects_repository.h +++ b/common/repositories/base/base_aa_rank_effects_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseAaRankEffectsRepository { public: struct AaRankEffects { @@ -134,9 +133,9 @@ public: e.rank_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.slot = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 1; - e.effect_id = static_cast(atoi(row[2])); - e.base1 = static_cast(atoi(row[3])); - e.base2 = static_cast(atoi(row[4])); + e.effect_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.base1 = row[3] ? static_cast(atoi(row[3])) : 0; + e.base2 = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -270,9 +269,9 @@ public: e.rank_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.slot = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 1; - e.effect_id = static_cast(atoi(row[2])); - e.base1 = static_cast(atoi(row[3])); - e.base2 = static_cast(atoi(row[4])); + e.effect_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.base1 = row[3] ? static_cast(atoi(row[3])) : 0; + e.base2 = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -299,9 +298,9 @@ public: e.rank_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.slot = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 1; - e.effect_id = static_cast(atoi(row[2])); - e.base1 = static_cast(atoi(row[3])); - e.base2 = static_cast(atoi(row[4])); + e.effect_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.base1 = row[3] ? static_cast(atoi(row[3])) : 0; + e.base2 = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_aa_rank_prereqs_repository.h b/common/repositories/base/base_aa_rank_prereqs_repository.h index c1393d793..c227ef3c8 100644 --- a/common/repositories/base/base_aa_rank_prereqs_repository.h +++ b/common/repositories/base/base_aa_rank_prereqs_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseAaRankPrereqsRepository { public: struct AaRankPrereqs { @@ -125,8 +124,8 @@ public: AaRankPrereqs e{}; e.rank_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.aa_id = static_cast(atoi(row[1])); - e.points = static_cast(atoi(row[2])); + e.aa_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.points = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -253,8 +252,8 @@ public: AaRankPrereqs e{}; e.rank_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.aa_id = static_cast(atoi(row[1])); - e.points = static_cast(atoi(row[2])); + e.aa_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.points = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -280,8 +279,8 @@ public: AaRankPrereqs e{}; e.rank_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.aa_id = static_cast(atoi(row[1])); - e.points = static_cast(atoi(row[2])); + e.aa_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.points = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_aa_ranks_repository.h b/common/repositories/base/base_aa_ranks_repository.h index 0b097ca11..0667bf282 100644 --- a/common/repositories/base/base_aa_ranks_repository.h +++ b/common/repositories/base/base_aa_ranks_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseAaRanksRepository { public: struct AaRanks { @@ -165,18 +164,18 @@ public: AaRanks e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.upper_hotkey_sid = static_cast(atoi(row[1])); - e.lower_hotkey_sid = static_cast(atoi(row[2])); - e.title_sid = static_cast(atoi(row[3])); - e.desc_sid = static_cast(atoi(row[4])); - e.cost = static_cast(atoi(row[5])); - e.level_req = static_cast(atoi(row[6])); - e.spell = static_cast(atoi(row[7])); - e.spell_type = static_cast(atoi(row[8])); - e.recast_time = static_cast(atoi(row[9])); - e.expansion = static_cast(atoi(row[10])); - e.prev_id = static_cast(atoi(row[11])); - e.next_id = static_cast(atoi(row[12])); + e.upper_hotkey_sid = row[1] ? static_cast(atoi(row[1])) : -1; + e.lower_hotkey_sid = row[2] ? static_cast(atoi(row[2])) : -1; + e.title_sid = row[3] ? static_cast(atoi(row[3])) : -1; + e.desc_sid = row[4] ? static_cast(atoi(row[4])) : -1; + e.cost = row[5] ? static_cast(atoi(row[5])) : 1; + e.level_req = row[6] ? static_cast(atoi(row[6])) : 51; + e.spell = row[7] ? static_cast(atoi(row[7])) : -1; + e.spell_type = row[8] ? static_cast(atoi(row[8])) : 0; + e.recast_time = row[9] ? static_cast(atoi(row[9])) : 0; + e.expansion = row[10] ? static_cast(atoi(row[10])) : 0; + e.prev_id = row[11] ? static_cast(atoi(row[11])) : -1; + e.next_id = row[12] ? static_cast(atoi(row[12])) : -1; return e; } @@ -333,18 +332,18 @@ public: AaRanks e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.upper_hotkey_sid = static_cast(atoi(row[1])); - e.lower_hotkey_sid = static_cast(atoi(row[2])); - e.title_sid = static_cast(atoi(row[3])); - e.desc_sid = static_cast(atoi(row[4])); - e.cost = static_cast(atoi(row[5])); - e.level_req = static_cast(atoi(row[6])); - e.spell = static_cast(atoi(row[7])); - e.spell_type = static_cast(atoi(row[8])); - e.recast_time = static_cast(atoi(row[9])); - e.expansion = static_cast(atoi(row[10])); - e.prev_id = static_cast(atoi(row[11])); - e.next_id = static_cast(atoi(row[12])); + e.upper_hotkey_sid = row[1] ? static_cast(atoi(row[1])) : -1; + e.lower_hotkey_sid = row[2] ? static_cast(atoi(row[2])) : -1; + e.title_sid = row[3] ? static_cast(atoi(row[3])) : -1; + e.desc_sid = row[4] ? static_cast(atoi(row[4])) : -1; + e.cost = row[5] ? static_cast(atoi(row[5])) : 1; + e.level_req = row[6] ? static_cast(atoi(row[6])) : 51; + e.spell = row[7] ? static_cast(atoi(row[7])) : -1; + e.spell_type = row[8] ? static_cast(atoi(row[8])) : 0; + e.recast_time = row[9] ? static_cast(atoi(row[9])) : 0; + e.expansion = row[10] ? static_cast(atoi(row[10])) : 0; + e.prev_id = row[11] ? static_cast(atoi(row[11])) : -1; + e.next_id = row[12] ? static_cast(atoi(row[12])) : -1; all_entries.push_back(e); } @@ -370,18 +369,18 @@ public: AaRanks e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.upper_hotkey_sid = static_cast(atoi(row[1])); - e.lower_hotkey_sid = static_cast(atoi(row[2])); - e.title_sid = static_cast(atoi(row[3])); - e.desc_sid = static_cast(atoi(row[4])); - e.cost = static_cast(atoi(row[5])); - e.level_req = static_cast(atoi(row[6])); - e.spell = static_cast(atoi(row[7])); - e.spell_type = static_cast(atoi(row[8])); - e.recast_time = static_cast(atoi(row[9])); - e.expansion = static_cast(atoi(row[10])); - e.prev_id = static_cast(atoi(row[11])); - e.next_id = static_cast(atoi(row[12])); + e.upper_hotkey_sid = row[1] ? static_cast(atoi(row[1])) : -1; + e.lower_hotkey_sid = row[2] ? static_cast(atoi(row[2])) : -1; + e.title_sid = row[3] ? static_cast(atoi(row[3])) : -1; + e.desc_sid = row[4] ? static_cast(atoi(row[4])) : -1; + e.cost = row[5] ? static_cast(atoi(row[5])) : 1; + e.level_req = row[6] ? static_cast(atoi(row[6])) : 51; + e.spell = row[7] ? static_cast(atoi(row[7])) : -1; + e.spell_type = row[8] ? static_cast(atoi(row[8])) : 0; + e.recast_time = row[9] ? static_cast(atoi(row[9])) : 0; + e.expansion = row[10] ? static_cast(atoi(row[10])) : 0; + e.prev_id = row[11] ? static_cast(atoi(row[11])) : -1; + e.next_id = row[12] ? static_cast(atoi(row[12])) : -1; all_entries.push_back(e); } diff --git a/common/repositories/base/base_account_ip_repository.h b/common/repositories/base/base_account_ip_repository.h index f93d3fa08..44ec6a84c 100644 --- a/common/repositories/base/base_account_ip_repository.h +++ b/common/repositories/base/base_account_ip_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { AccountIp e{}; - e.accid = static_cast(atoi(row[0])); + e.accid = row[0] ? static_cast(atoi(row[0])) : 0; e.ip = row[1] ? row[1] : ""; - e.count = static_cast(atoi(row[2])); - e.lastused = row[3] ? row[3] : ""; + e.count = row[2] ? static_cast(atoi(row[2])) : 1; + e.lastused = row[3] ? row[3] : std::time(nullptr); return e; } @@ -259,10 +259,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { AccountIp e{}; - e.accid = static_cast(atoi(row[0])); + e.accid = row[0] ? static_cast(atoi(row[0])) : 0; e.ip = row[1] ? row[1] : ""; - e.count = static_cast(atoi(row[2])); - e.lastused = row[3] ? row[3] : ""; + e.count = row[2] ? static_cast(atoi(row[2])) : 1; + e.lastused = row[3] ? row[3] : std::time(nullptr); all_entries.push_back(e); } @@ -287,10 +287,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { AccountIp e{}; - e.accid = static_cast(atoi(row[0])); + e.accid = row[0] ? static_cast(atoi(row[0])) : 0; e.ip = row[1] ? row[1] : ""; - e.count = static_cast(atoi(row[2])); - e.lastused = row[3] ? row[3] : ""; + e.count = row[2] ? static_cast(atoi(row[2])) : 1; + e.lastused = row[3] ? row[3] : std::time(nullptr); all_entries.push_back(e); } diff --git a/common/repositories/base/base_account_repository.h b/common/repositories/base/base_account_repository.h index 6e24e8538..96632cae7 100644 --- a/common/repositories/base/base_account_repository.h +++ b/common/repositories/base/base_account_repository.h @@ -207,22 +207,22 @@ public: if (results.RowCount() == 1) { Account e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.charname = row[2] ? row[2] : ""; e.sharedplat = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.password = row[4] ? row[4] : ""; - e.status = static_cast(atoi(row[5])); - e.ls_id = row[6] ? row[6] : ""; + e.status = row[5] ? static_cast(atoi(row[5])) : 0; + e.ls_id = row[6] ? row[6] : "eqemu"; e.lsaccount_id = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.gmspeed = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.invulnerable = static_cast(atoi(row[9])); - e.flymode = static_cast(atoi(row[10])); - e.ignore_tells = static_cast(atoi(row[11])); + e.invulnerable = row[9] ? static_cast(atoi(row[9])) : 0; + e.flymode = row[10] ? static_cast(atoi(row[10])) : 0; + e.ignore_tells = row[11] ? static_cast(atoi(row[11])) : 0; e.revoked = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.karma = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.minilogin_ip = row[14] ? row[14] : ""; - e.hideme = static_cast(atoi(row[15])); + e.hideme = row[15] ? static_cast(atoi(row[15])) : 0; e.rulesflag = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10); e.time_creation = row[18] ? static_cast(strtoul(row[18], nullptr, 10)) : 0; @@ -280,7 +280,7 @@ public: v.push_back(columns[14] + " = '" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(columns[15] + " = " + std::to_string(e.hideme)); v.push_back(columns[16] + " = " + std::to_string(e.rulesflag)); - v.push_back(columns[17] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); + v.push_back(columns[17] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[18] + " = " + std::to_string(e.time_creation)); v.push_back(columns[19] + " = '" + Strings::Escape(e.ban_reason) + "'"); v.push_back(columns[20] + " = '" + Strings::Escape(e.suspend_reason) + "'"); @@ -325,7 +325,7 @@ public: v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); @@ -378,7 +378,7 @@ public: v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); @@ -418,22 +418,22 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Account e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.charname = row[2] ? row[2] : ""; e.sharedplat = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.password = row[4] ? row[4] : ""; - e.status = static_cast(atoi(row[5])); - e.ls_id = row[6] ? row[6] : ""; + e.status = row[5] ? static_cast(atoi(row[5])) : 0; + e.ls_id = row[6] ? row[6] : "eqemu"; e.lsaccount_id = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.gmspeed = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.invulnerable = static_cast(atoi(row[9])); - e.flymode = static_cast(atoi(row[10])); - e.ignore_tells = static_cast(atoi(row[11])); + e.invulnerable = row[9] ? static_cast(atoi(row[9])) : 0; + e.flymode = row[10] ? static_cast(atoi(row[10])) : 0; + e.ignore_tells = row[11] ? static_cast(atoi(row[11])) : 0; e.revoked = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.karma = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.minilogin_ip = row[14] ? row[14] : ""; - e.hideme = static_cast(atoi(row[15])); + e.hideme = row[15] ? static_cast(atoi(row[15])) : 0; e.rulesflag = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10); e.time_creation = row[18] ? static_cast(strtoul(row[18], nullptr, 10)) : 0; @@ -466,22 +466,22 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Account e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.charname = row[2] ? row[2] : ""; e.sharedplat = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.password = row[4] ? row[4] : ""; - e.status = static_cast(atoi(row[5])); - e.ls_id = row[6] ? row[6] : ""; + e.status = row[5] ? static_cast(atoi(row[5])) : 0; + e.ls_id = row[6] ? row[6] : "eqemu"; e.lsaccount_id = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.gmspeed = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.invulnerable = static_cast(atoi(row[9])); - e.flymode = static_cast(atoi(row[10])); - e.ignore_tells = static_cast(atoi(row[11])); + e.invulnerable = row[9] ? static_cast(atoi(row[9])) : 0; + e.flymode = row[10] ? static_cast(atoi(row[10])) : 0; + e.ignore_tells = row[11] ? static_cast(atoi(row[11])) : 0; e.revoked = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.karma = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.minilogin_ip = row[14] ? row[14] : ""; - e.hideme = static_cast(atoi(row[15])); + e.hideme = row[15] ? static_cast(atoi(row[15])) : 0; e.rulesflag = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10); e.time_creation = row[18] ? static_cast(strtoul(row[18], nullptr, 10)) : 0; @@ -581,7 +581,7 @@ public: v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); @@ -627,7 +627,7 @@ public: v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); diff --git a/common/repositories/base/base_adventure_details_repository.h b/common/repositories/base/base_adventure_details_repository.h index 009c253f5..0a2834c7a 100644 --- a/common/repositories/base/base_adventure_details_repository.h +++ b/common/repositories/base/base_adventure_details_repository.h @@ -149,7 +149,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.adventure_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.instance_id = static_cast(atoi(row[2])); + e.instance_id = row[2] ? static_cast(atoi(row[2])) : -1; e.count = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.assassinate_count = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.status = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; @@ -300,7 +300,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.adventure_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.instance_id = static_cast(atoi(row[2])); + e.instance_id = row[2] ? static_cast(atoi(row[2])) : -1; e.count = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.assassinate_count = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.status = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; @@ -333,7 +333,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.adventure_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.instance_id = static_cast(atoi(row[2])); + e.instance_id = row[2] ? static_cast(atoi(row[2])) : -1; e.count = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.assassinate_count = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.status = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_adventure_template_repository.h b/common/repositories/base/base_adventure_template_repository.h index c0c97e749..25662aeac 100644 --- a/common/repositories/base/base_adventure_template_repository.h +++ b/common/repositories/base/base_adventure_template_repository.h @@ -266,7 +266,7 @@ public: e.zone_in_zone_id = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.zone_in_x = row[21] ? strtof(row[21], nullptr) : 0; e.zone_in_y = row[22] ? strtof(row[22], nullptr) : 0; - e.zone_in_object_id = static_cast(atoi(row[23])); + e.zone_in_object_id = row[23] ? static_cast(atoi(row[23])) : 0; e.dest_x = row[24] ? strtof(row[24], nullptr) : 0; e.dest_y = row[25] ? strtof(row[25], nullptr) : 0; e.dest_z = row[26] ? strtof(row[26], nullptr) : 0; @@ -513,7 +513,7 @@ public: e.zone_in_zone_id = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.zone_in_x = row[21] ? strtof(row[21], nullptr) : 0; e.zone_in_y = row[22] ? strtof(row[22], nullptr) : 0; - e.zone_in_object_id = static_cast(atoi(row[23])); + e.zone_in_object_id = row[23] ? static_cast(atoi(row[23])) : 0; e.dest_x = row[24] ? strtof(row[24], nullptr) : 0; e.dest_y = row[25] ? strtof(row[25], nullptr) : 0; e.dest_z = row[26] ? strtof(row[26], nullptr) : 0; @@ -569,7 +569,7 @@ public: e.zone_in_zone_id = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.zone_in_x = row[21] ? strtof(row[21], nullptr) : 0; e.zone_in_y = row[22] ? strtof(row[22], nullptr) : 0; - e.zone_in_object_id = static_cast(atoi(row[23])); + e.zone_in_object_id = row[23] ? static_cast(atoi(row[23])) : 0; e.dest_x = row[24] ? strtof(row[24], nullptr) : 0; e.dest_y = row[25] ? strtof(row[25], nullptr) : 0; e.dest_z = row[26] ? strtof(row[26], nullptr) : 0; diff --git a/common/repositories/base/base_alternate_currency_repository.h b/common/repositories/base/base_alternate_currency_repository.h index 362efa2ba..4c6bbc564 100644 --- a/common/repositories/base/base_alternate_currency_repository.h +++ b/common/repositories/base/base_alternate_currency_repository.h @@ -119,8 +119,8 @@ public: if (results.RowCount() == 1) { AlternateCurrency e{}; - e.id = static_cast(atoi(row[0])); - e.item_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.item_id = row[1] ? static_cast(atoi(row[1])) : 0; return e; } @@ -243,8 +243,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { AlternateCurrency e{}; - e.id = static_cast(atoi(row[0])); - e.item_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.item_id = row[1] ? static_cast(atoi(row[1])) : 0; all_entries.push_back(e); } @@ -269,8 +269,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { AlternateCurrency e{}; - e.id = static_cast(atoi(row[0])); - e.item_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.item_id = row[1] ? static_cast(atoi(row[1])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_auras_repository.h b/common/repositories/base/base_auras_repository.h index e363fb8ca..ae1c3f459 100644 --- a/common/repositories/base/base_auras_repository.h +++ b/common/repositories/base/base_auras_repository.h @@ -155,17 +155,17 @@ public: if (results.RowCount() == 1) { Auras e{}; - e.type = static_cast(atoi(row[0])); - e.npc_type = static_cast(atoi(row[1])); + e.type = row[0] ? static_cast(atoi(row[0])) : 0; + e.npc_type = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; - e.spell_id = static_cast(atoi(row[3])); - e.distance = static_cast(atoi(row[4])); - e.aura_type = static_cast(atoi(row[5])); - e.spawn_type = static_cast(atoi(row[6])); - e.movement = static_cast(atoi(row[7])); - e.duration = static_cast(atoi(row[8])); - e.icon = static_cast(atoi(row[9])); - e.cast_time = static_cast(atoi(row[10])); + e.spell_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.distance = row[4] ? static_cast(atoi(row[4])) : 60; + e.aura_type = row[5] ? static_cast(atoi(row[5])) : 1; + e.spawn_type = row[6] ? static_cast(atoi(row[6])) : 0; + e.movement = row[7] ? static_cast(atoi(row[7])) : 0; + e.duration = row[8] ? static_cast(atoi(row[8])) : 5400; + e.icon = row[9] ? static_cast(atoi(row[9])) : -1; + e.cast_time = row[10] ? static_cast(atoi(row[10])) : 0; return e; } @@ -315,17 +315,17 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Auras e{}; - e.type = static_cast(atoi(row[0])); - e.npc_type = static_cast(atoi(row[1])); + e.type = row[0] ? static_cast(atoi(row[0])) : 0; + e.npc_type = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; - e.spell_id = static_cast(atoi(row[3])); - e.distance = static_cast(atoi(row[4])); - e.aura_type = static_cast(atoi(row[5])); - e.spawn_type = static_cast(atoi(row[6])); - e.movement = static_cast(atoi(row[7])); - e.duration = static_cast(atoi(row[8])); - e.icon = static_cast(atoi(row[9])); - e.cast_time = static_cast(atoi(row[10])); + e.spell_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.distance = row[4] ? static_cast(atoi(row[4])) : 60; + e.aura_type = row[5] ? static_cast(atoi(row[5])) : 1; + e.spawn_type = row[6] ? static_cast(atoi(row[6])) : 0; + e.movement = row[7] ? static_cast(atoi(row[7])) : 0; + e.duration = row[8] ? static_cast(atoi(row[8])) : 5400; + e.icon = row[9] ? static_cast(atoi(row[9])) : -1; + e.cast_time = row[10] ? static_cast(atoi(row[10])) : 0; all_entries.push_back(e); } @@ -350,17 +350,17 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Auras e{}; - e.type = static_cast(atoi(row[0])); - e.npc_type = static_cast(atoi(row[1])); + e.type = row[0] ? static_cast(atoi(row[0])) : 0; + e.npc_type = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; - e.spell_id = static_cast(atoi(row[3])); - e.distance = static_cast(atoi(row[4])); - e.aura_type = static_cast(atoi(row[5])); - e.spawn_type = static_cast(atoi(row[6])); - e.movement = static_cast(atoi(row[7])); - e.duration = static_cast(atoi(row[8])); - e.icon = static_cast(atoi(row[9])); - e.cast_time = static_cast(atoi(row[10])); + e.spell_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.distance = row[4] ? static_cast(atoi(row[4])) : 60; + e.aura_type = row[5] ? static_cast(atoi(row[5])) : 1; + e.spawn_type = row[6] ? static_cast(atoi(row[6])) : 0; + e.movement = row[7] ? static_cast(atoi(row[7])) : 0; + e.duration = row[8] ? static_cast(atoi(row[8])) : 5400; + e.icon = row[9] ? static_cast(atoi(row[9])) : -1; + e.cast_time = row[10] ? static_cast(atoi(row[10])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_blocked_spells_repository.h b/common/repositories/base/base_blocked_spells_repository.h index e7df4f9ee..5e9e0dabe 100644 --- a/common/repositories/base/base_blocked_spells_repository.h +++ b/common/repositories/base/base_blocked_spells_repository.h @@ -175,10 +175,10 @@ public: if (results.RowCount() == 1) { BlockedSpells e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.spellid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[2])); - e.zoneid = static_cast(atoi(row[3])); + e.type = row[2] ? static_cast(atoi(row[2])) : 0; + e.zoneid = row[3] ? static_cast(atoi(row[3])) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0; e.y = row[5] ? strtof(row[5], nullptr) : 0; e.z = row[6] ? strtof(row[6], nullptr) : 0; @@ -187,8 +187,8 @@ public: e.z_diff = row[9] ? strtof(row[9], nullptr) : 0; e.message = row[10] ? row[10] : ""; e.description = row[11] ? row[11] : ""; - e.min_expansion = static_cast(atoi(row[12])); - e.max_expansion = static_cast(atoi(row[13])); + e.min_expansion = row[12] ? static_cast(atoi(row[12])) : -1; + e.max_expansion = row[13] ? static_cast(atoi(row[13])) : -1; e.content_flags = row[14] ? row[14] : ""; e.content_flags_disabled = row[15] ? row[15] : ""; @@ -354,10 +354,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { BlockedSpells e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.spellid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[2])); - e.zoneid = static_cast(atoi(row[3])); + e.type = row[2] ? static_cast(atoi(row[2])) : 0; + e.zoneid = row[3] ? static_cast(atoi(row[3])) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0; e.y = row[5] ? strtof(row[5], nullptr) : 0; e.z = row[6] ? strtof(row[6], nullptr) : 0; @@ -366,8 +366,8 @@ public: e.z_diff = row[9] ? strtof(row[9], nullptr) : 0; e.message = row[10] ? row[10] : ""; e.description = row[11] ? row[11] : ""; - e.min_expansion = static_cast(atoi(row[12])); - e.max_expansion = static_cast(atoi(row[13])); + e.min_expansion = row[12] ? static_cast(atoi(row[12])) : -1; + e.max_expansion = row[13] ? static_cast(atoi(row[13])) : -1; e.content_flags = row[14] ? row[14] : ""; e.content_flags_disabled = row[15] ? row[15] : ""; @@ -394,10 +394,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { BlockedSpells e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.spellid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[2])); - e.zoneid = static_cast(atoi(row[3])); + e.type = row[2] ? static_cast(atoi(row[2])) : 0; + e.zoneid = row[3] ? static_cast(atoi(row[3])) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0; e.y = row[5] ? strtof(row[5], nullptr) : 0; e.z = row[6] ? strtof(row[6], nullptr) : 0; @@ -406,8 +406,8 @@ public: e.z_diff = row[9] ? strtof(row[9], nullptr) : 0; e.message = row[10] ? row[10] : ""; e.description = row[11] ? row[11] : ""; - e.min_expansion = static_cast(atoi(row[12])); - e.max_expansion = static_cast(atoi(row[13])); + e.min_expansion = row[12] ? static_cast(atoi(row[12])) : -1; + e.max_expansion = row[13] ? static_cast(atoi(row[13])) : -1; e.content_flags = row[14] ? row[14] : ""; e.content_flags_disabled = row[15] ? row[15] : ""; diff --git a/common/repositories/base/base_books_repository.h b/common/repositories/base/base_books_repository.h index ff3a338f5..499b581cf 100644 --- a/common/repositories/base/base_books_repository.h +++ b/common/repositories/base/base_books_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { Books e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.txtfile = row[2] ? row[2] : ""; - e.language = static_cast(atoi(row[3])); + e.language = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -258,10 +258,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Books e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.txtfile = row[2] ? row[2] : ""; - e.language = static_cast(atoi(row[3])); + e.language = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -286,10 +286,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Books e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.txtfile = row[2] ? row[2] : ""; - e.language = static_cast(atoi(row[3])); + e.language = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_bug_reports_repository.h b/common/repositories/base/base_bug_reports_repository.h index 4918f0621..3f8dc7ff3 100644 --- a/common/repositories/base/base_bug_reports_repository.h +++ b/common/repositories/base/base_bug_reports_repository.h @@ -240,36 +240,36 @@ public: BugReports e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.zone = row[1] ? row[1] : ""; + e.zone = row[1] ? row[1] : "Unknown"; e.client_version_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.client_version_name = row[3] ? row[3] : ""; + e.client_version_name = row[3] ? row[3] : "Unknown"; e.account_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.character_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.character_name = row[6] ? row[6] : ""; - e.reporter_spoof = static_cast(atoi(row[7])); + e.character_name = row[6] ? row[6] : "Unknown"; + e.reporter_spoof = row[7] ? static_cast(atoi(row[7])) : 1; e.category_id = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.category_name = row[9] ? row[9] : ""; - e.reporter_name = row[10] ? row[10] : ""; - e.ui_path = row[11] ? row[11] : ""; + e.category_name = row[9] ? row[9] : "Other"; + e.reporter_name = row[10] ? row[10] : "Unknown"; + e.ui_path = row[11] ? row[11] : "Unknown"; e.pos_x = row[12] ? strtof(row[12], nullptr) : 0; e.pos_y = row[13] ? strtof(row[13], nullptr) : 0; e.pos_z = row[14] ? strtof(row[14], nullptr) : 0; e.heading = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.time_played = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.target_id = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; - e.target_name = row[18] ? row[18] : ""; + e.target_name = row[18] ? row[18] : "Unknown"; e.optional_info_mask = row[19] ? static_cast(strtoul(row[19], nullptr, 10)) : 0; - e._can_duplicate = static_cast(atoi(row[20])); - e._crash_bug = static_cast(atoi(row[21])); - e._target_info = static_cast(atoi(row[22])); - e._character_flags = static_cast(atoi(row[23])); - e._unknown_value = static_cast(atoi(row[24])); + e._can_duplicate = row[20] ? static_cast(atoi(row[20])) : 0; + e._crash_bug = row[21] ? static_cast(atoi(row[21])) : 0; + e._target_info = row[22] ? static_cast(atoi(row[22])) : 0; + e._character_flags = row[23] ? static_cast(atoi(row[23])) : 0; + e._unknown_value = row[24] ? static_cast(atoi(row[24])) : 0; e.bug_report = row[25] ? row[25] : ""; e.system_info = row[26] ? row[26] : ""; e.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10); e.bug_status = row[28] ? static_cast(strtoul(row[28], nullptr, 10)) : 0; e.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10); - e.last_reviewer = row[30] ? row[30] : ""; + e.last_reviewer = row[30] ? row[30] : "None"; e.reviewer_notes = row[31] ? row[31] : ""; return e; @@ -330,9 +330,9 @@ public: v.push_back(columns[24] + " = " + std::to_string(e._unknown_value)); v.push_back(columns[25] + " = '" + Strings::Escape(e.bug_report) + "'"); v.push_back(columns[26] + " = '" + Strings::Escape(e.system_info) + "'"); - v.push_back(columns[27] + " = FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); + v.push_back(columns[27] + " = FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[28] + " = " + std::to_string(e.bug_status)); - v.push_back(columns[29] + " = FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); + v.push_back(columns[29] + " = FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[30] + " = '" + Strings::Escape(e.last_reviewer) + "'"); v.push_back(columns[31] + " = '" + Strings::Escape(e.reviewer_notes) + "'"); @@ -383,9 +383,9 @@ public: v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); @@ -444,9 +444,9 @@ public: v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); @@ -483,36 +483,36 @@ public: BugReports e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.zone = row[1] ? row[1] : ""; + e.zone = row[1] ? row[1] : "Unknown"; e.client_version_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.client_version_name = row[3] ? row[3] : ""; + e.client_version_name = row[3] ? row[3] : "Unknown"; e.account_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.character_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.character_name = row[6] ? row[6] : ""; - e.reporter_spoof = static_cast(atoi(row[7])); + e.character_name = row[6] ? row[6] : "Unknown"; + e.reporter_spoof = row[7] ? static_cast(atoi(row[7])) : 1; e.category_id = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.category_name = row[9] ? row[9] : ""; - e.reporter_name = row[10] ? row[10] : ""; - e.ui_path = row[11] ? row[11] : ""; + e.category_name = row[9] ? row[9] : "Other"; + e.reporter_name = row[10] ? row[10] : "Unknown"; + e.ui_path = row[11] ? row[11] : "Unknown"; e.pos_x = row[12] ? strtof(row[12], nullptr) : 0; e.pos_y = row[13] ? strtof(row[13], nullptr) : 0; e.pos_z = row[14] ? strtof(row[14], nullptr) : 0; e.heading = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.time_played = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.target_id = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; - e.target_name = row[18] ? row[18] : ""; + e.target_name = row[18] ? row[18] : "Unknown"; e.optional_info_mask = row[19] ? static_cast(strtoul(row[19], nullptr, 10)) : 0; - e._can_duplicate = static_cast(atoi(row[20])); - e._crash_bug = static_cast(atoi(row[21])); - e._target_info = static_cast(atoi(row[22])); - e._character_flags = static_cast(atoi(row[23])); - e._unknown_value = static_cast(atoi(row[24])); + e._can_duplicate = row[20] ? static_cast(atoi(row[20])) : 0; + e._crash_bug = row[21] ? static_cast(atoi(row[21])) : 0; + e._target_info = row[22] ? static_cast(atoi(row[22])) : 0; + e._character_flags = row[23] ? static_cast(atoi(row[23])) : 0; + e._unknown_value = row[24] ? static_cast(atoi(row[24])) : 0; e.bug_report = row[25] ? row[25] : ""; e.system_info = row[26] ? row[26] : ""; e.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10); e.bug_status = row[28] ? static_cast(strtoul(row[28], nullptr, 10)) : 0; e.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10); - e.last_reviewer = row[30] ? row[30] : ""; + e.last_reviewer = row[30] ? row[30] : "None"; e.reviewer_notes = row[31] ? row[31] : ""; all_entries.push_back(e); @@ -539,36 +539,36 @@ public: BugReports e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.zone = row[1] ? row[1] : ""; + e.zone = row[1] ? row[1] : "Unknown"; e.client_version_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.client_version_name = row[3] ? row[3] : ""; + e.client_version_name = row[3] ? row[3] : "Unknown"; e.account_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.character_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.character_name = row[6] ? row[6] : ""; - e.reporter_spoof = static_cast(atoi(row[7])); + e.character_name = row[6] ? row[6] : "Unknown"; + e.reporter_spoof = row[7] ? static_cast(atoi(row[7])) : 1; e.category_id = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.category_name = row[9] ? row[9] : ""; - e.reporter_name = row[10] ? row[10] : ""; - e.ui_path = row[11] ? row[11] : ""; + e.category_name = row[9] ? row[9] : "Other"; + e.reporter_name = row[10] ? row[10] : "Unknown"; + e.ui_path = row[11] ? row[11] : "Unknown"; e.pos_x = row[12] ? strtof(row[12], nullptr) : 0; e.pos_y = row[13] ? strtof(row[13], nullptr) : 0; e.pos_z = row[14] ? strtof(row[14], nullptr) : 0; e.heading = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.time_played = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.target_id = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; - e.target_name = row[18] ? row[18] : ""; + e.target_name = row[18] ? row[18] : "Unknown"; e.optional_info_mask = row[19] ? static_cast(strtoul(row[19], nullptr, 10)) : 0; - e._can_duplicate = static_cast(atoi(row[20])); - e._crash_bug = static_cast(atoi(row[21])); - e._target_info = static_cast(atoi(row[22])); - e._character_flags = static_cast(atoi(row[23])); - e._unknown_value = static_cast(atoi(row[24])); + e._can_duplicate = row[20] ? static_cast(atoi(row[20])) : 0; + e._crash_bug = row[21] ? static_cast(atoi(row[21])) : 0; + e._target_info = row[22] ? static_cast(atoi(row[22])) : 0; + e._character_flags = row[23] ? static_cast(atoi(row[23])) : 0; + e._unknown_value = row[24] ? static_cast(atoi(row[24])) : 0; e.bug_report = row[25] ? row[25] : ""; e.system_info = row[26] ? row[26] : ""; e.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10); e.bug_status = row[28] ? static_cast(strtoul(row[28], nullptr, 10)) : 0; e.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10); - e.last_reviewer = row[30] ? row[30] : ""; + e.last_reviewer = row[30] ? row[30] : "None"; e.reviewer_notes = row[31] ? row[31] : ""; all_entries.push_back(e); @@ -671,9 +671,9 @@ public: v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); @@ -725,9 +725,9 @@ public: v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); diff --git a/common/repositories/base/base_bugs_repository.h b/common/repositories/base/base_bugs_repository.h index 343036435..51a087c07 100644 --- a/common/repositories/base/base_bugs_repository.h +++ b/common/repositories/base/base_bugs_repository.h @@ -174,7 +174,7 @@ public: e.flag = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.target = row[9] ? row[9] : ""; e.bug = row[10] ? row[10] : ""; - e.date = row[11] ? row[11] : ""; + e.date = row[11] ? row[11] : 0; e.status = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; return e; @@ -341,7 +341,7 @@ public: e.flag = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.target = row[9] ? row[9] : ""; e.bug = row[10] ? row[10] : ""; - e.date = row[11] ? row[11] : ""; + e.date = row[11] ? row[11] : 0; e.status = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; all_entries.push_back(e); @@ -378,7 +378,7 @@ public: e.flag = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.target = row[9] ? row[9] : ""; e.bug = row[10] ? row[10] : ""; - e.date = row[11] ? row[11] : ""; + e.date = row[11] ? row[11] : 0; e.status = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; all_entries.push_back(e); diff --git a/common/repositories/base/base_buyer_repository.h b/common/repositories/base/base_buyer_repository.h index deb1b980d..b3953b63d 100644 --- a/common/repositories/base/base_buyer_repository.h +++ b/common/repositories/base/base_buyer_repository.h @@ -135,12 +135,12 @@ public: if (results.RowCount() == 1) { Buyer e{}; - e.charid = static_cast(atoi(row[0])); - e.buyslot = static_cast(atoi(row[1])); - e.itemid = static_cast(atoi(row[2])); + e.charid = row[0] ? static_cast(atoi(row[0])) : 0; + e.buyslot = row[1] ? static_cast(atoi(row[1])) : 0; + e.itemid = row[2] ? static_cast(atoi(row[2])) : 0; e.itemname = row[3] ? row[3] : ""; - e.quantity = static_cast(atoi(row[4])); - e.price = static_cast(atoi(row[5])); + e.quantity = row[4] ? static_cast(atoi(row[4])) : 0; + e.price = row[5] ? static_cast(atoi(row[5])) : 0; return e; } @@ -275,12 +275,12 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Buyer e{}; - e.charid = static_cast(atoi(row[0])); - e.buyslot = static_cast(atoi(row[1])); - e.itemid = static_cast(atoi(row[2])); + e.charid = row[0] ? static_cast(atoi(row[0])) : 0; + e.buyslot = row[1] ? static_cast(atoi(row[1])) : 0; + e.itemid = row[2] ? static_cast(atoi(row[2])) : 0; e.itemname = row[3] ? row[3] : ""; - e.quantity = static_cast(atoi(row[4])); - e.price = static_cast(atoi(row[5])); + e.quantity = row[4] ? static_cast(atoi(row[4])) : 0; + e.price = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -305,12 +305,12 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Buyer e{}; - e.charid = static_cast(atoi(row[0])); - e.buyslot = static_cast(atoi(row[1])); - e.itemid = static_cast(atoi(row[2])); + e.charid = row[0] ? static_cast(atoi(row[0])) : 0; + e.buyslot = row[1] ? static_cast(atoi(row[1])) : 0; + e.itemid = row[2] ? static_cast(atoi(row[2])) : 0; e.itemname = row[3] ? row[3] : ""; - e.quantity = static_cast(atoi(row[4])); - e.price = static_cast(atoi(row[5])); + e.quantity = row[4] ? static_cast(atoi(row[4])) : 0; + e.price = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_char_recipe_list_repository.h b/common/repositories/base/base_char_recipe_list_repository.h index e3413243f..83fb6d609 100644 --- a/common/repositories/base/base_char_recipe_list_repository.h +++ b/common/repositories/base/base_char_recipe_list_repository.h @@ -123,9 +123,9 @@ public: if (results.RowCount() == 1) { CharRecipeList e{}; - e.char_id = static_cast(atoi(row[0])); - e.recipe_id = static_cast(atoi(row[1])); - e.madecount = static_cast(atoi(row[2])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.recipe_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.madecount = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -251,9 +251,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharRecipeList e{}; - e.char_id = static_cast(atoi(row[0])); - e.recipe_id = static_cast(atoi(row[1])); - e.madecount = static_cast(atoi(row[2])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.recipe_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.madecount = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -278,9 +278,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharRecipeList e{}; - e.char_id = static_cast(atoi(row[0])); - e.recipe_id = static_cast(atoi(row[1])); - e.madecount = static_cast(atoi(row[2])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.recipe_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.madecount = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_activities_repository.h b/common/repositories/base/base_character_activities_repository.h index fd20c3b43..e7b380ecc 100644 --- a/common/repositories/base/base_character_activities_repository.h +++ b/common/repositories/base/base_character_activities_repository.h @@ -135,7 +135,7 @@ public: e.taskid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.activityid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.donecount = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.completed = static_cast(atoi(row[4])); + e.completed = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -271,7 +271,7 @@ public: e.taskid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.activityid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.donecount = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.completed = static_cast(atoi(row[4])); + e.completed = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -300,7 +300,7 @@ public: e.taskid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.activityid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.donecount = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.completed = static_cast(atoi(row[4])); + e.completed = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_auras_repository.h b/common/repositories/base/base_character_auras_repository.h index 8eca4d659..d2389f721 100644 --- a/common/repositories/base/base_character_auras_repository.h +++ b/common/repositories/base/base_character_auras_repository.h @@ -123,9 +123,9 @@ public: if (results.RowCount() == 1) { CharacterAuras e{}; - e.id = static_cast(atoi(row[0])); - e.slot = static_cast(atoi(row[1])); - e.spell_id = static_cast(atoi(row[2])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; + e.spell_id = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -251,9 +251,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterAuras e{}; - e.id = static_cast(atoi(row[0])); - e.slot = static_cast(atoi(row[1])); - e.spell_id = static_cast(atoi(row[2])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; + e.spell_id = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -278,9 +278,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterAuras e{}; - e.id = static_cast(atoi(row[0])); - e.slot = static_cast(atoi(row[1])); - e.spell_id = static_cast(atoi(row[2])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; + e.spell_id = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_bandolier_repository.h b/common/repositories/base/base_character_bandolier_repository.h index df41efaa8..8ad4d057f 100644 --- a/common/repositories/base/base_character_bandolier_repository.h +++ b/common/repositories/base/base_character_bandolier_repository.h @@ -140,7 +140,7 @@ public: e.bandolier_slot = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.icon = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.bandolier_name = row[5] ? row[5] : ""; + e.bandolier_name = row[5] ? row[5] : "0"; return e; } @@ -280,7 +280,7 @@ public: e.bandolier_slot = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.icon = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.bandolier_name = row[5] ? row[5] : ""; + e.bandolier_name = row[5] ? row[5] : "0"; all_entries.push_back(e); } @@ -310,7 +310,7 @@ public: e.bandolier_slot = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.icon = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.bandolier_name = row[5] ? row[5] : ""; + e.bandolier_name = row[5] ? row[5] : "0"; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_bind_repository.h b/common/repositories/base/base_character_bind_repository.h index 663c5c149..0dfb3eb45 100644 --- a/common/repositories/base/base_character_bind_repository.h +++ b/common/repositories/base/base_character_bind_repository.h @@ -144,7 +144,7 @@ public: CharacterBind e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.slot = static_cast(atoi(row[1])); + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; e.zone_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.instance_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0; @@ -291,7 +291,7 @@ public: CharacterBind e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.slot = static_cast(atoi(row[1])); + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; e.zone_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.instance_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0; @@ -323,7 +323,7 @@ public: CharacterBind e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.slot = static_cast(atoi(row[1])); + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; e.zone_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.instance_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0; diff --git a/common/repositories/base/base_character_buffs_repository.h b/common/repositories/base/base_character_buffs_repository.h index c405b6715..775848a29 100644 --- a/common/repositories/base/base_character_buffs_repository.h +++ b/common/repositories/base/base_character_buffs_repository.h @@ -184,18 +184,18 @@ public: e.spell_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.caster_level = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.caster_name = row[4] ? row[4] : ""; - e.ticsremaining = static_cast(atoi(row[5])); + e.ticsremaining = row[5] ? static_cast(atoi(row[5])) : 0; e.counters = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.numhits = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.melee_rune = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.magic_rune = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.persistent = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.dot_rune = static_cast(atoi(row[11])); - e.caston_x = static_cast(atoi(row[12])); - e.caston_y = static_cast(atoi(row[13])); - e.caston_z = static_cast(atoi(row[14])); - e.ExtraDIChance = static_cast(atoi(row[15])); - e.instrument_mod = static_cast(atoi(row[16])); + e.dot_rune = row[11] ? static_cast(atoi(row[11])) : 0; + e.caston_x = row[12] ? static_cast(atoi(row[12])) : 0; + e.caston_y = row[13] ? static_cast(atoi(row[13])) : 0; + e.caston_z = row[14] ? static_cast(atoi(row[14])) : 0; + e.ExtraDIChance = row[15] ? static_cast(atoi(row[15])) : 0; + e.instrument_mod = row[16] ? static_cast(atoi(row[16])) : 10; return e; } @@ -368,18 +368,18 @@ public: e.spell_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.caster_level = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.caster_name = row[4] ? row[4] : ""; - e.ticsremaining = static_cast(atoi(row[5])); + e.ticsremaining = row[5] ? static_cast(atoi(row[5])) : 0; e.counters = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.numhits = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.melee_rune = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.magic_rune = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.persistent = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.dot_rune = static_cast(atoi(row[11])); - e.caston_x = static_cast(atoi(row[12])); - e.caston_y = static_cast(atoi(row[13])); - e.caston_z = static_cast(atoi(row[14])); - e.ExtraDIChance = static_cast(atoi(row[15])); - e.instrument_mod = static_cast(atoi(row[16])); + e.dot_rune = row[11] ? static_cast(atoi(row[11])) : 0; + e.caston_x = row[12] ? static_cast(atoi(row[12])) : 0; + e.caston_y = row[13] ? static_cast(atoi(row[13])) : 0; + e.caston_z = row[14] ? static_cast(atoi(row[14])) : 0; + e.ExtraDIChance = row[15] ? static_cast(atoi(row[15])) : 0; + e.instrument_mod = row[16] ? static_cast(atoi(row[16])) : 10; all_entries.push_back(e); } @@ -409,18 +409,18 @@ public: e.spell_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.caster_level = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.caster_name = row[4] ? row[4] : ""; - e.ticsremaining = static_cast(atoi(row[5])); + e.ticsremaining = row[5] ? static_cast(atoi(row[5])) : 0; e.counters = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.numhits = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.melee_rune = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.magic_rune = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.persistent = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.dot_rune = static_cast(atoi(row[11])); - e.caston_x = static_cast(atoi(row[12])); - e.caston_y = static_cast(atoi(row[13])); - e.caston_z = static_cast(atoi(row[14])); - e.ExtraDIChance = static_cast(atoi(row[15])); - e.instrument_mod = static_cast(atoi(row[16])); + e.dot_rune = row[11] ? static_cast(atoi(row[11])) : 0; + e.caston_x = row[12] ? static_cast(atoi(row[12])) : 0; + e.caston_y = row[13] ? static_cast(atoi(row[13])) : 0; + e.caston_z = row[14] ? static_cast(atoi(row[14])) : 0; + e.ExtraDIChance = row[15] ? static_cast(atoi(row[15])) : 0; + e.instrument_mod = row[16] ? static_cast(atoi(row[16])) : 10; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_corpse_items_repository.h b/common/repositories/base/base_character_corpse_items_repository.h index a7689c6eb..87cb4fa81 100644 --- a/common/repositories/base/base_character_corpse_items_repository.h +++ b/common/repositories/base/base_character_corpse_items_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseCharacterCorpseItemsRepository { public: struct CharacterCorpseItems { @@ -181,8 +180,8 @@ public: e.aug_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.aug_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.aug_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.aug_6 = static_cast(atoi(row[9])); - e.attuned = static_cast(atoi(row[10])); + e.aug_6 = row[9] ? static_cast(atoi(row[9])) : 0; + e.attuned = row[10] ? static_cast(atoi(row[10])) : 0; e.custom_data = row[11] ? row[11] : ""; e.ornamenticon = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.ornamentidfile = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; @@ -357,8 +356,8 @@ public: e.aug_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.aug_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.aug_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.aug_6 = static_cast(atoi(row[9])); - e.attuned = static_cast(atoi(row[10])); + e.aug_6 = row[9] ? static_cast(atoi(row[9])) : 0; + e.attuned = row[10] ? static_cast(atoi(row[10])) : 0; e.custom_data = row[11] ? row[11] : ""; e.ornamenticon = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.ornamentidfile = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; @@ -396,8 +395,8 @@ public: e.aug_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.aug_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.aug_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.aug_6 = static_cast(atoi(row[9])); - e.attuned = static_cast(atoi(row[10])); + e.aug_6 = row[9] ? static_cast(atoi(row[9])) : 0; + e.attuned = row[10] ? static_cast(atoi(row[10])) : 0; e.custom_data = row[11] ? row[11] : ""; e.ornamenticon = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.ornamentidfile = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_character_corpses_repository.h b/common/repositories/base/base_character_corpses_repository.h index ea666ebfe..bbd1265b6 100644 --- a/common/repositories/base/base_character_corpses_repository.h +++ b/common/repositories/base/base_character_corpses_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseCharacterCorpsesRepository { public: struct CharacterCorpses { @@ -303,7 +302,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.charid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.charname = row[2] ? row[2] : ""; - e.zone_id = static_cast(atoi(row[3])); + e.zone_id = row[3] ? static_cast(atoi(row[3])) : 0; e.instance_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; e.y = row[6] ? strtof(row[6], nullptr) : 0; @@ -312,9 +311,9 @@ public: e.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10); e.guild_consent_id = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.is_rezzed = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.is_buried = static_cast(atoi(row[12])); - e.was_at_graveyard = static_cast(atoi(row[13])); - e.is_locked = static_cast(atoi(row[14])); + e.is_buried = row[12] ? static_cast(atoi(row[12])) : 0; + e.was_at_graveyard = row[13] ? static_cast(atoi(row[13])) : 0; + e.is_locked = row[14] ? static_cast(atoi(row[14])) : 0; e.exp = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.size = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.level = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; @@ -388,7 +387,7 @@ public: v.push_back(columns[6] + " = " + std::to_string(e.y)); v.push_back(columns[7] + " = " + std::to_string(e.z)); v.push_back(columns[8] + " = " + std::to_string(e.heading)); - v.push_back(columns[9] + " = FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); + v.push_back(columns[9] + " = FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[10] + " = " + std::to_string(e.guild_consent_id)); v.push_back(columns[11] + " = " + std::to_string(e.is_rezzed)); v.push_back(columns[12] + " = " + std::to_string(e.is_buried)); @@ -456,7 +455,7 @@ public: v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); @@ -532,7 +531,7 @@ public: v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); @@ -606,7 +605,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.charid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.charname = row[2] ? row[2] : ""; - e.zone_id = static_cast(atoi(row[3])); + e.zone_id = row[3] ? static_cast(atoi(row[3])) : 0; e.instance_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; e.y = row[6] ? strtof(row[6], nullptr) : 0; @@ -615,9 +614,9 @@ public: e.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10); e.guild_consent_id = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.is_rezzed = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.is_buried = static_cast(atoi(row[12])); - e.was_at_graveyard = static_cast(atoi(row[13])); - e.is_locked = static_cast(atoi(row[14])); + e.is_buried = row[12] ? static_cast(atoi(row[12])) : 0; + e.was_at_graveyard = row[13] ? static_cast(atoi(row[13])) : 0; + e.is_locked = row[14] ? static_cast(atoi(row[14])) : 0; e.exp = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.size = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.level = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; @@ -677,7 +676,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.charid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.charname = row[2] ? row[2] : ""; - e.zone_id = static_cast(atoi(row[3])); + e.zone_id = row[3] ? static_cast(atoi(row[3])) : 0; e.instance_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; e.y = row[6] ? strtof(row[6], nullptr) : 0; @@ -686,9 +685,9 @@ public: e.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10); e.guild_consent_id = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.is_rezzed = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.is_buried = static_cast(atoi(row[12])); - e.was_at_graveyard = static_cast(atoi(row[13])); - e.is_locked = static_cast(atoi(row[14])); + e.is_buried = row[12] ? static_cast(atoi(row[12])) : 0; + e.was_at_graveyard = row[13] ? static_cast(atoi(row[13])) : 0; + e.is_locked = row[14] ? static_cast(atoi(row[14])) : 0; e.exp = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.size = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.level = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; @@ -804,7 +803,7 @@ public: v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); @@ -873,7 +872,7 @@ public: v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); diff --git a/common/repositories/base/base_character_data_repository.h b/common/repositories/base/base_character_data_repository.h index 2580788f4..196547563 100644 --- a/common/repositories/base/base_character_data_repository.h +++ b/common/repositories/base/base_character_data_repository.h @@ -524,7 +524,7 @@ public: CharacterData e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.account_id = static_cast(atoi(row[1])); + e.account_id = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; e.last_name = row[3] ? row[3] : ""; e.title = row[4] ? row[4] : ""; @@ -618,7 +618,7 @@ public: e.lfg = row[92] ? static_cast(strtoul(row[92], nullptr, 10)) : 0; e.mailkey = row[93] ? row[93] : ""; e.xtargets = row[94] ? static_cast(strtoul(row[94], nullptr, 10)) : 5; - e.firstlogon = static_cast(atoi(row[95])); + e.firstlogon = row[95] ? static_cast(atoi(row[95])) : 0; e.e_aa_effects = row[96] ? static_cast(strtoul(row[96], nullptr, 10)) : 0; e.e_percent_to_aa = row[97] ? static_cast(strtoul(row[97], nullptr, 10)) : 0; e.e_expended_aa_spent = row[98] ? static_cast(strtoul(row[98], nullptr, 10)) : 0; @@ -760,7 +760,7 @@ public: v.push_back(columns[99] + " = " + std::to_string(e.aa_points_spent_old)); v.push_back(columns[100] + " = " + std::to_string(e.aa_points_old)); v.push_back(columns[101] + " = " + std::to_string(e.e_last_invsnapshot)); - v.push_back(columns[102] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back(columns[102] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -884,7 +884,7 @@ public: v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -1016,7 +1016,7 @@ public: v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -1051,7 +1051,7 @@ public: CharacterData e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.account_id = static_cast(atoi(row[1])); + e.account_id = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; e.last_name = row[3] ? row[3] : ""; e.title = row[4] ? row[4] : ""; @@ -1145,7 +1145,7 @@ public: e.lfg = row[92] ? static_cast(strtoul(row[92], nullptr, 10)) : 0; e.mailkey = row[93] ? row[93] : ""; e.xtargets = row[94] ? static_cast(strtoul(row[94], nullptr, 10)) : 5; - e.firstlogon = static_cast(atoi(row[95])); + e.firstlogon = row[95] ? static_cast(atoi(row[95])) : 0; e.e_aa_effects = row[96] ? static_cast(strtoul(row[96], nullptr, 10)) : 0; e.e_percent_to_aa = row[97] ? static_cast(strtoul(row[97], nullptr, 10)) : 0; e.e_expended_aa_spent = row[98] ? static_cast(strtoul(row[98], nullptr, 10)) : 0; @@ -1178,7 +1178,7 @@ public: CharacterData e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.account_id = static_cast(atoi(row[1])); + e.account_id = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; e.last_name = row[3] ? row[3] : ""; e.title = row[4] ? row[4] : ""; @@ -1272,7 +1272,7 @@ public: e.lfg = row[92] ? static_cast(strtoul(row[92], nullptr, 10)) : 0; e.mailkey = row[93] ? row[93] : ""; e.xtargets = row[94] ? static_cast(strtoul(row[94], nullptr, 10)) : 5; - e.firstlogon = static_cast(atoi(row[95])); + e.firstlogon = row[95] ? static_cast(atoi(row[95])) : 0; e.e_aa_effects = row[96] ? static_cast(strtoul(row[96], nullptr, 10)) : 0; e.e_percent_to_aa = row[97] ? static_cast(strtoul(row[97], nullptr, 10)) : 0; e.e_expended_aa_spent = row[98] ? static_cast(strtoul(row[98], nullptr, 10)) : 0; @@ -1456,7 +1456,7 @@ public: v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -1581,7 +1581,7 @@ public: v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_character_exp_modifiers_repository.h b/common/repositories/base/base_character_exp_modifiers_repository.h index eb10deb5b..e11f24294 100644 --- a/common/repositories/base/base_character_exp_modifiers_repository.h +++ b/common/repositories/base/base_character_exp_modifiers_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseCharacterExpModifiersRepository { public: struct CharacterExpModifiers { @@ -132,9 +131,9 @@ public: if (results.RowCount() == 1) { CharacterExpModifiers e{}; - e.character_id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); - e.instance_version = static_cast(atoi(row[2])); + e.character_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.instance_version = row[2] ? static_cast(atoi(row[2])) : -1; e.aa_modifier = row[3] ? strtof(row[3], nullptr) : 0; e.exp_modifier = row[4] ? strtof(row[4], nullptr) : 0; @@ -268,9 +267,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterExpModifiers e{}; - e.character_id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); - e.instance_version = static_cast(atoi(row[2])); + e.character_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.instance_version = row[2] ? static_cast(atoi(row[2])) : -1; e.aa_modifier = row[3] ? strtof(row[3], nullptr) : 0; e.exp_modifier = row[4] ? strtof(row[4], nullptr) : 0; @@ -297,9 +296,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterExpModifiers e{}; - e.character_id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); - e.instance_version = static_cast(atoi(row[2])); + e.character_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.instance_version = row[2] ? static_cast(atoi(row[2])) : -1; e.aa_modifier = row[3] ? strtof(row[3], nullptr) : 0; e.exp_modifier = row[4] ? strtof(row[4], nullptr) : 0; diff --git a/common/repositories/base/base_character_expedition_lockouts_repository.h b/common/repositories/base/base_character_expedition_lockouts_repository.h index 35d34502a..60d181f5c 100644 --- a/common/repositories/base/base_character_expedition_lockouts_repository.h +++ b/common/repositories/base/base_character_expedition_lockouts_repository.h @@ -182,7 +182,7 @@ public: v.push_back(columns[1] + " = " + std::to_string(e.character_id)); v.push_back(columns[2] + " = '" + Strings::Escape(e.expedition_name) + "'"); v.push_back(columns[3] + " = '" + Strings::Escape(e.event_name) + "'"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[5] + " = " + std::to_string(e.duration)); v.push_back(columns[6] + " = '" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -210,7 +210,7 @@ public: v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -246,7 +246,7 @@ public: v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -398,7 +398,7 @@ public: v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -427,7 +427,7 @@ public: v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); diff --git a/common/repositories/base/base_character_instance_safereturns_repository.h b/common/repositories/base/base_character_instance_safereturns_repository.h index 55c5588d8..0501d5c29 100644 --- a/common/repositories/base/base_character_instance_safereturns_repository.h +++ b/common/repositories/base/base_character_instance_safereturns_repository.h @@ -149,9 +149,9 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.instance_zone_id = static_cast(atoi(row[2])); - e.instance_id = static_cast(atoi(row[3])); - e.safe_zone_id = static_cast(atoi(row[4])); + e.instance_zone_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.instance_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.safe_zone_id = row[4] ? static_cast(atoi(row[4])) : 0; e.safe_x = row[5] ? strtof(row[5], nullptr) : 0; e.safe_y = row[6] ? strtof(row[6], nullptr) : 0; e.safe_z = row[7] ? strtof(row[7], nullptr) : 0; @@ -300,9 +300,9 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.instance_zone_id = static_cast(atoi(row[2])); - e.instance_id = static_cast(atoi(row[3])); - e.safe_zone_id = static_cast(atoi(row[4])); + e.instance_zone_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.instance_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.safe_zone_id = row[4] ? static_cast(atoi(row[4])) : 0; e.safe_x = row[5] ? strtof(row[5], nullptr) : 0; e.safe_y = row[6] ? strtof(row[6], nullptr) : 0; e.safe_z = row[7] ? strtof(row[7], nullptr) : 0; @@ -333,9 +333,9 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.instance_zone_id = static_cast(atoi(row[2])); - e.instance_id = static_cast(atoi(row[3])); - e.safe_zone_id = static_cast(atoi(row[4])); + e.instance_zone_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.instance_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.safe_zone_id = row[4] ? static_cast(atoi(row[4])) : 0; e.safe_x = row[5] ? strtof(row[5], nullptr) : 0; e.safe_y = row[6] ? strtof(row[6], nullptr) : 0; e.safe_z = row[7] ? strtof(row[7], nullptr) : 0; diff --git a/common/repositories/base/base_character_peqzone_flags_repository.h b/common/repositories/base/base_character_peqzone_flags_repository.h index 3ecd5bfc6..a4fe7f1cd 100644 --- a/common/repositories/base/base_character_peqzone_flags_repository.h +++ b/common/repositories/base/base_character_peqzone_flags_repository.h @@ -119,8 +119,8 @@ public: if (results.RowCount() == 1) { CharacterPeqzoneFlags e{}; - e.id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; return e; } @@ -243,8 +243,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPeqzoneFlags e{}; - e.id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; all_entries.push_back(e); } @@ -269,8 +269,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPeqzoneFlags e{}; - e.id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_pet_buffs_repository.h b/common/repositories/base/base_character_pet_buffs_repository.h index 23aff2b97..262a40e3a 100644 --- a/common/repositories/base/base_character_pet_buffs_repository.h +++ b/common/repositories/base/base_character_pet_buffs_repository.h @@ -155,16 +155,16 @@ public: if (results.RowCount() == 1) { CharacterPetBuffs e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); - e.slot = static_cast(atoi(row[2])); - e.spell_id = static_cast(atoi(row[3])); - e.caster_level = static_cast(atoi(row[4])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; + e.slot = row[2] ? static_cast(atoi(row[2])) : 0; + e.spell_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.caster_level = row[4] ? static_cast(atoi(row[4])) : 0; e.castername = row[5] ? row[5] : ""; - e.ticsremaining = static_cast(atoi(row[6])); - e.counters = static_cast(atoi(row[7])); - e.numhits = static_cast(atoi(row[8])); - e.rune = static_cast(atoi(row[9])); + e.ticsremaining = row[6] ? static_cast(atoi(row[6])) : 0; + e.counters = row[7] ? static_cast(atoi(row[7])) : 0; + e.numhits = row[8] ? static_cast(atoi(row[8])) : 0; + e.rune = row[9] ? static_cast(atoi(row[9])) : 0; e.instrument_mod = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 10; return e; @@ -315,16 +315,16 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPetBuffs e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); - e.slot = static_cast(atoi(row[2])); - e.spell_id = static_cast(atoi(row[3])); - e.caster_level = static_cast(atoi(row[4])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; + e.slot = row[2] ? static_cast(atoi(row[2])) : 0; + e.spell_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.caster_level = row[4] ? static_cast(atoi(row[4])) : 0; e.castername = row[5] ? row[5] : ""; - e.ticsremaining = static_cast(atoi(row[6])); - e.counters = static_cast(atoi(row[7])); - e.numhits = static_cast(atoi(row[8])); - e.rune = static_cast(atoi(row[9])); + e.ticsremaining = row[6] ? static_cast(atoi(row[6])) : 0; + e.counters = row[7] ? static_cast(atoi(row[7])) : 0; + e.numhits = row[8] ? static_cast(atoi(row[8])) : 0; + e.rune = row[9] ? static_cast(atoi(row[9])) : 0; e.instrument_mod = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 10; all_entries.push_back(e); @@ -350,16 +350,16 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPetBuffs e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); - e.slot = static_cast(atoi(row[2])); - e.spell_id = static_cast(atoi(row[3])); - e.caster_level = static_cast(atoi(row[4])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; + e.slot = row[2] ? static_cast(atoi(row[2])) : 0; + e.spell_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.caster_level = row[4] ? static_cast(atoi(row[4])) : 0; e.castername = row[5] ? row[5] : ""; - e.ticsremaining = static_cast(atoi(row[6])); - e.counters = static_cast(atoi(row[7])); - e.numhits = static_cast(atoi(row[8])); - e.rune = static_cast(atoi(row[9])); + e.ticsremaining = row[6] ? static_cast(atoi(row[6])) : 0; + e.counters = row[7] ? static_cast(atoi(row[7])) : 0; + e.numhits = row[8] ? static_cast(atoi(row[8])) : 0; + e.rune = row[9] ? static_cast(atoi(row[9])) : 0; e.instrument_mod = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 10; all_entries.push_back(e); diff --git a/common/repositories/base/base_character_pet_info_repository.h b/common/repositories/base/base_character_pet_info_repository.h index 973c6d41b..d176cf65a 100644 --- a/common/repositories/base/base_character_pet_info_repository.h +++ b/common/repositories/base/base_character_pet_info_repository.h @@ -147,15 +147,15 @@ public: if (results.RowCount() == 1) { CharacterPetInfo e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; e.petname = row[2] ? row[2] : ""; - e.petpower = static_cast(atoi(row[3])); - e.spell_id = static_cast(atoi(row[4])); - e.hp = static_cast(atoi(row[5])); - e.mana = static_cast(atoi(row[6])); + e.petpower = row[3] ? static_cast(atoi(row[3])) : 0; + e.spell_id = row[4] ? static_cast(atoi(row[4])) : 0; + e.hp = row[5] ? static_cast(atoi(row[5])) : 0; + e.mana = row[6] ? static_cast(atoi(row[6])) : 0; e.size = row[7] ? strtof(row[7], nullptr) : 0; - e.taunting = static_cast(atoi(row[8])); + e.taunting = row[8] ? static_cast(atoi(row[8])) : 1; return e; } @@ -299,15 +299,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPetInfo e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; e.petname = row[2] ? row[2] : ""; - e.petpower = static_cast(atoi(row[3])); - e.spell_id = static_cast(atoi(row[4])); - e.hp = static_cast(atoi(row[5])); - e.mana = static_cast(atoi(row[6])); + e.petpower = row[3] ? static_cast(atoi(row[3])) : 0; + e.spell_id = row[4] ? static_cast(atoi(row[4])) : 0; + e.hp = row[5] ? static_cast(atoi(row[5])) : 0; + e.mana = row[6] ? static_cast(atoi(row[6])) : 0; e.size = row[7] ? strtof(row[7], nullptr) : 0; - e.taunting = static_cast(atoi(row[8])); + e.taunting = row[8] ? static_cast(atoi(row[8])) : 1; all_entries.push_back(e); } @@ -332,15 +332,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPetInfo e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; e.petname = row[2] ? row[2] : ""; - e.petpower = static_cast(atoi(row[3])); - e.spell_id = static_cast(atoi(row[4])); - e.hp = static_cast(atoi(row[5])); - e.mana = static_cast(atoi(row[6])); + e.petpower = row[3] ? static_cast(atoi(row[3])) : 0; + e.spell_id = row[4] ? static_cast(atoi(row[4])) : 0; + e.hp = row[5] ? static_cast(atoi(row[5])) : 0; + e.mana = row[6] ? static_cast(atoi(row[6])) : 0; e.size = row[7] ? strtof(row[7], nullptr) : 0; - e.taunting = static_cast(atoi(row[8])); + e.taunting = row[8] ? static_cast(atoi(row[8])) : 1; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_pet_inventory_repository.h b/common/repositories/base/base_character_pet_inventory_repository.h index e10164b3a..d9e590663 100644 --- a/common/repositories/base/base_character_pet_inventory_repository.h +++ b/common/repositories/base/base_character_pet_inventory_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { CharacterPetInventory e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); - e.slot = static_cast(atoi(row[2])); - e.item_id = static_cast(atoi(row[3])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; + e.slot = row[2] ? static_cast(atoi(row[2])) : 0; + e.item_id = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -259,10 +259,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPetInventory e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); - e.slot = static_cast(atoi(row[2])); - e.item_id = static_cast(atoi(row[3])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; + e.slot = row[2] ? static_cast(atoi(row[2])) : 0; + e.item_id = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -287,10 +287,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterPetInventory e{}; - e.char_id = static_cast(atoi(row[0])); - e.pet = static_cast(atoi(row[1])); - e.slot = static_cast(atoi(row[2])); - e.item_id = static_cast(atoi(row[3])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.pet = row[1] ? static_cast(atoi(row[1])) : 0; + e.slot = row[2] ? static_cast(atoi(row[2])) : 0; + e.item_id = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_stats_record_repository.h b/common/repositories/base/base_character_stats_record_repository.h index 657515233..20d698f4b 100644 --- a/common/repositories/base/base_character_stats_record_repository.h +++ b/common/repositories/base/base_character_stats_record_repository.h @@ -407,78 +407,78 @@ public: if (results.RowCount() == 1) { CharacterStatsRecord e{}; - e.character_id = static_cast(atoi(row[0])); + e.character_id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.status = static_cast(atoi(row[2])); - e.level = static_cast(atoi(row[3])); - e.class_ = static_cast(atoi(row[4])); - e.race = static_cast(atoi(row[5])); - e.aa_points = static_cast(atoi(row[6])); + e.status = row[2] ? static_cast(atoi(row[2])) : 0; + e.level = row[3] ? static_cast(atoi(row[3])) : 0; + e.class_ = row[4] ? static_cast(atoi(row[4])) : 0; + e.race = row[5] ? static_cast(atoi(row[5])) : 0; + e.aa_points = row[6] ? static_cast(atoi(row[6])) : 0; e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0; e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0; e.endurance = row[9] ? strtoll(row[9], nullptr, 10) : 0; - e.ac = static_cast(atoi(row[10])); - e.strength = static_cast(atoi(row[11])); - e.stamina = static_cast(atoi(row[12])); - e.dexterity = static_cast(atoi(row[13])); - e.agility = static_cast(atoi(row[14])); - e.intelligence = static_cast(atoi(row[15])); - e.wisdom = static_cast(atoi(row[16])); - e.charisma = static_cast(atoi(row[17])); - e.magic_resist = static_cast(atoi(row[18])); - e.fire_resist = static_cast(atoi(row[19])); - e.cold_resist = static_cast(atoi(row[20])); - e.poison_resist = static_cast(atoi(row[21])); - e.disease_resist = static_cast(atoi(row[22])); - e.corruption_resist = static_cast(atoi(row[23])); - e.heroic_strength = static_cast(atoi(row[24])); - e.heroic_stamina = static_cast(atoi(row[25])); - e.heroic_dexterity = static_cast(atoi(row[26])); - e.heroic_agility = static_cast(atoi(row[27])); - e.heroic_intelligence = static_cast(atoi(row[28])); - e.heroic_wisdom = static_cast(atoi(row[29])); - e.heroic_charisma = static_cast(atoi(row[30])); - e.heroic_magic_resist = static_cast(atoi(row[31])); - e.heroic_fire_resist = static_cast(atoi(row[32])); - e.heroic_cold_resist = static_cast(atoi(row[33])); - e.heroic_poison_resist = static_cast(atoi(row[34])); - e.heroic_disease_resist = static_cast(atoi(row[35])); - e.heroic_corruption_resist = static_cast(atoi(row[36])); - e.haste = static_cast(atoi(row[37])); - e.accuracy = static_cast(atoi(row[38])); - e.attack = static_cast(atoi(row[39])); - e.avoidance = static_cast(atoi(row[40])); - e.clairvoyance = static_cast(atoi(row[41])); - e.combat_effects = static_cast(atoi(row[42])); - e.damage_shield_mitigation = static_cast(atoi(row[43])); - e.damage_shield = static_cast(atoi(row[44])); - e.dot_shielding = static_cast(atoi(row[45])); - e.hp_regen = static_cast(atoi(row[46])); - e.mana_regen = static_cast(atoi(row[47])); - e.endurance_regen = static_cast(atoi(row[48])); - e.shielding = static_cast(atoi(row[49])); - e.spell_damage = static_cast(atoi(row[50])); - e.spell_shielding = static_cast(atoi(row[51])); - e.strikethrough = static_cast(atoi(row[52])); - e.stun_resist = static_cast(atoi(row[53])); - e.backstab = static_cast(atoi(row[54])); - e.wind = static_cast(atoi(row[55])); - e.brass = static_cast(atoi(row[56])); - e.string = static_cast(atoi(row[57])); - e.percussion = static_cast(atoi(row[58])); - e.singing = static_cast(atoi(row[59])); - e.baking = static_cast(atoi(row[60])); - e.alchemy = static_cast(atoi(row[61])); - e.tailoring = static_cast(atoi(row[62])); - e.blacksmithing = static_cast(atoi(row[63])); - e.fletching = static_cast(atoi(row[64])); - e.brewing = static_cast(atoi(row[65])); - e.jewelry = static_cast(atoi(row[66])); - e.pottery = static_cast(atoi(row[67])); - e.research = static_cast(atoi(row[68])); - e.alcohol = static_cast(atoi(row[69])); - e.fishing = static_cast(atoi(row[70])); - e.tinkering = static_cast(atoi(row[71])); + e.ac = row[10] ? static_cast(atoi(row[10])) : 0; + e.strength = row[11] ? static_cast(atoi(row[11])) : 0; + e.stamina = row[12] ? static_cast(atoi(row[12])) : 0; + e.dexterity = row[13] ? static_cast(atoi(row[13])) : 0; + e.agility = row[14] ? static_cast(atoi(row[14])) : 0; + e.intelligence = row[15] ? static_cast(atoi(row[15])) : 0; + e.wisdom = row[16] ? static_cast(atoi(row[16])) : 0; + e.charisma = row[17] ? static_cast(atoi(row[17])) : 0; + e.magic_resist = row[18] ? static_cast(atoi(row[18])) : 0; + e.fire_resist = row[19] ? static_cast(atoi(row[19])) : 0; + e.cold_resist = row[20] ? static_cast(atoi(row[20])) : 0; + e.poison_resist = row[21] ? static_cast(atoi(row[21])) : 0; + e.disease_resist = row[22] ? static_cast(atoi(row[22])) : 0; + e.corruption_resist = row[23] ? static_cast(atoi(row[23])) : 0; + e.heroic_strength = row[24] ? static_cast(atoi(row[24])) : 0; + e.heroic_stamina = row[25] ? static_cast(atoi(row[25])) : 0; + e.heroic_dexterity = row[26] ? static_cast(atoi(row[26])) : 0; + e.heroic_agility = row[27] ? static_cast(atoi(row[27])) : 0; + e.heroic_intelligence = row[28] ? static_cast(atoi(row[28])) : 0; + e.heroic_wisdom = row[29] ? static_cast(atoi(row[29])) : 0; + e.heroic_charisma = row[30] ? static_cast(atoi(row[30])) : 0; + e.heroic_magic_resist = row[31] ? static_cast(atoi(row[31])) : 0; + e.heroic_fire_resist = row[32] ? static_cast(atoi(row[32])) : 0; + e.heroic_cold_resist = row[33] ? static_cast(atoi(row[33])) : 0; + e.heroic_poison_resist = row[34] ? static_cast(atoi(row[34])) : 0; + e.heroic_disease_resist = row[35] ? static_cast(atoi(row[35])) : 0; + e.heroic_corruption_resist = row[36] ? static_cast(atoi(row[36])) : 0; + e.haste = row[37] ? static_cast(atoi(row[37])) : 0; + e.accuracy = row[38] ? static_cast(atoi(row[38])) : 0; + e.attack = row[39] ? static_cast(atoi(row[39])) : 0; + e.avoidance = row[40] ? static_cast(atoi(row[40])) : 0; + e.clairvoyance = row[41] ? static_cast(atoi(row[41])) : 0; + e.combat_effects = row[42] ? static_cast(atoi(row[42])) : 0; + e.damage_shield_mitigation = row[43] ? static_cast(atoi(row[43])) : 0; + e.damage_shield = row[44] ? static_cast(atoi(row[44])) : 0; + e.dot_shielding = row[45] ? static_cast(atoi(row[45])) : 0; + e.hp_regen = row[46] ? static_cast(atoi(row[46])) : 0; + e.mana_regen = row[47] ? static_cast(atoi(row[47])) : 0; + e.endurance_regen = row[48] ? static_cast(atoi(row[48])) : 0; + e.shielding = row[49] ? static_cast(atoi(row[49])) : 0; + e.spell_damage = row[50] ? static_cast(atoi(row[50])) : 0; + e.spell_shielding = row[51] ? static_cast(atoi(row[51])) : 0; + e.strikethrough = row[52] ? static_cast(atoi(row[52])) : 0; + e.stun_resist = row[53] ? static_cast(atoi(row[53])) : 0; + e.backstab = row[54] ? static_cast(atoi(row[54])) : 0; + e.wind = row[55] ? static_cast(atoi(row[55])) : 0; + e.brass = row[56] ? static_cast(atoi(row[56])) : 0; + e.string = row[57] ? static_cast(atoi(row[57])) : 0; + e.percussion = row[58] ? static_cast(atoi(row[58])) : 0; + e.singing = row[59] ? static_cast(atoi(row[59])) : 0; + e.baking = row[60] ? static_cast(atoi(row[60])) : 0; + e.alchemy = row[61] ? static_cast(atoi(row[61])) : 0; + e.tailoring = row[62] ? static_cast(atoi(row[62])) : 0; + e.blacksmithing = row[63] ? static_cast(atoi(row[63])) : 0; + e.fletching = row[64] ? static_cast(atoi(row[64])) : 0; + e.brewing = row[65] ? static_cast(atoi(row[65])) : 0; + e.jewelry = row[66] ? static_cast(atoi(row[66])) : 0; + e.pottery = row[67] ? static_cast(atoi(row[67])) : 0; + e.research = row[68] ? static_cast(atoi(row[68])) : 0; + e.alcohol = row[69] ? static_cast(atoi(row[69])) : 0; + e.fishing = row[70] ? static_cast(atoi(row[70])) : 0; + e.tinkering = row[71] ? static_cast(atoi(row[71])) : 0; e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10); e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10); @@ -586,8 +586,8 @@ public: v.push_back(columns[69] + " = " + std::to_string(e.alcohol)); v.push_back(columns[70] + " = " + std::to_string(e.fishing)); v.push_back(columns[71] + " = " + std::to_string(e.tinkering)); - v.push_back(columns[72] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back(columns[72] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -681,8 +681,8 @@ public: v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -784,8 +784,8 @@ public: v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -819,78 +819,78 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterStatsRecord e{}; - e.character_id = static_cast(atoi(row[0])); + e.character_id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.status = static_cast(atoi(row[2])); - e.level = static_cast(atoi(row[3])); - e.class_ = static_cast(atoi(row[4])); - e.race = static_cast(atoi(row[5])); - e.aa_points = static_cast(atoi(row[6])); + e.status = row[2] ? static_cast(atoi(row[2])) : 0; + e.level = row[3] ? static_cast(atoi(row[3])) : 0; + e.class_ = row[4] ? static_cast(atoi(row[4])) : 0; + e.race = row[5] ? static_cast(atoi(row[5])) : 0; + e.aa_points = row[6] ? static_cast(atoi(row[6])) : 0; e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0; e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0; e.endurance = row[9] ? strtoll(row[9], nullptr, 10) : 0; - e.ac = static_cast(atoi(row[10])); - e.strength = static_cast(atoi(row[11])); - e.stamina = static_cast(atoi(row[12])); - e.dexterity = static_cast(atoi(row[13])); - e.agility = static_cast(atoi(row[14])); - e.intelligence = static_cast(atoi(row[15])); - e.wisdom = static_cast(atoi(row[16])); - e.charisma = static_cast(atoi(row[17])); - e.magic_resist = static_cast(atoi(row[18])); - e.fire_resist = static_cast(atoi(row[19])); - e.cold_resist = static_cast(atoi(row[20])); - e.poison_resist = static_cast(atoi(row[21])); - e.disease_resist = static_cast(atoi(row[22])); - e.corruption_resist = static_cast(atoi(row[23])); - e.heroic_strength = static_cast(atoi(row[24])); - e.heroic_stamina = static_cast(atoi(row[25])); - e.heroic_dexterity = static_cast(atoi(row[26])); - e.heroic_agility = static_cast(atoi(row[27])); - e.heroic_intelligence = static_cast(atoi(row[28])); - e.heroic_wisdom = static_cast(atoi(row[29])); - e.heroic_charisma = static_cast(atoi(row[30])); - e.heroic_magic_resist = static_cast(atoi(row[31])); - e.heroic_fire_resist = static_cast(atoi(row[32])); - e.heroic_cold_resist = static_cast(atoi(row[33])); - e.heroic_poison_resist = static_cast(atoi(row[34])); - e.heroic_disease_resist = static_cast(atoi(row[35])); - e.heroic_corruption_resist = static_cast(atoi(row[36])); - e.haste = static_cast(atoi(row[37])); - e.accuracy = static_cast(atoi(row[38])); - e.attack = static_cast(atoi(row[39])); - e.avoidance = static_cast(atoi(row[40])); - e.clairvoyance = static_cast(atoi(row[41])); - e.combat_effects = static_cast(atoi(row[42])); - e.damage_shield_mitigation = static_cast(atoi(row[43])); - e.damage_shield = static_cast(atoi(row[44])); - e.dot_shielding = static_cast(atoi(row[45])); - e.hp_regen = static_cast(atoi(row[46])); - e.mana_regen = static_cast(atoi(row[47])); - e.endurance_regen = static_cast(atoi(row[48])); - e.shielding = static_cast(atoi(row[49])); - e.spell_damage = static_cast(atoi(row[50])); - e.spell_shielding = static_cast(atoi(row[51])); - e.strikethrough = static_cast(atoi(row[52])); - e.stun_resist = static_cast(atoi(row[53])); - e.backstab = static_cast(atoi(row[54])); - e.wind = static_cast(atoi(row[55])); - e.brass = static_cast(atoi(row[56])); - e.string = static_cast(atoi(row[57])); - e.percussion = static_cast(atoi(row[58])); - e.singing = static_cast(atoi(row[59])); - e.baking = static_cast(atoi(row[60])); - e.alchemy = static_cast(atoi(row[61])); - e.tailoring = static_cast(atoi(row[62])); - e.blacksmithing = static_cast(atoi(row[63])); - e.fletching = static_cast(atoi(row[64])); - e.brewing = static_cast(atoi(row[65])); - e.jewelry = static_cast(atoi(row[66])); - e.pottery = static_cast(atoi(row[67])); - e.research = static_cast(atoi(row[68])); - e.alcohol = static_cast(atoi(row[69])); - e.fishing = static_cast(atoi(row[70])); - e.tinkering = static_cast(atoi(row[71])); + e.ac = row[10] ? static_cast(atoi(row[10])) : 0; + e.strength = row[11] ? static_cast(atoi(row[11])) : 0; + e.stamina = row[12] ? static_cast(atoi(row[12])) : 0; + e.dexterity = row[13] ? static_cast(atoi(row[13])) : 0; + e.agility = row[14] ? static_cast(atoi(row[14])) : 0; + e.intelligence = row[15] ? static_cast(atoi(row[15])) : 0; + e.wisdom = row[16] ? static_cast(atoi(row[16])) : 0; + e.charisma = row[17] ? static_cast(atoi(row[17])) : 0; + e.magic_resist = row[18] ? static_cast(atoi(row[18])) : 0; + e.fire_resist = row[19] ? static_cast(atoi(row[19])) : 0; + e.cold_resist = row[20] ? static_cast(atoi(row[20])) : 0; + e.poison_resist = row[21] ? static_cast(atoi(row[21])) : 0; + e.disease_resist = row[22] ? static_cast(atoi(row[22])) : 0; + e.corruption_resist = row[23] ? static_cast(atoi(row[23])) : 0; + e.heroic_strength = row[24] ? static_cast(atoi(row[24])) : 0; + e.heroic_stamina = row[25] ? static_cast(atoi(row[25])) : 0; + e.heroic_dexterity = row[26] ? static_cast(atoi(row[26])) : 0; + e.heroic_agility = row[27] ? static_cast(atoi(row[27])) : 0; + e.heroic_intelligence = row[28] ? static_cast(atoi(row[28])) : 0; + e.heroic_wisdom = row[29] ? static_cast(atoi(row[29])) : 0; + e.heroic_charisma = row[30] ? static_cast(atoi(row[30])) : 0; + e.heroic_magic_resist = row[31] ? static_cast(atoi(row[31])) : 0; + e.heroic_fire_resist = row[32] ? static_cast(atoi(row[32])) : 0; + e.heroic_cold_resist = row[33] ? static_cast(atoi(row[33])) : 0; + e.heroic_poison_resist = row[34] ? static_cast(atoi(row[34])) : 0; + e.heroic_disease_resist = row[35] ? static_cast(atoi(row[35])) : 0; + e.heroic_corruption_resist = row[36] ? static_cast(atoi(row[36])) : 0; + e.haste = row[37] ? static_cast(atoi(row[37])) : 0; + e.accuracy = row[38] ? static_cast(atoi(row[38])) : 0; + e.attack = row[39] ? static_cast(atoi(row[39])) : 0; + e.avoidance = row[40] ? static_cast(atoi(row[40])) : 0; + e.clairvoyance = row[41] ? static_cast(atoi(row[41])) : 0; + e.combat_effects = row[42] ? static_cast(atoi(row[42])) : 0; + e.damage_shield_mitigation = row[43] ? static_cast(atoi(row[43])) : 0; + e.damage_shield = row[44] ? static_cast(atoi(row[44])) : 0; + e.dot_shielding = row[45] ? static_cast(atoi(row[45])) : 0; + e.hp_regen = row[46] ? static_cast(atoi(row[46])) : 0; + e.mana_regen = row[47] ? static_cast(atoi(row[47])) : 0; + e.endurance_regen = row[48] ? static_cast(atoi(row[48])) : 0; + e.shielding = row[49] ? static_cast(atoi(row[49])) : 0; + e.spell_damage = row[50] ? static_cast(atoi(row[50])) : 0; + e.spell_shielding = row[51] ? static_cast(atoi(row[51])) : 0; + e.strikethrough = row[52] ? static_cast(atoi(row[52])) : 0; + e.stun_resist = row[53] ? static_cast(atoi(row[53])) : 0; + e.backstab = row[54] ? static_cast(atoi(row[54])) : 0; + e.wind = row[55] ? static_cast(atoi(row[55])) : 0; + e.brass = row[56] ? static_cast(atoi(row[56])) : 0; + e.string = row[57] ? static_cast(atoi(row[57])) : 0; + e.percussion = row[58] ? static_cast(atoi(row[58])) : 0; + e.singing = row[59] ? static_cast(atoi(row[59])) : 0; + e.baking = row[60] ? static_cast(atoi(row[60])) : 0; + e.alchemy = row[61] ? static_cast(atoi(row[61])) : 0; + e.tailoring = row[62] ? static_cast(atoi(row[62])) : 0; + e.blacksmithing = row[63] ? static_cast(atoi(row[63])) : 0; + e.fletching = row[64] ? static_cast(atoi(row[64])) : 0; + e.brewing = row[65] ? static_cast(atoi(row[65])) : 0; + e.jewelry = row[66] ? static_cast(atoi(row[66])) : 0; + e.pottery = row[67] ? static_cast(atoi(row[67])) : 0; + e.research = row[68] ? static_cast(atoi(row[68])) : 0; + e.alcohol = row[69] ? static_cast(atoi(row[69])) : 0; + e.fishing = row[70] ? static_cast(atoi(row[70])) : 0; + e.tinkering = row[71] ? static_cast(atoi(row[71])) : 0; e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10); e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10); @@ -917,78 +917,78 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterStatsRecord e{}; - e.character_id = static_cast(atoi(row[0])); + e.character_id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.status = static_cast(atoi(row[2])); - e.level = static_cast(atoi(row[3])); - e.class_ = static_cast(atoi(row[4])); - e.race = static_cast(atoi(row[5])); - e.aa_points = static_cast(atoi(row[6])); + e.status = row[2] ? static_cast(atoi(row[2])) : 0; + e.level = row[3] ? static_cast(atoi(row[3])) : 0; + e.class_ = row[4] ? static_cast(atoi(row[4])) : 0; + e.race = row[5] ? static_cast(atoi(row[5])) : 0; + e.aa_points = row[6] ? static_cast(atoi(row[6])) : 0; e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0; e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0; e.endurance = row[9] ? strtoll(row[9], nullptr, 10) : 0; - e.ac = static_cast(atoi(row[10])); - e.strength = static_cast(atoi(row[11])); - e.stamina = static_cast(atoi(row[12])); - e.dexterity = static_cast(atoi(row[13])); - e.agility = static_cast(atoi(row[14])); - e.intelligence = static_cast(atoi(row[15])); - e.wisdom = static_cast(atoi(row[16])); - e.charisma = static_cast(atoi(row[17])); - e.magic_resist = static_cast(atoi(row[18])); - e.fire_resist = static_cast(atoi(row[19])); - e.cold_resist = static_cast(atoi(row[20])); - e.poison_resist = static_cast(atoi(row[21])); - e.disease_resist = static_cast(atoi(row[22])); - e.corruption_resist = static_cast(atoi(row[23])); - e.heroic_strength = static_cast(atoi(row[24])); - e.heroic_stamina = static_cast(atoi(row[25])); - e.heroic_dexterity = static_cast(atoi(row[26])); - e.heroic_agility = static_cast(atoi(row[27])); - e.heroic_intelligence = static_cast(atoi(row[28])); - e.heroic_wisdom = static_cast(atoi(row[29])); - e.heroic_charisma = static_cast(atoi(row[30])); - e.heroic_magic_resist = static_cast(atoi(row[31])); - e.heroic_fire_resist = static_cast(atoi(row[32])); - e.heroic_cold_resist = static_cast(atoi(row[33])); - e.heroic_poison_resist = static_cast(atoi(row[34])); - e.heroic_disease_resist = static_cast(atoi(row[35])); - e.heroic_corruption_resist = static_cast(atoi(row[36])); - e.haste = static_cast(atoi(row[37])); - e.accuracy = static_cast(atoi(row[38])); - e.attack = static_cast(atoi(row[39])); - e.avoidance = static_cast(atoi(row[40])); - e.clairvoyance = static_cast(atoi(row[41])); - e.combat_effects = static_cast(atoi(row[42])); - e.damage_shield_mitigation = static_cast(atoi(row[43])); - e.damage_shield = static_cast(atoi(row[44])); - e.dot_shielding = static_cast(atoi(row[45])); - e.hp_regen = static_cast(atoi(row[46])); - e.mana_regen = static_cast(atoi(row[47])); - e.endurance_regen = static_cast(atoi(row[48])); - e.shielding = static_cast(atoi(row[49])); - e.spell_damage = static_cast(atoi(row[50])); - e.spell_shielding = static_cast(atoi(row[51])); - e.strikethrough = static_cast(atoi(row[52])); - e.stun_resist = static_cast(atoi(row[53])); - e.backstab = static_cast(atoi(row[54])); - e.wind = static_cast(atoi(row[55])); - e.brass = static_cast(atoi(row[56])); - e.string = static_cast(atoi(row[57])); - e.percussion = static_cast(atoi(row[58])); - e.singing = static_cast(atoi(row[59])); - e.baking = static_cast(atoi(row[60])); - e.alchemy = static_cast(atoi(row[61])); - e.tailoring = static_cast(atoi(row[62])); - e.blacksmithing = static_cast(atoi(row[63])); - e.fletching = static_cast(atoi(row[64])); - e.brewing = static_cast(atoi(row[65])); - e.jewelry = static_cast(atoi(row[66])); - e.pottery = static_cast(atoi(row[67])); - e.research = static_cast(atoi(row[68])); - e.alcohol = static_cast(atoi(row[69])); - e.fishing = static_cast(atoi(row[70])); - e.tinkering = static_cast(atoi(row[71])); + e.ac = row[10] ? static_cast(atoi(row[10])) : 0; + e.strength = row[11] ? static_cast(atoi(row[11])) : 0; + e.stamina = row[12] ? static_cast(atoi(row[12])) : 0; + e.dexterity = row[13] ? static_cast(atoi(row[13])) : 0; + e.agility = row[14] ? static_cast(atoi(row[14])) : 0; + e.intelligence = row[15] ? static_cast(atoi(row[15])) : 0; + e.wisdom = row[16] ? static_cast(atoi(row[16])) : 0; + e.charisma = row[17] ? static_cast(atoi(row[17])) : 0; + e.magic_resist = row[18] ? static_cast(atoi(row[18])) : 0; + e.fire_resist = row[19] ? static_cast(atoi(row[19])) : 0; + e.cold_resist = row[20] ? static_cast(atoi(row[20])) : 0; + e.poison_resist = row[21] ? static_cast(atoi(row[21])) : 0; + e.disease_resist = row[22] ? static_cast(atoi(row[22])) : 0; + e.corruption_resist = row[23] ? static_cast(atoi(row[23])) : 0; + e.heroic_strength = row[24] ? static_cast(atoi(row[24])) : 0; + e.heroic_stamina = row[25] ? static_cast(atoi(row[25])) : 0; + e.heroic_dexterity = row[26] ? static_cast(atoi(row[26])) : 0; + e.heroic_agility = row[27] ? static_cast(atoi(row[27])) : 0; + e.heroic_intelligence = row[28] ? static_cast(atoi(row[28])) : 0; + e.heroic_wisdom = row[29] ? static_cast(atoi(row[29])) : 0; + e.heroic_charisma = row[30] ? static_cast(atoi(row[30])) : 0; + e.heroic_magic_resist = row[31] ? static_cast(atoi(row[31])) : 0; + e.heroic_fire_resist = row[32] ? static_cast(atoi(row[32])) : 0; + e.heroic_cold_resist = row[33] ? static_cast(atoi(row[33])) : 0; + e.heroic_poison_resist = row[34] ? static_cast(atoi(row[34])) : 0; + e.heroic_disease_resist = row[35] ? static_cast(atoi(row[35])) : 0; + e.heroic_corruption_resist = row[36] ? static_cast(atoi(row[36])) : 0; + e.haste = row[37] ? static_cast(atoi(row[37])) : 0; + e.accuracy = row[38] ? static_cast(atoi(row[38])) : 0; + e.attack = row[39] ? static_cast(atoi(row[39])) : 0; + e.avoidance = row[40] ? static_cast(atoi(row[40])) : 0; + e.clairvoyance = row[41] ? static_cast(atoi(row[41])) : 0; + e.combat_effects = row[42] ? static_cast(atoi(row[42])) : 0; + e.damage_shield_mitigation = row[43] ? static_cast(atoi(row[43])) : 0; + e.damage_shield = row[44] ? static_cast(atoi(row[44])) : 0; + e.dot_shielding = row[45] ? static_cast(atoi(row[45])) : 0; + e.hp_regen = row[46] ? static_cast(atoi(row[46])) : 0; + e.mana_regen = row[47] ? static_cast(atoi(row[47])) : 0; + e.endurance_regen = row[48] ? static_cast(atoi(row[48])) : 0; + e.shielding = row[49] ? static_cast(atoi(row[49])) : 0; + e.spell_damage = row[50] ? static_cast(atoi(row[50])) : 0; + e.spell_shielding = row[51] ? static_cast(atoi(row[51])) : 0; + e.strikethrough = row[52] ? static_cast(atoi(row[52])) : 0; + e.stun_resist = row[53] ? static_cast(atoi(row[53])) : 0; + e.backstab = row[54] ? static_cast(atoi(row[54])) : 0; + e.wind = row[55] ? static_cast(atoi(row[55])) : 0; + e.brass = row[56] ? static_cast(atoi(row[56])) : 0; + e.string = row[57] ? static_cast(atoi(row[57])) : 0; + e.percussion = row[58] ? static_cast(atoi(row[58])) : 0; + e.singing = row[59] ? static_cast(atoi(row[59])) : 0; + e.baking = row[60] ? static_cast(atoi(row[60])) : 0; + e.alchemy = row[61] ? static_cast(atoi(row[61])) : 0; + e.tailoring = row[62] ? static_cast(atoi(row[62])) : 0; + e.blacksmithing = row[63] ? static_cast(atoi(row[63])) : 0; + e.fletching = row[64] ? static_cast(atoi(row[64])) : 0; + e.brewing = row[65] ? static_cast(atoi(row[65])) : 0; + e.jewelry = row[66] ? static_cast(atoi(row[66])) : 0; + e.pottery = row[67] ? static_cast(atoi(row[67])) : 0; + e.research = row[68] ? static_cast(atoi(row[68])) : 0; + e.alcohol = row[69] ? static_cast(atoi(row[69])) : 0; + e.fishing = row[70] ? static_cast(atoi(row[70])) : 0; + e.tinkering = row[71] ? static_cast(atoi(row[71])) : 0; e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10); e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10); @@ -1137,8 +1137,8 @@ public: v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -1233,8 +1233,8 @@ public: v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_character_task_timers_repository.h b/common/repositories/base/base_character_task_timers_repository.h index d76fadc9b..ae23a88ba 100644 --- a/common/repositories/base/base_character_task_timers_repository.h +++ b/common/repositories/base/base_character_task_timers_repository.h @@ -138,8 +138,8 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.task_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.timer_type = static_cast(atoi(row[3])); - e.timer_group = static_cast(atoi(row[4])); + e.timer_type = row[3] ? static_cast(atoi(row[3])) : 0; + e.timer_group = row[4] ? static_cast(atoi(row[4])) : 0; e.expire_time = strtoll(row[5] ? row[5] : "-1", nullptr, 10); return e; @@ -178,7 +178,7 @@ public: v.push_back(columns[2] + " = " + std::to_string(e.task_id)); v.push_back(columns[3] + " = " + std::to_string(e.timer_type)); v.push_back(columns[4] + " = " + std::to_string(e.timer_group)); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -205,7 +205,7 @@ public: v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -240,7 +240,7 @@ public: v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -277,8 +277,8 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.task_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.timer_type = static_cast(atoi(row[3])); - e.timer_group = static_cast(atoi(row[4])); + e.timer_type = row[3] ? static_cast(atoi(row[3])) : 0; + e.timer_group = row[4] ? static_cast(atoi(row[4])) : 0; e.expire_time = strtoll(row[5] ? row[5] : "-1", nullptr, 10); all_entries.push_back(e); @@ -307,8 +307,8 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.task_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.timer_type = static_cast(atoi(row[3])); - e.timer_group = static_cast(atoi(row[4])); + e.timer_type = row[3] ? static_cast(atoi(row[3])) : 0; + e.timer_group = row[4] ? static_cast(atoi(row[4])) : 0; e.expire_time = strtoll(row[5] ? row[5] : "-1", nullptr, 10); all_entries.push_back(e); @@ -389,7 +389,7 @@ public: v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -417,7 +417,7 @@ public: v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_character_tasks_repository.h b/common/repositories/base/base_character_tasks_repository.h index d0e38a8d1..e28e5f7df 100644 --- a/common/repositories/base/base_character_tasks_repository.h +++ b/common/repositories/base/base_character_tasks_repository.h @@ -138,9 +138,9 @@ public: e.charid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.taskid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.slot = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[3])); + e.type = row[3] ? static_cast(atoi(row[3])) : 0; e.acceptedtime = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.was_rewarded = static_cast(atoi(row[5])); + e.was_rewarded = row[5] ? static_cast(atoi(row[5])) : 0; return e; } @@ -278,9 +278,9 @@ public: e.charid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.taskid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.slot = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[3])); + e.type = row[3] ? static_cast(atoi(row[3])) : 0; e.acceptedtime = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.was_rewarded = static_cast(atoi(row[5])); + e.was_rewarded = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -308,9 +308,9 @@ public: e.charid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.taskid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.slot = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[3])); + e.type = row[3] ? static_cast(atoi(row[3])) : 0; e.acceptedtime = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.was_rewarded = static_cast(atoi(row[5])); + e.was_rewarded = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_character_tribute_repository.h b/common/repositories/base/base_character_tribute_repository.h index 70d315b31..53edda1d4 100644 --- a/common/repositories/base/base_character_tribute_repository.h +++ b/common/repositories/base/base_character_tribute_repository.h @@ -127,7 +127,7 @@ public: if (results.RowCount() == 1) { CharacterTribute e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.tier = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.tribute = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; @@ -258,7 +258,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterTribute e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.tier = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.tribute = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; @@ -286,7 +286,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterTribute e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.character_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.tier = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.tribute = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_chatchannel_reserved_names_repository.h b/common/repositories/base/base_chatchannel_reserved_names_repository.h index 04474ec78..7a8d715d8 100644 --- a/common/repositories/base/base_chatchannel_reserved_names_repository.h +++ b/common/repositories/base/base_chatchannel_reserved_names_repository.h @@ -119,7 +119,7 @@ public: if (results.RowCount() == 1) { ChatchannelReservedNames e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; return e; @@ -242,7 +242,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ChatchannelReservedNames e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; all_entries.push_back(e); @@ -268,7 +268,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ChatchannelReservedNames e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_chatchannels_repository.h b/common/repositories/base/base_chatchannels_repository.h index 035155d23..4bea08c82 100644 --- a/common/repositories/base/base_chatchannels_repository.h +++ b/common/repositories/base/base_chatchannels_repository.h @@ -131,11 +131,11 @@ public: if (results.RowCount() == 1) { Chatchannels e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.owner = row[2] ? row[2] : ""; e.password = row[3] ? row[3] : ""; - e.minstatus = static_cast(atoi(row[4])); + e.minstatus = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -266,11 +266,11 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Chatchannels e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.owner = row[2] ? row[2] : ""; e.password = row[3] ? row[3] : ""; - e.minstatus = static_cast(atoi(row[4])); + e.minstatus = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -295,11 +295,11 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Chatchannels e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.owner = row[2] ? row[2] : ""; e.password = row[3] ? row[3] : ""; - e.minstatus = static_cast(atoi(row[4])); + e.minstatus = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_completed_shared_task_activity_state_repository.h b/common/repositories/base/base_completed_shared_task_activity_state_repository.h index 36d4223df..d596c191c 100644 --- a/common/repositories/base/base_completed_shared_task_activity_state_repository.h +++ b/common/repositories/base/base_completed_shared_task_activity_state_repository.h @@ -132,8 +132,8 @@ public: CompletedSharedTaskActivityState e{}; e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.activity_id = static_cast(atoi(row[1])); - e.done_count = static_cast(atoi(row[2])); + e.activity_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.done_count = row[2] ? static_cast(atoi(row[2])) : 0; e.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); @@ -172,8 +172,8 @@ public: v.push_back(columns[0] + " = " + std::to_string(e.shared_task_id)); v.push_back(columns[1] + " = " + std::to_string(e.activity_id)); v.push_back(columns[2] + " = " + std::to_string(e.done_count)); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -198,8 +198,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -232,8 +232,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -268,8 +268,8 @@ public: CompletedSharedTaskActivityState e{}; e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.activity_id = static_cast(atoi(row[1])); - e.done_count = static_cast(atoi(row[2])); + e.activity_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.done_count = row[2] ? static_cast(atoi(row[2])) : 0; e.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); @@ -297,8 +297,8 @@ public: CompletedSharedTaskActivityState e{}; e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.activity_id = static_cast(atoi(row[1])); - e.done_count = static_cast(atoi(row[2])); + e.activity_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.done_count = row[2] ? static_cast(atoi(row[2])) : 0; e.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); @@ -378,8 +378,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -405,8 +405,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_completed_shared_task_members_repository.h b/common/repositories/base/base_completed_shared_task_members_repository.h index 80e4fbdab..a748097f8 100644 --- a/common/repositories/base/base_completed_shared_task_members_repository.h +++ b/common/repositories/base/base_completed_shared_task_members_repository.h @@ -125,7 +125,7 @@ public: e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.character_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; - e.is_leader = static_cast(atoi(row[2])); + e.is_leader = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -253,7 +253,7 @@ public: e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.character_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; - e.is_leader = static_cast(atoi(row[2])); + e.is_leader = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -280,7 +280,7 @@ public: e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.character_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; - e.is_leader = static_cast(atoi(row[2])); + e.is_leader = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_completed_shared_tasks_repository.h b/common/repositories/base/base_completed_shared_tasks_repository.h index 8327b5ec8..a3a580d20 100644 --- a/common/repositories/base/base_completed_shared_tasks_repository.h +++ b/common/repositories/base/base_completed_shared_tasks_repository.h @@ -136,11 +136,11 @@ public: CompletedSharedTasks e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.task_id = static_cast(atoi(row[1])); + e.task_id = row[1] ? static_cast(atoi(row[1])) : 0; e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10); e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); - e.is_locked = static_cast(atoi(row[5])); + e.is_locked = row[5] ? static_cast(atoi(row[5])) : 0; return e; } @@ -176,9 +176,9 @@ public: v.push_back(columns[0] + " = " + std::to_string(e.id)); v.push_back(columns[1] + " = " + std::to_string(e.task_id)); - v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[5] + " = " + std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -203,9 +203,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -238,9 +238,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); @@ -276,11 +276,11 @@ public: CompletedSharedTasks e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.task_id = static_cast(atoi(row[1])); + e.task_id = row[1] ? static_cast(atoi(row[1])) : 0; e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10); e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); - e.is_locked = static_cast(atoi(row[5])); + e.is_locked = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -306,11 +306,11 @@ public: CompletedSharedTasks e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.task_id = static_cast(atoi(row[1])); + e.task_id = row[1] ? static_cast(atoi(row[1])) : 0; e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10); e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); - e.is_locked = static_cast(atoi(row[5])); + e.is_locked = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -387,9 +387,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -415,9 +415,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); diff --git a/common/repositories/base/base_completed_tasks_repository.h b/common/repositories/base/base_completed_tasks_repository.h index 4adf2a838..1e936d65e 100644 --- a/common/repositories/base/base_completed_tasks_repository.h +++ b/common/repositories/base/base_completed_tasks_repository.h @@ -130,7 +130,7 @@ public: e.charid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.completedtime = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.taskid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.activityid = static_cast(atoi(row[3])); + e.activityid = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -262,7 +262,7 @@ public: e.charid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.completedtime = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.taskid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.activityid = static_cast(atoi(row[3])); + e.activityid = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -290,7 +290,7 @@ public: e.charid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.completedtime = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.taskid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.activityid = static_cast(atoi(row[3])); + e.activityid = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_content_flags_repository.h b/common/repositories/base/base_content_flags_repository.h index fa3ee3094..339d7a95c 100644 --- a/common/repositories/base/base_content_flags_repository.h +++ b/common/repositories/base/base_content_flags_repository.h @@ -127,9 +127,9 @@ public: if (results.RowCount() == 1) { ContentFlags e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.flag_name = row[1] ? row[1] : ""; - e.enabled = static_cast(atoi(row[2])); + e.enabled = row[2] ? static_cast(atoi(row[2])) : 0; e.notes = row[3] ? row[3] : ""; return e; @@ -258,9 +258,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ContentFlags e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.flag_name = row[1] ? row[1] : ""; - e.enabled = static_cast(atoi(row[2])); + e.enabled = row[2] ? static_cast(atoi(row[2])) : 0; e.notes = row[3] ? row[3] : ""; all_entries.push_back(e); @@ -286,9 +286,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ContentFlags e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.flag_name = row[1] ? row[1] : ""; - e.enabled = static_cast(atoi(row[2])); + e.enabled = row[2] ? static_cast(atoi(row[2])) : 0; e.notes = row[3] ? row[3] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_db_str_repository.h b/common/repositories/base/base_db_str_repository.h index ad1ef0e2e..f520e1ca9 100644 --- a/common/repositories/base/base_db_str_repository.h +++ b/common/repositories/base/base_db_str_repository.h @@ -123,8 +123,8 @@ public: if (results.RowCount() == 1) { DbStr e{}; - e.id = static_cast(atoi(row[0])); - e.type = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.type = row[1] ? static_cast(atoi(row[1])) : 0; e.value = row[2] ? row[2] : ""; return e; @@ -251,8 +251,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { DbStr e{}; - e.id = static_cast(atoi(row[0])); - e.type = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.type = row[1] ? static_cast(atoi(row[1])) : 0; e.value = row[2] ? row[2] : ""; all_entries.push_back(e); @@ -278,8 +278,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { DbStr e{}; - e.id = static_cast(atoi(row[0])); - e.type = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.type = row[1] ? static_cast(atoi(row[1])) : 0; e.value = row[2] ? row[2] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_discord_webhooks_repository.h b/common/repositories/base/base_discord_webhooks_repository.h index b4ed89083..ba897eed3 100644 --- a/common/repositories/base/base_discord_webhooks_repository.h +++ b/common/repositories/base/base_discord_webhooks_repository.h @@ -131,7 +131,7 @@ public: if (results.RowCount() == 1) { DiscordWebhooks e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.webhook_name = row[1] ? row[1] : ""; e.webhook_url = row[2] ? row[2] : ""; e.created_at = strtoll(row[3] ? row[3] : "-1", nullptr, 10); @@ -171,8 +171,8 @@ public: v.push_back(columns[1] + " = '" + Strings::Escape(e.webhook_name) + "'"); v.push_back(columns[2] + " = '" + Strings::Escape(e.webhook_url) + "'"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -197,8 +197,8 @@ public: v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -231,8 +231,8 @@ public: v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -266,7 +266,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { DiscordWebhooks e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.webhook_name = row[1] ? row[1] : ""; e.webhook_url = row[2] ? row[2] : ""; e.created_at = strtoll(row[3] ? row[3] : "-1", nullptr, 10); @@ -295,7 +295,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { DiscordWebhooks e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.webhook_name = row[1] ? row[1] : ""; e.webhook_url = row[2] ? row[2] : ""; e.created_at = strtoll(row[3] ? row[3] : "-1", nullptr, 10); @@ -377,8 +377,8 @@ public: v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -404,8 +404,8 @@ public: v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_discovered_items_repository.h b/common/repositories/base/base_discovered_items_repository.h index c6f494c1b..cdb8a92b1 100644 --- a/common/repositories/base/base_discovered_items_repository.h +++ b/common/repositories/base/base_discovered_items_repository.h @@ -130,7 +130,7 @@ public: e.item_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.char_name = row[1] ? row[1] : ""; e.discovered_date = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.account_status = static_cast(atoi(row[3])); + e.account_status = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -262,7 +262,7 @@ public: e.item_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.char_name = row[1] ? row[1] : ""; e.discovered_date = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.account_status = static_cast(atoi(row[3])); + e.account_status = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -290,7 +290,7 @@ public: e.item_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.char_name = row[1] ? row[1] : ""; e.discovered_date = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.account_status = static_cast(atoi(row[3])); + e.account_status = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_doors_repository.h b/common/repositories/base/base_doors_repository.h index fde8aefaf..03fabd6a9 100644 --- a/common/repositories/base/base_doors_repository.h +++ b/common/repositories/base/base_doors_repository.h @@ -255,40 +255,40 @@ public: if (results.RowCount() == 1) { Doors e{}; - e.id = static_cast(atoi(row[0])); - e.doorid = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.doorid = row[1] ? static_cast(atoi(row[1])) : 0; e.zone = row[2] ? row[2] : ""; - e.version = static_cast(atoi(row[3])); + e.version = row[3] ? static_cast(atoi(row[3])) : 0; e.name = row[4] ? row[4] : ""; e.pos_y = row[5] ? strtof(row[5], nullptr) : 0; e.pos_x = row[6] ? strtof(row[6], nullptr) : 0; e.pos_z = row[7] ? strtof(row[7], nullptr) : 0; e.heading = row[8] ? strtof(row[8], nullptr) : 0; - e.opentype = static_cast(atoi(row[9])); - e.guild = static_cast(atoi(row[10])); - e.lockpick = static_cast(atoi(row[11])); - e.keyitem = static_cast(atoi(row[12])); + e.opentype = row[9] ? static_cast(atoi(row[9])) : 0; + e.guild = row[10] ? static_cast(atoi(row[10])) : 0; + e.lockpick = row[11] ? static_cast(atoi(row[11])) : 0; + e.keyitem = row[12] ? static_cast(atoi(row[12])) : 0; e.nokeyring = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; - e.triggerdoor = static_cast(atoi(row[14])); - e.triggertype = static_cast(atoi(row[15])); - e.disable_timer = static_cast(atoi(row[16])); - e.doorisopen = static_cast(atoi(row[17])); - e.door_param = static_cast(atoi(row[18])); - e.dest_zone = row[19] ? row[19] : ""; + e.triggerdoor = row[14] ? static_cast(atoi(row[14])) : 0; + e.triggertype = row[15] ? static_cast(atoi(row[15])) : 0; + e.disable_timer = row[16] ? static_cast(atoi(row[16])) : 0; + e.doorisopen = row[17] ? static_cast(atoi(row[17])) : 0; + e.door_param = row[18] ? static_cast(atoi(row[18])) : 0; + e.dest_zone = row[19] ? row[19] : "NONE"; e.dest_instance = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.dest_x = row[21] ? strtof(row[21], nullptr) : 0; e.dest_y = row[22] ? strtof(row[22], nullptr) : 0; e.dest_z = row[23] ? strtof(row[23], nullptr) : 0; e.dest_heading = row[24] ? strtof(row[24], nullptr) : 0; - e.invert_state = static_cast(atoi(row[25])); - e.incline = static_cast(atoi(row[26])); + e.invert_state = row[25] ? static_cast(atoi(row[25])) : 0; + e.incline = row[26] ? static_cast(atoi(row[26])) : 0; e.size = row[27] ? static_cast(strtoul(row[27], nullptr, 10)) : 100; e.buffer = row[28] ? strtof(row[28], nullptr) : 0; e.client_version_mask = row[29] ? static_cast(strtoul(row[29], nullptr, 10)) : 4294967295; - e.is_ldon_door = static_cast(atoi(row[30])); - e.dz_switch_id = static_cast(atoi(row[31])); - e.min_expansion = static_cast(atoi(row[32])); - e.max_expansion = static_cast(atoi(row[33])); + e.is_ldon_door = row[30] ? static_cast(atoi(row[30])) : 0; + e.dz_switch_id = row[31] ? static_cast(atoi(row[31])) : 0; + e.min_expansion = row[32] ? static_cast(atoi(row[32])) : -1; + e.max_expansion = row[33] ? static_cast(atoi(row[33])) : -1; e.content_flags = row[34] ? row[34] : ""; e.content_flags_disabled = row[35] ? row[35] : ""; @@ -514,40 +514,40 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Doors e{}; - e.id = static_cast(atoi(row[0])); - e.doorid = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.doorid = row[1] ? static_cast(atoi(row[1])) : 0; e.zone = row[2] ? row[2] : ""; - e.version = static_cast(atoi(row[3])); + e.version = row[3] ? static_cast(atoi(row[3])) : 0; e.name = row[4] ? row[4] : ""; e.pos_y = row[5] ? strtof(row[5], nullptr) : 0; e.pos_x = row[6] ? strtof(row[6], nullptr) : 0; e.pos_z = row[7] ? strtof(row[7], nullptr) : 0; e.heading = row[8] ? strtof(row[8], nullptr) : 0; - e.opentype = static_cast(atoi(row[9])); - e.guild = static_cast(atoi(row[10])); - e.lockpick = static_cast(atoi(row[11])); - e.keyitem = static_cast(atoi(row[12])); + e.opentype = row[9] ? static_cast(atoi(row[9])) : 0; + e.guild = row[10] ? static_cast(atoi(row[10])) : 0; + e.lockpick = row[11] ? static_cast(atoi(row[11])) : 0; + e.keyitem = row[12] ? static_cast(atoi(row[12])) : 0; e.nokeyring = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; - e.triggerdoor = static_cast(atoi(row[14])); - e.triggertype = static_cast(atoi(row[15])); - e.disable_timer = static_cast(atoi(row[16])); - e.doorisopen = static_cast(atoi(row[17])); - e.door_param = static_cast(atoi(row[18])); - e.dest_zone = row[19] ? row[19] : ""; + e.triggerdoor = row[14] ? static_cast(atoi(row[14])) : 0; + e.triggertype = row[15] ? static_cast(atoi(row[15])) : 0; + e.disable_timer = row[16] ? static_cast(atoi(row[16])) : 0; + e.doorisopen = row[17] ? static_cast(atoi(row[17])) : 0; + e.door_param = row[18] ? static_cast(atoi(row[18])) : 0; + e.dest_zone = row[19] ? row[19] : "NONE"; e.dest_instance = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.dest_x = row[21] ? strtof(row[21], nullptr) : 0; e.dest_y = row[22] ? strtof(row[22], nullptr) : 0; e.dest_z = row[23] ? strtof(row[23], nullptr) : 0; e.dest_heading = row[24] ? strtof(row[24], nullptr) : 0; - e.invert_state = static_cast(atoi(row[25])); - e.incline = static_cast(atoi(row[26])); + e.invert_state = row[25] ? static_cast(atoi(row[25])) : 0; + e.incline = row[26] ? static_cast(atoi(row[26])) : 0; e.size = row[27] ? static_cast(strtoul(row[27], nullptr, 10)) : 100; e.buffer = row[28] ? strtof(row[28], nullptr) : 0; e.client_version_mask = row[29] ? static_cast(strtoul(row[29], nullptr, 10)) : 4294967295; - e.is_ldon_door = static_cast(atoi(row[30])); - e.dz_switch_id = static_cast(atoi(row[31])); - e.min_expansion = static_cast(atoi(row[32])); - e.max_expansion = static_cast(atoi(row[33])); + e.is_ldon_door = row[30] ? static_cast(atoi(row[30])) : 0; + e.dz_switch_id = row[31] ? static_cast(atoi(row[31])) : 0; + e.min_expansion = row[32] ? static_cast(atoi(row[32])) : -1; + e.max_expansion = row[33] ? static_cast(atoi(row[33])) : -1; e.content_flags = row[34] ? row[34] : ""; e.content_flags_disabled = row[35] ? row[35] : ""; @@ -574,40 +574,40 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Doors e{}; - e.id = static_cast(atoi(row[0])); - e.doorid = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.doorid = row[1] ? static_cast(atoi(row[1])) : 0; e.zone = row[2] ? row[2] : ""; - e.version = static_cast(atoi(row[3])); + e.version = row[3] ? static_cast(atoi(row[3])) : 0; e.name = row[4] ? row[4] : ""; e.pos_y = row[5] ? strtof(row[5], nullptr) : 0; e.pos_x = row[6] ? strtof(row[6], nullptr) : 0; e.pos_z = row[7] ? strtof(row[7], nullptr) : 0; e.heading = row[8] ? strtof(row[8], nullptr) : 0; - e.opentype = static_cast(atoi(row[9])); - e.guild = static_cast(atoi(row[10])); - e.lockpick = static_cast(atoi(row[11])); - e.keyitem = static_cast(atoi(row[12])); + e.opentype = row[9] ? static_cast(atoi(row[9])) : 0; + e.guild = row[10] ? static_cast(atoi(row[10])) : 0; + e.lockpick = row[11] ? static_cast(atoi(row[11])) : 0; + e.keyitem = row[12] ? static_cast(atoi(row[12])) : 0; e.nokeyring = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; - e.triggerdoor = static_cast(atoi(row[14])); - e.triggertype = static_cast(atoi(row[15])); - e.disable_timer = static_cast(atoi(row[16])); - e.doorisopen = static_cast(atoi(row[17])); - e.door_param = static_cast(atoi(row[18])); - e.dest_zone = row[19] ? row[19] : ""; + e.triggerdoor = row[14] ? static_cast(atoi(row[14])) : 0; + e.triggertype = row[15] ? static_cast(atoi(row[15])) : 0; + e.disable_timer = row[16] ? static_cast(atoi(row[16])) : 0; + e.doorisopen = row[17] ? static_cast(atoi(row[17])) : 0; + e.door_param = row[18] ? static_cast(atoi(row[18])) : 0; + e.dest_zone = row[19] ? row[19] : "NONE"; e.dest_instance = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.dest_x = row[21] ? strtof(row[21], nullptr) : 0; e.dest_y = row[22] ? strtof(row[22], nullptr) : 0; e.dest_z = row[23] ? strtof(row[23], nullptr) : 0; e.dest_heading = row[24] ? strtof(row[24], nullptr) : 0; - e.invert_state = static_cast(atoi(row[25])); - e.incline = static_cast(atoi(row[26])); + e.invert_state = row[25] ? static_cast(atoi(row[25])) : 0; + e.incline = row[26] ? static_cast(atoi(row[26])) : 0; e.size = row[27] ? static_cast(strtoul(row[27], nullptr, 10)) : 100; e.buffer = row[28] ? strtof(row[28], nullptr) : 0; e.client_version_mask = row[29] ? static_cast(strtoul(row[29], nullptr, 10)) : 4294967295; - e.is_ldon_door = static_cast(atoi(row[30])); - e.dz_switch_id = static_cast(atoi(row[31])); - e.min_expansion = static_cast(atoi(row[32])); - e.max_expansion = static_cast(atoi(row[33])); + e.is_ldon_door = row[30] ? static_cast(atoi(row[30])) : 0; + e.dz_switch_id = row[31] ? static_cast(atoi(row[31])) : 0; + e.min_expansion = row[32] ? static_cast(atoi(row[32])) : -1; + e.max_expansion = row[33] ? static_cast(atoi(row[33])) : -1; e.content_flags = row[34] ? row[34] : ""; e.content_flags_disabled = row[35] ? row[35] : ""; diff --git a/common/repositories/base/base_dynamic_zone_templates_repository.h b/common/repositories/base/base_dynamic_zone_templates_repository.h index b72720b65..56c701447 100644 --- a/common/repositories/base/base_dynamic_zone_templates_repository.h +++ b/common/repositories/base/base_dynamic_zone_templates_repository.h @@ -200,23 +200,23 @@ public: DynamicZoneTemplates e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.zone_id = static_cast(atoi(row[1])); - e.zone_version = static_cast(atoi(row[2])); + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.zone_version = row[2] ? static_cast(atoi(row[2])) : 0; e.name = row[3] ? row[3] : ""; - e.min_players = static_cast(atoi(row[4])); - e.max_players = static_cast(atoi(row[5])); - e.duration_seconds = static_cast(atoi(row[6])); - e.dz_switch_id = static_cast(atoi(row[7])); - e.compass_zone_id = static_cast(atoi(row[8])); + e.min_players = row[4] ? static_cast(atoi(row[4])) : 0; + e.max_players = row[5] ? static_cast(atoi(row[5])) : 0; + e.duration_seconds = row[6] ? static_cast(atoi(row[6])) : 0; + e.dz_switch_id = row[7] ? static_cast(atoi(row[7])) : 0; + e.compass_zone_id = row[8] ? static_cast(atoi(row[8])) : 0; e.compass_x = row[9] ? strtof(row[9], nullptr) : 0; e.compass_y = row[10] ? strtof(row[10], nullptr) : 0; e.compass_z = row[11] ? strtof(row[11], nullptr) : 0; - e.return_zone_id = static_cast(atoi(row[12])); + e.return_zone_id = row[12] ? static_cast(atoi(row[12])) : 0; e.return_x = row[13] ? strtof(row[13], nullptr) : 0; e.return_y = row[14] ? strtof(row[14], nullptr) : 0; e.return_z = row[15] ? strtof(row[15], nullptr) : 0; e.return_h = row[16] ? strtof(row[16], nullptr) : 0; - e.override_zone_in = static_cast(atoi(row[17])); + e.override_zone_in = row[17] ? static_cast(atoi(row[17])) : 0; e.zone_in_x = row[18] ? strtof(row[18], nullptr) : 0; e.zone_in_y = row[19] ? strtof(row[19], nullptr) : 0; e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0; @@ -403,23 +403,23 @@ public: DynamicZoneTemplates e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.zone_id = static_cast(atoi(row[1])); - e.zone_version = static_cast(atoi(row[2])); + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.zone_version = row[2] ? static_cast(atoi(row[2])) : 0; e.name = row[3] ? row[3] : ""; - e.min_players = static_cast(atoi(row[4])); - e.max_players = static_cast(atoi(row[5])); - e.duration_seconds = static_cast(atoi(row[6])); - e.dz_switch_id = static_cast(atoi(row[7])); - e.compass_zone_id = static_cast(atoi(row[8])); + e.min_players = row[4] ? static_cast(atoi(row[4])) : 0; + e.max_players = row[5] ? static_cast(atoi(row[5])) : 0; + e.duration_seconds = row[6] ? static_cast(atoi(row[6])) : 0; + e.dz_switch_id = row[7] ? static_cast(atoi(row[7])) : 0; + e.compass_zone_id = row[8] ? static_cast(atoi(row[8])) : 0; e.compass_x = row[9] ? strtof(row[9], nullptr) : 0; e.compass_y = row[10] ? strtof(row[10], nullptr) : 0; e.compass_z = row[11] ? strtof(row[11], nullptr) : 0; - e.return_zone_id = static_cast(atoi(row[12])); + e.return_zone_id = row[12] ? static_cast(atoi(row[12])) : 0; e.return_x = row[13] ? strtof(row[13], nullptr) : 0; e.return_y = row[14] ? strtof(row[14], nullptr) : 0; e.return_z = row[15] ? strtof(row[15], nullptr) : 0; e.return_h = row[16] ? strtof(row[16], nullptr) : 0; - e.override_zone_in = static_cast(atoi(row[17])); + e.override_zone_in = row[17] ? static_cast(atoi(row[17])) : 0; e.zone_in_x = row[18] ? strtof(row[18], nullptr) : 0; e.zone_in_y = row[19] ? strtof(row[19], nullptr) : 0; e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0; @@ -449,23 +449,23 @@ public: DynamicZoneTemplates e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.zone_id = static_cast(atoi(row[1])); - e.zone_version = static_cast(atoi(row[2])); + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.zone_version = row[2] ? static_cast(atoi(row[2])) : 0; e.name = row[3] ? row[3] : ""; - e.min_players = static_cast(atoi(row[4])); - e.max_players = static_cast(atoi(row[5])); - e.duration_seconds = static_cast(atoi(row[6])); - e.dz_switch_id = static_cast(atoi(row[7])); - e.compass_zone_id = static_cast(atoi(row[8])); + e.min_players = row[4] ? static_cast(atoi(row[4])) : 0; + e.max_players = row[5] ? static_cast(atoi(row[5])) : 0; + e.duration_seconds = row[6] ? static_cast(atoi(row[6])) : 0; + e.dz_switch_id = row[7] ? static_cast(atoi(row[7])) : 0; + e.compass_zone_id = row[8] ? static_cast(atoi(row[8])) : 0; e.compass_x = row[9] ? strtof(row[9], nullptr) : 0; e.compass_y = row[10] ? strtof(row[10], nullptr) : 0; e.compass_z = row[11] ? strtof(row[11], nullptr) : 0; - e.return_zone_id = static_cast(atoi(row[12])); + e.return_zone_id = row[12] ? static_cast(atoi(row[12])) : 0; e.return_x = row[13] ? strtof(row[13], nullptr) : 0; e.return_y = row[14] ? strtof(row[14], nullptr) : 0; e.return_z = row[15] ? strtof(row[15], nullptr) : 0; e.return_h = row[16] ? strtof(row[16], nullptr) : 0; - e.override_zone_in = static_cast(atoi(row[17])); + e.override_zone_in = row[17] ? static_cast(atoi(row[17])) : 0; e.zone_in_x = row[18] ? strtof(row[18], nullptr) : 0; e.zone_in_y = row[19] ? strtof(row[19], nullptr) : 0; e.zone_in_z = row[20] ? strtof(row[20], nullptr) : 0; diff --git a/common/repositories/base/base_dynamic_zones_repository.h b/common/repositories/base/base_dynamic_zones_repository.h index 0ae38786e..8fe5266ab 100644 --- a/common/repositories/base/base_dynamic_zones_repository.h +++ b/common/repositories/base/base_dynamic_zones_repository.h @@ -204,14 +204,14 @@ public: DynamicZones e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.instance_id = static_cast(atoi(row[1])); + e.instance_id = row[1] ? static_cast(atoi(row[1])) : 0; e.type = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.uuid = row[3] ? row[3] : ""; e.name = row[4] ? row[4] : ""; e.leader_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.min_players = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.max_players = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.dz_switch_id = static_cast(atoi(row[8])); + e.dz_switch_id = row[8] ? static_cast(atoi(row[8])) : 0; e.compass_zone_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.compass_x = row[10] ? strtof(row[10], nullptr) : 0; e.compass_y = row[11] ? strtof(row[11], nullptr) : 0; @@ -411,14 +411,14 @@ public: DynamicZones e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.instance_id = static_cast(atoi(row[1])); + e.instance_id = row[1] ? static_cast(atoi(row[1])) : 0; e.type = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.uuid = row[3] ? row[3] : ""; e.name = row[4] ? row[4] : ""; e.leader_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.min_players = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.max_players = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.dz_switch_id = static_cast(atoi(row[8])); + e.dz_switch_id = row[8] ? static_cast(atoi(row[8])) : 0; e.compass_zone_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.compass_x = row[10] ? strtof(row[10], nullptr) : 0; e.compass_y = row[11] ? strtof(row[11], nullptr) : 0; @@ -458,14 +458,14 @@ public: DynamicZones e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.instance_id = static_cast(atoi(row[1])); + e.instance_id = row[1] ? static_cast(atoi(row[1])) : 0; e.type = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.uuid = row[3] ? row[3] : ""; e.name = row[4] ? row[4] : ""; e.leader_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.min_players = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.max_players = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.dz_switch_id = static_cast(atoi(row[8])); + e.dz_switch_id = row[8] ? static_cast(atoi(row[8])) : 0; e.compass_zone_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.compass_x = row[10] ? strtof(row[10], nullptr) : 0; e.compass_y = row[11] ? strtof(row[11], nullptr) : 0; diff --git a/common/repositories/base/base_expedition_lockouts_repository.h b/common/repositories/base/base_expedition_lockouts_repository.h index b4ec21804..2fa70e329 100644 --- a/common/repositories/base/base_expedition_lockouts_repository.h +++ b/common/repositories/base/base_expedition_lockouts_repository.h @@ -176,7 +176,7 @@ public: v.push_back(columns[1] + " = " + std::to_string(e.expedition_id)); v.push_back(columns[2] + " = '" + Strings::Escape(e.event_name) + "'"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[4] + " = " + std::to_string(e.duration)); v.push_back(columns[5] + " = '" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -203,7 +203,7 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -238,7 +238,7 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -387,7 +387,7 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -415,7 +415,7 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); diff --git a/common/repositories/base/base_faction_association_repository.h b/common/repositories/base/base_faction_association_repository.h index 3287f997e..0fd1a6e27 100644 --- a/common/repositories/base/base_faction_association_repository.h +++ b/common/repositories/base/base_faction_association_repository.h @@ -195,26 +195,26 @@ public: if (results.RowCount() == 1) { FactionAssociation e{}; - e.id = static_cast(atoi(row[0])); - e.id_1 = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.id_1 = row[1] ? static_cast(atoi(row[1])) : 0; e.mod_1 = row[2] ? strtof(row[2], nullptr) : 0; - e.id_2 = static_cast(atoi(row[3])); + e.id_2 = row[3] ? static_cast(atoi(row[3])) : 0; e.mod_2 = row[4] ? strtof(row[4], nullptr) : 0; - e.id_3 = static_cast(atoi(row[5])); + e.id_3 = row[5] ? static_cast(atoi(row[5])) : 0; e.mod_3 = row[6] ? strtof(row[6], nullptr) : 0; - e.id_4 = static_cast(atoi(row[7])); + e.id_4 = row[7] ? static_cast(atoi(row[7])) : 0; e.mod_4 = row[8] ? strtof(row[8], nullptr) : 0; - e.id_5 = static_cast(atoi(row[9])); + e.id_5 = row[9] ? static_cast(atoi(row[9])) : 0; e.mod_5 = row[10] ? strtof(row[10], nullptr) : 0; - e.id_6 = static_cast(atoi(row[11])); + e.id_6 = row[11] ? static_cast(atoi(row[11])) : 0; e.mod_6 = row[12] ? strtof(row[12], nullptr) : 0; - e.id_7 = static_cast(atoi(row[13])); + e.id_7 = row[13] ? static_cast(atoi(row[13])) : 0; e.mod_7 = row[14] ? strtof(row[14], nullptr) : 0; - e.id_8 = static_cast(atoi(row[15])); + e.id_8 = row[15] ? static_cast(atoi(row[15])) : 0; e.mod_8 = row[16] ? strtof(row[16], nullptr) : 0; - e.id_9 = static_cast(atoi(row[17])); + e.id_9 = row[17] ? static_cast(atoi(row[17])) : 0; e.mod_9 = row[18] ? strtof(row[18], nullptr) : 0; - e.id_10 = static_cast(atoi(row[19])); + e.id_10 = row[19] ? static_cast(atoi(row[19])) : 0; e.mod_10 = row[20] ? strtof(row[20], nullptr) : 0; return e; @@ -395,26 +395,26 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionAssociation e{}; - e.id = static_cast(atoi(row[0])); - e.id_1 = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.id_1 = row[1] ? static_cast(atoi(row[1])) : 0; e.mod_1 = row[2] ? strtof(row[2], nullptr) : 0; - e.id_2 = static_cast(atoi(row[3])); + e.id_2 = row[3] ? static_cast(atoi(row[3])) : 0; e.mod_2 = row[4] ? strtof(row[4], nullptr) : 0; - e.id_3 = static_cast(atoi(row[5])); + e.id_3 = row[5] ? static_cast(atoi(row[5])) : 0; e.mod_3 = row[6] ? strtof(row[6], nullptr) : 0; - e.id_4 = static_cast(atoi(row[7])); + e.id_4 = row[7] ? static_cast(atoi(row[7])) : 0; e.mod_4 = row[8] ? strtof(row[8], nullptr) : 0; - e.id_5 = static_cast(atoi(row[9])); + e.id_5 = row[9] ? static_cast(atoi(row[9])) : 0; e.mod_5 = row[10] ? strtof(row[10], nullptr) : 0; - e.id_6 = static_cast(atoi(row[11])); + e.id_6 = row[11] ? static_cast(atoi(row[11])) : 0; e.mod_6 = row[12] ? strtof(row[12], nullptr) : 0; - e.id_7 = static_cast(atoi(row[13])); + e.id_7 = row[13] ? static_cast(atoi(row[13])) : 0; e.mod_7 = row[14] ? strtof(row[14], nullptr) : 0; - e.id_8 = static_cast(atoi(row[15])); + e.id_8 = row[15] ? static_cast(atoi(row[15])) : 0; e.mod_8 = row[16] ? strtof(row[16], nullptr) : 0; - e.id_9 = static_cast(atoi(row[17])); + e.id_9 = row[17] ? static_cast(atoi(row[17])) : 0; e.mod_9 = row[18] ? strtof(row[18], nullptr) : 0; - e.id_10 = static_cast(atoi(row[19])); + e.id_10 = row[19] ? static_cast(atoi(row[19])) : 0; e.mod_10 = row[20] ? strtof(row[20], nullptr) : 0; all_entries.push_back(e); @@ -440,26 +440,26 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionAssociation e{}; - e.id = static_cast(atoi(row[0])); - e.id_1 = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.id_1 = row[1] ? static_cast(atoi(row[1])) : 0; e.mod_1 = row[2] ? strtof(row[2], nullptr) : 0; - e.id_2 = static_cast(atoi(row[3])); + e.id_2 = row[3] ? static_cast(atoi(row[3])) : 0; e.mod_2 = row[4] ? strtof(row[4], nullptr) : 0; - e.id_3 = static_cast(atoi(row[5])); + e.id_3 = row[5] ? static_cast(atoi(row[5])) : 0; e.mod_3 = row[6] ? strtof(row[6], nullptr) : 0; - e.id_4 = static_cast(atoi(row[7])); + e.id_4 = row[7] ? static_cast(atoi(row[7])) : 0; e.mod_4 = row[8] ? strtof(row[8], nullptr) : 0; - e.id_5 = static_cast(atoi(row[9])); + e.id_5 = row[9] ? static_cast(atoi(row[9])) : 0; e.mod_5 = row[10] ? strtof(row[10], nullptr) : 0; - e.id_6 = static_cast(atoi(row[11])); + e.id_6 = row[11] ? static_cast(atoi(row[11])) : 0; e.mod_6 = row[12] ? strtof(row[12], nullptr) : 0; - e.id_7 = static_cast(atoi(row[13])); + e.id_7 = row[13] ? static_cast(atoi(row[13])) : 0; e.mod_7 = row[14] ? strtof(row[14], nullptr) : 0; - e.id_8 = static_cast(atoi(row[15])); + e.id_8 = row[15] ? static_cast(atoi(row[15])) : 0; e.mod_8 = row[16] ? strtof(row[16], nullptr) : 0; - e.id_9 = static_cast(atoi(row[17])); + e.id_9 = row[17] ? static_cast(atoi(row[17])) : 0; e.mod_9 = row[18] ? strtof(row[18], nullptr) : 0; - e.id_10 = static_cast(atoi(row[19])); + e.id_10 = row[19] ? static_cast(atoi(row[19])) : 0; e.mod_10 = row[20] ? strtof(row[20], nullptr) : 0; all_entries.push_back(e); diff --git a/common/repositories/base/base_faction_base_data_repository.h b/common/repositories/base/base_faction_base_data_repository.h index 2ddd58f03..1455fe53b 100644 --- a/common/repositories/base/base_faction_base_data_repository.h +++ b/common/repositories/base/base_faction_base_data_repository.h @@ -135,12 +135,12 @@ public: if (results.RowCount() == 1) { FactionBaseData e{}; - e.client_faction_id = static_cast(atoi(row[0])); - e.min = static_cast(atoi(row[1])); - e.max = static_cast(atoi(row[2])); - e.unk_hero1 = static_cast(atoi(row[3])); - e.unk_hero2 = static_cast(atoi(row[4])); - e.unk_hero3 = static_cast(atoi(row[5])); + e.client_faction_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.min = row[1] ? static_cast(atoi(row[1])) : -2000; + e.max = row[2] ? static_cast(atoi(row[2])) : 2000; + e.unk_hero1 = row[3] ? static_cast(atoi(row[3])) : 0; + e.unk_hero2 = row[4] ? static_cast(atoi(row[4])) : 0; + e.unk_hero3 = row[5] ? static_cast(atoi(row[5])) : 0; return e; } @@ -275,12 +275,12 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionBaseData e{}; - e.client_faction_id = static_cast(atoi(row[0])); - e.min = static_cast(atoi(row[1])); - e.max = static_cast(atoi(row[2])); - e.unk_hero1 = static_cast(atoi(row[3])); - e.unk_hero2 = static_cast(atoi(row[4])); - e.unk_hero3 = static_cast(atoi(row[5])); + e.client_faction_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.min = row[1] ? static_cast(atoi(row[1])) : -2000; + e.max = row[2] ? static_cast(atoi(row[2])) : 2000; + e.unk_hero1 = row[3] ? static_cast(atoi(row[3])) : 0; + e.unk_hero2 = row[4] ? static_cast(atoi(row[4])) : 0; + e.unk_hero3 = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -305,12 +305,12 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionBaseData e{}; - e.client_faction_id = static_cast(atoi(row[0])); - e.min = static_cast(atoi(row[1])); - e.max = static_cast(atoi(row[2])); - e.unk_hero1 = static_cast(atoi(row[3])); - e.unk_hero2 = static_cast(atoi(row[4])); - e.unk_hero3 = static_cast(atoi(row[5])); + e.client_faction_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.min = row[1] ? static_cast(atoi(row[1])) : -2000; + e.max = row[2] ? static_cast(atoi(row[2])) : 2000; + e.unk_hero1 = row[3] ? static_cast(atoi(row[3])) : 0; + e.unk_hero2 = row[4] ? static_cast(atoi(row[4])) : 0; + e.unk_hero3 = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_faction_list_mod_repository.h b/common/repositories/base/base_faction_list_mod_repository.h index 774eafa76..d778322bc 100644 --- a/common/repositories/base/base_faction_list_mod_repository.h +++ b/common/repositories/base/base_faction_list_mod_repository.h @@ -129,7 +129,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.faction_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.mod = static_cast(atoi(row[2])); + e.mod = row[2] ? static_cast(atoi(row[2])) : 0; e.mod_name = row[3] ? row[3] : ""; return e; @@ -260,7 +260,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.faction_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.mod = static_cast(atoi(row[2])); + e.mod = row[2] ? static_cast(atoi(row[2])) : 0; e.mod_name = row[3] ? row[3] : ""; all_entries.push_back(e); @@ -288,7 +288,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.faction_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.mod = static_cast(atoi(row[2])); + e.mod = row[2] ? static_cast(atoi(row[2])) : 0; e.mod_name = row[3] ? row[3] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_faction_list_repository.h b/common/repositories/base/base_faction_list_repository.h index 6d3c013e4..30ebb0754 100644 --- a/common/repositories/base/base_faction_list_repository.h +++ b/common/repositories/base/base_faction_list_repository.h @@ -123,9 +123,9 @@ public: if (results.RowCount() == 1) { FactionList e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.base = static_cast(atoi(row[2])); + e.base = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -251,9 +251,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionList e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.base = static_cast(atoi(row[2])); + e.base = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -278,9 +278,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionList e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.base = static_cast(atoi(row[2])); + e.base = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_faction_values_repository.h b/common/repositories/base/base_faction_values_repository.h index edce0d9f7..fdaeb1903 100644 --- a/common/repositories/base/base_faction_values_repository.h +++ b/common/repositories/base/base_faction_values_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { FactionValues e{}; - e.char_id = static_cast(atoi(row[0])); - e.faction_id = static_cast(atoi(row[1])); - e.current_value = static_cast(atoi(row[2])); - e.temp = static_cast(atoi(row[3])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.faction_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.current_value = row[2] ? static_cast(atoi(row[2])) : 0; + e.temp = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -259,10 +259,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionValues e{}; - e.char_id = static_cast(atoi(row[0])); - e.faction_id = static_cast(atoi(row[1])); - e.current_value = static_cast(atoi(row[2])); - e.temp = static_cast(atoi(row[3])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.faction_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.current_value = row[2] ? static_cast(atoi(row[2])) : 0; + e.temp = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -287,10 +287,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { FactionValues e{}; - e.char_id = static_cast(atoi(row[0])); - e.faction_id = static_cast(atoi(row[1])); - e.current_value = static_cast(atoi(row[2])); - e.temp = static_cast(atoi(row[3])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.faction_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.current_value = row[2] ? static_cast(atoi(row[2])) : 0; + e.temp = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_fishing_repository.h b/common/repositories/base/base_fishing_repository.h index 578ae4212..fde25e7bc 100644 --- a/common/repositories/base/base_fishing_repository.h +++ b/common/repositories/base/base_fishing_repository.h @@ -155,15 +155,15 @@ public: if (results.RowCount() == 1) { Fishing e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.Itemid = static_cast(atoi(row[2])); - e.skill_level = static_cast(atoi(row[3])); - e.chance = static_cast(atoi(row[4])); - e.npc_id = static_cast(atoi(row[5])); - e.npc_chance = static_cast(atoi(row[6])); - e.min_expansion = static_cast(atoi(row[7])); - e.max_expansion = static_cast(atoi(row[8])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.Itemid = row[2] ? static_cast(atoi(row[2])) : 0; + e.skill_level = row[3] ? static_cast(atoi(row[3])) : 0; + e.chance = row[4] ? static_cast(atoi(row[4])) : 0; + e.npc_id = row[5] ? static_cast(atoi(row[5])) : 0; + e.npc_chance = row[6] ? static_cast(atoi(row[6])) : 0; + e.min_expansion = row[7] ? static_cast(atoi(row[7])) : -1; + e.max_expansion = row[8] ? static_cast(atoi(row[8])) : -1; e.content_flags = row[9] ? row[9] : ""; e.content_flags_disabled = row[10] ? row[10] : ""; @@ -314,15 +314,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Fishing e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.Itemid = static_cast(atoi(row[2])); - e.skill_level = static_cast(atoi(row[3])); - e.chance = static_cast(atoi(row[4])); - e.npc_id = static_cast(atoi(row[5])); - e.npc_chance = static_cast(atoi(row[6])); - e.min_expansion = static_cast(atoi(row[7])); - e.max_expansion = static_cast(atoi(row[8])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.Itemid = row[2] ? static_cast(atoi(row[2])) : 0; + e.skill_level = row[3] ? static_cast(atoi(row[3])) : 0; + e.chance = row[4] ? static_cast(atoi(row[4])) : 0; + e.npc_id = row[5] ? static_cast(atoi(row[5])) : 0; + e.npc_chance = row[6] ? static_cast(atoi(row[6])) : 0; + e.min_expansion = row[7] ? static_cast(atoi(row[7])) : -1; + e.max_expansion = row[8] ? static_cast(atoi(row[8])) : -1; e.content_flags = row[9] ? row[9] : ""; e.content_flags_disabled = row[10] ? row[10] : ""; @@ -349,15 +349,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Fishing e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.Itemid = static_cast(atoi(row[2])); - e.skill_level = static_cast(atoi(row[3])); - e.chance = static_cast(atoi(row[4])); - e.npc_id = static_cast(atoi(row[5])); - e.npc_chance = static_cast(atoi(row[6])); - e.min_expansion = static_cast(atoi(row[7])); - e.max_expansion = static_cast(atoi(row[8])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.Itemid = row[2] ? static_cast(atoi(row[2])) : 0; + e.skill_level = row[3] ? static_cast(atoi(row[3])) : 0; + e.chance = row[4] ? static_cast(atoi(row[4])) : 0; + e.npc_id = row[5] ? static_cast(atoi(row[5])) : 0; + e.npc_chance = row[6] ? static_cast(atoi(row[6])) : 0; + e.min_expansion = row[7] ? static_cast(atoi(row[7])) : -1; + e.max_expansion = row[8] ? static_cast(atoi(row[8])) : -1; e.content_flags = row[9] ? row[9] : ""; e.content_flags_disabled = row[10] ? row[10] : ""; diff --git a/common/repositories/base/base_forage_repository.h b/common/repositories/base/base_forage_repository.h index 66007f5e0..1fb1df3e4 100644 --- a/common/repositories/base/base_forage_repository.h +++ b/common/repositories/base/base_forage_repository.h @@ -147,13 +147,13 @@ public: if (results.RowCount() == 1) { Forage e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.Itemid = static_cast(atoi(row[2])); - e.level = static_cast(atoi(row[3])); - e.chance = static_cast(atoi(row[4])); - e.min_expansion = static_cast(atoi(row[5])); - e.max_expansion = static_cast(atoi(row[6])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.Itemid = row[2] ? static_cast(atoi(row[2])) : 0; + e.level = row[3] ? static_cast(atoi(row[3])) : 0; + e.chance = row[4] ? static_cast(atoi(row[4])) : 0; + e.min_expansion = row[5] ? static_cast(atoi(row[5])) : -1; + e.max_expansion = row[6] ? static_cast(atoi(row[6])) : -1; e.content_flags = row[7] ? row[7] : ""; e.content_flags_disabled = row[8] ? row[8] : ""; @@ -298,13 +298,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Forage e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.Itemid = static_cast(atoi(row[2])); - e.level = static_cast(atoi(row[3])); - e.chance = static_cast(atoi(row[4])); - e.min_expansion = static_cast(atoi(row[5])); - e.max_expansion = static_cast(atoi(row[6])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.Itemid = row[2] ? static_cast(atoi(row[2])) : 0; + e.level = row[3] ? static_cast(atoi(row[3])) : 0; + e.chance = row[4] ? static_cast(atoi(row[4])) : 0; + e.min_expansion = row[5] ? static_cast(atoi(row[5])) : -1; + e.max_expansion = row[6] ? static_cast(atoi(row[6])) : -1; e.content_flags = row[7] ? row[7] : ""; e.content_flags_disabled = row[8] ? row[8] : ""; @@ -331,13 +331,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Forage e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.Itemid = static_cast(atoi(row[2])); - e.level = static_cast(atoi(row[3])); - e.chance = static_cast(atoi(row[4])); - e.min_expansion = static_cast(atoi(row[5])); - e.max_expansion = static_cast(atoi(row[6])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.Itemid = row[2] ? static_cast(atoi(row[2])) : 0; + e.level = row[3] ? static_cast(atoi(row[3])) : 0; + e.chance = row[4] ? static_cast(atoi(row[4])) : 0; + e.min_expansion = row[5] ? static_cast(atoi(row[5])) : -1; + e.max_expansion = row[6] ? static_cast(atoi(row[6])) : -1; e.content_flags = row[7] ? row[7] : ""; e.content_flags_disabled = row[8] ? row[8] : ""; diff --git a/common/repositories/base/base_global_loot_repository.h b/common/repositories/base/base_global_loot_repository.h index e2b0eeb06..7128207be 100644 --- a/common/repositories/base/base_global_loot_repository.h +++ b/common/repositories/base/base_global_loot_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseGlobalLootRepository { public: struct GlobalLoot { diff --git a/common/repositories/base/base_gm_ips_repository.h b/common/repositories/base/base_gm_ips_repository.h index 57a21654b..eeba74d34 100644 --- a/common/repositories/base/base_gm_ips_repository.h +++ b/common/repositories/base/base_gm_ips_repository.h @@ -124,7 +124,7 @@ public: GmIps e{}; e.name = row[0] ? row[0] : ""; - e.account_id = static_cast(atoi(row[1])); + e.account_id = row[1] ? static_cast(atoi(row[1])) : 0; e.ip_address = row[2] ? row[2] : ""; return e; @@ -252,7 +252,7 @@ public: GmIps e{}; e.name = row[0] ? row[0] : ""; - e.account_id = static_cast(atoi(row[1])); + e.account_id = row[1] ? static_cast(atoi(row[1])) : 0; e.ip_address = row[2] ? row[2] : ""; all_entries.push_back(e); @@ -279,7 +279,7 @@ public: GmIps e{}; e.name = row[0] ? row[0] : ""; - e.account_id = static_cast(atoi(row[1])); + e.account_id = row[1] ? static_cast(atoi(row[1])) : 0; e.ip_address = row[2] ? row[2] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_graveyard_repository.h b/common/repositories/base/base_graveyard_repository.h index 50d5f79c0..139e469aa 100644 --- a/common/repositories/base/base_graveyard_repository.h +++ b/common/repositories/base/base_graveyard_repository.h @@ -135,8 +135,8 @@ public: if (results.RowCount() == 1) { Graveyard e{}; - e.id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; e.x = row[2] ? strtof(row[2], nullptr) : 0; e.y = row[3] ? strtof(row[3], nullptr) : 0; e.z = row[4] ? strtof(row[4], nullptr) : 0; @@ -274,8 +274,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Graveyard e{}; - e.id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; e.x = row[2] ? strtof(row[2], nullptr) : 0; e.y = row[3] ? strtof(row[3], nullptr) : 0; e.z = row[4] ? strtof(row[4], nullptr) : 0; @@ -304,8 +304,8 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Graveyard e{}; - e.id = static_cast(atoi(row[0])); - e.zone_id = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zone_id = row[1] ? static_cast(atoi(row[1])) : 0; e.x = row[2] ? strtof(row[2], nullptr) : 0; e.y = row[3] ? strtof(row[3], nullptr) : 0; e.z = row[4] ? strtof(row[4], nullptr) : 0; diff --git a/common/repositories/base/base_grid_entries_repository.h b/common/repositories/base/base_grid_entries_repository.h index 97e7cd83a..dbfb6adfd 100644 --- a/common/repositories/base/base_grid_entries_repository.h +++ b/common/repositories/base/base_grid_entries_repository.h @@ -147,15 +147,15 @@ public: if (results.RowCount() == 1) { GridEntries e{}; - e.gridid = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.number = static_cast(atoi(row[2])); + e.gridid = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.number = row[2] ? static_cast(atoi(row[2])) : 0; e.x = row[3] ? strtof(row[3], nullptr) : 0; e.y = row[4] ? strtof(row[4], nullptr) : 0; e.z = row[5] ? strtof(row[5], nullptr) : 0; e.heading = row[6] ? strtof(row[6], nullptr) : 0; - e.pause = static_cast(atoi(row[7])); - e.centerpoint = static_cast(atoi(row[8])); + e.pause = row[7] ? static_cast(atoi(row[7])) : 0; + e.centerpoint = row[8] ? static_cast(atoi(row[8])) : 0; return e; } @@ -299,15 +299,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GridEntries e{}; - e.gridid = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.number = static_cast(atoi(row[2])); + e.gridid = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.number = row[2] ? static_cast(atoi(row[2])) : 0; e.x = row[3] ? strtof(row[3], nullptr) : 0; e.y = row[4] ? strtof(row[4], nullptr) : 0; e.z = row[5] ? strtof(row[5], nullptr) : 0; e.heading = row[6] ? strtof(row[6], nullptr) : 0; - e.pause = static_cast(atoi(row[7])); - e.centerpoint = static_cast(atoi(row[8])); + e.pause = row[7] ? static_cast(atoi(row[7])) : 0; + e.centerpoint = row[8] ? static_cast(atoi(row[8])) : 0; all_entries.push_back(e); } @@ -332,15 +332,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GridEntries e{}; - e.gridid = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.number = static_cast(atoi(row[2])); + e.gridid = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.number = row[2] ? static_cast(atoi(row[2])) : 0; e.x = row[3] ? strtof(row[3], nullptr) : 0; e.y = row[4] ? strtof(row[4], nullptr) : 0; e.z = row[5] ? strtof(row[5], nullptr) : 0; e.heading = row[6] ? strtof(row[6], nullptr) : 0; - e.pause = static_cast(atoi(row[7])); - e.centerpoint = static_cast(atoi(row[8])); + e.pause = row[7] ? static_cast(atoi(row[7])) : 0; + e.centerpoint = row[8] ? static_cast(atoi(row[8])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_grid_repository.h b/common/repositories/base/base_grid_repository.h index 2c0d5d7dd..b7bbe2192 100644 --- a/common/repositories/base/base_grid_repository.h +++ b/common/repositories/base/base_grid_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { Grid e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.type = static_cast(atoi(row[2])); - e.type2 = static_cast(atoi(row[3])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.type = row[2] ? static_cast(atoi(row[2])) : 0; + e.type2 = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -259,10 +259,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Grid e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.type = static_cast(atoi(row[2])); - e.type2 = static_cast(atoi(row[3])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.type = row[2] ? static_cast(atoi(row[2])) : 0; + e.type2 = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -287,10 +287,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Grid e{}; - e.id = static_cast(atoi(row[0])); - e.zoneid = static_cast(atoi(row[1])); - e.type = static_cast(atoi(row[2])); - e.type2 = static_cast(atoi(row[3])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.zoneid = row[1] ? static_cast(atoi(row[1])) : 0; + e.type = row[2] ? static_cast(atoi(row[2])) : 0; + e.type2 = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_ground_spawns_repository.h b/common/repositories/base/base_ground_spawns_repository.h index 077b05319..3505d4f4e 100644 --- a/common/repositories/base/base_ground_spawns_repository.h +++ b/common/repositories/base/base_ground_spawns_repository.h @@ -185,7 +185,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.zoneid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.max_x = row[3] ? strtof(row[3], nullptr) : 2000; e.max_y = row[4] ? strtof(row[4], nullptr) : 2000; e.max_z = row[5] ? strtof(row[5], nullptr) : 10000; @@ -197,8 +197,8 @@ public: e.max_allowed = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 1; e.comment = row[12] ? row[12] : ""; e.respawn_timer = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 300; - e.min_expansion = static_cast(atoi(row[14])); - e.max_expansion = static_cast(atoi(row[15])); + e.min_expansion = row[14] ? static_cast(atoi(row[14])) : -1; + e.max_expansion = row[15] ? static_cast(atoi(row[15])) : -1; e.content_flags = row[16] ? row[16] : ""; e.content_flags_disabled = row[17] ? row[17] : ""; @@ -372,7 +372,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.zoneid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.max_x = row[3] ? strtof(row[3], nullptr) : 2000; e.max_y = row[4] ? strtof(row[4], nullptr) : 2000; e.max_z = row[5] ? strtof(row[5], nullptr) : 10000; @@ -384,8 +384,8 @@ public: e.max_allowed = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 1; e.comment = row[12] ? row[12] : ""; e.respawn_timer = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 300; - e.min_expansion = static_cast(atoi(row[14])); - e.max_expansion = static_cast(atoi(row[15])); + e.min_expansion = row[14] ? static_cast(atoi(row[14])) : -1; + e.max_expansion = row[15] ? static_cast(atoi(row[15])) : -1; e.content_flags = row[16] ? row[16] : ""; e.content_flags_disabled = row[17] ? row[17] : ""; @@ -414,7 +414,7 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.zoneid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.max_x = row[3] ? strtof(row[3], nullptr) : 2000; e.max_y = row[4] ? strtof(row[4], nullptr) : 2000; e.max_z = row[5] ? strtof(row[5], nullptr) : 10000; @@ -426,8 +426,8 @@ public: e.max_allowed = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 1; e.comment = row[12] ? row[12] : ""; e.respawn_timer = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 300; - e.min_expansion = static_cast(atoi(row[14])); - e.max_expansion = static_cast(atoi(row[15])); + e.min_expansion = row[14] ? static_cast(atoi(row[14])) : -1; + e.max_expansion = row[15] ? static_cast(atoi(row[15])) : -1; e.content_flags = row[16] ? row[16] : ""; e.content_flags_disabled = row[17] ? row[17] : ""; diff --git a/common/repositories/base/base_group_id_repository.h b/common/repositories/base/base_group_id_repository.h index 36800d86c..eb590fccf 100644 --- a/common/repositories/base/base_group_id_repository.h +++ b/common/repositories/base/base_group_id_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { GroupId e{}; - e.groupid = static_cast(atoi(row[0])); - e.charid = static_cast(atoi(row[1])); + e.groupid = row[0] ? static_cast(atoi(row[0])) : 0; + e.charid = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; - e.ismerc = static_cast(atoi(row[3])); + e.ismerc = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -259,10 +259,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GroupId e{}; - e.groupid = static_cast(atoi(row[0])); - e.charid = static_cast(atoi(row[1])); + e.groupid = row[0] ? static_cast(atoi(row[0])) : 0; + e.charid = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; - e.ismerc = static_cast(atoi(row[3])); + e.ismerc = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -287,10 +287,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GroupId e{}; - e.groupid = static_cast(atoi(row[0])); - e.charid = static_cast(atoi(row[1])); + e.groupid = row[0] ? static_cast(atoi(row[0])) : 0; + e.charid = row[1] ? static_cast(atoi(row[1])) : 0; e.name = row[2] ? row[2] : ""; - e.ismerc = static_cast(atoi(row[3])); + e.ismerc = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_group_leaders_repository.h b/common/repositories/base/base_group_leaders_repository.h index c760caf90..ca5dae8ec 100644 --- a/common/repositories/base/base_group_leaders_repository.h +++ b/common/repositories/base/base_group_leaders_repository.h @@ -147,15 +147,15 @@ public: if (results.RowCount() == 1) { GroupLeaders e{}; - e.gid = static_cast(atoi(row[0])); + e.gid = row[0] ? static_cast(atoi(row[0])) : 0; e.leadername = row[1] ? row[1] : ""; e.marknpc = row[2] ? row[2] : ""; - e.leadershipaa = row[3] ? row[3] : ""; + e.leadershipaa = row[3] ? row[3] : 0; e.maintank = row[4] ? row[4] : ""; e.assist = row[5] ? row[5] : ""; e.puller = row[6] ? row[6] : ""; e.mentoree = row[7] ? row[7] : ""; - e.mentor_percent = static_cast(atoi(row[8])); + e.mentor_percent = row[8] ? static_cast(atoi(row[8])) : 0; return e; } @@ -299,15 +299,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GroupLeaders e{}; - e.gid = static_cast(atoi(row[0])); + e.gid = row[0] ? static_cast(atoi(row[0])) : 0; e.leadername = row[1] ? row[1] : ""; e.marknpc = row[2] ? row[2] : ""; - e.leadershipaa = row[3] ? row[3] : ""; + e.leadershipaa = row[3] ? row[3] : 0; e.maintank = row[4] ? row[4] : ""; e.assist = row[5] ? row[5] : ""; e.puller = row[6] ? row[6] : ""; e.mentoree = row[7] ? row[7] : ""; - e.mentor_percent = static_cast(atoi(row[8])); + e.mentor_percent = row[8] ? static_cast(atoi(row[8])) : 0; all_entries.push_back(e); } @@ -332,15 +332,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GroupLeaders e{}; - e.gid = static_cast(atoi(row[0])); + e.gid = row[0] ? static_cast(atoi(row[0])) : 0; e.leadername = row[1] ? row[1] : ""; e.marknpc = row[2] ? row[2] : ""; - e.leadershipaa = row[3] ? row[3] : ""; + e.leadershipaa = row[3] ? row[3] : 0; e.maintank = row[4] ? row[4] : ""; e.assist = row[5] ? row[5] : ""; e.puller = row[6] ? row[6] : ""; e.mentoree = row[7] ? row[7] : ""; - e.mentor_percent = static_cast(atoi(row[8])); + e.mentor_percent = row[8] ? static_cast(atoi(row[8])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_guild_members_repository.h b/common/repositories/base/base_guild_members_repository.h index 0d3599e94..47b023e34 100644 --- a/common/repositories/base/base_guild_members_repository.h +++ b/common/repositories/base/base_guild_members_repository.h @@ -151,7 +151,7 @@ public: if (results.RowCount() == 1) { GuildMembers e{}; - e.char_id = static_cast(atoi(row[0])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; e.guild_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.rank = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.tribute_enable = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; @@ -307,7 +307,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GuildMembers e{}; - e.char_id = static_cast(atoi(row[0])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; e.guild_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.rank = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.tribute_enable = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; @@ -341,7 +341,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { GuildMembers e{}; - e.char_id = static_cast(atoi(row[0])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; e.guild_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.rank = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.tribute_enable = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_guild_relations_repository.h b/common/repositories/base/base_guild_relations_repository.h index 0c040d7de..567eaeff5 100644 --- a/common/repositories/base/base_guild_relations_repository.h +++ b/common/repositories/base/base_guild_relations_repository.h @@ -125,7 +125,7 @@ public: e.guild1 = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.guild2 = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.relation = static_cast(atoi(row[2])); + e.relation = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -253,7 +253,7 @@ public: e.guild1 = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.guild2 = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.relation = static_cast(atoi(row[2])); + e.relation = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -280,7 +280,7 @@ public: e.guild1 = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.guild2 = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.relation = static_cast(atoi(row[2])); + e.relation = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_guilds_repository.h b/common/repositories/base/base_guilds_repository.h index ef6a4eeae..0a5387879 100644 --- a/common/repositories/base/base_guilds_repository.h +++ b/common/repositories/base/base_guilds_repository.h @@ -151,10 +151,10 @@ public: if (results.RowCount() == 1) { Guilds e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.leader = static_cast(atoi(row[2])); - e.minstatus = static_cast(atoi(row[3])); + e.leader = row[2] ? static_cast(atoi(row[2])) : 0; + e.minstatus = row[3] ? static_cast(atoi(row[3])) : 0; e.motd = row[4] ? row[4] : ""; e.tribute = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.motd_setter = row[6] ? row[6] : ""; @@ -306,10 +306,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Guilds e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.leader = static_cast(atoi(row[2])); - e.minstatus = static_cast(atoi(row[3])); + e.leader = row[2] ? static_cast(atoi(row[2])) : 0; + e.minstatus = row[3] ? static_cast(atoi(row[3])) : 0; e.motd = row[4] ? row[4] : ""; e.tribute = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.motd_setter = row[6] ? row[6] : ""; @@ -340,10 +340,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Guilds e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.leader = static_cast(atoi(row[2])); - e.minstatus = static_cast(atoi(row[3])); + e.leader = row[2] ? static_cast(atoi(row[2])) : 0; + e.minstatus = row[3] ? static_cast(atoi(row[3])) : 0; e.motd = row[4] ? row[4] : ""; e.tribute = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.motd_setter = row[6] ? row[6] : ""; diff --git a/common/repositories/base/base_horses_repository.h b/common/repositories/base/base_horses_repository.h index 3b447852d..5b12d52a6 100644 --- a/common/repositories/base/base_horses_repository.h +++ b/common/repositories/base/base_horses_repository.h @@ -139,13 +139,13 @@ public: if (results.RowCount() == 1) { Horses e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.filename = row[1] ? row[1] : ""; - e.race = static_cast(atoi(row[2])); - e.gender = static_cast(atoi(row[3])); - e.texture = static_cast(atoi(row[4])); + e.race = row[2] ? static_cast(atoi(row[2])) : 216; + e.gender = row[3] ? static_cast(atoi(row[3])) : 0; + e.texture = row[4] ? static_cast(atoi(row[4])) : 0; e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; - e.notes = row[6] ? row[6] : ""; + e.notes = row[6] ? row[6] : "Notes"; return e; } @@ -282,13 +282,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Horses e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.filename = row[1] ? row[1] : ""; - e.race = static_cast(atoi(row[2])); - e.gender = static_cast(atoi(row[3])); - e.texture = static_cast(atoi(row[4])); + e.race = row[2] ? static_cast(atoi(row[2])) : 216; + e.gender = row[3] ? static_cast(atoi(row[3])) : 0; + e.texture = row[4] ? static_cast(atoi(row[4])) : 0; e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; - e.notes = row[6] ? row[6] : ""; + e.notes = row[6] ? row[6] : "Notes"; all_entries.push_back(e); } @@ -313,13 +313,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Horses e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.filename = row[1] ? row[1] : ""; - e.race = static_cast(atoi(row[2])); - e.gender = static_cast(atoi(row[3])); - e.texture = static_cast(atoi(row[4])); + e.race = row[2] ? static_cast(atoi(row[2])) : 216; + e.gender = row[3] ? static_cast(atoi(row[3])) : 0; + e.texture = row[4] ? static_cast(atoi(row[4])) : 0; e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; - e.notes = row[6] ? row[6] : ""; + e.notes = row[6] ? row[6] : "Notes"; all_entries.push_back(e); } diff --git a/common/repositories/base/base_instance_list_repository.h b/common/repositories/base/base_instance_list_repository.h index 4e31b7e48..4b0d730a4 100644 --- a/common/repositories/base/base_instance_list_repository.h +++ b/common/repositories/base/base_instance_list_repository.h @@ -143,7 +143,7 @@ public: if (results.RowCount() == 1) { InstanceList e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.version = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.is_global = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; @@ -290,7 +290,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { InstanceList e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.version = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.is_global = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; @@ -322,7 +322,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { InstanceList e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.version = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.is_global = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_inventory_repository.h b/common/repositories/base/base_inventory_repository.h index 57e6fce54..7cc15789b 100644 --- a/common/repositories/base/base_inventory_repository.h +++ b/common/repositories/base/base_inventory_repository.h @@ -185,12 +185,12 @@ public: e.augslot3 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.augslot4 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot5 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[10])); + e.augslot6 = row[10] ? static_cast(atoi(row[10])) : 0; e.instnodrop = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.custom_data = row[12] ? row[12] : ""; e.ornamenticon = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.ornamentidfile = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; - e.ornament_hero_model = static_cast(atoi(row[15])); + e.ornament_hero_model = row[15] ? static_cast(atoi(row[15])) : 0; return e; } @@ -365,12 +365,12 @@ public: e.augslot3 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.augslot4 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot5 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[10])); + e.augslot6 = row[10] ? static_cast(atoi(row[10])) : 0; e.instnodrop = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.custom_data = row[12] ? row[12] : ""; e.ornamenticon = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.ornamentidfile = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; - e.ornament_hero_model = static_cast(atoi(row[15])); + e.ornament_hero_model = row[15] ? static_cast(atoi(row[15])) : 0; all_entries.push_back(e); } @@ -405,12 +405,12 @@ public: e.augslot3 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.augslot4 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot5 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[10])); + e.augslot6 = row[10] ? static_cast(atoi(row[10])) : 0; e.instnodrop = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.custom_data = row[12] ? row[12] : ""; e.ornamenticon = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.ornamentidfile = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; - e.ornament_hero_model = static_cast(atoi(row[15])); + e.ornament_hero_model = row[15] ? static_cast(atoi(row[15])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_inventory_snapshots_repository.h b/common/repositories/base/base_inventory_snapshots_repository.h index a3d383705..8a8aa22a9 100644 --- a/common/repositories/base/base_inventory_snapshots_repository.h +++ b/common/repositories/base/base_inventory_snapshots_repository.h @@ -190,12 +190,12 @@ public: e.augslot3 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot4 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.augslot5 = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[11])); + e.augslot6 = row[11] ? static_cast(atoi(row[11])) : 0; e.instnodrop = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.custom_data = row[13] ? row[13] : ""; e.ornamenticon = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.ornamentidfile = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; - e.ornament_hero_model = static_cast(atoi(row[16])); + e.ornament_hero_model = row[16] ? static_cast(atoi(row[16])) : 0; return e; } @@ -374,12 +374,12 @@ public: e.augslot3 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot4 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.augslot5 = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[11])); + e.augslot6 = row[11] ? static_cast(atoi(row[11])) : 0; e.instnodrop = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.custom_data = row[13] ? row[13] : ""; e.ornamenticon = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.ornamentidfile = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; - e.ornament_hero_model = static_cast(atoi(row[16])); + e.ornament_hero_model = row[16] ? static_cast(atoi(row[16])) : 0; all_entries.push_back(e); } @@ -415,12 +415,12 @@ public: e.augslot3 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot4 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.augslot5 = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[11])); + e.augslot6 = row[11] ? static_cast(atoi(row[11])) : 0; e.instnodrop = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.custom_data = row[13] ? row[13] : ""; e.ornamenticon = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.ornamentidfile = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; - e.ornament_hero_model = static_cast(atoi(row[16])); + e.ornament_hero_model = row[16] ? static_cast(atoi(row[16])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_ip_exemptions_repository.h b/common/repositories/base/base_ip_exemptions_repository.h index ad85ff18a..7137dee62 100644 --- a/common/repositories/base/base_ip_exemptions_repository.h +++ b/common/repositories/base/base_ip_exemptions_repository.h @@ -123,9 +123,9 @@ public: if (results.RowCount() == 1) { IpExemptions e{}; - e.exemption_id = static_cast(atoi(row[0])); + e.exemption_id = row[0] ? static_cast(atoi(row[0])) : 0; e.exemption_ip = row[1] ? row[1] : ""; - e.exemption_amount = static_cast(atoi(row[2])); + e.exemption_amount = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -250,9 +250,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { IpExemptions e{}; - e.exemption_id = static_cast(atoi(row[0])); + e.exemption_id = row[0] ? static_cast(atoi(row[0])) : 0; e.exemption_ip = row[1] ? row[1] : ""; - e.exemption_amount = static_cast(atoi(row[2])); + e.exemption_amount = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -277,9 +277,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { IpExemptions e{}; - e.exemption_id = static_cast(atoi(row[0])); + e.exemption_id = row[0] ? static_cast(atoi(row[0])) : 0; e.exemption_ip = row[1] ? row[1] : ""; - e.exemption_amount = static_cast(atoi(row[2])); + e.exemption_amount = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_items_repository.h b/common/repositories/base/base_items_repository.h index dfbbfda74..f09af248f 100644 --- a/common/repositories/base/base_items_repository.h +++ b/common/repositories/base/base_items_repository.h @@ -1251,291 +1251,291 @@ public: if (results.RowCount() == 1) { Items e{}; - e.id = static_cast(atoi(row[0])); - e.minstatus = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.minstatus = row[1] ? static_cast(atoi(row[1])) : 0; e.Name = row[2] ? row[2] : ""; - e.aagi = static_cast(atoi(row[3])); - e.ac = static_cast(atoi(row[4])); - e.accuracy = static_cast(atoi(row[5])); - e.acha = static_cast(atoi(row[6])); - e.adex = static_cast(atoi(row[7])); - e.aint = static_cast(atoi(row[8])); + e.aagi = row[3] ? static_cast(atoi(row[3])) : 0; + e.ac = row[4] ? static_cast(atoi(row[4])) : 0; + e.accuracy = row[5] ? static_cast(atoi(row[5])) : 0; + e.acha = row[6] ? static_cast(atoi(row[6])) : 0; + e.adex = row[7] ? static_cast(atoi(row[7])) : 0; + e.aint = row[8] ? static_cast(atoi(row[8])) : 0; e.artifactflag = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.asta = static_cast(atoi(row[10])); - e.astr = static_cast(atoi(row[11])); - e.attack = static_cast(atoi(row[12])); - e.augrestrict = static_cast(atoi(row[13])); - e.augslot1type = static_cast(atoi(row[14])); - e.augslot1visible = static_cast(atoi(row[15])); - e.augslot2type = static_cast(atoi(row[16])); - e.augslot2visible = static_cast(atoi(row[17])); - e.augslot3type = static_cast(atoi(row[18])); - e.augslot3visible = static_cast(atoi(row[19])); - e.augslot4type = static_cast(atoi(row[20])); - e.augslot4visible = static_cast(atoi(row[21])); - e.augslot5type = static_cast(atoi(row[22])); - e.augslot5visible = static_cast(atoi(row[23])); - e.augslot6type = static_cast(atoi(row[24])); - e.augslot6visible = static_cast(atoi(row[25])); - e.augtype = static_cast(atoi(row[26])); - e.avoidance = static_cast(atoi(row[27])); - e.awis = static_cast(atoi(row[28])); - e.bagsize = static_cast(atoi(row[29])); - e.bagslots = static_cast(atoi(row[30])); - e.bagtype = static_cast(atoi(row[31])); - e.bagwr = static_cast(atoi(row[32])); - e.banedmgamt = static_cast(atoi(row[33])); - e.banedmgraceamt = static_cast(atoi(row[34])); - e.banedmgbody = static_cast(atoi(row[35])); - e.banedmgrace = static_cast(atoi(row[36])); - e.bardtype = static_cast(atoi(row[37])); - e.bardvalue = static_cast(atoi(row[38])); - e.book = static_cast(atoi(row[39])); - e.casttime = static_cast(atoi(row[40])); - e.casttime_ = static_cast(atoi(row[41])); + e.asta = row[10] ? static_cast(atoi(row[10])) : 0; + e.astr = row[11] ? static_cast(atoi(row[11])) : 0; + e.attack = row[12] ? static_cast(atoi(row[12])) : 0; + e.augrestrict = row[13] ? static_cast(atoi(row[13])) : 0; + e.augslot1type = row[14] ? static_cast(atoi(row[14])) : 0; + e.augslot1visible = row[15] ? static_cast(atoi(row[15])) : 0; + e.augslot2type = row[16] ? static_cast(atoi(row[16])) : 0; + e.augslot2visible = row[17] ? static_cast(atoi(row[17])) : 0; + e.augslot3type = row[18] ? static_cast(atoi(row[18])) : 0; + e.augslot3visible = row[19] ? static_cast(atoi(row[19])) : 0; + e.augslot4type = row[20] ? static_cast(atoi(row[20])) : 0; + e.augslot4visible = row[21] ? static_cast(atoi(row[21])) : 0; + e.augslot5type = row[22] ? static_cast(atoi(row[22])) : 0; + e.augslot5visible = row[23] ? static_cast(atoi(row[23])) : 0; + e.augslot6type = row[24] ? static_cast(atoi(row[24])) : 0; + e.augslot6visible = row[25] ? static_cast(atoi(row[25])) : 0; + e.augtype = row[26] ? static_cast(atoi(row[26])) : 0; + e.avoidance = row[27] ? static_cast(atoi(row[27])) : 0; + e.awis = row[28] ? static_cast(atoi(row[28])) : 0; + e.bagsize = row[29] ? static_cast(atoi(row[29])) : 0; + e.bagslots = row[30] ? static_cast(atoi(row[30])) : 0; + e.bagtype = row[31] ? static_cast(atoi(row[31])) : 0; + e.bagwr = row[32] ? static_cast(atoi(row[32])) : 0; + e.banedmgamt = row[33] ? static_cast(atoi(row[33])) : 0; + e.banedmgraceamt = row[34] ? static_cast(atoi(row[34])) : 0; + e.banedmgbody = row[35] ? static_cast(atoi(row[35])) : 0; + e.banedmgrace = row[36] ? static_cast(atoi(row[36])) : 0; + e.bardtype = row[37] ? static_cast(atoi(row[37])) : 0; + e.bardvalue = row[38] ? static_cast(atoi(row[38])) : 0; + e.book = row[39] ? static_cast(atoi(row[39])) : 0; + e.casttime = row[40] ? static_cast(atoi(row[40])) : 0; + e.casttime_ = row[41] ? static_cast(atoi(row[41])) : 0; e.charmfile = row[42] ? row[42] : ""; e.charmfileid = row[43] ? row[43] : ""; - e.classes = static_cast(atoi(row[44])); + e.classes = row[44] ? static_cast(atoi(row[44])) : 0; e.color = row[45] ? static_cast(strtoul(row[45], nullptr, 10)) : 0; e.combateffects = row[46] ? row[46] : ""; - e.extradmgskill = static_cast(atoi(row[47])); - e.extradmgamt = static_cast(atoi(row[48])); - e.price = static_cast(atoi(row[49])); - e.cr = static_cast(atoi(row[50])); - e.damage = static_cast(atoi(row[51])); - e.damageshield = static_cast(atoi(row[52])); - e.deity = static_cast(atoi(row[53])); - e.delay = static_cast(atoi(row[54])); + e.extradmgskill = row[47] ? static_cast(atoi(row[47])) : 0; + e.extradmgamt = row[48] ? static_cast(atoi(row[48])) : 0; + e.price = row[49] ? static_cast(atoi(row[49])) : 0; + e.cr = row[50] ? static_cast(atoi(row[50])) : 0; + e.damage = row[51] ? static_cast(atoi(row[51])) : 0; + e.damageshield = row[52] ? static_cast(atoi(row[52])) : 0; + e.deity = row[53] ? static_cast(atoi(row[53])) : 0; + e.delay = row[54] ? static_cast(atoi(row[54])) : 0; e.augdistiller = row[55] ? static_cast(strtoul(row[55], nullptr, 10)) : 0; - e.dotshielding = static_cast(atoi(row[56])); - e.dr = static_cast(atoi(row[57])); - e.clicktype = static_cast(atoi(row[58])); - e.clicklevel2 = static_cast(atoi(row[59])); - e.elemdmgtype = static_cast(atoi(row[60])); - e.elemdmgamt = static_cast(atoi(row[61])); - e.endur = static_cast(atoi(row[62])); - e.factionamt1 = static_cast(atoi(row[63])); - e.factionamt2 = static_cast(atoi(row[64])); - e.factionamt3 = static_cast(atoi(row[65])); - e.factionamt4 = static_cast(atoi(row[66])); - e.factionmod1 = static_cast(atoi(row[67])); - e.factionmod2 = static_cast(atoi(row[68])); - e.factionmod3 = static_cast(atoi(row[69])); - e.factionmod4 = static_cast(atoi(row[70])); + e.dotshielding = row[56] ? static_cast(atoi(row[56])) : 0; + e.dr = row[57] ? static_cast(atoi(row[57])) : 0; + e.clicktype = row[58] ? static_cast(atoi(row[58])) : 0; + e.clicklevel2 = row[59] ? static_cast(atoi(row[59])) : 0; + e.elemdmgtype = row[60] ? static_cast(atoi(row[60])) : 0; + e.elemdmgamt = row[61] ? static_cast(atoi(row[61])) : 0; + e.endur = row[62] ? static_cast(atoi(row[62])) : 0; + e.factionamt1 = row[63] ? static_cast(atoi(row[63])) : 0; + e.factionamt2 = row[64] ? static_cast(atoi(row[64])) : 0; + e.factionamt3 = row[65] ? static_cast(atoi(row[65])) : 0; + e.factionamt4 = row[66] ? static_cast(atoi(row[66])) : 0; + e.factionmod1 = row[67] ? static_cast(atoi(row[67])) : 0; + e.factionmod2 = row[68] ? static_cast(atoi(row[68])) : 0; + e.factionmod3 = row[69] ? static_cast(atoi(row[69])) : 0; + e.factionmod4 = row[70] ? static_cast(atoi(row[70])) : 0; e.filename = row[71] ? row[71] : ""; - e.focuseffect = static_cast(atoi(row[72])); - e.fr = static_cast(atoi(row[73])); - e.fvnodrop = static_cast(atoi(row[74])); - e.haste = static_cast(atoi(row[75])); - e.clicklevel = static_cast(atoi(row[76])); - e.hp = static_cast(atoi(row[77])); - e.regen = static_cast(atoi(row[78])); - e.icon = static_cast(atoi(row[79])); + e.focuseffect = row[72] ? static_cast(atoi(row[72])) : 0; + e.fr = row[73] ? static_cast(atoi(row[73])) : 0; + e.fvnodrop = row[74] ? static_cast(atoi(row[74])) : 0; + e.haste = row[75] ? static_cast(atoi(row[75])) : 0; + e.clicklevel = row[76] ? static_cast(atoi(row[76])) : 0; + e.hp = row[77] ? static_cast(atoi(row[77])) : 0; + e.regen = row[78] ? static_cast(atoi(row[78])) : 0; + e.icon = row[79] ? static_cast(atoi(row[79])) : 0; e.idfile = row[80] ? row[80] : ""; - e.itemclass = static_cast(atoi(row[81])); - e.itemtype = static_cast(atoi(row[82])); - e.ldonprice = static_cast(atoi(row[83])); - e.ldontheme = static_cast(atoi(row[84])); - e.ldonsold = static_cast(atoi(row[85])); - e.light = static_cast(atoi(row[86])); + e.itemclass = row[81] ? static_cast(atoi(row[81])) : 0; + e.itemtype = row[82] ? static_cast(atoi(row[82])) : 0; + e.ldonprice = row[83] ? static_cast(atoi(row[83])) : 0; + e.ldontheme = row[84] ? static_cast(atoi(row[84])) : 0; + e.ldonsold = row[85] ? static_cast(atoi(row[85])) : 0; + e.light = row[86] ? static_cast(atoi(row[86])) : 0; e.lore = row[87] ? row[87] : ""; - e.loregroup = static_cast(atoi(row[88])); - e.magic = static_cast(atoi(row[89])); - e.mana = static_cast(atoi(row[90])); - e.manaregen = static_cast(atoi(row[91])); - e.enduranceregen = static_cast(atoi(row[92])); - e.material = static_cast(atoi(row[93])); - e.herosforgemodel = static_cast(atoi(row[94])); - e.maxcharges = static_cast(atoi(row[95])); - e.mr = static_cast(atoi(row[96])); - e.nodrop = static_cast(atoi(row[97])); - e.norent = static_cast(atoi(row[98])); + e.loregroup = row[88] ? static_cast(atoi(row[88])) : 0; + e.magic = row[89] ? static_cast(atoi(row[89])) : 0; + e.mana = row[90] ? static_cast(atoi(row[90])) : 0; + e.manaregen = row[91] ? static_cast(atoi(row[91])) : 0; + e.enduranceregen = row[92] ? static_cast(atoi(row[92])) : 0; + e.material = row[93] ? static_cast(atoi(row[93])) : 0; + e.herosforgemodel = row[94] ? static_cast(atoi(row[94])) : 0; + e.maxcharges = row[95] ? static_cast(atoi(row[95])) : 0; + e.mr = row[96] ? static_cast(atoi(row[96])) : 0; + e.nodrop = row[97] ? static_cast(atoi(row[97])) : 0; + e.norent = row[98] ? static_cast(atoi(row[98])) : 0; e.pendingloreflag = row[99] ? static_cast(strtoul(row[99], nullptr, 10)) : 0; - e.pr = static_cast(atoi(row[100])); - e.procrate = static_cast(atoi(row[101])); - e.races = static_cast(atoi(row[102])); - e.range_ = static_cast(atoi(row[103])); - e.reclevel = static_cast(atoi(row[104])); - e.recskill = static_cast(atoi(row[105])); - e.reqlevel = static_cast(atoi(row[106])); + e.pr = row[100] ? static_cast(atoi(row[100])) : 0; + e.procrate = row[101] ? static_cast(atoi(row[101])) : 0; + e.races = row[102] ? static_cast(atoi(row[102])) : 0; + e.range_ = row[103] ? static_cast(atoi(row[103])) : 0; + e.reclevel = row[104] ? static_cast(atoi(row[104])) : 0; + e.recskill = row[105] ? static_cast(atoi(row[105])) : 0; + e.reqlevel = row[106] ? static_cast(atoi(row[106])) : 0; e.sellrate = row[107] ? strtof(row[107], nullptr) : 0; - e.shielding = static_cast(atoi(row[108])); - e.size = static_cast(atoi(row[109])); - e.skillmodtype = static_cast(atoi(row[110])); - e.skillmodvalue = static_cast(atoi(row[111])); - e.slots = static_cast(atoi(row[112])); - e.clickeffect = static_cast(atoi(row[113])); - e.spellshield = static_cast(atoi(row[114])); - e.strikethrough = static_cast(atoi(row[115])); - e.stunresist = static_cast(atoi(row[116])); + e.shielding = row[108] ? static_cast(atoi(row[108])) : 0; + e.size = row[109] ? static_cast(atoi(row[109])) : 0; + e.skillmodtype = row[110] ? static_cast(atoi(row[110])) : 0; + e.skillmodvalue = row[111] ? static_cast(atoi(row[111])) : 0; + e.slots = row[112] ? static_cast(atoi(row[112])) : 0; + e.clickeffect = row[113] ? static_cast(atoi(row[113])) : 0; + e.spellshield = row[114] ? static_cast(atoi(row[114])) : 0; + e.strikethrough = row[115] ? static_cast(atoi(row[115])) : 0; + e.stunresist = row[116] ? static_cast(atoi(row[116])) : 0; e.summonedflag = row[117] ? static_cast(strtoul(row[117], nullptr, 10)) : 0; - e.tradeskills = static_cast(atoi(row[118])); - e.favor = static_cast(atoi(row[119])); - e.weight = static_cast(atoi(row[120])); - e.UNK012 = static_cast(atoi(row[121])); - e.UNK013 = static_cast(atoi(row[122])); - e.benefitflag = static_cast(atoi(row[123])); - e.UNK054 = static_cast(atoi(row[124])); - e.UNK059 = static_cast(atoi(row[125])); - e.booktype = static_cast(atoi(row[126])); - e.recastdelay = static_cast(atoi(row[127])); - e.recasttype = static_cast(atoi(row[128])); - e.guildfavor = static_cast(atoi(row[129])); - e.UNK123 = static_cast(atoi(row[130])); - e.UNK124 = static_cast(atoi(row[131])); - e.attuneable = static_cast(atoi(row[132])); - e.nopet = static_cast(atoi(row[133])); + e.tradeskills = row[118] ? static_cast(atoi(row[118])) : 0; + e.favor = row[119] ? static_cast(atoi(row[119])) : 0; + e.weight = row[120] ? static_cast(atoi(row[120])) : 0; + e.UNK012 = row[121] ? static_cast(atoi(row[121])) : 0; + e.UNK013 = row[122] ? static_cast(atoi(row[122])) : 0; + e.benefitflag = row[123] ? static_cast(atoi(row[123])) : 0; + e.UNK054 = row[124] ? static_cast(atoi(row[124])) : 0; + e.UNK059 = row[125] ? static_cast(atoi(row[125])) : 0; + e.booktype = row[126] ? static_cast(atoi(row[126])) : 0; + e.recastdelay = row[127] ? static_cast(atoi(row[127])) : 0; + e.recasttype = row[128] ? static_cast(atoi(row[128])) : 0; + e.guildfavor = row[129] ? static_cast(atoi(row[129])) : 0; + e.UNK123 = row[130] ? static_cast(atoi(row[130])) : 0; + e.UNK124 = row[131] ? static_cast(atoi(row[131])) : 0; + e.attuneable = row[132] ? static_cast(atoi(row[132])) : 0; + e.nopet = row[133] ? static_cast(atoi(row[133])) : 0; e.updated = strtoll(row[134] ? row[134] : "-1", nullptr, 10); e.comment = row[135] ? row[135] : ""; - e.UNK127 = static_cast(atoi(row[136])); - e.pointtype = static_cast(atoi(row[137])); - e.potionbelt = static_cast(atoi(row[138])); - e.potionbeltslots = static_cast(atoi(row[139])); - e.stacksize = static_cast(atoi(row[140])); - e.notransfer = static_cast(atoi(row[141])); - e.stackable = static_cast(atoi(row[142])); + e.UNK127 = row[136] ? static_cast(atoi(row[136])) : 0; + e.pointtype = row[137] ? static_cast(atoi(row[137])) : 0; + e.potionbelt = row[138] ? static_cast(atoi(row[138])) : 0; + e.potionbeltslots = row[139] ? static_cast(atoi(row[139])) : 0; + e.stacksize = row[140] ? static_cast(atoi(row[140])) : 0; + e.notransfer = row[141] ? static_cast(atoi(row[141])) : 0; + e.stackable = row[142] ? static_cast(atoi(row[142])) : 0; e.UNK134 = row[143] ? row[143] : ""; - e.UNK137 = static_cast(atoi(row[144])); - e.proceffect = static_cast(atoi(row[145])); - e.proctype = static_cast(atoi(row[146])); - e.proclevel2 = static_cast(atoi(row[147])); - e.proclevel = static_cast(atoi(row[148])); - e.UNK142 = static_cast(atoi(row[149])); - e.worneffect = static_cast(atoi(row[150])); - e.worntype = static_cast(atoi(row[151])); - e.wornlevel2 = static_cast(atoi(row[152])); - e.wornlevel = static_cast(atoi(row[153])); - e.UNK147 = static_cast(atoi(row[154])); - e.focustype = static_cast(atoi(row[155])); - e.focuslevel2 = static_cast(atoi(row[156])); - e.focuslevel = static_cast(atoi(row[157])); - e.UNK152 = static_cast(atoi(row[158])); - e.scrolleffect = static_cast(atoi(row[159])); - e.scrolltype = static_cast(atoi(row[160])); - e.scrolllevel2 = static_cast(atoi(row[161])); - e.scrolllevel = static_cast(atoi(row[162])); - e.UNK157 = static_cast(atoi(row[163])); + e.UNK137 = row[144] ? static_cast(atoi(row[144])) : 0; + e.proceffect = row[145] ? static_cast(atoi(row[145])) : 0; + e.proctype = row[146] ? static_cast(atoi(row[146])) : 0; + e.proclevel2 = row[147] ? static_cast(atoi(row[147])) : 0; + e.proclevel = row[148] ? static_cast(atoi(row[148])) : 0; + e.UNK142 = row[149] ? static_cast(atoi(row[149])) : 0; + e.worneffect = row[150] ? static_cast(atoi(row[150])) : 0; + e.worntype = row[151] ? static_cast(atoi(row[151])) : 0; + e.wornlevel2 = row[152] ? static_cast(atoi(row[152])) : 0; + e.wornlevel = row[153] ? static_cast(atoi(row[153])) : 0; + e.UNK147 = row[154] ? static_cast(atoi(row[154])) : 0; + e.focustype = row[155] ? static_cast(atoi(row[155])) : 0; + e.focuslevel2 = row[156] ? static_cast(atoi(row[156])) : 0; + e.focuslevel = row[157] ? static_cast(atoi(row[157])) : 0; + e.UNK152 = row[158] ? static_cast(atoi(row[158])) : 0; + e.scrolleffect = row[159] ? static_cast(atoi(row[159])) : 0; + e.scrolltype = row[160] ? static_cast(atoi(row[160])) : 0; + e.scrolllevel2 = row[161] ? static_cast(atoi(row[161])) : 0; + e.scrolllevel = row[162] ? static_cast(atoi(row[162])) : 0; + e.UNK157 = row[163] ? static_cast(atoi(row[163])) : 0; e.serialized = strtoll(row[164] ? row[164] : "-1", nullptr, 10); e.verified = strtoll(row[165] ? row[165] : "-1", nullptr, 10); e.serialization = row[166] ? row[166] : ""; e.source = row[167] ? row[167] : ""; - e.UNK033 = static_cast(atoi(row[168])); + e.UNK033 = row[168] ? static_cast(atoi(row[168])) : 0; e.lorefile = row[169] ? row[169] : ""; - e.UNK014 = static_cast(atoi(row[170])); - e.svcorruption = static_cast(atoi(row[171])); - e.skillmodmax = static_cast(atoi(row[172])); - e.UNK060 = static_cast(atoi(row[173])); - e.augslot1unk2 = static_cast(atoi(row[174])); - e.augslot2unk2 = static_cast(atoi(row[175])); - e.augslot3unk2 = static_cast(atoi(row[176])); - e.augslot4unk2 = static_cast(atoi(row[177])); - e.augslot5unk2 = static_cast(atoi(row[178])); - e.augslot6unk2 = static_cast(atoi(row[179])); - e.UNK120 = static_cast(atoi(row[180])); - e.UNK121 = static_cast(atoi(row[181])); - e.questitemflag = static_cast(atoi(row[182])); + e.UNK014 = row[170] ? static_cast(atoi(row[170])) : 0; + e.svcorruption = row[171] ? static_cast(atoi(row[171])) : 0; + e.skillmodmax = row[172] ? static_cast(atoi(row[172])) : 0; + e.UNK060 = row[173] ? static_cast(atoi(row[173])) : 0; + e.augslot1unk2 = row[174] ? static_cast(atoi(row[174])) : 0; + e.augslot2unk2 = row[175] ? static_cast(atoi(row[175])) : 0; + e.augslot3unk2 = row[176] ? static_cast(atoi(row[176])) : 0; + e.augslot4unk2 = row[177] ? static_cast(atoi(row[177])) : 0; + e.augslot5unk2 = row[178] ? static_cast(atoi(row[178])) : 0; + e.augslot6unk2 = row[179] ? static_cast(atoi(row[179])) : 0; + e.UNK120 = row[180] ? static_cast(atoi(row[180])) : 0; + e.UNK121 = row[181] ? static_cast(atoi(row[181])) : 0; + e.questitemflag = row[182] ? static_cast(atoi(row[182])) : 0; e.UNK132 = row[183] ? row[183] : ""; - e.clickunk5 = static_cast(atoi(row[184])); + e.clickunk5 = row[184] ? static_cast(atoi(row[184])) : 0; e.clickunk6 = row[185] ? row[185] : ""; - e.clickunk7 = static_cast(atoi(row[186])); - e.procunk1 = static_cast(atoi(row[187])); - e.procunk2 = static_cast(atoi(row[188])); - e.procunk3 = static_cast(atoi(row[189])); - e.procunk4 = static_cast(atoi(row[190])); + e.clickunk7 = row[186] ? static_cast(atoi(row[186])) : 0; + e.procunk1 = row[187] ? static_cast(atoi(row[187])) : 0; + e.procunk2 = row[188] ? static_cast(atoi(row[188])) : 0; + e.procunk3 = row[189] ? static_cast(atoi(row[189])) : 0; + e.procunk4 = row[190] ? static_cast(atoi(row[190])) : 0; e.procunk6 = row[191] ? row[191] : ""; - e.procunk7 = static_cast(atoi(row[192])); - e.wornunk1 = static_cast(atoi(row[193])); - e.wornunk2 = static_cast(atoi(row[194])); - e.wornunk3 = static_cast(atoi(row[195])); - e.wornunk4 = static_cast(atoi(row[196])); - e.wornunk5 = static_cast(atoi(row[197])); + e.procunk7 = row[192] ? static_cast(atoi(row[192])) : 0; + e.wornunk1 = row[193] ? static_cast(atoi(row[193])) : 0; + e.wornunk2 = row[194] ? static_cast(atoi(row[194])) : 0; + e.wornunk3 = row[195] ? static_cast(atoi(row[195])) : 0; + e.wornunk4 = row[196] ? static_cast(atoi(row[196])) : 0; + e.wornunk5 = row[197] ? static_cast(atoi(row[197])) : 0; e.wornunk6 = row[198] ? row[198] : ""; - e.wornunk7 = static_cast(atoi(row[199])); - e.focusunk1 = static_cast(atoi(row[200])); - e.focusunk2 = static_cast(atoi(row[201])); - e.focusunk3 = static_cast(atoi(row[202])); - e.focusunk4 = static_cast(atoi(row[203])); - e.focusunk5 = static_cast(atoi(row[204])); + e.wornunk7 = row[199] ? static_cast(atoi(row[199])) : 0; + e.focusunk1 = row[200] ? static_cast(atoi(row[200])) : 0; + e.focusunk2 = row[201] ? static_cast(atoi(row[201])) : 0; + e.focusunk3 = row[202] ? static_cast(atoi(row[202])) : 0; + e.focusunk4 = row[203] ? static_cast(atoi(row[203])) : 0; + e.focusunk5 = row[204] ? static_cast(atoi(row[204])) : 0; e.focusunk6 = row[205] ? row[205] : ""; - e.focusunk7 = static_cast(atoi(row[206])); + e.focusunk7 = row[206] ? static_cast(atoi(row[206])) : 0; e.scrollunk1 = row[207] ? static_cast(strtoul(row[207], nullptr, 10)) : 0; - e.scrollunk2 = static_cast(atoi(row[208])); - e.scrollunk3 = static_cast(atoi(row[209])); - e.scrollunk4 = static_cast(atoi(row[210])); - e.scrollunk5 = static_cast(atoi(row[211])); + e.scrollunk2 = row[208] ? static_cast(atoi(row[208])) : 0; + e.scrollunk3 = row[209] ? static_cast(atoi(row[209])) : 0; + e.scrollunk4 = row[210] ? static_cast(atoi(row[210])) : 0; + e.scrollunk5 = row[211] ? static_cast(atoi(row[211])) : 0; e.scrollunk6 = row[212] ? row[212] : ""; - e.scrollunk7 = static_cast(atoi(row[213])); - e.UNK193 = static_cast(atoi(row[214])); - e.purity = static_cast(atoi(row[215])); - e.evoitem = static_cast(atoi(row[216])); - e.evoid = static_cast(atoi(row[217])); - e.evolvinglevel = static_cast(atoi(row[218])); - e.evomax = static_cast(atoi(row[219])); + e.scrollunk7 = row[213] ? static_cast(atoi(row[213])) : 0; + e.UNK193 = row[214] ? static_cast(atoi(row[214])) : 0; + e.purity = row[215] ? static_cast(atoi(row[215])) : 0; + e.evoitem = row[216] ? static_cast(atoi(row[216])) : 0; + e.evoid = row[217] ? static_cast(atoi(row[217])) : 0; + e.evolvinglevel = row[218] ? static_cast(atoi(row[218])) : 0; + e.evomax = row[219] ? static_cast(atoi(row[219])) : 0; e.clickname = row[220] ? row[220] : ""; e.procname = row[221] ? row[221] : ""; e.wornname = row[222] ? row[222] : ""; e.focusname = row[223] ? row[223] : ""; e.scrollname = row[224] ? row[224] : ""; - e.dsmitigation = static_cast(atoi(row[225])); - e.heroic_str = static_cast(atoi(row[226])); - e.heroic_int = static_cast(atoi(row[227])); - e.heroic_wis = static_cast(atoi(row[228])); - e.heroic_agi = static_cast(atoi(row[229])); - e.heroic_dex = static_cast(atoi(row[230])); - e.heroic_sta = static_cast(atoi(row[231])); - e.heroic_cha = static_cast(atoi(row[232])); - e.heroic_pr = static_cast(atoi(row[233])); - e.heroic_dr = static_cast(atoi(row[234])); - e.heroic_fr = static_cast(atoi(row[235])); - e.heroic_cr = static_cast(atoi(row[236])); - e.heroic_mr = static_cast(atoi(row[237])); - e.heroic_svcorrup = static_cast(atoi(row[238])); - e.healamt = static_cast(atoi(row[239])); - e.spelldmg = static_cast(atoi(row[240])); - e.clairvoyance = static_cast(atoi(row[241])); - e.backstabdmg = static_cast(atoi(row[242])); + e.dsmitigation = row[225] ? static_cast(atoi(row[225])) : 0; + e.heroic_str = row[226] ? static_cast(atoi(row[226])) : 0; + e.heroic_int = row[227] ? static_cast(atoi(row[227])) : 0; + e.heroic_wis = row[228] ? static_cast(atoi(row[228])) : 0; + e.heroic_agi = row[229] ? static_cast(atoi(row[229])) : 0; + e.heroic_dex = row[230] ? static_cast(atoi(row[230])) : 0; + e.heroic_sta = row[231] ? static_cast(atoi(row[231])) : 0; + e.heroic_cha = row[232] ? static_cast(atoi(row[232])) : 0; + e.heroic_pr = row[233] ? static_cast(atoi(row[233])) : 0; + e.heroic_dr = row[234] ? static_cast(atoi(row[234])) : 0; + e.heroic_fr = row[235] ? static_cast(atoi(row[235])) : 0; + e.heroic_cr = row[236] ? static_cast(atoi(row[236])) : 0; + e.heroic_mr = row[237] ? static_cast(atoi(row[237])) : 0; + e.heroic_svcorrup = row[238] ? static_cast(atoi(row[238])) : 0; + e.healamt = row[239] ? static_cast(atoi(row[239])) : 0; + e.spelldmg = row[240] ? static_cast(atoi(row[240])) : 0; + e.clairvoyance = row[241] ? static_cast(atoi(row[241])) : 0; + e.backstabdmg = row[242] ? static_cast(atoi(row[242])) : 0; e.created = row[243] ? row[243] : ""; - e.elitematerial = static_cast(atoi(row[244])); - e.ldonsellbackrate = static_cast(atoi(row[245])); - e.scriptfileid = static_cast(atoi(row[246])); - e.expendablearrow = static_cast(atoi(row[247])); - e.powersourcecapacity = static_cast(atoi(row[248])); - e.bardeffect = static_cast(atoi(row[249])); - e.bardeffecttype = static_cast(atoi(row[250])); - e.bardlevel2 = static_cast(atoi(row[251])); - e.bardlevel = static_cast(atoi(row[252])); - e.bardunk1 = static_cast(atoi(row[253])); - e.bardunk2 = static_cast(atoi(row[254])); - e.bardunk3 = static_cast(atoi(row[255])); - e.bardunk4 = static_cast(atoi(row[256])); - e.bardunk5 = static_cast(atoi(row[257])); + e.elitematerial = row[244] ? static_cast(atoi(row[244])) : 0; + e.ldonsellbackrate = row[245] ? static_cast(atoi(row[245])) : 0; + e.scriptfileid = row[246] ? static_cast(atoi(row[246])) : 0; + e.expendablearrow = row[247] ? static_cast(atoi(row[247])) : 0; + e.powersourcecapacity = row[248] ? static_cast(atoi(row[248])) : 0; + e.bardeffect = row[249] ? static_cast(atoi(row[249])) : 0; + e.bardeffecttype = row[250] ? static_cast(atoi(row[250])) : 0; + e.bardlevel2 = row[251] ? static_cast(atoi(row[251])) : 0; + e.bardlevel = row[252] ? static_cast(atoi(row[252])) : 0; + e.bardunk1 = row[253] ? static_cast(atoi(row[253])) : 0; + e.bardunk2 = row[254] ? static_cast(atoi(row[254])) : 0; + e.bardunk3 = row[255] ? static_cast(atoi(row[255])) : 0; + e.bardunk4 = row[256] ? static_cast(atoi(row[256])) : 0; + e.bardunk5 = row[257] ? static_cast(atoi(row[257])) : 0; e.bardname = row[258] ? row[258] : ""; - e.bardunk7 = static_cast(atoi(row[259])); - e.UNK214 = static_cast(atoi(row[260])); - e.subtype = static_cast(atoi(row[261])); - e.UNK220 = static_cast(atoi(row[262])); - e.UNK221 = static_cast(atoi(row[263])); - e.heirloom = static_cast(atoi(row[264])); - e.UNK223 = static_cast(atoi(row[265])); - e.UNK224 = static_cast(atoi(row[266])); - e.UNK225 = static_cast(atoi(row[267])); - e.UNK226 = static_cast(atoi(row[268])); - e.UNK227 = static_cast(atoi(row[269])); - e.UNK228 = static_cast(atoi(row[270])); - e.UNK229 = static_cast(atoi(row[271])); - e.UNK230 = static_cast(atoi(row[272])); - e.UNK231 = static_cast(atoi(row[273])); - e.UNK232 = static_cast(atoi(row[274])); - e.UNK233 = static_cast(atoi(row[275])); - e.UNK234 = static_cast(atoi(row[276])); - e.placeable = static_cast(atoi(row[277])); - e.UNK236 = static_cast(atoi(row[278])); - e.UNK237 = static_cast(atoi(row[279])); - e.UNK238 = static_cast(atoi(row[280])); - e.UNK239 = static_cast(atoi(row[281])); - e.UNK240 = static_cast(atoi(row[282])); - e.UNK241 = static_cast(atoi(row[283])); - e.epicitem = static_cast(atoi(row[284])); + e.bardunk7 = row[259] ? static_cast(atoi(row[259])) : 0; + e.UNK214 = row[260] ? static_cast(atoi(row[260])) : 0; + e.subtype = row[261] ? static_cast(atoi(row[261])) : 0; + e.UNK220 = row[262] ? static_cast(atoi(row[262])) : 0; + e.UNK221 = row[263] ? static_cast(atoi(row[263])) : 0; + e.heirloom = row[264] ? static_cast(atoi(row[264])) : 0; + e.UNK223 = row[265] ? static_cast(atoi(row[265])) : 0; + e.UNK224 = row[266] ? static_cast(atoi(row[266])) : 0; + e.UNK225 = row[267] ? static_cast(atoi(row[267])) : 0; + e.UNK226 = row[268] ? static_cast(atoi(row[268])) : 0; + e.UNK227 = row[269] ? static_cast(atoi(row[269])) : 0; + e.UNK228 = row[270] ? static_cast(atoi(row[270])) : 0; + e.UNK229 = row[271] ? static_cast(atoi(row[271])) : 0; + e.UNK230 = row[272] ? static_cast(atoi(row[272])) : 0; + e.UNK231 = row[273] ? static_cast(atoi(row[273])) : 0; + e.UNK232 = row[274] ? static_cast(atoi(row[274])) : 0; + e.UNK233 = row[275] ? static_cast(atoi(row[275])) : 0; + e.UNK234 = row[276] ? static_cast(atoi(row[276])) : 0; + e.placeable = row[277] ? static_cast(atoi(row[277])) : 0; + e.UNK236 = row[278] ? static_cast(atoi(row[278])) : 0; + e.UNK237 = row[279] ? static_cast(atoi(row[279])) : 0; + e.UNK238 = row[280] ? static_cast(atoi(row[280])) : 0; + e.UNK239 = row[281] ? static_cast(atoi(row[281])) : 0; + e.UNK240 = row[282] ? static_cast(atoi(row[282])) : 0; + e.UNK241 = row[283] ? static_cast(atoi(row[283])) : 0; + e.epicitem = row[284] ? static_cast(atoi(row[284])) : 0; return e; } @@ -1703,7 +1703,7 @@ public: v.push_back(columns[131] + " = " + std::to_string(e.UNK124)); v.push_back(columns[132] + " = " + std::to_string(e.attuneable)); v.push_back(columns[133] + " = " + std::to_string(e.nopet)); - v.push_back(columns[134] + " = FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); + v.push_back(columns[134] + " = FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[135] + " = '" + Strings::Escape(e.comment) + "'"); v.push_back(columns[136] + " = " + std::to_string(e.UNK127)); v.push_back(columns[137] + " = " + std::to_string(e.pointtype)); @@ -1733,8 +1733,8 @@ public: v.push_back(columns[161] + " = " + std::to_string(e.scrolllevel2)); v.push_back(columns[162] + " = " + std::to_string(e.scrolllevel)); v.push_back(columns[163] + " = " + std::to_string(e.UNK157)); - v.push_back(columns[164] + " = FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); - v.push_back(columns[165] + " = FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); + v.push_back(columns[164] + " = FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[165] + " = FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[166] + " = '" + Strings::Escape(e.serialization) + "'"); v.push_back(columns[167] + " = '" + Strings::Escape(e.source) + "'"); v.push_back(columns[168] + " = " + std::to_string(e.UNK033)); @@ -2009,7 +2009,7 @@ public: v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -2039,8 +2039,8 @@ public: v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); @@ -2323,7 +2323,7 @@ public: v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -2353,8 +2353,8 @@ public: v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); @@ -2507,291 +2507,291 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Items e{}; - e.id = static_cast(atoi(row[0])); - e.minstatus = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.minstatus = row[1] ? static_cast(atoi(row[1])) : 0; e.Name = row[2] ? row[2] : ""; - e.aagi = static_cast(atoi(row[3])); - e.ac = static_cast(atoi(row[4])); - e.accuracy = static_cast(atoi(row[5])); - e.acha = static_cast(atoi(row[6])); - e.adex = static_cast(atoi(row[7])); - e.aint = static_cast(atoi(row[8])); + e.aagi = row[3] ? static_cast(atoi(row[3])) : 0; + e.ac = row[4] ? static_cast(atoi(row[4])) : 0; + e.accuracy = row[5] ? static_cast(atoi(row[5])) : 0; + e.acha = row[6] ? static_cast(atoi(row[6])) : 0; + e.adex = row[7] ? static_cast(atoi(row[7])) : 0; + e.aint = row[8] ? static_cast(atoi(row[8])) : 0; e.artifactflag = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.asta = static_cast(atoi(row[10])); - e.astr = static_cast(atoi(row[11])); - e.attack = static_cast(atoi(row[12])); - e.augrestrict = static_cast(atoi(row[13])); - e.augslot1type = static_cast(atoi(row[14])); - e.augslot1visible = static_cast(atoi(row[15])); - e.augslot2type = static_cast(atoi(row[16])); - e.augslot2visible = static_cast(atoi(row[17])); - e.augslot3type = static_cast(atoi(row[18])); - e.augslot3visible = static_cast(atoi(row[19])); - e.augslot4type = static_cast(atoi(row[20])); - e.augslot4visible = static_cast(atoi(row[21])); - e.augslot5type = static_cast(atoi(row[22])); - e.augslot5visible = static_cast(atoi(row[23])); - e.augslot6type = static_cast(atoi(row[24])); - e.augslot6visible = static_cast(atoi(row[25])); - e.augtype = static_cast(atoi(row[26])); - e.avoidance = static_cast(atoi(row[27])); - e.awis = static_cast(atoi(row[28])); - e.bagsize = static_cast(atoi(row[29])); - e.bagslots = static_cast(atoi(row[30])); - e.bagtype = static_cast(atoi(row[31])); - e.bagwr = static_cast(atoi(row[32])); - e.banedmgamt = static_cast(atoi(row[33])); - e.banedmgraceamt = static_cast(atoi(row[34])); - e.banedmgbody = static_cast(atoi(row[35])); - e.banedmgrace = static_cast(atoi(row[36])); - e.bardtype = static_cast(atoi(row[37])); - e.bardvalue = static_cast(atoi(row[38])); - e.book = static_cast(atoi(row[39])); - e.casttime = static_cast(atoi(row[40])); - e.casttime_ = static_cast(atoi(row[41])); + e.asta = row[10] ? static_cast(atoi(row[10])) : 0; + e.astr = row[11] ? static_cast(atoi(row[11])) : 0; + e.attack = row[12] ? static_cast(atoi(row[12])) : 0; + e.augrestrict = row[13] ? static_cast(atoi(row[13])) : 0; + e.augslot1type = row[14] ? static_cast(atoi(row[14])) : 0; + e.augslot1visible = row[15] ? static_cast(atoi(row[15])) : 0; + e.augslot2type = row[16] ? static_cast(atoi(row[16])) : 0; + e.augslot2visible = row[17] ? static_cast(atoi(row[17])) : 0; + e.augslot3type = row[18] ? static_cast(atoi(row[18])) : 0; + e.augslot3visible = row[19] ? static_cast(atoi(row[19])) : 0; + e.augslot4type = row[20] ? static_cast(atoi(row[20])) : 0; + e.augslot4visible = row[21] ? static_cast(atoi(row[21])) : 0; + e.augslot5type = row[22] ? static_cast(atoi(row[22])) : 0; + e.augslot5visible = row[23] ? static_cast(atoi(row[23])) : 0; + e.augslot6type = row[24] ? static_cast(atoi(row[24])) : 0; + e.augslot6visible = row[25] ? static_cast(atoi(row[25])) : 0; + e.augtype = row[26] ? static_cast(atoi(row[26])) : 0; + e.avoidance = row[27] ? static_cast(atoi(row[27])) : 0; + e.awis = row[28] ? static_cast(atoi(row[28])) : 0; + e.bagsize = row[29] ? static_cast(atoi(row[29])) : 0; + e.bagslots = row[30] ? static_cast(atoi(row[30])) : 0; + e.bagtype = row[31] ? static_cast(atoi(row[31])) : 0; + e.bagwr = row[32] ? static_cast(atoi(row[32])) : 0; + e.banedmgamt = row[33] ? static_cast(atoi(row[33])) : 0; + e.banedmgraceamt = row[34] ? static_cast(atoi(row[34])) : 0; + e.banedmgbody = row[35] ? static_cast(atoi(row[35])) : 0; + e.banedmgrace = row[36] ? static_cast(atoi(row[36])) : 0; + e.bardtype = row[37] ? static_cast(atoi(row[37])) : 0; + e.bardvalue = row[38] ? static_cast(atoi(row[38])) : 0; + e.book = row[39] ? static_cast(atoi(row[39])) : 0; + e.casttime = row[40] ? static_cast(atoi(row[40])) : 0; + e.casttime_ = row[41] ? static_cast(atoi(row[41])) : 0; e.charmfile = row[42] ? row[42] : ""; e.charmfileid = row[43] ? row[43] : ""; - e.classes = static_cast(atoi(row[44])); + e.classes = row[44] ? static_cast(atoi(row[44])) : 0; e.color = row[45] ? static_cast(strtoul(row[45], nullptr, 10)) : 0; e.combateffects = row[46] ? row[46] : ""; - e.extradmgskill = static_cast(atoi(row[47])); - e.extradmgamt = static_cast(atoi(row[48])); - e.price = static_cast(atoi(row[49])); - e.cr = static_cast(atoi(row[50])); - e.damage = static_cast(atoi(row[51])); - e.damageshield = static_cast(atoi(row[52])); - e.deity = static_cast(atoi(row[53])); - e.delay = static_cast(atoi(row[54])); + e.extradmgskill = row[47] ? static_cast(atoi(row[47])) : 0; + e.extradmgamt = row[48] ? static_cast(atoi(row[48])) : 0; + e.price = row[49] ? static_cast(atoi(row[49])) : 0; + e.cr = row[50] ? static_cast(atoi(row[50])) : 0; + e.damage = row[51] ? static_cast(atoi(row[51])) : 0; + e.damageshield = row[52] ? static_cast(atoi(row[52])) : 0; + e.deity = row[53] ? static_cast(atoi(row[53])) : 0; + e.delay = row[54] ? static_cast(atoi(row[54])) : 0; e.augdistiller = row[55] ? static_cast(strtoul(row[55], nullptr, 10)) : 0; - e.dotshielding = static_cast(atoi(row[56])); - e.dr = static_cast(atoi(row[57])); - e.clicktype = static_cast(atoi(row[58])); - e.clicklevel2 = static_cast(atoi(row[59])); - e.elemdmgtype = static_cast(atoi(row[60])); - e.elemdmgamt = static_cast(atoi(row[61])); - e.endur = static_cast(atoi(row[62])); - e.factionamt1 = static_cast(atoi(row[63])); - e.factionamt2 = static_cast(atoi(row[64])); - e.factionamt3 = static_cast(atoi(row[65])); - e.factionamt4 = static_cast(atoi(row[66])); - e.factionmod1 = static_cast(atoi(row[67])); - e.factionmod2 = static_cast(atoi(row[68])); - e.factionmod3 = static_cast(atoi(row[69])); - e.factionmod4 = static_cast(atoi(row[70])); + e.dotshielding = row[56] ? static_cast(atoi(row[56])) : 0; + e.dr = row[57] ? static_cast(atoi(row[57])) : 0; + e.clicktype = row[58] ? static_cast(atoi(row[58])) : 0; + e.clicklevel2 = row[59] ? static_cast(atoi(row[59])) : 0; + e.elemdmgtype = row[60] ? static_cast(atoi(row[60])) : 0; + e.elemdmgamt = row[61] ? static_cast(atoi(row[61])) : 0; + e.endur = row[62] ? static_cast(atoi(row[62])) : 0; + e.factionamt1 = row[63] ? static_cast(atoi(row[63])) : 0; + e.factionamt2 = row[64] ? static_cast(atoi(row[64])) : 0; + e.factionamt3 = row[65] ? static_cast(atoi(row[65])) : 0; + e.factionamt4 = row[66] ? static_cast(atoi(row[66])) : 0; + e.factionmod1 = row[67] ? static_cast(atoi(row[67])) : 0; + e.factionmod2 = row[68] ? static_cast(atoi(row[68])) : 0; + e.factionmod3 = row[69] ? static_cast(atoi(row[69])) : 0; + e.factionmod4 = row[70] ? static_cast(atoi(row[70])) : 0; e.filename = row[71] ? row[71] : ""; - e.focuseffect = static_cast(atoi(row[72])); - e.fr = static_cast(atoi(row[73])); - e.fvnodrop = static_cast(atoi(row[74])); - e.haste = static_cast(atoi(row[75])); - e.clicklevel = static_cast(atoi(row[76])); - e.hp = static_cast(atoi(row[77])); - e.regen = static_cast(atoi(row[78])); - e.icon = static_cast(atoi(row[79])); + e.focuseffect = row[72] ? static_cast(atoi(row[72])) : 0; + e.fr = row[73] ? static_cast(atoi(row[73])) : 0; + e.fvnodrop = row[74] ? static_cast(atoi(row[74])) : 0; + e.haste = row[75] ? static_cast(atoi(row[75])) : 0; + e.clicklevel = row[76] ? static_cast(atoi(row[76])) : 0; + e.hp = row[77] ? static_cast(atoi(row[77])) : 0; + e.regen = row[78] ? static_cast(atoi(row[78])) : 0; + e.icon = row[79] ? static_cast(atoi(row[79])) : 0; e.idfile = row[80] ? row[80] : ""; - e.itemclass = static_cast(atoi(row[81])); - e.itemtype = static_cast(atoi(row[82])); - e.ldonprice = static_cast(atoi(row[83])); - e.ldontheme = static_cast(atoi(row[84])); - e.ldonsold = static_cast(atoi(row[85])); - e.light = static_cast(atoi(row[86])); + e.itemclass = row[81] ? static_cast(atoi(row[81])) : 0; + e.itemtype = row[82] ? static_cast(atoi(row[82])) : 0; + e.ldonprice = row[83] ? static_cast(atoi(row[83])) : 0; + e.ldontheme = row[84] ? static_cast(atoi(row[84])) : 0; + e.ldonsold = row[85] ? static_cast(atoi(row[85])) : 0; + e.light = row[86] ? static_cast(atoi(row[86])) : 0; e.lore = row[87] ? row[87] : ""; - e.loregroup = static_cast(atoi(row[88])); - e.magic = static_cast(atoi(row[89])); - e.mana = static_cast(atoi(row[90])); - e.manaregen = static_cast(atoi(row[91])); - e.enduranceregen = static_cast(atoi(row[92])); - e.material = static_cast(atoi(row[93])); - e.herosforgemodel = static_cast(atoi(row[94])); - e.maxcharges = static_cast(atoi(row[95])); - e.mr = static_cast(atoi(row[96])); - e.nodrop = static_cast(atoi(row[97])); - e.norent = static_cast(atoi(row[98])); + e.loregroup = row[88] ? static_cast(atoi(row[88])) : 0; + e.magic = row[89] ? static_cast(atoi(row[89])) : 0; + e.mana = row[90] ? static_cast(atoi(row[90])) : 0; + e.manaregen = row[91] ? static_cast(atoi(row[91])) : 0; + e.enduranceregen = row[92] ? static_cast(atoi(row[92])) : 0; + e.material = row[93] ? static_cast(atoi(row[93])) : 0; + e.herosforgemodel = row[94] ? static_cast(atoi(row[94])) : 0; + e.maxcharges = row[95] ? static_cast(atoi(row[95])) : 0; + e.mr = row[96] ? static_cast(atoi(row[96])) : 0; + e.nodrop = row[97] ? static_cast(atoi(row[97])) : 0; + e.norent = row[98] ? static_cast(atoi(row[98])) : 0; e.pendingloreflag = row[99] ? static_cast(strtoul(row[99], nullptr, 10)) : 0; - e.pr = static_cast(atoi(row[100])); - e.procrate = static_cast(atoi(row[101])); - e.races = static_cast(atoi(row[102])); - e.range_ = static_cast(atoi(row[103])); - e.reclevel = static_cast(atoi(row[104])); - e.recskill = static_cast(atoi(row[105])); - e.reqlevel = static_cast(atoi(row[106])); + e.pr = row[100] ? static_cast(atoi(row[100])) : 0; + e.procrate = row[101] ? static_cast(atoi(row[101])) : 0; + e.races = row[102] ? static_cast(atoi(row[102])) : 0; + e.range_ = row[103] ? static_cast(atoi(row[103])) : 0; + e.reclevel = row[104] ? static_cast(atoi(row[104])) : 0; + e.recskill = row[105] ? static_cast(atoi(row[105])) : 0; + e.reqlevel = row[106] ? static_cast(atoi(row[106])) : 0; e.sellrate = row[107] ? strtof(row[107], nullptr) : 0; - e.shielding = static_cast(atoi(row[108])); - e.size = static_cast(atoi(row[109])); - e.skillmodtype = static_cast(atoi(row[110])); - e.skillmodvalue = static_cast(atoi(row[111])); - e.slots = static_cast(atoi(row[112])); - e.clickeffect = static_cast(atoi(row[113])); - e.spellshield = static_cast(atoi(row[114])); - e.strikethrough = static_cast(atoi(row[115])); - e.stunresist = static_cast(atoi(row[116])); + e.shielding = row[108] ? static_cast(atoi(row[108])) : 0; + e.size = row[109] ? static_cast(atoi(row[109])) : 0; + e.skillmodtype = row[110] ? static_cast(atoi(row[110])) : 0; + e.skillmodvalue = row[111] ? static_cast(atoi(row[111])) : 0; + e.slots = row[112] ? static_cast(atoi(row[112])) : 0; + e.clickeffect = row[113] ? static_cast(atoi(row[113])) : 0; + e.spellshield = row[114] ? static_cast(atoi(row[114])) : 0; + e.strikethrough = row[115] ? static_cast(atoi(row[115])) : 0; + e.stunresist = row[116] ? static_cast(atoi(row[116])) : 0; e.summonedflag = row[117] ? static_cast(strtoul(row[117], nullptr, 10)) : 0; - e.tradeskills = static_cast(atoi(row[118])); - e.favor = static_cast(atoi(row[119])); - e.weight = static_cast(atoi(row[120])); - e.UNK012 = static_cast(atoi(row[121])); - e.UNK013 = static_cast(atoi(row[122])); - e.benefitflag = static_cast(atoi(row[123])); - e.UNK054 = static_cast(atoi(row[124])); - e.UNK059 = static_cast(atoi(row[125])); - e.booktype = static_cast(atoi(row[126])); - e.recastdelay = static_cast(atoi(row[127])); - e.recasttype = static_cast(atoi(row[128])); - e.guildfavor = static_cast(atoi(row[129])); - e.UNK123 = static_cast(atoi(row[130])); - e.UNK124 = static_cast(atoi(row[131])); - e.attuneable = static_cast(atoi(row[132])); - e.nopet = static_cast(atoi(row[133])); + e.tradeskills = row[118] ? static_cast(atoi(row[118])) : 0; + e.favor = row[119] ? static_cast(atoi(row[119])) : 0; + e.weight = row[120] ? static_cast(atoi(row[120])) : 0; + e.UNK012 = row[121] ? static_cast(atoi(row[121])) : 0; + e.UNK013 = row[122] ? static_cast(atoi(row[122])) : 0; + e.benefitflag = row[123] ? static_cast(atoi(row[123])) : 0; + e.UNK054 = row[124] ? static_cast(atoi(row[124])) : 0; + e.UNK059 = row[125] ? static_cast(atoi(row[125])) : 0; + e.booktype = row[126] ? static_cast(atoi(row[126])) : 0; + e.recastdelay = row[127] ? static_cast(atoi(row[127])) : 0; + e.recasttype = row[128] ? static_cast(atoi(row[128])) : 0; + e.guildfavor = row[129] ? static_cast(atoi(row[129])) : 0; + e.UNK123 = row[130] ? static_cast(atoi(row[130])) : 0; + e.UNK124 = row[131] ? static_cast(atoi(row[131])) : 0; + e.attuneable = row[132] ? static_cast(atoi(row[132])) : 0; + e.nopet = row[133] ? static_cast(atoi(row[133])) : 0; e.updated = strtoll(row[134] ? row[134] : "-1", nullptr, 10); e.comment = row[135] ? row[135] : ""; - e.UNK127 = static_cast(atoi(row[136])); - e.pointtype = static_cast(atoi(row[137])); - e.potionbelt = static_cast(atoi(row[138])); - e.potionbeltslots = static_cast(atoi(row[139])); - e.stacksize = static_cast(atoi(row[140])); - e.notransfer = static_cast(atoi(row[141])); - e.stackable = static_cast(atoi(row[142])); + e.UNK127 = row[136] ? static_cast(atoi(row[136])) : 0; + e.pointtype = row[137] ? static_cast(atoi(row[137])) : 0; + e.potionbelt = row[138] ? static_cast(atoi(row[138])) : 0; + e.potionbeltslots = row[139] ? static_cast(atoi(row[139])) : 0; + e.stacksize = row[140] ? static_cast(atoi(row[140])) : 0; + e.notransfer = row[141] ? static_cast(atoi(row[141])) : 0; + e.stackable = row[142] ? static_cast(atoi(row[142])) : 0; e.UNK134 = row[143] ? row[143] : ""; - e.UNK137 = static_cast(atoi(row[144])); - e.proceffect = static_cast(atoi(row[145])); - e.proctype = static_cast(atoi(row[146])); - e.proclevel2 = static_cast(atoi(row[147])); - e.proclevel = static_cast(atoi(row[148])); - e.UNK142 = static_cast(atoi(row[149])); - e.worneffect = static_cast(atoi(row[150])); - e.worntype = static_cast(atoi(row[151])); - e.wornlevel2 = static_cast(atoi(row[152])); - e.wornlevel = static_cast(atoi(row[153])); - e.UNK147 = static_cast(atoi(row[154])); - e.focustype = static_cast(atoi(row[155])); - e.focuslevel2 = static_cast(atoi(row[156])); - e.focuslevel = static_cast(atoi(row[157])); - e.UNK152 = static_cast(atoi(row[158])); - e.scrolleffect = static_cast(atoi(row[159])); - e.scrolltype = static_cast(atoi(row[160])); - e.scrolllevel2 = static_cast(atoi(row[161])); - e.scrolllevel = static_cast(atoi(row[162])); - e.UNK157 = static_cast(atoi(row[163])); + e.UNK137 = row[144] ? static_cast(atoi(row[144])) : 0; + e.proceffect = row[145] ? static_cast(atoi(row[145])) : 0; + e.proctype = row[146] ? static_cast(atoi(row[146])) : 0; + e.proclevel2 = row[147] ? static_cast(atoi(row[147])) : 0; + e.proclevel = row[148] ? static_cast(atoi(row[148])) : 0; + e.UNK142 = row[149] ? static_cast(atoi(row[149])) : 0; + e.worneffect = row[150] ? static_cast(atoi(row[150])) : 0; + e.worntype = row[151] ? static_cast(atoi(row[151])) : 0; + e.wornlevel2 = row[152] ? static_cast(atoi(row[152])) : 0; + e.wornlevel = row[153] ? static_cast(atoi(row[153])) : 0; + e.UNK147 = row[154] ? static_cast(atoi(row[154])) : 0; + e.focustype = row[155] ? static_cast(atoi(row[155])) : 0; + e.focuslevel2 = row[156] ? static_cast(atoi(row[156])) : 0; + e.focuslevel = row[157] ? static_cast(atoi(row[157])) : 0; + e.UNK152 = row[158] ? static_cast(atoi(row[158])) : 0; + e.scrolleffect = row[159] ? static_cast(atoi(row[159])) : 0; + e.scrolltype = row[160] ? static_cast(atoi(row[160])) : 0; + e.scrolllevel2 = row[161] ? static_cast(atoi(row[161])) : 0; + e.scrolllevel = row[162] ? static_cast(atoi(row[162])) : 0; + e.UNK157 = row[163] ? static_cast(atoi(row[163])) : 0; e.serialized = strtoll(row[164] ? row[164] : "-1", nullptr, 10); e.verified = strtoll(row[165] ? row[165] : "-1", nullptr, 10); e.serialization = row[166] ? row[166] : ""; e.source = row[167] ? row[167] : ""; - e.UNK033 = static_cast(atoi(row[168])); + e.UNK033 = row[168] ? static_cast(atoi(row[168])) : 0; e.lorefile = row[169] ? row[169] : ""; - e.UNK014 = static_cast(atoi(row[170])); - e.svcorruption = static_cast(atoi(row[171])); - e.skillmodmax = static_cast(atoi(row[172])); - e.UNK060 = static_cast(atoi(row[173])); - e.augslot1unk2 = static_cast(atoi(row[174])); - e.augslot2unk2 = static_cast(atoi(row[175])); - e.augslot3unk2 = static_cast(atoi(row[176])); - e.augslot4unk2 = static_cast(atoi(row[177])); - e.augslot5unk2 = static_cast(atoi(row[178])); - e.augslot6unk2 = static_cast(atoi(row[179])); - e.UNK120 = static_cast(atoi(row[180])); - e.UNK121 = static_cast(atoi(row[181])); - e.questitemflag = static_cast(atoi(row[182])); + e.UNK014 = row[170] ? static_cast(atoi(row[170])) : 0; + e.svcorruption = row[171] ? static_cast(atoi(row[171])) : 0; + e.skillmodmax = row[172] ? static_cast(atoi(row[172])) : 0; + e.UNK060 = row[173] ? static_cast(atoi(row[173])) : 0; + e.augslot1unk2 = row[174] ? static_cast(atoi(row[174])) : 0; + e.augslot2unk2 = row[175] ? static_cast(atoi(row[175])) : 0; + e.augslot3unk2 = row[176] ? static_cast(atoi(row[176])) : 0; + e.augslot4unk2 = row[177] ? static_cast(atoi(row[177])) : 0; + e.augslot5unk2 = row[178] ? static_cast(atoi(row[178])) : 0; + e.augslot6unk2 = row[179] ? static_cast(atoi(row[179])) : 0; + e.UNK120 = row[180] ? static_cast(atoi(row[180])) : 0; + e.UNK121 = row[181] ? static_cast(atoi(row[181])) : 0; + e.questitemflag = row[182] ? static_cast(atoi(row[182])) : 0; e.UNK132 = row[183] ? row[183] : ""; - e.clickunk5 = static_cast(atoi(row[184])); + e.clickunk5 = row[184] ? static_cast(atoi(row[184])) : 0; e.clickunk6 = row[185] ? row[185] : ""; - e.clickunk7 = static_cast(atoi(row[186])); - e.procunk1 = static_cast(atoi(row[187])); - e.procunk2 = static_cast(atoi(row[188])); - e.procunk3 = static_cast(atoi(row[189])); - e.procunk4 = static_cast(atoi(row[190])); + e.clickunk7 = row[186] ? static_cast(atoi(row[186])) : 0; + e.procunk1 = row[187] ? static_cast(atoi(row[187])) : 0; + e.procunk2 = row[188] ? static_cast(atoi(row[188])) : 0; + e.procunk3 = row[189] ? static_cast(atoi(row[189])) : 0; + e.procunk4 = row[190] ? static_cast(atoi(row[190])) : 0; e.procunk6 = row[191] ? row[191] : ""; - e.procunk7 = static_cast(atoi(row[192])); - e.wornunk1 = static_cast(atoi(row[193])); - e.wornunk2 = static_cast(atoi(row[194])); - e.wornunk3 = static_cast(atoi(row[195])); - e.wornunk4 = static_cast(atoi(row[196])); - e.wornunk5 = static_cast(atoi(row[197])); + e.procunk7 = row[192] ? static_cast(atoi(row[192])) : 0; + e.wornunk1 = row[193] ? static_cast(atoi(row[193])) : 0; + e.wornunk2 = row[194] ? static_cast(atoi(row[194])) : 0; + e.wornunk3 = row[195] ? static_cast(atoi(row[195])) : 0; + e.wornunk4 = row[196] ? static_cast(atoi(row[196])) : 0; + e.wornunk5 = row[197] ? static_cast(atoi(row[197])) : 0; e.wornunk6 = row[198] ? row[198] : ""; - e.wornunk7 = static_cast(atoi(row[199])); - e.focusunk1 = static_cast(atoi(row[200])); - e.focusunk2 = static_cast(atoi(row[201])); - e.focusunk3 = static_cast(atoi(row[202])); - e.focusunk4 = static_cast(atoi(row[203])); - e.focusunk5 = static_cast(atoi(row[204])); + e.wornunk7 = row[199] ? static_cast(atoi(row[199])) : 0; + e.focusunk1 = row[200] ? static_cast(atoi(row[200])) : 0; + e.focusunk2 = row[201] ? static_cast(atoi(row[201])) : 0; + e.focusunk3 = row[202] ? static_cast(atoi(row[202])) : 0; + e.focusunk4 = row[203] ? static_cast(atoi(row[203])) : 0; + e.focusunk5 = row[204] ? static_cast(atoi(row[204])) : 0; e.focusunk6 = row[205] ? row[205] : ""; - e.focusunk7 = static_cast(atoi(row[206])); + e.focusunk7 = row[206] ? static_cast(atoi(row[206])) : 0; e.scrollunk1 = row[207] ? static_cast(strtoul(row[207], nullptr, 10)) : 0; - e.scrollunk2 = static_cast(atoi(row[208])); - e.scrollunk3 = static_cast(atoi(row[209])); - e.scrollunk4 = static_cast(atoi(row[210])); - e.scrollunk5 = static_cast(atoi(row[211])); + e.scrollunk2 = row[208] ? static_cast(atoi(row[208])) : 0; + e.scrollunk3 = row[209] ? static_cast(atoi(row[209])) : 0; + e.scrollunk4 = row[210] ? static_cast(atoi(row[210])) : 0; + e.scrollunk5 = row[211] ? static_cast(atoi(row[211])) : 0; e.scrollunk6 = row[212] ? row[212] : ""; - e.scrollunk7 = static_cast(atoi(row[213])); - e.UNK193 = static_cast(atoi(row[214])); - e.purity = static_cast(atoi(row[215])); - e.evoitem = static_cast(atoi(row[216])); - e.evoid = static_cast(atoi(row[217])); - e.evolvinglevel = static_cast(atoi(row[218])); - e.evomax = static_cast(atoi(row[219])); + e.scrollunk7 = row[213] ? static_cast(atoi(row[213])) : 0; + e.UNK193 = row[214] ? static_cast(atoi(row[214])) : 0; + e.purity = row[215] ? static_cast(atoi(row[215])) : 0; + e.evoitem = row[216] ? static_cast(atoi(row[216])) : 0; + e.evoid = row[217] ? static_cast(atoi(row[217])) : 0; + e.evolvinglevel = row[218] ? static_cast(atoi(row[218])) : 0; + e.evomax = row[219] ? static_cast(atoi(row[219])) : 0; e.clickname = row[220] ? row[220] : ""; e.procname = row[221] ? row[221] : ""; e.wornname = row[222] ? row[222] : ""; e.focusname = row[223] ? row[223] : ""; e.scrollname = row[224] ? row[224] : ""; - e.dsmitigation = static_cast(atoi(row[225])); - e.heroic_str = static_cast(atoi(row[226])); - e.heroic_int = static_cast(atoi(row[227])); - e.heroic_wis = static_cast(atoi(row[228])); - e.heroic_agi = static_cast(atoi(row[229])); - e.heroic_dex = static_cast(atoi(row[230])); - e.heroic_sta = static_cast(atoi(row[231])); - e.heroic_cha = static_cast(atoi(row[232])); - e.heroic_pr = static_cast(atoi(row[233])); - e.heroic_dr = static_cast(atoi(row[234])); - e.heroic_fr = static_cast(atoi(row[235])); - e.heroic_cr = static_cast(atoi(row[236])); - e.heroic_mr = static_cast(atoi(row[237])); - e.heroic_svcorrup = static_cast(atoi(row[238])); - e.healamt = static_cast(atoi(row[239])); - e.spelldmg = static_cast(atoi(row[240])); - e.clairvoyance = static_cast(atoi(row[241])); - e.backstabdmg = static_cast(atoi(row[242])); + e.dsmitigation = row[225] ? static_cast(atoi(row[225])) : 0; + e.heroic_str = row[226] ? static_cast(atoi(row[226])) : 0; + e.heroic_int = row[227] ? static_cast(atoi(row[227])) : 0; + e.heroic_wis = row[228] ? static_cast(atoi(row[228])) : 0; + e.heroic_agi = row[229] ? static_cast(atoi(row[229])) : 0; + e.heroic_dex = row[230] ? static_cast(atoi(row[230])) : 0; + e.heroic_sta = row[231] ? static_cast(atoi(row[231])) : 0; + e.heroic_cha = row[232] ? static_cast(atoi(row[232])) : 0; + e.heroic_pr = row[233] ? static_cast(atoi(row[233])) : 0; + e.heroic_dr = row[234] ? static_cast(atoi(row[234])) : 0; + e.heroic_fr = row[235] ? static_cast(atoi(row[235])) : 0; + e.heroic_cr = row[236] ? static_cast(atoi(row[236])) : 0; + e.heroic_mr = row[237] ? static_cast(atoi(row[237])) : 0; + e.heroic_svcorrup = row[238] ? static_cast(atoi(row[238])) : 0; + e.healamt = row[239] ? static_cast(atoi(row[239])) : 0; + e.spelldmg = row[240] ? static_cast(atoi(row[240])) : 0; + e.clairvoyance = row[241] ? static_cast(atoi(row[241])) : 0; + e.backstabdmg = row[242] ? static_cast(atoi(row[242])) : 0; e.created = row[243] ? row[243] : ""; - e.elitematerial = static_cast(atoi(row[244])); - e.ldonsellbackrate = static_cast(atoi(row[245])); - e.scriptfileid = static_cast(atoi(row[246])); - e.expendablearrow = static_cast(atoi(row[247])); - e.powersourcecapacity = static_cast(atoi(row[248])); - e.bardeffect = static_cast(atoi(row[249])); - e.bardeffecttype = static_cast(atoi(row[250])); - e.bardlevel2 = static_cast(atoi(row[251])); - e.bardlevel = static_cast(atoi(row[252])); - e.bardunk1 = static_cast(atoi(row[253])); - e.bardunk2 = static_cast(atoi(row[254])); - e.bardunk3 = static_cast(atoi(row[255])); - e.bardunk4 = static_cast(atoi(row[256])); - e.bardunk5 = static_cast(atoi(row[257])); + e.elitematerial = row[244] ? static_cast(atoi(row[244])) : 0; + e.ldonsellbackrate = row[245] ? static_cast(atoi(row[245])) : 0; + e.scriptfileid = row[246] ? static_cast(atoi(row[246])) : 0; + e.expendablearrow = row[247] ? static_cast(atoi(row[247])) : 0; + e.powersourcecapacity = row[248] ? static_cast(atoi(row[248])) : 0; + e.bardeffect = row[249] ? static_cast(atoi(row[249])) : 0; + e.bardeffecttype = row[250] ? static_cast(atoi(row[250])) : 0; + e.bardlevel2 = row[251] ? static_cast(atoi(row[251])) : 0; + e.bardlevel = row[252] ? static_cast(atoi(row[252])) : 0; + e.bardunk1 = row[253] ? static_cast(atoi(row[253])) : 0; + e.bardunk2 = row[254] ? static_cast(atoi(row[254])) : 0; + e.bardunk3 = row[255] ? static_cast(atoi(row[255])) : 0; + e.bardunk4 = row[256] ? static_cast(atoi(row[256])) : 0; + e.bardunk5 = row[257] ? static_cast(atoi(row[257])) : 0; e.bardname = row[258] ? row[258] : ""; - e.bardunk7 = static_cast(atoi(row[259])); - e.UNK214 = static_cast(atoi(row[260])); - e.subtype = static_cast(atoi(row[261])); - e.UNK220 = static_cast(atoi(row[262])); - e.UNK221 = static_cast(atoi(row[263])); - e.heirloom = static_cast(atoi(row[264])); - e.UNK223 = static_cast(atoi(row[265])); - e.UNK224 = static_cast(atoi(row[266])); - e.UNK225 = static_cast(atoi(row[267])); - e.UNK226 = static_cast(atoi(row[268])); - e.UNK227 = static_cast(atoi(row[269])); - e.UNK228 = static_cast(atoi(row[270])); - e.UNK229 = static_cast(atoi(row[271])); - e.UNK230 = static_cast(atoi(row[272])); - e.UNK231 = static_cast(atoi(row[273])); - e.UNK232 = static_cast(atoi(row[274])); - e.UNK233 = static_cast(atoi(row[275])); - e.UNK234 = static_cast(atoi(row[276])); - e.placeable = static_cast(atoi(row[277])); - e.UNK236 = static_cast(atoi(row[278])); - e.UNK237 = static_cast(atoi(row[279])); - e.UNK238 = static_cast(atoi(row[280])); - e.UNK239 = static_cast(atoi(row[281])); - e.UNK240 = static_cast(atoi(row[282])); - e.UNK241 = static_cast(atoi(row[283])); - e.epicitem = static_cast(atoi(row[284])); + e.bardunk7 = row[259] ? static_cast(atoi(row[259])) : 0; + e.UNK214 = row[260] ? static_cast(atoi(row[260])) : 0; + e.subtype = row[261] ? static_cast(atoi(row[261])) : 0; + e.UNK220 = row[262] ? static_cast(atoi(row[262])) : 0; + e.UNK221 = row[263] ? static_cast(atoi(row[263])) : 0; + e.heirloom = row[264] ? static_cast(atoi(row[264])) : 0; + e.UNK223 = row[265] ? static_cast(atoi(row[265])) : 0; + e.UNK224 = row[266] ? static_cast(atoi(row[266])) : 0; + e.UNK225 = row[267] ? static_cast(atoi(row[267])) : 0; + e.UNK226 = row[268] ? static_cast(atoi(row[268])) : 0; + e.UNK227 = row[269] ? static_cast(atoi(row[269])) : 0; + e.UNK228 = row[270] ? static_cast(atoi(row[270])) : 0; + e.UNK229 = row[271] ? static_cast(atoi(row[271])) : 0; + e.UNK230 = row[272] ? static_cast(atoi(row[272])) : 0; + e.UNK231 = row[273] ? static_cast(atoi(row[273])) : 0; + e.UNK232 = row[274] ? static_cast(atoi(row[274])) : 0; + e.UNK233 = row[275] ? static_cast(atoi(row[275])) : 0; + e.UNK234 = row[276] ? static_cast(atoi(row[276])) : 0; + e.placeable = row[277] ? static_cast(atoi(row[277])) : 0; + e.UNK236 = row[278] ? static_cast(atoi(row[278])) : 0; + e.UNK237 = row[279] ? static_cast(atoi(row[279])) : 0; + e.UNK238 = row[280] ? static_cast(atoi(row[280])) : 0; + e.UNK239 = row[281] ? static_cast(atoi(row[281])) : 0; + e.UNK240 = row[282] ? static_cast(atoi(row[282])) : 0; + e.UNK241 = row[283] ? static_cast(atoi(row[283])) : 0; + e.epicitem = row[284] ? static_cast(atoi(row[284])) : 0; all_entries.push_back(e); } @@ -2816,291 +2816,291 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Items e{}; - e.id = static_cast(atoi(row[0])); - e.minstatus = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.minstatus = row[1] ? static_cast(atoi(row[1])) : 0; e.Name = row[2] ? row[2] : ""; - e.aagi = static_cast(atoi(row[3])); - e.ac = static_cast(atoi(row[4])); - e.accuracy = static_cast(atoi(row[5])); - e.acha = static_cast(atoi(row[6])); - e.adex = static_cast(atoi(row[7])); - e.aint = static_cast(atoi(row[8])); + e.aagi = row[3] ? static_cast(atoi(row[3])) : 0; + e.ac = row[4] ? static_cast(atoi(row[4])) : 0; + e.accuracy = row[5] ? static_cast(atoi(row[5])) : 0; + e.acha = row[6] ? static_cast(atoi(row[6])) : 0; + e.adex = row[7] ? static_cast(atoi(row[7])) : 0; + e.aint = row[8] ? static_cast(atoi(row[8])) : 0; e.artifactflag = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.asta = static_cast(atoi(row[10])); - e.astr = static_cast(atoi(row[11])); - e.attack = static_cast(atoi(row[12])); - e.augrestrict = static_cast(atoi(row[13])); - e.augslot1type = static_cast(atoi(row[14])); - e.augslot1visible = static_cast(atoi(row[15])); - e.augslot2type = static_cast(atoi(row[16])); - e.augslot2visible = static_cast(atoi(row[17])); - e.augslot3type = static_cast(atoi(row[18])); - e.augslot3visible = static_cast(atoi(row[19])); - e.augslot4type = static_cast(atoi(row[20])); - e.augslot4visible = static_cast(atoi(row[21])); - e.augslot5type = static_cast(atoi(row[22])); - e.augslot5visible = static_cast(atoi(row[23])); - e.augslot6type = static_cast(atoi(row[24])); - e.augslot6visible = static_cast(atoi(row[25])); - e.augtype = static_cast(atoi(row[26])); - e.avoidance = static_cast(atoi(row[27])); - e.awis = static_cast(atoi(row[28])); - e.bagsize = static_cast(atoi(row[29])); - e.bagslots = static_cast(atoi(row[30])); - e.bagtype = static_cast(atoi(row[31])); - e.bagwr = static_cast(atoi(row[32])); - e.banedmgamt = static_cast(atoi(row[33])); - e.banedmgraceamt = static_cast(atoi(row[34])); - e.banedmgbody = static_cast(atoi(row[35])); - e.banedmgrace = static_cast(atoi(row[36])); - e.bardtype = static_cast(atoi(row[37])); - e.bardvalue = static_cast(atoi(row[38])); - e.book = static_cast(atoi(row[39])); - e.casttime = static_cast(atoi(row[40])); - e.casttime_ = static_cast(atoi(row[41])); + e.asta = row[10] ? static_cast(atoi(row[10])) : 0; + e.astr = row[11] ? static_cast(atoi(row[11])) : 0; + e.attack = row[12] ? static_cast(atoi(row[12])) : 0; + e.augrestrict = row[13] ? static_cast(atoi(row[13])) : 0; + e.augslot1type = row[14] ? static_cast(atoi(row[14])) : 0; + e.augslot1visible = row[15] ? static_cast(atoi(row[15])) : 0; + e.augslot2type = row[16] ? static_cast(atoi(row[16])) : 0; + e.augslot2visible = row[17] ? static_cast(atoi(row[17])) : 0; + e.augslot3type = row[18] ? static_cast(atoi(row[18])) : 0; + e.augslot3visible = row[19] ? static_cast(atoi(row[19])) : 0; + e.augslot4type = row[20] ? static_cast(atoi(row[20])) : 0; + e.augslot4visible = row[21] ? static_cast(atoi(row[21])) : 0; + e.augslot5type = row[22] ? static_cast(atoi(row[22])) : 0; + e.augslot5visible = row[23] ? static_cast(atoi(row[23])) : 0; + e.augslot6type = row[24] ? static_cast(atoi(row[24])) : 0; + e.augslot6visible = row[25] ? static_cast(atoi(row[25])) : 0; + e.augtype = row[26] ? static_cast(atoi(row[26])) : 0; + e.avoidance = row[27] ? static_cast(atoi(row[27])) : 0; + e.awis = row[28] ? static_cast(atoi(row[28])) : 0; + e.bagsize = row[29] ? static_cast(atoi(row[29])) : 0; + e.bagslots = row[30] ? static_cast(atoi(row[30])) : 0; + e.bagtype = row[31] ? static_cast(atoi(row[31])) : 0; + e.bagwr = row[32] ? static_cast(atoi(row[32])) : 0; + e.banedmgamt = row[33] ? static_cast(atoi(row[33])) : 0; + e.banedmgraceamt = row[34] ? static_cast(atoi(row[34])) : 0; + e.banedmgbody = row[35] ? static_cast(atoi(row[35])) : 0; + e.banedmgrace = row[36] ? static_cast(atoi(row[36])) : 0; + e.bardtype = row[37] ? static_cast(atoi(row[37])) : 0; + e.bardvalue = row[38] ? static_cast(atoi(row[38])) : 0; + e.book = row[39] ? static_cast(atoi(row[39])) : 0; + e.casttime = row[40] ? static_cast(atoi(row[40])) : 0; + e.casttime_ = row[41] ? static_cast(atoi(row[41])) : 0; e.charmfile = row[42] ? row[42] : ""; e.charmfileid = row[43] ? row[43] : ""; - e.classes = static_cast(atoi(row[44])); + e.classes = row[44] ? static_cast(atoi(row[44])) : 0; e.color = row[45] ? static_cast(strtoul(row[45], nullptr, 10)) : 0; e.combateffects = row[46] ? row[46] : ""; - e.extradmgskill = static_cast(atoi(row[47])); - e.extradmgamt = static_cast(atoi(row[48])); - e.price = static_cast(atoi(row[49])); - e.cr = static_cast(atoi(row[50])); - e.damage = static_cast(atoi(row[51])); - e.damageshield = static_cast(atoi(row[52])); - e.deity = static_cast(atoi(row[53])); - e.delay = static_cast(atoi(row[54])); + e.extradmgskill = row[47] ? static_cast(atoi(row[47])) : 0; + e.extradmgamt = row[48] ? static_cast(atoi(row[48])) : 0; + e.price = row[49] ? static_cast(atoi(row[49])) : 0; + e.cr = row[50] ? static_cast(atoi(row[50])) : 0; + e.damage = row[51] ? static_cast(atoi(row[51])) : 0; + e.damageshield = row[52] ? static_cast(atoi(row[52])) : 0; + e.deity = row[53] ? static_cast(atoi(row[53])) : 0; + e.delay = row[54] ? static_cast(atoi(row[54])) : 0; e.augdistiller = row[55] ? static_cast(strtoul(row[55], nullptr, 10)) : 0; - e.dotshielding = static_cast(atoi(row[56])); - e.dr = static_cast(atoi(row[57])); - e.clicktype = static_cast(atoi(row[58])); - e.clicklevel2 = static_cast(atoi(row[59])); - e.elemdmgtype = static_cast(atoi(row[60])); - e.elemdmgamt = static_cast(atoi(row[61])); - e.endur = static_cast(atoi(row[62])); - e.factionamt1 = static_cast(atoi(row[63])); - e.factionamt2 = static_cast(atoi(row[64])); - e.factionamt3 = static_cast(atoi(row[65])); - e.factionamt4 = static_cast(atoi(row[66])); - e.factionmod1 = static_cast(atoi(row[67])); - e.factionmod2 = static_cast(atoi(row[68])); - e.factionmod3 = static_cast(atoi(row[69])); - e.factionmod4 = static_cast(atoi(row[70])); + e.dotshielding = row[56] ? static_cast(atoi(row[56])) : 0; + e.dr = row[57] ? static_cast(atoi(row[57])) : 0; + e.clicktype = row[58] ? static_cast(atoi(row[58])) : 0; + e.clicklevel2 = row[59] ? static_cast(atoi(row[59])) : 0; + e.elemdmgtype = row[60] ? static_cast(atoi(row[60])) : 0; + e.elemdmgamt = row[61] ? static_cast(atoi(row[61])) : 0; + e.endur = row[62] ? static_cast(atoi(row[62])) : 0; + e.factionamt1 = row[63] ? static_cast(atoi(row[63])) : 0; + e.factionamt2 = row[64] ? static_cast(atoi(row[64])) : 0; + e.factionamt3 = row[65] ? static_cast(atoi(row[65])) : 0; + e.factionamt4 = row[66] ? static_cast(atoi(row[66])) : 0; + e.factionmod1 = row[67] ? static_cast(atoi(row[67])) : 0; + e.factionmod2 = row[68] ? static_cast(atoi(row[68])) : 0; + e.factionmod3 = row[69] ? static_cast(atoi(row[69])) : 0; + e.factionmod4 = row[70] ? static_cast(atoi(row[70])) : 0; e.filename = row[71] ? row[71] : ""; - e.focuseffect = static_cast(atoi(row[72])); - e.fr = static_cast(atoi(row[73])); - e.fvnodrop = static_cast(atoi(row[74])); - e.haste = static_cast(atoi(row[75])); - e.clicklevel = static_cast(atoi(row[76])); - e.hp = static_cast(atoi(row[77])); - e.regen = static_cast(atoi(row[78])); - e.icon = static_cast(atoi(row[79])); + e.focuseffect = row[72] ? static_cast(atoi(row[72])) : 0; + e.fr = row[73] ? static_cast(atoi(row[73])) : 0; + e.fvnodrop = row[74] ? static_cast(atoi(row[74])) : 0; + e.haste = row[75] ? static_cast(atoi(row[75])) : 0; + e.clicklevel = row[76] ? static_cast(atoi(row[76])) : 0; + e.hp = row[77] ? static_cast(atoi(row[77])) : 0; + e.regen = row[78] ? static_cast(atoi(row[78])) : 0; + e.icon = row[79] ? static_cast(atoi(row[79])) : 0; e.idfile = row[80] ? row[80] : ""; - e.itemclass = static_cast(atoi(row[81])); - e.itemtype = static_cast(atoi(row[82])); - e.ldonprice = static_cast(atoi(row[83])); - e.ldontheme = static_cast(atoi(row[84])); - e.ldonsold = static_cast(atoi(row[85])); - e.light = static_cast(atoi(row[86])); + e.itemclass = row[81] ? static_cast(atoi(row[81])) : 0; + e.itemtype = row[82] ? static_cast(atoi(row[82])) : 0; + e.ldonprice = row[83] ? static_cast(atoi(row[83])) : 0; + e.ldontheme = row[84] ? static_cast(atoi(row[84])) : 0; + e.ldonsold = row[85] ? static_cast(atoi(row[85])) : 0; + e.light = row[86] ? static_cast(atoi(row[86])) : 0; e.lore = row[87] ? row[87] : ""; - e.loregroup = static_cast(atoi(row[88])); - e.magic = static_cast(atoi(row[89])); - e.mana = static_cast(atoi(row[90])); - e.manaregen = static_cast(atoi(row[91])); - e.enduranceregen = static_cast(atoi(row[92])); - e.material = static_cast(atoi(row[93])); - e.herosforgemodel = static_cast(atoi(row[94])); - e.maxcharges = static_cast(atoi(row[95])); - e.mr = static_cast(atoi(row[96])); - e.nodrop = static_cast(atoi(row[97])); - e.norent = static_cast(atoi(row[98])); + e.loregroup = row[88] ? static_cast(atoi(row[88])) : 0; + e.magic = row[89] ? static_cast(atoi(row[89])) : 0; + e.mana = row[90] ? static_cast(atoi(row[90])) : 0; + e.manaregen = row[91] ? static_cast(atoi(row[91])) : 0; + e.enduranceregen = row[92] ? static_cast(atoi(row[92])) : 0; + e.material = row[93] ? static_cast(atoi(row[93])) : 0; + e.herosforgemodel = row[94] ? static_cast(atoi(row[94])) : 0; + e.maxcharges = row[95] ? static_cast(atoi(row[95])) : 0; + e.mr = row[96] ? static_cast(atoi(row[96])) : 0; + e.nodrop = row[97] ? static_cast(atoi(row[97])) : 0; + e.norent = row[98] ? static_cast(atoi(row[98])) : 0; e.pendingloreflag = row[99] ? static_cast(strtoul(row[99], nullptr, 10)) : 0; - e.pr = static_cast(atoi(row[100])); - e.procrate = static_cast(atoi(row[101])); - e.races = static_cast(atoi(row[102])); - e.range_ = static_cast(atoi(row[103])); - e.reclevel = static_cast(atoi(row[104])); - e.recskill = static_cast(atoi(row[105])); - e.reqlevel = static_cast(atoi(row[106])); + e.pr = row[100] ? static_cast(atoi(row[100])) : 0; + e.procrate = row[101] ? static_cast(atoi(row[101])) : 0; + e.races = row[102] ? static_cast(atoi(row[102])) : 0; + e.range_ = row[103] ? static_cast(atoi(row[103])) : 0; + e.reclevel = row[104] ? static_cast(atoi(row[104])) : 0; + e.recskill = row[105] ? static_cast(atoi(row[105])) : 0; + e.reqlevel = row[106] ? static_cast(atoi(row[106])) : 0; e.sellrate = row[107] ? strtof(row[107], nullptr) : 0; - e.shielding = static_cast(atoi(row[108])); - e.size = static_cast(atoi(row[109])); - e.skillmodtype = static_cast(atoi(row[110])); - e.skillmodvalue = static_cast(atoi(row[111])); - e.slots = static_cast(atoi(row[112])); - e.clickeffect = static_cast(atoi(row[113])); - e.spellshield = static_cast(atoi(row[114])); - e.strikethrough = static_cast(atoi(row[115])); - e.stunresist = static_cast(atoi(row[116])); + e.shielding = row[108] ? static_cast(atoi(row[108])) : 0; + e.size = row[109] ? static_cast(atoi(row[109])) : 0; + e.skillmodtype = row[110] ? static_cast(atoi(row[110])) : 0; + e.skillmodvalue = row[111] ? static_cast(atoi(row[111])) : 0; + e.slots = row[112] ? static_cast(atoi(row[112])) : 0; + e.clickeffect = row[113] ? static_cast(atoi(row[113])) : 0; + e.spellshield = row[114] ? static_cast(atoi(row[114])) : 0; + e.strikethrough = row[115] ? static_cast(atoi(row[115])) : 0; + e.stunresist = row[116] ? static_cast(atoi(row[116])) : 0; e.summonedflag = row[117] ? static_cast(strtoul(row[117], nullptr, 10)) : 0; - e.tradeskills = static_cast(atoi(row[118])); - e.favor = static_cast(atoi(row[119])); - e.weight = static_cast(atoi(row[120])); - e.UNK012 = static_cast(atoi(row[121])); - e.UNK013 = static_cast(atoi(row[122])); - e.benefitflag = static_cast(atoi(row[123])); - e.UNK054 = static_cast(atoi(row[124])); - e.UNK059 = static_cast(atoi(row[125])); - e.booktype = static_cast(atoi(row[126])); - e.recastdelay = static_cast(atoi(row[127])); - e.recasttype = static_cast(atoi(row[128])); - e.guildfavor = static_cast(atoi(row[129])); - e.UNK123 = static_cast(atoi(row[130])); - e.UNK124 = static_cast(atoi(row[131])); - e.attuneable = static_cast(atoi(row[132])); - e.nopet = static_cast(atoi(row[133])); + e.tradeskills = row[118] ? static_cast(atoi(row[118])) : 0; + e.favor = row[119] ? static_cast(atoi(row[119])) : 0; + e.weight = row[120] ? static_cast(atoi(row[120])) : 0; + e.UNK012 = row[121] ? static_cast(atoi(row[121])) : 0; + e.UNK013 = row[122] ? static_cast(atoi(row[122])) : 0; + e.benefitflag = row[123] ? static_cast(atoi(row[123])) : 0; + e.UNK054 = row[124] ? static_cast(atoi(row[124])) : 0; + e.UNK059 = row[125] ? static_cast(atoi(row[125])) : 0; + e.booktype = row[126] ? static_cast(atoi(row[126])) : 0; + e.recastdelay = row[127] ? static_cast(atoi(row[127])) : 0; + e.recasttype = row[128] ? static_cast(atoi(row[128])) : 0; + e.guildfavor = row[129] ? static_cast(atoi(row[129])) : 0; + e.UNK123 = row[130] ? static_cast(atoi(row[130])) : 0; + e.UNK124 = row[131] ? static_cast(atoi(row[131])) : 0; + e.attuneable = row[132] ? static_cast(atoi(row[132])) : 0; + e.nopet = row[133] ? static_cast(atoi(row[133])) : 0; e.updated = strtoll(row[134] ? row[134] : "-1", nullptr, 10); e.comment = row[135] ? row[135] : ""; - e.UNK127 = static_cast(atoi(row[136])); - e.pointtype = static_cast(atoi(row[137])); - e.potionbelt = static_cast(atoi(row[138])); - e.potionbeltslots = static_cast(atoi(row[139])); - e.stacksize = static_cast(atoi(row[140])); - e.notransfer = static_cast(atoi(row[141])); - e.stackable = static_cast(atoi(row[142])); + e.UNK127 = row[136] ? static_cast(atoi(row[136])) : 0; + e.pointtype = row[137] ? static_cast(atoi(row[137])) : 0; + e.potionbelt = row[138] ? static_cast(atoi(row[138])) : 0; + e.potionbeltslots = row[139] ? static_cast(atoi(row[139])) : 0; + e.stacksize = row[140] ? static_cast(atoi(row[140])) : 0; + e.notransfer = row[141] ? static_cast(atoi(row[141])) : 0; + e.stackable = row[142] ? static_cast(atoi(row[142])) : 0; e.UNK134 = row[143] ? row[143] : ""; - e.UNK137 = static_cast(atoi(row[144])); - e.proceffect = static_cast(atoi(row[145])); - e.proctype = static_cast(atoi(row[146])); - e.proclevel2 = static_cast(atoi(row[147])); - e.proclevel = static_cast(atoi(row[148])); - e.UNK142 = static_cast(atoi(row[149])); - e.worneffect = static_cast(atoi(row[150])); - e.worntype = static_cast(atoi(row[151])); - e.wornlevel2 = static_cast(atoi(row[152])); - e.wornlevel = static_cast(atoi(row[153])); - e.UNK147 = static_cast(atoi(row[154])); - e.focustype = static_cast(atoi(row[155])); - e.focuslevel2 = static_cast(atoi(row[156])); - e.focuslevel = static_cast(atoi(row[157])); - e.UNK152 = static_cast(atoi(row[158])); - e.scrolleffect = static_cast(atoi(row[159])); - e.scrolltype = static_cast(atoi(row[160])); - e.scrolllevel2 = static_cast(atoi(row[161])); - e.scrolllevel = static_cast(atoi(row[162])); - e.UNK157 = static_cast(atoi(row[163])); + e.UNK137 = row[144] ? static_cast(atoi(row[144])) : 0; + e.proceffect = row[145] ? static_cast(atoi(row[145])) : 0; + e.proctype = row[146] ? static_cast(atoi(row[146])) : 0; + e.proclevel2 = row[147] ? static_cast(atoi(row[147])) : 0; + e.proclevel = row[148] ? static_cast(atoi(row[148])) : 0; + e.UNK142 = row[149] ? static_cast(atoi(row[149])) : 0; + e.worneffect = row[150] ? static_cast(atoi(row[150])) : 0; + e.worntype = row[151] ? static_cast(atoi(row[151])) : 0; + e.wornlevel2 = row[152] ? static_cast(atoi(row[152])) : 0; + e.wornlevel = row[153] ? static_cast(atoi(row[153])) : 0; + e.UNK147 = row[154] ? static_cast(atoi(row[154])) : 0; + e.focustype = row[155] ? static_cast(atoi(row[155])) : 0; + e.focuslevel2 = row[156] ? static_cast(atoi(row[156])) : 0; + e.focuslevel = row[157] ? static_cast(atoi(row[157])) : 0; + e.UNK152 = row[158] ? static_cast(atoi(row[158])) : 0; + e.scrolleffect = row[159] ? static_cast(atoi(row[159])) : 0; + e.scrolltype = row[160] ? static_cast(atoi(row[160])) : 0; + e.scrolllevel2 = row[161] ? static_cast(atoi(row[161])) : 0; + e.scrolllevel = row[162] ? static_cast(atoi(row[162])) : 0; + e.UNK157 = row[163] ? static_cast(atoi(row[163])) : 0; e.serialized = strtoll(row[164] ? row[164] : "-1", nullptr, 10); e.verified = strtoll(row[165] ? row[165] : "-1", nullptr, 10); e.serialization = row[166] ? row[166] : ""; e.source = row[167] ? row[167] : ""; - e.UNK033 = static_cast(atoi(row[168])); + e.UNK033 = row[168] ? static_cast(atoi(row[168])) : 0; e.lorefile = row[169] ? row[169] : ""; - e.UNK014 = static_cast(atoi(row[170])); - e.svcorruption = static_cast(atoi(row[171])); - e.skillmodmax = static_cast(atoi(row[172])); - e.UNK060 = static_cast(atoi(row[173])); - e.augslot1unk2 = static_cast(atoi(row[174])); - e.augslot2unk2 = static_cast(atoi(row[175])); - e.augslot3unk2 = static_cast(atoi(row[176])); - e.augslot4unk2 = static_cast(atoi(row[177])); - e.augslot5unk2 = static_cast(atoi(row[178])); - e.augslot6unk2 = static_cast(atoi(row[179])); - e.UNK120 = static_cast(atoi(row[180])); - e.UNK121 = static_cast(atoi(row[181])); - e.questitemflag = static_cast(atoi(row[182])); + e.UNK014 = row[170] ? static_cast(atoi(row[170])) : 0; + e.svcorruption = row[171] ? static_cast(atoi(row[171])) : 0; + e.skillmodmax = row[172] ? static_cast(atoi(row[172])) : 0; + e.UNK060 = row[173] ? static_cast(atoi(row[173])) : 0; + e.augslot1unk2 = row[174] ? static_cast(atoi(row[174])) : 0; + e.augslot2unk2 = row[175] ? static_cast(atoi(row[175])) : 0; + e.augslot3unk2 = row[176] ? static_cast(atoi(row[176])) : 0; + e.augslot4unk2 = row[177] ? static_cast(atoi(row[177])) : 0; + e.augslot5unk2 = row[178] ? static_cast(atoi(row[178])) : 0; + e.augslot6unk2 = row[179] ? static_cast(atoi(row[179])) : 0; + e.UNK120 = row[180] ? static_cast(atoi(row[180])) : 0; + e.UNK121 = row[181] ? static_cast(atoi(row[181])) : 0; + e.questitemflag = row[182] ? static_cast(atoi(row[182])) : 0; e.UNK132 = row[183] ? row[183] : ""; - e.clickunk5 = static_cast(atoi(row[184])); + e.clickunk5 = row[184] ? static_cast(atoi(row[184])) : 0; e.clickunk6 = row[185] ? row[185] : ""; - e.clickunk7 = static_cast(atoi(row[186])); - e.procunk1 = static_cast(atoi(row[187])); - e.procunk2 = static_cast(atoi(row[188])); - e.procunk3 = static_cast(atoi(row[189])); - e.procunk4 = static_cast(atoi(row[190])); + e.clickunk7 = row[186] ? static_cast(atoi(row[186])) : 0; + e.procunk1 = row[187] ? static_cast(atoi(row[187])) : 0; + e.procunk2 = row[188] ? static_cast(atoi(row[188])) : 0; + e.procunk3 = row[189] ? static_cast(atoi(row[189])) : 0; + e.procunk4 = row[190] ? static_cast(atoi(row[190])) : 0; e.procunk6 = row[191] ? row[191] : ""; - e.procunk7 = static_cast(atoi(row[192])); - e.wornunk1 = static_cast(atoi(row[193])); - e.wornunk2 = static_cast(atoi(row[194])); - e.wornunk3 = static_cast(atoi(row[195])); - e.wornunk4 = static_cast(atoi(row[196])); - e.wornunk5 = static_cast(atoi(row[197])); + e.procunk7 = row[192] ? static_cast(atoi(row[192])) : 0; + e.wornunk1 = row[193] ? static_cast(atoi(row[193])) : 0; + e.wornunk2 = row[194] ? static_cast(atoi(row[194])) : 0; + e.wornunk3 = row[195] ? static_cast(atoi(row[195])) : 0; + e.wornunk4 = row[196] ? static_cast(atoi(row[196])) : 0; + e.wornunk5 = row[197] ? static_cast(atoi(row[197])) : 0; e.wornunk6 = row[198] ? row[198] : ""; - e.wornunk7 = static_cast(atoi(row[199])); - e.focusunk1 = static_cast(atoi(row[200])); - e.focusunk2 = static_cast(atoi(row[201])); - e.focusunk3 = static_cast(atoi(row[202])); - e.focusunk4 = static_cast(atoi(row[203])); - e.focusunk5 = static_cast(atoi(row[204])); + e.wornunk7 = row[199] ? static_cast(atoi(row[199])) : 0; + e.focusunk1 = row[200] ? static_cast(atoi(row[200])) : 0; + e.focusunk2 = row[201] ? static_cast(atoi(row[201])) : 0; + e.focusunk3 = row[202] ? static_cast(atoi(row[202])) : 0; + e.focusunk4 = row[203] ? static_cast(atoi(row[203])) : 0; + e.focusunk5 = row[204] ? static_cast(atoi(row[204])) : 0; e.focusunk6 = row[205] ? row[205] : ""; - e.focusunk7 = static_cast(atoi(row[206])); + e.focusunk7 = row[206] ? static_cast(atoi(row[206])) : 0; e.scrollunk1 = row[207] ? static_cast(strtoul(row[207], nullptr, 10)) : 0; - e.scrollunk2 = static_cast(atoi(row[208])); - e.scrollunk3 = static_cast(atoi(row[209])); - e.scrollunk4 = static_cast(atoi(row[210])); - e.scrollunk5 = static_cast(atoi(row[211])); + e.scrollunk2 = row[208] ? static_cast(atoi(row[208])) : 0; + e.scrollunk3 = row[209] ? static_cast(atoi(row[209])) : 0; + e.scrollunk4 = row[210] ? static_cast(atoi(row[210])) : 0; + e.scrollunk5 = row[211] ? static_cast(atoi(row[211])) : 0; e.scrollunk6 = row[212] ? row[212] : ""; - e.scrollunk7 = static_cast(atoi(row[213])); - e.UNK193 = static_cast(atoi(row[214])); - e.purity = static_cast(atoi(row[215])); - e.evoitem = static_cast(atoi(row[216])); - e.evoid = static_cast(atoi(row[217])); - e.evolvinglevel = static_cast(atoi(row[218])); - e.evomax = static_cast(atoi(row[219])); + e.scrollunk7 = row[213] ? static_cast(atoi(row[213])) : 0; + e.UNK193 = row[214] ? static_cast(atoi(row[214])) : 0; + e.purity = row[215] ? static_cast(atoi(row[215])) : 0; + e.evoitem = row[216] ? static_cast(atoi(row[216])) : 0; + e.evoid = row[217] ? static_cast(atoi(row[217])) : 0; + e.evolvinglevel = row[218] ? static_cast(atoi(row[218])) : 0; + e.evomax = row[219] ? static_cast(atoi(row[219])) : 0; e.clickname = row[220] ? row[220] : ""; e.procname = row[221] ? row[221] : ""; e.wornname = row[222] ? row[222] : ""; e.focusname = row[223] ? row[223] : ""; e.scrollname = row[224] ? row[224] : ""; - e.dsmitigation = static_cast(atoi(row[225])); - e.heroic_str = static_cast(atoi(row[226])); - e.heroic_int = static_cast(atoi(row[227])); - e.heroic_wis = static_cast(atoi(row[228])); - e.heroic_agi = static_cast(atoi(row[229])); - e.heroic_dex = static_cast(atoi(row[230])); - e.heroic_sta = static_cast(atoi(row[231])); - e.heroic_cha = static_cast(atoi(row[232])); - e.heroic_pr = static_cast(atoi(row[233])); - e.heroic_dr = static_cast(atoi(row[234])); - e.heroic_fr = static_cast(atoi(row[235])); - e.heroic_cr = static_cast(atoi(row[236])); - e.heroic_mr = static_cast(atoi(row[237])); - e.heroic_svcorrup = static_cast(atoi(row[238])); - e.healamt = static_cast(atoi(row[239])); - e.spelldmg = static_cast(atoi(row[240])); - e.clairvoyance = static_cast(atoi(row[241])); - e.backstabdmg = static_cast(atoi(row[242])); + e.dsmitigation = row[225] ? static_cast(atoi(row[225])) : 0; + e.heroic_str = row[226] ? static_cast(atoi(row[226])) : 0; + e.heroic_int = row[227] ? static_cast(atoi(row[227])) : 0; + e.heroic_wis = row[228] ? static_cast(atoi(row[228])) : 0; + e.heroic_agi = row[229] ? static_cast(atoi(row[229])) : 0; + e.heroic_dex = row[230] ? static_cast(atoi(row[230])) : 0; + e.heroic_sta = row[231] ? static_cast(atoi(row[231])) : 0; + e.heroic_cha = row[232] ? static_cast(atoi(row[232])) : 0; + e.heroic_pr = row[233] ? static_cast(atoi(row[233])) : 0; + e.heroic_dr = row[234] ? static_cast(atoi(row[234])) : 0; + e.heroic_fr = row[235] ? static_cast(atoi(row[235])) : 0; + e.heroic_cr = row[236] ? static_cast(atoi(row[236])) : 0; + e.heroic_mr = row[237] ? static_cast(atoi(row[237])) : 0; + e.heroic_svcorrup = row[238] ? static_cast(atoi(row[238])) : 0; + e.healamt = row[239] ? static_cast(atoi(row[239])) : 0; + e.spelldmg = row[240] ? static_cast(atoi(row[240])) : 0; + e.clairvoyance = row[241] ? static_cast(atoi(row[241])) : 0; + e.backstabdmg = row[242] ? static_cast(atoi(row[242])) : 0; e.created = row[243] ? row[243] : ""; - e.elitematerial = static_cast(atoi(row[244])); - e.ldonsellbackrate = static_cast(atoi(row[245])); - e.scriptfileid = static_cast(atoi(row[246])); - e.expendablearrow = static_cast(atoi(row[247])); - e.powersourcecapacity = static_cast(atoi(row[248])); - e.bardeffect = static_cast(atoi(row[249])); - e.bardeffecttype = static_cast(atoi(row[250])); - e.bardlevel2 = static_cast(atoi(row[251])); - e.bardlevel = static_cast(atoi(row[252])); - e.bardunk1 = static_cast(atoi(row[253])); - e.bardunk2 = static_cast(atoi(row[254])); - e.bardunk3 = static_cast(atoi(row[255])); - e.bardunk4 = static_cast(atoi(row[256])); - e.bardunk5 = static_cast(atoi(row[257])); + e.elitematerial = row[244] ? static_cast(atoi(row[244])) : 0; + e.ldonsellbackrate = row[245] ? static_cast(atoi(row[245])) : 0; + e.scriptfileid = row[246] ? static_cast(atoi(row[246])) : 0; + e.expendablearrow = row[247] ? static_cast(atoi(row[247])) : 0; + e.powersourcecapacity = row[248] ? static_cast(atoi(row[248])) : 0; + e.bardeffect = row[249] ? static_cast(atoi(row[249])) : 0; + e.bardeffecttype = row[250] ? static_cast(atoi(row[250])) : 0; + e.bardlevel2 = row[251] ? static_cast(atoi(row[251])) : 0; + e.bardlevel = row[252] ? static_cast(atoi(row[252])) : 0; + e.bardunk1 = row[253] ? static_cast(atoi(row[253])) : 0; + e.bardunk2 = row[254] ? static_cast(atoi(row[254])) : 0; + e.bardunk3 = row[255] ? static_cast(atoi(row[255])) : 0; + e.bardunk4 = row[256] ? static_cast(atoi(row[256])) : 0; + e.bardunk5 = row[257] ? static_cast(atoi(row[257])) : 0; e.bardname = row[258] ? row[258] : ""; - e.bardunk7 = static_cast(atoi(row[259])); - e.UNK214 = static_cast(atoi(row[260])); - e.subtype = static_cast(atoi(row[261])); - e.UNK220 = static_cast(atoi(row[262])); - e.UNK221 = static_cast(atoi(row[263])); - e.heirloom = static_cast(atoi(row[264])); - e.UNK223 = static_cast(atoi(row[265])); - e.UNK224 = static_cast(atoi(row[266])); - e.UNK225 = static_cast(atoi(row[267])); - e.UNK226 = static_cast(atoi(row[268])); - e.UNK227 = static_cast(atoi(row[269])); - e.UNK228 = static_cast(atoi(row[270])); - e.UNK229 = static_cast(atoi(row[271])); - e.UNK230 = static_cast(atoi(row[272])); - e.UNK231 = static_cast(atoi(row[273])); - e.UNK232 = static_cast(atoi(row[274])); - e.UNK233 = static_cast(atoi(row[275])); - e.UNK234 = static_cast(atoi(row[276])); - e.placeable = static_cast(atoi(row[277])); - e.UNK236 = static_cast(atoi(row[278])); - e.UNK237 = static_cast(atoi(row[279])); - e.UNK238 = static_cast(atoi(row[280])); - e.UNK239 = static_cast(atoi(row[281])); - e.UNK240 = static_cast(atoi(row[282])); - e.UNK241 = static_cast(atoi(row[283])); - e.epicitem = static_cast(atoi(row[284])); + e.bardunk7 = row[259] ? static_cast(atoi(row[259])) : 0; + e.UNK214 = row[260] ? static_cast(atoi(row[260])) : 0; + e.subtype = row[261] ? static_cast(atoi(row[261])) : 0; + e.UNK220 = row[262] ? static_cast(atoi(row[262])) : 0; + e.UNK221 = row[263] ? static_cast(atoi(row[263])) : 0; + e.heirloom = row[264] ? static_cast(atoi(row[264])) : 0; + e.UNK223 = row[265] ? static_cast(atoi(row[265])) : 0; + e.UNK224 = row[266] ? static_cast(atoi(row[266])) : 0; + e.UNK225 = row[267] ? static_cast(atoi(row[267])) : 0; + e.UNK226 = row[268] ? static_cast(atoi(row[268])) : 0; + e.UNK227 = row[269] ? static_cast(atoi(row[269])) : 0; + e.UNK228 = row[270] ? static_cast(atoi(row[270])) : 0; + e.UNK229 = row[271] ? static_cast(atoi(row[271])) : 0; + e.UNK230 = row[272] ? static_cast(atoi(row[272])) : 0; + e.UNK231 = row[273] ? static_cast(atoi(row[273])) : 0; + e.UNK232 = row[274] ? static_cast(atoi(row[274])) : 0; + e.UNK233 = row[275] ? static_cast(atoi(row[275])) : 0; + e.UNK234 = row[276] ? static_cast(atoi(row[276])) : 0; + e.placeable = row[277] ? static_cast(atoi(row[277])) : 0; + e.UNK236 = row[278] ? static_cast(atoi(row[278])) : 0; + e.UNK237 = row[279] ? static_cast(atoi(row[279])) : 0; + e.UNK238 = row[280] ? static_cast(atoi(row[280])) : 0; + e.UNK239 = row[281] ? static_cast(atoi(row[281])) : 0; + e.UNK240 = row[282] ? static_cast(atoi(row[282])) : 0; + e.UNK241 = row[283] ? static_cast(atoi(row[283])) : 0; + e.epicitem = row[284] ? static_cast(atoi(row[284])) : 0; all_entries.push_back(e); } @@ -3309,7 +3309,7 @@ public: v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -3339,8 +3339,8 @@ public: v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); @@ -3616,7 +3616,7 @@ public: v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -3646,8 +3646,8 @@ public: v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); diff --git a/common/repositories/base/base_level_exp_mods_repository.h b/common/repositories/base/base_level_exp_mods_repository.h index 61aa8448c..3df29fa44 100644 --- a/common/repositories/base/base_level_exp_mods_repository.h +++ b/common/repositories/base/base_level_exp_mods_repository.h @@ -123,7 +123,7 @@ public: if (results.RowCount() == 1) { LevelExpMods e{}; - e.level = static_cast(atoi(row[0])); + e.level = row[0] ? static_cast(atoi(row[0])) : 0; e.exp_mod = row[1] ? strtof(row[1], nullptr) : 0; e.aa_exp_mod = row[2] ? strtof(row[2], nullptr) : 0; @@ -251,7 +251,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { LevelExpMods e{}; - e.level = static_cast(atoi(row[0])); + e.level = row[0] ? static_cast(atoi(row[0])) : 0; e.exp_mod = row[1] ? strtof(row[1], nullptr) : 0; e.aa_exp_mod = row[2] ? strtof(row[2], nullptr) : 0; @@ -278,7 +278,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { LevelExpMods e{}; - e.level = static_cast(atoi(row[0])); + e.level = row[0] ? static_cast(atoi(row[0])) : 0; e.exp_mod = row[1] ? strtof(row[1], nullptr) : 0; e.aa_exp_mod = row[2] ? strtof(row[2], nullptr) : 0; diff --git a/common/repositories/base/base_login_accounts_repository.h b/common/repositories/base/base_login_accounts_repository.h index ed7610e4e..dbc4cccbe 100644 --- a/common/repositories/base/base_login_accounts_repository.h +++ b/common/repositories/base/base_login_accounts_repository.h @@ -195,9 +195,9 @@ public: v.push_back(columns[3] + " = '" + Strings::Escape(e.account_email) + "'"); v.push_back(columns[4] + " = '" + Strings::Escape(e.source_loginserver) + "'"); v.push_back(columns[5] + " = '" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); - v.push_back(columns[7] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back(columns[8] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[7] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[8] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -225,9 +225,9 @@ public: v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -263,9 +263,9 @@ public: v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -421,9 +421,9 @@ public: v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -452,9 +452,9 @@ public: v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_login_api_tokens_repository.h b/common/repositories/base/base_login_api_tokens_repository.h index e126f80cd..82239dba1 100644 --- a/common/repositories/base/base_login_api_tokens_repository.h +++ b/common/repositories/base/base_login_api_tokens_repository.h @@ -135,10 +135,10 @@ public: if (results.RowCount() == 1) { LoginApiTokens e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.token = row[1] ? row[1] : ""; - e.can_write = static_cast(atoi(row[2])); - e.can_read = static_cast(atoi(row[3])); + e.can_write = row[2] ? static_cast(atoi(row[2])) : 0; + e.can_read = row[3] ? static_cast(atoi(row[3])) : 0; e.created_at = strtoll(row[4] ? row[4] : "-1", nullptr, 10); e.updated_at = strtoll(row[5] ? row[5] : "-1", nullptr, 10); @@ -177,8 +177,8 @@ public: v.push_back(columns[1] + " = '" + Strings::Escape(e.token) + "'"); v.push_back(columns[2] + " = " + std::to_string(e.can_write)); v.push_back(columns[3] + " = " + std::to_string(e.can_read)); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -204,8 +204,8 @@ public: v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -239,8 +239,8 @@ public: v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -274,10 +274,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { LoginApiTokens e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.token = row[1] ? row[1] : ""; - e.can_write = static_cast(atoi(row[2])); - e.can_read = static_cast(atoi(row[3])); + e.can_write = row[2] ? static_cast(atoi(row[2])) : 0; + e.can_read = row[3] ? static_cast(atoi(row[3])) : 0; e.created_at = strtoll(row[4] ? row[4] : "-1", nullptr, 10); e.updated_at = strtoll(row[5] ? row[5] : "-1", nullptr, 10); @@ -304,10 +304,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { LoginApiTokens e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.token = row[1] ? row[1] : ""; - e.can_write = static_cast(atoi(row[2])); - e.can_read = static_cast(atoi(row[3])); + e.can_write = row[2] ? static_cast(atoi(row[2])) : 0; + e.can_read = row[3] ? static_cast(atoi(row[3])) : 0; e.created_at = strtoll(row[4] ? row[4] : "-1", nullptr, 10); e.updated_at = strtoll(row[5] ? row[5] : "-1", nullptr, 10); @@ -388,8 +388,8 @@ public: v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -416,8 +416,8 @@ public: v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_login_server_admins_repository.h b/common/repositories/base/base_login_server_admins_repository.h index 2ec6237c2..06342c8fe 100644 --- a/common/repositories/base/base_login_server_admins_repository.h +++ b/common/repositories/base/base_login_server_admins_repository.h @@ -189,7 +189,7 @@ public: v.push_back(columns[3] + " = '" + Strings::Escape(e.first_name) + "'"); v.push_back(columns[4] + " = '" + Strings::Escape(e.last_name) + "'"); v.push_back(columns[5] + " = '" + Strings::Escape(e.email) + "'"); - v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); + v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[7] + " = '" + Strings::Escape(e.registration_ip_address) + "'"); auto results = db.QueryDatabase( @@ -218,7 +218,7 @@ public: v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); auto results = db.QueryDatabase( @@ -255,7 +255,7 @@ public: v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); @@ -410,7 +410,7 @@ public: v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); auto results = db.QueryDatabase( @@ -440,7 +440,7 @@ public: v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); diff --git a/common/repositories/base/base_login_world_servers_repository.h b/common/repositories/base/base_login_world_servers_repository.h index 864638273..d8107936e 100644 --- a/common/repositories/base/base_login_world_servers_repository.h +++ b/common/repositories/base/base_login_world_servers_repository.h @@ -155,11 +155,11 @@ public: e.long_name = row[1] ? row[1] : ""; e.short_name = row[2] ? row[2] : ""; e.tag_description = row[3] ? row[3] : ""; - e.login_server_list_type_id = static_cast(atoi(row[4])); + e.login_server_list_type_id = row[4] ? static_cast(atoi(row[4])) : 0; e.last_login_date = strtoll(row[5] ? row[5] : "-1", nullptr, 10); e.last_ip_address = row[6] ? row[6] : ""; - e.login_server_admin_id = static_cast(atoi(row[7])); - e.is_server_trusted = static_cast(atoi(row[8])); + e.login_server_admin_id = row[7] ? static_cast(atoi(row[7])) : 0; + e.is_server_trusted = row[8] ? static_cast(atoi(row[8])) : 0; e.note = row[9] ? row[9] : ""; return e; @@ -198,7 +198,7 @@ public: v.push_back(columns[2] + " = '" + Strings::Escape(e.short_name) + "'"); v.push_back(columns[3] + " = '" + Strings::Escape(e.tag_description) + "'"); v.push_back(columns[4] + " = " + std::to_string(e.login_server_list_type_id)); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[6] + " = '" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(columns[7] + " = " + std::to_string(e.login_server_admin_id)); v.push_back(columns[8] + " = " + std::to_string(e.is_server_trusted)); @@ -229,7 +229,7 @@ public: v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); @@ -268,7 +268,7 @@ public: v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); @@ -310,11 +310,11 @@ public: e.long_name = row[1] ? row[1] : ""; e.short_name = row[2] ? row[2] : ""; e.tag_description = row[3] ? row[3] : ""; - e.login_server_list_type_id = static_cast(atoi(row[4])); + e.login_server_list_type_id = row[4] ? static_cast(atoi(row[4])) : 0; e.last_login_date = strtoll(row[5] ? row[5] : "-1", nullptr, 10); e.last_ip_address = row[6] ? row[6] : ""; - e.login_server_admin_id = static_cast(atoi(row[7])); - e.is_server_trusted = static_cast(atoi(row[8])); + e.login_server_admin_id = row[7] ? static_cast(atoi(row[7])) : 0; + e.is_server_trusted = row[8] ? static_cast(atoi(row[8])) : 0; e.note = row[9] ? row[9] : ""; all_entries.push_back(e); @@ -344,11 +344,11 @@ public: e.long_name = row[1] ? row[1] : ""; e.short_name = row[2] ? row[2] : ""; e.tag_description = row[3] ? row[3] : ""; - e.login_server_list_type_id = static_cast(atoi(row[4])); + e.login_server_list_type_id = row[4] ? static_cast(atoi(row[4])) : 0; e.last_login_date = strtoll(row[5] ? row[5] : "-1", nullptr, 10); e.last_ip_address = row[6] ? row[6] : ""; - e.login_server_admin_id = static_cast(atoi(row[7])); - e.is_server_trusted = static_cast(atoi(row[8])); + e.login_server_admin_id = row[7] ? static_cast(atoi(row[7])) : 0; + e.is_server_trusted = row[8] ? static_cast(atoi(row[8])) : 0; e.note = row[9] ? row[9] : ""; all_entries.push_back(e); @@ -429,7 +429,7 @@ public: v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); @@ -461,7 +461,7 @@ public: v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); diff --git a/common/repositories/base/base_logsys_categories_repository.h b/common/repositories/base/base_logsys_categories_repository.h index 804a5f4ad..b10c20964 100644 --- a/common/repositories/base/base_logsys_categories_repository.h +++ b/common/repositories/base/base_logsys_categories_repository.h @@ -139,13 +139,13 @@ public: if (results.RowCount() == 1) { LogsysCategories e{}; - e.log_category_id = static_cast(atoi(row[0])); + e.log_category_id = row[0] ? static_cast(atoi(row[0])) : 0; e.log_category_description = row[1] ? row[1] : ""; - e.log_to_console = static_cast(atoi(row[2])); - e.log_to_file = static_cast(atoi(row[3])); - e.log_to_gmsay = static_cast(atoi(row[4])); - e.log_to_discord = static_cast(atoi(row[5])); - e.discord_webhook_id = static_cast(atoi(row[6])); + e.log_to_console = row[2] ? static_cast(atoi(row[2])) : 0; + e.log_to_file = row[3] ? static_cast(atoi(row[3])) : 0; + e.log_to_gmsay = row[4] ? static_cast(atoi(row[4])) : 0; + e.log_to_discord = row[5] ? static_cast(atoi(row[5])) : 0; + e.discord_webhook_id = row[6] ? static_cast(atoi(row[6])) : 0; return e; } @@ -283,13 +283,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { LogsysCategories e{}; - e.log_category_id = static_cast(atoi(row[0])); + e.log_category_id = row[0] ? static_cast(atoi(row[0])) : 0; e.log_category_description = row[1] ? row[1] : ""; - e.log_to_console = static_cast(atoi(row[2])); - e.log_to_file = static_cast(atoi(row[3])); - e.log_to_gmsay = static_cast(atoi(row[4])); - e.log_to_discord = static_cast(atoi(row[5])); - e.discord_webhook_id = static_cast(atoi(row[6])); + e.log_to_console = row[2] ? static_cast(atoi(row[2])) : 0; + e.log_to_file = row[3] ? static_cast(atoi(row[3])) : 0; + e.log_to_gmsay = row[4] ? static_cast(atoi(row[4])) : 0; + e.log_to_discord = row[5] ? static_cast(atoi(row[5])) : 0; + e.discord_webhook_id = row[6] ? static_cast(atoi(row[6])) : 0; all_entries.push_back(e); } @@ -314,13 +314,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { LogsysCategories e{}; - e.log_category_id = static_cast(atoi(row[0])); + e.log_category_id = row[0] ? static_cast(atoi(row[0])) : 0; e.log_category_description = row[1] ? row[1] : ""; - e.log_to_console = static_cast(atoi(row[2])); - e.log_to_file = static_cast(atoi(row[3])); - e.log_to_gmsay = static_cast(atoi(row[4])); - e.log_to_discord = static_cast(atoi(row[5])); - e.discord_webhook_id = static_cast(atoi(row[6])); + e.log_to_console = row[2] ? static_cast(atoi(row[2])) : 0; + e.log_to_file = row[3] ? static_cast(atoi(row[3])) : 0; + e.log_to_gmsay = row[4] ? static_cast(atoi(row[4])) : 0; + e.log_to_discord = row[5] ? static_cast(atoi(row[5])) : 0; + e.discord_webhook_id = row[6] ? static_cast(atoi(row[6])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_lootdrop_entries_repository.h b/common/repositories/base/base_lootdrop_entries_repository.h index de5e312b5..567f0dbe0 100644 --- a/common/repositories/base/base_lootdrop_entries_repository.h +++ b/common/repositories/base/base_lootdrop_entries_repository.h @@ -156,7 +156,7 @@ public: LootdropEntries e{}; e.lootdrop_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.item_id = static_cast(atoi(row[1])); + e.item_id = row[1] ? static_cast(atoi(row[1])) : 0; e.item_charges = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 1; e.equip_item = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.chance = row[4] ? strtof(row[4], nullptr) : 1; @@ -316,7 +316,7 @@ public: LootdropEntries e{}; e.lootdrop_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.item_id = static_cast(atoi(row[1])); + e.item_id = row[1] ? static_cast(atoi(row[1])) : 0; e.item_charges = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 1; e.equip_item = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.chance = row[4] ? strtof(row[4], nullptr) : 1; @@ -351,7 +351,7 @@ public: LootdropEntries e{}; e.lootdrop_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.item_id = static_cast(atoi(row[1])); + e.item_id = row[1] ? static_cast(atoi(row[1])) : 0; e.item_charges = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 1; e.equip_item = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.chance = row[4] ? strtof(row[4], nullptr) : 1; diff --git a/common/repositories/base/base_lootdrop_repository.h b/common/repositories/base/base_lootdrop_repository.h index 504d8fdfb..b76cd7a58 100644 --- a/common/repositories/base/base_lootdrop_repository.h +++ b/common/repositories/base/base_lootdrop_repository.h @@ -137,8 +137,8 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; - e.min_expansion = static_cast(atoi(row[2])); - e.max_expansion = static_cast(atoi(row[3])); + e.min_expansion = row[2] ? static_cast(atoi(row[2])) : -1; + e.max_expansion = row[3] ? static_cast(atoi(row[3])) : -1; e.content_flags = row[4] ? row[4] : ""; e.content_flags_disabled = row[5] ? row[5] : ""; @@ -276,8 +276,8 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; - e.min_expansion = static_cast(atoi(row[2])); - e.max_expansion = static_cast(atoi(row[3])); + e.min_expansion = row[2] ? static_cast(atoi(row[2])) : -1; + e.max_expansion = row[3] ? static_cast(atoi(row[3])) : -1; e.content_flags = row[4] ? row[4] : ""; e.content_flags_disabled = row[5] ? row[5] : ""; @@ -306,8 +306,8 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; - e.min_expansion = static_cast(atoi(row[2])); - e.max_expansion = static_cast(atoi(row[3])); + e.min_expansion = row[2] ? static_cast(atoi(row[2])) : -1; + e.max_expansion = row[3] ? static_cast(atoi(row[3])) : -1; e.content_flags = row[4] ? row[4] : ""; e.content_flags_disabled = row[5] ? row[5] : ""; diff --git a/common/repositories/base/base_loottable_repository.h b/common/repositories/base/base_loottable_repository.h index eedd05788..41994884a 100644 --- a/common/repositories/base/base_loottable_repository.h +++ b/common/repositories/base/base_loottable_repository.h @@ -156,9 +156,9 @@ public: e.mincash = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.maxcash = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.avgcoin = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.done = static_cast(atoi(row[5])); - e.min_expansion = static_cast(atoi(row[6])); - e.max_expansion = static_cast(atoi(row[7])); + e.done = row[5] ? static_cast(atoi(row[5])) : 0; + e.min_expansion = row[6] ? static_cast(atoi(row[6])) : -1; + e.max_expansion = row[7] ? static_cast(atoi(row[7])) : -1; e.content_flags = row[8] ? row[8] : ""; e.content_flags_disabled = row[9] ? row[9] : ""; @@ -311,9 +311,9 @@ public: e.mincash = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.maxcash = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.avgcoin = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.done = static_cast(atoi(row[5])); - e.min_expansion = static_cast(atoi(row[6])); - e.max_expansion = static_cast(atoi(row[7])); + e.done = row[5] ? static_cast(atoi(row[5])) : 0; + e.min_expansion = row[6] ? static_cast(atoi(row[6])) : -1; + e.max_expansion = row[7] ? static_cast(atoi(row[7])) : -1; e.content_flags = row[8] ? row[8] : ""; e.content_flags_disabled = row[9] ? row[9] : ""; @@ -345,9 +345,9 @@ public: e.mincash = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.maxcash = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.avgcoin = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.done = static_cast(atoi(row[5])); - e.min_expansion = static_cast(atoi(row[6])); - e.max_expansion = static_cast(atoi(row[7])); + e.done = row[5] ? static_cast(atoi(row[5])) : 0; + e.min_expansion = row[6] ? static_cast(atoi(row[6])) : -1; + e.max_expansion = row[7] ? static_cast(atoi(row[7])) : -1; e.content_flags = row[8] ? row[8] : ""; e.content_flags_disabled = row[9] ? row[9] : ""; diff --git a/common/repositories/base/base_mail_repository.h b/common/repositories/base/base_mail_repository.h index 57c3311a5..d13cb9bb2 100644 --- a/common/repositories/base/base_mail_repository.h +++ b/common/repositories/base/base_mail_repository.h @@ -145,12 +145,12 @@ public: e.msgid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.charid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.timestamp = static_cast(atoi(row[2])); + e.timestamp = row[2] ? static_cast(atoi(row[2])) : 0; e.from = row[3] ? row[3] : ""; e.subject = row[4] ? row[4] : ""; e.body = row[5] ? row[5] : ""; e.to = row[6] ? row[6] : ""; - e.status = static_cast(atoi(row[7])); + e.status = row[7] ? static_cast(atoi(row[7])) : 0; return e; } @@ -292,12 +292,12 @@ public: e.msgid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.charid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.timestamp = static_cast(atoi(row[2])); + e.timestamp = row[2] ? static_cast(atoi(row[2])) : 0; e.from = row[3] ? row[3] : ""; e.subject = row[4] ? row[4] : ""; e.body = row[5] ? row[5] : ""; e.to = row[6] ? row[6] : ""; - e.status = static_cast(atoi(row[7])); + e.status = row[7] ? static_cast(atoi(row[7])) : 0; all_entries.push_back(e); } @@ -324,12 +324,12 @@ public: e.msgid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.charid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.timestamp = static_cast(atoi(row[2])); + e.timestamp = row[2] ? static_cast(atoi(row[2])) : 0; e.from = row[3] ? row[3] : ""; e.subject = row[4] ? row[4] : ""; e.body = row[5] ? row[5] : ""; e.to = row[6] ? row[6] : ""; - e.status = static_cast(atoi(row[7])); + e.status = row[7] ? static_cast(atoi(row[7])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_merc_buffs_repository.h b/common/repositories/base/base_merc_buffs_repository.h index d067b1455..48d0b229c 100644 --- a/common/repositories/base/base_merc_buffs_repository.h +++ b/common/repositories/base/base_merc_buffs_repository.h @@ -192,7 +192,7 @@ public: e.SpellId = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.CasterLevel = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.DurationFormula = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.TicsRemaining = static_cast(atoi(row[5])); + e.TicsRemaining = row[5] ? static_cast(atoi(row[5])) : 0; e.PoisonCounters = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.DiseaseCounters = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.CurseCounters = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; @@ -200,12 +200,12 @@ public: e.HitCount = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.MeleeRune = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.MagicRune = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; - e.dot_rune = static_cast(atoi(row[13])); - e.caston_x = static_cast(atoi(row[14])); - e.Persistent = static_cast(atoi(row[15])); - e.caston_y = static_cast(atoi(row[16])); - e.caston_z = static_cast(atoi(row[17])); - e.ExtraDIChance = static_cast(atoi(row[18])); + e.dot_rune = row[13] ? static_cast(atoi(row[13])) : 0; + e.caston_x = row[14] ? static_cast(atoi(row[14])) : 0; + e.Persistent = row[15] ? static_cast(atoi(row[15])) : 0; + e.caston_y = row[16] ? static_cast(atoi(row[16])) : 0; + e.caston_z = row[17] ? static_cast(atoi(row[17])) : 0; + e.ExtraDIChance = row[18] ? static_cast(atoi(row[18])) : 0; return e; } @@ -383,7 +383,7 @@ public: e.SpellId = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.CasterLevel = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.DurationFormula = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.TicsRemaining = static_cast(atoi(row[5])); + e.TicsRemaining = row[5] ? static_cast(atoi(row[5])) : 0; e.PoisonCounters = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.DiseaseCounters = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.CurseCounters = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; @@ -391,12 +391,12 @@ public: e.HitCount = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.MeleeRune = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.MagicRune = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; - e.dot_rune = static_cast(atoi(row[13])); - e.caston_x = static_cast(atoi(row[14])); - e.Persistent = static_cast(atoi(row[15])); - e.caston_y = static_cast(atoi(row[16])); - e.caston_z = static_cast(atoi(row[17])); - e.ExtraDIChance = static_cast(atoi(row[18])); + e.dot_rune = row[13] ? static_cast(atoi(row[13])) : 0; + e.caston_x = row[14] ? static_cast(atoi(row[14])) : 0; + e.Persistent = row[15] ? static_cast(atoi(row[15])) : 0; + e.caston_y = row[16] ? static_cast(atoi(row[16])) : 0; + e.caston_z = row[17] ? static_cast(atoi(row[17])) : 0; + e.ExtraDIChance = row[18] ? static_cast(atoi(row[18])) : 0; all_entries.push_back(e); } @@ -426,7 +426,7 @@ public: e.SpellId = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.CasterLevel = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.DurationFormula = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.TicsRemaining = static_cast(atoi(row[5])); + e.TicsRemaining = row[5] ? static_cast(atoi(row[5])) : 0; e.PoisonCounters = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.DiseaseCounters = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.CurseCounters = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; @@ -434,12 +434,12 @@ public: e.HitCount = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.MeleeRune = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.MagicRune = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; - e.dot_rune = static_cast(atoi(row[13])); - e.caston_x = static_cast(atoi(row[14])); - e.Persistent = static_cast(atoi(row[15])); - e.caston_y = static_cast(atoi(row[16])); - e.caston_z = static_cast(atoi(row[17])); - e.ExtraDIChance = static_cast(atoi(row[18])); + e.dot_rune = row[13] ? static_cast(atoi(row[13])) : 0; + e.caston_x = row[14] ? static_cast(atoi(row[14])) : 0; + e.Persistent = row[15] ? static_cast(atoi(row[15])) : 0; + e.caston_y = row[16] ? static_cast(atoi(row[16])) : 0; + e.caston_z = row[17] ? static_cast(atoi(row[17])) : 0; + e.ExtraDIChance = row[18] ? static_cast(atoi(row[18])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_name_filter_repository.h b/common/repositories/base/base_name_filter_repository.h index 9c3c6c4f3..3871c879b 100644 --- a/common/repositories/base/base_name_filter_repository.h +++ b/common/repositories/base/base_name_filter_repository.h @@ -119,7 +119,7 @@ public: if (results.RowCount() == 1) { NameFilter e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; return e; @@ -242,7 +242,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NameFilter e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; all_entries.push_back(e); @@ -268,7 +268,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NameFilter e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_npc_emotes_repository.h b/common/repositories/base/base_npc_emotes_repository.h index 2812b47b2..6826d38a2 100644 --- a/common/repositories/base/base_npc_emotes_repository.h +++ b/common/repositories/base/base_npc_emotes_repository.h @@ -131,10 +131,10 @@ public: if (results.RowCount() == 1) { NpcEmotes e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.emoteid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.event_ = static_cast(atoi(row[2])); - e.type = static_cast(atoi(row[3])); + e.event_ = row[2] ? static_cast(atoi(row[2])) : 0; + e.type = row[3] ? static_cast(atoi(row[3])) : 0; e.text = row[4] ? row[4] : ""; return e; @@ -266,10 +266,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcEmotes e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.emoteid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.event_ = static_cast(atoi(row[2])); - e.type = static_cast(atoi(row[3])); + e.event_ = row[2] ? static_cast(atoi(row[2])) : 0; + e.type = row[3] ? static_cast(atoi(row[3])) : 0; e.text = row[4] ? row[4] : ""; all_entries.push_back(e); @@ -295,10 +295,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcEmotes e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.emoteid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.event_ = static_cast(atoi(row[2])); - e.type = static_cast(atoi(row[3])); + e.event_ = row[2] ? static_cast(atoi(row[2])) : 0; + e.type = row[3] ? static_cast(atoi(row[3])) : 0; e.text = row[4] ? row[4] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_npc_faction_entries_repository.h b/common/repositories/base/base_npc_faction_entries_repository.h index a77f96f89..b7c60fae3 100644 --- a/common/repositories/base/base_npc_faction_entries_repository.h +++ b/common/repositories/base/base_npc_faction_entries_repository.h @@ -133,9 +133,9 @@ public: e.npc_faction_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.faction_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.value = static_cast(atoi(row[2])); - e.npc_value = static_cast(atoi(row[3])); - e.temp = static_cast(atoi(row[4])); + e.value = row[2] ? static_cast(atoi(row[2])) : 0; + e.npc_value = row[3] ? static_cast(atoi(row[3])) : 0; + e.temp = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -269,9 +269,9 @@ public: e.npc_faction_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.faction_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.value = static_cast(atoi(row[2])); - e.npc_value = static_cast(atoi(row[3])); - e.temp = static_cast(atoi(row[4])); + e.value = row[2] ? static_cast(atoi(row[2])) : 0; + e.npc_value = row[3] ? static_cast(atoi(row[3])) : 0; + e.temp = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -298,9 +298,9 @@ public: e.npc_faction_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.faction_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.value = static_cast(atoi(row[2])); - e.npc_value = static_cast(atoi(row[3])); - e.temp = static_cast(atoi(row[4])); + e.value = row[2] ? static_cast(atoi(row[2])) : 0; + e.npc_value = row[3] ? static_cast(atoi(row[3])) : 0; + e.temp = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_npc_faction_repository.h b/common/repositories/base/base_npc_faction_repository.h index 1b7e2d709..bb3a13d0c 100644 --- a/common/repositories/base/base_npc_faction_repository.h +++ b/common/repositories/base/base_npc_faction_repository.h @@ -127,10 +127,10 @@ public: if (results.RowCount() == 1) { NpcFaction e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.primaryfaction = static_cast(atoi(row[2])); - e.ignore_primary_assist = static_cast(atoi(row[3])); + e.primaryfaction = row[2] ? static_cast(atoi(row[2])) : 0; + e.ignore_primary_assist = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -258,10 +258,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcFaction e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.primaryfaction = static_cast(atoi(row[2])); - e.ignore_primary_assist = static_cast(atoi(row[3])); + e.primaryfaction = row[2] ? static_cast(atoi(row[2])) : 0; + e.ignore_primary_assist = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -286,10 +286,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcFaction e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.primaryfaction = static_cast(atoi(row[2])); - e.ignore_primary_assist = static_cast(atoi(row[3])); + e.primaryfaction = row[2] ? static_cast(atoi(row[2])) : 0; + e.ignore_primary_assist = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_npc_scale_global_base_repository.h b/common/repositories/base/base_npc_scale_global_base_repository.h index 0ea0920e4..f01f5d38a 100644 --- a/common/repositories/base/base_npc_scale_global_base_repository.h +++ b/common/repositories/base/base_npc_scale_global_base_repository.h @@ -243,38 +243,38 @@ public: if (results.RowCount() == 1) { NpcScaleGlobalBase e{}; - e.type = static_cast(atoi(row[0])); - e.level = static_cast(atoi(row[1])); + e.type = row[0] ? static_cast(atoi(row[0])) : 0; + e.level = row[1] ? static_cast(atoi(row[1])) : 0; e.zone_id_list = row[2] ? row[2] : ""; e.instance_version_list = row[3] ? row[3] : ""; - e.ac = static_cast(atoi(row[4])); + e.ac = row[4] ? static_cast(atoi(row[4])) : 0; e.hp = row[5] ? strtoll(row[5], nullptr, 10) : 0; - e.accuracy = static_cast(atoi(row[6])); - e.slow_mitigation = static_cast(atoi(row[7])); - e.attack = static_cast(atoi(row[8])); - e.strength = static_cast(atoi(row[9])); - e.stamina = static_cast(atoi(row[10])); - e.dexterity = static_cast(atoi(row[11])); - e.agility = static_cast(atoi(row[12])); - e.intelligence = static_cast(atoi(row[13])); - e.wisdom = static_cast(atoi(row[14])); - e.charisma = static_cast(atoi(row[15])); - e.magic_resist = static_cast(atoi(row[16])); - e.cold_resist = static_cast(atoi(row[17])); - e.fire_resist = static_cast(atoi(row[18])); - e.poison_resist = static_cast(atoi(row[19])); - e.disease_resist = static_cast(atoi(row[20])); - e.corruption_resist = static_cast(atoi(row[21])); - e.physical_resist = static_cast(atoi(row[22])); - e.min_dmg = static_cast(atoi(row[23])); - e.max_dmg = static_cast(atoi(row[24])); + e.accuracy = row[6] ? static_cast(atoi(row[6])) : 0; + e.slow_mitigation = row[7] ? static_cast(atoi(row[7])) : 0; + e.attack = row[8] ? static_cast(atoi(row[8])) : 0; + e.strength = row[9] ? static_cast(atoi(row[9])) : 0; + e.stamina = row[10] ? static_cast(atoi(row[10])) : 0; + e.dexterity = row[11] ? static_cast(atoi(row[11])) : 0; + e.agility = row[12] ? static_cast(atoi(row[12])) : 0; + e.intelligence = row[13] ? static_cast(atoi(row[13])) : 0; + e.wisdom = row[14] ? static_cast(atoi(row[14])) : 0; + e.charisma = row[15] ? static_cast(atoi(row[15])) : 0; + e.magic_resist = row[16] ? static_cast(atoi(row[16])) : 0; + e.cold_resist = row[17] ? static_cast(atoi(row[17])) : 0; + e.fire_resist = row[18] ? static_cast(atoi(row[18])) : 0; + e.poison_resist = row[19] ? static_cast(atoi(row[19])) : 0; + e.disease_resist = row[20] ? static_cast(atoi(row[20])) : 0; + e.corruption_resist = row[21] ? static_cast(atoi(row[21])) : 0; + e.physical_resist = row[22] ? static_cast(atoi(row[22])) : 0; + e.min_dmg = row[23] ? static_cast(atoi(row[23])) : 0; + e.max_dmg = row[24] ? static_cast(atoi(row[24])) : 0; e.hp_regen_rate = row[25] ? strtoll(row[25], nullptr, 10) : 0; e.hp_regen_per_second = row[26] ? strtoll(row[26], nullptr, 10) : 0; - e.attack_delay = static_cast(atoi(row[27])); - e.spell_scale = static_cast(atoi(row[28])); - e.heal_scale = static_cast(atoi(row[29])); + e.attack_delay = row[27] ? static_cast(atoi(row[27])) : 0; + e.spell_scale = row[28] ? static_cast(atoi(row[28])) : 100; + e.heal_scale = row[29] ? static_cast(atoi(row[29])) : 100; e.avoidance = row[30] ? static_cast(strtoul(row[30], nullptr, 10)) : 0; - e.heroic_strikethrough = static_cast(atoi(row[31])); + e.heroic_strikethrough = row[31] ? static_cast(atoi(row[31])) : 0; e.special_abilities = row[32] ? row[32] : ""; return e; @@ -491,38 +491,38 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcScaleGlobalBase e{}; - e.type = static_cast(atoi(row[0])); - e.level = static_cast(atoi(row[1])); + e.type = row[0] ? static_cast(atoi(row[0])) : 0; + e.level = row[1] ? static_cast(atoi(row[1])) : 0; e.zone_id_list = row[2] ? row[2] : ""; e.instance_version_list = row[3] ? row[3] : ""; - e.ac = static_cast(atoi(row[4])); + e.ac = row[4] ? static_cast(atoi(row[4])) : 0; e.hp = row[5] ? strtoll(row[5], nullptr, 10) : 0; - e.accuracy = static_cast(atoi(row[6])); - e.slow_mitigation = static_cast(atoi(row[7])); - e.attack = static_cast(atoi(row[8])); - e.strength = static_cast(atoi(row[9])); - e.stamina = static_cast(atoi(row[10])); - e.dexterity = static_cast(atoi(row[11])); - e.agility = static_cast(atoi(row[12])); - e.intelligence = static_cast(atoi(row[13])); - e.wisdom = static_cast(atoi(row[14])); - e.charisma = static_cast(atoi(row[15])); - e.magic_resist = static_cast(atoi(row[16])); - e.cold_resist = static_cast(atoi(row[17])); - e.fire_resist = static_cast(atoi(row[18])); - e.poison_resist = static_cast(atoi(row[19])); - e.disease_resist = static_cast(atoi(row[20])); - e.corruption_resist = static_cast(atoi(row[21])); - e.physical_resist = static_cast(atoi(row[22])); - e.min_dmg = static_cast(atoi(row[23])); - e.max_dmg = static_cast(atoi(row[24])); + e.accuracy = row[6] ? static_cast(atoi(row[6])) : 0; + e.slow_mitigation = row[7] ? static_cast(atoi(row[7])) : 0; + e.attack = row[8] ? static_cast(atoi(row[8])) : 0; + e.strength = row[9] ? static_cast(atoi(row[9])) : 0; + e.stamina = row[10] ? static_cast(atoi(row[10])) : 0; + e.dexterity = row[11] ? static_cast(atoi(row[11])) : 0; + e.agility = row[12] ? static_cast(atoi(row[12])) : 0; + e.intelligence = row[13] ? static_cast(atoi(row[13])) : 0; + e.wisdom = row[14] ? static_cast(atoi(row[14])) : 0; + e.charisma = row[15] ? static_cast(atoi(row[15])) : 0; + e.magic_resist = row[16] ? static_cast(atoi(row[16])) : 0; + e.cold_resist = row[17] ? static_cast(atoi(row[17])) : 0; + e.fire_resist = row[18] ? static_cast(atoi(row[18])) : 0; + e.poison_resist = row[19] ? static_cast(atoi(row[19])) : 0; + e.disease_resist = row[20] ? static_cast(atoi(row[20])) : 0; + e.corruption_resist = row[21] ? static_cast(atoi(row[21])) : 0; + e.physical_resist = row[22] ? static_cast(atoi(row[22])) : 0; + e.min_dmg = row[23] ? static_cast(atoi(row[23])) : 0; + e.max_dmg = row[24] ? static_cast(atoi(row[24])) : 0; e.hp_regen_rate = row[25] ? strtoll(row[25], nullptr, 10) : 0; e.hp_regen_per_second = row[26] ? strtoll(row[26], nullptr, 10) : 0; - e.attack_delay = static_cast(atoi(row[27])); - e.spell_scale = static_cast(atoi(row[28])); - e.heal_scale = static_cast(atoi(row[29])); + e.attack_delay = row[27] ? static_cast(atoi(row[27])) : 0; + e.spell_scale = row[28] ? static_cast(atoi(row[28])) : 100; + e.heal_scale = row[29] ? static_cast(atoi(row[29])) : 100; e.avoidance = row[30] ? static_cast(strtoul(row[30], nullptr, 10)) : 0; - e.heroic_strikethrough = static_cast(atoi(row[31])); + e.heroic_strikethrough = row[31] ? static_cast(atoi(row[31])) : 0; e.special_abilities = row[32] ? row[32] : ""; all_entries.push_back(e); @@ -548,38 +548,38 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcScaleGlobalBase e{}; - e.type = static_cast(atoi(row[0])); - e.level = static_cast(atoi(row[1])); + e.type = row[0] ? static_cast(atoi(row[0])) : 0; + e.level = row[1] ? static_cast(atoi(row[1])) : 0; e.zone_id_list = row[2] ? row[2] : ""; e.instance_version_list = row[3] ? row[3] : ""; - e.ac = static_cast(atoi(row[4])); + e.ac = row[4] ? static_cast(atoi(row[4])) : 0; e.hp = row[5] ? strtoll(row[5], nullptr, 10) : 0; - e.accuracy = static_cast(atoi(row[6])); - e.slow_mitigation = static_cast(atoi(row[7])); - e.attack = static_cast(atoi(row[8])); - e.strength = static_cast(atoi(row[9])); - e.stamina = static_cast(atoi(row[10])); - e.dexterity = static_cast(atoi(row[11])); - e.agility = static_cast(atoi(row[12])); - e.intelligence = static_cast(atoi(row[13])); - e.wisdom = static_cast(atoi(row[14])); - e.charisma = static_cast(atoi(row[15])); - e.magic_resist = static_cast(atoi(row[16])); - e.cold_resist = static_cast(atoi(row[17])); - e.fire_resist = static_cast(atoi(row[18])); - e.poison_resist = static_cast(atoi(row[19])); - e.disease_resist = static_cast(atoi(row[20])); - e.corruption_resist = static_cast(atoi(row[21])); - e.physical_resist = static_cast(atoi(row[22])); - e.min_dmg = static_cast(atoi(row[23])); - e.max_dmg = static_cast(atoi(row[24])); + e.accuracy = row[6] ? static_cast(atoi(row[6])) : 0; + e.slow_mitigation = row[7] ? static_cast(atoi(row[7])) : 0; + e.attack = row[8] ? static_cast(atoi(row[8])) : 0; + e.strength = row[9] ? static_cast(atoi(row[9])) : 0; + e.stamina = row[10] ? static_cast(atoi(row[10])) : 0; + e.dexterity = row[11] ? static_cast(atoi(row[11])) : 0; + e.agility = row[12] ? static_cast(atoi(row[12])) : 0; + e.intelligence = row[13] ? static_cast(atoi(row[13])) : 0; + e.wisdom = row[14] ? static_cast(atoi(row[14])) : 0; + e.charisma = row[15] ? static_cast(atoi(row[15])) : 0; + e.magic_resist = row[16] ? static_cast(atoi(row[16])) : 0; + e.cold_resist = row[17] ? static_cast(atoi(row[17])) : 0; + e.fire_resist = row[18] ? static_cast(atoi(row[18])) : 0; + e.poison_resist = row[19] ? static_cast(atoi(row[19])) : 0; + e.disease_resist = row[20] ? static_cast(atoi(row[20])) : 0; + e.corruption_resist = row[21] ? static_cast(atoi(row[21])) : 0; + e.physical_resist = row[22] ? static_cast(atoi(row[22])) : 0; + e.min_dmg = row[23] ? static_cast(atoi(row[23])) : 0; + e.max_dmg = row[24] ? static_cast(atoi(row[24])) : 0; e.hp_regen_rate = row[25] ? strtoll(row[25], nullptr, 10) : 0; e.hp_regen_per_second = row[26] ? strtoll(row[26], nullptr, 10) : 0; - e.attack_delay = static_cast(atoi(row[27])); - e.spell_scale = static_cast(atoi(row[28])); - e.heal_scale = static_cast(atoi(row[29])); + e.attack_delay = row[27] ? static_cast(atoi(row[27])) : 0; + e.spell_scale = row[28] ? static_cast(atoi(row[28])) : 100; + e.heal_scale = row[29] ? static_cast(atoi(row[29])) : 100; e.avoidance = row[30] ? static_cast(strtoul(row[30], nullptr, 10)) : 0; - e.heroic_strikethrough = static_cast(atoi(row[31])); + e.heroic_strikethrough = row[31] ? static_cast(atoi(row[31])) : 0; e.special_abilities = row[32] ? row[32] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_npc_spells_effects_entries_repository.h b/common/repositories/base/base_npc_spells_effects_entries_repository.h index cce837a80..35381cff0 100644 --- a/common/repositories/base/base_npc_spells_effects_entries_repository.h +++ b/common/repositories/base/base_npc_spells_effects_entries_repository.h @@ -144,13 +144,13 @@ public: NpcSpellsEffectsEntries e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.npc_spells_effects_id = static_cast(atoi(row[1])); - e.spell_effect_id = static_cast(atoi(row[2])); + e.npc_spells_effects_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.spell_effect_id = row[2] ? static_cast(atoi(row[2])) : 0; e.minlevel = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.maxlevel = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 255; - e.se_base = static_cast(atoi(row[5])); - e.se_limit = static_cast(atoi(row[6])); - e.se_max = static_cast(atoi(row[7])); + e.se_base = row[5] ? static_cast(atoi(row[5])) : 0; + e.se_limit = row[6] ? static_cast(atoi(row[6])) : 0; + e.se_max = row[7] ? static_cast(atoi(row[7])) : 0; return e; } @@ -291,13 +291,13 @@ public: NpcSpellsEffectsEntries e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.npc_spells_effects_id = static_cast(atoi(row[1])); - e.spell_effect_id = static_cast(atoi(row[2])); + e.npc_spells_effects_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.spell_effect_id = row[2] ? static_cast(atoi(row[2])) : 0; e.minlevel = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.maxlevel = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 255; - e.se_base = static_cast(atoi(row[5])); - e.se_limit = static_cast(atoi(row[6])); - e.se_max = static_cast(atoi(row[7])); + e.se_base = row[5] ? static_cast(atoi(row[5])) : 0; + e.se_limit = row[6] ? static_cast(atoi(row[6])) : 0; + e.se_max = row[7] ? static_cast(atoi(row[7])) : 0; all_entries.push_back(e); } @@ -323,13 +323,13 @@ public: NpcSpellsEffectsEntries e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.npc_spells_effects_id = static_cast(atoi(row[1])); - e.spell_effect_id = static_cast(atoi(row[2])); + e.npc_spells_effects_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.spell_effect_id = row[2] ? static_cast(atoi(row[2])) : 0; e.minlevel = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.maxlevel = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 255; - e.se_base = static_cast(atoi(row[5])); - e.se_limit = static_cast(atoi(row[6])); - e.se_max = static_cast(atoi(row[7])); + e.se_base = row[5] ? static_cast(atoi(row[5])) : 0; + e.se_limit = row[6] ? static_cast(atoi(row[6])) : 0; + e.se_max = row[7] ? static_cast(atoi(row[7])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_npc_spells_entries_repository.h b/common/repositories/base/base_npc_spells_entries_repository.h index 282c285c3..d5508c645 100644 --- a/common/repositories/base/base_npc_spells_entries_repository.h +++ b/common/repositories/base/base_npc_spells_entries_repository.h @@ -160,17 +160,17 @@ public: NpcSpellsEntries e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.npc_spells_id = static_cast(atoi(row[1])); + e.npc_spells_id = row[1] ? static_cast(atoi(row[1])) : 0; e.spellid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.type = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.minlevel = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.maxlevel = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 255; - e.manacost = static_cast(atoi(row[6])); - e.recast_delay = static_cast(atoi(row[7])); - e.priority = static_cast(atoi(row[8])); - e.resist_adjust = static_cast(atoi(row[9])); - e.min_hp = static_cast(atoi(row[10])); - e.max_hp = static_cast(atoi(row[11])); + e.manacost = row[6] ? static_cast(atoi(row[6])) : -1; + e.recast_delay = row[7] ? static_cast(atoi(row[7])) : -1; + e.priority = row[8] ? static_cast(atoi(row[8])) : 0; + e.resist_adjust = row[9] ? static_cast(atoi(row[9])) : 0; + e.min_hp = row[10] ? static_cast(atoi(row[10])) : 0; + e.max_hp = row[11] ? static_cast(atoi(row[11])) : 0; return e; } @@ -323,17 +323,17 @@ public: NpcSpellsEntries e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.npc_spells_id = static_cast(atoi(row[1])); + e.npc_spells_id = row[1] ? static_cast(atoi(row[1])) : 0; e.spellid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.type = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.minlevel = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.maxlevel = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 255; - e.manacost = static_cast(atoi(row[6])); - e.recast_delay = static_cast(atoi(row[7])); - e.priority = static_cast(atoi(row[8])); - e.resist_adjust = static_cast(atoi(row[9])); - e.min_hp = static_cast(atoi(row[10])); - e.max_hp = static_cast(atoi(row[11])); + e.manacost = row[6] ? static_cast(atoi(row[6])) : -1; + e.recast_delay = row[7] ? static_cast(atoi(row[7])) : -1; + e.priority = row[8] ? static_cast(atoi(row[8])) : 0; + e.resist_adjust = row[9] ? static_cast(atoi(row[9])) : 0; + e.min_hp = row[10] ? static_cast(atoi(row[10])) : 0; + e.max_hp = row[11] ? static_cast(atoi(row[11])) : 0; all_entries.push_back(e); } @@ -359,17 +359,17 @@ public: NpcSpellsEntries e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.npc_spells_id = static_cast(atoi(row[1])); + e.npc_spells_id = row[1] ? static_cast(atoi(row[1])) : 0; e.spellid = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.type = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.minlevel = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.maxlevel = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 255; - e.manacost = static_cast(atoi(row[6])); - e.recast_delay = static_cast(atoi(row[7])); - e.priority = static_cast(atoi(row[8])); - e.resist_adjust = static_cast(atoi(row[9])); - e.min_hp = static_cast(atoi(row[10])); - e.max_hp = static_cast(atoi(row[11])); + e.manacost = row[6] ? static_cast(atoi(row[6])) : -1; + e.recast_delay = row[7] ? static_cast(atoi(row[7])) : -1; + e.priority = row[8] ? static_cast(atoi(row[8])) : 0; + e.resist_adjust = row[9] ? static_cast(atoi(row[9])) : 0; + e.min_hp = row[10] ? static_cast(atoi(row[10])) : 0; + e.max_hp = row[11] ? static_cast(atoi(row[11])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_npc_spells_repository.h b/common/repositories/base/base_npc_spells_repository.h index 2cd2cdc2f..e9868d419 100644 --- a/common/repositories/base/base_npc_spells_repository.h +++ b/common/repositories/base/base_npc_spells_repository.h @@ -198,12 +198,12 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; e.parent_list = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.attack_proc = static_cast(atoi(row[3])); - e.proc_chance = static_cast(atoi(row[4])); - e.range_proc = static_cast(atoi(row[5])); - e.rproc_chance = static_cast(atoi(row[6])); - e.defensive_proc = static_cast(atoi(row[7])); - e.dproc_chance = static_cast(atoi(row[8])); + e.attack_proc = row[3] ? static_cast(atoi(row[3])) : -1; + e.proc_chance = row[4] ? static_cast(atoi(row[4])) : 3; + e.range_proc = row[5] ? static_cast(atoi(row[5])) : -1; + e.rproc_chance = row[6] ? static_cast(atoi(row[6])) : 0; + e.defensive_proc = row[7] ? static_cast(atoi(row[7])) : -1; + e.dproc_chance = row[8] ? static_cast(atoi(row[8])) : 0; e.fail_recast = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.engaged_no_sp_recast_min = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.engaged_no_sp_recast_max = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; @@ -397,12 +397,12 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; e.parent_list = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.attack_proc = static_cast(atoi(row[3])); - e.proc_chance = static_cast(atoi(row[4])); - e.range_proc = static_cast(atoi(row[5])); - e.rproc_chance = static_cast(atoi(row[6])); - e.defensive_proc = static_cast(atoi(row[7])); - e.dproc_chance = static_cast(atoi(row[8])); + e.attack_proc = row[3] ? static_cast(atoi(row[3])) : -1; + e.proc_chance = row[4] ? static_cast(atoi(row[4])) : 3; + e.range_proc = row[5] ? static_cast(atoi(row[5])) : -1; + e.rproc_chance = row[6] ? static_cast(atoi(row[6])) : 0; + e.defensive_proc = row[7] ? static_cast(atoi(row[7])) : -1; + e.dproc_chance = row[8] ? static_cast(atoi(row[8])) : 0; e.fail_recast = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.engaged_no_sp_recast_min = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.engaged_no_sp_recast_max = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; @@ -442,12 +442,12 @@ public: e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.name = row[1] ? row[1] : ""; e.parent_list = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.attack_proc = static_cast(atoi(row[3])); - e.proc_chance = static_cast(atoi(row[4])); - e.range_proc = static_cast(atoi(row[5])); - e.rproc_chance = static_cast(atoi(row[6])); - e.defensive_proc = static_cast(atoi(row[7])); - e.dproc_chance = static_cast(atoi(row[8])); + e.attack_proc = row[3] ? static_cast(atoi(row[3])) : -1; + e.proc_chance = row[4] ? static_cast(atoi(row[4])) : 3; + e.range_proc = row[5] ? static_cast(atoi(row[5])) : -1; + e.rproc_chance = row[6] ? static_cast(atoi(row[6])) : 0; + e.defensive_proc = row[7] ? static_cast(atoi(row[7])) : -1; + e.dproc_chance = row[8] ? static_cast(atoi(row[8])) : 0; e.fail_recast = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.engaged_no_sp_recast_min = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.engaged_no_sp_recast_max = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_npc_types_repository.h b/common/repositories/base/base_npc_types_repository.h index 38f99bce1..929e3248f 100644 --- a/common/repositories/base/base_npc_types_repository.h +++ b/common/repositories/base/base_npc_types_repository.h @@ -619,19 +619,19 @@ public: if (results.RowCount() == 1) { NpcTypes e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.lastname = row[2] ? row[2] : ""; e.level = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.race = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.class_ = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.bodytype = static_cast(atoi(row[6])); + e.bodytype = row[6] ? static_cast(atoi(row[6])) : 1; e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0; e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0; e.gender = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.texture = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.helmtexture = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.herosforgemodel = static_cast(atoi(row[12])); + e.herosforgemodel = row[12] ? static_cast(atoi(row[12])) : 0; e.size = row[13] ? strtof(row[13], nullptr) : 0; e.hp_regen_rate = row[14] ? strtoll(row[14], nullptr, 10) : 0; e.hp_regen_per_second = row[15] ? strtoll(row[15], nullptr, 10) : 0; @@ -641,12 +641,12 @@ public: e.alt_currency_id = row[19] ? static_cast(strtoul(row[19], nullptr, 10)) : 0; e.npc_spells_id = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.npc_spells_effects_id = row[21] ? static_cast(strtoul(row[21], nullptr, 10)) : 0; - e.npc_faction_id = static_cast(atoi(row[22])); + e.npc_faction_id = row[22] ? static_cast(atoi(row[22])) : 0; e.adventure_template_id = row[23] ? static_cast(strtoul(row[23], nullptr, 10)) : 0; e.trap_template = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; e.mindmg = row[25] ? static_cast(strtoul(row[25], nullptr, 10)) : 0; e.maxdmg = row[26] ? static_cast(strtoul(row[26], nullptr, 10)) : 0; - e.attack_count = static_cast(atoi(row[27])); + e.attack_count = row[27] ? static_cast(atoi(row[27])) : -1; e.npcspecialattks = row[28] ? row[28] : ""; e.special_abilities = row[29] ? row[29] : ""; e.aggroradius = row[30] ? static_cast(strtoul(row[30], nullptr, 10)) : 0; @@ -658,36 +658,36 @@ public: e.luclin_eyecolor2 = row[36] ? static_cast(strtoul(row[36], nullptr, 10)) : 1; e.luclin_beardcolor = row[37] ? static_cast(strtoul(row[37], nullptr, 10)) : 1; e.luclin_beard = row[38] ? static_cast(strtoul(row[38], nullptr, 10)) : 0; - e.drakkin_heritage = static_cast(atoi(row[39])); - e.drakkin_tattoo = static_cast(atoi(row[40])); - e.drakkin_details = static_cast(atoi(row[41])); + e.drakkin_heritage = row[39] ? static_cast(atoi(row[39])) : 0; + e.drakkin_tattoo = row[40] ? static_cast(atoi(row[40])) : 0; + e.drakkin_details = row[41] ? static_cast(atoi(row[41])) : 0; e.armortint_id = row[42] ? static_cast(strtoul(row[42], nullptr, 10)) : 0; e.armortint_red = row[43] ? static_cast(strtoul(row[43], nullptr, 10)) : 0; e.armortint_green = row[44] ? static_cast(strtoul(row[44], nullptr, 10)) : 0; e.armortint_blue = row[45] ? static_cast(strtoul(row[45], nullptr, 10)) : 0; e.d_melee_texture1 = row[46] ? static_cast(strtoul(row[46], nullptr, 10)) : 0; e.d_melee_texture2 = row[47] ? static_cast(strtoul(row[47], nullptr, 10)) : 0; - e.ammo_idfile = row[48] ? row[48] : ""; + e.ammo_idfile = row[48] ? row[48] : "IT10"; e.prim_melee_type = row[49] ? static_cast(strtoul(row[49], nullptr, 10)) : 28; e.sec_melee_type = row[50] ? static_cast(strtoul(row[50], nullptr, 10)) : 28; e.ranged_type = row[51] ? static_cast(strtoul(row[51], nullptr, 10)) : 7; e.runspeed = row[52] ? strtof(row[52], nullptr) : 0; - e.MR = static_cast(atoi(row[53])); - e.CR = static_cast(atoi(row[54])); - e.DR = static_cast(atoi(row[55])); - e.FR = static_cast(atoi(row[56])); - e.PR = static_cast(atoi(row[57])); - e.Corrup = static_cast(atoi(row[58])); + e.MR = row[53] ? static_cast(atoi(row[53])) : 0; + e.CR = row[54] ? static_cast(atoi(row[54])) : 0; + e.DR = row[55] ? static_cast(atoi(row[55])) : 0; + e.FR = row[56] ? static_cast(atoi(row[56])) : 0; + e.PR = row[57] ? static_cast(atoi(row[57])) : 0; + e.Corrup = row[58] ? static_cast(atoi(row[58])) : 0; e.PhR = row[59] ? static_cast(strtoul(row[59], nullptr, 10)) : 0; - e.see_invis = static_cast(atoi(row[60])); - e.see_invis_undead = static_cast(atoi(row[61])); + e.see_invis = row[60] ? static_cast(atoi(row[60])) : 0; + e.see_invis_undead = row[61] ? static_cast(atoi(row[61])) : 0; e.qglobal = row[62] ? static_cast(strtoul(row[62], nullptr, 10)) : 0; - e.AC = static_cast(atoi(row[63])); - e.npc_aggro = static_cast(atoi(row[64])); - e.spawn_limit = static_cast(atoi(row[65])); + e.AC = row[63] ? static_cast(atoi(row[63])) : 0; + e.npc_aggro = row[64] ? static_cast(atoi(row[64])) : 0; + e.spawn_limit = row[65] ? static_cast(atoi(row[65])) : 0; e.attack_speed = row[66] ? strtof(row[66], nullptr) : 0; e.attack_delay = row[67] ? static_cast(strtoul(row[67], nullptr, 10)) : 30; - e.findable = static_cast(atoi(row[68])); + e.findable = row[68] ? static_cast(atoi(row[68])) : 0; e.STR = row[69] ? static_cast(strtoul(row[69], nullptr, 10)) : 75; e.STA = row[70] ? static_cast(strtoul(row[70], nullptr, 10)) : 75; e.DEX = row[71] ? static_cast(strtoul(row[71], nullptr, 10)) : 75; @@ -695,56 +695,56 @@ public: e._INT = row[73] ? static_cast(strtoul(row[73], nullptr, 10)) : 80; e.WIS = row[74] ? static_cast(strtoul(row[74], nullptr, 10)) : 75; e.CHA = row[75] ? static_cast(strtoul(row[75], nullptr, 10)) : 75; - e.see_hide = static_cast(atoi(row[76])); - e.see_improved_hide = static_cast(atoi(row[77])); - e.trackable = static_cast(atoi(row[78])); - e.isbot = static_cast(atoi(row[79])); - e.exclude = static_cast(atoi(row[80])); - e.ATK = static_cast(atoi(row[81])); - e.Accuracy = static_cast(atoi(row[82])); + e.see_hide = row[76] ? static_cast(atoi(row[76])) : 0; + e.see_improved_hide = row[77] ? static_cast(atoi(row[77])) : 0; + e.trackable = row[78] ? static_cast(atoi(row[78])) : 1; + e.isbot = row[79] ? static_cast(atoi(row[79])) : 0; + e.exclude = row[80] ? static_cast(atoi(row[80])) : 1; + e.ATK = row[81] ? static_cast(atoi(row[81])) : 0; + e.Accuracy = row[82] ? static_cast(atoi(row[82])) : 0; e.Avoidance = row[83] ? static_cast(strtoul(row[83], nullptr, 10)) : 0; - e.slow_mitigation = static_cast(atoi(row[84])); + e.slow_mitigation = row[84] ? static_cast(atoi(row[84])) : 0; e.version = row[85] ? static_cast(strtoul(row[85], nullptr, 10)) : 0; - e.maxlevel = static_cast(atoi(row[86])); - e.scalerate = static_cast(atoi(row[87])); + e.maxlevel = row[86] ? static_cast(atoi(row[86])) : 0; + e.scalerate = row[87] ? static_cast(atoi(row[87])) : 100; e.private_corpse = row[88] ? static_cast(strtoul(row[88], nullptr, 10)) : 0; e.unique_spawn_by_name = row[89] ? static_cast(strtoul(row[89], nullptr, 10)) : 0; e.underwater = row[90] ? static_cast(strtoul(row[90], nullptr, 10)) : 0; - e.isquest = static_cast(atoi(row[91])); + e.isquest = row[91] ? static_cast(atoi(row[91])) : 0; e.emoteid = row[92] ? static_cast(strtoul(row[92], nullptr, 10)) : 0; e.spellscale = row[93] ? strtof(row[93], nullptr) : 100; e.healscale = row[94] ? strtof(row[94], nullptr) : 100; e.no_target_hotkey = row[95] ? static_cast(strtoul(row[95], nullptr, 10)) : 0; e.raid_target = row[96] ? static_cast(strtoul(row[96], nullptr, 10)) : 0; - e.armtexture = static_cast(atoi(row[97])); - e.bracertexture = static_cast(atoi(row[98])); - e.handtexture = static_cast(atoi(row[99])); - e.legtexture = static_cast(atoi(row[100])); - e.feettexture = static_cast(atoi(row[101])); - e.light = static_cast(atoi(row[102])); - e.walkspeed = static_cast(atoi(row[103])); - e.peqid = static_cast(atoi(row[104])); - e.unique_ = static_cast(atoi(row[105])); - e.fixed = static_cast(atoi(row[106])); - e.ignore_despawn = static_cast(atoi(row[107])); - e.show_name = static_cast(atoi(row[108])); - e.untargetable = static_cast(atoi(row[109])); - e.charm_ac = static_cast(atoi(row[110])); - e.charm_min_dmg = static_cast(atoi(row[111])); - e.charm_max_dmg = static_cast(atoi(row[112])); - e.charm_attack_delay = static_cast(atoi(row[113])); - e.charm_accuracy_rating = static_cast(atoi(row[114])); - e.charm_avoidance_rating = static_cast(atoi(row[115])); - e.charm_atk = static_cast(atoi(row[116])); - e.skip_global_loot = static_cast(atoi(row[117])); - e.rare_spawn = static_cast(atoi(row[118])); - e.stuck_behavior = static_cast(atoi(row[119])); - e.model = static_cast(atoi(row[120])); - e.flymode = static_cast(atoi(row[121])); - e.always_aggro = static_cast(atoi(row[122])); - e.exp_mod = static_cast(atoi(row[123])); - e.heroic_strikethrough = static_cast(atoi(row[124])); - e.faction_amount = static_cast(atoi(row[125])); + e.armtexture = row[97] ? static_cast(atoi(row[97])) : 0; + e.bracertexture = row[98] ? static_cast(atoi(row[98])) : 0; + e.handtexture = row[99] ? static_cast(atoi(row[99])) : 0; + e.legtexture = row[100] ? static_cast(atoi(row[100])) : 0; + e.feettexture = row[101] ? static_cast(atoi(row[101])) : 0; + e.light = row[102] ? static_cast(atoi(row[102])) : 0; + e.walkspeed = row[103] ? static_cast(atoi(row[103])) : 0; + e.peqid = row[104] ? static_cast(atoi(row[104])) : 0; + e.unique_ = row[105] ? static_cast(atoi(row[105])) : 0; + e.fixed = row[106] ? static_cast(atoi(row[106])) : 0; + e.ignore_despawn = row[107] ? static_cast(atoi(row[107])) : 0; + e.show_name = row[108] ? static_cast(atoi(row[108])) : 1; + e.untargetable = row[109] ? static_cast(atoi(row[109])) : 0; + e.charm_ac = row[110] ? static_cast(atoi(row[110])) : 0; + e.charm_min_dmg = row[111] ? static_cast(atoi(row[111])) : 0; + e.charm_max_dmg = row[112] ? static_cast(atoi(row[112])) : 0; + e.charm_attack_delay = row[113] ? static_cast(atoi(row[113])) : 0; + e.charm_accuracy_rating = row[114] ? static_cast(atoi(row[114])) : 0; + e.charm_avoidance_rating = row[115] ? static_cast(atoi(row[115])) : 0; + e.charm_atk = row[116] ? static_cast(atoi(row[116])) : 0; + e.skip_global_loot = row[117] ? static_cast(atoi(row[117])) : 0; + e.rare_spawn = row[118] ? static_cast(atoi(row[118])) : 0; + e.stuck_behavior = row[119] ? static_cast(atoi(row[119])) : 0; + e.model = row[120] ? static_cast(atoi(row[120])) : 0; + e.flymode = row[121] ? static_cast(atoi(row[121])) : -1; + e.always_aggro = row[122] ? static_cast(atoi(row[122])) : 0; + e.exp_mod = row[123] ? static_cast(atoi(row[123])) : 100; + e.heroic_strikethrough = row[124] ? static_cast(atoi(row[124])) : 0; + e.faction_amount = row[125] ? static_cast(atoi(row[125])) : 0; e.keeps_sold_items = row[126] ? static_cast(strtoul(row[126], nullptr, 10)) : 1; return e; @@ -1242,19 +1242,19 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcTypes e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.lastname = row[2] ? row[2] : ""; e.level = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.race = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.class_ = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.bodytype = static_cast(atoi(row[6])); + e.bodytype = row[6] ? static_cast(atoi(row[6])) : 1; e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0; e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0; e.gender = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.texture = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.helmtexture = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.herosforgemodel = static_cast(atoi(row[12])); + e.herosforgemodel = row[12] ? static_cast(atoi(row[12])) : 0; e.size = row[13] ? strtof(row[13], nullptr) : 0; e.hp_regen_rate = row[14] ? strtoll(row[14], nullptr, 10) : 0; e.hp_regen_per_second = row[15] ? strtoll(row[15], nullptr, 10) : 0; @@ -1264,12 +1264,12 @@ public: e.alt_currency_id = row[19] ? static_cast(strtoul(row[19], nullptr, 10)) : 0; e.npc_spells_id = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.npc_spells_effects_id = row[21] ? static_cast(strtoul(row[21], nullptr, 10)) : 0; - e.npc_faction_id = static_cast(atoi(row[22])); + e.npc_faction_id = row[22] ? static_cast(atoi(row[22])) : 0; e.adventure_template_id = row[23] ? static_cast(strtoul(row[23], nullptr, 10)) : 0; e.trap_template = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; e.mindmg = row[25] ? static_cast(strtoul(row[25], nullptr, 10)) : 0; e.maxdmg = row[26] ? static_cast(strtoul(row[26], nullptr, 10)) : 0; - e.attack_count = static_cast(atoi(row[27])); + e.attack_count = row[27] ? static_cast(atoi(row[27])) : -1; e.npcspecialattks = row[28] ? row[28] : ""; e.special_abilities = row[29] ? row[29] : ""; e.aggroradius = row[30] ? static_cast(strtoul(row[30], nullptr, 10)) : 0; @@ -1281,36 +1281,36 @@ public: e.luclin_eyecolor2 = row[36] ? static_cast(strtoul(row[36], nullptr, 10)) : 1; e.luclin_beardcolor = row[37] ? static_cast(strtoul(row[37], nullptr, 10)) : 1; e.luclin_beard = row[38] ? static_cast(strtoul(row[38], nullptr, 10)) : 0; - e.drakkin_heritage = static_cast(atoi(row[39])); - e.drakkin_tattoo = static_cast(atoi(row[40])); - e.drakkin_details = static_cast(atoi(row[41])); + e.drakkin_heritage = row[39] ? static_cast(atoi(row[39])) : 0; + e.drakkin_tattoo = row[40] ? static_cast(atoi(row[40])) : 0; + e.drakkin_details = row[41] ? static_cast(atoi(row[41])) : 0; e.armortint_id = row[42] ? static_cast(strtoul(row[42], nullptr, 10)) : 0; e.armortint_red = row[43] ? static_cast(strtoul(row[43], nullptr, 10)) : 0; e.armortint_green = row[44] ? static_cast(strtoul(row[44], nullptr, 10)) : 0; e.armortint_blue = row[45] ? static_cast(strtoul(row[45], nullptr, 10)) : 0; e.d_melee_texture1 = row[46] ? static_cast(strtoul(row[46], nullptr, 10)) : 0; e.d_melee_texture2 = row[47] ? static_cast(strtoul(row[47], nullptr, 10)) : 0; - e.ammo_idfile = row[48] ? row[48] : ""; + e.ammo_idfile = row[48] ? row[48] : "IT10"; e.prim_melee_type = row[49] ? static_cast(strtoul(row[49], nullptr, 10)) : 28; e.sec_melee_type = row[50] ? static_cast(strtoul(row[50], nullptr, 10)) : 28; e.ranged_type = row[51] ? static_cast(strtoul(row[51], nullptr, 10)) : 7; e.runspeed = row[52] ? strtof(row[52], nullptr) : 0; - e.MR = static_cast(atoi(row[53])); - e.CR = static_cast(atoi(row[54])); - e.DR = static_cast(atoi(row[55])); - e.FR = static_cast(atoi(row[56])); - e.PR = static_cast(atoi(row[57])); - e.Corrup = static_cast(atoi(row[58])); + e.MR = row[53] ? static_cast(atoi(row[53])) : 0; + e.CR = row[54] ? static_cast(atoi(row[54])) : 0; + e.DR = row[55] ? static_cast(atoi(row[55])) : 0; + e.FR = row[56] ? static_cast(atoi(row[56])) : 0; + e.PR = row[57] ? static_cast(atoi(row[57])) : 0; + e.Corrup = row[58] ? static_cast(atoi(row[58])) : 0; e.PhR = row[59] ? static_cast(strtoul(row[59], nullptr, 10)) : 0; - e.see_invis = static_cast(atoi(row[60])); - e.see_invis_undead = static_cast(atoi(row[61])); + e.see_invis = row[60] ? static_cast(atoi(row[60])) : 0; + e.see_invis_undead = row[61] ? static_cast(atoi(row[61])) : 0; e.qglobal = row[62] ? static_cast(strtoul(row[62], nullptr, 10)) : 0; - e.AC = static_cast(atoi(row[63])); - e.npc_aggro = static_cast(atoi(row[64])); - e.spawn_limit = static_cast(atoi(row[65])); + e.AC = row[63] ? static_cast(atoi(row[63])) : 0; + e.npc_aggro = row[64] ? static_cast(atoi(row[64])) : 0; + e.spawn_limit = row[65] ? static_cast(atoi(row[65])) : 0; e.attack_speed = row[66] ? strtof(row[66], nullptr) : 0; e.attack_delay = row[67] ? static_cast(strtoul(row[67], nullptr, 10)) : 30; - e.findable = static_cast(atoi(row[68])); + e.findable = row[68] ? static_cast(atoi(row[68])) : 0; e.STR = row[69] ? static_cast(strtoul(row[69], nullptr, 10)) : 75; e.STA = row[70] ? static_cast(strtoul(row[70], nullptr, 10)) : 75; e.DEX = row[71] ? static_cast(strtoul(row[71], nullptr, 10)) : 75; @@ -1318,56 +1318,56 @@ public: e._INT = row[73] ? static_cast(strtoul(row[73], nullptr, 10)) : 80; e.WIS = row[74] ? static_cast(strtoul(row[74], nullptr, 10)) : 75; e.CHA = row[75] ? static_cast(strtoul(row[75], nullptr, 10)) : 75; - e.see_hide = static_cast(atoi(row[76])); - e.see_improved_hide = static_cast(atoi(row[77])); - e.trackable = static_cast(atoi(row[78])); - e.isbot = static_cast(atoi(row[79])); - e.exclude = static_cast(atoi(row[80])); - e.ATK = static_cast(atoi(row[81])); - e.Accuracy = static_cast(atoi(row[82])); + e.see_hide = row[76] ? static_cast(atoi(row[76])) : 0; + e.see_improved_hide = row[77] ? static_cast(atoi(row[77])) : 0; + e.trackable = row[78] ? static_cast(atoi(row[78])) : 1; + e.isbot = row[79] ? static_cast(atoi(row[79])) : 0; + e.exclude = row[80] ? static_cast(atoi(row[80])) : 1; + e.ATK = row[81] ? static_cast(atoi(row[81])) : 0; + e.Accuracy = row[82] ? static_cast(atoi(row[82])) : 0; e.Avoidance = row[83] ? static_cast(strtoul(row[83], nullptr, 10)) : 0; - e.slow_mitigation = static_cast(atoi(row[84])); + e.slow_mitigation = row[84] ? static_cast(atoi(row[84])) : 0; e.version = row[85] ? static_cast(strtoul(row[85], nullptr, 10)) : 0; - e.maxlevel = static_cast(atoi(row[86])); - e.scalerate = static_cast(atoi(row[87])); + e.maxlevel = row[86] ? static_cast(atoi(row[86])) : 0; + e.scalerate = row[87] ? static_cast(atoi(row[87])) : 100; e.private_corpse = row[88] ? static_cast(strtoul(row[88], nullptr, 10)) : 0; e.unique_spawn_by_name = row[89] ? static_cast(strtoul(row[89], nullptr, 10)) : 0; e.underwater = row[90] ? static_cast(strtoul(row[90], nullptr, 10)) : 0; - e.isquest = static_cast(atoi(row[91])); + e.isquest = row[91] ? static_cast(atoi(row[91])) : 0; e.emoteid = row[92] ? static_cast(strtoul(row[92], nullptr, 10)) : 0; e.spellscale = row[93] ? strtof(row[93], nullptr) : 100; e.healscale = row[94] ? strtof(row[94], nullptr) : 100; e.no_target_hotkey = row[95] ? static_cast(strtoul(row[95], nullptr, 10)) : 0; e.raid_target = row[96] ? static_cast(strtoul(row[96], nullptr, 10)) : 0; - e.armtexture = static_cast(atoi(row[97])); - e.bracertexture = static_cast(atoi(row[98])); - e.handtexture = static_cast(atoi(row[99])); - e.legtexture = static_cast(atoi(row[100])); - e.feettexture = static_cast(atoi(row[101])); - e.light = static_cast(atoi(row[102])); - e.walkspeed = static_cast(atoi(row[103])); - e.peqid = static_cast(atoi(row[104])); - e.unique_ = static_cast(atoi(row[105])); - e.fixed = static_cast(atoi(row[106])); - e.ignore_despawn = static_cast(atoi(row[107])); - e.show_name = static_cast(atoi(row[108])); - e.untargetable = static_cast(atoi(row[109])); - e.charm_ac = static_cast(atoi(row[110])); - e.charm_min_dmg = static_cast(atoi(row[111])); - e.charm_max_dmg = static_cast(atoi(row[112])); - e.charm_attack_delay = static_cast(atoi(row[113])); - e.charm_accuracy_rating = static_cast(atoi(row[114])); - e.charm_avoidance_rating = static_cast(atoi(row[115])); - e.charm_atk = static_cast(atoi(row[116])); - e.skip_global_loot = static_cast(atoi(row[117])); - e.rare_spawn = static_cast(atoi(row[118])); - e.stuck_behavior = static_cast(atoi(row[119])); - e.model = static_cast(atoi(row[120])); - e.flymode = static_cast(atoi(row[121])); - e.always_aggro = static_cast(atoi(row[122])); - e.exp_mod = static_cast(atoi(row[123])); - e.heroic_strikethrough = static_cast(atoi(row[124])); - e.faction_amount = static_cast(atoi(row[125])); + e.armtexture = row[97] ? static_cast(atoi(row[97])) : 0; + e.bracertexture = row[98] ? static_cast(atoi(row[98])) : 0; + e.handtexture = row[99] ? static_cast(atoi(row[99])) : 0; + e.legtexture = row[100] ? static_cast(atoi(row[100])) : 0; + e.feettexture = row[101] ? static_cast(atoi(row[101])) : 0; + e.light = row[102] ? static_cast(atoi(row[102])) : 0; + e.walkspeed = row[103] ? static_cast(atoi(row[103])) : 0; + e.peqid = row[104] ? static_cast(atoi(row[104])) : 0; + e.unique_ = row[105] ? static_cast(atoi(row[105])) : 0; + e.fixed = row[106] ? static_cast(atoi(row[106])) : 0; + e.ignore_despawn = row[107] ? static_cast(atoi(row[107])) : 0; + e.show_name = row[108] ? static_cast(atoi(row[108])) : 1; + e.untargetable = row[109] ? static_cast(atoi(row[109])) : 0; + e.charm_ac = row[110] ? static_cast(atoi(row[110])) : 0; + e.charm_min_dmg = row[111] ? static_cast(atoi(row[111])) : 0; + e.charm_max_dmg = row[112] ? static_cast(atoi(row[112])) : 0; + e.charm_attack_delay = row[113] ? static_cast(atoi(row[113])) : 0; + e.charm_accuracy_rating = row[114] ? static_cast(atoi(row[114])) : 0; + e.charm_avoidance_rating = row[115] ? static_cast(atoi(row[115])) : 0; + e.charm_atk = row[116] ? static_cast(atoi(row[116])) : 0; + e.skip_global_loot = row[117] ? static_cast(atoi(row[117])) : 0; + e.rare_spawn = row[118] ? static_cast(atoi(row[118])) : 0; + e.stuck_behavior = row[119] ? static_cast(atoi(row[119])) : 0; + e.model = row[120] ? static_cast(atoi(row[120])) : 0; + e.flymode = row[121] ? static_cast(atoi(row[121])) : -1; + e.always_aggro = row[122] ? static_cast(atoi(row[122])) : 0; + e.exp_mod = row[123] ? static_cast(atoi(row[123])) : 100; + e.heroic_strikethrough = row[124] ? static_cast(atoi(row[124])) : 0; + e.faction_amount = row[125] ? static_cast(atoi(row[125])) : 0; e.keeps_sold_items = row[126] ? static_cast(strtoul(row[126], nullptr, 10)) : 1; all_entries.push_back(e); @@ -1393,19 +1393,19 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { NpcTypes e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; e.lastname = row[2] ? row[2] : ""; e.level = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.race = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.class_ = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.bodytype = static_cast(atoi(row[6])); + e.bodytype = row[6] ? static_cast(atoi(row[6])) : 1; e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0; e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0; e.gender = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.texture = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; e.helmtexture = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.herosforgemodel = static_cast(atoi(row[12])); + e.herosforgemodel = row[12] ? static_cast(atoi(row[12])) : 0; e.size = row[13] ? strtof(row[13], nullptr) : 0; e.hp_regen_rate = row[14] ? strtoll(row[14], nullptr, 10) : 0; e.hp_regen_per_second = row[15] ? strtoll(row[15], nullptr, 10) : 0; @@ -1415,12 +1415,12 @@ public: e.alt_currency_id = row[19] ? static_cast(strtoul(row[19], nullptr, 10)) : 0; e.npc_spells_id = row[20] ? static_cast(strtoul(row[20], nullptr, 10)) : 0; e.npc_spells_effects_id = row[21] ? static_cast(strtoul(row[21], nullptr, 10)) : 0; - e.npc_faction_id = static_cast(atoi(row[22])); + e.npc_faction_id = row[22] ? static_cast(atoi(row[22])) : 0; e.adventure_template_id = row[23] ? static_cast(strtoul(row[23], nullptr, 10)) : 0; e.trap_template = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; e.mindmg = row[25] ? static_cast(strtoul(row[25], nullptr, 10)) : 0; e.maxdmg = row[26] ? static_cast(strtoul(row[26], nullptr, 10)) : 0; - e.attack_count = static_cast(atoi(row[27])); + e.attack_count = row[27] ? static_cast(atoi(row[27])) : -1; e.npcspecialattks = row[28] ? row[28] : ""; e.special_abilities = row[29] ? row[29] : ""; e.aggroradius = row[30] ? static_cast(strtoul(row[30], nullptr, 10)) : 0; @@ -1432,36 +1432,36 @@ public: e.luclin_eyecolor2 = row[36] ? static_cast(strtoul(row[36], nullptr, 10)) : 1; e.luclin_beardcolor = row[37] ? static_cast(strtoul(row[37], nullptr, 10)) : 1; e.luclin_beard = row[38] ? static_cast(strtoul(row[38], nullptr, 10)) : 0; - e.drakkin_heritage = static_cast(atoi(row[39])); - e.drakkin_tattoo = static_cast(atoi(row[40])); - e.drakkin_details = static_cast(atoi(row[41])); + e.drakkin_heritage = row[39] ? static_cast(atoi(row[39])) : 0; + e.drakkin_tattoo = row[40] ? static_cast(atoi(row[40])) : 0; + e.drakkin_details = row[41] ? static_cast(atoi(row[41])) : 0; e.armortint_id = row[42] ? static_cast(strtoul(row[42], nullptr, 10)) : 0; e.armortint_red = row[43] ? static_cast(strtoul(row[43], nullptr, 10)) : 0; e.armortint_green = row[44] ? static_cast(strtoul(row[44], nullptr, 10)) : 0; e.armortint_blue = row[45] ? static_cast(strtoul(row[45], nullptr, 10)) : 0; e.d_melee_texture1 = row[46] ? static_cast(strtoul(row[46], nullptr, 10)) : 0; e.d_melee_texture2 = row[47] ? static_cast(strtoul(row[47], nullptr, 10)) : 0; - e.ammo_idfile = row[48] ? row[48] : ""; + e.ammo_idfile = row[48] ? row[48] : "IT10"; e.prim_melee_type = row[49] ? static_cast(strtoul(row[49], nullptr, 10)) : 28; e.sec_melee_type = row[50] ? static_cast(strtoul(row[50], nullptr, 10)) : 28; e.ranged_type = row[51] ? static_cast(strtoul(row[51], nullptr, 10)) : 7; e.runspeed = row[52] ? strtof(row[52], nullptr) : 0; - e.MR = static_cast(atoi(row[53])); - e.CR = static_cast(atoi(row[54])); - e.DR = static_cast(atoi(row[55])); - e.FR = static_cast(atoi(row[56])); - e.PR = static_cast(atoi(row[57])); - e.Corrup = static_cast(atoi(row[58])); + e.MR = row[53] ? static_cast(atoi(row[53])) : 0; + e.CR = row[54] ? static_cast(atoi(row[54])) : 0; + e.DR = row[55] ? static_cast(atoi(row[55])) : 0; + e.FR = row[56] ? static_cast(atoi(row[56])) : 0; + e.PR = row[57] ? static_cast(atoi(row[57])) : 0; + e.Corrup = row[58] ? static_cast(atoi(row[58])) : 0; e.PhR = row[59] ? static_cast(strtoul(row[59], nullptr, 10)) : 0; - e.see_invis = static_cast(atoi(row[60])); - e.see_invis_undead = static_cast(atoi(row[61])); + e.see_invis = row[60] ? static_cast(atoi(row[60])) : 0; + e.see_invis_undead = row[61] ? static_cast(atoi(row[61])) : 0; e.qglobal = row[62] ? static_cast(strtoul(row[62], nullptr, 10)) : 0; - e.AC = static_cast(atoi(row[63])); - e.npc_aggro = static_cast(atoi(row[64])); - e.spawn_limit = static_cast(atoi(row[65])); + e.AC = row[63] ? static_cast(atoi(row[63])) : 0; + e.npc_aggro = row[64] ? static_cast(atoi(row[64])) : 0; + e.spawn_limit = row[65] ? static_cast(atoi(row[65])) : 0; e.attack_speed = row[66] ? strtof(row[66], nullptr) : 0; e.attack_delay = row[67] ? static_cast(strtoul(row[67], nullptr, 10)) : 30; - e.findable = static_cast(atoi(row[68])); + e.findable = row[68] ? static_cast(atoi(row[68])) : 0; e.STR = row[69] ? static_cast(strtoul(row[69], nullptr, 10)) : 75; e.STA = row[70] ? static_cast(strtoul(row[70], nullptr, 10)) : 75; e.DEX = row[71] ? static_cast(strtoul(row[71], nullptr, 10)) : 75; @@ -1469,56 +1469,56 @@ public: e._INT = row[73] ? static_cast(strtoul(row[73], nullptr, 10)) : 80; e.WIS = row[74] ? static_cast(strtoul(row[74], nullptr, 10)) : 75; e.CHA = row[75] ? static_cast(strtoul(row[75], nullptr, 10)) : 75; - e.see_hide = static_cast(atoi(row[76])); - e.see_improved_hide = static_cast(atoi(row[77])); - e.trackable = static_cast(atoi(row[78])); - e.isbot = static_cast(atoi(row[79])); - e.exclude = static_cast(atoi(row[80])); - e.ATK = static_cast(atoi(row[81])); - e.Accuracy = static_cast(atoi(row[82])); + e.see_hide = row[76] ? static_cast(atoi(row[76])) : 0; + e.see_improved_hide = row[77] ? static_cast(atoi(row[77])) : 0; + e.trackable = row[78] ? static_cast(atoi(row[78])) : 1; + e.isbot = row[79] ? static_cast(atoi(row[79])) : 0; + e.exclude = row[80] ? static_cast(atoi(row[80])) : 1; + e.ATK = row[81] ? static_cast(atoi(row[81])) : 0; + e.Accuracy = row[82] ? static_cast(atoi(row[82])) : 0; e.Avoidance = row[83] ? static_cast(strtoul(row[83], nullptr, 10)) : 0; - e.slow_mitigation = static_cast(atoi(row[84])); + e.slow_mitigation = row[84] ? static_cast(atoi(row[84])) : 0; e.version = row[85] ? static_cast(strtoul(row[85], nullptr, 10)) : 0; - e.maxlevel = static_cast(atoi(row[86])); - e.scalerate = static_cast(atoi(row[87])); + e.maxlevel = row[86] ? static_cast(atoi(row[86])) : 0; + e.scalerate = row[87] ? static_cast(atoi(row[87])) : 100; e.private_corpse = row[88] ? static_cast(strtoul(row[88], nullptr, 10)) : 0; e.unique_spawn_by_name = row[89] ? static_cast(strtoul(row[89], nullptr, 10)) : 0; e.underwater = row[90] ? static_cast(strtoul(row[90], nullptr, 10)) : 0; - e.isquest = static_cast(atoi(row[91])); + e.isquest = row[91] ? static_cast(atoi(row[91])) : 0; e.emoteid = row[92] ? static_cast(strtoul(row[92], nullptr, 10)) : 0; e.spellscale = row[93] ? strtof(row[93], nullptr) : 100; e.healscale = row[94] ? strtof(row[94], nullptr) : 100; e.no_target_hotkey = row[95] ? static_cast(strtoul(row[95], nullptr, 10)) : 0; e.raid_target = row[96] ? static_cast(strtoul(row[96], nullptr, 10)) : 0; - e.armtexture = static_cast(atoi(row[97])); - e.bracertexture = static_cast(atoi(row[98])); - e.handtexture = static_cast(atoi(row[99])); - e.legtexture = static_cast(atoi(row[100])); - e.feettexture = static_cast(atoi(row[101])); - e.light = static_cast(atoi(row[102])); - e.walkspeed = static_cast(atoi(row[103])); - e.peqid = static_cast(atoi(row[104])); - e.unique_ = static_cast(atoi(row[105])); - e.fixed = static_cast(atoi(row[106])); - e.ignore_despawn = static_cast(atoi(row[107])); - e.show_name = static_cast(atoi(row[108])); - e.untargetable = static_cast(atoi(row[109])); - e.charm_ac = static_cast(atoi(row[110])); - e.charm_min_dmg = static_cast(atoi(row[111])); - e.charm_max_dmg = static_cast(atoi(row[112])); - e.charm_attack_delay = static_cast(atoi(row[113])); - e.charm_accuracy_rating = static_cast(atoi(row[114])); - e.charm_avoidance_rating = static_cast(atoi(row[115])); - e.charm_atk = static_cast(atoi(row[116])); - e.skip_global_loot = static_cast(atoi(row[117])); - e.rare_spawn = static_cast(atoi(row[118])); - e.stuck_behavior = static_cast(atoi(row[119])); - e.model = static_cast(atoi(row[120])); - e.flymode = static_cast(atoi(row[121])); - e.always_aggro = static_cast(atoi(row[122])); - e.exp_mod = static_cast(atoi(row[123])); - e.heroic_strikethrough = static_cast(atoi(row[124])); - e.faction_amount = static_cast(atoi(row[125])); + e.armtexture = row[97] ? static_cast(atoi(row[97])) : 0; + e.bracertexture = row[98] ? static_cast(atoi(row[98])) : 0; + e.handtexture = row[99] ? static_cast(atoi(row[99])) : 0; + e.legtexture = row[100] ? static_cast(atoi(row[100])) : 0; + e.feettexture = row[101] ? static_cast(atoi(row[101])) : 0; + e.light = row[102] ? static_cast(atoi(row[102])) : 0; + e.walkspeed = row[103] ? static_cast(atoi(row[103])) : 0; + e.peqid = row[104] ? static_cast(atoi(row[104])) : 0; + e.unique_ = row[105] ? static_cast(atoi(row[105])) : 0; + e.fixed = row[106] ? static_cast(atoi(row[106])) : 0; + e.ignore_despawn = row[107] ? static_cast(atoi(row[107])) : 0; + e.show_name = row[108] ? static_cast(atoi(row[108])) : 1; + e.untargetable = row[109] ? static_cast(atoi(row[109])) : 0; + e.charm_ac = row[110] ? static_cast(atoi(row[110])) : 0; + e.charm_min_dmg = row[111] ? static_cast(atoi(row[111])) : 0; + e.charm_max_dmg = row[112] ? static_cast(atoi(row[112])) : 0; + e.charm_attack_delay = row[113] ? static_cast(atoi(row[113])) : 0; + e.charm_accuracy_rating = row[114] ? static_cast(atoi(row[114])) : 0; + e.charm_avoidance_rating = row[115] ? static_cast(atoi(row[115])) : 0; + e.charm_atk = row[116] ? static_cast(atoi(row[116])) : 0; + e.skip_global_loot = row[117] ? static_cast(atoi(row[117])) : 0; + e.rare_spawn = row[118] ? static_cast(atoi(row[118])) : 0; + e.stuck_behavior = row[119] ? static_cast(atoi(row[119])) : 0; + e.model = row[120] ? static_cast(atoi(row[120])) : 0; + e.flymode = row[121] ? static_cast(atoi(row[121])) : -1; + e.always_aggro = row[122] ? static_cast(atoi(row[122])) : 0; + e.exp_mod = row[123] ? static_cast(atoi(row[123])) : 100; + e.heroic_strikethrough = row[124] ? static_cast(atoi(row[124])) : 0; + e.faction_amount = row[125] ? static_cast(atoi(row[125])) : 0; e.keeps_sold_items = row[126] ? static_cast(strtoul(row[126], nullptr, 10)) : 1; all_entries.push_back(e); diff --git a/common/repositories/base/base_object_contents_repository.h b/common/repositories/base/base_object_contents_repository.h index 23c817786..d27a148ec 100644 --- a/common/repositories/base/base_object_contents_repository.h +++ b/common/repositories/base/base_object_contents_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseObjectContentsRepository { public: struct ObjectContents { @@ -164,14 +163,14 @@ public: e.parentid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.bagidx = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.itemid = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.charges = static_cast(atoi(row[4])); + e.charges = row[4] ? static_cast(atoi(row[4])) : 0; e.droptime = strtoll(row[5] ? row[5] : "-1", nullptr, 10); e.augslot1 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.augslot2 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.augslot3 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot4 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.augslot5 = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[11])); + e.augslot6 = row[11] ? static_cast(atoi(row[11])) : 0; return e; } @@ -210,7 +209,7 @@ public: v.push_back(columns[2] + " = " + std::to_string(e.bagidx)); v.push_back(columns[3] + " = " + std::to_string(e.itemid)); v.push_back(columns[4] + " = " + std::to_string(e.charges)); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[6] + " = " + std::to_string(e.augslot1)); v.push_back(columns[7] + " = " + std::to_string(e.augslot2)); v.push_back(columns[8] + " = " + std::to_string(e.augslot3)); @@ -243,7 +242,7 @@ public: v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); @@ -284,7 +283,7 @@ public: v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); @@ -328,14 +327,14 @@ public: e.parentid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.bagidx = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.itemid = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.charges = static_cast(atoi(row[4])); + e.charges = row[4] ? static_cast(atoi(row[4])) : 0; e.droptime = strtoll(row[5] ? row[5] : "-1", nullptr, 10); e.augslot1 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.augslot2 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.augslot3 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot4 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.augslot5 = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[11])); + e.augslot6 = row[11] ? static_cast(atoi(row[11])) : 0; all_entries.push_back(e); } @@ -364,14 +363,14 @@ public: e.parentid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.bagidx = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.itemid = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.charges = static_cast(atoi(row[4])); + e.charges = row[4] ? static_cast(atoi(row[4])) : 0; e.droptime = strtoll(row[5] ? row[5] : "-1", nullptr, 10); e.augslot1 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; e.augslot2 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.augslot3 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.augslot4 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; e.augslot5 = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.augslot6 = static_cast(atoi(row[11])); + e.augslot6 = row[11] ? static_cast(atoi(row[11])) : 0; all_entries.push_back(e); } @@ -451,7 +450,7 @@ public: v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); @@ -485,7 +484,7 @@ public: v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); diff --git a/common/repositories/base/base_object_repository.h b/common/repositories/base/base_object_repository.h index 29d1c16e9..aabecdeef 100644 --- a/common/repositories/base/base_object_repository.h +++ b/common/repositories/base/base_object_repository.h @@ -231,34 +231,34 @@ public: if (results.RowCount() == 1) { Object e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zoneid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.xpos = row[3] ? strtof(row[3], nullptr) : 0; e.ypos = row[4] ? strtof(row[4], nullptr) : 0; e.zpos = row[5] ? strtof(row[5], nullptr) : 0; e.heading = row[6] ? strtof(row[6], nullptr) : 0; - e.itemid = static_cast(atoi(row[7])); + e.itemid = row[7] ? static_cast(atoi(row[7])) : 0; e.charges = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.objectname = row[9] ? row[9] : ""; - e.type = static_cast(atoi(row[10])); - e.icon = static_cast(atoi(row[11])); + e.type = row[10] ? static_cast(atoi(row[10])) : 0; + e.icon = row[11] ? static_cast(atoi(row[11])) : 0; e.size_percentage = row[12] ? strtof(row[12], nullptr) : 0; - e.unknown24 = static_cast(atoi(row[13])); - e.unknown60 = static_cast(atoi(row[14])); - e.unknown64 = static_cast(atoi(row[15])); - e.unknown68 = static_cast(atoi(row[16])); - e.unknown72 = static_cast(atoi(row[17])); - e.unknown76 = static_cast(atoi(row[18])); - e.unknown84 = static_cast(atoi(row[19])); + e.unknown24 = row[13] ? static_cast(atoi(row[13])) : 0; + e.unknown60 = row[14] ? static_cast(atoi(row[14])) : 0; + e.unknown64 = row[15] ? static_cast(atoi(row[15])) : 0; + e.unknown68 = row[16] ? static_cast(atoi(row[16])) : 0; + e.unknown72 = row[17] ? static_cast(atoi(row[17])) : 0; + e.unknown76 = row[18] ? static_cast(atoi(row[18])) : 0; + e.unknown84 = row[19] ? static_cast(atoi(row[19])) : 0; e.size = row[20] ? strtof(row[20], nullptr) : 100; - e.solid_type = static_cast(atoi(row[21])); - e.incline = static_cast(atoi(row[22])); + e.solid_type = row[21] ? static_cast(atoi(row[21])) : 0; + e.incline = row[22] ? static_cast(atoi(row[22])) : 0; e.tilt_x = row[23] ? strtof(row[23], nullptr) : 0; e.tilt_y = row[24] ? strtof(row[24], nullptr) : 0; e.display_name = row[25] ? row[25] : ""; - e.min_expansion = static_cast(atoi(row[26])); - e.max_expansion = static_cast(atoi(row[27])); + e.min_expansion = row[26] ? static_cast(atoi(row[26])) : -1; + e.max_expansion = row[27] ? static_cast(atoi(row[27])) : -1; e.content_flags = row[28] ? row[28] : ""; e.content_flags_disabled = row[29] ? row[29] : ""; @@ -466,34 +466,34 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Object e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zoneid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.xpos = row[3] ? strtof(row[3], nullptr) : 0; e.ypos = row[4] ? strtof(row[4], nullptr) : 0; e.zpos = row[5] ? strtof(row[5], nullptr) : 0; e.heading = row[6] ? strtof(row[6], nullptr) : 0; - e.itemid = static_cast(atoi(row[7])); + e.itemid = row[7] ? static_cast(atoi(row[7])) : 0; e.charges = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.objectname = row[9] ? row[9] : ""; - e.type = static_cast(atoi(row[10])); - e.icon = static_cast(atoi(row[11])); + e.type = row[10] ? static_cast(atoi(row[10])) : 0; + e.icon = row[11] ? static_cast(atoi(row[11])) : 0; e.size_percentage = row[12] ? strtof(row[12], nullptr) : 0; - e.unknown24 = static_cast(atoi(row[13])); - e.unknown60 = static_cast(atoi(row[14])); - e.unknown64 = static_cast(atoi(row[15])); - e.unknown68 = static_cast(atoi(row[16])); - e.unknown72 = static_cast(atoi(row[17])); - e.unknown76 = static_cast(atoi(row[18])); - e.unknown84 = static_cast(atoi(row[19])); + e.unknown24 = row[13] ? static_cast(atoi(row[13])) : 0; + e.unknown60 = row[14] ? static_cast(atoi(row[14])) : 0; + e.unknown64 = row[15] ? static_cast(atoi(row[15])) : 0; + e.unknown68 = row[16] ? static_cast(atoi(row[16])) : 0; + e.unknown72 = row[17] ? static_cast(atoi(row[17])) : 0; + e.unknown76 = row[18] ? static_cast(atoi(row[18])) : 0; + e.unknown84 = row[19] ? static_cast(atoi(row[19])) : 0; e.size = row[20] ? strtof(row[20], nullptr) : 100; - e.solid_type = static_cast(atoi(row[21])); - e.incline = static_cast(atoi(row[22])); + e.solid_type = row[21] ? static_cast(atoi(row[21])) : 0; + e.incline = row[22] ? static_cast(atoi(row[22])) : 0; e.tilt_x = row[23] ? strtof(row[23], nullptr) : 0; e.tilt_y = row[24] ? strtof(row[24], nullptr) : 0; e.display_name = row[25] ? row[25] : ""; - e.min_expansion = static_cast(atoi(row[26])); - e.max_expansion = static_cast(atoi(row[27])); + e.min_expansion = row[26] ? static_cast(atoi(row[26])) : -1; + e.max_expansion = row[27] ? static_cast(atoi(row[27])) : -1; e.content_flags = row[28] ? row[28] : ""; e.content_flags_disabled = row[29] ? row[29] : ""; @@ -520,34 +520,34 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Object e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zoneid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.xpos = row[3] ? strtof(row[3], nullptr) : 0; e.ypos = row[4] ? strtof(row[4], nullptr) : 0; e.zpos = row[5] ? strtof(row[5], nullptr) : 0; e.heading = row[6] ? strtof(row[6], nullptr) : 0; - e.itemid = static_cast(atoi(row[7])); + e.itemid = row[7] ? static_cast(atoi(row[7])) : 0; e.charges = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.objectname = row[9] ? row[9] : ""; - e.type = static_cast(atoi(row[10])); - e.icon = static_cast(atoi(row[11])); + e.type = row[10] ? static_cast(atoi(row[10])) : 0; + e.icon = row[11] ? static_cast(atoi(row[11])) : 0; e.size_percentage = row[12] ? strtof(row[12], nullptr) : 0; - e.unknown24 = static_cast(atoi(row[13])); - e.unknown60 = static_cast(atoi(row[14])); - e.unknown64 = static_cast(atoi(row[15])); - e.unknown68 = static_cast(atoi(row[16])); - e.unknown72 = static_cast(atoi(row[17])); - e.unknown76 = static_cast(atoi(row[18])); - e.unknown84 = static_cast(atoi(row[19])); + e.unknown24 = row[13] ? static_cast(atoi(row[13])) : 0; + e.unknown60 = row[14] ? static_cast(atoi(row[14])) : 0; + e.unknown64 = row[15] ? static_cast(atoi(row[15])) : 0; + e.unknown68 = row[16] ? static_cast(atoi(row[16])) : 0; + e.unknown72 = row[17] ? static_cast(atoi(row[17])) : 0; + e.unknown76 = row[18] ? static_cast(atoi(row[18])) : 0; + e.unknown84 = row[19] ? static_cast(atoi(row[19])) : 0; e.size = row[20] ? strtof(row[20], nullptr) : 100; - e.solid_type = static_cast(atoi(row[21])); - e.incline = static_cast(atoi(row[22])); + e.solid_type = row[21] ? static_cast(atoi(row[21])) : 0; + e.incline = row[22] ? static_cast(atoi(row[22])) : 0; e.tilt_x = row[23] ? strtof(row[23], nullptr) : 0; e.tilt_y = row[24] ? strtof(row[24], nullptr) : 0; e.display_name = row[25] ? row[25] : ""; - e.min_expansion = static_cast(atoi(row[26])); - e.max_expansion = static_cast(atoi(row[27])); + e.min_expansion = row[26] ? static_cast(atoi(row[26])) : -1; + e.max_expansion = row[27] ? static_cast(atoi(row[27])) : -1; e.content_flags = row[28] ? row[28] : ""; e.content_flags_disabled = row[29] ? row[29] : ""; diff --git a/common/repositories/base/base_perl_event_export_settings_repository.h b/common/repositories/base/base_perl_event_export_settings_repository.h index 69baa52fb..e22fadb1e 100644 --- a/common/repositories/base/base_perl_event_export_settings_repository.h +++ b/common/repositories/base/base_perl_event_export_settings_repository.h @@ -139,13 +139,13 @@ public: if (results.RowCount() == 1) { PerlEventExportSettings e{}; - e.event_id = static_cast(atoi(row[0])); + e.event_id = row[0] ? static_cast(atoi(row[0])) : 0; e.event_description = row[1] ? row[1] : ""; - e.export_qglobals = static_cast(atoi(row[2])); - e.export_mob = static_cast(atoi(row[3])); - e.export_zone = static_cast(atoi(row[4])); - e.export_item = static_cast(atoi(row[5])); - e.export_event = static_cast(atoi(row[6])); + e.export_qglobals = row[2] ? static_cast(atoi(row[2])) : 0; + e.export_mob = row[3] ? static_cast(atoi(row[3])) : 0; + e.export_zone = row[4] ? static_cast(atoi(row[4])) : 0; + e.export_item = row[5] ? static_cast(atoi(row[5])) : 0; + e.export_event = row[6] ? static_cast(atoi(row[6])) : 0; return e; } @@ -283,13 +283,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { PerlEventExportSettings e{}; - e.event_id = static_cast(atoi(row[0])); + e.event_id = row[0] ? static_cast(atoi(row[0])) : 0; e.event_description = row[1] ? row[1] : ""; - e.export_qglobals = static_cast(atoi(row[2])); - e.export_mob = static_cast(atoi(row[3])); - e.export_zone = static_cast(atoi(row[4])); - e.export_item = static_cast(atoi(row[5])); - e.export_event = static_cast(atoi(row[6])); + e.export_qglobals = row[2] ? static_cast(atoi(row[2])) : 0; + e.export_mob = row[3] ? static_cast(atoi(row[3])) : 0; + e.export_zone = row[4] ? static_cast(atoi(row[4])) : 0; + e.export_item = row[5] ? static_cast(atoi(row[5])) : 0; + e.export_event = row[6] ? static_cast(atoi(row[6])) : 0; all_entries.push_back(e); } @@ -314,13 +314,13 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { PerlEventExportSettings e{}; - e.event_id = static_cast(atoi(row[0])); + e.event_id = row[0] ? static_cast(atoi(row[0])) : 0; e.event_description = row[1] ? row[1] : ""; - e.export_qglobals = static_cast(atoi(row[2])); - e.export_mob = static_cast(atoi(row[3])); - e.export_zone = static_cast(atoi(row[4])); - e.export_item = static_cast(atoi(row[5])); - e.export_event = static_cast(atoi(row[6])); + e.export_qglobals = row[2] ? static_cast(atoi(row[2])) : 0; + e.export_mob = row[3] ? static_cast(atoi(row[3])) : 0; + e.export_zone = row[4] ? static_cast(atoi(row[4])) : 0; + e.export_item = row[5] ? static_cast(atoi(row[5])) : 0; + e.export_event = row[6] ? static_cast(atoi(row[6])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_petitions_repository.h b/common/repositories/base/base_petitions_repository.h index dd4fd9b16..f73f529fb 100644 --- a/common/repositories/base/base_petitions_repository.h +++ b/common/repositories/base/base_petitions_repository.h @@ -183,13 +183,13 @@ public: e.petitiontext = row[5] ? row[5] : ""; e.gmtext = row[6] ? row[6] : ""; e.zone = row[7] ? row[7] : ""; - e.urgency = static_cast(atoi(row[8])); - e.charclass = static_cast(atoi(row[9])); - e.charrace = static_cast(atoi(row[10])); - e.charlevel = static_cast(atoi(row[11])); - e.checkouts = static_cast(atoi(row[12])); - e.unavailables = static_cast(atoi(row[13])); - e.ischeckedout = static_cast(atoi(row[14])); + e.urgency = row[8] ? static_cast(atoi(row[8])) : 0; + e.charclass = row[9] ? static_cast(atoi(row[9])) : 0; + e.charrace = row[10] ? static_cast(atoi(row[10])) : 0; + e.charlevel = row[11] ? static_cast(atoi(row[11])) : 0; + e.checkouts = row[12] ? static_cast(atoi(row[12])) : 0; + e.unavailables = row[13] ? static_cast(atoi(row[13])) : 0; + e.ischeckedout = row[14] ? static_cast(atoi(row[14])) : 0; e.senttime = row[15] ? strtoll(row[15], nullptr, 10) : 0; return e; @@ -362,13 +362,13 @@ public: e.petitiontext = row[5] ? row[5] : ""; e.gmtext = row[6] ? row[6] : ""; e.zone = row[7] ? row[7] : ""; - e.urgency = static_cast(atoi(row[8])); - e.charclass = static_cast(atoi(row[9])); - e.charrace = static_cast(atoi(row[10])); - e.charlevel = static_cast(atoi(row[11])); - e.checkouts = static_cast(atoi(row[12])); - e.unavailables = static_cast(atoi(row[13])); - e.ischeckedout = static_cast(atoi(row[14])); + e.urgency = row[8] ? static_cast(atoi(row[8])) : 0; + e.charclass = row[9] ? static_cast(atoi(row[9])) : 0; + e.charrace = row[10] ? static_cast(atoi(row[10])) : 0; + e.charlevel = row[11] ? static_cast(atoi(row[11])) : 0; + e.checkouts = row[12] ? static_cast(atoi(row[12])) : 0; + e.unavailables = row[13] ? static_cast(atoi(row[13])) : 0; + e.ischeckedout = row[14] ? static_cast(atoi(row[14])) : 0; e.senttime = row[15] ? strtoll(row[15], nullptr, 10) : 0; all_entries.push_back(e); @@ -402,13 +402,13 @@ public: e.petitiontext = row[5] ? row[5] : ""; e.gmtext = row[6] ? row[6] : ""; e.zone = row[7] ? row[7] : ""; - e.urgency = static_cast(atoi(row[8])); - e.charclass = static_cast(atoi(row[9])); - e.charrace = static_cast(atoi(row[10])); - e.charlevel = static_cast(atoi(row[11])); - e.checkouts = static_cast(atoi(row[12])); - e.unavailables = static_cast(atoi(row[13])); - e.ischeckedout = static_cast(atoi(row[14])); + e.urgency = row[8] ? static_cast(atoi(row[8])) : 0; + e.charclass = row[9] ? static_cast(atoi(row[9])) : 0; + e.charrace = row[10] ? static_cast(atoi(row[10])) : 0; + e.charlevel = row[11] ? static_cast(atoi(row[11])) : 0; + e.checkouts = row[12] ? static_cast(atoi(row[12])) : 0; + e.unavailables = row[13] ? static_cast(atoi(row[13])) : 0; + e.ischeckedout = row[14] ? static_cast(atoi(row[14])) : 0; e.senttime = row[15] ? strtoll(row[15], nullptr, 10) : 0; all_entries.push_back(e); diff --git a/common/repositories/base/base_pets_equipmentset_entries_repository.h b/common/repositories/base/base_pets_equipmentset_entries_repository.h index 7f650a175..c34118488 100644 --- a/common/repositories/base/base_pets_equipmentset_entries_repository.h +++ b/common/repositories/base/base_pets_equipmentset_entries_repository.h @@ -123,9 +123,9 @@ public: if (results.RowCount() == 1) { PetsEquipmentsetEntries e{}; - e.set_id = static_cast(atoi(row[0])); - e.slot = static_cast(atoi(row[1])); - e.item_id = static_cast(atoi(row[2])); + e.set_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; + e.item_id = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -251,9 +251,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { PetsEquipmentsetEntries e{}; - e.set_id = static_cast(atoi(row[0])); - e.slot = static_cast(atoi(row[1])); - e.item_id = static_cast(atoi(row[2])); + e.set_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; + e.item_id = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -278,9 +278,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { PetsEquipmentsetEntries e{}; - e.set_id = static_cast(atoi(row[0])); - e.slot = static_cast(atoi(row[1])); - e.item_id = static_cast(atoi(row[2])); + e.set_id = row[0] ? static_cast(atoi(row[0])) : 0; + e.slot = row[1] ? static_cast(atoi(row[1])) : 0; + e.item_id = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_pets_equipmentset_repository.h b/common/repositories/base/base_pets_equipmentset_repository.h index 04fe06df3..ee369a69a 100644 --- a/common/repositories/base/base_pets_equipmentset_repository.h +++ b/common/repositories/base/base_pets_equipmentset_repository.h @@ -123,9 +123,9 @@ public: if (results.RowCount() == 1) { PetsEquipmentset e{}; - e.set_id = static_cast(atoi(row[0])); + e.set_id = row[0] ? static_cast(atoi(row[0])) : 0; e.setname = row[1] ? row[1] : ""; - e.nested_set = static_cast(atoi(row[2])); + e.nested_set = row[2] ? static_cast(atoi(row[2])) : -1; return e; } @@ -251,9 +251,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { PetsEquipmentset e{}; - e.set_id = static_cast(atoi(row[0])); + e.set_id = row[0] ? static_cast(atoi(row[0])) : 0; e.setname = row[1] ? row[1] : ""; - e.nested_set = static_cast(atoi(row[2])); + e.nested_set = row[2] ? static_cast(atoi(row[2])) : -1; all_entries.push_back(e); } @@ -278,9 +278,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { PetsEquipmentset e{}; - e.set_id = static_cast(atoi(row[0])); + e.set_id = row[0] ? static_cast(atoi(row[0])) : 0; e.setname = row[1] ? row[1] : ""; - e.nested_set = static_cast(atoi(row[2])); + e.nested_set = row[2] ? static_cast(atoi(row[2])) : -1; all_entries.push_back(e); } diff --git a/common/repositories/base/base_pets_repository.h b/common/repositories/base/base_pets_repository.h index e1dcf101e..bb2346b3a 100644 --- a/common/repositories/base/base_pets_repository.h +++ b/common/repositories/base/base_pets_repository.h @@ -147,15 +147,15 @@ public: if (results.RowCount() == 1) { Pets e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.type = row[1] ? row[1] : ""; - e.petpower = static_cast(atoi(row[2])); - e.npcID = static_cast(atoi(row[3])); - e.temp = static_cast(atoi(row[4])); - e.petcontrol = static_cast(atoi(row[5])); - e.petnaming = static_cast(atoi(row[6])); - e.monsterflag = static_cast(atoi(row[7])); - e.equipmentset = static_cast(atoi(row[8])); + e.petpower = row[2] ? static_cast(atoi(row[2])) : 0; + e.npcID = row[3] ? static_cast(atoi(row[3])) : 0; + e.temp = row[4] ? static_cast(atoi(row[4])) : 0; + e.petcontrol = row[5] ? static_cast(atoi(row[5])) : 0; + e.petnaming = row[6] ? static_cast(atoi(row[6])) : 0; + e.monsterflag = row[7] ? static_cast(atoi(row[7])) : 0; + e.equipmentset = row[8] ? static_cast(atoi(row[8])) : -1; return e; } @@ -298,15 +298,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Pets e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.type = row[1] ? row[1] : ""; - e.petpower = static_cast(atoi(row[2])); - e.npcID = static_cast(atoi(row[3])); - e.temp = static_cast(atoi(row[4])); - e.petcontrol = static_cast(atoi(row[5])); - e.petnaming = static_cast(atoi(row[6])); - e.monsterflag = static_cast(atoi(row[7])); - e.equipmentset = static_cast(atoi(row[8])); + e.petpower = row[2] ? static_cast(atoi(row[2])) : 0; + e.npcID = row[3] ? static_cast(atoi(row[3])) : 0; + e.temp = row[4] ? static_cast(atoi(row[4])) : 0; + e.petcontrol = row[5] ? static_cast(atoi(row[5])) : 0; + e.petnaming = row[6] ? static_cast(atoi(row[6])) : 0; + e.monsterflag = row[7] ? static_cast(atoi(row[7])) : 0; + e.equipmentset = row[8] ? static_cast(atoi(row[8])) : -1; all_entries.push_back(e); } @@ -331,15 +331,15 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Pets e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.type = row[1] ? row[1] : ""; - e.petpower = static_cast(atoi(row[2])); - e.npcID = static_cast(atoi(row[3])); - e.temp = static_cast(atoi(row[4])); - e.petcontrol = static_cast(atoi(row[5])); - e.petnaming = static_cast(atoi(row[6])); - e.monsterflag = static_cast(atoi(row[7])); - e.equipmentset = static_cast(atoi(row[8])); + e.petpower = row[2] ? static_cast(atoi(row[2])) : 0; + e.npcID = row[3] ? static_cast(atoi(row[3])) : 0; + e.temp = row[4] ? static_cast(atoi(row[4])) : 0; + e.petcontrol = row[5] ? static_cast(atoi(row[5])) : 0; + e.petnaming = row[6] ? static_cast(atoi(row[6])) : 0; + e.monsterflag = row[7] ? static_cast(atoi(row[7])) : 0; + e.equipmentset = row[8] ? static_cast(atoi(row[8])) : -1; all_entries.push_back(e); } diff --git a/common/repositories/base/base_player_event_log_settings_repository.h b/common/repositories/base/base_player_event_log_settings_repository.h index d8122b66e..e74156cf1 100644 --- a/common/repositories/base/base_player_event_log_settings_repository.h +++ b/common/repositories/base/base_player_event_log_settings_repository.h @@ -133,9 +133,9 @@ public: e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.event_name = row[1] ? row[1] : ""; - e.event_enabled = static_cast(atoi(row[2])); - e.retention_days = static_cast(atoi(row[3])); - e.discord_webhook_id = static_cast(atoi(row[4])); + e.event_enabled = row[2] ? static_cast(atoi(row[2])) : 0; + e.retention_days = row[3] ? static_cast(atoi(row[3])) : 0; + e.discord_webhook_id = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -269,9 +269,9 @@ public: e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.event_name = row[1] ? row[1] : ""; - e.event_enabled = static_cast(atoi(row[2])); - e.retention_days = static_cast(atoi(row[3])); - e.discord_webhook_id = static_cast(atoi(row[4])); + e.event_enabled = row[2] ? static_cast(atoi(row[2])) : 0; + e.retention_days = row[3] ? static_cast(atoi(row[3])) : 0; + e.discord_webhook_id = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -298,9 +298,9 @@ public: e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.event_name = row[1] ? row[1] : ""; - e.event_enabled = static_cast(atoi(row[2])); - e.retention_days = static_cast(atoi(row[3])); - e.discord_webhook_id = static_cast(atoi(row[4])); + e.event_enabled = row[2] ? static_cast(atoi(row[2])) : 0; + e.retention_days = row[3] ? static_cast(atoi(row[3])) : 0; + e.discord_webhook_id = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_player_event_logs_repository.h b/common/repositories/base/base_player_event_logs_repository.h index 1c14dca82..6c7d7a8df 100644 --- a/common/repositories/base/base_player_event_logs_repository.h +++ b/common/repositories/base/base_player_event_logs_repository.h @@ -187,13 +187,13 @@ public: e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.account_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; e.character_id = row[2] ? strtoll(row[2], nullptr, 10) : 0; - e.zone_id = static_cast(atoi(row[3])); - e.instance_id = static_cast(atoi(row[4])); + e.zone_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.instance_id = row[4] ? static_cast(atoi(row[4])) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; e.y = row[6] ? strtof(row[6], nullptr) : 0; e.z = row[7] ? strtof(row[7], nullptr) : 0; e.heading = row[8] ? strtof(row[8], nullptr) : 0; - e.event_type_id = static_cast(atoi(row[9])); + e.event_type_id = row[9] ? static_cast(atoi(row[9])) : 0; e.event_type_name = row[10] ? row[10] : ""; e.event_data = row[11] ? row[11] : ""; e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10); @@ -241,7 +241,7 @@ public: v.push_back(columns[9] + " = " + std::to_string(e.event_type_id)); v.push_back(columns[10] + " = '" + Strings::Escape(e.event_type_name) + "'"); v.push_back(columns[11] + " = '" + Strings::Escape(e.event_data) + "'"); - v.push_back(columns[12] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back(columns[12] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -275,7 +275,7 @@ public: v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -317,7 +317,7 @@ public: v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -354,13 +354,13 @@ public: e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.account_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; e.character_id = row[2] ? strtoll(row[2], nullptr, 10) : 0; - e.zone_id = static_cast(atoi(row[3])); - e.instance_id = static_cast(atoi(row[4])); + e.zone_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.instance_id = row[4] ? static_cast(atoi(row[4])) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; e.y = row[6] ? strtof(row[6], nullptr) : 0; e.z = row[7] ? strtof(row[7], nullptr) : 0; e.heading = row[8] ? strtof(row[8], nullptr) : 0; - e.event_type_id = static_cast(atoi(row[9])); + e.event_type_id = row[9] ? static_cast(atoi(row[9])) : 0; e.event_type_name = row[10] ? row[10] : ""; e.event_data = row[11] ? row[11] : ""; e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10); @@ -391,13 +391,13 @@ public: e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.account_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; e.character_id = row[2] ? strtoll(row[2], nullptr, 10) : 0; - e.zone_id = static_cast(atoi(row[3])); - e.instance_id = static_cast(atoi(row[4])); + e.zone_id = row[3] ? static_cast(atoi(row[3])) : 0; + e.instance_id = row[4] ? static_cast(atoi(row[4])) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; e.y = row[6] ? strtof(row[6], nullptr) : 0; e.z = row[7] ? strtof(row[7], nullptr) : 0; e.heading = row[8] ? strtof(row[8], nullptr) : 0; - e.event_type_id = static_cast(atoi(row[9])); + e.event_type_id = row[9] ? static_cast(atoi(row[9])) : 0; e.event_type_name = row[10] ? row[10] : ""; e.event_data = row[11] ? row[11] : ""; e.created_at = strtoll(row[12] ? row[12] : "-1", nullptr, 10); @@ -487,7 +487,7 @@ public: v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -522,7 +522,7 @@ public: v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_quest_globals_repository.h b/common/repositories/base/base_quest_globals_repository.h index d2ad8fc95..692ba49f7 100644 --- a/common/repositories/base/base_quest_globals_repository.h +++ b/common/repositories/base/base_quest_globals_repository.h @@ -135,12 +135,12 @@ public: if (results.RowCount() == 1) { QuestGlobals e{}; - e.charid = static_cast(atoi(row[0])); - e.npcid = static_cast(atoi(row[1])); - e.zoneid = static_cast(atoi(row[2])); + e.charid = row[0] ? static_cast(atoi(row[0])) : 0; + e.npcid = row[1] ? static_cast(atoi(row[1])) : 0; + e.zoneid = row[2] ? static_cast(atoi(row[2])) : 0; e.name = row[3] ? row[3] : ""; - e.value = row[4] ? row[4] : ""; - e.expdate = static_cast(atoi(row[5])); + e.value = row[4] ? row[4] : "?"; + e.expdate = row[5] ? static_cast(atoi(row[5])) : 0; return e; } @@ -275,12 +275,12 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { QuestGlobals e{}; - e.charid = static_cast(atoi(row[0])); - e.npcid = static_cast(atoi(row[1])); - e.zoneid = static_cast(atoi(row[2])); + e.charid = row[0] ? static_cast(atoi(row[0])) : 0; + e.npcid = row[1] ? static_cast(atoi(row[1])) : 0; + e.zoneid = row[2] ? static_cast(atoi(row[2])) : 0; e.name = row[3] ? row[3] : ""; - e.value = row[4] ? row[4] : ""; - e.expdate = static_cast(atoi(row[5])); + e.value = row[4] ? row[4] : "?"; + e.expdate = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -305,12 +305,12 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { QuestGlobals e{}; - e.charid = static_cast(atoi(row[0])); - e.npcid = static_cast(atoi(row[1])); - e.zoneid = static_cast(atoi(row[2])); + e.charid = row[0] ? static_cast(atoi(row[0])) : 0; + e.npcid = row[1] ? static_cast(atoi(row[1])) : 0; + e.zoneid = row[2] ? static_cast(atoi(row[2])) : 0; e.name = row[3] ? row[3] : ""; - e.value = row[4] ? row[4] : ""; - e.expdate = static_cast(atoi(row[5])); + e.value = row[4] ? row[4] : "?"; + e.expdate = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_raid_details_repository.h b/common/repositories/base/base_raid_details_repository.h index 704fbbb8b..fc3b0e3f2 100644 --- a/common/repositories/base/base_raid_details_repository.h +++ b/common/repositories/base/base_raid_details_repository.h @@ -163,9 +163,9 @@ public: if (results.RowCount() == 1) { RaidDetails e{}; - e.raidid = static_cast(atoi(row[0])); - e.loottype = static_cast(atoi(row[1])); - e.locked = static_cast(atoi(row[2])); + e.raidid = row[0] ? static_cast(atoi(row[0])) : 0; + e.loottype = row[1] ? static_cast(atoi(row[1])) : 0; + e.locked = row[2] ? static_cast(atoi(row[2])) : 0; e.motd = row[3] ? row[3] : ""; e.marked_npc_1_entity_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.marked_npc_1_zone_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; @@ -331,9 +331,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { RaidDetails e{}; - e.raidid = static_cast(atoi(row[0])); - e.loottype = static_cast(atoi(row[1])); - e.locked = static_cast(atoi(row[2])); + e.raidid = row[0] ? static_cast(atoi(row[0])) : 0; + e.loottype = row[1] ? static_cast(atoi(row[1])) : 0; + e.locked = row[2] ? static_cast(atoi(row[2])) : 0; e.motd = row[3] ? row[3] : ""; e.marked_npc_1_entity_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.marked_npc_1_zone_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; @@ -368,9 +368,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { RaidDetails e{}; - e.raidid = static_cast(atoi(row[0])); - e.loottype = static_cast(atoi(row[1])); - e.locked = static_cast(atoi(row[2])); + e.raidid = row[0] ? static_cast(atoi(row[0])) : 0; + e.loottype = row[1] ? static_cast(atoi(row[1])) : 0; + e.locked = row[2] ? static_cast(atoi(row[2])) : 0; e.motd = row[3] ? row[3] : ""; e.marked_npc_1_entity_id = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.marked_npc_1_zone_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_raid_members_repository.h b/common/repositories/base/base_raid_members_repository.h index 582a4eb9e..2f269ad4b 100644 --- a/common/repositories/base/base_raid_members_repository.h +++ b/common/repositories/base/base_raid_members_repository.h @@ -168,16 +168,16 @@ public: RaidMembers e{}; e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0; - e.raidid = static_cast(atoi(row[1])); - e.charid = static_cast(atoi(row[2])); - e.bot_id = static_cast(atoi(row[3])); + e.raidid = row[1] ? static_cast(atoi(row[1])) : 0; + e.charid = row[2] ? static_cast(atoi(row[2])) : 0; + e.bot_id = row[3] ? static_cast(atoi(row[3])) : 0; e.groupid = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e._class = static_cast(atoi(row[5])); - e.level = static_cast(atoi(row[6])); + e._class = row[5] ? static_cast(atoi(row[5])) : 0; + e.level = row[6] ? static_cast(atoi(row[6])) : 0; e.name = row[7] ? row[7] : ""; - e.isgroupleader = static_cast(atoi(row[8])); - e.israidleader = static_cast(atoi(row[9])); - e.islooter = static_cast(atoi(row[10])); + e.isgroupleader = row[8] ? static_cast(atoi(row[8])) : 0; + e.israidleader = row[9] ? static_cast(atoi(row[9])) : 0; + e.islooter = row[10] ? static_cast(atoi(row[10])) : 0; e.is_marker = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.is_assister = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.note = row[13] ? row[13] : ""; @@ -339,16 +339,16 @@ public: RaidMembers e{}; e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0; - e.raidid = static_cast(atoi(row[1])); - e.charid = static_cast(atoi(row[2])); - e.bot_id = static_cast(atoi(row[3])); + e.raidid = row[1] ? static_cast(atoi(row[1])) : 0; + e.charid = row[2] ? static_cast(atoi(row[2])) : 0; + e.bot_id = row[3] ? static_cast(atoi(row[3])) : 0; e.groupid = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e._class = static_cast(atoi(row[5])); - e.level = static_cast(atoi(row[6])); + e._class = row[5] ? static_cast(atoi(row[5])) : 0; + e.level = row[6] ? static_cast(atoi(row[6])) : 0; e.name = row[7] ? row[7] : ""; - e.isgroupleader = static_cast(atoi(row[8])); - e.israidleader = static_cast(atoi(row[9])); - e.islooter = static_cast(atoi(row[10])); + e.isgroupleader = row[8] ? static_cast(atoi(row[8])) : 0; + e.israidleader = row[9] ? static_cast(atoi(row[9])) : 0; + e.islooter = row[10] ? static_cast(atoi(row[10])) : 0; e.is_marker = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.is_assister = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.note = row[13] ? row[13] : ""; @@ -377,16 +377,16 @@ public: RaidMembers e{}; e.id = row[0] ? strtoull(row[0], nullptr, 10) : 0; - e.raidid = static_cast(atoi(row[1])); - e.charid = static_cast(atoi(row[2])); - e.bot_id = static_cast(atoi(row[3])); + e.raidid = row[1] ? static_cast(atoi(row[1])) : 0; + e.charid = row[2] ? static_cast(atoi(row[2])) : 0; + e.bot_id = row[3] ? static_cast(atoi(row[3])) : 0; e.groupid = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e._class = static_cast(atoi(row[5])); - e.level = static_cast(atoi(row[6])); + e._class = row[5] ? static_cast(atoi(row[5])) : 0; + e.level = row[6] ? static_cast(atoi(row[6])) : 0; e.name = row[7] ? row[7] : ""; - e.isgroupleader = static_cast(atoi(row[8])); - e.israidleader = static_cast(atoi(row[9])); - e.islooter = static_cast(atoi(row[10])); + e.isgroupleader = row[8] ? static_cast(atoi(row[8])) : 0; + e.israidleader = row[9] ? static_cast(atoi(row[9])) : 0; + e.islooter = row[10] ? static_cast(atoi(row[10])) : 0; e.is_marker = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; e.is_assister = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; e.note = row[13] ? row[13] : ""; diff --git a/common/repositories/base/base_respawn_times_repository.h b/common/repositories/base/base_respawn_times_repository.h index fac8ed10f..94d5526a8 100644 --- a/common/repositories/base/base_respawn_times_repository.h +++ b/common/repositories/base/base_respawn_times_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseRespawnTimesRepository { public: struct RespawnTimes { @@ -128,10 +127,10 @@ public: if (results.RowCount() == 1) { RespawnTimes e{}; - e.id = static_cast(atoi(row[0])); - e.start = static_cast(atoi(row[1])); - e.duration = static_cast(atoi(row[2])); - e.instance_id = static_cast(atoi(row[3])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.start = row[1] ? static_cast(atoi(row[1])) : 0; + e.duration = row[2] ? static_cast(atoi(row[2])) : 0; + e.instance_id = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -260,10 +259,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { RespawnTimes e{}; - e.id = static_cast(atoi(row[0])); - e.start = static_cast(atoi(row[1])); - e.duration = static_cast(atoi(row[2])); - e.instance_id = static_cast(atoi(row[3])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.start = row[1] ? static_cast(atoi(row[1])) : 0; + e.duration = row[2] ? static_cast(atoi(row[2])) : 0; + e.instance_id = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -288,10 +287,10 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { RespawnTimes e{}; - e.id = static_cast(atoi(row[0])); - e.start = static_cast(atoi(row[1])); - e.duration = static_cast(atoi(row[2])); - e.instance_id = static_cast(atoi(row[3])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.start = row[1] ? static_cast(atoi(row[1])) : 0; + e.duration = row[2] ? static_cast(atoi(row[2])) : 0; + e.instance_id = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_saylink_repository.h b/common/repositories/base/base_saylink_repository.h index 6866b36f3..01de6506f 100644 --- a/common/repositories/base/base_saylink_repository.h +++ b/common/repositories/base/base_saylink_repository.h @@ -119,7 +119,7 @@ public: if (results.RowCount() == 1) { Saylink e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.phrase = row[1] ? row[1] : ""; return e; @@ -242,7 +242,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Saylink e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.phrase = row[1] ? row[1] : ""; all_entries.push_back(e); @@ -268,7 +268,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Saylink e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.phrase = row[1] ? row[1] : ""; all_entries.push_back(e); diff --git a/common/repositories/base/base_server_scheduled_events_repository.h b/common/repositories/base/base_server_scheduled_events_repository.h index b1a7ff776..3bca211dd 100644 --- a/common/repositories/base/base_server_scheduled_events_repository.h +++ b/common/repositories/base/base_server_scheduled_events_repository.h @@ -179,20 +179,20 @@ public: if (results.RowCount() == 1) { ServerScheduledEvents e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.description = row[1] ? row[1] : ""; e.event_type = row[2] ? row[2] : ""; e.event_data = row[3] ? row[3] : ""; - e.minute_start = static_cast(atoi(row[4])); - e.hour_start = static_cast(atoi(row[5])); - e.day_start = static_cast(atoi(row[6])); - e.month_start = static_cast(atoi(row[7])); - e.year_start = static_cast(atoi(row[8])); - e.minute_end = static_cast(atoi(row[9])); - e.hour_end = static_cast(atoi(row[10])); - e.day_end = static_cast(atoi(row[11])); - e.month_end = static_cast(atoi(row[12])); - e.year_end = static_cast(atoi(row[13])); + e.minute_start = row[4] ? static_cast(atoi(row[4])) : 0; + e.hour_start = row[5] ? static_cast(atoi(row[5])) : 0; + e.day_start = row[6] ? static_cast(atoi(row[6])) : 0; + e.month_start = row[7] ? static_cast(atoi(row[7])) : 0; + e.year_start = row[8] ? static_cast(atoi(row[8])) : 0; + e.minute_end = row[9] ? static_cast(atoi(row[9])) : 0; + e.hour_end = row[10] ? static_cast(atoi(row[10])) : 0; + e.day_end = row[11] ? static_cast(atoi(row[11])) : 0; + e.month_end = row[12] ? static_cast(atoi(row[12])) : 0; + e.year_end = row[13] ? static_cast(atoi(row[13])) : 0; e.cron_expression = row[14] ? row[14] : ""; e.created_at = strtoll(row[15] ? row[15] : "-1", nullptr, 10); e.deleted_at = strtoll(row[16] ? row[16] : "-1", nullptr, 10); @@ -243,8 +243,8 @@ public: v.push_back(columns[12] + " = " + std::to_string(e.month_end)); v.push_back(columns[13] + " = " + std::to_string(e.year_end)); v.push_back(columns[14] + " = '" + Strings::Escape(e.cron_expression) + "'"); - v.push_back(columns[15] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back(columns[16] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back(columns[15] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[16] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -281,8 +281,8 @@ public: v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -327,8 +327,8 @@ public: v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -362,20 +362,20 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ServerScheduledEvents e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.description = row[1] ? row[1] : ""; e.event_type = row[2] ? row[2] : ""; e.event_data = row[3] ? row[3] : ""; - e.minute_start = static_cast(atoi(row[4])); - e.hour_start = static_cast(atoi(row[5])); - e.day_start = static_cast(atoi(row[6])); - e.month_start = static_cast(atoi(row[7])); - e.year_start = static_cast(atoi(row[8])); - e.minute_end = static_cast(atoi(row[9])); - e.hour_end = static_cast(atoi(row[10])); - e.day_end = static_cast(atoi(row[11])); - e.month_end = static_cast(atoi(row[12])); - e.year_end = static_cast(atoi(row[13])); + e.minute_start = row[4] ? static_cast(atoi(row[4])) : 0; + e.hour_start = row[5] ? static_cast(atoi(row[5])) : 0; + e.day_start = row[6] ? static_cast(atoi(row[6])) : 0; + e.month_start = row[7] ? static_cast(atoi(row[7])) : 0; + e.year_start = row[8] ? static_cast(atoi(row[8])) : 0; + e.minute_end = row[9] ? static_cast(atoi(row[9])) : 0; + e.hour_end = row[10] ? static_cast(atoi(row[10])) : 0; + e.day_end = row[11] ? static_cast(atoi(row[11])) : 0; + e.month_end = row[12] ? static_cast(atoi(row[12])) : 0; + e.year_end = row[13] ? static_cast(atoi(row[13])) : 0; e.cron_expression = row[14] ? row[14] : ""; e.created_at = strtoll(row[15] ? row[15] : "-1", nullptr, 10); e.deleted_at = strtoll(row[16] ? row[16] : "-1", nullptr, 10); @@ -403,20 +403,20 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ServerScheduledEvents e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.description = row[1] ? row[1] : ""; e.event_type = row[2] ? row[2] : ""; e.event_data = row[3] ? row[3] : ""; - e.minute_start = static_cast(atoi(row[4])); - e.hour_start = static_cast(atoi(row[5])); - e.day_start = static_cast(atoi(row[6])); - e.month_start = static_cast(atoi(row[7])); - e.year_start = static_cast(atoi(row[8])); - e.minute_end = static_cast(atoi(row[9])); - e.hour_end = static_cast(atoi(row[10])); - e.day_end = static_cast(atoi(row[11])); - e.month_end = static_cast(atoi(row[12])); - e.year_end = static_cast(atoi(row[13])); + e.minute_start = row[4] ? static_cast(atoi(row[4])) : 0; + e.hour_start = row[5] ? static_cast(atoi(row[5])) : 0; + e.day_start = row[6] ? static_cast(atoi(row[6])) : 0; + e.month_start = row[7] ? static_cast(atoi(row[7])) : 0; + e.year_start = row[8] ? static_cast(atoi(row[8])) : 0; + e.minute_end = row[9] ? static_cast(atoi(row[9])) : 0; + e.hour_end = row[10] ? static_cast(atoi(row[10])) : 0; + e.day_end = row[11] ? static_cast(atoi(row[11])) : 0; + e.month_end = row[12] ? static_cast(atoi(row[12])) : 0; + e.year_end = row[13] ? static_cast(atoi(row[13])) : 0; e.cron_expression = row[14] ? row[14] : ""; e.created_at = strtoll(row[15] ? row[15] : "-1", nullptr, 10); e.deleted_at = strtoll(row[16] ? row[16] : "-1", nullptr, 10); @@ -509,8 +509,8 @@ public: v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -548,8 +548,8 @@ public: v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_shared_task_activity_state_repository.h b/common/repositories/base/base_shared_task_activity_state_repository.h index 36db2ec58..e10b7d333 100644 --- a/common/repositories/base/base_shared_task_activity_state_repository.h +++ b/common/repositories/base/base_shared_task_activity_state_repository.h @@ -132,8 +132,8 @@ public: SharedTaskActivityState e{}; e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.activity_id = static_cast(atoi(row[1])); - e.done_count = static_cast(atoi(row[2])); + e.activity_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.done_count = row[2] ? static_cast(atoi(row[2])) : 0; e.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); @@ -172,8 +172,8 @@ public: v.push_back(columns[0] + " = " + std::to_string(e.shared_task_id)); v.push_back(columns[1] + " = " + std::to_string(e.activity_id)); v.push_back(columns[2] + " = " + std::to_string(e.done_count)); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -198,8 +198,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -232,8 +232,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -268,8 +268,8 @@ public: SharedTaskActivityState e{}; e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.activity_id = static_cast(atoi(row[1])); - e.done_count = static_cast(atoi(row[2])); + e.activity_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.done_count = row[2] ? static_cast(atoi(row[2])) : 0; e.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); @@ -297,8 +297,8 @@ public: SharedTaskActivityState e{}; e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.activity_id = static_cast(atoi(row[1])); - e.done_count = static_cast(atoi(row[2])); + e.activity_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.done_count = row[2] ? static_cast(atoi(row[2])) : 0; e.updated_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completed_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); @@ -378,8 +378,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -405,8 +405,8 @@ public: v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_shared_task_members_repository.h b/common/repositories/base/base_shared_task_members_repository.h index 2da41035f..8c05bbc8f 100644 --- a/common/repositories/base/base_shared_task_members_repository.h +++ b/common/repositories/base/base_shared_task_members_repository.h @@ -125,7 +125,7 @@ public: e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.character_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; - e.is_leader = static_cast(atoi(row[2])); + e.is_leader = row[2] ? static_cast(atoi(row[2])) : 0; return e; } @@ -253,7 +253,7 @@ public: e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.character_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; - e.is_leader = static_cast(atoi(row[2])); + e.is_leader = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } @@ -280,7 +280,7 @@ public: e.shared_task_id = row[0] ? strtoll(row[0], nullptr, 10) : 0; e.character_id = row[1] ? strtoll(row[1], nullptr, 10) : 0; - e.is_leader = static_cast(atoi(row[2])); + e.is_leader = row[2] ? static_cast(atoi(row[2])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_shared_tasks_repository.h b/common/repositories/base/base_shared_tasks_repository.h index 8f7e320d1..4d9956ffc 100644 --- a/common/repositories/base/base_shared_tasks_repository.h +++ b/common/repositories/base/base_shared_tasks_repository.h @@ -136,11 +136,11 @@ public: SharedTasks e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.task_id = static_cast(atoi(row[1])); + e.task_id = row[1] ? static_cast(atoi(row[1])) : 0; e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10); e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); - e.is_locked = static_cast(atoi(row[5])); + e.is_locked = row[5] ? static_cast(atoi(row[5])) : 0; return e; } @@ -175,9 +175,9 @@ public: auto columns = Columns(); v.push_back(columns[1] + " = " + std::to_string(e.task_id)); - v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(columns[5] + " = " + std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -202,9 +202,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -237,9 +237,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); @@ -275,11 +275,11 @@ public: SharedTasks e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.task_id = static_cast(atoi(row[1])); + e.task_id = row[1] ? static_cast(atoi(row[1])) : 0; e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10); e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); - e.is_locked = static_cast(atoi(row[5])); + e.is_locked = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -305,11 +305,11 @@ public: SharedTasks e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.task_id = static_cast(atoi(row[1])); + e.task_id = row[1] ? static_cast(atoi(row[1])) : 0; e.accepted_time = strtoll(row[2] ? row[2] : "-1", nullptr, 10); e.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.completion_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10); - e.is_locked = static_cast(atoi(row[5])); + e.is_locked = row[5] ? static_cast(atoi(row[5])) : 0; all_entries.push_back(e); } @@ -386,9 +386,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -414,9 +414,9 @@ public: v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); diff --git a/common/repositories/base/base_spawn2_disabled_repository.h b/common/repositories/base/base_spawn2_disabled_repository.h index 032066913..9df03bc7d 100644 --- a/common/repositories/base/base_spawn2_disabled_repository.h +++ b/common/repositories/base/base_spawn2_disabled_repository.h @@ -128,9 +128,9 @@ public: Spawn2Disabled e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.spawn2_id = static_cast(atoi(row[1])); - e.instance_id = static_cast(atoi(row[2])); - e.disabled = static_cast(atoi(row[3])); + e.spawn2_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.instance_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.disabled = row[3] ? static_cast(atoi(row[3])) : 0; return e; } @@ -259,9 +259,9 @@ public: Spawn2Disabled e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.spawn2_id = static_cast(atoi(row[1])); - e.instance_id = static_cast(atoi(row[2])); - e.disabled = static_cast(atoi(row[3])); + e.spawn2_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.instance_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.disabled = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } @@ -287,9 +287,9 @@ public: Spawn2Disabled e{}; e.id = row[0] ? strtoll(row[0], nullptr, 10) : 0; - e.spawn2_id = static_cast(atoi(row[1])); - e.instance_id = static_cast(atoi(row[2])); - e.disabled = static_cast(atoi(row[3])); + e.spawn2_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.instance_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.disabled = row[3] ? static_cast(atoi(row[3])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_spawn2_repository.h b/common/repositories/base/base_spawn2_repository.h index 721e72311..91b31822a 100644 --- a/common/repositories/base/base_spawn2_repository.h +++ b/common/repositories/base/base_spawn2_repository.h @@ -187,23 +187,23 @@ public: if (results.RowCount() == 1) { Spawn2 e{}; - e.id = static_cast(atoi(row[0])); - e.spawngroupID = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.spawngroupID = row[1] ? static_cast(atoi(row[1])) : 0; e.zone = row[2] ? row[2] : ""; - e.version = static_cast(atoi(row[3])); + e.version = row[3] ? static_cast(atoi(row[3])) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0.000000; e.y = row[5] ? strtof(row[5], nullptr) : 0.000000; e.z = row[6] ? strtof(row[6], nullptr) : 0.000000; e.heading = row[7] ? strtof(row[7], nullptr) : 0.000000; - e.respawntime = static_cast(atoi(row[8])); - e.variance = static_cast(atoi(row[9])); - e.pathgrid = static_cast(atoi(row[10])); - e.path_when_zone_idle = static_cast(atoi(row[11])); + e.respawntime = row[8] ? static_cast(atoi(row[8])) : 0; + e.variance = row[9] ? static_cast(atoi(row[9])) : 0; + e.pathgrid = row[10] ? static_cast(atoi(row[10])) : 0; + e.path_when_zone_idle = row[11] ? static_cast(atoi(row[11])) : 0; e._condition = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; - e.cond_value = static_cast(atoi(row[13])); + e.cond_value = row[13] ? static_cast(atoi(row[13])) : 1; e.animation = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; - e.min_expansion = static_cast(atoi(row[15])); - e.max_expansion = static_cast(atoi(row[16])); + e.min_expansion = row[15] ? static_cast(atoi(row[15])) : -1; + e.max_expansion = row[16] ? static_cast(atoi(row[16])) : -1; e.content_flags = row[17] ? row[17] : ""; e.content_flags_disabled = row[18] ? row[18] : ""; @@ -378,23 +378,23 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Spawn2 e{}; - e.id = static_cast(atoi(row[0])); - e.spawngroupID = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.spawngroupID = row[1] ? static_cast(atoi(row[1])) : 0; e.zone = row[2] ? row[2] : ""; - e.version = static_cast(atoi(row[3])); + e.version = row[3] ? static_cast(atoi(row[3])) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0.000000; e.y = row[5] ? strtof(row[5], nullptr) : 0.000000; e.z = row[6] ? strtof(row[6], nullptr) : 0.000000; e.heading = row[7] ? strtof(row[7], nullptr) : 0.000000; - e.respawntime = static_cast(atoi(row[8])); - e.variance = static_cast(atoi(row[9])); - e.pathgrid = static_cast(atoi(row[10])); - e.path_when_zone_idle = static_cast(atoi(row[11])); + e.respawntime = row[8] ? static_cast(atoi(row[8])) : 0; + e.variance = row[9] ? static_cast(atoi(row[9])) : 0; + e.pathgrid = row[10] ? static_cast(atoi(row[10])) : 0; + e.path_when_zone_idle = row[11] ? static_cast(atoi(row[11])) : 0; e._condition = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; - e.cond_value = static_cast(atoi(row[13])); + e.cond_value = row[13] ? static_cast(atoi(row[13])) : 1; e.animation = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; - e.min_expansion = static_cast(atoi(row[15])); - e.max_expansion = static_cast(atoi(row[16])); + e.min_expansion = row[15] ? static_cast(atoi(row[15])) : -1; + e.max_expansion = row[16] ? static_cast(atoi(row[16])) : -1; e.content_flags = row[17] ? row[17] : ""; e.content_flags_disabled = row[18] ? row[18] : ""; @@ -421,23 +421,23 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Spawn2 e{}; - e.id = static_cast(atoi(row[0])); - e.spawngroupID = static_cast(atoi(row[1])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.spawngroupID = row[1] ? static_cast(atoi(row[1])) : 0; e.zone = row[2] ? row[2] : ""; - e.version = static_cast(atoi(row[3])); + e.version = row[3] ? static_cast(atoi(row[3])) : 0; e.x = row[4] ? strtof(row[4], nullptr) : 0.000000; e.y = row[5] ? strtof(row[5], nullptr) : 0.000000; e.z = row[6] ? strtof(row[6], nullptr) : 0.000000; e.heading = row[7] ? strtof(row[7], nullptr) : 0.000000; - e.respawntime = static_cast(atoi(row[8])); - e.variance = static_cast(atoi(row[9])); - e.pathgrid = static_cast(atoi(row[10])); - e.path_when_zone_idle = static_cast(atoi(row[11])); + e.respawntime = row[8] ? static_cast(atoi(row[8])) : 0; + e.variance = row[9] ? static_cast(atoi(row[9])) : 0; + e.pathgrid = row[10] ? static_cast(atoi(row[10])) : 0; + e.path_when_zone_idle = row[11] ? static_cast(atoi(row[11])) : 0; e._condition = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; - e.cond_value = static_cast(atoi(row[13])); + e.cond_value = row[13] ? static_cast(atoi(row[13])) : 1; e.animation = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; - e.min_expansion = static_cast(atoi(row[15])); - e.max_expansion = static_cast(atoi(row[16])); + e.min_expansion = row[15] ? static_cast(atoi(row[15])) : -1; + e.max_expansion = row[16] ? static_cast(atoi(row[16])) : -1; e.content_flags = row[17] ? row[17] : ""; e.content_flags_disabled = row[18] ? row[18] : ""; diff --git a/common/repositories/base/base_spawn_conditions_repository.h b/common/repositories/base/base_spawn_conditions_repository.h index 96132074f..521a39e5f 100644 --- a/common/repositories/base/base_spawn_conditions_repository.h +++ b/common/repositories/base/base_spawn_conditions_repository.h @@ -133,7 +133,7 @@ public: e.zone = row[0] ? row[0] : ""; e.id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 1; - e.value = static_cast(atoi(row[2])); + e.value = row[2] ? static_cast(atoi(row[2])) : 0; e.onchange = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.name = row[4] ? row[4] : ""; @@ -269,7 +269,7 @@ public: e.zone = row[0] ? row[0] : ""; e.id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 1; - e.value = static_cast(atoi(row[2])); + e.value = row[2] ? static_cast(atoi(row[2])) : 0; e.onchange = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.name = row[4] ? row[4] : ""; @@ -298,7 +298,7 @@ public: e.zone = row[0] ? row[0] : ""; e.id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 1; - e.value = static_cast(atoi(row[2])); + e.value = row[2] ? static_cast(atoi(row[2])) : 0; e.onchange = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; e.name = row[4] ? row[4] : ""; diff --git a/common/repositories/base/base_spawn_events_repository.h b/common/repositories/base/base_spawn_events_repository.h index 3279e3430..f4d8944ad 100644 --- a/common/repositories/base/base_spawn_events_repository.h +++ b/common/repositories/base/base_spawn_events_repository.h @@ -177,10 +177,10 @@ public: e.next_day = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.next_month = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.next_year = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.enabled = static_cast(atoi(row[10])); + e.enabled = row[10] ? static_cast(atoi(row[10])) : 1; e.action = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.argument = static_cast(atoi(row[12])); - e.strict = static_cast(atoi(row[13])); + e.argument = row[12] ? static_cast(atoi(row[12])) : 0; + e.strict = row[13] ? static_cast(atoi(row[13])) : 0; return e; } @@ -348,10 +348,10 @@ public: e.next_day = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.next_month = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.next_year = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.enabled = static_cast(atoi(row[10])); + e.enabled = row[10] ? static_cast(atoi(row[10])) : 1; e.action = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.argument = static_cast(atoi(row[12])); - e.strict = static_cast(atoi(row[13])); + e.argument = row[12] ? static_cast(atoi(row[12])) : 0; + e.strict = row[13] ? static_cast(atoi(row[13])) : 0; all_entries.push_back(e); } @@ -386,10 +386,10 @@ public: e.next_day = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; e.next_month = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; e.next_year = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.enabled = static_cast(atoi(row[10])); + e.enabled = row[10] ? static_cast(atoi(row[10])) : 1; e.action = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; - e.argument = static_cast(atoi(row[12])); - e.strict = static_cast(atoi(row[13])); + e.argument = row[12] ? static_cast(atoi(row[12])) : 0; + e.strict = row[13] ? static_cast(atoi(row[13])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_spawnentry_repository.h b/common/repositories/base/base_spawnentry_repository.h index 4cf92d0fb..70d7e1807 100644 --- a/common/repositories/base/base_spawnentry_repository.h +++ b/common/repositories/base/base_spawnentry_repository.h @@ -151,14 +151,14 @@ public: if (results.RowCount() == 1) { Spawnentry e{}; - e.spawngroupID = static_cast(atoi(row[0])); - e.npcID = static_cast(atoi(row[1])); - e.chance = static_cast(atoi(row[2])); - e.condition_value_filter = static_cast(atoi(row[3])); - e.min_time = static_cast(atoi(row[4])); - e.max_time = static_cast(atoi(row[5])); - e.min_expansion = static_cast(atoi(row[6])); - e.max_expansion = static_cast(atoi(row[7])); + e.spawngroupID = row[0] ? static_cast(atoi(row[0])) : 0; + e.npcID = row[1] ? static_cast(atoi(row[1])) : 0; + e.chance = row[2] ? static_cast(atoi(row[2])) : 0; + e.condition_value_filter = row[3] ? static_cast(atoi(row[3])) : 1; + e.min_time = row[4] ? static_cast(atoi(row[4])) : 0; + e.max_time = row[5] ? static_cast(atoi(row[5])) : 0; + e.min_expansion = row[6] ? static_cast(atoi(row[6])) : -1; + e.max_expansion = row[7] ? static_cast(atoi(row[7])) : -1; e.content_flags = row[8] ? row[8] : ""; e.content_flags_disabled = row[9] ? row[9] : ""; @@ -307,14 +307,14 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Spawnentry e{}; - e.spawngroupID = static_cast(atoi(row[0])); - e.npcID = static_cast(atoi(row[1])); - e.chance = static_cast(atoi(row[2])); - e.condition_value_filter = static_cast(atoi(row[3])); - e.min_time = static_cast(atoi(row[4])); - e.max_time = static_cast(atoi(row[5])); - e.min_expansion = static_cast(atoi(row[6])); - e.max_expansion = static_cast(atoi(row[7])); + e.spawngroupID = row[0] ? static_cast(atoi(row[0])) : 0; + e.npcID = row[1] ? static_cast(atoi(row[1])) : 0; + e.chance = row[2] ? static_cast(atoi(row[2])) : 0; + e.condition_value_filter = row[3] ? static_cast(atoi(row[3])) : 1; + e.min_time = row[4] ? static_cast(atoi(row[4])) : 0; + e.max_time = row[5] ? static_cast(atoi(row[5])) : 0; + e.min_expansion = row[6] ? static_cast(atoi(row[6])) : -1; + e.max_expansion = row[7] ? static_cast(atoi(row[7])) : -1; e.content_flags = row[8] ? row[8] : ""; e.content_flags_disabled = row[9] ? row[9] : ""; @@ -341,14 +341,14 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Spawnentry e{}; - e.spawngroupID = static_cast(atoi(row[0])); - e.npcID = static_cast(atoi(row[1])); - e.chance = static_cast(atoi(row[2])); - e.condition_value_filter = static_cast(atoi(row[3])); - e.min_time = static_cast(atoi(row[4])); - e.max_time = static_cast(atoi(row[5])); - e.min_expansion = static_cast(atoi(row[6])); - e.max_expansion = static_cast(atoi(row[7])); + e.spawngroupID = row[0] ? static_cast(atoi(row[0])) : 0; + e.npcID = row[1] ? static_cast(atoi(row[1])) : 0; + e.chance = row[2] ? static_cast(atoi(row[2])) : 0; + e.condition_value_filter = row[3] ? static_cast(atoi(row[3])) : 1; + e.min_time = row[4] ? static_cast(atoi(row[4])) : 0; + e.max_time = row[5] ? static_cast(atoi(row[5])) : 0; + e.min_expansion = row[6] ? static_cast(atoi(row[6])) : -1; + e.max_expansion = row[7] ? static_cast(atoi(row[7])) : -1; e.content_flags = row[8] ? row[8] : ""; e.content_flags_disabled = row[9] ? row[9] : ""; diff --git a/common/repositories/base/base_spawngroup_repository.h b/common/repositories/base/base_spawngroup_repository.h index 6b551f474..dd7a3e1b0 100644 --- a/common/repositories/base/base_spawngroup_repository.h +++ b/common/repositories/base/base_spawngroup_repository.h @@ -16,7 +16,6 @@ #include "../../strings.h" #include - class BaseSpawngroupRepository { public: struct Spawngroup { @@ -164,18 +163,18 @@ public: if (results.RowCount() == 1) { Spawngroup e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.spawn_limit = static_cast(atoi(row[2])); + e.spawn_limit = row[2] ? static_cast(atoi(row[2])) : 0; e.dist = row[3] ? strtof(row[3], nullptr) : 0; e.max_x = row[4] ? strtof(row[4], nullptr) : 0; e.min_x = row[5] ? strtof(row[5], nullptr) : 0; e.max_y = row[6] ? strtof(row[6], nullptr) : 0; e.min_y = row[7] ? strtof(row[7], nullptr) : 0; - e.delay = static_cast(atoi(row[8])); - e.mindelay = static_cast(atoi(row[9])); - e.despawn = static_cast(atoi(row[10])); - e.despawn_timer = static_cast(atoi(row[11])); + e.delay = row[8] ? static_cast(atoi(row[8])) : 45000; + e.mindelay = row[9] ? static_cast(atoi(row[9])) : 15000; + e.despawn = row[10] ? static_cast(atoi(row[10])) : 0; + e.despawn_timer = row[11] ? static_cast(atoi(row[11])) : 100; e.wp_spawns = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; return e; @@ -331,18 +330,18 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Spawngroup e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.spawn_limit = static_cast(atoi(row[2])); + e.spawn_limit = row[2] ? static_cast(atoi(row[2])) : 0; e.dist = row[3] ? strtof(row[3], nullptr) : 0; e.max_x = row[4] ? strtof(row[4], nullptr) : 0; e.min_x = row[5] ? strtof(row[5], nullptr) : 0; e.max_y = row[6] ? strtof(row[6], nullptr) : 0; e.min_y = row[7] ? strtof(row[7], nullptr) : 0; - e.delay = static_cast(atoi(row[8])); - e.mindelay = static_cast(atoi(row[9])); - e.despawn = static_cast(atoi(row[10])); - e.despawn_timer = static_cast(atoi(row[11])); + e.delay = row[8] ? static_cast(atoi(row[8])) : 45000; + e.mindelay = row[9] ? static_cast(atoi(row[9])) : 15000; + e.despawn = row[10] ? static_cast(atoi(row[10])) : 0; + e.despawn_timer = row[11] ? static_cast(atoi(row[11])) : 100; e.wp_spawns = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; all_entries.push_back(e); @@ -368,18 +367,18 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Spawngroup e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.spawn_limit = static_cast(atoi(row[2])); + e.spawn_limit = row[2] ? static_cast(atoi(row[2])) : 0; e.dist = row[3] ? strtof(row[3], nullptr) : 0; e.max_x = row[4] ? strtof(row[4], nullptr) : 0; e.min_x = row[5] ? strtof(row[5], nullptr) : 0; e.max_y = row[6] ? strtof(row[6], nullptr) : 0; e.min_y = row[7] ? strtof(row[7], nullptr) : 0; - e.delay = static_cast(atoi(row[8])); - e.mindelay = static_cast(atoi(row[9])); - e.despawn = static_cast(atoi(row[10])); - e.despawn_timer = static_cast(atoi(row[11])); + e.delay = row[8] ? static_cast(atoi(row[8])) : 45000; + e.mindelay = row[9] ? static_cast(atoi(row[9])) : 15000; + e.despawn = row[10] ? static_cast(atoi(row[10])) : 0; + e.despawn_timer = row[11] ? static_cast(atoi(row[11])) : 100; e.wp_spawns = row[12] ? static_cast(strtoul(row[12], nullptr, 10)) : 0; all_entries.push_back(e); diff --git a/common/repositories/base/base_spell_globals_repository.h b/common/repositories/base/base_spell_globals_repository.h index a3aa9c4d6..b4d3dc1cf 100644 --- a/common/repositories/base/base_spell_globals_repository.h +++ b/common/repositories/base/base_spell_globals_repository.h @@ -127,7 +127,7 @@ public: if (results.RowCount() == 1) { SpellGlobals e{}; - e.spellid = static_cast(atoi(row[0])); + e.spellid = row[0] ? static_cast(atoi(row[0])) : 0; e.spell_name = row[1] ? row[1] : ""; e.qglobal = row[2] ? row[2] : ""; e.value = row[3] ? row[3] : ""; @@ -259,7 +259,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { SpellGlobals e{}; - e.spellid = static_cast(atoi(row[0])); + e.spellid = row[0] ? static_cast(atoi(row[0])) : 0; e.spell_name = row[1] ? row[1] : ""; e.qglobal = row[2] ? row[2] : ""; e.value = row[3] ? row[3] : ""; @@ -287,7 +287,7 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { SpellGlobals e{}; - e.spellid = static_cast(atoi(row[0])); + e.spellid = row[0] ? static_cast(atoi(row[0])) : 0; e.spell_name = row[1] ? row[1] : ""; e.qglobal = row[2] ? row[2] : ""; e.value = row[3] ? row[3] : ""; diff --git a/common/repositories/base/base_spells_new_repository.h b/common/repositories/base/base_spells_new_repository.h index 47c65ebf5..40f490580 100644 --- a/common/repositories/base/base_spells_new_repository.h +++ b/common/repositories/base/base_spells_new_repository.h @@ -1059,243 +1059,243 @@ public: if (results.RowCount() == 1) { SpellsNew e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.player_1 = row[2] ? row[2] : ""; + e.player_1 = row[2] ? row[2] : "BLUE_TRAIL"; e.teleport_zone = row[3] ? row[3] : ""; e.you_cast = row[4] ? row[4] : ""; e.other_casts = row[5] ? row[5] : ""; e.cast_on_you = row[6] ? row[6] : ""; e.cast_on_other = row[7] ? row[7] : ""; e.spell_fades = row[8] ? row[8] : ""; - e.range_ = static_cast(atoi(row[9])); - e.aoerange = static_cast(atoi(row[10])); - e.pushback = static_cast(atoi(row[11])); - e.pushup = static_cast(atoi(row[12])); - e.cast_time = static_cast(atoi(row[13])); - e.recovery_time = static_cast(atoi(row[14])); - e.recast_time = static_cast(atoi(row[15])); - e.buffdurationformula = static_cast(atoi(row[16])); - e.buffduration = static_cast(atoi(row[17])); - e.AEDuration = static_cast(atoi(row[18])); - e.mana = static_cast(atoi(row[19])); - e.effect_base_value1 = static_cast(atoi(row[20])); - e.effect_base_value2 = static_cast(atoi(row[21])); - e.effect_base_value3 = static_cast(atoi(row[22])); - e.effect_base_value4 = static_cast(atoi(row[23])); - e.effect_base_value5 = static_cast(atoi(row[24])); - e.effect_base_value6 = static_cast(atoi(row[25])); - e.effect_base_value7 = static_cast(atoi(row[26])); - e.effect_base_value8 = static_cast(atoi(row[27])); - e.effect_base_value9 = static_cast(atoi(row[28])); - e.effect_base_value10 = static_cast(atoi(row[29])); - e.effect_base_value11 = static_cast(atoi(row[30])); - e.effect_base_value12 = static_cast(atoi(row[31])); - e.effect_limit_value1 = static_cast(atoi(row[32])); - e.effect_limit_value2 = static_cast(atoi(row[33])); - e.effect_limit_value3 = static_cast(atoi(row[34])); - e.effect_limit_value4 = static_cast(atoi(row[35])); - e.effect_limit_value5 = static_cast(atoi(row[36])); - e.effect_limit_value6 = static_cast(atoi(row[37])); - e.effect_limit_value7 = static_cast(atoi(row[38])); - e.effect_limit_value8 = static_cast(atoi(row[39])); - e.effect_limit_value9 = static_cast(atoi(row[40])); - e.effect_limit_value10 = static_cast(atoi(row[41])); - e.effect_limit_value11 = static_cast(atoi(row[42])); - e.effect_limit_value12 = static_cast(atoi(row[43])); - e.max1 = static_cast(atoi(row[44])); - e.max2 = static_cast(atoi(row[45])); - e.max3 = static_cast(atoi(row[46])); - e.max4 = static_cast(atoi(row[47])); - e.max5 = static_cast(atoi(row[48])); - e.max6 = static_cast(atoi(row[49])); - e.max7 = static_cast(atoi(row[50])); - e.max8 = static_cast(atoi(row[51])); - e.max9 = static_cast(atoi(row[52])); - e.max10 = static_cast(atoi(row[53])); - e.max11 = static_cast(atoi(row[54])); - e.max12 = static_cast(atoi(row[55])); - e.icon = static_cast(atoi(row[56])); - e.memicon = static_cast(atoi(row[57])); - e.components1 = static_cast(atoi(row[58])); - e.components2 = static_cast(atoi(row[59])); - e.components3 = static_cast(atoi(row[60])); - e.components4 = static_cast(atoi(row[61])); - e.component_counts1 = static_cast(atoi(row[62])); - e.component_counts2 = static_cast(atoi(row[63])); - e.component_counts3 = static_cast(atoi(row[64])); - e.component_counts4 = static_cast(atoi(row[65])); - e.NoexpendReagent1 = static_cast(atoi(row[66])); - e.NoexpendReagent2 = static_cast(atoi(row[67])); - e.NoexpendReagent3 = static_cast(atoi(row[68])); - e.NoexpendReagent4 = static_cast(atoi(row[69])); - e.formula1 = static_cast(atoi(row[70])); - e.formula2 = static_cast(atoi(row[71])); - e.formula3 = static_cast(atoi(row[72])); - e.formula4 = static_cast(atoi(row[73])); - e.formula5 = static_cast(atoi(row[74])); - e.formula6 = static_cast(atoi(row[75])); - e.formula7 = static_cast(atoi(row[76])); - e.formula8 = static_cast(atoi(row[77])); - e.formula9 = static_cast(atoi(row[78])); - e.formula10 = static_cast(atoi(row[79])); - e.formula11 = static_cast(atoi(row[80])); - e.formula12 = static_cast(atoi(row[81])); - e.LightType = static_cast(atoi(row[82])); - e.goodEffect = static_cast(atoi(row[83])); - e.Activated = static_cast(atoi(row[84])); - e.resisttype = static_cast(atoi(row[85])); - e.effectid1 = static_cast(atoi(row[86])); - e.effectid2 = static_cast(atoi(row[87])); - e.effectid3 = static_cast(atoi(row[88])); - e.effectid4 = static_cast(atoi(row[89])); - e.effectid5 = static_cast(atoi(row[90])); - e.effectid6 = static_cast(atoi(row[91])); - e.effectid7 = static_cast(atoi(row[92])); - e.effectid8 = static_cast(atoi(row[93])); - e.effectid9 = static_cast(atoi(row[94])); - e.effectid10 = static_cast(atoi(row[95])); - e.effectid11 = static_cast(atoi(row[96])); - e.effectid12 = static_cast(atoi(row[97])); - e.targettype = static_cast(atoi(row[98])); - e.basediff = static_cast(atoi(row[99])); - e.skill = static_cast(atoi(row[100])); - e.zonetype = static_cast(atoi(row[101])); - e.EnvironmentType = static_cast(atoi(row[102])); - e.TimeOfDay = static_cast(atoi(row[103])); - e.classes1 = static_cast(atoi(row[104])); - e.classes2 = static_cast(atoi(row[105])); - e.classes3 = static_cast(atoi(row[106])); - e.classes4 = static_cast(atoi(row[107])); - e.classes5 = static_cast(atoi(row[108])); - e.classes6 = static_cast(atoi(row[109])); - e.classes7 = static_cast(atoi(row[110])); - e.classes8 = static_cast(atoi(row[111])); - e.classes9 = static_cast(atoi(row[112])); - e.classes10 = static_cast(atoi(row[113])); - e.classes11 = static_cast(atoi(row[114])); - e.classes12 = static_cast(atoi(row[115])); - e.classes13 = static_cast(atoi(row[116])); - e.classes14 = static_cast(atoi(row[117])); - e.classes15 = static_cast(atoi(row[118])); - e.classes16 = static_cast(atoi(row[119])); - e.CastingAnim = static_cast(atoi(row[120])); - e.TargetAnim = static_cast(atoi(row[121])); - e.TravelType = static_cast(atoi(row[122])); - e.SpellAffectIndex = static_cast(atoi(row[123])); - e.disallow_sit = static_cast(atoi(row[124])); - e.deities0 = static_cast(atoi(row[125])); - e.deities1 = static_cast(atoi(row[126])); - e.deities2 = static_cast(atoi(row[127])); - e.deities3 = static_cast(atoi(row[128])); - e.deities4 = static_cast(atoi(row[129])); - e.deities5 = static_cast(atoi(row[130])); - e.deities6 = static_cast(atoi(row[131])); - e.deities7 = static_cast(atoi(row[132])); - e.deities8 = static_cast(atoi(row[133])); - e.deities9 = static_cast(atoi(row[134])); - e.deities10 = static_cast(atoi(row[135])); - e.deities11 = static_cast(atoi(row[136])); - e.deities12 = static_cast(atoi(row[137])); - e.deities13 = static_cast(atoi(row[138])); - e.deities14 = static_cast(atoi(row[139])); - e.deities15 = static_cast(atoi(row[140])); - e.deities16 = static_cast(atoi(row[141])); - e.field142 = static_cast(atoi(row[142])); - e.field143 = static_cast(atoi(row[143])); - e.new_icon = static_cast(atoi(row[144])); - e.spellanim = static_cast(atoi(row[145])); - e.uninterruptable = static_cast(atoi(row[146])); - e.ResistDiff = static_cast(atoi(row[147])); - e.dot_stacking_exempt = static_cast(atoi(row[148])); - e.deleteable = static_cast(atoi(row[149])); - e.RecourseLink = static_cast(atoi(row[150])); - e.no_partial_resist = static_cast(atoi(row[151])); - e.field152 = static_cast(atoi(row[152])); - e.field153 = static_cast(atoi(row[153])); - e.short_buff_box = static_cast(atoi(row[154])); - e.descnum = static_cast(atoi(row[155])); - e.typedescnum = static_cast(atoi(row[156])); - e.effectdescnum = static_cast(atoi(row[157])); - e.effectdescnum2 = static_cast(atoi(row[158])); - e.npc_no_los = static_cast(atoi(row[159])); - e.field160 = static_cast(atoi(row[160])); - e.reflectable = static_cast(atoi(row[161])); - e.bonushate = static_cast(atoi(row[162])); - e.field163 = static_cast(atoi(row[163])); - e.field164 = static_cast(atoi(row[164])); - e.ldon_trap = static_cast(atoi(row[165])); - e.EndurCost = static_cast(atoi(row[166])); - e.EndurTimerIndex = static_cast(atoi(row[167])); - e.IsDiscipline = static_cast(atoi(row[168])); - e.field169 = static_cast(atoi(row[169])); - e.field170 = static_cast(atoi(row[170])); - e.field171 = static_cast(atoi(row[171])); - e.field172 = static_cast(atoi(row[172])); - e.HateAdded = static_cast(atoi(row[173])); - e.EndurUpkeep = static_cast(atoi(row[174])); - e.numhitstype = static_cast(atoi(row[175])); - e.numhits = static_cast(atoi(row[176])); - e.pvpresistbase = static_cast(atoi(row[177])); - e.pvpresistcalc = static_cast(atoi(row[178])); - e.pvpresistcap = static_cast(atoi(row[179])); - e.spell_category = static_cast(atoi(row[180])); - e.pvp_duration = static_cast(atoi(row[181])); - e.pvp_duration_cap = static_cast(atoi(row[182])); - e.pcnpc_only_flag = static_cast(atoi(row[183])); - e.cast_not_standing = static_cast(atoi(row[184])); - e.can_mgb = static_cast(atoi(row[185])); - e.nodispell = static_cast(atoi(row[186])); - e.npc_category = static_cast(atoi(row[187])); - e.npc_usefulness = static_cast(atoi(row[188])); - e.MinResist = static_cast(atoi(row[189])); - e.MaxResist = static_cast(atoi(row[190])); - e.viral_targets = static_cast(atoi(row[191])); - e.viral_timer = static_cast(atoi(row[192])); - e.nimbuseffect = static_cast(atoi(row[193])); - e.ConeStartAngle = static_cast(atoi(row[194])); - e.ConeStopAngle = static_cast(atoi(row[195])); - e.sneaking = static_cast(atoi(row[196])); - e.not_extendable = static_cast(atoi(row[197])); - e.field198 = static_cast(atoi(row[198])); - e.field199 = static_cast(atoi(row[199])); - e.suspendable = static_cast(atoi(row[200])); - e.viral_range = static_cast(atoi(row[201])); - e.songcap = static_cast(atoi(row[202])); - e.field203 = static_cast(atoi(row[203])); - e.field204 = static_cast(atoi(row[204])); - e.no_block = static_cast(atoi(row[205])); - e.field206 = static_cast(atoi(row[206])); - e.spellgroup = static_cast(atoi(row[207])); - e.rank = static_cast(atoi(row[208])); - e.field209 = static_cast(atoi(row[209])); - e.field210 = static_cast(atoi(row[210])); - e.CastRestriction = static_cast(atoi(row[211])); - e.allowrest = static_cast(atoi(row[212])); - e.InCombat = static_cast(atoi(row[213])); - e.OutofCombat = static_cast(atoi(row[214])); - e.field215 = static_cast(atoi(row[215])); - e.field216 = static_cast(atoi(row[216])); - e.field217 = static_cast(atoi(row[217])); - e.aemaxtargets = static_cast(atoi(row[218])); - e.maxtargets = static_cast(atoi(row[219])); - e.field220 = static_cast(atoi(row[220])); - e.field221 = static_cast(atoi(row[221])); - e.field222 = static_cast(atoi(row[222])); - e.field223 = static_cast(atoi(row[223])); - e.persistdeath = static_cast(atoi(row[224])); - e.field225 = static_cast(atoi(row[225])); - e.field226 = static_cast(atoi(row[226])); + e.range_ = row[9] ? static_cast(atoi(row[9])) : 100; + e.aoerange = row[10] ? static_cast(atoi(row[10])) : 0; + e.pushback = row[11] ? static_cast(atoi(row[11])) : 0; + e.pushup = row[12] ? static_cast(atoi(row[12])) : 0; + e.cast_time = row[13] ? static_cast(atoi(row[13])) : 0; + e.recovery_time = row[14] ? static_cast(atoi(row[14])) : 0; + e.recast_time = row[15] ? static_cast(atoi(row[15])) : 0; + e.buffdurationformula = row[16] ? static_cast(atoi(row[16])) : 7; + e.buffduration = row[17] ? static_cast(atoi(row[17])) : 65; + e.AEDuration = row[18] ? static_cast(atoi(row[18])) : 0; + e.mana = row[19] ? static_cast(atoi(row[19])) : 0; + e.effect_base_value1 = row[20] ? static_cast(atoi(row[20])) : 100; + e.effect_base_value2 = row[21] ? static_cast(atoi(row[21])) : 0; + e.effect_base_value3 = row[22] ? static_cast(atoi(row[22])) : 0; + e.effect_base_value4 = row[23] ? static_cast(atoi(row[23])) : 0; + e.effect_base_value5 = row[24] ? static_cast(atoi(row[24])) : 0; + e.effect_base_value6 = row[25] ? static_cast(atoi(row[25])) : 0; + e.effect_base_value7 = row[26] ? static_cast(atoi(row[26])) : 0; + e.effect_base_value8 = row[27] ? static_cast(atoi(row[27])) : 0; + e.effect_base_value9 = row[28] ? static_cast(atoi(row[28])) : 0; + e.effect_base_value10 = row[29] ? static_cast(atoi(row[29])) : 0; + e.effect_base_value11 = row[30] ? static_cast(atoi(row[30])) : 0; + e.effect_base_value12 = row[31] ? static_cast(atoi(row[31])) : 0; + e.effect_limit_value1 = row[32] ? static_cast(atoi(row[32])) : 0; + e.effect_limit_value2 = row[33] ? static_cast(atoi(row[33])) : 0; + e.effect_limit_value3 = row[34] ? static_cast(atoi(row[34])) : 0; + e.effect_limit_value4 = row[35] ? static_cast(atoi(row[35])) : 0; + e.effect_limit_value5 = row[36] ? static_cast(atoi(row[36])) : 0; + e.effect_limit_value6 = row[37] ? static_cast(atoi(row[37])) : 0; + e.effect_limit_value7 = row[38] ? static_cast(atoi(row[38])) : 0; + e.effect_limit_value8 = row[39] ? static_cast(atoi(row[39])) : 0; + e.effect_limit_value9 = row[40] ? static_cast(atoi(row[40])) : 0; + e.effect_limit_value10 = row[41] ? static_cast(atoi(row[41])) : 0; + e.effect_limit_value11 = row[42] ? static_cast(atoi(row[42])) : 0; + e.effect_limit_value12 = row[43] ? static_cast(atoi(row[43])) : 0; + e.max1 = row[44] ? static_cast(atoi(row[44])) : 0; + e.max2 = row[45] ? static_cast(atoi(row[45])) : 0; + e.max3 = row[46] ? static_cast(atoi(row[46])) : 0; + e.max4 = row[47] ? static_cast(atoi(row[47])) : 0; + e.max5 = row[48] ? static_cast(atoi(row[48])) : 0; + e.max6 = row[49] ? static_cast(atoi(row[49])) : 0; + e.max7 = row[50] ? static_cast(atoi(row[50])) : 0; + e.max8 = row[51] ? static_cast(atoi(row[51])) : 0; + e.max9 = row[52] ? static_cast(atoi(row[52])) : 0; + e.max10 = row[53] ? static_cast(atoi(row[53])) : 0; + e.max11 = row[54] ? static_cast(atoi(row[54])) : 0; + e.max12 = row[55] ? static_cast(atoi(row[55])) : 0; + e.icon = row[56] ? static_cast(atoi(row[56])) : 0; + e.memicon = row[57] ? static_cast(atoi(row[57])) : 0; + e.components1 = row[58] ? static_cast(atoi(row[58])) : -1; + e.components2 = row[59] ? static_cast(atoi(row[59])) : -1; + e.components3 = row[60] ? static_cast(atoi(row[60])) : -1; + e.components4 = row[61] ? static_cast(atoi(row[61])) : -1; + e.component_counts1 = row[62] ? static_cast(atoi(row[62])) : 1; + e.component_counts2 = row[63] ? static_cast(atoi(row[63])) : 1; + e.component_counts3 = row[64] ? static_cast(atoi(row[64])) : 1; + e.component_counts4 = row[65] ? static_cast(atoi(row[65])) : 1; + e.NoexpendReagent1 = row[66] ? static_cast(atoi(row[66])) : -1; + e.NoexpendReagent2 = row[67] ? static_cast(atoi(row[67])) : -1; + e.NoexpendReagent3 = row[68] ? static_cast(atoi(row[68])) : -1; + e.NoexpendReagent4 = row[69] ? static_cast(atoi(row[69])) : -1; + e.formula1 = row[70] ? static_cast(atoi(row[70])) : 100; + e.formula2 = row[71] ? static_cast(atoi(row[71])) : 100; + e.formula3 = row[72] ? static_cast(atoi(row[72])) : 100; + e.formula4 = row[73] ? static_cast(atoi(row[73])) : 100; + e.formula5 = row[74] ? static_cast(atoi(row[74])) : 100; + e.formula6 = row[75] ? static_cast(atoi(row[75])) : 100; + e.formula7 = row[76] ? static_cast(atoi(row[76])) : 100; + e.formula8 = row[77] ? static_cast(atoi(row[77])) : 100; + e.formula9 = row[78] ? static_cast(atoi(row[78])) : 100; + e.formula10 = row[79] ? static_cast(atoi(row[79])) : 100; + e.formula11 = row[80] ? static_cast(atoi(row[80])) : 100; + e.formula12 = row[81] ? static_cast(atoi(row[81])) : 100; + e.LightType = row[82] ? static_cast(atoi(row[82])) : 0; + e.goodEffect = row[83] ? static_cast(atoi(row[83])) : 0; + e.Activated = row[84] ? static_cast(atoi(row[84])) : 0; + e.resisttype = row[85] ? static_cast(atoi(row[85])) : 0; + e.effectid1 = row[86] ? static_cast(atoi(row[86])) : 254; + e.effectid2 = row[87] ? static_cast(atoi(row[87])) : 254; + e.effectid3 = row[88] ? static_cast(atoi(row[88])) : 254; + e.effectid4 = row[89] ? static_cast(atoi(row[89])) : 254; + e.effectid5 = row[90] ? static_cast(atoi(row[90])) : 254; + e.effectid6 = row[91] ? static_cast(atoi(row[91])) : 254; + e.effectid7 = row[92] ? static_cast(atoi(row[92])) : 254; + e.effectid8 = row[93] ? static_cast(atoi(row[93])) : 254; + e.effectid9 = row[94] ? static_cast(atoi(row[94])) : 254; + e.effectid10 = row[95] ? static_cast(atoi(row[95])) : 254; + e.effectid11 = row[96] ? static_cast(atoi(row[96])) : 254; + e.effectid12 = row[97] ? static_cast(atoi(row[97])) : 254; + e.targettype = row[98] ? static_cast(atoi(row[98])) : 2; + e.basediff = row[99] ? static_cast(atoi(row[99])) : 0; + e.skill = row[100] ? static_cast(atoi(row[100])) : 98; + e.zonetype = row[101] ? static_cast(atoi(row[101])) : -1; + e.EnvironmentType = row[102] ? static_cast(atoi(row[102])) : 0; + e.TimeOfDay = row[103] ? static_cast(atoi(row[103])) : 0; + e.classes1 = row[104] ? static_cast(atoi(row[104])) : 255; + e.classes2 = row[105] ? static_cast(atoi(row[105])) : 255; + e.classes3 = row[106] ? static_cast(atoi(row[106])) : 255; + e.classes4 = row[107] ? static_cast(atoi(row[107])) : 255; + e.classes5 = row[108] ? static_cast(atoi(row[108])) : 255; + e.classes6 = row[109] ? static_cast(atoi(row[109])) : 255; + e.classes7 = row[110] ? static_cast(atoi(row[110])) : 255; + e.classes8 = row[111] ? static_cast(atoi(row[111])) : 255; + e.classes9 = row[112] ? static_cast(atoi(row[112])) : 255; + e.classes10 = row[113] ? static_cast(atoi(row[113])) : 255; + e.classes11 = row[114] ? static_cast(atoi(row[114])) : 255; + e.classes12 = row[115] ? static_cast(atoi(row[115])) : 255; + e.classes13 = row[116] ? static_cast(atoi(row[116])) : 255; + e.classes14 = row[117] ? static_cast(atoi(row[117])) : 255; + e.classes15 = row[118] ? static_cast(atoi(row[118])) : 255; + e.classes16 = row[119] ? static_cast(atoi(row[119])) : 255; + e.CastingAnim = row[120] ? static_cast(atoi(row[120])) : 44; + e.TargetAnim = row[121] ? static_cast(atoi(row[121])) : 13; + e.TravelType = row[122] ? static_cast(atoi(row[122])) : 0; + e.SpellAffectIndex = row[123] ? static_cast(atoi(row[123])) : -1; + e.disallow_sit = row[124] ? static_cast(atoi(row[124])) : 0; + e.deities0 = row[125] ? static_cast(atoi(row[125])) : 0; + e.deities1 = row[126] ? static_cast(atoi(row[126])) : 0; + e.deities2 = row[127] ? static_cast(atoi(row[127])) : 0; + e.deities3 = row[128] ? static_cast(atoi(row[128])) : 0; + e.deities4 = row[129] ? static_cast(atoi(row[129])) : 0; + e.deities5 = row[130] ? static_cast(atoi(row[130])) : 0; + e.deities6 = row[131] ? static_cast(atoi(row[131])) : 0; + e.deities7 = row[132] ? static_cast(atoi(row[132])) : 0; + e.deities8 = row[133] ? static_cast(atoi(row[133])) : 0; + e.deities9 = row[134] ? static_cast(atoi(row[134])) : 0; + e.deities10 = row[135] ? static_cast(atoi(row[135])) : 0; + e.deities11 = row[136] ? static_cast(atoi(row[136])) : 0; + e.deities12 = row[137] ? static_cast(atoi(row[137])) : 0; + e.deities13 = row[138] ? static_cast(atoi(row[138])) : 0; + e.deities14 = row[139] ? static_cast(atoi(row[139])) : 0; + e.deities15 = row[140] ? static_cast(atoi(row[140])) : 0; + e.deities16 = row[141] ? static_cast(atoi(row[141])) : 0; + e.field142 = row[142] ? static_cast(atoi(row[142])) : 100; + e.field143 = row[143] ? static_cast(atoi(row[143])) : 0; + e.new_icon = row[144] ? static_cast(atoi(row[144])) : 161; + e.spellanim = row[145] ? static_cast(atoi(row[145])) : 0; + e.uninterruptable = row[146] ? static_cast(atoi(row[146])) : 0; + e.ResistDiff = row[147] ? static_cast(atoi(row[147])) : -150; + e.dot_stacking_exempt = row[148] ? static_cast(atoi(row[148])) : 0; + e.deleteable = row[149] ? static_cast(atoi(row[149])) : 0; + e.RecourseLink = row[150] ? static_cast(atoi(row[150])) : 0; + e.no_partial_resist = row[151] ? static_cast(atoi(row[151])) : 0; + e.field152 = row[152] ? static_cast(atoi(row[152])) : 0; + e.field153 = row[153] ? static_cast(atoi(row[153])) : 0; + e.short_buff_box = row[154] ? static_cast(atoi(row[154])) : -1; + e.descnum = row[155] ? static_cast(atoi(row[155])) : 0; + e.typedescnum = row[156] ? static_cast(atoi(row[156])) : 0; + e.effectdescnum = row[157] ? static_cast(atoi(row[157])) : 0; + e.effectdescnum2 = row[158] ? static_cast(atoi(row[158])) : 0; + e.npc_no_los = row[159] ? static_cast(atoi(row[159])) : 0; + e.field160 = row[160] ? static_cast(atoi(row[160])) : 0; + e.reflectable = row[161] ? static_cast(atoi(row[161])) : 0; + e.bonushate = row[162] ? static_cast(atoi(row[162])) : 0; + e.field163 = row[163] ? static_cast(atoi(row[163])) : 100; + e.field164 = row[164] ? static_cast(atoi(row[164])) : -150; + e.ldon_trap = row[165] ? static_cast(atoi(row[165])) : 0; + e.EndurCost = row[166] ? static_cast(atoi(row[166])) : 0; + e.EndurTimerIndex = row[167] ? static_cast(atoi(row[167])) : 0; + e.IsDiscipline = row[168] ? static_cast(atoi(row[168])) : 0; + e.field169 = row[169] ? static_cast(atoi(row[169])) : 0; + e.field170 = row[170] ? static_cast(atoi(row[170])) : 0; + e.field171 = row[171] ? static_cast(atoi(row[171])) : 0; + e.field172 = row[172] ? static_cast(atoi(row[172])) : 0; + e.HateAdded = row[173] ? static_cast(atoi(row[173])) : 0; + e.EndurUpkeep = row[174] ? static_cast(atoi(row[174])) : 0; + e.numhitstype = row[175] ? static_cast(atoi(row[175])) : 0; + e.numhits = row[176] ? static_cast(atoi(row[176])) : 0; + e.pvpresistbase = row[177] ? static_cast(atoi(row[177])) : -150; + e.pvpresistcalc = row[178] ? static_cast(atoi(row[178])) : 100; + e.pvpresistcap = row[179] ? static_cast(atoi(row[179])) : -150; + e.spell_category = row[180] ? static_cast(atoi(row[180])) : -99; + e.pvp_duration = row[181] ? static_cast(atoi(row[181])) : 0; + e.pvp_duration_cap = row[182] ? static_cast(atoi(row[182])) : 0; + e.pcnpc_only_flag = row[183] ? static_cast(atoi(row[183])) : 0; + e.cast_not_standing = row[184] ? static_cast(atoi(row[184])) : 0; + e.can_mgb = row[185] ? static_cast(atoi(row[185])) : 0; + e.nodispell = row[186] ? static_cast(atoi(row[186])) : -1; + e.npc_category = row[187] ? static_cast(atoi(row[187])) : 0; + e.npc_usefulness = row[188] ? static_cast(atoi(row[188])) : 0; + e.MinResist = row[189] ? static_cast(atoi(row[189])) : 0; + e.MaxResist = row[190] ? static_cast(atoi(row[190])) : 0; + e.viral_targets = row[191] ? static_cast(atoi(row[191])) : 0; + e.viral_timer = row[192] ? static_cast(atoi(row[192])) : 0; + e.nimbuseffect = row[193] ? static_cast(atoi(row[193])) : 0; + e.ConeStartAngle = row[194] ? static_cast(atoi(row[194])) : 0; + e.ConeStopAngle = row[195] ? static_cast(atoi(row[195])) : 0; + e.sneaking = row[196] ? static_cast(atoi(row[196])) : 0; + e.not_extendable = row[197] ? static_cast(atoi(row[197])) : 0; + e.field198 = row[198] ? static_cast(atoi(row[198])) : 0; + e.field199 = row[199] ? static_cast(atoi(row[199])) : 1; + e.suspendable = row[200] ? static_cast(atoi(row[200])) : 0; + e.viral_range = row[201] ? static_cast(atoi(row[201])) : 0; + e.songcap = row[202] ? static_cast(atoi(row[202])) : 0; + e.field203 = row[203] ? static_cast(atoi(row[203])) : 0; + e.field204 = row[204] ? static_cast(atoi(row[204])) : 0; + e.no_block = row[205] ? static_cast(atoi(row[205])) : 0; + e.field206 = row[206] ? static_cast(atoi(row[206])) : -1; + e.spellgroup = row[207] ? static_cast(atoi(row[207])) : 0; + e.rank = row[208] ? static_cast(atoi(row[208])) : 0; + e.field209 = row[209] ? static_cast(atoi(row[209])) : 0; + e.field210 = row[210] ? static_cast(atoi(row[210])) : 1; + e.CastRestriction = row[211] ? static_cast(atoi(row[211])) : 0; + e.allowrest = row[212] ? static_cast(atoi(row[212])) : 0; + e.InCombat = row[213] ? static_cast(atoi(row[213])) : 0; + e.OutofCombat = row[214] ? static_cast(atoi(row[214])) : 0; + e.field215 = row[215] ? static_cast(atoi(row[215])) : 0; + e.field216 = row[216] ? static_cast(atoi(row[216])) : 0; + e.field217 = row[217] ? static_cast(atoi(row[217])) : 0; + e.aemaxtargets = row[218] ? static_cast(atoi(row[218])) : 0; + e.maxtargets = row[219] ? static_cast(atoi(row[219])) : 0; + e.field220 = row[220] ? static_cast(atoi(row[220])) : 0; + e.field221 = row[221] ? static_cast(atoi(row[221])) : 0; + e.field222 = row[222] ? static_cast(atoi(row[222])) : 0; + e.field223 = row[223] ? static_cast(atoi(row[223])) : 0; + e.persistdeath = row[224] ? static_cast(atoi(row[224])) : 0; + e.field225 = row[225] ? static_cast(atoi(row[225])) : 0; + e.field226 = row[226] ? static_cast(atoi(row[226])) : 0; e.min_dist = row[227] ? strtof(row[227], nullptr) : 0; e.min_dist_mod = row[228] ? strtof(row[228], nullptr) : 0; e.max_dist = row[229] ? strtof(row[229], nullptr) : 0; e.max_dist_mod = row[230] ? strtof(row[230], nullptr) : 0; - e.min_range = static_cast(atoi(row[231])); - e.field232 = static_cast(atoi(row[232])); - e.field233 = static_cast(atoi(row[233])); - e.field234 = static_cast(atoi(row[234])); - e.field235 = static_cast(atoi(row[235])); - e.field236 = static_cast(atoi(row[236])); + e.min_range = row[231] ? static_cast(atoi(row[231])) : 0; + e.field232 = row[232] ? static_cast(atoi(row[232])) : 0; + e.field233 = row[233] ? static_cast(atoi(row[233])) : 0; + e.field234 = row[234] ? static_cast(atoi(row[234])) : 0; + e.field235 = row[235] ? static_cast(atoi(row[235])) : 0; + e.field236 = row[236] ? static_cast(atoi(row[236])) : 0; return e; } @@ -2123,243 +2123,243 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { SpellsNew e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.player_1 = row[2] ? row[2] : ""; + e.player_1 = row[2] ? row[2] : "BLUE_TRAIL"; e.teleport_zone = row[3] ? row[3] : ""; e.you_cast = row[4] ? row[4] : ""; e.other_casts = row[5] ? row[5] : ""; e.cast_on_you = row[6] ? row[6] : ""; e.cast_on_other = row[7] ? row[7] : ""; e.spell_fades = row[8] ? row[8] : ""; - e.range_ = static_cast(atoi(row[9])); - e.aoerange = static_cast(atoi(row[10])); - e.pushback = static_cast(atoi(row[11])); - e.pushup = static_cast(atoi(row[12])); - e.cast_time = static_cast(atoi(row[13])); - e.recovery_time = static_cast(atoi(row[14])); - e.recast_time = static_cast(atoi(row[15])); - e.buffdurationformula = static_cast(atoi(row[16])); - e.buffduration = static_cast(atoi(row[17])); - e.AEDuration = static_cast(atoi(row[18])); - e.mana = static_cast(atoi(row[19])); - e.effect_base_value1 = static_cast(atoi(row[20])); - e.effect_base_value2 = static_cast(atoi(row[21])); - e.effect_base_value3 = static_cast(atoi(row[22])); - e.effect_base_value4 = static_cast(atoi(row[23])); - e.effect_base_value5 = static_cast(atoi(row[24])); - e.effect_base_value6 = static_cast(atoi(row[25])); - e.effect_base_value7 = static_cast(atoi(row[26])); - e.effect_base_value8 = static_cast(atoi(row[27])); - e.effect_base_value9 = static_cast(atoi(row[28])); - e.effect_base_value10 = static_cast(atoi(row[29])); - e.effect_base_value11 = static_cast(atoi(row[30])); - e.effect_base_value12 = static_cast(atoi(row[31])); - e.effect_limit_value1 = static_cast(atoi(row[32])); - e.effect_limit_value2 = static_cast(atoi(row[33])); - e.effect_limit_value3 = static_cast(atoi(row[34])); - e.effect_limit_value4 = static_cast(atoi(row[35])); - e.effect_limit_value5 = static_cast(atoi(row[36])); - e.effect_limit_value6 = static_cast(atoi(row[37])); - e.effect_limit_value7 = static_cast(atoi(row[38])); - e.effect_limit_value8 = static_cast(atoi(row[39])); - e.effect_limit_value9 = static_cast(atoi(row[40])); - e.effect_limit_value10 = static_cast(atoi(row[41])); - e.effect_limit_value11 = static_cast(atoi(row[42])); - e.effect_limit_value12 = static_cast(atoi(row[43])); - e.max1 = static_cast(atoi(row[44])); - e.max2 = static_cast(atoi(row[45])); - e.max3 = static_cast(atoi(row[46])); - e.max4 = static_cast(atoi(row[47])); - e.max5 = static_cast(atoi(row[48])); - e.max6 = static_cast(atoi(row[49])); - e.max7 = static_cast(atoi(row[50])); - e.max8 = static_cast(atoi(row[51])); - e.max9 = static_cast(atoi(row[52])); - e.max10 = static_cast(atoi(row[53])); - e.max11 = static_cast(atoi(row[54])); - e.max12 = static_cast(atoi(row[55])); - e.icon = static_cast(atoi(row[56])); - e.memicon = static_cast(atoi(row[57])); - e.components1 = static_cast(atoi(row[58])); - e.components2 = static_cast(atoi(row[59])); - e.components3 = static_cast(atoi(row[60])); - e.components4 = static_cast(atoi(row[61])); - e.component_counts1 = static_cast(atoi(row[62])); - e.component_counts2 = static_cast(atoi(row[63])); - e.component_counts3 = static_cast(atoi(row[64])); - e.component_counts4 = static_cast(atoi(row[65])); - e.NoexpendReagent1 = static_cast(atoi(row[66])); - e.NoexpendReagent2 = static_cast(atoi(row[67])); - e.NoexpendReagent3 = static_cast(atoi(row[68])); - e.NoexpendReagent4 = static_cast(atoi(row[69])); - e.formula1 = static_cast(atoi(row[70])); - e.formula2 = static_cast(atoi(row[71])); - e.formula3 = static_cast(atoi(row[72])); - e.formula4 = static_cast(atoi(row[73])); - e.formula5 = static_cast(atoi(row[74])); - e.formula6 = static_cast(atoi(row[75])); - e.formula7 = static_cast(atoi(row[76])); - e.formula8 = static_cast(atoi(row[77])); - e.formula9 = static_cast(atoi(row[78])); - e.formula10 = static_cast(atoi(row[79])); - e.formula11 = static_cast(atoi(row[80])); - e.formula12 = static_cast(atoi(row[81])); - e.LightType = static_cast(atoi(row[82])); - e.goodEffect = static_cast(atoi(row[83])); - e.Activated = static_cast(atoi(row[84])); - e.resisttype = static_cast(atoi(row[85])); - e.effectid1 = static_cast(atoi(row[86])); - e.effectid2 = static_cast(atoi(row[87])); - e.effectid3 = static_cast(atoi(row[88])); - e.effectid4 = static_cast(atoi(row[89])); - e.effectid5 = static_cast(atoi(row[90])); - e.effectid6 = static_cast(atoi(row[91])); - e.effectid7 = static_cast(atoi(row[92])); - e.effectid8 = static_cast(atoi(row[93])); - e.effectid9 = static_cast(atoi(row[94])); - e.effectid10 = static_cast(atoi(row[95])); - e.effectid11 = static_cast(atoi(row[96])); - e.effectid12 = static_cast(atoi(row[97])); - e.targettype = static_cast(atoi(row[98])); - e.basediff = static_cast(atoi(row[99])); - e.skill = static_cast(atoi(row[100])); - e.zonetype = static_cast(atoi(row[101])); - e.EnvironmentType = static_cast(atoi(row[102])); - e.TimeOfDay = static_cast(atoi(row[103])); - e.classes1 = static_cast(atoi(row[104])); - e.classes2 = static_cast(atoi(row[105])); - e.classes3 = static_cast(atoi(row[106])); - e.classes4 = static_cast(atoi(row[107])); - e.classes5 = static_cast(atoi(row[108])); - e.classes6 = static_cast(atoi(row[109])); - e.classes7 = static_cast(atoi(row[110])); - e.classes8 = static_cast(atoi(row[111])); - e.classes9 = static_cast(atoi(row[112])); - e.classes10 = static_cast(atoi(row[113])); - e.classes11 = static_cast(atoi(row[114])); - e.classes12 = static_cast(atoi(row[115])); - e.classes13 = static_cast(atoi(row[116])); - e.classes14 = static_cast(atoi(row[117])); - e.classes15 = static_cast(atoi(row[118])); - e.classes16 = static_cast(atoi(row[119])); - e.CastingAnim = static_cast(atoi(row[120])); - e.TargetAnim = static_cast(atoi(row[121])); - e.TravelType = static_cast(atoi(row[122])); - e.SpellAffectIndex = static_cast(atoi(row[123])); - e.disallow_sit = static_cast(atoi(row[124])); - e.deities0 = static_cast(atoi(row[125])); - e.deities1 = static_cast(atoi(row[126])); - e.deities2 = static_cast(atoi(row[127])); - e.deities3 = static_cast(atoi(row[128])); - e.deities4 = static_cast(atoi(row[129])); - e.deities5 = static_cast(atoi(row[130])); - e.deities6 = static_cast(atoi(row[131])); - e.deities7 = static_cast(atoi(row[132])); - e.deities8 = static_cast(atoi(row[133])); - e.deities9 = static_cast(atoi(row[134])); - e.deities10 = static_cast(atoi(row[135])); - e.deities11 = static_cast(atoi(row[136])); - e.deities12 = static_cast(atoi(row[137])); - e.deities13 = static_cast(atoi(row[138])); - e.deities14 = static_cast(atoi(row[139])); - e.deities15 = static_cast(atoi(row[140])); - e.deities16 = static_cast(atoi(row[141])); - e.field142 = static_cast(atoi(row[142])); - e.field143 = static_cast(atoi(row[143])); - e.new_icon = static_cast(atoi(row[144])); - e.spellanim = static_cast(atoi(row[145])); - e.uninterruptable = static_cast(atoi(row[146])); - e.ResistDiff = static_cast(atoi(row[147])); - e.dot_stacking_exempt = static_cast(atoi(row[148])); - e.deleteable = static_cast(atoi(row[149])); - e.RecourseLink = static_cast(atoi(row[150])); - e.no_partial_resist = static_cast(atoi(row[151])); - e.field152 = static_cast(atoi(row[152])); - e.field153 = static_cast(atoi(row[153])); - e.short_buff_box = static_cast(atoi(row[154])); - e.descnum = static_cast(atoi(row[155])); - e.typedescnum = static_cast(atoi(row[156])); - e.effectdescnum = static_cast(atoi(row[157])); - e.effectdescnum2 = static_cast(atoi(row[158])); - e.npc_no_los = static_cast(atoi(row[159])); - e.field160 = static_cast(atoi(row[160])); - e.reflectable = static_cast(atoi(row[161])); - e.bonushate = static_cast(atoi(row[162])); - e.field163 = static_cast(atoi(row[163])); - e.field164 = static_cast(atoi(row[164])); - e.ldon_trap = static_cast(atoi(row[165])); - e.EndurCost = static_cast(atoi(row[166])); - e.EndurTimerIndex = static_cast(atoi(row[167])); - e.IsDiscipline = static_cast(atoi(row[168])); - e.field169 = static_cast(atoi(row[169])); - e.field170 = static_cast(atoi(row[170])); - e.field171 = static_cast(atoi(row[171])); - e.field172 = static_cast(atoi(row[172])); - e.HateAdded = static_cast(atoi(row[173])); - e.EndurUpkeep = static_cast(atoi(row[174])); - e.numhitstype = static_cast(atoi(row[175])); - e.numhits = static_cast(atoi(row[176])); - e.pvpresistbase = static_cast(atoi(row[177])); - e.pvpresistcalc = static_cast(atoi(row[178])); - e.pvpresistcap = static_cast(atoi(row[179])); - e.spell_category = static_cast(atoi(row[180])); - e.pvp_duration = static_cast(atoi(row[181])); - e.pvp_duration_cap = static_cast(atoi(row[182])); - e.pcnpc_only_flag = static_cast(atoi(row[183])); - e.cast_not_standing = static_cast(atoi(row[184])); - e.can_mgb = static_cast(atoi(row[185])); - e.nodispell = static_cast(atoi(row[186])); - e.npc_category = static_cast(atoi(row[187])); - e.npc_usefulness = static_cast(atoi(row[188])); - e.MinResist = static_cast(atoi(row[189])); - e.MaxResist = static_cast(atoi(row[190])); - e.viral_targets = static_cast(atoi(row[191])); - e.viral_timer = static_cast(atoi(row[192])); - e.nimbuseffect = static_cast(atoi(row[193])); - e.ConeStartAngle = static_cast(atoi(row[194])); - e.ConeStopAngle = static_cast(atoi(row[195])); - e.sneaking = static_cast(atoi(row[196])); - e.not_extendable = static_cast(atoi(row[197])); - e.field198 = static_cast(atoi(row[198])); - e.field199 = static_cast(atoi(row[199])); - e.suspendable = static_cast(atoi(row[200])); - e.viral_range = static_cast(atoi(row[201])); - e.songcap = static_cast(atoi(row[202])); - e.field203 = static_cast(atoi(row[203])); - e.field204 = static_cast(atoi(row[204])); - e.no_block = static_cast(atoi(row[205])); - e.field206 = static_cast(atoi(row[206])); - e.spellgroup = static_cast(atoi(row[207])); - e.rank = static_cast(atoi(row[208])); - e.field209 = static_cast(atoi(row[209])); - e.field210 = static_cast(atoi(row[210])); - e.CastRestriction = static_cast(atoi(row[211])); - e.allowrest = static_cast(atoi(row[212])); - e.InCombat = static_cast(atoi(row[213])); - e.OutofCombat = static_cast(atoi(row[214])); - e.field215 = static_cast(atoi(row[215])); - e.field216 = static_cast(atoi(row[216])); - e.field217 = static_cast(atoi(row[217])); - e.aemaxtargets = static_cast(atoi(row[218])); - e.maxtargets = static_cast(atoi(row[219])); - e.field220 = static_cast(atoi(row[220])); - e.field221 = static_cast(atoi(row[221])); - e.field222 = static_cast(atoi(row[222])); - e.field223 = static_cast(atoi(row[223])); - e.persistdeath = static_cast(atoi(row[224])); - e.field225 = static_cast(atoi(row[225])); - e.field226 = static_cast(atoi(row[226])); + e.range_ = row[9] ? static_cast(atoi(row[9])) : 100; + e.aoerange = row[10] ? static_cast(atoi(row[10])) : 0; + e.pushback = row[11] ? static_cast(atoi(row[11])) : 0; + e.pushup = row[12] ? static_cast(atoi(row[12])) : 0; + e.cast_time = row[13] ? static_cast(atoi(row[13])) : 0; + e.recovery_time = row[14] ? static_cast(atoi(row[14])) : 0; + e.recast_time = row[15] ? static_cast(atoi(row[15])) : 0; + e.buffdurationformula = row[16] ? static_cast(atoi(row[16])) : 7; + e.buffduration = row[17] ? static_cast(atoi(row[17])) : 65; + e.AEDuration = row[18] ? static_cast(atoi(row[18])) : 0; + e.mana = row[19] ? static_cast(atoi(row[19])) : 0; + e.effect_base_value1 = row[20] ? static_cast(atoi(row[20])) : 100; + e.effect_base_value2 = row[21] ? static_cast(atoi(row[21])) : 0; + e.effect_base_value3 = row[22] ? static_cast(atoi(row[22])) : 0; + e.effect_base_value4 = row[23] ? static_cast(atoi(row[23])) : 0; + e.effect_base_value5 = row[24] ? static_cast(atoi(row[24])) : 0; + e.effect_base_value6 = row[25] ? static_cast(atoi(row[25])) : 0; + e.effect_base_value7 = row[26] ? static_cast(atoi(row[26])) : 0; + e.effect_base_value8 = row[27] ? static_cast(atoi(row[27])) : 0; + e.effect_base_value9 = row[28] ? static_cast(atoi(row[28])) : 0; + e.effect_base_value10 = row[29] ? static_cast(atoi(row[29])) : 0; + e.effect_base_value11 = row[30] ? static_cast(atoi(row[30])) : 0; + e.effect_base_value12 = row[31] ? static_cast(atoi(row[31])) : 0; + e.effect_limit_value1 = row[32] ? static_cast(atoi(row[32])) : 0; + e.effect_limit_value2 = row[33] ? static_cast(atoi(row[33])) : 0; + e.effect_limit_value3 = row[34] ? static_cast(atoi(row[34])) : 0; + e.effect_limit_value4 = row[35] ? static_cast(atoi(row[35])) : 0; + e.effect_limit_value5 = row[36] ? static_cast(atoi(row[36])) : 0; + e.effect_limit_value6 = row[37] ? static_cast(atoi(row[37])) : 0; + e.effect_limit_value7 = row[38] ? static_cast(atoi(row[38])) : 0; + e.effect_limit_value8 = row[39] ? static_cast(atoi(row[39])) : 0; + e.effect_limit_value9 = row[40] ? static_cast(atoi(row[40])) : 0; + e.effect_limit_value10 = row[41] ? static_cast(atoi(row[41])) : 0; + e.effect_limit_value11 = row[42] ? static_cast(atoi(row[42])) : 0; + e.effect_limit_value12 = row[43] ? static_cast(atoi(row[43])) : 0; + e.max1 = row[44] ? static_cast(atoi(row[44])) : 0; + e.max2 = row[45] ? static_cast(atoi(row[45])) : 0; + e.max3 = row[46] ? static_cast(atoi(row[46])) : 0; + e.max4 = row[47] ? static_cast(atoi(row[47])) : 0; + e.max5 = row[48] ? static_cast(atoi(row[48])) : 0; + e.max6 = row[49] ? static_cast(atoi(row[49])) : 0; + e.max7 = row[50] ? static_cast(atoi(row[50])) : 0; + e.max8 = row[51] ? static_cast(atoi(row[51])) : 0; + e.max9 = row[52] ? static_cast(atoi(row[52])) : 0; + e.max10 = row[53] ? static_cast(atoi(row[53])) : 0; + e.max11 = row[54] ? static_cast(atoi(row[54])) : 0; + e.max12 = row[55] ? static_cast(atoi(row[55])) : 0; + e.icon = row[56] ? static_cast(atoi(row[56])) : 0; + e.memicon = row[57] ? static_cast(atoi(row[57])) : 0; + e.components1 = row[58] ? static_cast(atoi(row[58])) : -1; + e.components2 = row[59] ? static_cast(atoi(row[59])) : -1; + e.components3 = row[60] ? static_cast(atoi(row[60])) : -1; + e.components4 = row[61] ? static_cast(atoi(row[61])) : -1; + e.component_counts1 = row[62] ? static_cast(atoi(row[62])) : 1; + e.component_counts2 = row[63] ? static_cast(atoi(row[63])) : 1; + e.component_counts3 = row[64] ? static_cast(atoi(row[64])) : 1; + e.component_counts4 = row[65] ? static_cast(atoi(row[65])) : 1; + e.NoexpendReagent1 = row[66] ? static_cast(atoi(row[66])) : -1; + e.NoexpendReagent2 = row[67] ? static_cast(atoi(row[67])) : -1; + e.NoexpendReagent3 = row[68] ? static_cast(atoi(row[68])) : -1; + e.NoexpendReagent4 = row[69] ? static_cast(atoi(row[69])) : -1; + e.formula1 = row[70] ? static_cast(atoi(row[70])) : 100; + e.formula2 = row[71] ? static_cast(atoi(row[71])) : 100; + e.formula3 = row[72] ? static_cast(atoi(row[72])) : 100; + e.formula4 = row[73] ? static_cast(atoi(row[73])) : 100; + e.formula5 = row[74] ? static_cast(atoi(row[74])) : 100; + e.formula6 = row[75] ? static_cast(atoi(row[75])) : 100; + e.formula7 = row[76] ? static_cast(atoi(row[76])) : 100; + e.formula8 = row[77] ? static_cast(atoi(row[77])) : 100; + e.formula9 = row[78] ? static_cast(atoi(row[78])) : 100; + e.formula10 = row[79] ? static_cast(atoi(row[79])) : 100; + e.formula11 = row[80] ? static_cast(atoi(row[80])) : 100; + e.formula12 = row[81] ? static_cast(atoi(row[81])) : 100; + e.LightType = row[82] ? static_cast(atoi(row[82])) : 0; + e.goodEffect = row[83] ? static_cast(atoi(row[83])) : 0; + e.Activated = row[84] ? static_cast(atoi(row[84])) : 0; + e.resisttype = row[85] ? static_cast(atoi(row[85])) : 0; + e.effectid1 = row[86] ? static_cast(atoi(row[86])) : 254; + e.effectid2 = row[87] ? static_cast(atoi(row[87])) : 254; + e.effectid3 = row[88] ? static_cast(atoi(row[88])) : 254; + e.effectid4 = row[89] ? static_cast(atoi(row[89])) : 254; + e.effectid5 = row[90] ? static_cast(atoi(row[90])) : 254; + e.effectid6 = row[91] ? static_cast(atoi(row[91])) : 254; + e.effectid7 = row[92] ? static_cast(atoi(row[92])) : 254; + e.effectid8 = row[93] ? static_cast(atoi(row[93])) : 254; + e.effectid9 = row[94] ? static_cast(atoi(row[94])) : 254; + e.effectid10 = row[95] ? static_cast(atoi(row[95])) : 254; + e.effectid11 = row[96] ? static_cast(atoi(row[96])) : 254; + e.effectid12 = row[97] ? static_cast(atoi(row[97])) : 254; + e.targettype = row[98] ? static_cast(atoi(row[98])) : 2; + e.basediff = row[99] ? static_cast(atoi(row[99])) : 0; + e.skill = row[100] ? static_cast(atoi(row[100])) : 98; + e.zonetype = row[101] ? static_cast(atoi(row[101])) : -1; + e.EnvironmentType = row[102] ? static_cast(atoi(row[102])) : 0; + e.TimeOfDay = row[103] ? static_cast(atoi(row[103])) : 0; + e.classes1 = row[104] ? static_cast(atoi(row[104])) : 255; + e.classes2 = row[105] ? static_cast(atoi(row[105])) : 255; + e.classes3 = row[106] ? static_cast(atoi(row[106])) : 255; + e.classes4 = row[107] ? static_cast(atoi(row[107])) : 255; + e.classes5 = row[108] ? static_cast(atoi(row[108])) : 255; + e.classes6 = row[109] ? static_cast(atoi(row[109])) : 255; + e.classes7 = row[110] ? static_cast(atoi(row[110])) : 255; + e.classes8 = row[111] ? static_cast(atoi(row[111])) : 255; + e.classes9 = row[112] ? static_cast(atoi(row[112])) : 255; + e.classes10 = row[113] ? static_cast(atoi(row[113])) : 255; + e.classes11 = row[114] ? static_cast(atoi(row[114])) : 255; + e.classes12 = row[115] ? static_cast(atoi(row[115])) : 255; + e.classes13 = row[116] ? static_cast(atoi(row[116])) : 255; + e.classes14 = row[117] ? static_cast(atoi(row[117])) : 255; + e.classes15 = row[118] ? static_cast(atoi(row[118])) : 255; + e.classes16 = row[119] ? static_cast(atoi(row[119])) : 255; + e.CastingAnim = row[120] ? static_cast(atoi(row[120])) : 44; + e.TargetAnim = row[121] ? static_cast(atoi(row[121])) : 13; + e.TravelType = row[122] ? static_cast(atoi(row[122])) : 0; + e.SpellAffectIndex = row[123] ? static_cast(atoi(row[123])) : -1; + e.disallow_sit = row[124] ? static_cast(atoi(row[124])) : 0; + e.deities0 = row[125] ? static_cast(atoi(row[125])) : 0; + e.deities1 = row[126] ? static_cast(atoi(row[126])) : 0; + e.deities2 = row[127] ? static_cast(atoi(row[127])) : 0; + e.deities3 = row[128] ? static_cast(atoi(row[128])) : 0; + e.deities4 = row[129] ? static_cast(atoi(row[129])) : 0; + e.deities5 = row[130] ? static_cast(atoi(row[130])) : 0; + e.deities6 = row[131] ? static_cast(atoi(row[131])) : 0; + e.deities7 = row[132] ? static_cast(atoi(row[132])) : 0; + e.deities8 = row[133] ? static_cast(atoi(row[133])) : 0; + e.deities9 = row[134] ? static_cast(atoi(row[134])) : 0; + e.deities10 = row[135] ? static_cast(atoi(row[135])) : 0; + e.deities11 = row[136] ? static_cast(atoi(row[136])) : 0; + e.deities12 = row[137] ? static_cast(atoi(row[137])) : 0; + e.deities13 = row[138] ? static_cast(atoi(row[138])) : 0; + e.deities14 = row[139] ? static_cast(atoi(row[139])) : 0; + e.deities15 = row[140] ? static_cast(atoi(row[140])) : 0; + e.deities16 = row[141] ? static_cast(atoi(row[141])) : 0; + e.field142 = row[142] ? static_cast(atoi(row[142])) : 100; + e.field143 = row[143] ? static_cast(atoi(row[143])) : 0; + e.new_icon = row[144] ? static_cast(atoi(row[144])) : 161; + e.spellanim = row[145] ? static_cast(atoi(row[145])) : 0; + e.uninterruptable = row[146] ? static_cast(atoi(row[146])) : 0; + e.ResistDiff = row[147] ? static_cast(atoi(row[147])) : -150; + e.dot_stacking_exempt = row[148] ? static_cast(atoi(row[148])) : 0; + e.deleteable = row[149] ? static_cast(atoi(row[149])) : 0; + e.RecourseLink = row[150] ? static_cast(atoi(row[150])) : 0; + e.no_partial_resist = row[151] ? static_cast(atoi(row[151])) : 0; + e.field152 = row[152] ? static_cast(atoi(row[152])) : 0; + e.field153 = row[153] ? static_cast(atoi(row[153])) : 0; + e.short_buff_box = row[154] ? static_cast(atoi(row[154])) : -1; + e.descnum = row[155] ? static_cast(atoi(row[155])) : 0; + e.typedescnum = row[156] ? static_cast(atoi(row[156])) : 0; + e.effectdescnum = row[157] ? static_cast(atoi(row[157])) : 0; + e.effectdescnum2 = row[158] ? static_cast(atoi(row[158])) : 0; + e.npc_no_los = row[159] ? static_cast(atoi(row[159])) : 0; + e.field160 = row[160] ? static_cast(atoi(row[160])) : 0; + e.reflectable = row[161] ? static_cast(atoi(row[161])) : 0; + e.bonushate = row[162] ? static_cast(atoi(row[162])) : 0; + e.field163 = row[163] ? static_cast(atoi(row[163])) : 100; + e.field164 = row[164] ? static_cast(atoi(row[164])) : -150; + e.ldon_trap = row[165] ? static_cast(atoi(row[165])) : 0; + e.EndurCost = row[166] ? static_cast(atoi(row[166])) : 0; + e.EndurTimerIndex = row[167] ? static_cast(atoi(row[167])) : 0; + e.IsDiscipline = row[168] ? static_cast(atoi(row[168])) : 0; + e.field169 = row[169] ? static_cast(atoi(row[169])) : 0; + e.field170 = row[170] ? static_cast(atoi(row[170])) : 0; + e.field171 = row[171] ? static_cast(atoi(row[171])) : 0; + e.field172 = row[172] ? static_cast(atoi(row[172])) : 0; + e.HateAdded = row[173] ? static_cast(atoi(row[173])) : 0; + e.EndurUpkeep = row[174] ? static_cast(atoi(row[174])) : 0; + e.numhitstype = row[175] ? static_cast(atoi(row[175])) : 0; + e.numhits = row[176] ? static_cast(atoi(row[176])) : 0; + e.pvpresistbase = row[177] ? static_cast(atoi(row[177])) : -150; + e.pvpresistcalc = row[178] ? static_cast(atoi(row[178])) : 100; + e.pvpresistcap = row[179] ? static_cast(atoi(row[179])) : -150; + e.spell_category = row[180] ? static_cast(atoi(row[180])) : -99; + e.pvp_duration = row[181] ? static_cast(atoi(row[181])) : 0; + e.pvp_duration_cap = row[182] ? static_cast(atoi(row[182])) : 0; + e.pcnpc_only_flag = row[183] ? static_cast(atoi(row[183])) : 0; + e.cast_not_standing = row[184] ? static_cast(atoi(row[184])) : 0; + e.can_mgb = row[185] ? static_cast(atoi(row[185])) : 0; + e.nodispell = row[186] ? static_cast(atoi(row[186])) : -1; + e.npc_category = row[187] ? static_cast(atoi(row[187])) : 0; + e.npc_usefulness = row[188] ? static_cast(atoi(row[188])) : 0; + e.MinResist = row[189] ? static_cast(atoi(row[189])) : 0; + e.MaxResist = row[190] ? static_cast(atoi(row[190])) : 0; + e.viral_targets = row[191] ? static_cast(atoi(row[191])) : 0; + e.viral_timer = row[192] ? static_cast(atoi(row[192])) : 0; + e.nimbuseffect = row[193] ? static_cast(atoi(row[193])) : 0; + e.ConeStartAngle = row[194] ? static_cast(atoi(row[194])) : 0; + e.ConeStopAngle = row[195] ? static_cast(atoi(row[195])) : 0; + e.sneaking = row[196] ? static_cast(atoi(row[196])) : 0; + e.not_extendable = row[197] ? static_cast(atoi(row[197])) : 0; + e.field198 = row[198] ? static_cast(atoi(row[198])) : 0; + e.field199 = row[199] ? static_cast(atoi(row[199])) : 1; + e.suspendable = row[200] ? static_cast(atoi(row[200])) : 0; + e.viral_range = row[201] ? static_cast(atoi(row[201])) : 0; + e.songcap = row[202] ? static_cast(atoi(row[202])) : 0; + e.field203 = row[203] ? static_cast(atoi(row[203])) : 0; + e.field204 = row[204] ? static_cast(atoi(row[204])) : 0; + e.no_block = row[205] ? static_cast(atoi(row[205])) : 0; + e.field206 = row[206] ? static_cast(atoi(row[206])) : -1; + e.spellgroup = row[207] ? static_cast(atoi(row[207])) : 0; + e.rank = row[208] ? static_cast(atoi(row[208])) : 0; + e.field209 = row[209] ? static_cast(atoi(row[209])) : 0; + e.field210 = row[210] ? static_cast(atoi(row[210])) : 1; + e.CastRestriction = row[211] ? static_cast(atoi(row[211])) : 0; + e.allowrest = row[212] ? static_cast(atoi(row[212])) : 0; + e.InCombat = row[213] ? static_cast(atoi(row[213])) : 0; + e.OutofCombat = row[214] ? static_cast(atoi(row[214])) : 0; + e.field215 = row[215] ? static_cast(atoi(row[215])) : 0; + e.field216 = row[216] ? static_cast(atoi(row[216])) : 0; + e.field217 = row[217] ? static_cast(atoi(row[217])) : 0; + e.aemaxtargets = row[218] ? static_cast(atoi(row[218])) : 0; + e.maxtargets = row[219] ? static_cast(atoi(row[219])) : 0; + e.field220 = row[220] ? static_cast(atoi(row[220])) : 0; + e.field221 = row[221] ? static_cast(atoi(row[221])) : 0; + e.field222 = row[222] ? static_cast(atoi(row[222])) : 0; + e.field223 = row[223] ? static_cast(atoi(row[223])) : 0; + e.persistdeath = row[224] ? static_cast(atoi(row[224])) : 0; + e.field225 = row[225] ? static_cast(atoi(row[225])) : 0; + e.field226 = row[226] ? static_cast(atoi(row[226])) : 0; e.min_dist = row[227] ? strtof(row[227], nullptr) : 0; e.min_dist_mod = row[228] ? strtof(row[228], nullptr) : 0; e.max_dist = row[229] ? strtof(row[229], nullptr) : 0; e.max_dist_mod = row[230] ? strtof(row[230], nullptr) : 0; - e.min_range = static_cast(atoi(row[231])); - e.field232 = static_cast(atoi(row[232])); - e.field233 = static_cast(atoi(row[233])); - e.field234 = static_cast(atoi(row[234])); - e.field235 = static_cast(atoi(row[235])); - e.field236 = static_cast(atoi(row[236])); + e.min_range = row[231] ? static_cast(atoi(row[231])) : 0; + e.field232 = row[232] ? static_cast(atoi(row[232])) : 0; + e.field233 = row[233] ? static_cast(atoi(row[233])) : 0; + e.field234 = row[234] ? static_cast(atoi(row[234])) : 0; + e.field235 = row[235] ? static_cast(atoi(row[235])) : 0; + e.field236 = row[236] ? static_cast(atoi(row[236])) : 0; all_entries.push_back(e); } @@ -2384,243 +2384,243 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { SpellsNew e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.player_1 = row[2] ? row[2] : ""; + e.player_1 = row[2] ? row[2] : "BLUE_TRAIL"; e.teleport_zone = row[3] ? row[3] : ""; e.you_cast = row[4] ? row[4] : ""; e.other_casts = row[5] ? row[5] : ""; e.cast_on_you = row[6] ? row[6] : ""; e.cast_on_other = row[7] ? row[7] : ""; e.spell_fades = row[8] ? row[8] : ""; - e.range_ = static_cast(atoi(row[9])); - e.aoerange = static_cast(atoi(row[10])); - e.pushback = static_cast(atoi(row[11])); - e.pushup = static_cast(atoi(row[12])); - e.cast_time = static_cast(atoi(row[13])); - e.recovery_time = static_cast(atoi(row[14])); - e.recast_time = static_cast(atoi(row[15])); - e.buffdurationformula = static_cast(atoi(row[16])); - e.buffduration = static_cast(atoi(row[17])); - e.AEDuration = static_cast(atoi(row[18])); - e.mana = static_cast(atoi(row[19])); - e.effect_base_value1 = static_cast(atoi(row[20])); - e.effect_base_value2 = static_cast(atoi(row[21])); - e.effect_base_value3 = static_cast(atoi(row[22])); - e.effect_base_value4 = static_cast(atoi(row[23])); - e.effect_base_value5 = static_cast(atoi(row[24])); - e.effect_base_value6 = static_cast(atoi(row[25])); - e.effect_base_value7 = static_cast(atoi(row[26])); - e.effect_base_value8 = static_cast(atoi(row[27])); - e.effect_base_value9 = static_cast(atoi(row[28])); - e.effect_base_value10 = static_cast(atoi(row[29])); - e.effect_base_value11 = static_cast(atoi(row[30])); - e.effect_base_value12 = static_cast(atoi(row[31])); - e.effect_limit_value1 = static_cast(atoi(row[32])); - e.effect_limit_value2 = static_cast(atoi(row[33])); - e.effect_limit_value3 = static_cast(atoi(row[34])); - e.effect_limit_value4 = static_cast(atoi(row[35])); - e.effect_limit_value5 = static_cast(atoi(row[36])); - e.effect_limit_value6 = static_cast(atoi(row[37])); - e.effect_limit_value7 = static_cast(atoi(row[38])); - e.effect_limit_value8 = static_cast(atoi(row[39])); - e.effect_limit_value9 = static_cast(atoi(row[40])); - e.effect_limit_value10 = static_cast(atoi(row[41])); - e.effect_limit_value11 = static_cast(atoi(row[42])); - e.effect_limit_value12 = static_cast(atoi(row[43])); - e.max1 = static_cast(atoi(row[44])); - e.max2 = static_cast(atoi(row[45])); - e.max3 = static_cast(atoi(row[46])); - e.max4 = static_cast(atoi(row[47])); - e.max5 = static_cast(atoi(row[48])); - e.max6 = static_cast(atoi(row[49])); - e.max7 = static_cast(atoi(row[50])); - e.max8 = static_cast(atoi(row[51])); - e.max9 = static_cast(atoi(row[52])); - e.max10 = static_cast(atoi(row[53])); - e.max11 = static_cast(atoi(row[54])); - e.max12 = static_cast(atoi(row[55])); - e.icon = static_cast(atoi(row[56])); - e.memicon = static_cast(atoi(row[57])); - e.components1 = static_cast(atoi(row[58])); - e.components2 = static_cast(atoi(row[59])); - e.components3 = static_cast(atoi(row[60])); - e.components4 = static_cast(atoi(row[61])); - e.component_counts1 = static_cast(atoi(row[62])); - e.component_counts2 = static_cast(atoi(row[63])); - e.component_counts3 = static_cast(atoi(row[64])); - e.component_counts4 = static_cast(atoi(row[65])); - e.NoexpendReagent1 = static_cast(atoi(row[66])); - e.NoexpendReagent2 = static_cast(atoi(row[67])); - e.NoexpendReagent3 = static_cast(atoi(row[68])); - e.NoexpendReagent4 = static_cast(atoi(row[69])); - e.formula1 = static_cast(atoi(row[70])); - e.formula2 = static_cast(atoi(row[71])); - e.formula3 = static_cast(atoi(row[72])); - e.formula4 = static_cast(atoi(row[73])); - e.formula5 = static_cast(atoi(row[74])); - e.formula6 = static_cast(atoi(row[75])); - e.formula7 = static_cast(atoi(row[76])); - e.formula8 = static_cast(atoi(row[77])); - e.formula9 = static_cast(atoi(row[78])); - e.formula10 = static_cast(atoi(row[79])); - e.formula11 = static_cast(atoi(row[80])); - e.formula12 = static_cast(atoi(row[81])); - e.LightType = static_cast(atoi(row[82])); - e.goodEffect = static_cast(atoi(row[83])); - e.Activated = static_cast(atoi(row[84])); - e.resisttype = static_cast(atoi(row[85])); - e.effectid1 = static_cast(atoi(row[86])); - e.effectid2 = static_cast(atoi(row[87])); - e.effectid3 = static_cast(atoi(row[88])); - e.effectid4 = static_cast(atoi(row[89])); - e.effectid5 = static_cast(atoi(row[90])); - e.effectid6 = static_cast(atoi(row[91])); - e.effectid7 = static_cast(atoi(row[92])); - e.effectid8 = static_cast(atoi(row[93])); - e.effectid9 = static_cast(atoi(row[94])); - e.effectid10 = static_cast(atoi(row[95])); - e.effectid11 = static_cast(atoi(row[96])); - e.effectid12 = static_cast(atoi(row[97])); - e.targettype = static_cast(atoi(row[98])); - e.basediff = static_cast(atoi(row[99])); - e.skill = static_cast(atoi(row[100])); - e.zonetype = static_cast(atoi(row[101])); - e.EnvironmentType = static_cast(atoi(row[102])); - e.TimeOfDay = static_cast(atoi(row[103])); - e.classes1 = static_cast(atoi(row[104])); - e.classes2 = static_cast(atoi(row[105])); - e.classes3 = static_cast(atoi(row[106])); - e.classes4 = static_cast(atoi(row[107])); - e.classes5 = static_cast(atoi(row[108])); - e.classes6 = static_cast(atoi(row[109])); - e.classes7 = static_cast(atoi(row[110])); - e.classes8 = static_cast(atoi(row[111])); - e.classes9 = static_cast(atoi(row[112])); - e.classes10 = static_cast(atoi(row[113])); - e.classes11 = static_cast(atoi(row[114])); - e.classes12 = static_cast(atoi(row[115])); - e.classes13 = static_cast(atoi(row[116])); - e.classes14 = static_cast(atoi(row[117])); - e.classes15 = static_cast(atoi(row[118])); - e.classes16 = static_cast(atoi(row[119])); - e.CastingAnim = static_cast(atoi(row[120])); - e.TargetAnim = static_cast(atoi(row[121])); - e.TravelType = static_cast(atoi(row[122])); - e.SpellAffectIndex = static_cast(atoi(row[123])); - e.disallow_sit = static_cast(atoi(row[124])); - e.deities0 = static_cast(atoi(row[125])); - e.deities1 = static_cast(atoi(row[126])); - e.deities2 = static_cast(atoi(row[127])); - e.deities3 = static_cast(atoi(row[128])); - e.deities4 = static_cast(atoi(row[129])); - e.deities5 = static_cast(atoi(row[130])); - e.deities6 = static_cast(atoi(row[131])); - e.deities7 = static_cast(atoi(row[132])); - e.deities8 = static_cast(atoi(row[133])); - e.deities9 = static_cast(atoi(row[134])); - e.deities10 = static_cast(atoi(row[135])); - e.deities11 = static_cast(atoi(row[136])); - e.deities12 = static_cast(atoi(row[137])); - e.deities13 = static_cast(atoi(row[138])); - e.deities14 = static_cast(atoi(row[139])); - e.deities15 = static_cast(atoi(row[140])); - e.deities16 = static_cast(atoi(row[141])); - e.field142 = static_cast(atoi(row[142])); - e.field143 = static_cast(atoi(row[143])); - e.new_icon = static_cast(atoi(row[144])); - e.spellanim = static_cast(atoi(row[145])); - e.uninterruptable = static_cast(atoi(row[146])); - e.ResistDiff = static_cast(atoi(row[147])); - e.dot_stacking_exempt = static_cast(atoi(row[148])); - e.deleteable = static_cast(atoi(row[149])); - e.RecourseLink = static_cast(atoi(row[150])); - e.no_partial_resist = static_cast(atoi(row[151])); - e.field152 = static_cast(atoi(row[152])); - e.field153 = static_cast(atoi(row[153])); - e.short_buff_box = static_cast(atoi(row[154])); - e.descnum = static_cast(atoi(row[155])); - e.typedescnum = static_cast(atoi(row[156])); - e.effectdescnum = static_cast(atoi(row[157])); - e.effectdescnum2 = static_cast(atoi(row[158])); - e.npc_no_los = static_cast(atoi(row[159])); - e.field160 = static_cast(atoi(row[160])); - e.reflectable = static_cast(atoi(row[161])); - e.bonushate = static_cast(atoi(row[162])); - e.field163 = static_cast(atoi(row[163])); - e.field164 = static_cast(atoi(row[164])); - e.ldon_trap = static_cast(atoi(row[165])); - e.EndurCost = static_cast(atoi(row[166])); - e.EndurTimerIndex = static_cast(atoi(row[167])); - e.IsDiscipline = static_cast(atoi(row[168])); - e.field169 = static_cast(atoi(row[169])); - e.field170 = static_cast(atoi(row[170])); - e.field171 = static_cast(atoi(row[171])); - e.field172 = static_cast(atoi(row[172])); - e.HateAdded = static_cast(atoi(row[173])); - e.EndurUpkeep = static_cast(atoi(row[174])); - e.numhitstype = static_cast(atoi(row[175])); - e.numhits = static_cast(atoi(row[176])); - e.pvpresistbase = static_cast(atoi(row[177])); - e.pvpresistcalc = static_cast(atoi(row[178])); - e.pvpresistcap = static_cast(atoi(row[179])); - e.spell_category = static_cast(atoi(row[180])); - e.pvp_duration = static_cast(atoi(row[181])); - e.pvp_duration_cap = static_cast(atoi(row[182])); - e.pcnpc_only_flag = static_cast(atoi(row[183])); - e.cast_not_standing = static_cast(atoi(row[184])); - e.can_mgb = static_cast(atoi(row[185])); - e.nodispell = static_cast(atoi(row[186])); - e.npc_category = static_cast(atoi(row[187])); - e.npc_usefulness = static_cast(atoi(row[188])); - e.MinResist = static_cast(atoi(row[189])); - e.MaxResist = static_cast(atoi(row[190])); - e.viral_targets = static_cast(atoi(row[191])); - e.viral_timer = static_cast(atoi(row[192])); - e.nimbuseffect = static_cast(atoi(row[193])); - e.ConeStartAngle = static_cast(atoi(row[194])); - e.ConeStopAngle = static_cast(atoi(row[195])); - e.sneaking = static_cast(atoi(row[196])); - e.not_extendable = static_cast(atoi(row[197])); - e.field198 = static_cast(atoi(row[198])); - e.field199 = static_cast(atoi(row[199])); - e.suspendable = static_cast(atoi(row[200])); - e.viral_range = static_cast(atoi(row[201])); - e.songcap = static_cast(atoi(row[202])); - e.field203 = static_cast(atoi(row[203])); - e.field204 = static_cast(atoi(row[204])); - e.no_block = static_cast(atoi(row[205])); - e.field206 = static_cast(atoi(row[206])); - e.spellgroup = static_cast(atoi(row[207])); - e.rank = static_cast(atoi(row[208])); - e.field209 = static_cast(atoi(row[209])); - e.field210 = static_cast(atoi(row[210])); - e.CastRestriction = static_cast(atoi(row[211])); - e.allowrest = static_cast(atoi(row[212])); - e.InCombat = static_cast(atoi(row[213])); - e.OutofCombat = static_cast(atoi(row[214])); - e.field215 = static_cast(atoi(row[215])); - e.field216 = static_cast(atoi(row[216])); - e.field217 = static_cast(atoi(row[217])); - e.aemaxtargets = static_cast(atoi(row[218])); - e.maxtargets = static_cast(atoi(row[219])); - e.field220 = static_cast(atoi(row[220])); - e.field221 = static_cast(atoi(row[221])); - e.field222 = static_cast(atoi(row[222])); - e.field223 = static_cast(atoi(row[223])); - e.persistdeath = static_cast(atoi(row[224])); - e.field225 = static_cast(atoi(row[225])); - e.field226 = static_cast(atoi(row[226])); + e.range_ = row[9] ? static_cast(atoi(row[9])) : 100; + e.aoerange = row[10] ? static_cast(atoi(row[10])) : 0; + e.pushback = row[11] ? static_cast(atoi(row[11])) : 0; + e.pushup = row[12] ? static_cast(atoi(row[12])) : 0; + e.cast_time = row[13] ? static_cast(atoi(row[13])) : 0; + e.recovery_time = row[14] ? static_cast(atoi(row[14])) : 0; + e.recast_time = row[15] ? static_cast(atoi(row[15])) : 0; + e.buffdurationformula = row[16] ? static_cast(atoi(row[16])) : 7; + e.buffduration = row[17] ? static_cast(atoi(row[17])) : 65; + e.AEDuration = row[18] ? static_cast(atoi(row[18])) : 0; + e.mana = row[19] ? static_cast(atoi(row[19])) : 0; + e.effect_base_value1 = row[20] ? static_cast(atoi(row[20])) : 100; + e.effect_base_value2 = row[21] ? static_cast(atoi(row[21])) : 0; + e.effect_base_value3 = row[22] ? static_cast(atoi(row[22])) : 0; + e.effect_base_value4 = row[23] ? static_cast(atoi(row[23])) : 0; + e.effect_base_value5 = row[24] ? static_cast(atoi(row[24])) : 0; + e.effect_base_value6 = row[25] ? static_cast(atoi(row[25])) : 0; + e.effect_base_value7 = row[26] ? static_cast(atoi(row[26])) : 0; + e.effect_base_value8 = row[27] ? static_cast(atoi(row[27])) : 0; + e.effect_base_value9 = row[28] ? static_cast(atoi(row[28])) : 0; + e.effect_base_value10 = row[29] ? static_cast(atoi(row[29])) : 0; + e.effect_base_value11 = row[30] ? static_cast(atoi(row[30])) : 0; + e.effect_base_value12 = row[31] ? static_cast(atoi(row[31])) : 0; + e.effect_limit_value1 = row[32] ? static_cast(atoi(row[32])) : 0; + e.effect_limit_value2 = row[33] ? static_cast(atoi(row[33])) : 0; + e.effect_limit_value3 = row[34] ? static_cast(atoi(row[34])) : 0; + e.effect_limit_value4 = row[35] ? static_cast(atoi(row[35])) : 0; + e.effect_limit_value5 = row[36] ? static_cast(atoi(row[36])) : 0; + e.effect_limit_value6 = row[37] ? static_cast(atoi(row[37])) : 0; + e.effect_limit_value7 = row[38] ? static_cast(atoi(row[38])) : 0; + e.effect_limit_value8 = row[39] ? static_cast(atoi(row[39])) : 0; + e.effect_limit_value9 = row[40] ? static_cast(atoi(row[40])) : 0; + e.effect_limit_value10 = row[41] ? static_cast(atoi(row[41])) : 0; + e.effect_limit_value11 = row[42] ? static_cast(atoi(row[42])) : 0; + e.effect_limit_value12 = row[43] ? static_cast(atoi(row[43])) : 0; + e.max1 = row[44] ? static_cast(atoi(row[44])) : 0; + e.max2 = row[45] ? static_cast(atoi(row[45])) : 0; + e.max3 = row[46] ? static_cast(atoi(row[46])) : 0; + e.max4 = row[47] ? static_cast(atoi(row[47])) : 0; + e.max5 = row[48] ? static_cast(atoi(row[48])) : 0; + e.max6 = row[49] ? static_cast(atoi(row[49])) : 0; + e.max7 = row[50] ? static_cast(atoi(row[50])) : 0; + e.max8 = row[51] ? static_cast(atoi(row[51])) : 0; + e.max9 = row[52] ? static_cast(atoi(row[52])) : 0; + e.max10 = row[53] ? static_cast(atoi(row[53])) : 0; + e.max11 = row[54] ? static_cast(atoi(row[54])) : 0; + e.max12 = row[55] ? static_cast(atoi(row[55])) : 0; + e.icon = row[56] ? static_cast(atoi(row[56])) : 0; + e.memicon = row[57] ? static_cast(atoi(row[57])) : 0; + e.components1 = row[58] ? static_cast(atoi(row[58])) : -1; + e.components2 = row[59] ? static_cast(atoi(row[59])) : -1; + e.components3 = row[60] ? static_cast(atoi(row[60])) : -1; + e.components4 = row[61] ? static_cast(atoi(row[61])) : -1; + e.component_counts1 = row[62] ? static_cast(atoi(row[62])) : 1; + e.component_counts2 = row[63] ? static_cast(atoi(row[63])) : 1; + e.component_counts3 = row[64] ? static_cast(atoi(row[64])) : 1; + e.component_counts4 = row[65] ? static_cast(atoi(row[65])) : 1; + e.NoexpendReagent1 = row[66] ? static_cast(atoi(row[66])) : -1; + e.NoexpendReagent2 = row[67] ? static_cast(atoi(row[67])) : -1; + e.NoexpendReagent3 = row[68] ? static_cast(atoi(row[68])) : -1; + e.NoexpendReagent4 = row[69] ? static_cast(atoi(row[69])) : -1; + e.formula1 = row[70] ? static_cast(atoi(row[70])) : 100; + e.formula2 = row[71] ? static_cast(atoi(row[71])) : 100; + e.formula3 = row[72] ? static_cast(atoi(row[72])) : 100; + e.formula4 = row[73] ? static_cast(atoi(row[73])) : 100; + e.formula5 = row[74] ? static_cast(atoi(row[74])) : 100; + e.formula6 = row[75] ? static_cast(atoi(row[75])) : 100; + e.formula7 = row[76] ? static_cast(atoi(row[76])) : 100; + e.formula8 = row[77] ? static_cast(atoi(row[77])) : 100; + e.formula9 = row[78] ? static_cast(atoi(row[78])) : 100; + e.formula10 = row[79] ? static_cast(atoi(row[79])) : 100; + e.formula11 = row[80] ? static_cast(atoi(row[80])) : 100; + e.formula12 = row[81] ? static_cast(atoi(row[81])) : 100; + e.LightType = row[82] ? static_cast(atoi(row[82])) : 0; + e.goodEffect = row[83] ? static_cast(atoi(row[83])) : 0; + e.Activated = row[84] ? static_cast(atoi(row[84])) : 0; + e.resisttype = row[85] ? static_cast(atoi(row[85])) : 0; + e.effectid1 = row[86] ? static_cast(atoi(row[86])) : 254; + e.effectid2 = row[87] ? static_cast(atoi(row[87])) : 254; + e.effectid3 = row[88] ? static_cast(atoi(row[88])) : 254; + e.effectid4 = row[89] ? static_cast(atoi(row[89])) : 254; + e.effectid5 = row[90] ? static_cast(atoi(row[90])) : 254; + e.effectid6 = row[91] ? static_cast(atoi(row[91])) : 254; + e.effectid7 = row[92] ? static_cast(atoi(row[92])) : 254; + e.effectid8 = row[93] ? static_cast(atoi(row[93])) : 254; + e.effectid9 = row[94] ? static_cast(atoi(row[94])) : 254; + e.effectid10 = row[95] ? static_cast(atoi(row[95])) : 254; + e.effectid11 = row[96] ? static_cast(atoi(row[96])) : 254; + e.effectid12 = row[97] ? static_cast(atoi(row[97])) : 254; + e.targettype = row[98] ? static_cast(atoi(row[98])) : 2; + e.basediff = row[99] ? static_cast(atoi(row[99])) : 0; + e.skill = row[100] ? static_cast(atoi(row[100])) : 98; + e.zonetype = row[101] ? static_cast(atoi(row[101])) : -1; + e.EnvironmentType = row[102] ? static_cast(atoi(row[102])) : 0; + e.TimeOfDay = row[103] ? static_cast(atoi(row[103])) : 0; + e.classes1 = row[104] ? static_cast(atoi(row[104])) : 255; + e.classes2 = row[105] ? static_cast(atoi(row[105])) : 255; + e.classes3 = row[106] ? static_cast(atoi(row[106])) : 255; + e.classes4 = row[107] ? static_cast(atoi(row[107])) : 255; + e.classes5 = row[108] ? static_cast(atoi(row[108])) : 255; + e.classes6 = row[109] ? static_cast(atoi(row[109])) : 255; + e.classes7 = row[110] ? static_cast(atoi(row[110])) : 255; + e.classes8 = row[111] ? static_cast(atoi(row[111])) : 255; + e.classes9 = row[112] ? static_cast(atoi(row[112])) : 255; + e.classes10 = row[113] ? static_cast(atoi(row[113])) : 255; + e.classes11 = row[114] ? static_cast(atoi(row[114])) : 255; + e.classes12 = row[115] ? static_cast(atoi(row[115])) : 255; + e.classes13 = row[116] ? static_cast(atoi(row[116])) : 255; + e.classes14 = row[117] ? static_cast(atoi(row[117])) : 255; + e.classes15 = row[118] ? static_cast(atoi(row[118])) : 255; + e.classes16 = row[119] ? static_cast(atoi(row[119])) : 255; + e.CastingAnim = row[120] ? static_cast(atoi(row[120])) : 44; + e.TargetAnim = row[121] ? static_cast(atoi(row[121])) : 13; + e.TravelType = row[122] ? static_cast(atoi(row[122])) : 0; + e.SpellAffectIndex = row[123] ? static_cast(atoi(row[123])) : -1; + e.disallow_sit = row[124] ? static_cast(atoi(row[124])) : 0; + e.deities0 = row[125] ? static_cast(atoi(row[125])) : 0; + e.deities1 = row[126] ? static_cast(atoi(row[126])) : 0; + e.deities2 = row[127] ? static_cast(atoi(row[127])) : 0; + e.deities3 = row[128] ? static_cast(atoi(row[128])) : 0; + e.deities4 = row[129] ? static_cast(atoi(row[129])) : 0; + e.deities5 = row[130] ? static_cast(atoi(row[130])) : 0; + e.deities6 = row[131] ? static_cast(atoi(row[131])) : 0; + e.deities7 = row[132] ? static_cast(atoi(row[132])) : 0; + e.deities8 = row[133] ? static_cast(atoi(row[133])) : 0; + e.deities9 = row[134] ? static_cast(atoi(row[134])) : 0; + e.deities10 = row[135] ? static_cast(atoi(row[135])) : 0; + e.deities11 = row[136] ? static_cast(atoi(row[136])) : 0; + e.deities12 = row[137] ? static_cast(atoi(row[137])) : 0; + e.deities13 = row[138] ? static_cast(atoi(row[138])) : 0; + e.deities14 = row[139] ? static_cast(atoi(row[139])) : 0; + e.deities15 = row[140] ? static_cast(atoi(row[140])) : 0; + e.deities16 = row[141] ? static_cast(atoi(row[141])) : 0; + e.field142 = row[142] ? static_cast(atoi(row[142])) : 100; + e.field143 = row[143] ? static_cast(atoi(row[143])) : 0; + e.new_icon = row[144] ? static_cast(atoi(row[144])) : 161; + e.spellanim = row[145] ? static_cast(atoi(row[145])) : 0; + e.uninterruptable = row[146] ? static_cast(atoi(row[146])) : 0; + e.ResistDiff = row[147] ? static_cast(atoi(row[147])) : -150; + e.dot_stacking_exempt = row[148] ? static_cast(atoi(row[148])) : 0; + e.deleteable = row[149] ? static_cast(atoi(row[149])) : 0; + e.RecourseLink = row[150] ? static_cast(atoi(row[150])) : 0; + e.no_partial_resist = row[151] ? static_cast(atoi(row[151])) : 0; + e.field152 = row[152] ? static_cast(atoi(row[152])) : 0; + e.field153 = row[153] ? static_cast(atoi(row[153])) : 0; + e.short_buff_box = row[154] ? static_cast(atoi(row[154])) : -1; + e.descnum = row[155] ? static_cast(atoi(row[155])) : 0; + e.typedescnum = row[156] ? static_cast(atoi(row[156])) : 0; + e.effectdescnum = row[157] ? static_cast(atoi(row[157])) : 0; + e.effectdescnum2 = row[158] ? static_cast(atoi(row[158])) : 0; + e.npc_no_los = row[159] ? static_cast(atoi(row[159])) : 0; + e.field160 = row[160] ? static_cast(atoi(row[160])) : 0; + e.reflectable = row[161] ? static_cast(atoi(row[161])) : 0; + e.bonushate = row[162] ? static_cast(atoi(row[162])) : 0; + e.field163 = row[163] ? static_cast(atoi(row[163])) : 100; + e.field164 = row[164] ? static_cast(atoi(row[164])) : -150; + e.ldon_trap = row[165] ? static_cast(atoi(row[165])) : 0; + e.EndurCost = row[166] ? static_cast(atoi(row[166])) : 0; + e.EndurTimerIndex = row[167] ? static_cast(atoi(row[167])) : 0; + e.IsDiscipline = row[168] ? static_cast(atoi(row[168])) : 0; + e.field169 = row[169] ? static_cast(atoi(row[169])) : 0; + e.field170 = row[170] ? static_cast(atoi(row[170])) : 0; + e.field171 = row[171] ? static_cast(atoi(row[171])) : 0; + e.field172 = row[172] ? static_cast(atoi(row[172])) : 0; + e.HateAdded = row[173] ? static_cast(atoi(row[173])) : 0; + e.EndurUpkeep = row[174] ? static_cast(atoi(row[174])) : 0; + e.numhitstype = row[175] ? static_cast(atoi(row[175])) : 0; + e.numhits = row[176] ? static_cast(atoi(row[176])) : 0; + e.pvpresistbase = row[177] ? static_cast(atoi(row[177])) : -150; + e.pvpresistcalc = row[178] ? static_cast(atoi(row[178])) : 100; + e.pvpresistcap = row[179] ? static_cast(atoi(row[179])) : -150; + e.spell_category = row[180] ? static_cast(atoi(row[180])) : -99; + e.pvp_duration = row[181] ? static_cast(atoi(row[181])) : 0; + e.pvp_duration_cap = row[182] ? static_cast(atoi(row[182])) : 0; + e.pcnpc_only_flag = row[183] ? static_cast(atoi(row[183])) : 0; + e.cast_not_standing = row[184] ? static_cast(atoi(row[184])) : 0; + e.can_mgb = row[185] ? static_cast(atoi(row[185])) : 0; + e.nodispell = row[186] ? static_cast(atoi(row[186])) : -1; + e.npc_category = row[187] ? static_cast(atoi(row[187])) : 0; + e.npc_usefulness = row[188] ? static_cast(atoi(row[188])) : 0; + e.MinResist = row[189] ? static_cast(atoi(row[189])) : 0; + e.MaxResist = row[190] ? static_cast(atoi(row[190])) : 0; + e.viral_targets = row[191] ? static_cast(atoi(row[191])) : 0; + e.viral_timer = row[192] ? static_cast(atoi(row[192])) : 0; + e.nimbuseffect = row[193] ? static_cast(atoi(row[193])) : 0; + e.ConeStartAngle = row[194] ? static_cast(atoi(row[194])) : 0; + e.ConeStopAngle = row[195] ? static_cast(atoi(row[195])) : 0; + e.sneaking = row[196] ? static_cast(atoi(row[196])) : 0; + e.not_extendable = row[197] ? static_cast(atoi(row[197])) : 0; + e.field198 = row[198] ? static_cast(atoi(row[198])) : 0; + e.field199 = row[199] ? static_cast(atoi(row[199])) : 1; + e.suspendable = row[200] ? static_cast(atoi(row[200])) : 0; + e.viral_range = row[201] ? static_cast(atoi(row[201])) : 0; + e.songcap = row[202] ? static_cast(atoi(row[202])) : 0; + e.field203 = row[203] ? static_cast(atoi(row[203])) : 0; + e.field204 = row[204] ? static_cast(atoi(row[204])) : 0; + e.no_block = row[205] ? static_cast(atoi(row[205])) : 0; + e.field206 = row[206] ? static_cast(atoi(row[206])) : -1; + e.spellgroup = row[207] ? static_cast(atoi(row[207])) : 0; + e.rank = row[208] ? static_cast(atoi(row[208])) : 0; + e.field209 = row[209] ? static_cast(atoi(row[209])) : 0; + e.field210 = row[210] ? static_cast(atoi(row[210])) : 1; + e.CastRestriction = row[211] ? static_cast(atoi(row[211])) : 0; + e.allowrest = row[212] ? static_cast(atoi(row[212])) : 0; + e.InCombat = row[213] ? static_cast(atoi(row[213])) : 0; + e.OutofCombat = row[214] ? static_cast(atoi(row[214])) : 0; + e.field215 = row[215] ? static_cast(atoi(row[215])) : 0; + e.field216 = row[216] ? static_cast(atoi(row[216])) : 0; + e.field217 = row[217] ? static_cast(atoi(row[217])) : 0; + e.aemaxtargets = row[218] ? static_cast(atoi(row[218])) : 0; + e.maxtargets = row[219] ? static_cast(atoi(row[219])) : 0; + e.field220 = row[220] ? static_cast(atoi(row[220])) : 0; + e.field221 = row[221] ? static_cast(atoi(row[221])) : 0; + e.field222 = row[222] ? static_cast(atoi(row[222])) : 0; + e.field223 = row[223] ? static_cast(atoi(row[223])) : 0; + e.persistdeath = row[224] ? static_cast(atoi(row[224])) : 0; + e.field225 = row[225] ? static_cast(atoi(row[225])) : 0; + e.field226 = row[226] ? static_cast(atoi(row[226])) : 0; e.min_dist = row[227] ? strtof(row[227], nullptr) : 0; e.min_dist_mod = row[228] ? strtof(row[228], nullptr) : 0; e.max_dist = row[229] ? strtof(row[229], nullptr) : 0; e.max_dist_mod = row[230] ? strtof(row[230], nullptr) : 0; - e.min_range = static_cast(atoi(row[231])); - e.field232 = static_cast(atoi(row[232])); - e.field233 = static_cast(atoi(row[233])); - e.field234 = static_cast(atoi(row[234])); - e.field235 = static_cast(atoi(row[235])); - e.field236 = static_cast(atoi(row[236])); + e.min_range = row[231] ? static_cast(atoi(row[231])) : 0; + e.field232 = row[232] ? static_cast(atoi(row[232])) : 0; + e.field233 = row[233] ? static_cast(atoi(row[233])) : 0; + e.field234 = row[234] ? static_cast(atoi(row[234])) : 0; + e.field235 = row[235] ? static_cast(atoi(row[235])) : 0; + e.field236 = row[236] ? static_cast(atoi(row[236])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_start_zones_repository.h b/common/repositories/base/base_start_zones_repository.h index df54438ee..54344e685 100644 --- a/common/repositories/base/base_start_zones_repository.h +++ b/common/repositories/base/base_start_zones_repository.h @@ -191,19 +191,19 @@ public: e.y = row[1] ? strtof(row[1], nullptr) : 0; e.z = row[2] ? strtof(row[2], nullptr) : 0; e.heading = row[3] ? strtof(row[3], nullptr) : 0; - e.zone_id = static_cast(atoi(row[4])); - e.bind_id = static_cast(atoi(row[5])); - e.player_choice = static_cast(atoi(row[6])); - e.player_class = static_cast(atoi(row[7])); - e.player_deity = static_cast(atoi(row[8])); - e.player_race = static_cast(atoi(row[9])); - e.start_zone = static_cast(atoi(row[10])); + e.zone_id = row[4] ? static_cast(atoi(row[4])) : 0; + e.bind_id = row[5] ? static_cast(atoi(row[5])) : 0; + e.player_choice = row[6] ? static_cast(atoi(row[6])) : 0; + e.player_class = row[7] ? static_cast(atoi(row[7])) : 0; + e.player_deity = row[8] ? static_cast(atoi(row[8])) : 0; + e.player_race = row[9] ? static_cast(atoi(row[9])) : 0; + e.start_zone = row[10] ? static_cast(atoi(row[10])) : 0; e.bind_x = row[11] ? strtof(row[11], nullptr) : 0; e.bind_y = row[12] ? strtof(row[12], nullptr) : 0; e.bind_z = row[13] ? strtof(row[13], nullptr) : 0; e.select_rank = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 50; - e.min_expansion = static_cast(atoi(row[15])); - e.max_expansion = static_cast(atoi(row[16])); + e.min_expansion = row[15] ? static_cast(atoi(row[15])) : -1; + e.max_expansion = row[16] ? static_cast(atoi(row[16])) : -1; e.content_flags = row[17] ? row[17] : ""; e.content_flags_disabled = row[18] ? row[18] : ""; @@ -383,19 +383,19 @@ public: e.y = row[1] ? strtof(row[1], nullptr) : 0; e.z = row[2] ? strtof(row[2], nullptr) : 0; e.heading = row[3] ? strtof(row[3], nullptr) : 0; - e.zone_id = static_cast(atoi(row[4])); - e.bind_id = static_cast(atoi(row[5])); - e.player_choice = static_cast(atoi(row[6])); - e.player_class = static_cast(atoi(row[7])); - e.player_deity = static_cast(atoi(row[8])); - e.player_race = static_cast(atoi(row[9])); - e.start_zone = static_cast(atoi(row[10])); + e.zone_id = row[4] ? static_cast(atoi(row[4])) : 0; + e.bind_id = row[5] ? static_cast(atoi(row[5])) : 0; + e.player_choice = row[6] ? static_cast(atoi(row[6])) : 0; + e.player_class = row[7] ? static_cast(atoi(row[7])) : 0; + e.player_deity = row[8] ? static_cast(atoi(row[8])) : 0; + e.player_race = row[9] ? static_cast(atoi(row[9])) : 0; + e.start_zone = row[10] ? static_cast(atoi(row[10])) : 0; e.bind_x = row[11] ? strtof(row[11], nullptr) : 0; e.bind_y = row[12] ? strtof(row[12], nullptr) : 0; e.bind_z = row[13] ? strtof(row[13], nullptr) : 0; e.select_rank = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 50; - e.min_expansion = static_cast(atoi(row[15])); - e.max_expansion = static_cast(atoi(row[16])); + e.min_expansion = row[15] ? static_cast(atoi(row[15])) : -1; + e.max_expansion = row[16] ? static_cast(atoi(row[16])) : -1; e.content_flags = row[17] ? row[17] : ""; e.content_flags_disabled = row[18] ? row[18] : ""; @@ -426,19 +426,19 @@ public: e.y = row[1] ? strtof(row[1], nullptr) : 0; e.z = row[2] ? strtof(row[2], nullptr) : 0; e.heading = row[3] ? strtof(row[3], nullptr) : 0; - e.zone_id = static_cast(atoi(row[4])); - e.bind_id = static_cast(atoi(row[5])); - e.player_choice = static_cast(atoi(row[6])); - e.player_class = static_cast(atoi(row[7])); - e.player_deity = static_cast(atoi(row[8])); - e.player_race = static_cast(atoi(row[9])); - e.start_zone = static_cast(atoi(row[10])); + e.zone_id = row[4] ? static_cast(atoi(row[4])) : 0; + e.bind_id = row[5] ? static_cast(atoi(row[5])) : 0; + e.player_choice = row[6] ? static_cast(atoi(row[6])) : 0; + e.player_class = row[7] ? static_cast(atoi(row[7])) : 0; + e.player_deity = row[8] ? static_cast(atoi(row[8])) : 0; + e.player_race = row[9] ? static_cast(atoi(row[9])) : 0; + e.start_zone = row[10] ? static_cast(atoi(row[10])) : 0; e.bind_x = row[11] ? strtof(row[11], nullptr) : 0; e.bind_y = row[12] ? strtof(row[12], nullptr) : 0; e.bind_z = row[13] ? strtof(row[13], nullptr) : 0; e.select_rank = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 50; - e.min_expansion = static_cast(atoi(row[15])); - e.max_expansion = static_cast(atoi(row[16])); + e.min_expansion = row[15] ? static_cast(atoi(row[15])) : -1; + e.max_expansion = row[16] ? static_cast(atoi(row[16])) : -1; e.content_flags = row[17] ? row[17] : ""; e.content_flags_disabled = row[18] ? row[18] : ""; diff --git a/common/repositories/base/base_starting_items_repository.h b/common/repositories/base/base_starting_items_repository.h index 8c48bb65e..e9899f6b8 100644 --- a/common/repositories/base/base_starting_items_repository.h +++ b/common/repositories/base/base_starting_items_repository.h @@ -170,10 +170,10 @@ public: e.zone_id_list = row[4] ? row[4] : ""; e.item_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.item_charges = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 1; - e.status = static_cast(atoi(row[7])); - e.inventory_slot = static_cast(atoi(row[8])); - e.min_expansion = static_cast(atoi(row[9])); - e.max_expansion = static_cast(atoi(row[10])); + e.status = row[7] ? static_cast(atoi(row[7])) : 0; + e.inventory_slot = row[8] ? static_cast(atoi(row[8])) : -1; + e.min_expansion = row[9] ? static_cast(atoi(row[9])) : -1; + e.max_expansion = row[10] ? static_cast(atoi(row[10])) : -1; e.content_flags = row[11] ? row[11] : ""; e.content_flags_disabled = row[12] ? row[12] : ""; @@ -337,10 +337,10 @@ public: e.zone_id_list = row[4] ? row[4] : ""; e.item_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.item_charges = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 1; - e.status = static_cast(atoi(row[7])); - e.inventory_slot = static_cast(atoi(row[8])); - e.min_expansion = static_cast(atoi(row[9])); - e.max_expansion = static_cast(atoi(row[10])); + e.status = row[7] ? static_cast(atoi(row[7])) : 0; + e.inventory_slot = row[8] ? static_cast(atoi(row[8])) : -1; + e.min_expansion = row[9] ? static_cast(atoi(row[9])) : -1; + e.max_expansion = row[10] ? static_cast(atoi(row[10])) : -1; e.content_flags = row[11] ? row[11] : ""; e.content_flags_disabled = row[12] ? row[12] : ""; @@ -374,10 +374,10 @@ public: e.zone_id_list = row[4] ? row[4] : ""; e.item_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; e.item_charges = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 1; - e.status = static_cast(atoi(row[7])); - e.inventory_slot = static_cast(atoi(row[8])); - e.min_expansion = static_cast(atoi(row[9])); - e.max_expansion = static_cast(atoi(row[10])); + e.status = row[7] ? static_cast(atoi(row[7])) : 0; + e.inventory_slot = row[8] ? static_cast(atoi(row[8])) : -1; + e.min_expansion = row[9] ? static_cast(atoi(row[9])) : -1; + e.max_expansion = row[10] ? static_cast(atoi(row[10])) : -1; e.content_flags = row[11] ? row[11] : ""; e.content_flags_disabled = row[12] ? row[12] : ""; diff --git a/common/repositories/base/base_task_activities_repository.h b/common/repositories/base/base_task_activities_repository.h index e8cb02939..b47f5b86d 100644 --- a/common/repositories/base/base_task_activities_repository.h +++ b/common/repositories/base/base_task_activities_repository.h @@ -213,28 +213,28 @@ public: e.taskid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.activityid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.req_activity_id = static_cast(atoi(row[2])); - e.step = static_cast(atoi(row[3])); + e.req_activity_id = row[2] ? static_cast(atoi(row[2])) : -1; + e.step = row[3] ? static_cast(atoi(row[3])) : 0; e.activitytype = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.target_name = row[5] ? row[5] : ""; e.goalmethod = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.goalcount = static_cast(atoi(row[7])); + e.goalcount = row[7] ? static_cast(atoi(row[7])) : 1; e.description_override = row[8] ? row[8] : ""; e.npc_match_list = row[9] ? row[9] : ""; e.item_id_list = row[10] ? row[10] : ""; e.item_list = row[11] ? row[11] : ""; - e.dz_switch_id = static_cast(atoi(row[12])); + e.dz_switch_id = row[12] ? static_cast(atoi(row[12])) : 0; e.min_x = row[13] ? strtof(row[13], nullptr) : 0; e.min_y = row[14] ? strtof(row[14], nullptr) : 0; e.min_z = row[15] ? strtof(row[15], nullptr) : 0; e.max_x = row[16] ? strtof(row[16], nullptr) : 0; e.max_y = row[17] ? strtof(row[17], nullptr) : 0; e.max_z = row[18] ? strtof(row[18], nullptr) : 0; - e.skill_list = row[19] ? row[19] : ""; - e.spell_list = row[20] ? row[20] : ""; + e.skill_list = row[19] ? row[19] : "-1"; + e.spell_list = row[20] ? row[20] : "0"; e.zones = row[21] ? row[21] : ""; - e.zone_version = static_cast(atoi(row[22])); - e.optional = static_cast(atoi(row[23])); + e.zone_version = row[22] ? static_cast(atoi(row[22])) : -1; + e.optional = row[23] ? static_cast(atoi(row[23])) : 0; e.list_group = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; return e; @@ -429,28 +429,28 @@ public: e.taskid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.activityid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.req_activity_id = static_cast(atoi(row[2])); - e.step = static_cast(atoi(row[3])); + e.req_activity_id = row[2] ? static_cast(atoi(row[2])) : -1; + e.step = row[3] ? static_cast(atoi(row[3])) : 0; e.activitytype = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.target_name = row[5] ? row[5] : ""; e.goalmethod = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.goalcount = static_cast(atoi(row[7])); + e.goalcount = row[7] ? static_cast(atoi(row[7])) : 1; e.description_override = row[8] ? row[8] : ""; e.npc_match_list = row[9] ? row[9] : ""; e.item_id_list = row[10] ? row[10] : ""; e.item_list = row[11] ? row[11] : ""; - e.dz_switch_id = static_cast(atoi(row[12])); + e.dz_switch_id = row[12] ? static_cast(atoi(row[12])) : 0; e.min_x = row[13] ? strtof(row[13], nullptr) : 0; e.min_y = row[14] ? strtof(row[14], nullptr) : 0; e.min_z = row[15] ? strtof(row[15], nullptr) : 0; e.max_x = row[16] ? strtof(row[16], nullptr) : 0; e.max_y = row[17] ? strtof(row[17], nullptr) : 0; e.max_z = row[18] ? strtof(row[18], nullptr) : 0; - e.skill_list = row[19] ? row[19] : ""; - e.spell_list = row[20] ? row[20] : ""; + e.skill_list = row[19] ? row[19] : "-1"; + e.spell_list = row[20] ? row[20] : "0"; e.zones = row[21] ? row[21] : ""; - e.zone_version = static_cast(atoi(row[22])); - e.optional = static_cast(atoi(row[23])); + e.zone_version = row[22] ? static_cast(atoi(row[22])) : -1; + e.optional = row[23] ? static_cast(atoi(row[23])) : 0; e.list_group = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; all_entries.push_back(e); @@ -478,28 +478,28 @@ public: e.taskid = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.activityid = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.req_activity_id = static_cast(atoi(row[2])); - e.step = static_cast(atoi(row[3])); + e.req_activity_id = row[2] ? static_cast(atoi(row[2])) : -1; + e.step = row[3] ? static_cast(atoi(row[3])) : 0; e.activitytype = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.target_name = row[5] ? row[5] : ""; e.goalmethod = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.goalcount = static_cast(atoi(row[7])); + e.goalcount = row[7] ? static_cast(atoi(row[7])) : 1; e.description_override = row[8] ? row[8] : ""; e.npc_match_list = row[9] ? row[9] : ""; e.item_id_list = row[10] ? row[10] : ""; e.item_list = row[11] ? row[11] : ""; - e.dz_switch_id = static_cast(atoi(row[12])); + e.dz_switch_id = row[12] ? static_cast(atoi(row[12])) : 0; e.min_x = row[13] ? strtof(row[13], nullptr) : 0; e.min_y = row[14] ? strtof(row[14], nullptr) : 0; e.min_z = row[15] ? strtof(row[15], nullptr) : 0; e.max_x = row[16] ? strtof(row[16], nullptr) : 0; e.max_y = row[17] ? strtof(row[17], nullptr) : 0; e.max_z = row[18] ? strtof(row[18], nullptr) : 0; - e.skill_list = row[19] ? row[19] : ""; - e.spell_list = row[20] ? row[20] : ""; + e.skill_list = row[19] ? row[19] : "-1"; + e.spell_list = row[20] ? row[20] : "0"; e.zones = row[21] ? row[21] : ""; - e.zone_version = static_cast(atoi(row[22])); - e.optional = static_cast(atoi(row[23])); + e.zone_version = row[22] ? static_cast(atoi(row[22])) : -1; + e.optional = row[23] ? static_cast(atoi(row[23])) : 0; e.list_group = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; all_entries.push_back(e); diff --git a/common/repositories/base/base_tasks_repository.h b/common/repositories/base/base_tasks_repository.h index 847125020..d1a30f711 100644 --- a/common/repositories/base/base_tasks_repository.h +++ b/common/repositories/base/base_tasks_repository.h @@ -228,34 +228,34 @@ public: Tasks e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[1])); + e.type = row[1] ? static_cast(atoi(row[1])) : 0; e.duration = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.duration_code = static_cast(atoi(row[3])); + e.duration_code = row[3] ? static_cast(atoi(row[3])) : 0; e.title = row[4] ? row[4] : ""; e.description = row[5] ? row[5] : ""; e.reward_text = row[6] ? row[6] : ""; e.reward_id_list = row[7] ? row[7] : ""; e.cash_reward = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.exp_reward = static_cast(atoi(row[9])); + e.exp_reward = row[9] ? static_cast(atoi(row[9])) : 0; e.reward_method = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.reward_points = static_cast(atoi(row[11])); - e.reward_point_type = static_cast(atoi(row[12])); + e.reward_points = row[11] ? static_cast(atoi(row[11])) : 0; + e.reward_point_type = row[12] ? static_cast(atoi(row[12])) : 0; e.min_level = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.max_level = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.level_spread = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.min_players = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.max_players = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; e.repeatable = row[18] ? static_cast(strtoul(row[18], nullptr, 10)) : 1; - e.faction_reward = static_cast(atoi(row[19])); + e.faction_reward = row[19] ? static_cast(atoi(row[19])) : 0; e.completion_emote = row[20] ? row[20] : ""; e.replay_timer_group = row[21] ? static_cast(strtoul(row[21], nullptr, 10)) : 0; e.replay_timer_seconds = row[22] ? static_cast(strtoul(row[22], nullptr, 10)) : 0; e.request_timer_group = row[23] ? static_cast(strtoul(row[23], nullptr, 10)) : 0; e.request_timer_seconds = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; e.dz_template_id = row[25] ? static_cast(strtoul(row[25], nullptr, 10)) : 0; - e.lock_activity_id = static_cast(atoi(row[26])); - e.faction_amount = static_cast(atoi(row[27])); - e.enabled = static_cast(atoi(row[28])); + e.lock_activity_id = row[26] ? static_cast(atoi(row[26])) : -1; + e.faction_amount = row[27] ? static_cast(atoi(row[27])) : 0; + e.enabled = row[28] ? static_cast(atoi(row[28])) : 1; return e; } @@ -460,34 +460,34 @@ public: Tasks e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[1])); + e.type = row[1] ? static_cast(atoi(row[1])) : 0; e.duration = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.duration_code = static_cast(atoi(row[3])); + e.duration_code = row[3] ? static_cast(atoi(row[3])) : 0; e.title = row[4] ? row[4] : ""; e.description = row[5] ? row[5] : ""; e.reward_text = row[6] ? row[6] : ""; e.reward_id_list = row[7] ? row[7] : ""; e.cash_reward = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.exp_reward = static_cast(atoi(row[9])); + e.exp_reward = row[9] ? static_cast(atoi(row[9])) : 0; e.reward_method = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.reward_points = static_cast(atoi(row[11])); - e.reward_point_type = static_cast(atoi(row[12])); + e.reward_points = row[11] ? static_cast(atoi(row[11])) : 0; + e.reward_point_type = row[12] ? static_cast(atoi(row[12])) : 0; e.min_level = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.max_level = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.level_spread = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.min_players = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.max_players = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; e.repeatable = row[18] ? static_cast(strtoul(row[18], nullptr, 10)) : 1; - e.faction_reward = static_cast(atoi(row[19])); + e.faction_reward = row[19] ? static_cast(atoi(row[19])) : 0; e.completion_emote = row[20] ? row[20] : ""; e.replay_timer_group = row[21] ? static_cast(strtoul(row[21], nullptr, 10)) : 0; e.replay_timer_seconds = row[22] ? static_cast(strtoul(row[22], nullptr, 10)) : 0; e.request_timer_group = row[23] ? static_cast(strtoul(row[23], nullptr, 10)) : 0; e.request_timer_seconds = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; e.dz_template_id = row[25] ? static_cast(strtoul(row[25], nullptr, 10)) : 0; - e.lock_activity_id = static_cast(atoi(row[26])); - e.faction_amount = static_cast(atoi(row[27])); - e.enabled = static_cast(atoi(row[28])); + e.lock_activity_id = row[26] ? static_cast(atoi(row[26])) : -1; + e.faction_amount = row[27] ? static_cast(atoi(row[27])) : 0; + e.enabled = row[28] ? static_cast(atoi(row[28])) : 1; all_entries.push_back(e); } @@ -513,34 +513,34 @@ public: Tasks e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.type = static_cast(atoi(row[1])); + e.type = row[1] ? static_cast(atoi(row[1])) : 0; e.duration = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.duration_code = static_cast(atoi(row[3])); + e.duration_code = row[3] ? static_cast(atoi(row[3])) : 0; e.title = row[4] ? row[4] : ""; e.description = row[5] ? row[5] : ""; e.reward_text = row[6] ? row[6] : ""; e.reward_id_list = row[7] ? row[7] : ""; e.cash_reward = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.exp_reward = static_cast(atoi(row[9])); + e.exp_reward = row[9] ? static_cast(atoi(row[9])) : 0; e.reward_method = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.reward_points = static_cast(atoi(row[11])); - e.reward_point_type = static_cast(atoi(row[12])); + e.reward_points = row[11] ? static_cast(atoi(row[11])) : 0; + e.reward_point_type = row[12] ? static_cast(atoi(row[12])) : 0; e.min_level = row[13] ? static_cast(strtoul(row[13], nullptr, 10)) : 0; e.max_level = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.level_spread = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 0; e.min_players = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; e.max_players = row[17] ? static_cast(strtoul(row[17], nullptr, 10)) : 0; e.repeatable = row[18] ? static_cast(strtoul(row[18], nullptr, 10)) : 1; - e.faction_reward = static_cast(atoi(row[19])); + e.faction_reward = row[19] ? static_cast(atoi(row[19])) : 0; e.completion_emote = row[20] ? row[20] : ""; e.replay_timer_group = row[21] ? static_cast(strtoul(row[21], nullptr, 10)) : 0; e.replay_timer_seconds = row[22] ? static_cast(strtoul(row[22], nullptr, 10)) : 0; e.request_timer_group = row[23] ? static_cast(strtoul(row[23], nullptr, 10)) : 0; e.request_timer_seconds = row[24] ? static_cast(strtoul(row[24], nullptr, 10)) : 0; e.dz_template_id = row[25] ? static_cast(strtoul(row[25], nullptr, 10)) : 0; - e.lock_activity_id = static_cast(atoi(row[26])); - e.faction_amount = static_cast(atoi(row[27])); - e.enabled = static_cast(atoi(row[28])); + e.lock_activity_id = row[26] ? static_cast(atoi(row[26])) : -1; + e.faction_amount = row[27] ? static_cast(atoi(row[27])) : 0; + e.enabled = row[28] ? static_cast(atoi(row[28])) : 1; all_entries.push_back(e); } diff --git a/common/repositories/base/base_timers_repository.h b/common/repositories/base/base_timers_repository.h index 4883acf4e..bcf2efbd9 100644 --- a/common/repositories/base/base_timers_repository.h +++ b/common/repositories/base/base_timers_repository.h @@ -131,11 +131,11 @@ public: if (results.RowCount() == 1) { Timers e{}; - e.char_id = static_cast(atoi(row[0])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; e.type = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.start = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.duration = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.enable = static_cast(atoi(row[4])); + e.enable = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -267,11 +267,11 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Timers e{}; - e.char_id = static_cast(atoi(row[0])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; e.type = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.start = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.duration = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.enable = static_cast(atoi(row[4])); + e.enable = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -296,11 +296,11 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Timers e{}; - e.char_id = static_cast(atoi(row[0])); + e.char_id = row[0] ? static_cast(atoi(row[0])) : 0; e.type = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.start = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; e.duration = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.enable = static_cast(atoi(row[4])); + e.enable = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_titles_repository.h b/common/repositories/base/base_titles_repository.h index a939fdd73..638c711d6 100644 --- a/common/repositories/base/base_titles_repository.h +++ b/common/repositories/base/base_titles_repository.h @@ -168,19 +168,19 @@ public: Titles e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.skill_id = static_cast(atoi(row[1])); - e.min_skill_value = static_cast(atoi(row[2])); - e.max_skill_value = static_cast(atoi(row[3])); - e.min_aa_points = static_cast(atoi(row[4])); - e.max_aa_points = static_cast(atoi(row[5])); - e.class_ = static_cast(atoi(row[6])); - e.gender = static_cast(atoi(row[7])); - e.char_id = static_cast(atoi(row[8])); - e.status = static_cast(atoi(row[9])); - e.item_id = static_cast(atoi(row[10])); + e.skill_id = row[1] ? static_cast(atoi(row[1])) : -1; + e.min_skill_value = row[2] ? static_cast(atoi(row[2])) : -1; + e.max_skill_value = row[3] ? static_cast(atoi(row[3])) : -1; + e.min_aa_points = row[4] ? static_cast(atoi(row[4])) : -1; + e.max_aa_points = row[5] ? static_cast(atoi(row[5])) : -1; + e.class_ = row[6] ? static_cast(atoi(row[6])) : -1; + e.gender = row[7] ? static_cast(atoi(row[7])) : -1; + e.char_id = row[8] ? static_cast(atoi(row[8])) : -1; + e.status = row[9] ? static_cast(atoi(row[9])) : -1; + e.item_id = row[10] ? static_cast(atoi(row[10])) : -1; e.prefix = row[11] ? row[11] : ""; e.suffix = row[12] ? row[12] : ""; - e.title_set = static_cast(atoi(row[13])); + e.title_set = row[13] ? static_cast(atoi(row[13])) : 0; return e; } @@ -339,19 +339,19 @@ public: Titles e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.skill_id = static_cast(atoi(row[1])); - e.min_skill_value = static_cast(atoi(row[2])); - e.max_skill_value = static_cast(atoi(row[3])); - e.min_aa_points = static_cast(atoi(row[4])); - e.max_aa_points = static_cast(atoi(row[5])); - e.class_ = static_cast(atoi(row[6])); - e.gender = static_cast(atoi(row[7])); - e.char_id = static_cast(atoi(row[8])); - e.status = static_cast(atoi(row[9])); - e.item_id = static_cast(atoi(row[10])); + e.skill_id = row[1] ? static_cast(atoi(row[1])) : -1; + e.min_skill_value = row[2] ? static_cast(atoi(row[2])) : -1; + e.max_skill_value = row[3] ? static_cast(atoi(row[3])) : -1; + e.min_aa_points = row[4] ? static_cast(atoi(row[4])) : -1; + e.max_aa_points = row[5] ? static_cast(atoi(row[5])) : -1; + e.class_ = row[6] ? static_cast(atoi(row[6])) : -1; + e.gender = row[7] ? static_cast(atoi(row[7])) : -1; + e.char_id = row[8] ? static_cast(atoi(row[8])) : -1; + e.status = row[9] ? static_cast(atoi(row[9])) : -1; + e.item_id = row[10] ? static_cast(atoi(row[10])) : -1; e.prefix = row[11] ? row[11] : ""; e.suffix = row[12] ? row[12] : ""; - e.title_set = static_cast(atoi(row[13])); + e.title_set = row[13] ? static_cast(atoi(row[13])) : 0; all_entries.push_back(e); } @@ -377,19 +377,19 @@ public: Titles e{}; e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.skill_id = static_cast(atoi(row[1])); - e.min_skill_value = static_cast(atoi(row[2])); - e.max_skill_value = static_cast(atoi(row[3])); - e.min_aa_points = static_cast(atoi(row[4])); - e.max_aa_points = static_cast(atoi(row[5])); - e.class_ = static_cast(atoi(row[6])); - e.gender = static_cast(atoi(row[7])); - e.char_id = static_cast(atoi(row[8])); - e.status = static_cast(atoi(row[9])); - e.item_id = static_cast(atoi(row[10])); + e.skill_id = row[1] ? static_cast(atoi(row[1])) : -1; + e.min_skill_value = row[2] ? static_cast(atoi(row[2])) : -1; + e.max_skill_value = row[3] ? static_cast(atoi(row[3])) : -1; + e.min_aa_points = row[4] ? static_cast(atoi(row[4])) : -1; + e.max_aa_points = row[5] ? static_cast(atoi(row[5])) : -1; + e.class_ = row[6] ? static_cast(atoi(row[6])) : -1; + e.gender = row[7] ? static_cast(atoi(row[7])) : -1; + e.char_id = row[8] ? static_cast(atoi(row[8])) : -1; + e.status = row[9] ? static_cast(atoi(row[9])) : -1; + e.item_id = row[10] ? static_cast(atoi(row[10])) : -1; e.prefix = row[11] ? row[11] : ""; e.suffix = row[12] ? row[12] : ""; - e.title_set = static_cast(atoi(row[13])); + e.title_set = row[13] ? static_cast(atoi(row[13])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_trader_repository.h b/common/repositories/base/base_trader_repository.h index c4293ed3f..4bd23b9aa 100644 --- a/common/repositories/base/base_trader_repository.h +++ b/common/repositories/base/base_trader_repository.h @@ -138,7 +138,7 @@ public: e.char_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.item_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.serialnumber = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.charges = static_cast(atoi(row[3])); + e.charges = row[3] ? static_cast(atoi(row[3])) : 0; e.item_cost = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.slot_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; @@ -278,7 +278,7 @@ public: e.char_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.item_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.serialnumber = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.charges = static_cast(atoi(row[3])); + e.charges = row[3] ? static_cast(atoi(row[3])) : 0; e.item_cost = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.slot_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; @@ -308,7 +308,7 @@ public: e.char_id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; e.item_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.serialnumber = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.charges = static_cast(atoi(row[3])); + e.charges = row[3] ? static_cast(atoi(row[3])) : 0; e.item_cost = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; e.slot_id = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; diff --git a/common/repositories/base/base_tradeskill_recipe_entries_repository.h b/common/repositories/base/base_tradeskill_recipe_entries_repository.h index 763e0ce79..85eb5b281 100644 --- a/common/repositories/base/base_tradeskill_recipe_entries_repository.h +++ b/common/repositories/base/base_tradeskill_recipe_entries_repository.h @@ -143,14 +143,14 @@ public: if (results.RowCount() == 1) { TradeskillRecipeEntries e{}; - e.id = static_cast(atoi(row[0])); - e.recipe_id = static_cast(atoi(row[1])); - e.item_id = static_cast(atoi(row[2])); - e.successcount = static_cast(atoi(row[3])); - e.failcount = static_cast(atoi(row[4])); - e.componentcount = static_cast(atoi(row[5])); - e.salvagecount = static_cast(atoi(row[6])); - e.iscontainer = static_cast(atoi(row[7])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.recipe_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.item_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.successcount = row[3] ? static_cast(atoi(row[3])) : 0; + e.failcount = row[4] ? static_cast(atoi(row[4])) : 0; + e.componentcount = row[5] ? static_cast(atoi(row[5])) : 1; + e.salvagecount = row[6] ? static_cast(atoi(row[6])) : 0; + e.iscontainer = row[7] ? static_cast(atoi(row[7])) : 0; return e; } @@ -290,14 +290,14 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { TradeskillRecipeEntries e{}; - e.id = static_cast(atoi(row[0])); - e.recipe_id = static_cast(atoi(row[1])); - e.item_id = static_cast(atoi(row[2])); - e.successcount = static_cast(atoi(row[3])); - e.failcount = static_cast(atoi(row[4])); - e.componentcount = static_cast(atoi(row[5])); - e.salvagecount = static_cast(atoi(row[6])); - e.iscontainer = static_cast(atoi(row[7])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.recipe_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.item_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.successcount = row[3] ? static_cast(atoi(row[3])) : 0; + e.failcount = row[4] ? static_cast(atoi(row[4])) : 0; + e.componentcount = row[5] ? static_cast(atoi(row[5])) : 1; + e.salvagecount = row[6] ? static_cast(atoi(row[6])) : 0; + e.iscontainer = row[7] ? static_cast(atoi(row[7])) : 0; all_entries.push_back(e); } @@ -322,14 +322,14 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { TradeskillRecipeEntries e{}; - e.id = static_cast(atoi(row[0])); - e.recipe_id = static_cast(atoi(row[1])); - e.item_id = static_cast(atoi(row[2])); - e.successcount = static_cast(atoi(row[3])); - e.failcount = static_cast(atoi(row[4])); - e.componentcount = static_cast(atoi(row[5])); - e.salvagecount = static_cast(atoi(row[6])); - e.iscontainer = static_cast(atoi(row[7])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.recipe_id = row[1] ? static_cast(atoi(row[1])) : 0; + e.item_id = row[2] ? static_cast(atoi(row[2])) : 0; + e.successcount = row[3] ? static_cast(atoi(row[3])) : 0; + e.failcount = row[4] ? static_cast(atoi(row[4])) : 0; + e.componentcount = row[5] ? static_cast(atoi(row[5])) : 1; + e.salvagecount = row[6] ? static_cast(atoi(row[6])) : 0; + e.iscontainer = row[7] ? static_cast(atoi(row[7])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_tradeskill_recipe_repository.h b/common/repositories/base/base_tradeskill_recipe_repository.h index 6bbbc0214..e7070382a 100644 --- a/common/repositories/base/base_tradeskill_recipe_repository.h +++ b/common/repositories/base/base_tradeskill_recipe_repository.h @@ -175,20 +175,20 @@ public: if (results.RowCount() == 1) { TradeskillRecipe e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.tradeskill = static_cast(atoi(row[2])); - e.skillneeded = static_cast(atoi(row[3])); - e.trivial = static_cast(atoi(row[4])); - e.nofail = static_cast(atoi(row[5])); - e.replace_container = static_cast(atoi(row[6])); + e.tradeskill = row[2] ? static_cast(atoi(row[2])) : 0; + e.skillneeded = row[3] ? static_cast(atoi(row[3])) : 0; + e.trivial = row[4] ? static_cast(atoi(row[4])) : 0; + e.nofail = row[5] ? static_cast(atoi(row[5])) : 0; + e.replace_container = row[6] ? static_cast(atoi(row[6])) : 0; e.notes = row[7] ? row[7] : ""; - e.must_learn = static_cast(atoi(row[8])); - e.learned_by_item_id = static_cast(atoi(row[9])); - e.quest = static_cast(atoi(row[10])); - e.enabled = static_cast(atoi(row[11])); - e.min_expansion = static_cast(atoi(row[12])); - e.max_expansion = static_cast(atoi(row[13])); + e.must_learn = row[8] ? static_cast(atoi(row[8])) : 0; + e.learned_by_item_id = row[9] ? static_cast(atoi(row[9])) : 0; + e.quest = row[10] ? static_cast(atoi(row[10])) : 0; + e.enabled = row[11] ? static_cast(atoi(row[11])) : 1; + e.min_expansion = row[12] ? static_cast(atoi(row[12])) : -1; + e.max_expansion = row[13] ? static_cast(atoi(row[13])) : -1; e.content_flags = row[14] ? row[14] : ""; e.content_flags_disabled = row[15] ? row[15] : ""; @@ -354,20 +354,20 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { TradeskillRecipe e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.tradeskill = static_cast(atoi(row[2])); - e.skillneeded = static_cast(atoi(row[3])); - e.trivial = static_cast(atoi(row[4])); - e.nofail = static_cast(atoi(row[5])); - e.replace_container = static_cast(atoi(row[6])); + e.tradeskill = row[2] ? static_cast(atoi(row[2])) : 0; + e.skillneeded = row[3] ? static_cast(atoi(row[3])) : 0; + e.trivial = row[4] ? static_cast(atoi(row[4])) : 0; + e.nofail = row[5] ? static_cast(atoi(row[5])) : 0; + e.replace_container = row[6] ? static_cast(atoi(row[6])) : 0; e.notes = row[7] ? row[7] : ""; - e.must_learn = static_cast(atoi(row[8])); - e.learned_by_item_id = static_cast(atoi(row[9])); - e.quest = static_cast(atoi(row[10])); - e.enabled = static_cast(atoi(row[11])); - e.min_expansion = static_cast(atoi(row[12])); - e.max_expansion = static_cast(atoi(row[13])); + e.must_learn = row[8] ? static_cast(atoi(row[8])) : 0; + e.learned_by_item_id = row[9] ? static_cast(atoi(row[9])) : 0; + e.quest = row[10] ? static_cast(atoi(row[10])) : 0; + e.enabled = row[11] ? static_cast(atoi(row[11])) : 1; + e.min_expansion = row[12] ? static_cast(atoi(row[12])) : -1; + e.max_expansion = row[13] ? static_cast(atoi(row[13])) : -1; e.content_flags = row[14] ? row[14] : ""; e.content_flags_disabled = row[15] ? row[15] : ""; @@ -394,20 +394,20 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { TradeskillRecipe e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.name = row[1] ? row[1] : ""; - e.tradeskill = static_cast(atoi(row[2])); - e.skillneeded = static_cast(atoi(row[3])); - e.trivial = static_cast(atoi(row[4])); - e.nofail = static_cast(atoi(row[5])); - e.replace_container = static_cast(atoi(row[6])); + e.tradeskill = row[2] ? static_cast(atoi(row[2])) : 0; + e.skillneeded = row[3] ? static_cast(atoi(row[3])) : 0; + e.trivial = row[4] ? static_cast(atoi(row[4])) : 0; + e.nofail = row[5] ? static_cast(atoi(row[5])) : 0; + e.replace_container = row[6] ? static_cast(atoi(row[6])) : 0; e.notes = row[7] ? row[7] : ""; - e.must_learn = static_cast(atoi(row[8])); - e.learned_by_item_id = static_cast(atoi(row[9])); - e.quest = static_cast(atoi(row[10])); - e.enabled = static_cast(atoi(row[11])); - e.min_expansion = static_cast(atoi(row[12])); - e.max_expansion = static_cast(atoi(row[13])); + e.must_learn = row[8] ? static_cast(atoi(row[8])) : 0; + e.learned_by_item_id = row[9] ? static_cast(atoi(row[9])) : 0; + e.quest = row[10] ? static_cast(atoi(row[10])) : 0; + e.enabled = row[11] ? static_cast(atoi(row[11])) : 1; + e.min_expansion = row[12] ? static_cast(atoi(row[12])) : -1; + e.max_expansion = row[13] ? static_cast(atoi(row[13])) : -1; e.content_flags = row[14] ? row[14] : ""; e.content_flags_disabled = row[15] ? row[15] : ""; diff --git a/common/repositories/base/base_traps_repository.h b/common/repositories/base/base_traps_repository.h index 48f1e6d95..899e64fe1 100644 --- a/common/repositories/base/base_traps_repository.h +++ b/common/repositories/base/base_traps_repository.h @@ -211,29 +211,29 @@ public: if (results.RowCount() == 1) { Traps e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? row[1] : ""; e.version = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.x = static_cast(atoi(row[3])); - e.y = static_cast(atoi(row[4])); - e.z = static_cast(atoi(row[5])); - e.chance = static_cast(atoi(row[6])); + e.x = row[3] ? static_cast(atoi(row[3])) : 0; + e.y = row[4] ? static_cast(atoi(row[4])) : 0; + e.z = row[5] ? static_cast(atoi(row[5])) : 0; + e.chance = row[6] ? static_cast(atoi(row[6])) : 0; e.maxzdiff = row[7] ? strtof(row[7], nullptr) : 0; e.radius = row[8] ? strtof(row[8], nullptr) : 0; - e.effect = static_cast(atoi(row[9])); - e.effectvalue = static_cast(atoi(row[10])); - e.effectvalue2 = static_cast(atoi(row[11])); + e.effect = row[9] ? static_cast(atoi(row[9])) : 0; + e.effectvalue = row[10] ? static_cast(atoi(row[10])) : 0; + e.effectvalue2 = row[11] ? static_cast(atoi(row[11])) : 0; e.message = row[12] ? row[12] : ""; - e.skill = static_cast(atoi(row[13])); + e.skill = row[13] ? static_cast(atoi(row[13])) : 0; e.level = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 1; e.respawn_time = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 60; e.respawn_var = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; - e.triggered_number = static_cast(atoi(row[17])); - e.group = static_cast(atoi(row[18])); - e.despawn_when_triggered = static_cast(atoi(row[19])); - e.undetectable = static_cast(atoi(row[20])); - e.min_expansion = static_cast(atoi(row[21])); - e.max_expansion = static_cast(atoi(row[22])); + e.triggered_number = row[17] ? static_cast(atoi(row[17])) : 0; + e.group = row[18] ? static_cast(atoi(row[18])) : 0; + e.despawn_when_triggered = row[19] ? static_cast(atoi(row[19])) : 0; + e.undetectable = row[20] ? static_cast(atoi(row[20])) : 0; + e.min_expansion = row[21] ? static_cast(atoi(row[21])) : -1; + e.max_expansion = row[22] ? static_cast(atoi(row[22])) : -1; e.content_flags = row[23] ? row[23] : ""; e.content_flags_disabled = row[24] ? row[24] : ""; @@ -426,29 +426,29 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Traps e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? row[1] : ""; e.version = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.x = static_cast(atoi(row[3])); - e.y = static_cast(atoi(row[4])); - e.z = static_cast(atoi(row[5])); - e.chance = static_cast(atoi(row[6])); + e.x = row[3] ? static_cast(atoi(row[3])) : 0; + e.y = row[4] ? static_cast(atoi(row[4])) : 0; + e.z = row[5] ? static_cast(atoi(row[5])) : 0; + e.chance = row[6] ? static_cast(atoi(row[6])) : 0; e.maxzdiff = row[7] ? strtof(row[7], nullptr) : 0; e.radius = row[8] ? strtof(row[8], nullptr) : 0; - e.effect = static_cast(atoi(row[9])); - e.effectvalue = static_cast(atoi(row[10])); - e.effectvalue2 = static_cast(atoi(row[11])); + e.effect = row[9] ? static_cast(atoi(row[9])) : 0; + e.effectvalue = row[10] ? static_cast(atoi(row[10])) : 0; + e.effectvalue2 = row[11] ? static_cast(atoi(row[11])) : 0; e.message = row[12] ? row[12] : ""; - e.skill = static_cast(atoi(row[13])); + e.skill = row[13] ? static_cast(atoi(row[13])) : 0; e.level = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 1; e.respawn_time = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 60; e.respawn_var = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; - e.triggered_number = static_cast(atoi(row[17])); - e.group = static_cast(atoi(row[18])); - e.despawn_when_triggered = static_cast(atoi(row[19])); - e.undetectable = static_cast(atoi(row[20])); - e.min_expansion = static_cast(atoi(row[21])); - e.max_expansion = static_cast(atoi(row[22])); + e.triggered_number = row[17] ? static_cast(atoi(row[17])) : 0; + e.group = row[18] ? static_cast(atoi(row[18])) : 0; + e.despawn_when_triggered = row[19] ? static_cast(atoi(row[19])) : 0; + e.undetectable = row[20] ? static_cast(atoi(row[20])) : 0; + e.min_expansion = row[21] ? static_cast(atoi(row[21])) : -1; + e.max_expansion = row[22] ? static_cast(atoi(row[22])) : -1; e.content_flags = row[23] ? row[23] : ""; e.content_flags_disabled = row[24] ? row[24] : ""; @@ -475,29 +475,29 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Traps e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? row[1] : ""; e.version = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.x = static_cast(atoi(row[3])); - e.y = static_cast(atoi(row[4])); - e.z = static_cast(atoi(row[5])); - e.chance = static_cast(atoi(row[6])); + e.x = row[3] ? static_cast(atoi(row[3])) : 0; + e.y = row[4] ? static_cast(atoi(row[4])) : 0; + e.z = row[5] ? static_cast(atoi(row[5])) : 0; + e.chance = row[6] ? static_cast(atoi(row[6])) : 0; e.maxzdiff = row[7] ? strtof(row[7], nullptr) : 0; e.radius = row[8] ? strtof(row[8], nullptr) : 0; - e.effect = static_cast(atoi(row[9])); - e.effectvalue = static_cast(atoi(row[10])); - e.effectvalue2 = static_cast(atoi(row[11])); + e.effect = row[9] ? static_cast(atoi(row[9])) : 0; + e.effectvalue = row[10] ? static_cast(atoi(row[10])) : 0; + e.effectvalue2 = row[11] ? static_cast(atoi(row[11])) : 0; e.message = row[12] ? row[12] : ""; - e.skill = static_cast(atoi(row[13])); + e.skill = row[13] ? static_cast(atoi(row[13])) : 0; e.level = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 1; e.respawn_time = row[15] ? static_cast(strtoul(row[15], nullptr, 10)) : 60; e.respawn_var = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 0; - e.triggered_number = static_cast(atoi(row[17])); - e.group = static_cast(atoi(row[18])); - e.despawn_when_triggered = static_cast(atoi(row[19])); - e.undetectable = static_cast(atoi(row[20])); - e.min_expansion = static_cast(atoi(row[21])); - e.max_expansion = static_cast(atoi(row[22])); + e.triggered_number = row[17] ? static_cast(atoi(row[17])) : 0; + e.group = row[18] ? static_cast(atoi(row[18])) : 0; + e.despawn_when_triggered = row[19] ? static_cast(atoi(row[19])) : 0; + e.undetectable = row[20] ? static_cast(atoi(row[20])) : 0; + e.min_expansion = row[21] ? static_cast(atoi(row[21])) : -1; + e.max_expansion = row[22] ? static_cast(atoi(row[22])) : -1; e.content_flags = row[23] ? row[23] : ""; e.content_flags_disabled = row[24] ? row[24] : ""; diff --git a/common/repositories/base/base_tributes_repository.h b/common/repositories/base/base_tributes_repository.h index 688ee098e..5c6b7c402 100644 --- a/common/repositories/base/base_tributes_repository.h +++ b/common/repositories/base/base_tributes_repository.h @@ -135,7 +135,7 @@ public: e.unknown = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.name = row[2] ? row[2] : ""; e.descr = row[3] ? row[3] : ""; - e.isguild = static_cast(atoi(row[4])); + e.isguild = row[4] ? static_cast(atoi(row[4])) : 0; return e; } @@ -271,7 +271,7 @@ public: e.unknown = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.name = row[2] ? row[2] : ""; e.descr = row[3] ? row[3] : ""; - e.isguild = static_cast(atoi(row[4])); + e.isguild = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } @@ -300,7 +300,7 @@ public: e.unknown = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; e.name = row[2] ? row[2] : ""; e.descr = row[3] ? row[3] : ""; - e.isguild = static_cast(atoi(row[4])); + e.isguild = row[4] ? static_cast(atoi(row[4])) : 0; all_entries.push_back(e); } diff --git a/common/repositories/base/base_variables_repository.h b/common/repositories/base/base_variables_repository.h index dc959269c..dec022fec 100644 --- a/common/repositories/base/base_variables_repository.h +++ b/common/repositories/base/base_variables_repository.h @@ -131,11 +131,11 @@ public: if (results.RowCount() == 1) { Variables e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.varname = row[1] ? row[1] : ""; e.value = row[2] ? row[2] : ""; e.information = row[3] ? row[3] : ""; - e.ts = row[4] ? row[4] : ""; + e.ts = row[4] ? row[4] : std::time(nullptr); return e; } @@ -266,11 +266,11 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Variables e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.varname = row[1] ? row[1] : ""; e.value = row[2] ? row[2] : ""; e.information = row[3] ? row[3] : ""; - e.ts = row[4] ? row[4] : ""; + e.ts = row[4] ? row[4] : std::time(nullptr); all_entries.push_back(e); } @@ -295,11 +295,11 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Variables e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.varname = row[1] ? row[1] : ""; e.value = row[2] ? row[2] : ""; e.information = row[3] ? row[3] : ""; - e.ts = row[4] ? row[4] : ""; + e.ts = row[4] ? row[4] : std::time(nullptr); all_entries.push_back(e); } diff --git a/common/repositories/base/base_zone_points_repository.h b/common/repositories/base/base_zone_points_repository.h index e7bfbcdc0..b4e91c20d 100644 --- a/common/repositories/base/base_zone_points_repository.h +++ b/common/repositories/base/base_zone_points_repository.h @@ -207,9 +207,9 @@ public: if (results.RowCount() == 1) { ZonePoints e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? row[1] : ""; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.number = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 1; e.y = row[4] ? strtof(row[4], nullptr) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; @@ -224,13 +224,13 @@ public: e.target_instance = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.buffer = row[15] ? strtof(row[15], nullptr) : 0; e.client_version_mask = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 4294967295; - e.min_expansion = static_cast(atoi(row[17])); - e.max_expansion = static_cast(atoi(row[18])); + e.min_expansion = row[17] ? static_cast(atoi(row[17])) : -1; + e.max_expansion = row[18] ? static_cast(atoi(row[18])) : -1; e.content_flags = row[19] ? row[19] : ""; e.content_flags_disabled = row[20] ? row[20] : ""; - e.is_virtual = static_cast(atoi(row[21])); - e.height = static_cast(atoi(row[22])); - e.width = static_cast(atoi(row[23])); + e.is_virtual = row[21] ? static_cast(atoi(row[21])) : 0; + e.height = row[22] ? static_cast(atoi(row[22])) : 0; + e.width = row[23] ? static_cast(atoi(row[23])) : 0; return e; } @@ -418,9 +418,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ZonePoints e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? row[1] : ""; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.number = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 1; e.y = row[4] ? strtof(row[4], nullptr) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; @@ -435,13 +435,13 @@ public: e.target_instance = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.buffer = row[15] ? strtof(row[15], nullptr) : 0; e.client_version_mask = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 4294967295; - e.min_expansion = static_cast(atoi(row[17])); - e.max_expansion = static_cast(atoi(row[18])); + e.min_expansion = row[17] ? static_cast(atoi(row[17])) : -1; + e.max_expansion = row[18] ? static_cast(atoi(row[18])) : -1; e.content_flags = row[19] ? row[19] : ""; e.content_flags_disabled = row[20] ? row[20] : ""; - e.is_virtual = static_cast(atoi(row[21])); - e.height = static_cast(atoi(row[22])); - e.width = static_cast(atoi(row[23])); + e.is_virtual = row[21] ? static_cast(atoi(row[21])) : 0; + e.height = row[22] ? static_cast(atoi(row[22])) : 0; + e.width = row[23] ? static_cast(atoi(row[23])) : 0; all_entries.push_back(e); } @@ -466,9 +466,9 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { ZonePoints e{}; - e.id = static_cast(atoi(row[0])); + e.id = row[0] ? static_cast(atoi(row[0])) : 0; e.zone = row[1] ? row[1] : ""; - e.version = static_cast(atoi(row[2])); + e.version = row[2] ? static_cast(atoi(row[2])) : 0; e.number = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 1; e.y = row[4] ? strtof(row[4], nullptr) : 0; e.x = row[5] ? strtof(row[5], nullptr) : 0; @@ -483,13 +483,13 @@ public: e.target_instance = row[14] ? static_cast(strtoul(row[14], nullptr, 10)) : 0; e.buffer = row[15] ? strtof(row[15], nullptr) : 0; e.client_version_mask = row[16] ? static_cast(strtoul(row[16], nullptr, 10)) : 4294967295; - e.min_expansion = static_cast(atoi(row[17])); - e.max_expansion = static_cast(atoi(row[18])); + e.min_expansion = row[17] ? static_cast(atoi(row[17])) : -1; + e.max_expansion = row[18] ? static_cast(atoi(row[18])) : -1; e.content_flags = row[19] ? row[19] : ""; e.content_flags_disabled = row[20] ? row[20] : ""; - e.is_virtual = static_cast(atoi(row[21])); - e.height = static_cast(atoi(row[22])); - e.width = static_cast(atoi(row[23])); + e.is_virtual = row[21] ? static_cast(atoi(row[21])) : 0; + e.height = row[22] ? static_cast(atoi(row[22])) : 0; + e.width = row[23] ? static_cast(atoi(row[23])) : 0; all_entries.push_back(e); } diff --git a/utils/scripts/generators/repository-generator.pl b/utils/scripts/generators/repository-generator.pl index b6f10d149..598c0dac4 100644 --- a/utils/scripts/generators/repository-generator.pl +++ b/utils/scripts/generators/repository-generator.pl @@ -294,7 +294,7 @@ foreach my $table_to_generate (@tables) { $query_value = sprintf('" + std::to_string(e.%s));', $column_name_formatted); } elsif ($data_type =~ /datetime/) { - $query_value = sprintf('FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")");', $column_name_formatted, $column_name_formatted); + $query_value = sprintf('FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "UNIX_TIMESTAMP()") + ")");', $column_name_formatted, $column_name_formatted); } $update_one_entries .= sprintf( @@ -310,7 +310,7 @@ foreach my $table_to_generate (@tables) { $value = sprintf('std::to_string(e.%s)', $column_name_formatted); } elsif ($data_type =~ /datetime/) { - $value = sprintf('"FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")"', $column_name_formatted, $column_name_formatted); + $value = sprintf('"FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "UNIX_TIMESTAMP()") + ")"', $column_name_formatted, $column_name_formatted); } $insert_one_entries .= sprintf("\t\tv.push_back(%s);\n", $value);