comparison orpg/gametree/nodehandlers/dnd3e.py @ 243:3bbfd84619c0 beta

Traipse Beta 'OpenRPG' {101018-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 New Earthdawn Dieroller New IronClaw roller, sheet, and image 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 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 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
author sirebral
date Mon, 18 Oct 2010 23:48:49 -0500
parents dcae32e219f1
children
comparison
equal deleted inserted replaced
242:72e0cce81a47 243:3bbfd84619c0
31 from string import * #a 1.6003 31 from string import * #a 1.6003
32 from inspect import * #a 1.9001 32 from inspect import * #a 1.9001
33 from orpg.dirpath import dir_struct 33 from orpg.dirpath import dir_struct
34 from orpg.tools.orpg_log import debug 34 from orpg.tools.orpg_log import debug
35 from xml.etree.ElementTree import parse 35 from xml.etree.ElementTree import parse
36 from orpg.tools.InterParse import Parse
36 37
37 dnd3e_EXPORT = wx.NewId() 38 dnd3e_EXPORT = wx.NewId()
38 ############Global Stuff############## 39 ############Global Stuff##############
39 40
40 HP_CUR = wx.NewId() 41 HP_CUR = wx.NewId()
761 mod = self.get_mod(name) 762 mod = self.get_mod(name)
762 if mod >= 0: mod1 = "+" 763 if mod >= 0: mod1 = "+"
763 else: mod1 = "" 764 else: mod1 = ""
764 chat = self.chat 765 chat = self.chat
765 txt = '%s save: [1d20%s%s]' % (name, mod1, mod) 766 txt = '%s save: [1d20%s%s]' % (name, mod1, mod)
766 chat.ParsePost( txt, True, True ) 767 Parse.Post( txt, self.chat, True, True )
767 768
768 def get_design_panel(self,parent): 769 def get_design_panel(self,parent):
769 wnd = outline_panel(parent,self,save_grid,"Saves") 770 wnd = outline_panel(parent,self,save_grid,"Saves")
770 wnd.title = "Saves" 771 wnd.title = "Saves"
771 return wnd 772 return wnd
1014 if mod >= 0: mod1 = "+" 1015 if mod >= 0: mod1 = "+"
1015 else: mod1 = "" 1016 else: mod1 = ""
1016 chat = self.chat 1017 chat = self.chat
1017 txt = '%s Skill Check: [1d20%s%s%s] %s' % ( 1018 txt = '%s Skill Check: [1d20%s%s%s] %s' % (
1018 name, mod1, mod, acCp, armor) 1019 name, mod1, mod, acCp, armor)
1019 chat.ParsePost(txt,True,True) 1020 Parse.Post( txt, self.chat, True, True )
1020 1021
1021 def get_design_panel(self,parent): 1022 def get_design_panel(self,parent):
1022 wnd = outline_panel(parent,self,skill_grid,"Skills") 1023 wnd = outline_panel(parent,self,skill_grid,"Skills")
1023 wnd.title = "Skills (edit)" 1024 wnd.title = "Skills (edit)"
1024 return wnd 1025 return wnd
1316 1317
1317 def on_rclick( self, evt ): 1318 def on_rclick( self, evt ):
1318 chp = self.xml.get('current') 1319 chp = self.xml.get('current')
1319 mhp = self.xml.get('max') 1320 mhp = self.xml.get('max')
1320 txt = '((HP: %s / %s))' % ( chp, mhp ) 1321 txt = '((HP: %s / %s))' % ( chp, mhp )
1321 self.chat.ParsePost( txt, True, True ) 1322 Parse.Post( txt, self.chat, True, True )
1322 1323
1323 def tohtml(self): 1324 def tohtml(self):
1324 html_str = "<table width=100% border=1 >" 1325 html_str = "<table width=100% border=1 >"
1325 html_str += "<tr BGCOLOR=#E9E9E9 ><th colspan=4>Hit Points</th></tr>" 1326 html_str += "<tr BGCOLOR=#E9E9E9 ><th colspan=4>Hit Points</th></tr>"
1326 html_str += "<tr><th>Max:</th>" 1327 html_str += "<tr><th>Max:</th>"
1522 monkLvl = self.root.classes.get_class_lvl('Monk') # a 1.5002 1523 monkLvl = self.root.classes.get_class_lvl('Monk') # a 1.5002
1523 if dmg == "Monk Med": 1524 if dmg == "Monk Med":
1524 if monkLvl == None: #a 1.5009 1525 if monkLvl == None: #a 1.5009
1525 txt = 'Attempting to use monk attack, but has no monk ' 1526 txt = 'Attempting to use monk attack, but has no monk '
1526 txt += 'levels, please choose a different attack.' 1527 txt += 'levels, please choose a different attack.'
1527 chat.ParsePost( txt, True, True ) #a 1.5009 1528 Parse.Post( txt, self.chat, True, True )
1528 return #a 1.5009 1529 return #a 1.5009
1529 else: #a 1.5009 1530 else: #a 1.5009
1530 lvl=int(monkLvl) 1531 lvl=int(monkLvl)
1531 if lvl <= 3: dmg = "1d6" 1532 if lvl <= 3: dmg = "1d6"
1532 elif lvl <= 7: dmg = "1d8" 1533 elif lvl <= 7: dmg = "1d8"
1536 elif lvl <= 20: dmg = "2d10" 1537 elif lvl <= 20: dmg = "2d10"
1537 if dmg == "Monk Small": 1538 if dmg == "Monk Small":
1538 if monkLvl == None: 1539 if monkLvl == None:
1539 txt = 'Attempting to use monk attack, but has no monk ' 1540 txt = 'Attempting to use monk attack, but has no monk '
1540 txt += 'levels, please choose a different attack.' 1541 txt += 'levels, please choose a different attack.'
1541 chat.ParsePost( txt, True, True ) 1542 Parse.Post( txt, self.chat, True, True )
1542 return 1543 return
1543 else: 1544 else:
1544 lvl=int(monkLvl) 1545 lvl=int(monkLvl)
1545 if lvl <= 3: dmg = "1d4" 1546 if lvl <= 3: dmg = "1d4"
1546 elif lvl <= 7: dmg = "1d6" 1547 elif lvl <= 7: dmg = "1d6"
1581 if base >= 0: mod1 = "+" 1582 if base >= 0: mod1 = "+"
1582 else: mod1 = "" 1583 else: mod1 = ""
1583 txt = '%s ' % (spacer) 1584 txt = '%s ' % (spacer)
1584 txt += '%s Attack Roll: <b>[1d20%s%s%s]</b>' % (name, mod1, base, flu) 1585 txt += '%s Attack Roll: <b>[1d20%s%s%s]</b>' % (name, mod1, base, flu)
1585 txt += ' ===> Damage: <b>[%s%s]</b>' % (dmg, aStrengthMod) 1586 txt += ' ===> Damage: <b>[%s%s]</b>' % (dmg, aStrengthMod)
1586 self.chat.ParsePost( txt, True, True ) 1587 Parse.Post( txt, self.chat, True, True )
1587 1588
1588 def get_design_panel(self,parent): 1589 def get_design_panel(self,parent):
1589 wnd = outline_panel(parent,self,attack_panel,"Attacks") 1590 wnd = outline_panel(parent,self,attack_panel,"Attacks")
1590 wnd.title = "Attacks" 1591 wnd.title = "Attacks"
1591 return wnd 1592 return wnd
1946 1947
1947 def on_rclick( self, evt ): 1948 def on_rclick( self, evt ):
1948 ac = self.get_armor_class() 1949 ac = self.get_armor_class()
1949 fac = (int(ac)-(self.root.abilities.get_mod('Dex'))) 1950 fac = (int(ac)-(self.root.abilities.get_mod('Dex')))
1950 txt = '((AC: %s Normal, %s Flatfoot))' % ( ac, fac ) #a 1.5002 1951 txt = '((AC: %s Normal, %s Flatfoot))' % ( ac, fac ) #a 1.5002
1951 self.chat.ParsePost( txt, True, True ) 1952 Parse.Post( txt, self.chat, True, True )
1952 1953
1953 def tohtml(self): 1954 def tohtml(self):
1954 html_str = """<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 > 1955 html_str = """<table width=100% border=1 ><tr BGCOLOR=#E9E9E9 >
1955 <th>AC</th><th>Check Penalty</th><th >Spell Failure</th> 1956 <th>AC</th><th>Check Penalty</th><th >Spell Failure</th>
1956 <th>Max Dex</th><th>Total Weight</th></tr>""" 1957 <th>Max Dex</th><th>Total Weight</th></tr>"""
2166 charNameL=self.root.general.charName #a 1.5002 2167 charNameL=self.root.general.charName #a 1.5002
2167 left = eval( '%s - ( %s )' % ( memrz, use ) ) 2168 left = eval( '%s - ( %s )' % ( memrz, use ) )
2168 if left < 0: 2169 if left < 0:
2169 txt = '%s Tried to cast %s but has used all of them for today,' 2170 txt = '%s Tried to cast %s but has used all of them for today,'
2170 txt +='"Please rest so I can cast more."' % ( charNameL, name ) #a 1.5002 2171 txt +='"Please rest so I can cast more."' % ( charNameL, name ) #a 1.5002
2171 self.chat.ParsePost( txt, True, False ) 2172 Parse.Post( txt, self.chat, True, False )
2172 else: 2173 else:
2173 txt = '%s casts %s ( level %s, "%s" )' % ( charNameL, name, level, descr )#a f 1.5002 2174 txt = '%s casts %s ( level %s, "%s" )' % ( charNameL, name, level, descr )#a f 1.5002
2174 self.chat.ParsePost( txt, True, False ) 2175 Parse.Post( txt, self.chat, True, False )
2175 s = '' 2176 s = ''
2176 if left != 1: s = 's' 2177 if left != 1: s = 's'
2177 txt = '%s can cast %s %d more time%s' % ( charNameL, name, left, s ) #a 1.5002 2178 txt = '%s can cast %s %d more time%s' % ( charNameL, name, left, s ) #a 1.5002
2178 self.chat.ParsePost( txt, False, False ) 2179 Parse.Post( txt, self.chat, False, False )
2179 self.spells[ name ].set( 'used', `eval( use )` ) 2180 self.spells[ name ].set( 'used', `eval( use )` )
2180 2181
2181 def refresh_spells(self): 2182 def refresh_spells(self):
2182 self.spells = {} 2183 self.spells = {}
2183 tree = self.tree 2184 tree = self.tree
2343 use += '+1' 2344 use += '+1'
2344 left = eval( '%s - ( %s )' % ( memrz, use ) ) 2345 left = eval( '%s - ( %s )' % ( memrz, use ) )
2345 if left < 0: 2346 if left < 0:
2346 txt = '%s Tried to cast %s but has used all of them for today,' #m 1.5002 break in 2. 2347 txt = '%s Tried to cast %s but has used all of them for today,' #m 1.5002 break in 2.
2347 txt += "Please rest so I can cast more."' % ( charNameL, name )' #a 1.5002 2348 txt += "Please rest so I can cast more."' % ( charNameL, name )' #a 1.5002
2348 self.chat.ParsePost( txt, True, False ) 2349 Parse.Post( txt, self.chat, True, False )
2349 else: 2350 else:
2350 txt = '%s casts %s ( level %s, "%s" )' % ( charNameL, name, level, descr ) #a 5002 2351 txt = '%s casts %s ( level %s, "%s" )' % ( charNameL, name, level, descr ) #a 5002
2351 self.chat.ParsePost( txt, True, False ) 2352 Parse.Post( txt, self.chat, True, False )
2352 s = '' 2353 s = ''
2353 if left != 1: s = 's' 2354 if left != 1: s = 's'
2354 txt = '%s can cast %s %d more time%s' % ( charNameL, name, left, s ) #a 1.5002 2355 txt = '%s can cast %s %d more time%s' % ( charNameL, name, left, s ) #a 1.5002
2355 self.chat.ParsePost( txt, False, False ) 2356 Parse.Post( txt, self.chat, False, False )
2356 self.spells[ name ].set( 'used', `eval( use )` ) 2357 self.spells[ name ].set( 'used', `eval( use )` )
2357 2358
2358 def refresh_spells(self): 2359 def refresh_spells(self):
2359 self.spells = {} 2360 self.spells = {}
2360 tree = self.tree 2361 tree = self.tree
2531 numcast = eval('%s / %s' % (left, points)) 2532 numcast = eval('%s / %s' % (left, points))
2532 if left < 0: 2533 if left < 0:
2533 #In theory you should never see this -mgt 2534 #In theory you should never see this -mgt
2534 txt = ('%s doesnt have enough PowerPoints to use %s' 2535 txt = ('%s doesnt have enough PowerPoints to use %s'
2535 % ( charNameL, name )) #a 1.5002 2536 % ( charNameL, name )) #a 1.5002
2536 self.chat.ParsePost( txt, True, False ) 2537 Parse.Post( txt, self.chat, True, False )
2537 else: 2538 else:
2538 txt = ('%s uses %s as a Free Talent ( level %s, "%s" )' 2539 txt = ('%s uses %s as a Free Talent ( level %s, "%s" )'
2539 % ( charNameL, name, level, descr )) #a 1.5002 2540 % ( charNameL, name, level, descr )) #a 1.5002
2540 self.chat.ParsePost( txt, True, False ) 2541 Parse.Post( txt, self.chat, True, False )
2541 s = '' 2542 s = ''
2542 if left != 1: s = 's' 2543 if left != 1: s = 's'
2543 txt = '%s has %d Free Talent%s left' % ( charNameL, numcast, s ) #a 1.5002 2544 txt = '%s has %d Free Talent%s left' % ( charNameL, numcast, s ) #a 1.5002
2544 self.chat.ParsePost( txt, False, False ) 2545 Parse.Post( txt, self.chat, False, False )
2545 self.root.pp.set_char_pp('free',left) #a 1.5002 2546 self.root.pp.set_char_pp('free',left) #a 1.5002
2546 else: 2547 else:
2547 left = eval('%s - ( %s )' % ( cpp, points )) 2548 left = eval('%s - ( %s )' % ( cpp, points ))
2548 #numcast = eval('%s / %s' % (left, points)) 2549 #numcast = eval('%s / %s' % (left, points))
2549 if left < 0: 2550 if left < 0:
2550 txt = '%s doesnt have enough PowerPoints to use %s' % ( charNameL, name ) #m 1.5002 2551 txt = '%s doesnt have enough PowerPoints to use %s' % ( charNameL, name ) #m 1.5002
2551 self.chat.ParsePost( txt, True, False ) 2552 Parse.Post( txt, self.chat, True, False )
2552 else: 2553 else:
2553 txt = '%s uses %s ( level %s, "%s" )' % ( charNameL, name, level, descr ) #m 1.5002 2554 txt = '%s uses %s ( level %s, "%s" )' % ( charNameL, name, level, descr ) #m 1.5002
2554 self.chat.ParsePost( txt, True, False ) 2555 Parse.Post( txt, self.chat, True, False )
2555 s = '' 2556 s = ''
2556 if left != 1: 2557 if left != 1:
2557 s = 's' 2558 s = 's'
2558 #numcast is meaningless here -mgt 2559 #numcast is meaningless here -mgt
2559 #txt = '%s can use %s %d more time%s' % ( charNameL, name, numcast, s ) #m 1.5002 2560 #txt = '%s can use %s %d more time%s' % ( charNameL, name, numcast, s ) #m 1.5002
2560 #txt += ' - And has %d more PowerpointsP left' % (left) 2561 #txt += ' - And has %d more PowerpointsP left' % (left)
2561 txt = '%s has %d more Powerpoint%s' % ( charNameL, left, s ) #m 1.5002 2562 txt = '%s has %d more Powerpoint%s' % ( charNameL, left, s ) #m 1.5002
2562 self.chat.ParsePost( txt, False, False ) 2563 Parse.Post( txt, self.chat, False, False )
2563 self.root.pp.set_char_pp('current1',left) #a 1.5002 2564 self.root.pp.set_char_pp('current1',left) #a 1.5002
2564 2565
2565 def refresh_powers(self): 2566 def refresh_powers(self):
2566 self.powers = {} 2567 self.powers = {}
2567 tree = self.tree 2568 tree = self.tree