comparison orpg/gametree/nodehandlers/dnd3e.py @ 74:fdcca00696ea ornery-dev

Continuing the code refinement.
author sirebral
date Fri, 21 Aug 2009 21:40:22 -0500
parents 449a8900f9ac
children 2fa8bd6785a5
comparison
equal deleted inserted replaced
73:7b752c9d0c28 74:fdcca00696ea
141 # crash out entire orpg environment. 141 # crash out entire orpg environment.
142 # 142 #
143 # r- resolved 143 # r- resolved
144 # o- open 144 # o- open
145 # 145 #
146 import orpg.tools.orpg_settings #Not used?? 146
147 #import orpg.tools.orpg_settings #Not used??
147 import orpg.minidom 148 import orpg.minidom
148 from core import * 149 from core import component
149 from containers import * 150 from containers import *
150 from string import * #a 1.6003 151 from string import * #a 1.6003
151 from inspect import * #a 1.9001 152 from inspect import * #a 1.9001
153 from orpg.dirpath import dir_struct
152 dnd3e_EXPORT = wx.NewId() 154 dnd3e_EXPORT = wx.NewId()
153 ############Global Stuff############## 155 ############Global Stuff##############
154 156
155 HP_CUR = wx.NewId() 157 HP_CUR = wx.NewId()
156 HP_MAX = wx.NewId() 158 HP_MAX = wx.NewId()
303 305
304 html_str += "</tr></table>" 306 html_str += "</tr></table>"
305 return html_str 307 return html_str
306 308
307 def about(self): 309 def about(self):
308 html_str = "<img src='" + orpg.dirpath.dir_struct["icon"] 310 html_str = "<img src='" + dir_struct["icon"]
309 html_str += "dnd3e_logo.gif' ><br><b>dnd3e Character Tool " 311 html_str += "dnd3e_logo.gif' ><br><b>dnd3e Character Tool "
310 html_str += self.Version+"</b>" #m 1.6000 was hard coded. 312 html_str += self.Version+"</b>" #m 1.6000 was hard coded.
311 html_str += "<br>by Dj Gilcrease<br>digitalxero@gmail.com" 313 html_str += "<br>by Dj Gilcrease<br>digitalxero@gmail.com"
312 return html_str 314 return html_str
313 315
917 self.grid.DeleteRows(i) 919 self.grid.DeleteRows(i)
918 self.master_dom.removeChild(self.n_list[i]) 920 self.master_dom.removeChild(self.n_list[i])
919 921
920 def on_add(self,evt): 922 def on_add(self,evt):
921 if not self.temp_dom: 923 if not self.temp_dom:
922 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3eclasses.xml","r") 924 tmp = open(dir_struct["dnd3e"]+"dnd3eclasses.xml","r")
923 xml_dom = parseXml_with_dlg(self,tmp.read()) 925 xml_dom = parseXml_with_dlg(self,tmp.read())
924 xml_dom = xml_dom._get_firstChild() 926 xml_dom = xml_dom._get_firstChild()
925 tmp.close() 927 tmp.close()
926 self.temp_dom = xml_dom 928 self.temp_dom = xml_dom
927 f_list = self.temp_dom.getElementsByTagName('class') 929 f_list = self.temp_dom.getElementsByTagName('class')
1548 self.master_dom.removeChild(self.n_list[i]) 1550 self.master_dom.removeChild(self.n_list[i])
1549 1551
1550 def on_add(self,evt): 1552 def on_add(self,evt):
1551 1553
1552 if not self.temp_dom: 1554 if not self.temp_dom:
1553 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3efeats.xml","r") 1555 tmp = open(dir_struct["dnd3e"]+"dnd3efeats.xml","r")
1554 xml_dom = parseXml_with_dlg(self,tmp.read()) 1556 xml_dom = parseXml_with_dlg(self,tmp.read())
1555 xml_dom = xml_dom._get_firstChild() 1557 xml_dom = xml_dom._get_firstChild()
1556 tmp.close() 1558 tmp.close()
1557 self.temp_dom = xml_dom 1559 temp_dom = xml_dom
1558 f_list = self.temp_dom.getElementsByTagName('feat') 1560 f_list = temp_dom.getElementsByTagName('feat')
1559 opts = [] 1561 opts = []
1560 for f in f_list: 1562 for f in f_list:
1561 opts.append(f.getAttribute('name') + " - [" + 1563 opts.append(f.getAttribute('name') + " - [" +
1562 f.getAttribute('type') + "] - " + f.getAttribute('desc')) 1564 f.getAttribute('type') + "] - " + f.getAttribute('desc'))
1563 dlg = wx.SingleChoiceDialog(self,'Choose Feat','Feats',opts) 1565 dlg = wx.SingleChoiceDialog(self,'Choose Feat','Feats',opts)
1813 tree.SetPyData(new_tree_node,self) 1815 tree.SetPyData(new_tree_node,self)
1814 self.weapons[name]=n 1816 self.weapons[name]=n
1815 1817
1816 def updateFootN(self,n):#a 1.5012 this whole function 1818 def updateFootN(self,n):#a 1.5012 this whole function
1817 if not self.temp_dom: 1819 if not self.temp_dom:
1818 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3eweapons.xml","r") 1820 tmp = open(dir_struct["dnd3e"]+"dnd3eweapons.xml","r")
1819 #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012 1821 #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012
1820 self.temp_dom = xml.dom.minidom.parse(tmp) 1822 self.temp_dom = xml.dom.minidom.parse(tmp)
1821 1823
1822 #self.temp_dom = parseXml_with_dlg(self,tmp.read()) 1824 #self.temp_dom = parseXml_with_dlg(self,tmp.read())
1823 self.temp_dom = self.temp_dom._get_firstChild() 1825 self.temp_dom = self.temp_dom._get_firstChild()
2246 #print "masterFrame:",masterFrame 2248 #print "masterFrame:",masterFrame
2247 title = name+"'s Special Weapon Characteristics" 2249 title = name+"'s Special Weapon Characteristics"
2248 fnFrame = wx.Frame(masterFrame, -1, title) 2250 fnFrame = wx.Frame(masterFrame, -1, title)
2249 fnFrame.panel = wx.html.HtmlWindow(fnFrame,-1) 2251 fnFrame.panel = wx.html.HtmlWindow(fnFrame,-1)
2250 if not self.temp_dom: 2252 if not self.temp_dom:
2251 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+ 2253 tmp = open(dir_struct["dnd3e"]+
2252 "dnd3eweapons.xml","r") 2254 "dnd3eweapons.xml","r")
2253 #tmp = open("c:\clh\codeSamples\sample1.xml","r") 2255 #tmp = open("c:\clh\codeSamples\sample1.xml","r")
2254 xml_dom = parseXml_with_dlg(self,tmp.read()) 2256 xml_dom = parseXml_with_dlg(self,tmp.read())
2255 xml_dom = xml_dom._get_firstChild() 2257 xml_dom = xml_dom._get_firstChild()
2256 tmp.close() 2258 tmp.close()
2352 self.n_list = self.master_dom.getElementsByTagName('weapon') 2354 self.n_list = self.master_dom.getElementsByTagName('weapon')
2353 self.handler.refresh_weapons() 2355 self.handler.refresh_weapons()
2354 2356
2355 def on_add(self,evt): 2357 def on_add(self,evt):
2356 if not self.temp_dom: 2358 if not self.temp_dom:
2357 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3eweapons.xml","r") 2359 tmp = open(dir_struct["dnd3e"]+"dnd3eweapons.xml","r")
2358 #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012 2360 #tmp = open("c:\clh\codeSamples\sample1.xml","r") #a (debug) 1.5012
2359 xml_dom = parseXml_with_dlg(self,tmp.read()) 2361 xml_dom = parseXml_with_dlg(self,tmp.read())
2360 xml_dom = xml_dom._get_firstChild() 2362 xml_dom = xml_dom._get_firstChild()
2361 tmp.close() 2363 tmp.close()
2362 self.temp_dom = xml_dom 2364 self.temp_dom = xml_dom
2579 self.grid.DeleteRows(i) 2581 self.grid.DeleteRows(i)
2580 self.master_dom.removeChild(self.n_list[i]) 2582 self.master_dom.removeChild(self.n_list[i])
2581 2583
2582 def on_add(self,evt): 2584 def on_add(self,evt):
2583 if not self.temp_dom: 2585 if not self.temp_dom:
2584 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3earmor.xml","r") 2586 tmp = open(dir_struct["dnd3e"]+"dnd3earmor.xml","r")
2585 xml_dom = parseXml_with_dlg(self,tmp.read()) 2587 xml_dom = parseXml_with_dlg(self,tmp.read())
2586 xml_dom = xml_dom._get_firstChild() 2588 xml_dom = xml_dom._get_firstChild()
2587 tmp.close() 2589 tmp.close()
2588 self.temp_dom = xml_dom 2590 self.temp_dom = xml_dom
2589 f_list = self.temp_dom.getElementsByTagName('armor') 2591 f_list = self.temp_dom.getElementsByTagName('armor')
2842 self.master_dom.removeChild(self.n_list[i]) 2844 self.master_dom.removeChild(self.n_list[i])
2843 2845
2844 def on_add(self,evt): 2846 def on_add(self,evt):
2845 2847
2846 if not self.temp_dom: 2848 if not self.temp_dom:
2847 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3espells.xml","r") 2849 tmp = open(dir_struct["dnd3e"]+"dnd3espells.xml","r")
2848 xml_dom = parseXml_with_dlg(self,tmp.read()) 2850 xml_dom = parseXml_with_dlg(self,tmp.read())
2849 xml_dom = xml_dom._get_firstChild() 2851 xml_dom = xml_dom._get_firstChild()
2850 tmp.close() 2852 tmp.close()
2851 self.temp_dom = xml_dom 2853 self.temp_dom = xml_dom
2852 f_list = self.temp_dom.getElementsByTagName('spell') 2854 f_list = self.temp_dom.getElementsByTagName('spell')
3049 self.grid.DeleteRows(i) 3051 self.grid.DeleteRows(i)
3050 self.master_dom.removeChild(self.n_list[i]) 3052 self.master_dom.removeChild(self.n_list[i])
3051 3053
3052 def on_add(self,evt): 3054 def on_add(self,evt):
3053 if not self.temp_dom: 3055 if not self.temp_dom:
3054 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3edivine.xml","r") 3056 tmp = open(dir_struct["dnd3e"]+"dnd3edivine.xml","r")
3055 3057
3056 xml_dom = parseXml_with_dlg(self,tmp.read()) 3058 xml_dom = parseXml_with_dlg(self,tmp.read())
3057 xml_dom = xml_dom._get_firstChild() 3059 xml_dom = xml_dom._get_firstChild()
3058 tmp.close() 3060 tmp.close()
3059 self.temp_dom = xml_dom 3061 self.temp_dom = xml_dom
3286 self.grid.DeleteRows(i) 3288 self.grid.DeleteRows(i)
3287 self.master_dom.removeChild(self.n_list[i]) 3289 self.master_dom.removeChild(self.n_list[i])
3288 3290
3289 def on_add(self,evt): 3291 def on_add(self,evt):
3290 if not self.temp_dom: 3292 if not self.temp_dom:
3291 tmp = open(orpg.dirpath.dir_struct["dnd3e"]+"dnd3epowers.xml","r") 3293 tmp = open(dir_struct["dnd3e"]+"dnd3epowers.xml","r")
3292 3294
3293 xml_dom = parseXml_with_dlg(self,tmp.read()) 3295 xml_dom = parseXml_with_dlg(self,tmp.read())
3294 xml_dom = xml_dom._get_firstChild() 3296 xml_dom = xml_dom._get_firstChild()
3295 tmp.close() 3297 tmp.close()
3296 self.temp_dom = xml_dom 3298 self.temp_dom = xml_dom