Merge pull request #362 from Noremac201/testTestBarb

Added barbarian assault plugin
This commit is contained in:
Adam
2018-01-17 16:48:30 -05:00
committed by GitHub
10 changed files with 628 additions and 2 deletions

View File

@@ -112,7 +112,12 @@ public enum Varbits
/**
* Options
*/
SIDE_PANELS(4607, 1055, 8, 8);
SIDE_PANELS(4607, 1055, 8, 8),
/**
* Barbarian Assault
*/
IN_GAME_BA(3923, 638, 12, 12);
/**
* varbit id

View File

@@ -50,6 +50,10 @@ public class WidgetID
public static final int CHATBOX_GROUP_ID = 162;
public static final int WORLD_MAP_MENU_GROUP_ID = 160;
public static final int VOLCANIC_MINE_GROUP_ID = 611;
public static final int BA_ATTACKER_GROUP_ID = 485;
public static final int BA_COLLECTOR_GROUP_ID = 486;
public static final int BA_DEFENDER_GROUP_ID = 487;
public static final int BA_HEALER_GROUP_ID = 488;
static class WorldMap
{
@@ -227,4 +231,21 @@ public class WidgetID
static final int VENT_B_STATUS = 24;
static final int VENT_C_STATUS = 25;
}
static class BarbarianAssault
{
static class ATK
{
static final int CORRECT_STYLE2 = 4;
static final int TO_CALL = 6;
static final int ROLE = 8;
static final int ROLE_SPRITE = 7;
}
static final int CURRENT_WAVE = 1;
static final int CORRECT_STYLE = 3;
static final int TO_CALL = 5;
static final int ROLE_SPRITE = 6;
static final int ROLE = 7;
}
}

View File

@@ -128,7 +128,31 @@ public enum WidgetInfo
CHATBOX(WidgetID.CHATBOX_GROUP_ID, 0),
CHATBOX_MESSAGES(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_MESSAGES),
CHATBOX_BUTTONS(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_BUTTONS),
CHATBOX_REPORT_TEXT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_REPORT_TEXT);
CHATBOX_REPORT_TEXT(WidgetID.CHATBOX_GROUP_ID, WidgetID.Chatbox.CHATBOX_REPORT_TEXT),
BA_HEAL_WAVE_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.CURRENT_WAVE),
BA_HEAL_CALL_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.TO_CALL),
BA_HEAL_LISTEN_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.CORRECT_STYLE),
BA_HEAL_ROLE_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.ROLE),
BA_HEAL_ROLE_SPRITE(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.ROLE_SPRITE),
BA_COLL_WAVE_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.CURRENT_WAVE),
BA_COLL_CALL_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.TO_CALL),
BA_COLL_LISTEN_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.CORRECT_STYLE),
BA_COLL_ROLE_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.ROLE),
BA_COLL_ROLE_SPRITE(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.ROLE_SPRITE),
BA_ATK_WAVE_TEXT(WidgetID.BA_ATTACKER_GROUP_ID, WidgetID.BarbarianAssault.CURRENT_WAVE),
BA_ATK_CALL_TEXT(WidgetID.BA_ATTACKER_GROUP_ID, WidgetID.BarbarianAssault.ATK.TO_CALL),
BA_ATK_LISTEN_TEXT(WidgetID.BA_ATTACKER_GROUP_ID, WidgetID.BarbarianAssault.CORRECT_STYLE),
BA_ATK_ROLE_TEXT(WidgetID.BA_ATTACKER_GROUP_ID, WidgetID.BarbarianAssault.ATK.ROLE),
BA_ATK_ROLE_SPRITE(WidgetID.BA_ATTACKER_GROUP_ID, WidgetID.BarbarianAssault.ATK.ROLE_SPRITE),
BA_DEF_WAVE_TEXT(WidgetID.BA_DEFENDER_GROUP_ID, WidgetID.BarbarianAssault.CURRENT_WAVE),
BA_DEF_CALL_TEXT(WidgetID.BA_DEFENDER_GROUP_ID, WidgetID.BarbarianAssault.TO_CALL),
BA_DEF_LISTEN_TEXT(WidgetID.BA_DEFENDER_GROUP_ID, WidgetID.BarbarianAssault.CORRECT_STYLE),
BA_DEF_ROLE_TEXT(WidgetID.BA_DEFENDER_GROUP_ID, WidgetID.BarbarianAssault.ROLE),
BA_DEF_ROLE_SPRITE(WidgetID.BA_DEFENDER_GROUP_ID, WidgetID.BarbarianAssault.ROLE_SPRITE);
private final int groupId;
private final int childId;

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.barbarianassault;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(
keyName = "barbarianAssault",
name = "Barbarian Assault",
description = "Configuration for the barbarian assault plugin"
)
public interface BarbarianAssaultConfig extends Config
{
@ConfigItem(
keyName = "enabled",
name = "Enable plugin",
description = "Configures whether or not the plugin is enabled"
)
default boolean enabled()
{
return true;
}
@ConfigItem(
keyName = "removeUnused",
name = "Remove incorrect calls",
description = "Removes incorrect calls for Role horn"
)
default boolean removeWrong()
{
return true;
}
@ConfigItem(
keyName = "showTimer",
name = "Show call change timer",
description = "Show time to next call change"
)
default boolean showTimer()
{
return true;
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.barbarianassault;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import javax.inject.Inject;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.widgets.Widget;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
public class BarbarianAssaultOverlay extends Overlay
{
private final Client client;
private final BarbarianAssaultPlugin plugin;
private final BarbarianAssaultConfig config;
@Getter
@Setter
private Round currentRound;
@Inject
BarbarianAssaultOverlay(Client client, BarbarianAssaultPlugin plugin, BarbarianAssaultConfig config)
{
setPosition(OverlayPosition.DYNAMIC);
this.client = client;
this.plugin = plugin;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics, Point parent)
{
if (!config.enabled() || client.getGameState() != GameState.LOGGED_IN || currentRound == null)
{
return null;
}
Role role = currentRound.getRoundRole();
if (role == null)
{
return null;
}
Widget roleText = client.getWidget(role.getRoleText());
Widget roleSprite = client.getWidget(role.getRoleSprite());
if (config.showTimer() && roleText != null && roleSprite != null)
{
roleText.setText(String.format("00:%02d", currentRound.getTimeToChange()));
Rectangle spriteBounds = roleSprite.getBounds();
roleSprite.setHidden(true);
graphics.drawImage(plugin.getClockImage(), spriteBounds.x, spriteBounds.y, null);
}
return null;
}
}

View File

@@ -0,0 +1,212 @@
/*
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.barbarianassault;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Binder;
import com.google.inject.Provides;
import java.awt.Font;
import java.awt.Image;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.Varbits;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.kit.KitType;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
@PluginDescriptor(
name = "Barbarian Assault Plugin"
)
public class BarbarianAssaultPlugin extends Plugin
{
private final List<MenuEntry> entries = new ArrayList<>();
private static final int BA_ALL_KILLED_INDEX = 4;
private Font font;
private Image clockImage;
private int inGameBit = 0;
@Inject
Client client;
@Inject
BarbarianAssaultConfig config;
@Inject
BarbarianAssaultOverlay overlay;
@Provides
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(BarbarianAssaultConfig.class);
}
@Override
public void configure(Binder binder)
{
binder.bind(BarbarianAssaultOverlay.class);
}
@Override
protected void startUp() throws Exception
{
font = FontManager.getRunescapeFont()
.deriveFont(Font.BOLD, 24);
clockImage = ImageIO.read(getClass().getResourceAsStream("clock.png"));
}
@Subscribe
public void onGameTick(GameTick event)
{
if (client.getSetting(Varbits.IN_GAME_BA) == 1 &&
overlay.getCurrentRound() == null &&
client.getLocalPlayer() != null)
{
switch (client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.CAPE))
{
case ItemID.ATTACKER_ICON:
overlay.setCurrentRound(new Round(Role.ATTACKER));
break;
case ItemID.COLLECTOR_ICON:
overlay.setCurrentRound(new Round(Role.COLLECTOR));
break;
case ItemID.DEFENDER_ICON:
overlay.setCurrentRound(new Round(Role.DEFENDER));
break;
case ItemID.HEALER_ICON:
overlay.setCurrentRound(new Round(Role.HEALER));
break;
}
}
}
@Subscribe
public void onMenuOpen(MenuEntryAdded event)
{
if (config.removeWrong() && overlay.getCurrentRound() != null && event.getTarget().endsWith("horn"))
{
MenuEntry[] menuEntries = client.getMenuEntries();
WidgetInfo callInfo = overlay.getCurrentRound().getRoundRole().getCall();
Widget callWidget = client.getWidget(callInfo);
String call = Calls.getOption(callWidget.getText());
MenuEntry correctCall = null;
entries.clear();
for (MenuEntry entry : menuEntries)
{
String option = entry.getOption();
if (option.equals(call))
{
correctCall = entry;
}
else if (!option.startsWith("Tell-"))
{
entries.add(entry);
}
}
if (correctCall != null)
{
entries.add(correctCall);
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
}
}
}
@Subscribe
public void onVarbitChange(VarbitChanged event)
{
int inGame = client.getSetting(Varbits.IN_GAME_BA);
if (inGameBit != inGame && inGameBit == 1)
{
// end of game
overlay.setCurrentRound(null);
}
inGameBit = inGame;
}
@Subscribe
public void onMessageEvent(ChatMessage event)
{
if (event.getType() == ChatMessageType.SERVER
&& event.getMessage().startsWith("All of the Penance"))
{
String[] message = event.getMessage().split(" ");
Round round = overlay.getCurrentRound();
if (round != null)
{
switch (message[BA_ALL_KILLED_INDEX])
{
case "Healers":
round.setHealersKilled(true);
break;
case "Runners":
round.setRunnersKilled(true);
break;
case "Fighters":
round.setFightersKilled(true);
break;
case "Rangers":
round.setRangersKilled(true);
break;
}
}
}
}
@Override
public Overlay getOverlay()
{
return overlay;
}
public Font getFont()
{
return font;
}
public Image getClockImage()
{
return clockImage;
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.barbarianassault;
import java.util.HashMap;
import java.util.Map;
public enum Calls
{
//Attacker Calls
RED_EGG("Red egg", "Tell-red"),
GREEN_EGG("Green egg", "Tell-green"),
BLUE_EGG("Blue egg", "Tell-blue"),
//Collector Calls
CONTROLLED("Controlled/Bronze/Wind", "Tell-controlled"),
ACCURATE("Accurate/Iron/Water", "Tell-accurate"),
AGGRESSIVE("Aggressive/Steel/Earth", "Tell-aggressive"),
DEFENSIVE("Defensive/Mithril/Fire", "Tell-defensive"),
//Healer Calls
TOFU("Tofu", "Tell-tofu"),
CRACKERS("Crackers", "Tell-crackers"),
WORMS("Worms", "Tell-worms"),
//Defender Calls
POIS_WORMS("Pois. Worms", "Tell-worms"),
POIS_TOFU("Pois. Tofu", "Tell-tofu"),
POIS_MEAT("Pois. Meat", "Tell-meat");
private final String call;
private final String option;
private static final Map<String, String> CALL_MENU = new HashMap<>();
static
{
for (Calls s : values())
{
CALL_MENU.put(s.getCall(), s.getOption());
}
}
Calls(String call, String option)
{
this.call = call;
this.option = option;
}
public String getCall()
{
return call;
}
public String getOption()
{
return option;
}
public static String getOption(String call)
{
return CALL_MENU.get(call);
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.barbarianassault;
import lombok.Getter;
import net.runelite.api.widgets.WidgetInfo;
public enum Role
{
ATTACKER(WidgetInfo.BA_ATK_LISTEN_TEXT, WidgetInfo.BA_ATK_CALL_TEXT, WidgetInfo.BA_ATK_ROLE_TEXT, WidgetInfo.BA_ATK_ROLE_SPRITE),
DEFENDER(WidgetInfo.BA_DEF_LISTEN_TEXT, WidgetInfo.BA_DEF_CALL_TEXT, WidgetInfo.BA_DEF_ROLE_TEXT, WidgetInfo.BA_DEF_ROLE_SPRITE),
COLLECTOR(WidgetInfo.BA_COLL_LISTEN_TEXT, WidgetInfo.BA_COLL_CALL_TEXT, WidgetInfo.BA_COLL_ROLE_TEXT, WidgetInfo.BA_COLL_ROLE_SPRITE),
HEALER(WidgetInfo.BA_HEAL_LISTEN_TEXT, WidgetInfo.BA_HEAL_CALL_TEXT, WidgetInfo.BA_HEAL_ROLE_TEXT, WidgetInfo.BA_HEAL_ROLE_SPRITE);
@Getter
private final WidgetInfo listen;
@Getter
private final WidgetInfo call;
@Getter
private final WidgetInfo roleText;
@Getter
private final WidgetInfo roleSprite;
Role(WidgetInfo listen, WidgetInfo call, WidgetInfo role, WidgetInfo roleSprite)
{
this.listen = listen;
this.call = call;
this.roleText = role;
this.roleSprite = roleSprite;
}
@Override
public String toString()
{
return name();
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.barbarianassault;
import java.time.Duration;
import java.time.Instant;
import javax.inject.Inject;
import lombok.Getter;
import lombok.Setter;
public class Round
{
private final Instant roundStartTime;
@Getter
private final Role roundRole;
@Getter
@Setter
private boolean runnersKilled;
@Getter
@Setter
private boolean rangersKilled;
@Getter
@Setter
private boolean healersKilled;
@Getter
@Setter
private boolean fightersKilled;
@Inject
public Round(Role role)
{
this.roundRole = role;
this.roundStartTime = Instant.now().plusMillis(1200);
}
public long getRoundTime()
{
return Duration.between(roundStartTime, Instant.now()).getSeconds();
}
public long getTimeToChange()
{
return 30 + (Duration.between(Instant.now(), roundStartTime).getSeconds() % 30);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B