Skip to content

Commit

Permalink
Add right-click to copy teleport command
Browse files Browse the repository at this point in the history
Includes settings for height offset and enabling of *fly* and *ghost* modes.

Closes #14.
  • Loading branch information
coldino committed Mar 27, 2019
1 parent 72d974c commit 635cd0c
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 1 deletion.
5 changes: 5 additions & 0 deletions LarkatorGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<local:GenderToLetterConverter x:Key="GenderToLetterConverter"/>
<local:AddIntConverter x:Key="AddIntConverter"/>

<ContextMenu x:Key="CreatureMenu">
<MenuItem Header="Copy teleport cmd" Click="CopyTeleport_Click"/>
</ContextMenu>

<CollectionViewSource x:Key="GroupedSearchCriteria" Source="{Binding ListSearches}">
<CollectionViewSource.GroupDescriptions>
<PropertyGroupDescription PropertyName="Group"/>
Expand Down Expand Up @@ -67,6 +71,7 @@
<TextBlock Text="{Binding Path=Dino, Converter={StaticResource DinoToTooltipConverter}}"/>
</Setter.Value>
</Setter>
<Setter Property="ContextMenu" Value="{StaticResource CreatureMenu}"/>
<Setter Property="IsSelected" Value="{Binding Highlight, Mode=TwoWay}"/>
<EventSetter Event="MouseEnter" Handler="Result_MouseEnter"/>
<EventSetter Event="MouseLeave" Handler="Result_MouseLeave"/>
Expand Down
19 changes: 19 additions & 0 deletions LarkatorGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 37 additions & 1 deletion LarkatorGUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions LarkatorGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,14 @@
<Setting Name="PinScale" Type="System.Double" Scope="User">
<Value Profile="(Default)">0.9</Value>
</Setting>
<Setting Name="TeleportHeightOffset" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1500</Value>
</Setting>
<Setting Name="TeleportFly" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="TeleportGhost" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
32 changes: 32 additions & 0 deletions LarkatorGUI/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>

<Border Grid.Row="1" Grid.Column="0">
Expand Down Expand Up @@ -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"/>
</Border>

<Border Grid.Row="6" Grid.Column="0">
<TextBlock VerticalAlignment="Center" Margin="0,0,4,0">Teleport height offset</TextBlock>
</Border>
<Border Grid.Row="6" Grid.Column="1">
<local:NumericEntryControl ToolTip="The distance above the creature when teleporting (in Unreal units)"
Value="{Binding Source={StaticResource Model}, Path=Settings.TeleportHeightOffset, Mode=TwoWay}" MaxWidth="110" HorizontalAlignment="Right"
MaxValue="3000" MinValue="0" Increment="100" LargeIncrement="500" Margin="0,0,2,0"/>
</Border>

<Border Grid.Row="7" Grid.Column="0">
<TextBlock VerticalAlignment="Center" Margin="0,0,4,0">Enable fly after teleport</TextBlock>
</Border>
<Border Grid.Row="7" Grid.Column="1">
<CheckBox ToolTip="Include 'cheat fly' in the teleport command"
IsChecked="{Binding Source={StaticResource Model}, Path=Settings.TeleportFly, Mode=TwoWay}" HorizontalAlignment="Right"
Margin="7,4"/>
</Border>

<Border Grid.Row="8" Grid.Column="0">
<TextBlock VerticalAlignment="Center" Margin="0,0,4,0">Enable ghost after teleport</TextBlock>
</Border>
<Border Grid.Row="8" Grid.Column="1">
<CheckBox ToolTip="Include 'cheat ghost' in the teleport command (only if fly is also set)"
IsChecked="{Binding Source={StaticResource Model}, Path=Settings.TeleportGhost, Mode=TwoWay}" HorizontalAlignment="Right"
Margin="7,4"/>
</Border>
</Grid>
<DockPanel Margin="4,6,6,4" LastChildFill="True">
<TextBlock Text="Restore all defaults" DockPanel.Dock="Left" VerticalAlignment="Bottom" TextDecorations="Underline" MouseDown="Restore_MouseDown" FontSize="10"/>
Expand Down
9 changes: 9 additions & 0 deletions LarkatorGUI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
<setting name="PinScale" serializeAs="String">
<value>0.9</value>
</setting>
<setting name="TeleportHeightOffset" serializeAs="String">
<value>1500</value>
</setting>
<setting name="TeleportFly" serializeAs="String">
<value>True</value>
</setting>
<setting name="TeleportGhost" serializeAs="String">
<value>False</value>
</setting>
</LarkatorGUI.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 635cd0c

Please sign in to comment.