Mercurial > traipse_dev
comparison orpg/chat/commands.py @ 184:dcae32e219f1 beta
Traipse Beta 'OpenRPG' {100117-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 (Beta)
New Features:
Added Bookmarks
Added 'boot' command to remote admin
Added confirmation window for sent nodes
Minor changes to allow for portability to an OpenSUSE linux OS
Miniatures Layer pop up box allows users to turn off Mini labels, from
FlexiRPG
Zoom Mouse plugin added
Images added to Plugin UI
Switching to Element Tree
Map efficiency, from FlexiRPG
Added Status Bar to Update Manager
New TrueDebug Class in orpg_log (See documentation for usage)
Portable Mercurial
Tip of the Day added, from Core and community
New Reference Syntax added for custom PC sheets
New Child Reference for gametree
New Parent Reference for gametree
New Gametree Recursion method, mapping, context sensitivity, and
effeciency..
New Features node with bonus nodes and Node Referencing help added
Dieroller structure from Core
New DieRoller portability for odd Dice
Added 7th Sea die roller; ie [7k3] = [7d10.takeHighest(3).open(10)]
New 'Mythos' System die roller added
Added new vs. die roller method for WoD; ie [3v3] = [3d10.vs(3)].
Included for Mythos roller also
New Warhammer FRPG Die Roller (Special thanks to Puu-san for the
support)
New EZ_Tree Reference system. Push a button, Traipse the tree, get a
reference (Beta!)
Fixes:
Fix to Text based Server
Fix to Remote Admin Commands
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
Fix to Map from gametree not showing to all clients
Fix to gametree about menus
Fix to Password Manager check on startup
Fix to PC Sheets from tool nodes. They now use the tabber_panel
Fix to Whiteboard ID to prevent random line or text deleting.
Fixes to Server, Remote Server, and Server GUI
Fix to Update Manager; cleaner clode for saved repositories
Fixes made to Settings Panel and now reactive settings when Ok is
pressed
Fixes to Alternity roller's attack roll. Uses a simple Tuple instead of
a Splice
Fix to Use panel of Forms and Tabbers. Now longer enters design mode
Fix made Image Fetching. New fetching image and new failed image
Modified ID's to prevent non updated clients from ruining the fix.
default_manifest.xml renamed to default_upmana.xml
author | sirebral |
---|---|
date | Sun, 17 Jan 2010 21:37:34 -0600 |
parents | 3b6888bb53b5 |
children | 13054be69834 |
comparison
equal
deleted
inserted
replaced
183:0d9b746b5751 | 184:dcae32e219f1 |
---|---|
5 # docmd(self,text) | 5 # docmd(self,text) |
6 # on_help(self) | 6 # on_help(self) |
7 # on_whisper(self,text) | 7 # on_whisper(self,text) |
8 # | 8 # |
9 | 9 |
10 | |
11 import string, time | 10 import string, time |
12 import orpg.orpg_version | 11 import orpg.orpg_version |
13 import orpg.orpg_windows | 12 import orpg.orpg_windows |
14 import traceback | 13 import traceback |
15 | 14 |
24 ## cmd_ext.py should NOT be included in the CVS or Actual Releases | 23 ## cmd_ext.py should NOT be included in the CVS or Actual Releases |
25 | 24 |
26 try: | 25 try: |
27 import cmd_ext | 26 import cmd_ext |
28 print "Importing Developer Extended Command Set" | 27 print "Importing Developer Extended Command Set" |
29 except: | 28 except: pass |
30 pass | |
31 ##---------------------------------------------------------------- | 29 ##---------------------------------------------------------------- |
32 | 30 |
33 ANTI_LOG_CHAR = '!' | 31 ANTI_LOG_CHAR = '!' |
34 | 32 |
35 class chat_commands: | 33 class chat_commands: |
36 | 34 |
37 # Initialization subroutine. | |
38 # | |
39 # !self : instance of self | |
40 # !chat : instance of the chat window to write to | |
41 | |
42 def __init__(self,chat): | 35 def __init__(self,chat): |
43 self.post = chat.Post | 36 self.post = chat.Post |
44 self.colorize = chat.colorize | 37 self.colorize = chat.colorize |
45 self.session = chat.session | 38 self.session = chat.session |
46 #self.send = chat.session.send | |
47 self.settings = chat.settings | 39 self.settings = chat.settings |
48 self.chat = chat | 40 self.chat = chat |
49 self.cmdlist = {} | 41 self.cmdlist = {} |
50 self.shortcmdlist = {} | 42 self.shortcmdlist = {} |
51 self.defaultcmds() | 43 self.defaultcmds() |
52 self.defaultcmdalias() | 44 self.defaultcmdalias() |
53 # def __init__ - end | |
54 self.previous_whisper = [] | 45 self.previous_whisper = [] |
55 | 46 |
56 | |
57 # This subroutine will take a text string and attempt to match to a series | |
58 # of implemented emotions. | |
59 # | |
60 # !self : instance of self | |
61 # !text : string of text matching an implemented emotion | |
62 | |
63 def addcommand(self, cmd, function, helpmsg): | 47 def addcommand(self, cmd, function, helpmsg): |
64 if not self.cmdlist.has_key(cmd) and not self.shortcmdlist.has_key(cmd): | 48 if not self.cmdlist.has_key(cmd) and not self.shortcmdlist.has_key(cmd): |
65 self.cmdlist[cmd] = {} | 49 self.cmdlist[cmd] = {} |
66 self.cmdlist[cmd]['function'] = function | 50 self.cmdlist[cmd]['function'] = function |
67 self.cmdlist[cmd]['help'] = helpmsg | 51 self.cmdlist[cmd]['help'] = helpmsg |
68 #print 'Command Added: ' + cmd | 52 |
69 | |
70 | |
71 def addshortcmd(self, shortcmd, longcmd): | 53 def addshortcmd(self, shortcmd, longcmd): |
72 if not self.shortcmdlist.has_key(shortcmd) and not self.cmdlist.has_key(shortcmd): | 54 if not self.shortcmdlist.has_key(shortcmd) and not self.cmdlist.has_key(shortcmd): |
73 self.shortcmdlist[shortcmd] = longcmd | 55 self.shortcmdlist[shortcmd] = longcmd |
74 | 56 |
75 | |
76 def removecmd(self, cmd): | 57 def removecmd(self, cmd): |
77 if self.cmdlist.has_key(cmd): | 58 if self.cmdlist.has_key(cmd): |
78 del self.cmdlist[cmd] | 59 del self.cmdlist[cmd] |
79 elif self.shortcmdlist.has_key(cmd): | 60 elif self.shortcmdlist.has_key(cmd): |
80 del self.shortcmdlist[cmd] | 61 del self.shortcmdlist[cmd] |
81 | 62 |
82 #print 'Command Removed: ' + cmd | |
83 | |
84 | |
85 | |
86 def defaultcmds(self): | 63 def defaultcmds(self): |
87 self.addcommand('/help', self.on_help, '- Displays this help message') | 64 self.addcommand('/help', self.on_help, '- Displays this help message') |
88 self.addcommand('/version', self.on_version, ' - Displays current version of OpenRPG.') | 65 self.addcommand('/version', self.on_version, ' - Displays current version of OpenRPG.') |
89 self.addcommand('/me', self.chat.emote_message, ' - Alias for **yourname does something.**') | 66 self.addcommand('/me', self.chat.emote_message, ' - Alias for **yourname does something.**') |
90 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.') | 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.') |
110 self.addcommand('/description', self.on_description, 'message - Creates a block of text, used for room descriptions and such') | 87 self.addcommand('/description', self.on_description, 'message - Creates a block of text, used for room descriptions and such') |
111 self.addcommand('/sound', self.on_sound, 'Sound_URL - Plays a sound for all clients in the room.') | 88 self.addcommand('/sound', self.on_sound, 'Sound_URL - Plays a sound for all clients in the room.') |
112 self.addcommand('/purge', self.on_purge, 'This will clear the entire chat window') | 89 self.addcommand('/purge', self.on_purge, 'This will clear the entire chat window') |
113 self.addcommand('/advfilter', self.on_filter, 'This will toggle the Advanced Filter') | 90 self.addcommand('/advfilter', self.on_filter, 'This will toggle the Advanced Filter') |
114 | 91 |
115 | |
116 def defaultcmdalias(self): | 92 def defaultcmdalias(self): |
117 self.addshortcmd('/?', '/help') | 93 self.addshortcmd('/?', '/help') |
118 self.addshortcmd('/he', '/me') | 94 self.addshortcmd('/he', '/me') |
119 self.addshortcmd('/she', '/me') | 95 self.addshortcmd('/she', '/me') |
120 self.addshortcmd('/i', '/ignore') | 96 self.addshortcmd('/i', '/ignore') |
121 self.addshortcmd('/w', '/whisper') | 97 self.addshortcmd('/w', '/whisper') |
122 self.addshortcmd('/nick', '/name') | 98 self.addshortcmd('/nick', '/name') |
123 self.addshortcmd('/date', '/time') | 99 self.addshortcmd('/date', '/time') |
124 self.addshortcmd('/desc', '/description') | 100 self.addshortcmd('/desc', '/description') |
125 self.addshortcmd('/d', '/description') | 101 self.addshortcmd('/d', '/description') |
126 | |
127 #This is just an example or a differant way the shorcmd can be used | |
128 self.addshortcmd('/sleep', '/me falls asleep') | 102 self.addshortcmd('/sleep', '/me falls asleep') |
129 | 103 |
130 | |
131 def docmd(self,text): | 104 def docmd(self,text): |
132 cmdsearch = string.split(text,None,1) | 105 cmdsearch = string.split(text,None,1) |
133 cmd = string.lower(cmdsearch[0]) | 106 cmd = string.lower(cmdsearch[0]) |
134 start = len(cmd) | 107 start = len(cmd) |
135 end = len(text) | 108 end = len(text) |
136 cmdargs = text[start+1:end] | 109 cmdargs = text[start+1:end] |
137 | |
138 if self.cmdlist.has_key(cmd): | 110 if self.cmdlist.has_key(cmd): |
139 self.cmdlist[cmd]['function'](cmdargs) | 111 self.cmdlist[cmd]['function'](cmdargs) |
140 elif self.shortcmdlist.has_key(cmd): | 112 elif self.shortcmdlist.has_key(cmd): |
141 self.docmd(self.shortcmdlist[cmd] + " " + cmdargs) | 113 self.docmd(self.shortcmdlist[cmd] + " " + cmdargs) |
142 else: | 114 else: |
143 msg = "Sorry I don't know what %s is!" % (cmd) | 115 msg = "Sorry I don't know what %s is!" % (cmd) |
144 self.chat.InfoPost(msg) | 116 self.chat.InfoPost(msg) |
145 | 117 |
146 | |
147 def on_filter(self, cmdargs): | 118 def on_filter(self, cmdargs): |
148 #print self.chat.advancedFilter | |
149 test = not self.chat.advancedFilter | 119 test = not self.chat.advancedFilter |
150 #print test | |
151 | |
152 for tab in self.chat.parent.whisper_tabs: | 120 for tab in self.chat.parent.whisper_tabs: |
153 tab.advancedFilter = not self.chat.advancedFilter | 121 tab.advancedFilter = not self.chat.advancedFilter |
154 | |
155 for tab in self.chat.parent.null_tabs: | 122 for tab in self.chat.parent.null_tabs: |
156 tab.advancedFilter = not self.chat.advancedFilter | 123 tab.advancedFilter = not self.chat.advancedFilter |
157 | |
158 for tab in self.chat.parent.group_tabs: | 124 for tab in self.chat.parent.group_tabs: |
159 tab.advancedFilter = not self.chat.advancedFilter | 125 tab.advancedFilter = not self.chat.advancedFilter |
160 | |
161 if self.chat.parent.GMChatPanel != None: | 126 if self.chat.parent.GMChatPanel != None: |
162 self.chat.parent.GMChatPanel.advancedFilter = not self.chat.advancedFilter | 127 self.chat.parent.GMChatPanel.advancedFilter = not self.chat.advancedFilter |
163 | |
164 self.chat.advancedFilter = not self.chat.advancedFilter | 128 self.chat.advancedFilter = not self.chat.advancedFilter |
165 | |
166 if self.chat.advancedFilter: | 129 if self.chat.advancedFilter: |
167 self.chat.InfoPost("Advanced Filtering has been turned On") | 130 self.chat.InfoPost("Advanced Filtering has been turned On") |
168 else: | 131 else: |
169 self.chat.InfoPost("Advanced Filtering has been turned Off") | 132 self.chat.InfoPost("Advanced Filtering has been turned Off") |
170 | 133 |
171 | |
172 def on_purge(self, cmdargs): | 134 def on_purge(self, cmdargs): |
173 self.chat.PurgeChat() | 135 self.chat.PurgeChat() |
174 self.chat.InfoPost('Chat Buffer has been Purged!') | 136 self.chat.InfoPost('Chat Buffer has been Purged!') |
175 | 137 |
176 | |
177 def on_sound(self, cmdargs): | 138 def on_sound(self, cmdargs): |
178 if len(cmdargs) < 8: | 139 if len(cmdargs) < 8: |
179 self.chat.InfoPost("You must provide a URL for the file name, it does not work for just local sound files") | 140 self.chat.InfoPost("You must provide a URL for the file name, it does not work for just local sound files") |
180 return | 141 return |
181 args = string.split(cmdargs, None, -1) | 142 args = string.split(cmdargs, None, -1) |
184 snd = args[1].replace('&', '&') | 145 snd = args[1].replace('&', '&') |
185 loop = '1' | 146 loop = '1' |
186 else: | 147 else: |
187 snd = cmdargs.replace('&', '&') | 148 snd = cmdargs.replace('&', '&') |
188 loop = '' | 149 loop = '' |
189 | |
190 type = 'remote' | 150 type = 'remote' |
191 | |
192 (name, ip, id, text_status, version, protocol_version, client_string, role) = self.session.get_my_info() | 151 (name, ip, id, text_status, version, protocol_version, client_string, role) = self.session.get_my_info() |
193 group_id = self.session.group_id | 152 group_id = self.session.group_id |
194 if (role != 'Lurker' and group_id != '0') or self.session.get_status() != 1: | 153 if (role != 'Lurker' and group_id != '0') or self.session.get_status() != 1: |
195 try: | 154 try: |
196 self.chat.sound_player.play(snd, type, loop) | 155 self.chat.sound_player.play(snd, type, loop) |
205 elif group_id == '0': | 164 elif group_id == '0': |
206 self.chat.InfoPost("You cannot send sound files to the lobby!") | 165 self.chat.InfoPost("You cannot send sound files to the lobby!") |
207 else: | 166 else: |
208 self.chat.InfoPost("Something dun fuckered up Frank!") | 167 self.chat.InfoPost("Something dun fuckered up Frank!") |
209 | 168 |
210 | |
211 def on_version(self, cmdargs=""): | 169 def on_version(self, cmdargs=""): |
212 self.chat.InfoPost("Version is OpenRPG " + self.chat.version) | 170 self.chat.InfoPost("Version is OpenRPG " + self.chat.version) |
213 | 171 |
214 | |
215 def on_load(self, cmdargs): | 172 def on_load(self, cmdargs): |
216 args = string.split(cmdargs,None,-1) | 173 args = string.split(cmdargs,None,-1) |
217 try: | 174 try: |
218 self.settings.setup_ini(args[0]) | 175 self.settings.setup_ini(args[0]) |
219 self.settings.reload_settings(self.chat) | 176 self.settings.reload_settings(self.chat) |
220 self.chat.InfoPost("Settings Loaded from file " + args[0] ) | 177 self.chat.InfoPost("Settings Loaded from file " + args[0] ) |
221 except Exception,e: | 178 except Exception,e: |
222 print e | 179 print e |
223 self.chat.InfoPost("ERROR Loading settings") | 180 self.chat.InfoPost("ERROR Loading settings") |
224 | 181 |
225 | |
226 def on_font(self, cmdargs): | 182 def on_font(self, cmdargs): |
227 try: | 183 try: |
228 fontsettings = self.chat.set_default_font(fontname=cmdargs, fontsize=None) | 184 fontsettings = self.chat.set_default_font(fontname=cmdargs, fontsize=None) |
229 except: | 185 except: |
230 self.chat.InfoPost("ERROR setting default font") | 186 self.chat.InfoPost("ERROR setting default font") |
231 | 187 |
232 | |
233 def on_fontsize(self, cmdargs): | 188 def on_fontsize(self, cmdargs): |
234 args = string.split(cmdargs,None,-1) | 189 args = string.split(cmdargs,None,-1) |
235 try: | 190 try: |
236 fontsettings = self.chat.set_default_font(fontname=None, fontsize=int(args[0])) | 191 fontsettings = self.chat.set_default_font(fontname=None, fontsize=int(args[0])) |
237 except Exception, e: | 192 except Exception, e: |
238 print e | 193 print e |
239 self.chat.InfoPost("ERROR setting default font size") | 194 self.chat.InfoPost("ERROR setting default font size") |
240 | 195 |
241 | |
242 def on_close(self, cmdargs): | 196 def on_close(self, cmdargs): |
243 try: | 197 try: |
244 chatpanel = self.chat | 198 chatpanel = self.chat |
245 if (chatpanel.sendtarget == "all"): | 199 if (chatpanel.sendtarget == "all"): |
246 chatpanel.InfoPost("Error: cannot close public chat tab.") | 200 chatpanel.InfoPost("Error: cannot close public chat tab.") |
248 chatpanel.chat_timer.Stop() | 202 chatpanel.chat_timer.Stop() |
249 chatpanel.parent.onCloseTab(0) | 203 chatpanel.parent.onCloseTab(0) |
250 except: | 204 except: |
251 self.chat.InfoPost("Error: cannot close private chat tab.") | 205 self.chat.InfoPost("Error: cannot close private chat tab.") |
252 | 206 |
253 | |
254 def on_time(self, cmdargs): | 207 def on_time(self, cmdargs): |
255 local_time = time.localtime() | 208 local_time = time.localtime() |
256 gmt_time = time.gmtime() | 209 gmt_time = time.gmtime() |
257 format_string = "%A %b %d, %Y %I:%M:%S%p" | 210 format_string = "%A %b %d, %Y %I:%M:%S%p" |
258 self.chat.InfoPost("<br />Local: " + time.strftime(format_string)+\ | 211 self.chat.InfoPost("<br />Local: " + time.strftime(format_string)+\ |
259 "<br />GMT: "+time.strftime(format_string,gmt_time)) | 212 "<br />GMT: "+time.strftime(format_string,gmt_time)) |
260 | 213 |
261 | |
262 def on_dieroller(self, cmdargs): | 214 def on_dieroller(self, cmdargs): |
263 args = string.split(cmdargs,None,-1) | 215 args = string.split(cmdargs,None,-1) |
264 rm = component.get('DiceManager') | 216 rm = component.get('DiceManager') |
265 try: | 217 try: |
266 rm.setRoller(args[0]) | 218 rm.setRoller(args[0]) |
269 except Exception, e: | 221 except Exception, e: |
270 print e | 222 print e |
271 self.chat.InfoPost("Available die rollers: " + str(rm.listRollers())) | 223 self.chat.InfoPost("Available die rollers: " + str(rm.listRollers())) |
272 self.chat.InfoPost("You are using the <b>\"" + rm.getRoller() + "\"</b> die roller.") | 224 self.chat.InfoPost("You are using the <b>\"" + rm.getRoller() + "\"</b> die roller.") |
273 | 225 |
274 | |
275 def on_ping(self, cmdargs): | 226 def on_ping(self, cmdargs): |
276 ct = time.clock() | 227 ct = time.clock() |
277 msg = "<ping player='"+self.session.id+"' time='"+str(ct)+"' />" | 228 msg = "<ping player='"+self.session.id+"' time='"+str(ct)+"' />" |
278 self.session.outbox.put(msg) | 229 self.session.outbox.put(msg) |
279 | 230 |
280 | |
281 def on_log(self,cmdargs): | 231 def on_log(self,cmdargs): |
282 args = string.split(cmdargs,None,-1) | 232 args = string.split(cmdargs,None,-1) |
283 logfile = self.settings.get_setting( 'GameLogPrefix' ) | 233 logfile = self.settings.get_setting( 'GameLogPrefix' ) |
284 | |
285 if len( args ) == 0: | 234 if len( args ) == 0: |
286 self.postLoggingState() | 235 self.postLoggingState() |
287 elif args[0] == "on" and logfile != '': | 236 elif args[0] == "on" and logfile != '': |
288 try: | 237 try: |
289 while logfile[ 0 ] == ANTI_LOG_CHAR: | 238 while logfile[ 0 ] == ANTI_LOG_CHAR: |
307 self.chat.SystemPost('You must also specify a filename with the <em>/log to</em> command.' ) | 256 self.chat.SystemPost('You must also specify a filename with the <em>/log to</em> command.' ) |
308 self.postLoggingState() | 257 self.postLoggingState() |
309 else: | 258 else: |
310 self.chat.InfoPost("Unknown logging command, use 'on' or 'off'" ) | 259 self.chat.InfoPost("Unknown logging command, use 'on' or 'off'" ) |
311 | 260 |
312 | |
313 def postLoggingState( self ): | 261 def postLoggingState( self ): |
314 logfile = self.settings.get_setting( 'GameLogPrefix' ) | 262 logfile = self.settings.get_setting( 'GameLogPrefix' ) |
315 try: | 263 try: |
316 if logfile[0] != ANTI_LOG_CHAR: comment = 'is' | 264 if logfile[0] != ANTI_LOG_CHAR: comment = 'is' |
317 else: comment = 'is not' | 265 else: comment = 'is not' |
318 except: comment = 'is not' | 266 except: comment = 'is not' |
319 suffix = time.strftime( '-%d-%m-%y.html', time.localtime( time.time() ) ) | 267 suffix = time.strftime( '-%d-%m-%y.html', time.localtime( time.time() ) ) |
320 self.chat.InfoPost('Log filename is "%s%s", system is %s logging.' % (logfile, suffix, comment) ) | 268 self.chat.InfoPost('Log filename is "%s%s", system is %s logging.' % (logfile, suffix, comment) ) |
321 | 269 |
322 # This subroutine will set the players netork status. | |
323 # | |
324 #!self : instance of self | |
325 | |
326 | |
327 def on_name(self, cmdargs): | 270 def on_name(self, cmdargs): |
328 #only 20 chars no more! :) | |
329 if cmdargs == "": | 271 if cmdargs == "": |
330 self.chat.InfoPost("**Incorrect syntax for name.") | 272 self.chat.InfoPost("**Incorrect syntax for name.") |
331 else: | 273 else: |
332 #txt = txt[:50] | |
333 self.settings.set_setting('player', cmdargs) | 274 self.settings.set_setting('player', cmdargs) |
334 self.session.set_name(str(cmdargs)) | 275 self.session.set_name(str(cmdargs)) |
335 | 276 |
336 # def on_status - end | |
337 # This subroutine will set the players netork status. | |
338 # | |
339 # !self : instance of self | |
340 | |
341 def on_status(self, cmdargs): | 277 def on_status(self, cmdargs): |
342 if cmdargs == "": | 278 if cmdargs == "": |
343 self.chat.InfoPost("Incorrect synatx for status.") | 279 self.chat.InfoPost("Incorrect synatx for status.") |
344 else: | 280 else: |
345 #only 20 chars no more! :) | |
346 txt = cmdargs[:20] | 281 txt = cmdargs[:20] |
347 self.session.set_text_status(str(txt)) | 282 self.session.set_text_status(str(txt)) |
348 # def on_status - end | 283 |
349 | |
350 | |
351 def on_set(self, cmdargs): | 284 def on_set(self, cmdargs): |
352 args = string.split(cmdargs,None,-1) | 285 args = string.split(cmdargs,None,-1) |
353 keys = self.settings.get_setting_keys() | 286 keys = self.settings.get_setting_keys() |
354 #print keys | |
355 if len(args) == 0: | 287 if len(args) == 0: |
356 line = "<table border='2'>" | 288 line = "<table border='2'>" |
357 for m in keys: | 289 for m in keys: |
358 line += "<tr><td>" + str(m) + "</td><td> " + str(self.settings.get_setting(m)) + "</td></tr>" | 290 line += "<tr><td>" + str(m) + "</td><td> " + str(self.settings.get_setting(m)) + "</td></tr>" |
359 line += "</table>" | 291 line += "</table>" |
376 self.chat.InfoPost(return_string) | 308 self.chat.InfoPost(return_string) |
377 self.session.set_name(self.settings.get_setting("player")) | 309 self.session.set_name(self.settings.get_setting("player")) |
378 self.chat.set_colors() | 310 self.chat.set_colors() |
379 self.chat.set_buffersize() | 311 self.chat.set_buffersize() |
380 | 312 |
381 # This subroutine will display the correct usage of the different emotions. | |
382 # | |
383 #!self : instance of self | |
384 | |
385 | |
386 def on_help(self, cmdargs=""): | 313 def on_help(self, cmdargs=""): |
387 cmds = self.cmdlist.keys() | 314 cmds = self.cmdlist.keys() |
388 cmds.sort() | 315 cmds.sort() |
389 shortcmds = self.shortcmdlist.keys() | 316 shortcmds = self.shortcmdlist.keys() |
390 shortcmds.sort() | 317 shortcmds.sort() |
398 if self.shortcmdlist[shortcmd] == cmd: | 325 if self.shortcmdlist[shortcmd] == cmd: |
399 msg += ', <b><font color="#0000CC">%s</font></b>' % (shortcmd) | 326 msg += ', <b><font color="#0000CC">%s</font></b>' % (shortcmd) |
400 msg += ' %s' % (self.cmdlist[cmd]['help']) | 327 msg += ' %s' % (self.cmdlist[cmd]['help']) |
401 self.chat.InfoPost(msg) | 328 self.chat.InfoPost(msg) |
402 | 329 |
403 # This subroutine will either show the list of currently ignored users | |
404 # !self : instance of self | |
405 # !text : string that is comprised of a list of users to toggle the ignore flag | |
406 | |
407 | |
408 def on_ignore(self, cmdargs): | 330 def on_ignore(self, cmdargs): |
409 args = string.split(cmdargs,None,-1) | 331 args = string.split(cmdargs,None,-1) |
410 (ignore_list, ignore_name) = self.session.get_ignore_list() | 332 (ignore_list, ignore_name) = self.session.get_ignore_list() |
411 ignore_output = self.colorize(self.chat.syscolor,"<br /><u>Player IDs Currently being Ignored:</u><br />") | 333 ignore_output = self.colorize(self.chat.syscolor,"<br /><u>Player IDs Currently being Ignored:</u><br />") |
412 if cmdargs == "": | 334 if cmdargs == "": |
429 self.chat.InfoPost("Player " + name + " with ID:" + id + " now being ignored") | 351 self.chat.InfoPost("Player " + name + " with ID:" + id + " now being ignored") |
430 except: | 352 except: |
431 self.chat.InfoPost(m + " was ignored because it is an invalid player ID") | 353 self.chat.InfoPost(m + " was ignored because it is an invalid player ID") |
432 traceback.print_exc() | 354 traceback.print_exc() |
433 | 355 |
434 | |
435 def on_role(self, cmdargs): | 356 def on_role(self, cmdargs): |
436 if cmdargs == "": | 357 if cmdargs == "": |
437 self.session.display_roles() | 358 self.session.display_roles() |
438 return | 359 return |
439 delim = cmdargs.find("=") | 360 delim = cmdargs.find("=") |
451 role_pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id)) | 372 role_pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id)) |
452 if role_pwd != None: | 373 if role_pwd != None: |
453 for m in player_ids: | 374 for m in player_ids: |
454 self.session.set_role(m.strip(),role,role_pwd) | 375 self.session.set_role(m.strip(),role,role_pwd) |
455 except: traceback.print_exc() | 376 except: traceback.print_exc() |
456 # return | 377 |
457 | |
458 # This subroutine implements the whisper functionality that enables a user | |
459 # to whisper to another user. | |
460 # | |
461 # !self : instance of self | |
462 # !text : string that is comprised of a list of users and the message to | |
463 #whisper. | |
464 | |
465 | |
466 def on_whisper(self, cmdargs): | 378 def on_whisper(self, cmdargs): |
467 delim = cmdargs.find("=") | 379 delim = cmdargs.find("=") |
468 | 380 |
469 if delim < 0: | 381 if delim < 0: |
470 if self.previous_whisper: player_ids = self.previous_whisper | 382 if self.previous_whisper: player_ids = self.previous_whisper |
474 else: player_ids = string.split(cmdargs[:delim], ",") | 386 else: player_ids = string.split(cmdargs[:delim], ",") |
475 self.previous_whisper = player_ids | 387 self.previous_whisper = player_ids |
476 mesg = string.strip(cmdargs[delim+1:]) | 388 mesg = string.strip(cmdargs[delim+1:]) |
477 self.chat.whisper_to_players(mesg,player_ids) | 389 self.chat.whisper_to_players(mesg,player_ids) |
478 | 390 |
479 #--------------------------------------------------------- | |
480 # [START] Digitalxero Multi Whisper Group 1/1/05 | |
481 #--------------------------------------------------------- | |
482 | |
483 def on_groupwhisper(self, cmdargs): | 391 def on_groupwhisper(self, cmdargs): |
484 args = string.split(cmdargs,None,-1) | 392 args = string.split(cmdargs,None,-1) |
485 delim = cmdargs.find("=") | 393 delim = cmdargs.find("=") |
486 | 394 |
487 if delim > 0: group_ids = string.split(cmdargs[:delim], ",") | 395 if delim > 0: group_ids = string.split(cmdargs[:delim], ",") |
531 for n in orpg.player_list.WG_LIST[gid]: | 439 for n in orpg.player_list.WG_LIST[gid]: |
532 if idList == "": idList = str(n) | 440 if idList == "": idList = str(n) |
533 else: idList = str(n) + ", " + idList | 441 else: idList = str(n) + ", " + idList |
534 self.on_whisper(idList + "=" + self.settings.get_setting("gwtext") + msg) | 442 self.on_whisper(idList + "=" + self.settings.get_setting("gwtext") + msg) |
535 | 443 |
536 #--------------------------------------------------------- | |
537 # [END] Digitalxero Multi Whisper Group 1/1/05 | |
538 #--------------------------------------------------------- | |
539 | |
540 | |
541 def on_gmwhisper(self, cmdargs): | 444 def on_gmwhisper(self, cmdargs): |
542 if cmdargs == "": | 445 if cmdargs == "": |
543 self.chat.InfoPost("**Incorrect syntax for GM Whisper.") | 446 self.chat.InfoPost("**Incorrect syntax for GM Whisper.") |
544 else: | 447 else: |
545 the_gms = self.chat.get_gms() | 448 the_gms = self.chat.get_gms() |
549 if gmstring != "": gmstring += "," | 452 if gmstring != "": gmstring += "," |
550 gmstring += each_gm | 453 gmstring += each_gm |
551 self.on_whisper(gmstring + "=" + cmdargs) | 454 self.on_whisper(gmstring + "=" + cmdargs) |
552 else: self.chat.InfoPost("**No GMs to Whisper to.") | 455 else: self.chat.InfoPost("**No GMs to Whisper to.") |
553 | 456 |
554 | |
555 def on_moderate(self, cmdargs): | 457 def on_moderate(self, cmdargs): |
556 if cmdargs != "": | 458 if cmdargs != "": |
557 pos = cmdargs.find("=") | 459 pos = cmdargs.find("=") |
558 if (pos < 0): | 460 if (pos < 0): |
559 plist = "" | 461 plist = "" |
582 else: | 484 else: |
583 msg = "<moderate action='list' from='"+self.session.id+"' />" | 485 msg = "<moderate action='list' from='"+self.session.id+"' />" |
584 self.session.outbox.put(msg) | 486 self.session.outbox.put(msg) |
585 self.session.update() | 487 self.session.update() |
586 | 488 |
587 | |
588 def on_update(self, cmdargs): | 489 def on_update(self, cmdargs): |
589 self.chat.InfoPost("This command is no longer valid") | 490 self.chat.InfoPost("This command is no longer valid") |
590 | 491 |
591 | |
592 def on_description(self, cmdargs): | 492 def on_description(self, cmdargs): |
593 if len(cmdargs) <= 0: | 493 if len(cmdargs) <= 0: |
594 self.chat.InfoPost("**No description text to display." + str(delim)) | 494 self.chat.InfoPost("**No description text to display." + str(delim)) |
595 return | 495 return |
596 mesg = "<table bgcolor='#c0c0c0' border='3' cellpadding='5' cellspacing='0' width='100%'><tr><td><font color='#000000'>" | 496 mesg = "<table bgcolor='#c0c0c0' border='3' cellpadding='5' cellspacing='0' width='100%'><tr><td><font color='#000000'>" |
597 mesg += string.strip(cmdargs) | 497 mesg += string.strip(cmdargs) |
598 mesg += "</font></td></tr></table>" | 498 mesg += "</font></td></tr></table>" |
599 self.chat.Post(mesg) | 499 self.chat.Post(mesg) |
600 self.chat.send_chat_message(mesg) | 500 self.chat.send_chat_message(mesg) |
601 | 501 |
602 | |
603 def invoke_tab(self, cmdargs): | 502 def invoke_tab(self, cmdargs): |
604 ######START mDuo13's Tab Initiator######## | |
605 try: | 503 try: |
606 int(cmdargs) | 504 int(cmdargs) |
607 playerid = cmdargs.strip() | 505 playerid = cmdargs.strip() |
608 # Check to see if parent notebook already has a private tab for player | |
609 for panel in self.chat.parent.whisper_tabs: | 506 for panel in self.chat.parent.whisper_tabs: |
610 if (panel.sendtarget == playerid): | 507 if (panel.sendtarget == playerid): |
611 self.chat.Post("Cannot invoke tab: Tab already exists.") | 508 self.chat.Post("Cannot invoke tab: Tab already exists.") |
612 return | 509 return |
613 try: displaypanel = self.chat.parent.create_whisper_tab(playerid) | 510 try: displaypanel = self.chat.parent.create_whisper_tab(playerid) |
620 except: | 517 except: |
621 displaypanel = self.chat.parent.create_null_tab(cmdargs) | 518 displaypanel = self.chat.parent.create_null_tab(cmdargs) |
622 nidx = self.chat.parent.get_tab_index(displaypanel) | 519 nidx = self.chat.parent.get_tab_index(displaypanel) |
623 self.chat.parent.newMsg(nidx) | 520 self.chat.parent.newMsg(nidx) |
624 return | 521 return |
625 #######END mDuo13's Tab Initiator######### | 522 |
626 | |
627 | |
628 | |
629 def on_remote_admin(self, cmdargs): | 523 def on_remote_admin(self, cmdargs): |
630 args = string.split(cmdargs,None,-1) | 524 args = string.split(cmdargs,None,-1) |
631 #handles remote administration commands | |
632 try: | 525 try: |
633 pass_state = 0 | 526 pass_state = 0 |
634 pwd = self.session.orpgFrame_callback.password_manager.GetSilentPassword("server") | 527 pwd = self.session.orpgFrame_callback.password_manager.GetSilentPassword("server") |
635 if pwd != None: | 528 if pwd != None: |
636 pass_state = 1 | 529 pass_state = 1 |
637 else: pwd = "<i>[NONE]</i>" | 530 else: pwd = "<i>[NONE]</i>" |
638 | |
639 if len( args ) == 0: | 531 if len( args ) == 0: |
640 #raw command return state info | |
641 msg = "<br /><b>Remote Administrator Config:</b>" | 532 msg = "<br /><b>Remote Administrator Config:</b>" |
642 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />" | 533 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />" |
643 else: msg += " Enabled. Using password '"+pwd+"'<br />" | 534 else: msg += " Enabled. Using password '"+pwd+"'<br />" |
644 self.chat.SystemPost(msg) | 535 self.chat.SystemPost(msg) |
645 return | 536 return |
646 | |
647 if pass_state != 1 and args[0] != "set": | 537 if pass_state != 1 and args[0] != "set": |
648 #no commands under this point will execute unless an admin password has been previously set | |
649 self.chat.SystemPost("Command ignored. No remote administrator password set!!") | 538 self.chat.SystemPost("Command ignored. No remote administrator password set!!") |
650 return | 539 return |
651 msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'" | 540 msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'" |
652 if args[0] == "set": | 541 if args[0] == "set": |
653 if len( args ) > 1: | 542 if len( args ) > 1: |
688 if admin_command.has_key(args[0]): | 577 if admin_command.has_key(args[0]): |
689 msg = msgbase + admin_command[args[0]] | 578 msg = msgbase + admin_command[args[0]] |
690 self.session.outbox.put(msg) | 579 self.session.outbox.put(msg) |
691 | 580 |
692 elif args[0] == "banip": | 581 elif args[0] == "banip": |
693 #Ban a player from the server | |
694 try: bname = str(args[2]) | 582 try: bname = str(args[2]) |
695 except: bname = 'Unknown' | 583 except: bname = 'Unknown' |
696 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>' | 584 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>' |
697 self.session.outbox.put(msg) | 585 self.session.outbox.put(msg) |
698 | 586 |
699 elif args[0] == "createroom": | 587 elif args[0] == "createroom": |
700 #request creation of a (temporary) persistant room | |
701 if len(args) < 2: | 588 if len(args) < 2: |
702 self.chat.SystemPost( "You must supply a name and boot password at least. <br />/admin createroom <name> <boot password> [password]" ) | 589 self.chat.SystemPost( "You must supply a name and boot password at least. <br />/admin createroom <name> <boot password> [password]" ) |
703 return | 590 return |
704 if len(args) < 3: | 591 if len(args) < 3: |
705 self.chat.SystemPost( "You must supply a boot password also.<br />/admin createroom <name> <boot password> [password]" ) | 592 self.chat.SystemPost( "You must supply a boot password also.<br />/admin createroom <name> <boot password> [password]" ) |
707 if len(args) < 4: args.append("") | 594 if len(args) < 4: args.append("") |
708 msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />" | 595 msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />" |
709 self.session.outbox.put(msg) | 596 self.session.outbox.put(msg) |
710 | 597 |
711 else: self.chat.InfoPost("Unknown administrator command" ) | 598 else: self.chat.InfoPost("Unknown administrator command" ) |
712 #command_function = {'banip': self.admin.r_admin_banip, 'createroom': self.r_admin_createroom,} | |
713 except: | 599 except: |
714 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!") | 600 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!") |
715 traceback.print_exc() | 601 traceback.print_exc() |