From 3b2c207627d49170df0d80a12d754adf86b4e293 Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Fri, 16 Aug 2024 10:58:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- machine/machinedoll/command.go | 91 ++++++++++--------------------- machine/machinedoll/machinemgr.go | 2 + 2 files changed, 31 insertions(+), 62 deletions(-) diff --git a/machine/machinedoll/command.go b/machine/machinedoll/command.go index ad56c9a..745b590 100644 --- a/machine/machinedoll/command.go +++ b/machine/machinedoll/command.go @@ -335,7 +335,7 @@ func queryBaseParam(conn net.Conn) { func SetPower(conn net.Conn) { data[3] = 0x01 fmt.Println("data.len = ", len(data)) - instruction := []byte{0xAA, 0x04, 0x01, 0x06} + instruction := []byte{0xAA, 0x33, 0x01, 0x06} instruction = append(instruction, data...) instruction = CalculateChecksum(instruction) _, err := conn.Write(instruction) @@ -353,10 +353,35 @@ func SetPower(conn net.Conn) { fmt.Println("n", n)*/ } +// 基础设置 +func SetBaseParam(conn net.Conn) { + instruction := []byte{0xAA, 0x33, 0x01, 0x06} + instruction = append(instruction, data...) + instruction = CalculateChecksum(instruction) + _, err := conn.Write(instruction) + if err != nil { + fmt.Println("Failed to send command to server:", err) + return + } + // 读取服务端的响应 + buf := make([]byte, 1024) + n, err := conn.Read(buf) + if err != nil { + fmt.Println("Failed to read response from server:", err) + return + } + fmt.Println("n", n) + if buf[4] == 1 { + fmt.Println("设置成功!") + } else { + fmt.Println("设置失败!") + } +} + var data = []byte{ 0x65, //0 几币几玩 0x00, //1 几币几玩占用位 - 0x1E, //2 游戏时间 + 0x2D, //2 游戏时间 0x00, //3 出奖模式 0x0F, //4 出奖概率 0x00, //5 出奖概率占用位 @@ -380,8 +405,8 @@ var data = []byte{ 0x32, //21 前后速度 0x32, //22 左右速度 0x50, //23 上下速度 - 0x34, //24 放线长度 - 0x08, //25 放线长度占用位 + 0x9A, //24 放线长度 + 0x06, //25 放线长度占用位 0x00, //26 礼品下放高度 0x00, //27 礼品下放高度占用位 0x00, //28 甩抓长度 @@ -407,61 +432,3 @@ var data = []byte{ 0x08, //46 游戏音乐选择 0x00, //47 概率队列自动 } - -/* -var data = []byte{ - 101, //0 几币几玩 - 0, //1 几币几玩占用位 - 30, //2 游戏时间 - 0, //3 出奖模式0无概率 1随机模式 2固定模式 3冠兴模式 - 15, //4 出奖概率 - 0, //5 出奖概率占用位 - 1, //6 空中抓物 0关闭 1开启 - 0, //7 连续投币赠送 范围0~100 - 0, //8 保夹次数 范围0~6, 6为无限次 - 1, //9 保夹赠送模式 0送游戏 1送中奖 2送游戏和中奖 - - 200, //10 强抓力电压 - 0, //11 强抓力电压占用位 - 124, //12 中抓力电压 - 1, //13 中抓力电压占用位 - 90, //14 弱抓力电压 - 0, //15 弱抓力电压占用位 - 224, //16 中奖电压 - 1, //17 中奖电压占用位 - 200, //18 强抓力时间 - 0, //19 强抓力时间占用位 - - 20, //20 放抓时间 - 50, //21 前后速度 - 50, //22 左右速度 - 80, //23 上下速度 - 52, //24 放线长度 - 8, //25 放线长度占用位 - 0, //26 礼品下放高度 - 0, //27 礼品下放高度占用位 - 0, //28 甩抓长度 - 0, //29 甩抓保护 - - 120, //30 甩抓电压 - 0, //31 甩抓电压占用位 - 50, //32 上拉保护 - 2, //33 天车自救时间 - 0, //34 下抓延时 - 0, //35 下抓延时占用位 - 200, //36 抓物延时 - 0, //37 抓物延时占用位 - 150, //38 上停延时 - 0, //39 上停延时占用位 - - 0, //40 摇杆延时 - 0, //41 摇杆延时占用位 - 0, //42 抓物二收 - 1, //43 待机音乐开关 - 15, //44 音量大小调整 - 7, //45 待机音乐选择 - 8, //46 游戏音乐选择 - 0, //47 概率队列自动 -} - -*/ diff --git a/machine/machinedoll/machinemgr.go b/machine/machinedoll/machinemgr.go index efaaf73..57ad3d2 100644 --- a/machine/machinedoll/machinemgr.go +++ b/machine/machinedoll/machinemgr.go @@ -74,6 +74,8 @@ func (this *MachineManager) Init() { Conn: conn, Addr: addr, } + SetBaseParam(conn) + fmt.Println("设置每台娃娃机基础配置!") } /* fmt.Println("Connected to server:\n", this.ConnMap[1].RemoteAddr())