| | |
| | | import PyGameData
|
| | | import GameFuncComm
|
| | |
|
| | |
|
| | | #关联类型
|
| | | (
|
| | | RelatedType_1, # 1关联日常活动表
|
| | | RelatedType_2, # 2关联副本总表
|
| | | ) = range(1, 3)
|
| | |
|
| | |
|
| | |
|
| | | def OnWeek(curPlayer, onWeekType):
|
| | |
| | | # 重置类型不同的不处理
|
| | | 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):
|
| | | ##发送每日活动邮件
|
| | |
| | | GameWorld.DebugLog(' 重新计算活跃奖励阶段 curStage=%s,realmLV=%s'%(curStage, realmLV))
|
| | | return
|
| | |
|
| | |
|
| | | ## OnLogin
|
| | | # @param curPlayer 玩家实例
|
| | | # @return
|
| | |
| | | # @return
|
| | | def __GetPDictValue(curPlayer, key, defaultValue=0):
|
| | | return curPlayer.NomalDictGetProperty(key, defaultValue)
|
| | |
|
| | |
|
| | | ## 设置活跃度玩家数据库字典信息值
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ## 摸NPC获得活跃度
|
| | | # @param atkObj
|
| | | # @param curNPC
|
| | |
| | | # AddActivityFinishCnt(atkObj, ShareDefine.ActivityNum_KillBoss)
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | | ## 增加完成活跃度次数
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | % (activityNum, addPbCnt, addValue, multiple, addExtraPoint, curExtraPoint), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | |
|
| | | def __GetActionAddPer(curPlayer):
|
| | | multiple, extraPointLimit = 1, 0 #倍数、额外可获得修行点上限
|
| | | actRealmPointInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_RealmPoint, {})# 多倍修行点活动
|
| | |
| | | if curPlayer.GetLV() < actRealmPointIpyData.GetLVLimit():
|
| | | return multiple, extraPointLimit
|
| | | return actRealmPointIpyData.GetMultiple(), actRealmPointIpyData.GetPointLimit()
|
| | |
|
| | |
|
| | | ## 同步活跃度信息
|
| | | # @param curPlayer
|
| | |
| | | sendPack.ExtraPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_ExtraRealmPoint)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
|
| | |
|
| | | ## 领取活跃度奖励
|
| | |
| | | GameWorld.DebugLog("领取活跃度奖励OK!awardStage=%s, index=%s,needActivity=%s,totalActivity=%s,awardRecord=%s"
|
| | | % (awardStage, awardIndex, needActivity, totalActivity, updAwardRecord))
|
| | |
|
| | | |
| | | |
| | | return
|
| | |
|
| | |
|
| | | def GetRealmPointAward(curPlayer):
|
| | | #领取活跃修行点
|
| | |
| | | SyncDailyActivityInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def GetActivityNum(relatedType, relatedID):
|
| | | ## 获取日常任务ID(活跃ID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('DailyQuest', {"RelatedID":relatedID,"RelatedType":relatedType}, False, False)
|
| | |
| | | return ipyData.GetID()
|
| | |
|
| | | #########################################日常活动###########################################
|
| | |
|
| | |
|
| | | def AddDailyActionFinishCnt(curPlayer, dailyID, addCnt=1):
|
| | | ##增加日常活动完成次数
|
| | |
| | | if dayTimesLimit:
|
| | | 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))
|
| | |
| | | AddActivityFinishCnt(curPlayer, activityNum, updTimes, addCnt)
|
| | | return True
|
| | |
|
| | |
|
| | | def GetDailyActionFinishCnt(curPlayer, dailyID):
|
| | | key = ChConfig.Def_PDict_DailyActionDayTimes%dailyID
|
| | | curDayTimes = __GetPDictValue(curPlayer, key)
|
| | |
| | | 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()
|
| | | if ipyData.GetDailyID() == ShareDefine.DailyActionID_TowerSD:
|
| | | 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
|
| | |
| | | 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)
|
| | |
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | |
|
| | | ##################################副本类增加活跃##########################################
|
| | | ## 参加副本获得活跃度
|
| | | # @param curPlayer 玩家实例
|