Browse Source

Merge branch 'master' of https://github.com/SwaggyMacro/YangLeGeYang

liuyuqi-dellpc 1 year ago
parent
commit
c153d92a40
2 changed files with 118 additions and 26 deletions
  1. 47 13
      SheepSheep/MainForm.Designer.cs
  2. 71 13
      SheepSheep/MainForm.cs

+ 47 - 13
SheepSheep/MainForm.Designer.cs

@@ -39,6 +39,9 @@ namespace SheepSheep
             this.statusStrip1 = new System.Windows.Forms.StatusStrip();
             this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
             this.label4 = new System.Windows.Forms.Label();
+            this.textBox3 = new System.Windows.Forms.TextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
             this.statusStrip1.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -46,7 +49,7 @@ namespace SheepSheep
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(24, 90);
+            this.label1.Location = new System.Drawing.Point(25, 117);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(51, 17);
             this.label1.TabIndex = 0;
@@ -58,15 +61,15 @@ namespace SheepSheep
             this.label2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label2.Location = new System.Drawing.Point(24, 27);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(63, 17);
+            this.label2.Size = new System.Drawing.Size(87, 17);
             this.label2.TabIndex = 1;
-            this.label2.Text = "通关次数: ";
+            this.label2.Text = "加入羊群次数: ";
             // 
             // label3
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(24, 61);
+            this.label3.Location = new System.Drawing.Point(25, 88);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(59, 17);
             this.label3.TabIndex = 2;
@@ -75,7 +78,7 @@ namespace SheepSheep
             // textBox1
             // 
             this.textBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.textBox1.Location = new System.Drawing.Point(26, 109);
+            this.textBox1.Location = new System.Drawing.Point(27, 136);
             this.textBox1.Multiline = true;
             this.textBox1.Name = "textBox1";
             this.textBox1.Size = new System.Drawing.Size(246, 142);
@@ -89,7 +92,7 @@ namespace SheepSheep
             this.comboBox1.Items.AddRange(new object[] {
             "随机",
             "自定义"});
-            this.comboBox1.Location = new System.Drawing.Point(89, 58);
+            this.comboBox1.Location = new System.Drawing.Point(90, 85);
             this.comboBox1.Name = "comboBox1";
             this.comboBox1.Size = new System.Drawing.Size(121, 25);
             this.comboBox1.TabIndex = 4;
@@ -98,7 +101,7 @@ namespace SheepSheep
             // button1
             // 
             this.button1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.button1.Location = new System.Drawing.Point(108, 270);
+            this.button1.Location = new System.Drawing.Point(109, 297);
             this.button1.Name = "button1";
             this.button1.Size = new System.Drawing.Size(75, 23);
             this.button1.TabIndex = 5;
@@ -109,7 +112,7 @@ namespace SheepSheep
             // textBox2
             // 
             this.textBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.textBox2.Location = new System.Drawing.Point(89, 24);
+            this.textBox2.Location = new System.Drawing.Point(110, 24);
             this.textBox2.Name = "textBox2";
             this.textBox2.Size = new System.Drawing.Size(100, 23);
             this.textBox2.TabIndex = 6;
@@ -119,8 +122,9 @@ namespace SheepSheep
             // statusStrip1
             // 
             this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.toolStripStatusLabel1});
-            this.statusStrip1.Location = new System.Drawing.Point(0, 308);
+            this.toolStripStatusLabel1,
+            this.toolStripStatusLabel2});
+            this.statusStrip1.Location = new System.Drawing.Point(0, 333);
             this.statusStrip1.Name = "statusStrip1";
             this.statusStrip1.Size = new System.Drawing.Size(295, 22);
             this.statusStrip1.TabIndex = 7;
@@ -130,25 +134,52 @@ namespace SheepSheep
             // 
             this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
             this.toolStripStatusLabel1.Size = new System.Drawing.Size(71, 17);
-            this.toolStripStatusLabel1.Text = "通关次数: 0";
+            this.toolStripStatusLabel1.Text = "加入次数: 0";
             // 
             // label4
             // 
             this.label4.AutoSize = true;
             this.label4.Cursor = System.Windows.Forms.Cursors.Hand;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(206, 274);
+            this.label4.Location = new System.Drawing.Point(207, 301);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(68, 17);
             this.label4.TabIndex = 8;
             this.label4.Text = "获取Token";
             this.label4.Click += new System.EventHandler(this.label4_Click);
             // 
+            // textBox3
+            // 
+            this.textBox3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.textBox3.Location = new System.Drawing.Point(110, 54);
+            this.textBox3.Name = "textBox3";
+            this.textBox3.Size = new System.Drawing.Size(100, 23);
+            this.textBox3.TabIndex = 10;
+            this.textBox3.Text = "100";
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(25, 57);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(87, 17);
+            this.label5.TabIndex = 9;
+            this.label5.Text = "话题通关次数: ";
+            // 
+            // toolStripStatusLabel2
+            // 
+            this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
+            this.toolStripStatusLabel2.Size = new System.Drawing.Size(68, 17);
+            this.toolStripStatusLabel2.Text = "通关次数:0";
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(295, 330);
+            this.ClientSize = new System.Drawing.Size(295, 355);
+            this.Controls.Add(this.textBox3);
+            this.Controls.Add(this.label5);
             this.Controls.Add(this.label4);
             this.Controls.Add(this.statusStrip1);
             this.Controls.Add(this.textBox2);
@@ -180,6 +211,9 @@ namespace SheepSheep
         private System.Windows.Forms.StatusStrip statusStrip1;
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
         private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.TextBox textBox3;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
     }
 }
 

+ 71 - 13
SheepSheep/MainForm.cs

@@ -17,7 +17,8 @@ namespace SheepSheep
     public partial class MainForm : Form
     {
         private int passWay = 0;
-        private int state = 0;
+        private int stateGame = 0;
+        private int stateTopic = 0;
         private string costTime = "10";
         public MainForm()
         {
@@ -55,16 +56,68 @@ namespace SheepSheep
             }
         }
 
-        private void passTheGame(int passTimes) {
-            string apiUrl = string.Format("https://cat-match.easygame2021.com/sheep/v1/game/game_over?rank_score=1&rank_state=1&rank_time={0}&rank_role=1&skin=1", costTime);
+        private void passTopicGame(int passTimes)
+        {
+            string apiUrl = string.Format("https://cat-match.easygame2021.com/sheep/v1/game/topic_game_over?rank_score=1&rank_state=1&rank_time={0}&rank_role=1&skin=1", costTime);
             string json = "";
             for (int i = 0; i < passTimes; i++)
             {
-                if (state == 0) {
+                if (stateTopic == 0)
+                {
+                    return;
+                }
+                if (passWay == 0)
+                {
+                    try
+                    {
+                        Random r = new Random();
+                        costTime = r.Next(0, 3000).ToString();
+                        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);
+                        request.Method = "GET";
+                        request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.33";
+                        request.Host = "cat-match.easygame2021.com";
+                        request.Headers.Add("t", this.textBox1.Text);
+                        request.Timeout = 5000;
+                        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+                        Stream myResponseStream = response.GetResponseStream();
+                        StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
+                        string retString = myStreamReader.ReadToEnd();
+                        myStreamReader.Close();
+                        myResponseStream.Close();
+                        if (retString.Contains("\"err_code\":0"))
+                        {
+                            this.Invoke(new Action(() =>
+                            {
+                                toolStripStatusLabel2.Text = "通关次数: " + (i + 1).ToString();
+                            }));
+                            Console.WriteLine(retString);
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        //throw ex;
+                    }
+
+                }
+                if (i == passTimes - 1)
+                {
                     this.Invoke(new Action(() =>
                     {
-                        MessageBox.Show(this, "已停止羊!", "Tips:", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                        if (stateGame == 0) {
+                            stateTopic = 0;
+                            this.button1.Text = "羊它!";
+                        }
                     }));
+                }
+            }
+        }
+
+        private void passTheGame(int passTimes) {
+            string apiUrl = string.Format("https://cat-match.easygame2021.com/sheep/v1/game/game_over?rank_score=1&rank_state=1&rank_time={0}&rank_role=1&skin=1", costTime);
+            string json = "";
+            for (int i = 0; i < passTimes; i++)
+            {
+                if (stateGame == 0) {
                     return;
                 }
                 if (passWay == 0)
@@ -89,7 +142,7 @@ namespace SheepSheep
                         {
                             this.Invoke(new Action(() =>
                             {
-                                toolStripStatusLabel1.Text = "通关次数: " + i.ToString();
+                                toolStripStatusLabel1.Text = "加入次数: " + (i+1).ToString();
                             }));
                             Console.WriteLine(retString);
                         }
@@ -102,30 +155,35 @@ namespace SheepSheep
                 if (i == passTimes - 1) {
                     this.Invoke(new Action(() =>
                     {
-                        state = 0;
-                        this.button1.Text = "羊它!";
+                        if (stateTopic == 0)
+                        {
+                            stateGame = 0;
+                            this.button1.Text = "羊它!";
+                        }
                     }));
                 }
             }
-            
-
         }
 
         private void button1_Click(object sender, EventArgs e)
         {
             if (!this.textBox1.Text.Equals(""))
             {
-                if (state == 0)
+                if (stateGame == 0)
                 {
-                    state = 1;
+                    stateGame = 1;
+                    stateTopic = 1;
                     Thread t = new Thread(() => passTheGame(int.Parse(this.textBox2.Text)));
                     t.Start();
+                    Thread tt = new Thread(() => passTopicGame(int.Parse(this.textBox3.Text)));
+                    tt.Start();
                     this.button1.Text = "停止羊!";
                     MessageBox.Show(this, "开始羊咯!", "Tips:", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
-                    state = 0;
+                    stateGame = 0;
+                    stateTopic = 0;
                     this.button1.Text = "羊它!";
                 }
             }