Hey -Andreas, found a little issue and it has me stumped.
Randomly, special attacks "null". As in, the special attack bar becomes unclickable (the server detects the click), but it doesn't request to use a special attack. This happens randomly while switching, and I cannot figure out what is causing the click to be lost.
- Also looked through a older release, code seems to be pretty much unchanged.
- Edit 1: It also happens at random, after opening a bank, etc. Just makes the click dead on the spec bar. (But it is detected server sided).
Avalon Release 2 submitSpecialRequest(player);
Code:
public static void submitSpecialRequest(final Player player) {
CoresManager.fastExecutor.schedule(new TimerTask() {
@Override
public void run() {
try {
WorldTasksManager.schedule(new WorldTask() {
@Override
public void run() {
final int weaponId = player.getEquipment().getWeaponId();
if (player.hasInstantSpecial(weaponId) && !player.itemSwitch) {
final Entity target = (Entity) player.temporaryAttribute().get("last_target");
if ((player.getActionManager().getAction() instanceof PlayerCombat) && target != null) {
player.getActionManager().forceStop();
player.performInstantSpecial(weaponId);
player.getActionManager().setAction(new PlayerCombat(target));
} else {
player.getActionManager().forceStop();
player.performInstantSpecial(weaponId);
}
return;
}
player.getCombatDefinitions().switchUsingSpecialAttack();
}
}, 0);
} catch (Throwable e) {
Logger.handle(e);
}
}
}, 0);
}
The issue isn't present, as far as I have noticed in the older version of Avalon/Rain III.
Avalon/Rain III - 2015-2016 submitSpecialRequest(player);
Code:
public static void submitSpecialRequest(final Player player) {
CoresManager.fastExecutor.schedule(new TimerTask() {
@Override
public void run() {
try {
WorldTasksManager.schedule(new WorldTask() {
@Override
public void run() {
final int weaponId = player.getEquipment()
.getWeaponId();
if (player.hasInstantSpecial(weaponId)
&& !player.itemSwitch) {
final Entity target = (Entity) player
.temporaryAttribute()
.get("last_target");
if ((player.getActionManager().getAction() instanceof PlayerCombat)
&& target != null) {
player.getActionManager().forceStop();
player.performInstantSpecial(weaponId);
player.getActionManager().setAction(
new PlayerCombat(target));
} else {
player.getActionManager().forceStop();
player.performInstantSpecial(weaponId);
}
return;
}
player.getCombatDefinitions()
.switchUsingSpecialAttack();
}
}, 0);
} catch (Throwable e) {
Logger.handle(e);
}
}
}, 0);
}