Refactor
This commit is contained in:
parent
66aecce5ef
commit
62a3b6a64d
@ -120,6 +120,11 @@ namespace rabi_splitter_WPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Log(string message)
|
||||||
|
{
|
||||||
|
this.DebugLog += message + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
[NotifyPropertyChangedInvocator]
|
[NotifyPropertyChangedInvocator]
|
||||||
@ -130,142 +135,193 @@ namespace rabi_splitter_WPF
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MainContext : INotifyPropertyChanged
|
class MainContext : INotifyPropertyChanged
|
||||||
|
|
||||||
{
|
{
|
||||||
private bool _musicStart;
|
public string oldtitle;
|
||||||
private bool _musicEnd;
|
public int veridx;
|
||||||
private bool _computer;
|
|
||||||
private bool _miruDe;
|
|
||||||
private bool _sideCh;
|
|
||||||
private bool _aliusI;
|
|
||||||
private bool _tm2;
|
|
||||||
private bool _irisu1;
|
|
||||||
private bool _dontSplitOnReload;
|
|
||||||
private bool _debugArea;
|
|
||||||
private int _serverPort;
|
private int _serverPort;
|
||||||
private string _gameVer;
|
private string _gameVer;
|
||||||
private string _gameMusic;
|
private string _gameMusic;
|
||||||
private bool _igt;
|
private bool _igt;
|
||||||
public bool _autoReset;
|
|
||||||
public bool _autoStart;
|
private string _text1;
|
||||||
public bool Noah1Reload
|
private string _text2;
|
||||||
|
private string _text3;
|
||||||
|
private string _text4;
|
||||||
|
private string _text5;
|
||||||
|
private string _text6;
|
||||||
|
private string _text7;
|
||||||
|
private string _text8;
|
||||||
|
private string _text9;
|
||||||
|
private string _text10;
|
||||||
|
private string _text11;
|
||||||
|
private string _text12;
|
||||||
|
private string _text13;
|
||||||
|
private string _text14;
|
||||||
|
private string _text15;
|
||||||
|
|
||||||
|
public string Text1
|
||||||
{
|
{
|
||||||
get { return _noah1Reload; }
|
get { return _text1; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _noah1Reload) return;
|
if (value == _text1) return;
|
||||||
_noah1Reload = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(Noah1Reload));
|
OnPropertyChanged(nameof(Text1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MusicStart
|
public string Text2
|
||||||
{
|
{
|
||||||
get { return _musicStart; }
|
get { return _text2; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _musicStart) return;
|
if (value == _text2) return;
|
||||||
_musicStart = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(MusicStart));
|
OnPropertyChanged(nameof(Text2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MusicEnd
|
public string Text3
|
||||||
{
|
{
|
||||||
get { return _musicEnd; }
|
get { return _text3; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _musicEnd) return;
|
if (value == _text3) return;
|
||||||
_musicEnd = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(MusicEnd));
|
OnPropertyChanged(nameof(Text3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Computer
|
public string Text4
|
||||||
{
|
{
|
||||||
get { return _computer; }
|
get { return _text4; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _computer) return;
|
if (value == _text4) return;
|
||||||
_computer = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(Computer));
|
OnPropertyChanged(nameof(Text4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool MiruDe
|
public string Text5
|
||||||
{
|
{
|
||||||
get { return _miruDe; }
|
get { return _text5; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _miruDe) return;
|
if (value == _text5) return;
|
||||||
_miruDe = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(MiruDe));
|
OnPropertyChanged(nameof(Text5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SideCh
|
public string Text6
|
||||||
{
|
{
|
||||||
get { return _sideCh; }
|
get { return _text6; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _sideCh) return;
|
if (value == _text6) return;
|
||||||
_sideCh = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(SideCh));
|
OnPropertyChanged(nameof(Text6));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AliusI
|
public string Text7
|
||||||
{
|
{
|
||||||
get { return _aliusI; }
|
get { return _text7; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _aliusI) return;
|
if (value == _text7) return;
|
||||||
_aliusI = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(AliusI));
|
OnPropertyChanged(nameof(Text7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Tm2
|
public string Text8
|
||||||
{
|
{
|
||||||
get { return _tm2; }
|
get { return _text8; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _tm2) return;
|
if (value == _text8) return;
|
||||||
_tm2 = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(Tm2));
|
OnPropertyChanged(nameof(Text8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Irisu1
|
public string Text9
|
||||||
{
|
{
|
||||||
get { return _irisu1; }
|
get { return _text9; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _irisu1) return;
|
if (value == _text9) return;
|
||||||
_irisu1 = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(Irisu1));
|
OnPropertyChanged(nameof(Text9));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DontSplitOnReload
|
public string Text10
|
||||||
{
|
{
|
||||||
get { return _dontSplitOnReload; }
|
get { return _text10; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _dontSplitOnReload) return;
|
if (value == _text10) return;
|
||||||
_dontSplitOnReload = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(DontSplitOnReload));
|
OnPropertyChanged(nameof(Text10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DebugArea
|
public string Text11
|
||||||
{
|
{
|
||||||
get { return _debugArea; }
|
get { return _text11; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _debugArea) return;
|
if (value == _text11) return;
|
||||||
_debugArea = value;
|
_gameVer = value;
|
||||||
OnPropertyChanged(nameof(DebugArea));
|
OnPropertyChanged(nameof(Text11));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text12
|
||||||
|
{
|
||||||
|
get { return _text12; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _text12) return;
|
||||||
|
_gameVer = value;
|
||||||
|
OnPropertyChanged(nameof(Text12));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text13
|
||||||
|
{
|
||||||
|
get { return _text13; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _text13) return;
|
||||||
|
_gameVer = value;
|
||||||
|
OnPropertyChanged(nameof(Text13));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text14
|
||||||
|
{
|
||||||
|
get { return _text14; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _text14) return;
|
||||||
|
_gameVer = value;
|
||||||
|
OnPropertyChanged(nameof(Text14));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Text15
|
||||||
|
{
|
||||||
|
get { return _text15; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _text15) return;
|
||||||
|
_gameVer = value;
|
||||||
|
OnPropertyChanged(nameof(Text15));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,62 +369,10 @@ namespace rabi_splitter_WPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AutoStart
|
|
||||||
{
|
|
||||||
get { return _autoStart; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == _autoStart) return;
|
|
||||||
_autoStart = value;
|
|
||||||
OnPropertyChanged(nameof(AutoStart));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AutoReset
|
|
||||||
{
|
|
||||||
get { return _autoReset; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == _autoReset) return;
|
|
||||||
_autoReset = value;
|
|
||||||
OnPropertyChanged(nameof(AutoReset));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int previousBlackness = -1;
|
|
||||||
public string oldtitle;
|
|
||||||
public int veridx;
|
|
||||||
public int lastmoney;
|
|
||||||
public int lastmapid;
|
|
||||||
public int lastmusicid;
|
|
||||||
public int lastplaytime = 0;
|
|
||||||
public bool bossbattle;
|
|
||||||
public List<int> lastbosslist;
|
|
||||||
public int lastnoah3hp;
|
|
||||||
public int lastTM;
|
|
||||||
public DateTime LastTMAddTime;
|
|
||||||
private bool _noah1Reload;
|
|
||||||
|
|
||||||
public MainContext()
|
public MainContext()
|
||||||
{
|
{
|
||||||
this.MusicEnd = true;
|
|
||||||
this.MusicStart = false;
|
|
||||||
this.Computer = true;
|
|
||||||
this.MiruDe = true;
|
|
||||||
this.SideCh = true;
|
|
||||||
this.AliusI = true;
|
|
||||||
this.Tm2 = true;
|
|
||||||
this.Irisu1 = true;
|
|
||||||
this.DontSplitOnReload = false;
|
|
||||||
this.DebugArea = false;
|
|
||||||
this.ServerPort = 16834;
|
this.ServerPort = 16834;
|
||||||
this.Igt = true;
|
this.Igt = true;
|
||||||
this.Noah1Reload = false;
|
|
||||||
this.AutoStart = false;
|
|
||||||
this.AutoReset = true;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
@ -378,9 +382,6 @@ namespace rabi_splitter_WPF
|
|||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<TextBlock Text="GitHub" MouseUp="TextBlock_MouseUp" Cursor="Hand" Foreground="Blue" TextDecorations="Underline" VerticalAlignment="Top" />
|
<TextBlock Text="GitHub" MouseUp="TextBlock_MouseUp" Cursor="Hand" Foreground="Blue" TextDecorations="Underline" VerticalAlignment="Top" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<DockPanel Margin="5" DockPanel.Dock="Top">
|
<DockPanel Margin="5" DockPanel.Dock="Top">
|
||||||
<StackPanel Margin="0,0,100,0">
|
<StackPanel Margin="0,0,100,0" Width="356">
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,0,0,3">
|
||||||
<TextBlock TextWrapping="Wrap" Text="LiveSplit Server Port" VerticalAlignment="Center" FontSize="16" Margin="0,0,10,0"/>
|
<TextBlock TextWrapping="Wrap" Text="LiveSplit Server Port" VerticalAlignment="Center" FontSize="16" Margin="0,0,10,0"/>
|
||||||
<TextBox TextWrapping="Wrap" Text="{Binding ServerPort}" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Padding="6,0"/>
|
<TextBox TextWrapping="Wrap" Text="{Binding ServerPort}" VerticalAlignment="Center" HorizontalAlignment="Center" VerticalContentAlignment="Center" FontSize="16" Padding="6,0"/>
|
||||||
@ -26,23 +26,43 @@
|
|||||||
<TextBlock TextWrapping="Wrap" Text="Rabi-Ribi Status:" FontSize="16"/>
|
<TextBlock TextWrapping="Wrap" Text="Rabi-Ribi Status:" FontSize="16"/>
|
||||||
<TextBlock TextWrapping="Wrap" Text="{Binding GameVer}" FontSize="16"/>
|
<TextBlock TextWrapping="Wrap" Text="{Binding GameVer}" FontSize="16"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock TextWrapping="Wrap" Text="{Binding GameMusic}" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4"/>
|
<Grid Height="280">
|
||||||
<CheckBox Content="Split when BOSS music STARTS" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MusicStart, Mode=TwoWay}"/>
|
<Grid.RowDefinitions>
|
||||||
<CheckBox Content="Split when BOSS music ENDS" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MusicEnd, Mode=TwoWay}"/>
|
<RowDefinition Height="3*"/>
|
||||||
<CheckBox Content="Split when the computer is found" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Computer, Mode=TwoWay}"/>
|
<RowDefinition Height="3*"/>
|
||||||
<CheckBox Content="Split when Miru despawns" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MiruDe, Mode=TwoWay}"/>
|
<RowDefinition Height="3*"/>
|
||||||
<CheckBox Content="Ignore the Side Chapter" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding SideCh, Mode=TwoWay}"/>
|
<RowDefinition Height="3*"/>
|
||||||
<CheckBox Content="Ignore the next "SUDDEN DEATH" (Ignore Alius I)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AliusI, Mode=TwoWay}" IsEnabled="{Binding AutoReset, Converter={StaticResource InverseBooleanConverter},Mode=TwoWay}" />
|
<RowDefinition Height="3*"/>
|
||||||
<CheckBox Content="Ignore the "M.R." (Reload on Noah 1)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Noah1Reload, Mode=TwoWay}" IsEnabled="{Binding AutoReset, Converter={StaticResource InverseBooleanConverter},Mode=TwoWay}"/>
|
<RowDefinition Height="3*"/>
|
||||||
<CheckBox Content="Split when Town Member +2 or Nixie despawns" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Tm2, Mode=TwoWay}"/>
|
</Grid.RowDefinitions>
|
||||||
<CheckBox Content="Ignore Irisu Phase 1" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Irisu1, Mode=TwoWay}"/>
|
<Grid.ColumnDefinitions>
|
||||||
<CheckBox Content="Don't split on reload during boss (1.75, experimental)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding DontSplitOnReload, Mode=TwoWay}"/>
|
<ColumnDefinition Width="1*"/>
|
||||||
<CheckBox Content="Track In-Game Time" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Igt, Mode=TwoWay}"/>
|
<ColumnDefinition Width="1*"/>
|
||||||
<CheckBox Content="Start timer on game start (1.75 only)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AutoStart, Mode=TwoWay}"/>
|
<ColumnDefinition Width="1*"/>
|
||||||
<CheckBox Content="Reset timer when returning to title screen" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AutoReset, Mode=TwoWay}"/>
|
</Grid.ColumnDefinitions>
|
||||||
<CheckBox Content="Show debug area" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding DebugArea, Mode=TwoWay}"/>
|
<TextBlock Grid.Row="0" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text1}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Text2}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="0" Grid.Column="2" TextWrapping="Wrap" Text="{Binding Text3}" FontSize="16"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text4}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Text5}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="2" TextWrapping="Wrap" Text="{Binding Text6}" FontSize="16"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text7}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Text8}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="2" TextWrapping="Wrap" Text="{Binding Text9}" FontSize="16"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text10}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Text11}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="3" Grid.Column="2" TextWrapping="Wrap" Text="{Binding Text12}" FontSize="16"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="0" TextWrapping="Wrap" Text="{Binding Text13}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="1" TextWrapping="Wrap" Text="{Binding Text14}" FontSize="16"/>
|
||||||
|
<TextBlock Grid.Row="4" Grid.Column="2" TextWrapping="Wrap" Text="{Binding Text15}" FontSize="16"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<DockPanel Visibility="{Binding DebugArea, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}" >
|
<DockPanel>
|
||||||
<TextBlock TextWrapping="Wrap" Text="debug area" Height="15.24" Width="352.251" DockPanel.Dock="Top"/>
|
<TextBlock TextWrapping="Wrap" Text="debug area" Height="15.24" Width="352.251" DockPanel.Dock="Top"/>
|
||||||
<CheckBox x:Name="BossEventDebug" IsEnabled="False" Content="(DEBUG)BOSS event tracked" FontSize="15" VerticalAlignment="Top" HorizontalAlignment="Left" IsChecked="{Binding BossEvent, Mode=TwoWay}" DockPanel.Dock="Top"/>
|
<CheckBox x:Name="BossEventDebug" IsEnabled="False" Content="(DEBUG)BOSS event tracked" FontSize="15" VerticalAlignment="Top" HorizontalAlignment="Left" IsChecked="{Binding BossEvent, Mode=TwoWay}" DockPanel.Dock="Top"/>
|
||||||
<Grid x:Name="DebugPanel" d:DataContext="{d:DesignData local:DebugContext}" DockPanel.Dock="Top">
|
<Grid x:Name="DebugPanel" d:DataContext="{d:DesignData local:DebugContext}" DockPanel.Dock="Top">
|
||||||
|
@ -25,18 +25,18 @@ namespace rabi_splitter_WPF
|
|||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
private MainContext mainContext;
|
private MainContext mainContext;
|
||||||
|
private RabiRibiDisplay rabiRibiDisplay;
|
||||||
private DebugContext debugContext;
|
private DebugContext debugContext;
|
||||||
private static TcpClient tcpclient;
|
private static TcpClient tcpclient;
|
||||||
private static NetworkStream networkStream;
|
private static NetworkStream networkStream;
|
||||||
private readonly Regex titleReg = new Regex(@"ver.*?(\d+\.?\d+.*)$");
|
private readonly Regex titleReg = new Regex(@"ver.*?(\d+\.?\d+.*)$");
|
||||||
private readonly Thread memoryThread;
|
private readonly Thread memoryThread;
|
||||||
|
|
||||||
private void ReadMemory()
|
private void ReadMemory()
|
||||||
{
|
{
|
||||||
|
|
||||||
var processlist = Process.GetProcessesByName("rabiribi");
|
var processlist = Process.GetProcessesByName("rabiribi");
|
||||||
if (processlist.Length > 0)
|
if (processlist.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
Process process = processlist[0];
|
Process process = processlist[0];
|
||||||
if (process.MainWindowTitle != mainContext.oldtitle)
|
if (process.MainWindowTitle != mainContext.oldtitle)
|
||||||
{
|
{
|
||||||
@ -44,393 +44,37 @@ namespace rabi_splitter_WPF
|
|||||||
string rabiver;
|
string rabiver;
|
||||||
if (result.Success)
|
if (result.Success)
|
||||||
{
|
{
|
||||||
|
rabiver = result.Groups[1].Value;
|
||||||
rabiver = result.Groups[1].Value;
|
|
||||||
mainContext.veridx = Array.IndexOf(StaticData.VerNames, rabiver);
|
mainContext.veridx = Array.IndexOf(StaticData.VerNames, rabiver);
|
||||||
if (mainContext.veridx < 0)
|
if (mainContext.veridx < 0)
|
||||||
{
|
{
|
||||||
mainContext.GameVer = rabiver + " Running (not support)";
|
mainContext.GameVer = rabiver + " Running (not supported)";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainContext.veridx = -1;
|
mainContext.veridx = -1;
|
||||||
mainContext.GameVer = "Running (Unknown version)";
|
mainContext.GameVer = "Running (Unknown version)";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mainContext.GameVer = rabiver + " Running";
|
mainContext.GameVer = rabiver + " Running";
|
||||||
mainContext.oldtitle = process.MainWindowTitle;
|
mainContext.oldtitle = process.MainWindowTitle;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mainContext.veridx < 0) return;
|
if (mainContext.veridx < 0) return;
|
||||||
|
|
||||||
|
rabiRibiDisplay.ReadMemory(process);
|
||||||
#region read igt
|
|
||||||
|
|
||||||
int igt = MemoryHelper.GetMemoryValue<int>(process, StaticData.IGTAddr[mainContext.veridx]);
|
|
||||||
if (igt > 0 && mainContext.Igt)
|
|
||||||
{
|
|
||||||
sendigt((float)igt / 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Detect Reload
|
|
||||||
|
|
||||||
bool reloaded = false;
|
|
||||||
{
|
|
||||||
int playtime = MemoryHelper.GetMemoryValue<int>(process, StaticData.PlaytimeAddr[mainContext.veridx]);
|
|
||||||
reloaded = playtime != 0 && playtime < mainContext.lastplaytime;
|
|
||||||
if (reloaded) DebugLog("Reload Game!");
|
|
||||||
mainContext.lastplaytime = playtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Detect Start Game
|
|
||||||
|
|
||||||
{
|
|
||||||
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]);
|
|
||||||
if (mainContext.previousBlackness == 0 && blackness >= 100000)
|
|
||||||
{
|
|
||||||
// Sudden increase by 100000
|
|
||||||
// Have to be careful, though. I don't know whether anything else causes blackness to increase by 100000
|
|
||||||
if (mainContext.AutoStart) sendstarttimer();
|
|
||||||
DebugLog("Start Game!");
|
|
||||||
}
|
|
||||||
mainContext.previousBlackness = blackness;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region CheckMoney
|
|
||||||
|
|
||||||
if (mainContext.Computer)
|
|
||||||
{
|
|
||||||
var newmoney = MemoryHelper.GetMemoryValue<int>(process, StaticData.MoneyAddress[mainContext.veridx]);
|
|
||||||
if (newmoney - mainContext.lastmoney == 17500)
|
|
||||||
{
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("get 17500 en, split");
|
|
||||||
}
|
|
||||||
mainContext.lastmoney = newmoney;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
int mapid = MemoryHelper.GetMemoryValue<int>(process, StaticData.MapAddress[mainContext.veridx]);
|
|
||||||
if (mainContext.lastmapid != mapid)
|
|
||||||
{
|
|
||||||
DebugLog("newmap: " + mapid + ":" + StaticData.MapNames[mapid]);
|
|
||||||
mainContext.lastmapid = mapid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region checkTM
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Music
|
|
||||||
|
|
||||||
int musicaddr = StaticData.MusicAddr[mainContext.veridx];
|
|
||||||
int musicid = MemoryHelper.GetMemoryValue<int>(process, musicaddr);
|
|
||||||
if (musicid > 0 && musicid < StaticData.MusicNames.Length)
|
|
||||||
{
|
|
||||||
if (mainContext.lastmusicid != musicid)
|
|
||||||
{
|
|
||||||
DebugLog("new music:" + musicid + ":" + StaticData.MusicNames[musicid]);
|
|
||||||
mainContext.GameMusic = StaticData.MusicNames[musicid];
|
|
||||||
|
|
||||||
if ((musicid == 45 || musicid == 46 || musicid == 53) && mainContext.AutoReset)
|
|
||||||
{
|
|
||||||
DebugLog("Title music, reset");
|
|
||||||
//reset
|
|
||||||
sendreset();
|
|
||||||
mainContext.AliusI = true;
|
|
||||||
mainContext.Noah1Reload = false;
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var bossmusicflag = StaticData.BossMusics.Contains(musicid);
|
|
||||||
if (bossmusicflag)
|
|
||||||
{
|
|
||||||
if (mainContext.bossbattle)
|
|
||||||
{
|
|
||||||
if (mainContext.Noah1Reload && (mainContext.lastmusicid == 52 || musicid == 52))
|
|
||||||
{
|
|
||||||
DebugLog("noah 1 reload? ignore");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mainContext.MusicStart || mainContext.MusicEnd)
|
|
||||||
{
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("new boss music, split");
|
|
||||||
|
|
||||||
}
|
|
||||||
if (musicid == 37)
|
|
||||||
{
|
|
||||||
mainContext.Noah1Reload = true;
|
|
||||||
DebugLog("noah1 music start, ignore MR forever");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mainContext.lastmusicid = musicid;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!mainContext.bossbattle)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (musicid == 54 && mainContext.AliusI)
|
|
||||||
{
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
mainContext.AliusI = false;
|
|
||||||
DebugLog("Alius music, ignore once");
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (musicid == 42 && mapid == 1 && mainContext.Irisu1)
|
|
||||||
{
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
DebugLog("Irisu P1, ignore");
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (bossmusicflag)
|
|
||||||
{
|
|
||||||
if (mapid == 5 && musicid == 44 && mainContext.SideCh)
|
|
||||||
{
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
DebugLog("sidechapter, ignore");
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainContext.bossbattle = true;
|
|
||||||
mainContext.lastbosslist = new List<int>();
|
|
||||||
mainContext.lastnoah3hp = -1;
|
|
||||||
if (musicid == 37)
|
|
||||||
{
|
|
||||||
mainContext.Noah1Reload = true;
|
|
||||||
DebugLog("noah1 music start, ignore MR forever");
|
|
||||||
}
|
|
||||||
if (mainContext.MusicStart)
|
|
||||||
{
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("music start, split");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!bossmusicflag) //boss music end!
|
|
||||||
{
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
if (mainContext.MusicEnd)
|
|
||||||
{
|
|
||||||
if (!mainContext.DontSplitOnReload || !reloaded) sendsplit();
|
|
||||||
DebugLog(reloaded ? "music end, don't split (reload)" : "music end, split");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mainContext.lastmusicid = musicid;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainContext.GameMusic = "N/A";
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion Music
|
|
||||||
|
|
||||||
#region SpecialBOSS
|
|
||||||
|
|
||||||
if (mainContext.bossbattle)
|
|
||||||
{
|
|
||||||
if (mainContext.MiruDe || false)//todo noah3 option
|
|
||||||
{
|
|
||||||
int Noah3HP = -1;
|
|
||||||
|
|
||||||
if (mapid >= 0 && mapid < StaticData.MapNames.Length)
|
|
||||||
{
|
|
||||||
int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[mainContext.veridx]);
|
|
||||||
List<int> bosses = new List<int>();
|
|
||||||
for (var i = 0; i < 50; i++)
|
|
||||||
{
|
|
||||||
ptr = ptr + StaticData.EnenyEntitySize[mainContext.veridx];
|
|
||||||
|
|
||||||
var emyid = MemoryHelper.GetMemoryValue<int>(process,
|
|
||||||
ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false);
|
|
||||||
if (StaticData.BossNames.ContainsKey(emyid))
|
|
||||||
{
|
|
||||||
bosses.Add(emyid);
|
|
||||||
if (emyid == 1053)
|
|
||||||
{
|
|
||||||
Noah3HP = MemoryHelper.GetMemoryValue<int>(process,
|
|
||||||
ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (mainContext.MiruDe && mapid==8)
|
|
||||||
{
|
|
||||||
foreach (var boss in mainContext.lastbosslist)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (boss == 1043)
|
|
||||||
{
|
|
||||||
if (!bosses.Contains(boss)) //despawn
|
|
||||||
{
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("miru despawn, split");
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (cbBoss3.Checked)
|
|
||||||
// {
|
|
||||||
// if (bosses.Contains(1053) && Noah3HP < lastnoah3hp && Noah3HP == 1)
|
|
||||||
// {
|
|
||||||
// sendsplit();
|
|
||||||
// DebugLog("noah3 hp 1, split");
|
|
||||||
// bossbattle = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if (mainContext.Tm2 && musicid == 8)
|
|
||||||
{
|
|
||||||
bool f = true;
|
|
||||||
foreach (var boss in mainContext.lastbosslist)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (boss == 1024)
|
|
||||||
{
|
|
||||||
if (!bosses.Contains(boss)) //despawn
|
|
||||||
{
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("nixie despawn, split");
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
f = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int newTM = MemoryHelper.GetMemoryValue<int>(process, StaticData.TownMemberAddr[mainContext.veridx]);
|
|
||||||
if (newTM - mainContext.lastTM == 1 && f) //for after 1.71 , 1.71 isn't TM+2 at once when skip Nixie, it's TM+1 twice
|
|
||||||
|
|
||||||
{
|
|
||||||
if (DateTime.Now - mainContext.LastTMAddTime < TimeSpan.FromSeconds(1))
|
|
||||||
{
|
|
||||||
var d = DateTime.Now - mainContext.LastTMAddTime;
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("TM+2 in " + d.TotalMilliseconds + " ms, split");
|
|
||||||
}
|
|
||||||
mainContext.LastTMAddTime = DateTime.Now;
|
|
||||||
}
|
|
||||||
else if (newTM - mainContext.lastTM == 2 && f)//for 1.65-1.70
|
|
||||||
{
|
|
||||||
mainContext.bossbattle = false;
|
|
||||||
sendsplit();
|
|
||||||
DebugLog("TM+2, split");
|
|
||||||
}
|
|
||||||
mainContext.lastTM = newTM;
|
|
||||||
}
|
|
||||||
mainContext.lastbosslist = bosses;
|
|
||||||
mainContext.lastnoah3hp = Noah3HP;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion SpecialBOSS
|
|
||||||
|
|
||||||
if (mainContext.DebugArea)
|
|
||||||
{
|
|
||||||
int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[mainContext.veridx]);
|
|
||||||
// List<int> bosses = new List<int>();
|
|
||||||
// List<int> HPS = new List<int>();
|
|
||||||
// this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => debugContext.BossList.Clear()));
|
|
||||||
// ptr += StaticData.EnenyEntitySize[mainContext.veridx] * 3;
|
|
||||||
for (var i = 0; i < 50; i++)
|
|
||||||
{
|
|
||||||
ptr += StaticData.EnenyEntitySize[mainContext.veridx];
|
|
||||||
debugContext.BossList[i].BossID = MemoryHelper.GetMemoryValue<int>(process,
|
|
||||||
ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false);
|
|
||||||
debugContext.BossList[i].BossHP = MemoryHelper.GetMemoryValue<int>(process,
|
|
||||||
ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
debugContext.BossEvent = mainContext.bossbattle;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
mainContext.oldtitle = "";
|
mainContext.oldtitle = "";
|
||||||
|
|
||||||
mainContext.GameVer = "Not Found";
|
mainContext.GameVer = "Not Found";
|
||||||
mainContext.GameMusic = "N/A";
|
mainContext.GameMusic = "N/A";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DebugLog(string log)
|
public void SendMessage(string message)
|
||||||
{
|
|
||||||
this.debugContext.DebugLog += log + "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendsplit()
|
|
||||||
{
|
|
||||||
SendMessage("split\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendreset()
|
|
||||||
{
|
|
||||||
SendMessage("reset\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendstarttimer()
|
|
||||||
{
|
|
||||||
SendMessage("starttimer\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendigt(float time)
|
|
||||||
{
|
|
||||||
SendMessage($"setgametime {time}\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SendMessage(string message)
|
|
||||||
{
|
{
|
||||||
if (tcpclient != null && tcpclient.Connected)
|
if (tcpclient != null && tcpclient.Connected)
|
||||||
{
|
{
|
||||||
@ -446,6 +90,7 @@ namespace rabi_splitter_WPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void disconnect()
|
void disconnect()
|
||||||
{
|
{
|
||||||
tcpclient = null;
|
tcpclient = null;
|
||||||
@ -453,8 +98,11 @@ namespace rabi_splitter_WPF
|
|||||||
{
|
{
|
||||||
BtnConnect.IsEnabled = true;
|
BtnConnect.IsEnabled = true;
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DebugLog(string log)
|
||||||
|
{
|
||||||
|
this.debugContext.Log(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
@ -466,6 +114,7 @@ namespace rabi_splitter_WPF
|
|||||||
DebugPanel.DataContext = debugContext;
|
DebugPanel.DataContext = debugContext;
|
||||||
this.Grid.ItemsSource = debugContext.BossList;
|
this.Grid.ItemsSource = debugContext.BossList;
|
||||||
BossEventDebug.DataContext = debugContext;
|
BossEventDebug.DataContext = debugContext;
|
||||||
|
rabiRibiDisplay = new RabiRibiDisplay(mainContext, debugContext, this);
|
||||||
memoryThread = new Thread(() =>
|
memoryThread = new Thread(() =>
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -9,6 +9,9 @@ namespace rabi_splitter_WPF
|
|||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
|
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
public static extern bool CloseHandle(IntPtr hObject);
|
||||||
|
|
||||||
[DllImport("kernel32.dll")]
|
[DllImport("kernel32.dll")]
|
||||||
public static extern bool ReadProcessMemory(int hProcess,
|
public static extern bool ReadProcessMemory(int hProcess,
|
||||||
int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
|
int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);
|
||||||
@ -57,6 +60,7 @@ namespace rabi_splitter_WPF
|
|||||||
datasize, ref bytesRead);
|
datasize, ref bytesRead);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
CloseHandle(processHandle);
|
||||||
switch (Type.GetTypeCode(typeof(T)))
|
switch (Type.GetTypeCode(typeof(T)))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
150
rabi_splitter_WPF/RabiRibiDisplay.cs
Normal file
150
rabi_splitter_WPF/RabiRibiDisplay.cs
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace rabi_splitter_WPF
|
||||||
|
{
|
||||||
|
class RabiRibiDisplay
|
||||||
|
{
|
||||||
|
private MainContext mainContext;
|
||||||
|
private DebugContext debugContext;
|
||||||
|
private MainWindow mainWindow;
|
||||||
|
|
||||||
|
public int previousBlackness = -1;
|
||||||
|
public int lastmoney;
|
||||||
|
public int lastmapid;
|
||||||
|
public int lastmusicid;
|
||||||
|
public int lastplaytime = 0;
|
||||||
|
public bool bossbattle;
|
||||||
|
public List<int> lastbosslist;
|
||||||
|
public int lastnoah3hp;
|
||||||
|
public int lastTM;
|
||||||
|
public DateTime LastTMAddTime;
|
||||||
|
private bool _noah1Reload;
|
||||||
|
|
||||||
|
|
||||||
|
public RabiRibiDisplay(MainContext mainContext, DebugContext debugContext, MainWindow mainWindow)
|
||||||
|
{
|
||||||
|
this.mainContext = mainContext;
|
||||||
|
this.debugContext = debugContext;
|
||||||
|
this.mainWindow = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadMemory(Process process)
|
||||||
|
{
|
||||||
|
#region read igt
|
||||||
|
|
||||||
|
int igt = MemoryHelper.GetMemoryValue<int>(process, StaticData.IGTAddr[mainContext.veridx]);
|
||||||
|
if (igt > 0 && mainContext.Igt)
|
||||||
|
{
|
||||||
|
sendigt((float)igt / 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Detect Reload
|
||||||
|
|
||||||
|
bool reloaded = false;
|
||||||
|
{
|
||||||
|
int playtime = MemoryHelper.GetMemoryValue<int>(process, StaticData.PlaytimeAddr[mainContext.veridx]);
|
||||||
|
reloaded = playtime != 0 && playtime < lastplaytime;
|
||||||
|
if (reloaded) DebugLog("Reload Game!");
|
||||||
|
lastplaytime = playtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Detect Start Game
|
||||||
|
|
||||||
|
{
|
||||||
|
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]);
|
||||||
|
if (previousBlackness == 0 && blackness >= 100000)
|
||||||
|
{
|
||||||
|
// Sudden increase by 100000
|
||||||
|
// Have to be careful, though. I don't know whether anything else causes blackness to increase by 100000
|
||||||
|
DebugLog("Start Game!");
|
||||||
|
}
|
||||||
|
previousBlackness = blackness;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region CheckMoney
|
||||||
|
|
||||||
|
{
|
||||||
|
var newmoney = MemoryHelper.GetMemoryValue<int>(process, StaticData.MoneyAddress[mainContext.veridx]);
|
||||||
|
if (newmoney - lastmoney == 17500)
|
||||||
|
{
|
||||||
|
sendsplit();
|
||||||
|
DebugLog("get 17500 en, split");
|
||||||
|
}
|
||||||
|
lastmoney = newmoney;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
int mapid = MemoryHelper.GetMemoryValue<int>(process, StaticData.MapAddress[mainContext.veridx]);
|
||||||
|
if (lastmapid != mapid)
|
||||||
|
{
|
||||||
|
DebugLog("newmap: " + mapid + ":" + StaticData.MapNames[mapid]);
|
||||||
|
lastmapid = mapid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region checkTM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
UpdateDebugArea(process);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateDebugArea(Process process)
|
||||||
|
{
|
||||||
|
int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[mainContext.veridx]);
|
||||||
|
// List<int> bosses = new List<int>();
|
||||||
|
// List<int> HPS = new List<int>();
|
||||||
|
// this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => debugContext.BossList.Clear()));
|
||||||
|
// ptr += StaticData.EnenyEntitySize[mainContext.veridx] * 3;
|
||||||
|
for (var i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
|
ptr += StaticData.EnenyEntitySize[mainContext.veridx];
|
||||||
|
debugContext.BossList[i].BossID = MemoryHelper.GetMemoryValue<int>(process,
|
||||||
|
ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false);
|
||||||
|
debugContext.BossList[i].BossHP = MemoryHelper.GetMemoryValue<int>(process,
|
||||||
|
ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false);
|
||||||
|
}
|
||||||
|
|
||||||
|
debugContext.BossEvent = bossbattle;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DebugLog(string log)
|
||||||
|
{
|
||||||
|
this.debugContext.Log(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendsplit()
|
||||||
|
{
|
||||||
|
mainWindow.SendMessage("split\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendreset()
|
||||||
|
{
|
||||||
|
mainWindow.SendMessage("reset\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendstarttimer()
|
||||||
|
{
|
||||||
|
mainWindow.SendMessage("starttimer\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendigt(float time)
|
||||||
|
{
|
||||||
|
mainWindow.SendMessage($"setgametime {time}\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -55,6 +55,7 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
|
<Compile Include="RabiRibiDisplay.cs" />
|
||||||
<Compile Include="StaticData.cs" />
|
<Compile Include="StaticData.cs" />
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user