From 9f9df14f55832c2ab01859b049060ec1c170e113 Mon Sep 17 00:00:00 2001 From: Copy Liu Date: Tue, 7 Feb 2017 21:22:49 +0800 Subject: [PATCH] v0.2! now can track IGT --- rabiribi_splitter/Form1.Designer.cs | 27 ++++++++++++++++++++------- rabiribi_splitter/Form1.cs | 27 +++++++++++++++++++++++++-- rabiribi_splitter/StaticData.cs | 2 +- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/rabiribi_splitter/Form1.Designer.cs b/rabiribi_splitter/Form1.Designer.cs index bc60c05..741322c 100644 --- a/rabiribi_splitter/Form1.Designer.cs +++ b/rabiribi_splitter/Form1.Designer.cs @@ -50,6 +50,7 @@ this.debugArea = new System.Windows.Forms.CheckBox(); this.cbASG = new System.Windows.Forms.CheckBox(); this.cbTM = new System.Windows.Forms.CheckBox(); + this.cbIGT = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.portNum)).BeginInit(); this.SuspendLayout(); // @@ -133,7 +134,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, 211); + this.musicLabel.Location = new System.Drawing.Point(13, 237); this.musicLabel.Name = "musicLabel"; this.musicLabel.Size = new System.Drawing.Size(41, 12); this.musicLabel.TabIndex = 14; @@ -144,7 +145,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, 226); + this.cbBoss.Location = new System.Drawing.Point(15, 252); this.cbBoss.Name = "cbBoss"; this.cbBoss.Size = new System.Drawing.Size(84, 16); this.cbBoss.TabIndex = 15; @@ -189,7 +190,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(279, 230); + this.linkLabel1.Location = new System.Drawing.Point(279, 256); this.linkLabel1.Name = "linkLabel1"; this.linkLabel1.Size = new System.Drawing.Size(41, 12); this.linkLabel1.TabIndex = 20; @@ -218,11 +219,11 @@ // 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(232, 230); + this.label4.Location = new System.Drawing.Point(232, 256); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(41, 12); this.label4.TabIndex = 24; - this.label4.Text = "v0.1.5"; + this.label4.Text = "v0.2.0"; // // cbSideCh // @@ -245,7 +246,7 @@ this.debugLog.MinimumSize = new System.Drawing.Size(10, 10); this.debugLog.Multiline = true; this.debugLog.Name = "debugLog"; - this.debugLog.Size = new System.Drawing.Size(10, 60); + this.debugLog.Size = new System.Drawing.Size(10, 86); this.debugLog.TabIndex = 26; // // debugArea @@ -282,11 +283,22 @@ this.cbTM.Text = "Split when Town Member +2 or Nixie despawns"; this.cbTM.UseVisualStyleBackColor = true; // + // cbIGT + // + this.cbIGT.AutoSize = true; + this.cbIGT.Location = new System.Drawing.Point(15, 207); + this.cbIGT.Name = "cbIGT"; + this.cbIGT.Size = new System.Drawing.Size(132, 16); + this.cbIGT.TabIndex = 30; + this.cbIGT.Text = "Track In-Game Time"; + this.cbIGT.UseVisualStyleBackColor = true; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(332, 254); + this.ClientSize = new System.Drawing.Size(332, 280); + this.Controls.Add(this.cbIGT); this.Controls.Add(this.cbTM); this.Controls.Add(this.cbASG); this.Controls.Add(this.debugArea); @@ -339,6 +351,7 @@ private System.Windows.Forms.CheckBox debugArea; private System.Windows.Forms.CheckBox cbASG; private System.Windows.Forms.CheckBox cbTM; + private System.Windows.Forms.CheckBox cbIGT; } } diff --git a/rabiribi_splitter/Form1.cs b/rabiribi_splitter/Form1.cs index c528950..33be767 100644 --- a/rabiribi_splitter/Form1.cs +++ b/rabiribi_splitter/Form1.cs @@ -60,7 +60,7 @@ namespace rabiribi_splitter while (true) { readmemory(); - Thread.Sleep(10); + Thread.Sleep(1000/60); } }); @@ -124,7 +124,14 @@ namespace rabiribi_splitter if (veridx < 0) return; - + #region read igt + + int igt = MemoryHelper.GetMemoryValue(process, StaticData.IGTAddr[veridx]); + if (igt>0 && cbIGT.Checked ) + { + sendigt((float)igt/60); + } + #endregion #region CheckMoney @@ -408,6 +415,22 @@ namespace rabiribi_splitter } } + void sendigt(float time) + { + if (tcpclient != null && tcpclient.Connected) + { + try + { + var b = Encoding.UTF8.GetBytes($"setgametime {time}\r\n"); + networkStream.Write(b, 0, b.Length); + } + catch (Exception) + { + + disconnect(); + } + } + } void disconnect() { tcpclient = null; diff --git a/rabiribi_splitter/StaticData.cs b/rabiribi_splitter/StaticData.cs index 7e935bb..5149942 100644 --- a/rabiribi_splitter/StaticData.cs +++ b/rabiribi_splitter/StaticData.cs @@ -166,6 +166,6 @@ namespace rabiribi_splitter }; public static int[] TownMemberAddr = {0xD38934, 0xD5C0F4, 0xD63BC4, 0xD65BC4 }; - + public static int[] IGTAddr = { 0xD388E0, 0xD5C0A0, 0xD63B70, 0xD65B70 }; } }