Skip to content
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

add bonus calendar proxy #381

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.github.manolo8.darkbot.core.itf.Updatable;
import com.github.manolo8.darkbot.core.objects.facades.AssemblyMediator;
import com.github.manolo8.darkbot.core.objects.facades.AstralGateProxy;
import com.github.manolo8.darkbot.core.objects.facades.BonusCalendarProxy;
import com.github.manolo8.darkbot.core.objects.facades.BoosterProxy;
import com.github.manolo8.darkbot.core.objects.facades.ChatProxy;
import com.github.manolo8.darkbot.core.objects.facades.ChrominProxy;
Expand All @@ -22,8 +23,8 @@
import com.github.manolo8.darkbot.core.objects.facades.InventoryProxy;
import com.github.manolo8.darkbot.core.objects.facades.LogMediator;
import com.github.manolo8.darkbot.core.objects.facades.NpcEventProxy;
import com.github.manolo8.darkbot.core.objects.facades.SeassonPassMediator;
import com.github.manolo8.darkbot.core.objects.facades.QuestProxy;
import com.github.manolo8.darkbot.core.objects.facades.SeassonPassMediator;
import com.github.manolo8.darkbot.core.objects.facades.SettingsProxy;
import com.github.manolo8.darkbot.core.objects.facades.SlotBarsProxy;
import com.github.manolo8.darkbot.core.objects.facades.SpaceMapWindowProxy;
Expand Down Expand Up @@ -64,6 +65,7 @@ public class FacadeManager implements Manager, eu.darkbot.api.API.Singleton, Npc
public final WorldBossOverviewProxy worldBossOverview;
public final Updatable group;
public final Updatable groupMediator;
public final BonusCalendarProxy bonusCalendarProxy;

private final Map<EventType, NpcEventProxy> npcEvents = new HashMap<>();

Expand All @@ -88,6 +90,7 @@ public FacadeManager(PluginAPI pluginApi) {
this.worldBossOverview = registerProxy("worldBoss_overview", WorldBossOverviewProxy.class);
this.group = registerProxy("GroupProxy", Updatable.NoOp.class);
this.groupMediator = registerMediator("GroupSystemMediator", Updatable.NoOp.class);
this.bonusCalendarProxy = registerProxy("miniclient_reward", BonusCalendarProxy.class);

registerProxy("dispatch", DispatchProxy.class);
registerProxy("dispatch_retriever", DispatchRetrieverProxy.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class GuiManager implements Manager, GameScreenAPI {
public final GroupManager group;
public final SettingsGui settingsGui;
public final ChatGui chat;
public final Gui bonusCalendar;

public final Gui assembly;

Expand Down Expand Up @@ -148,6 +149,7 @@ public GuiManager(Main main, PluginAPI pluginAPI, RepairManager repairManager) {
this.refinement = register("refinement", RefinementGui.class);
this.chat = register("chat", ChatGui.class);
this.settingsGui = register("settings", SettingsGui.class);
this.bonusCalendar = register("miniclient_reward");

register("dispatch", DispatchManager.class);
register("dispatch_popup_reward_list", DispatchPopupRewardGui.class);
Expand Down
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.managers.BonusCalendarAPI;
import lombok.Getter;
import lombok.ToString;

@Getter
public class BonusCalendarProxy extends Updatable implements BonusCalendarAPI {
private int daysClaimed;
private boolean claimable;
private final FlashList<RewardLoot> rewardList = FlashList.ofVector(RewardLoot::new);

@Override
public void update() {
daysClaimed = readInt(0x30, 0x40);
rewardList.update(readAtom(0x30, 0x58));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the listing does not change, this will only be read once

claimable = readBoolean(0x30, 0x50, 0x20);
}

@Getter
@ToString
private static class RewardLoot extends Auto implements BonusCalendarAPI.RewardList {
private String lootId;
private int amount;

@Override
public void update() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace it with the following since these data remain unchanged

public void update(long address) {
            super.update(address);
            this.amount = readInt(0x20);
            this.lootId = readString(0x30);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh yea this should have been just updateable, not auto

this.amount = readInt(0x20);
this.lootId = readString(0x30);
}
}
}
Loading