From 635cd0cb591f53113c49886e9393308aa89e067a Mon Sep 17 00:00:00 2001 From: Ant Purchase Date: Wed, 27 Mar 2019 15:44:31 +0000 Subject: [PATCH] Add right-click to copy teleport command Includes settings for height offset and enabling of *fly* and *ghost* modes. Closes #14. --- LarkatorGUI/MainWindow.xaml | 5 +++ LarkatorGUI/MainWindow.xaml.cs | 19 +++++++++++ LarkatorGUI/Properties/Settings.Designer.cs | 38 ++++++++++++++++++++- LarkatorGUI/Properties/Settings.settings | 9 +++++ LarkatorGUI/SettingsWindow.xaml | 32 +++++++++++++++++ LarkatorGUI/app.config | 9 +++++ 6 files changed, 111 insertions(+), 1 deletion(-) diff --git a/LarkatorGUI/MainWindow.xaml b/LarkatorGUI/MainWindow.xaml index 938c454..782bc5f 100644 --- a/LarkatorGUI/MainWindow.xaml +++ b/LarkatorGUI/MainWindow.xaml @@ -30,6 +30,10 @@ + + + + @@ -67,6 +71,7 @@ + diff --git a/LarkatorGUI/MainWindow.xaml.cs b/LarkatorGUI/MainWindow.xaml.cs index 4bb0689..54ed2a8 100644 --- a/LarkatorGUI/MainWindow.xaml.cs +++ b/LarkatorGUI/MainWindow.xaml.cs @@ -433,6 +433,25 @@ private void MapPin_Click(object sender, MouseButtonEventArgs ev) } } + private void CopyTeleport_Click(object sender, RoutedEventArgs e) + { + if (sender is MenuItem mi && mi.Parent is ContextMenu cm && cm.PlacementTarget is DataGridRow dgr && dgr.DataContext is DinoViewModel dvm) + { + var z = dvm.Dino.Location.Z + Properties.Settings.Default.TeleportHeightOffset; + var clipboard = "cheat SetPlayerPos "; + clipboard += $"{dvm.Dino.Location.X:0.00} {dvm.Dino.Location.Y:0.00} {z:0.00}"; + if (Properties.Settings.Default.TeleportFly) + { + clipboard += " | cheat fly"; + if (Properties.Settings.Default.TeleportGhost) clipboard += " | cheat ghost"; + } + + Clipboard.SetText(clipboard, TextDataFormat.Text); + + StatusText = "Copied: " + clipboard; + } + } + private void Window_SourceInitialized(object sender, EventArgs e) { // Handler to maintain window aspect ratio diff --git a/LarkatorGUI/Properties/Settings.Designer.cs b/LarkatorGUI/Properties/Settings.Designer.cs index d85afa9..9c1ee83 100644 --- a/LarkatorGUI/Properties/Settings.Designer.cs +++ b/LarkatorGUI/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace LarkatorGUI.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -200,5 +200,41 @@ public double PinScale { this["PinScale"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("1500")] + public int TeleportHeightOffset { + get { + return ((int)(this["TeleportHeightOffset"])); + } + set { + this["TeleportHeightOffset"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool TeleportFly { + get { + return ((bool)(this["TeleportFly"])); + } + set { + this["TeleportFly"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool TeleportGhost { + get { + return ((bool)(this["TeleportGhost"])); + } + set { + this["TeleportGhost"] = value; + } + } } } diff --git a/LarkatorGUI/Properties/Settings.settings b/LarkatorGUI/Properties/Settings.settings index d6e47ff..175a717 100644 --- a/LarkatorGUI/Properties/Settings.settings +++ b/LarkatorGUI/Properties/Settings.settings @@ -41,5 +41,14 @@ 0.9 + + 1500 + + + True + + + False + \ No newline at end of file diff --git a/LarkatorGUI/SettingsWindow.xaml b/LarkatorGUI/SettingsWindow.xaml index eb9e117..5111133 100644 --- a/LarkatorGUI/SettingsWindow.xaml +++ b/LarkatorGUI/SettingsWindow.xaml @@ -32,6 +32,11 @@ + + + + + @@ -77,6 +82,33 @@ Value="{Binding Source={StaticResource Model}, Path=Settings.ConvertDelay, Mode=TwoWay}" MaxWidth="110" HorizontalAlignment="Right" MaxValue="10000" MinValue="200" Increment="100" LargeIncrement="500" Margin="0,0,2,0"/> + + + Teleport height offset + + + + + + + Enable fly after teleport + + + + + + + Enable ghost after teleport + + + + diff --git a/LarkatorGUI/app.config b/LarkatorGUI/app.config index 74c3af5..93cbee7 100644 --- a/LarkatorGUI/app.config +++ b/LarkatorGUI/app.config @@ -46,6 +46,15 @@ 0.9 + + 1500 + + + True + + + False + \ No newline at end of file