hxp
4 天以前 a7ab0247c7b8eff06ad104bee39bc035384ca43e
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py
@@ -794,6 +794,42 @@
    GameWorld.DebugLog("背包类型初始格子数: packType=%s,initCount=%s" % (packType, initCount))
    return initCount
def GetPackOpenItemCnt(curPlayer, packType):
    ## 获取对应背包已购买的格子数
    openCntDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 3, {})
    if str(packType) not in openCntDict:
        return 0
    openCntList = openCntDict[str(packType)]
    if not openCntList:
        return 0
    buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PackBuyCnt % packType)
    openCnt = sum(openCntList[:buyCnt])
    if buyCnt > len(openCntList):
        addCnt = (buyCnt - len(openCntList)) * openCntList[-1]
        openCnt += addCnt
    return openCnt
def SyncPackBuyCnt(curPlayer, packType=None):
    ## 同步已购买格子次数信息
    openCntDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 3, {})
    if not openCntDict:
        return
    syncTypeList = [str(packType)] if packType else openCntDict.keys()
    clientPack = ChPyNetSendPack.tagSCPackBuyInfo()
    clientPack.BuyInfoList = []
    for packTypeStr in syncTypeList:
        packType = int(packTypeStr)
        buy = ChPyNetSendPack.tagSCPackBuy()
        buy.PackType = packType
        buy.BuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PackBuyCnt % packType)
        clientPack.BuyInfoList.append(buy)
    clientPack.Count = len(clientPack.BuyInfoList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
## 获得虚拟背包格子数
#  @param packindex 背包索引
#  @return 背包格子数