diff --git a/src/resources/common/MathUtilities.java b/src/resources/common/MathUtilities.java index cdfd672e..6fe41af3 100644 --- a/src/resources/common/MathUtilities.java +++ b/src/resources/common/MathUtilities.java @@ -24,27 +24,45 @@ package resources.common; import java.math.BigDecimal; import java.util.Random; +import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; + import engine.resources.scene.*; public class MathUtilities { public static Quaternion rotateQuaternion(Quaternion quaternion, float radians, Point3D axis) { - float sin = (float) Math.sin(radians / 2); - Quaternion rotateQ = new Quaternion((float) Math.cos(radians / 2), axis.x * sin, axis.y * sin, axis.z * sin); - return multiplyQuaternions(rotateQ, quaternion); - } public static Quaternion multiplyQuaternions(Quaternion q1, Quaternion q2) { - return new Quaternion(q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x); - + } + + /* + * @description Far more efficient method of calculating distance than sqrt. + * @param o Origin + * @param d Destination + * @returns Distance between Origin and Destination. + */ + public static float manhattenDistance(Point3D o, Point3D d) { + return Math.abs(d.x - o.x) + Math.abs(d.z - o.z); + } + + /* + * @description When you need to get objects in front of you to a certain width, such as a cone. + * @param o Origin + * @param a Origin's angle + * @param t Target + * @param fov Field Of View + * @returns True if Target is within specified field of view of origin (2D). + */ + public static boolean fov(Point3D o, Quaternion a, Point3D t, float fov) { + return (Math.abs(Math.acos(Vector3D.dotProduct((new Vector3D(a.x, a.y, a.z)).normalize(), (new Vector3D(t.x - o.x, t.z - o.z, t.y - o.y)).normalize()))) <= (((int) fov) / 2)); } /** @@ -79,6 +97,11 @@ public class MathUtilities { return newX; } + /* + * Rolls a dice based on the specified chance within 100. + * @param chance Chance + * @returns True if they got lucky. + */ public static boolean tryChance(int chance) { if (chance <= 0) { return false; diff --git a/src/resources/datatables/AttackType.java b/src/resources/datatables/AttackType.java new file mode 100644 index 00000000..25f21c94 --- /dev/null +++ b/src/resources/datatables/AttackType.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class AttackType { + + public static final byte CONE = 0; + public static final byte SINGLE_TARGET = 1; + public static final byte AREA = 2; + public static final byte TARGET_AREA = 3; + public static final byte DUAL_WIELD = 4; + public static final byte RAMPAGE = 5; + public static final byte RANDOM_HATE_TARGET = 6; + public static final byte RANDOM_HATE_TARGET_CONE = 7; + public static final byte RANDOM_HATE_TARGET_CONE_TERMINUS = 8; + public static final byte HATE_LIST = 9; + public static final byte RANDOM_HATE_MULTI = 10; + public static final byte AREA_PROGRESSIVE = 11; + public static final byte SPLIT_DAMAGE_TARGET_AREA = 12; + public static final byte DISTANCE_FARTHEST = 13; + +} diff --git a/src/resources/datatables/DelayAttackEggPosition.java b/src/resources/datatables/DelayAttackEggPosition.java new file mode 100644 index 00000000..1e1003e9 --- /dev/null +++ b/src/resources/datatables/DelayAttackEggPosition.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class DelayAttackEggPosition { + + public static final byte SELF = 1; + public static final byte TARGETED_OBJECT = 2; + public static final byte LOCATION = 3; + +} diff --git a/src/resources/datatables/InvalidWeapon.java b/src/resources/datatables/InvalidWeapon.java new file mode 100644 index 00000000..b6cf9eff --- /dev/null +++ b/src/resources/datatables/InvalidWeapon.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class InvalidWeapon { + + public static final byte NONE = 0; + public static final byte RIFLE = 1; + public static final byte CARBINE = 2; + public static final byte PISTOL = 3; + public static final byte HEAVY = 4; + public static final byte ONEHAND_MELEE = 5; + public static final byte TWOHAND_MELEE = 6; + public static final byte UNARMED = 7; + public static final byte POLEARM = 8; + public static final byte THROWN = 9; + public static final byte ONEHAND_LIGHTSABER = 10; + public static final byte TWOHAND_LIGHTSABER = 11; + public static final byte POLEARM_LIGHTSABER = 12; + public static final byte GROUND_TARGETTING = 13; + public static final byte DIRECTIONAL = 14; + public static final byte RANGED = 28; + public static final byte MELEE = 29; + public static final byte ALL = 30; + public static final byte ALL_LIGHTSABERS = 31; + +} diff --git a/src/resources/datatables/Target.java b/src/resources/datatables/Target.java new file mode 100644 index 00000000..13b63750 --- /dev/null +++ b/src/resources/datatables/Target.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class Target { + + public static final byte FRIEND = 0; + public static final byte ENEMY = 1; + public static final byte OTHER = 2; + +} \ No newline at end of file diff --git a/src/resources/datatables/TargetType.java b/src/resources/datatables/TargetType.java new file mode 100644 index 00000000..93f51571 --- /dev/null +++ b/src/resources/datatables/TargetType.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class TargetType { + + public static final byte NONE = 0; + public static final byte REQUIRED = 1; + public static final byte OPTIONAL = 2; + public static final byte LOCATION = 3; + public static final byte ALL = 4; + +} \ No newline at end of file diff --git a/src/resources/datatables/ValidWeapon.java b/src/resources/datatables/ValidWeapon.java new file mode 100644 index 00000000..3f44c682 --- /dev/null +++ b/src/resources/datatables/ValidWeapon.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * This File is part of NGECore2. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + * Using NGEngine to work with NGECore2 is making a combined work based on NGEngine. + * Therefore all terms and conditions of the GNU Lesser General Public License cover the combination. + ******************************************************************************/ +package resources.datatables; + +public class ValidWeapon { + + public static final byte NONE = 0; + public static final byte RIFLE = 1; + public static final byte CARBINE = 2; + public static final byte PISTOL = 3; + public static final byte HEAVY = 4; + public static final byte ONEHAND_MELEE = 5; + public static final byte TWOHAND_MELEE = 6; + public static final byte UNARMED = 7; + public static final byte POLEARM = 8; + public static final byte THROWN = 9; + public static final byte ONEHAND_LIGHTSABER = 10; + public static final byte TWOHAND_LIGHTSABER = 11; + public static final byte POLEARM_LIGHTSABER = 12; + public static final byte GROUND_TARGETTING = 13; + public static final byte DIRECTIONAL = 14; + public static final byte RANGED = 28; + public static final byte MELEE = 29; + public static final byte ALL = 30; + public static final byte ALL_LIGHTSABERS = 31; + +} \ No newline at end of file diff --git a/src/resources/datatables/WeaponType.java b/src/resources/datatables/WeaponType.java index 187332a4..e2f5df92 100644 --- a/src/resources/datatables/WeaponType.java +++ b/src/resources/datatables/WeaponType.java @@ -26,6 +26,7 @@ public class WeaponType { public static final int RIFLE = 0; public static final int CARBINE = 1; public static final int PISTOL = 2; + public static final int HEAVY = 3; public static final int ONEHANDEDMELEE = 4; public static final int TWOHANDEDMELEE = 5; public static final int UNARMED = 6; diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 0a5c86e0..bede3913 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; import org.apache.mina.core.buffer.IoBuffer; @@ -41,6 +42,7 @@ import protocol.swg.PlayClientEffectObjectMessage; import protocol.swg.StopClientEffectObjectByLabel; import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.objectControllerObjects.ShowFlyText; +import protocol.swg.objectControllerObjects.StartTask; import resources.common.OutOfBand; import resources.datatables.Options; import resources.datatables.PvpStatus; @@ -49,6 +51,7 @@ import resources.objects.ObjectMessageBuilder; import resources.objects.SWGList; import resources.objects.SWGSet; import resources.objects.creature.CreatureObject; +import services.command.BaseSWGCommand; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.IDManagerVisitor; import engine.clients.Client; @@ -73,7 +76,6 @@ public class TangibleObject extends SWGObject implements Serializable { private transient int pvpBitmask = 0; - //private TreeSet> lootSpecification = new TreeSet>(); private transient List lootGroups = new ArrayList(); private transient boolean looted = false; private transient boolean lootLock = false; @@ -81,6 +83,8 @@ public class TangibleObject extends SWGObject implements Serializable { private transient boolean lootItem = false; private transient TangibleObject killer = null; + private transient ConcurrentHashMap cooldowns = new ConcurrentHashMap(); + public TangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { super(objectID, planet, position, orientation, template); if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1); @@ -419,7 +423,7 @@ public class TangibleObject extends SWGObject implements Serializable { } } - public boolean isAttackableBy(CreatureObject attacker) { + public boolean isAttackableBy(TangibleObject attacker) { int pvpStatus = NGECore.getInstance().factionService.calculatePvpStatus(attacker, this); return (((pvpStatus & PvpStatus.Attackable) == PvpStatus.Attackable) || ((pvpStatus & PvpStatus.Aggressive) == PvpStatus.Aggressive)); } @@ -608,9 +612,52 @@ public class TangibleObject extends SWGObject implements Serializable { return false; } + public void addCooldown(String cooldownGroup, float cooldownTime) { + if (cooldowns.containsKey(cooldownGroup)) { + cooldowns.remove(cooldownGroup); + } + + long duration = System.currentTimeMillis() + ((long) (cooldownTime * 1000F)); + + cooldowns.put(cooldownGroup, duration); + } + + public boolean hasCooldown(String cooldownGroup) { + if (cooldowns.containsKey(cooldownGroup)) { + if (System.currentTimeMillis() < cooldowns.get(cooldownGroup)) { + return true; + } else { + cooldowns.remove(cooldownGroup); + } + } + + return false; + } + + public boolean removeCooldown(int actionCounter, BaseSWGCommand command) { + if (cooldowns.containsKey(command.getCooldownGroup())) { + cooldowns.remove(command.getCooldownGroup()); + getClient().getSession().write(new ObjControllerMessage(0x0B, new StartTask(actionCounter, getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), -1)).serialize()); + return true; + } + + return false; + } + + public long getRemainingCooldown(String cooldownGroup) { + if (cooldowns.containsKey(cooldownGroup)) { + if (System.currentTimeMillis() < cooldowns.get(cooldownGroup)) { + return (long) (cooldowns.get(cooldownGroup) - System.currentTimeMillis()); + } else { + cooldowns.remove(cooldownGroup); + } + } + + return 0L; + } + public void notifyClients(IoBuffer buffer, boolean notifySelf) { - // notifyObservers(buffer, false); // ??? Ignores the notifySelf argument. Was this done purposely? Faction Status etc. can't update the client without it - notifyObservers(buffer, notifySelf); + notifyObservers(buffer, false); } public ObjectMessageBuilder getMessageBuilder() { @@ -623,26 +670,9 @@ public class TangibleObject extends SWGObject implements Serializable { } } - @Override public void sendBaselines(Client destination) { if (destination != null && destination.getSession() != null) { - - // Factional peculiarities - Baseline baseLine3 = getBaseline(3); - if (destination.getParent() instanceof CreatureObject){ - if (((CreatureObject) destination.getParent()).isPlayer() && ((CreatureObject) destination.getParent()).getFaction()!=this.getFaction()){ - int optionsBitMask = getOptionsBitmask(); - if (getOption(Options.QUEST)) - optionsBitMask = optionsBitMask & ~Options.QUEST; - if (!getOption(Options.ATTACKABLE)) - optionsBitMask = optionsBitMask | Options.ATTACKABLE; - - baseLine3.set("optionsBitmask", optionsBitMask); - } - } - - //destination.getSession().write(getBaseline(3).getBaseline()); - destination.getSession().write(baseLine3.getBaseline()); + destination.getSession().write(getBaseline(3).getBaseline()); destination.getSession().write(getBaseline(6).getBaseline()); Client parent = ((getGrandparent() == null) ? null : getGrandparent().getClient()); @@ -655,18 +685,12 @@ public class TangibleObject extends SWGObject implements Serializable { if (destination.getParent() != this) { UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); upvpm.setFaction(CRC.StringtoCRC(getFaction())); -// if (this.getTemplate().contains("barricade")){ -// System.out.println("BARTANO RESULT " + NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this)); -// } - upvpm.setStatus(NGECore.getInstance().factionService.calculatePvpStatus((CreatureObject) destination.getParent(), this)); destination.getSession().write(upvpm.serialize()); } } } - - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { switch (viewType) { case 3: diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 1ff5c1d7..e701e8cd 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -71,8 +71,6 @@ public class BuffService implements INetworkDispatch { public BuffService(NGECore core) { this.core = core; - core.commandService.registerCommand("removeBuff"); - loadBuffs(); } diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index d6d5e365..68907056 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -506,35 +506,7 @@ public class EntertainmentService implements INetworkDispatch { } private void registerCommands() { - core.commandService.registerCommand("bandflourish"); - core.commandService.registerCommand("flourish"); core.commandService.registerAlias("flo","flourish"); - core.commandService.registerCommand("groupdance"); - core.commandService.registerCommand("startdance"); - core.commandService.registerCommand("stopdance"); - core.commandService.registerCommand("watch"); - core.commandService.registerCommand("stopwatching"); - core.commandService.registerCommand("holoEmote"); - core.commandService.registerCommand("covercharge"); - //core.commandService.registerCommand("en_holographic_recall"); - //core.commandService.registerCommand("en_holographic_image"); - core.commandService.registerCommand("imagedesign"); - // TODO: Add /bandsolo, /bandpause, /changeBandMusic, /changeDance, /changeGroupDance, /changeMusic - - // Entertainer Effects - core.commandService.registerCommand("centerStage"); - core.commandService.registerCommand("colorSwirl"); - core.commandService.registerCommand("colorlights"); - core.commandService.registerCommand("floorLights"); // referred to also as Dance Floor - core.commandService.registerCommand("dazzle"); - core.commandService.registerCommand("distract"); - core.commandService.registerCommand("featuredSolo"); - core.commandService.registerCommand("firejet"); - core.commandService.registerCommand("firejet2"); - core.commandService.registerCommand("laserShow"); - core.commandService.registerCommand("smokebomb"); - core.commandService.registerCommand("spotlight"); - core.commandService.registerCommand("ventriloquism"); } public void giveInspirationBuff(CreatureObject reciever, CreatureObject buffer, Vector buffVector) { diff --git a/src/services/GroupService.java b/src/services/GroupService.java index 4579cbf6..ec9d924c 100644 --- a/src/services/GroupService.java +++ b/src/services/GroupService.java @@ -42,12 +42,7 @@ public class GroupService implements INetworkDispatch { public GroupService(NGECore core) { this.core = core; - core.commandService.registerCommand("invite"); - core.commandService.registerCommand("join"); - core.commandService.registerCommand("disband"); core.commandService.registerAlias("leavegroup", "disband"); - core.commandService.registerCommand("decline"); - core.commandService.registerCommand("dismissgroupmember"); } @Override diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index 8f4aa0e7..e8dc0bc0 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -132,56 +132,7 @@ public class SimulationService implements INetworkDispatch { collidableQuadTrees.put(terrainService.getPlanetList().get(i).getName(), new QuadTree(-8192, -8192, 8192, 8192)); } - core.commandService.registerCommand("opencontainer"); - core.commandService.registerCommand("transferitem"); - core.commandService.registerCommand("transferitemarmor"); - core.commandService.registerCommand("transferitemweapon"); - core.commandService.registerCommand("transferitemmisc"); - core.commandService.registerCommand("equip"); - core.commandService.registerCommand("prone"); - core.commandService.registerCommand("stand"); - core.commandService.registerCommand("sitserver"); - core.commandService.registerCommand("kneel"); - core.commandService.registerCommand("serverdestroyobject"); - core.commandService.registerGmCommand("giveitem"); - core.commandService.registerGmCommand("object"); - core.commandService.registerCommand("getattributesbatch"); - core.commandService.registerCommand("pvp"); - core.commandService.registerCommand("setcurrentskilltitle"); - core.commandService.registerCommand("tip"); - core.commandService.registerCommand("faction"); - core.commandService.registerGmCommand("setspeed"); - core.commandService.registerCommand("waypoint"); - core.commandService.registerCommand("setwaypointactivestatus"); - core.commandService.registerCommand("setwaypointname"); - core.commandService.registerCommand("getfriendlist"); - core.commandService.registerCommand("deathblow"); - core.commandService.registerCommand("endduel"); - core.commandService.registerCommand("duel"); - core.commandService.registerCommand("purchaseticket"); - core.commandService.registerCommand("boardshuttle"); - core.commandService.registerCommand("getplayerid"); - core.commandService.registerCommand("inspire"); - core.commandService.registerGmCommand("setgodmode"); - core.commandService.registerCommand("requestwaypointatposition"); - core.commandService.registerCommand("meditate"); - core.commandService.registerGmCommand("server"); - core.commandService.registerCommand("toggleawayfromkeyboard"); - core.commandService.registerCommand("lfg"); - core.commandService.registerCommand("newbiehelper"); - core.commandService.registerCommand("roleplay"); core.commandService.registerAlias("afk", "toggleawayfromkeyboard"); - core.commandService.registerCommand("toggledisplayingfactionrank"); - core.commandService.registerCommand("editbiography"); - core.commandService.registerCommand("setbiography"); - core.commandService.registerCommand("requestbiography"); - core.commandService.registerCommand("eject"); - core.commandService.registerGmCommand("broadcast"); - core.commandService.registerGmCommand("teleporttarget"); - core.commandService.registerGmCommand("getplayerid"); - core.commandService.registerCommand("npcconversationselect"); - core.commandService.registerCommand("npcconversationstop"); - } public void insertSnapShotObjects() { diff --git a/src/services/StaticService.java b/src/services/StaticService.java index 62b0ad61..e49c3904 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -140,7 +140,8 @@ public class StaticService implements INetworkDispatch { } //long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z); - long objectId = 0; + long objectId = core.objectService.getReusableId(); + //long objectId = 0; SWGObject object = null; MobileTemplate mobileTemplate = core.spawnService.getMobileTemplate(template); diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index 5bf32584..6be0625f 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -61,8 +61,6 @@ public class SurveyService implements INetworkDispatch { public SurveyService(NGECore core) { this.core = core; scheduleSurveyService(); - core.commandService.registerCommand("requestsurvey"); - core.commandService.registerCommand("requestcoreSample"); } @SuppressWarnings("unused") diff --git a/src/services/ai/AIActor.java b/src/services/ai/AIActor.java index 7a6fbc6c..ef33f619 100644 --- a/src/services/ai/AIActor.java +++ b/src/services/ai/AIActor.java @@ -64,6 +64,7 @@ public class AIActor { private MobileTemplate mobileTemplate; private ScheduledExecutorService scheduler; private Map damageMap = new ConcurrentHashMap(); + private Map hateMap = new ConcurrentHashMap(); private volatile boolean hasReachedPosition; private long lastAttackTimestamp; private ScheduledFuture regenTask; @@ -297,16 +298,16 @@ public class AIActor { return; } creature.removeDefender(defender); - if (damageMap.containsKey(defender)) - damageMap.remove(defender); + if (damageMap.containsKey(defender)) damageMap.remove(defender); + if (hateMap.containsKey(defender)) hateMap.remove(defender); defender.removeDefender(creature); if(followObject == defender) { - setFollowObject(getHighestDamageDealer()); + setFollowObject(getMostHated()); if(creature.getDefendersList().size() == 0) setCurrentState(new RetreatState()); } } - + public CreatureObject getHighestDamageDealer() { CreatureObject highestDamageDealer = null; highestDamageDealer = damageMap.keySet().stream().max((c1, c2) -> damageMap.get(c1) - damageMap.get(c2)).orElse(null); @@ -319,7 +320,20 @@ public class AIActor { } return highestDamageDealer; } - + + public CreatureObject getMostHated() { + CreatureObject mostHated = null; + mostHated = hateMap.keySet().stream().max((c1, c2) -> hateMap.get(c1) - hateMap.get(c2)).orElse(null); + // return first defender if no damage has been dealt + if(mostHated == null) { + for(TangibleObject tangible : creature.getDefendersList().toArray(new TangibleObject[]{})) { + if(tangible instanceof CreatureObject) + return (CreatureObject) tangible; + } + } + return mostHated; + } + public AIState getCurrentState() { return currentState; } @@ -417,15 +431,19 @@ public class AIActor { // Put AI into combat state if it is not yet and damaged if (!creature.isInCombat()){ creature.setInCombat(true); - if (this.getHighestDamageDealer()!=null) - addDefender(this.getHighestDamageDealer()); + if (this.getMostHated()!=null) + addDefender(this.getMostHated()); } } public Map getDamageMap() { return damageMap; } - + + public Map getHateMap() { + return hateMap; + } + public boolean hasReachedPosition() { return hasReachedPosition; } @@ -513,9 +531,11 @@ public class AIActor { public void run() { try { damageMap.clear(); + hateMap.clear(); followObject = null; - NGECore.getInstance().objectService.destroyObject(creature); //destroyActor(); + creature.setAttachment("AI", null); + NGECore.getInstance().objectService.destroyObject(creature); } catch (Exception e) { System.err.println("Exception3 in scheduleDespawn"); e.printStackTrace(); diff --git a/src/services/ai/states/AttackState.java b/src/services/ai/states/AttackState.java index e5d64038..4ba22146 100644 --- a/src/services/ai/states/AttackState.java +++ b/src/services/ai/states/AttackState.java @@ -157,8 +157,8 @@ public class AttackState extends AIState { TangibleObject target = actor.getFollowObject(); - if(target != actor.getHighestDamageDealer() && actor.getHighestDamageDealer() != null) { - actor.setFollowObject(actor.getHighestDamageDealer()); + if(target != actor.getMostHated() && actor.getMostHated() != null) { + actor.setFollowObject(actor.getMostHated()); target = actor.getFollowObject(); } if(target == null) { @@ -197,7 +197,7 @@ public class AttackState extends AIState { CreatureObject targetCreature = (CreatureObject) target; if(targetCreature.getPosture() == 13 || targetCreature.getPosture() == 14 || targetCreature.isCloaked()) { - actor.setFollowObject(actor.getHighestDamageDealer()); + actor.setFollowObject(actor.getMostHated()); target = (CreatureObject) actor.getFollowObject(); if(target == null) { @@ -226,7 +226,7 @@ public class AttackState extends AIState { TangibleObject targetObject = (TangibleObject) target; if((targetObject.getConditionDamage()>=targetObject.getMaximumCondition())) { - actor.setFollowObject(actor.getHighestDamageDealer()); + actor.setFollowObject(actor.getMostHated()); target = (CreatureObject) actor.getFollowObject(); if(target == null) { diff --git a/src/services/bazaar/BazaarService.java b/src/services/bazaar/BazaarService.java index e998ba7f..0613155e 100644 --- a/src/services/bazaar/BazaarService.java +++ b/src/services/bazaar/BazaarService.java @@ -93,7 +93,6 @@ public class BazaarService implements INetworkDispatch { public BazaarService(NGECore core) { this.core = core; - core.commandService.registerCommand("createvendor"); loadAuctionItems(); } diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index f45ef334..a66c82d5 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -86,15 +86,6 @@ public class ChatService implements INetworkDispatch { public ChatService(NGECore core) { this.core = core; - core.commandService.registerCommand("spatialchatinternal"); - core.commandService.registerCommand("socialinternal"); - - core.commandService.registerCommand("addignore"); - core.commandService.registerCommand("removeignore"); - core.commandService.registerCommand("findfriend"); - core.commandService.registerCommand("addfriend"); - core.commandService.registerCommand("removefriend"); - core.commandService.registerAlias("g", "groupchat"); core.commandService.registerAlias("gc", "groupchat"); core.commandService.registerAlias("groupsay", "groupchat"); @@ -105,7 +96,6 @@ public class ChatService implements INetworkDispatch { mailODB = core.getMailODB(); chatRoomsODB = core.getChatRoomODB(); - } /* diff --git a/src/services/combat/CombatCommands.java b/src/services/combat/CombatCommands.java index dcdc875d..58a57475 100644 --- a/src/services/combat/CombatCommands.java +++ b/src/services/combat/CombatCommands.java @@ -26,699 +26,7 @@ import main.NGECore; public class CombatCommands { public static void registerCommands(NGECore core) { - - // Auto Attacks - - core.commandService.registerCombatCommand("creatureRangedAttack"); core.commandService.registerCombatCommand("creatureMeleeAttack").setDefaultAnimations(new String[] { "creature_attack_light" }); - core.commandService.registerCombatCommand("rangedshotrifle"); - core.commandService.registerCombatCommand("rangedshotpistol"); - core.commandService.registerCombatCommand("rangedshotlightrifle"); - core.commandService.registerCombatCommand("rangedshot"); - core.commandService.registerCombatCommand("meleehit"); - core.commandService.registerCombatCommand("saberhit"); - core.commandService.registerCombatCommand("fireAcidBeam"); - core.commandService.registerCombatCommand("fireAcidBeamAvatar"); - core.commandService.registerCombatCommand("fireAcidBeamHeavy"); - core.commandService.registerCombatCommand("fireAcidRifle"); - core.commandService.registerCombatCommand("fireCr1BlastCannon"); - core.commandService.registerCombatCommand("fireCrusaderHeavyRifle"); - core.commandService.registerCombatCommand("fireElitePistolLauncher"); - core.commandService.registerCombatCommand("fireFlameThrowerLight"); - core.commandService.registerCombatCommand("fireHeavyShotgun"); - core.commandService.registerCombatCommand("fireHeavyWeapon"); - core.commandService.registerCombatCommand("fireIceGun"); - core.commandService.registerCombatCommand("fireLavaCannon"); - //core.commandService.registerCombatCommand("fireLavaCannonGeneric"); - core.commandService.registerCombatCommand("fireLightningBeam"); - core.commandService.registerCombatCommand("fireParticleBeam"); - core.commandService.registerCombatCommand("firePistolLauncher"); - //core.commandService.registerCombatCommand("firePistolLauncherGeneric"); - core.commandService.registerCombatCommand("firePistolLauncherMedium"); - core.commandService.registerCombatCommand("firePistolLauncherTargeting"); - core.commandService.registerCombatCommand("firePlasmaFlameThrower"); - core.commandService.registerCombatCommand("firePulseCannon"); - core.commandService.registerCombatCommand("firePvpHeavy"); - core.commandService.registerCombatCommand("fireRepublicFlameThrower"); - //core.commandService.registerCombatCommand("fireRepublicFlameThrowerGeneric"); - core.commandService.registerCombatCommand("fireRocketLauncher"); - //core.commandService.registerCombatCommand("fireRocketLauncherGeneric"); - core.commandService.registerCombatCommand("fireStunCannon"); - core.commandService.registerCombatCommand("fireVoidRocketLauncher"); - - // Bounty Hunter - - core.commandService.registerCombatCommand("bh_ae_dm_1"); - core.commandService.registerCombatCommand("bh_ae_dm_2"); - core.commandService.registerCombatCommand("bh_armor_sprint_1"); - core.commandService.registerCombatCommand("bh_cover_1"); - core.commandService.registerCombatCommand("bh_dm_1"); - core.commandService.registerCombatCommand("bh_dm_2"); - core.commandService.registerCombatCommand("bh_dm_3"); - core.commandService.registerCombatCommand("bh_dm_4"); - core.commandService.registerCombatCommand("bh_dm_5"); - core.commandService.registerCombatCommand("bh_dm_6"); - core.commandService.registerCombatCommand("bh_dm_7"); - core.commandService.registerCombatCommand("bh_dm_8"); - core.commandService.registerCombatCommand("bh_dm_cc_1"); - core.commandService.registerCombatCommand("bh_dm_cc_2"); - core.commandService.registerCombatCommand("bh_dm_cc_3"); - core.commandService.registerCombatCommand("bh_dm_crit_1"); - core.commandService.registerCombatCommand("bh_dm_crit_2"); - core.commandService.registerCombatCommand("bh_dm_crit_3"); - core.commandService.registerCombatCommand("bh_dm_crit_4"); - core.commandService.registerCombatCommand("bh_dm_crit_5"); - core.commandService.registerCombatCommand("bh_dm_crit_6"); - core.commandService.registerCombatCommand("bh_dm_crit_7"); - core.commandService.registerCombatCommand("bh_dm_crit_8"); - core.commandService.registerCombatCommand("bh_dread_strike_1"); - core.commandService.registerCombatCommand("bh_dread_strike_2"); - core.commandService.registerCombatCommand("bh_dread_strike_3"); - core.commandService.registerCombatCommand("bh_dread_strike_4"); - core.commandService.registerCombatCommand("bh_dread_strike_5"); - core.commandService.registerCombatCommand("bh_flawless_strike"); - core.commandService.registerCombatCommand("bh_fumble_1"); - core.commandService.registerCombatCommand("bh_fumble_2"); - core.commandService.registerCombatCommand("bh_fumble_3"); - core.commandService.registerCombatCommand("bh_fumble_4"); - core.commandService.registerCombatCommand("bh_fumble_5"); - core.commandService.registerCombatCommand("bh_fumble_6"); - core.commandService.registerCombatCommand("bh_intimidate_1"); - core.commandService.registerCombatCommand("bh_intimidate_2"); - core.commandService.registerCombatCommand("bh_intimidate_3"); - core.commandService.registerCombatCommand("bh_intimidate_4"); - core.commandService.registerCombatCommand("bh_intimidate_5"); - core.commandService.registerCombatCommand("bh_intimidate_6"); - core.commandService.registerCombatCommand("bh_sniper_1"); - core.commandService.registerCombatCommand("bh_sniper_2"); - core.commandService.registerCombatCommand("bh_sniper_3"); - core.commandService.registerCombatCommand("bh_sniper_4"); - core.commandService.registerCombatCommand("bh_sniper_5"); - core.commandService.registerCombatCommand("bh_sniper_6"); - core.commandService.registerCombatCommand("bh_stun_1"); - core.commandService.registerCombatCommand("bh_stun_2"); - core.commandService.registerCombatCommand("bh_stun_3"); - core.commandService.registerCombatCommand("bh_stun_4"); - core.commandService.registerCombatCommand("bh_stun_5"); - core.commandService.registerCombatCommand("bh_stun_6"); - core.commandService.registerCombatCommand("bh_taunt_1"); - core.commandService.registerCombatCommand("bh_taunt_2"); - core.commandService.registerCombatCommand("bh_taunt_3"); - core.commandService.registerCombatCommand("bh_taunt_4"); - core.commandService.registerCombatCommand("bh_taunt_5"); - core.commandService.registerCombatCommand("bh_taunt_6"); - core.commandService.registerCombatCommand("bh_return_fire_command_1"); - core.commandService.registerCombatCommand("bh_sh_0"); - core.commandService.registerCombatCommand("bh_sh_1"); - core.commandService.registerCombatCommand("bh_sh_2"); - core.commandService.registerCombatCommand("bh_sh_3"); - core.commandService.registerCommand("bh_shields_1"); - - // Jedi - - core.commandService.registerCombatCommand("fs_sweep_1"); - core.commandService.registerCombatCommand("fs_sweep_2"); - core.commandService.registerCombatCommand("fs_sweep_3"); - core.commandService.registerCombatCommand("fs_sweep_4"); - core.commandService.registerCombatCommand("fs_sweep_5"); - core.commandService.registerCombatCommand("fs_sweep_6"); - core.commandService.registerCombatCommand("fs_sweep_7"); - core.commandService.registerCombatCommand("fs_dm_1"); - core.commandService.registerCombatCommand("fs_dm_2"); - core.commandService.registerCombatCommand("fs_dm_3"); - core.commandService.registerCombatCommand("fs_dm_4"); - core.commandService.registerCombatCommand("fs_dm_5"); - core.commandService.registerCombatCommand("fs_dm_6"); - core.commandService.registerCombatCommand("fs_dm_7"); - core.commandService.registerCombatCommand("fs_dm_cc_1"); - core.commandService.registerCombatCommand("fs_dm_cc_2"); - core.commandService.registerCombatCommand("fs_dm_cc_3"); - core.commandService.registerCombatCommand("fs_dm_cc_4"); - core.commandService.registerCombatCommand("fs_dm_cc_5"); - core.commandService.registerCombatCommand("fs_dm_cc_6"); - core.commandService.registerCombatCommand("fs_ae_dm_cc_1"); - core.commandService.registerCombatCommand("fs_ae_dm_cc_2"); - core.commandService.registerCombatCommand("fs_ae_dm_cc_3"); - core.commandService.registerCombatCommand("fs_ae_dm_cc_4"); - core.commandService.registerCombatCommand("fs_ae_dm_cc_5"); - core.commandService.registerCombatCommand("fs_ae_dm_cc_6"); - core.commandService.registerCombatCommand("forceThrow"); - core.commandService.registerCombatCommand("fs_dm_cc_crit_1"); - core.commandService.registerCombatCommand("fs_dm_cc_crit_2"); - core.commandService.registerCombatCommand("fs_dm_cc_crit_3"); - core.commandService.registerCombatCommand("fs_dm_cc_crit_4"); - core.commandService.registerCombatCommand("fs_dm_cc_crit_5"); - core.commandService.registerCombatCommand("fs_drain_1"); - core.commandService.registerCombatCommand("fs_drain_2"); - core.commandService.registerCombatCommand("fs_drain_3"); - core.commandService.registerCombatCommand("fs_drain_4"); - core.commandService.registerCombatCommand("fs_drain_5"); - core.commandService.registerCombatCommand("fs_flurry_1"); - core.commandService.registerCombatCommand("fs_flurry_2"); - core.commandService.registerCombatCommand("fs_flurry_3"); - core.commandService.registerCombatCommand("fs_flurry_4"); - core.commandService.registerCombatCommand("fs_flurry_5"); - core.commandService.registerCombatCommand("fs_flurry_6"); - core.commandService.registerCombatCommand("fs_flurry_7"); - core.commandService.registerCombatCommand("fs_maelstrom_1"); - core.commandService.registerCombatCommand("fs_maelstrom_2"); - core.commandService.registerCombatCommand("fs_maelstrom_3"); - core.commandService.registerCombatCommand("fs_maelstrom_4"); - core.commandService.registerCombatCommand("fs_maelstrom_5"); - core.commandService.registerCombatCommand("fs_sh_0"); - core.commandService.registerCombatCommand("fs_sh_1"); - core.commandService.registerCombatCommand("fs_sh_2"); - core.commandService.registerCombatCommand("fs_sh_3"); - core.commandService.registerCommand("fs_buff_def_1_1"); // Stance - core.commandService.registerCommand("fs_buff_ca_1"); // Focus - core.commandService.registerCommand("fs_saber_reflect_buff"); // Saber Reflect - core.commandService.registerCommand("saberBlock"); // Saber Block - core.commandService.registerCommand("forcerun"); // Force Run - core.commandService.registerCommand("fs_buff_invis_1"); // Force Cloak - core.commandService.registerCombatCommand("fs_force_throw_1"); - core.commandService.registerCommand("forceThrow"); - - // Commando - - core.commandService.registerCombatCommand("co_ae_dm_1"); - core.commandService.registerCombatCommand("co_ae_dm_2"); - core.commandService.registerCombatCommand("co_ae_dm_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_acid_1"); - core.commandService.registerCombatCommand("co_ae_hw_dot_acid_2"); - core.commandService.registerCombatCommand("co_ae_hw_dot_acid_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_acid_4"); - core.commandService.registerCombatCommand("co_ae_hw_dot_acid_5"); - core.commandService.registerCombatCommand("co_ae_hw_dot_cold_1"); - core.commandService.registerCombatCommand("co_ae_hw_dot_cold_2"); - core.commandService.registerCombatCommand("co_ae_hw_dot_cold_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_cold_4"); - core.commandService.registerCombatCommand("co_ae_hw_dot_cold_5"); - core.commandService.registerCombatCommand("co_ae_hw_dot_electrical_1"); - core.commandService.registerCombatCommand("co_ae_hw_dot_electrical_2"); - core.commandService.registerCombatCommand("co_ae_hw_dot_electrical_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_electrical_4"); - core.commandService.registerCombatCommand("co_ae_hw_dot_electrical_5"); - core.commandService.registerCombatCommand("co_ae_hw_dot_energy_1"); - core.commandService.registerCombatCommand("co_ae_hw_dot_energy_2"); - core.commandService.registerCombatCommand("co_ae_hw_dot_energy_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_energy_4"); - core.commandService.registerCombatCommand("co_ae_hw_dot_energy_5"); - core.commandService.registerCombatCommand("co_ae_hw_dot_fire_1"); - core.commandService.registerCombatCommand("co_ae_hw_dot_fire_2"); - core.commandService.registerCombatCommand("co_ae_hw_dot_fire_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_fire_4"); - core.commandService.registerCombatCommand("co_ae_hw_dot_fire_5"); - core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_1"); - core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_2"); - core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_3"); - core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_4"); - core.commandService.registerCombatCommand("co_ae_hw_dot_kinetic_5"); - core.commandService.registerCombatCommand("co_armor_cracker"); - //core.commandService.registerCombatCommand("co_cluster_bomb"); - //core.commandService.registerCombatCommand("co_cluster_bomblet"); - core.commandService.registerCombatCommand("co_del_ae_cc_1_1"); - core.commandService.registerCombatCommand("co_del_ae_cc_1_2"); - core.commandService.registerCombatCommand("co_del_ae_cc_1_3"); - core.commandService.registerCombatCommand("co_del_ae_cc_2_1"); - core.commandService.registerCombatCommand("co_del_ae_cc_2_2"); - core.commandService.registerCombatCommand("co_del_ae_dm_1"); - core.commandService.registerCombatCommand("co_del_ae_dm_2"); - core.commandService.registerCombatCommand("co_del_ae_dm_3"); - core.commandService.registerCombatCommand("co_dm_1"); - core.commandService.registerCombatCommand("co_dm_2"); - core.commandService.registerCombatCommand("co_dm_3"); - core.commandService.registerCombatCommand("co_dm_4"); - core.commandService.registerCombatCommand("co_dm_5"); - core.commandService.registerCombatCommand("co_dm_6"); - core.commandService.registerCombatCommand("co_dm_7"); - core.commandService.registerCombatCommand("co_dm_8"); - core.commandService.registerCombatCommand("co_fld_dm_1"); - core.commandService.registerCombatCommand("co_fld_dm_2"); - core.commandService.registerCombatCommand("co_hw_dm_1"); - core.commandService.registerCombatCommand("co_hw_dm_2"); - core.commandService.registerCombatCommand("co_hw_dm_3"); - core.commandService.registerCombatCommand("co_hw_dm_4"); - core.commandService.registerCombatCommand("co_hw_dm_5"); - core.commandService.registerCombatCommand("co_hw_dm_6"); - core.commandService.registerCombatCommand("co_hw_dm_crit_1"); - core.commandService.registerCombatCommand("co_hw_dm_crit_2"); - core.commandService.registerCombatCommand("co_hw_dm_crit_3"); - core.commandService.registerCombatCommand("co_hw_dm_crit_4"); - core.commandService.registerCombatCommand("co_hw_dm_crit_5"); - core.commandService.registerCombatCommand("co_hw_dm_crit_6"); - core.commandService.registerCombatCommand("co_hw_dot_acid_1"); - core.commandService.registerCombatCommand("co_hw_dot_acid_2"); - core.commandService.registerCombatCommand("co_hw_dot_acid_3"); - core.commandService.registerCombatCommand("co_hw_dot_acid_4"); - core.commandService.registerCombatCommand("co_hw_dot_acid_5"); - core.commandService.registerCombatCommand("co_hw_dot_cold_1"); - core.commandService.registerCombatCommand("co_hw_dot_cold_2"); - core.commandService.registerCombatCommand("co_hw_dot_cold_3"); - core.commandService.registerCombatCommand("co_hw_dot_cold_4"); - core.commandService.registerCombatCommand("co_hw_dot_cold_5"); - core.commandService.registerCombatCommand("co_hw_dot_electrical_1"); - core.commandService.registerCombatCommand("co_hw_dot_electrical_2"); - core.commandService.registerCombatCommand("co_hw_dot_electrical_3"); - core.commandService.registerCombatCommand("co_hw_dot_electrical_4"); - core.commandService.registerCombatCommand("co_hw_dot_electrical_5"); - core.commandService.registerCombatCommand("co_hw_dot_energy_1"); - core.commandService.registerCombatCommand("co_hw_dot_energy_2"); - core.commandService.registerCombatCommand("co_hw_dot_energy_3"); - core.commandService.registerCombatCommand("co_hw_dot_energy_4"); - core.commandService.registerCombatCommand("co_hw_dot_energy_5"); - core.commandService.registerCombatCommand("co_hw_dot_fire_1"); - core.commandService.registerCombatCommand("co_hw_dot_fire_2"); - core.commandService.registerCombatCommand("co_hw_dot_fire_3"); - core.commandService.registerCombatCommand("co_hw_dot_fire_4"); - core.commandService.registerCombatCommand("co_hw_dot_fire_5"); - core.commandService.registerCombatCommand("co_hw_dot_kinetic_1"); - core.commandService.registerCombatCommand("co_hw_dot_kinetic_2"); - core.commandService.registerCombatCommand("co_hw_dot_kinetic_3"); - core.commandService.registerCombatCommand("co_hw_dot_kinetic_4"); - core.commandService.registerCombatCommand("co_hw_dot_kinetic_5"); - core.commandService.registerCombatCommand("co_remote_detonator_1"); - core.commandService.registerCombatCommand("co_remote_detonator_2"); - core.commandService.registerCombatCommand("co_remote_detonator_3"); - core.commandService.registerCombatCommand("co_remote_detonator_4"); - core.commandService.registerCombatCommand("co_remote_detonator_5"); - core.commandService.registerCombatCommand("co_remote_detonator_5"); - core.commandService.registerCombatCommand("co_riddle_armor"); - core.commandService.registerCombatCommand("co_suppressing_fire"); - core.commandService.registerCombatCommand("co_sh_0"); - core.commandService.registerCombatCommand("co_sh_1"); - core.commandService.registerCombatCommand("co_sh_2"); - core.commandService.registerCombatCommand("co_sh_3"); - core.commandService.registerCombatCommand("co_stand_fast"); - core.commandService.registerCommand("co_hw_dot"); - core.commandService.registerCommand("co_ae_hw_dot"); - core.commandService.registerCommand("co_position_secured"); - core.commandService.registerCommand("co_first_aid_training"); - - // Entertainer - - core.commandService.registerCombatCommand("en_dm_1"); - core.commandService.registerCombatCommand("en_dm_2"); - core.commandService.registerCombatCommand("en_dm_3"); - core.commandService.registerCombatCommand("en_dm_4"); - core.commandService.registerCombatCommand("en_dm_5"); - core.commandService.registerCombatCommand("en_dm_6"); - core.commandService.registerCombatCommand("en_dm_7"); - core.commandService.registerCombatCommand("en_dm_8"); - core.commandService.registerCombatCommand("en_project_will_0"); - core.commandService.registerCombatCommand("en_project_will_1"); - core.commandService.registerCombatCommand("en_project_will_2"); - core.commandService.registerCombatCommand("en_project_will_3"); - core.commandService.registerCombatCommand("en_project_will_4"); - core.commandService.registerCombatCommand("en_project_will_5"); - core.commandService.registerCombatCommand("en_project_will_6"); - core.commandService.registerCombatCommand("en_spiral_kick_0"); - core.commandService.registerCombatCommand("en_spiral_kick_1"); - core.commandService.registerCombatCommand("en_spiral_kick_2"); - core.commandService.registerCombatCommand("en_spiral_kick_3"); - core.commandService.registerCombatCommand("en_spiral_kick_4"); - core.commandService.registerCombatCommand("en_strike_0"); - core.commandService.registerCombatCommand("en_strike_1"); - core.commandService.registerCombatCommand("en_strike_2"); - core.commandService.registerCombatCommand("en_strike_3"); - core.commandService.registerCombatCommand("en_strike_4"); - core.commandService.registerCombatCommand("en_strike_5"); - core.commandService.registerCombatCommand("en_strike_6"); - core.commandService.registerCombatCommand("en_sweeping_pirouette_0"); - core.commandService.registerCombatCommand("en_sweeping_pirouette_1"); - core.commandService.registerCombatCommand("en_sweeping_pirouette_2"); - core.commandService.registerCombatCommand("en_sweeping_pirouette_3"); - core.commandService.registerCombatCommand("en_sweeping_pirouette_4"); - core.commandService.registerCombatCommand("en_sweeping_pirouette_5"); - core.commandService.registerCombatCommand("en_unhealthy_fixation"); - core.commandService.registerCombatCommand("en_void_dance"); - core.commandService.registerCombatCommand("en_void_dance_1"); - core.commandService.registerCombatCommand("en_void_dance_2"); - core.commandService.registerCombatCommand("en_void_dance_3"); - core.commandService.registerCombatCommand("en_sh_1"); - core.commandService.registerCombatCommand("en_sh_2"); - core.commandService.registerCombatCommand("en_sh_3"); - core.commandService.registerCombatCommand("en_heal_1"); - core.commandService.registerCombatCommand("en_heal_2"); - core.commandService.registerCombatCommand("en_heal_3"); - core.commandService.registerCombatCommand("en_heal_4"); - - - // Medic - - core.commandService.registerCombatCommand("me_ae_heal_1"); - core.commandService.registerCombatCommand("me_ae_heal_2"); - core.commandService.registerCombatCommand("me_ae_heal_3"); - core.commandService.registerCombatCommand("me_ae_heal_4"); - core.commandService.registerCombatCommand("me_ae_heal_5"); - core.commandService.registerCombatCommand("me_ae_heal_6"); - core.commandService.registerCombatCommand("me_bacta_ampule_1"); - core.commandService.registerCombatCommand("me_bacta_ampule_2"); - core.commandService.registerCombatCommand("me_bacta_ampule_3"); - core.commandService.registerCombatCommand("me_bacta_ampule_4"); - core.commandService.registerCombatCommand("me_bacta_ampule_5"); - core.commandService.registerCombatCommand("me_bacta_ampule_6"); - core.commandService.registerCombatCommand("me_bacta_bomb_1"); - core.commandService.registerCombatCommand("me_bacta_bomb_2"); - core.commandService.registerCombatCommand("me_bacta_bomb_3"); - core.commandService.registerCombatCommand("me_bacta_bomb_4"); - core.commandService.registerCombatCommand("me_bacta_bomb_5"); - core.commandService.registerCombatCommand("me_bacta_grenade_1"); - core.commandService.registerCombatCommand("me_bacta_grenade_2"); - core.commandService.registerCombatCommand("me_bacta_grenade_3"); - core.commandService.registerCombatCommand("me_bacta_grenade_4"); - core.commandService.registerCombatCommand("me_bacta_grenade_5"); - core.commandService.registerCombatCommand("me_bacta_resistance_1"); - core.commandService.registerCombatCommand("me_burst_1"); - core.commandService.registerCombatCommand("me_burst_2"); - core.commandService.registerCombatCommand("me_burst_3"); - core.commandService.registerCombatCommand("me_burst_4"); - core.commandService.registerCombatCommand("me_burst_5"); - core.commandService.registerCombatCommand("me_cranial_smash_1"); - core.commandService.registerCombatCommand("me_cranial_smash_2"); - core.commandService.registerCombatCommand("me_cranial_smash_3"); - core.commandService.registerCombatCommand("me_cranial_smash_4"); - core.commandService.registerCombatCommand("me_cranial_smash_5"); - core.commandService.registerCommand("me_cure_affliction_1"); - core.commandService.registerCombatCommand("me_dm_1"); - core.commandService.registerCombatCommand("me_dm_2"); - core.commandService.registerCombatCommand("me_dm_3"); - core.commandService.registerCombatCommand("me_dm_4"); - core.commandService.registerCombatCommand("me_dm_5"); - core.commandService.registerCombatCommand("me_dm_6"); - core.commandService.registerCombatCommand("me_dm_8"); - core.commandService.registerCombatCommand("me_dm_dot_1"); - core.commandService.registerCombatCommand("me_dm_dot_2"); - core.commandService.registerCombatCommand("me_dm_dot_3"); - core.commandService.registerCombatCommand("me_dm_dot_4"); - core.commandService.registerCombatCommand("me_dm_dot_5"); - core.commandService.registerCombatCommand("me_dm_dot_6"); - core.commandService.registerCombatCommand("me_electrolyte_drain_1"); - core.commandService.registerCombatCommand("me_fld_dm_dot_1"); - core.commandService.registerCombatCommand("me_fld_dm_dot_2"); - core.commandService.registerCombatCommand("me_fld_dm_dot_3"); - core.commandService.registerCombatCommand("me_induce_insanity_1"); - core.commandService.registerCombatCommand("me_rv_area"); - core.commandService.registerCombatCommand("me_rv_combat"); - core.commandService.registerCombatCommand("me_rv_ooc"); - core.commandService.registerCombatCommand("me_rv_pvp_area"); - core.commandService.registerCombatCommand("me_rv_pvp_single"); - core.commandService.registerCommand("me_serotonin_boost_1"); - core.commandService.registerCombatCommand("me_serotonin_purge_1"); - core.commandService.registerCombatCommand("me_sh_1"); - core.commandService.registerCommand("me_stasis_1"); - core.commandService.registerCommand("me_stasis_self_1"); - core.commandService.registerCombatCommand("me_thyroid_rupture_1"); - core.commandService.registerCombatCommand("me_traumatize_1"); - core.commandService.registerCombatCommand("me_traumatize_2"); - core.commandService.registerCombatCommand("me_traumatize_3"); - core.commandService.registerCombatCommand("me_traumatize_4"); - core.commandService.registerCombatCommand("me_traumatize_5"); - core.commandService.registerCombatCommand("me_stasis_1"); - core.commandService.registerCommand("me_drag_1"); - core.commandService.registerCommand("me_enhance_action_1"); - core.commandService.registerCommand("me_reckless_stimulation_1"); - core.commandService.registerCommand("me_reckless_stimulation_2"); - core.commandService.registerCommand("me_reckless_stimulation_3"); - core.commandService.registerCommand("me_reckless_stimulation_4"); - core.commandService.registerCommand("me_reckless_stimulation_5"); - core.commandService.registerCommand("me_reckless_stimulation_6"); - core.commandService.registerCommand("me_buff_health_1"); - core.commandService.registerCommand("me_buff_health_2"); - core.commandService.registerCommand("me_buff_health_3"); - core.commandService.registerCommand("me_enhance_action_1"); - core.commandService.registerCommand("me_enhance_action_2"); - core.commandService.registerCommand("me_enhance_action_3"); - core.commandService.registerCommand("me_enhance_agility_1"); - core.commandService.registerCommand("me_enhance_agility_2"); - core.commandService.registerCommand("me_enhance_agility_3"); - core.commandService.registerCommand("me_enhance_block_1"); - core.commandService.registerCommand("me_enhance_dodge_1"); - core.commandService.registerCommand("me_enhance_precision_1"); - core.commandService.registerCommand("me_enhance_precision_2"); - core.commandService.registerCommand("me_enhance_precision_3"); - core.commandService.registerCommand("me_enhance_strength_1"); - core.commandService.registerCommand("me_enhance_strength_2"); - core.commandService.registerCommand("me_enhance_strength_3"); - core.commandService.registerCommand("me_evasion_1"); - - // Officer - - core.commandService.registerCombatCommand("of_ae_dm_boss"); - core.commandService.registerCombatCommand("of_ae_dm_cc_1"); - core.commandService.registerCombatCommand("of_ae_dm_cc_2"); - core.commandService.registerCombatCommand("of_ae_dm_cc_3"); - core.commandService.registerCombatCommand("of_alt_ae_dm_1"); - core.commandService.registerCombatCommand("of_alt_ae_dm_2"); - core.commandService.registerCombatCommand("of_alt_ae_dm_3"); - core.commandService.registerCombatCommand("of_deb_def_1"); - core.commandService.registerCombatCommand("of_deb_def_2"); - core.commandService.registerCombatCommand("of_deb_def_3"); - core.commandService.registerCombatCommand("of_deb_def_4"); - core.commandService.registerCombatCommand("of_deb_def_5"); - core.commandService.registerCombatCommand("of_deb_def_6"); - core.commandService.registerCombatCommand("of_deb_def_7"); - core.commandService.registerCombatCommand("of_deb_def_8"); - core.commandService.registerCombatCommand("of_decapitate_1"); - core.commandService.registerCombatCommand("of_decapitate_2"); - core.commandService.registerCombatCommand("of_decapitate_3"); - core.commandService.registerCombatCommand("of_decapitate_4"); - core.commandService.registerCombatCommand("of_decapitate_5"); - core.commandService.registerCombatCommand("of_decapitate_6"); - core.commandService.registerCombatCommand("of_del_ae_dm_1"); - core.commandService.registerCombatCommand("of_del_ae_dm_2"); - core.commandService.registerCombatCommand("of_del_ae_dm_3"); - core.commandService.registerCombatCommand("of_del_ae_dm_boss"); - core.commandService.registerCombatCommand("of_del_ae_dm_dot_1"); - core.commandService.registerCombatCommand("of_del_ae_dm_dot_2"); - core.commandService.registerCombatCommand("of_del_ae_dm_dot_3"); - core.commandService.registerCombatCommand("of_del_ae_dot_1"); - core.commandService.registerCombatCommand("of_dm_1"); - core.commandService.registerCombatCommand("of_dm_2"); - core.commandService.registerCombatCommand("of_dm_3"); - core.commandService.registerCombatCommand("of_dm_4"); - core.commandService.registerCombatCommand("of_dm_5"); - core.commandService.registerCombatCommand("of_dm_6"); - core.commandService.registerCombatCommand("of_dm_7"); - core.commandService.registerCombatCommand("of_dm_8"); - core.commandService.registerCombatCommand("of_dm_boss"); - core.commandService.registerCombatCommand("of_leg_strike_1"); - core.commandService.registerCombatCommand("of_leg_strike_2"); - core.commandService.registerCombatCommand("of_leg_strike_3"); - core.commandService.registerCombatCommand("of_leg_strike_4"); - core.commandService.registerCombatCommand("of_leg_strike_5"); - core.commandService.registerCombatCommand("of_leg_strike_6"); - core.commandService.registerCombatCommand("of_leg_strike_7"); - core.commandService.registerCombatCommand("of_pistol_bleed"); - core.commandService.registerCombatCommand("of_pistol_dm"); - core.commandService.registerCombatCommand("of_sh_0"); - core.commandService.registerCombatCommand("of_sh_1"); - core.commandService.registerCombatCommand("of_sh_2"); - core.commandService.registerCombatCommand("of_sh_3"); - core.commandService.registerCombatCommand("of_vortex_1"); - core.commandService.registerCombatCommand("of_vortex_2"); - core.commandService.registerCombatCommand("of_vortex_3"); - core.commandService.registerCombatCommand("of_vortex_4"); - core.commandService.registerCombatCommand("of_vortex_5"); - core.commandService.registerCommand("of_charge_1"); - core.commandService.registerCommand("of_inspiration_1"); - core.commandService.registerCommand("of_inspiration_2"); - core.commandService.registerCommand("of_inspiration_3"); - core.commandService.registerCommand("of_inspiration_4"); - core.commandService.registerCommand("of_inspiration_5"); - core.commandService.registerCommand("of_inspiration_6"); - core.commandService.registerCommand("of_focus_fire_1"); - core.commandService.registerCommand("of_focus_fire_2"); - core.commandService.registerCommand("of_focus_fire_3"); - core.commandService.registerCommand("of_focus_fire_4"); - core.commandService.registerCommand("of_focus_fire_5"); - core.commandService.registerCommand("of_focus_fire_6"); - core.commandService.registerCommand("of_drillmaster_1"); - core.commandService.registerCommand("of_buff_def_1"); - core.commandService.registerCommand("of_buff_def_2"); - core.commandService.registerCommand("of_buff_def_3"); - core.commandService.registerCommand("of_buff_def_4"); - core.commandService.registerCommand("of_buff_def_5"); - core.commandService.registerCommand("of_buff_def_6"); - core.commandService.registerCommand("of_buff_def_7"); - core.commandService.registerCommand("of_buff_def_8"); - core.commandService.registerCommand("of_buff_def_9"); - core.commandService.registerCommand("of_emergency_shield"); - core.commandService.registerCommand("of_firepower_1"); - core.commandService.registerCommand("of_medical_sup_1"); - core.commandService.registerCommand("of_purge_1"); - core.commandService.registerCommand("of_scatter_1"); - core.commandService.registerCommand("of_stimulator_1"); - - // Smuggler - - core.commandService.registerCombatCommand("sm_ae_cover_fire"); - core.commandService.registerCombatCommand("sm_ae_dm_1"); - core.commandService.registerCombatCommand("sm_ae_dm_2"); - core.commandService.registerCombatCommand("sm_ae_dm_3"); - core.commandService.registerCombatCommand("sm_ae_dm_4"); - core.commandService.registerCombatCommand("sm_ae_dm_5"); - core.commandService.registerCombatCommand("sm_ae_dm_6"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_1"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_2"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_3"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_4"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_5"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_melee_1"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_melee_2"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_melee_3"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_melee_4"); - core.commandService.registerCombatCommand("sm_ae_dm_cc_melee_5"); - core.commandService.registerCombatCommand("sm_ae_dm_melee_1"); - core.commandService.registerCombatCommand("sm_ae_dm_melee_2"); - core.commandService.registerCombatCommand("sm_ae_dm_melee_3"); - core.commandService.registerCombatCommand("sm_ae_dm_melee_4"); - core.commandService.registerCombatCommand("sm_ae_dm_melee_5"); - core.commandService.registerCombatCommand("sm_ae_dm_melee_6"); - core.commandService.registerCombatCommand("sm_ae_pin_down"); - core.commandService.registerCombatCommand("sm_bad_odds_1"); - core.commandService.registerCombatCommand("sm_bad_odds_2"); - core.commandService.registerCombatCommand("sm_bad_odds_3"); - core.commandService.registerCombatCommand("sm_bad_odds_4"); - core.commandService.registerCombatCommand("sm_bad_odds_5"); - core.commandService.registerCombatCommand("sm_break_the_deal"); - core.commandService.registerCombatCommand("sm_concussion_shot"); - core.commandService.registerCombatCommand("sm_del_dm_cc_1"); - core.commandService.registerCombatCommand("sm_del_dm_cc_2"); - core.commandService.registerCombatCommand("sm_del_dm_cc_3"); - core.commandService.registerCombatCommand("sm_del_dm_cc_4"); - core.commandService.registerCombatCommand("sm_del_dm_cc_5"); - core.commandService.registerCombatCommand("sm_del_dm_cc_6"); - core.commandService.registerCombatCommand("sm_dizzy"); - core.commandService.registerCombatCommand("sm_dm_1"); - core.commandService.registerCombatCommand("sm_dm_2"); - core.commandService.registerCombatCommand("sm_dm_3"); - core.commandService.registerCombatCommand("sm_dm_4"); - core.commandService.registerCombatCommand("sm_dm_5"); - core.commandService.registerCombatCommand("sm_dm_6"); - core.commandService.registerCombatCommand("sm_dm_7"); - core.commandService.registerCombatCommand("sm_dm_cc_1"); - core.commandService.registerCombatCommand("sm_dm_cc_2"); - core.commandService.registerCombatCommand("sm_dm_cc_3"); - core.commandService.registerCombatCommand("sm_dm_cc_4"); - core.commandService.registerCombatCommand("sm_dm_cc_5"); - core.commandService.registerCombatCommand("sm_dm_cc_6"); - core.commandService.registerCombatCommand("sm_dm_cc_melee_1"); - core.commandService.registerCombatCommand("sm_dm_cc_melee_2"); - core.commandService.registerCombatCommand("sm_dm_cc_melee_3"); - core.commandService.registerCombatCommand("sm_dm_cc_melee_4"); - core.commandService.registerCombatCommand("sm_dm_cc_melee_5"); - core.commandService.registerCombatCommand("sm_dm_cc_melee_6"); - core.commandService.registerCombatCommand("sm_dm_dot_1"); - core.commandService.registerCombatCommand("sm_dm_dot_2"); - core.commandService.registerCombatCommand("sm_dm_dot_3"); - core.commandService.registerCombatCommand("sm_dm_dot_4"); - core.commandService.registerCombatCommand("sm_dm_dot_melee_1"); - core.commandService.registerCombatCommand("sm_dm_dot_melee_2"); - core.commandService.registerCombatCommand("sm_dm_dot_melee_3"); - core.commandService.registerCombatCommand("sm_dm_dot_melee_4"); - core.commandService.registerCombatCommand("sm_dm_melee_1"); - core.commandService.registerCombatCommand("sm_dm_melee_2"); - core.commandService.registerCombatCommand("sm_dm_melee_3"); - core.commandService.registerCombatCommand("sm_dm_melee_4"); - core.commandService.registerCombatCommand("sm_dm_melee_5"); - core.commandService.registerCombatCommand("sm_dm_melee_6"); - core.commandService.registerCombatCommand("sm_dm_melee_7"); - core.commandService.registerCombatCommand("sm_false_hope"); - core.commandService.registerCombatCommand("sm_fast_draw"); - core.commandService.registerCombatCommand("sm_how_are_you"); - core.commandService.registerCombatCommand("sm_impossible_odds"); - core.commandService.registerCombatCommand("sm_inspect_cargo"); - core.commandService.registerCombatCommand("sm_pistol_whip_1"); - core.commandService.registerCombatCommand("sm_pistol_whip_2"); - core.commandService.registerCombatCommand("sm_pistol_whip_3"); - core.commandService.registerCombatCommand("sm_pistol_whip_4"); - core.commandService.registerCombatCommand("sm_precision_strike"); - core.commandService.registerCombatCommand("sm_sh_0"); - core.commandService.registerCombatCommand("sm_sh_1"); - core.commandService.registerCombatCommand("sm_sh_2"); - core.commandService.registerCombatCommand("sm_sh_3"); - core.commandService.registerCombatCommand("sm_shoot_first_1"); - core.commandService.registerCombatCommand("sm_shoot_first_2"); - core.commandService.registerCombatCommand("sm_shoot_first_3"); - core.commandService.registerCombatCommand("sm_shoot_first_4"); - core.commandService.registerCombatCommand("sm_shoot_first_5"); - core.commandService.registerCombatCommand("sm_skullduggery"); - core.commandService.registerCombatCommand("sm_sly_lie"); - core.commandService.registerCombatCommand("sm_spot_a_sucker_1"); - core.commandService.registerCombatCommand("sm_spot_a_sucker_2"); - core.commandService.registerCombatCommand("sm_spot_a_sucker_3"); - core.commandService.registerCombatCommand("sm_spot_a_sucker_4"); - - - // Spy - - core.commandService.registerCombatCommand("sp_action_regen"); - core.commandService.registerCombatCommand("sp_assassins_mark"); - core.commandService.registerCombatCommand("sp_cc_dot"); - core.commandService.registerCombatCommand("sp_dm_1"); - core.commandService.registerCombatCommand("sp_dm_2"); - core.commandService.registerCombatCommand("sp_dm_3"); - core.commandService.registerCombatCommand("sp_dm_4"); - core.commandService.registerCombatCommand("sp_dm_5"); - core.commandService.registerCombatCommand("sp_dm_6"); - core.commandService.registerCombatCommand("sp_dm_7"); - core.commandService.registerCombatCommand("sp_dm_8"); - core.commandService.registerCombatCommand("sp_dot_0"); - core.commandService.registerCombatCommand("sp_dot_1"); - core.commandService.registerCombatCommand("sp_dot_2"); - core.commandService.registerCombatCommand("sp_dot_3"); - core.commandService.registerCombatCommand("sp_dot_4"); - core.commandService.registerCombatCommand("sp_dot_5"); - core.commandService.registerCombatCommand("sp_fld_debuff_ca"); - core.commandService.registerCombatCommand("sp_fldmot_1"); - core.commandService.registerCombatCommand("sp_fldmot_1_snare"); - core.commandService.registerCombatCommand("sp_fldmot_2"); - core.commandService.registerCombatCommand("sp_fldmot_2_snare"); - core.commandService.registerCombatCommand("sp_fldmot_3"); - core.commandService.registerCombatCommand("sp_fldmot_3_snare"); - core.commandService.registerCombatCommand("sp_hd_melee_0"); - core.commandService.registerCombatCommand("sp_hd_melee_1"); - core.commandService.registerCombatCommand("sp_hd_melee_2"); - core.commandService.registerCombatCommand("sp_hd_melee_3"); - core.commandService.registerCombatCommand("sp_hd_melee_4"); - core.commandService.registerCombatCommand("sp_hd_melee_5"); - core.commandService.registerCombatCommand("sp_hd_melee_6"); - core.commandService.registerCombatCommand("sp_hd_range_0"); - core.commandService.registerCombatCommand("sp_hd_range_1"); - core.commandService.registerCombatCommand("sp_hd_range_2"); - core.commandService.registerCombatCommand("sp_hd_range_3"); - core.commandService.registerCombatCommand("sp_hd_range_4"); - core.commandService.registerCombatCommand("sp_hd_range_5"); - core.commandService.registerCombatCommand("sp_hd_range_6"); - core.commandService.registerCombatCommand("sp_improved_cc_dot_0"); - core.commandService.registerCombatCommand("sp_improved_cc_dot_1"); - core.commandService.registerCombatCommand("sp_improved_cc_dot_2"); - core.commandService.registerCombatCommand("sp_improved_cc_dot_3"); - core.commandService.registerCombatCommand("sp_run_its_course"); - core.commandService.registerCombatCommand("sp_sh_0"); - core.commandService.registerCombatCommand("sp_sh_1"); - core.commandService.registerCombatCommand("sp_sh_2"); - core.commandService.registerCombatCommand("sp_sh_3"); - core.commandService.registerCombatCommand("sp_shifty_setup"); - core.commandService.registerCombatCommand("sp_stealth_melee_0"); - core.commandService.registerCombatCommand("sp_stealth_melee_1"); - core.commandService.registerCombatCommand("sp_stealth_melee_2"); - core.commandService.registerCombatCommand("sp_stealth_melee_3"); - core.commandService.registerCombatCommand("sp_stealth_melee_4"); - core.commandService.registerCombatCommand("sp_stealth_melee_5"); - core.commandService.registerCombatCommand("sp_stealth_melee_6"); - core.commandService.registerCombatCommand("sp_stealth_ranged_0"); - core.commandService.registerCombatCommand("sp_stealth_ranged_1"); - core.commandService.registerCombatCommand("sp_stealth_ranged_2"); - core.commandService.registerCombatCommand("sp_stealth_ranged_3"); - core.commandService.registerCombatCommand("sp_stealth_ranged_4"); - core.commandService.registerCombatCommand("sp_stealth_ranged_5"); - core.commandService.registerCombatCommand("sp_stealth_ranged_6"); - - - - - } - + } diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 2af17e5d..ad8bf34c 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -36,6 +36,7 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; +import java.util.TreeSet; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; @@ -152,6 +153,8 @@ public class ObjectService implements INetworkDispatch { private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); protected final Object objectMutex = new Object(); private List loadServerTemplateTasks = Collections.synchronizedList(new ArrayList()); + private int iteratedReusedIds = 0; + private List reusableIds = Collections.synchronizedList(new ArrayList()); public ObjectService(final NGECore core) { this.core = core; @@ -202,6 +205,12 @@ public class ObjectService implements INetworkDispatch { objectList.put(object.getObjectID(), object); } + cursor = core.getReusableIdODB().getCursor(); + + while (cursor.hasNext()) { + reusableIds.add(((ObjectId) cursor.next()).objectId); + } + loadBuildings(); System.out.println("Finished loading objects."); } @@ -792,16 +801,98 @@ public class ObjectService implements INetworkDispatch { long objectId = 0; - if (core.getDuplicateIdODB().contains(key)) { - objectId = ((DuplicateId) core.getDuplicateIdODB().get(key)).getObjectId(); + boolean containsKey; + + synchronized(objectMutex) { + containsKey = core.getDuplicateIdODB().contains(key); + } + + if (containsKey) { + synchronized(objectMutex) { + objectId = ((DuplicateId) core.getDuplicateIdODB().get(key)).getObjectId(); + } + + if (objectList.containsKey(objectId)) { + System.err.println("Warning: DOId already in use. Using one from reusableId pool instead."); + return getReusableId(); + } } else { - objectId = generateObjectID(); - core.getDuplicateIdODB().put(key, new DuplicateId(key, objectId)); + while (true) { + objectId = generateObjectID(); + + synchronized(objectMutex) { + if (!core.getObjectIdODB().contains(objectId)) { + core.getObjectIdODB().put(objectId, new ObjectId(objectId)); + } else { + System.err.println("Error: Generated objectId is already in objectIdODB?"); + System.err.println("Trying again..."); + continue; + } + + if (objectList.containsKey(objectId)) { + System.err.println("Error: Generated objectId is already in objectList?"); + System.err.println("Trying again..."); + continue; + } + } + + break; + } + + synchronized(objectMutex) { + core.getDuplicateIdODB().put(key, new DuplicateId(key, objectId)); + } } return objectId; } - + + public long getReusableId() { + long objectId = 0; + + synchronized(objectMutex) { + objectId = reusableIds.iterator().next(); + + while (objectList.containsKey(objectId) && iteratedReusedIds++ < reusableIds.size()) { + objectId = reusableIds.get(iteratedReusedIds); + } + + if (objectList.containsKey(objectId)) { + objectId = 0; + } + } + + if (objectId == 0) { + while (true) { + objectId = generateObjectID(); + + synchronized(objectMutex) { + if (!core.getObjectIdODB().contains(objectId)) { + core.getObjectIdODB().put(objectId, new ObjectId(objectId)); + } else { + System.err.println("Error: Generated objectId is already in objectIdODB?"); + System.err.println("Trying again..."); + continue; + } + + if (objectList.containsKey(objectId)) { + System.err.println("Error: Generated objectId is already in objectList?"); + System.err.println("Trying again..."); + continue; + } + + core.getReusableIdODB().put(objectId, new ObjectId(objectId)); + reusableIds.add(objectId); + iteratedReusedIds++; + + break; + } + } + } + + return objectId; + } + public Vector getItemsInContainerByStfName(CreatureObject creature, long containerId, String stfName) { Vector itemList = new Vector(); SWGObject container = getObject(containerId); @@ -1084,6 +1175,10 @@ public class ObjectService implements INetworkDispatch { } } + creature.setIntendedTarget(0); + + creature.setLookAtTarget(0); + PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost"); if (ghost == null) { diff --git a/src/services/resources/ResourceService.java b/src/services/resources/ResourceService.java index 58e5b752..2ece6e4d 100644 --- a/src/services/resources/ResourceService.java +++ b/src/services/resources/ResourceService.java @@ -430,12 +430,6 @@ public class ResourceService implements INetworkDispatch { private void initialize() { for (ResourceClass c : ResourceClass.values()) resourceTypeTable.put(c, new Vector()); - - core.commandService.registerCommand("harvestcorpse"); - core.commandService.registerCommand("milkcreature"); - core.commandService.registerCommand("resourcecontainersplit"); - core.commandService.registerCommand("resourcecontainertransfer"); - core.commandService.registerCommand("factorycratesplit"); start(); } diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index f5d5aceb..e790004d 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -34,10 +34,12 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Random; +import java.util.TreeMap; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; + import resources.common.collidables.CollidableBox; import resources.common.collidables.CollidableCircle; import resources.datatables.Options; @@ -116,7 +118,6 @@ public class SpawnService { creature.setFaction(mobileTemplate.getFaction()); creature.setFactionStatus(mobileTemplate.getFactionStatus()); - creature.setPvpBitmask(mobileTemplate.getPvpBitmask()); creature.updatePvpStatus(); @@ -219,7 +220,11 @@ public class SpawnService { armor = 6000; core.skillModService.addSkillMod(creature, "expertise_innate_protection_all", armor); } - + + Map attacks = new TreeMap(); + mobileTemplate.getAttacks().stream().forEach((attack) -> attacks.put(attack, 1)); + creature.getAbilities().putAll(attacks); + if (mobileTemplate.isAIEnabled()){ if (!mobileTemplate.isNoAI()){ // NoAI is for QuestGivers that don't fight to save resources AIActor actor = new AIActor(creature, creature.getPosition(), scheduler); @@ -288,8 +293,7 @@ public class SpawnService { creature.setOptionsBitmask(mobileTemplate.getOptionsBitmask()); creature.setFaction(mobileTemplate.getFaction()); creature.setFactionStatus(mobileTemplate.getFactionStatus()); - creature.setPvpBitmask(mobileTemplate.getPvpBitmask()); - + if (mobileTemplate.getCustomName()==null){ // //creature.setStfFilename("mob/creature_names"); // TODO: set other STFs for NPCs other than creatures -> DONE if (mobileTemplate.getStfFilename()!=null){