Commit 686ff0487b24ab9aaa8e10bd2ee24223622508ae
1 parent
ddc88bac
fix: 结束战斗增加字段
Showing
3 changed files
with
22 additions
and
24 deletions
Show diff stats
cmd/gameserver/action/RoleAction.go
@@ -233,18 +233,20 @@ func RoleEndBattleRpc(role *models.RoleModel, msg components.IMessage) (int32, i | @@ -233,18 +233,20 @@ func RoleEndBattleRpc(role *models.RoleModel, msg components.IMessage) (int32, i | ||
233 | reward = role.Award(reward) | 233 | reward = role.Award(reward) |
234 | 234 | ||
235 | //exp | 235 | //exp |
236 | - var exp int32 | 236 | + var amount int32 |
237 | if req.Pass { | 237 | if req.Pass { |
238 | - exp = carbonInfo.CarbonExp | 238 | + amount = carbonInfo.CarbonExp |
239 | } else { | 239 | } else { |
240 | - exp = carbonInfo.CarbonFailExp | 240 | + amount = carbonInfo.CarbonFailExp |
241 | } | 241 | } |
242 | - level, exp := role.UpLevel(exp) | 242 | + level, exp := role.UpLevel(amount) |
243 | 243 | ||
244 | rsp := pb.RoleEndBattleRsp{ | 244 | rsp := pb.RoleEndBattleRsp{ |
245 | - RoleLevel: level, | ||
246 | - RoleExp: exp, | ||
247 | - Reward: common.MapNumToString(reward), | 245 | + RoleLevel: level, |
246 | + RoleExp: exp, | ||
247 | + RoleExpamount: amount, | ||
248 | + Pass: req.Pass, | ||
249 | + Reward: common.MapNumToString(reward), | ||
248 | } | 250 | } |
249 | return 0, rsp | 251 | return 0, rsp |
250 | } | 252 | } |
models/rolePlugin.go
@@ -134,7 +134,7 @@ func (m *RoleModel) UpLevel(exp int32) (int32, int32) { | @@ -134,7 +134,7 @@ func (m *RoleModel) UpLevel(exp int32) (int32, int32) { | ||
134 | level := m.Role.Level | 134 | level := m.Role.Level |
135 | oldLevelExp := csvdata.Get().TbAccountLevelExp.Get(level) | 135 | oldLevelExp := csvdata.Get().TbAccountLevelExp.Get(level) |
136 | if exp >= oldLevelExp.NeedExp-m.Role.Exp { | 136 | if exp >= oldLevelExp.NeedExp-m.Role.Exp { |
137 | - exp = exp - oldLevelExp.NeedExp | 137 | + exp = exp - (oldLevelExp.NeedExp - m.Role.Exp) |
138 | level++ | 138 | level++ |
139 | 139 | ||
140 | for exp > 0 { | 140 | for exp > 0 { |
pb/protocode.pb.go
@@ -38,9 +38,8 @@ const ( | @@ -38,9 +38,8 @@ const ( | ||
38 | ProtoCode_RoleStartBattleReq ProtoCode = 12 | 38 | ProtoCode_RoleStartBattleReq ProtoCode = 12 |
39 | ProtoCode_RoleEndBattleReq ProtoCode = 13 | 39 | ProtoCode_RoleEndBattleReq ProtoCode = 13 |
40 | ProtoCode_RoleEndBattleRsp ProtoCode = 14 | 40 | ProtoCode_RoleEndBattleRsp ProtoCode = 14 |
41 | - ProtoCode_RoleRewardRsp ProtoCode = 15 | ||
42 | - ProtoCode_EquipmentDelReq ProtoCode = 16 | ||
43 | - ProtoCode_EquipmentAddRsp ProtoCode = 17 | 41 | + ProtoCode_EquipmentDelReq ProtoCode = 15 |
42 | + ProtoCode_EquipmentAddRsp ProtoCode = 16 | ||
44 | ) | 43 | ) |
45 | 44 | ||
46 | // Enum value maps for ProtoCode. | 45 | // Enum value maps for ProtoCode. |
@@ -61,9 +60,8 @@ var ( | @@ -61,9 +60,8 @@ var ( | ||
61 | 12: "RoleStartBattleReq", | 60 | 12: "RoleStartBattleReq", |
62 | 13: "RoleEndBattleReq", | 61 | 13: "RoleEndBattleReq", |
63 | 14: "RoleEndBattleRsp", | 62 | 14: "RoleEndBattleRsp", |
64 | - 15: "RoleRewardRsp", | ||
65 | - 16: "EquipmentDelReq", | ||
66 | - 17: "EquipmentAddRsp", | 63 | + 15: "EquipmentDelReq", |
64 | + 16: "EquipmentAddRsp", | ||
67 | } | 65 | } |
68 | ProtoCode_value = map[string]int32{ | 66 | ProtoCode_value = map[string]int32{ |
69 | "UNKNOWN": 0, | 67 | "UNKNOWN": 0, |
@@ -81,9 +79,8 @@ var ( | @@ -81,9 +79,8 @@ var ( | ||
81 | "RoleStartBattleReq": 12, | 79 | "RoleStartBattleReq": 12, |
82 | "RoleEndBattleReq": 13, | 80 | "RoleEndBattleReq": 13, |
83 | "RoleEndBattleRsp": 14, | 81 | "RoleEndBattleRsp": 14, |
84 | - "RoleRewardRsp": 15, | ||
85 | - "EquipmentDelReq": 16, | ||
86 | - "EquipmentAddRsp": 17, | 82 | + "EquipmentDelReq": 15, |
83 | + "EquipmentAddRsp": 16, | ||
87 | } | 84 | } |
88 | ) | 85 | ) |
89 | 86 | ||
@@ -118,7 +115,7 @@ var File_protocode_proto protoreflect.FileDescriptor | @@ -118,7 +115,7 @@ var File_protocode_proto protoreflect.FileDescriptor | ||
118 | 115 | ||
119 | var file_protocode_proto_rawDesc = []byte{ | 116 | var file_protocode_proto_rawDesc = []byte{ |
120 | 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, | 117 | 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, |
121 | - 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0xe1, 0x02, 0x0a, | 118 | + 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0xce, 0x02, 0x0a, |
122 | 0x09, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, | 119 | 0x09, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, |
123 | 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, | 120 | 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, |
124 | 0x52, 0x73, 0x70, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, | 121 | 0x52, 0x73, 0x70, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, |
@@ -137,12 +134,11 @@ var file_protocode_proto_rawDesc = []byte{ | @@ -137,12 +134,11 @@ var file_protocode_proto_rawDesc = []byte{ | ||
137 | 0x6c, 0x65, 0x52, 0x65, 0x71, 0x10, 0x0c, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x6f, 0x6c, 0x65, 0x45, | 134 | 0x6c, 0x65, 0x52, 0x65, 0x71, 0x10, 0x0c, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x6f, 0x6c, 0x65, 0x45, |
138 | 0x6e, 0x64, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x10, 0x0d, 0x12, 0x14, 0x0a, | 135 | 0x6e, 0x64, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x10, 0x0d, 0x12, 0x14, 0x0a, |
139 | 0x10, 0x52, 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x73, | 136 | 0x10, 0x52, 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x73, |
140 | - 0x70, 0x10, 0x0e, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, | ||
141 | - 0x64, 0x52, 0x73, 0x70, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, | ||
142 | - 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x10, 0x10, 0x12, 0x13, 0x0a, 0x0f, 0x45, | ||
143 | - 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x52, 0x73, 0x70, 0x10, 0x11, | ||
144 | - 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, | ||
145 | - 0x6f, 0x74, 0x6f, 0x33, | 137 | + 0x70, 0x10, 0x0e, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, |
138 | + 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x10, 0x0f, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, | ||
139 | + 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x52, 0x73, 0x70, 0x10, 0x10, 0x42, 0x0a, 0x5a, | ||
140 | + 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, | ||
141 | + 0x33, | ||
146 | } | 142 | } |
147 | 143 | ||
148 | var ( | 144 | var ( |