Пример #1
0
class BattlePassMission(LocalizeAdapter):
    id = Adapter("Id", int)
    exp = Adapter("AddPoint", int)
    desc = Adapter("DescTextMapHash", Localizable)
    trigger = Adapter("TriggerConfig", dict)
    counter = Adapter("Progress", int)

    schedule = IdAdapter("ScheduleId", BPScheduleConfig)
    activity = IdAdapter("ActivityId", ActivityConfig)
Пример #2
0
class TagGroup(JsonAdapter):
    id = Adapter("GroupID", int)
    tags = Adapter("TagIDs", List[Tag], lambda x: [y for y in x if y != 0])

    def __init__(self, entry: Dict, tags: TagConfig) -> None:
        super().__init__(entry)
        self.tags = [tags.mappings[x] for x in self.tags if x in tags.mappings]

    def __repr__(self) -> str:
        return self.tags.__repr__()
Пример #3
0
class TrialSet(JsonAdapter):
    id = Adapter("ScheduleId", int)
    trials = Adapter("AvatarIndexIdList", List[TrialData], lambda x: [y for y in x if y != 0])

    def __init__(self, entry: Dict, trials: TrialDataConfig) -> None:
        super().__init__(entry)
        self.trials = [trials[x] for x in self.trials]

    def __repr__(self) -> str:
        return self.trials.__repr__()
Пример #4
0
class Achievement(LocalizeAdapter):
    id = Adapter("Id", int)
    times = Adapter("Progress", int)

    title = Adapter("TitleTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)

    reward = IdAdapter("FinishReward", RewardConfig)

    def __repr__(self) -> str:
        return f"<{self.id} {self.title.localize()}>"
Пример #5
0
class HangoutCG(LocalizeAdapter):
    id = Adapter("Id", int)
    title = Adapter("POKEBGGOPDK", Localizable)
    desc = Adapter("EDPEJIGGCMO", Localizable)

    gender = Adapter("CgType", CGType)

    chapter = Adapter("ChapterId", int)

    def __repr__(self) -> str:
        return self.title.__repr__()
Пример #6
0
class BattlePassMission(LocalizeAdapter):
    id = Adapter("Id", int)
    exp = Adapter("AddPoint", int)
    desc = Adapter("DescTextMapHash", Localizable)
    trigger = Adapter("TriggerConfig", dict)
    counter = Adapter("Progress", int)

    schedule = IdAdapter("ScheduleId", BPScheduleConfig)
    activity = IdAdapter("ActivityId", ActivityConfig)

    def __repr__(self) -> str:
        return f"<{self.desc.localize()} {self.exp}>"
Пример #7
0
class AvatarCodex(LocalizeAdapter):
    id = Adapter("SortId", int)
    factor = Adapter("SortFactor", int)

    avatar = IdAdapter("AvatarId", AvatarConfig)
    time = Adapter("BeginTime", datetime, lambda x: x)

    def __init__(self, entries: List[Dict]) -> None:
        super().__init__(entries)
        date, time = self.time.split(" ")
        date: List[int] = [int(x) for x in date.split('-')]
        time: List[int] = [int(x) for x in time.split(':')]
        self.time = datetime(*date, *time)
Пример #8
0
class Reward(JsonAdapter):
    id = Adapter("RewardId", int)
    items = Adapter("RewardItemList", List[ItemStack], lambda x: [y for y in x if y])

    def __init__(self, entry: Dict) -> None:
        super().__init__(entry)
        self.items = [ItemStack(x["ItemId"], x["ItemCount"]) for x in self.items]

    def __eq__(self, o: 'Reward') -> bool:
        a = self.items.copy()
        a.sort(key=lambda x: x.__id__)
        b = o.items.copy()
        b.sort(key=lambda x: x.__id__)
        return all(x == y for x, y in zip(a, b))
Пример #9
0
class Shop(LocalizeAdapter):
    id = Adapter("ShopId", int)
    type = Adapter("ShopType")

    city_id = Adapter("CityId", int)
    city_discount_level = Adapter("CityDiscountLevel", int)
    city_discout = Adapter("ScoinDiscountRate", float,
                           lambda x: float(x) / 100.0)

    goods_list: List['Good']

    def __init__(self, entries: List[Dict]) -> None:
        self.goods_list: List['Good'] = []
        super().__init__(entries)

    def __repr__(self) -> str:
        return f"<{self.id} {self.type}>"
Пример #10
0
class TrialAvatar(JsonAdapter):
    id = Adapter("TrialAvatarId", int)
    __avatar_param_list = Adapter("TrialAvatarParamList", list)
    __weapon_param_list = Adapter("TrialWeaponParamList", list)
    avatar = Avatar
    level = int
    weapon = WeaponEntry
    weapon_level = int

    def __init__(self, entry: Dict, avatar_config: AvatarConfig, weapon_config: WeaponConfig) -> None:
        super().__init__(entry)
        self.avatar = avatar_config[self.__avatar_param_list[0]]
        self.level = self.__avatar_param_list[1]
        self.weapon = weapon_config[self.__weapon_param_list[0]]
        self.weapon_level = self.__weapon_param_list[1]

    def __repr__(self) -> str:
        return f"<{self.avatar.name.localize()} {self.level} | {self.weapon.name.localize()} {self.weapon_level}>"
Пример #11
0
class Activity(LocalizeAdapter):
    id = Adapter("ActivityId", int)
    type = Adapter("ActivityType")
    name = Adapter("NameTextMapHash", Localizable)
    scene_tag = Adapter("ActivitySceneTag")
    cond_group = Adapter("CondGroupId", list)
    watcher_group = Adapter("WatcherId", list)

    def __repr__(self) -> str:
        return f"<{self.name.localize()} {self.id}>"
Пример #12
0
class TrialData(LocalizeAdapter):
    id = Adapter("TrialAvatarIndexId", int)
    id_internal = Adapter("Id", int)
    avatar_data = IdAdapter("TrialAvatarId", TrialAvatarConfig)
    dungeon = Adapter("DungeonId", int)
    support_avatars = Adapter("BattleAvatarsList", List[Avatar], lambda x: [int(y) for y in x.split(",")])
    reward = Adapter("FirstPassReward", int)
    title = Adapter("TitleTextMapHash", Localizable)
    info = Adapter("BriefInfoTextMapHash", Localizable)

    def __init__(self, entry: Dict, trial_config: TrialAvatarConfig) -> None:
        super().__init__(entry)
        self.support_avatars = [trial_config[x] for x in self.support_avatars]

    def __repr__(self) -> str:
        return f"<{self.avatar_data.avatar.name.localize()} {self.avatar_data.level}>"
Пример #13
0
class ArtifactEntry(LocalizeAdapter):
    id = Adapter("Id", int)
    rank = Adapter("RankLevel", int)
    weight = Adapter("Weight", int)
    __rank = Adapter("Rank", int)
    set_id = Adapter("SetID", int)
    item_type = Adapter("ItemType", ItemType)
    icon = Adapter("Icon")
    gadget_id = Adapter("GadgetId", int)
    max_level = Adapter("MaxLevel", int)
    base_exp = Adapter("BaseConvExp", int)

    main_depot = IdAdapter("MainPropDepotId", MainDepots)
    append_depot = Adapter("AppendPropDepotId", List[AppendDepot], lambda x: x)

    can_drop = Adapter("Dropable", bool)
    equip_type = Adapter("EquipType", EquipPart)

    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)

    can_destroy = Adapter("DestroyRule", bool,
                          lambda x: x == "DESTROY_RETURN_MATERIAL",
                          lambda x: False)
    recover_list = Union[List[ItemStack], None]

    def __init__(self, entry: Dict) -> None:
        super().__init__(entry)
        if self.can_destroy:
            self.recover_list = list(
                ItemStack(*x)
                for x in zip(entry['DestroyReturnMaterial'],
                             entry['DestroyReturnMaterialCount']))
        else:
            self.recover_list = None

    def __repr__(self) -> str:
        return f"<{self.rank}* {self.name.localize()} {self.id}>"
Пример #14
0
class WindGlider(LocalizeAdapter):
    id = Adapter("FlycloakId", int)
    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)
    json = Adapter("JsonName")
    item = IdAdapter("MaterialId", MaterialConfig)
Пример #15
0
class SkillUpgrade(LocalizeAdapter):
    id = Adapter("ProudSkillId", int)
    group = Adapter("ProudSkillGroupId", int)
    level = Adapter("Level", int)
    skill_type = Adapter("ProudSkillType", int)

    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)
    unlock = Adapter("UnlockDescTextMapHash", Localizable)
    param_desc = Adapter("ParamDescList", List[Localizable], lambda x: x)

    icon = Adapter("Icon")

    mora = Adapter("CoinCost", int)
    items = Adapter(
        "CostItems", List[ItemStack],
        lambda x: [ItemStack(**y) for y in x if "Id" in y and "Count" in y])
    filter = Adapter("FilterConds", list)
    ascension = Adapter("BreakLevel", int)

    param_list = Adapter("ParamList", list)

    def __init__(self, entries: List[Dict]) -> None:
        super().__init__(entries)
        self.param_desc = [
            Localizable(x, TextMap.__inst__) for x in self.param_desc
        ]

    def __repr__(self) -> str:
        return f"<{self.id} {self.level}>"
Пример #16
0
class Skill(LocalizeAdapter):
    id = Adapter("Id", int)
    icon = Adapter("SkillIcon")
    buff_icon = Adapter("BuffIcon")
    ability_name = Adapter("AbilityName")

    cd = Adapter("CdTime", float)
    charge = Adapter("MaxChargeNum", int)
    stamina = Adapter("CostStamina", float)
    min_energy = Adapter("EnergyMin", float)
    cd_slot = Adapter("CdSlot", int)

    element_type = Adapter("CostElemType", ElementType)
    energy_required = Adapter("CostElemVal", float)

    ranged = Adapter("IsRanged", bool)
    camera_lock = Adapter("IsAttackCameraLock", bool)
    default_locked = Adapter("DefaultLocked", bool)
    no_cd_reduce = Adapter("IgnoreCDMinusRatio", bool)
    show_icon_arrow = Adapter("ShowIconArrow", bool)
    no_stagger_after_hit = Adapter("ForceCanDoSkill", bool)
    survive_lethal = Adapter("NeedStore", bool)

    upgrade_group = Adapter(
        "ProudSkillGroupId", List[SkillUpgrade],
        lambda x: SkillUpgradeConfig.__inst__.group_mappings[x])

    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)

    lock_shape = Adapter("LockShape", LockShape)
    drag_type = Adapter("DragType", DragType)
Пример #17
0
class Constellation(LocalizeAdapter):
    id = Adapter("TalentId", int)
    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)
    prev = Adapter("PrevTalent", int)
Пример #18
0
class Good(LocalizeAdapter):
    id = Adapter("GoodsId", int)
    subtag = Adapter("SubTagNameTextMapHash", Localizable)

    __item = Adapter('ItemId', int)
    __count = Adapter("ItemCount", int)
    item: ItemStack
    buy_limit = Adapter("BuyLimit", int)

    coin_cost = Adapter("CostScoin", int, fallback=lambda x: 0)
    item_cost = Adapter(
        "CostItems",
        lambda x: [ItemStack(y["Id"], y["Count"]) for y in x if y])

    shop = IdAdapter("ShopType", ShopConfig)

    refresh_type = Adapter("RefreshType")
    refresh_time = Adapter("RefreshParam", int)

    start_time = Adapter("BeginTime",
                         adapter=datetime,
                         transformer=genshin_datetime)
    end_time = Adapter("EndTime",
                       adapter=datetime,
                       transformer=genshin_datetime)

    min_level = Adapter("MinPlayerLevel", int)
    max_level = Adapter("MaxPlayerLevel", int)

    def __init__(self, entries: List[Dict]) -> None:
        super().__init__(entries)
        if self.shop is not None:
            ShopConfig.__inst__.mappings[self.shop.id].goods_list.append(self)
        self.item = ItemStack(self.__item, self.__count)

    def __repr__(self) -> str:
        return f"<{self.item.__repr__()} {self.buy_limit}>"
Пример #19
0
class Avatar(LocalizeAdapter):
    id = Adapter("Id", int)
    ranged = Adapter("IsRangeAttack", bool)

    quality = Adapter("QualityType", QualityType)
    use_type = Adapter("UseType", UseType)
    identity_type = Adapter("IdentityType", IdentityType)

    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)
    info = Adapter("InfoDescTextMapHash", Localizable)
    image_name = Adapter("ImageName")
    initial_weapon = Adapter("InitialWeapon", int)

    hp_base = Adapter("HpBase", float)
    atk_base = Adapter("AttackBase", float)
    def_base = Adapter("DefenseBase", float)
    crit = Adapter("Critical", float)
    crit_dmg = Adapter("CriticalHurt", float)
    energy_recharge = Adapter("ChargeEfficiency", float)
    stamina_recover = Adapter("StaminaRecoverSpeed", float)

    body_type = Adapter("BodyType", BodyType)
    weapon_type = Adapter("WeaponType", WeaponType)
    feature_tags = IdAdapter("FeatureTagGroupID", TagGroupConfig)

    skill_depot = IdAdapter("SkillDepotId", SkillDepotConfig)

    def __repr__(self) -> str:
        return f"<{self.name.localize()} {self.id}>"
Пример #20
0
class WeaponEntry(LocalizeAdapter):
    id = Adapter("Id", int)
    level = Adapter("RankLevel", int)
    exp = Adapter("WeaponBaseExp", int)
    skills = Adapter("SkillAffix", List[int],
                     lambda x: [y for y in x if y != 0])
    item_type = Adapter("ItemType", ItemType)
    weight = Adapter("Weight", int)
    __rank = Adapter("Rank", int)
    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)

    gadget_id = Adapter("GadgetId", int)

    __weapon_pros = Adapter("WeaponProp", List[Dict], lambda x: x)
    base_atk: float
    base_curve: str
    substat: Union[ArtiAttrType, None]
    substat_base: float
    substat_curve: str

    awaken_texture = Adapter("AwakenTexture")
    awaken_icon = Adapter("AwakenIcon")
    icon = Adapter("Icon")

    unrotate = Adapter("UnRotate", bool)

    promote_id = Adapter("WeaponPromoteId", int)
    refine_costs = Adapter("AwakenCosts", List[int], lambda x: x)

    story_id = Adapter("StoryId", int)

    def __init__(self, entry: Dict) -> None:
        super().__init__(entry)
        self.base_atk = self.__weapon_pros[0]["InitValue"]
        self.base_curve = self.__weapon_pros[0]["Type"]
        if "PropType" in self.__weapon_pros[1]:
            self.substat = ArtiAttrType(self.__weapon_pros[1]["PropType"])
            self.substat_base = self.__weapon_pros[1]["InitValue"]
            self.substat_curve = self.__weapon_pros[1]["Type"]
        else:
            self.substat = None
            self.substat_base = 0
            self.substat_curve = ""
Пример #21
0
class MaterialEntry(LocalizeAdapter):
    id = Adapter("Id", int)
    rank = Adapter("RankLevel", int)
    stacksize = Adapter("StackLimit", int)
    max_use = Adapter("MaxUseCount", int)
    use_level = Adapter("UseLevel", int)
    weight = Adapter("Weight", int)
    cd = Adapter("CdTime", int)
    __rank = Adapter("Rank", int)
    global_limit = Adapter("GlobalItemLimit", int)

    hidden = Adapter("IsHidden", bool)
    is_split_drop = Adapter("IsSplitDrop", bool)
    use_on_gain = Adapter("UseOnGain", bool)
    close_bag_after_use = Adapter("CloseBagAfterUsed", bool)
    play_gain_effect = Adapter("PlayGainEffect", bool)
    no_first_get_hin = Adapter("NoFirstGetHint", bool)

    target = Adapter("UseTarget", UseTarget)
    item_type = Adapter("ItemType", ItemType)
    material_type = Adapter("MaterialType", MaterialType)
    icon = Adapter("Icon")
    gadget_id = Adapter("GadgetId", int)

    food_quality = Adapter("FoodQuality", FoodQuality)
    hunger_value = Adapter("SatiationParams",
                           int,
                           transformer=lambda x: x[1] if x else 0)

    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)
    type_text = Adapter("TypeDescTextMapHash", Localizable)
    interaction_text = Adapter("InteractionTitleTextMapHash", Localizable)
    special_text = Adapter("SpecialDescTextMapHash", Localizable)
    effect_text = Adapter("EffectDescTextMapHash", Localizable)

    effect_icon = Adapter("EffectIcon")
    effect_name = Adapter("EffectName")
    effect_id = Adapter("EffectGadgetID")

    can_destroy = Adapter("DestroyRule", bool,
                          lambda x: x == "DESTROY_RETURN_MATERIAL",
                          lambda x: False)
    recover_list = Union[List, None]

    set_id = Adapter("SetID", int)

    item_use = Adapter("ItemUse", list, lambda x: x)
    pic_path = Adapter("PicPath", list, lambda x: x)

    def __init__(self, entry: Dict) -> None:
        super().__init__(entry)
        if self.can_destroy:
            self.recover_list = list(
                ItemStack(*x)
                for x in zip(entry['DestroyReturnMaterial'],
                             entry['DestroyReturnMaterialCount']))
        else:
            self.recover_list = None

    def __repr__(self) -> str:
        return f"<{self.name.localize()} {self.id}>"
Пример #22
0
class BattlePassSchedule(LocalizeAdapter):
    id = Adapter("Id", int)
    title = Adapter("TitleNameTextMapHash", Localizable)
    begin = Adapter("BeginDateStr")
    end = Adapter("EndDateStr")