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

            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);
        }