comparison orpg/main.py @ 118:217fb049bd00 alpha

Traipse Alpha 'OpenRPG' {091028-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
author sirebral
date Wed, 28 Oct 2009 14:24:54 -0500
parents 0f18d16f3fe7
children 9314d63c0941
comparison
equal deleted inserted replaced
117:0f18d16f3fe7 118:217fb049bd00
60 from orpg.tools.passtool import PassTool 60 from orpg.tools.passtool import PassTool
61 from orpg.tools.orpg_log import logger, crash 61 from orpg.tools.orpg_log import logger, crash
62 from orpg.tools.decorators import debugging 62 from orpg.tools.decorators import debugging
63 from orpg.tools.metamenus import MenuBarEx 63 from orpg.tools.metamenus import MenuBarEx
64 64
65 #from xml.etree.ElementTree import ElementTree, Element 65 from xml.etree.ElementTree import ElementTree, Element, iselement
66 #from xml.etree.ElementTree import fromstring, tostring 66 from xml.etree.ElementTree import fromstring, tostring
67 from orpg.orpg_xml import xml #to be replaced by etree 67 from orpg.orpg_xml import xml #to be replaced by etree
68 68
69 69
70 #################################### 70 ####################################
71 ## Main Frame 71 ## Main Frame
970 for m in ignore_id: 970 for m in ignore_id:
971 if m == player[2]: logger.debug("ignoring message from player:" + player[0], True); return 971 if m == player[2]: logger.debug("ignoring message from player:" + player[0], True); return
972 972
973 # ok we are not ignoring this message 973 # ok we are not ignoring this message
974 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below 974 #recvSound = "RecvSound" # this will be the default sound. Whisper will change this below
975 if player: display_name = self.chat.chat_display_name(player) 975 ### Alpha ###
976 else: display_name = "Server Administrator" 976 etreeEl = Element('msg')
977 977 try: etreeEl.append(fromstring(data))
978 if data[:5] == "<tree": 978 except: etreeEl.text = data
979 ### Alpha ### Allows users to decide if they want the node or not. 979 ### Remove after Element Tree is integrated further ###
980 dlg = wx.MessageDialog(None, display_name + 'is trying to send you a tree node. Accept?', 'Question', 980 if player:
981 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION) 981 display_name = self.chat.chat_display_name(player)
982 if dlg.ShowModal() == wx.ID_YES:
983 dlg.Destroy()
984 self.tree.on_receive_data(data,player)
985 self.chat.InfoPost(display_name + " has sent you a tree node...")
986
987 elif data[:4] == "<map": self.map.new_data(data)
988
989 elif data[:5] == "<chat":
990 msg = orpg.chat.chat_msg.chat_msg(data)
991 self.chat.post_incoming_msg(msg,player)
992 else: 982 else:
993 """ 983 display_name = "Server Administrator"
994 all this below code is for comptiablity with older clients and can 984
995 be removed after a bit 985 if etreeEl.text:
996 """ 986 self.chat.Post(etreeEl.text)
997 import warnings 987
998 warnings.warn("Getting here is bad, find out how and fix it", 988 for child in etreeEl.getchildren():
999 DeprecationWarning, 2) 989 if child.tag == 'tree':
1000 if data[:3] == "/me": 990 ### Alpha ### Allows users to decide if they want the node or not.
1001 """ 991 dlg = wx.MessageDialog(None, display_name + 'is trying to send you a tree node. Accept?', 'Question',
1002 This fixes the emote coloring to comply with what has been 992 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION)
1003 asked for by the user population, not to mention, what I 993 if dlg.ShowModal() == wx.ID_YES:
1004 committed to many moons ago. In doing so, Woody's scheme has 994 dlg.Destroy()
1005 been tossed out. I'm sure Woody won't be happy but I'm 995 self.tree.on_receive_data(data,player)
1006 invoking developer priveledge to satisfy user request, not to 996 self.chat.InfoPost(display_name + " has sent you a tree node...")
1007 mention, this scheme actually makes more sense. In Woody's 997 ### Core ### to be milked in later.
1008 scheme, a user could over-ride another users emote color. This 998 #TODO: Fix game tree to accepts elements
1009 doesn't make sense, rather, people dictate their OWN colors... 999 #self.tree.on_receive_data(child, player)
1010 which is as it should be in the first place and is as it has 1000 #self.chat.InfoPost(display_name + " has sent you a tree node...")
1011 been with normal text. In short, this makes sense and is 1001
1012 consistent. 1002 elif child.tag == 'map':
1013 """ 1003 ### Core ### Adapted from, remove tostring later
1014 data = data.replace( "/me", "" ) 1004 #TODO: Fix map to accepts elements
1015 """ 1005 self.map.new_data(tostring(child))
1016 Check to see if we find the closing '>' for the font within the 1006
1017 first 22 values 1007 elif child.tag == 'chat':
1018 """ 1008 msg = orpg.chat.chat_msg.chat_msg(data)
1019 index = data[:22].find( ">" ) 1009 self.chat.post_incoming_msg(msg,player)
1020 if index == -1: 1010 ### Core ### to be milked in later
1021 data = "** " + self.chat.colorize( self.chat.infocolor, display_name + data ) + " **" 1011 #msg = orpg.chat.chat_msg.chat_msg()
1022 1012 #msg.takedom(child)
1023 else: 1013 #self.chat.post_incoming_msg(msg, player)
1024 """ 1014
1025 This means that we found a valid font string, so we can
1026 simply plug the name into the string between the start and
1027 stop font delimiter
1028 """
1029 print "pre data = " + data
1030 data = data[:22] + "** " + display_name + " " + data[22:] + " **"
1031 print "post data = " + data
1032
1033 elif data[:2] == "/w":
1034 data = data.replace("/w","")
1035 data = "<b>" + display_name + "</b> (whispering): " + data
1036
1037 else:
1038 # Normal text
1039 if player: data = "<b>" + display_name + "</b>: " + data
1040 else: data = "<b><i><u>" + display_name + "</u>-></i></b> " + data
1041 self.chat.Post(data)
1042 1015
1043 @debugging 1016 @debugging
1044 def on_mplay_event(self, evt): 1017 def on_mplay_event(self, evt):
1045 id = evt.get_id() 1018 id = evt.get_id()
1046 if id == orpg.networking.mplay_client.MPLAY_CONNECTED: 1019 if id == orpg.networking.mplay_client.MPLAY_CONNECTED: