This commit is contained in:
Dominique Wyniger 2017-09-08 23:46:43 +02:00
parent 1206aa4cde
commit dab9cb51ce
6 changed files with 152 additions and 25 deletions

View File

@ -82,6 +82,9 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="ClearOverlay.xaml.vb">
<DependentUpon>ClearOverlay.xaml</DependentUpon>
</Compile>
<Compile Include="functions.vb" /> <Compile Include="functions.vb" />
<Compile Include="GetWebAPIinfo.vb" /> <Compile Include="GetWebAPIinfo.vb" />
<Compile Include="HandleProceses.vb" /> <Compile Include="HandleProceses.vb" />
@ -92,6 +95,10 @@
<DependentUpon>Overlay.xaml</DependentUpon> <DependentUpon>Overlay.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="PressKeys.vb" /> <Compile Include="PressKeys.vb" />
<Page Include="ClearOverlay.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml"> <Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>

25
ArkH/ClearOverlay.xaml Normal file
View File

@ -0,0 +1,25 @@
<Window x:Class="ClearOverlay"
AllowsTransparency="True" WindowStyle="None" Background="Transparent" Topmost="True" ShowInTaskbar="false"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ArkH"
mc:Ignorable="d"
Title="ClearOverlay" Height="600" Width="160">
<Grid>
<StackPanel x:Name="OLstack">
<Label x:Name="lblTitle" Content="ArkH! v1.0" HorizontalContentAlignment="Center" FontSize="8" FontWeight="Bold" Padding="5,10,5,5"/>
<TextBlock x:Name="lblEvent" TextAlignment="Center" TextWrapping="Wrap" Text="TextBlock" Height="37" VerticalAlignment="Center" Foreground="#FF1ABD00"/>
<TextBlock x:Name="lblHelp" TextWrapping="Wrap" TextAlignment="Center" FontSize="8" Foreground="#FFBABABA"><Run Text="AutoWalk: F5 / MateHelper: F6"/><LineBreak/><Run Text="AutoFeed: F7 / AutoEat: F8"/><LineBreak/><Run Text="AutoGather/PetHeal: F9"/><LineBreak/><Run Text="AutoAttack: F10 / AutoDrink: F11"/><LineBreak/><Run Text="Settings: ALT"/><LineBreak/><Run/></TextBlock>
<Button x:Name="btnAutoWalk" Content="AutoWalk" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
<Button x:Name="btnMateHelper" Content="MateHelper" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
<Button x:Name="btnAutoFeed" Content="AutoFeed" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
<Button x:Name="btnAutoEat" Content="AutoEat" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
<Button x:Name="btnAutoGather" Content="AutoGather/PetHeal" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
<Button x:Name="btnAutoAttack" Content="AutoAttack" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
<Button x:Name="btnAutoDrink" Content="AutoDrink" Background="#BFDDDDDD" FontSize="12" Opacity="0.6" Height="40"/>
</StackPanel>
</Grid>
</Window>

39
ArkH/ClearOverlay.xaml.vb Normal file
View File

@ -0,0 +1,39 @@
Public Class ClearOverlay
Public Sub refreshOL()
updateglobalstate()
OLstack.Children.Clear()
OLstack.Children.Add(lblTitle)
If globvar_eventactive = True Then
lblEvent.Text = globvar_eventmessage
'lblEvent.HorizontalContentAlignment = HorizontalAlignment.Center
'txtEvent.Text = globvar_eventmessage
OLstack.Children.Add(lblEvent)
End If
If globvar_globalstate = False Then
OLstack.Children.Add(lblHelp)
End If
If globvar_autowalkstate = True Then
OLstack.Children.Add(btnAutoWalk)
End If
If globvar_matehelperstate = True Then
OLstack.Children.Add(btnMateHelper)
End If
End Sub
Private Sub ClearOverlay_Initialized(sender As Object, e As EventArgs) Handles Me.Initialized
Me.Left = 10
Me.Top = 10
refreshOL()
End Sub
End Class

View File

@ -33,18 +33,52 @@ Module getWebAPIinfo
Private Sub findEvents() Private Sub findEvents()
Dim Substrings() As String = globvar_APInews.Split(vbCrLf) Dim Substrings() As String = globvar_APInews.Split(vbCrLf)
globvar_eventmessage = "" globvar_eventmessage = "Event NOT active"
globvar_eventactive = False globvar_eventactive = False
For Each substring In Substrings For Each substring In Substrings
'MsgBox(substring) 'MsgBox(substring)
If substring.Contains("Phoenix") = True Then If substring.Contains("EVOLUTION") = True Then
If substring.Contains("1.5X") = True Then
globvar_eventmessage = "Event: 1.5x until" & vbCrLf & analyzenews(substring)
ElseIf substring.Contains("2X") = True Then
globvar_eventmessage = "Event: 2x until" & vbCrLf & analyzenews(substring)
'MsgBox("Found")
'MsgBox(analyzenews(substring))
ElseIf substring.Contains("3X") = True Then
globvar_eventmessage = "Event: 3x until" & vbCrLf & analyzenews(substring)
End If
globvar_eventactive = True globvar_eventactive = True
globvar_eventmessage = substring 'globvar_eventmessage = substring
' MsgBox(substring) ' MsgBox(substring)
Else Else
End If End If
Next Next
' MsgBox(globvar_eventmessage) ' MsgBox(globvar_eventmessage)
End Sub End Sub
Private Function analyzenews(ByVal news As String)
Dim retnews As String
Dim p1 As Integer
Dim p2 As Integer
p1 = InStr(1, news, "through")
' MsgBox(p1 & vbCrLf & p2)
retnews = Mid(news, p1 + 8)
p2 = InStr(1, retnews, ", with")
retnews = Left(retnews, p2 - 1)
Return retnews
End Function
End Module End Module

View File

@ -64,13 +64,17 @@
<Grid Margin="10,10,10,45" Grid.Row="2"> <Grid Margin="10,10,10,45" Grid.Row="2">
<Rectangle Fill="#00F4F4F4" Stroke="Black"/> <Rectangle Fill="#00F4F4F4" Stroke="Black"/>
<Slider HorizontalAlignment="Left" Margin="10,43,0,0" VerticalAlignment="Top" Width="289"/> <Slider HorizontalAlignment="Left" Margin="10,43,0,0" VerticalAlignment="Top" Width="289"/>
<Label x:Name="lblKeyForward_Copy3" Content="AutoFeed Rate (seconds)" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="227"/> <Label x:Name="lblKeyForward_Copy3" Content="AutoFeed Rate (seconds)" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="170"/>
<Slider HorizontalAlignment="Left" Margin="10,97,0,0" VerticalAlignment="Top" Width="289"/> <Slider HorizontalAlignment="Left" Margin="10,97,0,0" VerticalAlignment="Top" Width="289"/>
<Label x:Name="lblKeyForward_Copy4" Content="AutoEat Rate (minutes)" HorizontalAlignment="Left" Margin="10,64,0,0" VerticalAlignment="Top" Width="227"/> <Label x:Name="lblKeyForward_Copy4" Content="AutoEat Rate (minutes)" HorizontalAlignment="Left" Margin="10,64,0,0" VerticalAlignment="Top" Width="227"/>
<Slider HorizontalAlignment="Left" Margin="10,151,0,0" VerticalAlignment="Top" Width="289"/> <Slider HorizontalAlignment="Left" Margin="10,151,0,0" VerticalAlignment="Top" Width="289"/>
<Label x:Name="lblKeyForward_Copy5" Content="AutoDrink Rate (minutes)" HorizontalAlignment="Left" Margin="10,118,0,0" VerticalAlignment="Top" Width="227"/> <Label x:Name="lblKeyForward_Copy5" Content="AutoDrink Rate (minutes)" HorizontalAlignment="Left" Margin="10,118,0,0" VerticalAlignment="Top" Width="227"/>
<Slider HorizontalAlignment="Left" Margin="10,205,0,0" VerticalAlignment="Top" Width="289"/> <Slider HorizontalAlignment="Left" Margin="10,205,0,0" VerticalAlignment="Top" Width="289"/>
<Label x:Name="lblKeyForward_Copy6" Content="AutoScreenshot Interval (minutes)" HorizontalAlignment="Left" Margin="10,172,0,0" VerticalAlignment="Top" Width="227"/> <Label x:Name="lblKeyForward_Copy6" Content="AutoScreenshot Interval (minutes)" HorizontalAlignment="Left" Margin="10,172,0,0" VerticalAlignment="Top" Width="227"/>
<Label x:Name="lblAutoFeedRateValue" Content="60" HorizontalAlignment="Left" Margin="255,10,0,0" VerticalAlignment="Top" Width="44" HorizontalContentAlignment="Right"/>
<Label x:Name="lblAutoEatRateValue" Content="60" HorizontalAlignment="Left" Margin="255,64,0,0" VerticalAlignment="Top" Width="44" HorizontalContentAlignment="Right"/>
<Label x:Name="lblAutoDrinkRateValue" Content="60" HorizontalAlignment="Left" Margin="255,118,0,0" VerticalAlignment="Top" Width="44" HorizontalContentAlignment="Right"/>
<Label x:Name="lblAutoScreenshotRateValue" Content="60" HorizontalAlignment="Left" Margin="255,172,0,0" VerticalAlignment="Top" Width="44" HorizontalContentAlignment="Right"/>
</Grid> </Grid>

View File

@ -1,10 +1,13 @@
Imports System.ComponentModel Imports System.ComponentModel
Imports System.IO Imports System.IO
Imports System.Runtime.InteropServices Imports Microsoft.Win32
Class MainWindow Class MainWindow
Dim overlaywin As New Overlay() ' Dim notifywin As New Notification()
Dim notifywin As New Notification() Dim clearol As New ClearOverlay()
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal nVirtKey As keys) As Short Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal nVirtKey As keys) As Short
Private WithEvents Bgworker As New ComponentModel.BackgroundWorker Private WithEvents Bgworker As New ComponentModel.BackgroundWorker
@ -318,20 +321,26 @@ Class MainWindow
If globvar_enableoverlay = True Then If globvar_enableoverlay = True Then
notifywin.Show() 'notifywin.Show()
'test
clearol.Show()
overlaywin.Show()
notifywin.screenmessage()
overlaywin.OL_Update() 'clearol.Show()
'notifywin.screenmessage()
clearol.refreshOL()
chkEnableOverlay.IsChecked = True chkEnableOverlay.IsChecked = True
Else Else
chkEnableOverlay.IsChecked = False chkEnableOverlay.IsChecked = False
overlaywin.Hide() 'clearol.Hide()
notifywin.Hide() 'notifywin.Hide()
clearol.Hide()
End If End If
overlaywin.OL_Update() clearol.refreshOL()
notifywin.screenmessage()
'notifywin.screenmessage()
'binds 'binds
txtKeyForward.Text = bind_forward txtKeyForward.Text = bind_forward
txtKeyUse.Text = bind_use txtKeyUse.Text = bind_use
@ -393,6 +402,7 @@ Class MainWindow
If globvar_matehelperstate = True Then If globvar_matehelperstate = True Then
AppActivate(globvar_gamewindowname) AppActivate(globvar_gamewindowname)
keycodepress(ConvertCharToVirtualKey(txtKeyWhistle.Text)) keycodepress(ConvertCharToVirtualKey(txtKeyWhistle.Text))
keycoderelease(ConvertCharToVirtualKey(txtKeyWhistle.Text))
End If End If
@ -410,6 +420,7 @@ Class MainWindow
If GetAsyncKeyState(keys.VK_LMENU) <> 0 Then If GetAsyncKeyState(keys.VK_LMENU) <> 0 Then
togglemainwin() togglemainwin()
End If End If
clearol.refreshOL()
End Sub End Sub
Private Sub action_tickm() Private Sub action_tickm()
Bgworker.RunWorkerAsync() Bgworker.RunWorkerAsync()
@ -423,12 +434,12 @@ Class MainWindow
Public Sub toggleautowalk() Public Sub toggleautowalk()
If globvar_autowalkstate = False Then If globvar_autowalkstate = False Then
globvar_autowalkstate = True globvar_autowalkstate = True
'overlaywin.toggleautowalkbutton(True) 'clearol.toggleautowalkbutton(True)
overlaywin.OL_Update() clearol.refreshOL()
Else Else
globvar_autowalkstate = False globvar_autowalkstate = False
overlaywin.OL_Update() clearol.refreshOL()
'overlaywin.toggleautowalkbutton(False) 'clearol.toggleautowalkbutton(False)
'keyrelease(keys.VK_W) 'keyrelease(keys.VK_W)
keycoderelease(ConvertCharToVirtualKey(txtKeyForward.Text)) keycoderelease(ConvertCharToVirtualKey(txtKeyForward.Text))
End If End If
@ -437,10 +448,10 @@ Class MainWindow
Public Sub togglematehelper() Public Sub togglematehelper()
If globvar_matehelperstate = False Then If globvar_matehelperstate = False Then
globvar_matehelperstate = True globvar_matehelperstate = True
overlaywin.OL_Update() clearol.refreshOL()
Else Else
globvar_matehelperstate = False globvar_matehelperstate = False
overlaywin.OL_Update() clearol.refreshOL()
keycoderelease(ConvertCharToVirtualKey(txtKeyWhistle.Text)) keycoderelease(ConvertCharToVirtualKey(txtKeyWhistle.Text))
End If End If
updateglobalstate() updateglobalstate()
@ -630,8 +641,8 @@ Class MainWindow
Private Sub MainWindow_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing Private Sub MainWindow_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
writeoptions() writeoptions()
overlaywin.Close() clearol.Close()
notifywin.Close() 'notifywin.Close()
End Sub End Sub
Private Sub btnSetDefault_Click(sender As Object, e As RoutedEventArgs) Handles btnSetDefault.Click Private Sub btnSetDefault_Click(sender As Object, e As RoutedEventArgs) Handles btnSetDefault.Click
@ -645,12 +656,12 @@ Class MainWindow
Private Sub chkEnableOverlay_Checked(sender As Object, e As RoutedEventArgs) Handles chkEnableOverlay.Checked Private Sub chkEnableOverlay_Checked(sender As Object, e As RoutedEventArgs) Handles chkEnableOverlay.Checked
globvar_enableoverlay = True globvar_enableoverlay = True
overlaywin.Show() clearol.Show()
End Sub End Sub
Private Sub chkEnableOverlay_Unchecked(sender As Object, e As RoutedEventArgs) Handles chkEnableOverlay.Unchecked Private Sub chkEnableOverlay_Unchecked(sender As Object, e As RoutedEventArgs) Handles chkEnableOverlay.Unchecked
globvar_enableoverlay = False globvar_enableoverlay = False
overlaywin.Hide() clearol.Hide()
End Sub End Sub
Private Function getkeycode(ByVal s As String) As keys Private Function getkeycode(ByVal s As String) As keys
@ -863,4 +874,11 @@ Class MainWindow
Private Sub btnExit_Click(sender As Object, e As RoutedEventArgs) Handles btnExit.Click Private Sub btnExit_Click(sender As Object, e As RoutedEventArgs) Handles btnExit.Click
Me.Close() Me.Close()
End Sub End Sub
Private Sub btnBrowsePathToGame_Click(sender As Object, e As RoutedEventArgs) Handles btnBrowsePathToGame.Click
Dim openfiledialog As New OpenFileDialog()
If openfiledialog.ShowDialog() = True Then
txtPathToGame.Text = Path.GetFullPath(openfiledialog.FileName)
End If
End Sub
End Class End Class