#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
#-------------------------------------------------------------------------------
|
#
|
##@package GameWorldLogic.FBProcess.GameLogic_FamilyParty
|
#
|
# @todo:Õ½ÃËÊ¢Ñç
|
# @author xdh
|
# @date 2018-04-16
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: Õ½ÃËÊ¢Ñç
|
#
|
#---------------------------------------------------------------------
|
#"""Version = 2018-04-16 17:20"""
|
#---------------------------------------------------------------------
|
import ShareDefine
|
import FBCommon
|
import ChConfig
|
import IPY_GameWorld
|
import PlayerControl
|
import GameWorld
|
import PlayerFamily
|
import IpyGameDataPY
|
import PlayerFeastTravel
|
import PlayerFairyCeremony
|
import PlayerNewFairyCeremony
|
import PlayerActLogin
|
import EventReport
|
import PyGameData
|
import ItemCommon
|
import ItemControler
|
import PlayerActivity
|
import PlayerTongTianLing
|
import ChPyNetSendPack
|
import NetPackCommon
|
|
#---Õ½Ã˸±±¾---
|
FBPlayerDict_TagPlayerID = 'XMYH_TagPlayerID%s' # ÑûÇë´«¹¦Ä¿±êÍæ¼ÒID
|
|
g_familyMapPlayerIDDict = {}#{lineID:[playerID,..]}
|
|
def OnDayFamilyPartyPlayer(curPlayer):
|
GameWorld.DebugLog("ÖØÖÃÏÉÃËÑç»áÏà¹ØÊý¾Ý£¬º¬´«¹¦!", curPlayer.GetPlayerID())
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyJoinSign, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyCollectState, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExp, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalPoint, 0)
|
#´ò×ø
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitExpRound, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExp, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExpPoint, 0)
|
SyncFamilySitInfo(curPlayer)
|
return
|
|
def OnFBPlayerOnLogin(curPlayer):
|
SyncFamilySitInfo(curPlayer)
|
return
|
|
##¿ªÆô¸±±¾
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks ¿ªÆô¸±±¾
|
def OnOpenFB(tick):
|
return
|
|
|
##¹Ø±Õ¸±±¾
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks
|
def OnCloseFB(tick):
|
global g_familyMapPlayerIDDict
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
g_familyMapPlayerIDDict.pop(lineID, None)
|
return
|
|
|
## ÊÇ·ñÄܹ»Í¨¹ý»î¶¯²éѯ½øÈë
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param mapID µØÍ¼ID
|
# @param lineID Ïß·id
|
# @param tick ʱ¼ä´Á
|
# @return ²¼¶ûÖµ
|
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
|
return __CheckEnter(curPlayer, mapID)
|
|
|
##½øÈ븱±¾¼ì²é
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param mapID µØÍ¼ID
|
# @param lineID Ïß·id
|
# @return None
|
def __CheckEnter(curPlayer, mapID):
|
|
# ÊÇ·ñÓÐÕ½ÃË
|
if curPlayer.GetFamilyID() <= 0:
|
GameWorld.DebugLog("ûÓÐÕ½ÃË£¬²»ÄܽøÈëÕ½ÃËboss¸±±¾£¡")
|
return False
|
|
return True
|
|
|
##¸±±¾Íæ¼Ò½øÈëµã
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param mapID µØÍ¼ID
|
# @param lineId ·ÖÏßID
|
# @param ipyEnterPosInfo ¹¦ÄÜÏß·IPYÅäÖÃ×ø±êÐÅÏ¢
|
# @param tick ʱ¼ä´Á
|
# @return posX, posY, Ëæ»ú°ë¾¶(¿ÉÑ¡)
|
def OnGetFBEnterPos(curPlayer, mapID, lineId, ipyEnterPosInfo, tick):
|
return ipyEnterPosInfo
|
|
|
##ÊÇ·ñ¿ÉÒÔ½øÈë
|
# @param ask ÇëÇó½á¹¹Ìå
|
# @param tick ʱ¼ä´Á
|
# @return
|
def OnChangeMapAsk(ask, tick):
|
return IPY_GameWorld.cmeAccept
|
|
|
##Íæ¼Ò½øÈ븱±¾
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks Íæ¼Ò½øÈ븱±¾
|
def DoEnterFB(curPlayer, tick):
|
global g_familyMapPlayerIDDict
|
mapID = GameWorld.GetGameWorld().GetMapID()
|
playerID = curPlayer.GetPlayerID()
|
if not __CheckEnter(curPlayer, mapID):
|
PlayerControl.PlayerLeaveFB(curPlayer)
|
return
|
|
gameWorld = GameWorld.GetGameWorld()
|
partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
|
if partyActionState:
|
remainSeconds = PlayerActivity.GetDailyActionRemainSeconds(ShareDefine.DailyActionID_FamilyParty)
|
__DoEnterJoinFamilyParty(curPlayer, remainSeconds)
|
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
if lineID not in g_familyMapPlayerIDDict:
|
g_familyMapPlayerIDDict[lineID] = []
|
if playerID not in g_familyMapPlayerIDDict[lineID]:
|
g_familyMapPlayerIDDict[lineID].append(playerID)
|
|
playerManager = GameWorld.GetMapCopyPlayerManager()
|
for index in xrange(playerManager.GetPlayerCount()):
|
curPlayer = playerManager.GetPlayerByIndex(index)
|
if not curPlayer:
|
continue
|
DoFBHelp(curPlayer, tick, True)
|
|
return
|
|
def __DoEnterJoinFamilyParty(curPlayer, remainSeconds):
|
## Íæ¼ÒÕýʽ¿ªÊ¼²ÎÓëÏÉÃËÑç»á£¬ÒòΪ¶à¸öÏÉÃ˻¿ÉÄܹ²ÓøõØÍ¼£¬Íæ¼Ò¿ÉÄܻ¿ªÊ¼Ê±ÒѾÔڸõØÍ¼
|
GameWorld.DebugLog("Íæ¼Ò²Î¼ÓÏÉÃËÑç»á!remainSeconds=%s" % remainSeconds, curPlayer.GetPlayerID())
|
if remainSeconds:
|
curPlayer.Sync_TimeTick(IPY_GameWorld.tttTowerTake, 0, remainSeconds * 1000, True)
|
|
if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyJoinSign):
|
return
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyJoinSign, 1)
|
|
#FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_FamilyParty)
|
PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_FamilyParty)
|
PlayerFamily.AddFamilyActivity(curPlayer, ShareDefine.FamilyActive_Party)
|
EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_FamilyParty, 0, ChConfig.CME_Log_Start)
|
PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyParty, 1)
|
PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_FamilyParty, 1)
|
PlayerFeastTravel.AddFeastTravelTaskValue(curPlayer, ChConfig.Def_FeastTravel_FamilyParty, 1)
|
PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_FamilyParty, 1)
|
return
|
|
## ÊÇ·ñ¿ÉÒÔ»ñµÃ¸±±¾µØÍ¼ÇøÓò¾Ñé
|
def OnCanGetAreaExp(curPlayer):
|
gameWorld = GameWorld.GetGameWorld()
|
partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
|
return partyActionState
|
|
##¸±±¾¶¨Ê±Æ÷
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
# @remarks ¸±±¾¶¨Ê±Æ÷
|
def OnProcess(tick):
|
familyID = GameWorld.GetGameWorld().GetPropertyID()
|
if not familyID:
|
return
|
|
gameWorld = GameWorld.GetGameWorld()
|
sitActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilySit)
|
partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
|
|
if sitActionState:
|
Process_SitAction(tick)
|
|
# ÓÉÓÚÑç»á²»ÐèÒª¶îÍâ´¦Àí£¬Ö»ÐèҪͬ²½Help£¬ËùÒÔÈç¹û´ò×ø½øÐÐÖУ¬¾Í²»ÐèÒªÔÙÖØ¸´´¦ÀíÑç»áͬ²½
|
elif partyActionState:
|
FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
|
|
return
|
|
def Process_SitAction(tick):
|
key = "SitActionProcessTick"
|
interval, expRoundMax = IpyGameDataPY.GetFuncEvalCfg("FamilySit", 1)
|
gameFB = GameWorld.GetGameFB()
|
lastTick = gameFB.GetGameFBDictByKey(key)
|
if tick - lastTick < interval * 1000:
|
return
|
gameFB.SetGameFBDict(key, tick)
|
|
worldlv = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
|
playerManager = GameWorld.GetMapCopyPlayerManager()
|
playerCount = playerManager.GetPlayerCount()
|
# ÿÔö¼ÓÒ»ÃûÏÉÃ˳ÉÔ±¼Ó³É¾Ñé°Ù·Ö±È|×î¸ß¼Ó³É°Ù·Ö±È£¬Á½¸öÈË¿ªÊ¼Ëã¼Ó³É
|
perPlayerExpRateAdd, expRateAddMax = IpyGameDataPY.GetFuncEvalCfg("FamilySit", 3)
|
expRateEx = min(expRateAddMax, (playerCount - 1) * perPlayerExpRateAdd) if playerCount > 1 else 0
|
|
for index in xrange(playerManager.GetPlayerCount()):
|
curPlayer = playerManager.GetPlayerByIndex(index)
|
if not curPlayer:
|
continue
|
|
expRound = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitExpRound)
|
if expRound < expRoundMax:
|
expRound += 1
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitExpRound, expRound)
|
|
# ¸ø¾Ñé
|
reLV = curPlayer.GetLV()
|
reExp = PlayerControl.GetPlayerReExp(curPlayer)
|
giveExp = eval(IpyGameDataPY.GetFuncCompileCfg("FamilySit", 2))
|
finalAddExp = PlayerControl.PlayerControl(curPlayer).AddExp(giveExp, ShareDefine.Def_ViewExpType_Sit, expRateEx=expRateEx)
|
|
exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExp)
|
expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExpPoint)
|
newTotalExp = expPoint * ChConfig.Def_PerPointValue + exp + finalAddExp
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExp, newTotalExp % ChConfig.Def_PerPointValue)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilySitTotalExpPoint, newTotalExp / ChConfig.Def_PerPointValue)
|
|
#GameWorld.DebugLog("´ò×ø¾Ñé: expRound=%s,reLV=%s,reExp=%s,giveExp=%s,expRateEx=%s,finalAddExp=%s"
|
# % (expRound, reLV, reExp, giveExp, expRateEx, finalAddExp), curPlayer.GetPlayerID())
|
|
DoFBHelp(curPlayer, tick)
|
|
return
|
|
def FamilyPartyAnswerRight(curPlayer, answerInfo):
|
#»Ø´ðÕýÈ·£¬¸ø½±Àø
|
|
rightPlayerID = answerInfo[0]
|
|
#¸ø±¾Ìâ´ðÌâ½±Àø£¬±¾µØÍ¼ÖеļÒ×å³ÉÔ±²Å¸ø
|
answerRWItemReward = IpyGameDataPY.GetFuncEvalCfg('PartyReward2', 1)
|
rightItemID, wrongItemID = answerRWItemReward
|
playerManager = GameWorld.GetMapCopyPlayerManager()
|
for index in xrange(playerManager.GetPlayerCount()):
|
player = playerManager.GetPlayerByIndex(index)
|
if not player:
|
continue
|
if player.GetFamilyID() != curPlayer.GetFamilyID():
|
continue
|
if player.GetPlayerID() == rightPlayerID:
|
giveItemID = rightItemID
|
else:
|
giveItemID = wrongItemID
|
itemCount, isAuctionItem = 1, False
|
ItemControler.GivePlayerItem(player, giveItemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
|
|
if curPlayer.GetPlayerID() != rightPlayerID:
|
return
|
|
addPoint, addExp = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 2)
|
#ÏÉÃ˹±Ï×¶È
|
PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty, True)
|
#´ðÌâ¾Ñé¸üÐÂ
|
PlayerControl.PlayerControl(curPlayer).AddExp(addExp, ShareDefine.Def_ViewExpType_SysEx)
|
PlayerControl.FamilyNotify(curPlayer.GetFamilyID(), 'Party_Answer', [curPlayer.GetName(), rightItemID])
|
curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt, curAnswerCnt + 1)
|
PlayerTongTianLing.AddTongTianTaskValue(curPlayer, ChConfig.TTLTaskType_FamilyPartyAnswerRight, 1)
|
|
if GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_FamilyParty:
|
DoFBHelp(curPlayer, 0)
|
return
|
|
|
def OnFamilyPartyStateChange(state, tick):
|
#»î¶¯×´Ì¬±ä¸ü
|
mapID = GameWorld.GetMap().GetMapID()
|
if mapID != ChConfig.Def_FBMapID_FamilyParty:
|
return
|
|
GameWorld.DebugLog('ÏÉÃËÑç»á»î¶¯×´Ì¬±ä¸ü state=%s' % state)
|
if state == 1:
|
remainSeconds = PlayerActivity.GetDailyActionRemainSeconds(ShareDefine.DailyActionID_FamilyParty)
|
playerManager = GameWorld.GetPlayerManager()
|
for i in xrange(playerManager.GetPlayerCount()):
|
curPlayer = playerManager.GetPlayerByIndex(i)
|
if not curPlayer or curPlayer.IsEmpty():
|
continue
|
__DoEnterJoinFamilyParty(curPlayer, remainSeconds)
|
else:
|
PyGameData.g_familyPartyInfo = []
|
|
return
|
|
|
##Íæ¼ÒÍ˳ö¼Ò×å´¦Àí
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ·µ»ØÖµÎÞÒâÒå
|
def OnLeaveFamily(curPlayer, tick):
|
#GameWorld.DebugLog("OnLeaveFamily...")
|
PlayerControl.PlayerLeaveFB(curPlayer)
|
return
|
|
|
##»ñµÃ¸±±¾°ïÖúÐÅÏ¢
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks ÓÃÓÚ֪ͨÕóÓª±È·ÖÌõ
|
def DoFBHelp(curPlayer, tick, isSyncPlayerID=False):
|
gameWorld = GameWorld.GetGameWorld()
|
partyActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
|
|
playerID = curPlayer.GetPlayerID()
|
curAnswerCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyAnswerCnt)
|
addPoint, addExp = IpyGameDataPY.GetFuncEvalCfg('PartyReward', 2)
|
exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExp)
|
expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint)
|
totalExp = expPoint * ChConfig.Def_PerPointValue + exp + addExp * curAnswerCnt
|
exp = totalExp % ChConfig.Def_PerPointValue
|
expPoint = totalExp / ChConfig.Def_PerPointValue
|
|
totalPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalPoint)
|
#totalPoint += IpyGameDataPY.GetFuncCfg('PartyReward') #¼Ó²ÎÓë½±
|
totalPoint += addPoint * curAnswerCnt
|
hasCollect = int(curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyCollectState) or not partyActionState) # ·Ç»î¶¯ÆÚ¼äҲͬ²½ÒѲɼ¯£¬Ç°¶Ë¸ù¾Ý´Ë״̬¿ØÖư´Å¥ÏÔÒþ
|
|
helpDict = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, FBCommon.Help_score:totalPoint, "hasCollect":hasCollect}
|
if PyGameData.g_familyPartyInfo:
|
rankList = []
|
for i, info in enumerate(PyGameData.g_familyPartyInfo[0], 1):
|
rankList.append({"rank":i, "name":info[1], "cnt":info[2]})
|
helpDict['familyPartyRank'] = rankList
|
helpDict['familyPartyTop'] = {'name':PyGameData.g_familyPartyInfo[1], "cnt":PyGameData.g_familyPartyInfo[2]}
|
if isSyncPlayerID:
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
helpDict['familyPartyPlayer'] = g_familyMapPlayerIDDict.get(lineID, [])
|
|
# ´ò×ø
|
sitActionState = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilySit)
|
if sitActionState:
|
exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExp)
|
expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExpPoint)
|
expRound = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitExpRound)
|
playerCount = GameWorld.GetMapCopyPlayerManager().GetPlayerCount()
|
sitInfo = {FBCommon.Help_exp:exp, FBCommon.Help_expPoint:expPoint, "expRound":expRound, "playerCount":playerCount}
|
helpDict["sitInfo"] = sitInfo
|
|
GameWorld.DebugLog("DoFBHelp %s" % helpDict, playerID)
|
FBCommon.Notify_FBHelp(curPlayer, helpDict)
|
return
|
|
|
##ÊÇ·ñ¿ÉÒԲɼ¯
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param curNPC NPCʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks
|
def OnCanCollect(curPlayer, curNPC, tick):
|
partyActionState = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyParty)
|
if not partyActionState:
|
PlayerControl.NotifyCode(curPlayer, 'Party_NotInPartyTime')
|
return
|
hasCollect = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyCollectState)
|
if hasCollect:
|
PlayerControl.NotifyCode(curPlayer, 'Party_HadCollected')
|
return
|
needSpace = len(IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3))
|
packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
if needSpace > packSpace:
|
PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
return
|
return True
|
|
|
##¸±±¾ÖÐ,²É¼¯ÎïÐèÒªLoadingʱ¼ä.
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param curNPC NPCʵÀý
|
# @return ·µ»ØÖµ, Loadingʱ¼ä
|
# @remarks ¸±±¾ÖÐ,²É¼¯ÎïÐèÒªLoadingʱ¼ä
|
def GetFBPrepareTime(curPlayer, curNPC):
|
return IpyGameDataPY.GetFuncCfg('FamilyPartyDesk', 2) * 1000
|
|
|
##Íæ¼ÒÊÕ¼¯³É¹¦(Ëþ, Æì)
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
# @remarks
|
def OnCollectOK(curPlayer, npcID, tick):
|
playerID = curPlayer.GetID()
|
#gameWorld = GameWorld.GetGameWorld()
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyCollectState, 1)
|
|
GameWorld.DebugLog(' Ñç»á²É¼¯³É¹¦£¡', playerID)
|
#¸ø½±Àø
|
itemAward = IpyGameDataPY.GetFuncEvalCfg('FamilyPartyDesk', 3)
|
for itemID, itemCount, isBind in itemAward:
|
ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
|
addPoint = IpyGameDataPY.GetFuncCfg('FamilyPartyDesk')
|
PlayerControl.NotifyCode(curPlayer, 'Party_CollectSuccess', [addPoint])
|
PlayerFamily.AddPlayerFamilyActiveValue(curPlayer, addPoint, True, ShareDefine.Def_AddFAVReason_FamilyParty)
|
|
totalPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalPoint)
|
updPoint = totalPoint + addPoint
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalPoint, updPoint)
|
DoFBHelp(curPlayer, 0)
|
return
|
|
## »ñµÃ¾Ñé
|
# @param curPlayer µ±Ç°Íæ¼Ò
|
# @param addExp »ñµÃµÄ¾Ñé
|
# @param expViewType ¾ÑéÀàÐÍ
|
# @return True or False
|
def OnGetExp(curPlayer, addExp, expViewType):
|
|
if expViewType != ShareDefine.Def_ViewExpType_SysEx:
|
return
|
exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExp)
|
expPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint)
|
newTotalExp = expPoint * ChConfig.Def_PerPointValue + exp + addExp
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExp, newTotalExp % ChConfig.Def_PerPointValue)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyPartyTotalExpPoint, newTotalExp / ChConfig.Def_PerPointValue)
|
return
|
|
##Íæ¼ÒÍ˳ö¸±±¾
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @param tick ʱ¼ä´Á
|
# @return ÎÞÒâÒå
|
def DoExitFB(curPlayer, tick):
|
global g_familyMapPlayerIDDict
|
SyncFamilySitInfo(curPlayer)
|
lineID = GameWorld.GetGameWorld().GetLineID()
|
playerID = curPlayer.GetID()
|
if playerID in g_familyMapPlayerIDDict.get(lineID, []):
|
g_familyMapPlayerIDDict[lineID].remove(playerID)
|
if g_familyMapPlayerIDDict[lineID]:
|
playerManager = GameWorld.GetMapCopyPlayerManager()
|
for index in xrange(playerManager.GetPlayerCount()):
|
curPlayer = playerManager.GetPlayerByIndex(index)
|
if not curPlayer:
|
continue
|
DoFBHelp(curPlayer, tick, True)
|
return
|
|
## ¸±±¾ÐÐΪ
|
# @param curPlayer Íæ¼Ò
|
# @param actionType ÐÐΪÀàÐÍ
|
# @param actionInfo ÐÐΪÐÅÏ¢
|
# @param tick µ±Ç°Ê±¼ä
|
# @return None
|
def DoFBAction(curPlayer, actionType, actionInfo, tick):
|
return
|
|
def DoAddFamilyMemberFamilyActivity(familyID, addFamilyActivity):
|
playerManager = GameWorld.GetPlayerManager()
|
for index in xrange(playerManager.GetPlayerCount()):
|
curPlayer = playerManager.GetPlayerByIndex(index)
|
if not curPlayer:
|
continue
|
if curPlayer.GetFamilyID() != familyID:
|
continue
|
PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_FamilyActivity, addFamilyActivity)
|
GameWorld.DebugLog("Ôö¼Ó±¾ÏÉÃ˳ÉÔ±´ðÌâ»îÔ¾Áî, playerID=%s,addFamilyActivity=%s" % (curPlayer.GetPlayerID(), addFamilyActivity))
|
return
|
|
def SyncFamilySitInfo(curPlayer):
|
clientPack = ChPyNetSendPack.tagMCFamilySitInfo()
|
clientPack.Clear()
|
clientPack.ExpRound = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitExpRound)
|
clientPack.Exp = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExp)
|
clientPack.ExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilySitTotalExpPoint)
|
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
return
|
|