新增章节奖励接口
This commit is contained in:
parent
822ae4c6ef
commit
6471ccda73
@ -109,6 +109,15 @@ func GetDecoarteReward(Scene int, Lv int) []*item.Item {
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetAreaReward(AreaId int) []*item.Item {
|
||||
value, err := gamedata.GetDataByIntKey(DECORATE_AREA, AreaId)
|
||||
if err != nil {
|
||||
log.Debug("IndoorProgress GetDecoarteReward not found")
|
||||
return nil
|
||||
}
|
||||
return gamedata.GetItemList(value, "Items")
|
||||
}
|
||||
|
||||
// 获取一键装饰的解锁等级
|
||||
func GetOneKeyDecorateUnlockLv() int {
|
||||
data, err := gamedata.GetDataByKey(DECORATE_CONST, "OneKey")
|
||||
|
||||
@ -760,9 +760,9 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
||||
RegisterMsgProcessFunc("ReqCreatePetOrder", ReqCreatePetOrder) // 生成消耗品订单
|
||||
|
||||
//装饰
|
||||
RegisterMsgProcessFunc("ReqDecorate", ReqDecorate) // 装饰
|
||||
RegisterMsgProcessFunc("ReqDecorateAll", ReqDecorateAll) // 装饰全部
|
||||
RegisterMsgProcessFunc("ReqDecorateReward", ReqDecorateReward) // 装饰全部
|
||||
RegisterMsgProcessFunc("ReqDecorate", ReqDecorate) // 装饰
|
||||
RegisterMsgProcessFunc("ReqDecorateAll", ReqDecorateAll) // 装饰全部
|
||||
RegisterMsgProcessFunc("ReqAreaReward", ReqAreaReward) // 章节奖励
|
||||
//Gm命令
|
||||
RegisterMsgProcessFunc("ReqGmCommand", ReqGmCommand) // Gm命令
|
||||
|
||||
|
||||
@ -656,8 +656,34 @@ func ReqDecorateAll(player *Player, buf []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReqDecorateReward(player *Player, buf []byte) error {
|
||||
|
||||
func ReqAreaReward(player *Player, buf []byte) error {
|
||||
req := &msg.ReqAreaReward{}
|
||||
err := proto.Unmarshal(buf, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
DecorateMod := player.PlayMod.getDecorateMod()
|
||||
RewardItem, err := DecorateMod.GetDecorateReward(int(req.AreaId))
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResAreaReward{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: err.Error(),
|
||||
})
|
||||
return err
|
||||
}
|
||||
err = player.HandleItem(RewardItem, msg.ITEM_POP_LABEL_DecorateReward.String())
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResAreaReward{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
Msg: err.Error(),
|
||||
})
|
||||
return err
|
||||
}
|
||||
player.PushClientRes(&msg.ResAreaReward{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
player.PushClientRes(DecorateMod.BackData())
|
||||
player.PlayMod.save()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -185,7 +185,7 @@ func (d *Decorate) GetDecorateReward(areaId int) ([]*item.Item, error) {
|
||||
return nil, fmt.Errorf("areaId already rewarded")
|
||||
}
|
||||
d.AreaReward = append(d.AreaReward, areaId)
|
||||
return decorateCfg.GetDecoarteReward(areaId, 20), nil
|
||||
return decorateCfg.GetAreaReward(areaId), nil
|
||||
}
|
||||
|
||||
func (d *Decorate) GetAreaId() int {
|
||||
|
||||
@ -7297,27 +7297,27 @@ func (x *ResDecorateAll) GetMsg() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type ReqDecorateReward struct {
|
||||
type ReqAreaReward struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
AreaId int32 `protobuf:"varint,1,opt,name=AreaId,proto3" json:"AreaId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ReqDecorateReward) Reset() {
|
||||
*x = ReqDecorateReward{}
|
||||
func (x *ReqAreaReward) Reset() {
|
||||
*x = ReqAreaReward{}
|
||||
mi := &file_proto_Gameapi_proto_msgTypes[108]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ReqDecorateReward) String() string {
|
||||
func (x *ReqAreaReward) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReqDecorateReward) ProtoMessage() {}
|
||||
func (*ReqAreaReward) ProtoMessage() {}
|
||||
|
||||
func (x *ReqDecorateReward) ProtoReflect() protoreflect.Message {
|
||||
func (x *ReqAreaReward) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_Gameapi_proto_msgTypes[108]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -7329,19 +7329,19 @@ func (x *ReqDecorateReward) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ReqDecorateReward.ProtoReflect.Descriptor instead.
|
||||
func (*ReqDecorateReward) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ReqAreaReward.ProtoReflect.Descriptor instead.
|
||||
func (*ReqAreaReward) Descriptor() ([]byte, []int) {
|
||||
return file_proto_Gameapi_proto_rawDescGZIP(), []int{108}
|
||||
}
|
||||
|
||||
func (x *ReqDecorateReward) GetAreaId() int32 {
|
||||
func (x *ReqAreaReward) GetAreaId() int32 {
|
||||
if x != nil {
|
||||
return x.AreaId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ResDecorateReward struct {
|
||||
type ResAreaReward struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Code RES_CODE `protobuf:"varint,1,opt,name=Code,proto3,enum=tutorial.RES_CODE" json:"Code,omitempty"`
|
||||
Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
|
||||
@ -7349,20 +7349,20 @@ type ResDecorateReward struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ResDecorateReward) Reset() {
|
||||
*x = ResDecorateReward{}
|
||||
func (x *ResAreaReward) Reset() {
|
||||
*x = ResAreaReward{}
|
||||
mi := &file_proto_Gameapi_proto_msgTypes[109]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ResDecorateReward) String() string {
|
||||
func (x *ResAreaReward) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ResDecorateReward) ProtoMessage() {}
|
||||
func (*ResAreaReward) ProtoMessage() {}
|
||||
|
||||
func (x *ResDecorateReward) ProtoReflect() protoreflect.Message {
|
||||
func (x *ResAreaReward) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_Gameapi_proto_msgTypes[109]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -7374,19 +7374,19 @@ func (x *ResDecorateReward) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ResDecorateReward.ProtoReflect.Descriptor instead.
|
||||
func (*ResDecorateReward) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use ResAreaReward.ProtoReflect.Descriptor instead.
|
||||
func (*ResAreaReward) Descriptor() ([]byte, []int) {
|
||||
return file_proto_Gameapi_proto_rawDescGZIP(), []int{109}
|
||||
}
|
||||
|
||||
func (x *ResDecorateReward) GetCode() RES_CODE {
|
||||
func (x *ResAreaReward) GetCode() RES_CODE {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return RES_CODE_FAIL
|
||||
}
|
||||
|
||||
func (x *ResDecorateReward) GetMsg() string {
|
||||
func (x *ResAreaReward) GetMsg() string {
|
||||
if x != nil {
|
||||
return x.Msg
|
||||
}
|
||||
@ -28000,10 +28000,10 @@ const file_proto_Gameapi_proto_rawDesc = "" +
|
||||
"\x0eReqDecorateAll\"J\n" +
|
||||
"\x0eResDecorateAll\x12&\n" +
|
||||
"\x04Code\x18\x01 \x01(\x0e2\x12.tutorial.RES_CODER\x04Code\x12\x10\n" +
|
||||
"\x03Msg\x18\x02 \x01(\tR\x03Msg\"+\n" +
|
||||
"\x11ReqDecorateReward\x12\x16\n" +
|
||||
"\x06AreaId\x18\x01 \x01(\x05R\x06AreaId\"M\n" +
|
||||
"\x11ResDecorateReward\x12&\n" +
|
||||
"\x03Msg\x18\x02 \x01(\tR\x03Msg\"'\n" +
|
||||
"\rReqAreaReward\x12\x16\n" +
|
||||
"\x06AreaId\x18\x01 \x01(\x05R\x06AreaId\"I\n" +
|
||||
"\rResAreaReward\x12&\n" +
|
||||
"\x04Code\x18\x01 \x01(\x0e2\x12.tutorial.RES_CODER\x04Code\x12\x10\n" +
|
||||
"\x03Msg\x18\x02 \x01(\tR\x03Msg\"<\n" +
|
||||
"\fReqGmCommand\x12\x18\n" +
|
||||
@ -29843,8 +29843,8 @@ var file_proto_Gameapi_proto_goTypes = []any{
|
||||
(*ResDecorate)(nil), // 118: tutorial.ResDecorate
|
||||
(*ReqDecorateAll)(nil), // 119: tutorial.ReqDecorateAll
|
||||
(*ResDecorateAll)(nil), // 120: tutorial.ResDecorateAll
|
||||
(*ReqDecorateReward)(nil), // 121: tutorial.ReqDecorateReward
|
||||
(*ResDecorateReward)(nil), // 122: tutorial.ResDecorateReward
|
||||
(*ReqAreaReward)(nil), // 121: tutorial.ReqAreaReward
|
||||
(*ResAreaReward)(nil), // 122: tutorial.ResAreaReward
|
||||
(*ReqGmCommand)(nil), // 123: tutorial.ReqGmCommand
|
||||
(*Card)(nil), // 124: tutorial.Card
|
||||
(*ReqCardInfo)(nil), // 125: tutorial.ReqCardInfo
|
||||
@ -30340,7 +30340,7 @@ var file_proto_Gameapi_proto_depIdxs = []int32{
|
||||
169, // 56: tutorial.DecoratePart.Items:type_name -> tutorial.ItemInfo
|
||||
2, // 57: tutorial.ResDecorate.Code:type_name -> tutorial.RES_CODE
|
||||
2, // 58: tutorial.ResDecorateAll.Code:type_name -> tutorial.RES_CODE
|
||||
2, // 59: tutorial.ResDecorateReward.Code:type_name -> tutorial.RES_CODE
|
||||
2, // 59: tutorial.ResAreaReward.Code:type_name -> tutorial.RES_CODE
|
||||
124, // 60: tutorial.ResCardInfo.CardList:type_name -> tutorial.Card
|
||||
503, // 61: tutorial.ResCardInfo.AllCard:type_name -> tutorial.ResCardInfo.AllCardEntry
|
||||
504, // 62: tutorial.ResCardInfo.Handbook:type_name -> tutorial.ResCardInfo.HandbookEntry
|
||||
|
||||
Loading…
Reference in New Issue
Block a user