Fix weapon special usage
This commit is contained in:
parent
344ee6cb24
commit
5c1991fb1a
@ -126,6 +126,7 @@ public class Consume extends Plugin implements KeyListener {
|
||||
private boolean shouldDrinkMagic;
|
||||
private long lastMagic;
|
||||
private boolean shouldUseSpecial;
|
||||
private long lastSpecial;
|
||||
private boolean pkTeleport;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ -179,7 +180,8 @@ public class Consume extends Plugin implements KeyListener {
|
||||
|
||||
if (config.useSpecial()
|
||||
&& event.getIndex() == VarPlayer.SPECIAL_ATTACK_PERCENT.getId()
|
||||
&& game.client().getVarpValue(VarPlayer.SPECIAL_ATTACK_PERCENT.getId()) > config.specialCost()) {
|
||||
&& game.client().getVarpValue(VarPlayer.SPECIAL_ATTACK_PERCENT.getId()) / 10 >= config.specialCost()
|
||||
&& lastSpecial + 2000 < System.currentTimeMillis()) {
|
||||
shouldUseSpecial = true;
|
||||
}
|
||||
}
|
||||
@ -281,8 +283,9 @@ public class Consume extends Plugin implements KeyListener {
|
||||
|
||||
if (shouldUseSpecial && game.client().getVarpValue(VarPlayer.SPECIAL_ATTACK_ENABLED.getId()) == 0) {
|
||||
shouldUseSpecial = false;
|
||||
lastSpecial = System.currentTimeMillis();
|
||||
|
||||
if (game.client().getVar(Varbits.PVP_SPEC_ORB) == 0) {
|
||||
if (game.varb(Varbits.PVP_SPEC_ORB.getId()) == 0) {
|
||||
iWidget special = game.widget(WidgetInfo.MINIMAP_SPEC_CLICKBOX);
|
||||
if (special == null) return;
|
||||
|
||||
@ -400,7 +403,7 @@ public class Consume extends Plugin implements KeyListener {
|
||||
private void onInteractingChanged(InteractingChanged event) {
|
||||
if (!config.tpOnPlayerAttack() || !pkTeleport || game.client().getVar(Varbits.IN_WILDERNESS) == 0) return;
|
||||
|
||||
if (event.getSource() == null || event.getTarget() == null) return;
|
||||
if (event.getSource() == null || event.getTarget() == null || event.getTarget().getName() == null) return;
|
||||
|
||||
if (event.getSource() instanceof Player && event.getTarget().equals(game.client().getLocalPlayer())) {
|
||||
log.info("Player attacking us: " + event.getSource().getName());
|
||||
|
Loading…
x
Reference in New Issue
Block a user