From ee8463d3e723446c652324e398582252f955a8db Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期一, 14 一月 2019 19:21:13 +0800
Subject: [PATCH] 5805 【后端】【1.5】新增增加跨服匹配次数的道具

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddCrossRealmPKCnt.py           |   46 +++++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                                |    8 +++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py                                    |    3 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py |    6 ++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                                     |    8 +++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py                      |   11 ++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                                       |    2 +
 7 files changed, 75 insertions(+), 9 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 4611140..8f1f990 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -28195,6 +28195,7 @@
                   ("DayPKCount", c_ubyte),    # 当日已PK次数
                   ("DayWinCount", c_ubyte),    # 当日已胜利次数
                   ("DayBuyCount", c_ubyte),    # 当日已购买次数
+                  ("DayItemAddCount", c_ubyte),    # 当日物品增加次数
                   ]
 
     def __init__(self):
@@ -28219,6 +28220,7 @@
         self.DayPKCount = 0
         self.DayWinCount = 0
         self.DayBuyCount = 0
+        self.DayItemAddCount = 0
         return
 
     def GetLength(self):
@@ -28238,7 +28240,8 @@
                                 CWinCount:%d,
                                 DayPKCount:%d,
                                 DayWinCount:%d,
-                                DayBuyCount:%d
+                                DayBuyCount:%d,
+                                DayItemAddCount:%d
                                 '''\
                                 %(
                                 self.Cmd,
@@ -28250,7 +28253,8 @@
                                 self.CWinCount,
                                 self.DayPKCount,
                                 self.DayWinCount,
-                                self.DayBuyCount
+                                self.DayBuyCount,
+                                self.DayItemAddCount
                                 )
         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 a210acf..a25a08f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -355,6 +355,7 @@
 Def_ItemType_DogzEquipTooth = 121   # 神兽獠牙
 Def_ItemType_DogzEquipClaw = 122    # 神兽兽爪
 Def_ItemType_DogzEquipScute = 123   # 神兽鳞甲
+Def_ItemType_AddCrossRealmPKCnt = 127 #增加跨服PK次数
 
 #以下定义物品类型下次删除
 Def_Item_Type_Horse = 1000036          #坐骑
@@ -3852,6 +3853,7 @@
 Def_PDict_CrossPK_TodayPKCount = "CrossPK_TodayPKCount" # 今日已PK次数
 Def_PDict_CrossPK_TodayWinCount = "CrossPK_TodayWinCount" # 今日已胜利次数
 Def_PDict_CrossPK_TodayBuyCount = "CrossPK_TodayBuyCount" # 今日已购买PK次数
+Def_PDict_CrossPK_ItemAddCount = "CrossPK_ItemAddCount" # 今日道具增加PK次数
 Def_PDict_CrossPK_DayPKCountAwardState = "CrossPK_DayPKCountAwardState" # 每日匹配次数奖励记录,二进制位存储是否已领取,按匹配次数升序排序索引代表奖励位
 Def_PDict_CrossPK_DayWinCountAwardState = "CrossPK_DayWinCountAwardState" # 每日胜利次数奖励记录,二进制位存储是否已领取,按胜利次数升序排序索引代表奖励位
 Def_PDict_CrossPK_DanLVAwardState = "CrossPK_DanLVAwardState" # 段位达标奖励记录,二进制位存储是否已领取,按段位代表奖励位
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 4611140..8f1f990 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -28195,6 +28195,7 @@
                   ("DayPKCount", c_ubyte),    # 当日已PK次数
                   ("DayWinCount", c_ubyte),    # 当日已胜利次数
                   ("DayBuyCount", c_ubyte),    # 当日已购买次数
+                  ("DayItemAddCount", c_ubyte),    # 当日物品增加次数
                   ]
 
     def __init__(self):
@@ -28219,6 +28220,7 @@
         self.DayPKCount = 0
         self.DayWinCount = 0
         self.DayBuyCount = 0
+        self.DayItemAddCount = 0
         return
 
     def GetLength(self):
@@ -28238,7 +28240,8 @@
                                 CWinCount:%d,
                                 DayPKCount:%d,
                                 DayWinCount:%d,
-                                DayBuyCount:%d
+                                DayBuyCount:%d,
+                                DayItemAddCount:%d
                                 '''\
                                 %(
                                 self.Cmd,
@@ -28250,7 +28253,8 @@
                                 self.CWinCount,
                                 self.DayPKCount,
                                 self.DayWinCount,
-                                self.DayBuyCount
+                                self.DayBuyCount,
+                                self.DayItemAddCount
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py
index b53635b..ab094da 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_MagicWeapon.py
@@ -29,6 +29,7 @@
 import EventReport
 import PlayerGoldGift
 import PlayerMagicWeapon
+import ChPlayer
 
 #---副本配置对应key值---
 (
@@ -328,7 +329,10 @@
     playerManager = GameWorld.GetMapCopyPlayerManager()
     if playerManager.GetPlayerCount() > 0:
         curPlayer = playerManager.GetPlayerByIndex(0)
-        curPlayer.SetHP(curPlayer.GetMaxHP())
+        if curPlayer.GetHP() <=0:
+            ChPlayer.PlayerRebornByType(curPlayer, ChConfig.rebornType_System, tick)
+        else:
+            curPlayer.SetHP(curPlayer.GetMaxHP())
         DoFBHelp(curPlayer, tick)
     
     FBCommon.SetFBStep(FB_Step_Fighting, tick)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
index 752bfb7..8d9824c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChItem.py
@@ -705,7 +705,8 @@
                            ChConfig.Def_ItemType_GiveMoney:"Item_GiveMoney",         # 给人物金钱
                            ChConfig.Def_ItemType_AddLimitBuff:"Item_Add_LimitingBuff",         # 给限时buff物品
                            ChConfig.Def_ItemType_AddExpBuff:"Item_Add_LimitingBuff",         # 给限时buff物品
-                           ChConfig.Def_ItemType_ResetAttrPoint:"Item_ResetAttrPoint"    #单个属性点重置
+                           ChConfig.Def_ItemType_ResetAttrPoint:"Item_ResetAttrPoint",    #单个属性点重置
+                           ChConfig.Def_ItemType_AddCrossRealmPKCnt:"Item_AddCrossRealmPKCnt"    #增加跨服PK次数
                            } 
     
     #根据物品效果使用{物品效果ID:call的py名}
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddCrossRealmPKCnt.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddCrossRealmPKCnt.py
new file mode 100644
index 0000000..2a68f91
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddCrossRealmPKCnt.py
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package UseItem.Item_AddCrossRealmPKCnt
+#
+# @todo:增加跨服PK次数
+# @author xdh
+# @date 2019-01-14
+# @version 1.0
+#
+# 详细描述: 增加跨服PK次数
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2018-03-09 12:00"""
+#-------------------------------------------------------------------------------
+import ItemCommon
+import PlayerCrossRealmPK
+import PlayerControl
+import ChConfig
+import CrossRealmPlayer
+import GameWorld
+
+
+def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
+    ##批量使用物品
+    playerID = curPlayer.GetID()
+    #curEff = curRoleItem.GetEffectByIndex(0)
+    addCnt = useCnt #curEff.GetEffectValue(0)
+    if not CrossRealmPlayer.IsCrossServerOpen():
+        PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
+        return
+    if not PlayerCrossRealmPK.IsCrossRealmPKMatchState():
+        GameWorld.DebugLog("跨服匹配未开启,不可进行使用物品增加次数!", playerID)
+        return
+    todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
+
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, todayItemAddCount+addCnt)
+    
+    ItemCommon.DelItem(curPlayer, curRoleItem, useCnt, True, ChConfig.ItemDel_AddFBCnt)
+    PlayerCrossRealmPK.SyncCrossRealmPKPlayerInfo(curPlayer)
+    
+    PlayerControl.NotifyCode(curPlayer, 'CrossMatching25', [useCnt])
+    
+    return True, useCnt
+
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
index 6509b9c..0629b71 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCrossRealmPK.py
@@ -65,6 +65,7 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
     SyncCrossRealmPKPlayerInfo(curPlayer)
@@ -168,6 +169,7 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayPKCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayWinCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_TodayBuyCount, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_ItemAddCount, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayPKCountAwardState, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DayWinCountAwardState, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CrossPK_DanLVAwardState, 0)
@@ -229,9 +231,11 @@
         if dayFreeMatchCountMax:
             todayPKCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
             todayBuyCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
-            if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount):
-                GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s)" 
-                                   % (todayPKCount, dayFreeMatchCountMax, todayBuyCount), playerID)
+            todayItemAddCount  = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
+            
+            if todayPKCount >= (dayFreeMatchCountMax + todayBuyCount + todayItemAddCount):
+                GameWorld.DebugLog("PK次数不足,无法发起匹配! todayPKCount=%s >= (dayFreeMatchCountMax=%s + todayBuyCount=%s + todayItemAddCount=%s)" 
+                                   % (todayPKCount, dayFreeMatchCountMax, todayBuyCount, todayItemAddCount), playerID)
                 return
             
         dataMsg = {
@@ -633,6 +637,7 @@
     pkPlayerInfo.DayPKCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayPKCount)
     pkPlayerInfo.DayWinCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayWinCount)
     pkPlayerInfo.DayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_TodayBuyCount)
+    pkPlayerInfo.DayItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CrossPK_ItemAddCount)
     NetPackCommon.SendFakePack(curPlayer, pkPlayerInfo)
     return
     

--
Gitblit v1.8.0