Merge remote-tracking branch 'origin/develop' into dev_slots
This commit is contained in:
commit
0d132fa803
|
@ -8,7 +8,6 @@ import (
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/protocol/clawdoll"
|
"mongo.games.com/game/protocol/clawdoll"
|
||||||
"mongo.games.com/game/protocol/machine"
|
"mongo.games.com/game/protocol/machine"
|
||||||
"mongo.games.com/game/srvdata"
|
|
||||||
"mongo.games.com/goserver/core/basic"
|
"mongo.games.com/goserver/core/basic"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/netlib"
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
@ -240,28 +239,6 @@ func (h *CSGetPlayerLogHandler) Process(s *netlib.Session, packetid int, data in
|
||||||
var err error
|
var err error
|
||||||
var ItemLogs []model.ClawdollSuccessItemLog
|
var ItemLogs []model.ClawdollSuccessItemLog
|
||||||
|
|
||||||
if rule.DebugSwitch {
|
|
||||||
var items []*model.Item
|
|
||||||
itemData := srvdata.GameItemMgr.Get(p.Platform, common.ItemIDClawdoll)
|
|
||||||
if itemData != nil {
|
|
||||||
items = append(items, &model.Item{
|
|
||||||
ItemId: common.ItemIDClawdoll,
|
|
||||||
ItemNum: int64(machineInfo.CostItemNum),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
p.AddItems(&model.AddItemParam{
|
|
||||||
Platform: p.Platform,
|
|
||||||
SnId: p.SnId,
|
|
||||||
Change: items,
|
|
||||||
GainWay: common.GainWayClawdollCostItem,
|
|
||||||
Operator: "system",
|
|
||||||
Remark: "娃娃机上分扣除道具",
|
|
||||||
GameId: int64(sceneEx.GameId),
|
|
||||||
GameFreeId: int64(sceneEx.GetGameFreeId()),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//娃娃机道具使用日志
|
//娃娃机道具使用日志
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
ItemLogs, err = model.GetClawdollSuccessItemLog(p.Platform, p.SnId)
|
ItemLogs, err = model.GetClawdollSuccessItemLog(p.Platform, p.SnId)
|
||||||
|
|
|
@ -155,7 +155,6 @@ func (this *SceneEx) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
// 发送http Get请求 关闭直播间流
|
// 发送http Get请求 关闭直播间流
|
||||||
operateTask(this, 2, rule.Zego_ForbidRTCStream, p.Platform)
|
operateTask(this, 2, rule.Zego_ForbidRTCStream, p.Platform)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
func (this *SceneEx) SceneDestroy(force bool) {
|
func (this *SceneEx) SceneDestroy(force bool) {
|
||||||
//销毁房间
|
//销毁房间
|
||||||
|
@ -349,18 +348,24 @@ func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 {
|
||||||
machineId := this.GetDBGameFree().GetId() % 6080000
|
machineId := this.GetDBGameFree().GetId() % 6080000
|
||||||
machineInfo := this.GetMachineServerInfo(machineId, player.Platform)
|
machineInfo := this.GetMachineServerInfo(machineId, player.Platform)
|
||||||
if machineInfo == nil {
|
if machineInfo == nil {
|
||||||
logger.Logger.Errorf("GetPlayGrabType machineId: %v, platform: %v", machineId, player.Platform)
|
logger.Logger.Errorf("Clawdoll GetPlayGrabType machineId: %v, platform: %v", machineId, player.Platform)
|
||||||
return rule.ClawWeak
|
return rule.ClawWeak
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfitRate := common.RandFloat(machineInfo.ProfitMin, machineInfo.ProfitMax)
|
ProfitRate := common.RandFloat(machineInfo.ProfitMin, machineInfo.ProfitMax)
|
||||||
strongRate := machineInfo.CatchPrice/machineInfo.BuyPrice*ProfitRate*float64(this.PayCoinCount) - 1
|
strongRate := (machineInfo.CatchPrice/(machineInfo.BuyPrice*ProfitRate))*float64(this.PayCoinCount) - 1
|
||||||
|
|
||||||
|
logger.Logger.Tracef("Clawdoll GetPlayGrabType: SnId: %v, PayCoinCount:%v, ProfitRate:%v, strongRate:%v", player.SnId, this.PayCoinCount, ProfitRate, strongRate)
|
||||||
|
|
||||||
if strongRate <= 0.00000 {
|
if strongRate <= 0.00000 {
|
||||||
return rule.ClawWeak
|
return rule.ClawWeak
|
||||||
} else if strongRate > 0.00000 && strongRate <= 0.99999 {
|
} else if strongRate > 0.00000 && strongRate <= 0.99999 {
|
||||||
// 再次随机
|
// 再次随机
|
||||||
newRate := common.RandFromRangeInt64(0, 100)
|
newRate := common.RandFromRangeInt64(0, 100)
|
||||||
if int64(strongRate*100) > newRate {
|
logger.Logger.Tracef("Clawdoll GetPlayGrabType: newRate:%v, SnId: %v, PayCoinCount:%v, ProfitRate:%v, strongRate:%v ", newRate, player.SnId, this.PayCoinCount, ProfitRate, strongRate)
|
||||||
|
|
||||||
|
if int64(strongRate*100) >= newRate {
|
||||||
|
logger.Logger.Tracef("Clawdoll GetPlayGrabType: SnId: %v gain ClawStrong, PayCoinCount:%v", player.SnId, this.PayCoinCount)
|
||||||
return rule.ClawStrong
|
return rule.ClawStrong
|
||||||
} else {
|
} else {
|
||||||
return rule.ClawWeak
|
return rule.ClawWeak
|
||||||
|
@ -432,6 +437,8 @@ func (this *SceneEx) TimeOutPlayGrab() bool {
|
||||||
this.PayCoinCount = 0
|
this.PayCoinCount = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.Logger.Trace("ClawDoll StatePlayGame OnPlayerOp Grab-----SnId:", playerEx.SnId, " grapType: ", grapType)
|
||||||
|
|
||||||
this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), grapType)
|
this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), grapType)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -520,7 +527,7 @@ func (this *SceneEx) SavePayCoinCount(asyn bool) {
|
||||||
machineId := this.GetDBGameFree().GetId()
|
machineId := this.GetDBGameFree().GetId()
|
||||||
PayCoinCountDBKey := fmt.Sprintf("Clawdoll_PayCoinCount_%v", machineId)
|
PayCoinCountDBKey := fmt.Sprintf("Clawdoll_PayCoinCount_%v", machineId)
|
||||||
|
|
||||||
saveBuff := strconv.Itoa(int(machineId))
|
saveBuff := strconv.Itoa(int(this.PayCoinCount))
|
||||||
if asyn {
|
if asyn {
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
return model.UptStrKVGameData(PayCoinCountDBKey, string(saveBuff))
|
return model.UptStrKVGameData(PayCoinCountDBKey, string(saveBuff))
|
||||||
|
|
|
@ -56,6 +56,10 @@ func (this *PolicyClawdoll) OnStart(s *base.Scene) {
|
||||||
|
|
||||||
func (this *PolicyClawdoll) OnStop(s *base.Scene) {
|
func (this *PolicyClawdoll) OnStop(s *base.Scene) {
|
||||||
logger.Logger.Trace("(this *PolicyClawdoll) OnStop , sceneId=", s.GetSceneId())
|
logger.Logger.Trace("(this *PolicyClawdoll) OnStop , sceneId=", s.GetSceneId())
|
||||||
|
sceneEx, ok := s.ExtraData.(*SceneEx)
|
||||||
|
if ok {
|
||||||
|
sceneEx.ShutDown()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PolicyClawdoll) OnTick(s *base.Scene) {
|
func (this *PolicyClawdoll) OnTick(s *base.Scene) {
|
||||||
|
@ -530,23 +534,6 @@ func (this *StateWait) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, par
|
||||||
// 1-前 2-后 3-左 4-右 5-投币
|
// 1-前 2-后 3-左 4-右 5-投币
|
||||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
|
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonPayCoin)
|
||||||
|
|
||||||
if rule.DebugSwitch {
|
|
||||||
playerEx.CostPlayCoin()
|
|
||||||
|
|
||||||
sceneEx.playingSnid = p.SnId
|
|
||||||
|
|
||||||
//发送向前移动指令
|
|
||||||
//sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonBack)
|
|
||||||
|
|
||||||
s.ChangeSceneState(rule.ClawDollSceneStateStart)
|
|
||||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
|
|
||||||
|
|
||||||
ClawdollBroadcastRoomState(s)
|
|
||||||
ClawdollSendPlayerInfo(s)
|
|
||||||
|
|
||||||
ClawdollBroadcastPlayingInfo(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.Logger.Trace("(ClawDoll this *StateWait) OnPlayerOp payCoin, sceneId=", s.GetSceneId(), " player=", p.SnId, " machineId=", sceneEx.machineId)
|
logger.Logger.Trace("(ClawDoll this *StateWait) OnPlayerOp payCoin, sceneId=", s.GetSceneId(), " player=", p.SnId, " machineId=", sceneEx.machineId)
|
||||||
|
|
||||||
//sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
|
//sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
|
||||||
|
@ -692,24 +679,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)
|
||||||
|
|
||||||
if rule.DebugSwitch {
|
|
||||||
if sceneEx.RoundId/2 == 1 {
|
|
||||||
// 获得娃娃卡
|
|
||||||
playerEx.CatchCardClawdoll()
|
|
||||||
|
|
||||||
playerEx.IsWin = true
|
|
||||||
|
|
||||||
} else {
|
|
||||||
playerEx.IsWin = false
|
|
||||||
}
|
|
||||||
|
|
||||||
s.ChangeSceneState(rule.ClawDollSceneStateBilled)
|
|
||||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled))
|
|
||||||
|
|
||||||
ClawdollBroadcastRoomState(s)
|
|
||||||
ClawdollSendPlayerInfo(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
sceneEx.Gaming = false
|
sceneEx.Gaming = false
|
||||||
|
|
||||||
case rule.ClawDollPlayerOpMove:
|
case rule.ClawDollPlayerOpMove:
|
||||||
|
@ -934,22 +903,6 @@ func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode i
|
||||||
playerEx.ReStartGame()
|
playerEx.ReStartGame()
|
||||||
|
|
||||||
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
|
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
|
||||||
if rule.DebugSwitch {
|
|
||||||
playerEx.CostPlayCoin()
|
|
||||||
|
|
||||||
sceneEx.playingSnid = p.SnId
|
|
||||||
|
|
||||||
//发送向前移动指令
|
|
||||||
//sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonBack)
|
|
||||||
|
|
||||||
s.ChangeSceneState(rule.ClawDollSceneStateStart)
|
|
||||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
|
|
||||||
|
|
||||||
ClawdollBroadcastRoomState(s)
|
|
||||||
ClawdollSendPlayerInfo(s)
|
|
||||||
|
|
||||||
ClawdollBroadcastPlayingInfo(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
case rule.ClawDollPlayerCancelPayCoin:
|
case rule.ClawDollPlayerCancelPayCoin:
|
||||||
if sceneEx.playingSnid != playerEx.SnId {
|
if sceneEx.playingSnid != playerEx.SnId {
|
||||||
|
|
|
@ -135,7 +135,7 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
||||||
|
|
||||||
// 下抓
|
// 下抓
|
||||||
func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error {
|
func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
logger.Logger.Tracef("SMDollMachineGrabHandler %v", data)
|
fmt.Println("下抓SMDollMachineGrabHandler %v", data)
|
||||||
msg, ok := data.(*machine.SMDollMachineGrab)
|
msg, ok := data.(*machine.SMDollMachineGrab)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -382,8 +382,8 @@ var data = []byte{
|
||||||
0x65, //0 几币几玩
|
0x65, //0 几币几玩
|
||||||
0x00, //1 几币几玩占用位
|
0x00, //1 几币几玩占用位
|
||||||
0x2D, //2 游戏时间
|
0x2D, //2 游戏时间
|
||||||
0x01, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式
|
0x00, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式
|
||||||
0x0A, //4 出奖概率
|
0x14, //4 出奖概率
|
||||||
0x00, //5 出奖概率占用位
|
0x00, //5 出奖概率占用位
|
||||||
0x00, //6 空中抓物 0关闭 1开启
|
0x00, //6 空中抓物 0关闭 1开启
|
||||||
0x00, //7 连续投币赠送 范围0~100
|
0x00, //7 连续投币赠送 范围0~100
|
||||||
|
|
|
@ -4,5 +4,4 @@ gatesrv
|
||||||
worldsrv
|
worldsrv
|
||||||
gamesrv
|
gamesrv
|
||||||
robot
|
robot
|
||||||
ranksrv
|
ranksrv
|
||||||
machine
|
|
|
@ -2,10 +2,14 @@ package webapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/mq"
|
||||||
"mongo.games.com/game/proto"
|
"mongo.games.com/game/proto"
|
||||||
"mongo.games.com/game/protocol/webapi"
|
"mongo.games.com/game/protocol/webapi"
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PlayerStatement struct {
|
type PlayerStatement struct {
|
||||||
|
@ -141,6 +145,7 @@ func API_CreateOrder(appId, orderId string, configid, SnId, shopId int32, platfo
|
||||||
logger.Logger.Error("API_CreateOrder Unmarshal err:", err)
|
logger.Logger.Error("API_CreateOrder Unmarshal err:", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
mq.Write(model.GenerateActivityLog(SnId, platform, buyType, 0))
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,6 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
|
||||||
}
|
}
|
||||||
if !p.IsRob && tp1 >= 0 {
|
if !p.IsRob && tp1 >= 0 {
|
||||||
mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBox, tp1, v.ItemNum))
|
mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBox, tp1, v.ItemNum))
|
||||||
mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_CollectBox, 1))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,6 +269,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gainFunc(common.GainWay_Collect, "player", "集卡活动")
|
gainFunc(common.GainWay_Collect, "player", "集卡活动")
|
||||||
|
mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_CollectBox, 1))
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.Logger.Warnf("道具使用未定义", msg.ItemId)
|
logger.Logger.Warnf("道具使用未定义", msg.ItemId)
|
||||||
|
|
Loading…
Reference in New Issue