批量打造优化

This commit is contained in:
meixiongfeng 2023-07-13 16:38:20 +08:00
parent 8dd12dd6d3
commit e1dc59f4fb
4 changed files with 48 additions and 44 deletions

View File

@ -186,7 +186,7 @@ type (
//查询服务资源数量 //查询服务资源数量
QueryEquipments(uid string) (equipment []*pb.DB_Equipment, errdata *pb.ErrorData) QueryEquipments(uid string) (equipment []*pb.DB_Equipment, errdata *pb.ErrorData)
//查询服务资源数量 db id //查询服务资源数量 db id
QueryEquipment(uid string, Id string) (equipment *pb.DB_Equipment, errdata *pb.ErrorData) QueryEquipment(uid string, Ids ...string) (equipment []*pb.DB_Equipment, errdata *pb.ErrorData)
//查询服务资源数量 参数武器配置id //查询服务资源数量 参数武器配置id
QueryEquipmentAmount(uid string, equipmentId string) (amount uint32) QueryEquipmentAmount(uid string, equipmentId string) (amount uint32)
//添加新武器 //添加新武器

View File

@ -19,7 +19,7 @@ type Activity struct {
modelhdList *modelHdList modelhdList *modelHdList
modelhdData *modelhdData modelhdData *modelhdData
warorder comm.IWarorder // 战令 //warorder comm.IWarorder // 战令
} }
func NewModule() core.IModule { func NewModule() core.IModule {
@ -52,11 +52,16 @@ func (this *Activity) Start() (err error) {
// 服务启动 获取活动信息 // 服务启动 获取活动信息
var module core.IModule var module core.IModule
if module, err = this.service.GetModule(comm.ModuleWarorder); err == nil { if module, err = this.service.GetModule(comm.ModuleWarorder); err == nil {
this.warorder = module.(comm.IWarorder) if m, ok := module.(comm.IWarorder); ok {
this.warorder.OpenWarorder(2, rst.Stime) m.OpenWarorder(2, rst.Stime)
} }
} }
// if module, err = this.service.GetModule(comm.ModulePay); err == nil {
// if m, ok := module.(comm.IPay); ok {
// m.OpenActivity(1, rst.Stime)
// }
// }
}
return return
} }
func (this *Activity) OnInstallComp() { func (this *Activity) OnInstallComp() {

View File

@ -77,17 +77,20 @@ func (this *Equipment) EventUserOffline(uid, sessionid string) {
// IEquipment------------------------------------------------------------------------------------------------------------------------------- // IEquipment-------------------------------------------------------------------------------------------------------------------------------
// 查询武器信息 // 查询武器信息
func (this *Equipment) QueryEquipment(uid string, id string) (equipment *pb.DB_Equipment, errdata *pb.ErrorData) { func (this *Equipment) QueryEquipment(uid string, ids ...string) (equipment []*pb.DB_Equipment, errdata *pb.ErrorData) {
var err error
for _, id := range ids {
if uid == "" || id == "" { if uid == "" || id == "" {
this.Errorf("请求参数错误 uid:%s Id:%s", uid, id) this.Errorf("请求参数错误 uid:%s Id:%s", uid, id)
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
} }
return continue
} }
if equipment, err = this.modelEquipment.QueryUserEquipmentsById(uid, id); err != nil { if equip, err := this.modelEquipment.QueryUserEquipmentsById(uid, id); err == nil {
equipment = append(equipment, equip)
} else {
if err == redis.Nil { if err == redis.Nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_EquipmentOnFoundEquipment, Code: pb.ErrorCode_EquipmentOnFoundEquipment,
@ -102,6 +105,8 @@ func (this *Equipment) QueryEquipment(uid string, id string) (equipment *pb.DB_E
} }
} }
} }
}
return return
} }

View File

@ -35,6 +35,7 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
lava *cfg.Gameatn lava *cfg.Gameatn
bQuality bool // 是否是精炼打造 bQuality bool // 是否是精炼打造
preHitCount int32 // 打造之前的次数 preHitCount int32 // 打造之前的次数
resReward []*cfg.Gameatn // 打造装备奖励
) )
// 参数校验 // 参数校验
if req.Count == 0 { // 传0 默认打造意见 if req.Count == 0 { // 传0 默认打造意见
@ -246,30 +247,23 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
for i := 0; i < int(req.Count); i++ { for i := 0; i < int(req.Count); i++ {
res := this.module.configure.GetDropReward(newdrop) res := this.module.configure.GetDropReward(newdrop)
if ok := this.module.modelStove.CheckForgetwoEquip(req.ReelId, stove.Data[req.ReelId].Lv, addProbability); ok { if ok := this.module.modelStove.CheckForgetwoEquip(req.ReelId, stove.Data[req.ReelId].Lv, addProbability); ok {
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata == nil { resReward = append(resReward, res...)
for _, v := range atno {
if eq, e := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); e == nil {
rsp.Equip = append(rsp.Equip, eq)
} }
resReward = append(resReward, res...)
}
if errdata, atno = this.module.DispenseAtno(session, resReward, true); errdata == nil {
ids := make([]string, 0)
for _, v := range atno {
ids = append(ids, v.O)
}
if rsp.Equip, errdata = this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), ids...); errdata != nil {
return
} }
} else { } else {
return return
} }
} }
if errdata, atno = this.module.DispenseAtno(session, res, true); errdata == nil {
for _, v := range atno {
if eq, err1 := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); err1 == nil {
rsp.Equip = append(rsp.Equip, eq)
}
}
} else {
return
}
}
}
if stoveLvConf, err := this.module.configure.GetSmithyStoveConf(stove.Lv); err == nil { if stoveLvConf, err := this.module.configure.GetSmithyStoveConf(stove.Lv); err == nil {
maxT = stoveLvConf.MaxTemperature maxT = stoveLvConf.MaxTemperature
} }