Fixes to things using the PlayerState machinery:
- Charge now clears the state when it finishes, allowing consecutive uses without relogging. - Ava's device clears the state when unequipped, allong it to be equipped again later. - (Unrelated to states) Binding necklace now uses amulet-slot degradation instead of degrading your hat.
This commit is contained in:
+1
-3
@@ -34,18 +34,16 @@ public final class AvasDevicePlugin implements Plugin<Object> {
|
||||
state.init();
|
||||
break;
|
||||
case "unequip":
|
||||
player.clearState("avadevice");
|
||||
if (args.length == 3) {
|
||||
Item second = (Item) args[2];
|
||||
if (second.getId() == 10498 || second.getId() == 10499) {
|
||||
player.clearState("avadevice");
|
||||
AvaDeviceState newState = (AvaDeviceState) player.registerState("avadevice");
|
||||
newState.setDevice(second.getId());
|
||||
newState.init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(player.hasActiveState("avadevice")) player.clearState("avadevice");
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1386,7 +1386,10 @@ public class Player extends Entity {
|
||||
public void clearState(String key){
|
||||
State state = states.get(key);
|
||||
if(state == null) return;
|
||||
state.getPulse().stop();
|
||||
Pulse pulse = state.getPulse();
|
||||
if(pulse != null) {
|
||||
pulse.stop();
|
||||
}
|
||||
states.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,14 +235,14 @@ public final class RuneCraftPulse extends SkillPulse<Item> {
|
||||
}
|
||||
if (player.getInventory().remove(new Item(PURE_ESSENCE.getId(), amount)) && player.getInventory().remove(new Item(rune.getId(), amount))) {
|
||||
for (int i = 0; i < amount; i++) {
|
||||
if (RandomFunction.random(1, 3) == 1 || hasBindingNeckalce()) {
|
||||
if (RandomFunction.random(1, 3) == 1 || hasBindingNecklace()) {
|
||||
player.getInventory().add(new Item(combo.getRune().getId(), 1));
|
||||
player.getSkills().addExperience(Skills.RUNECRAFTING, combo.getExperience(), true);
|
||||
}
|
||||
}
|
||||
if (hasBindingNeckalce()) {
|
||||
player.getEquipment().get(EquipmentContainer.SLOT_HAT).setCharge(player.getEquipment().get(EquipmentContainer.SLOT_HAT).getCharge() - 1);
|
||||
if (1000 - player.getEquipment().get(EquipmentContainer.SLOT_HAT).getCharge() > 14) {
|
||||
if (hasBindingNecklace()) {
|
||||
player.getEquipment().get(EquipmentContainer.SLOT_AMULET).setCharge(player.getEquipment().get(EquipmentContainer.SLOT_AMULET).getCharge() - 1);
|
||||
if (1000 - player.getEquipment().get(EquipmentContainer.SLOT_AMULET).getCharge() > 14) {
|
||||
player.getEquipment().remove(BINDING_NECKLACE, true);
|
||||
player.getPacketDispatch().sendMessage("Your binding necklace crumbles into dust.");
|
||||
}
|
||||
@@ -326,7 +326,7 @@ public final class RuneCraftPulse extends SkillPulse<Item> {
|
||||
*
|
||||
* @return <code>True</code> if so.
|
||||
*/
|
||||
public boolean hasBindingNeckalce() {
|
||||
public boolean hasBindingNecklace() {
|
||||
return player.getEquipment().containsItem(BINDING_NECKLACE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user