diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index e01c784..3da5a08 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -8,7 +8,6 @@ import ( "mongo.games.com/game/model" "mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/machine" - "mongo.games.com/game/srvdata" "mongo.games.com/goserver/core/basic" "mongo.games.com/goserver/core/logger" "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 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{} { ItemLogs, err = model.GetClawdollSuccessItemLog(p.Platform, p.SnId) diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index 1c60d81..a725773 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -155,7 +155,6 @@ func (this *SceneEx) OnPlayerLeave(p *base.Player, reason int) { // 发送http Get请求 关闭直播间流 operateTask(this, 2, rule.Zego_ForbidRTCStream, p.Platform) } - } func (this *SceneEx) SceneDestroy(force bool) { //销毁房间 @@ -349,18 +348,24 @@ func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 { machineId := this.GetDBGameFree().GetId() % 6080000 machineInfo := this.GetMachineServerInfo(machineId, player.Platform) 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 } 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 { return rule.ClawWeak } else if strongRate > 0.00000 && strongRate <= 0.99999 { // 再次随机 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 } else { return rule.ClawWeak @@ -432,6 +437,8 @@ func (this *SceneEx) TimeOutPlayGrab() bool { this.PayCoinCount = 0 } + logger.Logger.Trace("ClawDoll StatePlayGame OnPlayerOp Grab-----SnId:", playerEx.SnId, " grapType: ", grapType) + this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), grapType) } @@ -520,7 +527,7 @@ func (this *SceneEx) SavePayCoinCount(asyn bool) { machineId := this.GetDBGameFree().GetId() PayCoinCountDBKey := fmt.Sprintf("Clawdoll_PayCoinCount_%v", machineId) - saveBuff := strconv.Itoa(int(machineId)) + saveBuff := strconv.Itoa(int(this.PayCoinCount)) if asyn { task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} { return model.UptStrKVGameData(PayCoinCountDBKey, string(saveBuff)) diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 188dab5..6b2d895 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -56,6 +56,10 @@ func (this *PolicyClawdoll) OnStart(s *base.Scene) { func (this *PolicyClawdoll) OnStop(s *base.Scene) { 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) { @@ -530,23 +534,6 @@ func (this *StateWait) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, par // 1-前 2-后 3-左 4-右 5-投币 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) //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 -强力抓 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 case rule.ClawDollPlayerOpMove: @@ -934,22 +903,6 @@ func (this *StateWaitPayCoin) OnPlayerOp(s *base.Scene, p *base.Player, opcode i playerEx.ReStartGame() 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: if sceneEx.playingSnid != playerEx.SnId { diff --git a/machine/action/action_server.go b/machine/action/action_server.go index a6ad565..23e8450 100644 --- a/machine/action/action_server.go +++ b/machine/action/action_server.go @@ -135,7 +135,7 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte // 下抓 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) if !ok { return nil diff --git a/machine/machinedoll/command.go b/machine/machinedoll/command.go index 3bb9bb2..bbe2a0f 100644 --- a/machine/machinedoll/command.go +++ b/machine/machinedoll/command.go @@ -382,8 +382,8 @@ var data = []byte{ 0x65, //0 几币几玩 0x00, //1 几币几玩占用位 0x2D, //2 游戏时间 - 0x01, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式 - 0x0A, //4 出奖概率 + 0x00, //3 出奖模式0 无概率 1 随机模式 2 固定模式 3 冠兴模式 + 0x14, //4 出奖概率 0x00, //5 出奖概率占用位 0x00, //6 空中抓物 0关闭 1开启 0x00, //7 连续投币赠送 范围0~100 diff --git a/shell/programs.txt b/shell/programs.txt index f49d1bc..2155807 100644 --- a/shell/programs.txt +++ b/shell/programs.txt @@ -4,5 +4,4 @@ gatesrv worldsrv gamesrv robot -ranksrv -machine \ No newline at end of file +ranksrv \ No newline at end of file diff --git a/webapi/deprecated.go b/webapi/deprecated.go index 4540418..bbffa29 100644 --- a/webapi/deprecated.go +++ b/webapi/deprecated.go @@ -2,10 +2,14 @@ package webapi import ( "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/protocol/webapi" - "mongo.games.com/goserver/core/logger" - "time" ) 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) return nil } + mq.Write(model.GenerateActivityLog(SnId, platform, buyType, 0)) return ret } diff --git a/worldsrv/action_bag.go b/worldsrv/action_bag.go index 76a4dab..95b2249 100644 --- a/worldsrv/action_bag.go +++ b/worldsrv/action_bag.go @@ -195,7 +195,6 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e } 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.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", "集卡活动") + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_CollectBox, 1)) default: logger.Logger.Warnf("道具使用未定义", msg.ItemId)