From 1ff3e77b9f3398c3c0c057091b17a11d3040228a Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期二, 19 二月 2019 16:05:21 +0800 Subject: [PATCH] 6253 【主干】【1.6】守卫人皇添加怪物波数日志输出 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py | 472 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 402 insertions(+), 70 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..34dcade 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 @@ -25,11 +25,21 @@ import IpyGameDataPY import PyGameData import ChConfig -import NPCCommon +import PlayerActivity import ItemCommon +import ItemControler import EventReport +import EventShell +import ChPyNetSendPack +import NetPackCommon +import PlayerSuccess +import PlayerWeekParty +import PlayerActLogin +import BuffSkill import random +import datetime +import time import math #---副本配置对应key值--- @@ -38,7 +48,8 @@ Def_FightTime, # 进行时间(秒) Def_PickTime, # 拾取时间(秒)(包含退出时间) Def_LeaveTime, # 退出时间(秒) -) = range(4) +Def_StarTime, #星级时间 +) = range(5) #---副本分线配置索引信息--- @@ -61,12 +72,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 +85,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 +98,44 @@ ## 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, lineList) + SyncIceLoddInfo(curPlayer) + return + +def __RandomLine(curPlayer, oldlineList): + # 随机今日玩法 + maxCnt, randomCnt = IpyGameDataPY.GetFuncEvalCfg('IceLodeCfg', 2) + lineList = range(maxCnt) + newlineList = list(set(lineList) - set(oldlineList)) + if len(newlineList) < randomCnt: + random.shuffle(oldlineList) + newlineList += oldlineList[:randomCnt-len(newlineList)] + else: + random.shuffle(newlineList) + newlineList = newlineList[:randomCnt] + #random.shuffle(lineList) + for lineID in lineList: + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_IceLoadLineID, lineID, 1 if lineID in newlineList else 0) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeDayLV, curPlayer.GetLV()) + GameWorld.DebugLog(' 随机冰晶矿脉今日玩法 oldlineList=%s, newlineList =%s'%(oldlineList, newlineList), curPlayer.GetID()) + return ## 是否能够通过活动查询进入 # @param curPlayer 玩家实例 @@ -98,6 +144,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 @@ -126,10 +176,12 @@ # @param tick # @return None def DoEnterFB(curPlayer, tick): + PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default * 2) 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 +192,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 +222,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 +231,7 @@ # @param tick 时间戳 # @return 无意义 def DoExitFB(curPlayer, tick): - + PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default) return ##玩家主动离开副本. @@ -172,10 +239,18 @@ # @param tick 时间戳 # @return 返回值无意义 def DoPlayerLeaveFB(curPlayer, tick): + PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default) return +##玩家切换地图 +def DoPlayerChangeMapLogic(curPlayer): + tick = GameWorld.GetGameWorld().GetTick() + for buffID in IpyGameDataPY.GetFuncEvalCfg('IceLodeSpecial', 2): + BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick) + return def OnPickUpItem(curPlayer, curItem, tick): + return mapItemType = curItem.GetType() if mapItemType == ChConfig.Def_ItemType_Money: return @@ -209,10 +284,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 +306,7 @@ # 副本进行中 elif fbStep == FB_Step_Fighting: __DoLogic_FB_Fighting(tick) + __UpdIceLoadFBStar(tick) # 副本拾取中 elif fbStep == FB_Step_PickItem: __DoLogic_FB_PickItem(tick) @@ -240,26 +316,73 @@ 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 += totalMaxCnt NPCCustomRefresh.ProcessAllNPCRefresh(tick) # 立即出发一次标识点刷新 - + gameFB.SetGameFBDict(FBPlayerDict_RemainNPCCnt, npcCnt) + GameWorld.DebugLog('设置开始刷怪 remainNPCCnt=%s'%npcCnt) # 副本开始 FBCommon.SetFBStep(FB_Step_Fighting, tick) FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, stepTimeCfg[Def_FightTime] * 1000) @@ -346,37 +469,67 @@ return False return True +def __OnKillNPC(curNPC, tick): + gameFB = GameWorld.GetGameFB() + npcid = curNPC.GetNPCID() + npcCfg = GetIceLodeNPCCfg() + isfbnpc = False + for npcInfo in npcCfg: + if npcid == npcInfo[DL_NPCID]: + isfbnpc = True + break + if not isfbnpc: + return + + remainNPCCnt = max(0, gameFB.GetGameFBDictByKey(FBPlayerDict_RemainNPCCnt) - 1) + gameFB.SetGameFBDict(FBPlayerDict_RemainNPCCnt, remainNPCCnt) + GameWorld.DebugLog('__OnKillNPC remainNPCCnt=%s'%remainNPCCnt) + if remainNPCCnt <=0 or npcid in IpyGameDataPY.GetFuncEvalCfg('IceLodeSpecial'): + __DoIceLodeOver(True) + return + +def DoFB_NPCDead(curNPC): + __OnKillNPC(curNPC, GameWorld.GetGameWorld().GetTick()) + return + +#def DoFB_Npc_KillNPC(attacker, curNPC, tick): +# GameWorld.Log('__OnKillNPC 1111111111') +# __OnKillNPC(attacker, curNPC, tick) +# return + ## 执行副本杀怪逻辑 # @param curPlayer 杀怪的人 # @param curNPC 被杀的怪 # @param tick 当前时间 # @return None -def DoFB_Player_KillNPC(curPlayer, curNPC, tick): - gameFB = GameWorld.GetGameFB() - npcid = curNPC.GetNPCID() - 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) +#def DoFB_Player_KillNPC(curPlayer, curNPC, tick): +# GameWorld.Log('__OnKillNPC 2222222222') +# __OnKillNPC(curPlayer, curNPC, tick) +# - 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) +# 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) + #DoFBHelp(curPlayer, tick) return ## 是否副本复活 @@ -401,35 +554,59 @@ 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]) + isInFBOnDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeIsInFBOnDay) + #更新星级 + 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 + if not lastStar and not isInFBOnDay: #每日活动 + PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_IceLode) + PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_IceLode, 1) + PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_IceLode, 1) + + 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, []) + overDict = {FBCommon.Over_isPass:int(isPass), FBCommon.Over_costTime:costTime} + if isPass: + itemList = FBCommon.GetFBLineReward(mapID, lineID) + # 给物品 + needSpace = len(itemList) + packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace) + if needSpace > packSpace: + PlayerControl.SendMailByKey('', [curPlayer.GetID()], itemList) + else: + for itemID, itemCount, isBind in itemList: + ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem]) + + jsonItemList = FBCommon.GetJsonItemList(itemList) + overDict[FBCommon.Over_itemInfo] = jsonItemList + EventShell.EventRespons_FBEvent(curPlayer, 'icelode') + PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_IceLode, 1) + # 通知结果 - __SendIceLodeOverInfo(curPlayer, {FBCommon.Over_isPass:int(isPass),FBCommon.Over_exp:totalExp, FBCommon.Over_costTime:costTime, FBCommon.Over_itemInfo:jsonItemList}) + __SendIceLodeOverInfo(curPlayer, overDict) # 进入离开阶段 FBCommon.SetFBStep(FB_Step_Over, tick) FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttLeaveMap, FBCommon.GetFBLineStepTime(mapID)[Def_LeaveTime] * 1000) # 清怪,关闭刷怪 - FBCommon.ClearFBNPC() - npcCfg = GetIceLodeNPCCfg() - for npcInfo in npcCfg: - NPCCustomRefresh.CloseNPCRefresh(npcInfo[Def_RefreshMark], tick) +# FBCommon.ClearFBNPC() +# npcCfg = GetIceLodeNPCCfg() +# for npcInfo in npcCfg: +# NPCCustomRefresh.CloseNPCRefresh(npcInfo[Def_RefreshMark], tick) return @@ -454,27 +631,182 @@ ## 可否扫荡 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 + if curPlayer.GetMapID() == ChConfig.Def_FBMapID_IceLode: + GameWorld.DebugLog('冰晶矿脉扫荡 副本里不能扫荡 ') + return + #战力判断 + 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) + + SyncIceLoddInfo(curPlayer) 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]) + #直接将5条线星级改为3星 + addCnt = 0 + starCnt, lineList = GetIceLodeAllStarCnt(curPlayer) + for lineid in lineList: + curStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineid, False, [mapID]) + if curStar == 0: + addCnt += 1 + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineid, 3, False, [mapID]) + PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_IceLode, addCnt) + PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_IceLode, addCnt) + PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_IceLode, addCnt) + PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_IceLode, len(lineList)) + FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID) # 同步信息 +# 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 lineList and 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) + maxCnt, randomCnt = IpyGameDataPY.GetFuncEvalCfg('IceLodeCfg', 2) + for i in xrange(maxCnt): + GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, i, 0, False, [ChConfig.Def_FBMapID_IceLode]) + FBCommon.Sync_FBPlayerFBInfoData(curPlayer, ChConfig.Def_FBMapID_IceLode) # 同步信息 + #重置领奖记录 + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeStarAwardRecord, 0) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeHasSweep, 0) + #随机今日玩法 + __RandomLine(curPlayer, lineList) + #通知 + 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