From 724c3574fa7b9637feaa5c20120c967df287e120 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 18 十一月 2022 20:06:24 +0800
Subject: [PATCH] 9748 【BT7】【主干】【越南】跨服BOSS定时活动(修复跨服boss日常引起的跨服日常PK匹配状态处理bug)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py |  131 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 103 insertions(+), 28 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
index 3894633..ad1322e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
@@ -40,6 +40,8 @@
 import PlayerFamilySWRH
 import PlayerViewCache
 import GameWorldBoss
+import AuctionHouse
+import PlayerAssist
 import PlayerTalk
 import PlayerTeam
 
@@ -87,8 +89,11 @@
 def GetFamilyMixServerDay(curFamily): return curFamily.GetExtra1()
 def SetFamilyMixServerDay(curFamily, value): return curFamily.SetExtra1(value)
 ## ------------------ 成员 ----------------------
-def GetMemberFightPower(curMember): return curMember.GetExattr3()
-def SetMemberFightPower(curMember, fightPower): return curMember.SetExattr3(fightPower)
+def GetMemberFightPower(curMember): return curMember.GetExattr3() + curMember.GetExattr5() * ChConfig.Def_PerPointValue
+def SetMemberFightPower(curMember, fightPower):
+    curMember.SetExattr5(fightPower / ChConfig.Def_PerPointValue)
+    curMember.SetExattr3(fightPower % ChConfig.Def_PerPointValue)
+    return
 
 def GetMemberJoinTime(curMember): return curMember.GetExattr4()
 def SetMemberJoinTime(curMember, joinTime): return curMember.SetExattr4(joinTime)
@@ -131,9 +136,25 @@
             if not lackCnt:
                 break
     elif lackCnt < 0:
-        GameWorld.ErrLog('    随机假仙盟异常 已存在的随机数大于还需要的随机个数lackFakeCnt=%s,fakeIDList=%s'%(lackFakeCnt, fakeIDList))
+        #GameWorld.DebugLog('    随机假仙盟异常 已存在的随机数大于还需要的随机个数lackFakeCnt=%s,fakeIDList=%s'%(lackFakeCnt, fakeIDList))
         return []
     return fakeIDList
+
+def GetFamilyNameFakeIndex(familyName):
+    ## 获取仙盟名是否是系统随机出来的假仙盟名
+    # @return: 0-不是, >0 对应的 fakeIndex
+    fakeFamilyNameList = IpyGameDataPY.GetFuncEvalCfg('FakeFamilyName')
+    randomCnt = IpyGameDataPY.GetFuncCfg('FakeFamilyName', 2)
+    for i in xrange(randomCnt):
+        fakeID = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % i)
+        if not fakeID:
+            continue
+        nameIndex = fakeID - 1
+        if nameIndex >=0 and nameIndex < len(fakeFamilyNameList):
+            fakeName = GameWorld.GbkToCode(fakeFamilyNameList[nameIndex])
+            if familyName == fakeName:
+                return fakeID
+    return 0
 
 def SyncFakeFamilyInfo(curPlayer=None):
     '''通知假仙盟信息'''
@@ -159,6 +180,28 @@
         if PlayerControl.GetIsTJG(curPlayer):
             return
         NetPackCommon.SendFakePack(curPlayer, fakeFamilyPack)
+    return
+
+def SyncCreatFamilyTimes(curPlayer=None):
+    # 通知建盟次数
+    packData = ChPyNetSendPack.tagGCServerCreatFamilyTimes()
+    packData.Clear()
+    packData.Times = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes)
+    if not curPlayer:
+        # 全服广播在线玩家
+        playerManager = GameWorld.GetPlayerManager()
+        for i in range(0, playerManager.GetPlayerCount()):
+            curPlayer = playerManager.GetPlayerByIndex(i)
+            if curPlayer == None or not curPlayer.GetInitOK():
+                continue
+            
+            if PlayerControl.GetIsTJG(curPlayer):
+                continue
+            NetPackCommon.SendFakePack(curPlayer, packData)
+    else:
+        if PlayerControl.GetIsTJG(curPlayer):
+            return
+        NetPackCommon.SendFakePack(curPlayer, packData)
     return
 
 #输入家族名称
@@ -244,11 +287,17 @@
     
     #-设置家族成员属性
     DoPlayerJionFamily(curFamily, curPlayer, IPY_GameServer.fmlLeader)
-    
+    creatFamilyTimes = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes)
+    # 如果是手动指定仙盟名创建的,判断是否在系统随机的假仙盟里,如果是的话就当做创建系统分配的假仙盟处理
+    if familyName and not fakeIndex:
+        fakeIndex = GetFamilyNameFakeIndex(familyName)
+        GameWorld.DebugLog("    玩家手动输入创建仙盟名与系统随机的假仙盟名相同,默认当做创建假仙盟!fakeIndexID=%s" % (fakeIndex))
     #扣道具(前N个战盟并且假编号在随机编号里不要钱)
     if fakeIndex and fakeIndex in fakeIndexList:
         PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % fakeIndexList.index(fakeIndex), 0)
-        GameWorld.DebugLog('    创建前3个仙盟不扣钱! 假仙盟索引%s'%fakeIndexList.index(fakeIndex))
+        GameWorld.Log('    创建前n个假仙盟不扣钱! 假仙盟索引%s'%fakeIndexList.index(fakeIndex))
+    elif creatFamilyTimes < IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney', 3):
+        GameWorld.Log('    创建前n个仙盟不扣钱! creatFamilyTimes=%s' % creatFamilyTimes)
     else:
         for i, findex in enumerate(fakeIndexList):
             if findex:
@@ -258,7 +307,9 @@
         needMoney = IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney')
         if needMoney:
             moneyType = IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney', 2)
-            curPlayer.MapServer_PayMoney(moneyType, needMoney)
+            sendMsg = str([moneyType, needMoney])
+            curPlayer.MapServer_QueryPlayerResult(0, 0, "CreateFamilyPayMoney", sendMsg, len(sendMsg))
+            #curPlayer.MapServer_PayMoney(moneyType, needMoney)
             #玩家创建家族费用转化为家族初始资金
             #PlayerAddFamilyMoney(curPlayer, curFamily, needMoney)
   
@@ -284,12 +335,13 @@
     
     #XW_JZ_EstablishSud <n color="255,255,0">恭喜您,家族建立成功!</n>    25  -   -
     PlayerControl.NotifyCode(curPlayer, "XW_JZ_EstablishSud")
-    
+    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerCreatFamilyTimes, min(creatFamilyTimes + 1, ShareDefine.Def_UpperLimit_DWord))
+    SyncCreatFamilyTimes()
     #帮会创建流向
     DataRecordPack.DR_CreateFamily(curPlayer.GetAccID(), curPlayerID, curPlayer.GetName(),
-                                   fullFamilyName, curFamily.GetID())
+                                   fullFamilyName, curFamily.GetID(), creatFamilyTimes+1)
 
-    GameWorld.Log('创建家族 : %s(%s), fakeIndex=%s' % (fullFamilyName, curFamily.GetID(), fakeIndex), curPlayerID)
+    GameWorld.Log('创建家族 : %s(%s), fakeIndex=%s, creatFamilyTimes=%s' % (fullFamilyName, curFamily.GetID(), fakeIndex, creatFamilyTimes+1), curPlayerID)
     PlayerControl.WorldNotify(0, "jiazu_liubo_671654", [curPlayer.GetName(), fullFamilyName, curFamily.GetID()])
     return
 
@@ -368,14 +420,17 @@
     PlayerFamilyBoss.NotifyFamilyBossFBInfo(jionPlayer)
     #通知家族仓库
     PyDataManager.GetFamilyStoreItemManager().SyncFamilyStoreItem(jionPlayer, curFamily.GetID())
-    
-    SetMemberFightPower(familyMember, jionPlayer.GetFightPower())
+    #仙盟拍品
+    AuctionHouse.Sync_FamilyAuctionItemInfo(jionPlayer, curFamily.GetID())
+    SetMemberFightPower(familyMember, PlayerControl.GetFightPower(jionPlayer))
     AddFamilyIDToFightPowerChangeList(curFamily.GetID())
     
     #通知仙盟盛宴题目
     PlayerFamilyParty.NotifyFamilyPartyQuestion(jionPlayer)
     #通知守卫人皇信息
     PlayerFamilySWRH.NotifySWRHInfo(jionPlayer, curFamily.GetID())
+    #通知仙盟协助信息
+    PlayerAssist.SyncFamilyAssist(jionPlayer)
     #oss记录加入家族信息
     DataRecordPack.DR_PlayerJoinFamily(jionPlayer, curFamily.GetID(), curFamily.GetName(), curFamily.GetCount())
     return
@@ -385,7 +440,6 @@
     GameWorld.DebugLog('    玩家战盟名变更处理, newFamilyName=%s' % familyName, playerID)
     #不处理排行榜
     needChangeFamilyBillboardList = [
-                                     #ShareDefine.Def_BT_RechargeTeHui,  # 充值特惠活动排行榜-当前期记录
                                      ]
     billboardMgr = GameWorld.GetBillboard()
     for billboardIndex in needChangeFamilyBillboardList:
@@ -580,7 +634,7 @@
     #===============================================================================================
     return
 
-def SendFamilyFakePack(familyID, clientPack):
+def SendFamilyFakePack(familyID, clientPack, excludePlayerIDList=[]):
     ## 广播家族成员PY封包
     family = GameWorld.GetFamilyManager().FindFamily(familyID)
     if not family:
@@ -589,8 +643,11 @@
     for index in xrange(family.GetCount()):
         member = family.GetAt(index)
         memPlayer = member.GetPlayer()
-        if memPlayer:
-            NetPackCommon.SendFakePack(memPlayer, clientPack)
+        if not memPlayer:
+            continue
+        if excludePlayerIDList and memPlayer.GetPlayerID() in excludePlayerIDList:
+            continue
+        NetPackCommon.SendFakePack(memPlayer, clientPack)
     return
 
 def Sync_PyAllFamilyInfo(curPlayer, allPageCnt, viewPage, startIndex, endIndex):
@@ -1421,7 +1478,12 @@
     if GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss):        
         PlayerControl.NotifyCode(curPlayer, "FairyGrabBossExitError")
         return
-    
+    if PlayerFamilyBoss.IsInAllFamilyBoss():
+        PlayerControl.NotifyCode(curPlayer, "LeagueBOSSExitError1")
+        return
+    if AuctionHouse.IsFamilyMemberBiddingAuctionItem(curFamily.GetID(), tagMemberID):
+        PlayerControl.NotifyCode(curPlayer, "Paimai7")
+        return
     tagPlayerName = curTagMember.GetName()  # 被踢玩家名
     tagPlayerID = curTagMember.GetPlayerID()  # 被踢玩家ID
     tagFamilyLV = curTagMember.GetFamilyLV()  # 被踢玩家职位
@@ -1432,10 +1494,10 @@
     PlayerFamilyAction.AddFamilyActionNote(tagPlayerName, curFamily.GetID(), ShareDefine.Def_ActionType_FamilyEvent,
                                            [ShareDefine.Def_FamilyActionEvent_MemberChange, ShareDefine.Def_FamilyMemberChange_KickOut], tick)
     #删除玩家
-    curFamily.DeleteMember(tagPlayerID)
-    __DoPlayerLeaveFamilyByID(curFamily, tagPlayerID)
-    
+    curFamily.DeleteMember(tagPlayerID)    
     tagPlayer = playerManager.FindPlayerByID(tagMemberID)
+    
+    __DoPlayerLeaveFamilyByID(curFamily, tagPlayerID, tagPlayer)
     #玩家在线, 设置这个玩家的属性
     PlayerForceLeaveFamily(tagPlayer, tick)
     
@@ -1500,6 +1562,12 @@
     if GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_DailyActionState % ShareDefine.DailyActionID_FamilyRobBoss):        
         PlayerControl.NotifyCode(curPlayer, "FairyGrabBossExitError")
         return
+    if PlayerFamilyBoss.IsInAllFamilyBoss():
+        PlayerControl.NotifyCode(curPlayer, "LeagueBOSSExitError1")
+        return
+    if AuctionHouse.IsFamilyMemberBiddingAuctionItem(curFamily.GetID(), curMember.GetPlayerID()):
+        PlayerControl.NotifyCode(curPlayer, "Paimai8")
+        return
     #判断退出时间间隔
     curTime = int(time.time())
     lastLeaveFamilyTime = PlayerControl.GetLeaveFamilyTime(curPlayer)
@@ -1526,7 +1594,7 @@
     curFamily.DeleteMember(curMember.GetPlayerID())
     #玩家在线, 设置这个玩家的属性
     PlayerForceLeaveFamily(curPlayer, tick)  
-    __DoPlayerLeaveFamilyByID(curFamily, curPlayerID)
+    __DoPlayerLeaveFamilyByID(curFamily, curPlayerID, curPlayer)
 
     DataRecordPack.DR_PlayerLeaveFamily(curPlayer, curFamily.GetID(), curFamily.GetName(), curFamily.GetCount(),
                                         familyLV, curPlayer.GetPlayerID(), curPlayer.GetName(), familyLV, updTime)
@@ -1544,12 +1612,13 @@
 #  @param curFamily 离开的家族
 #  @param leavePlayerID 离开的玩家ID
 #  @return None
-def __DoPlayerLeaveFamilyByID(curFamily, leavePlayerID):
+def __DoPlayerLeaveFamilyByID(curFamily, leavePlayerID, tagPlayer=None):
     PlayerFamilyAction.DelFamilyOfficerModelEquip(curFamily.GetID(), leavePlayerID)
     # 玩家战盟名变更处理
     __OnFamilyNameChange(leavePlayerID, '')
     AddFamilyIDToFightPowerChangeList(curFamily.GetID())
     PlayerViewCache.OnPlayerFamilyChange(leavePlayerID, 0, "")
+    PlayerAssist.OnPlayerLeaveFamily(curFamily.GetID(), leavePlayerID, tagPlayer)
     if leavePlayerID in PyGameData.g_autoViceleaderDict.get(curFamily.GetID(),[]):
         PyGameData.g_autoViceleaderDict[curFamily.GetID()].remove(leavePlayerID)
     return
@@ -1670,8 +1739,10 @@
                                           addFamilyMoney, curFamily.GetFamilyActiveValue(), addFamilyActiveValue)
     
     #通知客户端
-    #curFamily.Broadcast_FamilyChange()
-    curPlayer.Sync_FamilyInfo()
+    if addFamilyHornor:
+        curFamily.Broadcast_FamilyChange()
+    else:
+        curPlayer.Sync_FamilyInfo()
     
     #金钱变更时才通知
     if addFamilyMoney != 0:
@@ -1862,6 +1933,7 @@
 #  @remarks 函数详细说明.
 def PlayerLoginRefreshFamily(curPlayer, tick):
     SyncFakeFamilyInfo(curPlayer)
+    SyncCreatFamilyTimes(curPlayer)
     familyID = curPlayer.GetFamilyID()
     curFamily = None
     
@@ -1915,8 +1987,10 @@
     
     if not PlayerControl.GetIsTJG(curPlayer):
         #上线重置离线时间为0, 非脱机挂才设置
-        curMember.SetExattr2(0)
+        curMember.SetExattr2(0) # 在线0,脱机1,>1离线时间
         curPlayer.Sync_FamilyInfo()
+    else:
+        curMember.SetExattr2(1) # 脱机1
     
     curPlayer.MapServer_FamilyRefresh()
     curMember = GetPlayerFamilyMember(curPlayer)
@@ -2844,7 +2918,7 @@
         GameWorld.Log("GetLeaderOfflineTime->FindMember, None;%s" % leaderID)
         return 0
     offLineTimeNum = curMember.GetExattr2()
-    if not offLineTimeNum:
+    if not offLineTimeNum or offLineTimeNum == 1:
         return 0
     offLineTime = GameWorld.ChangeTimeNumToStr(offLineTimeNum)
     return GameWorld.GetPastHour(offLineTime)
@@ -2855,7 +2929,7 @@
     for i in range(0, family.GetCount()):
         member = family.GetAt(i) 
         offLineTimeNum = member.GetExattr2()
-        if not offLineTimeNum:
+        if not offLineTimeNum or offLineTimeNum == 1:
             #有人在线直接返回
             return 0
         if not offLineTime:
@@ -2890,7 +2964,7 @@
         elif toMember2.GetExattr1() < member.GetExattr1():
             toMember2 = member
 
-        offLineHour = GameWorld.GetPastHour(GameWorld.ChangeTimeNumToStr(member.GetExattr2())) if member.GetExattr2() else 0
+        offLineHour = GameWorld.GetPastHour(GameWorld.ChangeTimeNumToStr(member.GetExattr2())) if member.GetExattr2() > 1 else 0
         #GameWorld.DebugLog('memberID=%s 离线%s小时,历史贡献度%s'%(member.GetPlayerID(), offLineHour, member.GetExattr1()))
         if offLineHour < 48:
             if not toMember1:
@@ -3490,7 +3564,8 @@
     requestPlayerName = curPlayer.GetName()
     playerLV = curPlayer.GetLV()
     #玩家Id, 等级,职业,战斗力
-    actionDataList = [curPlayer.GetID(), playerLV, curPlayer.GetJob(), curPlayer.GetFightPower()]
+    fightPower = PlayerControl.GetFightPower(curPlayer)
+    actionDataList = [curPlayer.GetID(), playerLV, curPlayer.GetJob(), fightPower % ChConfig.Def_PerPointValue, fightPower / ChConfig.Def_PerPointValue]
     allFamilyActionManager = GameWorld.GetFamilyActionManager()
     familyManager = GameWorld.GetFamilyManager()
     indexList = range(familyManager.GetCount())

--
Gitblit v1.8.0