def sendVipCirculateInfo(userId): """ 道具流通数量限制信息 """ levels = {} for level in sorted(map(int, config.getVipConf().keys())): levelDict = {} vipConf = config.getVipConf(level) levelDict["present:1408"] = vipConf.get("vipPresentCount:1408", 0) levelDict["present:1429"] = vipConf.get("vipPresentCount:1429", 0) levelDict["present:1430"] = vipConf.get("vipPresentCount:1430", 0) levelDict["present:1431"] = vipConf.get("vipPresentCount:1431", 0) levelDict["present:14120"] = vipConf.get("vipPresentCount:14120", 0) levelDict["present:14119"] = vipConf.get("vipPresentCount:14119", 0) levelDict["present:1193"] = vipConf.get("vipPresentCount:1193", 0) levelDict["present:1194"] = vipConf.get("vipPresentCount:1194", 0) levelDict["receive:1193"] = vipConf.get("vipReceiveCount:1193", 0) levelDict["receive:1194"] = vipConf.get("vipReceiveCount:1194", 0) levels[level] = levelDict mo = MsgPack() mo.setCmd("fish_circulate_info") mo.setResult("gameId", FISH_GAMEID) mo.setResult("userId", userId) mo.setResult("levels", levels) router.sendToUser(mo, userId)
def vipAutoSupplyPerDay(userId): """ vip每日自动补足 """ vipLevel = hallvip.userVipSystem.getVipInfo(userId).get("level", 0) key = GameData.autoSupplyKey % config.CHIP_KINDID autoSupplyCount = config.getVipConf(vipLevel).get(key, 0) chips = userchip.getUserChipAll(userId) if autoSupplyCount >= 10000 and chips < autoSupplyCount and weakdata.getDayFishData( userId, key, 0) == 0: weakdata.incrDayFishData(userId, key, 1) lang = util.getLanguage(userId) rewards = [{ "name": config.CHIP_KINDID, "count": (autoSupplyCount - chips) }] message = config.getMultiLangTextConf( "ID_VIP_AUTO_SUPPLY_PER_DAY", lang=lang) % (autoSupplyCount / 10000) mail_system.sendSystemMail(userId, mail_system.MailRewardType.SystemReward, rewards, message) if ftlog.is_debug(): ftlog.debug("vipAutoSupplyPerDay", userId, vipLevel, autoSupplyCount, chips, key, autoSupplyCount - chips)
def loadRecord(cls, gameId, userId, matchId): try: jstr = gamedata.getGameAttr(userId, gameId, cls.__buildField(matchId)) if ftlog.is_debug(): ftlog.debug("MatchRecord.loadRecord gameId=", gameId, "userId=", userId, "matchId=", matchId, "data=", jstr, caller=cls) if jstr: return MatchRecord.Record.fromDict(json.loads(jstr)) except: ftlog.exception() vip = hallvip.userVipSystem.getUserVip(userId).vipLevel.level key = "initLuckyValue:%d" % int(matchId) initVal = config.getVipConf(vip).get(key, 10000) if ftlog.is_debug(): ftlog.debug("loadRecord, default value !", "userId =", userId, "key =", key, "vip =", vip, "initVal", initVal) return MatchRecord.Record(0, 0, 0, 0, 0, initVal, [])
def sendFishVipInfo(userId): """ 发送VIP特权信息 """ userVip = hallvip.userVipSystem.getUserVip(userId) vipLevelObj = userVip.vipLevel vipGiftBought = gamedata.getGameAttrJson(userId, FISH_GAMEID, GameData.vipGiftBought, []) lang = util.getLanguage(userId) levels = [] for level in sorted(map(int, config.getVipConf().keys())): if level == 0 or (vipLevelObj.level <= 6 and level > 8): continue vipConf = config.getVipConf(level) vip = {} vip["level"] = vipConf["vipLv"] # vip["desc"] = vipConf["vipDesc"] vip["desc"] = config.getMultiLangTextConf(vipConf["vipDesc"], lang=lang) vip["name"] = config.getMultiLangTextConf(vipConf["giftName"], lang=lang) vip["productId"] = vipConf["productId"] vip["originalPrice"] = vipConf["originalPrice"] vip["price"] = vipConf["price"] vip["bought"] = 1 if vipConf["vipLv"] in vipGiftBought else 0 vip["gift"] = vipConf["vipGift"] vip["canSetVipShow"] = vipConf.get("setVipShow", 0) levels.append(vip) totalExp = vipLevelObj.nextVipLevel.vipExp if vipLevelObj.nextVipLevel else vipLevelObj.vipExp mo = MsgPack() mo.setCmd("fish_vip_info") mo.setResult("gameId", FISH_GAMEID) mo.setResult("userId", userId) mo.setResult("vipLevel", vipLevelObj.level) mo.setResult("exp", [userVip.vipExp, totalExp]) mo.setResult("levels", levels) mo.setResult("showVip", util.isVipShow(userId)) vipConf = config.getVipConf(vipLevelObj.level) mo.setResult("convert1137ToDRate", vipConf.get("convert1137ToDRate", 1)) mo.setResult("convert1429ToDRate", vipConf.get("convert1429ToDRate", 0)) mo.setResult("convert1430ToDRate", vipConf.get("convert1430ToDRate", 0)) mo.setResult("convert1431ToDRate", vipConf.get("convert1431ToDRate", 0)) router.sendToUser(mo, userId)
def sendGrandPrixInfo(self): """ 发送大奖赛信息 大奖赛相关信息(进入渔场后服务器主动推送) """ if not grand_prix.isGrandPrixOpenTime(): # 是否为大奖赛开放时段 00:00 —— 23:00 self._resetGrandPrixData() self._freeTimes = 0 # 免费次数 weakdata.setDayFishData(self.userId, WeakData.grandPrix_getPointsInfo, json.dumps([])) weakdata.setDayFishData(self.userId, WeakData.grandPrix_freeTimes, self._freeTimes) if ftlog.is_debug(): ftlog.debug("sendGrandPrixInfo", self.grandPrixStartTS, self.isGrandPrixMode()) signUpState = 1 if self.isGrandPrixMode() else 0 # 是否已经报名 remainFreeTimes = config.getVipConf(self.vipLevel).get( "grandPrixFreeTimes", 0) - self._freeTimes # 剩余免费次数 openTime = "-".join(config.getGrandPrixConf("openTimeRange")) # 时间范围 mo = MsgPack() mo.setCmd("grand_prix_info") mo.setResult("gameId", FISH_GAMEID) mo.setResult("userId", self.userId) mo.setResult("seatId", self.seatId) mo.setResult("remainFreeTimes", remainFreeTimes) mo.setResult("fee", config.getGrandPrixConf("fee")) # 报名费 mo.setResult("openTime", openTime) # 00:00 - 23:00 mo.setResult( "isInOpenTime", 1 if grand_prix.isGrandPrixOpenTime() else 0) # 大奖在是否在开放时间段 mo.setResult("signUpState", signUpState) # 是否已报名大奖赛 mo.setResult( "todayRankType", RankType.TodayGrandPrix) # 今日榜Type,使用fish_ranking获取排行榜数据,下同 mo.setResult("todayDate", util.timestampToStr(int(time.time()), "%m/%d")) # 今日榜时间 mo.setResult("yesterdayRankType", RankType.LastGrandPrix) mo.setResult("yesterdayDate", util.timestampToStr(int(time.time() - 86400), "%m/%d")) mo.setResult( "des", config.getMultiLangTextConf( config.getGrandPrixConf("info").get("des"), lang=self.lang)) # 每日积分超过2400送100珍珠,今日榜单每10分钟刷新1次,最终排名00:00公布 mo.setResult("pointsInfo", grand_prix.getPointInfo( self.userId)) # 奖励积分 道具Id、道具数量、是否领取了奖励0|1 mo.setResult("todayMaxPoints", weakdata.getDayFishData(self.userId, WeakData.grandPrix_point, 0)) # 今日最高积分 GameMsg.sendMsg(mo, self.userId) if ftlog.is_debug(): ftlog.debug("FishGrandPrixPlayer, userId =", self.userId, "mo =", mo)
def getMatchVipAddition(userId, vipLevel=None): """ 获取回馈赛VIP积分加成 """ vipConf = config.getVipConf() vipLevel = vipLevel or hallvip.userVipSystem.getUserVip( userId).vipLevel.level if vipLevel > len(vipConf.keys()) - 1: vipLevel = len(vipConf.keys()) - 1 matchAddition = vipConf.get(str(vipLevel), {}).get("matchAddition", 0) return matchAddition
def addUserLuckyValue(userId, productId, rmbs): """ 增加用户比赛场幸运值 """ # 玩家每充值1元,所有比赛场的幸运值加0.5 from newfish.entity.match_record import MatchRecord vip = hallvip.userVipSystem.getUserVip(userId).vipLevel.level for roomId in [44101, 44102, 44103, 44104]: key = "initLuckyValue:%d" % int(roomId) initVal = config.getVipConf(vip).get(key, 10000) record = MatchRecord.loadRecord(FISH_GAMEID, userId, roomId) record.luckyValue = min(record.luckyValue + int(0.5 * rmbs), initVal) MatchRecord.saveRecord(FISH_GAMEID, userId, roomId, record)
def _calcuCatchFishGrandPrixPoint(self, fishPoint, gunX): """ 计算捕鱼积分 炮倍和vip的加成 """ if ftlog.is_debug(): ftlog.debug('calcuCatchFishGrandPrixPoint', fishPoint, gunX) vipAddition = config.getVipConf(self.vipLevel).get( "grandPrixAddition", 0.) gunXAddition = self.getGunXAddition(gunX) if ftlog.is_debug(): ftlog.debug('calcuCatchFishGrandPrixPoint1', vipAddition, gunXAddition) point = fishPoint * 100 points = point * (1 + vipAddition) * (1 + gunXAddition) return int(points)
def sendGrandPrixInfo(userId): """ 发送大奖赛信息 """ if not isGrandPrixOpenTime(): grandPrixStartTS = 0 grandPrixFireCount = 0 grandPrixTargetFish = {} grandPrixUseSkillTimes = [] grandPrixFishPoint = 0 # grandPrixLevelFpMultiple = [] getPointsInfo = [] todayMaxPoints = 0 freeTimes = 0 saveGrandPrixData(userId, grandPrixStartTS, grandPrixFireCount, grandPrixFishPoint, grandPrixUseSkillTimes, grandPrixTargetFish, getPointsInfo, todayMaxPoints, freeTimes) vipLevel = util.getVipRealLevel(userId) # 大奖赛剩余免费次数 remainFreeTimes = config.getVipConf(vipLevel).get( "grandPrixFreeTimes", 0) - weakdata.getDayFishData( userId, WeakData.grandPrix_freeTimes, 0) mo = MsgPack() mo.setCmd("grand_prix_info") mo.setResult("gameId", FISH_GAMEID) mo.setResult("userId", userId) mo.setResult("remainFreeTimes", remainFreeTimes) mo.setResult("fee", config.getGrandPrixConf("fee")) mo.setResult("openTime", "-".join(config.getGrandPrixConf("openTimeRange"))) mo.setResult("isInOpenTime", 1 if isGrandPrixOpenTime() else 0) mo.setResult( "signUpState", 1 if weakdata.getDayFishData(userId, WeakData.grandPrix_startTS, 0) > 0 else 0) mo.setResult("todayRankType", RankType.TodayGrandPrix) mo.setResult("todayDate", util.timestampToStr(int(time.time()), "%m/%d")) mo.setResult("yesterdayRankType", RankType.LastGrandPrix) mo.setResult("yesterdayDate", util.timestampToStr(int(time.time() - 86400), "%m/%d")) mo.setResult("pointsInfo", getPointInfo(userId)) # 奖励积分 道具Id、道具数量、是否领取了奖励0|1 mo.setResult("todayMaxPoints", weakdata.getDayFishData(userId, WeakData.grandPrix_point, 0)) # 今日最高积分 router.sendToUser(mo, userId)
def _isCanReceiveFromOther(otherUserId, kindId): """ 检查是否可以接收他人赠送招财珠 """ from newfish.entity.config import SILVER_BULLET_KINDID, GOLD_BULLET_KINDID if kindId in [SILVER_BULLET_KINDID, GOLD_BULLET_KINDID]: silverBulletKey = WeakData.vipReceiveCount % SILVER_BULLET_KINDID if userdata.checkUserData(otherUserId): vipLevel = util.getVipRealLevel(otherUserId) dayReceiveCount = weakdata.getDayFishData(otherUserId, silverBulletKey, 0) dayLimitCount = config.getVipConf(vipLevel).get(silverBulletKey, 0) leftReceiveCount = dayLimitCount - dayReceiveCount if leftReceiveCount > 0 and not util.isProtectionLimit(otherUserId): if kindId == GOLD_BULLET_KINDID: leftReceiveCount = leftReceiveCount // 5 return 0, leftReceiveCount # 可以接受赠送 else: return 1, 0 # 不可以接受赠送 return 0, 99999
def finishCheckin(userId, rewards=None, checkinDay=None, ts=None): """ 完成签到 """ # if not rewards or not checkinDay: # kindId, rewards, checkinDay = getTodayCheckinRewards(userId) # if checkinDay: # gamedata.setGameAttr(userId, FISH_GAMEID, GameData.checkinDay, checkinDay) # weakdata.setDayFishData(userId, "isCheckin", 1) # module_tip.resetModuleTipEvent(userId, "checkin") # from newfish.game import TGFish # from newfish.entity.event import CheckinEvent # event = CheckinEvent(userId, FISH_GAMEID, checkinDay, rewards) # TGFish.getEventBus().publishEvent(event) ts = ts or int(time.time()) if not rewards or not checkinDay: checkinDay, rewards, _ = getTodayCheckinRewards(userId) if checkinDay: _isCheckContinuousBreak(userId, ts) gamedata.setGameAttr(userId, FISH_GAMEID, GameData.continuousCheckinDayTS, util.getDayStartTimestamp(int(ts)) + 86400) weakdata.setDayFishData(userId, "isCheckin", 1) module_tip.resetModuleTipEvent(userId, "checkin") vipLevel = util.getVipRealLevel(userId) # 注册当天签到不增加充值奖池. registTime = gamedata.getGameAttrInt(userId, FISH_GAMEID, GameData.registTime) if util.getDayStartTimestamp(int( time.time())) > util.getDayStartTimestamp(registTime): util.increaseExtraRechargeBonus( userId, config.getVipConf(vipLevel).get("checkinRechargeBonus", 0)) from newfish.game import TGFish from newfish.entity.event import CheckinEvent event = CheckinEvent(userId, FISH_GAMEID, checkinDay, rewards) TGFish.getEventBus().publishEvent(event)
def grandPrixEnterRoom(cls, userId): """ 大奖赛房间能否进入 """ startDay = config.getGrandPrixConf("info").get("startDay") currentTime = int(time.time()) if startDay and currentTime < util.getTimestampFromStr(startDay): return cls.ENTER_ROOM_REASON_NOT_OPEN if weakdata.getDayFishData(userId, WeakData.grandPrix_startTS, 0) == 0: dayStartTimestamp = util.getDayStartTimestamp(currentTime) remainGrandPrixTimeSeconds = util.timeStrToInt( config.getGrandPrixConf("openTimeRange")[1]) - ( currentTime - dayStartTimestamp) # 大奖赛剩余时间 if not grand_prix.isGrandPrixOpenTime( ) or remainGrandPrixTimeSeconds < 10: return cls.ENTER_ROOM_REASON_GRAND_PRIX_NOE_OPEN vipLevel = hallvip.userVipSystem.getUserVip(userId).vipLevel.level if config.getVipConf(vipLevel).get("grandPrixFreeTimes", 0) <= \ weakdata.getDayFishData(userId, WeakData.grandPrix_freeTimes, 0): # 用免费次数已经用完 fee = config.getGrandPrixConf("fee")[0] surplusCount = util.balanceItem(userId, fee["name"]) if surplusCount < fee["count"]: return cls.ENTER_ROOM_REASON_GRAND_PRIX_LESS_FEES return cls.ENTER_ROOM_REASON_OK
def startGrandPrix(self): """ 大奖赛开始 grandPrixStartTS=0 报名大奖赛/ grandPrixStartTS > 0 直接进入渔场 """ curTime = int(time.time()) dayStartTimestamp = util.getDayStartTimestamp(curTime) remainGrandPrixTimeSeconds = util.timeStrToInt( config.getGrandPrixConf("openTimeRange")[1]) - ( curTime - dayStartTimestamp) # 大奖赛剩余时间 # 当局进入大奖赛 if self.grandPrixStartTS == 0: event = JoinGrandPrixEvent(self.userId, FISH_GAMEID, self.table.bigRoomId) # 参加大奖赛事件 TGFish.getEventBus().publishEvent(event) # 距离大奖赛结束不足10秒不可参赛 if not grand_prix.isGrandPrixOpenTime( ) or remainGrandPrixTimeSeconds < 10: code = SignupCode.SC_NOT_OPEN elif config.getVipConf(self.vipLevel).get( "grandPrixFreeTimes", 0) > self._freeTimes: # 用免费次数报名 self._freeTimes = weakdata.incrDayFishData( self.userId, WeakData.grandPrix_freeTimes, 1) code = SignupCode.SC_SUCC else: # 扣除报名费 fee = config.getGrandPrixConf("fee")[0] _consume = [{ "name": fee.get("name"), "count": fee.get("count") }] _ret = util.consumeItems(self.userId, _consume, "ITEM_USE", self.table.roomId) if _ret: code = SignupCode.SC_SUCC else: code = SignupCode.SC_FEE_NOT_ENOUGH if code == SignupCode.SC_SUCC: # 选择目标鱼 for _val in config.getGrandPrixConf( "group").values(): # 1、2、3个组 idx = random.randint(0, len(_val) - 1) # 一组鱼 _cnt = config.getGrandPrixConf("target").get( str(_val[idx]), {}).get("count", 999) # 某一种鱼 捕获数量 _point = config.getGrandPrixConf("target").get( str(_val[idx]), {}).get("point", 0) # 某一种鱼 获得的积分 self.grandPrixTargetFish[str( _val[idx])] = [0, _cnt, _point] # 备份技能数据. self.grandPrixUseSkillTimes = [] for i in range(skill_system.MAX_INSTALL_NUM - 1): self.grandPrixUseSkillTimes.append({ "skillId": 0, "state": 0, "star": 0, "grade": 0, "count": config.getGrandPrixConf("fireCount")[1], # 技能使用次数3 "skillType": 0 if i < skill_system.MAX_INSTALL_NUM else 1 # 0主技能 1辅助技能 }) for idx, _skillId in enumerate(self.skillSlots): _skill = self.getSkill(_skillId, 0) self.grandPrixUseSkillTimes[idx]["skillId"] = _skillId self.grandPrixUseSkillTimes[idx][ "state"] = _skill.skillState self.grandPrixUseSkillTimes[idx]["star"] = _skill.skillStar self.grandPrixUseSkillTimes[idx][ "grade"] = _skill.skillGrade if self.inGameTimes: bireport.reportGameEvent("BI_NFISH_GRAND_PRIX_INGAMETIMES", self.userId, FISH_GAMEID, 0, 0, self.grandPrixStartTS, self.inGameTimes, 0, 0, [], util.getClientId(self.userId)) self.inGameTimes = 0 self.grandPrixFishPoint = 0 self.grandPrixSurpassCount = 0 self.grandPrixStartTS = curTime # 大奖赛开始的时间戳 self.grandPrixFireCount = config.getGrandPrixConf( "fireCount")[0] self._saveGrandPrixData() # 保存大奖赛数据 else: if not grand_prix.isGrandPrixOpenTime(): # 现在不可参赛 code = SignupCode.SC_NOT_OPEN elif not self.isGrandPrixMode(): code = SignupCode.SC_SUCC else: code = SignupCode.SC_UNFINISH if code in [SignupCode.SC_SUCC, SignupCode.SC_UNFINISH]: interval = max(0.1, remainGrandPrixTimeSeconds) if self.grandPrixFireCount == 0: # 3秒之后结束大奖赛 interval = 0.1 if self.grandPrixEndTimer: self.grandPrixEndTimer.cancel() self.grandPrixEndTimer = None self.grandPrixEndTimer = FTLoopTimer(interval, 0, self.endGrandPrix) # 启动结束定时器 self.grandPrixEndTimer.start() # 取消处于使用中的技能,以免干扰技能使用次数计数 if self.offline == 0: # 玩家在线 self.cancelUsingSkills() self.unloadSkills() self.loadAllSkillData() self.syncSkillSlots() elif code == SignupCode.SC_NOT_OPEN: # 没开启 self._resetGrandPrixData() # 重置大奖赛相关数据 self._getSurpassTarget() # 获取要超越的玩家数据 mo = MsgPack() mo.setCmd("start_grand_prix") mo.setResult("gameId", FISH_GAMEID) mo.setResult("userId", self.userId) mo.setResult("seatId", self.seatId) mo.setResult("fireCount", self.grandPrixFireCount) mo.setResult("fishPoint", self.grandPrixFishPoint) mo.setResult("targetFish", self.grandPrixTargetFish) mo.setResult( "useSkillTimes", { val.get("skillId", 0): val.get("count", 0) for val in self.grandPrixUseSkillTimes }) mo.setResult("pointsInfo", grand_prix.getPointInfo( self.userId)) # 奖励积分 道具Id、道具数量、是否领取了奖励0|1 mo.setResult("todayMaxPoints", weakdata.getDayFishData(self.userId, WeakData.grandPrix_point, 0)) # 今日最高积分 GameMsg.sendMsg(mo, self.userId)
def buyFishVipGift(userId, level, clientId, buyType=None, itemId=0): """ 购买特定VIP等级的礼包 """ mo = MsgPack() mo.setCmd("buy_fish_vip_gift") mo.setResult("gameId", FISH_GAMEID) mo.setResult("userId", userId) mo.setResult("level", level) vipLevel = hallvip.userVipSystem.getUserVip(userId).vipLevel.level vipGiftBought = gamedata.getGameAttrJson(userId, FISH_GAMEID, GameData.vipGiftBought, []) code = 1 commonRewards = [] chestRewards = [] buyType = buyType if buyType else config.BT_DIAMOND from newfish.entity import store from newfish.entity.gun import gun_system if vipLevel < level or level in vipGiftBought: mo.setResult("code", code) router.sendToUser(mo, userId) return vipConf = config.getVipConf(level) if vipConf: price = vipConf["price"] vipGiftRewards = vipConf["vipGift"] price, isSucc = store.getUseRebateItemPrice(userId, itemId, price, buyType, vipConf["productId"], clientId) # 满减券之后的钻石 满减券 consumeCount = 0 if price > 0 and isSucc: store.autoConvertVoucherToDiamond(userId, price) # 代购券 consumeCount, final = userchip.incrDiamond( userId, FISH_GAMEID, -abs(price), 0, "BI_NFISH_BUY_ITEM_CONSUME", int(config.DIAMOND_KINDID), util.getClientId(userId), param01=vipConf["productId"]) if not isSucc or abs(consumeCount) != price: code = 2 else: eventId = "BI_NFISH_BUY_ITEM_GAIN" for item in vipGiftRewards: if item["type"] == 1: # 宝箱 chestId = item["name"] from newfish.entity.chest import chest_system rewards = chest_system.getChestRewards(userId, chestId) code = chest_system.deliveryChestRewards( userId, chestId, rewards, eventId) chestRewards.extend(rewards) elif item["type"] == 2: # 等级 from newfish.entity.gift.gift_system import _makeUserLevelUp _makeUserLevelUp(userId, item["count"]) code = 0 elif item["type"] == 3: # 资产/道具 rewards = [{"name": item["name"], "count": item["count"]}] code = util.addRewards(userId, rewards, eventId, int(level), param01=int(level)) commonRewards.extend(rewards) elif item["type"] == 5: # 皮肤炮皮肤 skinId = item["name"] ret = gun_system.addEquipGunSkinSkin( userId, skinId, clientId) if ret: code = 0 rewards = [{ "name": item["name"], "count": item["count"], "type": item["type"] }] commonRewards.extend(rewards) elif item["type"] == 6: # 直升炮台 upToLevel = item["count"] success = gun_system.upgradeGun(userId, False, MULTIPLE_MODE, byGift=True, upToLevel=upToLevel) if success: code = 0 vipGiftBought.append(level) gamedata.setGameAttr(userId, FISH_GAMEID, GameData.vipGiftBought, json.dumps(vipGiftBought)) if code == 0: mo.setResult("rewards", vipGiftRewards) mo.setResult("code", code) router.sendToUser(mo, userId)
def loginGame(userId, gameId, clientId, iscreate, isdayfirst): """ 用户登录一个游戏, 游戏自己做一些其他的业务或数据处理 """ if ftlog.is_debug(): ftlog.debug("userId =", userId, "gameId =", gameId, "clientId =", clientId, "iscreate =", iscreate, "isdayfirst =", isdayfirst, gdata.name()) gamedata.setnxGameAttr(userId, FISH_GAMEID, GameData.gunLevel_m, 2101) if isdayfirst: sendVipSpringFestivalRewards(userId) if isdayfirst: vipAutoSupplyPerDay(userId) if isdayfirst: from newfish.entity.quest import daily_quest from newfish.entity import weakdata resetTime = weakdata.getDayFishData(userId, "resetTime") if not resetTime: weakdata.setDayFishData(userId, "resetTime", int(time.time())) daily_quest.refreshDailyQuestData(userId) # FTLoopTimer(1, 0, util.doSendFishNotice, userId).start() gamedata.setnxGameAttr(userId, FISH_GAMEID, GameData.vipShow, 1) serverVersion = gamedata.getGameAttrInt(userId, gameId, GameData.serverVersion) if isdayfirst and gamedata.getGameAttr( userId, FISH_GAMEID, GameData.hasBoughtMonthCard) is None: from hall.entity import hallitem userBag = hallitem.itemSystem.loadUserAssets(userId).getUserBag() item = userBag.getItemByKindId(config.PERMANENT_MONTH_CARD_KINDID) or \ userBag.getItemByKindId(config.MONTH_CARD_KINDID) bought = 1 if item else 0 gamedata.setGameAttr(userId, FISH_GAMEID, GameData.hasBoughtMonthCard, json.dumps(bought)) if serverVersion and serverVersion <= 20180907: # 珍珠数量调整 util.adjustPearlCount(userId) if serverVersion and serverVersion <= 20180918: # 老玩家屏蔽10元话费卡兑换 gamedata.setGameAttr(userId, gameId, GameData.exchangeCount, 1) if serverVersion and serverVersion <= 20180928: # 老玩家金猪出现次数数据迁移 from newfish.entity import share_system from newfish.entity.share_system import FlyingPig shareClass = FlyingPig(userId) flyPigFinishCount = shareClass.shareData[ share_system.INDEX_FINISH_COUNT] gamedata.incrGameAttr(userId, FISH_GAMEID, GameData.flyPigFinishCount, flyPigFinishCount) # 清理金币购买记录,19/12/25日0点后开始检测 if int(time.time()) >= util.getTimestampFromStr("2019-12-25 00:00:00") and \ not gamedata.getGameAttrInt(userId, gameId, "resetBuyCoinCount"): gamedata.delGameAttr(userId, FISH_GAMEID, GameData.buyCoinCount) gamedata.setGameAttr(userId, gameId, "resetBuyCoinCount", 1) if not serverVersion or int(serverVersion) != SERVER_VERSION: gamedata.setGameAttr(userId, gameId, GameData.serverVersion, SERVER_VERSION) if not util.isFinishAllNewbieTask(userId): # 没完成所有新手引导,不主动弹出每日签到和最新消息 return # 限定玩家比赛幸运值. from newfish.entity.match_record import MatchRecord vip = hallvip.userVipSystem.getUserVip(userId).vipLevel.level for roomId in [44102]: key = "initLuckyValue:%d" % int(roomId) initVal = config.getVipConf(vip).get(key, 10000) record = MatchRecord.loadRecord(FISH_GAMEID, userId, roomId) record.luckyValue = min(record.luckyValue, initVal) MatchRecord.saveRecord(FISH_GAMEID, userId, roomId, record)