上传装备升级业务逻辑代码

This commit is contained in:
liwei1dao 2022-06-24 17:22:49 +08:00
parent cbc121ada6
commit 2584d994ce
11 changed files with 256 additions and 309 deletions

View File

@ -73,8 +73,8 @@ func (this *Api_Comp) Equip(session comm.IUserSession, agrs map[string]interface
code = pb.ErrorCode_SystemError
return
}
equipment.IsEquip = false
equipments[i].IsEquip = true
equipment.HeroId = ""
equipments[i].HeroId = hero.Id
updatequipment = append(updatequipment, equipment, equipments[i])
} else if equipments[i] == nil {
if equipment, err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), v); err != nil {
@ -82,12 +82,12 @@ func (this *Api_Comp) Equip(session comm.IUserSession, agrs map[string]interface
code = pb.ErrorCode_SystemError
return
}
equipment.IsEquip = false
equipment.HeroId = ""
updatequipment = append(updatequipment, equipment)
}
} else {
if equipments[i] != nil {
equipments[i].IsEquip = true
equipments[i].HeroId = hero.Id
updatequipment = append(updatequipment, equipments[i])
}
}

View File

@ -8,6 +8,7 @@ import (
//参数校验
func (this *Api_Comp) Getlist_Check(session comm.IUserSession, req *pb.Equipment_GetList_Req) (result map[string]interface{}, code comm.ErrorCode) {
return
}

View File

@ -1,23 +1,140 @@
package equipment
import (
"crypto/rand"
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"math/big"
"go.mongodb.org/mongo-driver/bson/primitive"
)
//参数校验
func (this *Api_Comp) Upgrade_Check(session comm.IUserSession, req *pb.Equipment_Upgrade_Req) (result map[string]interface{}, code comm.ErrorCode) {
var (
err error
conf *cfg.Game_equipmentData
equipment *pb.DB_Equipment
)
if req.EquipmentId == "" {
log.Errorf("Upgrade 请求参数错误 req:%v", req)
code.Code = pb.ErrorCode_ReqParameterError
return
}
if equipment, err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), req.EquipmentId); err != nil {
log.Errorf("Equip_Check err:%v", err)
code.Code = pb.ErrorCode_EquipmentOnFoundEquipment
return
}
if conf, err = this.module.configure_comp.GetEquipmentConfigureById(equipment.CId); err != nil {
log.Errorf("Equip_Check err:%v", err)
code.Code = pb.ErrorCode_EquipmentOnFoundEquipment
return
}
if equipment.Lv >= conf.MaxLv {
log.Errorf("Equip_Check Lv:%v MaxLv:%v", equipment.Lv, conf.MaxLv)
code.Code = pb.ErrorCode_EquipmentLvlimitReached
}
result = map[string]interface{}{
"equipment": equipment,
"conf": conf,
}
return
}
///英雄挂在装备
func (this *Api_Comp) Upgrade(session comm.IUserSession, agrs map[string]interface{}, req *pb.Equipment_Upgrade_Req) (code pb.ErrorCode) {
var (
err error
conf *cfg.Game_equipmentData
equipment *pb.DB_Equipment
hero *pb.DB_HeroData
equipments []*pb.DB_Equipment
probability int32
guaranteed int32
issucc bool
)
defer func() {
if code == pb.ErrorCode_Success {
session.SendMsg(string(this.module.GetType()), "", &pb.Equipment_Upgrade_Resp{})
}
}()
conf = agrs["conf"].(*cfg.Game_equipmentData)
equipment = agrs["equipment"].(*pb.DB_Equipment)
probability = conf.UpgradeProbability[equipment.Lv]
guaranteed = conf.UpgradeGuaranteed[equipment.Lv]
if equipment.KeepFailNum >= guaranteed { //没有达到保底次数 根据概率随机成功失败
issucc = true
} else { //随机
n, _ := rand.Int(rand.Reader, big.NewInt(100))
if int32(n.Int64()) < probability {
issucc = true
} else {
issucc = false
}
}
if issucc {
//没有佩戴的装备
if equipment.IsInitialState && equipment.OverlayNum > 1 { // 叠加装备 拆分处理
equipment.OverlayNum--
if err = this.module.model_equipment_comp.ChangeList(session.GetUserId(), equipment.Id, map[string]interface{}{
"overlayNum": equipment.OverlayNum,
"heroId": "",
}); err != nil {
log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError
return
}
equipment = CloneEquipment(equipment)
equipment.Id = primitive.NewObjectID().Hex()
equipment.IsInitialState = false
equipment.OverlayNum = 1
equipment.Lv++
if err = this.module.model_equipment_comp.AddList(session.GetUserId(), equipment.Id, equipment); err != nil {
log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError
return
}
} else {
equipment.IsInitialState = false
equipment.Lv++
if err = this.module.model_equipment_comp.ChangeList(session.GetUserId(), equipment.Id, map[string]interface{}{"lv": equipment.Lv}); err != nil {
log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError
return
}
}
if equipment.HeroId != "" { //已装备 重新计算属性
if hero, code = this.module.hero.GetHero(equipment.HeroId); code != pb.ErrorCode_Success {
log.Errorf("Upgrade code:%d", code)
return
}
hero.EquipID[conf.Station] = equipment.Id //拆分后的装备是一个新的
for i, v := range hero.EquipID {
if v != "" {
if v != equipment.Id {
if equipments[i], err = this.module.model_equipment_comp.Equipment_QueryUserEquipmentsPackById(session.GetUserId(), v); err != nil {
log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_EquipmentOnFoundEquipment
return
}
} else {
equipments[i] = equipment
}
}
}
equipment.Lv++
if err = this.module.model_equipment_comp.ChangeList(session.GetUserId(), equipment.Id, map[string]interface{}{"lv": equipment.Lv}); err != nil {
log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError
return
}
code = this.module.hero.UpdateEquipment(hero, equipments)
}
}
return
}

18
modules/equipment/core.go Normal file
View File

@ -0,0 +1,18 @@
package equipment
import "go_dreamfactory/pb"
func CloneEquipment(equipment *pb.DB_Equipment) *pb.DB_Equipment {
temp := &pb.DB_Equipment{
UId: equipment.UId,
CId: equipment.CId,
HeroId: equipment.HeroId,
Lv: equipment.Lv,
KeepFailNum: equipment.KeepFailNum,
MainEntry: make(map[uint32]int32),
AdverbEntry: make(map[uint32]int32),
OverlayNum: equipment.OverlayNum,
IsInitialState: equipment.IsInitialState,
}
return temp
}

View File

@ -102,7 +102,7 @@ func (this *Model_Equipment_Comp) Equipment_AddEquipmentsToPack(uId string, cIds
func (this *Model_Equipment_Comp) Equipment_UpdateIsEquip(uid string, equipments ...*pb.DB_Equipment) (err error) {
for _, v := range equipments {
if err = this.ChangeList(uid, v.Id, map[string]interface{}{
"isEquip": v.IsEquip,
"heroId": v.HeroId,
}); err != nil {
log.Errorf("Equipment_UpdateIsEquip err:%v", err)
return

View File

@ -1,234 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: equip_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type DB_EquipData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"`
EquipID int32 `protobuf:"varint,3,opt,name=equipID,proto3" json:"equipID"` // 装备的配置表ID
Star int32 `protobuf:"varint,4,opt,name=star,proto3" json:"star"` // 装备星级
Quality int32 `protobuf:"varint,5,opt,name=quality,proto3" json:"quality"` // 装备品质
Lv int32 `protobuf:"varint,6,opt,name=lv,proto3" json:"lv"` // 装备等级
AddProperty map[int32]int32 `protobuf:"bytes,7,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 装备附加属性
Baodi int32 `protobuf:"varint,8,opt,name=baodi,proto3" json:"baodi"` // 保底次数
Advance int32 `protobuf:"varint,9,opt,name=advance,proto3" json:"advance"` // 强化次数
FailCount int32 `protobuf:"varint,10,opt,name=failCount,proto3" json:"failCount"` // 连续强化失败次数
}
func (x *DB_EquipData) Reset() {
*x = DB_EquipData{}
if protoimpl.UnsafeEnabled {
mi := &file_equip_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DB_EquipData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DB_EquipData) ProtoMessage() {}
func (x *DB_EquipData) ProtoReflect() protoreflect.Message {
mi := &file_equip_db_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DB_EquipData.ProtoReflect.Descriptor instead.
func (*DB_EquipData) Descriptor() ([]byte, []int) {
return file_equip_db_proto_rawDescGZIP(), []int{0}
}
func (x *DB_EquipData) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DB_EquipData) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DB_EquipData) GetEquipID() int32 {
if x != nil {
return x.EquipID
}
return 0
}
func (x *DB_EquipData) GetStar() int32 {
if x != nil {
return x.Star
}
return 0
}
func (x *DB_EquipData) GetQuality() int32 {
if x != nil {
return x.Quality
}
return 0
}
func (x *DB_EquipData) GetLv() int32 {
if x != nil {
return x.Lv
}
return 0
}
func (x *DB_EquipData) GetAddProperty() map[int32]int32 {
if x != nil {
return x.AddProperty
}
return nil
}
func (x *DB_EquipData) GetBaodi() int32 {
if x != nil {
return x.Baodi
}
return 0
}
func (x *DB_EquipData) GetAdvance() int32 {
if x != nil {
return x.Advance
}
return 0
}
func (x *DB_EquipData) GetFailCount() int32 {
if x != nil {
return x.FailCount
}
return 0
}
var File_equip_db_proto protoreflect.FileDescriptor
var file_equip_db_proto_rawDesc = []byte{
0x0a, 0x0e, 0x65, 0x71, 0x75, 0x69, 0x70, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0xd8, 0x02, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x44, 0x61, 0x74,
0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x18, 0x03,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x65, 0x71, 0x75, 0x69, 0x70, 0x49, 0x44, 0x12, 0x12, 0x0a,
0x04, 0x73, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x61,
0x72, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01,
0x28, 0x05, 0x52, 0x07, 0x71, 0x75, 0x61, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x6c,
0x76, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x40, 0x0a, 0x0b, 0x61,
0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x1e, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x44, 0x61, 0x74, 0x61, 0x2e,
0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x14, 0x0a,
0x05, 0x62, 0x61, 0x6f, 0x64, 0x69, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x62, 0x61,
0x6f, 0x64, 0x69, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x09,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x61, 0x64, 0x76, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1c, 0x0a,
0x09, 0x66, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05,
0x52, 0x09, 0x66, 0x61, 0x69, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x3e, 0x0a, 0x10, 0x41,
0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_equip_db_proto_rawDescOnce sync.Once
file_equip_db_proto_rawDescData = file_equip_db_proto_rawDesc
)
func file_equip_db_proto_rawDescGZIP() []byte {
file_equip_db_proto_rawDescOnce.Do(func() {
file_equip_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_equip_db_proto_rawDescData)
})
return file_equip_db_proto_rawDescData
}
var file_equip_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_equip_db_proto_goTypes = []interface{}{
(*DB_EquipData)(nil), // 0: DB_EquipData
nil, // 1: DB_EquipData.AddPropertyEntry
}
var file_equip_db_proto_depIdxs = []int32{
1, // 0: DB_EquipData.addProperty:type_name -> DB_EquipData.AddPropertyEntry
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_equip_db_proto_init() }
func file_equip_db_proto_init() {
if File_equip_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_equip_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DB_EquipData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_equip_db_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_equip_db_proto_goTypes,
DependencyIndexes: file_equip_db_proto_depIdxs,
MessageInfos: file_equip_db_proto_msgTypes,
}.Build()
File_equip_db_proto = out.File
file_equip_db_proto_rawDesc = nil
file_equip_db_proto_goTypes = nil
file_equip_db_proto_depIdxs = nil
}

View File

@ -116,13 +116,13 @@ type DB_Equipment struct {
Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id" bson:"_id"` //装备id
CId int32 `protobuf:"zigzag32,2,opt,name=cId,proto3" json:"cId" bson:"cId"` // 配置Id
UId string `protobuf:"bytes,3,opt,name=uId,proto3" json:"uId" bson:"uid"` // 所属玩家Id
IsEquip bool `protobuf:"varint,4,opt,name=isEquip,proto3" json:"isEquip" bson:"isEquip"` // 是否装备
Lv int32 `protobuf:"zigzag32,5,opt,name=lv,proto3" json:"lv" bson:"lv"` //装备强化等级
KeepFailNum int32 `protobuf:"zigzag32,6,opt,name=keepFailNum,proto3" json:"keepFailNum" bson:"keepFailNum"` // 连续强化失败次数
MainEntry map[uint32]int32 `protobuf:"bytes,7,rep,name=mainEntry,proto3" json:"mainEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"mainEntry"` // 装备主词条
AdverbEntry map[uint32]int32 `protobuf:"bytes,8,rep,name=adverbEntry,proto3" json:"adverbEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"adverbEntry"` //装备副词条
OverlayNum uint32 `protobuf:"varint,9,opt,name=overlayNum,proto3" json:"overlayNum" bson:"overlayNum"` //叠加数量
IsInitialState bool `protobuf:"varint,10,opt,name=isInitialState,proto3" json:"isInitialState" bson:"isInitialState"` //是否初始状态
HeroId string `protobuf:"bytes,5,opt,name=heroId,proto3" json:"heroId" bson:"heroId"` // 挂在的英雄卡片id 未装备 填 ''
Lv int32 `protobuf:"zigzag32,6,opt,name=lv,proto3" json:"lv" bson:"lv"` //装备强化等级
KeepFailNum int32 `protobuf:"zigzag32,7,opt,name=keepFailNum,proto3" json:"keepFailNum" bson:"keepFailNum"` // 连续强化失败次数
MainEntry map[uint32]int32 `protobuf:"bytes,8,rep,name=mainEntry,proto3" json:"mainEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"mainEntry"` // 装备主词条
AdverbEntry map[uint32]int32 `protobuf:"bytes,9,rep,name=adverbEntry,proto3" json:"adverbEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"adverbEntry"` //装备副词条
OverlayNum uint32 `protobuf:"varint,10,opt,name=overlayNum,proto3" json:"overlayNum" bson:"overlayNum"` //叠加数量
IsInitialState bool `protobuf:"varint,11,opt,name=isInitialState,proto3" json:"isInitialState" bson:"isInitialState"` //是否初始状态
}
func (x *DB_Equipment) Reset() {
@ -178,11 +178,11 @@ func (x *DB_Equipment) GetUId() string {
return ""
}
func (x *DB_Equipment) GetIsEquip() bool {
func (x *DB_Equipment) GetHeroId() string {
if x != nil {
return x.IsEquip
return x.HeroId
}
return false
return ""
}
func (x *DB_Equipment) GetLv() int32 {
@ -231,42 +231,42 @@ var File_equipment_equipment_db_proto protoreflect.FileDescriptor
var file_equipment_equipment_db_proto_rawDesc = []byte{
0x0a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd2,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0,
0x03, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12,
0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x63, 0x49,
0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x75, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x18, 0x04,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x45, 0x71, 0x75, 0x69, 0x70, 0x12, 0x0e, 0x0a,
0x02, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a,
0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01,
0x28, 0x11, 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12,
0x3a, 0x0a, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e,
0x74, 0x2e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x61,
0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x1e, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a,
0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a,
0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18,
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c,
0x53, 0x74, 0x61, 0x74, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x2a, 0x1c, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74,
0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10,
0x00, 0x2a, 0x20, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64,
0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69,
0x74, 0x10, 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x75, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x05, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c,
0x76, 0x18, 0x06, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x6b,
0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x11,
0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12, 0x3a, 0x0a,
0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e,
0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09,
0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x61, 0x64, 0x76,
0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e,
0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x64,
0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b,
0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f,
0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52,
0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x69,
0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20,
0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74,
0x61, 0x74, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
0x01, 0x2a, 0x1c, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x61,
0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x2a,
0x20, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x76, 0x65,
0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10,
0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (

View File

@ -65,6 +65,7 @@ const (
ErrorCode_HeroNoExist ErrorCode = 1300 //英雄不存在
//equipment
ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器
ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限
)
// Enum value maps for ErrorCode.
@ -107,6 +108,7 @@ var (
1203: "PackGirdAmountUpper",
1300: "HeroNoExist",
1400: "EquipmentOnFoundEquipment",
1401: "EquipmentLvlimitReached",
}
ErrorCode_value = map[string]int32{
"Success": 0,
@ -146,6 +148,7 @@ var (
"PackGirdAmountUpper": 1203,
"HeroNoExist": 1300,
"EquipmentOnFoundEquipment": 1400,
"EquipmentLvlimitReached": 1401,
}
)
@ -180,7 +183,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, 0x8d, 0x06, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0xab, 0x06, 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,
@ -229,8 +232,9 @@ var file_errorcode_proto_rawDesc = []byte{
0x10, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4e, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x94,
0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, 0x6e,
0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0xf8,
0x0a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x76,
0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -12,14 +12,14 @@ enum EquipmentAdverbEntry {
}
message DB_Equipment {
string Id = 1; //@go_tags(`bson:"_id"`) id
sint32 cId = 2; //@go_tags(`bson:"cId"`) Id
string uId = 3; //@go_tags(`bson:"uid"`) Id
bool isEquip = 4; //@go_tags(`bson:"isEquip"`)
sint32 lv = 5; //@go_tags(`bson:"lv"`)
sint32 keepFailNum = 6; //@go_tags(`bson:"keepFailNum"`)
map<uint32,int32> mainEntry = 7; //@go_tags(`bson:"mainEntry"`)
map<uint32,int32> adverbEntry = 8; //@go_tags(`bson:"adverbEntry"`)
uint32 overlayNum = 9; //@go_tags(`bson:"overlayNum"`)
bool isInitialState = 10; //@go_tags(`bson:"isInitialState"`)
string Id = 1; //@go_tags(`bson:"_id"`) id
sint32 cId = 2; //@go_tags(`bson:"cId"`) Id
string uId = 3; //@go_tags(`bson:"uid"`) Id
string heroId = 5; //@go_tags(`bson:"heroId"`) id ''
sint32 lv = 6; //@go_tags(`bson:"lv"`)
sint32 keepFailNum = 7; //@go_tags(`bson:"keepFailNum"`)
map<uint32,int32> mainEntry = 8; //@go_tags(`bson:"mainEntry"`)
map<uint32,int32> adverbEntry = 9; //@go_tags(`bson:"adverbEntry"`)
uint32 overlayNum = 10; //@go_tags(`bson:"overlayNum"`)
bool isInitialState = 11; //@go_tags(`bson:"isInitialState"`)
}

View File

@ -49,4 +49,5 @@ enum ErrorCode {
//equipment
EquipmentOnFoundEquipment = 1400; //
EquipmentLvlimitReached = 1401; //
}

View File

@ -1,4 +1,3 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
@ -11,23 +10,64 @@ package cfg
import "errors"
type Game_equipmentData struct {
Id int32
Name string
Star int32
Quality int32
Station int32
Id int32
Name string
Star int32
Quality int32
Station int32
MaxLv int32
UpgradeProbability []int32
UpgradeGuaranteed []int32
}
func (Game_equipmentData) GetTypeId() int {
return 859081052
return 859081052
}
func NewGame_equipmentData(_buf map[string]interface{}) (_v *Game_equipmentData, err error) {
_v = &Game_equipmentData{}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["quality"].(float64); !_ok_ { err = errors.New("quality error"); return }; _v.Quality = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["station"].(float64); !_ok_ { err = errors.New("station error"); return }; _v.Station = int32(_tempNum_) }
return
_v = &Game_equipmentData{}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ {
err = errors.New("id error")
return
}
_v.Id = int32(_tempNum_)
}
{
var _ok_ bool
if _v.Name, _ok_ = _buf["name"].(string); !_ok_ {
err = errors.New("name error")
return
}
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ {
err = errors.New("star error")
return
}
_v.Star = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["quality"].(float64); !_ok_ {
err = errors.New("quality error")
return
}
_v.Quality = int32(_tempNum_)
}
{
var _ok_ bool
var _tempNum_ float64
if _tempNum_, _ok_ = _buf["station"].(float64); !_ok_ {
err = errors.New("station error")
return
}
_v.Station = int32(_tempNum_)
}
return
}