上传月之秘境触发接口
This commit is contained in:
parent
ee081b1e99
commit
7cca06d548
@ -221,6 +221,7 @@ const ( //Rpc
|
|||||||
Rpc_ModuleChatPushChat core.Rpc_Key = "Rpc_ModuleChatPushChat" //推送聊天消息
|
Rpc_ModuleChatPushChat core.Rpc_Key = "Rpc_ModuleChatPushChat" //推送聊天消息
|
||||||
//Moonfantasy 月之秘境
|
//Moonfantasy 月之秘境
|
||||||
Rpc_ModuleMoonfantasyTrigger core.Rpc_Key = "Rpc_ModuleMoonfantasyTrigger" //月之秘境触发消息
|
Rpc_ModuleMoonfantasyTrigger core.Rpc_Key = "Rpc_ModuleMoonfantasyTrigger" //月之秘境触发消息
|
||||||
|
Rpc_ModuleMoonfantasyTriggerMF core.Rpc_Key = "Rpc_ModuleMoonfantasyTriggerMF" //月之秘境触发消息
|
||||||
//rtask 上传随机任务代码
|
//rtask 上传随机任务代码
|
||||||
Rpc_ModuleRtaskSendTask core.Rpc_Key = "Rpc_ModuleRtaskSendTask" //随机任务触发
|
Rpc_ModuleRtaskSendTask core.Rpc_Key = "Rpc_ModuleRtaskSendTask" //随机任务触发
|
||||||
// friend
|
// friend
|
||||||
|
@ -234,6 +234,8 @@ type (
|
|||||||
IMoonFantasy interface {
|
IMoonFantasy interface {
|
||||||
//触发月之秘境
|
//触发月之秘境
|
||||||
Trigger(session IUserSession, source *pb.BattleReport)
|
Trigger(session IUserSession, source *pb.BattleReport)
|
||||||
|
//GM触发月之秘境
|
||||||
|
TriggerMF(session IUserSession, Boosid string) (err error)
|
||||||
}
|
}
|
||||||
IViking interface {
|
IViking interface {
|
||||||
CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) // 查询玩家最佳通关记录
|
CheckUserBaseVikingInfo(uid string) (data []*pb.DBVikingRank) // 查询玩家最佳通关记录
|
||||||
|
@ -138,6 +138,59 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//触发月之秘境
|
||||||
|
func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string) (err error) {
|
||||||
|
var (
|
||||||
|
user *pb.DBUser
|
||||||
|
umfantasy *pb.DBUserMFantasy
|
||||||
|
globalconf *cfg.GameGlobalData
|
||||||
|
boss *cfg.GameDreamlandBoosData
|
||||||
|
mdata *pb.DBMoonFantasy
|
||||||
|
chat *pb.DBChat
|
||||||
|
)
|
||||||
|
globalconf = this.module.configure.GetGlobalConf()
|
||||||
|
|
||||||
|
if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.module.modelUserMF.recoverTicket(session, umfantasy)
|
||||||
|
if umfantasy.TriggerNum >= globalconf.DreamlandTriggernum {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if boss, err = this.module.configure.GetMonsterById(boosid); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user == nil {
|
||||||
|
this.module.Errorf("no found uer:%d", session.GetUserId())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if mdata, err = this.module.modelDream.addDreamData(&pb.UserInfo{Uid: user.Uid, Name: user.Name, Avatar: user.Avatar, Lv: user.Lv}, boss); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// umfantasy.Mfantasys = append(umfantasy.Mfantasys, mdata.Id)
|
||||||
|
umfantasy.TriggerNum++
|
||||||
|
umfantasy.LastTrigger = configure.Now().Unix()
|
||||||
|
this.module.modelUserMF.updateUserInfo(umfantasy)
|
||||||
|
chat = &pb.DBChat{
|
||||||
|
Ctype: pb.ChatType_Moonfantasy,
|
||||||
|
Suid: session.GetUserId(),
|
||||||
|
Avatar: user.Avatar,
|
||||||
|
Uname: user.Name,
|
||||||
|
Slv: user.Lv,
|
||||||
|
Ctime: configure.Now().Unix(),
|
||||||
|
Stag: session.GetServiecTag(),
|
||||||
|
Content: mdata.Monster,
|
||||||
|
AppendStr: mdata.Id,
|
||||||
|
}
|
||||||
|
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
|
||||||
|
session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster})
|
||||||
|
this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
///查询好友数据
|
///查询好友数据
|
||||||
func (this *modelDreamComp) noticeuserfriend(session comm.IUserSession, mid string, chat *pb.DBChat) (code pb.ErrorCode) {
|
func (this *modelDreamComp) noticeuserfriend(session comm.IUserSession, mid string, chat *pb.DBChat) (code pb.ErrorCode) {
|
||||||
var (
|
var (
|
||||||
|
@ -65,6 +65,7 @@ func (this *Moonfantasy) Start() (err error) {
|
|||||||
}
|
}
|
||||||
this.battle = module.(comm.IBattle)
|
this.battle = module.(comm.IBattle)
|
||||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTrigger), this.Rpc_ModuleMoonfantasyTrigger)
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTrigger), this.Rpc_ModuleMoonfantasyTrigger)
|
||||||
|
this.service.RegisterFunctionName(string(comm.Rpc_ModuleMoonfantasyTriggerMF), this.Rpc_ModuleMoonfantasyTriggerMF)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,3 +120,38 @@ func (this *Moonfantasy) Rpc_ModuleMoonfantasyTrigger(ctx context.Context, args
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//触发月之秘境
|
||||||
|
func (this *Moonfantasy) Rpc_ModuleMoonfantasyTriggerMF(ctx context.Context, args *pb.RPCTargetMFReq, reply *pb.EmptyResp) (err error) {
|
||||||
|
var (
|
||||||
|
session comm.IUserSession
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
if session, ok = this.GetUserSession(args.Uid); !ok {
|
||||||
|
err = fmt.Errorf("no found user%s", args.Uid)
|
||||||
|
this.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = this.modelDream.triggerbyid(session, args.Boosid); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//触发月之秘境
|
||||||
|
func (this *Moonfantasy) TriggerMF(session comm.IUserSession, Boosid string) (err error) {
|
||||||
|
if this.IsCross() {
|
||||||
|
err = this.modelDream.triggerbyid(session, Boosid)
|
||||||
|
} else {
|
||||||
|
if _, err = this.service.AcrossClusterRpcGo(context.Background(),
|
||||||
|
this.GetCrossTag(),
|
||||||
|
comm.Service_Worker,
|
||||||
|
string(comm.Rpc_ModuleMoonfantasyTriggerMF),
|
||||||
|
pb.RPCTargetMFReq{Uid: session.GetUserId(), Boosid: Boosid},
|
||||||
|
nil,
|
||||||
|
); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -292,6 +292,62 @@ func (x *DBUserMFantasy) GetLastrtickettime() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//RPC 触发请求
|
||||||
|
type RPCTargetMFReq struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id
|
||||||
|
Boosid string `protobuf:"bytes,2,opt,name=boosid,proto3" json:"boosid"` //怪物id
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RPCTargetMFReq) Reset() {
|
||||||
|
*x = RPCTargetMFReq{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_moonfantasy_moonfantasy_db_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RPCTargetMFReq) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RPCTargetMFReq) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RPCTargetMFReq) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_moonfantasy_moonfantasy_db_proto_msgTypes[3]
|
||||||
|
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 RPCTargetMFReq.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RPCTargetMFReq) Descriptor() ([]byte, []int) {
|
||||||
|
return file_moonfantasy_moonfantasy_db_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RPCTargetMFReq) GetUid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Uid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RPCTargetMFReq) GetBoosid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Boosid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_moonfantasy_moonfantasy_db_proto protoreflect.FileDescriptor
|
var File_moonfantasy_moonfantasy_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_moonfantasy_moonfantasy_db_proto_rawDesc = []byte{
|
var file_moonfantasy_moonfantasy_db_proto_rawDesc = []byte{
|
||||||
@ -333,8 +389,12 @@ var file_moonfantasy_moonfantasy_db_proto_rawDesc = []byte{
|
|||||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x72, 0x69, 0x67,
|
0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x72, 0x69, 0x67,
|
||||||
0x67, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b,
|
0x67, 0x65, 0x72, 0x12, 0x28, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b,
|
||||||
0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61,
|
0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61,
|
||||||
0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a,
|
0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x3a, 0x0a,
|
||||||
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x0e, 0x52, 0x50, 0x43, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4d, 0x46, 0x52, 0x65, 0x71, 0x12,
|
||||||
|
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
|
||||||
|
0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x06, 0x62, 0x6f, 0x6f, 0x73, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||||
|
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -349,16 +409,17 @@ func file_moonfantasy_moonfantasy_db_proto_rawDescGZIP() []byte {
|
|||||||
return file_moonfantasy_moonfantasy_db_proto_rawDescData
|
return file_moonfantasy_moonfantasy_db_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_moonfantasy_moonfantasy_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
var file_moonfantasy_moonfantasy_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||||
var file_moonfantasy_moonfantasy_db_proto_goTypes = []interface{}{
|
var file_moonfantasy_moonfantasy_db_proto_goTypes = []interface{}{
|
||||||
(*UserInfo)(nil), // 0: UserInfo
|
(*UserInfo)(nil), // 0: UserInfo
|
||||||
(*DBMoonFantasy)(nil), // 1: DBMoonFantasy
|
(*DBMoonFantasy)(nil), // 1: DBMoonFantasy
|
||||||
(*DBUserMFantasy)(nil), // 2: DBUserMFantasy
|
(*DBUserMFantasy)(nil), // 2: DBUserMFantasy
|
||||||
nil, // 3: DBMoonFantasy.RecordEntry
|
(*RPCTargetMFReq)(nil), // 3: RPCTargetMFReq
|
||||||
|
nil, // 4: DBMoonFantasy.RecordEntry
|
||||||
}
|
}
|
||||||
var file_moonfantasy_moonfantasy_db_proto_depIdxs = []int32{
|
var file_moonfantasy_moonfantasy_db_proto_depIdxs = []int32{
|
||||||
0, // 0: DBMoonFantasy.join:type_name -> UserInfo
|
0, // 0: DBMoonFantasy.join:type_name -> UserInfo
|
||||||
3, // 1: DBMoonFantasy.record:type_name -> DBMoonFantasy.RecordEntry
|
4, // 1: DBMoonFantasy.record:type_name -> DBMoonFantasy.RecordEntry
|
||||||
2, // [2:2] is the sub-list for method output_type
|
2, // [2:2] is the sub-list for method output_type
|
||||||
2, // [2:2] is the sub-list for method input_type
|
2, // [2:2] is the sub-list for method input_type
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
@ -408,6 +469,18 @@ func file_moonfantasy_moonfantasy_db_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_moonfantasy_moonfantasy_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*RPCTargetMFReq); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -415,7 +488,7 @@ func file_moonfantasy_moonfantasy_db_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_moonfantasy_moonfantasy_db_proto_rawDesc,
|
RawDescriptor: file_moonfantasy_moonfantasy_db_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 4,
|
NumMessages: 5,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user