From dc0b92c1e2fe9f3d24c183b325dad54d088735c1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 10 七月 2025 17:01:24 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_ServerCode

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index ae8e33a..73211db 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -507,6 +507,8 @@
 # @return 返回值. 是否通过检查
 # @remarks 概率相关, 这个事件是否能够出现
 def CanHappen(rate, maxRate=ShareDefine.Def_MaxRateValue):
+    if rate <= 0:
+        return 0
     if random.randint(0, maxRate -1) < rate:
         return 1
     
@@ -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())
     
@@ -1358,6 +1357,8 @@
 # @return
 def GetPlatform():
     return ReadChConfig.GetPyMongoConfig("platform", "PlatformName")
+
+def IsTestPlatform(platform): return platform in ["test", "yun"]
 
 #===============================================================================
 # ##获得当前服务器ID
@@ -2104,6 +2105,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: 待取值的字节值
@@ -2388,8 +2415,8 @@
 def SendGameErrorEx(errType, msgInfo="", playerID=0):
     ErrLog("SendGameErrorEx: %s -> %s" % (errType, msgInfo), playerID)
     SendGameError(errType, msgInfo)
-    #if GetGameWorld().GetDebugLevel():
-    #    raise Exception("%s -> %s" % (errType, msgInfo))
+    if GetGameWorld().GetDebugLevel():
+        raise Exception("%s -> %s" % (errType, msgInfo))
     return
 
 def SendGameError(errType, msgInfo=""):

--
Gitblit v1.8.0