comparison plugins/xxhiddendice.py @ 36:d02e9197c066 ornery-orc

Traipse 'OpenRPG' {101220-00} Traipse is a distribution of OpenRPG that is designed to be easy to setup and go. Traipse also makes it easy for developers to work on code without fear of sacrifice. 'Ornery-Orc' continues the trend of 'Grumpy' and adds fixes to the code. 'Ornery-Orc's main goal is to offer more advanced features and enhance the productivity of the user. Update Summary (Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log New Earthdawn Dieroller New IronClaw roller, sheet, and image New ShapeShifter PC Sheet Updates: Update to Warhammer PC Sheet. Rollers set as macros. Should work with little maintanence. Update to Browser Server window. Display rooms with ' " & cleaner Update to Server. Handles ' " & cleaner Update to Dieroller. Cleaner, more effecient expression system Update to Hidden Die plugin, allows for non standard dice rolls Update to location.py, allows for more portable references when starting Traipse Update to the Features node Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to Server, removing wxPython dependencies where not needed Fix to metaservers.xml file not being created Fix to Single and Double quotes in Whiteboard text Fix to Background images not showing when using the Image Server Fix to Duplicate chat names appearing Fix to Server GUI's logging output Fix to FNB.COLORFUL_TABS bug Fix to Gametree for XSLT Sheets Fix to Gametree for locating gametree files Fix to Send to Chat from Gametree Fix to Gametree, renaming and remapping operates correctly Fix to aliaslib, prevents error caused when SafeHTML is sent None
author sirebral
date Sun, 19 Dec 2010 22:44:36 -0600
parents fc48380f0c9f
children
comparison
equal deleted inserted replaced
35:ee890f424e16 36:d02e9197c066
1 import os, re, wx 1 import os, re, wx
2 import orpg.pluginhandler 2 import orpg.pluginhandler
3 from orpg.tools.InterParse import Parse 3 from orpg.tools.InterParse import Parse
4 from orpg.dieroller.base import die_rollers
5 from orpg.dieroller.utils import roller_manager
4 6
5 class Plugin(orpg.pluginhandler.PluginHandler): 7 class Plugin(orpg.pluginhandler.PluginHandler):
6 # Initialization subroutine. 8 # Initialization subroutine.
7 # 9 #
8 # !self : instance of self 10 # !self : instance of self
19 self.help += 'Useful for GMs who want to roll secretly.' 21 self.help += 'Useful for GMs who want to roll secretly.'
20 22
21 #You can set variables below here. Always set them to a blank value in this section. Use plugin_enabled 23 #You can set variables below here. Always set them to a blank value in this section. Use plugin_enabled
22 #to set their proper values. 24 #to set their proper values.
23 self.hiddenrolls = [] 25 self.hiddenrolls = []
24 self.dicere = "\{([0-9]*d[0-9]*.+)\}" 26 #self.dicere = "\{([0-9]*d[0-9]*.+)\}"
25 27
26 def plugin_menu(self): 28 def plugin_menu(self):
27 self.menu = wx.Menu() 29 self.menu = wx.Menu()
28 self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On') 30 self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On')
29 self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle) 31 self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle)
38 def plugin_disabled(self): 40 def plugin_disabled(self):
39 pass 41 pass
40 42
41 def pre_parse(self, text): 43 def pre_parse(self, text):
42 if self.toggle.IsChecked() == True: 44 if self.toggle.IsChecked() == True:
43 m = re.search(self.dicere, text) 45 ## Changes added for non standard dice rolls. Prof.Ebral (TaS)
46 math = '[\(0-9\/\*\-\+\)]+'
47 dicere = '\{('+math+'d\s*([0-9]+|'+math+'|[fF]))\}'
48 m = re.search(dicere, text)
49 if m is None:
50 dicere = '\{('+die_rollers._rollers[roller_manager().getRoller()].regExpression+')\}'
51 m = re.search(dicere, text)
44 while m: 52 while m:
45 roll = "[" + m.group(1) + "]" 53 roll = "[" + m.group(1) + "]"
46 self.hiddenrolls += [Parse.Dice(roll)] 54 self.hiddenrolls += [Parse.Dice(roll)]
47 text = text[:m.start()] + "(hidden roll)" + text[m.end():] 55 text = text[:m.start()] + "(hidden roll)" + text[m.end():]
48 m = re.search(self.dicere, text) 56 m = re.search(dicere, text)
49 return text 57 return text
50 58
51 def post_msg(self, text, myself): 59 def post_msg(self, text, myself):
52 if self.toggle.IsChecked() == True: 60 if self.toggle.IsChecked() == True:
53 c = 0 61 c = 0