From fba7745533989fc514ce7a8e9edc8017abd2d69e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 29 四月 2019 17:09:33 +0800
Subject: [PATCH] 6661 【后端】【2.0】战斗需要木桩

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   61 ++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index b5607c5..30c0148 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -1940,6 +1940,67 @@
         
     return
 
+#// B4 0C 召唤私有专属木桩怪 #tagCMSummonPriWoodPile
+#
+#struct    tagCMSummonPriWoodPile
+#{
+#    tagHead        Head;
+#    DWORD        NPCID;
+#    BYTE        Count;    //默认1个,最多5个
+#};
+def OnSummonPriWoodPile(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    npcID = clientData.NPCID
+    count = clientData.Count
+    SummonPriWoodPile(curPlayer, npcID, count)
+    return
+
+def SummonPriWoodPile(curPlayer, npcID, count):
+    ''' 召唤私有专属木桩怪
+    '''
+    
+    maxCount = 5
+    nowCount = 0
+    # 只允许存在一个私有木桩
+    indexList = range(curPlayer.GetSummonCount())
+    for index in indexList[::-1]:
+        summonNPC = curPlayer.GetSummonNPCAt(index)
+        if not summonNPC:
+            continue
+        npcType = summonNPC.GetType()
+        if npcType not in [ChConfig.ntPriWoodPilePVE, ChConfig.ntPriWoodPilePVP]:
+            continue
+        if nowCount >= maxCount or summonNPC.GetNPCID() != npcID:
+            SetDeadEx(summonNPC)
+        else:
+            nowCount += 1
+            
+    summonCount = min(count, maxCount - nowCount)
+    #GameWorld.DebugLog("召唤: count=%s,maxCount=%s,nowCount=%s,summonCount=%s" 
+    #                   % (count, maxCount, nowCount, summonCount))
+    if summonCount <= 0:
+        return
+    
+    for _ in xrange(summonCount):
+        summonNPC = curPlayer.SummonNewNPC()
+        
+        #设置召唤兽基础信息
+        summonNPC.SetNPCTypeID(npcID)
+        #初始化
+        InitNPC(summonNPC)
+        
+        #玩家召唤兽列表添加召唤兽,召唤兽添加主人
+        summonNPC.SetOwner(curPlayer)
+        summonNPC.SetDict(ChConfig.Def_NPC_Dict_SummonMapNPCPlayerID, curPlayer.GetPlayerID())
+        
+        #将召唤兽召唤出来
+        #玩家周围随机出生点
+        #技能召唤坐标 ChConfig.Def_SummonAppearDist
+        summonPos = GameMap.GetEmptyPlaceInArea(curPlayer.GetPosX(), curPlayer.GetPosY(), 3)
+        summonNPC.Reborn(summonPos.GetPosX(), summonPos.GetPosY())
+        
+    return
+
 ## 设置npc死亡及自身处理(请不要将游戏逻辑加在此函数中)
 #  @param curNPC:npc实例
 #  @return 

--
Gitblit v1.8.0