From 69af48cc1a7c0a6b71b3464b15bd8ffba4958b5c Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 22 十一月 2018 20:42:32 +0800
Subject: [PATCH] 4919 [主干]增加玩家战力流向记录
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py | 171 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 108 insertions(+), 63 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 11882e1..b14d26d 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
@@ -69,6 +69,7 @@
import random
import math
+import time
#---------------------------------------------------------------------
##开始交易
# @param curPlayer 玩家实例
@@ -191,6 +192,14 @@
## 登录
def ShopItemOnLogin(curPlayer):
+ if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_SuperGift):
+ GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_SuperGift, 1)
+ isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftFirstRecord)
+ if isGet:#首充奖励已领取则代表超值礼包已开启过,
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftHasOpen, 1)
+
+
+ SyncMysticalShopInfo(curPlayer)
SyncShopItemTodayBuyCount(curPlayer)
SyncSuperGiftInfo(curPlayer)
return
@@ -201,7 +210,6 @@
def ShopItemOnDay(curPlayer, onEventType):
if onEventType == ShareDefine.Def_OnEventType:
UpdataSuperGiftTime(curPlayer, True)
- SyncSuperGiftInfo(curPlayer)
OSSaleOpenMail(curPlayer)
refreshType = [3]
elif onEventType == ShareDefine.Def_OnEventTypeEx:
@@ -272,6 +280,49 @@
syncIndexList.append(shopItem.GetID())
if syncIndexList:
SyncShopItemTodayBuyCount(curPlayer, syncIndexList, True)
+ return
+
+def MysticalShopOpen(curPlayer, befLV, aftLV):
+ ##神秘限购开启
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('Store', {'ShopType':16}, True)
+ if not ipyDataList:
+ return
+ curTime = int(time.time())
+ syncGoodsList = []
+ for ipyData in ipyDataList:
+ limitLV = ipyData.GetLimitLV()
+ if befLV < limitLV and aftLV >= limitLV:
+ goodsID = ipyData.GetID()
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopItemStartTime % goodsID, curTime)
+ syncGoodsList.append(goodsID)
+ GameWorld.DebugLog('神秘限购商品%s 开卖'%goodsID, curPlayer.GetID())
+ if syncGoodsList:
+ SyncMysticalShopInfo(curPlayer)
+ return
+
+def SyncMysticalShopInfo(curPlayer):
+ ##神秘限购通知
+ packData = ChPyNetSendPack.tagMCMysticalShopTimeInfo()
+ packData.ShopTimeList = []
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('Store', {'ShopType':16}, True)
+ curTime = int(time.time())
+ for ipyData in ipyDataList:
+ goodsID = ipyData.GetID()
+ startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % goodsID)
+ if not startTime:
+ continue
+ if curTime - startTime >= ipyData.GetLimitValue():
+ #超时的重置
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopItemStartTime % goodsID, 0)
+ else:
+ goodsTime = ChPyNetSendPack.tagMCMysticalShopTime()
+ goodsTime.GoodsID = goodsID
+ goodsTime.StartTime = startTime
+ packData.ShopTimeList.append(goodsTime)
+ if not packData.ShopTimeList:
+ return
+ packData.Count = len(packData.ShopTimeList)
+ NetPackCommon.SendFakePack(curPlayer, packData)
return
## 回购物品
@@ -452,12 +503,18 @@
GameWorld.DebugLog("购买物品: shopType=%s,itemIndex=%s,clientBuyCount=%s,totalItemList=%s,mainItemID=%s,needPackSpaceDict=%s"
% (shopType, itemIndex, clientBuyCount, totalItemList, mainItemID, needPackSpaceDict), curPlayer.GetPlayerID())
-
+ mailKey = ipyData.GetMailKey()
+ isLackPack = False #是否背包不足
for packType, needSpace in needPackSpaceDict.items():
if needSpace > ItemCommon.GetItemPackSpace(curPlayer, packType, needSpace):
- curPlayer.ShopResult(itemIndex, IPY_GameWorld.tsrNoPlace)
- PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packType])
- return
+ isLackPack = True
+ if mailKey:
+ break
+ else:
+ curPlayer.ShopResult(itemIndex, IPY_GameWorld.tsrNoPlace)
+ PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [packType])
+ return
+ sendMailKey = mailKey if isLackPack and mailKey else '' #背包不足且配置了mailKey的才发邮件
# 购买限制条件扩展
if CheckBuyItemLimitEx(curPlayer, shopType, itemIndex, mainItemID, ipyData.GetLimitValue()):
@@ -473,21 +530,22 @@
#已经在查询中, 不重复查询
GameWorld.DebugLog("全服购买次数已经在查询中, 不重复查询 itemIndex=%s" % itemIndex)
return
- cmdStr = '%s' % ([itemIndex, serverLimitCnt, clientBuyCount, totalItemList, mainItemID, limitBuyCnt])
+ cmdStr = '%s' % ([itemIndex, serverLimitCnt, clientBuyCount, totalItemList, mainItemID, limitBuyCnt, sendMailKey])
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0,
"GetStoreServerBuyCnt", cmdStr, len(cmdStr))
#设置状态查询中
curPlayer.SetDict(ChConfig.Def_PlayerKey_StoreQueryState, 1)
return
#-------------------------开始购买物品-----------------------------
- DoBuyStoreItem(curPlayer, itemIndex, clientBuyCount, totalItemList, mainItemID, limitBuyCnt, ipyData)
+ DoBuyStoreItem(curPlayer, itemIndex, clientBuyCount, totalItemList, mainItemID, limitBuyCnt, sendMailKey, ipyData)
return
-def DoBuyStoreItem(curPlayer, itemIndex, clientBuyCount, totalItemList, mainItemID, limitBuyCnt, ipyData=None):
+def DoBuyStoreItem(curPlayer, itemIndex, clientBuyCount, totalItemList, mainItemID, limitBuyCnt, sendMailKey, ipyData=None):
if not ipyData:
ipyData = IpyGameDataPY.GetIpyGameData("Store", itemIndex)
priceType, itemPrice = ipyData.GetMoneyType(), ipyData.GetMoneyNum()
+ itemPrice *= clientBuyCount
shopType = ipyData.GetShopType()
beforeMoney = PlayerControl.GetMoney(curPlayer, priceType)
@@ -508,31 +566,32 @@
"ItemPrice":itemPrice, "MoneyType":priceType,
"BeforeMoney":beforeMoney, "AfterMoney":afterMoney}
isForceEvent = priceType not in [IPY_GameWorld.TYPE_Price_Silver_Money]
-
+
itemControl = ItemControler.PlayerItemControler(curPlayer)
for itemID, itemCount, isBind in totalItemList:
curItemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, isBind)
if not curItemObj:
continue
userData = curItemObj.GetUserData()
- packType = ChConfig.GetItemPackType(curItemObj.GetType())
- if not itemControl.PutInItem(packType, curItemObj, event=[ChConfig.ItemGive_BuyItem, isForceEvent, dataDict]):
+ if not sendMailKey:
+ packType = ChConfig.GetItemPackType(curItemObj.GetType())
+ if not itemControl.PutInItem(packType, curItemObj, event=[ChConfig.ItemGive_BuyItem, isForceEvent, dataDict]):
+ curItemObj.Clear()
+ continue
+ else:
curItemObj.Clear()
- continue
-
EventShell.EventRespons_BuyItem(curPlayer, itemID, itemCount)
if ipyData.GetNotifyMark() and itemID == mainItemID:
PlayerControl.WorldNotify(0, ipyData.GetNotifyMark(), [curPlayer.GetName(), mainItemID, userData])
-
+ 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 dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
- UpdataSuperGiftTime(curPlayer)
return
def __GetShopJobItem(job, itemID, jobItemList):
@@ -578,8 +637,13 @@
if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
- if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
- return not CheckSuperGiftBuy(curPlayer, itemIndex)
+# if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
+# return not CheckSuperGiftBuy(curPlayer, itemIndex)
+ if shopNPCID == 16:#神秘限购
+ startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % itemIndex)
+ curTime = int(time.time())
+ return not startTime or curTime - startTime >= limitValue
+
#
# limitPlusDict = {shopItem.GetLimitPlusType1():shopItem.GetLimitPlusValue1(),
# shopItem.GetLimitPlusType2():shopItem.GetLimitPlusValue2(),
@@ -619,67 +683,48 @@
#超值礼包购买时间
def UpdataSuperGiftTime(curPlayer, isOnday=False):
- superGiftData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftData)
- giftIndex, startDay = superGiftData%10, superGiftData/10
- superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
- if giftIndex >= len(superGiftTimeList):
- return
- if isOnday and not giftIndex:
- return
- openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
- newIndex = giftIndex
+ curTime = int(time.time())
if isOnday:
- lastDays = 0
- pastDay = openServerDay - startDay
- for i in xrange(giftIndex-1, len(superGiftTimeList)):
- lastDays += superGiftTimeList[i][1]
- if pastDay < lastDays:
- break
- if pastDay >= lastDays:
- newIndex = i+2
-
+ 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:
- newIndex = min(len(superGiftTimeList), giftIndex+1)
+ if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftHasOpen):
+ #老号已开启过超值礼包则不再开启
+ return
- if newIndex == giftIndex:
- return
-
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftData, openServerDay*10+newIndex)
- #通知
- if not isOnday:
- SyncSuperGiftInfo(curPlayer)
- if newIndex == 1:
+ 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):
- superGiftData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftData)
- giftIndex, startDay = superGiftData%10, superGiftData/10
- superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
- if giftIndex == 0 or giftIndex > len(superGiftTimeList):
+ startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
+ if not startTime:
return
- giftID, day = superGiftTimeList[giftIndex-1]
- openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
- remainDay = max(0, day - openServerDay+startDay)-1
-
packData = ChPyNetSendPack.tagMCSuperGiftInfo()
- packData.GiftID = giftID
- packData.EndtDate = str(GameWorld.GetDatetimeByDiffDays(remainDay))[:10]
+ packData.StartTime = startTime
NetPackCommon.SendFakePack(curPlayer, packData)
return
def CheckSuperGiftBuy(curPlayer, giftID):
#超值礼包是否可购买
- superGiftData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftData)
- giftIndex, startDay = superGiftData%10, superGiftData/10
- superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
- if giftIndex == 0 or giftIndex > len(superGiftTimeList):
+ startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftStartTime)
+ if not startTime:
return
- curGiftID, day = superGiftTimeList[giftIndex-1]
- if giftID != curGiftID:
+
+ superGiftTimeDict = dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList'))
+ totalDay = superGiftTimeDict.get(giftID, 0)
+ if not totalDay:
return
- openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
- if not max(0, day - openServerDay+startDay):
+ curTime = int(time.time())
+ if (curTime - startTime)/86400 >= totalDay:
+ #已结束
return
return True
--
Gitblit v1.8.0