public static string GameObjectTemplateAddon(Dictionary<WowGuid, GameObject> gameobjects) { if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gameobject_template_addon)) return string.Empty; if (gameobjects.Count == 0) return string.Empty; var addons = new DataBag<GameObjectTemplateAddon>(); foreach (var obj in gameobjects) { var goT = Storage.GameObjectTemplates.FirstOrDefault(p => p.Item1.Entry == obj.Key.GetEntry()); if (goT == null) continue; var go = obj.Value; if (Settings.AreaFilters.Length > 0) if (!(go.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters))) continue; if (Settings.MapFilters.Length > 0) if (!(go.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters))) continue; var addon = new GameObjectTemplateAddon { Entry = obj.Key.GetEntry() }; HashSet<uint> playerFactions = new HashSet<uint> { 1, 2, 3, 4, 5, 6, 115, 116, 1610, 1629, 2203, 2204 }; addon.Faction = go.Faction.GetValueOrDefault(0); if (playerFactions.Contains(go.Faction.GetValueOrDefault())) addon.Faction = 0; addon.Flags = go.Flags.GetValueOrDefault(GameObjectFlag.None); addon.Flags &= ~GameObjectFlag.Triggered; addon.Flags &= ~GameObjectFlag.Damaged; addon.Flags &= ~GameObjectFlag.Destroyed; if (addons.ContainsKey(addon)) continue; if (addon.Flags == GameObjectFlag.None && addon.Faction == 0) continue; addons.Add(addon); } var addonsDb = SQLDatabase.Get(addons); return SQLUtil.Compare(addons, addonsDb, StoreNameType.GameObject); }
public static string PointsOfInterest() { if (Storage.GossipPOIs.IsEmpty()) return string.Empty; if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.points_of_interest)) return string.Empty; var result = string.Empty; if (!Storage.GossipSelects.IsEmpty()) { var gossipPOIsTable = new Dictionary<Tuple<uint, uint>, uint>(); foreach (var poi in Storage.GossipPOIs) { foreach (var gossipSelect in Storage.GossipSelects) { var tuple = Tuple.Create(gossipSelect.Key.Item1, gossipSelect.Key.Item2); if (gossipPOIsTable.ContainsKey(tuple)) continue; var timeSpan = poi.Item2 - gossipSelect.Value.Item2; if (timeSpan != null && timeSpan.Value.Duration() <= TimeSpan.FromSeconds(1)) gossipPOIsTable.Add(tuple, poi.Item1.ID.GetValueOrDefault()); } } var menuOptions = new DataBag<GossipMenuOption>(); foreach (var u in gossipPOIsTable) menuOptions.Add(new GossipMenuOption {ID = u.Key.Item2, MenuID = u.Key.Item1, ActionPoiID = u.Value}); result += SQLUtil.Compare(menuOptions, SQLDatabase.Get(menuOptions), StoreNameType.None); } result += SQLUtil.Compare(Storage.GossipPOIs, SQLDatabase.Get(Storage.GossipPOIs), StoreNameType.None); return result; }
public static string ModelData(Dictionary<WowGuid, Unit> units) { if (units.Count == 0) return string.Empty; if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_model_info)) return string.Empty; var models = new DataBag<ModelData>(); foreach (var npc in units.Select(unit => unit.Value)) { if (Settings.AreaFilters.Length > 0) if (!(npc.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters))) continue; if (Settings.MapFilters.Length > 0) if (!(npc.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters))) continue; uint modelId; if (npc.Model.HasValue) modelId = npc.Model.Value; else continue; var model = new ModelData { DisplayID = modelId }; if (models.ContainsKey(model)) continue; var scale = npc.Size.GetValueOrDefault(1.0f); model.BoundingRadius = npc.BoundingRadius.GetValueOrDefault(0.306f) / scale; model.CombatReach = npc.CombatReach.GetValueOrDefault(1.5f) / scale; model.Gender = npc.Gender.GetValueOrDefault(Gender.Male); models.Add(model); } var modelsDb = SQLDatabase.Get(models); return SQLUtil.Compare(models, modelsDb, StoreNameType.None); }
public static string CreatureTemplateAddon(Dictionary<WowGuid, Unit> units) { if (units.Count == 0) return string.Empty; if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_template_addon)) return string.Empty; var addons = new DataBag<CreatureTemplateAddon>(); foreach (var unit in units) { var npc = unit.Value; if (Settings.AreaFilters.Length > 0) if (!(npc.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters))) continue; if (Settings.MapFilters.Length > 0) if (!(npc.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters))) continue; var auras = string.Empty; var commentAuras = string.Empty; if (npc.Auras != null && npc.Auras.Count != 0) { foreach (var aura in npc.Auras.Where(aura => aura != null && (ClientVersion.AddedInVersion(ClientType.MistsOfPandaria) ? aura.AuraFlags.HasAnyFlag(AuraFlagMoP.NoCaster) : aura.AuraFlags.HasAnyFlag(AuraFlag.NotCaster)))) { auras += aura.SpellId + " "; commentAuras += StoreGetters.GetName(StoreNameType.Spell, (int) aura.SpellId, false) + ", "; } auras = auras.TrimEnd(' '); commentAuras = commentAuras.TrimEnd(',', ' '); } var addon = new CreatureTemplateAddon { Entry = unit.Key.GetEntry(), MountID = npc.Mount.GetValueOrDefault(), Bytes1 = npc.Bytes1.GetValueOrDefault(), Bytes2 = npc.Bytes2.GetValueOrDefault(), Auras = auras, CommentAuras = commentAuras }; if (addons.ContainsKey(addon)) continue; addons.Add(addon); } var addonsDb = SQLDatabase.Get(addons); return SQLUtil.Compare(addons, addonsDb, addon => { var comment = StoreGetters.GetName(StoreNameType.Unit, (int)addon.Entry.GetValueOrDefault()); if (!string.IsNullOrEmpty(addon.CommentAuras)) comment += " - " + addon.CommentAuras; return comment; }); }
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); }
public static string CreatureTemplateAddon(Dictionary <WowGuid, Unit> units) { if (units.Count == 0) { return(string.Empty); } if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_template_addon)) { return(string.Empty); } CreatureTemplateAddon templateAddonDefault = null; if (Settings.DBEnabled && Settings.SkipRowsWithFallbackValues) { templateAddonDefault = SQLUtil.GetDefaultObject <CreatureTemplateAddon>(); } var dbFields = SQLUtil.GetDBFields <CreatureTemplateAddon>(false); var addons = new DataBag <CreatureTemplateAddon>(); foreach (var unit in units) { var npc = unit.Value; if (Settings.AreaFilters.Length > 0) { if (!(npc.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters))) { continue; } } if (Settings.MapFilters.Length > 0) { if (!(npc.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters))) { continue; } } var auras = string.Empty; var commentAuras = string.Empty; if (npc.Auras != null && npc.Auras.Count != 0) { foreach (var aura in npc.Auras.Where(aura => aura != null && (ClientVersion.AddedInVersion(ClientType.MistsOfPandaria) ? aura.AuraFlags.HasAnyFlag(AuraFlagMoP.NoCaster) : aura.AuraFlags.HasAnyFlag(AuraFlag.NotCaster)))) { auras += aura.SpellId + " "; commentAuras += StoreGetters.GetName(StoreNameType.Spell, (int)aura.SpellId, false) + ", "; } auras = auras.TrimEnd(' '); commentAuras = commentAuras.TrimEnd(',', ' '); } var addon = new CreatureTemplateAddon { Entry = unit.Key.GetEntry(), PathID = 0, MountID = (uint)npc.UnitData.MountDisplayID, Bytes1 = npc.Bytes1, Bytes2 = npc.Bytes2, Emote = 0, AIAnimKit = npc.AIAnimKit.GetValueOrDefault(0), MovementAnimKit = npc.MovementAnimKit.GetValueOrDefault(0), MeleeAnimKit = npc.MeleeAnimKit.GetValueOrDefault(0), VisibilityDistanceType = npc.VisibilityDistanceType, Auras = auras, CommentAuras = commentAuras }; if (templateAddonDefault != null && SQLUtil.AreDBFieldsEqual(addon, templateAddonDefault, dbFields)) { continue; } if (addons.ContainsKey(addon)) { continue; } addons.Add(addon); } var addonsDb = SQLDatabase.Get(addons); return(SQLUtil.Compare(addons, addonsDb, addon => { var comment = StoreGetters.GetName(StoreNameType.Unit, (int)addon.Entry.GetValueOrDefault()); if (!string.IsNullOrEmpty(addon.CommentAuras)) { comment += " - " + addon.CommentAuras; } return comment; })); }
public static string GameObjectTemplateAddon(Dictionary <WowGuid, GameObject> gameobjects) { if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.gameobject_template_addon)) { return(string.Empty); } if (gameobjects.Count == 0) { return(string.Empty); } var addons = new DataBag <GameObjectTemplateAddon>(); foreach (var obj in gameobjects) { var goT = Storage.GameObjectTemplates.FirstOrDefault(p => p.Item1.Entry == obj.Key.GetEntry()); if (goT == null) { continue; } var go = obj.Value; if (Settings.AreaFilters.Length > 0) { if (!(go.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters))) { continue; } } if (Settings.MapFilters.Length > 0) { if (!(go.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters))) { continue; } } var addon = new GameObjectTemplateAddon { Entry = obj.Key.GetEntry() }; HashSet <uint> playerFactions = new HashSet <uint> { 1, 2, 3, 4, 5, 6, 115, 116, 1610, 1629, 2203, 2204 }; addon.Faction = go.Faction.GetValueOrDefault(0); if (playerFactions.Contains(go.Faction.GetValueOrDefault())) { addon.Faction = 0; } addon.Flags = go.Flags.GetValueOrDefault(GameObjectFlag.None); addon.Flags &= ~GameObjectFlag.Triggered; addon.Flags &= ~GameObjectFlag.Damaged; addon.Flags &= ~GameObjectFlag.Destroyed; if (addons.ContainsKey(addon)) { continue; } if (addon.Flags == GameObjectFlag.None && addon.Faction == 0) { continue; } addons.Add(addon); } var addonsDb = SQLDatabase.Get(addons); return(SQLUtil.Compare(addons, addonsDb, StoreNameType.GameObject)); }
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.EquipmentItemId == null || npc.Value.EquipmentItemId.Length != 3) { continue; } if (npc.Value.EquipmentItemId[0] == 0 && npc.Value.EquipmentItemId[1] == 0 && npc.Value.EquipmentItemId[2] == 0) { continue; } var equip = new CreatureEquipment { CreatureID = npc.Key.GetEntry(), ItemID1 = npc.Value.EquipmentItemId[0], ItemID2 = npc.Value.EquipmentItemId[1], ItemID3 = npc.Value.EquipmentItemId[2] }; if (npc.Value.EquipmentAppearanceModId != null && npc.Value.EquipmentAppearanceModId.Length == 3) { equip.AppearanceModID1 = npc.Value.EquipmentAppearanceModId[0]; equip.AppearanceModID2 = npc.Value.EquipmentAppearanceModId[1]; equip.AppearanceModID3 = npc.Value.EquipmentAppearanceModId[2]; } if (npc.Value.EquipmentItemVisual != null && npc.Value.EquipmentItemVisual.Length == 3) { equip.ItemVisual1 = npc.Value.EquipmentItemVisual[0]; equip.ItemVisual2 = npc.Value.EquipmentItemVisual[1]; equip.ItemVisual3 = npc.Value.EquipmentItemVisual[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)); }
public static string ModelData(Dictionary <WowGuid, Unit> units) { if (units.Count == 0) { return(string.Empty); } if (!Settings.SQLOutputFlag.HasAnyFlagBit(SQLOutput.creature_model_info)) { return(string.Empty); } var models = new DataBag <ModelData>(); foreach (var npc in units.Select(unit => unit.Value)) { if (Settings.AreaFilters.Length > 0) { if (!(npc.Area.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.AreaFilters))) { continue; } } if (Settings.MapFilters.Length > 0) { if (!(npc.Map.ToString(CultureInfo.InvariantCulture).MatchesFilters(Settings.MapFilters))) { continue; } } uint modelId; if (npc.Model.HasValue) { modelId = npc.Model.Value; } else { continue; } var model = new ModelData { DisplayID = modelId }; //if (models.ContainsKey(model)) if (models.Any(modelInfo => modelInfo.Item1.DisplayID == modelId)) { continue; } var scale = npc.Size.GetValueOrDefault(1.0f); model.BoundingRadius = npc.BoundingRadius.GetValueOrDefault(0.306f) / scale; model.CombatReach = npc.CombatReach.GetValueOrDefault(1.5f) / scale; model.Gender = npc.Gender.GetValueOrDefault(Gender.Male); models.Add(model); } var modelsDb = SQLDatabase.Get(models); return(SQLUtil.Compare(models, modelsDb, StoreNameType.None)); }
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 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 (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)); }