Changed on animation changed checks to switch and cleaned up a bit

This commit is contained in:
Dyldozer
2019-12-23 02:09:17 -06:00
parent 25fe4f30d5
commit e457b1d453
2 changed files with 64 additions and 116 deletions

View File

@@ -196,7 +196,6 @@ public class SuppliesTrackerPlugin extends Plugin
name.contains("(2)") || name.contains("(2)") ||
name.contains("(1)"); name.contains("(1)");
} }
/** /**
* Checks if item name is pizza or pie * Checks if item name is pizza or pie
* *
@@ -208,7 +207,6 @@ public class SuppliesTrackerPlugin extends Plugin
return name.toLowerCase().contains("pizza") || return name.toLowerCase().contains("pizza") ||
name.toLowerCase().contains(" pie"); name.toLowerCase().contains(" pie");
} }
public static boolean isCake(String name, int itemId) public static boolean isCake(String name, int itemId)
{ {
return name.toLowerCase().contains("cake") || return name.toLowerCase().contains("cake") ||
@@ -255,6 +253,7 @@ public class SuppliesTrackerPlugin extends Plugin
{ {
skipTick = true; skipTick = true;
magicXpChanged = true; magicXpChanged = true;
magicXp = event.getXp();
} }
} }
} }
@@ -283,8 +282,6 @@ public class SuppliesTrackerPlugin extends Plugin
ticks = 0; ticks = 0;
} }
if (skipTick) if (skipTick)
{ {
skipTick = false; skipTick = false;
@@ -489,19 +486,14 @@ public class SuppliesTrackerPlugin extends Plugin
{ {
int playerAniId = animationChanged.getActor().getAnimation(); int playerAniId = animationChanged.getActor().getAnimation();
if (playerAniId == HIGH_LEVEL_MAGIC_ATTACK) switch (playerAniId) {
{ case HIGH_LEVEL_MAGIC_ATTACK:
//Trident of the seas //Trident of the seas
for (int tridentOfTheSeas : TRIDENT_OF_THE_SEAS_IDS) for (int tridentOfTheSeas : TRIDENT_OF_THE_SEAS_IDS) {
{ if (mainHand == tridentOfTheSeas) {
if (mainHand == tridentOfTheSeas) if (config.chargesBox()) {
{
if (config.chargesBox())
{
buildChargesEntries(TRIDENT_OF_THE_SEAS); buildChargesEntries(TRIDENT_OF_THE_SEAS);
} } else {
else
{
buildEntries(CHAOS_RUNE); buildEntries(CHAOS_RUNE);
buildEntries(DEATH_RUNE); buildEntries(DEATH_RUNE);
buildEntries(FIRE_RUNE, 5); buildEntries(FIRE_RUNE, 5);
@@ -511,16 +503,11 @@ public class SuppliesTrackerPlugin extends Plugin
} }
} }
//Trident of the swamp //Trident of the swamp
for (int tridentOfTheSwamp : TRIDENT_OF_THE_SWAMP_IDS) for (int tridentOfTheSwamp : TRIDENT_OF_THE_SWAMP_IDS) {
{ if (mainHand == tridentOfTheSwamp) {
if (mainHand == tridentOfTheSwamp) if (config.chargesBox()) {
{
if (config.chargesBox())
{
buildChargesEntries(TRIDENT_OF_THE_SWAMP); buildChargesEntries(TRIDENT_OF_THE_SWAMP);
} } else {
else
{
buildEntries(CHAOS_RUNE); buildEntries(CHAOS_RUNE);
buildEntries(DEATH_RUNE); buildEntries(DEATH_RUNE);
buildEntries(FIRE_RUNE, 5); buildEntries(FIRE_RUNE, 5);
@@ -530,78 +517,46 @@ public class SuppliesTrackerPlugin extends Plugin
} }
} }
//Sang Staff //Sang Staff
if (mainHand == SANGUINESTI_STAFF) if (mainHand == SANGUINESTI_STAFF) {
{ if (config.chargesBox()) {
if (config.chargesBox())
{
buildChargesEntries(SANGUINESTI_STAFF); buildChargesEntries(SANGUINESTI_STAFF);
} } else {
else
{
buildEntries(BLOOD_RUNE, 3); buildEntries(BLOOD_RUNE, 3);
} }
} }
} break;
else if (playerAniId == LOW_LEVEL_MAGIC_ATTACK) case LOW_LEVEL_MAGIC_ATTACK:
{ case BARRAGE_ANIMATION:
case BLITZ_ANIMATION:
case LOW_LEVEL_STANDARD_SPELLS:
case WAVE_SPELL_ANIMATION:
case SURGE_SPELL_ANIMATION:
case HIGH_ALCH_ANIMATION:
case LUNAR_HUMIDIFY:
old = client.getItemContainer(InventoryID.INVENTORY); old = client.getItemContainer(InventoryID.INVENTORY);
if (old != null && old.getItems() != null && actionStack.stream().noneMatch(a -> if (old != null && old.getItems() != null && actionStack.stream().noneMatch(a ->
a.getType() == CAST)) a.getType() == CAST)) {
{
MenuAction newAction = new MenuAction(CAST, old.getItems()); MenuAction newAction = new MenuAction(CAST, old.getItems());
actionStack.push(newAction); actionStack.push(newAction);
} }
} if (!magicXpChanged) {
//Ancients
else if (playerAniId == BARRAGE_ANIMATION ||
playerAniId == BLITZ_ANIMATION)
{
old = client.getItemContainer(InventoryID.INVENTORY);
if (old != null && old.getItems() != null && actionStack.stream().noneMatch(a ->
a.getType() == CAST))
{
MenuAction newAction = new MenuAction(CAST, old.getItems());
actionStack.push(newAction);
}
}
else if ( playerAniId == LOW_LEVEL_STANDARD_SPELLS ||
playerAniId == WAVE_SPELL_ANIMATION ||
playerAniId == SURGE_SPELL_ANIMATION ||
playerAniId == HIGH_ALCH_ANIMATION ||
playerAniId == LUNAR_HUMIDIFY)
{
old = client.getItemContainer(InventoryID.INVENTORY);
if (old != null && old.getItems() != null && actionStack.stream().noneMatch(a ->
a.getType() == CAST))
{
MenuAction newAction = new MenuAction(CAST, old.getItems());
actionStack.push(newAction);
}
if (!magicXpChanged)
{
skipTick = true; skipTick = true;
noXpCast = true; noXpCast = true;
} }
} break;
else if (playerAniId == SCYTHE_OF_VITUR_ANIMATION) case SCYTHE_OF_VITUR_ANIMATION:
{ if (config.chargesBox()) {
if (config.chargesBox())
{
buildChargesEntries(SCYTHE_OF_VITUR); buildChargesEntries(SCYTHE_OF_VITUR);
} } else {
else
{
buildEntries(BLOOD_RUNE, 3); buildEntries(BLOOD_RUNE, 3);
buildEntries(COINS_995, itemManager.getItemPrice(VIAL_OF_BLOOD_22446) / 100); buildEntries(COINS_995, itemManager.getItemPrice(VIAL_OF_BLOOD_22446) / 100);
} }
} break;
else if (playerAniId == ONEHAND_SLASH_SWORD_ANIMATION || case ONEHAND_SLASH_SWORD_ANIMATION:
playerAniId == ONEHAND_STAB_SWORD_ANIMATION) case ONEHAND_STAB_SWORD_ANIMATION:
{
buildChargesEntries(BLADE_OF_SAELDOR); buildChargesEntries(BLADE_OF_SAELDOR);
break;
} }
} }
} }

View File

@@ -619,8 +619,6 @@ public abstract class SuppliesBox extends JPanel
@Override @Override
final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item)
{ {
final String name = item.getName();
final long price = itemManager.getItemPrice(itemId); final long price = itemManager.getItemPrice(itemId);
return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") "; return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") ";
} }
@@ -651,8 +649,6 @@ public abstract class SuppliesBox extends JPanel
@Override @Override
final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item)
{ {
final String name = item.getName();
final long price = itemManager.getItemPrice(plugin.getPotionID(item.getName().replaceAll(POTION_PATTERN, "(4)"))) / 4; final long price = itemManager.getItemPrice(plugin.getPotionID(item.getName().replaceAll(POTION_PATTERN, "(4)"))) / 4;
return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") "; return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") ";
} }
@@ -698,9 +694,6 @@ public abstract class SuppliesBox extends JPanel
@Override @Override
final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item) final String buildTooltip(int itemId, int qty, SuppliesTrackerItem item)
{ {
final String name = item.getName();
final long price = itemManager.getItemPrice(itemId); final long price = itemManager.getItemPrice(itemId);
return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") "; return item.getName() + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") ";
} }