from typing import Optional from enum import Enum from core.utils import floor_to_nearest_005 class OngekiConstants: GAME_CODE = "SDDT" CONFIG_NAME = "ongeki.yaml" VER_ONGEKI = 0 VER_ONGEKI_PLUS = 1 VER_ONGEKI_SUMMER = 2 VER_ONGEKI_SUMMER_PLUS = 3 VER_ONGEKI_RED = 4 VER_ONGEKI_RED_PLUS = 5 VER_ONGEKI_BRIGHT = 6 VER_ONGEKI_BRIGHT_MEMORY = 7 VER_ONGEKI_BRIGHT_MEMORY_ACT3 = 8 EVT_TYPES: Enum = Enum( "EVT_TYPES", [ "Announcement", "Movie", "AddMyList", "UnlockChapter", "JewelEvent", "RankingEvent", "AcceptRankingEvent", "UnlockMusic", "UnlockCard", "UnlockTrophy", "UnlockNamePlate", "UnlockLimitBreakItem", "MissionEvent", "DailyBonus", "UnlockBossLockEarly", "UnlockPurchaseItem", "TechChallengeEvent", "AcceptTechChallengeEvent", "SilverJewelEvent", "Max", "None", ], ) REWARD_TYPES: Enum = Enum( "REWARD_TYPES", [ "Card", "NamePlate", "Trophy", "LimitBreakItem", "AlmightyJewel", "Money", "Music", "ProfileVoice", "Present", "ChapterJewel", "GachaTicket", "KaikaItem", "ExpUpItem", "IntimateUpItem", "BookItem", "SystemVoice", "Costume", "Medal", "Attachment", "UnlockItem", "Max", "None", ], ) class CM_GACHA_KINDS(Enum): Normal = 0 Pickup = 1 BonusRestored = 2 Free = 3 PickupBonusRestored = 4 class RARITY_TYPES(Enum): N = 0 R = 1 SR = 2 SSR = 3 SRPlus = 12 # The game expects the server to give Lunatic an ID of 10, while the game uses 4 internally... except in Music.xml class DIFF_NAME(Enum): Basic = 0 Advanced = 1 Expert = 2 Master = 3 Lunatic = 10 VERSION_NAMES = ( "O.N.G.E.K.I.", "O.N.G.E.K.I. PLUS", "O.N.G.E.K.I. SUMMER", "O.N.G.E.K.I. SUMMER PLUS", "O.N.G.E.K.I. R.E.D.", "O.N.G.E.K.I. R.E.D. PLUS", "O.N.G.E.K.I. bright", "O.N.G.E.K.I. bright MEMORY", "O.N.G.E.K.I. bright MEMORY Act.3", ) VERSION_LUT = { "100": VER_ONGEKI, "105": VER_ONGEKI_PLUS, "110": VER_ONGEKI_SUMMER, "115": VER_ONGEKI_SUMMER_PLUS, "120": VER_ONGEKI_RED, "125": VER_ONGEKI_RED_PLUS, "130": VER_ONGEKI_BRIGHT, "135": VER_ONGEKI_BRIGHT_MEMORY, "140": VER_ONGEKI_BRIGHT_MEMORY, "145": VER_ONGEKI_BRIGHT_MEMORY_ACT3, } @classmethod def game_ver_to_string(cls, ver: int): return cls.VERSION_NAMES[ver] @classmethod def int_ver_to_game_ver(cls, ver: int) -> Optional[int]: """ Takes an int ver (ex 100 for 1.00) and returns an internal game version """ return cls.VERSION_LUT.get(str(floor_to_nearest_005(ver)), None)