Exemplo n.º 1
0
        public static string ConversationTemplateData()
        {
            var conversations = Storage.Objects.IsEmpty()
                ? new Dictionary <WowGuid, ConversationTemplate>()                                       // empty dict if there are no objects
                : Storage.Objects.Where(
                obj =>
                obj.Value.Item1.Type == ObjectType.Conversation)
                                .OrderBy(pair => pair.Value.Item2)                                      // order by spawn time
                                .ToDictionary(obj => obj.Key, obj => obj.Value.Item1 as ConversationTemplate);

            if (conversations.Count == 0)
            {
                return(string.Empty);
            }

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

            var conversationsData = new DataBag <ConversationTemplate>();

            foreach (var conversation in conversations)
            {
                conversationsData.Add(conversation.Value);
            }

            var templateDb = SQLDatabase.Get(conversationsData);

            return(SQLUtil.Compare(Settings.SQLOrderByKey ? conversationsData.OrderBy(x => x.Item1.Id).ToArray() : conversationsData.ToArray(), templateDb, x => string.Empty));
        }
Exemplo n.º 2
0
        public static string SpellAreaTriggersData()
        {
            var spellareatriggers = Storage.Objects.IsEmpty()
                ? new Dictionary <WowGuid, SpellAreaTrigger>()                                                   // empty dict if there are no objects
                : Storage.Objects.Where(
                obj =>
                obj.Value.Item1.Type == ObjectType.AreaTrigger &&
                !obj.Value.Item1.IsTemporarySpawn())                                                            // remove temporary spawns
                                    .OrderBy(pair => pair.Value.Item2)                                          // order by spawn time
                                    .ToDictionary(obj => obj.Key, obj => obj.Value.Item1 as SpellAreaTrigger);

            if (spellareatriggers.Count == 0)
            {
                return(string.Empty);
            }

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

            var spellareatriggersData = new DataBag <SpellAreaTrigger>();

            foreach (var spellareatrigger in spellareatriggers)
            {
                spellareatriggersData.Add(spellareatrigger.Value);
            }

            var templateDb = SQLDatabase.Get(spellareatriggersData);

            return(SQLUtil.Compare(Settings.SQLOrderByKey ? spellareatriggersData.OrderBy(x => x.Item1.AreaTriggerId).ToArray() : spellareatriggersData.ToArray(), templateDb, x => "SpellId : " + x.spellId.ToString()));
        }
Exemplo n.º 3
0
        public static string AreaTriggerCreatePropertiesData()
        {
            var spellareatriggers = Storage.Objects.IsEmpty()
                ? new Dictionary <WowGuid, AreaTriggerCreateProperties>()                                        // empty dict if there are no objects
                : Storage.Objects.Where(
                obj =>
                obj.Value.Item1.Type == ObjectType.AreaTrigger &&
                !obj.Value.Item1.IsTemporarySpawn())                                                            // remove temporary spawns
                                    .OrderBy(pair => pair.Value.Item2)                                          // order by spawn time
                                    .ToDictionary(obj => obj.Key, obj => obj.Value.Item1 as AreaTriggerCreateProperties);

            if (spellareatriggers.Count == 0)
            {
                return(string.Empty);
            }

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

            var spellareatriggersData = new DataBag <AreaTriggerCreateProperties>();

            foreach (var spellareatrigger in spellareatriggers)
            {
                spellareatriggersData.Add(spellareatrigger.Value);
            }

            var templateDb = SQLDatabase.Get(spellareatriggersData);

            return(SQLUtil.Compare(Settings.SQLOrderByKey ? spellareatriggersData.OrderBy(x => x.Item1.AreaTriggerId).ToArray() : spellareatriggersData.ToArray(),
                                   templateDb,
                                   x =>
            {
                var comment = "SpellId : " + x.spellId.ToString();
                if ((x.AreaTriggerCreatePropertiesId & 0x80000000) != 0)
                {
                    comment += " CANNOT FIND PROPERTIES ID, USED SPELL ID AS KEY (NEEDS MANUAL CORRECTION)";
                }

                return comment;
            }));
        }
Exemplo n.º 4
0
        // [BuilderMethod(Units = true)] // this method has to be run before generating creature spawns, with this attribute the order isn't ensured
        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>();
            var equipsDb       = new RowList <CreatureEquipment>();
            var newEntriesDict = new Dictionary <uint? /*CreatureID*/, List <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 equip = npc.Value.GetEquipment();
                if (equip == null)
                {
                    continue;
                }

                if (SQLDatabase.CreatureEquipments.TryGetValue(npc.Key.GetEntry(), out var equipListDB))
                {
                    var equipDB = GetDuplicateEquipFromList(equip, equipListDB);
                    if (equipDB != null)
                    {
                        if (equipDB.VerifiedBuild >= equip.VerifiedBuild)
                        {
                            continue;
                        }

                        equip.ID = equipDB.ID;
                        equipsDb.Add(equipDB); // add to entries to compare to
                    }
                    else
                    {
                        equip.ID = (uint)equipListDB.Count + 1;
                        equipListDB.Add(equip);
                    }
                }
                else
                {
                    if (newEntriesDict.TryGetValue(equip.CreatureID, out var equipList))
                    {
                        if (GetDuplicateEquipFromList(equip, equipList) != null)
                        {
                            continue;
                        }

                        equip.ID = (uint)equipList.Count + 1;
                        equipList.Add(equip);
                    }
                    else
                    {
                        equip.ID = 1;
                        newEntriesDict.Add(equip.CreatureID, new List <CreatureEquipment>()
                        {
                            equip
                        });
                    }
                }

                equips.Add(equip);
            }

            return(SQLUtil.Compare(Settings.SQLOrderByKey ? equips.OrderBy(x => x.Item1.CreatureID).ThenBy(y => y.Item1.ID) : equips, equipsDb, StoreNameType.Unit));
        }