Skip to content

Commit

Permalink
fixed egg timer reset
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenga8533 committed May 30, 2024
1 parent f05ee19 commit 89ea106
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
3 changes: 2 additions & 1 deletion changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"- Changed word deletion to be less",
"- Fixed worker rendering and calc",
"- Fixed tower calc",
"- Fixed egg tracking on reload"
"- Fixed egg tracking on reload",
"- Fixed egg timer reset"
]
1 change: 1 addition & 0 deletions docs/_posts/2024-05-29-v2_9_10.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ author: Volcaronitee
- Fixed worker rendering and calc
- Fixed tower calc
- Fixed egg tracking on reload
- Fixed egg timer reset

{: .box-error}
#### Deprecated
Expand Down
30 changes: 25 additions & 5 deletions features/event/RabbitEggs.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,26 @@ let lastLooted = {
// Track if egg was looted.
registerWhen(register("chat", (type) => {
looted[type] = true;
if (lastLooted[type] === 0) lastLooted[type] = Date.now();

// Set last looted time
if (lastLooted[type] === 0) {
const time = World.getTime() % 24_000 + 20;
const offset = type === "Breakfast" ? (time > 1_000 ? 1_000 - time : -23_000 - time) :
type === "Lunch" ? (time > 8_000 ? 8_000 - time : -16_000 - time) :
type === "Dinner" ? (time > 15_000 ? 15_000 - time : -9_000 - time) : 0;
lastLooted[type] = Date.now() + (offset * 50);
}
}).setCriteria("You have already collected this Chocolate ${type} Egg! Try again when it respawns!"),
() => (Settings.chocoWaypoints || Settings.eggTimers) && location.getSeason() === "Spring");

registerWhen(register("chat", (type) => {
// Set looted status and last looted time
looted[type] = true;
lastLooted[type] = Date.now();
const time = World.getTime() % 24_000 + 20;
const offset = type === "Breakfast" ? (time > 1_000 ? 1_000 - time : -23_000 - time) :
type === "Lunch" ? (time > 8_000 ? 8_000 - time : -16_000 - time) :
type === "Dinner" ? (time > 15_000 ? 15_000 - time : -9_000 - time) : 0;
lastLooted[type] = Date.now() + (offset * 50);

// Track egg location
const found = data.eggs.found;
Expand All @@ -130,12 +143,19 @@ registerWhen(register("chat", (type) => {

registerWhen(register("tick", () => {
const time = World.getTime() % 24_000;
if (Math.abs(time - 1_000) < 4 || Date.now() - lastLooted.Breakfast > 1_200_000)

if (Math.abs(time - 1_000) < 4 || Date.now() - lastLooted.Breakfast > 1_200_000) {
looted.Breakfast = false;
else if (Math.abs(time - 8_000) < 4 || Date.now() - lastLooted.Lunch > 1_200_000)
lastLooted.Breakfast = 0;
}
if (Math.abs(time - 8_000) < 4 || Date.now() - lastLooted.Lunch > 1_200_000) {
looted.Lunch = false;
else if (Math.abs(time - 15_000) < 4 || Date.now() - lastLooted.Dinner > 1_200_000)
lastLooted.Lunch = 0;
}
if (Math.abs(time - 15_000) < 4 || Date.now() - lastLooted.Dinner > 1_200_000) {
looted.Dinner = false;
lastLooted.Dinner = 0;
}
}), () => (Settings.chocoWaypoints || Settings.eggTimers) && location.getSeason() === "Spring");

// ArmorStand ESP susge, UAYOR
Expand Down

0 comments on commit 89ea106

Please sign in to comment.