Compare commits
23 Commits
c6799597c3
...
a3b95947b0
| Author | SHA1 | Date |
|---|---|---|
|
|
a3b95947b0 | |
|
|
ac7492c2db | |
|
|
663b93d52d | |
|
|
9a9c62c1da | |
|
|
65aa4efebb | |
|
|
3d653d6413 | |
|
|
33a087d1d7 | |
|
|
aadfc98306 | |
|
|
4fb1ec47b9 | |
|
|
c45f5457ab | |
|
|
c8cf242a09 | |
|
|
b0315b0e70 | |
|
|
8418435068 | |
|
|
8ac802e2a3 | |
|
|
d632386936 | |
|
|
c1d2925933 | |
|
|
71ad21de65 | |
|
|
b4765bf686 | |
|
|
4745a067aa | |
|
|
0e53147f13 | |
|
|
d792e0ceb1 | |
|
|
79ace9a7bf | |
|
|
ad363f7d85 |
|
|
@ -6,6 +6,8 @@
|
||||||
# Folders
|
# Folders
|
||||||
_obj
|
_obj
|
||||||
_test
|
_test
|
||||||
|
/bin/*
|
||||||
|
**/backup
|
||||||
|
|
||||||
# Architecture specific extensions/prefixes
|
# Architecture specific extensions/prefixes
|
||||||
*.[568vq]
|
*.[568vq]
|
||||||
|
|
@ -35,11 +37,8 @@ _testmain.go
|
||||||
/dbproxy/dbproxy
|
/dbproxy/dbproxy
|
||||||
/mgrsrv/mgrsrv
|
/mgrsrv/mgrsrv
|
||||||
/gatesrv/gatesrv
|
/gatesrv/gatesrv
|
||||||
/gamesrv/gamesrv
|
|
||||||
/worldsrv/worldsrv
|
/worldsrv/worldsrv
|
||||||
|
/gamesrv/gamesrv
|
||||||
/robot/robot
|
/robot/robot
|
||||||
/schedulesrv/schedulesrv
|
|
||||||
/ranksrv/ranksrv
|
/ranksrv/ranksrv
|
||||||
|
/schedulesrv/schedulesrv
|
||||||
/bin/*
|
|
||||||
**/backup
|
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,6 @@ update_public.sh
|
||||||
#### gen_go.bat
|
#### gen_go.bat
|
||||||
proto文件生成go文件
|
proto文件生成go文件
|
||||||
|
|
||||||
#### gen_web.bat
|
|
||||||
proto文件生成go文件
|
|
||||||
|
|
||||||
#### build.bat
|
#### build.bat
|
||||||
生成可执行文件
|
生成可执行文件
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@ const (
|
||||||
GameID_ThirteenFree = 213 // 十三张(自由场经典场)
|
GameID_ThirteenFree = 213 // 十三张(自由场经典场)
|
||||||
GameID_ThirteenFreeLaiZi = 214 // 十三张(自由场癞子场)
|
GameID_ThirteenFreeLaiZi = 214 // 十三张(自由场癞子场)
|
||||||
__GameId_Slot_Min__ = 300 //################拉霸类################
|
__GameId_Slot_Min__ = 300 //################拉霸类################
|
||||||
GameId_CaiShen = 301 //财神
|
GameId_CaiShen = 301 // 财神
|
||||||
GameId_Avengers = 302 //复仇者联盟
|
GameId_Avengers = 302 // 复仇者联盟
|
||||||
GameId_EasterIsland = 303 //复活岛
|
GameId_EasterIsland = 303 // 复活岛
|
||||||
GameId_IceAge = 304 //冰河世纪
|
GameId_IceAge = 304 // 冰河世纪
|
||||||
GameId_TamQuoc = 305 //百战成神
|
GameId_TamQuoc = 305 // 百战成神
|
||||||
GameId_Fruits = 306 //水果拉霸
|
GameId_Fruits = 306 // 水果拉霸
|
||||||
GameId_Richblessed = 307 //多福多财
|
GameId_Richblessed = 307 // 多福多财
|
||||||
__GameId_Fishing_Min__ = 400 //################捕鱼类################
|
__GameId_Fishing_Min__ = 400 //################捕鱼类################
|
||||||
GameId_HFishing = 401 //欢乐捕鱼
|
GameId_HFishing = 401 //欢乐捕鱼
|
||||||
GameId_TFishing = 402 //天天捕鱼
|
GameId_TFishing = 402 //天天捕鱼
|
||||||
|
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
|
@ -54,18 +54,6 @@
|
||||||
"GameId": 401,
|
"GameId": 401,
|
||||||
"GameDif": "401"
|
"GameDif": "401"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"Id": 30600,
|
|
||||||
"Name": "水果拉霸",
|
|
||||||
"GameId": 306,
|
|
||||||
"GameDif": "306"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Id": 30400,
|
|
||||||
"Name": "冰河世纪",
|
|
||||||
"GameId": 304,
|
|
||||||
"GameDif": "304"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"Id": 52100,
|
"Id": 52100,
|
||||||
"Name": "ChessCambodian",
|
"Name": "ChessCambodian",
|
||||||
|
|
@ -165,6 +153,48 @@
|
||||||
"Name": "小火箭",
|
"Name": "小火箭",
|
||||||
"GameId": 607,
|
"GameId": 607,
|
||||||
"GameDif": "607"
|
"GameDif": "607"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30100,
|
||||||
|
"Name": "财运神",
|
||||||
|
"GameId": 301,
|
||||||
|
"GameDif": "301"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30200,
|
||||||
|
"Name": "复仇者联盟",
|
||||||
|
"GameId": 302,
|
||||||
|
"GameDif": "302"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30300,
|
||||||
|
"Name": "复活节岛",
|
||||||
|
"GameId": 303,
|
||||||
|
"GameDif": "303"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30400,
|
||||||
|
"Name": "冰河世纪",
|
||||||
|
"GameId": 304,
|
||||||
|
"GameDif": "304"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30500,
|
||||||
|
"Name": "百战成神",
|
||||||
|
"GameId": 305,
|
||||||
|
"GameDif": "305"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30600,
|
||||||
|
"Name": "水果拉霸",
|
||||||
|
"GameId": 306,
|
||||||
|
"GameDif": "306"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 30700,
|
||||||
|
"Name": "多财多福",
|
||||||
|
"GameId": 307,
|
||||||
|
"GameDif": "307"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
6т├у├ж├в├с├"║█ю└=
|
6у├ж├в├с├т├"║█ю└=
|
||||||
.з├ш├ь├ы├"║█ю└=
|
.ы├з├ш├ь├"║█ю└=
|
||||||
Wс├в├ь├ы├ш├т├у├ж├з├" ║█─╜Б
|
Wь├ы├т├у├в├ш├с├ж├з├" ║█─╜Б
|
||||||
]т├у├ж├ы├з├э├с├в├ь├ш├"╒█Т
|
]в├ь├ы├з├э├с├т├у├ж├ш├"╒█Т
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.etcd.io/etcd/client/v3"
|
"go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
"mongo.games.com/game/dbproxy/mongo"
|
"mongo.games.com/game/dbproxy/mongo"
|
||||||
|
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
etcd.Register(etcd.ETCDKEY_SYS_PLT_DBCFG_PREFIX, webapi.PlatformDbConfig{}, func(completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
etcd.Register(etcd.ETCDKEY_SYS_PLT_DBCFG_PREFIX, webapi.PlatformDbConfig{}, func(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
||||||
if event.Type == clientv3.EventTypeDelete {
|
if event.Type == clientv3.EventTypeDelete {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,8 +143,10 @@ func newMgoSession(user, password, host string, port int32, options string) (s *
|
||||||
// [mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options]
|
// [mongodb://][user:pass@]host1[:port1][,host2[:port2],...][/database][?options]
|
||||||
url := fmt.Sprintf("mongodb://%s%s:%d/admin%s", login, host, port, options)
|
url := fmt.Sprintf("mongodb://%s%s:%d/admin%s", login, host, port, options)
|
||||||
//fmt.Println(url)
|
//fmt.Println(url)
|
||||||
|
logger.Logger.Tracef("newMgoSession url:%s", url)
|
||||||
session, err := mgo.Dial(url)
|
session, err := mgo.Dial(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("newMgoSession err:%v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
session.SetSafe(&mgo.Safe{})
|
session.SetSafe(&mgo.Safe{})
|
||||||
|
|
@ -240,7 +242,7 @@ func (msm *MgoSessionMgr) GetPltMgoSession(plt, key string) *Session {
|
||||||
if c, ok := msm.GetCfg(plt, key); ok {
|
if c, ok := msm.GetCfg(plt, key); ok {
|
||||||
s, err := newMgoSession(c.Username, c.Password, c.HostName, c.HostPort, c.Options)
|
s, err := newMgoSession(c.Username, c.Password, c.HostName, c.HostPort, c.Options)
|
||||||
if s == nil || err != nil {
|
if s == nil || err != nil {
|
||||||
logger.Logger.Error("GetPltMgoSession(%s,%s) err:%v", plt, key, err)
|
logger.Logger.Errorf("GetPltMgoSession(%s,%s) err:%v config:%+v", plt, key, err, *c)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
ss := &Session{Session: s, cfg: c}
|
ss := &Session{Session: s, cfg: c}
|
||||||
|
|
|
||||||
|
|
@ -31,21 +31,21 @@ type Client struct {
|
||||||
closed bool
|
closed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Client) IsClosed() bool {
|
func (c *Client) IsClosed() bool {
|
||||||
return this.closed
|
return c.closed
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Client) Ctx() context.Context {
|
func (c *Client) Ctx() context.Context {
|
||||||
if this.cli != nil {
|
if c.cli != nil {
|
||||||
return this.cli.Ctx()
|
return c.cli.Ctx()
|
||||||
}
|
}
|
||||||
return context.TODO()
|
return context.TODO()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Client) Open(etcdUrl []string, userName, passWord string, dialTimeout time.Duration) error {
|
func (c *Client) Open(etcdUrl []string, userName, passWord string, dialTimeout time.Duration) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
this.cli, err = clientv3.New(clientv3.Config{
|
c.cli, err = clientv3.New(clientv3.Config{
|
||||||
Endpoints: etcdUrl,
|
Endpoints: etcdUrl,
|
||||||
Username: userName,
|
Username: userName,
|
||||||
Password: passWord,
|
Password: passWord,
|
||||||
|
|
@ -59,22 +59,22 @@ func (this *Client) Open(etcdUrl []string, userName, passWord string, dialTimeou
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
this.closed = false
|
c.closed = false
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Client) Close() error {
|
func (c *Client) Close() error {
|
||||||
logger.Logger.Warn("EtcdClient.close")
|
logger.Logger.Warn("EtcdClient.close")
|
||||||
this.closed = true
|
c.closed = true
|
||||||
if this.cli != nil {
|
if c.cli != nil {
|
||||||
return this.cli.Close()
|
return c.cli.Close()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutValue 添加键值对
|
// PutValue 添加键值对
|
||||||
func (this *Client) PutValue(key, value string) (*clientv3.PutResponse, error) {
|
func (c *Client) PutValue(key, value string) (*clientv3.PutResponse, error) {
|
||||||
resp, err := this.cli.Put(context.TODO(), key, value)
|
resp, err := c.cli.Put(context.TODO(), key, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Warnf("EtcdClient.PutValue(%v,%v) error:%v", key, value, err)
|
logger.Logger.Warnf("EtcdClient.PutValue(%v,%v) error:%v", key, value, err)
|
||||||
}
|
}
|
||||||
|
|
@ -82,8 +82,8 @@ func (this *Client) PutValue(key, value string) (*clientv3.PutResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetValue 查询
|
// GetValue 查询
|
||||||
func (this *Client) GetValue(key string) (*clientv3.GetResponse, error) {
|
func (c *Client) GetValue(key string) (*clientv3.GetResponse, error) {
|
||||||
resp, err := this.cli.Get(context.TODO(), key)
|
resp, err := c.cli.Get(context.TODO(), key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Warnf("EtcdClient.GetValue(%v) error:%v", key, err)
|
logger.Logger.Warnf("EtcdClient.GetValue(%v) error:%v", key, err)
|
||||||
}
|
}
|
||||||
|
|
@ -91,8 +91,8 @@ func (this *Client) GetValue(key string) (*clientv3.GetResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DelValue 返回删除了几条数据
|
// DelValue 返回删除了几条数据
|
||||||
func (this *Client) DelValue(key string) (*clientv3.DeleteResponse, error) {
|
func (c *Client) DelValue(key string) (*clientv3.DeleteResponse, error) {
|
||||||
res, err := this.cli.Delete(context.TODO(), key)
|
res, err := c.cli.Delete(context.TODO(), key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Warnf("EtcdClient.DelValue(%v) error:%v", key, err)
|
logger.Logger.Warnf("EtcdClient.DelValue(%v) error:%v", key, err)
|
||||||
}
|
}
|
||||||
|
|
@ -100,8 +100,8 @@ func (this *Client) DelValue(key string) (*clientv3.DeleteResponse, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DelValueWithPrefix 按照前缀删除
|
// DelValueWithPrefix 按照前缀删除
|
||||||
func (this *Client) DelValueWithPrefix(prefix string) (*clientv3.DeleteResponse, error) {
|
func (c *Client) DelValueWithPrefix(prefix string) (*clientv3.DeleteResponse, error) {
|
||||||
res, err := this.cli.Delete(context.TODO(), prefix, clientv3.WithPrefix())
|
res, err := c.cli.Delete(context.TODO(), prefix, clientv3.WithPrefix())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Warnf("EtcdClient.DelValueWithPrefix(%v) error:%v", prefix, err)
|
logger.Logger.Warnf("EtcdClient.DelValueWithPrefix(%v) error:%v", prefix, err)
|
||||||
}
|
}
|
||||||
|
|
@ -109,8 +109,8 @@ func (this *Client) DelValueWithPrefix(prefix string) (*clientv3.DeleteResponse,
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetValueWithPrefix 获取前缀
|
// GetValueWithPrefix 获取前缀
|
||||||
func (this *Client) GetValueWithPrefix(prefix string) (*clientv3.GetResponse, error) {
|
func (c *Client) GetValueWithPrefix(prefix string) (*clientv3.GetResponse, error) {
|
||||||
resp, err := this.cli.Get(context.TODO(), prefix, clientv3.WithPrefix())
|
resp, err := c.cli.Get(context.TODO(), prefix, clientv3.WithPrefix())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Logger.Warnf("EtcdClient.GetValueWIthPrefix(%v) error:%v", prefix, err)
|
logger.Logger.Warnf("EtcdClient.GetValueWIthPrefix(%v) error:%v", prefix, err)
|
||||||
}
|
}
|
||||||
|
|
@ -118,13 +118,13 @@ func (this *Client) GetValueWithPrefix(prefix string) (*clientv3.GetResponse, er
|
||||||
}
|
}
|
||||||
|
|
||||||
// WatchWithPrefix 监测前缀创建事件
|
// WatchWithPrefix 监测前缀创建事件
|
||||||
func (this *Client) WatchWithPrefix(prefix string, revision int64) clientv3.WatchChan {
|
func (c *Client) WatchWithPrefix(prefix string, revision int64) clientv3.WatchChan {
|
||||||
if this.cli != nil {
|
if c.cli != nil {
|
||||||
opts := []clientv3.OpOption{clientv3.WithPrefix(), clientv3.WithCreatedNotify()}
|
opts := []clientv3.OpOption{clientv3.WithPrefix(), clientv3.WithCreatedNotify()}
|
||||||
if revision > 0 {
|
if revision > 0 {
|
||||||
opts = append(opts, clientv3.WithRev(revision))
|
opts = append(opts, clientv3.WithRev(revision))
|
||||||
}
|
}
|
||||||
return this.cli.Watch(clientv3.WithRequireLeader(context.Background()), prefix, opts...)
|
return c.cli.Watch(clientv3.WithRequireLeader(context.Background()), prefix, opts...)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -160,41 +160,41 @@ func (this *Client) WatchWithPrefix(prefix string, revision int64) clientv3.Watc
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// AddFunc 添加监听函数
|
// AddFunc 添加监听函数
|
||||||
func (this *Client) AddFunc(initFunc InitFunc, watchFunc WatchFunc) {
|
func (c *Client) AddFunc(initFunc InitFunc, watchFunc WatchFunc) {
|
||||||
funcPair := FuncPair{
|
funcPair := FuncPair{
|
||||||
initFunc: initFunc,
|
initFunc: initFunc,
|
||||||
watchFunc: watchFunc,
|
watchFunc: watchFunc,
|
||||||
}
|
}
|
||||||
this.functions = append(this.functions, funcPair)
|
c.functions = append(c.functions, funcPair)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReInitAndWatchAll 重新监听
|
// ReInitAndWatchAll 重新监听
|
||||||
func (this *Client) ReInitAndWatchAll() {
|
func (c *Client) ReInitAndWatchAll() {
|
||||||
if this.closed {
|
if c.closed {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
oldFunc := this.functions
|
oldFunc := c.functions
|
||||||
this.functions = nil
|
c.functions = nil
|
||||||
for i := 0; i < len(oldFunc); i++ {
|
for i := 0; i < len(oldFunc); i++ {
|
||||||
this.InitAndWatch(oldFunc[i].initFunc, oldFunc[i].watchFunc)
|
c.InitAndWatch(oldFunc[i].initFunc, oldFunc[i].watchFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitAndWatch 开始监听
|
// InitAndWatch 开始监听
|
||||||
func (this *Client) InitAndWatch(initFunc InitFunc, watchFunc WatchFunc) {
|
func (c *Client) InitAndWatch(initFunc InitFunc, watchFunc WatchFunc) {
|
||||||
funcPair := FuncPair{
|
funcPair := FuncPair{
|
||||||
initFunc: initFunc,
|
initFunc: initFunc,
|
||||||
watchFunc: watchFunc,
|
watchFunc: watchFunc,
|
||||||
}
|
}
|
||||||
this.functions = append(this.functions, funcPair)
|
c.functions = append(c.functions, funcPair)
|
||||||
lastRevision := initFunc()
|
lastRevision := initFunc()
|
||||||
ctx, _ := context.WithCancel(this.cli.Ctx())
|
ctx, _ := context.WithCancel(c.cli.Ctx())
|
||||||
watchFunc(ctx, lastRevision+1)
|
watchFunc(ctx, lastRevision+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GoWatch 异步监听
|
// GoWatch 异步监听
|
||||||
func (this *Client) GoWatch(ctx context.Context, revision int64, prefix string, f func(res clientv3.WatchResponse) error) {
|
func (c *Client) GoWatch(ctx context.Context, revision int64, prefix string, f func(res clientv3.WatchResponse) error) {
|
||||||
go func() {
|
go func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := recover(); err != nil {
|
if err := recover(); err != nil {
|
||||||
|
|
@ -203,10 +203,10 @@ func (this *Client) GoWatch(ctx context.Context, revision int64, prefix string,
|
||||||
logger.Logger.Warnf("etcd watch WithPrefix(%v) quit!!!", prefix)
|
logger.Logger.Warnf("etcd watch WithPrefix(%v) quit!!!", prefix)
|
||||||
}()
|
}()
|
||||||
var times int64
|
var times int64
|
||||||
for !this.closed {
|
for !c.closed {
|
||||||
times++
|
times++
|
||||||
logger.Logger.Warnf("etcd watch WithPrefix(%v) base revision %v start[%v]!!!", prefix, revision, times)
|
logger.Logger.Warnf("etcd watch WithPrefix(%v) base revision %v start[%v]!!!", prefix, revision, times)
|
||||||
rch := this.WatchWithPrefix(prefix, revision)
|
rch := c.WatchWithPrefix(prefix, revision)
|
||||||
for {
|
for {
|
||||||
skip := false
|
skip := false
|
||||||
select {
|
select {
|
||||||
|
|
@ -214,39 +214,39 @@ func (this *Client) GoWatch(ctx context.Context, revision int64, prefix string,
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case wresp, ok := <-rch:
|
case resp, ok := <-rch:
|
||||||
if !ok {
|
if !ok {
|
||||||
logger.Logger.Warnf("etcd watch WithPrefix(%v) be closed", prefix)
|
logger.Logger.Warnf("etcd watch WithPrefix(%v) be closed", prefix)
|
||||||
skip = true
|
skip = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if wresp.Header.Revision > revision {
|
if resp.Header.Revision > revision {
|
||||||
revision = wresp.Header.Revision
|
revision = resp.Header.Revision
|
||||||
}
|
}
|
||||||
if wresp.Canceled {
|
if resp.Canceled {
|
||||||
logger.Logger.Warnf("etcd watch WithPrefix(%v) be closed, reason:%v", prefix, wresp.Err())
|
logger.Logger.Warnf("etcd watch WithPrefix(%v) be closed, reason:%v", prefix, resp.Err())
|
||||||
skip = true
|
skip = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if err := wresp.Err(); err != nil {
|
if err := resp.Err(); err != nil {
|
||||||
logger.Logger.Warnf("etcd watch WithPrefix(%v) err:%v", prefix, wresp.Err())
|
logger.Logger.Warnf("etcd watch WithPrefix(%v) err:%v", prefix, resp.Err())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !model.GameParamData.UseEtcd {
|
if !model.GameParamData.UseEtcd {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if len(wresp.Events) == 0 {
|
if len(resp.Events) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Tracef("@goWatch %v changed, header:%#v", prefix, wresp.Header)
|
logger.Logger.Tracef("@goWatch %v changed, header:%#v", prefix, resp.Header)
|
||||||
obj := core.CoreObject()
|
obj := core.CoreObject()
|
||||||
if obj != nil {
|
if obj != nil {
|
||||||
func(res clientv3.WatchResponse) {
|
func(res clientv3.WatchResponse) {
|
||||||
obj.SendCommand(basic.CommandWrapper(func(*basic.Object) error {
|
obj.SendCommand(basic.CommandWrapper(func(*basic.Object) error {
|
||||||
return f(res)
|
return f(res)
|
||||||
}), true)
|
}), true)
|
||||||
}(wresp)
|
}(resp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ type Manager struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register .
|
// Register .
|
||||||
func (this *Manager) Register(key string, msgType interface{}, f func(completeKey string, isInit bool, event *clientv3.Event, data interface{})) {
|
func (this *Manager) Register(key string, msgType interface{}, f func(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{})) {
|
||||||
|
|
||||||
createFunc := func() interface{} {
|
createFunc := func() interface{} {
|
||||||
tp := reflect.TypeOf(msgType)
|
tp := reflect.TypeOf(msgType)
|
||||||
|
|
@ -50,7 +50,7 @@ func (this *Manager) Register(key string, msgType interface{}, f func(completeKe
|
||||||
event := &clientv3.Event{
|
event := &clientv3.Event{
|
||||||
Type: 0,
|
Type: 0,
|
||||||
}
|
}
|
||||||
f(string(res.Kvs[i].Key), true, event, v)
|
f(context.TODO(), string(res.Kvs[i].Key), true, event, v)
|
||||||
}
|
}
|
||||||
if res.Header != nil {
|
if res.Header != nil {
|
||||||
return res.Header.Revision
|
return res.Header.Revision
|
||||||
|
|
@ -79,10 +79,10 @@ func (this *Manager) Register(key string, msgType interface{}, f func(completeKe
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
logger.Logger.Tracef("ETCD 更新事件 %v ==> %v", string(ev.Kv.Key), v)
|
logger.Logger.Tracef("ETCD 更新事件 %v ==> %v", string(ev.Kv.Key), v)
|
||||||
f(string(ev.Kv.Key), false, ev, v)
|
f(ctx, string(ev.Kv.Key), false, ev, v)
|
||||||
case clientv3.EventTypeDelete:
|
case clientv3.EventTypeDelete:
|
||||||
logger.Logger.Tracef("ETCD 删除事件 %v", string(ev.Kv.Key))
|
logger.Logger.Tracef("ETCD 删除事件 %v", string(ev.Kv.Key))
|
||||||
f(string(ev.Kv.Key), false, ev, nil)
|
f(ctx, string(ev.Kv.Key), false, ev, nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -113,8 +113,8 @@ func (this *Manager) Reset() {
|
||||||
// Register 注册etcd监听方法
|
// Register 注册etcd监听方法
|
||||||
// key:监听的key
|
// key:监听的key
|
||||||
// msgType:数据类型
|
// msgType:数据类型
|
||||||
// f:数据变更回调方法, completeKey:完整键, isInit:第一次主动拉取数据,event:事件类型, data:已经反序列化的数据,类型为msgType
|
// f:数据变更回调方法, completeKey:完整键, isInit:第一次主动拉取数据,event:事件类型, data:已经反序列化的数据,类型为msgType,是指针类型
|
||||||
func Register(key string, msgType interface{}, f func(completeKey string, isInit bool, event *clientv3.Event, data interface{})) {
|
func Register(key string, msgType interface{}, f func(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{})) {
|
||||||
mgr.Register(key, msgType, f)
|
mgr.Register(key, msgType, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ const (
|
||||||
const (
|
const (
|
||||||
WaitStartTimeout = time.Second * 3 // 开始游戏
|
WaitStartTimeout = time.Second * 3 // 开始游戏
|
||||||
HandCardTimeout = time.Second * 1 // 发牌
|
HandCardTimeout = time.Second * 1 // 发牌
|
||||||
PlayerOpTimeout = time.Second * 16 // 玩家操作阶段
|
PlayerOpTimeout = time.Second * 61 // 玩家操作阶段
|
||||||
BilledTimeout = time.Second * 1 // 结算
|
BilledTimeout = time.Second * 1 // 结算
|
||||||
|
PlayerFirstOpTimeout = time.Second * 31
|
||||||
PlayerTotalTime = time.Minute*15 + time.Second // 下棋总时长
|
PlayerTotalTime = time.Minute*10 + time.Second // 下棋总时长
|
||||||
)
|
)
|
||||||
|
|
||||||
// 场景状态
|
// 场景状态
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package avengers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/protocol/avengers"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 复仇者联盟的操作
|
||||||
|
type CSAvengersOpPacketFactory struct {
|
||||||
|
}
|
||||||
|
type CSAvengersOpHandler struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CSAvengersOpPacketFactory) CreatePacket() interface{} {
|
||||||
|
pack := &avengers.CSAvengersOp{}
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
func (this *CSAvengersOpHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Trace("CSAvengersOpHandler Process recv ", data)
|
||||||
|
if csAvengersOp, ok := data.(*avengers.CSAvengersOp); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
logger.Logger.Warn("CSAvengersOpHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scene := p.GetScene()
|
||||||
|
if scene == nil {
|
||||||
|
logger.Logger.Warn("CSAvengersOpHandler p.scene == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if scene.GameId != common.GameId_Avengers {
|
||||||
|
logger.Logger.Error("CSAvengersOpHandler gameId Error ", scene.GameId)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !scene.HasPlayer(p) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
sp := scene.GetScenePolicy()
|
||||||
|
if sp != nil {
|
||||||
|
sp.OnPlayerOp(scene, p, int(csAvengersOp.GetOpCode()), csAvengersOp.GetParams())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
// 复仇者联盟的操作
|
||||||
|
common.RegisterHandler(int(avengers.AvengersPacketID_PACKET_CS_AVENGERS_PLAYEROP), &CSAvengersOpHandler{})
|
||||||
|
netlib.RegisterFactory(int(avengers.AvengersPacketID_PACKET_CS_AVENGERS_PLAYEROP), &CSAvengersOpPacketFactory{})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,116 @@
|
||||||
|
package avengers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家游戏数据索引
|
||||||
|
const (
|
||||||
|
AvengersFreeTimes int = iota //0 当前剩余免费次数
|
||||||
|
AvengersIndexMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 场景状态
|
||||||
|
const (
|
||||||
|
AvengersSceneStateStart int = iota //开始游戏
|
||||||
|
AvengersSceneStateMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
const (
|
||||||
|
AvengersPlayerOpStart int = iota //游戏
|
||||||
|
AvengersPlayerHistory // 游戏记录
|
||||||
|
AvengersBurstHistory // 奖池记录
|
||||||
|
AvengersBonusGame // 小游戏
|
||||||
|
AvengersBonusGameRecord // 小游戏操作记录
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
AvengersBonusGameTimeout = time.Second * 60 // 小游戏最大超时时间
|
||||||
|
AvengersBonusGameStageTimeout = 15 // 小游戏每阶段的超时时间 秒
|
||||||
|
)
|
||||||
|
|
||||||
|
type GameResultLog struct {
|
||||||
|
BaseResult *model.SlotBaseResultType
|
||||||
|
AllLine int32 //线路数
|
||||||
|
UserName string //昵称
|
||||||
|
WinLines []int //赢分的线
|
||||||
|
BetLines []int64 //下注的线
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复仇者联盟解析的数据
|
||||||
|
type AvengersGameNoteData struct {
|
||||||
|
Source int32
|
||||||
|
Data *GameResultLog
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复仇者联盟游戏记录
|
||||||
|
func UnMarshalAvengersGameNote(data string) (roll interface{}, err error) {
|
||||||
|
gnd := &AvengersGameNoteData{}
|
||||||
|
if err := json.Unmarshal([]byte(data), gnd); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
roll = gnd.Data
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var DebugData = [][]int{
|
||||||
|
{
|
||||||
|
5, 5, 8, 4, 5,
|
||||||
|
4, 4, 1, 4, 1,
|
||||||
|
4, 4, 2, 4, 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
8, 8, 8, 8, 8,
|
||||||
|
8, 8, 8, 8, 8,
|
||||||
|
8, 8, 8, 8, 8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
9, 9, 9, 9, 9,
|
||||||
|
9, 9, 9, 9, 9,
|
||||||
|
9, 9, 9, 9, 9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
11, 11, 11, 11, 11,
|
||||||
|
11, 11, 11, 11, 11,
|
||||||
|
11, 11, 11, 11, 11,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
package avengers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
|
rule "mongo.games.com/game/gamerule/avengers"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/protocol/avengers"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AvengersPlayerData struct {
|
||||||
|
*base.Player
|
||||||
|
spinID int64 //当前旋转ID
|
||||||
|
score int32 //单线押注数
|
||||||
|
freeTimes int32 //免费转动次数
|
||||||
|
cards []int32 //15张牌
|
||||||
|
//RollGameType *model.AvengersType //记录信息
|
||||||
|
RollGameType *GameResultLog //记录信息
|
||||||
|
enterGameCoin int64 //玩家进入初始金币
|
||||||
|
taxCoin int64 //本局税收
|
||||||
|
winCoin int64 //本局收税前赢的钱
|
||||||
|
linesWinCoin int64 //本局中奖线赢得钱
|
||||||
|
jackpotWinCoin int64 //本局奖池赢的钱
|
||||||
|
smallGameWinCoin int64 //本局小游戏赢的钱
|
||||||
|
betLines []int64 //下注的选线
|
||||||
|
currentLogId string //爆奖玩家logid
|
||||||
|
leavetime int32 //用户离开时间
|
||||||
|
totalPriceBonus int64 //小游戏得分
|
||||||
|
bonusTimerHandle timer.TimerHandle //托管超时handle
|
||||||
|
bonusStage int32 //小游戏所处阶段 1选金额 2选倍率
|
||||||
|
bonusStartTime int64 //小游戏阶段开始时间
|
||||||
|
bonusOpRecord []int32 //小游戏操作记录
|
||||||
|
bonusGame *avengers.AvengersBonusGameInfo //小游戏
|
||||||
|
bonusX []int32 //小游戏倍率选项
|
||||||
|
billedData *avengers.GameBilledData //上一局结算信息
|
||||||
|
DebugGame bool //测试
|
||||||
|
TestNum int
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家初始化
|
||||||
|
func (this *AvengersPlayerData) init(s *base.Scene) {
|
||||||
|
this.Clean()
|
||||||
|
this.score = 0
|
||||||
|
this.freeTimes = 0
|
||||||
|
//this.RollGameType = &model.AvengersType{}
|
||||||
|
//this.RollGameType.Init()
|
||||||
|
this.RollGameType = &GameResultLog{}
|
||||||
|
this.RollGameType.BaseResult = &model.SlotBaseResultType{}
|
||||||
|
this.enterGameCoin = this.Coin
|
||||||
|
this.currentLogId = ""
|
||||||
|
this.billedData = &avengers.GameBilledData{}
|
||||||
|
this.DebugGame = true
|
||||||
|
this.TestNum = 0
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
if this.GDatas == nil {
|
||||||
|
this.GDatas = make(map[string]*model.PlayerGameInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
if d, exist := this.GDatas[s.KeyGamefreeId]; exist {
|
||||||
|
gLen := len(d.Data)
|
||||||
|
if gLen < AvengersIndexMax {
|
||||||
|
for i := gLen; i < AvengersIndexMax; i++ {
|
||||||
|
d.Data = append(d.Data, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pgd := &model.PlayerGameInfo{
|
||||||
|
Data: make([]int64, AvengersIndexMax),
|
||||||
|
}
|
||||||
|
this.GDatas[s.KeyGamefreeId] = pgd
|
||||||
|
}
|
||||||
|
this.LoadPlayerGameData(s.KeyGamefreeId)
|
||||||
|
//线条全选
|
||||||
|
if len(this.betLines) == 0 {
|
||||||
|
this.betLines = rule.AllBetLines
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家清理数据
|
||||||
|
func (this *AvengersPlayerData) Clean() {
|
||||||
|
for i := 0; i < len(this.cards); i++ {
|
||||||
|
this.cards[i] = -1
|
||||||
|
}
|
||||||
|
this.winCoin = 0
|
||||||
|
this.taxCoin = 0
|
||||||
|
this.linesWinCoin = 0
|
||||||
|
this.jackpotWinCoin = 0
|
||||||
|
this.smallGameWinCoin = 0
|
||||||
|
this.CleanBonus()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理小游戏数据
|
||||||
|
func (this *AvengersPlayerData) CleanBonus() {
|
||||||
|
this.totalPriceBonus = 0
|
||||||
|
this.bonusStage = 0
|
||||||
|
this.bonusTimerHandle = timer.TimerHandle(0)
|
||||||
|
this.bonusStartTime = 0
|
||||||
|
this.bonusOpRecord = make([]int32, 0)
|
||||||
|
this.bonusGame = nil
|
||||||
|
this.bonusX = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
func (this *AvengersPlayerData) LoadPlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
this.freeTimes = int32(d.Data[AvengersFreeTimes])
|
||||||
|
if this.freeTimes > 0 && len(d.DataEx) != 0 {
|
||||||
|
json.Unmarshal(d.DataEx, &this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储玩家游戏数据
|
||||||
|
func (this *AvengersPlayerData) SavePlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
d.Data[AvengersFreeTimes] = int64(this.freeTimes)
|
||||||
|
d.DataEx, _ = json.Marshal(this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黑白名单的限制是否生效
|
||||||
|
func (this *AvengersPlayerData) CheckBlackWriteList(isWin bool) bool {
|
||||||
|
if isWin && this.BlackLevel > 0 && this.BlackLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.BlackLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if !isWin && this.WhiteLevel > 0 && this.WhiteLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.WhiteLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家是否是新手
|
||||||
|
func (this *AvengersPlayerData) IsFNovice(keyGameId string) {
|
||||||
|
if f, ok := this.IsFoolPlayer[keyGameId]; ok {
|
||||||
|
if !f {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.IsFoolPlayer[keyGameId] = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if data, ok := this.GDatas[keyGameId]; ok {
|
||||||
|
if data.Statics.GameTimes < 100 && data.Statics.TotalOut-data.Statics.TotalIn <= 2000000 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.IsFoolPlayer[keyGameId] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,339 @@
|
||||||
|
package avengers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/avengers"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/avengers"
|
||||||
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
)
|
||||||
|
|
||||||
|
type AvengersJackpot struct {
|
||||||
|
createdTime time.Time
|
||||||
|
userName string
|
||||||
|
priceValue int64
|
||||||
|
roomID int64
|
||||||
|
spinID string
|
||||||
|
}
|
||||||
|
|
||||||
|
type AvengersSceneData struct {
|
||||||
|
*base.Scene //房间信息
|
||||||
|
players map[int32]*AvengersPlayerData //玩家信息
|
||||||
|
jackpot *base.SlotJackpotPool //奖池
|
||||||
|
lastJackpotValue int64 //上一次奖池变化时的值
|
||||||
|
lastJackPot time.Time //增加奖池时间
|
||||||
|
lastBurstJackPot map[int32]time.Time //爆池时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAvengersSceneData(s *base.Scene) *AvengersSceneData {
|
||||||
|
return &AvengersSceneData{
|
||||||
|
Scene: s,
|
||||||
|
players: make(map[int32]*AvengersPlayerData),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) SaveData(force bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
|
if p, exist := this.players[p.SnId]; exist {
|
||||||
|
delete(this.players, p.SnId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) SceneDestroy(force bool) {
|
||||||
|
//销毁房间
|
||||||
|
this.Scene.Destroy(force)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) init() bool {
|
||||||
|
if this.DbGameFree == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
params := this.DbGameFree.GetJackpot()
|
||||||
|
this.jackpot = &base.SlotJackpotPool{}
|
||||||
|
if this.jackpot.Small <= 0 {
|
||||||
|
this.jackpot.Small = 0
|
||||||
|
this.jackpot.VirtualJK = int64(params[rule.AVENGERS_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore())
|
||||||
|
}
|
||||||
|
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
|
||||||
|
if str != "" {
|
||||||
|
jackpot := &base.SlotJackpotPool{}
|
||||||
|
err := json.Unmarshal([]byte(str), jackpot)
|
||||||
|
if err == nil {
|
||||||
|
this.jackpot = jackpot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.jackpot != nil {
|
||||||
|
base.SlotsPoolMgr.SetPool(this.GetGameFreeId(), this.Platform, this.jackpot)
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now()
|
||||||
|
this.lastBurstJackPot = make(map[int32]time.Time)
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type AvengersSpinResult struct {
|
||||||
|
LinesInfo []*avengers.AvengersLinesInfo
|
||||||
|
SlotsData []int32
|
||||||
|
TotalPrizeLine int64 // 线条总金额
|
||||||
|
TotalPrizeJackpot int64 // 爆奖总金额
|
||||||
|
JackpotCnt int // 爆奖的次数
|
||||||
|
AddFreeTimes int32 // 新增免费次数
|
||||||
|
IsJackpot bool // 是否爆奖
|
||||||
|
BonusGame avengers.AvengersBonusGameInfo
|
||||||
|
BonusX []int32
|
||||||
|
TotalWinRate int32 // 中奖总倍率
|
||||||
|
TotalTaxScore int64 // 税收
|
||||||
|
WinLines []int // 赢分的线
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes AvengersSpinResult) {
|
||||||
|
taxRate := this.DbGameFree.GetTaxRate()
|
||||||
|
calcTaxScore := func(score int64, taxScore *int64) int64 {
|
||||||
|
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||||
|
if taxScore != nil {
|
||||||
|
*taxScore += score - newScore
|
||||||
|
}
|
||||||
|
return newScore
|
||||||
|
}
|
||||||
|
|
||||||
|
lines := rule.CalcLine(cards, betLines)
|
||||||
|
for _, line := range lines {
|
||||||
|
if line.Element == rule.Element_JACKPOT && line.Count == rule.LINE_CELL {
|
||||||
|
spinRes.IsJackpot = true
|
||||||
|
spinRes.JackpotCnt++
|
||||||
|
}
|
||||||
|
|
||||||
|
curScore := betValue * int64(line.Score)
|
||||||
|
curScore = calcTaxScore(curScore, &spinRes.TotalTaxScore)
|
||||||
|
spinRes.TotalPrizeLine += curScore
|
||||||
|
spinRes.TotalWinRate += int32(line.Score)
|
||||||
|
|
||||||
|
lineInfo := &avengers.AvengersLinesInfo{
|
||||||
|
LineId: proto.Int32(int32(line.Index)),
|
||||||
|
Position: line.Position,
|
||||||
|
PrizeValue: proto.Int64(curScore),
|
||||||
|
}
|
||||||
|
spinRes.LinesInfo = append(spinRes.LinesInfo, lineInfo)
|
||||||
|
spinRes.WinLines = append(spinRes.WinLines, int(lineInfo.GetLineId()))
|
||||||
|
}
|
||||||
|
|
||||||
|
if spinRes.IsJackpot { // 爆奖只计一条线
|
||||||
|
spinRes.TotalPrizeJackpot = calcTaxScore(this.jackpot.VirtualJK, &spinRes.TotalTaxScore)
|
||||||
|
}
|
||||||
|
|
||||||
|
var countBonus, countFree int
|
||||||
|
for _, card := range cards {
|
||||||
|
if card == rule.Element_BONUS {
|
||||||
|
countBonus++
|
||||||
|
}
|
||||||
|
if card == rule.Element_FREESPIN {
|
||||||
|
countFree++
|
||||||
|
}
|
||||||
|
spinRes.SlotsData = append(spinRes.SlotsData, int32(card))
|
||||||
|
}
|
||||||
|
|
||||||
|
// bonus game
|
||||||
|
if countBonus >= 3 {
|
||||||
|
if countBonus == 3 {
|
||||||
|
spinRes.BonusX = []int32{1, 2, 3}
|
||||||
|
} else if countBonus == 4 {
|
||||||
|
spinRes.BonusX = []int32{2, 3, 4}
|
||||||
|
} else {
|
||||||
|
spinRes.BonusX = []int32{3, 4, 5}
|
||||||
|
countBonus = 5
|
||||||
|
}
|
||||||
|
totalBet := int64(len(betLines)) * betValue
|
||||||
|
bonusGame := rule.GenerateBonusGame(int(totalBet), countBonus-2)
|
||||||
|
var totalBonusValue int64
|
||||||
|
bonusData := make([]int64, 0)
|
||||||
|
for _, value := range bonusGame.BonusData {
|
||||||
|
value = calcTaxScore(value, nil)
|
||||||
|
totalBonusValue += value
|
||||||
|
bonusData = append(bonusData, value)
|
||||||
|
}
|
||||||
|
spinRes.BonusGame = avengers.AvengersBonusGameInfo{
|
||||||
|
TotalPrizeValue: proto.Int64(totalBonusValue * int64(bonusGame.Mutiplier)),
|
||||||
|
Mutiplier: proto.Int32(int32(bonusGame.Mutiplier)),
|
||||||
|
DataMultiplier: proto.Int64(totalBonusValue),
|
||||||
|
BonusData: bonusData,
|
||||||
|
}
|
||||||
|
// 小游戏税收
|
||||||
|
bonusTax := (bonusGame.DataMultiplier - totalBonusValue) * int64(bonusGame.Mutiplier)
|
||||||
|
spinRes.TotalTaxScore += bonusTax
|
||||||
|
}
|
||||||
|
|
||||||
|
// add free
|
||||||
|
if countFree >= 3 {
|
||||||
|
spinRes.AddFreeTimes = int32(countFree-2) * 4
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) BroadcastJackpot(sync bool) {
|
||||||
|
if this.lastJackpotValue != this.jackpot.VirtualJK || sync {
|
||||||
|
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||||
|
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||||
|
jpfi := &gamehall.GameJackpotFundInfo{
|
||||||
|
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||||
|
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||||
|
}
|
||||||
|
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
//以平台为标识向该平台内所有玩家广播奖池变动消息,游戏内外的玩家可监听该消息,减少由gamesrv向worldsrv转发这一步
|
||||||
|
tags := []string{this.Platform}
|
||||||
|
logger.Logger.Trace("jackpot avengers", pack)
|
||||||
|
base.PlayerMgrSington.BroadcastMessageToGroup(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, tags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) PushCoinPool(prizeFundAdd int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PushCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PushCoin(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *AvengersSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PopCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PopCoin(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *AvengersSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
|
||||||
|
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.InsertBurstJackpotLogs(log)
|
||||||
|
}), nil, "InsertBurstJackpotLogs").Start()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) BurstHistory(player *AvengersPlayerData) {
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
|
||||||
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
var logsp []*avengers.AvengersBurstHistoryInfo
|
||||||
|
if data != nil {
|
||||||
|
logs := data.([]model.BurstJackpotLog)
|
||||||
|
if len(logs) > 0 {
|
||||||
|
for _, log := range logs {
|
||||||
|
logsp = append(logsp, &avengers.AvengersBurstHistoryInfo{
|
||||||
|
UserName: log.Name,
|
||||||
|
PriceValue: log.WinCoin,
|
||||||
|
TotalBet: log.TotalBet,
|
||||||
|
Ts: log.Ts,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pack := &avengers.SCAvengersBurstHistory{
|
||||||
|
BurstLog: logsp,
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("SCAvengersBurstHistory:", pack)
|
||||||
|
player.SendToClient(int(avengers.AvengersPacketID_PACKET_SC_AVENGERS_BURSTHISTORY), pack)
|
||||||
|
}), "BurstHistory").Start()
|
||||||
|
}
|
||||||
|
func (this *AvengersSceneData) GetLastBurstJackPot() time.Time {
|
||||||
|
return this.lastBurstJackPot[this.GetGameFreeId()]
|
||||||
|
}
|
||||||
|
func (this *AvengersSceneData) SetLastBurstJackPot() {
|
||||||
|
var randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(46800-32400+1) + 32400
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(108000-72000+1) + 72000
|
||||||
|
case 4:
|
||||||
|
randT = rand.Intn(180000-108000+1) + 108000
|
||||||
|
}
|
||||||
|
this.lastBurstJackPot[this.GetGameFreeId()] = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *AvengersSceneData) AIAddJackPot() {
|
||||||
|
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||||
|
var randT = rand.Intn(3) + 1
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(6-1) + 2
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(12-5) + 6
|
||||||
|
case 4:
|
||||||
|
randT = rand.Intn(20-9) + 10
|
||||||
|
default:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
|
||||||
|
this.jackpot.VirtualJK += val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *AvengersSceneData) AIBurstJackPot() {
|
||||||
|
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
jackpotParams := this.DbGameFree.GetJackpot()
|
||||||
|
var jackpotInit = int64(jackpotParams[rule.AVENGERS_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||||
|
|
||||||
|
//AI机器人爆奖
|
||||||
|
val := this.jackpot.VirtualJK
|
||||||
|
this.jackpot.VirtualJK = jackpotInit
|
||||||
|
bet := this.DbGameFree.GetBaseScore() * int32(rule.LINENUM)
|
||||||
|
this.RecordBurstLog(this.RandNickName(), val, int64(bet))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *AvengersSceneData) KickPlayerByTime() {
|
||||||
|
if time.Now().Sub(this.GameStartTime) > time.Second*3 {
|
||||||
|
this.GameStartTime = time.Now()
|
||||||
|
for _, p := range this.players {
|
||||||
|
if p.IsOnLine() {
|
||||||
|
p.leavetime = 0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
p.leavetime++
|
||||||
|
if p.leavetime < 60 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//踢出玩家
|
||||||
|
this.PlayerLeave(p.Player, common.PlayerLeaveReason_LongTimeNoOp, true)
|
||||||
|
}
|
||||||
|
//for _, p := range this.players {
|
||||||
|
// //游戏次数达到目标值
|
||||||
|
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||||
|
// if !p.IsRob &&
|
||||||
|
// todayGamefreeIDSceneData != nil &&
|
||||||
|
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||||
|
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||||
|
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if this.CheckNeedDestroy() {
|
||||||
|
for _, player := range this.players {
|
||||||
|
if !player.IsRob {
|
||||||
|
if time.Now().Sub(player.LastOPTimer) > 10*time.Second {
|
||||||
|
//离开有统计
|
||||||
|
this.PlayerLeave(player.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.GetRealPlayerCnt() == 0 {
|
||||||
|
this.SceneDestroy(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,22 +1,39 @@
|
||||||
package base
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"go.etcd.io/etcd/client/v3"
|
"go.etcd.io/etcd/client/v3"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
"mongo.games.com/game/etcd"
|
"mongo.games.com/game/etcd"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/protocol/webapi"
|
"mongo.games.com/game/protocol/webapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var ConfigMgrInst = model.NewConfigMgr()
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// 个人水池
|
// 个人水池
|
||||||
etcd.Register(etcd.ETCDKEY_PLAYERPOOL, webapi.PlayerPool{}, PlatformConfigEtcd)
|
etcd.Register(etcd.ETCDKEY_PLAYERPOOL, webapi.PlayerPool{}, platformConfigEtcd)
|
||||||
// 游戏配置
|
// 游戏配置
|
||||||
etcd.Register(etcd.ETCDKEY_GAME_CONFIG, webapi.GameConfig{}, PlatformConfigEtcd)
|
etcd.Register(etcd.ETCDKEY_GAME_CONFIG, webapi.GameConfig{}, platformConfigEtcd)
|
||||||
|
// 集卡活动
|
||||||
|
etcd.Register(etcd.ETCDKEY_ACT_Collect, webapi.WelfareCollectConfig{}, platformConfigEtcd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PlatformConfigEtcd(completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
func platformConfigEtcd(ctx context.Context, completeKey string, isInit bool, event *clientv3.Event, data interface{}) {
|
||||||
if event.Type == clientv3.EventTypeDelete {
|
if event.Type == clientv3.EventTypeDelete {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
PlatformConfigSingleton.Update(data)
|
switch d := data.(type) {
|
||||||
|
case *webapi.PlayerPool:
|
||||||
|
ConfigMgrInst.GetConfig(d.Platform).PlayerPool = d
|
||||||
|
case *webapi.GameConfig:
|
||||||
|
ConfigMgrInst.GetConfig(d.Platform).GameConfig = d
|
||||||
|
case *webapi.WelfareCollectConfig:
|
||||||
|
ConfigMgrInst.GetConfig(d.Platform).WelfareCollectConfig = d
|
||||||
|
default:
|
||||||
|
logger.Logger.Errorf("etcd completeKey:%s, Not processed", completeKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package base
|
|
||||||
|
|
||||||
import (
|
|
||||||
"mongo.games.com/game/protocol/webapi"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
)
|
|
||||||
|
|
||||||
var PlatformConfigSingleton = &PlatformConfigMgr{
|
|
||||||
Platforms: make(map[string]*PlatformConfig),
|
|
||||||
}
|
|
||||||
|
|
||||||
type PlatformConfig struct {
|
|
||||||
PlayerPool *webapi.PlayerPool
|
|
||||||
GameConfig *webapi.GameConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
type PlatformConfigMgr struct {
|
|
||||||
Platforms map[string]*PlatformConfig //key 是平台标记
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *PlatformConfigMgr) Get(plt string) *PlatformConfig {
|
|
||||||
ret, ok := this.Platforms[plt]
|
|
||||||
if !ok {
|
|
||||||
ret = new(PlatformConfig)
|
|
||||||
this.Platforms[plt] = ret
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *PlatformConfigMgr) Update(config any) {
|
|
||||||
if config == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
switch v := config.(type) {
|
|
||||||
case *webapi.PlayerPool:
|
|
||||||
this.Get(v.GetPlatform()).PlayerPool = v
|
|
||||||
|
|
||||||
case *webapi.GameConfig:
|
|
||||||
this.Get(v.GetPlatform()).GameConfig = v
|
|
||||||
|
|
||||||
default:
|
|
||||||
logger.Logger.Error("Update config type error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -117,7 +117,7 @@ type Player struct {
|
||||||
BlackLevel int32 //todo 使用WBLevel
|
BlackLevel int32 //todo 使用WBLevel
|
||||||
SingleAdjust *model.PlayerSingleAdjust
|
SingleAdjust *model.PlayerSingleAdjust
|
||||||
IsLocal bool //是否本地player
|
IsLocal bool //是否本地player
|
||||||
Items map[int32]int32 //背包数据
|
Items map[int32]int64 //背包数据
|
||||||
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色
|
MatchParams []int32 //比赛参数 排名、段位、假snid、假角色
|
||||||
MatchRobotGrades []MatchRobotGrade
|
MatchRobotGrades []MatchRobotGrade
|
||||||
TestLog []string // 调试日志
|
TestLog []string // 调试日志
|
||||||
|
|
@ -141,7 +141,7 @@ func NewPlayer(sid int64, data []byte, ws, gs *netlib.Session) *Player {
|
||||||
cparams: make(map[string]string), //平台登陆数据
|
cparams: make(map[string]string), //平台登陆数据
|
||||||
Iparams: make(map[int]int64), //整形参数
|
Iparams: make(map[int]int64), //整形参数
|
||||||
sparams: make(map[int]string), //字符参数
|
sparams: make(map[int]string), //字符参数
|
||||||
Items: make(map[int32]int32),
|
Items: make(map[int32]int64),
|
||||||
RankScore: make(map[int32]int64),
|
RankScore: make(map[int32]int64),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,6 +448,7 @@ func (this *Player) AddCoin(num int64, gainWay int32, syncFlag int, oper, remark
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.Coin += num
|
this.Coin += num
|
||||||
|
this.Items[common.ItemIDCoin] = this.Coin
|
||||||
if this.scene != nil {
|
if this.scene != nil {
|
||||||
if !this.IsRob && !this.scene.Testing { //机器人log排除掉
|
if !this.IsRob && !this.scene.Testing { //机器人log排除掉
|
||||||
log := model.NewCoinLogEx(&model.CoinLogParam{
|
log := model.NewCoinLogEx(&model.CoinLogParam{
|
||||||
|
|
@ -525,6 +526,7 @@ func (this *Player) AddCoinAsync(num int64, gainWay int32, notifyC, broadcast bo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.Coin += num
|
this.Coin += num
|
||||||
|
this.Items[common.ItemIDCoin] = this.Coin
|
||||||
if this.scene != nil {
|
if this.scene != nil {
|
||||||
if !this.IsRob && !this.scene.Testing && writeLog { //机器人log排除掉
|
if !this.IsRob && !this.scene.Testing && writeLog { //机器人log排除掉
|
||||||
log := model.NewCoinLogEx(&model.CoinLogParam{
|
log := model.NewCoinLogEx(&model.CoinLogParam{
|
||||||
|
|
|
||||||
|
|
@ -639,9 +639,9 @@ func (this *Scene) PlayerLeave(p *Player, reason int, isBill bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pack.Items = make(map[int32]int32)
|
pack.Items = make(map[int32]int64)
|
||||||
for id, num := range p.Items {
|
for id, num := range p.Items {
|
||||||
pack.Items[id] = proto.Int32(num)
|
pack.Items[id] = num
|
||||||
}
|
}
|
||||||
pack.RankScore = make(map[int32]int64)
|
pack.RankScore = make(map[int32]int64)
|
||||||
for k, v := range p.RankScore {
|
for k, v := range p.RankScore {
|
||||||
|
|
@ -2343,7 +2343,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
||||||
num = rand.Int31n(drop.MaxAmount-drop.MinAmount+1) + drop.MinAmount
|
num = rand.Int31n(drop.MaxAmount-drop.MinAmount+1) + drop.MinAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Items[drop.ItemId] += num
|
p.Items[drop.ItemId] += int64(num)
|
||||||
realDrop[drop.ItemId] = num
|
realDrop[drop.ItemId] = num
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2376,7 +2376,7 @@ func (this *Scene) TryBillExGameDrop(p *Player) {
|
||||||
|
|
||||||
// DropCollectBox 掉落集卡礼盒
|
// DropCollectBox 掉落集卡礼盒
|
||||||
func (this *Scene) DropCollectBox(p *Player) {
|
func (this *Scene) DropCollectBox(p *Player) {
|
||||||
if p == nil || p.IsRob {
|
if p == nil || p.IsRob || ConfigMgrInst.GetConfig(p.Platform).WelfareCollectConfig.Switch != model.WelfareOpen {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2436,7 +2436,7 @@ func (this *Scene) GetBaseScore() int32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Scene) PlayerPoolOdds(p *Player) int32 {
|
func (this *Scene) PlayerPoolOdds(p *Player) int32 {
|
||||||
config := PlatformConfigSingleton.Get(p.Platform).PlayerPool
|
config := ConfigMgrInst.GetConfig(p.Platform).PlayerPool
|
||||||
if config == nil {
|
if config == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
@ -2490,7 +2490,7 @@ func (this *Scene) GetPlayerOdds(p *Player, gameId int, hasRobot bool) int32 {
|
||||||
// 场次水池概率
|
// 场次水池概率
|
||||||
f = CoinPoolMgr.GetCoinPoolOdds(this.Platform, this.GetGameFreeId(), this.GroupId)
|
f = CoinPoolMgr.GetCoinPoolOdds(this.Platform, this.GetGameFreeId(), this.GroupId)
|
||||||
|
|
||||||
cfg := PlatformConfigSingleton.Get(p.Platform).PlayerPool
|
cfg := ConfigMgrInst.GetConfig(p.Platform).PlayerPool
|
||||||
if cfg != nil && cfg.PlayerPoolSwitch {
|
if cfg != nil && cfg.PlayerPoolSwitch {
|
||||||
if g > 0 {
|
if g > 0 {
|
||||||
t = f + (1000-f)*g/1000
|
t = f + (1000-f)*g/1000
|
||||||
|
|
@ -2707,7 +2707,7 @@ func (this *Scene) Statistics(param *StaticParam) {
|
||||||
|
|
||||||
// 个人输赢统计条件(个人水池)
|
// 个人输赢统计条件(个人水池)
|
||||||
// 黑白名单和新手调控,溢出金币统计到个人水池
|
// 黑白名单和新手调控,溢出金币统计到个人水池
|
||||||
cfg := PlatformConfigSingleton.Get(p.Platform).PlayerPool
|
cfg := ConfigMgrInst.GetConfig(p.Platform).PlayerPool
|
||||||
isPlayerPool := cfg != nil && cfg.PlayerPoolSwitch && isControl && ((wbLevel == 0 && !isNovice) || addGain > 0)
|
isPlayerPool := cfg != nil && cfg.PlayerPoolSwitch && isControl && ((wbLevel == 0 && !isNovice) || addGain > 0)
|
||||||
if isPlayerPool {
|
if isPlayerPool {
|
||||||
keyGameType := common.GetKeyGameType(int(this.GetDBGameFree().GetGameType()))
|
keyGameType := common.GetKeyGameType(int(this.GetDBGameFree().GetGameType()))
|
||||||
|
|
|
||||||
|
|
@ -1,94 +1,98 @@
|
||||||
package base
|
package base
|
||||||
|
|
||||||
//import (
|
import (
|
||||||
// "encoding/json"
|
"encoding/json"
|
||||||
// "fmt"
|
"fmt"
|
||||||
//
|
"time"
|
||||||
// "mongo.games.com/goserver/core/logger"
|
|
||||||
// "mongo.games.com/goserver/core/module"
|
"mongo.games.com/goserver/core/logger"
|
||||||
//
|
"mongo.games.com/goserver/core/module"
|
||||||
// "mongo.games.com/game/common"
|
|
||||||
// "mongo.games.com/game/model"
|
"mongo.games.com/game/common"
|
||||||
//)
|
"mongo.games.com/game/model"
|
||||||
//
|
)
|
||||||
//var XSlotsPoolMgr = &XSlotsPoolManager{
|
|
||||||
// //SlotsPoolData: make(map[string]interface{}),
|
var XSlotsPoolMgr = &XSlotsPoolManager{
|
||||||
// SlotsPoolStr: make(map[string]string),
|
SlotsPoolData: make(map[string]interface{}),
|
||||||
//}
|
SlotsPoolStr: make(map[string]string),
|
||||||
//
|
}
|
||||||
//type XSlotsPoolManager struct {
|
|
||||||
// //SlotsPoolData map[string]interface{}
|
type XSlotsPoolManager struct {
|
||||||
// SlotsPoolStr map[string]string
|
//
|
||||||
// SlotsPoolDBKey string
|
SlotsPoolData map[string]interface{}
|
||||||
//}
|
//
|
||||||
//
|
SlotsPoolStr map[string]string
|
||||||
//func (this *XSlotsPoolManager) GetPool(gamefreeId int32, platform string) string {
|
//
|
||||||
|
SlotsPoolDBKey string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *XSlotsPoolManager) GetPool(gamefreeId int32, platform string) string {
|
||||||
|
key := fmt.Sprintf("%v-%v", gamefreeId, platform)
|
||||||
|
if str, exist := this.SlotsPoolStr[key]; exist {
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
//func (this *XSlotsPoolManager) SetPool(gamefreeId int32, platform string, pool interface{}) {
|
||||||
// key := fmt.Sprintf("%v-%v", gamefreeId, platform)
|
// key := fmt.Sprintf("%v-%v", gamefreeId, platform)
|
||||||
// if str, exist := this.SlotsPoolStr[key]; exist {
|
// this.SlotsPoolData[key] = pool
|
||||||
// return str
|
//}
|
||||||
|
|
||||||
|
//func (this *XSlotsPoolManager) GetPoolByPlatform(platform string) map[string]interface{} {
|
||||||
|
// slots := make(map[string]interface{})
|
||||||
|
// for k, v := range this.SlotsPoolData {
|
||||||
|
// str := strings.Split(k, "-")
|
||||||
|
// if len(str) == 2 && str[1] == platform {
|
||||||
|
// idStr := str[0]
|
||||||
|
// slots[idStr] = v
|
||||||
// }
|
// }
|
||||||
// return ""
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
////func (this *XSlotsPoolManager) SetPool(gamefreeId int32, platform string, pool interface{}) {
|
|
||||||
//// key := fmt.Sprintf("%v-%v", gamefreeId, platform)
|
|
||||||
//// this.SlotsPoolData[key] = pool
|
|
||||||
////}
|
|
||||||
//
|
|
||||||
////func (this *XSlotsPoolManager) GetPoolByPlatform(platform string) map[string]interface{} {
|
|
||||||
//// slots := make(map[string]interface{})
|
|
||||||
//// for k, v := range this.SlotsPoolData {
|
|
||||||
//// str := strings.Split(k, "-")
|
|
||||||
//// if len(str) == 2 && str[1] == platform {
|
|
||||||
//// idStr := str[0] // gamefreeid
|
|
||||||
//// slots[idStr] = v
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// return slots
|
|
||||||
////}
|
|
||||||
//
|
|
||||||
//// //////////////////////////////////////////////////////////////////
|
|
||||||
//// / Module Implement [beg]
|
|
||||||
//// //////////////////////////////////////////////////////////////////
|
|
||||||
//func (this *XSlotsPoolManager) ModuleName() string {
|
|
||||||
// return "XSlotsPoolManager"
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//func (this *XSlotsPoolManager) Init() {
|
|
||||||
// this.SlotsPoolDBKey = fmt.Sprintf("XSlotsPoolManager_Srv%v", common.GetSelfSrvId())
|
|
||||||
// data := model.GetStrKVGameData(this.SlotsPoolDBKey)
|
|
||||||
// err := json.Unmarshal([]byte(data), &this.SlotsPoolStr)
|
|
||||||
// if err != nil {
|
|
||||||
// logger.Logger.Error("Unmarshal slots pool error:", err)
|
|
||||||
// }
|
// }
|
||||||
|
// return slots
|
||||||
//}
|
//}
|
||||||
//
|
|
||||||
//func (this *XSlotsPoolManager) Update() {
|
// //////////////////////////////////////////////////////////////////
|
||||||
// this.Save()
|
// / Module Implement [beg]
|
||||||
//}
|
// //////////////////////////////////////////////////////////////////
|
||||||
//
|
func (this *XSlotsPoolManager) ModuleName() string {
|
||||||
//func (this *XSlotsPoolManager) Shutdown() {
|
return "XSlotsPoolManager"
|
||||||
// this.Save()
|
}
|
||||||
// module.UnregisteModule(this)
|
|
||||||
//}
|
func (this *XSlotsPoolManager) Init() {
|
||||||
//
|
this.SlotsPoolDBKey = fmt.Sprintf("XSlotsPoolManager_Srv%v", common.GetSelfSrvId())
|
||||||
//func (this *XSlotsPoolManager) Save() {
|
data := model.GetStrKVGameData(this.SlotsPoolDBKey)
|
||||||
// //数据先整合
|
err := json.Unmarshal([]byte(data), &this.SlotsPoolStr)
|
||||||
// //for k, v := range this.SlotsPoolData {
|
if err != nil {
|
||||||
// // data, err := json.Marshal(v)
|
logger.Logger.Error("Unmarshal slots pool error:", err)
|
||||||
// // if err == nil {
|
}
|
||||||
// // this.SlotsPoolStr[k] = string(data)
|
}
|
||||||
// // }
|
|
||||||
// //}
|
func (this *XSlotsPoolManager) Update() {
|
||||||
// //再保存
|
this.Save()
|
||||||
// buff, err := json.Marshal(this.SlotsPoolStr)
|
}
|
||||||
// if err == nil {
|
|
||||||
// model.UptStrKVGameData(this.SlotsPoolDBKey, string(buff))
|
func (this *XSlotsPoolManager) Shutdown() {
|
||||||
// } else {
|
this.Save()
|
||||||
// logger.Logger.Error("Marshal coin pool error:", err)
|
module.UnregisteModule(this)
|
||||||
// }
|
}
|
||||||
//}
|
|
||||||
//
|
func (this *XSlotsPoolManager) Save() {
|
||||||
//func init() {
|
//数据先整合
|
||||||
// //module.RegisteModule(XSlotsPoolMgr, time.Minute, 0)
|
for k, v := range this.SlotsPoolData {
|
||||||
//}
|
data, err := json.Marshal(v)
|
||||||
|
if err == nil {
|
||||||
|
this.SlotsPoolStr[k] = string(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//再保存
|
||||||
|
buff, err := json.Marshal(this.SlotsPoolStr)
|
||||||
|
if err == nil {
|
||||||
|
model.UptStrKVGameData(this.SlotsPoolDBKey, string(buff))
|
||||||
|
} else {
|
||||||
|
logger.Logger.Error("Marshal coin pool error:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
module.RegisteModule(XSlotsPoolMgr, time.Minute, 0)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package caishen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/protocol/caishen"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 财神的操作
|
||||||
|
type CSCaiShenOpPacketFactory struct {
|
||||||
|
}
|
||||||
|
type CSCaiShenOpHandler struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CSCaiShenOpPacketFactory) CreatePacket() interface{} {
|
||||||
|
pack := &caishen.CSCaiShenOp{}
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
func (this *CSCaiShenOpHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Trace("CSCaiShenOpHandler Process recv ", data)
|
||||||
|
if csCaiShenOp, ok := data.(*caishen.CSCaiShenOp); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
logger.Logger.Warn("CSCaiShenOpHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scene := p.GetScene()
|
||||||
|
if scene == nil {
|
||||||
|
logger.Logger.Warn("CSCaiShenOpHandler p.scene == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if scene.GameId != common.GameId_CaiShen {
|
||||||
|
logger.Logger.Error("CSCaiShenOpHandler gameId Error ", scene.GameId)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !scene.HasPlayer(p) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
sp := scene.GetScenePolicy()
|
||||||
|
if sp != nil {
|
||||||
|
sp.OnPlayerOp(scene, p, int(csCaiShenOp.GetOpCode()), csCaiShenOp.GetParams())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// 财神的操作
|
||||||
|
common.RegisterHandler(int(caishen.CaiShenPacketID_PACKET_CS_CAISHEN_PLAYEROP), &CSCaiShenOpHandler{})
|
||||||
|
netlib.RegisterFactory(int(caishen.CaiShenPacketID_PACKET_CS_CAISHEN_PLAYEROP), &CSCaiShenOpPacketFactory{})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
package caishen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家游戏数据索引
|
||||||
|
const (
|
||||||
|
CaiShenFreeTimes int = iota //0 当前剩余免费次数
|
||||||
|
CaiShenIndexMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 通知奖池变化的时间间隔
|
||||||
|
const jackpotNoticeInterval = time.Second
|
||||||
|
|
||||||
|
// 场景状态
|
||||||
|
const (
|
||||||
|
CaiShenSceneStateStart int = iota //开始游戏
|
||||||
|
CaiShenSceneStateMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
const (
|
||||||
|
CaiShenPlayerOpStart int = iota //游戏
|
||||||
|
CaiShenPlayerHistory // 游戏记录
|
||||||
|
CaiShenBurstHistory // 爆奖记录
|
||||||
|
CaiShenBonusGame // 小游戏
|
||||||
|
CaiShenBonusGameRecord // 小游戏操作记录
|
||||||
|
)
|
||||||
|
|
||||||
|
// 小游戏超时时间
|
||||||
|
const (
|
||||||
|
CaiShenBonusGameTimeout = time.Second * 60
|
||||||
|
CaiShenBonusGameStageTimeout = 15 // 小游戏每阶段的超时时间 秒
|
||||||
|
)
|
||||||
|
|
||||||
|
type GameResultLog struct {
|
||||||
|
BaseResult *model.SlotBaseResultType
|
||||||
|
AllLine int32 //线路数
|
||||||
|
UserName string //昵称
|
||||||
|
WinLines []int //赢分的线
|
||||||
|
BetLines []int64 //下注的线
|
||||||
|
}
|
||||||
|
|
||||||
|
// 财神解析的数据
|
||||||
|
type CaiShenGameNoteData struct {
|
||||||
|
Source int32
|
||||||
|
Data *GameResultLog
|
||||||
|
}
|
||||||
|
|
||||||
|
// 财神游戏记录
|
||||||
|
func UnMarshalCaiShenGameNote(data string) (roll interface{}, err error) {
|
||||||
|
gnd := &CaiShenGameNoteData{}
|
||||||
|
if err := json.Unmarshal([]byte(data), gnd); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
roll = gnd.Data
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var DebugData = [][]int{
|
||||||
|
{
|
||||||
|
1, 1, 1, 5, 5,
|
||||||
|
1, 1, 1, 3, 4,
|
||||||
|
6, 7, 8, 9, 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
8, 8, 8, 8, 8,
|
||||||
|
8, 8, 8, 8, 8,
|
||||||
|
8, 8, 8, 8, 8,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
9, 9, 9, 9, 9,
|
||||||
|
9, 9, 9, 9, 9,
|
||||||
|
9, 9, 9, 9, 9,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
10, 10, 10, 10, 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
11, 11, 11, 11, 11,
|
||||||
|
11, 11, 11, 11, 11,
|
||||||
|
11, 11, 11, 11, 11,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,156 @@
|
||||||
|
package caishen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
|
rule "mongo.games.com/game/gamerule/caishen"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/protocol/caishen"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CaiShenPlayerData struct {
|
||||||
|
*base.Player
|
||||||
|
spinID int64 //当前旋转ID
|
||||||
|
score int32 //单线押注数
|
||||||
|
freeTimes int32 //免费转动次数
|
||||||
|
cards []int32 //15张牌
|
||||||
|
//RollGameType *model.CaiShenType //记录信息
|
||||||
|
RollGameType *GameResultLog //记录信息
|
||||||
|
enterGameCoin int64 //玩家进入初始金币
|
||||||
|
taxCoin int64 //本局税收
|
||||||
|
winCoin int64 //本局收税前赢的钱
|
||||||
|
linesWinCoin int64 //本局中奖线赢得钱
|
||||||
|
jackpotWinCoin int64 //本局奖池赢的钱
|
||||||
|
smallGameWinCoin int64 //本局小游戏赢的钱 //新版本已废弃
|
||||||
|
betLines []int64 //下注的选线
|
||||||
|
totalPriceBonus int64 //小游戏得分
|
||||||
|
bonusTimerHandle timer.TimerHandle //托管handle
|
||||||
|
currentLogId string //爆奖玩家logid
|
||||||
|
leavetime int32 //用户离开时间
|
||||||
|
bonusStage int32 //小游戏所处阶段 1选金额 2选倍率
|
||||||
|
bonusStartTime int64 //小游戏阶段开始时间
|
||||||
|
bonusOpRecord []int32 //小游戏操作记录
|
||||||
|
bonusGame *caishen.CaiShenBonusGameInfo //小游戏
|
||||||
|
bonusX []int32 //小游戏倍率选项
|
||||||
|
bonusGameIconData []int32 //小游戏选项图标,用于客户端展示
|
||||||
|
billedData *caishen.GameBilledData
|
||||||
|
DebugGame bool //测试
|
||||||
|
TestNum int
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家初始化
|
||||||
|
func (this *CaiShenPlayerData) init(s *base.Scene) {
|
||||||
|
this.Clean()
|
||||||
|
this.score = 0
|
||||||
|
this.freeTimes = 0
|
||||||
|
//this.RollGameType = &model.CaiShenType{}
|
||||||
|
this.RollGameType = &GameResultLog{}
|
||||||
|
this.RollGameType.BaseResult = &model.SlotBaseResultType{}
|
||||||
|
this.enterGameCoin = this.Coin
|
||||||
|
this.currentLogId = ""
|
||||||
|
this.billedData = &caishen.GameBilledData{}
|
||||||
|
this.DebugGame = true
|
||||||
|
this.TestNum = 0
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
if this.GDatas == nil {
|
||||||
|
this.GDatas = make(map[string]*model.PlayerGameInfo)
|
||||||
|
}
|
||||||
|
if d, exist := this.GDatas[s.KeyGamefreeId]; exist {
|
||||||
|
gLen := len(d.Data)
|
||||||
|
if gLen < CaiShenIndexMax {
|
||||||
|
for i := gLen; i < CaiShenIndexMax; i++ {
|
||||||
|
d.Data = append(d.Data, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pgd := &model.PlayerGameInfo{
|
||||||
|
Data: make([]int64, CaiShenIndexMax, CaiShenIndexMax),
|
||||||
|
}
|
||||||
|
this.GDatas[s.KeyGamefreeId] = pgd
|
||||||
|
}
|
||||||
|
this.LoadPlayerGameData(s.KeyGamefreeId)
|
||||||
|
//线条全选
|
||||||
|
if len(this.betLines) == 0 {
|
||||||
|
this.betLines = rule.AllBetLines
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家清理数据
|
||||||
|
func (this *CaiShenPlayerData) Clean() {
|
||||||
|
for i := 0; i < len(this.cards); i++ {
|
||||||
|
this.cards[i] = -1
|
||||||
|
}
|
||||||
|
this.winCoin = 0
|
||||||
|
this.taxCoin = 0
|
||||||
|
this.linesWinCoin = 0
|
||||||
|
this.jackpotWinCoin = 0
|
||||||
|
this.smallGameWinCoin = 0
|
||||||
|
this.CleanBonus()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理小游戏数据
|
||||||
|
func (this *CaiShenPlayerData) CleanBonus() {
|
||||||
|
this.totalPriceBonus = 0
|
||||||
|
this.bonusStage = 0
|
||||||
|
this.bonusTimerHandle = timer.TimerHandle(0)
|
||||||
|
this.bonusStartTime = 0
|
||||||
|
this.bonusOpRecord = make([]int32, 0)
|
||||||
|
this.bonusGame = nil
|
||||||
|
this.bonusX = nil
|
||||||
|
this.bonusGameIconData = make([]int32, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
func (this *CaiShenPlayerData) LoadPlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
this.freeTimes = int32(d.Data[CaiShenFreeTimes])
|
||||||
|
if this.freeTimes > 0 && len(d.DataEx) != 0 {
|
||||||
|
json.Unmarshal(d.DataEx, &this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储玩家游戏数据
|
||||||
|
func (this *CaiShenPlayerData) SavePlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
d.Data[CaiShenFreeTimes] = int64(this.freeTimes)
|
||||||
|
d.DataEx, _ = json.Marshal(this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黑白名单的限制是否生效
|
||||||
|
func (this *CaiShenPlayerData) CheckBlackWriteList(isWin bool) bool {
|
||||||
|
if isWin && this.BlackLevel > 0 && this.BlackLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.BlackLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if !isWin && this.WhiteLevel > 0 && this.WhiteLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.WhiteLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家是否是新手
|
||||||
|
func (this *CaiShenPlayerData) IsFNovice(keyGameId string) {
|
||||||
|
if f, ok := this.IsFoolPlayer[keyGameId]; ok {
|
||||||
|
if !f {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.IsFoolPlayer[keyGameId] = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if data, ok := this.GDatas[keyGameId]; ok {
|
||||||
|
if data.Statics.GameTimes < 100 && data.Statics.TotalOut-data.Statics.TotalIn <= 2000000 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.IsFoolPlayer[keyGameId] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,339 @@
|
||||||
|
package caishen
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/caishen"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/caishen"
|
||||||
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CaiShenJackpot struct {
|
||||||
|
createdTime time.Time
|
||||||
|
userName string
|
||||||
|
priceValue int64
|
||||||
|
roomID int64
|
||||||
|
spinID string
|
||||||
|
}
|
||||||
|
|
||||||
|
type CaiShenSceneData struct {
|
||||||
|
*base.Scene //房间信息
|
||||||
|
players map[int32]*CaiShenPlayerData //玩家信息
|
||||||
|
jackpot *base.SlotJackpotPool //奖池
|
||||||
|
lastJackpotValue int64 //上一次奖池变化时的值
|
||||||
|
lastJackPot time.Time //增加奖池时间
|
||||||
|
lastBurstJackPot map[int32]time.Time //爆池时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCaiShenSceneData(s *base.Scene) *CaiShenSceneData {
|
||||||
|
return &CaiShenSceneData{
|
||||||
|
Scene: s,
|
||||||
|
players: make(map[int32]*CaiShenPlayerData),
|
||||||
|
jackpot: &base.SlotJackpotPool{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) SaveData(force bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
|
if p, exist := this.players[p.SnId]; exist {
|
||||||
|
delete(this.players, p.SnId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) SceneDestroy(force bool) {
|
||||||
|
//销毁房间
|
||||||
|
this.Scene.Destroy(force)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) init() bool {
|
||||||
|
if this.DbGameFree == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
params := this.DbGameFree.GetJackpot()
|
||||||
|
this.jackpot = &base.SlotJackpotPool{}
|
||||||
|
if this.jackpot.Small <= 0 {
|
||||||
|
this.jackpot.Small = 0
|
||||||
|
this.jackpot.VirtualJK = int64(params[rule.CAISHEN_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore())
|
||||||
|
}
|
||||||
|
str := base.XSlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
|
||||||
|
if str != "" {
|
||||||
|
jackpot := &base.SlotJackpotPool{}
|
||||||
|
err := json.Unmarshal([]byte(str), jackpot)
|
||||||
|
if err == nil {
|
||||||
|
this.jackpot = jackpot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.jackpot != nil {
|
||||||
|
base.SlotsPoolMgr.SetPool(this.GetGameFreeId(), this.Platform, this.jackpot)
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now()
|
||||||
|
this.lastBurstJackPot = make(map[int32]time.Time)
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type CaiShenSpinResult struct {
|
||||||
|
LinesInfo []*caishen.CaiShenLinesInfo
|
||||||
|
SlotsData []int32
|
||||||
|
TotalPrizeLine int64 // 线条总金额
|
||||||
|
TotalPrizeJackpot int64 // 爆奖总金额
|
||||||
|
JackpotCnt int // 爆奖的次数
|
||||||
|
AddFreeTimes int32 // 新增免费次数
|
||||||
|
IsJackpot bool // 是否爆奖
|
||||||
|
BonusGame caishen.CaiShenBonusGameInfo
|
||||||
|
BonusX []int32
|
||||||
|
TotalWinRate int32 // 中奖总倍率
|
||||||
|
TotalTaxScore int64 // 税收
|
||||||
|
WinLines []int // 赢分的线
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes CaiShenSpinResult) {
|
||||||
|
taxRate := this.DbGameFree.GetTaxRate()
|
||||||
|
calcTaxScore := func(score int64, taxScore *int64) int64 {
|
||||||
|
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||||
|
if taxScore != nil {
|
||||||
|
*taxScore += score - newScore
|
||||||
|
}
|
||||||
|
return newScore
|
||||||
|
}
|
||||||
|
|
||||||
|
lines := rule.CalcLine(cards, betLines)
|
||||||
|
for _, line := range lines {
|
||||||
|
if line.Element == rule.Element_JACKPOT && line.Count == rule.LINE_CELL {
|
||||||
|
spinRes.IsJackpot = true
|
||||||
|
spinRes.JackpotCnt++
|
||||||
|
}
|
||||||
|
|
||||||
|
curScore := betValue * int64(line.Score)
|
||||||
|
curScore = calcTaxScore(curScore, &spinRes.TotalTaxScore)
|
||||||
|
spinRes.TotalPrizeLine += curScore
|
||||||
|
spinRes.TotalWinRate += int32(line.Score)
|
||||||
|
|
||||||
|
lineInfo := &caishen.CaiShenLinesInfo{
|
||||||
|
LineId: proto.Int32(int32(line.Index)),
|
||||||
|
Position: line.Position,
|
||||||
|
PrizeValue: proto.Int64(curScore),
|
||||||
|
}
|
||||||
|
spinRes.LinesInfo = append(spinRes.LinesInfo, lineInfo)
|
||||||
|
spinRes.WinLines = append(spinRes.WinLines, int(lineInfo.GetLineId()))
|
||||||
|
}
|
||||||
|
|
||||||
|
if spinRes.IsJackpot { // 爆奖只计一条线
|
||||||
|
spinRes.TotalPrizeJackpot = calcTaxScore(this.jackpot.VirtualJK, &spinRes.TotalTaxScore)
|
||||||
|
}
|
||||||
|
|
||||||
|
var countBonus, countFree int
|
||||||
|
for _, card := range cards {
|
||||||
|
if card == rule.Element_BONUS {
|
||||||
|
countBonus++
|
||||||
|
}
|
||||||
|
if card == rule.Element_SCATTER {
|
||||||
|
countFree++
|
||||||
|
}
|
||||||
|
spinRes.SlotsData = append(spinRes.SlotsData, int32(card))
|
||||||
|
}
|
||||||
|
|
||||||
|
// bonus game
|
||||||
|
if countBonus >= 3 {
|
||||||
|
if countBonus == 3 {
|
||||||
|
spinRes.BonusX = []int32{1, 2, 3}
|
||||||
|
} else if countBonus == 4 {
|
||||||
|
spinRes.BonusX = []int32{2, 3, 4}
|
||||||
|
} else {
|
||||||
|
spinRes.BonusX = []int32{3, 4, 5}
|
||||||
|
countBonus = 5
|
||||||
|
}
|
||||||
|
totalBet := int64(len(betLines)) * betValue
|
||||||
|
bonusGame := rule.GenerateBonusGame(int(totalBet), countBonus-2)
|
||||||
|
var totalBonusValue int64
|
||||||
|
bonusData := make([]int64, 0)
|
||||||
|
for _, value := range bonusGame.BonusData {
|
||||||
|
value = calcTaxScore(value, nil)
|
||||||
|
totalBonusValue += value
|
||||||
|
bonusData = append(bonusData, value)
|
||||||
|
}
|
||||||
|
spinRes.BonusGame = caishen.CaiShenBonusGameInfo{
|
||||||
|
TotalPrizeValue: proto.Int64(totalBonusValue * int64(bonusGame.Mutiplier)),
|
||||||
|
Mutiplier: proto.Int32(int32(bonusGame.Mutiplier)),
|
||||||
|
DataMultiplier: proto.Int64(int64(totalBonusValue)),
|
||||||
|
BonusData: bonusData,
|
||||||
|
}
|
||||||
|
// 小游戏税收
|
||||||
|
bonusTax := (bonusGame.DataMultiplier - totalBonusValue) * int64(bonusGame.Mutiplier)
|
||||||
|
spinRes.TotalTaxScore += bonusTax
|
||||||
|
}
|
||||||
|
|
||||||
|
// add free
|
||||||
|
if countFree >= 3 {
|
||||||
|
spinRes.AddFreeTimes = int32(countFree-2) * 4
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) BroadcastJackpot(sync bool) {
|
||||||
|
if this.lastJackpotValue != this.jackpot.VirtualJK || sync {
|
||||||
|
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||||
|
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||||
|
jpfi := &gamehall.GameJackpotFundInfo{
|
||||||
|
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||||
|
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||||
|
}
|
||||||
|
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
//以平台为标识向该平台内所有玩家广播奖池变动消息,游戏内外的玩家可监听该消息,减少由gamesrv向worldsrv转发这一步
|
||||||
|
tags := []string{this.Platform}
|
||||||
|
logger.Logger.Trace("jackpot caishen", pack)
|
||||||
|
base.PlayerMgrSington.BroadcastMessageToGroup(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, tags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) PushCoinPool(prizeFundAdd int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PushCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PushCoin(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PopCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PopCoin(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
|
||||||
|
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.InsertBurstJackpotLogs(log)
|
||||||
|
}), nil, "InsertBurstJackpotLogs").Start()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) BurstHistory(player *CaiShenPlayerData) {
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
|
||||||
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
var logsp []*caishen.CaiShenBurstHistoryInfo
|
||||||
|
if data != nil {
|
||||||
|
logs := data.([]model.BurstJackpotLog)
|
||||||
|
if len(logs) > 0 {
|
||||||
|
for _, log := range logs {
|
||||||
|
logsp = append(logsp, &caishen.CaiShenBurstHistoryInfo{
|
||||||
|
UserName: log.Name,
|
||||||
|
PriceValue: log.WinCoin,
|
||||||
|
TotalBet: log.TotalBet,
|
||||||
|
Ts: log.Ts,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pack := &caishen.SCCaiShenBurstHistory{
|
||||||
|
BurstLog: logsp,
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("SCCaiShenBurstHistory:", pack)
|
||||||
|
player.SendToClient(int(caishen.CaiShenPacketID_PACKET_SC_CAISHEN_BURSTHISTORY), pack)
|
||||||
|
}), "BurstHistory").Start()
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) GetLastBurstJackPot() time.Time {
|
||||||
|
return this.lastBurstJackPot[this.GetGameFreeId()]
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) SetLastBurstJackPot() {
|
||||||
|
var randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(46800-32400+1) + 32400
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(108000-72000+1) + 72000
|
||||||
|
case 4:
|
||||||
|
randT = rand.Intn(180000-108000+1) + 108000
|
||||||
|
}
|
||||||
|
this.lastBurstJackPot[this.GetGameFreeId()] = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CaiShenSceneData) AIAddJackPot() {
|
||||||
|
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||||
|
var randT = rand.Intn(3) + 1
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(6-1) + 2
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(12-5) + 6
|
||||||
|
case 4:
|
||||||
|
randT = rand.Intn(20-9) + 10
|
||||||
|
default:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
|
||||||
|
this.jackpot.VirtualJK += val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) AIBurstJackPot() {
|
||||||
|
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
jackpotParams := this.DbGameFree.GetJackpot()
|
||||||
|
var jackpotInit = int64(jackpotParams[rule.CAISHEN_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||||
|
|
||||||
|
//AI机器人爆奖
|
||||||
|
val := this.jackpot.VirtualJK
|
||||||
|
this.jackpot.VirtualJK = jackpotInit
|
||||||
|
bet := this.DbGameFree.GetBaseScore() * int32(rule.LINENUM)
|
||||||
|
this.RecordBurstLog(this.RandNickName(), val, int64(bet))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *CaiShenSceneData) KickPlayerByTime() {
|
||||||
|
if time.Now().Sub(this.GameStartTime) > time.Second*3 {
|
||||||
|
this.GameStartTime = time.Now()
|
||||||
|
for _, p := range this.players {
|
||||||
|
if p.IsOnLine() {
|
||||||
|
p.leavetime = 0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
p.leavetime++
|
||||||
|
if p.leavetime < 60 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//踢出玩家
|
||||||
|
this.PlayerLeave(p.Player, common.PlayerLeaveReason_LongTimeNoOp, true)
|
||||||
|
}
|
||||||
|
//for _, p := range this.players {
|
||||||
|
// //游戏次数达到目标值
|
||||||
|
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||||
|
// if !p.IsRob &&
|
||||||
|
// todayGamefreeIDSceneData != nil &&
|
||||||
|
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||||
|
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||||
|
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if this.CheckNeedDestroy() {
|
||||||
|
for _, player := range this.players {
|
||||||
|
if !player.IsRob {
|
||||||
|
if time.Now().Sub(player.LastOPTimer) > 10*time.Second {
|
||||||
|
//离开有统计
|
||||||
|
this.PlayerLeave(player.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.GetRealPlayerCnt() == 0 {
|
||||||
|
this.SceneDestroy(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -459,7 +459,7 @@ func CreatePlayerData(p *base.Player) *chesstitians.ChesstitiansPlayerData {
|
||||||
if p.Items != nil {
|
if p.Items != nil {
|
||||||
pd.Items = make(map[int32]int32)
|
pd.Items = make(map[int32]int32)
|
||||||
for id, num := range p.Items {
|
for id, num := range p.Items {
|
||||||
pd.Items[id] = proto.Int32(num)
|
pd.Items[id] = int32(num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(p.MatchParams) > 0 {
|
if len(p.MatchParams) > 0 {
|
||||||
|
|
@ -1164,9 +1164,15 @@ func (this *SceneStatePlayerOp) OnTick(s *base.Scene) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sceneEx.chess.GetRound() == 1 || sceneEx.chess.GetRound() == 2 {
|
||||||
|
if now.Sub(sceneEx.StateStartTime) > rule.PlayerFirstOpTimeout {
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if now.Sub(sceneEx.StateStartTime) > rule.PlayerOpTimeout {
|
if now.Sub(sceneEx.StateStartTime) > rule.PlayerOpTimeout {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
curPlayer := sceneEx.seats[sceneEx.GetCurOpPos()]
|
curPlayer := sceneEx.seats[sceneEx.GetCurOpPos()]
|
||||||
if time.Duration(curPlayer.getTotalTime())*time.Second >= rule.PlayerTotalTime {
|
if time.Duration(curPlayer.getTotalTime())*time.Second >= rule.PlayerTotalTime {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package easterisland
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/protocol/easterisland"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 复活岛的操作
|
||||||
|
type CSEasterIslandOpPacketFactory struct {
|
||||||
|
}
|
||||||
|
type CSEasterIslandOpHandler struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CSEasterIslandOpPacketFactory) CreatePacket() interface{} {
|
||||||
|
pack := &easterisland.CSEasterIslandOp{}
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
func (this *CSEasterIslandOpHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Trace("CSEasterIslandOpHandler Process recv ", data)
|
||||||
|
if csEasterIslandOp, ok := data.(*easterisland.CSEasterIslandOp); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
logger.Logger.Warn("CSEasterIslandOpHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scene := p.GetScene()
|
||||||
|
if scene == nil {
|
||||||
|
logger.Logger.Warn("CSEasterIslandOpHandler p.scene == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if scene.GameId != common.GameId_EasterIsland {
|
||||||
|
logger.Logger.Error("CSEasterIslandOpHandler gameId Error ", scene.GameId)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !scene.HasPlayer(p) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
sp := scene.GetScenePolicy()
|
||||||
|
if sp != nil {
|
||||||
|
sp.OnPlayerOp(scene, p, int(csEasterIslandOp.GetOpCode()), csEasterIslandOp.GetParams())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// 复活岛的操作
|
||||||
|
common.RegisterHandler(int(easterisland.EasterIslandPacketID_PACKET_CS_EASTERISLAND_PLAYEROP), &CSEasterIslandOpHandler{})
|
||||||
|
netlib.RegisterFactory(int(easterisland.EasterIslandPacketID_PACKET_CS_EASTERISLAND_PLAYEROP), &CSEasterIslandOpPacketFactory{})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
package easterisland
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家游戏数据索引
|
||||||
|
const (
|
||||||
|
EasterIslandFreeTimes int = iota //0 当前剩余免费次数
|
||||||
|
EasterIslandIndexMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 通知奖池变化的时间间隔
|
||||||
|
const jackpotNoticeInterval = time.Second
|
||||||
|
|
||||||
|
// 场景状态
|
||||||
|
const (
|
||||||
|
EasterIslandSceneStateStart int = iota //开始游戏
|
||||||
|
EasterIslandSceneStateMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
const (
|
||||||
|
EasterIslandPlayerOpStart int = iota //游戏
|
||||||
|
EasterIslandPlayerHistory //游戏记录
|
||||||
|
EasterIslandBurstHistory //爆奖记录
|
||||||
|
EasterIslandBonusGame //小游戏
|
||||||
|
EasterIslandBonusGameRecord //小游戏操作记录
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
EasterIslandBonusGameTimeout = time.Second * 60
|
||||||
|
EasterIslandBonusGameStageTimeout = 15 // 小游戏每阶段的超时时间 秒
|
||||||
|
)
|
||||||
|
|
||||||
|
type GameResultLog struct {
|
||||||
|
BaseResult *model.SlotBaseResultType
|
||||||
|
AllLine int32 //线路数
|
||||||
|
UserName string //昵称
|
||||||
|
WinLines []int //赢分的线
|
||||||
|
BetLines []int64 //下注的线
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复活岛解析的数据
|
||||||
|
type EasterIslandGameNoteData struct {
|
||||||
|
Source int32
|
||||||
|
Data *GameResultLog
|
||||||
|
}
|
||||||
|
|
||||||
|
// 复活岛游戏记录
|
||||||
|
func UnMarshalEasterIslandGameNote(data string) (roll interface{}, err error) {
|
||||||
|
gnd := &EasterIslandGameNoteData{}
|
||||||
|
if err := json.Unmarshal([]byte(data), gnd); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
roll = gnd.Data
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// {0, 6, 12, 8, 4}, //线条4
|
||||||
|
// {10, 6, 2, 8, 14}, //线条5
|
||||||
|
// {5, 1, 12, 3, 9}, //线条22
|
||||||
|
// {5, 11, 2, 13, 9}, //线条23
|
||||||
|
var DebugData = [][]int{
|
||||||
|
{
|
||||||
|
5, 8, 6, 8, 5,
|
||||||
|
9, 5, 8, 5, 4,
|
||||||
|
6, 7, 5, 9, 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
6, 8, 5, 8, 6,
|
||||||
|
9, 5, 8, 5, 4,
|
||||||
|
5, 7, 6, 9, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
5, 8, 6, 8, 5,
|
||||||
|
6, 7, 8, 9, 6,
|
||||||
|
5, 6, 5, 6, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
5, 6, 5, 6, 5,
|
||||||
|
6, 7, 8, 9, 6,
|
||||||
|
5, 8, 6, 8, 5,
|
||||||
|
},
|
||||||
|
//{
|
||||||
|
// 3, 3, 3, 3, 3,
|
||||||
|
// 3, 3, 3, 3, 3,
|
||||||
|
// 3, 3, 3, 3, 3,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 4, 4, 4, 4, 4,
|
||||||
|
// 4, 4, 4, 4, 4,
|
||||||
|
// 4, 4, 4, 4, 4,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 5, 5, 5, 5, 5,
|
||||||
|
// 5, 5, 5, 5, 5,
|
||||||
|
// 5, 5, 5, 5, 5,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 6, 6, 6, 6, 6,
|
||||||
|
// 6, 6, 6, 6, 6,
|
||||||
|
// 6, 6, 6, 6, 6,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 7, 7, 7, 7, 7,
|
||||||
|
// 7, 7, 7, 7, 7,
|
||||||
|
// 7, 7, 7, 7, 7,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 8, 8, 8, 8, 8,
|
||||||
|
// 8, 8, 8, 8, 8,
|
||||||
|
// 8, 8, 8, 8, 8,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 9, 9, 9, 9, 9,
|
||||||
|
// 9, 9, 9, 9, 9,
|
||||||
|
// 9, 9, 9, 9, 9,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 10, 10, 10, 10, 10,
|
||||||
|
// 10, 10, 10, 10, 10,
|
||||||
|
// 10, 10, 10, 10, 10,
|
||||||
|
//},
|
||||||
|
//{
|
||||||
|
// 11, 11, 11, 11, 11,
|
||||||
|
// 11, 11, 11, 11, 11,
|
||||||
|
// 11, 11, 11, 11, 11,
|
||||||
|
//},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,155 @@
|
||||||
|
package easterisland
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math/rand"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
|
rule "mongo.games.com/game/gamerule/easterisland"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/protocol/easterisland"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EasterIslandPlayerData struct {
|
||||||
|
*base.Player
|
||||||
|
score int32 //单线押注数
|
||||||
|
spinID int64 //当前旋转ID
|
||||||
|
freeTimes int32 //免费转动次数
|
||||||
|
cards []int32 //15张牌
|
||||||
|
//RollGameType *model.EasterIslandType //记录信息
|
||||||
|
RollGameType *GameResultLog //记录信息
|
||||||
|
enterGameCoin int64 //玩家进入老虎机初始金币
|
||||||
|
taxCoin int64 //本局税收
|
||||||
|
winCoin int64 //本局收税前赢的钱
|
||||||
|
linesWinCoin int64 //本局中奖线赢得钱
|
||||||
|
jackpotWinCoin int64 //本局奖池赢的钱
|
||||||
|
smallGameWinCoin int64 //本局小游戏赢的钱
|
||||||
|
betLines []int64 //下注的选线
|
||||||
|
totalPriceBonus int64 //小游戏得分
|
||||||
|
bonusTimerHandle timer.TimerHandle //托管handle
|
||||||
|
currentLogId string //爆奖玩家logid
|
||||||
|
leavetime int32 //用户离开时间
|
||||||
|
bonusStage int32 //小游戏所处阶段 1选金额 2选倍率
|
||||||
|
bonusStartTime int64 //小游戏阶段开始时间
|
||||||
|
bonusOpRecord []int32 //小游戏操作记录
|
||||||
|
bonusGame *easterisland.EasterIslandBonusGameInfo //小游戏
|
||||||
|
bonusX []int32 //小游戏倍率选项
|
||||||
|
billedData *easterisland.GameBilledData
|
||||||
|
DebugGame bool //测试
|
||||||
|
TestNum int
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家初始化
|
||||||
|
func (this *EasterIslandPlayerData) init(s *base.Scene) {
|
||||||
|
this.Clean()
|
||||||
|
this.score = 0
|
||||||
|
this.freeTimes = 0
|
||||||
|
//this.RollGameType = &model.EasterIslandType{}
|
||||||
|
this.RollGameType = &GameResultLog{}
|
||||||
|
this.RollGameType.BaseResult = &model.SlotBaseResultType{}
|
||||||
|
this.enterGameCoin = this.Coin
|
||||||
|
this.currentLogId = ""
|
||||||
|
this.billedData = &easterisland.GameBilledData{}
|
||||||
|
this.DebugGame = true
|
||||||
|
this.TestNum = 0
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
if this.GDatas == nil {
|
||||||
|
this.GDatas = make(map[string]*model.PlayerGameInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
if d, exist := this.GDatas[s.KeyGamefreeId]; exist {
|
||||||
|
gLen := len(d.Data)
|
||||||
|
if gLen < EasterIslandIndexMax {
|
||||||
|
for i := gLen; i < EasterIslandIndexMax; i++ {
|
||||||
|
d.Data = append(d.Data, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pgd := &model.PlayerGameInfo{
|
||||||
|
Data: make([]int64, EasterIslandIndexMax, EasterIslandIndexMax),
|
||||||
|
}
|
||||||
|
this.GDatas[s.KeyGamefreeId] = pgd
|
||||||
|
}
|
||||||
|
this.LoadPlayerGameData(s.KeyGamefreeId)
|
||||||
|
//线条全选
|
||||||
|
if len(this.betLines) == 0 {
|
||||||
|
this.betLines = rule.AllBetLines
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家清理数据
|
||||||
|
func (this *EasterIslandPlayerData) Clean() {
|
||||||
|
for i := 0; i < len(this.cards); i++ {
|
||||||
|
this.cards[i] = -1
|
||||||
|
}
|
||||||
|
this.winCoin = 0
|
||||||
|
this.taxCoin = 0
|
||||||
|
this.linesWinCoin = 0
|
||||||
|
this.jackpotWinCoin = 0
|
||||||
|
this.smallGameWinCoin = 0
|
||||||
|
this.CleanBonus()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理小游戏数据
|
||||||
|
func (this *EasterIslandPlayerData) CleanBonus() {
|
||||||
|
this.totalPriceBonus = 0
|
||||||
|
this.bonusStage = 0
|
||||||
|
this.bonusTimerHandle = timer.TimerHandle(0)
|
||||||
|
this.bonusStartTime = 0
|
||||||
|
this.bonusOpRecord = make([]int32, 0)
|
||||||
|
this.bonusGame = nil
|
||||||
|
this.bonusX = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
func (this *EasterIslandPlayerData) LoadPlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
this.freeTimes = int32(d.Data[EasterIslandFreeTimes])
|
||||||
|
if this.freeTimes > 0 && len(d.DataEx) != 0 {
|
||||||
|
json.Unmarshal(d.DataEx, &this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储玩家游戏数据
|
||||||
|
func (this *EasterIslandPlayerData) SavePlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
d.Data[EasterIslandFreeTimes] = int64(this.freeTimes)
|
||||||
|
d.DataEx, _ = json.Marshal(this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黑白名单的限制是否生效
|
||||||
|
func (this *EasterIslandPlayerData) CheckBlackWriteList(isWin bool) bool {
|
||||||
|
if isWin && this.BlackLevel > 0 && this.BlackLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.BlackLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if !isWin && this.WhiteLevel > 0 && this.WhiteLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.WhiteLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家是否是新手
|
||||||
|
func (this *EasterIslandPlayerData) IsFNovice(keyGameId string) {
|
||||||
|
if f, ok := this.IsFoolPlayer[keyGameId]; ok {
|
||||||
|
if !f {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.IsFoolPlayer[keyGameId] = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if data, ok := this.GDatas[keyGameId]; ok {
|
||||||
|
if data.Statics.GameTimes < 100 && data.Statics.TotalOut-data.Statics.TotalIn <= 2000000 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.IsFoolPlayer[keyGameId] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,341 @@
|
||||||
|
package easterisland
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/easterisland"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/easterisland"
|
||||||
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
|
)
|
||||||
|
|
||||||
|
type EasterIslandSceneData struct {
|
||||||
|
*base.Scene //房间信息
|
||||||
|
players map[int32]*EasterIslandPlayerData //玩家信息
|
||||||
|
jackpot *base.SlotJackpotPool //奖池
|
||||||
|
lastJackpotValue int64 //上一次奖池变化时的值
|
||||||
|
lastJackPot time.Time //增加奖池时间
|
||||||
|
lastBurstJackPot map[int32]time.Time //爆池时间
|
||||||
|
}
|
||||||
|
|
||||||
|
type EasterIslandJackpot struct {
|
||||||
|
createdTime time.Time
|
||||||
|
userName string
|
||||||
|
priceValue int64
|
||||||
|
roomID int64
|
||||||
|
spinID string
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewEasterIslandSceneData(s *base.Scene) *EasterIslandSceneData {
|
||||||
|
return &EasterIslandSceneData{
|
||||||
|
Scene: s,
|
||||||
|
players: make(map[int32]*EasterIslandPlayerData),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) SaveData(force bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
|
if p, exist := this.players[p.SnId]; exist {
|
||||||
|
delete(this.players, p.SnId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) init() bool {
|
||||||
|
if this.DbGameFree == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
params := this.DbGameFree.GetJackpot()
|
||||||
|
this.jackpot = &base.SlotJackpotPool{}
|
||||||
|
if this.jackpot.Small <= 0 {
|
||||||
|
this.jackpot.Small = 0
|
||||||
|
this.jackpot.VirtualJK = int64(params[rule.EL_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore())
|
||||||
|
}
|
||||||
|
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
|
||||||
|
if str != "" {
|
||||||
|
jackpot := &base.SlotJackpotPool{}
|
||||||
|
err := json.Unmarshal([]byte(str), jackpot)
|
||||||
|
if err == nil {
|
||||||
|
this.jackpot = jackpot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.jackpot != nil {
|
||||||
|
base.SlotsPoolMgr.SetPool(this.GetGameFreeId(), this.Platform, this.jackpot)
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now()
|
||||||
|
this.lastBurstJackPot = make(map[int32]time.Time)
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) SceneDestroy(force bool) {
|
||||||
|
//销毁房间
|
||||||
|
this.Scene.Destroy(force)
|
||||||
|
}
|
||||||
|
|
||||||
|
type EasterIslandSpinResult struct {
|
||||||
|
LinesInfo []*easterisland.EasterIslandLinesInfo
|
||||||
|
SlotsData []int32
|
||||||
|
TotalPrizeLine int64 // 线条总金额
|
||||||
|
TotalPrizeJackpot int64 // 爆奖总金额
|
||||||
|
JackpotCnt int // 爆奖的次数
|
||||||
|
AddFreeTimes int32 // 新增免费次数
|
||||||
|
IsJackpot bool // 是否爆奖
|
||||||
|
BonusGame easterisland.EasterIslandBonusGameInfo
|
||||||
|
BonusX []int32
|
||||||
|
TotalWinRate int32 // 中奖总倍率
|
||||||
|
TotalTaxScore int64 // 税收
|
||||||
|
WinLines []int // 赢分的线
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes EasterIslandSpinResult) {
|
||||||
|
taxRate := this.DbGameFree.GetTaxRate()
|
||||||
|
calcTaxScore := func(score int64, taxScore *int64) int64 {
|
||||||
|
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||||
|
if taxScore != nil {
|
||||||
|
*taxScore += score - newScore
|
||||||
|
}
|
||||||
|
return newScore
|
||||||
|
}
|
||||||
|
|
||||||
|
lines := rule.CalcLine(cards, betLines)
|
||||||
|
for _, line := range lines {
|
||||||
|
if line.Element == rule.Element_EASTERISLAND && line.Count == rule.LINE_CELL {
|
||||||
|
spinRes.IsJackpot = true
|
||||||
|
spinRes.JackpotCnt++
|
||||||
|
}
|
||||||
|
|
||||||
|
curScore := betValue * int64(line.Score)
|
||||||
|
curScore = calcTaxScore(curScore, &spinRes.TotalTaxScore)
|
||||||
|
spinRes.TotalPrizeLine += curScore
|
||||||
|
spinRes.TotalWinRate += int32(line.Score)
|
||||||
|
|
||||||
|
lineInfo := &easterisland.EasterIslandLinesInfo{
|
||||||
|
LineId: proto.Int32(int32(line.Index)),
|
||||||
|
Position: line.Position,
|
||||||
|
PrizeValue: proto.Int64(curScore),
|
||||||
|
}
|
||||||
|
spinRes.LinesInfo = append(spinRes.LinesInfo, lineInfo)
|
||||||
|
spinRes.WinLines = append(spinRes.WinLines, int(lineInfo.GetLineId()))
|
||||||
|
}
|
||||||
|
|
||||||
|
if spinRes.IsJackpot { // 爆奖只计一条线
|
||||||
|
spinRes.TotalPrizeJackpot = calcTaxScore(this.jackpot.VirtualJK, &spinRes.TotalTaxScore)
|
||||||
|
}
|
||||||
|
|
||||||
|
var countBonus, countFree int
|
||||||
|
for _, card := range cards {
|
||||||
|
if card == rule.Element_BONUS {
|
||||||
|
countBonus++
|
||||||
|
}
|
||||||
|
if card == rule.Element_SCATTER {
|
||||||
|
countFree++
|
||||||
|
}
|
||||||
|
spinRes.SlotsData = append(spinRes.SlotsData, int32(card))
|
||||||
|
}
|
||||||
|
|
||||||
|
// bonus game
|
||||||
|
if countBonus >= 3 {
|
||||||
|
if countBonus == 3 {
|
||||||
|
spinRes.BonusX = []int32{1, 2, 3}
|
||||||
|
} else if countBonus == 4 {
|
||||||
|
spinRes.BonusX = []int32{2, 3, 4}
|
||||||
|
} else {
|
||||||
|
spinRes.BonusX = []int32{3, 4, 5}
|
||||||
|
countBonus = 5
|
||||||
|
}
|
||||||
|
totalBet := int64(len(betLines)) * betValue
|
||||||
|
bonusGame := rule.GenerateBonusGame(int(totalBet), countBonus-2)
|
||||||
|
var totalBonusValue int64
|
||||||
|
bonusData := make([]int64, 0)
|
||||||
|
for _, value := range bonusGame.BonusData {
|
||||||
|
value = calcTaxScore(value, nil)
|
||||||
|
totalBonusValue += value
|
||||||
|
bonusData = append(bonusData, int64(value))
|
||||||
|
}
|
||||||
|
spinRes.BonusGame = easterisland.EasterIslandBonusGameInfo{
|
||||||
|
TotalPrizeValue: proto.Int64(totalBonusValue * int64(bonusGame.Mutiplier)),
|
||||||
|
Mutiplier: proto.Int32(int32(bonusGame.Mutiplier)),
|
||||||
|
DataMultiplier: proto.Int64(totalBonusValue),
|
||||||
|
BonusData: bonusData,
|
||||||
|
}
|
||||||
|
// 小游戏税收
|
||||||
|
bonusTax := (bonusGame.DataMultiplier - totalBonusValue) * int64(bonusGame.Mutiplier)
|
||||||
|
spinRes.TotalTaxScore += bonusTax
|
||||||
|
}
|
||||||
|
|
||||||
|
// add free
|
||||||
|
if countFree >= 3 {
|
||||||
|
if countFree > 5 {
|
||||||
|
countFree = 5
|
||||||
|
}
|
||||||
|
spinRes.AddFreeTimes = int32(rule.FreeSpinTimesRate[countFree-1])
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) BroadcastJackpot(sync bool) {
|
||||||
|
if this.lastJackpotValue != this.jackpot.VirtualJK || sync {
|
||||||
|
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||||
|
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||||
|
jpfi := &gamehall.GameJackpotFundInfo{
|
||||||
|
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||||
|
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||||
|
}
|
||||||
|
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
//以平台为标识向该平台内所有玩家广播奖池变动消息,游戏内外的玩家可监听该消息,减少由gamesrv向worldsrv转发这一步
|
||||||
|
tags := []string{this.Platform}
|
||||||
|
logger.Logger.Trace("jackpot easterisland", pack)
|
||||||
|
base.PlayerMgrSington.BroadcastMessageToGroup(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, tags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) PushCoinPool(prizeFundAdd int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PushCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PushCoin(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PopCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PopCoin(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
|
||||||
|
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.InsertBurstJackpotLogs(log)
|
||||||
|
}), nil, "InsertBurstJackpotLogs").Start()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *EasterIslandSceneData) BurstHistory(player *EasterIslandPlayerData) {
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
|
||||||
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
var logsp []*easterisland.EasterIslandBurstHistoryInfo
|
||||||
|
if data != nil {
|
||||||
|
logs := data.([]model.BurstJackpotLog)
|
||||||
|
if len(logs) > 0 {
|
||||||
|
for _, log := range logs {
|
||||||
|
logsp = append(logsp, &easterisland.EasterIslandBurstHistoryInfo{
|
||||||
|
UserName: log.Name,
|
||||||
|
PriceValue: log.WinCoin,
|
||||||
|
TotalBet: log.TotalBet,
|
||||||
|
Ts: log.Ts,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pack := &easterisland.SCEasterIslandBurstHistory{
|
||||||
|
BurstLog: logsp,
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("SCEasterIslandBurstHistory:", pack)
|
||||||
|
player.SendToClient(int(easterisland.EasterIslandPacketID_PACKET_SC_EASTERISLAND_BURSTHISTORY), pack)
|
||||||
|
}), "BurstHistory").Start()
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) GetLastBurstJackPot() time.Time {
|
||||||
|
return this.lastBurstJackPot[this.GetGameFreeId()]
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) SetLastBurstJackPot() {
|
||||||
|
var randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(46800-32400+1) + 32400
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(108000-72000+1) + 72000
|
||||||
|
case 4:
|
||||||
|
randT = rand.Intn(180000-108000+1) + 108000
|
||||||
|
}
|
||||||
|
this.lastBurstJackPot[this.GetGameFreeId()] = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) AIAddJackPot() {
|
||||||
|
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||||
|
var randT = rand.Intn(3) + 1
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(6-1) + 2
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(12-5) + 6
|
||||||
|
case 4:
|
||||||
|
randT = rand.Intn(20-9) + 10
|
||||||
|
default:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
|
||||||
|
this.jackpot.VirtualJK += val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) AIBurstJackPot() {
|
||||||
|
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
jackpotParams := this.DbGameFree.GetJackpot()
|
||||||
|
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||||
|
|
||||||
|
//AI机器人爆奖
|
||||||
|
val := this.jackpot.VirtualJK
|
||||||
|
this.jackpot.VirtualJK = jackpotInit
|
||||||
|
bet := this.DbGameFree.GetBaseScore() * int32(rule.LINENUM)
|
||||||
|
this.RecordBurstLog(this.RandNickName(), val, int64(bet))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *EasterIslandSceneData) KickPlayerByTime() {
|
||||||
|
if time.Now().Sub(this.GameStartTime) > time.Second*3 {
|
||||||
|
this.GameStartTime = time.Now()
|
||||||
|
for _, p := range this.players {
|
||||||
|
if p.IsOnLine() {
|
||||||
|
p.leavetime = 0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
p.leavetime++
|
||||||
|
if p.leavetime < 60 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//踢出玩家
|
||||||
|
this.PlayerLeave(p.Player, common.PlayerLeaveReason_LongTimeNoOp, true)
|
||||||
|
}
|
||||||
|
//for _, p := range this.players {
|
||||||
|
// //游戏次数达到目标值
|
||||||
|
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||||
|
// if !p.IsRob &&
|
||||||
|
// todayGamefreeIDSceneData != nil &&
|
||||||
|
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||||
|
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||||
|
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if this.CheckNeedDestroy() {
|
||||||
|
for _, player := range this.players {
|
||||||
|
if !player.IsRob {
|
||||||
|
if time.Now().Sub(player.LastOPTimer) > 10*time.Second {
|
||||||
|
//离开有统计
|
||||||
|
this.PlayerLeave(player.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.GetRealPlayerCnt() == 0 {
|
||||||
|
this.SceneDestroy(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,958 @@
|
||||||
|
package easterisland
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core"
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/easterisland"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/easterisland"
|
||||||
|
"mongo.games.com/game/protocol/server"
|
||||||
|
)
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//复活岛
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// 房间内主要逻辑
|
||||||
|
var ScenePolicyEasterIslandSington = &ScenePolicyEasterIsland{}
|
||||||
|
|
||||||
|
type ScenePolicyEasterIsland struct {
|
||||||
|
base.BaseScenePolicy
|
||||||
|
states [EasterIslandSceneStateMax]base.SceneState
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建场景扩展数据
|
||||||
|
func (this *ScenePolicyEasterIsland) CreateSceneExData(s *base.Scene) interface{} {
|
||||||
|
sceneEx := NewEasterIslandSceneData(s)
|
||||||
|
if sceneEx != nil {
|
||||||
|
if sceneEx.init() {
|
||||||
|
s.ExtraData = sceneEx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sceneEx
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建玩家扩展数据
|
||||||
|
func (this *ScenePolicyEasterIsland) CreatePlayerExData(s *base.Scene, p *base.Player) interface{} {
|
||||||
|
playerEx := &EasterIslandPlayerData{Player: p}
|
||||||
|
if playerEx != nil {
|
||||||
|
p.ExtraData = playerEx
|
||||||
|
}
|
||||||
|
return playerEx
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景开启事件
|
||||||
|
func (this *ScenePolicyEasterIsland) OnStart(s *base.Scene) {
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnStart, sceneId=", s.SceneId)
|
||||||
|
sceneEx := NewEasterIslandSceneData(s)
|
||||||
|
if sceneEx != nil {
|
||||||
|
if sceneEx.init() {
|
||||||
|
s.ExtraData = sceneEx
|
||||||
|
s.ChangeSceneState(EasterIslandSceneStateStart) //改变当前的玩家状态
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景关闭事件
|
||||||
|
func (this *ScenePolicyEasterIsland) OnStop(s *base.Scene) {
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnStop , sceneId=", s.SceneId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
sceneEx.SaveData(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景心跳事件
|
||||||
|
func (this *ScenePolicyEasterIsland) OnTick(s *base.Scene) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
s.SceneState.OnTick(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家进入事件
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerEnter(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerEnter, sceneId=", s.SceneId, " player=", p.SnId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
playerEx := &EasterIslandPlayerData{Player: p}
|
||||||
|
playerEx.init(s) // 玩家当前信息初始化
|
||||||
|
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
|
||||||
|
sceneEx.players[p.SnId] = playerEx
|
||||||
|
p.ExtraData = playerEx
|
||||||
|
EasterIslandSendRoomInfo(s, p, sceneEx, playerEx, nil)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventEnter, nil) //回调会调取 onPlayerEvent事件
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家离开事件
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerLeave(s *base.Scene, p *base.Player, reason int) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerLeave, sceneId=", s.SceneId, " player=", p.SnId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
if this.CanChangeCoinScene(s, p) {
|
||||||
|
if playerEx, ok := p.ExtraData.(*EasterIslandPlayerData); ok {
|
||||||
|
playerEx.SavePlayerGameData(s.KeyGamefreeId)
|
||||||
|
}
|
||||||
|
sceneEx.OnPlayerLeave(p, reason)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventLeave, []int64{int64(reason)})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家掉线
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerDropLine(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerDropLine, sceneId=", s.SceneId, " player=", p.SnId)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventDropLine, nil)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
if sceneEx.Gaming {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家重连
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerRehold(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerRehold, sceneId=", s.SceneId, " player=", p.Name)
|
||||||
|
//if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
// if playerEx, ok := p.ExtraData.(*EasterIslandPlayerData); ok {
|
||||||
|
//发送房间信息给自己
|
||||||
|
//EasterIslandSendRoomInfo(s, p, sceneEx, playerEx)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家重连
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerReturn(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyEasterIsland) OnPlayerReturn, sceneId=", s.SceneId, " player=", p.Name)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
if playerEx, ok := p.ExtraData.(*EasterIslandPlayerData); ok {
|
||||||
|
//发送房间信息给自己
|
||||||
|
EasterIslandSendRoomInfo(s, p, sceneEx, playerEx, playerEx.billedData)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventReturn, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
return s.SceneState.OnPlayerOp(s, p, opcode, params)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家事件
|
||||||
|
func (this *ScenePolicyEasterIsland) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
s.SceneState.OnPlayerEvent(s, p, evtcode, params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否完成了整个牌局
|
||||||
|
func (this *ScenePolicyEasterIsland) IsCompleted(s *base.Scene) bool { return false }
|
||||||
|
|
||||||
|
// 是否可以强制开始
|
||||||
|
func (this *ScenePolicyEasterIsland) IsCanForceStart(s *base.Scene) bool { return true }
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *ScenePolicyEasterIsland) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
return s.SceneState.CanChangeCoinScene(s, p)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ScenePolicyEasterIsland) RegisteSceneState(state base.SceneState) {
|
||||||
|
if state == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
stateid := state.GetState()
|
||||||
|
if stateid < 0 || stateid >= EasterIslandSceneStateMax {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.states[stateid] = state
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ScenePolicyEasterIsland) GetSceneState(s *base.Scene, stateid int) base.SceneState {
|
||||||
|
if stateid >= 0 && stateid < EasterIslandSceneStateMax {
|
||||||
|
return ScenePolicyEasterIslandSington.states[stateid]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ScenePolicyEasterIsland) GetJackPotVal(s *base.Scene) int64 {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
if sceneEx.lastJackpotValue != sceneEx.jackpot.VirtualJK {
|
||||||
|
return sceneEx.jackpot.VirtualJK
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
func EasterIslandSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *EasterIslandSceneData, playerEx *EasterIslandPlayerData, data *easterisland.GameBilledData) {
|
||||||
|
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
|
||||||
|
pack := &easterisland.SCEasterIslandRoomInfo{
|
||||||
|
RoomId: proto.Int(s.SceneId),
|
||||||
|
Creator: proto.Int32(s.Creator),
|
||||||
|
GameId: proto.Int(s.GameId),
|
||||||
|
RoomMode: proto.Int(s.GameMode),
|
||||||
|
Params: s.Params,
|
||||||
|
State: proto.Int(s.SceneState.GetState()),
|
||||||
|
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||||
|
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||||
|
BilledData: data,
|
||||||
|
}
|
||||||
|
if playerEx != nil {
|
||||||
|
pd := &easterisland.EasterIslandPlayerData{
|
||||||
|
SnId: proto.Int32(playerEx.SnId),
|
||||||
|
Name: proto.String(playerEx.Name),
|
||||||
|
Head: proto.Int32(playerEx.Head),
|
||||||
|
Sex: proto.Int32(playerEx.Sex),
|
||||||
|
Coin: proto.Int64(playerEx.Coin),
|
||||||
|
HeadOutLine: proto.Int32(playerEx.HeadOutLine),
|
||||||
|
VIP: proto.Int32(playerEx.VIP),
|
||||||
|
}
|
||||||
|
pack.Players = append(pack.Players, pd)
|
||||||
|
//for _, value := range playerEx.cards {
|
||||||
|
// pack.Cards = append(pack.Cards, int32(value))
|
||||||
|
//}
|
||||||
|
pack.BetLines = playerEx.betLines
|
||||||
|
pack.FreeTimes = proto.Int32(playerEx.freeTimes)
|
||||||
|
pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
|
||||||
|
pack.SpinID = proto.Int64(playerEx.spinID)
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
switch playerEx.bonusStage {
|
||||||
|
case 0:
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, playerEx.bonusStage)
|
||||||
|
case 1:
|
||||||
|
if time.Now().Unix()-playerEx.bonusStartTime >= EasterIslandBonusGameStageTimeout*2 {
|
||||||
|
playerEx.CleanBonus()
|
||||||
|
} else if time.Now().Unix()-playerEx.bonusStartTime >= EasterIslandBonusGameStageTimeout {
|
||||||
|
playerEx.bonusStage = 2
|
||||||
|
playerEx.bonusStartTime += EasterIslandBonusGameStageTimeout
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, playerEx.bonusStage)
|
||||||
|
leftTime := playerEx.bonusStartTime + EasterIslandBonusGameStageTimeout + 2 - time.Now().Unix()
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, int32(leftTime))
|
||||||
|
} else {
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, playerEx.bonusStage)
|
||||||
|
leftTime := playerEx.bonusStartTime + EasterIslandBonusGameStageTimeout + 2 - time.Now().Unix()
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, int32(leftTime))
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, playerEx.bonusOpRecord...)
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
if time.Now().Unix()-playerEx.bonusStartTime >= EasterIslandBonusGameStageTimeout {
|
||||||
|
playerEx.CleanBonus()
|
||||||
|
} else {
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, playerEx.bonusStage)
|
||||||
|
leftTime := playerEx.bonusStartTime + EasterIslandBonusGameStageTimeout + 2 - time.Now().Unix()
|
||||||
|
pack.ParamsEx = append(pack.ParamsEx, int32(leftTime))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus)
|
||||||
|
pack.BonusGame = playerEx.bonusGame
|
||||||
|
pack.BonusX = playerEx.bonusX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
p.SendToClient(int(easterisland.EasterIslandPacketID_PACKET_SC_EASTERISLAND_ROOMINFO), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneStateEasterIslandStart struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前场景状态
|
||||||
|
func (this *SceneStateEasterIslandStart) GetState() int { return EasterIslandSceneStateStart }
|
||||||
|
|
||||||
|
// 是否可以切换状态到
|
||||||
|
func (this *SceneStateEasterIslandStart) CanChangeTo(s base.SceneState) bool { return true }
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *SceneStateEasterIslandStart) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) GetTimeout(s *base.Scene) int { return 0 }
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) OnEnter(s *base.Scene) {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
logger.Logger.Tracef("(this *Scene) [%v] 场景状态进入 %v", s.SceneId, len(sceneEx.players))
|
||||||
|
sceneEx.StateStartTime = time.Now()
|
||||||
|
pack := &easterisland.SCEasterIslandRoomState{
|
||||||
|
State: proto.Int(this.GetState()),
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
s.Broadcast(int(easterisland.EasterIslandPacketID_PACKET_SC_EASTERISLAND_ROOMSTATE), pack, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) OnLeave(s *base.Scene) {}
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) OnTick(s *base.Scene) {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*EasterIslandSceneData); ok {
|
||||||
|
sceneEx.AIAddJackPot()
|
||||||
|
sceneEx.AIBurstJackPot()
|
||||||
|
sceneEx.KickPlayerByTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
playerEx, ok := p.ExtraData.(*EasterIslandPlayerData)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
sceneEx, ok := s.ExtraData.(*EasterIslandSceneData)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if sceneEx.CheckNeedDestroy() && playerEx.freeTimes <= 0 {
|
||||||
|
//离开有统计
|
||||||
|
sceneEx.PlayerLeave(playerEx.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
switch opcode {
|
||||||
|
case EasterIslandPlayerOpStart: //开始
|
||||||
|
//if !easterIslandBenchTest {
|
||||||
|
// easterIslandBenchTest = true
|
||||||
|
// for i := 0; i < 10; i++ {
|
||||||
|
// //this.BenchTest(s, p)
|
||||||
|
// this.WinTargetBenchTest(s, p)
|
||||||
|
// }
|
||||||
|
// return true
|
||||||
|
//}
|
||||||
|
|
||||||
|
//参数是否合法
|
||||||
|
//params 参数0底注,后面跟客户端选择的线n条线(1<=n<=25),客户端线是从1开始算起1~25条线
|
||||||
|
if len(params) < 2 || len(params) > rule.LINENUM+1 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
//先做底注校验
|
||||||
|
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.score = int32(params[0]) // 单线押注数
|
||||||
|
// 小游戏未结束 不能进行下一次旋转
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
//判断线条是否重复,是否合法
|
||||||
|
lineFlag := make(map[int64]bool)
|
||||||
|
lineParams := make([]int64, 0)
|
||||||
|
for i := 1; i < len(params); i++ {
|
||||||
|
lineNum := params[i]
|
||||||
|
if lineNum >= 1 && lineNum <= int64(rule.LINENUM) && !lineFlag[lineNum] {
|
||||||
|
lineParams = append(lineParams, lineNum)
|
||||||
|
lineFlag[lineNum] = true
|
||||||
|
} else {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//没有选线参数
|
||||||
|
if len(lineParams) == 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取总投注金额(所有线的总投注) | 校验玩家余额是否足够
|
||||||
|
totalBetValue := (int64(len(lineParams))) * params[0]
|
||||||
|
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
|
||||||
|
return false
|
||||||
|
} else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_CoinNotEnough, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
p.LastOPTimer = time.Now()
|
||||||
|
sceneEx.GameNowTime = time.Now()
|
||||||
|
sceneEx.NumOfGames++
|
||||||
|
p.GameTimes++
|
||||||
|
|
||||||
|
//获取当前水池的上下文环境
|
||||||
|
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
|
||||||
|
taxRate := sceneEx.DbGameFree.GetTaxRate()
|
||||||
|
if taxRate < 0 || taxRate > 10000 {
|
||||||
|
logger.Logger.Warnf("EasterIslandErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
|
||||||
|
taxRate = 500
|
||||||
|
}
|
||||||
|
coinPoolSetting := base.CoinPoolMgr.GetCoinPoolSetting(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
|
||||||
|
ctroRate := 500 //调节赔率 暗税系数
|
||||||
|
logger.Logger.Tracef("EasterIslandRates [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate, ctroRate)
|
||||||
|
|
||||||
|
playerEx.IsFNovice(sceneEx.KeyGameId)
|
||||||
|
isFoolPlayer := false
|
||||||
|
var gamePoolCoin int64
|
||||||
|
//if isFoolPlayer {
|
||||||
|
// gamePoolCoin = base.CoinPoolMgr.GetNoviceCoinPool(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||||
|
//} else {
|
||||||
|
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||||
|
//}
|
||||||
|
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||||
|
jackpotParams := sceneEx.DbGameFree.GetJackpot() // 奖池参数
|
||||||
|
var jackpotInit = int64(jackpotParams[rule.EL_JACKPOT_InitJackpot] * sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
|
||||||
|
|
||||||
|
var jackpotFundAdd, prizeFundAdd int64
|
||||||
|
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
|
||||||
|
playerEx.betLines = lineParams // 选线记录
|
||||||
|
jackpotFundAdd = int64(math.Floor(float64(totalBetValue) * (float64(ctroRate) / 10000.0))) //奖池要增加的金额
|
||||||
|
prizeFundAdd = totalBetValue - jackpotFundAdd //现金池增加的金额
|
||||||
|
//扣除投注金币
|
||||||
|
p.AddCoin(-totalBetValue, common.GainWay_HundredSceneLost, base.SyncFlag_ToClient, "system", s.GetSceneName())
|
||||||
|
if !p.IsRob && !sceneEx.Testing {
|
||||||
|
// 推送金币
|
||||||
|
sceneEx.PushCoinPool(prizeFundAdd, isFoolPlayer)
|
||||||
|
}
|
||||||
|
|
||||||
|
////统计参与游戏次数
|
||||||
|
//if !sceneEx.Testing && !playerEx.IsRob {
|
||||||
|
// pack := &server.GWSceneEnd{
|
||||||
|
// GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||||
|
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
|
||||||
|
// }
|
||||||
|
// proto.SetDefaults(pack)
|
||||||
|
// sceneEx.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENEEND), pack)
|
||||||
|
//}
|
||||||
|
} else {
|
||||||
|
totalBetValue = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
writeBlackTryTimes := 0
|
||||||
|
WriteBlack:
|
||||||
|
slotData := make([]int, 0)
|
||||||
|
var spinRes EasterIslandSpinResult
|
||||||
|
var slotDataIsOk bool
|
||||||
|
for {
|
||||||
|
var symbolType rule.Symbol
|
||||||
|
if gamePoolCoin < int64(coinPoolSetting.GetLowerLimit()) { // userInfo.prizeFund < limit * roomId
|
||||||
|
symbolType = rule.SYMBOL1
|
||||||
|
} else {
|
||||||
|
symbolType = rule.SYMBOL2
|
||||||
|
}
|
||||||
|
slotData, _ = rule.GenerateSlotsData_v2(symbolType)
|
||||||
|
|
||||||
|
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
|
||||||
|
|
||||||
|
// 免费次数时 不允许爆奖
|
||||||
|
if playerEx.freeTimes > 0 && spinRes.IsJackpot {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if spinRes.JackpotCnt > 1 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if spinRes.IsJackpot {
|
||||||
|
if sceneEx.jackpot.Small < sceneEx.jackpot.VirtualJK {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spinCondition := prizeFund + prizeFundAdd - (spinRes.TotalPrizeLine + spinRes.BonusGame.GetTotalPrizeValue() + spinRes.TotalPrizeJackpot)
|
||||||
|
spinCondition += jackpotFundAdd + sceneEx.jackpot.VirtualJK - jackpotInit
|
||||||
|
win := spinRes.TotalPrizeLine + spinRes.BonusGame.GetTotalPrizeValue() + spinRes.TotalPrizeJackpot
|
||||||
|
// 现金池不足时 重新发牌
|
||||||
|
if spinCondition < 0 && win > totalBetValue {
|
||||||
|
if !spinRes.IsJackpot { // 非爆奖 水池不足 不再进行黑白名单调控
|
||||||
|
writeBlackTryTimes = 999
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// 非爆奖时 不允许赢取太大的奖励
|
||||||
|
var limitBigWin int64 = 50
|
||||||
|
if spinCondition < int64(coinPoolSetting.GetLowerLimit()) { //现金池不足时
|
||||||
|
limitBigWin = int64(jackpotParams[rule.EL_JACKPOT_LIMITWIN_PRIZELOW])
|
||||||
|
} else {
|
||||||
|
limitBigWin = int64(jackpotParams[rule.EL_JACKPOT_LIMITWIN_PRIZEHIGH])
|
||||||
|
}
|
||||||
|
if totalBetValue > 0 && !spinRes.IsJackpot && spinRes.TotalPrizeLine+spinRes.BonusGame.GetTotalPrizeValue() > totalBetValue*limitBigWin {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
slotDataIsOk = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if !slotDataIsOk {
|
||||||
|
slotData = rule.MissData[rand.Intn(len(rule.MissData))]
|
||||||
|
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黑白名单调控 防止异常循环,添加上限次数
|
||||||
|
if writeBlackTryTimes < 100 && playerEx.CheckBlackWriteList(spinRes.TotalPrizeLine+spinRes.TotalPrizeJackpot+spinRes.BonusGame.GetTotalPrizeValue() > totalBetValue) {
|
||||||
|
writeBlackTryTimes++
|
||||||
|
goto WriteBlack
|
||||||
|
} else if writeBlackTryTimes >= 100 && writeBlackTryTimes != 999 {
|
||||||
|
logger.Logger.Warnf("EasterIslandWriteBlackTryTimesOver [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, gamePoolCoin, playerEx.BlackLevel, playerEx.WhiteLevel)
|
||||||
|
}
|
||||||
|
// 奖池水池处理
|
||||||
|
if spinRes.IsJackpot {
|
||||||
|
sceneEx.jackpot.Small -= sceneEx.jackpot.VirtualJK
|
||||||
|
if sceneEx.jackpot.Small < 0 {
|
||||||
|
sceneEx.jackpot.Small = 0
|
||||||
|
}
|
||||||
|
sceneEx.jackpot.VirtualJK = jackpotInit
|
||||||
|
} else {
|
||||||
|
sceneEx.jackpot.Small += jackpotFundAdd
|
||||||
|
sceneEx.jackpot.VirtualJK += jackpotFundAdd
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家赢钱
|
||||||
|
totalWinScore := spinRes.TotalPrizeLine + spinRes.TotalPrizeJackpot
|
||||||
|
if totalWinScore > 0 || len(spinRes.BonusX) > 0 {
|
||||||
|
p.AddCoin(totalWinScore+spinRes.BonusGame.GetTotalPrizeValue(), common.GainWay_HundredSceneWin, 0, "system", s.GetSceneName())
|
||||||
|
if !p.IsRob && !sceneEx.Testing {
|
||||||
|
sceneEx.PopCoinPool(totalWinScore+spinRes.BonusGame.GetTotalPrizeValue()+spinRes.TotalTaxScore, isFoolPlayer)
|
||||||
|
}
|
||||||
|
playerEx.taxCoin = spinRes.TotalTaxScore
|
||||||
|
playerEx.AddServiceFee(playerEx.taxCoin)
|
||||||
|
}
|
||||||
|
p.StaticsLaba(sceneEx.KeyGameId, sceneEx.KeyGamefreeId, totalBetValue, totalWinScore+spinRes.BonusGame.GetTotalPrizeValue()+spinRes.TotalTaxScore)
|
||||||
|
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Sucess, append(params[:1], playerEx.betLines...))
|
||||||
|
|
||||||
|
var isFreeFlag bool
|
||||||
|
if playerEx.freeTimes > 0 {
|
||||||
|
playerEx.freeTimes--
|
||||||
|
isFreeFlag = true
|
||||||
|
}
|
||||||
|
playerEx.freeTimes += spinRes.AddFreeTimes
|
||||||
|
|
||||||
|
rule.SpinID++
|
||||||
|
playerEx.spinID = rule.SpinID
|
||||||
|
playerEx.cards = spinRes.SlotsData
|
||||||
|
playerEx.winCoin = spinRes.TotalPrizeLine + spinRes.TotalPrizeJackpot + spinRes.BonusGame.GetTotalPrizeValue() + playerEx.taxCoin
|
||||||
|
playerEx.linesWinCoin = spinRes.TotalPrizeLine
|
||||||
|
playerEx.jackpotWinCoin = spinRes.TotalPrizeJackpot
|
||||||
|
playerEx.smallGameWinCoin = spinRes.BonusGame.GetTotalPrizeValue()
|
||||||
|
playerEx.CurrentBet = totalBetValue
|
||||||
|
playerEx.CurrentTax = playerEx.taxCoin
|
||||||
|
|
||||||
|
// 小游戏超时处理
|
||||||
|
if len(spinRes.BonusX) > 0 {
|
||||||
|
playerEx.totalPriceBonus = spinRes.BonusGame.GetTotalPrizeValue()
|
||||||
|
playerEx.bonusGame = &spinRes.BonusGame
|
||||||
|
playerEx.bonusX = spinRes.BonusX
|
||||||
|
logger.Logger.Tracef("BonusGame Start [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, playerEx.totalPriceBonus)
|
||||||
|
}
|
||||||
|
|
||||||
|
playerEx.billedData = &easterisland.GameBilledData{
|
||||||
|
SpinID: proto.Int64(playerEx.spinID),
|
||||||
|
SlotsData: spinRes.SlotsData,
|
||||||
|
AddFreeSpin: proto.Int32(spinRes.AddFreeTimes),
|
||||||
|
IsJackpot: proto.Bool(spinRes.IsJackpot),
|
||||||
|
PrizeLines: spinRes.LinesInfo,
|
||||||
|
TotalPrizeValue: proto.Int64(spinRes.TotalPrizeLine + spinRes.TotalPrizeJackpot),
|
||||||
|
TotalPaylinePrizeValue: proto.Int64(spinRes.TotalPrizeLine),
|
||||||
|
TotalJackpotValue: proto.Int64(spinRes.TotalPrizeJackpot),
|
||||||
|
Balance: proto.Int64(playerEx.Coin - spinRes.BonusGame.GetTotalPrizeValue()),
|
||||||
|
FreeSpins: proto.Int32(playerEx.freeTimes),
|
||||||
|
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||||
|
BonusX: spinRes.BonusX,
|
||||||
|
BonusGame: &spinRes.BonusGame,
|
||||||
|
}
|
||||||
|
pack := &easterisland.SCEasterIslandGameBilled{
|
||||||
|
BilledData: playerEx.billedData,
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
logger.Logger.Infof("EasterIslandPlayerOpStart %v", pack)
|
||||||
|
p.SendToClient(int(easterisland.EasterIslandPacketID_PACKET_SC_EASTERISLAND_GAMEBILLED), pack)
|
||||||
|
|
||||||
|
// 记录本次操作
|
||||||
|
playerEx.RollGameType.BaseResult.WinTotal = pack.BilledData.GetTotalPrizeValue() + pack.BilledData.GetBonusGame().GetTotalPrizeValue()
|
||||||
|
playerEx.RollGameType.BaseResult.IsFree = isFreeFlag
|
||||||
|
playerEx.RollGameType.BaseResult.WinSmallGame = pack.BilledData.BonusGame.GetTotalPrizeValue()
|
||||||
|
playerEx.RollGameType.BaseResult.AllWinNum = int32(len(pack.BilledData.PrizeLines))
|
||||||
|
playerEx.RollGameType.BaseResult.WinRate = spinRes.TotalWinRate
|
||||||
|
playerEx.RollGameType.BaseResult.Cards = pack.BilledData.GetSlotsData()
|
||||||
|
playerEx.RollGameType.BaseResult.WinLineScore = pack.BilledData.TotalPaylinePrizeValue
|
||||||
|
playerEx.RollGameType.WinLines = spinRes.WinLines
|
||||||
|
playerEx.RollGameType.BaseResult.WinJackpot = pack.BilledData.GetTotalJackpotValue()
|
||||||
|
playerEx.RollGameType.BaseResult.IsFoolPlayer = isFoolPlayer
|
||||||
|
EasterIslandCheckAndSaveLog(sceneEx, playerEx)
|
||||||
|
|
||||||
|
// 广播奖池
|
||||||
|
if totalBetValue == 0 && !spinRes.IsJackpot { // 没改变奖池
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 添加进开奖记录里面
|
||||||
|
if spinRes.IsJackpot {
|
||||||
|
sceneEx.RecordBurstLog(playerEx.Name, pack.BilledData.GetTotalJackpotValue(), playerEx.CurrentBet)
|
||||||
|
}
|
||||||
|
logger.Logger.Tracef("---easterisland---当前奖池:真人[%v] 虚拟[%v]", sceneEx.jackpot.Small, sceneEx.jackpot.VirtualJK)
|
||||||
|
case EasterIslandBurstHistory:
|
||||||
|
sceneEx.BurstHistory(playerEx)
|
||||||
|
case EasterIslandPlayerHistory:
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
|
||||||
|
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId)
|
||||||
|
pack := &easterisland.SCEasterIslandPlayerHistory{}
|
||||||
|
for _, v := range gpl.Data {
|
||||||
|
//if v.GameDetailedLogId == "" {
|
||||||
|
// logger.Logger.Error("EasterIslandPlayerHistory GameDetailedLogId is nil")
|
||||||
|
// break
|
||||||
|
//}
|
||||||
|
//gdl := model.GetPlayerHistory(p.Platform, v.GameDetailedLogId)
|
||||||
|
//if gdl == nil {
|
||||||
|
// logger.Logger.Error("EasterIslandPlayerHistory gdl is nil")
|
||||||
|
// continue
|
||||||
|
//}
|
||||||
|
//data, err := UnMarshalEasterIslandGameNote(gdl.GameDetailedNote)
|
||||||
|
//if err != nil {
|
||||||
|
// logger.Logger.Errorf("UnMarshalEasterIslandGameNote error:%v", err)
|
||||||
|
// continue
|
||||||
|
//}
|
||||||
|
//if gnd, ok := data.(*GameResultLog); ok {
|
||||||
|
//
|
||||||
|
//}
|
||||||
|
player := &easterisland.EasterIslandPlayerHistoryInfo{
|
||||||
|
SpinID: proto.String(spinid),
|
||||||
|
CreatedTime: proto.Int64(int64(v.Ts)),
|
||||||
|
TotalBetValue: proto.Int64(v.BetAmount),
|
||||||
|
TotalPriceValue: proto.Int64(v.WinTotal),
|
||||||
|
IsFree: proto.Bool(v.IsFree),
|
||||||
|
TotalBonusValue: proto.Int64(v.WinSmallGame),
|
||||||
|
}
|
||||||
|
pack.PlayerHistory = append(pack.PlayerHistory, player)
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
logger.Logger.Info("EasterIslandPlayerHistory: ", pack)
|
||||||
|
return pack
|
||||||
|
|
||||||
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
if data == nil {
|
||||||
|
logger.Logger.Error("EasterIslandPlayerHistory data is nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
p.SendToClient(int(easterisland.EasterIslandPacketID_PACKET_SC_EASTERISLAND_PLAYERHISTORY), data)
|
||||||
|
}), "CSGetEasterIslandPlayerHistoryHandler").Start()
|
||||||
|
case EasterIslandBonusGame:
|
||||||
|
//参数是否合法 params 参数0 spinID
|
||||||
|
if len(params) < 1 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if playerEx.spinID != params[0] || playerEx.totalPriceBonus <= 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if playerEx.bonusTimerHandle != timer.TimerHandle(0) {
|
||||||
|
timer.StopTimer(playerEx.bonusTimerHandle)
|
||||||
|
playerEx.bonusTimerHandle = timer.TimerHandle(0)
|
||||||
|
}
|
||||||
|
logger.Logger.Tracef("BonusGame Start [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, playerEx.totalPriceBonus)
|
||||||
|
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Sucess, []int64{playerEx.totalPriceBonus, playerEx.Coin})
|
||||||
|
playerEx.CleanBonus()
|
||||||
|
case EasterIslandBonusGameRecord:
|
||||||
|
// params[0] 小游戏阶段: 0 小游戏动画开始 1 小游戏界面1 2 切换小游戏界面2
|
||||||
|
// params[1] 小游戏界面1时,选择奖项的界面位置信息
|
||||||
|
if len(params) < 1 || params[0] < 0 || params[0] > 2 || playerEx.totalPriceBonus <= 0 || (params[0] == 1 && len(params) < 2) {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if params[0] == 0 {
|
||||||
|
if playerEx.bonusStage > 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.bonusStage = 1
|
||||||
|
playerEx.bonusStartTime = time.Now().Unix()
|
||||||
|
} else if params[0] == 2 {
|
||||||
|
if playerEx.bonusStage != 1 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.bonusStage = 2
|
||||||
|
playerEx.bonusStartTime = time.Now().Unix()
|
||||||
|
} else if params[0] == 1 {
|
||||||
|
if params[1] < 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
} else if playerEx.bonusGame != nil && len(playerEx.bonusOpRecord) >= len(playerEx.bonusGame.BonusData) {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.bonusOpRecord = append(playerEx.bonusOpRecord, int32(params[1]))
|
||||||
|
}
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, easterisland.OpResultCode_OPRC_Sucess, params)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送玩家操作情况
|
||||||
|
func (this *SceneStateEasterIslandStart) OnPlayerSToCOp(s *base.Scene, p *base.Player, pos int, opcode int,
|
||||||
|
opRetCode easterisland.OpResultCode, params []int64) {
|
||||||
|
pack := &easterisland.SCEasterIslandOp{
|
||||||
|
SnId: proto.Int32(p.SnId),
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: opRetCode,
|
||||||
|
Params: params,
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
p.SendToClient(int(easterisland.EasterIslandPacketID_PACKET_SC_EASTERISLAND_PLAYEROP), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
var easterIslandBenchTest bool
|
||||||
|
var easterIslandBenchTestTimes int
|
||||||
|
|
||||||
|
func (this *SceneStateEasterIslandStart) BenchTest(s *base.Scene, p *base.Player) {
|
||||||
|
const BENCH_CNT = 10000
|
||||||
|
setting := base.CoinPoolMgr.GetCoinPoolSetting(s.Platform, s.GetGameFreeId(), s.GroupId)
|
||||||
|
oldPoolCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
|
if easterIslandBenchTestTimes == 0 {
|
||||||
|
defaultVal := int64(setting.GetLowerLimit())
|
||||||
|
if oldPoolCoin != defaultVal {
|
||||||
|
base.CoinPoolMgr.PushCoin(s.GetGameFreeId(), s.GroupId, s.Platform, defaultVal-oldPoolCoin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
easterIslandBenchTestTimes++
|
||||||
|
|
||||||
|
fileName := fmt.Sprintf("easterisland-%v-%d.csv", p.SnId, easterIslandBenchTestTimes)
|
||||||
|
file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
|
||||||
|
defer file.Close()
|
||||||
|
if err != nil {
|
||||||
|
file, err = os.Create(fileName)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
|
||||||
|
|
||||||
|
oldCoin := p.Coin
|
||||||
|
p.Coin = 100000000
|
||||||
|
if playerEx, ok := p.ExtraData.(*EasterIslandPlayerData); ok {
|
||||||
|
for i := 0; i < BENCH_CNT; i++ {
|
||||||
|
startCoin := p.Coin
|
||||||
|
freeTimes := playerEx.freeTimes
|
||||||
|
poolCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
|
playerEx.UnmarkFlag(base.PlayerState_GameBreak)
|
||||||
|
suc := this.OnPlayerOp(s, p, EasterIslandPlayerOpStart, append([]int64{int64(playerEx.score)}, rule.AllBetLines...))
|
||||||
|
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||||
|
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
|
||||||
|
taxCoin := playerEx.RollGameType.BaseResult.Tax
|
||||||
|
|
||||||
|
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin,
|
||||||
|
playerEx.RollGameType.BaseResult.WinSmallGame, playerEx.RollGameType.BaseResult.WinRate, playerEx.RollGameType.BaseResult.AllWinNum, freeTimes)
|
||||||
|
file.WriteString(str)
|
||||||
|
if !suc {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
this.OnPlayerOp(s, p, EasterIslandBonusGame, []int64{playerEx.spinID})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.Coin = oldCoin
|
||||||
|
}
|
||||||
|
func (this *SceneStateEasterIslandStart) WinTargetBenchTest(s *base.Scene, p *base.Player) {
|
||||||
|
const BENCH_CNT = 10000
|
||||||
|
var once = sync.Once{}
|
||||||
|
once.Do(func() {
|
||||||
|
setting := base.CoinPoolMgr.GetCoinPoolSetting(s.Platform, s.GetGameFreeId(), s.GroupId)
|
||||||
|
oldPoolCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
|
if easterIslandBenchTestTimes == 0 {
|
||||||
|
defaultVal := int64(setting.GetLowerLimit())
|
||||||
|
if oldPoolCoin != defaultVal {
|
||||||
|
base.CoinPoolMgr.PushCoin(s.GetGameFreeId(), s.GroupId, s.Platform, defaultVal-oldPoolCoin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
easterIslandBenchTestTimes++
|
||||||
|
|
||||||
|
fileName := fmt.Sprintf("easterisland-%v-%d.csv", p.SnId, easterIslandBenchTestTimes)
|
||||||
|
file, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, os.ModePerm)
|
||||||
|
defer file.Close()
|
||||||
|
if err != nil {
|
||||||
|
file, err = os.Create(fileName)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file.WriteString("玩家id,当前水位,之前余额,之后余额,投入,产出,税收,小游戏,中线倍数,中线数,剩余免费次数\r\n")
|
||||||
|
oldCoin := p.Coin
|
||||||
|
switch s.DbGameFree.GetSceneType() {
|
||||||
|
case 1:
|
||||||
|
p.Coin = 100000
|
||||||
|
case 2:
|
||||||
|
p.Coin = 500000
|
||||||
|
case 3:
|
||||||
|
p.Coin = 1000000
|
||||||
|
case 4:
|
||||||
|
p.Coin = 10000000
|
||||||
|
default:
|
||||||
|
p.Coin = 100000
|
||||||
|
}
|
||||||
|
var targetCoin = p.Coin + p.Coin/10
|
||||||
|
if playerEx, ok := p.ExtraData.(*EasterIslandPlayerData); ok {
|
||||||
|
for i := 0; p.Coin < targetCoin; i++ {
|
||||||
|
startCoin := p.Coin
|
||||||
|
freeTimes := playerEx.freeTimes
|
||||||
|
poolCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
|
playerEx.UnmarkFlag(base.PlayerState_GameBreak)
|
||||||
|
suc := this.OnPlayerOp(s, p, EasterIslandPlayerOpStart, append([]int64{int64(playerEx.score)}, rule.AllBetLines...))
|
||||||
|
inCoin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||||
|
outCoin := playerEx.RollGameType.BaseResult.ChangeCoin + inCoin
|
||||||
|
taxCoin := playerEx.RollGameType.BaseResult.Tax
|
||||||
|
|
||||||
|
str := fmt.Sprintf("%v,%v,%v,%v,%v,%v,%v,%v,%v,%v,%v\r\n", p.SnId, poolCoin, startCoin, p.Coin, inCoin, outCoin, taxCoin,
|
||||||
|
playerEx.RollGameType.BaseResult.WinSmallGame, playerEx.RollGameType.BaseResult.WinRate, playerEx.RollGameType.BaseResult.AllWinNum, freeTimes)
|
||||||
|
file.WriteString(str)
|
||||||
|
if !suc {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
this.OnPlayerOp(s, p, EasterIslandBonusGame, []int64{playerEx.spinID})
|
||||||
|
}
|
||||||
|
if i > BENCH_CNT {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.Coin = oldCoin
|
||||||
|
}
|
||||||
|
|
||||||
|
func EasterIslandCheckAndSaveLog(sceneEx *EasterIslandSceneData, playerEx *EasterIslandPlayerData) {
|
||||||
|
//统计金币变动
|
||||||
|
//log1
|
||||||
|
logger.Logger.Trace("EasterIslandCheckAndSaveLog Save ", playerEx.SnId)
|
||||||
|
//changeCoin := playerEx.Coin - playerEx.StartCoin
|
||||||
|
changeCoin := playerEx.winCoin - playerEx.taxCoin - playerEx.CurrentBet
|
||||||
|
startCoin := playerEx.Coin - changeCoin
|
||||||
|
playerEx.SaveSceneCoinLog(startCoin, changeCoin,
|
||||||
|
playerEx.Coin, playerEx.CurrentBet, playerEx.taxCoin, playerEx.winCoin, playerEx.jackpotWinCoin, playerEx.smallGameWinCoin)
|
||||||
|
|
||||||
|
//log2
|
||||||
|
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
|
||||||
|
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore()
|
||||||
|
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
|
||||||
|
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
|
||||||
|
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
|
||||||
|
playerEx.RollGameType.BaseResult.IsFirst = sceneEx.IsPlayerFirst(playerEx.Player)
|
||||||
|
playerEx.RollGameType.BaseResult.PlayerSnid = playerEx.SnId
|
||||||
|
playerEx.RollGameType.BaseResult.TotalBet = int32(playerEx.CurrentBet)
|
||||||
|
playerEx.RollGameType.AllLine = int32(len(playerEx.betLines))
|
||||||
|
playerEx.RollGameType.BaseResult.FreeTimes = playerEx.freeTimes
|
||||||
|
playerEx.RollGameType.UserName = playerEx.Name
|
||||||
|
playerEx.RollGameType.BetLines = playerEx.betLines
|
||||||
|
playerEx.RollGameType.BaseResult.Tax = playerEx.taxCoin
|
||||||
|
playerEx.RollGameType.BaseResult.WBLevel = sceneEx.players[playerEx.SnId].WBLevel
|
||||||
|
if playerEx.score > 0 {
|
||||||
|
if !playerEx.IsRob {
|
||||||
|
info, err := model.MarshalGameNoteByROLL(playerEx.RollGameType)
|
||||||
|
if err == nil {
|
||||||
|
logid, _ := model.AutoIncGameLogId()
|
||||||
|
playerEx.currentLogId = logid
|
||||||
|
sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{})
|
||||||
|
totalin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||||
|
totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin
|
||||||
|
validFlow := totalin + totalout
|
||||||
|
validBet := common.AbsI64(totalin - totalout)
|
||||||
|
logParam := &base.SaveGamePlayerListLogParam{
|
||||||
|
Platform: playerEx.Platform,
|
||||||
|
Channel: playerEx.Channel,
|
||||||
|
Promoter: playerEx.BeUnderAgentCode,
|
||||||
|
PackageTag: playerEx.PackageID,
|
||||||
|
InviterId: playerEx.InviterId,
|
||||||
|
LogId: logid,
|
||||||
|
TotalIn: totalin,
|
||||||
|
TotalOut: totalout,
|
||||||
|
TaxCoin: playerEx.taxCoin,
|
||||||
|
BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet),
|
||||||
|
WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin,
|
||||||
|
ValidBet: validBet,
|
||||||
|
ValidFlow: validFlow,
|
||||||
|
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
|
||||||
|
IsFree: playerEx.RollGameType.BaseResult.IsFree,
|
||||||
|
WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame,
|
||||||
|
WinTotal: playerEx.RollGameType.BaseResult.WinTotal,
|
||||||
|
}
|
||||||
|
sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//统计输下注金币数
|
||||||
|
if !sceneEx.Testing && !playerEx.IsRob {
|
||||||
|
playerBet := &server.PlayerData{
|
||||||
|
SnId: proto.Int32(playerEx.SnId),
|
||||||
|
Bet: proto.Int64(playerEx.CurrentBet),
|
||||||
|
Gain: proto.Int64(playerEx.RollGameType.BaseResult.ChangeCoin),
|
||||||
|
Tax: proto.Int64(playerEx.taxCoin),
|
||||||
|
Coin: proto.Int64(playerEx.GetCoin()),
|
||||||
|
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||||
|
}
|
||||||
|
gwPlayerBet := &server.GWPlayerData{
|
||||||
|
SceneId: proto.Int(sceneEx.SceneId),
|
||||||
|
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||||
|
}
|
||||||
|
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||||
|
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||||
|
HasRobotGaming: false,
|
||||||
|
Data: gwPlayerBet,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
playerEx.taxCoin = 0
|
||||||
|
playerEx.winCoin = 0
|
||||||
|
playerEx.linesWinCoin = 0
|
||||||
|
playerEx.jackpotWinCoin = 0
|
||||||
|
playerEx.smallGameWinCoin = 0
|
||||||
|
|
||||||
|
if sceneEx.CheckNeedDestroy() && playerEx.freeTimes <= 0 {
|
||||||
|
sceneEx.PlayerLeave(playerEx.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
ScenePolicyEasterIslandSington.RegisteSceneState(&SceneStateEasterIslandStart{})
|
||||||
|
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
|
||||||
|
base.RegisteScenePolicy(common.GameId_EasterIsland, 0, ScenePolicyEasterIslandSington)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -353,7 +353,7 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
|
||||||
itemNum := item[1]
|
itemNum := item[1]
|
||||||
//获取背包道具数量
|
//获取背包道具数量
|
||||||
num, ok := player.Items[item[0]]
|
num, ok := player.Items[item[0]]
|
||||||
if !ok || num < item[1] {
|
if !ok || num < int64(item[1]) {
|
||||||
fishlogger.Errorf("道具数量不在 itemId = %v,itemNum = %v,背包数量 = %v", item[0], item[1], num)
|
fishlogger.Errorf("道具数量不在 itemId = %v,itemNum = %v,背包数量 = %v", item[0], item[1], num)
|
||||||
//判断其他消耗其他物品
|
//判断其他消耗其他物品
|
||||||
otherItem := skillTemp.OtherConsumer
|
otherItem := skillTemp.OtherConsumer
|
||||||
|
|
@ -378,18 +378,18 @@ func (this *CSFishSkillUseReqHandler) Process(s *netlib.Session, packetid int, d
|
||||||
}
|
}
|
||||||
player.Diamond -= int64(otherItemNum)
|
player.Diamond -= int64(otherItemNum)
|
||||||
} else {
|
} else {
|
||||||
if player.Items[otherItemId] < otherItemNum {
|
if player.Items[otherItemId] < int64(otherItemNum) {
|
||||||
fishlogger.Tracef("转换物品是其他物品时,物品数量不足!")
|
fishlogger.Tracef("转换物品是其他物品时,物品数量不足!")
|
||||||
pack.Result = 1
|
pack.Result = 1
|
||||||
pack.Status = fishing_proto.SCFishSkillUseResp_TOOL_LIMIT
|
pack.Status = fishing_proto.SCFishSkillUseResp_TOOL_LIMIT
|
||||||
player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack)
|
player.SendToClient(int(fishing_proto.FIPacketID_FISHING_SC_SKILLUSERESP), pack)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
player.Items[otherItemId] = player.Items[otherItemId] - otherItemNum
|
player.Items[otherItemId] = player.Items[otherItemId] - int64(otherItemNum)
|
||||||
}
|
}
|
||||||
fishlogger.Tracef("玩家使用技能当前道具不足 转化物品消耗 skillid = %v,snid = %v,otherItemId = %v,otherItemNum = %v", skillId, player.SnId, otherItemId, otherItemNum)
|
fishlogger.Tracef("玩家使用技能当前道具不足 转化物品消耗 skillid = %v,snid = %v,otherItemId = %v,otherItemNum = %v", skillId, player.SnId, otherItemId, otherItemNum)
|
||||||
} else {
|
} else {
|
||||||
player.Items[itemId] = player.Items[itemId] - itemNum
|
player.Items[itemId] = player.Items[itemId] - int64(itemNum)
|
||||||
//记录道具消耗日志
|
//记录道具消耗日志
|
||||||
fishlogger.Tracef("玩家使用技能,消耗道具!snod = %v, skill = %v,itemId =%v,itemNum = %v", player.SnId, skillId, itemId, itemNum)
|
fishlogger.Tracef("玩家使用技能,消耗道具!snod = %v, skill = %v,itemId =%v,itemNum = %v", player.SnId, skillId, itemId, itemNum)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/gamerule/fruits"
|
"mongo.games.com/game/gamerule/fruits"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
|
@ -14,7 +16,6 @@ import (
|
||||||
"mongo.games.com/game/protocol/server"
|
"mongo.games.com/game/protocol/server"
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type FruitsSceneData struct {
|
type FruitsSceneData struct {
|
||||||
|
|
@ -92,7 +93,7 @@ func (s *FruitsSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
//小玛丽
|
//小玛丽
|
||||||
playerEx.winCoin = playerEx.winOutMaryCoin + playerEx.winMidMaryCoin + playerEx.winFreeCoin
|
playerEx.winCoin = playerEx.winOutMaryCoin + playerEx.winMidMaryCoin + playerEx.winFreeCoin
|
||||||
if playerEx.winCoin != 0 {
|
if playerEx.winCoin != 0 {
|
||||||
//SysProfitCoinMgr.PushBetAndSysOut(s.sysProfitCoinKey, 0, playerEx.winCoin)
|
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, playerEx.winCoin)
|
||||||
p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false)
|
p.Statics(s.KeyGameId, s.KeyGamefreeId, playerEx.winCoin, false)
|
||||||
//tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
//tax := int64(math.Ceil(float64(playerEx.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
||||||
//playerEx.taxCoin = tax
|
//playerEx.taxCoin = tax
|
||||||
|
|
@ -137,7 +138,7 @@ func (s *FruitsSceneData) Win(p *FruitsPlayerData) {
|
||||||
}
|
}
|
||||||
if isBilled && p.winCoin != 0 {
|
if isBilled && p.winCoin != 0 {
|
||||||
p.noWinTimes = 0
|
p.noWinTimes = 0
|
||||||
//SysProfitCoinMgr.PushBetAndSysOut(s.sysProfitCoinKey, 0, p.winCoin)
|
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
|
||||||
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
|
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
|
||||||
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
||||||
//p.taxCoin = tax
|
//p.taxCoin = tax
|
||||||
|
|
@ -364,23 +365,19 @@ func (s *FruitsSceneData) SendPlayerBet(p *FruitsPlayerData) {
|
||||||
if p.gameState != fruits.Normal {
|
if p.gameState != fruits.Normal {
|
||||||
betCoin = 0
|
betCoin = 0
|
||||||
}
|
}
|
||||||
|
playerBet := &server.PlayerData{
|
||||||
|
SnId: proto.Int32(p.SnId),
|
||||||
|
Bet: proto.Int64(betCoin),
|
||||||
|
Gain: proto.Int64(p.Coin - p.startCoin),
|
||||||
|
Tax: proto.Int64(p.taxCoin),
|
||||||
|
}
|
||||||
|
gwPlayerBet := &server.GWPlayerData{
|
||||||
|
GameFreeId: proto.Int32(s.DbGameFree.GetId()),
|
||||||
|
}
|
||||||
|
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||||
s.SyncPlayerDatas(&base.PlayerDataParam{
|
s.SyncPlayerDatas(&base.PlayerDataParam{
|
||||||
HasRobotGaming: false,
|
HasRobotGaming: false,
|
||||||
Data: &server.GWPlayerData{
|
Data: gwPlayerBet,
|
||||||
Datas: []*server.PlayerData{
|
|
||||||
{
|
|
||||||
SnId: p.SnId,
|
|
||||||
Bet: betCoin,
|
|
||||||
Gain: p.Coin - p.startCoin,
|
|
||||||
Tax: p.taxCoin,
|
|
||||||
Coin: p.Coin,
|
|
||||||
GameCoinTs: p.GameCoinTs,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
GameFreeId: s.GetGameFreeId(),
|
|
||||||
SceneId: int32(s.SceneId),
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +440,7 @@ func (s *FruitsSceneData) Regulation(p *FruitsPlayerData, n int) {
|
||||||
// }
|
// }
|
||||||
// if regY == -1 {
|
// if regY == -1 {
|
||||||
// if setting != nil {
|
// if setting != nil {
|
||||||
// poolValue := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
// poolValue := base.CoinPoolMgr.LoadCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
// w := float64(s.slotRateWeight[0]) * (1 - float64(int32(poolValue)-setting.GetLowerLimit())/float64(setting.GetUpperLimit()-setting.GetLowerLimit()+1))
|
// w := float64(s.slotRateWeight[0]) * (1 - float64(int32(poolValue)-setting.GetLowerLimit())/float64(setting.GetUpperLimit()-setting.GetLowerLimit()+1))
|
||||||
// if w < 0 {
|
// if w < 0 {
|
||||||
// regY = 0
|
// regY = 0
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ func (this *SceneBaseStateFruits) OnTick(s *base.Scene) {
|
||||||
// now := time.Now()
|
// now := time.Now()
|
||||||
// sceneEx.mqLogTime = now.Add(-time.Second * time.Duration(now.Second()))
|
// sceneEx.mqLogTime = now.Add(-time.Second * time.Duration(now.Second()))
|
||||||
//
|
//
|
||||||
// waterVal := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
// waterVal := base.CoinPoolMgr.LoadCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
// waterVal = int64(math.Floor(float64(waterVal) / float64(fruits.NowByte)))
|
// waterVal = int64(math.Floor(float64(waterVal) / float64(fruits.NowByte)))
|
||||||
//
|
//
|
||||||
// jkVal1 := int64(math.Floor(float64(sceneEx.jackpot.GetTotalSmall()) / float64(fruits.NowByte)))
|
// jkVal1 := int64(math.Floor(float64(sceneEx.jackpot.GetTotalSmall()) / float64(fruits.NowByte)))
|
||||||
|
|
@ -444,7 +444,7 @@ func (this *SceneStateStartFruits) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
||||||
}
|
}
|
||||||
playerEx.CurrentBet = playerEx.betCoin
|
playerEx.CurrentBet = playerEx.betCoin
|
||||||
playerEx.CurrentTax = 0
|
playerEx.CurrentTax = 0
|
||||||
//SysProfitCoinMgr.PushBetAndSysOut(sceneEx.sysProfitCoinKey, playerEx.betCoin, -playerEx.betCoin)
|
//SysProfitCoinMgr.Add(sceneEx.sysProfitCoinKey, playerEx.betCoin, -playerEx.betCoin)
|
||||||
//没有免费次数 扣钱
|
//没有免费次数 扣钱
|
||||||
p.Statics(s.KeyGameId, s.KeyGamefreeId, -playerEx.betCoin, false)
|
p.Statics(s.KeyGameId, s.KeyGamefreeId, -playerEx.betCoin, false)
|
||||||
playerEx.AddCoin(-playerEx.betCoin, common.GainWay_HundredSceneLost, 0, "system", s.GetSceneName())
|
playerEx.AddCoin(-playerEx.betCoin, common.GainWay_HundredSceneLost, 0, "system", s.GetSceneName())
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
package iceage
|
package iceage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/protocol/iceage"
|
"mongo.games.com/game/protocol/iceage"
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/netlib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 冰河世纪的操作
|
// 冰河世纪的操作
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,9 @@ package iceage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"mongo.games.com/game/model"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 玩家游戏数据索引
|
// 玩家游戏数据索引
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,14 @@ package iceage
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
rule "mongo.games.com/game/gamerule/iceage"
|
rule "mongo.games.com/game/gamerule/iceage"
|
||||||
base "mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/protocol/iceage"
|
"mongo.games.com/game/protocol/iceage"
|
||||||
"mongo.games.com/goserver/core/timer"
|
|
||||||
"strconv"
|
|
||||||
//"mongo.games.com/game/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type IceAgePlayerData struct {
|
type IceAgePlayerData struct {
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,21 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/iceage"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
"mongo.games.com/game/protocol/gamehall"
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
"mongo.games.com/game/protocol/iceage"
|
"mongo.games.com/game/protocol/iceage"
|
||||||
"mongo.games.com/game/protocol/server"
|
"mongo.games.com/game/protocol/server"
|
||||||
"mongo.games.com/goserver/core/basic"
|
|
||||||
"mongo.games.com/goserver/core/task"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
rule "mongo.games.com/game/gamerule/iceage"
|
|
||||||
"mongo.games.com/game/gamesrv/base"
|
|
||||||
"mongo.games.com/game/proto"
|
|
||||||
"mongo.games.com/game/srvdata"
|
"mongo.games.com/game/srvdata"
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type IceAgeJackpot struct {
|
type IceAgeJackpot struct {
|
||||||
|
|
@ -323,14 +324,7 @@ func (this *IceAgeSceneData) AIAddJackPot() {
|
||||||
randT = rand.Intn(3) + 1
|
randT = rand.Intn(3) + 1
|
||||||
}
|
}
|
||||||
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
|
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
//AI机器人
|
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
|
||||||
setting := base.CoinPoolMgr.GetCoinPoolSetting(this.Platform, this.GetGameFreeId(), this.GroupId)
|
|
||||||
var ctroRate int32
|
|
||||||
if setting != nil {
|
|
||||||
ctroRate = 9800
|
|
||||||
}
|
|
||||||
var val int64
|
|
||||||
val = int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(ctroRate) / 10000))
|
|
||||||
this.jackpot.VirtualJK += val
|
this.jackpot.VirtualJK += val
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,17 @@ package iceage
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core"
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
rule "mongo.games.com/game/gamerule/iceage"
|
rule "mongo.games.com/game/gamerule/iceage"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
|
@ -10,15 +21,6 @@ import (
|
||||||
"mongo.games.com/game/proto"
|
"mongo.games.com/game/proto"
|
||||||
"mongo.games.com/game/protocol/iceage"
|
"mongo.games.com/game/protocol/iceage"
|
||||||
"mongo.games.com/game/protocol/server"
|
"mongo.games.com/game/protocol/server"
|
||||||
"mongo.games.com/goserver/core"
|
|
||||||
"mongo.games.com/goserver/core/basic"
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"mongo.games.com/goserver/core/task"
|
|
||||||
"mongo.games.com/goserver/core/timer"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"sync"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -395,7 +397,7 @@ func (this *SceneStateIceAgeStart) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
||||||
//水池设置
|
//水池设置
|
||||||
coinPoolSetting := base.GetCoinPoolMgr().GetCoinPoolSetting(sceneEx.GetPlatform(), sceneEx.GetGameFreeId(), sceneEx.GetGroupId())
|
coinPoolSetting := base.GetCoinPoolMgr().GetCoinPoolSetting(sceneEx.GetPlatform(), sceneEx.GetGameFreeId(), sceneEx.GetGroupId())
|
||||||
//baseRate := coinPoolSetting.GetBaseRate() //基础赔率
|
//baseRate := coinPoolSetting.GetBaseRate() //基础赔率
|
||||||
ctroRate := 9800 //调节赔率 暗税系数
|
ctroRate := 500 //调节赔率 暗税系数
|
||||||
//if baseRate >= 10000 || baseRate <= 0 || ctroRate < 0 || ctroRate >= 1000 || baseRate+ctroRate > 9900 {
|
//if baseRate >= 10000 || baseRate <= 0 || ctroRate < 0 || ctroRate >= 1000 || baseRate+ctroRate > 9900 {
|
||||||
// logger.Logger.Warnf("IceAgeErrorBaseRate [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, baseRate, ctroRate)
|
// logger.Logger.Warnf("IceAgeErrorBaseRate [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, baseRate, ctroRate)
|
||||||
// baseRate = 9700
|
// baseRate = 9700
|
||||||
|
|
@ -406,13 +408,13 @@ func (this *SceneStateIceAgeStart) OnPlayerOp(s *base.Scene, p *base.Player, opc
|
||||||
logger.Logger.Tracef("IceAgeRates [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate, ctroRate)
|
logger.Logger.Tracef("IceAgeRates [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate, ctroRate)
|
||||||
|
|
||||||
playerEx.IsFNovice(sceneEx.KeyGameId)
|
playerEx.IsFNovice(sceneEx.KeyGameId)
|
||||||
isFoolPlayer := playerEx.IsFoolPlayer[sceneEx.KeyGameId]
|
isFoolPlayer := false
|
||||||
var gamePoolCoin int64
|
var gamePoolCoin int64
|
||||||
if isFoolPlayer {
|
//if isFoolPlayer {
|
||||||
gamePoolCoin = base.CoinPoolMgr.GetNoviceCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
// gamePoolCoin = base.CoinPoolMgr.GetNoviceCoinPool(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||||
} else {
|
//} else {
|
||||||
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||||
}
|
//}
|
||||||
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||||
|
|
||||||
var jackpotParam = sceneEx.GetDBGameFree().GetJackpot() // 奖池参数
|
var jackpotParam = sceneEx.GetDBGameFree().GetJackpot() // 奖池参数
|
||||||
|
|
@ -979,9 +981,10 @@ func IceAgeCheckAndSaveLog(sceneEx *IceAgeSceneData, playerEx *IceAgePlayerData)
|
||||||
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
GameFreeId: proto.Int32(sceneEx.GetDBGameFree().GetId()),
|
||||||
}
|
}
|
||||||
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||||
proto.SetDefaults(gwPlayerBet)
|
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||||
sceneEx.SendToWorld(int(server.SSPacketID_PACKET_GW_PLAYERDATA), gwPlayerBet)
|
HasRobotGaming: false,
|
||||||
logger.Logger.Trace("Send msg gwPlayerBet ===>", gwPlayerBet)
|
Data: gwPlayerBet,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
playerEx.taxCoin = 0
|
playerEx.taxCoin = 0
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,14 @@ import (
|
||||||
_ "mongo.games.com/game/gamesrv/thirteen"
|
_ "mongo.games.com/game/gamesrv/thirteen"
|
||||||
_ "mongo.games.com/game/gamesrv/tienlen"
|
_ "mongo.games.com/game/gamesrv/tienlen"
|
||||||
|
|
||||||
|
// 拉霸
|
||||||
|
_ "mongo.games.com/game/gamesrv/avengers"
|
||||||
|
_ "mongo.games.com/game/gamesrv/caishen"
|
||||||
|
_ "mongo.games.com/game/gamesrv/easterisland"
|
||||||
_ "mongo.games.com/game/gamesrv/fruits"
|
_ "mongo.games.com/game/gamesrv/fruits"
|
||||||
_ "mongo.games.com/game/gamesrv/iceage"
|
_ "mongo.games.com/game/gamesrv/iceage"
|
||||||
|
_ "mongo.games.com/game/gamesrv/richblessed"
|
||||||
|
_ "mongo.games.com/game/gamesrv/tamquoc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package richblessed
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/protocol/richblessed"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CSRichBlessedOpPacketFactory struct {
|
||||||
|
}
|
||||||
|
type CSRichBlessedOpHandler struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CSRichBlessedOpPacketFactory) CreatePacket() interface{} {
|
||||||
|
pack := &richblessed.CSRichBlessedOp{}
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CSRichBlessedOpHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
if op, ok := data.(*richblessed.CSRichBlessedOp); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
logger.Logger.Warn("CSRichBlessedOpHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scene := p.GetScene()
|
||||||
|
if scene == nil {
|
||||||
|
logger.Logger.Warn("CSRichBlessedOpHandler p.scene == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !scene.HasPlayer(p) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if scene.GetScenePolicy() != nil {
|
||||||
|
scene.GetScenePolicy().OnPlayerOp(scene, p, int(op.GetOpCode()), op.GetParams())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func init() {
|
||||||
|
//多财多福
|
||||||
|
common.RegisterHandler(int(richblessed.RBPID_PACKET_RICHBLESSED_CSRichBlessedOp), &CSRichBlessedOpHandler{})
|
||||||
|
netlib.RegisterFactory(int(richblessed.RBPID_PACKET_RICHBLESSED_CSRichBlessedOp), &CSRichBlessedOpPacketFactory{})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
package richblessed
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/game/gamerule/richblessed"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
ElementsParams = [][]int32{} // 十三个元素
|
||||||
|
FreeElementsParams = [][]int32{}
|
||||||
|
FreeLeElementsParams = []int32{0, 0, 60, 50, 50, 60, 50, 0, 0, 0, 0, 0, 0}
|
||||||
|
JACKPOTElementsParams = []int32{20, 30, 100, 150}
|
||||||
|
)
|
||||||
|
|
||||||
|
// RichBlessed
|
||||||
|
type RichBlessedPlayerData struct {
|
||||||
|
*base.Player
|
||||||
|
roomid int32 //房间ID
|
||||||
|
result *richblessed.WinResult
|
||||||
|
betIdx int //下注索引
|
||||||
|
betCoin int64 //下注金额
|
||||||
|
maxbetCoin int64 //下注金额
|
||||||
|
oneBetCoin int64 //单注
|
||||||
|
cpCtx model.CoinPoolCtx //水池环境
|
||||||
|
leaveTime int32 //离开时间
|
||||||
|
winCoin int64 //本局输赢
|
||||||
|
startCoin int64 //本局开始金币
|
||||||
|
freewinCoin int64 //免费游戏总输赢
|
||||||
|
JackwinCoin int64 //Jack奖励
|
||||||
|
freeTimes int32 //免费游戏
|
||||||
|
addfreeTimes int32 //新增免费游戏
|
||||||
|
gameState int //当前游戏模式
|
||||||
|
taxCoin int64 //税收
|
||||||
|
noWinTimes int //没有中奖次数
|
||||||
|
isFWinJackpot bool //是否中奖
|
||||||
|
JackMidCards []int64 //掀开位置
|
||||||
|
///当局数值
|
||||||
|
nowFreeTimes int //当前第几轮免费游戏
|
||||||
|
winLineRate int64 //线倍率
|
||||||
|
JackPotRate int64 //获取奖池的百分比 5% 10% 15%
|
||||||
|
freeWinTotalRate int64 //免费游戏赢的倍率
|
||||||
|
// winNowJackPotCoin int64 //当局奖池爆奖
|
||||||
|
winNowAllRate int64 //当局赢得倍率
|
||||||
|
//测试
|
||||||
|
isFTest int
|
||||||
|
isTestIdx int
|
||||||
|
isJk bool
|
||||||
|
//
|
||||||
|
weightPos int32 //当局权重
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *RichBlessedPlayerData) init() {
|
||||||
|
p.roomid = 0
|
||||||
|
p.result = new(richblessed.WinResult)
|
||||||
|
}
|
||||||
|
func (p *RichBlessedPlayerData) Clear() {
|
||||||
|
p.gameState = richblessed.Normal
|
||||||
|
p.startCoin = p.Coin
|
||||||
|
p.winCoin = 0
|
||||||
|
p.taxCoin = 0
|
||||||
|
p.isFWinJackpot = false
|
||||||
|
p.addfreeTimes = 0
|
||||||
|
p.result.AllRate = 0
|
||||||
|
p.JackMidCards = p.JackMidCards[:0]
|
||||||
|
p.result.FreeNum = 0
|
||||||
|
p.result.JackpotEle = -1
|
||||||
|
p.result.JackpotRate = 0
|
||||||
|
if p.freeTimes == 0 {
|
||||||
|
p.freewinCoin = 0
|
||||||
|
p.nowFreeTimes = 0
|
||||||
|
}
|
||||||
|
p.isJk = false
|
||||||
|
p.weightPos = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正常游戏 免费游戏
|
||||||
|
func (p *RichBlessedPlayerData) TestCode(eleLineAppearRate [][]int32) {
|
||||||
|
if p.isFTest%5 == 0 && p.gameState == richblessed.Normal {
|
||||||
|
switch p.isTestIdx {
|
||||||
|
case 0:
|
||||||
|
//免费
|
||||||
|
p.result.EleValue = []int32{
|
||||||
|
1, 1, 1, 1, 1,
|
||||||
|
6, 2, 7, 7, 9,
|
||||||
|
9, 7, 4, 8, 7,
|
||||||
|
}
|
||||||
|
p.isTestIdx = 1
|
||||||
|
case 1:
|
||||||
|
//奖池
|
||||||
|
p.result.EleValue = []int32{
|
||||||
|
5, 0, 0, 0, 1,
|
||||||
|
6, 2, 7, 7, 9,
|
||||||
|
9, 1, 4, 8, 7,
|
||||||
|
}
|
||||||
|
p.isTestIdx = 0
|
||||||
|
p.isJk = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p.result.CreateLine(eleLineAppearRate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *RichBlessedPlayerData) CreateLevResult(eleLineAppearRate [][]int32) {
|
||||||
|
p.result.CreateLevLine(eleLineAppearRate)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 正常游戏 免费游戏
|
||||||
|
func (p *RichBlessedPlayerData) CreateJACKPOT(eleRate []int32) {
|
||||||
|
p.result.CreateJACKPOT(eleRate)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,457 @@
|
||||||
|
package richblessed
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamerule/richblessed"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
protocol "mongo.games.com/game/protocol/richblessed"
|
||||||
|
"mongo.games.com/game/protocol/server"
|
||||||
|
"mongo.games.com/game/srvdata"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RichBlessedSceneData struct {
|
||||||
|
*base.Scene //场景
|
||||||
|
players map[int32]*RichBlessedPlayerData //玩家信息
|
||||||
|
jackpot *base.SlotJackpotPool //奖池
|
||||||
|
levelRate [][]int32 //调控概率区间
|
||||||
|
slotRateWeight []int32 //调控权重
|
||||||
|
sysProfitCoinKey string
|
||||||
|
mqLogTime time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewRichBlessedSceneData(s *base.Scene) *RichBlessedSceneData {
|
||||||
|
sceneEx := &RichBlessedSceneData{
|
||||||
|
Scene: s,
|
||||||
|
players: make(map[int32]*RichBlessedPlayerData),
|
||||||
|
}
|
||||||
|
sceneEx.Init()
|
||||||
|
return sceneEx
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) Init() {
|
||||||
|
s.LoadJackPotData()
|
||||||
|
//for _, data := range srvdata.PBDB_SlotRateMgr.Datas.Arr {
|
||||||
|
// if int(data.GetGameId()) == common.GameId_Fruits {
|
||||||
|
// s.levelRate = append(s.levelRate, data.RateSection)
|
||||||
|
// s.slotRateWeight = append(s.slotRateWeight, data.GetWeight())
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
s.sysProfitCoinKey = fmt.Sprintf("%v_%v", s.Platform, s.GetGameFreeId())
|
||||||
|
s.mqLogTime = time.Now()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RichBlessedSceneData) Clear() {
|
||||||
|
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) SceneDestroy(force bool) {
|
||||||
|
//销毁房间
|
||||||
|
s.Scene.Destroy(force)
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) AddPrizeCoin(playerEx *RichBlessedPlayerData) {
|
||||||
|
val := playerEx.betCoin
|
||||||
|
tax := int64(math.Ceil(float64(val) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
||||||
|
//playerEx.taxCoin = tax
|
||||||
|
//playerEx.AddServiceFee(tax)
|
||||||
|
val -= tax
|
||||||
|
|
||||||
|
addPrizeCoin := val * richblessed.NowByte * int64(s.DbGameFree.GetJackpotRatio()) //扩大10000倍
|
||||||
|
jk1 := int64(math.Floor(float64(addPrizeCoin) / 1000 / 4)) //千分之奖池比例 分四份
|
||||||
|
s.jackpot.AddToGrand(playerEx.IsRob, jk1)
|
||||||
|
s.jackpot.AddToBig(playerEx.IsRob, jk1)
|
||||||
|
s.jackpot.AddToMiddle(playerEx.IsRob, jk1)
|
||||||
|
s.jackpot.AddToSmall(playerEx.IsRob, jk1)
|
||||||
|
logger.Logger.Tracef("[Rich] 奖池增加...AddPrizeCoin... %f", float64(jk1*4)/float64(richblessed.NowByte))
|
||||||
|
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
|
||||||
|
if !s.Testing {
|
||||||
|
base.CoinPoolMgr.PushCoin(s.GetGameFreeId(), s.GroupId, s.Platform, val*richblessed.NowByte-jk1*4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) DelPrizeCoin(isRob bool, win int64, jackpotEle int32) {
|
||||||
|
if win > 0 {
|
||||||
|
switch jackpotEle {
|
||||||
|
case richblessed.GoldBoy:
|
||||||
|
s.jackpot.AddToGrand(isRob, -win*richblessed.NowByte)
|
||||||
|
case richblessed.GoldGirl:
|
||||||
|
s.jackpot.AddToBig(isRob, -win*richblessed.NowByte)
|
||||||
|
case richblessed.BlueBoy:
|
||||||
|
s.jackpot.AddToMiddle(isRob, -win*richblessed.NowByte)
|
||||||
|
default:
|
||||||
|
s.jackpot.AddToSmall(isRob, -win*richblessed.NowByte)
|
||||||
|
}
|
||||||
|
logger.Logger.Tracef("[Rich] 奖池减少...DelPrizeCoin... %d", win)
|
||||||
|
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) delPlayer(SnId int32) {
|
||||||
|
if _, exist := s.players[SnId]; exist {
|
||||||
|
delete(s.players, SnId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
|
if playerEx, ok := p.ExtraData.(*RichBlessedPlayerData); ok {
|
||||||
|
if playerEx.freeTimes > 0 || playerEx.isFWinJackpot {
|
||||||
|
if playerEx.isFWinJackpot { // 小游戏
|
||||||
|
s.JACKPOTWin(playerEx)
|
||||||
|
|
||||||
|
a1 := rand.Int63n(3)
|
||||||
|
a2 := rand.Int63n(3) + 3
|
||||||
|
a3 := rand.Int63n(2) + 6
|
||||||
|
playerEx.JackMidCards = append(playerEx.JackMidCards, a1, a2, a3)
|
||||||
|
|
||||||
|
//发送结算
|
||||||
|
//s.SendJACKPOTBilled(playerEx)
|
||||||
|
|
||||||
|
s.SaveLog(playerEx, 1)
|
||||||
|
playerEx.Clear()
|
||||||
|
}
|
||||||
|
//freenum := playerEx.freeTimes
|
||||||
|
//for i := int32(0); i < freenum; i++ {
|
||||||
|
// playerEx.Clear()
|
||||||
|
// gameRand, _ := s.GetFreeWeight()
|
||||||
|
// playerEx.CreateLevResult(gameRand) // 没有铜锣概率
|
||||||
|
// s.Win(playerEx)
|
||||||
|
// s.SaveLog(playerEx, 1)
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
s.delPlayer(p.SnId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否中奖
|
||||||
|
func (s *RichBlessedSceneData) CanJACKPOT(p *RichBlessedPlayerData, bet int64, big int64, JACKRand []int32) bool {
|
||||||
|
ret := p.result.CanJACKPOT(bet, big)
|
||||||
|
logger.Logger.Tracef("RichBlessedSceneData CanJACKPOT %v %v", ret, p.result.EleValue)
|
||||||
|
if ret || p.isJk {
|
||||||
|
WinJackPot := int64(0)
|
||||||
|
ele := p.result.CreateJACKPOT(JACKRand)
|
||||||
|
if p.isJk {
|
||||||
|
ele = rand.Int31n(richblessed.JackMax)
|
||||||
|
p.result.JackpotEle = ele
|
||||||
|
}
|
||||||
|
switch ele {
|
||||||
|
case richblessed.GoldBoy:
|
||||||
|
WinJackPot = s.jackpot.GetTotalGrand()
|
||||||
|
case richblessed.GoldGirl:
|
||||||
|
WinJackPot = s.jackpot.GetTotalBig()
|
||||||
|
case richblessed.BlueBoy:
|
||||||
|
WinJackPot = s.jackpot.GetTotalMiddle()
|
||||||
|
case richblessed.BlueGirl:
|
||||||
|
WinJackPot = s.jackpot.GetTotalSmall()
|
||||||
|
}
|
||||||
|
if WinJackPot > 0 {
|
||||||
|
jkWin := int64(math.Floor(float64(WinJackPot) / float64(richblessed.NowByte)))
|
||||||
|
if jkWin > (richblessed.JkEleNumRate[int(ele)]*p.oneBetCoin) || p.isJk {
|
||||||
|
p.isFWinJackpot = true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//不能中奖
|
||||||
|
p.result.JackpotEle = -1
|
||||||
|
p.result.JackpotRate = 0
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) Win(p *RichBlessedPlayerData) {
|
||||||
|
p.result.Win(p.betCoin, p.maxbetCoin)
|
||||||
|
|
||||||
|
if p.result.FreeNum != 0 {
|
||||||
|
p.addfreeTimes = p.result.FreeNum
|
||||||
|
p.freeTimes += p.addfreeTimes
|
||||||
|
}
|
||||||
|
|
||||||
|
p.winLineRate = p.result.AllRate
|
||||||
|
p.winCoin += p.oneBetCoin * p.winLineRate
|
||||||
|
if p.gameState == richblessed.FreeGame {
|
||||||
|
p.freewinCoin += p.winCoin
|
||||||
|
}
|
||||||
|
if p.winCoin != 0 {
|
||||||
|
p.noWinTimes = 0
|
||||||
|
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.winCoin)
|
||||||
|
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.winCoin, false)
|
||||||
|
//tax := int64(math.Ceil(float64(p.winCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
||||||
|
//p.taxCoin = tax
|
||||||
|
//p.winCoin -= tax
|
||||||
|
//p.AddServiceFee(tax)
|
||||||
|
|
||||||
|
p.AddCoin(p.winCoin, common.GainWay_HundredSceneWin, 0, "system", s.GetSceneName())
|
||||||
|
if !s.Testing && p.winCoin != 0 {
|
||||||
|
base.CoinPoolMgr.PushCoin(s.GetGameFreeId(), s.GroupId, s.Platform, -(p.winCoin)*richblessed.NowByte)
|
||||||
|
}
|
||||||
|
//p.isReportGameEvent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RichBlessedSceneData) JACKPOTWin(p *RichBlessedPlayerData) {
|
||||||
|
p.result.JACKPOTWin()
|
||||||
|
p.JackwinCoin = p.result.JackpotRate * p.oneBetCoin
|
||||||
|
if p.JackwinCoin > 0 {
|
||||||
|
s.DelPrizeCoin(p.IsRob, p.JackwinCoin, p.result.JackpotEle)
|
||||||
|
p.noWinTimes = 0
|
||||||
|
//SysProfitCoinMgr.Add(s.sysProfitCoinKey, 0, p.JackwinCoin)
|
||||||
|
p.Statics(s.KeyGameId, s.KeyGamefreeId, p.JackwinCoin, false)
|
||||||
|
//tax := int64(math.Ceil(float64(p.JackwinCoin) * float64(s.DbGameFree.GetTaxRate()) / 10000))
|
||||||
|
//p.taxCoin = tax
|
||||||
|
//p.JackwinCoin -= tax
|
||||||
|
//p.AddServiceFee(tax)
|
||||||
|
|
||||||
|
p.AddCoin(p.JackwinCoin, common.GainWay_HundredSceneWin, 0, "system", s.GetSceneName())
|
||||||
|
if !s.Testing && p.JackwinCoin != 0 {
|
||||||
|
base.CoinPoolMgr.PushCoin(s.GetGameFreeId(), s.GroupId, s.Platform, -(p.JackwinCoin)*richblessed.NowByte)
|
||||||
|
}
|
||||||
|
// p.JackpotEle = -1
|
||||||
|
//p.isReportGameEvent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RichBlessedSceneData) SendBilled(p *RichBlessedPlayerData) {
|
||||||
|
//正常游戏 免费游戏
|
||||||
|
pack := &protocol.SCRBBilled{
|
||||||
|
NowGameState: proto.Int(p.gameState),
|
||||||
|
BetIdx: proto.Int(p.betIdx),
|
||||||
|
Coin: proto.Int64(p.Coin),
|
||||||
|
Cards: p.result.EleValue,
|
||||||
|
FreeAllWin: proto.Int64(p.freewinCoin), //
|
||||||
|
//SmallJackpot: proto.Int64(s.jackpot.GetTotalSmall() / 10000),
|
||||||
|
//MiddleJackpot: proto.Int64(s.jackpot.GetTotalMiddle() / 10000),
|
||||||
|
//BigJackpot: proto.Int64(s.jackpot.GetTotalBig() / 10000),
|
||||||
|
//GrandJackpot: proto.Int64(s.jackpot.GetTotalGrand() / 10000),
|
||||||
|
WinEleCoin: proto.Int64(p.winCoin),
|
||||||
|
WinRate: proto.Int64(p.winLineRate),
|
||||||
|
FreeNum: proto.Int64(int64(p.freeTimes)),
|
||||||
|
AddFreeNum: proto.Int64(int64(p.addfreeTimes)),
|
||||||
|
JackpotEle: proto.Int32(p.result.JackpotEle),
|
||||||
|
WinFreeTimes: proto.Int32(int32(p.nowFreeTimes)),
|
||||||
|
}
|
||||||
|
var wl []*protocol.RichWinLine
|
||||||
|
for _, r := range p.result.WinLine {
|
||||||
|
wl = append(wl, &protocol.RichWinLine{
|
||||||
|
Poss: r.Poss,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
pack.WinLines = wl
|
||||||
|
logger.Logger.Trace("SCRBBilled:", pack)
|
||||||
|
p.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRBBilled), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RichBlessedSceneData) SendJACKPOTBilled(p *RichBlessedPlayerData) {
|
||||||
|
|
||||||
|
pack := &protocol.SCRBBilled{
|
||||||
|
NowGameState: proto.Int(p.gameState),
|
||||||
|
BetIdx: proto.Int(p.betIdx),
|
||||||
|
Coin: proto.Int64(p.Coin),
|
||||||
|
//SmallJackpot: proto.Int64(s.jackpot.GetTotalSmall() / 10000),
|
||||||
|
//MiddleJackpot: proto.Int64(s.jackpot.GetTotalMiddle() / 10000),
|
||||||
|
//BigJackpot: proto.Int64(s.jackpot.GetTotalBig() / 10000),
|
||||||
|
//GrandJackpot: proto.Int64(s.jackpot.GetTotalGrand() / 10000),
|
||||||
|
WinJackpot: proto.Int64(p.JackwinCoin),
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("SendJACKPOTBilled:", pack)
|
||||||
|
p.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRBJACKBilled), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RichBlessedSceneData) LoadJackPotData() {
|
||||||
|
str := base.SlotsPoolMgr.GetPool(s.GetGameFreeId(), s.Platform)
|
||||||
|
if str != "" {
|
||||||
|
jackpot := &base.SlotJackpotPool{}
|
||||||
|
err := json.Unmarshal([]byte(str), jackpot)
|
||||||
|
if err == nil {
|
||||||
|
s.jackpot = jackpot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if s.jackpot != nil {
|
||||||
|
base.SlotsPoolMgr.SetPool(s.GetGameFreeId(), s.Platform, s.jackpot)
|
||||||
|
} else {
|
||||||
|
s.jackpot = &base.SlotJackpotPool{}
|
||||||
|
jp := s.DbGameFree.GetJackpot()
|
||||||
|
if len(jp) > 0 {
|
||||||
|
s.jackpot.Small += int64(jp[0] * 10000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) SaveLog(p *RichBlessedPlayerData, isOffline int) {
|
||||||
|
if s.Testing {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.SendPlayerBet(p)
|
||||||
|
|
||||||
|
var betCoin int64
|
||||||
|
var nowNRound int
|
||||||
|
var nowGetCoin int64
|
||||||
|
|
||||||
|
if p.gameState == richblessed.Normal {
|
||||||
|
betCoin = p.betCoin
|
||||||
|
nowGetCoin = p.winCoin
|
||||||
|
|
||||||
|
} else if p.gameState == richblessed.FreeGame {
|
||||||
|
nowNRound = p.nowFreeTimes
|
||||||
|
nowGetCoin = p.winCoin
|
||||||
|
|
||||||
|
} else {
|
||||||
|
nowGetCoin = p.JackwinCoin
|
||||||
|
|
||||||
|
}
|
||||||
|
RichBlessed := model.RichBlessedType{
|
||||||
|
RoomId: s.SceneId,
|
||||||
|
BasicScore: int32(p.oneBetCoin),
|
||||||
|
PlayerSnId: p.SnId,
|
||||||
|
BeforeCoin: p.startCoin,
|
||||||
|
AfterCoin: p.Coin,
|
||||||
|
ChangeCoin: p.Coin - p.startCoin,
|
||||||
|
TotalBetCoin: betCoin,
|
||||||
|
TotalLine: 9,
|
||||||
|
TotalWinCoin: nowGetCoin,
|
||||||
|
NowGameState: p.gameState,
|
||||||
|
NowNRound: nowNRound,
|
||||||
|
IsOffline: isOffline,
|
||||||
|
FirstFreeTimes: int(p.freeTimes),
|
||||||
|
TaxCoin: p.taxCoin,
|
||||||
|
WBLevel: p.WBLevel,
|
||||||
|
RealCtrl: s.RealCtrl,
|
||||||
|
WBState: p.WBState,
|
||||||
|
WeightKey: p.weightPos + 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
var winLine []model.RichBlessedWinLine
|
||||||
|
if p.gameState == richblessed.JackGame { // jack小游戏
|
||||||
|
RichBlessed.JackEleValue = p.result.JackpotEle
|
||||||
|
RichBlessed.JackMidCards = append(RichBlessed.JackMidCards, p.JackMidCards...)
|
||||||
|
}
|
||||||
|
|
||||||
|
RichBlessed.Cards = p.result.EleValue
|
||||||
|
RichBlessed.WinLineNum = len(p.result.WinLine)
|
||||||
|
RichBlessed.WinLineRate = p.winLineRate
|
||||||
|
RichBlessed.WinLineCoin = p.winLineRate * p.oneBetCoin
|
||||||
|
for _, line := range p.result.WinLine {
|
||||||
|
if len(line.Lines) > 0 {
|
||||||
|
flag := line.Lines[0]
|
||||||
|
fw := model.RichBlessedWinLine{
|
||||||
|
Id: line.LineId,
|
||||||
|
Num: len(line.Lines),
|
||||||
|
EleValue: flag,
|
||||||
|
Rate: line.Rate,
|
||||||
|
WinCoin: line.Rate * p.oneBetCoin,
|
||||||
|
}
|
||||||
|
winLine = append(winLine, fw)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RichBlessed.WinLine = winLine
|
||||||
|
info, err := model.MarshalGameNoteByROLL(&RichBlessed)
|
||||||
|
if err == nil {
|
||||||
|
logId, _ := model.AutoIncGameLogId()
|
||||||
|
s.SaveGameDetailedLog(logId, info, &base.GameDetailedParam{})
|
||||||
|
//水池上下文环境s
|
||||||
|
s.CpCtx = p.cpCtx
|
||||||
|
var totalIn, totalOut int64
|
||||||
|
if betCoin > 0 {
|
||||||
|
totalIn = betCoin
|
||||||
|
}
|
||||||
|
if nowGetCoin > 0 {
|
||||||
|
totalOut = p.Coin - p.startCoin + betCoin /*+ p.taxCoin*/
|
||||||
|
}
|
||||||
|
s.SaveGamePlayerListLog(p.SnId,
|
||||||
|
&base.SaveGamePlayerListLogParam{
|
||||||
|
Platform: p.Platform,
|
||||||
|
Channel: p.Channel,
|
||||||
|
Promoter: p.BeUnderAgentCode,
|
||||||
|
PackageTag: p.PackageID,
|
||||||
|
InviterId: p.InviterId,
|
||||||
|
LogId: logId,
|
||||||
|
TotalIn: totalIn,
|
||||||
|
TotalOut: totalOut,
|
||||||
|
TaxCoin: p.taxCoin,
|
||||||
|
ClubPumpCoin: 0,
|
||||||
|
BetAmount: totalIn,
|
||||||
|
WinAmountNoAnyTax: p.Coin - p.startCoin,
|
||||||
|
IsFirstGame: s.IsPlayerFirst(p.Player),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
s.GameNowTime = time.Now()
|
||||||
|
if s.CheckNeedDestroy() && p.freeTimes == 0 {
|
||||||
|
s.PlayerLeave(p.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) GetEleWeight(needpos int32) (norms, frees [][]int32, jk []int32, key int32) {
|
||||||
|
if needpos < 0 || needpos > 7 || !s.RealCtrl {
|
||||||
|
needpos = 0
|
||||||
|
}
|
||||||
|
if needpos == 0 {
|
||||||
|
curCoin := base.CoinPoolMgr.GetCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
|
curCoin = int64(math.Floor(float64(curCoin) / float64(richblessed.NowByte)))
|
||||||
|
|
||||||
|
for i := len(s.DbGameFree.BalanceLine) - 1; i >= 0; i-- {
|
||||||
|
balance := s.DbGameFree.BalanceLine[i]
|
||||||
|
if curCoin >= int64(balance) {
|
||||||
|
key = int32(i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
key = needpos - 1
|
||||||
|
}
|
||||||
|
for _, ele := range srvdata.PBDB_SlotRateWeightMgr.Datas.GetArr() {
|
||||||
|
if ele.GameFreeId == s.GetGameFreeId() && ele.Pos == key {
|
||||||
|
norms = append(norms, ele.NormCol1)
|
||||||
|
norms = append(norms, ele.NormCol2)
|
||||||
|
norms = append(norms, ele.NormCol3)
|
||||||
|
norms = append(norms, ele.NormCol4)
|
||||||
|
norms = append(norms, ele.NormCol5)
|
||||||
|
|
||||||
|
frees = append(frees, ele.FreeCol1)
|
||||||
|
frees = append(frees, ele.FreeCol2)
|
||||||
|
frees = append(frees, ele.FreeCol3)
|
||||||
|
frees = append(frees, ele.FreeCol4)
|
||||||
|
frees = append(frees, ele.FreeCol5)
|
||||||
|
|
||||||
|
jk = ele.JackPot
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if norms == nil {
|
||||||
|
norms = richblessed.EleWeight[:5]
|
||||||
|
frees = richblessed.EleWeight[5:10]
|
||||||
|
jk = richblessed.EleWeight[10]
|
||||||
|
key = 0
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *RichBlessedSceneData) CreateResult(eleLineAppearRate [][]int32, playerEx *RichBlessedPlayerData) {
|
||||||
|
//if s.DbGameFree.GetId() == 3070004 {
|
||||||
|
// playerEx.TestCode(eleLineAppearRate)
|
||||||
|
//} else {
|
||||||
|
playerEx.result.CreateLine(eleLineAppearRate)
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
func (s *RichBlessedSceneData) SendPlayerBet(p *RichBlessedPlayerData) {
|
||||||
|
//统计输下注金币数
|
||||||
|
if !p.IsRob && !s.Testing {
|
||||||
|
betCoin := p.betCoin
|
||||||
|
if p.gameState != richblessed.Normal {
|
||||||
|
betCoin = 0
|
||||||
|
}
|
||||||
|
playerBet := &server.PlayerData{
|
||||||
|
SnId: proto.Int32(p.SnId),
|
||||||
|
Bet: proto.Int64(betCoin),
|
||||||
|
Gain: proto.Int64(p.Coin - p.startCoin),
|
||||||
|
Tax: proto.Int64(p.taxCoin),
|
||||||
|
}
|
||||||
|
gwPlayerBet := &server.GWPlayerData{
|
||||||
|
GameFreeId: proto.Int32(s.DbGameFree.GetId()),
|
||||||
|
}
|
||||||
|
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||||
|
s.SyncPlayerDatas(&base.PlayerDataParam{
|
||||||
|
HasRobotGaming: false,
|
||||||
|
Data: gwPlayerBet,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,585 @@
|
||||||
|
package richblessed
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamerule/richblessed"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
protocol "mongo.games.com/game/protocol/richblessed"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ////////////////////////////////////////////////////////////
|
||||||
|
var ScenePolicyRichBlessedSington = &ScenePolicyRichBlessed{}
|
||||||
|
|
||||||
|
type ScenePolicyRichBlessed struct {
|
||||||
|
base.BaseScenePolicy
|
||||||
|
states [richblessed.RichBlessedStateMax]base.SceneState
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建场景扩展数据
|
||||||
|
func (this *ScenePolicyRichBlessed) CreateSceneExData(s *base.Scene) interface{} {
|
||||||
|
sceneEx := NewRichBlessedSceneData(s)
|
||||||
|
if sceneEx != nil {
|
||||||
|
if sceneEx.GetInit() {
|
||||||
|
s.SetExtraData(sceneEx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sceneEx
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建玩家扩展数据
|
||||||
|
func (this *ScenePolicyRichBlessed) CreatePlayerExData(s *base.Scene, p *base.Player) interface{} {
|
||||||
|
playerEx := &RichBlessedPlayerData{Player: p}
|
||||||
|
p.SetExtraData(playerEx)
|
||||||
|
return playerEx
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景开启事件
|
||||||
|
func (this *ScenePolicyRichBlessed) OnStart(s *base.Scene) {
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnStart, sceneId=", s.GetSceneId())
|
||||||
|
sceneEx := NewRichBlessedSceneData(s)
|
||||||
|
if sceneEx != nil {
|
||||||
|
if sceneEx.GetInit() {
|
||||||
|
s.SetExtraData(sceneEx)
|
||||||
|
s.ChangeSceneState(richblessed.RichBlessedStateStart)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景关闭事件
|
||||||
|
func (this *ScenePolicyRichBlessed) OnStop(s *base.Scene) {
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnStop , sceneId=", s.GetSceneId())
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景心跳事件
|
||||||
|
func (this *ScenePolicyRichBlessed) OnTick(s *base.Scene) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.GetSceneState() != nil {
|
||||||
|
s.GetSceneState().OnTick(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家进入事件
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerEnter(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEnter, sceneId=", s.GetSceneId(), " player=", p.Name, "bet:", s.DbGameFree.GetOtherIntParams())
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
playerEx := &RichBlessedPlayerData{Player: p}
|
||||||
|
playerEx.init()
|
||||||
|
playerEx.Clear()
|
||||||
|
|
||||||
|
sceneEx.players[p.SnId] = playerEx
|
||||||
|
|
||||||
|
p.SetExtraData(playerEx)
|
||||||
|
|
||||||
|
RichBlessedSendRoomInfo(s, sceneEx, playerEx)
|
||||||
|
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventEnter, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家离开事件
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerLeave(s *base.Scene, p *base.Player, reason int) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerLeave, sceneId=", s.GetSceneId(), " player=", p.SnId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok {
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventLeave, nil)
|
||||||
|
sceneEx.OnPlayerLeave(p, reason)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家掉线
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerDropLine(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerDropLine, sceneId=", s.GetSceneId(), " player=", p.SnId)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventDropLine, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家重连
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerRehold(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerRehold, sceneId=", s.GetSceneId(), " player=", p.SnId)
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
if playerEx, ok := p.GetExtraData().(*RichBlessedPlayerData); ok {
|
||||||
|
RichBlessedSendRoomInfo(s, sceneEx, playerEx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回房间
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerReturn(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerReturn, GetSceneId()=", s.GetSceneId(), " player=", p.Name)
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
if playerEx, ok := p.GetExtraData().(*RichBlessedPlayerData); ok {
|
||||||
|
//if p.IsMarkFlag(base.PlayerState_Auto) {
|
||||||
|
// p.UnmarkFlag(base.PlayerState_Auto)
|
||||||
|
// p.SyncFlag()
|
||||||
|
//}
|
||||||
|
//发送房间信息给自己
|
||||||
|
RichBlessedSendRoomInfo(s, sceneEx, playerEx)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventReturn, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func RichBlessedSendRoomInfo(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) {
|
||||||
|
pack := RichBlessedCreateRoomInfoPacket(s, sceneEx, playerEx)
|
||||||
|
logger.Logger.Trace("RoomInfo: ", pack)
|
||||||
|
playerEx.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRBRoomInfo), pack)
|
||||||
|
}
|
||||||
|
func RichBlessedCreateRoomInfoPacket(s *base.Scene, sceneEx *RichBlessedSceneData, playerEx *RichBlessedPlayerData) interface{} {
|
||||||
|
//房间信息
|
||||||
|
pack := &protocol.SCRBRoomInfo{
|
||||||
|
RoomId: proto.Int(s.SceneId),
|
||||||
|
GameId: proto.Int(s.GameId),
|
||||||
|
RoomMode: proto.Int(s.SceneMode),
|
||||||
|
SceneType: proto.Int(s.SceneType),
|
||||||
|
Params: s.Params,
|
||||||
|
NumOfGames: proto.Int(sceneEx.NumOfGames),
|
||||||
|
State: proto.Int(s.SceneState.GetState()),
|
||||||
|
ParamsEx: common.Int64ToInt32(s.DbGameFree.OtherIntParams), //s.GetParamsEx(),
|
||||||
|
//BetLimit: s.DbGameFree.BetLimit,
|
||||||
|
|
||||||
|
NowGameState: proto.Int(playerEx.gameState),
|
||||||
|
BetIdx: proto.Int(playerEx.betIdx),
|
||||||
|
FreeAllWin: proto.Int64(playerEx.freewinCoin),
|
||||||
|
SmallJackpot: proto.Int64(playerEx.oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl]),
|
||||||
|
MiddleJackpot: proto.Int64(playerEx.oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy]),
|
||||||
|
BigJackpot: proto.Int64(playerEx.oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldGirl]),
|
||||||
|
GrandJackpot: proto.Int64(playerEx.oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldBoy]),
|
||||||
|
WinEleCoin: proto.Int64(playerEx.winCoin),
|
||||||
|
WinRate: proto.Int64(playerEx.winLineRate),
|
||||||
|
FreeNum: proto.Int64(int64(playerEx.freeTimes)),
|
||||||
|
AddFreeNum: proto.Int64(int64(playerEx.addfreeTimes)),
|
||||||
|
WinFreeTimes: proto.Int32(int32(playerEx.nowFreeTimes)),
|
||||||
|
JackpotEle: proto.Int32(playerEx.result.JackpotEle),
|
||||||
|
WinJackpot: proto.Int64(playerEx.JackwinCoin),
|
||||||
|
GameFreeId: proto.Int32(s.DbGameFree.Id),
|
||||||
|
}
|
||||||
|
|
||||||
|
if playerEx.oneBetCoin == 0 && len(s.DbGameFree.GetOtherIntParams()) != 0 { // 初始化客户端jack显示
|
||||||
|
oneBetCoin := int64(s.DbGameFree.GetOtherIntParams()[0] / richblessed.LineNum)
|
||||||
|
pack.SmallJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueGirl]
|
||||||
|
pack.MiddleJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.BlueBoy]
|
||||||
|
pack.BigJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldGirl]
|
||||||
|
pack.GrandJackpot = oneBetCoin * richblessed.JkEleNumRate[richblessed.GoldBoy]
|
||||||
|
}
|
||||||
|
|
||||||
|
//自己的信息
|
||||||
|
if playerEx != nil {
|
||||||
|
pd := &protocol.RBPlayerData{
|
||||||
|
SnId: proto.Int32(playerEx.SnId),
|
||||||
|
Name: proto.String(playerEx.Name),
|
||||||
|
Head: proto.Int32(playerEx.Head),
|
||||||
|
Sex: proto.Int32(playerEx.Sex),
|
||||||
|
Coin: proto.Int64(playerEx.Coin),
|
||||||
|
Pos: proto.Int(playerEx.Pos),
|
||||||
|
Flag: proto.Int(playerEx.GetFlag()),
|
||||||
|
City: proto.String(playerEx.City),
|
||||||
|
HeadOutLine: proto.Int32(playerEx.HeadOutLine),
|
||||||
|
VIP: proto.Int32(playerEx.VIP),
|
||||||
|
}
|
||||||
|
pack.Player = pd
|
||||||
|
}
|
||||||
|
if playerEx.result != nil {
|
||||||
|
pack.Cards = playerEx.result.EleValue
|
||||||
|
var wl []*protocol.RichWinLine
|
||||||
|
for _, r := range playerEx.result.WinLine {
|
||||||
|
wl = append(wl, &protocol.RichWinLine{
|
||||||
|
Poss: r.Poss,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
pack.WinLines = wl
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerOp, sceneId=", s.GetSceneId(), " player=", p.SnId, " opcode=", opcode, " params=", params)
|
||||||
|
if s.GetSceneState() != nil {
|
||||||
|
if s.GetSceneState().OnPlayerOp(s, p, opcode, params) {
|
||||||
|
p.SetLastOPTimer(time.Now())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ScenePolicyRichBlessed) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyRichBlessed) OnPlayerEvent, sceneId=", s.GetSceneId(), " player=", p.SnId, " eventcode=", evtcode, " params=", params)
|
||||||
|
if s.GetSceneState() != nil {
|
||||||
|
s.GetSceneState().OnPlayerEvent(s, p, evtcode, params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *ScenePolicyRichBlessed) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if s.GetSceneState() != nil {
|
||||||
|
return s.GetSceneState().CanChangeCoinScene(s, p)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态基类
|
||||||
|
type SceneBaseStateRichBlessed struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneBaseStateRichBlessed) GetTimeout(s *base.Scene) int {
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
return int(time.Now().Sub(sceneEx.GetStateStartTime()) / time.Second)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneBaseStateRichBlessed) CanChangeTo(s base.SceneState) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *SceneBaseStateRichBlessed) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
func (this *SceneBaseStateRichBlessed) OnEnter(s *base.Scene) {
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
sceneEx.SetStateStartTime(time.Now())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneBaseStateRichBlessed) OnLeave(s *base.Scene) {}
|
||||||
|
func (this *SceneBaseStateRichBlessed) OnTick(s *base.Scene) {
|
||||||
|
if time.Now().Sub(s.GameStartTime) > time.Second*3 {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok {
|
||||||
|
//pack := &protocol.SCRBPrize{
|
||||||
|
// PrizePool: proto.Int64(sceneEx.jackpot.GetTotalSmall() / 10000),
|
||||||
|
//}
|
||||||
|
//proto.SetDefaults(pack)
|
||||||
|
////logger.Logger.Trace("SCRBPrize: ", pack)
|
||||||
|
//s.Broadcast(int(protocol.RBPID_PACKET_RICHBLESSED_SCRBPrize), pack, 0)
|
||||||
|
for _, p := range sceneEx.players {
|
||||||
|
if p.IsOnLine() {
|
||||||
|
p.leaveTime = 0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
p.leaveTime++
|
||||||
|
if p.leaveTime < 60*2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//踢出玩家
|
||||||
|
sceneEx.PlayerLeave(p.Player, common.PlayerLeaveReason_LongTimeNoOp, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s.GameStartTime = time.Now()
|
||||||
|
}
|
||||||
|
if sceneEx, ok := s.ExtraData.(*RichBlessedSceneData); ok {
|
||||||
|
//for _, p := range sceneEx.players {
|
||||||
|
// //游戏次数达到目标值
|
||||||
|
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(sceneEx.DbGameFree.GetId()))
|
||||||
|
// if !p.IsRob &&
|
||||||
|
// todayGamefreeIDSceneData != nil &&
|
||||||
|
// sceneEx.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||||
|
// todayGamefreeIDSceneData.GameTimes >= int64(sceneEx.DbGameFree.GetPlayNumLimit()) {
|
||||||
|
// s.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if sceneEx.CheckNeedDestroy() {
|
||||||
|
for _, player := range sceneEx.players {
|
||||||
|
if !player.IsRob {
|
||||||
|
sceneEx.PlayerLeave(player.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if s.GetRealPlayerCnt() == 0 {
|
||||||
|
sceneEx.SceneDestroy(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
// if time.Now().Sub(sceneEx.mqLogTime) >= time.Minute*1 {
|
||||||
|
// now := time.Now()
|
||||||
|
// sceneEx.mqLogTime = now.Add(-time.Second * time.Duration(now.Second()))
|
||||||
|
//
|
||||||
|
// waterVal := base.CoinPoolMgr.LoadCoin(s.GetGameFreeId(), s.Platform, s.GroupId)
|
||||||
|
// waterVal = int64(math.Floor(float64(waterVal) / float64(richblessed.NowByte)))
|
||||||
|
//
|
||||||
|
// jkVal1 := int64(math.Floor(float64(sceneEx.jackpot.GetTotalSmall()) / float64(richblessed.NowByte)))
|
||||||
|
// jkVal2 := int64(math.Floor(float64(sceneEx.jackpot.GetTotalMiddle()) / float64(richblessed.NowByte)))
|
||||||
|
// jkVal3 := int64(math.Floor(float64(sceneEx.jackpot.GetTotalBig()) / float64(richblessed.NowByte)))
|
||||||
|
// jkVal4 := int64(math.Floor(float64(sceneEx.jackpot.GetTotalGrand()) / float64(richblessed.NowByte)))
|
||||||
|
//
|
||||||
|
// base.JackPotMgr.WJackPotUpdate(sceneEx.GetGameFreeId(), sceneEx.Platform, waterVal, jkVal1, jkVal2, jkVal3, jkVal4)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
func (this *SceneBaseStateRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
func (this *SceneBaseStateRichBlessed) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// ////////////////////////////////////////////////////////////
|
||||||
|
// 开始状态
|
||||||
|
// ////////////////////////////////////////////////////////////
|
||||||
|
type SceneStateStartRichBlessed struct {
|
||||||
|
SceneBaseStateRichBlessed
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateStartRichBlessed) GetState() int {
|
||||||
|
return richblessed.RichBlessedStateStart
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateStartRichBlessed) CanChangeTo(s base.SceneState) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *SceneStateStartRichBlessed) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
if playerEx, ok := p.GetExtraData().(*RichBlessedPlayerData); ok {
|
||||||
|
if playerEx.IsOnLine() && playerEx.freeTimes > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateStartRichBlessed) GetTimeout(s *base.Scene) int {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateStartRichBlessed) OnEnter(s *base.Scene) {
|
||||||
|
this.SceneBaseStateRichBlessed.OnEnter(s)
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
sceneEx.SetGameNowTime(time.Now())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态离开时
|
||||||
|
func (this *SceneStateStartRichBlessed) OnLeave(s *base.Scene) {
|
||||||
|
this.SceneBaseStateRichBlessed.OnLeave(s)
|
||||||
|
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnLeave, sceneid=%v", s.GetSceneId())
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
func (this *SceneStateStartRichBlessed) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, sceneid=%v params=%v", s.GetSceneId(), params)
|
||||||
|
if this.SceneBaseStateRichBlessed.OnPlayerOp(s, p, opcode, params) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if sceneEx, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
if playerEx, ok := p.GetExtraData().(*RichBlessedPlayerData); ok {
|
||||||
|
switch opcode {
|
||||||
|
case richblessed.RichBlessedPlayerOpStart:
|
||||||
|
playerEx.Clear()
|
||||||
|
if len(params) > 0 {
|
||||||
|
//只有开始算操作
|
||||||
|
p.LastOPTimer = time.Now()
|
||||||
|
idx := int(params[0])
|
||||||
|
if len(sceneEx.DbGameFree.GetOtherIntParams()) <= idx {
|
||||||
|
pack := &protocol.SCRichBlessedOp{
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: proto.Int(3),
|
||||||
|
}
|
||||||
|
playerEx.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRichBlessedOp), pack)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if playerEx.freeTimes > 0 {
|
||||||
|
playerEx.gameState = richblessed.FreeGame
|
||||||
|
playerEx.freeTimes--
|
||||||
|
playerEx.nowFreeTimes++
|
||||||
|
}
|
||||||
|
//水池上下文环境
|
||||||
|
playerEx.cpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
|
||||||
|
|
||||||
|
norms, frees, JACKRand, key := sceneEx.GetEleWeight(playerEx.WBState)
|
||||||
|
playerEx.weightPos = key
|
||||||
|
if playerEx.gameState == richblessed.Normal {
|
||||||
|
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, 下注 %v %v %v", playerEx.betCoin, playerEx.maxbetCoin, playerEx.oneBetCoin)
|
||||||
|
playerEx.betIdx = idx
|
||||||
|
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
|
||||||
|
maxidx := len(sceneEx.DbGameFree.GetOtherIntParams()) - 1
|
||||||
|
playerEx.maxbetCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[maxidx])
|
||||||
|
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum // 单注
|
||||||
|
playerEx.noWinTimes++
|
||||||
|
|
||||||
|
if playerEx.Coin < int64(s.DbGameFree.GetBetLimit()) {
|
||||||
|
//押注限制(低于该值不能押注)
|
||||||
|
pack := &protocol.SCRichBlessedOp{
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: proto.Int(2),
|
||||||
|
}
|
||||||
|
playerEx.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRichBlessedOp), pack)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if playerEx.betCoin > playerEx.Coin {
|
||||||
|
//金币不足
|
||||||
|
pack := &protocol.SCRichBlessedOp{
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: proto.Int(1),
|
||||||
|
}
|
||||||
|
playerEx.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRichBlessedOp), pack)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.CurrentBet = playerEx.betCoin
|
||||||
|
playerEx.CurrentTax = 0
|
||||||
|
//SysProfitCoinMgr.Add(sceneEx.sysProfitCoinKey, playerEx.betCoin, -playerEx.betCoin)
|
||||||
|
//没有免费次数 扣钱
|
||||||
|
p.Statics(s.KeyGameId, s.KeyGamefreeId, -playerEx.betCoin, false)
|
||||||
|
playerEx.AddCoin(-playerEx.betCoin, common.GainWay_HundredSceneLost, 0, "system", s.GetSceneName())
|
||||||
|
sceneEx.AddPrizeCoin(playerEx) // 12%jack
|
||||||
|
|
||||||
|
sceneEx.CreateResult(norms, playerEx)
|
||||||
|
|
||||||
|
playerEx.isFTest++
|
||||||
|
if playerEx.isFTest >= 100000 {
|
||||||
|
playerEx.isFTest = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
//if !playerEx.nottest {
|
||||||
|
// playerEx.result.EleValue = []int32{1, 0, 1, 0, 5, 6, 2, 7, 7, 9, 9, 7, 4, 8, 7} //三锣免费
|
||||||
|
//}
|
||||||
|
} else {
|
||||||
|
// 免费游戏
|
||||||
|
if playerEx.freeTimes >= 100 {
|
||||||
|
playerEx.CreateLevResult(frees) // 没有铜锣概率
|
||||||
|
playerEx.freeTimes = 0
|
||||||
|
} else {
|
||||||
|
sceneEx.CreateResult(frees, playerEx)
|
||||||
|
}
|
||||||
|
|
||||||
|
//if playerEx.freeTimes == 3 && !playerEx.nottest1 { // 免费在中一次
|
||||||
|
// playerEx.result.EleValue = []int32{1, 0, 1, 0, 5, 6, 2, 7, 7, 9, 9, 7, 4, 8, 7} //三锣免费
|
||||||
|
// playerEx.nottest1 = true
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
sceneEx.Win(playerEx)
|
||||||
|
|
||||||
|
if sceneEx.CanJACKPOT(playerEx, playerEx.betCoin, playerEx.maxbetCoin, JACKRand) { // 中奖 包含CreateJACKPOT 下注不存在越界问题
|
||||||
|
playerEx.gameState = richblessed.JackGame
|
||||||
|
// sceneEx.JACKPOTWin(playerEx)
|
||||||
|
}
|
||||||
|
//发送结算
|
||||||
|
sceneEx.SendBilled(playerEx)
|
||||||
|
if !playerEx.isFWinJackpot {
|
||||||
|
sceneEx.SaveLog(playerEx, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case richblessed.RichBlessedPlayerOpSwitch:
|
||||||
|
if len(params) > 0 && playerEx.freeTimes == 0 {
|
||||||
|
idx := int(params[0])
|
||||||
|
if len(sceneEx.DbGameFree.GetOtherIntParams()) > idx {
|
||||||
|
playerEx.betIdx = idx
|
||||||
|
playerEx.betCoin = int64(sceneEx.DbGameFree.GetOtherIntParams()[idx])
|
||||||
|
playerEx.oneBetCoin = playerEx.betCoin / richblessed.LineNum
|
||||||
|
pack := &protocol.SCRichBlessedOp{
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: proto.Int(4),
|
||||||
|
}
|
||||||
|
for i := int32(0); i != richblessed.JackMax; i++ {
|
||||||
|
pack.Params = append(pack.Params, playerEx.oneBetCoin*richblessed.JkEleNumRate[i])
|
||||||
|
}
|
||||||
|
playerEx.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRichBlessedOp), pack)
|
||||||
|
logger.Logger.Tracef("(this *SceneStateStartRichBlessed) OnPlayerOp, sceneid=%v pack=%v", s.GetSceneId(), pack)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case richblessed.RichBlessedPlayerOpJack: // jack领奖 注意不要再次结算wincoin
|
||||||
|
if !playerEx.isFWinJackpot {
|
||||||
|
pack := &protocol.SCRichBlessedOp{
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: proto.Int(3),
|
||||||
|
}
|
||||||
|
playerEx.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRichBlessedOp), pack)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.JackMidCards = append(playerEx.JackMidCards, params...)
|
||||||
|
sceneEx.JACKPOTWin(playerEx)
|
||||||
|
//发送结算
|
||||||
|
sceneEx.SendJACKPOTBilled(playerEx)
|
||||||
|
|
||||||
|
sceneEx.SaveLog(playerEx, 0)
|
||||||
|
|
||||||
|
playerEx.Clear() // 小游戏模式结束
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家事件
|
||||||
|
func (this *SceneStateStartRichBlessed) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
logger.Logger.Trace("(this *SceneStateStartRichBlessed) OnPlayerEvent, sceneId=", s.GetSceneId(), " player=", p.SnId, " evtcode=", evtcode)
|
||||||
|
this.SceneBaseStateRichBlessed.OnPlayerEvent(s, p, evtcode, params)
|
||||||
|
if _, ok := s.GetExtraData().(*RichBlessedSceneData); ok {
|
||||||
|
switch evtcode {
|
||||||
|
case base.PlayerEventEnter:
|
||||||
|
/*
|
||||||
|
pack := &protocol.SCRBPrize{
|
||||||
|
PrizePool: proto.Int64(sceneEx.jackpot.GetTotalSmall() / 10000),
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
//logger.Logger.Trace("SCRBPrize: ", pack)
|
||||||
|
p.SendToClient(int(protocol.RBPID_PACKET_RICHBLESSED_SCRBPrize), pack)
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateStartRichBlessed) OnTick(s *base.Scene) {
|
||||||
|
this.SceneBaseStateRichBlessed.OnTick(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
func (this *ScenePolicyRichBlessed) RegisteSceneState(state base.SceneState) {
|
||||||
|
if state == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
stateid := state.GetState()
|
||||||
|
if stateid < 0 || stateid >= richblessed.RichBlessedStateMax {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.states[stateid] = state
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ScenePolicyRichBlessed) GetSceneState(s *base.Scene, stateid int) base.SceneState {
|
||||||
|
if stateid >= 0 && stateid < richblessed.RichBlessedStateMax {
|
||||||
|
return this.states[stateid]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
//主状态
|
||||||
|
ScenePolicyRichBlessedSington.RegisteSceneState(&SceneStateStartRichBlessed{})
|
||||||
|
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
|
||||||
|
base.RegisteScenePolicy(common.GameId_Richblessed, richblessed.RoomMode_Classic, ScenePolicyRichBlessedSington)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
package tamquoc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/netlib"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/protocol/tamquoc"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 百战成神的操作
|
||||||
|
type CSTamQuocOpPacketFactory struct {
|
||||||
|
}
|
||||||
|
type CSTamQuocOpHandler struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CSTamQuocOpPacketFactory) CreatePacket() interface{} {
|
||||||
|
pack := &tamquoc.CSTamQuocOp{}
|
||||||
|
return pack
|
||||||
|
}
|
||||||
|
func (this *CSTamQuocOpHandler) Process(s *netlib.Session, packetid int, data interface{}, sid int64) error {
|
||||||
|
logger.Logger.Trace("CSTamQuocOpHandler Process recv ", data)
|
||||||
|
if csTamQuocOp, ok := data.(*tamquoc.CSTamQuocOp); ok {
|
||||||
|
p := base.PlayerMgrSington.GetPlayer(sid)
|
||||||
|
if p == nil {
|
||||||
|
logger.Logger.Warn("CSTamQuocOpHandler p == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
scene := p.GetScene()
|
||||||
|
if scene == nil {
|
||||||
|
logger.Logger.Warn("CSTamQuocOpHandler p.scene == nil")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if scene.GameId != common.GameId_TamQuoc {
|
||||||
|
logger.Logger.Error("CSTamQuocOpHandler gameId Error ", scene.GameId)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !scene.HasPlayer(p) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
sp := scene.GetScenePolicy()
|
||||||
|
if sp != nil {
|
||||||
|
sp.OnPlayerOp(scene, p, int(csTamQuocOp.GetOpCode()), csTamQuocOp.GetParams())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// 百战成神的操作
|
||||||
|
common.RegisterHandler(int(tamquoc.TamQuocPacketID_PACKET_CS_TAMQUOC_PLAYEROP), &CSTamQuocOpHandler{})
|
||||||
|
netlib.RegisterFactory(int(tamquoc.TamQuocPacketID_PACKET_CS_TAMQUOC_PLAYEROP), &CSTamQuocOpPacketFactory{})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,112 @@
|
||||||
|
package tamquoc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家游戏数据索引
|
||||||
|
const (
|
||||||
|
TamQuocFreeTimes int = iota //0 当前剩余免费次数
|
||||||
|
TamQuocBonusTime //1 上一次小游戏的时间
|
||||||
|
TamQuocIndexMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 通知奖池变化的时间间隔
|
||||||
|
const jackpotNoticeInterval = time.Second
|
||||||
|
|
||||||
|
// 场景状态
|
||||||
|
const (
|
||||||
|
TamQuocSceneStateStart int = iota //开始游戏
|
||||||
|
TamQuocSceneStateMax
|
||||||
|
)
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
const (
|
||||||
|
TamQuocPlayerOpStart int = iota //游戏
|
||||||
|
TamQuocPlayerHistory // 游戏记录
|
||||||
|
TamQuocBurstHistory // 爆奖记录
|
||||||
|
TamQuocBonusGame // 小游戏
|
||||||
|
TamQuocBonusGameRecord // 小游戏重连
|
||||||
|
)
|
||||||
|
|
||||||
|
// 小游戏超时时间
|
||||||
|
const TamQuocBonusGameTimeout = time.Second * 60
|
||||||
|
|
||||||
|
// 小游戏操作时间
|
||||||
|
const TamQuocBonusGamePickTime = time.Second * 15
|
||||||
|
|
||||||
|
type GameResultLog struct {
|
||||||
|
BaseResult *model.SlotBaseResultType
|
||||||
|
AllLine int32 //线路数
|
||||||
|
UserName string //昵称
|
||||||
|
BetLines []int64 //下注的线
|
||||||
|
//Cards [][]int32 // 消除前后的牌(消除前15张,消除后15张...)
|
||||||
|
WinLines []int // 赢分的线
|
||||||
|
}
|
||||||
|
|
||||||
|
// 百战成神解析的数据
|
||||||
|
type TamQuocGameNoteData struct {
|
||||||
|
Source int32
|
||||||
|
Data *GameResultLog
|
||||||
|
}
|
||||||
|
|
||||||
|
// 百战成神游戏记录
|
||||||
|
func UnMarshalTamQuocGameNote(data string) (roll interface{}, err error) {
|
||||||
|
gnd := &TamQuocGameNoteData{}
|
||||||
|
if err := json.Unmarshal([]byte(data), gnd); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
roll = gnd.Data
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var DebugData = [][]int{
|
||||||
|
{
|
||||||
|
1, 1, 1, 5, 5,
|
||||||
|
1, 1, 1, 3, 4,
|
||||||
|
6, 7, 2, 3, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
1, 1, 1, 1, 5,
|
||||||
|
1, 1, 1, 1, 4,
|
||||||
|
6, 7, 2, 3, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 1,
|
||||||
|
6, 7, 2, 3, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
2, 2, 2, 2, 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
3, 3, 3, 3, 3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
4, 4, 4, 4, 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
5, 5, 5, 5, 5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
6, 6, 6, 6, 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
7, 7, 7, 7, 7,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
package tamquoc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
|
rule "mongo.games.com/game/gamerule/tamquoc"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/protocol/tamquoc"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TamQuocPlayerData struct {
|
||||||
|
*base.Player
|
||||||
|
spinID int64 //当前旋转ID
|
||||||
|
score int32 //单线押注数
|
||||||
|
freeTimes int32 //免费转动次数
|
||||||
|
cards []int32 //15张牌
|
||||||
|
totalPriceBonus int64 //小游戏奖金
|
||||||
|
bonusTimerHandle timer.TimerHandle //托管handle
|
||||||
|
//RollGameType *model.TamQuocType //记录信息
|
||||||
|
RollGameType *GameResultLog //记录信息
|
||||||
|
enterGameCoin int64 //玩家进入初始金币
|
||||||
|
betLines []int64 //下注的选线
|
||||||
|
taxCoin int64 //本局税收
|
||||||
|
winCoin int64 //本局收税前赢的钱
|
||||||
|
linesWinCoin int64 //本局中奖线赢得钱
|
||||||
|
jackpotWinCoin int64 //本局奖池赢的钱
|
||||||
|
smallGameWinCoin int64 //本局小游戏赢的钱
|
||||||
|
currentLogId string //爆奖玩家logid
|
||||||
|
leavetime int32 //用户离开时间
|
||||||
|
bonusGameTime int64 //上一次小游戏的时间
|
||||||
|
bonusGameStartTime time.Time // 小游戏开始时间
|
||||||
|
bonusGamePickPos []int32 // 小游戏位置
|
||||||
|
bonusGameCanPickNum int // 小游戏点击次数
|
||||||
|
bonusGame tamquoc.TamQuocBonusGameInfo
|
||||||
|
billedData *tamquoc.GameBilledData
|
||||||
|
DebugGame bool //测试
|
||||||
|
TestNum int
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家初始化
|
||||||
|
func (this *TamQuocPlayerData) init(s *base.Scene) {
|
||||||
|
this.Clean()
|
||||||
|
this.score = 0
|
||||||
|
this.freeTimes = 0
|
||||||
|
//this.RollGameType = &model.TamQuocType{}
|
||||||
|
this.RollGameType = &GameResultLog{}
|
||||||
|
this.RollGameType.BaseResult = &model.SlotBaseResultType{}
|
||||||
|
this.enterGameCoin = this.Coin
|
||||||
|
this.currentLogId = ""
|
||||||
|
this.billedData = &tamquoc.GameBilledData{}
|
||||||
|
this.DebugGame = true
|
||||||
|
this.TestNum = 0
|
||||||
|
|
||||||
|
initCards := rule.GenerateSlotsData_v2(rule.SYMBOL2)
|
||||||
|
for _, card := range initCards {
|
||||||
|
this.cards = append(this.cards, int32(card))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
if this.GDatas == nil {
|
||||||
|
this.GDatas = make(map[string]*model.PlayerGameInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
if d, exist := this.GDatas[s.KeyGamefreeId]; exist {
|
||||||
|
gLen := len(d.Data)
|
||||||
|
if gLen < TamQuocIndexMax {
|
||||||
|
for i := gLen; i < TamQuocIndexMax; i++ {
|
||||||
|
d.Data = append(d.Data, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pgd := &model.PlayerGameInfo{
|
||||||
|
Data: make([]int64, TamQuocIndexMax, TamQuocIndexMax),
|
||||||
|
}
|
||||||
|
this.GDatas[s.KeyGamefreeId] = pgd
|
||||||
|
}
|
||||||
|
this.LoadPlayerGameData(s.KeyGamefreeId)
|
||||||
|
//线条全选
|
||||||
|
if len(this.betLines) == 0 {
|
||||||
|
this.betLines = rule.AllBetLines
|
||||||
|
}
|
||||||
|
this.bonusGamePickPos = make([]int32, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家清理数据
|
||||||
|
func (this *TamQuocPlayerData) Clean() {
|
||||||
|
for i := 0; i < len(this.cards); i++ {
|
||||||
|
this.cards[i] = -1
|
||||||
|
}
|
||||||
|
this.winCoin = 0
|
||||||
|
this.taxCoin = 0
|
||||||
|
this.linesWinCoin = 0
|
||||||
|
this.jackpotWinCoin = 0
|
||||||
|
this.smallGameWinCoin = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载玩家游戏数据
|
||||||
|
func (this *TamQuocPlayerData) LoadPlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
this.freeTimes = int32(d.Data[TamQuocFreeTimes])
|
||||||
|
this.bonusGameTime = d.Data[TamQuocBonusTime]
|
||||||
|
if this.freeTimes > 0 && len(d.DataEx) != 0 {
|
||||||
|
json.Unmarshal(d.DataEx, &this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 存储玩家游戏数据
|
||||||
|
func (this *TamQuocPlayerData) SavePlayerGameData(gameFreeId string) {
|
||||||
|
if d, exist := this.GDatas[gameFreeId]; exist {
|
||||||
|
d.Data[TamQuocFreeTimes] = int64(this.freeTimes)
|
||||||
|
d.Data[TamQuocBonusTime] = this.bonusGameTime
|
||||||
|
d.DataEx, _ = json.Marshal(this.betLines)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黑白名单的限制是否生效
|
||||||
|
func (this *TamQuocPlayerData) CheckBlackWriteList(isWin bool) bool {
|
||||||
|
if isWin && this.BlackLevel > 0 && this.BlackLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.BlackLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if !isWin && this.WhiteLevel > 0 && this.WhiteLevel <= 10 {
|
||||||
|
if rand.Int31n(100) < this.WhiteLevel*10 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家是否是新手
|
||||||
|
func (this *TamQuocPlayerData) IsFNovice(keyGameId string) {
|
||||||
|
if f, ok := this.IsFoolPlayer[keyGameId]; ok {
|
||||||
|
if !f {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.IsFoolPlayer[keyGameId] = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if data, ok := this.GDatas[keyGameId]; ok {
|
||||||
|
if data.Statics.GameTimes < 100 && data.Statics.TotalOut-data.Statics.TotalIn <= 2000000 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.IsFoolPlayer[keyGameId] = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,324 @@
|
||||||
|
package tamquoc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/tamquoc"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/gamehall"
|
||||||
|
"mongo.games.com/game/protocol/tamquoc"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TamQuocSceneData struct {
|
||||||
|
*base.Scene //房间信息
|
||||||
|
players map[int32]*TamQuocPlayerData //玩家信息
|
||||||
|
rooms map[int][]*TamQuocPlayerData //房间
|
||||||
|
jackpot *base.SlotJackpotPool //奖池
|
||||||
|
lastJackpotValue int64 //上一次奖池变化时的值
|
||||||
|
lastJackPot time.Time //增加奖池时间
|
||||||
|
lastBurstJackPot map[int32]time.Time //爆池时间
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTamQuocSceneData(s *base.Scene) *TamQuocSceneData {
|
||||||
|
return &TamQuocSceneData{
|
||||||
|
Scene: s,
|
||||||
|
players: make(map[int32]*TamQuocPlayerData),
|
||||||
|
rooms: make(map[int][]*TamQuocPlayerData),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) SaveData(force bool) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) OnPlayerLeave(p *base.Player, reason int) {
|
||||||
|
if p, exist := this.players[p.SnId]; exist {
|
||||||
|
delete(this.players, p.SnId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) SceneDestroy(force bool) {
|
||||||
|
//销毁房间
|
||||||
|
this.Scene.Destroy(force)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) init() bool {
|
||||||
|
if this.DbGameFree == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
params := this.DbGameFree.GetJackpot()
|
||||||
|
this.jackpot = &base.SlotJackpotPool{}
|
||||||
|
if this.jackpot.Small <= 0 {
|
||||||
|
this.jackpot.Small = 0
|
||||||
|
this.jackpot.VirtualJK = int64(params[rule.TAMQUOC_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore())
|
||||||
|
}
|
||||||
|
str := base.SlotsPoolMgr.GetPool(this.GetGameFreeId(), this.Platform)
|
||||||
|
if str != "" {
|
||||||
|
jackpot := &base.SlotJackpotPool{}
|
||||||
|
err := json.Unmarshal([]byte(str), jackpot)
|
||||||
|
if err == nil {
|
||||||
|
this.jackpot = jackpot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.jackpot != nil {
|
||||||
|
base.SlotsPoolMgr.SetPool(this.GetGameFreeId(), this.Platform, this.jackpot)
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now()
|
||||||
|
this.lastBurstJackPot = make(map[int32]time.Time)
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type TamQuocSpinResult struct {
|
||||||
|
LinesInfo []*tamquoc.TamQuocLinesInfo
|
||||||
|
SlotsData []int32
|
||||||
|
TotalPrizeLine int64 // 线条总金额
|
||||||
|
TotalPrizeJackpot int64 // 爆奖总金额
|
||||||
|
JackpotCnt int // 爆奖的次数
|
||||||
|
AddFreeTimes int32 // 新增免费次数
|
||||||
|
IsJackpot bool // 是否爆奖
|
||||||
|
BonusGame tamquoc.TamQuocBonusGameInfo
|
||||||
|
TotalWinRate int32 // 中奖总倍率
|
||||||
|
TotalTaxScore int64 // 税收
|
||||||
|
IsBonusGame bool // 是否进小游戏标志
|
||||||
|
WinLines []int // 赢分的线
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) CalcLinePrize(cards []int, betLines []int64, betValue int64) (spinRes TamQuocSpinResult) {
|
||||||
|
taxRate := this.DbGameFree.GetTaxRate()
|
||||||
|
calcTaxScore := func(score int64, taxScore *int64) int64 {
|
||||||
|
newScore := int64(float64(score) * float64(10000-taxRate) / 10000.0)
|
||||||
|
if taxScore != nil {
|
||||||
|
*taxScore += score - newScore
|
||||||
|
}
|
||||||
|
return newScore
|
||||||
|
}
|
||||||
|
|
||||||
|
var startBonus int
|
||||||
|
lines := rule.CalcLine(cards, betLines)
|
||||||
|
for _, line := range lines {
|
||||||
|
if line.Element == rule.Element_JACKPOT && line.Count == rule.LINE_CELL {
|
||||||
|
spinRes.IsJackpot = true
|
||||||
|
spinRes.JackpotCnt++
|
||||||
|
var prizeJackpot int64
|
||||||
|
if spinRes.TotalPrizeJackpot == 0 { // 第一个爆奖 获取当前奖池所有
|
||||||
|
prizeJackpot = this.jackpot.VirtualJK
|
||||||
|
} else { // 之后的爆奖 奖励为奖池初值
|
||||||
|
prizeJackpot = int64(this.DbGameFree.GetJackpot()[rule.TAMQUOC_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore())
|
||||||
|
}
|
||||||
|
prizeJackpot = calcTaxScore(prizeJackpot, &spinRes.TotalTaxScore)
|
||||||
|
spinRes.TotalPrizeJackpot += prizeJackpot
|
||||||
|
}
|
||||||
|
|
||||||
|
curScore := betValue * int64(line.Score)
|
||||||
|
curScore = calcTaxScore(curScore, &spinRes.TotalTaxScore)
|
||||||
|
spinRes.TotalPrizeLine += curScore
|
||||||
|
spinRes.TotalWinRate += int32(line.Score)
|
||||||
|
|
||||||
|
lineInfo := &tamquoc.TamQuocLinesInfo{
|
||||||
|
LineId: proto.Int32(int32(line.Index)),
|
||||||
|
Position: line.Position,
|
||||||
|
PrizeValue: proto.Int64(curScore),
|
||||||
|
}
|
||||||
|
spinRes.LinesInfo = append(spinRes.LinesInfo, lineInfo)
|
||||||
|
spinRes.WinLines = append(spinRes.WinLines, int(lineInfo.GetLineId()))
|
||||||
|
|
||||||
|
// bonus game
|
||||||
|
if line.BonusElementCnt == 3 || line.BonusElementCnt == 4 {
|
||||||
|
startBonus += rule.LineScore[rule.Element_BONUS][line.BonusElementCnt-1]
|
||||||
|
spinRes.IsBonusGame = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// add free
|
||||||
|
if line.FreeElementCnt >= 3 {
|
||||||
|
spinRes.AddFreeTimes += int32(rule.FreeSpinTimesRate[line.FreeElementCnt-1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if spinRes.IsBonusGame && startBonus > 0 {
|
||||||
|
bonusGame := rule.GenerateBonusGame(int(betValue), startBonus)
|
||||||
|
|
||||||
|
var totalBonusValue int64
|
||||||
|
bonusData := make([]int64, 0)
|
||||||
|
for _, value := range bonusGame.BonusData {
|
||||||
|
value = calcTaxScore(value, nil)
|
||||||
|
totalBonusValue += value
|
||||||
|
bonusData = append(bonusData, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
spinRes.BonusGame = tamquoc.TamQuocBonusGameInfo{
|
||||||
|
TotalPrizeValue: proto.Int64(totalBonusValue * int64(bonusGame.Mutiplier)),
|
||||||
|
Mutiplier: proto.Int32(int32(bonusGame.Mutiplier)),
|
||||||
|
DataMultiplier: proto.Int64(totalBonusValue),
|
||||||
|
BonusData: bonusData,
|
||||||
|
}
|
||||||
|
// 小游戏税收
|
||||||
|
bonusTax := (bonusGame.DataMultiplier - totalBonusValue) * int64(bonusGame.Mutiplier)
|
||||||
|
spinRes.TotalTaxScore += bonusTax
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, card := range cards {
|
||||||
|
spinRes.SlotsData = append(spinRes.SlotsData, int32(card))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) BroadcastJackpot(sync bool) {
|
||||||
|
if this.lastJackpotValue != this.jackpot.VirtualJK || sync {
|
||||||
|
this.lastJackpotValue = this.jackpot.VirtualJK
|
||||||
|
pack := &gamehall.SCHundredSceneGetGameJackpot{}
|
||||||
|
jpfi := &gamehall.GameJackpotFundInfo{
|
||||||
|
GameFreeId: proto.Int32(this.DbGameFree.Id),
|
||||||
|
JackPotFund: proto.Int64(this.jackpot.VirtualJK),
|
||||||
|
}
|
||||||
|
pack.GameJackpotFund = append(pack.GameJackpotFund, jpfi)
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
//以平台为标识向该平台内所有玩家广播奖池变动消息,游戏内外的玩家可监听该消息,减少由gamesrv向worldsrv转发这一步
|
||||||
|
tags := []string{this.Platform}
|
||||||
|
logger.Logger.Trace("jackpot tamquoc", pack)
|
||||||
|
base.PlayerMgrSington.BroadcastMessageToGroup(int(gamehall.HundredScenePacketID_PACKET_SC_GAMEJACKPOT), pack, tags)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) PushCoinPool(prizeFundAdd int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PushCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PushCoin(this.GetGameFreeId(), this.GroupId, this.Platform, prizeFundAdd)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) PopCoinPool(winCoin int64, IsNovice bool) {
|
||||||
|
if IsNovice {
|
||||||
|
base.CoinPoolMgr.PopCoinNovice(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
} else {
|
||||||
|
base.CoinPoolMgr.PopCoin(this.GetGameFreeId(), this.GroupId, this.Platform, winCoin)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) RecordBurstLog(name string, wincoin, totalbet int64) {
|
||||||
|
log := model.NewBurstJackpotLog(this.Platform, this.DbGameFree.GameId, this.GetGameFreeId(), name, wincoin, totalbet)
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.InsertBurstJackpotLogs(log)
|
||||||
|
}), nil, "InsertBurstJackpotLogs").Start()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) BurstHistory(player *TamQuocPlayerData) {
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
return model.GetBurstJackpotLog(this.Platform, this.DbGameFree.GameId)
|
||||||
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
var logsp []*tamquoc.TamQuocBurstHistoryInfo
|
||||||
|
if data != nil {
|
||||||
|
logs := data.([]model.BurstJackpotLog)
|
||||||
|
if len(logs) > 0 {
|
||||||
|
for _, log := range logs {
|
||||||
|
logsp = append(logsp, &tamquoc.TamQuocBurstHistoryInfo{
|
||||||
|
UserName: log.Name,
|
||||||
|
PriceValue: log.WinCoin,
|
||||||
|
TotalBet: log.TotalBet,
|
||||||
|
Ts: log.Ts,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pack := &tamquoc.SCTamQuocBurstHistory{
|
||||||
|
BurstLog: logsp,
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("SCTamQuocBurstHistory:", pack)
|
||||||
|
player.SendToClient(int(tamquoc.TamQuocPacketID_PACKET_SC_TAMQUOC_BURSTHISTORY), pack)
|
||||||
|
}), "BurstHistory").Start()
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) GetLastBurstJackPot() time.Time {
|
||||||
|
return this.lastBurstJackPot[this.GetGameFreeId()]
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) SetLastBurstJackPot() {
|
||||||
|
var randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(25200-7200+1) + 7200
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(108000-72000+1) + 72000
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(180000-108000+1) + 108000
|
||||||
|
}
|
||||||
|
this.lastBurstJackPot[this.GetGameFreeId()] = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *TamQuocSceneData) AIAddJackPot() {
|
||||||
|
if time.Now().Sub(this.lastJackPot) > 0 {
|
||||||
|
var randT = rand.Intn(3) + 1
|
||||||
|
switch this.DbGameFree.SceneType {
|
||||||
|
case 1:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
case 2:
|
||||||
|
randT = rand.Intn(12-5) + 6
|
||||||
|
case 3:
|
||||||
|
randT = rand.Intn(20-9) + 10
|
||||||
|
default:
|
||||||
|
randT = rand.Intn(3) + 1
|
||||||
|
}
|
||||||
|
this.lastJackPot = time.Now().Add(time.Second * time.Duration(randT))
|
||||||
|
val := int64(math.Floor(float64(this.DbGameFree.GetBaseScore()) * float64(rule.LINENUM) * float64(500) / 10000))
|
||||||
|
this.jackpot.VirtualJK += val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) AIBurstJackPot() {
|
||||||
|
if time.Now().Sub(this.GetLastBurstJackPot()) > 0 {
|
||||||
|
this.SetLastBurstJackPot()
|
||||||
|
jackpotParams := this.DbGameFree.GetJackpot()
|
||||||
|
var jackpotInit = int64(jackpotParams[rule.TAMQUOC_JACKPOT_InitJackpot] * this.DbGameFree.GetBaseScore()) //奖池初始值
|
||||||
|
|
||||||
|
//AI机器人爆奖
|
||||||
|
val := this.jackpot.VirtualJK
|
||||||
|
this.jackpot.VirtualJK = jackpotInit
|
||||||
|
bet := this.DbGameFree.GetBaseScore() * int32(rule.LINENUM)
|
||||||
|
this.RecordBurstLog(this.RandNickName(), val, int64(bet))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (this *TamQuocSceneData) KickPlayerByTime() {
|
||||||
|
if time.Now().Sub(this.GameStartTime) > time.Second*3 {
|
||||||
|
this.GameStartTime = time.Now()
|
||||||
|
for _, p := range this.players {
|
||||||
|
if p.IsOnLine() {
|
||||||
|
p.leavetime = 0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
p.leavetime++
|
||||||
|
if p.leavetime < 60 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
//踢出玩家
|
||||||
|
this.PlayerLeave(p.Player, common.PlayerLeaveReason_LongTimeNoOp, true)
|
||||||
|
}
|
||||||
|
//for _, p := range this.players {
|
||||||
|
// //游戏次数达到目标值
|
||||||
|
// todayGamefreeIDSceneData, _ := p.GetDaliyGameData(int(this.DbGameFree.GetId()))
|
||||||
|
// if !p.IsRob &&
|
||||||
|
// todayGamefreeIDSceneData != nil &&
|
||||||
|
// this.DbGameFree.GetPlayNumLimit() != 0 &&
|
||||||
|
// todayGamefreeIDSceneData.GameTimes >= int64(this.DbGameFree.GetPlayNumLimit()) {
|
||||||
|
// this.PlayerLeave(p.Player, common.PlayerLeaveReason_GameTimes, true)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
if this.CheckNeedDestroy() {
|
||||||
|
for _, player := range this.players {
|
||||||
|
if !player.IsRob {
|
||||||
|
if time.Now().Sub(player.LastOPTimer) > 10*time.Second {
|
||||||
|
//离开有统计
|
||||||
|
this.PlayerLeave(player.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.GetRealPlayerCnt() == 0 {
|
||||||
|
this.SceneDestroy(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,843 @@
|
||||||
|
package tamquoc
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core"
|
||||||
|
"mongo.games.com/goserver/core/basic"
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
"mongo.games.com/goserver/core/task"
|
||||||
|
"mongo.games.com/goserver/core/timer"
|
||||||
|
|
||||||
|
"mongo.games.com/game/common"
|
||||||
|
rule "mongo.games.com/game/gamerule/tamquoc"
|
||||||
|
"mongo.games.com/game/gamesrv/base"
|
||||||
|
"mongo.games.com/game/model"
|
||||||
|
"mongo.games.com/game/proto"
|
||||||
|
"mongo.games.com/game/protocol/server"
|
||||||
|
"mongo.games.com/game/protocol/tamquoc"
|
||||||
|
)
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//百战成神
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// 房间内主要逻辑
|
||||||
|
var ScenePolicyTamQuocSington = &ScenePolicyTamQuoc{}
|
||||||
|
|
||||||
|
type ScenePolicyTamQuoc struct {
|
||||||
|
base.BaseScenePolicy
|
||||||
|
states [TamQuocSceneStateMax]base.SceneState
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建场景扩展数据
|
||||||
|
func (this *ScenePolicyTamQuoc) CreateSceneExData(s *base.Scene) interface{} {
|
||||||
|
sceneEx := NewTamQuocSceneData(s)
|
||||||
|
if sceneEx != nil {
|
||||||
|
if sceneEx.init() {
|
||||||
|
s.ExtraData = sceneEx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sceneEx
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建玩家扩展数据
|
||||||
|
func (this *ScenePolicyTamQuoc) CreatePlayerExData(s *base.Scene, p *base.Player) interface{} {
|
||||||
|
playerEx := &TamQuocPlayerData{Player: p}
|
||||||
|
if playerEx != nil {
|
||||||
|
p.ExtraData = playerEx
|
||||||
|
}
|
||||||
|
return playerEx
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景开启事件
|
||||||
|
func (this *ScenePolicyTamQuoc) OnStart(s *base.Scene) {
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnStart, sceneId=", s.SceneId)
|
||||||
|
sceneEx := NewTamQuocSceneData(s)
|
||||||
|
if sceneEx != nil {
|
||||||
|
if sceneEx.init() {
|
||||||
|
s.ExtraData = sceneEx
|
||||||
|
s.ChangeSceneState(TamQuocSceneStateStart) //改变当前的玩家状态
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景关闭事件
|
||||||
|
func (this *ScenePolicyTamQuoc) OnStop(s *base.Scene) {
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnStop , sceneId=", s.SceneId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
sceneEx.SaveData(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 场景心跳事件
|
||||||
|
func (this *ScenePolicyTamQuoc) OnTick(s *base.Scene) {
|
||||||
|
if s == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
s.SceneState.OnTick(s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家进入事件
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerEnter(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerEnter, sceneId=", s.SceneId, " player=", p.SnId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
playerEx := &TamQuocPlayerData{Player: p}
|
||||||
|
playerEx.init(s) // 玩家当前信息初始化
|
||||||
|
playerEx.score = sceneEx.DbGameFree.GetBaseScore() // 底注
|
||||||
|
sceneEx.players[p.SnId] = playerEx
|
||||||
|
p.ExtraData = playerEx
|
||||||
|
TamQuocSendRoomInfo(s, p, sceneEx, playerEx, nil)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventEnter, nil) //回调会调取 onPlayerEvent事件
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家离开事件
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerLeave(s *base.Scene, p *base.Player, reason int) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerLeave, sceneId=", s.SceneId, " player=", p.SnId)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
if this.CanChangeCoinScene(s, p) {
|
||||||
|
if playerEx, ok := p.ExtraData.(*TamQuocPlayerData); ok {
|
||||||
|
playerEx.SavePlayerGameData(strconv.Itoa(int(s.GetGameFreeId())))
|
||||||
|
}
|
||||||
|
sceneEx.OnPlayerLeave(p, reason)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventLeave, []int64{int64(reason)})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家掉线
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerDropLine(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerDropLine, sceneId=", s.SceneId, " player=", p.SnId)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventDropLine, nil)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
if sceneEx.Gaming {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家重连
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerRehold(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerRehold, sceneId=", s.SceneId, " player=", p.Name)
|
||||||
|
//if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
// if playerEx, ok := p.ExtraData.(*TamQuocPlayerData); ok {
|
||||||
|
// //发送房间信息给自己
|
||||||
|
// TamQuocSendRoomInfo(s, p, sceneEx, playerEx)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventRehold, nil)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家重连
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerReturn(s *base.Scene, p *base.Player) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Logger.Trace("(this *ScenePolicyTamQuoc) OnPlayerReturn, sceneId=", s.SceneId, " player=", p.Name)
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
if playerEx, ok := p.ExtraData.(*TamQuocPlayerData); ok {
|
||||||
|
//发送房间信息给自己
|
||||||
|
TamQuocSendRoomInfo(s, p, sceneEx, playerEx, playerEx.billedData)
|
||||||
|
s.FirePlayerEvent(p, base.PlayerEventReturn, nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家操作
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
return s.SceneState.OnPlayerOp(s, p, opcode, params)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家事件
|
||||||
|
func (this *ScenePolicyTamQuoc) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
s.SceneState.OnPlayerEvent(s, p, evtcode, params)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否完成了整个牌局
|
||||||
|
func (this *ScenePolicyTamQuoc) IsCompleted(s *base.Scene) bool { return false }
|
||||||
|
|
||||||
|
// 是否可以强制开始
|
||||||
|
func (this *ScenePolicyTamQuoc) IsCanForceStart(s *base.Scene) bool { return true }
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *ScenePolicyTamQuoc) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
if s == nil || p == nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if s.SceneState != nil {
|
||||||
|
return s.SceneState.CanChangeCoinScene(s, p)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ScenePolicyTamQuoc) RegisteSceneState(state base.SceneState) {
|
||||||
|
if state == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
stateid := state.GetState()
|
||||||
|
if stateid < 0 || stateid >= TamQuocSceneStateMax {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.states[stateid] = state
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ScenePolicyTamQuoc) GetSceneState(s *base.Scene, stateid int) base.SceneState {
|
||||||
|
if stateid >= 0 && stateid < TamQuocSceneStateMax {
|
||||||
|
return ScenePolicyTamQuocSington.states[stateid]
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ScenePolicyTamQuoc) GetJackPotVal(s *base.Scene) int64 {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
if sceneEx.lastJackpotValue != sceneEx.jackpot.VirtualJK {
|
||||||
|
return sceneEx.jackpot.VirtualJK
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
func TamQuocSendRoomInfo(s *base.Scene, p *base.Player, sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerData, data *tamquoc.GameBilledData) {
|
||||||
|
logger.Logger.Trace("-------------------发送房间消息 ", s.RoomId, p.SnId)
|
||||||
|
pack := &tamquoc.SCTamQuocRoomInfo{
|
||||||
|
RoomId: proto.Int(s.SceneId),
|
||||||
|
Creator: proto.Int32(s.Creator),
|
||||||
|
GameId: proto.Int(s.GameId),
|
||||||
|
RoomMode: proto.Int(s.GameMode),
|
||||||
|
Params: s.Params,
|
||||||
|
State: proto.Int(s.SceneState.GetState()),
|
||||||
|
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||||
|
GameFreeId: proto.Int32(s.GetDBGameFree().GetId()),
|
||||||
|
BilledData: data,
|
||||||
|
}
|
||||||
|
if playerEx != nil {
|
||||||
|
pd := &tamquoc.TamQuocPlayerData{
|
||||||
|
SnId: proto.Int32(playerEx.SnId),
|
||||||
|
Name: proto.String(playerEx.Name),
|
||||||
|
Head: proto.Int32(playerEx.Head),
|
||||||
|
Sex: proto.Int32(playerEx.Sex),
|
||||||
|
Coin: proto.Int64(playerEx.Coin),
|
||||||
|
HeadOutLine: proto.Int32(playerEx.HeadOutLine),
|
||||||
|
VIP: proto.Int32(playerEx.VIP),
|
||||||
|
}
|
||||||
|
pack.Players = append(pack.Players, pd)
|
||||||
|
//for _, value := range playerEx.cards {
|
||||||
|
// pack.Cards = append(pack.Cards, int32(value))
|
||||||
|
//}
|
||||||
|
pack.BetLines = playerEx.betLines
|
||||||
|
pack.FreeTimes = proto.Int32(playerEx.freeTimes)
|
||||||
|
pack.Chip = proto.Int32(s.DbGameFree.BaseScore)
|
||||||
|
pack.SpinID = proto.Int64(playerEx.spinID)
|
||||||
|
if playerEx.totalPriceBonus > 0 && playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Before(time.Now()) {
|
||||||
|
playerEx.totalPriceBonus = 0
|
||||||
|
playerEx.bonusGamePickPos = make([]int32, 2)
|
||||||
|
// 取消定时器
|
||||||
|
if playerEx.bonusTimerHandle != timer.TimerHandle(0) {
|
||||||
|
timer.StopTimer(playerEx.bonusTimerHandle)
|
||||||
|
playerEx.bonusTimerHandle = timer.TimerHandle(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
pack.TotalPriceBonus = proto.Int64(playerEx.totalPriceBonus)
|
||||||
|
playerEx.bonusGamePickPos[1] = int32(playerEx.bonusGameStartTime.Add(TamQuocBonusGamePickTime).Unix() - time.Now().Unix())
|
||||||
|
pack.ParamsEx = playerEx.bonusGamePickPos
|
||||||
|
pack.BonusGame = &playerEx.bonusGame
|
||||||
|
}
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
p.SendToClient(int(tamquoc.TamQuocPacketID_PACKET_SC_TAMQUOC_ROOMINFO), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
type SceneStateTamQuocStart struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前场景状态
|
||||||
|
func (this *SceneStateTamQuocStart) GetState() int { return TamQuocSceneStateStart }
|
||||||
|
|
||||||
|
// 是否可以切换状态到
|
||||||
|
func (this *SceneStateTamQuocStart) CanChangeTo(s base.SceneState) bool { return true }
|
||||||
|
|
||||||
|
// 当前状态能否换桌
|
||||||
|
func (this *SceneStateTamQuocStart) CanChangeCoinScene(s *base.Scene, p *base.Player) bool {
|
||||||
|
if _, ok := p.ExtraData.(*TamQuocPlayerData); ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateTamQuocStart) GetTimeout(s *base.Scene) int { return 0 }
|
||||||
|
|
||||||
|
func (this *SceneStateTamQuocStart) OnEnter(s *base.Scene) {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
logger.Logger.Tracef("(this *base.Scene) [%v] 场景状态进入 %v", s.SceneId, len(sceneEx.players))
|
||||||
|
sceneEx.StateStartTime = time.Now()
|
||||||
|
pack := &tamquoc.SCTamQuocRoomState{
|
||||||
|
State: proto.Int(this.GetState()),
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
s.Broadcast(int(tamquoc.TamQuocPacketID_PACKET_SC_TAMQUOC_ROOMSTATE), pack, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateTamQuocStart) OnLeave(s *base.Scene) {}
|
||||||
|
|
||||||
|
func (this *SceneStateTamQuocStart) OnTick(s *base.Scene) {
|
||||||
|
if sceneEx, ok := s.ExtraData.(*TamQuocSceneData); ok {
|
||||||
|
sceneEx.AIAddJackPot()
|
||||||
|
sceneEx.AIBurstJackPot()
|
||||||
|
sceneEx.KickPlayerByTime()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateTamQuocStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, params []int64) bool {
|
||||||
|
playerEx, ok := p.ExtraData.(*TamQuocPlayerData)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
sceneEx, ok := s.ExtraData.(*TamQuocSceneData)
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if sceneEx.CheckNeedDestroy() && playerEx.freeTimes <= 0 {
|
||||||
|
//离开有统计
|
||||||
|
sceneEx.PlayerLeave(playerEx.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
switch opcode {
|
||||||
|
case TamQuocPlayerOpStart: //开始
|
||||||
|
|
||||||
|
//参数是否合法
|
||||||
|
//params 参数0底注,后面跟客户端选择的线n条线(1<=n<=20),客户端线是从1开始算起1~20条线
|
||||||
|
if len(params) < 2 || len(params) > rule.LINENUM+1 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
//先做底注校验
|
||||||
|
if sceneEx.DbGameFree.GetBaseScore() != int32(params[0]) {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
playerEx.score = int32(params[0]) // 单线押注数
|
||||||
|
// 小游戏未结束 不能进行下一次旋转
|
||||||
|
if playerEx.totalPriceBonus > 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
//判断线条是否重复,是否合法
|
||||||
|
lineFlag := make(map[int64]bool)
|
||||||
|
lineParams := make([]int64, 0)
|
||||||
|
for i := 1; i < len(params); i++ {
|
||||||
|
lineNum := params[i]
|
||||||
|
if lineNum >= 1 && lineNum <= int64(rule.LINENUM) && !lineFlag[lineNum] {
|
||||||
|
lineParams = append(lineParams, lineNum)
|
||||||
|
lineFlag[lineNum] = true
|
||||||
|
} else {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//没有选线参数
|
||||||
|
if len(lineParams) == 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取总投注金额(所有线的总投注) | 校验玩家余额是否足够
|
||||||
|
totalBetValue := (int64(len(lineParams))) * params[0]
|
||||||
|
if playerEx.freeTimes <= 0 && totalBetValue > playerEx.Coin {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
|
||||||
|
return false
|
||||||
|
} else if playerEx.freeTimes <= 0 && int64(sceneEx.DbGameFree.GetBetLimit()) > playerEx.Coin { //押注限制
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_CoinNotEnough, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
p.LastOPTimer = time.Now()
|
||||||
|
sceneEx.GameNowTime = time.Now()
|
||||||
|
sceneEx.NumOfGames++
|
||||||
|
p.GameTimes++
|
||||||
|
//playerEx.StartCoin = playerEx.Coin
|
||||||
|
|
||||||
|
//获取当前水池的上下文环境
|
||||||
|
sceneEx.CpCtx = base.CoinPoolMgr.GetCoinPoolCtx(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
|
||||||
|
|
||||||
|
//税收比例
|
||||||
|
taxRate := sceneEx.DbGameFree.GetTaxRate()
|
||||||
|
if taxRate < 0 || taxRate > 10000 {
|
||||||
|
logger.Logger.Tracef("TamQuocErrorTaxRate [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate)
|
||||||
|
taxRate = 500
|
||||||
|
}
|
||||||
|
//水池设置
|
||||||
|
coinPoolSetting := base.CoinPoolMgr.GetCoinPoolSetting(sceneEx.Platform, sceneEx.GetGameFreeId(), sceneEx.GroupId)
|
||||||
|
ctroRate := 500 //调节赔率 暗税系数
|
||||||
|
jackpotRate := ctroRate //奖池系数
|
||||||
|
logger.Logger.Tracef("TamQuocRates [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, taxRate, ctroRate)
|
||||||
|
|
||||||
|
playerEx.IsFNovice(sceneEx.KeyGameId)
|
||||||
|
isFoolPlayer := false
|
||||||
|
var gamePoolCoin int64
|
||||||
|
//if isFoolPlayer {
|
||||||
|
// gamePoolCoin = base.CoinPoolMgr.GetNoviceCoinPool(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||||
|
//} else {
|
||||||
|
gamePoolCoin = base.CoinPoolMgr.GetCoin(sceneEx.GetGameFreeId(), sceneEx.Platform, sceneEx.GroupId) // 当前水池金额
|
||||||
|
//}
|
||||||
|
prizeFund := gamePoolCoin - sceneEx.jackpot.VirtualJK // 除去奖池的水池剩余金额
|
||||||
|
|
||||||
|
// 奖池参数
|
||||||
|
var jackpotParam = sceneEx.DbGameFree.GetJackpot()
|
||||||
|
var jackpotInit = int64(jackpotParam[rule.TAMQUOC_JACKPOT_InitJackpot] * sceneEx.DbGameFree.GetBaseScore()) //奖池初始值
|
||||||
|
|
||||||
|
var jackpotFundAdd, prizeFundAdd int64
|
||||||
|
if playerEx.freeTimes <= 0 { //正常模式才能记录用户的押注变化,免费模式不能改变押注
|
||||||
|
playerEx.betLines = lineParams // 选线记录
|
||||||
|
jackpotFundAdd = int64(math.Floor(float64(totalBetValue) * (float64(jackpotRate) / 10000.0))) //奖池要增加的金额
|
||||||
|
prizeFundAdd = totalBetValue - jackpotFundAdd
|
||||||
|
playerEx.TotalBet += totalBetValue //总下注额(从进房间开始,包含多局游戏的下注)
|
||||||
|
//扣除投注金币
|
||||||
|
p.AddCoin(-totalBetValue, common.GainWay_HundredSceneLost, base.SyncFlag_ToClient, "system", s.GetSceneName())
|
||||||
|
//p.Statics(sceneEx.KeyGameId, sceneEx.KeyGamefreeId, -totalBetValue, true)
|
||||||
|
if !p.IsRob && !sceneEx.Testing {
|
||||||
|
// 推送金币
|
||||||
|
sceneEx.PushCoinPool(prizeFundAdd, isFoolPlayer)
|
||||||
|
//base.CoinPoolMgr.PushCoin(sceneEx.GetGameFreeId(), sceneEx.GroupId, sceneEx.Platform, int64(float64(totalBetValue)*(float64(10000-ctroRate)/10000.0)))
|
||||||
|
}
|
||||||
|
|
||||||
|
//统计参与游戏次数
|
||||||
|
//if !sceneEx.Testing && !playerEx.IsRob {
|
||||||
|
// pack := &server.GWSceneEnd{
|
||||||
|
// GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||||
|
// Players: []*server.PlayerCtx{&server.PlayerCtx{SnId: proto.Int32(playerEx.SnId), Coin: proto.Int64(playerEx.Coin)}},
|
||||||
|
// }
|
||||||
|
// proto.SetDefaults(pack)
|
||||||
|
// sceneEx.SendToWorld(int(server.SSPacketID_PACKET_GW_SCENEEND), pack)
|
||||||
|
//}
|
||||||
|
} else { //免费次数时,不能改线改选线
|
||||||
|
totalBetValue = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var symbolType rule.Symbol
|
||||||
|
if gamePoolCoin <= int64(coinPoolSetting.GetLowerLimit()) { // 水池不足
|
||||||
|
symbolType = rule.SYMBOL1
|
||||||
|
} else {
|
||||||
|
symbolType = rule.SYMBOL2
|
||||||
|
}
|
||||||
|
writeBlackTryTimes := 0
|
||||||
|
WriteBlack:
|
||||||
|
slotData := make([]int, 0)
|
||||||
|
var spinRes TamQuocSpinResult
|
||||||
|
var slotDataIsOk bool
|
||||||
|
for i := 0; i < 3; i++ {
|
||||||
|
slotData = rule.GenerateSlotsData_v2(symbolType)
|
||||||
|
//if sceneEx.DbGameFree.GetSceneType() == 1 {
|
||||||
|
// slotData = []int{1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7}
|
||||||
|
//}
|
||||||
|
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
|
||||||
|
//if sceneEx.DbGameFree.GetSceneType() == 1 {
|
||||||
|
// slotDataIsOk = true
|
||||||
|
// break
|
||||||
|
//}
|
||||||
|
if spinRes.AddFreeTimes > 0 && len(playerEx.betLines) < 15 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 免费次数时 不允许爆奖
|
||||||
|
if playerEx.freeTimes > 0 && spinRes.IsJackpot {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 水池不足以支付玩家
|
||||||
|
if spinRes.IsJackpot {
|
||||||
|
if sceneEx.jackpot.Small < sceneEx.jackpot.VirtualJK {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spinCondition := prizeFund + prizeFundAdd - (spinRes.TotalPrizeJackpot + spinRes.TotalPrizeLine + spinRes.BonusGame.GetTotalPrizeValue())
|
||||||
|
spinCondition += sceneEx.jackpot.VirtualJK - jackpotInit
|
||||||
|
win := spinRes.TotalPrizeJackpot + spinRes.TotalPrizeLine + spinRes.BonusGame.GetTotalPrizeValue()
|
||||||
|
if spinCondition < 0 && win > totalBetValue {
|
||||||
|
if !spinRes.IsJackpot {
|
||||||
|
writeBlackTryTimes = 999
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 非爆奖时 大奖限制
|
||||||
|
var limitBigWin int64
|
||||||
|
if symbolType == rule.SYMBOL1 {
|
||||||
|
limitBigWin = int64(jackpotParam[rule.TAMQUOC_JACKPOT_LIMITWIN_PRIZELOW])
|
||||||
|
} else {
|
||||||
|
limitBigWin = int64(jackpotParam[rule.TAMQUOC_JACKPOT_LIMITWIN_PRIZEHIGH])
|
||||||
|
}
|
||||||
|
if totalBetValue > 0 && !spinRes.IsJackpot && spinRes.TotalPrizeLine > totalBetValue*limitBigWin {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if spinRes.BonusGame.GetTotalPrizeValue() > 0 {
|
||||||
|
if len(playerEx.betLines) < 20 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// 小游戏最小时间间隔限制
|
||||||
|
lastBonusGameTimeInterval := time.Now().Unix() - playerEx.bonusGameTime
|
||||||
|
if symbolType == rule.SYMBOL1 && lastBonusGameTimeInterval < int64(jackpotParam[rule.TAMQUOC_JACKPOT_BonusMinTimeInterval_Low]) {
|
||||||
|
continue
|
||||||
|
} else if symbolType == rule.SYMBOL2 && lastBonusGameTimeInterval < int64(jackpotParam[rule.TAMQUOC_JACKPOT_BonusMinTimeInterval_High]) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
slotDataIsOk = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if !slotDataIsOk {
|
||||||
|
slotData = rule.GenerateSlotsData_v3(rule.DEFALUTROOMMODEL)
|
||||||
|
spinRes = sceneEx.CalcLinePrize(slotData, playerEx.betLines, params[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
// 黑白名单调控 防止异常循环,添加上限次数
|
||||||
|
if writeBlackTryTimes < 100 && playerEx.CheckBlackWriteList(spinRes.TotalPrizeLine+spinRes.TotalPrizeJackpot+spinRes.BonusGame.GetTotalPrizeValue() > totalBetValue) {
|
||||||
|
writeBlackTryTimes++
|
||||||
|
goto WriteBlack
|
||||||
|
} else if writeBlackTryTimes >= 100 && writeBlackTryTimes != 999 {
|
||||||
|
logger.Logger.Warnf("TamquocWriteBlackTryTimesOver [%v][%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, gamePoolCoin, playerEx.BlackLevel, playerEx.WhiteLevel)
|
||||||
|
}
|
||||||
|
// 奖池水池处理
|
||||||
|
|
||||||
|
if spinRes.IsJackpot {
|
||||||
|
sceneEx.jackpot.Small -= sceneEx.jackpot.VirtualJK
|
||||||
|
if sceneEx.jackpot.Small < 0 {
|
||||||
|
sceneEx.jackpot.Small = 0
|
||||||
|
}
|
||||||
|
sceneEx.jackpot.VirtualJK = jackpotInit
|
||||||
|
} else {
|
||||||
|
sceneEx.jackpot.Small += jackpotFundAdd
|
||||||
|
sceneEx.jackpot.VirtualJK += jackpotFundAdd
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家赢钱
|
||||||
|
totalWinScore := spinRes.TotalPrizeLine + spinRes.TotalPrizeJackpot
|
||||||
|
if totalWinScore > 0 || spinRes.BonusGame.GetTotalPrizeValue() > 0 {
|
||||||
|
p.AddCoin(totalWinScore+spinRes.BonusGame.GetTotalPrizeValue(), common.GainWay_HundredSceneWin, 0, "system", s.GetSceneName())
|
||||||
|
//p.Statics(sceneEx.KeyGameId, sceneEx.KeyGamefreeId, totalWinScore+spinRes.BonusGame.GetTotalPrizeValue()+spinRes.TotalTaxScore, true)
|
||||||
|
if !p.IsRob && !sceneEx.Testing {
|
||||||
|
sceneEx.PopCoinPool(totalWinScore+spinRes.BonusGame.GetTotalPrizeValue()+spinRes.TotalTaxScore, isFoolPlayer)
|
||||||
|
//base.CoinPoolMgr.PopCoin(sceneEx.GetGameFreeId(), sceneEx.GroupId, sceneEx.Platform, totalWinScore+spinRes.BonusGame.GetTotalPrizeValue()+spinRes.TotalTaxScore)
|
||||||
|
}
|
||||||
|
playerEx.taxCoin = spinRes.TotalTaxScore
|
||||||
|
playerEx.AddServiceFee(playerEx.taxCoin)
|
||||||
|
}
|
||||||
|
p.StaticsLaba(sceneEx.KeyGameId, sceneEx.KeyGamefreeId, totalBetValue, totalWinScore+spinRes.BonusGame.GetTotalPrizeValue()+spinRes.TotalTaxScore)
|
||||||
|
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Sucess, append(params[:1], playerEx.betLines...))
|
||||||
|
|
||||||
|
//免费次数
|
||||||
|
var isFreeFlag bool
|
||||||
|
if playerEx.freeTimes > 0 {
|
||||||
|
playerEx.freeTimes--
|
||||||
|
isFreeFlag = true
|
||||||
|
}
|
||||||
|
playerEx.freeTimes += spinRes.AddFreeTimes
|
||||||
|
|
||||||
|
rule.SpinID++
|
||||||
|
playerEx.spinID = rule.SpinID
|
||||||
|
playerEx.cards = spinRes.SlotsData
|
||||||
|
playerEx.winCoin = spinRes.TotalPrizeLine + spinRes.TotalPrizeJackpot + spinRes.BonusGame.GetTotalPrizeValue() + playerEx.taxCoin
|
||||||
|
playerEx.linesWinCoin = spinRes.TotalPrizeLine
|
||||||
|
playerEx.jackpotWinCoin = spinRes.TotalPrizeJackpot
|
||||||
|
playerEx.smallGameWinCoin = spinRes.BonusGame.GetTotalPrizeValue()
|
||||||
|
playerEx.CurrentBet = totalBetValue
|
||||||
|
playerEx.CurrentTax = playerEx.taxCoin
|
||||||
|
|
||||||
|
// 小游戏超时处理
|
||||||
|
if spinRes.IsBonusGame {
|
||||||
|
playerEx.totalPriceBonus = spinRes.BonusGame.GetTotalPrizeValue()
|
||||||
|
playerEx.bonusGameTime = time.Now().Unix()
|
||||||
|
logger.Logger.Tracef("BonusGame Start [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, playerEx.totalPriceBonus)
|
||||||
|
playerEx.bonusTimerHandle, _ = timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool {
|
||||||
|
this.OnPlayerOp(s, p, TamQuocBonusGame, []int64{playerEx.spinID})
|
||||||
|
return true
|
||||||
|
}), nil, TamQuocBonusGameTimeout, 1)
|
||||||
|
playerEx.bonusGameCanPickNum = len(spinRes.BonusGame.BonusData)
|
||||||
|
playerEx.bonusGame = spinRes.BonusGame
|
||||||
|
}
|
||||||
|
|
||||||
|
playerEx.billedData = &tamquoc.GameBilledData{
|
||||||
|
SpinID: proto.Int64(playerEx.spinID),
|
||||||
|
SlotsData: spinRes.SlotsData,
|
||||||
|
AddFreeSpin: proto.Int32(spinRes.AddFreeTimes),
|
||||||
|
IsJackpot: proto.Bool(spinRes.IsJackpot),
|
||||||
|
PrizeLines: spinRes.LinesInfo,
|
||||||
|
TotalPrizeValue: proto.Int64(totalWinScore),
|
||||||
|
TotalPaylinePrizeValue: proto.Int64(spinRes.TotalPrizeLine),
|
||||||
|
TotalJackpotValue: proto.Int64(spinRes.TotalPrizeJackpot),
|
||||||
|
Balance: proto.Int64(playerEx.Coin - spinRes.BonusGame.GetTotalPrizeValue()),
|
||||||
|
FreeSpins: proto.Int32(playerEx.freeTimes),
|
||||||
|
Jackpot: proto.Int64(sceneEx.jackpot.VirtualJK),
|
||||||
|
BonusGame: &spinRes.BonusGame,
|
||||||
|
}
|
||||||
|
pack := &tamquoc.SCTamQuocGameBilled{
|
||||||
|
BilledData: playerEx.billedData,
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
logger.Logger.Infof("TamQuocPlayerOpStart %v", pack)
|
||||||
|
p.SendToClient(int(tamquoc.TamQuocPacketID_PACKET_SC_TAMQUOC_GAMEBILLED), pack)
|
||||||
|
|
||||||
|
// 记录本次操作this
|
||||||
|
playerEx.RollGameType.BaseResult.WinTotal = pack.BilledData.GetTotalPrizeValue() + pack.BilledData.GetBonusGame().GetTotalPrizeValue()
|
||||||
|
playerEx.RollGameType.BaseResult.IsFree = isFreeFlag
|
||||||
|
playerEx.RollGameType.BaseResult.WinSmallGame = pack.BilledData.BonusGame.GetTotalPrizeValue()
|
||||||
|
playerEx.RollGameType.BaseResult.AllWinNum = int32(len(pack.BilledData.PrizeLines))
|
||||||
|
playerEx.RollGameType.BaseResult.WinRate = spinRes.TotalWinRate
|
||||||
|
playerEx.RollGameType.BaseResult.Cards = pack.BilledData.GetSlotsData()
|
||||||
|
playerEx.RollGameType.WinLines = spinRes.WinLines
|
||||||
|
playerEx.RollGameType.BaseResult.WinJackpot = pack.BilledData.GetTotalJackpotValue()
|
||||||
|
playerEx.RollGameType.BaseResult.WinLineScore = pack.BilledData.TotalPaylinePrizeValue
|
||||||
|
playerEx.RollGameType.BaseResult.IsFoolPlayer = isFoolPlayer
|
||||||
|
TamQuocCheckAndSaveLog(sceneEx, playerEx)
|
||||||
|
|
||||||
|
// 广播奖池
|
||||||
|
if totalBetValue == 0 && !spinRes.IsJackpot { // 没改变奖池
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// 添加进开奖记录里面
|
||||||
|
if spinRes.IsJackpot {
|
||||||
|
sceneEx.RecordBurstLog(playerEx.Name, pack.BilledData.GetTotalJackpotValue(), playerEx.CurrentBet)
|
||||||
|
}
|
||||||
|
logger.Logger.Tracef("---tamquoc---当前奖池:真人[%v] 虚拟[%v]", sceneEx.jackpot.Small, sceneEx.jackpot.VirtualJK)
|
||||||
|
case TamQuocBurstHistory:
|
||||||
|
sceneEx.BurstHistory(playerEx)
|
||||||
|
case TamQuocPlayerHistory:
|
||||||
|
task.New(nil, task.CallableWrapper(func(o *basic.Object) interface{} {
|
||||||
|
spinid := strconv.FormatInt(int64(playerEx.SnId), 10)
|
||||||
|
gpl := model.GetPlayerListByHallEx(p.SnId, p.Platform, 0, 80, 0, 0, 0, s.DbGameFree.GetGameClass(), s.GameId)
|
||||||
|
pack := &tamquoc.SCTamQuocPlayerHistory{}
|
||||||
|
for _, v := range gpl.Data {
|
||||||
|
//if v.GameDetailedLogId == "" {
|
||||||
|
// logger.Logger.Error("TamQuocPlayerHistory GameDetailedLogId is nil")
|
||||||
|
// break
|
||||||
|
//}
|
||||||
|
//gdl := model.GetPlayerHistory(p.Platform, v.GameDetailedLogId)
|
||||||
|
//if gdl == nil {
|
||||||
|
// logger.Logger.Error("TamQuocPlayerHistory gdl is nil")
|
||||||
|
// continue
|
||||||
|
//}
|
||||||
|
//data, err := UnMarshalTamQuocGameNote(gdl.GameDetailedNote)
|
||||||
|
//if err != nil {
|
||||||
|
// logger.Logger.Errorf("UnMarshalTamQuoccGameNote error:%v", err)
|
||||||
|
//}
|
||||||
|
//gnd := data.(*GameResultLog)
|
||||||
|
player := &tamquoc.TamQuocPlayerHistoryInfo{
|
||||||
|
SpinID: proto.String(spinid),
|
||||||
|
CreatedTime: proto.Int64(int64(v.Ts)),
|
||||||
|
TotalBetValue: proto.Int64(v.BetAmount),
|
||||||
|
TotalPriceValue: proto.Int64(v.WinTotal),
|
||||||
|
IsFree: proto.Bool(v.IsFree),
|
||||||
|
TotalBonusValue: proto.Int64(v.WinSmallGame),
|
||||||
|
}
|
||||||
|
pack.PlayerHistory = append(pack.PlayerHistory, player)
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
logger.Logger.Info("TamQuocPlayerHistory: ", pack)
|
||||||
|
return pack
|
||||||
|
|
||||||
|
}), task.CompleteNotifyWrapper(func(data interface{}, t task.Task) {
|
||||||
|
if data == nil {
|
||||||
|
logger.Logger.Error("TamQuocPlayerHistory data is nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
p.SendToClient(int(tamquoc.TamQuocPacketID_PACKET_SC_TAMQUOC_PLAYERHISTORY), data)
|
||||||
|
}), "CSGetTamQuocPlayerHistoryHandler").Start()
|
||||||
|
case TamQuocBonusGame:
|
||||||
|
//params 参数0 spinID
|
||||||
|
//参数是否合法
|
||||||
|
if len(params) < 1 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if playerEx.spinID != params[0] || playerEx.totalPriceBonus <= 0 {
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if playerEx.bonusTimerHandle != timer.TimerHandle(0) {
|
||||||
|
timer.StopTimer(playerEx.bonusTimerHandle)
|
||||||
|
playerEx.bonusTimerHandle = timer.TimerHandle(0)
|
||||||
|
}
|
||||||
|
logger.Logger.Tracef("BonusGame Start [%v][%v][%v][%v]", sceneEx.GetGameFreeId(), playerEx.SnId, playerEx.spinID, playerEx.totalPriceBonus)
|
||||||
|
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Sucess, []int64{playerEx.totalPriceBonus, playerEx.Coin})
|
||||||
|
playerEx.totalPriceBonus = 0
|
||||||
|
playerEx.bonusGamePickPos = make([]int32, 2)
|
||||||
|
case TamQuocBonusGameRecord:
|
||||||
|
// params
|
||||||
|
// 参数下标0 0表示进小游戏 1表示选图标界面
|
||||||
|
// 参数下标1 玩家当前点击位置
|
||||||
|
if (len(params) == 1 && params[0] != 0) ||
|
||||||
|
(len(params) == 2 && (params[0] != 1 || params[1] < 1 || params[1] > 24)) {
|
||||||
|
logger.Logger.Errorf("Invalid parameter")
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
switch params[0] {
|
||||||
|
case 0:
|
||||||
|
if playerEx.bonusGamePickPos[0] < 1 {
|
||||||
|
// 记录进入小游戏时间
|
||||||
|
playerEx.bonusGameStartTime = time.Now()
|
||||||
|
playerEx.bonusGamePickPos[0] = 1
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
if len(playerEx.bonusGamePickPos) > playerEx.bonusGameCanPickNum {
|
||||||
|
logger.Logger.Errorf("too many pickPos")
|
||||||
|
this.OnPlayerSToCOp(s, p, playerEx.Pos, opcode, tamquoc.OpResultCode_OPRC_Error, params)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
playerEx.bonusGamePickPos = append(playerEx.bonusGamePickPos, int32(params[1]))
|
||||||
|
default:
|
||||||
|
logger.Logger.Errorf("Invalid parameter, params[0]")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *SceneStateTamQuocStart) OnPlayerEvent(s *base.Scene, p *base.Player, evtcode int, params []int64) {
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送玩家操作情况
|
||||||
|
func (this *SceneStateTamQuocStart) OnPlayerSToCOp(s *base.Scene, p *base.Player, pos int, opcode int,
|
||||||
|
opRetCode tamquoc.OpResultCode, params []int64) {
|
||||||
|
pack := &tamquoc.SCTamQuocOp{
|
||||||
|
SnId: proto.Int32(p.SnId),
|
||||||
|
OpCode: proto.Int(opcode),
|
||||||
|
OpRetCode: opRetCode,
|
||||||
|
Params: params,
|
||||||
|
}
|
||||||
|
proto.SetDefaults(pack)
|
||||||
|
p.SendToClient(int(tamquoc.TamQuocPacketID_PACKET_SC_TAMQUOC_PLAYEROP), pack)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TamQuocCheckAndSaveLog(sceneEx *TamQuocSceneData, playerEx *TamQuocPlayerData) {
|
||||||
|
//统计金币变动
|
||||||
|
//log1
|
||||||
|
logger.Logger.Trace("TamQuocCheckAndSaveLog Save ", playerEx.SnId)
|
||||||
|
//changeCoin := playerEx.Coin - playerEx.StartCoin
|
||||||
|
changeCoin := playerEx.winCoin - playerEx.taxCoin - playerEx.CurrentBet
|
||||||
|
startCoin := playerEx.Coin - changeCoin
|
||||||
|
playerEx.SaveSceneCoinLog(startCoin, changeCoin,
|
||||||
|
playerEx.Coin, playerEx.CurrentBet, playerEx.taxCoin, playerEx.winCoin, playerEx.jackpotWinCoin, playerEx.smallGameWinCoin)
|
||||||
|
|
||||||
|
//log2
|
||||||
|
playerEx.RollGameType.BaseResult.ChangeCoin = changeCoin
|
||||||
|
playerEx.RollGameType.BaseResult.BasicBet = sceneEx.DbGameFree.GetBaseScore()
|
||||||
|
playerEx.RollGameType.BaseResult.RoomId = int32(sceneEx.SceneId)
|
||||||
|
playerEx.RollGameType.BaseResult.AfterCoin = playerEx.Coin
|
||||||
|
playerEx.RollGameType.BaseResult.BeforeCoin = startCoin
|
||||||
|
playerEx.RollGameType.BaseResult.IsFirst = sceneEx.IsPlayerFirst(playerEx.Player)
|
||||||
|
playerEx.RollGameType.BaseResult.PlayerSnid = playerEx.SnId
|
||||||
|
playerEx.RollGameType.BaseResult.TotalBet = int32(playerEx.CurrentBet)
|
||||||
|
playerEx.RollGameType.AllLine = int32(len(playerEx.betLines))
|
||||||
|
playerEx.RollGameType.BaseResult.FreeTimes = playerEx.freeTimes
|
||||||
|
playerEx.RollGameType.UserName = playerEx.Name
|
||||||
|
playerEx.RollGameType.BetLines = playerEx.betLines
|
||||||
|
playerEx.RollGameType.BaseResult.Tax = playerEx.taxCoin
|
||||||
|
playerEx.RollGameType.BaseResult.WBLevel = sceneEx.players[playerEx.SnId].WBLevel
|
||||||
|
if playerEx.score > 0 {
|
||||||
|
if !playerEx.IsRob {
|
||||||
|
info, err := model.MarshalGameNoteByROLL(playerEx.RollGameType)
|
||||||
|
if err == nil {
|
||||||
|
logid, _ := model.AutoIncGameLogId()
|
||||||
|
playerEx.currentLogId = logid
|
||||||
|
sceneEx.SaveGameDetailedLog(logid, info, &base.GameDetailedParam{})
|
||||||
|
totalin := int64(playerEx.RollGameType.BaseResult.TotalBet)
|
||||||
|
totalout := playerEx.RollGameType.BaseResult.ChangeCoin + playerEx.taxCoin + totalin
|
||||||
|
validFlow := totalin + totalout
|
||||||
|
validBet := common.AbsI64(totalin - totalout)
|
||||||
|
logParam := &base.SaveGamePlayerListLogParam{
|
||||||
|
Platform: playerEx.Platform,
|
||||||
|
Channel: playerEx.Channel,
|
||||||
|
Promoter: playerEx.BeUnderAgentCode,
|
||||||
|
PackageTag: playerEx.PackageID,
|
||||||
|
InviterId: playerEx.InviterId,
|
||||||
|
LogId: logid,
|
||||||
|
TotalIn: totalin,
|
||||||
|
TotalOut: totalout,
|
||||||
|
TaxCoin: playerEx.taxCoin,
|
||||||
|
BetAmount: int64(playerEx.RollGameType.BaseResult.TotalBet),
|
||||||
|
WinAmountNoAnyTax: playerEx.RollGameType.BaseResult.ChangeCoin,
|
||||||
|
ValidBet: validBet,
|
||||||
|
ValidFlow: validFlow,
|
||||||
|
IsFirstGame: sceneEx.IsPlayerFirst(playerEx.Player),
|
||||||
|
IsFree: playerEx.RollGameType.BaseResult.IsFree,
|
||||||
|
WinSmallGame: playerEx.RollGameType.BaseResult.WinSmallGame,
|
||||||
|
WinTotal: playerEx.RollGameType.BaseResult.WinTotal,
|
||||||
|
}
|
||||||
|
sceneEx.SaveGamePlayerListLog(playerEx.SnId, logParam)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//统计输下注金币数
|
||||||
|
if !sceneEx.Testing && !playerEx.IsRob {
|
||||||
|
playerBet := &server.PlayerData{
|
||||||
|
SnId: proto.Int32(playerEx.SnId),
|
||||||
|
Bet: proto.Int64(playerEx.CurrentBet),
|
||||||
|
Gain: proto.Int64(playerEx.RollGameType.BaseResult.ChangeCoin),
|
||||||
|
Tax: proto.Int64(playerEx.taxCoin),
|
||||||
|
Coin: proto.Int64(playerEx.GetCoin()),
|
||||||
|
GameCoinTs: proto.Int64(playerEx.GameCoinTs),
|
||||||
|
}
|
||||||
|
gwPlayerBet := &server.GWPlayerData{
|
||||||
|
SceneId: proto.Int(sceneEx.SceneId),
|
||||||
|
GameFreeId: proto.Int32(sceneEx.DbGameFree.GetId()),
|
||||||
|
}
|
||||||
|
gwPlayerBet.Datas = append(gwPlayerBet.Datas, playerBet)
|
||||||
|
sceneEx.SyncPlayerDatas(&base.PlayerDataParam{
|
||||||
|
HasRobotGaming: false,
|
||||||
|
Data: gwPlayerBet,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
playerEx.taxCoin = 0
|
||||||
|
playerEx.winCoin = 0
|
||||||
|
playerEx.linesWinCoin = 0
|
||||||
|
playerEx.jackpotWinCoin = 0
|
||||||
|
playerEx.smallGameWinCoin = 0
|
||||||
|
|
||||||
|
if sceneEx.CheckNeedDestroy() && playerEx.freeTimes <= 0 {
|
||||||
|
sceneEx.PlayerLeave(playerEx.Player, common.PlayerLeaveReason_OnDestroy, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
ScenePolicyTamQuocSington.RegisteSceneState(&SceneStateTamQuocStart{})
|
||||||
|
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
|
||||||
|
base.RegisteScenePolicy(common.GameId_TamQuoc, 0, ScenePolicyTamQuocSington)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -1184,7 +1184,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameConfig := base.PlatformConfigSingleton.Get(this.Platform).GameConfig
|
gameConfig := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig
|
||||||
|
|
||||||
// testPokers 用于测试
|
// testPokers 用于测试
|
||||||
isTestPoker := false
|
isTestPoker := false
|
||||||
|
|
@ -1228,7 +1228,7 @@ func (this *TienLenSceneData) SendHandCardOdds() {
|
||||||
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
logger.Logger.Tracef("TienLen SendHandCardOdds Good:%v G:%v Bad:%v B:%v", isGood, G, isBad, B)
|
||||||
|
|
||||||
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
if isBad && !isTestPoker && len(robotPlayers) > 0 && !noviceCtrl && !noviceTianHu {
|
||||||
gf := base.PlatformConfigSingleton.Get(this.Platform).GameConfig
|
gf := base.ConfigMgrInst.GetConfig(this.Platform).GameConfig
|
||||||
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
items := []int32{gf.GetTianHu(), gf.GetPaiKu(), gf.GetFenCha()}
|
||||||
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
score := this.RandInt(int(gf.GetTianHu() + gf.GetPaiKu() + gf.GetFenCha()))
|
||||||
sum := int32(0)
|
sum := int32(0)
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ func TienLenCreatePlayerData(p *base.Player, rankScore int64) *tienlen.TienLenPl
|
||||||
if p.Items != nil {
|
if p.Items != nil {
|
||||||
pd.Items = make(map[int32]int32)
|
pd.Items = make(map[int32]int32)
|
||||||
for id, num := range p.Items {
|
for id, num := range p.Items {
|
||||||
pd.Items[id] = proto.Int32(num)
|
pd.Items[id] = int32(num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(p.MatchParams) > 0 {
|
if len(p.MatchParams) > 0 {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ go build
|
||||||
xlsx2proto.exe
|
xlsx2proto.exe
|
||||||
|
|
||||||
cd ../../protocol/server
|
cd ../../protocol/server
|
||||||
%protoc% --plugin=protoc-gen-go=%protoc-gen-go-plugin-path% --go_out=. pbdata.proto
|
%protoc% --proto_path=%GOPATH%\src --proto_path=. --plugin=protoc-gen-go=%protoc-gen-go-plugin-path% --go_out=%GOPATH%\src pbdata.proto
|
||||||
|
|
||||||
cd ../../tools/xlsx2binary
|
cd ../../tools/xlsx2binary
|
||||||
go build
|
go build
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,11 @@ set protoc-gen-go-plugin-path="%work_path%\bin\protoc-gen-go.exe"
|
||||||
echo %protoc3%
|
echo %protoc3%
|
||||||
cd %proto_path%
|
cd %proto_path%
|
||||||
for /d %%s in (,*) do (
|
for /d %%s in (,*) do (
|
||||||
if %%s NEQ webapi (
|
|
||||||
cd %%s
|
cd %%s
|
||||||
for %%b in (,*.proto) do (
|
for %%b in (,*.proto) do (
|
||||||
echo %%b
|
echo %%b
|
||||||
%protoc% --plugin=protoc-gen-go=%protoc-gen-go-plugin-path% --go_out=. %%b
|
%protoc% --proto_path=%GOPATH%\src --proto_path=. --plugin=protoc-gen-go=%protoc-gen-go-plugin-path% --go_out=%GOPATH%\src %%b
|
||||||
)
|
)
|
||||||
cd ..
|
cd ..
|
||||||
)
|
|
||||||
)
|
)
|
||||||
pause
|
pause
|
||||||
21
gen_web.bat
21
gen_web.bat
|
|
@ -1,21 +0,0 @@
|
||||||
|
|
||||||
copy
|
|
||||||
@echo off
|
|
||||||
set work_path=%cd%
|
|
||||||
set proto_path=%work_path%\protocol
|
|
||||||
set protoc=%work_path%\bin\protoc-3.19.4-win64\bin\protoc.exe
|
|
||||||
set protoc-gen-go-plugin-path="%work_path%\bin\protoc-gen-go.exe"
|
|
||||||
|
|
||||||
echo %protoc3%
|
|
||||||
cd %proto_path%
|
|
||||||
for /d %%s in (,*) do (
|
|
||||||
rem if %%s NEQ webapi (
|
|
||||||
cd %%s
|
|
||||||
for %%b in (,*.proto) do (
|
|
||||||
echo %%b
|
|
||||||
%protoc% --plugin=protoc-gen-go=%protoc-gen-go-plugin-path% --go_out=. %%b
|
|
||||||
)
|
|
||||||
cd ..
|
|
||||||
rem )
|
|
||||||
)
|
|
||||||
pause
|
|
||||||
|
|
@ -0,0 +1,194 @@
|
||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mongo.games.com/game/protocol/shop"
|
||||||
|
"mongo.games.com/game/protocol/webapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
通用模型定义在这里,如果需要自定义可以内嵌在新结构体中
|
||||||
|
*/
|
||||||
|
|
||||||
|
const (
|
||||||
|
OpAll = 0
|
||||||
|
OpTurnplate = 1
|
||||||
|
OpBlindBox = 2
|
||||||
|
OpFirstPay = 3
|
||||||
|
OpContinuousPay = 4
|
||||||
|
OpPhoneLottery = 5
|
||||||
|
OpCollect = 6
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
WelfareNil = 0 // 不处理
|
||||||
|
WelfareOpen = 1 // 开启
|
||||||
|
WelfareClose = 2 // 关闭
|
||||||
|
)
|
||||||
|
|
||||||
|
type ShopInfo struct {
|
||||||
|
Id int32 // 商品ID
|
||||||
|
Page int32 // 页面 1,金币页面 2,钻石页面 3,道具页面
|
||||||
|
Order int32 // 排序 页面内商品的位置排序
|
||||||
|
Location []int32 // 显示位置 第1位,竖版大厅 第2位,Tienlen1级选场 第3位,捕鱼1级选场
|
||||||
|
Picture string // 图片id
|
||||||
|
Name string // 名称
|
||||||
|
Label []int32 // 标签
|
||||||
|
Ad int32 // 是否观看广告 0不看
|
||||||
|
AdTime int32 // 观看几次广告
|
||||||
|
RepeatTimes int32 // 领取次数
|
||||||
|
CoolingTime []int32 // 观看冷却时间
|
||||||
|
Type int32 // 获得类型 1,金币 2,钻石 3,道具类型
|
||||||
|
Amount int64 // 获得数量
|
||||||
|
AddArea []int32 // 加送百分比(比如加送10%,就配置110)
|
||||||
|
ItemId int32 // 获得道具ID
|
||||||
|
AddItemInfo []*shop.ItemInfo // 获得道具
|
||||||
|
ConstType int32 // 购买消耗类型 1,金币 2,钻石 3,美金 4,柬埔寨币
|
||||||
|
CostArea []int32 // 消耗数量区间
|
||||||
|
VipLevel int32 //Vip等级限制
|
||||||
|
Ratio int32 //权重
|
||||||
|
EndTime int32 //新手礼包结束时间间隔
|
||||||
|
//缓存数据
|
||||||
|
AdLookedNum int32 //已经观看的次数
|
||||||
|
AdReceiveNum int32 //已经领取的次数
|
||||||
|
RemainingTime int32
|
||||||
|
LastLookTime int32
|
||||||
|
RoleAdded int32
|
||||||
|
PetAdded int32
|
||||||
|
RoleAddedId int32 //加成人物ID
|
||||||
|
PetAddedId int32 //加成宠物ID
|
||||||
|
FirstSwitch bool // 首冲翻倍
|
||||||
|
AmountFinal int64 // 实际获得数量
|
||||||
|
}
|
||||||
|
|
||||||
|
type AllConfig struct {
|
||||||
|
// 平台配置
|
||||||
|
Platform *webapi.Platform
|
||||||
|
// 客户端游戏入口开关
|
||||||
|
EntrySwitch *webapi.EntrySwitch
|
||||||
|
// 公告
|
||||||
|
CommonNotices *webapi.CommonNoticeList
|
||||||
|
// 七日签到
|
||||||
|
*webapi.Welfare7SignDateList
|
||||||
|
// 转盘
|
||||||
|
*webapi.WelfareTurnplateDateList
|
||||||
|
// 盲盒
|
||||||
|
*webapi.WelfareBlindBoxDataList
|
||||||
|
BlindBoxCycle int32
|
||||||
|
// 首充
|
||||||
|
*webapi.WelfareFirstPayDataList
|
||||||
|
FirstPayCycle int32
|
||||||
|
// 连续充值
|
||||||
|
*webapi.WelfareContinuousPayDataList
|
||||||
|
ContinuousPayCycle int32
|
||||||
|
// 积分换手机
|
||||||
|
*webapi.WelfarePhoneLotteryStatus
|
||||||
|
// 集卡活动
|
||||||
|
*webapi.WelfareCollectConfig
|
||||||
|
// 个人水池
|
||||||
|
*webapi.PlayerPool
|
||||||
|
// 游戏调控全局配置
|
||||||
|
*webapi.GameConfig
|
||||||
|
// 兑换商品
|
||||||
|
*webapi.ExchangeShopList
|
||||||
|
// 商店
|
||||||
|
ShopInfos map[int32]*ShopInfo // 商品id:商品信息
|
||||||
|
}
|
||||||
|
|
||||||
|
type GlobalConfig struct {
|
||||||
|
// 包对应的平台,包标识
|
||||||
|
PackageList map[string]*webapi.AppInfo
|
||||||
|
// 超管平台游戏开关,游戏id
|
||||||
|
GameStatus map[int32]bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConfigMgr struct {
|
||||||
|
platform map[string]*AllConfig
|
||||||
|
global *GlobalConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewConfigMgr() *ConfigMgr {
|
||||||
|
return &ConfigMgr{
|
||||||
|
platform: make(map[string]*AllConfig),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cm *ConfigMgr) GetConfig(platform string) *AllConfig {
|
||||||
|
c, ok := cm.platform[platform]
|
||||||
|
if !ok {
|
||||||
|
c = &AllConfig{
|
||||||
|
// todo 初始化默认值
|
||||||
|
ShopInfos: make(map[int32]*ShopInfo),
|
||||||
|
}
|
||||||
|
cm.platform[platform] = c
|
||||||
|
}
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cm *ConfigMgr) GetGlobalConfig() *GlobalConfig {
|
||||||
|
if cm.global == nil {
|
||||||
|
cm.global = &GlobalConfig{
|
||||||
|
// todo 初始化默认值
|
||||||
|
PackageList: make(map[string]*webapi.AppInfo),
|
||||||
|
GameStatus: make(map[int32]bool),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cm.global
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cm *ConfigMgr) GetConfigs() map[string]*AllConfig {
|
||||||
|
return cm.platform
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpdateItemShop 更新商品信息
|
||||||
|
func (cm *ConfigMgr) UpdateItemShop(list *webapi.ItemShopList) {
|
||||||
|
if list == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
shopInfos := make(map[int32]*ShopInfo)
|
||||||
|
for _, itemShop := range list.List {
|
||||||
|
var itemInfo []*shop.ItemInfo
|
||||||
|
for key, value := range itemShop.Award {
|
||||||
|
itemInfo = append(itemInfo, &shop.ItemInfo{
|
||||||
|
ItemId: int32(key),
|
||||||
|
ItemNum: value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
shopInfos[itemShop.Id] = &ShopInfo{
|
||||||
|
Id: itemShop.Id,
|
||||||
|
ItemId: itemShop.ItemId,
|
||||||
|
Page: itemShop.Page,
|
||||||
|
Order: itemShop.Order,
|
||||||
|
Type: itemShop.Type,
|
||||||
|
Location: itemShop.Location,
|
||||||
|
Picture: itemShop.Picture,
|
||||||
|
Name: itemShop.Name,
|
||||||
|
Ad: itemShop.Ad,
|
||||||
|
AdTime: itemShop.AdTime,
|
||||||
|
RepeatTimes: itemShop.RepeatTimes,
|
||||||
|
CoolingTime: itemShop.CoolingTime,
|
||||||
|
Label: itemShop.Label,
|
||||||
|
AddArea: itemShop.AddArea,
|
||||||
|
Amount: int64(itemShop.Amount),
|
||||||
|
ConstType: itemShop.ConstType,
|
||||||
|
CostArea: itemShop.CostArea,
|
||||||
|
AddItemInfo: itemInfo,
|
||||||
|
VipLevel: itemShop.VipLevel,
|
||||||
|
Ratio: itemShop.Ratio,
|
||||||
|
EndTime: itemShop.EndTime,
|
||||||
|
FirstSwitch: itemShop.FirstSwitch,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cm.GetConfig(list.Platform).ShopInfos = shopInfos
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetShopInfo 获取商品信息
|
||||||
|
func (cm *ConfigMgr) GetShopInfo(plt string, shopId int32) *ShopInfo {
|
||||||
|
if shops := cm.GetConfig(plt).ShopInfos; shops != nil {
|
||||||
|
if info, ok1 := shops[shopId]; ok1 {
|
||||||
|
return info
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
@ -642,8 +642,10 @@ var file_actbonus_proto_rawDesc = []byte{
|
||||||
0x70, 0x42, 0x6f, 0x6e, 0x75, 0x73, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0xac, 0x14, 0x12,
|
0x70, 0x42, 0x6f, 0x6e, 0x75, 0x73, 0x5f, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0xac, 0x14, 0x12,
|
||||||
0x27, 0x0a, 0x22, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x4e, 0x6f, 0x74,
|
0x27, 0x0a, 0x22, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x4e, 0x6f, 0x74,
|
||||||
0x69, 0x66, 0x79, 0x5f, 0x56, 0x69, 0x70, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6e, 0x75, 0x73, 0x5f,
|
0x69, 0x66, 0x79, 0x5f, 0x56, 0x69, 0x70, 0x47, 0x65, 0x74, 0x42, 0x6f, 0x6e, 0x75, 0x73, 0x5f,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0xad, 0x14, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x61, 0x63,
|
0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0xad, 0x14, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67,
|
||||||
0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65,
|
||||||
|
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69,
|
||||||
|
0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package activity;
|
package activity;
|
||||||
option go_package = ".;activity";
|
option go_package = "mongo.games.com/game/protocol/activity";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -884,8 +884,10 @@ var file_actcard_proto_rawDesc = []byte{
|
||||||
0x5f, 0x43, 0x41, 0x52, 0x44, 0x5f, 0x42, 0x55, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45,
|
0x5f, 0x43, 0x41, 0x52, 0x44, 0x5f, 0x42, 0x55, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45,
|
||||||
0x10, 0xb8, 0x14, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
|
0x10, 0xb8, 0x14, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43,
|
||||||
0x5f, 0x43, 0x41, 0x52, 0x44, 0x5f, 0x42, 0x55, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45,
|
0x5f, 0x43, 0x41, 0x52, 0x44, 0x5f, 0x42, 0x55, 0x59, 0x5f, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45,
|
||||||
0x10, 0xb9, 0x14, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74,
|
0x10, 0xb9, 0x14, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d,
|
||||||
0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package activity;
|
package activity;
|
||||||
option go_package = ".;activity";
|
option go_package = "mongo.games.com/game/protocol/activity";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode_ActCard {
|
enum OpResultCode_ActCard {
|
||||||
|
|
|
||||||
|
|
@ -819,8 +819,10 @@ var file_actfpay_proto_rawDesc = []byte{
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x46, 0x50, 0x61, 0x79, 0x5f, 0x53, 0x69,
|
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x46, 0x50, 0x61, 0x79, 0x5f, 0x53, 0x69,
|
||||||
0x67, 0x6e, 0x10, 0xc2, 0x14, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
0x67, 0x6e, 0x10, 0xc2, 0x14, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
||||||
0x53, 0x43, 0x5f, 0x46, 0x50, 0x61, 0x79, 0x5f, 0x53, 0x69, 0x67, 0x6e, 0x10, 0xc3, 0x14, 0x42,
|
0x53, 0x43, 0x5f, 0x46, 0x50, 0x61, 0x79, 0x5f, 0x53, 0x69, 0x67, 0x6e, 0x10, 0xc3, 0x14, 0x42,
|
||||||
0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70,
|
0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
|
||||||
|
0x2f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package activity;
|
package activity;
|
||||||
option go_package = ".;activity";
|
option go_package = "mongo.games.com/game/protocol/activity";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode_ActFPay {
|
enum OpResultCode_ActFPay {
|
||||||
|
|
|
||||||
|
|
@ -1095,9 +1095,10 @@ var file_actgold_proto_rawDesc = []byte{
|
||||||
0x14, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47,
|
0x14, 0x12, 0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x5f, 0x47,
|
||||||
0x4f, 0x4c, 0x44, 0x43, 0x4f, 0x4d, 0x45, 0x5f, 0x52, 0x41, 0x4e, 0x4b, 0x10, 0xce, 0x14, 0x12,
|
0x4f, 0x4c, 0x44, 0x43, 0x4f, 0x4d, 0x45, 0x5f, 0x52, 0x41, 0x4e, 0x4b, 0x10, 0xce, 0x14, 0x12,
|
||||||
0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x47, 0x4f, 0x4c,
|
0x1c, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x47, 0x4f, 0x4c,
|
||||||
0x44, 0x43, 0x4f, 0x4d, 0x45, 0x5f, 0x52, 0x41, 0x4e, 0x4b, 0x10, 0xcf, 0x14, 0x42, 0x0c, 0x5a,
|
0x44, 0x43, 0x4f, 0x4d, 0x45, 0x5f, 0x52, 0x41, 0x4e, 0x4b, 0x10, 0xcf, 0x14, 0x42, 0x28, 0x5a,
|
||||||
0x0a, 0x2e, 0x3b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d,
|
||||||
0x74, 0x6f, 0x33,
|
0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61,
|
||||||
|
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package activity;
|
package activity;
|
||||||
option go_package = ".;activity";
|
option go_package = "mongo.games.com/game/protocol/activity";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode_ActGold {
|
enum OpResultCode_ActGold {
|
||||||
|
|
|
||||||
|
|
@ -954,8 +954,10 @@ var file_actluckyturntable_proto_rawDesc = []byte{
|
||||||
0x47, 0x52, 0x41, 0x4e, 0x44, 0x50, 0x52, 0x49, 0x5a, 0x45, 0x10, 0xdf, 0x14, 0x12, 0x2a, 0x0a,
|
0x47, 0x52, 0x41, 0x4e, 0x44, 0x50, 0x52, 0x49, 0x5a, 0x45, 0x10, 0xdf, 0x14, 0x12, 0x2a, 0x0a,
|
||||||
0x25, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x4c, 0x55, 0x43, 0x4b, 0x59,
|
0x25, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x4c, 0x55, 0x43, 0x4b, 0x59,
|
||||||
0x54, 0x55, 0x52, 0x4e, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x4d, 0x4f, 0x44, 0x49, 0x46, 0x59,
|
0x54, 0x55, 0x52, 0x4e, 0x54, 0x41, 0x42, 0x4c, 0x45, 0x5f, 0x4d, 0x4f, 0x44, 0x49, 0x46, 0x59,
|
||||||
0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0xe0, 0x14, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x61,
|
0x43, 0x4f, 0x4e, 0x46, 0x49, 0x47, 0x10, 0xe0, 0x14, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e,
|
||||||
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d,
|
||||||
|
0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x76,
|
||||||
|
0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package activity;
|
package activity;
|
||||||
option go_package = ".;activity";
|
option go_package = "mongo.games.com/game/protocol/activity";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode_ActLuckTurn {
|
enum OpResultCode_ActLuckTurn {
|
||||||
|
|
|
||||||
|
|
@ -400,8 +400,10 @@ var file_actsign_proto_rawDesc = []byte{
|
||||||
0x67, 0x6e, 0x10, 0xe7, 0x14, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
0x67, 0x6e, 0x10, 0xe7, 0x14, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f,
|
||||||
0x43, 0x53, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x10, 0xe8, 0x14, 0x12, 0x16, 0x0a,
|
0x43, 0x53, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x61, 0x74, 0x61, 0x10, 0xe8, 0x14, 0x12, 0x16, 0x0a,
|
||||||
0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x61,
|
0x11, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x53, 0x69, 0x67, 0x6e, 0x44, 0x61,
|
||||||
0x74, 0x61, 0x10, 0xe9, 0x14, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x61, 0x63, 0x74, 0x69, 0x76,
|
0x74, 0x61, 0x10, 0xe9, 0x14, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67,
|
||||||
0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package activity;
|
package activity;
|
||||||
option go_package = ".;activity";
|
option go_package = "mongo.games.com/game/protocol/activity";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode_ActSign {
|
enum OpResultCode_ActSign {
|
||||||
|
|
|
||||||
|
|
@ -1388,9 +1388,10 @@ var file_avengers_proto_rawDesc = []byte{
|
||||||
0x41, 0x56, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x53, 0x5f, 0x42, 0x55, 0x52, 0x53, 0x54, 0x48, 0x49,
|
0x41, 0x56, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x53, 0x5f, 0x42, 0x55, 0x52, 0x53, 0x54, 0x48, 0x49,
|
||||||
0x53, 0x54, 0x4f, 0x52, 0x59, 0x10, 0xc2, 0x28, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43, 0x4b,
|
0x53, 0x54, 0x4f, 0x52, 0x59, 0x10, 0xc2, 0x28, 0x12, 0x23, 0x0a, 0x1e, 0x50, 0x41, 0x43, 0x4b,
|
||||||
0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x41, 0x56, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x53, 0x5f, 0x47,
|
0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x41, 0x56, 0x45, 0x4e, 0x47, 0x45, 0x52, 0x53, 0x5f, 0x47,
|
||||||
0x41, 0x4d, 0x45, 0x4a, 0x41, 0x43, 0x4b, 0x50, 0x4f, 0x54, 0x10, 0xc3, 0x28, 0x42, 0x0c, 0x5a,
|
0x41, 0x4d, 0x45, 0x4a, 0x41, 0x43, 0x4b, 0x50, 0x4f, 0x54, 0x10, 0xc3, 0x28, 0x42, 0x28, 0x5a,
|
||||||
0x0a, 0x2e, 0x3b, 0x61, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d,
|
||||||
0x74, 0x6f, 0x33,
|
0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x61,
|
||||||
|
0x76, 0x65, 0x6e, 0x67, 0x65, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package avengers;
|
package avengers;
|
||||||
option go_package = ".;avengers";
|
option go_package = "mongo.games.com/game/protocol/avengers";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -1588,8 +1588,10 @@ var file_baccarat_proto_rawDesc = []byte{
|
||||||
0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x42, 0x65, 0x74, 0x10, 0xe2, 0x36, 0x12, 0x23, 0x0a, 0x1e,
|
0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x42, 0x65, 0x74, 0x10, 0xe2, 0x36, 0x12, 0x23, 0x0a, 0x1e,
|
||||||
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x42, 0x61, 0x63, 0x63, 0x61, 0x72, 0x61, 0x74, 0x5f, 0x53, 0x65,
|
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x42, 0x61, 0x63, 0x63, 0x61, 0x72, 0x61, 0x74, 0x5f, 0x53, 0x65,
|
||||||
0x6c, 0x66, 0x42, 0x65, 0x74, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x10, 0xe3,
|
0x6c, 0x66, 0x42, 0x65, 0x74, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x61, 0x74, 0x65, 0x10, 0xe3,
|
||||||
0x36, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x3b, 0x62, 0x61, 0x63, 0x63, 0x61, 0x72, 0x61, 0x74, 0x62,
|
0x36, 0x42, 0x28, 0x5a, 0x26, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
||||||
|
0x6f, 0x6c, 0x2f, 0x62, 0x61, 0x63, 0x63, 0x61, 0x72, 0x61, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package baccarat;
|
package baccarat;
|
||||||
option go_package = ".;baccarat";
|
option go_package = "mongo.games.com/game/protocol/baccarat";
|
||||||
|
|
||||||
//百家乐
|
//百家乐
|
||||||
enum BaccaratPacketID{
|
enum BaccaratPacketID{
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ const (
|
||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 操作结果
|
//操作结果
|
||||||
type OpResultCode int32
|
type OpResultCode int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -145,7 +145,7 @@ func (SPacketID) EnumDescriptor() ([]byte, []int) {
|
||||||
return file_bag_proto_rawDescGZIP(), []int{1}
|
return file_bag_proto_rawDescGZIP(), []int{1}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 物品信息 后续精简
|
//物品信息 后续精简
|
||||||
type ItemInfo struct {
|
type ItemInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -223,7 +223,7 @@ func (x *ItemInfo) GetObtainTime() int64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// PACKET_ALL_BAG_INFO
|
//PACKET_ALL_BAG_INFO
|
||||||
type CSBagInfo struct {
|
type CSBagInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -279,7 +279,7 @@ func (x *CSBagInfo) GetTp() int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// PACKET_ALL_BAG_INFO
|
//PACKET_ALL_BAG_INFO
|
||||||
type SCBagInfo struct {
|
type SCBagInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -343,7 +343,7 @@ func (x *SCBagInfo) GetBagNumMax() int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// PACKET_ALL_BAG_USE
|
//PACKET_ALL_BAG_USE
|
||||||
type CSUpBagInfo struct {
|
type CSUpBagInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -431,7 +431,7 @@ func (x *CSUpBagInfo) GetShowId() int64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// PACKET_ALL_BAG_USE
|
//PACKET_ALL_BAG_USE
|
||||||
type SCUpBagInfo struct {
|
type SCUpBagInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -521,7 +521,7 @@ func (x *SCUpBagInfo) GetInfos() []*ItemInfo {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PACKET_SC_SYNCBAGDATA
|
//PACKET_SC_SYNCBAGDATA
|
||||||
type SCSyncBagData struct {
|
type SCSyncBagData struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
|
@ -999,8 +999,10 @@ var file_bag_proto_rawDesc = []byte{
|
||||||
0x47, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0xf5, 0x13, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b,
|
0x47, 0x5f, 0x45, 0x4e, 0x44, 0x10, 0xf5, 0x13, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b,
|
||||||
0x45, 0x54, 0x5f, 0x50, 0x72, 0x6f, 0x70, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10,
|
0x45, 0x54, 0x5f, 0x50, 0x72, 0x6f, 0x70, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x10,
|
||||||
0xb8, 0x17, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45, 0x78, 0x63,
|
0xb8, 0x17, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x45, 0x78, 0x63,
|
||||||
0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb9, 0x17, 0x42, 0x07, 0x5a, 0x05,
|
0x68, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x10, 0xb9, 0x17, 0x42, 0x23, 0x5a, 0x21,
|
||||||
0x2e, 0x3b, 0x62, 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
|
||||||
|
0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x62, 0x61,
|
||||||
|
0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package bag;
|
package bag;
|
||||||
option go_package = ".;bag";
|
option go_package = "mongo.games.com/game/protocol/bag";
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
OPRC_Sucess = 0; //成功
|
OPRC_Sucess = 0; //成功
|
||||||
|
|
|
||||||
|
|
@ -2011,8 +2011,10 @@ var file_blackjack_proto_rawDesc = []byte{
|
||||||
0x44, 0x53, 0x10, 0xd5, 0x29, 0x12, 0x0b, 0x0a, 0x06, 0x53, 0x43, 0x5f, 0x45, 0x4e, 0x44, 0x10,
|
0x44, 0x53, 0x10, 0xd5, 0x29, 0x12, 0x0b, 0x0a, 0x06, 0x53, 0x43, 0x5f, 0x45, 0x4e, 0x44, 0x10,
|
||||||
0xd6, 0x29, 0x12, 0x0f, 0x0a, 0x0a, 0x53, 0x43, 0x5f, 0x42, 0x55, 0x59, 0x5f, 0x45, 0x4e, 0x44,
|
0xd6, 0x29, 0x12, 0x0f, 0x0a, 0x0a, 0x53, 0x43, 0x5f, 0x42, 0x55, 0x59, 0x5f, 0x45, 0x4e, 0x44,
|
||||||
0x10, 0xd7, 0x29, 0x12, 0x0b, 0x0a, 0x06, 0x53, 0x43, 0x5f, 0x53, 0x49, 0x54, 0x10, 0xd8, 0x29,
|
0x10, 0xd7, 0x29, 0x12, 0x0b, 0x0a, 0x06, 0x53, 0x43, 0x5f, 0x53, 0x49, 0x54, 0x10, 0xd8, 0x29,
|
||||||
0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x3b, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x6a, 0x61, 0x63, 0x6b, 0x62,
|
0x42, 0x29, 0x5a, 0x27, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f,
|
||||||
|
0x6c, 0x2f, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x6a, 0x61, 0x63, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package blackjack;
|
package blackjack;
|
||||||
option go_package = ".;blackjack";
|
option go_package = "mongo.games.com/game/protocol/blackjack";
|
||||||
|
|
||||||
enum BlackJackPacketID {
|
enum BlackJackPacketID {
|
||||||
PACKET_BlackJack_ZERO = 0; // 弃用消息号
|
PACKET_BlackJack_ZERO = 0; // 弃用消息号
|
||||||
|
|
|
||||||
|
|
@ -1387,8 +1387,10 @@ var file_caishen_proto_rawDesc = []byte{
|
||||||
0x45, 0x4e, 0x5f, 0x42, 0x55, 0x52, 0x53, 0x54, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x52, 0x59, 0x10,
|
0x45, 0x4e, 0x5f, 0x42, 0x55, 0x52, 0x53, 0x54, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x52, 0x59, 0x10,
|
||||||
0xea, 0x28, 0x12, 0x22, 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f,
|
0xea, 0x28, 0x12, 0x22, 0x0a, 0x1d, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f,
|
||||||
0x43, 0x41, 0x49, 0x53, 0x48, 0x45, 0x4e, 0x5f, 0x47, 0x41, 0x4d, 0x45, 0x4a, 0x41, 0x43, 0x4b,
|
0x43, 0x41, 0x49, 0x53, 0x48, 0x45, 0x4e, 0x5f, 0x47, 0x41, 0x4d, 0x45, 0x4a, 0x41, 0x43, 0x4b,
|
||||||
0x50, 0x4f, 0x54, 0x10, 0xeb, 0x28, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x63, 0x61, 0x69, 0x73,
|
0x50, 0x4f, 0x54, 0x10, 0xeb, 0x28, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e,
|
||||||
0x68, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x61, 0x69, 0x73, 0x68, 0x65, 0x6e, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package caishen;
|
package caishen;
|
||||||
option go_package = ".;caishen";
|
option go_package = "mongo.games.com/game/protocol/caishen";
|
||||||
//财神
|
//财神
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -1078,8 +1078,10 @@ var file_candy_proto_rawDesc = []byte{
|
||||||
0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73,
|
0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73,
|
||||||
0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72,
|
||||||
0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e,
|
0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e,
|
||||||
0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b,
|
0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x02, 0x42, 0x25, 0x5a, 0x23, 0x6d, 0x6f,
|
||||||
0x63, 0x61, 0x6e, 0x64, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61,
|
||||||
|
0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x61, 0x6e, 0x64,
|
||||||
|
0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package candy;
|
package candy;
|
||||||
option go_package = ".;candy";
|
option go_package = "mongo.games.com/game/protocol/candy";
|
||||||
|
|
||||||
//糖果
|
//糖果
|
||||||
enum CandyPacketID {
|
enum CandyPacketID {
|
||||||
|
|
|
||||||
|
|
@ -1044,8 +1044,10 @@ var file_caothap_proto_rawDesc = []byte{
|
||||||
0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a,
|
0x50, 0x52, 0x43, 0x5f, 0x53, 0x75, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a,
|
||||||
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12,
|
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12,
|
||||||
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75,
|
0x4f, 0x50, 0x52, 0x43, 0x5f, 0x43, 0x6f, 0x69, 0x6e, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75,
|
||||||
0x67, 0x68, 0x10, 0x02, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x63, 0x61, 0x6f, 0x74, 0x68, 0x61,
|
0x67, 0x68, 0x10, 0x02, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61,
|
||||||
0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x61, 0x6f, 0x74, 0x68, 0x61, 0x70, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package caothap;
|
package caothap;
|
||||||
option go_package = ".;caothap";
|
option go_package = "mongo.games.com/game/protocol/caothap";
|
||||||
|
|
||||||
//CaoThap
|
//CaoThap
|
||||||
enum CaoThapPacketID {
|
enum CaoThapPacketID {
|
||||||
|
|
|
||||||
|
|
@ -839,8 +839,10 @@ var file_chat_proto_rawDesc = []byte{
|
||||||
0x64, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x10, 0xa4, 0x15, 0x12, 0x17, 0x0a, 0x12, 0x50,
|
0x64, 0x43, 0x68, 0x61, 0x74, 0x4d, 0x73, 0x67, 0x10, 0xa4, 0x15, 0x12, 0x17, 0x0a, 0x12, 0x50,
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x73,
|
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x73,
|
||||||
0x67, 0x10, 0xa5, 0x15, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
0x67, 0x10, 0xa5, 0x15, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||||
0x43, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x73, 0x67, 0x10, 0xa6, 0x15, 0x42, 0x08, 0x5a,
|
0x43, 0x53, 0x68, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x73, 0x67, 0x10, 0xa6, 0x15, 0x42, 0x24, 0x5a,
|
||||||
0x06, 0x2e, 0x3b, 0x63, 0x68, 0x61, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x22, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d,
|
||||||
|
0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63,
|
||||||
|
0x68, 0x61, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package chat;
|
package chat;
|
||||||
option go_package = ".;chat";
|
option go_package = "mongo.games.com/game/protocol/chat";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -2506,8 +2506,10 @@ var file_chesstitians_proto_rawDesc = []byte{
|
||||||
0x61, 0x79, 0x65, 0x72, 0x44, 0x65, 0x76, 0x4f, 0x70, 0x10, 0xed, 0x2a, 0x12, 0x25, 0x0a, 0x20,
|
0x61, 0x79, 0x65, 0x72, 0x44, 0x65, 0x76, 0x4f, 0x70, 0x10, 0xed, 0x2a, 0x12, 0x25, 0x0a, 0x20,
|
||||||
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x43, 0x68, 0x65, 0x73, 0x73, 0x74, 0x69,
|
0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x43, 0x68, 0x65, 0x73, 0x73, 0x74, 0x69,
|
||||||
0x74, 0x69, 0x61, 0x6e, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x65, 0x76, 0x4f, 0x70,
|
0x74, 0x69, 0x61, 0x6e, 0x73, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x65, 0x76, 0x4f, 0x70,
|
||||||
0x10, 0xee, 0x2a, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x3b, 0x63, 0x68, 0x65, 0x73, 0x73, 0x74, 0x69,
|
0x10, 0xee, 0x2a, 0x42, 0x2c, 0x5a, 0x2a, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d,
|
||||||
0x74, 0x69, 0x61, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x68, 0x65, 0x73, 0x73, 0x74, 0x69, 0x74, 0x69, 0x61, 0x6e,
|
||||||
|
0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package chesstitians;
|
package chesstitians;
|
||||||
option go_package = ".;chesstitians";
|
option go_package = "mongo.games.com/game/protocol/chesstitians";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -1540,8 +1540,10 @@ var file_crash_proto_rawDesc = []byte{
|
||||||
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x52, 0x41, 0x53, 0x48, 0x5f, 0x53,
|
0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x52, 0x41, 0x53, 0x48, 0x5f, 0x53,
|
||||||
0x45, 0x4e, 0x44, 0x54, 0x69, 0x6d, 0x65, 0x10, 0x9c, 0x28, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41,
|
0x45, 0x4e, 0x44, 0x54, 0x69, 0x6d, 0x65, 0x10, 0x9c, 0x28, 0x12, 0x1e, 0x0a, 0x19, 0x50, 0x41,
|
||||||
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x52, 0x41, 0x53, 0x48, 0x5f, 0x50, 0x61,
|
0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x43, 0x52, 0x41, 0x53, 0x48, 0x5f, 0x50, 0x61,
|
||||||
0x72, 0x61, 0x63, 0x68, 0x75, 0x74, 0x65, 0x10, 0x9d, 0x28, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b,
|
0x72, 0x61, 0x63, 0x68, 0x75, 0x74, 0x65, 0x10, 0x9d, 0x28, 0x42, 0x25, 0x5a, 0x23, 0x6d, 0x6f,
|
||||||
0x63, 0x72, 0x61, 0x73, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61,
|
||||||
|
0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x63, 0x72, 0x61, 0x73,
|
||||||
|
0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package crash;
|
package crash;
|
||||||
option go_package = ".;crash";
|
option go_package = "mongo.games.com/game/protocol/crash";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -2377,9 +2377,10 @@ var file_dezhoupoker_proto_rawDesc = []byte{
|
||||||
0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x42, 0x59, 0x50, 0x4f, 0x54, 0x53, 0x10,
|
0x41, 0x4d, 0x45, 0x42, 0x49, 0x4c, 0x4c, 0x45, 0x44, 0x42, 0x59, 0x50, 0x4f, 0x54, 0x53, 0x10,
|
||||||
0xef, 0x29, 0x12, 0x24, 0x0a, 0x1f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x43,
|
0xef, 0x29, 0x12, 0x24, 0x0a, 0x1f, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x43, 0x53, 0x43,
|
||||||
0x5f, 0x44, 0x45, 0x5a, 0x48, 0x4f, 0x55, 0x50, 0x4f, 0x4b, 0x45, 0x52, 0x5f, 0x57, 0x50, 0x55,
|
0x5f, 0x44, 0x45, 0x5a, 0x48, 0x4f, 0x55, 0x50, 0x4f, 0x4b, 0x45, 0x52, 0x5f, 0x57, 0x50, 0x55,
|
||||||
0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0xf0, 0x29, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x3b, 0x64, 0x65,
|
0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0xf0, 0x29, 0x42, 0x2b, 0x5a, 0x29, 0x6d, 0x6f, 0x6e, 0x67,
|
||||||
0x7a, 0x68, 0x6f, 0x75, 0x70, 0x6f, 0x6b, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65,
|
||||||
0x33,
|
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x64, 0x65, 0x7a, 0x68, 0x6f, 0x75,
|
||||||
|
0x70, 0x6f, 0x6b, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package dezhoupoker;
|
package dezhoupoker;
|
||||||
option go_package = ".;dezhoupoker";
|
option go_package = "mongo.games.com/game/protocol/dezhoupoker";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -1567,9 +1567,11 @@ var file_dragonvstiger_proto_rawDesc = []byte{
|
||||||
0xd0, 0x2a, 0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f,
|
0xd0, 0x2a, 0x12, 0x1b, 0x0a, 0x16, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f,
|
||||||
0x44, 0x56, 0x53, 0x54, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x42, 0x45, 0x54, 0x10, 0xd1, 0x2a, 0x12,
|
0x44, 0x56, 0x53, 0x54, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x42, 0x45, 0x54, 0x10, 0xd1, 0x2a, 0x12,
|
||||||
0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x44, 0x56, 0x53,
|
0x1a, 0x0a, 0x15, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53, 0x43, 0x5f, 0x44, 0x56, 0x53,
|
||||||
0x54, 0x5f, 0x55, 0x50, 0x4c, 0x49, 0x53, 0x54, 0x10, 0xd2, 0x2a, 0x42, 0x11, 0x5a, 0x0f, 0x2e,
|
0x54, 0x5f, 0x55, 0x50, 0x4c, 0x49, 0x53, 0x54, 0x10, 0xd2, 0x2a, 0x42, 0x2d, 0x5a, 0x2b, 0x6d,
|
||||||
0x3b, 0x64, 0x72, 0x61, 0x67, 0x6f, 0x6e, 0x76, 0x73, 0x74, 0x69, 0x67, 0x65, 0x72, 0x62, 0x06,
|
0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x64, 0x72, 0x61,
|
||||||
|
0x67, 0x6f, 0x6e, 0x76, 0x73, 0x74, 0x69, 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package dragonvstiger;
|
package dragonvstiger;
|
||||||
option go_package = ".;dragonvstiger";
|
option go_package = "mongo.games.com/game/protocol/dragonvstiger";
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
OPRC_Sucess = 0; //成功
|
OPRC_Sucess = 0; //成功
|
||||||
|
|
|
||||||
|
|
@ -1402,9 +1402,11 @@ var file_easterisland_proto_rawDesc = []byte{
|
||||||
0x41, 0x4e, 0x44, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x52,
|
0x41, 0x4e, 0x44, 0x5f, 0x50, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x52,
|
||||||
0x59, 0x10, 0xd5, 0x28, 0x12, 0x28, 0x0a, 0x23, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
0x59, 0x10, 0xd5, 0x28, 0x12, 0x28, 0x0a, 0x23, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||||
0x43, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x45, 0x52, 0x49, 0x53, 0x4c, 0x41, 0x4e, 0x44, 0x5f, 0x42,
|
0x43, 0x5f, 0x45, 0x41, 0x53, 0x54, 0x45, 0x52, 0x49, 0x53, 0x4c, 0x41, 0x4e, 0x44, 0x5f, 0x42,
|
||||||
0x55, 0x52, 0x53, 0x54, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x52, 0x59, 0x10, 0xd6, 0x28, 0x42, 0x10,
|
0x55, 0x52, 0x53, 0x54, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x52, 0x59, 0x10, 0xd6, 0x28, 0x42, 0x2c,
|
||||||
0x5a, 0x0e, 0x2e, 0x3b, 0x65, 0x61, 0x73, 0x74, 0x65, 0x72, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64,
|
0x5a, 0x2a, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f,
|
||||||
|
0x65, 0x61, 0x73, 0x74, 0x65, 0x72, 0x69, 0x73, 0x6c, 0x61, 0x6e, 0x64, 0x62, 0x06, 0x70, 0x72,
|
||||||
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package easterisland;
|
package easterisland;
|
||||||
option go_package = ".;easterisland";
|
option go_package = "mongo.games.com/game/protocol/easterisland";
|
||||||
|
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
|
|
@ -4356,8 +4356,10 @@ var file_fishing_proto_rawDesc = []byte{
|
||||||
0x47, 0x5f, 0x43, 0x53, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x54, 0x49, 0x4d, 0x45, 0x50, 0x4f, 0x49,
|
0x47, 0x5f, 0x43, 0x53, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x54, 0x49, 0x4d, 0x45, 0x50, 0x4f, 0x49,
|
||||||
0x4e, 0x54, 0x10, 0xb9, 0x27, 0x12, 0x1d, 0x0a, 0x18, 0x46, 0x49, 0x53, 0x48, 0x49, 0x4e, 0x47,
|
0x4e, 0x54, 0x10, 0xb9, 0x27, 0x12, 0x1d, 0x0a, 0x18, 0x46, 0x49, 0x53, 0x48, 0x49, 0x4e, 0x47,
|
||||||
0x5f, 0x53, 0x43, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x54, 0x49, 0x4d, 0x45, 0x50, 0x4f, 0x49, 0x4e,
|
0x5f, 0x53, 0x43, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x54, 0x49, 0x4d, 0x45, 0x50, 0x4f, 0x49, 0x4e,
|
||||||
0x54, 0x10, 0xba, 0x27, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x66, 0x69, 0x73, 0x68, 0x69, 0x6e,
|
0x54, 0x10, 0xba, 0x27, 0x42, 0x27, 0x5a, 0x25, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61,
|
||||||
0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x66, 0x69, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package fishing;
|
package fishing;
|
||||||
option go_package = ".;fishing";
|
option go_package = "mongo.games.com/game/protocol/fishing";
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
OPRC_Sucess = 0; //成功
|
OPRC_Sucess = 0; //成功
|
||||||
|
|
|
||||||
|
|
@ -828,9 +828,10 @@ var file_fortunegod_proto_rawDesc = []byte{
|
||||||
0x54, 0x55, 0x4e, 0x45, 0x47, 0x4f, 0x44, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54,
|
0x54, 0x55, 0x4e, 0x45, 0x47, 0x4f, 0x44, 0x5f, 0x52, 0x4f, 0x4f, 0x4d, 0x53, 0x54, 0x41, 0x54,
|
||||||
0x45, 0x10, 0xef, 0x27, 0x12, 0x25, 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
0x45, 0x10, 0xef, 0x27, 0x12, 0x25, 0x0a, 0x20, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x53,
|
||||||
0x43, 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x47, 0x4f, 0x44, 0x5f, 0x47, 0x41, 0x4d,
|
0x43, 0x5f, 0x46, 0x4f, 0x52, 0x54, 0x55, 0x4e, 0x45, 0x47, 0x4f, 0x44, 0x5f, 0x47, 0x41, 0x4d,
|
||||||
0x45, 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0xf0, 0x27, 0x42, 0x0e, 0x5a, 0x0c, 0x2e,
|
0x45, 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0xf0, 0x27, 0x42, 0x2a, 0x5a, 0x28, 0x6d,
|
||||||
0x3b, 0x66, 0x6f, 0x72, 0x74, 0x75, 0x6e, 0x65, 0x67, 0x6f, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67,
|
||||||
0x74, 0x6f, 0x33,
|
0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x66, 0x6f, 0x72,
|
||||||
|
0x74, 0x75, 0x6e, 0x65, 0x67, 0x6f, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package fortunegod;
|
package fortunegod;
|
||||||
option go_package = ".;fortunegod";
|
option go_package = "mongo.games.com/game/protocol/fortunegod";
|
||||||
//财神到协议
|
//财神到协议
|
||||||
//操作结果
|
//操作结果
|
||||||
enum OpResultCode {
|
enum OpResultCode {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue