批量打造优化
This commit is contained in:
parent
8dd12dd6d3
commit
e1dc59f4fb
@ -186,7 +186,7 @@ type (
|
||||
//查询服务资源数量
|
||||
QueryEquipments(uid string) (equipment []*pb.DB_Equipment, errdata *pb.ErrorData)
|
||||
//查询服务资源数量 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
|
||||
QueryEquipmentAmount(uid string, equipmentId string) (amount uint32)
|
||||
//添加新武器
|
||||
|
@ -19,7 +19,7 @@ type Activity struct {
|
||||
modelhdList *modelHdList
|
||||
modelhdData *modelhdData
|
||||
|
||||
warorder comm.IWarorder // 战令
|
||||
//warorder comm.IWarorder // 战令
|
||||
}
|
||||
|
||||
func NewModule() core.IModule {
|
||||
@ -52,11 +52,16 @@ func (this *Activity) Start() (err error) {
|
||||
// 服务启动 获取活动信息
|
||||
var module core.IModule
|
||||
if module, err = this.service.GetModule(comm.ModuleWarorder); err == nil {
|
||||
this.warorder = module.(comm.IWarorder)
|
||||
this.warorder.OpenWarorder(2, rst.Stime)
|
||||
if m, ok := module.(comm.IWarorder); ok {
|
||||
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
|
||||
}
|
||||
func (this *Activity) OnInstallComp() {
|
||||
|
@ -77,31 +77,36 @@ func (this *Equipment) EventUserOffline(uid, sessionid string) {
|
||||
|
||||
// IEquipment-------------------------------------------------------------------------------------------------------------------------------
|
||||
// 查询武器信息
|
||||
func (this *Equipment) QueryEquipment(uid string, id string) (equipment *pb.DB_Equipment, errdata *pb.ErrorData) {
|
||||
var err error
|
||||
if uid == "" || id == "" {
|
||||
this.Errorf("请求参数错误 uid:%s Id:%s", uid, id)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
if equipment, err = this.modelEquipment.QueryUserEquipmentsById(uid, id); err != nil {
|
||||
if err == redis.Nil {
|
||||
func (this *Equipment) QueryEquipment(uid string, ids ...string) (equipment []*pb.DB_Equipment, errdata *pb.ErrorData) {
|
||||
|
||||
for _, id := range ids {
|
||||
if uid == "" || id == "" {
|
||||
this.Errorf("请求参数错误 uid:%s Id:%s", uid, id)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_EquipmentOnFoundEquipment,
|
||||
Title: pb.ErrorCode_EquipmentOnFoundEquipment.ToString(),
|
||||
Message: fmt.Sprintf("未找到装备 uid:%s id:%s", uid, id),
|
||||
Code: pb.ErrorCode_ReqParameterError,
|
||||
Title: pb.ErrorCode_ReqParameterError.ToString(),
|
||||
}
|
||||
continue
|
||||
}
|
||||
if equip, err := this.modelEquipment.QueryUserEquipmentsById(uid, id); err == nil {
|
||||
equipment = append(equipment, equip)
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Title: pb.ErrorCode_SystemError.ToString(),
|
||||
Message: err.Error(),
|
||||
if err == redis.Nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_EquipmentOnFoundEquipment,
|
||||
Title: pb.ErrorCode_EquipmentOnFoundEquipment.ToString(),
|
||||
Message: fmt.Sprintf("未找到装备 uid:%s id:%s", uid, id),
|
||||
}
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
Title: pb.ErrorCode_SystemError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,9 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
maxT int32
|
||||
atno []*pb.UserAtno
|
||||
lava *cfg.Gameatn
|
||||
bQuality bool // 是否是精炼打造
|
||||
preHitCount int32 // 打造之前的次数
|
||||
bQuality bool // 是否是精炼打造
|
||||
preHitCount int32 // 打造之前的次数
|
||||
resReward []*cfg.Gameatn // 打造装备奖励
|
||||
)
|
||||
// 参数校验
|
||||
if req.Count == 0 { // 传0 默认打造意见
|
||||
@ -246,28 +247,21 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
for i := 0; i < int(req.Count); i++ {
|
||||
res := this.module.configure.GetDropReward(newdrop)
|
||||
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 {
|
||||
for _, v := range atno {
|
||||
if eq, e := this.module.ModuleEquipment.QueryEquipment(session.GetUserId(), v.O); e == nil {
|
||||
rsp.Equip = append(rsp.Equip, eq)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
resReward = append(resReward, res...)
|
||||
}
|
||||
|
||||
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 {
|
||||
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 {
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if stoveLvConf, err := this.module.configure.GetSmithyStoveConf(stove.Lv); err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user