From a917ff2d56566ae2d4089602c450bd5fbaa83dc3 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 24 Apr 2024 12:32:02 +0000 Subject: [PATCH] [create-pull-request] automated change --- store/characters.json.swift | 78 +++++++++++++++++++++++++++++++++++++ store/loc.json.swift | 10 ++--- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/store/characters.json.swift b/store/characters.json.swift index b26631a..5e372b2 100644 --- a/store/characters.json.swift +++ b/store/characters.json.swift @@ -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 @@ -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" @@ -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, @@ -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, @@ -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 { diff --git a/store/loc.json.swift b/store/loc.json.swift index 947dbb1..4d6dfd7 100644 --- a/store/loc.json.swift +++ b/store/loc.json.swift @@ -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 } } @@ -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, @@ -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,