上传新埋点接口
This commit is contained in:
parent
1a2d39eaec
commit
0bde395d6a
34
comm/pool.go
34
comm/pool.go
@ -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 := taskParamPool.Get().(*TaskParam)
|
||||||
task.TT = t
|
task.TT = t
|
||||||
task.Params = append(task.Params, p...)
|
task.Params = append(task.Params, p...)
|
||||||
@ -21,3 +22,34 @@ func PuttaskParam(r *TaskParam) {
|
|||||||
r.Params = r.Params[:0]
|
r.Params = r.Params[:0]
|
||||||
taskParamPool.Put(r)
|
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)
|
||||||
|
}
|
||||||
|
@ -54,7 +54,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.module.DispenseRes(session, level.Award, true)
|
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})
|
session.SendMsg(string(this.module.GetType()), "receive", &pb.AcademyReceiveResp{Issucc: true})
|
||||||
return
|
return
|
||||||
|
@ -40,7 +40,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
|||||||
Tasks: record.Tasks,
|
Tasks: record.Tasks,
|
||||||
}})
|
}})
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype130, 1)
|
// 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 {
|
} else {
|
||||||
session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: nil})
|
session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: nil})
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
|||||||
bulestate = pb.BattleRecordState_DefendLost
|
bulestate = pb.BattleRecordState_DefendLost
|
||||||
}
|
}
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype131, 1)
|
// 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 {
|
} else {
|
||||||
if req.Revengeid != "" {
|
if req.Revengeid != "" {
|
||||||
redstate = pb.BattleRecordState_RevengeFailed
|
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})
|
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.Rtype128, red.Integral)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype129, red.Dan)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype129, red.Dan)
|
||||||
return
|
return
|
||||||
|
@ -138,8 +138,8 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
|||||||
}
|
}
|
||||||
for _, v := range req.Format.Friendformat {
|
for _, v := range req.Format.Friendformat {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Format.Friendformat != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -251,8 +251,8 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
|
|||||||
}
|
}
|
||||||
for _, v := range req.Format.Friendformat {
|
for _, v := range req.Format.Friendformat {
|
||||||
if v != "" {
|
if v != "" {
|
||||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype108, 1)
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype108, 1))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,7 +261,7 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Format.Friendformat != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -383,8 +383,8 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt
|
|||||||
}
|
}
|
||||||
this.moonfantasy.Trigger(session, report)
|
this.moonfantasy.Trigger(session, report)
|
||||||
for _, v := range report.Completetask {
|
for _, v := range report.Completetask {
|
||||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v)
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(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
|
return pb.ErrorCode_Success, true
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,8 @@ func (this *Buried) ActiveCondition(uid string, condiIds ...int32) {
|
|||||||
|
|
||||||
//激活数据采集点
|
//激活数据采集点
|
||||||
func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condIds []int32) {
|
func (this *Buried) CheckCondition(uid string, condiIds ...int32) (condIds []int32) {
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
|
|||||||
}
|
}
|
||||||
go this.module.modelChat.sendChatToWorld(msg, max_chat)
|
go this.module.modelChat.sendChatToWorld(msg, max_chat)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
|
// 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(
|
// if _, err = this.service.AcrossClusterRpcGo(
|
||||||
// context.Background(),
|
// 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)
|
go this.module.modelChat.sendChatToCrossServer(msg, max_chat)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype106, 1)
|
// 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
|
break
|
||||||
default:
|
default:
|
||||||
code = pb.ErrorCode_ReqParameterError
|
code = pb.ErrorCode_ReqParameterError
|
||||||
|
@ -25,12 +25,12 @@ func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (cod
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
if code = a.DoCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.DoCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dConf, err := a.module.configure.getDispatchTaskConf(req.TaskId)
|
dConf, err := this.module.configure.getDispatchTaskConf(req.TaskId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
@ -42,27 +42,27 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(req.HeroIds) < int(dConf.Taskneed) {
|
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
|
code = pb.ErrorCode_DispatchHeroNoEnough
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
d := a.module.modelDispatch.getDBDispatch(session.GetUserId())
|
d := this.module.modelDispatch.getDBDispatch(session.GetUserId())
|
||||||
if d == nil && d.Nb == nil {
|
if d == nil && d.Nb == nil {
|
||||||
code = pb.ErrorCode_DataNotFound
|
code = pb.ErrorCode_DataNotFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//校验门票
|
//校验门票
|
||||||
ticketAtn := a.module.ModuleTools.GetGlobalConf().DispatchNumtools
|
ticketAtn := this.module.ModuleTools.GetGlobalConf().DispatchNumtools
|
||||||
if code = a.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
|
if code = this.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
|
||||||
code = pb.ErrorCode_DispatchTicketNoEnough
|
code = pb.ErrorCode_DispatchTicketNoEnough
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rsp := &pb.DispatchDoResp{}
|
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)
|
var errCustom = new(comm.CustomError)
|
||||||
if errors.As(err, &errCustom) {
|
if errors.As(err, &errCustom) {
|
||||||
code = errCustom.Code
|
code = errCustom.Code
|
||||||
@ -72,12 +72,12 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
|
|||||||
return
|
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
|
rsp.IsSucc = true
|
||||||
session.SendMsg(string(a.module.GetType()), "do", rsp)
|
session.SendMsg(string(this.module.GetType()), "do", rsp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype94, 1)
|
// 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})
|
session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,8 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
minstr int32 = 9999
|
minstr int32 = 9999
|
||||||
minlv int32 = 9999
|
minlv int32 = 9999
|
||||||
hero *pb.DBHero
|
hero *pb.DBHero
|
||||||
suite1Str, suite1Lv, suite2Str, suite2Lv int32 = math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32
|
suite1Str, suite1Lv, suite2Str, suite2Lv int32 = math.MaxInt32, math.MaxInt32, math.MaxInt32, math.MaxInt32
|
||||||
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
|
||||||
)
|
)
|
||||||
|
|
||||||
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
|
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.SuiteId = confs[0].Suittype
|
||||||
hero.Suite1Star = suite1Str
|
hero.Suite1Star = suite1Str
|
||||||
hero.Suite1Lv = suite1Lv
|
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 {
|
} else {
|
||||||
hero.SuiteId = 0
|
hero.SuiteId = 0
|
||||||
@ -160,7 +160,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
hero.SuiteExtId = confs[4].Suittype
|
hero.SuiteExtId = confs[4].Suittype
|
||||||
hero.Suite2Star = suite2Str
|
hero.Suite2Star = suite2Str
|
||||||
hero.Suite2Lv = suite2Lv
|
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 {
|
} else {
|
||||||
hero.SuiteExtId = 0
|
hero.SuiteExtId = 0
|
||||||
@ -178,34 +178,34 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype5, utils.ToInt32(hero.HeroID), equipNum)
|
||||||
// for k, v := range equipStr {
|
// 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)
|
// // 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.GetBuriedParam(comm.Rtype41, 1, equipNum, minstr))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype42, 1, equipNum, minlv))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, equipNum, minlv))
|
||||||
// for k, v := range equipLv {
|
// 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)
|
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype42, utils.ToInt32(hero.HeroID), v, k)
|
||||||
// }
|
// }
|
||||||
if hero.SuiteId != 0 {
|
if hero.SuiteId != 0 {
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype98, 1, hero.Suite1Lv))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype169, hero.SuiteId))
|
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.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
|
||||||
}
|
}
|
||||||
if hero.SuiteExtId != 0 {
|
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))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype98, 1, hero.Suite1Lv))
|
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.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(tasks) > 0 {
|
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})
|
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})
|
||||||
|
@ -35,7 +35,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
|||||||
issucc bool
|
issucc bool
|
||||||
suite1Lv, suite2Lv int32 = math.MaxInt32, math.MaxInt32
|
suite1Lv, suite2Lv int32 = math.MaxInt32, math.MaxInt32
|
||||||
user *pb.DBUser
|
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 {
|
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
@ -169,27 +169,27 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
|||||||
|
|
||||||
if hero.SuiteId != 0 {
|
if hero.SuiteId != 0 {
|
||||||
hero.Suite1Lv = suite1Lv
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
|
||||||
}
|
}
|
||||||
if hero.SuiteExtId != 0 {
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
|
||||||
}
|
}
|
||||||
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
|
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
|
||||||
}
|
}
|
||||||
//随机任务触发
|
//随机任务触发
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype43, 1, equipment.Lv))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype43, 1, equipment.Lv))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype44, 1, equipment.Lv))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype44, 1, equipment.Lv))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype47, 1))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1))
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)
|
// 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.Rtype44, equipment.Lv)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
|
||||||
if conf.Pos == 7 {
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype102, 1)
|
||||||
} else if conf.Pos == 6 {
|
} 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)
|
// 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())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
}
|
}
|
||||||
} else {
|
} 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)
|
// 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 {
|
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})
|
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
|
||||||
return
|
return
|
||||||
|
@ -67,7 +67,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype95, 1)
|
// 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})
|
session.SendMsg(string(this.module.GetType()), "wash", &pb.EquipmentWashResp{Eid: req.Eid, AdverbEntry: adverbEntry})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
|||||||
var (
|
var (
|
||||||
configure *cfg.GameEquip
|
configure *cfg.GameEquip
|
||||||
add map[string]*pb.DB_Equipment
|
add map[string]*pb.DB_Equipment
|
||||||
uId string = session.GetUserId()
|
uId string = session.GetUserId()
|
||||||
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
|
||||||
)
|
)
|
||||||
if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil {
|
if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil {
|
||||||
return
|
return
|
||||||
@ -111,8 +111,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
|||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
//随机任务
|
//随机任务
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype50, 1, c.Star))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype50, 1, c.Star))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype97, 1, c.Suittype, c.Star))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype97, 1, c.Suittype, c.Star))
|
||||||
unm := int32(1)
|
unm := int32(1)
|
||||||
if equipment.AdverbEntry != nil {
|
if equipment.AdverbEntry != nil {
|
||||||
unm += int32(len(equipment.AdverbEntry))
|
unm += int32(len(equipment.AdverbEntry))
|
||||||
@ -120,11 +120,11 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
|||||||
if equipment.Adverbskill != nil {
|
if equipment.Adverbskill != nil {
|
||||||
unm += int32(len(equipment.Adverbskill))
|
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 {
|
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 {
|
} 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
|
add[equipment.Id] = equipment
|
||||||
change = append(change, equipment)
|
change = append(change, equipment)
|
||||||
@ -135,7 +135,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
|||||||
|
|
||||||
//异步出发任务启动
|
//异步出发任务启动
|
||||||
if len(tasks) > 0 {
|
if len(tasks) > 0 {
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(add) > 0 {
|
if len(add) > 0 {
|
||||||
|
@ -33,17 +33,17 @@ const (
|
|||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
modules.MCompGate
|
modules.MCompGate
|
||||||
moduleFriend *Friend
|
module *Friend
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
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.MCompGate.Init(service, module, comp, options)
|
||||||
this.moduleFriend = module.(*Friend)
|
this.module = module.(*Friend)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
|
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
|
||||||
user := this.moduleFriend.ModuleUser.GetUser(userId)
|
user := this.module.ModuleUser.GetUser(userId)
|
||||||
if user != nil {
|
if user != nil {
|
||||||
return &pb.FriendBase{
|
return &pb.FriendBase{
|
||||||
ServerId: user.Sid,
|
ServerId: user.Sid,
|
||||||
|
@ -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()
|
now := configure.Now().Unix()
|
||||||
if now-qr.Timestamp > 10 { //大于10s 切磋超时
|
if now-qr.Timestamp > 10 { //大于10s 切磋超时
|
||||||
code = pb.ErrorCode_FriendQiecuoTimeout
|
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
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -34,19 +34,19 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
|
|||||||
return
|
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 {
|
if ipvp, ok := imodule.(comm.IPvp); ok {
|
||||||
//发起者 red
|
//发起者 red
|
||||||
red := this.moduleFriend.ModuleUser.GetUser(req.Uid)
|
red := this.module.ModuleUser.GetUser(req.Uid)
|
||||||
if red == nil {
|
if red == nil {
|
||||||
code = pb.ErrorCode_UserNofound
|
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
|
return
|
||||||
}
|
}
|
||||||
blue := this.moduleFriend.ModuleUser.GetUser(session.GetUserId())
|
blue := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||||
if blue == nil {
|
if blue == nil {
|
||||||
code = pb.ErrorCode_UserNofound
|
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
|
return
|
||||||
}
|
}
|
||||||
matchId, c := ipvp.CreatePvp(
|
matchId, c := ipvp.CreatePvp(
|
||||||
@ -55,12 +55,12 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.FriendAcceptReq)
|
|||||||
pb.PvpType_friends,
|
pb.PvpType_friends,
|
||||||
)
|
)
|
||||||
if c != pb.ErrorCode_Success {
|
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
|
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{
|
resp := &pb.FriendAcceptResp{
|
||||||
IsSucc: true,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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)
|
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendAddBlackReq) (code pb.ErrorCode) {
|
func (this *apiComp) AddblackCheck(session comm.IUserSession, req *pb.FriendAddBlackReq) (code pb.ErrorCode) {
|
||||||
if req.FriendId == "" {
|
if req.FriendId == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -30,13 +30,13 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
|
|||||||
)
|
)
|
||||||
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(uid)
|
self = this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
target = this.moduleFriend.modelFriend.GetFriend(req.FriendId)
|
target = this.module.modelFriend.GetFriend(req.FriendId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
code = pb.ErrorCode_FriendTargetNoData
|
||||||
return
|
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
|
code = pb.ErrorCode_FriendBlackMax
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -73,13 +73,13 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
|
|||||||
friendIds := utils.Deletex(self.FriendIds, req.FriendId)
|
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,
|
"blackIds": self.BlackIds,
|
||||||
"friendIds": friendIds,
|
"friendIds": friendIds,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("加入黑名单",
|
this.module.Error("加入黑名单",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "目标人", Value: req.FriendId},
|
log.Field{Key: "目标人", Value: req.FriendId},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -91,7 +91,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
|
|||||||
FriendId: req.FriendId,
|
FriendId: req.FriendId,
|
||||||
UserId: session.GetUserId(),
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeReq) (code pb.ErrorCode) {
|
func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.FriendAgreeReq) (code pb.ErrorCode) {
|
||||||
if len(req.FriendIds) == 0 {
|
if len(req.FriendIds) == 0 {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
@ -30,7 +30,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
|||||||
)
|
)
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(uid)
|
self = this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -40,7 +40,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
|||||||
agreeIds := []string{}
|
agreeIds := []string{}
|
||||||
for _, friendId := range req.FriendIds {
|
for _, friendId := range req.FriendIds {
|
||||||
// 验证friendId是否有效
|
// 验证friendId是否有效
|
||||||
user := this.moduleFriend.ModuleUser.GetUser(friendId)
|
user := this.module.ModuleUser.GetUser(friendId)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
continue
|
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: "uid", Value: uid},
|
||||||
log.Field{Key: "heroObjId", Value: heroObjId},
|
log.Field{Key: "heroObjId", Value: heroObjId},
|
||||||
)
|
)
|
||||||
if err := this.moduleFriend.SendMsgToUsers(string(this.moduleFriend.GetType()), "assistheroupdate", push, friendId); err != nil {
|
if err := this.module.SendMsgToUsers(string(this.module.GetType()), "assistheroupdate", push, friendId); err != nil {
|
||||||
this.moduleFriend.Error("推送助战英雄列表",
|
this.module.Error("推送助战英雄列表",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
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 {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
code = pb.ErrorCode_FriendTargetNoData
|
||||||
return
|
return
|
||||||
@ -96,11 +96,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
|||||||
}
|
}
|
||||||
target.FriendIds = append(target.FriendIds, self.Uid)
|
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,
|
"friendIds": target.FriendIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("好友审批同意",
|
this.module.Error("好友审批同意",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.FriendIds},
|
log.Field{Key: "params", Value: req.FriendIds},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
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 {
|
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,
|
"applyIds": self.ApplyIds,
|
||||||
"friendIds": self.FriendIds,
|
"friendIds": self.FriendIds,
|
||||||
})
|
})
|
||||||
@ -135,11 +135,11 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
|||||||
|
|
||||||
// 拥有xx个好友
|
// 拥有xx个好友
|
||||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds)))
|
// 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{
|
resp := &pb.FriendAgreeResp{
|
||||||
Num: optNum,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode) {
|
func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.FriendApplyReq) (code pb.ErrorCode) {
|
||||||
if req.FriendId == "" {
|
if req.FriendId == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
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 {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
globalConf := this.moduleFriend.globalConf
|
globalConf := this.module.globalConf
|
||||||
//判断是否超过最大好友数量
|
//判断是否超过最大好友数量
|
||||||
if len(self.FriendIds) >= int(globalConf.FriendMaxnum) {
|
if len(self.FriendIds) >= int(globalConf.FriendMaxnum) {
|
||||||
code = pb.ErrorCode_FriendSelfMax
|
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 {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
code = pb.ErrorCode_FriendTargetNoData
|
||||||
return
|
return
|
||||||
@ -93,11 +93,11 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
|
|||||||
}
|
}
|
||||||
target.ApplyIds = append(target.ApplyIds, session.GetUserId())
|
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,
|
"applyIds": target.ApplyIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_FriendApplyError
|
code = pb.ErrorCode_FriendApplyError
|
||||||
this.moduleFriend.Error("好友申请",
|
this.module.Error("好友申请",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.FriendId},
|
log.Field{Key: "params", Value: req.FriendId},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
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,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
|
|||||||
list []*pb.FriendBase
|
list []*pb.FriendBase
|
||||||
)
|
)
|
||||||
|
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -34,7 +34,7 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
|
|||||||
List: list,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func (this *apiComp) AssistheroCheck(session comm.IUserSession, req *pb.FriendAssistheroReq) (code pb.ErrorCode) {
|
func (this *apiComp) AssistheroCheck(session comm.IUserSession, req *pb.FriendAssistheroReq) (code pb.ErrorCode) {
|
||||||
if req.HeroObjId == "" {
|
if req.HeroObjId == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -23,10 +23,10 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
|||||||
}
|
}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
// 获取英雄
|
// 获取英雄
|
||||||
hero, err := this.moduleFriend.ModuleHero.QueryCrossHeroinfo(req.HeroObjId)
|
hero, err := this.module.ModuleHero.QueryCrossHeroinfo(req.HeroObjId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("查询英雄数据 QueryCrossHeroinfo",
|
this.module.Error("查询英雄数据 QueryCrossHeroinfo",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.HeroObjId},
|
log.Field{Key: "params", Value: req.HeroObjId},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
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 {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -56,9 +56,9 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
|||||||
update["received"] = 1 //设置可领取状态
|
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
|
code = pb.ErrorCode_FriendApplyError
|
||||||
this.moduleFriend.Error("设置助战英雄",
|
this.module.Error("设置助战英雄",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.HeroObjId},
|
log.Field{Key: "params", Value: req.HeroObjId},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
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}
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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: "uid", Value: uid},
|
||||||
log.Field{Key: "friendIds", Value: self.FriendIds},
|
log.Field{Key: "friendIds", Value: self.FriendIds},
|
||||||
log.Field{Key: "heroObjId", Value: req.HeroObjId},
|
log.Field{Key: "heroObjId", Value: req.HeroObjId},
|
||||||
)
|
)
|
||||||
if err := this.moduleFriend.SendMsgToUsers(string(this.moduleFriend.GetType()), "assistheroupdate", push, self.FriendIds...); err != nil {
|
if err := this.module.SendMsgToUsers(string(this.module.GetType()), "assistheroupdate", push, self.FriendIds...); err != nil {
|
||||||
this.moduleFriend.Error("推送助战英雄列表",
|
this.module.Error("推送助战英雄列表",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "friends", Value: self.FriendIds},
|
log.Field{Key: "friends", Value: self.FriendIds},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -98,6 +98,6 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
|||||||
|
|
||||||
// 随机任务Rtype13
|
// 随机任务Rtype13
|
||||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1)
|
// 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
|
return
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
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 {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -22,7 +22,7 @@ func (this *apiComp) AssistHeroList(session comm.IUserSession, req *pb.FriendAss
|
|||||||
|
|
||||||
rsp := &pb.FriendAssistHeroListResp{}
|
rsp := &pb.FriendAssistHeroListResp{}
|
||||||
for _, v := range self.FriendIds {
|
for _, v := range self.FriendIds {
|
||||||
f := this.moduleFriend.modelFriend.GetFriend(v)
|
f := this.module.modelFriend.GetFriend(v)
|
||||||
|
|
||||||
rsp.Friends = append(rsp.Friends, &pb.FriendBase{
|
rsp.Friends = append(rsp.Friends, &pb.FriendBase{
|
||||||
UserId: v,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistlistReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
var list []*pb.FriendBase
|
var list []*pb.FriendBase
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -26,7 +26,7 @@ func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistl
|
|||||||
base := this.setDefaultFriendUserBaseInfo(uid)
|
base := this.setDefaultFriendUserBaseInfo(uid)
|
||||||
if base != nil {
|
if base != nil {
|
||||||
// 获取好友信息
|
// 获取好友信息
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(uid)
|
target := this.module.modelFriend.GetFriend(uid)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ func (this *apiComp) Assistlist(session comm.IUserSession, req *pb.FriendAssistl
|
|||||||
HeroObjId: self.AssistHeroId,
|
HeroObjId: self.AssistHeroId,
|
||||||
Record: self.Record,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -16,7 +16,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
|
|||||||
list []*pb.FriendBase
|
list []*pb.FriendBase
|
||||||
)
|
)
|
||||||
|
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -33,7 +33,7 @@ func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackLis
|
|||||||
Friends: list,
|
Friends: list,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeBlacklist, resp)
|
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeBlacklist, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (code pb.ErrorCode) {
|
func (this *apiComp) DelCheck(session comm.IUserSession, req *pb.FriendDelReq) (code pb.ErrorCode) {
|
||||||
if req.FriendId == "" {
|
if req.FriendId == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
|
|||||||
}
|
}
|
||||||
|
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
self := this.moduleFriend.modelFriend.GetFriend(uid)
|
self := this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -31,10 +31,10 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
|
|||||||
// 从好友列表中删除
|
// 从好友列表中删除
|
||||||
selfFriendIds := utils.Deletex(self.FriendIds, req.FriendId)
|
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,
|
"friendIds": selfFriendIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
this.moduleFriend.Error("删除好友",
|
this.module.Error("删除好友",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.String()},
|
log.Field{Key: "params", Value: req.String()},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -43,7 +43,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(req.FriendId)
|
target := this.module.modelFriend.GetFriend(req.FriendId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendNotSelf
|
code = pb.ErrorCode_FriendNotSelf
|
||||||
return
|
return
|
||||||
@ -52,11 +52,11 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
|
|||||||
// 将自己从对方好友列表中移除
|
// 将自己从对方好友列表中移除
|
||||||
targetFriendIds := utils.DeleteString(target.FriendIds, uid)
|
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,
|
"friendIds": targetFriendIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_FriendApplyError
|
code = pb.ErrorCode_FriendApplyError
|
||||||
this.moduleFriend.Error("删除好友",
|
this.module.Error("删除好友",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.FriendId},
|
log.Field{Key: "params", Value: req.FriendId},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -64,7 +64,7 @@ func (this *apiComp) Del(session comm.IUserSession, req *pb.FriendDelReq) (code
|
|||||||
return
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelBlackReq) (code pb.ErrorCode) {
|
func (this *apiComp) DelblackCheck(session comm.IUserSession, req *pb.FriendDelBlackReq) (code pb.ErrorCode) {
|
||||||
if req.FriendId == "" {
|
if req.FriendId == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
|
|||||||
self *pb.DBFriend
|
self *pb.DBFriend
|
||||||
)
|
)
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -34,11 +34,11 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
|
|||||||
//从黑名单列表中删除目标
|
//从黑名单列表中删除目标
|
||||||
self.BlackIds = utils.DeleteString(self.BlackIds, req.FriendId)
|
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,
|
"blackIds": self.BlackIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("删除黑名单",
|
this.module.Error("删除黑名单",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
)
|
)
|
||||||
@ -50,7 +50,7 @@ func (this *apiComp) Delblack(session comm.IUserSession, req *pb.FriendDelBlackR
|
|||||||
UserId: session.GetUserId(),
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func (this *apiComp) GetRelationCheck(session comm.IUserSession, req *pb.FriendGetRelationReq) (code pb.ErrorCode) {
|
func (this *apiComp) GetRelationCheck(session comm.IUserSession, req *pb.FriendGetRelationReq) (code pb.ErrorCode) {
|
||||||
if req.TargetUid == "" {
|
if req.TargetUid == "" {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -21,13 +21,13 @@ func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRel
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
self := this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self := this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(req.TargetUid)
|
target := this.module.modelFriend.GetFriend(req.TargetUid)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendTargetNoData
|
code = pb.ErrorCode_FriendTargetNoData
|
||||||
return
|
return
|
||||||
@ -48,7 +48,7 @@ func (this *apiComp) GetRelation(session comm.IUserSession, req *pb.FriendGetRel
|
|||||||
TargetUid: req.TargetUid,
|
TargetUid: req.TargetUid,
|
||||||
Status: status,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewardReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
self := this.moduleFriend.modelFriend.GetFriend(uid)
|
self := this.module.modelFriend.GetFriend(uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -29,18 +29,18 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
|
|||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"received": received,
|
"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
|
code = pb.ErrorCode_FriendApplyError
|
||||||
this.moduleFriend.Error("领奖",
|
this.module.Error("领奖",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
globalConf := this.moduleFriend.ModuleTools.GetGlobalConf()
|
globalConf := this.module.ModuleTools.GetGlobalConf()
|
||||||
if code = this.moduleFriend.DispenseRes(session, globalConf.FriendPeize, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, globalConf.FriendPeize, true); code != pb.ErrorCode_Success {
|
||||||
this.moduleFriend.Error("好友领奖励",
|
this.module.Error("好友领奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "reward", Value: globalConf.FriendPeize},
|
log.Field{Key: "reward", Value: globalConf.FriendPeize},
|
||||||
log.Field{Key: "code", Value: code},
|
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)}
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod
|
|||||||
list []*pb.FriendBase
|
list []*pb.FriendBase
|
||||||
)
|
)
|
||||||
|
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
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 //在线
|
base.OfflineTime = -1 //在线
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否已点赞
|
// 判断是否已点赞
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(userId)
|
target := this.module.modelFriend.GetFriend(userId)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod
|
|||||||
resp := &pb.FriendListResp{
|
resp := &pb.FriendListResp{
|
||||||
List: list,
|
List: list,
|
||||||
}
|
}
|
||||||
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeList, resp)
|
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeList, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -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
|
code = pb.ErrorCode_UserOffline
|
||||||
return
|
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)
|
var customErr = new(comm.CustomError)
|
||||||
if errors.As(err, &customErr) {
|
if errors.As(err, &customErr) {
|
||||||
code = customErr.Code
|
code = customErr.Code
|
||||||
@ -40,11 +40,11 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.FriendQiecuoReq)
|
|||||||
TargetUid: req.TargetUid,
|
TargetUid: req.TargetUid,
|
||||||
Uid: session.GetUserId(),
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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)
|
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 1}, req.TargetUid)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -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) {
|
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 {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//在线玩家列表
|
//在线玩家列表
|
||||||
cuList, err := this.moduleFriend.ModuleUser.UserOnlineList()
|
cuList, err := this.module.ModuleUser.UserOnlineList()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
@ -43,7 +43,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
|||||||
}
|
}
|
||||||
|
|
||||||
//检查目标v中的申请列表中是否有自己,
|
//检查目标v中的申请列表中是否有自己,
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(v.Uid)
|
target := this.module.modelFriend.GetFriend(v.Uid)
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -76,16 +76,16 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
|||||||
var userList []*pb.FriendBase
|
var userList []*pb.FriendBase
|
||||||
|
|
||||||
for _, uid := range randOnlineUsers {
|
for _, uid := range randOnlineUsers {
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(uid)
|
target := this.module.modelFriend.GetFriend(uid)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
this.moduleFriend.Debug("未找到好友",
|
this.module.Debug("未找到好友",
|
||||||
log.Field{Key: "uid", Value: uid})
|
log.Field{Key: "uid", Value: uid})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
base := this.setDefaultFriendUserBaseInfo(uid)
|
base := this.setDefaultFriendUserBaseInfo(uid)
|
||||||
if base == nil {
|
if base == nil {
|
||||||
this.moduleFriend.Debug("未找到玩家信息",
|
this.module.Debug("未找到玩家信息",
|
||||||
log.Field{Key: "uid", Value: uid})
|
log.Field{Key: "uid", Value: uid})
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendRandlistR
|
|||||||
rsp := &pb.FriendRandlistResp{
|
rsp := &pb.FriendRandlistResp{
|
||||||
List: userList,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuseReq) (code pb.ErrorCode) {
|
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.FriendRefuseReq) (code pb.ErrorCode) {
|
||||||
if len(req.FriendIds) == 0 {
|
if len(req.FriendIds) == 0 {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
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 {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -51,11 +51,11 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
|
|||||||
}
|
}
|
||||||
//更新
|
//更新
|
||||||
if optNum > 0 {
|
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,
|
"applyIds": self.ApplyIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("好友审批拒绝",
|
this.module.Error("好友审批拒绝",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req},
|
log.Field{Key: "params", Value: req},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -68,7 +68,7 @@ func (this *apiComp) Refuse(session comm.IUserSession, req *pb.FriendRefuseReq)
|
|||||||
Num: optNum,
|
Num: optNum,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := session.SendMsg(string(this.moduleFriend.GetType()), FriendSubTypeRefuse, resp)
|
err := session.SendMsg(string(this.module.GetType()), FriendSubTypeRefuse, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (code pb.ErrorCode) {
|
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.FriendSearchReq) (code pb.ErrorCode) {
|
||||||
if req.NickName == "" {
|
if req.NickName == "" {
|
||||||
code = pb.ErrorCode_FriendSearchNameEmpty
|
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
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -25,10 +25,10 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
|
|||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
resp := &pb.FriendSearchResp{}
|
resp := &pb.FriendSearchResp{}
|
||||||
|
|
||||||
users, err := this.moduleFriend.ModuleUser.SearchRmoteUser(req.NickName)
|
users, err := this.module.ModuleUser.SearchRmoteUser(req.NickName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("搜索玩家",
|
this.module.Error("搜索玩家",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "params", Value: req.NickName},
|
log.Field{Key: "params", Value: req.NickName},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
@ -49,7 +49,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
|
|||||||
ServerId: u.Sid,
|
ServerId: u.Sid,
|
||||||
}
|
}
|
||||||
|
|
||||||
target := this.moduleFriend.modelFriend.GetFriend(u.Uid)
|
target := this.module.modelFriend.GetFriend(u.Uid)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
|
|||||||
resp.Friends = append(resp.Friends, base)
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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{
|
resp := &pb.FriendStopResp{
|
||||||
IsSucc: true,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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)
|
&pb.FriendQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 3}, req.Uid)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
func (this *apiComp) ZanCheck(session comm.IUserSession, req *pb.FriendZanReq) (code pb.ErrorCode) {
|
func (this *apiComp) ZanCheck(session comm.IUserSession, req *pb.FriendZanReq) (code pb.ErrorCode) {
|
||||||
if len(req.FriendIds) == 0 {
|
if len(req.FriendIds) == 0 {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
|
|||||||
)
|
)
|
||||||
// 是否已给好友点赞
|
// 是否已给好友点赞
|
||||||
for _, v := range req.FriendIds {
|
for _, v := range req.FriendIds {
|
||||||
target = this.moduleFriend.modelFriend.GetFriend(v)
|
target = this.module.modelFriend.GetFriend(v)
|
||||||
if target == nil {
|
if target == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -54,12 +54,12 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
|
|||||||
target.ZanIds = append(target.ZanIds, selfId)
|
target.ZanIds = append(target.ZanIds, selfId)
|
||||||
target.GetZandIds = append(target.GetZandIds, 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,
|
"zanIds": target.ZanIds,
|
||||||
"getZandIds": target.GetZandIds,
|
"getZandIds": target.GetZandIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
this.moduleFriend.Error("点赞",
|
this.module.Error("点赞",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
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 {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 今日送出的友情点是否达到上限
|
// 今日送出的友情点是否达到上限
|
||||||
if ue.FriendPointOD >= this.moduleFriend.globalConf.FriendMaxsendnum {
|
if ue.FriendPointOD >= this.module.globalConf.FriendMaxsendnum {
|
||||||
code = pb.ErrorCode_FriendPointLimit
|
code = pb.ErrorCode_FriendPointLimit
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
|
|||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"friendPointOD": ue.FriendPointOD + pointTotal,
|
"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
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -93,13 +93,13 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
|
|||||||
Flag: true,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 赠送X次友情点
|
// 赠送X次友情点
|
||||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
|
// 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
|
return
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq
|
|||||||
list []*pb.FriendBase
|
list []*pb.FriendBase
|
||||||
)
|
)
|
||||||
|
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -37,7 +37,7 @@ func (this *apiComp) Zanlist(session comm.IUserSession, req *pb.FriendZanlistReq
|
|||||||
rsp := &pb.FriendZanlistResp{
|
rsp := &pb.FriendZanlistResp{
|
||||||
List: list,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
func (this *apiComp) ZanreceiveCheck(session comm.IUserSession, req *pb.FriendZanreceiveReq) (code pb.ErrorCode) {
|
func (this *apiComp) ZanreceiveCheck(session comm.IUserSession, req *pb.FriendZanreceiveReq) (code pb.ErrorCode) {
|
||||||
if len(req.FriendIds) == 0 {
|
if len(req.FriendIds) == 0 {
|
||||||
code = pb.ErrorCode_ReqParameterError
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
self = this.module.modelFriend.GetFriend(session.GetUserId())
|
||||||
if self == nil {
|
if self == nil {
|
||||||
code = pb.ErrorCode_FriendSelfNoData
|
code = pb.ErrorCode_FriendSelfNoData
|
||||||
return
|
return
|
||||||
@ -46,7 +46,7 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改获赞Id
|
// 修改获赞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,
|
"getZandIds": self.GetZandIds,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
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 {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 今日获赠的友情点是否达到上限
|
// 今日获赠的友情点是否达到上限
|
||||||
if ue.FriendPointID >= int32(this.moduleFriend.globalConf.FriendMaxgetnum) {
|
if ue.FriendPointID >= int32(this.module.globalConf.FriendMaxgetnum) {
|
||||||
code = pb.ErrorCode_FriendPointLimit
|
code = pb.ErrorCode_FriendPointLimit
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -70,12 +70,12 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
|
|||||||
"friendPoint": ue.FriendPoint + pointTotal,
|
"friendPoint": ue.FriendPoint + pointTotal,
|
||||||
"friendPointID": ue.FriendPointID + 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
|
code = pb.ErrorCode_DBError
|
||||||
return
|
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 {
|
&pb.FriendZanreceiveResp{Flag: true}); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -79,6 +79,6 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
|
|||||||
Cid: curFood,
|
Cid: curFood,
|
||||||
FirstGet: bFirst,
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -99,16 +99,16 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
|
|||||||
} else {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
}
|
}
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype34, 1, _hero.JuexingLv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype34, 1, _hero.JuexingLv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype119, 1, utils.ToInt32(_hero.HeroID)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype35, _hero.JuexingLv, utils.ToInt32(_hero.HeroID)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype118, _hero.Lv, _hero.JuexingLv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype118, _hero.Lv, _hero.JuexingLv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype120, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype120, 1))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype122, _hero.JuexingLv, _hero.Star))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype122, _hero.JuexingLv, _hero.Star))
|
||||||
cfg := this.module.configure.GetHeroConfig(_hero.HeroID)
|
cfg := this.module.configure.GetHeroConfig(_hero.HeroID)
|
||||||
if cfg != nil {
|
if cfg != nil {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype121, 1, cfg.Race))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype121, 1, cfg.Race))
|
||||||
|
|
||||||
//xx英雄满级、共鸣、觉醒至最高状态
|
//xx英雄满级、共鸣、觉醒至最高状态
|
||||||
nextAwaken := this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1)
|
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 {
|
if this.module.configure.GetHeroTalentMaxLv(_hero.HeroID) == _l {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype37, 1, cfg.Color))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype37, 1, cfg.Color))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
|
szTask = append(szTask, comm.GetBuriedParam(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.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
|
return
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
|
|||||||
price []int32 // 购买所需的价钱
|
price []int32 // 购买所需的价钱
|
||||||
totalCost float64 // 购买打折系数
|
totalCost float64 // 购买打折系数
|
||||||
udata *pb.DBUser
|
udata *pb.DBUser
|
||||||
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
|
||||||
)
|
)
|
||||||
update = make(map[string]interface{})
|
update = make(map[string]interface{})
|
||||||
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
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.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
|
||||||
//随机任务
|
//随机任务
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
|
// 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 {
|
for _, v := range give {
|
||||||
if v.A == comm.ItemType {
|
if v.A == comm.ItemType {
|
||||||
// this.module.ModuleRtask.SendToRtask(session, 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.Rtype65, v.N, utils.ToInt32(v.T)))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype65, v.N, utils.ToInt32(v.T)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for _, v := range need {
|
// for _, v := range need {
|
||||||
// if v.A == comm.AttrType && (v.T == comm.ResGold || v.T == comm.ResDiamond) {
|
// 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))
|
// // 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{
|
session.SendMsg(string(this.module.GetType()), "buy", &pb.HeroBuyResp{
|
||||||
IsSucc: true,
|
IsSucc: true,
|
||||||
Onebuy: record.Onebuy + req.BuyCount,
|
Onebuy: record.Onebuy + req.BuyCount,
|
||||||
|
@ -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})
|
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
|
||||||
// 通过融合获得指定英雄
|
// 通过融合获得指定英雄
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype139, utils.ToInt32(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
|
return
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,9 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 推送 世界任务消息
|
// 推送 世界任务消息
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype52, 1, utils.ToInt32(_hero.HeroID)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype53, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype53, 1))
|
||||||
|
|
||||||
// 检查是不是满级技能
|
// 检查是不是满级技能
|
||||||
maxLv := true
|
maxLv := true
|
||||||
@ -130,16 +130,16 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if maxLv {
|
if maxLv {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype54, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype54, 1))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype57, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype57, 1))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype174, 1, _hero.Star))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype174, 1, _hero.Star))
|
||||||
}
|
}
|
||||||
if cfg := this.module.configure.GetHeroConfig(_hero.HeroID); cfg != nil {
|
if cfg := this.module.configure.GetHeroConfig(_hero.HeroID); cfg != nil {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype55, 1, cfg.Color))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype55, 1, cfg.Color))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype56, 1, 1, cfg.Job))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype56, 1, 1, cfg.Job))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype116, lvUpCount, cfg.Race))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype116, lvUpCount, cfg.Race))
|
||||||
}
|
}
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID)))
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -83,20 +83,20 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 推送 世界任务消息
|
// 推送 世界任务消息
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype25, 1, utils.ToInt32(_hero.HeroID), _hero.Star))
|
||||||
|
|
||||||
if _hero.Star == 4 {
|
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 {
|
} 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 {
|
} 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.GetBuriedParam(comm.Rtype114, _hero.Star, utils.ToInt32(_hero.HeroID)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype115, 1, _hero.Star))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype115, 1, _hero.Star))
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -135,30 +135,30 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
Telnet: talent,
|
Telnet: talent,
|
||||||
TalentID: req.TalentID, // 返回刚学习过的天赋ID
|
TalentID: req.TalentID, // 返回刚学习过的天赋ID
|
||||||
})
|
})
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
// 查询英雄相关信息
|
// 查询英雄相关信息
|
||||||
if heroObj := this.module.QueryHeroByConfId(session.GetUserId(), talent.HeroId); heroObj != nil {
|
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.GetBuriedParam(comm.Rtype123, 1, int32(len(talent.Talent)), heroObj.Star))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype124, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype124, 1))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype125, 1, utils.ToInt32(heroObj.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype125, 1, utils.ToInt32(heroObj.HeroID)))
|
||||||
cfg := this.module.configure.GetHeroConfig(heroObj.HeroID)
|
cfg := this.module.configure.GetHeroConfig(heroObj.HeroID)
|
||||||
if cfg != nil {
|
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.GetBuriedParam(comm.Rtype127, 1, heroObj.Star))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype40, 1, int32(len(talent.Talent))))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype40, 1, int32(len(talent.Talent))))
|
||||||
nextAwaken := this.module.configure.GetHeroAwakenConfig(heroObj.HeroID, heroObj.JuexingLv+1)
|
nextAwaken := this.module.configure.GetHeroAwakenConfig(heroObj.HeroID, heroObj.JuexingLv+1)
|
||||||
if nextAwaken == nil { // 达到满级觉醒
|
if nextAwaken == nil { // 达到满级觉醒
|
||||||
if heroObj.Lv == this.module.configure.GetHeroMaxLv(heroObj.Star) {
|
if heroObj.Lv == this.module.configure.GetHeroMaxLv(heroObj.Star) {
|
||||||
|
|
||||||
if this.module.configure.GetHeroTalentMaxLv(heroObj.HeroID) == int32(len(talent.Talent)) {
|
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.GetBuriedParam(comm.Rtype37, 1, cfg.Color))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
|
szTask = append(szTask, comm.GetBuriedParam(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.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
|
return
|
||||||
|
@ -22,13 +22,13 @@ import (
|
|||||||
|
|
||||||
type ModelHero struct {
|
type ModelHero struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
moduleHero *Hero
|
module *Hero
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelHero) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelHero) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
this.TableName = comm.TableHero
|
this.TableName = comm.TableHero
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleHero = module.(*Hero)
|
this.module = module.(*Hero)
|
||||||
// 通过uid创建索引
|
// 通过uid创建索引
|
||||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
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 {
|
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 {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
objId := primitive.NewObjectID().Hex()
|
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 {
|
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 != nil {
|
||||||
if heroCfg.Skill != 0 {
|
if heroCfg.Skill != 0 {
|
||||||
hero.CaptainSkill = heroCfg.Skill
|
hero.CaptainSkill = heroCfg.Skill
|
||||||
@ -103,7 +103,7 @@ func (this *ModelHero) createSpecialHero(uid string, heroCfgId string) (hero *pb
|
|||||||
hero = this.InitHero(uid, heroCfgId)
|
hero = this.InitHero(uid, heroCfgId)
|
||||||
if hero != nil {
|
if hero != nil {
|
||||||
if err = this.AddList(uid, hero.Id, hero); err != nil {
|
if err = this.AddList(uid, hero.Id, hero); err != nil {
|
||||||
this.moduleHero.Errorf("%v", err)
|
this.module.Errorf("%v", err)
|
||||||
return
|
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.AddList(newHero.Uid, newHero.Id, newHero)
|
||||||
|
|
||||||
// 星座图属性计算
|
// 星座图属性计算
|
||||||
this.moduleHero.moduleHoroscope.ComputeHeroNumeric(uid, hero)
|
this.module.moduleHoroscope.ComputeHeroNumeric(uid, hero)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,17 +139,17 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
|
|||||||
hero = this.InitHero(uid, heroCfgId)
|
hero = this.InitHero(uid, heroCfgId)
|
||||||
if hero != nil {
|
if hero != nil {
|
||||||
hero.SameCount = 1 // 新需求 不需要判断叠加
|
hero.SameCount = 1 // 新需求 不需要判断叠加
|
||||||
if this.moduleHero.IsCross() {
|
if this.module.IsCross() {
|
||||||
if model, err = this.moduleHero.GetDBModelByUid(uid, this.TableName); err != nil {
|
if model, err = this.module.GetDBModelByUid(uid, this.TableName); err != nil {
|
||||||
this.moduleHero.Errorln(err)
|
this.module.Errorln(err)
|
||||||
} else {
|
} else {
|
||||||
if err = model.AddList(uid, hero.Id, hero); err != nil {
|
if err = model.AddList(uid, hero.Id, hero); err != nil {
|
||||||
this.moduleHero.Errorf("err:%v", err)
|
this.module.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err = this.AddList(uid, hero.Id, hero); err != nil {
|
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
|
hero.SameCount -= count // 数量-1
|
||||||
if hero.SameCount == 0 {
|
if hero.SameCount == 0 {
|
||||||
if err := this.DelListlds(uid, []string{hero.Id}); err != nil {
|
if err := this.DelListlds(uid, []string{hero.Id}); err != nil {
|
||||||
this.moduleHero.Errorf("%v", err)
|
this.module.Errorf("%v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
update := map[string]interface{}{
|
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)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
|||||||
func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) {
|
func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) {
|
||||||
hero.JuexProperty = make(map[string]int32)
|
hero.JuexProperty = make(map[string]int32)
|
||||||
for i := 1; i <= int(hero.JuexingLv); i++ {
|
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 awakenData != nil {
|
||||||
if len(awakenData.Phasebonus) != 2 {
|
if len(awakenData.Phasebonus) != 2 {
|
||||||
continue
|
continue
|
||||||
@ -237,7 +237,7 @@ func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) {
|
|||||||
case comm.ResonanceDefPro:
|
case comm.ResonanceDefPro:
|
||||||
hero.JuexProperty[comm.Def] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Def])))
|
hero.JuexProperty[comm.Def] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Def])))
|
||||||
default:
|
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 hero.SuiteId != 0 { //套装
|
||||||
if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteId); err != nil {
|
if configure, err := this.module.configure.GetEquipsuit(hero.SuiteId); err != nil {
|
||||||
this.moduleHero.Errorln(err)
|
this.module.Errorln(err)
|
||||||
} else {
|
} else {
|
||||||
for k, v := range configure.SetBonuses {
|
for k, v := range configure.SetBonuses {
|
||||||
addProperty[k] += v
|
addProperty[k] += v
|
||||||
@ -298,8 +298,8 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if hero.SuiteExtId != 0 { //套装
|
if hero.SuiteExtId != 0 { //套装
|
||||||
if configure, err := this.moduleHero.configure.GetEquipsuit(hero.SuiteExtId); err != nil {
|
if configure, err := this.module.configure.GetEquipsuit(hero.SuiteExtId); err != nil {
|
||||||
this.moduleHero.Errorln(err)
|
this.module.Errorln(err)
|
||||||
} else {
|
} else {
|
||||||
for k, v := range configure.SetBonuses {
|
for k, v := range configure.SetBonuses {
|
||||||
addProperty[k] += v
|
addProperty[k] += v
|
||||||
@ -366,7 +366,7 @@ func (this *ModelHero) setEquipment(uid string, hero *pb.DBHero) (newHero *pb.DB
|
|||||||
update["suite2Lv"] = suite2Lv
|
update["suite2Lv"] = suite2Lv
|
||||||
|
|
||||||
if err = this.ChangeList(hero.Uid, hero.Id, update); err != nil {
|
if err = this.ChangeList(hero.Uid, hero.Id, update); err != nil {
|
||||||
this.moduleHero.Errorf("%v", err)
|
this.module.Errorf("%v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
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{}{
|
if err = this.ChangeList(uid, hero.Id, map[string]interface{}{
|
||||||
"property": hero.Property,
|
"property": hero.Property,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
this.moduleHero.Errorf("mergeMainProperty err %v", err)
|
this.module.Errorf("mergeMainProperty err %v", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -396,14 +396,14 @@ func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[st
|
|||||||
"addProperty": data,
|
"addProperty": data,
|
||||||
"equipSkill": skills,
|
"equipSkill": skills,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
this.moduleHero.Errorf("mergeAddProperty err %v", err)
|
this.module.Errorf("mergeAddProperty err %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelHero) StarAtkAddition(star int32) (addValue float32) {
|
func (this *ModelHero) StarAtkAddition(star int32) (addValue float32) {
|
||||||
for i := 1; i <= int(star); i++ {
|
for i := 1; i <= int(star); i++ {
|
||||||
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
|
starCfg := this.module.configure.GetHeroStar(int32(i))
|
||||||
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
cfg := this.module.configure.GetHeroLv(starCfg.Level)
|
||||||
addValue += cfg.Atk * starCfg.StarupAtk / 1000.0
|
addValue += cfg.Atk * starCfg.StarupAtk / 1000.0
|
||||||
}
|
}
|
||||||
return addValue
|
return addValue
|
||||||
@ -411,8 +411,8 @@ func (this *ModelHero) StarAtkAddition(star int32) (addValue float32) {
|
|||||||
|
|
||||||
func (this *ModelHero) StarDefAddition(star int32) (addValue float32) {
|
func (this *ModelHero) StarDefAddition(star int32) (addValue float32) {
|
||||||
for i := 1; i <= int(star); i++ {
|
for i := 1; i <= int(star); i++ {
|
||||||
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
|
starCfg := this.module.configure.GetHeroStar(int32(i))
|
||||||
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
cfg := this.module.configure.GetHeroLv(starCfg.Level)
|
||||||
addValue += cfg.Def * starCfg.StarupDef / 1000.0
|
addValue += cfg.Def * starCfg.StarupDef / 1000.0
|
||||||
}
|
}
|
||||||
return addValue
|
return addValue
|
||||||
@ -420,8 +420,8 @@ func (this *ModelHero) StarDefAddition(star int32) (addValue float32) {
|
|||||||
|
|
||||||
func (this *ModelHero) StarHpAddition(star int32) (addValue float32) {
|
func (this *ModelHero) StarHpAddition(star int32) (addValue float32) {
|
||||||
for i := 1; i <= int(star); i++ {
|
for i := 1; i <= int(star); i++ {
|
||||||
starCfg := this.moduleHero.configure.GetHeroStar(int32(i))
|
starCfg := this.module.configure.GetHeroStar(int32(i))
|
||||||
cfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
cfg := this.module.configure.GetHeroLv(starCfg.Level)
|
||||||
|
|
||||||
//this.moduleHero.Debugf("cfg.Atk= %f,starCfg.StarupHp = %f,addValue= %f", cfg.Atk, starCfg.StarupHp, addValue)
|
//this.moduleHero.Debugf("cfg.Atk= %f,starCfg.StarupHp = %f,addValue= %f", cfg.Atk, starCfg.StarupHp, addValue)
|
||||||
addValue += cfg.Hp * starCfg.StarupHp / 1000.0
|
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) {
|
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
||||||
growCfg := this.moduleHero.configure.GetHeroLvgrow(hero.HeroID)
|
growCfg := this.module.configure.GetHeroLvgrow(hero.HeroID)
|
||||||
heroCfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID)
|
heroCfg := this.module.configure.GetHeroConfig(hero.HeroID)
|
||||||
lvCfg := this.moduleHero.configure.GetHeroLv(hero.Lv)
|
lvCfg := this.module.configure.GetHeroLv(hero.Lv)
|
||||||
starCfg := this.moduleHero.configure.GetHeroStar(hero.Star)
|
starCfg := this.module.configure.GetHeroStar(hero.Star)
|
||||||
starLvfg := this.moduleHero.configure.GetHeroLv(starCfg.Level)
|
starLvfg := this.module.configure.GetHeroLv(starCfg.Level)
|
||||||
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,7 +466,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
|||||||
|
|
||||||
if hero.Id != "" { // objID 为空表示是怪物对象 不享受天赋属性加成
|
if hero.Id != "" { // objID 为空表示是怪物对象 不享受天赋属性加成
|
||||||
this.resetTalentProperty(hero)
|
this.resetTalentProperty(hero)
|
||||||
this.moduleHero.moduleHoroscope.ComputeHeroNumeric(hero.Uid, hero)
|
this.module.moduleHoroscope.ComputeHeroNumeric(hero.Uid, hero)
|
||||||
}
|
}
|
||||||
this.resetJuexingProperty(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 {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,10 +490,10 @@ func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DB
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelHero) cleanData(uid string) {
|
func (this *ModelHero) cleanData(uid string) {
|
||||||
userList := this.moduleHero.GetHeroList(uid)
|
userList := this.module.GetHeroList(uid)
|
||||||
for _, v := range userList {
|
for _, v := range userList {
|
||||||
if err := this.DelListlds(uid, []string{v.Id}); err != nil {
|
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
|
curLv = hero.Lv
|
||||||
preLv = curLv
|
preLv = curLv
|
||||||
var maxLv int32 // 校验等级达到上限
|
var maxLv int32 // 校验等级达到上限
|
||||||
maxLv = this.moduleHero.configure.GetHeroMaxLv(hero.Star)
|
maxLv = this.module.configure.GetHeroMaxLv(hero.Star)
|
||||||
_data := this.moduleHero.configure.GetHeroLv(curLv)
|
_data := this.module.configure.GetHeroLv(curLv)
|
||||||
if _data != nil {
|
if _data != nil {
|
||||||
var maxExp int32
|
var maxExp int32
|
||||||
maxExp = _data.Heroexp
|
maxExp = _data.Heroexp
|
||||||
if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级
|
if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级
|
||||||
curAddExp = 0 // 已经满级的时候
|
curAddExp = 0 // 已经满级的时候
|
||||||
//code = pb.ErrorCode_HeroMaxLv //
|
//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
|
return
|
||||||
}
|
}
|
||||||
curExp += exp // 先把经验加上
|
curExp += exp // 先把经验加上
|
||||||
@ -544,7 +544,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
|
|||||||
} else { // 升级操作
|
} else { // 升级操作
|
||||||
curExp -= maxExp
|
curExp -= maxExp
|
||||||
curLv += 1 // 经验够了 那么等级+1
|
curLv += 1 // 经验够了 那么等级+1
|
||||||
_data = this.moduleHero.configure.GetHeroLv(curLv)
|
_data = this.module.configure.GetHeroLv(curLv)
|
||||||
if _data == nil { // 等级加失败了 回到原来的等级
|
if _data == nil { // 等级加失败了 回到原来的等级
|
||||||
curLv -= 1
|
curLv -= 1
|
||||||
break
|
break
|
||||||
@ -556,7 +556,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
|
|||||||
curAddExp = exp // 真正加的经验
|
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["lv"] = curLv
|
||||||
update["exp"] = curExp
|
update["exp"] = curExp
|
||||||
|
|
||||||
@ -571,34 +571,34 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
|
|||||||
}
|
}
|
||||||
if model != nil {
|
if model != nil {
|
||||||
if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != 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
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
|
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
|
code = pb.ErrorCode_DBError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if curLv-preLv > 0 { // 升级了 统计任务
|
if curLv-preLv > 0 { // 升级了 统计任务
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype113, curLv-preLv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, curLv-preLv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype23, 1, hero.Star, hero.Lv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype23, 1, hero.Star, hero.Lv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype24, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype24, 1))
|
||||||
// szTask = append(szTask, comm.GettaskParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
|
// szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID)))
|
||||||
|
|
||||||
if cfg := this.moduleHero.configure.GetHeroConfig(hero.HeroID); cfg != nil {
|
if cfg := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype32, 1, cfg.Color, hero.Lv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype32, 1, cfg.Color, hero.Lv))
|
||||||
|
|
||||||
//xx英雄满级、共鸣、觉醒至最高状态
|
//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 nextAwaken == nil { // 达到满级觉醒
|
||||||
if hero.Lv == this.moduleHero.configure.GetHeroMaxLv(hero.Star) {
|
if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) {
|
||||||
var _l int32
|
var _l int32
|
||||||
talent, err := this.moduleHero.modelTalent.GetHerotalent(session.GetUserId())
|
talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId())
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for _, v := range talent {
|
for _, v := range talent {
|
||||||
if v.HeroId == hero.HeroID {
|
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 {
|
if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype37, 1, cfg.Color))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype37, 1, cfg.Color))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype38, 1))
|
szTask = append(szTask, comm.GetBuriedParam(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.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, hero.JuexingLv))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype111, 1, hero.Lv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype111, 1, hero.Lv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype112, 1, hero.Lv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype113, hero.Lv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype113, hero.Lv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype33, 1, 1, hero.Lv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype33, 1, 1, hero.Lv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype118, hero.Lv, hero.JuexingLv))
|
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)
|
//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 {
|
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 {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTale
|
|||||||
|
|
||||||
_heroMap["talentProperty"] = hero.TalentProperty
|
_heroMap["talentProperty"] = hero.TalentProperty
|
||||||
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
|
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 := make(map[string]interface{}, 0)
|
||||||
_heroMap["talentProperty"] = hero.TalentProperty
|
_heroMap["talentProperty"] = hero.TalentProperty
|
||||||
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
|
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 {
|
if hero == nil {
|
||||||
return
|
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 {
|
for _, v := range rst {
|
||||||
if v.HeroId == hero.HeroID { // 找到对应的英雄
|
if v.HeroId == hero.HeroID { // 找到对应的英雄
|
||||||
for k := range v.Talent {
|
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 {
|
if conf.Hp != -1 {
|
||||||
attr[0] += conf.Hp
|
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) {
|
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)
|
heros := make([]*pb.DBHero, 0)
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
heroCfg := this.moduleHero.configure.GetHeroConfig(heroCfgId)
|
heroCfg := this.module.configure.GetHeroConfig(heroCfgId)
|
||||||
if heroCfg == nil {
|
if heroCfg == nil {
|
||||||
err = errors.New("not found hero configID")
|
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
|
return
|
||||||
}
|
}
|
||||||
if this.moduleHero.IsCross() {
|
if this.module.IsCross() {
|
||||||
if dbModel, err1 := this.moduleHero.GetDBModelByUid(uid, this.TableName); err1 == nil {
|
if dbModel, err1 := this.module.GetDBModelByUid(uid, this.TableName); err1 == nil {
|
||||||
if err = dbModel.GetList(uid, &heros); err != nil {
|
if err = dbModel.GetList(uid, &heros); err != nil {
|
||||||
this.moduleHero.Errorf("err:%v", err)
|
this.module.Errorf("err:%v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.moduleHero.Errorln(err) // 获取跨服对象失败
|
this.module.Errorln(err) // 获取跨服对象失败
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err = this.GetList(uid, &heros); err != nil {
|
if err = this.GetList(uid, &heros); err != nil {
|
||||||
this.moduleHero.Errorf("err:%v", err)
|
this.module.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bFirst = true
|
bFirst = true
|
||||||
@ -912,7 +912,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
|||||||
|
|
||||||
// 如果技能是满级 则转成其他道具
|
// 如果技能是满级 则转成其他道具
|
||||||
if this.checkHeroAllSkillMax(hero) {
|
if this.checkHeroAllSkillMax(hero) {
|
||||||
list := this.moduleHero.ModuleTools.GetGlobalConf().Moonshopmoney
|
list := this.module.ModuleTools.GetGlobalConf().Moonshopmoney
|
||||||
if list != nil {
|
if list != nil {
|
||||||
|
|
||||||
for pos, v := range list {
|
for pos, v := range list {
|
||||||
@ -945,7 +945,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
// expitem 获得
|
// 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
|
_mp := rst.Expitem
|
||||||
bAdd := false
|
bAdd := false
|
||||||
if heroCfg.Expitemnum > 0 {
|
if heroCfg.Expitemnum > 0 {
|
||||||
@ -960,7 +960,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if bAdd {
|
if bAdd {
|
||||||
this.moduleHero.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||||
"expitem": _mp,
|
"expitem": _mp,
|
||||||
})
|
})
|
||||||
for i := 0; i < int(count); i++ {
|
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 { // 资源统一发放
|
if len(res) > 0 { // 资源统一发放
|
||||||
this.moduleHero.DispenseRes(session, res, true)
|
this.module.DispenseRes(session, res, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -985,7 +985,7 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
|||||||
// 校验当前技能是否是满级
|
// 校验当前技能是否是满级
|
||||||
func (this *ModelHero) checkHeroAllSkillMax(hero *pb.DBHero) bool {
|
func (this *ModelHero) checkHeroAllSkillMax(hero *pb.DBHero) bool {
|
||||||
for _, v := range hero.NormalSkill {
|
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
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1016,7 +1016,7 @@ func (this *ModelHero) SetHeroFetterProperty(hero *pb.DBHero, attr []*cfg.Gameat
|
|||||||
case comm.DefPro:
|
case comm.DefPro:
|
||||||
hero.Fetters[comm.Def] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Def])))
|
hero.Fetters[comm.Def] += int32(math.Floor((float64(value) / 1000) * float64(hero.Property[comm.Def])))
|
||||||
default:
|
default:
|
||||||
this.moduleHero.Errorf("unkonw hero fetter property:%v", key)
|
this.module.Errorf("unkonw hero fetter property:%v", key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,11 +96,11 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
|
|||||||
// 查品质
|
// 查品质
|
||||||
cfg := this.configure.GetHeroConfig(heroCfgId)
|
cfg := this.configure.GetHeroConfig(heroCfgId)
|
||||||
if cfg != nil {
|
if cfg != nil {
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype30, 1, cfg.Color))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype30, 1, cfg.Color))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype31, 1, cfg.Color))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype31, 1, cfg.Color))
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -167,14 +167,14 @@ func (this *Hero) SendRdTask(session comm.IUserSession) {
|
|||||||
equipmap[v.SuiteExtId][v.Suite2Star]++
|
equipmap[v.SuiteExtId][v.Suite2Star]++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
for k, v := range equipmap {
|
for k, v := range equipmap {
|
||||||
for k1, v1 := range v {
|
for k1, v1 := range v {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype46, v1, k1, k))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype46, v1, k1, k))
|
||||||
//this.ModuleRtask.SendToRtask(session, 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{}
|
hero = &pb.DBHero{}
|
||||||
if err = sr.Decode(hero); err != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
@ -433,7 +433,7 @@ func (this *Hero) QueryCrossHeroinfo(oid string) (hero *pb.DBHero, err error) {
|
|||||||
}); res == nil {
|
}); res == nil {
|
||||||
hero = &pb.DBHero{}
|
hero = &pb.DBHero{}
|
||||||
if err = res.Decode(hero); err != nil {
|
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
|
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) {
|
func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
|
||||||
data := this.modelHero.moduleHero.configure.GetHeroConfigData()
|
data := this.modelHero.module.configure.GetHeroConfigData()
|
||||||
var (
|
var (
|
||||||
changeHero []*pb.DBHero
|
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) {
|
func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCount int32, itype bool) {
|
||||||
// 任务统计
|
// 任务统计
|
||||||
var (
|
var (
|
||||||
szTask []*comm.TaskParam
|
szTask []*comm.BuriedParam
|
||||||
)
|
)
|
||||||
if itype { //普通招募
|
if itype { //普通招募
|
||||||
if drawCount == 10 {
|
if drawCount == 10 {
|
||||||
@ -730,35 +730,35 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
|
|||||||
sz[star]++
|
sz[star]++
|
||||||
}
|
}
|
||||||
for k := range sz {
|
for k := range sz {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype17, 1, k))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype17, 1, k))
|
||||||
//this.ModuleRtask.SendToRtask(session, comm.Rtype17, 1, k)
|
//this.ModuleBuried.SendToRtask(session, comm.Rtype17, 1, k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype14, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype14, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype18, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype18, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype141, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype141, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype143, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype143, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype145, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype145, drawCount))
|
||||||
|
|
||||||
} else { // 阵营招募
|
} else { // 阵营招募
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype15, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype15, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype19, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype19, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype142, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype142, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype144, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype144, drawCount))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype146, drawCount))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype146, drawCount))
|
||||||
if drawCount == 10 {
|
if drawCount == 10 {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype91, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype91, 1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, star := range szStar {
|
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 {
|
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))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype89, drawCount))
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
|
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()) {
|
for sr.Next(context.TODO()) {
|
||||||
_hero := &pb.DBHero{}
|
_hero := &pb.DBHero{}
|
||||||
if err = sr.Decode(_hero); err != nil {
|
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)
|
hero = append(hero, _hero)
|
||||||
}
|
}
|
||||||
@ -968,7 +968,7 @@ func (this *Hero) QueryCrossMultipleHeroinfo(oid []string) (hero []*pb.DBHero, e
|
|||||||
for sr.Next(context.TODO()) {
|
for sr.Next(context.TODO()) {
|
||||||
_hero := &pb.DBHero{}
|
_hero := &pb.DBHero{}
|
||||||
if err = sr.Decode(_hero); err != nil {
|
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)
|
hero = append(hero, _hero)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.HoroscopeUpgrade
|
|||||||
}
|
}
|
||||||
info.Nodes[conf.NodeId] = conf.Lv + 1
|
info.Nodes[conf.NodeId] = conf.Lv + 1
|
||||||
if info.Nodes[conf.NodeId] == 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 {
|
if err = this.module.modelHoroscope.updateInfo(session, info); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
|
@ -23,11 +23,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
|||||||
mapData map[string]interface{}
|
mapData map[string]interface{}
|
||||||
newChallenge bool // 新的关卡
|
newChallenge bool // 新的关卡
|
||||||
reward []*cfg.Gameatn
|
reward []*cfg.Gameatn
|
||||||
bWin bool // 战斗是否胜利
|
bWin bool // 战斗是否胜利
|
||||||
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
|
||||||
del []string // 自动出售的装备
|
del []string // 自动出售的装备
|
||||||
atno []*pb.UserAtno // atno 类型
|
atno []*pb.UserAtno // atno 类型
|
||||||
res []*cfg.Gameatn // 最后获得的资源
|
res []*cfg.Gameatn // 最后获得的资源
|
||||||
)
|
)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
reward = make([]*cfg.Gameatn, 0)
|
reward = make([]*cfg.Gameatn, 0)
|
||||||
@ -145,18 +145,18 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
|||||||
Asset: atno,
|
Asset: atno,
|
||||||
Sell: del,
|
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.Rtype81, req.Difficulty, req.BossType)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype82, 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.GetBuriedParam(comm.Rtype81, req.Difficulty, req.BossType))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype82, 1, req.BossType))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype82, 1, req.BossType))
|
||||||
// 狩猎副本掉落觉醒材料
|
// 狩猎副本掉落觉醒材料
|
||||||
for _, v := range reward {
|
for _, v := range reward {
|
||||||
if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
|
if _conf, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
|
||||||
if _conf.Usetype == comm.UseType8 {
|
if _conf.Usetype == comm.UseType8 {
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N)
|
// 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, err := this.module.configure.GetItemConfigureData(v.T); err == nil {
|
||||||
if _conf.Usetype == comm.UseType8 {
|
if _conf.Usetype == comm.UseType8 {
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype154, v.N)
|
// 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 {
|
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))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype83, 1, req.BossType, req.Difficulty))
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -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.Rtype21, 1)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, utils.ToInt32(sale.Prize[0].T))
|
// 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: //自选宝箱
|
case 4: //自选宝箱
|
||||||
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
||||||
|
@ -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) {
|
func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, bPush bool) (change []*pb.DB_UserItemData, code pb.ErrorCode) {
|
||||||
var (
|
var (
|
||||||
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -160,12 +160,12 @@ func (this *Items) AddItems(session comm.IUserSession, items map[string]int32, b
|
|||||||
}
|
}
|
||||||
for k, v := range items {
|
for k, v := range items {
|
||||||
if v > 0 {
|
if v > 0 {
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype187, v, utils.ToInt32(k)))
|
tasks = append(tasks, comm.GetBuriedParam(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.Rtype170, utils.ToInt32(k), v)) // 20230526 移除170 任务
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(tasks) > 0 {
|
if len(tasks) > 0 {
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -157,11 +157,11 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype132, 1, _heroObj.Favorlv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype132, 1, _heroObj.Favorlv))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid)))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype133, _heroObj.Favorlv, utils.ToInt32(_heroObj.Heroid)))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype134, upLv))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype134, upLv))
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -26,8 +26,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
|||||||
first bool // 判断是否是首通
|
first bool // 判断是否是首通
|
||||||
update map[string]interface{}
|
update map[string]interface{}
|
||||||
rsp *pb.MlineChallengeOverResp
|
rsp *pb.MlineChallengeOverResp
|
||||||
star int32 // 评星
|
star int32 // 评星
|
||||||
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
tasks []*comm.BuriedParam = make([]*comm.BuriedParam, 0)
|
||||||
)
|
)
|
||||||
rsp = &pb.MlineChallengeOverResp{}
|
rsp = &pb.MlineChallengeOverResp{}
|
||||||
update = make(map[string]interface{})
|
update = make(map[string]interface{})
|
||||||
@ -184,8 +184,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
|||||||
// 主线任务统计 Rtype60
|
// 主线任务统计 Rtype60
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype60, 1)
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.StageId))
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype61, int32(req.StageId))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype60, 1))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype60, 1))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype61, 1, int32(req.StageId)))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype61, 1, int32(req.StageId)))
|
||||||
var (
|
var (
|
||||||
ChapterStar int32
|
ChapterStar int32
|
||||||
bAll3Star bool
|
bAll3Star bool
|
||||||
@ -204,10 +204,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
|||||||
bAll3Star = false
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype158, curChapter.ChapterId, ChapterStar)
|
||||||
if bAll3Star {
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype159, curChapter.ChapterId)
|
||||||
}
|
}
|
||||||
for _, v2 := range list {
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype160, allStar)
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype160, allStar))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype160, allStar))
|
||||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -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})
|
this.Debug("消耗玩家资源", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "attrs", Value: attrs})
|
||||||
if count, ok := attrs[comm.ResDiamond]; ok {
|
if count, ok := attrs[comm.ResDiamond]; ok {
|
||||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype104, -count)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype104, -count)
|
||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype104, -count))
|
go this.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype104, -count))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(items) > 0 {
|
if len(items) > 0 {
|
||||||
|
@ -47,7 +47,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype88, 1)
|
// 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 {
|
} else {
|
||||||
session.SendMsg(string(this.module.GetType()), "battle", &pb.MoonfantasyBattleResp{Code: cd})
|
session.SendMsg(string(this.module.GetType()), "battle", &pb.MoonfantasyBattleResp{Code: cd})
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
|
|||||||
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
|
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})
|
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)
|
// 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string
|
|||||||
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
|
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})
|
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)
|
// 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +144,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
return
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,6 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.PracticeAcceptReq
|
|||||||
|
|
||||||
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
this.module.SendMsgToUser(string(this.module.GetType()), "qiecuonotify",
|
||||||
&pb.PracticeQiecuonotifyPush{Uid: session.GetUserId(), NotifyType: 2}, req.Uid)
|
&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
|
return
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func (this *apiComp) GetGymBuff(session comm.IUserSession, req *pb.PracticeGetGy
|
|||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
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})
|
session.SendMsg(string(this.module.GetType()), "getgymbuff", &pb.PracticeGetGymBuffResp{Buffid: buff.Id})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ func (this *apiComp) Loot(session comm.IUserSession, req *pb.PracticeLootReq) (c
|
|||||||
} else {
|
} else {
|
||||||
this.module.PutUserSession(_session)
|
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})
|
session.SendMsg(string(this.module.GetType()), "loot", &pb.PracticeLootResp{Friend: req.Friend, Pillar: froom.Pillarf})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic
|
|||||||
"refresh": room.Refresh,
|
"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 {
|
} else {
|
||||||
room.Npcstate = 1
|
room.Npcstate = 1
|
||||||
room.Battlenum++
|
room.Battlenum++
|
||||||
|
@ -102,7 +102,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
|
|||||||
"knapsack": room.Knapsack,
|
"knapsack": room.Knapsack,
|
||||||
filed: pillar,
|
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})
|
session.SendMsg(string(this.module.GetType()), "practice", &pb.PracticePracticeResp{Pillar: pillar})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
|
|||||||
this.module.PutUserSession(_session)
|
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})
|
session.SendMsg(string(this.module.GetType()), "receive", &pb.PracticeReceiveResp{Pillar: pillar, Knapsack: room.Knapsack})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq
|
|||||||
filed: pillar,
|
filed: pillar,
|
||||||
"pillarf": room.Pillarf,
|
"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})
|
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ func (this *Practice) RPC_ModulePracticeUnLockPillar(ctx context.Context, args *
|
|||||||
this.atlas.CheckActivatePandaAtlasCollect(args.Param1, "100001")
|
this.atlas.CheckActivatePandaAtlasCollect(args.Param1, "100001")
|
||||||
break
|
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 {
|
// for _, v := range configure {
|
||||||
// if v.UnlockCondition == int32(taskid) {
|
// if v.UnlockCondition == int32(taskid) {
|
||||||
// switch v.Id {
|
// switch v.Id {
|
||||||
|
@ -6,20 +6,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// RtaskSubTypeGetrecord = "getrecord" //任务数据
|
// RtaskSubTypeGetrecord = "getrecord" //任务数据
|
||||||
// RtaskSubTypeSend = "send" //触发任务
|
// RtaskSubTypeSend = "send" //触发任务
|
||||||
)
|
)
|
||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
modules.MCompGate
|
modules.MCompGate
|
||||||
service core.IService
|
service core.IService
|
||||||
moduleRtask *ModuleRtask
|
module *ModuleRtask
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件初始化接口
|
// 组件初始化接口
|
||||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
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)
|
err = this.MCompGate.Init(service, module, comp, options)
|
||||||
this.moduleRtask = module.(*ModuleRtask)
|
this.module = module.(*ModuleRtask)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
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 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
|
rsp.Flag = false
|
||||||
}
|
}
|
||||||
} else if req.GroupId != 0 {
|
} else if req.GroupId != 0 {
|
||||||
// 获取当前玩家
|
// 获取当前玩家
|
||||||
rtask := this.moduleRtask.modelRtask.GetRtask(session.GetUserId())
|
rtask := this.module.modelRtask.GetRtask(session.GetUserId())
|
||||||
if rtask == nil {
|
if rtask == nil {
|
||||||
code = pb.ErrorCode_RtaskNoRtask
|
code = pb.ErrorCode_RtaskNoRtask
|
||||||
return
|
return
|
||||||
@ -43,17 +43,17 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod
|
|||||||
"frtaskIds": rtask.FrtaskIds,
|
"frtaskIds": rtask.FrtaskIds,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.moduleRtask.modelRtask.Change(rtask.Uid, update)
|
this.module.modelRtask.Change(rtask.Uid, update)
|
||||||
} else {
|
} else {
|
||||||
this.moduleRtask.TriggerTask(session.GetUserId(), &comm.TaskParam{
|
// this.module.ModuleBuried.TriggerBuried(session.GetUserId(), &comm.BuriedParam{
|
||||||
TT: comm.TaskType(req.RtaskType),
|
// TT: comm.TaskType(req.RtaskType),
|
||||||
Params: req.Params,
|
// Params: req.Params,
|
||||||
})
|
// })
|
||||||
|
|
||||||
rsp.Flag = true
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -17,14 +17,14 @@ import (
|
|||||||
|
|
||||||
type ModelRtaskRecord struct {
|
type ModelRtaskRecord struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
moduleRtask *ModuleRtask
|
module *ModuleRtask
|
||||||
service core.IService
|
service core.IService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
this.TableName = comm.TableRtaskRecord
|
this.TableName = comm.TableRtaskRecord
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleRtask = module.(*ModuleRtask)
|
this.module = module.(*ModuleRtask)
|
||||||
this.service = service
|
this.service = service
|
||||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
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
|
// 配置表: rdtask_condi
|
||||||
func (this *ModelRtaskRecord) getRecord(uid string) *pb.DBRtaskRecord {
|
func (this *ModelRtaskRecord) getRecord(uid string) *pb.DBRtaskRecord {
|
||||||
record := &pb.DBRtaskRecord{}
|
record := &pb.DBRtaskRecord{}
|
||||||
if this.moduleRtask.IsCross() {
|
if this.module.IsCross() {
|
||||||
var (
|
var (
|
||||||
stag string
|
stag string
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
|
@ -15,14 +15,14 @@ import (
|
|||||||
|
|
||||||
type ModelRtask struct {
|
type ModelRtask struct {
|
||||||
modules.MCompModel
|
modules.MCompModel
|
||||||
moduleRtask *ModuleRtask
|
module *ModuleRtask
|
||||||
service core.IService
|
service core.IService
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelRtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelRtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
this.TableName = comm.TableRtask
|
this.TableName = comm.TableRtask
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleRtask = module.(*ModuleRtask)
|
this.module = module.(*ModuleRtask)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ func (this *ModelRtask) updateUserRtaskId(uid string, rtaskId int32) (err error)
|
|||||||
ex_update := map[string]interface{}{
|
ex_update := map[string]interface{}{
|
||||||
"rtaskId": rtaskId,
|
"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
|
return nil, true
|
||||||
}
|
}
|
||||||
|
|
||||||
conf, err := this.moduleRtask.configure.getRtaskTypeById(condiId)
|
conf, err := this.module.configure.getRtaskTypeById(condiId)
|
||||||
if err != nil || conf == nil {
|
if err != nil || conf == nil {
|
||||||
errors.Errorf("conf not found condiID: %v", condiId)
|
errors.Errorf("conf not found condiID: %v", condiId)
|
||||||
return
|
return
|
||||||
@ -70,9 +70,9 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32, record *pb.DBRtask
|
|||||||
|
|
||||||
//验证限定条件
|
//验证限定条件
|
||||||
var condi *rtaskCondHandle
|
var condi *rtaskCondHandle
|
||||||
cond, ok := this.moduleRtask.handleMap.Load(condiId)
|
cond, ok := this.module.handleMap.Load(condiId)
|
||||||
if !ok {
|
if !ok {
|
||||||
rcs := this.moduleRtask.getHandle(comm.TaskType(conf.Type))
|
rcs := this.module.getHandle(comm.TaskType(conf.Type))
|
||||||
for _, v := range rcs {
|
for _, v := range rcs {
|
||||||
if v.condId == condiId {
|
if v.condId == condiId {
|
||||||
cond = v
|
cond = v
|
||||||
|
@ -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) {
|
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 {
|
if ec == pb.ErrorCode_Success {
|
||||||
for _, e := range equipment {
|
for _, e := range equipment {
|
||||||
if ok, _ = soGreatEqual(e.Lv, cfg.Data2); ok {
|
if ok, _ = soGreatEqual(e.Lv, cfg.Data2); ok {
|
||||||
|
@ -26,7 +26,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
|
|||||||
record *pb.UserShopData
|
record *pb.UserShopData
|
||||||
need []*cfg.Gameatn
|
need []*cfg.Gameatn
|
||||||
give []*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 {
|
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
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)
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
|
||||||
for _, v := range give {
|
for _, v := range give {
|
||||||
if v.A == comm.ItemType {
|
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))
|
// 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))
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype66, 1, int32(req.ShopType))
|
||||||
for _, v := range need {
|
for _, v := range need {
|
||||||
if v.A == comm.AttrType {
|
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 {
|
switch v.T {
|
||||||
case comm.ResGold:
|
case comm.ResGold:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 1))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 1))
|
||||||
break
|
break
|
||||||
case comm.ResExp:
|
case comm.ResExp:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 3))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 3))
|
||||||
break
|
break
|
||||||
case comm.ResDiamond:
|
case comm.ResDiamond:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.VipExp:
|
case comm.VipExp:
|
||||||
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.ResTaskActive:
|
case comm.ResTaskActive:
|
||||||
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.ResFriend:
|
case comm.ResFriend:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 4))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 4))
|
||||||
break
|
break
|
||||||
case comm.StarCoin:
|
case comm.StarCoin:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 9))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 9))
|
||||||
break
|
break
|
||||||
case comm.SociatyCoin:
|
case comm.SociatyCoin:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 8))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 8))
|
||||||
break
|
break
|
||||||
case comm.ArenaCoin:
|
case comm.ArenaCoin:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 11))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 11))
|
||||||
break
|
break
|
||||||
case comm.ResPs:
|
case comm.ResPs:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 12))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 12))
|
||||||
break
|
break
|
||||||
case comm.Moongold:
|
case comm.Moongold:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 14))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 14))
|
||||||
break
|
break
|
||||||
case comm.Talent1:
|
case comm.Talent1:
|
||||||
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.Talent2:
|
case comm.Talent2:
|
||||||
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.Talent3:
|
case comm.Talent3:
|
||||||
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.Talent4:
|
case comm.Talent4:
|
||||||
// tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 2))
|
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 2))
|
||||||
break
|
break
|
||||||
case comm.Merchantmoney:
|
case comm.Merchantmoney:
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, 15))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype67, v.N, 15))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T))
|
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(tasks) > 0 {
|
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})
|
session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true})
|
||||||
|
@ -157,7 +157,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
|
// 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})
|
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata})
|
||||||
} else if !req.IsManualRefresh {
|
} else if !req.IsManualRefresh {
|
||||||
// refresh := int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType2))
|
// 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)
|
goods = transGoods(items, sdata)
|
||||||
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: sdata})
|
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: sdata})
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
|
// 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 { //返回以前的商品列表
|
} else { //返回以前的商品列表
|
||||||
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
|
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
|
@ -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) {
|
func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtlasActivateReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||||
var (
|
var (
|
||||||
addScore int32 // 更新图鉴增加的积分
|
addScore int32 // 更新图鉴增加的积分
|
||||||
szTask []*comm.TaskParam
|
szTask []*comm.BuriedParam
|
||||||
)
|
)
|
||||||
code = this.AtlasActivateCheck(session, req)
|
code = this.AtlasActivateCheck(session, req)
|
||||||
if code != pb.ErrorCode_Success {
|
if code != pb.ErrorCode_Success {
|
||||||
@ -60,7 +60,7 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
|
|||||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype166, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype166, 1))
|
||||||
} else if conf.TypeId == 2 {
|
} else if conf.TypeId == 2 {
|
||||||
if v, ok := atlas.Collect[req.Id]; ok {
|
if v, ok := atlas.Collect[req.Id]; ok {
|
||||||
if !v.Activate { // 激活
|
if !v.Activate { // 激活
|
||||||
@ -76,10 +76,10 @@ func (this *apiComp) AtlasActivate(session comm.IUserSession, req *pb.SmithyAtla
|
|||||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||||
return
|
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))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype167, atlas.Score))
|
||||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), szTask...)
|
||||||
session.SendMsg(string(this.module.GetType()), "atlasactivate", &pb.SmithyAtlasActivateResp{Data: atlas})
|
session.SendMsg(string(this.module.GetType()), "atlasactivate", &pb.SmithyAtlasActivateResp{Data: atlas})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -249,8 +249,8 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
|||||||
Value: 0,
|
Value: 0,
|
||||||
}
|
}
|
||||||
// 解锁了新的图纸
|
// 解锁了新的图纸
|
||||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype177, 1))
|
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(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.Rtype179, 1, nextProficiency.Value1))
|
||||||
}
|
}
|
||||||
// 是否解锁新套装
|
// 是否解锁新套装
|
||||||
if nextProficiency.Type == comm.SmithyReelType4 {
|
if nextProficiency.Type == comm.SmithyReelType4 {
|
||||||
|
@ -60,9 +60,9 @@ func (this *apiComp) Rise(session comm.IUserSession, req *pb.SmithyRiseReq) (cod
|
|||||||
update["temperature"] = stove.Temperature
|
update["temperature"] = stove.Temperature
|
||||||
this.module.modelStove.updateSmithyStove(session.GetUserId(), update)
|
this.module.modelStove.updateSmithyStove(session.GetUserId(), update)
|
||||||
session.SendMsg(string(this.module.GetType()), "rise", &pb.SmithyRiseResp{Data: stove})
|
session.SendMsg(string(this.module.GetType()), "rise", &pb.SmithyRiseResp{Data: stove})
|
||||||
tasks := make([]*comm.TaskParam, 0)
|
tasks := make([]*comm.BuriedParam, 0)
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype175, stove.Temperature))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype175, stove.Temperature))
|
||||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
this.module.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -123,17 +123,17 @@ func (this *Smithy) CheckActivateAtlasCollect(uid string, id string) {
|
|||||||
func (this *Smithy) SendRdTask(session comm.IUserSession, Items []*pb.UserAtno) {
|
func (this *Smithy) SendRdTask(session comm.IUserSession, Items []*pb.UserAtno) {
|
||||||
var equip map[int32]int32 // key xingji value 数量
|
var equip map[int32]int32 // key xingji value 数量
|
||||||
equip = make(map[int32]int32, 0)
|
equip = make(map[int32]int32, 0)
|
||||||
tasks := make([]*comm.TaskParam, 0)
|
tasks := make([]*comm.BuriedParam, 0)
|
||||||
for _, v := range Items {
|
for _, v := range Items {
|
||||||
if cfg := this.configure.GetEquipmentConfigureById(v.T); cfg != nil {
|
if cfg := this.configure.GetEquipmentConfigureById(v.T); cfg != nil {
|
||||||
equip[cfg.Star]++
|
equip[cfg.Star]++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for k, v := range equip {
|
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))))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype148, int32(len(equip))))
|
||||||
this.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
|||||||
|
|
||||||
// 触发任务条件
|
// 触发任务条件
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
|
// 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 {
|
if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil {
|
||||||
this.module.Error("发送邮件 模板ID:GuildApproved",
|
this.module.Error("发送邮件 模板ID:GuildApproved",
|
||||||
|
@ -96,7 +96,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
|||||||
if !isCheck {
|
if !isCheck {
|
||||||
// 触发任务条件
|
// 触发任务条件
|
||||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
|
// 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{
|
rsp := &pb.SociatyApplyResp{
|
||||||
Uid: uid,
|
Uid: uid,
|
||||||
|
@ -136,7 +136,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
|
|||||||
return
|
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() {
|
go func() {
|
||||||
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {
|
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {
|
||||||
|
@ -13,19 +13,19 @@ const (
|
|||||||
TaskSubTypeStrategy = "strategy" //卡牌攻略
|
TaskSubTypeStrategy = "strategy" //卡牌攻略
|
||||||
TaskSubTypeFinishedPush = "taskfinishedpush" //推送
|
TaskSubTypeFinishedPush = "taskfinishedpush" //推送
|
||||||
TaskSubTypeGetrecord = "getrecord" //任务数据
|
TaskSubTypeGetrecord = "getrecord" //任务数据
|
||||||
TaskSubTypeSend = "send" //触发任务
|
TaskSubTypeSend = "send" //触发任务
|
||||||
)
|
)
|
||||||
|
|
||||||
type apiComp struct {
|
type apiComp struct {
|
||||||
modules.MCompGate
|
modules.MCompGate
|
||||||
service core.IService
|
service core.IService
|
||||||
moduleTask *ModuleTask
|
module *ModuleTask
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组件初始化接口
|
// 组件初始化接口
|
||||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
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)
|
err = this.MCompGate.Init(service, module, comp, options)
|
||||||
this.moduleTask = module.(*ModuleTask)
|
this.module = module.(*ModuleTask)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,14 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
|
|||||||
|
|
||||||
resp := &pb.TaskActiveListResp{}
|
resp := &pb.TaskActiveListResp{}
|
||||||
defer func() {
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// 获取玩家活跃度
|
// 获取玩家活跃度
|
||||||
expand, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
@ -43,7 +43,7 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
//获取当前Tag的活跃度列表
|
//获取当前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
|
return
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
}
|
}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
|
||||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(uid)
|
ue, err := this.module.ModuleUser.GetUserExpand(uid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
@ -37,12 +37,12 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
var flag bool
|
var flag bool
|
||||||
update := map[string]interface{}{}
|
update := map[string]interface{}{}
|
||||||
// 玩家的
|
// 玩家的
|
||||||
activeList := this.moduleTask.modelTaskActive.getActiveList(uid)
|
activeList := this.module.modelTaskActive.getActiveList(uid)
|
||||||
// var activityData *pb.ActivityData
|
// var activityData *pb.ActivityData
|
||||||
for _, v := range activeList {
|
for _, v := range activeList {
|
||||||
if v.TaskId == req.Id {
|
if v.TaskId == req.Id {
|
||||||
if v.Received != 1 {
|
if v.Received != 1 {
|
||||||
conf := this.moduleTask.configure.getTaskActiveById(v.TaskId)
|
conf := this.module.configure.getTaskActiveById(v.TaskId)
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
@ -71,8 +71,8 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
if flag {
|
if flag {
|
||||||
update["activityList"] = activeList
|
update["activityList"] = activeList
|
||||||
|
|
||||||
if err := this.moduleTask.modelTaskActive.Change(session.GetUserId(), update); err != nil {
|
if err := this.module.modelTaskActive.Change(session.GetUserId(), update); err != nil {
|
||||||
this.moduleTask.Errorf("updateReceive err %v", err)
|
this.module.Errorf("updateReceive err %v", err)
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -80,14 +80,14 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
|
|
||||||
if len(rewards) > 0 {
|
if len(rewards) > 0 {
|
||||||
//派发奖励
|
//派发奖励
|
||||||
if code = this.moduleTask.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
|
||||||
this.moduleTask.Error("活跃度奖励",
|
this.module.Error("活跃度奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "rewards", Value: rewards},
|
log.Field{Key: "rewards", Value: rewards},
|
||||||
log.Field{Key: "code", Value: code},
|
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{
|
resp := &pb.TaskActiveReceiveResp{
|
||||||
@ -95,7 +95,7 @@ func (this *apiComp) ActiveReceive(session comm.IUserSession, req *pb.TaskActive
|
|||||||
Id: req.Id,
|
Id: req.Id,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeActiveReceive, resp)
|
err = session.SendMsg(string(this.module.GetType()), TaskSubTypeActiveReceive, resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
|
@ -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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -21,14 +21,14 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.TaskListReq) (code
|
|||||||
rsp := &pb.TaskListResp{}
|
rsp := &pb.TaskListResp{}
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
err := session.SendMsg(string(this.moduleTask.GetType()), TaskSubTypeList, rsp)
|
err := session.SendMsg(string(this.module.GetType()), TaskSubTypeList, rsp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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 {
|
if task == nil {
|
||||||
code = pb.ErrorCode_TaskNotFound
|
code = pb.ErrorCode_TaskNotFound
|
||||||
return
|
return
|
||||||
|
@ -24,7 +24,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
}
|
}
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
// 获取待领取的任务
|
// 获取待领取的任务
|
||||||
userTask := this.moduleTask.modelTask.getUserTask(uid, req.Id)
|
userTask := this.module.modelTask.getUserTask(uid, req.Id)
|
||||||
|
|
||||||
if userTask == nil {
|
if userTask == nil {
|
||||||
code = pb.ErrorCode_TaskNotFound
|
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 {
|
if conf == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
@ -71,7 +71,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
// 更新活跃度
|
// 更新活跃度
|
||||||
if conf.Active > 0 {
|
if conf.Active > 0 {
|
||||||
//更新活跃度
|
//更新活跃度
|
||||||
ue, err := this.moduleTask.ModuleUser.GetUserExpand(session.GetUserId())
|
ue, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
@ -89,12 +89,12 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
// 周任务 自动领取奖励
|
// 周任务 自动领取奖励
|
||||||
if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
if comm.TaskTag(req.TaskTag) == comm.TASK_WEEKLY {
|
||||||
TaskActive := make(map[string]interface{})
|
TaskActive := make(map[string]interface{})
|
||||||
activeList := this.moduleTask.modelTaskActive.getActiveList(uid)
|
activeList := this.module.modelTaskActive.getActiveList(uid)
|
||||||
var rewards []*cfg.Gameatn
|
var rewards []*cfg.Gameatn
|
||||||
var maxTaskId int32
|
var maxTaskId int32
|
||||||
for _, v := range activeList {
|
for _, v := range activeList {
|
||||||
if v.Received != 1 {
|
if v.Received != 1 {
|
||||||
conf := this.moduleTask.configure.getTaskActiveById(v.TaskId)
|
conf := this.module.configure.getTaskActiveById(v.TaskId)
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
return
|
return
|
||||||
@ -113,21 +113,21 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
if len(rewards) > 0 {
|
if len(rewards) > 0 {
|
||||||
TaskActive["activityList"] = activeList
|
TaskActive["activityList"] = activeList
|
||||||
|
|
||||||
if err := this.moduleTask.modelTaskActive.Change(session.GetUserId(), TaskActive); err != nil {
|
if err := this.module.modelTaskActive.Change(session.GetUserId(), TaskActive); err != nil {
|
||||||
this.moduleTask.Errorf("updateReceive err %v", err)
|
this.module.Errorf("updateReceive err %v", err)
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//派发奖励
|
//派发奖励
|
||||||
if code = this.moduleTask.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, rewards, true); code != pb.ErrorCode_Success {
|
||||||
this.moduleTask.Error("活跃度奖励",
|
this.module.Error("活跃度奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "rewards", Value: rewards},
|
log.Field{Key: "rewards", Value: rewards},
|
||||||
log.Field{Key: "code", Value: code},
|
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))
|
||||||
err := session.SendMsg(string(this.moduleTask.GetType()), "activereceive", &pb.TaskActiveReceivePush{
|
err := session.SendMsg(string(this.module.GetType()), "activereceive", &pb.TaskActiveReceivePush{
|
||||||
TaskTag: int32(comm.TASK_WEEKLY),
|
TaskTag: int32(comm.TASK_WEEKLY),
|
||||||
Id: maxTaskId,
|
Id: maxTaskId,
|
||||||
})
|
})
|
||||||
@ -140,7 +140,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(update) > 0 {
|
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
|
code = pb.ErrorCode_DBError
|
||||||
return
|
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 {
|
if code = this.module.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
|
||||||
this.moduleTask.Error("发送奖励",
|
this.module.Error("发送奖励",
|
||||||
log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
log.Field{Key: "rewards", Value: conf.Reword},
|
log.Field{Key: "rewards", Value: conf.Reword},
|
||||||
log.Field{Key: "code", Value: code},
|
log.Field{Key: "code", Value: code},
|
||||||
@ -174,13 +174,13 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.TaskReceiveReq)
|
|||||||
update["achieveList"] = taskDataList
|
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
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resp.TaskId = taskData.TaskId
|
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 {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -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) {
|
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 imodule, err := this.service.GetModule(comm.ModuleRtask); err == nil {
|
||||||
if itask, ok := imodule.(comm.IRtask); ok {
|
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{
|
rsp := &pb.TaskSendResp{
|
||||||
IsSucc: true,
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -122,7 +122,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
|
|||||||
// this.sendMsg(session, UserSubTypeCreate, resp)
|
// this.sendMsg(session, UserSubTypeCreate, resp)
|
||||||
session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{})
|
session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{})
|
||||||
if req.Figure != 0 {
|
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)
|
this.mail.SendMailByCid(session, comm.Welcomemail, nil)
|
||||||
return
|
return
|
||||||
|
@ -141,7 +141,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
|||||||
|
|
||||||
this.module.RecoverUserPsStart(user.Uid)
|
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)
|
this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
|
||||||
|
|
||||||
rsp.Data = user
|
rsp.Data = user
|
||||||
|
@ -421,7 +421,7 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
|
|||||||
code = pb.ErrorCode_GoldNoEnough
|
code = pb.ErrorCode_GoldNoEnough
|
||||||
return
|
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)
|
change.Gold += int64(add)
|
||||||
case comm.ResExp:
|
case comm.ResExp:
|
||||||
|
@ -170,29 +170,29 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
|||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
}
|
}
|
||||||
// 随机任务统计
|
// 随机任务统计
|
||||||
var szTask []*comm.TaskParam
|
var szTask []*comm.BuriedParam
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
|
||||||
//szTask = append(szTask, comm.GettaskParam(comm.Rtype74, req.BossId, req.Difficulty))
|
//szTask = append(szTask, comm.GetBuriedParam(comm.Rtype74, req.BossId, req.Difficulty))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype78, req.BossId, req.Difficulty, req.Report.Costtime))
|
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 {
|
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||||
for _, v := range req.Report.Info.Redflist[0].Team {
|
for _, v := range req.Report.Info.Redflist[0].Team {
|
||||||
if v.Ishelp { // 判断是否有助战
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Auto {
|
if req.Auto {
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype75, req.BossId, req.Difficulty))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype75, req.BossId, req.Difficulty))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype172, 1))
|
szTask = append(szTask, comm.GetBuriedParam(comm.Rtype172, 1))
|
||||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype181, 1, req.BossId, req.Difficulty))
|
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 {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ func (this *Viking) AutoBattleOver(session comm.IUserSession, Report *pb.BattleR
|
|||||||
difficulty := autoBattle.Difficulty
|
difficulty := autoBattle.Difficulty
|
||||||
atno = make([]*pb.UserAtno, 0)
|
atno = make([]*pb.UserAtno, 0)
|
||||||
conf := this.configure.GetVikingBossConfigData(bossId, difficulty)
|
conf := this.configure.GetVikingBossConfigData(bossId, difficulty)
|
||||||
tasks := make([]*comm.TaskParam, 0)
|
tasks := make([]*comm.BuriedParam, 0)
|
||||||
// costRes := this.ModuleTools.GetGlobalConf().VikingExpeditionCos
|
// costRes := this.ModuleTools.GetGlobalConf().VikingExpeditionCos
|
||||||
// if costRes == nil {
|
// if costRes == nil {
|
||||||
// code = pb.ErrorCode_ConfigNoFound
|
// 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.ModuleBuried.SendToRtask(session, comm.Rtype73, difficulty, bossId, 1)
|
||||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype78, difficulty, bossId, Report.Costtime)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype78, difficulty, bossId, Report.Costtime)
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype73, 1, bossId, difficulty))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype73, 1, bossId, difficulty))
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
|
||||||
if Report != nil && Report.Info != nil && len(Report.Info.Redflist) > 0 {
|
if Report != nil && Report.Info != nil && len(Report.Info.Redflist) > 0 {
|
||||||
for _, v := range Report.Info.Redflist[0].Team {
|
for _, v := range Report.Info.Redflist[0].Team {
|
||||||
if v.Ishelp { // 判断是否有助战
|
if v.Ishelp { // 判断是否有助战
|
||||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype79, difficulty, bossId)
|
// this.ModuleBuried.SendToRtask(session, comm.Rtype79, difficulty, bossId)
|
||||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
|
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype78, difficulty, bossId, Report.Costtime))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
this.ModuleBuried.TriggerBuried(session.GetUserId(), tasks...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
|||||||
return
|
return
|
||||||
} else {
|
} 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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/event"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
@ -46,7 +45,6 @@ func (this *Worldtask) GetType() core.M_Modules {
|
|||||||
|
|
||||||
func (this *Worldtask) Start() (err error) {
|
func (this *Worldtask) Start() (err error) {
|
||||||
err = this.ModuleBase.Start()
|
err = this.ModuleBase.Start()
|
||||||
event.RegisterGO(comm.EventBuriedComplete, this.ConditionFinishNotify)
|
|
||||||
if this.worldtaskConf, err = this.configure.getWorldtaskCfg(); err != nil {
|
if this.worldtaskConf, err = this.configure.getWorldtaskCfg(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user