Mercurial > traipse_dev
changeset 110:910942d07574 alpha
Traipse Alpha 'OpenRPG' {091008-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:
{091006}
00:
Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images!
03:
Changes made to the map for increased portability. SnowDog has changes planned in
Core, though.
Added an initial push to the BCG. Not much to see, just shows off how it is
re-writing Main code.
{091007}
00:
New images added to Plugin Control Panel for Auto Start.
01:
Attempting to fix Deprecation warning from Main.
02:
Second attempt, problem in gsclient with "s.
03:
Fail.
{091008}
00:
Fix to remote admin commands
author | sirebral |
---|---|
date | Thu, 08 Oct 2009 04:14:41 -0500 |
parents | 5eac6e0308df |
children | 0c936d98f9eb |
files | orpg/chat/commands.py orpg/orpg_version.py |
diffstat | 2 files changed, 61 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/orpg/chat/commands.py Wed Oct 07 21:02:28 2009 -0500 +++ b/orpg/chat/commands.py Thu Oct 08 04:14:41 2009 -0500 @@ -12,10 +12,10 @@ import time import orpg.orpg_version import orpg.orpg_windows -import traceback - -from orpg.orpgCore import component -from orpg.tools.orpg_log import logger +import traceback + +from orpg.orpgCore import component +from orpg.tools.orpg_log import logger from orpg.tools.decorators import debugging ##-------------------------------------------------------------- @@ -39,7 +39,7 @@ # Initialization subroutine. # # !self : instance of self - # !chat : instance of the chat window to write to + # !chat : instance of the chat window to write to @debugging def __init__(self,chat): self.post = chat.Post @@ -60,7 +60,7 @@ # of implemented emotions. # # !self : instance of self - # !text : string of text matching an implemented emotion + # !text : string of text matching an implemented emotion @debugging def addcommand(self, cmd, function, helpmsg): if not self.cmdlist.has_key(cmd) and not self.shortcmdlist.has_key(cmd): @@ -68,12 +68,12 @@ self.cmdlist[cmd]['function'] = function self.cmdlist[cmd]['help'] = helpmsg #print 'Command Added: ' + cmd - + @debugging def addshortcmd(self, shortcmd, longcmd): if not self.shortcmdlist.has_key(shortcmd) and not self.cmdlist.has_key(shortcmd): self.shortcmdlist[shortcmd] = longcmd - + @debugging def removecmd(self, cmd): if self.cmdlist.has_key(cmd): @@ -83,7 +83,7 @@ #print 'Command Removed: ' + cmd - + @debugging def defaultcmds(self): self.addcommand('/help', self.on_help, '- Displays this help message') @@ -113,7 +113,7 @@ self.addcommand('/sound', self.on_sound, 'Sound_URL - Plays a sound for all clients in the room.') self.addcommand('/purge', self.on_purge, 'This will clear the entire chat window') self.addcommand('/advfilter', self.on_filter, 'This will toggle the Advanced Filter') - + @debugging def defaultcmdalias(self): self.addshortcmd('/?', '/help') @@ -128,7 +128,7 @@ #This is just an example or a differant way the shorcmd can be used self.addshortcmd('/sleep', '/me falls asleep') - + @debugging def docmd(self,text): cmdsearch = string.split(text,None,1) @@ -144,7 +144,7 @@ else: msg = "Sorry I don't know what %s is!" % (cmd) self.chat.InfoPost(msg) - + @debugging def on_filter(self, cmdargs): #print self.chat.advancedFilter @@ -169,12 +169,12 @@ self.chat.InfoPost("Advanced Filtering has been turned On") else: self.chat.InfoPost("Advanced Filtering has been turned Off") - + @debugging def on_purge(self, cmdargs): self.chat.PurgeChat() self.chat.InfoPost('Chat Buffer has been Purged!') - + @debugging def on_sound(self, cmdargs): if len(cmdargs) < 8: @@ -208,11 +208,11 @@ self.chat.InfoPost("You cannot send sound files to the lobby!") else: self.chat.InfoPost("Something dun fuckered up Frank!") - + @debugging def on_version(self, cmdargs=""): self.chat.InfoPost("Version is OpenRPG " + self.chat.version) - + @debugging def on_load(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -223,14 +223,14 @@ except Exception,e: print e self.chat.InfoPost("ERROR Loading settings") - + @debugging def on_font(self, cmdargs): try: fontsettings = self.chat.set_default_font(fontname=cmdargs, fontsize=None) except: self.chat.InfoPost("ERROR setting default font") - + @debugging def on_fontsize(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -239,7 +239,7 @@ except Exception, e: print e self.chat.InfoPost("ERROR setting default font size") - + @debugging def on_close(self, cmdargs): try: @@ -251,7 +251,7 @@ chatpanel.parent.onCloseTab(0) except: self.chat.InfoPost("Error: cannot close private chat tab.") - + @debugging def on_time(self, cmdargs): local_time = time.localtime() @@ -259,7 +259,7 @@ format_string = "%A %b %d, %Y %I:%M:%S%p" self.chat.InfoPost("<br />Local: " + time.strftime(format_string)+\ "<br />GMT: "+time.strftime(format_string,gmt_time)) - + @debugging def on_dieroller(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -272,13 +272,13 @@ print e self.chat.InfoPost("Available die rollers: " + str(rm.listRollers())) self.chat.InfoPost("You are using the <b>\"" + rm.getRoller() + "\"</b> die roller.") - + @debugging def on_ping(self, cmdargs): ct = time.clock() msg = "<ping player='"+self.session.id+"' time='"+str(ct)+"' />" self.session.outbox.put(msg) - + @debugging def on_log(self,cmdargs): args = string.split(cmdargs,None,-1) @@ -310,7 +310,7 @@ self.postLoggingState() else: self.chat.InfoPost("Unknown logging command, use 'on' or 'off'" ) - + @debugging def postLoggingState( self ): logfile = self.settings.get_setting( 'GameLogPrefix' ) @@ -327,7 +327,7 @@ # This subroutine will set the players netork status. # #!self : instance of self - + @debugging def on_name(self, cmdargs): #only 20 chars no more! :) @@ -342,17 +342,17 @@ # This subroutine will set the players netork status. # - # !self : instance of self + # !self : instance of self @debugging def on_status(self, cmdargs): if cmdargs == "": self.chat.InfoPost("Incorrect synatx for status.") - else: + else: #only 20 chars no more! :) - txt = cmdargs[:20] - self.session.set_text_status(str(txt)) + txt = cmdargs[:20] + self.session.set_text_status(str(txt)) # def on_status - end - + @debugging def on_set(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -387,7 +387,7 @@ # This subroutine will display the correct usage of the different emotions. # #!self : instance of self - + @debugging def on_help(self, cmdargs=""): cmds = self.cmdlist.keys() @@ -410,7 +410,7 @@ # This subroutine will either show the list of currently ignored users # !self : instance of self # !text : string that is comprised of a list of users to toggle the ignore flag - + @debugging def on_ignore(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -437,7 +437,7 @@ except: self.chat.InfoPost(m + " was ignored because it is an invalid player ID") traceback.print_exc() - + @debugging def on_role(self, cmdargs): if cmdargs == "": @@ -469,7 +469,7 @@ # !self : instance of self # !text : string that is comprised of a list of users and the message to #whisper. - + @debugging def on_whisper(self, cmdargs): delim = cmdargs.find("=") @@ -488,7 +488,7 @@ #--------------------------------------------------------- # [START] Digitalxero Multi Whisper Group 1/1/05 -#--------------------------------------------------------- +#--------------------------------------------------------- @debugging def on_groupwhisper(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -549,7 +549,7 @@ #--------------------------------------------------------- # [END] Digitalxero Multi Whisper Group 1/1/05 #--------------------------------------------------------- - + @debugging def on_gmwhisper(self, cmdargs): if cmdargs == "": @@ -565,7 +565,7 @@ self.on_whisper(gmstring + "=" + cmdargs) else: self.chat.InfoPost("**No GMs to Whisper to.") - + @debugging def on_moderate(self, cmdargs): if cmdargs != "": @@ -603,11 +603,11 @@ msg = "<moderate action='list' from='"+self.session.id+"' />" self.session.outbox.put(msg) self.session.update() - + @debugging def on_update(self, cmdargs): self.chat.InfoPost("This command is no longer valid") - + @debugging def on_description(self, cmdargs): if len(cmdargs) <= 0: @@ -618,7 +618,7 @@ mesg += "</font></td></tr></table>" self.chat.Post(mesg) self.chat.send_chat_message(mesg) - + @debugging def invoke_tab(self, cmdargs): ######START mDuo13's Tab Initiator######## @@ -644,7 +644,7 @@ self.chat.parent.newMsg(nidx) return #######END mDuo13's Tab Initiator######### - + @debugging def on_remote_admin(self, cmdargs): args = string.split(cmdargs,None,-1) @@ -661,7 +661,7 @@ msg = "<br /><b>Remote Administrator Config:</b>" if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />" else: - msg += " Enabled. Using password \""+pwd+"\"<br />" + msg += " Enabled. Using password '"+pwd+"'<br />" self.chat.SystemPost(msg) return @@ -669,15 +669,16 @@ #no commands under this point will execute unless an admin password has been previously set self.chat.SystemPost("Command ignored. No remote administrator password set!!") return - msgbase = "<admin id=\""+self.session.id+"\" group_id=\""+self.session.group_id+"\" pwd=\""+pwd+"\" " + msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'" + if args[0] == "set": if len( args ) > 1: self.session.orpgFrame_callback.password_manager.server = str( args[1] ) - self.chat.SystemPost( "Remote administration commands using password: \""+str(self.session.orpgFrame_callback.password_manager.GetSilentPassword("server"))+"\"" ) + self.chat.SystemPost( "Remote administration commands using password: "+str(self.session.orpgFrame_callback.password_manager.GetSilentPassword("server"))+"" ) else: pwd = self.session.orpgFrame_callback.password_manager.GetPassword("server") if pwd != None: - self.chat.SystemPost( "Remote administration commands using password: \""+pwd+"\"" ) + self.chat.SystemPost( "Remote administration commands using password: "+pwd+"" ) elif args[0] == "ban": #Ban a player from the server @@ -686,10 +687,8 @@ elif args[0] == "banip": #Ban a player from the server - try: - bname = str(args[2]) - except: - bname = 'Unknown' + try: bname = str(args[2]) + except: bname = 'Unknown' msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>' self.session.outbox.put(msg) @@ -705,37 +704,37 @@ elif args[0] == "help": #request help from server - msg = msgbase + " cmd=\"help\" />" + msg = msgbase + " cmd='help' />" self.session.outbox.put(msg) elif args[0] == "nameroom": #reqest room renaming on server - msg = msgbase + " cmd=\"nameroom\" rmid=\""+ str(args[1])+"\" name=\""+ string.join(args[2:])+"\" />" + msg = msgbase + " cmd='nameroom' rmid="+ str(args[1])+" name="+ string.join(args[2:])+" />" self.session.outbox.put(msg) elif args[0] == "roompasswords": #reqest room renaming on server - msg = msgbase + " cmd=\"roompasswords\"/>" + msg = msgbase + " cmd='roompasswords' />" self.session.outbox.put(msg) elif args[0] == "message": #send message to a specific player on the server via the system administrator - msg = msgbase + " cmd=\"message\" to_id=\""+ str(args[1])+"\" msg=\""+ string.join(args[2:])+"\" />" + msg = msgbase + " cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />" self.session.outbox.put(msg) elif args[0] == "broadcast": #send a message to all players on server from the system administrator - msg = msgbase + " cmd=\"broadcast\" msg=\""+ string.join(args[1:])+"\" />" + msg = msgbase + " cmd='broadcast' msg='"+ string.join(args[1:])+"' />" self.session.outbox.put(msg) elif args[0] == "killgroup": #remove a group from the server and drop all players within the group - msg = msgbase + " cmd=\"killgroup\" gid=\""+ str(args[1])+"\" />" + msg = msgbase + " cmd='killgroup' gid='"+ str(args[1])+"' />" self.session.outbox.put(msg) elif args[0] == "uptime": #request uptime report from server - msg = msgbase + " cmd=\"uptime\" />" + msg = msgbase + " cmd='uptime' />" self.session.outbox.put(msg) elif args[0] == "createroom": @@ -747,30 +746,29 @@ self.chat.SystemPost( "You must supply a boot password also.<br />/admin createroom <name> <boot password> [password]" ) return if len(args) < 4: args.append("") - msg = msgbase + " cmd=\"createroom\" name=\""+str(args[1])+"\" boot=\""+ str(args[2])+"\" pass=\""+ str(args[3])+"\" />" + msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />" self.session.outbox.put(msg) elif args[0] == "passwd": #request boot password change on a room - msg = msgbase + " cmd=\"passwd\" gid=\""+str(args[1])+"\" pass=\""+ str(args[2])+"\" />" + msg = msgbase + " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />" self.session.outbox.put(msg) elif args[0] == "list": #request a list of rooms and players from server - msg = msgbase + " cmd=\"list\" />" + msg = msgbase + " cmd='list' />" self.session.outbox.put(msg) elif args[0] == "killserver": #remotely kill the server - msg = msgbase + " cmd=\"killserver\" />" + msg = msgbase + " cmd='killserver' />" self.session.outbox.put(msg) elif args[0] == "savemaps": msg = msgbase + ' cmd="savemaps" />' self.session.outbox.put(msg) - else: - self.chat.InfoPost("Unknown administrator command" ) + else: self.chat.InfoPost("Unknown administrator command" ) except: self.chat.InfoPost("An error has occured while processing a Remote Administrator command!") traceback.print_exc()
--- a/orpg/orpg_version.py Wed Oct 07 21:02:28 2009 -0500 +++ b/orpg/orpg_version.py Thu Oct 08 04:14:41 2009 -0500 @@ -4,7 +4,7 @@ #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed) DISTRO = "Traipse Alpha" DIS_VER = "Ornery Orc" -BUILD = "091007-03" +BUILD = "091008-00" # This version is for network capability. PROTOCOL_VERSION = "1.2"