forked from MagicBane/Server
powers thread
This commit is contained in:
@@ -60,6 +60,19 @@ public enum PowersManager {
|
|||||||
public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"};
|
public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"};
|
||||||
public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"};
|
public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"};
|
||||||
|
|
||||||
|
public static ArrayList<PowerQueObject> static_power_que = new ArrayList<>();
|
||||||
|
|
||||||
|
public static class PowerQueObject{
|
||||||
|
public PowerQueObject(PerformActionMsg inmsg,ClientConnection inorigin,boolean insendCastToSelf){
|
||||||
|
this.msg = inmsg;
|
||||||
|
this.origin = inorigin;
|
||||||
|
this.sendCastToSelf = insendCastToSelf;
|
||||||
|
}
|
||||||
|
public PerformActionMsg msg;
|
||||||
|
public ClientConnection origin;
|
||||||
|
public boolean sendCastToSelf;
|
||||||
|
}
|
||||||
|
|
||||||
private PowersManager() {
|
private PowersManager() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1921,7 +1921,8 @@ public class ClientMessagePump implements NetMsgHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case POWER:
|
case POWER:
|
||||||
PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
//PowersManager.usePower((PerformActionMsg) msg, origin, false);
|
||||||
|
PowersManager.static_power_que.add(new PowersManager.PowerQueObject((PerformActionMsg) msg, origin, false));
|
||||||
break;
|
break;
|
||||||
case REQUESTMELEEATTACK:
|
case REQUESTMELEEATTACK:
|
||||||
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
|
CombatManager.setAttackTarget((AttackCmdMsg) msg, origin);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package engine.workthreads;
|
||||||
|
|
||||||
|
import engine.gameManager.PowersManager;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class PowersThread implements Runnable {
|
||||||
|
|
||||||
|
public PowersThread(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
while(true){
|
||||||
|
ArrayList<PowersManager.PowerQueObject> purge = new ArrayList<>();
|
||||||
|
for(PowersManager.PowerQueObject pqo : PowersManager.static_power_que){
|
||||||
|
purge.add(pqo);
|
||||||
|
PowersManager.usePower(pqo.msg,pqo.origin,pqo.sendCastToSelf);
|
||||||
|
}
|
||||||
|
PowersManager.static_power_que.removeAll(purge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user