Added some more tools to manage inits, and updated aliases list

main
silverwizard 3 years ago
parent 86927f595c
commit 69318abf6c
  1. BIN
      __pycache__/shadowdice.cpython-38.pyc
  2. 3
      aliases.csv
  3. 4
      help.html
  4. 2
      metadata.ini
  5. 9
      privileges.csv
  6. 42
      shadowdice.py

@ -1,3 +1,6 @@
alias,command
predge,(preedge)
pass,(initpass)
listinits,(listinit)
removeinit,(delinit)
rollinits,(rollinit)

1 alias command
2 predge (preedge)
3 pass (initpass)
4 listinits (listinit)
5 removeinit (delinit)
6 rollinits (rollinit)

@ -1,6 +1,8 @@
All commands can be run by typing it in the chat or privately messaging JJMumbleBot.<br>
<b>!addinit</b>: Roll init for a user <i>!init 4 11 Malta</i> will add Malta with 4d6+11<br>
<b>!addinit</b>: Add init for a user <i>!addinit 4 11 Malta</i> will add Malta with 4d6+11<br>
<b>!delinit</b>: Remove init for a user <i>!delinit Malta</i> will remove Malta from the list<br>
<b>!listinit</b>: List all inits in the init DB<br>
<b>!listinitpools</b>: List all init pools in the init DB<br>
<b>!rollinit</b>: Rolls the inits for all of the users, and outputs it<br>
<b>!initpass</b>: Subtracts 10 from all inits, minimum 0<br>
<b>!interupt</b>: Subtracts an amount from a single user's init, wont work if you try to subtract more init from the character than they have <i>!interupt Malta 7</i> will subtract 7 init from Malta<br>

@ -6,7 +6,9 @@ PluginLanguage = EN
PluginCommands: [
"rollinit",
"addinit",
"delinit",
"listinit",
"listinitpools",
"initpass",
"clearinit",
"interupt",

@ -1,7 +1,16 @@
command,level
rollinit,1
addinit,1
delinit,1
listinit,1
listinitpools,1
initpass,1
clearinit,1
interupt,1
srun,1
preedge,1
assensing,1
delivery,1
perception_mods,1
environmental,1
concealability,1

1 command level
2 rollinit 1
3 addinit 1
4 delinit 1
5 listinit 1
6 listinitpools 1
7 initpass 1
8 clearinit 1
9 interupt 1
10 srun 1
11 preedge 1
12 assensing 1
13 delivery 1
14 perception_mods 1
15 environmental 1
16 concealability 1

@ -19,7 +19,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)")
init.execute("CREATE TABLE inits (dice int, bonus int, total int, name string UNIQUE)")
init_db.commit()
init_db.close()
self.is_running = True
@ -60,7 +60,7 @@ class Plugin(PluginBase):
character_name = str(all_data[3])
init_db = sqlite3.connect('init.db')
cur = init_db.cursor()
cur.execute("INSERT INTO inits values (?,?,?,?)", (number_of_dice, init_bonus, 0, character_name))
cur.execute("INSERT INTO inits values (?,?,?,?) ON CONFLICT(name) DO UPDATE SET dice=" + str(number_of_dice) + ", bonus=" + str(init_bonus), (number_of_dice, init_bonus, 0, character_name))
init_db.commit()
init_db.close()
gs.gui_service.quick_gui("Added init for: " + character_name, text_type='header', box_align='left')
@ -88,6 +88,23 @@ class Plugin(PluginBase):
text_type='header', box_align='left')
return
def cmd_listinitpools(self,data):
try:
init_db = sqlite3.connect('init.db')
cur = init_db.cursor()
cur.execute("SELECT * from inits ORDER BY total DESC")
ret_text = ""
for row in cur:
ret_text += str(row[3]) + ": " + str(row[0]) + "d6+" + str(row[1]) + "<br>"
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,
text_type='header', box_align='left')
return
def cmd_initpass(self, data):
try:
init_db = sqlite3.connect('init.db')
@ -135,14 +152,33 @@ class Plugin(PluginBase):
text_type='header', box_align='left')
return
def cmd_delinit(self, data):
all_data = data.message.strip().split()
try:
name = str(all_data[1])
init_db = sqlite3.connect('init.db')
cur = init_db.cursor()
cur.execute("DELETE from inits WHERE name = :name", {"name": name})
init_db.commit()
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
def cmd_clearinit(self, data):
init_db = sqlite3.connect('init.db')
init = init_db.cursor()
init.execute("DROP TABLE inits")
init_db.commit()
init.execute("CREATE TABLE inits (dice int, bonus int, total int, name string)")
init.execute("CREATE TABLE inits (dice int, bonus int, total int, name string UNIQUE)")
init_db.commit()
init_db.close()
gs.gui_service.quick_gui("Purged the Init DB", text_type='header', box_align='left')
def cmd_rollinit(self, data):
try:

Loading…
Cancel
Save