From 63f6f44ec2a38eaec9f39bbe26edb07daed49b49 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 16 九月 2025 17:36:50 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(王元姬技能,弹射待处理;支持被动变更伤害倍值;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTree.py |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTree.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTree.py
index 906fea0..ae4a7e6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTree.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTree.py
@@ -22,7 +22,7 @@
 import ChPyNetSendPack
 import PlayerControl
 import IPY_GameWorld
-#import PlayerTask
+import PlayerTask
 import ChConfig
 
 import time
@@ -32,6 +32,11 @@
     if not treeLV:
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLV, 1)
     RefreshTreeLVUPTime(curPlayer)
+    SyncTreeInfo(curPlayer)
+    return
+
+def PlayerOnDay(curPlayer):
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeFreeTimeCnt, 0)
     SyncTreeInfo(curPlayer)
     return
 
@@ -152,7 +157,7 @@
                        % (updLVUPRemainTime, treeLV, LVUPRemainTime, passSeconds, lastRefreshTime), curPlayer.GetPlayerID())
     return
 
-def ReduceTreeLVUPTime(curPlayer, reduceTime):
+def ReduceTreeLVUPTime(curPlayer, reduceTime, isNotify=True):
     ## 减少仙树升级剩余时间,可能是使用道具或其他功能等
     RefreshTreeLVUPTime(curPlayer)
     lvupState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
@@ -165,8 +170,39 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeLVUPRemainTime, updLVUPRemainTime)
     GameWorld.DebugLog("减少仙树升级剩余时间! updLVUPRemainTime=%s,LVUPRemainTime=%s,reduceTime=%s" 
                        % (updLVUPRemainTime, LVUPRemainTime, reduceTime), curPlayer.GetPlayerID())
-    SyncTreeInfo(curPlayer)
+    if isNotify:
+        SyncTreeInfo(curPlayer)
     return True
+
+def FreeReduceTreeLVTime(curPlayer):
+    ## 仙树免费减时
+    dailyFreeCntMax = IpyGameDataPY.GetFuncCfg("TreeLVUP", 3)
+    freeCDSeconds = IpyGameDataPY.GetFuncCfg("TreeLVUP", 4) * 60 # 免费CD,秒
+    
+    freeTimeCntToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeFreeTimeCnt)
+    freeTimeLast = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeFreeTimeLast)
+    
+    if dailyFreeCntMax and freeTimeCntToday >= dailyFreeCntMax:
+        GameWorld.DebugLog("已达今日免费仙树减时次数! freeTimeCntToday=%s >= %s" % (freeTimeCntToday, dailyFreeCntMax))
+        return
+    
+    curTime = int(time.time())
+    if freeCDSeconds and freeTimeLast and (curTime - freeTimeLast) < freeCDSeconds:
+        GameWorld.DebugLog("免费仙树减时CD未到! passSeconds=%s < %s" % (curTime - freeTimeLast, freeCDSeconds))
+        return
+    
+    reduceTime = IpyGameDataPY.GetFuncCfg("TreeLVUP", 5) * 60
+    if reduceTime <= 0:
+        return
+    
+    if not ReduceTreeLVUPTime(curPlayer, reduceTime, False):
+        return
+    
+    freeTimeCntToday += 1
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeFreeTimeCnt, freeTimeCntToday)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreeFreeTimeLast, curTime)
+    SyncTreeInfo(curPlayer)
+    return
 
 def DoTreeLVUP(curPlayer):
     ## 执行仙树升级
@@ -194,7 +230,7 @@
     GameWorld.DebugLog("执行仙树升级! updTreeLV=%s" % updTreeLV, playerID)
     SyncTreeInfo(curPlayer)
     
-    #PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_TreeLV)
+    PlayerTask.UpdTaskValue(curPlayer, ChConfig.TaskType_TreeLV)
     return True
 
 def SyncTreeInfo(curPlayer):
@@ -202,5 +238,7 @@
     clientPack.TreeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
     clientPack.LVUPState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPState)
     clientPack.LVUPRemainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLVUPRemainTime)
+    clientPack.FreeTimeCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeFreeTimeCnt)
+    clientPack.FreeTimeLast = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeFreeTimeLast)
     NetPackCommon.SendFakePack(curPlayer, clientPack)
     return

--
Gitblit v1.8.0