| | |
| | | import GameWorld
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import ChConfig
|
| | | import ShareDefine
|
| | |
|
| | | Def_LastYinji_Tick = "lastyjtick" # 上一次印记消失时间
|
| | |
|
| | | #CDBPlayerRefresh_XP
|
| | | def AddYinji(curPlayer, cnt):
|
| | | beforeCnt = GetYinjiCnt(curPlayer)
|
| | | beforeCnt = PlayerControl.GetYinjiCnt(curPlayer)
|
| | | #上限 X个
|
| | | curPlayer.SetXP(min(beforeCnt + cnt, IpyGameDataPY.GetFuncCfg('Yinji', 2)))
|
| | | PlayerControl.SetYinjiCnt(curPlayer, min(beforeCnt + cnt, IpyGameDataPY.GetFuncCfg('Yinji', 2)))
|
| | |
|
| | | if beforeCnt == 0:
|
| | | # 第一次加印记需重计时
|
| | |
| | | return
|
| | |
|
| | | def SubYinji(curPlayer, cnt):
|
| | | curPlayer.SetXP(max(curPlayer.GetXP() - cnt, 0))
|
| | | PlayerControl.SetYinjiCnt(curPlayer, max(PlayerControl.GetYinjiCnt(curPlayer) - cnt, 0))
|
| | | return
|
| | |
|
| | | def GetYinjiCnt(curPlayer):
|
| | | return curPlayer.GetXP()
|
| | |
|
| | |
|
| | | # 每X秒自动减少1个印记
|
| | | def ProcessPlayerYinji(curPlayer, tick):
|
| | | if GetYinjiCnt(curPlayer) == 0:
|
| | | if PlayerControl.GetYinjiCnt(curPlayer) == 0:
|
| | | return
|
| | |
|
| | | if tick - curPlayer.GetDictByKey(Def_LastYinji_Tick) < PlayerControl.GetLostYinjiTime(curPlayer):
|
| | |
| | |
|
| | | StartYinjiTick(curPlayer)
|
| | |
|
| | | |
| | | SubYinji(curPlayer, 1)
|
| | |
|
| | |
|