#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#-------------------------------------------------------------------------------
|
#
|
##@package Player.PlayerLLMJ
|
#
|
# @todo:ÀúÁ·ÃØóÅ
|
# @author hxp
|
# @date 2025-10-20
|
# @version 1.0
|
#
|
# ÏêϸÃèÊö: ÀúÁ·ÃØóÅ
|
#
|
#-------------------------------------------------------------------------------
|
#"""Version = 2025-10-20 15:00"""
|
#-------------------------------------------------------------------------------
|
|
import ChConfig
|
import NetPackCommon
|
import IpyGameDataPY
|
import ChPyNetSendPack
|
import PlayerControl
|
import GameWorld
|
import ObjPool
|
|
def OnPlayerLogin(curPlayer):
|
if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJLVInfo):
|
return
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def PlayerOnDay(curPlayer):
|
if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJLVInfo):
|
return
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LLMJExp, 0)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LLMJDecompose, 0)
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def SetMJLVInfo(curPlayer, mjLV, zhanchui):
|
lvInfo = zhanchui * 100 + min(mjLV, 99)
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LLMJLVInfo, lvInfo)
|
return
|
def GetMJLVInfo(curPlayer):
|
lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJLVInfo)
|
mjLV = lvInfo % 100
|
zhanchui = lvInfo / 100
|
return mjLV, zhanchui
|
|
def OnActiviteByCTGID(curPlayer, ctgID):
|
if ctgID != IpyGameDataPY.GetFuncCfg("LLMJ", 1):
|
return
|
if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJLVInfo):
|
# ·À·¶Öظ´¼¤»î
|
return
|
GameWorld.DebugLog("¼¤»îÀúÁ·ÃØóÅ")
|
SetMJLVInfo(curPlayer, 1, 0)
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def AddUseZhanchui(curPlayer, addCnt):
|
mjLV, zhanchui = GetMJLVInfo(curPlayer)
|
if not mjLV:
|
return
|
maxIpyData = IpyGameDataPY.IPY_Data().GetLLMJByIndex(-1) # ×î¶àÀÛ¼Óµ½×îºóÒ»¼¶
|
if not maxIpyData:
|
return
|
maxZhanchui = maxIpyData.GetCostWarhammer()
|
if zhanchui >= maxZhanchui:
|
#GameWorld.DebugLog("ÀúÁ·ÃØóÅÀÛ¼ÓÕ½´¸ÒÑ´ïÉÏÏÞ: mjLV=%s,zhanchui=%s >= %s" % (mjLV, zhanchui, maxZhanchui))
|
return
|
updZhanchui = min(zhanchui + addCnt, maxZhanchui)
|
GameWorld.DebugLog("ÀÛ¼ÓÀúÁ·ÃØóÅÕ½´¸: mjLV=%s,addCnt=%s,updZhanchui=%s,maxZhanchui=%s" % (mjLV, addCnt, updZhanchui, maxZhanchui))
|
SetMJLVInfo(curPlayer, mjLV, updZhanchui)
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def OnLLMJLVUp(curPlayer):
|
## ÃØóÅÉý¼¶
|
mjLV, zhanchui = GetMJLVInfo(curPlayer)
|
if not mjLV:
|
return
|
nextIpyData = IpyGameDataPY.GetIpyGameData("LLMJ", mjLV + 1)
|
if not nextIpyData:
|
return
|
nextZhanchui = nextIpyData.GetCostWarhammer()
|
while nextIpyData and zhanchui >= nextZhanchui:
|
mjLV += 1 # Éý¼¶
|
nextIpyData = IpyGameDataPY.GetIpyGameDataNotLog("LLMJ", mjLV + 1)
|
nextZhanchui = nextIpyData.GetCostWarhammer() if nextIpyData else 0
|
GameWorld.DebugLog("ÀúÁ·ÃØóÅÉý¼¶: %s,nextZhanchui=%s" % (mjLV, nextZhanchui))
|
SetMJLVInfo(curPlayer, mjLV, zhanchui)
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def GetAddExpPerInfo(curPlayer):
|
## »ñÈ¡¶îÍâ¾Ñé±ÈÀýÐÅÏ¢
|
# @return: ¶îÍâ±ÈÀý, Ê£Óà¶îÍâ¿ÉÔö¼Ó¾Ñé
|
mjLV, _ = GetMJLVInfo(curPlayer)
|
if not mjLV:
|
return 0, 0
|
ipyData = IpyGameDataPY.GetIpyGameData("LLMJ", mjLV)
|
if not ipyData:
|
return 0, 0
|
exPer = ipyData.GetExpAddPer()
|
exUpper = ipyData.GetExpExUpper()
|
exNow = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJExp)
|
exRemain = max(0, exUpper - exNow)
|
return exPer, exRemain
|
|
def GetAddDecomposePer(curPlayer):
|
## »ñÈ¡¶îÍâ·Ö½â±ÈÀýÐÅÏ¢
|
# @return: ¶îÍâ±ÈÀý, Ê£Óà¶îÍâ¿ÉÔö¼Ó·Ö½â
|
mjLV, _ = GetMJLVInfo(curPlayer)
|
if not mjLV:
|
return 0, 0
|
ipyData = IpyGameDataPY.GetIpyGameData("LLMJ", mjLV)
|
if not ipyData:
|
return 0, 0
|
exPer = ipyData.GetDecomposeAddPer()
|
exUpper = ipyData.GetDecomposeExUpper()
|
exNow = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJDecompose)
|
exRemain = max(0, exUpper - exNow)
|
return exPer, exRemain
|
|
def AddExpEx(curPlayer, expEx):
|
## ÀÛ¼Ó½ñÈÕ¶îÍâ¾Ñé
|
if expEx <= 0:
|
return
|
updEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJExp) + expEx
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LLMJExp, updEx)
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def AddExpDecompose(curPlayer, decomposeEx):
|
## ÀÛ¼Ó½ñÈÕ¶îÍâ·Ö½â
|
if decomposeEx <= 0:
|
return
|
updEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJDecompose) + decomposeEx
|
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LLMJDecompose, updEx)
|
SyncLLMJInfo(curPlayer)
|
return
|
|
def SyncLLMJInfo(curPlayer):
|
mjLV, zhanchui = GetMJLVInfo(curPlayer)
|
clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCLLMJInfo)
|
clientPack.MJLV = mjLV
|
clientPack.Zhanchui = zhanchui
|
clientPack.ExpEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJExp)
|
clientPack.DecomposeEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LLMJDecompose)
|
NetPackCommon.SendFakePack(curPlayer, clientPack)
|
return
|