三消上传
This commit is contained in:
parent
a5f8e905c7
commit
2b9c0b828e
@ -210,7 +210,7 @@ type (
|
|||||||
ChangeUserMoonLv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
ChangeUserMoonLv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
||||||
//GM创号
|
//GM创号
|
||||||
GMCreatePlayer(session IUserSession, req *pb.UserCreateReq) (errdata *pb.ErrorData)
|
GMCreatePlayer(session IUserSession, req *pb.UserCreateReq) (errdata *pb.ErrorData)
|
||||||
// 清除玩家赛季积分
|
// 清除玩家赛季积分 ---需要清除
|
||||||
CleanUserConsumeexp(session IUserSession) (err error)
|
CleanUserConsumeexp(session IUserSession) (err error)
|
||||||
}
|
}
|
||||||
//武器模块
|
//武器模块
|
||||||
|
@ -110,6 +110,7 @@ func (this *matchComp) MatchNotic(players map[string]interface{}) (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
this.module.gameMgr.CreateRoomByType(p1, p2, -1)
|
this.module.gameMgr.CreateRoomByType(p1, p2, -1)
|
||||||
}()
|
}()
|
||||||
|
@ -253,9 +253,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
|||||||
if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil {
|
if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.module.model.modifyEntertainmList(session.GetUserId(), map[string]interface{}{
|
|
||||||
"skill": curPlayer.Skill,
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 {
|
if req.Itype == 0 && req.Curid == 0 && req.Targetid == 0 {
|
||||||
@ -558,95 +556,85 @@ func (this *Room) GameOver(winner *pb.PlayerData) (errdata *pb.ErrorData) {
|
|||||||
var (
|
var (
|
||||||
atno []*pb.UserAtno
|
atno []*pb.UserAtno
|
||||||
winindex int32
|
winindex int32
|
||||||
bReward bool
|
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
lostPlayer *pb.PlayerData // 输的玩家
|
lostPlayer *pb.PlayerData // 输的玩家
|
||||||
box *pb.BoxData // 是否可以获得宝箱奖励
|
box *pb.BoxData // 是否可以获得宝箱奖励
|
||||||
)
|
)
|
||||||
bReward = true
|
|
||||||
if winner == nil {
|
if winner == nil {
|
||||||
if this.player1.Score < this.player2.Score {
|
if this.player1.Score < this.player2.Score {
|
||||||
winner = this.player2
|
winner = this.player2
|
||||||
winindex = 1
|
winindex = 1
|
||||||
if this.RoomType == 2 { // 赢家是AI 的话不发奖
|
|
||||||
bReward = false
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
winner = this.player1
|
winner = this.player1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if bReward { // 发奖
|
|
||||||
if user, err := this.module.ModuleUser.GetUser(winner.Userinfo.Uid); err == nil {
|
|
||||||
if conf, err := this.module.configure.GetGameConsumeintegral(user.Consumeexp); err == nil {
|
|
||||||
res = append(res, conf.Rewards...)
|
|
||||||
for _, v := range res {
|
|
||||||
if v.A == "attr" && v.T == "consumeexp" {
|
|
||||||
if winner.Userinfo.Uid == this.player1.Userinfo.Uid {
|
|
||||||
this.player1.Consumeexp += v.N
|
|
||||||
} else {
|
|
||||||
this.player2.Consumeexp += v.N
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if errdata, atno = this.module.DispenseAtno(this.szSession[winindex], res, true); errdata != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
go this.module.WriteUserLog(winner.Userinfo.Uid, "gameover", comm.GMResAddType, "xxlGameReward", atno)
|
|
||||||
|
|
||||||
this.szSession[winindex].Push()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 失败的一方扣除卡
|
|
||||||
if this.player1 != winner {
|
if this.player1 != winner {
|
||||||
lostPlayer = this.player1
|
lostPlayer = this.player1
|
||||||
} else {
|
} else {
|
||||||
lostPlayer = this.player2
|
lostPlayer = this.player2
|
||||||
}
|
}
|
||||||
// 失败卡类型
|
|
||||||
if conf, err := this.module.configure.GetGameConsumeHero(lostPlayer.Cardid); err == nil && lostPlayer.Userinfo.Uid != "999" {
|
|
||||||
|
|
||||||
if list, err := this.module.model.getEntertainmList(lostPlayer.Userinfo.Uid); err == nil {
|
|
||||||
update := map[string]interface{}{}
|
|
||||||
if list.Liansheng != 0 {
|
|
||||||
list.Liansheng = 0 // 修改连胜
|
|
||||||
update["liansheng"] = list.Liansheng
|
|
||||||
}
|
|
||||||
|
|
||||||
if conf.Type != 1 { //卡片类型不为1
|
|
||||||
if list.Card[lostPlayer.Cardid] >= 1 { //删除卡片
|
|
||||||
list.Card[lostPlayer.Cardid] -= 1
|
|
||||||
update["card"] = list.Card
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(update) > 0 {
|
|
||||||
this.module.model.modifyEntertainmList(lostPlayer.Userinfo.Uid, update)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 查看能不能获得箱子
|
|
||||||
if winner.Userinfo.Uid != "999" {
|
if winner.Userinfo.Uid != "999" {
|
||||||
if list, err := this.module.model.getEntertainmList(winner.Userinfo.Uid); err == nil {
|
var (
|
||||||
update := map[string]interface{}{}
|
list *pb.DBXXLData
|
||||||
// 修改连胜
|
err error
|
||||||
list.Liansheng += 1
|
update map[string]interface{}
|
||||||
update["liansheng"] = list.Liansheng
|
)
|
||||||
if len(list.Box) < 3 { // 可以获得一个宝箱
|
update = make(map[string]interface{})
|
||||||
if c, err := this.module.configure.GetGameRandomConsumeBoxConf(); err == nil {
|
if list, err = this.module.model.getEntertainmList(winner.Userinfo.Uid); err == nil {
|
||||||
if c.Color != 0 {
|
return
|
||||||
box = &pb.BoxData{
|
}
|
||||||
Boxid: c.Boxid,
|
if user, err := this.module.ModuleUser.GetUser(winner.Userinfo.Uid); err == nil {
|
||||||
Opentime: int64(c.Cd) + configure.Now().Unix(),
|
if conf, err := this.module.configure.GetGameConsumeintegral(user.Consumeexp); err == nil {
|
||||||
}
|
res = append(res, conf.Rewards...)
|
||||||
list.Box = append(list.Box, box)
|
for _, v := range res {
|
||||||
update["box"] = list.Box
|
if v.A == "attr" && v.T == "consumeexp" {
|
||||||
|
this.player2.Consumeexp += v.N
|
||||||
|
list.Consumeexp += v.N
|
||||||
|
update["consumeexp"] = list.Consumeexp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.szSession[winindex].Push()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改连胜
|
||||||
|
list.Liansheng += 1
|
||||||
|
update["liansheng"] = list.Liansheng
|
||||||
|
if len(list.Box) < 3 { // 可以获得一个宝箱
|
||||||
|
if c, err := this.module.configure.GetGameRandomConsumeBoxConf(); err == nil {
|
||||||
|
if c.Color != 0 {
|
||||||
|
box = &pb.BoxData{
|
||||||
|
Boxid: c.Boxid,
|
||||||
|
Opentime: int64(c.Cd) + configure.Now().Unix(),
|
||||||
|
}
|
||||||
|
list.Box = append(list.Box, box)
|
||||||
|
update["box"] = list.Box
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.module.model.modifyEntertainmList(winner.Userinfo.Uid, update)
|
||||||
|
}
|
||||||
|
if lostPlayer.Userinfo.Uid != "999" {
|
||||||
|
if conf, err := this.module.configure.GetGameConsumeHero(lostPlayer.Cardid); err == nil {
|
||||||
|
|
||||||
|
if list, err := this.module.model.getEntertainmList(lostPlayer.Userinfo.Uid); err == nil {
|
||||||
|
update := map[string]interface{}{}
|
||||||
|
if list.Liansheng != 0 {
|
||||||
|
list.Liansheng = 0 // 修改连胜
|
||||||
|
update["liansheng"] = list.Liansheng
|
||||||
|
}
|
||||||
|
|
||||||
|
if conf.Type != 1 { //卡片类型不为1
|
||||||
|
if list.Card[lostPlayer.Cardid] >= 1 { //删除卡片
|
||||||
|
list.Card[lostPlayer.Cardid] -= 1
|
||||||
|
update["card"] = list.Card
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(update) > 0 {
|
||||||
|
this.module.model.modifyEntertainmList(lostPlayer.Userinfo.Uid, update)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.module.model.modifyEntertainmList(winner.Userinfo.Uid, update)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,7 +941,7 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
|
|||||||
if conf.Skilltype == 1 { // 技能类型为1
|
if conf.Skilltype == 1 { // 技能类型为1
|
||||||
szMap = this.chessboard.HitElem(color, curid)
|
szMap = this.chessboard.HitElem(color, curid)
|
||||||
} else if conf.Skilltype == 2 {
|
} else if conf.Skilltype == 2 {
|
||||||
this.chessboard.SetIndelibilityPlat()
|
this.chessboard.ShuffleElem() // 初始化棋盘
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.chessboard.Plat,
|
Data: this.chessboard.Plat,
|
||||||
})
|
})
|
||||||
@ -971,6 +959,7 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid i
|
|||||||
this.player2.Energy += v.CurEnergy
|
this.player2.Energy += v.CurEnergy
|
||||||
v.CurEnergy = this.player2.Energy
|
v.CurEnergy = this.player2.Energy
|
||||||
}
|
}
|
||||||
|
v.ChangeType = 1
|
||||||
}
|
}
|
||||||
this.NexPower = this.curPower
|
this.NexPower = this.curPower
|
||||||
|
|
||||||
|
@ -1284,7 +1284,6 @@ func (this *MapData) SpecialElem(id int, s int32) (x map[int]struct{}) {
|
|||||||
}
|
}
|
||||||
func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
||||||
this.Plat[curid] = &pb.GirdeData{}
|
this.Plat[curid] = &pb.GirdeData{}
|
||||||
|
|
||||||
if this.DropGirde() {
|
if this.DropGirde() {
|
||||||
szMap = append(szMap, &pb.MapData{
|
szMap = append(szMap, &pb.MapData{
|
||||||
Data: this.GetPalatData(),
|
Data: this.GetPalatData(),
|
||||||
@ -1294,5 +1293,21 @@ func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
|
|||||||
}
|
}
|
||||||
sz, _ := this.CheckMap(color, false)
|
sz, _ := this.CheckMap(color, false)
|
||||||
szMap = append(szMap, sz...)
|
szMap = append(szMap, sz...)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MapData) ShuffleElem() {
|
||||||
|
|
||||||
|
for i := 0; i < Total; i++ {
|
||||||
|
n1, _ := rand.Int(rand.Reader, big.NewInt(Total))
|
||||||
|
newId := n1.Int64()
|
||||||
|
if i != int(n1.Int64()) {
|
||||||
|
tmp := new(pb.GirdeData)
|
||||||
|
*tmp = *this.Plat[newId]
|
||||||
|
this.Plat[newId] = this.Plat[i]
|
||||||
|
this.Plat[i] = tmp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.SetIndelibilityPlat()
|
||||||
|
}
|
||||||
|
@ -409,7 +409,7 @@ type EntertainOperatorReq struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Roomid string `protobuf:"bytes,1,opt,name=roomid,proto3" json:"roomid"` // 房间id
|
Roomid string `protobuf:"bytes,1,opt,name=roomid,proto3" json:"roomid"` // 房间id
|
||||||
Itype int32 `protobuf:"varint,2,opt,name=itype,proto3" json:"itype"` // 操作类型 0 默认交换元素 999 技能
|
Itype int32 `protobuf:"varint,2,opt,name=itype,proto3" json:"itype"` // 操作类型 0 默认交换元素 1 卡片技能
|
||||||
Curid int32 `protobuf:"varint,3,opt,name=curid,proto3" json:"curid"` // 当前key
|
Curid int32 `protobuf:"varint,3,opt,name=curid,proto3" json:"curid"` // 当前key
|
||||||
Targetid int32 `protobuf:"varint,4,opt,name=targetid,proto3" json:"targetid"` // 目标key
|
Targetid int32 `protobuf:"varint,4,opt,name=targetid,proto3" json:"targetid"` // 目标key
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user