yad supp0rt
This commit is contained in:
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||||
|
* 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.inferno;
|
||||||
|
|
||||||
|
import net.runelite.api.AnimationID;
|
||||||
|
import net.runelite.api.Prayer;
|
||||||
|
|
||||||
|
public enum InfernoJadAttack
|
||||||
|
{
|
||||||
|
MAGIC(AnimationID.JALTOK_JAD_MAGE_ATTACK, Prayer.PROTECT_FROM_MAGIC),
|
||||||
|
RANGE(AnimationID.JALTOK_JAD_RANGE_ATTACK, Prayer.PROTECT_FROM_MISSILES);
|
||||||
|
|
||||||
|
private final int animation;
|
||||||
|
private final Prayer prayer;
|
||||||
|
|
||||||
|
InfernoJadAttack(int animation, Prayer prayer)
|
||||||
|
{
|
||||||
|
this.animation = animation;
|
||||||
|
this.prayer = prayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAnimation()
|
||||||
|
{
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Prayer getPrayer()
|
||||||
|
{
|
||||||
|
return prayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||||
|
* 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.inferno;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.SpriteID;
|
||||||
|
import net.runelite.client.game.SpriteManager;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||||
|
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
|
public class InfernoJadOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final InfernoPlugin plugin;
|
||||||
|
private final SpriteManager spriteManager;
|
||||||
|
private final PanelComponent imagePanelComponent = new PanelComponent();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfernoJadOverlay(Client client, InfernoPlugin plugin, SpriteManager spriteManager)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||||
|
setPriority(OverlayPriority.HIGH);
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.spriteManager = spriteManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
final InfernoJadAttack attack = plugin.getAttack();
|
||||||
|
|
||||||
|
if (attack == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final BufferedImage prayerImage = getPrayerImage(attack);
|
||||||
|
|
||||||
|
imagePanelComponent.getChildren().clear();
|
||||||
|
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||||
|
imagePanelComponent.setBackgroundColor(client.isPrayerActive(attack.getPrayer())
|
||||||
|
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||||
|
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
return imagePanelComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BufferedImage getPrayerImage(InfernoJadAttack attack)
|
||||||
|
{
|
||||||
|
final int prayerSpriteID = attack == InfernoJadAttack.MAGIC ? SpriteID.PRAYER_PROTECT_FROM_MAGIC : SpriteID.PRAYER_PROTECT_FROM_MISSILES;
|
||||||
|
return spriteManager.getSprite(prayerSpriteID, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,378 +1,427 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Jacky <liangj97@gmail.com>
|
* Copyright (c) 2019, Jacky <liangj97@gmail.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
* list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.inferno;
|
package net.runelite.client.plugins.inferno;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.annotation.Nullable;
|
||||||
import lombok.Getter;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.ChatMessageType;
|
import lombok.AccessLevel;
|
||||||
import net.runelite.api.Client;
|
import lombok.Getter;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.HeadIcon;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.NpcID;
|
import net.runelite.api.HeadIcon;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.NpcID;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.AnimationChanged;
|
||||||
import net.runelite.api.events.NpcDespawned;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.NpcSpawned;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.api.events.NpcDespawned;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.api.events.NpcSpawned;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
|
import net.runelite.client.plugins.PluginType;
|
||||||
@PluginDescriptor(
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
name = "Inferno",
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
description = "Inferno helper",
|
|
||||||
tags = {"combat", "overlay", "pve", "pvm"},
|
@PluginDescriptor(
|
||||||
type = PluginType.PVM
|
name = "Inferno",
|
||||||
)
|
description = "Inferno helper",
|
||||||
public class InfernoPlugin extends Plugin
|
tags = {"combat", "overlay", "pve", "pvm"},
|
||||||
{
|
type = PluginType.PVM
|
||||||
|
)
|
||||||
private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*");
|
public class InfernoPlugin extends Plugin
|
||||||
private static final int MAX_MONSTERS_OF_TYPE_PER_WAVE = 6;
|
{
|
||||||
private static final int INFERNO_REGION = 9043;
|
|
||||||
static final int MAX_WAVE = 69;
|
private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*");
|
||||||
|
private static final int MAX_MONSTERS_OF_TYPE_PER_WAVE = 6;
|
||||||
@Inject
|
private static final int INFERNO_REGION = 9043;
|
||||||
private Client client;
|
static final int MAX_WAVE = 69;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InfernoOverlay infernoOverlay;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InfernoWaveOverlay waveOverlay;
|
private InfernoOverlay infernoOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InfernoInfobox infernoInfobox;
|
private InfernoWaveOverlay waveOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InfernoNibblerOverlay nibblerOverlay;
|
private InfernoJadOverlay jadOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InfernoConfig config;
|
private InfernoInfobox infernoInfobox;
|
||||||
|
|
||||||
@Getter
|
@Inject
|
||||||
static final List<EnumMap<InfernoWaveMonster, Integer>> WAVES = new ArrayList<>();
|
private InfernoNibblerOverlay nibblerOverlay;
|
||||||
|
|
||||||
@Getter
|
@Inject
|
||||||
private int currentWave = -1;
|
private InfernoConfig config;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Map<NPC, InfernoNPC> monsters;
|
static final List<EnumMap<InfernoWaveMonster, Integer>> WAVES = new ArrayList<>();
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Map<Integer, ArrayList<InfernoNPC>> monsterCurrentAttackMap;
|
private int currentWave = -1;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private List<NPC> nibblers;
|
private Map<NPC, InfernoNPC> monsters;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private InfernoNPC[] priorityNPC;
|
private Map<Integer, ArrayList<InfernoNPC>> monsterCurrentAttackMap;
|
||||||
|
|
||||||
static
|
@Getter
|
||||||
{
|
private List<NPC> nibblers;
|
||||||
final InfernoWaveMonster[] waveMonsters = InfernoWaveMonster.values();
|
|
||||||
|
@Getter
|
||||||
// Add wave 1, future waves are derived from its contents
|
private InfernoNPC[] priorityNPC;
|
||||||
final EnumMap<InfernoWaveMonster, Integer> waveOne = new EnumMap<>(InfernoWaveMonster.class);
|
|
||||||
waveOne.put(waveMonsters[0], 1);
|
|
||||||
WAVES.add(waveOne);
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Nullable
|
||||||
for (int wave = 1; wave < MAX_WAVE; wave++)
|
private InfernoJadAttack attack;
|
||||||
{
|
|
||||||
final EnumMap<InfernoWaveMonster, Integer> prevWave = WAVES.get(wave - 1).clone();
|
private NPC jad;
|
||||||
int maxMonsterOrdinal = -1;
|
|
||||||
|
|
||||||
for (int i = 0; i < waveMonsters.length; i++)
|
static
|
||||||
{
|
{
|
||||||
final int ordinalMonsterQuantity = prevWave.getOrDefault(waveMonsters[i], 0);
|
final InfernoWaveMonster[] waveMonsters = InfernoWaveMonster.values();
|
||||||
|
|
||||||
if (ordinalMonsterQuantity == MAX_MONSTERS_OF_TYPE_PER_WAVE)
|
// Add wave 1, future waves are derived from its contents
|
||||||
{
|
final EnumMap<InfernoWaveMonster, Integer> waveOne = new EnumMap<>(InfernoWaveMonster.class);
|
||||||
maxMonsterOrdinal = i;
|
waveOne.put(waveMonsters[0], 1);
|
||||||
break;
|
WAVES.add(waveOne);
|
||||||
}
|
|
||||||
}
|
for (int wave = 1; wave < MAX_WAVE; wave++)
|
||||||
|
{
|
||||||
if (maxMonsterOrdinal >= 0)
|
final EnumMap<InfernoWaveMonster, Integer> prevWave = WAVES.get(wave - 1).clone();
|
||||||
{
|
int maxMonsterOrdinal = -1;
|
||||||
prevWave.remove(waveMonsters[maxMonsterOrdinal]);
|
|
||||||
}
|
for (int i = 0; i < waveMonsters.length; i++)
|
||||||
|
{
|
||||||
final int addedMonsterOrdinal = maxMonsterOrdinal >= 0 ? maxMonsterOrdinal + 1 : 0;
|
final int ordinalMonsterQuantity = prevWave.getOrDefault(waveMonsters[i], 0);
|
||||||
final InfernoWaveMonster addedMonster = waveMonsters[addedMonsterOrdinal];
|
|
||||||
final int addedMonsterQuantity = prevWave.getOrDefault(addedMonster, 0);
|
if (ordinalMonsterQuantity == MAX_MONSTERS_OF_TYPE_PER_WAVE)
|
||||||
|
{
|
||||||
prevWave.put(addedMonster, addedMonsterQuantity + 1);
|
maxMonsterOrdinal = i;
|
||||||
|
break;
|
||||||
WAVES.add(prevWave);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (maxMonsterOrdinal >= 0)
|
||||||
@Provides
|
{
|
||||||
InfernoConfig provideConfig(ConfigManager configManager)
|
prevWave.remove(waveMonsters[maxMonsterOrdinal]);
|
||||||
{
|
}
|
||||||
return configManager.getConfig(InfernoConfig.class);
|
|
||||||
}
|
final int addedMonsterOrdinal = maxMonsterOrdinal >= 0 ? maxMonsterOrdinal + 1 : 0;
|
||||||
|
final InfernoWaveMonster addedMonster = waveMonsters[addedMonsterOrdinal];
|
||||||
@Override
|
final int addedMonsterQuantity = prevWave.getOrDefault(addedMonster, 0);
|
||||||
protected void startUp() throws Exception
|
|
||||||
{
|
prevWave.put(addedMonster, addedMonsterQuantity + 1);
|
||||||
overlayManager.add(infernoOverlay);
|
|
||||||
overlayManager.add(infernoInfobox);
|
WAVES.add(prevWave);
|
||||||
overlayManager.add(nibblerOverlay);
|
}
|
||||||
overlayManager.add(waveOverlay);
|
}
|
||||||
monsters = new HashMap<>();
|
|
||||||
monsterCurrentAttackMap = new HashMap<>(6);
|
@Provides
|
||||||
for (int i = 1; i <= 6; i++)
|
InfernoConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
monsterCurrentAttackMap.put(i, new ArrayList<>());
|
return configManager.getConfig(InfernoConfig.class);
|
||||||
}
|
}
|
||||||
nibblers = new ArrayList<>();
|
|
||||||
priorityNPC = new InfernoNPC[4];
|
@Override
|
||||||
}
|
protected void startUp() throws Exception
|
||||||
|
{
|
||||||
@Override
|
overlayManager.add(infernoOverlay);
|
||||||
protected void shutDown() throws Exception
|
overlayManager.add(infernoInfobox);
|
||||||
{
|
overlayManager.add(nibblerOverlay);
|
||||||
overlayManager.remove(infernoInfobox);
|
overlayManager.add(waveOverlay);
|
||||||
overlayManager.remove(infernoOverlay);
|
overlayManager.add(jadOverlay);
|
||||||
overlayManager.remove(nibblerOverlay);
|
monsters = new HashMap<>();
|
||||||
overlayManager.remove(waveOverlay);
|
monsterCurrentAttackMap = new HashMap<>(6);
|
||||||
}
|
for (int i = 1; i <= 6; i++)
|
||||||
|
{
|
||||||
@Subscribe
|
monsterCurrentAttackMap.put(i, new ArrayList<>());
|
||||||
public void onNpcSpawned(NpcSpawned event)
|
}
|
||||||
{
|
nibblers = new ArrayList<>();
|
||||||
if (client.getMapRegions()[0] != 9043) return;
|
priorityNPC = new InfernoNPC[4];
|
||||||
|
}
|
||||||
NPC npc = event.getNpc();
|
|
||||||
if (isValidInfernoMob(npc))
|
@Override
|
||||||
{
|
protected void shutDown() throws Exception
|
||||||
monsters.put(npc, new InfernoNPC(npc));
|
{
|
||||||
System.out.println(monsters.size());
|
overlayManager.remove(infernoInfobox);
|
||||||
}
|
overlayManager.remove(infernoOverlay);
|
||||||
if (npc.getId() == NpcID.JALNIB)
|
overlayManager.remove(nibblerOverlay);
|
||||||
{
|
overlayManager.remove(waveOverlay);
|
||||||
nibblers.add(npc);
|
overlayManager.remove(jadOverlay);
|
||||||
}
|
jad = null;
|
||||||
}
|
attack = null;
|
||||||
|
}
|
||||||
@Subscribe
|
|
||||||
public void onNpcDespawned(NpcDespawned event)
|
@Subscribe
|
||||||
{
|
public void onNpcSpawned(NpcSpawned event)
|
||||||
if (client.getMapRegions()[0] != 9043) return;
|
{
|
||||||
|
if (client.getMapRegions()[0] != 9043) return;
|
||||||
NPC npc = event.getNpc();
|
|
||||||
if (monsters.containsKey(npc))
|
NPC npc = event.getNpc();
|
||||||
{
|
if (isValidInfernoMob(npc))
|
||||||
monsters.remove(npc);
|
{
|
||||||
System.out.println(monsters.size());
|
monsters.put(npc, new InfernoNPC(npc));
|
||||||
}
|
System.out.println(monsters.size());
|
||||||
|
}
|
||||||
if (npc.getId() == NpcID.JALNIB)
|
if (npc.getId() == NpcID.JALNIB)
|
||||||
{
|
{
|
||||||
nibblers.remove(npc);
|
nibblers.add(npc);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
final int id = event.getNpc().getId();
|
||||||
@Subscribe
|
|
||||||
public void onGameStateChanged(GameStateChanged event)
|
if (id == NpcID.JALTOKJAD || id == NpcID.JALTOKJAD_7704)
|
||||||
{
|
{
|
||||||
if (event.getGameState() != GameState.LOGGED_IN)
|
jad = event.getNpc();
|
||||||
{
|
}
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
@Subscribe
|
||||||
if (!inInferno())
|
public void onNpcDespawned(NpcDespawned event)
|
||||||
{
|
{
|
||||||
currentWave = -1;
|
if (client.getMapRegions()[0] != 9043) return;
|
||||||
}
|
|
||||||
}
|
NPC npc = event.getNpc();
|
||||||
|
if (monsters.containsKey(npc))
|
||||||
@Subscribe
|
{
|
||||||
public void onChatMessage(ChatMessage event)
|
monsters.remove(npc);
|
||||||
{
|
System.out.println(monsters.size());
|
||||||
final Matcher waveMatcher = WAVE_PATTERN.matcher(event.getMessage());
|
}
|
||||||
|
|
||||||
if (event.getType() != ChatMessageType.GAMEMESSAGE
|
if (npc.getId() == NpcID.JALNIB)
|
||||||
|| !inInferno()
|
{
|
||||||
|| !waveMatcher.matches())
|
nibblers.remove(npc);
|
||||||
{
|
}
|
||||||
return;
|
|
||||||
}
|
if (jad == event.getNpc())
|
||||||
|
{
|
||||||
currentWave = Integer.parseInt(waveMatcher.group(1));
|
jad = null;
|
||||||
}
|
attack = null;
|
||||||
|
}
|
||||||
@Subscribe
|
}
|
||||||
public void onGameTick(GameTick event)
|
|
||||||
{
|
@Subscribe
|
||||||
if (client.getMapRegions()[0] != 9043) return;
|
public void onGameStateChanged(GameStateChanged event)
|
||||||
|
{
|
||||||
clearMapAndPriority();
|
if (event.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
for (InfernoNPC monster : monsters.values())
|
return;
|
||||||
{
|
}
|
||||||
calculateDistanceToPlayer(monster);
|
|
||||||
|
if (!inInferno())
|
||||||
NPC npc = monster.getNpc();
|
{
|
||||||
|
currentWave = -1;
|
||||||
// if they are not attacking but are still attacking
|
}
|
||||||
if (monster.isAttacking())
|
}
|
||||||
{
|
|
||||||
monster.setTicksTillAttack(monster.getTicksTillAttack() - 1);
|
@Subscribe
|
||||||
|
public void onChatMessage(ChatMessage event)
|
||||||
// sets the blobs attack style
|
{
|
||||||
if (monster.getName().equals("blob") && monster.getTicksTillAttack() == 3 && monster.getDistanceToPlayer() <= 15)
|
final Matcher waveMatcher = WAVE_PATTERN.matcher(event.getMessage());
|
||||||
{
|
|
||||||
if (client.getLocalPlayer().getOverheadIcon() == null)
|
if (event.getType() != ChatMessageType.GAMEMESSAGE
|
||||||
{
|
|| !inInferno()
|
||||||
monster.setAttackstyle(InfernoNPC.Attackstyle.RANDOM);
|
|| !waveMatcher.matches())
|
||||||
}
|
{
|
||||||
else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.MAGIC))
|
return;
|
||||||
{
|
}
|
||||||
monster.setAttackstyle(InfernoNPC.Attackstyle.RANGE);
|
|
||||||
}
|
currentWave = Integer.parseInt(waveMatcher.group(1));
|
||||||
else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.RANGED))
|
}
|
||||||
{
|
|
||||||
monster.setAttackstyle(InfernoNPC.Attackstyle.MAGE);
|
@Subscribe
|
||||||
}
|
public void onGameTick(GameTick event)
|
||||||
}
|
{
|
||||||
|
if (client.getMapRegions()[0] != 9043) return;
|
||||||
// we know the monster is not attacking because it should have attacked and is idling
|
|
||||||
if (monster.getTicksTillAttack() == 0)
|
clearMapAndPriority();
|
||||||
{
|
|
||||||
if (npc.getAnimation() == -1)
|
for (InfernoNPC monster : monsters.values())
|
||||||
{
|
{
|
||||||
monster.setAttacking(false);
|
calculateDistanceToPlayer(monster);
|
||||||
}
|
|
||||||
else
|
NPC npc = monster.getNpc();
|
||||||
{
|
|
||||||
// want to reset the monsters attack back to attacking
|
// if they are not attacking but are still attacking
|
||||||
monster.attacked();
|
if (monster.isAttacking())
|
||||||
}
|
{
|
||||||
}
|
monster.setTicksTillAttack(monster.getTicksTillAttack() - 1);
|
||||||
}
|
|
||||||
else
|
// sets the blobs attack style
|
||||||
{
|
if (monster.getName().equals("blob") && monster.getTicksTillAttack() == 3 && monster.getDistanceToPlayer() <= 15)
|
||||||
// they've just attacked
|
{
|
||||||
if (npc.getAnimation() == monster.getAttackAnimation() || npc.getAnimation() == 7581) // special case for blob
|
if (client.getLocalPlayer().getOverheadIcon() == null)
|
||||||
{
|
{
|
||||||
monster.attacked();
|
monster.setAttackstyle(InfernoNPC.Attackstyle.RANDOM);
|
||||||
}
|
}
|
||||||
}
|
else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.MAGIC))
|
||||||
|
{
|
||||||
if (monster.getTicksTillAttack() >= 1)
|
monster.setAttackstyle(InfernoNPC.Attackstyle.RANGE);
|
||||||
{
|
}
|
||||||
monsterCurrentAttackMap.get(monster.getTicksTillAttack()).add(monster);
|
else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.RANGED))
|
||||||
}
|
{
|
||||||
}
|
monster.setAttackstyle(InfernoNPC.Attackstyle.MAGE);
|
||||||
|
}
|
||||||
calculatePriorityNPC();
|
}
|
||||||
}
|
|
||||||
|
// we know the monster is not attacking because it should have attacked and is idling
|
||||||
private void calculatePriorityNPC()
|
if (monster.getTicksTillAttack() == 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < priorityNPC.length; i++)
|
if (npc.getAnimation() == -1)
|
||||||
{
|
{
|
||||||
ArrayList<InfernoNPC> monsters = monsterCurrentAttackMap.get(i + 1);
|
monster.setAttacking(false);
|
||||||
|
}
|
||||||
if ( monsters.size() == 0) continue;
|
else
|
||||||
|
{
|
||||||
int priority = monsters.get(0).getPriority();
|
// want to reset the monsters attack back to attacking
|
||||||
|
monster.attacked();
|
||||||
InfernoNPC infernoNPC = monsters.get(0);
|
}
|
||||||
|
}
|
||||||
for (InfernoNPC npc : monsters)
|
}
|
||||||
{
|
else
|
||||||
if (npc.getPriority() < priority)
|
{
|
||||||
{
|
// they've just attacked
|
||||||
priority = npc.getPriority();
|
if (npc.getAnimation() == monster.getAttackAnimation() || npc.getAnimation() == 7581) // special case for blob
|
||||||
infernoNPC = npc;
|
{
|
||||||
}
|
monster.attacked();
|
||||||
}
|
}
|
||||||
priorityNPC[i] = infernoNPC;
|
}
|
||||||
System.out.println("i: " + i + " " + infernoNPC.getName());
|
|
||||||
}
|
if (monster.getTicksTillAttack() >= 1)
|
||||||
}
|
{
|
||||||
|
monsterCurrentAttackMap.get(monster.getTicksTillAttack()).add(monster);
|
||||||
// TODO: blob calculator
|
}
|
||||||
private void calculateDistanceToPlayer(InfernoNPC monster)
|
}
|
||||||
{
|
|
||||||
monster.setDistanceToPlayer(client.getLocalPlayer().getWorldLocation().distanceTo(monster.getNpc().getWorldArea()));
|
calculatePriorityNPC();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearMapAndPriority()
|
@Subscribe
|
||||||
{
|
public void onAnimationChanged(final AnimationChanged event)
|
||||||
for (List<InfernoNPC> l : monsterCurrentAttackMap.values())
|
{
|
||||||
{
|
if (event.getActor() != jad)
|
||||||
l.clear();
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
for (int i = 0; i < priorityNPC.length; i++)
|
|
||||||
{
|
if (jad.getAnimation() == InfernoJadAttack.MAGIC.getAnimation())
|
||||||
priorityNPC[i] = null;
|
{
|
||||||
}
|
attack = InfernoJadAttack.MAGIC;
|
||||||
}
|
}
|
||||||
|
else if (jad.getAnimation() == InfernoJadAttack.RANGE.getAnimation())
|
||||||
public boolean isValidInfernoMob(NPC npc)
|
{
|
||||||
{
|
attack = InfernoJadAttack.RANGE;
|
||||||
// we only want the bat, blob, melee, ranger and mager
|
}
|
||||||
if (npc.getId() == NpcID.JALMEJRAH ||
|
}
|
||||||
npc.getId() == NpcID.JALAK ||
|
|
||||||
npc.getId() == NpcID.JALIMKOT ||
|
private void calculatePriorityNPC()
|
||||||
npc.getId() == NpcID.JALXIL ||
|
{
|
||||||
npc.getId() == NpcID.JALZEK) return true;
|
for (int i = 0; i < priorityNPC.length; i++)
|
||||||
|
{
|
||||||
return false;
|
ArrayList<InfernoNPC> monsters = monsterCurrentAttackMap.get(i + 1);
|
||||||
}
|
|
||||||
|
if ( monsters.size() == 0) continue;
|
||||||
boolean inInferno()
|
|
||||||
{
|
int priority = monsters.get(0).getPriority();
|
||||||
return ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION);
|
|
||||||
}
|
InfernoNPC infernoNPC = monsters.get(0);
|
||||||
|
|
||||||
static String formatMonsterQuantity(final InfernoWaveMonster monster, final int quantity)
|
for (InfernoNPC npc : monsters)
|
||||||
{
|
{
|
||||||
return String.format("%dx %s", quantity, monster);
|
if (npc.getPriority() < priority)
|
||||||
}
|
{
|
||||||
|
priority = npc.getPriority();
|
||||||
}
|
infernoNPC = npc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
priorityNPC[i] = infernoNPC;
|
||||||
|
System.out.println("i: " + i + " " + infernoNPC.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: blob calculator
|
||||||
|
private void calculateDistanceToPlayer(InfernoNPC monster)
|
||||||
|
{
|
||||||
|
monster.setDistanceToPlayer(client.getLocalPlayer().getWorldLocation().distanceTo(monster.getNpc().getWorldArea()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearMapAndPriority()
|
||||||
|
{
|
||||||
|
for (List<InfernoNPC> l : monsterCurrentAttackMap.values())
|
||||||
|
{
|
||||||
|
l.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < priorityNPC.length; i++)
|
||||||
|
{
|
||||||
|
priorityNPC[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValidInfernoMob(NPC npc)
|
||||||
|
{
|
||||||
|
// we only want the bat, blob, melee, ranger and mager
|
||||||
|
if (npc.getId() == NpcID.JALMEJRAH ||
|
||||||
|
npc.getId() == NpcID.JALAK ||
|
||||||
|
npc.getId() == NpcID.JALIMKOT ||
|
||||||
|
npc.getId() == NpcID.JALXIL ||
|
||||||
|
npc.getId() == NpcID.JALZEK) return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean inInferno()
|
||||||
|
{
|
||||||
|
return ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String formatMonsterQuantity(final InfernoWaveMonster monster, final int quantity)
|
||||||
|
{
|
||||||
|
return String.format("%dx %s", quantity, monster);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user