hxp
4 天以前 a7ab0247c7b8eff06ad104bee39bc035384ca43e
80 【常规】背包-服务端(增加背包购买格子;)
7个文件已修改
1个文件已删除
849 ■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ResetPack.py 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/ItemCommon.py 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py 212 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerExpandPackCfgMgr.py 262 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -1019,10 +1019,6 @@
#流向记录变更最小金币值(小于该值的暂不记录, 仅限金币)
Def_DRRecord_Min_Silver = 500000
Def_LargeTrade_Silver = 1000 * 1000
#登陆初始储物柜格子数
Def_PackCnt_Fashion = 1
#登陆初始武器时装格子数
Def_PackCnt_WeaponCoat = 8
#玩家脱离战斗状态时间(6秒)
Def_PlayerLeaveBattleTick = 3000
#玩家PK多杀间隔
@@ -3334,13 +3330,7 @@
Def_Player_Dict_Wallow_LV = "GameWallowLV_34"    #防沉迷等级
Def_Player_Dict_Wallow_OfflineTime = "GameWallowOfflineTime_35"    #防沉迷离线累积时间
Def_Player_Dict_Wallow_OnlineTime = "GameWallowOnlineTime_36"    #防沉迷在线累积时间
Def_Player_Dict_CabinetCount_Pet = "CabinetCount_Pet_39"    #宠物收纳柜
Def_Player_Dict_CabinetCount_WeaponCoat = "CabinetCount_WeaponCoat_40"    #武器收纳柜
Def_Player_Dict_CabinetCount_DressCoat = "CabinetCount_DressCoat_41"     #时装收纳柜
Def_Player_Dict_CabinetCount_Horse = "CabinetCount_Horse_42"    #马匹收纳柜
Def_Player_Dict_PackCount_Item = "PackCount_Item_72"    #玩家物品背包格子数
Def_Player_Dict_PackCount_Warehouse = "PackCount_Warehouse_73"    #仓库背包格子数
Def_Player_Dict_PackCount_Hero = "PackCount_Hero"    #武将背包格子数
Def_Player_Dict_PackBuyCnt = "PackBuyCnt_%s"    #背包已购买格子次数, 参数(背包类型)
Def_Player_Dict_PlayerMapSignCnt = "PlayerMapSignCnt_75"    # 大地图标记数量
Def_Player_Dict_PlayerBuyZhenQiCnt = "PlayerBuyZhenQiCnt_76"  # 购买真气次数
Def_Player_Dict_PlayChangeLineID = "PlayChangeLineID"     # 玩家主动切换线路记录
@@ -3485,7 +3475,6 @@
Def_PDict_FamilyWarDailyReward = "FamilyWarDailyReward"  # 王者仙盟每日俸禄领取状态
Def_PDict_Family_Contribution = "FamilyContribution"  #战盟贡献度
Def_PDict_HasChange_FamilyActiveToContribution = "HasChangeContribution"  #战盟活跃度已转化过贡献度
Def_PDict_PackCount_FineSoul = "PackCount_FineSoul"    # 已购买精魄/符文背包格子数
Def_PDict_KillPlayerAddActive = "KillPlayerAddActiveByDay"  # 杀人每日获得活跃度
Def_PDict_LoginDayCnt = "PLoginDayCnt"  # 累计登陆天数
Def_PDict_LoginDayAward = "PLoginDayAward"  # 累计登陆领取情况
@@ -4309,47 +4298,6 @@
Def_PDict_UnXiantaoCntEquip = "UnXiantaoCntEquip" # 累计未结算掉落的战锤数
Def_PDict_BootyDropToday = "BootyDropToday_%s" # 今日已累计掉落战利品数量,参数(itemID)
#-------------------------------------------------------------------------------
#可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
#字典值列表枚举,废弃默认格子数枚举,改为读配置
[
Def_PlayerPackDict_Index_Key,      # 字典可以
] = range(0, 1)
Def_Type_CanBuyPack_PlayerDict = {
                                  #IPY_GameWorld.rptPetCabinetPet:[
                                  #     Def_Player_Dict_CabinetCount_Pet,
                                  #     Def_PackCnt_Fashion],
                                  #IPY_GameWorld.rptCabinetWeaponCoat:[
                                  #     Def_Player_Dict_CabinetCount_WeaponCoat,
                                  #     Def_PackCnt_WeaponCoat],
                                  #IPY_GameWorld.rptCabinetDressCoat:[
                                  #     Def_Player_Dict_CabinetCount_DressCoat,
                                  #     Def_PackCnt_Fashion],
                                  #IPY_GameWorld.rptCabinetHorse:[
                                  #     Def_Player_Dict_CabinetCount_Horse,
                                  #     Def_PackCnt_Fashion],
                                  IPY_GameWorld.rptItem:[
                                       Def_Player_Dict_PackCount_Item,
                                       0],
                                  IPY_GameWorld.rptWarehouse:[
                                       Def_Player_Dict_PackCount_Warehouse,
                                       0],
                                  ShareDefine.rptHero:[
                                       Def_Player_Dict_PackCount_Hero,
                                       0],
                                  #IPY_GameWorld.rptFineSoulSlot:[
                                  #     Def_PDict_PackCount_FineSoul,
                                  #     Def_PlayerFirstLoginOpenFineSoulSlot],
                                }
#-------------------------------------------------------------------------------
#物品效果(ID或指定类型)对应的属性计算信息 {效果(ID/指定类型):[[属性索引, ...], 是否基础属性,(非)线性]}
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -3252,6 +3252,114 @@
#------------------------------------------------------
# A2 07 背包购买格子信息 #tagSCPackBuyInfo
class  tagSCPackBuy(Structure):
    _pack_ = 1
    _fields_ = [
                  ("PackType", c_ubyte),    # 背包类型
                  ("BuyCnt", c_ushort),    # 已购买次数
                  ]
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, stringData, _pos=0, _len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
    def Clear(self):
        self.PackType = 0
        self.BuyCnt = 0
        return
    def GetLength(self):
        return sizeof(tagSCPackBuy)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A2 07 背包购买格子信息 //tagSCPackBuyInfo:
                                PackType:%d,
                                BuyCnt:%d
                                '''\
                                %(
                                self.PackType,
                                self.BuyCnt
                                )
        return DumpString
class  tagSCPackBuyInfo(Structure):
    Head = tagHead()
    Count = 0    #(BYTE Count)
    BuyInfoList = list()    #(vector<tagSCPackBuy> BuyInfoList)
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xA2
        self.Head.SubCmd = 0x07
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            temBuyInfoList = tagSCPackBuy()
            _pos = temBuyInfoList.ReadData(_lpData, _pos)
            self.BuyInfoList.append(temBuyInfoList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xA2
        self.Head.SubCmd = 0x07
        self.Count = 0
        self.BuyInfoList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        for i in range(self.Count):
            length += self.BuyInfoList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.Count)
        for i in range(self.Count):
            data = CommFunc.WriteString(data, self.BuyInfoList[i].GetLength(), self.BuyInfoList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                Count:%d,
                                BuyInfoList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.Count,
                                "..."
                                )
        return DumpString
m_NAtagSCPackBuyInfo=tagSCPackBuyInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCPackBuyInfo.Head.Cmd,m_NAtagSCPackBuyInfo.Head.SubCmd))] = m_NAtagSCPackBuyInfo
#------------------------------------------------------
# A2 05 虚拟背包物品清空 #tagMCVPackClear
class  tagMCVPackClear(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
@@ -77,7 +77,6 @@
import ItemControler
import ItemCommon
import ShareDefine
import DataRecordPack
import PlayerCoat
import PlayerGatherSoul
import PlayerRune
@@ -455,104 +454,45 @@
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    pack = IPY_GameWorld.IPY_COpenPackCount()
    packType = pack.GetPackType()
    if packType not in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        return
    buyCount = pack.GetCount()
    #buyCount = pack.GetCount()
    __DoOpenPackCount(curPlayer, packType)
    return
    #已购买格子数
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict[packType][ChConfig.Def_PlayerPackDict_Index_Key]
    curGridCnt = curPlayer.NomalDictGetProperty(keyName)
    #默认格子数
    initCnt = ItemCommon.GetPackInitCount(packType)
def __DoOpenPackCount(curPlayer, packType):
    costMoneyTypeDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 1, {})
    costMoneyValueDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 2, {})
    openGridListDict = IpyGameDataPY.GetFuncEvalCfg("OpenPack", 3, {})
    if str(packType) not in costMoneyTypeDict or str(packType) not in costMoneyValueDict or str(packType) not in openGridListDict:
        GameWorld.ErrLog("该背包不可购买! packType=%s" % packType)
        return
    moneyType = costMoneyTypeDict[str(packType)]
    costValueList = costMoneyValueDict[str(packType)]
    openGridList = openGridListDict[str(packType)]
    
    curPack = curPlayer.GetItemManager().GetPack(packType)
    curPackMaxCnt = curPack.GetMaxCount()
    openAnonCnt =  initCnt + curGridCnt + buyCount
    initCnt = ItemCommon.GetPackInitCount(packType)
    alreadyOpenCnt = ItemCommon.GetPackOpenItemCnt(curPlayer, packType)
    canOpenGridCnt = curPackMaxCnt - initCnt - alreadyOpenCnt
    
    if curPackMaxCnt < openAnonCnt:
    nextBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PackBuyCnt % packType) + 1
    nextOpenCnt = openGridList[nextBuyCnt - 1] if len(openGridList) >= nextBuyCnt else openGridList[-1]
    moneyCnt = costValueList[nextBuyCnt - 1] if len(costValueList) >= nextBuyCnt else costValueList[-1]
    if canOpenGridCnt < nextOpenCnt:
        #数量超过最大格子数
        GameWorld.DebugLog("购买背包格子,数量超过最大格子数!packType=%s,buyCount=%s" % (packType, buyCount))
        return
    isBuyOK, costMoneyList = DoOpenGrid(curPlayer, curGridCnt, packType, buyCount)
    if not isBuyOK:
        GameWorld.DebugLog("购买背包格子,数量超过最大格子数!packType=%s,initCnt=%s,alreadyOpenCnt=%s,已购买次数=%s,curPackMaxCnt=%s,canOpenGridCnt=%s < %s"
                           % (packType, initCnt, alreadyOpenCnt, nextBuyCnt - 1, curPackMaxCnt, canOpenGridCnt, nextOpenCnt))
        return
    
    #fromIndex, toIndex =  curGridCnt + 1, curGridCnt + buyCount
#    GameWorld.Log("fromIndex=%s toIndex=%s"%(fromIndex, toIndex))
    PlayerControl.NomalDictSetProperty(curPlayer, keyName, curGridCnt + buyCount)
    infoDict = {"BuyCount":nextBuyCnt, ChConfig.Def_Cost_Reason_SonKey:packType}
    if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_BuyPack, infoDict, 1):
        return
    
    if packType == IPY_GameWorld.rptItem:
        #背包刷新
        PlayerControl.Init_ItemPack(curPlayer)
        PlayerControl.NotifyCode(curPlayer, "GeRen_liubo_671654")
        #PlayerControl.SyncOnLineTimeTotal(curPlayer)
        #PlayerControl.SyncOnLineTimeLastOpenPack(curPlayer, packType)
    elif packType == IPY_GameWorld.rptWarehouse:
        #仓库刷新
        PlayerControl.Init_Warehouse(curPlayer)
    else:
        #收纳柜刷新
        PlayerControl.Init_CabinetCountByType(curPlayer, packType)
    DataRecordPack.DR_OpenPackCount(curPlayer, packType, buyCount, curPlayer.NomalDictGetProperty(keyName))
    if costMoneyList:
        #消费记录
        for moneyType, money in costMoneyList:
            GameWorld.Login_Interface_GoldRec(curPlayer, 0, 1, 'BuyPackGrid', moneyType, money)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PackBuyCnt % packType, nextBuyCnt)
    PlayerControl.Init_PackCount(curPlayer, packType)
    ItemCommon.SyncPackBuyCnt(curPlayer, packType)
    return
##开启格子扣道具钻石
# @param curPlayer 玩家对象
# @param buyMoney 钻石消耗
# @param packType 背包类型
# @param curPack 物品管理器
# @param buyPackMoneyType 货币类型
# @param buyCount 购买格子数
# @return None 是否购买成功, 玩家是否有钱款
def DoOpenGrid(curPlayer, curGridCnt, packType, buyCount):
    curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    itemId = IpyGameDataPY.GetFuncCfg('OpenBagItem')
    itemCntFormula = IpyGameDataPY.GetFuncCompileCfg('OpenBagItem', 2)
    buyMoney = IpyGameDataPY.GetFuncCfg('OpenBagItem', 3)
    totalItemCnt = 0
    for index in range(curGridCnt+1, curGridCnt + buyCount+1):
        itemcnt = eval(itemCntFormula)
        totalItemCnt += itemcnt
    hasEnough, indexList, findItemIsBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(itemId, curPack, totalItemCnt)
    needMoney = lackCnt * buyMoney if not hasEnough else 0
    # 需要付钱
    costMoneyList = []
    if needMoney > 0:
        costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, needMoney)
        if costMoneyList == []:
            #金钱不足
            return False, costMoneyList
        #付款
        for moneyType, moneyCnt in costMoneyList:
            infoDict = {"BuyCount":buyCount, ChConfig.Def_Cost_Reason_SonKey:packType}
            if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_BuyPack, infoDict, 1):
                return False, costMoneyList
    # 扣道具
    delCnt = max(0, totalItemCnt - lackCnt) # 实际扣除的个数
    if indexList:
        ItemCommon.ReduceItem(curPlayer, curPack, indexList, delCnt, True)
    return True, costMoneyList
    
#===============================================================================
#//A2 04 请求打开远程仓库 #tagCMOpenLongWarehouse
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ResetPack.py
@@ -2,26 +2,23 @@
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GM.Commands.ResetPack
#
# @todo:重置背包购买
# @author hxp
# @date 2015-1-10
# @date 2025-07-23
# @version 1.0
#
# 详细描述: 重置背包购买
#
#---------------------------------------------------------------------
"""Version = 2015-1-10 23:00"""
#-------------------------------------------------------------------------------
#"""Version = 2025-07-23 12:00"""
#-------------------------------------------------------------------------------
import IPY_GameWorld
import PlayerControl
import ChConfig
import GameWorld
#---------------------------------------------------------------------
import PlayerControl
import ItemCommon
import ChConfig
## 执行逻辑
#  @param curPlayer 当前玩家
@@ -30,22 +27,16 @@
#  @remarks 函数详细说明.
def OnExec(curPlayer, cmdList):
    if len(cmdList) <= 0:
        GameWorld.DebugAnswer(curPlayer, "ResetPack 背包类型[5-仓库]")
        GameWorld.DebugAnswer(curPlayer, "ResetPack 背包类型")
        return
    
    packType = cmdList[0]
    if packType not in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        GameWorld.DebugAnswer(curPlayer, "背包类型错误")
    if not curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_PackBuyCnt % packType):
        GameWorld.DebugAnswer(curPlayer, "背包未购买过: %s" % packType)
        return
    
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict[packType][ChConfig.Def_PlayerPackDict_Index_Key]
    if packType == IPY_GameWorld.rptWarehouse:
        PlayerControl.NomalDictSetProperty(curPlayer, keyName, 0)
        #仓库刷新
        PlayerControl.Init_Warehouse(curPlayer)
    else:
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_PackBuyCnt % packType, 0)
    PlayerControl.Init_PackCount(curPlayer, packType)
    ItemCommon.SyncPackBuyCnt(curPlayer, packType)
    GameWorld.DebugAnswer(curPlayer, "ResetPack OK")
    return
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 背包格子数
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -1436,36 +1436,30 @@
#@return 返回值无意义
#@remarks 初始化玩家背包
def InitPlayerPack(curPlayer) :
    itemManager = curPlayer.GetItemManager()
    #设置装备实际个数,默认最大个数
    curPack = itemManager.GetPack(IPY_GameWorld.rptEquip)
    curPack.SetCount(curPack.GetMaxCount())
    PlayerControl.Init_PackCount(curPlayer, IPY_GameWorld.rptEquip, defaultMax=True, isSync=False)
    
    #初始化玩家背包
    PlayerControl.Init_ItemPack(curPlayer)
    PlayerControl.Init_PackCount(curPlayer, IPY_GameWorld.rptItem)
    
    #初始化玩家仓库
    #PlayerControl.Init_Warehouse(curPlayer)
    
    #初始化鉴定背包,默认最大个数用于存放主线掉落
    curPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptIdentify)
    curPack.SetCount(curPack.GetMaxCount())
    curPack.Sync_PackCanUseCount()
    PlayerControl.Init_PackCount(curPlayer, IPY_GameWorld.rptIdentify, defaultMax=True)
    
    #初始化英雄背包
    PlayerControl.Init_HeroPack(curPlayer)
    PlayerControl.Init_PackCount(curPlayer, ShareDefine.rptHero)
    
    #初始化临时交换背包,默认最大个数
    curPack = itemManager.GetPack(ShareDefine.rptTempSwap)
    curPack.SetCount(curPack.GetMaxCount())
    PlayerControl.Init_PackCount(curPlayer, ShareDefine.rptTempSwap, defaultMax=True, isSync=False)
    
    #初始化临时存放背包,默认最大个数
    curPack = itemManager.GetPack(ShareDefine.rptTempItem)
    curPack.SetCount(curPack.GetMaxCount())
    PlayerControl.Init_PackCount(curPlayer, ShareDefine.rptTempItem, defaultMax=True, isSync=False)
    
    #初始化寻宝背包
    PlayerControl.Init_TreasurePack(curPlayer)
    PlayerControl.Init_PackCount(curPlayer, ShareDefine.rptTreasure)
    
    #初始化神兽物品背包
    #curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptDogzItem)
@@ -1493,6 +1487,8 @@
    #curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptPet))
    #curPack.Sync_PackCanUseCount()
    
    ItemCommon.SyncPackBuyCnt(curPlayer)
    #通知玩家物品信息
    __Sync_PackDetel(curPlayer)
    
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -14,10 +14,8 @@
#"""Version = 2017-07-17 15:00"""
#---------------------------------------------------------------------
import GameWorld
import ChEquip
import SkillShell
import ChConfig
import EffGetSet
import PlayerHorse
import PlayerTeam
import SkillCommon
@@ -41,27 +39,15 @@
import ChPyNetSendPack
import NetPackCommon
import DataRecordPack
import CalcNoLineEffect
import CalcLineEffect
import PlayerEquipDecompose
import FormulaControl
import PlayerDienstgrad
import PlayerPrestigeSys
import OpenServerCampaign
import PlayerGodWeapon
import PlayerExpandPackCfgMgr
import PlayerActivity
import FBCommon
import PassiveBuffEffMng
import EventReport
import PlayerGatherSoul
import PlayerGatherTheSoul
import PlayerSuccess
import PlayerPet
import ItemControler
import GameFuncComm
import IpyGameDataPY
import PlayerRune
import PyGameData
import PlayerMagicWeapon
import PlayerFeastTravel
@@ -70,9 +56,6 @@
import GameLogic_ZhuXianBoss
import GameLogic_CrossDemonKing
import PlayerVip
import PlayerRefineStove
import PlayerFamilyTech
import PlayerFamilyZhenfa
import PlayerCostRebate
import PlayerActLunhuidian
import PlayerActGarbageSorting
@@ -80,24 +63,14 @@
import PlayerTongTianLing
import FunctionNPCCommon
import PlayerGoldInvest
import IPY_PlayerDefine
import CrossRealmPlayer
import CrossPlayerData
import NPCHurtManager
import ChNetSendPack
import PlayerLianTi
import PlayerCoat
import PlayerAssist
import PlayerState
import PlayerDogz
import PlayerFaQi
import PlayerLove
import PlayerGubao
import PlayerShentong
import PlayerOnline
import PlayerCharm
import PlayerTask
import PlayerFace
import PlayerMail
import ChPlayer
import GameObj
@@ -777,21 +750,6 @@
    curPlayer.Stand()
    
    
    return
#---------------------------------------------------------------------
##玩家播放表情
# @param curPlayer 玩家实例
# @return 返回值无意义
# @remarks 玩家播放表情
def DoPlayerShowPlayerFace(curPlayer, faceType):
    #清空玩家点击
    curPlayer.SetActionObj(None)
    #通知中断战斗对峙
    ExitPlayerConfronting(curPlayer)
    #通知停止移动
    curPlayer.StopMove()
    #通知客户端播放表情
    curPlayer.View_ShowPlayerFace(faceType)
    return
#---------------------------------------------------------------------
@@ -3647,10 +3605,6 @@
            
            # 升级需要执行的游戏功能处理
            GameFuncComm.DoFuncOpenLogic(curPlayer)
            #ChEquip.RefreshPlayerLingQiEquipAttr(curPlayer) # 灵器属性会随等级成长
            #if aftLV%10 == 0:
            #    # 控制下刷新次数
            #    PlayerPet.CalcPetItemAddPlayerAttr(curPlayer)   # 宠物有随等级变化的技能
            
            PlayerOnline.CalcRoleBase(curPlayer)
            PlayerOnline.GetOnlinePlayer(curPlayer).RefreshRoleAttr()
@@ -4268,104 +4222,22 @@
#        return False
    
    return True
#------------------------------------------------------------------------------------
##初始化玩家背包.
# @param curPlayer 玩家实例
# @return 返回值无意义
# @remarks 初始化玩家背包
def Init_ItemPack(curPlayer):
    packType = IPY_GameWorld.rptItem
    #初始化玩家背包
    if packType not in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        return
    #获取玩家背包
    curPack = curPlayer.GetItemManager().GetPack(packType)
    #默认14格子 + 开启的
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
    count = ItemCommon.GetPackInitCount(packType) + curPlayer.NomalDictGetProperty(keyName)
    curPack.SetCount(count)
    #通知客户端背包格子数目
#    curPlayer.Sync_ItemCount(curPack.GetCount())
    curPack.Sync_PackCanUseCount()
    return
#------------------------------------------------------------------------------------
##初始化玩家仓库.
# @param curPlayer 玩家实例
# @return 返回值无意义
# @remarks 初始化玩家仓库
def Init_Warehouse(curPlayer):
    packType = IPY_GameWorld.rptWarehouse
    #初始化玩家背包
    if packType not in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        return
    #获取玩家背包
def Init_PackCount(curPlayer, packType, defaultMax=False, isSync=True):
    ## 初始化刷新玩家某个背包格子数
    curPack = curPlayer.GetItemManager().GetPack(packType)
    #默认42格子 + 开启的
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
    count = ItemCommon.GetPackInitCount(packType) + curPlayer.NomalDictGetProperty(keyName)
    curPack.SetCount(count)
    #通知客户端
    curPack.Sync_PackCanUseCount()
    maxCount = curPack.GetMaxCount()
    if defaultMax:
        curPack.SetCount(maxCount)
    else:
        count = ItemCommon.GetPackInitCount(packType) + ItemCommon.GetPackOpenItemCnt(curPlayer, packType)
        curPack.SetCount(min(count, maxCount))
    if isSync:
        curPack.Sync_PackCanUseCount()
    return
def Init_HeroPack(curPlayer):
    packType = ShareDefine.rptHero
    #获取玩家背包
    curPack = curPlayer.GetItemManager().GetPack(packType)
    initCount = ItemCommon.GetPackInitCount(packType)
    if packType in ChConfig.Def_Type_CanBuyPack_PlayerDict.keys():
        keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
        initCount += curPlayer.NomalDictGetProperty(keyName)
    curPack.SetCount(initCount)
    #通知客户端背包格子数目
#    curPlayer.Sync_ItemCount(curPack.GetCount())
    curPack.Sync_PackCanUseCount()
    return
##初始化寻宝背包
# @param curPlayer 玩家实例
# @return None
def Init_TreasurePack(curPlayer):
    curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptTreasure)
    curPack.SetCount(ItemCommon.GetPackInitCount(ShareDefine.rptTreasure))
    #通知客户端
    curPack.Sync_PackCanUseCount()
    return
##初始化玩家收纳柜
# @param curPlayer 玩家实例
# @param packType 背包类型
# @return 返回值无意义
def Init_CabinetCountByType(curPlayer, packType):
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict.get(packType)[ChConfig.Def_PlayerPackDict_Index_Key]
    if keyName == None:
        GameWorld.ErrLog("Init_Pack Error type=%s" % packType)
        return
    #初始化时装武器背包
    curPack = curPlayer.GetItemManager().GetPack(packType)
    #默认14格子 + 开启的
    count = ChConfig.Def_PackCnt_WeaponCoat + curPlayer.NomalDictGetProperty(keyName)
    curPack.SetCount(count)
    #通知客户端
    curPack.Sync_PackCanUseCount()
    return
#---------------------------------------------------------------------
def IsInOperationAction(curPlayer, actName, actIDKey, crossActName="", crossActIDKey=""):
    ## 玩家是否有正在进行中运营活动,不含参与结束阶段
    
@@ -4871,68 +4743,6 @@
# #@warning: ExAttr6~ExAttr10, 新增2个布尔默认参数, 是否通知客户端, 是否通知GameServer, 默认值为False
#===============================================================================
#---------------------------------------------------------------------------
##获取可免费开启的格子数
# @param curPlayer 玩家对象
# @param packType 背包类型
# @param openCnt 实际要开启的格子数
# @return 获取可免费开启的格子数
def GetCanAutoOpenPackCount(curPlayer, packType, openCnt, tick):
    if packType not in [IPY_GameWorld.rptItem, IPY_GameWorld.rptWarehouse]:
        return 0
    cfgObj = PlayerExpandPackCfgMgr.GetExpandPackCfg(curPlayer, packType)
    #找不到这种背包的配置信息对象
    if not cfgObj:
        return 0
    #已购买或自动开启的格子数
    keyName = ChConfig.Def_Type_CanBuyPack_PlayerDict[packType][ChConfig.Def_PlayerPackDict_Index_Key]
    curCount = curPlayer.NomalDictGetProperty(keyName)
#    nextCountIndex = curCount + 1
#    infoObj = cfgObj.GetAttrInfoByInex(nextCountIndex)
#    if None == infoObj:
#        return 0
#    #更新下玩家的在线时间
#    UpdateOnLineTime(curPlayer, tick)
#    onlineTime = curPlayer.GetOnlineTime()
#    #需要的时间
#    needOnlineTime = infoObj["OnlineTime"]
#    #最后一次自动开启背包的在线时间tick
#    lastAutoOpenPackTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LastAutoOpenPackTick)
#    if onlineTime - lastAutoOpenPackTick > needOnlineTime:
#        return 1
#    return 0
    #最大可增加的背包数
    maxCanAddCount = cfgObj.GetCanAddCount()
    forCount = min(openCnt, maxCanAddCount - curCount)
    #可以再增加的格子数
    count = 0
    #遍历可增加的背包格子数
    UpdateOnLineTime(curPlayer, tick)
    onlineTime = curPlayer.GetOnlineTime()
    lastAutoOpenPackTick = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_LastAutoOpenPackTick % packType)
    lastInfoObj = cfgObj.GetTotalAddAttrInfoByCount(curCount)
    notOnlineTime = 0
    if lastInfoObj:
        notOnlineTime = lastInfoObj["OnlineTime"]
#    GameWorld.Log("get online time = %s"%onlineTime)
    for i in range(forCount):
        nextCount = curCount + i + 1
        infoObj = cfgObj.GetTotalAddAttrInfoByCount(nextCount)
        if None == infoObj:
            break
        # (小于0的不具有免费开启功能)
        if infoObj["OnlineTime"] < 0:
            continue
        needOnlineTime = infoObj["OnlineTime"] - notOnlineTime
#        GameWorld.Log("get need online time = %s"%needOnlineTime)
        #要求的在线时间,大于当前的在线时间,没办法加背包格子
        if needOnlineTime > onlineTime - lastAutoOpenPackTick:
            break
        count += 1
    return count
## 获取玩家当前等级升级所需总经验
#  @param playerLv 玩家等级
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerExpandPackCfgMgr.py
File was deleted