Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-11-22 14:38:59 +08:00
commit aac7850519
3 changed files with 178 additions and 155 deletions

View File

@ -359,86 +359,86 @@ const (
// 随机任务类型 // 随机任务类型
const ( const (
Rtype1 TaskType = 1 //英雄指定 Rtype1 TaskType = 1 //英雄指定
Rtype2 TaskType = 2 //主线之内触发了剧情Id Rtype2 TaskType = 2 //主线之内触发了剧情Id
Rtype3 TaskType = 3 //每日任务 Rtype3 TaskType = 3 //每日任务
Rtype4 TaskType = 4 //指定英雄的等级限制 Rtype4 TaskType = 4 //指定英雄的等级限制
Rtype5 TaskType = 5 //指定英雄的装备数量 Rtype5 TaskType = 5 //指定英雄的装备数量
Rtype6 TaskType = 6 //指定英雄的星级 Rtype6 TaskType = 6 //指定英雄的星级
Rtype7 TaskType = 7 //日常登录一次 Rtype7 TaskType = 7 //日常登录一次
Rtype8 TaskType = 8 //累计登陆xx天 Rtype8 TaskType = 8 //累计登陆xx天
Rtype9 TaskType = 9 //连续登陆xx天 Rtype9 TaskType = 9 //连续登陆xx天
Rtype10 TaskType = 10 //拥有xx个好友 Rtype10 TaskType = 10 //拥有xx个好友
Rtype11 TaskType = 11 //赠送X次友情点 Rtype11 TaskType = 11 //赠送X次友情点
Rtype12 TaskType = 12 //使用好友助战英雄xx次 Rtype12 TaskType = 12 //使用好友助战英雄xx次
Rtype13 TaskType = 13 //更换X次助战英雄 Rtype13 TaskType = 13 //更换X次助战英雄
Rtype14 TaskType = 14 //累计xx次普通招募 Rtype14 TaskType = 14 //累计xx次普通招募
Rtype15 TaskType = 15 //累计xx次阵营招募 Rtype15 TaskType = 15 //累计xx次阵营招募
Rtype16 TaskType = 16 //招募获得xx品质英雄xx个 Rtype16 TaskType = 16 //招募获得xx品质英雄xx个
Rtype17 TaskType = 17 //普通招募十连获得xx个以上xx星英雄 Rtype17 TaskType = 17 //普通招募十连获得xx个以上xx星英雄
Rtype18 TaskType = 18 //xx次普通招募 Rtype18 TaskType = 18 //xx次普通招募
Rtype19 TaskType = 19 //xx次阵营招募 Rtype19 TaskType = 19 //xx次阵营招募
Rtype20 TaskType = 20 //用户等级达到xx级 Rtype20 TaskType = 20 //用户等级达到xx级
Rtype21 TaskType = 21 //英雄合成xx次 Rtype21 TaskType = 21 //英雄合成xx次
Rtype22 TaskType = 22 //合成xx英雄 Rtype22 TaskType = 22 //合成xx英雄
Rtype23 TaskType = 23 //拥有xx个xx星级的xx等级英雄 Rtype23 TaskType = 23 //拥有xx个xx星级的xx等级英雄
Rtype24 TaskType = 24 //为任意英雄提升xx次等级 Rtype24 TaskType = 24 //为任意英雄提升xx次等级
Rtype25 TaskType = 25 //xx名xx英雄升至xx星 Rtype25 TaskType = 25 //xx名xx英雄升至xx星
Rtype26 TaskType = 26 //xx名英雄从三星升四星 Rtype26 TaskType = 26 //xx名英雄从三星升四星
Rtype27 TaskType = 27 //xx名英雄从四星升五星 Rtype27 TaskType = 27 //xx名英雄从四星升五星
Rtype28 TaskType = 28 //xx名英雄从五星升六星 Rtype28 TaskType = 28 //xx名英雄从五星升六星
Rtype29 TaskType = 29 //拥有xx个xx级及以上的【xx】英雄 Rtype29 TaskType = 29 //拥有xx个xx级及以上的【xx】英雄
Rtype30 TaskType = 30 //获得xx个品质为xx的英雄 Rtype30 TaskType = 30 //获得xx个品质为xx的英雄
Rtype31 TaskType = 31 //获得xx个品质为xx以上的英雄 Rtype31 TaskType = 31 //获得xx个品质为xx以上的英雄
Rtype32 TaskType = 32 //xx个品质为xx的英雄升到xx级 Rtype32 TaskType = 32 //xx个品质为xx的英雄升到xx级
Rtype33 TaskType = 33 //xx个品质为xx以及以上英雄升到xx级 Rtype33 TaskType = 33 //xx个品质为xx以及以上英雄升到xx级
Rtype34 TaskType = 34 //xx个英雄觉醒达到xx阶段 Rtype34 TaskType = 34 //xx个英雄觉醒达到xx阶段
Rtype35 TaskType = 35 //xx英雄觉醒达到xx阶段 Rtype35 TaskType = 35 //xx英雄觉醒达到xx阶段
Rtype36 TaskType = 36 //xx位xx品质xx职业英雄xx阵营觉醒达到xx阶段 Rtype36 TaskType = 36 //xx位xx品质xx职业英雄xx阵营觉醒达到xx阶段
Rtype37 TaskType = 37 //xx名xx品质英雄满共鸣、等级、觉醒 Rtype37 TaskType = 37 //xx名xx品质英雄满共鸣、等级、觉醒
Rtype38 TaskType = 38 //xx英雄满级、共鸣、觉醒至最高状态 Rtype38 TaskType = 38 //xx英雄满级、共鸣、觉醒至最高状态
Rtype39 TaskType = 39 //累计英雄共鸣xx次 Rtype39 TaskType = 39 //累计英雄共鸣xx次
Rtype40 TaskType = 40 //xx个英雄共鸣满xx次 Rtype40 TaskType = 40 //xx个英雄共鸣满xx次
Rtype41 TaskType = 41 //xx名英雄穿戴xx件xx星级的装备 Rtype41 TaskType = 41 //xx名英雄穿戴xx件xx星级的装备
Rtype42 TaskType = 42 //xx名英雄穿戴xx件xx等级的装备 Rtype42 TaskType = 42 //xx名英雄穿戴xx件xx等级的装备
Rtype43 TaskType = 43 //将xx件装备强化至xx级 Rtype43 TaskType = 43 //将xx件装备强化至xx级
Rtype44 TaskType = 44 //任意装备强化到xx级 Rtype44 TaskType = 44 //任意装备强化到xx级
Rtype45 TaskType = 45 //将xx件xx星【xx】套装装备强化至xx级 Rtype45 TaskType = 45 //将xx件xx星【xx】套装装备强化至xx级
Rtype46 TaskType = 46 //为xx名英雄穿戴完整xx星【xx】套装装备 Rtype46 TaskType = 46 //为xx名英雄穿戴完整xx星【xx】套装装备
Rtype47 TaskType = 47 //累计强化装备成功xx次 Rtype47 TaskType = 47 //累计强化装备成功xx次
Rtype48 TaskType = 48 //xx次xx星的二件套装备强化至xx并穿戴 Rtype48 TaskType = 48 //xx次xx星的二件套装备强化至xx并穿戴
Rtype49 TaskType = 49 //xx次xx星的四件套装备强化至xx并穿戴 Rtype49 TaskType = 49 //xx次xx星的四件套装备强化至xx并穿戴
Rtype50 TaskType = 50 //获得xx星以上装备xx件 Rtype50 TaskType = 50 //获得xx星以上装备xx件
Rtype51 TaskType = 51 //在铁匠铺中获得xx件xx星装备 Rtype51 TaskType = 51 //在铁匠铺中获得xx件xx星装备
Rtype52 TaskType = 52 //xx英雄提升xx次技能等级 Rtype52 TaskType = 52 //xx英雄提升xx次技能等级
Rtype53 TaskType = 53 //技能升级累计xx次 Rtype53 TaskType = 53 //技能升级累计xx次
Rtype54 TaskType = 54 //x名卡牌角色技能全满级 Rtype54 TaskType = 54 //x名卡牌角色技能全满级
Rtype55 TaskType = 55 //xx品质英雄提升xx次技能等级 Rtype55 TaskType = 55 //xx品质英雄提升xx次技能等级
Rtype56 TaskType = 56 //拥有xx名技能升级xx次的xx职业英雄 Rtype56 TaskType = 56 //拥有xx名技能升级xx次的xx职业英雄
Rtype57 TaskType = 57 //xx名英雄技能满级 Rtype57 TaskType = 57 //xx名英雄技能满级
Rtype58 TaskType = 58 //通关任意普通爬塔层数 Rtype58 TaskType = 58 //通关任意普通爬塔层数
Rtype59 TaskType = 59 //通关普通爬塔xx层 Rtype59 TaskType = 59 //通关普通爬塔xx层
Rtype60 TaskType = 60 //任意主线副本通关1次 Rtype60 TaskType = 60 //任意主线副本通关1次
Rtype61 TaskType = 61 //通关主线关卡xx Rtype61 TaskType = 61 //通关主线关卡xx
Rtype62 TaskType = 62 //世界聊天发言xx次 Rtype62 TaskType = 62 //世界聊天发言xx次
Rtype63 TaskType = 63 //日常任务活跃度达到xx Rtype63 TaskType = 63 //日常任务活跃度达到xx
Rtype64 TaskType = 64 //任意商品购买xx次 Rtype64 TaskType = 64 //任意商品购买xx次
Rtype65 TaskType = 65 //在商店购买xx商品xx件 Rtype65 TaskType = 65 //在商店购买xx商品xx件
Rtype66 TaskType = 66 //xx商店购买任意商品xx次 Rtype66 TaskType = 66 //xx商店购买任意商品xx次
Rtype67 TaskType = 67 //商店购物消耗xx货币xx个 Rtype67 TaskType = 67 //商店购物消耗xx货币xx个
Rtype68 TaskType = 68 //任意渠道消耗xx金币 Rtype68 TaskType = 68 //任意渠道消耗xx金币
Rtype69 TaskType = 69 //与其他玩家切磋xx次 Rtype69 TaskType = 69 //与其他玩家切磋xx次
Rtype70 TaskType = 70 //通关世界任务XX关卡 Rtype70 TaskType = 70 //通关世界任务XX关卡
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层(检查最高难度记录是否达到了此难度,达到则完成)
@ -497,7 +497,11 @@ const (
Rtype137 TaskType = 137 //累计铁匠铺锻造X小时历史(从创号开始记录满1小时进度+1) Rtype137 TaskType = 137 //累计铁匠铺锻造X小时历史(从创号开始记录满1小时进度+1)
Rtype138 TaskType = 138 //在线N分钟(从接到任务开始,记录玩家在线时间并记入进度) Rtype138 TaskType = 138 //在线N分钟(从接到任务开始,记录玩家在线时间并记入进度)
Rtype139 TaskType = 139 //通过融合获得指定英雄(从接到任务开始记录,通过融合获得指定英雄则任务完成) Rtype139 TaskType = 139 //通过融合获得指定英雄(从接到任务开始记录,通过融合获得指定英雄则任务完成)
<<<<<<< HEAD
Rtype140 TaskType = 140 //关卡编辑器完成条件 Rtype140 TaskType = 140 //关卡编辑器完成条件
=======
>>>>>>> 8def819e118af719604f8c08eda354d931faa7c7
) )
const ( const (

View File

@ -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
} }

View File

@ -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)
}
}