hxp
2024-12-26 22c964784d465c77365c2495f6d43117618d8482
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
#!/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