Greasy Fork is available in English.
Checks if feeding a kad was successful and logs the results to pass through a Discord webhook.
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/485575/1330924/%5BGC%5D%20-%20Kadoatery%20Details%20Helper.js
// ==UserScript==
// @name [GC] - Kadoatery Details Helper
// @namespace http://greasyfork.icu/en/users/1225524-kaitlin
// @match https://www.grundos.cafe/games/kadoatery/feed_kadoatie/*
// @version 1.4.6
// @author Cupkait
// @license MIT
// @description Checks if feeding a kad was successful and logs the results to pass through a Discord webhook.
// ==/UserScript==
function GrabKadoatieDetails() {
const errorPage = $('.errorpage');
if (errorPage.length > 0) {
const errorText = errorPage.text();
if (errorText.includes("has already been fed")) {
console.log(
'Too slow, someone else got to that kad first.');
} else if (errorText.includes("wait a bit")) {
console.log('You already fed a kad, try again later.');
}
} else {
const elementOne = $('.center p').eq(0);
const elementTwo = $('.center p').eq(1);
const elementThree = $('.center p').eq(2);
const kadType = $('.center p').eq(3);
const elementFive = $('.center p').eq(4);
const userName = /user=(.*?)"/g.exec(document.body.innerHTML)[
1];
const kadImage = elementTwo.find('img').eq(0).attr('src');
const kadName = elementOne.find('b').eq(0).text();
const kadBlurb = elementTwo.find('strong').eq(0).text();
const kadPaint = kadImage.split('/').pop().replace(
'_happy.gif', '');
let relicStatus = false;
let kadCount = kadType.find('strong').eq(0).text();
if (kadType.text().includes("particularly grateful")) {
kadCount = elementFive.find('strong').eq(0).text();
console.log(
`${userName} fed ${kadName} the ${kadPaint} Kadoatie as number ${kadCount} and got a relic!`
);
relicStatus = true;
} else {
console.log(
`${userName} fed ${kadName} the ${kadPaint} Kadoatie as number ${kadCount}!`
);
}
const colorMapping = {
blue: "8758759",
green: "10933110",
island: "987592",
pink: "16751565",
rainbow: "13197820",
spotted: "15842854",
white: "14608883",
yellow: "16777063"
};
const barColor = colorMapping[kadPaint.toLowerCase()] ||
"#FFFFFF"; // Default to white if not found
return {
userName,
kadName,
kadImage,
kadBlurb,
kadPaint,
kadCount,
relicStatus,
barColor
};
}
}