@Override public BeatmapMeta loadBeatmap(int beatmapid, final long mods, Language lang) throws SQLException, IOException, UserException { OsuApiBeatmap beatmap = getBeatmap(beatmapid); BeatmapWithMods entry = new BeatmapWithMods(beatmapid, mods); FakePercentageEstimates estimates = database.estimates.get(entry); if (estimates == null) { double pp = Math.pow(2, beatmap.getStarDifficulty()) * 8; if (Mods.DoubleTime.is(mods)) { pp *= 2.5; } if (Mods.HardRock.is(mods)) { pp *= 1.3; } if (Mods.Hidden.is(mods)) { pp *= 1.1; } final double fPp = pp; estimates = new FakePercentageEstimates(mods, fPp); } return new BeatmapMeta(beatmap, null, estimates); }
public OsuApiBeatmap getBeatmap(int beatmapid) { Random rand = new Random(beatmapid); OsuApiBeatmap beatmap = database.beatmaps.get(beatmapid); if (beatmap == null) { beatmap = new OsuApiBeatmap(); beatmap.setBeatmapId(beatmapid); if (setIds.containsKey(beatmapid)) { beatmap.setSetId(setIds.get(beatmapid)); } { // ARTIST String[] artists = {"Hatsune Miku", "IOSYS", "Nightcore", "DragonForce", "ClariS"}; beatmap.setArtist(artists[beatmapid % artists.length]); } beatmap.setTitle("Beatmap " + beatmapid); { // VERSION AND DIFFICULTY String[] versions = {"Easy", "Normal", "Hard", "Hyper", "Insane", "Another", "Extra"}; int diff = beatmapid % versions.length; beatmap.setVersion(versions[diff]); beatmap.setStarDifficulty(diff + rand.nextDouble()); beatmap.setTotalLength((int) (30 + Math.pow(rand.nextDouble(), 3) * 600)); beatmap.setApproachRate(5 + Math.min(4, diff) + (int) (rand.nextDouble() + .5)); beatmap.setCircleSize(diff + 1); beatmap.setBpm(50 * Math.pow(2, diff * .4 + rand.nextDouble())); } } return beatmap; }