hxp
2019-09-20 67bcc2ab06912fc3d9cf31ceae533da76e50d5ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/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