From c280ced8be799a899efc78b21cc807d435ab6609 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 10 二月 2026 19:34:03 +0800
Subject: [PATCH] 66 【公会】基础主体-服务端(退出公会时间根据当前是否互通取对应的本服或跨服时间;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py |  143 +++++++++++++++++++++++++++--------------------
 1 files changed, 81 insertions(+), 62 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py
index e4405c1..6dd6137 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Taofa.py
@@ -17,43 +17,42 @@
 
 import ChConfig
 import GameWorld
+import ShareDefine
+import CreateFamily
 import PlayerControl
-import PlayerFamilyZhenbaoge
 import PlayerFamilyTaofa
 import PlayerFamily
+import CrossPlayer
 import DBDataMgr
 import random
 import time
 
-def OnExec(curPlayer, msgList):
-    
+def GetGMServerIDList(curPlayer):
+    ## 获取命令额外发送到其他服务器,如跨服
+    crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
+    if crossServerID:
+        GameWorld.DebugAnswer(curPlayer, "本服公会已互通跨服ID:%s" % crossServerID)
+        return [crossServerID]
+    GameWorld.DebugAnswer(curPlayer, "本服公会未互通")
+    return []
+
+def OnExecCross(crossPlayer, msgList):
     if not msgList:
-        GameWorld.DebugAnswer(curPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr())
-        GameWorld.DebugAnswer(curPlayer, "重置公会讨伐: Taofa 0")
-        GameWorld.DebugAnswer(curPlayer, "设置布阵层级: Taofa z 层级 [剩余秒]")
-        GameWorld.DebugAnswer(curPlayer, "设置当前怒气: Taofa a 怒气")
-        GameWorld.DebugAnswer(curPlayer, "设置讨伐次数: Taofa c 已讨伐次数  物品次数")
-        GameWorld.DebugAnswer(curPlayer, "设置宝箱领取: Taofa b 已领取宝箱 未领取")
-        GameWorld.DebugAnswer(curPlayer, "设置宝箱时间: Taofa t 几秒前统计的")
-        GameWorld.DebugAnswer(curPlayer, "设置宝箱贡献: Taofa g 已贡献宝箱 [累计伤害 历史伤害]")
-        #GameWorld.DebugAnswer(curPlayer, "新增成员讨伐: Taofa m 人数 [每人攻击次数 怒气次数 伤害值A 到B]")
-        #GameWorld.DebugAnswer(curPlayer, "AB值没有填则按常规砍价价格计算")
-        GameWorld.DebugAnswer(curPlayer, "创建仙盟相关使用命令: CreateFamily")
+        return
+    if GameWorld.IsMainServer() and DBDataMgr.GetFamilyMgr().GetCurCrossServerID():
+        # 本服公会已互通不再执行本服命令
         return
     
-    familyID = curPlayer.GetFamilyID()
-    if not familyID:
-        GameWorld.DebugAnswer(curPlayer, "没有仙盟")
-        return
+    familyID = crossPlayer.GetFamilyID()
     curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
     if not curFamily:
+        GameWorld.DebugAnswer(crossPlayer, "没有公会")
         return
     
     value1 = msgList[0]
     if value1 == 0:
         PlayerFamilyTaofa.OnTaofaReset(curFamily)
-        PlayerFamilyTaofa.OnTaofaResetPlayer(curPlayer)
-        GameWorld.DebugAnswer(curPlayer, "重置公会讨伐OK")
+        GameWorld.DebugAnswer(crossPlayer, "重置公会讨伐OK")
         return
     
     if value1 == "z":
@@ -65,16 +64,42 @@
         PlayerFamilyTaofa.SetFABuzhenLayer(gActionData, gLayer)
         PlayerFamilyTaofa.SetFABuzhenEndTime(gActionData, gEndTime)
         PlayerFamily.SendFamilyAction(gActionData)
-        GameWorld.DebugAnswer(curPlayer, "布阵层:%s,到期:%s" % (gLayer, GameWorld.ChangeTimeNumToStr(gEndTime)))
+        GameWorld.DebugAnswer(crossPlayer, "布阵层:%s,到期:%s" % (gLayer, GameWorld.ChangeTimeNumToStr(gEndTime)))
         return
     
     # 新增成员讨伐
     if value1 == "m":
-        memCnt = msgList[1] if len(msgList) > 1 else 0
-        GameWorld.DebugAnswer(curPlayer, "成员讨伐:%s" % (memCnt))
+        __AddMemTaofaAtk(crossPlayer, curFamily, msgList)
         return
     
-    elif value1 == "a":
+    return
+
+def OnExec(curPlayer, msgList):
+    if not msgList:
+        GameWorld.DebugAnswer(curPlayer, "-----%s-----" % GameWorld.GetCurrentDataTimeStr())
+        GameWorld.DebugAnswer(curPlayer, "重置公会讨伐: Taofa 0")
+        GameWorld.DebugAnswer(curPlayer, "设置布阵层级: Taofa z 层级 [剩余秒]")
+        GameWorld.DebugAnswer(curPlayer, "设置当前怒气: Taofa a 怒气")
+        GameWorld.DebugAnswer(curPlayer, "设置讨伐次数: Taofa c 已讨伐次数  物品次数")
+        GameWorld.DebugAnswer(curPlayer, "设置宝箱领取: Taofa b 已领取宝箱 未领取")
+        GameWorld.DebugAnswer(curPlayer, "设置宝箱贡献: Taofa g 已贡献宝箱 [累计伤害 历史伤害]")
+        GameWorld.DebugAnswer(curPlayer, "增加成员讨伐: Taofa m 人数 [伤害值A 到B 怒攻概率]")
+        GameWorld.DebugAnswer(curPlayer, "创建公会相关使用命令: CreateFamily")
+        return
+    
+    crossPlayer = CrossPlayer.GetCrossPlayerMgr().FindCrossPlayer(curPlayer.GetPlayerID())
+    if not crossPlayer:
+        return
+    
+    value1 = msgList[0]
+    
+    if value1 == 0:
+        OnExecCross(crossPlayer, msgList)
+        PlayerFamilyTaofa.OnTaofaResetPlayer(curPlayer)
+        GameWorld.DebugAnswer(curPlayer, "重置玩家讨伐OK")
+        return
+    
+    if value1 == "a":
         anger = msgList[1] if len(msgList) > 1 else 0
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaAnger, anger)
         GameWorld.DebugAnswer(curPlayer, "当前怒气: %s" % anger)
@@ -85,19 +110,13 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaCnt, atkCnt)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaItemAddCnt, itemAddCnt)
         GameWorld.DebugAnswer(curPlayer, "已讨伐次数:%s, 物品增加次数:%s" % (atkCnt, itemAddCnt))
-        
+
     elif value1 == "b":
         totalGetCnt = msgList[1] if len(msgList) > 1 else 0
         unGetCnt = msgList[2] if len(msgList) > 2 else 0
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxTotalGetCnt, totalGetCnt)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt, unGetCnt)
         GameWorld.DebugAnswer(curPlayer, "已领取宝箱:%s, 未领取:%s" % (totalGetCnt, unGetCnt))
-        
-    elif value1 == "t":
-        befSeconds = msgList[1] if len(msgList) > 1 else 0
-        lastTime = int(time.time()) - befSeconds
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxLastTime, lastTime)
-        GameWorld.DebugAnswer(curPlayer, "上次检查宝箱时间:%s" % (GameWorld.ChangeTimeNumToStr(lastTime)))
         
     elif value1 == "g":
         contribCnt = msgList[1] if len(msgList) > 1 else 0
@@ -121,40 +140,40 @@
     PlayerFamilyTaofa.SyncTaofaInfo(curPlayer)
     return
 
-    #添加假砍价
-    gActionData = PlayerFamilyZhenbaoge.GetZhenbaogeActionData(familyID, PlayerFamilyZhenbaoge.ActionGlobalID)
-    if not gActionData:
-        GameWorld.DebugAnswer(curPlayer, "请先重置珍宝阁")
-        return
+def __AddMemTaofaAtk(crossPlayer, curFamily, msgList):
+    #新增成员讨伐: Taofa m 人数 [伤害值A 到B]
     
-    familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, PlayerFamilyZhenbaoge.ActionType)
-    actionCount = familyAction.Count()
+    GameWorld.DebugAnswer(crossPlayer, "---------- %s" % GameWorld.GetCurrentDataTimeStr())
+    memCnt = msgList[1] if len(msgList) > 1 else curFamily.GetCount()
+    hurtTotalA = msgList[2] if len(msgList) > 2 else 0
+    hurtTotalB = msgList[3] if len(msgList) > 3 else hurtTotalA
+    angerRate = msgList[4] if len(msgList) > 4 else 5000
+    hurtTotalB = max(hurtTotalA, hurtTotalB)
     
-    fackCount = value1
-    randValue1 = msgList[1] if len(msgList) > 1 else 0
-    randValue2 = msgList[2] if len(msgList) > 2 else 0
-    syncActionDataList = [gActionData]
-    startFackID = 1000 + actionCount
-    FakeName = GameWorld.GbkToCode("假名字")
-    for fackID in range(startFackID, startFackID + fackCount):
+    if curFamily.GetCount() <= memCnt:
+        addMemCnt = memCnt - curFamily.GetCount() + 1
+        GameWorld.DebugAnswer(crossPlayer, "添加缺少成员: %s" % addMemCnt)
+        CreateFamily.OnExecCross(crossPlayer, ["m", addMemCnt])
+        GameWorld.DebugAnswer(crossPlayer, "当前总成员数: %s" % curFamily.GetCount())
         
-        playerID = fackID
-        playerName = "%s%s" % (FakeName, fackID)
-        
-        if randValue1 and randValue2 and randValue1 <= randValue2:     
-            cutPrice = random.randint(randValue1, randValue2)
-        else:
-            cutPrice = PlayerFamilyZhenbaoge.CalcCutPrice(curFamily, gActionData, playerID)
-            
-        if not cutPrice:
+    actionDataList = []
+    for index in range(curFamily.GetCount()):
+        if memCnt <= 0:
+            break
+        member = curFamily.GetAt(index)
+        memID = member.GetPlayerID()
+        if memID == PlayerFamilyTaofa.ActionGlobalID:
             continue
+        if memID >= ShareDefine.RealPlayerIDStart:
+            # 不包括真实玩家
+            continue
+        memCnt -= 1
+        hurtValue = random.randint(hurtTotalA, hurtTotalB)
+        isAnger = GameWorld.CanHappen(angerRate) # 概率设置为怒气攻击
         
-        actionData = PlayerFamilyZhenbaoge.AddCutPrice(familyID, playerID, playerName, cutPrice, gActionData, False)
-        syncActionDataList.append(actionData)
-        nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
-        GameWorld.DebugAnswer(curPlayer, "砍价人次:%s,砍价:%s,现价:%s" % (fackID % 1000, cutPrice, nowPrice))
-        
-    PlayerFamily.SendFamilyAction(syncActionDataList)
-    nowPrice = PlayerFamilyZhenbaoge.GetFAPriceFinal(gActionData)
-    GameWorld.DebugAnswer(curPlayer, "添加假砍价数:%s,总砍价数:%s,当前价格:%s" % (fackCount, familyAction.Count() - 1, nowPrice))
+        actionData = PlayerFamilyTaofa.GMAddMemTaofaAtk(crossPlayer, curFamily, memID, hurtValue, isAnger)
+        actionDataList.append(actionData)
+                
+    PlayerFamily.SendFamilyAction(actionDataList)
+    PlayerFamilyTaofa.SyncMemContribInfo(curFamily)
     return

--
Gitblit v1.8.0