Skip to content

Commit

Permalink
Removed outdated references to the "merge items" setting & no longer …
Browse files Browse the repository at this point in the history
…deletes bugged duplicates (only relevant for the old looting mode)
  • Loading branch information
m committed Oct 18, 2024
1 parent 114d329 commit d2edd89
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 102 deletions.
60 changes: 0 additions & 60 deletions IAGrim/Database/DAO/PlayerItemDaoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -980,66 +980,6 @@ public Dictionary<long, string> FindRecordsFromIds(IEnumerable<long> ids) {
return result;
}

/// <summary>
/// Delete duplicate items (items duplicated via bugs, not simply similar items)
/// </summary>
public void DeleteDuplicates() {
using (var session = SessionCreator.OpenSession()) {
using (var transaction = session.BeginTransaction()) {
// Mark all duplicates for deletion from online backups
session.CreateSQLQuery(@"
insert into deletedplayeritem_v3(id)
select cloudid FROM playeritem WHERE Id IN (
SELECT Id FROM (
SELECT MAX(Id) as Id, (baserecord || prefixrecord || modifierrecord || suffixrecord || materiarecord || transmuterecord || seed) as UQ FROM PlayerItem WHERE (baserecord || prefixrecord || modifierrecord || suffixrecord || materiarecord || transmuterecord || seed) IN (
SELECT UQ FROM (
SELECT (baserecord || prefixrecord || modifierrecord || suffixrecord || materiarecord || transmuterecord || seed) as UQ, COUNT(*) as C FROM PlayerItem
WHERE baserecord NOT LIKE '%materia%'
AND baserecord NOT LIKE '%questitems%'
AND baserecord NOT LIKE '%potions%'
AND baserecord NOT LIKE '%crafting%'
AND StackCount < 2 -- Potions, components, etc
GROUP BY UQ
) X
WHERE C > 1
)
Group BY UQ
) Z
)
AND cloud_hassync
AND cloudid IS NOT NULL
AND cloudid NOT IN (SELECT id FROM deletedplayeritem_v3)
AND cloudid != ''
").ExecuteUpdate();
// Delete duplicates (if there are multiple, only one will be deleted)
session.CreateSQLQuery(@"
DELETE FROM PlayerItem WHERE Id IN (
SELECT Id FROM (
SELECT MAX(Id) as Id, (baserecord || prefixrecord || modifierrecord || suffixrecord || materiarecord || transmuterecord || seed) as UQ FROM PlayerItem WHERE (baserecord || prefixrecord || modifierrecord || suffixrecord || materiarecord || transmuterecord || seed) IN (
SELECT UQ FROM (
SELECT (baserecord || prefixrecord || modifierrecord || suffixrecord || materiarecord || transmuterecord || seed) as UQ, COUNT(*) as C FROM PlayerItem
WHERE baserecord NOT LIKE '%materia%'
AND baserecord NOT LIKE '%questitems%'
AND baserecord NOT LIKE '%potions%'
AND baserecord NOT LIKE '%crafting%'
AND StackCount < 2 -- Potions, components, etc
GROUP BY UQ
) X
WHERE C > 1
)
Group BY UQ
) Z
)
").ExecuteUpdate();

transaction.Commit();
}
}
}

public IList<PlayerItem> ListMissingReplica() {


Expand Down
1 change: 0 additions & 1 deletion IAGrim/Database/Interfaces/IPlayerItemDao.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public interface IPlayerItemDao : IBaseDao<PlayerItem> {

bool Exists(PlayerItem item);

void DeleteDuplicates();

IList<PlayerItem> ListMissingReplica();
}
Expand Down
6 changes: 0 additions & 6 deletions IAGrim/Database/Synchronizer/PlayerItemRepo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ public bool Exists(PlayerItem item) {
);
}

public void DeleteDuplicates() {
ThreadExecuter.Execute(
() => _repo.DeleteDuplicates()
);
}

public IList<PlayerItem> ListMissingReplica() {
return ThreadExecuter.Execute(
() => _repo.ListMissingReplica()
Expand Down
8 changes: 0 additions & 8 deletions IAGrim/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,6 @@ private static void Run(string[] args, ThreadExecuter threadExecuter) {
StartupService.PerformIconCheck(grimDawnDetector, settingsService);


try {
var playerItemDao = serviceProvider.Get<IPlayerItemDao>();
playerItemDao.DeleteDuplicates();
}
catch (Exception ex) {
Logger.Warn("Something went terribly wrong trying to ensure no duplicate items are found, however we'll just ignore it instead of blocking you access to your items.. sigh..", ex);
}

_mw.Visible = false;
if (new DonateNagScreen(settingsService).CanNag)
Application.Run(new DonateNagScreen(settingsService));
Expand Down
1 change: 0 additions & 1 deletion IAGrim/Services/ItemReplica/ItemReplicaParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using IAGrim.UI.Misc.CEF;
using IAGrim.Utilities;
using log4net;
using log4net.Repository.Hierarchy;
using Newtonsoft.Json;
using NHibernate.Exceptions;

Expand Down
9 changes: 0 additions & 9 deletions IAGrim/Settings/Dto/PersistentSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public class PersistentSettings {
private bool _subscribeExperimentalUpdates;
private bool _minimizeToTray;
private bool _usingDualComputer;
private bool _mergeDuplicates;
private bool _transferAnyMod;
private bool _darkMode;
private bool _autoUpdateModSettings;
Expand Down Expand Up @@ -61,14 +60,6 @@ public bool UsingDualComputer {
}
}

public bool MergeDuplicates {
get => _mergeDuplicates;
set {
_mergeDuplicates = value;
OnMutate?.Invoke(null, null);
}
}

public bool TransferAnyMod {
get => _transferAnyMod;
set {
Expand Down
1 change: 0 additions & 1 deletion IAGrim/UI/Controller/ISettingsReadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace IAGrim.UI.Controller {
interface ISettingsReadController {
bool MinimizeToTray { get; }
bool MergeDuplicates { get; }
bool AutoUpdateModSettings { get; }
}
}
14 changes: 0 additions & 14 deletions IAGrim/UI/Controller/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public SettingsController(SettingsService settings) {

public void LoadDefaults() {
MinimizeToTray = _settings.GetPersistent().MinimizeToTray;
MergeDuplicates = _settings.GetPersistent().MergeDuplicates;
AutoUpdateModSettings = _settings.GetPersistent().AutoUpdateModSettings;
HideSkills = _settings.GetPersistent().HideSkills;
}
Expand Down Expand Up @@ -71,19 +70,6 @@ public bool MinimizeToTray {
}


/// <summary>
/// Merge duplicate items into a single entry
/// </summary>
public bool MergeDuplicates {
get => _settings.GetPersistent().MergeDuplicates;
set {
_settings.GetPersistent().MergeDuplicates = value;
OnPropertyChanged();
}
}



#endregion

private string StripPrefix(string s) {
Expand Down
2 changes: 0 additions & 2 deletions StatTranslator/EnglishLanguage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ public string Export() {
{"iatag_ui_no", "No"},
{"iatag_ui_survivalmode", "The Crucible (DLC)"},
{"iatag_ui_dualcomputer", "Using IA on multiple PCs"},
{"iatag_ui_deleteduplicates", "Delete bugged duplicates"},
{"iatag_ui_backup_service_error", "The backup service is currently experiencing technical difficulties.\nPlease try again later."},
{"iatag_ui_backup_status", "Backup status"},
{"iatag_ui_backup_complete", "Backup complete!"},
Expand Down Expand Up @@ -550,7 +549,6 @@ public string Export() {
{"iatag_ui_autoselectmod", "Auto Select Mod"},
{"iatag_ui_autosearch", "Auto Search"},
{"iatag_ui_transferanymod", "Transfer to any mod"},
{"iatag_ui_mergeduplicates", "Merge Duplicates"},
{"iatag_ui_minimizetotray", "Minimize to Tray"},
{"iatag_ui_startminimized", "Start minimized"},
{"iatag_ui_update_title", "Automatic Updates"},
Expand Down

0 comments on commit d2edd89

Please sign in to comment.