diff --git a/__pycache__/shadowdice.cpython-38.pyc b/__pycache__/shadowdice.cpython-38.pyc index df675da..c5a9291 100644 Binary files a/__pycache__/shadowdice.cpython-38.pyc and b/__pycache__/shadowdice.cpython-38.pyc differ diff --git a/aliases.csv b/aliases.csv index 23cd3e2..bea95c6 100644 --- a/aliases.csv +++ b/aliases.csv @@ -4,3 +4,5 @@ pass,(initpass) listinits,(listinit) removeinit,(delinit) rollinits,(rollinit) +srun4,(srun) +srun5,(srun) diff --git a/metadata.ini b/metadata.ini index 6f5b108..0d5338b 100644 --- a/metadata.ini +++ b/metadata.ini @@ -18,6 +18,7 @@ PluginCommands: [ "delivery", "perception_mods", "environmental", + "hosts", "concealability" ] diff --git a/shadowdice.py b/shadowdice.py index 0e141d1..df27b4c 100644 --- a/shadowdice.py +++ b/shadowdice.py @@ -2,7 +2,6 @@ from JJMumbleBot.lib.plugin_template import PluginBase from JJMumbleBot.lib.utils.plugin_utils import PluginUtilityService from JJMumbleBot.lib.utils.logging_utils import log from JJMumbleBot.lib.utils.print_utils import PrintMode -from JJMumbleBot.plugins.extensions.randomizer.resources.strings import CMD_INVALID_CUSTOM_ROLL from JJMumbleBot.settings import global_settings as gs from JJMumbleBot.lib.resources.strings import * import os @@ -19,7 +18,7 @@ class Plugin(PluginBase): self.plugin_cmds = loads(self.metadata.get(C_PLUGIN_INFO, P_PLUGIN_CMDS)) init_db = sqlite3.connect('init.db') init = init_db.cursor() - init.execute("CREATE TABLE inits (dice int, bonus int, total int, name string UNIQUE)") + init.execute("CREATE TABLE IF NOT EXISTS inits (dice int, bonus int, total int, name string UNIQUE)") init_db.commit() init_db.close() self.is_running = True @@ -65,9 +64,7 @@ class Plugin(PluginBase): init_db.close() gs.gui_service.quick_gui("Added init for: " + character_name, text_type='header', box_align='left') except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !addinit #dice #bonus $name", text_type='header', box_align='left') return @@ -82,9 +79,7 @@ class Plugin(PluginBase): init_db.close() gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left') except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !listinit", text_type='header', box_align='left') return @@ -99,9 +94,7 @@ class Plugin(PluginBase): init_db.close() gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left') except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !listinitpools", text_type='header', box_align='left') return @@ -122,9 +115,7 @@ class Plugin(PluginBase): init_db.close() gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left') except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !initpass", text_type='header', box_align='left') return @@ -146,8 +137,6 @@ class Plugin(PluginBase): init_db.commit() init_db.close() except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) gs.gui_service.quick_gui("Can only subtract init from a name in the list of inits, try !listinit to confirm spellings", text_type='header', box_align='left') return @@ -164,8 +153,6 @@ class Plugin(PluginBase): init_db.close() gs.gui_service.quick_gui("Deleted init for: " + name + " (if they exist)", text_type='header', box_align='left') except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) gs.gui_service.quick_gui("Can only remove init from a name in the list of inits, try !listinit to confirm spellings", text_type='header', box_align='left') return @@ -206,9 +193,7 @@ class Plugin(PluginBase): init_db.close() return except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !rollinit", text_type='header', box_align='left') return @@ -222,7 +207,10 @@ class Plugin(PluginBase): for i in range(number_of_dice): random.seed(int.from_bytes(os.urandom(8), byteorder="big")) this_die = random.randint(1,6) - ret_text += f"{this_die}, " + if i == 0: + ret_text += f"{this_die}" + else: + ret_text += f", {this_die}" if this_die > 4: successes = successes + 1 if this_die == 1: @@ -231,9 +219,7 @@ class Plugin(PluginBase): gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left') return except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !srun #", text_type='header', box_align='left') return @@ -249,7 +235,10 @@ class Plugin(PluginBase): while i < number_of_dice: random.seed(int.from_bytes(os.urandom(8), byteorder="big")) this_die = random.randint(1,6) - ret_text += f"{this_die}, " + if i == 0: + ret_text += f"{this_die}" + else: + ret_text += f", {this_die}" if this_die > 4: successes = successes + 1 if this_die == 1: @@ -257,14 +246,14 @@ class Plugin(PluginBase): if this_die == 6: i = i-1 explosions = explosions + 1 + if i < 1: + ret_text +=f", " i = i + 1 ret_text += f"
Successes: {successes} , Ones: {ones} , Explosions: {explosions}" gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left') return except IndexError: - log(ERROR, CMD_INVALID_CUSTOM_ROLL, - origin=L_COMMAND, error_type=CMD_INVALID_ERR, print_mode=PrintMode.VERBOSE_PRINT.value) - gs.gui_service.quick_gui(CMD_INVALID_CUSTOM_ROLL, + gs.gui_service.quick_gui("Format: !preedge #", text_type='header', box_align='left') return @@ -287,3 +276,7 @@ class Plugin(PluginBase): def cmd_environmental(self, data): ret_text = "
ENVIRONMENTAL
VISIBILITY LIGHT / GLARE WIND RANGE MODIFIER
Clear Full Light / No Glare None / Light Breeze Short 0
Light Rain / Fog / Smoke Partial Light / Weak Glare Light Winds / Light Breeze Medium -1
Moderate Rain / Fog / Smoke Dim Light / Moderate Glare Moderate Winds / Light Breeze Long -3
Heavy Rain / Fog / Smoke Total Darkness/ Blinding Glare Strong Winds / Light Breeze Extreme -6
Combination of two or more conditions at the -6 level row -10
" gs.gui_service.quick_gui(ret_text, text_type='header', box_align='center') + + def cmd_hosts(self, data): + ret_text = "
SAMPLE HOST RATINGS
EXAMPLESRATING
Personal sites, pirate archives, public education1-2
Low-end commercial, private business, public libraries, small policlubs3-4
Social media, small colleges and universities, local police, international policlubs5-6
Matrix games, local corporate hosts, large universities, low-level government7-8
Affluent groups, regional corporate hosts, major government, secure sites9-10
Megacorporate headquarters, military command, clandestine head office11-12
" + gs.gui_service.quick_gui(ret_text, text_type='header', box_align='center')