babyhydra: Merge nested is statements
This commit is contained in:
@@ -53,17 +53,14 @@ public class BabyHydraIndicatorOverlay extends Overlay
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
if (plugin.getHydra() != null)
|
if (plugin.getHydra() != null && plugin.getHydras().containsKey(plugin.getHydra().getIndex()))
|
||||||
{
|
{
|
||||||
if (plugin.getHydras().containsKey(plugin.getHydra().getIndex()))
|
int val = plugin.getHydras().get(plugin.getHydra().getIndex());
|
||||||
|
if (val != 0)
|
||||||
{
|
{
|
||||||
int val = plugin.getHydras().get(plugin.getHydra().getIndex());
|
panelComponent.getChildren().clear();
|
||||||
if (val != 0)
|
panelComponent.getChildren().add(LineComponent.builder().right(Integer.toString(val)).build());
|
||||||
{
|
return panelComponent.render(graphics);
|
||||||
panelComponent.getChildren().clear();
|
|
||||||
panelComponent.getChildren().add(LineComponent.builder().right(Integer.toString(val)).build());
|
|
||||||
return panelComponent.render(graphics);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -65,52 +65,49 @@ public class BabyHydraOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
if (hydra.getName().equalsIgnoreCase("Hydra") && plugin.getHydras().containsKey(hydra.getIndex()))
|
||||||
{
|
{
|
||||||
if (plugin.getHydras().containsKey(hydra.getIndex()))
|
int val = plugin.getHydras().get(hydra.getIndex());
|
||||||
|
if (val != 0)
|
||||||
{
|
{
|
||||||
int val = plugin.getHydras().get(hydra.getIndex());
|
if (plugin.isBoldText())
|
||||||
if (val != 0)
|
|
||||||
{
|
{
|
||||||
if (plugin.isBoldText())
|
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||||
{
|
}
|
||||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
if (plugin.getHydraattacks().containsKey(hydra.getIndex()))
|
||||||
}
|
{
|
||||||
if (plugin.getHydraattacks().containsKey(hydra.getIndex()))
|
int attack = plugin.getHydraattacks().get(hydra.getIndex());
|
||||||
{
|
|
||||||
int attack = plugin.getHydraattacks().get(hydra.getIndex());
|
|
||||||
|
|
||||||
Point textLocation = hydra.getCanvasTextLocation(graphics, "TEMP!!", hydra.getLogicalHeight() + 100);
|
Point textLocation = hydra.getCanvasTextLocation(graphics, "TEMP!!", hydra.getLogicalHeight() + 100);
|
||||||
|
|
||||||
if (textLocation != null && attack == 8261)
|
if (textLocation != null && attack == 8261)
|
||||||
|
{
|
||||||
|
if (val == 3)
|
||||||
{
|
{
|
||||||
if (val == 3)
|
OverlayUtil.renderTextLocation(graphics, textLocation, "MAGE", Color.BLUE);
|
||||||
{
|
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, "MAGE", Color.BLUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, "RANGE", Color.GREEN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (textLocation != null && attack == 8262)
|
else
|
||||||
{
|
{
|
||||||
if (val == 3)
|
OverlayUtil.renderTextLocation(graphics, textLocation, "RANGE", Color.GREEN);
|
||||||
{
|
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, "RANGE", Color.GREEN);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, "MAGE", Color.BLUE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Point hydraPoint = hydra.getCanvasTextLocation(graphics, Integer.toString(val), hydra.getLogicalHeight() + 40);
|
else if (textLocation != null && attack == 8262)
|
||||||
if (hydraPoint != null)
|
|
||||||
{
|
{
|
||||||
OverlayUtil.renderTextLocation(graphics, hydraPoint, Integer.toString(val), Color.WHITE);
|
if (val == 3)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTextLocation(graphics, textLocation, "RANGE", Color.GREEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTextLocation(graphics, textLocation, "MAGE", Color.BLUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Point hydraPoint = hydra.getCanvasTextLocation(graphics, Integer.toString(val), hydra.getLogicalHeight() + 40);
|
||||||
|
if (hydraPoint != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTextLocation(graphics, hydraPoint, Integer.toString(val), Color.WHITE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,15 +159,9 @@ public class BabyHydraPlugin extends Plugin
|
|||||||
public void onNpcSpawned(NpcSpawned event)
|
public void onNpcSpawned(NpcSpawned event)
|
||||||
{
|
{
|
||||||
NPC hydra = event.getNpc();
|
NPC hydra = event.getNpc();
|
||||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null)
|
if (hydra.getCombatLevel() != 0 && hydra.getName() != null && hydra.getName().equalsIgnoreCase("Hydra") && !hydras.containsKey(hydra.getIndex()))
|
||||||
{
|
{
|
||||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
hydras.put(hydra.getIndex(), 3);
|
||||||
{
|
|
||||||
if (!hydras.containsKey(hydra.getIndex()))
|
|
||||||
{
|
|
||||||
hydras.put(hydra.getIndex(), 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,13 +169,10 @@ public class BabyHydraPlugin extends Plugin
|
|||||||
public void onNpcDespawned(NpcDespawned event)
|
public void onNpcDespawned(NpcDespawned event)
|
||||||
{
|
{
|
||||||
NPC hydra = event.getNpc();
|
NPC hydra = event.getNpc();
|
||||||
if (hydra.getCombatLevel() != 0 && hydra.getName() != null)
|
if (hydra.getCombatLevel() != 0 && hydra.getName() != null && hydra.getName().equalsIgnoreCase("Hydra"))
|
||||||
{
|
{
|
||||||
if (hydra.getName().equalsIgnoreCase("Hydra"))
|
hydras.remove(hydra.getIndex());
|
||||||
{
|
hydraattacks.remove(hydra.getIndex());
|
||||||
hydras.remove(hydra.getIndex());
|
|
||||||
hydraattacks.remove(hydra.getIndex());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,62 +78,56 @@ public class BabyHydraPrayOverlay extends Overlay
|
|||||||
PRAY_RANGED = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
PRAY_RANGED = spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.getHydra() != null)
|
if (plugin.getHydra() != null && plugin.getHydras().containsKey(plugin.getHydra().getIndex()))
|
||||||
{
|
{
|
||||||
if (plugin.getHydras().containsKey(plugin.getHydra().getIndex()))
|
int val = plugin.getHydras().get(plugin.getHydra().getIndex());
|
||||||
|
if (val != 0 && plugin.getHydraattacks().containsKey(plugin.getHydra().getIndex()))
|
||||||
{
|
{
|
||||||
int val = plugin.getHydras().get(plugin.getHydra().getIndex());
|
int attack = plugin.getHydraattacks().get(plugin.getHydra().getIndex());
|
||||||
if (val != 0)
|
if (attack == 8261)
|
||||||
{
|
{
|
||||||
if (plugin.getHydraattacks().containsKey(plugin.getHydra().getIndex()))
|
if (val == 3)
|
||||||
{
|
{
|
||||||
int attack = plugin.getHydraattacks().get(plugin.getHydra().getIndex());
|
imagePanelComponent.getChildren().clear();
|
||||||
if (attack == 8261)
|
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_MAGE));
|
||||||
{
|
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
||||||
if (val == 3)
|
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||||
{
|
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||||
imagePanelComponent.getChildren().clear();
|
|
||||||
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_MAGE));
|
|
||||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
|
||||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
|
||||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
|
||||||
|
|
||||||
return imagePanelComponent.render(graphics);
|
return imagePanelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imagePanelComponent.getChildren().clear();
|
imagePanelComponent.getChildren().clear();
|
||||||
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_RANGED));
|
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_RANGED));
|
||||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
||||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
return imagePanelComponent.render(graphics);
|
return imagePanelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (attack == 8262)
|
else if (attack == 8262)
|
||||||
{
|
{
|
||||||
if (val == 3)
|
if (val == 3)
|
||||||
{
|
{
|
||||||
imagePanelComponent.getChildren().clear();
|
imagePanelComponent.getChildren().clear();
|
||||||
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_RANGED));
|
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_RANGED));
|
||||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MISSILES)
|
||||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
return imagePanelComponent.render(graphics);
|
return imagePanelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imagePanelComponent.getChildren().clear();
|
imagePanelComponent.getChildren().clear();
|
||||||
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_MAGE));
|
imagePanelComponent.getChildren().add(new ImageComponent(PRAY_MAGE));
|
||||||
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
imagePanelComponent.setBackgroundColor(client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC)
|
||||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
return imagePanelComponent.render(graphics);
|
return imagePanelComponent.render(graphics);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user