gamestate

package
v0.0.0-...-21a16ac Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUpdater

func NewUpdater(gsRepo persist.GameStateRepository,
	reportsRepo persist.ReportsRepository,
	userRepo persist.GameUserRepository,
	notifyRepo persist.NotifyRepository,
	marketRepo persist.MarketRepository,
	worldRepo persist.WorldRepository) *updater

Types

type GameStateUpdaterFn

type GameStateUpdaterFn func(gs *models.GameState, tx *GameTx) error

type GameTx

type GameTx struct {
	Users map[string]*GameTx_User
}

func NewGameTx

func NewGameTx(userId string, gs *models.GameState, latestActivity time.Time) *GameTx

func (*GameTx) InitUser

func (tx *GameTx) InitUser(userId string, gs *models.GameState)

type GameTx_User

type GameTx_User struct {
	Gs             *models.GameState
	PatchMask      *models.PatchMask
	Reports        []*models.Report
	Messages       []*messaging.Message
	LatestActivity time.Time

	NextUpdateInvalidated bool
	StatsInvalidated      bool
	ReportsInvalidated    bool
	CoinsChanged          bool
	PizzasChanged         bool
}

func (*GameTx_User) AppendAppearancePart

func (u *GameTx_User) AppendAppearancePart(val string)

func (*GameTx_User) AppendDiscovery

func (u *GameTx_User) AppendDiscovery(val models.ResearchDiscovery)

func (*GameTx_User) AppendMessage

func (u *GameTx_User) AppendMessage(val *messaging.Message)

func (*GameTx_User) AppendNewMouse

func (u *GameTx_User) AppendNewMouse()

func (*GameTx_User) AppendReport

func (u *GameTx_User) AppendReport(val *models.Report)

func (*GameTx_User) AppendResearchQueue

func (u *GameTx_User) AppendResearchQueue(val *models.OngoingResearch)

func (*GameTx_User) AppendTrainingQueue

func (u *GameTx_User) AppendTrainingQueue(val *models.Training)

func (*GameTx_User) ConstructBuilding

func (u *GameTx_User) ConstructBuilding(lotId string, building models.Building, level int32)

func (*GameTx_User) IncrCoins

func (u *GameTx_User) IncrCoins(val int32)

func (*GameTx_User) IncrGeniusFlashes

func (u *GameTx_User) IncrGeniusFlashes(val int32)

func (*GameTx_User) IncrPizzas

func (u *GameTx_User) IncrPizzas(val int32)

func (*GameTx_User) RazeBuilding

func (u *GameTx_User) RazeBuilding(lotId string)

func (*GameTx_User) RemoveMouseByEducation

func (u *GameTx_User) RemoveMouseByEducation(isEducated bool, education models.Education) bool

func (*GameTx_User) SetAmbassadorMouse

func (u *GameTx_User) SetAmbassadorMouse(mouseId string)

func (*GameTx_User) SetCoins

func (u *GameTx_User) SetCoins(val int32)

func (*GameTx_User) SetConstructionQueue

func (u *GameTx_User) SetConstructionQueue(val []*models.Construction)

func (*GameTx_User) SetGeniusFlashes

func (u *GameTx_User) SetGeniusFlashes(val int32)

func (*GameTx_User) SetMouseAppearance

func (u *GameTx_User) SetMouseAppearance(mouseId string, appearance *models.MouseAppearance)

func (*GameTx_User) SetMouseEducation

func (u *GameTx_User) SetMouseEducation(mouseId string, education models.Education)

func (*GameTx_User) SetMouseIsBeingEducated

func (u *GameTx_User) SetMouseIsBeingEducated(mouseId string, val bool)

func (*GameTx_User) SetMouseUneducated

func (u *GameTx_User) SetMouseUneducated(mouseId string)

func (*GameTx_User) SetPizzaPrice

func (u *GameTx_User) SetPizzaPrice(val int32)

func (*GameTx_User) SetPizzas

func (u *GameTx_User) SetPizzas(val int32)

func (*GameTx_User) SetQuestAvailable

func (u *GameTx_User) SetQuestAvailable(questId string)

func (*GameTx_User) SetQuestClaimedReward

func (u *GameTx_User) SetQuestClaimedReward(questId string)

func (*GameTx_User) SetQuestCompleted

func (u *GameTx_User) SetQuestCompleted(questId string)

func (*GameTx_User) SetResearchQueue

func (u *GameTx_User) SetResearchQueue(val []*models.OngoingResearch)

func (*GameTx_User) SetStreak

func (u *GameTx_User) SetStreak(lotId string, val int32)

func (*GameTx_User) SetTappedAt

func (u *GameTx_User) SetTappedAt(lotId string, val int64)

func (*GameTx_User) SetTaps

func (u *GameTx_User) SetTaps(lotId string, val int32)

func (*GameTx_User) SetTimestamp

func (u *GameTx_User) SetTimestamp(val int64)

func (*GameTx_User) SetTrainingQueue

func (u *GameTx_User) SetTrainingQueue(val []*models.Training)

func (*GameTx_User) SetTravelQueue

func (u *GameTx_User) SetTravelQueue(val []*models.Travel)

func (*GameTx_User) ToServerMessage

func (u *GameTx_User) ToServerMessage() *models.ServerMessage

type Updater

type Updater interface {
	PerformUpdate(ctx context.Context, userId string, updater GameStateUpdaterFn) (*GameTx, error)
}

Jump to

Keyboard shortcuts

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