comparison orpg/tools/InterParse.py @ 236:9230a33defd9 beta

Traipse Beta 'OpenRPG' {100616-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 (Closing/Closed) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order New to Server GUI, can now clear log 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. 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 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.
author sirebral
date Wed, 16 Jun 2010 03:06:20 -0500
parents bb7b9648792c
children b44dad398833
comparison
equal deleted inserted replaced
226:b29454610f36 236:9230a33defd9
47 def ParseLogic(self, s, node): 47 def ParseLogic(self, s, node):
48 'Nodes now parse through ParsLogic. Easily add new parse rules right here!!' 48 'Nodes now parse through ParsLogic. Easily add new parse rules right here!!'
49 s = self.NameSpaceE(s) 49 s = self.NameSpaceE(s)
50 s = self.NameSpaceI(s, node) 50 s = self.NameSpaceI(s, node)
51 s = self.NodeMap(s, node) 51 s = self.NodeMap(s, node)
52 s = self.NodeParent(s, node.get('map')) 52 s = self.NodeParent(s, node)
53 return s 53 return s
54 54
55 def Normalize(self, s, tab): 55 def Normalize(self, s, tab):
56 for plugin_fname in tab.activeplugins.keys(): 56 for plugin_fname in tab.activeplugins.keys():
57 plugin = tab.activeplugins[plugin_fname] 57 plugin = tab.activeplugins[plugin_fname]
157 references syntax for the game tree is confusing, so I dropped this in there without telling 157 references syntax for the game tree is confusing, so I dropped this in there without telling
158 anyone. Using !" :: "! will allow you to use an internal namespace from within another internal 158 anyone. Using !" :: "! will allow you to use an internal namespace from within another internal
159 namespace -- TaS, Prof. Ebral""" 159 namespace -- TaS, Prof. Ebral"""
160 reg2 = re.compile("(!=(.*?)=!)") 160 reg2 = re.compile("(!=(.*?)=!)")
161 matches = reg1.findall(s) + reg2.findall(s) 161 matches = reg1.findall(s) + reg2.findall(s)
162 tree_map = node.get('map') 162 try: tree_map = node.get('map')
163 except: return node
163 for i in xrange(0,len(matches)): 164 for i in xrange(0,len(matches)):
164 ## Build the new tree_map 165 ## Build the new tree_map
165 new_map = tree_map.split('::') 166 new_map = tree_map.split('::')
166 find = matches[i][1].split('::') 167 find = matches[i][1].split('::')
167 ## Backwards Reference the Parent Children 168 ## Backwards Reference the Parent Children
168 node = self.get_node(new_map) 169 node = self.get_node(new_map)
169 newstr = self.LocationCheck(node, tree_map, new_map, find) 170 newstr = self.LocationCheck(node, tree_map, new_map, find)
170 s = s.replace(matches[i][0], newstr, 1) 171 s = s.replace(matches[i][0], newstr, 1)
171 s = self.ParseLogic(s, node) 172 s = self.NodeMap(s, node)
173 s = self.NodeParent(s, node)
172 return s 174 return s
173 175
174 def NameSpaceE(self, s): 176 def NameSpaceE(self, s):
175 reg = re.compile("(!&(.*?)&!)") 177 reg = re.compile("(!&(.*?)&!)")
176 matches = reg.findall(s) 178 matches = reg.findall(s)
229 s = s.replace(matches[i][0], newstr, 1) 231 s = s.replace(matches[i][0], newstr, 1)
230 s = self.Node(s) 232 s = self.Node(s)
231 s = self.NodeParent(s, tree_map) 233 s = self.NodeParent(s, tree_map)
232 return s 234 return s
233 235
234 def NodeParent(self, s, tree_map): 236 def NodeParent(self, s, node):
235 """Parses player input for embedded nodes rolls""" 237 """Parses player input for embedded nodes rolls"""
238 if node == 'Invalid Reference!': return node
239 tree_map = node.get('map')
236 cur_loc = 0 240 cur_loc = 0
237 reg = re.compile("(!#(.*?)#!)") 241 reg = re.compile("(!#(.*?)#!)")
238 matches = reg.findall(s) 242 matches = reg.findall(s)
239 for i in xrange(0,len(matches)): 243 for i in xrange(0,len(matches)):
240 ## Build the new tree_map 244 ## Build the new tree_map