From 17c0a15c9b306ab2fb7576ca99adbdf8e4e8285e Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期一, 19 十一月 2018 16:37:51 +0800 Subject: [PATCH] 4715 【1.3】【后端】新的洗练副本-冰晶矿脉(新) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py | 375 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 315 insertions(+), 60 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py index 0e4e54f..e40c607 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py @@ -27,9 +27,14 @@ import ChConfig import NPCCommon import ItemCommon +import ItemControler import EventReport +import ChPyNetSendPack +import NetPackCommon import random +import datetime +import time import math #---副本配置对应key值--- @@ -38,7 +43,8 @@ Def_FightTime, # 进行时间(秒) Def_PickTime, # 拾取时间(秒)(包含退出时间) Def_LeaveTime, # 退出时间(秒) -) = range(4) +Def_StarTime, #星级时间 +) = range(5) #---副本分线配置索引信息--- @@ -61,12 +67,12 @@ ) = range(6) - +FBPlayerDict_RemainNPCCnt = 'FBPlayerDict_RemainNPCCnt' # 剩余怪数量 FBPlayerDict_TotalPoint = 'FBPlayerDict_TotalPoint' # 获得的总怒气值 FBPlayerDict_CostTime = 'FBPlayerDict_CostTime' #通关时间 FBPlayerDict_TotalExp = 'FBPlayerDict_TotalExp' # 获得的总经验 FBPlayerDict_TotalExpPoint = 'FBPlayerDict_TotalExpPoint' # 获得的总经验点 - +FBPlayerDict_FBStar = 'FBPlayerDict_FBStar' # 当前星级 @@ -74,7 +80,8 @@ # @param None # @return 配置信息 def GetIceLodeNPCCfg(): - return FBCommon.GetFBLineRefreshNPC(GameWorld.GetMap().GetMapID()) + lineID = FBCommon.GetFBPropertyMark() + return FBCommon.GetFBLineRefreshNPC(GameWorld.GetMap().GetMapID(), lineID) def GetPointByNPCID(npcid): '''通过NPCID获取对应的积分''' @@ -86,10 +93,37 @@ ## OnDay处理 # @param curPlayer # @return None -def IceLodeOnDay(curPlayer): - +def OnFBPlayerOnDay(curPlayer): + if curPlayer.GetMapID() == ChConfig.Def_FBMapID_IceLode: + #玩家还在副本中,等这次副本结束,以最新的总星级给发奖励 + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeIsInFBOnDay, 1) + return + + #补发奖励 + CheckIceLodeStarAwardMail(curPlayer) return +def OnFBPlayerOnLogin(curPlayer): + isInFBOnDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeIsInFBOnDay) + if isInFBOnDay and curPlayer.GetMapID() != ChConfig.Def_FBMapID_IceLode: #在副本里过天,副本结束后再补发奖励 + if CheckIceLodeStarAwardMail(curPlayer): + return + starCnt, lineList = GetIceLodeAllStarCnt(curPlayer) + if not lineList: + __RandomLine(curPlayer) + SyncIceLoddInfo(curPlayer) + return + +def __RandomLine(curPlayer): + # 随机今日玩法 + maxCnt, randomCnt = IpyGameDataPY.GetFuncEvalCfg('IceLodeCfg', 2) + lineList = range(maxCnt) + random.shuffle(lineList) + for i, lineID in enumerate(lineList): + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_IceLoadLineID, lineID, 0 if i >= randomCnt else 1) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeDayLV, curPlayer.GetLV()) + GameWorld.DebugLog(' 随机冰晶矿脉今日玩法 lineList =%s'%(lineList[:randomCnt]), curPlayer.GetID()) + return ## 是否能够通过活动查询进入 # @param curPlayer 玩家实例 @@ -98,6 +132,10 @@ # @param tick 时间戳 # @return 布尔值 def OnEnterFBEvent(curPlayer, mapID, lineID, tick): + starCnt, lineList = GetIceLodeAllStarCnt(curPlayer) + if lineID not in lineList: + GameWorld.DebugLog('冰晶矿脉今日没有该线路 lineID=%s,lineList=%s'%(lineID, lineList)) + return False return True @@ -127,9 +165,10 @@ # @return None def DoEnterFB(curPlayer, tick): playerID = curPlayer.GetPlayerID() - GameWorld.DebugLog("DoEnterFB...", playerID) mapID = GameWorld.GetGameWorld().GetMapID() gameFB = GameWorld.GetGameFB() + lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine) + GameWorld.DebugLog("DoEnterFB...lineID=%s"%lineID, playerID) hadDelTicket = FBCommon.GetHadDelTicket(curPlayer) if not hadDelTicket: PyGameData.g_fbPickUpItemDict.pop(playerID, 0) @@ -140,6 +179,20 @@ if not isOK: PlayerControl.PlayerLeaveFB(curPlayer) return + #星级为0则免费,否则收钱 + curStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID]) + if curStar: + costGold = IpyGameDataPY.GetFuncCfg('IceLodeCfg') + if costGold: + costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costGold) + if not costMoneyList: + GameWorld.Log('钱不够 lineID=%s,costGold=%s'%(lineID, costGold)) + PlayerControl.PlayerLeaveFB(curPlayer) + return + for moneyType, moneyNum in costMoneyList: + PlayerControl.PayMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_Cost_BuyFBCnt, {"MapID":mapID, 'lineID':lineID}) + + FBCommon.SetFBPropertyMark(lineID) FBCommon.SetHadDelTicket(curPlayer) FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_IceLode) FBCommon.SetFBStep(FB_Step_Prepare, tick) @@ -156,6 +209,7 @@ mapID = GameWorld.GetMap().GetMapID() notify_tick = FBCommon.GetFBLineStepTime(mapID)[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick()) curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True) + __UpdIceLoadFBStar(tick, True, curPlayer) DoFBHelp(curPlayer, tick) return @@ -164,7 +218,6 @@ # @param tick 时间戳 # @return 无意义 def DoExitFB(curPlayer, tick): - return ##玩家主动离开副本. @@ -176,6 +229,7 @@ def OnPickUpItem(curPlayer, curItem, tick): + return mapItemType = curItem.GetType() if mapItemType == ChConfig.Def_ItemType_Money: return @@ -209,10 +263,10 @@ gameFB = GameWorld.GetGameFB() # 获得副本信息 - totalPoint = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalPoint) - + star = gameFB.GetGameFBDictByKey(FBPlayerDict_FBStar) + lineID = FBCommon.GetFBPropertyMark() #副本帮助 - helpDict = {FBCommon.Help_score:totalPoint} + helpDict = {FBCommon.Help_grade:star, FBCommon.Help_lineID:lineID} GameWorld.DebugLog("DoFBHelp %s" % str(helpDict)) FBCommon.Notify_FBHelp(curPlayer, helpDict) return @@ -231,6 +285,7 @@ # 副本进行中 elif fbStep == FB_Step_Fighting: __DoLogic_FB_Fighting(tick) + __UpdIceLoadFBStar(tick) # 副本拾取中 elif fbStep == FB_Step_PickItem: __DoLogic_FB_PickItem(tick) @@ -240,25 +295,72 @@ return + +## 更新当前副本星级 +def __UpdIceLoadFBStar(tick, isEnter=False, curPlayer=None): + gameFB = GameWorld.GetGameFB() + curStar = gameFB.GetGameFBDictByKey(FBPlayerDict_FBStar) + if curStar == 1: + return curStar + + mapID = GameWorld.GetMap().GetMapID() + useSecond = int(math.ceil((tick - gameFB.GetFBStepTick()) / 1000.0)) + icelodeTimeCfg = FBCommon.GetFBLineStepTime(mapID) + starTimeList = icelodeTimeCfg[Def_StarTime] + diffSecond = 0 + updStar = 1 # 默认至少1星 + for star, starTime in enumerate(starTimeList, 2): + if useSecond <= starTime: + updStar = star + diffSecond = starTime-useSecond + + if curStar == updStar and not isEnter: + return curStar + + gameFB.SetGameFBDict(FBPlayerDict_FBStar, updStar) + + GameWorld.DebugLog("__UpdFBStar useSecond=%s,curStar=%s,updStar=%s, diffSecond=%s" + % (useSecond, curStar, updStar, diffSecond)) + + if curPlayer: + DoFBHelp(curPlayer, tick) + if updStar != 1: + curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True) + else: + playerManager = GameWorld.GetMapCopyPlayerManager() + for index in xrange(playerManager.GetPlayerCount()): + curPlayer = playerManager.GetPlayerByIndex(index) + if not curPlayer: + continue + DoFBHelp(curPlayer, tick) + if updStar != 1: + curPlayer.Sync_TimeTick(IPY_GameWorld.tttFlagTake, 0, diffSecond * 1000, True) + + + return updStar + ## 副本准备逻辑 # @param tick:时间戳 # @return 无意义 def __DoLogic_FB_Prepare(tick): - #gameFB = GameWorld.GetGameFB() + gameFB = GameWorld.GetGameFB() mapID = GameWorld.GetMap().GetMapID() stepTimeCfg = FBCommon.GetFBLineStepTime(mapID) # 间隔未到 - if tick - GameWorld.GetGameFB().GetFBStepTick() < stepTimeCfg[Def_PrepareTime] * 1000: + if tick - gameFB.GetFBStepTick() < stepTimeCfg[Def_PrepareTime] * 1000: return # 设置开始刷怪 + npcCnt = 0 npcCfg = GetIceLodeNPCCfg() for npcInfo in npcCfg: npcid = npcInfo[DL_NPCID] maxCnt = npcInfo[DL_ScreenMaxNPC] totalMaxCnt = npcInfo[DL_TotalNPCCnt] NPCCustomRefresh.SetNPCRefresh(npcInfo[Def_RefreshMark], [npcid], maxCnt, totalMaxCnt) + npcCnt += maxCnt NPCCustomRefresh.ProcessAllNPCRefresh(tick) # 立即出发一次标识点刷新 + gameFB.SetGameFBDict(FBPlayerDict_RemainNPCCnt, npcCnt) # 副本开始 FBCommon.SetFBStep(FB_Step_Fighting, tick) @@ -354,29 +456,44 @@ def DoFB_Player_KillNPC(curPlayer, curNPC, tick): gameFB = GameWorld.GetGameFB() npcid = curNPC.GetNPCID() - addPoint = GetPointByNPCID(npcid) - if not addPoint: + npcCfg = GetIceLodeNPCCfg() + isfbnpc = False + for npcInfo in npcCfg: + if npcid == npcInfo[DL_NPCID]: + isfbnpc = True + break + if not isfbnpc: return - totalPoint = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalPoint) - maxPoint = IpyGameDataPY.GetFuncCfg('IceLodeNeedPoint') - updPoint = min(totalPoint + addPoint, maxPoint) - gameFB.SetGameFBDict(FBPlayerDict_TotalPoint, updPoint) - if updPoint >= maxPoint: - costTime = tick - GameWorld.GetGameFB().GetFBStepTick() - gameFB.SetGameFBDict(FBPlayerDict_CostTime, costTime) - FBCommon.SetFBStep(FB_Step_PickItem, tick) - mapID = GameWorld.GetMap().GetMapID() - curPlayer.Sync_TimeTick(ChConfig.tttPickupItem, 0, FBCommon.GetFBLineStepTime(mapID)[Def_PickTime] * 1000, True) - - FBCommon.ClearFBNPC() - npcCfg = GetIceLodeNPCCfg() - for npcInfo in npcCfg: - NPCCustomRefresh.CloseNPCRefresh(npcInfo[Def_RefreshMark], tick) - - #__DoIceLodeOver(True) + remainNPCCnt = max(0, gameFB.GetGameFBDictByKey(FBPlayerDict_RemainNPCCnt) - 1) + gameFB.SetGameFBDict(FBPlayerDict_RemainNPCCnt, remainNPCCnt) - DoFBHelp(curPlayer, tick) + if remainNPCCnt <=0: + __DoIceLodeOver(True) + +# addPoint = GetPointByNPCID(npcid) +# if not addPoint: +# return +# totalPoint = gameFB.GetGameFBDictByKey(FBPlayerDict_TotalPoint) +# maxPoint = IpyGameDataPY.GetFuncCfg('IceLodeNeedPoint') +# updPoint = min(totalPoint + addPoint, maxPoint) +# gameFB.SetGameFBDict(FBPlayerDict_TotalPoint, updPoint) +# +# if updPoint >= maxPoint: +# costTime = tick - GameWorld.GetGameFB().GetFBStepTick() +# gameFB.SetGameFBDict(FBPlayerDict_CostTime, costTime) +# FBCommon.SetFBStep(FB_Step_PickItem, tick) +# mapID = GameWorld.GetMap().GetMapID() +# curPlayer.Sync_TimeTick(ChConfig.tttPickupItem, 0, FBCommon.GetFBLineStepTime(mapID)[Def_PickTime] * 1000, True) +# +# FBCommon.ClearFBNPC() +# npcCfg = GetIceLodeNPCCfg() +# for npcInfo in npcCfg: +# NPCCustomRefresh.CloseNPCRefresh(npcInfo[Def_RefreshMark], tick) +# +# #__DoIceLodeOver(True) + + #DoFBHelp(curPlayer, tick) return ## 是否副本复活 @@ -401,25 +518,29 @@ return playerID = curPlayer.GetPlayerID() - + lineID = FBCommon.GetFBPropertyMark() + star = GameWorld.GetGameFB().GetGameFBDictByKey(FBPlayerDict_FBStar) mapID = ChConfig.Def_FBMapID_IceLode - hasPass = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, 0, False, [mapID]) - if isPass and not hasPass: - GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, 0, 1, False, [mapID]) + + #更新星级 + lastStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID]) + if isPass and star > lastStar: + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, star, False, [mapID]) FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID) # 同步信息 - - # 记录最后一次手打获得的总经验 - exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp) - expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint) - totalExp = expPoint * ChConfig.Def_PerPointValue + exp + isInFBOnDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeIsInFBOnDay) + if isInFBOnDay: #在副本里过天,副本结束后再补发奖励 + CheckIceLodeStarAwardMail(curPlayer) +# exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp) +# expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint) +# totalExp = expPoint * ChConfig.Def_PerPointValue + exp costTime = gameFB.GetGameFBDictByKey(FBPlayerDict_CostTime) if not costTime: costTime = tick - GameWorld.GetGameFB().GetFBStepTick() - jsonItemList = PyGameData.g_fbPickUpItemDict.get(playerID, []) - + #jsonItemList = PyGameData.g_fbPickUpItemDict.get(playerID, []) + jsonItemList = FBCommon.GetJsonItemList(FBCommon.GetFBLineReward(mapID, lineID)) # 通知结果 - __SendIceLodeOverInfo(curPlayer, {FBCommon.Over_isPass:int(isPass),FBCommon.Over_exp:totalExp, FBCommon.Over_costTime:costTime, FBCommon.Over_itemInfo:jsonItemList}) + __SendIceLodeOverInfo(curPlayer, {FBCommon.Over_isPass:int(isPass), FBCommon.Over_costTime:costTime, FBCommon.Over_itemInfo:jsonItemList}) # 进入离开阶段 FBCommon.SetFBStep(FB_Step_Over, tick) @@ -454,27 +575,161 @@ ## 可否扫荡 def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx): - playerID = curPlayer.GetPlayerID() - star = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, 0, False, [mapID]) - # 是否过关过, 扫荡星级限制暂时客户端限制,这里只判断是否过关 - if star <= 0: - GameWorld.DebugLog("IceLode 当前所属线路未过关过,不可扫荡!lineID=%s,star=%s" % (0, star), playerID) - return False + #战力判断 + LVIpyData = PlayerControl.GetPlayerLVIpyData(curPlayer.GetLV()) + reFightPower = 0 if not LVIpyData else LVIpyData.GetIceLodeFightPower() # 当前等级参考战力 + if curPlayer.GetFightPower() < reFightPower: + GameWorld.DebugLog('冰晶矿脉扫荡 战力不足 %s'%(reFightPower)) + return + #vip判断 + if curPlayer.GetVIPLv() < IpyGameDataPY.GetFuncCfg('IceLodeCfg', 5): + GameWorld.DebugLog('冰晶矿脉扫荡 vip不足 ') + return + + #钱 + if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeHasSweep): + costMoney = IpyGameDataPY.GetFuncCfg('IceLodeCfg', 3) + else: + costMoney = 0 + if costMoney: + costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costMoney) + if not costMoneyList: + return + for moneyType, moneyNum in costMoneyList: + if not PlayerControl.PayMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_Cost_FBSweep): + GameWorld.DebugLog("冰晶矿脉扫荡仙玉不足!costGold=%s" % (costMoney)) + return + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeHasSweep, 1) return True ## 扫荡结果 def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx): - npcCountDict = {} - iceLodeSweepDict = IpyGameDataPY.GetFuncEvalCfg('IceLodeSweep') - for npcID, count in iceLodeSweepDict.items(): - npcCountDict[npcID] = count * sweepCnt - - exp_rate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Sweep) - jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, exp_rate) - GameWorld.DebugLog("扫荡奖励: 次数=%s,totalExp=%s,totalMoney=%s,jsonItemList=%s" % (sweepCnt, totalExp, totalMoney, jsonItemList)) - overDict = {FBCommon.Over_isPass:1, FBCommon.Over_exp:totalExp, FBCommon.Over_isSweep:1, FBCommon.Over_itemInfo:jsonItemList} + itemList = IpyGameDataPY.GetFuncEvalCfg('IceLodeCfg', 4) + jsonItemList = FBCommon.GetJsonItemList(itemList) + needSpace = len(itemList) + if needSpace > ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace): + PlayerControl.SendMailByKey(0, [curPlayer.GetID()], itemList) + else: + for itemID, itemCnt, isBind in itemList: + ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem]) + + +# npcCountDict = {} +# iceLodeSweepDict = IpyGameDataPY.GetFuncEvalCfg('IceLodeSweep') +# for npcID, count in iceLodeSweepDict.items(): +# npcCountDict[npcID] = count * sweepCnt +# +# exp_rate = PlayerControl.GetLimitExpRate(curPlayer, ChConfig.ExpRateLimitType_Sweep) +# jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, exp_rate) + GameWorld.DebugLog("扫荡奖励: 次数=%s,jsonItemList=%s" % (sweepCnt, jsonItemList)) + overDict = {FBCommon.Over_isPass:1, FBCommon.Over_isSweep:1, FBCommon.Over_itemInfo:jsonItemList} __SendIceLodeOverInfo(curPlayer, overDict) for _ in xrange(sweepCnt): EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_IceLode, 0, ChConfig.CME_Log_Start) return True + +def GetIceLodeStarAward(curPlayer, starIndex): + ## 领取冰晶矿脉星级奖励 + ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('IceLodeStarAward', {'Index':starIndex}, True) + if not ipyDataList: + return + playerLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeDayLV) + #playerLV = curPlayer.GetLV() + awardList = [] + needStar = 0 + for ipyData in ipyDataList: + lvLimit = ipyData.GetLVLimit() + if lvLimit[0]<=playerLV <=lvLimit[1]: + awardList = ipyData.GetItemList() + needStar = ipyData.GetStar() + break + if not awardList: + GameWorld.Log(' 领取冰晶矿脉星级奖励,没找到奖励 starIndex=%s,playerLV=%s'%(starIndex,playerLV), curPlayer.GetID()) + return + awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeStarAwardRecord) + if awardRecord & pow(2, starIndex): + GameWorld.DebugLog('领取冰晶矿脉星级奖励, 奖励已领取 starIndex=%s'%starIndex) + return + + starCnt, lineList = GetIceLodeAllStarCnt(curPlayer) + if starCnt < needStar: + GameWorld.DebugLog('领取冰晶矿脉星级奖励, 总星数不足starIndex=%s starCnt=%s,needStar=%s'%(starIndex,starCnt,needStar)) + return + + # 检查背包 + needSpace = len(awardList) + packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace) + if needSpace > packSpace: + PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371") + return + + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeStarAwardRecord, awardRecord|pow(2, starIndex)) + + for itemID, itemCount, isBind in awardList: + ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem]) + #通知 + SyncIceLoddInfo(curPlayer) + return + +def GetIceLodeAllStarCnt(curPlayer): + ##获取当前总星数 + maxCnt, randomCnt = IpyGameDataPY.GetFuncEvalCfg('IceLodeCfg', 2) + starCnt = 0 + lineList = [] + for i in xrange(maxCnt): + if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_IceLoadLineID, i): + starCnt += GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, i, False, [ChConfig.Def_FBMapID_IceLode]) + lineList.append(i) + if len(lineList) != randomCnt: + GameWorld.ErrLog(' 冰晶矿脉获取当前总星数,当前线路数量异常!lineList=%s'%lineList) + return starCnt, lineList[:randomCnt] + +def CheckIceLodeStarAwardMail(curPlayer): + #邮件补发未领取星级奖励 + serverTime = GameWorld.GetCurrentTime() + curDateTimeStr = "%d-%d-%d 00:00:00" % (serverTime.year, serverTime.month, serverTime.day) + curDateTime = datetime.datetime.strptime(curDateTimeStr, ChConfig.TYPE_Time_Format) + curDateTime = int(time.mktime(curDateTime.timetuple())) + lastCheckTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeLastCheckTime) + if lastCheckTime and lastCheckTime == curDateTime: + return + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeLastCheckTime, curDateTime) + + itemList = [] + mailStarList = [] + awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeStarAwardRecord) + playerLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeDayLV) + starCnt, lineList = GetIceLodeAllStarCnt(curPlayer) + ipyMgr = IpyGameDataPY.IPY_Data() + newRecord = awardRecord + for i in xrange(ipyMgr.GetIceLodeStarAwardCount()): + ipyData = ipyMgr.GetIceLodeStarAwardByIndex(i) + starIndex = ipyData.GetIndex() + lvLimit = ipyData.GetLVLimit() + if lvLimit[0]<=playerLV <=lvLimit[1]: + if starCnt >= ipyData.GetStar() and not awardRecord & pow(2, starIndex): + itemList += ipyData.GetItemList() + newRecord |= pow(2, starIndex) + mailStarList.append(starIndex) + if itemList: + PlayerControl.SendMailByKey('IceLodeStarReward', [curPlayer.GetID()], itemList, detail=mailStarList) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeIsInFBOnDay, 0) + #重置领奖记录 + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeStarAwardRecord, 0) + #随机今日玩法 + __RandomLine(curPlayer) + #通知 + SyncIceLoddInfo(curPlayer) + return True + +def SyncIceLoddInfo(curPlayer): + starCnt, lineList = GetIceLodeAllStarCnt(curPlayer) + packdata = ChPyNetSendPack.tagMCIceLodeInfo() + packdata.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeStarAwardRecord) + packdata.DayLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeDayLV) + packdata.HasSweep = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeHasSweep) + packdata.LineList = lineList + packdata.Cnt = len(packdata.LineList) + NetPackCommon.SendFakePack(curPlayer, packdata) + return -- Gitblit v1.8.0