From c06d47322d2892a440dc11b94f06950da762e5bd Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期五, 21 六月 2019 19:41:43 +0800
Subject: [PATCH] 7413 宗门试炼评级通知
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py | 283 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 215 insertions(+), 68 deletions(-)
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 19da755..dbb2d4d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -28,14 +28,14 @@
import IpyGameDataPY
import PyGameData
import GameFuncComm
-
+import EventShell
+import PlayerPet
#关联类型
(
-RelatedType_1, # 1关联日常活动表
-RelatedType_2, # 2关联副本总表
+RelatedType_1, # 1关联日常活动表
+RelatedType_2, # 2关联副本总表
) = range(1, 3)
-
def OnWeek(curPlayer, onWeekType):
@@ -49,7 +49,7 @@
# 重置类型不同的不处理
if ipyData.GetWeekResetType() != onWeekType:
continue
- key = ChConfig.Def_PDict_DailyActionWeekTimes%ipyData.GetDailyID()
+ key = ChConfig.Def_PDict_DailyActionWeekTimes % ipyData.GetDailyID()
__SetPDictValue(curPlayer, key, 0)
actionIDInfo.append(ipyData.GetDailyID())
@@ -69,22 +69,26 @@
if onEventType == ShareDefine.Def_OnEventTypeEx:
# 重置完成次数
for i in xrange(ipyDataMgr.GetDailyQuestCount()):
- key = ChConfig.Def_PDict_Activity_FinishCnt % (i+1)
- curPBCnt = __GetPDictValue(curPlayer, key) #单次进度值
+ ipyData = ipyDataMgr.GetDailyQuestByIndex(i)
+
+ key = ChConfig.Def_PDict_Activity_FinishCnt % ipyData.GetID()
+ curPBCnt = __GetPDictValue(curPlayer, key) #单次进度值
if curPBCnt:
__SetPDictValue(curPlayer, key, 0)
#总活跃度重置
__SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, 0)
# 重置领奖记录
__SetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityAwardRecord, 0)
+ #重置额外获得修行点数
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint, 0)
#重新计算奖励阶段
__CalcAwardStage(curPlayer)
#重置可领取修行点,未领取的发邮件
- realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
- if realmPoint and GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official):
- if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_DailyQuest):
- PlayerControl.SendMailByKey('XXDForgetToPick', [curPlayer.GetID()], [(ChConfig.Def_ItemID_RealmPoint, realmPoint, 1)], [realmPoint])
- __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, 0)
+# realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
+# if realmPoint and GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Official):
+# if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_DailyQuest):
+# PlayerControl.SendMailByKey('XXDForgetToPick', [curPlayer.GetID()], [(ChConfig.Def_ItemID_RealmPoint, realmPoint, 1)], [realmPoint])
+# __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, 0)
SyncDailyActivityInfo(curPlayer)
else:
@@ -94,42 +98,47 @@
actionIDInfo = []
for i in xrange(ipyDataMgr.GetDailyActionCount()):
ipyData = ipyDataMgr.GetDailyActionByIndex(i)
- dayTimesLimit = GetMaxDayTimes(ipyData)#ipyData.GetDayTimes()
+ dayTimesLimit = GetMaxDayTimes(ipyData) #ipyData.GetDayTimes()
if not dayTimesLimit:
continue
# 重置类型不同的不处理
if ipyData.GetDayResetType() != onEventType:
continue
- key = ChConfig.Def_PDict_DailyActionDayTimes%ipyData.GetDailyID()
- __SetPDictValue(curPlayer, key, 0)
+ dailyID = ipyData.GetDailyID()
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % dailyID, 0)
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID, 0)
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID, 0)
+
actionIDInfo.append(ipyData.GetDailyID())
if actionIDInfo:
SyncDailyActionInfo(curPlayer, actionIDInfo)
return
+
def SendDayActionMail(curPlayer):
##发送每日活动邮件
- if curPlayer.GetLV()>= IpyGameDataPY.GetFuncCfg('DailyQuestMailLvLimit'):
+ if curPlayer.GetLV() >= IpyGameDataPY.GetFuncCfg('DailyQuestMailLvLimit'):
PlayerControl.SendMailByKey('TodayDailyTask', [curPlayer.GetID()], [])
return
#重新计算奖励阶段
def __CalcAwardStage(curPlayer):
- realmLV= curPlayer.GetOfficialRank()
+ realmLV = curPlayer.GetOfficialRank()
ipyData = IpyGameDataPY.IPY_Data().GetDailyLivenessRewardByIndex(0)
if not ipyData:
return
stageLVList = ipyData.GetStageLV()
curStage = 0
for i, lv in enumerate(stageLVList):
- if realmLV <lv:
+ if realmLV < lv:
break
if realmLV >= lv:
curStage = i
__SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_AwardStage, curStage)
- GameWorld.DebugLog(' 重新计算活跃奖励阶段 curStage=%s,realmLV=%s'%(curStage, realmLV))
+ GameWorld.DebugLog(' 重新计算活跃奖励阶段 curStage=%s,realmLV=%s' % (curStage, realmLV))
return
+
## OnLogin
# @param curPlayer 玩家实例
@@ -149,6 +158,7 @@
# @return
def __GetPDictValue(curPlayer, key, defaultValue=0):
return curPlayer.NomalDictGetProperty(key, defaultValue)
+
## 设置活跃度玩家数据库字典信息值
# @param curPlayer 玩家实例
@@ -176,7 +186,6 @@
return
-
## 摸NPC获得活跃度
# @param atkObj
# @param curNPC
@@ -197,6 +206,7 @@
return
+
## 增加完成活跃度次数
# @param curPlayer 玩家实例
# @param activityNum 活跃度编号
@@ -214,46 +224,107 @@
onceActivityTime = dailyQuestData.GetOnceActivityTime()
if not onceActivity:
return
- if maxActiveValue and finishCnt > maxActiveValue/onceActivity*onceActivityTime:
+ if maxActiveValue and finishCnt > maxActiveValue / onceActivity * onceActivityTime:
#GameWorld.DebugLog("活跃度可完成次数已达到上限,activityNum=%s" % (activityNum))
return
key = ChConfig.Def_PDict_Activity_FinishCnt % activityNum
- curPBCnt = __GetPDictValue(curPlayer, key) #单次进度值
+ curPBCnt = __GetPDictValue(curPlayer, key) #单次进度值
- addValue = (addCnt+curPBCnt)/onceActivityTime * onceActivity #增加的活跃度
- addPbCnt = (addCnt+curPBCnt) % onceActivityTime
+ addValue = (addCnt + curPBCnt) / onceActivityTime * onceActivity #增加的活跃度
+ addPbCnt = (addCnt + curPBCnt) % onceActivityTime
__SetPDictValue(curPlayer, key, addPbCnt)
- #curTotalPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint)
+ #
+ DoAddActivity(curPlayer, addValue, True)
+ return
+
+def DoAddActivityByLV(curPlayer, befLV, aftLV):
+ ##升级增加活跃点
+ perLVAddPoint = IpyGameDataPY.GetFuncCfg('ImmortalDomainActivePoint', 3)
+ skillTypeID, perAddLV, addPoint, maxPoint = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomainActivePoint', 4)
+ learnSkillList, passiveSkillList = PlayerPet.GetPetLearnSkill(curPlayer)
+ addValue = (aftLV-befLV)*perLVAddPoint
+ if skillTypeID in passiveSkillList:
+ for lv in xrange(befLV+1, aftLV+1):
+ addValue += min(((lv-1)/perAddLV+1) * addPoint, maxPoint)
+ DoAddActivity(curPlayer, addValue, False, True)
+ return
+
+def AddActivityByLVOnLearnSkill(curPlayer, skillID):
+ ## 获得技能时,处理增加升级获得活跃点效果
+ skillTypeID, perAddLV, addPoint, maxPoint = IpyGameDataPY.GetFuncEvalCfg('ImmortalDomainActivePoint', 4)
+ if skillID != skillTypeID:
+ return
+ curLV = curPlayer.GetLV()
+ addValue = 0
+ for lv in xrange(2, curLV+1):
+ addValue += min(((lv-1)/perAddLV+1) * addPoint, maxPoint)
+ DoAddActivity(curPlayer, addValue, False, True)
+ return
+
+def DoAddActivity(curPlayer, addValue, isMultiple=False, isLVUp=False):
+ if not addValue:
+ return
multiple = 1
- if addValue:
- #__SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, nuwTotalPoint)
- multiple = __GetActionAddPer(curPlayer)
- addValue *= multiple
-
- realmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
- __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint, realmPoint+addValue)
- SyncDailyActivityInfo(curPlayer)
-
- GameWorld.DebugLog("增加活跃度任务次数,activityNum=%s,addPbCnt=%s,addValue=%s, multiple=%s"
- % (activityNum, addPbCnt, addValue, multiple), curPlayer.GetPlayerID())
+ addExtraPoint = 0
+ if isMultiple:
+ multiple, extraPointLimit = __GetActionAddPer(curPlayer)
+ curExtraPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint)
+ addExtraPoint = max(0, min(addValue * (multiple - 1),
+ extraPointLimit - curExtraPoint)) if extraPointLimit else addValue * (multiple - 1)
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint, curExtraPoint + addExtraPoint)
+ addValue = addValue + addExtraPoint
+ curTotalPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint)
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, curTotalPoint + addValue)
+ AddCanCostActivityPoint(curPlayer, addValue, isLVUp)
+ historyPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityHistoryPoint)
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityHistoryPoint,
+ min(ChConfig.Def_UpperLimit_DWord, historyPoint + addValue))
+
+ SyncDailyActivityInfo(curPlayer)
+ EventShell.EventRespons_AddActivityValue(curPlayer)
+ GameWorld.DebugLog(
+ "增加活跃度,addValue=%s, multiple=%s, addExtraPoint=%s"
+ % (addValue, multiple, addExtraPoint), curPlayer.GetPlayerID())
+
return
def __GetActionAddPer(curPlayer):
- multiple = 1
- actRealmPointInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_RealmPoint, {})# 多倍修行点活动
+ multiple, extraPointLimit = 1, 0 #倍数、额外可获得修行点上限
+ actRealmPointInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_RealmPoint, {}) # 多倍修行点活动
if not actRealmPointInfo:
- return multiple
+ return multiple, extraPointLimit
if not actRealmPointInfo.get(ShareDefine.ActKey_State):
- return multiple
+ return multiple, extraPointLimit
actRealmPointIpyData = IpyGameDataPY.GetIpyGameData("ActRealmPoint", actRealmPointInfo.get(ShareDefine.ActKey_CfgID, 0))
if not actRealmPointIpyData:
- return multiple
+ return multiple, extraPointLimit
if curPlayer.GetLV() < actRealmPointIpyData.GetLVLimit():
- return multiple
- return actRealmPointIpyData.GetMultiple()
+ return multiple, extraPointLimit
+ return actRealmPointIpyData.GetMultiple(), actRealmPointIpyData.GetPointLimit()
+
+def AddCanCostActivityPoint(curPlayer, addValue, isLVUp):
+ # 增加可消耗的活跃点
+ curPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityCanCostTotalPoint)
+ if isLVUp:
+ updPoint = min(ChConfig.Def_UpperLimit_DWord, curPoint + addValue)
+ else:
+ updPoint = min(IpyGameDataPY.GetFuncCfg('ImmortalDomainActivePoint'), curPoint + addValue)
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityCanCostTotalPoint, updPoint)
+ return
+
+def CostActivityPoint(curPlayer, costPoint, isOnlyCheck=False):
+ # 消耗活跃点
+ curPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityCanCostTotalPoint)
+ if curPoint < costPoint:
+ return
+ if not isOnlyCheck:
+ __SetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityCanCostTotalPoint,
+ curPoint - costPoint)
+ SyncDailyActivityInfo(curPlayer)
+ return True
## 同步活跃度信息
# @param curPlayer
@@ -265,10 +336,10 @@
sendPack.CurValue = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint)
sendPack.StageIndex = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_AwardStage)
sendPack.AwardRecord = __GetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityAwardRecord)
- sendPack.RealmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_RealmPoint)
+ sendPack.RealmPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_ActivityCanCostTotalPoint)
+ sendPack.ExtraPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint)
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
-
## 领取活跃度奖励
@@ -304,7 +375,7 @@
itemIDList = ipyData.GetItemID()
itemCntList = ipyData.GetItemCount()
itemIsBindList = ipyData.GetItemBind()
- if awardStage >=len(itemIDList) or awardStage >= len(itemCntList) or awardStage >= len(itemIsBindList):
+ if awardStage >= len(itemIDList) or awardStage >= len(itemCntList) or awardStage >= len(itemIsBindList):
return
itemID = itemIDList[awardStage]
@@ -317,7 +388,7 @@
return
# 给物品
- ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem], True)
+ ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem])
# 更新已领取成功标记
updAwardRecord = getAwardRecord | (1 << awardIndex)
@@ -325,10 +396,9 @@
SyncDailyActivityInfo(curPlayer)
GameWorld.DebugLog("领取活跃度奖励OK!awardStage=%s, index=%s,needActivity=%s,totalActivity=%s,awardRecord=%s"
% (awardStage, awardIndex, needActivity, totalActivity, updAwardRecord))
-
-
-
+ EventShell.EventRespons_ActivityAward(curPlayer, awardIndex)
return
+
def GetRealmPointAward(curPlayer):
#领取活跃修行点
@@ -342,14 +412,16 @@
SyncDailyActivityInfo(curPlayer)
return
+
def GetActivityNum(relatedType, relatedID):
## 获取日常任务ID(活跃ID)
- ipyData = IpyGameDataPY.GetIpyGameDataByCondition('DailyQuest', {"RelatedID":relatedID,"RelatedType":relatedType}, False, False)
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition('DailyQuest', {"RelatedID":relatedID, "RelatedType":relatedType}, False, False)
if not ipyData:
return 0
return ipyData.GetID()
#########################################日常活动###########################################
+
def AddDailyActionFinishCnt(curPlayer, dailyID, addCnt=1):
##增加日常活动完成次数
@@ -361,11 +433,13 @@
# return
# 由GameServer决定
- if not GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID):
- GameWorld.DebugLog("日常活动未开启!dailyID=%s" % dailyID)
- return
+ # 目前跨服PK暂不需要判断,因为跨服PK次数结算在本服,玩家可能上次未结算离线,等非匹配期间上线,也需要加上,所以暂不判断
+ if dailyID not in [ShareDefine.DailyActionID_CrossReamPK]:
+ if not GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % dailyID):
+ GameWorld.DebugLog("日常活动未开启!dailyID=%s" % dailyID)
+ return
- dayTimesLimit = GetMaxDayTimes(ipyData)#ipyData.GetDayTimes()
+ dayTimesLimit = GetMaxDayTimes(ipyData) #ipyData.GetDayTimes()
weekTimesLimit = ipyData.GetWeekTimes()
if not dayTimesLimit and not weekTimesLimit:
return
@@ -379,39 +453,53 @@
updDayTimes = 0
if dayTimesLimit:
- key = ChConfig.Def_PDict_DailyActionDayTimes%dailyID
+ key = ChConfig.Def_PDict_DailyActionDayTimes % dailyID
curDayTimes = curPlayer.NomalDictGetProperty(key)
- if not unLimitCnt and curDayTimes >= dayTimesLimit:
+ curDayBuyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID)
+ curDayItemTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID)
+ if not unLimitCnt and curDayTimes >= dayTimesLimit + curDayBuyTimes + curDayItemTimes:
return
- updDayTimes = curDayTimes+addCnt if unLimitCnt else min(dayTimesLimit, curDayTimes+addCnt)
+ updDayTimes = curDayTimes + addCnt if unLimitCnt else min(dayTimesLimit + curDayBuyTimes + curDayItemTimes, curDayTimes + addCnt)
+ addCnt = updDayTimes - curDayTimes
PlayerControl.NomalDictSetProperty(curPlayer, key, updDayTimes)
- GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curDayTimes=%s, updDayTimes=%s'%(dailyID, curDayTimes, updDayTimes))
-
+ GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curDayTimes=%s, updDayTimes=%s' % (dailyID, curDayTimes, updDayTimes))
+ updWeekTimes = 0
if weekTimesLimit:
- key = ChConfig.Def_PDict_DailyActionWeekTimes%dailyID
+ key = ChConfig.Def_PDict_DailyActionWeekTimes % dailyID
curWeekTimes = curPlayer.NomalDictGetProperty(key)
if not unLimitCnt and curWeekTimes >= weekTimesLimit:
return
- updWeekTimes = curWeekTimes+addCnt if unLimitCnt else min(weekTimesLimit, curWeekTimes+addCnt)
+ updWeekTimes = curWeekTimes + addCnt if unLimitCnt else min(weekTimesLimit, curWeekTimes + addCnt)
+ addCnt = updWeekTimes - curWeekTimes
PlayerControl.NomalDictSetProperty(curPlayer, key, updWeekTimes)
- GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curWeekTimes=%s, updWeekTimes=%s'%(dailyID, curWeekTimes, updWeekTimes))
+ GameWorld.DebugLog('增加日常活动完成次数 dailyID=%s, curWeekTimes=%s, updWeekTimes=%s' % (dailyID, curWeekTimes, updWeekTimes))
SyncDailyActionInfo(curPlayer, [dailyID])
#对应的日常任务表ID
updTimes = updDayTimes or updWeekTimes
- if updTimes and dailyQuestData:
+ if addCnt and updTimes and dailyQuestData:
AddActivityFinishCnt(curPlayer, activityNum, updTimes, addCnt)
return True
+
def GetDailyActionFinishCnt(curPlayer, dailyID):
- key = ChConfig.Def_PDict_DailyActionDayTimes%dailyID
+ key = ChConfig.Def_PDict_DailyActionDayTimes % dailyID
curDayTimes = __GetPDictValue(curPlayer, key)
ipyData = IpyGameDataPY.GetIpyGameData('DailyAction', dailyID)
if not ipyData:
return 0, 0
- dayTimesLimit = GetMaxDayTimes(ipyData)#ipyData.GetDayTimes()
+ dayTimesLimit = GetMaxDayTimes(ipyData) #ipyData.GetDayTimes()
return curDayTimes, dayTimesLimit
+
+def GetDailyActionrRemainCnt(curPlayer, dailyID):
+ ##获取活动剩余次数
+ curDayTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % dailyID)
+ curDayBuyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID)
+ curDayItemTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID)
+ ipyData = IpyGameDataPY.GetIpyGameData('DailyAction', dailyID)
+ dayTimesLimit = GetMaxDayTimes(ipyData)
+ return max(0, dayTimesLimit+curDayBuyTimes+curDayItemTimes-curDayTimes)
def GetMaxDayTimes(ipyData):
dayTimesLimit = ipyData.GetDayTimes()
@@ -419,11 +507,67 @@
dayTimesLimit += IpyGameDataPY.GetFuncCfg('RuneTowerSweepBuy')
return dayTimesLimit
+
+#// A5 25 购买日常活动次数 #tagCMBuyDailyActionCnt
+#
+#struct tagCMBuyDailyActionCnt
+#{
+# tagHead Head;
+# DWORD ActionID; // ID
+# BYTE AddType; // 0-花仙玉 1-用物品
+#};
+def OnDailyActionBuyCnt(index, clientData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ dailyID = clientData.ActionID
+ addType = clientData.AddType #0花仙玉 1使用物品
+ ipyData = IpyGameDataPY.GetIpyGameData('DailyAction', dailyID)
+ if not ipyData:
+ return
+ curDayTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % dailyID)
+ curDayBuyTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID)
+ curDayItemTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID)
+ if curDayBuyTimes + curDayItemTimes - curDayTimes >= 0:
+ GameWorld.DebugLog('剩余次数已达上限,不可增加!')
+ return
+
+ if addType == 0:
+ dayBuyTimesLimit = ipyData.GetDayBuyTimes()
+ buyNeedMoney = ipyData.GetBuyNeedMoney()
+ if not dayBuyTimesLimit or not buyNeedMoney:
+ return
+ if curDayBuyTimes >= dayBuyTimesLimit:
+ GameWorld.DebugLog('今日购买次数已达上限,不可增加!')
+ return
+ if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, buyNeedMoney, ChConfig.Def_Cost_BuyDailyActionCnt, {'dailyID':dailyID, 'curDayBuyTimes':curDayBuyTimes}):
+ return
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % dailyID, curDayBuyTimes + 1)
+
+ elif addType == 1:
+ dayItemAddTimesLimit = ipyData.GetDayItemAddTimes()
+ dayItemID = ipyData.GetDayItemID()
+ if not dayItemAddTimesLimit or not dayItemID:
+ return
+ if curDayItemTimes >= dayItemAddTimesLimit:
+ GameWorld.DebugLog('今日使用物品增加次数已达上限,不可增加!')
+ return
+ itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
+ enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(dayItemID, itemPack, 1)
+ if not enough:
+ return
+ ItemCommon.ReduceItem(curPlayer, itemPack, indexList, 1, False, "DailyActionCnt")
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyActionDayItemTimes % dailyID, curDayItemTimes + 1)
+
+ else:
+ return
+ SyncDailyActionInfo(curPlayer, [dailyID])
+ return
+
+
## 同步活跃度信息
# @param curPlayer
# @param syncNum 默认-1时全部同步
# @return None
-def SyncDailyActionInfo(curPlayer, syncNumList= []):
+def SyncDailyActionInfo(curPlayer, syncNumList=[]):
sendPack = ChPyNetSendPack.tagMCDailyActionCnt()
sendPack.Clear()
sendPack.ActionInfo = []
@@ -434,12 +578,15 @@
activityInfo.Clear()
activityInfo.ActionID = activityNum
activityInfo.DayFinishCnt = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayTimes % activityNum)
+ activityInfo.DayBuyTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayBuyTimes % activityNum)
+ activityInfo.DayItemTimes = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionDayItemTimes % activityNum)
activityInfo.WeekFinishCnt = __GetPDictValue(curPlayer, ChConfig.Def_PDict_DailyActionWeekTimes % activityNum)
sendPack.ActionInfo.append(activityInfo)
sendPack.Count = len(sendPack.ActionInfo)
NetPackCommon.SendFakePack(curPlayer, sendPack)
return
+
##################################副本类增加活跃##########################################
## 参加副本获得活跃度
@@ -450,4 +597,4 @@
activityNum = GetActivityNum(RelatedType_2, mapID)
if activityNum:
AddActivityFinishCnt(curPlayer, activityNum, curDayTimes, addCount)
- return
\ No newline at end of file
+ return
--
Gitblit v1.8.0