9325 【BT3】【BT4】【BT5】【主干】【后端】日常扫荡优化
# Conflicts:
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
| | |
| | | import GameWorld
|
| | | import ChConfig
|
| | | import PlayerFairyDomain
|
| | | import GameLogic_CrossGrassland
|
| | | import PlayerControl
|
| | | import ShareDefine
|
| | | import random
|
| | |
| | | # @remarks 函数详细说明.
|
| | | def OnExec(curPlayer, msgList):
|
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "AddFairyEvent 事件ID")
|
| | | GameWorld.DebugAnswer(curPlayer, "AddFairyEvent 事件ID 事件ID ...")
|
| | | return
|
| | | maxEventCnt = PlayerFairyDomain.GetMaxEventCnt() # 最大可出现事件个数
|
| | | if len(msgList) > maxEventCnt:
|
| | |
| | | index = 0
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyAdventuresData % fdEventID, ipyData.GetID() * 100 + index)
|
| | |
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('FairyDomain', fdEventID)
|
| | | if not ipyData:
|
| | | continue
|
| | | # 草园重置
|
| | | if ipyData.GetEventType() in [PlayerFairyDomain.FDEventType_GrasslandXian, PlayerFairyDomain.FDEventType_GrasslandLing]:
|
| | | GameLogic_CrossGrassland.DoResetCrossGrassland(curPlayer, ipyData.GetEventType(), fdEventID)
|
| | | |
| | | #设置寻访中
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FairyDomainState, 1)
|
| | |
|
| | |
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | return
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | return True
|
| | |
|
| | | ## 扫荡结果
|
| | | def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | |
| | | enterLV = curPlayer.GetLV()
|
| | | GameWorld.DebugLog("仙界秘境扫荡: mapID=%s,lineID=%s,sweepCnt=%s" % (mapID, lineID, sweepCnt), playerID)
|
| | | |
| | | totalExp = 0
|
| | | fairylandNPCList = IpyGameDataPY.GetFuncEvalCfg('FairylandNPC', 1)
|
| | | for npcID, npcCount in fairylandNPCList:
|
| | | npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
|
| | | if not npcData:
|
| | | continue
|
| | | baseExp = npcData.GetExp()
|
| | | reExp = PlayerControl.GetPlayerReExp(curPlayer)
|
| | | expMulti = IpyGameDataPY.GetFuncCfg("XjmjMonsterExp", 2)
|
| | | addExp = eval(IpyGameDataPY.GetFuncCompileCfg("XjmjMonsterExp", 1))
|
| | | addExpT = addExp * npcCount
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | finalAddExp = playerControl.AddExp(addExpT, ShareDefine.Def_ViewExpType_KillNPC)
|
| | | totalExp += finalAddExp
|
| | | GameWorld.DebugLog(" reExp=%s,npcID=%s,baseExp=%s,expMulti=%s,addExp=%s,npcCount=%s,addExpT=%s,finalAddExp=%s,totalExp=%s"
|
| | | % (reExp, npcID, baseExp, expMulti, addExp, npcCount, addExpT, finalAddExp, totalExp), playerID)
|
| | | |
| | | rewardRateList = FBCommon.GetFBGradeRewardRateList(ChConfig.Def_FBMapID_BZZD)
|
| | | maxGrade = len(rewardRateList)
|
| | | grade = maxGrade # 扫荡直接取最高评级
|
| | | gradeAddExpRate = rewardRateList[maxGrade - grade]
|
| | | gradeExp = int(totalExp * gradeAddExpRate / 100.0)
|
| | | totalExp += gradeExp
|
| | | |
| | | GameWorld.DebugLog(" totalExp=%s,gradeExp=%s,gradeAddExpRate=%s" % (totalExp, gradeExp, gradeAddExpRate), playerID)
|
| | | playerControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playerControl.AddExp(gradeExp)
|
| | | |
| | | expRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExp)
|
| | | expPointRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExpPoint)
|
| | | totalExpRecord = expPointRecord * ChConfig.Def_PerPointValue + expRecord
|
| | | upPer = 0 #提升比例
|
| | | if totalExp > totalExpRecord:#超过旧记录
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_TotalFightExp, totalExp % ChConfig.Def_PerPointValue)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_TotalFightExpPoint, totalExp / ChConfig.Def_PerPointValue)
|
| | | upPer = (totalExp - totalExpRecord) * 100 / totalExpRecord if totalExpRecord else 0
|
| | | |
| | | # 通知结果
|
| | | overDict = {FBCommon.Over_enterLV:enterLV, FBCommon.Over_exp:totalExp % ChConfig.Def_PerPointValue, |
| | | FBCommon.Over_expPoint: totalExp / ChConfig.Def_PerPointValue, |
| | | 'gradeExp':gradeExp % ChConfig.Def_PerPointValue, 'gradeExpPoint':gradeExp / ChConfig.Def_PerPointValue,
|
| | | 'upPer':upPer, FBCommon.Over_grade:grade, FBCommon.Over_isSweep:1}
|
| | | __SendBZZDOverInfo(curPlayer, overDict)
|
| | | return
|
| | |
|
| | | ## 副本行为
|
| | | def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
| | |
| | | import NPCCommon
|
| | | import ChConfig
|
| | | import ChItem
|
| | | import ItemControler
|
| | |
|
| | | FBDict_IsOver = 'FBDict_IsOver' #是否已结算, 结算时的tick
|
| | | FBDict_IsPlayerOver = 'IsPlayerOver_%s' #玩家是否已经结算掉落的,参数playerID
|
| | |
| | |
|
| | | return giveItemList
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | if curState not in [PlayerFairyDomain.FDEventState_CanVisit, PlayerFairyDomain.FDEventState_Visiting]:
|
| | | GameWorld.DebugLog("缥缈无法扫荡! 不存在该事件或无法进入! mapID=%s,lineID=%s,curState=%s" % (mapID, lineID, curState))
|
| | | return False
|
| | | return True
|
| | |
|
| | | ## 扫荡结果
|
| | | def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
|
| | | if not ipyData:
|
| | | return
|
| | | eventID = ipyData.GetID()
|
| | | PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
|
| | | |
| | | isOwner = True
|
| | | giveItemList = __GetDemonKingPrizeItemList(curPlayer, mapID, lineID, eventID, isOwner)
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList)
|
| | | |
| | | isPass = 1
|
| | | overDict = {FBCommon.Over_ownerID:playerID, FBCommon.Over_ownerName:curPlayer.GetPlayerName(), |
| | | FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList), FBCommon.Over_isSweep:1}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | return
|
| | |
|
| | |
| | | import ChConfig
|
| | | import FBCommon
|
| | | import ItemControler
|
| | | import random
|
| | |
|
| | | FBDict_SyncFBNPC = 'SyncFBNPC' #是否需要同步副本NPC
|
| | |
|
| | |
| | | return
|
| | |
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | if curState not in [PlayerFairyDomain.FDEventState_CanVisit, PlayerFairyDomain.FDEventState_Visiting]:
|
| | | GameWorld.DebugLog("缥缈无法扫荡! 不存在该事件或无法进入! mapID=%s,lineID=%s,curState=%s" % (mapID, lineID, curState))
|
| | | return False
|
| | | return True
|
| | |
|
| | | ## 扫荡结果
|
| | | def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | |
| | | jsonItemList = []
|
| | | refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
|
| | | npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
|
| | | GameWorld.DebugLog("草园扫荡: mapID=%s,lineID=%s,npcCountDict=%s" % (mapID, lineID, npcCountDict))
|
| | | if npcCountDict:
|
| | | npcIDList = npcCountDict.keys()
|
| | | doCount = sum(npcCountDict.values()) * 2
|
| | | while npcIDList and doCount >= 0:
|
| | | doCount -= 1
|
| | | npcID = random.choice(npcIDList)
|
| | | collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
|
| | | if not collectNPCIpyData:
|
| | | npcIDList.remove(npcID)
|
| | | continue
|
| | | awardItemInfo = NPCCommon.DoGiveCollectNPCAward(curPlayer, npcID, collectNPCIpyData, isSweep=True)
|
| | | if awardItemInfo == None:
|
| | | npcIDList.remove(npcID)
|
| | | GameWorld.DebugLog(" 扫荡npcID=%s,没有奖励了,移除! npcIDList=%s" % (npcID, npcIDList))
|
| | | continue
|
| | | jsonItemList.extend(awardItemInfo)
|
| | | GameWorld.DebugLog(" npcID=%s,awardItemInfo=%s" % (npcID, awardItemInfo))
|
| | | GameWorld.DebugLog(" 扫荡jsonItemList=%s" % jsonItemList)
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineID})
|
| | | if ipyData:
|
| | | fdeventID = ipyData.GetID()
|
| | | PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
|
| | | |
| | | isPass = 1
|
| | | overDict = {FBCommon.Over_itemInfo:jsonItemList, FBCommon.Over_isSweep:1}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | lineID = 0
|
| | | mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineID})
|
| | | fdeventID = ipyData.GetID()
|
| | | fdeventID = ipyData.GetID() if ipyData else 0
|
| | | GameWorld.DebugLog("副本结算: isPass=%s" % (isPass))
|
| | |
|
| | | noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict = PlayerAssist.OnFBAssistOver(isPass, mapID)
|
| | |
| | | def CheckCanAttackTagObjInFB(attacker, defender):
|
| | | return GameWorld.GetGameFB().GetFBStep() == FB_Step_Fight
|
| | |
|
| | | ## 可否扫荡
|
| | | def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
|
| | | if curState not in [PlayerFairyDomain.FDEventState_CanVisit, PlayerFairyDomain.FDEventState_Visiting]:
|
| | | GameWorld.DebugLog("缥缈无法扫荡! 不存在该事件或无法进入! mapID=%s,lineID=%s,curState=%s" % (mapID, lineID, curState))
|
| | | return False
|
| | | return True
|
| | |
|
| | |
|
| | | ## 扫荡结果
|
| | | def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineID})
|
| | | if ipyData:
|
| | | fdeventID = ipyData.GetID()
|
| | | PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
|
| | | |
| | | isPass = 1
|
| | | _, bossID = FBCommon.GetFBLineRefreshNPC(ChConfig.Def_FBMapID_KillDevil)
|
| | | jsonItemList, totalExp, totalMoney = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, {bossID:1})
|
| | | overDict = {FBCommon.Over_itemInfo:jsonItemList, FBCommon.Over_isSweep:1}
|
| | | FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
| | | return
|
| | |
| | | if mapID != ChConfig.Def_FBMapID_MunekadoTrial:
|
| | | return
|
| | | # 暂写死,前两层不能扫
|
| | | if lineID < 2: |
| | | GameWorld.DebugLog("前两层不能扫荡!")
|
| | | return
|
| | | #if lineID < 2: |
| | | # GameWorld.DebugLog("前两层不能扫荡!")
|
| | | # return
|
| | | historyStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
|
| | | if historyStar < 5:
|
| | | GameWorld.DebugLog("没有S级不能扫荡!")
|
| | |
| | | overDict = {FBCommon.Over_grade:star,FBCommon.Over_dataMapID:mapID,FBCommon.Over_isPass:1, FBCommon.Over_isSweep:1}
|
| | | overDict[FBCommon.Over_helpPlayer] = helpBattlePlayerDict
|
| | | overDict[FBCommon.Over_itemInfo] = jsonItemList
|
| | | GameWorld.DebugLog("宗门扫荡结果: overDict=%s" % overDict)
|
| | | FBCommon.Notify_FB_Over(curPlayer, overDict)
|
| | | return True
|
| | |
|
| | |
| | | if fbIpyData and fbIpyData.GetDayTimes():
|
| | | FBCommon.AddEnterFBCount(curPlayer, mapID, cnt)
|
| | |
|
| | | helpIpyData = IpyGameDataPY.GetIpyGameData("FBHelpBattle", mapID, lineID)
|
| | | helpIpyData = IpyGameDataPY.GetIpyGameDataNotLog("FBHelpBattle", mapID, lineID)
|
| | | if helpIpyData:
|
| | | FBHelpBattle.SendGameServer_SweepCallHelpBattlePlayer(curPlayer, mapID, lineID)
|
| | | return
|
| | |
| | | import PlayerFeastTravel
|
| | | import PlayerFairyCeremony
|
| | | import PlayerNewFairyCeremony
|
| | | import ItemControler
|
| | | import ItemCommon
|
| | | import PyGameData
|
| | | import EventShell
|
| | |
| | | GameWorld.Log('寻访仙域, 没有随机出事件,使用默认事件!! playerLV=%s,visitCnt=%s,默认fdEventIDList=%s'%(curPlayer.GetLV(), visitCnt, fdEventIDList), curPlayer.GetID())
|
| | | if not fdEventIDList:
|
| | | return
|
| | | |
| | | for fdEventID in fdEventIDList:
|
| | | domainIpyData = IpyGameDataPY.GetIpyGameData('FairyDomain', fdEventID)
|
| | | if not domainIpyData:
|
| | | continue
|
| | | |
| | | # 草园重置
|
| | | if domainIpyData.GetEventType() in [FDEventType_GrasslandXian, FDEventType_GrasslandLing]:
|
| | | GameLogic_CrossGrassland.DoResetCrossGrassland(curPlayer, domainIpyData.GetEventType(), fdEventID)
|
| | | |
| | | if not PlayerActivity.AddDailyActionFinishCnt(curPlayer, dailyID):
|
| | | return
|
| | |
|
| | |
| | | def GetFairyAdventuresAward(curPlayer, fdeventID, state):
|
| | | ##奇遇领取奖励
|
| | | state = GameWorld.ToIntDef(state, 0)
|
| | | isSweep, state = state / 10, state % 10
|
| | | if state == FDEventState_Visiting:
|
| | | SetFairyDomainEventState(curPlayer, fdeventID, state)
|
| | | elif state == FDEventState_Visited:
|
| | |
| | | giveItemList.append(GameWorld.GetResultByWeightList(itemRateList))
|
| | | else:
|
| | | giveItemList = [ipyData.GetBasicAward()]
|
| | | NPCCommon.DoGiveItemByVirtualDrop(curPlayer, giveItemList, 0)
|
| | | msgDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
|
| | | if isSweep:
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList)
|
| | | msgDict.update({FBCommon.Over_dataMapID:ChConfig.Def_FBMapID_FairyTreasure, |
| | | FBCommon.Over_isPass:1, FBCommon.Over_isSweep:1})
|
| | | else:
|
| | | NPCCommon.DoGiveItemByVirtualDrop(curPlayer, giveItemList, 0)
|
| | | FBCommon.Notify_FB_Over(curPlayer, msgDict)
|
| | | GameWorld.DebugLog('缥缈奇遇领奖 msgDict=%s, fdeventID=%s' % (msgDict, fdeventID))
|
| | | GameWorld.DebugLog('缥缈奇遇领奖 msgDict=%s, fdeventID=%s, isSweep=%s' % (msgDict, fdeventID, isSweep))
|
| | | return
|
| | |
|
| | |
|