#!/usr/bin/python  
 | 
# -*- coding: GBK -*-  
 | 
#-------------------------------------------------------------------------------  
 | 
#  
 | 
##@package GameWorldLogic.FBProcess.GameLogic_BossHome  
 | 
#  
 | 
# @todo:BOSSÖ®¼Ò  
 | 
# @author xdh  
 | 
# @date 2017-11-09  
 | 
# @version 1.0  
 | 
#  
 | 
# ÏêϸÃèÊö: BOSSÖ®¼Ò  
 | 
#  
 | 
#-------------------------------------------------------------------------------  
 | 
#"""Version = 2017-11-09 14:30"""  
 | 
#-------------------------------------------------------------------------------  
 | 
  
 | 
import FBCommon  
 | 
import GameWorld  
 | 
import IpyGameDataPY  
 | 
import IPY_GameWorld  
 | 
import ChConfig  
 | 
import ShareDefine  
 | 
import PlayerVip  
 | 
import PlayerControl  
 | 
import EventReport  
 | 
  
 | 
  
 | 
def __GetEnterCostMoney(lineID):  
 | 
    BossHomeCostDict = IpyGameDataPY.GetFuncEvalCfg('BossHomeCost', 1, {})  
 | 
    return BossHomeCostDict.get(lineID+1, 0)  
 | 
  
 | 
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë  
 | 
#  @param curPlayer Íæ¼ÒʵÀý  
 | 
#  @param mapID µØÍ¼ID  
 | 
#  @param lineID Ïß·id  
 | 
#  @param tick Ê±¼ä´Á  
 | 
#  @return ²¼¶ûÖµ  
 | 
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):  
 | 
    canEnterLine = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_BossHome)  
 | 
    if not canEnterLine:  
 | 
        return  
 | 
    if lineID+1 > canEnterLine:  
 | 
        #ÅжÏÇ®¹»²»¹»  
 | 
        costGold = __GetEnterCostMoney(lineID)  
 | 
        if not costGold:  
 | 
            return False  
 | 
        costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costGold)  
 | 
        #GameWorld.Log('costMoneyList=%s,costGold=%s'%(costMoneyList,costGold))  
 | 
        if not costMoneyList:  
 | 
            return False  
 | 
    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 tick Ê±¼ä´Á  
 | 
#  @return ²¼¶ûÖµ  
 | 
def OnCanOpen(tick):  
 | 
    return True  
 | 
  
 | 
##²éѯÊÇ·ñ¿ÉÒÔ½øÈëµØÍ¼  
 | 
# @param ask:ÇëÇó½á¹¹Ìå(IPY_BMChangeMapAsk)  
 | 
# @param tick:ʱ¼ä´Á  
 | 
# @return IPY_GameWorld.cme Ã¶¾Ù  
 | 
def OnChangeMapAsk(ask, tick):  
 | 
    return IPY_GameWorld.cmeAccept  
 | 
  
 | 
  
 | 
## ½ø¸±±¾  
 | 
#  @param curPlayer  
 | 
#  @param tick  
 | 
#  @return None  
 | 
def DoEnterFB(curPlayer, tick):  
 | 
    playerID = curPlayer.GetPlayerID()  
 | 
    if curPlayer.GetHP() == 0:  
 | 
        PlayerControl.PlayerLeaveFB(curPlayer)  
 | 
        return  
 | 
    # ÉèÖø±±¾¹«¹²ÊôÐԵĵ¥¶À´¦Àí£¬·ÀÖ¹¶ÓÔ±½øÈëºó±»ÐÞ¸Ä  
 | 
    if not FBCommon.GetHadSetFBPropertyMark():  
 | 
        lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)  
 | 
        FBCommon.SetFBPropertyMark(lineID)  
 | 
          
 | 
    GameWorld.DebugLog("DoEnterFB...lineID=%s" % FBCommon.GetFBPropertyMark(), playerID)  
 | 
    hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)  
 | 
    if not hadDelTicket:  
 | 
        FBCommon.SetHadDelTicket(curPlayer)  
 | 
        canEnterLine = PlayerVip.GetPrivilegeValue(curPlayer, ChConfig.VIPPrivilege_BossHome)  
 | 
        lineID = FBCommon.GetFBPropertyMark()  
 | 
        if lineID+1 > canEnterLine:  
 | 
            costGold = __GetEnterCostMoney(lineID)  
 | 
            costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, costGold)  
 | 
            mapID = GameWorld.GetMap().GetMapID()  
 | 
            infoDict = {"MapID":mapID,"LineID":lineID}  
 | 
            for moneyType, moneyNum in costMoneyList:  
 | 
                if not PlayerControl.PayMoney(curPlayer, moneyType, moneyNum, ChConfig.Def_Cost_EnterFB, infoDict):  
 | 
                    GameWorld.Log("ÏÉÓñ²»×ã!costGold=%s" % costGold)  
 | 
                    PlayerControl.PlayerLeaveFB(curPlayer)  
 | 
                    return  
 | 
        EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_BossHome, lineID, ChConfig.CME_Log_Start)  
 | 
      
 | 
  
 | 
    #DoFBHelp(curPlayer, tick, True)  
 | 
    return  
 | 
  
 | 
##Íæ¼ÒÍ˳ö¸±±¾  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param tick Ê±¼ä´Á  
 | 
# @return ÎÞÒâÒå  
 | 
def DoExitFB(curPlayer, tick):  
 | 
   
 | 
    return  
 | 
  
 | 
##Íæ¼ÒÖ÷¶¯À뿪¸±±¾.  
 | 
# @param curPlayer Íæ¼ÒʵÀý  
 | 
# @param tick Ê±¼ä´Á  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
def DoPlayerLeaveFB(curPlayer, tick):  
 | 
    FBCommon.SetHadDelTicket(curPlayer, 0)  
 | 
    return  
 | 
  
 | 
##Íæ¼ÒÇл»µØÍ¼  
 | 
def DoPlayerChangeMapLogic(curPlayer):  
 | 
    FBCommon.SetHadDelTicket(curPlayer, 0)  
 | 
    return  
 | 
  
 | 
## ÊÇ·ñ¸±±¾¸´»î  
 | 
#  @param None  
 | 
#  @return ÊÇ·ñ¸±±¾¸´»î  
 | 
def OnPlayerReborn():  
 | 
    return False  
 | 
  
 | 
## Ñ¯ÎÊÍæ¼ÒÊÇ·ñÇл»Í¬¸ö¹¦ÄܵØÍ¼µÄ²»Í¬³¡¾°µØÍ¼  
 | 
def CanChangeSameDataMapFB(curPlayer, mapID, lineID):  
 | 
    return True  
 | 
      
 | 
  
 | 
## »ñµÃ¸±±¾°ïÖúÐÅÏ¢  
 | 
#  @param curPlayer µ±Ç°Íæ¼Ò£¨±»Í¨Öª¶ÔÏó£©  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return None  
 | 
def DoFBHelp(curPlayer, tick, isEnter=False):  
 | 
  
 | 
    return  
 | 
  
 | 
## ¸±±¾ÐÐΪ  
 | 
#  @param curPlayer Íæ¼Ò  
 | 
#  @param actionType ÐÐΪÀàÐÍ  
 | 
#  @param actionInfo ÐÐΪÐÅÏ¢  
 | 
#  @param tick µ±Ç°Ê±¼ä  
 | 
#  @return None  
 | 
def DoFBAction(curPlayer, actionType, actionInfo, tick):  
 | 
      
 | 
    return  
 | 
  
 | 
##---¸±±¾×ÜÂß¼¼ÆÊ±Æ÷---  
 | 
# @param tick:ʱ¼ä´Á  
 | 
# @return ÎÞÒâÒå  
 | 
# @remarks ¸±±¾×ÜÂß¼¼ÆÊ±Æ÷  
 | 
def OnProcess(tick):  
 | 
    return  
 | 
  
 | 
##Íæ¼ÒËÀÍö.  
 | 
# @param curPlayer:ËÀÍöµÄÍæ¼Ò   
 | 
# @param tick Ê±¼ä´Á  
 | 
# @return ·µ»ØÖµÎÞÒâÒå  
 | 
# @remarks Íæ¼ÒÖ÷¶¯À뿪¸±±¾.  
 | 
def DoPlayerDead(curPlayer):  
 | 
    FBCommon.Notify_FB_Over(curPlayer, {FBCommon.Over_isPass:0})  
 | 
    lineID = FBCommon.GetFBPropertyMark()  
 | 
    leaveTime = int(FBCommon.GetFBLineStepTime(ChConfig.Def_FBMapID_BossHome, lineID))  
 | 
    curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTime*1000, True)  
 | 
    return 
 |