Genshin Impact daily check-in rewards
Leave a tab open with the Genshin Impact daily check-in rewards page and this script will collect them for you in the following scenarios:
- When you start up your browser and/or visit the webpage
- If you leave a tab open in the background and the reward refresh timer passes + a few random minutes. The page will be refreshed, re-running the script from the beginning, collecting any rewards available.
This script does not require you to share your credentials or anything like that, it simply observes an already logged in page and clicks a button if it appears (With some extra checks here and there). Feel free to take a short look at the content of the script if you feel nervous and want to double check.
Tested in Chrome-based browsers and uses somewhat "modern" functions here and there. No attempts at supporting legacy browsers have been made. Use at your own risk.
The browser tab running in the background must not be put to sleep, if you are using any extensions/add-on for that type of functionality.
I recommend you verifying that this script is collecting the rewards as expected periodically, as there may bugs and edge cases that the script does not take into account.
If you find any bugs, feel free to report it.
First piece of Javascript code I've written. Could probably be written more efficiently and the problem otherwise solved more elegantly. Publish your version if you have a better solution :D
How to use
- Install the script
- Open up the rewards page
- If you are not logged in, log in.
- Leave it alone
If there is a reward available: The script will normally wait ten (10) seconds, and should then click and collect the reward.
The script lets the pop-up/confirmation box alone, as a reminder for you. The rewards have already been sent when the box appears.
If no rewards are available, the script will schedule a refresh of the tab after the reward reset (By default midnight at UTC+8). The refresh will occur a random minute number after the midnight, to make the request seem somewhat random.
Compatibility issues
If you have any troubles getting the script working for you for some reason, maybe try a modified and a leaner version of my script rewritten by Bunta 2:
https://greasyfork.org/en/scripts/428958-genshin-impact-daily-check-in-rewards
It has been slimmed down to the bare essentials and will instead refresh every 4 hours, bypassing a lot of complexity and dependencies and should work better for you if you encounter any reliability issues with my script.
Changelog
Version 1.9
- Bugfix: Change the load event to look for another class, which presumably loads last.
Version 1.8
- Bugfix: Change the load event to look for another class, the avatar icon, which presumably loads last. The previous class does not load on the first day.
Version 1.7
- Bugfix: Change the load event to look for another class that presumably loads last. The previous class may not load in some cases.
Version 1.6
- Bugfix: Proper bugfix to the issue hotfixed in version 1.5. Removes duplicate attempts at clicking the reward entry.
Version 1.5
- Hotfix: Quick bugfix to adapt to the changes in the daily check-in rewards website. Not fully tested, but should work fine as a stopgap solution.
Version 1.4
- Updated the class strings used in the new design of the daily check-in page
Version 1.3
- Added a new match rule to work on new URL/domain for daily check-in
- Changed to a MIT-license to conform better to Greasyfork. Functionally mostly the same as CC BY 4.0 on the things that matter to me
Version 1.2
- Fixed a potential bug in how early the script observation period terminates.
Version 1.1
- Fixed a bug that prevented the script from collecting the first reward in a month.
License
MIT License
Copyright (c) 2022 NoxPi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.