Merging All of the Cox Plugins
This commit is contained in:
@@ -1,9 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
|
* Copyright (c) 2019, xzact <https://github.com/xzact>
|
||||||
* No rights reserved. Use, redistribute, and modify at your own discretion,
|
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||||
* and in accordance with Yagex and RuneLite guidelines.
|
* All rights reserved.
|
||||||
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
|
*
|
||||||
* Good luck on your raids!
|
* 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.zcox;
|
package net.runelite.client.plugins.zcox;
|
||||||
|
|||||||
@@ -1,9 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
|
* Copyright (c) 2019, xzact <https://github.com/xzact>
|
||||||
* No rights reserved. Use, redistribute, and modify at your own discretion,
|
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||||
* and in accordance with Yagex and RuneLite guidelines.
|
* All rights reserved.
|
||||||
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
|
*
|
||||||
* Good luck on your raids!
|
* 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.zcox;
|
package net.runelite.client.plugins.zcox;
|
||||||
|
|||||||
@@ -1,9 +1,26 @@
|
|||||||
/*
|
/*
|
||||||
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
|
* Copyright (c) 2019, xzact <https://github.com/xzact>
|
||||||
* No rights reserved. Use, redistribute, and modify at your own discretion,
|
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||||
* and in accordance with Yagex and RuneLite guidelines.
|
* All rights reserved.
|
||||||
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
|
*
|
||||||
* Good luck on your raids!
|
* 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.zcox;
|
package net.runelite.client.plugins.zcox;
|
||||||
@@ -12,19 +29,24 @@ import com.google.inject.Provides;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GraphicsObject;
|
import net.runelite.api.GraphicsObject;
|
||||||
import net.runelite.api.MessageNode;
|
import net.runelite.api.MessageNode;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.NpcID;
|
import net.runelite.api.NpcID;
|
||||||
|
import net.runelite.api.Projectile;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.NpcDespawned;
|
import net.runelite.api.events.NpcDespawned;
|
||||||
import net.runelite.api.events.NpcSpawned;
|
import net.runelite.api.events.NpcSpawned;
|
||||||
|
import net.runelite.api.events.ProjectileMoved;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
@@ -41,6 +63,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
type = PluginType.PVM
|
type = PluginType.PVM
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Singleton
|
||||||
public class CoxPlugin extends Plugin
|
public class CoxPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private static final int GAMEOBJECT_ID_PSN = 30032;
|
private static final int GAMEOBJECT_ID_PSN = 30032;
|
||||||
@@ -57,6 +81,26 @@ public class CoxPlugin extends Plugin
|
|||||||
private NPC Guard1_NPC;
|
private NPC Guard1_NPC;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private NPC Guard2_NPC;
|
private NPC Guard2_NPC;
|
||||||
|
private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily.";
|
||||||
|
@Inject
|
||||||
|
private Client client;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean HandCripple;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private int timer = 45;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private NPC hand;
|
||||||
|
@Inject
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
@Inject
|
||||||
|
private OlmCrippleTimerOverlay olmCrippleTimerOverlay;
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
protected PrayAgainst prayAgainstOlm;
|
||||||
|
@Getter
|
||||||
|
protected long lastPrayTime;
|
||||||
|
@Inject
|
||||||
|
private OlmPrayAgainstOverlay prayAgainstOverlay;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean runMutta;
|
private boolean runMutta;
|
||||||
@@ -120,13 +164,6 @@ public class CoxPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ChatMessageManager chatMessageManager;
|
private ChatMessageManager chatMessageManager;
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private Client client;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private OverlayManager overlayManager;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CoxOverlay overlay;
|
private CoxOverlay overlay;
|
||||||
|
|
||||||
@@ -143,12 +180,19 @@ public class CoxPlugin extends Plugin
|
|||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
|
overlayManager.add(olmCrippleTimerOverlay);
|
||||||
|
overlayManager.add(prayAgainstOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown()
|
protected void shutDown()
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
|
overlayManager.remove(olmCrippleTimerOverlay);
|
||||||
|
overlayManager.remove(prayAgainstOverlay);
|
||||||
|
HandCripple = false;
|
||||||
|
timer = 45;
|
||||||
|
hand = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -195,6 +239,47 @@ public class CoxPlugin extends Plugin
|
|||||||
needOlm = true;
|
needOlm = true;
|
||||||
Olm_NextSpec = -1;
|
Olm_NextSpec = -1;
|
||||||
}
|
}
|
||||||
|
if (messageNode.getValue().startsWith(OLM_HAND_CRIPPLE))
|
||||||
|
{
|
||||||
|
HandCripple = true;
|
||||||
|
timer = 45;
|
||||||
|
}
|
||||||
|
if (messageNode.getValue().toLowerCase().contains("aggression"))
|
||||||
|
{
|
||||||
|
log.debug("Melee Detected");
|
||||||
|
prayAgainstOlm = PrayAgainst.MELEE;
|
||||||
|
lastPrayTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if (messageNode.getValue().toLowerCase().contains("of magical power"))
|
||||||
|
{
|
||||||
|
log.debug("Mage Detected");
|
||||||
|
prayAgainstOlm = PrayAgainst.MAGIC;
|
||||||
|
lastPrayTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if (messageNode.getValue().toLowerCase().contains("accuracy and dexterity"))
|
||||||
|
{
|
||||||
|
log.debug("Missile Detected");
|
||||||
|
prayAgainstOlm = PrayAgainst.RANGED;
|
||||||
|
lastPrayTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onProjectileMoved(ProjectileMoved event)
|
||||||
|
{
|
||||||
|
Projectile projectile = event.getProjectile();
|
||||||
|
if (projectile.getId() == 1339)
|
||||||
|
{
|
||||||
|
log.debug("Mage Detected");
|
||||||
|
prayAgainstOlm = PrayAgainst.MAGIC;
|
||||||
|
lastPrayTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if (projectile.getId() == 1340)
|
||||||
|
{
|
||||||
|
log.debug("Range Detected");
|
||||||
|
prayAgainstOlm = PrayAgainst.RANGED;
|
||||||
|
lastPrayTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -212,8 +297,7 @@ public class CoxPlugin extends Plugin
|
|||||||
runTekton = true;
|
runTekton = true;
|
||||||
Tekton_NPC = npc;
|
Tekton_NPC = npc;
|
||||||
break;
|
break;
|
||||||
|
case NpcID.MUTTADILE:
|
||||||
case NpcID.MUTTADILE://momadile resting
|
|
||||||
Momma_NPC = npc;
|
Momma_NPC = npc;
|
||||||
break;
|
break;
|
||||||
case NpcID.MUTTADILE_7562:
|
case NpcID.MUTTADILE_7562:
|
||||||
@@ -224,28 +308,6 @@ public class CoxPlugin extends Plugin
|
|||||||
runMutta = true;
|
runMutta = true;
|
||||||
Momma_NPC = npc;
|
Momma_NPC = npc;
|
||||||
break;
|
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:
|
case NpcID.GUARDIAN:
|
||||||
Guard1_NPC = npc;
|
Guard1_NPC = npc;
|
||||||
guardTick = -1;
|
guardTick = -1;
|
||||||
@@ -256,8 +318,10 @@ public class CoxPlugin extends Plugin
|
|||||||
guardTick = -1;
|
guardTick = -1;
|
||||||
runGuard = true;
|
runGuard = true;
|
||||||
break;
|
break;
|
||||||
|
case NpcID.GREAT_OLM_RIGHT_CLAW_7553:
|
||||||
//add vanguards
|
case NpcID.GREAT_OLM_LEFT_CLAW:
|
||||||
|
hand = npc;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,28 +340,16 @@ public class CoxPlugin extends Plugin
|
|||||||
runTekton = false;
|
runTekton = false;
|
||||||
Tekton_NPC = null;
|
Tekton_NPC = null;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NpcID.MUTTADILE:
|
case NpcID.MUTTADILE:
|
||||||
Momma_NPC = null;
|
Momma_NPC = null;
|
||||||
break;
|
break;
|
||||||
case NpcID.MUTTADILE_7562:
|
case NpcID.MUTTADILE_7562:
|
||||||
Mutta_NPC = null;
|
Mutta_NPC = null;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NpcID.MUTTADILE_7563:
|
case NpcID.MUTTADILE_7563:
|
||||||
runMutta = false;
|
runMutta = false;
|
||||||
Momma_NPC = null;
|
Momma_NPC = null;
|
||||||
break;
|
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:
|
case NpcID.GUARDIAN:
|
||||||
Guard1_NPC = null;
|
Guard1_NPC = null;
|
||||||
runGuard = false;
|
runGuard = false;
|
||||||
@@ -314,7 +366,10 @@ public class CoxPlugin extends Plugin
|
|||||||
runGuard = false;
|
runGuard = false;
|
||||||
Guard2_NPC = null;
|
Guard2_NPC = null;
|
||||||
break;
|
break;
|
||||||
//add vanguards
|
case NpcID.GREAT_OLM_RIGHT_CLAW_7553:
|
||||||
|
case NpcID.GREAT_OLM_LEFT_CLAW:
|
||||||
|
HandCripple = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -338,6 +393,16 @@ public class CoxPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HandCripple)
|
||||||
|
{
|
||||||
|
timer--;
|
||||||
|
if (timer <= 0)
|
||||||
|
{
|
||||||
|
HandCripple = false;
|
||||||
|
timer = 45;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (needOlm = true)
|
if (needOlm = true)
|
||||||
{
|
{
|
||||||
for (NPC monster : client.getNpcs())
|
for (NPC monster : client.getNpcs())
|
||||||
@@ -435,30 +500,6 @@ public class CoxPlugin extends Plugin
|
|||||||
Olm_TicksUntilAction--;
|
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())
|
for (GraphicsObject o : client.getGraphicsObjects())
|
||||||
{
|
{
|
||||||
if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL)
|
if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL)
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, https://runelitepl.us
|
||||||
|
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||||
|
* 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.zcox;
|
||||||
|
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
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 OlmCrippleTimerOverlay extends Overlay
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final CoxPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OlmCrippleTimerOverlay(Client client, CoxPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setPriority(OverlayPriority.HIGH);
|
||||||
|
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (plugin.isHandCripple())
|
||||||
|
{
|
||||||
|
int tick = plugin.getTimer();
|
||||||
|
NPC olmHand = plugin.getHand();
|
||||||
|
final String tickStr = String.valueOf(tick);
|
||||||
|
Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50);
|
||||||
|
renderTextLocation(graphics, tickStr, 12, Font.BOLD, Color.GRAY, canvasPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||||
|
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||||
|
* 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.zcox;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
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.components.InfoBoxComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
|
class OlmPrayAgainstOverlay extends Overlay
|
||||||
|
{
|
||||||
|
|
||||||
|
private final CoxPlugin plugin;
|
||||||
|
private final Client client;
|
||||||
|
private final SpriteManager spriteManager;
|
||||||
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
OlmPrayAgainstOverlay(CoxPlugin plugin, Client client, SpriteManager spriteManager)
|
||||||
|
{
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.client = client;
|
||||||
|
this.spriteManager = spriteManager;
|
||||||
|
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||||
|
panelComponent.setOrientation(PanelComponent.Orientation.VERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Dimension render(Graphics2D graphics2D)
|
||||||
|
{
|
||||||
|
if (plugin.getPrayAgainstOlm() == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().clear();
|
||||||
|
|
||||||
|
if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000))
|
||||||
|
{
|
||||||
|
InfoBoxComponent prayComponent = new InfoBoxComponent();
|
||||||
|
Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm));
|
||||||
|
prayComponent.setImage(prayImg);
|
||||||
|
prayComponent.setColor(Color.WHITE);
|
||||||
|
prayComponent.setPreferredSize(new Dimension(40, 40));
|
||||||
|
panelComponent.getChildren().add(prayComponent);
|
||||||
|
|
||||||
|
panelComponent.setPreferredSize(new Dimension(40, 40));
|
||||||
|
panelComponent.setBorder(new Rectangle(0, 0, 0, 0));
|
||||||
|
return panelComponent.render(graphics2D);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plugin.setPrayAgainstOlm(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BufferedImage getPrayerImage(PrayAgainst prayAgainst)
|
||||||
|
{
|
||||||
|
switch (prayAgainst)
|
||||||
|
{
|
||||||
|
case MAGIC:
|
||||||
|
return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
|
||||||
|
case MELEE:
|
||||||
|
return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0);
|
||||||
|
case RANGED:
|
||||||
|
return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Image scaleImg(final Image img)
|
||||||
|
{
|
||||||
|
if (img == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final double width = img.getWidth(null);
|
||||||
|
final double height = img.getHeight(null);
|
||||||
|
final double size = 36; // Limit size to 2 as that is minimum size not causing breakage
|
||||||
|
final double scalex = size / width;
|
||||||
|
final double scaley = size / height;
|
||||||
|
final double scale = Math.min(scalex, scaley);
|
||||||
|
final int newWidth = (int) (width * scale);
|
||||||
|
final int newHeight = (int) (height * scale);
|
||||||
|
final BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
final Graphics g = scaledImage.createGraphics();
|
||||||
|
g.drawImage(img, 0, 0, newWidth, newHeight, null);
|
||||||
|
g.dispose();
|
||||||
|
return scaledImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||||
|
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||||
|
* 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.zcox;
|
||||||
|
|
||||||
|
enum PrayAgainst
|
||||||
|
{
|
||||||
|
MELEE,
|
||||||
|
MAGIC,
|
||||||
|
RANGED
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user