对接装备
This commit is contained in:
parent
bc19f93618
commit
91f883e47e
@ -30,12 +30,7 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.SmithySellReq) (cod
|
||||
// return
|
||||
// }
|
||||
|
||||
|
||||
if imodule, err := this.service.GetModule(comm.ModuleEquipment); err == nil {
|
||||
if iequip, ok := imodule.(comm.IEquipment); ok {
|
||||
iequip.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId()))
|
||||
}
|
||||
}
|
||||
this.module.ModuleEquipment.RecycleEquipments(session, req.EquipIds, this.module.modelStove.StoveToolsSellUp(session.GetUserId()))
|
||||
|
||||
_ = this.module.modelTrade.updateCustomer(session.GetUserId(), req.CustomerId)
|
||||
|
||||
|
@ -3,6 +3,7 @@ package smithy
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
@ -151,25 +152,33 @@ func (s *modelTrade) updateCustomer(uid string, customerId int32) error {
|
||||
// 返回概率下的套装
|
||||
func (s *modelTrade) GetSuitRandom(uid string) string {
|
||||
//获取玩家所有解锁套装
|
||||
unlockEquips := []*pb.DB_Equipment{}
|
||||
var unlockEquipsItems []*WeightItem
|
||||
for _, v := range unlockEquips {
|
||||
unlockEquipsItems = append(unlockEquipsItems, &WeightItem{
|
||||
Id: v.Id,
|
||||
uex, err := s.module.ModuleUser.GetUserExpand(uid)
|
||||
if err != nil {
|
||||
s.module.Errorln(err)
|
||||
return ""
|
||||
}
|
||||
var unlockSuiteItems []*WeightItem
|
||||
for _, v := range uex.SuiteId {
|
||||
unlockSuiteItems = append(unlockSuiteItems, &WeightItem{
|
||||
Id: v,
|
||||
Weight: 5,
|
||||
})
|
||||
}
|
||||
//获取玩家已有装备
|
||||
ownerEquips := []*pb.DB_Equipment{}
|
||||
var ownerEquipsItems []*WeightItem
|
||||
for _, v := range ownerEquips {
|
||||
ownerEquipsItems = append(ownerEquipsItems, &WeightItem{
|
||||
Id: v.Id,
|
||||
ec, suites := s.module.ModuleEquipment.GetActionableSuit(uid)
|
||||
if ec!=pb.ErrorCode_Success {
|
||||
s.module.Error("获取玩家已有装备:", log.Field{Key:"code",Value: ec})
|
||||
return ""
|
||||
}
|
||||
var ownerSuiteItems []*WeightItem
|
||||
for _, v := range suites {
|
||||
ownerSuiteItems = append(ownerSuiteItems, &WeightItem{
|
||||
Id: v,
|
||||
Weight: 7,
|
||||
})
|
||||
}
|
||||
|
||||
merge := append(unlockEquipsItems, ownerEquipsItems...)
|
||||
merge := append(unlockSuiteItems, ownerSuiteItems...)
|
||||
// 设置权重
|
||||
wr := newWeightedRandom(merge)
|
||||
if c := wr.pick(); c != nil {
|
||||
|
@ -316,11 +316,13 @@ const (
|
||||
ErrorCode_AutoBattleNoData ErrorCode = 4001 //没有正在自动战斗的数据
|
||||
ErrorCode_AutoBattleStatesErr ErrorCode = 4002 // 自动战斗状态错误
|
||||
// smithy
|
||||
ErrorCode_SmithyNoReel ErrorCode = 4101 // 没有激活图纸信息
|
||||
ErrorCode_SmithyNoTemperature ErrorCode = 4102 // 炉温不够不能打造
|
||||
ErrorCode_SmithyStoveMaxLv ErrorCode = 4103 // 炉子达到最大等级
|
||||
ErrorCode_SmithyCustomerLimit ErrorCode = 4104 //顾客上限
|
||||
ErrorCode_SmithyMaxTemperature ErrorCode = 4105 //炉温达上限
|
||||
ErrorCode_SmithyNoReel ErrorCode = 4101 // 没有激活图纸信息
|
||||
ErrorCode_SmithyNoTemperature ErrorCode = 4102 // 炉温不够不能打造
|
||||
ErrorCode_SmithyStoveMaxLv ErrorCode = 4103 // 炉子达到最大等级
|
||||
ErrorCode_SmithyCustomerLimit ErrorCode = 4104 //顾客上限
|
||||
ErrorCode_SmithyCustomerEquipNoEnough ErrorCode = 4105 //装备回收数量不足
|
||||
ErrorCode_SmithyMaxTemperature ErrorCode = 4106 // 炉温达上限
|
||||
ErrorCode_SmithyLackLava ErrorCode = 4107 // 缺少熔岩
|
||||
)
|
||||
|
||||
// Enum value maps for ErrorCode.
|
||||
@ -591,7 +593,9 @@ var (
|
||||
4102: "SmithyNoTemperature",
|
||||
4103: "SmithyStoveMaxLv",
|
||||
4104: "SmithyCustomerLimit",
|
||||
4105: "SmithyMaxTemperature",
|
||||
4105: "SmithyCustomerEquipNoEnough",
|
||||
4106: "SmithyMaxTemperature",
|
||||
4107: "SmithyLackLava",
|
||||
}
|
||||
ErrorCode_value = map[string]int32{
|
||||
"Success": 0,
|
||||
@ -859,7 +863,9 @@ var (
|
||||
"SmithyNoTemperature": 4102,
|
||||
"SmithyStoveMaxLv": 4103,
|
||||
"SmithyCustomerLimit": 4104,
|
||||
"SmithyMaxTemperature": 4105,
|
||||
"SmithyCustomerEquipNoEnough": 4105,
|
||||
"SmithyMaxTemperature": 4106,
|
||||
"SmithyLackLava": 4107,
|
||||
}
|
||||
)
|
||||
|
||||
@ -894,7 +900,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_errorcode_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2a, 0x8b, 0x30, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0xc2, 0x30, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
@ -1277,9 +1283,13 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x10, 0x86, 0x20, 0x12, 0x15, 0x0a, 0x10, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x53, 0x74, 0x6f,
|
||||
0x76, 0x65, 0x4d, 0x61, 0x78, 0x4c, 0x76, 0x10, 0x87, 0x20, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x6d,
|
||||
0x69, 0x74, 0x68, 0x79, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69,
|
||||
0x74, 0x10, 0x88, 0x20, 0x12, 0x19, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x4d, 0x61,
|
||||
0x78, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x89, 0x20, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x10, 0x88, 0x20, 0x12, 0x20, 0x0a, 0x1b, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x43, 0x75,
|
||||
0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x45, 0x71, 0x75, 0x69, 0x70, 0x4e, 0x6f, 0x45, 0x6e, 0x6f,
|
||||
0x75, 0x67, 0x68, 0x10, 0x89, 0x20, 0x12, 0x19, 0x0a, 0x14, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79,
|
||||
0x4d, 0x61, 0x78, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x10, 0x8a,
|
||||
0x20, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6d, 0x69, 0x74, 0x68, 0x79, 0x4c, 0x61, 0x63, 0x6b, 0x4c,
|
||||
0x61, 0x76, 0x61, 0x10, 0x8b, 0x20, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user