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. 55
      rabi_splitter_WPF/MainWindow.xaml
  3. 94
      rabi_splitter_WPF/MainWindow.xaml.cs

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

@ -4,13 +4,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:rabi_splitter_WPF"
mc:Ignorable="d"
Title="Irisu is watching you" d:DataContext="{d:DesignData local:MainContext}" SizeToContent="WidthAndHeight">
mc:Ignorable="d" SizeToContent="Width"
Title="Irisu is watching you" d:DataContext="{d:DesignData local:MainContext}" d:DesignWidth="835.476" Height="391.628">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</Window.Resources>
<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 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"/>
@ -24,36 +28,37 @@
<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 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 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 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 Irisu Phase 1" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Irisu1,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}"/>
<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="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 &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="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 Irisu Phase 1" HorizontalAlignment="Left" FontSize="15" Margin="0,0,0,4" IsChecked="{Binding Irisu1, 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 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" 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}"/>
<DataGrid ItemsSource="{Binding BossList}" CanUserAddRows="False" IsReadOnly="True" AutoGenerateColumns="False" SelectionUnit="FullRow" DockPanel.Dock="Top"
d:DataContext="{d:DesignData local:BossData}">
<DockPanel Visibility="{Binding DebugArea, Converter={StaticResource BooleanToVisibilityConverter}, Mode=TwoWay}" >
<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"/>
<Grid x:Name="DebugPanel" d:DataContext="{d:DesignData local:DebugContext}" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<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>
<DataGridTextColumn Binding="{Binding BossIdx}" ClipboardContentBinding="{Binding BossIdx}" Header="Index"/>
<DataGridTextColumn Binding="{Binding BossID}" ClipboardContentBinding="{Binding BossID}" Header="Entity ID"/>
<DataGridTextColumn Binding="{Binding BossHP}" ClipboardContentBinding="{Binding BossHP}" Header="HP"/>
</DataGrid.Columns>
</DataGrid>
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog,Mode=TwoWay}" DockPanel.Dock="Bottom" MinHeight="203"/>
</DockPanel>
</StackPanel>
<TextBox TextWrapping="Wrap" Text="{Binding DebugLog, Mode=TwoWay}" Grid.Row="1" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" TextChanged="TextBox_TextChanged" VerticalScrollBarVisibility="Visible"/>
</Grid>
</DockPanel>
</StackPanel>
<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>

@ -80,6 +80,11 @@ namespace rabi_splitter_WPF
{
sendigt((float)igt / 60);
}
if (igt > 0 && igt < 3600)
{
mainContext.AliusI = true;
mainContext.Noah1Reload = false;
}
#endregion
@ -128,13 +133,25 @@ namespace rabi_splitter_WPF
{
if (mainContext.bossbattle)
{
//直接换boss曲
if (mainContext.MusicStart || mainContext.MusicEnd)
if (mainContext.Noah1Reload && (mainContext.lastmusicid == 52 || musicid == 52))
{
sendsplit();
DebugLog("new boss music, split");
DebugLog("noah 1 reload? ignore");
}
debugContext.BossEvent = true;
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;
}
@ -145,15 +162,13 @@ namespace rabi_splitter_WPF
if (musicid == 54 && mainContext.AliusI)
{
mainContext.bossbattle = false;
debugContext.BossEvent = false;
mainContext.AliusI = false;
DebugLog("Alius music, ignore once");
}
if (musicid == 42 && mapid == 1 && mainContext.Irisu1)
else if (musicid == 42 && mapid == 1 && mainContext.Irisu1)
{
mainContext.bossbattle = false;
debugContext.BossEvent = false;
DebugLog("Irisu P1, ignore");
}
@ -164,20 +179,24 @@ namespace rabi_splitter_WPF
if (mapid == 5 && musicid == 44 && mainContext.SideCh)
{
mainContext.bossbattle = false;
debugContext.BossEvent = false;
DebugLog("sidechapter, ignore");
}
else
{
mainContext.bossbattle = true;
debugContext.BossEvent = 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");
}
}
}
@ -192,6 +211,7 @@ namespace rabi_splitter_WPF
{
sendsplit();
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)
{
@ -319,32 +339,22 @@ namespace rabi_splitter_WPF
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>();
debugContext.BossList.Clear();
// 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.Add(new BossData()
{
BossIdx = i,
BossID = MemoryHelper.GetMemoryValue<int>(process,
ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false),
BossHP = MemoryHelper.GetMemoryValue<int>(process,
ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false)
});
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);
// this.Invoke(new Action(() =>
// {
// t1.Text = string.Join("\n", bosses);
// t2.Text = string.Join("\n", HPS);
// }));
}
}
debugContext.BossEvent = mainContext.bossbattle;
}
@ -415,11 +425,21 @@ namespace rabi_splitter_WPF
debugContext=new DebugContext();
this.DataContext = mainContext;
DebugPanel.DataContext = debugContext;
this.Grid.ItemsSource = debugContext.BossList;
BossEventDebug.DataContext = debugContext;
memoryThread = new Thread(() =>
{
while (true)
{
ReadMemory();
try
{
ReadMemory();
}
catch (Exception e)
{
DebugLog(e.ToString());
}
Thread.Sleep(1000 / 60);
}
@ -453,5 +473,19 @@ namespace rabi_splitter_WPF
{
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