annotate orpg/chat/commands.py @ 208:9ac90179e8d8 alpha

Traipse Alpha 'OpenRPG' {100428-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 (Patch-2) Getting Ready for Beta! New Features: New Namespace method with two new syntaxes New Namespace Internal is context sensitive, always! New Namespace External is 'as narrow as you make it' New Namespace FutureCheck helps ensure you don't receive an incorrect node New PluginDB access for URL2Link plugin New to Forms, they now show their content in Design Mode New to Update Manager, checks Repo for updates on software start Fixes: Fix to Server GUI startup errors Fix to Server GUI Rooms tab updating Fix to Chat and Settings if non existant die roller is picked Fix to Dieroller and .open() used with .vs(). Successes are correctly calculated Fix to Alias Lib's Export to Tree, Open, Save features Fix to alias node, now works properly Fix to Splitter node, minor GUI cleanup Fix to Backgrounds not loading through remote loader Fix to Node name errors Fix to rolling dice in chat Whispers Fix to Splitters Sizing issues Fix to URL2Link plugin, modified regex compilation should remove memory leak Fix to mapy.py, a roll back due to zoomed grid issues Fix to whiteboard_handler, Circles work by you clicking the center of the circle Fix to Servers parse_incoming_dom which was outdated and did not respect XML Fix to a broken link in the server welcome message Fix to InterParse and logger requiring traceback Fix to Update Manager Status Bar Fix to failed image and erroneous pop up
author sirebral
date Wed, 28 Apr 2010 01:57:06 -0500
parents b633f4c64aae
children 50af54dbd6a6
rev   line source
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
1 # This class implements the basic chat commands available in the chat interface.
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
2 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
3 # Defines:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
4 # __init__(self,chat)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
5 # docmd(self,text)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
6 # on_help(self)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
7 # on_whisper(self,text)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
8 #
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
9
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
10 import string, time
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
11 import orpg.orpg_version
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
12 import orpg.orpg_windows
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
13 import traceback
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
14
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
15 from orpg.orpgCore import component
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
16 from orpg.tools.orpg_log import logger
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
17
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
18 ##--------------------------------------------------------------
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
19 ## dynamically loading module for extended developer commands
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
20 ## allows developers to work on new chat commands without
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
21 ## integrating them directly into the ORPG code allowing
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
22 ## updating of their code without merging changes
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
23 ## cmd_ext.py should NOT be included in the CVS or Actual Releases
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
24
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
25 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
26 import cmd_ext
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
27 print "Importing Developer Extended Command Set"
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
28 except: pass
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
29 ##----------------------------------------------------------------
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
30
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
31 ANTI_LOG_CHAR = '!'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
32
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
33 class chat_commands:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
34
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
35 def __init__(self,chat):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
36 self.post = chat.Post
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
37 self.colorize = chat.colorize
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
38 self.session = chat.session
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
39 self.settings = chat.settings
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
40 self.chat = chat
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
41 self.cmdlist = {}
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
42 self.shortcmdlist = {}
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
43 self.defaultcmds()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
44 self.defaultcmdalias()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
45 self.previous_whisper = []
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
46
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
47 def addcommand(self, cmd, function, helpmsg):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
48 if not self.cmdlist.has_key(cmd) and not self.shortcmdlist.has_key(cmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
49 self.cmdlist[cmd] = {}
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
50 self.cmdlist[cmd]['function'] = function
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
51 self.cmdlist[cmd]['help'] = helpmsg
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
52
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
53 def addshortcmd(self, shortcmd, longcmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
54 if not self.shortcmdlist.has_key(shortcmd) and not self.cmdlist.has_key(shortcmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
55 self.shortcmdlist[shortcmd] = longcmd
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
56
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
57 def removecmd(self, cmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
58 if self.cmdlist.has_key(cmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
59 del self.cmdlist[cmd]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
60 elif self.shortcmdlist.has_key(cmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
61 del self.shortcmdlist[cmd]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
62
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
63 def defaultcmds(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
64 self.addcommand('/help', self.on_help, '- Displays this help message')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
65 self.addcommand('/version', self.on_version, ' - Displays current version of OpenRPG.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
66 self.addcommand('/me', self.chat.emote_message, ' - Alias for **yourname does something.**')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
67 self.addcommand('/ignore', self.on_ignore, '[player_id,player_id,... | ignored_ip,ignored_ip,... | list] - Toggle ignore for user associated with that player ID. Using the IP will remove only not toggle.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
68 self.addcommand('/load', self.on_load, 'filename - Loads settings from another ini file from the myfiles directory.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
69 self.addcommand('/role', self.on_role, '[player_id = GM | Player | Lurker] - Get player roles from ther server, self.or change the role of a player.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
70 self.addcommand('/font', self.on_font, 'fontname - Sets the font.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
71 self.addcommand('/fontsize', self.on_fontsize, 'size - Sets the size of your fonts. Recomended 8 or better for the size.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
72 self.addcommand('/close', self.on_close, 'Close the chat tab')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
73 self.addcommand('/set', self.on_set, '[setting[=value]] - Displays one or all settings, self.or sets a setting.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
74 self.addcommand('/whisper', self.on_whisper, 'player_id_number, ... = message - Whisper to player(s). Can contain multiple IDs.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
75 self.addcommand('/gw', self.on_groupwhisper, 'group_name=message - Type /gw help for more information')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
76 self.addcommand('/gm', self.on_gmwhisper, 'message - Whispers to all GMs in the room')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
77 self.addcommand('/name', self.on_name, 'name - Change your name.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
78 self.addcommand('/time', self.on_time, '- Display the local and GMT time and date.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
79 self.addcommand('/status', self.on_status, 'your_status - Set your online status (afk,away,etc..).')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
80 self.addcommand('/dieroller', self.on_dieroller, '- Set your dieroller or list the available rollers.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
81 self.addcommand('/log', self.on_log, '[ on | off | to <em>filename</em> ] - Check log state, additionally turn logging on, self.off, self.or set the log filename prefix.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
82 self.addcommand('/update', self.on_update, '[get] - Get the latest version of OpenRPG.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
83 self.addcommand('/moderate', self.on_moderate, '[ on | off ][player_id=on|off] - Show who can speak in a moderated room, self.or turn room moderation on or off.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
84 self.addcommand('/tab', self.invoke_tab, 'player_id - Creates a tab so you can whisper rolls to youror what ever')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
85 self.addcommand('/ping', self.on_ping, '- Ask for a response from the server.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
86 self.addcommand('/admin', self.on_remote_admin, '- Remote admin commands')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
87 self.addcommand('/description', self.on_description, 'message - Creates a block of text, used for room descriptions and such')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
88 self.addcommand('/sound', self.on_sound, 'Sound_URL - Plays a sound for all clients in the room.')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
89 self.addcommand('/purge', self.on_purge, 'This will clear the entire chat window')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
90 self.addcommand('/advfilter', self.on_filter, 'This will toggle the Advanced Filter')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
91
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
92 def defaultcmdalias(self):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
93 self.addshortcmd('/?', '/help')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
94 self.addshortcmd('/he', '/me')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
95 self.addshortcmd('/she', '/me')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
96 self.addshortcmd('/i', '/ignore')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
97 self.addshortcmd('/w', '/whisper')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
98 self.addshortcmd('/nick', '/name')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
99 self.addshortcmd('/date', '/time')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
100 self.addshortcmd('/desc', '/description')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
101 self.addshortcmd('/d', '/description')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
102 self.addshortcmd('/sleep', '/me falls asleep')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
103
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
104 def docmd(self,text):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
105 cmdsearch = string.split(text,None,1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
106 cmd = string.lower(cmdsearch[0])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
107 start = len(cmd)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
108 end = len(text)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
109 cmdargs = text[start+1:end]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
110 if self.cmdlist.has_key(cmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
111 self.cmdlist[cmd]['function'](cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
112 elif self.shortcmdlist.has_key(cmd):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
113 self.docmd(self.shortcmdlist[cmd] + " " + cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
114 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
115 msg = "Sorry I don't know what %s is!" % (cmd)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
116 self.chat.InfoPost(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
117
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
118 def on_filter(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
119 test = not self.chat.advancedFilter
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
120 for tab in self.chat.parent.whisper_tabs:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
121 tab.advancedFilter = not self.chat.advancedFilter
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
122 for tab in self.chat.parent.null_tabs:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
123 tab.advancedFilter = not self.chat.advancedFilter
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
124 for tab in self.chat.parent.group_tabs:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
125 tab.advancedFilter = not self.chat.advancedFilter
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
126 if self.chat.parent.GMChatPanel != None:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
127 self.chat.parent.GMChatPanel.advancedFilter = not self.chat.advancedFilter
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
128 self.chat.advancedFilter = not self.chat.advancedFilter
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
129 if self.chat.advancedFilter:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
130 self.chat.InfoPost("Advanced Filtering has been turned On")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
131 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
132 self.chat.InfoPost("Advanced Filtering has been turned Off")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
133
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
134 def on_purge(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
135 self.chat.PurgeChat()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
136 self.chat.InfoPost('Chat Buffer has been Purged!')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
137
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
138 def on_sound(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
139 if len(cmdargs) < 8:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
140 self.chat.InfoPost("You must provide a URL for the file name, it does not work for just local sound files")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
141 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
142 args = string.split(cmdargs, None, -1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
143
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
144 if args[0] == 'loop':
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
145 snd = args[1].replace('&', '&amp;')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
146 loop = '1'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
147 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
148 snd = cmdargs.replace('&', '&amp;')
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
149 loop = ''
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
150 type = 'remote'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
151 (name, ip, id, text_status, version, protocol_version, client_string, role) = self.session.get_my_info()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
152 group_id = self.session.group_id
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
153 if (role != 'Lurker' and group_id != '0') or self.session.get_status() != 1:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
154 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
155 self.chat.sound_player.play(snd, type, loop)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
156 if type == 'remote':
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
157 snd_xml = '<sound url="' + snd + '" group_id="' + group_id + '" from="' + id + '" loop="' + str(loop) + '" />'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
158 self.session.send_sound(snd_xml)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
159 except Exception, e:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
160 print e
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
161 self.chat.InfoPost("Invalid sound file!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
162 elif role == 'Lurker':
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
163 self.chat.InfoPost("You must be a player or a GM to send a sound file!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
164 elif group_id == '0':
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
165 self.chat.InfoPost("You cannot send sound files to the lobby!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
166 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
167 self.chat.InfoPost("Something dun fuckered up Frank!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
168
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
169 def on_version(self, cmdargs=""):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
170 self.chat.InfoPost("Version is OpenRPG " + self.chat.version)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
171
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
172 def on_load(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
173 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
174 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
175 self.settings.setup_ini(args[0])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
176 self.settings.reload_settings(self.chat)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
177 self.chat.InfoPost("Settings Loaded from file " + args[0] )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
178 except Exception,e:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
179 print e
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
180 self.chat.InfoPost("ERROR Loading settings")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
181
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
182 def on_font(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
183 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
184 fontsettings = self.chat.set_default_font(fontname=cmdargs, fontsize=None)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
185 except:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
186 self.chat.InfoPost("ERROR setting default font")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
187
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
188 def on_fontsize(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
189 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
190 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
191 fontsettings = self.chat.set_default_font(fontname=None, fontsize=int(args[0]))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
192 except Exception, e:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
193 print e
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
194 self.chat.InfoPost("ERROR setting default font size")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
195
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
196 def on_close(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
197 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
198 chatpanel = self.chat
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
199 if (chatpanel.sendtarget == "all"):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
200 chatpanel.InfoPost("Error: cannot close public chat tab.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
201 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
202 chatpanel.chat_timer.Stop()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
203 chatpanel.parent.onCloseTab(0)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
204 except:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
205 self.chat.InfoPost("Error: cannot close private chat tab.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
206
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
207 def on_time(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
208 local_time = time.localtime()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
209 gmt_time = time.gmtime()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
210 format_string = "%A %b %d, %Y %I:%M:%S%p"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
211 self.chat.InfoPost("<br />Local: " + time.strftime(format_string)+\
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
212 "<br />GMT: "+time.strftime(format_string,gmt_time))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
213
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
214 def on_dieroller(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
215 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
216 rm = component.get('DiceManager')
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
217 cur_die = rm.getRoller()
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
218 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
219 rm.setRoller(args[0])
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
220 self.chat.SystemPost('You have changed your die roller to the <b>"' +rm.getRoller()+ '"</b> roller.')
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
221 self.settings.change('dieroller', rm.getRoller())
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
222 except Exception, e:
195
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
223 rm.setRoller(cur_die)
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
224 self.settings.change('dieroller', str(cur_die))
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
225 if args[0] != '': self.chat.SystemPost(args[0]+ ' is an invalid roller.')
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
226 self.chat.InfoPost('Available die rollers: ' +str(rm.listRollers()) )
b633f4c64aae Traipse Alpha 'OpenRPG' {100219-00}
sirebral
parents: 155
diff changeset
227 self.chat.InfoPost('You are using the <b>"' +cur_die+ '"</b> die roller.')
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
228
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
229 def on_ping(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
230 ct = time.clock()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
231 msg = "<ping player='"+self.session.id+"' time='"+str(ct)+"' />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
232 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
233
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
234 def on_log(self,cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
235 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
236 logfile = self.settings.get_setting( 'GameLogPrefix' )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
237 if len( args ) == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
238 self.postLoggingState()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
239 elif args[0] == "on" and logfile != '':
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
240 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
241 while logfile[ 0 ] == ANTI_LOG_CHAR:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
242 #print logfile
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
243 logfile = logfile[ 1: ]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
244 except IndexError,e:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
245 self.chat.SystemPost("log filename is blank, system will *not* be logging until a valid filename is specified" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
246 self.settings.set_setting( 'GameLogPrefix', logfile )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
247 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
248 self.settings.set_setting( 'GameLogPrefix', logfile )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
249 self.postLoggingState()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
250 elif args[0] == "off":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
251 logfile = ANTI_LOG_CHAR+logfile
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
252 self.settings.set_setting( 'GameLogPrefix', logfile )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
253 self.postLoggingState()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
254 elif args[0] == "to":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
255 if len( args ) > 1:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
256 logfile = args[1]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
257 self.settings.set_setting( 'GameLogPrefix', logfile )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
258 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
259 self.chat.SystemPost('You must also specify a filename with the <em>/log to</em> command.' )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
260 self.postLoggingState()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
261 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
262 self.chat.InfoPost("Unknown logging command, use 'on' or 'off'" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
263
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
264 def postLoggingState( self ):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
265 logfile = self.settings.get_setting( 'GameLogPrefix' )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
266 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
267 if logfile[0] != ANTI_LOG_CHAR: comment = 'is'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
268 else: comment = 'is not'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
269 except: comment = 'is not'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
270 suffix = time.strftime( '-%d-%m-%y.html', time.localtime( time.time() ) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
271 self.chat.InfoPost('Log filename is "%s%s", system is %s logging.' % (logfile, suffix, comment) )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
272
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
273 def on_name(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
274 if cmdargs == "":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
275 self.chat.InfoPost("**Incorrect syntax for name.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
276 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
277 self.settings.set_setting('player', cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
278 self.session.set_name(str(cmdargs))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
279
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
280 def on_status(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
281 if cmdargs == "":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
282 self.chat.InfoPost("Incorrect synatx for status.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
283 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
284 txt = cmdargs[:20]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
285 self.session.set_text_status(str(txt))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
286
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
287 def on_set(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
288 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
289 keys = self.settings.get_setting_keys()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
290 if len(args) == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
291 line = "<table border='2'>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
292 for m in keys:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
293 line += "<tr><td>" + str(m) + "</td><td> " + str(self.settings.get_setting(m)) + "</td></tr>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
294 line += "</table>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
295 self.chat.InfoPost(line)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
296 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
297 split_name_from_data = cmdargs.find("=")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
298 if split_name_from_data == -1:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
299 for m in keys:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
300 if m == args[0]:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
301 return_string = "<table border='2'><tr><td>" + args[0] + "</td><td>"\
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
302 + self.settings.get_setting(args[0]) + "</td></tr></table>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
303 self.chat.InfoPost(return_string)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
304 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
305 name = cmdargs[:split_name_from_data].strip()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
306 for m in keys:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
307 if m == name:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
308 setting = cmdargs[split_name_from_data+1:].strip()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
309 self.settings.set_setting(name,setting)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
310 return_string = name + " changed to " + setting
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
311 self.chat.InfoPost(return_string)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
312 self.session.set_name(self.settings.get_setting("player"))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
313 self.chat.set_colors()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
314 self.chat.set_buffersize()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
315
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
316 def on_help(self, cmdargs=""):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
317 cmds = self.cmdlist.keys()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
318 cmds.sort()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
319 shortcmds = self.shortcmdlist.keys()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
320 shortcmds.sort()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
321 msg = '<br /><b>Command Alias List:</b>'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
322 for shortcmd in shortcmds:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
323 msg += '<br /><b><font color="#0000CC">%s</font></b> is short for <font color="#000000">%s</font>' % (shortcmd, self.shortcmdlist[shortcmd])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
324 msg += '<br /><br /><b>Command List:</b>'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
325 for cmd in cmds:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
326 msg += '<br /><b><font color="#000000">%s</font></b>' % (cmd)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
327 for shortcmd in shortcmds:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
328 if self.shortcmdlist[shortcmd] == cmd:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
329 msg += ', <b><font color="#0000CC">%s</font></b>' % (shortcmd)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
330 msg += ' %s' % (self.cmdlist[cmd]['help'])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
331 self.chat.InfoPost(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
332
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
333 def on_ignore(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
334 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
335 (ignore_list, ignore_name) = self.session.get_ignore_list()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
336 ignore_output = self.colorize(self.chat.syscolor,"<br /><u>Player IDs Currently being Ignored:</u><br />")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
337 if cmdargs == "":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
338 if len(ignore_list) == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
339 ignore_output += self.colorize(self.chat.infocolor,"No players are currently being ignored.<br />")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
340 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
341 for m in ignore_list:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
342 ignore_txt = m + " " + ignore_name[ignore_list.index(m)] + "<br />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
343 ignore_output += self.colorize(self.chat.infocolor,ignore_txt)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
344 self.chat.Post(ignore_output)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
345 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
346 players = cmdargs.split(",")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
347 for m in players:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
348 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
349 id = `int(m)`
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
350 (result, id, name) = self.session.toggle_ignore(id)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
351 if result == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
352 self.chat.InfoPost("Player " + name + " with ID:" + id + " no longer ignored")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
353 if result == 1:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
354 self.chat.InfoPost("Player " + name + " with ID:" + id + " now being ignored")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
355 except:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
356 self.chat.InfoPost(m + " was ignored because it is an invalid player ID")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
357 traceback.print_exc()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
358
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
359 def on_role(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
360 if cmdargs == "":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
361 self.session.display_roles()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
362 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
363 delim = cmdargs.find("=")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
364 if delim < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
365 self.chat.InfoPost("**Incorrect synatax for Role." + str(delim))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
366 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
367 player_ids = string.split(cmdargs[:delim],",")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
368 role = cmdargs[delim+1:].strip()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
369 role = role.lower()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
370 if (role.lower() == "player") or (role.lower() == "gm") or (role.lower() == "lurker"):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
371 if role.lower() == "player": role = "Player"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
372 elif role.lower() == "gm": role = "GM"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
373 else: role = "Lurker"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
374 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
375 role_pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
376 if role_pwd != None:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
377 for m in player_ids:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
378 self.session.set_role(m.strip(),role,role_pwd)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
379 except: traceback.print_exc()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
380
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
381 def on_whisper(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
382 delim = cmdargs.find("=")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
383
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
384 if delim < 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
385 if self.previous_whisper: player_ids = self.previous_whisper
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
386 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
387 self.chat.InfoPost("**Incorrect syntax for whisper." + str(delim))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
388 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
389 else: player_ids = string.split(cmdargs[:delim], ",")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
390 self.previous_whisper = player_ids
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
391 mesg = string.strip(cmdargs[delim+1:])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
392 self.chat.whisper_to_players(mesg,player_ids)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
393
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
394 def on_groupwhisper(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
395 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
396 delim = cmdargs.find("=")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
397
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
398 if delim > 0: group_ids = string.split(cmdargs[:delim], ",")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
399 elif args[0] == "add":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
400 if not orpg.player_list.WG_LIST.has_key(args[2]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
401 orpg.player_list.WG_LIST[args[2]] = {}
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
402 orpg.player_list.WG_LIST[args[2]][int(args[1])] = int(args[1])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
403 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
404 elif args[0] == "remove" or args[0] == "delete":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
405 del orpg.player_list.WG_LIST[args[2]][int(args[1])]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
406 if len(orpg.player_list.WG_LIST[args[2]]) == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
407 del orpg.player_list.WG_LIST[args[2]]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
408 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
409 elif args[0] == "create" or args[0] == "new_group":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
410 if not orpg.player_list.WG_LIST.has_key(args[1]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
411 orpg.player_list.WG_LIST[args[1]] = {}
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
412 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
413 elif args[0] == "list":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
414 if orpg.player_list.WG_LIST.has_key(args[1]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
415 for n in orpg.player_list.WG_LIST[args[1]]:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
416 player = self.session.get_player_info(str(n))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
417 self.chat.InfoPost(str(player[0]))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
418 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
419 self.chat.InfoPost("Invalid Whisper Group Name")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
420 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
421 elif args[0] == "clear":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
422 if orpg.player_list.WG_LIST.has_key(args[1]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
423 orpg.player_list.WG_LIST[args[1]].clear()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
424 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
425 self.chat.InfoPost("Invalid Whisper Group Name")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
426 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
427 elif args[0] == "clearall":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
428 orpg.player_list.WG_LIST.clear()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
429 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
430 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
431 self.chat.InfoPost("<b>/gw add</b> (player_id) (group_name) - Adds [player_id] to [group_name]")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
432 self.chat.InfoPost("<b>/gw remove</b> (player_id) (group_name) - Removes [player_id] from [group_name]")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
433 self.chat.InfoPost("<b>/gw</b> (group_name)<b>=</b>(message) - Sends [message] to [group_name]")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
434 self.chat.InfoPost("<b>/gw create</b> (group_name) - Creates a whisper group called [group_name]")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
435 self.chat.InfoPost("<b>/gw list</b> (group_name) - Lists all players in [group_name]")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
436 self.chat.InfoPost("<b>/gw clear</b> (group_name) - Removes all players from [group_name]")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
437 self.chat.InfoPost("<b>/gw clearall</b> - Removes all existing whisper groups")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
438 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
439 msg = string.strip(cmdargs[delim+1:])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
440 for gid in group_ids:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
441 idList = ""
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
442 for n in orpg.player_list.WG_LIST[gid]:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
443 if idList == "": idList = str(n)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
444 else: idList = str(n) + ", " + idList
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
445 self.on_whisper(idList + "=" + self.settings.get_setting("gwtext") + msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
446
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
447 def on_gmwhisper(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
448 if cmdargs == "":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
449 self.chat.InfoPost("**Incorrect syntax for GM Whisper.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
450 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
451 the_gms = self.chat.get_gms()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
452 if len(the_gms):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
453 gmstring = ""
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
454 for each_gm in the_gms:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
455 if gmstring != "": gmstring += ","
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
456 gmstring += each_gm
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
457 self.on_whisper(gmstring + "=" + cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
458 else: self.chat.InfoPost("**No GMs to Whisper to.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
459
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
460 def on_moderate(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
461 if cmdargs != "":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
462 pos = cmdargs.find("=")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
463 if (pos < 0):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
464 plist = ""
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
465 if cmdargs.lower() == "on": action = "enable"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
466 elif cmdargs.lower() == "off": action="disable"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
467 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
468 self.chat.InfoPost("Wrong syntax for moderate command!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
469 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
470 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
471 plist = string.strip(cmdargs[:pos])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
472 tag = string.strip(cmdargs[pos+1:])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
473 if tag.lower() == "on": action = "addvoice"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
474 elif tag.lower() == "off": action = "delvoice"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
475 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
476 self.chat.InfoPost("Wrong syntax for moderate command!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
477 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
478 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
479 if pwd != None:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
480 msg = "<moderate"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
481 msg += " action = '" + action + "'"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
482 msg +=" from = '" + self.session.id + "' pwd='" + pwd + "'"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
483 if (plist != ""): msg += " users='"+plist+"'"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
484 msg += " />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
485 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
486 pass
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
487 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
488 msg = "<moderate action='list' from='"+self.session.id+"' />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
489 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
490 self.session.update()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
491
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
492 def on_update(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
493 self.chat.InfoPost("This command is no longer valid")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
494
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
495 def on_description(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
496 if len(cmdargs) <= 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
497 self.chat.InfoPost("**No description text to display." + str(delim))
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
498 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
499 mesg = "<table bgcolor='#c0c0c0' border='3' cellpadding='5' cellspacing='0' width='100%'><tr><td><font color='#000000'>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
500 mesg += string.strip(cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
501 mesg += "</font></td></tr></table>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
502 self.chat.Post(mesg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
503 self.chat.send_chat_message(mesg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
504
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
505 def invoke_tab(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
506 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
507 int(cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
508 playerid = cmdargs.strip()
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
509 for panel in self.chat.parent.whisper_tabs:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
510 if (panel.sendtarget == playerid):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
511 self.chat.Post("Cannot invoke tab: Tab already exists.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
512 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
513 try: displaypanel = self.chat.parent.create_whisper_tab(playerid)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
514 except:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
515 self.chat.Post("That ID# is not valid.")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
516 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
517 nidx = self.chat.parent.get_tab_index(displaypanel)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
518 self.chat.parent.newMsg(nidx)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
519 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
520 except:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
521 displaypanel = self.chat.parent.create_null_tab(cmdargs)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
522 nidx = self.chat.parent.get_tab_index(displaypanel)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
523 self.chat.parent.newMsg(nidx)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
524 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
525
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
526 def on_remote_admin(self, cmdargs):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
527 args = string.split(cmdargs,None,-1)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
528 try:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
529 pass_state = 0
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
530 pwd = self.session.orpgFrame_callback.password_manager.GetSilentPassword("server")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
531 if pwd != None:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
532 pass_state = 1
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
533 else: pwd = "<i>[NONE]</i>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
534 if len( args ) == 0:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
535 msg = "<br /><b>Remote Administrator Config:</b>"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
536 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
537 else: msg += " Enabled. Using password '"+pwd+"'<br />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
538 self.chat.SystemPost(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
539 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
540 if pass_state != 1 and args[0] != "set":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
541 self.chat.SystemPost("Command ignored. No remote administrator password set!!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
542 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
543 msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
544 if args[0] == "set":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
545 if len( args ) > 1:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
546 self.session.orpgFrame_callback.password_manager.server = str( args[1] )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
547 self.chat.SystemPost( "Remote administration commands using password: "+str(self.session.orpgFrame_callback.password_manager.GetSilentPassword("server"))+"" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
548 else:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
549 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("server")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
550 if pwd != None:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
551 self.chat.SystemPost( "Remote administration commands using password: "+pwd+"" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
552 elif len(args) == 1:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
553 admin_command = {'banlist': ' cmd="banlist" />',
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
554 'help': " cmd='help' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
555 'roompasswords': " cmd='roompasswords' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
556 'uptime': " cmd='uptime' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
557 'list': " cmd='list' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
558 'killserver': " cmd='killserver' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
559 'savemaps': ' cmd="savemaps" />'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
560 }
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
561 if admin_command.has_key(args[0]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
562 msg = msgbase + admin_command[args[0]]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
563 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
564
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
565 elif len(args) == 2:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
566 admin_command = {'ban': ' cmd="ban" bid="' + str(args[1]) + '" />',
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
567 'unban': ' cmd="unban" ip="' + str(args[1]) + '" />',
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
568 'broadcast': " cmd='broadcast' msg='"+ string.join(args[1:])+"' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
569 'killgroup': " cmd='killgroup' gid='"+ str(args[1])+"' />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
570 }
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
571 if admin_command.has_key(args[0]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
572 msg = msgbase + admin_command[args[0]]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
573 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
574
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
575 elif len(args) == 3:
133
37d26a98883f Traipse Alpha 'OpenRPG' {091010-00}
sirebral
parents: 128
diff changeset
576 admin_command = {'message':" cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />",
155
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
577 'nameroom': " cmd='nameroom' rmid='"+ str(args[1])+"' name='"+ string.join(args[2:])+"' />",
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
578 'passwd': " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
579 }
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
580 if admin_command.has_key(args[0]):
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
581 msg = msgbase + admin_command[args[0]]
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
582 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
583
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
584 elif args[0] == "banip":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
585 try: bname = str(args[2])
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
586 except: bname = 'Unknown'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
587 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>'
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
588 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
589
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
590 elif args[0] == "createroom":
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
591 if len(args) < 2:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
592 self.chat.SystemPost( "You must supply a name and boot password at least. <br />/admin createroom &lt;name&gt; &lt;boot password&gt; [password]" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
593 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
594 if len(args) < 3:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
595 self.chat.SystemPost( "You must supply a boot password also.<br />/admin createroom &lt;name&gt; &lt;boot password&gt; [password]" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
596 return
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
597 if len(args) < 4: args.append("")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
598 msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />"
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
599 self.session.outbox.put(msg)
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
600
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
601 else: self.chat.InfoPost("Unknown administrator command" )
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
602 except:
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
603 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!")
bf799efe7a8a Traipse Alpha 'OpenRPG' {091125-02}
sirebral
parents: 133
diff changeset
604 traceback.print_exc()