上传战报数据独享
This commit is contained in:
parent
c77443c862
commit
b838460200
@ -133,8 +133,6 @@ type (
|
||||
|
||||
//战斗系统
|
||||
IBattle interface {
|
||||
///查询战斗记录接口
|
||||
QueryBattleRecord(oid string) (code pb.ErrorCode, record *pb.DBBattleRecord)
|
||||
///创建pve战斗
|
||||
CreatePveBattle(session IUserSession, req *pb.BattlePVEReq) (code pb.ErrorCode, record *pb.DBBattleRecord)
|
||||
///创建pvb战斗
|
||||
|
@ -1,30 +0,0 @@
|
||||
package battle
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) ResultCheck(session comm.IUserSession, req *pb.BattleResultReq) (code pb.ErrorCode) {
|
||||
if req.Id == "" {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
///获取本服聊天消息记录
|
||||
func (this *apiComp) Result(session comm.IUserSession, req *pb.BattleResultReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var ()
|
||||
if code = this.ResultCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
this.module.modelBattle.Change(req.Id, map[string]interface{}{
|
||||
"state": pb.BBattleState_end,
|
||||
"result": pb.DBBattleComp_red,
|
||||
})
|
||||
session.SendMsg(string(this.module.GetType()), "result", &pb.BattleResultResp{Id: req.Id, Issucc: true})
|
||||
return
|
||||
}
|
@ -91,10 +91,9 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, btype pb.Battl
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := this.Add(record.Id, record); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
|
||||
// if err := this.Add(record.Id, record); err != nil {
|
||||
// this.module.Errorln(err)
|
||||
// return
|
||||
// }
|
||||
return
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.Moonfantasy
|
||||
func (this *apiComp) Receive(session comm.IUserSession, req *pb.MoonfantasyReceiveReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
boss *cfg.GameDreamlandBoosData
|
||||
record *pb.DBBattleRecord
|
||||
award []*cfg.Gameatn = make([]*cfg.Gameatn, 0)
|
||||
err error
|
||||
)
|
||||
@ -32,19 +31,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.MoonfantasyRecei
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
if code, record = this.module.battle.QueryBattleRecord(req.Bid); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
|
||||
if record.State != pb.BBattleState_end {
|
||||
code = pb.ErrorCode_MoonfantasyBattleNoEnd
|
||||
return
|
||||
}
|
||||
|
||||
if record.Result != pb.DBBattleComp_red {
|
||||
code = pb.ErrorCode_MoonfantasyBattleNoWin
|
||||
return
|
||||
}
|
||||
this.module.configure.GetDropReward(boss.Prize, award)
|
||||
this.module.DispenseRes(session, award, true)
|
||||
session.SendMsg(string(this.module.GetType()), "receive", &pb.MoonfantasyReceiveResp{Issucc: true})
|
||||
|
@ -188,118 +188,6 @@ func (x *BattleInfo) GetBuleflist() []*DBBattleFormt {
|
||||
return nil
|
||||
}
|
||||
|
||||
//战斗结果请求
|
||||
type BattleResultReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //战斗id
|
||||
Iswin bool `protobuf:"varint,2,opt,name=iswin,proto3" json:"iswin"` //是否胜利
|
||||
}
|
||||
|
||||
func (x *BattleResultReq) Reset() {
|
||||
*x = BattleResultReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_battle_battle_msg_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *BattleResultReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BattleResultReq) ProtoMessage() {}
|
||||
|
||||
func (x *BattleResultReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_battle_battle_msg_proto_msgTypes[2]
|
||||
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 BattleResultReq.ProtoReflect.Descriptor instead.
|
||||
func (*BattleResultReq) Descriptor() ([]byte, []int) {
|
||||
return file_battle_battle_msg_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *BattleResultReq) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *BattleResultReq) GetIswin() bool {
|
||||
if x != nil {
|
||||
return x.Iswin
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
//战斗结果请求
|
||||
type BattleResultResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //战斗id
|
||||
Issucc bool `protobuf:"varint,2,opt,name=issucc,proto3" json:"issucc"` //是否生效
|
||||
}
|
||||
|
||||
func (x *BattleResultResp) Reset() {
|
||||
*x = BattleResultResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_battle_battle_msg_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *BattleResultResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*BattleResultResp) ProtoMessage() {}
|
||||
|
||||
func (x *BattleResultResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_battle_battle_msg_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 BattleResultResp.ProtoReflect.Descriptor instead.
|
||||
func (*BattleResultResp) Descriptor() ([]byte, []int) {
|
||||
return file_battle_battle_msg_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *BattleResultResp) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *BattleResultResp) GetIssucc() bool {
|
||||
if x != nil {
|
||||
return x.Issucc
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_battle_battle_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_battle_battle_msg_proto_rawDesc = []byte{
|
||||
@ -329,15 +217,8 @@ var file_battle_battle_msg_proto_rawDesc = []byte{
|
||||
0x09, 0x52, 0x0a, 0x62, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x49, 0x64, 0x12, 0x2c, 0x0a,
|
||||
0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0e, 0x2e, 0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74,
|
||||
0x52, 0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x0f, 0x42,
|
||||
0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x69, 0x73, 0x77, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69,
|
||||
0x73, 0x77, 0x69, 0x6e, 0x22, 0x3a, 0x0a, 0x10, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65,
|
||||
0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75,
|
||||
0x63, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63,
|
||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x52, 0x09, 0x62, 0x75, 0x6c, 0x65, 0x66, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -352,22 +233,20 @@ func file_battle_battle_msg_proto_rawDescGZIP() []byte {
|
||||
return file_battle_battle_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_battle_battle_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_battle_battle_msg_proto_goTypes = []interface{}{
|
||||
(*BattlePVEReq)(nil), // 0: BattlePVEReq
|
||||
(*BattleInfo)(nil), // 1: BattleInfo
|
||||
(*BattleResultReq)(nil), // 2: BattleResultReq
|
||||
(*BattleResultResp)(nil), // 3: BattleResultResp
|
||||
(PlayType)(0), // 4: PlayType
|
||||
(BattleType)(0), // 5: BattleType
|
||||
(*DBBattleFormt)(nil), // 6: DBBattleFormt
|
||||
(PlayType)(0), // 2: PlayType
|
||||
(BattleType)(0), // 3: BattleType
|
||||
(*DBBattleFormt)(nil), // 4: DBBattleFormt
|
||||
}
|
||||
var file_battle_battle_msg_proto_depIdxs = []int32{
|
||||
4, // 0: BattlePVEReq.ptype:type_name -> PlayType
|
||||
5, // 1: BattleInfo.btype:type_name -> BattleType
|
||||
4, // 2: BattleInfo.ptype:type_name -> PlayType
|
||||
6, // 3: BattleInfo.redflist:type_name -> DBBattleFormt
|
||||
6, // 4: BattleInfo.buleflist:type_name -> DBBattleFormt
|
||||
2, // 0: BattlePVEReq.ptype:type_name -> PlayType
|
||||
3, // 1: BattleInfo.btype:type_name -> BattleType
|
||||
2, // 2: BattleInfo.ptype:type_name -> PlayType
|
||||
4, // 3: BattleInfo.redflist:type_name -> DBBattleFormt
|
||||
4, // 4: BattleInfo.buleflist:type_name -> DBBattleFormt
|
||||
5, // [5:5] is the sub-list for method output_type
|
||||
5, // [5:5] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
@ -406,30 +285,6 @@ func file_battle_battle_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_battle_battle_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BattleResultReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_battle_battle_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*BattleResultResp); 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{
|
||||
@ -437,7 +292,7 @@ func file_battle_battle_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_battle_battle_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -394,6 +394,7 @@ type MoonfantasyReceiveReq struct {
|
||||
|
||||
Bid string `protobuf:"bytes,2,opt,name=bid,proto3" json:"bid"` //战斗id 后续需要这个id来领取奖励
|
||||
Monster string `protobuf:"bytes,3,opt,name=monster,proto3" json:"monster"` //怪物id
|
||||
Iswin bool `protobuf:"varint,4,opt,name=iswin,proto3" json:"iswin"` //是否胜利
|
||||
}
|
||||
|
||||
func (x *MoonfantasyReceiveReq) Reset() {
|
||||
@ -442,6 +443,13 @@ func (x *MoonfantasyReceiveReq) GetMonster() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *MoonfantasyReceiveReq) GetIswin() bool {
|
||||
if x != nil {
|
||||
return x.Iswin
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
///领取战斗奖励
|
||||
type MoonfantasyReceiveResp struct {
|
||||
state protoimpl.MessageState
|
||||
@ -530,15 +538,17 @@ var file_moonfantasy_moonfantasy_msg_proto_rawDesc = []byte{
|
||||
0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d,
|
||||
0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x43, 0x0a, 0x15, 0x4d, 0x6f, 0x6f, 0x6e, 0x66,
|
||||
0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x59, 0x0a, 0x15, 0x4d, 0x6f, 0x6f, 0x6e, 0x66,
|
||||
0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x62, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x62,
|
||||
0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x22, 0x30, 0x0a, 0x16,
|
||||
0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x6f, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x69, 0x73, 0x77, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x77,
|
||||
0x69, 0x6e, 0x22, 0x30, 0x0a, 0x16, 0x4d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73,
|
||||
0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73,
|
||||
0x73, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user