Merge branch 'ma' into develop

This commit is contained in:
kxdd 2024-09-10 15:00:35 +08:00
commit b57c5b2e41
5 changed files with 46 additions and 33 deletions

View File

@ -314,6 +314,7 @@ const (
GainWayRoomCost = 106 //房费消耗 GainWayRoomCost = 106 //房费消耗
GainWayRoomGain = 107 //房卡场获得 GainWayRoomGain = 107 //房卡场获得
GainWayItemShop = 108 // 交易市场道具交易 GainWayItemShop = 108 // 交易市场道具交易
GainWayClawdoorCostItem = 109 // 娃娃机上分扣道具
) )
// 后台选择 金币变化类型 的充值 类型id号起始 // 后台选择 金币变化类型 的充值 类型id号起始

View File

@ -76,6 +76,9 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data
case 1: case 1:
if msg.Result == 1 { if msg.Result == 1 {
logger.Logger.Tracef("上分成功snid = ", msg.Snid) logger.Logger.Tracef("上分成功snid = ", msg.Snid)
sceneEx.playingSnid = p.SnId
//发送向前移动指令 //发送向前移动指令
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonFront) sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonFront)

View File

@ -1,8 +1,10 @@
package clawdoll package clawdoll
import ( import (
"mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll" rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base" "mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/model"
"mongo.games.com/game/srvdata" "mongo.games.com/game/srvdata"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
) )
@ -62,6 +64,41 @@ func (this *PlayerEx) CanPayCoin() bool {
// 投币消耗 // 投币消耗
func (this *PlayerEx) CostPlayCoin(count int32) bool { func (this *PlayerEx) CostPlayCoin(count int32) bool {
if !this.CanPayCoin() {
return false
}
var items []*model.Item
itemData := srvdata.GameItemMgr.Get(this.Platform, rule.ClawDoorItemID)
if itemData != nil {
items = append(items, &model.Item{
ItemId: rule.ClawDoorItemID,
ItemNum: -1,
})
}
s := this.GetScene()
if s == nil {
logger.Logger.Warn("CostPlayCoin p.scene == nil")
return false
}
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
this.AddItems(&model.AddItemParam{
P: this.PlayerData,
Change: items,
GainWay: common.GainWayClawdoorCostItem,
Operator: "system",
Remark: "娃娃机上分扣除道具",
GameId: int64(sceneEx.GameId),
GameFreeId: int64(sceneEx.GetGameFreeId()),
})
return true return true
} }

View File

@ -296,8 +296,8 @@ func (this *SceneEx) IsHasPlaying() bool {
// 等待下一个玩家 // 等待下一个玩家
func (this *SceneEx) ReStartGame() { func (this *SceneEx) ReStartGame() {
logger.Logger.Trace("(*SceneEx) ReStartGame, playingSnid = ", this.playingSnid)
this.playingSnid = 0 this.playingSnid = 0
} }
func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) { func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {

View File

@ -526,13 +526,11 @@ func (this *StateWait) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, par
return false return false
} }
// 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
if sceneEx.CanStart() { if sceneEx.CanStart() {
sceneEx.playingSnid = playerEx.SnId // 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) //sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
} }
} }
@ -735,26 +733,6 @@ func (this *StateBilled) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, p
func (this *StateBilled) OnEnter(s *base.Scene) { func (this *StateBilled) OnEnter(s *base.Scene) {
logger.Logger.Trace("(this *StateBilled) OnEnter, sceneid=", s.GetSceneId()) logger.Logger.Trace("(this *StateBilled) OnEnter, sceneid=", s.GetSceneId())
this.BaseState.OnEnter(s) this.BaseState.OnEnter(s)
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return
}
playerEx := sceneEx.GetPlayingEx()
if playerEx != nil {
pack := &clawdoll.SCCLAWDOLLRoundGameBilled{
RoundId: proto.Int32(int32(sceneEx.RoundId)),
ClowResult: proto.Int32(0),
Award: proto.Int64(playerEx.gainCoin),
Balance: proto.Int64(playerEx.Coin),
}
// logger.Logger.Trace("SCSmallRocketRoundGameBilled is pack: ", pack)
proto.SetDefaults(pack)
playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack)
}
} }
func (this *StateBilled) OnLeave(s *base.Scene) { func (this *StateBilled) OnLeave(s *base.Scene) {
@ -842,12 +820,6 @@ func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode i
playerEx.ReStartGame() playerEx.ReStartGame()
s.ChangeSceneState(rule.ClawDollSceneStateStart)
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
ClawdollBroadcastRoomState(s)
ClawdollSendPlayerInfo(s)
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
case rule.ClawDollPlayerCancelPayCoin: case rule.ClawDollPlayerCancelPayCoin:
@ -894,7 +866,7 @@ func (this *StateWaitPayCoin) OnEnter(s *base.Scene) {
Balance: proto.Int64(playerEx.Coin), Balance: proto.Int64(playerEx.Coin),
} }
// logger.Logger.Trace("SCSmallRocketRoundGameBilled is pack: ", pack) logger.Logger.Trace("Clawdoor -StateWaitPayCoin is pack: ", pack)
proto.SetDefaults(pack) proto.SetDefaults(pack)
playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack) playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack)