Documentation
¶
Index ¶
- Constants
- func AddSkillBuff(skillID int32, bits ...int)
- func LoadBuffs()
- func NewCharacterBuffs(p *Player)
- func StopSaver()
- type BuffSnapshot
- type CharacterBuffs
- func (cb *CharacterBuffs) AddBuff(charId, skillID int32, level byte, foreign bool, delay int16)
- func (cb *CharacterBuffs) AddBuffFromCC(charId, skillID int32, expiresAtMs int64, level byte, foreign bool, ...)
- func (cb *CharacterBuffs) AddItemBuff(it Item)
- func (cb *CharacterBuffs) AddItemBuffFromCC(itemID int32, expiresAtMs int64)
- func (cb *CharacterBuffs) AddMobDebuff(skillID, level byte, durationSec int16)
- func (cb *CharacterBuffs) AuditAndExpireStaleBuffs()
- func (cb *CharacterBuffs) ClearBuff(skillID int32, _ uint32)
- func (cb *CharacterBuffs) HasGMHide() bool
- func (cb *CharacterBuffs) RestoreFromSnapshot(snaps []BuffSnapshot)
- func (cb *CharacterBuffs) Snapshot() []BuffSnapshot
- type DirtyBits
- type Flag
- type Item
- type Player
- func (d *Player) FlushNow()
- func (d *Player) GetAccountName() string
- func (d *Player) GetMaplePoints() int32
- func (d *Player) GetNX() int32
- func (d *Player) GiveItem(newItem Item) (error, Item)
- func (d Player) Logout()
- func (d *Player) MarkDirty(bits DirtyBits, debounce time.Duration)
- func (d *Player) SeedRNGDeterministic()
- func (d *Player) Send(packet mpacket.Packet)
- func (d *Player) SetMaplePoints(points int32)
- func (d *Player) SetNX(nx int32)
- func (d *Player) SetPos(pos pos)
- func (d *Player) UpdateMovement(frag movementFrag)
- func (plr *Player) WriteCharacterInfoPacket(p *mpacket.Packet)
- type Players
- type Server
- func (server *Server) CheckpointAll()
- func (server *Server) ClientDisconnected(conn mnet.Client)
- func (server *Server) HandleClientPacket(conn mnet.Client, reader mpacket.Reader)
- func (server *Server) HandleServerPacket(conn mnet.Server, reader mpacket.Reader)
- func (server *Server) Initialise(work chan func(), ...)
- func (server *Server) RegisterWithWorld(conn mnet.Server, ip []byte, port int16, maxPop int16)
- func (server *Server) SendCountdownToPlayers(t int32)
- func (server *Server) SendLostWorldConnectionMessage()
- func (server *Server) StartAutosave(ctx context.Context)
Constants ¶
const ( // Byte 1 (bits 0..7) BuffWeaponAttack = 0 BuffWeaponDefense = 1 BuffMagicAttack = 2 BuffMagicDefense = 3 BuffAccuracy = 4 BuffAvoidability = 5 BuffHands = 6 BuffSpeed = 7 // Byte 2 (bits 8..15) BuffJump = 8 BuffMagicGuard = 9 BuffDarkSight = 10 BuffBooster = 11 BuffPowerGuard = 12 BuffMaxHP = 13 BuffMaxMP = 14 BuffInvincible = 15 // Byte 3 (bits 16..23) BuffSoulArrow = 16 BuffStun = 17 BuffPoison = 18 BuffSeal = 19 BuffDarkness = 20 BuffComboAttack = 21 BuffCharges = 22 BuffDragonBlood = 23 // Byte 4 (bits 24..31) BuffHolySymbol = 24 BuffMesoUP = 25 BuffShadowPartner = 26 BuffPickPocketMesoUP = 27 BuffMesoGuard = 28 BuffThaw = 29 BuffWeakness = 30 BuffCurse = 31 )
BuffValueTypes now represent bit positions, not bitmasks.
const ( Ver_1 = 32 Ver_14 = 64 Default = Ver_14 // Most common versions used are UINT128. )
Version/collection bit lengths
Variables ¶
This section is empty.
Functions ¶
func AddSkillBuff ¶
AddSkillBuff registers one or more Flag bit positions for a skill.
func NewCharacterBuffs ¶
func NewCharacterBuffs(p *Player)
Types ¶
type BuffSnapshot ¶
type CharacterBuffs ¶
type CharacterBuffs struct {
// contains filtered or unexported fields
}
func (*CharacterBuffs) AddBuff ¶
func (cb *CharacterBuffs) AddBuff(charId, skillID int32, level byte, foreign bool, delay int16)
func (*CharacterBuffs) AddBuffFromCC ¶
func (*CharacterBuffs) AddItemBuff ¶
func (cb *CharacterBuffs) AddItemBuff(it Item)
durationSec is the client-visible remaining time in seconds. Source ID is encoded as -Item.ID.
func (*CharacterBuffs) AddItemBuffFromCC ¶
func (cb *CharacterBuffs) AddItemBuffFromCC(itemID int32, expiresAtMs int64)
func (*CharacterBuffs) AddMobDebuff ¶
func (cb *CharacterBuffs) AddMobDebuff(skillID, level byte, durationSec int16)
AddMobDebuff applies a debuff from a mob skill to the player
func (*CharacterBuffs) AuditAndExpireStaleBuffs ¶
func (cb *CharacterBuffs) AuditAndExpireStaleBuffs()
func (*CharacterBuffs) ClearBuff ¶
func (cb *CharacterBuffs) ClearBuff(skillID int32, _ uint32)
ClearBuff removes a specific buff from Player and DB.
func (*CharacterBuffs) HasGMHide ¶
func (cb *CharacterBuffs) HasGMHide() bool
func (*CharacterBuffs) RestoreFromSnapshot ¶
func (cb *CharacterBuffs) RestoreFromSnapshot(snaps []BuffSnapshot)
func (*CharacterBuffs) Snapshot ¶
func (cb *CharacterBuffs) Snapshot() []BuffSnapshot
type Flag ¶
type Flag []uint32
Flag is a bitset stored as 32-bit words (most significant bits at lower indices).
func NewFlagBits ¶
NewFlagBits constructs a Flag with exactly uBits capacity.
func (*Flag) SetBitNumber ¶
SetBitNumber sets a specific bit to 0 or 1. Bits are addressed MSB-first per 32-bit word.
func (*Flag) SetValue ¶
SetValue assigns a scalar 32-bit value to the least significant word, zeroing all higher words (mirrors Java).
func (*Flag) ToByteArray ¶
ToByteArray returns the byte representation identical to the Java code. If bNewVer is false, it writes bytes in a "reverse fill" big-endian order across the entire array (matching Java's decrementing uLen fill). If bNewVer is true, it writes each 32-bit word in little-endian order, from last word to first.
func (*Flag) ToByteArrayEx ¶
ToByteArrayEx is the "reverse" of ToByteArray: it outputs per-word little-endian bytes, iterating from the end towards the beginning.
type Item ¶
type Item struct {
ID int32
// contains filtered or unexported fields
}
func (Item) InventoryBytes ¶
InventoryBytes to display in character inventory window
type Player ¶
type Player struct {
Conn mnet.Client
ID int32 // Unique identifier of the character
ChannelID byte
Name string
UpdatePartyInfo updatePartyInfoFunc
// contains filtered or unexported fields
}
func (*Player) GetAccountName ¶
func (*Player) GetMaplePoints ¶
func (Player) Logout ¶
func (d Player) Logout()
Logout flushes coalesced state and does a full checkpoint save.
func (*Player) SeedRNGDeterministic ¶
func (d *Player) SeedRNGDeterministic()
SeedRNGDeterministic seeds the per-Player RNG using stable identifiers so gain sequences are reproducible across restarts and processes.
func (*Player) SetMaplePoints ¶
func (*Player) UpdateMovement ¶
func (d *Player) UpdateMovement(frag movementFrag)
UpdateMovement - update Data from position data
func (*Player) WriteCharacterInfoPacket ¶
type Players ¶ added in v0.0.5
type Players struct {
// contains filtered or unexported fields
}
func NewPlayers ¶ added in v0.0.5
func NewPlayers() Players
func (Players) GetFromConn ¶ added in v0.0.5
func (Players) GetFromName ¶ added in v0.0.5
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server state
func (*Server) CheckpointAll ¶
func (server *Server) CheckpointAll()
CheckpointAll now uses the saver to flush debounced/coalesced deltas for every Player.
func (*Server) ClientDisconnected ¶
ClientDisconnected from server
func (*Server) HandleClientPacket ¶
func (*Server) HandleServerPacket ¶
func (*Server) Initialise ¶
func (server *Server) Initialise(work chan func(), dbuser, dbpassword, dbaddress, dbport, dbdatabase, dropsJson, reactorJson, reactorDropsJson string)
Initialise the server
func (*Server) RegisterWithWorld ¶
RegisterWithWorld server
func (*Server) SendCountdownToPlayers ¶
SendCountdownToPlayers - Send a countdown to players that appears as a clock
func (*Server) SendLostWorldConnectionMessage ¶
func (server *Server) SendLostWorldConnectionMessage()
SendLostWorldConnectionMessage - Send message to players alerting them of whatever they do it won't be saved
func (*Server) StartAutosave ¶
startAutosave periodically flushes deltas via the saver.