Adding LordZuku's Cox Plugin

This commit is contained in:
Ganom
2019-04-25 21:06:31 -04:00
parent 896a9a3c0a
commit 83f230aec7
3 changed files with 953 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
/*
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
* No rights reserved. Use, redistribute, and modify at your own discretion,
* and in accordance with Yagex and RuneLite guidelines.
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
* Good luck on your raids!
*/
package net.runelite.client.plugins.zcox;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("Cox")
public interface CoxConfig extends Config
{
@ConfigItem(
position = 0,
keyName = "Muttadile",
name = "Muttadile Marker",
description = ""
)
default boolean Muttadile()
{
return true;
}
@ConfigItem(
position = 1,
keyName = "Tekton",
name = "Tekton Marker",
description = ""
)
default boolean Tekton()
{
return true;
}
@ConfigItem(
position = 2,
keyName = "Guardians",
name = "Guardians timing",
description = ""
)
default boolean Guardians()
{
return true;
}
@ConfigItem(
position = 3,
keyName = "OlmSpec",
name = "Olm Next Spec",
description = ""
)
default boolean OlmSpec()
{
return true;
}
@ConfigItem(
position = 4,
keyName = "OlmTick",
name = "Olm Tick Counter",
description = ""
)
default boolean OlmTick()
{
return true;
}
@ConfigItem(
position = 5,
keyName = "OlmCrystals",
name = "Olm AoE Indicator",
description = ""
)
default boolean OlmCrystals()
{
return true;
}
@ConfigItem(
position = 6,
keyName = "LargeCrystals",
name = "Mark Large AoE Crystals rather then small ones",
description = ""
)
default boolean LargeCrystals()
{
return true;
}
}

View File

@@ -0,0 +1,339 @@
/*
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
* No rights reserved. Use, redistribute, and modify at your own discretion,
* and in accordance with Yagex and RuneLite guidelines.
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
* Good luck on your raids!
*/
package net.runelite.client.plugins.zcox;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.util.Iterator;
import java.util.List;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
public class CoxOverlay extends Overlay
{
private final Client client;
private final CoxPlugin plugin;
private final CoxConfig config;
@Inject
private CoxOverlay(Client client, CoxPlugin plugin, CoxConfig config)
{
this.client = client;
this.plugin = plugin;
this.config = config;
setPosition(OverlayPosition.DYNAMIC);
setPriority(OverlayPriority.HIGH);
setLayer(OverlayLayer.ABOVE_SCENE);
}
@Override
public Dimension render(Graphics2D graphics)
{
if (plugin.isRunMutta())
{
if (config.Muttadile())
{
NPC boss = plugin.getMomma_NPC();
NPC baby = plugin.getMutta_NPC();
if (boss != null)
{
int size = 1;
NPCComposition composition = boss.getTransformedComposition();
{
size = composition.getSize();
}
List<WorldPoint> meleeRangeMom = getHitSquares(boss.getWorldLocation(), size, 1, false);
for (WorldPoint p : meleeRangeMom)
{
drawTile(graphics, p, Color.RED, 2, 155, 10);
}
}
if (baby != null)
{
int size = 1;
NPCComposition compositionbaby = baby.getTransformedComposition();
{
size = compositionbaby.getSize();
}
List<WorldPoint> meleeRange = getHitSquares(baby.getWorldLocation(), size, 1, false);
for (WorldPoint p : meleeRange)
{
drawTile(graphics, p, Color.RED, 1, 155, 10);
}
}
}
}
if (plugin.isRunGuard())
{
if (config.Guardians())
{
NPC G1 = plugin.getGuard1_NPC();
NPC G2 = plugin.getGuard2_NPC();
int tick = plugin.getGuardTick();
if (tick == 5)
{
if (G1 != null)
{
int size = 1;
NPCComposition composition = G1.getTransformedComposition();
{
size = composition.getSize();
}
List<WorldPoint> meleeRange = getHitSquares(G1.getWorldLocation(), size, 1, true);
for (WorldPoint p : meleeRange)
{
drawTile(graphics, p, Color.GREEN, 1, 155, 10);
}
}
if (G2 != null)
{
int size = 1;
NPCComposition composition = G2.getTransformedComposition();
{
size = composition.getSize();
}
List<WorldPoint> meleeRange = getHitSquares(G2.getWorldLocation(), size, 1, true);
for (WorldPoint p : meleeRange)
{
drawTile(graphics, p, Color.GREEN, 1, 155, 10);
}
}
}
}
}
if (plugin.isRunTekton())
{
if (config.Tekton())
{
NPC boss = plugin.getTekton_NPC();
if (boss != null)
{
int size = 1;
NPCComposition composition = boss.getTransformedComposition();
{
size = composition.getSize();
}
List<WorldPoint> meleeRange = getHitSquares(boss.getWorldLocation(), size, 1, false);
for (WorldPoint p : meleeRange)
{
drawTile(graphics, p, Color.WHITE, 1, 155, 10);
}
}
}
}
if (plugin.isRunOlm())
{
NPC boss = plugin.getOlm_NPC();
if (config.OlmCrystals())
{
for (WorldPoint p : plugin.getOlm_Crystals())
{
drawTile(graphics, p, Color.RED, 1, 255, 0);
}
for (WorldPoint p : plugin.getOlm_Heal())
{
drawTile(graphics, p, Color.BLUE, 3, 255, 0);
}
for (WorldPoint p : plugin.getOlm_PSN())
{
drawTile(graphics, p, Color.GREEN, 3, 255, 0);
}
}
if (config.OlmSpec())
{
}
if (config.OlmTick())
{
if (boss != null)
{
int tick = plugin.getOlm_TicksUntilAction();
int cycle = plugin.getOlm_ActionCycle();
int spec = plugin.getOlm_NextSpec();
final String tickStr = String.valueOf(tick);
String cycleStr = "?";
switch (cycle)
{
case 1:
switch (spec)
{
case 1:
cycleStr = "Portals";
break;
case 2:
cycleStr = "lightning";
break;
case 3:
cycleStr = "Crystals";
break;
case 4:
cycleStr = "Heal";
break;
case -1:
cycleStr = "??";
break;
}
break;
case 2:
cycleStr = "Sauto";
break;
case 3:
cycleStr = "Null";
break;
case 4:
cycleStr = "Nauto";
break;
case -1:
cycleStr = "??";
break;
}
final String combinedStr = cycleStr + ":" + tickStr;
Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130);
renderTextLocation(graphics, combinedStr, 12, Font.BOLD, Color.WHITE, canvasPoint);
}
}
}
return null;
}
private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha)
{
WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation();
if (point.distanceTo(playerLocation) >= 32)
{
return;
}
LocalPoint lp = LocalPoint.fromWorld(client, point);
if (lp == null)
{
return;
}
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
if (poly == null)
{
return;
}
//OverlayUtil.renderPolygon(graphics, poly, color);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
graphics.setStroke(new BasicStroke(strokeWidth));
graphics.draw(poly);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
graphics.fill(poly);
}
private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha)
{
int size = 1;
NPCComposition composition = actor.getTransformedComposition();
if (composition != null)
{
size = composition.getSize();
}
LocalPoint lp = actor.getLocalLocation();
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
if (tilePoly != null)
{
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
graphics.setStroke(new BasicStroke(outlineWidth));
graphics.draw(tilePoly);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
graphics.fill(tilePoly);
}
}
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
{
graphics.setFont(new Font("Arial", fontStyle, fontSize));
if (canvasPoint != null)
{
final Point canvasCenterPoint = new Point(
canvasPoint.getX(),
canvasPoint.getY());
final Point canvasCenterPoint_shadow = new Point(
canvasPoint.getX() + 1,
canvasPoint.getY() + 1);
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
}
}
private List<WorldPoint> getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder)
{
List<WorldPoint> little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList();
List<WorldPoint> big = new WorldArea(npcLoc.getX() - thickness, npcLoc.getY() - thickness, npcSize + (thickness * 2), npcSize + (thickness * 2), npcLoc.getPlane()).toWorldPointList();
if (!includeUnder)
{
for (Iterator<WorldPoint> it = big.iterator(); it.hasNext(); )
{
WorldPoint p = it.next();
if (little.contains(p))
{
it.remove();
}
}
}
return big;
}
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
{
if (polygon != null)
{
graphics.setColor(color);
graphics.setStroke(new BasicStroke(2));
graphics.draw(polygon);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
graphics.fill(polygon);
}
}
}

View File

@@ -0,0 +1,518 @@
/*
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
* No rights reserved. Use, redistribute, and modify at your own discretion,
* and in accordance with Yagex and RuneLite guidelines.
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
* Good luck on your raids!
*/
package net.runelite.client.plugins.zcox;
import com.google.inject.Provides;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.GraphicsObject;
import net.runelite.api.MessageNode;
import net.runelite.api.NPC;
import net.runelite.api.NpcID;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "CoX Helper ",
description = "All-in-one plugin for Chambers of Xeric",
tags = {"CoX", "chamber", "xeric", "helper"},
enabledByDefault = false,
type = PluginType.PVM
)
public class CoxPlugin extends Plugin
{
private static final int GAMEOBJECT_ID_PSN = 30032;
private static final int GRAPHICSOBJECT_ID_CRYSTAL = 1447;
private static final int GRAPHICSOBJECT_ID_HEAL = 1363;
private static final int ANIMATION_ID_G1 = 430;
int sleepcount = 0;
private boolean needOlm = false;
@Getter(AccessLevel.PACKAGE)
private int guardTick = -1;
@Getter(AccessLevel.PACKAGE)
private boolean runGuard = false;
@Getter(AccessLevel.PACKAGE)
private NPC Guard1_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC Guard2_NPC;
@Getter(AccessLevel.PACKAGE)
private boolean runMutta;
@Getter(AccessLevel.PACKAGE)
private NPC Mutta_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC Momma_NPC;
@Getter(AccessLevel.PACKAGE)
private int OlmPhase = 0;
@Getter(AccessLevel.PACKAGE)
private boolean runTekton;
@Getter(AccessLevel.PACKAGE)
private NPC Tekton_NPC;
@Getter(AccessLevel.PACKAGE)
private boolean runVanguards;
@Getter(AccessLevel.PACKAGE)
private NPC meleeVanguard_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC mageVanguard_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC rangeVanguard_NPC;
@Getter(AccessLevel.PACKAGE)
private boolean runOlm;
@Getter(AccessLevel.PACKAGE)
private NPC Olm_NPC;
@Getter(AccessLevel.PACKAGE)
private NPC OlmMelee_NPC;
@Getter(AccessLevel.PACKAGE)
private int Olm_TicksUntilAction = -1;
@Getter(AccessLevel.PACKAGE)
private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4
@Getter(AccessLevel.PACKAGE)
private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_Crystals = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_Heal = new ArrayList<>();
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> Olm_PSN = new ArrayList<>();
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;
@Inject
private CoxOverlay overlay;
@Inject
private CoxConfig config;
@Provides
CoxConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(CoxConfig.class);
}
@Override
protected void startUp()
{
overlayManager.add(overlay);
}
@Override
protected void shutDown()
{
overlayManager.remove(overlay);
}
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
MessageNode messageNode = chatMessage.getMessageNode();
if (messageNode.getValue().toLowerCase().contains("The Great Olm rises with the power of".toLowerCase()) || messageNode.getValue().toLowerCase().contains("!olm".toLowerCase()))
{
System.out.println("finding Olm NPC");
if (!runOlm)
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 4;
}
else
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 3;
}
OlmPhase = 0;
runOlm = true;
needOlm = true;
Olm_NextSpec = -1;
}
if (messageNode.getValue().toLowerCase().contains("The Great Olm is giving its all. this is its final stand".toLowerCase()))
{
System.out.println("finding Olm NPC");
if (!runOlm)
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 4;
}
else
{
Olm_ActionCycle = -1;
Olm_TicksUntilAction = 3;
}
OlmPhase = 1;
System.out.println("OLM PHASE:" + OlmPhase);
runOlm = true;
needOlm = true;
Olm_NextSpec = -1;
}
}
@Subscribe
public void onNpcSpawned(NpcSpawned npcSpawned)
{
NPC npc = npcSpawned.getNpc();
switch (npc.getId())
{
case NpcID.TEKTON:
case NpcID.TEKTON_7541:
case NpcID.TEKTON_7542:
case NpcID.TEKTON_7545:
case NpcID.TEKTON_ENRAGED:
case NpcID.TEKTON_ENRAGED_7544:
runTekton = true;
Tekton_NPC = npc;
break;
case NpcID.MUTTADILE://momadile resting
Momma_NPC = npc;
break;
case NpcID.MUTTADILE_7562:
runMutta = true;
Mutta_NPC = npc;
break;
case NpcID.MUTTADILE_7563:
runMutta = true;
Momma_NPC = npc;
break;
// case NpcID.GREAT_OLM_7554:
// System.out.println("Found Olm NPC");
// if (!runOlm)
// {
// Olm_ActionCycle = 4;
/// Olm_TicksUntilAction = 4;
// } else {
// Olm_ActionCycle = 4;
// Olm_TicksUntilAction = 3;
//// }
// OlmPhase++;
// System.out.println("OLM PHASE:"+OlmPhase);
// runOlm = true;
// Olm_NPC = npc;
// Olm_NextSpec = 1;
// break;
//
// case NpcID.GREAT_OLM_LEFT_CLAW:
// case NpcID.GREAT_OLM_LEFT_CLAW_7555:
// OlmMelee_NPC = npc;
// break;
case NpcID.GUARDIAN:
Guard1_NPC = npc;
guardTick = -1;
runGuard = true;
break;
case NpcID.GUARDIAN_7570:
Guard2_NPC = npc;
guardTick = -1;
runGuard = true;
break;
//add vanguards
}
}
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
NPC npc = npcDespawned.getNpc();
switch (npc.getId())
{
case NpcID.TEKTON:
case NpcID.TEKTON_7541:
case NpcID.TEKTON_7542:
case NpcID.TEKTON_7545:
case NpcID.TEKTON_ENRAGED:
case NpcID.TEKTON_ENRAGED_7544:
runTekton = false;
Tekton_NPC = null;
break;
case NpcID.MUTTADILE:
Momma_NPC = null;
break;
case NpcID.MUTTADILE_7562:
Mutta_NPC = null;
break;
case NpcID.MUTTADILE_7563:
runMutta = false;
Momma_NPC = null;
break;
// case NpcID.GREAT_OLM_7554:
// Olm_NPC = null;
// break;
//case NpcID.GREAT_OLM_LEFT_CLAW:
// case NpcID.GREAT_OLM_LEFT_CLAW_7555:
// OlmMelee_NPC = null;
// break;
//
case NpcID.GUARDIAN:
Guard1_NPC = null;
runGuard = false;
Guard2_NPC = null;
break;
case NpcID.GUARDIAN_7570:
Guard2_NPC = null;
Guard1_NPC = null;
runGuard = false;
break;
case NpcID.GUARDIAN_7571:
case NpcID.GUARDIAN_7572:
Guard1_NPC = null;
runGuard = false;
Guard2_NPC = null;
break;
//add vanguards
}
}
@Subscribe
public void onGameTick(GameTick event)
{
if (client.getVar(Varbits.IN_RAID) == 0)
{
runOlm = false;
runGuard = false;
runMutta = false;
runTekton = false;
needOlm = false;
OlmPhase = 0;
sleepcount = 0;
Olm_Heal.clear();
}
else
{
}
if (needOlm = true)
{
for (NPC monster : client.getNpcs())
{
if (monster.getId() == NpcID.GREAT_OLM)
{
needOlm = false;
Olm_NPC = monster;
System.out.println("Found olm Npc");
break;
}
else
{
continue;
}
}
}
if (runGuard)
{
if (guardTick == -1)
{
if (Guard1_NPC != null)
{
if (Guard1_NPC.getAnimation() == ANIMATION_ID_G1)
{
guardTick = 5;
}
}
if (Guard2_NPC != null)
{
if (Guard2_NPC.getAnimation() == ANIMATION_ID_G1)
{
guardTick = 5;
}
}
}
else
{
guardTick--;
}
if (guardTick == 0)
{
guardTick = 5;
}
}
if (runOlm)
{
Olm_Crystals.clear();
Olm_Heal.clear();
sleepcount--;
if (Olm_TicksUntilAction == 1)
{
if (Olm_ActionCycle == 1)
{
Olm_ActionCycle = 4;
Olm_TicksUntilAction = 4;
if (Olm_NextSpec == 1)
{
if (OlmPhase == 1)
{
Olm_NextSpec = 4; // 4 = heal 3= cry 2 = lightn 1 = swap
}
else
{
Olm_NextSpec = 3;
}
}
else
{
Olm_NextSpec--;
}
}
else
{
if (Olm_ActionCycle != -1)
{
Olm_ActionCycle--;
}
Olm_TicksUntilAction = 4;
}
}
else
{
Olm_TicksUntilAction--;
}
//for (GameObject i : client.getGameObjects()) {
// if (i.getId() == GRAPHICSOBJECT_ID_CRYSTAL) {
// WorldPoint newloc;
// for (int x = -1; x <= 1; x++) {
// for (int y = -1; y <= 1; y++) {
// newloc = WorldPoint.fromLocal(client, o.getLocation());
// if (config.LargeCrystals()) {
// newloc = newloc.dx(x);
// newloc = newloc.dy(y);
// }
// Olm_Crystals.add(newloc);
// }
// }
//
// }
// if (o.getId() == GRAPHICSOBJECT_ID_HEAL) {
// Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation()));
// }
//}
for (GraphicsObject o : client.getGraphicsObjects())
{
if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL)
{
WorldPoint newloc;
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
newloc = WorldPoint.fromLocal(client, o.getLocation());
if (config.LargeCrystals())
{
newloc = newloc.dx(x);
newloc = newloc.dy(y);
}
Olm_Crystals.add(newloc);
}
}
}
if (sleepcount <= 0)
{
if (o.getId() == 1338)
{
Olm_TicksUntilAction = 1;
Olm_NextSpec = 2;
Olm_ActionCycle = 4; //spec=1 null=3
sleepcount = 5;
System.out.println("setting off 1338 id - crystals");
}
if (o.getId() == 1356)
{
Olm_TicksUntilAction = 4;
Olm_NextSpec = 1;
Olm_ActionCycle = 4; //spec=1 null=3
sleepcount = 50;
System.out.println("setting off 1338 id - lighning");
}
}
if (o.getId() == GRAPHICSOBJECT_ID_HEAL)
{
Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation()));
}
}
}
}
}