From dbcdbf7daf12e2a94ea4d3f1c37c10f998deb8c6 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 24 十二月 2019 16:16:23 +0800
Subject: [PATCH] 8359 【主干】活跃兑换(快速完成增加可指定次数) 8346 【恺英】【后端】协助系统(增加每日协助活跃令上限及社交加成记录)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py | 21 +++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 8 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 56 ++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py | 40 ++++++++++
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py | 8 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py | 9 -
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 56 ++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 2
8 files changed, 183 insertions(+), 17 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 2ae3d31..e2a4c82 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -14013,6 +14013,7 @@
_fields_ = [
("Cmd", c_ubyte),
("SubCmd", c_ubyte),
+ ("FinishCount", c_ubyte), #完成次数
]
def __init__(self):
@@ -14029,6 +14030,7 @@
def Clear(self):
self.Cmd = 0xB0
self.SubCmd = 0x28
+ self.FinishCount = 0
return
def GetLength(self):
@@ -14040,11 +14042,13 @@
def OutputString(self):
DumpString = '''// B0 28 活跃放置快速完成 //tagCMActivityPlaceQuickFinish:
Cmd:%s,
- SubCmd:%s
+ SubCmd:%s,
+ FinishCount:%d
'''\
%(
self.Cmd,
- self.SubCmd
+ self.SubCmd,
+ self.FinishCount
)
return DumpString
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 162ea87..3462eb5 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -29382,6 +29382,62 @@
#------------------------------------------------------
+# B0 07 今日协助活跃令信息 #tagMCTodayAssistMoneyInfo
+
+class tagMCTodayAssistMoneyInfo(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("TodayAssistMoney", c_ushort), #今日已获得活跃令,不含社交加成
+ ("SocialMoney", c_ushort), #社交额外加成
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xB0
+ self.SubCmd = 0x07
+ 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 = 0xB0
+ self.SubCmd = 0x07
+ self.TodayAssistMoney = 0
+ self.SocialMoney = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagMCTodayAssistMoneyInfo)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// B0 07 今日协助活跃令信息 //tagMCTodayAssistMoneyInfo:
+ Cmd:%s,
+ SubCmd:%s,
+ TodayAssistMoney:%d,
+ SocialMoney:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.TodayAssistMoney,
+ self.SocialMoney
+ )
+ return DumpString
+
+
+m_NAtagMCTodayAssistMoneyInfo=tagMCTodayAssistMoneyInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTodayAssistMoneyInfo.Cmd,m_NAtagMCTodayAssistMoneyInfo.SubCmd))] = m_NAtagMCTodayAssistMoneyInfo
+
+
+#------------------------------------------------------
# B1 02 玩家时装皮肤激活状态 #tagMCClothesCoatSkinState
class tagMCClothesCoatLVInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 749d299..c15c81a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3997,6 +3997,8 @@
#协助
Def_PDict_GetThanksGiftCount = "GetThanksGiftCount_%s" # 协助方今日接收该感谢礼盒次数,参数(礼盒物品ID)
+Def_PDict_TodayAssistMoney = "TodayAssistMoney" # 今日已获得协助货币奖励
+Def_PDict_TodayAssistMoneySocial = "TodayAssistMoneySocial" # 今日已获得协助货币 社交关系额外加成
#-------------------------------------------------------------------------------
#可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 2ae3d31..e2a4c82 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -14013,6 +14013,7 @@
_fields_ = [
("Cmd", c_ubyte),
("SubCmd", c_ubyte),
+ ("FinishCount", c_ubyte), #完成次数
]
def __init__(self):
@@ -14029,6 +14030,7 @@
def Clear(self):
self.Cmd = 0xB0
self.SubCmd = 0x28
+ self.FinishCount = 0
return
def GetLength(self):
@@ -14040,11 +14042,13 @@
def OutputString(self):
DumpString = '''// B0 28 活跃放置快速完成 //tagCMActivityPlaceQuickFinish:
Cmd:%s,
- SubCmd:%s
+ SubCmd:%s,
+ FinishCount:%d
'''\
%(
self.Cmd,
- self.SubCmd
+ self.SubCmd,
+ self.FinishCount
)
return DumpString
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 162ea87..3462eb5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -29382,6 +29382,62 @@
#------------------------------------------------------
+# B0 07 今日协助活跃令信息 #tagMCTodayAssistMoneyInfo
+
+class tagMCTodayAssistMoneyInfo(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("TodayAssistMoney", c_ushort), #今日已获得活跃令,不含社交加成
+ ("SocialMoney", c_ushort), #社交额外加成
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xB0
+ self.SubCmd = 0x07
+ 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 = 0xB0
+ self.SubCmd = 0x07
+ self.TodayAssistMoney = 0
+ self.SocialMoney = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagMCTodayAssistMoneyInfo)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// B0 07 今日协助活跃令信息 //tagMCTodayAssistMoneyInfo:
+ Cmd:%s,
+ SubCmd:%s,
+ TodayAssistMoney:%d,
+ SocialMoney:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.TodayAssistMoney,
+ self.SocialMoney
+ )
+ return DumpString
+
+
+m_NAtagMCTodayAssistMoneyInfo=tagMCTodayAssistMoneyInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTodayAssistMoneyInfo.Cmd,m_NAtagMCTodayAssistMoneyInfo.SubCmd))] = m_NAtagMCTodayAssistMoneyInfo
+
+
+#------------------------------------------------------
# B1 02 玩家时装皮肤激活状态 #tagMCClothesCoatSkinState
class tagMCClothesCoatLVInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
index ec0f2e2..37017c2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
@@ -742,7 +742,6 @@
self.__assistAwardItemID = liheItemID
fbType = GameWorld.GetMap().GetMapFBTypeByMapID(mapID)
- friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3)
GameWorld.DebugLog("执行协助奖励逻辑", self.npcID, self.lineID)
copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
for playerID, assistPlayerIDList in self.__noAssitPlayerIDDict.items():
@@ -764,16 +763,14 @@
GameWorld.DebugLog("协助方离线或不在本地图,不给活跃令奖励: assistPlayerID=%s" % assistPlayerID, self.npcID, self.lineID)
continue
isFriend = assistHurtPlayer.GetIsFriend()
- addAssistMoney = assistMoney
- if isFriend and friendAddAssistMoneyPer:
- addAssistMoney += int(assistMoney * friendAddAssistMoneyPer / 100.0)
+ assistMoneyType = ShareDefine.TYPE_Price_FamilyActivity
+ addAssistMoney = PlayerAssist.AddTodayAssistMoney(assistPlayer, assistMoneyType, assistMoney, isFriend)
GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s,assistMoney=%s,isFriend=%s,addAssistMoney=%s"
% (assistPlayerID, assistMoney, isFriend, addAssistMoney), self.npcID, self.lineID)
- PlayerControl.GiveMoney(assistPlayer, ShareDefine.TYPE_Price_FamilyActivity, addAssistMoney) # 给活跃令无视发布方是否在线
if fbType == IPY_GameWorld.fbtNull:
PlayerControl.NotifyCode(assistPlayer, "AssistSuccess")
else:
- overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({ShareDefine.TYPE_Price_FamilyActivity:addAssistMoney}),
+ overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({assistMoneyType:addAssistMoney}),
FBCommon.Over_itemInfo:[]}
FBCommon.NotifyFBOver(assistPlayer, mapID, PlayerControl.GetFBFuncLineID(assistPlayer), 1, overDict)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
index 2d39151..e24b989 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -673,28 +673,35 @@
#struct tagCMActivityPlaceQuickFinish
#{
# tagHead Head;
+# BYTE FinishCount; //完成次数
#};
def OnActivityPlaceQuickFinish(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
-
+ finishCount = clientData.FinishCount
remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
if not remainCount:
GameWorld.DebugLog("没有剩余活跃放置次数,无法快速完成!")
return
+ finishCount = min(finishCount, remainCount)
+ if not finishCount:
+ return
costItemID, costGoldParper = IpyGameDataPY.GetFuncEvalCfg("ActivityPlace", 5)
- costItemCount = 1 # 默认扣一个
- endCount = 1 # 只快速结算一次
+ costItemCount = finishCount # 每次扣一个
costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
lackCnt = costItemCount - bindCnt - unBindCnt
+ delItemCount = costItemCount
if lackCnt > 0:
- if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, costGoldParper, ChConfig.Def_Cost_ActivityPlace):
+ costGoldParperTotal = costGoldParper * lackCnt
+ if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, costGoldParperTotal, ChConfig.Def_Cost_ActivityPlace):
return
- else:
- ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, ChConfig.ItemDel_ActivityPlace)
+ delItemCount -= lackCnt
- __DoActivityPlaceRewardEnd(curPlayer, endCount)
+ if delItemCount > 0:
+ ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delItemCount, ChConfig.ItemDel_ActivityPlace)
+
+ __DoActivityPlaceRewardEnd(curPlayer, finishCount)
return
def ProcessActivityPlace(curPlayer):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py
index 169a3ae..e0d7c0b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py
@@ -19,6 +19,8 @@
import IpyGameDataPY
import PlayerControl
import NPCHurtManager
+import ChPyNetSendPack
+import NetPackCommon
import IPY_GameWorld
import ItemControler
import ItemCommon
@@ -32,6 +34,9 @@
ipyData = ipyDataMgr.GetAssistThanksGiftByIndex(index)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GetThanksGiftCount % ipyData.GetGiftID(), 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoney, 0)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoneySocial, 0)
+ Sync_TodayAssistMoneyInfo(curPlayer)
return
#// B0 10 请求协助Boss #tagCMRequestAssistBoss
@@ -185,4 +190,39 @@
return
+def AddTodayAssistMoney(curPlayer, moneyType, addMoney, isSocialEx):
+ ''' 增加今日协助货币奖励
+ @param moneyType: 货币类型
+ @param addMoney: 常规增加,有每日上限
+ @param isSocialEx: 是否社交加成,不计入常规上限
+ '''
+
+ todayAssistMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoney)
+ socialMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoneySocial)
+ todayAssistMoneyMax = IpyGameDataPY.GetFuncCfg("AssistAward", 4)
+ if todayAssistMoney >= todayAssistMoneyMax:
+ return 0
+
+ addValue = min(addMoney, todayAssistMoneyMax - todayAssistMoney)
+ socialEx = 0
+ if isSocialEx:
+ friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3)
+ socialEx = int(addValue * friendAddAssistMoneyPer / 100.0)
+
+ realAdd = addValue + socialEx
+ PlayerControl.GiveMoney(curPlayer, moneyType, realAdd)
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoney, todayAssistMoney + addValue)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayAssistMoneySocial, socialMoney + socialEx)
+
+ Sync_TodayAssistMoneyInfo(curPlayer)
+ return realAdd
+
+def Sync_TodayAssistMoneyInfo(curPlayer):
+ ## 通知今日已获得协助货币信息
+ infoPack = ChPyNetSendPack.tagMCTodayAssistMoneyInfo()
+ infoPack.TodayAssistMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoney)
+ infoPack.SocialMoney = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayAssistMoneySocial)
+ NetPackCommon.SendFakePack(curPlayer, infoPack)
+ return
--
Gitblit v1.8.0