10178 【越南】【香港】【主干】挂机奖励(集字活动、垃圾分类活动支持掉落活动物品; 终身卡免费领取快速挂机收益;)
| | |
| | | BYTE LastDayOnlyExchange; //最后一天是否仅兑换
|
| | | WORD TemplateID; //兑换模板编号
|
| | | WORD DropDiffLVLimit; //掉落等级差值限制
|
| | | list GuajiAwardSet; //挂机收益设置,x秒|x次小怪掉率
|
| | | list DropItemRateList; //小怪掉落饼图概率
|
| | | list DropItemRateListBoss; //Boss掉落饼图概率
|
| | | };
|
| | |
| | | ExpPoint = 0 #(DWORD ExpPoint)// 已累计经验,整除亿部分
|
| | | MoneyInfoLen = 0 #(BYTE MoneyInfoLen)
|
| | | MoneyInfo = "" #(String MoneyInfo)// 已累计货币 [[货币类型, 货币值], ...]
|
| | | ItemInfoLen = 0 #(BYTE ItemInfoLen)
|
| | | ItemInfoLen = 0 #(WORD ItemInfoLen)
|
| | | ItemInfo = "" #(String ItemInfo)// 已累计物品 [[物品ID, 个数], ...]
|
| | | data = None
|
| | |
|
| | |
| | | self.ExpPoint,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.MoneyInfoLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.MoneyInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.MoneyInfoLen)
|
| | | self.ItemInfoLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.ItemInfoLen,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.ItemInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.ItemInfoLen)
|
| | | return _pos
|
| | |
|
| | |
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.MoneyInfo)
|
| | | length += 1
|
| | | length += 2
|
| | | length += len(self.ItemInfo)
|
| | |
|
| | | return length
|
| | |
| | | data = CommFunc.WriteDWORD(data, self.ExpPoint)
|
| | | data = CommFunc.WriteBYTE(data, self.MoneyInfoLen)
|
| | | data = CommFunc.WriteString(data, self.MoneyInfoLen, self.MoneyInfo)
|
| | | data = CommFunc.WriteBYTE(data, self.ItemInfoLen)
|
| | | data = CommFunc.WriteWORD(data, self.ItemInfoLen)
|
| | | data = CommFunc.WriteString(data, self.ItemInfoLen, self.ItemInfo)
|
| | | return data
|
| | |
|
| | |
| | | #集字活动
|
| | | Def_PDict_CollectWordsID = "CollectWordsID_%s" # 玩家身上的活动ID,唯一标识,取活动开始日期time值,参数(活动编号 1 或 2)
|
| | | Def_PDict_CollectWordsExchangeCount = "CollectWordsCount_%s_%s" # 兑换编号对应已兑换次数,参数(活动编号, 兑换编号)
|
| | | Def_PDict_CollectWordsGJSeconds = "CollectWordsGJSeconds_%s" # 挂机未处理收益的秒数,参数(活动编号)
|
| | |
|
| | | #BOSS复活
|
| | | Def_PDict_BossRebornID = "BossRebornID" # 玩家身上的BOSS复活活动ID,唯一标识,取活动开始日期time值
|
| | |
| | | Def_PDict_GarbageTaskValue = "ActGSTaskValue_%s_%s" # 任务总进度值,参数(活动编号, 任务ID)
|
| | | Def_PDict_GarbageTaskFinishCount = "ActGSTaskFinishCount_%s_%s" # 任务已完成次数,参数(活动编号, 任务ID)
|
| | | Def_PDict_GarbageEnvironmentValue = "ActGSEnvValue_%s" # 活动累计获得环保值,参数(活动编号)
|
| | | Def_PDict_GarbageGJSeconds = "ActGSGJSeconds_%s" # 挂机未处理收益的秒数,参数(活动编号)
|
| | |
|
| | | #仙匣秘境活动
|
| | | Def_PDict_XianXiaMJID = "ActXXMJID_%s" # 玩家身上的活动ID,唯一标识,取活动开始日期time值,参数:(活动编号)
|
| | |
| | | ExpPoint = 0 #(DWORD ExpPoint)// 已累计经验,整除亿部分
|
| | | MoneyInfoLen = 0 #(BYTE MoneyInfoLen)
|
| | | MoneyInfo = "" #(String MoneyInfo)// 已累计货币 [[货币类型, 货币值], ...]
|
| | | ItemInfoLen = 0 #(BYTE ItemInfoLen)
|
| | | ItemInfoLen = 0 #(WORD ItemInfoLen)
|
| | | ItemInfo = "" #(String ItemInfo)// 已累计物品 [[物品ID, 个数], ...]
|
| | | data = None
|
| | |
|
| | |
| | | self.ExpPoint,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.MoneyInfoLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.MoneyInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.MoneyInfoLen)
|
| | | self.ItemInfoLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.ItemInfoLen,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.ItemInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.ItemInfoLen)
|
| | | return _pos
|
| | |
|
| | |
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.MoneyInfo)
|
| | | length += 1
|
| | | length += 2
|
| | | length += len(self.ItemInfo)
|
| | |
|
| | | return length
|
| | |
| | | data = CommFunc.WriteDWORD(data, self.ExpPoint)
|
| | | data = CommFunc.WriteBYTE(data, self.MoneyInfoLen)
|
| | | data = CommFunc.WriteString(data, self.MoneyInfoLen, self.MoneyInfo)
|
| | | data = CommFunc.WriteBYTE(data, self.ItemInfoLen)
|
| | | data = CommFunc.WriteWORD(data, self.ItemInfoLen)
|
| | | data = CommFunc.WriteString(data, self.ItemInfoLen, self.ItemInfo)
|
| | | return data
|
| | |
|
| | |
| | | ("BYTE", "LastDayOnlyExchange", 0),
|
| | | ("WORD", "TemplateID", 0),
|
| | | ("WORD", "DropDiffLVLimit", 0),
|
| | | ("list", "GuajiAwardSet", 0),
|
| | | ("list", "DropItemRateList", 0),
|
| | | ("list", "DropItemRateListBoss", 0),
|
| | | ),
|
| | |
| | | def GetLastDayOnlyExchange(self): return self.attrTuple[4] # 最后一天是否仅兑换 BYTE
|
| | | def GetTemplateID(self): return self.attrTuple[5] # 兑换模板编号 WORD
|
| | | def GetDropDiffLVLimit(self): return self.attrTuple[6] # 掉落等级差值限制 WORD
|
| | | def GetDropItemRateList(self): return self.attrTuple[7] # 小怪掉落饼图概率 list
|
| | | def GetDropItemRateListBoss(self): return self.attrTuple[8] # Boss掉落饼图概率 list |
| | | def GetGuajiAwardSet(self): return self.attrTuple[7] # 挂机收益设置,x秒|x次小怪掉率 list
|
| | | def GetDropItemRateList(self): return self.attrTuple[8] # 小怪掉落饼图概率 list
|
| | | def GetDropItemRateListBoss(self): return self.attrTuple[9] # Boss掉落饼图概率 list |
| | | |
| | | # 集字活动兑换模板表 |
| | | class IPY_CollectWordsExchange(): |
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsExchangeCount % (actNum, exchangeNum), 0)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsID % actNum, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsGJSeconds % actNum, 0)
|
| | | GameWorld.DebugLog("集字活动重置! actNum=%s,cfgID=%s,templateID=%s,actID=%s" % (actNum, cfgID, templateID, actID), playerID)
|
| | |
|
| | | if state:
|
| | |
| | |
|
| | | return dropItemCountDict
|
| | |
|
| | | def OnGetGuajiAwardItemDict(curPlayer, awardSeconds, isQuick):
|
| | | ## 获取挂机收益
|
| | | |
| | | dropItemCountDict = {}
|
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CollectWords, {}).values():
|
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
|
| | | |
| | | if not actInfo.get(ShareDefine.ActKey_State):
|
| | | continue
|
| | | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActCollectWords", cfgID)
|
| | | if not ipyData:
|
| | | continue
|
| | | |
| | | dropRateList = ipyData.GetDropItemRateList()
|
| | | if not dropRateList:
|
| | | continue
|
| | | |
| | | guajiAwardSet = ipyData.GetGuajiAwardSet() # x秒x次
|
| | | if not guajiAwardSet:
|
| | | continue
|
| | | doSeconds, doCount = guajiAwardSet
|
| | | |
| | | if not isQuick:
|
| | | unSeconds = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CollectWordsGJSeconds % (actNum))
|
| | | awardSeconds += unSeconds
|
| | | |
| | | canDoCount = awardSeconds / doSeconds
|
| | | killCount = canDoCount * doCount
|
| | | |
| | | updUnSeconds = awardSeconds % doSeconds
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsGJSeconds % (actNum), updUnSeconds)
|
| | | GameWorld.DebugLog(" 挂机集字活动: actNum=%s,awardSeconds=%s,canDoCount=%s,killCount=%s,unSeconds=%s,updUnSeconds=%s" |
| | | % (actNum, awardSeconds, canDoCount, killCount, unSeconds, updUnSeconds))
|
| | | else:
|
| | | canDoCount = awardSeconds / doSeconds
|
| | | killCount = canDoCount * doCount
|
| | | GameWorld.DebugLog(" 挂机集字活动: actNum=%s,awardSeconds=%s,canDoCount=%s,killCount=%s" |
| | | % (actNum, awardSeconds, canDoCount, killCount))
|
| | | if killCount <= 0:
|
| | | continue
|
| | | |
| | | preRate = 0
|
| | | maxRate = dropRateList[-1][0]
|
| | | for rateInfo in dropRateList:
|
| | | rate, dropItemID = rateInfo
|
| | | curRate = rate - preRate
|
| | | if not curRate:
|
| | | break
|
| | | preRate = rate
|
| | | if not dropItemID:
|
| | | continue
|
| | | totalRate = curRate * killCount # 总概率
|
| | | dropCount = totalRate / maxRate # 可掉落数
|
| | | rateEx = totalRate % maxRate # 剩余概率
|
| | | if GameWorld.CanHappen(rateEx, maxRate):
|
| | | dropCount += 1
|
| | | if not dropCount:
|
| | | continue
|
| | | |
| | | dropItemCountDict[dropItemID] = dropItemCountDict.get(dropItemID, 0) + dropCount
|
| | | GameWorld.DebugLog(" 挂机集字活动掉字: actNum=%s,dropItemID=%s,dropCount=%s,curRate=%s,totalRate=%s" |
| | | % (actNum, dropItemID, dropCount, curRate, totalRate))
|
| | | |
| | | return dropItemCountDict
|
| | |
|
| | | #// AA 09 集字活动兑换 #tagCMActCollectWordsExchange
|
| | | #
|
| | | #struct tagCMActCollectWordsExchange
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GarbageTaskValue % (actNum, taskID), 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GarbageTaskFinishCount % (actNum, taskID), 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GarbageEnvironmentValue % actNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GarbageGJSeconds % actNum, 0)
|
| | |
|
| | | # 清除垃圾背包物品、重置环保值
|
| | | ItemControler.ClearPack(curPlayer, ShareDefine.rptGarbage)
|
| | |
| | | Sync_GarbageTaskInfo(curPlayer, actNum, taskID)
|
| | | return giveItemList
|
| | |
|
| | | def OnGetGuajiAwardItemDict(curPlayer, awardSeconds, isQuick):
|
| | | ## 获取挂机收益
|
| | | |
| | | dropItemCountDict = {}
|
| | | guajiAwardSet = IpyGameDataPY.GetFuncEvalCfg("GarbageSorting", 3) # 挂机收益设置 x秒|x次执行数值4
|
| | | if not guajiAwardSet:
|
| | | return dropItemCountDict
|
| | | doSeconds, doCount = guajiAwardSet
|
| | | |
| | | dropRateList = IpyGameDataPY.GetFuncEvalCfg("GarbageSorting", 4) # 挂机收益概率饼图 [[概率, [物品ID,个数,是否拍品]], ...]
|
| | | |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GarbageSorting, {}).values():
|
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
|
| | | |
| | | if not actInfo.get(ShareDefine.ActKey_State):
|
| | | continue
|
| | | |
| | | if not isQuick:
|
| | | unSeconds = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GarbageGJSeconds % (actNum))
|
| | | awardSeconds += unSeconds
|
| | | |
| | | canDoCount = awardSeconds / doSeconds
|
| | | killCount = canDoCount * doCount
|
| | | |
| | | updUnSeconds = awardSeconds % doSeconds
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GarbageGJSeconds % (actNum), updUnSeconds)
|
| | | GameWorld.DebugLog(" 挂机垃圾分类: actNum=%s,awardSeconds=%s,canDoCount=%s,killCount=%s,unSeconds=%s,updUnSeconds=%s" |
| | | % (actNum, awardSeconds, canDoCount, killCount, unSeconds, updUnSeconds))
|
| | | else:
|
| | | canDoCount = awardSeconds / doSeconds
|
| | | killCount = canDoCount * doCount
|
| | | GameWorld.DebugLog(" 挂机垃圾分类: actNum=%s,awardSeconds=%s,canDoCount=%s,killCount=%s" |
| | | % (actNum, awardSeconds, canDoCount, killCount))
|
| | | if killCount <= 0:
|
| | | continue
|
| | | |
| | | preRate = 0
|
| | | maxRate = dropRateList[-1][0]
|
| | | for rateInfo in dropRateList:
|
| | | rate, dropItemInfo = rateInfo
|
| | | curRate = rate - preRate
|
| | | if not curRate:
|
| | | break
|
| | | preRate = rate
|
| | | if not dropItemInfo:
|
| | | continue
|
| | | totalRate = curRate * killCount # 总概率
|
| | | dropCount = totalRate / maxRate # 可掉落数
|
| | | rateEx = totalRate % maxRate # 剩余概率
|
| | | if GameWorld.CanHappen(rateEx, maxRate):
|
| | | dropCount += 1
|
| | | if not dropCount:
|
| | | continue
|
| | | dropItemID, itemCount, _ = dropItemInfo
|
| | | dropItemCount = itemCount * dropCount
|
| | | |
| | | dropItemCountDict[dropItemID] = dropItemCountDict.get(dropItemID, 0) + dropItemCount
|
| | | GameWorld.DebugLog(" 挂机垃圾分类产出: actNum=%s,dropItemID=%s,dropCount=%s,dropItemCount=%s,curRate=%s,totalRate=%s" |
| | | % (actNum, dropItemID, dropCount, dropItemCount, curRate, totalRate))
|
| | | |
| | | return dropItemCountDict
|
| | |
|
| | | #// AA 14 垃圾分类活动分类垃圾 #tagCMActGarbageSorting
|
| | | #
|
| | | #struct tagCMActGarbageSorting
|
| | |
| | | import PlayerControl
|
| | | import ChPyNetSendPack
|
| | | import PlayerWorldAverageLv
|
| | | import PlayerActGarbageSorting
|
| | | import PlayerActCollectWords
|
| | | import PlayerGoldInvest
|
| | | import FormulaControl
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | |
| | | itemID, itemCount = itemInfo
|
| | | itemDict[itemID] = itemDict.get(itemID, 0) + itemCount
|
| | |
|
| | | # 集字掉落
|
| | | dropWordsCountDict = PlayerActCollectWords.OnGetGuajiAwardItemDict(curPlayer, awardSeconds, isQuick)
|
| | | for itemID, dropCount in dropWordsCountDict.items():
|
| | | itemDict[itemID] = itemDict.get(itemID, 0) + dropCount
|
| | | |
| | | # 垃圾回收
|
| | | giveGarbageItemList = PlayerActGarbageSorting.OnGetGuajiAwardItemDict(curPlayer, awardSeconds, isQuick)
|
| | | for itemID, dropCount in giveGarbageItemList.items():
|
| | | itemDict[itemID] = itemDict.get(itemID, 0) + dropCount
|
| | | |
| | | GameWorld.DebugLog(" itemDict=%s" % (itemDict), playerID)
|
| | | return addExp, moneyDict, itemDict
|
| | |
|
| | |
| | | GameWorld.DebugLog("快速挂机收益次数已达每日上限! quickCountToday=%s" % quickCountToday, playerID)
|
| | | return
|
| | |
|
| | | if quickCountToday >= quickCountFree:
|
| | | if quickCountToday >= quickCountFree and not PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | todayBuyCount = quickCountToday - quickCountFree # 今日已购买次数
|
| | | costMoneyType = IpyGameDataPY.GetFuncCfg("GuajiQuick", 3)
|
| | | costMoneyList = IpyGameDataPY.GetFuncEvalCfg("GuajiQuick", 4)
|
| | |
| | | for moneyType, moneyValue in moneyDict.items():
|
| | | PlayerControl.GiveMoney(curPlayer, moneyType, moneyValue, "Guaji")
|
| | |
|
| | | giveItemList = [[itemID, itemCount, 0] for itemID, itemCount in itemDict.items()]
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, event=["Guaji", False, {}])
|
| | | |
| | | # 分背包放入
|
| | | packTypeItemDict = {}
|
| | | for itemID, itemCount in itemDict.items():
|
| | | itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
|
| | | if not itemData:
|
| | | continue
|
| | | packType = ChConfig.GetItemPackType(itemData)
|
| | | if packType not in packTypeItemDict:
|
| | | packTypeItemDict[packType] = []
|
| | | giveItemList = packTypeItemDict[packType]
|
| | | giveItemList.append([itemID, itemCount, 0])
|
| | | |
| | | for packType, giveItemList in packTypeItemDict.items():
|
| | | # 垃圾分类背包直接放入
|
| | | if packType == ShareDefine.rptGarbage:
|
| | | for itemID, itemCount, isAuctionItem in giveItemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [packType], event=["Guaji", False, {}])
|
| | | else:
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, giveItemList, event=["Guaji", False, {}])
|
| | | |
| | | Sync_GuajiAward(curPlayer, 1, awardSeconds, exp, moneyDict, itemDict)
|
| | | return
|
| | |
|