diff --git a/WaypointCreatorGen2/App.config b/WaypointCreatorGen2/App.config
index 56efbc7..dc561f4 100644
--- a/WaypointCreatorGen2/App.config
+++ b/WaypointCreatorGen2/App.config
@@ -1,6 +1,42 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 127.0.0.1
+
+
+ 3306
+
+
+ world
+
+
+ trinity
+
+
+ trinity
+
+
+
\ No newline at end of file
diff --git a/WaypointCreatorGen2/Properties/Settings.Designer.cs b/WaypointCreatorGen2/Properties/Settings.Designer.cs
index b65d852..81246fc 100644
--- a/WaypointCreatorGen2/Properties/Settings.Designer.cs
+++ b/WaypointCreatorGen2/Properties/Settings.Designer.cs
@@ -8,22 +8,64 @@
//
//------------------------------------------------------------------------------
-
-namespace WaypointCreatorGen2.Properties
-{
+namespace WaypointCreatorGen2.Properties {
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("127.0.0.1")]
+ public string host {
+ get {
+ return ((string)(this["host"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("3306")]
+ public string port {
+ get {
+ return ((string)(this["port"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("world")]
+ public string database {
+ get {
+ return ((string)(this["database"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("trinity")]
+ public string username {
+ get {
+ return ((string)(this["username"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("trinity")]
+ public string password {
+ get {
+ return ((string)(this["password"]));
+ }
+ }
}
}
diff --git a/WaypointCreatorGen2/Properties/Settings.settings b/WaypointCreatorGen2/Properties/Settings.settings
index 3964565..0212b8c 100644
--- a/WaypointCreatorGen2/Properties/Settings.settings
+++ b/WaypointCreatorGen2/Properties/Settings.settings
@@ -1,7 +1,21 @@
-
-
-
-
-
-
+
+
+
+
+ 127.0.0.1
+
+
+ 3306
+
+
+ world
+
+
+ trinity
+
+
+ trinity
+
+
+
\ No newline at end of file
diff --git a/WaypointCreatorGen2/WaypointCreator.Designer.cs b/WaypointCreatorGen2/WaypointCreator.Designer.cs
index 723a636..f57f676 100644
--- a/WaypointCreatorGen2/WaypointCreator.Designer.cs
+++ b/WaypointCreatorGen2/WaypointCreator.Designer.cs
@@ -363,6 +363,7 @@ private void InitializeComponent()
// EditorListBox
//
this.EditorListBox.FormattingEnabled = true;
+ this.EditorListBox.HorizontalScrollbar = true;
this.EditorListBox.Location = new System.Drawing.Point(7, 14);
this.EditorListBox.Name = "EditorListBox";
this.EditorListBox.Size = new System.Drawing.Size(194, 472);
diff --git a/WaypointCreatorGen2/WaypointCreator.cs b/WaypointCreatorGen2/WaypointCreator.cs
index 0d92fd7..4ee2f11 100644
--- a/WaypointCreatorGen2/WaypointCreator.cs
+++ b/WaypointCreatorGen2/WaypointCreator.cs
@@ -7,6 +7,7 @@
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
+using MySqlConnector;
namespace WaypointCreatorGen2
{
@@ -22,6 +23,17 @@ public partial class WaypointCreator : Form
private const int SEQUENCE_TO_CHECK_FOR_DUPLICATES = 3;
+ private string GetConnectionString()
+ {
+ var host = Properties.Settings.Default.host;
+ var port = Properties.Settings.Default.port;
+ var database = Properties.Settings.Default.database;
+ var username = Properties.Settings.Default.username;
+ var password = Properties.Settings.Default.password;
+
+ return $"server={host};user={username};database={database};port={port};password={password};";
+ }
+
public WaypointCreator()
{
InitializeComponent();
@@ -213,22 +225,45 @@ private void ListEntries(UInt32 creatureId)
{
foreach (var waypointsByEntry in WaypointDatabyCreatureEntry)
{
- CreatureNamesByEntry.TryGetValue(waypointsByEntry.Key, out var name);
+ var name = GetCreatureName(waypointsByEntry.Key);
foreach (var waypointsByGuid in waypointsByEntry.Value)
EditorListBox.Items.Add($"{waypointsByEntry.Key} - {name} ({waypointsByGuid.Key})");
}
-
}
else
{
if (WaypointDatabyCreatureEntry.ContainsKey(creatureId))
{
- CreatureNamesByEntry.TryGetValue(creatureId, out var name);
+ var name = GetCreatureName(creatureId);
foreach (var waypointsByGuid in WaypointDatabyCreatureEntry[creatureId])
EditorListBox.Items.Add($"{creatureId} - {name} ({waypointsByGuid.Key.ToString()})");
}
+ }
+ }
+
+ private string GetCreatureName(UInt32 entry)
+ {
+ string name = string.Empty;
+ string query = "SELECT `name` FROM `creature_template` WHERE `entry` = @entry";
+ using (MySqlConnection conn = new MySqlConnection(GetConnectionString()))
+ {
+ conn.Open();
+ using (MySqlCommand cmd = new MySqlCommand(query, conn))
+ {
+ cmd.Parameters.AddWithValue("@entry", entry);
+
+ using (MySqlDataReader reader = cmd.ExecuteReader())
+ {
+ if (reader.Read())
+ {
+ name = reader["name"].ToString();
+ }
+ }
+ }
}
+
+ return name;
}
private void ShowWaypointDataForCreature(UInt32 creatureId, UInt64 lowGUID)
@@ -422,7 +457,7 @@ private void GenerateSQLStripMenuItem_Click(object sender, EventArgs e)
{
// Generates the SQL output.
// waypoint_data
- CreatureNamesByEntry.TryGetValue(_selectedCreatureId, out string name);
+ string name = GetCreatureName(_selectedCreatureId);
var velocity = "NULL";
SQLOutputTextBox.AppendText("SET @MOVERGUID := @CGUID+xxxxxxxx;\r\n");
diff --git a/WaypointCreatorGen2/WaypointCreatorGen2.csproj b/WaypointCreatorGen2/WaypointCreatorGen2.csproj
index 6547645..4703c88 100644
--- a/WaypointCreatorGen2/WaypointCreatorGen2.csproj
+++ b/WaypointCreatorGen2/WaypointCreatorGen2.csproj
@@ -33,8 +33,34 @@
4
+
+ ..\packages\Microsoft.Extensions.Logging.Abstractions.7.0.1\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll
+
+
+ ..\packages\MySqlConnector.2.3.7\lib\net471\MySqlConnector.dll
+
+
+ ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+ ..\packages\System.Diagnostics.DiagnosticSource.7.0.2\lib\net462\System.Diagnostics.DiagnosticSource.dll
+
+
+ ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
+
+
+
+ ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
+
+
+ ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
@@ -63,6 +89,7 @@
Designer
Resources.Designer.cs
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/WaypointCreatorGen2/packages.config b/WaypointCreatorGen2/packages.config
new file mode 100644
index 0000000..7766db9
--- /dev/null
+++ b/WaypointCreatorGen2/packages.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file