gamedata

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FloorchangeDown    uint16 = 1 << 0
	FloorchangeNorth   uint16 = 1 << 1
	FloorchangeSouth   uint16 = 1 << 2
	FloorchangeEast    uint16 = 1 << 3
	FloorchangeWest    uint16 = 1 << 4
	FloorchangeNorthEx uint16 = 1 << 5
	FloorchangeSouthEx uint16 = 1 << 6
	FloorchangeEastEx  uint16 = 1 << 7
	FloorchangeWestEx  uint16 = 1 << 8
)
View Source
const (
	CombatPhysical  = 1 << 0
	CombatEnergy    = 1 << 1
	CombatEarth     = 1 << 2
	CombatFire      = 1 << 3
	CombatUndefined = 1 << 4
	CombatLifeDrain = 1 << 5
	CombatManaDrain = 1 << 6
	CombatHealing   = 1 << 7
	CombatDrown     = 1 << 8
	CombatIce       = 1 << 9
	CombatHoly      = 1 << 10
	CombatDeath     = 1 << 11
)

Combat type indices (bitfield values matching server enums)

Variables

This section is empty.

Functions

func BulkInsertItems

func BulkInsertItems(tx *sql.Tx, items []ItemType) error

func BulkInsertTiles

func BulkInsertTiles(tx *sql.Tx, tiles []MapTile) error

func DecodeItems

func DecodeItems(blob []byte) ([]uint16, error)

func EncodeItems

func EncodeItems(items []uint16) []byte

func HasFloorchange

func HasFloorchange(flags, dir uint16) bool

func SaveItemType

func SaveItemType(db *sql.DB, it *ItemType) error

func SaveTile

func SaveTile(db *sql.DB, tile *MapTile) error

Types

type Abilities

type Abilities struct {
	Speed       int32 `json:"speed,omitempty"`
	HealthGain  int32 `json:"healthGain,omitempty"`
	HealthTicks int32 `json:"healthTicks,omitempty"`
	ManaGain    int32 `json:"manaGain,omitempty"`
	ManaTicks   int32 `json:"manaTicks,omitempty"`

	ManaShield   bool `json:"manaShield,omitempty"`
	Invisible    bool `json:"invisible,omitempty"`
	Regeneration bool `json:"regeneration,omitempty"`
	PreventLoss  bool `json:"preventLoss,omitempty"`
	PreventDrop  bool `json:"preventDrop,omitempty"`

	// skills[0..6]: fist, club, sword, axe, dist, shield, fish
	Skills        [7]int32 `json:"skills,omitempty"`
	SkillsPercent [7]int32 `json:"skillsPercent,omitempty"`

	// stats[0..3]: maxHealth, maxMana, soul, magicLevel
	Stats        [4]int32 `json:"stats,omitempty"`
	StatsPercent [4]int32 `json:"statsPercent,omitempty"`

	// increment[0..3]: healingValue, healingPercent, magicValue, magicPercent
	Increment [4]int16 `json:"increment,omitempty"`

	// Keyed by combat type bitfield value (1,2,4,8,...,2048)
	Absorb      map[int]int16 `json:"absorb,omitempty"`
	FieldAbsorb map[int]int16 `json:"fieldAbsorb,omitempty"`

	// reflect[type][combatType] — "percent" and "chance"
	ReflectPercent map[int]int16 `json:"reflectPercent,omitempty"`
	ReflectChance  map[int]int16 `json:"reflectChance,omitempty"`

	ElementType   int   `json:"elementType,omitempty"`
	ElementDamage int16 `json:"elementDamage,omitempty"`

	ConditionSuppressions int32 `json:"conditionSuppressions,omitempty"`

	FieldCombatType int   `json:"fieldCombatType,omitempty"`
	FieldTicks      int32 `json:"fieldTicks,omitempty"`
	FieldCount      int32 `json:"fieldCount,omitempty"`
	FieldStart      int32 `json:"fieldStart,omitempty"`
	FieldDamage     int32 `json:"fieldDamage,omitempty"`
}

type House

type House struct {
	ID        uint32 `db:"id"`
	Name      string `db:"name"`
	EntryX    uint16 `db:"entry_x"`
	EntryY    uint16 `db:"entry_y"`
	EntryZ    uint8  `db:"entry_z"`
	Rent      uint32 `db:"rent"`
	TownID    uint32 `db:"town_id"`
	Size      uint16 `db:"size"`
	Guildhall bool   `db:"guildhall"`
}

func LoadHouses

func LoadHouses(db *sql.DB) ([]House, error)

type ItemType

type ItemType struct {
	ServerID           uint16            `db:"server_id"`
	ClientID           uint16            `db:"client_id"`
	ItemGroup          uint8             `db:"item_group"`
	ItemTypeVal        uint8             `db:"item_type"`
	Flags              uint32            `db:"flags"`
	Speed              uint16            `db:"speed"`
	TopOrder           int8              `db:"top_order"`
	Name               string            `db:"name"`
	Article            string            `db:"article"`
	Plural             string            `db:"plural"`
	Description        string            `db:"description"`
	RuneSpellName      string            `db:"rune_spell_name"`
	Weight             float32           `db:"weight"`
	Armor              int16             `db:"armor"`
	Defense            int16             `db:"defense"`
	ExtraDefense       int16             `db:"extra_defense"`
	Attack             int16             `db:"attack"`
	ExtraAttack        int16             `db:"extra_attack"`
	AttackSpeed        uint32            `db:"attack_speed"`
	RotateTo           uint16            `db:"rotate_to"`
	ContainerSize      uint8             `db:"container_size"`
	MaxTextLength      uint16            `db:"max_text_length"`
	WriteOnceItemID    uint16            `db:"write_once_item_id"`
	Charges            uint32            `db:"charges"`
	DecayTo            *uint16           `db:"decay_to"`
	DecayTime          uint32            `db:"decay_time"`
	TransformEquipTo   uint16            `db:"transform_equip_to"`
	TransformDeequipTo uint16            `db:"transform_deequip_to"`
	TransformUseTo     uint16            `db:"transform_use_to"`
	Duration           uint32            `db:"duration"`
	ShowDuration       bool              `db:"show_duration"`
	ShowCharges        bool              `db:"show_charges"`
	ShowCount          bool              `db:"show_count"`
	ShowAttributes     bool              `db:"show_attributes"`
	BreakChance        int8              `db:"break_chance"`
	HitChance          int8              `db:"hit_chance"`
	MaxHitChance       int8              `db:"max_hit_chance"`
	DualWield          bool              `db:"dual_wield"`
	ShootRange         uint8             `db:"shoot_range"`
	Worth              uint32            `db:"worth"`
	LevelDoor          uint32            `db:"level_door"`
	SpecialDoor        bool              `db:"special_door"`
	ClosingDoor        bool              `db:"closing_door"`
	WareID             uint16            `db:"ware_id"`
	ForceSerialize     bool              `db:"force_serialize"`
	WeaponType         uint8             `db:"weapon_type"`
	AmmoType           uint8             `db:"ammo_type"`
	AmmoAction         uint8             `db:"ammo_action"`
	ShootType          uint8             `db:"shoot_type"`
	MagicEffect        uint8             `db:"magic_effect"`
	SlotPosition       uint32            `db:"slot_position"`
	WieldPosition      uint32            `db:"wield_position"`
	FluidSource        uint8             `db:"fluid_source"`
	CorpseType         uint8             `db:"corpse_type"`
	LightLevel         int16             `db:"light_level"`
	LightColor         int16             `db:"light_color"`
	MinimapColor       uint16            `db:"minimap_color"`
	BlockSolid         bool              `db:"block_solid"`
	BlockProjectile    bool              `db:"block_projectile"`
	BlockPathFind      bool              `db:"block_path_find"`
	AllowDistRead      bool              `db:"allow_dist_read"`
	Movable            bool              `db:"movable"`
	Pickupable         bool              `db:"pickupable"`
	AllowPickupable    bool              `db:"allow_pickupable"`
	IsVertical         bool              `db:"is_vertical"`
	IsHorizontal       bool              `db:"is_horizontal"`
	WalkStack          bool              `db:"walk_stack"`
	Replaceable        bool              `db:"replaceable"`
	CanWriteText       bool              `db:"can_write_text"`
	CanReadText        bool              `db:"can_read_text"`
	StopTime           bool              `db:"stop_time"`
	Floorchange        uint16            `db:"floorchange"`
	BedPartnerDir      uint8             `db:"bed_partner_dir"`
	MaleTransformTo    uint16            `db:"male_transform_to"`
	MaleLooktype       uint16            `db:"male_looktype"`
	FemaleTransformTo  uint16            `db:"female_transform_to"`
	FemaleLooktype     uint16            `db:"female_looktype"`
	Cache              bool              `db:"cache"`
	HasHeight          bool              `db:"-"`
	Usable             bool              `db:"-"`
	Stackable          bool              `db:"-"`
	AlwaysOnTop        bool              `db:"-"`
	Rotable            bool              `db:"-"`
	IsHangable         bool              `db:"-"`
	LookThrough        bool              `db:"-"`
	IsAnimation        bool              `db:"-"`
	Text               string            `db:"-"`
	Writer             string            `db:"-"`
	Date               int32             `db:"-"`
	Abilities          NullableAbilities `db:"abilities"`
}

func LoadItemType

func LoadItemType(db *sql.DB, serverID uint16) (*ItemType, error)

func LoadItemTypes

func LoadItemTypes(db *sql.DB) ([]ItemType, error)

type MapTile

type MapTile struct {
	X         uint16     `db:"x"`
	Y         uint16     `db:"y"`
	Z         uint8      `db:"z"`
	GroundID  uint16     `db:"ground_id"`
	Flags     uint32     `db:"flags"`
	HouseID   uint32     `db:"house_id"`
	Items     []uint16   // decoded from MEDIUMBLOB
	RichItems []RichItem // items with attributes
}

func LoadTiles

func LoadTiles(db *sql.DB) ([]MapTile, error)

func LoadTilesInArea

func LoadTilesInArea(db *sql.DB, minX, minY, maxX, maxY uint16, z uint8) ([]MapTile, error)

type NullableAbilities

type NullableAbilities struct {
	Abilities
	Valid bool
}

NullableAbilities wraps Abilities for nullable JSON column scanning.

func (*NullableAbilities) Scan

func (a *NullableAbilities) Scan(src interface{}) error

func (NullableAbilities) Value

func (a NullableAbilities) Value() (driver.Value, error)

type RichItem added in v1.20.0

type RichItem struct {
	ServerID    uint16
	ActionID    uint16
	UniqueID    uint16
	TeleDestX   uint16
	TeleDestY   uint16
	TeleDestZ   uint8
	DoorID      uint8
	DepotID     uint16
	Text        string
	Description string
	Charges     uint16
	RuneCharges uint8
	Count       uint8
	Duration    uint32
	WrittenDate uint32
	WrittenBy   string
	SleeperGUID uint32
	SleepStart  uint32
	SubItems    []RichItem
}

type Spawn

type Spawn struct {
	ID        uint32 `db:"id"`
	CenterX   uint16 `db:"center_x"`
	CenterY   uint16 `db:"center_y"`
	CenterZ   uint8  `db:"center_z"`
	Radius    uint8  `db:"radius"`
	Creatures []SpawnCreature
}

func LoadSpawns

func LoadSpawns(db *sql.DB) ([]Spawn, error)

type SpawnCreature

type SpawnCreature struct {
	ID        uint32 `db:"id"`
	SpawnID   uint32 `db:"spawn_id"`
	Name      string `db:"name"`
	Type      string `db:"type"`
	OffsetX   int16  `db:"offset_x"`
	OffsetY   int16  `db:"offset_y"`
	OffsetZ   int8   `db:"offset_z"`
	SpawnTime uint32 `db:"spawntime"`
	Direction uint8  `db:"direction"`
}

type Town

type Town struct {
	ID     uint32 `db:"id"`
	Name   string `db:"name"`
	EntryX uint16 `db:"entry_x"`
	EntryY uint16 `db:"entry_y"`
	EntryZ uint8  `db:"entry_z"`
}

func LoadTowns

func LoadTowns(db *sql.DB) ([]Town, error)

type Waypoint

type Waypoint struct {
	Name string `db:"name"`
	X    uint16 `db:"x"`
	Y    uint16 `db:"y"`
	Z    uint8  `db:"z"`
}

func LoadWaypoints

func LoadWaypoints(db *sql.DB) ([]Waypoint, error)

Jump to

Keyboard shortcuts

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