Exemple #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);
        }
Exemple #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(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);
        }
Exemple #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;
        }