| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- package common
- import (
- "fmt"
- "bet24.com/servers/games/luckyfruit_table/config"
- userservices "bet24.com/servers/micros/userservices/proto"
- )
- const (
- GAMEID = 39
- GAME_NAME = "luckyfruit"
- )
- const (
- GameState_Bet = iota
- GameState_Open
- )
- const (
- TIMERID_CHECKROBOT = iota
- )
- type UserSetScore struct {
- UserId int
- Score int
- }
- type GameState struct {
- RoomName string
- SerialNumber int
- State int // 当前状态
- Sec int // 当前阶段已使用时间
- SpinResult Fruit // 本局开奖结果
- Historys []config.OpenHistory // 历史纪录
- TableUser ScoreUsers // 幸运星和赢金榜的玩家
- //RichList []int //富豪榜
- BetList []int //下注榜
- //Scores []UserSetScore // 结算阶段,广播所有人的分数,给桌面玩家或者自己头像飘分用 水果机不需要 只飘自己的分数
- BetCmds []Bet // 本局下注列表
- }
- type BetBase struct {
- BetId int
- Amount int
- IsFree bool
- IsRobot bool `json:"-"`
- }
- type Bet struct {
- BetBase
- UserId int
- Index int // 添加一个索引,用于失败撤销
- }
- type Batch_Bet struct {
- UserId int
- Bets []BetBase
- }
- type RankingUser struct {
- UserId int
- Score int
- }
- // 是否相同下注类型
- func (b *Bet) IsSameBet(b2 *Bet) bool {
- return b.BetId == b2.BetId && b.IsFree == b2.IsFree
- }
- type BetRet struct {
- ErrorMsg string
- }
- type Result struct {
- Bet
- WinAmount int
- SpinResult Fruit
- WinArea Fruit
- Tax int
- }
- type RecordInfo struct {
- SpinResult Fruit
- SerialNumber int
- }
- type UserClear struct {
- RoomName string
- UserId int
- }
- // 连胜用户和累计下注用户
- type ScoreUser struct {
- UserId int
- NickName string
- FaceId int
- FaceUrl string
- VipLevel int
- VipExpire int
- Decorations []userservices.UserDecoration
- IsRobot bool `json:"-"`
- Info []int
- BetAmount int
- }
- type ScoreUsers struct {
- //LuckyStarUsers []ScoreUser
- WinGoldRankingUsers []ScoreUser
- BetGoldRankingUsers []ScoreUser
- }
- func IsInTopN(rankList []ScoreUser, userId, n int) bool {
- for i, v := range rankList {
- if i >= n {
- break
- }
- if v.UserId == userId {
- return true
- }
- }
- return false
- }
- func GetRedisKey(key string) string {
- return fmt.Sprintf("%s:%s", GAME_NAME, key)
- }
|