Exemple #1
0
        /// <summary>
        /// Returns the loot for the given Mob
        /// </summary>
        /// <param name="mob"></param>
        /// <param name="killer"></param>
        /// <returns></returns>
        public static ItemTemplate[] GetLoot(GameNPC mob, GameObject killer)
        {
            LootList lootList   = null;
            IList    generators = GetLootGenerators(mob);

            foreach (ILootGenerator generator in generators)
            {
                try
                {
                    if (lootList == null)
                    {
                        lootList = generator.GenerateLoot(mob, killer);
                    }
                    else
                    {
                        lootList.AddAll(generator.GenerateLoot(mob, killer));
                    }
                }
                catch (Exception e)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("GetLoot", e);
                    }
                }
            }
            if (lootList != null)
            {
                return(lootList.GetLoot());
            }
            else
            {
                return(new ItemTemplate[0]);
            }
        }
        public void GenerateROG(GamePlayer player, eObjectType objectType, eSlot slot)
        {
            player.RemoveBountyPoints(100);
            GameNPC mob = new GameNPC();

            mob.Name            = "Unique Object";
            mob.CurrentRegionID = 1;
            mob.Level           = (byte)(player.Level);
            if (mob.Level > 50)
            {
                mob.Level = 51;
            }

            LootList   lootlist = new LootList();
            ItemUnique item     = null;

            item             = new ItemUnique();
            item.Object_Type = (int)objectType;
            item.Item_Type   = (int)slot;

            mob.Level           = 60;
            mob.Name            = "TOA Mob";
            mob.CurrentRegionID = 30;
            mob.Z = 9999;
            lootlist.AddFixed(LootGeneratorUniqueObject.GenerateUniqueItem(mob, player, item), 1);
            foreach (ItemUnique unique in lootlist.GetLoot())
            {
                unique.Price = 0;
                GameServer.Database.AddObject(unique);
                InventoryItem invitem = GameInventoryItem.Create <ItemUnique>(unique);
                player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, invitem);
                player.Out.SendMessage("Generated: " + unique.Name, eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
        }