From 30dd8ff93a00ada8262a35da0ede9c2088a7fd37 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 23 九月 2025 16:52:52 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(诸葛亮技能; 目标细分增加攻击力最高5; buff状态增加军令19;增加效果6006增加本次技能万分比验证职业;增加效果5015集火攻击军令目标;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py |   46 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index 6092f9c..05ffe43 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -507,7 +507,9 @@
 # @return 返回值. 是否通过检查
 # @remarks 概率相关, 这个事件是否能够出现
 def CanHappen(rate, maxRate=ShareDefine.Def_MaxRateValue):
-    if random.randint(0, maxRate -1) < rate:
+    if rate <= 0:
+        return 0
+    if rate >= maxRate or random.randint(0, maxRate -1) < rate:
         return 1
     
     return 0
@@ -608,8 +610,6 @@
     if not curPlayer or curPlayer.GetID() == 0 or curPlayer.IsEmpty():
         return False
     #if not curPlayer.GetInitOK():
-    #    return False
-    #if IsTJGPlayer(curPlayer):
     #    return False
     if IsMirrorPlayer(curPlayer):
         return False
@@ -865,6 +865,8 @@
 # @return 返回值. 时间Data格式
 # @remarks 获得服务器系统时间
 def GetCurrentTime():
+    return datetime.datetime.today()
+def GetServerTime():
     return datetime.datetime.today()
 #    ctime = GetGameWorld().GetGameServerEventTime()
 #    
@@ -1160,9 +1162,6 @@
     if npcObj == IPY_GameWorld.gnotSummon:
         return GetNPCManager().FindSummonNPCByID(curTagNPC.GetID())
     
-    elif npcObj == IPY_GameWorld.gnotTruck:
-        return GetNPCManager().FindTruckByID(curTagNPC.GetID())
-    
     elif npcObj == IPY_GameWorld.gnotPet:
         return GetNPCManager().FindPetByID(curTagNPC.GetID())
     
@@ -1322,7 +1321,7 @@
     ## 获取服务器ID所属主服ID
     ServerIDMainServerDict = IpyGameDataPY.GetConfigEx("ServerIDMainServerDict")
     if ServerIDMainServerDict == None:
-        filePath = ChConfig.GetDBPath() + ("\\MixServerMap_%s.json" % GetPlatform())
+        filePath = ChConfig.GetServerConfigPath() + ("\\MixServerMap_%s.json" % GetPlatform())
         if not os.path.isfile(filePath):
             SendGameErrorEx("GetMainServerIDError", "file can not found. %s" % filePath)
         else:
@@ -1358,6 +1357,8 @@
 # @return
 def GetPlatform():
     return ReadChConfig.GetPyMongoConfig("platform", "PlatformName")
+
+def IsTestPlatform(platform): return platform in ["test", "yun"]
 
 #===============================================================================
 # ##获得当前服务器ID
@@ -1404,6 +1405,9 @@
         return mainServerID
     return 0
 
+def GetDBPlayerAccIDByID(playerID):
+    ## 获取玩家表账号ID - 根据玩家ID, 可用于判断是否本服玩家
+    return PyGameData.g_dbPlayerIDMap.get(playerID, "")
 
 #===============================================================================
 # 平台ID = appid
@@ -1727,6 +1731,8 @@
     randList = []
     weight = 0
     for info in weightList:
+        if not info[0]:
+            continue
         weight += info[0]
         randList.append([weight, info[1] if len(info) == 2 else info[1:]])
     if not randList:
@@ -2101,6 +2107,32 @@
     numValue += pow(10, dataIndex)*(dataValue - lastTagLV)
     return numValue
 
+def GetValue(dataValue, fromRight, bits):
+    '''获取某个数值中,从右往左数第x位开始,截图n位得到的数据
+    @param dataValue: 原始数值
+    @param fromRight: 从右往左数第x位开始,从1开始
+    @param bits: 截取n位
+    @return: 数值value
+    '''
+    lPow = pow(10, fromRight)
+    rPow = pow(10, fromRight - bits)
+    curValue = dataValue % lPow / rPow
+    return curValue
+
+def SetValue(dataValue, fromRight, bits, updValue):
+    '''修改某个数值,从右往左数第x位开始,截图n位得到的数据,替换为具体数值
+    @param dataValue: 原始数值
+    @param fromRight: 从右往左数第x位开始,从1开始
+    @param bits: 截取n位
+    @param updValue: 替换值
+    @return: 修改后的value值
+    '''
+    lPow = pow(10, fromRight)
+    rPow = pow(10, fromRight - bits)
+    leftValue = dataValue / lPow * lPow
+    rightValue = dataValue % rPow
+    return leftValue + updValue * rPow + rightValue
+    
 def GetBitValue(dataValue, index):
     """ 得到某个字节值中某一位(Bit)的值
     @param dataValue: 待取值的字节值

--
Gitblit v1.8.0