annotate plugins/xxhiddendice.py @ 220:9611ba80cf99 alpha

Traipse Alpha 'OpenRPG' {100501-01} 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 (Patch-2) Moving to Beta!! New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start New to Mini Lin node, change title in design mode New to Game Tree, never lose a node, appends a number to the end of corrupted trees New to Server GUI, Traipse Suite's Debug Console Updates: Update to White Board layer, uses a pencil image for color button Update to Grid Layer, uses a grid image for color button Update to Chat Window, size of drop down menus Update to default lobby message Update to template Text node Update to 4e PC Sheet node Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up Fix to Mini Lib node that was preventing use Fix to plugins that parce dice but did not call InterParse Fix to nodes for name changing by double click Fix to Game Tree, node ordering on drag and drop corrected Fix to Game Tree, corrupted error message was not showing Fix to Update Manager, checks for internet connection Fix to Update Manager, Auto Update corrections
author sirebral
date Sat, 01 May 2010 03:21:26 -0500
parents 4dc11df853bf
children 72e0cce81a47
rev   line source
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
1 import os, re, wx
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
2 import orpg.pluginhandler
214
4dc11df853bf Traipse Alpha 'OpenRPG' {100429-0}
sirebral
parents: 195
diff changeset
3 from orpg.tools.InterParse import Parse
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
4
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
5 class Plugin(orpg.pluginhandler.PluginHandler):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
6 # Initialization subroutine.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
7 #
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
8 # !self : instance of self
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
9 # !openrpg : instance of the the base openrpg control
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
10 def __init__(self, plugindb, parent):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
11 orpg.pluginhandler.PluginHandler.__init__(self, plugindb, parent)
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
12
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
13 # The Following code should be edited to contain the proper information
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
14 self.name = 'Hidden Dice'
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
15 self.author = 'mDuo13'
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
16 self.help = 'Roll with curly brackets to hide your roll,\n'
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
17 self.help += 'having it display only for you. Other players will\n'
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
18 self.help += 'get a message that only says you are rolling.\n'
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
19 self.help += 'Useful for GMs who want to roll secretly.'
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
20
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
21 #You can set variables below here. Always set them to a blank value in this section. Use plugin_enabled
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
22 #to set their proper values.
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
23 self.hiddenrolls = []
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
24 self.dicere = "\{([0-9]*d[0-9]*.+)\}"
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
25
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
26 def plugin_menu(self):
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
27 self.menu = wx.Menu()
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
28 self.toggle = self.menu.AppendCheckItem(wx.ID_ANY, 'On')
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
29 self.topframe.Bind(wx.EVT_MENU, self.plugin_toggle, self.toggle)
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
30 self.toggle.Check(True)
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
31
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
32 def plugin_toggle(self, evt):
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
33 pass
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
34
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
35 def plugin_enabled(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
36 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
37
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
38 def plugin_disabled(self):
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
39 pass
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
40
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
41 def pre_parse(self, text):
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
42 if self.toggle.IsChecked() == True:
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
43 m = re.search(self.dicere, text)
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
44 while m:
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
45 roll = "[" + m.group(1) + "]"
214
4dc11df853bf Traipse Alpha 'OpenRPG' {100429-0}
sirebral
parents: 195
diff changeset
46 self.hiddenrolls += [Parse.Dice(roll)]
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
47 text = text[:m.start()] + "(hidden roll)" + text[m.end():]
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
48 m = re.search(self.dicere, text)
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
49 return text
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
50
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
51 def post_msg(self, text, myself):
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
52 if self.toggle.IsChecked() == True:
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
53 c = 0
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
54 a = text.find("(hidden roll)")
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
55 while len(self.hiddenrolls) > c and a > -1:
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
56 text = text[:a+14].replace("(hidden roll)", self.hiddenrolls[c]) + text[a+14:]
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
57 a = text.find("(hidden roll)")
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
58 c += 1
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
59 if c > 0:
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 63
diff changeset
60 self.hiddenrolls = []
0
4385a7d0efd1 Deleted and repushed it with the 'grumpy-goblin' branch. I forgot a y
sirebral
parents:
diff changeset
61 return text