Skip to content

Commit

Permalink
Update v3.0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunaretic committed Jul 2, 2024
2 parents bf42ae8 + 8f776ec commit 2e52a86
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 29 deletions.
6 changes: 3 additions & 3 deletions FFXIV_TexTools/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ public MainWindow(string[] args)
return;
}

ModTransaction.ActiveTransactionBlocked += ModTransaction_ActiveTransactionBlocked;
ModTransaction.ActiveTransactionUnblocked += ModTransaction_ActiveTransactionUnblocked;

if (args != null && args.Length > 0)
{

Expand All @@ -383,9 +386,6 @@ public MainWindow(string[] args)
// This can be set whereever, since the item select won't fire it unless things are loaded fully.
ItemSelect.ItemSelected += ItemSelect_ItemSelected;
ItemSelect.ItemsLoaded += OnTreeLoaded;

ModTransaction.ActiveTransactionBlocked += ModTransaction_ActiveTransactionBlocked;
ModTransaction.ActiveTransactionUnblocked += ModTransaction_ActiveTransactionUnblocked;
_ = AsyncStartup();

}
Expand Down
4 changes: 2 additions & 2 deletions FFXIV_TexTools/Views/Controls/ItemSelectControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,15 @@ private void SelectItem(IItem item)
_selectedItem = item;

// Manually invoke this in case the item isn't in the filter currently.
ItemSelected.Invoke(_selectedItem, e.Root);
ItemSelected?.Invoke(_selectedItem, e.Root);
}
else
{
// Item was not in the tree.
if (_selectedItem != item)
{
_selectedItem = item;
ItemSelected.Invoke(_selectedItem, e.Root);
ItemSelected?.Invoke(_selectedItem, _selectedItem.GetRoot());
}

}
Expand Down
2 changes: 2 additions & 0 deletions FFXIV_TexTools/Views/Controls/RootSelectControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FFXIV_TexTools.Views.Controls;
using FFXIV_TexTools.Views.ItemConverter;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand All @@ -18,6 +19,7 @@
using xivModdingFramework.Cache;
using xivModdingFramework.Items;
using xivModdingFramework.Items.Interfaces;
using xivModdingFramework.Mods;
using UserControl = System.Windows.Controls.UserControl;

namespace FFXIV_TexTools.Views.Controls
Expand Down
19 changes: 10 additions & 9 deletions FFXIV_TexTools/Views/ItemConverter/ItemConverterWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private void SetState(ItemConverterState state)
}
}

private bool IsSupported(XivDependencyRoot fullRoot)
public static bool IsSupported(XivDependencyRoot fullRoot)
{

if (fullRoot == null) return false;
Expand All @@ -174,13 +174,13 @@ private bool IsSupported(XivDependencyRoot fullRoot)
return true;
}

private bool DestinationOk(XivDependencyRoot fullRoot)
public static bool DestinationOk(XivDependencyRoot source, XivDependencyRoot target)
{
if (fullRoot == null) return false;
if (Source == null) return false;
if (target == null) return false;
if (source == null) return false;

var root = fullRoot.Info;
var src = Source.Info;
var root = target.Info;
var src = source.Info;

// Convert To Accessory Handling
if((src.PrimaryType == XivItemType.equipment || src.PrimaryType == XivItemType.accessory) && root.PrimaryType == XivItemType.accessory)
Expand Down Expand Up @@ -212,7 +212,7 @@ private void ItemSelect_RawItemSelected(IItem item, XivDependencyRoot root)
return;
}

if(State == ItemConverterState.DestinationSelect && !DestinationOk(root))
if(State == ItemConverterState.DestinationSelect && !DestinationOk(Source, root))
{
ItemSelect.SelectButton.IsEnabled = false;
ItemSelect.SelectButton.Content = "Invalid Destination".L();
Expand All @@ -229,6 +229,7 @@ private void ItemSelect_RawItemSelected(IItem item, XivDependencyRoot root)
}
}


#region Item List Filters
private bool Filter(IItem item, XivDependencyRoot root)
{
Expand All @@ -242,7 +243,7 @@ private bool Filter(IItem item, XivDependencyRoot root)
return false;
}

if (State == ItemConverterState.DestinationSelect && !DestinationOk(root))
if (State == ItemConverterState.DestinationSelect && !DestinationOk(Source, root))
{
return false;
}
Expand Down Expand Up @@ -306,7 +307,7 @@ private void RefreshList()

public async Task ShowConversionStats()
{
if (!DestinationOk(Destination)) return;
if (!DestinationOk(Source, Destination)) return;


SourceBox.Text = Source.Info.GetBaseFileName() + " (" + SourceItem.Name + ")";
Expand Down
26 changes: 12 additions & 14 deletions FFXIV_TexTools/Views/ModPack/ModpackRootConvertWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ private void ItemSearch_Click(object sender, RoutedEventArgs e)

var srcItem = ItemSelections[root].SourceItem;

var selectedItem = PopupItemSelection.ShowItemSelection((IItem item, XivDependencyRoot root) =>
var selectedItem = PopupItemSelection.ShowItemSelection((IItem item, XivDependencyRoot innerRoot) =>
{
return ValidationFunction(item, root);
}, (IItem item, XivDependencyRoot root) =>
return ValidationFunction(root, item, innerRoot);
}, (IItem item, XivDependencyRoot innerRoot) =>
{
return ValidationFunction(item, root);
return ValidationFunction(root, item, innerRoot);
}, this);

if (selectedItem == null) return;
Expand All @@ -372,26 +372,24 @@ private void ItemSearch_Click(object sender, RoutedEventArgs e)
Results[root] = (selectedRoot, Results[root].Variant);
}

private static bool ValidationFunction(IItem item, XivDependencyRoot root) {
private static bool ValidationFunction(XivDependencyRoot source, IItem item, XivDependencyRoot target) {
// Item Select Acceptance
if (item == null) return false;
if (root == null) return false;
if (source == null) return false;
if (target == null) return false;

var itemRoot = item.GetRoot();
if (itemRoot == null) return false;

if(root.Info.PrimaryType == XivItemType.equipment || root.Info.PrimaryType == XivItemType.accessory)
if(source.Info.PrimaryType == XivItemType.equipment || source.Info.PrimaryType == XivItemType.accessory)
{
if(itemRoot.Info.PrimaryType == XivItemType.accessory)
if(target.Info.PrimaryType == XivItemType.accessory)
{
// Allow converting most things to accessories.
return true;
}
}

if (itemRoot.Info.PrimaryType == root.Info.PrimaryType &&
itemRoot.Info.SecondaryType == root.Info.SecondaryType &&
itemRoot.Info.Slot == root.Info.Slot)
if (source.Info.PrimaryType == target.Info.PrimaryType &&
source.Info.SecondaryType == target.Info.SecondaryType &&
source.Info.Slot == target.Info.Slot)
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/xivModdingFramework

0 comments on commit 2e52a86

Please sign in to comment.