Compare commits

...

4 Commits

Author SHA1 Message Date
tomas fc2d894955 del betchangelist 2025-02-27 18:16:21 +08:00
tomas 4216d2f39c fix betsize 2025-02-27 18:01:00 +08:00
tomas 9674ae585d fix script 2025-02-27 17:30:33 +08:00
tomas 107799f46b fix sort 2025-02-27 13:41:16 +08:00
8 changed files with 102 additions and 69 deletions

View File

@ -3,7 +3,6 @@ package assemble
import ( import (
"mongo.games.com/game/gamesrv/slotspkg/internal/module/shared" "mongo.games.com/game/gamesrv/slotspkg/internal/module/shared"
"mongo.games.com/game/gamesrv/slotspkg/slots/types/cli" "mongo.games.com/game/gamesrv/slotspkg/slots/types/cli"
"sort"
) )
var CoinRate float64 = 10000 var CoinRate float64 = 10000
@ -16,10 +15,10 @@ func DataToCli(response any) interface{} {
for _, size := range Response.BetSizes { for _, size := range Response.BetSizes {
BetSizes = append(BetSizes, float64(size)/10000) BetSizes = append(BetSizes, float64(size)/10000)
} }
sort.Slice(Response.BetChangeList, func(i, j int) bool { return Response.BetChangeList[i] < Response.BetChangeList[j] }) //sort.Slice(Response.BetChangeList, func(i, j int) bool { return Response.BetChangeList[i] < Response.BetChangeList[j] })
sort.Slice(Response.BetLevels, func(i, j int) bool { return Response.BetLevels[i] < Response.BetLevels[j] }) //sort.Slice(Response.BetLevels, func(i, j int) bool { return Response.BetLevels[i] < Response.BetLevels[j] })
sort.Slice(Response.BaseBets, func(i, j int) bool { return Response.BaseBets[i] < Response.BaseBets[j] }) //sort.Slice(Response.BaseBets, func(i, j int) bool { return Response.BaseBets[i] < Response.BaseBets[j] })
sort.Slice(BetSizes, func(i, j int) bool { return BetSizes[i] < BetSizes[j] }) //sort.Slice(BetSizes, func(i, j int) bool { return BetSizes[i] < BetSizes[j] })
tableInfo.BetConfig = BetConfig{ tableInfo.BetConfig = BetConfig{
BetChangeList: Response.BetChangeList, BetChangeList: Response.BetChangeList,
BetSize: BetSizes, BetSize: BetSizes,

View File

@ -13,8 +13,9 @@ else
echo "converter already exists." echo "converter already exists."
fi fi
cd ../../../
# 执行 converter 文件 # 执行 converter 文件
./converter go /excel ../internal/exported/excel2go .. ./gamesrv/slotspkg/external/converter go gamesrv/slotspkg/external/excel gamesrv/slotspkg/internal/exported/excel2go ..
echo "Done." echo "Done."
read -p "Press [Enter] to exit..." read -p "Press [Enter] to exit..."

View File

@ -106,295 +106,295 @@ func init() {
SugarRushBetBetChangeList = map[int64]*structs.SugarRushBetBetChangeList{ SugarRushBetBetChangeList = map[int64]*structs.SugarRushBetBetChangeList{
0: { 0: {
Index: 0, Index: 0,
BetChangeList: 0.2, BetChangeList: 2000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 0, BetLevelIndex: 0,
}, },
1: { 1: {
Index: 1, Index: 1,
BetChangeList: 0.4, BetChangeList: 4000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 1, BetLevelIndex: 1,
}, },
2: { 2: {
Index: 2, Index: 2,
BetChangeList: 0.6, BetChangeList: 6000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 2, BetLevelIndex: 2,
}, },
3: { 3: {
Index: 3, Index: 3,
BetChangeList: 0.8, BetChangeList: 8000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 3, BetLevelIndex: 3,
}, },
4: { 4: {
Index: 4, Index: 4,
BetChangeList: 1, BetChangeList: 10000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 4, BetLevelIndex: 4,
}, },
5: { 5: {
Index: 5, Index: 5,
BetChangeList: 1.2, BetChangeList: 12000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 5, BetLevelIndex: 5,
}, },
6: { 6: {
Index: 6, Index: 6,
BetChangeList: 1.4, BetChangeList: 14000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 6, BetLevelIndex: 6,
}, },
7: { 7: {
Index: 7, Index: 7,
BetChangeList: 1.6, BetChangeList: 16000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 7, BetLevelIndex: 7,
}, },
8: { 8: {
Index: 8, Index: 8,
BetChangeList: 1.8, BetChangeList: 18000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 8, BetLevelIndex: 8,
}, },
9: { 9: {
Index: 9, Index: 9,
BetChangeList: 2, BetChangeList: 20000,
BetSizeIndex: 0, BetSizeIndex: 0,
BetLevelIndex: 9, BetLevelIndex: 9,
}, },
10: { 10: {
Index: 10, Index: 10,
BetChangeList: 4, BetChangeList: 40000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 1, BetLevelIndex: 1,
}, },
11: { 11: {
Index: 11, Index: 11,
BetChangeList: 6, BetChangeList: 60000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 2, BetLevelIndex: 2,
}, },
12: { 12: {
Index: 12, Index: 12,
BetChangeList: 8, BetChangeList: 80000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 3, BetLevelIndex: 3,
}, },
13: { 13: {
Index: 13, Index: 13,
BetChangeList: 10, BetChangeList: 100000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 4, BetLevelIndex: 4,
}, },
14: { 14: {
Index: 14, Index: 14,
BetChangeList: 12, BetChangeList: 120000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 5, BetLevelIndex: 5,
}, },
15: { 15: {
Index: 15, Index: 15,
BetChangeList: 14, BetChangeList: 140000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 6, BetLevelIndex: 6,
}, },
16: { 16: {
Index: 16, Index: 16,
BetChangeList: 15, BetChangeList: 150000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 0, BetLevelIndex: 0,
}, },
17: { 17: {
Index: 17, Index: 17,
BetChangeList: 16, BetChangeList: 160000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 7, BetLevelIndex: 7,
}, },
18: { 18: {
Index: 18, Index: 18,
BetChangeList: 18, BetChangeList: 180000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 8, BetLevelIndex: 8,
}, },
19: { 19: {
Index: 19, Index: 19,
BetChangeList: 20, BetChangeList: 200000,
BetSizeIndex: 1, BetSizeIndex: 1,
BetLevelIndex: 9, BetLevelIndex: 9,
}, },
20: { 20: {
Index: 20, Index: 20,
BetChangeList: 24, BetChangeList: 240000,
BetSizeIndex: 2, BetSizeIndex: 2,
BetLevelIndex: 5, BetLevelIndex: 5,
}, },
21: { 21: {
Index: 21, Index: 21,
BetChangeList: 28, BetChangeList: 280000,
BetSizeIndex: 2, BetSizeIndex: 2,
BetLevelIndex: 6, BetLevelIndex: 6,
}, },
22: { 22: {
Index: 22, Index: 22,
BetChangeList: 30, BetChangeList: 300000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 2, BetLevelIndex: 2,
}, },
23: { 23: {
Index: 23, Index: 23,
BetChangeList: 32, BetChangeList: 320000,
BetSizeIndex: 2, BetSizeIndex: 2,
BetLevelIndex: 7, BetLevelIndex: 7,
}, },
24: { 24: {
Index: 24, Index: 24,
BetChangeList: 36, BetChangeList: 360000,
BetSizeIndex: 2, BetSizeIndex: 2,
BetLevelIndex: 8, BetLevelIndex: 8,
}, },
25: { 25: {
Index: 25, Index: 25,
BetChangeList: 40, BetChangeList: 400000,
BetSizeIndex: 2, BetSizeIndex: 2,
BetLevelIndex: 9, BetLevelIndex: 9,
}, },
26: { 26: {
Index: 26, Index: 26,
BetChangeList: 45, BetChangeList: 450000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 2, BetLevelIndex: 2,
}, },
27: { 27: {
Index: 27, Index: 27,
BetChangeList: 50, BetChangeList: 500000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 4, BetLevelIndex: 4,
}, },
28: { 28: {
Index: 28, Index: 28,
BetChangeList: 60, BetChangeList: 600000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 5, BetLevelIndex: 5,
}, },
29: { 29: {
Index: 29, Index: 29,
BetChangeList: 70, BetChangeList: 700000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 6, BetLevelIndex: 6,
}, },
30: { 30: {
Index: 30, Index: 30,
BetChangeList: 75, BetChangeList: 750000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 4, BetLevelIndex: 4,
}, },
31: { 31: {
Index: 31, Index: 31,
BetChangeList: 80, BetChangeList: 800000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 7, BetLevelIndex: 7,
}, },
32: { 32: {
Index: 32, Index: 32,
BetChangeList: 90, BetChangeList: 900000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 8, BetLevelIndex: 8,
}, },
33: { 33: {
Index: 33, Index: 33,
BetChangeList: 100, BetChangeList: 1000000,
BetSizeIndex: 3, BetSizeIndex: 3,
BetLevelIndex: 9, BetLevelIndex: 9,
}, },
34: { 34: {
Index: 34, Index: 34,
BetChangeList: 105, BetChangeList: 1050000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 6, BetLevelIndex: 6,
}, },
35: { 35: {
Index: 35, Index: 35,
BetChangeList: 120, BetChangeList: 1200000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 7, BetLevelIndex: 7,
}, },
36: { 36: {
Index: 36, Index: 36,
BetChangeList: 135, BetChangeList: 1350000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 8, BetLevelIndex: 8,
}, },
37: { 37: {
Index: 37, Index: 37,
BetChangeList: 150, BetChangeList: 1500000,
BetSizeIndex: 4, BetSizeIndex: 4,
BetLevelIndex: 9, BetLevelIndex: 9,
}, },
38: { 38: {
Index: 38, Index: 38,
BetChangeList: 160, BetChangeList: 1600000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 3, BetLevelIndex: 3,
}, },
39: { 39: {
Index: 39, Index: 39,
BetChangeList: 200, BetChangeList: 2000000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 4, BetLevelIndex: 4,
}, },
40: { 40: {
Index: 40, Index: 40,
BetChangeList: 240, BetChangeList: 2400000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 5, BetLevelIndex: 5,
}, },
41: { 41: {
Index: 41, Index: 41,
BetChangeList: 280, BetChangeList: 2800000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 6, BetLevelIndex: 6,
}, },
42: { 42: {
Index: 42, Index: 42,
BetChangeList: 320, BetChangeList: 3200000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 7, BetLevelIndex: 7,
}, },
43: { 43: {
Index: 43, Index: 43,
BetChangeList: 360, BetChangeList: 3600000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 8, BetLevelIndex: 8,
}, },
44: { 44: {
Index: 44, Index: 44,
BetChangeList: 400, BetChangeList: 4000000,
BetSizeIndex: 5, BetSizeIndex: 5,
BetLevelIndex: 9, BetLevelIndex: 9,
}, },
45: { 45: {
Index: 45, Index: 45,
BetChangeList: 3, BetChangeList: 30000,
BetSizeIndex: 6, BetSizeIndex: 6,
BetLevelIndex: 0, BetLevelIndex: 0,
}, },
46: { 46: {
Index: 46, Index: 46,
BetChangeList: 5, BetChangeList: 50000,
BetSizeIndex: 7, BetSizeIndex: 7,
BetLevelIndex: 0, BetLevelIndex: 0,
}, },
47: { 47: {
Index: 47, Index: 47,
BetChangeList: 25, BetChangeList: 250000,
BetSizeIndex: 8, BetSizeIndex: 8,
BetLevelIndex: 0, BetLevelIndex: 0,
}, },
48: { 48: {
Index: 48, Index: 48,
BetChangeList: 300, BetChangeList: 3000000,
BetSizeIndex: 9, BetSizeIndex: 9,
BetLevelIndex: 0, BetLevelIndex: 0,
}, },
@ -454,43 +454,43 @@ func init() {
SugarRushBetBetSize = map[int64]*structs.SugarRushBetBetSize{ SugarRushBetBetSize = map[int64]*structs.SugarRushBetBetSize{
0: { 0: {
Index: 0, Index: 0,
BetSize: 100, BetSize: 1000000,
}, },
1: { 1: {
Index: 1, Index: 1,
BetSize: 1000, BetSize: 10000000,
}, },
2: { 2: {
Index: 2, Index: 2,
BetSize: 2000, BetSize: 20000000,
}, },
3: { 3: {
Index: 3, Index: 3,
BetSize: 5000, BetSize: 50000000,
}, },
4: { 4: {
Index: 4, Index: 4,
BetSize: 7500, BetSize: 75000000,
}, },
5: { 5: {
Index: 5, Index: 5,
BetSize: 20000, BetSize: 200000000,
}, },
6: { 6: {
Index: 6, Index: 6,
BetSize: 1500, BetSize: 15000000,
}, },
7: { 7: {
Index: 7, Index: 7,
BetSize: 2500, BetSize: 25000000,
}, },
8: { 8: {
Index: 8, Index: 8,
BetSize: 12500, BetSize: 125000000,
}, },
9: { 9: {
Index: 9, Index: 9,
BetSize: 150000, BetSize: 1500000000,
}, },
} }

View File

@ -6,6 +6,7 @@ import (
"mongo.games.com/game/gamesrv/slotspkg/internal/exported/excel2go/structs" "mongo.games.com/game/gamesrv/slotspkg/internal/exported/excel2go/structs"
"mongo.games.com/game/gamesrv/slotspkg/internal/generic/errors" "mongo.games.com/game/gamesrv/slotspkg/internal/generic/errors"
"mongo.games.com/game/gamesrv/slotspkg/internal/module/shell" "mongo.games.com/game/gamesrv/slotspkg/internal/module/shell"
"sort"
) )
type ( type (
@ -76,28 +77,31 @@ func (n *MachineDesc) BetSizes() []int64 {
for _, list := range betSizeRows { for _, list := range betSizeRows {
lists = append(lists, list.BetSize) lists = append(lists, list.BetSize)
} }
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists return lists
} }
func (n *MachineDesc) BetLevels() []int64 { func (n *MachineDesc) BetLevels() []int64 {
betChangeListRows, ok := n.Sheet("Bet", "BetLevel").(map[int64]*structs.BetLevel) betLevelRows, ok := n.Sheet("Bet", "BetLevel").(map[int64]*structs.BetLevel)
if !ok { if !ok {
panic(errors.ConfigTypeError.ErrorWith(n.Theme, "BetLevel")) panic(errors.ConfigTypeError.ErrorWith(n.Theme, "BetLevel"))
} }
var lists []int64 var lists []int64
for _, list := range betChangeListRows { for _, list := range betLevelRows {
lists = append(lists, list.BetLevel) lists = append(lists, list.BetLevel)
} }
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists return lists
} }
func (n *MachineDesc) BetLines() []int64 { func (n *MachineDesc) BetLines() []int64 {
betChangeListRows, ok := n.Sheet("Bet", "BetLine").(map[int64]*structs.BetLine) betLineRows, ok := n.Sheet("Bet", "BetLine").(map[int64]*structs.BetLine)
if !ok { if !ok {
panic(errors.ConfigTypeError.ErrorWith(n.Theme, "BetLine")) panic(errors.ConfigTypeError.ErrorWith(n.Theme, "BetLine"))
} }
var lists []int64 var lists []int64
for _, list := range betChangeListRows { for _, list := range betLineRows {
lists = append(lists, list.BetLine) lists = append(lists, list.BetLine)
} }
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists return lists
} }
func (n *MachineDesc) BaseBets() []int64 { func (n *MachineDesc) BaseBets() []int64 {
@ -109,6 +113,7 @@ func (n *MachineDesc) BaseBets() []int64 {
for _, list := range baseBetRows { for _, list := range baseBetRows {
lists = append(lists, list.BaseBet) lists = append(lists, list.BaseBet)
} }
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists return lists
} }
func (n *MachineDesc) BetChangeList() []float64 { func (n *MachineDesc) BetChangeList() []float64 {
@ -120,6 +125,7 @@ func (n *MachineDesc) BetChangeList() []float64 {
for _, list := range betChangeListRows { for _, list := range betChangeListRows {
lists = append(lists, list.BetChangeList) lists = append(lists, list.BetChangeList)
} }
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists return lists
} }
func (n *MachineDesc) GetBetIndexByVal(val float64) []int64 { func (n *MachineDesc) GetBetIndexByVal(val float64) []int64 {
@ -134,6 +140,23 @@ func (n *MachineDesc) GetBetIndexByVal(val float64) []int64 {
} }
return nil return nil
} }
func (n *MachineDesc) GetBetIndexByTwoVal(betSizeVal float64, betLevelVal int64) (index []int64) {
betSizes := n.BetSizes()
betLevels := n.BetLevels()
for k, v := range betSizes {
if v == int64(betSizeVal*10000) {
index = append(index, int64(k))
break
}
}
for k, v := range betLevels {
if v == betLevelVal {
index = append(index, int64(k))
break
}
}
return
}
func (n *MachineDesc) GetVector(choice int64, minRatio, maxRatio float64, isForceWin bool) (int64, []int64) { func (n *MachineDesc) GetVector(choice int64, minRatio, maxRatio float64, isForceWin bool) (int64, []int64) {
if vectorIndex := config.GetInt64("slots.vectorIndex"); vectorIndex > 0 { if vectorIndex := config.GetInt64("slots.vectorIndex"); vectorIndex > 0 {
rows := n.DefaultSheet("Vector").([]*structs.Vector) rows := n.DefaultSheet("Vector").([]*structs.Vector)

View File

@ -127,6 +127,9 @@ func (sm *SlotsMgr) Play(s *base.SlotsSession, req *base.SpinReq) (*cli.SlotsPla
if !global.Mock { if !global.Mock {
defer player.PushPlayer(s) defer player.PushPlayer(s)
} }
if res.IsEnd {
m.Close()
}
return res, nil return res, nil
} }
func (*SlotsMgr) PushPlayer(s *base.SlotsSession) map[string]string { func (*SlotsMgr) PushPlayer(s *base.SlotsSession) map[string]string {

View File

@ -24,6 +24,11 @@ func NewMachine(s *base.SlotsSession, theme string, shell *shell.Shell, isFree b
m := &Machine{} m := &Machine{}
m.Entity = entity.NewEntity(s, theme, m, shell, isFree) m.Entity = entity.NewEntity(s, theme, m, shell, isFree)
m.Init() m.Init()
oldMachineInter := m.Session.Value(key.SessionMachine)
if oldMachineInter != nil {
oldMachine := oldMachineInter.(*Machine)
m.Data = oldMachine.Data
}
m.Session.Set(key.SessionMachine, m) m.Session.Set(key.SessionMachine, m)
return m return m
} }

View File

@ -214,6 +214,8 @@ func SugarRushCreateRoomInfoPacket(s *base.Scene, sceneEx *SugarRushSceneData, p
//get data //get data
Response, err := slots.SlotsMgrSington.Enter(playerEx.SlotsSession, int64(s.GameId)) Response, err := slots.SlotsMgrSington.Enter(playerEx.SlotsSession, int64(s.GameId))
if err == nil { if err == nil {
Response.BetSizes = []int64{100, 1000, 2000, 5000, 7500, 20000}
Response.BetChangeList = []float64{}
pi, _ := json.Marshal(Response) pi, _ := json.Marshal(Response)
pack.PlayerInfo = string(pi) pack.PlayerInfo = string(pi)
} else { } else {