|  |  |  | 
|---|
|  |  |  | dayIndex = actWeekPartyInfo.get(ShareDefine.ActKey_DayIndex, 0) | 
|---|
|  |  |  | if dayIndex >= len(templateIDList): | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dayTidList = templateIDList[dayIndex] | 
|---|
|  |  |  | findTidList = [] | 
|---|
|  |  |  | for tid in dayTidList: | 
|---|
|  |  |  | if tid / 100 == actionID: | 
|---|
|  |  |  | findTidList.append(tid) | 
|---|
|  |  |  | if not findTidList: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | for findTid in findTidList: | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', findTid) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | if actionID in [ChConfig.Def_WPAct_Login]: | 
|---|
|  |  |  | addDayIndexList = [dayIndex] | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | addDayIndexList = range(dayIndex + 1) | 
|---|
|  |  |  | for dayIndex in addDayIndexList: | 
|---|
|  |  |  | dayTidList = templateIDList[dayIndex] | 
|---|
|  |  |  | findTidList = [] | 
|---|
|  |  |  | for tid in dayTidList: | 
|---|
|  |  |  | if tid / 100 == actionID: | 
|---|
|  |  |  | findTidList.append(tid) | 
|---|
|  |  |  | if not findTidList: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | totalTimes = ipyData.GetTotalTimes() | 
|---|
|  |  |  | curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyCurTimes % (dayIndex, findTid), 0, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | if isAdd: | 
|---|
|  |  |  | curAddCnt = addCnt if totalTimes == 0 else min(totalTimes - curTimes, addCnt) | 
|---|
|  |  |  | if curAddCnt <= 0: | 
|---|
|  |  |  | for findTid in findTidList: | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', findTid) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | updTimes = curTimes + curAddCnt | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | if not isCompatible and addCnt != totalTimes: | 
|---|
|  |  |  | totalTimes = ipyData.GetTotalTimes() | 
|---|
|  |  |  | curTimes = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyCurTimes % (dayIndex, findTid), 0, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | if isAdd: | 
|---|
|  |  |  | curAddCnt = addCnt if totalTimes == 0 else min(totalTimes - curTimes, addCnt) | 
|---|
|  |  |  | if curAddCnt <= 0: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | updTimes = curTimes + curAddCnt | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | if not isCompatible and addCnt != totalTimes: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | updTimes = min(addCnt, totalTimes) | 
|---|
|  |  |  | realAddCnt = updTimes - curTimes | 
|---|
|  |  |  | if realAddCnt <= 0: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | updTimes = min(addCnt, totalTimes) | 
|---|
|  |  |  | realAddCnt = updTimes - curTimes | 
|---|
|  |  |  | if realAddCnt <= 0: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyCurTimes % (dayIndex, findTid), updTimes, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | #加积分 | 
|---|
|  |  |  | singleTimes = ipyData.GetSingleTimes() | 
|---|
|  |  |  | addPoint = (curTimes % singleTimes + realAddCnt) / singleTimes * ipyData.GetPoint() | 
|---|
|  |  |  | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyPoint % dayIndex, 0, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | updPoint = curPoint + addPoint | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyPoint % dayIndex, updPoint, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | GameWorld.DebugLog('   增加周狂欢相关活动完成次数 dayIndex=%s, findTid=%s, realAddCnt=%s,addPoint=%s' % (dayIndex, findTid, realAddCnt, addPoint)) | 
|---|
|  |  |  | if isSync: | 
|---|
|  |  |  | SyncWeekPartyPlayerInfo(curPlayer, dayIndex, findTid) | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyCurTimes % (dayIndex, findTid), updTimes, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | #加积分 | 
|---|
|  |  |  | singleTimes = ipyData.GetSingleTimes() | 
|---|
|  |  |  | addPoint = (curTimes % singleTimes + realAddCnt) / singleTimes * ipyData.GetPoint() | 
|---|
|  |  |  | curPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyPoint % dayIndex, 0, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | updPoint = curPoint + addPoint | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyPoint % dayIndex, updPoint, ChConfig.Def_PDictType_WeekParty) | 
|---|
|  |  |  | GameWorld.DebugLog('   增加周狂欢相关活动完成次数 dayIndex=%s, findTid=%s, curTimes=%s, updTimes=%s, realAddCnt=%s,addPoint=%s' % (dayIndex, findTid, curTimes, updTimes, realAddCnt, addPoint)) | 
|---|
|  |  |  | if isSync: | 
|---|
|  |  |  | SyncWeekPartyPlayerInfo(curPlayer, dayIndex, findTid) | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CheckWeekPartyActionCnt(curPlayer, isSync): | 
|---|