提交 | 用户 | age
|
3d7649
|
1 |
#!/usr/bin/python
|
H |
2 |
# -*- coding: GBK -*-
|
|
3 |
#-------------------------------------------------------------------------------
|
|
4 |
#
|
|
5 |
##@package Player.PlayerFeastWish
|
|
6 |
#
|
|
7 |
# @todo:节日祝福
|
|
8 |
# @author hxp
|
|
9 |
# @date 2021-01-29
|
|
10 |
# @version 1.0
|
|
11 |
#
|
|
12 |
# 详细描述: 节日祝福
|
|
13 |
#
|
|
14 |
#-------------------------------------------------------------------------------
|
|
15 |
#"""Version = 2021-01-29 11:30"""
|
|
16 |
#-------------------------------------------------------------------------------
|
|
17 |
|
|
18 |
import ItemCommon
|
|
19 |
import PyGameData
|
|
20 |
import ShareDefine
|
|
21 |
import PlayerControl
|
|
22 |
import IpyGameDataPY
|
|
23 |
import ItemControler
|
|
24 |
import ChPyNetSendPack
|
|
25 |
import IPY_GameWorld
|
|
26 |
import NetPackCommon
|
|
27 |
import GameWorld
|
|
28 |
import ChConfig
|
|
29 |
|
|
30 |
import random
|
|
31 |
|
|
32 |
def OnPlayerLogin(curPlayer):
|
|
33 |
isReset = __CheckPlayerFeastWishAction(curPlayer)
|
|
34 |
if not isReset:
|
|
35 |
actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
|
|
36 |
# 活动中同步活动信息
|
|
37 |
if actInfo.get(ShareDefine.ActKey_State):
|
|
38 |
Sync_FeastWishActionInfo(curPlayer)
|
|
39 |
Sync_FeastWishPlayerInfo(curPlayer)
|
|
40 |
return
|
|
41 |
|
|
42 |
def RefreshFeastWishActionInfo():
|
|
43 |
## 收到GameServer同步的活动信息,刷新活动信息
|
|
44 |
playerManager = GameWorld.GetPlayerManager()
|
|
45 |
for index in xrange(playerManager.GetPlayerCount()):
|
|
46 |
curPlayer = playerManager.GetPlayerByIndex(index)
|
8f7a29
|
47 |
if not GameWorld.IsNormalPlayer(curPlayer):
|
3d7649
|
48 |
continue
|
H |
49 |
__CheckPlayerFeastWishAction(curPlayer)
|
|
50 |
return
|
|
51 |
|
|
52 |
def __CheckPlayerFeastWishAction(curPlayer):
|
|
53 |
## 检查玩家活动信息
|
|
54 |
|
|
55 |
playerID = curPlayer.GetPlayerID()
|
|
56 |
|
|
57 |
actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
|
|
58 |
actID = actInfo.get(ShareDefine.ActKey_ID, 0)
|
|
59 |
state = actInfo.get(ShareDefine.ActKey_State, 0)
|
|
60 |
|
e302b9
|
61 |
templateID = __GetWishTemplateID()
|
3d7649
|
62 |
playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishID) # 玩家身上的活动ID
|
e302b9
|
63 |
playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishTemplateID) # 玩家身上的模板ID
|
3d7649
|
64 |
# 活动ID 相同的话不处理
|
H |
65 |
if actID == playerActID:
|
|
66 |
GameWorld.DebugLog("节日祝福活动ID不变,不处理!", curPlayer.GetPlayerID())
|
e302b9
|
67 |
if state:
|
H |
68 |
if templateID and templateID != playerTemplateID:
|
|
69 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishTemplateID, templateID)
|
3d7649
|
70 |
return
|
e302b9
|
71 |
GameWorld.DebugLog("节日祝福活动重置! actID=%s,playerActID=%s,state=%s,templateID=%s,playerTemplateID=%s"
|
H |
72 |
% (actID, playerActID, state, templateID, playerTemplateID), playerID)
|
3d7649
|
73 |
|
H |
74 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishID, actID)
|
e302b9
|
75 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishTemplateID, templateID)
|
H |
76 |
if playerTemplateID:
|
|
77 |
__SendWishBottleItemMail(curPlayer, playerTemplateID)
|
|
78 |
|
3d7649
|
79 |
bottleNumList = GetWishBottleNumList()
|
H |
80 |
for bottleNum in bottleNumList:
|
|
81 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, 0)
|
|
82 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, 0)
|
|
83 |
|
e302b9
|
84 |
if state:
|
H |
85 |
Sync_FeastWishActionInfo(curPlayer)
|
|
86 |
Sync_FeastWishPlayerInfo(curPlayer)
|
3d7649
|
87 |
return True
|
e302b9
|
88 |
|
H |
89 |
def __SendWishBottleItemMail(curPlayer, playerTemplateID):
|
|
90 |
# 未领取的奖励邮件发放
|
|
91 |
|
|
92 |
if not playerTemplateID:
|
|
93 |
return
|
|
94 |
|
|
95 |
bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", playerTemplateID)
|
|
96 |
if not bottleIpyDataList:
|
|
97 |
return
|
|
98 |
|
|
99 |
playerID = curPlayer.GetPlayerID()
|
|
100 |
batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
|
|
101 |
for ipyData in bottleIpyDataList:
|
|
102 |
bottleNum = ipyData.GetWishBottleNum()
|
|
103 |
choosePrizeItemDict = ipyData.GetChoosePrizeItem()
|
|
104 |
|
|
105 |
curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
|
|
106 |
getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
|
|
107 |
|
|
108 |
getIndexList = []
|
|
109 |
for recordIndex in choosePrizeItemDict.keys():
|
|
110 |
if getState & pow(2, recordIndex):
|
|
111 |
getIndexList.append(recordIndex)
|
|
112 |
|
|
113 |
getTimes = len(getIndexList)
|
|
114 |
maxTimes = ipyData.GetChooseTimeMax()
|
|
115 |
if getTimes >= maxTimes:
|
|
116 |
continue
|
|
117 |
|
|
118 |
needGiveTimes = min(maxTimes - getTimes, curWishValue / ipyData.GetNeedWishValue())
|
|
119 |
if not needGiveTimes:
|
|
120 |
continue
|
|
121 |
|
|
122 |
awardItemList = []
|
|
123 |
for recordIndex, itemInfo in choosePrizeItemDict.items():
|
|
124 |
if recordIndex in getIndexList:
|
|
125 |
continue
|
|
126 |
awardItemList.append(itemInfo)
|
|
127 |
|
|
128 |
curWishValue = curWishValue - ipyData.GetNeedWishValue()
|
|
129 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, curWishValue)
|
|
130 |
|
|
131 |
getState = getState | pow(2, recordIndex)
|
|
132 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, getState)
|
|
133 |
|
0211a3
|
134 |
if len(awardItemList) >= needGiveTimes:
|
H |
135 |
break
|
|
136 |
|
e302b9
|
137 |
if not awardItemList:
|
H |
138 |
continue
|
|
139 |
|
|
140 |
batchPlayerIDList.append([playerID])
|
|
141 |
batchAddItemList.append(awardItemList)
|
|
142 |
batchParamList.append([bottleNum])
|
|
143 |
|
|
144 |
if batchPlayerIDList:
|
|
145 |
PlayerControl.SendMailBatch("FeastWishBottleAwardMail", batchPlayerIDList, batchAddItemList, batchParamList)
|
|
146 |
|
|
147 |
return
|
3d7649
|
148 |
|
H |
149 |
#// AA 10 节日祝福瓶选择奖励物品 #tagCMFeastWishBottleChooseItem
|
|
150 |
#
|
|
151 |
#struct tagCMFeastWishBottleChooseItem
|
|
152 |
#{
|
|
153 |
# tagHead Head;
|
|
154 |
# BYTE BottleNum; //瓶子编号
|
|
155 |
# BYTE RecordIndex; //物品索引,用于选择及记录是否已选择
|
|
156 |
#};
|
|
157 |
def OnFeastWishBottleChooseItem(index, clientData, tick):
|
|
158 |
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
|
159 |
bottleNum = clientData.BottleNum
|
|
160 |
getRecordIndex = clientData.RecordIndex
|
|
161 |
|
|
162 |
templateID = __GetWishTemplateID()
|
|
163 |
GameWorld.DebugLog("节日祝福瓶选择奖励! templateID=%s,bottleNum=%s,getRecordIndex=%s" % (templateID, bottleNum, getRecordIndex))
|
|
164 |
if not templateID:
|
|
165 |
return
|
|
166 |
|
|
167 |
bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
|
|
168 |
if not bottleIpyDataList:
|
|
169 |
return
|
|
170 |
|
|
171 |
findIpyData = None
|
|
172 |
for bottleIpyData in bottleIpyDataList:
|
|
173 |
if bottleNum == bottleIpyData.GetWishBottleNum():
|
|
174 |
findIpyData = bottleIpyData
|
|
175 |
break
|
|
176 |
|
|
177 |
if not findIpyData:
|
|
178 |
GameWorld.DebugLog(" 找不到对应节日祝福瓶! bottleNum=%s" % bottleNum)
|
|
179 |
return
|
|
180 |
|
|
181 |
choosePrizeItemDict = findIpyData.GetChoosePrizeItem()
|
|
182 |
if getRecordIndex not in choosePrizeItemDict:
|
|
183 |
GameWorld.DebugLog(" 找不到对应节日祝福瓶奖励物品! getRecordIndex=%s" % getRecordIndex)
|
|
184 |
return
|
|
185 |
|
|
186 |
curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
|
|
187 |
getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
|
|
188 |
getTimes = 0
|
|
189 |
for recordIndex in choosePrizeItemDict.keys():
|
|
190 |
if getState & pow(2, recordIndex):
|
|
191 |
getTimes += 1
|
|
192 |
if getRecordIndex == recordIndex:
|
|
193 |
GameWorld.DebugLog(" 该物品已经选择过! getRecordIndex=%s,getState=%s" % (getRecordIndex, getState))
|
|
194 |
return
|
|
195 |
|
|
196 |
if getTimes >= findIpyData.GetChooseTimeMax():
|
|
197 |
GameWorld.DebugLog(" 已没有领取次数! getState=%s,getTimes=%s >= %s" % (getState, getTimes, findIpyData.GetChooseTimeMax()))
|
|
198 |
return
|
|
199 |
|
|
200 |
if curWishValue < findIpyData.GetNeedWishValue():
|
|
201 |
GameWorld.DebugLog(" 祝福值不足领取! curWishValue=%s < %s" % (curWishValue, findIpyData.GetNeedWishValue()))
|
|
202 |
return
|
|
203 |
|
|
204 |
if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem):
|
|
205 |
return
|
|
206 |
itemInfo = choosePrizeItemDict[getRecordIndex]
|
|
207 |
itemID, itemCount, isAuctionItem = itemInfo
|
|
208 |
if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem], ["", False, {}]):
|
|
209 |
return
|
|
210 |
|
|
211 |
updWishValue = curWishValue - findIpyData.GetNeedWishValue()
|
|
212 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, updWishValue)
|
|
213 |
|
|
214 |
updGetState = getState | pow(2, getRecordIndex)
|
|
215 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum, updGetState)
|
|
216 |
|
|
217 |
Sync_FeastWishPlayerInfo(curPlayer, [bottleNum])
|
|
218 |
|
|
219 |
GameWorld.DebugLog(" 选择成功: getState=%s,updGetState=%s,curWishValue=%s,updWishValue=%s,itemInfo=%s"
|
|
220 |
% (getState, updGetState, curWishValue, updWishValue, itemInfo))
|
|
221 |
|
|
222 |
if itemID in findIpyData.GetGoodItemIDList():
|
|
223 |
recFromType = 1 # 记录来源: 1-祝福瓶,2-祝福池
|
|
224 |
valueList = [itemID, itemCount, recFromType]
|
|
225 |
strValueList = [curPlayer.GetPlayerName()]
|
|
226 |
notifyType = 4 # 通知全服单条
|
|
227 |
GameWorld.AddUniversalGameRec(0, ShareDefine.Def_UniversalGameRecType_FeastWish, valueList, strValueList, notifyType)
|
|
228 |
|
|
229 |
notifyKey = findIpyData.GetWorldNotifyKey()
|
|
230 |
if notifyKey:
|
|
231 |
PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), itemID, "", itemCount])
|
|
232 |
|
|
233 |
return
|
|
234 |
|
|
235 |
#// AA 11 节日祝福池祝福 #tagCMFeastWishPoolWish
|
|
236 |
#
|
|
237 |
#struct tagCMFeastWishPoolWish
|
|
238 |
#{
|
|
239 |
# tagHead Head;
|
|
240 |
# BYTE WishCount; //祝福次数
|
|
241 |
#};
|
|
242 |
def OnFeastWishPoolWish(index, clientData, tick):
|
|
243 |
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
|
244 |
wishCount = clientData.WishCount
|
|
245 |
|
|
246 |
templateID = __GetWishTemplateID()
|
|
247 |
GameWorld.DebugLog("玩家节日祝福: wishCount=%s,templateID=%s" % (wishCount, templateID))
|
|
248 |
if not templateID:
|
|
249 |
return
|
|
250 |
|
|
251 |
bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
|
|
252 |
poolIpyData = IpyGameDataPY.GetIpyGameData("ActFeastWishPool", templateID)
|
|
253 |
if not bottleIpyDataList or not poolIpyData:
|
|
254 |
return
|
|
255 |
|
|
256 |
canWishCountList = IpyGameDataPY.GetFuncEvalCfg("FeastWishCfg", 2)
|
|
257 |
if wishCount not in canWishCountList:
|
|
258 |
return
|
|
259 |
|
|
260 |
costItemID = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 1)
|
|
261 |
|
|
262 |
costItemNeedCount = wishCount
|
|
263 |
costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID)
|
|
264 |
lackCount = max(0, costItemNeedCount - bindCnt - unBindCnt)
|
|
265 |
if lackCount > 0:
|
|
266 |
GameWorld.DebugLog(" 所需祝福道具不足!costItemID=%s,costItemNeedCount=%s,lackCount=%s"
|
|
267 |
% (costItemID, costItemNeedCount, lackCount))
|
|
268 |
return
|
|
269 |
|
|
270 |
giveWishValueTotal = 0
|
|
271 |
wishValueRange = IpyGameDataPY.GetFuncEvalCfg("FeastWishCfg", 3)
|
|
272 |
|
|
273 |
giveItemDict = {} # 用于判断占用背包用
|
|
274 |
giveItemList = [] # 用于实际给物品及通知前端用,一个个给
|
|
275 |
isAuctionItem = 0 # 默认给非拍品
|
|
276 |
itemWeightInfoList = poolIpyData.GetWishPoolItemWeightInfo()
|
|
277 |
for _ in xrange(wishCount):
|
|
278 |
randItemInfo = GameWorld.GetResultByWeightList(itemWeightInfoList)
|
|
279 |
if not randItemInfo:
|
|
280 |
GameWorld.ErrLog("节日祝福池物品权重配置异常! %s" % itemWeightInfoList)
|
|
281 |
return
|
|
282 |
itemID, itemCount = randItemInfo
|
|
283 |
giveItemList.append([itemID, itemCount, isAuctionItem])
|
|
284 |
giveItemDict[itemID] = giveItemDict.get(itemID, 0) + itemCount
|
|
285 |
giveWishValueTotal += random.randint(wishValueRange[0], wishValueRange[1])
|
|
286 |
|
|
287 |
checkSpaceList = [[itemID, itemCount, isAuctionItem] for itemID, itemCount in giveItemDict.items()]
|
|
288 |
if not ItemControler.CheckPackSpaceEnough(curPlayer, checkSpaceList):
|
|
289 |
return
|
|
290 |
|
|
291 |
GameWorld.DebugLog(" giveWishValueTotal=%s,giveItemList=%s" % (giveWishValueTotal, giveItemList))
|
|
292 |
|
|
293 |
# 扣除消耗
|
|
294 |
ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemNeedCount, "FeastWish")
|
|
295 |
|
|
296 |
# 加祝福值
|
|
297 |
syncBottleNumList = []
|
|
298 |
for bottleIpyData in bottleIpyDataList:
|
|
299 |
bottleNum = bottleIpyData.GetWishBottleNum()
|
|
300 |
curWishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
|
|
301 |
getState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
|
|
302 |
getTimes = 0
|
|
303 |
for recordIndex in bottleIpyData.GetChoosePrizeItem().keys():
|
|
304 |
if getState & pow(2, recordIndex):
|
|
305 |
getTimes += 1
|
|
306 |
canGetTimes = max(0, bottleIpyData.GetChooseTimeMax() - getTimes)
|
|
307 |
wishValueMax = bottleIpyData.GetNeedWishValue() * canGetTimes
|
|
308 |
if curWishValue >= wishValueMax:
|
|
309 |
GameWorld.DebugLog(" 瓶子祝福值已满! bottleNum=%s,canGetTimes=%s,wishValueMax=%s <= curWishValue=%s"
|
|
310 |
% (bottleNum, canGetTimes, wishValueMax, curWishValue))
|
|
311 |
continue
|
|
312 |
updWishValue = min(wishValueMax, curWishValue + giveWishValueTotal)
|
|
313 |
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastWishBottleValue % bottleNum, updWishValue)
|
|
314 |
GameWorld.DebugLog(" 瓶子祝福值更新! bottleNum=%s,canGetTimes=%s,wishValueMax=%s,curWishValue=%s,updWishValue=%s"
|
|
315 |
% (bottleNum, canGetTimes, wishValueMax, curWishValue, updWishValue))
|
|
316 |
syncBottleNumList.append(bottleNum)
|
|
317 |
|
|
318 |
# 给物品
|
|
319 |
goodItemIDList = poolIpyData.GetGoodItemIDList()
|
|
320 |
notifyKey = poolIpyData.GetWorldNotifyKey()
|
|
321 |
for itemID, itemCount, isAuctionItem in giveItemList:
|
|
322 |
itemObj = ItemControler.GetOutPutItemObj(itemID, itemCount, isAuctionItem, curPlayer=curPlayer)
|
|
323 |
itemUserData = itemObj.GetUserData()
|
|
324 |
isOK = ItemControler.DoLogic_PutItemInPack(curPlayer, itemObj, ["FeastWish", False, {}], [IPY_GameWorld.rptItem])
|
|
325 |
|
|
326 |
if isOK and itemID in goodItemIDList:
|
|
327 |
# 通知GameServer记录好物品轮播
|
|
328 |
recFromType = 2 # 记录来源: 1-祝福瓶,2-祝福池
|
|
329 |
valueList = [itemID, itemCount, recFromType]
|
|
330 |
strValueList = [curPlayer.GetPlayerName()]
|
|
331 |
notifyType = 4 # 通知全服单条
|
|
332 |
GameWorld.AddUniversalGameRec(0, ShareDefine.Def_UniversalGameRecType_FeastWish, valueList, strValueList, notifyType)
|
|
333 |
|
|
334 |
if notifyKey:
|
|
335 |
PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), itemID, itemUserData, itemCount])
|
|
336 |
|
|
337 |
# 通知前端结果
|
|
338 |
retPack = ChPyNetSendPack.tagMCFeastWishResult()
|
|
339 |
retPack.AddWishValue = giveWishValueTotal
|
|
340 |
retPack.WishResult = str(giveItemList)
|
|
341 |
retPack.WishResultLen = len(retPack.WishResult)
|
|
342 |
NetPackCommon.SendFakePack(curPlayer, retPack)
|
|
343 |
|
|
344 |
if syncBottleNumList:
|
|
345 |
Sync_FeastWishPlayerInfo(curPlayer, syncBottleNumList)
|
|
346 |
|
|
347 |
return
|
|
348 |
|
|
349 |
def GetFeastWishDropItemIDList(curPlayer, npcData):
|
|
350 |
## 获取掉落祝福道具ID列表
|
|
351 |
## @return: [itemID, ...]
|
|
352 |
|
|
353 |
actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
|
|
354 |
if not actInfo:
|
|
355 |
return []
|
|
356 |
|
|
357 |
if not actInfo.get(ShareDefine.ActKey_State):
|
|
358 |
return []
|
|
359 |
|
|
360 |
if not ChConfig.IsGameBoss(npcData):
|
|
361 |
return []
|
|
362 |
|
|
363 |
npcID = npcData.GetNPCID()
|
|
364 |
killBossCntLimitDict = IpyGameDataPY.GetFuncCfg('KillBossCntLimit', 1)
|
|
365 |
limitIndex = GameWorld.GetDictValueByKey(killBossCntLimitDict, npcID)
|
|
366 |
if limitIndex not in [ShareDefine.Def_Boss_Func_World, ShareDefine.Def_Boss_Func_Home]:
|
|
367 |
# 规定只有世界boss、boss之家可掉落
|
|
368 |
return
|
|
369 |
|
|
370 |
dropRate = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 4)
|
|
371 |
if not GameWorld.CanHappen(dropRate):
|
|
372 |
return
|
|
373 |
wishItemID = IpyGameDataPY.GetFuncCfg("FeastWishCfg", 1) # 默认掉1个
|
|
374 |
#GameWorld.DebugLog("掉落节日祝福道具: npcID=%s,dropRate=%s,wishItemID=%s" % (npcID, dropRate, wishItemID))
|
|
375 |
return [wishItemID]
|
|
376 |
|
|
377 |
def Sync_FeastWishPlayerInfo(curPlayer, bottleNumList=[]):
|
|
378 |
## 通知活动玩家信息
|
|
379 |
|
|
380 |
if bottleNumList:
|
|
381 |
syncBottleNumList = bottleNumList
|
|
382 |
else:
|
|
383 |
syncBottleNumList = GetWishBottleNumList()
|
|
384 |
|
|
385 |
playerPack = ChPyNetSendPack.tagMCFeastWishPlayerInfo()
|
|
386 |
playerPack.PlayerBottleInfo = []
|
|
387 |
for bottleNum in syncBottleNumList:
|
|
388 |
playerBottle = ChPyNetSendPack.tagMCFeastWishPlayerBottle()
|
|
389 |
playerBottle.BottleNum = bottleNum
|
|
390 |
playerBottle.WishValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleValue % bottleNum)
|
|
391 |
playerBottle.ChooseRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastWishBottleGetState % bottleNum)
|
|
392 |
playerPack.PlayerBottleInfo.append(playerBottle)
|
|
393 |
playerPack.BottleCount = len(playerPack.PlayerBottleInfo)
|
|
394 |
NetPackCommon.SendFakePack(curPlayer, playerPack)
|
|
395 |
return
|
|
396 |
|
|
397 |
def GetWishBottleNumList():
|
|
398 |
templateID = __GetWishTemplateID()
|
|
399 |
if not templateID:
|
|
400 |
return []
|
|
401 |
|
|
402 |
bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
|
|
403 |
if not bottleIpyDataList:
|
|
404 |
return []
|
|
405 |
return [bottleIpyData.GetWishBottleNum() for bottleIpyData in bottleIpyDataList]
|
|
406 |
|
|
407 |
def __GetWishTemplateID():
|
|
408 |
actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
|
|
409 |
if not actInfo:
|
e302b9
|
410 |
return 0
|
3d7649
|
411 |
|
H |
412 |
if not actInfo.get(ShareDefine.ActKey_State):
|
e302b9
|
413 |
return 0
|
3d7649
|
414 |
|
H |
415 |
cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
|
416 |
ipyData = IpyGameDataPY.GetIpyGameData("ActFeastWish", cfgID)
|
|
417 |
if not ipyData:
|
e302b9
|
418 |
return 0
|
3d7649
|
419 |
|
H |
420 |
worldLV = actInfo.get(ShareDefine.ActKey_WorldLV)
|
|
421 |
templateID = GameWorld.GetDictValueByRangeKey(ipyData.GetTemplateIDInfo(), worldLV, 0)
|
|
422 |
return templateID
|
|
423 |
|
|
424 |
def Sync_FeastWishActionInfo(curPlayer):
|
|
425 |
## 通知活动信息
|
|
426 |
actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastWish, {})
|
|
427 |
if not actInfo:
|
|
428 |
return
|
|
429 |
|
|
430 |
if not actInfo.get(ShareDefine.ActKey_State):
|
|
431 |
return
|
|
432 |
|
|
433 |
cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
|
434 |
ipyData = IpyGameDataPY.GetIpyGameData("ActFeastWish", cfgID)
|
|
435 |
if not ipyData:
|
|
436 |
return
|
|
437 |
|
|
438 |
worldLV = actInfo.get(ShareDefine.ActKey_WorldLV)
|
|
439 |
templateID = GameWorld.GetDictValueByRangeKey(ipyData.GetTemplateIDInfo(), worldLV, 0)
|
|
440 |
if not templateID:
|
|
441 |
return
|
|
442 |
|
|
443 |
bottleIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActFeastWishBottle", templateID)
|
|
444 |
poolIpyData = IpyGameDataPY.GetIpyGameData("ActFeastWishPool", templateID)
|
|
445 |
|
505624
|
446 |
startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
|
3d7649
|
447 |
actPack = ChPyNetSendPack.tagMCFeastWishInfo()
|
H |
448 |
actPack.Clear()
|
505624
|
449 |
actPack.StartDate = startDateStr
|
H |
450 |
actPack.EndtDate = endDateStr
|
2e677e
|
451 |
actPack.LimitLV = ipyData.GetLVLimit()
|
94ca00
|
452 |
actPack.ResetType = ipyData.GetResetType()
|
3d7649
|
453 |
actPack.WishPoolShowItemList = poolIpyData.GetWishPoolClientItemShow() if poolIpyData else []
|
H |
454 |
actPack.WishPoolShowCount = len(actPack.WishPoolShowItemList)
|
|
455 |
actPack.BottleInfoList = []
|
|
456 |
if bottleIpyDataList:
|
|
457 |
for bottleIpyData in bottleIpyDataList:
|
|
458 |
bottleInfo = ChPyNetSendPack.tagMCFeastWishBottleInfo()
|
|
459 |
bottleInfo.BottleNum = bottleIpyData.GetWishBottleNum()
|
|
460 |
bottleInfo.NeedWishValue = bottleIpyData.GetNeedWishValue()
|
|
461 |
bottleInfo.ChooseTimeMax = bottleIpyData.GetChooseTimeMax()
|
|
462 |
bottleInfo.ChoosePrizeList = []
|
|
463 |
prizeItemDict = bottleIpyData.GetChoosePrizeItem()
|
|
464 |
for recordIndex, itemInfo in prizeItemDict.items():
|
|
465 |
itemID, itemCount, isAuctionItem = itemInfo
|
|
466 |
itemInfo = ChPyNetSendPack.tagMCFeastWishBottleItem()
|
|
467 |
itemInfo.RecordIndex = recordIndex
|
|
468 |
itemInfo.ItemID = itemID
|
|
469 |
itemInfo.ItemCount = itemCount
|
|
470 |
itemInfo.IsBind = isAuctionItem
|
|
471 |
bottleInfo.ChoosePrizeList.append(itemInfo)
|
|
472 |
bottleInfo.ChoosePrizeCount = len(bottleInfo.ChoosePrizeList)
|
|
473 |
actPack.BottleInfoList.append(bottleInfo)
|
|
474 |
actPack.BottleCount = len(actPack.BottleInfoList)
|
|
475 |
NetPackCommon.SendFakePack(curPlayer, actPack)
|
|
476 |
return
|
|
477 |
|