florr.io | Petal farming progress counter

Petal farming progress counter

目前为 2023-11-15 提交的版本。查看 最新版本

// ==UserScript==
// @name         florr.io | Petal farming progress counter
// @namespace    Furaken
// @version      1.0.3
// @description  Petal farming progress counter
// @author       Furaken
// @match        https://florr.io/*
// @grant        unsafeWindow
// @license      MIT
// @require      https://unpkg.com/[email protected]/umd/string-similarity.min.js
// ==/UserScript==

var basic = 4155201 - 8, // DO NOT MODIFY
    aim = 5,
    petal = "Common Basic",
    rarityArr = [
        "Common",
        "Unusual",
        "Rare",
        "Epic",
        "Legendary",
        "Mythic",
        "Ultra",
        "Super"
    ],
    petalArr = [
        "Basic",
        "Light",
        "Rock",
        "Square",
        "Rose",
        "Stinger",
        "Iris",
        "Wing",
        "Missile",
        "Grapes",
        "Cactus",
        "Faster",
        "Bubble",
        "Pollen",
        "Dandelion",
        "Beetle Egg",
        "Antennae",
        "Heavy",
        "Yin Yang",
        "Web",
        "Honey",
        "Leaf",
        "Salt",
        "Rice",
        "Corn",
        "Sand",
        "Pincer",
        "Yucca",
        "Magnet",
        "Yggdrasil",
        "Starfish",
        "Pearl",
        "Lightning",
        "Jelly",
        "Claw",
        "Shell",
        "Cutter",
        "Dahlia",
        "Uranium",
        "Sponge",
        "Soil",
        "Fangs",
        "Third Eye",
        "Peas",
        "Stick",
        "Clover",
        "Powder",
        "Air",
        "Basil",
        "Orange",
        "Ant Egg",
        "Poo",
        "Relic",
        "Lotus",
        "Bulb",
        "Cotton",
        "Carrot",
        "Bone",
        "Plank",
        "Tomato",
        "Mark",
        "Rubber",
        "Blood Stinger",
        "Bur",
        "Root",
        "Ankh",
    ],
    rarity,
    id

function getNewPetal() {
    if (petal.split(" ").length <= 0) return
    if (petal.split(" ").length == 1) {
        if (petal.startsWith("un")) rarity = "Unusual"
        else if (petal.startsWith("r")) rarity = "Rare"
        else if (petal.startsWith("e")) rarity = "Epic"
        else if (petal.startsWith("l")) rarity = "Legendary"
        else if (petal.startsWith("m")) rarity = "Mythic"
        else if (petal.startsWith("u")) rarity = "Ultra"
        else if (petal.startsWith("s")) rarity = "Super"
        else rarity = "Common"
        id = stringSimilarity.findBestMatch(petal.slice(1), petalArr)
        petal = rarity + " " + id.bestMatch.target
        rarity = rarityArr.indexOf(rarity)
    } else {
        rarity = stringSimilarity.findBestMatch(petal.split(" ").shift(), rarityArr)
        id = stringSimilarity.findBestMatch(petal.split(" ").splice(1).join(" "), petalArr)
        petal = rarity.bestMatch.target + " " + id.bestMatch.target
        rarity = rarity.bestMatchIndex
    }
    id = id.bestMatchIndex + 1
}
getNewPetal()

var obj = {
    rarity: rarity,
    id: id,
    aim: aim
}

if (localStorage.getItem('petalFarmingCounter') == null) localStorage.setItem('petalFarmingCounter', JSON.stringify(obj))
else {
    obj = JSON.parse(localStorage.getItem('petalFarmingCounter'))
}
rarity = obj.rarity
id = obj.id
aim = obj.aim
petal = rarityArr[rarity] + " " + petalArr[id - 1]
getNewPetal()

function convertNumber(value) {
    return Math.abs(Number(value)) >= 1.0e+9
        ? (Math.abs(Number(value)) / 1.0e+9).toFixed(2) + "B"
    : Math.abs(Number(value)) >= 1.0e+6
        ? (Math.abs(Number(value)) / 1.0e+6).toFixed(2) + "M"
    : Math.abs(Number(value)) >= 1.0e+3
        ? (Math.abs(Number(value)) / 1.0e+3).toFixed(2) + "K"
    : Math.abs(Number(value))
}

aim = Math.abs(Math.floor(aim))
aim = aim == 0 ? 1 : aim

var container = document.createElement("div")
container.style = `
    padding: 5px;
    height: 24px;
    width: 300px;
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: #333333;
    border-radius: 100px;
    transition: all 1s ease-in-out;
    opacity: 1;
    box-shadow: 5px 5px rgba(0, 0, 0, 0.3);
`
document.querySelector('body').appendChild(container)

var petalName = document.createElement("div")
petalName.style = `
    top: 50%;
    left: 50%;
    transform: translate(-50%, -230%);
    position: absolute;
    width: 100%;
    color: white;
    font-family: 'Ubuntu';
    text-align: center;
    transition: all 1s ease-in-out;
    text-wrap: nowrap;
    cursor: pointer;
    text-shadow: rgb(0 0 0) 2px 0px 0px, rgb(0 0 0) 1.75517px 0.958851px 0px, rgb(0 0 0) 1.0806px 1.68294px 0px, rgb(0 0 0) 0.141474px 1.99499px 0px, rgb(0 0 0) -0.832294px 1.81859px 0px, rgb(0 0 0) -1.60229px 1.19694px 0px, rgb(0 0 0) -1.97998px 0.28224px 0px, rgb(0 0 0) -1.87291px -0.701566px 0px, rgb(0 0 0) -1.30729px -1.5136px 0px, rgb(0 0 0) -0.421592px -1.95506px 0px, rgb(0 0 0) 0.567324px -1.91785px 0px, rgb(0 0 0) 1.41734px -1.41108px 0px, rgb(0 0 0) 1.92034px -0.558831px 0px;
`
petalName.innerHTML = petal
petalName.onclick = function() {
    petal = prompt('Petal name?', petal)
    if (petal == null) return
    aim = prompt('Aim?', aim)
    if (aim == null) return
    if (isNaN(aim)) return
    aim = Math.abs(Math.floor(aim))
    aim = aim == 0 ? 1 : aim
    getNewPetal()
    petalName.innerHTML = petal
    updateProgress()
    var obj = {
        rarity: rarity,
        id: id,
        aim: aim
    }
    localStorage.setItem('petalFarmingCounter', JSON.stringify(obj))
}
container.appendChild(petalName)

var barText = document.createElement("div")
barText.style = `
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
    width: 100%;
    color: white;
    font-family: 'Ubuntu';
    text-align: center;
    transition: all 1s ease-in-out;
    text-wrap: nowrap;
    z-index: 1;
    pointer-events: none;
    text-shadow: rgb(0 0 0) 2px 0px 0px, rgb(0 0 0) 1.75517px 0.958851px 0px, rgb(0 0 0) 1.0806px 1.68294px 0px, rgb(0 0 0) 0.141474px 1.99499px 0px, rgb(0 0 0) -0.832294px 1.81859px 0px, rgb(0 0 0) -1.60229px 1.19694px 0px, rgb(0 0 0) -1.97998px 0.28224px 0px, rgb(0 0 0) -1.87291px -0.701566px 0px, rgb(0 0 0) -1.30729px -1.5136px 0px, rgb(0 0 0) -0.421592px -1.95506px 0px, rgb(0 0 0) 0.567324px -1.91785px 0px, rgb(0 0 0) 1.41734px -1.41108px 0px, rgb(0 0 0) 1.92034px -0.558831px 0px;
`
container.appendChild(barText)

var barProgress = document.createElement("div")
barProgress.style = `
    background: #F5FF65;
    border-radius: 100px;
    width: 0px;
    max-width: 300px;
    max-height: 24px;
    transition: all 1s ease-in-out;
    opacity: 0;
    height: 0px;
    top: 50%;
    position: absolute;
    transform: translate(0px, -50%);
    pointer-events: none;
`
container.appendChild(barProgress)
barText.innerHTML = `0 / ${convertNumber(aim)} (0.00%)`
var thisPetal, thisWidth
function updateProgress() {
    thisPetal = unsafeWindow.Module.HEAPU32[basic+(id*8)-(8-rarity)]
    thisWidth = container.style.width.slice(0, -2) * thisPetal / aim
    barProgress.style.height = thisWidth + "px"
    barProgress.style.width = thisWidth + "px"
    barProgress.style.opacity = thisPetal / (aim * 0.08)
    barText.innerHTML = `${convertNumber(thisPetal)} / ${convertNumber(aim)} (${(thisPetal * 100 / aim).toFixed(2)}%)`
}

setInterval(() => {
    updateProgress()
}, 10000)

document.documentElement.addEventListener("keydown", function (e) {
    if (event.keyCode == "187") container.style.opacity = container.style.opacity == '0' ? '1' : '0'
})

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址