ark

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package ark provides functions to retrieve resources of the game Arknights. This package only do fetching, unzipping, unpacking and decrypting resources. To do other works, such as parsing BSON or JSON tables or processing graphics assets, use the subpackages.

tools/extractor is required.

Index

Constants

View Source
const PictureArtPath = "assets/torappu/dynamicassets/avg"

Variables

Functions

func LanguageCodeUnderscore

func LanguageCodeUnderscore(s Server) string

Types

type CharacterArt

type CharacterArt struct {
	ID             string
	Kind           string
	BodyVariations []CharacterArtBodyVariation
}

func (*CharacterArt) BodyPath

func (a *CharacterArt) BodyPath(bodyNum int) string

func (*CharacterArt) BodyPathAlpha

func (a *CharacterArt) BodyPathAlpha(bodyNum int) string

func (*CharacterArt) FacePath

func (a *CharacterArt) FacePath(bodyNum int, faceNum int) string

func (*CharacterArt) FacePathAlpha

func (a *CharacterArt) FacePathAlpha(bodyNum int, faceNum int) string

type CharacterArtBodyVariation

type CharacterArtBodyVariation struct {
	BodySprite      string
	BodySpriteAlpha string
	FaceRectangle   image.Rectangle
	FaceVariations  []CharacterArtFaceVariation
}

type CharacterArtFaceVariation

type CharacterArtFaceVariation struct {
	FaceSprite      string
	FaceSpriteAlpha string
	WholeBody       bool
}

type CharacterArtImage

type CharacterArtImage struct {
	Image   image.Image
	Art     *CharacterArt
	BodyNum int
	FaceNum int
}

func (*CharacterArtImage) ID

func (i *CharacterArtImage) ID() string

type CharacterSprite

type CharacterSprite struct {
	Sprite struct {
		MPathID int64 `json:"m_PathID"`
	} `json:"sprite"`
	AlphaTex struct {
		MPathID int64 `json:"m_PathID"`
	} `json:"alphaTex"`
	IsWholeBody int `json:"isWholeBody"`
}

type CharacterSpriteHub

type CharacterSpriteHub struct {
	Sprites []CharacterSprite `json:"sprites"`
	FacePos struct {
		X float64 `json:"x"`
		Y float64 `json:"y"`
	} `json:"FacePos"`
	FaceSize struct {
		X float64 `json:"x"`
		Y float64 `json:"y"`
	} `json:"FaceSize"`
}

type CharacterSpriteHubGroup

type CharacterSpriteHubGroup struct {
	SpriteGroups []CharacterSpriteHub `json:"spriteGroups"`
}

type PictureArt

type PictureArt struct {
	ID   string
	Name string
	Kind string
}

func (*PictureArt) Path

func (a *PictureArt) Path() string

type PictureArtImage

type PictureArtImage struct {
	Image image.Image
	Art   *PictureArt
}

type Processor

type Processor struct {
	Root string
}

Processor provides functionalities for processing art. The term "process" here refers to merging color channel and alpha channel of arts together, merging faces variation and bodies of character arts together, etc.

func (*Processor) ProcessCharacterArt

func (p *Processor) ProcessCharacterArt(art *CharacterArt) ([]CharacterArtImage, error)

ProcessCharacterArt process a character art.

Since picture arts are complicated, the process operation consists of:

  • Decode all relevant images, including color channel and alpha channel of faces and bodies image.
  • For each face or body, merge the alpha channels onto the color channels.
  • For each face, merge it onto its corresponding body.

func (*Processor) ProcessPictureArt

func (p *Processor) ProcessPictureArt(art *PictureArt) (*PictureArtImage, error)

ProcessPictureArt process the picture art.

Since picture arts are trivial and different from character arts, the only thing this method does is to read the art image and return it.

type Scanner

type Scanner struct {
	Root string
}

func (*Scanner) ScanCharacter

func (scanner *Scanner) ScanCharacter(id string) (*CharacterArt, error)

func (*Scanner) ScanForCharacterArts

func (scanner *Scanner) ScanForCharacterArts() ([]*CharacterArt, error)

func (*Scanner) ScanForPictureArts

func (scanner *Scanner) ScanForPictureArts() ([]*PictureArt, error)

type Server

type Server = string

Server represents different server of the game. E.g., CN and EN.

const (
	// CnServer stands for China Server
	CnServer Server = "CN"

	// EnServer stands for English Server
	EnServer Server = "EN"

	// JpServer stands for Japan Server
	JpServer Server = "JP"

	// KrServer stands for Korea Server
	KrServer Server = "KR"

	// TwServer stands for Taiwan Server
	TwServer Server = "TW"
)

func MustParseServer

func MustParseServer(s string) Server

func ParseServer

func ParseServer(s string) (Server, error)

type Version

type Version = string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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