#pragma warning disable 1718
        public static void DumpItems(DumpItemLocation location)
        {
            ZetaDia.Actors.Update();
            using (ZetaDia.Memory.SaveCacheState())
            {
                ZetaDia.Memory.TemporaryCacheState(false);

                List <ACDItem> itemList = new List <ACDItem>();

                switch (location)
                {
                case DumpItemLocation.All:
                    itemList = ZetaDia.Actors.GetActorsOfType <ACDItem>(true).OrderBy(i => i.InventorySlot).ThenBy(i => i.Name).ToList();
                    break;

                case DumpItemLocation.Backpack:
                    itemList = ZetaDia.Me.Inventory.Backpack.ToList();
                    break;

                case DumpItemLocation.Merchant:
                    itemList = ZetaDia.Me.Inventory.MerchantItems.ToList();
                    break;

                case DumpItemLocation.Ground:
                    itemList = ZetaDia.Actors.GetActorsOfType <DiaItem>(true).Select(i => i.CommonData).ToList();
                    break;

                case DumpItemLocation.Equipped:
                    itemList = ZetaDia.Me.Inventory.Equipped.ToList();
                    break;

                case DumpItemLocation.Stash:
                    if (UIElements.StashWindow.IsVisible)
                    {
                        itemList = ZetaDia.Me.Inventory.StashItems.ToList();
                    }
                    else
                    {
                        Logger.Log("Stash window not open!");
                    }
                    break;
                }


                foreach (var item in itemList.OrderBy(i => i.InventorySlot).ThenBy(i => i.Name))
                {
                    try
                    {
                        string itemName = string.Format("\nName={0} InternalName={1} ActorSNO={2} DynamicID={3} InventorySlot={4}",
                                                        item.Name, item.InternalName, item.ActorSNO, item.DynamicId, item.InventorySlot);

                        Logger.Log(itemName);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception reading Basic Item Info\n{0}", ex.ToString());
                    }
                    try
                    {
                        foreach (object val in Enum.GetValues(typeof(ActorAttributeType)))
                        {
                            int   iVal = item.GetAttribute <int>((ActorAttributeType)val);
                            float fVal = item.GetAttribute <float>((ActorAttributeType)val);

                            if (iVal > 0 || fVal > 0)
                            {
                                Logger.Log("Attribute: {0}, iVal: {1}, fVal: {2}", val, iVal, (fVal != fVal) ? "" : fVal.ToString());
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception reading attributes for {0}\n{1}", item.Name, ex.ToString());
                    }

                    try
                    {
                        foreach (var stat in Enum.GetValues(typeof(ItemStats.Stat)).Cast <ItemStats.Stat>())
                        {
                            float fStatVal = item.Stats.GetStat <float>(stat);
                            int   iStatVal = item.Stats.GetStat <int>(stat);
                            if (fStatVal > 0 || iStatVal > 0)
                            {
                                Logger.Log("Stat {0}={1}f ({2})", stat, fStatVal, iStatVal);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception reading Item Stats\n{0}", ex.ToString());
                    }

                    try
                    {
                        Logger.Log("Link Color ItemQuality=" + item.ItemLinkColorQuality());
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception reading Item Link\n{0}", ex.ToString());
                    }

                    try
                    {
                        PrintObjectProperties(item);
                    }
                    catch (Exception ex)
                    {
                        Logger.Log("Exception reading Item Properties\n{0}", ex.ToString());
                    }
                }
            }
        }
示例#2
0
        public static void DumpItems(DumpItemLocation location)
        {
            using (ZetaDia.Memory.SaveCacheState())
            {
                ZetaDia.Memory.TemporaryCacheState(false);

                List <ItemWrapper> itemList = new List <ItemWrapper>();

                switch (location)
                {
                case DumpItemLocation.All:
                    itemList = ZetaDia.Actors.GetActorsOfType <ACDItem>(true).Select(i => new ItemWrapper(i)).OrderBy(i => i.InventorySlot).ThenBy(i => i.Name).ToList();
                    break;

                case DumpItemLocation.Backpack:
                    itemList = InventoryManager.Backpack.Select(i => new ItemWrapper(i)).ToList();
                    break;

                case DumpItemLocation.Merchant:
                    itemList = InventoryManager.MerchantItems.Select(i => new ItemWrapper(i)).ToList();
                    break;

                case DumpItemLocation.Ground:
                    itemList = ZetaDia.Actors.GetActorsOfType <DiaItem>(true).Select(i => new ItemWrapper(i.CommonData)).ToList();
                    break;

                case DumpItemLocation.Equipped:
                    itemList = InventoryManager.Equipped.Select(i => new ItemWrapper(i)).ToList();
                    break;

                case DumpItemLocation.Stash:
                    if (UIElements.StashWindow.IsVisible)
                    {
                        itemList = InventoryManager.StashItems.Select(i => new ItemWrapper(i)).ToList();
                    }
                    else
                    {
                        Core.Logger.Log("Stash window not open!");
                    }
                    break;
                }

                itemList.RemoveAll(i => i == null);
                //itemList.RemoveAll(i => !i.IsValid);

                foreach (var item in itemList.OrderBy(i => i.InventorySlot).ThenBy(i => i.Name))
                {
                    try
                    {
                        string itemName = $"\nName={item.Name} InternalName={item.InternalName} ActorSnoId={item.ActorSnoId} DynamicID={item.DynamicId} InventorySlot={item.InventorySlot}";

                        Core.Logger.Log(itemName);
                    }
                    catch (Exception ex)
                    {
                        Core.Logger.Log("Exception reading Basic Item Info\n{0}", ex.ToString());
                    }
                    try
                    {
                        foreach (object val in Enum.GetValues(typeof(ActorAttributeType)))
                        {
                            int   iVal = item.Item.GetAttribute <int>((ActorAttributeType)val);
                            float fVal = item.Item.GetAttribute <float>((ActorAttributeType)val);

                            if (iVal > 0 || fVal > 0)
                            {
                                Core.Logger.Log("Attribute: {0}, iVal: {1}, fVal: {2}", val, iVal, fVal.ToString(CultureInfo.InvariantCulture));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Core.Logger.Log("Exception reading attributes for {0}\n{1}", item.Name, ex.ToString());
                    }

                    try
                    {
                        foreach (var stat in Enum.GetValues(typeof(ItemStats.Stat)).Cast <ItemStats.Stat>())
                        {
                            float fStatVal = item.Stats.GetStat <float>(stat);
                            int   iStatVal = item.Stats.GetStat <int>(stat);
                            if (fStatVal > 0 || iStatVal > 0)
                            {
                                Core.Logger.Log("Stat {0}={1}f ({2})", stat, fStatVal, iStatVal);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Core.Logger.Log("Exception reading Item Stats\n{0}", ex.ToString());
                    }

                    try
                    {
                        Core.Logger.Log("Link Color ItemQuality=" + item.Item.GetItemQuality());
                    }
                    catch (Exception ex)
                    {
                        Core.Logger.Log("Exception reading Item Link\n{0}", ex.ToString());
                    }

                    try
                    {
                        PrintObjectProperties(item);
                    }
                    catch (Exception ex)
                    {
                        Core.Logger.Log("Exception reading Item PropertyLoader\n{0}", ex.ToString());
                    }
                }
            }
        }