Merge branch 'develop' into review
This commit is contained in:
commit
9c10355acf
|
@ -566,7 +566,7 @@ const (
|
||||||
ItemIDVCard = 30001 // v卡
|
ItemIDVCard = 30001 // v卡
|
||||||
ItemIDJCard = 30002 // 金券
|
ItemIDJCard = 30002 // 金券
|
||||||
ItemDiamondScore = 100012 //钻石积分
|
ItemDiamondScore = 100012 //钻石积分
|
||||||
ItemDollCard = 74004 // 娃娃卡
|
ItemDollCard = 40004 // 娃娃卡积分
|
||||||
)
|
)
|
||||||
|
|
||||||
func ToItemId(id int32) int32 {
|
func ToItemId(id int32) int32 {
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -11,7 +11,7 @@
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"100001": 500000,
|
"100001": 500000,
|
||||||
"100004": 5
|
"100004": 20
|
||||||
},
|
},
|
||||||
"Position": [
|
"Position": [
|
||||||
1,
|
1,
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
"TargetTimes": 1,
|
"TargetTimes": 1,
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"100001": 100000,
|
"100001": 200000,
|
||||||
"100004": 20
|
"100004": 20
|
||||||
},
|
},
|
||||||
"Position": [
|
"Position": [
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"100001": 50000,
|
"100001": 50000,
|
||||||
"100004": 15
|
"100004": 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"100001": 100000,
|
"100001": 100000,
|
||||||
"100004": 30
|
"100004": 20
|
||||||
},
|
},
|
||||||
"GameType": 1
|
"GameType": 1
|
||||||
},
|
},
|
||||||
|
@ -90,11 +90,47 @@
|
||||||
"TargetTimes": 1,
|
"TargetTimes": 1,
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"100001": 100000,
|
"100001": 50000,
|
||||||
"100004": 20
|
"100004": 20
|
||||||
},
|
},
|
||||||
"GameType": 1
|
"GameType": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Id": 27,
|
||||||
|
"Order": 7,
|
||||||
|
"Name": "每日任务",
|
||||||
|
"Des": "累计充值$4.99",
|
||||||
|
"ActivityType": 1,
|
||||||
|
"TaskType": 7,
|
||||||
|
"TargetTimes": 499,
|
||||||
|
"FinishTimes": 1,
|
||||||
|
"Award": {
|
||||||
|
"100001": 1000000,
|
||||||
|
"100004": 30
|
||||||
|
},
|
||||||
|
"Position": [
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 28,
|
||||||
|
"Order": 8,
|
||||||
|
"Name": "每日任务",
|
||||||
|
"Des": "累计充值$9.99",
|
||||||
|
"ActivityType": 1,
|
||||||
|
"TaskType": 7,
|
||||||
|
"TargetTimes": 999,
|
||||||
|
"FinishTimes": 1,
|
||||||
|
"Award": {
|
||||||
|
"100001": 2000000,
|
||||||
|
"100004": 50
|
||||||
|
},
|
||||||
|
"Position": [
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Id": 7,
|
"Id": 7,
|
||||||
"Order": 1,
|
"Order": 1,
|
||||||
|
@ -116,7 +152,7 @@
|
||||||
"TargetTimes": 300,
|
"TargetTimes": 300,
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"50001": 2
|
"50001": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -140,7 +176,7 @@
|
||||||
"TargetTimes": 500,
|
"TargetTimes": 500,
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"50001": 5
|
"50001": 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -149,10 +185,10 @@
|
||||||
"Name": "周活跃任务",
|
"Name": "周活跃任务",
|
||||||
"ActivityType": 2,
|
"ActivityType": 2,
|
||||||
"TaskType": 14,
|
"TaskType": 14,
|
||||||
"TargetTimes": 600,
|
"TargetTimes": 650,
|
||||||
"FinishTimes": 1,
|
"FinishTimes": 1,
|
||||||
"Award": {
|
"Award": {
|
||||||
"100002": 10
|
"30008": 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,9 @@ func GameDetailedLogsCollection(plt string) *mongo.Collection {
|
||||||
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "gamefreeid"}, Background: true, Sparse: true})
|
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "gamefreeid"}, Background: true, Sparse: true})
|
||||||
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
|
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
|
||||||
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
|
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
|
||||||
|
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"ts", "cycleid"}, Background: true, Sparse: true})
|
||||||
|
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"time", "cycleid"}, Background: true, Sparse: true})
|
||||||
|
c_gamedetailed.EnsureIndex(mgo.Index{Key: []string{"-time", "cycleid"}, Background: true, Sparse: true})
|
||||||
}
|
}
|
||||||
return c_gamedetailed
|
return c_gamedetailed
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ func GamePlayerListLogsCollection(plt string) *mongo.Collection {
|
||||||
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "snid", "gamefreeid"}, Background: true, Sparse: true})
|
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "snid", "gamefreeid"}, Background: true, Sparse: true})
|
||||||
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
|
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"-ts", "cycleid"}, Background: true, Sparse: true})
|
||||||
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
|
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"cycleid"}, Background: true, Sparse: true})
|
||||||
|
c_gameplayerlistlog.EnsureIndex(mgo.Index{Key: []string{"ts", "cycleid"}, Background: true, Sparse: true})
|
||||||
}
|
}
|
||||||
return c_gameplayerlistlog
|
return c_gameplayerlistlog
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data
|
||||||
sceneEx.playingSnid = p.SnId
|
sceneEx.playingSnid = p.SnId
|
||||||
|
|
||||||
//发送向前移动指令
|
//发送向前移动指令
|
||||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonFront)
|
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), rule.ButtonBack)
|
||||||
|
|
||||||
s.ChangeSceneState(rule.ClawDollSceneStateStart)
|
s.ChangeSceneState(rule.ClawDollSceneStateStart)
|
||||||
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
|
sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateStart))
|
||||||
|
|
|
@ -163,7 +163,7 @@ func (this *TienLenSceneData) CanStart() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
if this.IsCustom() {
|
if this.IsCustom() {
|
||||||
return this.IsAllReady() && this.GetPlayerCnt() >= this.GetPlayerNum()
|
return (this.IsAllReady() || this.GetNumOfGames() > 0) && this.GetPlayerCnt() >= this.GetPlayerNum()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 房间人数>=2开始,并且有真人或者是预创建房间,并且有房主
|
// 房间人数>=2开始,并且有真人或者是预创建房间,并且有房主
|
||||||
|
@ -2130,6 +2130,7 @@ func (this *TienLenSceneData) SaveCustomLog() {
|
||||||
StartTs: this.GameStartTime.Unix(),
|
StartTs: this.GameStartTime.Unix(),
|
||||||
EndTs: time.Now().Unix(),
|
EndTs: time.Now().Unix(),
|
||||||
State: state,
|
State: state,
|
||||||
|
Creator: this.GetCreator(),
|
||||||
}
|
}
|
||||||
for snid := range this.BilledList {
|
for snid := range this.BilledList {
|
||||||
var items []*model.Item
|
var items []*model.Item
|
||||||
|
|
|
@ -446,6 +446,9 @@ func TienLenCreateRoomInfoPacket(s *base.Scene, p *base.Player, sceneEx *TienLen
|
||||||
if s.GetCustom().GetPassword() != "" {
|
if s.GetCustom().GetPassword() != "" {
|
||||||
pack.NeedPassword = 1
|
pack.NeedPassword = 1
|
||||||
}
|
}
|
||||||
|
if s.IsCustom() {
|
||||||
|
pack.MasterSnid = s.GetCreator()
|
||||||
|
}
|
||||||
pack.IsMatch = int32(0)
|
pack.IsMatch = int32(0)
|
||||||
// 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
|
// 0.普通场 1.锦标赛 2.冠军赛 3.vip专属
|
||||||
if s.IsMatchScene() {
|
if s.IsMatchScene() {
|
||||||
|
@ -603,6 +606,10 @@ func (this *SceneBaseStateTienLen) OnTick(s *base.Scene) {
|
||||||
s.RandRobotCnt()
|
s.RandRobotCnt()
|
||||||
s.SetTimerRandomRobot(s.GetRobotTime())
|
s.SetTimerRandomRobot(s.GetRobotTime())
|
||||||
}
|
}
|
||||||
|
// 房卡房长时间没人解散房间
|
||||||
|
if s.IsCustom() && s.GetRealPlayerCnt() == 0 && this.GetTimeout(s) > 5 {
|
||||||
|
s.Destroy(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送玩家操作情况
|
// 发送玩家操作情况
|
||||||
|
@ -719,7 +726,7 @@ func (this *SceneWaitPlayerStateTienLen) CanChangeTo(s base.SceneState) bool {
|
||||||
|
|
||||||
// 当前状态能否换桌
|
// 当前状态能否换桌
|
||||||
func (this *SceneWaitPlayerStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
func (this *SceneWaitPlayerStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
if s.IsMatchScene() {
|
if s.IsMatchScene() || (s.IsCustom() && s.GetNumOfGames() > 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -810,7 +817,7 @@ func (this *SceneWaitStartStateTienLen) CanChangeTo(s base.SceneState) bool {
|
||||||
|
|
||||||
// 当前状态能否换桌
|
// 当前状态能否换桌
|
||||||
func (this *SceneWaitStartStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
func (this *SceneWaitStartStateTienLen) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
if s.IsMatchScene() {
|
if s.IsMatchScene() || (s.IsCustom() && s.GetNumOfGames() > 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -140,7 +140,7 @@ func init() {
|
||||||
}
|
}
|
||||||
pack.List = append(pack.List, item)
|
pack.List = append(pack.List, item)
|
||||||
}
|
}
|
||||||
|
return common.ResponseTag_Ok, pack
|
||||||
default:
|
default:
|
||||||
pack.Tag = webapiproto.TagCode_FAILED
|
pack.Tag = webapiproto.TagCode_FAILED
|
||||||
pack.Msg = "未实现"
|
pack.Msg = "未实现"
|
||||||
|
|
|
@ -67,7 +67,7 @@ func processConnMessageQueue(queue *ConnMessageQueue) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 移动
|
// 移动 1-前 2-后 3-左 4-右 5-投币
|
||||||
func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error {
|
func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data interface{}) error {
|
||||||
fmt.Println("SMDollMachinePerateHandler %v", data)
|
fmt.Println("SMDollMachinePerateHandler %v", data)
|
||||||
msg, ok := data.(*machine.SMDollMachineoPerate)
|
msg, ok := data.(*machine.SMDollMachineoPerate)
|
||||||
|
@ -86,15 +86,6 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
||||||
|
|
||||||
switch msg.Perate {
|
switch msg.Perate {
|
||||||
case 1:
|
case 1:
|
||||||
//向前移动
|
|
||||||
f1 := []func(){
|
|
||||||
func() { machinedoll.Backward(conn) },
|
|
||||||
}
|
|
||||||
f2 := []func(){
|
|
||||||
func() { machinedoll.BackwardStop(conn) },
|
|
||||||
}
|
|
||||||
Process(conn, f1, f2)
|
|
||||||
case 2:
|
|
||||||
//向后移动
|
//向后移动
|
||||||
f1 := []func(){
|
f1 := []func(){
|
||||||
func() { machinedoll.Forward(conn) },
|
func() { machinedoll.Forward(conn) },
|
||||||
|
@ -103,16 +94,16 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
||||||
func() { machinedoll.ForwardStop(conn) },
|
func() { machinedoll.ForwardStop(conn) },
|
||||||
}
|
}
|
||||||
Process(conn, f1, f2)
|
Process(conn, f1, f2)
|
||||||
case 3:
|
case 2:
|
||||||
//向左移动
|
//向前移动
|
||||||
f1 := []func(){
|
f1 := []func(){
|
||||||
func() { machinedoll.Left(conn) },
|
func() { machinedoll.Backward(conn) },
|
||||||
}
|
}
|
||||||
f2 := []func(){
|
f2 := []func(){
|
||||||
func() { machinedoll.LeftStop(conn) },
|
func() { machinedoll.BackwardStop(conn) },
|
||||||
}
|
}
|
||||||
Process(conn, f1, f2)
|
Process(conn, f1, f2)
|
||||||
case 4:
|
case 3:
|
||||||
//向右移动
|
//向右移动
|
||||||
f1 := []func(){
|
f1 := []func(){
|
||||||
func() { machinedoll.Right(conn) },
|
func() { machinedoll.Right(conn) },
|
||||||
|
@ -121,6 +112,16 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
||||||
func() { machinedoll.RightStop(conn) },
|
func() { machinedoll.RightStop(conn) },
|
||||||
}
|
}
|
||||||
Process(conn, f1, f2)
|
Process(conn, f1, f2)
|
||||||
|
case 4:
|
||||||
|
//向左移动
|
||||||
|
f1 := []func(){
|
||||||
|
func() { machinedoll.Left(conn) },
|
||||||
|
}
|
||||||
|
f2 := []func(){
|
||||||
|
func() { machinedoll.LeftStop(conn) },
|
||||||
|
}
|
||||||
|
Process(conn, f1, f2)
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
//投币
|
//投币
|
||||||
conn := machinedoll.MachineMgr.CreateConn(int(msg.GetId()))
|
conn := machinedoll.MachineMgr.CreateConn(int(msg.GetId()))
|
||||||
|
|
|
@ -133,48 +133,6 @@ func (this *MachineManager) Update() {
|
||||||
pack := &machine.MSDollMachineHeartBeat{}
|
pack := &machine.MSDollMachineHeartBeat{}
|
||||||
pack.TimeStamp = time.Now().UnixMilli()
|
pack.TimeStamp = time.Now().UnixMilli()
|
||||||
SendToGameServer(int(machine.DollMachinePacketID_Packet_MSDollMachineHeartBeat), pack)
|
SendToGameServer(int(machine.DollMachinePacketID_Packet_MSDollMachineHeartBeat), pack)
|
||||||
/* var delConn []*Conn
|
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
||||||
for _, v := range this.ConnMap {
|
|
||||||
_, err := v.Write([]byte("heartbeat"))
|
|
||||||
if err != nil {
|
|
||||||
delConn = append(delConn, v)
|
|
||||||
v.Close()
|
|
||||||
fmt.Println("断开连接:%v", v.Addr)
|
|
||||||
this.UpdateToGameServer(v, 0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
|
||||||
for _, v := range delConn {
|
|
||||||
delete(this.ConnMap, v.Id)
|
|
||||||
this.DelConnMap[v.Id] = v.Addr
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重连
|
|
||||||
var delIds []*Conn
|
|
||||||
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
|
||||||
for id, addr := range this.DelConnMap {
|
|
||||||
conn, err := net.DialTimeout("tcp", addr, 5*time.Second)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
fmt.Println("娃娃机重连成功!addr = %v", addr)
|
|
||||||
delIds = append(delIds, &Conn{
|
|
||||||
Id: id,
|
|
||||||
Conn: conn,
|
|
||||||
Addr: addr,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
|
||||||
for _, v := range delIds {
|
|
||||||
this.ConnMap[v.Id] = v
|
|
||||||
delete(this.DelConnMap, v.Id)
|
|
||||||
this.UpdateToGameServer(v, 1)
|
|
||||||
}
|
|
||||||
})).StartByFixExecutor(this.ModuleName())
|
|
||||||
})).StartByFixExecutor(this.ModuleName())*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *MachineManager) Shutdown() {
|
func (this *MachineManager) Shutdown() {
|
||||||
|
|
|
@ -6,8 +6,10 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mongo.games.com/game/common"
|
"net/http"
|
||||||
"mongo.games.com/game/model"
|
"sync/atomic"
|
||||||
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core"
|
"mongo.games.com/goserver/core"
|
||||||
"mongo.games.com/goserver/core/admin"
|
"mongo.games.com/goserver/core/admin"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
@ -15,9 +17,11 @@ import (
|
||||||
"mongo.games.com/goserver/core/transact"
|
"mongo.games.com/goserver/core/transact"
|
||||||
"mongo.games.com/goserver/core/utils"
|
"mongo.games.com/goserver/core/utils"
|
||||||
"mongo.games.com/goserver/srvlib"
|
"mongo.games.com/goserver/srvlib"
|
||||||
"net/http"
|
|
||||||
"sync/atomic"
|
"mongo.games.com/game/common"
|
||||||
"time"
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/webapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -173,7 +177,15 @@ func init() {
|
||||||
}),
|
}),
|
||||||
OnChildRespWrapper: transact.OnChildRespWrapper(func(tNode *transact.TransNode, hChild transact.TransNodeID, retCode int, ud interface{}) transact.TransExeResult {
|
OnChildRespWrapper: transact.OnChildRespWrapper(func(tNode *transact.TransNode, hChild transact.TransNodeID, retCode int, ud interface{}) transact.TransExeResult {
|
||||||
logger.Logger.Tracef("GameSrvApi OnChildRespWrapper %v:%v", hChild, ud)
|
logger.Logger.Tracef("GameSrvApi OnChildRespWrapper %v:%v", hChild, ud)
|
||||||
tNode.TransEnv.SetField(GAMESRVAPI_TRANSACTE_RESPONSE, ud)
|
if v, ok := ud.([]byte); ok {
|
||||||
|
var msg webapi.SARoomInfo
|
||||||
|
err := proto.Unmarshal(netlib.SkipHeaderGetRaw(v), &msg)
|
||||||
|
if err == nil && msg.GetTag() == webapi.TagCode_SUCCESS {
|
||||||
|
tNode.TransEnv.SetField(GAMESRVAPI_TRANSACTE_RESPONSE, ud)
|
||||||
|
} else if err != nil {
|
||||||
|
logger.Logger.Errorf("GameSrvApi OnChildRespWrapper unmarshal err %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
return transact.TransExeResult(retCode)
|
return transact.TransExeResult(retCode)
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
|
@ -28,6 +28,7 @@ type CustomLog struct {
|
||||||
CostType int32 // 付费方式 1AA 2房主
|
CostType int32 // 付费方式 1AA 2房主
|
||||||
Voice int32 // 是否开启语音 1开启
|
Voice int32 // 是否开启语音 1开启
|
||||||
RoomId int32 // 房间id
|
RoomId int32 // 房间id
|
||||||
|
Creator int32 // 创建者id
|
||||||
SnId []PlayerInfo // 所有玩家
|
SnId []PlayerInfo // 所有玩家
|
||||||
List []RoundInfo // 对局记录
|
List []RoundInfo // 对局记录
|
||||||
StartTs, EndTs int64 // 开始,结束时间
|
StartTs, EndTs int64 // 开始,结束时间
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -248,6 +248,7 @@ message RoomInfo{
|
||||||
string Password = 22;// 密码
|
string Password = 22;// 密码
|
||||||
int32 CostType = 23;// 付费方式 1房主 2AA
|
int32 CostType = 23;// 付费方式 1房主 2AA
|
||||||
int32 Voice = 24;// 语音开关 1开启
|
int32 Voice = 24;// 语音开关 1开启
|
||||||
|
int32 PlayerNum = 25; // 房间最大人数
|
||||||
}
|
}
|
||||||
|
|
||||||
message PlayerSingleAdjust{
|
message PlayerSingleAdjust{
|
||||||
|
@ -912,6 +913,9 @@ message MachineInfo{
|
||||||
int64 AppId = 2;
|
int64 AppId = 2;
|
||||||
string ServerSecret = 3;
|
string ServerSecret = 3;
|
||||||
string StreamId = 4;
|
string StreamId = 4;
|
||||||
|
int32 CostItemNum = 5; //消耗道具数量
|
||||||
|
int32 ItemId = 6; //获得道具Id
|
||||||
|
int32 ItemNum = 7; //获得道具数量
|
||||||
}
|
}
|
||||||
// etcd /game/match_audience
|
// etcd /game/match_audience
|
||||||
message MatchAudience {
|
message MatchAudience {
|
||||||
|
|
|
@ -212,7 +212,11 @@ func (this *CSLoginHandler) Process(s *netlib.Session, packetid int, data interf
|
||||||
// lss 其它连接
|
// lss 其它连接
|
||||||
lss := LoginStateMgrSington.LoginFinish(csl.GetUsername(), csl.GetPlatform(), sid, ls.acc, tagkey)
|
lss := LoginStateMgrSington.LoginFinish(csl.GetUsername(), csl.GetPlatform(), sid, ls.acc, tagkey)
|
||||||
player := PlayerMgrSington.GetPlayerBySnId(ls.acc.SnId)
|
player := PlayerMgrSington.GetPlayerBySnId(ls.acc.SnId)
|
||||||
if len(lss) > 0 && (player != nil && (player.scene != nil || player.thrscene != 0)) {
|
waitMatch := false
|
||||||
|
if player != nil {
|
||||||
|
waitMatch, _ = TournamentMgr.IsMatchWaiting(player.Platform, player.SnId)
|
||||||
|
}
|
||||||
|
if len(lss) > 0 && (player != nil && (player.scene != nil || player.thrscene != 0 || waitMatch || TournamentMgr.IsMatching(player.SnId))) {
|
||||||
sendSCLogin(login_proto.OpResultCode_OPRC_LoginOtherPlace)
|
sendSCLogin(login_proto.OpResultCode_OPRC_LoginOtherPlace)
|
||||||
sendSCDisconnect(common.KickReason_Logining)
|
sendSCDisconnect(common.KickReason_Logining)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -2819,27 +2819,33 @@ func CSBillList(s *netlib.Session, packetId int, data interface{}, sid int64) er
|
||||||
fromIndex := msg.GetPageNo() * msg.GetPageSize()
|
fromIndex := msg.GetPageNo() * msg.GetPageSize()
|
||||||
toIndex := fromIndex + msg.GetPageSize()
|
toIndex := fromIndex + msg.GetPageSize()
|
||||||
|
|
||||||
logs, _, err := model.GetCoinLogGame(p.Platform, p.SnId, common.BillTypeCoin, startTs, endTs, int(fromIndex), int(toIndex))
|
var err error
|
||||||
if err != nil {
|
var logs []model.CoinLog
|
||||||
logger.Logger.Errorf("GetCoinLogGame err:%v", err)
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCBillList), ret)
|
logs, _, err = model.GetCoinLogGame(p.Platform, p.SnId, common.BillTypeCoin, startTs, endTs, int(fromIndex), int(toIndex))
|
||||||
return err
|
return nil
|
||||||
}
|
}), task.CompleteNotifyWrapper(func(i interface{}, t task.Task) {
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("GetCoinLogGame err:%v", err)
|
||||||
|
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCBillList), ret)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for _, v := range logs {
|
for _, v := range logs {
|
||||||
ret.Items = append(ret.Items, &player_proto.BillItem{
|
ret.Items = append(ret.Items, &player_proto.BillItem{
|
||||||
Ts: v.Ts,
|
Ts: v.Ts,
|
||||||
Id: v.LogId.Hex(),
|
Id: v.LogId.Hex(),
|
||||||
BillType: int64(v.LogType),
|
BillType: int64(v.LogType),
|
||||||
Amount: v.Count,
|
Amount: v.Count,
|
||||||
Balance: v.RestCount,
|
Balance: v.RestCount,
|
||||||
GameID: int64(v.InGame),
|
GameID: int64(v.InGame),
|
||||||
GameFreeID: v.GameFreeId,
|
GameFreeID: v.GameFreeId,
|
||||||
BaseCoin: v.BaseCoin,
|
BaseCoin: v.BaseCoin,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCBillList), ret)
|
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCBillList), ret)
|
||||||
logger.Logger.Tracef("SCBillList pageNo:%d, pageSize:%d %v", msg.GetPageNo(), msg.GetPageSize(), ret)
|
logger.Logger.Tracef("SCBillList pageNo:%d, pageSize:%d %v", msg.GetPageNo(), msg.GetPageSize(), ret)
|
||||||
|
}), "GetCoinLogGame").Start()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -307,13 +307,20 @@ func (this *LoginStateMgr) Init() {
|
||||||
func (this *LoginStateMgr) Update() {
|
func (this *LoginStateMgr) Update() {
|
||||||
// 定时清理已经登出的账号数据
|
// 定时清理已经登出的账号数据
|
||||||
curTs := time.Now().Unix()
|
curTs := time.Now().Unix()
|
||||||
for name, s := range this.statesByPlayer {
|
var delAcc []*AccLoginState
|
||||||
|
for _, s := range this.statesByPlayer {
|
||||||
|
if s == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if len(s.lss) == 0 && curTs-s.lastLogoutTs > int64(model.GameParamData.LoginStateCacheSec) {
|
if len(s.lss) == 0 && curTs-s.lastLogoutTs > int64(model.GameParamData.LoginStateCacheSec) {
|
||||||
if s != nil && s.acc != nil {
|
if s.acc != nil {
|
||||||
this.DeleteAccount(name, s)
|
delAcc = append(delAcc, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, s := range delAcc {
|
||||||
|
this.DeleteAccount(s.acc.AccountId.Hex(), s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *LoginStateMgr) Shutdown() {
|
func (this *LoginStateMgr) Shutdown() {
|
||||||
|
|
|
@ -431,6 +431,7 @@ func (this *Player) OnRehold() {
|
||||||
FriendUnreadMgrSington.CheckSendFriendUnreadData(this.Platform, this.SnId)
|
FriendUnreadMgrSington.CheckSendFriendUnreadData(this.Platform, this.SnId)
|
||||||
|
|
||||||
if !this.IsRob {
|
if !this.IsRob {
|
||||||
|
TournamentMgr.Quit(this.Platform, this.SnId) // 比赛没有开始,退赛
|
||||||
this.SendJackPotInit()
|
this.SendJackPotInit()
|
||||||
PlayerOnlineSington.Check = true
|
PlayerOnlineSington.Check = true
|
||||||
|
|
||||||
|
|
|
@ -644,293 +644,6 @@ func (this *PlayerMgr) EndPlayerLoading(accid string) int64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
//func PlayerRankGe(p1, p2 *Player, n int) bool {
|
|
||||||
// switch n {
|
|
||||||
// case 0:
|
|
||||||
// if p1.TotalCoin == p2.TotalCoin {
|
|
||||||
// return p1.SnId < p2.SnId
|
|
||||||
// } else {
|
|
||||||
// return p1.TotalCoin > p2.TotalCoin
|
|
||||||
// }
|
|
||||||
// case 1:
|
|
||||||
// if p1.CoinPayTotal == p2.CoinPayTotal {
|
|
||||||
// return p1.SnId < p2.SnId
|
|
||||||
// } else {
|
|
||||||
// return p1.CoinPayTotal > p2.CoinPayTotal
|
|
||||||
// }
|
|
||||||
// case 2:
|
|
||||||
// if p1.CoinExchangeTotal == p2.CoinExchangeTotal {
|
|
||||||
// return p1.SnId < p2.SnId
|
|
||||||
// } else {
|
|
||||||
// return p1.CoinExchangeTotal > p2.CoinExchangeTotal
|
|
||||||
// }
|
|
||||||
// case 3:
|
|
||||||
// a := p1.Coin + p1.SafeBoxCoin - p1.CoinPayTotal
|
|
||||||
// b := p2.Coin + p2.SafeBoxCoin - p2.CoinPayTotal
|
|
||||||
// if a == b {
|
|
||||||
// return p1.SnId < p2.SnId
|
|
||||||
// } else {
|
|
||||||
// return a > b
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// return false
|
|
||||||
//}
|
|
||||||
|
|
||||||
// func (this *PlayerMgr) GetRank() map[string][]*model.Rank {
|
|
||||||
// ret := make(map[string][]*model.Rank)
|
|
||||||
// ls := make(map[string]*list.List)
|
|
||||||
//
|
|
||||||
// platforms := PlatformMgrSingleton.Platforms
|
|
||||||
// for p := range platforms {
|
|
||||||
// ret[p] = make([]*model.Rank, 0)
|
|
||||||
// ls[p] = list.New()
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for _, player := range this.players {
|
|
||||||
// if player.IsRob {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// p := player.PlayerData.Platform
|
|
||||||
// if _, ok := platforms[p]; !ok {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// l := ls[p]
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// if PlayerRankGe(player, np) {
|
|
||||||
// l.InsertBefore(player, n)
|
|
||||||
// goto CHECK
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //else {
|
|
||||||
// // logger.Logger.Warnf("PlayerMgr.GetRank n.Value.(*Player) fail")
|
|
||||||
// // continue
|
|
||||||
// //}
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// l.PushBack(player)
|
|
||||||
// CHECK:
|
|
||||||
// if l.Len() > model.MAX_RANK_COUNT {
|
|
||||||
// l.Remove(l.Back())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for p := range platforms {
|
|
||||||
// l := ls[p]
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// ret[p] = append(ret[p], &model.Rank{
|
|
||||||
// SnId: np.PlayerData.SnId,
|
|
||||||
// Name: np.PlayerData.Name,
|
|
||||||
// Head: np.PlayerData.Head,
|
|
||||||
// VIP: np.PlayerData.VIP,
|
|
||||||
// TotalCoin: np.PlayerData.TotalCoin,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return ret
|
|
||||||
// }
|
|
||||||
|
|
||||||
//func (this *PlayerMgr) GetAssetRank(platform string) []*model.Rank {
|
|
||||||
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
||||||
// l := list.New()
|
|
||||||
//
|
|
||||||
// for _, player := range this.players {
|
|
||||||
// if player.IsRob {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if player.PlayerData.Platform != platform {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// if PlayerRankGe(player, np, 0) {
|
|
||||||
// l.InsertBefore(player, n)
|
|
||||||
// goto CHECK
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// l.PushBack(player)
|
|
||||||
// CHECK:
|
|
||||||
// if l.Len() > model.MAX_RANK_COUNT {
|
|
||||||
// l.Remove(l.Back())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// ret = append(ret, &model.Rank{
|
|
||||||
// SnId: np.PlayerData.SnId,
|
|
||||||
// Name: np.PlayerData.Name,
|
|
||||||
// Head: np.PlayerData.Head,
|
|
||||||
// VIP: np.PlayerData.VIP,
|
|
||||||
// TotalCoin: np.PlayerData.TotalCoin,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return ret
|
|
||||||
//}
|
|
||||||
|
|
||||||
//func (this *PlayerMgr) GetRechargeLists(platform string) []*model.Rank {
|
|
||||||
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
||||||
// l := list.New()
|
|
||||||
//
|
|
||||||
// for _, player := range this.players {
|
|
||||||
// if player.IsRob {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if player.PlayerData.Platform != platform {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// if PlayerRankGe(player, np, 1) {
|
|
||||||
// l.InsertBefore(player, n)
|
|
||||||
// goto CHECK
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// l.PushBack(player)
|
|
||||||
// CHECK:
|
|
||||||
// if l.Len() > model.MAX_RANK_COUNT {
|
|
||||||
// l.Remove(l.Back())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// ret = append(ret, &model.Rank{
|
|
||||||
// SnId: np.PlayerData.SnId,
|
|
||||||
// Name: np.PlayerData.Name,
|
|
||||||
// Head: np.PlayerData.Head,
|
|
||||||
// VIP: np.PlayerData.VIP,
|
|
||||||
// TotalCoin: np.PlayerData.CoinPayTotal,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return ret
|
|
||||||
//}
|
|
||||||
|
|
||||||
//func (this *PlayerMgr) GetExchangeLists(platform string) []*model.Rank {
|
|
||||||
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
||||||
// l := list.New()
|
|
||||||
//
|
|
||||||
// for _, player := range this.players {
|
|
||||||
// if player.IsRob {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if player.PlayerData.Platform != platform {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// if PlayerRankGe(player, np, 2) {
|
|
||||||
// l.InsertBefore(player, n)
|
|
||||||
// goto CHECK
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// l.PushBack(player)
|
|
||||||
// CHECK:
|
|
||||||
// if l.Len() > model.MAX_RANK_COUNT {
|
|
||||||
// l.Remove(l.Back())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// ret = append(ret, &model.Rank{
|
|
||||||
// SnId: np.PlayerData.SnId,
|
|
||||||
// Name: np.PlayerData.Name,
|
|
||||||
// Head: np.PlayerData.Head,
|
|
||||||
// VIP: np.PlayerData.VIP,
|
|
||||||
// TotalCoin: np.PlayerData.CoinExchangeTotal,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return ret
|
|
||||||
//}
|
|
||||||
|
|
||||||
//func (this *PlayerMgr) GetProfitLists(platform string) []*model.Rank {
|
|
||||||
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
||||||
// l := list.New()
|
|
||||||
//
|
|
||||||
// for _, player := range this.players {
|
|
||||||
// if player.IsRob {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if player.PlayerData.Platform != platform {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// if PlayerRankGe(player, np, 3) {
|
|
||||||
// l.InsertBefore(player, n)
|
|
||||||
// goto CHECK
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// l.PushBack(player)
|
|
||||||
// CHECK:
|
|
||||||
// if l.Len() > model.MAX_RANK_COUNT {
|
|
||||||
// l.Remove(l.Back())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for n := l.Front(); n != nil; n = n.Next() {
|
|
||||||
// if np, ok := n.Value.(*Player); ok {
|
|
||||||
// ret = append(ret, &model.Rank{
|
|
||||||
// SnId: np.PlayerData.SnId,
|
|
||||||
// Name: np.PlayerData.Name,
|
|
||||||
// Head: np.PlayerData.Head,
|
|
||||||
// VIP: np.PlayerData.VIP,
|
|
||||||
// //TotalCoin: np.PlayerData.ProfitCoin,
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return ret
|
|
||||||
//}
|
|
||||||
|
|
||||||
//func (this *PlayerMgr) DeletePlayerByPlatform(platform string) {
|
|
||||||
// var dels []*Player
|
|
||||||
// for _, p := range this.players {
|
|
||||||
// if p != nil && p.Platform == platform {
|
|
||||||
// p.Kickout(common.KickReason_Disconnection)
|
|
||||||
// dels = append(dels, p)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// for _, p := range dels {
|
|
||||||
// if p != nil {
|
|
||||||
// p.isDelete = true
|
|
||||||
// if p.scene == nil {
|
|
||||||
// this.DelPlayer(p.SnId)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
func (this *PlayerMgr) StatsOnline() model.PlayerOLStats {
|
func (this *PlayerMgr) StatsOnline() model.PlayerOLStats {
|
||||||
stats := model.PlayerOLStats{
|
stats := model.PlayerOLStats{
|
||||||
PlatformStats: make(map[string]*model.PlayerStats),
|
PlatformStats: make(map[string]*model.PlayerStats),
|
||||||
|
|
|
@ -199,6 +199,7 @@ func (m *SceneMgr) MarshalAllRoom(platform string, groupId, gameId int, gameMode
|
||||||
Password: s.GetPassword(),
|
Password: s.GetPassword(),
|
||||||
CostType: s.GetCostType(),
|
CostType: s.GetCostType(),
|
||||||
Voice: s.GetVoice(),
|
Voice: s.GetVoice(),
|
||||||
|
PlayerNum: int32(s.playerNum),
|
||||||
}
|
}
|
||||||
if s.starting {
|
if s.starting {
|
||||||
si.Start = 1
|
si.Start = 1
|
||||||
|
|
|
@ -507,8 +507,17 @@ func (this *Tournament) IsMatchWaiting(platform string, snId int32) (bool, int32
|
||||||
// 未使用机器人
|
// 未使用机器人
|
||||||
for k, v := range this.signupPlayers[platform] {
|
for k, v := range this.signupPlayers[platform] {
|
||||||
if v.signup != nil {
|
if v.signup != nil {
|
||||||
_, ok := v.signup[snId]
|
if _, ok := v.signup[snId]; ok {
|
||||||
return ok, k
|
return ok, k
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for k, v := range this.matches {
|
||||||
|
for _, vv := range v {
|
||||||
|
if _, ok := vv.TmPlayer[snId]; ok {
|
||||||
|
return true, k
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue