genshin

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapWeaponType

func WrapWeaponType(key string) string

Types

type Artifact

type Artifact struct {
	ArtifactType ArtifactType
	Level        int
	MainStats    ArtifactStat
	SubStats     []ArtifactStat
	SetNameHash  string
	IconKey      string
}

func (*Artifact) GetHash

func (a *Artifact) GetHash() string

func (*Artifact) SetName

func (a *Artifact) SetName() string

SetName returns the name of the artifact set

type ArtifactStat

type ArtifactStat struct {
	Stat  string
	Value float64
}

type ArtifactType

type ArtifactType int
const (
	FLOWER ArtifactType = iota
	FEATHER
	SANDS
	GOBLET
	CIRCLET
)

func TypeFromId

func TypeFromId(identifier string) ArtifactType

type CharacterData

type CharacterData struct {
	Element          string         `json:"Element"`
	TalentsImageKeys []string       `json:"Consts"`
	SkillOrder       []int          `json:"SkillOrder"`
	Skills           map[int]string `json:"Skills"`
	NameHash         int            `json:"NameTextMapHash"`
	SideIconKey      string         `json:"SideIconName"`
	WeaponType       string
	RawWeaponType    string          `json:"WeaponType"`
	Costumes         map[int]Costume `json:"Costumes"`
}

func (*CharacterData) GetHash

func (c *CharacterData) GetHash() string

func (*CharacterData) GetSideIconKey

func (c *CharacterData) GetSideIconKey() string

Returns the icon of the character when looking at the camera This is a key, and should be parsed with EnkaNetworkApi#GetGenshinIcon

This is no longer needed after 4.1

func (*CharacterData) Name

func (c *CharacterData) Name() string

type Costume

type Costume struct {
	SideIconKey string `json:"sideIconName"`
	IconKey     string `json:"icon"`
	Art         string `json:"art"`
}

type FightProp

type FightProp struct {
	Id   string
	Name string
}

type ItemType

type ItemType string
const (
	ITEM_VIRTUAL  ItemType = "ITEM_VIRTUAL"
	ITEM_MATERIAL ItemType = "ITEM_MATERIAL"

	UNIMPLEMENTED ItemType = "UNIMPLEMENTED"
)

type Material

type Material struct {
	Id              int
	Name            string
	NameHash        localization.HashInt
	Description     string
	DescriptionHash localization.HashInt
	IconKey         string
	Pictures        []string
	ItemType        ItemType

	// Only avaible for ITEM_MATERIAL
	// Because I'm lazy it might be present for others
	// be sure to check ItemType
	MaterialType string
	Stars        int
}

type NameCard

type NameCard struct {
	RawId int
	Url   string
}

type Pair added in v0.1.2

type Pair[T any] struct {
	Left  T
	Right T
}

type ProfilePicture added in v0.1.2

type ProfilePicture struct {
	Id       string
	IconPath string `json:"iconPath"`
}

type RawArtifactData

type RawArtifactData struct {
	Level            int   `json:"level"`
	MainPropId       int   `json:"mainPropId"`
	AppendPropIdList []int `json:"appendPropIdList"`
}

type RawArtifactMainData

type RawArtifactMainData struct {
	MainPropId string `json:"mainPropId"`
	StatValue  int64  `json:"statValue"`
}

type RawAvatarInfo

type RawAvatarInfo struct {
	AvatarId               int                    `json:"avatarId"`
	PropMap                map[string]interface{} `json:"propMap"`
	TalentIdList           []int                  `json:"talentIdList"`
	FightPropMap           map[string]float64     `json:"fightPropMap"`
	SkillDepotId           int                    `json:"skillDepotId"`
	InherentProudSkillList []int                  `json:"inherentProudSkillList"`
	EquipList              []RawEquipData         `json:"equipList"`
	FetterInfo             RawFetterInfo          `json:"fetterInfo"`
}

type RawEquipData

type RawEquipData struct {
	ItemId int64 `json:"itemId"`
	// Empty if weapon
	ArtifactData *RawArtifactData `json:"reliquary,omitempty"`
	// Empty if artifact
	WeaponData *RawWeaponData `json:"weapon,omitempty"`
	Flat       RawFlatData    `json:"flat"`
}

type RawFetterInfo

type RawFetterInfo struct {
	ExpLevel int `json:"expLevel"`
}

type RawFlatData

type RawFlatData struct {
	NameTextMapHash    string              `json:"nameTextMapHash"`
	SetNameTextMapHash string              `json:"setNameTextMapHash"`
	RankLevel          int                 `json:"rankLevel"`
	WeaponStats        []RawSubData        `json:"weaponStats"`
	ArtifactMainData   RawArtifactMainData `json:"artifactMainData"`
	ReliquarySubStats  []RawSubData        `json:"reliquarySubStats"`
	Icon               string              `json:"icon"`
	EquipType          string              `json:"equipType"`
}

type RawGenshinUser

type RawGenshinUser struct {
	PlayerInfo     RawPlayerInfo   `json:"playerInfo"`
	AvatarInfoList []RawAvatarInfo `json:"avatarInfoList"`
	Ttl            int             `json:"ttl"`
	Uid            string          `json:"uid"`
}

func (*RawGenshinUser) GetTtl

func (user *RawGenshinUser) GetTtl() int

type RawMaterial

type RawMaterial struct {
	Id              int      `json:"id"`
	NameHash        int      `json:"nameTextMapHash"`
	DescriptionHash int      `json:"descTextMapHash"`
	IconKey         string   `json:"icon"`
	Pictures        []string `json:"picPath"`
	ItemType        string   `json:"itemType"`
	MaterialType    string   `json:"materialType,omitempty"`
	Stars           int      `json:"rankLevel,omitempty"`
}

func (RawMaterial) ToMaterial

func (r RawMaterial) ToMaterial() Material

type RawPlayerInfo

type RawPlayerInfo struct {
	Nickname                  string              `json:"nickname"`
	Level                     int                 `json:"level"`
	Signature                 *string             `json:"signature"`
	WorldLevel                int                 `json:"worldLevel"`
	NameCardId                int                 `json:"nameCardId"`
	FinishedAchievementsCount int                 `json:"finishedAchievementNum"`
	TowerFloorIndex           int                 `json:"towerFloorIndex"`
	TowerLevelIndex           int                 `json:"towerLevelIndex"`
	ShowAvatarInfoList        []RawShowAvatarInfo `json:"showAvatarInfoList"`
	ShowNameCardIdList        []int               `json:"showNameCardIdList"`
	ProfilePicture            RawProfilePicture   `json:"profilePicture"`
}

type RawProfilePicture

type RawProfilePicture struct {
	AvatarId int `json:"avatarId,omitempty"`
	Id       int `json:"id,omitempty"`
	// Fallback if above are empty
	CostumeId int `json:"costume_id,omitempty"`
}

As of version 4.1, HoYo is not storing an avatar ID anymore, but rather a profile picture ID. Both fields will continue to exist, as some people MAY not have migrated yet (changed their avatar after 4.1).

type RawShowAvatarInfo

type RawShowAvatarInfo struct {
	AvatarId  int `json:"avatarId"`
	Level     int `json:"level"`
	CostumeId int `json:"costumeId"`
}

type RawSubData

type RawSubData struct {
	AppendPropId string  `json:"appendPropId"`
	StatValue    float64 `json:"statValue"`
}

type RawWeaponData

type RawWeaponData struct {
	Level        int            `json:"level"`
	PromoteLevel int            `json:"promoteLevel"`
	AffixMap     map[string]int `json:"affixMap"`
}

type ShowCaseCharacter

type ShowCaseCharacter struct {
	AvatarId  int
	Level     int
	CostumeId int
}

type User

type User struct {
	NickName              string
	Signature             string
	Level                 int
	WorldLevel            int
	NameCardId            int
	CompletedAchievements int
	TowerFloorIndex       int
	TowerLevelIndex       int
	ShowCasedCharacters   []ShowCaseCharacter
	// Ids of the users NameCards, use EnkaNetworkApi#GetNameCardName to get the name
	NameCardsId    []int
	ProfilePicture RawProfilePicture
	Characters     []UserCharacter
}

func UserFromRaw

func UserFromRaw(rawUser *RawGenshinUser) *User

type UserCharacter

type UserCharacter struct {
	Id              int
	Constellation   int
	Experience      int
	Ascension       int
	Level           int
	FriendshipLevel int
	FightProperties map[FightProp]float64
	Artifacts       []Artifact
	Weapon          *Weapon
}

type Weapon

type Weapon struct {
	NameHash   string
	Level      int
	Ascension  int
	Refinement int
	Icon       string
	Stats      []WeaponStat
}

func (*Weapon) GetHash

func (w *Weapon) GetHash() string

func (*Weapon) Name

func (w *Weapon) Name() string

type WeaponStat

type WeaponStat struct {
	Stat  string
	Value float64
}

Jump to

Keyboard shortcuts

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