mons

package
v0.0.0-...-058f036 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(client taprpc.TaprootAssetsClient) *Manager

func (*Manager) IndexMons

func (m *Manager) IndexMons() error

IndexMons will index all monsters

func (*Manager) MintMon

func (m *Manager) MintMon(ctx context.Context, name string) (*Mon, error)

MintMon will mint a new monster

type Mon

type Mon struct {
	Id     []byte
	Scores []uint8
	Types  []string
	Level  int
	Nonce  int
}

func GenerateMonster

func GenerateMonster(blockHash, txHash *chainhash.Hash) (*Mon, error)

func (*Mon) CalculateRarityScore

func (m *Mon) CalculateRarityScore(index int) float64

CalculateRarityScore calculates the rarity score of the monster based on the first n attributes. The score is scaled to be between 0 and 1.

func (*Mon) GetLevelNonce

func (m *Mon) GetLevelNonce(ctx context.Context, targetLevel,
	startNonce int) int

func (*Mon) String

func (m *Mon) String() string

String returns a string representation of the monster.

func (*Mon) VerifyLevelUp

func (m *Mon) VerifyLevelUp(targetLevel int, nonce int) bool

VerifyLevelUp verifies that the level-up was performed correctly by checking if the hash of the combined hash and nonce produces a hash with the required number of leading zeros.

type MonMetadata

type MonMetadata struct {
	MonVersion uint32 `json:"mon_version"`
}

Jump to

Keyboard shortcuts

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