| | |
| | | """Version = 2018-10-09 17:00"""
|
| | |
|
| | | import GameWorld
|
| | | import PlayerUniversalGameRec
|
| | | import ShareDefine
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | |
|
| | | RecType = ShareDefine.Def_UniversalGameRecType_StoreServerCntRecord
|
| | |
|
| | |
| | | # @param None
|
| | | # @return None
|
| | | def OnPlayerLogin(curPlayer):
|
| | | PlayerUniversalGameRec.SendUniversalGameRecInfo(curPlayer, RecType)
|
| | | SyncStoreServerBuyInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | if not findRecData:
|
| | | findRecData = recTypeListData.AddRec()
|
| | | findRecData.SetValue1(goodsID)
|
| | | findRecData.SetValue2(curGotCnt+buyCount)
|
| | | newBuyCnt = curGotCnt+buyCount
|
| | | findRecData.SetValue2(newBuyCnt)
|
| | | #֪ͨ
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetActivePlayerCount()):
|
| | | curPlayer = playerManager.GetActivePlayerAt(i)
|
| | | if curPlayer == None or not curPlayer.GetInitOK():
|
| | | continue
|
| | | if PlayerControl.GetIsTJG(curPlayer):
|
| | | continue
|
| | | PlayerUniversalGameRec.SendUniversalGameRecSingle(curPlayer, findRecData)
|
| | | |
| | | SyncStoreServerBuyInfo(None, {goodsID:newBuyCnt})
|
| | | return msgList
|
| | |
|
| | | def DoResetStoreServerBuyCnt(shopTypeList):
|
| | |
| | | recTypeListData = universalRecMgr.GetTypeList(RecType)
|
| | |
|
| | | delCnt = 0
|
| | | syncDict = {}
|
| | | for index in xrange(recTypeListData.Count()):
|
| | | dataIndex = index - delCnt
|
| | | recData = recTypeListData.At(dataIndex)
|
| | |
| | | continue
|
| | | if ipyData.GetShopType() not in shopTypeList:
|
| | | continue
|
| | | syncDict[curGoodsID] = 0
|
| | | recTypeListData.Delete(dataIndex)
|
| | | delCnt +=1
|
| | | |
| | | GameWorld.DebugLog(' 根据商店类型重置全服购买次数 shopTypeList=%s'%shopTypeList)
|
| | | if delCnt:
|
| | | PlayerUniversalGameRec.SendUniversalGameRecInfo(None, RecType)
|
| | | SyncStoreServerBuyInfo(None, syncDict)
|
| | | |
| | | return
|
| | |
|
| | |
|
| | |
| | | dayShopList = shopTypeList[dayIndex] if dayIndex < len(shopTypeList) else shopTypeList[-1]
|
| | | shopType = dayShopList[state-1] if state-1 < len(dayShopList) else dayShopList[-1]
|
| | | DoResetStoreServerBuyCnt([shopType])
|
| | | return
|
| | |
|
| | | def SyncStoreServerBuyInfo(curPlayer, syncCntDict={}):
|
| | | #通知商品全服购买次数
|
| | | sendPack = ChPyNetSendPack.tagGCStoreServerBuyCntInfo()
|
| | | sendPack.Clear()
|
| | | sendPack.InfoList = []
|
| | | if syncCntDict:
|
| | | for goodsID, buyCnt in syncCntDict.items():
|
| | | buyInfo = ChPyNetSendPack.tagGCStoreServerBuyCnt()
|
| | | buyInfo.GoodsID = goodsID
|
| | | buyInfo.BuyCnt = buyCnt
|
| | | sendPack.InfoList.append(buyInfo)
|
| | | else:
|
| | | universalRecMgr = GameWorld.GetUniversalRecMgr()
|
| | | recTypeListData = universalRecMgr.GetTypeList(RecType)
|
| | | for index in xrange(recTypeListData.Count()):
|
| | | recData = recTypeListData.At(index)
|
| | | buyInfo = ChPyNetSendPack.tagGCStoreServerBuyCnt()
|
| | | buyInfo.GoodsID = recData.GetValue1()
|
| | | buyInfo.BuyCnt = recData.GetValue2()
|
| | | sendPack.InfoList.append(buyInfo)
|
| | | sendPack.Count = len(sendPack.InfoList)
|
| | | if not curPlayer:
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetActivePlayerCount()):
|
| | | curPlayer = playerManager.GetActivePlayerAt(i)
|
| | | if curPlayer == None or not curPlayer.GetInitOK():
|
| | | continue
|
| | | if PlayerControl.GetIsTJG(curPlayer):
|
| | | continue
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | else:
|
| | | if PlayerControl.GetIsTJG(curPlayer):
|
| | | return
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return |