executor

package
Version: v1.65.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: BSD-3-Clause Imports: 13 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// PokerbullResultX1 赌注倍数1倍
	PokerbullResultX1 = 1
	// PokerbullResultX2 赌注倍数2倍
	PokerbullResultX2 = 2
	// PokerbullResultX3 赌注倍数3倍
	PokerbullResultX3 = 3
	// PokerbullResultX4 赌注倍数4倍
	PokerbullResultX4 = 4
	// PokerbullResultX5 赌注倍数5倍
	PokerbullResultX5 = 5
	// PokerbullLeverageMax 赌注倍数最大倍数
	PokerbullLeverageMax = PokerbullResultX1
)

Variables

View Source
var CardNumPerColor = 13

CardNumPerColor 每种花色的牌数

View Source
var CardNumPerGame = 5

CardNumPerGame 一手牌的牌数

View Source
var ColorBitMask = 0xFF

ColorBitMask 牌花色bit掩码

View Source
var ColorOffset uint32 = 8

ColorOffset 牌花色偏移

View Source
var PokerCardNum = 52

PokerCardNum 牌数,4 * 13 不带大小王

Functions

func Compare

func Compare(a []int32, b []int32) bool

Compare 比较两手牌的斗牛结果

func CompareResult

func CompareResult(i, j *types.PBHand) bool

CompareResult 两手牌比较结果

func Deal

func Deal(poker *types.PBPoker, rng int64) []int32

Deal 发牌

func GetName

func GetName() string

GetName 获取斗牛执行器名

func Infos

func Infos(db dbm.KV, infos *pkt.QueryPBGameInfos) (types.Message, error)

Infos 获取gameinfo

func Init

func Init(name string, cfg *types.Chain33Config, sub []byte)

Init 执行器初始化

func InitExecType

func InitExecType()

InitExecType ...

func Key

func Key(id string) (key []byte)

Key 获取key值

func Leverage

func Leverage(hand *types.PBHand) int32

Leverage 计算结果倍数

func NewPoker

func NewPoker() *types.PBPoker

NewPoker 创建一副牌

func Result

func Result(cards []int32) int32

Result 计算斗牛结果

func Shuffle

func Shuffle(poker *types.PBPoker, rng int64)

Shuffle 洗牌

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action 斗牛action结构

func NewAction

func NewAction(pb *PokerBull, tx *types.Transaction, index int) *Action

NewAction 创建action

func (*Action) CheckExecAccountBalance

func (action *Action) CheckExecAccountBalance(fromAddr string, ToFrozen, ToActive int64) bool

CheckExecAccountBalance 检查账户余额

func (*Action) GameContinue

func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Receipt, error)

GameContinue 继续游戏

func (*Action) GamePlay

func (action *Action) GamePlay(pbplay *pkt.PBGamePlay) (*types.Receipt, error)

GamePlay 已匹配玩家直接游戏

func (*Action) GameQuit

func (action *Action) GameQuit(pbquit *pkt.PBGameQuit) (*types.Receipt, error)

GameQuit 退出游戏

func (*Action) GameStart

func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)

GameStart 游戏开始

func (*Action) GetReceiptLog

func (action *Action) GetReceiptLog(game *pkt.PokerBull) *types.ReceiptLog

GetReceiptLog 获取receipt日志

type HandSlice

type HandSlice []*pkt.PBHand

HandSlice 一手牌

func (HandSlice) Len

func (h HandSlice) Len() int

func (HandSlice) Less

func (h HandSlice) Less(i, j int) bool

func (HandSlice) Swap

func (h HandSlice) Swap(i, j int)

type PokerBull

type PokerBull struct {
	drivers.DriverBase
}

PokerBull 斗牛执行器结构

func (*PokerBull) CheckReceiptExecOk

func (g *PokerBull) CheckReceiptExecOk() bool

CheckReceiptExecOk return true to check if receipt ty is ok

func (*PokerBull) ExecDelLocal_Continue

func (g *PokerBull) ExecDelLocal_Continue(payload *pkt.PBGameContinue, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Continue 继续游戏交易回滚

func (*PokerBull) ExecDelLocal_Quit

func (g *PokerBull) ExecDelLocal_Quit(payload *pkt.PBGameQuit, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Quit 退出游戏交易回滚

func (*PokerBull) ExecDelLocal_Start

func (g *PokerBull) ExecDelLocal_Start(payload *pkt.PBGameStart, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Start 开始游戏交易回滚

func (*PokerBull) ExecLocal_Continue

func (c *PokerBull) ExecLocal_Continue(payload *pkt.PBGameContinue, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Continue 继续游戏交易local执行

func (*PokerBull) ExecLocal_Play

func (c *PokerBull) ExecLocal_Play(payload *pkt.PBGamePlay, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Play 已匹配游戏交易local执行

func (*PokerBull) ExecLocal_Quit

func (c *PokerBull) ExecLocal_Quit(payload *pkt.PBGameQuit, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Quit 退出游戏交易local执行

func (*PokerBull) ExecLocal_Start

func (c *PokerBull) ExecLocal_Start(payload *pkt.PBGameStart, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Start 开始游戏交易local执行

func (*PokerBull) Exec_Continue

func (c *PokerBull) Exec_Continue(payload *pkt.PBGameContinue, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Continue 继续游戏交易执行

func (*PokerBull) Exec_Play

func (c *PokerBull) Exec_Play(payload *pkt.PBGamePlay, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Play 已匹配玩家直接开始游戏

func (*PokerBull) Exec_Quit

func (c *PokerBull) Exec_Quit(payload *pkt.PBGameQuit, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Quit 退出游戏交易执行

func (*PokerBull) Exec_Start

func (c *PokerBull) Exec_Start(payload *pkt.PBGameStart, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Start 开始游戏交易执行

func (*PokerBull) ExecutorOrder

func (g *PokerBull) ExecutorOrder() int64

ExecutorOrder 设置localdb的EnableRead

func (*PokerBull) GetDriverName

func (g *PokerBull) GetDriverName() string

GetDriverName 获取斗牛执行器名

func (*PokerBull) Query_QueryGameByAddr

func (g *PokerBull) Query_QueryGameByAddr(in *pkt.QueryPBGameInfo) (types.Message, error)

Query_QueryGameByAddr 根据地址查询游戏

func (*PokerBull) Query_QueryGameByID

func (g *PokerBull) Query_QueryGameByID(in *pkt.QueryPBGameInfo) (types.Message, error)

Query_QueryGameByID 根据id查询游戏

func (*PokerBull) Query_QueryGameByRound

func (g *PokerBull) Query_QueryGameByRound(in *pkt.QueryPBGameByRound) (types.Message, error)

Query_QueryGameByRound 查询某一回合游戏结果

func (*PokerBull) Query_QueryGameByStatus

func (g *PokerBull) Query_QueryGameByStatus(in *pkt.QueryPBGameInfo) (types.Message, error)

Query_QueryGameByStatus 根据状态查询游戏

func (*PokerBull) Query_QueryGameListByIDs

func (g *PokerBull) Query_QueryGameListByIDs(in *pkt.QueryPBGameInfos) (types.Message, error)

Query_QueryGameListByIDs 根据id列表查询游戏

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL