任务埋点整理3

This commit is contained in:
wh_zcy 2023-05-24 19:36:01 +08:00
parent 48c68c04fd
commit 6afcd78e36
4 changed files with 102 additions and 10 deletions

View File

@ -551,15 +551,15 @@ 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层(检查最高难度记录是否达到了此难度,达到则完成)
Rtype85 TaskType = 85 //赛季塔达到XX层(检查最高难度记录是否达到了此难度,达到则完成) Rtype85 TaskType = 85 //赛季塔达到XX层(检查最高难度记录是否达到了此难度,达到则完成)
Rtype86 TaskType = 86 //本赛季的赛季塔达到XX层(检查本赛季最高难度记录是否达到了此难度,达到则完成) Rtype86 TaskType = 86 //本赛季的赛季塔达到XX层(检查本赛季最高难度记录是否达到了此难度,达到则完成)
@ -584,7 +584,7 @@ const (
Rtype104 TaskType = 104 Rtype104 TaskType = 104
Rtype105 TaskType = 105 //商店刷新N次(从接到任务开始,每次刷新商店进度+1) Rtype105 TaskType = 105 //商店刷新N次(从接到任务开始,每次刷新商店进度+1)
Rtype106 TaskType = 106 //跨服聊天发言N次(从接到任务开始,每次跨服发言成功进度+1) Rtype106 TaskType = 106 //跨服聊天发言N次(从接到任务开始,每次跨服发言成功进度+1)
Rtype107 TaskType = 107 //赠送N个人好感度(从接到任务开始每赠送1个好友好感度则进度+1)
Rtype108 TaskType = 108 //助战英雄被使用X次(从接到任务开始每被使用1次则进度+1) Rtype108 TaskType = 108 //助战英雄被使用X次(从接到任务开始每被使用1次则进度+1)
Rtype109 TaskType = 109 //加入公会(打开任务时,检查是否加入了公会,加入则完成) Rtype109 TaskType = 109 //加入公会(打开任务时,检查是否加入了公会,加入则完成)
Rtype110 TaskType = 110 //激活X个英雄图鉴(打开任务时,检查英雄图鉴激活数量并计入进度,达到了任务所需个数则完成任务。) Rtype110 TaskType = 110 //激活X个英雄图鉴(打开任务时,检查英雄图鉴激活数量并计入进度,达到了任务所需个数则完成任务。)

View File

@ -146,10 +146,15 @@ func equal[T Num](actual, expected T) bool {
} }
// 大于等于 // 大于等于
func greatEual(actual, expected int32) bool { func greatEqual(actual, expected int32) bool {
return actual >= expected return actual >= expected
} }
// 大于
func great(actual, expected int32) bool {
return actual > expected
}
// 小于等于 // 小于等于
func lessEqual(actual, expected int32) bool { func lessEqual(actual, expected int32) bool {
return actual <= expected return actual <= expected
@ -164,8 +169,17 @@ func soEqual[T Num](actual T, expected T) (ok bool, err error) {
return return
} }
func soGreat(actual, expected int32) (ok bool, err error) {
if !great(actual, expected) {
err = errors.New(fmt.Sprintf("soGreat actual:%v expect:%v", actual, expected))
return
}
ok = true
return
}
func soGreatEqual(actual, expected int32) (ok bool, err error) { func soGreatEqual(actual, expected int32) (ok bool, err error) {
if !greatEual(actual, expected) { if !greatEqual(actual, expected) {
err = errors.New(fmt.Sprintf("soGreatEqual actual:%v expect:%v", actual, expected)) err = errors.New(fmt.Sprintf("soGreatEqual actual:%v expect:%v", actual, expected))
return return
} }

View File

@ -133,7 +133,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
} }
handles = append(handles, handle) handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle) this.registerVerifyHandle(v.Id, handle)
case comm.Rtype50, comm.Rtype73: case comm.Rtype50:
handle := &rtaskCondHandle{ handle := &rtaskCondHandle{
condId: v.Id, condId: v.Id,
verify: this.modelRtaskRecord.verifyGreatEqual, verify: this.modelRtaskRecord.verifyGreatEqual,
@ -181,8 +181,8 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36, comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36,
comm.Rtype37, comm.Rtype40, comm.Rtype41, comm.Rtype37, comm.Rtype40, comm.Rtype41,
comm.Rtype42, comm.Rtype43, comm.Rtype42, comm.Rtype43,
comm.Rtype46, comm.Rtype47, comm.Rtype46, comm.Rtype47, comm.Rtype73, comm.Rtype76, comm.Rtype77, comm.Rtype79, comm.Rtype80, comm.Rtype83,
comm.Rtype52, comm.Rtype55, comm.Rtype56, comm.Rtype52, comm.Rtype55, comm.Rtype56, comm.Rtype82,
comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140, comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140,
comm.Rtype168, comm.Rtype169, comm.Rtype170, comm.Rtype174, comm.Rtype179, comm.Rtype180: comm.Rtype168, comm.Rtype169, comm.Rtype170, comm.Rtype174, comm.Rtype179, comm.Rtype180:
handle := &rtaskCondHandle{ handle := &rtaskCondHandle{
@ -192,6 +192,22 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle
} }
handles = append(handles, handle) handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle) this.registerVerifyHandle(v.Id, handle)
case comm.Rtype78:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.verifyThirdLessEqualParam,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
case comm.Rtype74, comm.Rtype75:
handle := &rtaskCondHandle{
condId: v.Id,
verify: this.modelRtaskRecord.veriftyFirstGreatParam,
update: this.modelRtaskRecord.overrideUpdate,
}
handles = append(handles, handle)
this.registerVerifyHandle(v.Id, handle)
default: default:
log.Warnf("rtaskType[%v] handle not register", tt) log.Warnf("rtaskType[%v] handle not register", tt)
} }

View File

@ -107,6 +107,68 @@ func (this *ModelRtaskRecord) verifyFirstGreatEqualParam(uid string, record *pb.
return return
} }
func (this *ModelRtaskRecord) verifyThirdLessEqualParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, toArr(v.Data)...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
return soGreatEqual(v.Data[0], cfg.Data1)
case 2:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
case 3:
if ok, err = soGreatEqual(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
if ok, err = soLessEqual(v.Data[2], cfg.Data3); !ok {
return
}
}
}
}
return
}
func (this *ModelRtaskRecord) veriftyFirstGreatParam(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
if v, f := record.Vals[cfg.Id]; f {
if len(v.Data) == 0 {
err = errors.WithMessagef(err, "玩家参数数据缺失 %v", v.Data)
return
}
var paramLen int
if paramLen, err = lenParam(cfg, toArr(v.Data)...); err == nil {
//参数比较,默认第一个参数soGreateEqual,其它soEqual
switch paramLen {
case 1:
return soGreat(v.Data[0], cfg.Data1)
case 2:
if ok, err = soGreat(v.Data[0], cfg.Data1); !ok {
return
}
if ok, err = soEqual(v.Data[1], cfg.Data2); !ok {
return
}
}
}
}
return
}
// 英雄指定 // 英雄指定
func (this *ModelRtask) verfiyRtype1(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { func (this *ModelRtask) verfiyRtype1(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) {
heroModule, err := this.service.GetModule(comm.ModuleHero) heroModule, err := this.service.GetModule(comm.ModuleHero)