| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package GMT_CTG  | 
| # GMÃüÁîCTG  | 
| #  | 
| # @author whx  | 
| # @date 2012-08-27 13:59  | 
| # @version 1.0  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| # Ä£¿éÏêϸ˵  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import GMCommon  | 
| import ChConfig  | 
| import GameWorld  | 
| import PyGameData  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö±äÁ¿  | 
| #---------------------------------------------------------------------  | 
| """Version = 2012-08-27 13:59"""  | 
| #---------------------------------------------------------------------  | 
|   | 
|   | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param gmCmdDict: ÃüÁî×Öµä  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(orderId, gmCmdDict):  | 
|     queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')  | 
|     playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')  | 
|     value = gmCmdDict.get('value', '')  | 
|     appID = gmCmdDict.get('appID', '')  | 
|     isAddBourseMoney = GameWorld.ToIntDef(gmCmdDict.get('isAddBourseMoney', ''), 0)  | 
|       | 
|     tagPlayer = None  | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|       | 
|     if queryType == GMCommon.Def_GMKey_PlayerAccID:  | 
|         queryType = ChConfig.queryType_sqtPlayerByAccID  | 
|         tagPlayer = playerManager.FindPlayerByAccID(str(playerFind))  | 
|       | 
|     elif queryType == GMCommon.Def_GMKey_PlayerName:  | 
|         queryType = ChConfig.queryType_sqtPlayerByName  | 
|         tagPlayer = playerManager.FindPlayerByName(str(playerFind))  | 
|       | 
|     else:  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)  | 
|         return  | 
|       | 
|     if not tagPlayer:  | 
|         # Íæ¼Ò²»ÔÚÏߣ¬ÏȼǼ£¬µÈÍæ¼ÒÉÏÏߺó´¦Àí  | 
|         key = (queryType, playerFind)  | 
|         ctgInfoList = PyGameData.g_ctgOfflinePlayerInfo.get(key, [])  | 
|         ctgInfoList.append(gmCmdDict)  | 
|         PyGameData.g_ctgOfflinePlayerInfo[key] = ctgInfoList  | 
|         GameWorld.Log("ÀëÏßCTG: g_ctgOfflinePlayerInfo=%s" % str(PyGameData.g_ctgOfflinePlayerInfo))  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success)  | 
|         return  | 
|       | 
|     GMCommon.GMTool_MapServer_Query(queryType, orderId, playerFind, gmCmdDict, 'GMTCTG', [orderId, value, appID, isAddBourseMoney, True], False)  | 
|     return  | 
|   | 
| def OnPlayerLogin(curPlayer):  | 
|     ctgList = []  | 
|     nameKey = (ChConfig.queryType_sqtPlayerByName, curPlayer.GetName())  | 
|     if nameKey in PyGameData.g_ctgOfflinePlayerInfo:  | 
|         ctgList += PyGameData.g_ctgOfflinePlayerInfo.pop(nameKey)  | 
|           | 
|     accIDKey = (ChConfig.queryType_sqtPlayerByAccID, curPlayer.GetAccID())  | 
|     if accIDKey in PyGameData.g_ctgOfflinePlayerInfo:  | 
|         ctgList += PyGameData.g_ctgOfflinePlayerInfo.pop(accIDKey)  | 
|           | 
|     if not ctgList:  | 
|         return  | 
|       | 
|     tagMapID = curPlayer.GetRealMapID()  | 
|     GameWorld.Log("ÀëÏßÍæ¼ÒÉÏÏßCTG: tagMapID=%s, %s" % (tagMapID, ctgList), curPlayer.GetPlayerID())  | 
|     if not tagMapID:  | 
|         return  | 
|       | 
|     playerManager = GameWorld.GetPlayerManager()  | 
|     for gmCmdDict in ctgList:  | 
|         orderId = gmCmdDict.get('orderId', '')  | 
|         value = gmCmdDict.get('value', '')  | 
|         appID = gmCmdDict.get('appID', '')  | 
|         isAddBourseMoney = GameWorld.ToIntDef(gmCmdDict.get('isAddBourseMoney', ''), 0)  | 
|         cmdStr = str([orderId, value, appID, isAddBourseMoney, False])  | 
|         playerManager.MapServer_QueryPlayer(0, 0, curPlayer.GetPlayerID(), tagMapID, 'GMTCTG',   | 
|                                             cmdStr, len(cmdStr), curPlayer.GetRouteServerIndex())  | 
|     return  | 
|   |