上传世界任务代码
This commit is contained in:
parent
4fa9beb9b0
commit
8646d2bcdf
@ -31,6 +31,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
|
|||||||
equipLv map[int32]int32 = make(map[int32]int32)
|
equipLv map[int32]int32 = make(map[int32]int32)
|
||||||
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)
|
||||||
)
|
)
|
||||||
|
|
||||||
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
|
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
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
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 {
|
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 {
|
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 {
|
if hero.SuiteId != 0 {
|
||||||
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.Rtype98, 1, 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 {
|
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.Rtype98, 1, hero.Suite1Lv)
|
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})
|
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})
|
||||||
|
@ -36,6 +36,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)
|
||||||
)
|
)
|
||||||
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
return
|
||||||
@ -169,21 +170,28 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
|||||||
|
|
||||||
if hero.SuiteId != 0 {
|
if hero.SuiteId != 0 {
|
||||||
hero.Suite1Lv = suite1Lv
|
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 {
|
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)
|
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
|
||||||
}
|
}
|
||||||
//随机任务触发
|
//随机任务触发
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)
|
tasks = append(tasks, comm.GettaskParam(comm.Rtype43, 1, equipment.Lv))
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype44, equipment.Lv)
|
tasks = append(tasks, comm.GettaskParam(comm.Rtype44, 1, equipment.Lv))
|
||||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
|
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 {
|
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 {
|
} 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 {
|
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())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
}
|
}
|
||||||
} else {
|
} 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})
|
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
|
||||||
return
|
return
|
||||||
|
@ -97,7 +97,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
|
|||||||
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
|
tasks []*comm.TaskParam = make([]*comm.TaskParam, 0)
|
||||||
)
|
)
|
||||||
if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil {
|
if configure, err = this.module.configure.GetEquipmentConfigure(); err != nil {
|
||||||
return
|
return
|
||||||
|
@ -20,7 +20,6 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq)
|
|||||||
err error
|
err error
|
||||||
items []*pb.DB_UserItemData
|
items []*pb.DB_UserItemData
|
||||||
nt int64
|
nt int64
|
||||||
// tempgrids []*pb.DB_UserItemData
|
|
||||||
grids []*pb.DB_UserItemData
|
grids []*pb.DB_UserItemData
|
||||||
modifys []*pb.DB_UserItemData
|
modifys []*pb.DB_UserItemData
|
||||||
dels []*pb.DB_UserItemData
|
dels []*pb.DB_UserItemData
|
||||||
|
@ -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.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))
|
||||||
|
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype21, 1), comm.GettaskParam(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 {
|
||||||
code = pb.ErrorCode_ConfigNoFound
|
code = pb.ErrorCode_ConfigNoFound
|
||||||
|
@ -28,6 +28,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)
|
||||||
)
|
)
|
||||||
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
if code = this.BuyCheck(session, req); code != pb.ErrorCode_Success {
|
||||||
return
|
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 {
|
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))
|
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 {
|
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))
|
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})
|
session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user