Mercurial > traipse_dev
comparison orpg/chat/commands.py @ 133:37d26a98883f alpha
Traipse Alpha 'OpenRPG' {091010-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 (Cleaning up for Beta)
Added Bookmarks
Fix to Remote Admin Commands
Minor fix to text based Server
Fix to Pretty Print, from Core
Fix to Splitter Nodes not being created
Fix to massive amounts of images loading, from Core
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
default_manifest.xml renamed to default_upmana.xml
Cleaner clode for saved repositories
New TrueDebug Class in orpg_log (See documentation for usage)
Mercurial's hgweb folder is ported to upmana
**Pretty important update that can help remove thousands of dead children from your gametree.
**Children, <forms />, <group_atts />, <horizontal />, <cols />, <rows />, <height />, etc... are all tags now.
Check your gametree and look for dead children!!
**New Gamtree Recusion method, mapping, and context sensitivity. !!Alpha - Watch out for infinite loops!!
Dead Node Children, now that's a
O O
-v-v- Happy Halloween!
author | sirebral |
---|---|
date | Tue, 10 Nov 2009 12:11:13 -0600 |
parents | fba298d65cf8 |
children | bf799efe7a8a |
comparison
equal
deleted
inserted
replaced
132:fe4dc5817d5e | 133:37d26a98883f |
---|---|
6 # on_help(self) | 6 # on_help(self) |
7 # on_whisper(self,text) | 7 # on_whisper(self,text) |
8 # | 8 # |
9 | 9 |
10 | 10 |
11 import string | 11 import string, time |
12 import time | |
13 import orpg.orpg_version | 12 import orpg.orpg_version |
14 import orpg.orpg_windows | 13 import orpg.orpg_windows |
15 import traceback | 14 import traceback |
16 | 15 |
17 from orpg.orpgCore import component | 16 from orpg.orpgCore import component |
18 from orpg.tools.orpg_log import logger | 17 from orpg.tools.orpg_log import logger |
19 from orpg.tools.decorators import debugging | |
20 | 18 |
21 ##-------------------------------------------------------------- | 19 ##-------------------------------------------------------------- |
22 ## dynamically loading module for extended developer commands | 20 ## dynamically loading module for extended developer commands |
23 ## allows developers to work on new chat commands without | 21 ## allows developers to work on new chat commands without |
24 ## integrating them directly into the ORPG code allowing | 22 ## integrating them directly into the ORPG code allowing |
38 | 36 |
39 # Initialization subroutine. | 37 # Initialization subroutine. |
40 # | 38 # |
41 # !self : instance of self | 39 # !self : instance of self |
42 # !chat : instance of the chat window to write to | 40 # !chat : instance of the chat window to write to |
43 @debugging | 41 |
44 def __init__(self,chat): | 42 def __init__(self,chat): |
45 self.post = chat.Post | 43 self.post = chat.Post |
46 self.colorize = chat.colorize | 44 self.colorize = chat.colorize |
47 self.session = chat.session | 45 self.session = chat.session |
48 #self.send = chat.session.send | 46 #self.send = chat.session.send |
59 # This subroutine will take a text string and attempt to match to a series | 57 # This subroutine will take a text string and attempt to match to a series |
60 # of implemented emotions. | 58 # of implemented emotions. |
61 # | 59 # |
62 # !self : instance of self | 60 # !self : instance of self |
63 # !text : string of text matching an implemented emotion | 61 # !text : string of text matching an implemented emotion |
64 @debugging | 62 |
65 def addcommand(self, cmd, function, helpmsg): | 63 def addcommand(self, cmd, function, helpmsg): |
66 if not self.cmdlist.has_key(cmd) and not self.shortcmdlist.has_key(cmd): | 64 if not self.cmdlist.has_key(cmd) and not self.shortcmdlist.has_key(cmd): |
67 self.cmdlist[cmd] = {} | 65 self.cmdlist[cmd] = {} |
68 self.cmdlist[cmd]['function'] = function | 66 self.cmdlist[cmd]['function'] = function |
69 self.cmdlist[cmd]['help'] = helpmsg | 67 self.cmdlist[cmd]['help'] = helpmsg |
70 #print 'Command Added: ' + cmd | 68 #print 'Command Added: ' + cmd |
71 | 69 |
72 @debugging | 70 |
73 def addshortcmd(self, shortcmd, longcmd): | 71 def addshortcmd(self, shortcmd, longcmd): |
74 if not self.shortcmdlist.has_key(shortcmd) and not self.cmdlist.has_key(shortcmd): | 72 if not self.shortcmdlist.has_key(shortcmd) and not self.cmdlist.has_key(shortcmd): |
75 self.shortcmdlist[shortcmd] = longcmd | 73 self.shortcmdlist[shortcmd] = longcmd |
76 | 74 |
77 @debugging | 75 |
78 def removecmd(self, cmd): | 76 def removecmd(self, cmd): |
79 if self.cmdlist.has_key(cmd): | 77 if self.cmdlist.has_key(cmd): |
80 del self.cmdlist[cmd] | 78 del self.cmdlist[cmd] |
81 elif self.shortcmdlist.has_key(cmd): | 79 elif self.shortcmdlist.has_key(cmd): |
82 del self.shortcmdlist[cmd] | 80 del self.shortcmdlist[cmd] |
83 | 81 |
84 #print 'Command Removed: ' + cmd | 82 #print 'Command Removed: ' + cmd |
85 | 83 |
86 | 84 |
87 @debugging | 85 |
88 def defaultcmds(self): | 86 def defaultcmds(self): |
89 self.addcommand('/help', self.on_help, '- Displays this help message') | 87 self.addcommand('/help', self.on_help, '- Displays this help message') |
90 self.addcommand('/version', self.on_version, ' - Displays current version of OpenRPG.') | 88 self.addcommand('/version', self.on_version, ' - Displays current version of OpenRPG.') |
91 self.addcommand('/me', self.chat.emote_message, ' - Alias for **yourname does something.**') | 89 self.addcommand('/me', self.chat.emote_message, ' - Alias for **yourname does something.**') |
92 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.') | 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.') |
112 self.addcommand('/description', self.on_description, 'message - Creates a block of text, used for room descriptions and such') | 110 self.addcommand('/description', self.on_description, 'message - Creates a block of text, used for room descriptions and such') |
113 self.addcommand('/sound', self.on_sound, 'Sound_URL - Plays a sound for all clients in the room.') | 111 self.addcommand('/sound', self.on_sound, 'Sound_URL - Plays a sound for all clients in the room.') |
114 self.addcommand('/purge', self.on_purge, 'This will clear the entire chat window') | 112 self.addcommand('/purge', self.on_purge, 'This will clear the entire chat window') |
115 self.addcommand('/advfilter', self.on_filter, 'This will toggle the Advanced Filter') | 113 self.addcommand('/advfilter', self.on_filter, 'This will toggle the Advanced Filter') |
116 | 114 |
117 @debugging | 115 |
118 def defaultcmdalias(self): | 116 def defaultcmdalias(self): |
119 self.addshortcmd('/?', '/help') | 117 self.addshortcmd('/?', '/help') |
120 self.addshortcmd('/he', '/me') | 118 self.addshortcmd('/he', '/me') |
121 self.addshortcmd('/she', '/me') | 119 self.addshortcmd('/she', '/me') |
122 self.addshortcmd('/i', '/ignore') | 120 self.addshortcmd('/i', '/ignore') |
127 self.addshortcmd('/d', '/description') | 125 self.addshortcmd('/d', '/description') |
128 | 126 |
129 #This is just an example or a differant way the shorcmd can be used | 127 #This is just an example or a differant way the shorcmd can be used |
130 self.addshortcmd('/sleep', '/me falls asleep') | 128 self.addshortcmd('/sleep', '/me falls asleep') |
131 | 129 |
132 @debugging | 130 |
133 def docmd(self,text): | 131 def docmd(self,text): |
134 cmdsearch = string.split(text,None,1) | 132 cmdsearch = string.split(text,None,1) |
135 cmd = string.lower(cmdsearch[0]) | 133 cmd = string.lower(cmdsearch[0]) |
136 start = len(cmd) | 134 start = len(cmd) |
137 end = len(text) | 135 end = len(text) |
143 self.docmd(self.shortcmdlist[cmd] + " " + cmdargs) | 141 self.docmd(self.shortcmdlist[cmd] + " " + cmdargs) |
144 else: | 142 else: |
145 msg = "Sorry I don't know what %s is!" % (cmd) | 143 msg = "Sorry I don't know what %s is!" % (cmd) |
146 self.chat.InfoPost(msg) | 144 self.chat.InfoPost(msg) |
147 | 145 |
148 @debugging | 146 |
149 def on_filter(self, cmdargs): | 147 def on_filter(self, cmdargs): |
150 #print self.chat.advancedFilter | 148 #print self.chat.advancedFilter |
151 test = not self.chat.advancedFilter | 149 test = not self.chat.advancedFilter |
152 #print test | 150 #print test |
153 | 151 |
168 if self.chat.advancedFilter: | 166 if self.chat.advancedFilter: |
169 self.chat.InfoPost("Advanced Filtering has been turned On") | 167 self.chat.InfoPost("Advanced Filtering has been turned On") |
170 else: | 168 else: |
171 self.chat.InfoPost("Advanced Filtering has been turned Off") | 169 self.chat.InfoPost("Advanced Filtering has been turned Off") |
172 | 170 |
173 @debugging | 171 |
174 def on_purge(self, cmdargs): | 172 def on_purge(self, cmdargs): |
175 self.chat.PurgeChat() | 173 self.chat.PurgeChat() |
176 self.chat.InfoPost('Chat Buffer has been Purged!') | 174 self.chat.InfoPost('Chat Buffer has been Purged!') |
177 | 175 |
178 @debugging | 176 |
179 def on_sound(self, cmdargs): | 177 def on_sound(self, cmdargs): |
180 if len(cmdargs) < 8: | 178 if len(cmdargs) < 8: |
181 self.chat.InfoPost("You must provide a URL for the file name, it does not work for just local sound files") | 179 self.chat.InfoPost("You must provide a URL for the file name, it does not work for just local sound files") |
182 return | 180 return |
183 args = string.split(cmdargs, None, -1) | 181 args = string.split(cmdargs, None, -1) |
207 elif group_id == '0': | 205 elif group_id == '0': |
208 self.chat.InfoPost("You cannot send sound files to the lobby!") | 206 self.chat.InfoPost("You cannot send sound files to the lobby!") |
209 else: | 207 else: |
210 self.chat.InfoPost("Something dun fuckered up Frank!") | 208 self.chat.InfoPost("Something dun fuckered up Frank!") |
211 | 209 |
212 @debugging | 210 |
213 def on_version(self, cmdargs=""): | 211 def on_version(self, cmdargs=""): |
214 self.chat.InfoPost("Version is OpenRPG " + self.chat.version) | 212 self.chat.InfoPost("Version is OpenRPG " + self.chat.version) |
215 | 213 |
216 @debugging | 214 |
217 def on_load(self, cmdargs): | 215 def on_load(self, cmdargs): |
218 args = string.split(cmdargs,None,-1) | 216 args = string.split(cmdargs,None,-1) |
219 try: | 217 try: |
220 self.settings.setup_ini(args[0]) | 218 self.settings.setup_ini(args[0]) |
221 self.settings.reload_settings(self.chat) | 219 self.settings.reload_settings(self.chat) |
222 self.chat.InfoPost("Settings Loaded from file " + args[0] ) | 220 self.chat.InfoPost("Settings Loaded from file " + args[0] ) |
223 except Exception,e: | 221 except Exception,e: |
224 print e | 222 print e |
225 self.chat.InfoPost("ERROR Loading settings") | 223 self.chat.InfoPost("ERROR Loading settings") |
226 | 224 |
227 @debugging | 225 |
228 def on_font(self, cmdargs): | 226 def on_font(self, cmdargs): |
229 try: | 227 try: |
230 fontsettings = self.chat.set_default_font(fontname=cmdargs, fontsize=None) | 228 fontsettings = self.chat.set_default_font(fontname=cmdargs, fontsize=None) |
231 except: | 229 except: |
232 self.chat.InfoPost("ERROR setting default font") | 230 self.chat.InfoPost("ERROR setting default font") |
233 | 231 |
234 @debugging | 232 |
235 def on_fontsize(self, cmdargs): | 233 def on_fontsize(self, cmdargs): |
236 args = string.split(cmdargs,None,-1) | 234 args = string.split(cmdargs,None,-1) |
237 try: | 235 try: |
238 fontsettings = self.chat.set_default_font(fontname=None, fontsize=int(args[0])) | 236 fontsettings = self.chat.set_default_font(fontname=None, fontsize=int(args[0])) |
239 except Exception, e: | 237 except Exception, e: |
240 print e | 238 print e |
241 self.chat.InfoPost("ERROR setting default font size") | 239 self.chat.InfoPost("ERROR setting default font size") |
242 | 240 |
243 @debugging | 241 |
244 def on_close(self, cmdargs): | 242 def on_close(self, cmdargs): |
245 try: | 243 try: |
246 chatpanel = self.chat | 244 chatpanel = self.chat |
247 if (chatpanel.sendtarget == "all"): | 245 if (chatpanel.sendtarget == "all"): |
248 chatpanel.InfoPost("Error: cannot close public chat tab.") | 246 chatpanel.InfoPost("Error: cannot close public chat tab.") |
250 chatpanel.chat_timer.Stop() | 248 chatpanel.chat_timer.Stop() |
251 chatpanel.parent.onCloseTab(0) | 249 chatpanel.parent.onCloseTab(0) |
252 except: | 250 except: |
253 self.chat.InfoPost("Error: cannot close private chat tab.") | 251 self.chat.InfoPost("Error: cannot close private chat tab.") |
254 | 252 |
255 @debugging | 253 |
256 def on_time(self, cmdargs): | 254 def on_time(self, cmdargs): |
257 local_time = time.localtime() | 255 local_time = time.localtime() |
258 gmt_time = time.gmtime() | 256 gmt_time = time.gmtime() |
259 format_string = "%A %b %d, %Y %I:%M:%S%p" | 257 format_string = "%A %b %d, %Y %I:%M:%S%p" |
260 self.chat.InfoPost("<br />Local: " + time.strftime(format_string)+\ | 258 self.chat.InfoPost("<br />Local: " + time.strftime(format_string)+\ |
261 "<br />GMT: "+time.strftime(format_string,gmt_time)) | 259 "<br />GMT: "+time.strftime(format_string,gmt_time)) |
262 | 260 |
263 @debugging | 261 |
264 def on_dieroller(self, cmdargs): | 262 def on_dieroller(self, cmdargs): |
265 args = string.split(cmdargs,None,-1) | 263 args = string.split(cmdargs,None,-1) |
266 rm = component.get('DiceManager') | 264 rm = component.get('DiceManager') |
267 try: | 265 try: |
268 rm.setRoller(args[0]) | 266 rm.setRoller(args[0]) |
271 except Exception, e: | 269 except Exception, e: |
272 print e | 270 print e |
273 self.chat.InfoPost("Available die rollers: " + str(rm.listRollers())) | 271 self.chat.InfoPost("Available die rollers: " + str(rm.listRollers())) |
274 self.chat.InfoPost("You are using the <b>\"" + rm.getRoller() + "\"</b> die roller.") | 272 self.chat.InfoPost("You are using the <b>\"" + rm.getRoller() + "\"</b> die roller.") |
275 | 273 |
276 @debugging | 274 |
277 def on_ping(self, cmdargs): | 275 def on_ping(self, cmdargs): |
278 ct = time.clock() | 276 ct = time.clock() |
279 msg = "<ping player='"+self.session.id+"' time='"+str(ct)+"' />" | 277 msg = "<ping player='"+self.session.id+"' time='"+str(ct)+"' />" |
280 self.session.outbox.put(msg) | 278 self.session.outbox.put(msg) |
281 | 279 |
282 @debugging | 280 |
283 def on_log(self,cmdargs): | 281 def on_log(self,cmdargs): |
284 args = string.split(cmdargs,None,-1) | 282 args = string.split(cmdargs,None,-1) |
285 logfile = self.settings.get_setting( 'GameLogPrefix' ) | 283 logfile = self.settings.get_setting( 'GameLogPrefix' ) |
286 | 284 |
287 if len( args ) == 0: | 285 if len( args ) == 0: |
309 self.chat.SystemPost('You must also specify a filename with the <em>/log to</em> command.' ) | 307 self.chat.SystemPost('You must also specify a filename with the <em>/log to</em> command.' ) |
310 self.postLoggingState() | 308 self.postLoggingState() |
311 else: | 309 else: |
312 self.chat.InfoPost("Unknown logging command, use 'on' or 'off'" ) | 310 self.chat.InfoPost("Unknown logging command, use 'on' or 'off'" ) |
313 | 311 |
314 @debugging | 312 |
315 def postLoggingState( self ): | 313 def postLoggingState( self ): |
316 logfile = self.settings.get_setting( 'GameLogPrefix' ) | 314 logfile = self.settings.get_setting( 'GameLogPrefix' ) |
317 try: | 315 try: |
318 if logfile[0] != ANTI_LOG_CHAR: comment = 'is' | 316 if logfile[0] != ANTI_LOG_CHAR: comment = 'is' |
319 else: comment = 'is not' | 317 else: comment = 'is not' |
323 | 321 |
324 # This subroutine will set the players netork status. | 322 # This subroutine will set the players netork status. |
325 # | 323 # |
326 #!self : instance of self | 324 #!self : instance of self |
327 | 325 |
328 @debugging | 326 |
329 def on_name(self, cmdargs): | 327 def on_name(self, cmdargs): |
330 #only 20 chars no more! :) | 328 #only 20 chars no more! :) |
331 if cmdargs == "": | 329 if cmdargs == "": |
332 self.chat.InfoPost("**Incorrect syntax for name.") | 330 self.chat.InfoPost("**Incorrect syntax for name.") |
333 else: | 331 else: |
337 | 335 |
338 # def on_status - end | 336 # def on_status - end |
339 # This subroutine will set the players netork status. | 337 # This subroutine will set the players netork status. |
340 # | 338 # |
341 # !self : instance of self | 339 # !self : instance of self |
342 @debugging | 340 |
343 def on_status(self, cmdargs): | 341 def on_status(self, cmdargs): |
344 if cmdargs == "": | 342 if cmdargs == "": |
345 self.chat.InfoPost("Incorrect synatx for status.") | 343 self.chat.InfoPost("Incorrect synatx for status.") |
346 else: | 344 else: |
347 #only 20 chars no more! :) | 345 #only 20 chars no more! :) |
348 txt = cmdargs[:20] | 346 txt = cmdargs[:20] |
349 self.session.set_text_status(str(txt)) | 347 self.session.set_text_status(str(txt)) |
350 # def on_status - end | 348 # def on_status - end |
351 | 349 |
352 @debugging | 350 |
353 def on_set(self, cmdargs): | 351 def on_set(self, cmdargs): |
354 args = string.split(cmdargs,None,-1) | 352 args = string.split(cmdargs,None,-1) |
355 keys = self.settings.get_setting_keys() | 353 keys = self.settings.get_setting_keys() |
356 #print keys | 354 #print keys |
357 if len(args) == 0: | 355 if len(args) == 0: |
382 | 380 |
383 # This subroutine will display the correct usage of the different emotions. | 381 # This subroutine will display the correct usage of the different emotions. |
384 # | 382 # |
385 #!self : instance of self | 383 #!self : instance of self |
386 | 384 |
387 @debugging | 385 |
388 def on_help(self, cmdargs=""): | 386 def on_help(self, cmdargs=""): |
389 cmds = self.cmdlist.keys() | 387 cmds = self.cmdlist.keys() |
390 cmds.sort() | 388 cmds.sort() |
391 shortcmds = self.shortcmdlist.keys() | 389 shortcmds = self.shortcmdlist.keys() |
392 shortcmds.sort() | 390 shortcmds.sort() |
404 | 402 |
405 # This subroutine will either show the list of currently ignored users | 403 # This subroutine will either show the list of currently ignored users |
406 # !self : instance of self | 404 # !self : instance of self |
407 # !text : string that is comprised of a list of users to toggle the ignore flag | 405 # !text : string that is comprised of a list of users to toggle the ignore flag |
408 | 406 |
409 @debugging | 407 |
410 def on_ignore(self, cmdargs): | 408 def on_ignore(self, cmdargs): |
411 args = string.split(cmdargs,None,-1) | 409 args = string.split(cmdargs,None,-1) |
412 (ignore_list, ignore_name) = self.session.get_ignore_list() | 410 (ignore_list, ignore_name) = self.session.get_ignore_list() |
413 ignore_output = self.colorize(self.chat.syscolor,"<br /><u>Player IDs Currently being Ignored:</u><br />") | 411 ignore_output = self.colorize(self.chat.syscolor,"<br /><u>Player IDs Currently being Ignored:</u><br />") |
414 if cmdargs == "": | 412 if cmdargs == "": |
431 self.chat.InfoPost("Player " + name + " with ID:" + id + " now being ignored") | 429 self.chat.InfoPost("Player " + name + " with ID:" + id + " now being ignored") |
432 except: | 430 except: |
433 self.chat.InfoPost(m + " was ignored because it is an invalid player ID") | 431 self.chat.InfoPost(m + " was ignored because it is an invalid player ID") |
434 traceback.print_exc() | 432 traceback.print_exc() |
435 | 433 |
436 @debugging | 434 |
437 def on_role(self, cmdargs): | 435 def on_role(self, cmdargs): |
438 if cmdargs == "": | 436 if cmdargs == "": |
439 self.session.display_roles() | 437 self.session.display_roles() |
440 return | 438 return |
441 delim = cmdargs.find("=") | 439 delim = cmdargs.find("=") |
462 # | 460 # |
463 # !self : instance of self | 461 # !self : instance of self |
464 # !text : string that is comprised of a list of users and the message to | 462 # !text : string that is comprised of a list of users and the message to |
465 #whisper. | 463 #whisper. |
466 | 464 |
467 @debugging | 465 |
468 def on_whisper(self, cmdargs): | 466 def on_whisper(self, cmdargs): |
469 delim = cmdargs.find("=") | 467 delim = cmdargs.find("=") |
470 | 468 |
471 if delim < 0: | 469 if delim < 0: |
472 if self.previous_whisper: player_ids = self.previous_whisper | 470 if self.previous_whisper: player_ids = self.previous_whisper |
479 self.chat.whisper_to_players(mesg,player_ids) | 477 self.chat.whisper_to_players(mesg,player_ids) |
480 | 478 |
481 #--------------------------------------------------------- | 479 #--------------------------------------------------------- |
482 # [START] Digitalxero Multi Whisper Group 1/1/05 | 480 # [START] Digitalxero Multi Whisper Group 1/1/05 |
483 #--------------------------------------------------------- | 481 #--------------------------------------------------------- |
484 @debugging | 482 |
485 def on_groupwhisper(self, cmdargs): | 483 def on_groupwhisper(self, cmdargs): |
486 args = string.split(cmdargs,None,-1) | 484 args = string.split(cmdargs,None,-1) |
487 delim = cmdargs.find("=") | 485 delim = cmdargs.find("=") |
488 | 486 |
489 if delim > 0: group_ids = string.split(cmdargs[:delim], ",") | 487 if delim > 0: group_ids = string.split(cmdargs[:delim], ",") |
537 | 535 |
538 #--------------------------------------------------------- | 536 #--------------------------------------------------------- |
539 # [END] Digitalxero Multi Whisper Group 1/1/05 | 537 # [END] Digitalxero Multi Whisper Group 1/1/05 |
540 #--------------------------------------------------------- | 538 #--------------------------------------------------------- |
541 | 539 |
542 @debugging | 540 |
543 def on_gmwhisper(self, cmdargs): | 541 def on_gmwhisper(self, cmdargs): |
544 if cmdargs == "": | 542 if cmdargs == "": |
545 self.chat.InfoPost("**Incorrect syntax for GM Whisper.") | 543 self.chat.InfoPost("**Incorrect syntax for GM Whisper.") |
546 else: | 544 else: |
547 the_gms = self.chat.get_gms() | 545 the_gms = self.chat.get_gms() |
551 if gmstring != "": gmstring += "," | 549 if gmstring != "": gmstring += "," |
552 gmstring += each_gm | 550 gmstring += each_gm |
553 self.on_whisper(gmstring + "=" + cmdargs) | 551 self.on_whisper(gmstring + "=" + cmdargs) |
554 else: self.chat.InfoPost("**No GMs to Whisper to.") | 552 else: self.chat.InfoPost("**No GMs to Whisper to.") |
555 | 553 |
556 @debugging | 554 |
557 def on_moderate(self, cmdargs): | 555 def on_moderate(self, cmdargs): |
558 if cmdargs != "": | 556 if cmdargs != "": |
559 pos = cmdargs.find("=") | 557 pos = cmdargs.find("=") |
560 if (pos < 0): | 558 if (pos < 0): |
561 plist = "" | 559 plist = "" |
584 else: | 582 else: |
585 msg = "<moderate action='list' from='"+self.session.id+"' />" | 583 msg = "<moderate action='list' from='"+self.session.id+"' />" |
586 self.session.outbox.put(msg) | 584 self.session.outbox.put(msg) |
587 self.session.update() | 585 self.session.update() |
588 | 586 |
589 @debugging | 587 |
590 def on_update(self, cmdargs): | 588 def on_update(self, cmdargs): |
591 self.chat.InfoPost("This command is no longer valid") | 589 self.chat.InfoPost("This command is no longer valid") |
592 | 590 |
593 @debugging | 591 |
594 def on_description(self, cmdargs): | 592 def on_description(self, cmdargs): |
595 if len(cmdargs) <= 0: | 593 if len(cmdargs) <= 0: |
596 self.chat.InfoPost("**No description text to display." + str(delim)) | 594 self.chat.InfoPost("**No description text to display." + str(delim)) |
597 return | 595 return |
598 mesg = "<table bgcolor='#c0c0c0' border='3' cellpadding='5' cellspacing='0' width='100%'><tr><td><font color='#000000'>" | 596 mesg = "<table bgcolor='#c0c0c0' border='3' cellpadding='5' cellspacing='0' width='100%'><tr><td><font color='#000000'>" |
599 mesg += string.strip(cmdargs) | 597 mesg += string.strip(cmdargs) |
600 mesg += "</font></td></tr></table>" | 598 mesg += "</font></td></tr></table>" |
601 self.chat.Post(mesg) | 599 self.chat.Post(mesg) |
602 self.chat.send_chat_message(mesg) | 600 self.chat.send_chat_message(mesg) |
603 | 601 |
604 @debugging | 602 |
605 def invoke_tab(self, cmdargs): | 603 def invoke_tab(self, cmdargs): |
606 ######START mDuo13's Tab Initiator######## | 604 ######START mDuo13's Tab Initiator######## |
607 try: | 605 try: |
608 int(cmdargs) | 606 int(cmdargs) |
609 playerid = cmdargs.strip() | 607 playerid = cmdargs.strip() |
625 self.chat.parent.newMsg(nidx) | 623 self.chat.parent.newMsg(nidx) |
626 return | 624 return |
627 #######END mDuo13's Tab Initiator######### | 625 #######END mDuo13's Tab Initiator######### |
628 | 626 |
629 | 627 |
630 @debugging | 628 |
631 def on_remote_admin(self, cmdargs): | 629 def on_remote_admin(self, cmdargs): |
632 args = string.split(cmdargs,None,-1) | 630 args = string.split(cmdargs,None,-1) |
633 #handles remote administration commands | 631 #handles remote administration commands |
634 try: | 632 try: |
635 pass_state = 0 | 633 pass_state = 0 |
673 self.session.outbox.put(msg) | 671 self.session.outbox.put(msg) |
674 | 672 |
675 elif len(args) == 2: | 673 elif len(args) == 2: |
676 admin_command = {'ban': ' cmd="ban" bid="' + str(args[1]) + '" />', | 674 admin_command = {'ban': ' cmd="ban" bid="' + str(args[1]) + '" />', |
677 'unban': ' cmd="unban" ip="' + str(args[1]) + '" />', | 675 'unban': ' cmd="unban" ip="' + str(args[1]) + '" />', |
678 'nameroom': " cmd='nameroom' rmid="+ str(args[1])+" name="+ string.join(args[2:])+" />", | |
679 'broadcast': " cmd='broadcast' msg='"+ string.join(args[1:])+"' />", | 676 'broadcast': " cmd='broadcast' msg='"+ string.join(args[1:])+"' />", |
680 'killgroup': " cmd='killgroup' gid='"+ str(args[1])+"' />" | 677 'killgroup': " cmd='killgroup' gid='"+ str(args[1])+"' />" |
681 } | 678 } |
682 if admin_command.has_key(args[0]): | 679 if admin_command.has_key(args[0]): |
683 msg = msgbase + admin_command[args[0]] | 680 msg = msgbase + admin_command[args[0]] |
684 self.session.outbox.put(msg) | 681 self.session.outbox.put(msg) |
685 | 682 |
686 elif len(args) == 3: | 683 elif len(args) == 3: |
687 admin_command = {'message':" cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />", | 684 admin_command = {'message':" cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />", |
685 'nameroom': " cmd='nameroom' rmid='"+ str(args[1])+"' name='"+ string.join(args[2:])+"' />", | |
688 'passwd': " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />" | 686 'passwd': " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />" |
689 } | 687 } |
690 if admin_command.has_key(args[0]): | 688 if admin_command.has_key(args[0]): |
691 msg = msgbase + admin_command[args[0]] | 689 msg = msgbase + admin_command[args[0]] |
692 self.session.outbox.put(msg) | 690 self.session.outbox.put(msg) |