Beispiel #1
0
        /// <summary>
        /// Whether the given lootable contains quest items for the given Character when looting with the given type
        /// </summary>
        public static bool ContainsQuestItemsFor(this ILootable lootable, Character chr, LootEntryType type)
        {
            Asda2Loot loot = lootable.Loot;

            if (loot != null)
            {
                return(((IEnumerable <Asda2LootItem>)loot.Items).Any <Asda2LootItem>((Func <Asda2LootItem, bool>)(item =>
                {
                    if (item.Template.HasQuestRequirements)
                    {
                        return item.Template.CheckQuestConstraints(chr);
                    }
                    return false;
                })));
            }
            ResolvedLootItemList entries = lootable.GetEntries(type);

            if (entries != null)
            {
                return(entries.Any <LootEntity>((Func <LootEntity, bool>)(entry =>
                {
                    if (entry.ItemTemplate.HasQuestRequirements)
                    {
                        return entry.ItemTemplate.CheckQuestConstraints(chr);
                    }
                    return false;
                })));
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>Generates loot for Items and GOs.</summary>
        /// <param name="lootable">The Object or Unit that is being looted</param>
        /// <returns>The object's loot or null if there is nothing to get or the given Character can't access the loot.</returns>
        public static ObjectLoot CreateAndSendObjectLoot(ILootable lootable, Character initialLooter,
                                                         LootEntryType type, bool heroic)
        {
            Asda2Loot loot = initialLooter.LooterEntry.Loot;

            if (loot != null)
            {
                loot.ForceDispose();
            }
            LootMgr.FindLooters(lootable, initialLooter);
            return(LootMgr.CreateLoot <ObjectLoot>(lootable, initialLooter, type, heroic, MapId.Silaris));
        }