Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Commit

Permalink
EnkaKitHSR // Fix skill icon missing issue happened with Stelle.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen committed Aug 11, 2024
1 parent db19ae8 commit c08c808
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ extension EnkaHSR.AvatarSummarized.AvatarMainInfo {
fetched: [EnkaHSR.QueryRelated.DetailInfo.SkillTreeItem]
) {
guard fetched.count >= 4, let firstTreeItem = fetched.first else { return nil }
let charIDStr = firstTreeItem.pointId.description.prefix(4).description
var charID = Int((Double(firstTreeItem.pointId) / 1000.0).rounded(.down))
if case .ofStelle = Protagonist(rawValue: charID) { charID -= 1 }
let charIDStr = charID.description
var levelAdditionList = [String: Int]()
if constellation > 1 {
for i in 1 ... constellation {
Expand Down
97 changes: 97 additions & 0 deletions Packages/EnkaKitHSR/Sources/EnkaKitHSR/Protagonist.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// (c) 2023 and onwards Pizza Studio (GPL v3.0 License).
// ====================
// This code is released under the GPL v3.0 License (SPDX-License-Identifier: GPL-3.0)

public enum Protagonist: Sendable {
// Male Protagonist in HSR
case ofCaelus
// Female Protagonist in HSR
case ofStelle
// Male Protagonist in Genshin Impact, a.k.a. Sora.
case ofAether
// Female Protagonist in Genshin Impact, a.k.a. Hotaru.
case ofLumine

// MARK: Lifecycle

public init?(rawValue: Int) {
switch rawValue {
case 10000005: self = .ofAether
case 10000007: self = .ofLumine
case 8001 ... 9000:
self = (rawValue % 2 == 0) ? .ofStelle : .ofCaelus
default: return nil
}
}

// MARK: Public

public var nameTranslationDict: [String: String] {
switch self {
case .ofCaelus: return [
"de-de": "Caelus",
"en-us": "Caelus",
"es-es": "Caelus",
"fr-fr": "Caelus",
"id-id": "Caelus",
"ja-jp": "",
"ko-kr": "카일루스",
"pt-pt": "Caelus",
"ru-ru": "Келус",
"th-th": "Caelus",
"vi-vn": "Caelus",
"zh-cn": "",
"zh-tw": "",
]
case .ofStelle: return [
"de-de": "Stella",
"en-us": "Stelle",
"es-es": "Estela",
"fr-fr": "Stelle",
"id-id": "Stelle",
"ja-jp": "",
"ko-kr": "스텔레",
"pt-pt": "Stelle",
"ru-ru": "Стелла",
"th-th": "Stelle",
"vi-vn": "Stelle",
"zh-cn": "",
"zh-tw": "",
]
case .ofAether: return [
"de-de": "Aether",
"en-us": "Aether",
"es-es": "Éter",
"fr-fr": "Aether",
"id-id": "Aether",
"it-it": "Aether",
"ja-jp": "",
"ko-kr": "아이테르",
"pt-pt": "Aether",
"ru-ru": "Итэр",
"th-th": "Aether",
"tr-tr": "Aether",
"vi-vn": "Aether",
"zh-cn": "",
"zh-tw": "",
]
case .ofLumine: return [
"de-de": "Lumine",
"en-us": "Lumine",
"es-es": "Lumina",
"fr-fr": "Lumine",
"id-id": "Lumine",
"it-it": "Lumine",
"ja-jp": "",
"ko-kr": "루미네",
"pt-pt": "Lumine",
"ru-ru": "Люмин",
"th-th": "Lumine",
"tr-tr": "Lumine",
"vi-vn": "Lumine",
"zh-cn": "",
"zh-tw": "",
]
}
}
}

0 comments on commit c08c808

Please sign in to comment.