54 【三国主界面】核心主体-服务端(仙树;增加货币41-战锤;42-结晶)
 
	
	
	
	
	
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  |     DWORD        NeedQiyun;    //所需气运值
 | 
 |  |  |     list        AwardItemList;    //奖励物品列表
 | 
 |  |  | };
 | 
 |  |  | 
 | 
 |  |  | //仙树等级表
 | 
 |  |  | 
 | 
 |  |  | struct tagTreeLV
 | 
 |  |  | {
 | 
 |  |  |     BYTE        _TreeLV;    //仙树等级
 | 
 |  |  |     DWORD        LVUPNeedMoney;    //升到下一级所需货币数
 | 
 |  |  |     DWORD        LVUPNeedTime;    //升级下一级所需所需秒
 | 
 |  |  |     list        EquipColorRateList;    //产出装备品质概率列表,[0品质万分率, 1品质万分率, ...]
 | 
 |  |  |     list        ExAwardItemRateList;    //每次砍树概率额外产出道具饼图,[[万分率,[物品ID,个数]], ...]
 | 
 |  |  | };
 | 
 
 |  |  | 
 |  |  | PacketSubCMD_2=0x11
 | 
 |  |  | PacketCallFunc_2=OnMirrorFight
 | 
 |  |  | 
 | 
 |  |  | ;仙树
 | 
 |  |  | [PlayerTree]
 | 
 |  |  | ScriptName = Player\PlayerTree.py
 | 
 |  |  | Writer = hxp
 | 
 |  |  | Releaser = hxp
 | 
 |  |  | RegType = 0
 | 
 |  |  | RegisterPackCount = 2
 | 
 |  |  | 
 | 
 |  |  | PacketCMD_1=0xB2
 | 
 |  |  | PacketSubCMD_1=0x23
 | 
 |  |  | PacketCallFunc_1=OnTreeLVUP
 | 
 |  |  | 
 | 
 |  |  | PacketCMD_2=0xB2
 | 
 |  |  | PacketSubCMD_2=0x24
 | 
 |  |  | PacketCallFunc_2=OnUseTreeLVUPTimeItem
 | 
 |  |  | 
 | 
 |  |  | ;福地
 | 
 |  |  | [PlayerMineArea]
 | 
 |  |  | ScriptName = Player\PlayerMineArea.py
 | 
 
 |  |  | 
 |  |  | Def_PDict_CustomAwardCanGet = "CustomAwardCanGet_%s" # 是否可领取,参数(key编号)
 | 
 |  |  | Def_PDict_CustomAwardGetState = "CustomAwardGetState_%s" # 是否已领取,参数(key编号)
 | 
 |  |  | 
 | 
 |  |  | #仙树
 | 
 |  |  | Def_PDict_TreeLV = "TreeLV" # 仙树等级,从1开始,代表1级
 | 
 |  |  | Def_PDict_TreeLVUPState = "TreeLVUPState" # 仙树升级状态;0-未升级;1-升级中
 | 
 |  |  | Def_PDict_TreeLVUPRemainTime = "TreeLVUPRemainTime" # 仙树升级剩余时间,秒
 | 
 |  |  | Def_PDict_TreeLVUPRefreshTime = "TreeLVUPRefreshTime" # 仙树升级上次刷新时间戳
 | 
 |  |  | 
 | 
 |  |  | #福地
 | 
 |  |  | Def_PDict_MineWorkerCount = "MineWorkerCount" # 已雇佣工人数
 | 
 |  |  | Def_PDict_MineWorkerEnergyUsed = "MineWorkerEnergyUsed" # 今日已消耗体力
 | 
 
 |  |  | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | #------------------------------------------------------
 | 
 |  |  | # B2 23 仙树升级 #tagCMTreeLVUP
 | 
 |  |  | 
 | 
 |  |  | class  tagCMTreeLVUP(Structure):
 | 
 |  |  |     _pack_ = 1
 | 
 |  |  |     _fields_ = [
 | 
 |  |  |                   ("Cmd", c_ubyte),
 | 
 |  |  |                   ("SubCmd", c_ubyte),
 | 
 |  |  |                   ("Type", c_ubyte),    # 0-开始升级(请求扣除消耗,开始升级倒计时);1-执行升级(前端自行倒计时,时间到后发送该类型)
 | 
 |  |  |                   ]
 | 
 |  |  | 
 | 
 |  |  |     def __init__(self):
 | 
 |  |  |         self.Clear()
 | 
 |  |  |         self.Cmd = 0xB2
 | 
 |  |  |         self.SubCmd = 0x23
 | 
 |  |  |         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.Cmd = 0xB2
 | 
 |  |  |         self.SubCmd = 0x23
 | 
 |  |  |         self.Type = 0
 | 
 |  |  |         return
 | 
 |  |  | 
 | 
 |  |  |     def GetLength(self):
 | 
 |  |  |         return sizeof(tagCMTreeLVUP)
 | 
 |  |  | 
 | 
 |  |  |     def GetBuffer(self):
 | 
 |  |  |         return string_at(addressof(self), self.GetLength())
 | 
 |  |  | 
 | 
 |  |  |     def OutputString(self):
 | 
 |  |  |         DumpString = '''// B2 23 仙树升级 //tagCMTreeLVUP:
 | 
 |  |  |                                 Cmd:%s,
 | 
 |  |  |                                 SubCmd:%s,
 | 
 |  |  |                                 Type:%d
 | 
 |  |  |                                 '''\
 | 
 |  |  |                                 %(
 | 
 |  |  |                                 self.Cmd,
 | 
 |  |  |                                 self.SubCmd,
 | 
 |  |  |                                 self.Type
 | 
 |  |  |                                 )
 | 
 |  |  |         return DumpString
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | m_NAtagCMTreeLVUP=tagCMTreeLVUP()
 | 
 |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMTreeLVUP.Cmd,m_NAtagCMTreeLVUP.SubCmd))] = m_NAtagCMTreeLVUP
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | #------------------------------------------------------
 | 
 |  |  | # B2 24 使用仙树升级减时物品 #tagCMUseTreeLVUPTimeItem
 | 
 |  |  | 
 | 
 |  |  | class  tagCMUseTreeLVUPTimeItem(Structure):
 | 
 |  |  |     _pack_ = 1
 | 
 |  |  |     _fields_ = [
 | 
 |  |  |                   ("Cmd", c_ubyte),
 | 
 |  |  |                   ("SubCmd", c_ubyte),
 | 
 |  |  |                   ("UseCount", c_int),    # 使用个数
 | 
 |  |  |                   ("IsAutoBuy", c_ubyte),    # 不足个数是否自动购买
 | 
 |  |  |                   ]
 | 
 |  |  | 
 | 
 |  |  |     def __init__(self):
 | 
 |  |  |         self.Clear()
 | 
 |  |  |         self.Cmd = 0xB2
 | 
 |  |  |         self.SubCmd = 0x24
 | 
 |  |  |         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.Cmd = 0xB2
 | 
 |  |  |         self.SubCmd = 0x24
 | 
 |  |  |         self.UseCount = 0
 | 
 |  |  |         self.IsAutoBuy = 0
 | 
 |  |  |         return
 | 
 |  |  | 
 | 
 |  |  |     def GetLength(self):
 | 
 |  |  |         return sizeof(tagCMUseTreeLVUPTimeItem)
 | 
 |  |  | 
 | 
 |  |  |     def GetBuffer(self):
 | 
 |  |  |         return string_at(addressof(self), self.GetLength())
 | 
 |  |  | 
 | 
 |  |  |     def OutputString(self):
 | 
 |  |  |         DumpString = '''// B2 24 使用仙树升级减时物品 //tagCMUseTreeLVUPTimeItem:
 | 
 |  |  |                                 Cmd:%s,
 | 
 |  |  |                                 SubCmd:%s,
 | 
 |  |  |                                 UseCount:%d,
 | 
 |  |  |                                 IsAutoBuy:%d
 | 
 |  |  |                                 '''\
 | 
 |  |  |                                 %(
 | 
 |  |  |                                 self.Cmd,
 | 
 |  |  |                                 self.SubCmd,
 | 
 |  |  |                                 self.UseCount,
 | 
 |  |  |                                 self.IsAutoBuy
 | 
 |  |  |                                 )
 | 
 |  |  |         return DumpString
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | m_NAtagCMUseTreeLVUPTimeItem=tagCMUseTreeLVUPTimeItem()
 | 
 |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMUseTreeLVUPTimeItem.Cmd,m_NAtagCMUseTreeLVUPTimeItem.SubCmd))] = m_NAtagCMUseTreeLVUPTimeItem
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | #------------------------------------------------------
 | 
 |  |  | # B3 17 情戒解锁 #tagCMLoveRingUnlock
 | 
 |  |  | 
 | 
 |  |  | class  tagCMLoveRingUnlock(Structure):
 | 
 
 |  |  | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | #------------------------------------------------------
 | 
 |  |  | # B1 21 仙树信息 #tagMCTreeInfo
 | 
 |  |  | 
 | 
 |  |  | class  tagMCTreeInfo(Structure):
 | 
 |  |  |     _pack_ = 1
 | 
 |  |  |     _fields_ = [
 | 
 |  |  |                   ("Cmd", c_ubyte),
 | 
 |  |  |                   ("SubCmd", c_ubyte),
 | 
 |  |  |                   ("TreeLV", c_ubyte),    # 当前仙树等级
 | 
 |  |  |                   ("LVUPState", c_ubyte),    # 0-非升级中;1-升级中
 | 
 |  |  |                   ("LVUPRemainTime", c_int),    # 升级剩余时间,秒;当升级中且倒计时为0时可发送B223执行升级包进行升级
 | 
 |  |  |                   ]
 | 
 |  |  | 
 | 
 |  |  |     def __init__(self):
 | 
 |  |  |         self.Clear()
 | 
 |  |  |         self.Cmd = 0xB1
 | 
 |  |  |         self.SubCmd = 0x21
 | 
 |  |  |         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.Cmd = 0xB1
 | 
 |  |  |         self.SubCmd = 0x21
 | 
 |  |  |         self.TreeLV = 0
 | 
 |  |  |         self.LVUPState = 0
 | 
 |  |  |         self.LVUPRemainTime = 0
 | 
 |  |  |         return
 | 
 |  |  | 
 | 
 |  |  |     def GetLength(self):
 | 
 |  |  |         return sizeof(tagMCTreeInfo)
 | 
 |  |  | 
 | 
 |  |  |     def GetBuffer(self):
 | 
 |  |  |         return string_at(addressof(self), self.GetLength())
 | 
 |  |  | 
 | 
 |  |  |     def OutputString(self):
 | 
 |  |  |         DumpString = '''// B1 21 仙树信息 //tagMCTreeInfo:
 | 
 |  |  |                                 Cmd:%s,
 | 
 |  |  |                                 SubCmd:%s,
 | 
 |  |  |                                 TreeLV:%d,
 | 
 |  |  |                                 LVUPState:%d,
 | 
 |  |  |                                 LVUPRemainTime:%d
 | 
 |  |  |                                 '''\
 | 
 |  |  |                                 %(
 | 
 |  |  |                                 self.Cmd,
 | 
 |  |  |                                 self.SubCmd,
 | 
 |  |  |                                 self.TreeLV,
 | 
 |  |  |                                 self.LVUPState,
 | 
 |  |  |                                 self.LVUPRemainTime
 | 
 |  |  |                                 )
 | 
 |  |  |         return DumpString
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | m_NAtagMCTreeInfo=tagMCTreeInfo()
 | 
 |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTreeInfo.Cmd,m_NAtagMCTreeInfo.SubCmd))] = m_NAtagMCTreeInfo
 | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | #------------------------------------------------------
 | 
 |  |  | # B1 16 累计消耗货币信息 #tagMCUseMoneyTotalInfo
 | 
 |  |  | 
 | 
 |  |  | class  tagMCUseMoneyTotal(Structure):
 | 
 
 |  |  | 
 |  |  |                         ("DWORD", "NeedQiyun", 0),
 | 
 |  |  |                         ("list", "AwardItemList", 0),
 | 
 |  |  |                         ),
 | 
 |  |  | 
 | 
 |  |  |                 "TreeLV":(
 | 
 |  |  |                         ("BYTE", "TreeLV", 1),
 | 
 |  |  |                         ("DWORD", "LVUPNeedMoney", 0),
 | 
 |  |  |                         ("DWORD", "LVUPNeedTime", 0),
 | 
 |  |  |                         ("list", "EquipColorRateList", 0),
 | 
 |  |  |                         ("list", "ExAwardItemRateList", 0),
 | 
 |  |  |                         ),
 | 
 |  |  |                 }
 | 
 |  |  | 
 | 
 |  |  |  | 
 |  |  | 
 |  |  |     def GetAwardIndex(self): return self.attrTuple[0] # 奖励索引 WORD
 | 
 |  |  |     def GetNeedQiyun(self): return self.attrTuple[1] # 所需气运值 DWORD
 | 
 |  |  |     def GetAwardItemList(self): return self.attrTuple[2] # 奖励物品列表 list | 
 |  |  |  | 
 |  |  | # 仙树等级表 | 
 |  |  | class IPY_TreeLV(): | 
 |  |  |      | 
 |  |  |     def __init__(self): | 
 |  |  |         self.attrTuple = None | 
 |  |  |         return | 
 |  |  |          | 
 |  |  |     def GetTreeLV(self): return self.attrTuple[0] # 仙树等级 BYTE
 | 
 |  |  |     def GetLVUPNeedMoney(self): return self.attrTuple[1] # 升到下一级所需货币数 DWORD
 | 
 |  |  |     def GetLVUPNeedTime(self): return self.attrTuple[2] # 升级下一级所需所需秒 DWORD
 | 
 |  |  |     def GetEquipColorRateList(self): return self.attrTuple[3] # 产出装备品质概率列表,[0品质万分率, 1品质万分率, ...] list
 | 
 |  |  |     def GetExAwardItemRateList(self): return self.attrTuple[4] # 每次砍树概率额外产出道具饼图,[[万分率,[物品ID,个数]], ...] list | 
 |  |  | 
 | 
 |  |  | 
 | 
 |  |  | def Log(msg, playerID=0, par=0):
 | 
 |  |  | 
 |  |  |         self.__LoadFileData("Zhanling", onlyCheck)
 | 
 |  |  |         self.__LoadFileData("Xiangong", onlyCheck)
 | 
 |  |  |         self.__LoadFileData("TiandaoTree", onlyCheck)
 | 
 |  |  |         self.__LoadFileData("TreeLV", onlyCheck)
 | 
 |  |  |         Log("IPY_DataMgr ReloadOK! onlyCheck=%s" % onlyCheck)
 | 
 |  |  |         return
 | 
 |  |  |     
 | 
 |  |  | 
 |  |  |     def GetTiandaoTreeByIndex(self, index): | 
 |  |  |         self.CheckLoadData("TiandaoTree") | 
 |  |  |         return self.ipyTiandaoTreeCache[index]
 | 
 |  |  |  | 
 |  |  |     def GetTreeLVCount(self): | 
 |  |  |         self.CheckLoadData("TreeLV") | 
 |  |  |         return self.ipyTreeLVLen
 | 
 |  |  |     def GetTreeLVByIndex(self, index): | 
 |  |  |         self.CheckLoadData("TreeLV") | 
 |  |  |         return self.ipyTreeLVCache[index]
 | 
 |  |  | 
 | 
 |  |  | IPYData = IPY_DataMgr()
 | 
 |  |  | def IPY_Data(): return IPYData
 | 
 
 |  |  | 
 |  |  | import PlayerShentong
 | 
 |  |  | import PlayerCustomAward
 | 
 |  |  | import PlayerZhanling
 | 
 |  |  | import PlayerTree
 | 
 |  |  | import PlayerLianTi
 | 
 |  |  | #import PlayerTask
 | 
 |  |  | import PlayerYinji
 | 
 |  |  | import PlayerLove
 | 
 |  |  | import GameObj
 | 
 |  |  | 
 |  |  |         PlayerGubao.OnPlayerLogin(curPlayer)
 | 
 |  |  |         PlayerShentong.OnPlayerLogin(curPlayer)
 | 
 |  |  |         PlayerZhanling.OnPlayerLogin(curPlayer)
 | 
 |  |  |         #PlayerTask.OnPlayerLogin(curPlayer)
 | 
 |  |  |         PlayerTree.OnPlayerLogin(curPlayer)
 | 
 |  |  |         PlayerMineArea.OnPlayerLogin(curPlayer)
 | 
 |  |  |         PlayerGuaji.OnPlayerLogin(curPlayer)
 | 
 |  |  |         PlayerActFamilyGCZ.OnPlayerLogin(curPlayer)
 | 
 
 |  |  | 
 |  |  |                 GameWorld.Log("等价货币补足扣除: type_Price%s, price=%s, curCurrency=%s, lackPrice=%s, tagMoneyType=%s, tagMoneyValue=%s" 
 | 
 |  |  |                                    % (type_Price, price, curCurrency, lackPrice, tagMoneyType, tagMoneyValue), curPlayer.GetPlayerID())
 | 
 |  |  |             else:
 | 
 |  |  |                 #GameWorld.Log("没有等价货币,无法扣除")
 | 
 |  |  |                 GameWorld.DebugLog("货币不足! type_Price=%s,curCurrency=%s < %s" % (type_Price, curCurrency, price))
 | 
 |  |  |                 return False
 | 
 |  |  |         #有足够的钱支付
 | 
 |  |  |         SetPlayerCurrency(curPlayer, type_Price, curCurrency - lostMoney)
 | 
 
| New file | 
 |  |  | 
 |  |  | #!/usr/bin/python
 | 
 |  |  | # -*- coding: GBK -*-
 | 
 |  |  | #-------------------------------------------------------------------------------
 | 
 |  |  | #
 | 
 |  |  | ##@package Player.PlayerTree
 | 
 |  |  | #
 | 
 |  |  | # @todo:仙树
 | 
 |  |  | # @author hxp
 | 
 |  |  | # @date 2025-05-28
 | 
 |  |  | # @version 1.0
 | 
 |  |  | #
 | 
 |  |  | # 详细描述: 仙树
 | 
 |  |  | #
 | 
 |  |  | #-------------------------------------------------------------------------------
 | 
 |  |  | #"""Version = 2025-05-28 12:00"""
 | 
 |  |  | #-------------------------------------------------------------------------------
 | 
 |  |  | 
 | 
 |  |  | import GameWorld
 | 
 |  |  | import ItemCommon
 | 
 |  |  | import NetPackCommon
 | 
 |  |  | import IpyGameDataPY
 | 
 |  |  | import ChPyNetSendPack
 | 
 |  |  | import PlayerControl
 | 
 |  |  | import IPY_GameWorld
 | 
 |  |  | #import PlayerTask
 | 
 |  |  | import ChConfig
 | 
 |  |  | 
 | 
 |  |  | import time
 | 
 |  |  | 
 | 
 |  |  | def OnPlayerLogin(curPlayer):
 | 
 |  |  |     treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
 | 
 |  |  |     if not treeLV:
 | 
 |  |  |         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLV, 1)
 | 
 |  |  |     RefreshTreeLVUPTime(curPlayer)
 | 
 |  |  |     SyncTreeInfo(curPlayer)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | #// B2 23 仙树升级 #tagCMTreeLVUP
 | 
 |  |  | #
 | 
 |  |  | #struct    tagCMTreeLVUP
 | 
 |  |  | #{
 | 
 |  |  | #    tagHead         Head;
 | 
 |  |  | #    BYTE        Type;    // 0-开始升级(请求扣除消耗,开始升级倒计时);1-执行升级(倒计时时间到后发送该类型)
 | 
 |  |  | #};
 | 
 |  |  | def OnTreeLVUP(index, clientData, tick):
 | 
 |  |  |     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
 | 
 |  |  |     upType = clientData.Type
 | 
 |  |  |     if upType == 1:
 | 
 |  |  |         if not DoTreeLVUP(curPlayer):
 | 
 |  |  |             SyncTreeInfo(curPlayer)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     playerID = curPlayer.GetPlayerID()
 | 
 |  |  |     lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
 | 
 |  |  |     if lvupState:
 | 
 |  |  |         GameWorld.DebugLog("仙树已经在升级中! lvupState=%s" % lvupState, playerID)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
 | 
 |  |  |     ipyData = IpyGameDataPY.GetIpyGameData("TreeLV", treeLV)
 | 
 |  |  |     if not ipyData:
 | 
 |  |  |         return
 | 
 |  |  |     needMoney = ipyData.GetLVUPNeedMoney()
 | 
 |  |  |     nextTreeLV = treeLV + 1
 | 
 |  |  |     nextIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreeLV", nextTreeLV)
 | 
 |  |  |     if needMoney <= 0 or not nextIpyData:
 | 
 |  |  |         GameWorld.DebugLog("仙树已满级! treeLV=%s" % treeLV, playerID)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     moneyType = IpyGameDataPY.GetFuncCfg("TreeLVUP", 1)
 | 
 |  |  |     if not PlayerControl.PayMoney(curPlayer, moneyType, needMoney, "TreeLVUP", {"treeLV":treeLV}):
 | 
 |  |  |         return
 | 
 |  |  |     needTime = ipyData.GetLVUPNeedTime()
 | 
 |  |  |      | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPState, 1)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRemainTime, needTime)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRefreshTime, int(time.time()))
 | 
 |  |  |     GameWorld.DebugLog("仙树请求开始升级! treeLV=%s,nextTreeLV=%s,needTime=%s" % (treeLV, nextTreeLV, needTime), playerID)
 | 
 |  |  |     SyncTreeInfo(curPlayer)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | #// B2 24 使用仙树升级减时物品 #tagCMUseTreeLVUPTimeItem
 | 
 |  |  | #
 | 
 |  |  | #struct    tagCMUseTreeLVUPTimeItem
 | 
 |  |  | #{
 | 
 |  |  | #    tagHead         Head;
 | 
 |  |  | #    DWORD        UseCount;    // 使用个数
 | 
 |  |  | #    BYTE        IsAutoBuy;    // 不足个数是否自动购买
 | 
 |  |  | #};
 | 
 |  |  | def OnUseTreeLVUPTimeItem(index, clientData, tick):
 | 
 |  |  |     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
 | 
 |  |  |     useCount = clientData.UseCount
 | 
 |  |  |     isAutoBuy = clientData.IsAutoBuy
 | 
 |  |  |      | 
 |  |  |     playerID = curPlayer.GetPlayerID()
 | 
 |  |  |     lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
 | 
 |  |  |     LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
 | 
 |  |  |     if not lvupState or not LVUPRemainTime:
 | 
 |  |  |         GameWorld.DebugLog("仙树非升级中或剩余时间为0,不需要减少时间! lvupState=%s,LVUPRemainTime=%s"  | 
 |  |  |                            % (lvupState, LVUPRemainTime), playerID)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     costItemID, reduceSeconds = IpyGameDataPY.GetFuncEvalCfg("TreeLVUP", 2)
 | 
 |  |  |     GameWorld.DebugLog("使用仙树升级减时物品! costItemID=%s,reduceSeconds=%s,useCount=%s" % (costItemID, reduceSeconds, useCount), playerID)
 | 
 |  |  |     if not costItemID or not useCount:
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, useCount)
 | 
 |  |  |     lackCnt = useCount - bindCnt - unBindCnt
 | 
 |  |  |     if lackCnt > 0 and not isAutoBuy:
 | 
 |  |  |         GameWorld.DebugLog("消耗道具不足! costItemID=%s,useCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s"  | 
 |  |  |                            % (costItemID, useCount, bindCnt, unBindCnt, lackCnt), playerID)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     delCnt = useCount
 | 
 |  |  |     if lackCnt > 0:
 | 
 |  |  |         moneyType = IPY_GameWorld.TYPE_Price_Gold_Money
 | 
 |  |  |         lackCost = ItemCommon.GetAutoBuyItemNeedGold({costItemID:lackCnt})
 | 
 |  |  |         if lackCost <= 0:
 | 
 |  |  |             return
 | 
 |  |  |         GameWorld.DebugLog("自动购买道具: lackCnt=%s,moneyType=%s,lackCost=%s" % (lackCnt, moneyType, lackCost), playerID)
 | 
 |  |  |         infoDict = {ChConfig.Def_Cost_Reason_SonKey:costItemID}
 | 
 |  |  |         if not PlayerControl.PayMoney(curPlayer, moneyType, lackCost, ChConfig.Def_Cost_BuyStoreItem, infoDict):
 | 
 |  |  |             return
 | 
 |  |  |         delCnt -= lackCnt
 | 
 |  |  |          | 
 |  |  |     # 扣除消耗
 | 
 |  |  |     if delCnt:
 | 
 |  |  |         ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "TreeLVUPTimeItem")
 | 
 |  |  |          | 
 |  |  |     reduceTime = reduceSeconds * useCount
 | 
 |  |  |     ReduceTreeLVUPTime(curPlayer, reduceTime)
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def RefreshTreeLVUPTime(curPlayer):
 | 
 |  |  |     ## 刷新仙树升级剩余时间
 | 
 |  |  |     lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
 | 
 |  |  |     LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
 | 
 |  |  |     if not lvupState or not LVUPRemainTime:
 | 
 |  |  |         return
 | 
 |  |  |     curTime = int(time.time())
 | 
 |  |  |     lastRefreshTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRefreshTime)
 | 
 |  |  |     if not lastRefreshTime:
 | 
 |  |  |         lastRefreshTime = curTime
 | 
 |  |  |     passSeconds = max(0, curTime - lastRefreshTime)
 | 
 |  |  |     updLVUPRemainTime = max(0, LVUPRemainTime - passSeconds)
 | 
 |  |  |      | 
 |  |  |     treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRemainTime, updLVUPRemainTime)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRefreshTime, curTime)
 | 
 |  |  |     GameWorld.DebugLog("刷新仙树升级剩余时间! updLVUPRemainTime=%s,treeLV=%s,LVUPRemainTime=%s,passSeconds=%s,lastRefreshTime=%s"  | 
 |  |  |                        % (updLVUPRemainTime, treeLV, LVUPRemainTime, passSeconds, lastRefreshTime), curPlayer.GetPlayerID())
 | 
 |  |  |     return
 | 
 |  |  | 
 | 
 |  |  | def ReduceTreeLVUPTime(curPlayer, reduceTime):
 | 
 |  |  |     ## 减少仙树升级剩余时间,可能是使用道具或其他功能等
 | 
 |  |  |     RefreshTreeLVUPTime(curPlayer)
 | 
 |  |  |     lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
 | 
 |  |  |     LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
 | 
 |  |  |     if not lvupState or not LVUPRemainTime:
 | 
 |  |  |         GameWorld.DebugLog("仙树非升级中或剩余时间为0,不需要减少时间! lvupState=%s,LVUPRemainTime=%s"  | 
 |  |  |                            % (lvupState, LVUPRemainTime), curPlayer.GetPlayerID())
 | 
 |  |  |         return
 | 
 |  |  |     updLVUPRemainTime = max(0, LVUPRemainTime - reduceTime)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRemainTime, updLVUPRemainTime)
 | 
 |  |  |     GameWorld.DebugLog("减少仙树升级剩余时间! updLVUPRemainTime=%s,LVUPRemainTime=%s,reduceTime=%s"  | 
 |  |  |                        % (updLVUPRemainTime, LVUPRemainTime, reduceTime), curPlayer.GetPlayerID())
 | 
 |  |  |     SyncTreeInfo(curPlayer)
 | 
 |  |  |     return True
 | 
 |  |  | 
 | 
 |  |  | def DoTreeLVUP(curPlayer):
 | 
 |  |  |     ## 执行仙树升级
 | 
 |  |  |     RefreshTreeLVUPTime(curPlayer)
 | 
 |  |  |     playerID = curPlayer.GetPlayerID()
 | 
 |  |  |     lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
 | 
 |  |  |     if not lvupState:
 | 
 |  |  |         GameWorld.DebugLog("仙树非升级中,无法执行升级! lvupState=%s" % lvupState, playerID)
 | 
 |  |  |         return
 | 
 |  |  |     LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
 | 
 |  |  |     if LVUPRemainTime > 0:
 | 
 |  |  |         GameWorld.DebugLog("仙树升级剩余时间未到,无法执行升级! LVUPRemainTime=%s" % LVUPRemainTime, playerID)
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     treeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
 | 
 |  |  |     updTreeLV = treeLV + 1
 | 
 |  |  |     ipyData = IpyGameDataPY.GetIpyGameData("TreeLV", updTreeLV)
 | 
 |  |  |     if not ipyData:
 | 
 |  |  |         return
 | 
 |  |  |      | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLV, updTreeLV)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPState, 0)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRemainTime, 0)
 | 
 |  |  |     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRefreshTime, 0)
 | 
 |  |  |     GameWorld.DebugLog("执行仙树升级! updTreeLV=%s" % updTreeLV, playerID)
 | 
 |  |  |     SyncTreeInfo(curPlayer)
 | 
 |  |  |      | 
 |  |  |     #PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_TreeLV)
 | 
 |  |  |     return True
 | 
 |  |  | 
 | 
 |  |  | def SyncTreeInfo(curPlayer):
 | 
 |  |  |     clientPack = ChPyNetSendPack.tagMCTreeInfo()
 | 
 |  |  |     clientPack.TreeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
 | 
 |  |  |     clientPack.LVUPState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
 | 
 |  |  |     clientPack.LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
 | 
 |  |  |     NetPackCommon.SendFakePack(curPlayer, clientPack)
 | 
 |  |  |     return
 | 
 
 |  |  | 
 |  |  | TYPE_Price_BTGMYuE = 38    # GM余额
 | 
 |  |  | TYPE_Price_SuccessSocre = 39    # 成就积分
 | 
 |  |  | TYPE_Price_FamilyFlagWarPoint = 40    # 万界积分
 | 
 |  |  | TYPE_Price_Xiantao = 41    # 仙桃
 | 
 |  |  | TYPE_Price_Lingyu = 42    # 灵玉
 | 
 |  |  | TYPE_Price_Xiantao = 41    # 仙桃/战锤
 | 
 |  |  | TYPE_Price_Lingyu = 42    # 灵玉/结晶
 | 
 |  |  | TYPE_Price_BossTrial = 43    # boss历练凭证积分
 | 
 |  |  | TYPE_Price_GatherSoul = 44    # 聚魂精华
 | 
 |  |  | TYPE_Price_HorsePetTrainScore = 45    # 骑宠养成积分
 | 
 |  |  | 
 |  |  |                  1:"仙玉", 2:"绑玉", 3:"铜钱", 6:"战盟贡献度", 10:"战盟仓库积分", 13:"境界修行点", 14:"符印融合石", 15:"仙盟活跃令", 
 | 
 |  |  |                  16:"助战积分", 18:"荣誉", 19:"Boss积分", 23:"符印精华", 24:"符印碎片", 25:"寻宝积分", 26:"集市额度", 27:"丹精", 28:"魂尘", 
 | 
 |  |  |                  29:"聚魂碎片", 30:"核心环", 31:"功能特权令", 32:"环保值", 33:"GM令", 34:"古神币", 35:"功德点", 
 | 
 |  |  |                  39:"成就积分", 40:"万界积分", 43:"凭证积分", 44:"聚魂精华", 45:"骑宠养成积分", 46:"古宝养成积分", 47:"天道果",  | 
 |  |  |                  39:"成就积分", 40:"万界积分", 41:"战锤", 42:"结晶", 43:"凭证积分", 44:"聚魂精华", 45:"骑宠养成积分", 46:"古宝养成积分", 47:"天道果",  | 
 |  |  |                  49:"仙缘积分", 50:"幻境阁积分",
 | 
 |  |  |                  98:"代币时效", 99:"代币"
 | 
 |  |  |                  }
 | 
 |  |  | 
 |  |  |                            TYPE_Price_GuShenMoney:CDBPlayerRefresh_GuShenMoney,
 | 
 |  |  |                            TYPE_Price_GongdePoint:CDBPlayerRefresh_GongdePoint,
 | 
 |  |  |                            TYPE_Price_SuccessSocre:CDBPlayerRefresh_SuccessScore,
 | 
 |  |  |                            TYPE_Price_Xiantao:CDBPlayerRefresh_Xiantao,
 | 
 |  |  |                            TYPE_Price_Lingyu:CDBPlayerRefresh_Lingyu,
 | 
 |  |  |                            TYPE_Price_FamilyFlagWarPoint:CDBPlayerRefresh_FamilyFlagWarPoint,
 | 
 |  |  |                            TYPE_Price_BossTrial:CDBPlayerRefresh_BossTrial,
 | 
 |  |  |                            TYPE_Price_GatherSoul:CDBPlayerRefresh_GatherSoul,
 |