session

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package session stores account, character, and player-session values shared across login, character selection, map transitions, and game UI.

Index

Constants

View Source
const (
	GuildRelationAlliance   uint32 = 0
	GuildRelationOpposition uint32 = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cart

type Cart struct {
	Open      bool
	Amount    int
	MaxAmount int
	Weight    int
	MaxWeight int
	Items     []InventoryItem
}

type CharServer

type CharServer struct {
	Address   string
	Port      uint16
	Name      string
	UserCount uint16
	State     uint16
	Property  uint16
}

type Character

type Character struct {
	ID        uint32
	Exp       int64
	Money     int64
	Name      string
	Slot      uint8
	Level     int16
	JobLevel  int16
	Job       int16
	HP        int16
	MaxHP     int16
	SP        int16
	MaxSP     int16
	Str       uint8
	Agi       uint8
	Vit       uint8
	Int       uint8
	Dex       uint8
	Luk       uint8
	Hair      int16
	HairColor uint8
	HeadPal   int16
	BodyPal   int16
	Weapon    int16
	Shield    int16
	HeadTop   int16
	HeadMid   int16
	HeadLow   int16
	Option    uint32
}

type Companion

type Companion struct {
	ID           uint32
	Active       bool
	Name         string
	Flags        uint8
	Level        int
	Hunger       int
	Intimacy     int
	ItemID       uint32
	Faith        int
	SummonCount  int
	Calls        uint32
	Kills        uint32
	ExpireTick   uint32
	Attack       int
	MagicAttack  int
	Hit          int
	Critical     int
	Defense      int
	MagicDefense int
	Flee         int
	ASPD         int
	HP           int
	MaxHP        int
	SP           int
	MaxSP        int
	Exp          uint64
	MaxExp       uint64
	AttackRange  int
	Job          int16
	Skills       Skills
}

type Friend

type Friend struct {
	AccountID uint32
	CharID    uint32
	Name      string
	State     uint8
}

func (Friend) Online

func (f Friend) Online() bool

type Friends

type Friends struct {
	List []Friend
}

type Guild

type Guild struct {
	ID               uint32
	IsMaster         bool
	Right            uint32
	MenuAccess       uint32
	Level            uint32
	UserNum          uint32
	MaxUserNum       uint32
	UserAverageLevel uint32
	Exp              uint32
	MaxExp           uint32
	Point            uint32
	Honor            uint32
	Virtue           uint32
	EmblemVersion    uint32
	Name             string
	MasterName       string
	ManageLand       string
	Zeny             uint32
	Members          []GuildMember
	Positions        []GuildPosition
	SkillPoints      int
	Skills           []Skill
	ExpelHistory     []GuildExpelHistory
	NoticeSubject    string
	Notice           string
	Relations        []GuildRelation
}

type GuildExpelHistory

type GuildExpelHistory struct {
	CharName string
	Account  string
	Reason   string
}

type GuildMember

type GuildMember struct {
	AccountID    uint32
	CharID       uint32
	HeadType     uint16
	HeadPalette  uint16
	Sex          uint16
	Job          uint16
	Level        uint16
	MemberExp    uint32
	CurrentState uint32
	PositionID   uint32
	Memo         string
	CharName     string
}

func (GuildMember) Online added in v0.8.0

func (m GuildMember) Online() bool

type GuildPosition

type GuildPosition struct {
	PositionID uint32
	Right      uint32
	Ranking    uint32
	PayRate    uint32
	PosName    string
}

type GuildRelation added in v0.8.0

type GuildRelation struct {
	Relation uint32
	GuildID  uint32
	Name     string
}

type HotkeySlot

type HotkeySlot struct {
	Type  uint8
	ID    uint32
	Level uint16
}

type Hotkeys

type Hotkeys struct {
	Loaded  bool
	Version int
	Slots   []HotkeySlot
}

type Inventory

type Inventory struct {
	Zeny      int64
	Weight    int
	MaxWeight int
	Items     []InventoryItem
}

type InventoryItem

type InventoryItem struct {
	Index      uint16
	ItemID     uint16
	Type       uint8
	Location   uint16
	Identified bool
	Amount     int
	Equip      bool
	Equipped   bool
	Damaged    bool
	Refine     uint8
	Cards      [4]uint16
}

type Movement

type Movement struct {
	ServerSpeed    int
	HasServerSpeed bool
}

type Party

type Party struct {
	Name             string
	Members          []PartyMember
	ExpShare         uint32
	ItemPickupRule   uint8
	ItemDivisionRule uint8
	RefuseInvites    bool
}

func (Party) Active

func (p Party) Active() bool

type PartyMember

type PartyMember struct {
	AccountID uint32
	Name      string
	MapName   string
	Role      uint32
	State     uint8
	X         int
	Y         int
	HP        int
	MaxHP     int
	Dead      bool
}

func (PartyMember) Leader

func (m PartyMember) Leader() bool

func (PartyMember) Online

func (m PartyMember) Online() bool

type Progress

type Progress struct {
	BaseLevel   int
	JobLevel    int
	BaseExp     int64
	NextBaseExp int64
	JobExp      int64
	NextJobExp  int64
}

func ProgressFromCharacter

func ProgressFromCharacter(character Character) Progress

type Session

type Session struct {
	AccountID            uint32
	CharID               uint32
	AuthCode             uint32
	UserLevel            uint32
	Sex                  byte
	AdminList            []uint32
	Playing              bool
	Dead                 bool
	NoShift              bool
	NoCtrl               bool
	LessEffects          bool
	HomunculusCustomAI   bool
	HomunculusAggressive bool
	MercenaryCustomAI    bool
	MercenaryAggressive  bool
	ShowEquip            bool
	GuildID              uint32
	EmblemVersion        uint32
	GuildName            string
	Guild                Guild
	PendingGuildName     string
	SnapTargets          bool
	SnapItems            bool
	AttackRange          int
	CharServers          []CharServer
	CharServerIndex      int
	Characters           []Character
	Selected             Character
	Zone                 ZoneServer
	ServerTick           uint32
	ServerTickAt         time.Time
	PlayerX              int
	PlayerY              int
	PlayerDir            int
	Vitals               Vitals
	Progress             Progress
	Inventory            Inventory
	Storage              Storage
	Cart                 Cart
	Stats                Stats
	Skills               Skills
	Hotkeys              Hotkeys
	Statuses             Statuses
	Friends              Friends
	Whisper              WhisperSettings
	Party                Party
	Movement             Movement
	Homunculus           Companion
	Mercenary            Companion
}

func New

func New() *Session

func (*Session) ElapsedSinceServerTick

func (s *Session) ElapsedSinceServerTick(start uint32, at time.Time) (time.Duration, bool)

func (*Session) EstimatedServerTick

func (s *Session) EstimatedServerTick(at time.Time) (uint32, bool)

func (*Session) IsAdminID

func (s *Session) IsAdminID(id uint32) bool

func (*Session) SelectCharacter

func (s *Session) SelectCharacter(character Character)

func (*Session) SelectedCharacter

func (s *Session) SelectedCharacter() Character

func (*Session) SyncServerTick

func (s *Session) SyncServerTick(tick uint32, at time.Time)

type Skill

type Skill struct {
	ID         uint16
	Type       uint32
	Level      int
	MaxLevel   int
	SPCost     int
	Range      int
	Name       string
	Upgradable bool
}

type Skills

type Skills struct {
	Points int
	List   []Skill
}

type Stats

type Stats struct {
	Points int
	Str    int
	Agi    int
	Vit    int
	Int    int
	Dex    int
	Luk    int

	StrBonus int
	AgiBonus int
	VitBonus int
	IntBonus int
	DexBonus int
	LukBonus int

	StrCost int
	AgiCost int
	VitCost int
	IntCost int
	DexCost int
	LukCost int

	Attack        int
	AttackBonus   int
	MatkMin       int
	MatkMax       int
	Defense       int
	DefenseBonus  int
	MDefense      int
	MDefenseBonus int
	Hit           int
	Flee          int
	FleeBonus     int
	Critical      int
	ASPD          int
	ASPDBonus     int
}

func StatsFromCharacter

func StatsFromCharacter(character Character) Stats

type StatusEffect

type StatusEffect struct {
	ID          uint16
	Source      uint32
	StartedAt   time.Time
	ExpiresAt   time.Time
	HasDuration bool
}

type Statuses

type Statuses struct {
	Active map[uint16]StatusEffect
}

type Storage

type Storage struct {
	Open            bool
	PasswordPending bool
	Amount          int
	MaxAmount       int
	Items           []InventoryItem
}

type Vitals

type Vitals struct {
	HP    int
	MaxHP int
	SP    int
	MaxSP int
}

func VitalsFromCharacter

func VitalsFromCharacter(character Character) Vitals

type WhisperSettings

type WhisperSettings struct {
	OpenStrangers bool
	OpenFriends   bool
	Alert         bool
	Configured    bool
}

func DefaultWhisperSettings

func DefaultWhisperSettings() WhisperSettings

type ZoneServer

type ZoneServer struct {
	Address string
	Port    uint16
	MapName string
}

Jump to

Keyboard shortcuts

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