예제 #1
0
        public static string CreatureEquip(Dictionary <WowGuid, Unit> units)
        {
            if (units.Count == 0)
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_equip_template))
            {
                return(string.Empty);
            }

            var equips = new DataBag <CreatureEquipment>();

            foreach (var npc in units)
            {
                if (Settings.AreaFilters.Length > 0)
                {
                    if (!(npc.Value.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters)))
                    {
                        continue;
                    }
                }

                if (Settings.MapFilters.Length > 0)
                {
                    if (!(npc.Value.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters)))
                    {
                        continue;
                    }
                }

                var equipment = npc.Value.UnitData.VirtualItems;
                if (equipment.Length != 3)
                {
                    continue;
                }

                if (equipment[0].ItemID == 0 && equipment[1].ItemID == 0 && equipment[2].ItemID == 0)
                {
                    continue;
                }

                var equip = new CreatureEquipment
                {
                    CreatureID = npc.Key.GetEntry(),
                    ItemID1    = (uint)equipment[0].ItemID,
                    ItemID2    = (uint)equipment[1].ItemID,
                    ItemID3    = (uint)equipment[2].ItemID,

                    AppearanceModID1 = equipment[0].ItemAppearanceModID,
                    AppearanceModID2 = equipment[1].ItemAppearanceModID,
                    AppearanceModID3 = equipment[2].ItemAppearanceModID,

                    ItemVisual1 = equipment[0].ItemVisual,
                    ItemVisual2 = equipment[1].ItemVisual,
                    ItemVisual3 = equipment[2].ItemVisual
                };


                if (equips.Contains(equip))
                {
                    continue;
                }

                for (uint i = 1;; i++)
                {
                    equip.ID = i;
                    if (!equips.ContainsKey(equip))
                    {
                        break;
                    }
                }

                equips.Add(equip);
            }

            var equipsDb = SQLDatabase.Get(equips);

            return(SQLUtil.Compare(equips, equipsDb, StoreNameType.Unit));
        }
예제 #2
0
        public static string CreatureEquip(Dictionary<WowGuid, Unit> units)
        {
            if (units.Count == 0)
                return string.Empty;

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_equip_template))
                return string.Empty;

            var equips = new DataBag<CreatureEquipment>();
            foreach (var npc in units)
            {
                if (Settings.AreaFilters.Length > 0)
                    if (!(npc.Value.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters)))
                        continue;

                if (Settings.MapFilters.Length > 0)
                    if (!(npc.Value.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters)))
                        continue;

                if (npc.Value.Equipment == null || npc.Value.Equipment.Length != 3)
                    continue;

                if (npc.Value.Equipment[0] == 0 && npc.Value.Equipment[1] == 0 && npc.Value.Equipment[2] == 0)
                    continue;

                var equip = new CreatureEquipment
                {
                    CreatureID = npc.Key.GetEntry(),
                    ItemID1 = npc.Value.Equipment[0],
                    ItemID2 = npc.Value.Equipment[1],
                    ItemID3 = npc.Value.Equipment[2]
                };

                if (equips.Contains(equip))
                    continue;

                for (uint i = 1;; i++)
                {
                    equip.ID = i;
                    if (!equips.ContainsKey(equip))
                        break;
                }

                equips.Add(equip);
            }

            var equipsDb = SQLDatabase.Get(equips);
            return SQLUtil.Compare(equips, equipsDb, StoreNameType.Unit);
        }
예제 #3
0
        public static string CreatureEquip(Dictionary <WowGuid, Unit> units)
        {
            if (units.Count == 0)
            {
                return(string.Empty);
            }

            if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_equip_template))
            {
                return(string.Empty);
            }

            var equips = new DataBag <CreatureEquipment>();

            foreach (KeyValuePair <WowGuid, Unit> npc in units)
            {
                if (Settings.AreaFilters.Length > 0)
                {
                    if (!(npc.Value.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters)))
                    {
                        continue;
                    }
                }

                if (Settings.MapFilters.Length > 0)
                {
                    if (!(npc.Value.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters)))
                    {
                        continue;
                    }
                }

                if (npc.Value.Equipment == null || npc.Value.Equipment.Length != 3)
                {
                    continue;
                }

                if (npc.Value.Equipment[0] == 0 && npc.Value.Equipment[1] == 0 && npc.Value.Equipment[2] == 0)
                {
                    continue;
                }

                CreatureEquipment equip = new CreatureEquipment
                {
                    CreatureID = npc.Key.GetEntry(),
                    ItemID1    = npc.Value.Equipment[0],
                    ItemID2    = npc.Value.Equipment[1],
                    ItemID3    = npc.Value.Equipment[2]
                };

                if (equips.Contains(equip))
                {
                    continue;
                }

                for (uint i = 1;; i++)
                {
                    equip.ID = i;
                    if (!equips.ContainsKey(equip))
                    {
                        break;
                    }
                }

                equips.Add(equip);
            }

            var equipsDb = SQLDatabase.Get(equips);

            return(SQLUtil.Compare(equips, equipsDb, StoreNameType.Unit));
        }