From d91f6d7897e0fd7a8b979a0bc70f7593e99bfc12 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 13 四月 2021 16:02:44 +0800
Subject: [PATCH] 8896 【BT2】【主干】【后端】特权令
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini | 16 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 123 +++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py | 12
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py | 123 +++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintMoney.py | 19 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFuncSysPrivilege.py | 62 ++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFuncSysPrivilege.py | 175 +++++++++++++++++++
8 files changed, 520 insertions(+), 12 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index f797d9d..69ae6c7 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -15370,6 +15370,73 @@
#------------------------------------------------------
+# B2 09 激活功能系统特权奖励 #tagMCActivateFuncSysPrivilege
+
+class tagMCActivateFuncSysPrivilege(Structure):
+ Head = tagHead()
+ ActivateCount = 0 #(BYTE ActivateCount)// 激活个数
+ ActivateFuncSysIDList = list() #(vector<BYTE> ActivateFuncSysIDList)// 激活功能系统ID列表,全部激活则需要发所有ID列表
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x09
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.ActivateCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ for i in range(self.ActivateCount):
+ value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
+ self.ActivateFuncSysIDList.append(value)
+ return _pos
+
+ def Clear(self):
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x09
+ self.ActivateCount = 0
+ self.ActivateFuncSysIDList = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += self.Head.GetLength()
+ length += 1
+ length += 1 * self.ActivateCount
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteBYTE(data, self.ActivateCount)
+ for i in range(self.ActivateCount):
+ data = CommFunc.WriteBYTE(data, self.ActivateFuncSysIDList[i])
+ return data
+
+ def OutputString(self):
+ DumpString = '''
+ Head:%s,
+ ActivateCount:%d,
+ ActivateFuncSysIDList:%s
+ '''\
+ %(
+ self.Head.OutputString(),
+ self.ActivateCount,
+ "..."
+ )
+ return DumpString
+
+
+m_NAtagMCActivateFuncSysPrivilege=tagMCActivateFuncSysPrivilege()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActivateFuncSysPrivilege.Head.Cmd,m_NAtagMCActivateFuncSysPrivilege.Head.SubCmd))] = m_NAtagMCActivateFuncSysPrivilege
+
+
+#------------------------------------------------------
# B2 06 玩家加点 #tagCMAddPoint
class tagCMAddPoint(Structure):
@@ -15555,6 +15622,62 @@
#------------------------------------------------------
+# B2 10 领取功能系统特权奖励 #tagCMGetFuncSysPrivilegeAward
+
+class tagCMGetFuncSysPrivilegeAward(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("FuncSysID", c_ubyte), # 功能系统ID
+ ("DayNum", c_ubyte), # 第X天,1为第1天
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xB2
+ self.SubCmd = 0x10
+ 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 = 0x10
+ self.FuncSysID = 0
+ self.DayNum = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagCMGetFuncSysPrivilegeAward)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// B2 10 领取功能系统特权奖励 //tagCMGetFuncSysPrivilegeAward:
+ Cmd:%s,
+ SubCmd:%s,
+ FuncSysID:%d,
+ DayNum:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.FuncSysID,
+ self.DayNum
+ )
+ return DumpString
+
+
+m_NAtagCMGetFuncSysPrivilegeAward=tagCMGetFuncSysPrivilegeAward()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGetFuncSysPrivilegeAward.Cmd,m_NAtagCMGetFuncSysPrivilegeAward.SubCmd))] = m_NAtagCMGetFuncSysPrivilegeAward
+
+
+#------------------------------------------------------
# B2 07 重置加点 #tagCMResetAttrPoint
class tagCMResetAttrPoint(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index e93fc45..5078936 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1510,6 +1510,22 @@
PacketSubCMD_2=0x11
PacketCallFunc_2=OnFeastWishPoolWish
+;功能系统特权
+[PlayerFuncSysPrivilege]
+ScriptName = Player\PlayerFuncSysPrivilege.py
+Writer = hxp
+Releaser = hxp
+RegType = 0
+RegisterPackCount = 2
+
+PacketCMD_1=0xB2
+PacketSubCMD_1=0x09
+PacketCallFunc_1=OnActivateFuncSysPrivilege
+
+PacketCMD_2=0xB2
+PacketSubCMD_2=0x10
+PacketCallFunc_2=OnGetFuncSysPrivilegeAward
+
;缥缈仙域
[PlayerFairyDomain]
ScriptName = Player\PlayerFairyDomain.py
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index f797d9d..69ae6c7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -15370,6 +15370,73 @@
#------------------------------------------------------
+# B2 09 激活功能系统特权奖励 #tagMCActivateFuncSysPrivilege
+
+class tagMCActivateFuncSysPrivilege(Structure):
+ Head = tagHead()
+ ActivateCount = 0 #(BYTE ActivateCount)// 激活个数
+ ActivateFuncSysIDList = list() #(vector<BYTE> ActivateFuncSysIDList)// 激活功能系统ID列表,全部激活则需要发所有ID列表
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x09
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.ActivateCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ for i in range(self.ActivateCount):
+ value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
+ self.ActivateFuncSysIDList.append(value)
+ return _pos
+
+ def Clear(self):
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0xB2
+ self.Head.SubCmd = 0x09
+ self.ActivateCount = 0
+ self.ActivateFuncSysIDList = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += self.Head.GetLength()
+ length += 1
+ length += 1 * self.ActivateCount
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteBYTE(data, self.ActivateCount)
+ for i in range(self.ActivateCount):
+ data = CommFunc.WriteBYTE(data, self.ActivateFuncSysIDList[i])
+ return data
+
+ def OutputString(self):
+ DumpString = '''
+ Head:%s,
+ ActivateCount:%d,
+ ActivateFuncSysIDList:%s
+ '''\
+ %(
+ self.Head.OutputString(),
+ self.ActivateCount,
+ "..."
+ )
+ return DumpString
+
+
+m_NAtagMCActivateFuncSysPrivilege=tagMCActivateFuncSysPrivilege()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActivateFuncSysPrivilege.Head.Cmd,m_NAtagMCActivateFuncSysPrivilege.Head.SubCmd))] = m_NAtagMCActivateFuncSysPrivilege
+
+
+#------------------------------------------------------
# B2 06 玩家加点 #tagCMAddPoint
class tagCMAddPoint(Structure):
@@ -15555,6 +15622,62 @@
#------------------------------------------------------
+# B2 10 领取功能系统特权奖励 #tagCMGetFuncSysPrivilegeAward
+
+class tagCMGetFuncSysPrivilegeAward(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("FuncSysID", c_ubyte), # 功能系统ID
+ ("DayNum", c_ubyte), # 第X天,1为第1天
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xB2
+ self.SubCmd = 0x10
+ 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 = 0x10
+ self.FuncSysID = 0
+ self.DayNum = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagCMGetFuncSysPrivilegeAward)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// B2 10 领取功能系统特权奖励 //tagCMGetFuncSysPrivilegeAward:
+ Cmd:%s,
+ SubCmd:%s,
+ FuncSysID:%d,
+ DayNum:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.FuncSysID,
+ self.DayNum
+ )
+ return DumpString
+
+
+m_NAtagCMGetFuncSysPrivilegeAward=tagCMGetFuncSysPrivilegeAward()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGetFuncSysPrivilegeAward.Cmd,m_NAtagCMGetFuncSysPrivilegeAward.SubCmd))] = m_NAtagCMGetFuncSysPrivilegeAward
+
+
+#------------------------------------------------------
# B2 07 重置加点 #tagCMResetAttrPoint
class tagCMResetAttrPoint(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFuncSysPrivilege.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFuncSysPrivilege.py
new file mode 100644
index 0000000..f10ea68
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFuncSysPrivilege.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.ClearFuncSysPrivilege
+#
+# @todo:重置功能系统特权
+# @author hxp
+# @date 2021-04-13
+# @version 1.0
+#
+# 详细描述: 重置功能系统特权
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2021-04-13 16:00"""
+#-------------------------------------------------------------------------------
+
+import ChConfig
+import PlayerControl
+import PlayerFuncSysPrivilege
+import IpyGameDataPY
+import GameWorld
+
+#---------------------------------------------------------------------
+#全局变量
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+#逻辑实现
+## GM命令执行入口
+# @param curPlayer 当前玩家
+# @param list 参数列表 [npcID]
+# @return None
+# @remarks 函数详细说明.
+def OnExec(curPlayer, paramList):
+
+ if not paramList:
+ GameWorld.DebugAnswer(curPlayer, "重置所有: ClearFuncSysPrivilege 0")
+ GameWorld.DebugAnswer(curPlayer, "重置指定: ClearFuncSysPrivilege 功能系统ID")
+ return
+
+ ipyDataMgr = IpyGameDataPY.IPY_Data()
+ lastIpyData = ipyDataMgr.GetFuncSysPrivilegeByIndex(ipyDataMgr.GetFuncSysPrivilegeCount() - 1)
+ maxFuncID = lastIpyData.GetFuncSysID()
+
+ resetID = paramList[0]
+ if resetID == 0:
+ resetIDList = range(1, maxFuncID + 1)
+ elif resetID > maxFuncID:
+ GameWorld.DebugAnswer(curPlayer, "该功能系统ID不存在!")
+ return
+ else:
+ resetIDList = [resetID]
+
+ for funcSysID in resetIDList:
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FuncSysPrivilegeActTime % funcSysID, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FuncSysPrivilegeAward % funcSysID, 0)
+
+ GameWorld.DebugAnswer(curPlayer, "重置功能系统特权OK!%s" % resetIDList)
+ PlayerFuncSysPrivilege.Sync_FuncSysPrivilege(curPlayer, resetIDList)
+ return
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintMoney.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintMoney.py
index 473210f..6e5be71 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintMoney.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/PrintMoney.py
@@ -12,10 +12,10 @@
# VER = "2010-05-12 18:30" zhengyang 添加注释
#
# 模块详细说明
+
import GameWorld
import PlayerControl
-import ShareDefine
-import Lang
+import SetMoney
## GM命令执行入口
# @param curPlayer 当前玩家
@@ -23,11 +23,16 @@
# @return None
# @remarks 函数详细说明.
def OnExec(curPlayer, msgList):
- GameWorld.DebugAnswer(curPlayer, Lang.GBText("1仙玉=%s" % curPlayer.GetGold()))
- GameWorld.DebugAnswer(curPlayer, Lang.GBText("2绑玉=%s" % curPlayer.GetGoldPaper()))
- GameWorld.DebugAnswer(curPlayer, Lang.GBText("3铜钱=%s" % PlayerControl.GetSilver(curPlayer)))
- GameWorld.DebugAnswer(curPlayer, Lang.GBText("4银票=%s" % curPlayer.GetSilverPaper()))
- GameWorld.DebugAnswer(curPlayer, Lang.GBText("26集市额度=%s" % PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)))
+
+ if msgList:
+ moneyType = msgList[0]
+ name = SetMoney.moneyNameDict.get(moneyType, str(moneyType))
+ GameWorld.DebugAnswer(curPlayer, "%s%s=%s" % (moneyType, name, PlayerControl.GetMoney(curPlayer, moneyType)))
+ return
+
+ GameWorld.DebugAnswer(curPlayer, "--------------------")
+ for moneyType, name in SetMoney.moneyNameDict.items():
+ GameWorld.DebugAnswer(curPlayer, "%s%s=%s" % (moneyType, name, PlayerControl.GetMoney(curPlayer, moneyType)))
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py
index 1746fd8..1dfaf04 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py
@@ -24,17 +24,19 @@
import ChConfig
import ShareDefine
import GameWorld
+
+moneyNameDict = {
+ 1:"仙玉", 2:"绑玉", 3:"铜钱", 6:"战盟贡献度", 10:"战盟仓库积分", 13:"境界修行点", 14:"符印融合石", 15:"仙盟活跃令",
+ 16:"助战积分", 18:"荣誉", 19:"Boss积分", 23:"符印精华", 24:"符印碎片", 25:"寻宝积分", 26:"集市额度", 27:"丹精", 28:"魂尘",
+ 29:"聚魂碎片", 30:"核心环", 31:"功能特权令"
+ }
+
## GM命令执行入口
# @param curPlayer 当前玩家
# @param list 参数列表 [ <钱币类型><数量>]
# @return None
# @remarks 函数详细说明.
def OnExec(curPlayer, List):
- moneyNameDict = {
- 1:"仙玉", 2:"绑玉", 3:"铜钱", 6:"战盟贡献度", 10:"战盟仓库积分", 13:"境界修行点", 14:"符印融合石", 15:"仙盟活跃令",
- 16:"助战积分", 18:"荣誉", 19:"Boss积分", 23:"符印精华", 24:"符印碎片", 25:"寻宝积分", 26:"集市额度", 27:"丹精", 28:"魂尘",
- 29:"聚魂碎片", 30:"核心环"
- }
if len(List) == 1:
moneyType = List[0]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index d172d6f..ddd35f9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -1045,6 +1045,8 @@
PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_Honor, itemCount)
elif itemID == ChConfig.Def_ItemID_GoldMoney:
PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, itemCount, moneyEventName, addDict)
+ elif itemID == ChConfig.Def_ItemID_FuncSysPrivilege:
+ PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_FuncSysPrivilege, itemCount)
return True
def __CrossServerPutInItem(self, packIndex, tagItem, event=["", False, {}]):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFuncSysPrivilege.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFuncSysPrivilege.py
new file mode 100644
index 0000000..3c0f713
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFuncSysPrivilege.py
@@ -0,0 +1,175 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package Player.PlayerFuncSysPrivilege
+#
+# @todo:功能系统特权奖励
+# @author hxp
+# @date 2021-04-13
+# @version 1.0
+#
+# 详细描述: 功能系统特权奖励
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2021-04-13 16:00"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import IpyGameDataPY
+import PlayerControl
+import ItemControler
+import ChPyNetSendPack
+import NetPackCommon
+import IPY_GameWorld
+import ShareDefine
+import ChConfig
+
+import time
+
+def OnPlayerLogin(curPlayer):
+ Sync_FuncSysPrivilege(curPlayer)
+ return
+
+#// B2 09 激活功能系统特权奖励 #tagMCActivateFuncSysPrivilege
+#
+#struct tagMCActivateFuncSysPrivilege
+#{
+# tagHead Head;
+# BYTE ActivateCount; // 激活个数
+# BYTE ActivateFuncSysIDList[ActivateCount]; // 激活功能系统ID列表,全部激活则需要发所有ID列表
+#};
+def OnActivateFuncSysPrivilege(index, clientData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ activateFuncSysIDList = clientData.ActivateFuncSysIDList
+
+ GameWorld.DebugLog("请求激活功能系统特权: %s" % activateFuncSysIDList)
+
+ curTime = int(time.time())
+ canActivateList = []
+ for funcSysID in activateFuncSysIDList:
+ ipyDatList = IpyGameDataPY.GetIpyGameDataList("FuncSysPrivilege", funcSysID)
+ if not ipyDatList:
+ continue
+
+ actTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeActTime % funcSysID)
+ if actTime:
+ maxDays = len(ipyDatList)
+ diffDays = GameWorld.GetDiff_Day(curTime, actTime)
+ if diffDays < maxDays:
+ GameWorld.DebugLog(" 未超过奖励最大天,不可激活: funcSysID=%s,diffDays(%s) < maxDays(%s)" % (funcSysID, diffDays, maxDays))
+ continue
+
+ isGetAll = True
+ awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeAward % funcSysID)
+ for ipyData in ipyDatList:
+ dayNum = ipyData.GetDayNum()
+ if not awardState & pow(2, dayNum):
+ isGetAll = False
+ GameWorld.DebugLog(" 还有未领取的奖励,不可激活: funcSysID=%s,dayNum=%s" % (funcSysID, dayNum))
+ break
+
+ if not isGetAll:
+ continue
+ canActivateList.append(funcSysID)
+
+ GameWorld.DebugLog(" 可激活的功能系统特权: %s" % canActivateList)
+ if not canActivateList:
+ return
+
+ needMoney = len(canActivateList) # 开通1个花费1
+ infoDict = {ChConfig.Def_Cost_Reason_SonKey:canActivateList}
+ if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_FuncSysPrivilege, needMoney, infoDict=infoDict):
+ GameWorld.DebugLog(" 货币不足! needMoney=%s" % needMoney)
+ return
+
+ for funcSysID in canActivateList:
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FuncSysPrivilegeActTime % funcSysID, curTime)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FuncSysPrivilegeAward % funcSysID, 0)
+
+ Sync_FuncSysPrivilege(curPlayer, canActivateList)
+ return
+
+#// B2 10 领取功能系统特权奖励 #tagCMGetFuncSysPrivilegeAward
+#
+#struct tagCMGetFuncSysPrivilegeAward
+#{
+# tagHead Head;
+# BYTE FuncSysID; // 功能系统ID
+# BYTE DayNum; // 第X天,1为第1天
+#};
+def OnGetFuncSysPrivilegeAward(index, clientData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ funcSysID = clientData.FuncSysID
+ dayNum = clientData.DayNum
+
+ actTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeActTime % funcSysID)
+ if not actTime:
+ GameWorld.DebugLog("未激活,不可领奖!funcSysID=%s" % (funcSysID))
+ return
+
+ curTime = int(time.time())
+ canGetMaxDayNum = GameWorld.GetDiff_Day(curTime, actTime) + 1
+ if dayNum > canGetMaxDayNum:
+ GameWorld.DebugLog("未达到领奖天,不可领奖!funcSysID=%s,dayNum(%s) > canGetMaxDayNum(%s), actTime=%s"
+ % (funcSysID, dayNum, canGetMaxDayNum, GameWorld.ChangeTimeNumToStr(actTime)))
+ return
+
+ awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeAward % funcSysID)
+ if awardState & pow(2, dayNum):
+ GameWorld.DebugLog("已领取过该天奖励!funcSysID=%s,dayNum=%s,awardState=%s" % (funcSysID, dayNum, awardState))
+ return
+
+ ipyDatList = IpyGameDataPY.GetIpyGameDataList("FuncSysPrivilege", funcSysID)
+ if not ipyDatList:
+ return
+
+ findIpyData = None
+ for ipyData in ipyDatList:
+ if ipyData.GetFuncSysID() == funcSysID and ipyData.GetDayNum() == dayNum:
+ findIpyData = ipyData
+ break
+ if not findIpyData:
+ GameWorld.DebugLog("找不到该天奖励!funcSysID=%s,dayNum=%s" % (funcSysID, dayNum))
+ return
+
+ awardItemList = findIpyData.GetDayAwardItemInfo()
+ if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
+ return
+
+ updAwardState = awardState | pow(2, dayNum)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FuncSysPrivilegeAward % funcSysID, updAwardState)
+
+ for itemID, itemCount, isAuctionItem in awardItemList:
+ ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem],
+ event=["FuncSysPrivilegeAward", False, {}])
+
+ Sync_FuncSysPrivilege(curPlayer, [funcSysID])
+ return
+
+def Sync_FuncSysPrivilege(curPlayer, syncIDList=[]):
+ if not syncIDList:
+ ipyDataMgr = IpyGameDataPY.IPY_Data()
+ lastIpyData = ipyDataMgr.GetFuncSysPrivilegeByIndex(ipyDataMgr.GetFuncSysPrivilegeCount() - 1)
+ maxFuncID = lastIpyData.GetFuncSysID()
+ for funcSysID in xrange(1, maxFuncID + 1):
+ if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeActTime % funcSysID):
+ syncIDList.append(funcSysID)
+
+ if not syncIDList:
+ return
+
+ clientPack = ChPyNetSendPack.tagMCFuncSysPrivilegeInfoList()
+ clientPack.PrivilegeInfoList = []
+ for funcSysID in syncIDList:
+ info = ChPyNetSendPack.tagMCFuncSysPrivilegeInfo()
+ info.FuncSysID = funcSysID
+ info.ActivateTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeActTime % funcSysID)
+ info.AwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FuncSysPrivilegeAward % funcSysID)
+
+ clientPack.PrivilegeInfoList.append(info)
+ clientPack.PrivilegeCount = len(clientPack.PrivilegeInfoList)
+ NetPackCommon.SendFakePack(curPlayer, clientPack)
+ return
+
+
--
Gitblit v1.8.0