From 0ca938652b1e39dd2531fc9dc43b368033db84d2 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 8 Nov 2023 11:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=AF=E5=88=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/entertainment/api_create.go | 5 ++-- modules/entertainment/api_joinroom.go | 5 ++-- modules/entertainment/api_match.go | 5 ++-- modules/entertainment/match.go | 10 ++++--- modules/entertainment/room.go | 38 +++++++++++++++++++------ modules/entertainment/xxlPlat.go | 39 ++++++++++++++------------ pb/entertain_db.pb.go | 40 ++++++++++++++++++++------- 7 files changed, 96 insertions(+), 46 deletions(-) diff --git a/modules/entertainment/api_create.go b/modules/entertainment/api_create.go index b8111bea4..182098934 100644 --- a/modules/entertainment/api_create.go +++ b/modules/entertainment/api_create.go @@ -63,8 +63,9 @@ func (this *apiComp) CreateRoom(session comm.IUserSession, req *pb.EntertainCrea return } p1 := &pb.PlayerData{ - Userinfo: comm.GetUserBaseInfo(user), - Cardid: req.Idcard, + Userinfo: comm.GetUserBaseInfo(user), + Cardid: req.Idcard, + Consumeexp: user.Consumeexp, } if room, err = this.module.gameMgr.CreateMasterRoom(p1); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/entertainment/api_joinroom.go b/modules/entertainment/api_joinroom.go index a9a55ba44..a41d108c0 100644 --- a/modules/entertainment/api_joinroom.go +++ b/modules/entertainment/api_joinroom.go @@ -61,8 +61,9 @@ func (this *apiComp) JoinRoom(session comm.IUserSession, req *pb.EntertainJoinRo return } p := &pb.PlayerData{ - Userinfo: comm.GetUserBaseInfo(user), - Cardid: req.Idcard, + Userinfo: comm.GetUserBaseInfo(user), + Cardid: req.Idcard, + Consumeexp: user.Consumeexp, } if _, err = this.module.gameMgr.JoinMasterRoom(req.Roomid, p); err != nil { diff --git a/modules/entertainment/api_match.go b/modules/entertainment/api_match.go index dd6645f8c..83fcaae72 100644 --- a/modules/entertainment/api_match.go +++ b/modules/entertainment/api_match.go @@ -58,8 +58,9 @@ func (this *apiComp) Match(session comm.IUserSession, req *pb.EntertainMatchReq) } this.module.match.MatchReq(&pb.DBXXLMatch{ - Userinfo: comm.GetUserBaseInfo(user), - Cardid: req.Idcard, + Userinfo: comm.GetUserBaseInfo(user), + Cardid: req.Idcard, + Consumeexp: user.Consumeexp, }) session.SendMsg(string(this.module.GetType()), "match", &pb.EntertainMatchResp{ diff --git a/modules/entertainment/match.go b/modules/entertainment/match.go index e7c0b0996..d27bf9800 100644 --- a/modules/entertainment/match.go +++ b/modules/entertainment/match.go @@ -68,13 +68,15 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) { for pos, v := range playerSlice { if pos == 0 { p1 = &pb.PlayerData{ - Userinfo: v.Userinfo, - Cardid: v.Cardid, + Userinfo: v.Userinfo, + Cardid: v.Cardid, + Consumeexp: v.Consumeexp, } } else if pos == 1 { p2 = &pb.PlayerData{ - Userinfo: v.Userinfo, - Cardid: v.Cardid, + Userinfo: v.Userinfo, + Cardid: v.Cardid, + Consumeexp: v.Consumeexp, } } else { break diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index a19b1726a..b187580a8 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -55,7 +55,7 @@ func (this *Room) RandomPlayType() (itype int32) { weight = append(weight, v.Weight) } itype = list[comm.GetRandW(weight)].Key - + //itype = 4 return } @@ -139,13 +139,13 @@ func (this *Room) AiOperator() { ChangeType: 1, }) } - for _, v := range szMap { // - curScore += v.CurSocre - this.player2.Score += v.CurSocre - v.CurSocre = this.player2.Score - this.player2.Energy += v.CurEnergy - v.CurEnergy = this.player2.Energy - } + // for _, v := range szMap { // + // curScore += v.CurSocre + // this.player2.Score += v.CurSocre + // v.CurSocre = this.player2.Score + // this.player2.Energy += v.CurEnergy + // v.CurEnergy = this.player2.Energy + // } // 广播消息 if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ Mpadata: szMap, @@ -381,6 +381,18 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr this.round++ } + for _, v := range szMap { // + fmt.Printf("================\n") + var v1 int + for index := Width - 1; index >= 0; index-- { + for j := 0; j < Height; j++ { + v1 = index + j*7 + fmt.Printf("%d ", v.Data[v1].Cid) + + } + fmt.Printf("\n") + } + } // 广播消息 if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ Mpadata: szMap, @@ -568,7 +580,15 @@ func (this *Room) GameOver() (errdata *pb.ErrorData) { if conf, err := this.module.configure.GetGameConsumeintegral(user.Consumeexp); err == nil { //res = append(res, conf.Onereward...) 这奖励手动领取 res = append(res, conf.Rewards...) - + for _, v := range res { + if v.A == "attr" && v.T == "consumeexp" { + if winner == this.player1 { + this.player1.Score += v.N + } else { + this.player2.Score += v.N + } + } + } if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil { return } diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go index 35f711217..052e493e4 100644 --- a/modules/entertainment/xxlPlat.go +++ b/modules/entertainment/xxlPlat.go @@ -117,7 +117,7 @@ func (this *MapData) InitMap(module *Entertainment, iType int32) { this.SetIndelibilityPlat() this.Plat = this.GetPalatData() - // this.SetMap() // 方便测试固定地图 + //this.SetMap() // 方便测试固定地图 } // 交换之前先判断是不是特殊元素的交换 @@ -740,26 +740,29 @@ func (this *MapData) SkillUp(pos int32, color int32, skillid int32, value int32, func (this *MapData) SetMap() { sz2 := []int32{ - 3, 3, 2, 2, 1, 3, 1, - 5, 1, 3, 3, 1, 2, 2, - 3, 2, 1, 4, 3, 1, 6, - 1, 4, 3, 4, 2, 3, 6, + 3, 1, 2, 2, 1, 3, 1, + 5, 1, 2, 3, 1, 2, 2, + 2, 42, 3, 4, 3, 1, 6, + 1, 3, 3, 4, 2, 3, 6, 1, 5, 6, 5, 6, 1, 4, - 6, 6, 3, 6, 3, 1, 3, - 3, 3, 1, 3, 3, 2, 5, - // 1, 4, 2, 5, 4, 5, 2, - // 3, 2, 3, 5, 2, 1, 4, - // 2, 5, 5, 4, 5, 4, 1, - // 3, 1, 3, 5, 2, 6, 3, - // 4, 5, 4, 2, 4, 1, 1, - // 5, 3, 1, 5, 3, 3, 4, - // 4, 2, 4, 1, 2, 3, 4, + 6, 6, 3, 6, 3, 48, 3, + 3, 3, 1, 3, 5, 2, 5, } var pos int for index := Width - 1; index >= 0; index-- { for j := 0; j < Height; j++ { - this.Plat[index+j*Height].Color = sz2[pos] - this.Plat[index+j*Height].Cid = sz2[pos] + Color := sz2[pos] + Cid := sz2[pos] + if sz2[pos] > 6 { + conf, err := this.module.configure.GetGameBlockByKey(sz2[pos]) + if err == nil { + Color = conf.Color + Cid = conf.Key + this.Plat[index+j*Height].Special = conf.Type + } + } + this.Plat[index+j*Height].Color = Color + this.Plat[index+j*Height].Cid = Cid pos++ } } @@ -1128,7 +1131,9 @@ func (this *MapData) GetBoomElem(pos int) (elem []int) { func (this *MapData) GetFireBoom(pos int, itype int32) (elem []int) { x := int(pos / Width) y := int(pos % Height) - + if itype == FireUp || itype == FireDown || itype == FireLeft || itype == FireRight { + elem = append(elem, pos) + } switch itype { case FireUp: //上烟火 for i := 0; i < Height; i++ { diff --git a/pb/entertain_db.pb.go b/pb/entertain_db.pb.go index b56baf19e..c71331730 100644 --- a/pb/entertain_db.pb.go +++ b/pb/entertain_db.pb.go @@ -177,11 +177,12 @@ type PlayerData struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Userinfo *BaseUserInfo `protobuf:"bytes,1,opt,name=userinfo,proto3" json:"userinfo"` - Score int32 `protobuf:"varint,2,opt,name=score,proto3" json:"score"` // 积分 - Ps int32 `protobuf:"varint,3,opt,name=ps,proto3" json:"ps"` // 体力 - Cardid string `protobuf:"bytes,4,opt,name=cardid,proto3" json:"cardid"` // 出战的英雄卡 - Energy int32 `protobuf:"varint,5,opt,name=energy,proto3" json:"energy"` // 能量进度 + Userinfo *BaseUserInfo `protobuf:"bytes,1,opt,name=userinfo,proto3" json:"userinfo"` + Score int32 `protobuf:"varint,2,opt,name=score,proto3" json:"score"` // 本局战斗得分 + Ps int32 `protobuf:"varint,3,opt,name=ps,proto3" json:"ps"` // 体力 + Cardid string `protobuf:"bytes,4,opt,name=cardid,proto3" json:"cardid"` // 出战的英雄卡 + Energy int32 `protobuf:"varint,5,opt,name=energy,proto3" json:"energy"` // 能量进度 + Consumeexp int32 `protobuf:"varint,6,opt,name=consumeexp,proto3" json:"consumeexp"` // 消消乐积分 } func (x *PlayerData) Reset() { @@ -251,14 +252,22 @@ func (x *PlayerData) GetEnergy() int32 { return 0 } +func (x *PlayerData) GetConsumeexp() int32 { + if x != nil { + return x.Consumeexp + } + return 0 +} + // 消消乐匹配数据 type DBXXLMatch struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Userinfo *BaseUserInfo `protobuf:"bytes,1,opt,name=userinfo,proto3" json:"userinfo"` - Cardid string `protobuf:"bytes,2,opt,name=cardid,proto3" json:"cardid"` // 选择的卡片ID + Userinfo *BaseUserInfo `protobuf:"bytes,1,opt,name=userinfo,proto3" json:"userinfo"` + Cardid string `protobuf:"bytes,2,opt,name=cardid,proto3" json:"cardid"` // 选择的卡片ID + Consumeexp int32 `protobuf:"varint,3,opt,name=consumeexp,proto3" json:"consumeexp"` // 消消乐积分 } func (x *DBXXLMatch) Reset() { @@ -307,6 +316,13 @@ func (x *DBXXLMatch) GetCardid() string { return "" } +func (x *DBXXLMatch) GetConsumeexp() int32 { + if x != nil { + return x.Consumeexp + } + return 0 +} + type BoxData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -495,7 +511,7 @@ var file_entertain_entertain_db_proto_rawDesc = []byte{ 0x28, 0x05, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x22, 0x8d, 0x01, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x61, 0x6c, 0x22, 0xad, 0x01, 0x0a, 0x0a, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, @@ -504,12 +520,16 @@ var file_entertain_entertain_db_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x02, 0x70, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x4f, 0x0a, 0x0a, 0x44, 0x42, 0x58, 0x58, 0x4c, + 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x65, 0x78, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6f, 0x6e, + 0x73, 0x75, 0x6d, 0x65, 0x65, 0x78, 0x70, 0x22, 0x6f, 0x0a, 0x0a, 0x44, 0x42, 0x58, 0x58, 0x4c, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x12, 0x29, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x22, 0x3b, 0x0a, 0x07, 0x42, 0x6f, 0x78, 0x44, + 0x52, 0x06, 0x63, 0x61, 0x72, 0x64, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x73, + 0x75, 0x6d, 0x65, 0x65, 0x78, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x63, 0x6f, + 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x65, 0x78, 0x70, 0x22, 0x3b, 0x0a, 0x07, 0x42, 0x6f, 0x78, 0x44, 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, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x70, 0x65,