-
-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Lottery interaction #1934
base: master
Are you sure you want to change the base?
Conversation
scripts/src/main/java/io/github/fate_grand_automata/scripts/entrypoints/AutoLottery.kt
Outdated
Show resolved
Hide resolved
private fun spin() { | ||
// Don't increase this too much or you'll regret when you're not able to stop the script | ||
// And your phone won't let you press anything | ||
locations.lottery.spinClick.click(20) | ||
} | ||
|
||
private fun spinLongClick() { | ||
locations.lottery.spinClick.longPress(lottoLongPress * 1_000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this to access the sharedpreference once and store that in memory
@@ -27,6 +29,8 @@ class TapperService : AccessibilityService() { | |||
// We only want events from FGO | |||
serviceInfo = serviceInfo.apply { | |||
packageNames = GameServer.packageNames.keys.toTypedArray() | |||
flags = AccessibilityServiceInfo.DEFAULT or AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE | |||
eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED or AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You used the same value twice for the or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah, bad code that I forgot to delete
val source = event?.source | ||
source?.let { | ||
source.performAction(AccessibilityNodeInfo.ACTION_LONG_CLICK) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the one that handles the long press
events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have sworn, I remember that it didn't work with the initial setup until I added this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really find any other people using these kinds of flags and event listeners.
What your code currently does is long press the screen when FGO is opened and when FGA dialogs are closed (for example when you press the play button and then click cancel)
I can't see the long presses or any effects, but this code doesn't seem right.
I also don't get what the touch exploration mode flag is used for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
touch exploration mode flag is used for
this is also needed for long press
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah this might be the one for long press and drag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still have currency to test the code? For example remove the ACTION_LONG_CLICK and see if it still works.
Also, does the new lottery long press code only work for JP lotteries or may it also work for other servers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already empty
the long press QOL works much faster than the multiple clicks. I emptied it out before I even notice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still have currency to test the code? For example remove the ACTION_LONG_CLICK and see if it still works.
I still have currency if testing is needed
does the new lottery long press code only work for JP lotteries or may it also work for other servers?
only for JP for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, does the new lottery long press code only work for JP lotteries or may it also work for other servers?
lmao me speed reading didn't read this.
yea there's a lock-in there as it is JP only feature so far.
FGA/scripts/src/main/java/io/github/fate_grand_automata/scripts/entrypoints/AutoLottery.kt
Lines 41 to 47 in 428c187
/** | |
* Switch between the two different spin methods depending on the server | |
*/ | |
private fun spinGameServer() = when (prefs.gameServer) { | |
is GameServer.Jp -> spinLongClick() | |
else -> spin() | |
} |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
longPress8(location, duration) | ||
} else { | ||
click(location, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this will produce weird behavior for Android 7, but I think we should drop support for Android 7 anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind dropping the android 7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's a bit out of place to ask but it'd be nice to have a "Last working build" release for no-longer-supported Android versions
Co-authored-by: sby1ce <135048812+sby1ce@users.noreply.github.com>
428c187
to
e05b7d2
Compare
Updated Lottery interaction
Pull Request Type
Related issue
fixes #1936
Description
They actually moved the done location causing issues.
Added the long press for jp lottery
Screenshots
Testing
Additional context