IdlePixel+ AviusUiTweaks

IdlePixel+ Ui tweaks

目前為 2023-11-07 提交的版本,檢視 最新版本

作者
Avius Exquisitus
評價
0 0 0
版本
0.0.18
建立日期
2023-08-10
更新日期
2023-11-07
尺寸
7.2 KB
授權條款
MIT
腳本執行於

// ==UserScript==
// @name IdlePixel+ AviusUiTweaks
// @namespace com.avius.idlepixel.aviusuitweaks
// @version 0.0.19
// @description IdlePixel+ Ui tweaks
// @author Avius
// @license MIT
// @match *://idle-pixel.com/login/play*
// @grant none
// @require https://gf.qytechs.cn/scripts/441206-idlepixel/code/IdlePixel+.js
// ==/UserScript==

(function() {
'use strict';


class AviusUiTweaks extends IdlePixelPlusPlugin {
constructor() {
super("aviusuitweaks", {
about: {
name: GM_info.script.name,
version: GM_info.script.version,
author: GM_info.script.author,
description: GM_info.script.description
},
config: [
]
});
}

onLogin() {
$("head").append(`

`);

const makeBadge = function() {
const el = $(this);
el.addClass("avius-itembox");
el.append(`

`);
};

const cookingRows = $("#cooks_book-table").children("tbody").first().children("tr");
const cookingHeader = cookingRows.first();
cookingHeader.children("th").each(function(){
const el = $(this);
el.attr({
width: (parseInt(el.attr("width").replace("%","")) - 1).toString() + "%"
});
});
cookingHeader.append(`RATIOS`);

cookingRows.not(":eq(0)").each(function(){
const el = $(this);
el.width(el.width()-1);
el.append(`


- per h


- xp per h

`);
})

$(`#panel-brewing itembox`).each(makeBadge);
$(`#panel-gathering itembox`).each(makeBadge);
$(`#panel-fishing itembox`).each(makeBadge);

const first = $(`#panel-brewing itembox`).first();
$(`

`).insertBefore(first);
}

getCookingRows(){
return $("#cooks_book-table").children("tbody").first().children("tr[data-cooks_book-item]");
}

onPanelChanged(panelBefore, panelAfter) {
if(panelAfter == "brewing"){
let total = 0;
$(`#panel-${panelAfter} itembox`).each(function() {
const el = $(this);

const key = el.attr("data-tooltip");
const amount = Items.getItem(key);
const value = Brewing.get_xp_from_materials(key, amount);
const badge = el.find(".avius-badge");

if (value == 0){
badge.text("");
}else{
total += value;
badge.text(`${value}xp`);
}
});
$(".avius-brewing-xp-total").text(`Total ingredient xp: ${total}`)
} else if (panelAfter == "gathering"){
$(`#panel-${panelAfter} itembox`).each(function() {
const el = $(this);

const key = el.attr("data-item");
const amount = Items.getItem(key+"_total");
const badge = el.find(".avius-badge");

if (amount == 0){
badge.text("");
}else{
badge.text(amount);
}
});
} else if (panelAfter == "fishing"){
$(`#panel-${panelAfter} itembox`).each(function() {
const el = $(this);

const key = el.attr("data-item");
const energy = Cooking.ENERGY_MAP[key];
const heat = Cooking.FOOD_HEAT_REQ_MAP[key];

if(energy !== undefined && energy !== undefined
&& key.startsWith("raw_")){

const badge = el.find(".avius-badge");

const ratio = energy / heat;
const label = `${Math.trunc(ratio)} / `;
badge.html(label);
}


});
} else if (panelAfter == "cooking"){
const hasChefHat = Items.getItem("chefs_hat") === 1;
this.getCookingRows().each(function(){
const el = $(this);
const rows = el.children("td");
const energyEl = $(rows[4]);
const timeEl = $(rows[5]);
const xpEl = $(rows[6]);
const countEl = $(rows[7]);
const ratioRow = $(rows[8]);
const foodLabelEl = ratioRow.find(".avius-cooking-meta-food-ratio");
const xpLabelEl = ratioRow.find(".avius-cooking-meta-time-ratio");

let prepared = parseInt(countEl.text().trim().replaceAll(",",""));
let energy = parseInt(energyEl.text().trim().replaceAll(",",""));
let time = parseInt(timeEl.text().trim().replaceAll("h","").replaceAll(",",""));
let xp = parseInt(xpEl.text().trim().replaceAll(" xp","").replaceAll(",",""));

if(hasChefHat){
if(prepared >= 5)
time = time / 2;
if(prepared >= 10)
energy = energy * 2;
}

const energyRatio = energy / time;
const xpRatio = xp / time;

foodLabelEl.text(Math.trunc(energyRatio));
xpLabelEl.text(Math.trunc(xpRatio));
});
}
}
}

const plugin = new AviusUiTweaks();
IdlePixelPlus.registerPlugin(plugin);
})();

QingJ © 2025

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