1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/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