6256 子 【开发】【2.0】神秘商店开发 / 【后端】【2.0】神秘商店
| | |
| | | WORD ItemCnt; //物品数量
|
| | | BYTE IsBind; //是否绑定
|
| | | DWORD Weight; //权重
|
| | | };
|
| | |
|
| | | //神秘商店表
|
| | |
|
| | | struct tagMysteryShop
|
| | | {
|
| | | list LVRange; //等级范围
|
| | | DWORD GoodsID; //商城表ID
|
| | | }; |
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 32 神秘商店刷新 #tagCMRefreshMysticalShop
|
| | |
|
| | | class tagCMRefreshMysticalShop(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA2
|
| | | self.SubCmd = 0x32
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA2
|
| | | self.SubCmd = 0x32
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMRefreshMysticalShop)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A2 32 神秘商店刷新 //tagCMRefreshMysticalShop:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMRefreshMysticalShop=tagCMRefreshMysticalShop()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMRefreshMysticalShop.Cmd,m_NAtagCMRefreshMysticalShop.SubCmd))] = m_NAtagCMRefreshMysticalShop
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 14 刷新定时神秘商店物品#tagCMRefreshShopItem
|
| | |
|
| | | class tagCMRefreshShopItem(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A8 16 神秘商店商品信息 #tagMCMysticalShopInfo
|
| | |
|
| | | class tagMCMysticalShopGoods(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("GoodsID", c_int), # 商品ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.GoodsID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCMysticalShopGoods)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A8 16 神秘商店商品信息 //tagMCMysticalShopInfo:
|
| | | GoodsID:%d
|
| | | '''\
|
| | | %(
|
| | | self.GoodsID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCMysticalShopInfo(Structure):
|
| | | Head = tagHead()
|
| | | RefreshCnt = 0 #(WORD RefreshCnt)// 刷新次数
|
| | | Count = 0 #(BYTE Count)// 商品数
|
| | | GoodsList = list() #(vector<tagMCMysticalShopGoods> GoodsList)// 商品信息
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA8
|
| | | self.Head.SubCmd = 0x16
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.RefreshCnt,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temGoodsList = tagMCMysticalShopGoods()
|
| | | _pos = temGoodsList.ReadData(_lpData, _pos)
|
| | | self.GoodsList.append(temGoodsList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA8
|
| | | self.Head.SubCmd = 0x16
|
| | | self.RefreshCnt = 0
|
| | | self.Count = 0
|
| | | self.GoodsList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 2
|
| | | length += 1
|
| | | for i in range(self.Count):
|
| | | length += self.GoodsList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteWORD(data, self.RefreshCnt)
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.GoodsList[i].GetLength(), self.GoodsList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | RefreshCnt:%d,
|
| | | Count:%d,
|
| | | GoodsList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.RefreshCnt,
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCMysticalShopInfo=tagMCMysticalShopInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCMysticalShopInfo.Head.Cmd,m_NAtagMCMysticalShopInfo.Head.SubCmd))] = m_NAtagMCMysticalShopInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A8 06 通知神秘限购商品时间 #tagMCMysticalShopTimeInfo
|
| | |
|
| | | class tagMCMysticalShopTime(Structure):
|
| | |
| | | Writer = wdb
|
| | | Releaser = wdb
|
| | | RegType = 0
|
| | | RegisterPackCount = 2
|
| | | RegisterPackCount = 3
|
| | |
|
| | | PacketCMD_1=0xA2
|
| | | PacketSubCMD_1=0x01
|
| | |
| | | PacketSubCMD_2=0x11
|
| | | PacketCallFunc_2=OnSellManyItem
|
| | |
|
| | | PacketCMD_3=0xA2
|
| | | PacketSubCMD_3=0x32
|
| | | PacketCallFunc_3=OnMysticalShopRefresh
|
| | |
|
| | | ;物品管理
|
| | | [ItemControler]
|
| | | ScriptName = Item\ItemControler.py
|
| | |
| | | Def_PlayerKey_ComboBuffProcessState = "ComboBuffProcessState" #持续性buff连击处理状态
|
| | | Def_PlayerKey_LvAwardQueryState = 'LvAwardQueryState' # 等级奖励领奖查询状态
|
| | | Def_PlayerKey_StoreQueryState = 'StoreQueryState' # 商店全服购买次数查询状态
|
| | | Def_PlayerKey_MysticalShopLastTime = 'MysticalShopLastTime' # 神秘商店刷新时间
|
| | | #===============================================================================
|
| | | # # 持续性buff伤害处理连击技能ID列表
|
| | | # # 因为释放一次技能后一段时间内是持续性的, 故连接判断效果仅处理一次, 持续时间内均受此效果影响, 不重复处理连击
|
| | |
| | | Def_PDict_CollNpcIDCollTime = "CollNpcIDCollTime_%s" # 采集NPCID对应每日对应采集次数,%sNPCID
|
| | | Def_PDict_ShopItemDayBuyCnt = "ShopItemDayBuyCnt_%s" # 商店NPC商品已购买次数,itemIndex
|
| | | Def_PDict_ShopItemStartTime = "ShopItemStartTime_%s" # 神秘限购商品开卖时间,itemIndex
|
| | | Def_PDict_MysticalShopGoods = "MysticalShopGoods_%s" # 神秘商店商品ID,索引
|
| | | Def_PDict_MysticalShopRefreshCnt = "MysticalShopRefreshCnt" # 神秘商店已手动刷新次数
|
| | | Def_PDict_MysticalShopLVRefreshCnt = "MysticalShopLVRefreshCnt" # 神秘商店等级段刷新次数
|
| | | Def_PDict_ShopItemBuyCnt = "ShopItemBuyCnt_%s_%s" # 自定义商品已购买次数,(shopID, itemIndex)
|
| | | Def_PDict_ShopItemOpenState = "ShopItemOpenState_%s_%s" # 自定义神秘商店物品开启状态,(shopID, keyNum)
|
| | | Def_PDict_TimeShopRefreshCnt = "TimeShopRefreshCnt_%s" # 自定义神秘商店已手动刷新次数,(shopID)
|
| | |
| | | Def_Cost_FBGatherSoulBoss, # 聚魂副本BOSS召唤 40
|
| | | Def_Cost_CrossRealmPK, # 跨服PK
|
| | | Def_Cost_LuckyTreasure, #幸运鉴宝
|
| | | Def_Cost_MysteryShopRefresh, # 神秘商店刷新
|
| | | #-----------以下为暂时没用的,先不删除,如有新增消费点则放在这些之前------------
|
| | | Def_Cost_RefreshArrestTask, # 刷新悬赏任务
|
| | | Def_Cost_OffLineExp, # 兑换离线经验
|
| | |
| | | Def_Cost_Trade, # 交易
|
| | | Def_Cost_Rename, # 改名
|
| | | Def_Cost_SkillLvUp, # 技能升级
|
| | | ) = range(2000, 2000 + 58)
|
| | | ) = range(2000, 2000 + 59)
|
| | |
|
| | | Def_Cost_Reason_SonKey = "reason_name_son" # 消费点原因子类说明key
|
| | |
|
| | |
| | | Def_Cost_FBGatherSoulBoss:"FBGatherSoulBoss",
|
| | | Def_Cost_CrossRealmPK:"CrossRealmPK",
|
| | | Def_Cost_LuckyTreasure:"LuckyTreasure",
|
| | | Def_Cost_MysteryShopRefresh:"MysteryShopRefresh",
|
| | | }
|
| | | ## -----------------------------------------------------
|
| | |
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 32 神秘商店刷新 #tagCMRefreshMysticalShop
|
| | |
|
| | | class tagCMRefreshMysticalShop(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xA2
|
| | | self.SubCmd = 0x32
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xA2
|
| | | self.SubCmd = 0x32
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMRefreshMysticalShop)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A2 32 神秘商店刷新 //tagCMRefreshMysticalShop:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMRefreshMysticalShop=tagCMRefreshMysticalShop()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMRefreshMysticalShop.Cmd,m_NAtagCMRefreshMysticalShop.SubCmd))] = m_NAtagCMRefreshMysticalShop
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A2 14 刷新定时神秘商店物品#tagCMRefreshShopItem
|
| | |
|
| | | class tagCMRefreshShopItem(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A8 16 神秘商店商品信息 #tagMCMysticalShopInfo
|
| | |
|
| | | class tagMCMysticalShopGoods(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("GoodsID", c_int), # 商品ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.GoodsID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCMysticalShopGoods)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A8 16 神秘商店商品信息 //tagMCMysticalShopInfo:
|
| | | GoodsID:%d
|
| | | '''\
|
| | | %(
|
| | | self.GoodsID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCMysticalShopInfo(Structure):
|
| | | Head = tagHead()
|
| | | RefreshCnt = 0 #(WORD RefreshCnt)// 刷新次数
|
| | | Count = 0 #(BYTE Count)// 商品数
|
| | | GoodsList = list() #(vector<tagMCMysticalShopGoods> GoodsList)// 商品信息
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA8
|
| | | self.Head.SubCmd = 0x16
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.RefreshCnt,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temGoodsList = tagMCMysticalShopGoods()
|
| | | _pos = temGoodsList.ReadData(_lpData, _pos)
|
| | | self.GoodsList.append(temGoodsList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA8
|
| | | self.Head.SubCmd = 0x16
|
| | | self.RefreshCnt = 0
|
| | | self.Count = 0
|
| | | self.GoodsList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 2
|
| | | length += 1
|
| | | for i in range(self.Count):
|
| | | length += self.GoodsList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteWORD(data, self.RefreshCnt)
|
| | | data = CommFunc.WriteBYTE(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.GoodsList[i].GetLength(), self.GoodsList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | RefreshCnt:%d,
|
| | | Count:%d,
|
| | | GoodsList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.RefreshCnt,
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCMysticalShopInfo=tagMCMysticalShopInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCMysticalShopInfo.Head.Cmd,m_NAtagMCMysticalShopInfo.Head.SubCmd))] = m_NAtagMCMysticalShopInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A8 06 通知神秘限购商品时间 #tagMCMysticalShopTimeInfo
|
| | |
|
| | | class tagMCMysticalShopTime(Structure):
|
| | |
| | | import random
|
| | | import math
|
| | | import time
|
| | |
|
| | | g_mysticalShopDict = {} #神秘商店{等级范围:[等级段,{金钱类型:库}]}
|
| | | #---------------------------------------------------------------------
|
| | | ##开始交易
|
| | | # @param curPlayer 玩家实例
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftHasOpen, 1)
|
| | |
|
| | |
|
| | | SyncMysticalShopInfo(curPlayer)
|
| | | SyncMysticalLimitShopInfo(curPlayer)
|
| | | SyncShopItemTodayBuyCount(curPlayer)
|
| | | SyncSuperGiftInfo(curPlayer)
|
| | | SyncMysticalShopInfo(curPlayer)
|
| | | return
|
| | |
|
| | | ##商店物品OnDay
|
| | |
| | | UpdataSuperGiftTime(curPlayer, True)
|
| | | OSSaleOpenMail(curPlayer)
|
| | | refreshType = [3]
|
| | | #神秘商店刷新次数重置
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MysticalShopRefreshCnt, 0)
|
| | | SyncMysticalShopInfo(curPlayer)
|
| | | |
| | | elif onEventType == ShareDefine.Def_OnEventTypeEx:
|
| | | refreshType = [4]
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
|
| | |
| | | SyncShopItemTodayBuyCount(curPlayer, syncIndexList, True)
|
| | | return
|
| | |
|
| | | def MysticalShopOpen(curPlayer, befLV, aftLV):
|
| | | def MysticalLimitShopOpen(curPlayer, befLV, aftLV):
|
| | | ##神秘限购开启
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('Store', {'ShopType':16}, True)
|
| | | if not ipyDataList:
|
| | |
| | | syncGoodsList.append(goodsID)
|
| | | GameWorld.DebugLog('神秘限购商品%s 开卖'%goodsID, curPlayer.GetID())
|
| | | if syncGoodsList:
|
| | | SyncMysticalShopInfo(curPlayer)
|
| | | SyncMysticalLimitShopInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def SyncMysticalShopInfo(curPlayer):
|
| | | def SyncMysticalLimitShopInfo(curPlayer):
|
| | | ##神秘限购通知
|
| | | packData = ChPyNetSendPack.tagMCMysticalShopTimeInfo()
|
| | | packData.ShopTimeList = []
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
|
| | | def CheckMysticalShopRefresh(curPlayer, tick):
|
| | | ##神秘商店刷新
|
| | | createRoleTime = curPlayer.GetCreateRoleTime()
|
| | | diffTime = GameWorld.GetCurrentTime() - GameWorld.GetDateTimeByStr(createRoleTime, ChConfig.TYPE_Time_Format)
|
| | | pastSeconds = diffTime.days*24*60*60 + diffTime.seconds
|
| | | refreshTime = IpyGameDataPY.GetFuncCfg('MysteryShopRefresh', 4)
|
| | | if pastSeconds % refreshTime == 0:
|
| | | __DoMysticalShopRefresh(curPlayer, True, tick)
|
| | | return
|
| | |
|
| | | #// A2 32 神秘商店刷新 #tagCMRefreshMysticalShop
|
| | | #struct tagCMRefreshMysticalShop
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnMysticalShopRefresh(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | __DoMysticalShopRefresh(curPlayer, False, tick)
|
| | | return
|
| | |
|
| | | def __DoMysticalShopRefresh(curPlayer, isFree, tick):
|
| | | global g_mysticalShopDict #{等级范围:[等级段,{金钱类型:库}]}
|
| | | |
| | | lastTime = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MysticalShopLastTime)
|
| | | if lastTime and tick - lastTime < 1000:
|
| | | #GameWorld.DebugLog('神秘商店刷新,过于频繁!')
|
| | | return
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MysticalShopLastTime, tick)
|
| | | if not g_mysticalShopDict:
|
| | | ipyMgr= IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyMgr.GetMysteryShopCount()):
|
| | | ipyData = ipyMgr.GetMysteryShopByIndex(i)
|
| | | lvRange = ipyData.GetLVRange()
|
| | | goodsID = ipyData.GetGoodsID()
|
| | | goodsIpyData = IpyGameDataPY.GetIpyGameData('Store', goodsID)
|
| | | moneyType = goodsIpyData.GetMoneyType()
|
| | | weight = goodsIpyData.GetLimitValue()
|
| | | lvkey = tuple(lvRange)
|
| | | if lvkey not in g_mysticalShopDict:
|
| | | g_mysticalShopDict[lvkey] = [lvkey[0], {}]
|
| | | weightDict = {}
|
| | | if moneyType not in g_mysticalShopDict[lvkey][1]:
|
| | | g_mysticalShopDict[lvkey][1][moneyType] = []
|
| | | weightDict[moneyType] = weightDict.get(moneyType, 0) + weight
|
| | | g_mysticalShopDict[lvkey][1][moneyType].append([weightDict[moneyType], goodsID])
|
| | | |
| | | playerLV = curPlayer.GetLV()
|
| | | curLVDan, shopDict = GameWorld.GetDictValueByRangeKey(g_mysticalShopDict, playerLV)
|
| | | if not shopDict:
|
| | | return
|
| | | maxCnt = IpyGameDataPY.GetFuncCfg('MysteryShopGoods', 1)
|
| | | goldGoodsCnt =GameWorld.GetResultByRandomList(IpyGameDataPY.GetFuncEvalCfg('MysteryShopGoods', 2))
|
| | | if not goldGoodsCnt:
|
| | | return
|
| | | specialGoodsID = 0 #必出的商品ID
|
| | | if not isFree:
|
| | | #优先道具,再仙玉
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | costItemID = IpyGameDataPY.GetFuncCfg('MysteryShopRefresh', 1)
|
| | | costItemCntDict = IpyGameDataPY.GetFuncEvalCfg('MysteryShopRefresh', 2)
|
| | | curRefreshCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MysticalShopRefreshCnt)
|
| | | cntList = [int(cnt) for cnt in costItemCntDict.keys()]
|
| | | cntList.sort()
|
| | | costItemCnt = costItemCntDict[str(cntList[-1])]
|
| | | for cnt in cntList:
|
| | | if curRefreshCnt <= cnt:
|
| | | costItemCnt = costItemCntDict[str(cnt)]
|
| | | break
|
| | | enough, indexList, hasBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(costItemID, itemPack, costItemCnt)
|
| | | costGold = 0
|
| | | if not enough:
|
| | | costGold = lackCnt * IpyGameDataPY.GetFuncCfg('MysteryShopRefresh', 3)
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, costGold, ChConfig.Def_Cost_MysteryShopRefresh):
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, indexList, costItemCnt, False, "MysteryShopRefresh")
|
| | | curLVRefreshData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MysticalShopLVRefreshCnt)
|
| | | curLVRefreshCnt, lvDan = curLVRefreshData / 10000, curLVRefreshData % 10000 |
| | | updLVRefreshCnt = 1 if curLVDan != lvDan else curLVRefreshCnt + 1 #等级段变更,重置该等级段的刷新次数
|
| | | updLVRefreshData = min(updLVRefreshCnt * 10000+curLVDan, ChConfig.Def_UpperLimit_DWord)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MysticalShopLVRefreshCnt, updLVRefreshData)
|
| | | specialRefreshCfg = IpyGameDataPY.GetFuncEvalCfg('MysteryShopRefresh', 5)
|
| | | if curLVDan in specialRefreshCfg and updLVRefreshCnt == specialRefreshCfg[curLVDan][0]:
|
| | | specialGoodsID = specialRefreshCfg[curLVDan][1]
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MysticalShopRefreshCnt, curRefreshCnt+1)
|
| | | |
| | | goldGoodsCnt = min(goldGoodsCnt, maxCnt)
|
| | | sliverGoodsCnt = maxCnt - goldGoodsCnt
|
| | | goodsResultList = []
|
| | | if goldGoodsCnt:
|
| | | goodsResultList += GameWorld.GetResultByRandomListEx(shopDict.get(IPY_GameWorld.TYPE_Price_Gold_Money, []), goldGoodsCnt, [])
|
| | | if sliverGoodsCnt:
|
| | | goodsResultList += GameWorld.GetResultByRandomListEx(shopDict.get(IPY_GameWorld.TYPE_Price_Silver_Money, []), sliverGoodsCnt, [])
|
| | | if specialGoodsID and specialGoodsID not in goodsResultList:
|
| | | goodsResultList[0] = specialGoodsID
|
| | | GameWorld.DebugLog('神秘商店刷新特殊规则,等级段:%s,updLVRefreshCnt=%s,specialGoodsID=%s'%(curLVDan, updLVRefreshCnt, specialGoodsID))
|
| | | |
| | | GameWorld.DebugLog('神秘商店刷新isFree=%s,goldGoodsCnt=%s,sliverGoodsCnt=%s,goodsResultList=%s'%(isFree, goldGoodsCnt, sliverGoodsCnt, goodsResultList))
|
| | | for i in xrange(maxCnt):
|
| | | goodsID = goodsResultList[i] if i < len(goodsResultList) else 0
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MysticalShopGoods % i, goodsID)
|
| | | #֪ͨ
|
| | | SyncMysticalShopInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def SyncMysticalShopInfo(curPlayer):
|
| | | ##神秘商店通知
|
| | | packData = ChPyNetSendPack.tagMCMysticalShopInfo()
|
| | | packData.RefreshCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MysticalShopRefreshCnt)
|
| | | packData.GoodsList = []
|
| | | maxCnt = IpyGameDataPY.GetFuncCfg('MysteryShopGoods', 1)
|
| | | for i in xrange(maxCnt):
|
| | | goodsID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MysticalShopGoods % i)
|
| | | goodsInfo = ChPyNetSendPack.tagMCMysticalShopGoods()
|
| | | goodsInfo.GoodsID = goodsID
|
| | | packData.GoodsList.append(goodsInfo)
|
| | | packData.Count = len(packData.GoodsList)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
|
| | | ## 回购物品
|
| | | # @param None
|
| | | # @return None
|
| | |
| | | ("BYTE", "IsBind", 0),
|
| | | ("DWORD", "Weight", 0),
|
| | | ),
|
| | |
|
| | | "MysteryShop":(
|
| | | ("list", "LVRange", 0),
|
| | | ("DWORD", "GoodsID", 0),
|
| | | ),
|
| | | }
|
| | |
|
| | | |
| | |
| | | def GetItemCnt(self): return self.ItemCnt # 物品数量
|
| | | def GetIsBind(self): return self.IsBind # 是否绑定
|
| | | def GetWeight(self): return self.Weight # 权重 |
| | | |
| | | # 神秘商店表 |
| | | class IPY_MysteryShop(): |
| | | |
| | | def __init__(self): |
| | | self.LVRange = []
|
| | | self.GoodsID = 0 |
| | | return |
| | | |
| | | def GetLVRange(self): return self.LVRange # 等级范围
|
| | | def GetGoodsID(self): return self.GoodsID # 商城表ID |
| | |
|
| | |
|
| | | def Log(msg, playerID=0, par=0):
|
| | |
| | | self.ipyActLuckyTreasureLen = len(self.ipyActLuckyTreasureCache)
|
| | | self.ipyLuckyTreasureTemplateCache = self.__LoadFileData("LuckyTreasureTemplate", IPY_LuckyTreasureTemplate)
|
| | | self.ipyLuckyTreasureTemplateLen = len(self.ipyLuckyTreasureTemplateCache)
|
| | | self.ipyMysteryShopCache = self.__LoadFileData("MysteryShop", IPY_MysteryShop)
|
| | | self.ipyMysteryShopLen = len(self.ipyMysteryShopCache)
|
| | | Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
|
| | | Log("IPY_DataMgr InitOK!")
|
| | | return
|
| | |
| | | def GetActLuckyTreasureByIndex(self, index): return self.ipyActLuckyTreasureCache[index]
|
| | | def GetLuckyTreasureTemplateCount(self): return self.ipyLuckyTreasureTemplateLen
|
| | | def GetLuckyTreasureTemplateByIndex(self, index): return self.ipyLuckyTreasureTemplateCache[index]
|
| | | def GetMysteryShopCount(self): return self.ipyMysteryShopLen
|
| | | def GetMysteryShopByIndex(self, index): return self.ipyMysteryShopCache[index]
|
| | |
|
| | | IPYData = IPY_DataMgr()
|
| | | def IPY_Data(): return IPYData
|
| | |
| | | # 记录开服活动冲级数据
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_LV, curPlayer.GetLV())
|
| | | #神秘限购
|
| | | FunctionNPCCommon.MysticalShopOpen(curPlayer, befLV, aftLV)
|
| | | FunctionNPCCommon.MysticalLimitShopOpen(curPlayer, befLV, aftLV)
|
| | | #不需要做升级任务, 设置玩家经验
|
| | | SetPlayerTotalExp(curPlayer, curTotalExp)
|
| | | return
|
| | |
| | | import PlayerSuccess
|
| | | import CrossPlayerData
|
| | | import PassiveBuffEffMng
|
| | | import PlayerFamilyRedPacket
|
| | | import FunctionNPCCommon
|
| | | import FormulaControl
|
| | | import PlayerGoldGift
|
| | | import PlayerFlashSale
|
| | |
| | | PlayerFlashSale.ProcessFlashSaleMail(curPlayer, tick)
|
| | | #地图经验
|
| | | ProcessAreaExp(curPlayer, tick)
|
| | | #神秘商店刷新
|
| | | FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)
|
| | | #跨服数据同步,放最后
|
| | | CrossPlayerData.ProcessCrossPlayer(curPlayer, tick)
|
| | | return
|