上传世界任务代码

This commit is contained in:
liwei1dao 2023-03-10 16:23:49 +08:00
parent 4fa9beb9b0
commit 8646d2bcdf
6 changed files with 59 additions and 25 deletions

View File

@ -30,7 +30,8 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
equipStr map[int32]int32 = make(map[int32]int32)
equipLv map[int32]int32 = make(map[int32]int32)
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)
)
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
@ -168,20 +169,31 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
code = pb.ErrorCode_SystemError
return
}
this.module.ModuleRtask.SendToRtask(session, comm.Rtype5, utils.ToInt32(hero.HeroID), equipNum)
tasks = append(tasks, comm.GettaskParam(comm.Rtype5, 1, utils.ToInt32(hero.HeroID), equipNum))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype5, utils.ToInt32(hero.HeroID), equipNum)
for k, v := range equipStr {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype41, utils.ToInt32(hero.HeroID), v, k)
tasks = append(tasks, comm.GettaskParam(comm.Rtype41, 1, utils.ToInt32(hero.HeroID), v, k))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype41, utils.ToInt32(hero.HeroID), v, k)
}
for k, v := range equipLv {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype42, utils.ToInt32(hero.HeroID), v, k)
tasks = append(tasks, comm.GettaskParam(comm.Rtype42, 1, utils.ToInt32(hero.HeroID), v, k))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype42, utils.ToInt32(hero.HeroID), v, k)
}
if hero.SuiteId != 0 {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
tasks = append(tasks, comm.GettaskParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype98, 1, hero.Suite1Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
}
if hero.SuiteExtId != 0 {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
tasks = append(tasks, comm.GettaskParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
tasks = append(tasks, comm.GettaskParam(comm.Rtype98, 1, hero.Suite1Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
}
if len(tasks) > 0 {
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})

View File

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

View File

@ -96,8 +96,8 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
var (
configure *cfg.GameEquip
add map[string]*pb.DB_Equipment
uId string = session.GetUserId()
tasks []*comm.TaskParam
uId string = session.GetUserId()
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
)
if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil {
return

View File

@ -20,7 +20,6 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq)
err error
items []*pb.DB_UserItemData
nt int64
// tempgrids []*pb.DB_UserItemData
grids []*pb.DB_UserItemData
modifys []*pb.DB_UserItemData
dels []*pb.DB_UserItemData

View File

@ -61,8 +61,10 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
}
//随机任务
this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, 1)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, utils.ToInt32(sale.Prize[0].T))
// 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)))
case 4: //自选宝箱
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {
code = pb.ErrorCode_ConfigNoFound

View File

@ -28,6 +28,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
record *pb.UserShopData
need []*cfg.Gameatn
give []*cfg.Gameatn
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
)
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
return
@ -117,18 +118,26 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
}
//随机任务
this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
tasks = append(tasks, comm.GettaskParam(comm.Rtype64, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype64, 1)
for _, v := range give {
if v.A == comm.ItemType {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype65, v.N, utils.ToInt32(v.T))
tasks = append(tasks, comm.GettaskParam(comm.Rtype65, v.N, utils.ToInt32(v.T)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype65, v.N, utils.ToInt32(v.T))
}
}
this.module.ModuleRtask.SendToRtask(session, comm.Rtype66, 1, int32(req.ShopType))
tasks = append(tasks, comm.GettaskParam(comm.Rtype66, 1, int32(req.ShopType)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype66, 1, int32(req.ShopType))
for _, v := range need {
if v.A == comm.AttrType && (v.T == comm.ResGold || v.T == comm.ResDiamond) {
this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T))
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype67, v.N, utils.ToInt32(v.T))
}
}
if len(tasks) > 0 {
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true})
return
}