Skip to content

Commit

Permalink
Merge pull request #2 from pizza-studio/update-enka-asset-6
Browse files Browse the repository at this point in the history
Update EnkaDB Assets
  • Loading branch information
ShikiSuen authored Apr 24, 2024
2 parents 09e28f6 + a917ff2 commit c2381dc
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 5 deletions.
78 changes: 78 additions & 0 deletions store/characters.json.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct CharactersJSON: Codable {
let the10000092: The10000092
let the10000093: The10000093
let the10000094: The10000094
let the10000096: The10000096
let the10000005503: The10000005503
let the10000005504: The10000005
let the10000005506: The10000005506
Expand Down Expand Up @@ -183,6 +184,7 @@ struct CharactersJSON: Codable {
case the10000092 = "10000092"
case the10000093 = "10000093"
case the10000094 = "10000094"
case the10000096 = "10000096"
case the10000005503 = "10000005-503"
case the10000005504 = "10000005-504"
case the10000005506 = "10000005-506"
Expand Down Expand Up @@ -298,6 +300,7 @@ extension CharactersJSON {
the10000092: The10000092? = nil,
the10000093: The10000093? = nil,
the10000094: The10000094? = nil,
the10000096: The10000096? = nil,
the10000005503: The10000005503? = nil,
the10000005504: The10000005? = nil,
the10000005506: The10000005506? = nil,
Expand Down Expand Up @@ -393,6 +396,7 @@ extension CharactersJSON {
the10000092: the10000092 ?? self.the10000092,
the10000093: the10000093 ?? self.the10000093,
the10000094: the10000094 ?? self.the10000094,
the10000096: the10000096 ?? self.the10000096,
the10000005503: the10000005503 ?? self.the10000005503,
the10000005504: the10000005504 ?? self.the10000005504,
the10000005506: the10000005506 ?? self.the10000005506,
Expand Down Expand Up @@ -7921,6 +7925,80 @@ extension The10000094 {
}
}

// MARK: - The10000096
struct The10000096: Codable {
let element: String
let consts: [String]
let skillOrder: [Int]
let skills: [String: String]
let proudMap: [String: Int]
let nameTextMapHash: Int
let sideIconName, qualityType, weaponType: String

enum CodingKeys: String, CodingKey {
case element = "Element"
case consts = "Consts"
case skillOrder = "SkillOrder"
case skills = "Skills"
case proudMap = "ProudMap"
case nameTextMapHash = "NameTextMapHash"
case sideIconName = "SideIconName"
case qualityType = "QualityType"
case weaponType = "WeaponType"
}
}

// MARK: The10000096 convenience initializers and mutators

extension The10000096 {
init(data: Data) throws {
self = try newJSONDecoder().decode(The10000096.self, from: data)
}

init(_ json: String, using encoding: String.Encoding = .utf8) throws {
guard let data = json.data(using: encoding) else {
throw NSError(domain: "JSONDecoding", code: 0, userInfo: nil)
}
try self.init(data: data)
}

init(fromURL url: URL) throws {
try self.init(data: try Data(contentsOf: url))
}

func with(
element: String? = nil,
consts: [String]? = nil,
skillOrder: [Int]? = nil,
skills: [String: String]? = nil,
proudMap: [String: Int]? = nil,
nameTextMapHash: Int? = nil,
sideIconName: String? = nil,
qualityType: String? = nil,
weaponType: String? = nil
) -> The10000096 {
return The10000096(
element: element ?? self.element,
consts: consts ?? self.consts,
skillOrder: skillOrder ?? self.skillOrder,
skills: skills ?? self.skills,
proudMap: proudMap ?? self.proudMap,
nameTextMapHash: nameTextMapHash ?? self.nameTextMapHash,
sideIconName: sideIconName ?? self.sideIconName,
qualityType: qualityType ?? self.qualityType,
weaponType: weaponType ?? self.weaponType
)
}

func jsonData() throws -> Data {
return try newJSONEncoder().encode(self)
}

func jsonString(encoding: String.Encoding = .utf8) throws -> String? {
return String(data: try self.jsonData(), encoding: encoding)
}
}

// MARK: - Helper functions for creating encoders and decoders

func newJSONDecoder() -> JSONDecoder {
Expand Down
10 changes: 5 additions & 5 deletions store/loc.json.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import Foundation
struct LOCJSON: Codable {
let en, ru, vi, th: [String: String]
let pt, ko, ja, id: [String: String]
let fr, es, de, zhTW: [String: String]
let fr, es, de, zhTw: [String: String]
let zhCN, it, tr, ar: [String: String]
let uk: [String: String]

enum CodingKeys: String, CodingKey {
case en, ru, vi, th, pt, ko, ja, id, fr, es, de
case zhTW = "zh-TW"
case zhCN = "zh-CN"
case zhTw = "zh-tw"
case zhCN = "zh-cn"
case it, tr, ar, uk
}
}
Expand Down Expand Up @@ -51,7 +51,7 @@ extension LOCJSON {
fr: [String: String]? = nil,
es: [String: String]? = nil,
de: [String: String]? = nil,
zhTW: [String: String]? = nil,
zhTw: [String: String]? = nil,
zhCN: [String: String]? = nil,
it: [String: String]? = nil,
tr: [String: String]? = nil,
Expand All @@ -70,7 +70,7 @@ extension LOCJSON {
fr: fr ?? self.fr,
es: es ?? self.es,
de: de ?? self.de,
zhTW: zhTW ?? self.zhTW,
zhTw: zhTw ?? self.zhTw,
zhCN: zhCN ?? self.zhCN,
it: it ?? self.it,
tr: tr ?? self.tr,
Expand Down

0 comments on commit c2381dc

Please sign in to comment.