mock

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type LocalizedString

type LocalizedString struct {
	Lang string
	ID   int
	Text string
}

type MultiEntry

type MultiEntry struct {
	ID    int
	Multi *ultima.Multi
}

type SDK

type SDK struct {
	LandsMap       map[int]*ultima.Land
	ItemsMap       map[int]*ultima.Item
	GumpsMap       map[int]*ultima.Gump
	HuesMap        map[int]*ultima.Hue
	LightsMap      map[int]ultima.Light
	RadarColorMap  map[int]ultima.RadarColor
	SkillsMap      map[int]*ultima.Skill
	SkillGroupsMap map[int]*ultima.SkillGroup
	SoundsMap      map[int]*ultima.Sound
	TexturesMap    map[int]*ultima.Texture
	SpeechMap      map[int]ultima.Speech
	StringsMap     map[string]map[int]string
	MultisMap      map[int]*ultima.Multi
	MapsMap        map[int]*TileMap
	UnicodeFont    ultima.Font
	Fonts          []ultima.Font
	// contains filtered or unexported fields
}

SDK is a lightweight in-memory implementation of the ultima.Interface.

func New

func New() *SDK

New creates an empty mock SDK.

func Open

func Open(_ string) (*SDK, error)

Open mirrors ultima.Open but simply returns an empty SDK.

func (*SDK) Add

func (s *SDK) Add(v any)

Add registers the given value into the mock SDK.

func (*SDK) Animation

func (s *SDK) Animation(body, action, direction, hue int, preserveHue, firstFrame bool) (*ultima.Animation, error)

Animation returns a stored animation if present.

func (*SDK) BasePath

func (*SDK) BasePath() string

BasePath returns an empty string.

func (*SDK) Close

func (*SDK) Close() error

Close is a no-op for the mock SDK.

func (*SDK) Font

func (s *SDK) Font() ([]ultima.Font, error)

func (*SDK) FontUnicode

func (s *SDK) FontUnicode(int) (ultima.Font, error)

func (*SDK) Gump

func (s *SDK) Gump(id int) (*ultima.Gump, error)

func (*SDK) Gumps

func (s *SDK) Gumps() iter.Seq[*ultima.Gump]

func (*SDK) Hue

func (s *SDK) Hue(index int) (*ultima.Hue, error)

func (*SDK) Hues

func (s *SDK) Hues() iter.Seq[*ultima.Hue]

func (*SDK) Item

func (s *SDK) Item(id int) (*ultima.Item, error)

Item returns a stored item tile.

func (*SDK) Items

func (s *SDK) Items() iter.Seq[*ultima.Item]

Items iterates over stored items.

func (*SDK) Land

func (s *SDK) Land(id int) (*ultima.Land, error)

Land returns a stored land tile.

func (*SDK) Lands

func (s *SDK) Lands() iter.Seq[*ultima.Land]

Lands iterates over stored lands.

func (*SDK) Light

func (s *SDK) Light(id int) (ultima.Light, error)

func (*SDK) Lights

func (s *SDK) Lights() iter.Seq[ultima.Light]

func (*SDK) Map

func (s *SDK) Map(mapID int) (*TileMap, error)

func (*SDK) Multi

func (s *SDK) Multi(id int) (*ultima.Multi, error)

func (*SDK) MultiFromCSV

func (s *SDK) MultiFromCSV(data []byte) (*ultima.Multi, error)

func (*SDK) RadarColor

func (s *SDK) RadarColor(tileID int) (ultima.RadarColor, error)

func (*SDK) RadarColors

func (s *SDK) RadarColors() iter.Seq[ultima.RadarColor]

func (*SDK) Skill

func (s *SDK) Skill(id int) (*ultima.Skill, error)

func (*SDK) SkillGroup

func (s *SDK) SkillGroup(id int) (*ultima.SkillGroup, error)

func (*SDK) SkillGroups

func (s *SDK) SkillGroups() iter.Seq[*ultima.SkillGroup]

func (*SDK) Skills

func (s *SDK) Skills() iter.Seq[*ultima.Skill]

func (*SDK) Sound

func (s *SDK) Sound(index int) (*ultima.Sound, error)

func (*SDK) Sounds

func (s *SDK) Sounds() func(yield func(*ultima.Sound) bool)

func (*SDK) SpeechEntries

func (s *SDK) SpeechEntries() iter.Seq[ultima.Speech]

func (*SDK) SpeechEntry

func (s *SDK) SpeechEntry(id int) (ultima.Speech, error)

func (*SDK) String

func (s *SDK) String(id int) (string, error)

String retrieves a string in default language "enu".

func (*SDK) StringEntry

func (s *SDK) StringEntry(id int, lang string) (ultima.StringEntry, error)

StringEntry returns a StringEntry for the given id and lang.

func (*SDK) StringWithLang

func (s *SDK) StringWithLang(id int, lang string) (string, error)

StringWithLang retrieves a localized string.

func (*SDK) Strings

func (s *SDK) Strings() iter.Seq2[int, string]

Strings iterates over English strings.

func (*SDK) StringsWithLang

func (s *SDK) StringsWithLang(lang string) iter.Seq2[int, string]

StringsWithLang iterates over strings for a language.

func (*SDK) Text added in v0.0.9

func (s *SDK) Text(font ultima.Font, text string, hue int) image.Image

func (*SDK) Texture

func (s *SDK) Texture(index int) (*ultima.Texture, error)

func (*SDK) Textures

func (s *SDK) Textures() func(yield func(*ultima.Texture) bool)

type TileMap

type TileMap struct {
	ID     int
	Width  int
	Height int
	Tiles  map[[2]int]*ultima.Tile
}

TileMap is a minimal in-memory implementation of ultima.TileMap.

func (*TileMap) Image

func (m *TileMap) Image() (image.Image, error)

Image returns a blank image of the correct size.

func (*TileMap) TileAt

func (m *TileMap) TileAt(x, y int) (*ultima.Tile, error)

TileAt retrieves a stored tile.

Jump to

Keyboard shortcuts

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