[CommandHandler("fix-shortcut-bars", AccessLevel.Admin, CommandHandlerFlag.ConsoleInvoke, "Fixes the players with duplicate items on their shortcut bars.", "<execute>")]
Console.WriteLine("This command will attempt to fix duplicate shortcuts found in player shortcut bars. Unless explictly indicated, command will dry run only");
Console.WriteLine("If the command outputs nothing or errors, you are ready to proceed with updating your shard db with 2019-04-17-00-Character_Shortcut_Changes.sql script");
Console.WriteLine();
varexecute=false;
if(parameters.Length<1)
Console.WriteLine("This will be a dry run and show which characters that would be affected. To perform fix, please use command: fix-shortcut-bars execute");
elseif(parameters[0].ToLower()=="execute")
execute=true;
else
Console.WriteLine("Please use command fix-shortcut-bars execute");
strings.Add($"DELETE FROM `character_properties_shortcut_bar` WHERE `character_Id`={characterID};");
foreach(varshortcutinidxToObj)
strings.Add($"INSERT INTO `character_properties_shortcut_bar` SET `character_Id`={characterID}, `shortcut_Bar_Index`={shortcut.Key}, `shortcut_Object_Id`={shortcut.Value};");
[CommandHandler("database-shard-cache-pbrt", AccessLevel.Developer, CommandHandlerFlag.None, 0, "Shard Database, Player Biota Cache - Retention Time (in minutes)")]
CommandHandlerHelper.WriteOutputInfo(session,"DatabaseManager is not using ShardDatabaseWithCaching");
return;
}
if(parameters==null||parameters.Length==0)
{
CommandHandlerHelper.WriteOutputInfo(session,$"Shard Database, Player Biota Cache - Retention Time {shardDatabaseWithCaching.PlayerBiotaRetentionTime.TotalMinutes:N0} m");
CommandHandlerHelper.WriteOutputInfo(session,$"Shard Database, Player Biota Cache - Retention Time {shardDatabaseWithCaching.PlayerBiotaRetentionTime.TotalMinutes:N0} m");
}
[CommandHandler("database-shard-cache-npbrt", AccessLevel.Developer, CommandHandlerFlag.None, 0, "Shard Database, Non-Player Biota Cache - Retention Time (in minutes)")]
Console.WriteLine("This command will attempt to fix player spell bars. Unless explictly indicated, command will dry run only");
Console.WriteLine("You must have executed 2020-04-11-00-Update-Character-SpellBars.sql script first before running this command");
Console.WriteLine();
varexecute=false;
if(parameters.Length<1)
Console.WriteLine("This will be a dry run and show which characters that would be affected. To perform fix, please use command: fix-spell-bars execute");
elseif(parameters[0].ToLower()=="execute")
execute=true;
else
Console.WriteLine("Please use command fix-spell-bars execute");
if(!execute)
{
Console.WriteLine();
Console.WriteLine("Press enter to start.");
Console.ReadLine();
}
varnumberOfRecordsFixed=0;
log.Info($"Starting FixSpellBarsPR2918 process. This could take a while...");
Console.WriteLine("This command will attempt to correct the names on Gear Plated items. Unless explictly indicated, command will dry run only.");
Console.WriteLine();
varexecute=false;
if(parameters.Length<1)
Console.WriteLine("This will be a dry run and show which characters that would be affected. To perform fix, please use command: \"fix-gear-plating execute\"");
elseif(parameters[0].ToLower()=="execute")
execute=true;
else
Console.WriteLine("Please use command \"fix-gear-plating execute\"");
Console.WriteLine();
varsqlCommands=newList<string>();
using(varctx=newShardDbContext())
{
stringquery="SELECT s.object_Id, c.name, s.value as itemName, s2.value as gearPlatingName, i.value as locations from `character` as c, biota_properties_i_i_d as iid, biota_properties_int as i, biota_properties_string as s, biota_properties_string as s2 where c.id = iid.value and iid.`type` = 1 and s.type = 1 and s2.type = 52 and i.`type` = 9 and s.object_Id = s2.object_Id and iid.object_Id = s.object_Id and i.object_Id = s.object_Id;";
stringupdateSQL=$"UPDATE `biota_properties_string` SET `value` = '{newGearPlatingName}' WHERE `biota_properties_string`.`object_Id` = {object_Id} AND `biota_properties_string`.`type` = 52;";
sqlCommands.Add(updateSQL);
Console.WriteLine($"Char: {characterName} - Change `{itemName}` from \"{gearPlatingName}\" to \"{newGearPlatingName}\"");
}
}
}
}
Console.WriteLine();
Console.WriteLine($" -- There are {sqlCommands.Count} items that have incorrect Gear Plating Name values. --");
Console.WriteLine();
if(execute)
{
Console.WriteLine("Executing changes...");
foreach(varcmdinsqlCommands)
ctx.Database.ExecuteSqlRaw(cmd);
Console.WriteLine("Finished.");
}
else
Console.WriteLine("Dry run completed. Use \"fix-gear-plating execute\" to actually run command");