娃娃机基础配置

This commit is contained in:
by 2024-08-16 10:58:45 +08:00
parent 7a2c11d92e
commit 3b2c207627
2 changed files with 31 additions and 62 deletions

View File

@ -335,7 +335,7 @@ func queryBaseParam(conn net.Conn) {
func SetPower(conn net.Conn) { func SetPower(conn net.Conn) {
data[3] = 0x01 data[3] = 0x01
fmt.Println("data.len = ", len(data)) fmt.Println("data.len = ", len(data))
instruction := []byte{0xAA, 0x04, 0x01, 0x06} instruction := []byte{0xAA, 0x33, 0x01, 0x06}
instruction = append(instruction, data...) instruction = append(instruction, data...)
instruction = CalculateChecksum(instruction) instruction = CalculateChecksum(instruction)
_, err := conn.Write(instruction) _, err := conn.Write(instruction)
@ -353,10 +353,35 @@ func SetPower(conn net.Conn) {
fmt.Println("n", n)*/ 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{ var data = []byte{
0x65, //0 几币几玩 0x65, //0 几币几玩
0x00, //1 几币几玩占用位 0x00, //1 几币几玩占用位
0x1E, //2 游戏时间 0x2D, //2 游戏时间
0x00, //3 出奖模式 0x00, //3 出奖模式
0x0F, //4 出奖概率 0x0F, //4 出奖概率
0x00, //5 出奖概率占用位 0x00, //5 出奖概率占用位
@ -380,8 +405,8 @@ var data = []byte{
0x32, //21 前后速度 0x32, //21 前后速度
0x32, //22 左右速度 0x32, //22 左右速度
0x50, //23 上下速度 0x50, //23 上下速度
0x34, //24 放线长度 0x9A, //24 放线长度
0x08, //25 放线长度占用位 0x06, //25 放线长度占用位
0x00, //26 礼品下放高度 0x00, //26 礼品下放高度
0x00, //27 礼品下放高度占用位 0x00, //27 礼品下放高度占用位
0x00, //28 甩抓长度 0x00, //28 甩抓长度
@ -407,61 +432,3 @@ var data = []byte{
0x08, //46 游戏音乐选择 0x08, //46 游戏音乐选择
0x00, //47 概率队列自动 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 保夹次数 范围06 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 概率队列自动
}
*/

View File

@ -74,6 +74,8 @@ func (this *MachineManager) Init() {
Conn: conn, Conn: conn,
Addr: addr, Addr: addr,
} }
SetBaseParam(conn)
fmt.Println("设置每台娃娃机基础配置!")
} }
/* fmt.Println("Connected to server:\n", this.ConnMap[1].RemoteAddr()) /* fmt.Println("Connected to server:\n", this.ConnMap[1].RemoteAddr())