娃娃机抓取后结果通知修改
This commit is contained in:
parent
e1e805f9d8
commit
8f59f4d03a
|
|
@ -71,3 +71,7 @@ const (
|
||||||
Zego_ForbidRTCStream = iota + 1
|
Zego_ForbidRTCStream = iota + 1
|
||||||
Zego_ResumeRTCStream = iota + 1
|
Zego_ResumeRTCStream = iota + 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ClawDoorItemID = 40003
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package clawdoll
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"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 +53,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 +79,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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ func (this *PolicyClawdoll) OnTick(s *base.Scene) {
|
||||||
sceneEx, ok := s.ExtraData.(*SceneEx)
|
sceneEx, ok := s.ExtraData.(*SceneEx)
|
||||||
if ok {
|
if ok {
|
||||||
if sceneEx.machineId == 0 {
|
if sceneEx.machineId == 0 {
|
||||||
|
//machineId := s.DBGameFree.GetId() % 6080000
|
||||||
sceneEx.machineId = action.GetFreeDollMachineId()
|
sceneEx.machineId = action.GetFreeDollMachineId()
|
||||||
}
|
}
|
||||||
if sceneEx.machineId != 0 {
|
if sceneEx.machineId != 0 {
|
||||||
|
|
@ -666,12 +667,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) {
|
||||||
|
|
@ -702,11 +697,6 @@ func (this *PlayGame) OnTick(s *base.Scene) {
|
||||||
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue