赛季塔需要手动激活
This commit is contained in:
parent
95cf865134
commit
802a322f2a
@ -7,7 +7,6 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -24,10 +23,9 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Pagod
|
||||
///挑战主线关卡
|
||||
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
mapData map[string]interface{}
|
||||
pagoda *pb.DBPagoda
|
||||
seasonPagoda *pb.DBSeasonPagoda
|
||||
costTime int32 // 本次战斗消耗的时间
|
||||
mapData map[string]interface{}
|
||||
pagoda *pb.DBPagoda
|
||||
costTime int32 // 本次战斗消耗的时间
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
code = this.ChallengeOverCheck(session, req)
|
||||
@ -58,12 +56,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
}
|
||||
} else {
|
||||
// 塔数据校验
|
||||
seasonPagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||
pagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_PagodaNotFound
|
||||
return
|
||||
}
|
||||
if seasonPagoda.Type != req.PagodaType || conf.LayerNum-1 != seasonPagoda.PagodaId {
|
||||
if pagoda.Type != req.PagodaType || conf.LayerNum-1 != pagoda.PagodaId {
|
||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||
return
|
||||
}
|
||||
@ -119,32 +117,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
}
|
||||
// 普通塔通关了
|
||||
Nomalcfg := this.module.configure.GetPagodaConfigData(comm.PagodaType, pagoda.PagodaId+1)
|
||||
if Nomalcfg == nil { // 创建赛季塔数据
|
||||
if Nomalcfg == nil {
|
||||
// 修改expand 数据
|
||||
update := map[string]interface{}{
|
||||
"completePagoda": true,
|
||||
}
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update)
|
||||
seasonPagoda := &pb.DBSeasonPagoda{}
|
||||
seasonPagoda.Id = primitive.NewObjectID().Hex()
|
||||
|
||||
seasonPagoda.Uid = session.GetUserId()
|
||||
seasonPagoda.PagodaId = 0 // 初始数据0层
|
||||
|
||||
if conn, err := db.Cross(); err == nil {
|
||||
rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{})
|
||||
server := &pb.DBServerData{}
|
||||
rst.Decode(server)
|
||||
seasonPagoda.Type = server.SeasonType // 动态获取塔数据
|
||||
}
|
||||
this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), seasonPagoda)
|
||||
// 推送新的
|
||||
pagoda.PagodaId = seasonPagoda.PagodaId
|
||||
pagoda.Type = seasonPagoda.Type
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: pagoda})
|
||||
}
|
||||
} else {
|
||||
seasonPagoda.PagodaId = conf.LayerNum
|
||||
pagoda.PagodaId = conf.LayerNum
|
||||
mapData["pagodaId"] = conf.LayerNum
|
||||
// 记录爬塔明细数据
|
||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||
@ -164,8 +145,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
newData := &pb.DBPagodaRecord{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
PagodaId: seasonPagoda.PagodaId,
|
||||
Type: seasonPagoda.Type,
|
||||
PagodaId: pagoda.PagodaId,
|
||||
Type: pagoda.Type,
|
||||
Nickname: userinfo.Name,
|
||||
Icon: "", // icon 暂无
|
||||
Lv: userinfo.Lv,
|
||||
@ -175,24 +156,16 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
// 数据写到跨服中
|
||||
conn_, err := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableSeasonRecord, time.Hour, conn_)
|
||||
//if err = dbModel.GetList(uid, newData); err == nil {
|
||||
dbModel.AddList(uid, newData.Id, newData)
|
||||
this.module.SetPagodaRankList("pagodaList"+strconv.Itoa(int(newData.PagodaId)), newData.CostTime, newData.Id)
|
||||
//}
|
||||
dbModelTable := db.NewDBModel(comm.TableSeasonPagoda, time.Hour, conn_)
|
||||
if err = dbModelTable.Get(session.GetUserId(), seasonPagoda); err == nil {
|
||||
if err = dbModelTable.Get(session.GetUserId(), pagoda); err == nil {
|
||||
dbModelTable.Change(session.GetUserId(), mapData) // 修改跨服数据
|
||||
this.module.SetPagodaRankList("pagodaSeasonRank", seasonPagoda.PagodaId<<8+costTime, session.GetUserId())
|
||||
this.module.SetPagodaRankList("pagodaSeasonRank", pagoda.PagodaId<<8+costTime, session.GetUserId())
|
||||
}
|
||||
}
|
||||
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
||||
pagoda = &pb.DBPagoda{
|
||||
Id: seasonPagoda.Id,
|
||||
Uid: seasonPagoda.Uid,
|
||||
PagodaId: seasonPagoda.PagodaId,
|
||||
Reward: seasonPagoda.Reward,
|
||||
Type: seasonPagoda.Type,
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user