公会任务激活

This commit is contained in:
wh_zcy 2023-06-27 17:38:24 +08:00
parent e92fa0bfb4
commit a023dc65f9
2 changed files with 15 additions and 9 deletions

View File

@ -116,7 +116,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
}
//检查钻石
if errdata = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}, true); errdata != nil {
if errdata = this.module.CheckRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}); errdata != nil {
this.module.Warn("资源不足",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "res", Value: this.module.globalConf.GuildBuildCos},
@ -205,14 +205,15 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype188, 1))
// 初始化玩家公会任务
go func() {
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {
this.module.Error("初始化玩家公会任务",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
}
}()
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {
this.module.Error("初始化玩家公会任务",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
}
//扣除钻石
this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.globalConf.GuildBuildCos}, true)
session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{
Id: sociaty.Id,

View File

@ -37,6 +37,7 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
taskListConf := this.moduleSociaty.sociatyTaskConf.GetDataList()
globalConf := this.moduleSociaty.globalConf
var condIds []int32
// 大于4条配置
if len(taskListConf) > int(globalConf.GuildTaskNum) {
// 按照权重
@ -46,16 +47,20 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
taskList = append(taskList, &pb.SociatyTask{
TaskId: taskListConf[v].TypeId,
})
condIds = append(condIds, taskListConf[v].TypeId)
}
} else {
for _, v := range taskListConf {
taskList = append(taskList, &pb.SociatyTask{
TaskId: v.TypeId,
})
condIds = append(condIds, v.TypeId)
}
}
sociatyTask.TaskList = taskList
sociatyTask.LastUpdateTime = configure.Now().Unix()
// 激活所有任务
this.moduleSociaty.ModuleBuried.ActiveCondition(uid, condIds...)
return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask)
}