things

package
v0.0.0-...-63dc931 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnimationOneShot       = AnimationKind(0)
	AnimationOneShotRemove = AnimationKind(1)
	AnimationLoop          = AnimationKind(2)
	AnimationLoopAndFade   = AnimationKind(3)
	AnimationRandom        = AnimationKind(4)
	AnimationSlave         = AnimationKind(5)
)
View Source
const (
	SpellFlagUnk1       = SpellFlags(0x1)        // 1
	SpellDuration       = SpellFlags(0x2)        // 2
	SpellTargeted       = SpellFlags(0x4)        // 4
	SpellAtLocation     = SpellFlags(0x8)        // 8
	SpellMobsCanCast    = SpellFlags(0x10)       // 16
	SpellOffensive      = SpellFlags(0x20)       // 32
	SpellFlagUnk7       = SpellFlags(0x40)       // 64
	SpellFlagUnk8       = SpellFlags(0x80)       // 128
	SpellInstant        = SpellFlags(0x100)      // 256
	SpellDefensive      = SpellFlags(0x200)      // 512
	SpellFlagUnk11      = SpellFlags(0x400)      // 1024
	SpellFlagUnk12      = SpellFlags(0x800)      // 2048
	SpellSummonMain     = SpellFlags(0x1000)     // 4096
	SpellSummonCreature = SpellFlags(0x2000)     // 8192
	SpellMarkMain       = SpellFlags(0x4000)     // 16384
	SpellMarkNumber     = SpellFlags(0x8000)     // 32768
	SpellGotoMarkMain   = SpellFlags(0x10000)    // 65536
	SpellGotoMarkNumber = SpellFlags(0x20000)    // 131072
	SpellCanCounter     = SpellFlags(0x40000)    // 262144
	SpellCantHoldCrown  = SpellFlags(0x80000)    // 524288
	SpellFlagUnk21      = SpellFlags(0x100000)   // 1048576
	SpellCantTargetSelf = SpellFlags(0x200000)   // 2097152
	SpellNoTrap         = SpellFlags(0x400000)   // 4194304
	SpellNoMana         = SpellFlags(0x800000)   // 8388608
	SpellClassAny       = SpellFlags(0x1000000)  // 16777216
	SpellClassWizard    = SpellFlags(0x2000000)  // 33554432
	SpellClassConjurer  = SpellFlags(0x4000000)  // 67108864
	SpellFlagUnk28      = SpellFlags(0x8000000)  // 134217728
	SpellFlagUnk29      = SpellFlags(0x10000000) // 268435456
	SpellFlagUnk30      = SpellFlags(0x20000000) // 536870912
	SpellFlagUnk31      = SpellFlags(0x40000000) // 1073741824
	SpellFlagUnk32      = SpellFlags(0x80000000) // 2147483648
)
View Source
const (
	MonsterAnimSpecial3  = MonsterAnimationType(0) // TODO static?
	MonsterAnimMelee     = MonsterAnimationType(1)
	MonsterAnimMeleeEnd  = MonsterAnimationType(2)
	MonsterAnimRanged    = MonsterAnimationType(3)
	MonsterAnimRangedEnd = MonsterAnimationType(4)
	MonsterAnimDefend    = MonsterAnimationType(5)
	MonsterAnimDefendEnd = MonsterAnimationType(6)
	MonsterAnimCast      = MonsterAnimationType(7)
	MonsterAnimIdle      = MonsterAnimationType(8)
	MonsterAnimDie       = MonsterAnimationType(9)
	MonsterAnimDead      = MonsterAnimationType(10)
	MonsterAnimHurt      = MonsterAnimationType(11)
	MonsterAnimWalk      = MonsterAnimationType(12)
	MonsterAnimRun       = MonsterAnimationType(13)
	MonsterAnimSpecial1  = MonsterAnimationType(14)
	MonsterAnimSpecial2  = MonsterAnimationType(15)
)

Variables

This section is empty.

Functions

func WriteSpellsYAML

func WriteSpellsYAML(path string, list []Spell) error

Types

type AnimateDraw

type AnimateDraw struct {
	Anim Animation `json:"anim"`
}

type Animation

type Animation struct {
	Field  byte          `json:"field"`
	Kind   AnimationKind `json:"kind"`
	Frames []ImageRef    `json:"frames"`
}

type AnimationKind

type AnimationKind int

func (AnimationKind) MarshalText

func (k AnimationKind) MarshalText() ([]byte, error)

func (AnimationKind) String

func (k AnimationKind) String() string

func (*AnimationKind) UnmarshalText

func (k *AnimationKind) UnmarshalText(text []byte) error

type ArmorAnimateDraw

type ArmorAnimateDraw struct {
	Anim Animation `json:"armor_anim"`
}

type ArmorDraw

type ArmorDraw struct {
	Img ImageRef `json:"armor"`
}

type BaseDraw

type BaseDraw struct {
	Img ImageRef `json:"base"`
}

type Box

type Box struct {
	W float32 `json:"w"`
	H float32 `json:"h"`
}

type Center

type Center struct{}

type Circle

type Circle struct {
	R float32 `json:"r"`
}

type Class

type Class string

type ConditionalAnimateDraw

type ConditionalAnimateDraw struct {
	Anims []Animation `json:"cond_anim"`
}

type Data

type Data struct {
	Images []Image `json:"images,omitempty"`
	Things []Thing `json:"things,omitempty"`
	Spells []Spell `json:"spells,omitempty"`
	Walls  []Wall  `json:"walls,omitempty"`
}

type DoorDraw

type DoorDraw struct {
	Imgs []ImageRef `json:"door"`
}

type Draw

type Draw interface {
	// contains filtered or unexported methods
}

type Extent

type Extent interface {
	// contains filtered or unexported methods
}

func ParseExtent

func ParseExtent(val string) (Extent, error)

type Flag

type Flag string

type FlagDraw

type FlagDraw struct {
	Anim Animation `json:"flag"`
}

type GlyphDraw

type GlyphDraw struct {
	Anim Animation `json:"glyph"`
}

type Image

type Image struct {
	Name string     `json:"name"`
	Img  *ImageRef  `json:"img,omitempty"`
	Ani  *Animation `json:"ani,omitempty"`
}

type ImageRef

type ImageRef struct {
	Ind  int    `json:"ind,omitempty" yaml:"ind,omitempty"`
	Ind2 int    `json:"ind_2,omitempty" yaml:"ind_2,omitempty"`
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

func (ImageRef) MarshalJSON

func (ii ImageRef) MarshalJSON() ([]byte, error)

func (*ImageRef) UnmarshalJSON

func (ii *ImageRef) UnmarshalJSON(p []byte) error

type MaidenDraw

type MaidenDraw struct {
	Anims []MonsterAnimation `json:"maiden"`
}

type Material

type Material string

type MissilesSpell

type MissilesSpell struct {
	Count       int     `json:"count,omitempty" yaml:"count,omitempty"`
	Spread      uint16  `json:"spread,omitempty" yaml:"spread,omitempty"`
	Projectile  string  `json:"projectile,omitempty" yaml:"projectile,omitempty"`
	VelMult     float32 `json:"vel_mult,omitempty" yaml:"vel_mult,omitempty"`
	Offset      float32 `json:"offset,omitempty" yaml:"offset,omitempty"`
	SpeedRndMin float64 `json:"speed_rnd_min,omitempty" yaml:"speed_rnd_min,omitempty"`
	SpeedRndMax float64 `json:"speed_rnd_max,omitempty" yaml:"speed_rnd_max,omitempty"`
	SearchDist  float32 `json:"search_dist,omitempty" yaml:"search_dist,omitempty"`
}

func (*MissilesSpell) Merge

func (opts *MissilesSpell) Merge(opts2 *MissilesSpell)

func (*MissilesSpell) SetDefaults

func (opts *MissilesSpell) SetDefaults()

type MissilesSpellConf

type MissilesSpellConf struct {
	MissilesSpell `yaml:",inline"`
	Levels        []MissilesSpell `json:"levels,omitempty" yaml:"levels,omitempty"`
}

func (*MissilesSpellConf) Level

func (opts *MissilesSpellConf) Level(lvl int) MissilesSpell

type MonsterAnimation

type MonsterAnimation struct {
	Type         MonsterAnimationType `json:"type"`
	Sound        string               `json:"sound,omitempty"`
	Field8       string               `json:"field_8,omitempty"`
	FramesPerDir byte                 `json:"frames_per_dir"`
	Field10      byte                 `json:"field_10,omitempty"`
	Kind         AnimationKind        `json:"kind"`
	Frames       [8][]ImageRef        `json:"frames"`
}

type MonsterAnimationType

type MonsterAnimationType byte

func (MonsterAnimationType) String

func (v MonsterAnimationType) String() string

type MonsterDraw

type MonsterDraw struct {
	Anims []MonsterAnimation `json:"monster"`
}

type MonsterGeneratorDraw

type MonsterGeneratorDraw struct {
	Anims []Animation `json:"monster_gen"`
}

type PlayerAnim

type PlayerAnim struct {
	FramesPerDir byte                              `json:"frames_per_dir"`
	Field8       byte                              `json:"field_8,omitempty"`
	Field12      string                            `json:"field_12,omitempty"`
	Parts        map[player.AnimPart][8][]ImageRef `json:"parts"`
}

type PlayerDraw

type PlayerDraw struct {
	Anims map[player.AnimType]*PlayerAnim `json:"player"`
}

type ProcFunc

type ProcFunc struct {
	Name string   `json:"name"`
	Args []string `json:"args,omitempty"`
}

type RGB

type RGB = types.RGB

type Reader

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

func NewReader

func NewReader(r io.ReadSeeker) *Reader

NewReader creates a new thing.bin file reader. It assumes the file was already decrypted.

func Open

func Open(path string) (*Reader, error)

Open thing.bin file. It is similar to OpenReader, but will automatically open file and select decryption key.

func OpenReader

func OpenReader(f io.ReadSeeker, key int) (*Reader, error)

OpenReader creates a new thing.bin file reader and decrypts it with a given key. If key is set to zero, default key is used.

func (*Reader) Buffered

func (f *Reader) Buffered() int

Buffered returns the size of underlying buffer.

func (*Reader) Close

func (f *Reader) Close() error

Close the underlying file, if any.

func (*Reader) ReadAll

func (f *Reader) ReadAll() (*Data, error)

func (*Reader) ReadImages

func (f *Reader) ReadImages() ([]Image, error)

func (*Reader) ReadSpells

func (f *Reader) ReadSpells() ([]Spell, error)

func (*Reader) ReadSpellsSect

func (f *Reader) ReadSpellsSect() ([]Spell, error)

ReadSpellsSect reads one SPEL section. It assumes the reader is already positioned at the section start.

func (*Reader) ReadThingSect

func (f *Reader) ReadThingSect() (*Thing, error)

ReadThingSect reads one THNG section. It assumes the reader is already positioned at the section start.

func (*Reader) ReadThings

func (f *Reader) ReadThings() ([]Thing, error)

func (*Reader) ReadWalls

func (f *Reader) ReadWalls() ([]Wall, error)

func (*Reader) SkipSpellsSect

func (f *Reader) SkipSpellsSect() error

SkipSpellsSect skips one SPEL section. It assumes the reader is already positioned at the section start.

func (*Reader) SkipThingSect

func (f *Reader) SkipThingSect() error

SkipThingSect skips one THNG section. It assumes the reader is already positioned at the section start.

type Spell

type Spell struct {
	ID          string             `json:"name" yaml:"name"`
	Effect      string             `json:"effect,omitempty" yaml:"effect,omitempty"`
	Icon        *ImageRef          `json:"icon,omitempty" yaml:"icon,omitempty"`
	IconEnabled *ImageRef          `json:"icon_enabled,omitempty" yaml:"icon_enabled,omitempty"`
	ManaCost    int                `json:"mana_cost" yaml:"mana_cost"`
	Price       int                `json:"price" yaml:"price"`
	Flags       SpellFlags         `json:"flags" yaml:"flags"`
	Phonemes    []spell.Phoneme    `json:"phonemes,omitempty" yaml:"phonemes,flow,omitempty"`
	Title       strman.ID          `json:"title,omitempty" yaml:"title,omitempty"`
	Desc        strman.ID          `json:"desc,omitempty" yaml:"desc,omitempty"`
	CastSound   string             `json:"cast_sound,omitempty" yaml:"cast_sound,omitempty"`
	OnSound     string             `json:"on_sound,omitempty" yaml:"on_sound,omitempty"`
	OffSound    string             `json:"off_sound,omitempty" yaml:"off_sound,omitempty"`
	Missiles    *MissilesSpellConf `json:"missiles,omitempty" yaml:"missiles,omitempty"`
}

func ReadSpellsYAML

func ReadSpellsYAML(path string) ([]Spell, error)

type SpellFlags

type SpellFlags uint32

func (SpellFlags) Has

func (f SpellFlags) Has(f2 SpellFlags) bool

func (SpellFlags) MarshalJSON

func (f SpellFlags) MarshalJSON() ([]byte, error)

func (SpellFlags) MarshalYAML

func (f SpellFlags) MarshalYAML() (interface{}, error)

func (SpellFlags) Split

func (f SpellFlags) Split() []SpellFlags

func (SpellFlags) String

func (f SpellFlags) String() string

func (*SpellFlags) UnmarshalJSON

func (f *SpellFlags) UnmarshalJSON(data []byte) error

func (*SpellFlags) UnmarshalYAML

func (f *SpellFlags) UnmarshalYAML(unmarshal func(interface{}) error) error

type SphericalShieldDraw

type SphericalShieldDraw struct {
	Anim Animation `json:"spherical_shield"`
}

type StaticDraw

type StaticDraw struct {
	Img ImageRef `json:"static"`
}

type StaticRandomDraw

type StaticRandomDraw struct {
	Imgs []ImageRef `json:"random"`
}

type SubClass

type SubClass string

type SummonEffectDraw

type SummonEffectDraw struct {
	Anim Animation `json:"summon"`
}

type Thing

type Thing struct {
	Name        string     `json:"name" nox:"-"`
	PrettyName  strman.ID  `json:"pretty_name,omitempty" nox:"PRETTYNAME"`
	Description strman.ID  `json:"description,omitempty" nox:"DESCRIPTION"`
	Class       []Class    `json:"class,omitempty" nox:"CLASS"`
	SubClass    []SubClass `json:"sub_class,omitempty" nox:"SUBCLASS"`
	Flags       []Flag     `json:"flags,omitempty" nox:"FLAGS"`
	Material    []Material `json:"material,omitempty" nox:"MATERIAL"`

	Menu           *ImageRef    `json:"menu,omitempty" nox:"MENUICON"`
	Image          *ImageRef    `json:"image,omitempty" nox:"PRETTYIMAGE"`
	Health         *int         `json:"health,omitempty" nox:"HEALTH"`
	Speed          *int         `json:"speed,omitempty" nox:"SPEED"`
	Size           *image.Point `json:"size,omitempty" nox:"-"`
	ZSize          *ZSize       `json:"zsize,omitempty" nox:"-"`
	Z              *int         `json:"z,omitempty" nox:"Z"`
	Extent         Extent       `json:"extent,omitempty" nox:"-"`
	Mass           float64      `json:"mass,omitempty" nox:"MASS"`
	Weight         int          `json:"weight,omitempty" nox:"WEIGHT"`
	Price          *int         `json:"price,omitempty" nox:"WORTH"`
	CarryCap       int          `json:"carry_cap,omitempty" nox:"CARRYCAPACITY"`
	Lifetime       int          `json:"lifetime,omitempty" nox:"LIFETIME"`
	Experience     int          `json:"experience,omitempty" nox:"EXPERIENCE"`
	Draw           Draw         `json:"draw,omitempty" nox:"-"`
	AudioLoop      string       `json:"audio_loop,omitempty" nox:"AUDIOLOOP"`
	DamageSound    string       `json:"damage_sound,omitempty" nox:"DAMAGESOUND"`
	LightIntensity int          `json:"light_intensity,omitempty" nox:"LIGHTINTENSITY"`
	LightDirection int          `json:"light_direction,omitempty" nox:"LIGHTDIRECTION"`
	LightPenumbra  int          `json:"light_penumbra,omitempty" nox:"LIGHTPENUMBRA"`
	LightColor     *RGB         `json:"light_color,omitempty" nox:"-"`

	Preprocess     *ProcFunc `json:"preprocess,omitempty" nox:"PREPROCESS"`
	OnCreate       *ProcFunc `json:"on_create,omitempty" nox:"CREATE"`
	OnInit         *ProcFunc `json:"on_init,omitempty" nox:"INIT"`
	OnUpdate       *ProcFunc `json:"on_update,omitempty" nox:"UPDATE"`
	OnDamage       *ProcFunc `json:"on_damage,omitempty" nox:"DAMAGE"`
	OnClientUpdate *ProcFunc `json:"on_client_update,omitempty" nox:"CLIENTUPDATE"`
	OnCollide      *ProcFunc `json:"on_collide,omitempty" nox:"COLLIDE"`
	OnPickup       *ProcFunc `json:"on_pickup,omitempty" nox:"PICKUP"`
	OnUse          *ProcFunc `json:"on_use,omitempty" nox:"USE"`
	OnDrop         *ProcFunc `json:"on_drop,omitempty" nox:"DROP"`
	OnXfer         *ProcFunc `json:"on_xfer,omitempty" nox:"XFER"`
	OnDestroy      *ProcFunc `json:"on_destroy,omitempty" nox:"DESTROY"`
	OnDie          *ProcFunc `json:"on_die,omitempty" nox:"DIE"`
}

type UnknownDraw

type UnknownDraw struct {
	Type string `json:"unknown"`
}

type Wall

type Wall struct {
	Name       string `json:"name"`
	Unk1       uint32
	Unk2       uint32
	Unk3       uint32
	Unk4       uint16
	OpenSound  string            `json:"open_sound,omitempty"`
	CloseSound string            `json:"close_sound,omitempty"`
	BreakSound string            `json:"break_sound,omitempty"`
	Directions [15]WallDirection `json:"directions,omitempty"`
}

type WallDirection

type WallDirection struct {
	Variants []WallVariant `json:"variants,omitempty"`
}

type WallImage

type WallImage struct {
	Pt  image.Point `json:"pt,omitempty"`
	Img ImageRef    `json:"img"`
}

type WallVariant

type WallVariant struct {
	Images [4]WallImage `json:"images,omitempty"`
}

type WeaponAnimateDraw

type WeaponAnimateDraw struct {
	Anim Animation `json:"weapon_anim"`
}

type WeaponDraw

type WeaponDraw struct {
	Img ImageRef `json:"weapon"`
}

type ZSize

type ZSize struct {
	Bottom int `json:"bottom"`
	Top    int `json:"top"`
}

Jump to

Keyboard shortcuts

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