| | |
| | | import PlayerSuccess
|
| | | import GameFuncComm
|
| | | import PyGameData
|
| | | import PlayerVip
|
| | | import GameObj
|
| | | import FBLogic
|
| | | import ChConfig
|
| | |
| | | passLineID = 0
|
| | | if mapID == ChConfig.Def_FBMapID_Main:
|
| | | return PlayerControl.IsMainLevelPass(curPlayer, lineID)
|
| | | if mapID == ChConfig.Def_FBMapID_RealmTower:
|
| | | passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RealmTowerFloor)
|
| | | elif mapID == ChConfig.Def_FBMapID_SkyTower:
|
| | | passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_SkyTowerFloor)
|
| | | elif mapID == ChConfig.Def_FBMapID_TrialTower:
|
| | | passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV)
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('FBGeneralTrain', mapID, lineID)
|
| | | if ipyData:
|
| | | passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
| | | else:
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('FBGeneralTrain', mapID, lineID)
|
| | | if ipyData:
|
| | | passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
| | | else:
|
| | | grade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
|
| | | if grade:
|
| | | return True
|
| | | grade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
|
| | | if grade:
|
| | | return True
|
| | |
|
| | | if passLineID >= lineID:
|
| | | return True
|
| | |
| | | if not maxTimes:
|
| | | return True, ""
|
| | |
|
| | | # 首次进入免费
|
| | | if mapID in [ChConfig.Def_FBMapID_PersonalBoss]:
|
| | | curfbStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
|
| | | if not curfbStar:
|
| | | GameWorld.DebugLog("OnEnterFBEvent 首次进入该副本线路免费!mapID=%s,lineID=%s" % (mapID, lineID))
|
| | | return True, ""
|
| | | |
| | | #playerID = curPlayer.GetPlayerID()
|
| | | enterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_EnterFbCntDay % mapID)
|
| | | maxCnt = GetEnterFBMaxCnt(curPlayer, mapID)
|
| | |
| | | gameFB.SetGameFBDict(ChConfig.Def_FB_NPCStrengthenMaxLV, maxLV)
|
| | | GameWorld.Log("NPC成长动态等级变更: isLeave=%s,totalLV=%s,playerCnt=%s,averageLV=%s,maxLV=%s"
|
| | | % (isLeave, totalLV, playerCnt, averageLV, maxLV), playerID)
|
| | | # 上古战场特殊处理
|
| | | if mapID == ChConfig.Def_FBMapID_ElderBattlefield:
|
| | | lineID = GameWorld.GetGameWorld().GetPropertyID() - 1
|
| | | fbLineIpyData = GetFBLineIpyData(mapID, lineID)
|
| | | lvLimitMin = 0 if not fbLineIpyData else fbLineIpyData.GetLVLimitMin()
|
| | | robotLVDiff = IpyGameDataPY.GetFuncCfg("ElderBattlefieldCfg", 5)
|
| | | robotLVMin, robotLVMax = averageLV - robotLVDiff, averageLV
|
| | | robotLVMin = max(lvLimitMin, robotLVMin)
|
| | | gameFB.SetGameFBDict(ChConfig.Def_FB_NPCStrengthenMaxLV, robotLVMax)
|
| | | gameFB.SetGameFBDict(ChConfig.Def_FB_NPCStrengthenMinLV, robotLVMin)
|
| | | GameWorld.Log(" 更新上古机器人等级范围: lineID=%s,robotLVDiff=%s,robotLV=(%s~%s)" % (lineID, robotLVDiff, robotLVMin, robotLVMax))
|
| | | return True
|
| | |
|
| | | def UpdFBLineNPCStrengthenPlayerCnt(playerID, isLeave):
|
| | |
| | |
|
| | | mwAddCnt = 0#wmpIpyData.GetEffectValue() if wmpIpyData else 0
|
| | | extraTimesVIPPriID = fbIpyData.GetExtraTimesVIPPriID()
|
| | | extraCnt = PlayerVip.GetPrivilegeValue(curPlayer, extraTimesVIPPriID)
|
| | | extraCnt = 0
|
| | | buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mapID)
|
| | | recoverFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RecoverFbCnt % mapID)
|
| | | itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
|
| | |
| | | mwAddCnt = 0#wmpIpyData.GetEffectValue() if wmpIpyData else 0
|
| | | maxTimes += mwAddCnt #法宝增加的次数加到基础次数里
|
| | | extraTimesVIPPriID = fbIpyData.GetExtraTimesVIPPriID()
|
| | | extraCnt = PlayerVip.GetPrivilegeValue(curPlayer, extraTimesVIPPriID)
|
| | | extraCnt = 0
|
| | | buyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_BuyFbCntDay % mapID)
|
| | | recoverFbCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_RecoverFbCnt % mapID)
|
| | | itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ItemAddFbCnt % mapID)
|
| | |
| | |
|
| | | #未买次数
|
| | | buyTimesVIPPriID = fbIpyData.GetBuyTimesVIPPriID()
|
| | | canBuyCnt = PlayerVip.GetPrivilegeValue(curPlayer, buyTimesVIPPriID)
|
| | | canBuyCnt = 0
|
| | | noBuyCnt = max(0, canBuyCnt - buyCnt)
|
| | | return [[rCommonCnt, rRegainFbCnt, rExtraCnt, rBuyCnt, rItemAddCnt, noBuyCnt], [maxTimes, maxRegainFbCnt, extraCnt, canBuyCnt, 10000, canBuyCnt]]
|
| | |
|
| | |
| | | ipyData = ipyDataMgr.GetFBFuncByIndex(i)
|
| | | mapID = ipyData.GetDataMapID()
|
| | |
|
| | | # 有真实助战次数奖励限制的
|
| | | if ipyData.GetDayHelpCountMax():
|
| | | helpCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FBRealHelpCount % mapID)
|
| | | if helpCount:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FBRealHelpCount % mapID, 0)
|
| | | GameWorld.DebugLog("重置日助战奖励次数限制!mapID=%s" % mapID)
|
| | | |
| | | dayTimes = ipyData.GetDayTimes()
|
| | | # 没有日次数限制的不处理
|
| | | if not dayTimes and not ipyData.GetBuyTimesVIPPriID() and not ipyData.GetExtraTimesVIPPriID() and not ipyData.GetExtraTimesMWPriID():
|
| | |
| | |
|
| | | GameWorld.DebugLog(" 重置:mapID=%s,dayTimes=%s,buyCnt=%s,recoverCnt=%s,itemAddCnt=%s,regainFBCnt=%s,maxCnt=%s,enterCnt=%s"
|
| | | % (mapID, dayTimes, buyCnt, recoverCnt, itemAddCnt, regainFBCnt, maxCnt, enterCnt))
|
| | | if mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
|
| | | if GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_ZhuXianBoss):
|
| | | curCnt = min(maxCnt - enterCnt + IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg'), IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 2))
|
| | | if curCnt > dayTimes:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, itemAddCntKey, curCnt - dayTimes)
|
| | | elif curCnt < dayTimes:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, enterCntKey, dayTimes - curCnt)
|
| | | |
| | | |
| | | mapIDInfo.append(mapID)
|
| | |
|
| | | if mapIDInfo:
|
| | |
| | | if not ipyData:
|
| | | return
|
| | | canBuyCnt = 0
|
| | | buyTimesVIPPriID = ipyData.GetBuyTimesVIPPriID()
|
| | | if buyTimesVIPPriID:
|
| | | canBuyCnt += PlayerVip.GetPrivilegeValue(curPlayer, buyTimesVIPPriID)
|
| | | canBuyCnt += PlayerGoldInvest.GetAddFBBuyCnt(curPlayer, mapID)
|
| | | GameWorld.DebugLog("购买副本进入次数: mapID=%s,canBuyCnt=%s" % (mapID, canBuyCnt))
|
| | | if canBuyCnt <= 0:
|
| | |
| | | if mapID == ChConfig.Def_FBMapID_SealDemon and maxDayTimes and maxCnt - enterCnt >= maxDayTimes:
|
| | | GameWorld.DebugLog('当前次数已满,无需购买。。')
|
| | | return
|
| | | if mapID == ChConfig.Def_FBMapID_ZhuXianBoss and maxCnt - enterCnt >= IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 2):
|
| | | return
|
| | |
|
| | | if hasBuyCnt >= canBuyCnt:
|
| | | GameWorld.DebugLog("购买次数已经用完mapID=%s,buyTimesVIPPriID=%s,hasBuyCnt=%s >= canBuyCnt=%s" % (mapID, buyTimesVIPPriID, hasBuyCnt, canBuyCnt))
|
| | | GameWorld.DebugLog("购买次数已经用完mapID=%s,hasBuyCnt=%s >= canBuyCnt=%s" % (mapID, hasBuyCnt, canBuyCnt))
|
| | | return
|
| | | costGoldDict = IpyGameDataPY.GetFuncEvalCfg('BuyFBCntCost', 1, {})
|
| | | costGold = costGoldDict.get(str(mapID), '0')
|
| | |
| | | paramList = [curPlayer.GetPlayerName()]
|
| | | PlayerControl.SendMailByKey("BuyLoveFBCntCoupleMail", [coupleID], addItemList, paramList)
|
| | | return
|
| | |
|
| | | def DoFuncOpen_RunDaily(curPlayer): return EventReport.WriteFuncCMEAcceptable(curPlayer, ShareDefine.GameFuncID_RunDaily)
|
| | | def DoFuncOpen_RunFamily(curPlayer): return EventReport.WriteFuncCMEAcceptable(curPlayer, ShareDefine.GameFuncID_RunFamily)
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 副本开启提示(几分钟)
|
| | |
| | | return True
|
| | |
|
| | | return False
|
| | |
|
| | |
|
| | | ## 副本行为 - 鼓舞buff
|
| | | # @param curPlayer 玩家
|
| | | # @param key 副本玩家字典key
|
| | | # @param encourageType 金钱类型
|
| | | # @param tick 当前时间
|
| | | # @param isMaxlv 是否直接满级
|
| | | # @return None
|
| | | def FbEncourageBuff(curPlayer, key, encourageType, tick, ownerID=0):
|
| | | #GameWorld.Log("FbEncourageBuff moneyType=%s" % (moneyType))
|
| | | curMapID = curPlayer.GetMapID()
|
| | | curMapID = GetRecordMapID(curMapID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('FbEncourage', curMapID, encourageType)
|
| | | if not ipyData:
|
| | | return
|
| | | maxCnt = ipyData.GetInspireMaxLV()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | ownerID = ownerID or curPlayer.GetID()
|
| | | encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
|
| | | encourageCntKey = 'FbEncourageCnt_%s' % encourageType
|
| | | encourageCnt = gameFB.GetPlayerGameFBDictByKey(ownerID, encourageCntKey)
|
| | | maxLV = IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 2, {}).get(curMapID, 0)
|
| | | if encourageLV >= maxLV:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_93643")
|
| | | return
|
| | | if encourageCnt >= maxCnt:
|
| | | if encourageType == IPY_GameWorld.TYPE_Price_Silver_Money:
|
| | | PlayerControl.NotifyCode(curPlayer, "Xjmj_CopperInspireFull")
|
| | | else:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_93643")
|
| | | return
|
| | | |
| | | encourageCost = eval(ipyData.GetMoneyCount())
|
| | | if curMapID == ChConfig.Def_FBMapID_SealDemon:
|
| | | isDouble = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FMTDouble)
|
| | | if isDouble: #封魔坛双倍挑战则鼓舞双倍花费
|
| | | encourageCost *= 2
|
| | |
|
| | | costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, encourageType, encourageCost)
|
| | | if not costMoneyList:
|
| | | return
|
| | | |
| | | # 扣除鼓舞消耗
|
| | | infoDict = {"MapID":curMapID}
|
| | | for moneyType, moneyCnt in costMoneyList:
|
| | | if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt, ChConfig.Def_Cost_FBEncourage, infoDict):
|
| | | return
|
| | | buffTypeID = IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 1, {}).get(curMapID, ChConfig.Def_SkillID_FBEncourageBuff)
|
| | | skillBuffID = buffTypeID + encourageLV
|
| | | skillBuff = GameWorld.GetGameData().GetSkillBySkillID(skillBuffID)
|
| | | if not skillBuff:
|
| | | GameWorld.Log("FbEncourageBuff 找不到技能%s" % skillBuffID)
|
| | | return
|
| | | |
| | | buffType = SkillCommon.GetBuffType(skillBuff)
|
| | | |
| | | gameFB.SetPlayerGameFBDict(ownerID, key, encourageLV+1)
|
| | | gameFB.SetPlayerGameFBDict(ownerID, encourageCntKey, encourageCnt+1)
|
| | | #GameWorld.Log("FbEncourageBuff encourage nextLV=%s success" % encourageLV)
|
| | | addHurtNum = IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 3, {}).get(curMapID, 0)
|
| | | if curMapID == ChConfig.Def_FBMapID_AllFamilyBoss:
|
| | | #给副本里所有盟成员提示
|
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | player = playerManager.GetPlayerByIndex(index)
|
| | | if not player:
|
| | | continue
|
| | | if player.GetFamilyID() != ownerID:
|
| | | continue
|
| | | BuffSkill.DoAddBuff(player, buffType, skillBuff, tick)
|
| | | PlayerControl.NotifyCode(player, "AllianceBossText2", [curPlayer.GetName(), encourageLV+1])
|
| | | SendFBEncourageInfo(player, encourageLV+1, ownerID)
|
| | | if player.GetID() == curPlayer.GetID():
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FBEncourage, 1, [curMapID])
|
| | | |
| | | else:
|
| | | BuffSkill.DoAddBuff(curPlayer, buffType, skillBuff, tick)
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_628920", [(encourageLV+1)*addHurtNum])
|
| | | SendFBEncourageInfo(curPlayer, encourageLV+1, ownerID)
|
| | | #成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_FBEncourage, 1, [curMapID])
|
| | | return True
|
| | |
|
| | | ## 添加副本鼓舞buff,一般用于玩家掉线后,在规定时间内重新上线回到副本时重新上buff
|
| | | # @param curPlayer 玩家
|
| | | # @param key 副本玩家字典key
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def AddFbEncourageBuff(curPlayer, key, tick, ownerID=0):
|
| | | curPlayerID = curPlayer.GetID()
|
| | | GameWorld.Log("AddFbEncourageBuff() curPlayerID=%s" % curPlayerID)
|
| | | ownerID = ownerID or curPlayer.GetID()
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | encourageLV = gameFB.GetPlayerGameFBDictByKey(ownerID, key)
|
| | | if not encourageLV:
|
| | | return
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | mapID = GetRecordMapID(mapID)
|
| | | buffTypeID = IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 1, {}).get(mapID, ChConfig.Def_SkillID_FBEncourageBuff)
|
| | | skillBuffID = buffTypeID + encourageLV -1
|
| | | skillBuff = GameWorld.GetGameData().GetSkillBySkillID(skillBuffID)
|
| | | if not skillBuff:
|
| | | GameWorld.Log("FbEncourageBuff 找不到技能%s" % skillBuffID)
|
| | | return
|
| | | |
| | | buffType = SkillCommon.GetBuffType(skillBuff)
|
| | | BuffSkill.DoAddBuff(curPlayer, buffType, skillBuff, tick)
|
| | | |
| | | SendFBEncourageInfo(curPlayer, encourageLV, ownerID)
|
| | | return
|
| | |
|
| | | ## 清除鼓舞buff
|
| | | # @param curPlayer 玩家
|
| | | # @param tick 当前时间
|
| | | # @return True - 清除成功 ; False - 无该buff
|
| | | def ClearEncourageBuff(curPlayer, tick):
|
| | | for buffTypeID in list(set(IpyGameDataPY.GetFuncEvalCfg('FBEncourageBuff', 1, {}).values())):
|
| | | if BuffSkill.DelBuffBySkillID(curPlayer, buffTypeID, tick):
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.RefreshPlayerAttrByBuff()
|
| | | GameWorld.Log("ClearEncourageBuff() True")
|
| | | return True
|
| | | GameWorld.Log("ClearEncourageBuff() False")
|
| | | return False
|
| | |
|
| | | ## 发送副本鼓舞信息
|
| | | # @param curPlayer 玩家
|
| | | # @return None
|
| | | def SendFBEncourageInfo(curPlayer, lv, ownerID=0):
|
| | | #//A3 0A 副本鼓舞信息通知 #tagMCFBEncourageInfo
|
| | | curMapID = curPlayer.GetMapID()
|
| | | curMapID = GetRecordMapID(curMapID)
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('FbEncourage', {'DataMapID':curMapID}, True)
|
| | | if not ipyDataList:
|
| | | return
|
| | | encourageInfo = ChPyNetSendPack.tagMCFBEncourageInfo()
|
| | | encourageInfo.Clear()
|
| | | encourageInfo.InfoList = []
|
| | | encourageCntKey = 'FbEncourageCnt_%s'
|
| | | gameFB = GameWorld.GetGameFB()
|
| | | ownerID = ownerID or curPlayer.GetID()
|
| | | for ipyData in ipyDataList:
|
| | | inspireType = ipyData.GetInspireType()
|
| | | packData = ChPyNetSendPack.tagMCFBEncourageCnt()
|
| | | packData.MoneyType = inspireType
|
| | | packData.EncourageCnt = gameFB.GetPlayerGameFBDictByKey(ownerID, encourageCntKey % inspireType)
|
| | | encourageInfo.InfoList.append(packData)
|
| | | encourageInfo.Cnt = len(encourageInfo.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, encourageInfo)
|
| | | return
|
| | |
|
| | | ## 获取玩家所在副本区域福利倍值
|
| | | # @param curPlayer 玩家
|
| | |
| | | totalZhenQi = gameWorld.GetGameWorldDictByKey(ChConfig.Map_Player_AreaReward_GetZhenQiTotal%playerID)
|
| | | totalZhenQi += addZhenQi
|
| | | gameWorld.SetGameWorldDict(ChConfig.Map_Player_AreaReward_GetZhenQiTotal%playerID, totalZhenQi)
|
| | | |
| | | if "TechPoint" in rewardFormatDict:
|
| | | addTechPoint = eval(rewardFormatDict["TechPoint"])
|
| | | PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addTechPoint, True, ShareDefine.Def_AddFAVReason_FamilyInvade, True)
|
| | | |
| | | techPoint = gameWorld.GetGameWorldDictByKey(ChConfig.Map_Player_AreaReward_GetTechPoint%playerID)
|
| | | techPoint += addTechPoint
|
| | | gameWorld.SetGameWorldDict(ChConfig.Map_Player_AreaReward_GetTechPoint%playerID, techPoint)
|
| | |
|
| | | #GameWorld.DebugLog(" 战场福利 倍区=%s,reLV=%s,reExp=%s,addExp=%s,addZQ=%s,totalExp=%s,totalZQ=%s"
|
| | | # % (multiple, reLV, reExp, addExp, addZhenQi, totalExp, totalZhenQi), playerID)
|