nx

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: MIT Imports: 7 Imported by: 6

Documentation

Index

Constants

View Source
const (
	StockStateDefault      = 0 // available
	StockStateNotAvailable = 1
)

StockState values mirrored for client

Variables

This section is empty.

Functions

func GetBestSN

func GetBestSN(category, gender, idx int) int32

func GetCommodities

func GetCommodities() map[int32]Commodity

GetCommodities returns the global commodity map keyed by SN.

func GetCommoditySNByItemID

func GetCommoditySNByItemID(itemID int32) (int32, bool)

func GetMaps

func GetMaps() map[int32]Map

GetMaps from loaded nx

func GetMobSkills

func GetMobSkills(id int32) map[byte]byte

GetMobSkills from loaded nx

func GetPackages

func GetPackages() map[int32][]int32

func GetQuests

func GetQuests() map[int16]Quest

func GetReactorInfoList

func GetReactorInfoList() map[int32]ReactorInfo

GetReactorInfoList from loaded nx

func LoadFile

func LoadFile(fname string)

LoadFile into useable types

Types

type ActBlock

type ActBlock struct {
	Exp       int32
	Money     int32
	Pop       int32
	NextQuest int16
	Fame      int32

	Items []ActItem
}

type ActItem

type ActItem struct {
	ID     int32
	Count  int32
	Prop   int32
	Job    int32
	Gender int32
}

type CheckBlock

type CheckBlock struct {
	NPC   int32
	Job   int32
	LvMin int32
	LvMax int32
	Pop   int32

	PrevQuests []QuestStateReq
	Items      []ReqItem
	Mobs       []ReqMob
}

type Commodity

type Commodity struct {
	Index int32 // numeric key under Commodity.img

	// NX fields
	SN       int32
	ItemID   int32
	Count    int32
	Gender   int32
	Period   int32
	OnSale   int32
	Price    int32
	Priority int32
	Class    int32 // optional

	// Derived
	Category   int32 // floor(SN/10_000_000)+1
	StockState int32 // computed at load time
}

Commodity mirrors /Etc/Commodity.img/<index>/

func GetCommodity

func GetCommodity(sn int32) (Commodity, bool)

GetCommodity returns a single commodity by SN.

type FeaturedKey

type FeaturedKey struct {
	Category byte
	Gender   byte
	Idx      byte
}

type Foothold

type Foothold struct {
	ID             int16
	X1, X2, Y1, Y2 int16
	Prev, Next     int
}

Foothold in map

type Item

type Item struct {
	InvTabID                                                       byte
	Name                                                           string
	Cash, Pet                                                      bool
	Only, TradeBlock, ExpireOnLogout, Quest, TimeLimited           int64
	ReqLevel                                                       byte
	Tuc                                                            byte // Total upgrade count?
	SlotMax                                                        int16
	ReqJob                                                         int64
	ReqSTR, ReqDEX, ReqINT, ReqLUK, IncSTR, IncDEX, IncINT, IncLUK int16
	IncACC, IncEVA, IncMDD, IncPDD, IncMAD, IncPAD, IncMHP, IncMMP float64
	Speed, Jump, PAD, PDD, MAD, MDD, ACC, EVA                      int16
	Poison, Darkness, Weakness, Curse, Seal                        int16
	Attack, IncJump, IncSpeed, RecoveryHP                          float64
	HP, MP                                                         int16
	Time                                                           int16
	AttackSpeed                                                    int16
	Price                                                          int32
	NotSale                                                        int64
	UnitPrice                                                      float64
	Life, Hungry                                                   int64
	PickupItem, PickupAll, SweepForDrop                            int64
	ConsumeHP, LongRange                                           int64
	Recovery                                                       float64
	ReqPOP                                                         int64 // ?
	NameTag                                                        int64
	Pachinko                                                       int64
	VSlot, ISlot                                                   string
	Type                                                           int64
	Success                                                        int64 // Scroll type
	Cursed                                                         int64
	Add                                                            int64 // ?
	DropSweep                                                      int64
	Rate                                                           int64
	Meso                                                           int64
	Path                                                           string
	FloatType                                                      int64
	NoFlip                                                         string
	StateChangeItem                                                int64
	BigSize                                                        int64
	Sfx                                                            string
	Walk                                                           int64
	AfterImage                                                     string
	Stand                                                          int64
	Knockback                                                      int64
	Fs                                                             int64
	ChatBalloon                                                    int64
	MoveTo                                                         int32
	Interact                                                       map[byte]PetReaction
	SpawnMobs                                                      map[int32]int32
}

Item data from nx

func GetItem

func GetItem(id int32) (Item, error)

GetItem from loaded nx

type Life

type Life struct {
	ID       int32
	Type     string
	Foothold int16
	FaceLeft bool
	X, Y     int16
	MobTime  int64
	Hide     int64
	Rx0, Rx1 int16
	Cy       int64
	Info     int64
}

Life object in a map

type Map

type Map struct {
	Town         bool
	ForcedReturn int64
	ReturnMap    int32
	MobRate      float64

	Swim, PersonalShop, EntrustedShop, ScrollDisable int64

	MoveLimit int64
	DecHP     int64

	NPCs      []Life
	Mobs      []Life
	Portals   []Portal
	Reactors  []Reactor
	Footholds []Foothold

	FieldLimit                                int64
	VRRight, VRTop, VRLeft, VRBottom, VRLimit int64

	Recovery                  float64
	Version                   int64
	Bgm, MapMark              string
	Cloud, HideMinimap        int64
	MapDesc, Effect           string
	Fs                        float64
	TimeLimit                 int64
	FieldType                 int64
	Everlast, Snow, Rain      int64
	MapName, StreetName, Help string
}

Map data from nx

func GetMap

func GetMap(id int32) (Map, error)

GetMap from loaded nx

type Mob

type Mob struct {
	HP, MP             int32 // Not in nx
	MaxHP, HPRecovery  int32
	MaxMP, MPRecovery  int32
	Level              int64
	Exp                int64
	MADamage, MDDamage int64
	PADamage, PDDamage int64
	Speed, Eva, Acc    int64
	SummonType         int8
	SummonOption       int32
	Boss, Undead       int64
	ElemAttr           string
	Link               int64
	FlySpeed           int64
	NoRegen            int64
	Invincible         int64
	SelfDestruction    int64
	ExplosiveReward    int64
	Skills             map[byte]byte
	Revives            []int32
	Fs                 float64
	Pushed             int64
	BodyAttack         int64
	NoFlip             int64
	NotAttack          int64
	FirstAttack        int64
	RemoveQuest        int64
	RemoveAfter        string
	PublicReward       int64
	HPTagBGColor       int64
	HPTagColor         int64
}

Mob data from nx

func GetMob

func GetMob(id int32) (Mob, error)

GetMob from loaded nx

type MobSkill

type MobSkill struct {
	Hp              int32
	MpCon           int32
	Limit, Interval int64
	MobID           []int64
	SummonEffect    int64
	Time            int64
}

MobSkill data from nx

func GetMobSkill

func GetMobSkill(id byte) ([]MobSkill, error)

GetMobSkill from loaded nx

type NXVec2

type NXVec2 struct {
	X int16
	Y int16
}

NXVec2 is a simple integer vector for NX vector lookups

type PetReaction

type PetReaction struct {
	Inc      byte
	Prob     byte
	LevelMin byte
	LevelMax byte
}

type PlayerSkill

type PlayerSkill struct {
	Mastery               int64
	Mad, Mdd, Pad, Pdd    int64
	Hp, Mp, HpCon, MpCon  int64
	BulletConsume         int64
	MoneyConsume          int64
	ItemCon               int64
	ItemConNo             int64
	Time                  int64
	Cooltime              int64
	Eva, Acc, Jump, Speed int64
	Range                 int64
	MobCount              int64
	AttackCount           int64
	Damage                int64
	Fixdamage             int64
	Rb, Lt                gonx.Vector
	Hs                    string
	X, Y, Z               int64
	Prop                  int64
	BulletCount           int64
	Action                string
}

PlayerSkill data from nx

func GetPlayerSkill

func GetPlayerSkill(id int32) ([]PlayerSkill, error)

GetPlayerSkill from loaded nx

type Portal

type Portal struct {
	ID     byte
	Pn     string
	Tm     int32
	Tn     string
	Pt     int64
	X, Y   int16
	Script string
}

Portal object in a map

type Quest

type Quest struct {
	ID     int16
	Name   string
	Parent string
	Order  int16
	Area   int32

	Journal map[int]string

	// Requirements
	Start    CheckBlock // from Check[questID]["0"]
	Complete CheckBlock // from Check[questID]["1"]

	// Actions / rewards
	ActOnStart    ActBlock // from Act[questID]["0"]
	ActOnComplete ActBlock // from Act[questID]["1"]

	// Keys like: "start.0","start.1","complete.0","start.yes.0", etc.
	Say map[string][]string
}

Quest data

func GetQuest

func GetQuest(id int16) (Quest, error)

type QuestStateReq

type QuestStateReq struct {
	ID    int16
	State int8
}

type Reactor

type Reactor struct {
	ID          int64
	FaceLeft    int64
	X, Y        int64
	ReactorTime int64
	Name        string
}

Reactor object in a map

type ReactorEventInfo

type ReactorEventInfo struct {
	Type        int32
	State       int32
	ReqItemID   int32 // int name "0"
	ReqItemCnt  int32 // int name "1"
	Probability int32 // int name "2"
	LT          NXVec2
	RB          NXVec2

	ExtraInts map[string]int32
	ExtraVecs map[string]NXVec2
}

ReactorEventInfo represents a single event entry under a reactor state's "event" node.

type ReactorInfo

type ReactorInfo struct {
	ID     int32
	Info   string // /Reactor/<id>.img/info/info
	Action string // /Reactor/<id>.img/action
	States map[int]ReactorStateInfo
	LinkTo int32 // /Reactor/<id>.img/info/link -> other reactor id
}

ReactorInfo is the reactor data for a single ID.

func GetReactorInfo

func GetReactorInfo(id int32) (ReactorInfo, error)

GetReactorInfo from loaded nx

type ReactorStateInfo

type ReactorStateInfo struct {
	Events []ReactorEventInfo
}

ReactorStateInfo is a reactor state (e.g., "0", "1") and its events.

type ReqItem

type ReqItem struct {
	ID    int32
	Count int32
}

type ReqMob

type ReqMob struct {
	ID    int32
	Count int32
}

Jump to

Keyboard shortcuts

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