Code added to auto fix quests. Updated manifest and version to current.

This commit is contained in:
Noudess 2019-02-28 15:01:39 -05:00
parent 380e5d5084
commit aa9611d494
3 changed files with 32 additions and 5 deletions

View File

@ -30,7 +30,7 @@
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9137
#define CURRENT_BINARY_DATABASE_VERSION 9138
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9021
#else

View File

@ -2214,6 +2214,10 @@ sub run_database_check {
if ($bots_db_management == 1 && $val == 9000) {
modify_db_for_bots();
}
if ($val == 9137) {
fix_quest_factions();
}
}
$db_run_stage = 2;
}
@ -2564,12 +2568,12 @@ sub quest_faction_convert {
$new_faction = get_mysql_result("select clientid from client_server_faction_map where serverid = $faction_value_clean");
chomp $new_faction;
if ($new_faction == 0) {
$new_faction = get_mysql_result("select new_faction from custom_faction_mappings where old_faction = $faction_value_clean");
$new_faction = get_mysql_result("select new_faction from custom_faction_mappings where old_faction = $faction_value_clean");
chomp $new_faction;
}
if ($new_faction > 0) {
print "BEFORE: " . $line . "\n";
$line =~ s/$faction_value_clean/$new_faction/g;
$line =~ s/$faction_value_clean/$new_faction/g;
print "AFTER: " . $line . "\n";
$changes_made = 1;
}
@ -2600,3 +2604,25 @@ sub quest_faction_convert {
print "Total matches: " . $total_matches . "\n";
}
sub fix_quest_factions {
# Backup the quests
mkdir('backups');
my @files;
my $start_dir = "quests/";
find(
sub { push @files, $File::Find::name unless -d; },
$start_dir
);
for my $file (@files) {
$destination_file = $file;
my $date = strftime "%m-%d-%Y", localtime;
$destination_file =~ s/quests/quests-$date/;
print "Backing up :: " . $destination_file . "\n";
# unlink($destination_file);
copy_file($file, 'backups/' . $destination_file);
}
# Fix the factions
quest_faction_convert();
}

View File

@ -389,8 +389,9 @@
9133|2018_11_25_StuckBehavior.sql|SHOW COLUMNS FROM `npc_types` LIKE 'stuck_behavior'|empty|
9134|2019_01_04_update_global_base_scaling.sql|SELECT * FROM db_version WHERE version >= 9134|empty|
9135|2019_01_10_multi_version_spawns.sql|SHOW COLUMNS FROM `spawn2` LIKE 'version'|contains|unsigned|
9136|2018_12_12_client_faction_tables.sql|SHOW TABLES LIKE 'faction_base_data'|empty|
9137|2018_12_12_convert_to_client_functions.sql|SELECT `id` FROM `faction_list` WHERE `id` > 4999|empty|
9136|2019_02_04_profanity_command.sql|SHOW TABLES LIKE 'profanity_list'|empty|
9137|2018_12_12_client_faction_tables.sql|SHOW TABLES LIKE 'faction_base_data'|empty|
9138|2018_12_12_convert_to_client_functions.sql|SELECT `id` FROM `faction_list` WHERE `id` > 4999|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not
# yet using the versioning system to figure out where the database is schema wise to determine