xdh
2019-04-10 541284b1a89344ef8d6f5762972455a2205bb5fc
6457 【后端】【2.0】缥缈仙域开发单(宝藏)
2个文件已修改
1个文件已添加
390 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py 383 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -1731,7 +1731,7 @@
Def_FBMapID_DuJie = 31110
#麒麟之府
Def_FBMapID_KirinHome = 31190
Def_FBMapID_KirinHome = 311900
#个人BOSS
Def_FBMapID_PersonalBoss = 31240
@@ -1776,6 +1776,8 @@
Def_FBMapID_AllFamilyBoss = 31260
#骑宠Boss
Def_FBMapID_HorsePetBoss = 31200
#缥缈宝藏
Def_FBMapID_FairyTreasure = 31190
#注册上传跨服服务器数据后直接进入跨服服务器的地图
RegisterEnter_CrossServerMapIDList = [Def_FBMapID_CrossPenglai]
@@ -1877,6 +1879,7 @@
                'ZhuXianTower':[Def_FBMapID_ZhuXianTower],#诛仙塔
                'AllFamilyBoss':[Def_FBMapID_AllFamilyBoss],#多仙盟BOSS
                'HorsePetBoss':[Def_FBMapID_HorsePetBoss],#骑宠BOSS
                'FairyTreasure':[Def_FBMapID_FairyTreasure],#缥缈宝藏
                }
#特殊副本ID, 由系统分配, 进入时候不验证IsMapCopyFull
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_FairyTreasure.py
New file
@@ -0,0 +1,383 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
#
##@package GameWorldLogic.FBProcess.GameLogic_FairyTreasure
#
# @todo:缥缈宝藏
# @author xdh
# @date 2019-04-09
# @version 1.0
# 详细描述: 缥缈宝藏
#
#---------------------------------------------------------------------
#"""Version = 2019-04-09 11:00"""
#---------------------------------------------------------------------
import FBCommon
import GameWorld
import IPY_GameWorld
import NPCCustomRefresh
import IpyGameDataPY
import PlayerControl
import PlayerFairyDomain
import GameWorldProcess
import ItemControler
import NPCCommon
import ChConfig
import ChPlayer
import EventReport
import ChNPC
FBPlayerDict_CurStep = 'FBPlayerDict_CurStep'   # 当前阶段
# 副本通用配置
(
Def_PrepareTime, # 准备时间,秒
Def_FightTime, # 战斗时间,秒
Def_LeaveTime, # 退出时间, 秒
Def_CollectTime, # 采集时间, 秒
Def_RefreshBossMark, # 刷怪标识点
) = range(5)
#当前副本地图的状态
(
FB_Step_Open,  # 副本开启
FB_Step_Prepare,  # 副本等待
FB_Step_Fighting,  # 副本进行中
#FB_Step_Collect,  # 副本采集中
#FB_Step_PickItem, # 拾取物品中
FB_Step_Over,  # 副本结束
FB_Step_Close,  # 副本关闭
) = range(5)
def __GetFBTimeCfg(lineID=0):
    if not lineID:
        lineID = FBCommon.GetFBPropertyMark()
    return FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_FairyTreasure, lineID)
## 是否可进入
#  @param curPlayer
#  @param mapID 地图ID
#  @param lineId 分线ID
#  @param tick
#  @return 是否可进入
def OnEnterFBEvent(curPlayer, mapID, lineId, tick):
    ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':mapID, 'LineID':lineId})
    if not ipyData:
        return
    fdeventID = ipyData.GetID()
    if not PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visiting):
        return
    return True
##副本玩家进入点
# @param curPlayer 玩家实例
# @param mapID 地图ID
# @param lineId 分线ID
# @param ipyEnterPosInfo 功能线路IPY配置坐标信息
# @param tick 时间戳
# @return posX, posY, 随机半径(可选)
def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
    return ipyEnterPosInfo
## 是否可以进入
#  @param ask 请求信息
#  @param tick
#  @return 回复是否通过请求
def OnChangeMapAsk(ask, tick):
    return IPY_GameWorld.cmeAccept
## 进副本
#  @param curPlayer
#  @param tick
#  @return None
def DoEnterFB(curPlayer, tick):
    mapID = GameWorld.GetMap().GetMapID()
    mapID = FBCommon.GetRecordMapID(mapID)
    gameFB = GameWorld.GetGameFB()
    lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
    playerID = curPlayer.GetID()
    hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)
    if not hadDelTicket:
        FBCommon.SetHadDelTicket(curPlayer)
        FBCommon.SetFBPropertyMark(lineID)
    if not hadDelTicket \
        and IpyGameDataPY.GetIpyGameDataByCondition("NPCShow", {"MapID":mapID, "LineID":lineID}, isLogNone=False):
        GameWorld.DebugLog("刚进入时不直接开始,需等前端通知开始才开始!", playerID)  # 掉线重上强制开始
        return
    fbStep = gameFB.GetFBStep()
    if fbStep < FB_Step_Prepare:
        FBCommon.SetFBStep(FB_Step_Prepare, tick)
    if fbStep <= FB_Step_Prepare:
        notify_tick = __GetFBTimeCfg(lineID)[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
        curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
    elif fbStep == FB_Step_Fighting:
        notify_tick = __GetFBTimeCfg(lineID)[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
        curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True)
    else:
        PlayerControl.PlayerLeaveFB(curPlayer)
        return
    DoFBHelp(curPlayer, tick)
    return
## 客户端发送开始副本
def OnClientStartFB(curPlayer, tick):
    gameFB = GameWorld.GetGameFB()
    fbStep = gameFB.GetFBStep()
    if fbStep >= FB_Step_Prepare:
        GameWorld.ErrLog("前端请求正式开始副本, 但副本已经开始了,不可重复开始!", curPlayer.GetPlayerID())
        return
    lineID = FBCommon.GetFBPropertyMark()
    GameWorld.DebugLog("前端场景秀已播放完毕,请求正式开始副本!lineID=%s" % lineID, curPlayer.GetPlayerID())
    FBCommon.SetFBStep(FB_Step_Prepare, tick)
    notify_tick = __GetFBTimeCfg(lineID)[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
    curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
    DoFBHelp(curPlayer, tick)
    return
## 副本时间到关闭
#  @param tick 当前时间
#  @return None
#  @remarks 函数详细说明.
def OnCloseFB(tick):
    return
## 获得副本帮助信息
#  @param curPlayer 当前玩家(被通知对象)
#  @param tick 当前时间
#  @return None
def DoFBHelp(curPlayer, tick):
    gameFB = GameWorld.GetGameFB()
    curStep = gameFB.GetGameFBDictByKey(FBPlayerDict_CurStep) + 1
    helpDict = {FBCommon.Help_step:curStep}
    GameWorld.DebugLog("DoFBHelp %s" % str(helpDict))
    FBCommon.Notify_FBHelp(curPlayer, helpDict)
    return
##玩家退出副本.
# @param curPlayer 玩家实例
# @param tick 时间戳
# @return 返回值无意义
# @remarks 玩家主动离开副本.
def DoExitFB(curPlayer, tick):
    # 玩家退出默认关闭副本
    #GameWorldProcess.CloseFB(tick)
    return
##副本总逻辑计时器
# @param tick 时间戳
# @return 无意义
# @remarks 副本总逻辑计时器
def OnProcess(tick):
    gameFB = GameWorld.GetGameFB()
    fbStep = gameFB.GetFBStep()
    # 副本准备
    if fbStep == FB_Step_Prepare:
        __DoLogic_FB_Prepare(tick)
    # 副本进行中
    elif fbStep == FB_Step_Fighting:
        __DoLogic_FB_Fighting(tick)
#    # 副本拾取中
#    elif fbStep == FB_Step_PickItem:
#        __DoLogic_FB_PickItem(tick)
    # 副本结束
    elif fbStep == FB_Step_Over:
        __DoLogic_FB_Over(tick)
    return
##战斗准备时间
# @param tick  时钟
# @return 无意义
def __DoLogic_FB_Prepare(tick):
    gameFB = GameWorld.GetGameFB()
    mapID = GameWorld.GetMap().GetMapID()
    lineID = FBCommon.GetFBPropertyMark()
    trialCfg = __GetFBTimeCfg(lineID)
    if tick - gameFB.GetFBStepTick() < trialCfg[Def_PrepareTime] * 1000:
        return
    FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, trialCfg[Def_FightTime] * 1000)
    bossID = FBCommon.GetFBLineRefreshNPC(mapID, lineID)[0]
    NPCCustomRefresh.SetNPCRefresh(trialCfg[Def_RefreshBossMark], [bossID])
    #转入战斗
    FBCommon.SetFBStep(FB_Step_Fighting, tick)
    return
##战斗时间
# @param tick  时钟
# @return 无意义
def __DoLogic_FB_Fighting(tick):
    gameFB = GameWorld.GetGameFB()
    #判断时间结束
    if tick - gameFB.GetFBStepTick() < __GetFBTimeCfg()[Def_FightTime] * 1000:
        return
    #游戏结束
    FBCommon.SetFBStep(FB_Step_Over, tick)
    return
##副本关闭中
# @param tick:时间戳
# @return 无意义
# @remarks 副本关闭中
def __DoLogic_FB_Over(tick):
    # 间隔未到
    if tick - GameWorld.GetGameFB().GetFBStepTick() < __GetFBTimeCfg()[Def_LeaveTime] * 1000:
        return
    #副本关闭
    GameWorldProcess.CloseFB(tick)
    FBCommon.SetFBStep(FB_Step_Close, tick)
    return
## 杀怪
#  @param curPlayer
#  @param curNPC 被杀的怪
#  @param tick
#  @return None
def DoFB_Player_KillNPC(curPlayer, curNPC, tick):
    mapID = GameWorld.GetMap().GetMapID()
    lineID = FBCommon.GetFBPropertyMark()
    bossID, boxID = FBCommon.GetFBLineRefreshNPC(mapID, lineID)
    if bossID != curNPC.GetNPCID():
        return
    #刷宝箱进入采集阶段
    GameWorld.GetGameFB().SetGameFBDict(FBPlayerDict_CurStep, 1)
    DoFBHelp(curPlayer, tick)
    #FBCommon.SetFBStep(FB_Step_Collect, tick)
    NPCCustomRefresh.SetNPCRefresh(__GetFBTimeCfg()[Def_RefreshBossMark], [boxID])
    return
## 检查是否可攻击, 主判定不可攻击的情况,其他逻辑由外层决定
#  @param attacker 攻击方
#  @param defender 防守方
#  @return bool
def CheckCanAttackTagObjInFB(attacker, defender):
    gameFB = GameWorld.GetGameFB()
    if gameFB.GetFBStep() != FB_Step_Fighting:
        return False
    return True
##是否可以采集
# @param curPlayer 玩家实例
# @param curNPC NPC实例
# @param tick 时间戳
# @return 无意义
# @remarks
def OnCanCollect(curPlayer, curNPC, tick):
    return True
##副本中,采集物需要Loading时间.
# @param curPlayer 玩家实例
# @param curNPC NPC实例
# @return 返回值, Loading时间
# @remarks 副本中,采集物需要Loading时间
def GetFBPrepareTime(curPlayer, curNPC):
    return __GetFBTimeCfg()[Def_CollectTime] * 1000
##玩家收集成功(塔, 旗)
# @param curPlayer 玩家实例
# @param tick 时间戳
# @return 无意义
# @remarks
def OnCollectOK(curPlayer, npcID, tick):
    playerID = curPlayer.GetID()
    tagObj = curPlayer.GetActionObj()
    if not tagObj:
        return
    if tagObj.GetGameObjType() != IPY_GameWorld.gotNPC:
        return
    curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
    if not curNPC:
        return
    dropPosX, dropPosY = curNPC.GetPosX(), curNPC.GetPosY()
    ChNPC.OnCollectEnd(curPlayer, curNPC)
    GameWorld.DebugLog('    采集成功!', playerID)
    #DoFBHelp(curPlayer, 0)
    #掉落给奖励
    DoFairyTreasureOver(curPlayer, tick, dropPosX, dropPosY)
    return
def DoFairyTreasureOver(curPlayer, tick, dropPosX, dropPosY):
    #[[(4000,[141,1,1])],[(4000,[141,1,1])]]
    FBCommon.SetFBStep(FB_Step_Over, tick)
    lineID = FBCommon.GetFBPropertyMark()
    awardCfg = FBCommon.GetFBLineReward(ChConfig.Def_FBMapID_FairyTreasure, lineID)
    curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
    giveItemList = []
    for awardRateList in awardCfg:
        newItemInfoList = []
        for itemInfo in awardRateList:
            itemID = itemInfo[1][0]
            itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
            if not itemData:
                return
            if curAlchemyLV < itemData.GetLV() - 1:
                #丹炉等级不足
                continue
            newItemInfoList.append(itemInfo)
        if not newItemInfoList:
            continue
        giveItemList.append(GameWorld.GetResultByWeightList(newItemInfoList))
    if giveItemList:
        NPCCommon.DoVirtualItemDrop(curPlayer, giveItemList, dropPosX, dropPosY)
        ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList)
        leaveTick = __GetFBTimeCfg(lineID)[Def_LeaveTime] * 1000
        curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
        overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
        FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_FairyTreasure, lineID, 1, overDict)
    ipyData = IpyGameDataPY.GetIpyGameDataByCondition('FairyDomain', {'MapID':ChConfig.Def_FBMapID_FairyTreasure, 'LineID':lineID})
    fdeventID = ipyData.GetID()
    PlayerFairyDomain.SetFairyDomainEventState(curPlayer, fdeventID, PlayerFairyDomain.FDEventState_Visited)
    return
## 是否副本复活
#  @param None
#  @return 是否副本复活
def OnPlayerReborn():
    return True
## 副本行为
#  @param curPlayer 玩家
#  @param actionType 行为类型
#  @param actionInfo 行为信息
#  @param tick 当前时间
#  @return None
def DoFBAction(curPlayer, actionType, actionInfo, tick):
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyDomain.py
@@ -176,9 +176,9 @@
        return []
    randomRateList = []
    rate = 0
    curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
    for ipyData in ipyDataList:
        needAlchemyLV = ipyData.GetNeedAlchemyLV()
        curAlchemyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AlchemyLV)
        if curAlchemyLV < needAlchemyLV - 1:
            #丹炉等级不足
            continue