From 87bee82e24ef27fd1ec7cdf7f59c0876ceb2c0d2 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 18 Jan 2024 14:02:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A3=85=E5=A4=87=E9=99=84?= =?UTF-8?q?=E9=AD=94=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/buried/core.go | 2 +- modules/equipment/api_ench.go | 31 ++++++++++------ pb/equipment_msg.pb.go | 70 ++++++++++++++++++++++++----------- 3 files changed, 69 insertions(+), 34 deletions(-) diff --git a/modules/buried/core.go b/modules/buried/core.go index 3d21f47e1..dcf11c669 100644 --- a/modules/buried/core.go +++ b/modules/buried/core.go @@ -19,7 +19,7 @@ const ( const ( eq = "eq" // == gt = "gt" // > - gte = "gte" //>= + gte = "gte" // >= lt = "lt" // < lte = "lte" // <= ne = "ne" // != diff --git a/modules/equipment/api_ench.go b/modules/equipment/api_ench.go index 263b51894..48b956899 100644 --- a/modules/equipment/api_ench.go +++ b/modules/equipment/api_ench.go @@ -23,13 +23,14 @@ func (this *apiComp) EnchCheck(session comm.IUserSession, req *pb.EquipmentEnchR // 附魔 func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (errdata *pb.ErrorData) { var ( - equip *pb.DB_Equipment - conf *cfg.GameEquipEnchantingData - hero *pb.DBHero - equipments []*pb.DB_Equipment - need []*cfg.Gameatn - AttrValue int32 - err error + equip *pb.DB_Equipment + conf *cfg.GameEquipEnchantingData + hero *pb.DBHero + equipments []*pb.DB_Equipment + need []*cfg.Gameatn + OldAttrValue int32 + AttrValue int32 + err error ) if errdata = this.EnchCheck(session, req); errdata != nil { return @@ -71,9 +72,11 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) ( return } AttrValue = rand.Int31n(conf.AttrMax-conf.AttrMini) + conf.AttrMini - // if AttrValue > equip.AdverbEntry[req.Index].Value { - equip.AdverbEntry[req.Index].EnchValue = AttrValue - // } + OldAttrValue = equip.AdverbEntry[req.Index].Value + if AttrValue > equip.AdverbEntry[req.Index].Value { + equip.AdverbEntry[req.Index].EnchValue = AttrValue + this.module.equipmentsChangePush(session, []*pb.DB_Equipment{equip}) + } if err = this.module.modelEquipment.ChangeList(session.GetUserId(), equip.Id, map[string]interface{}{ "adverbEntry": equip.AdverbEntry, "isInitialState": false, @@ -112,7 +115,13 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) ( } } - session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip}) + session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{ + Eid: req.Eid, + Itemid: req.Itemid, + Index: req.Index, + Oldvalue: OldAttrValue, + Newvalue: AttrValue, + }) go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype94, 1)) diff --git a/pb/equipment_msg.pb.go b/pb/equipment_msg.pb.go index d6f653e28..4427f567b 100644 --- a/pb/equipment_msg.pb.go +++ b/pb/equipment_msg.pb.go @@ -992,8 +992,11 @@ type EquipmentEnchResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Issucc bool `protobuf:"varint,1,opt,name=issucc,proto3" json:"issucc"` - Equipment *DB_Equipment `protobuf:"bytes,2,opt,name=Equipment,proto3" json:"Equipment"` + Eid string `protobuf:"bytes,1,opt,name=eid,proto3" json:"eid"` + Itemid string `protobuf:"bytes,2,opt,name=itemid,proto3" json:"itemid"` + Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index"` + Oldvalue int32 `protobuf:"varint,4,opt,name=oldvalue,proto3" json:"oldvalue"` + Newvalue int32 `protobuf:"varint,5,opt,name=newvalue,proto3" json:"newvalue"` } func (x *EquipmentEnchResp) Reset() { @@ -1028,18 +1031,39 @@ func (*EquipmentEnchResp) Descriptor() ([]byte, []int) { return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{18} } -func (x *EquipmentEnchResp) GetIssucc() bool { +func (x *EquipmentEnchResp) GetEid() string { if x != nil { - return x.Issucc + return x.Eid } - return false + return "" } -func (x *EquipmentEnchResp) GetEquipment() *DB_Equipment { +func (x *EquipmentEnchResp) GetItemid() string { if x != nil { - return x.Equipment + return x.Itemid } - return nil + return "" +} + +func (x *EquipmentEnchResp) GetIndex() int32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *EquipmentEnchResp) GetOldvalue() int32 { + if x != nil { + return x.Oldvalue + } + return 0 +} + +func (x *EquipmentEnchResp) GetNewvalue() int32 { + if x != nil { + return x.Newvalue + } + return 0 } var File_equipment_equipment_msg_proto protoreflect.FileDescriptor @@ -1133,14 +1157,17 @@ var file_equipment_equipment_msg_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x58, 0x0a, 0x11, 0x45, 0x71, 0x75, 0x69, 0x70, - 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, - 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, - 0x73, 0x75, 0x63, 0x63, 0x12, 0x2b, 0x0a, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, - 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, - 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x8b, 0x01, 0x0a, 0x11, 0x45, 0x71, 0x75, 0x69, + 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x45, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, + 0x03, 0x65, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x65, 0x69, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x69, 0x74, 0x65, 0x6d, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x69, 0x74, 0x65, 0x6d, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1a, 0x0a, + 0x08, 0x6f, 0x6c, 0x64, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x08, 0x6f, 0x6c, 0x64, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x65, 0x77, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6e, 0x65, 0x77, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1191,12 +1218,11 @@ var file_equipment_equipment_msg_proto_depIdxs = []int32{ 21, // 6: EquipmentSellResp.reward:type_name -> UserAtno 21, // 7: EquipmentForgResp.reward:type_name -> UserAtno 22, // 8: EquipmentWashResp.adverbEntry:type_name -> EquipmentAttributeEntry - 19, // 9: EquipmentEnchResp.Equipment:type_name -> DB_Equipment - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name + 9, // [9:9] is the sub-list for method output_type + 9, // [9:9] is the sub-list for method input_type + 9, // [9:9] is the sub-list for extension type_name + 9, // [9:9] is the sub-list for extension extendee + 0, // [0:9] is the sub-list for field type_name } func init() { file_equipment_equipment_msg_proto_init() }