@ -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 " <br>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 = " <table class= \" wikitable \" border= \" 1 \" style= \" text-align:center;background:black;color:white; \" > <caption style= \" color:gold; \" >ENVIRONMENTAL </caption> <tbody><tr> <th style= \" background:black;color:gold; \" >VISIBILITY </th> <th style= \" background:black;color:gold; \" >LIGHT / GLARE </th> <th style= \" background:black;color:gold; \" >WIND </th> <th style= \" background:black;color:gold; \" >RANGE </th> <th style= \" background:black;color:gold; \" >MODIFIER </th></tr> <tr> <td>Clear</td> <td>Full Light / No Glare</td> <td>None / Light Breeze</td> <td>Short</td> <td>0 </td></tr> <tr> <td>Light Rain / Fog / Smoke</td> <td>Partial Light / Weak Glare</td> <td>Light Winds / Light Breeze</td> <td>Medium</td> <td>-1 </td></tr> <tr> <td>Moderate Rain / Fog / Smoke</td> <td>Dim Light / Moderate Glare</td> <td>Moderate Winds / Light Breeze</td> <td>Long</td> <td>-3 </td></tr> <tr> <td>Heavy Rain / Fog / Smoke</td> <td>Total Darkness/ Blinding Glare</td> <td>Strong Winds / Light Breeze</td> <td>Extreme</td> <td>-6 </td></tr> <tr> <td>Combination of two or more conditions at the -6 level row</td> <td></td> <td></td> <td></td> <td>-10 </td></tr></tbody></table> "
gs . gui_service . quick_gui ( ret_text , text_type = ' header ' , box_align = ' center ' )
def cmd_hosts ( self , data ) :
ret_text = " <table border= \" 1 \" style= \" text-align:center;background:black;color:white; \" ><caption style= \" color:gold; \" >SAMPLE HOST RATINGS</caption><tbody><tr><th style= \" background:black;color:gold; \" >EXAMPLES</th><th style= \" background:black;color:gold; \" >RATING</th></tr><tr><td>Personal sites, pirate archives, public education</td><td>1-2</td></tr><tr><td>Low-end commercial, private business, public libraries, small policlubs</td><td>3-4</td></tr><tr><td>Social media, small colleges and universities, local police, international policlubs</td><td>5-6</td></tr><tr><td>Matrix games, local corporate hosts, large universities, low-level government</td><td>7-8</td></tr><tr><td>Affluent groups, regional corporate hosts, major government, secure sites</td><td>9-10</td></tr><tr><td>Megacorporate headquarters, military command, clandestine head office</td><td>11-12</td></tr></tbody></table> "
gs . gui_service . quick_gui ( ret_text , text_type = ' header ' , box_align = ' center ' )