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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GM.Commands.GMT_QueryBillboard
#
# @todo:²éѯÅÅÐаñ
# @author hxp
# @date 2015-5-25
# @version 1.0
#
# @change: "2015-06-23 10:30" hxp Ôö¼Ó·µ»ØType2ÐÅÏ¢
#
# ÏêϸÃèÊö: ²éѯÅÅÐаñ
#
#---------------------------------------------------------------------
"""Version = 2015-06-23 10:30"""
#---------------------------------------------------------------------
 
 
#µ¼Èë
import ShareDefine
import GMCommon
import GameWorld
 
 
#Âß¼­ÊµÏÖ(ÕâÀïcurPlayer = None)
## Ö´ÐÐÂß¼­
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param gmList [cmdIndex gmAccID forbidAcc]
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(orderId, gmCmdDict):
    billBoardType = GameWorld.ToIntDef(gmCmdDict.get('billboardType', ''), None)
    billType = GameWorld.ToIntDef(gmCmdDict.get('billType', ''), None) # ÆäËûÖ¸¶¨ÀàÐÍ
    if billType != None:
        billBoardType = billType
    
    queryCount = GameWorld.ToIntDef(gmCmdDict.get('queryCount', ''), 10)
    startRank = GameWorld.ToIntDef(gmCmdDict.get('startRank', ''), 1)
    startRank = max(1, startRank)
    
    if billBoardType == None:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_TypeNumErr)
        return
        
    if billBoardType < 0 or billBoardType >= ShareDefine.Def_BT_Max:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_TypeNumErr)
        return
    
    billBoard = GameWorld.GetBillboard().FindBillboard(billBoardType)
    if not billBoard:
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_TypeNumErr)
        return False
    
    dataTotal = billBoard.GetCount()
    fromIndex = startRank - 1
    toIndex = fromIndex + queryCount
    billBoardInfo = []
    for index in xrange(fromIndex, toIndex):
        if index >= dataTotal:
            break
        
        billBoardData = billBoard.At(index)
        if not billBoardData:
            continue
        
        rank = index + 1
        billBoardDict = {
                        "Rank":rank,
                        "ID":billBoardData.GetID(),
                        "ID2":billBoardData.GetID2(),
                        "Name1":billBoardData.GetName1(),
                        "Name2":billBoardData.GetName2(),
                        "Type2":billBoardData.GetType2(),
                        "Value1":billBoardData.GetValue1(),
                        "Value2":billBoardData.GetValue2(),
                        "Value3":billBoardData.GetValue3(),
                        "Value4":billBoardData.GetValue4(),
                        "Value5":billBoardData.GetValue5(),
                        "Value6":billBoardData.GetValue6(),
                        "Value7":billBoardData.GetValue7(),
                        "Value8":billBoardData.GetValue8(),
                        "CmpValue":billBoardData.GetCmpValue(),
                        "CmpValue2":billBoardData.GetCmpValue2(),
                        "CmpValue3":billBoardData.GetCmpValue3(),
                        "UserData":billBoardData.GetUserData(),
                         }
        
        billBoardInfo.append(billBoardDict)
    
    if len(billBoardInfo) > pow(2, 14):
        #Êý¾Ý¹ý´ó
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_MaxLimit)   
        return
    
    backMsg = {"BillBoardType":billBoardType, "BillBoardInfo":billBoardInfo, "dataTotal":dataTotal}
    #Ö´Ðгɹ¦
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, backMsg)        
    return