Skip to content

Commit

Permalink
0.0.2.10 Option to bump BattlePets to rare for selected account
Browse files Browse the repository at this point in the history
  • Loading branch information
skeezerbean committed Mar 23, 2021
1 parent 901cac4 commit b1056cc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions Models/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class Account
public int BattleCoins { get; set; } // donate columm in battlenet_accounts
public int GMLevel { get; set; } // gmlevel in account_access
public SecureString SecurePassword { get; set; } // temporarily store encrypted password if being updated
public bool RareBattlePets { get; set; } // temp choice in selected account settings

public Account()
{
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.2.9")]
[assembly: AssemblyFileVersion("0.0.2.9")]
[assembly: AssemblyVersion("0.0.2.10")]
[assembly: AssemblyFileVersion("0.0.2.10")]
2 changes: 1 addition & 1 deletion SPP-LegionV2-Management.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>9</ApplicationRevision>
<ApplicationRevision>10</ApplicationRevision>
<ApplicationVersion>0.0.2.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down
20 changes: 11 additions & 9 deletions ViewModels/AccountManagerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class AccountManagerViewModel : Screen
public int CurrentBattleNetID { get { return (SelectedAccount == null) ? -1 : SelectedAccount.BattleNetAccount; } }
public SecureString SecurePassword { get { return (SelectedAccount == null) ? new SecureString() : SelectedAccount.SecurePassword; } set { SelectedAccount.SecurePassword = value; } }
public string AccountStatus { get { return (CharacterStatus == null) ? string.Empty : CharacterStatus; } set { CharacterStatus = value; } }
public bool CurrentRareBattlePets { get { return (SelectedAccount.RareBattlePets == null) ? false : SelectedAccount.RareBattlePets; } set { SelectedAccount.RareBattlePets = value; } }

// Characters
public int CharactersTotal { get; set; }
Expand Down Expand Up @@ -169,6 +170,10 @@ public async void ApplyAccountChanges()
else if (response != "-1" && (account.GMLevel != Int32.Parse(response)))
MessageBox.Show($"Account [{account.ID}({account.Username})] Changing GM status from {response} to {account.GMLevel} - "
+ MySqlManager.MySQLQueryToString($"UPDATE `legion_auth`.`account_access` SET `gmlevel`='{account.GMLevel}' WHERE `id`='{account.ID}'", true));
// If BattlePets checkbox was selected, zap all BattlePets for this account to rare quality
if (account.RareBattlePets)
MessageBox.Show($"Account [{account.ID}({account.Username})] Changing all BattlePets to rare quality - "
+ MySqlManager.MySQLQueryToString($"UPDATE `legion_characters`.`account_battlepet` SET `quality`='3' WHERE `account`='{account.ID}'", true));
}

// now that things have been updated, refresh our list
Expand Down Expand Up @@ -393,7 +398,8 @@ public async Task GetOrphanedData()
string tmpStatus = "";
int tmpCount = 0;

// Get our total orphaned objects for each table
// Get our total orphaned objects for each table. If there's a table with massive amounts of data
// then it may block the UI a bit (GB's of orphaned data in item_instance for example)
foreach (var entry in CharacterTableField.CharacterTableFields)
{
tmpCount = GetOrphanedTotalRows(entry.table, entry.field);
Expand Down Expand Up @@ -586,24 +592,20 @@ private async Task<int> RemoveObjectRows(string table, string field, int guid =

// The guid may be the same as the auctionhouse or guild bank items, so we need to make sure we're not removing any items that
// are listed in the those tables. Otherwise they may be orphaned auctions that the AH code didn't clean up, need removed
// If the guid is -1, apply tmpquery above, otherwise check for the incoming guid, then limit by rows if applicable
MySqlManager.MySQLQueryToString("DELETE FROM `legion_characters`.`item_instance` WHERE `owner_guid` "
+ $"{((guid == -1) ? tmpquery : $"= '{guid}'")}"
+ $"{((OrphanedRowsLimit > 0) ? $" LIMIT {OrphanedRowsLimit}" : "")}", true);
}
// Add handling for character_queststatus tables
else if (table.Contains("legion_characters`.`character_queststatus"))
{
// Some entries list id 0 for the whole account, this only removes if the account doesn't exist
MySqlManager.MySQLQueryToString($"DELETE FROM `{table}` WHERE `{field}` NOT IN (SELECT `id` FROM `legion_auth`.`account`)", true);
}
// Handle account related tables
if (table.Contains("legion_characters`.`account_"))
// Handle account or queststatus related tables
if (table.Contains("legion_characters`.`account_") || table.Contains("legion_characters`.`character_queststatus"))
{
if (table.Contains("legion_characters`.`account_item_favorite_appearances"))
// This table refers to battlenet accounts rather than normal account id.
MySqlManager.MySQLQueryToString($"DELETE FROM `{table}` WHERE `{field}` NOT IN (SELECT `id` FROM `legion_auth`.`battlenet_accounts`)", true);
else
// All other account related check with auth accounts table for a match
// Note - some queststatus tables had guid 0 for the account, so we don't touch unless the account id doesn't exist
MySqlManager.MySQLQueryToString($"DELETE FROM `{table}` WHERE `{field}` NOT IN (SELECT `id` FROM `legion_auth`.`account`)", true);
}
else
Expand Down
3 changes: 3 additions & 0 deletions Views/AccountManagerView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
<TextBlock Text="Selected Account Username:" Margin="1" />
<TextBlock Text="Selected BattleCoins:" Margin="1" />
<TextBlock Text="Selected Account GM Level:" Margin="1" />
<TextBlock Text="Account BattlePets to Rare?" Margin="1" />
<TextBlock Text="Status:" Margin="1" />
</StackPanel>
<StackPanel Margin="10">
Expand All @@ -79,6 +80,8 @@
<TextBox x:Name="CurrentBattleCoins" Width="125" HorizontalAlignment="Left" />
<TextBox x:Name="CurrentGMLevel" Width="125" HorizontalAlignment="Left"
ToolTip="GM Level set to -1 or 0 to disable, or between 1 and 6" />
<CheckBox x:Name="CurrentRareBattlePets" Margin="2" HorizontalAlignment="Left"
ToolTip="Checking this box, and hitting Apply, changes all CURRENT BattlePets on this account to rare quality"/>
<TextBlock x:Name="AccountStatus" />
</StackPanel>
</StackPanel>
Expand Down

0 comments on commit b1056cc

Please sign in to comment.