Documentation ¶
Index ¶
- Constants
- func Equip(game *Game, player *gameobject.Player, item *api.Item) error
- func EvaluateEffects(g *Game, effects []*api.Effect, a *api.Attributes, receiver gameobject.Alive) ([]*api.Effect, error)
- func ExecuteAssignSkillPoints(player *gameobject.Player, a *api.Attributes) error
- func ExecuteBuy(game *Game, p *gameobject.Player, identifiers *api.Identifiers) error
- func ExecutePickUp(game *Game, p *gameobject.Player, i *api.Identifier) error
- func ExecuteSkill(game *Game, player gameobject.Skiller, su *api.SkillUse) error
- func ExecuteYell(game *Game, p gameobject.Positioner, message *api.Message) error
- func HideNonPublicMonsterFields(g *Game, m *api.Monster)
- func IsMapDeprecated(mm *LevelCache, t int32, l int32) bool
- func LevelAgeTimeout(l int32) int32
- func LevelsPostProcessing(g *Game, m *api.Map, mapCache *MapCache) error
- func ParseMap(mapJson string) (*api.Map, error)
- func RemoveMonsterFromTile(o *api.MapObjects, m *gameobject.Monster)
- func RemovePlayerFromTile(o *api.MapObjects, p *gameobject.Player)
- func TilesInRange(game *Game, startingPosition *api.Coordinates, rng int32) []*api.MapObjects
- func ValidateBuy(game *Game, p *gameobject.Player, identifiers *api.Identifiers) error
- type Game
- func (g *Game) AddItem(item *api.Item)
- func (g *Game) AddLevel(level int32)
- func (g *Game) AddLevels(start int32, end int32)
- func (g *Game) AddPlayer(player *gameobject.Player, registration *api.Registration)
- func (g *Game) AlwaysGetObjectsOnPosition(c *api.Coordinates) (*api.MapObjects, error)
- func (g *Game) ForceMoveCharacter(p gameobject.Positioner, c *api.Coordinates) error
- func (g *Game) GetCachedLevel(level int32) (*LevelCache, error)
- func (g *Game) GetCommands(pId string) *api.CommandsBatch
- func (g *Game) GetCurrentPlayer(token string) (*gameobject.Player, error)
- func (g *Game) GetMapObjectsOrCreateDefault(c *api.Coordinates) *api.MapObjects
- func (g *Game) GetMoney() int32
- func (g *Game) GetObjectById(id string) (gameobject.Ider, error)
- func (g *Game) GetObjectsOnPosition(c *api.Coordinates) (*api.MapObjects, error)
- func (g *Game) GetPlayerByKey(apiKey string) (*gameobject.Player, error)
- func (g *Game) LogEvent(event *api.Event)
- func (g *Game) MarkVisitedLevel(level int32)
- func (g *Game) MoveCharacter(p gameobject.Positioner, c *api.Coordinates) error
- func (g *Game) Register(o gameobject.Ider)
- func (g *Game) Respawn(player *gameobject.Player, markDeath bool)
- func (g *Game) SortMaps()
- func (g *Game) SpawnPlayer(p *gameobject.Player, level int32)
- func (g *Game) Unregister(o gameobject.Ider)
- func (g *Game) WaitForNextTick(tick int32)
- type LevelCache
- type MapCache
Constants ¶
View Source
const LoopTime = time.Second
Variables ¶
This section is empty.
Functions ¶
func EvaluateEffects ¶
func EvaluateEffects(g *Game, effects []*api.Effect, a *api.Attributes, receiver gameobject.Alive) ([]*api.Effect, error)
func ExecuteAssignSkillPoints ¶
func ExecuteAssignSkillPoints(player *gameobject.Player, a *api.Attributes) error
func ExecuteBuy ¶
func ExecuteBuy(game *Game, p *gameobject.Player, identifiers *api.Identifiers) error
func ExecutePickUp ¶
func ExecutePickUp(game *Game, p *gameobject.Player, i *api.Identifier) error
func ExecuteSkill ¶
func ExecuteYell ¶
func ExecuteYell(game *Game, p gameobject.Positioner, message *api.Message) error
func IsMapDeprecated ¶
func IsMapDeprecated(mm *LevelCache, t int32, l int32) bool
func LevelAgeTimeout ¶
func LevelsPostProcessing ¶
func RemoveMonsterFromTile ¶
func RemoveMonsterFromTile(o *api.MapObjects, m *gameobject.Monster)
func RemovePlayerFromTile ¶
func RemovePlayerFromTile(o *api.MapObjects, p *gameobject.Player)
func TilesInRange ¶
func TilesInRange(game *Game, startingPosition *api.Coordinates, rng int32) []*api.MapObjects
func ValidateBuy ¶
func ValidateBuy(game *Game, p *gameobject.Player, identifiers *api.Identifiers) error
ValidateBuy validates identifiers, funds, and requirements
Types ¶
type Game ¶
type Game struct { // Gained after kill (may be used in the next run) Score float32 `json:"score"` Players map[string]*gameobject.Player `json:"-"` ApiKeyToPlayer map[string]*gameobject.Player `json:"player_api_keys"` MaxLevelReached int32 `json:"max_reached_level"` Game api.GameState `json:"-"` GameLock sync.RWMutex `json:"-"` CommandsLock sync.RWMutex `json:"-"` TickCond *sync.Cond `json:"-"` Commands map[string]*api.CommandsBatch `json:"-"` Respawns []*gameobject.Player `json:"-"` // contains filtered or unexported fields }
func CreateGame ¶
func (*Game) AddPlayer ¶
func (g *Game) AddPlayer(player *gameobject.Player, registration *api.Registration)
func (*Game) AlwaysGetObjectsOnPosition ¶
func (g *Game) AlwaysGetObjectsOnPosition(c *api.Coordinates) (*api.MapObjects, error)
func (*Game) ForceMoveCharacter ¶
func (g *Game) ForceMoveCharacter(p gameobject.Positioner, c *api.Coordinates) error
func (*Game) GetCachedLevel ¶
func (g *Game) GetCachedLevel(level int32) (*LevelCache, error)
func (*Game) GetCommands ¶
func (g *Game) GetCommands(pId string) *api.CommandsBatch
func (*Game) GetCurrentPlayer ¶
func (g *Game) GetCurrentPlayer(token string) (*gameobject.Player, error)
func (*Game) GetMapObjectsOrCreateDefault ¶
func (g *Game) GetMapObjectsOrCreateDefault(c *api.Coordinates) *api.MapObjects
func (*Game) GetObjectById ¶
func (g *Game) GetObjectById(id string) (gameobject.Ider, error)
func (*Game) GetObjectsOnPosition ¶
func (g *Game) GetObjectsOnPosition(c *api.Coordinates) (*api.MapObjects, error)
func (*Game) GetPlayerByKey ¶
func (g *Game) GetPlayerByKey(apiKey string) (*gameobject.Player, error)
func (*Game) MarkVisitedLevel ¶
func (*Game) MoveCharacter ¶
func (g *Game) MoveCharacter(p gameobject.Positioner, c *api.Coordinates) error
MoveCharacter The coordinates must include level.
func (*Game) Register ¶
func (g *Game) Register(o gameobject.Ider)
func (*Game) SpawnPlayer ¶
func (g *Game) SpawnPlayer(p *gameobject.Player, level int32)
func (*Game) Unregister ¶
func (g *Game) Unregister(o gameobject.Ider)
func (*Game) WaitForNextTick ¶
type LevelCache ¶
type LevelCache struct { SpawnPoint *api.Coordinates Width int32 Height int32 Objects map[int32]map[int32]*api.MapObjects Grid *paths.Grid GeneratedTick int32 LastInteractedTick int32 Fow map[int32]map[int32]bool }
func (*LevelCache) CacheObjectsOnPosition ¶
func (lc *LevelCache) CacheObjectsOnPosition(p *api.Coordinates, mo *api.MapObjects) *api.MapObjects
type MapCache ¶
type MapCache struct {
Level map[int32]*LevelCache
}
func (*MapCache) CachedLevel ¶
func (m *MapCache) CachedLevel(l int32) (*LevelCache, error)
func (*MapCache) ClearLevelCache ¶
Click to show internal directories.
Click to hide internal directories.