| | |
| | | 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 BuffSkill
|
| | |
|
| | | import random
|
| | | import datetime
|
| | |
| | | return
|
| | | starCnt, lineList = GetIceLodeAllStarCnt(curPlayer)
|
| | | if not lineList:
|
| | | __RandomLine(curPlayer)
|
| | | __RandomLine(curPlayer, lineList)
|
| | | SyncIceLoddInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def __RandomLine(curPlayer):
|
| | | def __RandomLine(curPlayer, oldlineList):
|
| | | # 随机今日玩法
|
| | | 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)
|
| | | 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(' 随机冰晶矿脉今日玩法 lineList =%s'%(lineList[:randomCnt]), curPlayer.GetID())
|
| | | GameWorld.DebugLog(' 随机冰晶矿脉今日玩法 oldlineList=%s, newlineList =%s'%(oldlineList, newlineList), curPlayer.GetID())
|
| | | return
|
| | |
|
| | | ## 是否能够通过活动查询进入
|
| | |
| | | # @param tick
|
| | | # @return None
|
| | | def DoEnterFB(curPlayer, tick):
|
| | | PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default * 2)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | mapID = GameWorld.GetGameWorld().GetMapID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | |
| | | # @param tick 时间戳
|
| | | # @return 无意义
|
| | | def DoExitFB(curPlayer, tick):
|
| | | PlayerControl.SetSight(curPlayer, ChConfig.Def_PlayerSight_Default)
|
| | | return
|
| | |
|
| | | ##玩家主动离开副本.
|
| | |
| | | # @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
|
| | |
| | | maxCnt = npcInfo[DL_ScreenMaxNPC]
|
| | | totalMaxCnt = npcInfo[DL_TotalNPCCnt]
|
| | | NPCCustomRefresh.SetNPCRefresh(npcInfo[Def_RefreshMark], [npcid], maxCnt, totalMaxCnt)
|
| | | npcCnt += maxCnt
|
| | | 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)
|
| | |
| | | return False
|
| | | return True
|
| | |
|
| | | ## 执行副本杀怪逻辑
|
| | | # @param curPlayer 杀怪的人
|
| | | # @param curNPC 被杀的怪
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
|
| | | def __OnKillNPC(curNPC, tick):
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | npcid = curNPC.GetNPCID()
|
| | | npcCfg = GetIceLodeNPCCfg()
|
| | |
| | |
|
| | | remainNPCCnt = max(0, gameFB.GetGameFBDictByKey(FBPlayerDict_RemainNPCCnt) - 1)
|
| | | gameFB.SetGameFBDict(FBPlayerDict_RemainNPCCnt, remainNPCCnt)
|
| | | |
| | | if remainNPCCnt <=0:
|
| | | 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):
|
| | | # GameWorld.Log('__OnKillNPC 2222222222')
|
| | | # __OnKillNPC(curPlayer, curNPC, tick)
|
| | | # |
| | |
|
| | | # addPoint = GetPointByNPCID(npcid)
|
| | | # if not addPoint:
|
| | |
| | | lineID = FBCommon.GetFBPropertyMark()
|
| | | star = GameWorld.GetGameFB().GetGameFBDictByKey(FBPlayerDict_FBStar)
|
| | | mapID = ChConfig.Def_FBMapID_IceLode
|
| | | |
| | | 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) # 同步信息
|
| | | isInFBOnDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_IceLodeIsInFBOnDay)
|
| | | if isInFBOnDay: #在副本里过天,副本结束后再补发奖励
|
| | | if not lastStar and not isInFBOnDay: #每日活动
|
| | | PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_IceLode)
|
| | | |
| | | if isInFBOnDay: #在副本里过天,副本结束后再补发星级奖励
|
| | | CheckIceLodeStarAwardMail(curPlayer)
|
| | | # exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp)
|
| | | # expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint)
|
| | |
| | | if not costTime:
|
| | | costTime = tick - GameWorld.GetGameFB().GetFBStepTick()
|
| | | #jsonItemList = PyGameData.g_fbPickUpItemDict.get(playerID, [])
|
| | | jsonItemList = FBCommon.GetJsonItemList(FBCommon.GetFBLineReward(mapID, lineID))
|
| | | 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_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
|
| | |
|
| | |
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | if curPlayer.GetMapID() == ChConfig.Def_FBMapID_IceLode:
|
| | | GameWorld.DebugLog('冰晶矿脉扫荡 副本里不能扫荡 ')
|
| | | return
|
| | | #战力判断
|
| | | LVIpyData = PlayerControl.GetPlayerLVIpyData(curPlayer.GetLV())
|
| | | reFightPower = 0 if not LVIpyData else LVIpyData.GetIceLodeFightPower() # 当前等级参考战力
|
| | |
| | | GameWorld.DebugLog("冰晶矿脉扫荡仙玉不足!costGold=%s" % (costMoney))
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_IceLodeHasSweep, 1)
|
| | | |
| | | SyncIceLoddInfo(curPlayer)
|
| | | return True
|
| | |
|
| | | ## 扫荡结果
|
| | |
| | | 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)
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_IceLode, len(lineList))
|
| | | FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID) # 同步信息
|
| | | # npcCountDict = {}
|
| | | # iceLodeSweepDict = IpyGameDataPY.GetFuncEvalCfg('IceLodeSweep')
|
| | | # for npcID, count in iceLodeSweepDict.items():
|
| | |
| | | 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:
|
| | | if lineList and len(lineList) != randomCnt:
|
| | | GameWorld.ErrLog(' 冰晶矿脉获取当前总星数,当前线路数量异常!lineList=%s'%lineList)
|
| | | return starCnt, lineList[:randomCnt]
|
| | |
|
| | |
| | | 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)
|
| | | __RandomLine(curPlayer, lineList)
|
| | | #֪ͨ
|
| | | SyncIceLoddInfo(curPlayer)
|
| | | return True
|