From 8a9416e0fe494446f5aa121b9b5c05abebf5c6b9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 01 九月 2018 17:55:28 +0800
Subject: [PATCH] Add: A4 12 搜索家族支持;

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

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
index db968a2..a8b7c46 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFamily.py
@@ -665,6 +665,47 @@
     NetPackCommon.SendFakePack(curPlayer, familyViewPack)
     return
 
+#// A4 12 搜索家族 #tagCGPySearchFamily
+#
+#struct    tagCGPySearchFamily
+#{
+#    tagHead        Head;
+#    BYTE        MsgLen;        //模糊搜索家族,如果输入为空,则为不限制该条件
+#    char        Msg[MsgLen];    //size = MsgLen
+#    BYTE        LV;        //最低家族等级,如果为0,则不限制该条件
+#    BYTE        MaxCount;    //搜索结果所需最大条数,后端限制最多返回20条
+#    BYTE        IsSearching;    //默认1,如果有指定其他值,则返回指定值
+#};
+def PySearchFamily(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    
+    msg = clientData.Msg
+    minFamilyLV = clientData.LV
+    maxCount = min(20, clientData.MaxCount)
+    IsSearching = clientData.IsSearching
+    
+    familyMgr = GameWorld.GetFamilyManager()
+    familyViewPack = ChPyNetSendPack.tagGCPyAllFamilyView()
+    familyViewPack.Clear()
+    familyViewPack.IsSearching = IsSearching
+    familyViewPack.TotalCount = 1
+    #familyViewPack.CurPage = viewPage
+    familyViewPack.Family = []
+    for i, familyID in enumerate(PyGameData.g_sortFamilyIDList):
+        family = familyMgr.FindFamily(familyID)
+        if not family:
+            continue
+        if msg not in family.GetName():
+            continue
+        if minFamilyLV and family.GetLV() < minFamilyLV:
+            continue
+        familyViewPack.Family.append(__GetFamilyView(i, family))
+        if len(familyViewPack.Family) >= maxCount:
+            break
+    familyViewPack.PageCount = len(familyViewPack.Family)
+    NetPackCommon.SendFakePack(curPlayer, familyViewPack)
+    return
+
 #class   IPY_CFamilyChangeBroadcast
 #{
 #public:

--
Gitblit v1.8.0