Documentation
¶
Overview ¶
Package res loads and decodes Ragnarok client resources such as GRF, GND, GAT, RSW, RSM, sprites, palettes, tables, and message strings.
Index ¶
- Constants
- Variables
- func ApplyEffectTransparency(img image.Image) *image.NRGBA
- func ApplyEffectTransparencyWithBlackKey(img image.Image, blackKey bool) *image.NRGBA
- func BookResourcePath(itemID uint16) string
- func CardIllustrationTextureCandidates(resource string) []string
- func DecodeImageData(data []byte) (image.Image, error)
- func EffectTextureCandidates(name string) []string
- func FormatGroundItemLabel(name string, amount int) string
- func GATCellType(raw uint32) uint32
- func GR2AnimationResourceCandidates(boneType uint32, action GR2Action) []string
- func GR2BoneTypeFromName(name string) (uint32, bool)
- func GR2ModelResourceCandidates(resourceName string) []string
- func GroundTextureCandidates(name string) []string
- func HasPlayerJobToken(job int) bool
- func InterfaceTextureCandidates(resource string) []string
- func IsDualWeaponPlayerJob(job int) bool
- func IsGR2ResourceName(name string) bool
- func ItemCollectionTextureCandidates(resource string) []string
- func ItemIconTextureCandidates(resource string) []string
- func ItemSpriteResourceCandidates(resource string, extension string) []string
- func LoadImage(manager *Manager, candidates []string) (image.Image, string, error)
- func LoadImageExact(manager *Manager, candidates []string) (image.Image, string, error)
- func MercenaryWeaponOverlayResourceCandidates(resourceName string, weaponValue int, secondLayer bool, extension string) []string
- func NPCCutinTextureCandidates(resource string) []string
- func NonPCSpriteResourceCandidates(job int, resourceName string, extension string) []string
- func NormalizePlayerHead(head int, job int) int
- func NormalizePlayerWeaponShield(weapon, shield int) (int, int)
- func PlayerAccessoryResourceCandidates(job int, head int, sex byte, viewID int, resourceName string, extension string) []string
- func PlayerAdminBodyResourceCandidates(sex byte, extension string) []string
- func PlayerBodyPaletteResourceCandidates(job int, sex byte, palette int, extension string) []string
- func PlayerBodyResourceCandidates(job int, sex byte, extension string) []string
- func PlayerBodyResourcePath(job int, sex byte, extension string) string
- func PlayerCartResourceCandidates(cartNum int, extension string) []string
- func PlayerFalconResourceCandidates(job int, extension string) []string
- func PlayerHeadPaletteResourceCandidates(job int, head int, sex byte, palette int, extension string) []string
- func PlayerHeadResourceCandidates(job int, head int, sex byte, extension string) []string
- func PlayerIMFResourceCandidates(job int, sex byte) []string
- func PlayerJobToken(job int) string
- func PlayerSexLabel(sex byte) string
- func PlayerSexToken(sex byte) string
- func PlayerShieldOverlayResourceCandidates(job int, sex byte, shield int, extension string) []string
- func PlayerShieldToken(shield int) string
- func PlayerWeaponIsBow(manager *Manager, weaponValue int) bool
- func PlayerWeaponOverlayResourceCandidates(job int, sex byte, weaponValue int, secondLayer bool, extension string) []string
- func PlayerWeaponOverlayResourceCandidatesForItem(job int, sex byte, weaponItemID int, weaponViewID int, secondLayer bool, ...) []string
- func PlayerWeaponOverlaySupportsSecondLayer(weaponType int) bool
- func PlayerWeaponOverlayToken(weaponType int) string
- func PlayerWeaponOverlayTypeForJob(job int, weaponType int, dualWeapon bool) int
- func PlayerWeaponViewID(manager *Manager, weaponValue int) int
- func RSMModelCandidates(name string) []string
- func SkillIconTextureCandidates(resource string, skillID int) []string
- func WaterTextureCandidates(waterType, frame int) []string
- type ACT
- type ACTAction
- type ACTAnimation
- type ACTLayer
- type ACTPosition
- type BookContent
- type CameraViewPoint
- type ClientInfo
- type Connection
- type FogParameter
- type GAT
- type GATCell
- type GND
- type GNDCell
- type GNDLightmap
- type GNDSurface
- type GNDWater
- type GR2Action
- type GR2Animation
- type GR2Bone
- type GR2Container
- type GR2Curve
- type GR2File
- type GR2Geometry
- type GR2GeometryBatch
- type GR2Material
- type GR2Mesh
- type GR2Model
- type GR2ModelVertex
- type GR2SectorInfo
- type GR2SectorRef
- type GR2Skeleton
- type GR2Texture
- type GR2TrackGroup
- type GR2Transform
- type GR2TransformTrack
- type GR2TriGroup
- type GR2TriTopology
- type GR2Vertex
- type GR2VertexData
- type GRF
- type GRFEntry
- type GRFPackStats
- type IMF
- type IMFAction
- type IMFLayer
- type IMFMotion
- type ItemMetadata
- type Manager
- func (m *Manager) AccessoryResourceName(viewID int) (string, bool)
- func (m *Manager) CameraViewPoint(mapName string) (CameraViewPoint, bool)
- func (m *Manager) Find(name string) (string, bool)
- func (m *Manager) FindFirst(names []string) (string, bool)
- func (m *Manager) FogParameter(mapName string) (FogParameter, bool)
- func (m *Manager) HasBook(itemID uint16) bool
- func (m *Manager) HasFileExact(name string) bool
- func (m *Manager) IsIndoorMap(mapName string) bool
- func (m *Manager) ItemCardIllustrationName(itemID int) (string, bool)
- func (m *Manager) ItemCardPostfix(itemID int) bool
- func (m *Manager) ItemCardPrefixName(itemID int) (string, bool)
- func (m *Manager) ItemClassNum(itemID int) (int, bool)
- func (m *Manager) ItemDescription(itemID int, identified bool) ([]string, bool)
- func (m *Manager) ItemDisplayName(itemID int, identified bool) (string, bool)
- func (m *Manager) ItemResourceName(itemID int, identified bool) (string, bool)
- func (m *Manager) ItemSlotCount(itemID int) (int, bool)
- func (m *Manager) LoadBook(itemID uint16) (BookContent, error)
- func (m *Manager) MsgString(id int) (string, bool)
- func (m *Manager) NonPCResourceName(job int) (string, bool)
- func (m *Manager) PetTalk(data uint32) (string, bool)
- func (m *Manager) PlayerWeaponViewID(weaponValue int) int
- func (m *Manager) ReadFile(name string) ([]byte, error)
- func (m *Manager) ReadFileExact(name string) ([]byte, error)
- func (m *Manager) ReadFirst(names []string) (string, []byte, bool)
- func (m *Manager) SkillDescription(skillID int) ([]string, bool)
- func (m *Manager) SkillDisplayName(skillID int) (string, bool)
- func (m *Manager) SkillMaxLevel(skillID int) (int, bool)
- func (m *Manager) SkillResourceName(skillID int) (string, bool)
- func (m *Manager) SkillTreePositions(job int) (map[int]int, bool)
- func (m *Manager) SongTalkLine(kind SongTalkKind) (string, bool)
- type Palette
- type RSM
- type RSMFace
- type RSMNode
- type RSMPositionKeyframe
- type RSMRotationKeyframe
- type RSMScaleKeyframe
- type RSMTextureAnimation
- type RSMTextureKeyframe
- type RSMTextureKeyframeGroup
- type RSMTextureRef
- type RSMTextureVertex
- type RSMVector3
- type RSMVolumeBox
- type RSW
- type RSWEffect
- type RSWFiles
- type RSWGround
- type RSWLight
- type RSWModel
- type RSWObjectLight
- type RSWSound
- type RSWVector3
- type RSWWater
- type SPR
- type SPRFrame
- type STR
- type STRAnimation
- type STRLayer
- type SongTalkKind
Constants ¶
View Source
const ( GATTypeNone uint32 = 1 << 0 GATTypeWalkable uint32 = 1 << 1 GATTypeWater uint32 = 1 << 2 GATTypeSnipable uint32 = 1 << 3 )
View Source
const ( GR2TextureEncodingRaw int32 = 1 GR2TextureEncodingS3TC int32 = 2 GR2TextureEncodingBink int32 = 3 )
View Source
const ( SPRFramePalette = 0 SPRFrameRGBA = 1 )
Variables ¶
View Source
var ( ErrGRFUnsupportedEncryption = errors.New("grf entry uses unsupported encryption") ErrGRFUnsupportedVersion = errors.New("unsupported grf version") ErrGRFNotFound = errors.New("grf entry not found") )
View Source
var GR2IdentityTransform = GR2Transform{ Rotation: [4]float32{0, 0, 0, 1}, ScaleShear: [9]float32{1, 0, 0, 0, 1, 0, 0, 0, 1}, }
Functions ¶
func BookResourcePath ¶ added in v0.10.0
func CardIllustrationTextureCandidates ¶ added in v0.10.0
func EffectTextureCandidates ¶
func FormatGroundItemLabel ¶
func GATCellType ¶
func GR2BoneTypeFromName ¶
func GroundTextureCandidates ¶
func HasPlayerJobToken ¶
func IsDualWeaponPlayerJob ¶
func IsGR2ResourceName ¶
func LoadImageExact ¶
func NPCCutinTextureCandidates ¶ added in v0.9.0
func NormalizePlayerHead ¶
func PlayerBodyResourcePath ¶
func PlayerJobToken ¶
func PlayerSexLabel ¶
func PlayerSexToken ¶
func PlayerShieldToken ¶
func PlayerWeaponIsBow ¶
func PlayerWeaponViewID ¶
func RSMModelCandidates ¶
func WaterTextureCandidates ¶
Types ¶
type ACTAction ¶
type ACTAction struct {
Animations []ACTAnimation
DelayMS float32
}
type ACTAnimation ¶
type ACTAnimation struct {
Layers []ACTLayer
Sound int
Pos []ACTPosition
}
type ACTPosition ¶
type BookContent ¶ added in v0.10.0
func ParseBookContent ¶ added in v0.10.0
func ParseBookContent(data []byte) BookContent
type CameraViewPoint ¶
type CameraViewPoint struct {
MinDistance int
DistanceScope int
InitialDistance int
MinLongitude int
MaxLongitude int
InitialLongitude int
MaxLatitude int
MinLatitude int
InitialLatitude int
}
func (CameraViewPoint) LocksLongitude ¶
func (v CameraViewPoint) LocksLongitude() bool
type ClientInfo ¶
type ClientInfo struct {
ServiceType string
Connections []Connection
}
func ParseClientInfo ¶
func ParseClientInfo(data []byte) (ClientInfo, error)
func ParseClientInfoFile ¶
func ParseClientInfoFile(path string) (ClientInfo, error)
type Connection ¶
type FogParameter ¶
type GND ¶
type GND struct {
VersionMajor byte
VersionMinor byte
Width int
Height int
Zoom float32
Water GNDWater
Textures []string
Lightmaps []GNDLightmap
Surfaces []GNDSurface
Cells []GNDCell
}
type GNDLightmap ¶
type GNDSurface ¶
type GR2Animation ¶
type GR2Bone ¶
type GR2Bone struct {
Name string
ParentIndex int32
Transform GR2Transform
InverseWorld [16]float32
}
type GR2Container ¶
type GR2Container struct {
Version uint32
Data []byte
SectorOffsets []int
Sectors []GR2SectorInfo
TypeRef GR2SectorRef
RootRef GR2SectorRef
}
func ParseGR2Container ¶
func ParseGR2Container(data []byte) (*GR2Container, error)
func (*GR2Container) RefOffset ¶
func (c *GR2Container) RefOffset(ref GR2SectorRef) (int, error)
type GR2File ¶
type GR2File struct {
Textures []GR2Texture
Materials []GR2Material
Skeletons []GR2Skeleton
VertexDatas []GR2VertexData
TriTopologies []GR2TriTopology
Meshes []GR2Mesh
Models []GR2Model
TrackGroups []GR2TrackGroup
Animations []GR2Animation
}
func ParseGR2File ¶
func ParseGR2File(container *GR2Container) (*GR2File, error)
type GR2Geometry ¶
type GR2Geometry struct {
Vertices []GR2ModelVertex
Indices []uint32
Batches []GR2GeometryBatch
BoneCount int
Center [3]float32
Size [3]float32
}
func BuildGR2Geometry ¶
func BuildGR2Geometry(file *GR2File, modelIndex int) (*GR2Geometry, error)
type GR2GeometryBatch ¶
type GR2Material ¶
type GR2Model ¶
type GR2Model struct {
Name string
SkeletonIndex *int
InitialPlacement GR2Transform
MeshIndices []int
}
type GR2ModelVertex ¶
type GR2SectorInfo ¶
type GR2SectorRef ¶
type GR2Skeleton ¶
type GR2Texture ¶
type GR2Texture struct {
FromFileName string
Width int32
Height int32
Encoding int32
SubFormat int32
BytesPerPixel int32
ComponentBits [4]int32
Pixels []byte
}
func (GR2Texture) HasAlpha ¶
func (t GR2Texture) HasAlpha() bool
func (GR2Texture) RGBA ¶
func (t GR2Texture) RGBA() ([]byte, error)
type GR2TrackGroup ¶
type GR2TrackGroup struct {
Name string
TransformTracks []GR2TransformTrack
InitialPlacement GR2Transform
}
type GR2Transform ¶
type GR2TransformTrack ¶
type GR2TriGroup ¶
type GR2TriTopology ¶
type GR2TriTopology struct {
Groups []GR2TriGroup
Indices []uint32
}
type GR2VertexData ¶
type GR2VertexData struct {
Vertices []GR2Vertex
}
type GRF ¶
type GRF struct {
// contains filtered or unexported fields
}
func (*GRF) NamesWithSuffix ¶
type GRFPackStats ¶
func PackGRF ¶
func PackGRF(outputPath, root string) (GRFPackStats, error)
type IMF ¶
func (*IMF) LayerForPriority ¶
type ItemMetadata ¶
type ItemMetadata struct {
UnidentifiedDisplayName string
IdentifiedDisplayName string
UnidentifiedResource string
IdentifiedResource string
CardIllustration string
UnidentifiedDescription []string
IdentifiedDescription []string
SlotCount int
ClassNum int
ClassNumSet bool
CardPrefixName string
CardPostfix bool
}
type Manager ¶
type Manager struct {
Root string
ClientInfo ClientInfo
FoundFiles []string
Archives []*GRF
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) AccessoryResourceName ¶
func (*Manager) CameraViewPoint ¶
func (m *Manager) CameraViewPoint(mapName string) (CameraViewPoint, bool)
func (*Manager) FogParameter ¶
func (m *Manager) FogParameter(mapName string) (FogParameter, bool)
func (*Manager) HasFileExact ¶ added in v0.10.0
HasFileExact reports whether a resource exists at exactly name. Unlike ReadFile, it does not use the legacy suffix fallback for archive entries.
func (*Manager) IsIndoorMap ¶
func (*Manager) ItemCardIllustrationName ¶ added in v0.10.0
func (*Manager) ItemCardPostfix ¶
func (*Manager) ItemCardPrefixName ¶
func (*Manager) ItemDescription ¶
func (*Manager) ItemDisplayName ¶
func (*Manager) ItemResourceName ¶
func (*Manager) LoadBook ¶ added in v0.10.0
func (m *Manager) LoadBook(itemID uint16) (BookContent, error)
func (*Manager) PlayerWeaponViewID ¶
func (*Manager) SkillTreePositions ¶ added in v0.10.0
SkillTreePositions returns the read-only client-defined grid position for each skill belonging to job. Positions are zero-based in seven columns.
func (*Manager) SongTalkLine ¶
func (m *Manager) SongTalkLine(kind SongTalkKind) (string, bool)
type RSM ¶
type RSMNode ¶
type RSMNode struct {
Name string
ParentName string
TextureRefs []RSMTextureRef
Matrix [9]float32
Offset RSMVector3
Position RSMVector3
RotationAngle float32
RotationAxis RSMVector3
Scale RSMVector3
Vertices []RSMVector3
TextureVertices []RSMTextureVertex
Faces []RSMFace
ScaleKeyframes []RSMScaleKeyframe
RotationKeyframes []RSMRotationKeyframe
PositionKeyframes []RSMPositionKeyframe
TextureKeyframeGroups []RSMTextureKeyframeGroup
}
type RSMPositionKeyframe ¶
type RSMPositionKeyframe struct {
Frame int32
Pos RSMVector3
Data float32
Int int32
}
type RSMRotationKeyframe ¶
type RSMScaleKeyframe ¶
type RSMScaleKeyframe struct {
Frame int32
Scale RSMVector3
Data float32
}
type RSMTextureAnimation ¶
type RSMTextureAnimation struct {
Type int32
Frames []RSMTextureKeyframe
}
type RSMTextureKeyframe ¶
type RSMTextureKeyframeGroup ¶
type RSMTextureKeyframeGroup struct {
TextureID int32
Animation []RSMTextureAnimation
}
type RSMTextureRef ¶
type RSMTextureVertex ¶
type RSMVector3 ¶
type RSMVolumeBox ¶
type RSMVolumeBox struct {
Size RSMVector3
Position RSMVector3
Rotation RSMVector3
Flag int32
}
type RSW ¶
type RSWEffect ¶
type RSWEffect struct {
Name string
Position RSWVector3
ID int32
Delay float32
Param [4]float32
}
type RSWModel ¶
type RSWModel struct {
Name string
AnimType int32
AnimSpeed float32
BlockType int32
UnknownByte byte
UnknownInt int32
Filename string
NodeName string
Position RSWVector3
Rotation RSWVector3
Scale RSWVector3
}
type RSWObjectLight ¶
type RSWObjectLight struct {
Name string
Position RSWVector3
Color color.RGBA
Range float32
}
type RSWVector3 ¶
type SPR ¶
type STRAnimation ¶
type STRLayer ¶
type STRLayer struct {
Textures []string
Animations []STRAnimation
}
type SongTalkKind ¶
type SongTalkKind int
const ( SongTalkScream SongTalkKind = iota SongTalkFrostJoke )
Source Files
¶
- act.go
- book.go
- clientinfo.go
- doc.go
- gat.go
- gnd.go
- gr2.go
- gr2_bink.go
- gr2_geometry.go
- gr2_oodle.go
- gr2_range.go
- grf.go
- grf_decrypt.go
- grf_writer.go
- image.go
- imf.go
- item_resource.go
- lub.go
- manager.go
- msgstring.go
- nonpc_resource.go
- pal.go
- pet_talk.go
- player_resource.go
- rsm.go
- rsw.go
- skill_resource.go
- song_talk.go
- spr.go
- str.go
- tga.go
Click to show internal directories.
Click to hide internal directories.