Skip to content

Commit

Permalink
add bonus calendar proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
anjeshshrestha committed Nov 30, 2024
1 parent d0b5fc1 commit 0d3ceb2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
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));
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() {
this.amount = readInt(0x20);
this.lootId = readString(0x30);
}
}
}

0 comments on commit 0d3ceb2

Please sign in to comment.