| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
|   | 
| ##@package GMT_GetFamilyInfo  | 
| # GMÃüÁîÖ´ÐÐ->¼Ò×åÐÅÏ¢  | 
| #  | 
| # @author wdb  | 
| # @date 2012-06-14  | 
| # @version 1.3  | 
| #  | 
| # ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ  | 
| #   | 
| # @note  | 
| # Ä£¿éÏêϸ˵  | 
| # @change: "2012-06-29 21:30" wdb ·µ»ØÐÅÏ¢ÊÇ·ñ¹ý³¤  | 
| # @change: "2012-07-12 18:00" wdb ×Ö·ûת»»ÔÚÈë¿Ú´¦Àí  | 
| # @change: "2016-09-07 03:00" hxp Ôö¼Ó²éѯȫ²¿Õ½ÃË£»Õ½Ã˲éѯ·µ»ØÐÅϢͳһ£»¾«È·²éѯ·µ»Ø³ÉÔ±ÏêÇé  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import GMCommon  | 
| import GameWorld  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö±äÁ¿  | 
| #---------------------------------------------------------------------  | 
| VER = "2016-09-07 03:00"   | 
| #---------------------------------------------------------------------  | 
| #Â߼ʵÏÖ(ÕâÀïcurPlayer = None)  | 
| ## Ö´ÐÐÂß¼  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param gmList [cmdIndex gmAccID forbidAcc]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(orderId, gmCmdDict):  | 
|       | 
|     queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')        | 
|     familyName = gmCmdDict.get(GMCommon.Def_GMKey_FamilyName, '')  | 
|       | 
|     familyInfo = []  | 
|     if queryType != 'all' and familyName == '':  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)  | 
|         return  | 
|       | 
|     # È«Ãû²éѯ  | 
|     if queryType == 'normal':  | 
|         curFamily = GameWorld.GetFamilyManager().FindFamilyByName(familyName)  | 
|         familyInfo.append(GetQueryFamilyInfo(curFamily, True))  | 
|     # Ä£ºý²éѯ  | 
|     elif queryType == 'faintness':  | 
|         for index in range(GameWorld.GetFamilyManager().GetCount()):  | 
|               | 
|             curFamily = GameWorld.GetFamilyManager().GetAt(index)  | 
|   | 
|             if familyName not in curFamily.GetName():  | 
|                 continue  | 
|               | 
|             familyInfo.append(GetQueryFamilyInfo(curFamily, False))  | 
|     # È«²¿  | 
|     elif queryType == 'all':  | 
|         for index in range(GameWorld.GetFamilyManager().GetCount()):  | 
|               | 
|             curFamily = GameWorld.GetFamilyManager().GetAt(index)  | 
|             familyInfo.append(GetQueryFamilyInfo(curFamily, False))  | 
|                     | 
|     if len(familyInfo) > pow(2, 14):  | 
|         #Êý¾Ý¹ý´ó  | 
|         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_MaxLimit)     | 
|         return  | 
|            | 
|     #Ö´Ðгɹ¦  | 
|     GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, familyInfo)          | 
|     return  | 
|   | 
|   | 
| ## »ñµÃÐèÒªµÄÐÅÏ¢  | 
| #  @param gmList   | 
| #  @return None  | 
| def GetQueryFamilyInfo(curFamily, memberDetail):  | 
|     if curFamily == None:  | 
|         return {}   | 
|       | 
|     memberCnt = curFamily.GetCount()  | 
|     memberInfo = []  | 
|     onlineCnt = 0  | 
|       | 
|     # ±éÀú˵ÓгÉÔ±  | 
|     for index in range(memberCnt):  | 
|           | 
|         curMember = curFamily.GetAt(index)  | 
|         player = GameWorld.GetPlayerManager().FindPlayerByID(curMember.GetPlayerID())  | 
|           | 
|         #¡¡ÊÇ·ñÔÚÏß  | 
|         isOnline = 0  | 
|         if player != None:  | 
|             isOnline = 1  | 
|             onlineCnt += 1  | 
|               | 
|         if not memberDetail:  | 
|             continue  | 
|           | 
|         # ³ÉÔ±ÐÅÏ¢  | 
|         member = {  | 
|                   'FamilyLV':curMember.GetFamilyLV(),  | 
|                   'PlayerID':curMember.GetPlayerID(),  | 
|                   'Name':curMember.GetName(),  | 
|                   'ActiveValue':curMember.GetFamilyActiveValue(),  | 
|                   'IsOnLine':isOnline,   | 
|                   }  | 
|         memberInfo.append(member)  | 
|       | 
|     familyInfo = {  | 
|                   'FamilyName':curFamily.GetName(),  | 
|                   'LeaderName':curFamily.GetLeaderName(),  | 
|                   'LV':curFamily.GetLV(),  | 
|                   'Broadcast':curFamily.GetBroadcast(),  | 
|                   'MemberCnt':memberCnt,  | 
|                     | 
|                   'FamilyID':curFamily.GetID(),       | 
|                   'Hornor':curFamily.GetHornor(),       | 
|                   'Money':curFamily.GetMoney(),  | 
|                   'CreateTime':curFamily.GetCreateTime(),  | 
|                   'MemberInfo':memberInfo,  | 
|                   'OnLineCnt':onlineCnt,  | 
|                   }  | 
|           | 
|     return familyInfo  | 
|       | 
|      |