Merge pull request #50 from runelite-extended/update3

Changes 3
This commit is contained in:
gazivodag
2019-04-22 16:56:28 -04:00
committed by GitHub
3 changed files with 43 additions and 2 deletions

View File

@@ -97,7 +97,7 @@ public class AmmoPlugin extends Plugin
{
// Check for weapon slot items. This overrides the ammo slot,
// as the player will use the thrown weapon (eg. chinchompas, knives, darts)
if (items.length >= EquipmentInventorySlot.WEAPON.getSlotIdx() - 1)
if (items.length > EquipmentInventorySlot.WEAPON.getSlotIdx())
{
final Item weapon = items[EquipmentInventorySlot.WEAPON.getSlotIdx()];
final ItemComposition weaponComp = itemManager.getItemComposition(weapon.getId());

View File

@@ -118,4 +118,18 @@ public interface IdleNotifierConfig extends Config
{
return 0;
}
@ConfigItem(
keyName = "pkers",
name = "PKer Notifier",
position = 9,
description = "Notifies if an attackable player based on your level range appears on screen.",
group = "pvp",
warning = "This will not notify you if the player is in your cc or is online on your friends list."
)
default boolean notifyPkers()
{
return true;
}
}

View File

@@ -26,6 +26,8 @@
package net.runelite.client.plugins.idlenotifier;
import com.google.inject.Provides;
import java.awt.*;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
@@ -50,16 +52,18 @@ import net.runelite.api.events.GameTick;
import net.runelite.api.events.GraphicChanged;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.PlayerSpawned;
import net.runelite.client.Notifier;
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.util.PvPUtil;
@PluginDescriptor(
name = "Idle Notifier",
description = "Send a notification when going idle, or when HP/Prayer reaches a threshold",
tags = {"health", "hitpoints", "notifications", "prayer"}
tags = {"health", "hitpoints", "notifications", "prayer", "pvp", "pker"}
)
public class IdleNotifierPlugin extends Plugin
{
@@ -238,6 +242,29 @@ public class IdleNotifierPlugin extends Plugin
}
}
@Subscribe
private void onPlayerSpawned(PlayerSpawned event)
{
final Player p = event.getPlayer();
if (config.notifyPkers())
{
if (p != null)
{
if (p != client.getLocalPlayer())
{
if (PvPUtil.isAttackable(client, p) && !client.isFriended(p.getName(), false)
&& !client.isClanMember(p.getName()))
{
String playerName = p.getName();
int combat = p.getCombatLevel();
notifier.notify("PK'er warning! A level " + combat + " player named " + playerName +
" appeared!", TrayIcon.MessageType.WARNING);
}
}
}
}
}
@Subscribe
public void onInteractingChanged(InteractingChanged event)
{