-
Notifications
You must be signed in to change notification settings - Fork 12
Add R01 Dispatch Task to cudoriver/tasks #44
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
8db762d
6ccc10f
313c86b
73fa5de
ba4921b
489525b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And also revert this one. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package dev.shared.cudoriver.task; | ||
|
|
||
| import eu.darkbot.api.API; | ||
| import eu.darkbot.api.extensions.Feature; | ||
| import eu.darkbot.api.extensions.Task; | ||
| import eu.darkbot.api.managers.BackpageAPI; | ||
| import eu.darkbot.api.utils.Inject; | ||
|
|
||
| @Feature(name = "R01 Dispatch Module", description = "Automatically collects and starts R01 dispatch tasks") | ||
| public class R01SevkiyatTask implements Task { | ||
|
|
||
| private final BackpageAPI backpage; | ||
| private long lastActionTime = 0; | ||
| private int currentSlot = 1; | ||
| private boolean collecting = true; | ||
|
|
||
| // 4 slot ve 3 saat bekleme | ||
| private static final int FIRST_SLOT_ID = 1; | ||
| private static final int LAST_SLOT_ID = 4; | ||
| private static final long ACTION_DELAY = 10800000L; | ||
| private static final int R01_RETRIEVER_ID = 1; | ||
|
|
||
| @Inject | ||
| public R01SevkiyatTask(BackpageAPI backpage) { | ||
| this.backpage = backpage; | ||
| } | ||
|
|
||
| @Override | ||
| public void onTickTask() { | ||
| if (System.currentTimeMillis() - lastActionTime < ACTION_DELAY) return; | ||
| if (backpage == null) return; | ||
|
|
||
| try { | ||
| if (collecting) { | ||
| backpage.getConnection("indexInternal.es?action=internalDispatch&subaction=collect&slotId=" + currentSlot); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } else { | ||
| backpage.getConnection("indexInternal.es?action=internalDispatch&subaction=init&retrieverId=" + R01_RETRIEVER_ID + "&slotId=" + currentSlot); | ||
| } | ||
| updateState(); | ||
| } catch (Exception e) { | ||
| // Hataları sessizce yut | ||
| } | ||
| } | ||
|
|
||
| private void updateState() { | ||
| lastActionTime = System.currentTimeMillis(); | ||
| currentSlot++; | ||
|
|
||
| if (currentSlot > LAST_SLOT_ID) { | ||
| currentSlot = FIRST_SLOT_ID; | ||
| collecting = !collecting; | ||
| } | ||
| } | ||
| } | ||
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.
Need to revert this file.