comparison orpg/chat/chatwnd.py @ 176:537a6bbac9bd alpha

Traipse Alpha 'OpenRPG' {100113-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 (Keeping up with Beta) New Features: Added Bookmarks Added 'boot' command to remote admin Added confirmation window for sent nodes Minor changes to allow for portability to an OpenSUSE linux OS Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Zoom Mouse plugin added Images added to Plugin UI Switching to Element Tree Map efficiency, from FlexiRPG Added Status Bar to Update Manager New TrueDebug Class in orpg_log (See documentation for usage) Portable Mercurial Tip of the Day added, from Core and community New Reference Syntax added for custom PC sheets New Child Reference for gametree New Parent Reference for gametree New Gametree Recursion method, mapping, context sensitivity, and effeciency.. New Features node with bonus nodes and Node Referencing help added Dieroller structure from Core Added 7th Sea die roller method; ie [7k3] = [7d10.takeHighest(3).open(10)] New 'Mythos' System die roller added Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)]. Includes support for Mythos roller New EZ_Tree Reference system. Push a button, Traipse the tree, get a reference (Alpha!!) Fixes: Fix to Text based Server Fix to Remote Admin Commands Fix to Pretty Print, from Core Fix to Splitter Nodes not being created Fix to massive amounts of images loading, from Core Fix to Map from gametree not showing to all clients Fix to gametree about menus Fix to Password Manager check on startup Fix to PC Sheets from tool nodes. They now use the tabber_panel Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix. default_manifest.xml renamed to default_upmana.xml Fix to Update Manager; cleaner clode for saved repositories Fixes made to Settings Panel and no reactive settings when Ok is pressed Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of a Splice Fix to Use panel of Forms and Tabbers. Now longer enters design mode
author sirebral
date Wed, 13 Jan 2010 02:50:22 -0600
parents ff6cbd2b7620
children ff19dd30064b
comparison
equal deleted inserted replaced
175:fd6415b8243e 176:537a6bbac9bd
1858 i += 1 1858 i += 1
1859 return rs 1859 return rs
1860 1860
1861 def resolve_loop(self, node, path, step, depth): 1861 def resolve_loop(self, node, path, step, depth):
1862 if step == depth: 1862 if step == depth:
1863 self.resolution(node) 1863 return self.resolution(node)
1864 else: 1864 else:
1865 child_list = node.findall('nodehandler') 1865 child_list = node.findall('nodehandler')
1866 for child in child_list: 1866 for child in child_list:
1867 if step == depth: break 1867 if step == depth: break
1868 if child.get('name') == path[step]: 1868 if child.get('name') == path[step]:
1869 node = child 1869 node = child
1870 step += 1 1870 step += 1
1871 if node.get('class') in ('dnd35char_handler', "SWd20char_handler", "d20char_handler", "dnd3echar_handler"): self.resolve_cust_loop(node, path, step, depth) 1871 if node.get('class') in ('dnd35char_handler',
1872 "SWd20char_handler",
1873 "d20char_handler",
1874 "dnd3echar_handler"): self.resolve_cust_loop(node, path, step, depth)
1872 elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, step, depth) 1875 elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, step, depth)
1873 else: self.resolve_loop(node, path, step, depth) 1876 else: self.resolve_loop(node, path, step, depth)
1874
1875 1877
1876 def resolve_grid(self, node, path, step, depth): 1878 def resolve_grid(self, node, path, step, depth):
1877 if step == depth: 1879 if step == depth:
1878 self.data = 'Invalid Grid Reference!' 1880 self.data = 'Invalid Grid Reference!'
1879 return 1881 return
1883 col = rows[int(self.ParseDice(cell[0]))-1].findall('cell') 1885 col = rows[int(self.ParseDice(cell[0]))-1].findall('cell')
1884 try: self.data = self.ParseMap(col[int(self.ParseDice(cell[1]))-1].text, node) or 'No Cell Data' 1886 try: self.data = self.ParseMap(col[int(self.ParseDice(cell[1]))-1].text, node) or 'No Cell Data'
1885 except: self.data = 'Invalid Grid Reference!' 1887 except: self.data = 'Invalid Grid Reference!'
1886 return 1888 return
1887 1889
1890 def resolution(self, node):
1891 if self.passed == False:
1892 self.passed = True
1893 if node.get('class') == 'textctrl_handler':
1894 s = str(node.find('text').text)
1895 else: s = 'Nodehandler for '+ node.get('class') + ' not done!' or 'Invalid Reference!'
1896 else:
1897 s = ''
1898 self.data = self.ParseMap(s, node)
1899
1900 def ParseMap(self, s, node):
1901 """Parses player input for embedded nodes rolls"""
1902 cur_loc = 0
1903 reg = re.compile("(!!(.*?)!!)")
1904 matches = reg.findall(s)
1905 for i in xrange(0,len(matches)):
1906 tree_map = node.get('map')
1907 tree_map = tree_map + '::' + matches[i][1]
1908 newstr = '!@'+ tree_map +'@!'
1909 s = s.replace(matches[i][0], newstr, 1)
1910 s = self.ParseNode(s)
1911 s = self.ParseParent(s, tree_map)
1912 return s
1913
1914 def ParseParent(self, s, tree_map):
1915 """Parses player input for embedded nodes rolls"""
1916 cur_loc = 0
1917 reg = re.compile("(!#(.*?)#!)")
1918 matches = reg.findall(s)
1919 for i in xrange(0,len(matches)):
1920 ## Build the new tree_map
1921 new_map = tree_map.split('::')
1922 del new_map[len(new_map)-1]
1923 parent_map = matches[i][1].split('::')
1924 ## Find an index or use 1 for ease of use.
1925 try: index = new_map.index(parent_map[0])
1926 except: index = 1
1927 ## Just replace the old tree_map from the index.
1928 new_map[index:len(new_map)] = parent_map
1929 newstr = '::'.join(new_map)
1930 newstr = '!@'+ newstr +'@!'
1931 s = s.replace(matches[i][0], newstr, 1)
1932 #s = self.ParseMap(s, node) ## Needs to be added
1933 s = self.ParseNode(s)
1934 return s
1935
1936 def resolve_nodes(self, s):
1937 self.passed = False
1938 self.data = 'Invalid Reference!'
1939 value = ""
1940 path = s.split('::')
1941 depth = len(path)
1942 self.gametree = component.get('tree_back')
1943 try: node = self.gametree.tree_map[path[0]]['node']
1944 except Exception, e: return self.data
1945 if node.get('class') in ('dnd35char_handler',
1946 "SWd20char_handler",
1947 "d20char_handler",
1948 "dnd3echar_handler"): self.resolve_cust_loop(node, path, 1, depth)
1949 elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, 1, depth)
1950 else: self.resolve_loop(node, path, 1, depth)
1951 return self.data
1952
1888 def resolve_cust_loop(self, node, path, step, depth): 1953 def resolve_cust_loop(self, node, path, step, depth):
1889 node_class = node.get('class') 1954 node_class = node.get('class')
1890 ## Code needs clean up. Either choose .lower() or .title(), then reset the path list's content ## 1955 ## Code needs clean up. Either choose .lower() or .title(), then reset the path list's content ##
1891 if step == depth: self.resolution(node) 1956 if step == depth: self.resolution(node)
1892 ##Build Abilities dictionary## 1957 ##Build Abilities dictionary##
1904 1969
1905 if node_class not in ('d20char_handler', "SWd20char_handler"): ab = node.find('character').find('saves') 1970 if node_class not in ('d20char_handler', "SWd20char_handler"): ab = node.find('character').find('saves')
1906 else: ab = node.find('saves') 1971 else: ab = node.find('saves')
1907 ab_list = ab.findall('save') 1972 ab_list = ab.findall('save')
1908 for save in ab_list: 1973 for save in ab_list:
1909 pc_stats[save.get('name')] = ( str(save.get('base')), str(int(save.get('magmod')) + int(save.get('miscmod')) + int(pc_stats[save.get('stat')][1]) ) ) 1974 pc_stats[save.get('name')] = (str(save.get('base')), str(int(save.get('magmod')) + int(save.get('miscmod')) + int(pc_stats[save.get('stat')][1]) ) )
1910 if save.get('name') == 'Fortitude': abbr = 'Fort' 1975 if save.get('name') == 'Fortitude': abbr = 'Fort'
1911 if save.get('name') == 'Reflex': abbr = 'Ref' 1976 if save.get('name') == 'Reflex': abbr = 'Ref'
1912 if save.get('name') == 'Will': abbr = 'Will' 1977 if save.get('name') == 'Will': abbr = 'Will'
1913 pc_stats[abbr] = ( str(save.get('base')), str(int(save.get('magmod')) + int(save.get('miscmod')) + int(pc_stats[save.get('stat')][1]) ) ) 1978 pc_stats[abbr] = ( str(save.get('base')), str(int(save.get('magmod')) + int(save.get('miscmod')) + int(pc_stats[save.get('stat')][1]) ) )
1914 1979
1965 elif pc_stats.has_key(path[step].title()): 2030 elif pc_stats.has_key(path[step].title()):
1966 if step+1 == depth: self.data = pc_stats[path[step].title()][0] + ' +('+pc_stats[path[step].title()][1]+')' 2031 if step+1 == depth: self.data = pc_stats[path[step].title()][0] + ' +('+pc_stats[path[step].title()][1]+')'
1967 elif path[step+1].title() == 'Mod': self.data = pc_stats[path[step].title()][1] 2032 elif path[step+1].title() == 'Mod': self.data = pc_stats[path[step].title()][1]
1968 elif path[step+1].title() == 'Check': self.data = '<b>'+path[step].title()+' Check:</b> [1d20+'+str(pc_stats[path[step].title()][1])+']' 2033 elif path[step+1].title() == 'Check': self.data = '<b>'+path[step].title()+' Check:</b> [1d20+'+str(pc_stats[path[step].title()][1])+']'
1969 return 2034 return
1970
1971 def resolution(self, node):
1972 if self.passed == False:
1973 self.passed = True
1974 if node.get('class') == 'textctrl_handler': s = str(node.find('text').text)
1975 else: self.data = 'Nodehandler for '+ node.get('class') + ' not done!' or 'Invalid Reference!'
1976 else:
1977 self.data = ''
1978 pass
1979 self.data = self.ParseMap(s, node)
1980
1981 def ParseMap(self, s, node):
1982 """Parses player input for embedded nodes rolls"""
1983 cur_loc = 0
1984 reg = re.compile("(!!(.*?)!!)")
1985 matches = reg.findall(s)
1986 tree_map = node.get('map')
1987 for i in xrange(0,len(matches)):
1988 tree_map = tree_map + '::' + matches[i][1]
1989 newstr = '!@'+ tree_map +'@!'
1990 s = s.replace(matches[i][0], newstr, 1)
1991 s = self.ParseNode(s)
1992 s = self.ParseParent(s, tree_map)
1993 return s
1994
1995 def ParseParent(self, s, tree_map):
1996 """Parses player input for embedded nodes rolls"""
1997 cur_loc = 0
1998 reg = re.compile("(!#(.*?)#!)")
1999 matches = reg.findall(s)
2000 for i in xrange(0,len(matches)):
2001 ## Build the new tree_map
2002 new_map = tree_map.split('::')
2003 del new_map[len(new_map)-1]
2004 parent_map = matches[i][1].split('::')
2005 ## Find an index or use 1 for ease of use.
2006 try: index = new_map.index(parent_map[0])
2007 except: index = 1
2008 ## Just replace the old tree_map from the index.
2009 new_map[index:len(new_map)] = parent_map
2010 newstr = '::'.join(new_map)
2011 newstr = '!@'+ newstr +'@!'
2012 s = s.replace(matches[i][0], newstr, 1)
2013 s = self.ParseNode(s)
2014 return s
2015
2016 def resolve_nodes(self, s):
2017 self.passed = False
2018 self.data = 'Invalid Reference!'
2019 value = ""
2020 path = s.split('::')
2021 depth = len(path)
2022 self.gametree = component.get('tree_back')
2023 try: node = self.gametree.tree_map[path[0]]['node']
2024 except Exception, e: return self.data
2025 if node.get('class') in ('dnd35char_handler', "SWd20char_handler", "d20char_handler", "dnd3echar_handler"): self.resolve_cust_loop(node, path, 1, depth)
2026 elif node.get('class') == 'rpg_grid_handler': self.resolve_grid(node, path, 1, depth)
2027 else: self.resolve_loop(node, path, 1, depth)
2028 return self.data