hxp
4 天以前 22f9a92aa213b3a2b691e6718d8a580895e68011
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#!/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