Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode
| | |
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("State", c_ubyte), #0-不可领 1-可领 2-已领取
|
| | | ("CTGTotal", c_int), #本次活动已累计充值,单位元
|
| | | ("FireworksBuyCount", c_ushort), #已购买高级烟花数
|
| | | ("FirewordsScore", c_int), #当前累计所有烟花总积分
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x14
|
| | | self.State = 0
|
| | | self.CTGTotal = 0
|
| | | self.FireworksBuyCount = 0
|
| | | self.FirewordsScore = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | DumpString = '''// AA 14 仙界盛典充值大礼 //tagMCXJSDRecharge:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | State:%d
|
| | | State:%d,
|
| | | CTGTotal:%d,
|
| | | FireworksBuyCount:%d,
|
| | | FirewordsScore:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.State
|
| | | self.State,
|
| | | self.CTGTotal,
|
| | | self.FireworksBuyCount,
|
| | | self.FirewordsScore
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | @param dateInfo: 运营活动表配置的日期信息, 如果是纯数字代表开服天
|
| | | @param openServerDay: 当前开服天
|
| | | '''
|
| | | if not dateInfo:
|
| | | curDateTime = datetime.datetime.today()
|
| | | return "%d-%d-%d" % (curDateTime.year, curDateTime.month, curDateTime.day)
|
| | | if dateInfo.startswith("W"):
|
| | | curDateTime = datetime.datetime.today()
|
| | | curWeekday = curDateTime.weekday() + 1
|
| | | actionWeekday = int(dateInfo[1:])
|
| | | actionDateTime = curDateTime + datetime.timedelta(days=(actionWeekday-curWeekday))
|
| | | return "%d-%d-%d" % (actionDateTime.year, actionDateTime.month, actionDateTime.day)
|
| | | if dateInfo.startswith("Mix"):
|
| | | diffDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_MixServerDay) + 1
|
| | | actionServerDay = int(dateInfo[3:])
|
| | |
| | | self.serverGroupID = 0 # 所属服务器ID,一个服务器ID由多个服组成
|
| | | self.pkZoneID = 0 # 所属赛区ID,一个赛区由多个服务器ID组成
|
| | | self.seasonID = 0 # 赛季ID
|
| | | self.notifyMatchRobotTick = 0 # 通知匹配到机器人的tick
|
| | | return
|
| | |
|
| | | def GetDRInfo(self):
|
| | |
| | | if danIpyData:
|
| | | matchRobotRate = danIpyData.GetMatchRobotRate() + danIpyData.GetMatchRobotRateEx() * cLoseCount
|
| | | if matchRobotRate and GameWorld.CanHappen(matchRobotRate, 100):
|
| | | pkPlayer.notifyMatchRobotTick = tick + random.randint(3, 5) * 1000
|
| | | PyGameData.g_crossPKZoneMatchRobotPlayerDict[playerID] = pkPlayer
|
| | | GameWorld.DebugLog("玩家加入匹配: seasonID=%s,pkZoneID=%s,serverGroupID=%s,accID=%s,playerID=%s,pkScore=%s,fightPower=%s,cWinCount=%s"
|
| | | % (seasonID, pkZoneID, serverGroupID, accID, playerID, pkScore, fightPower, cWinCount))
|
| | | GameWorld.DebugLog(" 本次匹配到机器人: danLV=%s,cLoseCount=%s,概率=%s" % (danLV, cLoseCount, matchRobotRate), playerID)
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 2], [serverGroupID])
|
| | | #这里优化下暂通知开始匹配,实际匹配到机器人做延迟通知
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID])
|
| | | return
|
| | |
|
| | | PyGameData.g_crossPKPlayerDict[playerID] = pkPlayer
|
| | |
| | | % (seasonID, pkZoneID, serverGroupID, accID, playerID, pkScore, fightPower, cWinCount, cLoseCount, matchRobotRate, len(zoneMatchPlayerList)))
|
| | |
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID])
|
| | | return
|
| | |
|
| | | def __DelayNotifyMatchRobot(tick):
|
| | | ## 做体验,延迟通知匹配到机器人
|
| | | for playerID, pkPlayer in PyGameData.g_crossPKZoneMatchRobotPlayerDict.items():
|
| | | if pkPlayer.notifyMatchRobotTick == -1:
|
| | | #GameWorld.DebugLog("已通知过玩家匹配到机器人", playerID)
|
| | | continue
|
| | | if tick < pkPlayer.notifyMatchRobotTick:
|
| | | continue
|
| | | pkPlayer.notifyMatchRobotTick = -1
|
| | | serverGroupID = pkPlayer.serverGroupID
|
| | | GameWorld.DebugLog("延迟通知玩家匹配到机器人: serverGroupID=%s" % (serverGroupID), playerID)
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 2], [serverGroupID])
|
| | | |
| | | return
|
| | |
|
| | | def ClientServerMsg_PKCancel(playerInfoDict, tick):
|
| | |
| | | return
|
| | | GameWorld.GetGameWorld().SetDict(processTickKey, tick)
|
| | |
|
| | | # 延迟通知匹配到机器人的
|
| | | __DelayNotifyMatchRobot(tick)
|
| | | # 处理超时的房间
|
| | | __DoCheckRoomTimeout(tick)
|
| | | # 通知已准备好的房间玩家可进入跨服
|
| | |
| | | mapServerOperationActionDict = {}
|
| | | serverGroupID = GameWorld.GetServerGroupID()
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | curWeekday = curDateTime.weekday() + 1 # 今天星期几, 1代表星期1
|
| | |
|
| | | GameWorld.Log("===== 加载本日运营活动信息: %s, serverGroupID=%s,openServerDay=%s,customMaxServerDay=%s,isMixServer=%s,mixServerDay=%s,maxCustomServerDayMix=%s,reloadSign=%s ====="
|
| | | % (curDateTime, serverGroupID, openServerDay, customMaxServerDay, isMixServer, mixServerDay, maxCustomServerDayMix, reloadSign))
|
| | | GameWorld.Log(" 今日周%s" % (curWeekday))
|
| | |
|
| | | for actName in ShareDefine.OperationActionNameList:
|
| | |
|
| | |
| | | GameWorld.Log("加载运营活动: actName=%s" % (actName))
|
| | | curServerActIpyDataList = __GetOperationActionServerIpyDataList(ipyDataMgr, serverGroupID, actName)
|
| | | GameWorld.Log(" 可处理条数=%s" % (len(curServerActIpyDataList)))
|
| | | disableWeekIpyDataInfo = __GetOperationActionDisableWeekIpyDataInfo(curDateTime, curServerActIpyDataList)
|
| | | needStartList = [] # [startDateTime, ...]
|
| | | needEndList = [] # [endDateTime, ...]
|
| | | needNotifyDict = {} # {notifyDateTime:[notifyKey, [参数]], ...}
|
| | |
| | | endDateStr = ipyData.GetEndDate()
|
| | | GameWorld.Log(" cfgID=%s,serverGroupIDList=%s,Except=%s,startDateStr=%s,endDateStr=%s,openServerDay=%s,isMixServer=%s,mixServerDay=%s,maxCustomServerDayMix=%s,curDateTime=%s"
|
| | | % (cfgID, serverGroupIDList, serverGroupIDListExcept, startDateStr, endDateStr, openServerDay, isMixServer, mixServerDay, maxCustomServerDayMix, curDateTime))
|
| | | if cfgID in disableWeekIpyDataInfo:
|
| | | startWeekDate, endWeekDate, ymdCfgID, ymdStartDate, ymdEndDate = disableWeekIpyDataInfo[cfgID]
|
| | | GameWorld.Log(" 按星期开启的在按日期开启的时间内,不处理! cfgID=%s,%s(%s) ~ %s(%s) in ymdCfgID=%s,%s ~ %s" |
| | | % (cfgID, startWeekDate, startDateStr, endWeekDate, endDateStr, ymdCfgID, ymdStartDate, ymdEndDate))
|
| | | continue
|
| | | if not startDateStr:
|
| | | startDateStr = "%d-%d-%d" % (serverTime.year, serverTime.month, serverTime.day)
|
| | | GameWorld.Log(" 开始日期为空,默认每天,今日为: startDateStr=%s" % startDateStr)
|
| | | if not endDateStr:
|
| | | endDateStr = "%d-%d-%d" % (serverTime.year, serverTime.month, serverTime.day)
|
| | | GameWorld.Log(" 结束日期为空,默认每天,今日为: endDateStr=%s" % endDateStr)
|
| | | # 活动优先级为 开服天=合服天>运营日期>运营周天
|
| | | # 按开服天开的
|
| | | if startDateStr.isdigit() and endDateStr.isdigit():
|
| | | startServerDay, endServerDay = int(startDateStr), int(endDateStr)
|
| | |
| | | startDateStr = "%d-%d-%d" % (openServerDateTime.year, openServerDateTime.month, openServerDateTime.day)
|
| | | endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day)
|
| | | GameWorld.Log(" 合服天转化为日期: %s ~ %s" % (startDateStr, endDateStr))
|
| | | elif startDateStr.startswith("W") and endDateStr.startswith("W"):
|
| | | startWeekday = int(startDateStr[1:])
|
| | | endWeekday = int(endDateStr[1:])
|
| | | startWeekDate = curDateTime + datetime.timedelta(days=(startWeekday-curWeekday))
|
| | | endWeekDate = curDateTime + datetime.timedelta(days=(endWeekday-curWeekday))
|
| | | startDateStr = "%d-%d-%d" % (startWeekDate.year, startWeekDate.month, startWeekDate.day)
|
| | | endDateStr = "%d-%d-%d" % (endWeekDate.year, endWeekDate.month, endWeekDate.day)
|
| | | GameWorld.Log(" 星期X转化为日期: %s ~ %s" % (startDateStr, endDateStr))
|
| | | elif actName not in ShareDefine.FeastOperationActionNameList:
|
| | | if openServerDay <= customMaxServerDay:
|
| | | GameWorld.Log(" 按日期开的在开服定制限制天内,不处理! cfgID=%s,%s ~ %s,openServerDay=%s" % (cfgID, startDateStr, endDateStr, openServerDay))
|
| | | continue
|
| | | curServerOpenDateTime = curDateTime + datetime.timedelta(days=(1-openServerDay)) # 开服第一天的日期
|
| | | customMaxServerDateTime = curDateTime + datetime.timedelta(days=(customMaxServerDay-openServerDay))
|
| | | curStartDateTime = datetime.datetime.strptime("%s %02d:%02d:%02d" % (startDateStr, customMaxServerDateTime.hour, customMaxServerDateTime.minute,
|
| | | customMaxServerDateTime.second), ChConfig.TYPE_Time_Format)
|
| | | if curStartDateTime <= customMaxServerDateTime:
|
| | | GameWorld.Log(" 按日期开的开始日期在开服定制限制天内,不处理! cfgID=%s,curStartDateTime=%s,customMaxServerDateTime=%s" % (cfgID, curStartDateTime, customMaxServerDateTime))
|
| | | if curServerOpenDateTime <= curStartDateTime <= customMaxServerDateTime:
|
| | | GameWorld.Log(" 按日期开的开始日期在开服定制限制天内,不处理! cfgID=%s,curServerOpenDateTime=%s<=curStartDateTime=%s<=customMaxServerDateTime=%s" % (cfgID, curServerOpenDateTime, curStartDateTime, customMaxServerDateTime))
|
| | | continue
|
| | |
|
| | | if isMixServer:
|
| | |
| | | curStartDateTime = datetime.datetime.strptime("%s %02d:%02d:%02d" % (startDateStr, customMaxServerDateTime.hour, customMaxServerDateTime.minute,
|
| | | customMaxServerDateTime.second), ChConfig.TYPE_Time_Format)
|
| | | if mixStartServerDateTime <= curStartDateTime <= customMaxServerDateTime:
|
| | | GameWorld.Log(" 按日期开的开始日期在合服定制限制天内,不处理! cfgID=%s,mixStartServerDateTime=%s,curStartDateTime=%s,customMaxServerDateTime=%s" % (cfgID, mixStartServerDateTime, curStartDateTime, customMaxServerDateTime))
|
| | | GameWorld.Log(" 按日期开的开始日期在合服定制限制天内,不处理! cfgID=%s,mixStartServerDateTime=%s<=curStartDateTime=%s<=customMaxServerDateTime=%s" % (cfgID, mixStartServerDateTime, curStartDateTime, customMaxServerDateTime))
|
| | | continue
|
| | |
|
| | | if hasattr(ipyData, "GetStartTimeList") and hasattr(ipyData, "GetEndTimeList"):
|
| | |
| | |
|
| | | return curServerActIpyDataList
|
| | |
|
| | | def __GetOperationActionDisableWeekIpyDataInfo(curDateTime, curServerActIpyDataList):
|
| | | ## 获取不可用的按星期X开启的配置数据信息,按星期X开启的 活动优先级小于按日期的,当有重叠时以日期的为准
|
| | | disableWeekIpyDataInfo = {}
|
| | | curWeekday = curDateTime.weekday() + 1 # 今天星期几, 1代表星期1
|
| | | |
| | | weekIpyDataList, ymdIpyDatList = [], []
|
| | | for ipyData in curServerActIpyDataList:
|
| | | startDateStr = ipyData.GetStartDate()
|
| | | endDateStr = ipyData.GetEndDate()
|
| | | if startDateStr.isdigit() or startDateStr.startswith("Mix"):
|
| | | # 开服天、合服天的不处理
|
| | | continue
|
| | | |
| | | # 按星期X的
|
| | | if startDateStr.startswith("W"):
|
| | | startWeekday = int(startDateStr[1:])
|
| | | endWeekday = int(endDateStr[1:])
|
| | | startWeekDate = curDateTime + datetime.timedelta(days=(startWeekday-curWeekday))
|
| | | endWeekDate = curDateTime + datetime.timedelta(days=(endWeekday-curWeekday))
|
| | | weekIpyDataList.append([ipyData, startWeekDate, endWeekDate])
|
| | | # 按日期的
|
| | | else:
|
| | | ymdIpyData = ipyData
|
| | | ymdStartDate = datetime.datetime.strptime("%s %02d:%02d:00" % (startDateStr, curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
|
| | | ymdEndDate = datetime.datetime.strptime("%s %02d:%02d:00" % (endDateStr, curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
|
| | | ymdIpyDatList.append([ymdIpyData, ymdStartDate, ymdEndDate])
|
| | | |
| | | for ipyData, startWeekDate, endWeekDate in weekIpyDataList:
|
| | | cfgID = ipyData.GetCfgID()
|
| | | for ymdIpyData, ymdStartDate, ymdEndDate in ymdIpyDatList:
|
| | | if ymdStartDate <= startWeekDate <= ymdEndDate or ymdStartDate <= endWeekDate <= ymdEndDate:
|
| | | ymdCfgID = ymdIpyData.GetCfgID()
|
| | | disableWeekIpyDataInfo[cfgID] = [startWeekDate, endWeekDate, ymdCfgID, ymdStartDate, ymdEndDate]
|
| | | |
| | | return disableWeekIpyDataInfo
|
| | |
|
| | | def Dispose_OperationActionState(reloadRefresh=False):
|
| | | # 运营活动状态处理, 每天0点会强制同步当天的运营活动详情到地图服务器
|
| | |
|
| | |
| | | AuctionHouse.OnPlayerLeaveServer(curPlayer)
|
| | | #------------镖车逻辑
|
| | | #TruckPlayerDisconnectProcess(curPlayer, tick)
|
| | | |
| | | if not PlayerControl.GetIsTJG(curPlayer):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | PyGameData.g_unTJLogoffTime[playerID] = int(time.time())
|
| | | |
| | | return
|
| | |
|
| | | ## 设置玩家离线时间
|
| | |
| | | return
|
| | |
|
| | | def NotifyTalkCache(curPlayer):
|
| | | ##上线通知聊天缓存
|
| | | sendPack = ChPyNetSendPack.tagGCTalkCache()
|
| | | sendPack.Clear()
|
| | | sendPack.InfoList = []
|
| | | ##上线通知非脱机离线后的聊天缓存
|
| | | if PlayerControl.GetIsTJG(curPlayer):
|
| | | return
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | unTJLogoffTime = PyGameData.g_unTJLogoffTime.get(playerID, 0)
|
| | | |
| | | familyCacheList, worldCacheList = [], []
|
| | | familyID = curPlayer.GetFamilyID()
|
| | | if familyID and familyID in PyGameData.g_familyTalkCache:
|
| | | for curTime, name, playerID, content, extras in PyGameData.g_familyTalkCache[familyID]:
|
| | | if curTime < unTJLogoffTime:
|
| | | continue
|
| | | contentInfo = ChPyNetSendPack.tagGCTalkCacheInfo()
|
| | | contentInfo.Clear()
|
| | | contentInfo.ChannelType = 2
|
| | |
| | | contentInfo.Content = content
|
| | | contentInfo.Len = len(content)
|
| | | contentInfo.Extras = extras
|
| | | sendPack.InfoList.append(contentInfo)
|
| | | elif PyGameData.g_worldTalkCache:
|
| | | for curTime, name, playerID, content, extras in PyGameData.g_worldTalkCache:
|
| | | contentInfo = ChPyNetSendPack.tagGCTalkCacheInfo()
|
| | | contentInfo.Clear()
|
| | | contentInfo.ChannelType = 1
|
| | | contentInfo.Name = name
|
| | | contentInfo.NameLen = len(name)
|
| | | contentInfo.PlayerID = playerID
|
| | | contentInfo.Time = curTime
|
| | | contentInfo.Content = content
|
| | | contentInfo.Len = len(content)
|
| | | contentInfo.Extras = extras
|
| | | sendPack.InfoList.append(contentInfo)
|
| | | sendPack.Count = len(sendPack.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | familyCacheList.append(contentInfo)
|
| | | |
| | | for curTime, name, playerID, content, extras in PyGameData.g_worldTalkCache:
|
| | | if curTime < unTJLogoffTime:
|
| | | continue
|
| | | contentInfo = ChPyNetSendPack.tagGCTalkCacheInfo()
|
| | | contentInfo.Clear()
|
| | | contentInfo.ChannelType = 1
|
| | | contentInfo.Name = name
|
| | | contentInfo.NameLen = len(name)
|
| | | contentInfo.PlayerID = playerID
|
| | | contentInfo.Time = curTime
|
| | | contentInfo.Content = content
|
| | | contentInfo.Len = len(content)
|
| | | contentInfo.Extras = extras
|
| | | worldCacheList.append(contentInfo)
|
| | | |
| | | if familyCacheList:
|
| | | sendPack = ChPyNetSendPack.tagGCTalkCache()
|
| | | sendPack.Clear()
|
| | | sendPack.InfoList = familyCacheList
|
| | | sendPack.Count = len(sendPack.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | |
| | | if worldCacheList:
|
| | | sendPack = ChPyNetSendPack.tagGCTalkCache()
|
| | | sendPack.Clear()
|
| | | sendPack.InfoList = worldCacheList
|
| | | sendPack.Count = len(sendPack.InfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return |
| | |
| | | g_crossFBFuncLinePlayerCountInfo = {} # 跨服副本功能线路人数信息,本服缓存 {mapID:{funcLineID:[playerCount], ...}, ...}
|
| | |
|
| | | g_familyTalkCache = {} #{familyID:[[time,content,extras],..]}
|
| | | g_worldTalkCache = [] #[[time,name, playerID, content,extras],..] |
| | | g_worldTalkCache = [] #[[time,name, playerID, content,extras],..]
|
| | |
|
| | | g_unTJLogoffTime = {} #非脱机离线时间 {playerID:time, ...}
|
| | |
| | | Def_PDict_LVAwardVIPGetRecord = "LVAwardVIPGetRecord" # 等级奖励vip领取信息记录,按二进制位标示
|
| | | Def_PDict_HistoryChargeAwardGetRecord = "HTotalGoldAwardRecord" # 历史累计充值奖励领取信息记录,按二进制位标示
|
| | | Def_PDict_CTGCountResetTime = "CTGCountResetTime" # CTG次数重置时间time值
|
| | | Def_PDict_TodayCTGCoinTotal = "TodayCTGCoinTotal" # 当日充值Coin数
|
| | | Def_PDict_TodayCTGCount = "TodayCTGCount_%s" # 当日充值次数,参数(CTG对应的商品记录ID)
|
| | | Def_PDict_CTGGoodsBuyCount = "CTGGoodsBuyCount_%s" # 对应充值商品已购买次数,参数(CTG对应的商品记录ID)
|
| | | Def_PDict_GoldGiftFirstRecord = "GoldGiftFirstRecord" # 首充领取记录,0-未领取;1-已领取
|
| | |
| | | Def_PDict_FCPartyCurCnt = "FCPartyCurCnt_%s" #全民来嗨活动当前完成次数 参数活动ID
|
| | | Def_PDict_FCPartyCurPoint = "FCPartyCurPoint" #全民来嗨活动当前总点数
|
| | | Def_PDict_FCPartyAwardRecord = "FCPartyAwardRecord" #全民来嗨活动领奖记录
|
| | | Def_PDict_FCCostGold = "FCCostGold" # 绝版降临总累计消费仙玉
|
| | | Def_PDict_FCCTGRMBTotal = "FCCTGRMBTotal" # 绝版降临总累计充值元
|
| | | Def_PDict_FCFireworksBuyCount = "FCFireworksBuyCount" # 高级烟花已购买次数
|
| | | Def_PDict_FCFireworksScore = "FCFireworksScore" # 总烟花积分,含普通烟花
|
| | |
|
| | | #新仙界盛典
|
| | | Def_PDict_NewFairyCeremonyID = "NewFairyCeremonyID" # 玩家身上的仙界盛典活动ID,唯一标识,取活动开始日期time值
|
| | |
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("State", c_ubyte), #0-不可领 1-可领 2-已领取
|
| | | ("CTGTotal", c_int), #本次活动已累计充值,单位元
|
| | | ("FireworksBuyCount", c_ushort), #已购买高级烟花数
|
| | | ("FirewordsScore", c_int), #当前累计所有烟花总积分
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x14
|
| | | self.State = 0
|
| | | self.CTGTotal = 0
|
| | | self.FireworksBuyCount = 0
|
| | | self.FirewordsScore = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | DumpString = '''// AA 14 仙界盛典充值大礼 //tagMCXJSDRecharge:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | State:%d
|
| | | State:%d,
|
| | | CTGTotal:%d,
|
| | | FireworksBuyCount:%d,
|
| | | FirewordsScore:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.State
|
| | | self.State,
|
| | | self.CTGTotal,
|
| | | self.FireworksBuyCount,
|
| | | self.FirewordsScore
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | import math
|
| | | import time
|
| | |
|
| | | # 商店类型定义
|
| | | ShopType_FairyCeremony = 19 # 仙界盛典烟花
|
| | |
|
| | | g_mysticalShopDict = {} #神秘商店{等级范围:[等级段,{金钱类型:库}]}
|
| | | #---------------------------------------------------------------------
|
| | | ##开始交易
|
| | |
| | | sendMailKey = mailKey if isLackPack and mailKey else '' #背包不足且配置了mailKey的才发邮件
|
| | |
|
| | | # 购买限制条件扩展
|
| | | if CheckBuyItemLimitEx(curPlayer, shopType, itemIndex, mainItemID, ipyData.GetLimitValue()):
|
| | | if CheckBuyItemLimitEx(curPlayer, shopType, itemIndex, mainItemID, ipyData.GetLimitValue(), clientBuyCount):
|
| | | GameWorld.Log("Store shop item buy limit! shopType=%s,itemIndex=%s,limitValue=%s"
|
| | | % (shopType, itemIndex, ipyData.GetLimitValue()), curPlayer.GetPlayerID())
|
| | | return
|
| | |
| | | EventShell.EventRespons_ShopBuy(curPlayer, shopType)
|
| | | #curPlayer.ShopResult(itemIndex, IPY_GameWorld.tsrShopOK)
|
| | | SyncShoppingResult(curPlayer, itemIndex, clientBuyCount)
|
| | | if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
|
| | | PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
|
| | | if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
|
| | | PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
|
| | |
|
| | | if shopType == ShopType_FairyCeremony:
|
| | | PlayerFairyCeremony.OnBuyFireworks(curPlayer, itemIndex, clientBuyCount)
|
| | | # if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
|
| | | # PlayerNewFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
|
| | | return
|
| | |
|
| | | def GetShopJobItem(job, itemID, jobItemList):
|
| | |
| | | ## 商店购买物品限制条件扩展
|
| | | # @param curPlayer 玩家实例
|
| | | # @return
|
| | | def CheckBuyItemLimitEx(curPlayer, shopNPCID, itemIndex, curItemID, limitValue):
|
| | | def CheckBuyItemLimitEx(curPlayer, shopNPCID, itemIndex, curItemID, limitValue, clientBuyCount):
|
| | | if shopNPCID == 7: #符印商店
|
| | | return not PlayerRune.GetIsOpenByRuneID(curPlayer, curItemID)
|
| | | if shopNPCID in [8, 9, 10]: #仙盟商店
|
| | |
| | | #playerCreateRoleDays = GameWorld.GetCreateRoleDays(curPlayer)
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
|
| | | return openServerDay != limitValue
|
| | | #烟花狂欢
|
| | | if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
|
| | | return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
|
| | | if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
|
| | | return not PlayerNewFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
|
| | |
|
| | | |
| | | #仙界盛典 - 烟花狂欢
|
| | | if shopNPCID == ShopType_FairyCeremony:
|
| | | return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex, clientBuyCount)
|
| | | |
| | | #另一个仙界盛典可用其他商店NPCID,这里先注释,之后再改
|
| | | # if itemIndex in IpyGameDataPY.GetFuncEvalCfg('NewCeremonyFireParty', 1, {}).values():
|
| | | # return not PlayerNewFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
|
| | | |
| | | if shopNPCID == 16:#神秘限购
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % itemIndex)
|
| | | curTime = int(time.time())
|
| | |
| | | @param dateInfo: 运营活动表配置的日期信息, 如果是纯数字代表开服天
|
| | | @param openServerDay: 当前开服天
|
| | | '''
|
| | | if not dateInfo:
|
| | | curDateTime = datetime.datetime.today()
|
| | | return "%d-%d-%d" % (curDateTime.year, curDateTime.month, curDateTime.day)
|
| | | if dateInfo.startswith("W"):
|
| | | curDateTime = datetime.datetime.today()
|
| | | curWeekday = curDateTime.weekday() + 1
|
| | | actionWeekday = int(dateInfo[1:])
|
| | | actionDateTime = curDateTime + datetime.timedelta(days=(actionWeekday-curWeekday))
|
| | | return "%d-%d-%d" % (actionDateTime.year, actionDateTime.month, actionDateTime.day)
|
| | | if dateInfo.startswith("Mix"):
|
| | | diffDay = GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_MixServerDay) + 1
|
| | | actionServerDay = int(dateInfo[3:])
|
| | |
| | |
|
| | |
|
| | | def OnDay(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, 0)
|
| | | |
| | | syncRecordIDList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetCTGCount()):
|
| | |
| | | curPlayer.SetChangeCoinPointTotal(changeCoinPointBefore + orderCoin, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
|
| | |
|
| | | todayCTGCoinTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCoinTotal) + orderCoin
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, todayCTGCoinTotal)
|
| | | |
| | | goldAfter = curPlayer.GetGold()
|
| | | changeCoinPointAfter = curPlayer.GetChangeCoinPointTotal()
|
| | | bourseMoneyAfter = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
|
| | | addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], |
| | | addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], "todayCTGCoinTotal":todayCTGCoinTotal,
|
| | | "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList})
|
| | |
|
| | | DataRecordPack.DR_CTGOK(curPlayer, addDRDict)
|
| | |
| | | PlayerGoldGift.DayChargeRedPackAward(curPlayer)
|
| | | #累积充值X元
|
| | | PlayerActTotalRecharge.AddTotalRechargeGold(curPlayer, orderCoin/100)
|
| | | PlayerFairyCeremony.AddFCCostGold(curPlayer, orderCoin/100)
|
| | | PlayerFairyCeremony.AddFCCTGRMB(curPlayer, orderCoin/100)
|
| | | PlayerNewFairyCeremony.AddFCCostGold(curPlayer, orderCoin/100)
|
| | | #开服活动
|
| | | #OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin)
|
| | |
| | |
|
| | | # 消费返利
|
| | | PlayerCostRebate.AddCostRebateGold(curPlayer, costType, price, infoDict)
|
| | | # 绝版降临
|
| | | # PlayerFairyCeremony.AddFCCostGold(curPlayer, costType, price)
|
| | | # PlayerNewFairyCeremony.AddFCCostGold(curPlayer, costType, price)
|
| | |
|
| | | # 事件汇报
|
| | | #===========================================================================
|
| | |
| | | if FairyCeremonyID == playerFairyCeremonyID:
|
| | | #GameWorld.DebugLog("仙界盛典活动ID不变,不处理!", curPlayer.GetPlayerID())
|
| | | return
|
| | | ctgRMBTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCoinTotal) / 100
|
| | | actWorldLV = actFairyCeremonyInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | playerFCWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCActionWorldLV)
|
| | | GameWorld.DebugLog("仙界盛典重置! FairyCeremonyID=%s,playerCostRebateID=%s,state=%s,ActWorldLV=%s,playerFCWorldLV=%s" |
| | | % (FairyCeremonyID, playerFairyCeremonyID, state, actWorldLV, playerFCWorldLV), playerID)
|
| | | GameWorld.DebugLog("仙界盛典重置! FairyCeremonyID=%s,playerCostRebateID=%s,state=%s,ActWorldLV=%s,playerFCWorldLV=%s,ctgRMBTotal=%s" |
| | | % (FairyCeremonyID, playerFairyCeremonyID, state, actWorldLV, playerFCWorldLV, ctgRMBTotal), playerID)
|
| | |
|
| | | # 未领取的奖励邮件发放
|
| | | __SendFairyCeremonyMail(curPlayer, playerFCWorldLV)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCActionWorldLV, actWorldLV)
|
| | | #重置充值大礼记录
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCRechargeState, 0)
|
| | | SyncFCRechargeInfo(curPlayer)
|
| | | #重置全民来嗨
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCPartyCurPoint, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCPartyAwardRecord, 0)
|
| | | for actid in ChConfig.PeoplePartyActIDList:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCPartyCurCnt % actid, 0)
|
| | | SyncFCPartyInfo(curPlayer)
|
| | | #重置消费
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCostGold, 0)
|
| | | #重置已充值RMB及烟花相关
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCTGRMBTotal, ctgRMBTotal)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksBuyCount, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksScore, 0)
|
| | | SyncFCRechargeInfo(curPlayer)
|
| | | return True
|
| | |
|
| | | def __SendFairyCeremonyMail(curPlayer, playerFCWorldLV):
|
| | |
| | | ## 通知充值大礼活动状态
|
| | | packData = ChPyNetSendPack.tagMCXJSDRecharge()
|
| | | packData.State = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCRechargeState)
|
| | | packData.CTGTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCTGRMBTotal)
|
| | | packData.FireworksBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksBuyCount)
|
| | | packData.FirewordsScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksScore)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|
| | |
|
| | |
| | | return
|
| | |
|
| | | #################绝版降临##############################
|
| | | def AddFCCostGold(curPlayer, costGold):
|
| | | ##充值X元
|
| | | if costGold <= 0:
|
| | |
|
| | | def AddFCCTGRMB(curPlayer, ctgRMB):
|
| | | ## 充值X元
|
| | | if ctgRMB <= 0:
|
| | | return
|
| | | # if costType in ChConfig.CostRebate_DisableType:
|
| | | # #GameWorld.DebugLog("不计入绝版降临消费的消费类型!costType=%s" % costType, curPlayer.GetPlayerID())
|
| | | # return
|
| | | if not __IsAtFCAction():
|
| | | return
|
| | | curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCostGold)
|
| | | updCostGold = curCostGold + costGold
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCostGold, updCostGold)
|
| | | |
| | | if updCostGold < IpyGameDataPY.GetFuncCfg('CeremonyRankLimit'):
|
| | | curRMBTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCTGRMBTotal)
|
| | | updRMBTotal = curRMBTotal + ctgRMB
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCTGRMBTotal, updRMBTotal)
|
| | | GameWorld.Log("更新仙界盛典充值RMB值: curRMBTotal=%s,ctgRMB=%s,updRMBTotal=%s" |
| | | % (curRMBTotal, ctgRMB, updRMBTotal), curPlayer.GetPlayerID())
|
| | | SyncFCRechargeInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def OnBuyFireworks(curPlayer, itemIndex, clientBuyCount):
|
| | | ## 购买烟花
|
| | | if not __IsAtFCAction():
|
| | | return
|
| | |
|
| | | #更新排行榜
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FCCostGold, updCostGold)
|
| | | fireworksDict = IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {})
|
| | | worldLvNum = __GetFCWorldLVIndex(curPlayer, Def_FC_Fireworks)
|
| | | canBuyIDList = fireworksDict.get(str(worldLvNum), []) #[普通烟花, 高级烟花]
|
| | | if itemIndex not in canBuyIDList:
|
| | | return
|
| | | fireworksIndex = canBuyIDList.index(itemIndex)
|
| | | AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
|
| | | if fireworksIndex == 1:
|
| | | fireworksBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksBuyCount) + clientBuyCount
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksBuyCount, fireworksBuyCount)
|
| | | GameWorld.DebugLog("更新玩家高级烟花已购买次数: clientBuyCount=%s,fireworksBuyCount=%s" |
| | | % (clientBuyCount, fireworksBuyCount), curPlayer.GetPlayerID())
|
| | | |
| | | fireworksScoreList = IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 2) # [普通烟花积分, 高级烟花积分]
|
| | | addScore = fireworksScoreList[fireworksIndex] * clientBuyCount
|
| | | curFireworksScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksScore)
|
| | | updFireworksScore = curFireworksScore + addScore
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksScore, updFireworksScore)
|
| | |
|
| | | GameWorld.DebugLog("玩家绝版降临消费活动: curCostGold=%s,costGold=%s,updCostGold=%s" |
| | | % (curCostGold, costGold, updCostGold), curPlayer.GetPlayerID())
|
| | | billboardNeedScore = IpyGameDataPY.GetFuncCfg('CeremonyFireParty', 4)
|
| | | if updFireworksScore >= billboardNeedScore:
|
| | | #更新排行榜
|
| | | GameWorld.DebugLog("玩家绝版降临积分排行更新: itemIndex=%s,clientBuyCount=%s,curFireworksScore=%s,addScore=%s,updFireworksScore=%s" |
| | | % (itemIndex, clientBuyCount, curFireworksScore, addScore, updFireworksScore), curPlayer.GetPlayerID())
|
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FCCostGold, updFireworksScore)
|
| | | else:
|
| | | GameWorld.DebugLog("玩家绝版降临烟花积分不足,无法上榜! updFireworksScore=%s < billboardNeedScore=%s" |
| | | % (updFireworksScore, billboardNeedScore), curPlayer.GetPlayerID())
|
| | | |
| | | SyncFCRechargeInfo(curPlayer) |
| | | return
|
| | |
|
| | | #################烟花狂欢##############################
|
| | | def IsCanBuyFireworks(curPlayer, itemIndex):
|
| | | def IsCanBuyFireworks(curPlayer, itemIndex, clientBuyCount):
|
| | | ##当前是否可以买烟花
|
| | | if not __IsAtFCAction():
|
| | | GameWorld.Log(' 烟花狂欢买烟花 活动未开启, 无法购买')
|
| | | return False
|
| | | fireworksDict = IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {})
|
| | | worldLvNum = __GetFCWorldLVIndex(curPlayer, Def_FC_Fireworks)
|
| | | canBuyID = fireworksDict.get(str(worldLvNum), 0)
|
| | | if canBuyID != itemIndex:
|
| | | GameWorld.Log(' 烟花狂欢买烟花 当前可以买烟花为 %s, 无法购买 %s,worldLvNum=%s'%(canBuyID, itemIndex,worldLvNum), curPlayer.GetID())
|
| | | canBuyIDList = fireworksDict.get(str(worldLvNum), []) #[普通烟花, 高级烟花]
|
| | | if itemIndex not in canBuyIDList:
|
| | | GameWorld.Log(' 烟花狂欢买烟花 当前可以买烟花为 %s, 无法购买 %s,worldLvNum=%s'%(canBuyIDList, itemIndex,worldLvNum), curPlayer.GetID())
|
| | | return False
|
| | | return True |
| | | #高级烟花需要判断充值的总额
|
| | | if itemIndex == canBuyIDList[-1]:
|
| | | curRMBTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCTGRMBTotal)
|
| | | fireworksBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksBuyCount)
|
| | | buyOneNeedRMB = IpyGameDataPY.GetFuncCfg('CeremonyFireParty', 3) # 购买一个高级烟花所需充值RMB值,单位X元
|
| | | totalCanBuyCount = curRMBTotal / buyOneNeedRMB
|
| | | if (fireworksBuyCount + clientBuyCount) > totalCanBuyCount:
|
| | | GameWorld.Log(' 烟花狂欢买烟花 高级烟花所需重置RMB不足, 无法购买! curRMBTotal=%s,totalCanBuyCount=%s < fireworksBuyCount=%s + clientBuyCount=%s' |
| | | % (curRMBTotal, totalCanBuyCount, fireworksBuyCount, clientBuyCount), curPlayer.GetID())
|
| | | return False
|
| | | return True
|