Adds consideration to the number of Smith's Outfit pieces currently worn by the player.

This commit is contained in:
Tal Skverer
2024-06-30 11:48:59 +03:00
parent 42a7260b81
commit 30ef327abb
2 changed files with 46 additions and 5 deletions

View File

@@ -13,6 +13,8 @@ import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.GameState;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemContainer;
import net.runelite.api.Skill;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
@@ -34,6 +36,8 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import java.util.Set;
@Slf4j
@PluginDescriptor(
name = "Easy Giant's Foundry",
@@ -57,6 +61,9 @@ public class EasyGiantsFoundryPlugin extends Plugin
private static final int REPUTATION_VARBIT = 3436;
// 5 total items, includes Smiths gloves (i);
private static final Set<Integer> SMITHS_OUTFIT_IDS = Set.of(27023, 27025, 27027, 27029, 27031);
private Stage oldStage;
private int lastBoost;
@@ -243,12 +250,18 @@ public class EasyGiantsFoundryPlugin extends Plugin
@Subscribe
public void onItemContainerChanged(ItemContainerChanged event)
{
if (event.getContainerId() == InventoryID.EQUIPMENT.getId()
&& event.getItemContainer().count(PREFORM) == 0)
if (event.getContainerId() == InventoryID.EQUIPMENT.getId())
{
if (event.getItemContainer().count(PREFORM) == 0)
{
state.reset();
oldStage = null;
}
else
{
updateSmithsOutfitPieces();
}
}
}
@Subscribe
@@ -382,6 +395,29 @@ public class EasyGiantsFoundryPlugin extends Plugin
bonusNotified = true;
}
private void updateSmithsOutfitPieces()
{
int pieces = 0;
ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT);
if (equipment != null)
{
for (Item item : equipment.getItems())
{
if (item != null && isSmithsOutfitPiece(item.getId()))
{
pieces++;
}
}
}
state.setSmithsOutfitPieces(pieces);
}
private boolean isSmithsOutfitPiece(int itemId)
{
return SMITHS_OUTFIT_IDS.contains(itemId);
}
@Provides
EasyGiantsFoundryConfig provideConfig(ConfigManager configManager)
{

View File

@@ -29,6 +29,9 @@ public class EasyGiantsFoundryState
@Getter
private boolean enabled;
@Setter
private int smithsOutfitPieces;
private final List<Stage> stages = new ArrayList<>();
private double heatRangeRatio = 0;
@@ -241,7 +244,9 @@ public class EasyGiantsFoundryState
double progressTillNext = progressPerStage - progress % progressPerStage;
Stage current = getCurrentStage();
return (int) Math.ceil(progressTillNext / current.getProgressPerAction());
// Each Smith's Outfit piece adds 20% chance to increase action progress by 1, or 100% for all 4 pieces.
double smithsOutfitBonus = smithsOutfitPieces == 4 ? 1 : 0.2 * smithsOutfitPieces;
return (int) Math.ceil(progressTillNext / (current.getProgressPerAction() + smithsOutfitBonus));
}
public int[] getCurrentHeatRange()