Beispiel #1
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}>"
Beispiel #2
0
class SkillDepot(JsonAdapter):
    id = Adapter("Id", int)

    burst = IdAdapter("EnergySkill", SkillConfig)
    skills = Adapter("Skills", List[Skill], lambda x: [y for y in x if y != 0])
    subskills = Adapter("SubSkills", List[Skill],
                        lambda x: [y for y in x if y != 0])
    normal = IdAdapter("AttackModeSkill", SkillConfig)
    constellations = Adapter("Talents", List[Constellation],
                             lambda x: [y for y in x if y != 0])
    # TODO : fill the upgrade
    upgrades = Adapter(
        "InherentProudSkillOpens", List, lambda x:
        [y["ProudSkillGroupId"] for y in x if "ProudSkillGroupId" in y])

    def __init__(self, entry: Dict, skill_config: SkillConfig,
                 constellation_config: ConstellationConfig) -> None:
        super().__init__(entry)
        self.skills = [
            skill_config[x] for x in self.skills if x in skill_config.mappings
        ]
        self.subskills = [
            skill_config[x] for x in self.subskills
            if x in skill_config.mappings
        ]
        self.constellations = [
            constellation_config[x] for x in self.constellations
            if x in constellation_config.mappings
        ]
Beispiel #3
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)
Beispiel #4
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}>"
Beispiel #5
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()}>"
Beispiel #6
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)
Beispiel #7
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}>"
Beispiel #8
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}>"
Beispiel #9
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}>"
Beispiel #10
0
class WindGlider(LocalizeAdapter):
    id = Adapter("FlycloakId", int)
    name = Adapter("NameTextMapHash", Localizable)
    desc = Adapter("DescTextMapHash", Localizable)
    json = Adapter("JsonName")
    item = IdAdapter("MaterialId", MaterialConfig)