From 2e0bb1c93edd423444fd0e4e56ee300f0caec561 Mon Sep 17 00:00:00 2001 From: Copy Liu Date: Fri, 18 Nov 2016 22:29:01 +0800 Subject: [PATCH] TM check, SUDDEN DEATH check --- rabiribi_splitter/Form1.Designer.cs | 55 +++++++++++++++++----- rabiribi_splitter/Form1.cs | 73 ++++++++++++++++++++++++----- rabiribi_splitter/StaticData.cs | 3 +- 3 files changed, 106 insertions(+), 25 deletions(-) diff --git a/rabiribi_splitter/Form1.Designer.cs b/rabiribi_splitter/Form1.Designer.cs index 608e331..10e8a7d 100644 --- a/rabiribi_splitter/Form1.Designer.cs +++ b/rabiribi_splitter/Form1.Designer.cs @@ -48,6 +48,8 @@ this.cbSideCh = new System.Windows.Forms.CheckBox(); this.debugLog = new System.Windows.Forms.TextBox(); this.debugArea = new System.Windows.Forms.CheckBox(); + this.cbASG = new System.Windows.Forms.CheckBox(); + this.cbTM = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.portNum)).BeginInit(); this.SuspendLayout(); // @@ -131,7 +133,7 @@ // this.musicLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.musicLabel.AutoSize = true; - this.musicLabel.Location = new System.Drawing.Point(13, 195); + this.musicLabel.Location = new System.Drawing.Point(13, 209); this.musicLabel.Name = "musicLabel"; this.musicLabel.Size = new System.Drawing.Size(41, 12); this.musicLabel.TabIndex = 14; @@ -142,7 +144,7 @@ this.cbBoss.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.cbBoss.AutoSize = true; this.cbBoss.Enabled = false; - this.cbBoss.Location = new System.Drawing.Point(15, 210); + this.cbBoss.Location = new System.Drawing.Point(15, 224); this.cbBoss.Name = "cbBoss"; this.cbBoss.Size = new System.Drawing.Size(84, 16); this.cbBoss.TabIndex = 15; @@ -168,15 +170,15 @@ this.cbBoss1.CheckState = System.Windows.Forms.CheckState.Checked; this.cbBoss1.Location = new System.Drawing.Point(15, 119); this.cbBoss1.Name = "cbBoss1"; - this.cbBoss1.Size = new System.Drawing.Size(318, 16); + this.cbBoss1.Size = new System.Drawing.Size(162, 16); this.cbBoss1.TabIndex = 17; - this.cbBoss1.Text = "Split when Miru/Nixie despawn, ignore their music"; + this.cbBoss1.Text = "Split when Miru despawn"; this.cbBoss1.UseVisualStyleBackColor = true; // // cbBoss3 // this.cbBoss3.AutoSize = true; - this.cbBoss3.Location = new System.Drawing.Point(15, 141); + this.cbBoss3.Location = new System.Drawing.Point(402, 141); this.cbBoss3.Name = "cbBoss3"; this.cbBoss3.Size = new System.Drawing.Size(276, 16); this.cbBoss3.TabIndex = 19; @@ -187,7 +189,7 @@ // this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.linkLabel1.AutoSize = true; - this.linkLabel1.Location = new System.Drawing.Point(300, 214); + this.linkLabel1.Location = new System.Drawing.Point(259, 228); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(41, 12); this.linkLabel1.TabIndex = 20; @@ -216,18 +218,18 @@ // this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(252, 214); + this.label4.Location = new System.Drawing.Point(224, 228); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(41, 12); + this.label4.Size = new System.Drawing.Size(29, 12); this.label4.TabIndex = 24; - this.label4.Text = "v0.0.4"; + this.label4.Text = "v0.1"; // // cbSideCh // this.cbSideCh.AutoSize = true; this.cbSideCh.Checked = true; this.cbSideCh.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbSideCh.Location = new System.Drawing.Point(15, 163); + this.cbSideCh.Location = new System.Drawing.Point(15, 141); this.cbSideCh.Name = "cbSideCh"; this.cbSideCh.Size = new System.Drawing.Size(138, 16); this.cbSideCh.TabIndex = 25; @@ -240,9 +242,10 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.debugLog.Location = new System.Drawing.Point(402, 163); + this.debugLog.MinimumSize = new System.Drawing.Size(10, 10); this.debugLog.Multiline = true; this.debugLog.Name = "debugLog"; - this.debugLog.Size = new System.Drawing.Size(0, 43); + this.debugLog.Size = new System.Drawing.Size(10, 58); this.debugLog.TabIndex = 26; // // debugArea @@ -255,11 +258,37 @@ this.debugArea.Text = "debugArea"; this.debugArea.UseVisualStyleBackColor = true; // + // cbASG + // + this.cbASG.AutoSize = true; + this.cbASG.Checked = true; + this.cbASG.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbASG.Location = new System.Drawing.Point(15, 163); + this.cbASG.Name = "cbASG"; + this.cbASG.Size = new System.Drawing.Size(180, 16); + this.cbASG.TabIndex = 28; + this.cbASG.Text = "Ignore next \"SUDDEN DEATH\""; + this.cbASG.UseVisualStyleBackColor = true; + // + // cbTM + // + this.cbTM.AutoSize = true; + this.cbTM.Checked = true; + this.cbTM.CheckState = System.Windows.Forms.CheckState.Checked; + this.cbTM.Location = new System.Drawing.Point(15, 185); + this.cbTM.Name = "cbTM"; + this.cbTM.Size = new System.Drawing.Size(276, 16); + this.cbTM.TabIndex = 29; + this.cbTM.Text = "Split when town member +2 or Nixie despawn"; + this.cbTM.UseVisualStyleBackColor = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(353, 238); + this.ClientSize = new System.Drawing.Size(312, 252); + this.Controls.Add(this.cbTM); + this.Controls.Add(this.cbASG); this.Controls.Add(this.debugArea); this.Controls.Add(this.debugLog); this.Controls.Add(this.cbSideCh); @@ -308,6 +337,8 @@ private System.Windows.Forms.CheckBox cbSideCh; private System.Windows.Forms.TextBox debugLog; private System.Windows.Forms.CheckBox debugArea; + private System.Windows.Forms.CheckBox cbASG; + private System.Windows.Forms.CheckBox cbTM; } } diff --git a/rabiribi_splitter/Form1.cs b/rabiribi_splitter/Form1.cs index 2442a0d..86ab562 100644 --- a/rabiribi_splitter/Form1.cs +++ b/rabiribi_splitter/Form1.cs @@ -31,19 +31,21 @@ namespace rabiribi_splitter private int veridx; private List lastbosslist = new List(); private int lastnoah3hp = -1; - + private int lastmapid; + private int lastTM; + void DebugLog(string log) { if (this.InvokeRequired) { this.Invoke(new Action(() => { - this.debugLog.AppendText(log + "\n"); + this.debugLog.AppendText(log + "\r\n"); })); } else { - this.debugLog.AppendText(log + "\n"); + this.debugLog.AppendText(log + "\r\n"); } } public Form1() @@ -132,7 +134,7 @@ namespace rabiribi_splitter if (newmoney - lastmoney == 17500) { sendsplit(); - + DebugLog("get 17500 en, split"); } lastmoney = newmoney; } @@ -140,8 +142,18 @@ namespace rabiribi_splitter #endregion int mapid = MemoryHelper.GetMemoryValue(process, StaticData.MapAddress[veridx]); + if (lastmapid != mapid) + { + DebugLog("newmap: "+mapid+":"+StaticData.MapNames[mapid]); + lastmapid = mapid; + } - + + #region checkTM + + + + #endregion #region Music @@ -151,7 +163,7 @@ namespace rabiribi_splitter { if (lastmusicid != musicid) { - DebugLog("new music:"+musicid); + DebugLog("new music:"+musicid+":"+StaticData.MusicNames[musicid]); this.Invoke(new Action(() => this.musicLabel.Text = StaticData.MusicNames[musicid])); var bossmusicflag = StaticData.BossMusics.Contains(musicid); @@ -163,7 +175,7 @@ namespace rabiribi_splitter if (cbBossStart.Checked || cbBossEnd.Checked) { sendsplit(); - DebugLog("splilt 1"); + DebugLog("new boss music, split"); } this.Invoke(new Action(() => cbBoss.Checked = bossbattle)); @@ -176,8 +188,15 @@ namespace rabiribi_splitter if (mapid == 5 && cbSideCh.Checked) { bossbattle = false; + DebugLog("boss music in town, ignore"); } + else if (cbASG.Checked && musicid==54) + { + bossbattle = false; + DebugLog("Alius music, ignore once"); + this.Invoke(new Action(() => cbASG.Checked = false)); + } else { if (bossmusicflag) @@ -188,7 +207,7 @@ namespace rabiribi_splitter if (cbBossStart.Checked) { sendsplit(); - DebugLog("splilt 2"); + DebugLog("music start, split"); } } } @@ -201,7 +220,7 @@ namespace rabiribi_splitter if (cbBossEnd.Checked) { sendsplit(); - DebugLog("splilt 3"); + DebugLog("music end, split"); } } } @@ -251,12 +270,12 @@ namespace rabiribi_splitter foreach (var boss in lastbosslist) { - if (boss == 1024 || boss == 1043) + if (boss == 1043) { if (!bosses.Contains(boss)) //despawn { sendsplit(); - DebugLog("split:4"); + DebugLog("miru despawn, split"); bossbattle = false; } @@ -269,10 +288,40 @@ namespace rabiribi_splitter if (bosses.Contains(1053) && Noah3HP < lastnoah3hp && Noah3HP == 1) { sendsplit(); - DebugLog("split:5"); + DebugLog("noah3 hp 1, split"); bossbattle = false; } } + if (cbTM.Checked) + { + bool f = true; + foreach (var boss in lastbosslist) + { + + if (boss == 1024) + { + if (!bosses.Contains(boss)) //despawn + { + sendsplit(); + DebugLog("nixie despawn, split"); + bossbattle = false; + f = false; + break; + } + } + } + + int newTM = MemoryHelper.GetMemoryValue(process, StaticData.TownMemberAddr[veridx]); + if (newTM - lastTM == 2 && f) + { + bossbattle = false; + sendsplit(); + DebugLog("TM+2, split"); + + + } + lastTM = newTM; + } lastbosslist = bosses; lastnoah3hp = Noah3HP; diff --git a/rabiribi_splitter/StaticData.cs b/rabiribi_splitter/StaticData.cs index b58cddc..5689693 100644 --- a/rabiribi_splitter/StaticData.cs +++ b/rabiribi_splitter/StaticData.cs @@ -163,6 +163,7 @@ namespace rabiribi_splitter 0xA69D98 }; - + public static int[] TownMemberAddr = {0xD38934, 0xD5C0F4}; + } }