def __init__(self, owner: str, upstream: str, active: bool, sheet_type: str, import_version: int, name: str, description: str, image: str, stats: dict, levels: dict, attacks: list, skills: dict, resistances: dict, saves: dict, ac: int, max_hp: int, hp: int, temp_hp: int, cvars: dict, options: dict, overrides: dict, consumables: list, death_saves: dict, spellbook: dict, 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 # main character info self.name = name self._description = description self._image = image self.stats = BaseStats.from_dict(stats) self.levels = Levels.from_dict(levels) self._attacks = [Attack.from_dict(atk) for atk in attacks] self.skills = Skills.from_dict(skills) self.resistances = Resistances.from_dict(resistances) self.saves = Saves.from_dict(saves) # hp/ac self.ac = ac self.max_hp = max_hp self._hp = hp self._temp_hp = temp_hp # 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) # spellbook spellbook = Spellbook.from_dict(spellbook) super(Character, self).__init__(spellbook) # 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
def create_cc_nx(name: str, minVal: str = None, maxVal: str = None, reset: str = None, dispType: str = None): if not cc_exists(name): new_consumable = CustomCounter.new(character, name, minVal, maxVal, reset, dispType) character.consumables.append(new_consumable) self.character_changed = True