Refactor inventory node loading logic
Simplifies the inventory node loading by replacing type checks with a string comparison on the entry type name. Removes redundant else-if block and ensures all entries are processed consistently.
This commit is contained in:
parent
70c1dcc86c
commit
e14ba787d4
1 changed files with 4 additions and 7 deletions
|
|
@ -1124,16 +1124,13 @@ namespace SecondBotEvents.Commands
|
|||
List<InventoryBase> folderlist = GetClient().Inventory.Store.GetContents(folder);
|
||||
foreach (InventoryBase entry in folderlist)
|
||||
{
|
||||
|
||||
if (entry is InventoryFolder)
|
||||
string entrytype = entry.GetType().Name.Replace("Inventory", "");
|
||||
if (entrytype == "Folder")
|
||||
{
|
||||
myentry.Children.Add(LoadInventoryNode(entry.UUID, entry.Name));
|
||||
continue;
|
||||
}
|
||||
else if (entry is InventoryItem)
|
||||
{
|
||||
string entrytype = entry.GetType().Name.Replace("Inventory", "");
|
||||
myentry.Children.Add(new InventoryNodeEntry() { Children = null, InventoryType = entrytype, Name = entry.Name, UUID = entry.UUID.ToString() });
|
||||
}
|
||||
myentry.Children.Add(new InventoryNodeEntry() { Children = null, InventoryType = entrytype, Name = entry.Name, UUID = entry.UUID.ToString() });
|
||||
}
|
||||
return myentry;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue