From a71b91377eae9f9e497ae25ca25fdcd85ef99528 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 12 二月 2020 16:23:31 +0800
Subject: [PATCH] 8353 【后端】个人BOSS修改(支持免费进入也可增加活跃、成就等额外逻辑,只是不加进入次数)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py |   91 +++++++++++++++------------------------------
 1 files changed, 31 insertions(+), 60 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index 55e9563..7dedfe8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -72,6 +72,9 @@
 import math
 import time
 
+# 商店类型定义
+ShopType_FairyCeremony = 19 # 仙界盛典烟花
+
 g_mysticalShopDict = {} #神秘商店{等级范围:[等级段,{金钱类型:库}]}
 #---------------------------------------------------------------------
 ##开始交易
@@ -197,7 +200,6 @@
 def ShopItemOnLogin(curPlayer):    
     SyncMysticalLimitShopInfo(curPlayer)
     SyncShopItemTodayBuyCount(curPlayer)
-    SyncSuperGiftInfo(curPlayer)
     if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MysticalShopGoods % 0):
         __DoMysticalShopRefresh(curPlayer, True, GameWorld.GetGameWorld().GetTick())
     SyncMysticalShopInfo(curPlayer)
@@ -208,7 +210,6 @@
 # @return 
 def ShopItemOnDay(curPlayer, onEventType):
     if onEventType == ShareDefine.Def_OnEventType:
-        UpdataSuperGiftTime(curPlayer, True)
         OSSaleOpenMail(curPlayer)
         refreshType = [3]
         #神秘商店刷新次数重置
@@ -372,7 +373,10 @@
 
 def __DoMysticalShopRefresh(curPlayer, isFree, tick):
     global g_mysticalShopDict #{等级范围:[等级段,{金钱类型:库}]}
-    
+    refreshTime = IpyGameDataPY.GetFuncCfg('MysteryShopRefresh', 4)
+    if not refreshTime:
+        return
+
     lastTime = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MysticalShopLastTime)
     if lastTime and tick - lastTime < 1000:
         #GameWorld.DebugLog('神秘商店刷新,过于频繁!')
@@ -397,7 +401,8 @@
                 g_mysticalShopDict[lvkey][1][moneyType] = []
             weightDict[moneyType] = weightDict.get(moneyType, 0) + weight
             g_mysticalShopDict[lvkey][1][moneyType].append([weightDict[moneyType], goodsID])
-            
+    if not g_mysticalShopDict:
+        return 
     playerLV = curPlayer.GetLV()
     curLVDan, shopDict = GameWorld.GetDictValueByRangeKey(g_mysticalShopDict, playerLV)
     if not shopDict:
@@ -675,7 +680,7 @@
     sendMailKey = mailKey if isLackPack and mailKey else '' #背包不足且配置了mailKey的才发邮件
         
     # 购买限制条件扩展
-    if CheckBuyItemLimitEx(curPlayer, shopType, itemIndex, mainItemID, ipyData.GetLimitValue()):
+    if CheckBuyItemLimitEx(curPlayer, shopType, itemIndex, mainItemID, ipyData.GetLimitValue(), clientBuyCount):
         GameWorld.Log("Store shop item buy limit! shopType=%s,itemIndex=%s,limitValue=%s" 
                       % (shopType, itemIndex, ipyData.GetLimitValue()), curPlayer.GetPlayerID())
         return
@@ -742,17 +747,24 @@
         
         if ipyData.GetNotifyMark() and itemID == mainItemID:
             PlayerControl.WorldNotify(0, ipyData.GetNotifyMark(), [curPlayer.GetName(), mainItemID, userData])
+            
+        # 购买永久守护时删除限时守护
+        if itemID == 4101:
+            delGuardItem = ItemCommon.FindItemInPackByItemID(curPlayer, 4105, IPY_GameWorld.rptItem)
+            if delGuardItem:
+                ItemCommon.DelItem(curPlayer, delGuardItem, 1)
+                
     if sendMailKey:
         PlayerControl.SendMailByKey(sendMailKey, [curPlayer.GetID()], totalItemList, detail=dataDict)
     #触发任务购买物品
     EventShell.EventRespons_ShopBuy(curPlayer, shopType)
     #curPlayer.ShopResult(itemIndex, IPY_GameWorld.tsrShopOK)
     SyncShoppingResult(curPlayer, itemIndex, clientBuyCount)
-    if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
-        PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
-    if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
-        PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
     
+    if shopType == ShopType_FairyCeremony:
+        PlayerFairyCeremony.OnBuyFireworks(curPlayer, itemIndex, clientBuyCount)
+#    if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
+#        PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
     return
 
 def GetShopJobItem(job, itemID, jobItemList):
@@ -779,7 +791,7 @@
 ## 商店购买物品限制条件扩展
 #  @param curPlayer 玩家实例
 #  @return 
-def CheckBuyItemLimitEx(curPlayer, shopNPCID, itemIndex, curItemID, limitValue):
+def CheckBuyItemLimitEx(curPlayer, shopNPCID, itemIndex, curItemID, limitValue, clientBuyCount):
     if shopNPCID == 7: #符印商店
         return not PlayerRune.GetIsOpenByRuneID(curPlayer, curItemID)
     if shopNPCID in [8, 9, 10]: #仙盟商店
@@ -794,13 +806,15 @@
         #playerCreateRoleDays = GameWorld.GetCreateRoleDays(curPlayer)
         openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
         return openServerDay != limitValue
-    #烟花狂欢
-    if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
-        return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
-    if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
-        return not PlayerNewFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
-#    if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
-#        return not CheckSuperGiftBuy(curPlayer, itemIndex)
+    
+    #仙界盛典 - 烟花狂欢
+    if shopNPCID == ShopType_FairyCeremony:
+        return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex, clientBuyCount)
+    
+    #另一个仙界盛典可用其他商店NPCID,这里先注释,之后再改
+#    if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
+#        return not PlayerNewFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
+    
     if shopNPCID == 16:#神秘限购
         startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % itemIndex)
         curTime = int(time.time())
@@ -843,49 +857,6 @@
     PlayerControl.SendMailByKey('SellMail1', [curPlayer.GetID()], addItemList)
     return
 
-#超值礼包购买时间
-def UpdataSuperGiftTime(curPlayer, isOnday=False):
-    curTime = int(time.time())
-    if isOnday:
-        startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
-        if not startTime:
-            return
-        superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
-        maxDay = max([info[1] for info in superGiftTimeList])
-        if curTime - startTime >= maxDay * 86400:
-            #活动结束 重置
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftStartTime, 0)
-    else:
-              
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftStartTime, curTime)
-        addItemList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList', 2)
-        PlayerControl.SendMailByKey('SellMail2', [curPlayer.GetID()], addItemList)
-        SyncSuperGiftInfo(curPlayer)
-    return True
-
-def SyncSuperGiftInfo(curPlayer):
-    startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
-    if not startTime:
-        return
-    packData = ChPyNetSendPack.tagMCSuperGiftInfo()
-    packData.StartTime = startTime
-    NetPackCommon.SendFakePack(curPlayer, packData)
-    return
-def CheckSuperGiftBuy(curPlayer, giftID):
-    #超值礼包是否可购买
-    startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
-    if not startTime:
-        return
-    
-    superGiftTimeDict = dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList'))
-    totalDay = superGiftTimeDict.get(giftID, 0)
-    if not totalDay:
-        return
-    curTime = int(time.time())
-    if (curTime - startTime)/86400 >= totalDay:
-        #已结束
-        return
-    return True
 
 ## 商店npcid
 #  @param curPlayer 玩家实例

--
Gitblit v1.8.0