xdh
2018-11-19 76aaa2bc9a47e1896638740312affe1ec61f2334
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
#!/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
    
    topNum = GameWorld.ToIntDef(gmCmdDict.get('topNum', ''), 10)
    
    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
 
    billBoardInfo = []
    
    for index in range(0, billBoard.GetCount()):
        
        if index >= topNum:
            break
        
        billBoardData = billBoard.At(index)
        if not billBoardData:
            continue
        
        billBoardDict = {
                        "ID":billBoardData.GetID(),
                        "ID2":billBoardData.GetID2(),
                        "Name1":billBoardData.GetName1(),
                        "Name2":billBoardData.GetName2(),
                        "Type2":billBoardData.GetType2(),
                        "Value1":billBoardData.GetValue1(),
                        "Value2":billBoardData.GetValue2(),
                        "CmpValue":billBoardData.GetCmpValue(),
                        "CmpValue2":billBoardData.GetCmpValue2(),
                        "CmpValue3":billBoardData.GetCmpValue3(),
                         }
        
        billBoardInfo.append(billBoardDict)
    
    if len(billBoardInfo) > pow(2, 14):
        #Êý¾Ý¹ý´ó
        GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_MaxLimit)   
        return
      
    #Ö´Ðгɹ¦
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, billBoardInfo)        
    return