changeset 230:2e2281ed40a9 alpha

Traipse Alpha 'OpenRPG' {100613-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 (Preparing to close updates) New Features: New to Map, can re-order Grid, Miniatures, and Whiteboard layer draw order Fixes: Fix to InterParse that was causing an Infernal Loop with Namespace Internal Fix to XML data, removed old Minidom and switched to Element Tree Fix to Server that was causing eternal attempt to find a Server ID, in Register Rooms thread Fix to metaservers.xml file not being created
author sirebral
date Sun, 13 Jun 2010 19:06:02 -0500
parents 1645a78a33a4
children cc7629ab526d
files orpg/networking/meta_server_lib.py orpg/networking/mplay_server.py orpg/orpg_version.py orpg/templates/nodes/4e_char_sheet.xml
diffstat 4 files changed, 41 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/orpg/networking/meta_server_lib.py	Sat Jun 12 04:46:16 2010 -0500
+++ b/orpg/networking/meta_server_lib.py	Sun Jun 13 19:06:02 2010 -0500
@@ -273,6 +273,7 @@
         self.destroy = 0                        #  Used to flag that this thread should die
         self.port = str(port)
         self.register_callback = register_callback  # set a method to call to report result of register
+        self.IdAttempts = 0
         """
           This thread will communicate with one and only one
           Meta.  If the Meta in ini.xml is changed after
@@ -447,7 +448,7 @@
             #  If there is a DOM returned ....
             if etreeEl != None:
                 #  If there's an error, echo it to the console
-                print tostring(etreeEl)
+                print tostring(etreeEl), path.get('url')
                 if etreeEl.get("errmsg") != None:
                     print "Error durring registration:  " + etreeEl.get("errmsg")
                     if META_DEBUG: print data
--- a/orpg/networking/mplay_server.py	Sat Jun 12 04:46:16 2010 -0500
+++ b/orpg/networking/mplay_server.py	Sun Jun 13 19:06:02 2010 -0500
@@ -650,10 +650,28 @@
         rooms = ''
         serverId = '0'
         x = 0
+        cache = {}
         for meta in self.metas.keys():
-            while serverId == '0':
+        # There is no point in wasting our planetary resources on attempting to register rooms to a meta
+        # that does not provide that service. When they eventually get their head out of the elitist clouds
+        # this work around can be removed.
+            if meta.get('url') != 'http://orpgmeta.appspot.com':
+                cache[meta] = self.metas[meta]
+        for meta in cache.keys():
+            self.log_msg("Registering rooms too: " +meta.get('url'))
+            self.log_msg("Obtaining Server ID from: " +meta.get('url'))
+            for x in range (1, 100):
                 serverId, cookie = self.metas[meta].getIdAndCookie()
+            if serverId == '0':
+                self.metas[meta].IdAttempts += 100
+                if self.metas[meta].IdAttempts > 1000:
+                    self.metas[meta].unregister()
+                    self.log_msg("Deleting Meta: " +meta.get('url')+ " after 1000 attempts.")
+                    del self.metas[meta]
+                    break
             if serverId != '0':
+                self.log_msg("Obtained Server ID: " +serverId+ " from: " +meta.get('url'))
+                self.metas[meta].IdAttempts = 0
                 for rnum in self.groups.keys():
                     rooms += urllib.urlencode({"room_data[rooms][" +str(rnum)+ "][name]":self.groups[rnum].name,
                                             "room_data[rooms][" +str(rnum)+ "][pwd]":str(self.groups[rnum].pwd != ""),
@@ -692,12 +710,14 @@
             if not meta in metalist:  # if the meta entry running is not in the list
                 if self.show_meta_messages != 0: self.log_msg( "Outdated.  Unregistering and removing")
                 self.metas[meta].unregister()
+                self.log_msg("Unregistering from: " +meta.get('url'))
                 del self.metas[meta]
             else: 
                 if self.show_meta_messages != 0: self.log_msg( "Found in current meta list.  Leaving intact.")
 
         #  Now call register() for alive metas or start one if we need one
         for meta in metalist:
+            self.log_msg("Registering too: " +meta.get('url'))
             if (self.metas.has_key(meta) and self.metas[meta] and self.metas[meta].isAlive()):
                 self.metas[meta].register(name=name, 
                                         realHostName=self.server_address, 
@@ -722,8 +742,9 @@
         #  Instead, loop through all existing meta threads and unregister them
         """
 
-        for meta in self.metas.values():
-            if meta and meta.isAlive(): meta.unregister()
+        for meta in self.metas.keys():
+            self.log_msg("Unregistering from: " +meta.get('url'))
+            if self.metas[meta] and self.metas[meta].isAlive(): self.metas[meta].unregister()
         self.be_registered = 0
 
         """
@@ -1817,30 +1838,32 @@
         act = xml_dom.get("action")
         group_id = self.players[id].group_id
         ip = self.players[id].ip
-        self.log_msg("Player with IP: " + str(ip) + " joined.")
         ServerPlugins.setPlayer(self.players[id])
         self.send_to_group(id,group_id,data)
         if act=="new":
             try:
                 self.send_player_list(id,group_id)
                 self.send_group_list(id)
+                self.log_msg("Player with IP: " + str(ip) + " connected.")
             except Exception, e: self.log_msg( ('exception', str(e)) ); traceback.print_exc()
         elif act=="del":
             self.del_player(id,group_id)
             self.check_group(id, group_id)
+            self.log_msg("Player with IP: " + str(ip) + " disconnected.")
         elif act=="update":
             self.players[id].take_dom(xml_dom)
+            self.log_msg("Player with IP: " + str(ip) + " updated.")
             self.log_msg(("update", {"id": id,
-                                     "name": xml_dom.get("name"),
-                                     "status": xml_dom.get("status"),
-                                     "role": xml_dom.get("role"),
-				     "ip":  str(ip),
-				     "group": xml_dom.get("group_id"),
-				     "room": xml_dom.get("name"),
-				     "boot": xml_dom.get("rm_boot"),
-				     "version": xml_dom.get("version"),
-				     "ping": xml_dom.get("time") \
-                                     }))
+                                    "name": xml_dom.get("name"),
+                                    "status": xml_dom.get("status"),
+                                    "role": xml_dom.get("role"),
+                                    "ip":  str(ip),
+                                    "group": xml_dom.get("group_id"),
+                                    "room": xml_dom.get("name"),
+                                    "boot": xml_dom.get("rm_boot"),
+                                    "version": xml_dom.get("version"),
+                                    "ping": xml_dom.get("time") \
+                                                 }))
 
     def strip_cheat_roll(self, string):
         try:
--- a/orpg/orpg_version.py	Sat Jun 12 04:46:16 2010 -0500
+++ b/orpg/orpg_version.py	Sun Jun 13 19:06:02 2010 -0500
@@ -4,7 +4,7 @@
 #BUILD NUMBER FORMAT: "YYMMDD-##" where ## is the incremental daily build index (if needed)
 DISTRO = "Traipse Alpha"
 DIS_VER = "Ornery Orc"
-BUILD = "100612-02"
+BUILD = "100613-00"
 
 # This version is for network capability.
 PROTOCOL_VERSION = "1.2"
--- a/orpg/templates/nodes/4e_char_sheet.xml	Sat Jun 12 04:46:16 2010 -0500
+++ b/orpg/templates/nodes/4e_char_sheet.xml	Sun Jun 13 19:06:02 2010 -0500
@@ -104,7 +104,7 @@
       <cell>Total</cell>
       <cell>!=AC Bonus::(3,2)=!+!=AC Bonus::(4,2)=!</cell>
     </row>
-  <row version="1.0"><cell>Armor</cell><cell>!!Armor::(2,2)!!</cell></row><row version="1.0"><cell>Misc</cell><cell>0</cell></row><row version="1.0"><cell /><cell /></row><row version="1.0"><cell /><cell /></row><row version="1.0"><cell /><cell /></row></grid>
+  <row version="1.0"><cell>Armor</cell><cell>!=Armor::(2,2)=!</cell></row><row version="1.0"><cell>Misc</cell><cell>0</cell></row><row version="1.0"><cell /><cell /></row><row version="1.0"><cell /><cell /></row><row version="1.0"><cell /><cell /></row></grid>
   <macros>
     <macro name="" />
   </macros>