Ejemplo n.º 1
0
        public static IList <Asda2LooterEntry> FindLooters(IAsda2Lootable lootable, Character initialLooter)
        {
            List <Asda2LooterEntry> asda2LooterEntryList = new List <Asda2LooterEntry>();

            Asda2LootMgr.FindLooters(lootable, initialLooter, (IList <Asda2LooterEntry>)asda2LooterEntryList);
            return((IList <Asda2LooterEntry>)asda2LooterEntryList);
        }
Ejemplo n.º 2
0
        /// <summary>Generates loot for Items and GOs.</summary>
        /// <param name="lootable">The Object or Unit that is being looted</param>
        /// <returns>The object's loot or null if there is nothing to get or the given Character can't access the loot.</returns>
        public static Asda2ObjectLoot CreateAndSendObjectLoot(IAsda2Lootable lootable, Character initialLooter,
                                                              Asda2LootEntryType type)
        {
            Asda2Loot loot1 = initialLooter.LooterEntry.Loot;

            if (loot1 != null)
            {
                loot1.ForceDispose();
            }
            IList <Asda2LooterEntry> looters = Asda2LootMgr.FindLooters(lootable, initialLooter);
            Asda2ObjectLoot          loot2   =
                Asda2LootMgr.CreateLoot <Asda2ObjectLoot>(lootable, initialLooter, type, MapId.Silaris);

            if (loot2 != null)
            {
                initialLooter.LooterEntry.Loot = (Asda2Loot)loot2;
                loot2.Initialize(initialLooter, looters, MapId.Silaris);
            }

            return(loot2);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new Loot object and returns it or null, if there is nothing to be looted.
        /// </summary>
        /// <typeparam name="T"><see cref="T:WCell.RealmServer.Looting.ObjectLoot" /> or <see cref="T:WCell.RealmServer.Looting.NPCLoot" /></typeparam>
        /// <param name="lootable"></param>
        /// <param name="initialLooter"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static T CreateLoot <T>(IAsda2Lootable lootable, Character initialLooter, Asda2LootEntryType type,
                                       MapId mapid) where T : Asda2Loot, new()
        {
            IList <Asda2LooterEntry> looters = Asda2LootMgr.FindLooters(lootable, initialLooter);
            float dropChanceBoost            = 0.0f;
            float num1 = 0.0f;

            foreach (Asda2LooterEntry asda2LooterEntry in (IEnumerable <Asda2LooterEntry>)looters)
            {
                dropChanceBoost += asda2LooterEntry.Owner.Asda2DropChance - 1f;
                num1            += (float)((double)num1 + (double)asda2LooterEntry.Owner.Asda2GoldAmountBoost - 1.0);
            }

            Asda2LootItem[] lootItems =
                Asda2LootMgr.CreateLootItems(lootable.GetLootId(type), type, looters, dropChanceBoost);
            float num2 = (float)lootable.LootMoney * ((float)Asda2LootMgr.DefaultMoneyDropFactor + num1);

            if (lootItems.Length == 0 && (double)num2 == 0.0 && lootable is GameObject)
            {
                num2 = 1f;
            }
            if (lootItems.Length <= 0 && (double)num2 <= 0.0)
            {
                return(default(T));
            }
            T instance = Activator.CreateInstance <T>();

            instance.Lootable = lootable;
            instance.Money    = (double)num2 > 4294967296.0 ? 1U : (uint)num2;
            instance.Items    = lootItems;
            T obj = instance;

            foreach (Asda2LootItem asda2LootItem in lootItems)
            {
                asda2LootItem.Loot = (Asda2Loot)obj;
            }
            obj.Initialize(initialLooter, looters, mapid);
            return(obj);
        }