Add feature: automatically start timer when starting game. Experimental. 1.75 only for same reason as before. Meh. lazyness
This commit is contained in:
parent
b1405598bb
commit
bf444802a4
@ -147,6 +147,7 @@ namespace rabi_splitter_WPF
|
||||
private string _gameMusic;
|
||||
private bool _igt;
|
||||
public bool _autoReset;
|
||||
public bool _autoStart;
|
||||
public bool Noah1Reload
|
||||
{
|
||||
get { return _noah1Reload; }
|
||||
@ -312,6 +313,17 @@ 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; }
|
||||
@ -324,7 +336,7 @@ namespace rabi_splitter_WPF
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool readyToStartGame = false;
|
||||
public string oldtitle;
|
||||
public int veridx;
|
||||
public int lastmoney;
|
||||
@ -353,6 +365,7 @@ namespace rabi_splitter_WPF
|
||||
this.ServerPort = 16834;
|
||||
this.Igt = true;
|
||||
this.Noah1Reload = false;
|
||||
this.AutoStart = false;
|
||||
this.AutoReset = true;
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
<CheckBox Content="Ignore Irisu Phase 1" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Irisu1, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Don't split on reload during boss" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding DontSplitOnReload, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Track In-Game Time" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Igt, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Start timer on game start" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AutoStart, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Reset timer when returning to title screen" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AutoReset, Mode=TwoWay}"/>
|
||||
<CheckBox Content="Show debug area" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding DebugArea, Mode=TwoWay}"/>
|
||||
</StackPanel>
|
||||
|
@ -94,7 +94,40 @@ namespace rabi_splitter_WPF
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Detect Start Game
|
||||
|
||||
{
|
||||
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]); // blackness
|
||||
if (blackness == 0)
|
||||
{
|
||||
if (!mainContext.readyToStartGame)
|
||||
{
|
||||
mainContext.readyToStartGame = true;
|
||||
}
|
||||
}
|
||||
else if (blackness >= 100000)
|
||||
{
|
||||
if (mainContext.readyToStartGame)
|
||||
{
|
||||
// suddent jump to 100000.
|
||||
mainContext.readyToStartGame = false;
|
||||
if (mainContext.AutoStart) sendstarttimer();
|
||||
DebugLog("Start Game!");
|
||||
}
|
||||
}
|
||||
else // 0 < blackness < 100000
|
||||
{
|
||||
if (mainContext.readyToStartGame)
|
||||
{
|
||||
// disarm ready trigger.
|
||||
mainContext.readyToStartGame = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CheckMoney
|
||||
|
||||
if (mainContext.Computer)
|
||||
@ -396,44 +429,31 @@ namespace rabi_splitter_WPF
|
||||
|
||||
private void sendsplit()
|
||||
{
|
||||
if (tcpclient != null && tcpclient.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
var b = Encoding.UTF8.GetBytes("split\r\n");
|
||||
networkStream.Write(b, 0, b.Length);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
SendMessage("split\r\n");
|
||||
}
|
||||
|
||||
private void sendreset()
|
||||
{
|
||||
if (tcpclient != null && tcpclient.Connected)
|
||||
{
|
||||
try
|
||||
{
|
||||
var b = Encoding.UTF8.GetBytes("reset\r\n");
|
||||
networkStream.Write(b, 0, b.Length);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
var b = Encoding.UTF8.GetBytes($"setgametime {time}\r\n");
|
||||
var b = Encoding.UTF8.GetBytes(message);
|
||||
networkStream.Write(b, 0, b.Length);
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -164,7 +164,8 @@ namespace rabi_splitter_WPF
|
||||
|
||||
public static int[] TownMemberAddr = {0xD38934, 0xD5C0F4, 0xD63BC4, 0xD65BC4 };
|
||||
public static int[] IGTAddr = { 0xD388E0, 0xD5C0A0, 0xD63B70, 0xD65B70 };
|
||||
|
||||
|
||||
public static int[] BlacknessAddr = { 0, 0, 0, 0xA723B0 };
|
||||
public static int[] PlaytimeAddr = { 0, 0, 0, 0xD642D8 };
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user