bingo:成长任务

This commit is contained in:
wh_zcy 2022-12-08 19:12:15 +08:00
parent 838ef9e2de
commit a44595ce31
4 changed files with 58 additions and 2 deletions

View File

@ -46,7 +46,7 @@ func (this *BingoView) CreateView(t *model.TestCase) fyne.CanvasObject {
aSel = &widget.Select{}
gridContainer = container.NewGridWithColumns(3, aSel, tEntry, nEntry)
aSel.Options = []string{"选择", "attr", "item", "hero", "equi", "mapid", "pataid", "alltask", "worldtask", "sociatyexp", "sociatyactivity"}
aSel.Options = []string{"选择", "attr", "item", "hero", "equi", "mapid", "pataid", "alltask", "worldtask", "sociatyexp", "sociatyactivity", "allgrowtask"}
aSel.SetSelected("选择")
aSel.OnChanged = func(s string) {
if s == "attr" {

View File

@ -323,4 +323,8 @@ type (
//与指定英雄好感度等级达到N
CheckRtype133(uid string, heroId string, lv int32) bool
}
// 个人成长任务
IGrowtask interface {
BingoAllGrowTask(session IUserSession) error
}
)

View File

@ -244,7 +244,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
}
module1.(comm.ISociaty).BingoSetActivity(session, int32(num))
this.Debug("使用bingo命令", log.Fields{"uid": session.GetUserId(), "0": datas[1]})
} else if len(datas) == 1 && (datas[0] == "alltask") { // 设置工会活跃度
} else if len(datas) == 1 && (datas[0] == "alltask") { // 完成所有世界任务
module, err := this.service.GetModule(comm.ModuleWorldtask)
if err != nil {
return
@ -255,6 +255,17 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
}
}
} else if len(datas) == 1 && (datas[0] == "allgrowtask") { // 完成所有成长任务
module, err := this.service.GetModule(comm.ModuleGrowtask)
if err != nil {
return
}
if wt, ok := module.(comm.IGrowtask); ok {
if err = wt.BingoAllGrowTask(session); err != nil {
this.Error("bingo 成长任务", log.Fields{"params": datas, "err": err.Error()})
}
}
}
}

View File

@ -4,9 +4,13 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
var _ comm.IGrowtask = (*Growtask)(nil)
type Growtask struct {
modules.ModuleBase
api *apiComp
@ -33,3 +37,40 @@ func (this *Growtask) OnInstallComp() {
this.modelGrowtask = this.RegisterComp(new(ModelGrowtask)).(*ModelGrowtask)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (m *Growtask) BingoAllGrowTask(session comm.IUserSession) error {
uid := session.GetUserId()
gt := &pb.DBGrowtask{Uid: uid}
//初始任务
init, err := m.modelGrowtask.initGrowtask(uid, 1)
if err != nil {
m.Error("初始任务", log.Fields{"uid": uid})
return err
}
gt.InitTaskList = init.InitTaskList
//中级任务
mid, err := m.modelGrowtask.initGrowtask(uid, 2)
if err != nil {
m.Error("中级任务", log.Fields{"uid": uid})
return err
}
gt.MidTaskList = mid.MidTaskList
//高级任务
high, err := m.modelGrowtask.initGrowtask(uid, 3)
if err != nil {
m.Error("高级任务", log.Fields{"uid": uid})
return err
}
gt.HighTaskList = high.HighTaskList
update := map[string]interface{}{
"initTaskList": gt.InitTaskList,
"midTaskList": gt.MidTaskList,
"highTaskList": gt.HighTaskList,
}
return m.modelGrowtask.Change(uid, update)
}