mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-24 19:59:36 +00:00
Use chance to determine hat unlocks and add heart to menu title
This commit is contained in:
BIN
dist/extension.zip
vendored
BIN
dist/extension.zip
vendored
Binary file not shown.
30
dist/extension/birb.js
vendored
30
dist/extension/birb.js
vendored
@@ -2048,7 +2048,6 @@
|
|||||||
// Timing constants (in milliseconds)
|
// Timing constants (in milliseconds)
|
||||||
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
||||||
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 150;
|
const URL_CHECK_INTERVAL = 150;
|
||||||
const HOP_DELAY = 500;
|
const HOP_DELAY = 500;
|
||||||
@@ -2057,10 +2056,15 @@
|
|||||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||||
|
const HAT_CHANCE = 1 / 50; // Every 50 webpages
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
|
|
||||||
|
// Petting boosts
|
||||||
|
const PET_BOOST_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||||
const PET_FEATHER_BOOST = 2;
|
const PET_FEATHER_BOOST = 2;
|
||||||
|
const PET_HAT_BOOST = 1.5;
|
||||||
|
|
||||||
// Focus element constraints
|
// Focus element constraints
|
||||||
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
||||||
@@ -2311,7 +2315,8 @@
|
|||||||
// Currently being pet, don't open menu
|
// Currently being pet, don't open menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertMenu(menuItems, `${birdBirb().toLowerCase()}OS`, updateMenuLocation);
|
|
||||||
|
insertMenu(menuItems, `${isPetBoostActive() ? " " : ""}${birdBirb().toLowerCase()}OS${isPetBoostActive() ? " ❤" : ""}`, updateMenuLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
birbElement.addEventListener("mouseover", () => {
|
birbElement.addEventListener("mouseover", () => {
|
||||||
@@ -2340,9 +2345,10 @@
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const currentPath = getContext().getPath().split("?")[0];
|
const currentPath = getContext().getPath().split("?")[0];
|
||||||
if (currentPath !== lastPath) {
|
if (currentPath !== lastPath) {
|
||||||
log("Path changed, updating sticky notes: " + currentPath);
|
log("Path changed from '" + lastPath + "' to '" + currentPath + "'");
|
||||||
lastPath = currentPath;
|
lastPath = currentPath;
|
||||||
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
||||||
|
determineHatUnlock();
|
||||||
}
|
}
|
||||||
}, URL_CHECK_INTERVAL);
|
}, URL_CHECK_INTERVAL);
|
||||||
|
|
||||||
@@ -2350,8 +2356,16 @@
|
|||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
// TODO: This is for testing
|
determineHatUnlock();
|
||||||
insertHat();
|
}
|
||||||
|
|
||||||
|
function determineHatUnlock() {
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
insertHat();
|
||||||
|
} else if (location.hostname === "127.0.0.1") {
|
||||||
|
log("Inserting hat for debug purposes");
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
@@ -2385,7 +2399,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
// Double the chance of a feather if recently pet
|
||||||
const petMod = Date.now() - lastPetTimestamp < PET_BOOST_DURATION ? PET_FEATHER_BOOST : 1;
|
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
||||||
lastPetTimestamp = 0;
|
lastPetTimestamp = 0;
|
||||||
activateFeather();
|
activateFeather();
|
||||||
@@ -3048,6 +3062,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPetBoostActive() {
|
||||||
|
return Date.now() - lastPetTimestamp < PET_BOOST_DURATION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
|||||||
30
dist/obsidian/main.js
vendored
30
dist/obsidian/main.js
vendored
@@ -2091,7 +2091,6 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
// Timing constants (in milliseconds)
|
// Timing constants (in milliseconds)
|
||||||
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
||||||
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 150;
|
const URL_CHECK_INTERVAL = 150;
|
||||||
const HOP_DELAY = 500;
|
const HOP_DELAY = 500;
|
||||||
@@ -2100,10 +2099,15 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||||
|
const HAT_CHANCE = 1 / 50; // Every 50 webpages
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
|
|
||||||
|
// Petting boosts
|
||||||
|
const PET_BOOST_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||||
const PET_FEATHER_BOOST = 2;
|
const PET_FEATHER_BOOST = 2;
|
||||||
|
const PET_HAT_BOOST = 1.5;
|
||||||
|
|
||||||
// Focus element constraints
|
// Focus element constraints
|
||||||
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
||||||
@@ -2354,7 +2358,8 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
// Currently being pet, don't open menu
|
// Currently being pet, don't open menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertMenu(menuItems, `${birdBirb().toLowerCase()}OS`, updateMenuLocation);
|
|
||||||
|
insertMenu(menuItems, `${isPetBoostActive() ? " " : ""}${birdBirb().toLowerCase()}OS${isPetBoostActive() ? " ❤" : ""}`, updateMenuLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
birbElement.addEventListener("mouseover", () => {
|
birbElement.addEventListener("mouseover", () => {
|
||||||
@@ -2383,9 +2388,10 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const currentPath = getContext().getPath().split("?")[0];
|
const currentPath = getContext().getPath().split("?")[0];
|
||||||
if (currentPath !== lastPath) {
|
if (currentPath !== lastPath) {
|
||||||
log("Path changed, updating sticky notes: " + currentPath);
|
log("Path changed from '" + lastPath + "' to '" + currentPath + "'");
|
||||||
lastPath = currentPath;
|
lastPath = currentPath;
|
||||||
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
||||||
|
determineHatUnlock();
|
||||||
}
|
}
|
||||||
}, URL_CHECK_INTERVAL);
|
}, URL_CHECK_INTERVAL);
|
||||||
|
|
||||||
@@ -2393,8 +2399,16 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
// TODO: This is for testing
|
determineHatUnlock();
|
||||||
insertHat();
|
}
|
||||||
|
|
||||||
|
function determineHatUnlock() {
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
insertHat();
|
||||||
|
} else if (location.hostname === "127.0.0.1") {
|
||||||
|
log("Inserting hat for debug purposes");
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
@@ -2428,7 +2442,7 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
// Double the chance of a feather if recently pet
|
||||||
const petMod = Date.now() - lastPetTimestamp < PET_BOOST_DURATION ? PET_FEATHER_BOOST : 1;
|
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
||||||
lastPetTimestamp = 0;
|
lastPetTimestamp = 0;
|
||||||
activateFeather();
|
activateFeather();
|
||||||
@@ -3091,6 +3105,10 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPetBoostActive() {
|
||||||
|
return Date.now() - lastPetTimestamp < PET_BOOST_DURATION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
|||||||
30
dist/userscript/birb.user.js
vendored
30
dist/userscript/birb.user.js
vendored
@@ -2053,7 +2053,6 @@
|
|||||||
// Timing constants (in milliseconds)
|
// Timing constants (in milliseconds)
|
||||||
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
||||||
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 150;
|
const URL_CHECK_INTERVAL = 150;
|
||||||
const HOP_DELAY = 500;
|
const HOP_DELAY = 500;
|
||||||
@@ -2062,10 +2061,15 @@
|
|||||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||||
|
const HAT_CHANCE = 1 / 50; // Every 50 webpages
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
|
|
||||||
|
// Petting boosts
|
||||||
|
const PET_BOOST_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||||
const PET_FEATHER_BOOST = 2;
|
const PET_FEATHER_BOOST = 2;
|
||||||
|
const PET_HAT_BOOST = 1.5;
|
||||||
|
|
||||||
// Focus element constraints
|
// Focus element constraints
|
||||||
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
||||||
@@ -2316,7 +2320,8 @@
|
|||||||
// Currently being pet, don't open menu
|
// Currently being pet, don't open menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertMenu(menuItems, `${birdBirb().toLowerCase()}OS`, updateMenuLocation);
|
|
||||||
|
insertMenu(menuItems, `${isPetBoostActive() ? " " : ""}${birdBirb().toLowerCase()}OS${isPetBoostActive() ? " ❤" : ""}`, updateMenuLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
birbElement.addEventListener("mouseover", () => {
|
birbElement.addEventListener("mouseover", () => {
|
||||||
@@ -2345,9 +2350,10 @@
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const currentPath = getContext().getPath().split("?")[0];
|
const currentPath = getContext().getPath().split("?")[0];
|
||||||
if (currentPath !== lastPath) {
|
if (currentPath !== lastPath) {
|
||||||
log("Path changed, updating sticky notes: " + currentPath);
|
log("Path changed from '" + lastPath + "' to '" + currentPath + "'");
|
||||||
lastPath = currentPath;
|
lastPath = currentPath;
|
||||||
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
||||||
|
determineHatUnlock();
|
||||||
}
|
}
|
||||||
}, URL_CHECK_INTERVAL);
|
}, URL_CHECK_INTERVAL);
|
||||||
|
|
||||||
@@ -2355,8 +2361,16 @@
|
|||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
// TODO: This is for testing
|
determineHatUnlock();
|
||||||
insertHat();
|
}
|
||||||
|
|
||||||
|
function determineHatUnlock() {
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
insertHat();
|
||||||
|
} else if (location.hostname === "127.0.0.1") {
|
||||||
|
log("Inserting hat for debug purposes");
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
@@ -2390,7 +2404,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
// Double the chance of a feather if recently pet
|
||||||
const petMod = Date.now() - lastPetTimestamp < PET_BOOST_DURATION ? PET_FEATHER_BOOST : 1;
|
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
||||||
lastPetTimestamp = 0;
|
lastPetTimestamp = 0;
|
||||||
activateFeather();
|
activateFeather();
|
||||||
@@ -3053,6 +3067,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPetBoostActive() {
|
||||||
|
return Date.now() - lastPetTimestamp < PET_BOOST_DURATION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
|||||||
30
dist/web/birb.embed.js
vendored
30
dist/web/birb.embed.js
vendored
@@ -2033,7 +2033,6 @@
|
|||||||
// Timing constants (in milliseconds)
|
// Timing constants (in milliseconds)
|
||||||
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
||||||
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 150;
|
const URL_CHECK_INTERVAL = 150;
|
||||||
const HOP_DELAY = 500;
|
const HOP_DELAY = 500;
|
||||||
@@ -2042,10 +2041,15 @@
|
|||||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||||
|
const HAT_CHANCE = 1 / 50; // Every 50 webpages
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
|
|
||||||
|
// Petting boosts
|
||||||
|
const PET_BOOST_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||||
const PET_FEATHER_BOOST = 2;
|
const PET_FEATHER_BOOST = 2;
|
||||||
|
const PET_HAT_BOOST = 1.5;
|
||||||
|
|
||||||
// Focus element constraints
|
// Focus element constraints
|
||||||
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
||||||
@@ -2296,7 +2300,8 @@
|
|||||||
// Currently being pet, don't open menu
|
// Currently being pet, don't open menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertMenu(menuItems, `${birdBirb().toLowerCase()}OS`, updateMenuLocation);
|
|
||||||
|
insertMenu(menuItems, `${isPetBoostActive() ? " " : ""}${birdBirb().toLowerCase()}OS${isPetBoostActive() ? " ❤" : ""}`, updateMenuLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
birbElement.addEventListener("mouseover", () => {
|
birbElement.addEventListener("mouseover", () => {
|
||||||
@@ -2325,9 +2330,10 @@
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const currentPath = getContext().getPath().split("?")[0];
|
const currentPath = getContext().getPath().split("?")[0];
|
||||||
if (currentPath !== lastPath) {
|
if (currentPath !== lastPath) {
|
||||||
log("Path changed, updating sticky notes: " + currentPath);
|
log("Path changed from '" + lastPath + "' to '" + currentPath + "'");
|
||||||
lastPath = currentPath;
|
lastPath = currentPath;
|
||||||
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
||||||
|
determineHatUnlock();
|
||||||
}
|
}
|
||||||
}, URL_CHECK_INTERVAL);
|
}, URL_CHECK_INTERVAL);
|
||||||
|
|
||||||
@@ -2335,8 +2341,16 @@
|
|||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
// TODO: This is for testing
|
determineHatUnlock();
|
||||||
insertHat();
|
}
|
||||||
|
|
||||||
|
function determineHatUnlock() {
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
insertHat();
|
||||||
|
} else if (location.hostname === "127.0.0.1") {
|
||||||
|
log("Inserting hat for debug purposes");
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
@@ -2370,7 +2384,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
// Double the chance of a feather if recently pet
|
||||||
const petMod = Date.now() - lastPetTimestamp < PET_BOOST_DURATION ? PET_FEATHER_BOOST : 1;
|
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
||||||
lastPetTimestamp = 0;
|
lastPetTimestamp = 0;
|
||||||
activateFeather();
|
activateFeather();
|
||||||
@@ -3033,6 +3047,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPetBoostActive() {
|
||||||
|
return Date.now() - lastPetTimestamp < PET_BOOST_DURATION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
|||||||
30
dist/web/birb.js
vendored
30
dist/web/birb.js
vendored
@@ -2033,7 +2033,6 @@
|
|||||||
// Timing constants (in milliseconds)
|
// Timing constants (in milliseconds)
|
||||||
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
||||||
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 150;
|
const URL_CHECK_INTERVAL = 150;
|
||||||
const HOP_DELAY = 500;
|
const HOP_DELAY = 500;
|
||||||
@@ -2042,10 +2041,15 @@
|
|||||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||||
|
const HAT_CHANCE = 1 / 50; // Every 50 webpages
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
|
|
||||||
|
// Petting boosts
|
||||||
|
const PET_BOOST_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||||
const PET_FEATHER_BOOST = 2;
|
const PET_FEATHER_BOOST = 2;
|
||||||
|
const PET_HAT_BOOST = 1.5;
|
||||||
|
|
||||||
// Focus element constraints
|
// Focus element constraints
|
||||||
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
||||||
@@ -2296,7 +2300,8 @@
|
|||||||
// Currently being pet, don't open menu
|
// Currently being pet, don't open menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertMenu(menuItems, `${birdBirb().toLowerCase()}OS`, updateMenuLocation);
|
|
||||||
|
insertMenu(menuItems, `${isPetBoostActive() ? " " : ""}${birdBirb().toLowerCase()}OS${isPetBoostActive() ? " ❤" : ""}`, updateMenuLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
birbElement.addEventListener("mouseover", () => {
|
birbElement.addEventListener("mouseover", () => {
|
||||||
@@ -2325,9 +2330,10 @@
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const currentPath = getContext().getPath().split("?")[0];
|
const currentPath = getContext().getPath().split("?")[0];
|
||||||
if (currentPath !== lastPath) {
|
if (currentPath !== lastPath) {
|
||||||
log("Path changed, updating sticky notes: " + currentPath);
|
log("Path changed from '" + lastPath + "' to '" + currentPath + "'");
|
||||||
lastPath = currentPath;
|
lastPath = currentPath;
|
||||||
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
||||||
|
determineHatUnlock();
|
||||||
}
|
}
|
||||||
}, URL_CHECK_INTERVAL);
|
}, URL_CHECK_INTERVAL);
|
||||||
|
|
||||||
@@ -2335,8 +2341,16 @@
|
|||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
// TODO: This is for testing
|
determineHatUnlock();
|
||||||
insertHat();
|
}
|
||||||
|
|
||||||
|
function determineHatUnlock() {
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
insertHat();
|
||||||
|
} else if (location.hostname === "127.0.0.1") {
|
||||||
|
log("Inserting hat for debug purposes");
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
@@ -2370,7 +2384,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
// Double the chance of a feather if recently pet
|
||||||
const petMod = Date.now() - lastPetTimestamp < PET_BOOST_DURATION ? PET_FEATHER_BOOST : 1;
|
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
||||||
lastPetTimestamp = 0;
|
lastPetTimestamp = 0;
|
||||||
activateFeather();
|
activateFeather();
|
||||||
@@ -3033,6 +3047,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPetBoostActive() {
|
||||||
|
return Date.now() - lastPetTimestamp < PET_BOOST_DURATION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ const HOP_DISTANCE = 35;
|
|||||||
// Timing constants (in milliseconds)
|
// Timing constants (in milliseconds)
|
||||||
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
const UPDATE_INTERVAL = 1000 / 60; // 60 FPS
|
||||||
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 150;
|
const URL_CHECK_INTERVAL = 150;
|
||||||
const HOP_DELAY = 500;
|
const HOP_DELAY = 500;
|
||||||
@@ -109,10 +108,15 @@ const HOP_DELAY = 500;
|
|||||||
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
const HOP_CHANCE = 1 / (60 * 2.5); // Every 2.5 seconds
|
||||||
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
const FOCUS_SWITCH_CHANCE = 1 / (60 * 20); // Every 20 seconds
|
||||||
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
const FEATHER_CHANCE = 1 / (60 * 60 * 60 * 2); // Every 2 hours
|
||||||
|
const HAT_CHANCE = 1 / 50; // Every 50 webpages
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
|
|
||||||
|
// Petting boosts
|
||||||
|
const PET_BOOST_DURATION = 1000 * 60 * 5; // 5 minutes
|
||||||
const PET_FEATHER_BOOST = 2;
|
const PET_FEATHER_BOOST = 2;
|
||||||
|
const PET_HAT_BOOST = 1.5;
|
||||||
|
|
||||||
// Focus element constraints
|
// Focus element constraints
|
||||||
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
const MIN_FOCUS_ELEMENT_WIDTH = 100;
|
||||||
@@ -363,7 +367,8 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
// Currently being pet, don't open menu
|
// Currently being pet, don't open menu
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
insertMenu(menuItems, `${birdBirb().toLowerCase()}OS`, updateMenuLocation);
|
|
||||||
|
insertMenu(menuItems, `${isPetBoostActive() ? " " : ""}${birdBirb().toLowerCase()}OS${isPetBoostActive() ? " ❤" : ""}`, updateMenuLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
birbElement.addEventListener("mouseover", () => {
|
birbElement.addEventListener("mouseover", () => {
|
||||||
@@ -392,9 +397,10 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
const currentPath = getContext().getPath().split("?")[0];
|
const currentPath = getContext().getPath().split("?")[0];
|
||||||
if (currentPath !== lastPath) {
|
if (currentPath !== lastPath) {
|
||||||
log("Path changed, updating sticky notes: " + currentPath);
|
log("Path changed from '" + lastPath + "' to '" + currentPath + "'");
|
||||||
lastPath = currentPath;
|
lastPath = currentPath;
|
||||||
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
drawStickyNotes(stickyNotes, save, deleteStickyNote);
|
||||||
|
determineHatUnlock();
|
||||||
}
|
}
|
||||||
}, URL_CHECK_INTERVAL);
|
}, URL_CHECK_INTERVAL);
|
||||||
|
|
||||||
@@ -402,8 +408,16 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
// TODO: This is for testing
|
determineHatUnlock();
|
||||||
insertHat();
|
}
|
||||||
|
|
||||||
|
function determineHatUnlock() {
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
insertHat();
|
||||||
|
} else if (location.hostname === "127.0.0.1") {
|
||||||
|
log("Inserting hat for debug purposes");
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
@@ -437,7 +451,7 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
// Double the chance of a feather if recently pet
|
||||||
const petMod = Date.now() - lastPetTimestamp < PET_BOOST_DURATION ? PET_FEATHER_BOOST : 1;
|
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
||||||
lastPetTimestamp = 0;
|
lastPetTimestamp = 0;
|
||||||
activateFeather();
|
activateFeather();
|
||||||
@@ -1114,6 +1128,10 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPetBoostActive() {
|
||||||
|
return Date.now() - lastPetTimestamp < PET_BOOST_DURATION;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
|
|||||||
Reference in New Issue
Block a user