#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_GeneralTrain
|
#
|
# @todo:ͨÓÃÑø³É¸±±¾
|
# @author hxp
|
# @date 2024-06-26
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ͨÓÃÑø³É¸±±¾
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2024-06-26 14:30"""
|
#-------------------------------------------------------------------------------
|
|
import FBCommon
|
import GameWorld
|
import PlayerControl
|
import IpyGameDataPY
|
import ItemControler
|
import NPCCommon
|
import ChConfig
|
|
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë
|
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
ipyData = IpyGameDataPY.GetIpyGameData('FBGeneralTrain', mapID, lineID)
|
if not ipyData:
|
return False
|
|
LVLimit = ipyData.GetLVLimit()
|
if LVLimit and curPlayer.GetLV() < LVLimit:
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾µÈ¼¶²»×㣬ÎÞ·¨ÌôÕ½! mapID=%s,lineID=%s,LVLimit=%s" % (mapID, lineID, LVLimit))
|
return False
|
|
RealmLimit = ipyData.GetRealmLimit()
|
if RealmLimit and curPlayer.GetOfficialRank() < RealmLimit:
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾¾³½ç²»×㣬ÎÞ·¨ÌôÕ½! mapID=%s,lineID=%s,RealmLimit=%s" % (mapID, lineID, RealmLimit))
|
return False
|
|
passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
if passLineID + 1 != lineID:
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾Ö»ÄÜÌôÕ½ÏÂÒ»¹Ø! mapID=%s,lineID=%s,passLineID=%s" % (mapID, lineID, passLineID))
|
return False
|
|
return True
|
|
## ÊÇ·ñÐèÒª×ö½øÈ븱±¾Í¨Óüì²éÌõ¼þÂß¼£¬Ä¬ÈÏÐèÒª¼ì²é
|
def OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
|
## ½øÐÐÖеIJ»ÐèÒªÖØ¸´¼ì²é£¬·ÀÖ¹¶ÏÏßÖØÁ¬±»½ûÖ¹½øÈë
|
if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) == ChConfig.CustomMapStep_Fight:
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾ÒѾÔÚ½øÐÐÖУ¬±¾´Î½øÈë²»ÐèÒªÖØÐ¼ì²é! mapID=%s,lineID=%s" % (mapID, lineID))
|
return False
|
return True
|
|
## ¿Í»§¶Ë½øÈë×Ô¶¨Ò峡¾°
|
def OnEnterCustomScene(curPlayer, mapID, lineID):
|
return
|
|
## ÅжϿɷñÕÙ»½Ä¾×®¹Ö
|
def OnCanSummonPriWoodPile(curPlayer, mapID, lineID, npcID, count):
|
|
if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
|
FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Fight)
|
|
npcIDList = GetGeneralTrainNPCIDList(mapID, lineID)
|
if not npcIDList or npcID not in npcIDList:
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾¸ÃNPC²»ÄÜÕÙ»½! mapID=%s,lineID=%s,npcID=%s not in %s" % (mapID, lineID, npcID, npcIDList))
|
return False
|
|
return True
|
|
def OnCustomSceneProcess(curPlayer, mapID, lineID, tick):
|
return
|
|
def GetGeneralTrainNPCIDList(mapID, lineID):
|
npcIDList = []
|
ipyData = IpyGameDataPY.GetIpyGameData('FBGeneralTrain', mapID, lineID)
|
if not ipyData:
|
return []
|
|
npcIDList.append(ipyData.GetBossNPCID())
|
npcIDList.extend(ipyData.GetOtherNPCIDList())
|
return npcIDList
|
|
def GetGeneralTrainBossID(mapID, lineID):
|
ipyData = IpyGameDataPY.GetIpyGameData('FBGeneralTrain', mapID, lineID)
|
if not ipyData:
|
return 0
|
return ipyData.GetBossNPCID()
|
|
## ×Ô¶¨Ò峡¾°¸±±¾»÷ɱNPC
|
def DoCustomScene_Player_KillNPC(curPlayer, curNPC, mapID, lineID):
|
|
npcID = curNPC.GetNPCID()
|
bossID = GetGeneralTrainBossID(mapID, lineID)
|
GameWorld.DebugLog("»÷ɱ¸±±¾NPC: mapID=%s,lineID=%s,npcID=%s,bossID=%s" % (mapID, lineID, npcID, bossID), curPlayer.GetPlayerID())
|
if npcID != bossID:
|
return
|
|
if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
|
return
|
|
ipyData = IpyGameDataPY.GetIpyGameData('FBGeneralTrain', mapID, lineID)
|
if not ipyData:
|
return
|
|
passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
if lineID > passLineID:
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBPassLineID % mapID, lineID)
|
|
#Ôö¼Ó½øÈë´ÎÊý
|
FBCommon.AddEnterFBCount(curPlayer, mapID)
|
|
giveItemList = ipyData.GetPassAwardItemList()
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾¹ý¹Ø! mapID=%s,lineID=%s,giveItemList=%s" % (mapID, lineID, giveItemList))
|
|
NPCCommon.DoGiveItemByVirtualDrop(curPlayer, giveItemList, bossID)
|
|
FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Over)
|
|
isPass = 1
|
overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(giveItemList)}
|
FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
return
|
|
## ¿É·ñɨµ´
|
def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
|
ipyData = IpyGameDataPY.GetIpyGameData('FBGeneralTrain', mapID, lineID)
|
if not ipyData:
|
return
|
|
passLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
if passLineID < lineID:
|
GameWorld.DebugLog("ûÓйý¹Ø²»ÄÜɨµ´! mapID=%s,passLineID=%s < %s" % (mapID, passLineID, lineID))
|
return
|
|
return True
|
|
## ɨµ´½á¹û
|
def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
GameWorld.DebugLog("ͨÓÃÑø³É¸±±¾É¨µ´: mapID=%s,lineID=%s,sweepCnt=%s" % (mapID, lineID, sweepCnt))
|
ipyData = IpyGameDataPY.GetIpyGameData('FBGeneralTrain', mapID, lineID)
|
if not ipyData:
|
return
|
|
giveItemList = ipyData.GetPassAwardItemList()
|
awardItemList = []
|
for itemID, itemCount, isAuctionItem in giveItemList:
|
awardItemList.append([itemID, itemCount * sweepCnt, isAuctionItem])
|
|
ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList)
|
|
isPass = 1
|
overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(awardItemList), FBCommon.Over_isSweep:1}
|
FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
|
return True
|