| | |
| | | list VIPAward; //vip奖励[[物品ID,个数],...]
|
| | | };
|
| | |
|
| | | //投资表
|
| | |
|
| | | struct tagInvest
|
| | | {
|
| | | WORD _ID; //ID
|
| | | BYTE Type; //投资类型
|
| | | BYTE NeedDay; //需要天数
|
| | | WORD NeedLV; //需要等级
|
| | | DWORD NeedNPCID; //需要NPCID
|
| | | dict Reward; //奖励 {"key":[[物品ID,个数,是否绑定],...], ...}
|
| | | };
|
| | |
|
| | | //仙宝寻主表
|
| | |
|
| | | struct tagXBXZ
|
| | |
| | | PacketSubCMD_3=0x24
|
| | | PacketCallFunc_3=MoveTouchNPC
|
| | |
|
| | | ;VIP功能
|
| | | [PlayerVip]
|
| | | ScriptName = Player\PlayerVip.py
|
| | | Writer = alee
|
| | | Releaser = alee
|
| | | RegType = 0
|
| | | RegisterPackCount = 1
|
| | |
|
| | | PacketCMD_1=0xA8
|
| | | PacketSubCMD_1=0x06
|
| | | PacketCallFunc_1=OnQueryRecharge
|
| | |
|
| | | ;玩家副本
|
| | | [PlayerFB]
|
| | | ScriptName = Player\PlayerFB.py
|
| | |
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 3
|
| | | RegisterPackCount = 4
|
| | |
|
| | | PacketCMD_1=0xA1
|
| | | PacketSubCMD_1=0x23
|
| | |
| | | PacketSubCMD_3=0x26
|
| | | PacketCallFunc_3=OnSelectCTGItem
|
| | |
|
| | | PacketCMD_4=0xA8
|
| | | PacketSubCMD_4=0x06
|
| | | PacketCallFunc_4=OnQueryRecharge
|
| | |
|
| | | ;限时抢购
|
| | | [PlayerFlashSale]
|
| | | ScriptName = Player\PlayerFlashSale.py
|
| | |
| | | Def_PDict_LastEnterFBTick = "LastEnterFBTick_%s" # 上次进入副本的时间%s副本id
|
| | |
|
| | | # 投资理财
|
| | | Def_PDict_InvestTime = "InvestTime_%s" # 投资时的时间,参数为投资类型
|
| | | Def_PDict_InvestProgress = "InvestProgress_%s_%s" # 投资可领奖进度值,参数为(投资类型, key编号)
|
| | | Def_PDict_InvestReward = "InvestReward_%s_%s" # 投资领奖记录,参数为(投资类型, key编号)
|
| | | Def_PDict_InvestRewardTime = "InvestRewardTime_%s" # 投资最后一次领奖时间,参数为(投资类型)
|
| | | Def_PDict_InvestKeyCount = 3 # key编号数
|
| | | Def_PDict_InvestTime = "InvestTime_%s" # 投资时的时间,参数(投资类型)
|
| | | Def_PDict_InvestEndTime = "InvestEndTime_%s" # 投资到期时间,参数(投资类型)
|
| | | Def_PDict_InvestRewardTime = "InvestRewardTime_%s" # 投资最后一次领奖时间,参数(投资类型)
|
| | |
|
| | | # 成就 Def_PDictType_Success
|
| | | Def_PDict_SuccessValue = "Succ_%s_%s" # 当前次数值,参数(成就类型、条件)
|
| | |
| | | Def_Cost_UseSpeaker, # 喇叭发言
|
| | | Def_Cost_Revive, # 复活
|
| | | Def_Cost_5, # 副本鼓舞 5
|
| | | Def_Cost_GoldInvest, # 理财投资
|
| | | Def_Cost_6, # 理财投资
|
| | | Def_Cost_Pray, # 祈祷
|
| | | Def_Cost_8, # 资源找回
|
| | | Def_Cost_BuyVIPItem, # 购买VIP礼包
|
| | |
| | |
|
| | | # 有分消费对象子类的
|
| | | Def_Cost_BuyVIPItem:"BuyVIPItem",
|
| | | Def_Cost_GoldInvest:"GoldInvest",
|
| | | Def_Cost_Pray:"Pray",
|
| | | Def_Cost_Treasure:"Treasure",
|
| | | Def_Cost_OpenNoble:"OpenNoble",
|
| | |
| | | Def_GiveMoney_UseItem, # 使用物品
|
| | | Def_GiveMoney_Pickup, # ʰȡ
|
| | | Def_GiveMoney_Bourse, # 交易所 10
|
| | | Def_GiveMoney_GoldInvest, # 绑钻投资
|
| | | Def_GiveMoney_11, # 绑钻投资
|
| | | Def_GiveMoney_12, # 资源找回
|
| | | Def_GiveMoney_13, # 红包
|
| | | Def_GiveMoney_RefineGift, # 炼制奖励
|
| | |
| | | Def_GiveMoney_UseItem:"UseItem",
|
| | | Def_GiveMoney_Pickup:"Pickup",
|
| | | Def_GiveMoney_Bourse:"Bourse",
|
| | | Def_GiveMoney_GoldInvest:"GoldInvest",
|
| | | Def_GiveMoney_RefineGift:"RefineGift",
|
| | | Def_GiveMoney_Mail:"Mail",
|
| | | Def_GiveMoney_RuneDecompose:"RuneDecompose",
|
| | |
| | |
|
| | | # 投资理财类型,和前端对应,从7开始
|
| | | InvestTypeList = (
|
| | | InvestType_NewMonth, # 至尊月卡投资7
|
| | | InvestType_Month1, # 新30元月卡投资8
|
| | | InvestType_Login, # 登录 9
|
| | | InvestType_LV, # 等级 10
|
| | | InvestType_Boss, # Boss 11
|
| | | InvestType_Life, # 终身卡 12
|
| | | ) = range(7, 7 + 6)
|
| | | InvestType_Month, # 月卡 1
|
| | | InvestType_Life, # 终身卡 2
|
| | | ) = range(1, 1 + 2)
|
| | |
|
| | | (
|
| | | tttLeaveMap, # 退出倒计时 0
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 37 投资理财信息 #tagMCGoldInvestInfo
|
| | |
|
| | | class tagMCInvestReward(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("RewardIndex", c_ushort), # 索引
|
| | | ("RewardValue", c_ubyte), # 该等级已领取数据,0可认为未领取
|
| | | ]
|
| | |
|
| | | 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.RewardIndex = 0
|
| | | self.RewardValue = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCInvestReward)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// A3 37 投资理财信息 //tagMCGoldInvestInfo:
|
| | | RewardIndex:%d,
|
| | | RewardValue:%d
|
| | | '''\
|
| | | %(
|
| | | self.RewardIndex,
|
| | | self.RewardValue
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCGoldInvestInfo(Structure):
|
| | | Head = tagHead()
|
| | | InvestType = 0 #(BYTE InvestType)// 投资类型
|
| | | CurDay = 0 #(DWORD CurDay)// 当前天数
|
| | | InvestGold = 0 #(DWORD InvestGold)// 投资额度
|
| | | RewardRecordCnt = 0 #(BYTE RewardRecordCnt)// 投资回报个数
|
| | | InvestRewardList = list() #(vector<tagMCInvestReward> InvestRewardList)// 投资回报记录
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x37
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.InvestType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.CurDay,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.InvestGold,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RewardRecordCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RewardRecordCnt):
|
| | | temInvestRewardList = tagMCInvestReward()
|
| | | _pos = temInvestRewardList.ReadData(_lpData, _pos)
|
| | | self.InvestRewardList.append(temInvestRewardList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x37
|
| | | self.InvestType = 0
|
| | | self.CurDay = 0
|
| | | self.InvestGold = 0
|
| | | self.RewardRecordCnt = 0
|
| | | self.InvestRewardList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 4
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.RewardRecordCnt):
|
| | | length += self.InvestRewardList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.InvestType)
|
| | | data = CommFunc.WriteDWORD(data, self.CurDay)
|
| | | data = CommFunc.WriteDWORD(data, self.InvestGold)
|
| | | data = CommFunc.WriteBYTE(data, self.RewardRecordCnt)
|
| | | for i in range(self.RewardRecordCnt):
|
| | | data = CommFunc.WriteString(data, self.InvestRewardList[i].GetLength(), self.InvestRewardList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | InvestType:%d,
|
| | | CurDay:%d,
|
| | | InvestGold:%d,
|
| | | RewardRecordCnt:%d,
|
| | | InvestRewardList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.InvestType,
|
| | | self.CurDay,
|
| | | self.InvestGold,
|
| | | self.RewardRecordCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCGoldInvestInfo=tagMCGoldInvestInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCGoldInvestInfo.Head.Cmd,m_NAtagMCGoldInvestInfo.Head.SubCmd))] = m_NAtagMCGoldInvestInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 C7 古宝信息 #tagMCGubaoInfo
|
| | |
|
| | | class tagMCGubao(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A3 38 投资理财信息 #tagMCInvestInfo
|
| | | # A3 38 投资信息 #tagSCInvestInfo
|
| | |
|
| | | class tagMCInvestInfo(Structure):
|
| | | Head = tagHead()
|
| | | InvestType = 0 #(BYTE InvestType)// 投资类型
|
| | | CurDay = 0 #(WORD CurDay)// 当前天数,投资第一天为1
|
| | | ValueCount = 0 #(BYTE ValueCount)
|
| | | RewardValue = list() #(vector<DWORD> RewardValue)//领奖记录值,按投资回报索引位记录是否已领取
|
| | | ProgressValue = list() #(vector<DWORD> ProgressValue)//投资相关可领取进度记录值: 9登录投资-记录已登录天数;11Boss投资-按回报索引位记录是否已击杀该boss
|
| | | data = None
|
| | | class tagSCInvestInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("InvestType", c_ubyte), # 投资类型
|
| | | ("InvestBuyTime", c_int), # 投资购买时间戳,永久的通过该时间判断是否有效或已过天数,任意类型均有该值,过期没有重置,前端自己判断
|
| | | ("InvestEndTime", c_int), # 投资到期时间戳,非永久的通过该时间判断到期时间,有天数限制的才有值
|
| | | ("AwardState", c_ubyte), # 今日是否已领取奖励
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x38
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x38
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.InvestType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.CurDay,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.ValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.ValueCount):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.RewardValue.append(value)
|
| | | for i in range(self.ValueCount):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.ProgressValue.append(value)
|
| | | return _pos
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA3
|
| | | self.Head.SubCmd = 0x38
|
| | | self.Cmd = 0xA3
|
| | | self.SubCmd = 0x38
|
| | | self.InvestType = 0
|
| | | self.CurDay = 0
|
| | | self.ValueCount = 0
|
| | | self.RewardValue = list()
|
| | | self.ProgressValue = list()
|
| | | self.InvestBuyTime = 0
|
| | | self.InvestEndTime = 0
|
| | | self.AwardState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | length += 4 * self.ValueCount
|
| | | length += 4 * self.ValueCount
|
| | |
|
| | | return length
|
| | | return sizeof(tagSCInvestInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.InvestType)
|
| | | data = CommFunc.WriteWORD(data, self.CurDay)
|
| | | data = CommFunc.WriteBYTE(data, self.ValueCount)
|
| | | for i in range(self.ValueCount):
|
| | | data = CommFunc.WriteDWORD(data, self.RewardValue[i])
|
| | | for i in range(self.ValueCount):
|
| | | data = CommFunc.WriteDWORD(data, self.ProgressValue[i])
|
| | | return data
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | DumpString = '''// A3 38 投资信息 //tagSCInvestInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | InvestType:%d,
|
| | | CurDay:%d,
|
| | | ValueCount:%d,
|
| | | RewardValue:%s,
|
| | | ProgressValue:%s
|
| | | InvestBuyTime:%d,
|
| | | InvestEndTime:%d,
|
| | | AwardState:%d
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.InvestType,
|
| | | self.CurDay,
|
| | | self.ValueCount,
|
| | | "...",
|
| | | "..."
|
| | | self.InvestBuyTime,
|
| | | self.InvestEndTime,
|
| | | self.AwardState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCInvestInfo=tagMCInvestInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCInvestInfo.Head.Cmd,m_NAtagMCInvestInfo.Head.SubCmd))] = m_NAtagMCInvestInfo
|
| | | m_NAtagSCInvestInfo=tagSCInvestInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCInvestInfo.Cmd,m_NAtagSCInvestInfo.SubCmd))] = m_NAtagSCInvestInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ObjID", c_int),
|
| | | ("HP", c_int), # 当前血量,求余20亿部分
|
| | | ("HPEx", c_int), # 当前血量,整除20亿部分
|
| | | ("MaxHP", c_int), # 最大血量,求余20亿部分
|
| | | ("MaxHPEx", c_int), # 最大血量,整除20亿部分
|
| | | ("HP", c_int), # 当前血量,求余亿部分
|
| | | ("HPEx", c_int), # 当前血量,整除亿部分
|
| | | ("MaxHP", c_int), # 最大血量,求余亿部分
|
| | | ("MaxHPEx", c_int), # 最大血量,整除亿部分
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | ("NPCID", c_int), # 战斗NPCID,不同的实例ID对应的NPCID可能一样
|
| | | ("HeroID", c_int), # 武将ID,玩家或NPC均可能有,如果有值则外观相关以该武将为准,否则以NPCID为准
|
| | | ("SkinID", c_int), # 武将皮肤ID,玩家或NPC均可能有,如果有值则皮肤以该值为准,否则取NPCID对应的皮肤ID
|
| | | ("HP", c_int), # 当前血量,求余20亿部分
|
| | | ("HPEx", c_int), # 当前血量,整除20亿部分
|
| | | ("MaxHP", c_int), # 最大血量,求余20亿部分
|
| | | ("MaxHPEx", c_int), # 最大血量,整除20亿部分
|
| | | ("HP", c_int), # 当前血量,求余亿部分
|
| | | ("HPEx", c_int), # 当前血量,整除亿部分
|
| | | ("MaxHP", c_int), # 最大血量,求余亿部分
|
| | | ("MaxHPEx", c_int), # 最大血量,整除亿部分
|
| | | ("LV", c_ushort), # 等级,玩家的武将等级或NPC成长等级,等级显示以该值为准
|
| | | ("PosNum", c_ubyte), # 在本阵容中的站位,从1开始,非主战斗武将为0,如红颜
|
| | | ("AngreXP", c_ushort), # 当前怒气值
|
| | |
| | | SendEventPack("CollectNPCOK", dataDict, curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | ## 领取投资回报
|
| | | # @param curPlayer: 玩家实例
|
| | | # @return: None
|
| | | def DR_GetGoldInvestReward(curPlayer, investType, rewardIndex, itemList):
|
| | | dataDict = {'PlayerID':curPlayer.GetPlayerID(), 'PlayerName':curPlayer.GetPlayerName(), |
| | | 'AccID':curPlayer.GetAccID(), 'PlayerLV':curPlayer.GetLV(), 'InvestType':investType, |
| | | 'RewardIndex':rewardIndex,
|
| | | 'itemList':itemList}
|
| | | #发送封包
|
| | | SendEventPack("GetGoldInvestReward", dataDict, curPlayer)
|
| | | return
|
| | |
|
| | | ## 击杀NPC流向
|
| | | # @param curPlayer: 玩家实例
|
| | | # @param eventName:
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package GM.Commands.GoldInvest
|
| | | #
|
| | | # @todo:投资
|
| | | # @author hxp
|
| | | # @date 2025-11-10
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 投资
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-11-10 20:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import PlayerGoldInvest
|
| | | import PlayerControl
|
| | | import GameWorld
|
| | |
|
| | | def OnExec(curPlayer, msgList):
|
| | | |
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "重置所有投资: GoldInvest 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置指定投资: GoldInvest 类型")
|
| | | GameWorld.DebugAnswer(curPlayer, "激活指定投资: GoldInvest a 类型")
|
| | | GameWorld.DebugAnswer(curPlayer, "类型:1-月卡;2-终身卡;")
|
| | | return
|
| | | |
| | | value = msgList[0]
|
| | | if value == "a":
|
| | | investType = msgList[1] if len(msgList) > 1 else 0
|
| | | if investType not in ChConfig.InvestTypeList:
|
| | | GameWorld.DebugAnswer(curPlayer, "不存在该投资类型!")
|
| | | return
|
| | | PlayerGoldInvest.DoLogicInvest(curPlayer, investType)
|
| | | GameWorld.DebugAnswer(curPlayer, "激活投资: %s" % investType)
|
| | | return
|
| | | |
| | | if value == 0:
|
| | | investTypeList = ChConfig.InvestTypeList
|
| | | elif value in ChConfig.InvestTypeList:
|
| | | investTypeList = [value]
|
| | | else:
|
| | | GameWorld.DebugAnswer(curPlayer, "不存在该投资类型!")
|
| | | return
|
| | | |
| | | for itype in investTypeList:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestTime % itype, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestEndTime % itype, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestRewardTime % itype, 0)
|
| | | PlayerGoldInvest.Sync_InvestInfo(curPlayer, itype)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置投资类型: %s" % investTypeList)
|
| | | return
|
| | |
| | | dateTimeB = datetime.datetime(dateTimeB.year, dateTimeB.month, dateTimeB.day, 0, 0, 0)
|
| | | return (dateTimeA - dateTimeB).days
|
| | |
|
| | | def GetEndTimeByZeroTime(startTime, addDays):
|
| | | ## 获取结束时间,根据0点结束计算
|
| | | # @param startTime: 起始时间戳
|
| | | # @param addDays: 增加的天数,如果是1天实际为当天,即1代表当天
|
| | | startDate = ChangeTimeNumToDatetime(startTime)
|
| | | startZeroDate = datetime.datetime(startDate.year, startDate.month, startDate.day, 23, 59, 59)
|
| | | startZeroTime = int(time.mktime(startZeroDate.timetuple()))
|
| | | endTime = startTime + (startZeroTime - startTime) + max(addDays - 1, 0) * 24 * 3600
|
| | | return endTime
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ##获取与当前时间相差天数的datetime格式数据
|
| | | # @param diffDays 差距天数
|
| | |
| | | if not costType or not payMoneyList:
|
| | | GameWorld.DebugLog("没有配置购买副本次数消耗货币数! mapID=%s,costType=%s,payMoneyList=%s" % (mapID, costType, payMoneyList))
|
| | | return
|
| | | costMoney = payMoneyList[hasBuyCnt] if len(payMoneyList) > hasBuyCnt else payMoneyList[-1]
|
| | | if not PlayerControl.PayMoney(curPlayer, costType, costMoney, ChConfig.Def_Cost_BuyFBCnt, {"MapID":mapID}):
|
| | | return
|
| | | if not PlayerGoldInvest.IsFBCntBuyFree(curPlayer, mapID):
|
| | | costMoney = payMoneyList[hasBuyCnt] if len(payMoneyList) > hasBuyCnt else payMoneyList[-1]
|
| | | if not PlayerControl.PayMoney(curPlayer, costType, costMoney, ChConfig.Def_Cost_BuyFBCnt, {"MapID":mapID}):
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FBBuyCnt % mapID, hasBuyCnt + 1)
|
| | | Sync_FBPlayerFBInfoData(curPlayer, mapID)
|
| | | return
|
| | |
| | | ("list", "VIPAward", 0),
|
| | | ),
|
| | |
|
| | | "Invest":(
|
| | | ("WORD", "ID", 1),
|
| | | ("BYTE", "Type", 0),
|
| | | ("BYTE", "NeedDay", 0),
|
| | | ("WORD", "NeedLV", 0),
|
| | | ("DWORD", "NeedNPCID", 0),
|
| | | ("dict", "Reward", 0),
|
| | | ),
|
| | |
|
| | | "XBXZ":(
|
| | | ("DWORD", "ID", 1),
|
| | | ("BYTE", "Type", 0),
|
| | |
| | | def GetVIPLimit(self): return self.attrTuple[4] # 需要VIP几 BYTE
|
| | | def GetVIPAward(self): return self.attrTuple[5] # vip奖励[[物品ID,个数],...] list |
| | | |
| | | # 投资表 |
| | | class IPY_Invest(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetID(self): return self.attrTuple[0] # ID WORD
|
| | | def GetType(self): return self.attrTuple[1] # 投资类型 BYTE
|
| | | def GetNeedDay(self): return self.attrTuple[2] # 需要天数 BYTE
|
| | | def GetNeedLV(self): return self.attrTuple[3] # 需要等级 WORD
|
| | | def GetNeedNPCID(self): return self.attrTuple[4] # 需要NPCID DWORD
|
| | | def GetReward(self): return self.attrTuple[5] # 奖励 {"key":[[物品ID,个数,是否绑定],...], ...} dict |
| | | |
| | | # 仙宝寻主表 |
| | | class IPY_XBXZ(): |
| | | |
| | |
| | | self.__LoadFileData("CTGSelectItem", onlyCheck)
|
| | | self.__LoadFileData("FirstCharge", onlyCheck)
|
| | | self.__LoadFileData("LVAward", onlyCheck)
|
| | | self.__LoadFileData("Invest", onlyCheck)
|
| | | self.__LoadFileData("XBXZ", onlyCheck)
|
| | | self.__LoadFileData("TreasureSet", onlyCheck)
|
| | | self.__LoadFileData("TreasureHouse", onlyCheck)
|
| | |
| | | def GetLVAwardByIndex(self, index): |
| | | self.CheckLoadData("LVAward") |
| | | return self.ipyLVAwardCache[index]
|
| | | |
| | | def GetInvestCount(self): |
| | | self.CheckLoadData("Invest") |
| | | return self.ipyInvestLen
|
| | | def GetInvestByIndex(self, index): |
| | | self.CheckLoadData("Invest") |
| | | return self.ipyInvestCache[index]
|
| | | |
| | | def GetXBXZCount(self): |
| | | self.CheckLoadData("XBXZ") |
| | |
| | | import CrossPlayerData
|
| | | import PlayerFeastWish
|
| | | import PlayerFeastTravel
|
| | | import PlayerGoldInvest
|
| | | import PlayerWeekParty
|
| | | import NPCRealmRefresh
|
| | | import PlayerActLogin
|
| | |
| | | if not buyTimesVIPPriID:
|
| | | return
|
| | | canBuyCnt = 0
|
| | | canBuyCnt += PlayerGoldInvest.GetAddBossBuyCnt(curPlayer, killBossMark)
|
| | | hasBuyCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Boss_KillCntBuyCnt%killBossMark, 0)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if hasBuyCnt >= canBuyCnt:
|
| | |
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import ChPyNetSendPack
|
| | | import PlayerGoldInvest
|
| | | import PlayerViewCache
|
| | | import NetPackCommon
|
| | | import PyGameData
|
| | |
| | | return
|
| | |
|
| | | def DoArenaOpen(curPlayer):
|
| | | storeMax = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
|
| | | PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_ArenaTicket, storeMax, "ArenaOpen") |
| | | __DoArenaSeasonReset(curPlayer)
|
| | | return
|
| | |
|
| | |
| | |
|
| | | def GetArenaTicketStoreMax(curPlayer):
|
| | | ## 获取挑战券存储上限
|
| | | baseCnt = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
|
| | | storeMax = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
|
| | |
|
| | | # 其他特权提升上限
|
| | | storeMax += PlayerGoldInvest.GetArenaTicketMax(curPlayer)
|
| | |
|
| | | storeMax = baseCnt
|
| | | return storeMax
|
| | |
|
| | | #// B2 09 演武场匹配玩家 #tagCSArenaMatch
|
| | |
| | | Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
|
| | | return
|
| | |
|
| | | #// A8 06 查询充值结果 #tagCMQueryRecharge
|
| | | #
|
| | | #struct tagCMQueryRecharge
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnQueryRecharge(index, packData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | if tick - curPlayer.GetDictByKey("QRtick") < 10000:
|
| | | return
|
| | | curPlayer.SetDict("QRtick", tick)
|
| | | curPlayer.SendDBQueryRecharge()
|
| | | return
|
| | |
|
| | | #// A1 23 查询充值次数 #tagCMQueryCoinToGoldCount
|
| | | #
|
| | |
| | | giveItemList += GetCTGGiveItemList(ipyData)
|
| | | giveItemList += selectItemList
|
| | |
|
| | | payType = ipyData.GetPayType()
|
| | | #payType = ipyData.GetPayType()
|
| | | moneyType = ipyData.GetMoneyType() # 获得货币类型
|
| | | addGold = ipyData.GetGainGold() # 获得货币数
|
| | | gainGoldPrize = ipyData.GetGainGoldPrize() # 赠送货币数,首次充值赠送仙玉时,此仙玉不给
|
| | | firstGoldPrize = ipyData.GetFirstGoldPrize() # 首次充值赠送的仙玉
|
| | | prizeGold = firstGoldPrize if (not totalBuyCount and firstGoldPrize) else gainGoldPrize
|
| | | if moneyType == IPY_GameWorld.TYPE_Price_Gold_Money:
|
| | | if payType in [PayType_Gold, PayType_GoldPlus] and PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | prizeGold = addGold # bt tqxbqy 版本,永久卡仙玉直充固定双倍
|
| | | #if payType in [PayType_Gold, PayType_GoldPlus] and PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | # prizeGold = addGold # bt tqxbqy 版本,永久卡仙玉直充固定双倍
|
| | | actPrizeGold = PlayerActRechargePrize.DoAddPlayerActRechargePrizeCount(curPlayer, recordID)
|
| | | if actPrizeGold:
|
| | | prizeGold += actPrizeGold
|
| | |
| | | if ctgIpyData:
|
| | | ctgID = ctgIpyData.GetRecordID()
|
| | | #PlayerActFamilyCTGAssist.OnPlayerCTG(curPlayer, ctgID)
|
| | | #PlayerGoldInvest.InvestByCTG(curPlayer, ctgID)
|
| | | PlayerGoldInvest.InvestByCTG(curPlayer, ctgID)
|
| | | PlayerGoldGift.OnGiftByCTGID(curPlayer, ctgID)
|
| | | PlayerZhanling.OnActiviteByCTGID(curPlayer, ctgID)
|
| | | PlayerGoldRush.OnGoldRushByCTGID(curPlayer, ctgID)
|
| | |
| | | import PlayerCostRebate
|
| | | import PlayerActLunhuidian
|
| | | import GY_Query_CrossRealmReg
|
| | | import PlayerGoldInvest
|
| | | import CrossRealmPlayer
|
| | | import CrossPlayerData
|
| | | import PlayerActivity
|
| | |
| | | def Sync_ExpRateChange(curPlayer):
|
| | | totalExpRate = GetPlayerExpRate(curPlayer)
|
| | | fightExpRate = curPlayer.GetFightExpRate() # 系统及功能累加
|
| | | fightExpRate += PlayerGoldInvest.GetAddFightExpRate(curPlayer)
|
| | |
|
| | | actExpRateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_ExpRate, {})# 多倍经验活动加成
|
| | | if actExpRateInfo.get(ShareDefine.ActKey_State):
|
| | |
| | | #
|
| | | # @todo:投资
|
| | | # @author hxp
|
| | | # @date 2020-09-10
|
| | | # @date 2025-11-10
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 投资
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2020-09-10 11:00"""
|
| | | #"""Version = 2025-11-10 20:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import IpyGameDataPY
|
| | | import NetPackCommon
|
| | | import DataRecordPack
|
| | | import ChPyNetSendPack
|
| | | import ItemControler
|
| | | import PlayerControl
|
| | | import IPY_GameWorld
|
| | | import PlayerMail
|
| | | import ChConfig
|
| | |
|
| | | import time
|
| | |
|
| | | ## 登录
|
| | | def OnLogin(curPlayer):
|
| | | for investType in ChConfig.InvestTypeList:
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestTime % investType):
|
| | | # 有投资过就同步
|
| | | continue
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | return
|
| | |
|
| | | ## 过天
|
| | | def OnDay(curPlayer):
|
| | | dayAwardDict = IpyGameDataPY.GetFuncEvalCfg("InvestDay", 3, {})
|
| | | for investType in ChConfig.InvestTypeList:
|
| | | if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestTime % investType):
|
| | | continue
|
| | |
|
| | | # 登录卡
|
| | | if investType == ChConfig.InvestType_Login:
|
| | | progressValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestProgress % (investType, 0))
|
| | | maxDays = __GetInvestMaxDays(investType)
|
| | | if maxDays and progressValue < maxDays:
|
| | | progressValue += 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestProgress % (investType, 0), progressValue)
|
| | | GameWorld.DebugLog("更新登录投资可领奖天数进度: %s" % progressValue)
|
| | | |
| | | # 终身卡
|
| | | elif investType == ChConfig.InvestType_Life:
|
| | | __GiveUnGetPerDayReward(curPlayer, investType)
|
| | | for keyNum in range(ChConfig.Def_PDict_InvestKeyCount):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestReward % (investType, keyNum), 0)
|
| | | |
| | | # 每日相同奖励的
|
| | | if str(investType) in dayAwardDict: |
| | | __GiveUnGetPerDayReward(curPlayer, investType, dayAwardDict[str(investType)])
|
| | | |
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | |
| | | return
|
| | |
|
| | | def __GiveUnGetPerDayReward(curPlayer, investType):
|
| | | def __GiveUnGetPerDayReward(curPlayer, investType, dayAwardItemList):
|
| | | ## 补发未领取的每日奖励,一般用于 每日可领取的固定奖励,如永久卡等
|
| | | |
| | | if not dayAwardItemList:
|
| | | return
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | curTime = int(time.time())
|
| | | lastRewardTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestRewardTime % investType)
|
| | | if not lastRewardTime:
|
| | | passDays = __GetInvestPassDays(curPlayer, investType)
|
| | | #GameWorld.DebugLog("补发奖励时,距离开通投资已过天数: %s" % passDays, playerID)
|
| | | else:
|
| | | passDays = GameWorld.GetDiff_Day(curTime, lastRewardTime)
|
| | | #GameWorld.DebugLog("补发奖励时,距离上次领奖已过天数: %s" % passDays, playerID)
|
| | | investTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestTime % investType)
|
| | | if not investTime:
|
| | | return
|
| | | lastRewardTime = investTime - 3600 * 24 # 让激活当天也可以领
|
| | | #GameWorld.DebugLog("从未领奖过")
|
| | |
|
| | | rewardDays = passDays - 1 # # 需要补发的奖励天数,只补到昨天,不算当天
|
| | | curTime = int(time.time())
|
| | | passDays = GameWorld.GetDiff_Day(curTime, lastRewardTime)
|
| | | #GameWorld.DebugLog("补发奖励时,距离上次领奖已过天数: %s" % passDays, playerID)
|
| | | if not GetInvestState(curPlayer, investType):
|
| | | rewardDays = passDays
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestEndTime % investType)
|
| | | if not endTime:
|
| | | return
|
| | | rewardDayMax = GameWorld.GetDiff_Day(endTime, lastRewardTime)
|
| | | if rewardDayMax <= 0:
|
| | | return
|
| | | GameWorld.DebugLog("已过期: 最大还可奖励天数: %s" % rewardDayMax, playerID)
|
| | | if rewardDays > rewardDayMax:
|
| | | rewardDays = rewardDayMax
|
| | | GameWorld.DebugLog("修正最大还可补发的奖励天数: %s" % rewardDays, playerID)
|
| | | else:
|
| | | rewardDays = passDays - 1 # # 需要补发的奖励天数,只补到昨天,不算当天
|
| | | GameWorld.DebugLog("未过期: rewardDays=%s" % rewardDays, playerID)
|
| | | |
| | | if rewardDays <= 0:
|
| | | GameWorld.DebugLog("不用补发投资卡每日奖励: investType=%s,rewardDays=%s" % (investType, rewardDays), playerID)
|
| | | return
|
| | | updRewardTime = curTime - 3600 * 24 # 最后一次领奖强制设置到昨天
|
| | |
|
| | | rewardIndex = 0 # 每日奖励默认0索引
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Invest", investType * 100 + rewardIndex)
|
| | | if not ipyData:
|
| | | return
|
| | | rewardInfo = ipyData.GetReward()
|
| | | |
| | | rewardKey = "1" # 默认1
|
| | | rewardItemList = rewardInfo.get(str(rewardKey), [])
|
| | | if not rewardItemList:
|
| | | return
|
| | | |
| | | mailItemList = []
|
| | | for itemID, itemCount, isAuctionItem in rewardItemList:
|
| | | mailItemList.append([itemID, itemCount * rewardDays, isAuctionItem])
|
| | | |
| | | for itemInfo in dayAwardItemList:
|
| | | itemID = itemInfo[0]
|
| | | itemCount = itemInfo[1]
|
| | | mailItemList.append([itemID, itemCount * rewardDays])
|
| | | |
| | | GameWorld.DebugLog("邮件补发投资卡每日奖励! investType=%s, rewardDays=%s, updRewardTime=%s, mailItemList=%s"
|
| | | % (investType, rewardDays, updRewardTime, mailItemList), playerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestRewardTime % investType, updRewardTime)
|
| | | PlayerControl.SendMailByKey("InvestDayReward_%s" % investType, [playerID], mailItemList, [rewardDays])
|
| | | PlayerMail.SendMailByKey("InvestDayReward_%s" % investType, playerID, mailItemList, [rewardDays])
|
| | | return
|
| | |
|
| | | def __GetInvestPassDays(curPlayer, investType):
|
| | |
| | | curTime = int(time.time())
|
| | | return max(0, GameWorld.GetDiff_Day(curTime, investTime) + 1)
|
| | |
|
| | | def __GetInvestMaxDays(investType):
|
| | | ## 获取投资最大天数,0为永久
|
| | | investMaxDayDict = IpyGameDataPY.GetFuncEvalCfg("InvestMaxDay", 1, {})
|
| | | return investMaxDayDict.get(str(investType), 0)
|
| | |
|
| | | def GetInvestState(curPlayer, investType):
|
| | | ## 获取投资卡状态 0-未投资;1-已投资;
|
| | | ## 获取投资卡状态 0-未投资;1-投资生效中;
|
| | | investTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestTime % investType)
|
| | | if not investTime:
|
| | | return 0
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestEndTime % investType)
|
| | | if endTime: # 有到期时间的检查到期
|
| | | expiredDays = GameWorld.GetDiff_Day(int(time.time()), endTime)
|
| | | if expiredDays > 0: # 已过期
|
| | | return 0
|
| | | return 1
|
| | |
|
| | | #// A5 40 投资理财 #tagCMGoldInvest
|
| | |
| | | # DWORD InvestGold; // 投资额度
|
| | | #};
|
| | | def OnGoldInvest(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | investType = clientData.InvestType
|
| | | InvestByRealCTG(curPlayer, investType)
|
| | | #curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | #investType = clientData.InvestType
|
| | | return
|
| | |
|
| | | def InvestByRealCTG(curPlayer, investType):
|
| | | ## 真实充值激活投资
|
| | | needRealCTGCoinDict = IpyGameDataPY.GetFuncEvalCfg("InvestCost", 4, {})
|
| | | if str(investType) not in needRealCTGCoinDict:
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | realNeed = needRealCTGCoinDict[str(investType)]
|
| | | realTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGRealTotal)
|
| | | if realTotal < realNeed:
|
| | | GameWorld.DebugLog("真实充值额度不足,无法激活! investType=%s,realTotal=%s < %s" |
| | | % (investType, realTotal, realNeed), playerID)
|
| | | return
|
| | | __DoLogicInvest(curPlayer, investType)
|
| | | return True
|
| | |
|
| | | ## 充值直购投资
|
| | | def InvestByCTG(curPlayer, ctgID):
|
| | | ctgInvestDict = IpyGameDataPY.GetFuncEvalCfg("InvestCost", 3, {})
|
| | | ## 充值直购投资
|
| | | ctgInvestDict = IpyGameDataPY.GetFuncEvalCfg("InvestCost", 1, {})
|
| | | for investType, ctgIDList in ctgInvestDict.items():
|
| | | if ctgID in ctgIDList:
|
| | | __DoLogicInvest(curPlayer, int(investType))
|
| | | DoLogicInvest(curPlayer, int(investType))
|
| | | break
|
| | | return
|
| | |
|
| | | ## 执行投资逻辑
|
| | | def __DoLogicInvest(curPlayer, investType):
|
| | | if GetInvestState(curPlayer, investType) == 1:
|
| | | GameWorld.DebugLog("已投资,无法重复投资! investType=%s" % investType)
|
| | | return
|
| | | def DoLogicInvest(curPlayer, investType):
|
| | | ## 执行投资逻辑
|
| | | buyDaysDict = IpyGameDataPY.GetFuncEvalCfg("InvestDay", 1, {}) # 购买天数 |
| | | buyDays = buyDaysDict.get(str(investType), 0)
|
| | | curState = GetInvestState(curPlayer, investType)
|
| | | GameWorld.DebugLog("购买投资: investType=%s,buyDays=%s,curState=%s" % (investType, buyDays, curState))
|
| | |
|
| | | # 可投资,更新重置投资相关数据
|
| | | curTime = int(time.time())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestTime % investType, curTime)
|
| | | for keyNum in range(ChConfig.Def_PDict_InvestKeyCount):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestReward % (investType, keyNum), 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestProgress % (investType, keyNum), 0)
|
| | | |
| | | # 登录卡,投资当天可领奖,完成设置为1
|
| | | if investType == ChConfig.InvestType_Login:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestProgress % (investType, 0), 1)
|
| | | # 已过期的重置投资相关数据
|
| | | if not curState:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestTime % investType, curTime)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestEndTime % investType, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestRewardTime % investType, 0)
|
| | |
|
| | | # 额外奖励物品
|
| | | awardItemDict = IpyGameDataPY.GetFuncEvalCfg("InvestCost", 5, {})
|
| | | if str(investType) in awardItemDict:
|
| | | awardItemListEx = awardItemDict[str(investType)]
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, awardItemListEx, event=["Invest", True, {"investType":investType}])
|
| | | # 支持重复购买,累加到期时间
|
| | | # 永久
|
| | | if buyDays <= 0:
|
| | | updEndTime = 0
|
| | |
|
| | | # 广播
|
| | | PlayerControl.WorldNotify(0, "BuyInvest_%s" % investType, [curPlayer.GetName(), __GetTotalGetGold(investType)])
|
| | | |
| | | # 有天数限制
|
| | | elif buyDays > 0:
|
| | | endTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestEndTime % investType)
|
| | | if endTime > curTime:
|
| | | updEndTime = endTime + buyDays * 24 * 3600
|
| | | GameWorld.Log(" 累加时长: investType=%s,endTime=%s,updEndTime=%s" |
| | | % (investType, GameWorld.ChangeTimeNumToStr(endTime), GameWorld.ChangeTimeNumToStr(updEndTime)))
|
| | | else:
|
| | | updEndTime = GameWorld.GetEndTimeByZeroTime(curTime, buyDays)
|
| | | GameWorld.Log(" 重新激活: investType=%s,updEndTime=%s" % (investType, GameWorld.ChangeTimeNumToStr(updEndTime)))
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestEndTime % investType, updEndTime)
|
| | | GameWorld.DebugLog("投资理财成功: investType=%s" % (investType))
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | PlayerControl.Sync_ExpRateChange(curPlayer)
|
| | | return
|
| | |
|
| | | def __GetTotalGetGold(investType):
|
| | | ## 获取投资预计总收益仙玉、灵石
|
| | | totalGold = 0
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetInvestCount()):
|
| | | ipyData = ipyDataMgr.GetInvestByIndex(index)
|
| | | if ipyData.GetType() != investType:
|
| | | continue
|
| | | rewardDict = ipyData.GetReward()
|
| | | for rewardInfo in rewardDict.values():
|
| | | for itemID, itemCount, _ in rewardInfo:
|
| | | if itemID in [20, 30]: # 单位1的仙玉、灵石
|
| | | totalGold += itemCount
|
| | | return totalGold
|
| | |
|
| | | def GetAddBossCnt(curPlayer, bossFuncIndex):
|
| | | ## 获取增加的boss次数上限
|
| | | addBossCnt = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | lifeCardAddBossCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 1, {})
|
| | | lifeCardAddCnt = lifeCardAddBossCntDict.get(str(bossFuncIndex), 0)
|
| | | addBossCnt += lifeCardAddCnt
|
| | | return addBossCnt
|
| | |
|
| | | def GetAddFBCnt(curPlayer, mapID):
|
| | | ## 获取增加的副本次数上限
|
| | | ## 获取增加的副本免费次数上限
|
| | | addFBCnt = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | lifeCardAddFBCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 2, {})
|
| | | lifeCardAddCnt = lifeCardAddFBCntDict.get(str(mapID), 0)
|
| | | addFBCnt += lifeCardAddCnt
|
| | | return addFBCnt
|
| | |
|
| | | def GetAddBossBuyCnt(curPlayer, bossFuncIndex):
|
| | | ## 获取增加的boss购买次数上限
|
| | | addBossBuyCnt = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | lifeCardAddBossCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 4, {})
|
| | | lifeCardAddCnt = lifeCardAddBossCntDict.get(str(bossFuncIndex), 0)
|
| | | addBossBuyCnt += lifeCardAddCnt
|
| | | return addBossBuyCnt
|
| | |
|
| | | def GetAddFBBuyCnt(curPlayer, mapID):
|
| | | ## 获取增加的副本购买次数上限
|
| | | addFBBuyCnt = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | lifeCardAddFBCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 5, {})
|
| | | lifeCardAddCnt = lifeCardAddFBCntDict.get(str(mapID), 0)
|
| | | addFBBuyCnt += lifeCardAddCnt
|
| | | addFBBuyCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 1, {})
|
| | | for investType, fbMapIDAddDict in addFBBuyCntDict.items():
|
| | | addCnt = fbMapIDAddDict.get(str(mapID), 0)
|
| | | if not addCnt:
|
| | | continue
|
| | | if not GetInvestState(curPlayer, int(investType)):
|
| | | continue
|
| | | addFBBuyCnt += addCnt
|
| | | return addFBBuyCnt
|
| | |
|
| | | def GetAddFightExpRate(curPlayer):
|
| | | ## 杀怪经验加成
|
| | | fightExpRate = 0
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Life):
|
| | | fightExpRate += IpyGameDataPY.GetFuncCfg("InvestPower2", 1)
|
| | | return fightExpRate
|
| | |
|
| | | def CanQuickFinishMissionFree(curPlayer):
|
| | | ## 可否免费快速完成任务
|
| | | for investType in IpyGameDataPY.GetFuncEvalCfg("InvestPower", 3):
|
| | | if GetInvestState(curPlayer, investType):
|
| | | return True
|
| | | def IsFBCntBuyFree(curPlayer, mapID):
|
| | | ## 副本付费次数购买免费
|
| | | freeSweepDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 2, {})
|
| | | for investType, fbMapIDList in freeSweepDict.items():
|
| | | if mapID not in fbMapIDList:
|
| | | continue
|
| | | if not GetInvestState(curPlayer, int(investType)):
|
| | | continue
|
| | | return True
|
| | | return False
|
| | |
|
| | | def OnKillBoss(curPlayer, npcID):
|
| | | ## 参与击杀boss
|
| | | if GetInvestState(curPlayer, ChConfig.InvestType_Boss) != 1:
|
| | | #GameWorld.DebugLog("boss投资未投资!")
|
| | | return
|
| | | key = "BossInvestNPCIDDict"
|
| | | BossInvestNPCIDDict = IpyGameDataPY.GetConfigEx(key)
|
| | | if not BossInvestNPCIDDict:
|
| | | BossInvestNPCIDDict = {}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetInvestCount()):
|
| | | ipyData = ipyDataMgr.GetInvestByIndex(index)
|
| | | if ipyData.GetType() != ChConfig.InvestType_Boss:
|
| | | continue
|
| | | if not ipyData.GetNeedNPCID():
|
| | | continue
|
| | | BossInvestNPCIDDict[ipyData.GetNeedNPCID()] = ipyData.GetID()
|
| | | IpyGameDataPY.SetConfigEx(key, BossInvestNPCIDDict)
|
| | | GameWorld.Log("缓存boss投资对应关系: %s" % BossInvestNPCIDDict)
|
| | | |
| | | if npcID not in BossInvestNPCIDDict:
|
| | | #GameWorld.DebugLog(" 该boss没有投资奖励!")
|
| | | return
|
| | | investID = BossInvestNPCIDDict[npcID]
|
| | | investType, rewardIndex = investID / 100, investID % 100
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestProgress, rewardIndex, True, [investType]):
|
| | | #GameWorld.DebugLog("已设置击杀过该投资boss: npcID=%s,rewardIndex=%s,progressValue=%s" % (npcID, rewardIndex, progressValue))
|
| | | return
|
| | | progressValue, updProgressValue = GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestProgress, rewardIndex, 1, True, [investType])
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | GameWorld.DebugLog("设置杀过投资boss: npcID=%s,rewardIndex=%s,progressValue=%s,updProgressValue=%s" |
| | | % (npcID, rewardIndex, progressValue, updProgressValue))
|
| | | return
|
| | | def GetArenaTicketMax(curPlayer):
|
| | | ## 演武场门票上限
|
| | | addMax = 0
|
| | | arenaCntDict = IpyGameDataPY.GetFuncEvalCfg("InvestPower", 3, {})
|
| | | for investType, addCnt in arenaCntDict.items():
|
| | | if not GetInvestState(curPlayer, int(investType)):
|
| | | continue
|
| | | addMax += addCnt
|
| | | return addMax
|
| | |
|
| | | #// A5 41 领取投资理财回报 #tagCMGetInvestReward
|
| | | #
|
| | |
| | | GameWorld.DebugLog(" 未投资或已过期,无法领奖!")
|
| | | return
|
| | |
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Invest", investType * 100 + rewardIndex)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | needLV = ipyData.GetNeedLV()
|
| | | if needLV and curPlayer.GetLV() < needLV:
|
| | | GameWorld.DebugLog(" 等级不足,无法领奖! needLV=%s" % needLV)
|
| | | return
|
| | | |
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestReward, rewardIndex, True, [investType]):
|
| | | GameWorld.DebugLog(" 已领取过该索引奖励! rewardIndex=%s" % rewardIndex)
|
| | | return
|
| | | |
| | | needDay = ipyData.GetNeedDay()
|
| | | rewardInfo = ipyData.GetReward()
|
| | | |
| | | indexProgressState = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestProgress, rewardIndex, True, [investType])
|
| | | |
| | | # 月卡
|
| | | if investType in [ChConfig.InvestType_NewMonth, ChConfig.InvestType_Month1]:
|
| | | passDays = __GetInvestPassDays(curPlayer, investType) # 按投资时间计算天
|
| | | if needDay > passDays:
|
| | | GameWorld.DebugLog(" 投资天数不足,无法领取! needDay=%s > passDays=%s" % (ipyData.GetNeedDay(), passDays))
|
| | | return
|
| | | |
| | | # 登录
|
| | | elif investType == ChConfig.InvestType_Login:
|
| | | loginDays = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestProgress % (investType, 0)) # 按登录天计算天,有登录才算
|
| | | if needDay > loginDays:
|
| | | GameWorld.DebugLog(" 登录投资天数不足,无法领取! needDay=%s > loginDays=%s" % (needDay, loginDays))
|
| | | return
|
| | | |
| | | # 等级
|
| | | elif investType == ChConfig.InvestType_LV:
|
| | | # 公共等级条件已判断
|
| | | pass
|
| | | |
| | | # Boss
|
| | | elif investType == ChConfig.InvestType_Boss:
|
| | | if not indexProgressState:
|
| | | GameWorld.DebugLog(" Boss投资无参与击杀该boss,无法领取! rewardIndex=%s" % (rewardIndex))
|
| | | return
|
| | | |
| | | # 终身卡
|
| | | elif investType == ChConfig.InvestType_Life:
|
| | | pass
|
| | | |
| | | else:
|
| | | return
|
| | | |
| | | if not ipyData:
|
| | | return
|
| | | |
| | | rewardKey = "1" # 默认1
|
| | | rewardItemList = rewardInfo.get(str(rewardKey), [])
|
| | | curTime = int(time.time())
|
| | | rewardItemList = []
|
| | | # 按每天固定奖励的
|
| | | if rewardIndex == 0:
|
| | | lastRewardTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestRewardTime % investType)
|
| | | if lastRewardTime:
|
| | | if GameWorld.GetDiff_Day(curTime, lastRewardTime) == 0:
|
| | | GameWorld.DebugLog(" 已领取过该索引奖励! rewardIndex=%s" % rewardIndex)
|
| | | return
|
| | | |
| | | dayAwardDict = IpyGameDataPY.GetFuncEvalCfg("InvestDay", 3, {})
|
| | | if str(investType) in dayAwardDict:
|
| | | rewardItemList = dayAwardDict[str(investType)]
|
| | | |
| | | if not rewardItemList:
|
| | | return
|
| | |
|
| | | if not ItemControler.CheckPackSpaceEnough(curPlayer, rewardItemList):
|
| | | return
|
| | | |
| | | rewardValue, updRewardValue = GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestReward, rewardIndex, 1, True, [investType])
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | GameWorld.DebugLog(" rewardValue=%s,updRewardValue=%s,rewardItemList=%s" % (rewardValue, updRewardValue, rewardItemList))
|
| | | |
| | | # 记录最后一次领奖时间
|
| | | if investType == ChConfig.InvestType_Life:
|
| | | if rewardIndex == 0:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestRewardTime % (investType), int(time.time()))
|
| | | |
| | | for itemID, itemCount, isAuctionItem in rewardItemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem],
|
| | | event=["Invest", False, {}])
|
| | | ItemControler.NotifyGiveAwardInfo(curPlayer, rewardItemList, "Invest")
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.DR_GetGoldInvestReward(curPlayer, investType, rewardIndex, rewardItemList)
|
| | | |
| | | # 领完了,重置可重复购买的非永久卡
|
| | | maxDays = __GetInvestMaxDays(investType)
|
| | | canRepetBuyTypeList = IpyGameDataPY.GetFuncEvalCfg("InvestMaxDay", 2)
|
| | | if maxDays > 1 and investType in canRepetBuyTypeList:
|
| | | isAllDayGet = True
|
| | | for i in range(maxDays, -1, -1):
|
| | | if not IpyGameDataPY.GetIpyGameDataNotLog("Invest", investType * 100 + i):
|
| | | continue
|
| | | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_InvestReward, i, True, [investType]):
|
| | | isAllDayGet = False
|
| | | #GameWorld.DebugLog(" 还有未领取: i=%s,isAllDayGet=%s" % (i, isAllDayGet))
|
| | | break
|
| | | |
| | | if isAllDayGet:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestTime % investType, 0)
|
| | | for keyNum in range(ChConfig.Def_PDict_InvestKeyCount):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestReward % (investType, keyNum), 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_InvestProgress % (investType, keyNum), 0)
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | GameWorld.DebugLog(" 领完奖励了,重置投资! investType=%s" % investType)
|
| | | |
| | | GameWorld.DebugLog("更新领奖:investType=%s,rewardItemList=%s" % (investType, rewardItemList))
|
| | | Sync_InvestInfo(curPlayer, investType)
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, rewardItemList, event=["Invest", False, {}])
|
| | | return
|
| | |
|
| | | ## 同步投资理财信息
|
| | | def __todayAwardState(curPlayer, investType):
|
| | | lastRewardTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestRewardTime % investType)
|
| | | if lastRewardTime:
|
| | | if GameWorld.GetDiff_Day(int(time.time()), lastRewardTime) == 0:
|
| | | return 1
|
| | | return 0
|
| | |
|
| | | def Sync_InvestInfo(curPlayer, investType):
|
| | | investInfoPack = ChPyNetSendPack.tagMCInvestInfo()
|
| | | investInfoPack.InvestType = investType
|
| | | investInfoPack.CurDay = __GetInvestPassDays(curPlayer, investType)
|
| | | for keyNum in range(ChConfig.Def_PDict_InvestKeyCount):
|
| | | investInfoPack.RewardValue.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestReward % (investType, keyNum)))
|
| | | investInfoPack.ProgressValue.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestProgress % (investType, keyNum)))
|
| | | investInfoPack.ValueCount = len(investInfoPack.RewardValue)
|
| | | NetPackCommon.SendFakePack(curPlayer, investInfoPack)
|
| | | clientPack = ChPyNetSendPack.tagSCInvestInfo()
|
| | | clientPack.InvestType = investType
|
| | | clientPack.InvestBuyTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestTime % investType)
|
| | | clientPack.InvestEndTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_InvestEndTime % investType)
|
| | | clientPack.AwardState = __todayAwardState(curPlayer, investType)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | |
|