This commit is contained in:
liwei1dao 2023-11-06 10:03:25 +08:00
commit 5711a882c4
8 changed files with 405 additions and 108 deletions

View File

@ -501,6 +501,8 @@ const ( //Rpc
Rpc_ActivityOver core.Rpc_Key = "Rpc_ActivityOver" //活动结束 Rpc_ActivityOver core.Rpc_Key = "Rpc_ActivityOver" //活动结束
Rpc_ActivityStar core.Rpc_Key = "Rpc_ActivityStar" //活动开启 Rpc_ActivityStar core.Rpc_Key = "Rpc_ActivityStar" //活动开启
RPC_XXLOffLine core.Rpc_Key = "RPC_XXLOffLine" //三消离线
) )
// 事件类型定义处 // 事件类型定义处

View File

@ -233,3 +233,18 @@ func (this *configureComp) GetGameRandomConsumeBoxConf() (conf *cfg.GameConsumeB
conf, err = this.GetGameConsumeBoxConf(boxid[comm.GetRandW(szWeight)]) conf, err = this.GetGameConsumeBoxConf(boxid[comm.GetRandW(szWeight)])
return return
} }
func (this *configureComp) GetGameBlockByKey(key int32) (conf *cfg.GameBlockData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_block); err == nil {
if configure, ok := v.(*cfg.GameBlock); ok {
if conf = configure.Get(key); conf != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(moduleName, game_block, key)
return
}

View File

@ -1,8 +1,10 @@
package entertainment package entertainment
import ( import (
"context"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
@ -52,7 +54,8 @@ func (this *Entertainment) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil { if err = this.ModuleBase.Start(); err != nil {
return return
} }
event.RegisterGO(comm.EventUserOffline, this.EventUserOffline)
this.service.RegisterFunctionName(string(comm.RPC_XXLOffLine), this.useroffline)
return return
} }
@ -117,3 +120,36 @@ func (this *Entertainment) ConsumXxlCard(session comm.IUserSession, card string)
}) })
return return
} }
// 用户离线处理
func (this *Entertainment) EventUserOffline(uid, sessionid string) {
this.Debugf("user offline: %s", uid)
// if list, err := this.model.getEntertainmList(uid); err == nil {
// var (
// serverPath string = fmt.Sprintf("%s/%s", this.service.GetType(), this.service.GetId())
// )
// if serverPath != list.ServicePath { // RPC 通知房间所在的服务器
// _, err = this.service.RpcGo(
// context.Background(),
// list.ServicePath,
// string(comm.RPC_XXLOffLine),
// &pb.RPCGeneralReqA2{
// Param1: list.Roomid,
// Param2: list.Uid,
// },
// nil)
// if err != nil {
// this.Errorln(err)
// return
// }
// } else {
// this.useroffline(context.Background(), &pb.RPCGeneralReqA2{Param1: list.Roomid, Param2: list.Uid}, nil)
// }
// return
// }
}
func (this *Entertainment) useroffline(ctx context.Context, req *pb.RPCGeneralReqA2, resp *pb.RPCGeneralReqA2) (err error) {
return
}

View File

@ -61,7 +61,7 @@ func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) {
Data: this.chessboard.GetPalatData(), Data: this.chessboard.GetPalatData(),
}) })
fmt.Printf("===超时棋盘=============\n") fmt.Printf("===超时棋盘=============\n")
this.chessboard.Debugf() //this.chessboard.Debugf()
if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{
//Mpadata: szMap, //Mpadata: szMap,
Power: this.NexPower, Power: this.NexPower,
@ -93,7 +93,7 @@ func (this *Room) operateTimeOut(task *timewheel.Task, args ...interface{}) {
} }
// 随机一个玩法 // 随机一个玩法
func (this *Room) RandomPlayType() { func (this *Room) RandomPlayType() (itype int32) {
var weight []int32 // 权重 var weight []int32 // 权重
// 开始随机玩法 // 开始随机玩法
list := this.module.configure.GetGameConsumeIntegral() list := this.module.configure.GetGameConsumeIntegral()
@ -101,15 +101,15 @@ func (this *Room) RandomPlayType() {
weight = append(weight, v.Weight) weight = append(weight, v.Weight)
} }
this.Playtype = list[comm.GetRandW(weight)].Key return list[comm.GetRandW(weight)].Key
} }
func (this *Room) InitRoom(module *Entertainment, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room { func (this *Room) InitRoom(module *Entertainment, p1 *pb.PlayerData, p2 *pb.PlayerData) *Room {
var room *Room var room *Room
this.module = module this.module = module
this.chessboard = new(MapData) this.chessboard = new(MapData)
this.RandomPlayType() this.Playtype = this.RandomPlayType()
this.chessboard.InitMap(module) // 初始化棋盘 this.chessboard.InitMap(module, this.Playtype) // 初始化棋盘
if s1, ok := this.module.GetUserSession(p1.Userinfo.Uid); !ok { if s1, ok := this.module.GetUserSession(p1.Userinfo.Uid); !ok {
this.module.PutUserSession(s1) this.module.PutUserSession(s1)
} else { } else {
@ -222,11 +222,10 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
case "operator": // 操作消息 case "operator": // 操作消息
var ( var (
curScore int32 // 该次操作的得分 curScore int32 // 该次操作的得分
//AIOperator bool oid1 int32 // 唯一id
oid1 int32 // 唯一id oid2 int32
oid2 int32 color int32 // 校验消除的颜色
color int32 // 校验消除的颜色 bAddPs bool
bAddPs bool
) )
var szMap []*pb.MapData var szMap []*pb.MapData
req := msg.(*pb.EntertainOperatorReq) req := msg.(*pb.EntertainOperatorReq)
@ -381,9 +380,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
if this.player1.Ps <= 0 { if this.player1.Ps <= 0 {
this.NexPower = this.player2.Userinfo.Uid this.NexPower = this.player2.Userinfo.Uid
// if len(this.szSession) == 1 { // 校验2号玩家是不是AI
// AIOperator = true
// }
this.player2.Ps = MaxPs this.player2.Ps = MaxPs
} }
} else { // this.curPower == this.player2.Uid } else { // this.curPower == this.player2.Uid
@ -398,8 +394,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
if this.player2.Ps <= 0 { if this.player2.Ps <= 0 {
this.NexPower = this.player1.Userinfo.Uid this.NexPower = this.player1.Userinfo.Uid
this.player1.Ps = MaxPs this.player1.Ps = MaxPs
// this.round++
} }
} }
for _, v := range szMap { // for _, v := range szMap { //
@ -454,9 +448,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
} }
// 变更权限 // 变更权限
this.curPower = this.NexPower this.curPower = this.NexPower
// if AIOperator { // AI操作
// this.AiOperator()
// }
case "ready": case "ready":
var bStartGame bool // 可以开始游戏 var bStartGame bool // 可以开始游戏
this.NexPower = this.player1.Userinfo.Uid this.NexPower = this.player1.Userinfo.Uid
@ -582,7 +574,6 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
} }
} }
//this.operatetimer = timewheel.Add(time.Second*time.Duration(this.MaxTime), this.operateTimeOut) //this.operatetimer = timewheel.Add(time.Second*time.Duration(this.MaxTime), this.operateTimeOut)
} }
return return
@ -691,8 +682,8 @@ func (this *Room) JoinRoom(module *Entertainment, p *pb.PlayerData) (room *Room,
this.player1 = p this.player1 = p
this.module = module this.module = module
this.chessboard = new(MapData) this.chessboard = new(MapData)
this.RandomPlayType() this.Playtype = this.RandomPlayType()
this.chessboard.InitMap(module) // 初始化棋盘 this.chessboard.InitMap(module, this.Playtype) // 初始化棋盘
if s1, ok := this.module.GetUserSession(p.Userinfo.Uid); !ok { if s1, ok := this.module.GetUserSession(p.Userinfo.Uid); !ok {
this.module.PutUserSession(s1) this.module.PutUserSession(s1)
} else { } else {

View File

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils" "go_dreamfactory/utils"
"math/big" "math/big"
) )
@ -18,6 +19,11 @@ const (
FourUType = 1 // 4消上下类型 FourUType = 1 // 4消上下类型
FourLType = 2 // 4消左右类型 FourLType = 2 // 4消左右类型
BoomType = 4 // 炸弹类型 BoomType = 4 // 炸弹类型
FireUp = 5 //上烟火
FireDown = 6 //下烟火
FireLeft = 7 //左烟火
FireRight = 8 //右烟火
) )
type Girde struct { type Girde struct {
@ -34,30 +40,83 @@ type MapData struct {
oid int32 // 唯一id oid int32 // 唯一id
module *Entertainment module *Entertainment
operElem []int32 // 当前移动的元素 operElem []int32 // 当前移动的元素
iType int32 // 玩法类型
} }
// 1~6随机一个数 // 1~6随机一个数
func GetRandType() int32 { func (this *MapData) GetRandType() int32 {
n, _ := rand.Int(rand.Reader, big.NewInt(6)) n, _ := rand.Int(rand.Reader, big.NewInt(6))
return int32(n.Int64() + 1) return int32(n.Int64() + 1)
} }
func (this *MapData) CreateGride(index int32) *pb.GirdeData { // 玩法带入
t := GetRandType() func (this *MapData) CreateGride(index int32) (girde *pb.GirdeData) {
var (
szWeight []int32
szId []int32
id int32
conf *cfg.GameBlockData
err error
) // 权重带入
this.oid++ this.oid++
return &pb.GirdeData{ girde = &pb.GirdeData{ // 默认值
Oid: this.oid, Oid: this.oid,
Color: t, Color: 1,
Cid: t, Cid: 1,
Score: 1, Score: 1,
Special: 0, Special: 0,
} }
if this.iType == 4 {
for i := 1; i <= 6; i++ { // 6种颜色
if conf, err := this.module.configure.GetGameBlock(int32(i), 4); err == nil {
szWeight = append(szWeight, conf.Weight)
szId = append(szId, conf.Key)
}
if conf, err := this.module.configure.GetGameBlock(int32(i), 0); err == nil {
szWeight = append(szWeight, conf.Weight)
szId = append(szId, conf.Key)
}
}
id = szId[comm.GetRandW(szWeight)]
} else if this.iType == 3 { // 创建棋盘的时候此玩法类型执行效率低下 稍后采用同颜色替换模式处理
// 最多2个
var count int32
for _, v := range this.Plat {
if v.Special == 4 {
count++
if count >= 2 {
break
}
}
}
if count <= 2 {
n, _ := rand.Int(rand.Reader, big.NewInt(6)) // 随机一个颜色
if conf, err := this.module.configure.GetGameBlock(int32(n.Int64()+1), 4); err == nil {
id = conf.Key
}
}
} else {
id = this.GetRandType()
}
conf, err = this.module.configure.GetGameBlockByKey(id)
if err != nil {
return
}
girde.Color = conf.Color
girde.Cid = conf.Key
girde.Special = conf.Type
girde.Score = conf.Score
return
} }
// 初始化地图数据 // 初始化地图数据
func (this *MapData) InitMap(module *Entertainment) { func (this *MapData) InitMap(module *Entertainment, iType int32) {
this.module = module this.module = module
this.iType = 1 //iType
this.oid = 1000 // 方便观察 从1000开始 this.oid = 1000 // 方便观察 从1000开始
this.Plat = make([]*pb.GirdeData, Width*Height) this.Plat = make([]*pb.GirdeData, Width*Height)
for i := 0; i < Width*Height; i++ { for i := 0; i < Width*Height; i++ {
@ -88,11 +147,11 @@ func (this *MapData) SwapGirde(oldId, newId int32) (bSwap bool) {
func (this *MapData) Debugf() { func (this *MapData) Debugf() {
fmt.Printf("================\n") fmt.Printf("================\n")
var v int //var v int
for index := Width - 1; index >= 0; index-- { for index := Width - 1; index >= 0; index-- {
for j := 0; j < Height; j++ { for j := 0; j < Height; j++ {
v = index + j*7 // v = index + j*7
fmt.Printf("%d:%d ", v, this.Plat[index+j*Height].Cid) fmt.Printf("%d:%d ", this.Plat[index+j*Height].Oid, this.Plat[index+j*Height].Cid)
} }
fmt.Printf("\n") fmt.Printf("\n")
@ -360,25 +419,10 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
} }
if s := this.Plat[id].Special; s != 0 { if s := this.Plat[id].Special; s != 0 {
if s == FourUType { // 4消上下类型 for k := range this.SpecialElem(id, s) {
for i := 0; i < Height; i++ { // id 的一条线位置 x[k] = struct{}{}
x[(id/Width)*Height+i] = struct{}{}
}
} else if s == FourLType { // 左右类型
for i := 0; i < Width; i++ { // id 的一条线位置
x[id%Height+i*Width] = struct{}{}
}
} else if s == FiveType { // 随机消除
// 获取配置
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
if xc, _ := this.SkillUp(0, color, 1, c.Value, false); len(xc) > 0 {
//szMap = append(szMap, sz...)
for key := range xc {
x[key] = struct{}{}
}
}
}
} }
} }
x[id] = struct{}{} x[id] = struct{}{}
} }
@ -399,6 +443,7 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
CurSocre: curScore, CurSocre: curScore,
CurEnergy: energy, CurEnergy: energy,
}) })
//this.Debugf()
} }
@ -436,7 +481,7 @@ func (this *MapData) DropGirde() bool {
} }
} }
} }
//this.Debugf()
return bDrop return bDrop
} }
@ -507,7 +552,6 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
x = make(map[int]struct{}) x = make(map[int]struct{})
if skillid == 1 { // 随机消除盘面上X个方块 if skillid == 1 { // 随机消除盘面上X个方块
ids = utils.RandomNumbers(0, Total-1, int(value)) ids = utils.RandomNumbers(0, Total-1, int(value))
} else if skillid == 4 { // 找到pos 位置的所有方块 } else if skillid == 4 { // 找到pos 位置的所有方块
x := int(pos / Width) x := int(pos / Width)
y := int(pos % Height) y := int(pos % Height)
@ -527,8 +571,7 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
ids = append(ids, (x+i)*Width+(y-i)) ids = append(ids, (x+i)*Width+(y-i))
} }
} }
} else if skillid == 5 { //选中一个方块,消除周围一圈
} else if skillid == 3 || skillid == 5 { //选中一个方块,消除周围一圈
ids = append(ids, int(pos)) // 包含自己 ids = append(ids, int(pos)) // 包含自己
x := int(pos / Width) x := int(pos / Width)
y := int(pos % Height) y := int(pos % Height)
@ -557,32 +600,29 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
if x+1 < Width && y-1 >= 0 { // 右下 if x+1 < Width && y-1 >= 0 { // 右下
ids = append(ids, (x+1)*Width+(y-1)) ids = append(ids, (x+1)*Width+(y-1))
} }
} else if skillid == 2 { // 消除中间的一列宝石 } else if skillid == 2 { // 消除中间的一列宝石
for i := 0; i < Height; i++ { for i := 0; i < Height; i++ {
ids = append(ids, 3*Width+i) ids = append(ids, 3*Width+i)
} }
} else if skillid == 3 { // 四周蔓延 第一次100% 第二次 60% 第三次 30% 第四次 10% 最多4次
var mids map[int]struct{}
mids = make(map[int]struct{}, 0)
for i := 0; i < 4; i++ {
dd := this.Skill3(pos, int32(i))
for k := range dd {
for s := range this.Skill3(int32(k), int32(i)) {
mids[s] = struct{}{}
}
}
}
for k := range mids {
ids = append(ids, k) // 转换成最终消除的坐标
}
} }
for _, id := range ids { for _, id := range ids {
s := this.Plat[id].Special if s := this.Plat[id].Special; s != 0 {
if s != 0 { for k := range this.SpecialElem(id, s) {
if s == FourUType { // 4消上下类型 x[k] = struct{}{}
for i := 0; i < Height; i++ { // id 的一条线位置
x[(id/Width)*Height+i] = struct{}{}
}
} else if s == FourLType { // 左右类型
for i := 0; i < Width; i++ { // id 的一条线位置
x[id%Height+i*Width] = struct{}{}
}
} else if s == FiveType { // 随机消除
// 获取配置
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
if xc, _ := this.SkillUp(pos, color, 1, c.Value, false); len(xc) > 0 { // 递归调用
for key := range xc {
x[key] = struct{}{}
}
}
}
} }
} }
x[id] = struct{}{} x[id] = struct{}{}
@ -609,24 +649,15 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32,
return return
} }
// 随机生成 不可消除的 地图
func (this *MapData) CheckInitPlat() {
this.Plat = make([]*pb.GirdeData, Width*Height)
for i := 0; i < Width*Height; i++ {
this.Plat[i] = this.CreateGride(int32(i))
}
}
func (this *MapData) SetMap() { func (this *MapData) SetMap() {
sz2 := []int32{ sz2 := []int32{
3, 3, 2, 2, 1, 3, 1, 3, 3, 2, 2, 1, 3, 1,
5, 1, 2, 3, 1, 2, 2, 5, 1, 2, 3, 1, 2, 2,
3, 4, 3, 5, 6, 1, 6, 3, 4, 3, 5, 6, 1, 6,
1, 4, 6, 4, 2, 3, 6, 1, 4, 1, 4, 2, 3, 6,
1, 5, 6, 5, 6, 1, 4, 1, 5, 1, 5, 6, 1, 4,
6, 6, 4, 6, 4, 3, 3, 6, 6, 4, 6, 4, 3, 3,
3, 3, 6, 1, 1, 2, 5, 3, 3, 1, 2, 1, 2, 5,
// 1, 4, 2, 5, 4, 5, 2, // 1, 4, 2, 5, 4, 5, 2,
// 3, 2, 3, 5, 2, 1, 4, // 3, 2, 3, 5, 2, 1, 4,
// 2, 5, 5, 4, 5, 4, 1, // 2, 5, 5, 4, 5, 4, 1,
@ -916,5 +947,170 @@ func (this *MapData) RedsetPlatData() {
} }
this.SetIndelibilityPlat() this.SetIndelibilityPlat()
//this.Debugf() }
//四周蔓延 第一次100% 第二次 60% 第三次 30% 第四次 10% 最多4次
func (this *MapData) Skill3(pos int32, count int32) (m map[int]struct{}) {
m = make(map[int]struct{}, 0)
var sz []int
var percent int32
// 先找出可以蔓延的方向
x := int(pos / Width)
y := int(pos % Height)
if x-1 >= 0 { // 左
sz = append(sz, (x-1)*Width+(y))
}
if y-1 >= 0 { // 下
sz = append(sz, (x)*Width+(y-1))
}
if y+1 < Height { // 上
sz = append(sz, (x)*Width+(y+1))
}
if x+1 < Width { // 右
sz = append(sz, (x+1)*Width+(y))
}
if count == 0 {
percent = 100
} else if count == 1 {
percent = 100
} else if count == 2 || count == 3 {
percent = 100
} else {
return
}
szid := utils.RandomNumbers(0, len(sz), 2)
for _, v := range szid {
if percent >= comm.GetRandNum(0, 100) {
m[sz[v]] = struct{}{}
}
}
return
}
// 获取BoomType 类型周围的所有元素(pos 四周+ 四周的上下左右)
func (this *MapData) GetBoomElem(pos int) (elem []int) {
x := int(pos / Width)
y := int(pos % Height)
if x-1 >= 0 { // 左
elem = append(elem, (x-1)*Width+(y))
}
if y-1 >= 0 { // 下
elem = append(elem, (x)*Width+(y-1))
}
if y+1 < Height { // 上
elem = append(elem, (x)*Width+(y+1))
}
if x+1 < Width { // 右
elem = append(elem, (x+1)*Width+(y))
}
if x-1 >= 0 && y+1 < Height { // 左上
elem = append(elem, (x-1)*Width+(y+1))
}
if x-1 >= 0 && y-1 >= 0 { // 左下
elem = append(elem, (x-1)*Width+(y-1))
}
if x+1 < Width && y+1 < Height { // 右上
elem = append(elem, (x+1)*Width+(y+1))
}
if x+1 < Width && y-1 >= 0 { // 右下
elem = append(elem, (x+1)*Width+(y-1))
}
///
if x-2 >= 0 { // 左左
elem = append(elem, (x-2)*Width+(y))
}
if y-2 >= 0 { // 下下
elem = append(elem, (x)*Width+(y-2))
}
if y+2 < Height { // 上上
elem = append(elem, (x)*Width+(y+2))
}
if x+2 < Width { // 右右
elem = append(elem, (x+2)*Width+(y))
}
return
}
func (this *MapData) GetFireBoom(pos int, itype int32) (elem []int) {
x := int(pos / Width)
y := int(pos % Height)
switch itype {
case FireUp: //上烟火
for i := 0; i < Height; i++ {
if y+1 < Height { // 上上
elem = append(elem, (x)*Width+(y+1))
y += 1
}
}
case FireDown: //下烟火
for i := 0; i < Height; i++ {
if y-1 >= 0 { // 下下
elem = append(elem, (x)*Width+(y-1))
y -= 1
}
}
case FireLeft: //左烟火
for i := 0; i < Height; i++ {
if x-1 >= 0 { // 左左
elem = append(elem, (x-1)*Width+(y))
x -= 1
}
}
case FireRight: //右烟火
for i := 0; i < Height; i++ {
if x+1 < Width { // 右右
elem = append(elem, (x+1)*Width+(y))
x += 1
}
}
}
return
}
// 特殊类型元素 统一处理
func (this *MapData) SpecialElem(id int, s int32) (x map[int]struct{}) {
x = make(map[int]struct{})
if s == FourUType { // 4消上下类型
for i := 0; i < Height; i++ { // id 的一条线位置
x[(id/Width)*Height+i] = struct{}{}
}
} else if s == FourLType { // 左右类型
for i := 0; i < Width; i++ { // id 的一条线位置
x[id%Height+i*Width] = struct{}{}
}
} else if s == FiveType { // 随机消除
// 获取配置
if c, _ := this.module.configure.GetGameBlock(this.Plat[id].Color, FiveType); c != nil {
ids := utils.RandomNumbers(0, Total-1, int(c.Value))
for key := range ids {
x[key] = struct{}{}
}
}
} else if s == BoomType { // 炸弹类型 带走周围一圈+ 上下左右
for key := range this.GetBoomElem(id) {
x[key] = struct{}{}
}
} else if s == FireUp || s == FireDown || s == FireLeft || s == FireRight { // 烟花技能
for key := range this.GetFireBoom(id, s) {
x[key] = struct{}{}
}
}
// for k := range x {
// if this.Plat[k].Special != 0 {
// for key := range this.SpecialElem(k, this.Plat[k].Special) { // 递归调用
// x[key] = struct{}{}
// }
// }
// }
return
} }

View File

@ -82,16 +82,50 @@ func Test_Main(t *testing.T) {
entertainment.NewModule(), entertainment.NewModule(),
) )
}() }()
// sz := utils.RandomNumbers(0, 2, 2)
// fmt.Printf("xxxx%v", sz)
m := new(entertainment.MapData) m := new(entertainment.MapData)
m.InitMap(nil) m.InitMap(nil, 1)
//m.SkillUp(24, 1, 3, 7, true) //m.SkillUp(24, 1, 3, 7, true)
m.SetMap() m.SetMap()
var vids int
for index := 7 - 1; index >= 0; index-- {
for j := 0; j < 7; j++ {
vids = index + j*7
fmt.Printf("%d ", vids)
}
fmt.Printf("\n")
}
for i := 0; i < 4; i++ {
b := m.GetFireBoom(30, int32(i)+5)
fmt.Printf("xxxx %d\n", b)
}
var mids map[int]struct{}
mids = make(map[int]struct{}, 0)
// k := m.Skill3(24, 0)
for i := 0; i < 4; i++ {
dd := m.Skill3(24, int32(i))
for k := range dd {
for s := range m.Skill3(int32(k), int32(i)) {
mids[s] = struct{}{}
}
}
}
for b := range mids {
fmt.Printf("xxxx %d\n", b)
}
fmt.Printf("xxxx %v\n", m.GetBoomElem(46))
m.Debugf()
// b := m.CheckAndRefreshPlat()
// fmt.Printf("xxxx%v", b)
//m.RedsetPlatData()
m.SwapGirde(15, 22)
m.Debugf() m.Debugf()
b := m.CheckAndRefreshPlat()
fmt.Printf("xxxx%v", b)
m.RedsetPlatData()
m.SwapGirde(1, 8)
m.CheckMap(1, false) m.CheckMap(1, false)
m.Debugf() m.Debugf()
// for i := 0; i < 100; i++ { // for i := 0; i < 100; i++ {

View File

@ -41,6 +41,7 @@ const (
EffectTipsType_Bleed EffectTipsType = 15 //流血 EffectTipsType_Bleed EffectTipsType = 15 //流血
EffectTipsType_Recovery EffectTipsType = 16 //复苏 EffectTipsType_Recovery EffectTipsType = 16 //复苏
EffectTipsType_BeatBack EffectTipsType = 17 //反击 EffectTipsType_BeatBack EffectTipsType = 17 //反击
EffectTipsType_Diseased EffectTipsType = 18 //禁疗
) )
// Enum value maps for EffectTipsType. // Enum value maps for EffectTipsType.
@ -64,6 +65,7 @@ var (
15: "Bleed", 15: "Bleed",
16: "Recovery", 16: "Recovery",
17: "BeatBack", 17: "BeatBack",
18: "Diseased",
} }
EffectTipsType_value = map[string]int32{ EffectTipsType_value = map[string]int32{
"Eff_Success": 0, "Eff_Success": 0,
@ -84,6 +86,7 @@ var (
"Bleed": 15, "Bleed": 15,
"Recovery": 16, "Recovery": 16,
"BeatBack": 17, "BeatBack": 17,
"Diseased": 18,
} }
) )
@ -1948,7 +1951,7 @@ var file_battle_battle_struct_proto_rawDesc = []byte{
0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x75, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x75, 0x72,
0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x53, 0x77, 0x69, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x26, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x53, 0x77, 0x69, 0x74,
0x63, 0x68, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x63, 0x68, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2a, 0x9c, 0x02, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x63, 0x65, 0x6e, 0x65, 0x2a, 0xaa, 0x02,
0x0a, 0x0e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65, 0x0a, 0x0e, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x54, 0x69, 0x70, 0x73, 0x54, 0x79, 0x70, 0x65,
0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x66, 0x66, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x12, 0x0f, 0x0a, 0x0b, 0x45, 0x66, 0x66, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10,
0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x6f, 0x74, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
@ -1966,8 +1969,9 @@ var file_battle_battle_struct_proto_rawDesc = []byte{
0x6e, 0x64, 0x65, 0x61, 0x64, 0x10, 0x0d, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x6f, 0x69, 0x73, 0x6f, 0x6e, 0x64, 0x65, 0x61, 0x64, 0x10, 0x0d, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x6f, 0x69, 0x73, 0x6f,
0x6e, 0x65, 0x64, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x6c, 0x65, 0x65, 0x64, 0x10, 0x0f, 0x6e, 0x65, 0x64, 0x10, 0x0e, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x6c, 0x65, 0x65, 0x64, 0x10, 0x0f,
0x12, 0x0c, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x10, 0x10, 0x12, 0x0c, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x10, 0x10, 0x12, 0x0c,
0x0a, 0x08, 0x42, 0x65, 0x61, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x10, 0x11, 0x42, 0x06, 0x5a, 0x04, 0x0a, 0x08, 0x42, 0x65, 0x61, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x10, 0x11, 0x12, 0x0c, 0x0a, 0x08,
0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x44, 0x69, 0x73, 0x65, 0x61, 0x73, 0x65, 0x64, 0x10, 0x12, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (

View File

@ -374,7 +374,9 @@ type DBXXLData struct {
Rtime int64 `protobuf:"varint,5,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 (客户端不用) Rtime int64 `protobuf:"varint,5,opt,name=rtime,proto3" json:"rtime"` // 刷新时间 (客户端不用)
Playtype []int32 `protobuf:"varint,6,rep,packed,name=playtype,proto3" json:"playtype"` // 每天随机玩法 Playtype []int32 `protobuf:"varint,6,rep,packed,name=playtype,proto3" json:"playtype"` // 每天随机玩法
// map<int32,int64> boxid = 7; // 宝箱 key 宝箱id value 可领取的时间 // map<int32,int64> boxid = 7; // 宝箱 key 宝箱id value 可领取的时间
Box []*BoxData `protobuf:"bytes,7,rep,name=box,proto3" json:"box"` Box []*BoxData `protobuf:"bytes,7,rep,name=box,proto3" json:"box"`
Roomid string `protobuf:"bytes,8,opt,name=roomid,proto3" json:"roomid"` // 房间id 重连用
ServicePath string `protobuf:"bytes,9,opt,name=servicePath,proto3" json:"servicePath"` // 目标服务节点 重连RPC用
} }
func (x *DBXXLData) Reset() { func (x *DBXXLData) Reset() {
@ -458,6 +460,20 @@ func (x *DBXXLData) GetBox() []*BoxData {
return nil return nil
} }
func (x *DBXXLData) GetRoomid() string {
if x != nil {
return x.Roomid
}
return ""
}
func (x *DBXXLData) GetServicePath() string {
if x != nil {
return x.ServicePath
}
return ""
}
var File_entertain_entertain_db_proto protoreflect.FileDescriptor var File_entertain_entertain_db_proto protoreflect.FileDescriptor
var file_entertain_entertain_db_proto_rawDesc = []byte{ var file_entertain_entertain_db_proto_rawDesc = []byte{
@ -497,7 +513,7 @@ var file_entertain_entertain_db_proto_rawDesc = []byte{
0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x78, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6f, 0x78, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x05, 0x62, 0x6f, 0x78, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x28, 0x05, 0x52, 0x05, 0x62, 0x6f, 0x78, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x70, 0x65,
0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x70, 0x65,
0x6e, 0x74, 0x69, 0x6d, 0x65, 0x22, 0xc9, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x58, 0x58, 0x4c, 0x44, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x83, 0x03, 0x0a, 0x09, 0x44, 0x42, 0x58, 0x58, 0x4c, 0x44,
0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2e, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2e, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18,
@ -510,16 +526,19 @@ var file_entertain_entertain_db_proto_rawDesc = []byte{
0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70, 0x72, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70,
0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x74, 0x79, 0x70,
0x65, 0x12, 0x1a, 0x0a, 0x03, 0x62, 0x6f, 0x78, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x65, 0x12, 0x1a, 0x0a, 0x03, 0x62, 0x6f, 0x78, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08,
0x2e, 0x42, 0x6f, 0x78, 0x44, 0x61, 0x74, 0x61, 0x52, 0x03, 0x62, 0x6f, 0x78, 0x1a, 0x39, 0x0a, 0x2e, 0x42, 0x6f, 0x78, 0x44, 0x61, 0x74, 0x61, 0x52, 0x03, 0x62, 0x6f, 0x78, 0x12, 0x16, 0x0a,
0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x6f, 0x6f, 0x6d, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x50, 0x61, 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x43, 0x61, 0x72, 0x64, 0x69, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x38, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x43, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x33, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (