#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package Player.PlayerBillboard
|
#
|
# @todo:ÅÅÐаñ
|
# @author hxp
|
# @date 2018-03-06
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÅÅÐаñ
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2018-03-06 11:00"""
|
#-------------------------------------------------------------------------------
|
|
import ShareDefine
|
import GameWorld
|
import ChConfig
|
import PlayerControl
|
import OpenServerCampaign
|
import GameFuncComm
|
import EventReport
|
|
def DoBillboardOpen(curPlayer):
|
## ÅÅÐаñ¿ªÆôʱÐèÒª´¦ÀíµÄ
|
UpdatePlayerBillboardOnLeaveServer(curPlayer, True) # Ö÷¶¯Í¬²½Ò»´Î°ñµ¥
|
OpenServerCampaign.DoBillboardOpen(curPlayer) # ͬ²½¿ª·þ»î¶¯°ñµ¥
|
return
|
|
def GetBillboardOperateInfo(curPlayer):
|
# ÅÅÐаñÖÐËù±£´æµÄÔËÓªÉÌÏà¹ØÐÅÏ¢
|
platform = curPlayer.GetAccID()
|
if platform in ["tencent"]:
|
return curPlayer.GetOperateInfo()
|
return platform
|
|
def GetBillboardJob(curPlayer): return curPlayer.GetJob()
|
|
def UpdatePlayerBillboardOnLeaveServer(curPlayer, isAll=False):
|
##ÏÂÏ߸üÐÂÍæ¼ÒÅÅÐаñ
|
#UpdateTotalRechargeBillboard(curPlayer)
|
|
UpdatePlayerLVBillboard(curPlayer) # µÈ¼¶°ñ
|
UpdatePlayerFPTotalBillboard(curPlayer, True) # Õ½¶·Á¦°ñ
|
UpdateHorseBillboard(curPlayer, True, False) # ×øÆï°ñ
|
UpdatePyPetBillboard(curPlayer, True, False) # Áé³è°ñ
|
UpdateRealmBillboard(curPlayer) # ¾³½ç°ñ
|
|
if isAll:
|
UpdateRuneTowerBillboard(curPlayer)
|
|
#UpdateTJGBillboard(curPlayer, minuteExp) ÍÑ»úЧÂʿɲ»¸üÐÂ
|
|
return
|
|
def __CanPlayerBillboardComm(curPlayer):
|
## Íæ¼Ò¿É·ñÉϰñͨÓüì²é
|
if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Billboard):
|
GameWorld.DebugLog("ÅÅÐаñ먦Æô,ÎÞ·¨Éϰñ!curLV=%s" % (curPlayer.GetLV()), curPlayer.GetPlayerID())
|
return False
|
|
return True
|
|
def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, exInfo=[]):
|
## ¸üÐÂÍæ¼ÒÅÅÐаñ
|
|
#if not cmpValue and not cmpValue2 and not cmpValue3:
|
# return
|
|
if not __CanPlayerBillboardComm(curPlayer):
|
return
|
|
playerJob = GetBillboardJob(curPlayer)
|
playerID = curPlayer.GetID()
|
playerName = curPlayer.GetName()
|
playerOpInfo = GetBillboardOperateInfo(curPlayer)
|
if bType in ShareDefine.BTValue1_OfficialRankList:
|
value1 = curPlayer.GetOfficialRank()
|
GameServer_UpdateBillboard(bType, playerJob, playerID, playerName, playerOpInfo,
|
value1, value2, cmpValue, cmpValue2, cmpValue3, 0, exInfo)
|
return
|
|
def GameServer_UpdateBillboard(bType, bType2, bID, bName, bName2, value1, value2, cmpValue, cmpValue2=0, cmpValue3=0, bID2=0, exInfo=[]):
|
sendMsg = "%s" % ({"Type":bType, "Type2":bType2, "ID":bID, "ID2":bID2, "Name1":bName, "Name2":bName2, "ExInfo":exInfo,
|
"Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3})
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "UpdateBillboard", sendMsg, len(sendMsg))
|
GameWorld.DebugLog("ͬ²½GameServerÅÅÐаñ:bType=%s,%s" % (bType, sendMsg))
|
return
|
|
def UpdatePlayerFPTotalBillboard(curPlayer, isForceUpdate=False, isCheckRule=True):
|
##¸üÐÂÍæ¼Ò×ÜÕ½¶·Á¦
|
|
playerFightPower = curPlayer.GetFightPower()
|
if not __CheckFightPowerCanUpdate(curPlayer, ChConfig.Def_PDict_FightPower_Total, playerFightPower, isForceUpdate, isCheckRule):
|
return
|
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_Total, playerFightPower,
|
ChConfig.Def_PDictType_FightPower)
|
familyID = curPlayer.GetFamilyID()
|
GameWorld.DebugLog("¸üÐÂ×ÜÕ½¶·Á¦£ºplayerFightPower=%s" % (playerFightPower), curPlayer.GetPlayerID())
|
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FightPower, playerFightPower, exInfo=[familyID])
|
EventReport.WriteEvent_FightPower(curPlayer)
|
return
|
|
def __CheckFightPowerCanUpdate(curPlayer, key, fightPower, isForceUpdate=False, isCheckRule=True):
|
''' ¼ì²éÍæ¼Ò¿É·ñ¸üÐÂÕ½¶·Á¦
|
@param curPlayer Íæ¼ÒʵÀý
|
@param key Õ½¶·Á¦ÀàÐͶÔÓ¦key
|
@param fightPower µ±Ç°Õ½¶·Á¦
|
@param isForceUpdate ÊÇ·ñÇ¿ÖÆ¸üУ¨ÈôÉèÖÃÇ¿ÖÆ¸üУ¬ÔÚijЩDZ¹æÔòÏÂÒ²²»Ò»¶¨ÄÜÇ¿ÖÆ¸üУ¬ÈçGMµÈ£©
|
@param isCheckRule ÊÇ·ñ¼ì²éÕ½Á¦·¶Î§¸üвîÖµ
|
@return True-¿É¸üÐÂ
|
'''
|
if fightPower <= 0:
|
return False
|
|
historyFightPower = curPlayer.NomalDictGetProperty(key, 0, ChConfig.Def_PDictType_FightPower)
|
|
if not __CanPlayerBillboardComm(curPlayer):
|
return False
|
|
if isForceUpdate:
|
GameWorld.DebugLog("Õ½¶·Á¦¸üмì²é£ºÇ¿ÖƸüРkey=%s,fightPower=%s,history=%s"
|
% (key, fightPower, historyFightPower), curPlayer.GetPlayerID())
|
return True
|
|
if fightPower == historyFightPower:
|
GameWorld.DebugLog("Õ½¶·Á¦¸üмì²é£ºÓëÉÏ´ÎÏàͬ£¬Ä¬Èϲ»¸üРkey=%s,fightPower=%s,history=%s"
|
% (key, fightPower, historyFightPower), curPlayer.GetPlayerID())
|
return False
|
|
return True
|
|
def __GetUpdFightPower(curPlayer, key, fightPower):
|
##»ñÈ¡¸üÐÂÅÅÐаñµÄÕ½Á¦
|
#Ôݶ¨¸üÐÂʵ¼ÊÕ½Á¦
|
PlayerControl.NomalDictSetProperty(curPlayer, key, fightPower, ChConfig.Def_PDictType_FightPower)
|
return fightPower
|
|
def UpdateHorseBillboard(curPlayer, isForceUpdate=False, isUpdateTotal=True):
|
##¸üÐÂÍæ¼Ò×øÆïÅÅÐаñ
|
|
HorseFightPower = PlayerControl.GetMFPFightPower(curPlayer, ShareDefine.Def_MFPType_Horse)
|
if not __CheckFightPowerCanUpdate(curPlayer, ChConfig.Def_PDict_FightPower_Horse,
|
HorseFightPower, isForceUpdate):
|
return
|
|
HorseFightPower = __GetUpdFightPower(curPlayer, ChConfig.Def_PDict_FightPower_Horse, HorseFightPower)
|
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FightPower_Horse, HorseFightPower)
|
|
if isUpdateTotal:
|
UpdatePlayerFPTotalBillboard(curPlayer, isForceUpdate)
|
return
|
|
def UpdatePyPetBillboard(curPlayer, isForceUpdate=False, isUpdateTotal=True):
|
## ¸üгèÎïÅÅÐаñ
|
petMaxAtk = PlayerControl.GetPetMaxAtk(curPlayer)
|
if not petMaxAtk:
|
return
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FightPower_Pet, petMaxAtk)
|
|
if isUpdateTotal:
|
UpdatePlayerFPTotalBillboard(curPlayer, isForceUpdate)
|
return
|
|
def UpdatePlayerLVBillboard(curPlayer, isForceUpdate=True):
|
##¸üÐÂÍæ¼ÒµÈ¼¶ÅÅÐаñ
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_LV, curPlayer.GetLV())
|
return
|
|
def UpdateRuneTowerBillboard(curPlayer):
|
##¸üÐÂÍæ¼Ò·ûÓ¡ËþÅÅÐаñ
|
passLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV)
|
if not passLV:
|
return
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_TrialTower, passLV)
|
return
|
|
|
def UpdateTJGBillboard(curPlayer, minuteExp):
|
##ÍÑ»úЧÂʰñ
|
if not minuteExp:
|
return
|
expPoint = minuteExp / ChConfig.Def_PerPointValue
|
exp = minuteExp % ChConfig.Def_PerPointValue
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_OffLineEfficient, expPoint, exp)
|
return
|
|
def UpdateRealmBillboard(curPlayer):
|
##¾³½ç°ñ
|
if not curPlayer.GetOfficialRank():
|
return
|
UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Realm, curPlayer.GetOfficialRank())
|
return
|
|
|
###################################### ÒÔÏ´úÂëÔÝʱûÓã¬ÐÞ¸ÄʱÔÙÕûºÏ ################################################
|
|
##Íæ¼ÒµÇ¼ÅÅÐд¦Àí
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @return
|
def BillboardOnLogin(curPlayer):
|
# ÉÏÏßĬÈÏͬ²½ÅÅÐаñ
|
UpdatePlayerBillboardOnLeaveServer(curPlayer) #ÅÅÐаñÒÑʵʱ¸üУ¬¹ÊÉÏÏß²»ÔÙͬ²½
|
return
|
|
## ¸üе±Ç°ïÚ³µÐÅÏ¢
|
# @param playerID: Íæ¼ÒID
|
# @param playerName: Íæ¼ÒÃû×Ö
|
# @param playerOpInfo: Íæ¼Òƽ̨ÐÅÏ¢
|
# @param playerLV: Íæ¼ÒµÈ¼¶
|
# @param truckLV: ïÚ³µµÈ¼¶
|
# @param truckMapID: ïÚ³µËùÔÚµØÍ¼ID
|
# @return:
|
def UpdateBillboardPlayerTruck(playerID, playerName, playerOpInfo, playerLV, truckLV, truckMapID):
|
|
#µ±truckMapIDΪ0ʱ±íʾÔÚÅÅÐÐÔÚɾ³ý¸ÃïÚ³µµÄ¼Ç¼
|
|
#[Íæ¼ÒID, Íæ¼ÒÃû×Ö, Íæ¼ÒµÈ¼¶, ïÚ³µµÈ¼¶, ïÚ³µÎ»ÖÃ]
|
cmdList = [playerID, playerName, playerOpInfo, playerLV, truckLV, truckMapID]
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "UpdateBillboardPlayerTruck",
|
'%s' % (cmdList), len(str(cmdList)))
|
return
|
|
##¸üÐÂÍæ¼Ò³äÖµÅÅÐаñ
|
# @param curPlayer Íæ¼ÒʵÀý
|
# @return ÈÎÎñʵÀý
|
# @remarks
|
def UpdateTotalRechargeBillboard(curPlayer):
|
# if GameWorld.IsGM(curPlayer):
|
# #GM²»Éϰñ
|
# return
|
totalChangeCoinPoint = curPlayer.GetChangeCoinPointTotal()
|
|
#ÅÅÐаñÐèÒªÊý¾Ý[Íæ¼ÒID, Íæ¼ÒÃû×Ö, Íæ¼ÒÖ°Òµ, Íæ¼ÒµÈ¼¶]
|
playerID = curPlayer.GetID()
|
playerName = curPlayer.GetName()
|
playerOpInfo = curPlayer.GetOperateInfo()
|
playerJob = curPlayer.GetJob()
|
playerLV = curPlayer.GetLV()
|
|
sendMsg = '%s' % ([playerID, playerName, playerOpInfo, playerJob, playerLV, totalChangeCoinPoint])
|
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'UpdateTotalRechargeBillboard', \
|
sendMsg, len(sendMsg))
|
return
|
|