Mercurial > traipse_dev
comparison orpg/chat/commands.py @ 110:910942d07574 alpha
Traipse Alpha 'OpenRPG' {091008-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:
{091006}
00:
Adds Bookmarks (Alpha) with cool Smiley Star and Plus Symbol images!
03:
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.
{091007}
00:
New images added to Plugin Control Panel for Auto Start.
01:
Attempting to fix Deprecation warning from Main.
02:
Second attempt, problem in gsclient with "s.
03:
Fail.
{091008}
00:
Fix to remote admin commands
author | sirebral |
---|---|
date | Thu, 08 Oct 2009 04:14:41 -0500 |
parents | eb1b275699c4 |
children | bd6ca89e4cbb |
comparison
equal
deleted
inserted
replaced
109:5eac6e0308df | 110:910942d07574 |
---|---|
659 if len( args ) == 0: | 659 if len( args ) == 0: |
660 #raw command return state info | 660 #raw command return state info |
661 msg = "<br /><b>Remote Administrator Config:</b>" | 661 msg = "<br /><b>Remote Administrator Config:</b>" |
662 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />" | 662 if pass_state != 1 : msg += " Password not set. Remote admin functions disabled<br />" |
663 else: | 663 else: |
664 msg += " Enabled. Using password \""+pwd+"\"<br />" | 664 msg += " Enabled. Using password '"+pwd+"'<br />" |
665 self.chat.SystemPost(msg) | 665 self.chat.SystemPost(msg) |
666 return | 666 return |
667 | 667 |
668 if pass_state != 1 and args[0] != "set": | 668 if pass_state != 1 and args[0] != "set": |
669 #no commands under this point will execute unless an admin password has been previously set | 669 #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!!") | 670 self.chat.SystemPost("Command ignored. No remote administrator password set!!") |
671 return | 671 return |
672 msgbase = "<admin id=\""+self.session.id+"\" group_id=\""+self.session.group_id+"\" pwd=\""+pwd+"\" " | 672 msgbase = "<admin id='"+self.session.id+"' group_id='"+self.session.group_id+"' pwd='"+pwd+"'" |
673 | |
673 if args[0] == "set": | 674 if args[0] == "set": |
674 if len( args ) > 1: | 675 if len( args ) > 1: |
675 self.session.orpgFrame_callback.password_manager.server = str( args[1] ) | 676 self.session.orpgFrame_callback.password_manager.server = str( args[1] ) |
676 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"))+"" ) |
677 else: | 678 else: |
678 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("server") | 679 pwd = self.session.orpgFrame_callback.password_manager.GetPassword("server") |
679 if pwd != None: | 680 if pwd != None: |
680 self.chat.SystemPost( "Remote administration commands using password: \""+pwd+"\"" ) | 681 self.chat.SystemPost( "Remote administration commands using password: "+pwd+"" ) |
681 | 682 |
682 elif args[0] == "ban": | 683 elif args[0] == "ban": |
683 #Ban a player from the server | 684 #Ban a player from the server |
684 msg = msgbase + ' cmd="ban" bid="' + str(args[1]) + '" />' | 685 msg = msgbase + ' cmd="ban" bid="' + str(args[1]) + '" />' |
685 self.session.outbox.put(msg) | 686 self.session.outbox.put(msg) |
686 | 687 |
687 elif args[0] == "banip": | 688 elif args[0] == "banip": |
688 #Ban a player from the server | 689 #Ban a player from the server |
689 try: | 690 try: bname = str(args[2]) |
690 bname = str(args[2]) | 691 except: bname = 'Unknown' |
691 except: | |
692 bname = 'Unknown' | |
693 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>' | 692 msg = msgbase + ' cmd="banip" bip="' + str(args[1]) + '" bname="' + bname + '"/>' |
694 self.session.outbox.put(msg) | 693 self.session.outbox.put(msg) |
695 | 694 |
696 elif args[0] == "unban": | 695 elif args[0] == "unban": |
697 #remove a group from the server and drop all players within the group | 696 #remove a group from the server and drop all players within the group |
703 msg = msgbase + ' cmd="banlist" />' | 702 msg = msgbase + ' cmd="banlist" />' |
704 self.session.outbox.put(msg) | 703 self.session.outbox.put(msg) |
705 | 704 |
706 elif args[0] == "help": | 705 elif args[0] == "help": |
707 #request help from server | 706 #request help from server |
708 msg = msgbase + " cmd=\"help\" />" | 707 msg = msgbase + " cmd='help' />" |
709 self.session.outbox.put(msg) | 708 self.session.outbox.put(msg) |
710 | 709 |
711 elif args[0] == "nameroom": | 710 elif args[0] == "nameroom": |
712 #reqest room renaming on server | 711 #reqest room renaming on server |
713 msg = msgbase + " cmd=\"nameroom\" rmid=\""+ str(args[1])+"\" name=\""+ string.join(args[2:])+"\" />" | 712 msg = msgbase + " cmd='nameroom' rmid="+ str(args[1])+" name="+ string.join(args[2:])+" />" |
714 self.session.outbox.put(msg) | 713 self.session.outbox.put(msg) |
715 | 714 |
716 elif args[0] == "roompasswords": | 715 elif args[0] == "roompasswords": |
717 #reqest room renaming on server | 716 #reqest room renaming on server |
718 msg = msgbase + " cmd=\"roompasswords\"/>" | 717 msg = msgbase + " cmd='roompasswords' />" |
719 self.session.outbox.put(msg) | 718 self.session.outbox.put(msg) |
720 | 719 |
721 elif args[0] == "message": | 720 elif args[0] == "message": |
722 #send message to a specific player on the server via the system administrator | 721 #send message to a specific player on the server via the system administrator |
723 msg = msgbase + " cmd=\"message\" to_id=\""+ str(args[1])+"\" msg=\""+ string.join(args[2:])+"\" />" | 722 msg = msgbase + " cmd='message' to_id='"+ str(args[1])+"' msg='"+ string.join(args[2:])+"' />" |
724 self.session.outbox.put(msg) | 723 self.session.outbox.put(msg) |
725 | 724 |
726 elif args[0] == "broadcast": | 725 elif args[0] == "broadcast": |
727 #send a message to all players on server from the system administrator | 726 #send a message to all players on server from the system administrator |
728 msg = msgbase + " cmd=\"broadcast\" msg=\""+ string.join(args[1:])+"\" />" | 727 msg = msgbase + " cmd='broadcast' msg='"+ string.join(args[1:])+"' />" |
729 self.session.outbox.put(msg) | 728 self.session.outbox.put(msg) |
730 | 729 |
731 elif args[0] == "killgroup": | 730 elif args[0] == "killgroup": |
732 #remove a group from the server and drop all players within the group | 731 #remove a group from the server and drop all players within the group |
733 msg = msgbase + " cmd=\"killgroup\" gid=\""+ str(args[1])+"\" />" | 732 msg = msgbase + " cmd='killgroup' gid='"+ str(args[1])+"' />" |
734 self.session.outbox.put(msg) | 733 self.session.outbox.put(msg) |
735 | 734 |
736 elif args[0] == "uptime": | 735 elif args[0] == "uptime": |
737 #request uptime report from server | 736 #request uptime report from server |
738 msg = msgbase + " cmd=\"uptime\" />" | 737 msg = msgbase + " cmd='uptime' />" |
739 self.session.outbox.put(msg) | 738 self.session.outbox.put(msg) |
740 | 739 |
741 elif args[0] == "createroom": | 740 elif args[0] == "createroom": |
742 #request creation of a (temporary) persistant room | 741 #request creation of a (temporary) persistant room |
743 if len(args) < 2: | 742 if len(args) < 2: |
745 return | 744 return |
746 if len(args) < 3: | 745 if len(args) < 3: |
747 self.chat.SystemPost( "You must supply a boot password also.<br />/admin createroom <name> <boot password> [password]" ) | 746 self.chat.SystemPost( "You must supply a boot password also.<br />/admin createroom <name> <boot password> [password]" ) |
748 return | 747 return |
749 if len(args) < 4: args.append("") | 748 if len(args) < 4: args.append("") |
750 msg = msgbase + " cmd=\"createroom\" name=\""+str(args[1])+"\" boot=\""+ str(args[2])+"\" pass=\""+ str(args[3])+"\" />" | 749 msg = msgbase + " cmd='createroom' name='"+str(args[1])+"' boot='"+ str(args[2])+"' pass='"+ str(args[3])+"' />" |
751 self.session.outbox.put(msg) | 750 self.session.outbox.put(msg) |
752 | 751 |
753 elif args[0] == "passwd": | 752 elif args[0] == "passwd": |
754 #request boot password change on a room | 753 #request boot password change on a room |
755 msg = msgbase + " cmd=\"passwd\" gid=\""+str(args[1])+"\" pass=\""+ str(args[2])+"\" />" | 754 msg = msgbase + " cmd='passwd' gid='"+str(args[1])+"' pass='"+ str(args[2])+"' />" |
756 self.session.outbox.put(msg) | 755 self.session.outbox.put(msg) |
757 | 756 |
758 elif args[0] == "list": | 757 elif args[0] == "list": |
759 #request a list of rooms and players from server | 758 #request a list of rooms and players from server |
760 msg = msgbase + " cmd=\"list\" />" | 759 msg = msgbase + " cmd='list' />" |
761 self.session.outbox.put(msg) | 760 self.session.outbox.put(msg) |
762 | 761 |
763 elif args[0] == "killserver": | 762 elif args[0] == "killserver": |
764 #remotely kill the server | 763 #remotely kill the server |
765 msg = msgbase + " cmd=\"killserver\" />" | 764 msg = msgbase + " cmd='killserver' />" |
766 self.session.outbox.put(msg) | 765 self.session.outbox.put(msg) |
767 | 766 |
768 elif args[0] == "savemaps": | 767 elif args[0] == "savemaps": |
769 msg = msgbase + ' cmd="savemaps" />' | 768 msg = msgbase + ' cmd="savemaps" />' |
770 self.session.outbox.put(msg) | 769 self.session.outbox.put(msg) |
771 | 770 |
772 else: | 771 else: self.chat.InfoPost("Unknown administrator command" ) |
773 self.chat.InfoPost("Unknown administrator command" ) | |
774 except: | 772 except: |
775 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!") | 773 self.chat.InfoPost("An error has occured while processing a Remote Administrator command!") |
776 traceback.print_exc() | 774 traceback.print_exc() |