Merge remote-tracking branch 'origin/develop' into dev_slots
# Conflicts: # public
This commit is contained in:
commit
94794a4e7c
|
@ -1,3 +0,0 @@
|
||||||
[submodule "public"]
|
|
||||||
path = public
|
|
||||||
url = git@git.pogorockgames.com:mango-games/server/public.git
|
|
21
README.md
21
README.md
|
@ -2,27 +2,6 @@
|
||||||
|
|
||||||
游戏业务代码
|
游戏业务代码
|
||||||
|
|
||||||
### 子仓库
|
|
||||||
public子仓库本项目本身并没有使用,只是用来暴露部分公共代码,供其他项目使用。
|
|
||||||
例如:
|
|
||||||
1.客户端同步通信协议
|
|
||||||
2.客户端同步游戏配置
|
|
||||||
|
|
||||||
#### 初始化子仓库
|
|
||||||
```
|
|
||||||
git submodule update --init --recursive
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 更新子仓库
|
|
||||||
```
|
|
||||||
git submodule update --remote
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 更新并提交子仓库代码
|
|
||||||
```
|
|
||||||
update_public.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 脚本
|
### 脚本
|
||||||
#### gen_data.bat
|
#### gen_data.bat
|
||||||
xlsx文件转换为json,dat文件,生成pbdata.proto,生成srvdata包
|
xlsx文件转换为json,dat文件,生成pbdata.proto,生成srvdata包
|
||||||
|
|
|
@ -316,6 +316,7 @@ const (
|
||||||
GainWayVipGift9 = 105 //vip等级礼包
|
GainWayVipGift9 = 105 //vip等级礼包
|
||||||
GainWayRoomCost = 106 //房费消耗
|
GainWayRoomCost = 106 //房费消耗
|
||||||
GainWayRoomGain = 107 //房卡场获得
|
GainWayRoomGain = 107 //房卡场获得
|
||||||
|
GainWayItemShop = 108 // 交易市场道具交易
|
||||||
)
|
)
|
||||||
|
|
||||||
// 后台选择 金币变化类型 的充值 类型id号起始
|
// 后台选择 金币变化类型 的充值 类型id号起始
|
||||||
|
|
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -71,3 +71,7 @@ const (
|
||||||
Zego_ForbidRTCStream = iota + 1
|
Zego_ForbidRTCStream = iota + 1
|
||||||
Zego_ResumeRTCStream = iota + 1
|
Zego_ResumeRTCStream = iota + 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ClawDoorItemID = 40003
|
||||||
|
)
|
||||||
|
|
|
@ -13,43 +13,6 @@ import (
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CSDestroyRoomPacketFactory struct {
|
|
||||||
}
|
|
||||||
type CSDestroyRoomHandler struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *CSDestroyRoomPacketFactory) CreatePacket() interface{} {
|
|
||||||
pack := &gamehall.CSDestroyRoom{}
|
|
||||||
return pack
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *CSDestroyRoomHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
|
||||||
logger.Logger.Trace("CSDestroyRoomHandler Process recv ", data)
|
|
||||||
p := base.PlayerMgrSington.GetPlayer(sid)
|
|
||||||
if p == nil {
|
|
||||||
logger.Logger.Warn("CSDestroyRoomHandler p == nil")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
scene := p.GetScene()
|
|
||||||
if scene == nil {
|
|
||||||
logger.Logger.Warn("CSDestroyRoomHandler p.GetScene() == nil")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if !scene.HasPlayer(p) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if scene.Creator != p.SnId {
|
|
||||||
logger.Logger.Warn("CSDestroyRoomHandler s.creator != p.AccountId")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
// 房卡场开始后不能解散
|
|
||||||
if scene.IsCustom() && scene.NumOfGames > 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
scene.Destroy(true)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type CSLeaveRoomPacketFactory struct {
|
type CSLeaveRoomPacketFactory struct {
|
||||||
}
|
}
|
||||||
type CSLeaveRoomHandler struct {
|
type CSLeaveRoomHandler struct {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package clawdoll
|
package clawdoll
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/clawdoll"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/protocol/clawdoll"
|
"mongo.games.com/game/protocol/clawdoll"
|
||||||
"mongo.games.com/game/protocol/machine"
|
"mongo.games.com/game/protocol/machine"
|
||||||
|
@ -52,10 +54,20 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf
|
||||||
func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error {
|
func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!")
|
logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!")
|
||||||
if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok {
|
if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok {
|
||||||
|
|
||||||
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid())
|
||||||
if p == nil {
|
if p == nil {
|
||||||
logger.Logger.Warn("CSGetTokenHandler p == nil")
|
logger.Logger.Warn("MSDollMachineoCoinResultHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
s := p.GetScene()
|
||||||
|
if s == nil {
|
||||||
|
logger.Logger.Warn("MSDollMachineoCoinResultHandler p.scene == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
sceneEx, ok := s.ExtraData.(*SceneEx)
|
||||||
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +80,17 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
if msg.Result == 1 {
|
if msg.Result == 1 {
|
||||||
|
// 获得娃娃卡
|
||||||
|
logger.Logger.Tracef("下抓成功!!!!!!!!!!!!snid = ", msg.Snid)
|
||||||
} else {
|
} else {
|
||||||
logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid)
|
logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.ChangeSceneState(rule.ClawDollSceneStateBilled)
|
||||||
|
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled))
|
||||||
|
|
||||||
|
ClawdollBroadcastRoomState(s)
|
||||||
|
ClawdollSendPlayerInfo(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -97,8 +116,6 @@ func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interf
|
||||||
logger.Logger.Warn("CSGetTokenHandler p == nil")
|
logger.Logger.Warn("CSGetTokenHandler p == nil")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
pack := &machine.SMGetToken{}
|
|
||||||
pack.Snid = p.SnId
|
|
||||||
|
|
||||||
scene := p.GetScene()
|
scene := p.GetScene()
|
||||||
if scene == nil {
|
if scene == nil {
|
||||||
|
@ -112,16 +129,27 @@ func (h *CSGetTokenHandler) Process(s *netlib.Session, packetid int, data interf
|
||||||
machineId := scene.GetDBGameFree().GetId() % 6080000
|
machineId := scene.GetDBGameFree().GetId() % 6080000
|
||||||
machineInfo := sceneEx.GetMachineServerInfo(machineId, p.Platform)
|
machineInfo := sceneEx.GetMachineServerInfo(machineId, p.Platform)
|
||||||
if machineInfo == nil {
|
if machineInfo == nil {
|
||||||
|
logger.Logger.Warn("CSGetTokenHandler machineId = %v not found", machineId)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v", machineInfo.AppId, machineInfo.ServerSecret, machineInfo.StreamId)
|
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v", machineInfo.AppId, machineInfo.ServerSecret, machineInfo.StreamId)
|
||||||
|
|
||||||
pack.ServerSecret = machineInfo.ServerSecret
|
//生成token
|
||||||
pack.AppId = machineInfo.AppId
|
token, err := token04.GenerateToken04(uint32(machineInfo.AppId), string(p.SnId), machineInfo.ServerSecret, 7200, "")
|
||||||
pack.StreamId = machineInfo.StreamId
|
if err != nil {
|
||||||
|
logger.Logger.Error(err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
logger.Logger.Trace(token)
|
||||||
|
|
||||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack)
|
pack := &clawdoll.SCCLAWDOLLSendToken{
|
||||||
|
LogicId: scene.DBGameFree.GetId(),
|
||||||
|
Appid: machineInfo.AppId,
|
||||||
|
Token: token,
|
||||||
|
StreamId: machineInfo.StreamId,
|
||||||
|
}
|
||||||
|
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_SENDTOKEN), pack)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package clawdoll
|
package clawdoll
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
rule "mongo.games.com/game/gamerule/clawdoll"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/srvdata"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,11 +39,18 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
|
||||||
|
|
||||||
// 能否投币
|
// 能否投币
|
||||||
func (this *PlayerEx) CanPayCoin() bool {
|
func (this *PlayerEx) CanPayCoin() bool {
|
||||||
|
|
||||||
|
itemID := int32(rule.ClawDoorItemID)
|
||||||
|
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
|
||||||
|
if itemData == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 投币消耗
|
// 投币消耗
|
||||||
func (this *PlayerEx) CostPlayCoin() bool {
|
func (this *PlayerEx) CostPlayCoin(count int32) bool {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -106,3 +115,16 @@ func (this *PlayerEx) GetClawState() int32 {
|
||||||
func (this *PlayerEx) SetClawState(state int32) {
|
func (this *PlayerEx) SetClawState(state int32) {
|
||||||
this.clawDollState = state
|
this.clawDollState = state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *PlayerEx) GetItemCount(itemID int32) int64 {
|
||||||
|
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
|
||||||
|
if itemData != nil {
|
||||||
|
v, ok := this.Items[itemID]
|
||||||
|
if ok {
|
||||||
|
return v
|
||||||
|
} else {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package clawdoll
|
package clawdoll
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
|
||||||
"mongo.games.com/game/gamesrv/action"
|
"mongo.games.com/game/gamesrv/action"
|
||||||
"mongo.games.com/game/protocol/clawdoll"
|
"mongo.games.com/game/protocol/clawdoll"
|
||||||
"mongo.games.com/game/protocol/machine"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core"
|
"mongo.games.com/goserver/core"
|
||||||
|
@ -279,21 +279,31 @@ func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sce
|
||||||
logger.Logger.Warn("ClawdollGetVideoToken p == nil")
|
logger.Logger.Warn("ClawdollGetVideoToken p == nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
pack := &machine.SMGetToken{}
|
|
||||||
pack.Snid = p.SnId
|
|
||||||
|
|
||||||
machineId := s.DBGameFree.GetId() % 6080000
|
machineId := s.DBGameFree.GetId() % 6080000
|
||||||
machineinfo := sceneEx.GetMachineServerInfo(machineId, p.Platform)
|
machineinfo := sceneEx.GetMachineServerInfo(machineId, p.Platform)
|
||||||
if machineinfo == nil {
|
if machineinfo == nil {
|
||||||
|
logger.Logger.Warn("CSGetTokenHandler machineId = %v not found", machineId)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v", machineinfo.AppId, machineinfo.ServerSecret, machineinfo.StreamId)
|
logger.Logger.Tracef("获取娃娃机 appId = %v, serverSecret = %v, streamId = %v", machineinfo.AppId, machineinfo.ServerSecret, machineinfo.StreamId)
|
||||||
|
|
||||||
pack.ServerSecret = machineinfo.ServerSecret
|
//生成token
|
||||||
pack.AppId = machineinfo.AppId
|
token, err := token04.GenerateToken04(uint32(machineinfo.AppId), string(p.SnId), machineinfo.ServerSecret, 3600, "")
|
||||||
pack.StreamId = machineinfo.StreamId
|
if err != nil {
|
||||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMGetToken), pack)
|
logger.Logger.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace(token)
|
||||||
|
|
||||||
|
pack := &clawdoll.SCCLAWDOLLSendToken{
|
||||||
|
LogicId: s.DBGameFree.GetId(),
|
||||||
|
Appid: machineinfo.AppId,
|
||||||
|
Token: token,
|
||||||
|
StreamId: machineinfo.StreamId,
|
||||||
|
}
|
||||||
|
p.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_SENDTOKEN), pack)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 广播房间状态
|
// 广播房间状态
|
||||||
|
@ -667,12 +677,6 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
|
||||||
//1-弱力抓 2 -强力抓
|
//1-弱力抓 2 -强力抓
|
||||||
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType)
|
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType)
|
||||||
|
|
||||||
s.ChangeSceneState(rule.ClawDollSceneStateBilled)
|
|
||||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled))
|
|
||||||
|
|
||||||
ClawdollBroadcastRoomState(s)
|
|
||||||
ClawdollSendPlayerInfo(s)
|
|
||||||
|
|
||||||
case rule.ClawDollPlayerOpMove:
|
case rule.ClawDollPlayerOpMove:
|
||||||
|
|
||||||
if !sceneEx.CheckMoveOp(playerEx) {
|
if !sceneEx.CheckMoveOp(playerEx) {
|
||||||
|
@ -700,14 +704,9 @@ func (this *PlayGame) OnTick(s *base.Scene) {
|
||||||
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout {
|
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout {
|
||||||
|
|
||||||
if sceneEx.TimeOutPlayGrab() {
|
if sceneEx.TimeOutPlayGrab() {
|
||||||
//logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId)
|
logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.ChangeSceneState(rule.ClawDollSceneStateBilled)
|
|
||||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled))
|
|
||||||
|
|
||||||
ClawdollBroadcastRoomState(s)
|
|
||||||
ClawdollSendPlayerInfo(s)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,9 @@ func (this *ScenePolicyTienLen) OnPlayerLeave(s *base.Scene, p *base.Player, rea
|
||||||
}
|
}
|
||||||
sceneEx.OnPlayerLeave(p, reason)
|
sceneEx.OnPlayerLeave(p, reason)
|
||||||
s.FirePlayerEvent(p, base.PlayerEventLeave, []int64{int64(reason)})
|
s.FirePlayerEvent(p, base.PlayerEventLeave, []int64{int64(reason)})
|
||||||
|
if s.IsCustom() && len(s.Players) == 0 {
|
||||||
|
s.Destroy(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 玩家掉线
|
// 玩家掉线
|
||||||
|
@ -603,9 +606,6 @@ func (this *SceneBaseStateTienLen) OnTick(s *base.Scene) {
|
||||||
s.RandRobotCnt()
|
s.RandRobotCnt()
|
||||||
s.SetTimerRandomRobot(s.GetRobotTime())
|
s.SetTimerRandomRobot(s.GetRobotTime())
|
||||||
}
|
}
|
||||||
if s.IsCustom() && len(s.Players) == 0 {
|
|
||||||
s.Destroy(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送玩家操作情况
|
// 发送玩家操作情况
|
||||||
|
|
|
@ -106,7 +106,7 @@ func init() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pack.Tag = webapiproto.TagCode_FAILED
|
pack.Tag = webapiproto.TagCode_FAILED
|
||||||
pack.Msg = "数据序列化失败"
|
pack.Msg = "数据序列化失败"
|
||||||
return common.ResponseTag_ParamError, pack
|
return common.ResponseTag_Ok, pack
|
||||||
}
|
}
|
||||||
pack.Tag = webapiproto.TagCode_SUCCESS
|
pack.Tag = webapiproto.TagCode_SUCCESS
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ func init() {
|
||||||
if scene == nil || scene.ExtraData == nil {
|
if scene == nil || scene.ExtraData == nil {
|
||||||
pack.Tag = webapiproto.TagCode_NotFound
|
pack.Tag = webapiproto.TagCode_NotFound
|
||||||
pack.Msg = "房间没找到"
|
pack.Msg = "房间没找到"
|
||||||
return common.ResponseTag_NoFindRoom, pack
|
return common.ResponseTag_Ok, pack
|
||||||
}
|
}
|
||||||
|
|
||||||
switch d := scene.ExtraData.(type) {
|
switch d := scene.ExtraData.(type) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/netlib"
|
"mongo.games.com/goserver/core/netlib"
|
||||||
"mongo.games.com/goserver/core/timer"
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -194,13 +195,13 @@ func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid
|
||||||
//fmt.Println("Failed to read response from server:", err)
|
//fmt.Println("Failed to read response from server:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
fmt.Println("没有抓到礼品!!!!!!!!snid = ", snid, "num = ", num)
|
||||||
|
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
||||||
Snid: snid,
|
Snid: snid,
|
||||||
Id: id,
|
Id: id,
|
||||||
Result: 0,
|
Result: 0,
|
||||||
TypeId: 2,
|
TypeId: 2,
|
||||||
})
|
})
|
||||||
logger.Logger.Trace("没有抓到礼品!!!!!!!!snid = ", snid, "num = ", num)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if bytes.Contains(part, instruction1) && num != 1 {
|
if bytes.Contains(part, instruction1) && num != 1 {
|
||||||
|
@ -208,39 +209,41 @@ func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid
|
||||||
//回应数据
|
//回应数据
|
||||||
_, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd})
|
_, err = conn.Write([]byte{0xAA, 0x04, 0x01, 0x50, 0x09, 0x5c, 0xdd})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Error("Failed to read response from server:", err)
|
fmt.Println("Failed to read response from server:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
fmt.Println("抓到礼品了!!!!!!!!snid = ", snid, "num = ", num)
|
||||||
|
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
||||||
Snid: snid,
|
Snid: snid,
|
||||||
Id: id,
|
Id: id,
|
||||||
Result: 1,
|
Result: 1,
|
||||||
TypeId: 2,
|
TypeId: 2,
|
||||||
})
|
})
|
||||||
logger.Logger.Trace("抓到礼品了!!!!!!!!snid = ", snid, "num = ", num)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//上分成功
|
//上分成功
|
||||||
coinData := []byte{0xAA, 0x04, 0x02, 0x03, 0x01}
|
coinData := []byte{0xAA, 0x04, 0x02, 0x03, 0x01}
|
||||||
if bytes.Contains(part, coinData) {
|
if bytes.Contains(part, coinData) {
|
||||||
//返回消息
|
//返回消息
|
||||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
||||||
Snid: snid,
|
Snid: snid,
|
||||||
Id: id,
|
Id: id,
|
||||||
Result: 1,
|
Result: 1,
|
||||||
TypeId: 1,
|
TypeId: 1,
|
||||||
})
|
})
|
||||||
|
fmt.Println("上分成功!!!!!!!!!!snid = ", snid, "num = ", num)
|
||||||
}
|
}
|
||||||
//上分失败
|
//上分失败
|
||||||
coinData = []byte{0xAA, 0x04, 0x02, 0x03, 0x00}
|
coinData = []byte{0xAA, 0x04, 0x02, 0x03, 0x00}
|
||||||
if bytes.Contains(part, coinData) {
|
if bytes.Contains(part, coinData) {
|
||||||
//返回消息
|
//返回消息
|
||||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
machinedoll.SendToGameServer(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
||||||
Snid: snid,
|
Snid: snid,
|
||||||
Id: id,
|
Id: id,
|
||||||
Result: 0,
|
Result: 0,
|
||||||
TypeId: 1,
|
TypeId: 1,
|
||||||
})
|
})
|
||||||
|
fmt.Println("上分失败!!!!!!!!!!snid = ", snid, "num = ", num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +256,7 @@ func DollMachineGrabResult(session *netlib.Session, conn *machinedoll.Conn, snid
|
||||||
|
|
||||||
// 与游戏服务器连接成功,向游戏服务器推送所有娃娃机连接
|
// 与游戏服务器连接成功,向游戏服务器推送所有娃娃机连接
|
||||||
func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interface{}) error {
|
func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
logger.Logger.Trace("与游戏服务器连接成功")
|
fmt.Println("与游戏服务器连接成功")
|
||||||
//开始向游戏服务器发送娃娃机连接信息
|
//开始向游戏服务器发送娃娃机连接信息
|
||||||
msg := &machine.MSDollMachineList{}
|
msg := &machine.MSDollMachineList{}
|
||||||
for i, _ := range machinedoll.MachineMgr.ConnMap {
|
for i, _ := range machinedoll.MachineMgr.ConnMap {
|
||||||
|
@ -262,7 +265,7 @@ func SMGameLinkSucceedHandler(session *netlib.Session, packetId int, data interf
|
||||||
msg.Data = append(msg.Data, info)
|
msg.Data = append(msg.Data, info)
|
||||||
}
|
}
|
||||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
|
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineList), msg)
|
||||||
logger.Logger.Tracef("向游戏服务器发送娃娃机连接信息:%v", msg)
|
fmt.Println("向游戏服务器发送娃娃机连接信息:%v", msg)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +293,7 @@ func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{})
|
||||||
var payload string = ""
|
var payload string = ""
|
||||||
|
|
||||||
//生成token
|
//生成token
|
||||||
token, err := token04.GenerateToken04(appId, string(userId), serverSecret, effectiveTimeInSeconds, payload)
|
token, err := token04.GenerateToken04(appId, strconv.Itoa(int(userId)), serverSecret, effectiveTimeInSeconds, payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Error(err)
|
logger.Logger.Error(err)
|
||||||
return err
|
return err
|
||||||
|
@ -303,7 +306,7 @@ func SMGetTokenHandler(session *netlib.Session, packetId int, data interface{})
|
||||||
info.StreamId = msg.StreamId
|
info.StreamId = msg.StreamId
|
||||||
|
|
||||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info)
|
session.Send(int(machine.DollMachinePacketID_PACKET_MSSendToken), info)
|
||||||
logger.Logger.Tracef("向游戏服务器发送娃娃机token:%v", info)
|
fmt.Println("向游戏服务器发送娃娃机token:%v", info)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,9 +152,7 @@ func (this *MachineManager) UpdateToGameServer(conn *Conn, status int32) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendToGameServer(pid int, msg interface{}) {
|
func SendToGameServer(pid int, msg interface{}) {
|
||||||
if GameConn == nil {
|
GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 777)
|
||||||
GameConn = srvlib.ServerSessionMgrSington.GetSession(1, 7, 701)
|
|
||||||
}
|
|
||||||
if GameConn != nil {
|
if GameConn != nil {
|
||||||
GameConn.Send(pid, msg)
|
GameConn.Send(pid, msg)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"mongo.games.com/game/protocol/gamehall"
|
"slices"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
"mongo.games.com/game/protocol/shop"
|
"mongo.games.com/game/protocol/shop"
|
||||||
"mongo.games.com/game/protocol/webapi"
|
"mongo.games.com/game/protocol/webapi"
|
||||||
)
|
)
|
||||||
|
@ -76,7 +77,7 @@ func (this *ShopInfo) GetItems() []ItemInfo {
|
||||||
if this.ItemId > 0 {
|
if this.ItemId > 0 {
|
||||||
ret = append(ret, ItemInfo{
|
ret = append(ret, ItemInfo{
|
||||||
ItemId: this.ItemId,
|
ItemId: this.ItemId,
|
||||||
ItemNum: this.Amount,
|
ItemNum: this.AmountFinal,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, v := range this.AddItemInfo {
|
for _, v := range this.AddItemInfo {
|
||||||
|
@ -405,7 +406,19 @@ func (cm *ConfigMgr) UpdateRoomConfig(data *webapi.RoomConfig) {
|
||||||
if d == nil {
|
if d == nil {
|
||||||
d = make([]*webapi.RoomConfig, 0)
|
d = make([]*webapi.RoomConfig, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has := false
|
||||||
|
for k, v := range d {
|
||||||
|
if v.GetId() == data.GetId() {
|
||||||
|
d[k] = data
|
||||||
|
has = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !has {
|
||||||
d = append(d, data)
|
d = append(d, data)
|
||||||
|
}
|
||||||
|
|
||||||
cm.GetConfig(data.GetPlatform()).RoomTypeMap[data.GetRoomType()] = d
|
cm.GetConfig(data.GetPlatform()).RoomTypeMap[data.GetRoomType()] = d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,19 +426,18 @@ func (cm *ConfigMgr) DelRoomConfig(plt string, id int32) {
|
||||||
d := cm.GetConfig(plt).RoomConfig[id]
|
d := cm.GetConfig(plt).RoomConfig[id]
|
||||||
if d != nil {
|
if d != nil {
|
||||||
b := cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()]
|
b := cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()]
|
||||||
if b != nil {
|
|
||||||
for i, v := range b {
|
for i, v := range b {
|
||||||
if v.GetId() == id {
|
if v.GetId() == id {
|
||||||
b = append(b[:i], b[i+1:]...)
|
b = append(b[:i], b[i+1:]...)
|
||||||
cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()] = b
|
cm.GetConfig(plt).RoomTypeMap[d.GetRoomType()] = b
|
||||||
}
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete(cm.GetConfig(plt).RoomConfig, id)
|
delete(cm.GetConfig(plt).RoomConfig, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cm *ConfigMgr) GetRoomConfig(plt string) *gamehall.SCRoomConfig {
|
func (cm *ConfigMgr) GetRoomConfig(plt string, lastChannel string) *gamehall.SCRoomConfig {
|
||||||
pack := &gamehall.SCRoomConfig{}
|
pack := &gamehall.SCRoomConfig{}
|
||||||
for _, v := range cm.GetConfig(plt).RoomType {
|
for _, v := range cm.GetConfig(plt).RoomType {
|
||||||
if v.GetOn() != common.On {
|
if v.GetOn() != common.On {
|
||||||
|
@ -436,6 +448,10 @@ func (cm *ConfigMgr) GetRoomConfig(plt string) *gamehall.SCRoomConfig {
|
||||||
if vv.GetOn() != common.On {
|
if vv.GetOn() != common.On {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if lastChannel != "" && !slices.Contains(vv.GetOnChannelName(), lastChannel) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var cost, reward []*gamehall.ItemInfo
|
var cost, reward []*gamehall.ItemInfo
|
||||||
for _, item := range vv.GetCost() {
|
for _, item := range vv.GetCost() {
|
||||||
cost = append(cost, &gamehall.ItemInfo{
|
cost = append(cost, &gamehall.ItemInfo{
|
||||||
|
|
|
@ -885,6 +885,7 @@ type SCCLAWDOLLSendToken struct {
|
||||||
Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
|
Appid int64 `protobuf:"varint,2,opt,name=Appid,proto3" json:"Appid,omitempty"`
|
||||||
Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"`
|
Token string `protobuf:"bytes,3,opt,name=Token,proto3" json:"Token,omitempty"`
|
||||||
StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"`
|
StreamId string `protobuf:"bytes,4,opt,name=StreamId,proto3" json:"StreamId,omitempty"`
|
||||||
|
AppSign string `protobuf:"bytes,5,opt,name=AppSign,proto3" json:"AppSign,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SCCLAWDOLLSendToken) Reset() {
|
func (x *SCCLAWDOLLSendToken) Reset() {
|
||||||
|
@ -947,6 +948,13 @@ func (x *SCCLAWDOLLSendToken) GetStreamId() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *SCCLAWDOLLSendToken) GetAppSign() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.AppSign
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type CLAWDOLLWaitPlayers struct {
|
type CLAWDOLLWaitPlayers struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -1161,62 +1169,64 @@ var file_clawdoll_proto_rawDesc = []byte{
|
||||||
0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49,
|
0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49,
|
||||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x22, 0x14, 0x0a,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x22, 0x14, 0x0a,
|
||||||
0x12, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x47, 0x65, 0x74, 0x54, 0x6f,
|
0x12, 0x43, 0x53, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x47, 0x65, 0x74, 0x54, 0x6f,
|
||||||
0x6b, 0x65, 0x6e, 0x22, 0x77, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c,
|
0x6b, 0x65, 0x6e, 0x22, 0x91, 0x01, 0x0a, 0x13, 0x53, 0x43, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f,
|
||||||
0x4c, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4c, 0x6f,
|
0x4c, 0x4c, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x4c,
|
||||||
0x67, 0x69, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4c, 0x6f, 0x67,
|
0x6f, 0x67, 0x69, 0x63, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x4c, 0x6f,
|
||||||
0x69, 0x63, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20,
|
0x67, 0x69, 0x63, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02,
|
||||||
0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x41, 0x70, 0x70, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54,
|
||||||
0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65,
|
||||||
0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01,
|
0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x18, 0x04, 0x20,
|
||||||
0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x63, 0x0a, 0x13,
|
0x01, 0x28, 0x09, 0x52, 0x08, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x18, 0x0a,
|
||||||
0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79,
|
0x07, 0x41, 0x70, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||||
0x65, 0x72, 0x73, 0x12, 0x4c, 0x0a, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65,
|
0x41, 0x70, 0x70, 0x53, 0x69, 0x67, 0x6e, 0x22, 0x63, 0x0a, 0x13, 0x43, 0x4c, 0x41, 0x57, 0x44,
|
||||||
0x72, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63,
|
0x4f, 0x4c, 0x4c, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x12, 0x4c,
|
||||||
0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
|
0x0a, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66,
|
||||||
0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f,
|
0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f,
|
||||||
0x52, 0x0f, 0x57, 0x61, 0x69, 0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66,
|
0x6c, 0x6c, 0x2e, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65,
|
||||||
0x6f, 0x22, 0x84, 0x01, 0x0a, 0x18, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c,
|
0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0f, 0x57, 0x61, 0x69,
|
||||||
0x61, 0x79, 0x65, 0x72, 0x44, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12,
|
0x74, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x84, 0x01, 0x0a,
|
||||||
0x0a, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e,
|
0x18, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44,
|
||||||
0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
|
0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x49,
|
||||||
0x52, 0x04, 0x48, 0x65, 0x61, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a,
|
||||||
0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c,
|
0x04, 0x48, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x48, 0x65, 0x61,
|
||||||
0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
0x64, 0x12, 0x18, 0x0a, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01,
|
0x28, 0x09, 0x52, 0x07, 0x48, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x4e,
|
||||||
0x28, 0x05, 0x52, 0x04, 0x53, 0x74, 0x61, 0x74, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41,
|
0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
0x57, 0x44, 0x4f, 0x4c, 0x4c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a,
|
0x12, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53,
|
||||||
0x0b, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17,
|
0x74, 0x61, 0x74, 0x2a, 0xfd, 0x02, 0x0a, 0x10, 0x43, 0x4c, 0x41, 0x57, 0x44, 0x4f, 0x4c, 0x4c,
|
||||||
0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d,
|
0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x44, 0x12, 0x0f, 0x0a, 0x0b, 0x50, 0x41, 0x43, 0x4b,
|
||||||
0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45,
|
0x45, 0x54, 0x5f, 0x5a, 0x45, 0x52, 0x4f, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43,
|
||||||
0x54, 0x5f, 0x43, 0x53, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b,
|
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x49, 0x4e, 0x46, 0x4f, 0x10,
|
||||||
0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c,
|
0xe1, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f,
|
||||||
0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43,
|
0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f, 0x50, 0x10, 0xe2, 0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50,
|
||||||
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45,
|
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x4f,
|
||||||
0x10, 0xe4, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
|
0x50, 0x10, 0xe3, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||||
0x5f, 0x47, 0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a,
|
0x43, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0xe4, 0x2b, 0x12, 0x19,
|
||||||
0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79,
|
0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x47, 0x41, 0x4d, 0x45,
|
||||||
0x65, 0x72, 0x45, 0x6e, 0x74, 0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41,
|
0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0xe5, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43,
|
||||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65,
|
0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x45, 0x6e, 0x74,
|
||||||
0x61, 0x76, 0x65, 0x10, 0xe7, 0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54,
|
0x65, 0x72, 0x10, 0xe6, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
||||||
0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8,
|
0x53, 0x43, 0x5f, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x10, 0xe7,
|
||||||
0x2b, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47,
|
0x2b, 0x12, 0x19, 0x0a, 0x14, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50,
|
||||||
0x45, 0x54, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41,
|
0x4c, 0x41, 0x59, 0x45, 0x52, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xe8, 0x2b, 0x12, 0x17, 0x0a, 0x12,
|
||||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45,
|
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47, 0x45, 0x54, 0x54, 0x4f, 0x4b,
|
||||||
0x4e, 0x10, 0xea, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43,
|
0x45, 0x4e, 0x10, 0xe9, 0x2b, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
||||||
0x53, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b,
|
0x53, 0x43, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x54, 0x4f, 0x4b, 0x45, 0x4e, 0x10, 0xea, 0x2b, 0x12,
|
||||||
0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41,
|
0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x57, 0x41, 0x49,
|
||||||
0x49, 0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15,
|
0x54, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0xeb, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50,
|
||||||
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e,
|
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x57, 0x41, 0x49, 0x54, 0x50, 0x4c, 0x41,
|
||||||
0x47, 0x49, 0x4e, 0x46, 0x4f, 0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65,
|
0x59, 0x45, 0x52, 0x53, 0x10, 0xec, 0x2b, 0x12, 0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45,
|
||||||
0x73, 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43,
|
0x54, 0x5f, 0x53, 0x43, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x49, 0x4e, 0x47, 0x49, 0x4e, 0x46, 0x4f,
|
||||||
0x5f, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50,
|
0x10, 0xed, 0x2b, 0x2a, 0x64, 0x0a, 0x0c, 0x4f, 0x70, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x43,
|
||||||
0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50,
|
0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x0c, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x63,
|
||||||
0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68,
|
0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72,
|
||||||
0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c,
|
0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f,
|
||||||
0x52, 0x65, 0x61, 0x64, 0x79, 0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28,
|
0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x12, 0x1a, 0x0a,
|
||||||
0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f,
|
0x16, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x50, 0x6f, 0x73, 0x41, 0x6c, 0x52, 0x65, 0x61, 0x64, 0x79,
|
||||||
0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f,
|
0x50, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e,
|
||||||
0x63, 0x6c, 0x61, 0x77, 0x64, 0x6f, 0x6c, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
|
|
|
@ -118,6 +118,7 @@ message SCCLAWDOLLSendToken {
|
||||||
int64 Appid = 2;
|
int64 Appid = 2;
|
||||||
string Token = 3;
|
string Token = 3;
|
||||||
string StreamId = 4;
|
string StreamId = 4;
|
||||||
|
string AppSign = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CLAWDOLLWaitPlayers {
|
message CLAWDOLLWaitPlayers {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
if exist ".\public" (
|
if exist "..\public" (
|
||||||
cd .\public
|
cd ..\public
|
||||||
git checkout main
|
git checkout main
|
||||||
git pull
|
git pull
|
||||||
|
|
||||||
xcopy ..\data .\data /s /e /y
|
xcopy ..\game\data .\data /s /e /y
|
||||||
xcopy ..\protocol .\protocol /s /e /y
|
xcopy ..\game\protocol .\protocol /s /e /y
|
||||||
xcopy ..\xlsx .\xlsx /s /e /y
|
xcopy ..\game\xlsx .\xlsx /s /e /y
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "update"
|
git commit -m "update"
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ func CSRoomConfigHandler(s *netlib.Session, packetId int, data interface{}, sid
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
pack := PlatformMgrSingleton.GetRoomConfig(p.Platform)
|
pack := PlatformMgrSingleton.GetRoomConfig(p.Platform, p.LastChannel)
|
||||||
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SCRoomConfig), pack)
|
p.SendToClient(int(gamehall.GameHallPacketID_PACKET_SCRoomConfig), pack)
|
||||||
logger.Logger.Tracef("SCRoomConfig: %v", pack)
|
logger.Logger.Tracef("SCRoomConfig: %v", pack)
|
||||||
return nil
|
return nil
|
||||||
|
@ -1202,18 +1202,36 @@ func CSCreatePrivateRoomHandler(s *netlib.Session, packetId int, data interface{
|
||||||
send()
|
send()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if !slices.Contains(cfg.GetOnChannelName(), p.LastChannel) {
|
||||||
|
send()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
f := func(param []int32) []int32 {
|
||||||
|
if len(param) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if param[0] == 0 {
|
||||||
|
return param[1:]
|
||||||
|
}
|
||||||
|
if param[0] > 0 && int(param[0]) < len(param) {
|
||||||
|
return []int32{param[param[0]]}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// 场次
|
// 场次
|
||||||
if !slices.Contains(cfg.GetGameFreeId(), msg.GetGameFreeId()) {
|
if !slices.Contains(f(cfg.GetGameFreeId()), msg.GetGameFreeId()) {
|
||||||
send()
|
send()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// 局数
|
// 局数
|
||||||
if !slices.Contains(cfg.GetRound(), msg.GetRound()) {
|
if !slices.Contains(f(cfg.GetRound()), msg.GetRound()) {
|
||||||
send()
|
send()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// 玩家数量
|
// 玩家数量
|
||||||
if !slices.Contains(cfg.GetPlayerNum(), msg.GetPlayerNum()) {
|
if !slices.Contains(f(cfg.GetPlayerNum()), msg.GetPlayerNum()) {
|
||||||
send()
|
send()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,7 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !scene.IsMatchScene() { // 比赛没金币是积分
|
if !scene.IsMatchScene() && !scene.IsCustom() { // 比赛没金币是积分
|
||||||
player.Coin = playerBet.GetCoin()
|
player.Coin = playerBet.GetCoin()
|
||||||
player.GameCoinTs = playerBet.GetGameCoinTs()
|
player.GameCoinTs = playerBet.GetGameCoinTs()
|
||||||
player.GameTax += playerBet.GetTax()
|
player.GameTax += playerBet.GetTax()
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"slices"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -76,7 +78,34 @@ func (p *PlayerNotify) GetPlayers(tp common.NotifyType) []int32 {
|
||||||
// SendToClient 发送消息给客户端
|
// SendToClient 发送消息给客户端
|
||||||
// tp 消息类型
|
// tp 消息类型
|
||||||
func (p *PlayerNotify) SendToClient(tp common.NotifyType, packetId int, pack interface{}) {
|
func (p *PlayerNotify) SendToClient(tp common.NotifyType, packetId int, pack interface{}) {
|
||||||
ids := p.GetPlayers(tp)
|
switch tp {
|
||||||
|
case common.NotifyPrivateRoomList:
|
||||||
|
d := pack.(*gamehall.SCGetPrivateRoomList)
|
||||||
|
if len(d.GetDatas()) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scene := SceneMgrSingleton.GetScene(int(d.GetDatas()[0].GetRoomId()))
|
||||||
|
if scene == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
roomConfigId := d.GetDatas()[0].GetRoomConfigId()
|
||||||
|
cfg := PlatformMgrSingleton.GetConfig(scene.limitPlatform.IdStr).RoomConfig[roomConfigId]
|
||||||
|
if cfg == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var ids []int32
|
||||||
|
for _, v := range p.GetPlayers(tp) {
|
||||||
|
player := PlayerMgrSington.GetPlayerBySnId(v)
|
||||||
|
if player == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if slices.Contains(cfg.GetOnChannelName(), player.LastChannel) {
|
||||||
|
ids = append(ids, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PlayerMgrSington.BroadcastMessageToTarget(ids, packetId, pack)
|
PlayerMgrSington.BroadcastMessageToTarget(ids, packetId, pack)
|
||||||
logger.Logger.Tracef("PlayerNotify SendToClient tp:%v ids:%v", tp, ids)
|
logger.Logger.Tracef("PlayerNotify SendToClient tp:%v ids:%v", tp, ids)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -141,7 +141,6 @@ func NewScene(args *CreateSceneParam) *Scene {
|
||||||
if s.CustomParam == nil {
|
if s.CustomParam == nil {
|
||||||
s.CustomParam = new(serverproto.CustomParam)
|
s.CustomParam = new(serverproto.CustomParam)
|
||||||
}
|
}
|
||||||
s.sp.OnStart(s)
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,9 +682,9 @@ func (this *Scene) OnClose() {
|
||||||
}
|
}
|
||||||
this.Broadcast(int(hallproto.GameHallPacketID_PACKET_SC_DESTROYROOM), scDestroyRoom, 0)
|
this.Broadcast(int(hallproto.GameHallPacketID_PACKET_SC_DESTROYROOM), scDestroyRoom, 0)
|
||||||
|
|
||||||
|
this.sp.OnStop(this)
|
||||||
this.deleting = true
|
this.deleting = true
|
||||||
this.closed = true
|
this.closed = true
|
||||||
this.sp.OnStop(this)
|
|
||||||
|
|
||||||
for _, p := range this.players {
|
for _, p := range this.players {
|
||||||
this.DelPlayer(p)
|
this.DelPlayer(p)
|
||||||
|
|
|
@ -413,6 +413,7 @@ func (m *SceneMgr) CreateScene(args *CreateSceneParam) *Scene {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
m.scenes[args.RoomId] = s
|
m.scenes[args.RoomId] = s
|
||||||
|
s.sp.OnStart(s)
|
||||||
// 添加到游戏服记录中
|
// 添加到游戏服记录中
|
||||||
args.GS.AddScene(&AddSceneParam{
|
args.GS.AddScene(&AddSceneParam{
|
||||||
S: s,
|
S: s,
|
||||||
|
|
|
@ -52,6 +52,7 @@ const (
|
||||||
ShopPageGift = 7 //礼包页面
|
ShopPageGift = 7 //礼包页面
|
||||||
ShopPageDiamondBank = 8 //钻石存储罐
|
ShopPageDiamondBank = 8 //钻石存储罐
|
||||||
ShopPagePermit = 9 //赛季通行证
|
ShopPagePermit = 9 //赛季通行证
|
||||||
|
ShopPageFangKa = 10 //房卡页面
|
||||||
|
|
||||||
ShopPagePhoneScore = 61 //手机积分商城
|
ShopPagePhoneScore = 61 //手机积分商城
|
||||||
ShopPagePhoneScoreGoogle = 62
|
ShopPagePhoneScoreGoogle = 62
|
||||||
|
@ -62,9 +63,15 @@ const (
|
||||||
const (
|
const (
|
||||||
ShopTypeCoin = iota + 1 // 金币
|
ShopTypeCoin = iota + 1 // 金币
|
||||||
ShopTypeDiamond // 钻石
|
ShopTypeDiamond // 钻石
|
||||||
ShopTypeItem // 道具
|
SHopTypeItem // 道具
|
||||||
ShopTypeFangKa // 房卡
|
)
|
||||||
ShopTypeMax
|
|
||||||
|
// 商品参数类型
|
||||||
|
const (
|
||||||
|
ShopParamCoin = iota // 金币
|
||||||
|
ShopParamDiamond // 钻石
|
||||||
|
ShopParamUnKnown // 未定义
|
||||||
|
ShopParamMax // 参数数量
|
||||||
)
|
)
|
||||||
|
|
||||||
// 兑换商品状态
|
// 兑换商品状态
|
||||||
|
@ -138,7 +145,7 @@ func (this *ShopMgr) GetShopInfoProto(si *model.ShopInfo, p *Player, vipShopId i
|
||||||
}
|
}
|
||||||
added := int32(rand.Intn(int(si.AddArea[1])-int(si.AddArea[0])+1) + int(si.AddArea[0]))
|
added := int32(rand.Intn(int(si.AddArea[1])-int(si.AddArea[0])+1) + int(si.AddArea[0]))
|
||||||
consumptionAmount := int32(rand.Intn(int(si.CostArea[1])-int(si.CostArea[0])+1) + int(si.CostArea[0]))
|
consumptionAmount := int32(rand.Intn(int(si.CostArea[1])-int(si.CostArea[0])+1) + int(si.CostArea[0]))
|
||||||
amount := int64(si.Amount)
|
amount := si.Amount
|
||||||
isBuy := false
|
isBuy := false
|
||||||
if si.Page == ShopPageVip {
|
if si.Page == ShopPageVip {
|
||||||
shopData := p.GetVipShopData(si.Id, vipShopId)
|
shopData := p.GetVipShopData(si.Id, vipShopId)
|
||||||
|
@ -646,6 +653,7 @@ func (this *ShopMgr) GetAmountFinal(p *Player, shopId, vipShopId int32) int64 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
addTotal += addNormal
|
||||||
}
|
}
|
||||||
return addTotal
|
return addTotal
|
||||||
}
|
}
|
||||||
|
@ -703,7 +711,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
amount := [3]int32{} // 获得含义:金币,钻石,经验
|
amount := [ShopParamMax]int32{} // 获得含义:金币,钻石,经验
|
||||||
if shopInfo.Page == ShopPageVip {
|
if shopInfo.Page == ShopPageVip {
|
||||||
if p.VipShopData[vipShopId] == nil {
|
if p.VipShopData[vipShopId] == nil {
|
||||||
logger.Logger.Errorf("GainShop 没有找到vip商品 shopId:%v vipShopId:%v snid:%v", shopInfo.Id, vipShopId, p.SnId)
|
logger.Logger.Errorf("GainShop 没有找到vip商品 shopId:%v vipShopId:%v snid:%v", shopInfo.Id, vipShopId, p.SnId)
|
||||||
|
@ -718,7 +726,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
|
||||||
|
|
||||||
switch shopInfo.Type {
|
switch shopInfo.Type {
|
||||||
case ShopTypeCoin:
|
case ShopTypeCoin:
|
||||||
amount[0] = int32(addTotal)
|
amount[ShopParamCoin] = int32(addTotal)
|
||||||
p.AddCoin(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
|
p.AddCoin(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
|
||||||
if shopInfo.Ad > 0 { //观看广告
|
if shopInfo.Ad > 0 { //观看广告
|
||||||
if !p.IsRob {
|
if !p.IsRob {
|
||||||
|
@ -735,7 +743,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po
|
||||||
|
|
||||||
case ShopTypeDiamond:
|
case ShopTypeDiamond:
|
||||||
//增加钻石
|
//增加钻石
|
||||||
amount[1] = int32(addTotal)
|
amount[ShopParamDiamond] = int32(addTotal)
|
||||||
p.AddDiamond(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
|
p.AddDiamond(addTotal, 0, common.GainWay_Shop_Buy, "system", shopName)
|
||||||
if shopInfo.Ad > 0 { //观看广告
|
if shopInfo.Ad > 0 { //观看广告
|
||||||
if !p.IsRob {
|
if !p.IsRob {
|
||||||
|
@ -902,7 +910,7 @@ func (this *ShopMgr) Exchange(p *Player, goodsId int32, username, mobile, commen
|
||||||
if err := proto.Unmarshal(buff, as); err != nil {
|
if err := proto.Unmarshal(buff, as); err != nil {
|
||||||
logger.Logger.Errorf("API_CreateExchange err: %v %v", err, as.Tag)
|
logger.Logger.Errorf("API_CreateExchange err: %v %v", err, as.Tag)
|
||||||
}
|
}
|
||||||
var amount [ShopTypeItem]int32
|
var amount [ShopParamMax]int32
|
||||||
//保存db
|
//保存db
|
||||||
dbShop := this.NewDbShop(p, 0, amount[:], ExchangeConsumeCash, info.Cash*num,
|
dbShop := this.NewDbShop(p, 0, amount[:], ExchangeConsumeCash, info.Cash*num,
|
||||||
common.GainWay_ShopBuy, itemInfo, cdata.Id, cdata.Name, 0, "", []int32{})
|
common.GainWay_ShopBuy, itemInfo, cdata.Id, cdata.Name, 0, "", []int32{})
|
||||||
|
@ -1194,40 +1202,10 @@ func (this *ShopMgr) NewDbShop(p *Player, pageId int32, amount []int32, consume,
|
||||||
func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any, remark string) {
|
func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any, remark string) {
|
||||||
//三方购买
|
//三方购买
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
var amount [ShopTypeItem]int32
|
var amount [ShopParamMax]int32
|
||||||
var dbShop *model.DbShop
|
var dbShop *model.DbShop
|
||||||
if shopInfo, ok := data.(*model.ShopInfo); ok {
|
if shopInfo, ok := data.(*model.ShopInfo); ok {
|
||||||
// 目前现金只能买钻石
|
|
||||||
var addTotal = int64(shopInfo.Amount)
|
|
||||||
added := rand.Int31n(shopInfo.AddArea[1]-shopInfo.AddArea[0]+1) + shopInfo.AddArea[0]
|
|
||||||
costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0]
|
costNum := rand.Int31n(shopInfo.CostArea[1]-shopInfo.CostArea[0]+1) + shopInfo.CostArea[0]
|
||||||
/* if shopInfo.Page == ShopPageVip {
|
|
||||||
//暂时这样修改 VIP礼包没有现金支付
|
|
||||||
shopData := p.GetVipShopData(shopInfo.Id, 0)
|
|
||||||
if shopData != nil {
|
|
||||||
added = shopData.AddArea
|
|
||||||
costNum = shopData.CostArea
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
vipAdded := int32(0)
|
|
||||||
if shopInfo.Page == ShopPageDiamond {
|
|
||||||
//vip加成
|
|
||||||
vipAdded = VipMgrSington.GetVipDiamondExtra(p.Platform, p.VIP)
|
|
||||||
logger.Logger.Tracef("商城钻石购买,vip加成 vipAdded = %v", vipAdded)
|
|
||||||
}
|
|
||||||
|
|
||||||
if added > 0 || vipAdded > 0 {
|
|
||||||
addTotal = shopInfo.Amount + int64((float64(shopInfo.Amount)*float64(added+vipAdded))/100.0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 首充翻倍
|
|
||||||
if shopInfo.FirstSwitch {
|
|
||||||
if !slices.Contains(p.ShopID, int(shopInfo.Id)) {
|
|
||||||
addTotal *= 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
amount[ShopTypeDiamond-1] = int32(addTotal)
|
|
||||||
var itemInfo []model.ItemInfo
|
var itemInfo []model.ItemInfo
|
||||||
var webItemInfo []*webapi_proto.ItemInfo
|
var webItemInfo []*webapi_proto.ItemInfo
|
||||||
for _, info := range shopInfo.GetItems() {
|
for _, info := range shopInfo.GetItems() {
|
||||||
|
@ -1241,6 +1219,13 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch shopInfo.Type {
|
||||||
|
case ShopTypeDiamond:
|
||||||
|
amount[ShopParamDiamond] = int32(shopInfo.AmountFinal)
|
||||||
|
default:
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
dbShop = this.NewDbShop(p, shopInfo.Page, amount[:], ShopConsumeMoney, costNum,
|
dbShop = this.NewDbShop(p, shopInfo.Page, amount[:], ShopConsumeMoney, costNum,
|
||||||
common.GainWay_ShopBuy, itemInfo, shopInfo.Id, shopInfo.Name, 0, remark, []int32{})
|
common.GainWay_ShopBuy, itemInfo, shopInfo.Id, shopInfo.Name, 0, remark, []int32{})
|
||||||
err := model.InsertDbShopLog(dbShop)
|
err := model.InsertDbShopLog(dbShop)
|
||||||
|
@ -1249,7 +1234,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, shopInfo.Id, p.Platform, p.PackageID, p.DeviceOS,
|
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, shopInfo.Id, p.Platform, p.PackageID, p.DeviceOS,
|
||||||
p.DeviceId, shopInfo.Name, [ShopTypeItem]int32{0, int32(addTotal), 0}, costNum, webItemInfo, "", p.Channel, p.ChannelId)
|
p.DeviceId, shopInfo.Name, amount, costNum, webItemInfo, "", p.Channel, p.ChannelId)
|
||||||
|
|
||||||
} else if cdata, ok := data.(*ExchangeShopInfo); ok {
|
} else if cdata, ok := data.(*ExchangeShopInfo); ok {
|
||||||
var info *shop.ExchangeType
|
var info *shop.ExchangeType
|
||||||
|
@ -1274,35 +1259,54 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
||||||
//兑换 充值订单
|
//兑换 充值订单
|
||||||
logger.Logger.Infof("客户端请求兑换 创建支付订单!AppId = %v,SnId = %v,Id = %v,dbShop.LogId.Hex() = %v,cash = %v", common.GetAppId(), p.SnId, cdata.Id, dbShop.LogId.Hex(), info.Cash*cdata.ExchangeNum)
|
logger.Logger.Infof("客户端请求兑换 创建支付订单!AppId = %v,SnId = %v,Id = %v,dbShop.LogId.Hex() = %v,cash = %v", common.GetAppId(), p.SnId, cdata.Id, dbShop.LogId.Hex(), info.Cash*cdata.ExchangeNum)
|
||||||
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, cdata.Id, p.Platform, p.PackageID, p.DeviceOS,
|
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, cdata.Id, p.Platform, p.PackageID, p.DeviceOS,
|
||||||
p.DeviceId, cdata.Name, [ShopTypeItem]int32{0, 0, 0}, info.Cash*cdata.ExchangeNum, nil, orderId, p.Channel, p.ChannelId)
|
p.DeviceId, cdata.Name, amount, info.Cash*cdata.ExchangeNum, nil, orderId, p.Channel, p.ChannelId)
|
||||||
} else if bbd, ok := data.(*webapi_proto.BlindBoxData); ok {
|
} else if bbd, ok := data.(*webapi_proto.BlindBoxData); ok {
|
||||||
if bbd.Type == 1 {
|
if bbd.Type == ShopTypeCoin {
|
||||||
//金币
|
//金币
|
||||||
amount[0] = bbd.Grade
|
amount[ShopParamCoin] = bbd.Grade
|
||||||
} else if bbd.Type == 2 {
|
} else if bbd.Type == ShopTypeDiamond {
|
||||||
//钻石
|
//钻石
|
||||||
amount[1] = bbd.Grade
|
amount[ShopParamDiamond] = bbd.Grade
|
||||||
}
|
}
|
||||||
dbShop = this.NewDbShop(p, 0, amount[:], ShopConsumeMoney, int32(bbd.Price2), common.GainWay_ActBlindBox, nil, 0, "", 0, remark, []int32{bbd.Id})
|
|
||||||
|
var itemInfo []model.ItemInfo
|
||||||
|
var webItemInfo []*webapi_proto.ItemInfo
|
||||||
|
for _, info := range shopInfo.GetItems() {
|
||||||
|
itemInfo = append(itemInfo, model.ItemInfo{
|
||||||
|
ItemId: info.ItemId,
|
||||||
|
ItemNum: info.ItemNum,
|
||||||
|
})
|
||||||
|
webItemInfo = append(webItemInfo, &webapi_proto.ItemInfo{
|
||||||
|
ItemId: info.ItemId,
|
||||||
|
ItemNum: info.ItemNum,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
dbShop = this.NewDbShop(p, 0, amount[:], ShopConsumeMoney, int32(bbd.Price2), common.GainWay_ActBlindBox, itemInfo, 0, "", 0, remark, []int32{bbd.Id})
|
||||||
err := model.InsertDbShopLog(dbShop)
|
err := model.InsertDbShopLog(dbShop)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Errorf("model.InsertDbShopLog err:", err)
|
logger.Logger.Errorf("model.InsertDbShopLog err:", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, 0, p.Platform, p.PackageID, p.DeviceOS,
|
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, 0, p.Platform, p.PackageID, p.DeviceOS,
|
||||||
p.DeviceId, bbd.Name, amount, int32(bbd.Price2), nil, "", p.Channel, p.ChannelId)
|
p.DeviceId, bbd.Name, amount, int32(bbd.Price2), webItemInfo, "", p.Channel, p.ChannelId)
|
||||||
} else if wfs, ok := data.(*webapi_proto.WelfareSpree); ok {
|
} else if wfs, ok := data.(*webapi_proto.WelfareSpree); ok {
|
||||||
var items []model.ItemInfo
|
var items []model.ItemInfo
|
||||||
|
var webItemInfo []*webapi_proto.ItemInfo
|
||||||
for _, it := range wfs.Item {
|
for _, it := range wfs.Item {
|
||||||
if it.Type == 1 {
|
if it.Type == ShopTypeCoin {
|
||||||
amount[0] = it.Grade
|
amount[ShopParamCoin] = it.Grade
|
||||||
} else if it.Type == 2 {
|
} else if it.Type == ShopTypeDiamond {
|
||||||
amount[1] = it.Grade
|
amount[ShopParamDiamond] = it.Grade
|
||||||
} else if it.Type == 3 {
|
} else if it.Type == SHopTypeItem {
|
||||||
items = append(items, model.ItemInfo{
|
items = append(items, model.ItemInfo{
|
||||||
ItemId: it.Item_Id,
|
ItemId: it.Item_Id,
|
||||||
ItemNum: int64(it.Grade),
|
ItemNum: int64(it.Grade),
|
||||||
})
|
})
|
||||||
|
webItemInfo = append(webItemInfo, &webapi_proto.ItemInfo{
|
||||||
|
ItemId: it.GetItem_Id(),
|
||||||
|
ItemNum: int64(it.GetGrade()),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var gainWay int32 = common.GainWay_ActFirstPay
|
var gainWay int32 = common.GainWay_ActFirstPay
|
||||||
|
@ -1316,7 +1320,7 @@ func (this *ShopMgr) SendAPICreateOrder(p *Player, ConfigPayId int32, data any,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, 0, p.Platform, p.PackageID, p.DeviceOS,
|
return webapi.API_CreateOrder(common.GetAppId(), dbShop.LogId.Hex(), ConfigPayId, p.SnId, 0, p.Platform, p.PackageID, p.DeviceOS,
|
||||||
p.DeviceId, "FirstRecharge", amount, int32(wfs.Price2), nil, "", p.Channel, p.ChannelId)
|
p.DeviceId, "FirstRecharge", amount, int32(wfs.Price2), webItemInfo, "", p.Channel, p.ChannelId)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}), task.CompleteNotifyWrapper(func(retdata interface{}, t task.Task) {
|
}), task.CompleteNotifyWrapper(func(retdata interface{}, t task.Task) {
|
||||||
|
|
Loading…
Reference in New Issue