娃娃机状态修改
This commit is contained in:
parent
7991a8044d
commit
418b16d2e9
|
@ -317,6 +317,7 @@ const (
|
|||
GainWayRoomCost = 106 //房费消耗
|
||||
GainWayRoomGain = 107 //房卡场获得
|
||||
GainWayItemShop = 108 // 交易市场道具交易
|
||||
GainWayClawdoorCostItem = 109 // 娃娃机上分扣道具
|
||||
)
|
||||
|
||||
// 后台选择 金币变化类型 的充值 类型id号起始
|
||||
|
|
|
@ -76,6 +76,9 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data
|
|||
case 1:
|
||||
if msg.Result == 1 {
|
||||
logger.Logger.Tracef("上分成功!!!!!!!!!!!!snid = ", msg.Snid)
|
||||
|
||||
sceneEx.playingSnid = p.SnId
|
||||
|
||||
//发送向前移动指令
|
||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonFront)
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
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"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
)
|
||||
|
@ -62,6 +64,41 @@ func (this *PlayerEx) CanPayCoin() 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
|
||||
}
|
||||
|
||||
|
|
|
@ -296,8 +296,8 @@ func (this *SceneEx) IsHasPlaying() bool {
|
|||
|
||||
// 等待下一个玩家
|
||||
func (this *SceneEx) ReStartGame() {
|
||||
logger.Logger.Trace("(*SceneEx) ReStartGame, playingSnid = ", this.playingSnid)
|
||||
this.playingSnid = 0
|
||||
|
||||
}
|
||||
|
||||
func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
|
||||
|
|
|
@ -526,13 +526,11 @@ func (this *StateWait) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, par
|
|||
return false
|
||||
}
|
||||
|
||||
// 1-前 2-后 3-左 4-右 5-投币
|
||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
|
||||
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
|
@ -842,12 +820,6 @@ func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode i
|
|||
|
||||
playerEx.ReStartGame()
|
||||
|
||||
s.ChangeSceneState(rule.ClawDollSceneStateStart)
|
||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
|
||||
|
||||
ClawdollBroadcastRoomState(s)
|
||||
ClawdollSendPlayerInfo(s)
|
||||
|
||||
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
|
||||
|
||||
case rule.ClawDollPlayerCancelPayCoin:
|
||||
|
@ -894,7 +866,7 @@ func (this *StateWaitPayCoin) OnEnter(s *base.Scene) {
|
|||
Balance: proto.Int64(playerEx.Coin),
|
||||
}
|
||||
|
||||
// logger.Logger.Trace("SCSmallRocketRoundGameBilled is pack: ", pack)
|
||||
logger.Logger.Trace("Clawdoor -StateWaitPayCoin is pack: ", pack)
|
||||
proto.SetDefaults(pack)
|
||||
|
||||
playerEx.SendToClient(int(clawdoll.CLAWDOLLPacketID_PACKET_SC_GAMEBILLED), pack)
|
||||
|
|
Loading…
Reference in New Issue