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
160
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GameWorldLogic.FBProcess.GameLogic_PersonalBoss
#
# @todo:¸öÈËBoss¡¢VIPBoss
# @author hxp
# @date 2019-05-23
# @version 1.0
#
# ÏêϸÃèÊö: ¸öÈËBoss¡¢VIPBoss
# ±¾¸±±¾×öǰ¶Ë×Ô¶¨Ò峡¾°´¦Àí£¬ºó¶ËÎÞʵ¼ÊµØÍ¼
#
#-------------------------------------------------------------------------------
#"""Version = 2019-05-23 17:30"""
#-------------------------------------------------------------------------------
 
import FBCommon
import GameWorld
import EventReport
import PlayerBossReborn
import PlayerNewFairyCeremony
import PlayerActGarbageSorting
import PlayerFairyCeremony
import PlayerFeastTravel
import IpyGameDataPY
import EventShell
import NPCCommon
import ChConfig
 
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
    return True
 
## ÊÇ·ñÐèÒª×ö½øÈ븱±¾Í¨Óüì²éÌõ¼þÂß¼­£¬Ä¬ÈÏÐèÒª¼ì²é
def OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
    ## ½øÐÐÖеIJ»ÐèÒªÖØ¸´¼ì²é£¬·ÀÖ¹¶ÏÏßÖØÁ¬±»½ûÖ¹½øÈë
    if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) == ChConfig.CustomMapStep_Fight:
        GameWorld.DebugLog("VIPBossÒѾ­ÔÚ½øÐÐÖУ¬±¾´Î½øÈë²»ÐèÒªÖØÐ¼ì²é!")
        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)
        EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_PersonalBoss, 0, ChConfig.CME_Log_Start)
        
        # ¿ªÊ¼¼ÆÊ±
        tick = GameWorld.GetGameWorld().GetTick()
        curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneStepTick, tick)
        FBCommon.UpdateCustomFBGrade(curPlayer, tick, FBCommon.GetFBLineGrade(mapID, lineID))
        
    return True
 
def OnCustomSceneProcess(curPlayer, mapID, lineID, tick):
    
    if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) == ChConfig.CustomMapStep_Fight:
        FBCommon.UpdateCustomFBGrade(curPlayer, tick, FBCommon.GetFBLineGrade(mapID, lineID))
        
    return
 
## ×Ô¶¨Ò峡¾°¸±±¾»÷ɱNPC
def DoCustomScene_Player_KillNPC(curPlayer, curNPC, mapID, lineID):
    
    npcID = curNPC.GetNPCID()
    bossID = __GetPersonalBossID(lineID)
    GameWorld.DebugLog("¸öÈËboss³¡¾°»÷ɱNPC: npcID=%s,bossID=%s" % (npcID, bossID), curPlayer.GetPlayerID())
    if npcID != bossID:
        return
    
    if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
        return
    
    grade = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneGrade)
    costTime = GameWorld.GetGameWorld().GetTick() - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneStepTick)
    GameWorld.DebugLog("¸öÈËboss¹ý¹Ø: grade=%s,costTime=%s" % (grade, costTime))
    isFree = False
    curfbStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
    # Ê״ιý¹Ø²»¿Û´ÎÊý
    if not curfbStar:
        isFree = True
        GameWorld.DebugLog("    Ê״ιý¹Ø£¡mapID=%s,lineID=%s" % (mapID, lineID), curPlayer.GetPlayerID())
        
    if curfbStar < grade:
        GameWorld.DebugLog("    ¸üÐÂÆÀ¼¶£¡curfbStar=%s < grade=%s" % (curfbStar, grade), curPlayer.GetPlayerID())
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, grade, False, [mapID])
        FBCommon.Sync_FBPlayerFBInfoData(curPlayer, mapID) # Í¬²½ÐÅÏ¢
        
    #Ôö¼Ó½øÈë´ÎÊý
    FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_PersonalBoss, isFree=isFree)
    
    FBCommon.DelFBEnterTicket(curPlayer, ChConfig.Def_FBMapID_PersonalBoss)
    PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_VIPBOSS, 1)
    PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_VIPBoss, 1)
    PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_VIPBoss, 1)
    PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_VIPBoss, 1)
    PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_KillBoss)
    
    EventShell.EventRespons_FBEvent(curPlayer, 'passvipboss')
    
    npcCountDict = {bossID:1}
    dropItemMapInfo = [0, 0]
    jsonItemList = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, dropItemMapInfo=dropItemMapInfo, curGrade=grade, isVirtualDrop=True)[0]
    FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Over)
    isPass = 1
    overDict = {FBCommon.Over_itemInfo:jsonItemList, FBCommon.Over_grade:grade, FBCommon.Over_costTime:costTime}
    FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
    return
 
def __GetPersonalBossID(lineID):
    ## VIPbossID
    ipyData = IpyGameDataPY.GetIpyGameData('PersonalBoss', lineID)
    if not ipyData:
        return 0
    return ipyData.GetNPCID()
 
## ¿É·ñɨµ´
def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
    if mapID != ChConfig.Def_FBMapID_PersonalBoss:
        return
    curGrade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
    if curGrade < 5:
        GameWorld.DebugLog("ûÓÐS¼¶²»ÄÜɨµ´! curGrade=%s" % curGrade)
        return
    
    return True
 
## É¨µ´½á¹û
def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
    
    bossID = __GetPersonalBossID(lineID)
    grade = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
    
    GameWorld.DebugLog("¸öÈËbossɨµ´: lineID=%s,bossID=%s,grade=%s,sweepCnt=%s" 
                       % (lineID, bossID, grade, sweepCnt), curPlayer.GetPlayerID())
    
    PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_VIPBOSS, sweepCnt)
    PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_VIPBoss, sweepCnt)
    PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_VIPBoss, sweepCnt)
    PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_VIPBoss, sweepCnt)
    PlayerActGarbageSorting.AddActGarbageTaskProgress(curPlayer, ChConfig.Def_GarbageTask_KillBoss)
    
    EventShell.EventRespons_FBEvent(curPlayer, 'passvipboss')
    
    npcCountDict = {bossID:sweepCnt}
    jsonItemList = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, curGrade=grade)[0]
    isPass = 1
    overDict = {FBCommon.Over_itemInfo:jsonItemList, FBCommon.Over_isSweep:1}
    FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
    return True