Exemple #1
0
        /// <summary>
        /// Create a collection of item drops
        /// </summary>
        /// <param name="mapobject"></param>
        /// <param name="character"></param>
        /// <returns></returns>
        public static LootCollection Create(MapObject mapobject, Character character)
        {
            if (MapObject.IsPlayer(mapobject))
            {
                throw new SystemException("Cannot create loot for mapobjects");
            }

            LootCollection collection = new LootCollection();
            PartySession   party      = character.sessionParty;

            if (party == null)
            {
                collection.LootLeader = character.id;
            }
            else if (party.LootSettings == 3 && party.ItemLeader.currentzone == mapobject.currentzone &&
                     mapobject.currentzone.IsInSightRangeBySquare(mapobject.Position, party.ItemLeader.Position))
            {
                collection.LootLeader = party.ItemLeader.id;
            }
            else
            {
                collection.LootLeader = character.id;
            }


            // Generate loot from base mobs
            foreach (Rag2Item c in Singleton.Itemdrops.FindItemDropsById(mapobject.ModelId, character._DropRate))
            {
                collection.Lootlist.Add(c);
            }

            //Item drops from quest content
            foreach (Rag2Item item in QuestBase.UserQuestLoot(mapobject.ModelId, character))
            {
                collection.Lootlist.Add(item);
            }

            return(collection);
        }