#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_BZZD
|
#
|
# @todo:°ÙÕ½Ö®µØ(¾Ñ鸱±¾)
|
# @author hxp
|
# @date 2016-3-20
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: °ÙÕ½Ö®µØ(¾Ñ鸱±¾)
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2017-06-23 16:30"""
|
#-------------------------------------------------------------------------------
|
|
import FBCommon
|
import GameWorld
|
import IPY_GameWorld
|
import NPCCustomRefresh
|
import GameWorldProcess
|
import PlayerControl
|
import ShareDefine
|
import EventReport
|
import ChConfig
|
import IpyGameDataPY
|
import PlayerSuccess
|
import PlayerBossReborn
|
import PlayerFairyCeremony
|
import PlayerNewFairyCeremony
|
import PlayerActLogin
|
import PlayerFeastTravel
|
import PlayerWeekParty
|
import ItemControler
|
import GameFuncComm
|
import SkillShell
|
import BuffSkill
|
import EventShell
|
import PyGameData
|
import SkillCommon
|
|
|
#---¸±±¾ÅäÖöÔÓ¦keyÖµ---
|
(
|
Def_PrepareTime, # ¸±±¾×¼±¸Ê±¼ä(Ãë)
|
Def_FightTime, # ½øÐÐʱ¼ä(Ãë)
|
Def_LeaveTime, # Í˳öʱ¼ä(Ãë)
|
) = range(3)
|
|
#µ±Ç°¸±±¾µØÍ¼µÄ״̬
|
(
|
FB_Step_Open, # ¸±±¾¿ªÆô
|
FB_Step_Prepare, # ¸±±¾µÈ´ý
|
FB_Step_Fighting, # ¸±±¾½øÐÐÖÐ
|
FB_Step_Over, # ¸±±¾½áÊø
|
FB_Step_Close, # ¸±±¾¹Ø±Õ
|
) = range(5)
|
|
BZZD_TotalNPCCount = 'BZZD_TotalNPCCount' # ×ÜÐè»÷ɱNPCÊýÁ¿
|
BZZD_LastNPCID = 'BZZD_LastNPCID' # ×îºóÒ»Ö»¹ÖNPCID£¬Ö¸¶¨¹ÖÎïË¢Íêºó£¬ºóÐø²¹Ë¢µÄ¹ÖÖ±½ÓË¢¸ÃNPCID£¬·ÀÖ¹Òì³£µ¼Ö¹ÖÎï²»¹»É±ÎÞ·¨½áËã
|
BZZD_IsKillAll = 'BZZD_IsKillAll' # ÊÇ·ñÒѾ»÷ɱµ½Ö¸¶¨¹ÖÎïÊýÁ¿
|
|
FBPlayerDict_KillCnt = 'FBPlayerDict_KillCnt' # »÷ɱÊý
|
FBPlayerDict_EnterLV = 'FBPlayerDict_EnterLV' # ½øÈ븱±¾Ê±µÄµÈ¼¶
|
FBPlayerDict_TotalExp = 'FBPlayerDict_TotalExp' # »ñµÃµÄ×ܾÑé
|
FBPlayerDict_TotalExpPoint = 'FBPlayerDict_TotalExpPoint' # »ñµÃµÄ×ܾÑéµã
|
FBPlayerDict_EncourageLV = 'FBPlayerDict_EncourageLV' # ¹ÄÎèµÈ¼¶
|
|
def OnFBPlayerOnLogin(curPlayer):
|
ReduceExpBuffOnLogin(curPlayer)
|
return
|
|
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë
|
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
return True
|
|
## ½øÈë´«Ë͵ã
|
def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
|
if len(ipyEnterPosInfo) == 3:
|
return ipyEnterPosInfo
|
return ipyEnterPosInfo + [3]
|
|
## ²éѯÊÇ·ñ¿ÉÒÔ½øÈëµØÍ¼
|
def OnChangeMapAsk(ask, tick):
|
return IPY_GameWorld.cmeAccept
|
|
## ¿ªÆô¸±±¾
|
def OnOpenFB(tick):
|
return
|
|
## ½ø¸±±¾
|
def DoEnterFB(curPlayer, tick):
|
playerID = curPlayer.GetPlayerID()
|
playerLV = curPlayer.GetLV()
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
GameWorld.Log("DoEnterFB..lineID=%s,playerLV=%s" % (lineID, playerLV), playerID)
|
gameFB = GameWorld.GetGameFB()
|
hadDelTicket = FBCommon.GetHadDelTicket(curPlayer)
|
if not hadDelTicket:
|
mapID = GameWorld.GetGameWorld().GetMapID()
|
delResult = FBCommon.DelFBEnterTicket(curPlayer, mapID)
|
isOK = delResult[0]
|
#hasBind = delResult[1]
|
if not isOK:
|
PlayerControl.PlayerLeaveFB(curPlayer)
|
return
|
FBCommon.SetHadDelTicket(curPlayer)
|
FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_BZZD)
|
PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_XJMJ, 1)
|
PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_XJMJ, 1)
|
PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_XJMJ, 1)
|
PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_XJMJ, 1)
|
PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_XJMJ, 1)
|
PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_XJMJ, 1)
|
EventShell.EventRespons_FBEvent(curPlayer, 'passxjmj')
|
FBCommon.UpdateFBEnterTick(curPlayer)
|
gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_EnterLV, playerLV)
|
|
logType = FBCommon.GetFBJoinType(curPlayer, False)
|
EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_BZZD, 0, ChConfig.CME_Log_Start, logType)
|
historyEnterCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_HistoryEnterCnt)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_HistoryEnterCnt, min(historyEnterCnt + 1, 999))
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_NeedReduceExpBuff, 1) # ½øÈëµÄʱºò±ê¼ÇÐèÒª¿Û³ý
|
__GiveFirstEnterPrize(curPlayer, historyEnterCnt + 1)
|
|
# ³õʼ»¯ËùÐè»÷ɱNPC
|
fairylandNPCList = IpyGameDataPY.GetFuncEvalCfg('FairylandNPC', 1)
|
refreshNPCList = []
|
for npcID, npcCount in fairylandNPCList:
|
refreshNPCList += [npcID] * npcCount
|
PyGameData.g_bzzdRefreshNPCListDict[lineID] = refreshNPCList
|
gameFB.SetGameFBDict(BZZD_TotalNPCCount, len(refreshNPCList))
|
|
CheckHurtBuff(curPlayer, tick)
|
showState = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_GuideState, ChConfig.GuideState_BZZDShow)
|
if not showState:
|
FBCommon.SendFBEncourageInfo(curPlayer, 0)
|
GameWorld.Log("ǰ¶Ë³¡¾°Ð㻹û²¥Í꣬ÐèÒªµÈǰ¶Ë²¥Í긱±¾³¡¾°Òýµ¼Ðã²ÅÕý³£½øÈë×¼±¸½×¶Î!", playerID)
|
return
|
|
fbStep = gameFB.GetFBStep()
|
if fbStep < FB_Step_Prepare:
|
FBCommon.SetFBStep(FB_Step_Prepare, tick)
|
|
if fbStep <= FB_Step_Prepare:
|
mapID = GameWorld.GetMap().GetMapID()
|
notify_tick = FBCommon.GetFBLineStepTime(mapID)[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttAddUpTime, 0, max(notify_tick, 0), True)
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
|
|
elif fbStep == FB_Step_Fighting:
|
mapID = GameWorld.GetMap().GetMapID()
|
notify_tick = FBCommon.GetFBLineStepTime(mapID)[Def_FightTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, max(notify_tick, 0), True)
|
FBCommon.UpdateFBGrade(tick, FBCommon.GetFBLineGrade(mapID), curPlayer)
|
|
# ÉϹÄÎèbuff
|
encourageLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EncourageLV)
|
if encourageLV > 0:
|
FBCommon.AddFbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, tick)
|
else:
|
FBCommon.SendFBEncourageInfo(curPlayer, encourageLV)
|
|
DoFBHelp(curPlayer, tick)
|
return
|
|
def __GiveFirstEnterPrize(curPlayer, historyEnterCnt):
|
XjmjFirstEnterPrizeDict = IpyGameDataPY.GetFuncEvalCfg("XjmjFirstEnter", 1, {})
|
if historyEnterCnt not in XjmjFirstEnterPrizeDict:
|
return
|
silverMoney, goldMoney, itemID = XjmjFirstEnterPrizeDict[historyEnterCnt]
|
if silverMoney:
|
PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, silverMoney)
|
if goldMoney:
|
PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, goldMoney)
|
if itemID:
|
ItemControler.GivePlayerItem(curPlayer, itemID, 1, 0, [IPY_GameWorld.rptItem])
|
GameWorld.DebugLog("Ê״νøÈë¸ø½±Àø£ºsilverMoney=%s,goldMoney=%s,itemID=%s"
|
% (silverMoney, goldMoney, itemID), curPlayer.GetPlayerID())
|
return
|
|
def CheckHurtBuff(curPlayer, tick, isAdd=True):
|
## ÈËÎïµÈ¼¶µÍÓÚÊÀ½çµÈ¼¶X¼¶£¬µ¥ÈËÌôÕ½ÏɽçÃܾ³»ñµÃÉ˺¦BUFF¼Ó³É
|
if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_WorldLV):
|
return
|
playerID = curPlayer.GetID()
|
enterLV = GameWorld.GetGameFB().GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EnterLV)
|
if enterLV < GameFuncComm.GetFuncLimitLV(ShareDefine.GameFuncID_WorldLV):
|
return
|
curLV = curPlayer.GetLV()
|
worldlv = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
buffID = IpyGameDataPY.GetFuncCfg('XjmjAddHarm', 2)
|
lvRange = IpyGameDataPY.GetFuncCfg('XjmjAddHarm', 1)
|
if isAdd and worldlv - curLV >= lvRange:
|
curSkill = GameWorld.GetGameData().GetSkillBySkillID(buffID)
|
SkillShell.__DoLogic_AddBuff(curPlayer, curPlayer, curSkill, False, tick, 0, 0)
|
if not isAdd and worldlv - curLV < lvRange:
|
BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick)
|
return
|
|
## ¿Í»§¶Ë·¢ËÍ¿ªÊ¼¸±±¾
|
def OnClientStartFB(curPlayer, tick):
|
gameFB = GameWorld.GetGameFB()
|
fbStep = gameFB.GetFBStep()
|
if fbStep >= FB_Step_Prepare:
|
GameWorld.ErrLog("ǰ¶ËÇëÇóÕýʽ¿ªÊ¼¸±±¾, µ«¸±±¾ÒѾ¿ªÊ¼ÁË£¬²»¿ÉÖØ¸´¿ªÊ¼!", curPlayer.GetPlayerID())
|
return
|
|
GameWorld.DebugLog("ǰ¶Ë³¡¾°ÐãÒѲ¥·ÅÍê±Ï£¬ÇëÇóÕýʽ¿ªÊ¼¸±±¾!", curPlayer.GetPlayerID())
|
FBCommon.SetFBStep(FB_Step_Prepare, tick)
|
mapID = GameWorld.GetMap().GetMapID()
|
notify_tick = FBCommon.GetFBLineStepTime(mapID)[Def_PrepareTime] * 1000 - (tick - GameWorld.GetGameFB().GetFBStepTick())
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttAddUpTime, 0, max(notify_tick, 0), True)
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttWaitStart, 0, max(notify_tick, 0), True)
|
DoFBHelp(curPlayer, tick)
|
return
|
|
## ¹Ø±Õ¸±±¾
|
def OnCloseFB(tick):
|
#GameWorld.GetGameWorld().SetPropertyID(0)
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
PyGameData.g_bzzdRefreshNPCListDict.pop(lineID, None)
|
return
|
|
## Íæ¼ÒÍ˳ö¸±±¾
|
def DoExitFB(curPlayer, tick):
|
# Çå³ý¹ÄÎèbuff
|
FBCommon.ClearEncourageBuff(curPlayer, tick)
|
buffID = IpyGameDataPY.GetFuncCfg('XjmjAddHarm', 2)
|
BuffSkill.DelBuffBySkillID(curPlayer, buffID, tick)
|
FBCommon.UpdFBLineNPCStrengthenLV(curPlayer.GetPlayerID(), True)
|
return
|
|
## Íæ¼ÒÖ÷¶¯À뿪¸±±¾
|
def DoPlayerLeaveFB(curPlayer, tick):
|
if GameWorld.GetGameFB().GetFBStep() <= FB_Step_Fighting:
|
GameWorld.DebugLog("¾Ñ鸱±¾½øÐÐÖУ¬Íæ¼ÒÖ÷¶¯Í˳ö£¬Ö±½Ó¿Û³ý¾Ñé²ã¼¶buff!", curPlayer.GetPlayerID())
|
DoReduceExpBuff(curPlayer)
|
return
|
|
## Íæ¼ÒÉý¼¶
|
def OnPlayerLVUp(curPlayer):
|
CheckHurtBuff(curPlayer, GameWorld.GetGameWorld().GetTick(), False)
|
FBCommon.UpdFBLineNPCStrengthenLV(curPlayer.GetPlayerID(), False)
|
return
|
|
## »ñµÃ¸±±¾°ïÖúÐÅÏ¢
|
def DoFBHelp(curPlayer, tick):
|
gameFB = GameWorld.GetGameFB()
|
playerID = curPlayer.GetID()
|
|
# »ñµÃ¸±±¾ÐÅÏ¢
|
killNPCCnt = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_KillCnt)
|
totalNPCCount = gameFB.GetGameFBDictByKey(BZZD_TotalNPCCount)
|
exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp)
|
expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint)
|
grade = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
|
#¸±±¾°ïÖú
|
helpDict = {FBCommon.Help_npcTotal:killNPCCnt, FBCommon.Help_npcTotalNeed:totalNPCCount,
|
FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, FBCommon.Help_grade:grade}
|
GameWorld.DebugLog("DoFBHelp %s" % str(helpDict))
|
FBCommon.Notify_FBHelp(curPlayer, helpDict)
|
return
|
|
##---¸±±¾×ÜÂß¼¼ÆÊ±Æ÷---
|
def OnProcess(tick):
|
fbStep = GameWorld.GetGameFB().GetFBStep()
|
|
# ¸±±¾×¼±¸
|
if fbStep == FB_Step_Prepare:
|
__DoLogic_FB_Prepare(tick)
|
# ¸±±¾½øÐÐÖÐ
|
elif fbStep == FB_Step_Fighting:
|
__DoLogic_FB_Fighting(tick)
|
# ¸±±¾½áÊø
|
elif fbStep == FB_Step_Over:
|
__DoLogic_FB_Over(tick)
|
|
return
|
|
## ¸±±¾×¼±¸Âß¼
|
def __DoLogic_FB_Prepare(tick):
|
#gameFB = GameWorld.GetGameFB()
|
mapID = GameWorld.GetMap().GetMapID()
|
fbCfg = FBCommon.GetFBLineStepTime(mapID)
|
# ¼ä¸ôδµ½
|
if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_PrepareTime] * 1000:
|
return
|
|
# ÉèÖÿªÊ¼Ë¢¹Ö
|
CheckNPCRefresh(tick)
|
|
# ¸±±¾¿ªÊ¼
|
FBCommon.SetFBStep(FB_Step_Fighting, tick)
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttTowerTake, fbCfg[Def_FightTime] * 1000)
|
return
|
|
def CheckNPCRefresh(tick):
|
#npcˢмì²é
|
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
if lineID not in PyGameData.g_bzzdRefreshNPCListDict:
|
return
|
refreshNPCList = PyGameData.g_bzzdRefreshNPCListDict[lineID]
|
#if not refreshNPCList:
|
# return
|
|
isRefresh = False
|
gameFB = GameWorld.GetGameFB()
|
gameNPC = GameWorld.GetNPCManager()
|
customNPCRefreshCount = gameNPC.GetCustomNPCRefreshCount()
|
for i in xrange(customNPCRefreshCount):
|
npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
|
if npcRefresh.GetCount():
|
continue
|
rMark = npcRefresh.GetRefreshMark()
|
if refreshNPCList:
|
npcID = refreshNPCList.pop(0) # Ö±½Ó°´Ë³ÐòÈ¡NPCID
|
gameFB.SetGameFBDict(BZZD_LastNPCID, npcID)
|
else:
|
npcID = gameFB.GetGameFBDictByKey(BZZD_LastNPCID)
|
GameWorld.DebugLog("¹ÖÈ«²¿Ë¢ÍêÁË£¬Ê¹ÓÃ×îºóÒ»´ÎË¢¹ÖµÄNPCID=%s" % npcID)
|
|
if not npcID:
|
break
|
|
isRefresh = True
|
NPCCustomRefresh.SetNPCRefresh(rMark, [npcID])
|
|
if isRefresh:
|
NPCCustomRefresh.ProcessAllNPCRefresh(tick) # Á¢¼´´¥·¢Ò»´Î±êʶµãË¢ÐÂ
|
return
|
|
## ¸±±¾½øÐÐÖÐ
|
def __DoLogic_FB_Fighting(tick):
|
#gameFB = GameWorld.GetGameFB()
|
mapID = GameWorld.GetMap().GetMapID()
|
FBCommon.UpdateFBGrade(tick, FBCommon.GetFBLineGrade(mapID))
|
fbCfg = FBCommon.GetFBLineStepTime(mapID)
|
# ¼ä¸ôδµ½
|
if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_FightTime] * 1000:
|
CheckNPCRefresh(tick)
|
return
|
__DoBZZDOver()
|
return
|
|
|
##¸±±¾¹Ø±ÕÖÐ
|
def __DoLogic_FB_Over(tick):
|
|
#gameFB = GameWorld.GetGameFB()
|
mapID = GameWorld.GetMap().GetMapID()
|
fbCfg = FBCommon.GetFBLineStepTime(mapID)
|
# ¼ä¸ôδµ½
|
if tick - GameWorld.GetGameFB().GetFBStepTick() < fbCfg[Def_LeaveTime] * 1000:
|
return
|
|
#¸±±¾¹Ø±Õ
|
GameWorldProcess.CloseFB(tick)
|
FBCommon.SetFBStep(FB_Step_Close, tick)
|
return
|
|
## ¼ì²éÊÇ·ñ¿É¹¥»÷£¬ Ö÷Åж¨²»¿É¹¥»÷µÄÇé¿ö£¬ÆäËûÂß¼ÓÉÍâ²ã¾ö¶¨
|
def CheckCanAttackTagObjInFB(attacker, defender):
|
gameFB = GameWorld.GetGameFB()
|
if gameFB.GetFBStep() != FB_Step_Fighting:
|
return False
|
|
if gameFB.GetGameFBDictByKey(BZZD_IsKillAll):
|
#GameWorld.DebugLog("»÷ɱ¹ÖÎïÊýÒÑ´ïµ½×î´ó£¬ÎÞ·¨ÔÙ¹¥»÷!")
|
return False
|
|
return True
|
|
|
## ¹ÖÎï¾ÑéÖµ, Ôݲ»¿¼ÂÇɨµ´ÎÊÌ⣬²ß»®È·ÈϾÑé±¾²»¿ªÉ¨µ´
|
def OnGetNPCExp(curPlayer, curNPC):
|
if not curPlayer:
|
return 0
|
|
gameFB = GameWorld.GetGameFB()
|
isKillAll = gameFB.GetGameFBDictByKey(BZZD_IsKillAll)
|
if isKillAll:
|
GameWorld.DebugLog("ÒѾɱµ½Ö¸¶¨¹ÖÎïÊýÁË£¬ÎÞ·¨ÔÙ»ñµÃ¾Ñé! isKillAll=%s" % isKillAll)
|
return 0
|
|
npcID = curNPC.GetNPCID()
|
playerID = curPlayer.GetPlayerID()
|
reExp = PlayerControl.GetPlayerReExp(curPlayer)
|
baseExp = curNPC.GetExp()
|
expMulti = IpyGameDataPY.GetFuncCfg("XjmjMonsterExp", 2)
|
addExp = eval(IpyGameDataPY.GetFuncCompileCfg("XjmjMonsterExp", 1))
|
|
#GameWorld.DebugLog("»÷ɱNPC: npcID=%s,reExp=%s,baseExp=%s,expMulti=%s,addExp=%s"
|
# % (npcID, reExp, baseExp, expMulti, addExp), playerID)
|
|
#Àۼƻ÷ɱÊý
|
killNPCCnt = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_KillCnt) + 1
|
gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_KillCnt, killNPCCnt)
|
DoFBHelp(curPlayer, GameWorld.GetGameWorld().GetTick())
|
|
totalNPCCount = gameFB.GetGameFBDictByKey(BZZD_TotalNPCCount)
|
if killNPCCnt >= totalNPCCount:
|
gameFB.SetGameFBDict(BZZD_IsKillAll, killNPCCnt)
|
GameWorld.DebugLog("¹ÖÎïÒÑ»÷ɱµ½Ö¸¶¨ÊýÁ¿: killNPCCnt=%s,totalNPCCount=%s" % (killNPCCnt, totalNPCCount))
|
|
return addExp
|
|
## »ñµÃ¾Ñé
|
def OnGetExp(curPlayer, addExp, expViewType):
|
|
if expViewType != ShareDefine.Def_ViewExpType_KillNPC:
|
return
|
|
playerID = curPlayer.GetID()
|
gameFB = GameWorld.GetGameFB()
|
|
if gameFB.GetFBStep() != FB_Step_Fighting:
|
#GameWorld.DebugLog("·ÇÕ½¶·½×¶Î£¬²»´¦Àí! addExp=%s" % addExp)
|
return
|
|
exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp)
|
expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint)
|
totalExp = expPoint * ChConfig.Def_PerPointValue + exp
|
updTotalExp = totalExp + addExp
|
updExp = updTotalExp % ChConfig.Def_PerPointValue
|
updExpPoint = updTotalExp / ChConfig.Def_PerPointValue
|
gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_TotalExp, updExp)
|
gameFB.SetPlayerGameFBDict(playerID, FBPlayerDict_TotalExpPoint, updExpPoint)
|
|
#GameWorld.DebugLog("OnGetExp() totalExp=%s,addExp=%s,updTotalExp=%s" % (totalExp, addExp, updTotalExp), playerID)
|
|
if gameFB.GetGameFBDictByKey(BZZD_IsKillAll):
|
GameWorld.DebugLog("¹ÖÎïÒÑÈ«²¿É±Í꣬½áË㸱±¾!")
|
__DoBZZDOver()
|
return
|
|
## ¸±±¾½áÊø´¦Àí
|
def __DoBZZDOver():
|
tick = GameWorld.GetGameWorld().GetTick()
|
|
playerManager = GameWorld.GetMapCopyPlayerManager()
|
playerCount = playerManager.GetPlayerCount()
|
if not playerCount:
|
GameWorldProcess.CloseFB(tick)
|
return
|
mapID = GameWorld.GetMap().GetMapID()
|
fbCfg = FBCommon.GetFBLineStepTime(mapID)
|
gameFB = GameWorld.GetGameFB()
|
costTime = tick - gameFB.GetFBStepTick()
|
FBCommon.UpdateFBGrade(tick, FBCommon.GetFBLineGrade(mapID)) # ½áËãÇ°Ç¿ÖÆË¢ÐÂÒ»´ÎÆÀ¼¶
|
grade = GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
|
rewardRateList = FBCommon.GetFBGradeRewardRateList(mapID)
|
maxGrade = len(rewardRateList)
|
|
for i in xrange(playerCount):
|
curPlayer = playerManager.GetPlayerByIndex(i)
|
if not curPlayer:
|
continue
|
playerID = curPlayer.GetPlayerID()
|
|
DoReduceExpBuff(curPlayer)
|
|
# ¼Ç¼×î¸ß×ܾÑé
|
exp = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExp)
|
expPoint = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_TotalExpPoint)
|
totalExp = expPoint * ChConfig.Def_PerPointValue + exp
|
gradeAddExpRate = rewardRateList[maxGrade - grade]
|
gradeExp = int(totalExp * gradeAddExpRate / 100.0)
|
totalExp += gradeExp
|
|
playerControl = PlayerControl.PlayerControl(curPlayer)
|
playerControl.AddExp(gradeExp)
|
|
expRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExp)
|
expPointRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExpPoint)
|
totalExpRecord = expPointRecord * ChConfig.Def_PerPointValue + expRecord
|
upPer = 0 #ÌáÉý±ÈÀý
|
if totalExp > totalExpRecord:#³¬¹ý¾É¼Ç¼
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_TotalFightExp, totalExp % ChConfig.Def_PerPointValue)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_TotalFightExpPoint, totalExp / ChConfig.Def_PerPointValue)
|
upPer = (totalExp - totalExpRecord) * 100 / totalExpRecord if totalExpRecord else 0
|
#µ¥³¡×ܾÑé³É¾Í
|
PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_XJMJGetExp, 1, [expPoint])
|
|
killNPCCnt = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_KillCnt)
|
|
# ֪ͨ½á¹û
|
enterLV = gameFB.GetPlayerGameFBDictByKey(playerID, FBPlayerDict_EnterLV)
|
overDict = {FBCommon.Over_enterLV:enterLV, FBCommon.Over_exp:totalExp % ChConfig.Def_PerPointValue,
|
FBCommon.Over_expPoint: totalExp / ChConfig.Def_PerPointValue,
|
'gradeExp':gradeExp % ChConfig.Def_PerPointValue, 'gradeExpPoint':gradeExp / ChConfig.Def_PerPointValue,
|
FBCommon.Over_costTime:costTime, FBCommon.Over_npcTotal:killNPCCnt, 'upPer':upPer, FBCommon.Over_grade:grade}
|
__SendBZZDOverInfo(curPlayer, overDict)
|
|
# ½øÈëÀ뿪½×¶Î
|
FBCommon.SetFBStep(FB_Step_Over, tick)
|
FBCommon.Sync_Player_TimeTick(IPY_GameWorld.tttLeaveMap, fbCfg[Def_LeaveTime] * 1000)
|
|
gameNPC = GameWorld.GetNPCManager()
|
for i in xrange(gameNPC.GetCustomNPCRefreshCount()):
|
npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
|
rMark = npcRefresh.GetRefreshMark()
|
NPCCustomRefresh.CloseNPCRefresh(rMark, tick)
|
return
|
|
## ·¢ËÍÌôÕ½½á¹ûÐÅÏ¢£¬
|
def __SendBZZDOverInfo(curPlayer, overDict):
|
overDict[FBCommon.Over_isPass] = 1 #ĬÈÏͨ¹Ø
|
overDict[FBCommon.Over_dataMapID] = ChConfig.Def_FBMapID_BZZD
|
GameWorld.DebugLog("__SendBZZDOverInfo overDict=%s" % (str(overDict)), curPlayer.GetPlayerID())
|
FBCommon.Notify_FB_Over(curPlayer, overDict)
|
return
|
|
## ¿É·ñɨµ´
|
def OnPlayerFBSweepAsk(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
return True
|
|
## ɨµ´½á¹û
|
def OnPlayerFBSweepResult(curPlayer, mapID, lineID, sweepCnt, isFinish, dataEx):
|
|
playerID = curPlayer.GetPlayerID()
|
|
enterLV = curPlayer.GetLV()
|
expRateEx = DoReduceExpBuff(curPlayer)
|
GameWorld.DebugLog("ÏɽçÃØ¾³É¨µ´: mapID=%s,lineID=%s,sweepCnt=%s,expRateEx=%s" % (mapID, lineID, sweepCnt, expRateEx), playerID)
|
|
totalExp = 0
|
fairylandNPCList = IpyGameDataPY.GetFuncEvalCfg('FairylandNPC', 1)
|
for npcID, npcCount in fairylandNPCList:
|
npcData = GameWorld.GetGameData().FindNPCDataByID(npcID)
|
if not npcData:
|
continue
|
baseExp = npcData.GetExp()
|
reExp = PlayerControl.GetPlayerReExp(curPlayer)
|
expMulti = IpyGameDataPY.GetFuncCfg("XjmjMonsterExp", 2)
|
addExp = eval(IpyGameDataPY.GetFuncCompileCfg("XjmjMonsterExp", 1))
|
addExpT = addExp * npcCount
|
playerControl = PlayerControl.PlayerControl(curPlayer)
|
finalAddExp = playerControl.AddExp(addExpT, ShareDefine.Def_ViewExpType_KillNPC, expRateEx=expRateEx)
|
totalExp += finalAddExp
|
GameWorld.DebugLog(" reExp=%s,npcID=%s,baseExp=%s,expMulti=%s,addExp=%s,npcCount=%s,addExpT=%s,finalAddExp=%s,totalExp=%s"
|
% (reExp, npcID, baseExp, expMulti, addExp, npcCount, addExpT, finalAddExp, totalExp), playerID)
|
|
rewardRateList = FBCommon.GetFBGradeRewardRateList(ChConfig.Def_FBMapID_BZZD)
|
maxGrade = len(rewardRateList)
|
grade = maxGrade # ɨµ´Ö±½ÓÈ¡×î¸ßÆÀ¼¶
|
gradeAddExpRate = rewardRateList[maxGrade - grade]
|
gradeExp = int(totalExp * gradeAddExpRate / 100.0)
|
totalExp += gradeExp
|
totalExp *= sweepCnt
|
|
GameWorld.DebugLog(" totalExp=%s,gradeExp=%s,gradeAddExpRate=%s" % (totalExp, gradeExp, gradeAddExpRate), playerID)
|
playerControl = PlayerControl.PlayerControl(curPlayer)
|
playerControl.AddExp(gradeExp)
|
|
expRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExp)
|
expPointRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_TotalFightExpPoint)
|
totalExpRecord = expPointRecord * ChConfig.Def_PerPointValue + expRecord
|
upPer = 0 #ÌáÉý±ÈÀý
|
if totalExp > totalExpRecord:#³¬¹ý¾É¼Ç¼
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_TotalFightExp, totalExp % ChConfig.Def_PerPointValue)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_TotalFightExpPoint, totalExp / ChConfig.Def_PerPointValue)
|
upPer = (totalExp - totalExpRecord) * 100 / totalExpRecord if totalExpRecord else 0
|
|
PlayerBossReborn.AddBossRebornActionCnt(curPlayer, ChConfig.Def_BRAct_XJMJ, sweepCnt)
|
PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_XJMJ, sweepCnt)
|
PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_XJMJ, sweepCnt)
|
PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_XJMJ, sweepCnt)
|
PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_XJMJ, sweepCnt)
|
PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_XJMJ, sweepCnt)
|
EventShell.EventRespons_FBEvent(curPlayer, 'passxjmj')
|
|
# ֪ͨ½á¹û
|
overDict = {FBCommon.Over_enterLV:enterLV, FBCommon.Over_exp:totalExp % ChConfig.Def_PerPointValue,
|
FBCommon.Over_expPoint: totalExp / ChConfig.Def_PerPointValue,
|
'gradeExp':gradeExp % ChConfig.Def_PerPointValue, 'gradeExpPoint':gradeExp / ChConfig.Def_PerPointValue,
|
'upPer':upPer, FBCommon.Over_grade:grade, FBCommon.Over_isSweep:1}
|
__SendBZZDOverInfo(curPlayer, overDict)
|
return
|
|
def DoReduceExpBuff(curPlayer):
|
buffExpRate = 0
|
buffSkillTypeIDList = IpyGameDataPY.GetFuncEvalCfg("XjmjMonsterExp", 3)
|
for skillTypeID in buffSkillTypeIDList:
|
buff = SkillCommon.FindBuffByID(curPlayer, skillTypeID)[0]
|
if not buff:
|
continue
|
hasEffect = SkillCommon.GetSkillEffectByEffectID(buff.GetSkill(), ChConfig.TYPE_Calc_AttrFightExpRate)
|
if hasEffect:
|
buffExpRate += hasEffect.GetEffectValue(0)
|
BuffSkill.ReduceBuffLayer(curPlayer, buff, skillTypeID, 1)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BZZD_NeedReduceExpBuff, 0)
|
return buffExpRate
|
|
def ReduceExpBuffOnLogin(curPlayer):
|
if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BZZD_NeedReduceExpBuff):
|
return
|
|
mapID = GameWorld.GetMap().GetMapID()
|
if mapID == ChConfig.Def_FBMapID_BZZD and GameWorld.GetGameFB().GetFBStep() <= FB_Step_Fighting:
|
GameWorld.DebugLog("¾Ñ鸱±¾½øÐÐÖУ¬»¹²»ÐèÒª¿Û³ý¾Ñé²ã¼¶buff!", curPlayer.GetPlayerID())
|
return
|
|
DoReduceExpBuff(curPlayer)
|
return
|
|
## ¸±±¾ÐÐΪ
|
def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
if actionType == 0:
|
#µÚÒ»´ÎÔÚ°ÙÕ½Ö®µØ¹ÄÎèÒ»´Î¾ÍÂú¼¶
|
FBCommon.FbEncourageBuff(curPlayer, FBPlayerDict_EncourageLV, actionInfo, tick)
|
return
|
|
return
|
|