Adds consideration to the number of Smith's Outfit pieces currently worn by the player.
This commit is contained in:
@@ -13,6 +13,8 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.api.ItemContainer;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.api.events.GameObjectDespawned;
|
import net.runelite.api.events.GameObjectDespawned;
|
||||||
import net.runelite.api.events.GameObjectSpawned;
|
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.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Easy Giant's Foundry",
|
name = "Easy Giant's Foundry",
|
||||||
@@ -57,6 +61,9 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
|
|
||||||
private static final int REPUTATION_VARBIT = 3436;
|
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 Stage oldStage;
|
||||||
|
|
||||||
private int lastBoost;
|
private int lastBoost;
|
||||||
@@ -243,11 +250,17 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onItemContainerChanged(ItemContainerChanged event)
|
public void onItemContainerChanged(ItemContainerChanged event)
|
||||||
{
|
{
|
||||||
if (event.getContainerId() == InventoryID.EQUIPMENT.getId()
|
if (event.getContainerId() == InventoryID.EQUIPMENT.getId())
|
||||||
&& event.getItemContainer().count(PREFORM) == 0)
|
|
||||||
{
|
{
|
||||||
state.reset();
|
if (event.getItemContainer().count(PREFORM) == 0)
|
||||||
oldStage = null;
|
{
|
||||||
|
state.reset();
|
||||||
|
oldStage = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateSmithsOutfitPieces();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +395,29 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
bonusNotified = true;
|
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
|
@Provides
|
||||||
EasyGiantsFoundryConfig provideConfig(ConfigManager configManager)
|
EasyGiantsFoundryConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ public class EasyGiantsFoundryState
|
|||||||
@Getter
|
@Getter
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private int smithsOutfitPieces;
|
||||||
|
|
||||||
private final List<Stage> stages = new ArrayList<>();
|
private final List<Stage> stages = new ArrayList<>();
|
||||||
private double heatRangeRatio = 0;
|
private double heatRangeRatio = 0;
|
||||||
|
|
||||||
@@ -241,7 +244,9 @@ public class EasyGiantsFoundryState
|
|||||||
double progressTillNext = progressPerStage - progress % progressPerStage;
|
double progressTillNext = progressPerStage - progress % progressPerStage;
|
||||||
|
|
||||||
Stage current = getCurrentStage();
|
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()
|
public int[] getCurrentHeatRange()
|
||||||
|
|||||||
Reference in New Issue
Block a user