Mercurial > traipse_dev
comparison orpg/chat/chatwnd.py @ 97:bb22f0f1a7ec alpha
Traipse Alpha 'OpenRPG' {090924-01}
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:
00:
Update forwards to the 090909-02 Server code that now works.
New default Lobby Map, designed for Traipse. Feel free to change it.
Updates to Server GUI:
* Admin can Ban from Backend.
* Prework to modify Ban List in back end.
* Server GUI finds your Lobby Name
* New users default as Lurker unless a Role is set
New Addition to Chat Die Roll commands. Math Ordering. Ex. [(X+Y)dZ]. Currently does pairs only, no nesting either.
Cleaner TraipseSuiteAttention portability and clean up in Main (Beta!)
01:
Die Roll Commands addition removed in favor of Core code
author | sirebral |
---|---|
date | Thu, 24 Sep 2009 21:21:49 -0500 |
parents | 65c1604e7949 |
children | 217fb049bd00 |
comparison
equal
deleted
inserted
replaced
96:65c1604e7949 | 97:bb22f0f1a7ec |
---|---|
1852 """Parses player input for embedded dice rolls""" | 1852 """Parses player input for embedded dice rolls""" |
1853 reg = re.compile("\[([^]]*?)\]") | 1853 reg = re.compile("\[([^]]*?)\]") |
1854 matches = reg.findall(s) | 1854 matches = reg.findall(s) |
1855 for i in xrange(0,len(matches)): | 1855 for i in xrange(0,len(matches)): |
1856 newstr = self.PraseUnknowns(matches[i]) | 1856 newstr = self.PraseUnknowns(matches[i]) |
1857 newstr = self.ParseMathOrder(matches[i]) | |
1858 qmode = 0 | 1857 qmode = 0 |
1859 newstr1 = newstr | 1858 newstr1 = newstr |
1860 if newstr[0].lower() == 'q': | 1859 if newstr[0].lower() == 'q': |
1861 newstr = newstr[1:] | 1860 newstr = newstr[1:] |
1862 qmode = 1 | 1861 qmode = 1 |
1883 dlg.SetTitle("Enter Value for " + matches[i][1]) | 1882 dlg.SetTitle("Enter Value for " + matches[i][1]) |
1884 if dlg.ShowModal() == wx.ID_OK: newstr = dlg.GetValue() | 1883 if dlg.ShowModal() == wx.ID_OK: newstr = dlg.GetValue() |
1885 if newstr == '': newstr = '0' | 1884 if newstr == '': newstr = '0' |
1886 s = s.replace(matches[i][0], newstr, 1).replace(matches[i][1], '', 1).replace(matches[i][2], '', 1) | 1885 s = s.replace(matches[i][0], newstr, 1).replace(matches[i][1], '', 1).replace(matches[i][2], '', 1) |
1887 dlg.Destroy() | 1886 dlg.Destroy() |
1888 return s | |
1889 | |
1890 def ParseMathOrder(self, s): | |
1891 ### Alpha ### New Code allows for Math Ordering with ()'s. Currently allows only pairs. | |
1892 reg = re.compile("\(([^]]*?)\)") | |
1893 matches = reg.findall(s) | |
1894 for i in xrange(0,len(matches)): | |
1895 node_math = self.ParseNode(matches[i]) | |
1896 do_math = list(str(node_math)) | |
1897 if do_math[1] == '+': math = int(do_math[0]) + int(do_math[2]) | |
1898 if do_math[1] == '-': math = int(do_math[0]) - int(do_math[2]) | |
1899 if do_math[1] == '*': math = int(do_math[0]) * int(do_math[2]) | |
1900 if do_math[1] == '/': math = int(do_math[0]) / int(do_math[2]) | |
1901 s = s.replace(matches[i], str(math)).replace('(', '').replace(')','') | |
1902 return s | 1887 return s |
1903 | 1888 |
1904 # This subroutine builds a chat display name. | 1889 # This subroutine builds a chat display name. |
1905 # | 1890 # |
1906 @debugging | 1891 @debugging |