From c9cfdf6387d727672825e36a8d2d55554f13693e Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期五, 28 六月 2019 19:38:20 +0800
Subject: [PATCH] 7661 【后端】【2.0.200】屏蔽多余日志输出 7632 【后端】【2.0.200】缥缈仙域的boss和宝藏产出的妖丹开出等级配置

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py |  197 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 148 insertions(+), 49 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
index ef186a9..db95c3c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -38,12 +38,17 @@
 import ShareDefine
 import GameFuncComm
 import FBHelpBattle
-import ItemControler
+import SkillShell
 import PyGameData
+import PetControl
+import NPCCommon
 
 import time
 import math
 #---------------------------------------------------------------------
+def OnLogin(curPlayer):
+    NotifyBuyFBBuffInfo(curPlayer)
+    return
 
 ## 玩家副本行为封包 A5 08
 #  @param playerIndex 玩家索引  
@@ -449,65 +454,159 @@
     FBLogic.OnClientStartFB(curPlayer, tick)
     return
 
-
-#// B1 08 刷新自定义副本奖励 #tagCMRefreshCustomFBPrize
+#// A2 31 前端开始自定义场景 #tagCMClientStartCustomScene
 #
-#struct    tagCMRefreshCustomFBPrize
+#struct    tagCMClientStartCustomScene
 #{
-#    tagHead         Head;
+#    tagHead        Head;
 #    DWORD        MapID;
 #    WORD        FuncLineID;
 #};
-def OnRefreshCustomFBPrize(playerIndex, clientData, tick):
+def OnClientStartCustomScene(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    mapID = clientData.MapID
+    funcLineID = clientData.FuncLineID
+    DoEnterCustomScene(curPlayer, mapID, funcLineID, tick)
+    return
+
+#// A2 33 前端退出自定义场景 #tagCMClientExitCustomScene
+#
+#struct    tagCMClientExitCustomScene
+#{
+#    tagHead        Head;
+#};
+def OnClientExitCustomScene(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    DoExitCustomScene(curPlayer)
+    return
+
+def DoEnterCustomScene(curPlayer, mapID, lineID, tick):
+    ## 进入自定义场景状态
+    playerID = curPlayer.GetPlayerID()
+    GameWorld.Log("玩家请求进入自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
+    if curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomScene):
+        curMapID = PlayerControl.GetCustomMapID(curPlayer)
+        curLineID = PlayerControl.GetCustomLineID(curPlayer)
+        if mapID == curMapID and lineID == curLineID:
+            GameWorld.Log("    玩家当前已经在自定义场景中!无需重新请求!", playerID)
+            result = 1
+        else:
+            GameWorld.Log("    玩家当前在不同的自定义场景中!不允许进入!curMapID=%s,curLineID=%s" 
+                          % (curMapID, curLineID), playerID)
+            result = 0
+        StartCustomSceneResult(curPlayer, mapID, lineID, result)
+        return
+    
+    #进入副本通用检查
+    if mapID:
+        fbIpyData = FBCommon.GetFBIpyData(mapID)
+        fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
+        if PlayerControl.CheckMoveToFB(curPlayer, mapID, lineID, fbIpyData, fbLineIpyData, tick) != ShareDefine.EntFBAskRet_OK:
+            StartCustomSceneResult(curPlayer, mapID, lineID, 0)
+            return
+    
+    PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
+        
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
+    PlayerControl.SetCustomMap(curPlayer, mapID, lineID)
+    NPCCommon.ClearPriWoodPile(curPlayer)
+    GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
+    if mapID:
+        PetControl.DoLogic_PetLoadMapOK(curPlayer)
+        FBLogic.OnEnterCustomScene(curPlayer, mapID, lineID)
+        
+    #通知进入状态
+    StartCustomSceneResult(curPlayer, mapID, lineID, 1)
+    return
+
+def StartCustomSceneResult(curPlayer, mapID, lineID, result):
+    if result != 1:
+        DoExitCustomScene(curPlayer)
+    resultPack = ChPyNetSendPack.tagMCStartCustomSceneResult()
+    resultPack.MapID = mapID
+    resultPack.FuncLineID = lineID
+    resultPack.Result = result
+    NetPackCommon.SendFakePack(curPlayer, resultPack)
+    return
+
+def DoExitCustomScene(curPlayer):
+    ## 退出自定义场景状态
+    PlayerControl.SetPlayerSightLevel(curPlayer, 0)
+    mapID = PlayerControl.GetCustomMapID(curPlayer)
+    lineID = PlayerControl.GetCustomLineID(curPlayer)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
+    PlayerControl.SetCustomMap(curPlayer, 0, 0)
+    if mapID and FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Over:
+        FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Over)
+    NPCCommon.ClearPriWoodPile(curPlayer)
+    GameWorld.Log("玩家退出自定义场景!", curPlayer.GetPlayerID())
+    return
+
+#// B1 0A 副本购买buff #tagCMFBBuyBuff
+#struct    tagCMFBBuyBuff
+#{
+#    tagHead         Head;
+#    DWORD        MapID;
+#    WORD        MoneyCnt;
+#};
+def OnFBBuyBuff(playerIndex, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
     playerID = curPlayer.GetPlayerID()
     mapID = clientData.MapID
-    funcLineID = clientData.FuncLineID
-    prizeItemList = FBLogic.OnRefreshCustomFBPrize(curPlayer, mapID, funcLineID)
-    if not prizeItemList:
+    moneyCnt = clientData.MoneyCnt
+    ipyData = IpyGameDataPY.GetIpyGameData('FBBuyBuff', mapID, moneyCnt)
+    if not ipyData:
         return
-    PyGameData.g_customFBPrizeInfo[playerID] = [mapID, funcLineID, prizeItemList]
-    prizePack = ChPyNetSendPack.tagMCCuntomFBPrizeInfo()
-    prizePack.MapID = mapID
-    prizePack.FuncLineID = funcLineID
-    prizePack.PrizeItemList = []
-    for prizeItemInfo in prizeItemList:
-        itemID, itemCount, isAuctionItem, userData = ItemControler.GetItemInfo(prizeItemInfo)
-        if not itemID:
-            continue
-        prizeItem = ChPyNetSendPack.tagMCCuntomFBPrizeItem()
-        prizeItem.ItemID = itemID
-        prizeItem.Count = itemCount
-        prizeItem.IsAuctionItem = isAuctionItem
-        prizeItem.UserData = userData
-        prizeItem.UserDataLen = len(prizeItem.UserData)
-        prizePack.PrizeItemList.append(prizeItem)
-    prizePack.PrizeItemCount = len(prizePack.PrizeItemList)
-    NetPackCommon.SendFakePack(curPlayer, prizePack)
+    addBuffID = ipyData.GetBuffID()
+    curSkill = GameWorld.GetGameData().GetSkillBySkillID(addBuffID)
+    if not curSkill:
+        return
+    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
+    if crossMapID and mapID !=crossMapID:
+        return
+    if not crossMapID and mapID != GameWorld.GetMap().GetMapID():
+        return
+    
+    curTime = int(time.time())
+    #判断CD 
+    timeKey = (mapID, moneyCnt)
+    lastTime = PyGameData.g_fbBuyBuffTimeDict.get(playerID, {}).get(timeKey, 0)
+    if lastTime and curTime - lastTime < ipyData.GetBuffCD():
+        GameWorld.DebugLog('副本购买buff CD未到 ')
+        return
+
+    #扣钱
+    infoDict =  {"MapID":mapID, "addBuffID":addBuffID}
+    if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, moneyCnt, ChConfig.Def_Cost_FBBuyBuff, infoDict):
+        return
+    if playerID not in PyGameData.g_fbBuyBuffTimeDict:
+        PyGameData.g_fbBuyBuffTimeDict[playerID] = {}
+    PyGameData.g_fbBuyBuffTimeDict[playerID][timeKey] = curTime
+    NotifyBuyFBBuffInfo(curPlayer)
+    if crossMapID:
+        msgDict = {"PlayerID":curPlayer.GetPlayerID(), "buffID":addBuffID}
+        GameWorld.SendMsgToCrossServer(ShareDefine.ClientServerMsg_AddBuff, msgDict)
+        GameWorld.DebugLog("跨服中请求复活, crossMapID=%s,msgDict=%s" % (crossMapID, msgDict), playerID)
+        return
+
+    SkillShell.__DoLogic_AddBuff(curPlayer, curPlayer, curSkill, False, tick, 0, 0)
+    #SkillCommon.AddBuffBySkillType(curPlayer, addBuffID, tick)
     return
 
-
-#// B1 09 结算自定义副本奖励 #tagCMGiveCustomFBPrize
-#
-#struct    tagCMGiveCustomFBPrize
-#{
-#    tagHead         Head;
-#    DWORD        MapID;
-#    WORD        FuncLineID;
-#};
-def OnGiveCustomFBPrize(playerIndex, clientData, tick):
-    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(playerIndex)
+def NotifyBuyFBBuffInfo(curPlayer):
     playerID = curPlayer.GetPlayerID()
-    packMapID = clientData.MapID
-    packFuncLineID = clientData.FuncLineID
-    prizeInfo = PyGameData.g_customFBPrizeInfo.pop(playerID, None)
-    if not prizeInfo:
+    buffTimeDict = PyGameData.g_fbBuyBuffTimeDict.get(playerID, {})
+    if not buffTimeDict:
         return
-    mapID, funcLineID, prizeItemList = prizeInfo
-    if mapID != packMapID or funcLineID != packFuncLineID:
-        return
-    FBLogic.OnGiveCustomFBPrizeOK(curPlayer, mapID, funcLineID)
-    ItemControler.GivePlayerItemOrMail(curPlayer, prizeItemList)
+    packData = ChPyNetSendPack.tagMCFBBuyBuffInfo()
+    packData.InfoList = []
+    for timeKey, buyTime in buffTimeDict.items():
+        mapID, moneyCnt = timeKey
+        timeInfo = ChPyNetSendPack.tagMCFBBuyBuffTime()
+        timeInfo.MapID = mapID
+        timeInfo.MoneyCnt = moneyCnt
+        timeInfo.BuyTime = buyTime
+        packData.InfoList.append(timeInfo)
+    packData.Cnt = len(packData.InfoList)
+    NetPackCommon.SendFakePack(curPlayer, packData)
     return
-
-

--
Gitblit v1.8.0