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 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 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)); }
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), 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 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)); }
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) { Unit 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; } } string auras = string.Empty; string commentAuras = string.Empty; if (npc.Auras != null && npc.Auras.Count != 0) { foreach (Aura aura in npc.Auras) { if (aura == null) { continue; } // usually "template auras" do not have caster if (ClientVersion.AddedInVersion(ClientType.MistsOfPandaria) ? !aura.AuraFlags.HasAnyFlag(AuraFlagMoP.NoCaster) : !aura.AuraFlags.HasAnyFlag(AuraFlag.NotCaster)) { continue; } auras += aura.SpellId + " "; commentAuras += StoreGetters.GetName(StoreNameType.Spell, (int)aura.SpellId, false) + ", "; } auras = auras.TrimEnd(' '); commentAuras = commentAuras.TrimEnd(',', ' '); } CreatureTemplateAddon 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 => { string comment = StoreGetters.GetName(StoreNameType.Unit, (int)addon.Entry.GetValueOrDefault()); if (!string.IsNullOrEmpty(addon.CommentAuras)) { comment += " - " + addon.CommentAuras; } return comment; })); }
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 (Unit 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; } ModelData model = new ModelData { DisplayID = modelId }; if (models.ContainsKey(model)) { continue; } float 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 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)); }