#!/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
|
|
|
|