69 lines
1.9 KiB
Go
69 lines
1.9 KiB
Go
package stonehenge
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) FinishCheck(session comm.IUserSession, req *pb.StonehengeFinishReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// 结算房间
|
|
func (this *apiComp) Finish(session comm.IUserSession, req *pb.StonehengeFinishReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
stone *pb.DBStonehenge
|
|
update map[string]interface{}
|
|
err error
|
|
curintegral int32
|
|
)
|
|
update = make(map[string]interface{})
|
|
if errdata = this.FinishCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
if stone, err = this.module.modelStonehenge.GetStonehengeData(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.String(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
// 发放积分 和奖励
|
|
|
|
if conf := this.module.configure.GetStageConfByStageid(stone.StageID, stone.CurRoomIndes); conf != nil {
|
|
stone.Integral += conf.WeeklyPoint
|
|
curintegral = conf.WeeklyPoint
|
|
// if errdata, atno = this.module.DispenseAtno(session, conf.FirstReward, true); errdata != nil {
|
|
// return
|
|
// }
|
|
}
|
|
stone.StageID = 0
|
|
update["stageID"] = stone.StageID
|
|
stone.CurRoomIndes = 0
|
|
update["curRoomIndes"] = stone.CurRoomIndes
|
|
stone.Rooms = nil
|
|
update["rooms"] = stone.Rooms
|
|
stone.Webuff = make([]int32, 0)
|
|
update["webuff"] = stone.Webuff
|
|
stone.Enemybuff = make([]int32, 0)
|
|
update["enemybuff"] = stone.Enemybuff
|
|
stone.Userbuff = make(map[int32]int32)
|
|
update["userbuff"] = stone.Userbuff
|
|
stone.Hero = make(map[string]*pb.BattleRole)
|
|
update["hero"] = stone.Hero
|
|
stone.Addweight = make(map[int32]int32, 0)
|
|
update["addweight"] = stone.Addweight
|
|
|
|
this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update)
|
|
session.SendMsg(string(this.module.GetType()), "finish", &pb.StonehengeFinishResp{
|
|
Data: stone,
|
|
Curintegral: curintegral,
|
|
})
|
|
return
|
|
}
|