This commit is contained in:
by 2025-01-08 11:27:37 +08:00
commit 62f27c4723
23 changed files with 1841 additions and 13 deletions

View File

@ -99,6 +99,7 @@ const (
GameId_AngerUncle = 606 // 愤怒大叔 GameId_AngerUncle = 606 // 愤怒大叔
GameId_SmallRoket = 607 // 小火箭 GameId_SmallRoket = 607 // 小火箭
GameId_Clawdoll = 608 // 娃娃机 GameId_Clawdoll = 608 // 娃娃机
GameId_PushCoin = 609 // 推币机
__GameId_ThrGame_Min__ = 700 //################三方类################ __GameId_ThrGame_Min__ = 700 //################三方类################
GameId_Thr_Dg = 701 //DG Game GameId_Thr_Dg = 701 //DG Game
GameId_Thr_XHJ = 901 ///DG Game GameId_Thr_XHJ = 901 ///DG Game

Binary file not shown.

View File

@ -4520,7 +4520,7 @@
{ {
"Id": 2110001, "Id": 2110001,
"Name": "十三张四人", "Name": "十三张四人",
"Title": "1", "Title": "新手场",
"GameId": 211, "GameId": 211,
"GameRule": 21100, "GameRule": 21100,
"GameType": 2, "GameType": 2,
@ -4574,7 +4574,7 @@
{ {
"Id": 2110002, "Id": 2110002,
"Name": "十三张四人", "Name": "十三张四人",
"Title": "2", "Title": "小康场",
"GameId": 211, "GameId": 211,
"GameRule": 21100, "GameRule": 21100,
"GameType": 2, "GameType": 2,
@ -4628,7 +4628,7 @@
{ {
"Id": 2110003, "Id": 2110003,
"Name": "十三张四人", "Name": "十三张四人",
"Title": "3", "Title": "土豪场",
"GameId": 211, "GameId": 211,
"GameRule": 21100, "GameRule": 21100,
"GameType": 2, "GameType": 2,
@ -4682,7 +4682,7 @@
{ {
"Id": 2110004, "Id": 2110004,
"Name": "十三张四人", "Name": "十三张四人",
"Title": "4", "Title": "新手场",
"GameId": 211, "GameId": 211,
"GameRule": 21100, "GameRule": 21100,
"GameType": 2, "GameType": 2,
@ -4736,7 +4736,7 @@
{ {
"Id": 2110005, "Id": 2110005,
"Name": "十三张四人", "Name": "十三张四人",
"Title": "5", "Title": "小康场",
"GameId": 211, "GameId": 211,
"GameRule": 21100, "GameRule": 21100,
"GameType": 2, "GameType": 2,
@ -4790,7 +4790,7 @@
{ {
"Id": 2110006, "Id": 2110006,
"Name": "十三张四人", "Name": "十三张四人",
"Title": "6", "Title": "土豪场",
"GameId": 211, "GameId": 211,
"GameRule": 21100, "GameRule": 21100,
"GameType": 2, "GameType": 2,
@ -4843,7 +4843,7 @@
{ {
"Id": 2120001, "Id": 2120001,
"Name": "十三张八人", "Name": "十三张八人",
"Title": "1", "Title": "新手场",
"GameId": 212, "GameId": 212,
"GameRule": 21200, "GameRule": 21200,
"GameType": 2, "GameType": 2,
@ -4897,7 +4897,7 @@
{ {
"Id": 2120002, "Id": 2120002,
"Name": "十三张八人", "Name": "十三张八人",
"Title": "2", "Title": "小康场",
"GameId": 212, "GameId": 212,
"GameRule": 21200, "GameRule": 21200,
"GameType": 2, "GameType": 2,
@ -4951,7 +4951,7 @@
{ {
"Id": 2120003, "Id": 2120003,
"Name": "十三张八人", "Name": "十三张八人",
"Title": "3", "Title": "土豪场",
"GameId": 212, "GameId": 212,
"GameRule": 21200, "GameRule": 21200,
"GameType": 2, "GameType": 2,
@ -5005,7 +5005,7 @@
{ {
"Id": 2120004, "Id": 2120004,
"Name": "十三张八人", "Name": "十三张八人",
"Title": "4", "Title": "新手场",
"GameId": 212, "GameId": 212,
"GameRule": 21200, "GameRule": 21200,
"GameType": 2, "GameType": 2,
@ -5059,7 +5059,7 @@
{ {
"Id": 2120005, "Id": 2120005,
"Name": "十三张八人", "Name": "十三张八人",
"Title": "5", "Title": "小康场",
"GameId": 212, "GameId": 212,
"GameRule": 21200, "GameRule": 21200,
"GameType": 2, "GameType": 2,
@ -5113,7 +5113,7 @@
{ {
"Id": 2120006, "Id": 2120006,
"Name": "十三张八人", "Name": "十三张八人",
"Title": "6", "Title": "土豪场",
"GameId": 212, "GameId": 212,
"GameRule": 21200, "GameRule": 21200,
"GameType": 2, "GameType": 2,
@ -7019,6 +7019,27 @@
"PlayerWaterRate": 100, "PlayerWaterRate": 100,
"BetWaterRate": 100, "BetWaterRate": 100,
"GameName": "娃娃机" "GameName": "娃娃机"
},
{
"Id": 6090001,
"Name": "推币机",
"GameId": 609,
"GameRule": 60900,
"GameType": 5,
"SceneType": 1,
"ShowType": 3,
"ShowId": 60900,
"Turn": 60900,
"OtherIntParams": [
5000,
10000,
15000
],
"SameIpLimit": 1,
"GameDif": "609",
"GameClass": 2,
"PlatformName": "越南棋牌",
"GameName": "推币机"
} }
] ]
} }

Binary file not shown.

View File

@ -267,6 +267,12 @@
"Name": "娃娃机", "Name": "娃娃机",
"GameId": 608, "GameId": 608,
"GameDif": "608" "GameDif": "608"
},
{
"Id": 60900,
"Name": "推币机",
"GameId": 609,
"GameDif": "609"
} }
] ]
} }

View File

@ -0,0 +1,84 @@
"¡<>"¢<>d"¹ê
"¡<>"¢<>d"¸ê
"¡<>"¢<>d"¸ê
"¡<>"¢<>d
"¡<>"¢<>c
"¡<>"¢<>b
"¡<>"¢<>a
"¡<>"¢<>`
  "¡<>"¢<>_


"¡<>"¢<>^
  "¡<>"¢<>]
  "¢<>\"¡<>
  "¡<>"¢<>[
"¡<>"¢<>Z
"¡<>"¢<>Y
"¡<>"¢<>X
"¡<>"¢<>W
"¡<>"¢<>V
"¡<>"¢<>U
"¡<>"¢<>T
"¡<>"¢<>S
"¡<>"¢<>R
"¡<>"¢<>Q
"¡<>"¢<>P
"¡<>"¢<>O
"¡<>"¢<>N
"¡<>"¢<>M
"¡<>"¢<>L
"¡<>"¢<>K
"¡<>"¢<>J
"¡<>"¢<>I
  "¡<>"¢<>H
!!"¡<>"¢<>G
"""¡<>"¢<>F
##"¡<>"¢<>E
$$"¡<>"¢<>D
%%"¡<>"¢<>C
&&"¢<>B"¡<>
''"¡<>"¢<>A
(("¢<>@"¡<>
)"¡<>"¢<>d"¹ê
*"¡<>"¢<>d"¸ê
+"¢<>d"¸ê"¡<>
,"¡<>"¢<>d
-"¡<>"¢<>c
."¡<>"¢<>b
/"¡<>"¢<>a
0"¡<>"¢<>`
1 "¡<>"¢<>_
2
"¡<>"¢<>^
3 "¡<>"¢<>]
4 "¡<>"¢<>\
5 "¡<>"¢<>[
6"¡<>"¢<>Z
7"¡<>"¢<>Y
8"¢<>X"¡<>
9"¢<>W"¡<>
:"¡<>"¢<>V
;"¡<>"¢<>U
<"¡<>"¢<>T
="¡<>"¢<>S
>"¢<>R"¡<>
?"¡<>"¢<>Q
@"¡<>"¢<>P
A"¡<>"¢<>O
B"¡<>"¢<>N
C"¡<>"¢<>M
D"¡<>"¢<>L
E"¡<>"¢<>K
F"¢<>J"¡<>
G"¡<>"¢<>I
H "¡<>"¢<>H
I!"¡<>"¢<>G
J""¡<>"¢<>F
K#"¡<>"¢<>E
L$"¡<>"¢<>D
M%"¡<>"¢<>C
N&"¡<>"¢<>B
O'"¡<>"¢<>A
P("¡<>"¢<>@

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
{
"GameName":"推币机",
"GameId":609,
"GameMode":[0],
"SceneType":[1],
"CanForceStart":true,
"MinPlayerCnt":1,
"DefaultPlayerCnt":1
}

View File

@ -193,5 +193,9 @@
- 5660~5669 - 5660~5669
### pushcoin.proto
- 5670~5679
### game.proto(玩家离开) ### game.proto(玩家离开)
- 8000~8099 - 8000~8099

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,103 @@
syntax = "proto3";
package pushcoin;
option go_package = "mongo.games.com/game/protocol/pushcoin";
// 5670~5679
enum PushCoinPacketID {
PACKET_PushCoin_ZERO = 0;//
PACKET_SCPushCoinRoomInfo = 5670; //
PACKET_SCPushCoinRoomState = 5671; //
PACKET_CSPushCoinPlayerOp = 5672; //
PACKET_SCPushCoinPlayerOp = 5673; //
}
//
//PACKET_SCPushCoinRoomInfo
message SCPushCoinRoomInfo {
int32 RoomId = 1; //id
int32 GameId = 2; //id
int32 RoomMode = 3; //
repeated int32 Params = 4; //
int32 State = 5; //
int32 TimeOut = 6; // :
repeated PushCoinPlayerData Players = 7; //
repeated ExchangeInfo ExchangeList = 8; //
repeated DrawInfo DrawList = 9; //
}
message ItemInfo{
int32 ItemId = 1; //id
int32 ItemNum = 2; //
}
message ExchangeInfo{
int32 Id = 1; //id
repeated ItemInfo Cost = 2; //
repeated ItemInfo Gain = 3; //
int32 ShakeTimes = 4; //
}
message DrawInfo{
int32 Id = 1; //id
int32 ItemId = 2; //id
int32 ItemNum = 3; //
int64 Coin = 4; //
}
message PushCoinPlayerData {
string Name = 1; //
int32 SnId = 2; //
int32 Head = 3; //
int32 Sex = 4; //
int64 Coin = 5; //
int32 Flag = 6; // :线(0:线 1:线) :(0: 1:)
repeated string Params = 7; // :ip
int32 VIP = 8;
int32 RoleId = 9; //使id
int64 Level = 10; //
int64 Exp = 11; //
int32 SkinId = 12; //id
int32 ShakeTimes = 13; //
int64 BaseCoin = 14; //()
int64 PowerLine = 15; //
int64 PowerLineMax = 16; //
int64 RefreshTimes = 17; //
}
//
//PACKET_SCPushCoinRoomState
message SCPushCoinRoomState {
int32 State = 1; //
int32 SubState = 2; //
repeated int32 Params = 3; //
}
//
//PACKET_CSPushCoinPlayerOp
message CSPushCoinPlayerOp {
OpCodes OpCode = 1;
repeated int64 OpParam = 2;
}
enum OpCodes {
OP_Zero = 0;
OP_Bet = 1; // []
OP_Gain = 2; // []
OP_Shake = 3; // []
OP_Refresh = 4; // []
OP_Exchange = 5; // [id]
OP_Draw = 6; // [id]
}
enum OpResultCode {
OPRC_Success = 0; //
OPRC_Error = 1; //
}
//PACKET_SCPushCoinPlayerOp
message SCPushCoinPlayerOp {
OpResultCode OpRetCode = 1;
OpCodes OpCode = 2;
ExchangeInfo Exchange = 3; // ,
DrawInfo Draw = 4; //
}

View File

@ -0,0 +1,95 @@
package main
import (
"encoding/json"
"fmt"
"math/rand"
"mongo.games.com/goserver/core/timer"
"time"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/game/model"
"mongo.games.com/game/proto"
loginproto "mongo.games.com/game/protocol/login"
playerproto "mongo.games.com/game/protocol/player"
)
func init() {
// 心跳
netlib.Register(int(loginproto.GatePacketID_PACKET_SC_PONG), loginproto.SCPong{}, SCPong)
// 登录
netlib.Register(int(loginproto.LoginPacketID_PACKET_SC_LOGIN), loginproto.SCLogin{}, SCLogin)
// 玩家信息
netlib.Register(int(playerproto.PlayerPacketID_PACKET_SC_PLAYERDATA), playerproto.SCPlayerData{}, SCPlayerData)
}
func SCPong(s *netlib.Session, packetid int, data interface{}) error {
accountID := s.GetAttribute(SessionAttributeClientAccountId)
logger.Logger.Tracef("SCPong username:%v %v", accountID, data)
return nil
}
func SCLogin(s *netlib.Session, packetid int, data interface{}) error {
logger.Logger.Trace("SCLogin ", data)
msg, ok := data.(*loginproto.SCLogin)
if !ok {
return nil
}
if msg.GetOpRetCode() != loginproto.OpResultCode_OPRC_Sucess {
accountID := s.GetAttribute(SessionAttributeClientAccountId)
logger.Logger.Error("登录失败 ", accountID)
s.Close()
return nil
}
csPlayerData := &playerproto.CSPlayerData{
AccId: msg.GetAccId(),
}
pp := &model.PlayerParams{
Platform: 1,
Ip: fmt.Sprintf("%v.%v.%v.%v", 1+rand.Int31n(255), 1+rand.Int31n(255), 1+rand.Int31n(255), 1+rand.Int31n(255)),
City: "北京",
Logininmodel: "app",
}
d, err := json.Marshal(pp)
if err == nil {
csPlayerData.Params = proto.String(string(d))
}
s.Send(int(playerproto.PlayerPacketID_PACKET_CS_PLAYERDATA), csPlayerData)
logger.Logger.Info("登录成功 ", msg.GetAccId())
return nil
}
func SCPlayerData(s *netlib.Session, packetid int, data interface{}) error {
logger.Logger.Trace("SCPlayerData ", data)
msg, ok := data.(*playerproto.SCPlayerData)
if !ok {
return nil
}
if msg.GetOpRetCode() != playerproto.OpResultCode_OPRC_Sucess {
accountID := s.GetAttribute(SessionAttributeClientAccountId)
logger.Logger.Errorf("获取玩家信息失败 %v", accountID)
s.Close()
return nil
}
s.SetAttribute(SessionAttributeUser, msg)
StartSessionPingTimer(s, timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool {
if !s.IsConned() {
StopSessionPingTimer(s)
return false
}
pack := &loginproto.CSPing{}
s.Send(int(loginproto.GatePacketID_PACKET_CS_PING), pack)
return true
}), nil, time.Second*time.Duration(60+rand.Int31n(100)), -1)
return nil
}

35
tools/benchmark/config.go Normal file
View File

@ -0,0 +1,35 @@
package main
import (
"mongo.games.com/goserver/core"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
)
var Config = &Configuration{}
type Configuration struct {
Count int // 机器人总数
AppId string // appID
Connects netlib.SessionConfig // 网络连接配置
}
func (this *Configuration) Name() string {
return "benchmark"
}
func (this *Configuration) Init() error {
logger.Logger.Tracef("%+v", *this)
if this.Count == 0 {
this.Count = 20
}
return nil
}
func (this *Configuration) Close() error {
return nil
}
func init() {
core.RegistePackage(Config)
}

View File

@ -0,0 +1,65 @@
netlib:
SrvInfo:
Name: BenchmarkServer
Type: 9
Id: 902
AreaID: 1
Banner:
- =================
- benchmark server
- =================
IoServices: []
module:
Options:
QueueBacklog: 1024
MaxDone: 1024
Interval: 100
executor:
Options:
QueueBacklog: 1024
MaxDone: 1024
Interval: 0
Worker:
WorkerCnt: 8
Options:
QueueBacklog: 1024
MaxDone: 1024
Interval: 0
timer:
Options:
QueueBacklog: 1024
MaxDone: 1024
Interval: 100
signal:
SupportSignal: true
benchmark:
Count: 100
AppId: 5c56d1644966f078bfb90c71
Connects:
Id: 402
Type: 4
AreaId: 1
Name: ClientService
Ip: 127.0.0.1
Port: 11001
Protocol: tcp
Path: /
MaxDone: 200
MaxPend: 200
MaxPacket: 65535
MaxConn: 2000
RcvBuff: 4096
SndBuff: 4096
WriteTimeout: 3600
ReadTimeout: 3600
SoLinger: 10
IsInnerLink: true
NoDelay: true
SupportFragment: true
AuthKey: www.jxjy.games.cn
IsClient: true
AllowMultiConn: true
FilterChain:
- session-filter-auth
HandlerChain:
- handler-gate-session

View File

@ -0,0 +1,69 @@
package main
import (
"time"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/module"
"mongo.games.com/goserver/core/netlib"
)
const (
// RobotSessionStartId 机器人session开始id
RobotSessionStartId = 100000000
)
var (
BenchMarkModule = &BenchMark{}
WaitConnectSessions []*netlib.SessionConfig
)
// NewSession 新建session
// id 连接id, 默认自动分配
func NewSession(id ...int) {
cfg := Config.Connects
if len(id) > 0 && id[0] > 0 {
cfg.Id = id[0]
} else {
BenchMarkModule.idx++
cfg.Id = BenchMarkModule.idx
}
cfg.Init()
logger.Logger.Info("waite connect session id=", cfg.Id)
WaitConnectSessions = append(WaitConnectSessions, &cfg)
}
type BenchMark struct {
idx int
}
func (m *BenchMark) ModuleName() string {
return "benchmark-module"
}
func (m *BenchMark) Init() {
m.idx = RobotSessionStartId
for i := 0; i < Config.Count; i++ {
NewSession()
}
}
// Update 机器开始连接游戏服务器
func (m *BenchMark) Update() {
n := len(WaitConnectSessions)
if n > 0 {
config := WaitConnectSessions[n-1]
WaitConnectSessions = WaitConnectSessions[:n-1]
if err := netlib.Connect(config); err != nil {
logger.Logger.Error("netlib.Connect error", err)
}
}
}
func (m *BenchMark) Shutdown() {
module.UnregisteModule(m)
}
func init() {
module.RegisteModule(BenchMarkModule, time.Millisecond, 1)
}

View File

@ -0,0 +1,31 @@
package main
import (
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/core/timer"
"time"
)
const (
SessionAttributeClientAccountId int = iota // 账号
SessionAttributeUser
SessionAttributePingTimer
)
func StartSessionPingTimer(s *netlib.Session, act timer.TimerAction, ud interface{}, interval time.Duration, times int) bool {
StopSessionPingTimer(s)
if hTimer, ok := timer.StartTimer(act, ud, interval, times); ok {
s.SetAttribute(SessionAttributePingTimer, hTimer)
return true
}
return false
}
func StopSessionPingTimer(s *netlib.Session) {
if h, ok := s.GetAttribute(SessionAttributePingTimer).(timer.TimerHandle); ok {
if h != timer.TimerHandle(0) {
timer.StopTimer(h)
s.RemoveAttribute(SessionAttributePingTimer)
}
}
}

View File

@ -0,0 +1,97 @@
package main
import (
"crypto/md5"
"encoding/hex"
"encoding/json"
"fmt"
"io"
"math/rand"
"mongo.games.com/game/common"
"mongo.games.com/game/model"
loginproto "mongo.games.com/game/protocol/login"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"strconv"
"sync/atomic"
"time"
)
/*
添加到客户端管理器管理器负责登录
当连接断开时从管理器中移除判断是否需要重连
*/
const (
GateSessionHandlerName = "handler-gate-session"
)
type GateSessionHandler struct {
netlib.BasicSessionHandler
}
func (g *GateSessionHandler) GetName() string {
return GateSessionHandlerName
}
func (g *GateSessionHandler) GetInterestOps() uint {
return 1<<netlib.InterestOps_Opened |
1<<netlib.InterestOps_Closed
}
func (g *GateSessionHandler) OnSessionOpened(s *netlib.Session) {
// 登录账号
StartLogin(s)
return
}
func (g *GateSessionHandler) OnSessionClosed(s *netlib.Session) {
}
func init() {
netlib.RegisteSessionHandlerCreator(GateSessionHandlerName, func() netlib.SessionHandler {
return &GateSessionHandler{}
})
}
var UserNameIndex int64
func StartLogin(s *netlib.Session) {
ts := time.Now().UnixNano()
username := fmt.Sprintf("benchmark-%v", atomic.AddInt64(&UserNameIndex, 1))
s.SetAttribute(SessionAttributeClientAccountId, username)
csLogin := &loginproto.CSLogin{
Username: username,
TimeStamp: ts,
Platform: "1",
Channel: "",
PlatformTag: "test.win88.yy_android",
}
params := &model.PlayerParams{
Ip: fmt.Sprintf("%v.%v.%v.%v", 1+rand.Int31n(255), 1+rand.Int31n(255), 1+rand.Int31n(255), 1+rand.Int31n(255)),
City: "北京",
Platform: 1,
Logininmodel: "app",
}
data, err := json.Marshal(params)
if err == nil {
csLogin.Params = string(data[:])
}
h := md5.New()
io.WriteString(h, fmt.Sprintf("%v%v", username, Config.AppId))
pwd := hex.EncodeToString(h.Sum(nil))
h.Reset()
io.WriteString(h, fmt.Sprintf("%v%v%v", pwd, Config.AppId, ts))
pwd = hex.EncodeToString(h.Sum(nil))
csLogin.Password = pwd
csLogin.LoginType = 0
csLogin.Sign = common.MakeMd5String(csLogin.GetUsername(), csLogin.GetPassword(),
strconv.Itoa(int(csLogin.GetTimeStamp())), csLogin.GetParams(), Config.AppId)
s.Send(int(loginproto.LoginPacketID_PACKET_CS_LOGIN), csLogin)
logger.Logger.Infof("账号 [%v] 开始登录", username)
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<seelog type="adaptive" mininterval="2000000" maxinterval="100000000" critmsgcount="500" minlevel="trace">
<exceptions>
<exception filepattern="test*" minlevel="error"/>
</exceptions>
<outputs formatid="all">
<rollingfile formatid="all" type="size" filename="./all.log" maxsize="50000000" maxrolls="5" />
<filter levels="info,trace,warn,error">
<console formatid="fmtinfo"/>
</filter>
<filter levels="error,critical" formatid="fmterror">
<console/>
<file path="errors.log"/>
</filter>
</outputs>
<formats>
<format id="fmtinfo" format="[%Date][%Time] [%Level] %Msg%n"/>
<format id="fmterror" format="[%Date][%Time] [%LEVEL] [%FuncShort @ %File.%Line] %Msg%n"/>
<format id="all" format="[%Date][%Time] [%Level] [@ %File.%Line] %Msg%n"/>
<format id="criticalemail" format="Critical error on our server!\n %Time %Date %RelFile %Func %Msg \nSent by Seelog"/>
</formats>
</seelog>

25
tools/benchmark/main.go Normal file
View File

@ -0,0 +1,25 @@
package main
import (
_ "mongo.games.com/game"
"mongo.games.com/goserver/core"
"mongo.games.com/goserver/core/module"
)
func main() {
defer core.ClosePackages()
core.LoadPackages("config.yaml")
// core hook
core.RegisteHook(core.HOOK_BEFORE_START, func() error {
return nil
})
core.RegisteHook(core.HOOK_AFTER_STOP, func() error {
return nil
})
// module模块
waiter := module.Start()
waiter.Wait("main()")
}

View File

@ -5,6 +5,7 @@ import (
"math" "math"
"math/rand" "math/rand"
"slices" "slices"
"sort"
"time" "time"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
@ -2313,6 +2314,10 @@ func (this *WelfareMgr) SendRedPacketInfo(p *Player) *welfare.SCRedPacketInfo {
} }
} }
sort.Slice(pack.Info, func(i, j int) bool {
return pack.Info[i].StartTs < pack.Info[j].StartTs
})
p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketInfo), pack) p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketInfo), pack)
return pack return pack
} }
@ -2401,7 +2406,7 @@ func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDr
f := func() { f := func() {
// 概率抽奖 // 概率抽奖
rate := 0 rate := 0
n := rand.Int63n(100) n := rand.Int63n(10000)
for _, v := range cfg.GetRedList() { for _, v := range cfg.GetRedList() {
rate += int(v.GetRate()) rate += int(v.GetRate())
if n < int64(rate) { if n < int64(rate) {

Binary file not shown.

Binary file not shown.