维京埋点
This commit is contained in:
parent
298a8f80ff
commit
8def819e11
@ -432,13 +432,13 @@ const (
|
|||||||
Rtype72 TaskType = 72 //完成一次捏人
|
Rtype72 TaskType = 72 //完成一次捏人
|
||||||
Rtype73 TaskType = 73 //通关难度A维京远征指定BOSSN次(从接到任务开始,只有通关A难度进度才+1)
|
Rtype73 TaskType = 73 //通关难度A维京远征指定BOSSN次(从接到任务开始,只有通关A难度进度才+1)
|
||||||
Rtype74 TaskType = 74 //通关难度A维京远征指定BOSS(检查最高难度记录是否超过了此难度,超过则完成)
|
Rtype74 TaskType = 74 //通关难度A维京远征指定BOSS(检查最高难度记录是否超过了此难度,超过则完成)
|
||||||
Rtype75 TaskType = 75 //自动战斗通关难度A的维京远征指定BOSS(从接到任务开始,若全程无手动操作(不包含变速)且挑战难度大于等于A则判断任务完成)
|
//Rtype75 TaskType = 75 //自动战斗通关难度A的维京远征指定BOSS(从接到任务开始,若全程无手动操作(不包含变速)且挑战难度大于等于A则判断任务完成)
|
||||||
Rtype76 TaskType = 76 //通关维京远征指定BOSSN次(从创号开始记录,通关任意难度进度都+1)
|
//Rtype76 TaskType = 76 //通关维京远征指定BOSSN次(从创号开始记录,通关任意难度进度都+1)
|
||||||
Rtype77 TaskType = 77 //通关难度A及以上维京远征指定BOSSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
//Rtype77 TaskType = 77 //通关难度A及以上维京远征指定BOSSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
||||||
Rtype78 TaskType = 78 //通关难度A维京远征指定BOSS时间达到XX秒以内(检查最高记录是否超过了此难度,超过则完成)
|
Rtype78 TaskType = 78 //通关难度A维京远征指定BOSS时间达到XX秒以内(检查最高记录是否超过了此难度,超过则完成)
|
||||||
Rtype79 TaskType = 79 //使用好友助战英雄通关A难度的指定维京远征BOSS(从接到任务开始,通关阵营中包含好友助战英雄,难度大于等于A的指定维京远征BOSS时任务完成。)
|
Rtype79 TaskType = 79 //使用好友助战英雄通关A难度的指定维京远征BOSS(从接到任务开始,通关阵营中包含好友助战英雄,难度大于等于A的指定维京远征BOSS时任务完成。)
|
||||||
Rtype80 TaskType = 80 //通关难度A指定狩猎BOOS难度N次(从接到任务开始,只有通关A难度进度才+1)
|
//Rtype80 TaskType = 80 //通关难度A指定狩猎BOOS难度N次(从接到任务开始,只有通关A难度进度才+1)
|
||||||
Rtype81 TaskType = 81 //通关A难度狩猎BOOS(检查最高难度记录是否达到了此难度,达到则完成)
|
//Rtype81 TaskType = 81 //通关A难度狩猎BOOS(检查最高难度记录是否达到了此难度,达到则完成)
|
||||||
Rtype82 TaskType = 82 //通关狩猎指定BOOSN次(历史)(从创号开始记录登陆天数,通关任意难度进度都+1)
|
Rtype82 TaskType = 82 //通关狩猎指定BOOSN次(历史)(从创号开始记录登陆天数,通关任意难度进度都+1)
|
||||||
Rtype83 TaskType = 83 //通关难度A及以上指定狩猎BOOSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
Rtype83 TaskType = 83 //通关难度A及以上指定狩猎BOOSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
||||||
Rtype84 TaskType = 84 //普通塔达到XX层(检查最高难度记录是否达到了此难度,达到则完成)
|
Rtype84 TaskType = 84 //普通塔达到XX层(检查最高难度记录是否达到了此难度,达到则完成)
|
||||||
|
@ -5,11 +5,7 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
"go_dreamfactory/sys/db"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,7 +25,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
newChallenge bool // 新的关卡
|
newChallenge bool // 新的关卡
|
||||||
reward []*cfg.Gameatn
|
reward []*cfg.Gameatn
|
||||||
asset []*pb.UserAssets
|
asset []*pb.UserAssets
|
||||||
costTime int32 // 战斗花费的时间
|
bWin bool // 战斗是否胜利
|
||||||
)
|
)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
reward = make([]*cfg.Gameatn, 0)
|
reward = make([]*cfg.Gameatn, 0)
|
||||||
@ -73,85 +69,26 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
}
|
}
|
||||||
mapData["boss"] = viking.Boss
|
mapData["boss"] = viking.Boss
|
||||||
}
|
}
|
||||||
if req.Report != nil {
|
|
||||||
costTime = req.Report.Costtime
|
|
||||||
}
|
|
||||||
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
|
|
||||||
code, _ = this.module.battle.CheckBattleReport(session, req.Report)
|
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if !bWin { // 战斗失败 直接返回
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
|
||||||
|
code, bWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||||
|
viking.LeftCount--
|
||||||
|
mapData["leftCount"] = viking.LeftCount
|
||||||
|
viking.ChallengeCount++
|
||||||
|
mapData["challengeCount"] = viking.ChallengeCount
|
||||||
conf := this.module.configure.GetGlobalConf()
|
conf := this.module.configure.GetGlobalConf()
|
||||||
if conf != nil {
|
if conf != nil {
|
||||||
if viking.LeftCount >= conf.VikingNum {
|
if viking.LeftCount >= conf.VikingNum {
|
||||||
viking.RecoveryTime = configure.Now().Unix()
|
viking.RecoveryTime = configure.Now().Unix()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viking.LeftCount--
|
this.module.CheckRank(session.GetUserId(), req.BossId, req.Difficulty, viking, req.Report)
|
||||||
mapData["leftCount"] = viking.LeftCount
|
|
||||||
viking.ChallengeCount++
|
|
||||||
mapData["challengeCount"] = viking.ChallengeCount
|
|
||||||
key := strconv.Itoa(int(req.BossId)) + "_" + strconv.Itoa(int(req.Difficulty))
|
|
||||||
|
|
||||||
if viking.BossTime[key] > costTime || viking.BossTime[key] == 0 && req.Difficulty >= viking.Boss[req.BossId] { // 刷新记录
|
|
||||||
viking.BossTime[key] = costTime
|
|
||||||
szLine := make([]*pb.LineUp, 5)
|
|
||||||
Leadpos := 0
|
|
||||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
|
||||||
costTime = req.Report.Costtime
|
|
||||||
Leadpos = int(req.Report.Info.Redflist[0].Leadpos)
|
|
||||||
for i, v := range req.Report.Info.Redflist[0].Team {
|
|
||||||
if v != nil {
|
|
||||||
szLine[i] = &pb.LineUp{
|
|
||||||
Cid: v.HeroID,
|
|
||||||
Star: v.Star,
|
|
||||||
Lv: v.Lv,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 写入排行榜
|
|
||||||
objID := ""
|
|
||||||
bFind := false
|
|
||||||
ranks := this.module.modulerank.getVikingRankList(session.GetUserId())
|
|
||||||
for _, v := range ranks {
|
|
||||||
if v.Bosstype == req.BossId {
|
|
||||||
mapRankData := make(map[string]interface{}, 0)
|
|
||||||
mapRankData["difficulty"] = req.Difficulty
|
|
||||||
mapRankData["bosstype"] = req.BossId
|
|
||||||
mapRankData["Leadpos"] = Leadpos
|
|
||||||
mapRankData["line"] = szLine
|
|
||||||
mapRankData["costTime"] = costTime
|
|
||||||
conn_, _ := db.Cross()
|
|
||||||
dbModel := db.NewDBModel(comm.TableVikingRank, time.Hour, conn_)
|
|
||||||
dbModel.ChangeList(session.GetUserId(), v.Id, mapRankData)
|
|
||||||
objID = v.Id
|
|
||||||
bFind = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !bFind {
|
|
||||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
|
||||||
new := &pb.DBVikingRank{
|
|
||||||
Id: primitive.NewObjectID().Hex(),
|
|
||||||
Uid: session.GetUserId(),
|
|
||||||
Difficulty: req.Difficulty,
|
|
||||||
Bosstype: req.BossId,
|
|
||||||
Nickname: userinfo.Name,
|
|
||||||
Icon: "",
|
|
||||||
Lv: userinfo.Lv,
|
|
||||||
Leadpos: int32(Leadpos),
|
|
||||||
Line: szLine,
|
|
||||||
CostTime: costTime,
|
|
||||||
}
|
|
||||||
objID = new.Id
|
|
||||||
conn_, _ := db.Cross()
|
|
||||||
dbModel := db.NewDBModel(comm.TableVikingRank, time.Hour, conn_)
|
|
||||||
dbModel.AddList(session.GetUserId(), new.Id, new)
|
|
||||||
}
|
|
||||||
this.module.modulerank.SetRankListData("vikingRank"+strconv.Itoa(int(req.BossId)), req.Difficulty<<16+costTime, objID)
|
|
||||||
}
|
|
||||||
mapData["bossTime"] = viking.BossTime // 更新时间
|
mapData["bossTime"] = viking.BossTime // 更新时间
|
||||||
if newChallenge { // 新关卡挑战通过 发放首通奖励
|
if newChallenge { // 新关卡挑战通过 发放首通奖励
|
||||||
if code = this.module.DispenseRes(session, cfg.Firstprize, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, cfg.Firstprize, true); code != pb.ErrorCode_Success {
|
||||||
@ -184,5 +121,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
Data: viking,
|
Data: viking,
|
||||||
Asset: asset,
|
Asset: asset,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 随机任务统计
|
||||||
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype73, req.Difficulty, req.BossId, 1)
|
||||||
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype74, req.Difficulty, req.BossId)
|
||||||
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype78, req.Difficulty, req.BossId, req.Report.Costtime)
|
||||||
|
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||||
|
for _, v := range req.Report.Info.Redflist[0].Team {
|
||||||
|
if v.Ishelp { // 判断是否有助战
|
||||||
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype79, req.Difficulty, req.BossId)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,11 @@ import (
|
|||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Viking struct {
|
type Viking struct {
|
||||||
@ -75,3 +80,67 @@ func (this *Viking) CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Viking) CheckRank(uid string, boosID int32, difficulty int32, viking *pb.DBViking, report *pb.BattleReport) {
|
||||||
|
costTime := report.Costtime
|
||||||
|
key := strconv.Itoa(int(boosID)) + "_" + strconv.Itoa(int(difficulty))
|
||||||
|
|
||||||
|
if viking.BossTime[key] > costTime || viking.BossTime[key] == 0 && difficulty >= viking.Boss[boosID] { // 刷新记录
|
||||||
|
viking.BossTime[key] = costTime
|
||||||
|
szLine := make([]*pb.LineUp, 5)
|
||||||
|
Leadpos := 0
|
||||||
|
if report != nil && report.Info != nil && len(report.Info.Redflist) > 0 {
|
||||||
|
costTime = report.Costtime
|
||||||
|
Leadpos = int(report.Info.Redflist[0].Leadpos)
|
||||||
|
for i, v := range report.Info.Redflist[0].Team {
|
||||||
|
if v != nil {
|
||||||
|
szLine[i] = &pb.LineUp{
|
||||||
|
Cid: v.HeroID,
|
||||||
|
Star: v.Star,
|
||||||
|
Lv: v.Lv,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 写入排行榜
|
||||||
|
objID := ""
|
||||||
|
bFind := false
|
||||||
|
ranks := this.modulerank.getVikingRankList(uid)
|
||||||
|
for _, v := range ranks {
|
||||||
|
if v.Bosstype == boosID {
|
||||||
|
mapRankData := make(map[string]interface{}, 0)
|
||||||
|
mapRankData["difficulty"] = difficulty
|
||||||
|
mapRankData["bosstype"] = boosID
|
||||||
|
mapRankData["Leadpos"] = Leadpos
|
||||||
|
mapRankData["line"] = szLine
|
||||||
|
mapRankData["costTime"] = costTime
|
||||||
|
conn_, _ := db.Cross()
|
||||||
|
dbModel := db.NewDBModel(comm.TableVikingRank, time.Hour, conn_)
|
||||||
|
dbModel.ChangeList(uid, v.Id, mapRankData)
|
||||||
|
objID = v.Id
|
||||||
|
bFind = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !bFind {
|
||||||
|
userinfo := this.ModuleUser.GetUser(uid)
|
||||||
|
new := &pb.DBVikingRank{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
Uid: uid,
|
||||||
|
Difficulty: difficulty,
|
||||||
|
Bosstype: boosID,
|
||||||
|
Nickname: userinfo.Name,
|
||||||
|
Icon: "",
|
||||||
|
Lv: userinfo.Lv,
|
||||||
|
Leadpos: int32(Leadpos),
|
||||||
|
Line: szLine,
|
||||||
|
CostTime: costTime,
|
||||||
|
}
|
||||||
|
objID = new.Id
|
||||||
|
conn_, _ := db.Cross()
|
||||||
|
dbModel := db.NewDBModel(comm.TableVikingRank, time.Hour, conn_)
|
||||||
|
dbModel.AddList(uid, new.Id, new)
|
||||||
|
}
|
||||||
|
this.modulerank.SetRankListData("vikingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user