Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -85,11 +85,18 @@ public enum InventoryID
|
||||
* Theater of Blood reward chest inventory (Raids 2)
|
||||
*/
|
||||
THEATRE_OF_BLOOD_CHEST(612),
|
||||
|
||||
/**
|
||||
* Seed vault located inside the Farming Guild
|
||||
*/
|
||||
SEED_VAULT(626);
|
||||
SEED_VAULT(626),
|
||||
/**
|
||||
* Group ironman shared storage
|
||||
*/
|
||||
GROUP_STORAGE(659),
|
||||
/**
|
||||
* Player inventory when accessing group ironman shared storage
|
||||
*/
|
||||
GROUP_STORAGE_INV(660);
|
||||
|
||||
private final int id;
|
||||
|
||||
|
||||
@@ -304,7 +304,10 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
|
||||
// input. We prevent having a tag tab open while also performing a normal search, so if a tag tab
|
||||
// is active here it must mean we have placed the bank into search mode. See onScriptPostFired().
|
||||
TagTab activeTab = tabInterface.getActiveTab();
|
||||
String search = activeTab != null ? TAG_SEARCH + activeTab.getTag() : searchfilter;
|
||||
// Shared storage uses the bankmain filter scripts too. Allow using tag searches in it but don't
|
||||
// apply the tag search from the active tab.
|
||||
final boolean bankOpen = client.getItemContainer(InventoryID.BANK) != null;
|
||||
String search = activeTab != null && bankOpen ? TAG_SEARCH + activeTab.getTag() : searchfilter;
|
||||
|
||||
if (search.isEmpty())
|
||||
{
|
||||
@@ -487,8 +490,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
|
||||
if (event.getScriptId() == ScriptID.BANKMAIN_SEARCHING)
|
||||
{
|
||||
// The return value of bankmain_searching is on the stack. If we have a tag tab active
|
||||
// make it return true to put the bank in a searching state.
|
||||
if (tabInterface.getActiveTab() != null || tabInterface.isTagTabActive())
|
||||
// and are in the bank, make it return true to put the bank in a searching state.
|
||||
boolean bankOpen = client.getItemContainer(InventoryID.BANK) != null;
|
||||
if (bankOpen && (tabInterface.getActiveTab() != null || tabInterface.isTagTabActive()))
|
||||
{
|
||||
client.getIntStack()[client.getIntStackSize() - 1] = 1; // true
|
||||
}
|
||||
|
||||
@@ -62,11 +62,7 @@ class PrayerDoseOverlay extends Overlay
|
||||
private boolean trackTick = true;
|
||||
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hasPrayerRestore;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private int bonusPrayer;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hasHolyWrench;
|
||||
private int restoreAmount;
|
||||
|
||||
@Inject
|
||||
private PrayerDoseOverlay(final Client client, final TooltipManager tooltipManager, final PrayerPlugin plugin, final PrayerConfig config)
|
||||
@@ -127,7 +123,7 @@ class PrayerDoseOverlay extends Overlay
|
||||
tooltipManager.add(new Tooltip(sb.toString()));
|
||||
}
|
||||
|
||||
if (!config.showPrayerDoseIndicator() || !hasPrayerRestore)
|
||||
if (!config.showPrayerDoseIndicator() || restoreAmount == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -136,17 +132,7 @@ class PrayerDoseOverlay extends Overlay
|
||||
final int maxPrayer = client.getRealSkillLevel(Skill.PRAYER);
|
||||
|
||||
final int prayerPointsMissing = maxPrayer - currentPrayer;
|
||||
if (prayerPointsMissing <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
final double dosePercentage = hasHolyWrench ? .27 : .25;
|
||||
final int basePointsRestored = (int) Math.floor(maxPrayer * dosePercentage);
|
||||
|
||||
final int pointsRestored = basePointsRestored + 7 + bonusPrayer;
|
||||
|
||||
if (prayerPointsMissing < pointsRestored)
|
||||
if (prayerPointsMissing <= 0 || prayerPointsMissing < restoreAmount)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
@@ -39,7 +40,6 @@ import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
@@ -47,6 +47,7 @@ import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -141,26 +142,15 @@ public class PrayerPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onItemContainerChanged(final ItemContainerChanged event)
|
||||
{
|
||||
final ItemContainer container = event.getItemContainer();
|
||||
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
||||
final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (container == inventory || container == equipment)
|
||||
final int id = event.getContainerId();
|
||||
if (id == InventoryID.INVENTORY.getId())
|
||||
{
|
||||
doseOverlay.setHasHolyWrench(false);
|
||||
doseOverlay.setHasPrayerRestore(false);
|
||||
doseOverlay.setBonusPrayer(0);
|
||||
|
||||
if (inventory != null)
|
||||
{
|
||||
checkContainerForPrayer(inventory.getItems());
|
||||
}
|
||||
|
||||
if (equipment != null)
|
||||
{
|
||||
prayerBonus = checkContainerForPrayer(equipment.getItems());
|
||||
}
|
||||
|
||||
updatePotionBonus(event.getItemContainer(),
|
||||
client.getItemContainer(InventoryID.EQUIPMENT));
|
||||
}
|
||||
else if (id == InventoryID.EQUIPMENT.getId())
|
||||
{
|
||||
prayerBonus = totalPrayerBonus(event.getItemContainer().getItems());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,26 +212,29 @@ public class PrayerPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private int checkContainerForPrayer(Item[] items)
|
||||
private int totalPrayerBonus(Item[] items)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int total = 0;
|
||||
for (Item item : items)
|
||||
{
|
||||
ItemStats is = itemManager.getItemStats(item.getId(), false);
|
||||
if (is != null && is.getEquipment() != null)
|
||||
{
|
||||
total += is.getEquipment().getPrayer();
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
private void updatePotionBonus(ItemContainer inventory, @Nullable ItemContainer equip)
|
||||
{
|
||||
boolean hasPrayerPotion = false;
|
||||
boolean hasSuperRestore = false;
|
||||
boolean hasSanfew = false;
|
||||
boolean hasWrench = false;
|
||||
|
||||
for (Item item : items)
|
||||
for (Item item : inventory.getItems())
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final PrayerRestoreType type = PrayerRestoreType.getType(item.getId());
|
||||
|
||||
if (type != null)
|
||||
@@ -258,32 +251,45 @@ public class PrayerPlugin extends Plugin
|
||||
hasSanfew = true;
|
||||
break;
|
||||
case HOLYWRENCH:
|
||||
doseOverlay.setHasHolyWrench(true);
|
||||
hasWrench = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStats is = itemManager.getItemStats(item.getId(), false);
|
||||
if (is != null && is.getEquipment() != null)
|
||||
{
|
||||
total += is.getEquipment().getPrayer();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSanfew || hasSuperRestore || hasPrayerPotion)
|
||||
// Some items providing the holy wrench bonus can also be worn
|
||||
if (!hasWrench && equip != null)
|
||||
{
|
||||
doseOverlay.setHasPrayerRestore(true);
|
||||
if (hasSanfew)
|
||||
for (Item item : equip.getItems())
|
||||
{
|
||||
doseOverlay.setBonusPrayer(2);
|
||||
}
|
||||
else if (hasSuperRestore)
|
||||
{
|
||||
doseOverlay.setBonusPrayer(1);
|
||||
final PrayerRestoreType type = PrayerRestoreType.getType(item.getId());
|
||||
if (type == PrayerRestoreType.HOLYWRENCH)
|
||||
{
|
||||
hasWrench = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
// Prayer potion: floor(7 + 25% of base level) - 27% with holy wrench
|
||||
// Super restore: floor(8 + 25% of base level) - 27% with holy wrench
|
||||
// Sanfew serum: floor(4 + 30% of base level) - 32% with holy wrench
|
||||
final int prayerLevel = client.getRealSkillLevel(Skill.PRAYER);
|
||||
int restored = 0;
|
||||
if (hasSanfew)
|
||||
{
|
||||
restored = Math.max(restored, 4 + (int) Math.floor(prayerLevel * (hasWrench ? .32 : .30)));
|
||||
}
|
||||
if (hasSuperRestore)
|
||||
{
|
||||
restored = Math.max(restored, 8 + (int) Math.floor(prayerLevel * (hasWrench ? .27 : .25)));
|
||||
}
|
||||
if (hasPrayerPotion)
|
||||
{
|
||||
restored = Math.max(restored, 7 + (int) Math.floor(prayerLevel * (hasWrench ? .27 : .25)));
|
||||
}
|
||||
|
||||
doseOverlay.setRestoreAmount(restored);
|
||||
}
|
||||
|
||||
double getTickProgress()
|
||||
|
||||
@@ -30,7 +30,9 @@ import net.runelite.api.ItemID;
|
||||
|
||||
enum PrayerRestoreType
|
||||
{
|
||||
RESTOREPOT(ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE2, ItemID.SUPER_RESTORE1),
|
||||
RESTOREPOT(ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE2, ItemID.SUPER_RESTORE1,
|
||||
ItemID.BLIGHTED_SUPER_RESTORE4, ItemID.BLIGHTED_SUPER_RESTORE3, ItemID.BLIGHTED_SUPER_RESTORE2,
|
||||
ItemID.BLIGHTED_SUPER_RESTORE1),
|
||||
PRAYERPOT(ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION1),
|
||||
SANFEWPOT(ItemID.SANFEW_SERUM4, ItemID.SANFEW_SERUM3, ItemID.SANFEW_SERUM2, ItemID.SANFEW_SERUM1),
|
||||
HOLYWRENCH(ItemID.PRAYER_CAPE, ItemID.PRAYER_CAPET, ItemID.MAX_CAPE,
|
||||
|
||||
@@ -99,7 +99,6 @@ public class PrayerPluginTest
|
||||
|
||||
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
|
||||
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
|
||||
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
|
||||
|
||||
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
|
||||
|
||||
@@ -114,7 +113,6 @@ public class PrayerPluginTest
|
||||
|
||||
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
|
||||
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
|
||||
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
|
||||
|
||||
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
|
||||
|
||||
@@ -129,7 +127,6 @@ public class PrayerPluginTest
|
||||
|
||||
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
|
||||
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
|
||||
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
|
||||
|
||||
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
|
||||
|
||||
@@ -145,7 +142,6 @@ public class PrayerPluginTest
|
||||
|
||||
when(client.isPrayerActive(Prayer.PRESERVE)).thenReturn(true);
|
||||
when(client.getBoostedSkillLevel(Skill.PRAYER)).thenReturn(99);
|
||||
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(itemContainer);
|
||||
|
||||
prayerPlugin.onItemContainerChanged(new ItemContainerChanged(InventoryID.EQUIPMENT.getId(), itemContainer));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user