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,119 +486,77 @@ 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()) {
{ buildChargesEntries(TRIDENT_OF_THE_SEAS);
if (config.chargesBox()) } else {
{ buildEntries(CHAOS_RUNE);
buildChargesEntries(TRIDENT_OF_THE_SEAS); buildEntries(DEATH_RUNE);
buildEntries(FIRE_RUNE, 5);
buildEntries(COINS_995, 10);
}
break;
} }
else
{
buildEntries(CHAOS_RUNE);
buildEntries(DEATH_RUNE);
buildEntries(FIRE_RUNE, 5);
buildEntries(COINS_995, 10);
}
break;
} }
} //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 (config.chargesBox()) {
if (mainHand == tridentOfTheSwamp) buildChargesEntries(TRIDENT_OF_THE_SWAMP);
{ } else {
if (config.chargesBox()) buildEntries(CHAOS_RUNE);
{ buildEntries(DEATH_RUNE);
buildChargesEntries(TRIDENT_OF_THE_SWAMP); buildEntries(FIRE_RUNE, 5);
buildEntries(ZULRAHS_SCALES);
}
break;
} }
else }
{ //Sang Staff
buildEntries(CHAOS_RUNE); if (mainHand == SANGUINESTI_STAFF) {
buildEntries(DEATH_RUNE); if (config.chargesBox()) {
buildEntries(FIRE_RUNE, 5); buildChargesEntries(SANGUINESTI_STAFF);
buildEntries(ZULRAHS_SCALES); } else {
buildEntries(BLOOD_RUNE, 3);
} }
break;
} }
} break;
//Sang Staff case LOW_LEVEL_MAGIC_ATTACK:
if (mainHand == SANGUINESTI_STAFF) case BARRAGE_ANIMATION:
{ case BLITZ_ANIMATION:
if (config.chargesBox()) case LOW_LEVEL_STANDARD_SPELLS:
{ case WAVE_SPELL_ANIMATION:
buildChargesEntries(SANGUINESTI_STAFF); case SURGE_SPELL_ANIMATION:
case HIGH_ALCH_ANIMATION:
case 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);
} }
else if (!magicXpChanged) {
{ skipTick = true;
noXpCast = true;
}
break;
case SCYTHE_OF_VITUR_ANIMATION:
if (config.chargesBox()) {
buildChargesEntries(SCYTHE_OF_VITUR);
} else {
buildEntries(BLOOD_RUNE, 3); buildEntries(BLOOD_RUNE, 3);
buildEntries(COINS_995, itemManager.getItemPrice(VIAL_OF_BLOOD_22446) / 100);
} }
} break;
} case ONEHAND_SLASH_SWORD_ANIMATION:
else if (playerAniId == LOW_LEVEL_MAGIC_ATTACK) case ONEHAND_STAB_SWORD_ANIMATION:
{ buildChargesEntries(BLADE_OF_SAELDOR);
old = client.getItemContainer(InventoryID.INVENTORY); break;
if (old != null && old.getItems() != null && actionStack.stream().noneMatch(a ->
a.getType() == CAST))
{
MenuAction newAction = new MenuAction(CAST, old.getItems());
actionStack.push(newAction);
}
}
//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;
noXpCast = true;
}
}
else if (playerAniId == SCYTHE_OF_VITUR_ANIMATION)
{
if (config.chargesBox())
{
buildChargesEntries(SCYTHE_OF_VITUR);
}
else
{
buildEntries(BLOOD_RUNE, 3);
buildEntries(COINS_995, itemManager.getItemPrice(VIAL_OF_BLOOD_22446) / 100);
}
}
else if (playerAniId == ONEHAND_SLASH_SWORD_ANIMATION ||
playerAniId == ONEHAND_STAB_SWORD_ANIMATION)
{
buildChargesEntries(BLADE_OF_SAELDOR);
} }
} }
} }

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) + ") ";
} }