Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop

This commit is contained in:
sk 2024-09-21 11:10:45 +08:00
commit eaff0f1308
12 changed files with 862 additions and 752 deletions

View File

@ -73,9 +73,3 @@ const (
Zego_ForbidRTCStream = iota + 1
Zego_ResumeRTCStream = iota + 1
)
const (
ClawDollItemID = 40003
ClawDollGiveItemID = 74004
ClawDollCostItemCount = 2
)

View File

@ -84,7 +84,7 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data
if msg.Result == 1 {
logger.Logger.Tracef("上分成功snid = %v", msg.Snid)
playerEx.CostPlayCoin(2)
playerEx.CostPlayCoin()
sceneEx.playingSnid = p.SnId
@ -107,11 +107,12 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data
if msg.Result == 1 {
// 获得娃娃卡
playerEx.CatchCardClawdoll(1)
playerEx.CatchCardClawdoll()
playerEx.IsWin = true
logger.Logger.Tracef("下抓成功snid = %v", msg.Snid)
} else {
logger.Logger.Tracef("下抓失败snid = %v", msg.Snid)
playerEx.IsWin = false
}
logger.Logger.Tracef("ClawDoll StatePlayGame OnPlayerOp Grab response, SnId= %v", msg.Snid)

View File

@ -2,7 +2,6 @@ package clawdoll
import (
"mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/model"
"mongo.games.com/game/srvdata"
@ -15,6 +14,8 @@ type PlayerEx struct {
clawDollState int32 // 抓娃娃状态
dollCardsCnt int32 // 娃娃卡数量
IsWin bool // 是否抓到娃娃
winDollCardType int32 // 本局赢取娃娃的类型
gainCoin int64 // 本局赢的金币
taxCoin int64 // 本局税收
@ -29,6 +30,7 @@ func (this *PlayerEx) Clear(baseScore int32) {
this.gainCoin = 0
this.taxCoin = 0
this.odds = 0
this.IsWin = false
}
func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
@ -42,19 +44,31 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
// 能否投币
func (this *PlayerEx) CanPayCoin() bool {
itemID := int32(rule.ClawDollItemID)
itemCount := this.GetItemCount(itemID)
if itemCount < rule.ClawDollCostItemCount {
return false
}
itemID := int32(common.ItemIDClawdoll)
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
if itemData == nil {
return false
}
s := this.GetScene()
if s == nil {
logger.Logger.Warn("CostPlayCoin p.scene == nil")
return false
}
machineId := s.GetDBGameFree().GetId() % 6080000
machineInfo := s.GetMachineServerInfo(machineId, this.Platform)
if machineInfo == nil {
return false
}
itemCount := this.GetItemCount(itemID)
if itemCount < int64(machineInfo.CostItemNum) {
return false
}
num, ok := this.Items[itemID]
if !ok || num < 1 {
if !ok || num < int64(machineInfo.CostItemNum) {
return false
}
@ -62,22 +76,12 @@ func (this *PlayerEx) CanPayCoin() bool {
}
// 投币消耗
func (this *PlayerEx) CostPlayCoin(count int32) bool {
func (this *PlayerEx) CostPlayCoin() bool {
if !this.CanPayCoin() {
return false
}
var items []*model.Item
itemData := srvdata.GameItemMgr.Get(this.Platform, rule.ClawDollItemID)
if itemData != nil {
items = append(items, &model.Item{
ItemId: rule.ClawDollItemID,
ItemNum: int64(count),
})
}
s := this.GetScene()
if s == nil {
logger.Logger.Warn("CostPlayCoin p.scene == nil")
@ -89,6 +93,21 @@ func (this *PlayerEx) CostPlayCoin(count int32) bool {
return false
}
machineId := s.GetDBGameFree().GetId() % 6080000
machineInfo := s.GetMachineServerInfo(machineId, this.Platform)
if machineInfo == nil {
return false
}
var items []*model.Item
itemData := srvdata.GameItemMgr.Get(this.Platform, common.ItemIDClawdoll)
if itemData != nil {
items = append(items, &model.Item{
ItemId: common.ItemIDClawdoll,
ItemNum: int64(-machineInfo.CostItemNum),
})
}
this.AddItems(&model.AddItemParam{
P: this.PlayerData,
Change: items,
@ -103,16 +122,7 @@ func (this *PlayerEx) CostPlayCoin(count int32) bool {
}
// 抓取到娃娃获得娃娃
func (this *PlayerEx) CatchCardClawdoll(count int32) bool {
var items []*model.Item
itemData := srvdata.GameItemMgr.Get(this.Platform, rule.ClawDollGiveItemID)
if itemData != nil {
items = append(items, &model.Item{
ItemId: rule.ClawDollGiveItemID,
ItemNum: int64(count),
})
}
func (this *PlayerEx) CatchCardClawdoll() bool {
s := this.GetScene()
if s == nil {
@ -120,11 +130,26 @@ func (this *PlayerEx) CatchCardClawdoll(count int32) bool {
return false
}
machineId := s.GetDBGameFree().GetId() % 6080000
machineInfo := s.GetMachineServerInfo(machineId, this.Platform)
if machineInfo == nil {
return false
}
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
var items []*model.Item
itemData := srvdata.GameItemMgr.Get(this.Platform, machineInfo.ItemId)
if itemData != nil {
items = append(items, &model.Item{
ItemId: machineInfo.ItemId,
ItemNum: int64(machineInfo.ItemNum),
})
}
this.AddItems(&model.AddItemParam{
P: this.PlayerData,
Change: items,
@ -175,6 +200,7 @@ func (this *PlayerEx) ReStartGame() {
this.gainCoin = 0
this.taxCoin = 0
this.odds = 0
this.IsWin = false
}
// 初始化

View File

@ -3,6 +3,7 @@ package clawdoll
import (
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
"mongo.games.com/game/gamesrv/action"
"mongo.games.com/game/model"
"mongo.games.com/game/protocol/clawdoll"
"strconv"
"time"
@ -739,6 +740,70 @@ func (this *StateBilled) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, p
func (this *StateBilled) OnEnter(s *base.Scene) {
logger.Logger.Trace("(this *StateBilled) OnEnter, sceneid=", s.GetSceneId())
this.BaseState.OnEnter(s)
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return
}
playerEx := sceneEx.GetPlayingEx()
if playerEx != nil {
logger.Logger.Trace("ClawdollSaveLog Save Snid : ", playerEx.SnId)
machineId := s.GetDBGameFree().GetId() % 6080000
machineInfo := s.GetMachineServerInfo(machineId, playerEx.Platform)
if machineInfo == nil {
return
}
curClawdollItemNum, ok := playerEx.Items[int32(common.ItemIDClawdoll)]
if !ok {
return
}
LogBaseResult := model.ClawdollResultType{}
LogBaseResult.RoomId = int32(sceneEx.GetSceneId())
LogBaseResult.PlayerSnid = playerEx.SnId
LogBaseResult.BeforeClawdollItemNum = curClawdollItemNum + int64(machineInfo.CostItemNum)
LogBaseResult.AfterClawdollItemNum = curClawdollItemNum
LogBaseResult.IsWin = playerEx.IsWin
if !playerEx.IsRob {
sceneEx.logid, _ = model.AutoIncGameLogId()
info, err := model.MarshalGameNoteByHUNDRED(LogBaseResult)
if err == nil {
sceneEx.SaveGameDetailedLog(sceneEx.logid, info, &base.GameDetailedParam{})
}
TotalBetValue := 0
totalin := int64(TotalBetValue)
totalout := playerEx.gainCoin
validFlow := totalin + totalout
validBet := common.AbsI64(totalin - totalout)
logParam := &base.SaveGamePlayerListLogParam{
Platform: playerEx.Platform,
Channel: playerEx.Channel,
Promoter: playerEx.BeUnderAgentCode,
PackageTag: playerEx.PackageID,
InviterId: playerEx.InviterId,
LogId: sceneEx.logid,
TotalIn: totalin,
TotalOut: totalout,
TaxCoin: playerEx.taxCoin,
BetAmount: int64(TotalBetValue),
WinAmountNoAnyTax: playerEx.gainCoin,
ValidBet: validBet,
ValidFlow: validFlow,
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
IsFree: false,
WinSmallGame: 0,
WinTotal: 0,
}
sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam)
}
playerEx.ReStartGame()
}
}
func (this *StateBilled) OnLeave(s *base.Scene) {

View File

@ -5,9 +5,7 @@ import (
"fmt"
"net"
"os"
"os/signal"
"path/filepath"
"syscall"
"time"
"mongo.games.com/goserver/core/logger"
@ -165,7 +163,7 @@ func init() {
module.RegisteModule(MachineMgr, time.Second, 0)
}
func listenKeyboardEvents(conn net.Conn) {
/*func listenKeyboardEvents(conn net.Conn) {
for {
// 读取键盘事件
key := readKeyboardEvent()
@ -242,9 +240,9 @@ func listenKeyboardEvents(conn net.Conn) {
queryBaseParam(conn)
}
}
}
}*/
func readKeyboardEvent() string {
/*func readKeyboardEvent() string {
var b [1]byte
var done uint32
err := syscall.ReadFile(syscall.Stdin, b[:], &done, nil)
@ -253,9 +251,9 @@ func readKeyboardEvent() string {
}
return string(b[:])
}
}*/
func waitForUserExit() {
/*func waitForUserExit() {
// 创建一个信号通道
signalChan := make(chan os.Signal, 1)
@ -265,4 +263,4 @@ func waitForUserExit() {
// 等待用户按下 Ctrl+C 退出
<-signalChan
fmt.Println("退出程序...")
}
}*/

View File

@ -1679,3 +1679,13 @@ type SamLocPerson struct {
CardInfoEnd []int32 //结算时的牌型
IsTianHu bool //是否天胡
}
// 娃娃机 每局记录
type ClawdollResultType struct {
//all
RoomId int32 //房间Id
PlayerSnid int32 //玩家id
BeforeClawdollItemNum int64 //变化前娃娃币
AfterClawdollItemNum int64 //变化后娃娃币
IsWin bool //是否成功
}

View File

@ -38,8 +38,6 @@ const (
CLAWDOLLPacketID_PACKET_CS_WAITPLAYERS CLAWDOLLPacketID = 5611 // 获取等待玩家信息 (客户->服务)
CLAWDOLLPacketID_PACKET_SC_WAITPLAYERS CLAWDOLLPacketID = 5612 // 获取等待玩家信息 (服务->客户)
CLAWDOLLPacketID_PACKET_SC_PLAYINGINFO CLAWDOLLPacketID = 5613 // 正在控制娃娃机的玩家信息 (服务->客户)
CLAWDOLLPacketID_PACKET_CS_DollConfig CLAWDOLLPacketID = 5614 //获取娃娃机配置信息
CLAWDOLLPacketID_PACKET_SC_DollConfig CLAWDOLLPacketID = 5615 //返回娃娃机配置信息
)
// Enum value maps for CLAWDOLLPacketID.
@ -59,8 +57,6 @@ var (
5611: "PACKET_CS_WAITPLAYERS",
5612: "PACKET_SC_WAITPLAYERS",
5613: "PACKET_SC_PLAYINGINFO",
5614: "PACKET_CS_DollConfig",
5615: "PACKET_SC_DollConfig",
}
CLAWDOLLPacketID_value = map[string]int32{
"PACKET_ZERO": 0,
@ -77,8 +73,6 @@ var (
"PACKET_CS_WAITPLAYERS": 5611,
"PACKET_SC_WAITPLAYERS": 5612,
"PACKET_SC_PLAYINGINFO": 5613,
"PACKET_CS_DollConfig": 5614,
"PACKET_SC_DollConfig": 5615,
}
)
@ -1080,170 +1074,6 @@ func (x *CLAWDOLLPlayerDigestInfo) GetStat() int32 {
return 0
}
type CSCLAWDOLLConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *CSCLAWDOLLConfig) Reset() {
*x = CSCLAWDOLLConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CSCLAWDOLLConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CSCLAWDOLLConfig) ProtoMessage() {}
func (x *CSCLAWDOLLConfig) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[13]
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 CSCLAWDOLLConfig.ProtoReflect.Descriptor instead.
func (*CSCLAWDOLLConfig) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{13}
}
type SCCLAWDOLLConfig struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Info []*MachineInfo `protobuf:"bytes,1,rep,name=info,proto3" json:"info,omitempty"`
}
func (x *SCCLAWDOLLConfig) Reset() {
*x = SCCLAWDOLLConfig{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SCCLAWDOLLConfig) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SCCLAWDOLLConfig) ProtoMessage() {}
func (x *SCCLAWDOLLConfig) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[14]
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 SCCLAWDOLLConfig.ProtoReflect.Descriptor instead.
func (*SCCLAWDOLLConfig) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{14}
}
func (x *SCCLAWDOLLConfig) GetInfo() []*MachineInfo {
if x != nil {
return x.Info
}
return nil
}
type MachineInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
IconAddr string `protobuf:"bytes,1,opt,name=IconAddr,proto3" json:"IconAddr,omitempty"` //图片地址
CostItemNum int32 `protobuf:"varint,2,opt,name=CostItemNum,proto3" json:"CostItemNum,omitempty"` //消耗道具数量
ItemId int32 `protobuf:"varint,3,opt,name=ItemId,proto3" json:"ItemId,omitempty"` //获得道具ID
ItemNum int32 `protobuf:"varint,4,opt,name=ItemNum,proto3" json:"ItemNum,omitempty"` //获得道具数量
MachineId int32 `protobuf:"varint,5,opt,name=MachineId,proto3" json:"MachineId,omitempty"`
}
func (x *MachineInfo) Reset() {
*x = MachineInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_clawdoll_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MachineInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MachineInfo) ProtoMessage() {}
func (x *MachineInfo) ProtoReflect() protoreflect.Message {
mi := &file_clawdoll_proto_msgTypes[15]
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 MachineInfo.ProtoReflect.Descriptor instead.
func (*MachineInfo) Descriptor() ([]byte, []int) {
return file_clawdoll_proto_rawDescGZIP(), []int{15}
}
func (x *MachineInfo) GetIconAddr() string {
if x != nil {
return x.IconAddr
}
return ""
}
func (x *MachineInfo) GetCostItemNum() int32 {
if x != nil {
return x.CostItemNum
}
return 0
}
func (x *MachineInfo) GetItemId() int32 {
if x != nil {
return x.ItemId
}
return 0
}
func (x *MachineInfo) GetItemNum() int32 {
if x != nil {
return x.ItemNum
}
return 0
}
func (x *MachineInfo) GetMachineId() int32 {
if x != nil {
return x.MachineId
}
return 0
}
var File_clawdoll_proto protoreflect.FileDescriptor
var file_clawdoll_proto_rawDesc = []byte{
@ -1353,59 +1183,40 @@ var file_clawdoll_proto_rawDesc = []byte{
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c,
0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01,
0x28, 0x05, 0x52, 0x04, 0x53, 0x74, 0x61, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x43, 0x53, 0x43, 0x4c,
0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x3d, 0x0a, 0x10,
0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x12, 0x29, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e,
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x9b, 0x01, 0x0a, 0x0b,
0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x49,
0x63, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x49,
0x63, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x6f, 0x73, 0x74, 0x49,
0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x43, 0x6f,
0x73, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65,
0x6d, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01,
0x28, 0x05, 0x52, 0x07, 0x49, 0x74, 0x65, 0x6d, 0x4e, 0x75, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x4d,
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09,
0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x2a, 0xb3, 0x03, 0x0a, 0x10, 0x43, 0x4c,
0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f,
0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12,
0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f,
0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b,
0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2,
0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50,
0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54,
0x45, 0x10, 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x43, 0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12,
0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61,
0x79, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50,
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c,
0x65, 0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10,
0xe8, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f,
0x47, 0x45, 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50,
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b,
0x45, 0x4e, 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
0x43, 0x53, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb,
0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57,
0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a,
0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49,
0x4e, 0x47, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x10, 0xee, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
0x43, 0x5f, 0x44, 0x6f, 0x6c, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x10, 0xef, 0x2b, 0x2a,
0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10,
0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10,
0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f,
0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52,
0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79,
0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, 0x26, 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, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x28, 0x05, 0x52, 0x04, 0x53, 0x74, 0x61, 0x74, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41,
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a,
0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17,
0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d,
0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45,
0x54, 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b,
0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c,
0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43,
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45,
0x10, 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a,
0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79,
0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65,
0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8,
0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47,
0x45, 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41,
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45,
0x4e, 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43,
0x53, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b,
0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41,
0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15,
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e,
0x47, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43,
0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50,
0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50,
0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68,
0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c,
0x52, 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28,
0x5a, 0x26, 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,
0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1421,7 +1232,7 @@ func file_clawdoll_proto_rawDescGZIP() []byte {
}
var file_clawdoll_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_clawdoll_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_clawdoll_proto_goTypes = []interface{}{
(CLAWDOLLPacketID)(0), // 0: clawdoll.CLAWDOLLPacketID
(OpResultCode)(0), // 1: clawdoll.OpResultCode
@ -1438,21 +1249,17 @@ var file_clawdoll_proto_goTypes = []interface{}{
(*SCCLAWDOLLSendToken)(nil), // 12: clawdoll.SCCLAWDOLLSendToken
(*CLAWDOLLWaitPlayers)(nil), // 13: clawdoll.CLAWDOLLWaitPlayers
(*CLAWDOLLPlayerDigestInfo)(nil), // 14: clawdoll.CLAWDOLLPlayerDigestInfo
(*CSCLAWDOLLConfig)(nil), // 15: clawdoll.CSCLAWDOLLConfig
(*SCCLAWDOLLConfig)(nil), // 16: clawdoll.SCCLAWDOLLConfig
(*MachineInfo)(nil), // 17: clawdoll.MachineInfo
}
var file_clawdoll_proto_depIdxs = []int32{
2, // 0: clawdoll.SCCLAWDOLLRoomInfo.Players:type_name -> clawdoll.CLAWDOLLPlayerData
1, // 1: clawdoll.SCCLAWDOLLOp.OpRetCode:type_name -> clawdoll.OpResultCode
14, // 2: clawdoll.SCCLAWDOLLPlayerEnter.Data:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo
14, // 3: clawdoll.CLAWDOLLWaitPlayers.WaitPlayersInfo:type_name -> clawdoll.CLAWDOLLPlayerDigestInfo
17, // 4: clawdoll.SCCLAWDOLLConfig.info:type_name -> clawdoll.MachineInfo
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
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_clawdoll_proto_init() }
@ -1617,42 +1424,6 @@ func file_clawdoll_proto_init() {
return nil
}
}
file_clawdoll_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CSCLAWDOLLConfig); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_clawdoll_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SCCLAWDOLLConfig); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_clawdoll_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MachineInfo); 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{
@ -1660,7 +1431,7 @@ func file_clawdoll_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_clawdoll_proto_rawDesc,
NumEnums: 2,
NumMessages: 16,
NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -18,8 +18,6 @@ enum CLAWDOLLPacketID {
PACKET_CS_WAITPLAYERS = 5611; // ->
PACKET_SC_WAITPLAYERS = 5612; // ->
PACKET_SC_PLAYINGINFO = 5613; // ->
PACKET_CS_DollConfig = 5614; //
PACKET_SC_DollConfig = 5615; //
}
//
@ -133,16 +131,4 @@ message CLAWDOLLPlayerDigestInfo {
string HeadUrl = 3; //
string Name = 4; //
int32 Stat = 5; // 0 5:
}
message CSCLAWDOLLConfig{
}
message SCCLAWDOLLConfig{
repeated MachineInfo info =1;
}
message MachineInfo{
string IconAddr =1; //
int32 CostItemNum = 2; //
int32 ItemId = 3; //ID
int32 ItemNum = 4;//
int32 MachineId = 5;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -234,6 +234,8 @@ enum PlayerPacketID {
PACKET_SCDataConfig = 2843;//
PACKET_CSClawdollItemLog = 2844;//
PACKET_SCClawdollItemLog = 2845;//
PACKET_CSDollConfig = 2846; //
PACKET_SCDollConfig = 2847; //
}
//
@ -1390,4 +1392,15 @@ message ClawdollItemLogData{
int64 Time = 4; //
int32 LogType = 5; // 0. 1.
}
message CSCLAWDOLLConfig{
}
message SCCLAWDOLLConfig{
repeated MachineInfo Info =1;
}
message MachineInfo{
string IconAddr =1; //
int32 CostItemNum = 2; //
int32 ItemId = 3; //ID
int32 ItemNum = 4;//
int32 MachineId = 5;
}

View File

@ -8,7 +8,6 @@ import (
"fmt"
"io"
"math/rand"
"mongo.games.com/game/protocol/clawdoll"
"net/url"
"regexp"
"strconv"
@ -3170,6 +3169,25 @@ func CSClawdollItemLog(s *netlib.Session, packetId int, data interface{}, sid in
if p == nil {
return nil
}
var change []*model.Item
change = append(change, &model.Item{
ItemId: common.ItemIDClawdoll,
ItemNum: 3,
})
BagMgrSingleton.AddItemsV2(&model.AddItemParam{
P: p.PlayerData,
Change: change,
Add: 0,
GainWay: common.GainWayItemShopChangeDoll,
Operator: "system",
Remark: "商城兑换娃娃",
GameId: 0,
GameFreeId: 0,
NoLog: false,
})
msg, ok := data.(*player_proto.CSClawdollItemLog)
if !ok {
return nil
@ -3207,7 +3225,7 @@ func CSClawdollItemLog(s *netlib.Session, packetId int, data interface{}, sid in
func CSCLAWDOLLConfig(s *netlib.Session, packetId int, data interface{}, sid int64) error {
logger.Logger.Tracef("CSDollConfigHandler")
if _, ok := data.(*clawdoll.CSCLAWDOLLConfig); ok {
if _, ok := data.(*player_proto.CSCLAWDOLLConfig); ok {
p := PlayerMgrSington.GetPlayer(sid)
if p == nil {
logger.Logger.Warn("CSDollConfigHandler p == nil")
@ -3218,9 +3236,9 @@ func CSCLAWDOLLConfig(s *netlib.Session, packetId int, data interface{}, sid int
if machineInfo == nil {
return nil
}
pack := &clawdoll.SCCLAWDOLLConfig{}
pack := &player_proto.SCCLAWDOLLConfig{}
for _, value := range machineInfo.Info {
info := &clawdoll.MachineInfo{
info := &player_proto.MachineInfo{
IconAddr: value.IconAddr,
CostItemNum: value.CostItemNum,
ItemId: value.ItemId,
@ -3229,7 +3247,7 @@ func CSCLAWDOLLConfig(s *netlib.Session, packetId int, data interface{}, sid int
}
pack.Info = append(pack.Info, info)
}
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_DollConfig), pack)
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCDollConfig), pack)
}
return nil
}
@ -3269,5 +3287,5 @@ func init() {
//娃娃卡道具记录
common.Register(int(player_proto.PlayerPacketID_PACKET_CSClawdollItemLog), player_proto.CSClawdollItemLog{}, CSClawdollItemLog)
//客户端请求配置信息
common.Register(int(clawdoll.CLAWDOLLPacketID_PACKET_CS_DollConfig), clawdoll.CSCLAWDOLLConfig{}, CSCLAWDOLLConfig)
common.Register(int(player_proto.PlayerPacketID_PACKET_CSDollConfig), player_proto.CSCLAWDOLLConfig{}, CSCLAWDOLLConfig)
}

View File

@ -98,7 +98,7 @@ func init() {
// 竞技馆房间类型配置
etcd.Register(etcd.ETCDKEY_RoomType, webapi.RoomType{}, handlerEvent)
//娃娃机配置
etcd.Register(etcd.ETCDKEY_MACHINE, webapi.MachineConfig{}, handlerEvent)
etcd.Register(etcd.ETCDKEY_MACHINE, webapi.MachineConfig{}, platformConfigEvent)
}
func platformConfigEvent(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {