Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
39221f5fb2
@ -420,4 +420,8 @@ type (
|
||||
IPandaAtlas interface {
|
||||
CheckActivatePandaAtlasCollect(uid string, id string) (code pb.ErrorCode)
|
||||
}
|
||||
//练功房
|
||||
IPractice interface {
|
||||
AddItems(session IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode)
|
||||
}
|
||||
)
|
||||
|
@ -39,7 +39,7 @@ type ModuleBase struct {
|
||||
ModuleSociaty comm.ISociaty //公会
|
||||
ModulePrivilege comm.IPrivilege // 月卡
|
||||
ModuleSmithy comm.ISmithy //
|
||||
ModulePandaAtlas comm.IPandaAtlas //
|
||||
ModulePractice comm.IPractice //练功房
|
||||
}
|
||||
|
||||
//重构模块配置对象
|
||||
@ -121,10 +121,10 @@ func (this *ModuleBase) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.ModuleSmithy = module.(comm.ISmithy)
|
||||
if module, err = this.service.GetModule(comm.ModulePandaAtlas); err != nil {
|
||||
if module, err = this.service.GetModule(comm.ModulePractice); err != nil {
|
||||
return
|
||||
}
|
||||
this.ModulePandaAtlas = module.(comm.IPandaAtlas)
|
||||
this.ModulePractice = module.(comm.IPractice)
|
||||
return
|
||||
}
|
||||
|
||||
@ -453,10 +453,8 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
}
|
||||
}
|
||||
if len(panda) > 0 {
|
||||
for k := range panda {
|
||||
code = this.ModulePandaAtlas.CheckActivatePandaAtlasCollect(session.GetUserId(), k)
|
||||
this.Debugf("发放武馆图鉴资源: %v [%v]", k, code)
|
||||
}
|
||||
code = this.ModulePractice.AddItems(session, panda, bPush)
|
||||
this.Debugf("发放武馆资源: %v [%v]", panda, code)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -51,6 +51,11 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
|
||||
filed = "pillarf"
|
||||
break
|
||||
}
|
||||
if !pillar.Isunlock { //柱子未解锁
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
return
|
||||
}
|
||||
|
||||
if pillarconfigure, err = this.module.configure.getGamePandamasMz(pillar.Lv); err != nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
|
@ -41,10 +41,10 @@ func (this *modelPandata) queryUserMartialhall(uid string) (result *pb.DBPractic
|
||||
Uid: uid,
|
||||
Full: make(map[int32]int32),
|
||||
Knapsack: make(map[string]int32),
|
||||
Pillar1: &pb.DBPracticePillar{Index: 1},
|
||||
Pillar2: &pb.DBPracticePillar{Index: 2},
|
||||
Pillar3: &pb.DBPracticePillar{Index: 3},
|
||||
Pillarf: &pb.DBPracticePillar{Index: 4},
|
||||
Pillar1: &pb.DBPracticePillar{Index: 1, Isunlock: true, Lv: 1},
|
||||
Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1},
|
||||
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
|
||||
Pillarf: &pb.DBPracticePillar{Index: 4, Lv: 1},
|
||||
}
|
||||
if err = this.Add(uid, result); err != nil {
|
||||
this.module.Errorln(err)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -21,6 +22,7 @@ type Practice struct {
|
||||
modules.ModuleBase
|
||||
service base.IRPCXService
|
||||
mail comm.Imail
|
||||
atlas comm.IPandaAtlas
|
||||
api *apiComp
|
||||
configure *configureComp
|
||||
modelPandata *modelPandata
|
||||
@ -44,6 +46,10 @@ func (this *Practice) Start() (err error) {
|
||||
return
|
||||
}
|
||||
this.mail = module.(comm.Imail)
|
||||
if module, err = this.service.GetModule(comm.ModulePandaAtlas); err != nil {
|
||||
return
|
||||
}
|
||||
this.atlas = module.(comm.IPandaAtlas)
|
||||
return
|
||||
}
|
||||
|
||||
@ -54,3 +60,26 @@ func (this *Practice) OnInstallComp() {
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
this.modelPandata = this.RegisterComp(new(modelPandata)).(*modelPandata)
|
||||
}
|
||||
|
||||
func (this *Practice) AddItems(session comm.IUserSession, items map[string]int32, bPush bool) (code pb.ErrorCode) {
|
||||
var (
|
||||
err error
|
||||
room *pb.DBPracticeRoom
|
||||
id []string
|
||||
)
|
||||
if room, err = this.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
id = make([]string, 0)
|
||||
for k, _ := range items {
|
||||
room.Knapsack[k] = 0
|
||||
id = append(id, k)
|
||||
this.atlas.CheckActivatePandaAtlasCollect(session.GetUserId(), k)
|
||||
}
|
||||
this.modelPandata.Change(session.GetUserId(), map[string]interface{}{
|
||||
"knapsack": room.Knapsack,
|
||||
})
|
||||
session.SendMsg(string(this.GetType()), "jxitem", &pb.PracticeJXItemPush{Id: id})
|
||||
return
|
||||
}
|
||||
|
@ -835,6 +835,54 @@ func (x *PracticeEnrolledResp) GetHero() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
///练功道具和教习推送
|
||||
type PracticeJXItemPush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id []string `protobuf:"bytes,1,rep,name=id,proto3" json:"id"`
|
||||
}
|
||||
|
||||
func (x *PracticeJXItemPush) Reset() {
|
||||
*x = PracticeJXItemPush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_practice_practice_msg_proto_msgTypes[16]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *PracticeJXItemPush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*PracticeJXItemPush) ProtoMessage() {}
|
||||
|
||||
func (x *PracticeJXItemPush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_practice_practice_msg_proto_msgTypes[16]
|
||||
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 PracticeJXItemPush.ProtoReflect.Descriptor instead.
|
||||
func (*PracticeJXItemPush) Descriptor() ([]byte, []int) {
|
||||
return file_practice_practice_msg_proto_rawDescGZIP(), []int{16}
|
||||
}
|
||||
|
||||
func (x *PracticeJXItemPush) GetId() []string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_practice_practice_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_practice_practice_msg_proto_rawDesc = []byte{
|
||||
@ -899,8 +947,11 @@ var file_practice_practice_msg_proto_rawDesc = []byte{
|
||||
0x14, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x72, 0x6f, 0x6c, 0x6c, 0x65,
|
||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x68,
|
||||
0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22,
|
||||
0x24, 0x0a, 0x12, 0x50, 0x72, 0x61, 0x63, 0x74, 0x69, 0x63, 0x65, 0x4a, 0x58, 0x49, 0x74, 0x65,
|
||||
0x6d, 0x50, 0x75, 0x73, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -915,7 +966,7 @@ func file_practice_practice_msg_proto_rawDescGZIP() []byte {
|
||||
return file_practice_practice_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_practice_practice_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
|
||||
var file_practice_practice_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
|
||||
var file_practice_practice_msg_proto_goTypes = []interface{}{
|
||||
(*PracticeInfoReq)(nil), // 0: PracticeInfoReq
|
||||
(*PracticeInfoResp)(nil), // 1: PracticeInfoResp
|
||||
@ -933,14 +984,15 @@ var file_practice_practice_msg_proto_goTypes = []interface{}{
|
||||
(*PracticeReceiveResp)(nil), // 13: PracticeReceiveResp
|
||||
(*PracticeEnrolledReq)(nil), // 14: PracticeEnrolledReq
|
||||
(*PracticeEnrolledResp)(nil), // 15: PracticeEnrolledResp
|
||||
(*DBPracticeRoom)(nil), // 16: DBPracticeRoom
|
||||
(*DBPracticePillar)(nil), // 17: DBPracticePillar
|
||||
(*PracticeJXItemPush)(nil), // 16: PracticeJXItemPush
|
||||
(*DBPracticeRoom)(nil), // 17: DBPracticeRoom
|
||||
(*DBPracticePillar)(nil), // 18: DBPracticePillar
|
||||
}
|
||||
var file_practice_practice_msg_proto_depIdxs = []int32{
|
||||
16, // 0: PracticeInfoResp.info:type_name -> DBPracticeRoom
|
||||
16, // 1: PracticeFriendRommResp.info:type_name -> DBPracticeRoom
|
||||
17, // 2: PracticePracticeResp.pillar:type_name -> DBPracticePillar
|
||||
17, // 3: PracticeLootResp.pillar:type_name -> DBPracticePillar
|
||||
17, // 0: PracticeInfoResp.info:type_name -> DBPracticeRoom
|
||||
17, // 1: PracticeFriendRommResp.info:type_name -> DBPracticeRoom
|
||||
18, // 2: PracticePracticeResp.pillar:type_name -> DBPracticePillar
|
||||
18, // 3: PracticeLootResp.pillar:type_name -> DBPracticePillar
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
@ -1147,6 +1199,18 @@ func file_practice_practice_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_practice_practice_msg_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*PracticeJXItemPush); 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{
|
||||
@ -1154,7 +1218,7 @@ func file_practice_practice_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_practice_practice_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 16,
|
||||
NumMessages: 17,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -31,6 +31,7 @@ import (
|
||||
"go_dreamfactory/modules/notify"
|
||||
"go_dreamfactory/modules/pagoda"
|
||||
"go_dreamfactory/modules/pay"
|
||||
"go_dreamfactory/modules/practice"
|
||||
"go_dreamfactory/modules/privilege"
|
||||
"go_dreamfactory/modules/pvp"
|
||||
"go_dreamfactory/modules/reddot"
|
||||
@ -116,6 +117,7 @@ func main() {
|
||||
pvp.NewModule(),
|
||||
dispatch.NewModule(),
|
||||
atlas.NewModule(),
|
||||
practice.NewModule(),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user