mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 04:07:23 +00:00
Add delay before hopping repeatedly
This commit is contained in:
7
dist/birb.js
vendored
7
dist/birb.js
vendored
@@ -1538,9 +1538,10 @@
|
|||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 500;
|
const URL_CHECK_INTERVAL = 500;
|
||||||
|
const HOP_DELAY = 500;
|
||||||
|
|
||||||
// Random event chances per tick
|
// Random event chances per tick
|
||||||
const HOP_CHANCE = 1 / (60 * 3); // Every 3 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
|
||||||
|
|
||||||
@@ -1674,7 +1675,7 @@
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("2025.10.28.152", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.28.152"); }, false),
|
new MenuItem("2025.10.28.157", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.28.157"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -1935,7 +1936,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
||||||
if (Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (Date.now() - stateStart > HOP_DELAY && Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
hop();
|
hop();
|
||||||
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
||||||
// Idle for a while, do something
|
// Idle for a while, do something
|
||||||
|
|||||||
9
dist/birb.user.js
vendored
9
dist/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 2025.10.28.152
|
// @version 2025.10.28.157
|
||||||
// @description birb
|
// @description birb
|
||||||
// @author Idrees
|
// @author Idrees
|
||||||
// @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/birb.user.js
|
// @downloadURL https://github.com/IdreesInc/Pocket-Bird/raw/refs/heads/main/dist/birb.user.js
|
||||||
@@ -1552,9 +1552,10 @@
|
|||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 500;
|
const URL_CHECK_INTERVAL = 500;
|
||||||
|
const HOP_DELAY = 500;
|
||||||
|
|
||||||
// Random event chances per tick
|
// Random event chances per tick
|
||||||
const HOP_CHANCE = 1 / (60 * 3); // Every 3 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
|
||||||
|
|
||||||
@@ -1688,7 +1689,7 @@
|
|||||||
insertModal(`${birdBirb()} Mode`, message);
|
insertModal(`${birdBirb()} Mode`, message);
|
||||||
}),
|
}),
|
||||||
new Separator(),
|
new Separator(),
|
||||||
new MenuItem("2025.10.28.152", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.28.152"); }, false),
|
new MenuItem("2025.10.28.157", () => { alert("Thank you for using Pocket Bird! You are on version: 2025.10.28.157"); }, false),
|
||||||
];
|
];
|
||||||
|
|
||||||
const styleElement = document.createElement("style");
|
const styleElement = document.createElement("style");
|
||||||
@@ -1949,7 +1950,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
||||||
if (Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (Date.now() - stateStart > HOP_DELAY && Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
hop();
|
hop();
|
||||||
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
||||||
// Idle for a while, do something
|
// Idle for a while, do something
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Pocket Bird",
|
"name": "Pocket Bird",
|
||||||
"description": "It's a bird, in your browser. What more could you want?",
|
"description": "It's a bird, in your browser. What more could you want?",
|
||||||
"version": "2025.10.28.152",
|
"version": "2025.10.28.157",
|
||||||
"homepage_url": "https://idreesinc.com",
|
"homepage_url": "https://idreesinc.com",
|
||||||
"icons": {
|
"icons": {
|
||||||
"48": "images/icons/transparent/48x48x1.png",
|
"48": "images/icons/transparent/48x48x1.png",
|
||||||
|
|||||||
@@ -90,9 +90,10 @@ const AFK_TIME = isDebug() ? 0 : 1000 * 5;
|
|||||||
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
const PET_BOOST_DURATION = 1000 * 60 * 5;
|
||||||
const PET_MENU_COOLDOWN = 1000;
|
const PET_MENU_COOLDOWN = 1000;
|
||||||
const URL_CHECK_INTERVAL = 500;
|
const URL_CHECK_INTERVAL = 500;
|
||||||
|
const HOP_DELAY = 500;
|
||||||
|
|
||||||
// Random event chances per tick
|
// Random event chances per tick
|
||||||
const HOP_CHANCE = 1 / (60 * 3); // Every 3 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
|
||||||
|
|
||||||
@@ -487,7 +488,7 @@ Promise.all([
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
if (currentState === States.IDLE && !frozen && !isMenuOpen()) {
|
||||||
if (Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
if (Date.now() - stateStart > HOP_DELAY && Math.random() < HOP_CHANCE && birb.getCurrentAnimation() !== Animations.HEART) {
|
||||||
hop();
|
hop();
|
||||||
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
} else if (Date.now() - lastActionTimestamp > AFK_TIME) {
|
||||||
// Idle for a while, do something
|
// Idle for a while, do something
|
||||||
|
|||||||
Reference in New Issue
Block a user