From afcb8b7d3550c078cd0fc322a847587734c99c8a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 28 Nov 2022 18:11:06 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pb/arena_db.pb.go | 137 +++++++++++++++++++--------------------- pb/moonfantasy_db.pb.go | 41 +++++------- 2 files changed, 80 insertions(+), 98 deletions(-) diff --git a/pb/arena_db.pb.go b/pb/arena_db.pb.go index e1b6b5ecc..31a8e17ab 100644 --- a/pb/arena_db.pb.go +++ b/pb/arena_db.pb.go @@ -465,12 +465,12 @@ type DBArenaUser struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` //玩家名称 - Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar" bson:"avatar"` //头像 - Lv int32 `protobuf:"varint,4,opt,name=lv,proto3" json:"lv" bson:"lv"` //等级 - Integral int32 `protobuf:"varint,5,opt,name=integral,proto3" json:"integral"` //积分 - Ticket int32 `protobuf:"varint,6,opt,name=ticket,proto3" json:"ticket"` //挑战券 + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //用户id + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` //玩家名称 + Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar" bson:"avatar"` //头像 + Lv int32 `protobuf:"varint,4,opt,name=lv,proto3" json:"lv" bson:"lv"` //等级 + Integral int32 `protobuf:"varint,5,opt,name=integral,proto3" json:"integral"` //积分 + // int32 ticket = 6; //挑战券 Dan int32 `protobuf:"varint,7,opt,name=dan,proto3" json:"dan"` //段位 Attack *DBPlayerBattleFormt `protobuf:"bytes,8,opt,name=attack,proto3" json:"attack"` //进攻阵型 Defend *DBPlayerBattleFormt `protobuf:"bytes,9,opt,name=defend,proto3" json:"defend"` //防守阵型 @@ -558,13 +558,6 @@ func (x *DBArenaUser) GetIntegral() int32 { return 0 } -func (x *DBArenaUser) GetTicket() int32 { - if x != nil { - return x.Ticket - } - return 0 -} - func (x *DBArenaUser) GetDan() int32 { if x != nil { return x.Dan @@ -808,7 +801,7 @@ var file_arena_arena_db_proto_rawDesc = []byte{ 0x28, 0x05, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0xa6, 0x06, 0x0a, 0x0b, 0x44, 0x42, + 0x74, 0x65, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x8e, 0x06, 0x0a, 0x0b, 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, @@ -816,65 +809,63 @@ var file_arena_arena_db_proto_rawDesc = []byte{ 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, - 0x72, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x64, - 0x61, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x2c, 0x0a, - 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x44, 0x42, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, - 0x72, 0x6d, 0x74, 0x52, 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x06, 0x64, - 0x65, 0x66, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, - 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, - 0x74, 0x52, 0x06, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6b, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x18, - 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, - 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x18, - 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x12, 0x2c, 0x0a, - 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x6c, - 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x10, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, - 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x77, - 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x18, 0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x74, 0x74, - 0x61, 0x63, 0x6b, 0x77, 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x74, 0x74, - 0x61, 0x63, 0x6b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, - 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x77, 0x69, 0x6e, 0x75, 0x75, - 0x6d, 0x18, 0x13, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x77, - 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x64, - 0x65, 0x66, 0x65, 0x6e, 0x64, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x12, 0x10, 0x0a, - 0x03, 0x6c, 0x6f, 0x63, 0x18, 0x15, 0x20, 0x03, 0x28, 0x01, 0x52, 0x03, 0x6c, 0x6f, 0x63, 0x12, - 0x14, 0x0a, 0x05, 0x69, 0x73, 0x64, 0x65, 0x66, 0x18, 0x16, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, - 0x69, 0x73, 0x64, 0x65, 0x66, 0x12, 0x27, 0x0a, 0x03, 0x6e, 0x70, 0x63, 0x18, 0x17, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, - 0x2e, 0x4e, 0x70, 0x63, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x6e, 0x70, 0x63, 0x12, 0x22, - 0x0a, 0x0c, 0x70, 0x72, 0x65, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x18, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x70, 0x72, 0x65, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x1a, 0x3e, 0x0a, 0x08, 0x4e, 0x70, 0x63, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x06, 0x2e, 0x44, 0x42, 0x4e, 0x70, 0x63, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x22, 0x3d, 0x0a, 0x05, 0x44, 0x42, 0x4e, 0x70, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x63, - 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x63, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, - 0x78, 0x2a, 0x9f, 0x01, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x61, 0x63, - 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, - 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, - 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, - 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, - 0x76, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x05, 0x12, 0x14, 0x0a, - 0x10, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, - 0x64, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x6e, - 0x64, 0x10, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x72, 0x61, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x03, 0x64, 0x61, 0x6e, 0x12, 0x2c, 0x0a, 0x06, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, 0x52, 0x06, 0x61, 0x74, 0x74, + 0x61, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x06, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x42, 0x61, + 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x74, 0x52, 0x06, 0x64, 0x65, 0x66, 0x65, 0x6e, + 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6b, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x74, 0x74, + 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x61, + 0x74, 0x74, 0x61, 0x63, 0x6b, 0x72, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x66, + 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x64, + 0x65, 0x66, 0x65, 0x6e, 0x64, 0x72, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, + 0x6b, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x12, 0x16, 0x0a, + 0x06, 0x62, 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, + 0x75, 0x79, 0x6e, 0x75, 0x6d, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, + 0x0f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x42, + 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, + 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0f, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, + 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6c, 0x61, + 0x73, 0x74, 0x72, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x22, 0x0a, + 0x0c, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x77, 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x18, 0x11, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0c, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x77, 0x69, 0x6e, 0x75, 0x75, + 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x75, 0x75, 0x6d, 0x18, 0x12, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x61, 0x74, 0x74, 0x61, 0x63, + 0x6b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x66, + 0x65, 0x6e, 0x64, 0x77, 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x18, 0x13, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0c, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x77, 0x69, 0x6e, 0x75, 0x75, 0x6d, 0x12, 0x26, 0x0a, + 0x0e, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x64, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x75, 0x75, 0x6d, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, 0x63, 0x18, 0x15, 0x20, 0x03, + 0x28, 0x01, 0x52, 0x03, 0x6c, 0x6f, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x73, 0x64, 0x65, 0x66, + 0x18, 0x16, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, 0x64, 0x65, 0x66, 0x12, 0x27, 0x0a, + 0x03, 0x6e, 0x70, 0x63, 0x18, 0x17, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x41, + 0x72, 0x65, 0x6e, 0x61, 0x55, 0x73, 0x65, 0x72, 0x2e, 0x4e, 0x70, 0x63, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x03, 0x6e, 0x70, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x65, 0x64, 0x65, 0x64, + 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x18, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x70, 0x72, + 0x65, 0x64, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x3e, 0x0a, 0x08, 0x4e, 0x70, + 0x63, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x44, 0x42, 0x4e, 0x70, 0x63, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3d, 0x0a, 0x05, 0x44, 0x42, + 0x4e, 0x70, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x63, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x02, 0x63, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2a, 0x9f, 0x01, 0x0a, 0x11, 0x42, 0x61, + 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x0d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x0e, + 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x01, 0x12, 0x0e, + 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0e, + 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x03, 0x12, 0x12, + 0x0a, 0x0e, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, + 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x61, 0x69, + 0x6c, 0x65, 0x64, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, + 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x52, + 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/moonfantasy_db.pb.go b/pb/moonfantasy_db.pb.go index 10e732ac5..a48ede6cf 100644 --- a/pb/moonfantasy_db.pb.go +++ b/pb/moonfantasy_db.pb.go @@ -209,13 +209,13 @@ type DBUserMFantasy struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id - TriggerNum int32 `protobuf:"varint,3,opt,name=triggerNum,proto3" json:"triggerNum" bson:"triggerNum"` // 月之秘境触发次数 - Ticket int32 `protobuf:"varint,4,opt,name=ticket,proto3" json:"ticket"` //@go_tags(`bson:"ticket"`)挑战券 - BuyNum int32 `protobuf:"varint,5,opt,name=buyNum,proto3" json:"buyNum" bson:"buyNum"` // 月之秘境挑战次数 - LastTrigger int64 `protobuf:"varint,6,opt,name=lastTrigger,proto3" json:"lastTrigger" bson:"lastTrigger"` // 月之秘境最后触发时间 - Lastrtickettime int64 `protobuf:"varint,7,opt,name=lastrtickettime,proto3" json:"lastrtickettime" bson:"lastrtickettime"` // 最后回复劵时间 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id + TriggerNum int32 `protobuf:"varint,3,opt,name=triggerNum,proto3" json:"triggerNum" bson:"triggerNum"` // 月之秘境触发次数 + // int32 ticket = 4; //@go_tags(`bson:"ticket"`)挑战券 + BuyNum int32 `protobuf:"varint,5,opt,name=buyNum,proto3" json:"buyNum" bson:"buyNum"` // 月之秘境挑战次数 + LastTrigger int64 `protobuf:"varint,6,opt,name=lastTrigger,proto3" json:"lastTrigger" bson:"lastTrigger"` // 月之秘境最后触发时间 + Lastrtickettime int64 `protobuf:"varint,7,opt,name=lastrtickettime,proto3" json:"lastrtickettime" bson:"lastrtickettime"` // 最后回复劵时间 } func (x *DBUserMFantasy) Reset() { @@ -271,13 +271,6 @@ func (x *DBUserMFantasy) GetTriggerNum() int32 { return 0 } -func (x *DBUserMFantasy) GetTicket() int32 { - if x != nil { - return x.Ticket - } - return 0 -} - func (x *DBUserMFantasy) GetBuyNum() int32 { if x != nil { return x.BuyNum @@ -329,21 +322,19 @@ var file_moonfantasy_moonfantasy_db_proto_rawDesc = []byte{ 0x6f, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xce, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x4d, + 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb6, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x4d, 0x46, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, - 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x63, - 0x6b, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, - 0x74, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x6c, 0x61, 0x73, - 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 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, 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, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, + 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, + 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, + 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, + 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, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From ff5e45cea83c8de286b843f93b1b67039887ca0e Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 28 Nov 2022 18:25:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=A8=E7=A5=A8?= =?UTF-8?q?=E9=81=93=E5=85=B7=E4=B8=8B=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/api_buy.go | 21 ++++++++------- modules/arena/api_challenge.go | 14 ++++++---- modules/arena/api_info.go | 10 ++++---- modules/arena/api_plot.go | 13 ++++++---- modules/arena/modelarena.go | 29 +++++++++++++-------- modules/moonfantasy/api_battle.go | 41 ++++++++++++++++-------------- modules/moonfantasy/api_buy.go | 11 +++++--- modules/moonfantasy/api_getlist.go | 4 +-- modules/moonfantasy/modelDream.go | 2 +- modules/moonfantasy/modelUserMF.go | 29 +++++++++++---------- 10 files changed, 100 insertions(+), 74 deletions(-) diff --git a/modules/arena/api_buy.go b/modules/arena/api_buy.go index 319a666ed..7f17712a9 100644 --- a/modules/arena/api_buy.go +++ b/modules/arena/api_buy.go @@ -20,7 +20,7 @@ func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ArenaBuyReq) (c ///获取自己的排行榜信息 func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code pb.ErrorCode, data proto.Message) { var ( - global *cfg.GameGlobalData + // global *cfg.GameGlobalData info *pb.DBArenaUser challenge *cfg.GameArenaBuyChallengeData need []*cfg.Gameatn @@ -33,12 +33,12 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code p code = pb.ErrorCode_CacheReadError return } - this.module.modelArena.recoverTicket(info) - global = this.module.configure.GetGlobalConf() - if info.Ticket+req.BuyNum > global.ArenaTicketMax { - code = pb.ErrorCode_ArenaTicketBuyUp - return - } + this.module.modelArena.recoverTicket(session, info) + // global = this.module.configure.GetGlobalConf() + // if info.Ticket+req.BuyNum > global.ArenaTicketMax { + // code = pb.ErrorCode_ArenaTicketBuyUp + // return + // } need = make([]*cfg.Gameatn, 0) for i := int32(0); i < req.BuyNum; i++ { if challenge, err = this.module.configure.GetchallengeData(info.Buynum + i + 1); err != nil { @@ -56,11 +56,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ArenaBuyReq) (code p return } info.Buynum += req.BuyNum - info.Ticket += req.BuyNum + if code = this.module.DispenseRes(session, []*cfg.Gameatn{{A: comm.ItemType, T: comm.ArenaTicket, N: req.BuyNum}}, true); code != pb.ErrorCode_Success { + return + } + // info.Ticket += req.BuyNum if err = this.module.modelArena.updateArenaUserInfo(info); err != nil { code = pb.ErrorCode_DBError return } - session.SendMsg(string(this.module.GetType()), "buy", &pb.MoonfantasyBuyResp{Issucc: true, BattleNum: info.Ticket}) + session.SendMsg(string(this.module.GetType()), "buy", &pb.MoonfantasyBuyResp{Issucc: true, BattleNum: info.Buynum}) return } diff --git a/modules/arena/api_challenge.go b/modules/arena/api_challenge.go index 2e779d84b..fa1654037 100644 --- a/modules/arena/api_challenge.go +++ b/modules/arena/api_challenge.go @@ -3,6 +3,7 @@ package arena import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" "google.golang.org/protobuf/proto" ) @@ -50,13 +51,16 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge cd = pb.ErrorCode_DBError return } - this.module.modelArena.recoverTicket(red) - if red.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos { - red.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos - } else { - code = pb.ErrorCode_ArenaTicketNotEnough + this.module.modelArena.recoverTicket(session, red) + if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.configure.GetGlobalConf().ArenaTicketCos}, true); cd != pb.ErrorCode_Success { return } + // if red.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos { + // red.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos + // } else { + // code = pb.ErrorCode_ArenaTicketNotEnough + // return + // } if red.Attack != nil { for i, v := range req.Battle.Format { diff --git a/modules/arena/api_info.go b/modules/arena/api_info.go index 954457ece..532952b1f 100644 --- a/modules/arena/api_info.go +++ b/modules/arena/api_info.go @@ -47,10 +47,10 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (code return } info = &pb.DBArenaUser{ - Uid: session.GetUserId(), - Name: user.Name, - Integral: global.ArenaInitiaIntegral, - Ticket: global.ArenaTicketMax, + Uid: session.GetUserId(), + Name: user.Name, + Integral: global.ArenaInitiaIntegral, + // Ticket: global.ArenaTicketMax, Streak: 0, Record: make([]*pb.DBArenaBattleRecord, 0), Lastrtickettime: 0, @@ -65,7 +65,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (code this.module.Errorln(err) } } else { - this.module.modelArena.recoverTicket(info) + this.module.modelArena.recoverTicket(session, info) if err = this.module.modelArena.updateArenaUserInfo(info); err != nil { code = pb.ErrorCode_DBError return diff --git a/modules/arena/api_plot.go b/modules/arena/api_plot.go index f67d64148..e76aa5d4f 100644 --- a/modules/arena/api_plot.go +++ b/modules/arena/api_plot.go @@ -57,13 +57,16 @@ func (this *apiComp) Plot(session comm.IUserSession, req *pb.ArenaPlotReq) (code cd = pb.ErrorCode_DBError return } - this.module.modelArena.recoverTicket(info) - if info.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos { - info.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos - } else { - code = pb.ErrorCode_ArenaTicketNotEnough + this.module.modelArena.recoverTicket(session, info) + if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.configure.GetGlobalConf().ArenaTicketCos}, true); cd != pb.ErrorCode_Success { return } + // if info.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos { + // info.Ticket -= this.module.configure.GetGlobalConf().ArenaTicketCos + // } else { + // code = pb.ErrorCode_ArenaTicketNotEnough + // return + // } if info.Npc[req.Pid] != nil { ndata := info.Npc[req.Pid] if !configure.Now().After(time.Unix(ndata.Cd, 0)) { //已经过了cd时间 diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index e48f2f957..15e009666 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -111,10 +111,10 @@ func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) { return } this.Change(info.Uid, map[string]interface{}{ - "integral": info.Integral, - "dan": dan, - "rank": info.Rank, - "ticket": info.Ticket, + "integral": info.Integral, + "dan": dan, + "rank": info.Rank, + // "ticket": info.Ticket, "buynum": info.Buynum, "lastrtickettime": info.Lastrtickettime, "attack": info.Attack, @@ -365,20 +365,26 @@ func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) { } } -func (this *modelArena) recoverTicket(info *pb.DBArenaUser) { +func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBArenaUser) { var ( duration time.Duration + ticket int32 ticketNum int32 ) global := this.module.configure.GetGlobalConf() - if info.Ticket < global.ArenaTicketMax && info.Lastrtickettime > 0 { + ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.ArenaTicket)) + if ticket < global.ArenaTicketMax && info.Lastrtickettime > 0 { duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0)) ticketNum = int32(math.Floor(duration.Minutes() / float64(global.ArenaTicketRecoveryTime))) if ticketNum > 0 { - info.Ticket += ticketNum - if info.Ticket > global.ArenaTicketMax { - info.Ticket = global.ArenaTicketMax + if ticketNum+ticket > global.ArenaTicketMax { + ticketNum = global.ArenaTicketMax - ticket } + this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{A: comm.ItemType, T: comm.ArenaTicket, N: ticketNum}}, true) + // info.Ticket += ticketNum + // if info.Ticket > global.ArenaTicketMax { + // info.Ticket = global.ArenaTicketMax + // } info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix() } } @@ -394,12 +400,13 @@ func (this *modelArena) reddot(session comm.IUserSession) bool { } if err == mgo.MongodbNil { global := this.module.configure.GetGlobalConf() - if global.ArenaTicketMax >= global.ArenaTicketCos { + if global.ArenaTicketMax >= global.ArenaTicketCos.N { return true } return false } - if info.Ticket > this.module.configure.GetGlobalConf().ArenaTicketCos { + ticket := int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.ArenaTicket)) + if ticket > this.module.configure.GetGlobalConf().ArenaTicketCos.N { return true } return false diff --git a/modules/moonfantasy/api_battle.go b/modules/moonfantasy/api_battle.go index aa05b8eac..730d8e3ad 100644 --- a/modules/moonfantasy/api_battle.go +++ b/modules/moonfantasy/api_battle.go @@ -16,20 +16,20 @@ func (this *apiComp) BattleCheck(session comm.IUserSession, req *pb.MoonfantasyB ///挑战怪物请求 func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattleReq) (code pb.ErrorCode, data proto.Message) { var ( - boss *cfg.GameDreamlandBoosData - umfantasy *pb.DBUserMFantasy - mdata *pb.DBMoonFantasy - record *pb.DBBattleRecord - cd pb.ErrorCode - isjoin bool - err error + boss *cfg.GameDreamlandBoosData + // umfantasy *pb.DBUserMFantasy + mdata *pb.DBMoonFantasy + record *pb.DBBattleRecord + cd pb.ErrorCode + isjoin bool + err error ) defer func() { if cd == pb.ErrorCode_Success { - this.module.modelUserMF.Change(session.GetUserId(), map[string]interface{}{ - "ticket": umfantasy.Ticket, - }) + // this.module.modelUserMF.Change(session.GetUserId(), map[string]interface{}{ + // "ticket": umfantasy.Ticket, + // }) this.module.modelDream.ChangeList("", mdata.Id, map[string]interface{}{ "record": mdata.Record, }) @@ -78,17 +78,20 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle cd = pb.ErrorCode_MoonfantasyNoJoin return } - if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil { - cd = pb.ErrorCode_CacheReadError - } - if umfantasy.Ticket < this.module.configure.GetGlobalConf().DreamlandCos { - cd = pb.ErrorCode_MoonfantasyNotEnoughbattles - } - umfantasy.Ticket -= this.module.configure.GetGlobalConf().DreamlandCos - if boss, err = this.module.configure.GetMonsterById(mdata.Monster); err != nil { - cd = pb.ErrorCode_ConfigNoFound + // if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil { + // cd = pb.ErrorCode_CacheReadError + // } + if cd = this.module.ConsumeRes(session, []*cfg.Gameatn{this.module.configure.GetGlobalConf().DreamlandCos}, true); cd != pb.ErrorCode_Success { return } + // if umfantasy.Ticket < this.module.configure.GetGlobalConf().DreamlandCos { + // cd = pb.ErrorCode_MoonfantasyNotEnoughbattles + // } + // umfantasy.Ticket -= this.module.configure.GetGlobalConf().DreamlandCos + // if boss, err = this.module.configure.GetMonsterById(mdata.Monster); err != nil { + // cd = pb.ErrorCode_ConfigNoFound + // return + // } if len(mdata.Join) >= int(mdata.Numup) { cd = pb.ErrorCode_MoonfantasyJoinUp diff --git a/modules/moonfantasy/api_buy.go b/modules/moonfantasy/api_buy.go index d53cd5020..c9a23fb53 100644 --- a/modules/moonfantasy/api_buy.go +++ b/modules/moonfantasy/api_buy.go @@ -32,7 +32,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.MoonfantasyBuyReq) ( code = pb.ErrorCode_CacheReadError return } - this.module.modelUserMF.recoverTicket(info) + this.module.modelUserMF.recoverTicket(session,info) need = make([]*cfg.Gameatn, 0) for i := int32(0); i < req.BuyNum; i++ { if challengeD, err = this.module.configure.GetchallengeData(info.BuyNum + i + 1); err != nil { @@ -50,11 +50,14 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.MoonfantasyBuyReq) ( return } info.BuyNum += req.BuyNum - info.Ticket += req.BuyNum + // info.Ticket += req.BuyNum + if code = this.module.DispenseRes(session, []*cfg.Gameatn{{A: comm.ItemType, T: comm.MoonFantasyTicket, N: req.BuyNum}}, true); code != pb.ErrorCode_Success { + return + } this.module.modelUserMF.Change(session.GetUserId(), map[string]interface{}{ "buyNum": info.BuyNum, - "ticket": info.Ticket, + // "ticket": info.Ticket, }) - session.SendMsg(string(this.module.GetType()), "buy", &pb.MoonfantasyBuyResp{Issucc: true, BattleNum: info.Ticket}) + session.SendMsg(string(this.module.GetType()), "buy", &pb.MoonfantasyBuyResp{Issucc: true, BattleNum: req.BuyNum}) return } diff --git a/modules/moonfantasy/api_getlist.go b/modules/moonfantasy/api_getlist.go index 718201e88..9c09e2f76 100644 --- a/modules/moonfantasy/api_getlist.go +++ b/modules/moonfantasy/api_getlist.go @@ -25,14 +25,14 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.MoonfantasyGetLi code = pb.ErrorCode_CacheReadError return } - this.module.modelUserMF.recoverTicket(info) + this.module.modelUserMF.recoverTicket(session, info) if err = this.module.modelUserMF.updateUserInfo(info); err != nil { code = pb.ErrorCode_DBError return } mfantasys, err = this.module.modelDream.querymfantasys(session.GetUserId()) session.SendMsg(string(this.module.GetType()), "getlist", &pb.MoonfantasyGetListResp{ - BattleNum: info.Ticket, + // BattleNum: info.Ticket, BuyNum: info.BuyNum, Dfantasys: mfantasys, }) diff --git a/modules/moonfantasy/modelDream.go b/modules/moonfantasy/modelDream.go index bf01182fc..b009ad11a 100644 --- a/modules/moonfantasy/modelDream.go +++ b/modules/moonfantasy/modelDream.go @@ -100,7 +100,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) { if umfantasy, err = this.module.modelUserMF.queryUsermfantasy(session.GetUserId()); err != nil { return } - this.module.modelUserMF.recoverTicket(umfantasy) + this.module.modelUserMF.recoverTicket(session, umfantasy) if umfantasy.TriggerNum >= globalconf.DreamlandTriggernum { return } diff --git a/modules/moonfantasy/modelUserMF.go b/modules/moonfantasy/modelUserMF.go index c8923305c..0b0d9e585 100644 --- a/modules/moonfantasy/modelUserMF.go +++ b/modules/moonfantasy/modelUserMF.go @@ -7,6 +7,7 @@ import ( "go_dreamfactory/modules" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" + cfg "go_dreamfactory/sys/configure/structs" "math" "time" @@ -42,12 +43,12 @@ func (this *modelUserMF) queryUsermfantasy(uId string) (info *pb.DBUserMFantasy, if err == mgo.MongodbNil { global := this.module.configure.GetGlobalConf() info = &pb.DBUserMFantasy{ - Id: primitive.NewObjectID().Hex(), - Uid: uId, - TriggerNum: 0, - LastTrigger: 0, - BuyNum: global.DreamlandFightnum, - Ticket: global.DreamlandFightnum, + Id: primitive.NewObjectID().Hex(), + Uid: uId, + TriggerNum: 0, + LastTrigger: 0, + BuyNum: global.DreamlandFightnum, + // Ticket: global.DreamlandFightnum, Lastrtickettime: configure.Now().Unix(), } if err = this.Add(uId, info); err != nil { @@ -62,8 +63,8 @@ func (this *modelUserMF) queryUsermfantasy(uId string) (info *pb.DBUserMFantasy, ///保存用户竞技场信息 func (this *modelUserMF) updateUserInfo(info *pb.DBUserMFantasy) (err error) { this.Change(info.Uid, map[string]interface{}{ - "triggerNum": info.TriggerNum, - "ticket": info.Ticket, + "triggerNum": info.TriggerNum, + // "ticket": info.Ticket, "buyNum": info.BuyNum, "lastTrigger": info.LastTrigger, "lastrtickettime": info.Lastrtickettime, @@ -71,9 +72,10 @@ func (this *modelUserMF) updateUserInfo(info *pb.DBUserMFantasy) (err error) { return } -func (this *modelUserMF) recoverTicket(info *pb.DBUserMFantasy) { +func (this *modelUserMF) recoverTicket(session comm.IUserSession, info *pb.DBUserMFantasy) { var ( duration time.Duration + ticket int32 ticketNum int32 ) if time.Unix(info.LastTrigger, 0).Day() < configure.Now().Day() { @@ -82,14 +84,15 @@ func (this *modelUserMF) recoverTicket(info *pb.DBUserMFantasy) { info.BuyNum = 0 } global := this.module.configure.GetGlobalConf() - if info.Ticket < global.DreamlandFightnum && info.Lastrtickettime > 0 { + ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.MoonFantasyTicket)) + if ticket < global.DreamlandFightnum && info.Lastrtickettime > 0 { duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0)) ticketNum = int32(math.Floor(duration.Minutes() / float64(global.ArenaTicketRecoveryTime))) if ticketNum > 0 { - info.Ticket += ticketNum - if info.Ticket > global.ArenaTicketMax { - info.Ticket = global.ArenaTicketMax + if ticketNum+ticket > global.ArenaTicketMax { + ticketNum = global.ArenaTicketMax - ticket } + this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{A: comm.ItemType, T: comm.MoonFantasyTicket, N: ticketNum}}, true) info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix() } } From 78d3254bc2a703bbec110ee60fb622f3f0cab60b Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 28 Nov 2022 18:34:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=A8=E7=A5=A8?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comm/const.go b/comm/const.go index 6fa400599..2605ba0f5 100644 --- a/comm/const.go +++ b/comm/const.go @@ -303,8 +303,8 @@ const ( //门票 const ( - ArenaTicket string = "10001" //竞技场入场券 - MoonFantasyTicket string = "10002" //梦境场入场券 + ArenaTicket string = "100004" //竞技场入场券 + MoonFantasyTicket string = "100003" //梦境场入场券 ) //红点枚举