Browse Source

verbose-repository debugging of non-DC server msgs

Darren Ranalli 19 years ago
parent
commit
58800c72a0
2 changed files with 93 additions and 95 deletions
  1. 3 0
      direct/src/distributed/ClientRepositoryBase.py
  2. 90 95
      direct/src/distributed/MsgTypes.py

+ 3 - 0
direct/src/distributed/ClientRepositoryBase.py

@@ -82,6 +82,9 @@ class ClientRepositoryBase(ConnectionRepository):
         else:
             return self.doId2do, self.cache
 
+    def _getMsgName(self, msgId):
+        return makeList(MsgId2Names.get(msgId, 'UNKNOWN MESSAGE: %s' % msgId))[0]
+
     def sendDisconnect(self):
         if self.isConnected():
             # Tell the game server that we're going:

+ 90 - 95
direct/src/distributed/MsgTypes.py

@@ -1,101 +1,96 @@
 """MsgTypes module: contains distributed object message types"""
 
-# 2 new params: passwd, char bool 0/1 1 = new account
-# 2 new return values: 129 = not found, 12 = bad passwd, 
-CLIENT_LOGIN =                                1
-CLIENT_LOGIN_RESP =                           2
-CLIENT_GET_AVATARS =                          3
-# Sent by the server when it is dropping the connection deliberately.
-CLIENT_GO_GET_LOST =                          4
-CLIENT_GET_AVATARS_RESP =                     5
-CLIENT_CREATE_AVATAR =                        6
-CLIENT_CREATE_AVATAR_RESP =                   7
-#Roger wants to remove this CLIENT_GET_SHARD_LIST =                       8
-#Roger wants to remove this CLIENT_GET_SHARD_LIST_RESP =                  9
-CLIENT_GET_FRIEND_LIST =                     10
-CLIENT_GET_FRIEND_LIST_RESP =                11
-#Roger wants to remove this CLIENT_GET_FRIEND_DETAILS =                  12
-#Roger wants to remove this CLIENT_GET_FRIEND_DETAILS_RESP =             13
-CLIENT_GET_AVATAR_DETAILS =                  14
-CLIENT_GET_AVATAR_DETAILS_RESP =             15
-CLIENT_LOGIN_2 =                             16
-CLIENT_LOGIN_2_RESP =                        17
-
-CLIENT_OBJECT_UPDATE_FIELD =                 24
-CLIENT_OBJECT_UPDATE_FIELD_RESP =            24
-CLIENT_OBJECT_DISABLE =                      25
-CLIENT_OBJECT_DISABLE_RESP =                 25
-CLIENT_OBJECT_DISABLE_OWNER =                26
-CLIENT_OBJECT_DISABLE_OWNER_RESP =           26
-CLIENT_OBJECT_DELETE =                       27
-CLIENT_OBJECT_DELETE_RESP =                  27
-CLIENT_SET_ZONE_CMU =                        29
-CLIENT_REMOVE_ZONE =                         30
-CLIENT_SET_AVATAR =                          32
-CLIENT_CREATE_OBJECT_REQUIRED =              34
-CLIENT_CREATE_OBJECT_REQUIRED_RESP =         34
-CLIENT_CREATE_OBJECT_REQUIRED_OTHER =        35
-CLIENT_CREATE_OBJECT_REQUIRED_OTHER_RESP =   35
-CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER      = 36
-CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER_RESP = 36
-
-CLIENT_REQUEST_GENERATES =                   36
-
-CLIENT_DISCONNECT =                          37
-
-#Roger wants to remove this CLIENT_CHANGE_IP_ADDRESS_RESP =              45
-#Roger wants to remove this CLIENT_GET_STATE =                           46
-CLIENT_GET_STATE_RESP =                      47
-CLIENT_DONE_INTEREST_RESP =                  48
+from direct.showbase.PythonUtil import invertDictLossless
+
+MsgName2Id = {
+    # 2 new params: passwd, char bool 0/1 1 = new account
+    # 2 new return values: 129 = not found, 12 = bad passwd, 
+    'CLIENT_LOGIN':                                  1,
+    'CLIENT_LOGIN_RESP':                             2,
+    'CLIENT_GET_AVATARS':                            3,
+    # Sent by the server when it is dropping the connection deliberately.
+    'CLIENT_GO_GET_LOST':                            4,
+    'CLIENT_GET_AVATARS_RESP':                       5,
+    'CLIENT_CREATE_AVATAR':                          6,
+    'CLIENT_CREATE_AVATAR_RESP':                     7,
+    'CLIENT_GET_FRIEND_LIST':                        10,
+    'CLIENT_GET_FRIEND_LIST_RESP':                   11,
+    'CLIENT_GET_AVATAR_DETAILS':                     14,
+    'CLIENT_GET_AVATAR_DETAILS_RESP':                15,
+    'CLIENT_LOGIN_2':                                16,
+    'CLIENT_LOGIN_2_RESP':                           17,
+
+    'CLIENT_OBJECT_UPDATE_FIELD':                    24,
+    'CLIENT_OBJECT_UPDATE_FIELD_RESP':               24,
+    'CLIENT_OBJECT_DISABLE':                         25,
+    'CLIENT_OBJECT_DISABLE_RESP':                    25,
+    'CLIENT_OBJECT_DISABLE_OWNER':                   26,
+    'CLIENT_OBJECT_DISABLE_OWNER_RESP':              26,
+    'CLIENT_OBJECT_DELETE':                          27,
+    'CLIENT_OBJECT_DELETE_RESP':                     27,
+    'CLIENT_SET_ZONE_CMU':                           29,
+    'CLIENT_REMOVE_ZONE':                            30,
+    'CLIENT_SET_AVATAR':                             32,
+    'CLIENT_CREATE_OBJECT_REQUIRED':                 34,
+    'CLIENT_CREATE_OBJECT_REQUIRED_RESP':            34,
+    'CLIENT_CREATE_OBJECT_REQUIRED_OTHER':           35,
+    'CLIENT_CREATE_OBJECT_REQUIRED_OTHER_RESP':      35,
+    'CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER':     36,
+    'CLIENT_CREATE_OBJECT_REQUIRED_OTHER_OWNER_RESP':36,
+
+    'CLIENT_REQUEST_GENERATES':                      36,
+
+    'CLIENT_DISCONNECT':                             37,
+
+    'CLIENT_GET_STATE_RESP':                         47,
+    'CLIENT_DONE_INTEREST_RESP':                     48,
+
+    'CLIENT_DELETE_AVATAR':                          49,
+
+    'CLIENT_DELETE_AVATAR_RESP':                     5,
+
+    'CLIENT_HEARTBEAT':                              52,
+    'CLIENT_FRIEND_ONLINE':                          53,
+    'CLIENT_FRIEND_OFFLINE':                         54,
+    'CLIENT_REMOVE_FRIEND':                          56,
+
+    'CLIENT_CHANGE_PASSWORD':                        65,
+
+    'CLIENT_SET_NAME_PATTERN':                       67,
+    'CLIENT_SET_NAME_PATTERN_ANSWER':                68,
+
+    'CLIENT_SET_WISHNAME':                           70,
+    'CLIENT_SET_WISHNAME_RESP':                      71,
+    'CLIENT_SET_WISHNAME_CLEAR':                     72,
+    'CLIENT_SET_SECURITY':                           73,
+
+    'CLIENT_SET_DOID_RANGE':                         74,
+
+    'CLIENT_GET_AVATARS_RESP2':                      75,
+    'CLIENT_CREATE_AVATAR2':                         76,
+    'CLIENT_SYSTEM_MESSAGE':                         78,
+    'CLIENT_SET_AVTYPE':                             80,
+
+    'CLIENT_GET_PET_DETAILS':                        81,
+    'CLIENT_GET_PET_DETAILS_RESP':                   82,
+
+    'CLIENT_ADD_INTEREST':                           97,
+    'CLIENT_REMOVE_INTEREST':                        99,
+    'CLIENT_OBJECT_LOCATION':                        102,
+
+    'CLIENT_LOGIN_3':                                111,
+    'CLIENT_LOGIN_3_RESP':                           110,
+
+    'CLIENT_GET_FRIEND_LIST_EXTENDED':               115,
+    'CLIENT_GET_FRIEND_LIST_EXTENDED_RESP':          116,
+    }
+
+# create id->name table for debugging
+MsgId2Names = invertDictLossless(MsgName2Id)
     
-CLIENT_DELETE_AVATAR =                       49
-
-# I think this is 5 to look like a CLIENT_GET_AVATARS_RESP
-# which is really what the server sends us when we delete an avatar
-CLIENT_DELETE_AVATAR_RESP =                  5
-
-CLIENT_HEARTBEAT =                           52
-CLIENT_FRIEND_ONLINE =                       53
-CLIENT_FRIEND_OFFLINE =                      54
-CLIENT_REMOVE_FRIEND =                       56
-
-#Roger wants to remove this CLIENT_SERVER_UP =                           57
-#Roger wants to remove this CLIENT_SERVER_DOWN =                         58
-
-CLIENT_CHANGE_PASSWORD =                     65
-
-CLIENT_SET_NAME_PATTERN =                    67
-CLIENT_SET_NAME_PATTERN_ANSWER =             68
-
-CLIENT_SET_WISHNAME =                        70
-CLIENT_SET_WISHNAME_RESP =                   71
-CLIENT_SET_WISHNAME_CLEAR =                  72
-CLIENT_SET_SECURITY =                        73
-
-CLIENT_SET_DOID_RANGE =                      74
-
-CLIENT_GET_AVATARS_RESP2 =                   75
-CLIENT_CREATE_AVATAR2 =                      76
-CLIENT_SYSTEM_MESSAGE =                      78
-CLIENT_SET_AVTYPE =                          80
-
-CLIENT_GET_PET_DETAILS =                     81
-CLIENT_GET_PET_DETAILS_RESP =                82
-
-# (Proposed new message): CLIENT_SET_WORLD_POS =                       83
-CLIENT_ADD_INTEREST =                        97
-# This is no longer supported. Alter just calls ADD_INTEREST
-# CLIENT_ALTER_INTEREST =                      98
-CLIENT_REMOVE_INTEREST =                     99
-#Roger wants to remove this CLIENT_QUERY_ONE_FIELD =                    101
-CLIENT_OBJECT_LOCATION =                    102
-#Roger wants to remove this CLIENT_QUERY_ONE_FIELD_RESP =               103
-
-CLIENT_LOGIN_3 =                             111
-CLIENT_LOGIN_3_RESP =                        110
-
-CLIENT_GET_FRIEND_LIST_EXTENDED =            115
-CLIENT_GET_FRIEND_LIST_EXTENDED_RESP =       116
+# put msg names in module scope, assigned to msg value
+for name, value in MsgName2Id.items():
+    exec '%s = %s' % (name, value)
 
 # These messages are ignored when the client is headed to the quiet zone
 QUIET_ZONE_IGNORED_LIST = [