theatre: MErge nested if statements
This commit is contained in:
@@ -134,13 +134,10 @@ public class BloatHandler extends RoomHandler
|
||||
@Subscribe
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
if (client.getVar(Varbits.BLOAT_DOOR) == 1)
|
||||
if (client.getVar(Varbits.BLOAT_DOOR) == 1 && !bloatFlag)
|
||||
{
|
||||
if (!bloatFlag)
|
||||
{
|
||||
bloatTimer = 0;
|
||||
bloatFlag = true;
|
||||
}
|
||||
bloatTimer = 0;
|
||||
bloatFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,12 +240,9 @@ public class MaidenHandler extends RoomHandler
|
||||
{
|
||||
NPC npc = event.getNpc();
|
||||
|
||||
if (npc.getName() != null && npc.getName().equals("Nylocas Matomenos"))
|
||||
if (npc.getName() != null && npc.getName().equals("Nylocas Matomenos") && npc.getId() == -1)
|
||||
{
|
||||
if (npc.getId() == -1)
|
||||
{
|
||||
nylos.removeIf(c -> c.getNpc() == npc);
|
||||
}
|
||||
nylos.removeIf(c -> c.getNpc() == npc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,78 +105,60 @@ public class VerzikHandler extends RoomHandler
|
||||
|
||||
if (id == TheatreConstant.VERZIK_ID_P1)
|
||||
{
|
||||
if (plugin.isP1attacks())
|
||||
if (plugin.isP1attacks() && this.versikCounter >= 0)
|
||||
{
|
||||
if (this.versikCounter >= 0)
|
||||
{
|
||||
String str = Integer.toString(versikCounter);
|
||||
String str = Integer.toString(versikCounter);
|
||||
|
||||
LocalPoint lp = npc.getLocalLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0);
|
||||
LocalPoint lp = npc.getLocalLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0);
|
||||
|
||||
renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point);
|
||||
}
|
||||
renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point);
|
||||
}
|
||||
}
|
||||
else if (id == TheatreConstant.VERZIK_ID_P2)
|
||||
{
|
||||
if (plugin.isP2attacks())
|
||||
if (plugin.isP2attacks() && this.versikCounter >= 0)
|
||||
{
|
||||
if (this.versikCounter >= 0)
|
||||
{
|
||||
String str = Integer.toString(versikCounter);
|
||||
String str = Integer.toString(versikCounter);
|
||||
|
||||
LocalPoint lp = npc.getLocalLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0);
|
||||
LocalPoint lp = npc.getLocalLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0);
|
||||
|
||||
renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point);
|
||||
}
|
||||
renderTextLocation(graphics, str, 20, Font.BOLD, Color.CYAN, point);
|
||||
}
|
||||
}
|
||||
|
||||
else if (id == TheatreConstant.VERZIK_ID_P3)
|
||||
else if (id == TheatreConstant.VERZIK_ID_P3 && plugin.isP3attacks() && versikCounter > 0 && versikCounter < 8)
|
||||
{
|
||||
if (plugin.isP3attacks())
|
||||
{
|
||||
if (versikCounter > 0 && versikCounter < 8)
|
||||
{
|
||||
String str = Math.max(versikCounter, 0) + "";// + " | " + model.getModelHeight();// + " | " + model.getRadius();
|
||||
String str = Math.max(versikCounter, 0) + "";// + " | " + model.getModelHeight();// + " | " + model.getRadius();
|
||||
|
||||
LocalPoint lp = npc.getLocalLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0);
|
||||
LocalPoint lp = npc.getLocalLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, str, 0);
|
||||
|
||||
renderTextLocation(graphics, str, 15, Font.BOLD, Color.WHITE, point);
|
||||
}
|
||||
}
|
||||
renderTextLocation(graphics, str, 15, Font.BOLD, Color.WHITE, point);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isVerzikTankTile())
|
||||
if (plugin.isVerzikTankTile() && id == TheatreConstant.VERZIK_ID_P3)
|
||||
{
|
||||
if (id == TheatreConstant.VERZIK_ID_P3)
|
||||
{
|
||||
WorldPoint wp = new WorldPoint(npc.getWorldLocation().getX() + 3, npc.getWorldLocation().getY() + 3, client.getPlane());
|
||||
drawTile2(graphics, wp, new Color(75, 0, 130), 2, 255, 0);
|
||||
//renderNpcOverlay(graphics, boss, new Color(75, 0, 130), 1, 255, 0);
|
||||
}
|
||||
|
||||
WorldPoint wp = new WorldPoint(npc.getWorldLocation().getX() + 3, npc.getWorldLocation().getY() + 3, client.getPlane());
|
||||
drawTile2(graphics, wp, new Color(75, 0, 130), 2, 255, 0);
|
||||
//renderNpcOverlay(graphics, boss, new Color(75, 0, 130), 1, 255, 0);
|
||||
}
|
||||
|
||||
if (plugin.isShowVerzikYellows())
|
||||
{
|
||||
if (this.yellows > 0)
|
||||
{
|
||||
String text = Integer.toString(this.yellows);
|
||||
|
||||
for (GraphicsObject object : client.getGraphicsObjects())
|
||||
if (plugin.isShowVerzikYellows() && this.yellows > 0)
|
||||
{
|
||||
String text = Integer.toString(this.yellows);
|
||||
|
||||
for (GraphicsObject object : client.getGraphicsObjects())
|
||||
{
|
||||
if (object.getId() == TheatreConstant.GRAPHIC_ID_YELLOWS)
|
||||
{
|
||||
if (object.getId() == TheatreConstant.GRAPHIC_ID_YELLOWS)
|
||||
{
|
||||
drawTile(graphics, WorldPoint.fromLocal(client, object.getLocation()), Color.YELLOW, 3, 255, 0);
|
||||
LocalPoint lp = object.getLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, text, 0);
|
||||
renderTextLocation(graphics, text, 12, Font.BOLD, Color.WHITE, point);
|
||||
}
|
||||
drawTile(graphics, WorldPoint.fromLocal(client, object.getLocation()), Color.YELLOW, 3, 255, 0);
|
||||
LocalPoint lp = object.getLocation();
|
||||
Point point = Perspective.getCanvasTextLocation(client, graphics, lp, text, 0);
|
||||
renderTextLocation(graphics, text, 12, Font.BOLD, Color.WHITE, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,12 +318,9 @@ public class VerzikHandler extends RoomHandler
|
||||
this.yellows--;
|
||||
}
|
||||
|
||||
if (npc != null)
|
||||
if (npc != null && npc.getAnimation() == 8117)
|
||||
{
|
||||
if (npc.getAnimation() == 8117)
|
||||
{
|
||||
redCrabsTimer = redCrabsTimer - 1;
|
||||
}
|
||||
redCrabsTimer = redCrabsTimer - 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,12 +95,9 @@ public class NyloHandler extends RoomHandler
|
||||
long minutes = seconds / 60L;
|
||||
seconds = seconds % 60;
|
||||
|
||||
if (this.startTime != 0)
|
||||
if (this.startTime != 0 && plugin.isExtraTimers())
|
||||
{
|
||||
if (plugin.isExtraTimers())
|
||||
{
|
||||
this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Nylocas - Waves' completed! Duration: <col=ff0000>" + minutes + ":" + twoDigitString(seconds), null);
|
||||
}
|
||||
this.client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Wave 'The Nylocas - Waves' completed! Duration: <col=ff0000>" + minutes + ":" + twoDigitString(seconds), null);
|
||||
}
|
||||
System.out.println("Stopping Nylocas Room");
|
||||
}
|
||||
@@ -267,26 +264,23 @@ public class NyloHandler extends RoomHandler
|
||||
this.pillars.put(npc, 100);
|
||||
this.recalculateLocal();
|
||||
}
|
||||
else if (npc.getName() != null)
|
||||
else if (npc.getName() != null && this.plugin.getRoom() == TheatreRoom.NYLOCAS)
|
||||
{
|
||||
if (this.plugin.getRoom() == TheatreRoom.NYLOCAS)
|
||||
Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)");
|
||||
Matcher m = p.matcher(npc.getName());
|
||||
if (m.matches())
|
||||
{
|
||||
Pattern p = Pattern.compile("Nylocas (Hagios|Toxobolos|Ischyros)");
|
||||
Matcher m = p.matcher(npc.getName());
|
||||
if (m.matches())
|
||||
{
|
||||
this.spiders.put(npc, 52);
|
||||
this.spiders.put(npc, 52);
|
||||
|
||||
if (this.predictor != null)
|
||||
{
|
||||
this.predictor.onNpcSpawned(event);
|
||||
}
|
||||
}
|
||||
else if (npc.getName().equals("Nylocas Vasilias"))
|
||||
if (this.predictor != null)
|
||||
{
|
||||
this.onStop();
|
||||
this.predictor.onNpcSpawned(event);
|
||||
}
|
||||
}
|
||||
else if (npc.getName().equals("Nylocas Vasilias"))
|
||||
{
|
||||
this.onStop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -158,35 +158,34 @@ public class XarpusHandler extends RoomHandler
|
||||
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
if (client.getVar(Varbits.MULTICOMBAT_AREA) == 1 || client.getVarbitValue(client.getVarps(), TheatreConstant.DOOR_VARP) == 2)
|
||||
if ((client.getVar(Varbits.MULTICOMBAT_AREA) == 1 ||
|
||||
client.getVarbitValue(client.getVarps(), TheatreConstant.DOOR_VARP) == 2) &&
|
||||
!xarpusFlag)
|
||||
{
|
||||
if (!xarpusFlag)
|
||||
int players = client.getPlayers().size();
|
||||
|
||||
if (players == 5)
|
||||
{
|
||||
int players = client.getPlayers().size();
|
||||
|
||||
if (players == 5)
|
||||
{
|
||||
exhumesCount = 18;
|
||||
}
|
||||
else if (players == 4)
|
||||
{
|
||||
exhumesCount = 15;
|
||||
}
|
||||
else if (players == 3)
|
||||
{
|
||||
exhumesCount = 12;
|
||||
}
|
||||
else if (players == 2)
|
||||
{
|
||||
exhumesCount = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
exhumesCount = 7;
|
||||
}
|
||||
|
||||
xarpusFlag = true;
|
||||
exhumesCount = 18;
|
||||
}
|
||||
else if (players == 4)
|
||||
{
|
||||
exhumesCount = 15;
|
||||
}
|
||||
else if (players == 3)
|
||||
{
|
||||
exhumesCount = 12;
|
||||
}
|
||||
else if (players == 2)
|
||||
{
|
||||
exhumesCount = 9;
|
||||
}
|
||||
else
|
||||
{
|
||||
exhumesCount = 7;
|
||||
}
|
||||
|
||||
xarpusFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user