上传新埋点接口

This commit is contained in:
liwei1dao 2023-05-29 17:16:52 +08:00
parent 1a2d39eaec
commit 0bde395d6a
91 changed files with 570 additions and 538 deletions

View File

@ -10,7 +10,8 @@ var taskParamPool = &sync.Pool{
},
}
func GettaskParam(t TaskType, p ...int32) *TaskParam {
//GetBuriedParam
func GetTaskParam(t TaskType, p ...int32) *TaskParam {
task := taskParamPool.Get().(*TaskParam)
task.TT = t
task.Params = append(task.Params, p...)
@ -21,3 +22,34 @@ func PuttaskParam(r *TaskParam) {
r.Params = r.Params[:0]
taskParamPool.Put(r)
}
var buriedParamPool = &sync.Pool{
New: func() interface{} {
return &TaskParam{}
},
}
//普通任务
func GetBuriedParam(t TaskType, vaule int32, p ...int32) *BuriedParam {
task := taskParamPool.Get().(*BuriedParam)
task.Btype = t
task.Value = vaule
task.Filter = append(task.Filter, p...)
return task
}
//统计型任务
func GetBuriedParam2(t TaskType, statistics string, p ...int32) *BuriedParam {
task := taskParamPool.Get().(*BuriedParam)
task.Btype = t
task.Statistics = statistics
task.Filter = append(task.Filter, p...)
return task
}
func PutburiedParam(r *BuriedParam) {
r.Filter = r.Filter[:0]
r.Value = 0
r.Statistics = ""
taskParamPool.Put(r)
}

View File

@ -54,7 +54,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe
}
this.module.DispenseRes(session, level.Award, true)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype151, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype151, 1))
}
session.SendMsg(string(this.module.GetType()), "receive", &pb.AcademyReceiveResp{Issucc: true})
return

View File

@ -40,7 +40,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
Tasks: record.Tasks,
}})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype130, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype130, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype130, 1))
} else {
session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: nil})
}

View File

@ -63,7 +63,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
bulestate = pb.BattleRecordState_DefendLost
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype131, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype131, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype131, 1))
} else {
if req.Revengeid != "" {
redstate = pb.BattleRecordState_RevengeFailed
@ -257,7 +257,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
}
session.SendMsg(string(this.module.GetType()), "challengereward", &pb.ArenaChallengeRewardResp{Issucc: true, Integral: info.Integral, Dan: info.Dan})
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype128, red.Integral), comm.GettaskParam(comm.Rtype129, red.Dan))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype128, red.Integral), comm.GetBuriedParam(comm.Rtype129, red.Dan))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype128, red.Integral)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype129, red.Dan)
return

View File

@ -138,8 +138,8 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
}
for _, v := range req.Format.Friendformat {
if v != "" {
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
break
}
}
@ -148,7 +148,7 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
return
}
if req.Format.Friendformat != nil {
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype12, 1))
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype12, 1))
}
return
}
@ -251,8 +251,8 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
}
for _, v := range req.Format.Friendformat {
if v != "" {
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
break
}
}
@ -261,7 +261,7 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
return
}
if req.Format.Friendformat != nil {
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype12, 1))
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype12, 1))
}
return
}
@ -383,8 +383,8 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt
}
this.moonfantasy.Trigger(session, report)
for _, v := range report.Completetask {
// this.ModuleRtask.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v)
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype157, int32(report.Info.Ptype), v))
// this.ModuleBuried.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v)
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype157, int32(report.Info.Ptype), v))
}
return pb.ErrorCode_Success, true
}

View File

@ -65,6 +65,8 @@ func (this *Buried) ActiveCondition(uid string, condiIds ...int32) {
//激活数据采集点
func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condIds []int32) {
return
}

View File

@ -75,7 +75,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
}
go this.module.modelChat.sendChatToWorld(msg, max_chat)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype62, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype62, 1))
//随机任务
// if _, err = this.service.AcrossClusterRpcGo(
// context.Background(),
@ -117,7 +117,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
go this.module.modelChat.sendChatToCrossServer(msg, max_chat)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype106, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype106, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype106, 1))
break
default:
code = pb.ErrorCode_ReqParameterError

View File

@ -25,12 +25,12 @@ func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (cod
return
}
func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode, data *pb.ErrorData) {
if code = a.DoCheck(session, req); code != pb.ErrorCode_Success {
func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode, data *pb.ErrorData) {
if code = this.DoCheck(session, req); code != pb.ErrorCode_Success {
return
}
dConf, err := a.module.configure.getDispatchTaskConf(req.TaskId)
dConf, err := this.module.configure.getDispatchTaskConf(req.TaskId)
if err != nil {
code = pb.ErrorCode_SystemError
return
@ -42,27 +42,27 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
}
if len(req.HeroIds) < int(dConf.Taskneed) {
a.module.Error("英雄派遣:", log.Field{Key: "HeroIds len", Value: len(req.HeroIds)}, log.Field{Key: "Taskneed", Value: dConf.Taskneed})
this.module.Error("英雄派遣:", log.Field{Key: "HeroIds len", Value: len(req.HeroIds)}, log.Field{Key: "Taskneed", Value: dConf.Taskneed})
code = pb.ErrorCode_DispatchHeroNoEnough
return
}
d := a.module.modelDispatch.getDBDispatch(session.GetUserId())
d := this.module.modelDispatch.getDBDispatch(session.GetUserId())
if d == nil && d.Nb == nil {
code = pb.ErrorCode_DataNotFound
return
}
//校验门票
ticketAtn := a.module.ModuleTools.GetGlobalConf().DispatchNumtools
if code = a.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
ticketAtn := this.module.ModuleTools.GetGlobalConf().DispatchNumtools
if code = this.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
code = pb.ErrorCode_DispatchTicketNoEnough
return
}
rsp := &pb.DispatchDoResp{}
if err := a.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroIds, d); err != nil {
if err := this.module.modelDispatch.dispatch(session.GetUserId(), req.TaskId, req.HeroIds, d); err != nil {
var errCustom = new(comm.CustomError)
if errors.As(err, &errCustom) {
code = errCustom.Code
@ -72,12 +72,12 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
return
}
go a.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype186, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype186, 1))
//扣除门票
a.module.ConsumeRes(session, []*cfg.Gameatn{ticketAtn}, true)
this.module.ConsumeRes(session, []*cfg.Gameatn{ticketAtn}, true)
rsp.IsSucc = true
session.SendMsg(string(a.module.GetType()), "do", rsp)
session.SendMsg(string(this.module.GetType()), "do", rsp)
return
}

View File

@ -90,7 +90,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype94, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype94, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype94, 1))
session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip})
return
}

View File

@ -30,8 +30,8 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
minstr int32 = 9999
minlv int32 = 9999
hero *pb.DBHero
suite1Str, suite1Lv, suite2Str, suite2Lv int32 = math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
suite1Str, suite1Lv, suite2Str, suite2Lv int32 = math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
)
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
@ -148,7 +148,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
hero.SuiteId = confs[0].Suittype
hero.Suite1Star = suite1Str
hero.Suite1Lv = suite1Lv
tasks = append(tasks, comm.GettaskParam(comm.Rtype93, 1, hero.SuiteId, suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype93, 1, hero.SuiteId, suite1Lv))
}
} else {
hero.SuiteId = 0
@ -160,7 +160,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
hero.SuiteExtId = confs[4].Suittype
hero.Suite2Star = suite2Str
hero.Suite2Lv = suite2Lv
tasks = append(tasks, comm.GettaskParam(comm.Rtype93, 1, hero.SuiteExtId, suite2Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype93, 1, hero.SuiteExtId, suite2Lv))
}
} else {
hero.SuiteExtId = 0
@ -178,34 +178,34 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
code = pb.ErrorCode_SystemError
return
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype5, equipNum, utils.ToInt32(hero.HeroID)))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype5, equipNum, utils.ToInt32(hero.HeroID)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype5, utils.ToInt32(hero.HeroID), equipNum)
// for k, v := range equipStr {
// tasks = append(tasks, comm.GettaskParam(comm.Rtype41, 1, v, k))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, v, k))
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype41, utils.ToInt32(hero.HeroID), v, k)
// }
tasks = append(tasks, comm.GettaskParam(comm.Rtype41, 1, equipNum, minstr))
tasks = append(tasks, comm.GettaskParam(comm.Rtype42, 1, equipNum, minlv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, equipNum, minstr))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, equipNum, minlv))
// for k, v := range equipLv {
// tasks = append(tasks, comm.GettaskParam(comm.Rtype42, 1, v, k))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, v, k))
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype42, utils.ToInt32(hero.HeroID), v, k)
// }
if hero.SuiteId != 0 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype98, 1, hero.Suite1Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype169, hero.SuiteId))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype169, hero.SuiteId))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
}
if hero.SuiteExtId != 0 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype98, 1, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
}
if len(tasks) > 0 {
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})

View File

@ -35,7 +35,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
issucc bool
suite1Lv, suite2Lv int32 = math.MaxInt32, math.MaxInt32
user *pb.DBUser
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
)
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
return
@ -169,27 +169,27 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
if hero.SuiteId != 0 {
hero.Suite1Lv = suite1Lv
tasks = append(tasks, comm.GettaskParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
}
if hero.SuiteExtId != 0 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
}
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
}
//随机任务触发
tasks = append(tasks, comm.GettaskParam(comm.Rtype43, 1, equipment.Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype44, 1, equipment.Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype47, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype43, 1, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype44, 1, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype44, equipment.Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
if conf.Pos == 7 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype102, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype102, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype102, 1)
} else if conf.Pos == 6 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype100, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype100, 1)
}
//聊天系统通知
@ -204,12 +204,12 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
} else {
tasks = append(tasks, comm.GettaskParam(comm.Rtype96, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype96, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype96, 1)
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype92, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype92, 1))
if len(tasks) > 0 {
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
return

View File

@ -67,7 +67,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype95, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype95, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype95, 1))
session.SendMsg(string(this.module.GetType()), "wash", &pb.EquipmentWashResp{Eid: req.Eid, AdverbEntry: adverbEntry})
return
}

View File

@ -96,8 +96,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
var (
configure *cfg.GameEquip
add map[string]*pb.DB_Equipment
uId string = session.GetUserId()
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
uId string = session.GetUserId()
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
)
if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil {
return
@ -111,8 +111,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
return nil, err
} else {
//随机任务
tasks = append(tasks, comm.GettaskParam(comm.Rtype50, 1, c.Star))
tasks = append(tasks, comm.GettaskParam(comm.Rtype97, 1, c.Suittype, c.Star))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype50, 1, c.Star))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype97, 1, c.Suittype, c.Star))
unm := int32(1)
if equipment.AdverbEntry != nil {
unm += int32(len(equipment.AdverbEntry))
@ -120,11 +120,11 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
if equipment.Adverbskill != nil {
unm += int32(len(equipment.Adverbskill))
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype99, 1, unm, c.Star))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype99, 1, unm, c.Star))
if c.Pos == 7 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype103, 1, c.Star))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype103, 1, c.Star))
} else if c.Pos == 6 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype101, 1, c.Star))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype101, 1, c.Star))
}
add[equipment.Id] = equipment
change = append(change, equipment)
@ -135,7 +135,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
//异步出发任务启动
if len(tasks) > 0 {
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}
if len(add) > 0 {

View File

@ -33,17 +33,17 @@ const (
type apiComp struct {
modules.MCompGate
moduleFriend *Friend
module *Friend
}
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
_ = this.MCompGate.Init(service, module, comp, options)
this.moduleFriend = module.(*Friend)
this.module = module.(*Friend)
return
}
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
user := this.moduleFriend.ModuleUser.GetUser(userId)
user := this.module.ModuleUser.GetUser(userId)
if user != nil {
return &pb.FriendBase{
ServerId: user.Sid,

View File

@ -22,11 +22,11 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
}
//校验切磋请求是否超时
if qr := this.moduleFriend.ModelFriendQiecuo.getQiecuo(req.Uid); qr != nil {
if qr := this.module.ModelFriendQiecuo.getQiecuo(req.Uid); qr != nil {
now := configure.Now().Unix()
if now-qr.Timestamp > 10 { //大于10s 切磋超时
code = pb.ErrorCode_FriendQiecuoTimeout
this.moduleFriend.Debug("切磋接受超时", log.Field{Key: "uid", Value: session.GetUserId()})
this.module.Debug("切磋接受超时", log.Field{Key: "uid", Value: session.GetUserId()})
return
}
} else {
@ -34,19 +34,19 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
return
}
if imodule, err := this.moduleFriend.service.GetModule(comm.ModulePvp); err == nil {
if imodule, err := this.module.service.GetModule(comm.ModulePvp); err == nil {
if ipvp, ok := imodule.(comm.IPvp); ok {
//发起者 red
red := this.moduleFriend.ModuleUser.GetUser(req.Uid)
red := this.module.ModuleUser.GetUser(req.Uid)
if red == nil {
code = pb.ErrorCode_UserNofound
this.moduleFriend.Error("未找到红方信息", log.Field{Key: "uid", Value: req.Uid})
this.module.Error("未找到红方信息", log.Field{Key: "uid", Value: req.Uid})
return
}
blue := this.moduleFriend.ModuleUser.GetUser(session.GetUserId())
blue := this.module.ModuleUser.GetUser(session.GetUserId())
if blue == nil {
code = pb.ErrorCode_UserNofound
this.moduleFriend.Error("未找到蓝方信息", log.Field{Key: "uid", Value: session.GetUserId()})
this.module.Error("未找到蓝方信息", log.Field{Key: "uid", Value: session.GetUserId()})
return
}
matchId, c := ipvp.CreatePvp(
@ -55,12 +55,12 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
pb.PvpType_friends,
)
if c != pb.ErrorCode_Success {
this.moduleFriend.Debug("createPvp code:", log.Field{Key: "code", Value: c})
this.module.Debug("createPvp code:", log.Field{Key: "code", Value: c})
return
}
//更新状态
this.moduleFriend.ModelFriendQiecuo.updateQiecuoRecord(req.Uid, session.GetUserId(), matchId)
this.module.ModelFriendQiecuo.updateQiecuoRecord(req.Uid, session.GetUserId(), matchId)
}
}
@ -68,12 +68,12 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
resp := &pb.FriendAcceptResp{
IsSucc: true,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAccept, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAccept, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}
this.moduleFriend.SendMsgToUser(string(this.moduleFriend.GetType()), "qiecuonotify",
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid)
return

View File

@ -12,7 +12,7 @@ import (
func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendAddBlackReq) (code pb.ErrorCode) {
if req.FriendId == "" {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("加入黑名单参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("加入黑名单参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -30,13 +30,13 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
)
uid := session.GetUserId()
self = this.moduleFriend.modelFriend.GetFriend(uid)
self = this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
target = this.moduleFriend.modelFriend.GetFriend(req.FriendId)
target = this.module.modelFriend.GetFriend(req.FriendId)
if target == nil {
code = pb.ErrorCode_FriendTargetNoData
return
@ -61,7 +61,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
}
// 判断是否黑名单人数已满
if len(self.BlackIds) >= int(this.moduleFriend.globalConf.FriendBlack) {
if len(self.BlackIds) >= int(this.module.globalConf.FriendBlack) {
code = pb.ErrorCode_FriendBlackMax
return
}
@ -73,13 +73,13 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
friendIds := utils.Deletex(self.FriendIds, req.FriendId)
//更新
err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{
err = this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"blackIds": self.BlackIds,
"friendIds": friendIds,
})
if err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("加入黑名单",
this.module.Error("加入黑名单",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "目标人", Value: req.FriendId},
log.Field{Key: "err", Value: err.Error()},
@ -91,7 +91,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
FriendId: req.FriendId,
UserId: session.GetUserId(),
}
if err = session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAddBlack, Resp); err != nil {
if err = session.SendMsg(string(this.module.GetType()), FriendSubTypeAddBlack, Resp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -12,7 +12,7 @@ import (
func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeReq) (code pb.ErrorCode) {
if len(req.FriendIds) == 0 {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("好友审批同意参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("好友审批同意参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
@ -30,7 +30,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
)
uid := session.GetUserId()
//获取玩家自己好友数据
self = this.moduleFriend.modelFriend.GetFriend(uid)
self = this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -40,7 +40,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
agreeIds := []string{}
for _, friendId := range req.FriendIds {
// 验证friendId是否有效
user := this.moduleFriend.ModuleUser.GetUser(friendId)
user := this.module.ModuleUser.GetUser(friendId)
if user == nil {
continue
}
@ -59,12 +59,12 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
},
}
this.moduleFriend.Debug("设置的助战英雄推送给好友",
this.module.Debug("设置的助战英雄推送给好友",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "heroObjId", Value: heroObjId},
)
if err := this.moduleFriend.SendMsgToUsers(string(this.moduleFriend.GetType()), "assistheroupdate", push, friendId); err != nil {
this.moduleFriend.Error("推送助战英雄列表",
if err := this.module.SendMsgToUsers(string(this.module.GetType()), "assistheroupdate", push, friendId); err != nil {
this.module.Error("推送助战英雄列表",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
@ -84,7 +84,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
}
//双向添加:将自己加入到申请人的好友列表中
target = this.moduleFriend.modelFriend.GetFriend(userId)
target = this.module.modelFriend.GetFriend(userId)
if target == nil {
code = pb.ErrorCode_FriendTargetNoData
return
@ -96,11 +96,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
}
target.FriendIds = append(target.FriendIds, self.Uid)
}
if err = this.moduleFriend.modelFriend.Change(target.Uid, map[string]interface{}{
if err = this.module.modelFriend.Change(target.Uid, map[string]interface{}{
"friendIds": target.FriendIds,
}); err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("好友审批同意",
this.module.Error("好友审批同意",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.FriendIds},
log.Field{Key: "err", Value: err.Error()},
@ -123,7 +123,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
if optNum > 0 {
//更新
err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{
err = this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"applyIds": self.ApplyIds,
"friendIds": self.FriendIds,
})
@ -135,11 +135,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
// 拥有xx个好友
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds)))
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype10, int32(len(agreeIds))))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype10, int32(len(agreeIds))))
resp := &pb.FriendAgreeResp{
Num: optNum,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAgree, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAgree, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -12,7 +12,7 @@ import (
func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode) {
if req.FriendId == "" {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("好友申请参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("好友申请参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -37,13 +37,13 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
}
//获取玩家自己好友数据
self = this.moduleFriend.modelFriend.GetFriend(uid)
self = this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
globalConf := this.moduleFriend.globalConf
globalConf := this.module.globalConf
//判断是否超过最大好友数量
if len(self.FriendIds) >= int(globalConf.FriendMaxnum) {
code = pb.ErrorCode_FriendSelfMax
@ -57,7 +57,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
}
//获取好友数据
target = this.moduleFriend.modelFriend.GetFriend(req.FriendId)
target = this.module.modelFriend.GetFriend(req.FriendId)
if target == nil {
code = pb.ErrorCode_FriendTargetNoData
return
@ -93,11 +93,11 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
}
target.ApplyIds = append(target.ApplyIds, session.GetUserId())
if err = this.moduleFriend.modelFriend.Change(req.FriendId, map[string]interface{}{
if err = this.module.modelFriend.Change(req.FriendId, map[string]interface{}{
"applyIds": target.ApplyIds,
}); err != nil {
code = pb.ErrorCode_FriendApplyError
this.moduleFriend.Error("好友申请",
this.module.Error("好友申请",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.FriendId},
log.Field{Key: "err", Value: err.Error()},
@ -110,7 +110,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
FriendId: req.FriendId,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeApply, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeApply, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -17,7 +17,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
list []*pb.FriendBase
)
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -34,7 +34,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
List: list,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeApplyList, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeApplyList, resp); err != nil {
code = pb.ErrorCode_SystemError
}

View File

@ -12,7 +12,7 @@ import (
func (this *apiComp) AssistheroCheck(session comm.IUserSession, req *pb.FriendAssistheroReq) (code pb.ErrorCode) {
if req.HeroObjId == "" {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("设置助战英雄参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("设置助战英雄参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -23,10 +23,10 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
}
uid := session.GetUserId()
// 获取英雄
hero, err := this.moduleFriend.ModuleHero.QueryCrossHeroinfo(req.HeroObjId)
hero, err := this.module.ModuleHero.QueryCrossHeroinfo(req.HeroObjId)
if err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("查询英雄数据 QueryCrossHeroinfo",
this.module.Error("查询英雄数据 QueryCrossHeroinfo",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.HeroObjId},
log.Field{Key: "err", Value: err.Error()},
@ -40,7 +40,7 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
}
//获取玩家自己好友数据
self := this.moduleFriend.modelFriend.GetFriend(uid)
self := this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -56,9 +56,9 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
update["received"] = 1 //设置可领取状态
}
if err := this.moduleFriend.modelFriend.Change(self.Uid, update); err != nil {
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
code = pb.ErrorCode_FriendApplyError
this.moduleFriend.Error("设置助战英雄",
this.module.Error("设置助战英雄",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.HeroObjId},
log.Field{Key: "err", Value: err.Error()},
@ -67,7 +67,7 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
}
rsp := &pb.FriendAssistheroResp{HeroObjId: req.HeroObjId, Received: received}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAssistHero, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistHero, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}
@ -82,13 +82,13 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
},
}
this.moduleFriend.Debug("设置的助战英雄推送给好友",
this.module.Debug("设置的助战英雄推送给好友",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "friendIds", Value: self.FriendIds},
log.Field{Key: "heroObjId", Value: req.HeroObjId},
)
if err := this.moduleFriend.SendMsgToUsers(string(this.moduleFriend.GetType()), "assistheroupdate", push, self.FriendIds...); err != nil {
this.moduleFriend.Error("推送助战英雄列表",
if err := this.module.SendMsgToUsers(string(this.module.GetType()), "assistheroupdate", push, self.FriendIds...); err != nil {
this.module.Error("推送助战英雄列表",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "friends", Value: self.FriendIds},
log.Field{Key: "err", Value: err.Error()},
@ -98,6 +98,6 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
// 随机任务Rtype13
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1)
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype13, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype13, 1))
return
}

View File

@ -14,7 +14,7 @@ func (this *apiComp) AssistHeroListCheck(session comm.IUserSession, req *pb.Frie
func (this *apiComp) AssistHeroList(session comm.IUserSession, req *pb.FriendAssistHeroListReq) (code pb.ErrorCode, data *pb.ErrorData) {
//获取玩家自己好友数据
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self := this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -22,7 +22,7 @@ func (this *apiComp) AssistHeroList(session comm.IUserSession, req *pb.FriendAss
rsp := &pb.FriendAssistHeroListResp{}
for _, v := range self.FriendIds {
f := this.moduleFriend.modelFriend.GetFriend(v)
f := this.module.modelFriend.GetFriend(v)
rsp.Friends = append(rsp.Friends, &pb.FriendBase{
UserId: v,
@ -30,7 +30,7 @@ func (this *apiComp) AssistHeroList(session comm.IUserSession, req *pb.FriendAss
})
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAssistHeroList, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistHeroList, rsp); err != nil {
code = pb.ErrorCode_SystemError
}

View File

@ -16,7 +16,7 @@ func (this *apiComp) AssistlistCheck(session comm.IUserSession, req *pb.FriendAs
func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistlistReq) (code pb.ErrorCode, data *pb.ErrorData) {
var list []*pb.FriendBase
//获取玩家自己好友数据
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self := this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -26,7 +26,7 @@ func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistl
base := this.setDefaultFriendUserBaseInfo(uid)
if base != nil {
// 获取好友信息
target := this.moduleFriend.modelFriend.GetFriend(uid)
target := this.module.modelFriend.GetFriend(uid)
if target == nil {
continue
}
@ -64,7 +64,7 @@ func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistl
HeroObjId: self.AssistHeroId,
Record: self.Record,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeAssistlist, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeAssistlist, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -16,7 +16,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
list []*pb.FriendBase
)
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -33,7 +33,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
Friends: list,
}
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeBlacklist, resp)
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeBlacklist, resp)
if err != nil {
code = pb.ErrorCode_SystemError
return

View File

@ -11,7 +11,7 @@ import (
func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (code pb.ErrorCode) {
if req.FriendId == "" {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("删除好友参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("删除好友参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -22,7 +22,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
}
uid := session.GetUserId()
self := this.moduleFriend.modelFriend.GetFriend(uid)
self := this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -31,10 +31,10 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
// 从好友列表中删除
selfFriendIds := utils.Deletex(self.FriendIds, req.FriendId)
if err := this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{
if err := this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"friendIds": selfFriendIds,
}); err != nil {
this.moduleFriend.Error("删除好友",
this.module.Error("删除好友",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.String()},
log.Field{Key: "err", Value: err.Error()},
@ -43,7 +43,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
return
}
target := this.moduleFriend.modelFriend.GetFriend(req.FriendId)
target := this.module.modelFriend.GetFriend(req.FriendId)
if target == nil {
code = pb.ErrorCode_FriendNotSelf
return
@ -52,11 +52,11 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
// 将自己从对方好友列表中移除
targetFriendIds := utils.DeleteString(target.FriendIds, uid)
if err := this.moduleFriend.modelFriend.Change(req.FriendId, map[string]interface{}{
if err := this.module.modelFriend.Change(req.FriendId, map[string]interface{}{
"friendIds": targetFriendIds,
}); err != nil {
code = pb.ErrorCode_FriendApplyError
this.moduleFriend.Error("删除好友",
this.module.Error("删除好友",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.FriendId},
log.Field{Key: "err", Value: err.Error()},
@ -64,7 +64,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
return
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeDel, &pb.FriendDelResp{FriendId: req.FriendId, UserId: self.Uid}); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeDel, &pb.FriendDelResp{FriendId: req.FriendId, UserId: self.Uid}); err != nil {
code = pb.ErrorCode_SystemError
}

View File

@ -11,7 +11,7 @@ import (
func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelBlackReq) (code pb.ErrorCode) {
if req.FriendId == "" {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -25,7 +25,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
self *pb.DBFriend
)
uid := session.GetUserId()
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -34,11 +34,11 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
//从黑名单列表中删除目标
self.BlackIds = utils.DeleteString(self.BlackIds, req.FriendId)
//更新黑名单
if err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{
if err = this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"blackIds": self.BlackIds,
}); err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("删除黑名单",
this.module.Error("删除黑名单",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
@ -50,7 +50,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
UserId: session.GetUserId(),
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeDelBlack, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeDelBlack, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -11,7 +11,7 @@ import (
func (this *apiComp) GetRelationCheck(session comm.IUserSession, req *pb.FriendGetRelationReq) (code pb.ErrorCode) {
if req.TargetUid == "" {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -21,13 +21,13 @@ func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRel
return
}
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self := this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
target := this.moduleFriend.modelFriend.GetFriend(req.TargetUid)
target := this.module.modelFriend.GetFriend(req.TargetUid)
if target == nil {
code = pb.ErrorCode_FriendTargetNoData
return
@ -48,7 +48,7 @@ func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRel
TargetUid: req.TargetUid,
Status: status,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeRelation, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRelation, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -14,7 +14,7 @@ func (this *apiComp) GetrewardCheck(session comm.IUserSession, req *pb.FriendGet
func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewardReq) (code pb.ErrorCode, data *pb.ErrorData) {
uid := session.GetUserId()
//获取玩家自己好友数据
self := this.moduleFriend.modelFriend.GetFriend(uid)
self := this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -29,18 +29,18 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
update := map[string]interface{}{
"received": received,
}
if err := this.moduleFriend.modelFriend.Change(self.Uid, update); err != nil {
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
code = pb.ErrorCode_FriendApplyError
this.moduleFriend.Error("领奖",
this.module.Error("领奖",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
return
}
globalConf := this.moduleFriend.ModuleTools.GetGlobalConf()
if code = this.moduleFriend.DispenseRes(session, globalConf.FriendPeize, true); code != pb.ErrorCode_Success {
this.moduleFriend.Error("好友领奖励",
globalConf := this.module.ModuleTools.GetGlobalConf()
if code = this.module.DispenseRes(session, globalConf.FriendPeize, true); code != pb.ErrorCode_Success {
this.module.Error("好友领奖励",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "reward", Value: globalConf.FriendPeize},
log.Field{Key: "code", Value: code},
@ -50,7 +50,7 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
rsp := &pb.FriendGetrewardResp{Received: int32(received)}
if err := session.SendMsg(string(this.moduleFriend.GetType()), "getreward", rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), "getreward", rsp); err != nil {
code = pb.ErrorCode_SystemError
}

View File

@ -18,7 +18,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod
list []*pb.FriendBase
)
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -33,12 +33,12 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod
}
// 判断用户在线状态
if this.moduleFriend.ModuleUser.IsOnline(userId) {
if this.module.ModuleUser.IsOnline(userId) {
base.OfflineTime = -1 //在线
}
// 判断是否已点赞
target := this.moduleFriend.modelFriend.GetFriend(userId)
target := this.module.modelFriend.GetFriend(userId)
if target == nil {
continue
}
@ -58,7 +58,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod
resp := &pb.FriendListResp{
List: list,
}
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeList, resp)
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeList, resp)
if err != nil {
code = pb.ErrorCode_SystemError
return

View File

@ -20,13 +20,13 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq)
}
//目标是否在线
if !this.moduleFriend.ModuleUser.IsOnline(req.TargetUid) {
if !this.module.ModuleUser.IsOnline(req.TargetUid) {
code = pb.ErrorCode_UserOffline
return
}
//切磋请求处理
if err := this.moduleFriend.ModelFriendQiecuo.qiecuoReq(session.GetUserId(), req.TargetUid); err != nil {
if err := this.module.ModelFriendQiecuo.qiecuoReq(session.GetUserId(), req.TargetUid); err != nil {
var customErr = new(comm.CustomError)
if errors.As(err, &customErr) {
code = customErr.Code
@ -40,11 +40,11 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq)
TargetUid: req.TargetUid,
Uid: session.GetUserId(),
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeQiecuo, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeQiecuo, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}
this.moduleFriend.SendMsgToUser(string(this.moduleFriend.GetType()), "qiecuonotify",
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 1}, req.TargetUid)
return

View File

@ -16,14 +16,14 @@ func (this *apiComp) RandlistCheck(session comm.IUserSession, req *pb.FriendRand
func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistReq) (code pb.ErrorCode, data *pb.ErrorData) {
// 当前玩家好友数据
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self := this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
//在线玩家列表
cuList, err := this.moduleFriend.ModuleUser.UserOnlineList()
cuList, err := this.module.ModuleUser.UserOnlineList()
if err != nil {
code = pb.ErrorCode_DBError
return
@ -43,7 +43,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
}
//检查目标v中的申请列表中是否有自己
target := this.moduleFriend.modelFriend.GetFriend(v.Uid)
target := this.module.modelFriend.GetFriend(v.Uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -76,16 +76,16 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
var userList []*pb.FriendBase
for _, uid := range randOnlineUsers {
target := this.moduleFriend.modelFriend.GetFriend(uid)
target := this.module.modelFriend.GetFriend(uid)
if target == nil {
this.moduleFriend.Debug("未找到好友",
this.module.Debug("未找到好友",
log.Field{Key: "uid", Value: uid})
continue
}
base := this.setDefaultFriendUserBaseInfo(uid)
if base == nil {
this.moduleFriend.Debug("未找到玩家信息",
this.module.Debug("未找到玩家信息",
log.Field{Key: "uid", Value: uid})
continue
}
@ -102,7 +102,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
rsp := &pb.FriendRandlistResp{
List: userList,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeRandList, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRandList, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -11,7 +11,7 @@ import (
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuseReq) (code pb.ErrorCode) {
if len(req.FriendIds) == 0 {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
@ -30,7 +30,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
)
//获取玩家自己好友数据
self = this.moduleFriend.modelFriend.GetFriend(uid)
self = this.module.modelFriend.GetFriend(uid)
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -51,11 +51,11 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
}
//更新
if optNum > 0 {
if err := this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{
if err := this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"applyIds": self.ApplyIds,
}); err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("好友审批拒绝",
this.module.Error("好友审批拒绝",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req},
log.Field{Key: "err", Value: err.Error()},
@ -68,7 +68,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
Num: optNum,
}
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeRefuse, resp)
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRefuse, resp)
if err != nil {
code = pb.ErrorCode_SystemError
return

View File

@ -11,7 +11,7 @@ import (
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (code pb.ErrorCode) {
if req.NickName == "" {
code = pb.ErrorCode_FriendSearchNameEmpty
this.moduleFriend.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
return
}
return
@ -25,10 +25,10 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
uid := session.GetUserId()
resp := &pb.FriendSearchResp{}
users, err := this.moduleFriend.ModuleUser.SearchRmoteUser(req.NickName)
users, err := this.module.ModuleUser.SearchRmoteUser(req.NickName)
if err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("搜索玩家",
this.module.Error("搜索玩家",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "params", Value: req.NickName},
log.Field{Key: "err", Value: err.Error()},
@ -49,7 +49,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
ServerId: u.Sid,
}
target := this.moduleFriend.modelFriend.GetFriend(u.Uid)
target := this.module.modelFriend.GetFriend(u.Uid)
if target == nil {
continue
}
@ -60,7 +60,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
resp.Friends = append(resp.Friends, base)
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeSearch, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeSearch, resp); err != nil {
code = pb.ErrorCode_SystemError
}

View File

@ -16,16 +16,16 @@ func (this *apiComp) Stop(session comm.IUserSession, req *pb.FriendStopReq) (cod
}
//清楚切磋请求记录
this.moduleFriend.ModelFriendQiecuo.DelByUId(req.Uid)
this.module.ModelFriendQiecuo.DelByUId(req.Uid)
resp := &pb.FriendStopResp{
IsSucc: true,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), "stop", resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), "stop", resp); err != nil {
code = pb.ErrorCode_SystemError
return
}
this.moduleFriend.SendMsgToUser(string(this.moduleFriend.GetType()), "qiecuonotify",
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 3}, req.Uid)
return
}

View File

@ -11,7 +11,7 @@ import (
func (this *apiComp) ZanCheck(session comm.IUserSession, req *pb.FriendZanReq) (code pb.ErrorCode) {
if len(req.FriendIds) == 0 {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -43,7 +43,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
)
// 是否已给好友点赞
for _, v := range req.FriendIds {
target = this.moduleFriend.modelFriend.GetFriend(v)
target = this.module.modelFriend.GetFriend(v)
if target == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -54,12 +54,12 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
target.ZanIds = append(target.ZanIds, selfId)
target.GetZandIds = append(target.GetZandIds, selfId)
//设置被点赞玩家
if err = this.moduleFriend.modelFriend.Change(target.GetUid(), map[string]interface{}{
if err = this.module.modelFriend.Change(target.GetUid(), map[string]interface{}{
"zanIds": target.ZanIds,
"getZandIds": target.GetZandIds,
}); err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Error("点赞",
this.module.Error("点赞",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "err", Value: err.Error()},
)
@ -69,14 +69,14 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
}
//设置友情值
ue, err := this.moduleFriend.ModuleUser.GetUserExpand(session.GetUserId())
ue, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
// 今日送出的友情点是否达到上限
if ue.FriendPointOD >= this.moduleFriend.globalConf.FriendMaxsendnum {
if ue.FriendPointOD >= this.module.globalConf.FriendMaxsendnum {
code = pb.ErrorCode_FriendPointLimit
return
}
@ -84,7 +84,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
update := map[string]interface{}{
"friendPointOD": ue.FriendPointOD + pointTotal,
}
if err := this.moduleFriend.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
if err := this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
return
}
@ -93,13 +93,13 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
Flag: true,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeZan, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeZan, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}
// 赠送X次友情点
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype11, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype11, 1))
return
}

View File

@ -21,7 +21,7 @@ func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq
list []*pb.FriendBase
)
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -37,7 +37,7 @@ func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq
rsp := &pb.FriendZanlistResp{
List: list,
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeZanList, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeZanList, rsp); err != nil {
code = pb.ErrorCode_SystemError
return
}

View File

@ -12,7 +12,7 @@ import (
func (this *apiComp) ZanreceiveCheck(session comm.IUserSession, req *pb.FriendZanreceiveReq) (code pb.ErrorCode) {
if len(req.FriendIds) == 0 {
code = pb.ErrorCode_ReqParameterError
this.moduleFriend.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
this.module.Error("参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()})
}
return
}
@ -27,7 +27,7 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
err error
)
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
self = this.module.modelFriend.GetFriend(session.GetUserId())
if self == nil {
code = pb.ErrorCode_FriendSelfNoData
return
@ -46,7 +46,7 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
}
// 修改获赞Id
if err = this.moduleFriend.modelFriend.Change(self.Uid, map[string]interface{}{
if err = this.module.modelFriend.Change(self.Uid, map[string]interface{}{
"getZandIds": self.GetZandIds,
}); err != nil {
code = pb.ErrorCode_DBError
@ -54,14 +54,14 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
}
//设置自己的友情值
ue, err := this.moduleFriend.ModuleUser.GetUserExpand(session.GetUserId())
ue, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
}
// 今日获赠的友情点是否达到上限
if ue.FriendPointID >= int32(this.moduleFriend.globalConf.FriendMaxgetnum) {
if ue.FriendPointID >= int32(this.module.globalConf.FriendMaxgetnum) {
code = pb.ErrorCode_FriendPointLimit
return
}
@ -70,12 +70,12 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
"friendPoint": ue.FriendPoint + pointTotal,
"friendPointID": ue.FriendPointID + pointTotal,
}
if err := this.moduleFriend.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
if err := this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
return
}
if err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeZanreceive,
if err := session.SendMsg(string(this.module.GetType()), FriendSubTypeZanreceive,
&pb.FriendZanreceiveResp{Flag: true}); err != nil {
code = pb.ErrorCode_SystemError
return

View File

@ -79,6 +79,6 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
Cid: curFood,
FirstGet: bFirst,
})
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype150, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype150, 1))
return
}

View File

@ -99,16 +99,16 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype34, 1, _hero.JuexingLv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype118, _hero.Lv, _hero.JuexingLv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype120, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype122, _hero.JuexingLv, _hero.Star))
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype34, 1, _hero.JuexingLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype118, _hero.Lv, _hero.JuexingLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype120, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype122, _hero.JuexingLv, _hero.Star))
cfg := this.module.configure.GetHeroConfig(_hero.HeroID)
if cfg != nil {
szTask = append(szTask, comm.GettaskParam(comm.Rtype121, 1, cfg.Race))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race))
//xx英雄满级、共鸣、觉醒至最高状态
nextAwaken := this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1)
@ -126,14 +126,14 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
}
}
if this.module.configure.GetHeroTalentMaxLv(_hero.HeroID) == _l {
szTask = append(szTask, comm.GettaskParam(comm.Rtype37, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, _hero.JuexingLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype37, 1, cfg.Color))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype38, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, _hero.JuexingLv))
}
}
}
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
return
}

View File

@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
price []int32 // 购买所需的价钱
totalCost float64 // 购买打折系数
udata *pb.DBUser
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
)
update = make(map[string]interface{})
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
@ -107,21 +107,21 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
//随机任务
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
tasks = append(tasks, comm.GettaskParam(comm.Rtype64, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype64, 1))
for _, v := range give {
if v.A == comm.ItemType {
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype65, v.N, utils.ToInt32(v.T))
tasks = append(tasks, comm.GettaskParam(comm.Rtype65, v.N, utils.ToInt32(v.T)))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype65, v.N, utils.ToInt32(v.T)))
}
}
// for _, v := range need {
// if v.A == comm.AttrType && (v.T == comm.ResGold || v.T == comm.ResDiamond) {
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T))
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
// }
// }
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
session.SendMsg(string(this.module.GetType()), "buy", &pb.HeroBuyResp{
IsSucc: true,
Onebuy: record.Onebuy + req.BuyCount,

View File

@ -86,6 +86,6 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
// 通过融合获得指定英雄
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype139, utils.ToInt32(conf.Hero))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
return
}

View File

@ -116,9 +116,9 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
}
// 推送 世界任务消息
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype53, 1))
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype53, 1))
// 检查是不是满级技能
maxLv := true
@ -130,16 +130,16 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
}
}
if maxLv {
szTask = append(szTask, comm.GettaskParam(comm.Rtype54, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype57, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype174, 1, _hero.Star))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype54, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype57, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype174, 1, _hero.Star))
}
if cfg := this.module.configure.GetHeroConfig(_hero.HeroID); cfg != nil {
szTask = append(szTask, comm.GettaskParam(comm.Rtype55, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype56, 1, 1, cfg.Job))
szTask = append(szTask, comm.GettaskParam(comm.Rtype116, lvUpCount, cfg.Race))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype55, 1, cfg.Color))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype56, 1, 1, cfg.Job))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype116, lvUpCount, cfg.Race))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID)))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID)))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
return
}

View File

@ -83,20 +83,20 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
}
// 推送 世界任务消息
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star))
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star))
if _hero.Star == 4 {
szTask = append(szTask, comm.GettaskParam(comm.Rtype26, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype26, 1))
} else if _hero.Star == 5 {
szTask = append(szTask, comm.GettaskParam(comm.Rtype27, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype27, 1))
} else if _hero.Star == 6 {
szTask = append(szTask, comm.GettaskParam(comm.Rtype28, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype28, 1))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype114, _hero.Star, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype115, 1, _hero.Star))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype114, _hero.Star, utils.ToInt32(_hero.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype115, 1, _hero.Star))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
return
}

View File

@ -135,30 +135,30 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
Telnet: talent,
TalentID: req.TalentID, // 返回刚学习过的天赋ID
})
var szTask []*comm.TaskParam
var szTask []*comm.BuriedParam
// 查询英雄相关信息
if heroObj := this.module.QueryHeroByConfId(session.GetUserId(), talent.HeroId); heroObj != nil {
szTask = append(szTask, comm.GettaskParam(comm.Rtype123, 1, int32(len(talent.Talent)), heroObj.Star))
szTask = append(szTask, comm.GettaskParam(comm.Rtype124, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype125, 1, utils.ToInt32(heroObj.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype123, 1, int32(len(talent.Talent)), heroObj.Star))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype124, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype125, 1, utils.ToInt32(heroObj.HeroID)))
cfg := this.module.configure.GetHeroConfig(heroObj.HeroID)
if cfg != nil {
szTask = append(szTask, comm.GettaskParam(comm.Rtype126, 1, cfg.Race))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype126, 1, cfg.Race))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype127, 1, heroObj.Star))
szTask = append(szTask, comm.GettaskParam(comm.Rtype40, 1, int32(len(talent.Talent))))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype127, 1, heroObj.Star))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype40, 1, int32(len(talent.Talent))))
nextAwaken := this.module.configure.GetHeroAwakenConfig(heroObj.HeroID, heroObj.JuexingLv+1)
if nextAwaken == nil { // 达到满级觉醒
if heroObj.Lv == this.module.configure.GetHeroMaxLv(heroObj.Star) {
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) {
szTask = append(szTask, comm.GettaskParam(comm.Rtype37, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, heroObj.JuexingLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype37, 1, cfg.Color))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype38, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, heroObj.JuexingLv))
}
}
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
}
return

View File

@ -22,13 +22,13 @@ import (
type ModelHero struct {
modules.MCompModel
moduleHero *Hero
module *Hero
}
func (this *ModelHero) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableHero
err = this.MCompModel.Init(service, module, comp, options)
this.moduleHero = module.(*Hero)
this.module = module.(*Hero)
// 通过uid创建索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
@ -38,9 +38,9 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
//初始化英雄
func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId)
heroCfg := this.module.configure.GetHeroConfig(heroCfgId)
if heroCfg == nil {
this.moduleHero.Errorf("%v hero not found from config %v", heroCfgId)
this.module.Errorf("%v hero not found from config %v", heroCfgId)
return nil
}
objId := primitive.NewObjectID().Hex()
@ -69,7 +69,7 @@ func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
//初始化英雄技能
func (this *ModelHero) initHeroSkill(hero *pb.DBHero) []*pb.SkillData {
heroCfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID)
heroCfg := this.module.configure.GetHeroConfig(hero.HeroID)
if heroCfg != nil {
if heroCfg.Skill != 0 {
hero.CaptainSkill = heroCfg.Skill
@ -103,7 +103,7 @@ func (this *ModelHero) createSpecialHero(uid string, heroCfgId string) (hero *pb
hero = this.InitHero(uid, heroCfgId)
if hero != nil {
if err = this.AddList(uid, hero.Id, hero); err != nil {
this.moduleHero.Errorf("%v", err)
this.module.Errorf("%v", err)
return
}
}
@ -127,7 +127,7 @@ func (this *ModelHero) CloneNewHero(uid string, hero *pb.DBHero) (newHero *pb.DB
this.AddList(newHero.Uid, newHero.Id, newHero)
// 星座图属性计算
this.moduleHero.moduleHoroscope.ComputeHeroNumeric(uid, hero)
this.module.moduleHoroscope.ComputeHeroNumeric(uid, hero)
return
}
@ -139,17 +139,17 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
hero = this.InitHero(uid, heroCfgId)
if hero != nil {
hero.SameCount = 1 // 新需求 不需要判断叠加
if this.moduleHero.IsCross() {
if model, err = this.moduleHero.GetDBModelByUid(uid, this.TableName); err != nil {
this.moduleHero.Errorln(err)
if this.module.IsCross() {
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err != nil {
this.module.Errorln(err)
} else {
if err = model.AddList(uid, hero.Id, hero); err != nil {
this.moduleHero.Errorf("err:%v", err)
this.module.Errorf("err:%v", err)
}
}
} else {
if err = this.AddList(uid, hero.Id, hero); err != nil {
this.moduleHero.Errorln(err)
this.module.Errorln(err)
}
}
}
@ -185,7 +185,7 @@ func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero, count int32)
hero.SameCount -= count // 数量-1
if hero.SameCount == 0 {
if err := this.DelListlds(uid, []string{hero.Id}); err != nil {
this.moduleHero.Errorf("%v", err)
this.module.Errorf("%v", err)
}
} else {
update := map[string]interface{}{
@ -193,7 +193,7 @@ func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero, count int32)
}
err = this.ChangeList(uid, hero.Id, update)
}
this.moduleHero.Debugf("删除%d张卡牌uid:%s,卡牌ID:%s", count, uid, hero.Id)
this.module.Debugf("删除%d张卡牌uid:%s,卡牌ID:%s", count, uid, hero.Id)
return
}
@ -211,7 +211,7 @@ func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) {
hero.JuexProperty = make(map[string]int32)
for i := 1; i <= int(hero.JuexingLv); i++ {
awakenData := this.moduleHero.configure.GetHeroAwakenConfig(hero.HeroID, int32(i))
awakenData := this.module.configure.GetHeroAwakenConfig(hero.HeroID, int32(i))
if awakenData != nil {
if len(awakenData.Phasebonus) != 2 {
continue
@ -237,7 +237,7 @@ func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) {
case comm.ResonanceDefPro:
hero.JuexProperty[comm.Def] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Def])))
default:
this.moduleHero.Errorf("unkonw Resonance property:%s", key)
this.module.Errorf("unkonw Resonance property:%s", key)
}
}
}
@ -289,8 +289,8 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
}
if hero.SuiteId != 0 { //套装
if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteId); err != nil {
this.moduleHero.Errorln(err)
if configure, err := this.module.configure.GetEquipsuit(hero.SuiteId); err != nil {
this.module.Errorln(err)
} else {
for k, v := range configure.SetBonuses {
addProperty[k] += v
@ -298,8 +298,8 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
}
}
if hero.SuiteExtId != 0 { //套装
if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteExtId); err != nil {
this.moduleHero.Errorln(err)
if configure, err := this.module.configure.GetEquipsuit(hero.SuiteExtId); err != nil {
this.module.Errorln(err)
} else {
for k, v := range configure.SetBonuses {
addProperty[k] += v
@ -366,7 +366,7 @@ func (this *ModelHero) setEquipment(uid string, hero *pb.DBHero) (newHero *pb.DB
update["suite2Lv"] = suite2Lv
if err = this.ChangeList(hero.Uid, hero.Id, update); err != nil {
this.moduleHero.Errorf("%v", err)
this.module.Errorf("%v", err)
return
}
return
@ -383,7 +383,7 @@ func (this *ModelHero) mergeMainProperty(uid string, hero *pb.DBHero, data map[s
if err = this.ChangeList(uid, hero.Id, map[string]interface{}{
"property": hero.Property,
}); err != nil {
this.moduleHero.Errorf("mergeMainProperty err %v", err)
this.module.Errorf("mergeMainProperty err %v", err)
}
return
}
@ -396,14 +396,14 @@ func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[st
"addProperty": data,
"equipSkill": skills,
}); err != nil {
this.moduleHero.Errorf("mergeAddProperty err %v", err)
this.module.Errorf("mergeAddProperty err %v", err)
}
}
func (this *ModelHero) StarAtkAddition(star int32) (addValue float32) {
for i := 1; i <= int(star); i++ {
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
starCfg := this.module.configure.GetHeroStar(int32(i))
cfg := this.module.configure.GetHeroLv(starCfg.Level)
addValue += cfg.Atk * starCfg.StarupAtk / 1000.0
}
return addValue
@ -411,8 +411,8 @@ func (this *ModelHero) StarAtkAddition(star int32) (addValue float32) {
func (this *ModelHero) StarDefAddition(star int32) (addValue float32) {
for i := 1; i <= int(star); i++ {
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
starCfg := this.module.configure.GetHeroStar(int32(i))
cfg := this.module.configure.GetHeroLv(starCfg.Level)
addValue += cfg.Def * starCfg.StarupDef / 1000.0
}
return addValue
@ -420,8 +420,8 @@ func (this *ModelHero) StarDefAddition(star int32) (addValue float32) {
func (this *ModelHero) StarHpAddition(star int32) (addValue float32) {
for i := 1; i <= int(star); i++ {
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
starCfg := this.module.configure.GetHeroStar(int32(i))
cfg := this.module.configure.GetHeroLv(starCfg.Level)
//this.moduleHero.Debugf("cfg.Atk= %f,starCfg.StarupHp = %f,addValue= %f", cfg.Atk, starCfg.StarupHp, addValue)
addValue += cfg.Hp * starCfg.StarupHp / 1000.0
@ -432,13 +432,13 @@ func (this *ModelHero) StarHpAddition(star int32) (addValue float32) {
//属性计算 基础属性
//英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
growCfg := this.moduleHero.configure.GetHeroLvgrow(hero.HeroID)
heroCfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID)
lvCfg := this.moduleHero.configure.GetHeroLv(hero.Lv)
starCfg := this.moduleHero.configure.GetHeroStar(hero.Star)
starLvfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
growCfg := this.module.configure.GetHeroLvgrow(hero.HeroID)
heroCfg := this.module.configure.GetHeroConfig(hero.HeroID)
lvCfg := this.module.configure.GetHeroLv(hero.Lv)
starCfg := this.module.configure.GetHeroStar(hero.Star)
starLvfg := this.module.configure.GetHeroLv(starCfg.Level)
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
this.moduleHero.Debugf("hero PropertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star)
this.module.Debugf("hero PropertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star)
return
}
@ -466,7 +466,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
if hero.Id != "" { // objID 为空表示是怪物对象 不享受天赋属性加成
this.resetTalentProperty(hero)
this.moduleHero.moduleHoroscope.ComputeHeroNumeric(hero.Uid, hero)
this.module.moduleHoroscope.ComputeHeroNumeric(hero.Uid, hero)
}
this.resetJuexingProperty(hero)
}
@ -482,7 +482,7 @@ func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DB
}
if err = this.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
this.moduleHero.Errorf("ChangeHeroProperty err:%v", err)
this.module.Errorf("ChangeHeroProperty err:%v", err)
return
}
@ -490,10 +490,10 @@ func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DB
}
func (this *ModelHero) cleanData(uid string) {
userList := this.moduleHero.GetHeroList(uid)
userList := this.module.GetHeroList(uid)
for _, v := range userList {
if err := this.DelListlds(uid, []string{v.Id}); err != nil {
this.moduleHero.Errorf("cleanData err:%v", err)
this.module.Errorf("cleanData err:%v", err)
}
}
}
@ -514,15 +514,15 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
curLv = hero.Lv
preLv = curLv
var maxLv int32 // 校验等级达到上限
maxLv = this.moduleHero.configure.GetHeroMaxLv(hero.Star)
_data := this.moduleHero.configure.GetHeroLv(curLv)
maxLv = this.module.configure.GetHeroMaxLv(hero.Star)
_data := this.module.configure.GetHeroLv(curLv)
if _data != nil {
var maxExp int32
maxExp = _data.Heroexp
if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级
curAddExp = 0 // 已经满级的时候
//code = pb.ErrorCode_HeroMaxLv //
this.moduleHero.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp)
this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp)
return
}
curExp += exp // 先把经验加上
@ -544,7 +544,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
} else { // 升级操作
curExp -= maxExp
curLv += 1 // 经验够了 那么等级+1
_data = this.moduleHero.configure.GetHeroLv(curLv)
_data = this.module.configure.GetHeroLv(curLv)
if _data == nil { // 等级加失败了 回到原来的等级
curLv -= 1
break
@ -556,7 +556,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
curAddExp = exp // 真正加的经验
}
this.moduleHero.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp)
this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp)
update["lv"] = curLv
update["exp"] = curExp
@ -571,34 +571,34 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
}
if model != nil {
if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
this.moduleHero.Errorf("add hero exp failed ChangeList %v", err)
this.module.Errorf("add hero exp failed ChangeList %v", err)
code = pb.ErrorCode_DBError
}
} else {
if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
this.moduleHero.Errorf("add hero exp failed ChangeList %v", err)
this.module.Errorf("add hero exp failed ChangeList %v", err)
code = pb.ErrorCode_DBError
}
}
if curLv-preLv > 0 { // 升级了 统计任务
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype113, curLv-preLv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype23, 1, hero.Star, hero.Lv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype24, 1))
// szTask = append(szTask, comm.GettaskParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, curLv-preLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype23, 1, hero.Star, hero.Lv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype24, 1))
// szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
if cfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID); cfg != nil {
szTask = append(szTask, comm.GettaskParam(comm.Rtype32, 1, cfg.Color, hero.Lv))
if cfg := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil {
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype32, 1, cfg.Color, hero.Lv))
//xx英雄满级、共鸣、觉醒至最高状态
nextAwaken := this.moduleHero.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
nextAwaken := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1)
if nextAwaken == nil { // 达到满级觉醒
if hero.Lv == this.moduleHero.configure.GetHeroMaxLv(hero.Star) {
if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) {
var _l int32
talent, err := this.moduleHero.modelTalent.GetHerotalent(session.GetUserId())
talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId())
if err == nil {
for _, v := range talent {
if v.HeroId == hero.HeroID {
@ -607,21 +607,21 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
}
}
}
if this.moduleHero.configure.GetHeroTalentMaxLv(hero.HeroID) == _l {
szTask = append(szTask, comm.GettaskParam(comm.Rtype37, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, hero.JuexingLv))
if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l {
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype37, 1, cfg.Color))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype38, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, hero.JuexingLv))
}
}
}
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype111, 1, hero.Lv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype112, 1, hero.Lv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype113, hero.Lv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype33, 1, 1, hero.Lv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype118, hero.Lv, hero.JuexingLv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype111, 1, hero.Lv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, hero.Lv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype33, 1, 1, hero.Lv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype118, hero.Lv, hero.JuexingLv))
go this.moduleHero.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
//this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype33, 1, 1, hero.Lv)
}
}
@ -698,9 +698,9 @@ func (this *ModelHero) GetRandHeroIdBypool(sz []int32) int32 {
// 初始化怪物属性
func (this *ModelHero) InitMonsterHero(heroCfgId string, star, lv int32) *pb.DBHero {
heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId)
heroCfg := this.module.configure.GetHeroConfig(heroCfgId)
if heroCfg == nil {
this.moduleHero.Errorf("%v hero not found from config %v", heroCfgId)
this.module.Errorf("%v hero not found from config %v", heroCfgId)
return nil
}
@ -780,7 +780,7 @@ func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTale
_heroMap["talentProperty"] = hero.TalentProperty
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
this.moduleHero.Errorf("mergeenegryProperty err %v", err)
this.module.Errorf("mergeenegryProperty err %v", err)
}
}
@ -793,7 +793,7 @@ func (this *ModelHero) cleanTalentProperty(hero *pb.DBHero) {
_heroMap := make(map[string]interface{}, 0)
_heroMap["talentProperty"] = hero.TalentProperty
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
this.moduleHero.Errorf("mergeenegryProperty err %v", err)
this.module.Errorf("mergeenegryProperty err %v", err)
}
}
@ -805,11 +805,11 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) {
if hero == nil {
return
}
if rst, err := this.moduleHero.modelTalent.GetHerotalent(hero.Uid); err != nil {
if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err != nil {
for _, v := range rst {
if v.HeroId == hero.HeroID { // 找到对应的英雄
for k := range v.Talent {
if conf := this.moduleHero.configure.GetHeroTalent(k); conf != nil { //获取天赋树
if conf := this.module.configure.GetHeroTalent(k); conf != nil { //获取天赋树
if conf.Hp != -1 {
attr[0] += conf.Hp
}
@ -857,25 +857,25 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) {
func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, count int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, err error) {
heros := make([]*pb.DBHero, 0)
uid := session.GetUserId()
heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId)
heroCfg := this.module.configure.GetHeroConfig(heroCfgId)
if heroCfg == nil {
err = errors.New("not found hero configID")
this.moduleHero.Errorf("not found hero configID:%s", heroCfgId)
this.module.Errorf("not found hero configID:%s", heroCfgId)
return
}
if this.moduleHero.IsCross() {
if dbModel, err1 := this.moduleHero.GetDBModelByUid(uid, this.TableName); err1 == nil {
if this.module.IsCross() {
if dbModel, err1 := this.module.GetDBModelByUid(uid, this.TableName); err1 == nil {
if err = dbModel.GetList(uid, &heros); err != nil {
this.moduleHero.Errorf("err:%v", err)
this.module.Errorf("err:%v", err)
return
}
} else {
this.moduleHero.Errorln(err) // 获取跨服对象失败
this.module.Errorln(err) // 获取跨服对象失败
return
}
} else {
if err = this.GetList(uid, &heros); err != nil {
this.moduleHero.Errorf("err:%v", err)
this.module.Errorf("err:%v", err)
}
}
bFirst = true
@ -912,7 +912,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
// 如果技能是满级 则转成其他道具
if this.checkHeroAllSkillMax(hero) {
list := this.moduleHero.ModuleTools.GetGlobalConf().Moonshopmoney
list := this.module.ModuleTools.GetGlobalConf().Moonshopmoney
if list != nil {
for pos, v := range list {
@ -945,7 +945,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
}
// expitem 获得
if rst, err := this.moduleHero.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
_mp := rst.Expitem
bAdd := false
if heroCfg.Expitemnum > 0 {
@ -960,7 +960,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
}
}
if bAdd {
this.moduleHero.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"expitem": _mp,
})
for i := 0; i < int(count); i++ {
@ -976,7 +976,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
}
}
if len(res) > 0 { // 资源统一发放
this.moduleHero.DispenseRes(session, res, true)
this.module.DispenseRes(session, res, true)
}
}
return
@ -985,7 +985,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
// 校验当前技能是否是满级
func (this *ModelHero) checkHeroAllSkillMax(hero *pb.DBHero) bool {
for _, v := range hero.NormalSkill {
if this.moduleHero.configure.GetHeroSkillMaxLvConfig(uint32(v.SkillID)) > v.SkillLv {
if this.module.configure.GetHeroSkillMaxLvConfig(uint32(v.SkillID)) > v.SkillLv {
return false
}
}
@ -1016,7 +1016,7 @@ func (this *ModelHero) SetHeroFetterProperty(hero *pb.DBHero, attr []*cfg.Gameat
case comm.DefPro:
hero.Fetters[comm.Def] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Def])))
default:
this.moduleHero.Errorf("unkonw hero fetter property:%v", key)
this.module.Errorf("unkonw hero fetter property:%v", key)
}
}
}

View File

@ -96,11 +96,11 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
// 查品质
cfg := this.configure.GetHeroConfig(heroCfgId)
if cfg != nil {
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype30, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype31, 1, cfg.Color))
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype30, 1, cfg.Color))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype31, 1, cfg.Color))
go this.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
}
return
@ -167,14 +167,14 @@ func (this *Hero) SendRdTask(session comm.IUserSession) {
equipmap[v.SuiteExtId][v.Suite2Star]++
}
}
var szTask []*comm.TaskParam
var szTask []*comm.BuriedParam
for k, v := range equipmap {
for k1, v1 := range v {
szTask = append(szTask, comm.GettaskParam(comm.Rtype46, v1, k1, k))
//this.ModuleRtask.SendToRtask(session, comm.Rtype46, v1, k1, k)
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype46, v1, k1, k))
//this.ModuleBuried.SendToRtask(session, comm.Rtype46, v1, k1, k)
}
}
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
}
// 英雄列表
@ -423,7 +423,7 @@ func (this *Hero) QueryCrossHeroinfo(oid string) (hero *pb.DBHero, err error) {
})
hero = &pb.DBHero{}
if err = sr.Decode(hero); err != nil {
this.modelHero.moduleHero.Errorf("find hero error: %v", err)
this.modelHero.module.Errorf("find hero error: %v", err)
}
return
}
@ -433,7 +433,7 @@ func (this *Hero) QueryCrossHeroinfo(oid string) (hero *pb.DBHero, err error) {
}); res == nil {
hero = &pb.DBHero{}
if err = res.Decode(hero); err != nil {
this.modelHero.moduleHero.Errorf("find hero error: %v", err)
this.modelHero.module.Errorf("find hero error: %v", err)
return
}
}
@ -647,7 +647,7 @@ func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) i
// 获取所有满星满级满觉醒的英雄
func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
data := this.modelHero.moduleHero.configure.GetHeroConfigData()
data := this.modelHero.module.configure.GetHeroConfigData()
var (
changeHero []*pb.DBHero
)
@ -721,7 +721,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCount int32, itype bool) {
// 任务统计
var (
szTask []*comm.TaskParam
szTask []*comm.BuriedParam
)
if itype { //普通招募
if drawCount == 10 {
@ -730,35 +730,35 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
sz[star]++
}
for k := range sz {
szTask = append(szTask, comm.GettaskParam(comm.Rtype17, 1, k))
//this.ModuleRtask.SendToRtask(session, comm.Rtype17, 1, k)
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype17, 1, k))
//this.ModuleBuried.SendToRtask(session, comm.Rtype17, 1, k)
}
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype14, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype18, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype141, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype143, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype145, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype14, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype18, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype141, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype143, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype145, drawCount))
} else { // 阵营招募
szTask = append(szTask, comm.GettaskParam(comm.Rtype15, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype19, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype142, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype144, drawCount))
szTask = append(szTask, comm.GettaskParam(comm.Rtype146, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype15, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype19, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype142, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype144, drawCount))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype146, drawCount))
if drawCount == 10 {
szTask = append(szTask, comm.GettaskParam(comm.Rtype91, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype91, 1))
}
}
for _, star := range szStar {
szTask = append(szTask, comm.GettaskParam(comm.Rtype16, star, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype16, star, 1))
}
if drawCount == 10 {
szTask = append(szTask, comm.GettaskParam(comm.Rtype90, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype90, 1))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype89, drawCount))
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype89, drawCount))
go this.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
}
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
@ -952,7 +952,7 @@ func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, e
for sr.Next(context.TODO()) {
_hero := &pb.DBHero{}
if err = sr.Decode(_hero); err != nil {
this.modelHero.moduleHero.Errorf("find hero error: %v", err)
this.modelHero.module.Errorf("find hero error: %v", err)
}
hero = append(hero, _hero)
}
@ -968,7 +968,7 @@ func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, e
for sr.Next(context.TODO()) {
_hero := &pb.DBHero{}
if err = sr.Decode(_hero); err != nil {
this.modelHero.moduleHero.Errorf("find hero error: %v", err)
this.modelHero.module.Errorf("find hero error: %v", err)
}
hero = append(hero, _hero)
}

View File

@ -53,7 +53,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade
}
info.Nodes[conf.NodeId] = conf.Lv + 1
if info.Nodes[conf.NodeId] == 1 { //解锁
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype173, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype173, 1))
}
if err = this.module.modelHoroscope.updateInfo(session, info); err != nil {
code = pb.ErrorCode_DBError

View File

@ -23,11 +23,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
mapData map[string]interface{}
newChallenge bool // 新的关卡
reward []*cfg.Gameatn
bWin bool // 战斗是否胜利
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
del []string // 自动出售的装备
atno []*pb.UserAtno // atno 类型
res []*cfg.Gameatn // 最后获得的资源
bWin bool // 战斗是否胜利
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
del []string // 自动出售的装备
atno []*pb.UserAtno // atno 类型
res []*cfg.Gameatn // 最后获得的资源
)
mapData = make(map[string]interface{}, 0)
reward = make([]*cfg.Gameatn, 0)
@ -145,18 +145,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
Asset: atno,
Sell: del,
})
tasks = append(tasks, comm.GettaskParam(comm.Rtype80, 1, req.BossType, req.Difficulty))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype80, 1, req.BossType, req.Difficulty))
// 随机任务统计
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype81, req.Difficulty, req.BossType)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype82, req.BossType)
tasks = append(tasks, comm.GettaskParam(comm.Rtype81, req.Difficulty, req.BossType))
tasks = append(tasks, comm.GettaskParam(comm.Rtype82, 1, req.BossType))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype81, req.Difficulty, req.BossType))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype82, 1, req.BossType))
// 狩猎副本掉落觉醒材料
for _, v := range reward {
if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
if _conf.Usetype == comm.UseType8 {
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N)
tasks = append(tasks, comm.GettaskParam(comm.Rtype154, v.N))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype154, v.N))
}
}
}
@ -165,15 +165,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
if _conf.Usetype == comm.UseType8 {
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N)
tasks = append(tasks, comm.GettaskParam(comm.Rtype154, v.N))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype154, v.N))
}
}
}
}
if req.Auto {
tasks = append(tasks, comm.GettaskParam(comm.Rtype172, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype172, 1))
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype83, 1, req.BossType, req.Difficulty))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype83, 1, req.BossType, req.Difficulty))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
return
}

View File

@ -60,7 +60,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
//随机任务
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype21, 1)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, utils.ToInt32(sale.Prize[0].T))
// go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype21, 1), comm.GettaskParam(comm.Rtype22, utils.ToInt32(sale.Prize[0].T)))
// go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype21, 1), comm.GetBuriedParam(comm.Rtype22, utils.ToInt32(sale.Prize[0].T)))
case 4: //自选宝箱
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {

View File

@ -137,7 +137,7 @@ func (this *Items) AddItem(session comm.IUserSession, itemid string, addnum int3
///添加多个物品到背包 (可以加物品和减物品)
func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, bPush bool) (change []*pb.DB_UserItemData, code pb.ErrorCode) {
var (
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
err error
)
@ -160,12 +160,12 @@ func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, b
}
for k, v := range items {
if v > 0 {
tasks = append(tasks, comm.GettaskParam(comm.Rtype187, v, utils.ToInt32(k)))
//tasks = append(tasks, comm.GettaskParam(comm.Rtype170, utils.ToInt32(k), v)) // 20230526 移除170 任务
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype187, v, utils.ToInt32(k)))
//tasks = append(tasks, comm.GetBuriedParam(comm.Rtype170, utils.ToInt32(k), v)) // 20230526 移除170 任务
}
}
if len(tasks) > 0 {
go this.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}
return
}

View File

@ -157,11 +157,11 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
})
}
}
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype132, 1, _heroObj.Favorlv))
szTask = append(szTask, comm.GettaskParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype134, upLv))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype132, 1, _heroObj.Favorlv))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid)))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype134, upLv))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
}
return

View File

@ -26,8 +26,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
first bool // 判断是否是首通
update map[string]interface{}
rsp *pb.MlineChallengeOverResp
star int32 // 评星
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
star int32 // 评星
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
)
rsp = &pb.MlineChallengeOverResp{}
update = make(map[string]interface{})
@ -184,8 +184,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
// 主线任务统计 Rtype60
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.StageId))
tasks = append(tasks, comm.GettaskParam(comm.Rtype60, 1))
tasks = append(tasks, comm.GettaskParam(comm.Rtype61, 1, int32(req.StageId)))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype60, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype61, 1, int32(req.StageId)))
var (
ChapterStar int32
bAll3Star bool
@ -204,10 +204,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
bAll3Star = false
}
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype158, curChapter.ChapterId, ChapterStar))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype158, curChapter.ChapterId, ChapterStar))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype158, curChapter.ChapterId, ChapterStar)
if bAll3Star {
tasks = append(tasks, comm.GettaskParam(comm.Rtype159, curChapter.ChapterId))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype159, curChapter.ChapterId))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype159, curChapter.ChapterId)
}
for _, v2 := range list {
@ -220,7 +220,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype160, allStar)
tasks = append(tasks, comm.GettaskParam(comm.Rtype160, allStar))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype160, allStar))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
return
}

View File

@ -383,8 +383,8 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
}
this.Debug("消耗玩家资源", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "attrs", Value: attrs})
if count, ok := attrs[comm.ResDiamond]; ok {
// this.ModuleRtask.SendToRtask(session, comm.Rtype104, -count)
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype104, -count))
// this.ModuleBuried.SendToRtask(session, comm.Rtype104, -count)
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype104, -count))
}
}
if len(items) > 0 {

View File

@ -47,7 +47,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
},
})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype88, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype88, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype88, 1))
} else {
session.SendMsg(string(this.module.GetType()), "battle", &pb.MoonfantasyBattleResp{Code: cd})
}

View File

@ -135,7 +135,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype87, 1))
return
}
@ -189,7 +189,7 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype87, 1))
return
}

View File

@ -144,6 +144,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
return
}
// 任务相关
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype168, pagoda.Data[conf.Tab], conf.Tab))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype168, pagoda.Data[conf.Tab], conf.Tab))
return
}

View File

@ -101,6 +101,6 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.PracticeAcceptReq
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
&pb.PracticeQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid)
go this.module.ModuleRtask.TriggerTask(req.Uid, comm.GettaskParam(comm.Rtype183, 1))
go this.module.ModuleBuried.TriggerBuried(req.Uid, comm.GetBuriedParam(comm.Rtype183, 1))
return
}

View File

@ -28,7 +28,7 @@ func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGy
code = pb.ErrorCode_ConfigNoFound
return
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype185, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype185, 1))
session.SendMsg(string(this.module.GetType()), "getgymbuff", &pb.PracticeGetGymBuffResp{Buffid: buff.Id})
return
}

View File

@ -96,7 +96,7 @@ func (this *apiComp) Loot(session comm.IUserSession, req *pb.PracticeLootReq) (c
} else {
this.module.PutUserSession(_session)
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype184, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype184, 1))
session.SendMsg(string(this.module.GetType()), "loot", &pb.PracticeLootResp{Friend: req.Friend, Pillar: froom.Pillarf})
return
}

View File

@ -48,7 +48,7 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic
"refresh": room.Refresh,
})
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype182, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype182, 1))
} else {
room.Npcstate = 1
room.Battlenum++

View File

@ -102,7 +102,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
"knapsack": room.Knapsack,
filed: pillar,
})
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype149, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype149, 1))
session.SendMsg(string(this.module.GetType()), "practice", &pb.PracticePracticeResp{Pillar: pillar})
return
}

View File

@ -246,7 +246,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
this.module.PutUserSession(_session)
}
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, minutes))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype135, minutes))
session.SendMsg(string(this.module.GetType()), "receive", &pb.PracticeReceiveResp{Pillar: pillar, Knapsack: room.Knapsack})
return
}

View File

@ -61,7 +61,7 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq
filed: pillar,
"pillarf": room.Pillarf,
})
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype152, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype152, 1))
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room})
return
}

View File

@ -374,7 +374,7 @@ func (this *Practice) RPC_ModulePracticeUnLockPillar(ctx context.Context, args *
this.atlas.CheckActivatePandaAtlasCollect(args.Param1, "100001")
break
}
go this.ModuleRtask.TriggerTask(args.Param1, comm.GettaskParam(comm.Rtype152, 1))
go this.ModuleBuried.TriggerBuried(args.Param1, comm.GetBuriedParam(comm.Rtype152, 1))
// for _, v := range configure {
// if v.UnlockCondition == int32(taskid) {
// switch v.Id {

View File

@ -6,20 +6,20 @@ import (
)
const (
// RtaskSubTypeGetrecord = "getrecord" //任务数据
// RtaskSubTypeSend = "send" //触发任务
// RtaskSubTypeGetrecord = "getrecord" //任务数据
// RtaskSubTypeSend = "send" //触发任务
)
type apiComp struct {
modules.MCompGate
service core.IService
moduleRtask *ModuleRtask
service core.IService
module *ModuleRtask
}
// 组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompGate.Init(service, module, comp, options)
this.moduleRtask = module.(*ModuleRtask)
this.module = module.(*ModuleRtask)
this.service = service
return
}

View File

@ -13,14 +13,14 @@ func (this *apiComp) RtestCheck(session comm.IUserSession, req *pb.RtaskTestReq)
}
func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (code pb.ErrorCode, data *pb.ErrorData) {
rsp := &pb.RtaskTestResp{Flag: true,RtaskType: req.RtaskType}
rsp := &pb.RtaskTestResp{Flag: true, RtaskType: req.RtaskType}
if req.CondiId != 0 {
if code = this.moduleRtask.CheckCondi(session.GetUserId(), req.CondiId); code != pb.ErrorCode_Success {
if code = this.module.CheckCondi(session.GetUserId(), req.CondiId); code != pb.ErrorCode_Success {
rsp.Flag = false
}
} else if req.GroupId != 0 {
// 获取当前玩家
rtask := this.moduleRtask.modelRtask.GetRtask(session.GetUserId())
rtask := this.module.modelRtask.GetRtask(session.GetUserId())
if rtask == nil {
code = pb.ErrorCode_RtaskNoRtask
return
@ -43,17 +43,17 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod
"frtaskIds": rtask.FrtaskIds,
}
this.moduleRtask.modelRtask.Change(rtask.Uid, update)
this.module.modelRtask.Change(rtask.Uid, update)
} else {
this.moduleRtask.TriggerTask(session.GetUserId(), &comm.TaskParam{
TT: comm.TaskType(req.RtaskType),
Params: req.Params,
})
// this.module.ModuleBuried.TriggerBuried(session.GetUserId(), &comm.BuriedParam{
// TT: comm.TaskType(req.RtaskType),
// Params: req.Params,
// })
rsp.Flag = true
}
if err := session.SendMsg(string(this.moduleRtask.GetType()), "rtest", rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), "rtest", rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -17,14 +17,14 @@ import (
type ModelRtaskRecord struct {
modules.MCompModel
moduleRtask *ModuleRtask
service core.IService
module *ModuleRtask
service core.IService
}
func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableRtaskRecord
err = this.MCompModel.Init(service, module, comp, options)
this.moduleRtask = module.(*ModuleRtask)
this.module = module.(*ModuleRtask)
this.service = service
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
@ -48,7 +48,7 @@ func (this *ModelRtaskRecord) GetVerifyData(uid string, condiId int32) (*pb.Rtas
// 配置表: rdtask_condi
func (this *ModelRtaskRecord) getRecord(uid string) *pb.DBRtaskRecord {
record := &pb.DBRtaskRecord{}
if this.moduleRtask.IsCross() {
if this.module.IsCross() {
var (
stag string
conn *db.DBConn

View File

@ -15,14 +15,14 @@ import (
type ModelRtask struct {
modules.MCompModel
moduleRtask *ModuleRtask
service core.IService
module *ModuleRtask
service core.IService
}
func (this *ModelRtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableRtask
err = this.MCompModel.Init(service, module, comp, options)
this.moduleRtask = module.(*ModuleRtask)
this.module = module.(*ModuleRtask)
this.service = service
return
}
@ -32,7 +32,7 @@ func (this *ModelRtask) updateUserRtaskId(uid string, rtaskId int32) (err error)
ex_update := map[string]interface{}{
"rtaskId": rtaskId,
}
return this.moduleRtask.ModuleUser.ChangeUserExpand(uid, ex_update)
return this.module.ModuleUser.ChangeUserExpand(uid, ex_update)
}
// 查询用户随机任务
@ -57,7 +57,7 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtask
return nil, true
}
conf, err := this.moduleRtask.configure.getRtaskTypeById(condiId)
conf, err := this.module.configure.getRtaskTypeById(condiId)
if err != nil || conf == nil {
errors.Errorf("conf not found condiID: %v", condiId)
return
@ -70,9 +70,9 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtask
//验证限定条件
var condi *rtaskCondHandle
cond, ok := this.moduleRtask.handleMap.Load(condiId)
cond, ok := this.module.handleMap.Load(condiId)
if !ok {
rcs := this.moduleRtask.getHandle(comm.TaskType(conf.Type))
rcs := this.module.getHandle(comm.TaskType(conf.Type))
for _, v := range rcs {
if v.condId == condiId {
cond = v

View File

@ -446,7 +446,7 @@ func (this *ModelRtask) verifyRtype138(uid string, cfg *cfg.GameRdtaskCondiData,
}
func (this *ModelRtask) verifyRtype43(uid string, cfg *cfg.GameRdtaskCondiData, params ...int32) (ok bool, count int32, err error) {
equipment, ec := this.moduleRtask.ModuleEquipment.QueryEquipments(uid)
equipment, ec := this.module.ModuleEquipment.QueryEquipments(uid)
if ec == pb.ErrorCode_Success {
for _, e := range equipment {
if ok, _ = soGreatEqual(e.Lv, cfg.Data2); ok {

View File

@ -26,7 +26,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
record *pb.UserShopData
need []*cfg.Gameatn
give []*cfg.Gameatn
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
)
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
return
@ -116,74 +116,74 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
}
//随机任务
tasks = append(tasks, comm.GettaskParam(comm.Rtype64, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype64, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
for _, v := range give {
if v.A == comm.ItemType {
tasks = append(tasks, comm.GettaskParam(comm.Rtype65, v.N, utils.ToInt32(v.T)))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype65, v.N, utils.ToInt32(v.T)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype65, v.N, utils.ToInt32(v.T))
}
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype66, 1, int32(req.ShopType)))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype66, 1, int32(req.ShopType)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype66, 1, int32(req.ShopType))
for _, v := range need {
if v.A == comm.AttrType {
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
switch v.T {
case comm.ResGold:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 1))
break
case comm.ResExp:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 3))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 3))
break
case comm.ResDiamond:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.VipExp:
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.ResTaskActive:
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.ResFriend:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 4))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 4))
break
case comm.StarCoin:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 9))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 9))
break
case comm.SociatyCoin:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 8))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 8))
break
case comm.ArenaCoin:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 11))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 11))
break
case comm.ResPs:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 12))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 12))
break
case comm.Moongold:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 14))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 14))
break
case comm.Talent1:
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.Talent2:
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.Talent3:
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.Talent4:
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
break
case comm.Merchantmoney:
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 15))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 15))
break
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T))
}
}
if len(tasks) > 0 {
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true})

View File

@ -157,7 +157,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype105, 1))
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata})
} else if !req.IsManualRefresh {
// refresh := int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType2))
@ -200,7 +200,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
goods = transGoods(items, sdata)
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: sdata})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype105, 1))
} else { //返回以前的商品列表
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
code = pb.ErrorCode_SystemError

View File

@ -17,7 +17,7 @@ func (this *apiComp) AtlasActivateCheck(session comm.IUserSession, req *pb.Smith
func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtlasActivateReq) (code pb.ErrorCode, data *pb.ErrorData) {
var (
addScore int32 // 更新图鉴增加的积分
szTask []*comm.TaskParam
szTask []*comm.BuriedParam
)
code = this.AtlasActivateCheck(session, req)
if code != pb.ErrorCode_Success {
@ -60,7 +60,7 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
code = pb.ErrorCode_SmithyNoFoundAtlas
return
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype166, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype166, 1))
} else if conf.TypeId == 2 {
if v, ok := atlas.Collect[req.Id]; ok {
if !v.Activate { // 激活
@ -76,10 +76,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
code = pb.ErrorCode_SmithyNoFoundAtlas
return
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype165, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype165, 1))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype167, atlas.Score))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype167, atlas.Score))
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
session.SendMsg(string(this.module.GetType()), "atlasactivate", &pb.SmithyAtlasActivateResp{Data: atlas})
return
}

View File

@ -249,8 +249,8 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
Value: 0,
}
// 解锁了新的图纸
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype177, 1))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype179, 1, nextProficiency.Value1))
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype177, 1))
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype179, 1, nextProficiency.Value1))
}
// 是否解锁新套装
if nextProficiency.Type == comm.SmithyReelType4 {

View File

@ -60,9 +60,9 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (cod
update["temperature"] = stove.Temperature
this.module.modelStove.updateSmithyStove(session.GetUserId(), update)
session.SendMsg(string(this.module.GetType()), "rise", &pb.SmithyRiseResp{Data: stove})
tasks := make([]*comm.TaskParam, 0)
tasks = append(tasks, comm.GettaskParam(comm.Rtype175, stove.Temperature))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
tasks := make([]*comm.BuriedParam, 0)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype175, stove.Temperature))
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}
return

View File

@ -123,17 +123,17 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) {
func (this *Smithy) SendRdTask(session comm.IUserSession, Items []*pb.UserAtno) {
var equip map[int32]int32 // key xingji value 数量
equip = make(map[int32]int32, 0)
tasks := make([]*comm.TaskParam, 0)
tasks := make([]*comm.BuriedParam, 0)
for _, v := range Items {
if cfg := this.configure.GetEquipmentConfigureById(v.T); cfg != nil {
equip[cfg.Star]++
}
}
for k, v := range equip {
tasks = append(tasks, comm.GettaskParam(comm.Rtype51, v, k))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype51, v, k))
// this.ModuleRtask.SendToRtask(session, comm.Rtype148, v, k)
// this.ModuleBuried.SendToRtask(session, comm.Rtype148, v, k)
}
tasks = append(tasks, comm.GettaskParam(comm.Rtype148, int32(len(equip))))
this.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype148, int32(len(equip))))
this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
}

View File

@ -55,7 +55,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
// 触发任务条件
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype109, 1))
// 发邮件
if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil {
this.module.Error("发送邮件 模板ID:GuildApproved",

View File

@ -96,7 +96,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
if !isCheck {
// 触发任务条件
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype109, 1))
}
rsp := &pb.SociatyApplyResp{
Uid: uid,

View File

@ -136,7 +136,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
return
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype188, 1))
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 {

View File

@ -13,19 +13,19 @@ const (
TaskSubTypeStrategy = "strategy" //卡牌攻略
TaskSubTypeFinishedPush = "taskfinishedpush" //推送
TaskSubTypeGetrecord = "getrecord" //任务数据
TaskSubTypeSend = "send" //触发任务
TaskSubTypeSend = "send" //触发任务
)
type apiComp struct {
modules.MCompGate
service core.IService
moduleTask *ModuleTask
service core.IService
module *ModuleTask
}
// 组件初始化接口
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompGate.Init(service, module, comp, options)
this.moduleTask = module.(*ModuleTask)
this.module = module.(*ModuleTask)
this.service = service
return
}

View File

@ -20,14 +20,14 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
resp := &pb.TaskActiveListResp{}
defer func() {
if err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveList, resp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveList, resp); err != nil {
code = pb.ErrorCode_SystemError
return
}
}()
// 获取玩家活跃度
expand, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
@ -43,7 +43,7 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
}
//获取当前Tag的活跃度列表
resp.List = this.moduleTask.modelTaskActive.getActiveListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
resp.List = this.module.modelTaskActive.getActiveListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
return
}

View File

@ -23,7 +23,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
}
uid := session.GetUserId()
ue, err := this.moduleTask.ModuleUser.GetUserExpand(uid)
ue, err := this.module.ModuleUser.GetUserExpand(uid)
if err != nil {
code = pb.ErrorCode_DBError
return
@ -37,12 +37,12 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
var flag bool
update := map[string]interface{}{}
// 玩家的
activeList := this.moduleTask.modelTaskActive.getActiveList(uid)
activeList := this.module.modelTaskActive.getActiveList(uid)
// var activityData *pb.ActivityData
for _, v := range activeList {
if v.TaskId == req.Id {
if v.Received != 1 {
conf := this.moduleTask.configure.getTaskActiveById(v.TaskId)
conf := this.module.configure.getTaskActiveById(v.TaskId)
if conf == nil {
code = pb.ErrorCode_ConfigNoFound
return
@ -71,8 +71,8 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
if flag {
update["activityList"] = activeList
if err := this.moduleTask.modelTaskActive.Change(session.GetUserId(), update); err != nil {
this.moduleTask.Errorf("updateReceive err %v", err)
if err := this.module.modelTaskActive.Change(session.GetUserId(), update); err != nil {
this.module.Errorf("updateReceive err %v", err)
code = pb.ErrorCode_DBError
return
}
@ -80,14 +80,14 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
if len(rewards) > 0 {
//派发奖励
if code = this.moduleTask.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
this.moduleTask.Error("活跃度奖励",
if code = this.module.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
this.module.Error("活跃度奖励",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "rewards", Value: rewards},
log.Field{Key: "code", Value: code},
)
}
go this.moduleTask.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype171, 1))
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype171, 1))
}
resp := &pb.TaskActiveReceiveResp{
@ -95,7 +95,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
Id: req.Id,
}
err = session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
err = session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveReceive, resp)
if err != nil {
code = pb.ErrorCode_SystemError
}

View File

@ -21,7 +21,7 @@ func (this *apiComp) Getrecord(session comm.IUserSession, req *pb.TaskGetrecordR
}
}
}
if err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeGetrecord, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), TaskSubTypeGetrecord, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -21,14 +21,14 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (code
rsp := &pb.TaskListResp{}
defer func() {
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeList, rsp)
err := session.SendMsg(string(this.module.GetType()), TaskSubTypeList, rsp)
if err != nil {
code = pb.ErrorCode_SystemError
return
}
}()
task := this.moduleTask.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
task := this.module.modelTask.getTaskListByTag(session.GetUserId(), comm.TaskTag(req.TaskTag))
if task == nil {
code = pb.ErrorCode_TaskNotFound
return

View File

@ -24,7 +24,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
}
uid := session.GetUserId()
// 获取待领取的任务
userTask := this.moduleTask.modelTask.getUserTask(uid, req.Id)
userTask := this.module.modelTask.getUserTask(uid, req.Id)
if userTask == nil {
code = pb.ErrorCode_TaskNotFound
@ -62,7 +62,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
}
// 待领取的任务配置
conf := this.moduleTask.configure.getTaskById(taskData.TaskId)
conf := this.module.configure.getTaskById(taskData.TaskId)
if conf == nil {
code = pb.ErrorCode_ConfigNoFound
return
@ -71,7 +71,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
// 更新活跃度
if conf.Active > 0 {
//更新活跃度
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
ue, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
if err != nil {
code = pb.ErrorCode_DBError
return
@ -89,12 +89,12 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
// 周任务 自动领取奖励
if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
TaskActive := make(map[string]interface{})
activeList := this.moduleTask.modelTaskActive.getActiveList(uid)
activeList := this.module.modelTaskActive.getActiveList(uid)
var rewards []*cfg.Gameatn
var maxTaskId int32
for _, v := range activeList {
if v.Received != 1 {
conf := this.moduleTask.configure.getTaskActiveById(v.TaskId)
conf := this.module.configure.getTaskActiveById(v.TaskId)
if conf == nil {
code = pb.ErrorCode_ConfigNoFound
return
@ -113,21 +113,21 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
if len(rewards) > 0 {
TaskActive["activityList"] = activeList
if err := this.moduleTask.modelTaskActive.Change(session.GetUserId(), TaskActive); err != nil {
this.moduleTask.Errorf("updateReceive err %v", err)
if err := this.module.modelTaskActive.Change(session.GetUserId(), TaskActive); err != nil {
this.module.Errorf("updateReceive err %v", err)
code = pb.ErrorCode_DBError
return
}
//派发奖励
if code = this.moduleTask.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
this.moduleTask.Error("活跃度奖励",
if code = this.module.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
this.module.Error("活跃度奖励",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "rewards", Value: rewards},
log.Field{Key: "code", Value: code},
)
}
go this.moduleTask.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype171, 1))
err := session.SendMsg(string(this.moduleTask.GetType()), "activereceive", &pb.TaskActiveReceivePush{
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype171, 1))
err := session.SendMsg(string(this.module.GetType()), "activereceive", &pb.TaskActiveReceivePush{
TaskTag: int32(comm.TASK_WEEKLY),
Id: maxTaskId,
})
@ -140,7 +140,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
}
if len(update) > 0 {
if err = this.moduleTask.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
if err = this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
return
}
@ -148,8 +148,8 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
}
//奖励
if code = this.moduleTask.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
this.moduleTask.Error("发送奖励",
if code = this.module.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
this.module.Error("发送奖励",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "rewards", Value: conf.Reword},
log.Field{Key: "code", Value: code},
@ -174,13 +174,13 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
update["achieveList"] = taskDataList
}
if err := this.moduleTask.modelTask.Change(session.GetUserId(), update); err != nil {
if err := this.module.modelTask.Change(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
return
}
resp.TaskId = taskData.TaskId
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeReceive, resp)
err := session.SendMsg(string(this.module.GetType()), TaskSubTypeReceive, resp)
if err != nil {
code = pb.ErrorCode_SystemError
return

View File

@ -15,14 +15,14 @@ func (this *apiComp) SendCheck(session comm.IUserSession, req *pb.TaskSendReq) (
func (this *apiComp) Send(session comm.IUserSession, req *pb.TaskSendReq) (code pb.ErrorCode, data *pb.ErrorData) {
if imodule, err := this.service.GetModule(comm.ModuleRtask); err == nil {
if itask, ok := imodule.(comm.IRtask); ok {
itask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.TaskType(req.TaskType), req.Params...))
itask.TriggerTask(session.GetUserId(), comm.GetTaskParam(comm.TaskType(req.TaskType), req.Params...))
}
}
rsp := &pb.TaskSendResp{
IsSucc: true,
}
if err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeSend, rsp); err != nil {
if err := session.SendMsg(string(this.module.GetType()), TaskSubTypeSend, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return

View File

@ -122,7 +122,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
// this.sendMsg(session, UserSubTypeCreate, resp)
session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{})
if req.Figure != 0 {
go this.module.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype72, 1))
go this.module.ModuleBuried.TriggerBuried(uid, comm.GetBuriedParam(comm.Rtype72, 1))
}
this.mail.SendMailByCid(session, comm.Welcomemail, nil)
return

View File

@ -141,7 +141,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
this.module.RecoverUserPsStart(user.Uid)
// 日常登录任务
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype8, 1))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype8, 1))
this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
rsp.Data = user

View File

@ -421,7 +421,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
code = pb.ErrorCode_GoldNoEnough
return
}
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype68, -(add)))
this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype68, -(add)))
}
change.Gold += int64(add)
case comm.ResExp:

View File

@ -170,29 +170,29 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}
// 随机任务统计
var szTask []*comm.TaskParam
szTask = append(szTask, comm.GettaskParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
//szTask = append(szTask, comm.GettaskParam(comm.Rtype74, req.BossId, req.Difficulty))
szTask = append(szTask, comm.GettaskParam(comm.Rtype78, req.BossId, req.Difficulty, req.Report.Costtime))
var szTask []*comm.BuriedParam
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
//szTask = append(szTask, comm.GetBuriedParam(comm.Rtype74, req.BossId, req.Difficulty))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype78, req.BossId, req.Difficulty, 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 { // 判断是否有助战
szTask = append(szTask, comm.GettaskParam(comm.Rtype79, req.Difficulty, req.BossId))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype79, req.Difficulty, req.BossId))
break
}
}
}
if req.Auto {
szTask = append(szTask, comm.GettaskParam(comm.Rtype75, req.BossId, req.Difficulty))
szTask = append(szTask, comm.GettaskParam(comm.Rtype172, 1))
szTask = append(szTask, comm.GettaskParam(comm.Rtype181, 1, req.BossId, req.Difficulty))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype75, req.BossId, req.Difficulty))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype172, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype181, 1, req.BossId, req.Difficulty))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype76, 1, req.BossId))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype76, 1, req.BossId))
if bHelp {
szTask = append(szTask, comm.GettaskParam(comm.Rtype180, req.BossId, 1))
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype180, req.BossId, 1))
}
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
return
}

View File

@ -255,7 +255,7 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
difficulty := autoBattle.Difficulty
atno = make([]*pb.UserAtno, 0)
conf := this.configure.GetVikingBossConfigData(bossId, difficulty)
tasks := make([]*comm.TaskParam, 0)
tasks := make([]*comm.BuriedParam, 0)
// costRes := this.ModuleTools.GetGlobalConf().VikingExpeditionCos
// if costRes == nil {
// code = pb.ErrorCode_ConfigNoFound
@ -317,21 +317,21 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
}
}
// 随机任务统计
// this.ModuleRtask.SendToRtask(session, comm.Rtype73, difficulty, bossId, 1)
// this.ModuleRtask.SendToRtask(session, comm.Rtype78, difficulty, bossId, Report.Costtime)
tasks = append(tasks, comm.GettaskParam(comm.Rtype73, 1, bossId, difficulty))
tasks = append(tasks, comm.GettaskParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
// this.ModuleBuried.SendToRtask(session, comm.Rtype73, difficulty, bossId, 1)
// this.ModuleBuried.SendToRtask(session, comm.Rtype78, difficulty, bossId, Report.Costtime)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype73, 1, bossId, difficulty))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
if Report != nil && Report.Info != nil && len(Report.Info.Redflist) > 0 {
for _, v := range Report.Info.Redflist[0].Team {
if v.Ishelp { // 判断是否有助战
// this.ModuleRtask.SendToRtask(session, comm.Rtype79, difficulty, bossId)
tasks = append(tasks, comm.GettaskParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
// this.ModuleBuried.SendToRtask(session, comm.Rtype79, difficulty, bossId)
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
break
}
}
}
this.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
return
}

View File

@ -80,7 +80,7 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
return
} else {
//触发任务
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype70, 1, req.BattleConfId))
}
}
}

View File

@ -4,7 +4,6 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
@ -46,7 +45,6 @@ func (this *Worldtask) GetType() core.M_Modules {
func (this *Worldtask) Start() (err error) {
err = this.ModuleBase.Start()
event.RegisterGO(comm.EventBuriedComplete, this.ConditionFinishNotify)
if this.worldtaskConf, err = this.configure.getWorldtaskCfg(); err != nil {
return err
}