comparison orpg/gametree/nodehandlers/dnd3e.py @ 195:b633f4c64aae alpha

Traipse Alpha 'OpenRPG' {100219-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 (Patch-2) New Features: New Namespace method with two new syntaxes 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
author sirebral
date Sat, 24 Apr 2010 08:37:20 -0500
parents bf799efe7a8a
children 3bbfd84619c0
comparison
equal deleted inserted replaced
182:4b2884f29a72 195:b633f4c64aae
19 # 19 #
20 # File: dnd3e.py 20 # File: dnd3e.py
21 # Author: Chris Davis & Digitalxero 21 # Author: Chris Davis & Digitalxero
22 # Maintainer: leadb 22 # Maintainer: leadb
23 # Version: 23 # Version:
24 # $Id: dnd3e.py,v 1.33 2006/11/04 21:24:21 digitalxero Exp $ 24 # $Id: dnd3e.py,v Traipse 'Ornery-Orc' prof.ebral Exp $
25 # 25 #
26 # Description: The file contains code for the dnd3e nodehanlers 26 # Description: The file contains code for the dnd3e nodehanlers
27 # 27 #
28 28
29 from core import * 29 from core import *
259 259
260 def tohtml(self): 260 def tohtml(self):
261 n_list = self.xml.getchildren() 261 n_list = self.xml.getchildren()
262 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>" 262 html_str = "<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 ><th>General Information</th></tr><tr><td>"
263 for n in n_list: 263 for n in n_list:
264 debug(n)
265 html_str += "<B>"+n.tag.capitalize() +":</B> " 264 html_str += "<B>"+n.tag.capitalize() +":</B> "
266 html_str += n.text + ", " 265 html_str += n.text + ", "
267 html_str = html_str[:len(html_str)-2] + "</td></tr></table>" 266 html_str = html_str[:len(html_str)-2] + "</td></tr></table>"
268 return html_str 267 return html_str
269 268
375 elif id == self.lang.GetId(): 374 elif id == self.lang.GetId():
376 nodeName = 'Languages' 375 nodeName = 'Languages'
377 value = self.lang.GetValue() 376 value = self.lang.GetValue()
378 for node in self.n_list: 377 for node in self.n_list:
379 if node.tag == nodeName: 378 if node.tag == nodeName:
380 debug(node)
381 node.text = value 379 node.text = value
382 380
383 def saveMoney(self, row, col): 381 def saveMoney(self, row, col):
384 value = self.grid.GetCellValue(row, col) 382 value = self.grid.GetCellValue(row, col)
385 debug(self.n_list[row])
386 self.n_list[row].text = value 383 self.n_list[row].text = value
387 384
388 def on_cell_change(self, evt): 385 def on_cell_change(self, evt):
389 row = evt.GetRow() 386 row = evt.GetRow()
390 col = evt.GetCol() 387 col = evt.GetCol()
2270 if self.grid.IsInSelection(i,0): 2267 if self.grid.IsInSelection(i,0):
2271 self.grid.DeleteRows(i) 2268 self.grid.DeleteRows(i)
2272 self.xml.remove(self.n_list[i]) 2269 self.xml.remove(self.n_list[i])
2273 2270
2274 def on_add(self,evt): 2271 def on_add(self,evt):
2275 debug()
2276 if not self.temp_dom: 2272 if not self.temp_dom:
2277 tree = parse(dir_struct["dnd3e"]+"dnd3espells.xml") 2273 tree = parse(dir_struct["dnd3e"]+"dnd3espells.xml")
2278 xml_dom = tree.getroot() 2274 xml_dom = tree.getroot()
2279 self.temp_dom = xml_dom 2275 self.temp_dom = xml_dom
2280 debug(self.temp_dom)
2281 f_list = self.temp_dom.findall('spell') 2276 f_list = self.temp_dom.findall('spell')
2282 opts = [] 2277 opts = []
2283 #lvl = int(dnd3e_char_child.get_char_lvl('level')) 2278 #lvl = int(dnd3e_char_child.get_char_lvl('level'))
2284 #castlvl = eval('%s/2' % (lvl)) 2279 #castlvl = eval('%s/2' % (lvl))
2285 for f in f_list: 2280 for f in f_list:
2667 if self.grid.IsInSelection(i,0): 2662 if self.grid.IsInSelection(i,0):
2668 self.grid.DeleteRows(i) 2663 self.grid.DeleteRows(i)
2669 self.xml.remove(self.n_list[i]) 2664 self.xml.remove(self.n_list[i])
2670 2665
2671 def on_add(self,evt): 2666 def on_add(self,evt):
2672 debug()
2673 if not self.temp_dom: 2667 if not self.temp_dom:
2674 tree = parse(dir_struct["dnd3e"]+"dnd3epowers.xml") 2668 tree = parse(dir_struct["dnd3e"]+"dnd3epowers.xml")
2675 xml_dom = tree.getroot() 2669 xml_dom = tree.getroot()
2676 self.temp_dom = xml_dom 2670 self.temp_dom = xml_dom
2677 debug(self.temp)
2678 f_list = self.temp_dom.findall('power') 2671 f_list = self.temp_dom.findall('power')
2679 opts = [] 2672 opts = []
2680 for f in f_list: 2673 for f in f_list:
2681 spelllvl = f.get('level') 2674 spelllvl = f.get('level')
2682 opts.append("(" + f.get('level') + ") - " + 2675 opts.append("(" + f.get('level') + ") - " +