Beispiel #1
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);
        }
Beispiel #2
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 #3
0
        void FillNotNormalLootFor(Player player, bool presentAtLooting)
        {
            ObjectGuid plguid = player.GetGUID();

            var questItemList = PlayerQuestItems.LookupByKey(plguid);

            if (questItemList.Empty())
            {
                FillQuestLoot(player);
            }

            questItemList = PlayerFFAItems.LookupByKey(plguid);
            if (questItemList.Empty())
            {
                FillFFALoot(player);
            }

            questItemList = PlayerNonQuestNonFFAConditionalItems.LookupByKey(plguid);
            if (questItemList.Empty())
            {
                FillNonQuestNonFFAConditionalLoot(player, presentAtLooting);
            }

            // if not auto-processed player will have to come and pick it up manually
            if (!presentAtLooting)
            {
                return;
            }

            // Process currency items
            uint     max_slot  = GetMaxSlotInLootFor(player);
            LootItem item      = null;
            int      itemsSize = items.Count;

            for (byte i = 0; i < max_slot; ++i)
            {
                if (i < items.Count)
                {
                    item = items[i];
                }
                else
                {
                    item = quest_items[i - itemsSize];
                }

                if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player))
                {
                    ItemTemplate proto = Global.ObjectMgr.GetItemTemplate(item.itemid);
                    if (proto != null)
                    {
                        if (proto.IsCurrencyToken())
                        {
                            player.StoreLootItem(i, this);
                        }
                    }
                }
            }
        }
Beispiel #4
0
        List <NotNormalLootItem> FillQuestLoot(Player player)
        {
            if (items.Count == SharedConst.MaxNRLootItems)
            {
                return(null);
            }

            List <NotNormalLootItem> ql = new List <NotNormalLootItem>();

            for (byte i = 0; i < quest_items.Count; ++i)
            {
                LootItem item = quest_items[i];

                if (!item.is_looted && (item.AllowedForPlayer(player) || (item.follow_loot_rules && player.GetGroup() && ((player.GetGroup().GetLootMethod() == LootMethod.MasterLoot &&
                                                                                                                           player.GetGroup().GetMasterLooterGuid() == player.GetGUID()) || player.GetGroup().GetLootMethod() != LootMethod.MasterLoot))))
                {
                    ql.Add(new NotNormalLootItem(i));

                    // quest items get blocked when they first appear in a
                    // player's quest vector
                    //
                    // increase once if one looter only, looter-times if free for all
                    if (item.freeforall || !item.is_blocked)
                    {
                        ++unlootedCount;
                    }
                    if (!player.GetGroup() || player.GetGroup().GetLootMethod() != LootMethod.GroupLoot)
                    {
                        item.is_blocked = true;
                    }

                    if (items.Count + ql.Count == SharedConst.MaxNRLootItems)
                    {
                        break;
                    }
                }
            }
            if (ql.Empty())
            {
                return(null);
            }

            PlayerQuestItems[player.GetGUID()] = ql;
            return(ql);
        }
Beispiel #5
0
        List <NotNormalLootItem> FillFFALoot(Player player)
        {
            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))
                {
                    ql.Add(new NotNormalLootItem(i));
                    ++unlootedCount;
                }
            }
            if (ql.Empty())
            {
                return(null);
            }


            PlayerFFAItems[player.GetGUID()] = ql;
            return(ql);
        }