#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_CrossChampionship
|
#
|
# @todo:¿ç·þÅÅλÕù°ÔÈü
|
# @author hxp
|
# @date 2022-09-21
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ¿ç·þÅÅλÕù°ÔÈü
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2022-09-21 21:30"""
|
#-------------------------------------------------------------------------------
|
|
import GameWorld
|
import MirrorAttack
|
import IPY_GameWorld
|
import PlayerControl
|
import CrossRealmPlayer
|
import IpyGameDataPY
|
import ShareDefine
|
import FBCommon
|
import GameObj
|
|
|
###´¦Àí¸±±¾ÖÐɱËÀÍæ¼ÒÂß¼
|
def DoFBOnKill_Player(atkobj, defender, tick):
|
GameWorld.DebugLog("¾µÏñÇдè»÷É±Íæ¼Ò: defID=%s" % (defender.GetID()), atkobj.GetID())
|
return True
|
|
def OnMirrorBattleRequest(curPlayer, mapID, funcLineID):
|
## ¾µÏñÕ½¶·ÇëÇó
|
|
playerID = curPlayer.GetPlayerID()
|
if GameWorld.IsCrossServer():
|
return
|
|
if not CrossRealmPlayer.IsCrossServerOpen():
|
PlayerControl.NotifyCode(curPlayer, "CrossMatching18")
|
return
|
|
if curPlayer.GetPlayerAction() == IPY_GameWorld.paDie or GameObj.GetHP(curPlayer) == 0:
|
GameWorld.DebugLog("ÒÑËÀÍö£¬ÎÞ·¨½øÐпç·þÅÅλÈü!", playerID)
|
return
|
|
stateError = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossChampionshipStateError)
|
if stateError:
|
GameWorld.ErrLog("¿ç·þÅÅλ״̬ÒѾÒì³£ÎÞ·¨½øÈë! stateError=%s" % stateError, playerID)
|
return
|
|
state = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_CrossChampionshipState)
|
if state not in ShareDefine.CrossChampionshipEnterStateInfo:
|
GameWorld.ErrLog("µ±Ç°×´Ì¬·Ç¿ç·þÅÅλս¶·×´Ì¬ÎÞ·¨½øÈë: state=%s" % state, playerID)
|
return
|
groupMark = ShareDefine.CrossChampionshipEnterStateInfo[state]
|
reqGroupMark = funcLineID % 100
|
if reqGroupMark != groupMark:
|
GameWorld.ErrLog("µ±Ç°×´Ì¬Óë¿ç·þÅÅλս¶··Ö×é²»Ò»ÖÂÎÞ·¨½øÈë: funcLineID=%s,reqGroupMark=%s != %s" % (funcLineID, reqGroupMark, groupMark), playerID)
|
return
|
|
return True
|
|
def OnMirrorBattleOver(battleID):
|
## ¾µÏñÕ½¶·½áÊø
|
|
battle = MirrorAttack.GetMirrorBattleByID(battleID)
|
if not battle:
|
return
|
mapID = battle.mapID
|
funcLineID = battle.funcLineID
|
isWin = battle.isWin
|
curPlayerID = battle.requestID # ¸±±¾ËùÊôÍæ¼ÒID£¬¸ÃÍæ¼Ò²»Ò»¶¨²ÎÓëʵ¼ÊÕ½¶·
|
tagPlayerID = battle.GetTagPlayerID()
|
fightTickRemain = battle.fightTickRemain
|
curHPPer = 0 # ×Ô¼ºÊ£ÓàѪÁ¿°Ù·Ö±È 0~100£¬Ö§³ÖСÊýµã
|
tagHPPer = 0 # ¶Ô·½Ê£ÓàѪÁ¿°Ù·Ö±È 0~100£¬Ö§³ÖСÊýµã
|
|
curPlayer = None
|
playerMgr = GameWorld.GetMapCopyPlayerManager()
|
for playerID, faction in battle.playerFactionDict.items():
|
player = playerMgr.FindPlayerByID(playerID)
|
if not player:
|
continue
|
realPlayerID = player.GetRealPlayerID()
|
hp = GameObj.GetHP(player)
|
hpMax = GameObj.GetMaxHP(player)
|
hpPer = hp / float(hpMax) * 100
|
GameWorld.DebugLog(" Ê£ÓàѪÁ¿: %s/%s,hpPer=%s%%,playerID=%s,realPlayerID=%s,faction=%s"
|
% (hp, hpMax, hpPer, playerID, realPlayerID, faction), battleID)
|
if not realPlayerID and curPlayerID == playerID:
|
curPlayer = player
|
curHPPer = hpPer
|
if tagPlayerID == realPlayerID:
|
tagHPPer = hpPer
|
|
if not curPlayer:
|
return
|
|
baseScoreList = IpyGameDataPY.GetFuncEvalCfg("CrossChamMirrorPK", 2)
|
baseScore = 0
|
if baseScoreList and len(baseScoreList) == 2:
|
baseScore = baseScoreList[0] if battle.isWin else baseScoreList[1]
|
hpScore = int(eval(IpyGameDataPY.GetFuncCompileCfg("CrossChamMirrorPK", 3)))
|
GameWorld.DebugLog(" hpScore=%s,curHPPer=%s,tagHPPer=%s" % (hpScore, curHPPer, tagHPPer), battleID)
|
remainTimePer = fightTickRemain / float(battle.fightTickMax) * 100 # Ê£ÓàÕ½¶·Ê±¼ä°Ù·Ö±È
|
timeScore = int(eval(IpyGameDataPY.GetFuncCompileCfg("CrossChamMirrorPK", 4)))
|
addScore = baseScore + hpScore + timeScore
|
GameWorld.DebugLog(" timeScore=%s,remainTimePer=%s%%,fightTickRemain=%s,fightTickMax=%s" % (timeScore, remainTimePer, fightTickRemain, battle.fightTickMax), battleID)
|
|
pkCountMax = IpyGameDataPY.GetFuncCfg("CrossChamMirrorPK", 1)
|
playerID = curPlayer.GetPlayerID()
|
dataMsg = {
|
"playerID":playerID,
|
"tagPlayerID":tagPlayerID,
|
"funcLineID":funcLineID,
|
"isWin":isWin,
|
"addScore":addScore,
|
"baseScore":baseScore,
|
"hpScore":hpScore,
|
"timeScore":timeScore,
|
"pkCountMax":pkCountMax,
|
}
|
GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_ChampionshipPKOver, dataMsg)
|
overDict = {"isWin":isWin, "tagPlayerID":tagPlayerID, "addScore":addScore, "baseScore":baseScore, "hpScore":hpScore, "timeScore":timeScore}
|
FBCommon.NotifyFBOver(curPlayer, mapID, funcLineID, isWin, overDict)
|
return
|
|