rabi_display
Copy Liu 8 years ago
parent 8be92a35be
commit 52458e06df
No known key found for this signature in database
GPG Key ID: 63A453DBF23409AF
  1. 63
      rabi_splitter_WPF/MainContext.cs
  2. 53
      rabi_splitter_WPF/MainWindow.xaml
  3. 86
      rabi_splitter_WPF/MainWindow.xaml.cs

@ -10,10 +10,42 @@ namespace rabi_splitter_WPF
{ {
public class BossData:INotifyPropertyChanged public class BossData:INotifyPropertyChanged
{ {
private int _bossIdx;
private int _bossId;
private int _bossHp;
public int BossIdx { get; set; } public int BossIdx
public int BossID { get; set; } {
public int BossHP { get; set; } get { return _bossIdx; }
set
{
if (value == _bossIdx) return;
_bossIdx = value;
OnPropertyChanged(nameof(BossIdx));
}
}
public int BossID
{
get { return _bossId; }
set
{
if (value == _bossId) return;
_bossId = value;
OnPropertyChanged(nameof(BossID));
}
}
public int BossHP
{
get { return _bossHp; }
set
{
if (value == _bossHp) return;
_bossHp = value;
OnPropertyChanged(nameof(BossHP));
}
}
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
@ -31,6 +63,18 @@ namespace rabi_splitter_WPF
public ObservableCollection<BossData> BossList = new ObservableCollection<BossData>(); public ObservableCollection<BossData> BossList = new ObservableCollection<BossData>();
public DebugContext()
{
BossList=new ObservableCollection<BossData>();
for (int i = 0; i < 50; i++)
{
BossList.Add(new BossData()
{
BossIdx = i
});
}
}
public bool BossEvent public bool BossEvent
{ {
get { return _bossEvent; } get { return _bossEvent; }
@ -79,6 +123,17 @@ namespace rabi_splitter_WPF
private string _gameMusic; private string _gameMusic;
private bool _igt; private bool _igt;
public bool Noah1Reload
{
get { return _noah1Reload; }
set
{
if (value == _noah1Reload) return;
_noah1Reload = value;
OnPropertyChanged(nameof(Noah1Reload));
}
}
public bool MusicStart public bool MusicStart
{ {
get { return _musicStart; } get { return _musicStart; }
@ -233,6 +288,7 @@ namespace rabi_splitter_WPF
public int lastnoah3hp; public int lastnoah3hp;
public int lastTM; public int lastTM;
public DateTime LastTMAddTime; public DateTime LastTMAddTime;
private bool _noah1Reload;
public MainContext() public MainContext()
{ {
@ -247,6 +303,7 @@ namespace rabi_splitter_WPF
this.DebugArea = false; this.DebugArea = false;
this.ServerPort = 16834; this.ServerPort = 16834;
this.Igt = true; this.Igt = true;
this.Noah1Reload = false;
} }

@ -4,13 +4,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:rabi_splitter_WPF" xmlns:local="clr-namespace:rabi_splitter_WPF"
mc:Ignorable="d" mc:Ignorable="d" SizeToContent="Width"
Title="Irisu is watching you" d:DataContext="{d:DesignData local:MainContext}" SizeToContent="WidthAndHeight"> Title="Irisu is watching you" d:DataContext="{d:DesignData local:MainContext}" d:DesignWidth="835.476" Height="391.628">
<Window.Resources> <Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</Window.Resources> </Window.Resources>
<DockPanel> <DockPanel>
<StackPanel Orientation="Horizontal" Margin="5" DockPanel.Dock="Top"> <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Left">
<TextBlock Text="v0.3" Margin="0,0,30,0" VerticalAlignment="Top" />
<TextBlock Text="GitHub" MouseUp="TextBlock_MouseUp" Cursor="Hand" Foreground="Blue" TextDecorations="Underline" VerticalAlignment="Top" />
</StackPanel>
<DockPanel Margin="5" DockPanel.Dock="Top">
<StackPanel Margin="0,0,100,0"> <StackPanel Margin="0,0,100,0">
<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"/>
@ -24,36 +28,37 @@
<TextBlock TextWrapping="Wrap" Text="{Binding GameMusic}" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4"/> <TextBlock TextWrapping="Wrap" Text="{Binding GameMusic}" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4"/>
<CheckBox Content="Split when BOSS music STARTS" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MusicStart, Mode=TwoWay}"/> <CheckBox Content="Split when BOSS music STARTS" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MusicStart, Mode=TwoWay}"/>
<CheckBox Content="Split when BOSS music ENDS" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MusicEnd, Mode=TwoWay}"/> <CheckBox Content="Split when BOSS music ENDS" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MusicEnd, Mode=TwoWay}"/>
<CheckBox Content="Split when the computer is found" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Computer,Mode=TwoWay}"/> <CheckBox Content="Split when the computer is found" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Computer, Mode=TwoWay}"/>
<CheckBox Content="Split when Miru despawns" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MiruDe,Mode=TwoWay}"/> <CheckBox Content="Split when Miru despawns" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding MiruDe, Mode=TwoWay}"/>
<CheckBox Content="Ignore the Side Chapter" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding SideCh,Mode=TwoWay}"/> <CheckBox Content="Ignore the Side Chapter" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding SideCh, Mode=TwoWay}"/>
<CheckBox Content="Ignore the next &quot;SUDDEN DEATH&quot; (Ignore Alius I)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AliusI,Mode=TwoWay}" IsEnabled="False"/> <CheckBox Content="Ignore the next &quot;SUDDEN DEATH&quot; (Ignore Alius I)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding AliusI, Mode=TwoWay}" IsEnabled="False"/>
<CheckBox Content="Split when Town Member +2 or Nixie despawns" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Tm2,Mode=TwoWay}"/> <CheckBox Content="Ignore the &quot;M.R.&quot; (Reload on Noah 1)" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Noah1Reload, Mode=TwoWay}" IsEnabled="False"/>
<CheckBox Content="Ignore Irisu Phase 1" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Irisu1,Mode=TwoWay}"/> <CheckBox Content="Split when Town Member +2 or Nixie despawns" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Tm2, Mode=TwoWay}"/>
<CheckBox Content="Track In-Game Time" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Igt,Mode=TwoWay}"/> <CheckBox Content="Ignore Irisu Phase 1" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Irisu1, Mode=TwoWay}"/>
<CheckBox Content="Show debug area" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding DebugArea,Mode=TwoWay}"/> <CheckBox Content="Track In-Game Time" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Igt, Mode=TwoWay}"/>
<CheckBox Content="Show debug area" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding DebugArea, Mode=TwoWay}"/>
</StackPanel> </StackPanel>
<StackPanel Visibility="{Binding DebugArea, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}" > <DockPanel Visibility="{Binding DebugArea, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}" >
<DockPanel x:Name="DebugPanel" LastChildFill="True" d:DataContext="{d:DesignData local:DebugContext}"> <TextBlock TextWrapping="Wrap" Text="debug area" Height="15.24" Width="352.251" DockPanel.Dock="Top"/>
<TextBlock TextWrapping="Wrap" Text="debug area" 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 IsEnabled="False" Content="(DEBUG)BOSS event tracked" FontSize="15" Margin="0,0,0,4" VerticalAlignment="Top" HorizontalAlignment="Left" DockPanel.Dock="Top" IsChecked="{Binding BossEvent,Mode=TwoWay}"/> <Grid x:Name="DebugPanel" d:DataContext="{d:DesignData local:DebugContext}" DockPanel.Dock="Top">
<DataGrid ItemsSource="{Binding BossList}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow" DockPanel.Dock="Top" <Grid.RowDefinitions>
d:DataContext="{d:DesignData local:BossData}"> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<DataGrid x:Name="Grid" ItemsSource="{Binding BossList}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow"
d:DataContext="{d:DesignData local:BossData}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Binding="{Binding BossIdx}" ClipboardContentBinding="{Binding BossIdx}" Header="Index"/> <DataGridTextColumn Binding="{Binding BossIdx}" ClipboardContentBinding="{Binding BossIdx}" Header="Index"/>
<DataGridTextColumn Binding="{Binding BossID}" ClipboardContentBinding="{Binding BossID}" Header="Entity ID"/> <DataGridTextColumn Binding="{Binding BossID}" ClipboardContentBinding="{Binding BossID}" Header="Entity ID"/>
<DataGridTextColumn Binding="{Binding BossHP}" ClipboardContentBinding="{Binding BossHP}" Header="HP"/> <DataGridTextColumn Binding="{Binding BossHP}" ClipboardContentBinding="{Binding BossHP}" Header="HP"/>
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog,Mode=TwoWay}" DockPanel.Dock="Bottom" MinHeight="203"/> <TextBox TextWrapping="Wrap" Text="{Binding DebugLog, Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Visible"/>
</Grid>
</DockPanel> </DockPanel>
</StackPanel>
</StackPanel> </DockPanel>
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
<TextBlock Text="v0.3" Margin="0,0,30,0" ></TextBlock>
<TextBlock Text="GitHub" MouseUp="TextBlock_MouseUp" Cursor="Hand" Foreground="Blue" TextDecorations="Underline" ></TextBlock>
</StackPanel>
</DockPanel> </DockPanel>
</Window> </Window>

@ -80,6 +80,11 @@ namespace rabi_splitter_WPF
{ {
sendigt((float)igt / 60); sendigt((float)igt / 60);
} }
if (igt > 0 && igt < 3600)
{
mainContext.AliusI = true;
mainContext.Noah1Reload = false;
}
#endregion #endregion
@ -128,13 +133,25 @@ namespace rabi_splitter_WPF
{ {
if (mainContext.bossbattle) if (mainContext.bossbattle)
{ {
//直接换boss曲 if (mainContext.Noah1Reload && (mainContext.lastmusicid == 52 || musicid == 52))
{
DebugLog("noah 1 reload? ignore");
}
else
{
if (mainContext.MusicStart || mainContext.MusicEnd) if (mainContext.MusicStart || mainContext.MusicEnd)
{ {
sendsplit(); sendsplit();
DebugLog("new boss music, split"); DebugLog("new boss music, split");
}
if (musicid == 37)
{
mainContext.Noah1Reload = true;
DebugLog("noah1 music start, ignore MR forever");
}
} }
debugContext.BossEvent = true;
mainContext.lastmusicid = musicid; mainContext.lastmusicid = musicid;
return; return;
} }
@ -145,15 +162,13 @@ namespace rabi_splitter_WPF
if (musicid == 54 && mainContext.AliusI) if (musicid == 54 && mainContext.AliusI)
{ {
mainContext.bossbattle = false; mainContext.bossbattle = false;
debugContext.BossEvent = false;
mainContext.AliusI = false; mainContext.AliusI = false;
DebugLog("Alius music, ignore once"); DebugLog("Alius music, ignore once");
} }
if (musicid == 42 && mapid == 1 && mainContext.Irisu1) else if (musicid == 42 && mapid == 1 && mainContext.Irisu1)
{ {
mainContext.bossbattle = false; mainContext.bossbattle = false;
debugContext.BossEvent = false;
DebugLog("Irisu P1, ignore"); DebugLog("Irisu P1, ignore");
} }
@ -164,20 +179,24 @@ namespace rabi_splitter_WPF
if (mapid == 5 && musicid == 44 && mainContext.SideCh) if (mapid == 5 && musicid == 44 && mainContext.SideCh)
{ {
mainContext.bossbattle = false; mainContext.bossbattle = false;
debugContext.BossEvent = false;
DebugLog("sidechapter, ignore"); DebugLog("sidechapter, ignore");
} }
else else
{ {
mainContext.bossbattle = true; mainContext.bossbattle = true;
debugContext.BossEvent = true;
mainContext.lastbosslist = new List<int>(); mainContext.lastbosslist = new List<int>();
mainContext.lastnoah3hp = -1; mainContext.lastnoah3hp = -1;
if (musicid == 37)
{
mainContext.Noah1Reload = true;
DebugLog("noah1 music start, ignore MR forever");
}
if (mainContext.MusicStart) if (mainContext.MusicStart)
{ {
sendsplit(); sendsplit();
DebugLog("music start, split"); DebugLog("music start, split");
} }
} }
} }
@ -192,6 +211,7 @@ namespace rabi_splitter_WPF
{ {
sendsplit(); sendsplit();
DebugLog("music end, split"); DebugLog("music end, split");
} }
} }
} }
@ -236,7 +256,7 @@ namespace rabi_splitter_WPF
} }
} }
if (mainContext.MiruDe) if (mainContext.MiruDe && mapid==8)
{ {
foreach (var boss in mainContext.lastbosslist) foreach (var boss in mainContext.lastbosslist)
{ {
@ -319,32 +339,22 @@ namespace rabi_splitter_WPF
if (mainContext.DebugArea) if (mainContext.DebugArea)
{ {
int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[mainContext.veridx]); int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[mainContext.veridx]);
// List<int> bosses = new List<int>(); // List<int> bosses = new List<int>();
// List<int> HPS = new List<int>(); // List<int> HPS = new List<int>();
debugContext.BossList.Clear(); // this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => debugContext.BossList.Clear()));
// ptr += StaticData.EnenyEntitySize[mainContext.veridx] * 3; // ptr += StaticData.EnenyEntitySize[mainContext.veridx] * 3;
for (var i = 0; i < 50; i++) for (var i = 0; i < 50; i++)
{ {
ptr += StaticData.EnenyEntitySize[mainContext.veridx]; ptr += StaticData.EnenyEntitySize[mainContext.veridx];
debugContext.BossList[i].BossID = MemoryHelper.GetMemoryValue<int>(process,
debugContext.BossList.Add(new BossData() ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false);
{ debugContext.BossList[i].BossHP = MemoryHelper.GetMemoryValue<int>(process,
BossIdx = i, ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false);
BossID = MemoryHelper.GetMemoryValue<int>(process,
ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false),
BossHP = MemoryHelper.GetMemoryValue<int>(process,
ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false)
});
// this.Invoke(new Action(() =>
// {
// t1.Text = string.Join("\n", bosses);
// t2.Text = string.Join("\n", HPS);
// }));
} }
} }
debugContext.BossEvent = mainContext.bossbattle; debugContext.BossEvent = mainContext.bossbattle;
} }
@ -415,11 +425,21 @@ namespace rabi_splitter_WPF
debugContext=new DebugContext(); debugContext=new DebugContext();
this.DataContext = mainContext; this.DataContext = mainContext;
DebugPanel.DataContext = debugContext; DebugPanel.DataContext = debugContext;
this.Grid.ItemsSource = debugContext.BossList;
BossEventDebug.DataContext = debugContext;
memoryThread = new Thread(() => memoryThread = new Thread(() =>
{ {
while (true) while (true)
{
try
{ {
ReadMemory(); ReadMemory();
}
catch (Exception e)
{
DebugLog(e.ToString());
}
Thread.Sleep(1000 / 60); Thread.Sleep(1000 / 60);
} }
@ -453,5 +473,19 @@ namespace rabi_splitter_WPF
{ {
Process.Start("https://github.com/copyliu/rabiribi_splitter"); Process.Start("https://github.com/copyliu/rabiribi_splitter");
} }
private void CheckBox_Click(object sender, RoutedEventArgs e)
{
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
var s = sender as TextBox;
if (s != null)
{
s.ScrollToEnd();
}
}
} }
} }

Loading…
Cancel
Save