예제 #1
0
 public override void SetDefaults(Item item)
 {
     if (Main.rand is LootUnifiedRandom)
     {
         LootUnifiedRandom.SetItem(item);
     }
 }
예제 #2
0
        public static List <NPCDropInfo> GetNPCDropInfoList()
        {
            List <NPCDropInfo> result = new List <NPCDropInfo>();

            var  rand       = Main.rand;
            bool expertMode = Main.expertMode;

            Main.rand       = new LootUnifiedRandom();
            Main.expertMode = false;

            for (int netID = -65; netID < NPCLoader.NPCCount; netID++)
            //int netID = 1;
            {
                NPC npc = new NPC();
                npc.SetDefaults(netID);
                for (int i = 0; i < 100; i++)
                {
                    try
                    {
                        LootUnifiedRandom.NextLoop(i);
                        npc.NPCLoot();
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine($"{netID}: {ex.Message}");
                    }
                }
                var info = new NPCDropInfo(npc);
                foreach (var a in LootUnifiedRandom.list)
                {
                    foreach (var b in a.list.Where(x => 0 < x.items.Count))
                    {
                        var list = new DropItemList();
                        list.rate   = b.maxValue;
                        list.expert = Main.expertMode;
                        foreach (var c in b.items)
                        {
                            if (!info.list.Any(x => x.items.Any(y => y.id == c.Value.netID)) && !list.items.Any(x => x.id == c.Value.netID))
                            {
                                list.items.Add(new DropItem(c.Value));
                            }
                        }
                        if (0 < list.items.Count)
                        {
                            info.list.Add(list);
                        }
                    }
                }
                if (0 < info.list.Count)
                {
                    result.Add(info);
                }
            }
            Main.rand       = rand;
            Main.expertMode = expertMode;

            return(result);
        }