Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Dec 26, 2022
2 parents fa4b67b + b39bf97 commit 8a66618
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 26 deletions.
94 changes: 70 additions & 24 deletions src/StatisticsAnalysisTool/Common/ItemController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,34 +438,80 @@ private static ItemJsonObject GetSpecificItemInfo(string uniqueName)
return null;
}

var itemTypes = new Dictionary<ItemType, Func<ItemJsonObject, bool>>
{
{ ItemType.Hideout, i => i is HideoutItem hideoutItem && hideoutItem.UniqueName == uniqueName },
{ ItemType.Farmable, i => i is FarmableItem farmableItem && farmableItem.UniqueName == uniqueName },
{ ItemType.Simple, i => i is SimpleItem simpleItem && simpleItem.UniqueName == uniqueName },
{ ItemType.Consumable, i => i is ConsumableItem consumableItem && consumableItem.UniqueName == uniqueName },
{ ItemType.ConsumableFromInventory, i => i is ConsumableFromInventoryItem consumableFromInventoryItem && consumableFromInventoryItem.UniqueName == uniqueName },
{ ItemType.Equipment, i => i is EquipmentItem equipmentItem && equipmentItem.UniqueName == uniqueName },
{ ItemType.Weapon, i => i is Weapon weapon && weapon.UniqueName == uniqueName },
{ ItemType.Mount, i => i is Mount mount && mount.UniqueName == uniqueName },
{ ItemType.Furniture, i => i is FurnitureItem furnitureItem && furnitureItem.UniqueName == uniqueName },
{ ItemType.Journal, i => i is JournalItem journalItem && journalItem.UniqueName == uniqueName },
{ ItemType.LabourerContract, i => i is LabourerContract labourerContract && labourerContract.UniqueName == uniqueName },
{ ItemType.MountSkin, i => i is MountSkin mountSkin && mountSkin.UniqueName == uniqueName },
{ ItemType.CrystalLeague, i => i is CrystalLeagueItem crystalLeagueItem && crystalLeagueItem.UniqueName == uniqueName }
};
var hideoutItem = GetItemJsonObject(cleanUniqueName, new List<HideoutItem> { _itemsJson.Items.HideoutItem });
if (hideoutItem != null)
{
return hideoutItem;
}

foreach (var (itemType, predicate) in itemTypes)
var farmableItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.FarmableItem);
if (farmableItem != null)
{
var item = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.GetType().GetProperty(itemType.ToString())?.GetValue(_itemsJson.Items) as List<ItemJsonObject>);
if (item != null && predicate(item))
{
item.ItemType = itemType;
return item;
}
return farmableItem;
}

return null;
var simpleItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.SimpleItem);
if (simpleItem != null)
{
return simpleItem;
}

var consumableItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.ConsumableItem);
if (consumableItem != null)
{
return consumableItem;
}

var consumableFromInventoryItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.ConsumableFromInventoryItem);
if (consumableFromInventoryItem != null)
{
return consumableFromInventoryItem;
}

var equipmentItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.EquipmentItem);
if (equipmentItem != null)
{
return equipmentItem;
}

var weapon = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.Weapon);
if (weapon != null)
{
return weapon;
}

var mount = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.Mount);
if (mount != null)
{
return mount;
}

var furnitureItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.FurnitureItem);
if (furnitureItem != null)
{
return furnitureItem;
}

var journalItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.JournalItem);
if (journalItem != null)
{
return journalItem;
}

var labourerContract = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.LabourerContract);
if (labourerContract != null)
{
return labourerContract;
}

var mountSkin = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.MountSkin);
if (mountSkin != null)
{
return mountSkin;
}

var crystalLeagueItem = GetItemJsonObject(cleanUniqueName, _itemsJson.Items.CrystalLeagueItem);
return crystalLeagueItem;
}

private static ItemJsonObject GetItemJsonObject<T>(string uniqueName, List<T> itemJsonObjects)
Expand Down
4 changes: 2 additions & 2 deletions src/StatisticsAnalysisTool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.15.4.*")]
[assembly: AssemblyFileVersion("5.15.4.0")]
[assembly: AssemblyVersion("5.15.5.*")]
[assembly: AssemblyFileVersion("5.15.5.0")]

0 comments on commit 8a66618

Please sign in to comment.