arkres

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package arkres 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 (
	KeySize         = 16
	IVSize          = 16
	MagicOffsetSize = 128
)
View Source
const (
	DefaultPrefix = "assets/torappu/dynamicassets"
)

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context, resVersion string, dst string, filter ...*regexp.Regexp) error

func GetIncrementally

func GetIncrementally(ctx context.Context, oldResVer string, newResVer string, dst string, filter ...*regexp.Regexp) error

func GetRes

func GetRes(ctx context.Context, infos []Info, dst string) error

GetRes gets the resources specified by infos into dst.

func GetResURL

func GetResURL(resVersion string, res string) string

GetResURL gets the URL to download the specified asset with specified resource version.

func GetResVersion

func GetResVersion() (string, error)

GetResVersion gets the current resource version.

func SetChatMask

func SetChatMask(newChatMask []byte)

Types

type AbInfo

type AbInfo struct {
	Name      string `json:"name"`
	Hash      string `json:"hash"`
	MD5       string `json:"md5"`
	TotalSize int    `json:"totalSize"`
	AbSize    int    `json:"abSize"`
	Cid       int    `json:"cid"`
	Pid       string `json:"pid,omitempty"`
	Type      string `json:"type,omitempty"`
}

type FullPack

type FullPack struct {
	TotalSize int    `json:"totalSize"`
	AbSize    int    `json:"abSize"`
	Type      string `json:"type"`
	Cid       int    `json:"cid"`
}

type HotUpdateList

type HotUpdateList struct {
	FullPack        FullPack   `json:"fullPack"`
	VersionID       string     `json:"versionId"`
	AbInfos         []AbInfo   `json:"abInfos"`
	CountOfTypedRes int        `json:"countOfTypedRes"`
	PackInfos       []PackInfo `json:"packInfos"`
}

HotUpdateList represents a raw response of "https://ak.hycdn.cn/assetbundle/official/Android/assets/{resVersion}/hot_update_list.json"

func GetRawResources

func GetRawResources(resVersion string) (HotUpdateList, error)

GetRawResources gets the raw response of Arknights resource API with specified resource version.

type Info

type Info struct {
	Name       string
	MD5        string
	ResVersion string
}

func FilterResInfos

func FilterResInfos(infos []Info, predicate func(i Info) bool) []Info

FilterResInfos returns a slice containing all Info matching the specified predicate.

func FilterResInfosRegexp

func FilterResInfosRegexp(infos []Info, r []*regexp.Regexp) []Info

FilterResInfosRegexp returns a slice containing all Info matching the specified regexp.

func GetResInfos

func GetResInfos(resVersion string) ([]Info, error)

GetResInfos gets the resource infos of specified resource version.

func (*Info) CreateURL

func (i *Info) CreateURL() string

type PackInfo

type PackInfo struct {
	Name      string `json:"name"`
	Hash      string `json:"hash"`
	MD5       string `json:"md5"`
	TotalSize int    `json:"totalSize"`
	AbSize    int    `json:"abSize"`
	Cid       int    `json:"cid"`
}

type Version

type Version struct {
	ResVersion    string `json:"resVersion"`
	ClientVersion string `json:"clientVersion"`
}

Version represents a raw response of "https://ak-conf.hypergryph.com/config/prod/official/Android/version".

func GetRawVersion

func GetRawVersion() (Version, error)

GetRawVersion gets the raw response from Arknights version API.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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