comparison orpg/chat/commands.py @ 115:17b64e9133e9 alpha

Traipse Alpha 'OpenRPG' {091012-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 {091011} 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. {091012} 00: Remote Admin Commands more organized, more prep work. Added Confirmation window for sent nodes.
author sirebral
date Mon, 12 Oct 2009 01:11:10 -0500
parents bd6ca89e4cbb
children 9314d63c0941
comparison
equal deleted inserted replaced
114:bd6ca89e4cbb 115:17b64e9133e9
643 nidx = self.chat.parent.get_tab_index(displaypanel) 643 nidx = self.chat.parent.get_tab_index(displaypanel)
644 self.chat.parent.newMsg(nidx) 644 self.chat.parent.newMsg(nidx)
645 return 645 return
646 #######END mDuo13's Tab Initiator######### 646 #######END mDuo13's Tab Initiator#########
647 647
648
648 @debugging 649 @debugging
649 def on_remote_admin(self, cmdargs): 650 def on_remote_admin(self, cmdargs):
650 args = string.split(cmdargs,None,-1) 651 args = string.split(cmdargs,None,-1)
651 #handles remote administration commands 652 #handles remote administration commands
652 try: 653 try:
668 if pass_state != 1 and args[0] != "set": 669 if pass_state != 1 and args[0] != "set":
669 #no commands under this point will execute unless an admin password has been previously set 670 #no commands under this point will execute unless an admin password has been previously set
670 self.chat.SystemPost("Command ignored. No remote administrator password set!!") 671 self.chat.SystemPost("Command ignored. No remote administrator password set!!")
671 return 672 return
672 msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'" 673 msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'"
673
674 if args[0] == "set": 674 if args[0] == "set":
675 if len( args ) > 1: 675 if len( args ) > 1:
676 self.session.orpgFrame_callback.password_manager.server = str( args[1] ) 676 self.session.orpgFrame_callback.password_manager.server = str( args[1] )
677 self.chat.SystemPost( "Remote administration commands using password: "+str(self.session.orpgFrame_callback.password_manager.GetSilentPassword("server"))+"" ) 677 self.chat.SystemPost( "Remote administration commands using password: "+str(self.session.orpgFrame_callback.password_manager.GetSilentPassword("server"))+"" )
678 else: 678 else:
679 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("server") 679 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("server")
680 if pwd != None: 680 if pwd != None:
681 self.chat.SystemPost( "Remote administration commands using password: "+pwd+"" ) 681 self.chat.SystemPost( "Remote administration commands using password: "+pwd+"" )
682 682 elif len(args) == 1:
683 elif args[0] == "ban": 683 admin_command = {'banlist': ' cmd="banlist" />',
684 #Ban a player from the server 684 'help': " cmd='help' />",
685 msg = msgbase + ' cmd="ban" bid="' + str(args[1]) + '" />' 685 'roompasswords': " cmd='roompasswords' />",
686 self.session.outbox.put(msg) 686 'uptime': " cmd='uptime' />",
687 687 'list': " cmd='list' />",
688 elif args[0] == "boot": 688 'killserver': " cmd='killserver' />",
689 #Ban a player from the server 689 'savemaps': ' cmd="savemaps" />'
690 msg = msgbase + ' cmd="boot" bid="' + str(args[1]) + '" />' 690 }
691 self.session.outbox.put(msg) 691 if admin_command.has_key(args[0]):
692 msg = msgbase + admin_command[args[0]]
693 self.session.outbox.put(msg)
694
695 elif len(args) == 2:
696 admin_command = {'ban': ' cmd="ban" bid="' + str(args[1]) + '" />',
697 'unban': ' cmd="unban" ip="' + str(args[1]) + '" />',
698 'nameroom': " cmd='nameroom' rmid="+ str(args[1])+" name="+ string.join(args[2:])+" />",
699 'broadcast': " cmd='broadcast' msg='"+ string.join(args[1:])+"' />",
700 'killgroup': " cmd='killgroup' gid='"+ str(args[1])+"' />"
701 }
702 if admin_command.has_key(args[0]):
703 msg = msgbase + admin_command[args[0]]
704 self.session.outbox.put(msg)
705
706 elif len(args) == 3:
707 admin_command = {'message':" cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />",
708 'passwd': " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />"
709 }
710 if admin_command.has_key(args[0]):
711 msg = msgbase + admin_command[args[0]]
712 self.session.outbox.put(msg)
692 713
693 elif args[0] == "banip": 714 elif args[0] == "banip":
694 #Ban a player from the server 715 #Ban a player from the server
695 try: bname = str(args[2]) 716 try: bname = str(args[2])
696 except: bname = 'Unknown' 717 except: bname = 'Unknown'
697 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>' 718 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>'
698 self.session.outbox.put(msg)
699
700 elif args[0] == "unban":
701 #remove a group from the server and drop all players within the group
702 msg = msgbase + ' cmd="unban" ip="' + str(args[1]) + '" />'
703 self.session.outbox.put(msg)
704
705 elif args[0] == "banlist":
706 #remove a group from the server and drop all players within the group
707 msg = msgbase + ' cmd="banlist" />'
708 self.session.outbox.put(msg)
709
710 elif args[0] == "help":
711 #request help from server
712 msg = msgbase + " cmd='help' />"
713 self.session.outbox.put(msg)
714
715 elif args[0] == "nameroom":
716 #reqest room renaming on server
717 msg = msgbase + " cmd='nameroom' rmid="+ str(args[1])+" name="+ string.join(args[2:])+" />"
718 self.session.outbox.put(msg)
719
720 elif args[0] == "roompasswords":
721 #reqest room renaming on server
722 msg = msgbase + " cmd='roompasswords' />"
723 self.session.outbox.put(msg)
724
725 elif args[0] == "message":
726 #send message to a specific player on the server via the system administrator
727 msg = msgbase + " cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />"
728 self.session.outbox.put(msg)
729
730 elif args[0] == "broadcast":
731 #send a message to all players on server from the system administrator
732 msg = msgbase + " cmd='broadcast' msg='"+ string.join(args[1:])+"' />"
733 self.session.outbox.put(msg)
734
735 elif args[0] == "killgroup":
736 #remove a group from the server and drop all players within the group
737 msg = msgbase + " cmd='killgroup' gid='"+ str(args[1])+"' />"
738 self.session.outbox.put(msg)
739
740 elif args[0] == "uptime":
741 #request uptime report from server
742 msg = msgbase + " cmd='uptime' />"
743 self.session.outbox.put(msg) 719 self.session.outbox.put(msg)
744 720
745 elif args[0] == "createroom": 721 elif args[0] == "createroom":
746 #request creation of a (temporary) persistant room 722 #request creation of a (temporary) persistant room
747 if len(args) < 2: 723 if len(args) < 2:
752 return 728 return
753 if len(args) < 4: args.append("") 729 if len(args) < 4: args.append("")
754 msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />" 730 msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />"
755 self.session.outbox.put(msg) 731 self.session.outbox.put(msg)
756 732
757 elif args[0] == "passwd":
758 #request boot password change on a room
759 msg = msgbase + " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />"
760 self.session.outbox.put(msg)
761
762 elif args[0] == "list":
763 #request a list of rooms and players from server
764 msg = msgbase + " cmd='list' />"
765 self.session.outbox.put(msg)
766
767 elif args[0] == "killserver":
768 #remotely kill the server
769 msg = msgbase + " cmd='killserver' />"
770 self.session.outbox.put(msg)
771
772 elif args[0] == "savemaps":
773 msg = msgbase + ' cmd="savemaps" />'
774 self.session.outbox.put(msg)
775
776 else: self.chat.InfoPost("Unknown administrator command" ) 733 else: self.chat.InfoPost("Unknown administrator command" )
734 command_function = {
735 'banip': self.admin.r_admin_banip,
736 'createroom': self.r_admin_createroom,
737 }
777 except: 738 except:
778 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!") 739 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!")
779 traceback.print_exc() 740 traceback.print_exc()