diff orpg/networking/mplay_client.py @ 151:06f10429eedc alpha

Traipse Alpha 'OpenRPG' {091125-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 Gametree Recursion method, mapping, and context sensitivity. !Infinite Loops return error instead of freezing the software! New Syntax added for custom PC sheets Tip of the Day added, from Core and community Fixed Whiteboard ID to prevent random line or text deleting. Modified ID's to prevent non updated clients from ruining the fix.
author sirebral
date Wed, 25 Nov 2009 06:15:49 -0600
parents 067922263f07
children b633f4c64aae 81d0bfd5e800
line wrap: on
line diff
--- a/orpg/networking/mplay_client.py	Tue Nov 24 17:17:42 2009 -0600
+++ b/orpg/networking/mplay_client.py	Wed Nov 25 06:15:49 2009 -0600
@@ -84,7 +84,6 @@
 
 def parseXml(data):
     "parse and return doc"
-    #print data
     doc = xml.parseXml(data)
     doc.normalize()
     return doc
@@ -268,7 +267,6 @@
         self.startedEvent.set()
 
     def disconnect(self):
-        debug()
         self.set_status(MPLAY_DISCONNECTING)
         self.log_msg("client stub " + self.ip +" disconnecting...")
         self.log_msg("closing sockets...")
@@ -291,6 +289,7 @@
     def use_roles(self):
         if self.useroles: return 1
         else: return 0
+
     def update_self_from_player(self, player):
         try: (self.name, self.ip, self.id, 
                 self.text_status, self.version, 
@@ -315,15 +314,12 @@
         el.set('client_string', self.client_string)
         el.set('useCompression', str(self.useCompression))
         cmpType = 'None'
-        if cmpBZ2 and (self.compressionType == 'Undefined' or self.compressionType == bz2):
-            cmpType = 'bz2'
-        elif cmpZLIB and (self.compressionType == 'Undefined' or self.compressionType == zlib):
-            cmpType = 'zlib'
+        if cmpBZ2 and (self.compressionType == 'Undefined' or self.compressionType == bz2): cmpType = 'bz2'
+        elif cmpZLIB and (self.compressionType == 'Undefined' or self.compressionType == zlib): cmpType = 'zlib'
         el.set('cmpType', cmpType)
         return tostring(el)
 
     def log_msg(self,msg):
-        debug(msg, log=False)
         if self.log_console: self.log_console(msg)
 
     def get_status(self):
@@ -525,10 +521,6 @@
         el.set('boot_pwd', boot_pwd)
         self.send(tostring(el), id)
 
-#---------------------------------------------------------
-# [START] Snowdog Password/Room Name altering code 12/02
-#---------------------------------------------------------
-
     def set_room_pass(self, npwd, pwd=""):
         el = Element('alter')
         el.set('key', 'pwd')
@@ -576,10 +568,6 @@
         self.outbox.put(tostring(el))
         self.update()
 
-#---------------------------------------------------------
-# [END] Snowdog Password/Room Name altering code  12/02
-#---------------------------------------------------------
-
     def display_roles(self):
         el = Element('role')
         el.set('action', 'display')
@@ -681,19 +669,18 @@
             end = data.find(">")
             head = data[:end+1]
             msg = data[end+1:]
-            ### Alpha ###
+            ### This if statement should help close invalid messages. ###
             if head[end:] != '/':
                 if head[end:] != '>': head = head[:end] + '/>' 
-            ### This if statement should help close invalid messages.  Since it needs fixing, use the try except message for now.
             try: el = fromstring(head)
             except: el = fromstring(head[:end] +'/>')
+            ###########
 
             try:
                 el1 = fromstring(msg)
                 el.append(el1)
             except ExpatError:
                 el.text = msg
-                #logger.general("Bad Message: \n" + data)
         id = el.get('from') or el.get('id')
         if el.tag in self.msg_handlers: self.msg_handlers[el.tag](id, data, el)
 
@@ -718,10 +705,10 @@
         elif self.is_valid_id(id): self.on_receive(msg, self.players[id])
 
     def on_ping(self, id, msg, etreeEl):
-        #a REAL ping time implementation by Snowdog 8/03
+        # A REAL ping time implementation by Snowdog 8/03
         # recieves special server <ping time="###" /> command
         # where ### is a returning time from the clients ping command
-        #get current time, pull old time from object and compare them
+        # get current time, pull old time from object and compare them
         # the difference is the latency between server and client * 2
         ct = time.clock()
         ot = etreeEl.get("time")
@@ -772,7 +759,6 @@
             self.clear_players()
             self.on_mplay_event(mplay_event(MPLAY_GROUP_CHANGE, self.groups[self.group_id]))
             self.players[self.id] = self.get_my_info() 
-            #(self.name,self.ip,self.id,self.text_status)
             self.on_player_event(mplay_event(PLAYER_NEW, self.players[self.id]))
         elif act == "failed":
             self.on_mplay_event(mplay_event(MPLAY_GROUP_CHANGE_F))