Beispiel #1
0
        List <QuestItem> FillNonQuestNonFFAConditionalLoot(Player player, bool presentAtLooting)
        {
            List <QuestItem> ql = new List <QuestItem>();

            for (byte i = 0; i < items.Count; ++i)
            {
                LootItem item = items[i];
                if (!item.is_looted && !item.freeforall && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player.GetGroup() != null &&
                                                                                              ((player.GetGroup().GetLootMethod() == LootMethod.MasterLoot && player.GetGroup().GetLooterGuid() == player.GetGUID()) || player.GetGroup().GetLootMethod() != LootMethod.MasterLoot))))
                {
                    if (presentAtLooting)
                    {
                        item.AddAllowedLooter(player);
                    }
                    if (!item.conditions.Empty())
                    {
                        ql.Add(new QuestItem(i));
                        if (!item.is_counted)
                        {
                            ++unlootedCount;
                            item.is_counted = true;
                        }
                    }
                }
            }
            if (ql.Empty())
            {
                return(null);
            }

            PlayerNonQuestNonFFAConditionalItems[player.GetGUID()] = ql;
            return(ql);
        }
Beispiel #2
0
        List <NotNormalLootItem> FillNonQuestNonFFAConditionalLoot(Player player, bool presentAtLooting)
        {
            List <NotNormalLootItem> ql = new List <NotNormalLootItem>();

            for (byte i = 0; i < items.Count; ++i)
            {
                LootItem item = items[i];
                if (!item.is_looted && !item.freeforall && item.AllowedForPlayer(player))
                {
                    if (presentAtLooting)
                    {
                        item.AddAllowedLooter(player);
                    }
                    if (!item.conditions.Empty())
                    {
                        ql.Add(new NotNormalLootItem(i));
                        if (!item.is_counted)
                        {
                            ++unlootedCount;
                            item.is_counted = true;
                        }
                    }
                }
            }
            if (ql.Empty())
            {
                return(null);
            }

            PlayerNonQuestNonFFAConditionalItems[player.GetGUID()] = ql;
            return(ql);
        }
        public bool LoadStoredLoot(Item item, Player player)
        {
            Loot loot = item.loot;

            if (!_lootItemStorage.ContainsKey(loot.containerID.GetCounter()))
            {
                return(false);
            }

            var container = _lootItemStorage[loot.containerID.GetCounter()];

            loot.gold = container.GetMoney();

            LootTemplate lt = LootStorage.Items.GetLootFor(item.GetEntry());

            if (lt != null)
            {
                foreach (var storedItemPair in container.GetLootItems())
                {
                    LootItem li = new LootItem();
                    li.itemid            = storedItemPair.Key;
                    li.count             = (byte)storedItemPair.Value.Count;
                    li.follow_loot_rules = storedItemPair.Value.FollowRules;
                    li.freeforall        = storedItemPair.Value.FFA;
                    li.is_blocked        = storedItemPair.Value.Blocked;
                    li.is_counted        = storedItemPair.Value.Counted;
                    li.is_underthreshold = storedItemPair.Value.UnderThreshold;
                    li.needs_quest       = storedItemPair.Value.NeedsQuest;
                    li.randomBonusListId = storedItemPair.Value.RandomBonusListId;
                    li.context           = storedItemPair.Value.Context;
                    li.BonusListIDs      = storedItemPair.Value.BonusListIDs;

                    // Copy the extra loot conditions from the item in the loot template
                    lt.CopyConditions(li);

                    // If container item is in a bag, add that player as an allowed looter
                    if (item.GetBagSlot() != 0)
                    {
                        li.AddAllowedLooter(player);
                    }

                    // Finally add the LootItem to the container
                    loot.items.Add(li);

                    // Increment unlooted count
                    ++loot.unlootedCount;
                }
            }

            // Mark the item if it has loot so it won't be generated again on open
            item.m_lootGenerated = true;
            return(true);
        }