Exemple #1
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 ObjectLoot CreateAndSendObjectLoot(ILootable lootable, Character initialLooter,
                                                         LootEntryType type, bool heroic)
        {
            var oldLoot = initialLooter.LooterEntry.Loot;

            if (oldLoot != null)
            {
                oldLoot.ForceDispose();
            }
            var looters = FindLooters(lootable, initialLooter);

            var loot = CreateLoot <ObjectLoot>(lootable, initialLooter, type, heroic, 0);            // TODO: pass mapid

            if (loot != null)
            {
                initialLooter.LooterEntry.Loot = loot;
                loot.Initialize(initialLooter, looters, 0);                 // TODO: pass mapid
                LootHandler.SendLootResponse(initialLooter, loot);
            }
            else
            {
                //lootable.OnFinishedLooting();
                // empty Item -> Don't do anything
            }
            return(loot);
        }
Exemple #2
0
        public override bool Use(Character user)
        {
            if (m_go.Entry.IsConsumable)
            {
                m_go.State = GameObjectState.Disabled;
            }

            if (m_go.Loot != null)
            {
                LootHandler.SendLootResponse(user, m_go.Loot);
            }
            else
            {
                LootMgr.CreateAndSendObjectLoot(m_go, user, LootEntryType.GameObject, user.Map.IsHeroic);
            }
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Requires loot to already be generated
        /// </summary>
        /// <param name="lootable"></param>
        public void TryLoot(ILootable lootable)
        {
            Release();             // make sure that the Character is not still looting something else

            var loot = lootable.Loot;

            if (loot == null)
            {
                LootHandler.SendLootFail(m_owner, lootable);
                // TODO: Kneel and unkneel?
            }
            else if (MayLoot(loot))
            {
                // we are either already a looter or become a new one
                m_owner.CancelAllActions();
                Loot = loot;

                LootHandler.SendLootResponse(m_owner, loot);
            }
            else
            {
                LootHandler.SendLootFail(m_owner, lootable);
            }
        }