-
Notifications
You must be signed in to change notification settings - Fork 67
add returnee calendar manager to claim rewards #378
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
Open
anjeshshrestha
wants to merge
11
commits into
darkbot-reloaded:master
Choose a base branch
from
anjeshshrestha:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7b9ec6b
add returnee calendar manager to claim rewards
anjeshshrestha 4ac2316
Merge branch 'master' into master
anjeshshrestha 13550a6
Merge branch 'darkbot-reloaded:master' into master
anjeshshrestha 5130753
Update src/main/java/com/github/manolo8/darkbot/core/objects/facades/…
anjeshshrestha 16546c2
Update ReturneeCalendarProxy.java
anjeshshrestha 2815403
Update ReturneeLoginProxy.java
anjeshshrestha f075f03
Update ReturneeManager.java
anjeshshrestha 7d836b7
Update ReturneeManager.java
anjeshshrestha 666a3ef
Update ReturneeCalendarProxy.java
anjeshshrestha 27144de
Update ReturneeLoginProxy.java
anjeshshrestha 73f8419
Merge branch 'darkbot-reloaded:master' into master
anjeshshrestha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/com/github/manolo8/darkbot/core/manager/ReturneeManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| package com.github.manolo8.darkbot.core.manager; | ||
|
|
||
| import com.github.manolo8.darkbot.core.objects.Gui; | ||
| import com.github.manolo8.darkbot.core.objects.facades.ReturneeCalendarProxy; | ||
| import com.github.manolo8.darkbot.core.objects.facades.ReturneeLoginProxy; | ||
| import eu.darkbot.api.managers.BotAPI; | ||
| import eu.darkbot.api.managers.ReturneeAPI; | ||
| import eu.darkbot.util.Timer; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RequiredArgsConstructor | ||
| public class ReturneeManager extends Gui implements ReturneeAPI { | ||
| private final ReturneeLoginProxy returneeLoginProxy; | ||
| private final ReturneeCalendarProxy returneeCalendarProxy; | ||
| private final BotAPI bot; | ||
|
|
||
| private final Timer guiUsed = Timer.getRandom(19_000, 1000); | ||
|
|
||
| @Override | ||
| public void update() { | ||
| super.update(); | ||
| // Last gui usage >20s ago, close gui | ||
| if (bot.isRunning() && guiUsed.isInactive()) { | ||
| this.show(false); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public boolean show(boolean value) { | ||
| if (value) guiUsed.activate(); | ||
| return super.show(value); | ||
| } | ||
|
|
||
| public boolean clickOverview() { | ||
| if (show(true)) { | ||
| this.click(320, 37); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public boolean clickDailyLogin() { | ||
| if (show(true)) { | ||
| this.click(420, 37); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public boolean clickClaim() { | ||
| if (show(true)) { | ||
| this.click(300, 410); | ||
| return true; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isLoginClaimable() { | ||
| return returneeLoginProxy.isClaimable(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<? extends LoginRewardList> getLoginRewardList() { | ||
| return returneeLoginProxy.getRewardList(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isCalendarClaimable() { | ||
| return returneeCalendarProxy.isClaimable(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<? extends CalendarRewardList> getCalendarRewardList() { | ||
| return returneeCalendarProxy.getCalendarList(); | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
src/main/java/com/github/manolo8/darkbot/core/objects/facades/ReturneeCalendarProxy.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.github.manolo8.darkbot.core.objects.facades; | ||
|
|
||
| import com.github.manolo8.darkbot.core.itf.Updatable; | ||
| import com.github.manolo8.darkbot.core.objects.swf.FlashList; | ||
| import eu.darkbot.api.API; | ||
| import eu.darkbot.api.managers.ReturneeAPI; | ||
| import lombok.Getter; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| public class ReturneeCalendarProxy extends Updatable implements API.Singleton { | ||
| private int daysClaimed = -1; | ||
| private boolean claimable = false; | ||
| private final FlashList<CalendarList> calendarList = FlashList.ofVector(CalendarList::new); | ||
|
|
||
| @Override | ||
| public void update() { | ||
| this.daysClaimed = readInt(0x30, 0x40); | ||
| this.claimable = readBoolean(0x30, 0x50, 0x20); | ||
| this.calendarList.update(readAtom(0x30, 0x58)); | ||
| } | ||
|
|
||
| @Getter | ||
| @ToString | ||
| private static class CalendarList extends Auto implements ReturneeAPI.CalendarRewardList { | ||
| private String lootId; | ||
| private int amount; | ||
| private boolean claimed; | ||
|
|
||
| @Override | ||
| public void update() { | ||
| this.amount = readInt(0x20); | ||
| this.lootId = readString(0x30); | ||
| this.claimed = readBoolean(0x2C); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean getClaimed() { | ||
| return claimed; | ||
| } | ||
| } | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
src/main/java/com/github/manolo8/darkbot/core/objects/facades/ReturneeLoginProxy.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.github.manolo8.darkbot.core.objects.facades; | ||
|
|
||
| import com.github.manolo8.darkbot.core.itf.Updatable; | ||
| import com.github.manolo8.darkbot.core.objects.swf.FlashList; | ||
| import eu.darkbot.api.API; | ||
| import eu.darkbot.api.managers.ReturneeAPI; | ||
| import lombok.Getter; | ||
| import lombok.ToString; | ||
|
|
||
| @Getter | ||
| public class ReturneeLoginProxy extends Updatable implements API.Singleton{ | ||
|
|
||
| private boolean claimable = false; | ||
| private final FlashList<RewardList> rewardList = FlashList.ofVector(RewardList::new); | ||
|
|
||
| @Override | ||
| public void update() { | ||
| this.claimable = readBoolean(0x30, 0x40, 0x20); | ||
| this.rewardList.update(readAtom(0x30, 0x48)); | ||
| } | ||
|
|
||
| @Getter | ||
| @ToString | ||
| private static class RewardList extends Auto implements ReturneeAPI.LoginRewardList { | ||
| private String lootId; | ||
| private double amount; | ||
|
|
||
| @Override | ||
| public void update() { | ||
| this.amount = readDouble(0x70); | ||
| this.lootId = readString(0x48); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.