Exemplo n.º 1
0
    def __init__(self, owner: str, upstream: str, active: bool,
                 sheet_type: str, import_version: int, name: str,
                 description: str, image: str, stats: BaseStats,
                 levels: Levels, attacks: AttackList, skills: Skills,
                 resistances: Resistances, saves: Saves, ac: int, max_hp: int,
                 hp: int, temp_hp: int, cvars: dict, options: dict,
                 overrides: dict, consumables: list, death_saves: dict,
                 spellbook: Spellbook, live, race: str, background: str,
                 **kwargs):
        if kwargs:
            log.warning(f"Unused kwargs: {kwargs}")
        # sheet metadata
        self._owner = owner
        self._upstream = upstream
        self._active = active
        self._sheet_type = sheet_type
        self._import_version = import_version

        # StatBlock super call
        super(Character, self).__init__(name=name,
                                        stats=stats,
                                        levels=levels,
                                        attacks=attacks,
                                        skills=skills,
                                        saves=saves,
                                        resistances=resistances,
                                        spellbook=spellbook,
                                        ac=ac,
                                        max_hp=max_hp,
                                        hp=hp,
                                        temp_hp=temp_hp)

        # main character info
        self._description = description
        self._image = image

        # customization
        self.cvars = cvars
        self.options = CharOptions.from_dict(options)
        self.overrides = ManualOverrides.from_dict(overrides)

        # ccs
        self.consumables = [
            CustomCounter.from_dict(self, cons) for cons in consumables
        ]
        self.death_saves = DeathSaves.from_dict(death_saves)

        # live sheet integrations
        self._live = live
        integration = INTEGRATION_MAP.get(live)
        if integration:
            self._live_integration = integration(self)
        else:
            self._live_integration = None

        # misc research things
        self.race = race
        self.background = background
Exemplo n.º 2
0
    def __init__(self,
                 owner: str,
                 upstream: str,
                 active: bool,
                 sheet_type: str,
                 import_version: int,
                 name: str,
                 description: str,
                 image: str,
                 stats: BaseStats,
                 levels: Levels,
                 attacks: AttackList,
                 skills: Skills,
                 resistances: Resistances,
                 saves: Saves,
                 ac: int,
                 max_hp: int,
                 hp: int,
                 temp_hp: int,
                 cvars: dict,
                 overrides: dict,
                 consumables: list,
                 death_saves: dict,
                 spellbook: Spellbook,
                 live,
                 race: str,
                 background: str,
                 creature_type: str = None,
                 ddb_campaign_id: str = None,
                 actions: Actions = None,
                 active_guilds: list = None,
                 options_v2: CharacterSettings = None,
                 **kwargs):
        if actions is None:
            actions = Actions()
        if active_guilds is None:
            active_guilds = []
        if options_v2 is None:
            if 'options' in kwargs:  # options v1 -> v2 migration (options rewrite)
                options_v2 = CharacterSettings.from_old_csettings(
                    kwargs.pop('options'))
            else:
                options_v2 = CharacterSettings()
        if kwargs:
            log.warning(f"Unused kwargs: {kwargs}")
        # sheet metadata
        self._owner = owner
        self._upstream = upstream
        self._active = active
        self._active_guilds = active_guilds
        self._sheet_type = sheet_type
        self._import_version = import_version

        # StatBlock super call
        super().__init__(name=name,
                         stats=stats,
                         levels=levels,
                         attacks=attacks,
                         skills=skills,
                         saves=saves,
                         resistances=resistances,
                         spellbook=spellbook,
                         ac=ac,
                         max_hp=max_hp,
                         hp=hp,
                         temp_hp=temp_hp,
                         creature_type=creature_type)

        # main character info
        self._description = description
        self._image = image

        # customization
        self.cvars = cvars
        self.options = options_v2
        self.overrides = ManualOverrides.from_dict(overrides)

        # ccs
        self.consumables = [
            CustomCounter.from_dict(self, cons) for cons in consumables
        ]
        self.death_saves = DeathSaves.from_dict(self, death_saves)

        # live sheet resource integrations
        self._live = live
        integration = INTEGRATION_MAP.get(live)
        if integration:
            self._live_integration = integration(self)
        else:
            self._live_integration = None

        # misc research things
        self.race = race
        self.background = background

        # ddb live sync
        self.ddb_campaign_id = ddb_campaign_id
        # action automation
        self.actions = actions