This commit is contained in:
tomas 2025-02-27 13:41:16 +08:00
parent 5fd2a05f24
commit 107799f46b
2 changed files with 31 additions and 9 deletions

View File

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

View File

@ -6,6 +6,7 @@ import (
"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/module/shell"
"sort"
)
type (
@ -76,28 +77,31 @@ func (n *MachineDesc) BetSizes() []int64 {
for _, list := range betSizeRows {
lists = append(lists, list.BetSize)
}
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists
}
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 {
panic(errors.ConfigTypeError.ErrorWith(n.Theme, "BetLevel"))
}
var lists []int64
for _, list := range betChangeListRows {
for _, list := range betLevelRows {
lists = append(lists, list.BetLevel)
}
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists
}
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 {
panic(errors.ConfigTypeError.ErrorWith(n.Theme, "BetLine"))
}
var lists []int64
for _, list := range betChangeListRows {
for _, list := range betLineRows {
lists = append(lists, list.BetLine)
}
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists
}
func (n *MachineDesc) BaseBets() []int64 {
@ -109,6 +113,7 @@ func (n *MachineDesc) BaseBets() []int64 {
for _, list := range baseBetRows {
lists = append(lists, list.BaseBet)
}
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists
}
func (n *MachineDesc) BetChangeList() []float64 {
@ -120,6 +125,7 @@ func (n *MachineDesc) BetChangeList() []float64 {
for _, list := range betChangeListRows {
lists = append(lists, list.BetChangeList)
}
sort.Slice(lists, func(i, j int) bool { return lists[i] < lists[j] })
return lists
}
func (n *MachineDesc) GetBetIndexByVal(val float64) []int64 {
@ -134,6 +140,23 @@ func (n *MachineDesc) GetBetIndexByVal(val float64) []int64 {
}
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) {
if vectorIndex := config.GetInt64("slots.vectorIndex"); vectorIndex > 0 {
rows := n.DefaultSheet("Vector").([]*structs.Vector)