def __init__(self, ctx, *args, **kwargs): super(ScriptingEvaluator, self).__init__(*args, **kwargs) self.builtins.update( # fixme character-only functions, all deprecated now get_cc=self.needs_char, set_cc=self.needs_char, get_cc_max=self.needs_char, get_cc_min=self.needs_char, mod_cc=self.needs_char, cc_exists=self.needs_char, create_cc_nx=self.needs_char, create_cc=self.needs_char, get_slots=self.needs_char, get_slots_max=self.needs_char, set_slots=self.needs_char, use_slot=self.needs_char, get_hp=self.needs_char, set_hp=self.needs_char, mod_hp=self.needs_char, hp_str=self.needs_char, get_temphp=self.needs_char, set_temphp=self.needs_char, set_cvar=self.needs_char, delete_cvar=self.needs_char, set_cvar_nx=self.needs_char, get_raw=self.needs_char) # char-agnostic globals self.builtins.update( set=self.set, exists=self.exists, get=self.get, combat=self.combat, character=self.character, get_gvar=self.get_gvar, get_svar=self.get_svar, set_uvar=self.set_uvar, delete_uvar=self.delete_uvar, set_uvar_nx=self.set_uvar_nx, uvar_exists=self.uvar_exists, chanid=self.chanid, servid=self.servid, # fixme deprecated - use ctx instead load_json=self.load_json, dump_json=self.dump_json, argparse=argparse, ctx=AliasContext(ctx)) # roll limiting self._roller = d20.Roller(context=PersistentRollContext( max_rolls=1_000, max_total_rolls=10_000)) self.builtins.update(vroll=self._limited_vroll, roll=self._limited_roll) self._cache = {"gvars": {}, "svars": {}, "uvars": {}} self.ctx = ctx self.character_changed = False self.combat_changed = False self.uvars_changed = set()
def __init__(self, ctx, *args, **kwargs): super().__init__(*args, **kwargs) self.builtins.update( # fixme character-only functions, all deprecated now get_cc=self.needs_char, set_cc=self.needs_char, get_cc_max=self.needs_char, get_cc_min=self.needs_char, mod_cc=self.needs_char, cc_exists=self.needs_char, create_cc_nx=self.needs_char, create_cc=self.needs_char, get_slots=self.needs_char, get_slots_max=self.needs_char, set_slots=self.needs_char, use_slot=self.needs_char, get_hp=self.needs_char, set_hp=self.needs_char, mod_hp=self.needs_char, hp_str=self.needs_char, get_temphp=self.needs_char, set_temphp=self.needs_char, set_cvar=self.needs_char, delete_cvar=self.needs_char, set_cvar_nx=self.needs_char, get_raw=self.needs_char) # char-agnostic globals self.builtins.update( set=self.set, exists=self.exists, get=self.get, combat=self.combat, character=self.character, get_gvar=self.get_gvar, get_svar=self.get_svar, set_uvar=self.set_uvar, delete_uvar=self.delete_uvar, set_uvar_nx=self.set_uvar_nx, uvar_exists=self.uvar_exists, chanid=self.chanid, servid=self.servid, # fixme deprecated - use ctx instead load_json=self.load_json, dump_json=self.dump_json, load_yaml=self.load_yaml, dump_yaml=self.dump_yaml, argparse=argparse, ctx=AliasContext(ctx), signature=self.signature, verify_signature=self.verify_signature) # roll limiting self._roller = d20.Roller(context=PersistentRollContext( max_rolls=1_000, max_total_rolls=10_000)) self.builtins.update(vroll=self._limited_vroll, roll=self._limited_roll) self._cache = {"gvars": {}, "svars": {}, "uvars": {}} self.ctx = ctx self.character_changed = False self.combat_changed = False self.uvars_changed = set() self.execution_scope: ExecutionScope = ExecutionScope.UNKNOWN self.invoking_object: _CodeInvokerT = None