コード例 #1
0
        private void AutoLootPerform()
        {
            try
            {
                const float MaxLootRange = 10.0f;
                var         canLootGold  = new Character(attachedGame.Game).Gold != 200000000;
                var         ground       = new GroundContainer(attachedGame.Game);

                GroundItem item;
                lock (settingVM.LootInfos)
                    item = ground.GetItems()
                           .Where(x => ShouldLoot(x, canLootGold))
                           .Where(x => x.RelativeDistance <= MaxLootRange)
                           .OrderBy(x => x.RelativeDistance)
                           .FirstOrDefault();

                if (item != null)
                {
                    item.Loot();
                }

                lootedInLastLoop = item != null;
            }
            catch (Exception e)
            {
                Debug.WriteLine($"An exception occured in {nameof(AutoLootPerform)} : {e}");
            }
        }
コード例 #2
0
        private static void DebugLoot()
        {
            var items = new GroundContainer(game).GetItems()
                        .OrderBy(x => x.ItemID)
                        .DistinctBy(x => x.ItemID)
            ;

            foreach (var item in items)
            {
                switch (item.CollectMethod.Value)
                {
                case CollectMethod.Gold: continue;

                case CollectMethod.Resource: continue;
                }

                var filter = new List <Predicate <string> >
                {
                    x => x.Contains("Restoration Powder"),
                    x => x.Contains("Aloeswood Bolus"),
                };
                if (filter.Any(x => x(item.Name.Value.Value)))
                {
                    continue;
                }

                switch (item.ItemID.Value)
                {
                case 0x5DC0:     // LM$ Silver

                case 0x527A:     // Martial God·Ksitigarbha Stele
                case 0x527B:     // Martial God·Ksitigarbha Stone
                case 0x527C:     // Martial God·Steel Stele

                case 0x527E:     // Martial God·Virtuous Stele
                case 0x527F:     // Martial God·Virtuous Stone
                case 0x5280:     // Martial God·Manjushri Stele
                case 0x5281:     // Martial God·Manjushri Stone
                case 0x5282:     // Martial God·Hollow Stele
                case 0x5283:     // Martial God·Hollow Stone
                case 0x5284:     // Martial God·Removal Stele
                case 0x5285:     // Martial God·Removal Stone
                case 0x5286:     // Martial God·Guanyin Stele
                case 0x5287:     // Martial God·Guanyin Stone

                case 0xD6D9:     // g17 Ember
                case 0xD6DA:     // g17 Pearl
                    continue;
                }

                Debug.WriteLine($"case 0x{item.ItemID.Value.ToString("X4")}: // {item.Name.Value}");
            }
        }