Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
95ba9c3983
@ -50,7 +50,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe
|
||||
}
|
||||
|
||||
this.module.DispenseRes(session, level.Award, true)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype151, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype151, 1))
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "receive", &pb.AcademyReceiveResp{Issucc: true})
|
||||
return
|
||||
|
@ -40,7 +40,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
|
||||
Tasks: record.Tasks,
|
||||
}})
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype130, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype130, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype130, 1))
|
||||
} else {
|
||||
session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: nil})
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
||||
bulestate = pb.BattleRecordState_DefendLost
|
||||
}
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype131, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype131, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype131, 1))
|
||||
} else {
|
||||
if req.Revengeid != "" {
|
||||
redstate = pb.BattleRecordState_RevengeFailed
|
||||
@ -225,7 +225,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype128, red.Integral), comm.GettaskParam(comm.Rtype129, red.Dan))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype128, red.Integral), comm.GettaskParam(comm.Rtype129, red.Dan))
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype128, red.Integral)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype129, red.Dan)
|
||||
return
|
||||
|
@ -139,7 +139,7 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
|
||||
for _, v := range req.Format.Friendformat {
|
||||
if v != "" {
|
||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -249,7 +249,7 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
|
||||
for _, v := range req.Format.Friendformat {
|
||||
if v != "" {
|
||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -378,7 +378,7 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt
|
||||
this.moonfantasy.Trigger(session, report)
|
||||
for _, v := range report.Completetask {
|
||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v)
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype157, int32(report.Info.Ptype), v))
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype157, int32(report.Info.Ptype), v))
|
||||
}
|
||||
return pb.ErrorCode_Success, true
|
||||
}
|
||||
|
@ -21,6 +21,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
|
||||
}
|
||||
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
|
||||
return
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
|
||||
}
|
||||
go this.module.modelChat.sendChatToWorld(msg, max_chat)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype62, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype62, 1))
|
||||
//随机任务
|
||||
// if _, err = this.service.AcrossClusterRpcGo(
|
||||
// context.Background(),
|
||||
@ -117,7 +117,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
|
||||
|
||||
go this.module.modelChat.sendChatToCrossServer(msg, max_chat)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype106, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype106, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype106, 1))
|
||||
break
|
||||
default:
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
|
@ -91,7 +91,7 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
|
||||
lv.Pass = true
|
||||
this.module.DispenseRes(session, level.Award, true)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype140, 1, level.Id)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
|
||||
}
|
||||
lv.Progress = int32((float64(len(lv.Passmanster)+len(lv.Passdrop)) / float64(len(level.Passdroplist)+len(level.PassformatList))) * float64(100))
|
||||
if err = this.module.modelCombat.updateInfo(info); err != nil {
|
||||
|
@ -100,7 +100,7 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
|
||||
lv.Pass = true
|
||||
this.module.DispenseRes(session, level.Award, true)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype140, 1, level.Id)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
|
||||
}
|
||||
lv.Progress = int32((float64(len(lv.Passmanster)+len(lv.Passdrop)) / float64(len(level.Passdroplist)+len(level.PassformatList))) * float64(100))
|
||||
if err = this.module.modelCombat.updateInfo(info); err != nil {
|
||||
|
@ -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.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype94, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype94, 1))
|
||||
session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip})
|
||||
return
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
||||
}
|
||||
|
||||
if len(tasks) > 0 {
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})
|
||||
|
@ -208,7 +208,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype96, 1)
|
||||
}
|
||||
if len(tasks) > 0 {
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
|
||||
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.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype95, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype95, 1))
|
||||
session.SendMsg(string(this.module.GetType()), "wash", &pb.EquipmentWashResp{Eid: req.Eid, AdverbEntry: adverbEntry})
|
||||
return
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
||||
|
||||
//异步出发任务启动
|
||||
if len(tasks) > 0 {
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
}
|
||||
|
||||
if len(add) > 0 {
|
||||
|
@ -135,7 +135,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
|
||||
|
||||
// 拥有xx个好友
|
||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds)))
|
||||
this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype10, int32(len(agreeIds))))
|
||||
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype10, int32(len(agreeIds))))
|
||||
resp := &pb.FriendAgreeResp{
|
||||
Num: optNum,
|
||||
}
|
||||
|
@ -98,6 +98,6 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
|
||||
|
||||
// 随机任务Rtype13
|
||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1)
|
||||
this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype13, 1))
|
||||
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype13, 1))
|
||||
return
|
||||
}
|
||||
|
@ -100,6 +100,6 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
|
||||
|
||||
// 赠送X次友情点
|
||||
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
|
||||
this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype11, 1))
|
||||
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype11, 1))
|
||||
return
|
||||
}
|
||||
|
@ -79,6 +79,6 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
|
||||
Cid: curFood,
|
||||
FirstGet: bFirst,
|
||||
})
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype150, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype150, 1))
|
||||
return
|
||||
}
|
||||
|
@ -117,6 +117,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
|
||||
}
|
||||
}
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
return
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
|
||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
|
||||
}
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
session.SendMsg(string(this.module.GetType()), "buy", &pb.HeroBuyResp{
|
||||
IsSucc: true,
|
||||
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})
|
||||
// 通过融合获得指定英雄
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype139, utils.ToInt32(conf.Hero))
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
|
||||
return
|
||||
}
|
||||
|
@ -137,6 +137,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype55, 1, cfg.Color))
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype56, 1, 1, cfg.Job))
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
return
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype28, 1))
|
||||
}
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star))
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star)
|
||||
return
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
|
||||
}
|
||||
}
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype33, 1, 1, hero.Lv))
|
||||
this.moduleHero.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.moduleHero.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
//this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype33, 1, 1, hero.Lv)
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId)))
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype30, 1, cfg.Color))
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype31, 1, cfg.Color))
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
}
|
||||
|
||||
return
|
||||
@ -174,7 +174,7 @@ func (this *Hero) SendRdTask(session comm.IUserSession) {
|
||||
//this.ModuleRtask.SendToRtask(session, comm.Rtype46, v1, k1, k)
|
||||
}
|
||||
}
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
}
|
||||
|
||||
//英雄列表
|
||||
@ -759,7 +759,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
|
||||
}
|
||||
|
||||
szTask = append(szTask, comm.GettaskParam(comm.Rtype89, drawCount))
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
}
|
||||
|
||||
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {
|
||||
|
@ -140,6 +140,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
}
|
||||
}
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
return
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
|
||||
//随机任务
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype21, 1)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, utils.ToInt32(sale.Prize[0].T))
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype21, 1), comm.GettaskParam(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)))
|
||||
|
||||
case 4: //自选宝箱
|
||||
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
|
||||
|
@ -153,7 +153,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
|
||||
}
|
||||
}
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv))
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -221,6 +221,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
}
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype160, allStar)
|
||||
tasks = append(tasks, comm.GettaskParam(comm.Rtype160, allStar))
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
return
|
||||
}
|
||||
|
@ -44,12 +44,12 @@ type ModuleBase struct {
|
||||
ModuleTools comm.ITools //工具类 获取一些通用配置
|
||||
}
|
||||
|
||||
//重构模块配置对象
|
||||
// 重构模块配置对象
|
||||
func (this *ModuleBase) NewOptions() (options core.IModuleOptions) {
|
||||
return new(Options)
|
||||
}
|
||||
|
||||
//模块初始化接口
|
||||
// 模块初始化接口
|
||||
func (this *ModuleBase) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
this.service = service.(base.IRPCXService)
|
||||
this.module = module
|
||||
@ -59,7 +59,7 @@ func (this *ModuleBase) Init(service core.IService, module core.IModule, options
|
||||
return
|
||||
}
|
||||
|
||||
//模块启动接口
|
||||
// 模块启动接口
|
||||
func (this *ModuleBase) Start() (err error) {
|
||||
if err = this.ModuleBase.Start(); err != nil {
|
||||
return
|
||||
@ -138,12 +138,12 @@ func (this *ModuleBase) Start() (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//判断当前环境是本服还还是跨服
|
||||
// 判断当前环境是本服还还是跨服
|
||||
func (this *ModuleBase) IsCross() bool {
|
||||
return db.IsCross()
|
||||
}
|
||||
|
||||
//获取跨服标签
|
||||
// 获取跨服标签
|
||||
func (this *ModuleBase) GetCrossTag() string {
|
||||
return db.CrossTag()
|
||||
}
|
||||
@ -166,7 +166,7 @@ func (this *ModuleBase) PutUserSession(session comm.IUserSession) {
|
||||
return
|
||||
}
|
||||
|
||||
//向指定用户发送消息
|
||||
// 向指定用户发送消息
|
||||
func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Message, uid string) (err error) {
|
||||
user := this.ModuleUser.GetUserSession(uid)
|
||||
if user == nil {
|
||||
@ -180,7 +180,7 @@ func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Messag
|
||||
return
|
||||
}
|
||||
|
||||
//向多个用户发送消息
|
||||
// 向多个用户发送消息
|
||||
func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Message, uids ...string) (err error) {
|
||||
var (
|
||||
users map[string]*pb.CacheUser = make(map[string]*pb.CacheUser)
|
||||
@ -226,7 +226,7 @@ func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Messa
|
||||
return
|
||||
}
|
||||
|
||||
//向多个用户发送消息
|
||||
// 向多个用户发送消息
|
||||
func (this *ModuleBase) SendMsgToCUsers(mainType, subType string, msg proto.Message, users ...*pb.CacheUser) (err error) {
|
||||
var (
|
||||
gateways map[string]map[string][]string = make(map[string]map[string][]string)
|
||||
@ -262,7 +262,7 @@ func (this *ModuleBase) SendMsgToCUsers(mainType, subType string, msg proto.Mess
|
||||
return
|
||||
}
|
||||
|
||||
//向多个用户发送消息
|
||||
// 向多个用户发送消息
|
||||
func (this *ModuleBase) SendMsgToSession(mainType, subType string, msg proto.Message, users ...comm.IUserSession) (err error) {
|
||||
var (
|
||||
gateways map[string]map[string][]string = make(map[string]map[string][]string)
|
||||
@ -335,7 +335,7 @@ func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Gameatn)
|
||||
return
|
||||
}
|
||||
|
||||
//消耗资源
|
||||
// 消耗资源
|
||||
func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
items map[string]int32 // 道具背包 批量处理
|
||||
@ -379,7 +379,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
||||
this.Debug("消耗玩家资源", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "attrs", Value: attrs})
|
||||
if count, ok := attrs[comm.ResDiamond]; ok {
|
||||
// this.ModuleRtask.SendToRtask(session, comm.Rtype104, -count)
|
||||
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype104, -count))
|
||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype104, -count))
|
||||
}
|
||||
}
|
||||
if len(items) > 0 {
|
||||
@ -393,7 +393,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
|
||||
return
|
||||
}
|
||||
|
||||
//发放资源
|
||||
// 发放资源
|
||||
func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
items map[string]int32 // 道具背包 批量处理
|
||||
@ -478,7 +478,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
return
|
||||
}
|
||||
|
||||
//跨服对象获取数据操作对象
|
||||
// 跨服对象获取数据操作对象
|
||||
func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string, expired time.Duration) (model *db.DBModel, err error) {
|
||||
var conn *db.DBConn
|
||||
if session.GetServiecTag() == this.service.GetTag() {
|
||||
@ -494,7 +494,7 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string,
|
||||
return
|
||||
}
|
||||
|
||||
//跨服对象获取数据操作对象
|
||||
// 跨服对象获取数据操作对象
|
||||
func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration) (model *db.DBModel, err error) {
|
||||
var (
|
||||
conn *db.DBConn
|
||||
@ -512,7 +512,7 @@ func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration)
|
||||
return
|
||||
}
|
||||
|
||||
//跨服对象获取数据操作对象
|
||||
// 跨服对象获取数据操作对象
|
||||
func (this *ModuleBase) GetDBModelByUid(uid, tableName string, expired time.Duration) (model *db.DBModel, err error) {
|
||||
var (
|
||||
stag string
|
||||
@ -534,7 +534,7 @@ func (this *ModuleBase) GetDBModelByUid(uid, tableName string, expired time.Dura
|
||||
return
|
||||
}
|
||||
|
||||
//日志接口
|
||||
// 日志接口
|
||||
func (this *ModuleBase) Debug(msg string, args ...log.Field) {
|
||||
this.options.GetLog().Debug(msg, args...)
|
||||
}
|
||||
@ -623,7 +623,7 @@ func (this *ModuleBase) PanicWithField(msg string, fields ...log.Field) {
|
||||
|
||||
}
|
||||
|
||||
//发放资源
|
||||
// 发放资源
|
||||
func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (code pb.ErrorCode, atno []*pb.UserAtno) {
|
||||
var (
|
||||
items map[string]int32 // 道具背包 批量处理
|
||||
|
@ -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.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype88, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype88, 1))
|
||||
} else {
|
||||
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)
|
||||
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.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
|
||||
return
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string
|
||||
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
|
||||
session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster})
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -155,6 +155,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype58, 1)
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype59, pagoda.PagodaId)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype58, 1), comm.GettaskParam(comm.Rtype59, pagoda.PagodaId))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype58, 1), comm.GettaskParam(comm.Rtype59, pagoda.PagodaId))
|
||||
return
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ func (this *apiComp) InviteHandle(session comm.IUserSession, req *pb.ParkourInvi
|
||||
code = pb.ErrorCode_ParkourMemberFull
|
||||
return
|
||||
}
|
||||
if req.State == 1 {
|
||||
if req.State == 3 {
|
||||
ok = false
|
||||
for i, v := range tean.Invite {
|
||||
if v.Uid == session.GetUserId() && !configure.Now().Before(time.Unix(v.Expired, 0)) { //邀请未过期
|
||||
if v.Uid == session.GetUserId() && configure.Now().Before(time.Unix(v.Expired, 0)) { //邀请未过期
|
||||
invite = v
|
||||
index = int32(i)
|
||||
ok = true
|
||||
@ -64,6 +64,7 @@ func (this *apiComp) InviteHandle(session comm.IUserSession, req *pb.ParkourInvi
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
users = append(users, invite.Uid)
|
||||
member = &pb.DBRaceMember{Uid: invite.Uid, Name: invite.Name, Avatar: invite.Avatar, Lv: invite.Lv, Mount: info.Dfmount, Hp: mount.Hp}
|
||||
tean.Captainid = tean.Uid
|
||||
tean.State = pb.RaceTeamState_teaming
|
||||
@ -93,6 +94,6 @@ func (this *apiComp) InviteHandle(session comm.IUserSession, req *pb.ParkourInvi
|
||||
&pb.ParkourInviteNoticePush{Team: tean, State: 3}, tean.Captainid)
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), "invite", &pb.ParkourInviteHandleResp{IsSucc: true})
|
||||
session.SendMsg(string(this.module.GetType()), "invitehandle", &pb.ParkourInviteHandleResp{IsSucc: true})
|
||||
return
|
||||
}
|
||||
|
@ -8,6 +8,10 @@ import (
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) JoinTeamCheck(session comm.IUserSession, req *pb.ParkourJoinTeamReq) (code pb.ErrorCode) {
|
||||
if session.GetUserId() == req.Uid {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -36,7 +40,7 @@ func (this *apiComp) JoinTeam(session comm.IUserSession, req *pb.ParkourJoinTeam
|
||||
}
|
||||
|
||||
if len(info.Member) > 3 {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
code = pb.ErrorCode_ParkourMemberFull
|
||||
return
|
||||
}
|
||||
if tean, err = this.module.parkourComp.queryinfo(req.Uid); err != nil {
|
||||
@ -58,7 +62,7 @@ func (this *apiComp) JoinTeam(session comm.IUserSession, req *pb.ParkourJoinTeam
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
member = &pb.DBRaceMember{Uid: session.GetUserId(), Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: tean.Dfmount, Hp: mount.Hp}
|
||||
member = &pb.DBRaceMember{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: tean.Dfmount, Hp: mount.Hp}
|
||||
tean.Captainid = tean.Uid
|
||||
tean.State = pb.RaceTeamState_teaming
|
||||
tean.Member = append(tean.Member, member)
|
||||
@ -71,7 +75,7 @@ func (this *apiComp) JoinTeam(session comm.IUserSession, req *pb.ParkourJoinTeam
|
||||
return
|
||||
}
|
||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||
member = &pb.DBRaceMember{Uid: session.GetUserId(), Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: info.Dfmount, Hp: mount.Hp}
|
||||
member = &pb.DBRaceMember{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv, Mount: info.Dfmount, Hp: mount.Hp}
|
||||
tean.Member = append(tean.Member, member)
|
||||
if err = this.module.parkourComp.Change(session.GetUserId(), map[string]interface{}{
|
||||
"state": tean.State,
|
||||
|
@ -3,6 +3,7 @@ package parkour
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
@ -17,6 +18,8 @@ func (this *apiComp) RaceMatchCheck(session comm.IUserSession, req *pb.ParkourRa
|
||||
func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMatchReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||
var (
|
||||
team *pb.DBParkour
|
||||
tuser *pb.DBUser
|
||||
mount *cfg.GameBuzkashiMountData
|
||||
users []string
|
||||
err error
|
||||
)
|
||||
@ -27,10 +30,31 @@ func (this *apiComp) RaceMatch(session comm.IUserSession, req *pb.ParkourRaceMat
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
if team.Captainid != session.GetUserId() {
|
||||
if team.Captainid != "" && team.Captainid != session.GetUserId() {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
if team.Captainid == "" { //为组队情况
|
||||
team.Captainid = team.Uid
|
||||
team.State = pb.RaceTeamState_teaming
|
||||
if tuser = this.module.ModuleUser.GetUser(session.GetUserId()); tuser == nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
return
|
||||
}
|
||||
if mount, err = this.module.configure.getGameBuzkashiMount(team.Dfmount); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
team.Member = append(team.Member, &pb.DBRaceMember{Uid: tuser.Uid, Name: tuser.Name, Avatar: tuser.Avatar, Lv: tuser.Lv, Mount: team.Dfmount, Hp: mount.Hp})
|
||||
if err = this.module.parkourComp.Change(team.Captainid, map[string]interface{}{
|
||||
"state": team.State,
|
||||
"captainid": team.Captainid,
|
||||
"member": team.Member,
|
||||
}); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err = this.module.match(team); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
|
@ -18,7 +18,9 @@ func (this *apiComp) ViewPlayer(session comm.IUserSession, req *pb.ParkourViewPl
|
||||
if code = this.ViewPlayerCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
resp = &pb.ParkourViewPlayerResp{
|
||||
Player: make([]*pb.ParkourData, 0),
|
||||
}
|
||||
for _, uid := range req.Uid {
|
||||
if u := this.module.ModuleUser.GetUser(uid); u != nil {
|
||||
{
|
||||
|
@ -148,11 +148,12 @@ func (this *Parkour) createbattle(ctx context.Context, req *pb.RPCParkourMatchSu
|
||||
v.Ready = true
|
||||
}
|
||||
}
|
||||
battle.BuleMember = req.Bule
|
||||
|
||||
for _, v := range battle.Session {
|
||||
sessions = append(sessions, v)
|
||||
}
|
||||
|
||||
battle.BuleMember = req.Bule
|
||||
if err = this.raceComp.addrace(race); err != nil {
|
||||
return
|
||||
}
|
||||
@ -406,17 +407,6 @@ func (this *Parkour) useroffline(uid, sessionid string) {
|
||||
}
|
||||
if info.State == pb.RaceTeamState_teaming {
|
||||
if info.Captainid == uid {
|
||||
info.Invite = info.Invite[:0]
|
||||
info.Member = info.Member[:0]
|
||||
if err = this.parkourComp.Change(uid, map[string]interface{}{
|
||||
"captainid": "",
|
||||
"state": 0,
|
||||
"Invite": info.Invite,
|
||||
"member": info.Member,
|
||||
}); err != nil {
|
||||
this.Error("用户离线! 处理数据", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
||||
return
|
||||
}
|
||||
users = make([]string, 0)
|
||||
for _, v := range info.Member {
|
||||
if v.Uid != uid && !v.Isai {
|
||||
@ -430,6 +420,17 @@ func (this *Parkour) useroffline(uid, sessionid string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
info.Invite = info.Invite[:0]
|
||||
info.Member = info.Member[:0]
|
||||
if err = this.parkourComp.Change(uid, map[string]interface{}{
|
||||
"captainid": "",
|
||||
"state": 0,
|
||||
"Invite": info.Invite,
|
||||
"member": info.Member,
|
||||
}); err != nil {
|
||||
this.Error("用户离线! 处理数据", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
|
||||
return
|
||||
}
|
||||
if len(users) > 0 {
|
||||
if err = this.SendMsgToUsers(string(comm.ModulePvp), "teamdisbandnotice", &pb.ParkourTeamDisbandNoticePush{}, users...); err != nil {
|
||||
this.Errorln(err)
|
||||
|
@ -102,7 +102,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
|
||||
"knapsack": room.Knapsack,
|
||||
filed: pillar,
|
||||
})
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype149, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype149, 1))
|
||||
session.SendMsg(string(this.module.GetType()), "practice", &pb.PracticePracticeResp{Pillar: pillar})
|
||||
return
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
|
||||
this.module.PutUserSession(_session)
|
||||
}
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, minutes))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, minutes))
|
||||
session.SendMsg(string(this.module.GetType()), "receive", &pb.PracticeReceiveResp{Pillar: pillar, Knapsack: room.Knapsack})
|
||||
return
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq
|
||||
filed: pillar,
|
||||
"pillarf": room.Pillarf,
|
||||
})
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype152, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype152, 1))
|
||||
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room})
|
||||
return
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ type ModelRtaskRecord struct {
|
||||
modules.MCompModel
|
||||
moduleRtask *ModuleRtask
|
||||
service core.IService
|
||||
record *pb.DBRtaskRecord
|
||||
}
|
||||
|
||||
func (this *ModelRtaskRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
|
@ -89,7 +89,7 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok boo
|
||||
}
|
||||
|
||||
//验证限定条件
|
||||
var condi *rtaskCondi
|
||||
var condi *rtaskCondHandle
|
||||
cond, ok := this.moduleRtask.handleMap.Load(condiId)
|
||||
if !ok {
|
||||
rcs := this.moduleRtask.getHandle(comm.TaskType(conf.Type))
|
||||
@ -100,7 +100,7 @@ func (this *ModelRtask) checkCondi(uid string, condiId int32) (err error, ok boo
|
||||
}
|
||||
}
|
||||
|
||||
if condi, ok = cond.(*rtaskCondi); !ok {
|
||||
if condi, ok = cond.(*rtaskCondHandle); !ok {
|
||||
err = fmt.Errorf("condiType err")
|
||||
return
|
||||
}
|
||||
|
@ -12,18 +12,21 @@ import (
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/sys/db"
|
||||
"go_dreamfactory/utils"
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
var _ comm.IRtask = (*ModuleRtask)(nil)
|
||||
|
||||
// 限定条件
|
||||
type rtaskCondi struct {
|
||||
type rtaskCondHandle struct {
|
||||
condId int32 //任务条件配置ID
|
||||
verify verifyHandle //校验任务条件
|
||||
find condiFindHandle //检索任务条件
|
||||
@ -71,15 +74,15 @@ func (this *ModuleRtask) OnInstallComp() {
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) registerVerifyHandle(condiId int32, condi *rtaskCondi) {
|
||||
func (this *ModuleRtask) registerVerifyHandle(condiId int32, condi *rtaskCondHandle) {
|
||||
this.handleMap.Store(condiId, condi)
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondHandle) {
|
||||
for _, v := range this.configure.getRtaskCondis(int32(tt)) {
|
||||
switch tt {
|
||||
case comm.Rtype1:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype1,
|
||||
@ -88,7 +91,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype2:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype2,
|
||||
@ -97,7 +100,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype3:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype3,
|
||||
@ -106,7 +109,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype4:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype4,
|
||||
@ -115,7 +118,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype5:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype5,
|
||||
@ -124,7 +127,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype6:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype6,
|
||||
@ -133,7 +136,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype8:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype8,
|
||||
@ -142,7 +145,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype9:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype9,
|
||||
@ -151,7 +154,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype10:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verfiyRtype10,
|
||||
@ -160,7 +163,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype11, comm.Rtype84, comm.Rtype85:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.lessEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
|
||||
@ -170,7 +173,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype18:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.greatEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
|
||||
@ -187,7 +190,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
comm.Rtype96, comm.Rtype105, comm.Rtype128, comm.Rtype130, comm.Rtype131,
|
||||
comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146,
|
||||
comm.Rtype147, comm.Rtype149, comm.Rtype153, comm.Rtype154, comm.Rtype155, comm.Rtype156:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.lessEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstGreatEqualParam,
|
||||
@ -196,7 +199,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype50, comm.Rtype73:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.lessEqualFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFromDb,
|
||||
@ -205,7 +208,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype20:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype20,
|
||||
@ -215,7 +218,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype22, comm.Rtype109:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtaskRecord.verifyFirstEqualParam,
|
||||
@ -225,7 +228,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
condis = append(condis, condi)
|
||||
this.registerVerifyHandle(v.Id, condi)
|
||||
case comm.Rtype63:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalFirstParam,
|
||||
verify: this.modelRtask.verifyRtype63,
|
||||
@ -236,7 +239,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
case comm.Rtype16, comm.Rtype17,
|
||||
comm.Rtype35, comm.Rtype44,
|
||||
comm.Rtype59, comm.Rtype61:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.equalParams,
|
||||
verify: this.modelRtaskRecord.verifyFromDb,
|
||||
@ -251,7 +254,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
comm.Rtype46, comm.Rtype47, comm.Rtype48, comm.Rtype49,
|
||||
comm.Rtype52, comm.Rtype55, comm.Rtype56,
|
||||
comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140:
|
||||
condi := &rtaskCondi{
|
||||
condi := &rtaskCondHandle{
|
||||
condId: v.Id,
|
||||
find: this.modelRtaskRecord.lessThanParams,
|
||||
verify: this.modelRtaskRecord.verifyFromDb,
|
||||
@ -269,7 +272,8 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondi) {
|
||||
// 处理触发的任务
|
||||
func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
|
||||
uid := session.GetUserId()
|
||||
var condis []*rtaskCondi
|
||||
|
||||
var handles []*rtaskCondHandle
|
||||
|
||||
if this.IsCross() {
|
||||
//随机任务
|
||||
@ -285,18 +289,18 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
|
||||
return
|
||||
}
|
||||
|
||||
condis = this.getHandle(rtaskType)
|
||||
handles = this.getHandle(rtaskType)
|
||||
// update
|
||||
for _, v := range condis {
|
||||
conf, err := this.configure.getRtaskTypeById(v.condId)
|
||||
for _, handle := range handles {
|
||||
conf, err := this.configure.getRtaskTypeById(handle.condId)
|
||||
if err != nil {
|
||||
log.Debug("任务配置未找到", log.Field{Key: "condId", Value: v.condId})
|
||||
log.Debug("任务配置未找到", log.Field{Key: "condId", Value: handle.condId})
|
||||
code = pb.ErrorCode_RtaskCondiNoFound
|
||||
return
|
||||
}
|
||||
|
||||
if v.update != nil {
|
||||
if err := v.update(uid, conf, params...); err != nil {
|
||||
if handle.update != nil {
|
||||
if err := handle.update(uid, conf, params...); err != nil {
|
||||
log.Errorf("update task:%v", err)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
@ -349,9 +353,6 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam) {
|
||||
this.Debug("任务处理",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "params", Value: taskParams})
|
||||
session, ok := this.GetUserSession(uid)
|
||||
if !ok {
|
||||
return
|
||||
@ -363,13 +364,40 @@ func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam)
|
||||
this.Error("TriggerTask userlock err!", log.Field{Key: "err", Value: err.Error()})
|
||||
}
|
||||
defer lock.Unlock()
|
||||
for _, tp := range taskParams {
|
||||
if code := this.processOneTask(session, tp.TT, tp.Params...); code != pb.ErrorCode_Success {
|
||||
|
||||
record := &pb.DBRtaskRecord{Uid: uid}
|
||||
if err := this.modelRtaskRecord.Get(uid, record); err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
record.Id = primitive.NewObjectID().Hex()
|
||||
record.Ctime = configure.Now().Unix()
|
||||
if err := this.modelRtaskRecord.Add(uid, record); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.modelRtaskRecord.record = record
|
||||
|
||||
for _, tp := range taskParams {
|
||||
// this.Debug("任务触发",
|
||||
// log.Field{Key: "uid", Value: uid},
|
||||
// log.Field{Key: "type", Value: tp.TT},
|
||||
// log.Field{Key: "params", Value: tp.Params})
|
||||
|
||||
if code := this.processOneTask(session, tp.TT, tp.Params...); code != pb.ErrorCode_Success {
|
||||
// this.Error("任务处理", log.Field{Key: "uid", Value: uid}, log.Field{Key: "code", Value: code})
|
||||
}
|
||||
|
||||
session.Push()
|
||||
comm.PuttaskParam(tp)
|
||||
}
|
||||
|
||||
update := map[string]interface{}{
|
||||
"vals": record.Vals,
|
||||
}
|
||||
|
||||
this.modelRtaskRecord.Change(uid, update)
|
||||
|
||||
this.PutUserSession(session)
|
||||
return
|
||||
}
|
||||
|
@ -2,14 +2,9 @@
|
||||
package rtask
|
||||
|
||||
import (
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
// 覆盖更新
|
||||
@ -19,93 +14,79 @@ func (this *ModelRtaskRecord) overrideUpdate(uid string, cfg *cfg.GameRdtaskCond
|
||||
return err
|
||||
}
|
||||
|
||||
record := &pb.DBRtaskRecord{Uid: uid}
|
||||
if err := this.Get(uid, record); err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
record.Id = primitive.NewObjectID().Hex()
|
||||
record.Ctime = configure.Now().Unix()
|
||||
if err := this.Add(uid, record); err != nil {
|
||||
return errors.Wrapf(err, "创建玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
}
|
||||
} else {
|
||||
return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
}
|
||||
// record := &pb.DBRtaskRecord{Uid: uid}
|
||||
// if err := this.Get(uid, record); err != nil {
|
||||
// if err == mongo.ErrNoDocuments {
|
||||
// record.Id = primitive.NewObjectID().Hex()
|
||||
// record.Ctime = configure.Now().Unix()
|
||||
// if err := this.Add(uid, record); err != nil {
|
||||
// return errors.Wrapf(err, "创建玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
// }
|
||||
// } else {
|
||||
// return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
// }
|
||||
// }
|
||||
|
||||
if this.record.Vals == nil {
|
||||
this.record.Vals = make(map[int32]*pb.RtaskData)
|
||||
}
|
||||
|
||||
if record.Vals == nil {
|
||||
record.Vals = make(map[int32]*pb.RtaskData)
|
||||
}
|
||||
|
||||
if v, ok := record.Vals[cfg.Id]; ok {
|
||||
this.moduleRtask.Debug("覆盖更新前",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "v", Value: v},
|
||||
log.Field{Key: "paramLen", Value: paramLen},
|
||||
log.Field{Key: "vals", Value: vals},
|
||||
log.Field{Key: "cfgId", Value: cfg.Id},
|
||||
)
|
||||
if v, ok := this.record.Vals[cfg.Id]; ok {
|
||||
v.Data = hasUpdateData(paramLen, v, vals...)
|
||||
this.moduleRtask.Debug("覆盖更新后",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "v", Value: v.Data},
|
||||
log.Field{Key: "paramLen", Value: paramLen},
|
||||
log.Field{Key: "vals", Value: vals},
|
||||
log.Field{Key: "cfgId", Value: cfg.Id},
|
||||
)
|
||||
if len(v.Data) > 0 {
|
||||
update := map[string]interface{}{
|
||||
"vals": record.Vals,
|
||||
}
|
||||
if err = this.Change(uid, update); err != nil {
|
||||
this.moduleRtask.Error("更新失败",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "update", Value: update})
|
||||
return
|
||||
}
|
||||
}
|
||||
// if len(v.Data) > 0 {
|
||||
// update := map[string]interface{}{
|
||||
// "vals": record.Vals,
|
||||
// }
|
||||
// if err = this.Change(uid, update); err != nil {
|
||||
// this.moduleRtask.Error("更新失败",
|
||||
// log.Field{Key: "uid", Value: uid},
|
||||
// log.Field{Key: "update", Value: update})
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
} else {
|
||||
data := &pb.RtaskData{
|
||||
Rtype: cfg.Type,
|
||||
Data: toMap(vals...),
|
||||
Timestamp: configure.Now().Unix(),
|
||||
}
|
||||
record.Vals[cfg.Id] = data
|
||||
this.record.Vals[cfg.Id] = data
|
||||
|
||||
update := map[string]interface{}{
|
||||
"vals": record.Vals,
|
||||
}
|
||||
// update := map[string]interface{}{
|
||||
// "vals": record.Vals,
|
||||
// }
|
||||
|
||||
if err = this.Change(uid, update); err != nil {
|
||||
this.moduleRtask.Error("更新失败",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "update", Value: update})
|
||||
return
|
||||
}
|
||||
// if err = this.Change(uid, update); err != nil {
|
||||
// this.moduleRtask.Error("更新失败",
|
||||
// log.Field{Key: "uid", Value: uid},
|
||||
// log.Field{Key: "update", Value: update})
|
||||
// return
|
||||
// }
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 累计更新 - 招募等
|
||||
func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData, vals ...int32) (err error) {
|
||||
record := &pb.DBRtaskRecord{Uid: uid}
|
||||
err = this.Get(uid, record)
|
||||
if err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
record.Id = primitive.NewObjectID().Hex()
|
||||
record.Ctime = configure.Now().Unix()
|
||||
if err := this.Add(uid, record); err != nil {
|
||||
return errors.Wrapf(err, "创建玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
}
|
||||
} else {
|
||||
return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
}
|
||||
}
|
||||
// record := &pb.DBRtaskRecord{Uid: uid}
|
||||
// err = this.Get(uid, record)
|
||||
// if err != nil {
|
||||
// if err == mongo.ErrNoDocuments {
|
||||
// record.Id = primitive.NewObjectID().Hex()
|
||||
// record.Ctime = configure.Now().Unix()
|
||||
// if err := this.Add(uid, record); err != nil {
|
||||
// return errors.Wrapf(err, "创建玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
// }
|
||||
// } else {
|
||||
// return errors.Wrapf(err, "获取玩家任务记录 err: %v rtype[%v]", uid, cfg.Id)
|
||||
// }
|
||||
// }
|
||||
|
||||
if record.Vals == nil {
|
||||
record.Vals = make(map[int32]*pb.RtaskData)
|
||||
if this.record.Vals == nil {
|
||||
this.record.Vals = make(map[int32]*pb.RtaskData)
|
||||
}
|
||||
//查找任务数据
|
||||
if v, ok := record.Vals[cfg.Id]; ok {
|
||||
if v, ok := this.record.Vals[cfg.Id]; ok {
|
||||
newArr := make([]int32, len(vals))
|
||||
copy(newArr, vals)
|
||||
srcCount := v.Data[0]
|
||||
@ -113,20 +94,20 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
|
||||
v.Data = toMap(newArr...)
|
||||
v.Timestamp = configure.Now().Unix()
|
||||
|
||||
update := map[string]interface{}{
|
||||
"vals": record.Vals,
|
||||
}
|
||||
err = this.Change(uid, update)
|
||||
// update := map[string]interface{}{
|
||||
// "vals": record.Vals,
|
||||
// }
|
||||
// err = this.Change(uid, update)
|
||||
} else {
|
||||
record.Vals[cfg.Id] = &pb.RtaskData{
|
||||
this.record.Vals[cfg.Id] = &pb.RtaskData{
|
||||
Data: toMap(vals...),
|
||||
Rtype: cfg.Type,
|
||||
Timestamp: configure.Now().Unix(),
|
||||
}
|
||||
update := map[string]interface{}{
|
||||
"vals": record.Vals,
|
||||
}
|
||||
err = this.Change(uid, update)
|
||||
// update := map[string]interface{}{
|
||||
// "vals": record.Vals,
|
||||
// }
|
||||
// err = this.Change(uid, update)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
|
||||
}
|
||||
}
|
||||
if len(tasks) > 0 {
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
|
||||
}
|
||||
|
||||
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.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
|
||||
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata})
|
||||
} else if !req.IsManualRefresh {
|
||||
// refresh := int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType2))
|
||||
@ -200,7 +200,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
|
||||
goods = transGoods(items, sdata)
|
||||
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: sdata})
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
|
||||
} else { //返回以前的商品列表
|
||||
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
|
@ -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.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
|
||||
// 发邮件
|
||||
if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil {
|
||||
this.module.Error("发送邮件 模板ID:GuildApproved",
|
||||
|
@ -96,7 +96,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
|
||||
if !isCheck {
|
||||
// 触发任务条件
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
|
||||
}
|
||||
rsp := &pb.SociatyApplyResp{
|
||||
Uid: uid,
|
||||
|
@ -197,6 +197,7 @@ func (this *ParkourComp) cancel(ctx context.Context, req *pb.RPCParkourCancelMat
|
||||
|
||||
//定时匹配处理
|
||||
func (this *ParkourComp) timer() {
|
||||
this.module.Errorf("捕羊大赛 定时匹配,%d", this.total)
|
||||
if this.total == 0 {
|
||||
return
|
||||
}
|
||||
@ -338,7 +339,7 @@ func (this *ParkourComp) timer() {
|
||||
reduser = append(reduser, this.teams[v]...)
|
||||
}
|
||||
for _, v := range bule {
|
||||
buleuser = append(reduser, this.teams[v]...)
|
||||
buleuser = append(buleuser, this.teams[v]...)
|
||||
}
|
||||
|
||||
if len(users)+rednum+bulenum < 6 {
|
||||
@ -357,6 +358,7 @@ func (this *ParkourComp) timer() {
|
||||
} else {
|
||||
v.Name = user.Name
|
||||
v.Avatar = user.Avatar
|
||||
v.Lv = user.Lv
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -372,6 +374,7 @@ func (this *ParkourComp) timer() {
|
||||
} else {
|
||||
v.Name = user.Name
|
||||
v.Avatar = user.Avatar
|
||||
v.Lv = user.Lv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,6 +169,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
||||
}
|
||||
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
|
||||
return
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
|
||||
}
|
||||
|
||||
if req.Figure != 0 {
|
||||
this.module.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype72, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype72, 1))
|
||||
}
|
||||
|
||||
this.mail.SendMailByCid(session, comm.Welcomemail, nil)
|
||||
|
@ -133,7 +133,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
this.module.RecoverUserPsStart(user.Uid)
|
||||
// 日常登录任务
|
||||
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype8, 1)
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype8, 1))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype8, 1))
|
||||
this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
|
||||
|
||||
rsp.Data = user
|
||||
|
@ -152,6 +152,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
}
|
||||
}
|
||||
}
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||
return
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
// 战斗结束的请求
|
||||
func (this *apiComp) BattlefinishCheck(session comm.IUserSession, req *pb.WorldtaskBattleFinishReq) (code pb.ErrorCode) {
|
||||
if req.GroupId <= 0 || req.CondiId <= 0 || req.BattleConfId <= 0 || req.TaskId <= 0 || req.Report == nil {
|
||||
if req.GroupId <= 0 || req.BattleConfId <= 0 || req.TaskId <= 0 || req.Report == nil {
|
||||
this.module.Error("世界任务战斗结束参数错误",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
log.Field{Key: "params", Value: req.String()},
|
||||
@ -70,7 +70,6 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
||||
if ibattle, ok := battleModule.(comm.IBattle); ok {
|
||||
var isWin bool
|
||||
if code, isWin = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
|
||||
|
||||
if isWin {
|
||||
if battleConf, ok := this.module.worldBattleConf.GetDataMap()[req.BattleConfId]; ok {
|
||||
if code := this.module.DispenseRes(session, []*cfg.Gameatn{battleConf.Playexp}, true); code != pb.ErrorCode_Success {
|
||||
@ -80,13 +79,14 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
||||
)
|
||||
} else {
|
||||
//触发任务
|
||||
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
|
||||
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
|
||||
}
|
||||
}
|
||||
}
|
||||
if userTask.CurrentTask == nil {
|
||||
userTask.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||
}
|
||||
|
||||
if _, ok := utils.Findx(userTask.CurrentTask[req.GroupId].CondiIds, req.CondiId); !ok {
|
||||
userTask.CurrentTask[req.GroupId].CondiIds = append(userTask.CurrentTask[req.GroupId].CondiIds, req.CondiId)
|
||||
}
|
||||
@ -105,6 +105,7 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
|
||||
TaskId: req.TaskId,
|
||||
CondiIds: userTask.CurrentTask[req.GroupId].CondiIds,
|
||||
})
|
||||
|
||||
}
|
||||
this.module.Debug("校验战报",
|
||||
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||
|
Loading…
Reference in New Issue
Block a user