statusorbs: Edit graceful recovery rate calculations (#2205)

statusorbs: Edit graceful recovery rate calculations
This commit is contained in:
Owain van Brakel
2020-01-10 15:24:11 +01:00
committed by GitHub
3 changed files with 74 additions and 17 deletions

View File

@@ -187,10 +187,7 @@ public class StatusOrbsOverlay extends Overlay
{ {
double recoverRate = (48 + client.getBoostedSkillLevel(Skill.AGILITY)) / 360000.0; double recoverRate = (48 + client.getBoostedSkillLevel(Skill.AGILITY)) / 360000.0;
if (Graceful.hasFullSet(client.getItemContainer(InventoryID.EQUIPMENT))) recoverRate *= Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT));
{
recoverRate *= 1.3; // 30% recover rate increase from Graceful set effect
}
percentRun += ms * recoverRate; percentRun += ms * recoverRate;
} }

View File

@@ -382,11 +382,7 @@ public class StatusOrbsPlugin extends Plugin
// Calculate the amount of energy recovered every second // Calculate the amount of energy recovered every second
double recoverRate = (48 + client.getBoostedSkillLevel(Skill.AGILITY)) / 360.0; double recoverRate = (48 + client.getBoostedSkillLevel(Skill.AGILITY)) / 360.0;
recoverRate *= Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT));
if (Graceful.hasFullSet(client.getItemContainer(InventoryID.EQUIPMENT)))
{
recoverRate *= 1.3; // 30% recover rate increase from Graceful set effect
}
// Calculate the number of seconds left // Calculate the number of seconds left
final double secondsLeft = (100 - client.getEnergy()) / recoverRate; final double secondsLeft = (100 - client.getEnergy()) / recoverRate;
@@ -432,11 +428,8 @@ public class StatusOrbsPlugin extends Plugin
private double runRegenPerTick() private double runRegenPerTick()
{ {
double recoverRate = (client.getBoostedSkillLevel(Skill.AGILITY) / 6d + 8) / 100; double recoverRate = (client.getBoostedSkillLevel(Skill.AGILITY) / 6d + 8) / 100;
recoverRate *= Graceful.calculateRecoveryRate(client.getItemContainer(InventoryID.EQUIPMENT));
if (Graceful.hasFullSet(client.getItemContainer(InventoryID.EQUIPMENT)))
{
return recoverRate * 1.3;
}
return recoverRate; return recoverRate;
} }

View File

@@ -78,20 +78,87 @@ public enum Graceful
this.ids = ImmutableSet.copyOf(ids); this.ids = ImmutableSet.copyOf(ids);
} }
public static boolean hasFullSet(final ItemContainer equipment) public static double calculateRecoveryRate(final ItemContainer equipment)
{ {
double rate = 1;
if (equipment == null) if (equipment == null)
{ {
return false; return rate;
} }
final Item[] items = equipment.getItems(); final Item[] items = equipment.getItems();
if (equipment == null || items.length <= EquipmentInventorySlot.BOOTS.getSlotIdx()) if (hasFullSet(items))
{ {
return false; return 1.3;
} }
if (hasHood(items))
{
rate += 0.03;
}
if (hasTop(items))
{
rate += 0.04;
}
if (hasLegs(items))
{
rate += 0.04;
}
if (hasGloves(items))
{
rate += 0.03;
}
if (hasBoots(items))
{
rate += 0.03;
}
if (hasCape(items))
{
rate += 0.03;
}
return rate;
}
public static boolean hasHood(final Item[] items)
{
return HOOD.ids.contains(items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId());
}
public static boolean hasTop(final Item[] items)
{
return TOP.ids.contains(items[EquipmentInventorySlot.BODY.getSlotIdx()].getId());
}
public static boolean hasLegs(final Item[] items)
{
return LEGS.ids.contains(items[EquipmentInventorySlot.LEGS.getSlotIdx()].getId());
}
public static boolean hasGloves(final Item[] items)
{
return GLOVES.ids.contains(items[EquipmentInventorySlot.GLOVES.getSlotIdx()].getId());
}
public static boolean hasBoots(final Item[] items)
{
return BOOTS.ids.contains(items[EquipmentInventorySlot.BOOTS.getSlotIdx()].getId());
}
public static boolean hasCape(final Item[] items)
{
return CAPE.ids.contains(items[EquipmentInventorySlot.CAPE.getSlotIdx()].getId());
}
public static boolean hasFullSet(final Item[] items)
{
return HOOD.ids.contains(items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId()) return HOOD.ids.contains(items[EquipmentInventorySlot.HEAD.getSlotIdx()].getId())
&& TOP.ids.contains(items[EquipmentInventorySlot.BODY.getSlotIdx()].getId()) && TOP.ids.contains(items[EquipmentInventorySlot.BODY.getSlotIdx()].getId())
&& LEGS.ids.contains(items[EquipmentInventorySlot.LEGS.getSlotIdx()].getId()) && LEGS.ids.contains(items[EquipmentInventorySlot.LEGS.getSlotIdx()].getId())