#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package Player.PlayerCrossYaomoBoss
|
#
|
# @todo:¿ç·þÑýħboss
|
# @author hxp
|
# @date 2022-11-11
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ¿ç·þÑýħboss
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2022-11-11 15:30"""
|
#-------------------------------------------------------------------------------
|
|
import GameWorld
|
import NPCHurtMgr
|
import PlayerControl
|
import IpyGameDataPY
|
import ItemControler
|
import IPY_GameWorld
|
import ShareDefine
|
import ItemCommon
|
import ChConfig
|
import PlayerGubao
|
|
def OnYaomoBossStateChange(state, tick):
|
## »î¶¯×´Ì¬±ä¸ü
|
if state:
|
# ¿ªÊ¼µÄ²»ÐèÒª´¦Àí
|
return
|
return
|
|
def OnCrossYaomoBossDead(curNPC):
|
|
objID = curNPC.GetID()
|
npcID = curNPC.GetNPCID()
|
mapID = GameWorld.GetGameWorld().GetMapID()
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
realMapID = GameWorld.GetGameWorld().GetRealMapID()
|
copyMapID = GameWorld.GetGameWorld().GetCopyMapID()
|
|
zoneID = 0
|
zoneTypeName = ChConfig.Def_CrossZoneMapTableName.get(mapID)
|
ipyDataMgr = IpyGameDataPY.IPY_Data()
|
if zoneTypeName and hasattr(ipyDataMgr, "Get%sCount" % zoneTypeName):
|
for index in range(getattr(ipyDataMgr, "Get%sCount" % zoneTypeName)()):
|
ipyData = getattr(ipyDataMgr, "Get%sByIndex" % zoneTypeName)(index)
|
if realMapID == ipyData.GetMapID() and copyMapID == ipyData.GetCopyMapID():
|
zoneID = ipyData.GetZoneID()
|
break
|
|
npcHurtList = NPCHurtMgr.GetPlayerHurtList(curNPC)
|
if not npcHurtList or not npcHurtList.GetHurtCount():
|
GameWorld.ErrLog("¿ç·þÑýħboss½áËãÎÞÉ˺¦Áбí: mapID=%s,lineID=%s,realMapID=%s,copyMapID=%s,zoneID=%s,npcID=%s,objID=%s"
|
% (mapID, lineID, realMapID, copyMapID, zoneID, npcID, objID))
|
return
|
|
GameWorld.Log("¿ç·þÑýħbossÉ˺¦½áËã: mapID=%s,lineID=%s,realMapID=%s,copyMapID=%s,zoneID=%s,npcID=%s,objID=%s"
|
% (mapID, lineID, realMapID, copyMapID, zoneID, npcID, objID))
|
npcHurtList.Sort() #sortÒÔºóÉËѪÁбí´Ó´óµ½Ð¡ÅÅÐò
|
|
rank = 0
|
playerHurtList = []
|
for index in xrange(npcHurtList.GetHurtCount()):
|
#»ñµÃÉËѪ¶ÔÏó
|
hurtObj = npcHurtList.GetHurtAt(index)
|
hurtType = hurtObj.GetValueType()
|
hurtID = hurtObj.GetValueID()
|
hurtValue = hurtObj.GetHurtValue()
|
hurtName = hurtObj.GetHurtName()
|
if hurtType != ChConfig.Def_NPCHurtTypePlayer or not hurtID:
|
continue
|
rank += 1
|
playerID = hurtID
|
GameWorld.Log(" zoneID=%s,rank=%s,playerID=%s,hurtValue=%s" % (zoneID, rank, playerID, hurtValue))
|
playerHurtList.append([playerID, hurtValue, hurtName])
|
|
msgInfo = str([zoneID, npcID, playerHurtList])
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "CrossYaomoBossHurtInfo", msgInfo, len(msgInfo))
|
return
|
|
def GetCrossYaomoBossHurtAward(curPlayer, awardIndex, tick):
|
|
playerID = curPlayer.GetPlayerID()
|
if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem, True):
|
return
|
|
if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_CrossYaomoBoss, tick):
|
PlayerControl.NotifyCode(curPlayer, "RequestLater")
|
return
|
|
# ·¢ËÍ¿ç·þ·þÎñÆ÷
|
dataMsg = {"playerID":playerID, "awardIndex":awardIndex}
|
GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_CrossYaomoBossHurtAward, dataMsg)
|
return
|
|
def GameServer_CrossYaomoBoss_DoResult(curPlayer, msgData):
|
msgType, dataMsg = msgData[:2]
|
#ret = msgData[2] if len(msgData) > 2 else None
|
|
## É˺¦Ä¿±ê½±Àø
|
if msgType == "HurtValueAward":
|
__DoGiveCrossYaomoBossHurtAward(curPlayer, dataMsg)
|
|
## ²ÎÓë»÷ɱÑýħboss
|
if msgType == "KillYaomoBoss":
|
PlayerGubao.AddGubaoItemEffValue(curPlayer, PlayerGubao.GubaoEffType_CrossYaomoBoss, 1)
|
|
return
|
|
def __DoGiveCrossYaomoBossHurtAward(curPlayer, dataMsg):
|
playerID = curPlayer.GetPlayerID()
|
awardIndex, awardItemList = dataMsg
|
GameWorld.Log("¸øÍæ¼Ò¿ç·þÑýħbossÉ˺¦Ä¿±ê½±Àø: awardIndex=%s,awardItemList=%s" % (awardIndex, awardItemList), playerID)
|
ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["CrossYaomoBoss", False, {}])
|
return
|