#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_CrossRealmPK
|
#
|
# @todo:¿ç·þÆ¥ÅäPK
|
# @author hxp
|
# @date 2018-12-21
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ¿ç·þÆ¥ÅäPK
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2018-12-21 18:00"""
|
#-------------------------------------------------------------------------------
|
|
import GameWorld
|
import MirrorAttack
|
import PlayerCrossRealmPK
|
import GameObj
|
|
###´¦Àí¸±±¾ÖÐɱËÀÍæ¼ÒÂß¼
|
def DoFBOnKill_Player(atkobj, defender, tick):
|
GameWorld.DebugLog("¾µÏñÇдè»÷É±Íæ¼Ò: defID=%s" % (defender.GetID()), atkobj.GetID())
|
return True
|
|
def OnMirrorBattleRequest(curPlayer, mapID, funcLineID):
|
## ¾µÏñÕ½¶·ÇëÇó
|
|
if not PlayerCrossRealmPK.CheckCanMatch(curPlayer):
|
return
|
|
if not PlayerCrossRealmPK.CheckHavePKCount(curPlayer):
|
return
|
|
return True
|
|
|
def OnMirrorBattleOver(battleID):
|
## ¾µÏñÕ½¶·½áÊø
|
|
battle = MirrorAttack.GetMirrorBattleByID(battleID)
|
if not battle:
|
return
|
isLogout = battle.isLogout
|
|
mapID = battle.mapID
|
funcLineID = battle.funcLineID
|
winFaction = battle.winFaction
|
curPlayerID = battle.requestID # ¸±±¾ËùÊôÍæ¼ÒID£¬¸ÃÍæ¼Ò²»Ò»¶¨²ÎÓëʵ¼ÊÕ½¶·
|
curIsWin = 0
|
tagPlayerID = 0
|
GameWorld.DebugLog("¾µÏñÕ½¶·½áËã: mapID=%s,funcLineID=%s,winFaction=%s,isLogout=%s" % (mapID, funcLineID, winFaction, isLogout), battleID)
|
|
playerMgr = GameWorld.GetMapCopyPlayerManager()
|
for playerID, faction in battle.playerFactionDict.items():
|
curPlayer = playerMgr.FindPlayerByID(playerID)
|
if not curPlayer:
|
continue
|
realPlayerID = curPlayer.GetRealPlayerID()
|
isWin = (faction == winFaction)
|
GameWorld.DebugLog("Ê£ÓàѪÁ¿: %s/%s,playerID=%s,realPlayerID=%s,faction=%s,isWin=%s"
|
% (GameObj.GetHP(curPlayer), GameObj.GetMaxHP(curPlayer), playerID, realPlayerID, faction, isWin), battleID)
|
if isWin and faction == 1:
|
curIsWin = 1
|
if faction != 1 and not tagPlayerID:
|
tagPlayerID = realPlayerID
|
|
if not curPlayerID:
|
return
|
|
curPlayer = playerMgr.FindPlayerByID(curPlayerID)
|
if not curPlayer:
|
return
|
|
PlayerCrossRealmPK.SendPKOver(curPlayer, tagPlayerID, curIsWin)
|
return
|