Merge pull request #1026 from Abextm/holy-wrench
itemstats: Support holy wrench effect
This commit is contained in:
@@ -292,6 +292,7 @@ public interface Client extends GameEngine
|
|||||||
* @param inventory
|
* @param inventory
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
ItemContainer getItemContainer(InventoryID inventory);
|
ItemContainer getItemContainer(InventoryID inventory);
|
||||||
|
|
||||||
int getIntStackSize();
|
int getIntStackSize();
|
||||||
|
|||||||
@@ -25,6 +25,10 @@
|
|||||||
package net.runelite.client.plugins.itemstats.potions;
|
package net.runelite.client.plugins.itemstats.potions;
|
||||||
|
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.InventoryID;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.api.ItemContainer;
|
||||||
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.client.plugins.itemstats.StatBoost;
|
import net.runelite.client.plugins.itemstats.StatBoost;
|
||||||
import static net.runelite.client.plugins.itemstats.stats.Stats.PRAYER;
|
import static net.runelite.client.plugins.itemstats.stats.Stats.PRAYER;
|
||||||
|
|
||||||
@@ -38,11 +42,57 @@ public class PrayerPotion extends StatBoost
|
|||||||
this.delta = delta;
|
this.delta = delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final int RING_SLOT = 12;
|
||||||
|
private static final int CAPE_SLOT = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int heals(Client client)
|
public int heals(Client client)
|
||||||
{
|
{
|
||||||
|
boolean hasHolyWrench = false;
|
||||||
|
|
||||||
|
ItemContainer equipContainer = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||||
|
if (equipContainer != null)
|
||||||
|
{
|
||||||
|
Item[] equip = equipContainer.getItems();
|
||||||
|
|
||||||
|
hasHolyWrench |= equip.length > RING_SLOT && equip[RING_SLOT].getId() == ItemID.RING_OF_THE_GODS_I;
|
||||||
|
if (equip.length > CAPE_SLOT)
|
||||||
|
{
|
||||||
|
int cape = equip[CAPE_SLOT].getId();
|
||||||
|
hasHolyWrench |= cape == ItemID.PRAYER_CAPE;
|
||||||
|
hasHolyWrench |= cape == ItemID.PRAYER_CAPET;
|
||||||
|
hasHolyWrench |= cape == ItemID.PRAYER_CAPE_10643; // No idea what this is
|
||||||
|
hasHolyWrench |= cape == ItemID.MAX_CAPE;
|
||||||
|
hasHolyWrench |= cape == ItemID.MAX_CAPE_13282; // Or these
|
||||||
|
hasHolyWrench |= cape == ItemID.MAX_CAPE_13342;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasHolyWrench)
|
||||||
|
{
|
||||||
|
ItemContainer invContainer = client.getItemContainer(InventoryID.INVENTORY);
|
||||||
|
if (invContainer != null)
|
||||||
|
{
|
||||||
|
for (Item itemStack : invContainer.getItems())
|
||||||
|
{
|
||||||
|
int item = itemStack.getId();
|
||||||
|
hasHolyWrench |= item == ItemID.HOLY_WRENCH;
|
||||||
|
hasHolyWrench |= item == ItemID.PRAYER_CAPE;
|
||||||
|
hasHolyWrench |= item == ItemID.PRAYER_CAPET;
|
||||||
|
hasHolyWrench |= item == ItemID.PRAYER_CAPE_10643;
|
||||||
|
hasHolyWrench |= item == ItemID.MAX_CAPE;
|
||||||
|
hasHolyWrench |= item == ItemID.MAX_CAPE_13282;
|
||||||
|
hasHolyWrench |= item == ItemID.MAX_CAPE_13342;
|
||||||
|
|
||||||
|
if (hasHolyWrench)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double perc = hasHolyWrench ? .27 : .25;
|
||||||
int max = getStat().getMaximum(client);
|
int max = getStat().getMaximum(client);
|
||||||
double perc = .25;
|
|
||||||
return (((int) (max * perc)) * (delta >= 0 ? 1 : -1)) + delta;
|
return (((int) (max * perc)) * (delta >= 0 ? 1 : -1)) + delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user