好友进房消耗检查

This commit is contained in:
sk 2024-09-11 16:26:05 +08:00
parent 1063cc8fba
commit d74c868947
4 changed files with 53 additions and 36 deletions

View File

@ -47,6 +47,7 @@ const (
OpResultCode_OPRC_InviteFriend_PosIsError OpResultCode = 1019 //座位不存在
OpResultCode_OPRC_InviteFriend_HadInRoom OpResultCode = 1020 //已在房间中
OpResultCode_OPRC_Friend_NotOpMyself OpResultCode = 1021 //不能操作自己
OpResultCode_OPRC_InviteFriend_CostNotEnough OpResultCode = 1022 // 房卡不足
)
// Enum value maps for OpResultCode.
@ -75,6 +76,7 @@ var (
1019: "OPRC_InviteFriend_PosIsError",
1020: "OPRC_InviteFriend_HadInRoom",
1021: "OPRC_Friend_NotOpMyself",
1022: "OPRC_InviteFriend_CostNotEnough",
}
OpResultCode_value = map[string]int32{
"OPRC_Sucess": 0,
@ -100,6 +102,7 @@ var (
"OPRC_InviteFriend_PosIsError": 1019,
"OPRC_InviteFriend_HadInRoom": 1020,
"OPRC_Friend_NotOpMyself": 1021,
"OPRC_InviteFriend_CostNotEnough": 1022,
}
)
@ -1726,7 +1729,7 @@ var file_friend_proto_rawDesc = []byte{
0x72, 0x69, 0x65, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52,
0x10, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x2a, 0xf3, 0x05, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f,
0x64, 0x2a, 0x99, 0x06, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f,
0x64, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73,
0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f,
0x72, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x14, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x46, 0x72, 0x69, 0x65,
@ -1773,41 +1776,43 @@ var file_friend_proto_rawDesc = []byte{
0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x48, 0x61, 0x64,
0x49, 0x6e, 0x52, 0x6f, 0x6f, 0x6d, 0x10, 0xfc, 0x07, 0x12, 0x1c, 0x0a, 0x17, 0x4f, 0x50, 0x52,
0x43, 0x5f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x4e, 0x6f, 0x74, 0x4f, 0x70, 0x4d, 0x79,
0x73, 0x65, 0x6c, 0x66, 0x10, 0xfd, 0x07, 0x2a, 0xe9, 0x03, 0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65,
0x6e, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b,
0x45, 0x54, 0x5f, 0x43, 0x53, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10,
0x8c, 0x15, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x46,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8d, 0x15, 0x12, 0x16, 0x0a, 0x11,
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f,
0x70, 0x10, 0x8e, 0x15, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x43, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x10, 0x8f, 0x15, 0x12, 0x20, 0x0a, 0x1b,
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6c,
0x61, 0x79, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x6f, 0x67, 0x10, 0x90, 0x15, 0x12, 0x20,
0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x51, 0x75, 0x65, 0x72, 0x79,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x6f, 0x67, 0x10, 0x91, 0x15,
0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x49, 0x6e, 0x76,
0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x92, 0x15, 0x12, 0x1a, 0x0a, 0x15,
0x73, 0x65, 0x6c, 0x66, 0x10, 0xfd, 0x07, 0x12, 0x24, 0x0a, 0x1f, 0x4f, 0x50, 0x52, 0x43, 0x5f,
0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f, 0x43, 0x6f, 0x73,
0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xfe, 0x07, 0x2a, 0xe9, 0x03,
0x0a, 0x0e, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44,
0x12, 0x1c, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x46, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x18,
0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x46, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x4c, 0x69, 0x73, 0x74, 0x10, 0x8c, 0x15, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b,
0x45, 0x54, 0x5f, 0x53, 0x43, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x10,
0x8d, 0x15, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x46,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x10, 0x8e, 0x15, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x10,
0x8f, 0x15, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x51,
0x75, 0x65, 0x72, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x4c, 0x6f,
0x67, 0x10, 0x90, 0x15, 0x12, 0x20, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x43, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65,
0x4c, 0x6f, 0x67, 0x10, 0x91, 0x15, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
0x5f, 0x43, 0x53, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10,
0x92, 0x15, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x49,
0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x93, 0x15, 0x12, 0x1c,
0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x49, 0x6e, 0x76, 0x69, 0x74,
0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x10, 0x94, 0x15, 0x12, 0x1c, 0x0a, 0x17,
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x93, 0x15, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b,
0x45, 0x54, 0x5f, 0x43, 0x53, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x4f, 0x70, 0x10, 0x94, 0x15, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
0x5f, 0x53, 0x43, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f,
0x70, 0x10, 0x95, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x43, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x44, 0x61, 0x74, 0x61,
0x10, 0x96, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x55, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61,
0x10, 0x97, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53,
0x46, 0x75, 0x7a, 0x7a, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x10, 0x98, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x46, 0x75, 0x7a, 0x7a, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72,
0x10, 0x99, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x64, 0x64, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64,
0x10, 0x9a, 0x15, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d,
0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x72, 0x69, 0x65, 0x6e, 0x64, 0x4f, 0x70, 0x10, 0x95, 0x15, 0x12, 0x1d, 0x0a, 0x18, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x41, 0x70, 0x70,
0x6c, 0x79, 0x44, 0x61, 0x74, 0x61, 0x10, 0x96, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x55, 0x6e, 0x72, 0x65,
0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x10, 0x97, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x46, 0x75, 0x7a, 0x7a, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x98, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x46, 0x75, 0x7a, 0x7a, 0x79, 0x51, 0x75, 0x65, 0x72, 0x79,
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x10, 0x99, 0x15, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x41, 0x64, 0x64,
0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x10, 0x9a, 0x15, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e,
0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d,
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e,
0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -27,6 +27,7 @@ enum OpResultCode {
OPRC_InviteFriend_PosIsError = 1019; //
OPRC_InviteFriend_HadInRoom = 1020; //
OPRC_Friend_NotOpMyself = 1021; //
OPRC_InviteFriend_CostNotEnough = 1022; //
}
//id

View File

@ -910,7 +910,7 @@ type CustomParam struct {
RoomTypeId int32 `protobuf:"varint,1,opt,name=RoomTypeId,proto3" json:"RoomTypeId,omitempty"` // 房间类型id
RoomConfigId int32 `protobuf:"varint,2,opt,name=RoomConfigId,proto3" json:"RoomConfigId,omitempty"` // 房间配置id
CostType int32 `protobuf:"varint,3,opt,name=CostType,proto3" json:"CostType,omitempty"` // 房卡场付费方式 1AA 2
CostType int32 `protobuf:"varint,3,opt,name=CostType,proto3" json:"CostType,omitempty"` // 房卡场付费方式 1AA 2房主
Password string `protobuf:"bytes,4,opt,name=Password,proto3" json:"Password,omitempty"` // 房间密码
Voice int32 `protobuf:"varint,5,opt,name=Voice,proto3" json:"Voice,omitempty"` // 是否开启语音 1开启 2关闭
}

View File

@ -501,6 +501,17 @@ func (this *CSInviteFriendOpHandler) Process(s *netlib.Session, packetid int, da
}
}
// 房费是否充足
if scene.IsCustom() {
cfg := PlatformMgrSingleton.GetConfig(p.Platform).RoomConfig[scene.RoomConfigId]
if scene.CostType == 1 && !scene.sp.CostEnough(int(scene.CostType), scene.playerNum, cfg, p) {
logger.Logger.Trace("CSInviteFriendHandler cost error")
opRetCode = friend.OpResultCode_OPRC_InviteFriend_CostNotEnough
send(p)
return nil
}
}
sp := GetScenePolicy(scene.gameId, scene.gameMode)
if sp == nil {
logger.Logger.Warn("CSInviteFriendHandler game not exist")