Small improvements (#354)
* Fix alch price logic * Replace streams with for loops (appearantly faster) * Fix bankpin button access level + add xp drop widgetinfo idk why * Use @Getter for getters and fix slot checking in itemcharges
This commit is contained in:
@@ -1067,17 +1067,17 @@ public class WidgetID
|
||||
public static final int WINNINGS = 40;
|
||||
}
|
||||
|
||||
public static class BankPin
|
||||
static class BankPin
|
||||
{
|
||||
public static final int BUTTON_1 = 16;
|
||||
public static final int BUTTON_2 = 18;
|
||||
public static final int BUTTON_3 = 20;
|
||||
public static final int BUTTON_4 = 22;
|
||||
public static final int BUTTON_5 = 24;
|
||||
public static final int BUTTON_6 = 26;
|
||||
public static final int BUTTON_7 = 28;
|
||||
public static final int BUTTON_8 = 30;
|
||||
public static final int BUTTON_9 = 32;
|
||||
public static final int BUTTON_0 = 34;
|
||||
static final int BUTTON_1 = 16;
|
||||
static final int BUTTON_2 = 18;
|
||||
static final int BUTTON_3 = 20;
|
||||
static final int BUTTON_4 = 22;
|
||||
static final int BUTTON_5 = 24;
|
||||
static final int BUTTON_6 = 26;
|
||||
static final int BUTTON_7 = 28;
|
||||
static final int BUTTON_8 = 30;
|
||||
static final int BUTTON_9 = 32;
|
||||
static final int BUTTON_0 = 34;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,7 +719,15 @@ public enum WidgetInfo
|
||||
BANK_PIN_7(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_7),
|
||||
BANK_PIN_8(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_8),
|
||||
BANK_PIN_9(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_9),
|
||||
BANK_PIN_0(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_0);
|
||||
BANK_PIN_0(WidgetID.BANK_PIN_GROUP_ID, WidgetID.BankPin.BUTTON_0),
|
||||
|
||||
XP_DROP_1(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_1),
|
||||
XP_DROP_2(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_2),
|
||||
XP_DROP_3(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_3),
|
||||
XP_DROP_4(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_4),
|
||||
XP_DROP_5(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_5),
|
||||
XP_DROP_6(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_6),
|
||||
XP_DROP_7(WidgetID.EXPERIENCE_DROP_GROUP_ID, WidgetID.ExperienceDrop.DROP_7);
|
||||
|
||||
private final int groupId;
|
||||
private final int childId;
|
||||
|
||||
@@ -425,14 +425,7 @@ public class ItemManager
|
||||
return 1000;
|
||||
}
|
||||
|
||||
float alchValue = getItemComposition(itemID).getPrice() * HIGH_ALCHEMY_CONSTANT;
|
||||
|
||||
/*
|
||||
* If the alch value is below 1, do not round up, return 0 instead.
|
||||
* For example bones have a base price of 1, multiplied by 0.6 will be 0.6,
|
||||
* if rounded up, the alch price will be 1, when it should be 0.
|
||||
*/
|
||||
return alchValue < 1 ? 0 : Math.round(alchValue);
|
||||
return (int) (getItemComposition(itemID).getPrice() * HIGH_ALCHEMY_CONSTANT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,8 @@ import java.awt.image.BufferedImage;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
@@ -119,27 +121,15 @@ public class ItemChargePlugin extends Plugin
|
||||
private static final int MAX_EXPEDITIOUS_CHARGES = 30;
|
||||
private static final int MAX_BINDING_CHARGES = 16;
|
||||
|
||||
public boolean isRingOfRecoilAvailable()
|
||||
{
|
||||
return ringOfRecoilAvailable;
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean ringOfRecoilAvailable = false;
|
||||
|
||||
boolean isRingOfRecoilEquipped()
|
||||
{
|
||||
return ringOfRecoilEquipped;
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean ringOfRecoilEquipped = false;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private BufferedImage recoilRingImage;
|
||||
|
||||
BufferedImage getRecoilRingImage()
|
||||
{
|
||||
return recoilRingImage;
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -416,7 +406,7 @@ public class ItemChargePlugin extends Plugin
|
||||
ringOfRecoilEquipped = false;
|
||||
|
||||
Item ring = null;
|
||||
if (equipment != null && equipment.getItems().length > EquipmentInventorySlot.RING.getSlotIdx())
|
||||
if (equipment != null && equipment.getItems().length >= EquipmentInventorySlot.RING.getSlotIdx())
|
||||
{
|
||||
ring = equipment.getItems()[EquipmentInventorySlot.RING.getSlotIdx()];
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.spellbook;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -43,14 +42,16 @@ public enum Spellbook
|
||||
@Getter
|
||||
private final String configKey;
|
||||
|
||||
private static final Map<Integer, Spellbook> map = new HashMap<>();
|
||||
private static final ImmutableMap<Integer, Spellbook> map;
|
||||
|
||||
static
|
||||
{
|
||||
ImmutableMap.Builder<Integer, Spellbook> builder = new ImmutableMap.Builder<>();
|
||||
for (Spellbook s : values())
|
||||
{
|
||||
map.put(s.id, s);
|
||||
builder.put(s.id, s);
|
||||
}
|
||||
map = builder.build();
|
||||
}
|
||||
|
||||
public static Spellbook getByID(int id)
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -198,7 +199,7 @@ public class SpellbookPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isUnfiltered(String spell, ImmutableSet<String> unfiltereds)
|
||||
private static boolean isUnfiltered(String spell, Set<String> unfiltereds)
|
||||
{
|
||||
for (String str : unfiltereds)
|
||||
{
|
||||
@@ -379,15 +380,19 @@ public class SpellbookPlugin extends Plugin
|
||||
}
|
||||
else if ("resizeIndividualSpells".equals(event.getEventName()))
|
||||
{
|
||||
ImmutableSet<String> tmp = ImmutableSet.copyOf(notFilteredSpells);
|
||||
|
||||
int widget = iStack[iStackSize - 1];
|
||||
int visCount = (int) spells.values().stream()
|
||||
.map(Spell::getName)
|
||||
.filter(s -> isUnfiltered(s, tmp))
|
||||
.count();
|
||||
|
||||
if (visCount > 20 || visCount == 0)
|
||||
int visibleCount = 0;
|
||||
for (Spell spell1 : spells.values())
|
||||
{
|
||||
String s = spell1.getName();
|
||||
if (isUnfiltered(s, notFilteredSpells))
|
||||
{
|
||||
visibleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (visibleCount > 20 || visibleCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -446,7 +451,10 @@ public class SpellbookPlugin extends Plugin
|
||||
|
||||
if (tmp != null)
|
||||
{
|
||||
tmp.forEach((k, v) -> spells.replace(k, v));
|
||||
for (Map.Entry<Integer, Spell> entry : tmp.entrySet())
|
||||
{
|
||||
spells.replace(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,7 +465,10 @@ public class SpellbookPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
tmp.forEach((k, v) -> spells.replace(k, v));
|
||||
for (Map.Entry<Integer, Spell> entry : tmp.entrySet())
|
||||
{
|
||||
spells.replace(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
String key = spellbook.getConfigKey();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user