public static void GrabNameData() { if (!SQLConnector.Connected()) { throw new DataException("Cannot get DB data without an active DB connection."); } foreach (var objectType in ObjectTypes) { NameStores.Add(objectType, GetDict <int, string>(string.Format("SELECT `Id`, `Name` FROM `ObjectNames` WHERE `ObjectType`='{0}';", objectType))); } }
public static void LoadSQL() { if (!SQLConnector.Connected()) { throw new DataException("Cannot get DB data without an active DB connection."); } var startTime = DateTime.Now; var query = new StringBuilder(string.Format("SELECT ID, Language, MaleText, FemaleText, EmoteID0, EmoteID1, EmoteID2, EmoteDelay0, EmoteDelay1, EmoteDelay2, SoundId, Unk1, Unk2 FROM {0}.broadcast_text;", Settings.TDBDatabase)); using (var reader = SQLConnector.ExecuteQuery(query.ToString())) { if (reader == null) { return; } while (reader.Read()) { var broadcastText = new BroadcastText(); uint Id = Convert.ToUInt32(reader["Id"]); broadcastText.language = Convert.ToUInt32(reader["Language"]); broadcastText.MaleText = Convert.ToString(reader["MaleText"]); broadcastText.FemaleText = Convert.ToString(reader["FemaleText"]); broadcastText.emoteID0 = Convert.ToUInt32(reader["EmoteID0"]); broadcastText.emoteID1 = Convert.ToUInt32(reader["EmoteID1"]); broadcastText.emoteID2 = Convert.ToUInt32(reader["EmoteID2"]); broadcastText.emoteDelay0 = Convert.ToUInt32(reader["EmoteDelay0"]); broadcastText.emoteDelay1 = Convert.ToUInt32(reader["EmoteDelay1"]); broadcastText.emoteDelay2 = Convert.ToUInt32(reader["EmoteDelay2"]); broadcastText.soundId = Convert.ToUInt32(reader["SoundId"]); broadcastText.unk1 = Convert.ToUInt32(reader["Unk1"]); broadcastText.unk2 = Convert.ToUInt32(reader["Unk2"]); var tuple = Tuple.Create(Id, broadcastText); BroadcastTextStores.Add(tuple); } } var endTime = DateTime.Now; var span = endTime.Subtract(startTime); Trace.WriteLine(String.Format("SQL loaded in {0}.", span.ToFormattedString())); }
/// <summary> /// Loads data necessary for the SQL generation from the database. /// </summary> public static void LoadSQL() { if (!SQLConnector.Connected()) { throw new DataException("Cannot get DB data without an active DB connection."); } var startTime = DateTime.Now; LoadBroadcastText(); var endTime = DateTime.Now; var span = DateTime.Now.Subtract(startTime); Trace.WriteLine($"SQL loaded in {span.ToFormattedString()}."); }
/// <summary> /// Loads data necessary for the SQL generation from the database. /// </summary> public static void LoadSQL() { if (!SQLConnector.Connected()) { throw new DataException("Cannot get DB data without an active DB connection."); } DateTime startTime = DateTime.Now; LoadBroadcastText(); // MapDifficulty //LoadMapDifficulty(); DateTime endTime = DateTime.Now; TimeSpan span = endTime.Subtract(startTime); Trace.WriteLine($"SQL loaded in {span.ToFormattedString()}."); }
/// <summary> /// Loads names of the objects from the database. /// </summary> public static void GrabNameData() { if (!SQLConnector.Connected()) { throw new DataException("Cannot get DB data without an active DB connection."); } foreach (var objectType in ObjectTypes) { using (var command = SQLConnector.CreateCommand($"SELECT `Id`, `Name` FROM `object_names` WHERE `ObjectType`='{objectType}';")) { if (command == null) { return; } using (MySqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { int ID = Convert.ToInt32(reader.GetValue(0)); string Name = Convert.ToString(reader.GetValue(1)); Dictionary <int, string> names; if (!NameStores.TryGetValue(objectType, out names)) { names = new Dictionary <int, string>(); NameStores.Add(objectType, names); } if (!names.ContainsKey(ID)) { names.Add(ID, Name); } } } } } }
public static void LoadSQL() { if (!SQLConnector.Connected()) { throw new DataException("Cannot get DB data without an active DB connection."); } var startTime = DateTime.Now; LoadBroadcastText(); LoadCreatureDifficulty(); // Locale LoadBroadcastTextLocale(); LoadQuestTemplateLocale(); LoadQuestObjectivesLocale(); // MapDifficulty LoadMapDifficulty(); var endTime = DateTime.Now; var span = endTime.Subtract(startTime); Trace.WriteLine(String.Format("SQL loaded in {0}.", span.ToFormattedString())); }
public static void GrabData() { if (!SQLConnector.Connected()) { throw new Exception("Cannot get DB data without an active DB connection."); } const string unitNameQuery = "SELECT entry, name FROM creature_template;"; const string gameObjectNameQuery = "SELECT entry, name FROM gameobject_template;"; const string itemNameQuery = "SELECT entry, name FROM item_template;"; const string questNameQuery = "SELECT Id, Title FROM quest_template;"; // creature_template.entry, creature_template.name UnitNames = GetDict <uint, string>(unitNameQuery); // gameobject_template.entry, gameobject_template.name GameObjectNames = GetDict <uint, string>(gameObjectNameQuery); // item_template.entry, item_template.name ItemNames = GetDict <uint, string>(itemNameQuery); // item_template.entry, item_template.name QuestNames = GetDict <uint, string>(questNameQuery); }