# HG changeset patch # User sirebral # Date 1281552750 18000 # Node ID 56c1f2729413fe7ccaf21097bd7748c03c54a2e8 # Parent b44dad398833fdd504a6c98587dc1cb02ec9f583 Traipse Beta 'OpenRPG' {100811-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 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. 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 diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/base.py --- a/orpg/dieroller/base.py Sat Jun 19 10:17:24 2010 -0500 +++ b/orpg/dieroller/base.py Wed Aug 11 13:52:30 2010 -0500 @@ -126,6 +126,7 @@ elif hasattr(other,"sum"): return cmp(self.sum(), other.sum()) else: return UserList.UserList.__cmp__(self,other) + def __rcmp__(self,other): return self.__cmp__(other) @@ -229,7 +230,7 @@ ### di class to handle actual dice class di: - def __init__(self, sides, min=1): + def __init__(self,sides,min=1): self.sides = sides self.history = None self.value = None @@ -263,6 +264,7 @@ def __int__(self): return self.value + def __lt__(self,other): if type(other) == type(3) or type(other) == type(3.0): return self.value < other elif hasattr(other,"value"): return self.value < other.value diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/7sea.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/__init__.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/alternity.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/d20.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/gurps.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/hackmaster.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/hero.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/mythos.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/runequest.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/savage.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/shadowrun.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/sr4.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/srex.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/std.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/trinity.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/wfrpg.py --- a/orpg/dieroller/rollers/wfrpg.py Sat Jun 19 10:17:24 2010 -0500 +++ b/orpg/dieroller/rollers/wfrpg.py Wed Aug 11 13:52:30 2010 -0500 @@ -37,11 +37,13 @@ class wfrpg(std): name = "wfrpg" + regExpression = "(?:\d+|\([0-9\*/\-\+]+\))\s*[a-zA-Z]+\s*[a-zA-Z]+" def __init__(self, source=[]): std.__init__(self, source) - def non_stdDie(self, s): + def non_stdDie(self, match): + s = match.group(0) self.war_die = {'rec': self.reckless, 'con': self.conservative, 'chr': self.characteristic, diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/wod.py --- a/orpg/dieroller/rollers/wod.py Sat Jun 19 10:17:24 2010 -0500 +++ b/orpg/dieroller/rollers/wod.py Wed Aug 11 13:52:30 2010 -0500 @@ -38,6 +38,7 @@ class wod(std): name = "wod" + regExpression = "[\(0-9\*\-\+\)]+[a-zA-Z]+[0-9]+" def __init__(self,source=[],target=0,targetthr=0): std.__init__(self,source) @@ -81,13 +82,14 @@ else: myStr += "] vs " +str(self.target)+" result of (" + str(self.sum()) + ")" return myStr - def non_stdDie(self, s): + def non_stdDie(self, match): + s = match.group(0) num_sides = s.split('v') if len(num_sides) > 1: num_sides; num = num_sides[0]; sides = num_sides[1] sides = '10'; target = num_sides[1] ret = ['(', num.strip(), "**die_rollers['wod'](", sides.strip(), ')).vs(', target, ')'] - s = ''.join(ret); return str(eval(s)) + s = ''.join(ret); return s die_rollers.register(wod) diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/rollers/wodex.py diff -r b44dad398833 -r 56c1f2729413 orpg/dieroller/utils.py --- a/orpg/dieroller/utils.py Sat Jun 19 10:17:24 2010 -0500 +++ b/orpg/dieroller/utils.py Wed Aug 11 13:52:30 2010 -0500 @@ -1,7 +1,7 @@ #!/usr/bin/env python -# Copyright (C) 2000-2001 The OpenRPG Project +# Copyright (C) 2000-2010 The OpenRPG Project # -# openrpg-dev@lists.sourceforge.net +# owner@madmathlabs.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,15 +20,13 @@ # # File: dieroller/utils.py # Author: OpenRPG Team -# Maintainer: +# Maintainer (Traipse): Tyler Starke # Version: # $Id: utils.py,v Traipse 'Ornery-Orc' prof.ebral Exp $ # # Description: Classes to help manage the die roller # -__version__ = "$Id: utils.py,v Traipse 'Ornery-Orc' prof.ebral Exp Exp $" - import re import orpg.dieroller.rollers @@ -55,8 +53,12 @@ def listRollers(self): return die_rollers.keys() + def completeMath(self, matches): + s = matches.group(0) + return str(eval(s)) + def stdDieToDClass(self, match): - s = match.group(0); self.eval = str(match.string) + s = match.group(0) num_sides = s.split('d') if len(num_sides) > 1: num_sides; num = num_sides[0]; sides = num_sides[1] @@ -67,38 +69,47 @@ ret = ['(', num.strip(), "**die_rollers['", self.getRoller(), "'](", sides.strip(), '))'] s = ''.join(ret) - self.eval = s return s - ## Portable Non Standard Die Characters #Prof-Ebral - else: s = die_rollers._rollers[self.getRoller()]().non_stdDie(s); return s - # Use this to convert ndm-style (3d6) dice to d_base format - def convertTheDieString(self,s): + def convertTheDieString(self, s): + """ + Die Roller Changes: + I've made some changes for ease of reading. Below you see the new formula and the old depricated formula. The new formula is easier to understand + and works a little better with math. Try this: [(2+4)+4d(6+8)+(4*4)] with both formulas. Traipse succeeds, Standard (1.7.1) fails. + + The new formula deals only with numbers of the Fudge roller. The math has a required process flow, which is unliked currently by me but I am not + going to spend more time on at currently to correct it. It occurs when using paranthesis on the facet. If paranthesis are used no modifier can be added + at the end, but you can added it before the roll. + + This is the standard roller formula: (Math D Numbers or Math or Fudge). If that fails the new non_stdDie looks for a regExpression formula inside + the current die roller, set under the name. So all of that bloat to include the english language in the Gilcrease 1.8.0 remains bloat and Traipse's + dice can be liberated to do what they want, where they want, when they want. + """ self.result = '' - reg = re.compile("(?:\d+|\([0-9\*/\-\+]+\))\s*[a-zA-Z]+\s*[\dFf]+") + math = '[\(0-9\/\*\-\+\)]+' + reg = re.compile(math+'d\s*([0-9]+|'+math+'|[fF])') + + #reg = re.compile("(?:\d+|\([0-9\*/\-\+]+\))\s*[a-zA-Z]+\s*[\dFf]+") ## Original (result, num_matches) = reg.subn(self.stdDieToDClass, s) + if num_matches == 0 or result is None: - reg = re.compile("(?:\d+|\([0-9\*/\-\+]+\))\s*[a-zA-Z]+\s*[a-zA-Z]+") ## Prof Ebral - (result, num_matches) = reg.subn(self.stdDieToDClass, s) ## Prof Ebral - """try: ## Kinda pointless when you can create new Regular Expressions - s2 = self.roller_class + "(0)." + s ## Broken method - test = eval(s2) - return s2 - except Exception, e: print e; pass""" - self.result = result - try: return self.do_math(s) + reg = re.compile(math) + (result, math_matches) = reg.subn(self.completeMath, s) + + if num_matches == 0 or result is None: + try: + reg = re.compile(die_rollers._rollers[self.getRoller()].regExpression) + (result, num_matches) = reg.subn(self.roller_class().non_stdDie, s) + self.result = result except: pass return result - def do_math(self, s): - return str(eval(s)) - def proccessRoll(self, s): v = self.convertTheDieString(s) try: b = str(eval(v)) except: - if v == self.eval: b = s + if v == '': b = s else: b = str(v) ##Fail safe for non standard dice. return b diff -r b44dad398833 -r 56c1f2729413 orpg/gametree/gametree.py --- a/orpg/gametree/gametree.py Sat Jun 19 10:17:24 2010 -0500 +++ b/orpg/gametree/gametree.py Wed Aug 11 13:52:30 2010 -0500 @@ -239,7 +239,7 @@ emsg = "Gametree Missing!\n"+filename+" cannot be found.\n\n"\ "Would you like to locate it?\n"\ "(Selecting 'No' will cause a new default gametree to be generated)" - self.locate_valid_tree("Gametree Error", emsg) + self.locate_valid_tree("Gametree Error", emsg, filename) return try: self.xml_root = False @@ -265,7 +265,7 @@ emsg = filename+" does not appear to be a valid gametree file.\n\n"\ "Would you like to select a different gametree file to use?\n"\ "(Selecting 'No' will cause a new default gametree to be generated)" - self.locate_valid_tree("Invalid Gametree!", emsg) + self.locate_valid_tree("Invalid Gametree!", emsg, filename) return try: # version = self.xml_root.get("version") diff -r b44dad398833 -r 56c1f2729413 orpg/orpg_version.py --- a/orpg/orpg_version.py Sat Jun 19 10:17:24 2010 -0500 +++ b/orpg/orpg_version.py Wed Aug 11 13:52:30 2010 -0500 @@ -4,7 +4,7 @@ #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed) DISTRO = "Traipse Beta" DIS_VER = "Ornery Orc" -BUILD = "100619-00" +BUILD = "100811-00" # This version is for network capability. PROTOCOL_VERSION = "1.2" diff -r b44dad398833 -r 56c1f2729413 plugins/xxstdnamespace.py --- a/plugins/xxstdnamespace.py Sat Jun 19 10:17:24 2010 -0500 +++ b/plugins/xxstdnamespace.py Wed Aug 11 13:52:30 2010 -0500 @@ -69,10 +69,10 @@ def plugin_toggle(self, evt): if self.toggle.IsChecked() == True: - Parse.NameSpaceI = self.parseMethods['Standard'] + Parse.NameSpaceE = self.parseMethods['Standard'] self.plugindb.SetString('xxstdnamespace', 'Standard', 'True') if self.toggle.IsChecked() == False: - Parse.NameSpaceI = self.parseMethods['Traipse'] + Parse.NameSpaceE = self.parseMethods['Traipse'] self.plugindb.SetString('xxstdnamespace', 'Standard', 'False') pass