Ejemplo n.º 1
0
        public static DM_Gatherable ParseGatherable(Gatherable gatherable)
        {
            var gatherableHolder = new DM_Gatherable
            {
                Name   = gatherable.Name?.Trim(),
                ItemID = gatherable.ItemID
            };

            if (At.GetField(gatherable as SelfFilledItemContainer, "m_drops") is List <Dropable> droppers)
            {
                if (droppers == null || droppers.Count < 1)
                {
                    //SL.LogWarning("droppers is null or list count is 0!");
                }
                else
                {
                    foreach (Dropable dropper in droppers)
                    {
                        var dropableHolder = DM_DropTable.ParseDropable(dropper);
                        gatherableHolder.DropTables.Add(dropableHolder.Name);
                    }
                }
            }

            if (gatherableHolder.Name == "Fish")
            {
                gatherableHolder.Name = "Fishing Spot (" + gatherableHolder.DropTables[0] + ")";
            }

            if (gatherableHolder.Name.Contains("vein"))
            {
                gatherableHolder.Name.Replace("vein", "Vein");

                if (gatherableHolder.Name.Contains("Iron") || gatherableHolder.Name == "Palladium")
                {
                    foreach (var table in gatherableHolder.DropTables)
                    {
                        if (table.Contains("Tourmaline"))
                        {
                            gatherableHolder.Name += " (Tourmaline)";
                            break;
                        }
                    }
                }
            }

            return(gatherableHolder);
        }
Ejemplo n.º 2
0
        // Parse Loot
        public static void ParseAllLoot()
        {
            var allitems = Resources.FindObjectsOfTypeAll(typeof(Item)) as Item[];

            foreach (Item item in allitems.Where(x => IsValidLoot(x)))
            {
                var summary = ListManager.SceneSummaries[ListManager.GetSceneSummaryKey(item.transform.position)];

                if (item is SelfFilledItemContainer)
                {
                    if (item is TreasureChest)
                    {
                        var lootContainer = DM_LootContainer.ParseLootContainer(item as TreasureChest);
                        AddQuantity(lootContainer.Name, summary.Loot_Containers);

                        ListManager.AddContainerSummary(
                            lootContainer.Name,
                            ListManager.GetSceneSummaryKey(item.transform.position),
                            lootContainer.DropTables,
                            Instance.GetCurrentLocation(item.transform.position)
                            );

                        if (!summary.UniqueContainerList.Contains(lootContainer.Name + "_" + lootContainer.UID))
                        {
                            summary.UniqueContainerList.Add(lootContainer.Name + "_" + lootContainer.UID);
                        }
                    }
                    else if (item is Gatherable)
                    {
                        var gatherableHolder = DM_Gatherable.ParseGatherable(item as Gatherable);
                        AddQuantity(gatherableHolder.Name, summary.Gatherables);

                        ListManager.AddContainerSummary(
                            gatherableHolder.Name,
                            ListManager.GetSceneSummaryKey(item.transform.position),
                            gatherableHolder.DropTables,
                            Instance.GetCurrentLocation(item.transform.position)
                            );
                    }
                    else
                    {
                        SL.LogWarning("[ParseLoot] Unsupported ItemContainer: " + item.Name + ", typeof: " + item.GetType());
                    }
                }
                else
                {
                    // item spawn
                    bool newHolder = true;
                    foreach (DM_ItemSpawn holder in summary.Item_Spawns)
                    {
                        if (holder.Item_ID == item.ItemID)
                        {
                            newHolder = false;
                            holder.Quantity++;
                            holder.positions.Add(item.transform.position);
                            break;
                        }
                    }
                    if (newHolder)
                    {
                        summary.Item_Spawns.Add(new DM_ItemSpawn
                        {
                            Name      = item.Name?.Trim(),
                            Item_ID   = item.ItemID,
                            Quantity  = 1,
                            positions = new List <Vector3>
                            {
                                item.transform.position
                            }
                        });
                    }

                    //AddItemSpawnSource(item.ItemID, item.Name, item.transform.position);
                }
            }
        }