refactor: 消耗积分暴兵,战报添加积分返回,优化结构。修复一些命令上的问题,更新全新命令解析器。

main
NorthLan 3 years ago
parent 86e268c751
commit 76da16982a

File diff suppressed because it is too large Load Diff

@ -29,42 +29,63 @@ message PlatformUserResp {
User user = 1;
}
// ID
message UserIdReq {
int64 userId = 1;
}
// ID
message UserIdResp {
int64 userId = 1;
}
//
message ChangeIntegralReq {
int64 userId = 1; // ID
int64 change = 2; //
}
//
message ChangeIntegralResp {
int64 userId = 1; // ID
int64 change = 2; //
int64 integral = 3; //
}
//
message UserIntegralResp {
int64 userId = 1; // ID
int64 integral = 2; //
}
//
message UserCheckInResp {
bool success = 1; //
string msg = 2; //
int64 integralChange = 3; //
int64 integral = 4; //
bool isCritical = 5; //
}
//
message UserSendGiftReq {
string platform = 1; //
string pUid = 2; // ID
string roomId = 3; // ID
int64 giftId = 4; // ID
string giftName = 5; //
int64 num = 6; //
int64 price = 7; // (使)
bool isPaid = 8; //
int64 userId = 2; // ID
string pUid = 3; // ID
string roomId = 4; // ID
int64 giftId = 5; // ID
string giftName = 6; //
int64 num = 7; //
int64 price = 8; // (使)
bool isPaid = 9; //
}
//
message UserSendGiftResp {
User user = 1; //
ChangeIntegralResp integral = 10; //
}
//
message UserBuyNobilityReq {
string platform = 1; //
string pUid = 2; // ID
@ -78,6 +99,7 @@ message UserBuyNobilityReq {
int64 endTime = 10; //
}
//
message UserBuyNobilityResp {
User user = 1; //
ChangeIntegralResp integral = 10; //
@ -111,6 +133,16 @@ message StatPvPReportReq {
repeated Item lostItems = 4; //
}
// -PvP
message StatPvPReportResp {
message Item {
int64 uid = 1; // ID
int64 addonIntegral = 2; //
}
repeated Item winItems = 3; //
repeated Item lostItems = 4; //
}
// rank
message RankPvpReq {
int32 type = 1; // rank
@ -141,7 +173,9 @@ service userCenter {
//ChangeIntegral
rpc ChangeIntegral(ChangeIntegralReq) returns (ChangeIntegralResp);
//GetUserIntegral
rpc GetUserIntegral(UserIdResp) returns (UserIntegralResp);
rpc GetUserIntegral(UserIdReq) returns (UserIntegralResp);
//UserCheckIn |
rpc UserCheckIn(UserIdReq) returns (UserCheckInResp);
/// @ZeroGroup: gift
@ -153,7 +187,7 @@ service userCenter {
rpc statPvpKill(StatPvPKillReq) returns (Empty);
rpc statPvpFirstBlood(StatPvPFirstBloodReq) returns (Empty);
rpc statPvpReport(StatPvPReportReq) returns (Empty);
rpc statPvpReport(StatPvPReportReq) returns (StatPvPReportResp);
/// @ZeroGroup: rank

@ -29,13 +29,15 @@ type UserCenterClient interface {
//ChangeIntegral 新增用户积分
ChangeIntegral(ctx context.Context, in *ChangeIntegralReq, opts ...grpc.CallOption) (*ChangeIntegralResp, error)
//GetUserIntegral 获取用户积分
GetUserIntegral(ctx context.Context, in *UserIdResp, opts ...grpc.CallOption) (*UserIntegralResp, error)
GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error)
//UserCheckIn 用户签到|打卡
UserCheckIn(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserCheckInResp, error)
// UserSendGift 用户赠送礼物
UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error)
UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*UserBuyNobilityResp, error)
StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error)
// rankPvp pvp排行
RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error)
}
@ -75,7 +77,7 @@ func (c *userCenterClient) ChangeIntegral(ctx context.Context, in *ChangeIntegra
return out, nil
}
func (c *userCenterClient) GetUserIntegral(ctx context.Context, in *UserIdResp, opts ...grpc.CallOption) (*UserIntegralResp, error) {
func (c *userCenterClient) GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error) {
out := new(UserIntegralResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/GetUserIntegral", in, out, opts...)
if err != nil {
@ -84,6 +86,15 @@ func (c *userCenterClient) GetUserIntegral(ctx context.Context, in *UserIdResp,
return out, nil
}
func (c *userCenterClient) UserCheckIn(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserCheckInResp, error) {
out := new(UserCheckInResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/UserCheckIn", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *userCenterClient) UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error) {
out := new(UserSendGiftResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/userSendGift", in, out, opts...)
@ -120,8 +131,8 @@ func (c *userCenterClient) StatPvpFirstBlood(ctx context.Context, in *StatPvPFir
return out, nil
}
func (c *userCenterClient) StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*Empty, error) {
out := new(Empty)
func (c *userCenterClient) StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error) {
out := new(StatPvPReportResp)
err := c.cc.Invoke(ctx, "/pb.userCenter/statPvpReport", in, out, opts...)
if err != nil {
return nil, err
@ -149,13 +160,15 @@ type UserCenterServer interface {
//ChangeIntegral 新增用户积分
ChangeIntegral(context.Context, *ChangeIntegralReq) (*ChangeIntegralResp, error)
//GetUserIntegral 获取用户积分
GetUserIntegral(context.Context, *UserIdResp) (*UserIntegralResp, error)
GetUserIntegral(context.Context, *UserIdReq) (*UserIntegralResp, error)
//UserCheckIn 用户签到|打卡
UserCheckIn(context.Context, *UserIdReq) (*UserCheckInResp, error)
// UserSendGift 用户赠送礼物
UserSendGift(context.Context, *UserSendGiftReq) (*UserSendGiftResp, error)
UserBuyNobility(context.Context, *UserBuyNobilityReq) (*UserBuyNobilityResp, error)
StatPvpKill(context.Context, *StatPvPKillReq) (*Empty, error)
StatPvpFirstBlood(context.Context, *StatPvPFirstBloodReq) (*Empty, error)
StatPvpReport(context.Context, *StatPvPReportReq) (*Empty, error)
StatPvpReport(context.Context, *StatPvPReportReq) (*StatPvPReportResp, error)
// rankPvp pvp排行
RankPvp(context.Context, *RankPvpReq) (*RankPvpResp, error)
mustEmbedUnimplementedUserCenterServer()
@ -174,9 +187,12 @@ func (UnimplementedUserCenterServer) GetUserIdByPUid(context.Context, *PlatformU
func (UnimplementedUserCenterServer) ChangeIntegral(context.Context, *ChangeIntegralReq) (*ChangeIntegralResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ChangeIntegral not implemented")
}
func (UnimplementedUserCenterServer) GetUserIntegral(context.Context, *UserIdResp) (*UserIntegralResp, error) {
func (UnimplementedUserCenterServer) GetUserIntegral(context.Context, *UserIdReq) (*UserIntegralResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserIntegral not implemented")
}
func (UnimplementedUserCenterServer) UserCheckIn(context.Context, *UserIdReq) (*UserCheckInResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserCheckIn not implemented")
}
func (UnimplementedUserCenterServer) UserSendGift(context.Context, *UserSendGiftReq) (*UserSendGiftResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UserSendGift not implemented")
}
@ -189,7 +205,7 @@ func (UnimplementedUserCenterServer) StatPvpKill(context.Context, *StatPvPKillRe
func (UnimplementedUserCenterServer) StatPvpFirstBlood(context.Context, *StatPvPFirstBloodReq) (*Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpFirstBlood not implemented")
}
func (UnimplementedUserCenterServer) StatPvpReport(context.Context, *StatPvPReportReq) (*Empty, error) {
func (UnimplementedUserCenterServer) StatPvpReport(context.Context, *StatPvPReportReq) (*StatPvPReportResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method StatPvpReport not implemented")
}
func (UnimplementedUserCenterServer) RankPvp(context.Context, *RankPvpReq) (*RankPvpResp, error) {
@ -263,7 +279,7 @@ func _UserCenter_ChangeIntegral_Handler(srv interface{}, ctx context.Context, de
}
func _UserCenter_GetUserIntegral_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserIdResp)
in := new(UserIdReq)
if err := dec(in); err != nil {
return nil, err
}
@ -275,7 +291,25 @@ func _UserCenter_GetUserIntegral_Handler(srv interface{}, ctx context.Context, d
FullMethod: "/pb.userCenter/GetUserIntegral",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).GetUserIntegral(ctx, req.(*UserIdResp))
return srv.(UserCenterServer).GetUserIntegral(ctx, req.(*UserIdReq))
}
return interceptor(ctx, in, info, handler)
}
func _UserCenter_UserCheckIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UserIdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserCenterServer).UserCheckIn(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.userCenter/UserCheckIn",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserCenterServer).UserCheckIn(ctx, req.(*UserIdReq))
}
return interceptor(ctx, in, info, handler)
}
@ -411,6 +445,10 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetUserIntegral",
Handler: _UserCenter_GetUserIntegral_Handler,
},
{
MethodName: "UserCheckIn",
Handler: _UserCenter_UserCheckIn_Handler,
},
{
MethodName: "userSendGift",
Handler: _UserCenter_UserSendGift_Handler,

@ -13,25 +13,29 @@ import (
)
type (
ChangeIntegralReq = pb.ChangeIntegralReq
ChangeIntegralResp = pb.ChangeIntegralResp
Empty = pb.Empty
PlatformUserReq = pb.PlatformUserReq
PlatformUserResp = pb.PlatformUserResp
RankPvpReq = pb.RankPvpReq
RankPvpResp = pb.RankPvpResp
RankPvpResp_Item = pb.RankPvpResp_Item
StatPvPFirstBloodReq = pb.StatPvPFirstBloodReq
StatPvPKillReq = pb.StatPvPKillReq
StatPvPReportReq = pb.StatPvPReportReq
StatPvPReportReq_Item = pb.StatPvPReportReq_Item
User = pb.User
UserBuyNobilityReq = pb.UserBuyNobilityReq
UserBuyNobilityResp = pb.UserBuyNobilityResp
UserIdResp = pb.UserIdResp
UserIntegralResp = pb.UserIntegralResp
UserSendGiftReq = pb.UserSendGiftReq
UserSendGiftResp = pb.UserSendGiftResp
ChangeIntegralReq = pb.ChangeIntegralReq
ChangeIntegralResp = pb.ChangeIntegralResp
Empty = pb.Empty
PlatformUserReq = pb.PlatformUserReq
PlatformUserResp = pb.PlatformUserResp
RankPvpReq = pb.RankPvpReq
RankPvpResp = pb.RankPvpResp
RankPvpResp_Item = pb.RankPvpResp_Item
StatPvPFirstBloodReq = pb.StatPvPFirstBloodReq
StatPvPKillReq = pb.StatPvPKillReq
StatPvPReportReq = pb.StatPvPReportReq
StatPvPReportReq_Item = pb.StatPvPReportReq_Item
StatPvPReportResp = pb.StatPvPReportResp
StatPvPReportResp_Item = pb.StatPvPReportResp_Item
User = pb.User
UserBuyNobilityReq = pb.UserBuyNobilityReq
UserBuyNobilityResp = pb.UserBuyNobilityResp
UserCheckInResp = pb.UserCheckInResp
UserIdReq = pb.UserIdReq
UserIdResp = pb.UserIdResp
UserIntegralResp = pb.UserIntegralResp
UserSendGiftReq = pb.UserSendGiftReq
UserSendGiftResp = pb.UserSendGiftResp
UserCenter interface {
// retrievePlatformUser 新增或获取用户
@ -41,13 +45,15 @@ type (
// ChangeIntegral 新增用户积分
ChangeIntegral(ctx context.Context, in *ChangeIntegralReq, opts ...grpc.CallOption) (*ChangeIntegralResp, error)
// GetUserIntegral 获取用户积分
GetUserIntegral(ctx context.Context, in *UserIdResp, opts ...grpc.CallOption) (*UserIntegralResp, error)
GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error)
// UserCheckIn 用户签到|打卡
UserCheckIn(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserCheckInResp, error)
// UserSendGift 用户赠送礼物
UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error)
UserBuyNobility(ctx context.Context, in *UserBuyNobilityReq, opts ...grpc.CallOption) (*UserBuyNobilityResp, error)
StatPvpKill(ctx context.Context, in *StatPvPKillReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpFirstBlood(ctx context.Context, in *StatPvPFirstBloodReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*Empty, error)
StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error)
// rankPvp pvp排行
RankPvp(ctx context.Context, in *RankPvpReq, opts ...grpc.CallOption) (*RankPvpResp, error)
}
@ -82,11 +88,17 @@ func (m *defaultUserCenter) ChangeIntegral(ctx context.Context, in *ChangeIntegr
}
// GetUserIntegral 获取用户积分
func (m *defaultUserCenter) GetUserIntegral(ctx context.Context, in *UserIdResp, opts ...grpc.CallOption) (*UserIntegralResp, error) {
func (m *defaultUserCenter) GetUserIntegral(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserIntegralResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.GetUserIntegral(ctx, in, opts...)
}
// UserCheckIn 用户签到|打卡
func (m *defaultUserCenter) UserCheckIn(ctx context.Context, in *UserIdReq, opts ...grpc.CallOption) (*UserCheckInResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.UserCheckIn(ctx, in, opts...)
}
// UserSendGift 用户赠送礼物
func (m *defaultUserCenter) UserSendGift(ctx context.Context, in *UserSendGiftReq, opts ...grpc.CallOption) (*UserSendGiftResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
@ -108,7 +120,7 @@ func (m *defaultUserCenter) StatPvpFirstBlood(ctx context.Context, in *StatPvPFi
return client.StatPvpFirstBlood(ctx, in, opts...)
}
func (m *defaultUserCenter) StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*Empty, error) {
func (m *defaultUserCenter) StatPvpReport(ctx context.Context, in *StatPvPReportReq, opts ...grpc.CallOption) (*StatPvPReportResp, error) {
client := pb.NewUserCenterClient(m.cli.Conn())
return client.StatPvpReport(ctx, in, opts...)
}

@ -1,6 +1,6 @@
Server:
Debug: false
Listen: 0.0.0.0:38888
Listen: 0.0.0.0:11111
UserCenterRpc:
Etcd:
Hosts:
@ -10,14 +10,23 @@ Kafka:
Danmaku:
Addr: [ "127.0.0.1:9093" ]
Topic: "danmaku-dev"
ConsumerGroup: "msgToPush-Dev"
ConsumerGroup: "msgToPush-dev"
Gift:
Addr: [ "127.0.0.1:9093" ]
Topic: "gift-dev"
ConsumerGroup: "giftToPush-Dev"
ConsumerGroup: "giftToPush-dev"
Game:
Common:
Commands: [ "q", "查询", "打卡", "签到" ]
Zhg:
Commands: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ]
Commands: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "s1", "s2", "s3", "s4", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ]
OutbreakCount: 5
OutbreakBaseCost: 300
OutbreakCostDict:
1: 250 # 步兵
2: 300 # 骑兵
3: 350 # 弓箭手
4: 350 # 法师
Zhghz:
Commands: [ "j", "加入", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "w", "我在哪", "m1", "m2", "m3", "m4", "f", "开炮" ]
Zhgfb:
@ -32,7 +41,7 @@ Log:
Format: json
Path: ./logs
Filename: dcg.log
FileMaxSize: 10 # 10mb
FileMaxSize: 8 # 10mb
FileMaxBackups: 30 #
MaxAge: 7 # 保留7天
Compress: true # 压缩日志

@ -1,8 +1,6 @@
Server:
Debug: false
Listen: 0.0.0.0:8888
Command:
Keys: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ]
UserCenterRpc:
Etcd:
Hosts:
@ -12,15 +10,30 @@ Kafka:
Danmaku:
Addr: [ "127.0.0.1:9093" ]
Topic: "danmaku"
ConsumerGroup: "msgToPush"
Gift:
Addr: [ "127.0.0.1:9093" ]
Topic: "gift"
ConsumerGroupId:
GiftToPush: "giftToPush"
MsgToPush: "msgToPush"
ConsumerGroup: "giftToPush"
Game:
Common:
Commands: [ "q", "查询", "打卡", "签到" ]
Zhg:
Commands: [ "j", "加入", "加入游戏", "s", "w", "我在哪", "s1", "s2", "s3", "s4", "c1", "c2", "c3", "c4", "r1", "r2", "r3", "m1", "m2", "m3" ]
OutbreakCount: 5
OutbreakBaseCost: 300
OutbreakCostDict:
1: 250 # 步兵
2: 300 # 骑兵
3: 350 # 弓箭手
4: 350 # 法师
Zhghz:
Commands: [ "j", "加入", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "w", "我在哪", "m1", "m2", "m3", "m4", "f", "开炮" ]
Zhgfb:
Commands: [ ]
Log:
Console:
Level: warn
Level: info
Format: console
File:
Enabled: true
@ -28,7 +41,7 @@ Log:
Format: json
Path: ./logs
Filename: dcg.log
FileMaxSize: 10 # 10mb
FileMaxSize: 8 # 10mb
FileMaxBackups: 30 #
MaxAge: 7 # 保留7天
Compress: true # 压缩日志

@ -38,7 +38,17 @@ type (
Gift Kafka
}
Game struct {
Zhg Game // 指挥官PvP模式
// 通用模式
Common struct {
Commands []string
}
// Zhg 指挥官PvP模式
Zhg struct {
Commands []string
OutbreakCount int64 // 每次暴兵数量
OutbreakBaseCost int64 // 默认每次暴兵消耗积分(不限兵种)
OutbreakCostDict map[int]int64 // 暴兵消耗积分表
}
Zhghz Game // 指挥官海战模式
Zhgfb Game // 指挥官副本模式
}

@ -0,0 +1,98 @@
package live_logic
import (
"dcg/app/user_center/usercenter"
"dcg/config"
"dcg/game/logic"
pbCommon "dcg/game/pb/common"
pbMq "dcg/game/pb/mq"
"dcg/game/svc"
"dcg/pkg/cmd"
"git.noahlan.cn/northlan/ntools-go/logger"
"strconv"
)
type commonGameLogic struct {
svcCtx *svc.ServiceContext
*LiveGameLogic
}
func NewCommonLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic {
resp := &commonGameLogic{
svcCtx: svcCtx,
LiveGameLogic: NewLiveGameLogic(-1, cmd.NewCMDParser(true, config.Config.Game.Common.Commands...)),
}
// 通用指令处理器
resp.RegisterCMDHandler(resp.handleQuery, "q", "查询")
resp.RegisterCMDHandler(resp.handleCheckIn, "打卡", "签到")
// 通用礼物处理器
resp.RegisterGiftHandler(resp.handleGift)
return resp.LiveGameLogic
}
func (h *commonGameLogic) handleCheckIn(roomId int64, _ string, user *pbCommon.PbUser) {
room, err := logic.GameLogic.RoomManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
respMsg := &pbCommon.CheckInMsg{User: user}
// RPC - 签到
resp, err := h.svcCtx.UserCenterRpc.UserCheckIn(h.svcCtx.Ctx, &usercenter.UserIdReq{UserId: user.UId})
if err != nil {
respMsg.Msg = "打卡失败UP主有罪。"
} else {
user.Integral = resp.Integral
respMsg.Success = resp.Success
respMsg.Msg = resp.Msg
respMsg.IntegralChange = resp.IntegralChange
respMsg.IsCritical = resp.IsCritical
}
room.PushToLiveRoom(roomId, "user.checkIn", respMsg)
}
func (h *commonGameLogic) handleQuery(roomId int64, _ string, user *pbCommon.PbUser) {
room, err := logic.GameLogic.RoomManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
room.PushToLiveRoom(roomId, "user.query", &pbCommon.UserQueryMsg{User: user})
}
func (h *commonGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) {
room, err := logic.GameLogic.RoomManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
// 1. 发送通用礼物消息
room.PushToLiveRoom(roomId, "live.gift", &pbCommon.GiftMsg{
User: user,
GiftId: gift.GiftId,
Num: gift.Num,
GiftName: gift.GiftName,
Price: gift.Price,
IsPaid: gift.IsPaid,
})
// 2. RPC 记录送礼,积分变动
req := &usercenter.UserSendGiftReq{
Platform: gift.Platform,
UserId: user.UId,
PUid: strconv.FormatInt(gift.Uid, 10),
RoomId: strconv.FormatInt(roomId, 10),
GiftId: gift.GiftId,
GiftName: gift.GiftName,
Num: gift.Num,
Price: gift.Price,
IsPaid: gift.IsPaid,
}
giftResp, err := h.svcCtx.UserCenterRpc.UserSendGift(h.svcCtx.Ctx, req)
if err != nil {
logger.SLog.Info("rpc 用户送礼记录失败,积分变动不通知了...")
return
}
user.Integral = giftResp.Integral.Integral // 更新最新积分
room.PushToLiveRoom(roomId, "user.integral.change", &pbCommon.UserIntegralChanged{
User: user,
Change: giftResp.Integral.Change,
Integral: giftResp.Integral.Integral,
})
}

@ -1,6 +1,7 @@
package logic
package live_logic
import (
"dcg/game/logic"
pbCommon "dcg/game/pb/common"
pbMq "dcg/game/pb/mq"
pbRoom "dcg/game/pb/room"
@ -48,14 +49,16 @@ func (l *LiveGameLogic) RegisterGiftHandler(h GiftHandlerFunc) {
l.GiftHandler = h
}
func (l *LiveGameLogic) HandleDanmaku(user *pbCommon.PbUser, dm *pbMq.MqDanmaku) {
// HandleDanmaku 弹幕数据处理
// pushCommonMsg 非弹幕数据是否转发
func (l *LiveGameLogic) HandleDanmaku(pushCommonMsg bool, user *pbCommon.PbUser, dm *pbMq.MqDanmaku) {
cmdStruct := l.CmdParser.Parse(dm.Content)
if cmdStruct.IsCMD {
for _, c := range cmdStruct.Arr {
go l.handleCMD(dm.LiveRoomId, c, user)
}
} else {
room, err := GameLogic.RoomManager.RoomByLiveRoomId(dm.LiveRoomId)
} else if pushCommonMsg {
room, err := logic.GameLogic.RoomManager.RoomByLiveRoomId(dm.LiveRoomId)
if err != nil {
return
}
@ -74,19 +77,8 @@ func (l *LiveGameLogic) handleCMD(roomId int64, cmd string, user *pbCommon.PbUse
}
func (l *LiveGameLogic) HandleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) {
if room, err := GameLogic.RoomManager.RoomByLiveRoomId(roomId); err == nil {
// 发送通用礼物消息
room.PushToLiveRoom(roomId, "live.gift", &pbCommon.GiftMsg{
User: user,
GiftId: gift.GiftId,
Num: gift.Num,
GiftName: gift.GiftName,
Price: gift.Price,
IsPaid: gift.IsPaid,
})
}
if l.GiftHandler == nil {
return
}
l.GiftHandler(roomId, user, gift)
go l.GiftHandler(roomId, user, gift)
}

@ -1,10 +1,7 @@
package live
package live_logic
import (
"dcg/game"
"dcg/game/logic"
"dcg/game/logic/zhg"
"dcg/game/logic/zhghz"
pbCommon "dcg/game/pb/common"
pbMq "dcg/game/pb/mq"
pbRoom "dcg/game/pb/room"
@ -17,28 +14,33 @@ var LiveManager *Manager
type (
Manager struct {
gameLogics map[pbRoom.GameType]*logic.LiveGameLogic
// commonLogic 通用游戏逻辑处理器,类型无关
commonLogic *LiveGameLogic
// gameLogics 游戏逻辑处理器 游戏类型相关
gameLogics map[pbRoom.GameType]*LiveGameLogic
}
)
func InitLiveManager(svcCtx *svc.ServiceContext) {
LiveManager = newManager()
// zhg
LiveManager.RegisterLogic(zhg.NewZhgLiveGameLogic().LiveGameLogic)
LiveManager.RegisterLogic(zhghz.NewZhghzLiveGameLogic().LiveGameLogic)
// commonLogic
LiveManager.commonLogic = NewCommonLiveGameLogic(svcCtx)
// gameLogic
LiveManager.RegisterLogic(NewZhgLiveGameLogic(svcCtx))
LiveManager.RegisterLogic(NewZhghzLiveGameLogic().LiveGameLogic)
}
func newManager() *Manager {
return &Manager{
gameLogics: make(map[pbRoom.GameType]*logic.LiveGameLogic),
gameLogics: make(map[pbRoom.GameType]*LiveGameLogic),
}
}
func (m *Manager) RegisterLogic(h *logic.LiveGameLogic) {
func (m *Manager) RegisterLogic(h *LiveGameLogic) {
m.gameLogics[h.GameType] = h
}
func (m *Manager) logicByLiveRoomId(roomId int64) (*logic.LiveGameLogic, error) {
func (m *Manager) logicByLiveRoomId(roomId int64) (*LiveGameLogic, error) {
gameType, err := game.GameTypeByLiveRoomId(roomId)
if err != nil {
return nil, errors.New("当前直播间未加入游戏房间")
@ -50,15 +52,19 @@ func (m *Manager) logicByLiveRoomId(roomId int64) (*logic.LiveGameLogic, error)
}
func (m *Manager) HandleDanmaku(user *pbCommon.PbUser, dm *pbMq.MqDanmaku) {
m.commonLogic.HandleDanmaku(false, user, dm)
l, err := m.logicByLiveRoomId(dm.LiveRoomId)
if err != nil {
logger.SLog.Errorf("获取游戏逻辑失败, err:%+v", err)
return
}
l.HandleDanmaku(user, dm)
l.HandleDanmaku(true, user, dm)
}
func (m *Manager) HandleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) {
m.commonLogic.HandleGift(roomId, user, gift)
l, err := m.logicByLiveRoomId(roomId)
if err != nil {
logger.SLog.Errorf("获取游戏逻辑失败, err:%+v", err)

@ -1,4 +1,4 @@
package zhg
package live_logic
import (
"dcg/config"
@ -7,26 +7,31 @@ import (
pbGameZhg "dcg/game/pb/game/zhg"
pbMq "dcg/game/pb/mq"
pbRoom "dcg/game/pb/room"
"dcg/game/svc"
"dcg/pkg/cmd"
"strconv"
)
type ZhgGameLogic struct {
*logic.LiveGameLogic
svcCtx *svc.ServiceContext
*LiveGameLogic
}
func NewZhgLiveGameLogic() *ZhgGameLogic {
func NewZhgLiveGameLogic(svcCtx *svc.ServiceContext) *LiveGameLogic {
resp := &ZhgGameLogic{
LiveGameLogic: logic.NewLiveGameLogic(pbRoom.GameType_ZHG, cmd.NewCMDParser(config.Config.Game.Zhg.Commands)),
svcCtx: svcCtx,
LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHG, cmd.NewCMDParser(false, config.Config.Game.Zhg.Commands...)),
}
resp.RegisterCMDHandler(resp.handleJoinGame, "j", "加入", "加入游戏")
resp.RegisterCMDHandler(resp.handleOutbreak, "s")
resp.RegisterCMDHandler(resp.handleOutbreakIntegral, "s1", "s2", "s3", "s4")
resp.RegisterCMDHandler(resp.handleWai, "w", "我在哪")
resp.RegisterCMDHandler(resp.handleCreateUnit, "c1", "c2", "c3", "c4")
resp.RegisterCMDHandler(resp.handleMove, "m1", "m2", "m3")
resp.RegisterCMDHandler(resp.handleMode, "r1", "r2", "r3")
// gift
resp.RegisterGiftHandler(resp.handleGift)
return resp
return resp.LiveGameLogic
}
func (h *ZhgGameLogic) handleJoinGame(roomId int64, _ string, user *pbCommon.PbUser) {
@ -45,6 +50,34 @@ func (h *ZhgGameLogic) handleOutbreak(roomId int64, _ string, user *pbCommon.PbU
room.PushToLiveRoom(roomId, "game.outbreak", &pbGameZhg.Outbreak{User: user})
}
func (h *ZhgGameLogic) handleOutbreakIntegral(roomId int64, cmd string, user *pbCommon.PbUser) {
room, err := logic.GameLogic.RoomManager.RoomByLiveRoomId(roomId)
if err != nil {
return
}
cmdRune := []rune(cmd)
if len(cmdRune) < 2 {
return
}
var unitTypeInt int
unitTypeInt, _ = strconv.Atoi(string(cmdRune[1]))
zhgCfg := config.Config.Game.Zhg
// 根据unitType计算 消耗积分
costIntegral, ok := zhgCfg.OutbreakCostDict[unitTypeInt]
if !ok {
costIntegral = zhgCfg.OutbreakBaseCost
}
room.PushToLiveRoom(roomId, "game.outbreak.integral", &pbGameZhg.OutbreakIntegral{
User: user,
UnitType: string(cmdRune[1]),
Count: int32(zhgCfg.OutbreakCount),
CostIntegral: -costIntegral,
})
}
func (h *ZhgGameLogic) handleCreateUnit(roomId int64, cmd string, user *pbCommon.PbUser) {
if len(cmd) < 2 {
return
@ -102,5 +135,5 @@ func (h *ZhgGameLogic) handleMode(roomId int64, cmd string, user *pbCommon.PbUse
}
func (h *ZhgGameLogic) handleGift(roomId int64, user *pbCommon.PbUser, gift *pbMq.MqGift) {
// TODO live.gift 已经发出,这里暂时不需要
// TODO 暂时没有特殊礼物需求,留空
}

@ -1,4 +1,4 @@
package zhghz
package live_logic
import (
"dcg/config"
@ -14,7 +14,7 @@ import (
type (
ZhghzGameLogic struct {
*logic.LiveGameLogic
*LiveGameLogic
// giftLogics 礼物处理 platform-cmd:logic
giftLogics map[string]giftLogic
@ -28,7 +28,7 @@ type (
func NewZhghzLiveGameLogic() *ZhghzGameLogic {
resp := &ZhghzGameLogic{
LiveGameLogic: logic.NewLiveGameLogic(pbRoom.GameType_ZHGHZ, cmd.NewCMDParser(config.Config.Game.Zhghz.Commands)),
LiveGameLogic: NewLiveGameLogic(pbRoom.GameType_ZHGHZ, cmd.NewCMDParser(false, config.Config.Game.Zhghz.Commands...)),
giftLogics: make(map[string]giftLogic),
}
resp.RegisterCMDHandler(resp.handleJoinGame, "j", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8")

@ -1,6 +1,7 @@
package logic
import (
"dcg/game/logic/user"
"dcg/game/logic/zhg/rank"
"dcg/game/logic/zhg/statistics"
"dcg/game/room"
@ -17,6 +18,7 @@ type Logics struct {
RoomManager *room.Manager
StatisticsPvP *statistics.PvP
Rank *rank.Rank
UserIntegral *user.UserIntegral
}
func Init(svcCtx *svc.ServiceContext) {
@ -43,10 +45,18 @@ func Init(svcCtx *svc.ServiceContext) {
return strings.ToLower(s)
}))
userIntegral := user.NewUserIntegral(svcCtx)
services.Register(userIntegral,
component.WithName(userIntegral.CMD()),
component.WithNameFunc(func(s string) string {
return userIntegral.Prefix() + "." + strings.ToLower(s)
}))
GameLogic = &Logics{
Services: services,
RoomManager: roomManager,
StatisticsPvP: statisticsPvP,
Rank: rk,
UserIntegral: userIntegral,
}
}

@ -0,0 +1,58 @@
package user
import (
"dcg/app/user_center/usercenter"
pbCommon "dcg/game/pb/common"
"dcg/game/svc"
"git.noahlan.cn/northlan/ngs/component"
"git.noahlan.cn/northlan/ngs/session"
)
type UserIntegral struct {
component.Base
svcCtx *svc.ServiceContext
}
func NewUserIntegral(svcCtx *svc.ServiceContext) *UserIntegral {
return &UserIntegral{
svcCtx: svcCtx,
}
}
func (p *UserIntegral) Init() {
}
func (p *UserIntegral) Shutdown() {
}
func (p *UserIntegral) CMD() string {
return "user"
}
func (p *UserIntegral) Prefix() string {
return "integral"
}
// Change 更新积分
func (p *UserIntegral) Change(s *session.Session, msg *pbCommon.ChangeUserIntegralReq) error {
integral, err := p.svcCtx.UserCenterRpc.ChangeIntegral(p.svcCtx.Ctx, &usercenter.ChangeIntegralReq{
UserId: msg.UserId,
Change: msg.Change,
})
if err != nil {
return s.Response(&pbCommon.ChangeUserIntegralResp{
Success: false,
Msg: err.Error(),
UserId: msg.UserId,
Change: 0,
Integral: 0,
})
}
return s.Response(&pbCommon.ChangeUserIntegralResp{
Success: true,
Msg: "成功",
UserId: msg.UserId,
Change: msg.Change,
Integral: integral.Integral,
})
}

@ -6,6 +6,7 @@ import (
"dcg/game/svc"
"git.noahlan.cn/northlan/ngs/component"
"git.noahlan.cn/northlan/ngs/session"
"git.noahlan.cn/northlan/ntools-go/logger"
)
type PvP struct {
@ -82,8 +83,8 @@ func (p *PvP) Report(s *session.Session, msg *pbGameZhg.StatPvPReport) error {
DeKillUnit: item.DeKillUnit,
})
}
_, err := p.svcCtx.UserCenterRpc.StatPvpReport(p.svcCtx.Ctx, &usercenter.StatPvPReportReq{
logger.SLog.Info("接收客户端战报", msg)
resp, err := p.svcCtx.UserCenterRpc.StatPvpReport(p.svcCtx.Ctx, &usercenter.StatPvPReportReq{
WinCamp: msg.WinCamp,
GeneralUid: msg.GeneralUid,
WinItems: winItems,
@ -92,5 +93,23 @@ func (p *PvP) Report(s *session.Session, msg *pbGameZhg.StatPvPReport) error {
if err != nil {
return err
}
return nil
winItemsResp := make([]*pbGameZhg.StatPvPReportResp_Item, 0, len(resp.WinItems))
lostItemsResp := make([]*pbGameZhg.StatPvPReportResp_Item, 0, len(resp.LostItems))
for _, item := range resp.WinItems {
winItemsResp = append(winItemsResp, &pbGameZhg.StatPvPReportResp_Item{
Uid: item.Uid,
AddonIntegral: item.AddonIntegral,
})
}
for _, item := range resp.LostItems {
lostItemsResp = append(lostItemsResp, &pbGameZhg.StatPvPReportResp_Item{
Uid: item.Uid,
AddonIntegral: item.AddonIntegral,
})
}
return s.Response(&pbGameZhg.StatPvPReportResp{
WinItems: winItemsResp,
LostItems: lostItemsResp,
})
}

@ -3,8 +3,7 @@ package msg_transfer
import (
"dcg/app/user_center/usercenter"
"dcg/config"
"dcg/game/live"
"dcg/game/logic"
"dcg/game/live_logic"
pbCommon "dcg/game/pb/common"
pbMq "dcg/game/pb/mq"
"dcg/game/svc"
@ -41,7 +40,7 @@ func (h *GiftToPushHandler) Init(svcCtx *svc.ServiceContext) {
}
}
func (h *GiftToPushHandler) handleGift(data []byte, msgKey string) {
func (h *GiftToPushHandler) handleGift(data []byte, _ string) {
// msg proto
var msgFromMq pbMq.MqGift
err := proto.Unmarshal(data, &msgFromMq)
@ -49,41 +48,26 @@ func (h *GiftToPushHandler) handleGift(data []byte, msgKey string) {
logger.SLog.Error("unmarshal msg err", err)
return
}
// rpc记录送礼
logger.SLog.Debugf("队列礼物消息: %s 投喂 %s 价值 %d", msgFromMq.Uname, msgFromMq.GiftName, msgFromMq.Price*msgFromMq.Num)
req := &usercenter.UserSendGiftReq{
// rpc创建或获取用户数据
rpcUser, err := h.svcCtx.UserCenterRpc.RetrievePlatformUser(h.svcCtx.Ctx, &usercenter.PlatformUserReq{
Platform: msgFromMq.Platform,
PUid: strconv.FormatInt(msgFromMq.Uid, 10),
RoomId: strconv.FormatInt(msgFromMq.LiveRoomId, 10),
GiftId: msgFromMq.GiftId,
GiftName: msgFromMq.GiftName,
Num: msgFromMq.Num,
Price: msgFromMq.Price,
IsPaid: msgFromMq.IsPaid,
}
giftResp, err := h.svcCtx.UserCenterRpc.UserSendGift(h.svcCtx.Ctx, req)
})
if err != nil {
logger.SLog.Info("rpc 用户送礼记录失败,本条消息丢弃...")
logger.SLog.Info("rpc获取用户信息失败本条消息丢弃...")
return
}
rpcUser := giftResp.User
pbUser := &pbCommon.PbUser{
UId: rpcUser.Id,
Uname: rpcUser.PUname,
Avatar: rpcUser.PAvatar,
NobilityLevel: rpcUser.NobilityLevel,
Integral: rpcUser.Integral,
}
// 用户积分变更,通用消息
if room, err := logic.GameLogic.RoomManager.RoomByLiveRoomId(msgFromMq.LiveRoomId); err == nil {
room.PushToLiveRoom(msgFromMq.LiveRoomId, "user.integral", &pbCommon.UserIntegralChanged{
User: pbUser,
Change: giftResp.Integral.Change,
Integral: giftResp.Integral.Integral,
})
UId: rpcUser.User.Id,
Uname: msgFromMq.Uname,
Avatar: rpcUser.User.PAvatar,
NobilityLevel: rpcUser.User.NobilityLevel,
Integral: rpcUser.User.Integral,
}
logger.SLog.Debugf("队列礼物消息: %s 投喂 %s 价值 %d", msgFromMq.Uname, msgFromMq.GiftName, msgFromMq.Price*msgFromMq.Num)
// 游戏逻辑处理
live.LiveManager.HandleGift(msgFromMq.LiveRoomId, pbUser, &msgFromMq)
live_logic.LiveManager.HandleGift(msgFromMq.LiveRoomId, pbUser, &msgFromMq)
}
func (GiftToPushHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }

@ -4,7 +4,7 @@ import (
"context"
"dcg/app/user_center/usercenter"
"dcg/config"
"dcg/game/live"
"dcg/game/live_logic"
pbCommon "dcg/game/pb/common"
pbMq "dcg/game/pb/mq"
"dcg/game/svc"
@ -68,7 +68,7 @@ func (h *MsgToPushHandler) handleDanmaku(data []byte, _ string) {
}
// 游戏命令逻辑处理
live.LiveManager.HandleDanmaku(pbUser, &msgFromMq)
live_logic.LiveManager.HandleDanmaku(pbUser, &msgFromMq)
}
func (MsgToPushHandler) Setup(_ sarama.ConsumerGroupSession) error { return nil }

File diff suppressed because it is too large Load Diff

@ -100,7 +100,7 @@ func (x *PbUser) GetIntegral() int64 {
return 0
}
// UserIntegralChanged 用户积分变更 push -> user.integral
// UserIntegralChanged 用户积分变更 push -> user.integral.change
type UserIntegralChanged struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -164,6 +164,270 @@ func (x *UserIntegralChanged) GetIntegral() int64 {
return 0
}
// ChangeUserIntegral 更新用户积分 request -> user.integral.change
type ChangeUserIntegralReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId,omitempty"` // 用户ID
Change int64 `protobuf:"varint,2,opt,name=change,proto3" json:"change,omitempty"` // 更新积分量,负数为消耗,正数为增加
}
func (x *ChangeUserIntegralReq) Reset() {
*x = ChangeUserIntegralReq{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ChangeUserIntegralReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ChangeUserIntegralReq) ProtoMessage() {}
func (x *ChangeUserIntegralReq) ProtoReflect() protoreflect.Message {
mi := &file_common_common_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 ChangeUserIntegralReq.ProtoReflect.Descriptor instead.
func (*ChangeUserIntegralReq) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{2}
}
func (x *ChangeUserIntegralReq) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *ChangeUserIntegralReq) GetChange() int64 {
if x != nil {
return x.Change
}
return 0
}
// ChangeUserIntegralResp 用户积分更新返回
type ChangeUserIntegralResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // 是否更新成功
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` // 消息
UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"` // 用户ID
Change int64 `protobuf:"varint,4,opt,name=change,proto3" json:"change,omitempty"` // 本次更新积分量
Integral int64 `protobuf:"varint,5,opt,name=integral,proto3" json:"integral,omitempty"` // 当前剩余积分
}
func (x *ChangeUserIntegralResp) Reset() {
*x = ChangeUserIntegralResp{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ChangeUserIntegralResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ChangeUserIntegralResp) ProtoMessage() {}
func (x *ChangeUserIntegralResp) ProtoReflect() protoreflect.Message {
mi := &file_common_common_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 ChangeUserIntegralResp.ProtoReflect.Descriptor instead.
func (*ChangeUserIntegralResp) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{3}
}
func (x *ChangeUserIntegralResp) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *ChangeUserIntegralResp) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
func (x *ChangeUserIntegralResp) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *ChangeUserIntegralResp) GetChange() int64 {
if x != nil {
return x.Change
}
return 0
}
func (x *ChangeUserIntegralResp) GetIntegral() int64 {
if x != nil {
return x.Integral
}
return 0
}
// CheckInMsg 每日打卡 push -> user.checkIn
type CheckInMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // 最新积分放置在user中
Success bool `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"` // 打卡成功与否
Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"` // 打卡消息: [打卡成功,快乐玩耍吧! | 今天已打过卡了!]
IntegralChange int64 `protobuf:"varint,4,opt,name=integralChange,proto3" json:"integralChange,omitempty"` // 积分变动
IsCritical bool `protobuf:"varint,5,opt,name=isCritical,proto3" json:"isCritical,omitempty"` // 是否发生了打卡积分奖励暴击
}
func (x *CheckInMsg) Reset() {
*x = CheckInMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CheckInMsg) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckInMsg) ProtoMessage() {}
func (x *CheckInMsg) ProtoReflect() protoreflect.Message {
mi := &file_common_common_proto_msgTypes[4]
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 CheckInMsg.ProtoReflect.Descriptor instead.
func (*CheckInMsg) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{4}
}
func (x *CheckInMsg) GetUser() *PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *CheckInMsg) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
func (x *CheckInMsg) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
func (x *CheckInMsg) GetIntegralChange() int64 {
if x != nil {
return x.IntegralChange
}
return 0
}
func (x *CheckInMsg) GetIsCritical() bool {
if x != nil {
return x.IsCritical
}
return false
}
// QueryIntegralMsg 用户查询信息通知 push -> user.query
type UserQueryMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
}
func (x *UserQueryMsg) Reset() {
*x = UserQueryMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserQueryMsg) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserQueryMsg) ProtoMessage() {}
func (x *UserQueryMsg) ProtoReflect() protoreflect.Message {
mi := &file_common_common_proto_msgTypes[5]
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 UserQueryMsg.ProtoReflect.Descriptor instead.
func (*UserQueryMsg) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{5}
}
func (x *UserQueryMsg) GetUser() *PbUser {
if x != nil {
return x.User
}
return nil
}
// DanmakuMsg 普通弹幕消息 push -> live.danmaku
type DanmakuMsg struct {
state protoimpl.MessageState
@ -177,7 +441,7 @@ type DanmakuMsg struct {
func (x *DanmakuMsg) Reset() {
*x = DanmakuMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[2]
mi := &file_common_common_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -190,7 +454,7 @@ func (x *DanmakuMsg) String() string {
func (*DanmakuMsg) ProtoMessage() {}
func (x *DanmakuMsg) ProtoReflect() protoreflect.Message {
mi := &file_common_common_proto_msgTypes[2]
mi := &file_common_common_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -203,7 +467,7 @@ func (x *DanmakuMsg) ProtoReflect() protoreflect.Message {
// Deprecated: Use DanmakuMsg.ProtoReflect.Descriptor instead.
func (*DanmakuMsg) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{2}
return file_common_common_proto_rawDescGZIP(), []int{6}
}
func (x *DanmakuMsg) GetUser() *PbUser {
@ -220,7 +484,7 @@ func (x *DanmakuMsg) GetContent() string {
return ""
}
// 赠送礼物 push -> game.gift
// 赠送礼物 push -> live.gift
type GiftMsg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -237,7 +501,7 @@ type GiftMsg struct {
func (x *GiftMsg) Reset() {
*x = GiftMsg{}
if protoimpl.UnsafeEnabled {
mi := &file_common_common_proto_msgTypes[3]
mi := &file_common_common_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -250,7 +514,7 @@ func (x *GiftMsg) String() string {
func (*GiftMsg) ProtoMessage() {}
func (x *GiftMsg) ProtoReflect() protoreflect.Message {
mi := &file_common_common_proto_msgTypes[3]
mi := &file_common_common_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -263,7 +527,7 @@ func (x *GiftMsg) ProtoReflect() protoreflect.Message {
// Deprecated: Use GiftMsg.ProtoReflect.Descriptor instead.
func (*GiftMsg) Descriptor() ([]byte, []int) {
return file_common_common_proto_rawDescGZIP(), []int{3}
return file_common_common_proto_rawDescGZIP(), []int{7}
}
func (x *GiftMsg) GetUser() *PbUser {
@ -329,24 +593,52 @@ var file_common_common_proto_rawDesc = []byte{
0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18,
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22,
0x4d, 0x0a, 0x0a, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a,
0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04,
0x75, 0x73, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xa4,
0x01, 0x0a, 0x07, 0x47, 0x69, 0x66, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73,
0x47, 0x0a, 0x15, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74,
0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72,
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x16, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52,
0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a,
0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12,
0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12,
0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0xa7, 0x01, 0x0a, 0x0a,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65,
0x72, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d,
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x67,
0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67,
0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65,
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69,
0x73, 0x50, 0x61, 0x69, 0x64, 0x42, 0x1d, 0x5a, 0x1b, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d,
0x65, 0x2f, 0x70, 0x62, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x70, 0x62, 0x43, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6d,
0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x26, 0x0a,
0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18,
0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x43,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69, 0x74, 0x69,
0x63, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x43, 0x72, 0x69,
0x74, 0x69, 0x63, 0x61, 0x6c, 0x22, 0x35, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x51, 0x75, 0x65,
0x72, 0x79, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x4d, 0x0a, 0x0a,
0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65,
0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x07,
0x47, 0x69, 0x66, 0x74, 0x4d, 0x73, 0x67, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x16,
0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x03, 0x20,
0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74,
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20,
0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73,
0x50, 0x61, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61,
0x69, 0x64, 0x42, 0x1d, 0x5a, 0x1b, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70,
0x62, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x70, 0x62, 0x43, 0x6f, 0x6d, 0x6d, 0x6f,
0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -361,22 +653,28 @@ func file_common_common_proto_rawDescGZIP() []byte {
return file_common_common_proto_rawDescData
}
var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_common_common_proto_goTypes = []interface{}{
(*PbUser)(nil), // 0: pb.common.PbUser
(*UserIntegralChanged)(nil), // 1: pb.common.UserIntegralChanged
(*DanmakuMsg)(nil), // 2: pb.common.DanmakuMsg
(*GiftMsg)(nil), // 3: pb.common.GiftMsg
(*PbUser)(nil), // 0: pb.common.PbUser
(*UserIntegralChanged)(nil), // 1: pb.common.UserIntegralChanged
(*ChangeUserIntegralReq)(nil), // 2: pb.common.ChangeUserIntegralReq
(*ChangeUserIntegralResp)(nil), // 3: pb.common.ChangeUserIntegralResp
(*CheckInMsg)(nil), // 4: pb.common.CheckInMsg
(*UserQueryMsg)(nil), // 5: pb.common.UserQueryMsg
(*DanmakuMsg)(nil), // 6: pb.common.DanmakuMsg
(*GiftMsg)(nil), // 7: pb.common.GiftMsg
}
var file_common_common_proto_depIdxs = []int32{
0, // 0: pb.common.UserIntegralChanged.user:type_name -> pb.common.PbUser
0, // 1: pb.common.DanmakuMsg.user:type_name -> pb.common.PbUser
0, // 2: pb.common.GiftMsg.user:type_name -> pb.common.PbUser
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
0, // 1: pb.common.CheckInMsg.user:type_name -> pb.common.PbUser
0, // 2: pb.common.UserQueryMsg.user:type_name -> pb.common.PbUser
0, // 3: pb.common.DanmakuMsg.user:type_name -> pb.common.PbUser
0, // 4: pb.common.GiftMsg.user:type_name -> pb.common.PbUser
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
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_common_common_proto_init() }
@ -410,7 +708,7 @@ func file_common_common_proto_init() {
}
}
file_common_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DanmakuMsg); i {
switch v := v.(*ChangeUserIntegralReq); i {
case 0:
return &v.state
case 1:
@ -422,6 +720,54 @@ func file_common_common_proto_init() {
}
}
file_common_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ChangeUserIntegralResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CheckInMsg); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserQueryMsg); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DanmakuMsg); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GiftMsg); i {
case 0:
return &v.state
@ -440,7 +786,7 @@ func file_common_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

@ -13,13 +13,42 @@ message PbUser {
int64 integral = 5; //
}
// UserIntegralChanged push -> user.integral
// UserIntegralChanged push -> user.integral.change
message UserIntegralChanged {
pb.common.PbUser user = 1;
int64 change = 2; //
int64 integral = 3; //
}
// ChangeUserIntegral request -> user.integral.change
message ChangeUserIntegralReq {
int64 userId = 1; // ID
int64 change = 2; //
}
// ChangeUserIntegralResp
message ChangeUserIntegralResp {
bool success = 1; //
string msg = 2; //
int64 userId = 3; // ID
int64 change = 4; //
int64 integral = 5; //
}
// CheckInMsg push -> user.checkIn
message CheckInMsg {
pb.common.PbUser user = 1; // user
bool success = 2; //
string msg = 3; // : [ | ]
int64 integralChange = 4; //
bool isCritical = 5; //
}
// QueryIntegralMsg push -> user.query
message UserQueryMsg {
pb.common.PbUser user = 1;
}
// DanmakuMsg push -> live.danmaku
message DanmakuMsg {
pb.common.PbUser user = 1;

@ -29,10 +29,13 @@ namespace Pb.Game.Zhg {
"VXNlciI7CgpDcmVhdGVVbml0Eh8KBHVzZXIYASABKAsyES5wYi5jb21tb24u",
"UGJVc2VyEgwKBHVuaXQYAiABKAkiNQoETW92ZRIfCgR1c2VyGAEgASgLMhEu",
"cGIuY29tbW9uLlBiVXNlchIMCgRsaW5lGAIgASgJIisKCE91dGJyZWFrEh8K",
"BHVzZXIYASABKAsyES5wYi5jb21tb24uUGJVc2VyIiYKA1dhaRIfCgR1c2Vy",
"GAEgASgLMhEucGIuY29tbW9uLlBiVXNlciI9CgxCdWlsZGluZ01vZGUSHwoE",
"dXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVzZXISDAoEbW9kZRgCIAEoCUIg",
"Wh5kY2cvZ2FtZS9wYi9nYW1lL3poZztwYkdhbWVaaGdiBnByb3RvMw=="));
"BHVzZXIYASABKAsyES5wYi5jb21tb24uUGJVc2VyImoKEE91dGJyZWFrSW50",
"ZWdyYWwSHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVzZXISEAoIdW5p",
"dFR5cGUYAiABKAkSDQoFY291bnQYAyABKAUSFAoMY29zdEludGVncmFsGAQg",
"ASgDIiYKA1dhaRIfCgR1c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNlciI9",
"CgxCdWlsZGluZ01vZGUSHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVz",
"ZXISDAoEbW9kZRgCIAEoCUIgWh5kY2cvZ2FtZS9wYi9nYW1lL3poZztwYkdh",
"bWVaaGdiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Pb.Common.CommonReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
@ -40,6 +43,7 @@ namespace Pb.Game.Zhg {
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.CreateUnit), global::Pb.Game.Zhg.CreateUnit.Parser, new[]{ "User", "Unit" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.Move), global::Pb.Game.Zhg.Move.Parser, new[]{ "User", "Line" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.Outbreak), global::Pb.Game.Zhg.Outbreak.Parser, new[]{ "User" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.OutbreakIntegral), global::Pb.Game.Zhg.OutbreakIntegral.Parser, new[]{ "User", "UnitType", "Count", "CostIntegral" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.Wai), global::Pb.Game.Zhg.Wai.Parser, new[]{ "User" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.BuildingMode), global::Pb.Game.Zhg.BuildingMode.Parser, new[]{ "User", "Mode" }, null, null, null, null)
}));
@ -932,6 +936,327 @@ namespace Pb.Game.Zhg {
}
/// <summary>
/// 暴兵(积分) push -> game.outbreak.integral
/// </summary>
public sealed partial class OutbreakIntegral : pb::IMessage<OutbreakIntegral>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<OutbreakIntegral> _parser = new pb::MessageParser<OutbreakIntegral>(() => new OutbreakIntegral());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<OutbreakIntegral> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Pb.Game.Zhg.CommandReflection.Descriptor.MessageTypes[4]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public OutbreakIntegral() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public OutbreakIntegral(OutbreakIntegral other) : this() {
user_ = other.user_ != null ? other.user_.Clone() : null;
unitType_ = other.unitType_;
count_ = other.count_;
costIntegral_ = other.costIntegral_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public OutbreakIntegral Clone() {
return new OutbreakIntegral(this);
}
/// <summary>Field number for the "user" field.</summary>
public const int UserFieldNumber = 1;
private global::Pb.Common.PbUser user_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Pb.Common.PbUser User {
get { return user_; }
set {
user_ = value;
}
}
/// <summary>Field number for the "unitType" field.</summary>
public const int UnitTypeFieldNumber = 2;
private string unitType_ = "";
/// <summary>
/// 暴兵类型
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string UnitType {
get { return unitType_; }
set {
unitType_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "count" field.</summary>
public const int CountFieldNumber = 3;
private int count_;
/// <summary>
/// 数量
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Count {
get { return count_; }
set {
count_ = value;
}
}
/// <summary>Field number for the "costIntegral" field.</summary>
public const int CostIntegralFieldNumber = 4;
private long costIntegral_;
/// <summary>
/// 消耗积分
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long CostIntegral {
get { return costIntegral_; }
set {
costIntegral_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as OutbreakIntegral);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(OutbreakIntegral other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!object.Equals(User, other.User)) return false;
if (UnitType != other.UnitType) return false;
if (Count != other.Count) return false;
if (CostIntegral != other.CostIntegral) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (user_ != null) hash ^= User.GetHashCode();
if (UnitType.Length != 0) hash ^= UnitType.GetHashCode();
if (Count != 0) hash ^= Count.GetHashCode();
if (CostIntegral != 0L) hash ^= CostIntegral.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (user_ != null) {
output.WriteRawTag(10);
output.WriteMessage(User);
}
if (UnitType.Length != 0) {
output.WriteRawTag(18);
output.WriteString(UnitType);
}
if (Count != 0) {
output.WriteRawTag(24);
output.WriteInt32(Count);
}
if (CostIntegral != 0L) {
output.WriteRawTag(32);
output.WriteInt64(CostIntegral);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (user_ != null) {
output.WriteRawTag(10);
output.WriteMessage(User);
}
if (UnitType.Length != 0) {
output.WriteRawTag(18);
output.WriteString(UnitType);
}
if (Count != 0) {
output.WriteRawTag(24);
output.WriteInt32(Count);
}
if (CostIntegral != 0L) {
output.WriteRawTag(32);
output.WriteInt64(CostIntegral);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (user_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(User);
}
if (UnitType.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(UnitType);
}
if (Count != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Count);
}
if (CostIntegral != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(CostIntegral);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(OutbreakIntegral other) {
if (other == null) {
return;
}
if (other.user_ != null) {
if (user_ == null) {
User = new global::Pb.Common.PbUser();
}
User.MergeFrom(other.User);
}
if (other.UnitType.Length != 0) {
UnitType = other.UnitType;
}
if (other.Count != 0) {
Count = other.Count;
}
if (other.CostIntegral != 0L) {
CostIntegral = other.CostIntegral;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
if (user_ == null) {
User = new global::Pb.Common.PbUser();
}
input.ReadMessage(User);
break;
}
case 18: {
UnitType = input.ReadString();
break;
}
case 24: {
Count = input.ReadInt32();
break;
}
case 32: {
CostIntegral = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
if (user_ == null) {
User = new global::Pb.Common.PbUser();
}
input.ReadMessage(User);
break;
}
case 18: {
UnitType = input.ReadString();
break;
}
case 24: {
Count = input.ReadInt32();
break;
}
case 32: {
CostIntegral = input.ReadInt64();
break;
}
}
}
}
#endif
}
/// <summary>
/// 查询位置 push -> game.wai
/// </summary>
@ -949,7 +1274,7 @@ namespace Pb.Game.Zhg {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Pb.Game.Zhg.CommandReflection.Descriptor.MessageTypes[4]; }
get { return global::Pb.Game.Zhg.CommandReflection.Descriptor.MessageTypes[5]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -1150,7 +1475,7 @@ namespace Pb.Game.Zhg {
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Pb.Game.Zhg.CommandReflection.Descriptor.MessageTypes[5]; }
get { return global::Pb.Game.Zhg.CommandReflection.Descriptor.MessageTypes[6]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]

@ -32,14 +32,19 @@ namespace Pb.Game.Zhg {
"Zy5TdGF0UHZQUmVwb3J0Lkl0ZW0SMgoJbG9zdEl0ZW1zGAQgAygLMh8ucGIu",
"Z2FtZS56aGcuU3RhdFB2UFJlcG9ydC5JdGVtGlsKBEl0ZW0SCwoDdWlkGAEg",
"ASgDEg4KBmRhbWFnZRgCIAEoAxIQCghkZURhbWFnZRgDIAEoAxIQCghraWxs",
"VW5pdBgEIAEoAxISCgpkZUtpbGxVbml0GAUgASgDQiBaHmRjZy9nYW1lL3Bi",
"L2dhbWUvemhnO3BiR2FtZVpoZ2IGcHJvdG8z"));
"VW5pdBgEIAEoAxISCgpkZUtpbGxVbml0GAUgASgDIq4BChFTdGF0UHZQUmVw",
"b3J0UmVzcBI1Cgh3aW5JdGVtcxgDIAMoCzIjLnBiLmdhbWUuemhnLlN0YXRQ",
"dlBSZXBvcnRSZXNwLkl0ZW0SNgoJbG9zdEl0ZW1zGAQgAygLMiMucGIuZ2Ft",
"ZS56aGcuU3RhdFB2UFJlcG9ydFJlc3AuSXRlbRoqCgRJdGVtEgsKA3VpZBgB",
"IAEoAxIVCg1hZGRvbkludGVncmFsGAIgASgDQiBaHmRjZy9nYW1lL3BiL2dh",
"bWUvemhnO3BiR2FtZVpoZ2IGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPKill), global::Pb.Game.Zhg.StatPvPKill.Parser, new[]{ "Uid", "TargetUid", "IsGeneral" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPFirstBlood), global::Pb.Game.Zhg.StatPvPFirstBlood.Parser, new[]{ "Uid", "Type" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPReport), global::Pb.Game.Zhg.StatPvPReport.Parser, new[]{ "WinCamp", "GeneralUid", "WinItems", "LostItems" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPReport.Types.Item), global::Pb.Game.Zhg.StatPvPReport.Types.Item.Parser, new[]{ "Uid", "Damage", "DeDamage", "KillUnit", "DeKillUnit" }, null, null, null, null)})
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPReport), global::Pb.Game.Zhg.StatPvPReport.Parser, new[]{ "WinCamp", "GeneralUid", "WinItems", "LostItems" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPReport.Types.Item), global::Pb.Game.Zhg.StatPvPReport.Types.Item.Parser, new[]{ "Uid", "Damage", "DeDamage", "KillUnit", "DeKillUnit" }, null, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPReportResp), global::Pb.Game.Zhg.StatPvPReportResp.Parser, new[]{ "WinItems", "LostItems" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhg.StatPvPReportResp.Types.Item), global::Pb.Game.Zhg.StatPvPReportResp.Types.Item.Parser, new[]{ "Uid", "AddonIntegral" }, null, null, null, null)})
}));
}
#endregion
@ -1209,6 +1214,459 @@ namespace Pb.Game.Zhg {
}
/// <summary>
/// 通知-PvP战报 回复
/// </summary>
public sealed partial class StatPvPReportResp : pb::IMessage<StatPvPReportResp>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<StatPvPReportResp> _parser = new pb::MessageParser<StatPvPReportResp>(() => new StatPvPReportResp());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<StatPvPReportResp> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Pb.Game.Zhg.StatReflection.Descriptor.MessageTypes[3]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public StatPvPReportResp() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public StatPvPReportResp(StatPvPReportResp other) : this() {
winItems_ = other.winItems_.Clone();
lostItems_ = other.lostItems_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public StatPvPReportResp Clone() {
return new StatPvPReportResp(this);
}
/// <summary>Field number for the "winItems" field.</summary>
public const int WinItemsFieldNumber = 3;
private static readonly pb::FieldCodec<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item> _repeated_winItems_codec
= pb::FieldCodec.ForMessage(26, global::Pb.Game.Zhg.StatPvPReportResp.Types.Item.Parser);
private readonly pbc::RepeatedField<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item> winItems_ = new pbc::RepeatedField<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item>();
/// <summary>
/// 获胜方数据
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item> WinItems {
get { return winItems_; }
}
/// <summary>Field number for the "lostItems" field.</summary>
public const int LostItemsFieldNumber = 4;
private static readonly pb::FieldCodec<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item> _repeated_lostItems_codec
= pb::FieldCodec.ForMessage(34, global::Pb.Game.Zhg.StatPvPReportResp.Types.Item.Parser);
private readonly pbc::RepeatedField<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item> lostItems_ = new pbc::RepeatedField<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item>();
/// <summary>
/// 战败方数据
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Pb.Game.Zhg.StatPvPReportResp.Types.Item> LostItems {
get { return lostItems_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as StatPvPReportResp);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(StatPvPReportResp other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!winItems_.Equals(other.winItems_)) return false;
if(!lostItems_.Equals(other.lostItems_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
hash ^= winItems_.GetHashCode();
hash ^= lostItems_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
winItems_.WriteTo(output, _repeated_winItems_codec);
lostItems_.WriteTo(output, _repeated_lostItems_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
winItems_.WriteTo(ref output, _repeated_winItems_codec);
lostItems_.WriteTo(ref output, _repeated_lostItems_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
size += winItems_.CalculateSize(_repeated_winItems_codec);
size += lostItems_.CalculateSize(_repeated_lostItems_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(StatPvPReportResp other) {
if (other == null) {
return;
}
winItems_.Add(other.winItems_);
lostItems_.Add(other.lostItems_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 26: {
winItems_.AddEntriesFrom(input, _repeated_winItems_codec);
break;
}
case 34: {
lostItems_.AddEntriesFrom(input, _repeated_lostItems_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 26: {
winItems_.AddEntriesFrom(ref input, _repeated_winItems_codec);
break;
}
case 34: {
lostItems_.AddEntriesFrom(ref input, _repeated_lostItems_codec);
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the StatPvPReportResp message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
public sealed partial class Item : pb::IMessage<Item>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<Item> _parser = new pb::MessageParser<Item>(() => new Item());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<Item> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Pb.Game.Zhg.StatPvPReportResp.Descriptor.NestedTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Item() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Item(Item other) : this() {
uid_ = other.uid_;
addonIntegral_ = other.addonIntegral_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Item Clone() {
return new Item(this);
}
/// <summary>Field number for the "uid" field.</summary>
public const int UidFieldNumber = 1;
private long uid_;
/// <summary>
/// 用户ID
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long Uid {
get { return uid_; }
set {
uid_ = value;
}
}
/// <summary>Field number for the "addonIntegral" field.</summary>
public const int AddonIntegralFieldNumber = 2;
private long addonIntegral_;
/// <summary>
/// 本次获取的积分
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public long AddonIntegral {
get { return addonIntegral_; }
set {
addonIntegral_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as Item);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(Item other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Uid != other.Uid) return false;
if (AddonIntegral != other.AddonIntegral) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Uid != 0L) hash ^= Uid.GetHashCode();
if (AddonIntegral != 0L) hash ^= AddonIntegral.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Uid != 0L) {
output.WriteRawTag(8);
output.WriteInt64(Uid);
}
if (AddonIntegral != 0L) {
output.WriteRawTag(16);
output.WriteInt64(AddonIntegral);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Uid != 0L) {
output.WriteRawTag(8);
output.WriteInt64(Uid);
}
if (AddonIntegral != 0L) {
output.WriteRawTag(16);
output.WriteInt64(AddonIntegral);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Uid != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(Uid);
}
if (AddonIntegral != 0L) {
size += 1 + pb::CodedOutputStream.ComputeInt64Size(AddonIntegral);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(Item other) {
if (other == null) {
return;
}
if (other.Uid != 0L) {
Uid = other.Uid;
}
if (other.AddonIntegral != 0L) {
AddonIntegral = other.AddonIntegral;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
Uid = input.ReadInt64();
break;
}
case 16: {
AddonIntegral = input.ReadInt64();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
Uid = input.ReadInt64();
break;
}
case 16: {
AddonIntegral = input.ReadInt64();
break;
}
}
}
}
#endif
}
}
#endregion
}
#endregion
}

@ -229,6 +229,78 @@ func (x *Outbreak) GetUser() *common.PbUser {
return nil
}
// 暴兵(积分) push -> game.outbreak.integral
type OutbreakIntegral struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
UnitType string `protobuf:"bytes,2,opt,name=unitType,proto3" json:"unitType,omitempty"` // 暴兵类型
Count int32 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"` // 数量
CostIntegral int64 `protobuf:"varint,4,opt,name=costIntegral,proto3" json:"costIntegral,omitempty"` // 消耗积分
}
func (x *OutbreakIntegral) Reset() {
*x = OutbreakIntegral{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhg_command_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OutbreakIntegral) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OutbreakIntegral) ProtoMessage() {}
func (x *OutbreakIntegral) ProtoReflect() protoreflect.Message {
mi := &file_game_zhg_command_proto_msgTypes[4]
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 OutbreakIntegral.ProtoReflect.Descriptor instead.
func (*OutbreakIntegral) Descriptor() ([]byte, []int) {
return file_game_zhg_command_proto_rawDescGZIP(), []int{4}
}
func (x *OutbreakIntegral) GetUser() *common.PbUser {
if x != nil {
return x.User
}
return nil
}
func (x *OutbreakIntegral) GetUnitType() string {
if x != nil {
return x.UnitType
}
return ""
}
func (x *OutbreakIntegral) GetCount() int32 {
if x != nil {
return x.Count
}
return 0
}
func (x *OutbreakIntegral) GetCostIntegral() int64 {
if x != nil {
return x.CostIntegral
}
return 0
}
// 查询位置 push -> game.wai
type Wai struct {
state protoimpl.MessageState
@ -241,7 +313,7 @@ type Wai struct {
func (x *Wai) Reset() {
*x = Wai{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhg_command_proto_msgTypes[4]
mi := &file_game_zhg_command_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -254,7 +326,7 @@ func (x *Wai) String() string {
func (*Wai) ProtoMessage() {}
func (x *Wai) ProtoReflect() protoreflect.Message {
mi := &file_game_zhg_command_proto_msgTypes[4]
mi := &file_game_zhg_command_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -267,7 +339,7 @@ func (x *Wai) ProtoReflect() protoreflect.Message {
// Deprecated: Use Wai.ProtoReflect.Descriptor instead.
func (*Wai) Descriptor() ([]byte, []int) {
return file_game_zhg_command_proto_rawDescGZIP(), []int{4}
return file_game_zhg_command_proto_rawDescGZIP(), []int{5}
}
func (x *Wai) GetUser() *common.PbUser {
@ -290,7 +362,7 @@ type BuildingMode struct {
func (x *BuildingMode) Reset() {
*x = BuildingMode{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhg_command_proto_msgTypes[5]
mi := &file_game_zhg_command_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -303,7 +375,7 @@ func (x *BuildingMode) String() string {
func (*BuildingMode) ProtoMessage() {}
func (x *BuildingMode) ProtoReflect() protoreflect.Message {
mi := &file_game_zhg_command_proto_msgTypes[5]
mi := &file_game_zhg_command_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -316,7 +388,7 @@ func (x *BuildingMode) ProtoReflect() protoreflect.Message {
// Deprecated: Use BuildingMode.ProtoReflect.Descriptor instead.
func (*BuildingMode) Descriptor() ([]byte, []int) {
return file_game_zhg_command_proto_rawDescGZIP(), []int{5}
return file_game_zhg_command_proto_rawDescGZIP(), []int{6}
}
func (x *BuildingMode) GetUser() *common.PbUser {
@ -354,17 +426,27 @@ var file_game_zhg_command_proto_rawDesc = []byte{
0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x22, 0x31, 0x0a, 0x08, 0x4f, 0x75, 0x74,
0x62, 0x72, 0x65, 0x61, 0x6b, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x2c, 0x0a, 0x03,
0x57, 0x61, 0x69, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62,
0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x49, 0x0a, 0x0c, 0x42, 0x75,
0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65,
0x72, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6d, 0x6f, 0x64, 0x65, 0x42, 0x20, 0x5a, 0x1e, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d,
0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x3b, 0x70, 0x62,
0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x8f, 0x01, 0x0a,
0x10, 0x4f, 0x75, 0x74, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61,
0x6c, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73,
0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x69, 0x74,
0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x74,
0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x6f,
0x73, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0c, 0x63, 0x6f, 0x73, 0x74, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x22, 0x2c,
0x0a, 0x03, 0x57, 0x61, 0x69, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x49, 0x0a, 0x0c,
0x42, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x04,
0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75,
0x73, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x42, 0x20, 0x5a, 0x1e, 0x64, 0x63, 0x67, 0x2f, 0x67,
0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x3b,
0x70, 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -379,28 +461,30 @@ func file_game_zhg_command_proto_rawDescGZIP() []byte {
return file_game_zhg_command_proto_rawDescData
}
var file_game_zhg_command_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_game_zhg_command_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_game_zhg_command_proto_goTypes = []interface{}{
(*JoinGame)(nil), // 0: pb.game.zhg.JoinGame
(*CreateUnit)(nil), // 1: pb.game.zhg.CreateUnit
(*Move)(nil), // 2: pb.game.zhg.Move
(*Outbreak)(nil), // 3: pb.game.zhg.Outbreak
(*Wai)(nil), // 4: pb.game.zhg.Wai
(*BuildingMode)(nil), // 5: pb.game.zhg.BuildingMode
(*common.PbUser)(nil), // 6: pb.common.PbUser
(*JoinGame)(nil), // 0: pb.game.zhg.JoinGame
(*CreateUnit)(nil), // 1: pb.game.zhg.CreateUnit
(*Move)(nil), // 2: pb.game.zhg.Move
(*Outbreak)(nil), // 3: pb.game.zhg.Outbreak
(*OutbreakIntegral)(nil), // 4: pb.game.zhg.OutbreakIntegral
(*Wai)(nil), // 5: pb.game.zhg.Wai
(*BuildingMode)(nil), // 6: pb.game.zhg.BuildingMode
(*common.PbUser)(nil), // 7: pb.common.PbUser
}
var file_game_zhg_command_proto_depIdxs = []int32{
6, // 0: pb.game.zhg.JoinGame.user:type_name -> pb.common.PbUser
6, // 1: pb.game.zhg.CreateUnit.user:type_name -> pb.common.PbUser
6, // 2: pb.game.zhg.Move.user:type_name -> pb.common.PbUser
6, // 3: pb.game.zhg.Outbreak.user:type_name -> pb.common.PbUser
6, // 4: pb.game.zhg.Wai.user:type_name -> pb.common.PbUser
6, // 5: pb.game.zhg.BuildingMode.user:type_name -> pb.common.PbUser
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
7, // 0: pb.game.zhg.JoinGame.user:type_name -> pb.common.PbUser
7, // 1: pb.game.zhg.CreateUnit.user:type_name -> pb.common.PbUser
7, // 2: pb.game.zhg.Move.user:type_name -> pb.common.PbUser
7, // 3: pb.game.zhg.Outbreak.user:type_name -> pb.common.PbUser
7, // 4: pb.game.zhg.OutbreakIntegral.user:type_name -> pb.common.PbUser
7, // 5: pb.game.zhg.Wai.user:type_name -> pb.common.PbUser
7, // 6: pb.game.zhg.BuildingMode.user:type_name -> pb.common.PbUser
7, // [7:7] is the sub-list for method output_type
7, // [7:7] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
}
func init() { file_game_zhg_command_proto_init() }
@ -458,7 +542,7 @@ func file_game_zhg_command_proto_init() {
}
}
file_game_zhg_command_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Wai); i {
switch v := v.(*OutbreakIntegral); i {
case 0:
return &v.state
case 1:
@ -470,6 +554,18 @@ func file_game_zhg_command_proto_init() {
}
}
file_game_zhg_command_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Wai); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhg_command_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BuildingMode); i {
case 0:
return &v.state
@ -488,7 +584,7 @@ func file_game_zhg_command_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_game_zhg_command_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},

@ -28,6 +28,14 @@ message Outbreak{
pb.common.PbUser user = 1;
}
// push -> game.outbreak.integral
message OutbreakIntegral {
pb.common.PbUser user = 1;
string unitType = 2; //
int32 count = 3; //
int64 costIntegral = 4; //
}
// push -> game.wai
message Wai{
pb.common.PbUser user = 1;

@ -212,6 +212,62 @@ func (x *StatPvPReport) GetLostItems() []*StatPvPReport_Item {
return nil
}
// 通知-PvP战报 回复
type StatPvPReportResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
WinItems []*StatPvPReportResp_Item `protobuf:"bytes,3,rep,name=winItems,proto3" json:"winItems,omitempty"` // 获胜方数据
LostItems []*StatPvPReportResp_Item `protobuf:"bytes,4,rep,name=lostItems,proto3" json:"lostItems,omitempty"` // 战败方数据
}
func (x *StatPvPReportResp) Reset() {
*x = StatPvPReportResp{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhg_stat_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatPvPReportResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatPvPReportResp) ProtoMessage() {}
func (x *StatPvPReportResp) ProtoReflect() protoreflect.Message {
mi := &file_game_zhg_stat_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 StatPvPReportResp.ProtoReflect.Descriptor instead.
func (*StatPvPReportResp) Descriptor() ([]byte, []int) {
return file_game_zhg_stat_proto_rawDescGZIP(), []int{3}
}
func (x *StatPvPReportResp) GetWinItems() []*StatPvPReportResp_Item {
if x != nil {
return x.WinItems
}
return nil
}
func (x *StatPvPReportResp) GetLostItems() []*StatPvPReportResp_Item {
if x != nil {
return x.LostItems
}
return nil
}
type StatPvPReport_Item struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -227,7 +283,7 @@ type StatPvPReport_Item struct {
func (x *StatPvPReport_Item) Reset() {
*x = StatPvPReport_Item{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhg_stat_proto_msgTypes[3]
mi := &file_game_zhg_stat_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -240,7 +296,7 @@ func (x *StatPvPReport_Item) String() string {
func (*StatPvPReport_Item) ProtoMessage() {}
func (x *StatPvPReport_Item) ProtoReflect() protoreflect.Message {
mi := &file_game_zhg_stat_proto_msgTypes[3]
mi := &file_game_zhg_stat_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -291,6 +347,61 @@ func (x *StatPvPReport_Item) GetDeKillUnit() int64 {
return 0
}
type StatPvPReportResp_Item struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid int64 `protobuf:"varint,1,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID
AddonIntegral int64 `protobuf:"varint,2,opt,name=addonIntegral,proto3" json:"addonIntegral,omitempty"` // 本次获取的积分
}
func (x *StatPvPReportResp_Item) Reset() {
*x = StatPvPReportResp_Item{}
if protoimpl.UnsafeEnabled {
mi := &file_game_zhg_stat_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatPvPReportResp_Item) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatPvPReportResp_Item) ProtoMessage() {}
func (x *StatPvPReportResp_Item) ProtoReflect() protoreflect.Message {
mi := &file_game_zhg_stat_proto_msgTypes[5]
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 StatPvPReportResp_Item.ProtoReflect.Descriptor instead.
func (*StatPvPReportResp_Item) Descriptor() ([]byte, []int) {
return file_game_zhg_stat_proto_rawDescGZIP(), []int{3, 0}
}
func (x *StatPvPReportResp_Item) GetUid() int64 {
if x != nil {
return x.Uid
}
return 0
}
func (x *StatPvPReportResp_Item) GetAddonIntegral() int64 {
if x != nil {
return x.AddonIntegral
}
return 0
}
var File_game_zhg_stat_proto protoreflect.FileDescriptor
var file_game_zhg_stat_proto_rawDesc = []byte{
@ -326,10 +437,24 @@ var file_game_zhg_stat_proto_rawDesc = []byte{
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20,
0x01, 0x28, 0x03, 0x52, 0x08, 0x6b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x1e, 0x0a,
0x0a, 0x64, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x64, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x42, 0x20, 0x5a,
0x1e, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d,
0x65, 0x2f, 0x7a, 0x68, 0x67, 0x3b, 0x70, 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x03, 0x52, 0x0a, 0x64, 0x65, 0x4b, 0x69, 0x6c, 0x6c, 0x55, 0x6e, 0x69, 0x74, 0x22, 0xd7, 0x01,
0x0a, 0x11, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52,
0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x08, 0x77, 0x69, 0x6e, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x2e,
0x7a, 0x68, 0x67, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70, 0x6f, 0x72,
0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x08, 0x77, 0x69, 0x6e, 0x49,
0x74, 0x65, 0x6d, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x6c, 0x6f, 0x73, 0x74, 0x49, 0x74, 0x65, 0x6d,
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x67, 0x61, 0x6d,
0x65, 0x2e, 0x7a, 0x68, 0x67, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x50, 0x76, 0x50, 0x52, 0x65, 0x70,
0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x09, 0x6c, 0x6f,
0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x1a, 0x3e, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x12,
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69,
0x64, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x64, 0x64, 0x6f, 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72,
0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x61, 0x64, 0x64, 0x6f, 0x6e, 0x49,
0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x42, 0x20, 0x5a, 0x1e, 0x64, 0x63, 0x67, 0x2f, 0x67,
0x61, 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x3b,
0x70, 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
@ -344,21 +469,25 @@ func file_game_zhg_stat_proto_rawDescGZIP() []byte {
return file_game_zhg_stat_proto_rawDescData
}
var file_game_zhg_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_game_zhg_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_game_zhg_stat_proto_goTypes = []interface{}{
(*StatPvPKill)(nil), // 0: pb.game.zhg.StatPvPKill
(*StatPvPFirstBlood)(nil), // 1: pb.game.zhg.StatPvPFirstBlood
(*StatPvPReport)(nil), // 2: pb.game.zhg.StatPvPReport
(*StatPvPReport_Item)(nil), // 3: pb.game.zhg.StatPvPReport.Item
(*StatPvPKill)(nil), // 0: pb.game.zhg.StatPvPKill
(*StatPvPFirstBlood)(nil), // 1: pb.game.zhg.StatPvPFirstBlood
(*StatPvPReport)(nil), // 2: pb.game.zhg.StatPvPReport
(*StatPvPReportResp)(nil), // 3: pb.game.zhg.StatPvPReportResp
(*StatPvPReport_Item)(nil), // 4: pb.game.zhg.StatPvPReport.Item
(*StatPvPReportResp_Item)(nil), // 5: pb.game.zhg.StatPvPReportResp.Item
}
var file_game_zhg_stat_proto_depIdxs = []int32{
3, // 0: pb.game.zhg.StatPvPReport.winItems:type_name -> pb.game.zhg.StatPvPReport.Item
3, // 1: pb.game.zhg.StatPvPReport.lostItems:type_name -> pb.game.zhg.StatPvPReport.Item
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 extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
4, // 0: pb.game.zhg.StatPvPReport.winItems:type_name -> pb.game.zhg.StatPvPReport.Item
4, // 1: pb.game.zhg.StatPvPReport.lostItems:type_name -> pb.game.zhg.StatPvPReport.Item
5, // 2: pb.game.zhg.StatPvPReportResp.winItems:type_name -> pb.game.zhg.StatPvPReportResp.Item
5, // 3: pb.game.zhg.StatPvPReportResp.lostItems:type_name -> pb.game.zhg.StatPvPReportResp.Item
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
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_game_zhg_stat_proto_init() }
@ -404,6 +533,18 @@ func file_game_zhg_stat_proto_init() {
}
}
file_game_zhg_stat_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPReportResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_game_zhg_stat_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPReport_Item); i {
case 0:
return &v.state
@ -415,6 +556,18 @@ func file_game_zhg_stat_proto_init() {
return nil
}
}
file_game_zhg_stat_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatPvPReportResp_Item); 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{
@ -422,7 +575,7 @@ func file_game_zhg_stat_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_game_zhg_stat_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},

@ -30,4 +30,14 @@ message StatPvPReport {
int64 generalUid = 2; // UID
repeated Item winItems = 3; //
repeated Item lostItems = 4; //
}
// -PvP
message StatPvPReportResp {
message Item {
int64 uid = 1; // ID
int64 addonIntegral = 2; //
}
repeated Item winItems = 3; //
repeated Item lostItems = 4; //
}

@ -6,7 +6,7 @@ require (
git.noahlan.cn/northlan/ngs v0.1.2
git.noahlan.cn/northlan/ntools-go/kafka v1.0.1
git.noahlan.cn/northlan/ntools-go/logger v1.0.1
git.noahlan.cn/northlan/ntools-go/stringn v1.0.0
git.noahlan.cn/northlan/ntools-go/stringn v1.1.0
github.com/Shopify/sarama v1.32.0
github.com/golang/protobuf v1.5.2
github.com/gookit/config/v2 v2.1.0

@ -39,6 +39,8 @@ git.noahlan.cn/northlan/ntools-go/logger v1.0.1 h1:+08dMbsKGECM1B7H8GqwtRzGqOl5y
git.noahlan.cn/northlan/ntools-go/logger v1.0.1/go.mod h1:QQwgylABV9P8MFGvXKlujJO5NV0MP0JUPzqQt3I0Y+w=
git.noahlan.cn/northlan/ntools-go/stringn v1.0.0 h1:kQlk6JkJSX2JRsxtji6Ht1f3FfwdJiFEJ52k0ehjR8s=
git.noahlan.cn/northlan/ntools-go/stringn v1.0.0/go.mod h1:71TA+fLLhTNGsZvX4Fd/YbV6UeYiliW5hxK+3a9wKko=
git.noahlan.cn/northlan/ntools-go/stringn v1.1.0 h1:wcV/1RAUxEX17CDBPs9HmgY+HFtTX0jJoM6n9Q4Nj70=
git.noahlan.cn/northlan/ntools-go/stringn v1.1.0/go.mod h1:71TA+fLLhTNGsZvX4Fd/YbV6UeYiliW5hxK+3a9wKko=
git.noahlan.cn/northlan/ntools-go/uuid v1.0.0 h1:C0PazSzG3+e/Hfh2C6Qf8R46sNZmZKTOcWS990yUmrE=
git.noahlan.cn/northlan/ntools-go/uuid v1.0.0/go.mod h1:qTbvG+IYjUYTjIOvo//P3KRBTJOSCt9Z3Sv2xnjlG0w=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=

@ -2,7 +2,7 @@ package main
import (
"dcg/config"
"dcg/game/live"
"dcg/game/live_logic"
"dcg/game/logic"
"dcg/game/msg_transfer"
"dcg/game/svc"
@ -25,7 +25,7 @@ func main() {
ctx := svc.NewServiceContext()
logic.Init(ctx)
live.InitLiveManager(ctx)
live_logic.InitLiveManager(ctx)
msg_transfer.Init(ctx)
msg_transfer.Run()

@ -11,7 +11,8 @@ type (
Arr []string // 具体CMD []string
}
Parser struct {
trie *ac.Trie
ac ac.AhoCorasick
distinct bool // 命令是否去重
allKeyArr []string
keywordMap map[string]struct{}
}
@ -19,8 +20,9 @@ type (
}
)
func NewCMDParser(keys []string) *Parser {
func NewCMDParser(distinct bool, keys ...string) *Parser {
p := &Parser{
distinct: distinct,
keywordMap: make(map[string]struct{}),
allKeyArr: make([]string, 0, len(keys)),
}
@ -28,23 +30,37 @@ func NewCMDParser(keys []string) *Parser {
p.keywordMap[keyword] = struct{}{}
p.allKeyArr = append(p.allKeyArr, keyword)
}
p.trie = ac.NewTrieBuilder().AddStrings(p.allKeyArr).Build()
builder := ac.NewAhoCorasickBuilder(ac.Opts{
AsciiCaseInsensitive: true,
MatchOnlyWholeWords: false,
MatchKind: ac.LeftMostLongestMatch,
DFA: true,
})
p.ac = builder.Build(p.allKeyArr)
return p
}
func (p *Parser) ParseTest(content string) {
p.trie.MatchString(content)
func (p *Parser) ParseTest(content string) []ac.Match {
return p.ac.FindAll(content)
}
// SetDistinct 设置命令去重
func (p *Parser) SetDistinct(distinct bool) {
p.distinct = distinct
}
// Parse 从弹幕内容解析命令
// distinct 是否去重
func (p *Parser) Parse(content string) *CMD {
// 移除多余空格,小写
tmpContent := strings.ToLower(strings.TrimSpace(content))
matches := p.trie.MatchString(tmpContent)
allKeyLen := 0
matchedKeys := make([]string, 0)
for _, match := range matches {
tmp := p.allKeyArr[match.Pattern()]
iter := p.ac.Iter(tmpContent)
for next := iter.Next(); next != nil; next = iter.Next() {
tmp := p.allKeyArr[next.Pattern()]
matchedKeys = append(matchedKeys, tmp)
allKeyLen += len(tmp)
}
@ -53,7 +69,7 @@ func (p *Parser) Parse(content string) *CMD {
// 避免同类型指令重复
arrMap := make(map[rune]struct{})
var matchedCmdArr []string
if isCMD {
if p.distinct && isCMD {
matchedCmdArr = make([]string, 0, len(matchedKeys))
for i := len(matchedKeys) - 1; i >= 0; i-- {
s := matchedKeys[i]
@ -64,8 +80,9 @@ func (p *Parser) Parse(content string) *CMD {
}
}
}
return &CMD{
IsCMD: isCMD,
Arr: matchedCmdArr,
resp := &CMD{IsCMD: isCMD, Arr: matchedKeys}
if p.distinct {
resp.Arr = matchedCmdArr
}
return resp
}

@ -37,6 +37,12 @@ func TestParse(t *testing.T) {
}
}
func TestA(t *testing.T) {
p := NewCMDParser([]string{"j", "j1", "j2", "j3"})
c := p.Parse("j2j2jjjjja")
fmt.Println(c)
}
func BenchmarkCmd(b *testing.B) {
p := NewCMDParser([]string{"j", "c1", "c2", "c3", "c4", "b1", "b2", "b3", "s", "b2", "b3", "w", "m1", "m2", "m3", "加入", "加入游戏"})
content := "jc2m2b1s"

Loading…
Cancel
Save