From 530971bfbab8b0bab8fe7a13c4b84e68935b6e46 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 31 十月 2018 14:28:53 +0800
Subject: [PATCH] 4436 【后端】【1.2.0】功能预告界面修改,新增可领取奖励

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                   |   16 ++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py                     |   20 ++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py              |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                   |    4 +
 PySysDB/PySysDBPY.h                                                                                      |    8 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/GameFuncComm.py               |   33 +++++++++++++++-
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                        |   16 ++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                          |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py |    1 
 9 files changed, 83 insertions(+), 20 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 9805bdf..5efdcb1 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1331,4 +1331,12 @@
 	BYTE		IsBind;	//是否绑定
 	DWORD		Weight;	//权重
 	DWORD		Mark;	//排序用标识
+};
+
+//功能预告表
+
+struct tagFunctionForecast
+{
+	DWORD		_FuncID;	//功能ID
+	dict		Award;	//属性类型
 };
\ No newline at end of file
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 6832b79..0fbfd19 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -12171,6 +12171,7 @@
     _fields_ = [
                   ("FuncID", c_ubyte),    # 功能ID
                   ("State", c_ubyte),    # 是否开启
+                  ("AwardState", c_ubyte),    # 是否已领奖励
                   ]
 
     def __init__(self):
@@ -12185,6 +12186,7 @@
     def Clear(self):
         self.FuncID = 0
         self.State = 0
+        self.AwardState = 0
         return
 
     def GetLength(self):
@@ -12196,11 +12198,13 @@
     def OutputString(self):
         DumpString = '''//A3 02 功能开通状态 //tagMCFuncOpenStateList:
                                 FuncID:%d,
-                                State:%d
+                                State:%d,
+                                AwardState:%d
                                 '''\
                                 %(
                                 self.FuncID,
-                                self.State
+                                self.State,
+                                self.AwardState
                                 )
         return DumpString
 
@@ -17200,7 +17204,6 @@
                   ("Value3", c_int),    # 自定义值3
                   ("Value4", c_int),    # 自定义值4
                   ("Value5", c_int),    # 自定义值5
-                  ("Value6", c_int),    # 自定义值6
                   ]
 
     def __init__(self):
@@ -17219,7 +17222,6 @@
         self.Value3 = 0
         self.Value4 = 0
         self.Value5 = 0
-        self.Value6 = 0
         return
 
     def GetLength(self):
@@ -17235,8 +17237,7 @@
                                 Value2:%d,
                                 Value3:%d,
                                 Value4:%d,
-                                Value5:%d,
-                                Value6:%d
+                                Value5:%d
                                 '''\
                                 %(
                                 self.SetNum,
@@ -17244,8 +17245,7 @@
                                 self.Value2,
                                 self.Value3,
                                 self.Value4,
-                                self.Value5,
-                                self.Value6
+                                self.Value5
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 2b1af98..c08ddbc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3305,6 +3305,7 @@
 Def_Player_Dict_FBHistoryMaxLine = "FBHistoryMaxLine_%s"  # 副本历史最高通关, 参数为副本ID
 Def_Player_Dict_RefurbishGoodBookPlayerLv = "RefurbishGoodBookPlayerLv_97"  # 刷新天书任务时的玩家等级
 Def_Player_Dict_GameFuncFirstTouch = "GameFuncFirstTouch_%s"  # 服务端功能首次触发开启状态; 参数, key编号
+Def_Player_Dict_GameFuncAwardState = "GameFuncAwardState_%s"  # 服务端功能开启领奖状态; 参数, key编号
 Def_Player_Dict_MissionFinish = "MissionFinish_%s"  # 任务是否完成; 参数, 任务ID, 只会记录部分需要记录的任务ID 
 Def_Player_Dict_FamilyArrestAwardState = "ArrestAwardState_103"  # 家族悬赏奖励领取情况
 Def_Player_Dict_OtherDayLogin = "OtherDayLogin_105"  # 非同一天二次登陆
@@ -5021,7 +5022,8 @@
 Def_RewardType_FCParty, # 仙界盛典全民来嗨14
 Def_RewardType_DownLoad, # 分包下载奖励15
 Def_RewardType_WishingWell, # 许愿池奖励16
-)= range(17)
+Def_RewardType_OpenFunc, # 功能开启奖励17
+)= range(18)
 
 
 #boss复活相关活动定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 6832b79..0fbfd19 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -12171,6 +12171,7 @@
     _fields_ = [
                   ("FuncID", c_ubyte),    # 功能ID
                   ("State", c_ubyte),    # 是否开启
+                  ("AwardState", c_ubyte),    # 是否已领奖励
                   ]
 
     def __init__(self):
@@ -12185,6 +12186,7 @@
     def Clear(self):
         self.FuncID = 0
         self.State = 0
+        self.AwardState = 0
         return
 
     def GetLength(self):
@@ -12196,11 +12198,13 @@
     def OutputString(self):
         DumpString = '''//A3 02 功能开通状态 //tagMCFuncOpenStateList:
                                 FuncID:%d,
-                                State:%d
+                                State:%d,
+                                AwardState:%d
                                 '''\
                                 %(
                                 self.FuncID,
-                                self.State
+                                self.State,
+                                self.AwardState
                                 )
         return DumpString
 
@@ -17200,7 +17204,6 @@
                   ("Value3", c_int),    # 自定义值3
                   ("Value4", c_int),    # 自定义值4
                   ("Value5", c_int),    # 自定义值5
-                  ("Value6", c_int),    # 自定义值6
                   ]
 
     def __init__(self):
@@ -17219,7 +17222,6 @@
         self.Value3 = 0
         self.Value4 = 0
         self.Value5 = 0
-        self.Value6 = 0
         return
 
     def GetLength(self):
@@ -17235,8 +17237,7 @@
                                 Value2:%d,
                                 Value3:%d,
                                 Value4:%d,
-                                Value5:%d,
-                                Value6:%d
+                                Value5:%d
                                 '''\
                                 %(
                                 self.SetNum,
@@ -17244,8 +17245,7 @@
                                 self.Value2,
                                 self.Value3,
                                 self.Value4,
-                                self.Value5,
-                                self.Value6
+                                self.Value5
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py
index 5d4e613..5bb0c5d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/OpenFunc.py
@@ -45,6 +45,7 @@
                 
             for keyNum in xrange(8):
                 PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncFirstTouch % keyNum, 0)
+                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState % keyNum, 0)
                 
             needLV, needMagicWeaponIDList, needRealmLV, needMissionIDList = __GetOpenFuncLimit([])
             for missionID in needMissionIDList:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
index 0072881..5689461 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -1557,6 +1557,7 @@
         return 0
     #任务
     EventShell.EventRespons_FBEvent(curPlayer, 'fbhelp')
+    EventShell.EventRespons_FBEvent(curPlayer, 'fbhelp_%s'%mapID)
     # 每日活动
     PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FBHelp)
     addHelpPoint = helpPoint * addFBCnt
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index ff4ccf2..e73c365 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1058,6 +1058,11 @@
                         ("DWORD", "Weight", 0),
                         ("DWORD", "Mark", 0),
                         ),
+
+                "FunctionForecast":(
+                        ("DWORD", "FuncID", 1),
+                        ("dict", "Award", 0),
+                        ),
                 }
 
 
@@ -3211,6 +3216,17 @@
     def GetIsBind(self): return self.IsBind # 是否绑定
     def GetWeight(self): return self.Weight # 权重
     def GetMark(self): return self.Mark # 排序用标识
+
+# 功能预告表
+class IPY_FunctionForecast():
+    
+    def __init__(self):
+        self.FuncID = 0
+        self.Award = {}
+        return
+        
+    def GetFuncID(self): return self.FuncID # 功能ID
+    def GetAward(self): return self.Award # 属性类型
 
 
 def Log(msg, playerID=0, par=0):
@@ -3430,6 +3446,8 @@
         self.ipyActWishingWellLen = len(self.ipyActWishingWellCache)
         self.ipyWishingWellCache = self.__LoadFileData("WishingWell", IPY_WishingWell)
         self.ipyWishingWellLen = len(self.ipyWishingWellCache)
+        self.ipyFunctionForecastCache = self.__LoadFileData("FunctionForecast", IPY_FunctionForecast)
+        self.ipyFunctionForecastLen = len(self.ipyFunctionForecastCache)
         Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
         Log("IPY_DataMgr InitOK!")
         return
@@ -3790,6 +3808,8 @@
     def GetActWishingWellByIndex(self, index): return self.ipyActWishingWellCache[index]
     def GetWishingWellCount(self): return self.ipyWishingWellLen
     def GetWishingWellByIndex(self, index): return self.ipyWishingWellCache[index]
+    def GetFunctionForecastCount(self): return self.ipyFunctionForecastLen
+    def GetFunctionForecastByIndex(self, index): return self.ipyFunctionForecastCache[index]
 
 IPYData = IPY_DataMgr()
 def IPY_Data(): return IPYData
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 2f6a129..69dbdd4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5050,7 +5050,9 @@
     # 领取许愿池奖励
     elif rewardType == ChConfig.Def_RewardType_WishingWell:
         PlayerWishingWell.DoGetWishingAward(curPlayer)
-    
+    # 功能开启奖励
+    elif rewardType == ChConfig.Def_RewardType_OpenFunc:
+        GameFuncComm.GetFuncOpenAward(curPlayer, dataEx)
 #
 #    # 充值豪礼奖励
 #    elif rewardType == ShareDefine.Def_RewardType_GoldGift:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/GameFuncComm.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/GameFuncComm.py
index f4244ea..28f1901 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/GameFuncComm.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/GameFuncComm.py
@@ -41,8 +41,9 @@
 import PlayerFreeGoods
 import FunctionNPCCommon
 import PlayerGreatMaster
-
-
+import IPY_GameWorld
+import ItemCommon
+import ItemControler
 
 
 # 功能开启需执行的函数{功能ID:执行函数, ...} 函数需返回是否激活成功, 功能开启有需要处理功能逻辑的这里增加函数调用配置即可
@@ -154,6 +155,33 @@
     
     return ipyData.GetLimitLV()
 
+def GetFuncOpenAward(curPlayer, funcID):
+    ## 领取功能开启奖励
+    ipyData = IpyGameDataPY.GetIpyGameData('FunctionForecast', funcID)
+    if not ipyData:
+        return
+    getState = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState, funcID)
+    if getState:
+        return
+    awardDict = ipyData.GetAward()
+    job = curPlayer.GetJob()
+    itemList = awardDict.get(str(job))
+    if not itemList:
+        return
+    # 检查背包
+    needSpace = len(itemList)
+    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
+    if needSpace > packSpace:
+        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+        return
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState, funcID, 1)
+    
+    # 给物品
+    for itemID, itemCount in itemList:
+        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 1, [IPY_GameWorld.rptItem])
+    Sync_FuncOpenState(curPlayer, [funcID])
+    return
+    
 def Sync_FuncOpenState(curPlayer, syncFuncIDList=[], isSyncUnOpen=False):
     ## 通知功能首次触发情况
     if not syncFuncIDList:
@@ -174,6 +202,7 @@
         funcOpenState.Clear()
         funcOpenState.FuncID = funcID
         funcOpenState.State = openState
+        funcOpenState.AwardState = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GameFuncAwardState, funcID)
         funcStatePack.FuncStateList.append(funcOpenState)
     funcCount = len(funcStatePack.FuncStateList) 
     funcStatePack.FuncCount = funcCount

--
Gitblit v1.8.0