Esempio n. 1
0
        /// <summary>
        /// Returns whether the given looter may loot the given Item.
        /// Make sure the Looter is logged in before calling this Method.
        ///
        /// TODO: Find the right error messages
        /// TODO: Only give every MultiLoot item to everyone once! Also check for quest-dependencies etc.
        /// </summary>
        public InventoryError CheckTakeItemConditions(LooterEntry looter, LootItem item)
        {
            if (item.Taken)
            {
                return(InventoryError.ALREADY_LOOTED);
            }
            if (item.RollProgress != null)
            {
                return(InventoryError.DONT_OWN_THAT_ITEM);
            }
            if (!looter.MayLoot(this))
            {
                return(InventoryError.DontReport);
            }
            ICollection <LooterEntry> multiLooters = item.MultiLooters;

            if (multiLooters != null)
            {
                if (multiLooters.Contains(looter))
                {
                    return(InventoryError.OK);
                }
                if (looter.Owner != null)
                {
                    LootHandler.SendLootRemoved(looter.Owner, item.Index);
                }
                return(InventoryError.DONT_OWN_THAT_ITEM);
            }

            return(!item.Template.CheckLootConstraints(looter.Owner) || this.Method != LootMethod.FreeForAll &&
                   (item.Template.Quality > this.Group.LootThreshold && !item.Passed ||
                    this.Group.MasterLooter != null && this.Group.MasterLooter != looter.Owner.GroupMember)
                ? InventoryError.DONT_OWN_THAT_ITEM
                : InventoryError.OK);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns whether the given looter may loot the given Item.
        /// Make sure the Looter is logged in before calling this Method.
        ///
        /// TODO: Find the right error messages
        /// TODO: Only give every MultiLoot item to everyone once! Also check for quest-dependencies etc.
        /// </summary>
        public InventoryError CheckTakeItemConditions(Asda2LooterEntry looter, Asda2LootItem item)
        {
            if (item.Taken)
            {
                return(InventoryError.ALREADY_LOOTED);
            }
            if (!looter.MayLoot(this))
            {
                return(InventoryError.DontReport);
            }
            ICollection <Asda2LooterEntry> multiLooters = item.MultiLooters;

            if (multiLooters != null)
            {
                if (multiLooters.Contains(looter))
                {
                    return(InventoryError.OK);
                }
                if (looter.Owner != null)
                {
                    LootHandler.SendLootRemoved(looter.Owner, item.Index);
                }
                return(InventoryError.DONT_OWN_THAT_ITEM);
            }

            if (!item.Template.CheckLootConstraints(looter.Owner))
            {
                return(InventoryError.DONT_OWN_THAT_ITEM);
            }
            int method = (int)this.Method;

            return(InventoryError.OK);
        }
Esempio n. 3
0
        /// <summary>
        /// Returns whether the given looter may loot the given Item.
        /// Make sure the Looter is logged in before calling this Method.
        ///
        /// TODO: Find the right error messages
        /// TODO: Only give every MultiLoot item to everyone once! Also check for quest-dependencies etc.
        /// </summary>
        public InventoryError CheckTakeItemConditions(LooterEntry looter, LootItem item)
        {
            if (item.Taken)
            {
                return(InventoryError.ALREADY_LOOTED);
            }
            if (item.RollProgress != null)
            {
                // TODO: Still being rolled for
                return(InventoryError.DONT_OWN_THAT_ITEM);
            }
            if (!looter.MayLoot(this))
            {
                return(InventoryError.DontReport);
            }

            var multiLooters = item.MultiLooters;

            if (multiLooters != null)
            {
                if (!multiLooters.Contains(looter))
                {
                    if (looter.Owner != null)
                    {
                        // make sure, Item cannot be seen by client anymore
                        LootHandler.SendLootRemoved(looter.Owner, item.Index);
                    }
                    return(InventoryError.DONT_OWN_THAT_ITEM);
                }
                return(InventoryError.OK);
            }

            if (!item.Template.CheckLootConstraints(looter.Owner))
            {
                return(InventoryError.DONT_OWN_THAT_ITEM);
            }

            if (Method != LootMethod.FreeForAll)
            {
                // definitely Group-Loot
                if ((item.Template.Quality > Group.LootThreshold && !item.Passed) ||
                    (Group.MasterLooter != null &&
                     Group.MasterLooter != looter.Owner.GroupMember))
                {
                    return(InventoryError.DONT_OWN_THAT_ITEM);
                }
            }

            return(InventoryError.OK);
        }
Esempio n. 4
0
        /// <summary>
        /// Marks the given Item as taken and removes it from the list of available Items
        /// </summary>
        /// <param name="lootItem"></param>
        public void RemoveItem(LootItem lootItem)
        {
            lootItem.Taken = true;
            ++this.m_takenCount;
            foreach (LooterEntry looter in (IEnumerable <LooterEntry>) this.Looters)
            {
                if (looter.Owner != null)
                {
                    LootHandler.SendLootRemoved(looter.Owner, lootItem.Index);
                }
            }

            this.CheckFinished();
        }
Esempio n. 5
0
        /// <summary>
        /// Marks the given Item as taken and removes it from the list of available Items
        /// </summary>
        /// <param name="lootItem"></param>
        public void RemoveItem(LootItem lootItem)
        {
            lootItem.Taken = true;
            ++m_takenCount;
            foreach (LooterEntry looter in Looters)
            {
                if (looter.Owner != null)
                {
                    LootHandler.SendLootRemoved(looter.Owner, lootItem.Index);
                }
            }

            CheckFinished();
        }
Esempio n. 6
0
        /// <summary>
        /// Marks the given Item as taken and removes it from the list of available Items
        /// </summary>
        /// <param name="lootItem"></param>
        public void RemoveItem(LootItem lootItem)
        {
            lootItem.Taken = true;
            m_takenCount++;

            // TODO: Have correct collection of all observing Characters
            foreach (var looter in Looters)
            {
                if (looter.Owner != null)
                {
                    LootHandler.SendLootRemoved(looter.Owner, lootItem.Index);
                }
            }
            CheckFinished();
        }