移动到出生点 直接去上一层
This commit is contained in:
parent
378525c2ef
commit
b657714a0d
@ -32,13 +32,47 @@ func (this *apiComp) LatticeGrid(session comm.IUserSession, req *pb.UiGameLattic
|
||||
update := make(map[string]interface{}, 0)
|
||||
list, _ := this.module.modelLattice.getLatticeList(session.GetUserId(), req.Hdid)
|
||||
|
||||
if _, ok := list.Gotarr[req.Grid]; ok {
|
||||
session.SendMsg(string(this.module.GetType()), "latticegrid", &pb.UiGameLatticeGridResp{Data: list})
|
||||
if latticeConf, err = this.module.configure.GetLatticeConf(list.Floor); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if list.Floor > 1 { // 移动到出生点 直接去上一层
|
||||
if latticeConf.Bornpos == req.Grid {
|
||||
list.Floor -= 1
|
||||
update["floor"] = list.Floor
|
||||
list.Curpos = 0
|
||||
update["curpos"] = list.Curpos
|
||||
this.module.modelLattice.modifyLatticeListByObjId(session.GetUserId(), update)
|
||||
session.SendMsg(string(this.module.GetType()), "latticegrid", &pb.UiGameLatticeGridResp{
|
||||
Data: list,
|
||||
Atno: atno,
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
if v1, ok := list.Lattice[list.Floor]; ok {
|
||||
if _, ok := v1.Data[req.Grid]; ok {
|
||||
list.Curpos = req.Grid
|
||||
if req.Grid == latticeConf.Outpos { // 宝箱关
|
||||
list.Floor += 1
|
||||
// 校验是不是达到最大层数
|
||||
if _, e := this.module.configure.GetLatticeConf(list.Floor); e != nil {
|
||||
list.Floor -= 1
|
||||
} else {
|
||||
list.Curpos = 0
|
||||
}
|
||||
update["floor"] = list.Floor
|
||||
if list.Total < list.Floor {
|
||||
list.Total = list.Floor
|
||||
update["total"] = list.Total
|
||||
}
|
||||
}
|
||||
|
||||
update["curpos"] = list.Curpos
|
||||
this.module.modelLattice.modifyLatticeListByObjId(session.GetUserId(), update)
|
||||
session.SendMsg(string(this.module.GetType()), "latticegrid", &pb.UiGameLatticeGridResp{
|
||||
@ -49,7 +83,6 @@ func (this *apiComp) LatticeGrid(session comm.IUserSession, req *pb.UiGameLattic
|
||||
}
|
||||
list.Lattice[list.Floor].Data[req.Grid] = 1
|
||||
} else {
|
||||
|
||||
list.Lattice[list.Floor] = &pb.LatticeData{
|
||||
Data: map[int32]int32{req.Grid: 1},
|
||||
}
|
||||
@ -63,11 +96,6 @@ func (this *apiComp) LatticeGrid(session comm.IUserSession, req *pb.UiGameLattic
|
||||
}
|
||||
}
|
||||
|
||||
// 校验 是否是宝箱
|
||||
latticeConf, err = this.module.configure.GetLatticeConf(list.Floor)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
for _, v := range latticeConf.Chestspos {
|
||||
if v == req.Grid { // 发现是宝箱
|
||||
if errdata, atno = this.module.DispenseAtno(session, latticeConf.Chestsward, true); errdata != nil {
|
||||
@ -93,8 +121,10 @@ func (this *apiComp) LatticeGrid(session comm.IUserSession, req *pb.UiGameLattic
|
||||
// 校验是不是达到最大层数
|
||||
if _, e := this.module.configure.GetLatticeConf(list.Floor); e != nil {
|
||||
list.Floor -= 1
|
||||
} else {
|
||||
req.Grid = 0 // 重置出生点
|
||||
}
|
||||
update["Floor"] = list.Floor
|
||||
update["floor"] = list.Floor
|
||||
if list.Total < list.Floor {
|
||||
list.Total = list.Floor
|
||||
update["total"] = list.Total
|
||||
|
Loading…
Reference in New Issue
Block a user