mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 19:59:38 +00:00
Spawn hats based on time again
This commit is contained in:
BIN
dist/extension.zip
vendored
BIN
dist/extension.zip
vendored
Binary file not shown.
34
dist/extension/birb.js
vendored
34
dist/extension/birb.js
vendored
@@ -2047,7 +2047,8 @@
|
|||||||
|
|
||||||
// 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; // 5 seconds
|
||||||
|
const SUPER_AFK_TIME = 1000 * 60 * 60; // 1 hour
|
||||||
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;
|
||||||
@@ -2056,7 +2057,7 @@
|
|||||||
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
|
const HAT_CHANCE = 1 / (60 * 60 * 10); // Every 10 minutes
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
@@ -2161,7 +2162,7 @@
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem(() => `2026.1.21 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.21"); }, false),
|
new MenuItem(() => `2026.1.22 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.22"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -2348,24 +2349,12 @@
|
|||||||
log("Path changed from '" + lastPath + "' to '" + 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);
|
||||||
|
|
||||||
setInterval(update, UPDATE_INTERVAL);
|
setInterval(update, UPDATE_INTERVAL);
|
||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
determineHatUnlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
||||||
@@ -2398,12 +2387,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
if (birb.isVisible() && Date.now() - lastActionTimestamp < SUPER_AFK_TIME) {
|
||||||
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
if (Math.random() < FEATHER_CHANCE * (isPetBoostActive() ? PET_FEATHER_BOOST : 1)) {
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
lastPetTimestamp = 0;
|
||||||
lastPetTimestamp = 0;
|
activateFeather();
|
||||||
activateFeather();
|
}
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
lastPetTimestamp = 0;
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeather();
|
updateFeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
dist/extension/manifest.json
vendored
2
dist/extension/manifest.json
vendored
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Pocket Bird",
|
"name": "Pocket Bird",
|
||||||
"description": "It's a pet bird in your browser, what more could you want?",
|
"description": "It's a pet bird in your browser, what more could you want?",
|
||||||
"version": "2026.1.21",
|
"version": "2026.1.22",
|
||||||
"homepage_url": "https://idreesinc.com",
|
"homepage_url": "https://idreesinc.com",
|
||||||
"icons": {
|
"icons": {
|
||||||
"48": "images/icons/transparent/48x48x1.png",
|
"48": "images/icons/transparent/48x48x1.png",
|
||||||
|
|||||||
36
dist/obsidian/main.js
vendored
36
dist/obsidian/main.js
vendored
@@ -1,7 +1,7 @@
|
|||||||
const { Plugin, Notice } = require('obsidian');
|
const { Plugin, Notice } = require('obsidian');
|
||||||
module.exports = class PocketBird extends Plugin {
|
module.exports = class PocketBird extends Plugin {
|
||||||
onload() {
|
onload() {
|
||||||
console.log("Loading Pocket Bird version 2026.1.21...");
|
console.log("Loading Pocket Bird version 2026.1.22...");
|
||||||
const OBSIDIAN_PLUGIN = this;
|
const OBSIDIAN_PLUGIN = this;
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -2090,7 +2090,8 @@ 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; // 5 seconds
|
||||||
|
const SUPER_AFK_TIME = 1000 * 60 * 60; // 1 hour
|
||||||
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;
|
||||||
@@ -2099,7 +2100,7 @@ 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
|
const HAT_CHANCE = 1 / (60 * 60 * 10); // Every 10 minutes
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
@@ -2204,7 +2205,7 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem(() => `2026.1.21 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.21"); }, false),
|
new MenuItem(() => `2026.1.22 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.22"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -2391,24 +2392,12 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
log("Path changed from '" + lastPath + "' to '" + 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);
|
||||||
|
|
||||||
setInterval(update, UPDATE_INTERVAL);
|
setInterval(update, UPDATE_INTERVAL);
|
||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
determineHatUnlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
||||||
@@ -2441,12 +2430,17 @@ module.exports = class PocketBird extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
if (birb.isVisible() && Date.now() - lastActionTimestamp < SUPER_AFK_TIME) {
|
||||||
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
if (Math.random() < FEATHER_CHANCE * (isPetBoostActive() ? PET_FEATHER_BOOST : 1)) {
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
lastPetTimestamp = 0;
|
||||||
lastPetTimestamp = 0;
|
activateFeather();
|
||||||
activateFeather();
|
}
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
lastPetTimestamp = 0;
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeather();
|
updateFeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
dist/obsidian/manifest.json
vendored
2
dist/obsidian/manifest.json
vendored
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "pocket-bird",
|
"id": "pocket-bird",
|
||||||
"name": "Pocket Bird",
|
"name": "Pocket Bird",
|
||||||
"version": "2026.1.21",
|
"version": "2026.1.22",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "Add a pet bird to fly around your notes and keep you company!",
|
"description": "Add a pet bird to fly around your notes and keep you company!",
|
||||||
"author": "Idrees Hassan",
|
"author": "Idrees Hassan",
|
||||||
|
|||||||
36
dist/userscript/birb.user.js
vendored
36
dist/userscript/birb.user.js
vendored
@@ -1,7 +1,7 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Pocket Bird
|
// @name Pocket Bird
|
||||||
// @namespace https://idreesinc.com
|
// @namespace https://idreesinc.com
|
||||||
// @version 2026.1.21
|
// @version 2026.1.22
|
||||||
// @description It's a pet bird in your browser, what more could you want?
|
// @description It's a pet bird in your browser, what more could you want?
|
||||||
// @author Idrees
|
// @author Idrees
|
||||||
// @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/userscript/birb.user.js
|
// @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/userscript/birb.user.js
|
||||||
@@ -2052,7 +2052,8 @@
|
|||||||
|
|
||||||
// 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; // 5 seconds
|
||||||
|
const SUPER_AFK_TIME = 1000 * 60 * 60; // 1 hour
|
||||||
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;
|
||||||
@@ -2061,7 +2062,7 @@
|
|||||||
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
|
const HAT_CHANCE = 1 / (60 * 60 * 10); // Every 10 minutes
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
@@ -2166,7 +2167,7 @@
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem(() => `2026.1.21 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.21"); }, false),
|
new MenuItem(() => `2026.1.22 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.22"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -2353,24 +2354,12 @@
|
|||||||
log("Path changed from '" + lastPath + "' to '" + 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);
|
||||||
|
|
||||||
setInterval(update, UPDATE_INTERVAL);
|
setInterval(update, UPDATE_INTERVAL);
|
||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
determineHatUnlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
||||||
@@ -2403,12 +2392,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
if (birb.isVisible() && Date.now() - lastActionTimestamp < SUPER_AFK_TIME) {
|
||||||
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
if (Math.random() < FEATHER_CHANCE * (isPetBoostActive() ? PET_FEATHER_BOOST : 1)) {
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
lastPetTimestamp = 0;
|
||||||
lastPetTimestamp = 0;
|
activateFeather();
|
||||||
activateFeather();
|
}
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
lastPetTimestamp = 0;
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeather();
|
updateFeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
dist/web/birb.embed.js
vendored
34
dist/web/birb.embed.js
vendored
@@ -2032,7 +2032,8 @@
|
|||||||
|
|
||||||
// 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; // 5 seconds
|
||||||
|
const SUPER_AFK_TIME = 1000 * 60 * 60; // 1 hour
|
||||||
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;
|
||||||
@@ -2041,7 +2042,7 @@
|
|||||||
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
|
const HAT_CHANCE = 1 / (60 * 60 * 10); // Every 10 minutes
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
@@ -2146,7 +2147,7 @@
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem(() => `2026.1.21 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.21"); }, false),
|
new MenuItem(() => `2026.1.22 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.22"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -2333,24 +2334,12 @@
|
|||||||
log("Path changed from '" + lastPath + "' to '" + 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);
|
||||||
|
|
||||||
setInterval(update, UPDATE_INTERVAL);
|
setInterval(update, UPDATE_INTERVAL);
|
||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
determineHatUnlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
||||||
@@ -2383,12 +2372,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
if (birb.isVisible() && Date.now() - lastActionTimestamp < SUPER_AFK_TIME) {
|
||||||
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
if (Math.random() < FEATHER_CHANCE * (isPetBoostActive() ? PET_FEATHER_BOOST : 1)) {
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
lastPetTimestamp = 0;
|
||||||
lastPetTimestamp = 0;
|
activateFeather();
|
||||||
activateFeather();
|
}
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
lastPetTimestamp = 0;
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeather();
|
updateFeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
34
dist/web/birb.js
vendored
34
dist/web/birb.js
vendored
@@ -2032,7 +2032,8 @@
|
|||||||
|
|
||||||
// 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; // 5 seconds
|
||||||
|
const SUPER_AFK_TIME = 1000 * 60 * 60; // 1 hour
|
||||||
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;
|
||||||
@@ -2041,7 +2042,7 @@
|
|||||||
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
|
const HAT_CHANCE = 1 / (60 * 60 * 10); // Every 10 minutes
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
@@ -2146,7 +2147,7 @@
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem(() => `2026.1.21 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.21"); }, false),
|
new MenuItem(() => `2026.1.22 ${isPetBoostActive() ? "❤" : ""}`, () => { alert("Thank you for using Pocket Bird! You are on version: 2026.1.22"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -2333,24 +2334,12 @@
|
|||||||
log("Path changed from '" + lastPath + "' to '" + 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);
|
||||||
|
|
||||||
setInterval(update, UPDATE_INTERVAL);
|
setInterval(update, UPDATE_INTERVAL);
|
||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
determineHatUnlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
||||||
@@ -2383,12 +2372,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
if (birb.isVisible() && Date.now() - lastActionTimestamp < SUPER_AFK_TIME) {
|
||||||
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
if (Math.random() < FEATHER_CHANCE * (isPetBoostActive() ? PET_FEATHER_BOOST : 1)) {
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
lastPetTimestamp = 0;
|
||||||
lastPetTimestamp = 0;
|
activateFeather();
|
||||||
activateFeather();
|
}
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
lastPetTimestamp = 0;
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeather();
|
updateFeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,8 @@ 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; // 5 seconds
|
||||||
|
const SUPER_AFK_TIME = 1000 * 60 * 60; // 1 hour
|
||||||
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;
|
||||||
@@ -108,7 +109,7 @@ 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
|
const HAT_CHANCE = 1 / (60 * 60 * 10); // Every 10 minutes
|
||||||
|
|
||||||
// Feathers
|
// Feathers
|
||||||
const FEATHER_FALL_SPEED = 1;
|
const FEATHER_FALL_SPEED = 1;
|
||||||
@@ -400,24 +401,12 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
log("Path changed from '" + lastPath + "' to '" + 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);
|
||||||
|
|
||||||
setInterval(update, UPDATE_INTERVAL);
|
setInterval(update, UPDATE_INTERVAL);
|
||||||
|
|
||||||
focusOnElement(true);
|
focusOnElement(true);
|
||||||
|
|
||||||
determineHatUnlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
||||||
@@ -450,12 +439,17 @@ function startApplication(birbPixels, featherPixels, hatsPixels) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Double the chance of a feather if recently pet
|
if (birb.isVisible() && Date.now() - lastActionTimestamp < SUPER_AFK_TIME) {
|
||||||
const petMod = isPetBoostActive() ? PET_FEATHER_BOOST : 1;
|
if (Math.random() < FEATHER_CHANCE * (isPetBoostActive() ? PET_FEATHER_BOOST : 1)) {
|
||||||
if (birb.isVisible() && Math.random() < FEATHER_CHANCE * petMod) {
|
lastPetTimestamp = 0;
|
||||||
lastPetTimestamp = 0;
|
activateFeather();
|
||||||
activateFeather();
|
}
|
||||||
|
if (Math.random() < (HAT_CHANCE * (isPetBoostActive() ? PET_HAT_BOOST : 1))) {
|
||||||
|
lastPetTimestamp = 0;
|
||||||
|
insertHat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateFeather();
|
updateFeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user