天赋树重置

This commit is contained in:
wh_zcy 2023-04-20 18:42:24 +08:00
parent 631c924514
commit 52e08a5c7a
2 changed files with 56 additions and 5 deletions

View File

@ -0,0 +1,40 @@
package reputation
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *apiComp) ResetCheck(session comm.IUserSession, req *pb.ReputationTalentresetReq) (code pb.ErrorCode) {
if req.RaceType < 1 && req.RaceType > 4 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Reset(session comm.IUserSession, req *pb.ReputationTalentresetReq) (code pb.ErrorCode, data *pb.ErrorData) {
uid := session.GetUserId()
reputation := this.module.modelReputation.getDBReputation(uid)
if reputation == nil {
code = pb.ErrorCode_DataNotFound
return
}
if v, ok := reputation.Camps[req.RaceType]; ok {
v.Nodes = []*pb.TalentNode{}
}
update := map[string]interface{}{
"camps": reputation.Camps,
}
if err := this.module.modelReputation.Change(uid, update); err != nil {
code = pb.ErrorCode_DBError
return
}
rsp := &pb.ReputationTalentresetResp{}
session.SendMsg(string(this.module.GetType()), "reset", rsp)
return
}

View File

@ -294,11 +294,13 @@ func (x *ReputationTalentResp) GetCamp() *Camp {
return nil
}
// 天赋树重置
// 阵营天赋树重置
type ReputationTalentresetReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RaceType int32 `protobuf:"varint,1,opt,name=raceType,proto3" json:"raceType"`
}
func (x *ReputationTalentresetReq) Reset() {
@ -333,6 +335,13 @@ func (*ReputationTalentresetReq) Descriptor() ([]byte, []int) {
return file_reputation_reputation_msg_proto_rawDescGZIP(), []int{6}
}
func (x *ReputationTalentresetReq) GetRaceType() int32 {
if x != nil {
return x.RaceType
}
return 0
}
type ReputationTalentresetResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -397,11 +406,13 @@ var file_reputation_reputation_msg_proto_rawDesc = []byte{
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x61, 0x6d, 0x70, 0x41, 0x74, 0x74, 0x72, 0x52, 0x0a, 0x61,
0x74, 0x74, 0x72, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x12, 0x19, 0x0a, 0x04, 0x63, 0x61, 0x6d,
0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x05, 0x2e, 0x43, 0x61, 0x6d, 0x70, 0x52, 0x04,
0x63, 0x61, 0x6d, 0x70, 0x22, 0x1a, 0x0a, 0x18, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69,
0x63, 0x61, 0x6d, 0x70, 0x22, 0x36, 0x0a, 0x18, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x72, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71,
0x22, 0x1b, 0x0a, 0x19, 0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61,
0x6c, 0x65, 0x6e, 0x74, 0x72, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x1a, 0x0a, 0x08, 0x72, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x72, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x1b, 0x0a, 0x19,
0x72, 0x65, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74,
0x72, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (