From 262e9c36dea8e7712cfc31d5284ab5319fc67990 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 13 一月 2025 10:39:15 +0800
Subject: [PATCH] 10263 【越南】【英文】后端支持NPC仿真实玩家战斗和快速战斗(最大护盾改为存ExAttr16)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py |   89 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 81 insertions(+), 8 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
index ba8dc6b..d9af3a4 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
@@ -29,6 +29,7 @@
 import DataRecordPack
 import PlayerFamilyBoss
 import IpyGameDataPY
+import PlayerFamilyZhenbaoge
 import PlayerFamilyRedPacket
 import GameWorldFamilyWar
 import ChPyNetSendPack
@@ -38,6 +39,7 @@
 import PlayerBillboard
 import PlayerActBossTrial
 import PlayerCompensation
+import PlayerFamilyEmblem
 import PlayerFamilyParty
 import PlayerFamilySWRH
 import PlayerViewCache
@@ -75,9 +77,9 @@
     if not family:
         return 0
     return GetFamilyTotalFightPower(family)
-# 徽章
-def GetFamilyEmblem(curFamily): return curFamily.GetExtra6()
-def SetFamilyEmblem(curFamily, value): return curFamily.SetExtra6(value)
+# 徽章ID
+def GetFamilyEmblemID(curFamily): return curFamily.GetExtra6()
+def SetFamilyEmblemID(curFamily, emblemID): return curFamily.SetExtra6(emblemID)
 
 # 公告修改次数
 def GetFamilyBroadcastCnt(curFamily): return curFamily.GetExtra3()
@@ -270,7 +272,7 @@
 #  @param tick 当前时间
 #  @return None
 #  @remarks 函数详细说明.
-def DoCreateFamily(curPlayer, familyName, fakeIndex, tick):
+def DoCreateFamily(curPlayer, familyName, fakeIndex, tick, emblemID=0):
     #---验证玩家属性---
     curPlayerID = curPlayer.GetPlayerID()
 
@@ -327,12 +329,16 @@
     if curFamily == None:
         GameWorld.ErrLog("家族创建数目已满, 创建家族失败", curPlayerID)
         return
-    GameWorld.Log("创建仙盟: familyID=%s,playerID=%s" % (curFamily.GetID(), curPlayerID))
+    emblemIDList = PlayerFamilyEmblem.GetDefaultFamilyEmblemIDList()
+    if not emblemID or emblemID not in emblemIDList:
+        emblemID = random.choice(emblemIDList) # 从默认徽章中随机选择一个
+    GameWorld.Log("创建仙盟: familyID=%s,playerID=%s,emblemID=%s" % (curFamily.GetID(), curPlayerID, emblemID))
     #---创建家族---
     curFamily.SetServerID(GameWorld.GetAccIDServerID(curPlayer.GetAccID()))
     curFamily.SetCreateTime(GameWorld.GetCurrentDataTimeStr())
     curFamily.SetLV(1)
     curFamily.SetAcceptJoin(ShareDefine.FamilyAcceptJoin_Agree)     #设置收人方式为直接通过申请
+    SetFamilyEmblemID(curFamily, emblemID)
     PyDataManager.GetFamilyStoreItemManager().DelFamilyStoreItemAll(curFamily.GetID())
     
     #新创建的仙盟默认设置已处理过合服
@@ -349,6 +355,8 @@
     if fakeIndex and fakeIndex in fakeIndexList:
         PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_FakeFamilyIndex % fakeIndexList.index(fakeIndex), 0)
         GameWorld.Log('    创建前n个假仙盟不扣钱! 假仙盟索引%s'%fakeIndexList.index(fakeIndex))
+        fakeAwardItemList = IpyGameDataPY.GetFuncEvalCfg("FakeFamilyName", 3)
+        PlayerCompensation.SendMailByKey("FackFamilyNotice", [curPlayerID], fakeAwardItemList)
     elif creatFamilyTimes < IpyGameDataPY.GetFuncCfg('CreateFamilyNeedMoney', 3):
         GameWorld.Log('    创建前n个仙盟不扣钱! creatFamilyTimes=%s' % creatFamilyTimes)
     else:
@@ -396,6 +404,8 @@
 
     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()])
+    
+    PlayerFamilyZhenbaoge.OnZhenbaogeReset(curFamily)
     return
 
 ## 获取家族全名
@@ -595,6 +605,7 @@
 #    tagHead        Head;
 #    char        Name[33];
 #    WORD        FakeID;
+#    BYTE        EmblemID; //选择徽章ID,解锁仙盟等级为1级的均为可选ID
 #};
 ## 查看申请帮会的成员信息
 #  @param index 玩家索引
@@ -605,8 +616,9 @@
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
     inputName = clientPack.Name
     fakeIndex = clientPack.FakeID
+    emblemID = clientPack.EmblemID
     #执行创建家族逻辑
-    DoCreateFamily(curPlayer, inputName, fakeIndex, tick)
+    DoCreateFamily(curPlayer, inputName, fakeIndex, tick, emblemID)
     #重置查看家族状态(仅创建家族时候重置, 其余状态由MapServer退出事件时重置)
     __ClearViewFamilyState(curPlayer)
     #玩家离开事件
@@ -742,6 +754,7 @@
     totalFightPower = GetFamilyTotalFightPower(family)
     familyView.TotalFightPower = totalFightPower % ChConfig.Def_PerPointValue
     familyView.TotalFightPowerEx = totalFightPower / ChConfig.Def_PerPointValue
+    familyView.EmblemID = GetFamilyEmblemID(family)
     return familyView
 
 ## 玩家模糊查询家族,0F 0D封包
@@ -822,6 +835,19 @@
             break
     familyViewPack.PageCount = len(familyViewPack.Family)
     NetPackCommon.SendFakePack(curPlayer, familyViewPack)
+    return
+
+#// A4 13 修改家族徽章 #tagCGChangeFamilyEmblem
+#
+#struct    tagCGChangeFamilyEmblem
+#{
+#    tagHead        Head;
+#    BYTE        EmblemID;    // 更换的徽章ID
+#};
+def OnChangeFamilyEmblem(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    changeEmblemID = clientData.EmblemID
+    PlayerFamilyEmblem.OnChangeFamilyEmblem(curPlayer, changeEmblemID)
     return
 
 #class   IPY_CFamilyChangeBroadcast
@@ -2132,6 +2158,8 @@
     curMember.SetJob(curPlayer.GetJob())
     curMember.SetOperateInfo(curPlayer.GetOperateInfo())
     curMember.SetOfficialRank(curPlayer.GetOfficialRank())
+    curMember.SetFace(curPlayer.GetFace())
+    curMember.SetFacePic(curPlayer.GetFacePic())
     return
 #---------------------------------------------------------------------
 ## 玩家刷新
@@ -2746,6 +2774,8 @@
         family = familyManager.GetAt(i)
         #仙盟boss
         PlayerFamilyBoss.FamilyBossFBOnDayEx(family)
+        #珍宝阁
+        PlayerFamilyZhenbaoge.OnDayEx(family)
     return
 
 #---------------------------------------------------------------------
@@ -3685,6 +3715,8 @@
         __DoChuangong_Response(curPlayer, tagPlayerID, isOK)
         return
     
+    if msgType == "ThanksGift":
+        __DoChuangong_ThanksGift(curPlayer, msgData)
     return
 
 def __CheckChuangongPlayer(curPlayer, tagPlayerID):
@@ -3704,8 +3736,26 @@
 def __DoChuangong_Invite(curPlayer, tagPlayerID):
     ## 邀请
     playerID = curPlayer.GetPlayerID()
-    tagPlayer = __CheckChuangongPlayer(curPlayer, tagPlayerID)
+    curFamily = curPlayer.GetFamily()
+    if not curFamily:
+        return
+    tagMember = curFamily.FindMember(tagPlayerID)
+    if not tagMember:
+        GameWorld.DebugLog("非盟友无法传功! tagPlayerID=%s" % tagPlayerID, curPlayer.GetPlayerID())
+        return
+    tagPlayer = tagMember.GetPlayer()
     if not tagPlayer:
+        clientPack = ChPyNetSendPack.tagGCChuangongStart()
+        clientPack.Clear()
+        clientPack.PlayerID = tagMember.GetPlayerID()
+        clientPack.Name = tagMember.GetName()
+        clientPack.NameLen = len(clientPack.Name)
+        clientPack.LV = tagMember.GetLV()
+        clientPack.Job = tagMember.GetJob()
+        clientPack.RealmLV = tagMember.GetOfficialRank()
+        NetPackCommon.SendFakePack(curPlayer, clientPack)
+        PyGameData.g_chuangongTagPlayerDict[playerID] = tagPlayerID
+        GameWorld.DebugLog("对方离线,则自己直接开始传功: tagPlayerID=%s, %s" % (tagPlayerID, PyGameData.g_chuangongPlayerDict), playerID)
         return
     invitePlayerIDList = PyGameData.g_chuangongPlayerDict.get(playerID, [])
     if tagPlayerID not in invitePlayerIDList:
@@ -3719,6 +3769,8 @@
     clientPack.LV = curPlayer.GetLV()
     clientPack.Job = curPlayer.GetJob()
     clientPack.RealmLV = curPlayer.GetOfficialRank()
+    clientPack.Face = curPlayer.GetFace()
+    clientPack.FacePic = curPlayer.GetFacePic()
     NetPackCommon.SendFakePack(tagPlayer, clientPack)
     GameWorld.DebugLog("邀请传功: tagPlayerID=%s, %s" % (tagPlayerID, PyGameData.g_chuangongPlayerDict), playerID)
     return
@@ -3759,6 +3811,27 @@
     clientPack.Job = tagPlayer.GetJob()
     clientPack.RealmLV = tagPlayer.GetOfficialRank()
     NetPackCommon.SendFakePack(curPlayer, clientPack)
+    PyGameData.g_chuangongTagPlayerDict[curPlayer.GetPlayerID()] = tagPlayer.GetPlayerID()
+    return
+
+def __DoChuangong_ThanksGift(curPlayer, msgData):
+    itemID = msgData[0]
+    playerID = curPlayer.GetPlayerID()
+    tagPlayerID = PyGameData.g_chuangongTagPlayerDict.pop(playerID, 0)
+    GameWorld.DebugLog("__DoChuangong_ThanksGift tagPlayerID=%s" % tagPlayerID, playerID)
+    if not tagPlayerID:
+        return
+    curFamily = curPlayer.GetFamily()
+    if not curFamily:
+        return
+    tagMember = curFamily.FindMember(tagPlayerID)
+    if not tagMember:
+        return
+    assistPlayerDict = {tagPlayerID:{"PlayerName":tagMember.GetName(), "Job":tagMember.GetJob(), 
+                                     "LV":tagMember.GetLV(), "RealmLV":tagMember.GetOfficialRank(),
+                                     "Face":tagMember.GetFace(), "FacePic":tagMember.GetFacePic()}}
+    GameWorld.DebugLog("    assistPlayerDict %s" % assistPlayerDict, playerID)
+    PlayerAssist.AddNewAssistThanksEx(curPlayer, itemID, assistPlayerDict)
     return
 
 ##--------------------------------------------------------------------------------------------------
@@ -3772,7 +3845,7 @@
     fightPower = GetFamilyTotalFightPower(curFamily)
     value1 = fightPower / ChConfig.Def_PerPointValue
     value2 = fightPower % ChConfig.Def_PerPointValue
-    value3 = GetFamilyEmblem(curFamily)
+    value3 = GetFamilyEmblemID(curFamily)
     value4 = curFamily.GetLV()
     value5 = curFamily.GetServerID()
     return {"id":familyID, "name":name, "id2":id2, "name2":name2, "value1":value1, "value2":value2, 

--
Gitblit v1.8.0