comparison orpg/chat/commands.py @ 119:9314d63c0941 alpha

Traipse Alpha 'OpenRPG' {091029-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: Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images! Changes made to the map for increased portability. SnowDog has changes planned in Core, though. Added an initial push to the BCG. Not much to see, just shows off how it is re-writing Main code. Fix to remote admin commands Minor fix to texted based server, works in /System/ folder Some Core changes to gametree to correctly disply Pretty Print, thanks David! Fix to Splitter Nodes not being created. Added images to Plugin Control panel for Autostart feature Fix to massive amounts of images loading; from Core fix to gsclient so with_statement imports Added 'boot' command to remote admin Prep work in Pass tool for remote admin rankings and different passwords, ei, Server, Admin, Moderator, etc. Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes. Minor changes to allow for portability to an OpenSUSE linux OS (hopefully without breaking) {091028} 00: Made changes to gametree to start working with Element Tree, mostly from Core Minor changes to Map to start working with Element Tree, from Core Preliminary changes to map efficiency, from FlexiRPG Miniatures Layer pop up box allows users to turn off Mini labels, from FlexiRPG Changes to main.py to start working with Element Tree {091029} 00: Changes made to server to start working with Element Tree. Changes made to Meta Server Lib. Prepping test work for a multi meta network page. Minor bug fixed with mini to gametree Zoom Mouse plugin added. Known Issue: Disconnecting causes an server side error. XML data is not being passed correctly.
author sirebral
date Thu, 29 Oct 2009 20:35:28 -0500
parents 17b64e9133e9
children fba298d65cf8
comparison
equal deleted inserted replaced
118:217fb049bd00 119:9314d63c0941
313 313
314 @debugging 314 @debugging
315 def postLoggingState( self ): 315 def postLoggingState( self ):
316 logfile = self.settings.get_setting( 'GameLogPrefix' ) 316 logfile = self.settings.get_setting( 'GameLogPrefix' )
317 try: 317 try:
318 if logfile[0] != ANTI_LOG_CHAR: 318 if logfile[0] != ANTI_LOG_CHAR: comment = 'is'
319 comment = 'is' 319 else: comment = 'is not'
320 else: 320 except: comment = 'is not'
321 comment = 'is not'
322 except:
323 comment = 'is not'
324 suffix = time.strftime( '-%d-%m-%y.html', time.localtime( time.time() ) ) 321 suffix = time.strftime( '-%d-%m-%y.html', time.localtime( time.time() ) )
325 self.chat.InfoPost('Log filename is "%s%s", system is %s logging.' % (logfile, suffix, comment) ) 322 self.chat.InfoPost('Log filename is "%s%s", system is %s logging.' % (logfile, suffix, comment) )
326 323
327 # This subroutine will set the players netork status. 324 # This subroutine will set the players netork status.
328 # 325 #
337 #txt = txt[:50] 334 #txt = txt[:50]
338 self.settings.set_setting('player', cmdargs) 335 self.settings.set_setting('player', cmdargs)
339 self.session.set_name(str(cmdargs)) 336 self.session.set_name(str(cmdargs))
340 337
341 # def on_status - end 338 # def on_status - end
342
343 # This subroutine will set the players netork status. 339 # This subroutine will set the players netork status.
344 # 340 #
345 # !self : instance of self 341 # !self : instance of self
346 @debugging 342 @debugging
347 def on_status(self, cmdargs): 343 def on_status(self, cmdargs):
402 msg += '<br /><b><font color="#000000">%s</font></b>' % (cmd) 398 msg += '<br /><b><font color="#000000">%s</font></b>' % (cmd)
403 for shortcmd in shortcmds: 399 for shortcmd in shortcmds:
404 if self.shortcmdlist[shortcmd] == cmd: 400 if self.shortcmdlist[shortcmd] == cmd:
405 msg += ', <b><font color="#0000CC">%s</font></b>' % (shortcmd) 401 msg += ', <b><font color="#0000CC">%s</font></b>' % (shortcmd)
406 msg += ' %s' % (self.cmdlist[cmd]['help']) 402 msg += ' %s' % (self.cmdlist[cmd]['help'])
407
408 self.chat.InfoPost(msg) 403 self.chat.InfoPost(msg)
409 404
410 # This subroutine will either show the list of currently ignored users 405 # This subroutine will either show the list of currently ignored users
411 # !self : instance of self 406 # !self : instance of self
412 # !text : string that is comprised of a list of users to toggle the ignore flag 407 # !text : string that is comprised of a list of users to toggle the ignore flag
457 try: 452 try:
458 role_pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id)) 453 role_pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id))
459 if role_pwd != None: 454 if role_pwd != None:
460 for m in player_ids: 455 for m in player_ids:
461 self.session.set_role(m.strip(),role,role_pwd) 456 self.session.set_role(m.strip(),role,role_pwd)
462 except: 457 except: traceback.print_exc()
463 traceback.print_exc()
464 # return 458 # return
465 459
466 # This subroutine implements the whisper functionality that enables a user 460 # This subroutine implements the whisper functionality that enables a user
467 # to whisper to another user. 461 # to whisper to another user.
468 # 462 #
473 @debugging 467 @debugging
474 def on_whisper(self, cmdargs): 468 def on_whisper(self, cmdargs):
475 delim = cmdargs.find("=") 469 delim = cmdargs.find("=")
476 470
477 if delim < 0: 471 if delim < 0:
478 if self.previous_whisper: 472 if self.previous_whisper: player_ids = self.previous_whisper
479 player_ids = self.previous_whisper
480 else: 473 else:
481 self.chat.InfoPost("**Incorrect syntax for whisper." + str(delim)) 474 self.chat.InfoPost("**Incorrect syntax for whisper." + str(delim))
482 return 475 return
483 else: 476 else: player_ids = string.split(cmdargs[:delim], ",")
484 player_ids = string.split(cmdargs[:delim], ",")
485 self.previous_whisper = player_ids 477 self.previous_whisper = player_ids
486 mesg = string.strip(cmdargs[delim+1:]) 478 mesg = string.strip(cmdargs[delim+1:])
487 self.chat.whisper_to_players(mesg,player_ids) 479 self.chat.whisper_to_players(mesg,player_ids)
488 480
489 #--------------------------------------------------------- 481 #---------------------------------------------------------
492 @debugging 484 @debugging
493 def on_groupwhisper(self, cmdargs): 485 def on_groupwhisper(self, cmdargs):
494 args = string.split(cmdargs,None,-1) 486 args = string.split(cmdargs,None,-1)
495 delim = cmdargs.find("=") 487 delim = cmdargs.find("=")
496 488
497 if delim > 0: 489 if delim > 0: group_ids = string.split(cmdargs[:delim], ",")
498 group_ids = string.split(cmdargs[:delim], ",")
499 elif args[0] == "add": 490 elif args[0] == "add":
500 if not orpg.player_list.WG_LIST.has_key(args[2]): 491 if not orpg.player_list.WG_LIST.has_key(args[2]):
501 orpg.player_list.WG_LIST[args[2]] = {} 492 orpg.player_list.WG_LIST[args[2]] = {}
502 orpg.player_list.WG_LIST[args[2]][int(args[1])] = int(args[1]) 493 orpg.player_list.WG_LIST[args[2]][int(args[1])] = int(args[1])
503 return 494 return
538 return 529 return
539 msg = string.strip(cmdargs[delim+1:]) 530 msg = string.strip(cmdargs[delim+1:])
540 for gid in group_ids: 531 for gid in group_ids:
541 idList = "" 532 idList = ""
542 for n in orpg.player_list.WG_LIST[gid]: 533 for n in orpg.player_list.WG_LIST[gid]:
543 if idList == "": 534 if idList == "": idList = str(n)
544 idList = str(n) 535 else: idList = str(n) + ", " + idList
545 else:
546 idList = str(n) + ", " + idList
547 self.on_whisper(idList + "=" + self.settings.get_setting("gwtext") + msg) 536 self.on_whisper(idList + "=" + self.settings.get_setting("gwtext") + msg)
548 537
549 #--------------------------------------------------------- 538 #---------------------------------------------------------
550 # [END] Digitalxero Multi Whisper Group 1/1/05 539 # [END] Digitalxero Multi Whisper Group 1/1/05
551 #--------------------------------------------------------- 540 #---------------------------------------------------------
557 else: 546 else:
558 the_gms = self.chat.get_gms() 547 the_gms = self.chat.get_gms()
559 if len(the_gms): 548 if len(the_gms):
560 gmstring = "" 549 gmstring = ""
561 for each_gm in the_gms: 550 for each_gm in the_gms:
562 if gmstring != "": 551 if gmstring != "": gmstring += ","
563 gmstring += ","
564 gmstring += each_gm 552 gmstring += each_gm
565 self.on_whisper(gmstring + "=" + cmdargs) 553 self.on_whisper(gmstring + "=" + cmdargs)
566 else: 554 else: self.chat.InfoPost("**No GMs to Whisper to.")
567 self.chat.InfoPost("**No GMs to Whisper to.")
568 555
569 @debugging 556 @debugging
570 def on_moderate(self, cmdargs): 557 def on_moderate(self, cmdargs):
571 if cmdargs != "": 558 if cmdargs != "":
572 pos = cmdargs.find("=") 559 pos = cmdargs.find("=")
573 if (pos < 0): 560 if (pos < 0):
574 plist = "" 561 plist = ""
575 if cmdargs.lower() == "on": 562 if cmdargs.lower() == "on": action = "enable"
576 action = "enable" 563 elif cmdargs.lower() == "off": action="disable"
577 elif cmdargs.lower() == "off":
578 action="disable"
579 else: 564 else:
580 self.chat.InfoPost("Wrong syntax for moderate command!") 565 self.chat.InfoPost("Wrong syntax for moderate command!")
581 return 566 return
582 else: 567 else:
583 plist = string.strip(cmdargs[:pos]) 568 plist = string.strip(cmdargs[:pos])
584 tag = string.strip(cmdargs[pos+1:]) 569 tag = string.strip(cmdargs[pos+1:])
585 if tag.lower() == "on": 570 if tag.lower() == "on": action = "addvoice"
586 action = "addvoice" 571 elif tag.lower() == "off": action = "delvoice"
587 elif tag.lower() == "off":
588 action = "delvoice"
589 else: 572 else:
590 self.chat.InfoPost("Wrong syntax for moderate command!") 573 self.chat.InfoPost("Wrong syntax for moderate command!")
591 return 574 return
592 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id)) 575 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("admin",int(self.session.group_id))
593 if pwd != None: 576 if pwd != None:
594 msg = "<moderate" 577 msg = "<moderate"
595 msg += " action = '" + action + "'" 578 msg += " action = '" + action + "'"
596 msg +=" from = '" + self.session.id + "' pwd='" + pwd + "'" 579 msg +=" from = '" + self.session.id + "' pwd='" + pwd + "'"
597 if (plist != ""): 580 if (plist != ""): msg += " users='"+plist+"'"
598 msg += " users='"+plist+"'"
599 msg += " />" 581 msg += " />"
600 self.session.outbox.put(msg) 582 self.session.outbox.put(msg)
601 pass 583 pass
602 else: 584 else:
603 msg = "<moderate action='list' from='"+self.session.id+"' />" 585 msg = "<moderate action='list' from='"+self.session.id+"' />"
628 # Check to see if parent notebook already has a private tab for player 610 # Check to see if parent notebook already has a private tab for player
629 for panel in self.chat.parent.whisper_tabs: 611 for panel in self.chat.parent.whisper_tabs:
630 if (panel.sendtarget == playerid): 612 if (panel.sendtarget == playerid):
631 self.chat.Post("Cannot invoke tab: Tab already exists.") 613 self.chat.Post("Cannot invoke tab: Tab already exists.")
632 return 614 return
633 try: 615 try: displaypanel = self.chat.parent.create_whisper_tab(playerid)
634 displaypanel = self.chat.parent.create_whisper_tab(playerid)
635 except: 616 except:
636 self.chat.Post("That ID# is not valid.") 617 self.chat.Post("That ID# is not valid.")
637 return 618 return
638 nidx = self.chat.parent.get_tab_index(displaypanel) 619 nidx = self.chat.parent.get_tab_index(displaypanel)
639 self.chat.parent.newMsg(nidx) 620 self.chat.parent.newMsg(nidx)
659 640
660 if len( args ) == 0: 641 if len( args ) == 0:
661 #raw command return state info 642 #raw command return state info
662 msg = "<br /><b>Remote Administrator Config:</b>" 643 msg = "<br /><b>Remote Administrator Config:</b>"
663 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />" 644 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />"
664 else: 645 else: msg += " Enabled. Using password '"+pwd+"'<br />"
665 msg += " Enabled. Using password '"+pwd+"'<br />"
666 self.chat.SystemPost(msg) 646 self.chat.SystemPost(msg)
667 return 647 return
668 648
669 if pass_state != 1 and args[0] != "set": 649 if pass_state != 1 and args[0] != "set":
670 #no commands under this point will execute unless an admin password has been previously set 650 #no commands under this point will execute unless an admin password has been previously set