| | |
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import ItemControler
|
| | | import CrossRealmPlayer
|
| | | import PlayerBillboard
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import PlayerActTask
|
| | | import ItemCommon
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | Def_SuperLibType = 9 # 大奖库类型固定为9
|
| | |
|
| | | def OnMixFirstLogin(curPlayer):
|
| | | |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_XianXiaMJ, {}).values():
|
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
|
| | | if not actInfo.get(ShareDefine.ActKey_State):
|
| | | continue
|
| | | score = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJScore % actNum)
|
| | | if not score:
|
| | | continue
|
| | | GameWorld.Log("仙匣秘境合服首登同步积分榜单: actNum=%s,score=%s" % (actNum, score), curPlayer.GetPlayerID())
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_XianXiaMJScore, score, autoSort=True)
|
| | | break
|
| | | |
| | | return
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | |
|
| | |
| | | # 活动中同步活动信息
|
| | | if actInfo.get(ShareDefine.ActKey_State):
|
| | | Sync_XianXiaMJActionInfo(curPlayer, actNum)
|
| | | Sync_XianXiaMJLayerInfo(curPlayer, actNum)
|
| | | |
| | | if not __CheckPlayerCrossActXianXiaMJ(curPlayer):
|
| | | Sync_CrossActXianXiaMJActionInfo(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | | def RefreshXianXiaMJActionInfo(actNum):
|
| | |
| | | if actID == playerActID:
|
| | | GameWorld.DebugLog("仙匣秘境活动ID不变,不处理!actNum=%s,actID=%s" % (actNum, actID), playerID)
|
| | |
|
| | | layerInfoValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum)
|
| | | layerNum = layerInfoValue % 100
|
| | | layerNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJLayerNum % actNum)
|
| | | if state and layerNum <= 0:
|
| | | GameWorld.Log("仙匣秘境活动中但首层奖池未刷新初始化,尝试刷新!actNum=%s,actID=%s" % (actNum, actID), playerID)
|
| | | __InitFirstLayerData(curPlayer, actNum, actInfo)
|
| | |
| | | % (actNum, actID, playerActID, state, cfgID), playerID)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJID % actNum, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJWorldLV % actNum, actWorldLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJWorldLV % actNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJLayerNum % actNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJPlayCount % actNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJScore % actNum, 0)
|
| | |
|
| | | if state:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJWorldLV % actNum, actWorldLV)
|
| | | Sync_XianXiaMJActionInfo(curPlayer, actNum)
|
| | | __InitFirstLayerData(curPlayer, actNum, actInfo)
|
| | | return True
|
| | |
|
| | |
| | | if awardIpyDataList:
|
| | | for awardIpyData in awardIpyDataList:
|
| | | libType = awardIpyData.GetAwardLibType()
|
| | | libItemCount = awardIpyData.GetAwardItemCount()
|
| | | libItemCount = max(awardIpyData.GetAwardItemCountList())
|
| | | for num in xrange(libItemCount):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJAwardItemInfo % (actNum, libType, num), 0)
|
| | |
|
| | |
| | |
|
| | | # 活动中,生成新奖池
|
| | | if state:
|
| | | __RefreshXianXiaMJAwardPool(curPlayer, actInfo, awardIpyDataList)
|
| | | __RefreshXianXiaMJAwardPool(curPlayer, actInfo, ipyData, awardIpyDataList)
|
| | |
|
| | | Sync_XianXiaMJActionInfo(curPlayer, actNum)
|
| | | Sync_XianXiaMJLayerInfo(curPlayer, actNum)
|
| | | return True
|
| | |
|
| | | def RefreshCrossActXianXiaMJInfo():
|
| | | ## 收到GameServer同步的活动信息,刷新活动信息
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | if curPlayer.GetID() == 0:
|
| | | continue
|
| | | __CheckPlayerCrossActXianXiaMJ(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | | def __CheckPlayerCrossActXianXiaMJ(curPlayer):
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | |
| | | actInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_XianXiaMJ)
|
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | actID = actInfo.get(ShareDefine.ActKey_ID, 0)
|
| | | state = actInfo.get(ShareDefine.ActKey_State, 0)
|
| | | dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0)
|
| | | |
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CA_XianXiaMJID) # 玩家身上的活动ID
|
| | | |
| | | # 活动ID 相同的话不处理
|
| | | if actID == playerActID:
|
| | | GameWorld.DebugLog("跨服仙匣秘境活动ID不变,不处理!cfgID=%s,dayIndex=%s,actID=%s" % (cfgID, dayIndex, actID), playerID) |
| | | return
|
| | | GameWorld.DebugLog("跨服仙匣秘境活动重置! cfgID=%s,actID=%s,playerActID=%s,state=%s" % (cfgID, actID, playerActID, state), playerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CA_XianXiaMJID, actID)
|
| | | |
| | | if not state:
|
| | | CrossRealmPlayer.NotifyCrossActEnd(curPlayer, ShareDefine.CrossActName_XianXiaMJ)
|
| | | |
| | | Sync_CrossActXianXiaMJActionInfo(curPlayer)
|
| | | return True
|
| | |
|
| | | def SendToGameServer_XianXiaMJ(curPlayer, msgType, dataMsg=""):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | msgList = str([msgType, dataMsg])
|
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "XianXiaMJ", msgList, len(msgList))
|
| | | GameWorld.Log("仙匣秘境发送GameServer: %s, %s" % (msgType, dataMsg), playerID)
|
| | | return
|
| | |
|
| | | def AddPlayerLotteryScore(curPlayer, actNum, addScore):
|
| | | if addScore <= 0:
|
| | | return 0
|
| | | lotteryScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJScore % actNum)
|
| | | updLotteryScore = lotteryScore + addScore
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJScore % actNum, updLotteryScore)
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_XianXiaMJScore, updLotteryScore, autoSort=True)
|
| | | SendToGameServer_XianXiaMJ(curPlayer, "AddLotteryScore", [addScore, updLotteryScore])
|
| | | return updLotteryScore
|
| | |
|
| | | def GetLayerSetByList(layerNum, setList):
|
| | | if not setList:
|
| | | return 0
|
| | | return setList[layerNum - 1] if len(setList) >= layerNum else setList[-1]
|
| | |
|
| | | #// AA 16 仙匣秘境活动选择大奖 #tagCMActXianXiaMJSuperItem
|
| | | #
|
| | |
| | | if not templateID:
|
| | | return
|
| | |
|
| | | layerNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJLayerNum % actNum)
|
| | | actWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJWorldLV % actNum)
|
| | | awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJAward", templateID)
|
| | | if not awardIpyDataList:
|
| | |
| | | GameWorld.ErrLog("没有配置仙匣秘境活动大奖库! cfgID=%s,actNum=%s,templateID=%s" % (cfgID, actNum, templateID))
|
| | | return
|
| | |
|
| | | superLibItemCount = superAwardIpyData.GetAwardItemCount()
|
| | | superLibItemCount = GetLayerSetByList(layerNum, superAwardIpyData.GetAwardItemCountList())
|
| | | if len(superItemIDList) != superLibItemCount:
|
| | | GameWorld.ErrLog("仙匣秘境活动选择大奖个数错误! cfgID=%s,actNum=%s,templateID=%s,superLibItemCount=%s,reqSuperItemIDList=%s" |
| | | % (cfgID, actNum, templateID, superLibItemCount, superItemIDList)) |
| | | GameWorld.ErrLog("仙匣秘境活动选择大奖个数错误! cfgID=%s,actNum=%s,templateID=%s,layerNum=%s,superLibItemCount=%s,reqSuperItemIDList=%s" |
| | | % (cfgID, actNum, templateID, layerNum, superLibItemCount, superItemIDList)) |
| | | return
|
| | |
|
| | | posNumItemIDList = [] # 已抽中的大奖物品ID
|
| | |
| | |
|
| | | GameWorld.DebugLog(" 已抽中的大奖ID! %s" % posNumItemIDList)
|
| | |
|
| | | layerInfoValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum)
|
| | | layerNum = layerInfoValue % 100
|
| | |
|
| | | libItemDict = __GetXianXiaMJAwardLibItem(superAwardIpyData.GetLibItemInfo(), actWorldLV)
|
| | | layerLimitInfo = superAwardIpyData.GetItemLayerLimitInfo()
|
| | |
| | | if not replaceSuperItemIDList:
|
| | | break
|
| | |
|
| | | Sync_XianXiaMJActionInfo(curPlayer, actNum)
|
| | | Sync_XianXiaMJLayerInfo(curPlayer, actNum)
|
| | | return
|
| | |
|
| | | #// AA 18 仙匣秘境活动奖池刷新 #tagCMActXianXiaMJAwardPoolRefresh
|
| | |
| | | if not awardIpyDataList:
|
| | | return
|
| | |
|
| | | if not __RefreshXianXiaMJAwardPool(curPlayer, actInfo, awardIpyDataList):
|
| | | if not __RefreshXianXiaMJAwardPool(curPlayer, actInfo, ipyData, awardIpyDataList):
|
| | | return
|
| | |
|
| | | Sync_XianXiaMJActionInfo(curPlayer, actNum)
|
| | | Sync_XianXiaMJLayerInfo(curPlayer, actNum)
|
| | | return
|
| | |
|
| | | def __RefreshXianXiaMJAwardPool(curPlayer, actInfo, awardIpyDataList):
|
| | | def __RefreshXianXiaMJAwardPool(curPlayer, actInfo, ipyData, awardIpyDataList):
|
| | | ## 刷新奖池物品
|
| | |
|
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
|
| | | actWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJWorldLV % actNum)
|
| | | |
| | | layerInfoValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum)
|
| | | layerNum = layerInfoValue % 100
|
| | | layerNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJLayerNum % actNum)
|
| | |
|
| | | GameWorld.DebugLog("刷新仙匣秘境奖池物品: cfgID=%s,actNum=%s,actWorldLV=%s,layerNum=%s" % (cfgID, actNum, actWorldLV, layerNum))
|
| | |
|
| | |
| | | if libType != Def_SuperLibType:
|
| | | continue
|
| | | superLib = True
|
| | | libItemCount = awardIpyData.GetAwardItemCount()
|
| | | libItemCount = GetLayerSetByList(layerNum, awardIpyData.GetAwardItemCountList())
|
| | | for num in xrange(libItemCount):
|
| | | itemInfoValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardItemInfo % (actNum, libType, num))
|
| | | if not itemInfoValue:
|
| | | GameWorld.ErrLog("未选择大奖!无法刷新奖池! cfgID=%s,actNum=%s,layerNum=%s,num=%s" |
| | | % (cfgID, actNum, layerNum, num))
|
| | | return
|
| | | itemID, posNum = itemInfoValue / 100, itemInfoValue % 100
|
| | | if itemID and not posNum:
|
| | | GameWorld.ErrLog("有大奖未抽中!无法刷新奖池! cfgID=%s,actNum=%s,layerNum=%s,num=%s,itemID=%s,posNum=%s"
|
| | |
| | | GameWorld.ErrLog("奖池配置没有大奖库!无法刷新奖池! cfgID=%s,actNum=%s,layerNum=%s,superLib=%s" % (cfgID, actNum, layerNum, superLib))
|
| | | return
|
| | |
|
| | | layerNum += 1 # 可刷新奖池,默认+1层
|
| | | if layerNum > 99:
|
| | | GameWorld.ErrLog("奖池层数达到上限,无法刷新! cfgID=%s,actNum=%s,layerNum=%s" % (cfgID, actNum, layerNum))
|
| | | return
|
| | | layerNum = min(layerNum + 1, 65530) # 可刷新奖池,默认+1层
|
| | | GameWorld.DebugLog(" 可刷新奖池!下一层: layerNum=%s" % (layerNum))
|
| | |
|
| | | refreshLibDict = {}
|
| | | for awardIpyData in awardIpyDataList:
|
| | | libType = awardIpyData.GetAwardLibType()
|
| | | libItemCount = awardIpyData.GetAwardItemCount()
|
| | | libItemCount = GetLayerSetByList(layerNum, awardIpyData.GetAwardItemCountList())
|
| | | libItemDict = __GetXianXiaMJAwardLibItem(awardIpyData.GetLibItemInfo(), actWorldLV)
|
| | | layerLimitInfo = awardIpyData.GetItemLayerLimitInfo()
|
| | | awardTimesTotalInfo = awardIpyData.GetItemAwardTimesTotalInfo()
|
| | |
| | | GameWorld.DebugLog(" 随机生成奖品! libType=%s,num=%s,randItemID=%s" % (libType, num, randItemID))
|
| | |
|
| | | playCount = 0 # 每层重置抽奖次数
|
| | | layerInfoValue = playCount * 100 + layerNum
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum, layerInfoValue)
|
| | | GameWorld.DebugLog(" 刷新完成! playCount=%s,layerNum=%s,layerInfoValue=%s" % (playCount, layerNum, layerInfoValue))
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJLayerNum % actNum, layerNum)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJPlayCount % actNum, playCount)
|
| | | GameWorld.DebugLog(" 刷新完成! layerNum=%s,playCount=%s" % (layerNum, playCount))
|
| | | PlayerActTask.UpdActTaskValue(curPlayer, ChConfig.ActTaskType_XianXiaMJLayer, layerNum)
|
| | | if layerNum > 1:
|
| | | AddPlayerLotteryScore(curPlayer, actNum, ipyData.GetLayerAddScore())
|
| | | return True
|
| | |
|
| | | #// AA 17 仙匣秘境活动抽奖 #tagCMActXianXiaMJLottery
|
| | |
| | | GameWorld.DebugLog(" 非活动中!")
|
| | | return
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | crossActInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_XianXiaMJ)
|
| | | if crossActInfo.get(ShareDefine.ActKey_State, 0):
|
| | | if crossActInfo.get(ShareDefine.ActKey_StateJoin) != ShareDefine.ActStateJoin_Start:
|
| | | GameWorld.Log("跨服仙匣秘境非参与活动中: actNum=%s" % actNum, playerID)
|
| | | return
|
| | | else:
|
| | | if actInfo.get(ShareDefine.ActKey_StateJoin) != ShareDefine.ActStateJoin_Start:
|
| | | GameWorld.Log("仙匣秘境非参与活动中: actNum=%s" % actNum, playerID)
|
| | | return
|
| | | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActXianXiaMJ", cfgID)
|
| | | if not ipyData:
|
| | |
| | | if not awardIpyDataList:
|
| | | return
|
| | |
|
| | | checkUseMoney = False
|
| | | costItemID = ipyData.GetUseItemID()
|
| | | costItemCount = 1
|
| | | if costItemID:
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
|
| | | lackCnt = costItemCount - bindCnt - unBindCnt
|
| | | if lackCnt > 0:
|
| | | checkUseMoney = True
|
| | | else:
|
| | | checkUseMoney = True
|
| | | |
| | | costMoneyType, costMoneyValue = ipyData.GetUseMoneyInfo()
|
| | | if checkUseMoney:
|
| | | if not costMoneyType or not costMoneyValue:
|
| | | return
|
| | | if not PlayerControl.HaveMoney(curPlayer, costMoneyType, costMoneyValue):
|
| | | GameWorld.DebugLog(" 货币不足,无法抽奖! costMoneyType=%s,costMoneyValue(%s) > curMoneyValue(%s)"
|
| | | % (costMoneyType, costMoneyValue, PlayerControl.GetMoney(curPlayer, costMoneyType)))
|
| | | return
|
| | |
|
| | | layerInfoValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum)
|
| | | playCount, layerNum = layerInfoValue / 100, layerInfoValue % 100
|
| | | layerNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJLayerNum % actNum)
|
| | | playCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJPlayCount % actNum)
|
| | | GameWorld.DebugLog("layerNum=%s,playCount=%s" % (layerNum, playCount))
|
| | |
|
| | | posNumMax = 0
|
| | | randLibItemDict = {}
|
| | | for awardIpyData in awardIpyDataList:
|
| | | libType = awardIpyData.GetAwardLibType()
|
| | | libItemCount = awardIpyData.GetAwardItemCount()
|
| | | unlockLimitTimes = awardIpyData.GetUnlockAwardLimitTimes()
|
| | | libItemCount = GetLayerSetByList(layerNum, awardIpyData.GetAwardItemCountList())
|
| | | unlockLimitTimes = GetLayerSetByList(layerNum, awardIpyData.GetUnlockAwardLimitTimesList())
|
| | | libWeight = awardIpyData.GetAwardLibWeight()
|
| | | posNumMax += libItemCount
|
| | |
|
| | |
| | | return
|
| | | itemID, itemCount, num, isAddTimes = randItemInfo
|
| | |
|
| | | # 扣除抽奖消耗环保值
|
| | | # 扣除消耗
|
| | | if checkUseMoney:
|
| | | PlayerControl.PayMoney(curPlayer, costMoneyType, costMoneyValue, "ActXianXiaMJ")
|
| | | GameWorld.DebugLog("消耗货币: costMoneyType=%s,costMoneyValue=%s" % (costMoneyType, costMoneyValue))
|
| | | else:
|
| | | GameWorld.DebugLog("消耗道具: costItemID=%s,costItemCount=%s %s" % (costItemID, costItemCount, costItemIndexList))
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, "XianXiaMJ")
|
| | |
|
| | | # 更新已抽中值
|
| | | updItemInfoValue = itemID * 100 + reqPosNum
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJAwardItemTimes % (actNum, libType, itemID), totalTimesNow)
|
| | |
|
| | | playCount += 1
|
| | | layerInfoValue = playCount * 100 + layerNum
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum, layerInfoValue)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_XianXiaMJPlayCount % actNum, playCount)
|
| | |
|
| | | GameWorld.DebugLog(" 抽中物品: layerNum=%s,libType=%s,itemID=%s,itemCount=%s,num=%s,reqPosNum=%s,updItemInfoValue=%s,totalTimesNow=%s,playCount=%s(%s)" |
| | | % (layerNum, libType, itemID, itemCount, num, reqPosNum, updItemInfoValue, totalTimesNow, playCount, layerInfoValue))
|
| | | GameWorld.DebugLog(" 抽中物品: layerNum=%s,libType=%s,itemID=%s,itemCount=%s,num=%s,reqPosNum=%s,updItemInfoValue=%s,totalTimesNow=%s,playCount=%s" |
| | | % (layerNum, libType, itemID, itemCount, num, reqPosNum, updItemInfoValue, totalTimesNow, playCount))
|
| | |
|
| | | # 给物品
|
| | | isAuctionItem = 0
|
| | | itemList = [[itemID, itemCount, isAuctionItem]]
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, itemList, event=["tagActXianXiaMJLottery", False, {}])
|
| | |
|
| | | # 任务
|
| | | PlayerActTask.AddActTaskValue(curPlayer, ChConfig.ActTaskType_XianXiaMJLottery, 1)
|
| | | |
| | | # 广播
|
| | | if libType == Def_SuperLibType:
|
| | | PlayerControl.WorldNotify(0, "XianXiaMJ%s" % actNum, [curPlayer.GetPlayerName(), itemID, itemCount])
|
| | | |
| | | # 积分
|
| | | lotteryScore = AddPlayerLotteryScore(curPlayer, actNum, ipyData.GetLotteryAddScore())
|
| | |
|
| | | # 通知抽奖结果
|
| | | clientPack = ChPyNetSendPack.tagMCActXianXiaMJAwardItemResult()
|
| | |
| | | clientPack.ItemCount = itemCount
|
| | | clientPack.PosNum = reqPosNum
|
| | | clientPack.TotalTimesNow = totalTimesNow
|
| | | clientPack.LotteryScore = lotteryScore
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActXianXiaMJ", cfgID)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | templateID = ipyData.GetTemplateID()
|
| | | if not templateID:
|
| | | return
|
| | | costMoneyType, costMoneyValue = ipyData.GetUseMoneyInfo()
|
| | |
|
| | | actWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJWorldLV % actNum)
|
| | | startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
|
| | | personalTempID = ipyData.GetPersonalTemplateID()
|
| | | personalTempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", personalTempID) if personalTempID else []
|
| | |
|
| | | layerInfoValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardLayerInfo % actNum)
|
| | | layerNum = layerInfoValue % 100
|
| | | startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
|
| | |
|
| | | clientPack = ChPyNetSendPack.tagMCActXianXiaMJInfo()
|
| | | clientPack.ActNum = actNum
|
| | | clientPack.StartDate = startDateStr
|
| | | clientPack.EndtDate = endDateStr
|
| | | clientPack.JoinStartTime = ipyData.GetJoinStartTime()
|
| | | clientPack.JoinEndTime = ipyData.GetJoinEndTime()
|
| | | clientPack.IsDayReset = ipyData.GetIsDayReset()
|
| | | clientPack.LimitLV = ipyData.GetLVLimit()
|
| | | clientPack.ResetType = ipyData.GetResetType()
|
| | | clientPack.UseItemID = ipyData.GetUseItemID()
|
| | | clientPack.MoneyType = costMoneyType
|
| | | clientPack.MoneyValue = costMoneyValue
|
| | | clientPack.LotteryAddScore = ipyData.GetLotteryAddScore()
|
| | | clientPack.LayerAddScore = ipyData.GetLayerAddScore()
|
| | | |
| | | clientPack.PersonalBillboardInfoList = __GetTempRankBillPackList(personalTempIpyDataList)
|
| | | clientPack.PersonalBillCount = len(clientPack.PersonalBillboardInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def __GetXianXiaMJAwardLibItem(libItemInfo, actWorldLV):
|
| | | ## 获取奖励库物品信息字典,支持按世界等级范围配置的格式
|
| | | keyList = libItemInfo.keys()
|
| | | if not keyList:
|
| | | return {}
|
| | | if isinstance(keyList[0], tuple) and len(keyList[0]) == 2:
|
| | | return GameWorld.GetDictValueByRangeKey(libItemInfo, actWorldLV, {})
|
| | | return libItemInfo
|
| | |
|
| | | def Sync_XianXiaMJLayerInfo(curPlayer, actNum):
|
| | | |
| | | actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_XianXiaMJ, actNum)
|
| | | if not actInfo.get(ShareDefine.ActKey_State):
|
| | | return
|
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActXianXiaMJ", cfgID)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | templateID = ipyData.GetTemplateID()
|
| | | if not templateID:
|
| | | return
|
| | | actWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJWorldLV % actNum)
|
| | | layerNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJLayerNum % actNum)
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCActXianXiaMJLayerInfo()
|
| | | clientPack.ActNum = actNum
|
| | | clientPack.LayerNum = layerNum
|
| | | clientPack.LotteryScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJScore % actNum)
|
| | | clientPack.AwardItemList = [] # 奖池物品列表
|
| | | awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJAward", templateID)
|
| | | if awardIpyDataList:
|
| | | for awardIpyData in awardIpyDataList:
|
| | | libType = awardIpyData.GetAwardLibType()
|
| | | libItemCount = awardIpyData.GetAwardItemCount()
|
| | | libItemCount = GetLayerSetByList(layerNum, awardIpyData.GetAwardItemCountList())
|
| | | libItemDict = __GetXianXiaMJAwardLibItem(awardIpyData.GetLibItemInfo(), actWorldLV)
|
| | | layerLimitInfo = awardIpyData.GetItemLayerLimitInfo()
|
| | | awardTimesTotalInfo = awardIpyData.GetItemAwardTimesTotalInfo()
|
| | |
| | | continue
|
| | | libItemInfo = libItemDict[itemID]
|
| | |
|
| | | awardItem = ChPyNetSendPack.tagMCActXianXiaMJAwardItem()
|
| | | awardItem.ItemLibType = libType
|
| | | awardItem.ItemID = itemID
|
| | | awardItem.ItemCount = libItemInfo[0]
|
| | | awardItem.PosNum = posNum
|
| | | awardItem.TotalTimesMax = awardTimesTotalInfo.get(itemID, 0)
|
| | | awardItem.TotalTimesNow = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardItemTimes % (actNum, libType, itemID))
|
| | | awardItem.LayerLimit = layerLimitInfo.get(itemID, 0)
|
| | | clientPack.AwardItemList.append(awardItem)
|
| | | layerItem = ChPyNetSendPack.tagMCActXianXiaMJLayerItem()
|
| | | layerItem.ItemLibType = libType
|
| | | layerItem.ItemID = itemID
|
| | | layerItem.ItemCount = libItemInfo[0]
|
| | | layerItem.PosNum = posNum
|
| | | layerItem.TotalTimesMax = awardTimesTotalInfo.get(itemID, 0)
|
| | | layerItem.TotalTimesNow = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardItemTimes % (actNum, libType, itemID))
|
| | | layerItem.LayerLimit = layerLimitInfo.get(itemID, 0)
|
| | | clientPack.AwardItemList.append(layerItem)
|
| | |
|
| | | # 大奖物品待选择库,全部同步
|
| | | if libType == Def_SuperLibType:
|
| | | for itemID, libItemInfo in libItemDict.items():
|
| | | awardItem = ChPyNetSendPack.tagMCActXianXiaMJAwardItem()
|
| | | awardItem.ItemLibType = libType
|
| | | awardItem.ItemID = itemID
|
| | | awardItem.ItemCount = libItemInfo[0]
|
| | | awardItem.TotalTimesMax = awardTimesTotalInfo.get(itemID, 0)
|
| | | awardItem.TotalTimesNow = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardItemTimes % (actNum, libType, itemID))
|
| | | awardItem.LayerLimit = layerLimitInfo.get(itemID, 0)
|
| | | clientPack.SuperItemList.append(awardItem)
|
| | | layerItem = ChPyNetSendPack.tagMCActXianXiaMJLayerItem()
|
| | | layerItem.ItemLibType = libType
|
| | | layerItem.ItemID = itemID
|
| | | layerItem.ItemCount = libItemInfo[0]
|
| | | layerItem.TotalTimesMax = awardTimesTotalInfo.get(itemID, 0)
|
| | | layerItem.TotalTimesNow = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_XianXiaMJAwardItemTimes % (actNum, libType, itemID))
|
| | | layerItem.LayerLimit = layerLimitInfo.get(itemID, 0)
|
| | | clientPack.SuperItemList.append(layerItem)
|
| | | clientPack.SuperItemCount = len(clientPack.SuperItemList)
|
| | | clientPack.SuperItemCanChooseCount = libItemCount
|
| | |
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def __GetXianXiaMJAwardLibItem(libItemInfo, actWorldLV):
|
| | | ## 获取奖励库物品信息字典,支持按世界等级范围配置的格式
|
| | | keyList = libItemInfo.keys()
|
| | | if not keyList:
|
| | | return {}
|
| | | if isinstance(keyList[0], tuple) and len(keyList[0]) == 2:
|
| | | return GameWorld.GetDictValueByRangeKey(libItemInfo, actWorldLV, {})
|
| | | return libItemInfo
|
| | | def Sync_CrossActXianXiaMJActionInfo(curPlayer):
|
| | | ## 通知活动信息
|
| | | actInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_XianXiaMJ)
|
| | | if not actInfo:
|
| | | return
|
| | |
|
| | | if not actInfo.get(ShareDefine.ActKey_State):
|
| | | return
|
| | | |
| | | ipyDataDict = actInfo.get(ShareDefine.ActKey_IpyDataInfo, {})
|
| | | if not ipyDataDict:
|
| | | return
|
| | | |
| | | personalTempID = ipyDataDict.get("PersonalTemplateID", 0)
|
| | | personalTempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActXianXiaMJBillTemp", personalTempID) if personalTempID else []
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCCrossActXianXiaMJInfo()
|
| | | clientPack.ServerIDRangeInfo = str(actInfo.get(ShareDefine.ActKey_ServerIDRangeList, []))
|
| | | clientPack.ServerInfoLen = len(clientPack.ServerIDRangeInfo)
|
| | | clientPack.GroupValue1 = ipyDataDict.get("ZoneID", 0)
|
| | | clientPack.StartDate = ipyDataDict.get("StartDate", "")
|
| | | clientPack.EndtDate = ipyDataDict.get("EndDate", "")
|
| | | clientPack.JoinStartTime = ipyDataDict.get("JoinStartTime", "")
|
| | | clientPack.JoinEndTime = ipyDataDict.get("JoinEndTime", "")
|
| | | clientPack.IsDayReset = ipyDataDict.get("IsDayReset", 0)
|
| | | clientPack.RankLimitPersonal = ipyDataDict.get("RankLimitPersonal", 0)
|
| | | |
| | | clientPack.PersonalBillboardInfoList = __GetTempRankBillPackList(personalTempIpyDataList)
|
| | | clientPack.PersonalBillCount = len(clientPack.PersonalBillboardInfoList)
|
| | | |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def __GetTempRankBillPackList(ipyDataList):
|
| | | packBillList = []
|
| | | if not ipyDataList:
|
| | | return packBillList
|
| | | for tempIpyData in ipyDataList:
|
| | | rankInfo = ChPyNetSendPack.tagMCActXianXiaMJBillard()
|
| | | rankInfo.Rank = tempIpyData.GetRank()
|
| | | |
| | | rankInfo.AwardItemList = []
|
| | | awardItemList = tempIpyData.GetAwardItemList()
|
| | | for itemID, itemCount, isAuctionItem in awardItemList:
|
| | | item = ChPyNetSendPack.tagMCActXianXiaMJItem()
|
| | | item.Clear()
|
| | | item.ItemID = itemID
|
| | | item.ItemCount = itemCount
|
| | | item.IsBind = isAuctionItem
|
| | | rankInfo.AwardItemList.append(item)
|
| | | rankInfo.Count = len(rankInfo.AwardItemList)
|
| | | |
| | | # rankInfo.MemAwardItemList = []
|
| | | # memAwardItemList = tempIpyData.GetMemAwardItemList()
|
| | | # for itemID, itemCount, isAuctionItem in memAwardItemList:
|
| | | # item = ChPyNetSendPack.tagMCActXianXiaMJItem()
|
| | | # item.Clear()
|
| | | # item.ItemID = itemID
|
| | | # item.ItemCount = itemCount
|
| | | # item.IsBind = isAuctionItem
|
| | | # rankInfo.MemAwardItemList.append(item)
|
| | | # rankInfo.MemCount = len(rankInfo.MemAwardItemList)
|
| | | |
| | | packBillList.append(rankInfo)
|
| | | return packBillList
|