diff --git a/__pycache__/burningdice.cpython-38.pyc b/__pycache__/burningdice.cpython-38.pyc
index d1998ff..4b4b735 100644
Binary files a/__pycache__/burningdice.cpython-38.pyc and b/__pycache__/burningdice.cpython-38.pyc differ
diff --git a/burningdice.py b/burningdice.py
index b7da3f7..e7e6470 100644
--- a/burningdice.py
+++ b/burningdice.py
@@ -2,11 +2,11 @@ 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
import random
+import sqlite3
class Plugin(PluginBase):
@@ -16,6 +16,13 @@ class Plugin(PluginBase):
self.plugin_name = os.path.basename(__file__).rsplit('.')[0]
self.metadata = PluginUtilityService.process_metadata(f'plugins/extensions/{self.plugin_name}')
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 IF NOT EXISTS v1 (content string, name string UNIQUE)")
+ init.execute("CREATE TABLE IF NOT EXISTS v2 (content string, name string UNIQUE)")
+ init.execute("CREATE TABLE IF NOT EXISTS v3 (content string, name string UNIQUE)")
+ init_db.commit()
+ init_db.close()
self.is_running = True
log(
INFO,
@@ -33,6 +40,7 @@ class Plugin(PluginBase):
print_mode=PrintMode.REG_PRINT.value
)
+
def stop(self):
if self.is_running:
self.quit()
@@ -41,6 +49,110 @@ class Plugin(PluginBase):
if not self.is_running:
self.__init__()
+ def cmd_volley(self, data):
+ all_data = data.message.strip().split()
+ try:
+ v = int(all_data[1])
+ if (v == 1):
+ volley = "v1"
+ elif (v == 2):
+ volley = "v2"
+ elif (v == 3):
+ volley = "v3"
+ else:
+ gs.gui_service.quick_gui("Format: !volley # script actions",
+ text_type='header', box_align='left')
+ return
+ script = str(all_data[2:])
+ init_db = sqlite3.connect('init.db')
+ cur = init_db.cursor()
+ cur.execute("INSERT INTO " + volley + " values (?,?) ON CONFLICT(name) DO UPDATE SET content=\"" + script + "\"", (str(script),str(gs.mumble_inst.users[data.actor]['name'])))
+ init_db.commit()
+ init_db.close()
+ gs.gui_service.quick_gui(str(gs.mumble_inst.users[data.actor]['name']) + " has scripted volley " + str(v), text_type='header', box_align='left')
+ return
+ except IndexError:
+ gs.gui_service.quick_gui("Format: !volley # script actions",
+ text_type='header', box_align='left')
+ return
+
+ def reveal_actions(self,volleynum):
+ volley = "v" + str(volleynum)
+ init_db = sqlite3.connect('init.db')
+ cur = init_db.cursor()
+ cur.execute("SELECT * from " + volley + " ORDER BY name DESC")
+ ret_text = "Volley " + str(volleynum) + "
"
+ for row in cur:
+ ret_text += str(row[1]) + ": " + row[0] + "
"
+ init_db.close()
+ gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left')
+ return
+
+ def cmd_revealv1(self, data):
+ self.reveal_actions(1)
+ return
+
+ def cmd_revealv2(self, data):
+ self.reveal_actions(2)
+ return
+
+ def cmd_revealv3(self, data):
+ self.reveal_actions(3)
+ return
+
+ def whoscript(self,volleynum):
+ volley = "v" + str(volleynum)
+ init_db = sqlite3.connect('init.db')
+ cur = init_db.cursor()
+ cur.execute("SELECT * from " + volley + " ORDER BY name DESC")
+ ret_text = "Volley " + str(volleynum) + "
"
+ for row in cur:
+ ret_text += str(row[1]) + "
"
+ init_db.close()
+ gs.gui_service.quick_gui(ret_text, text_type='header', box_align='left')
+ return
+
+ def cmd_scriptedv1(self, data):
+ self.whoscript(1)
+ return
+
+ def cmd_scriptedv2(self, data):
+ self.whoscript(2)
+ return
+
+ def cmd_scriptedv3(self, data):
+ self.whoscript(3)
+ return
+
+ def cmd_scripted(self, data):
+ self.whoscript(1)
+ self.whoscript(2)
+ self.whoscript(3)
+ return
+
+ def clear_volley(self, volleynum):
+ volley = "v" + str(volleynum)
+ init_db = sqlite3.connect('init.db')
+ init = init_db.cursor()
+ init.execute("DROP TABLE " + volley)
+ init_db.commit()
+ init.execute("CREATE TABLE IF NOT EXISTS " + volley + " (content string, name string UNIQUE)")
+ init_db.commit()
+ init_db.close()
+ gs.gui_service.quick_gui("Purged all for " + volley, text_type='header', box_align='left')
+
+ def cmd_clearv1(self, data):
+ self.clear_volley(1)
+ return
+
+ def cmd_clearv2(self, data):
+ self.clear_volley(2)
+ return
+
+ def cmd_clearv3(self, data):
+ self.clear_volley(3)
+ return
+
def cmd_bw(self, data):
all_data = data.message.strip().split()
try:
@@ -112,9 +224,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: !bw # [a][a]",
text_type='header', box_align='left')
return
@@ -194,9 +304,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("!bwo # [a][a]",
text_type='header', box_align='left')
return
diff --git a/help.html b/help.html
index 69af63f..824af80 100644
--- a/help.html
+++ b/help.html
@@ -7,3 +7,8 @@ All commands can be run by typing it in the chat or privately messaging JJMumble
!touchofages: Print the table of touch of ages difficulties.
!aurareading: Print the table of aura reading difficulties.
!sessionend: Print the Artha awards table.
+!volley: Sample !volley 1 Block Strike. Prepend the volley number and then the actions. Everything after the volley number is freeform.
+!revealv[1-3]: Prints everyone's script for given volley.
+!clearv[1-3]: Clears all scripts for given volley.
+!scriptedv[1-3]: Lists who has scripted for given volley.
+!scripted: Lists who has scripted for all volleys.
diff --git a/metadata.ini b/metadata.ini
index 58bbd26..8d78199 100644
--- a/metadata.ini
+++ b/metadata.ini
@@ -11,7 +11,18 @@ PluginCommands: [
"touchofages",
"aurareading",
"sessionend",
- "bwo"
+ "bwo",
+ "volley",
+ "revealv1",
+ "revealv2",
+ "revealv3",
+ "clearv1",
+ "clearv2",
+ "clearv3",
+ "scriptedv1",
+ "scriptedv2",
+ "scriptedv3",
+ "scripted"
]
[Plugin Settings]