Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
4a2971f08e
@ -88,11 +88,15 @@ func (this *apiComp) ForgeEquip(session comm.IUserSession, req *pb.SmithyForgeEq
|
||||
// 熟练度减少的温度
|
||||
t := this.module.modelStove.CheckTemperature(req.ReelId, stove.Data[req.ReelId].Lv)
|
||||
needTemperatureCos = needTemperatureCos * (1000 - t) / 1000 // 千分比
|
||||
|
||||
// 工具台技能减少
|
||||
_s := this.module.modelStove.StoveToolsTemperature(stove)
|
||||
if _s != 0 {
|
||||
needTemperatureCos *= (1 - _s/1000)
|
||||
}
|
||||
if req.Lava > 0 { // 熔岩打造
|
||||
exemption := this.module.ModuleTools.GetGlobalConf().ExemptionTemperatureCos // 预计消耗温度
|
||||
gloabNum := this.module.ModuleTools.GetGlobalConf().ExemptionTemperatureCosNum
|
||||
if needTemperatureCos > req.Lava*gloabNum {
|
||||
if needTemperatureCos > req.Count*gloabNum {
|
||||
code = pb.ErrorCode_SmithyLackLava // 缺少熔岩
|
||||
return
|
||||
}
|
||||
|
@ -16,30 +16,23 @@ func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.UserSellRe
|
||||
//分解道具
|
||||
func (this *apiComp) SellItem(session comm.IUserSession, req *pb.UserSellResReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
||||
var (
|
||||
item []*pb.UserAtno // 出售的道具
|
||||
equip []*pb.UserAtno // 出售的装备
|
||||
sale []*pb.UserAssets
|
||||
equip []string // 出售的装备
|
||||
sale []*pb.UserAssets
|
||||
mapitem map[string]int32
|
||||
)
|
||||
mapitem = map[string]int32{}
|
||||
if code = this.SellItemCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
for _, v := range req.Atno {
|
||||
if v.A == "item" {
|
||||
item = append(item, v)
|
||||
mapitem[v.O] += v.N
|
||||
} else if v.A == "equi" {
|
||||
equip = append(equip, v)
|
||||
equip = append(equip, v.O)
|
||||
}
|
||||
}
|
||||
if len(item) > 0 {
|
||||
|
||||
}
|
||||
if len(equip) > 0 {
|
||||
var id []string
|
||||
for _, v := range equip {
|
||||
id = append(id, v.O)
|
||||
}
|
||||
if code, d := this.module.ModuleEquipment.SellEquipments(session, id); code != pb.ErrorCode_Success {
|
||||
//sale = append(sale, d...)
|
||||
if len(mapitem) > 0 {
|
||||
if c, d := this.module.ModuleItems.SellItem(session, mapitem); c != pb.ErrorCode_Success {
|
||||
for _, v := range d {
|
||||
sale = append(sale, &pb.UserAssets{
|
||||
A: v.A,
|
||||
@ -47,6 +40,23 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.UserSellResReq)
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
code = c
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(equip) > 0 {
|
||||
if c, d := this.module.ModuleEquipment.SellEquipments(session, equip); c != pb.ErrorCode_Success {
|
||||
for _, v := range d {
|
||||
sale = append(sale, &pb.UserAssets{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
code = c
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user