Browse Source

use new power manager

feature-config-usage
FatBoy-DOTC 2 weeks ago
parent
commit
3be5236ba8
  1. 8
      src/engine/gameManager/PowersManager.java
  2. 45
      src/engine/wpak/WpakPowerManager.java

8
src/engine/gameManager/PowersManager.java

@ -64,10 +64,12 @@ public enum PowersManager {
public static void initPowersManager(boolean fullPowersLoad) { public static void initPowersManager(boolean fullPowersLoad) {
if (fullPowersLoad) if (fullPowersLoad) {
PowersManager.InitializePowers(); //PowersManager.InitializePowers();
else WpakPowerManager.init();
}else {
PowersManager.InitializeLoginPowers(); PowersManager.InitializeLoginPowers();
}
PowersManager.js = JobScheduler.getInstance(); PowersManager.js = JobScheduler.getInstance();

45
src/engine/wpak/WpakPowerManager.java

@ -5,7 +5,6 @@ import engine.gameManager.*;
import engine.job.JobContainer; import engine.job.JobContainer;
import engine.job.JobScheduler; import engine.job.JobScheduler;
import engine.jobs.FinishRecycleTimeJob; import engine.jobs.FinishRecycleTimeJob;
import engine.jobs.UsePowerJob;
import engine.jobs.WpakUsePowerJob; import engine.jobs.WpakUsePowerJob;
import engine.math.Vector3fImmutable; import engine.math.Vector3fImmutable;
import engine.mbEnums; import engine.mbEnums;
@ -16,14 +15,11 @@ import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.RecyclePowerMsg; import engine.net.client.msg.RecyclePowerMsg;
import engine.net.client.msg.UpdateStateMsg; import engine.net.client.msg.UpdateStateMsg;
import engine.objects.*; import engine.objects.*;
import engine.powers.PowersBase;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import engine.util.Hasher; import engine.util.Hasher;
import engine.wpak.data.*; import engine.wpak.data.*;
import engine.wpak.data.Effect; import engine.wpak.data.Effect;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -31,42 +27,18 @@ import static engine.math.FastMath.sqr;
public class WpakPowerManager { public class WpakPowerManager {
public static HashMap<String, Effect> effect_data = new HashMap<>(); public static HashMap<String, Effect> effect_data = new HashMap<>();
public static HashMap<Integer, PowerAction> power_actions= new HashMap<>(); public static HashMap<Integer, PowerAction> power_actions = new HashMap<>();
public static HashMap<Integer, Power> powers= new HashMap<>(); public static HashMap<Integer, Power> powers = new HashMap<>();
private static JobScheduler js; private static JobScheduler js;
public static void usePower(final PerformActionMsg msg, ClientConnection origin, boolean sendCastToSelf) { public static void init(){
EffectsParser.parseWpakFile();
PowersParser.parseWpakFile();
PowerActionParser.parseWpakFile();
}
if (ConfigManager.MB_RULESET.getValue().equals("LORE")) { public static void usePower(final PerformActionMsg msg, ClientConnection origin, boolean sendCastToSelf) {
PowersBase pb = PowersManager.powersBaseByToken.get(msg.getPowerUsedID());
PlayerCharacter caster = origin.getPlayerCharacter();
PlayerCharacter target = PlayerCharacter.getFromCache(msg.getTargetID());
if (pb != null && pb.enforceLore()) {
//if (caster.guild.equals(Guild.getErrantGuild()))
// return;
if (target != null && caster.guild.getGuildType().equals(target.guild.getGuildType()) == false && target.getObjectType().equals(mbEnums.GameObjectType.Building) == false) {
RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID());
Dispatch dispatch = Dispatch.borrow(origin.getPlayerCharacter(), recyclePowerMsg);
DispatchManager.dispatchMsgDispatch(dispatch, mbEnums.DispatchChannel.PRIMARY);
// Send Fail to cast message
PlayerCharacter pc = SessionManager
.getPlayerCharacter(origin);
if (pc != null) {
sendPowerMsg(pc, 2, msg);
if (pc.isCasting()) {
pc.update();
}
pc.setIsCasting(false);
}
return;
}
}
}
if (castPower(msg, origin, sendCastToSelf)) { if (castPower(msg, origin, sendCastToSelf)) {
// Cast failed for some reason, reset timer // Cast failed for some reason, reset timer
@ -87,7 +59,6 @@ public class WpakPowerManager {
pc.setIsCasting(false); pc.setIsCasting(false);
} }
} }
} }

Loading…
Cancel
Save