From ba6db599438e3ede7deb3cb2a205d857c69cf3dd Mon Sep 17 00:00:00 2001 From: Treeku Date: Sun, 2 Mar 2014 14:09:33 +0000 Subject: [PATCH 1/7] Roadmap Rewards Fix --- src/services/PlayerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/PlayerService.java b/src/services/PlayerService.java index 791e2056..dd4c90a7 100644 --- a/src/services/PlayerService.java +++ b/src/services/PlayerService.java @@ -575,7 +575,9 @@ public class PlayerService implements INetworkDispatch { try { String customServerTemplate = null; - if (!item.contains("/")) { + if (item.contains("/")) { + item = (item.substring(0, (item.lastIndexOf("/") + 1)) + "/shared_" + item.substring((item.lastIndexOf("/") + 1))); + } else { customServerTemplate = item; item = core.scriptService.callScript("scripts/roadmap/", "roadmap_rewards", "get", item).asString(); } From b4209ae7272bbf188fbbb397545e7519e744e461 Mon Sep 17 00:00:00 2001 From: Treeku Date: Fri, 7 Feb 2014 18:36:41 +0000 Subject: [PATCH 2/7] Basic Radial Scripts --- scripts/radial/appearance.py | 16 ++++++++++++++++ scripts/radial/deed.py | 16 ++++++++++++++++ scripts/radial/wearable.py | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 scripts/radial/appearance.py create mode 100644 scripts/radial/deed.py create mode 100644 scripts/radial/wearable.py diff --git a/scripts/radial/appearance.py b/scripts/radial/appearance.py new file mode 100644 index 00000000..4c184296 --- /dev/null +++ b/scripts/radial/appearance.py @@ -0,0 +1,16 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/radial/deed.py b/scripts/radial/deed.py new file mode 100644 index 00000000..633eb6db --- /dev/null +++ b/scripts/radial/deed.py @@ -0,0 +1,16 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + radials.add(RadialOptions(0, 61, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 61 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file diff --git a/scripts/radial/wearable.py b/scripts/radial/wearable.py new file mode 100644 index 00000000..4c184296 --- /dev/null +++ b/scripts/radial/wearable.py @@ -0,0 +1,16 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.add(RadialOptions(0, 21, 1, '')) + radials.add(RadialOptions(0, 7, 1, '')) + radials.add(RadialOptions(0, 15, 1, '')) + return + +def handleSelection(core, owner, target, option): + if option == 21 and target: + core.objectService.useObject(owner, target) + if option == 15 and target: + core.objectService.destroyObject(target) + return + \ No newline at end of file From c28041dd08e053f26ca1eec0297e2cede96acf9c Mon Sep 17 00:00:00 2001 From: Treeku Date: Mon, 3 Mar 2014 12:13:39 +0000 Subject: [PATCH 3/7] Catching ConnectPlayerMessage --- src/services/ConnectionService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/services/ConnectionService.java b/src/services/ConnectionService.java index dc249362..74affae0 100644 --- a/src/services/ConnectionService.java +++ b/src/services/ConnectionService.java @@ -172,7 +172,15 @@ public class ConnectionService implements INetworkDispatch { } }); + + swgOpcodes.put(Opcodes.ConnectPlayerMessage, new INetworkRemoteEvent() { + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + //ConnectPlayerResponseMessage + } + + }); } From ed098357ae45c856232d5755051528549e1d0ae6 Mon Sep 17 00:00:00 2001 From: Treeku Date: Mon, 3 Mar 2014 12:22:45 +0000 Subject: [PATCH 4/7] Catching CommandQueueRemove --- src/resources/common/ObjControllerOpcodes.java | 1 + src/services/command/CommandService.java | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/resources/common/ObjControllerOpcodes.java b/src/resources/common/ObjControllerOpcodes.java index a7cac034..5834038e 100644 --- a/src/resources/common/ObjControllerOpcodes.java +++ b/src/resources/common/ObjControllerOpcodes.java @@ -26,6 +26,7 @@ public class ObjControllerOpcodes { public static final int DATA_TRANSFORM = 0x71000000; public static final int DATA_TRANSFORM_WITH_PARENT = 0xF1000000; public static final int COMMAND_QUEUE_ENQUEUE = 0x16010000; + public static final int COMMAND_QUEUE_REMOVE = 0x17010000; public static final int HOVER_TARGET = 0x26010000; // lookAtTarget public static final int TARGET_UPDATE = 0xC5040000; // intendedTarget public static final int OBJECT_MENU_REQUEST = 0x46010000; diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index 5c838cd1..1f63a445 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -22,7 +22,6 @@ package services.command; import java.nio.ByteOrder; -import java.util.HashMap; import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -114,6 +113,15 @@ public class CommandService implements INetworkDispatch { } }); + + objControllerOpcodes.put(ObjControllerOpcodes.COMMAND_QUEUE_REMOVE, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + + } + + }); } From 7654f8298b04099b5b5dd68845f52dd708150462 Mon Sep 17 00:00:00 2001 From: Treeku Date: Mon, 3 Mar 2014 12:27:42 +0000 Subject: [PATCH 5/7] Catching ChatRequestRoomList --- src/resources/common/Opcodes.java | 3 +++ src/services/chat/ChatService.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/resources/common/Opcodes.java b/src/resources/common/Opcodes.java index 72399c5e..62ed5218 100644 --- a/src/resources/common/Opcodes.java +++ b/src/resources/common/Opcodes.java @@ -29,8 +29,11 @@ public class Opcodes { public static int ChatInstantMessageToCharacter = 0x84BB21F7; public static int ChatPersistentMessageToServer = 0x25A29FA6; public static int ChatRequestPersistentMessage = 0x07E3559F; + public static int ChatRequestRoomList = 0x4C3D2CFA; public static int ChatSystemMessage = CRC.StringtoCRC("ChatSystemMessage"); public static int ClientOpenContainerMessage = 0x2D2D6EE1; + public static int CommodotiesItemTypeListRequest = 0x48F493C5; // needs catching + public static int NewbieTutorialResponse = 0xCA88FBAD; // needs catching public static int CmdSceneReady = 0x43FD1C22; public static int ConnectPlayerMessage = 0x2E365218; public static int ClientCreateCharacter = 0xB97F3074; diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 0a68ab4c..2bd76a4f 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -24,7 +24,6 @@ package services.chat; import java.nio.ByteOrder; import java.util.Date; import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; @@ -53,7 +52,6 @@ import protocol.swg.ChatFriendsListUpdate; import protocol.swg.ChatInstantMessageToCharacter; import protocol.swg.ChatInstantMessagetoClient; import protocol.swg.ChatOnAddFriend; -import protocol.swg.ChatOnGetFriendsList; import protocol.swg.ChatOnSendInstantMessage; import protocol.swg.ChatOnSendPersistentMessage; import protocol.swg.ChatPersistentMessageToClient; @@ -331,6 +329,16 @@ public class ChatService implements INetworkDispatch { } }); + + swgOpcodes.put(Opcodes.ChatRequestRoomList, new INetworkRemoteEvent() { + + @Override + public void handlePacket(IoSession session, IoBuffer data) throws Exception { + //ChatRoomList + } + + }); + } public void playerStatusChange(String name, byte status) { From 2b20d1ee6af649111768df31188e67f742ee78fa Mon Sep 17 00:00:00 2001 From: Treeku Date: Mon, 3 Mar 2014 12:50:16 +0000 Subject: [PATCH 6/7] Removed z.exp, changed Delta --- src/resources/objects/Delta.java | 18 +- src/resources/z/exp/buffs/Buff.java | 324 ----- src/resources/z/exp/craft/DraftSchematic.java | 88 -- src/resources/z/exp/equipment/Equipment.java | 83 -- .../exp/gcw/CurrentServerGCWZoneHistory.java | 77 -- .../exp/gcw/CurrentServerGCWZonePercent.java | 173 --- .../z/exp/gcw/OtherServerGCWZonePercent.java | 84 -- src/resources/z/exp/gcw/RegionDefender.java | 99 -- .../z/exp/group/GroupInviteInfo.java | 79 -- src/resources/z/exp/group/Member.java | 70 -- src/resources/z/exp/group/MemberInfo.java | 82 -- src/resources/z/exp/guild/Guild.java | 120 -- src/resources/z/exp/manufacture/Property.java | 84 -- src/resources/z/exp/manufacture/SubList.java | 63 - .../z/exp/manufacture/TableAndKey.java | 84 -- .../z/exp/mission/MissionLocation.java | 47 - src/resources/z/exp/objects/Baseline.java | 747 ------------ src/resources/z/exp/objects/Builder.java | 28 - .../z/exp/objects/ObjectMessageBuilder.java | 127 -- src/resources/z/exp/objects/SWGList.java | 410 ------- src/resources/z/exp/objects/SWGMap.java | 279 ----- src/resources/z/exp/objects/SWGMultiMap.java | 382 ------ src/resources/z/exp/objects/SWGSet.java | 280 ----- .../building/BuildingMessageBuilder.java | 49 - .../exp/objects/building/BuildingObject.java | 102 -- .../exp/objects/cell/CellMessageBuilder.java | 59 - .../z/exp/objects/cell/CellObject.java | 137 --- .../creature/CreatureMessageBuilder.java | 72 -- .../exp/objects/creature/CreatureObject.java | 1086 ----------------- .../FactoryCrateMessageBuilder.java | 26 - .../factorycrate/FactoryCrateObject.java | 26 - .../objects/group/GroupMessageBuilder.java | 49 - .../z/exp/objects/group/GroupObject.java | 256 ---- .../objects/guild/GuildMessageBuilder.java | 48 - .../z/exp/objects/guild/GuildObject.java | 192 --- .../harvester/HarvesterMessageBuilder.java | 26 - .../objects/harvester/HarvesterObject.java | 26 - .../InstallationMessageBuilder.java | 26 - .../installation/InstallationObject.java | 26 - .../intangible/IntangibleMessageBuilder.java | 62 - .../objects/intangible/IntangibleObject.java | 139 --- .../ManufactureSchematicMessageBuilder.java | 64 - .../ManufactureSchematicObject.java | 603 --------- .../mission/MissionMessageBuilder.java | 59 - .../z/exp/objects/mission/MissionObject.java | 329 ----- .../z/exp/objects/object/BaseObject.java | 543 --------- .../objects/player/PlayerMessageBuilder.java | 60 - .../z/exp/objects/player/PlayerObject.java | 999 --------------- .../ResourceContainerMessageBuilder.java | 26 - .../resource/ResourceContainerObject.java | 26 - .../exp/objects/ship/ShipMessageBuilder.java | 26 - .../z/exp/objects/ship/ShipObject.java | 26 - .../staticobject/StaticMessageBuilder.java | 49 - .../objects/staticobject/StaticObject.java | 93 -- .../tangible/TangibleMessageBuilder.java | 62 - .../exp/objects/tangible/TangibleObject.java | 400 ------ .../universe/UniverseMessageBuilder.java | 36 - .../exp/objects/universe/UniverseObject.java | 83 -- .../exp/objects/waypoint/WaypointObject.java | 172 --- .../objects/weapon/WeaponMessageBuilder.java | 77 -- .../z/exp/objects/weapon/WeaponObject.java | 246 ---- src/resources/z/exp/quest/Quest.java | 36 - src/resources/z/exp/skills/SkillMod.java | 102 -- 63 files changed, 13 insertions(+), 10339 deletions(-) delete mode 100644 src/resources/z/exp/buffs/Buff.java delete mode 100644 src/resources/z/exp/craft/DraftSchematic.java delete mode 100644 src/resources/z/exp/equipment/Equipment.java delete mode 100644 src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java delete mode 100644 src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java delete mode 100644 src/resources/z/exp/gcw/OtherServerGCWZonePercent.java delete mode 100644 src/resources/z/exp/gcw/RegionDefender.java delete mode 100644 src/resources/z/exp/group/GroupInviteInfo.java delete mode 100644 src/resources/z/exp/group/Member.java delete mode 100644 src/resources/z/exp/group/MemberInfo.java delete mode 100644 src/resources/z/exp/guild/Guild.java delete mode 100644 src/resources/z/exp/manufacture/Property.java delete mode 100644 src/resources/z/exp/manufacture/SubList.java delete mode 100644 src/resources/z/exp/manufacture/TableAndKey.java delete mode 100644 src/resources/z/exp/mission/MissionLocation.java delete mode 100644 src/resources/z/exp/objects/Baseline.java delete mode 100644 src/resources/z/exp/objects/Builder.java delete mode 100644 src/resources/z/exp/objects/ObjectMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/SWGList.java delete mode 100644 src/resources/z/exp/objects/SWGMap.java delete mode 100644 src/resources/z/exp/objects/SWGMultiMap.java delete mode 100644 src/resources/z/exp/objects/SWGSet.java delete mode 100644 src/resources/z/exp/objects/building/BuildingMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/building/BuildingObject.java delete mode 100644 src/resources/z/exp/objects/cell/CellMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/cell/CellObject.java delete mode 100644 src/resources/z/exp/objects/creature/CreatureMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/creature/CreatureObject.java delete mode 100644 src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java delete mode 100644 src/resources/z/exp/objects/group/GroupMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/group/GroupObject.java delete mode 100644 src/resources/z/exp/objects/guild/GuildMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/guild/GuildObject.java delete mode 100644 src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/harvester/HarvesterObject.java delete mode 100644 src/resources/z/exp/objects/installation/InstallationMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/installation/InstallationObject.java delete mode 100644 src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/intangible/IntangibleObject.java delete mode 100644 src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java delete mode 100644 src/resources/z/exp/objects/mission/MissionMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/mission/MissionObject.java delete mode 100644 src/resources/z/exp/objects/object/BaseObject.java delete mode 100644 src/resources/z/exp/objects/player/PlayerMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/player/PlayerObject.java delete mode 100644 src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/resource/ResourceContainerObject.java delete mode 100644 src/resources/z/exp/objects/ship/ShipMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/ship/ShipObject.java delete mode 100644 src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/staticobject/StaticObject.java delete mode 100644 src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/tangible/TangibleObject.java delete mode 100644 src/resources/z/exp/objects/universe/UniverseMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/universe/UniverseObject.java delete mode 100644 src/resources/z/exp/objects/waypoint/WaypointObject.java delete mode 100644 src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java delete mode 100644 src/resources/z/exp/objects/weapon/WeaponObject.java delete mode 100644 src/resources/z/exp/quest/Quest.java delete mode 100644 src/resources/z/exp/skills/SkillMod.java diff --git a/src/resources/objects/Delta.java b/src/resources/objects/Delta.java index 8b1e7f18..f33de22c 100644 --- a/src/resources/objects/Delta.java +++ b/src/resources/objects/Delta.java @@ -23,18 +23,22 @@ package resources.objects; import java.nio.ByteBuffer; -import org.apache.mina.core.buffer.SimpleBufferAllocator; +import org.apache.mina.core.buffer.IoBuffer; +import com.sleepycat.persist.model.NotPersistent; +import com.sleepycat.persist.model.Persistent; import resources.common.StringUtilities; - +@Persistent public abstract class Delta implements IDelta { - public Delta() { } + @NotPersistent + protected final Object objectMutex; - protected final Object objectMutex = new Object(); - public SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); + public Delta() { + objectMutex = new Object(); + } protected String getAsciiString(ByteBuffer buffer) { return StringUtilities.getAsciiString(buffer); @@ -56,4 +60,8 @@ public abstract class Delta implements IDelta { return ((byte) ((variable) ? 1 : 0)); } + public static IoBuffer createBuffer(int size) { + return Baseline.createBuffer(size); + } + } diff --git a/src/resources/z/exp/buffs/Buff.java b/src/resources/z/exp/buffs/Buff.java deleted file mode 100644 index dc6259d6..00000000 --- a/src/resources/z/exp/buffs/Buff.java +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************************************* - * 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.z.exp.buffs; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.buffer.SimpleBufferAllocator; - -import resources.objects.IDelta; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clientdata.ClientFileManager; -import engine.clientdata.visitors.DatatableVisitor; - -@Persistent(version=3) -public class Buff implements IDelta { - - @NotPersistent - private SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - private float duration; - private String buffName; - private long ownerId; - private String effect1Name, effect2Name, effect3Name, effect4Name, effect5Name; - private float effect1Value, effect2Value, effect3Value, effect4Value, effect5Value; - private String particleEffect; - private boolean isDebuff; - private boolean removeOnDeath; - private boolean isRemovableByPlayer; - private int maxStacks; - private boolean isPersistent; - private boolean removeOnRespec; - private boolean aiRemoveOnEndCombat; - private boolean decayOnPvPDeath; - private long startTime; - private int totalPlayTime; - - public Buff(String buffName, long ownerId) { - this.buffName = buffName; - this.ownerId = ownerId; - - DatatableVisitor visitor; - - try { - - visitor = ClientFileManager.loadFile("datatables/buff/buff.iff", DatatableVisitor.class); - - for (int i = 0; i < visitor.getRowCount(); i++) { - - if (visitor.getObject(i, 0) != null) { - - if (((String) visitor.getObject(i, 0)).equalsIgnoreCase(buffName)) { - - duration = (Float) visitor.getObject(i, 6); - effect1Name = (String) visitor.getObject(i, 7); - effect1Value = (Float) visitor.getObject(i, 8); - effect2Name = (String) visitor.getObject(i, 9); - effect2Value = (Float) visitor.getObject(i, 10); - effect3Name = (String) visitor.getObject(i, 11); - effect3Value = (Float) visitor.getObject(i, 12); - effect4Name = (String) visitor.getObject(i, 13); - effect4Value = (Float) visitor.getObject(i, 14); - effect5Name = (String) visitor.getObject(i, 15); - effect5Value = (Float) visitor.getObject(i, 16); - particleEffect = (String) visitor.getObject(i, 19); - isDebuff = (Boolean) visitor.getObject(i, 22); - removeOnDeath = (Integer) visitor.getObject(i, 25) != 0; - isRemovableByPlayer = (Integer) visitor.getObject(i, 26) != 0; - maxStacks = (Integer) visitor.getObject(i, 28); - isPersistent = (Integer) visitor.getObject(i, 29) != 0; - removeOnRespec = (Integer) visitor.getObject(i, 31) != 0; - aiRemoveOnEndCombat = (Integer) visitor.getObject(i, 32) != 0; - decayOnPvPDeath = (Integer) visitor.getObject(i, 33) != 0; - - } - - } - - } - - } catch (InstantiationException | IllegalAccessException e) { - e.printStackTrace(); - } - } - - public Buff() { - - } - - public byte[] getBytes() { - IoBuffer buffer = bufferPool.allocate(28, false).order(ByteOrder.LITTLE_ENDIAN); - if (duration > 0) { - buffer.putInt((int) (totalPlayTime + getRemainingDuration())); - buffer.putInt(0); - buffer.putInt((int) duration); - } else { - buffer.putInt(-1); - buffer.putInt(0); - buffer.putInt(-1); - } - buffer.putLong(ownerId); - buffer.putInt(1); // Unknown - buffer.flip(); - return buffer.array(); - } - - public float getDuration() { - return duration; - } - - public void setDuration(float duration) { - this.duration = duration; - } - - public String getBuffName() { - return buffName; - } - - public void setBuffName(String buffName) { - this.buffName = buffName; - } - - public long getOwnerId() { - return ownerId; - } - - public void setOwnerId(long ownerId) { - this.ownerId = ownerId; - } - - public String getEffect1Name() { - return effect1Name; - } - - public void setEffect1Name(String effect1Name) { - this.effect1Name = effect1Name; - } - - public String getEffect2Name() { - return effect2Name; - } - - public void setEffect2Name(String effect2Name) { - this.effect2Name = effect2Name; - } - - public String getEffect3Name() { - return effect3Name; - } - - public void setEffect3Name(String effect3Name) { - this.effect3Name = effect3Name; - } - - public String getEffect4Name() { - return effect4Name; - } - - public void setEffect4Name(String effect4Name) { - this.effect4Name = effect4Name; - } - - public String getEffect5Name() { - return effect5Name; - } - - public void setEffect5Name(String effect5Name) { - this.effect5Name = effect5Name; - } - - public float getEffect1Value() { - return effect1Value; - } - - public void setEffect1Value(float effect1Value) { - this.effect1Value = effect1Value; - } - - public float getEffect2Value() { - return effect2Value; - } - - public void setEffect2Value(float effect2Value) { - this.effect2Value = effect2Value; - } - - public float getEffect3Value() { - return effect3Value; - } - - public void setEffect3Value(float effect3Value) { - this.effect3Value = effect3Value; - } - - public float getEffect4Value() { - return effect4Value; - } - - public void setEffect4Value(float effect4Value) { - this.effect4Value = effect4Value; - } - - public float getEffect5Value() { - return effect5Value; - } - - public void setEffect5Value(float effect5Value) { - this.effect5Value = effect5Value; - } - - public String getParticleEffect() { - return particleEffect; - } - - public void setParticleEffect(String particleEffect) { - this.particleEffect = particleEffect; - } - - public boolean isDebuff() { - return isDebuff; - } - - public void setDebuff(boolean isDebuff) { - this.isDebuff = isDebuff; - } - - public boolean isRemoveOnDeath() { - return removeOnDeath; - } - - public void setRemoveOnDeath(boolean removeOnDeath) { - this.removeOnDeath = removeOnDeath; - } - - public boolean isRemovableByPlayer() { - return isRemovableByPlayer; - } - - public void setRemovableByPlayer(boolean isRemovableByPlayer) { - this.isRemovableByPlayer = isRemovableByPlayer; - } - - public int getMaxStacks() { - return maxStacks; - } - - public void setMaxStacks(int maxStacks) { - this.maxStacks = maxStacks; - } - - public boolean isPersistent() { - return isPersistent; - } - - public void setPersistent(boolean isPersistent) { - this.isPersistent = isPersistent; - } - - public boolean isRemoveOnRespec() { - return removeOnRespec; - } - - public void setRemoveOnRespec(boolean removeOnRespec) { - this.removeOnRespec = removeOnRespec; - } - - public boolean isAiRemoveOnEndCombat() { - return aiRemoveOnEndCombat; - } - - public void setAiRemoveOnEndCombat(boolean aiRemoveOnEndCombat) { - this.aiRemoveOnEndCombat = aiRemoveOnEndCombat; - } - - public boolean isDecayOnPvPDeath() { - return decayOnPvPDeath; - } - - public void setDecayOnPvPDeath(boolean decayOnPvPDeath) { - this.decayOnPvPDeath = decayOnPvPDeath; - } - - public void setStartTime() { - this.startTime = System.currentTimeMillis(); - } - - public int getRemainingDuration() { - long currentTime = System.currentTimeMillis(); - long timeDiff = (currentTime - startTime) / 1000; - int remaining = (int) (duration - timeDiff); - System.out.println("Buff remaining: " + remaining); - return remaining; - } - - public int getTotalPlayTime() { - return totalPlayTime; - } - - public void setTotalPlayTime(int totalPlayTime) { - this.totalPlayTime = totalPlayTime; - } - -} diff --git a/src/resources/z/exp/craft/DraftSchematic.java b/src/resources/z/exp/craft/DraftSchematic.java deleted file mode 100644 index 7192c98b..00000000 --- a/src/resources/z/exp/craft/DraftSchematic.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * 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.z.exp.craft; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class DraftSchematic extends Delta { - - private int serverSchematicCrc = 0; - private int schematicCrc = 0; - private int amount = 1; - - public DraftSchematic(int serverSchematicCrc, int schematicCrc, int amount) { - this.serverSchematicCrc = serverSchematicCrc; - this.schematicCrc = schematicCrc; - this.amount = amount; - } - - public DraftSchematic(int serverSchematicCrc, int schematicCrc) { - this.serverSchematicCrc = serverSchematicCrc; - this.schematicCrc = schematicCrc; - } - - public DraftSchematic() { - - } - - public int getServerSchematicCrc() { - synchronized(objectMutex) { - return serverSchematicCrc; - } - } - - public int getSchematicCrc() { - synchronized(objectMutex) { - return schematicCrc; - } - } - - public int getAmount() { - synchronized(objectMutex) { - return amount; - } - } - - public void setAmount(int amount) { - synchronized(objectMutex) { - this.amount = amount; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(12, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(serverSchematicCrc); - buffer.putInt(schematicCrc); - buffer.putInt(amount); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/equipment/Equipment.java b/src/resources/z/exp/equipment/Equipment.java deleted file mode 100644 index 4e7e06cc..00000000 --- a/src/resources/z/exp/equipment/Equipment.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * 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.z.exp.equipment; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.common.CRC; -import engine.resources.objects.SWGObject; -import resources.objects.Delta; -import resources.z.exp.objects.tangible.TangibleObject; -import resources.z.exp.objects.weapon.WeaponObject; - -@Persistent -public class Equipment extends Delta { - - private TangibleObject object; - - public Equipment(SWGObject object) { - this.object = ((object instanceof TangibleObject) ? (TangibleObject) object : null); - } - - public Equipment() { - - } - - public SWGObject getObject() { - synchronized(objectMutex) { - return object; - } - } - - public long getObjectId() { - synchronized(objectMutex) { - return object.getObjectId(); - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - int size = 18 + object.getCustomization().length; - - IoBuffer buffer = bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.setAutoExpand(true); - buffer.putShort((short) object.getCustomization().length); - buffer.put(object.getCustomization()); - buffer.putInt(object.getArrangementId()); - buffer.putLong(object.getObjectID()); - buffer.putInt(CRC.StringtoCRC(object.getTemplate())); - buffer.put(getBoolean((object instanceof WeaponObject))); - if (object instanceof WeaponObject) { - buffer.put(((WeaponObject) object).getBaseline3().getBaseline()); - buffer.put(((WeaponObject) object).getBaseline6().getBaseline()); - } - buffer.flip(); - - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java b/src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java deleted file mode 100644 index 3171a5eb..00000000 --- a/src/resources/z/exp/gcw/CurrentServerGCWZoneHistory.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * 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.z.exp.gcw; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { - - private int lastUpdateTime; - private int percent; - - public CurrentServerGCWZoneHistory(CurrentServerGCWZonePercent zone) { - this.percent = zone.getPercent().intValue(); - this.lastUpdateTime = zone.getLastUpdateTime(); - } - - public CurrentServerGCWZoneHistory() { - - } - - public int getLastUpdateTime() { - synchronized(objectMutex) { - return lastUpdateTime; - } - } - - public int getPercent() { - synchronized(objectMutex) { - return percent; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(lastUpdateTime); - buffer.putInt(percent); - return buffer.array(); - } - } - - public CurrentServerGCWZoneHistory clone() { - try { - return (CurrentServerGCWZoneHistory) super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java b/src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java deleted file mode 100644 index 930671f0..00000000 --- a/src/resources/z/exp/gcw/CurrentServerGCWZonePercent.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * 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.z.exp.gcw; - -import java.math.BigDecimal; -import java.math.MathContext; -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.scene.Point2D; - -import resources.objects.Delta; - -@Persistent -public class CurrentServerGCWZonePercent extends Delta implements Cloneable { - - private Point2D position; - private float radius = 0; - private BigDecimal weight; - private int type = 0; - private BigDecimal percent; - private int gcwPoints = 1; - private long lastUpdateTime = (System.currentTimeMillis() / ((long) 1000)); - - public CurrentServerGCWZonePercent(Point2D position, float radius, int weight, int type) { - this.position = position; - this.radius = radius; - this.weight = new BigDecimal(weight, MathContext.DECIMAL128); - this.weight = this.weight.divide(new BigDecimal("10000000.0", MathContext.DECIMAL128), MathContext.DECIMAL128); - this.type = type; - this.percent = new BigDecimal("50.0", MathContext.DECIMAL128); - } - - public CurrentServerGCWZonePercent() { - - } - - public Point2D getPosition() { - synchronized(objectMutex) { - return position.clone(); - } - } - - public void setPosition(Point2D position) { - synchronized(objectMutex) { - this.position = position; - } - } - - public float getRadius() { - synchronized(objectMutex) { - return radius; - } - } - - public void setRadius(float radius) { - synchronized(objectMutex) { - this.radius = radius; - } - } - - public int getGroup() { - synchronized(objectMutex) { - return weight.unscaledValue().intValue(); - } - } - - public BigDecimal getWeight() { - synchronized(objectMutex) { - return weight; - } - } - - public void setWeight(int weight) { - synchronized(objectMutex) { - this.weight = new BigDecimal(weight, MathContext.DECIMAL128); - this.weight = this.weight.divide(new BigDecimal("10000000.0", MathContext.DECIMAL128), MathContext.DECIMAL128); - } - } - - public int getType() { - synchronized(objectMutex) { - return type; - } - } - - public void setType(int type) { - synchronized(objectMutex) { - this.type = type; - } - } - - public BigDecimal getPercent() { - synchronized(objectMutex) { - return percent; - } - } - - public CurrentServerGCWZonePercent setPercent(BigDecimal percent) { - synchronized(objectMutex) { - this.percent = percent; - this.lastUpdateTime = (System.currentTimeMillis() / ((long) 1000)); - return this; - } - } - - public int getGCWPoints() { - synchronized(objectMutex) { - return gcwPoints; - } - } - - public void addGCWPoints(int gcwPoints) { - synchronized(objectMutex) { - this.gcwPoints += gcwPoints; - } - } - - public void removeGCWPoints(int gcwPoints) { - synchronized(objectMutex) { - this.gcwPoints = (((this.gcwPoints - gcwPoints) < 1) ? 1 : this.gcwPoints - gcwPoints); - } - } - - public int getLastUpdateTime() { - synchronized(objectMutex) { - return ((int) lastUpdateTime); - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(percent.intValue()); - return buffer.array(); - } - } - - @Override - public CurrentServerGCWZonePercent clone() { - try { - CurrentServerGCWZonePercent object = (CurrentServerGCWZonePercent) super.clone(); - object.setPosition(getPosition()); - return object; - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/resources/z/exp/gcw/OtherServerGCWZonePercent.java b/src/resources/z/exp/gcw/OtherServerGCWZonePercent.java deleted file mode 100644 index 8411980d..00000000 --- a/src/resources/z/exp/gcw/OtherServerGCWZonePercent.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * 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.z.exp.gcw; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class OtherServerGCWZonePercent extends Delta implements Cloneable { - - private String zone = ""; - private int percent = 50; - - public OtherServerGCWZonePercent(String zone) { - this.zone = zone; - } - - public OtherServerGCWZonePercent() { - - } - - public String getZone() { - synchronized(objectMutex) { - return zone; - } - } - - public int getPercent() { - synchronized(objectMutex) { - return percent; - } - } - - public OtherServerGCWZonePercent setPercent(double percent) { - synchronized(objectMutex) { - this.percent = (int) percent; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((2 + zone.length() + 4), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(getAsciiString(zone)); - buffer.putInt(percent); - return buffer.array(); - } - } - - @Override - public OtherServerGCWZonePercent clone() { - try { - return (OtherServerGCWZonePercent) super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - return null; - } - } - -} diff --git a/src/resources/z/exp/gcw/RegionDefender.java b/src/resources/z/exp/gcw/RegionDefender.java deleted file mode 100644 index 3f0194fa..00000000 --- a/src/resources/z/exp/gcw/RegionDefender.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * 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.z.exp.gcw; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.common.AString; -import resources.z.exp.objects.Baseline; -import resources.objects.Delta; - -@Persistent -public class RegionDefender extends Delta { - - private AString region; - private byte byte1 = 0; - private byte byte2 = 0; - - public RegionDefender(String region, byte byte1, byte byte2) { - this.region = new AString(region); - this.byte1 = byte1; - this.byte2 = byte2; - } - - public RegionDefender(String region) { - this.region = new AString(region); - } - - public RegionDefender() { - this.region = new AString(); - } - - public String getRegion() { - synchronized(objectMutex) { - return region.get(); - } - } - - public void setRegion(String region) { - synchronized(objectMutex) { - this.region = new AString(region); - } - } - - public byte getByte1() { - synchronized(objectMutex) { - return byte1; - } - } - - public void setByte1(byte byte1) { - synchronized(objectMutex) { - this.byte1 = byte1; - } - } - - public byte getByte2() { - synchronized(objectMutex) { - return byte2; - } - } - - public void setByte2(byte byte2) { - synchronized(objectMutex) { - this.byte2 = byte2; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = Baseline.createBuffer(region.getBytes().length + 2); - buffer.put(region.getBytes()); - buffer.put(byte1); - buffer.put(byte2); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/group/GroupInviteInfo.java b/src/resources/z/exp/group/GroupInviteInfo.java deleted file mode 100644 index 97c53445..00000000 --- a/src/resources/z/exp/group/GroupInviteInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * 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.z.exp.group; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.common.AString; -import resources.z.exp.objects.Baseline; -import resources.objects.Delta; - -@Persistent -public class GroupInviteInfo extends Delta { - - private long senderId; - private AString senderName; - private long inviteCounter; - - public GroupInviteInfo(long senderId, String senderName) { - this.senderId = senderId; - this.senderName = new AString(senderName); - inviteCounter = 1; - } - - public GroupInviteInfo() { - - } - - public long getSenderId() { - synchronized(objectMutex) { - return senderId; - } - } - - public String getSenderName() { - synchronized(objectMutex) { - return senderName.get(); - } - } - - public void setSender(long senderId, String senderName) { - synchronized(objectMutex) { - this.senderId = senderId; - this.senderName = new AString(senderName); - inviteCounter++; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = Baseline.createBuffer(16 + senderName.getBytes().length); - buffer.putLong(senderId); - buffer.put(senderName.getBytes()); - buffer.putLong(inviteCounter); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/group/Member.java b/src/resources/z/exp/group/Member.java deleted file mode 100644 index 93c5b64b..00000000 --- a/src/resources/z/exp/group/Member.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * 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.z.exp.group; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.objects.SWGObject; - -import resources.objects.Delta; - -@Persistent -public class Member extends Delta { - - private SWGObject member; - - public Member(SWGObject member) { - this.member = member; - } - - public Member() { - - } - - public SWGObject getMember() { - synchronized(objectMutex) { - return member; - } - } - - public long getObjectId() { - return member.getObjectID(); - } - - public String getCustomName() { - return member.getCustomName(); - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(8 + getAsciiString(getCustomName()).length, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putLong(getObjectId()); - buffer.put(getAsciiString(getCustomName())); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/group/MemberInfo.java b/src/resources/z/exp/group/MemberInfo.java deleted file mode 100644 index a19fce7c..00000000 --- a/src/resources/z/exp/group/MemberInfo.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * 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.z.exp.group; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class MemberInfo extends Delta { - - private long info; - private int memberId; - - public MemberInfo(long info, int memberId) { - this.info = info; - this.memberId = memberId; - } - - public MemberInfo() { - - } - - public long getInfo() { - synchronized(objectMutex) { - return info; - } - } - - public MemberInfo setInfo(long info) { - synchronized(objectMutex) { - this.info = info; - return this; - } - } - - public int getMemberId() { - synchronized(objectMutex) { - return memberId; - } - } - - public MemberInfo setMemberId(int memberId) { - synchronized(objectMutex) { - this.memberId = memberId; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(12, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putLong(info); - buffer.putInt(memberId); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/guild/Guild.java b/src/resources/z/exp/guild/Guild.java deleted file mode 100644 index 7e29d8a2..00000000 --- a/src/resources/z/exp/guild/Guild.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * 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.z.exp.guild; - -import java.nio.ByteOrder; -import java.util.List; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -import engine.resources.objects.SWGObject; - -@Persistent -public class Guild extends Delta { - - private int id; - private String abbreviation; - private String name; - private SWGObject leader; - private List members; - - public Guild(int id, String abbreviation, String name, SWGObject leader) { - this.id = id; - this.abbreviation = abbreviation; - this.name = name; - this.leader = leader; - this.members.add(leader); - } - - public Guild() { - - } - - public int getId() { - synchronized(objectMutex) { - return id; - } - } - - public void setId(int id) { - synchronized(objectMutex) { - this.id = id; - } - } - - public String getAbbreviation() { - synchronized(objectMutex) { - return abbreviation; - } - } - - public void setAbbreviation(String abbreviation) { - synchronized(objectMutex) { - this.abbreviation = abbreviation; - } - } - - public String getName() { - synchronized(objectMutex) { - return name; - } - } - - public void setName(String name) { - synchronized(objectMutex) { - this.name = name; - } - } - - public String getString() { - return (Integer.toString(getId()) + ":" + getAbbreviation()); - } - - public SWGObject getLeader() { - synchronized(objectMutex) { - return leader; - } - } - - public void setLeader(SWGObject leader) { - synchronized(objectMutex) { - this.leader = leader; - } - } - - public List getMembers() { - return members; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((getString().length() + 2), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(getAsciiString(getString())); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/manufacture/Property.java b/src/resources/z/exp/manufacture/Property.java deleted file mode 100644 index 254c1689..00000000 --- a/src/resources/z/exp/manufacture/Property.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * 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.z.exp.manufacture; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class Property extends Delta { - - private int unused = 0; - private String key = ""; - private float value = 0; - - public Property(String key, float value) { - this.key = key; - this.value = value; - } - - public Property() { - - } - - public String getKey() { - synchronized(objectMutex) { - return key; - } - } - - public Property setKey(String key) { - synchronized(objectMutex) { - this.key = key; - return this; - } - } - - public float getValue() { - synchronized(objectMutex) { - return value; - } - } - - public Property setValue(float value) { - synchronized(objectMutex) { - this.value = value; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(8 + getAsciiString(key).length, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(unused); - buffer.put(getAsciiString(key)); - buffer.putFloat(value); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/manufacture/SubList.java b/src/resources/z/exp/manufacture/SubList.java deleted file mode 100644 index 4a65aaa9..00000000 --- a/src/resources/z/exp/manufacture/SubList.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * 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.z.exp.manufacture; - -import java.nio.ByteOrder; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; -import resources.z.exp.objects.Baseline; - -@Persistent -public class SubList extends Delta { - - private List list = new CopyOnWriteArrayList(); - - public SubList() { - - } - - public List getList() { - return list; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - int size = 4; - for (o object : list) size += Baseline.toBytes(object).length; - - IoBuffer buffer = bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(list.size()); - for (o object : list) { - buffer.put(Baseline.toBytes(object)); - } - - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/manufacture/TableAndKey.java b/src/resources/z/exp/manufacture/TableAndKey.java deleted file mode 100644 index acf3aa73..00000000 --- a/src/resources/z/exp/manufacture/TableAndKey.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * 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.z.exp.manufacture; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -@Persistent -public class TableAndKey extends Delta { - - private String table = ""; - private int unused = 0; - private String key = ""; - - public TableAndKey(String table, String key) { - this.table = table; - this.table = key; - } - - public TableAndKey() { - - } - - public String getTable() { - synchronized(objectMutex) { - return table; - } - } - - public TableAndKey setTable(String table) { - synchronized(objectMutex) { - this.table = table; - return this; - } - } - - public String getKey() { - synchronized(objectMutex) { - return key; - } - } - - public TableAndKey setKey(String key) { - synchronized(objectMutex) { - this.key = key; - return this; - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(4 + getAsciiString(table).length + getAsciiString(key).length, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(getAsciiString(table)); - buffer.putInt(unused); - buffer.put(getAsciiString(key)); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/mission/MissionLocation.java b/src/resources/z/exp/mission/MissionLocation.java deleted file mode 100644 index 52a37dc1..00000000 --- a/src/resources/z/exp/mission/MissionLocation.java +++ /dev/null @@ -1,47 +0,0 @@ -package resources.z.exp.mission; - -import com.sleepycat.persist.model.Persistent; - -import engine.resources.common.CRC; -import engine.resources.scene.Point3D; - -@Persistent -public class MissionLocation { - - private float x, y, z; - private long objectId; - private String planet; - - public MissionLocation(Point3D position, long objectId, String planet) { - this.x = position.x; - this.y = position.y; - this.z = position.z; - this.objectId = objectId; - this.planet = planet; - } - - public MissionLocation() { - - } - - public Point3D getPosition() { - return new Point3D(x, y, z); - } - - public long getObjectId() { - return objectId; - } - - public String getPlanet() { - return planet; - } - - public int getPlanetCRC() { - if (planet != null) { - return CRC.StringtoCRC(planet); - } else { - return 0; - } - } - -} diff --git a/src/resources/z/exp/objects/Baseline.java b/src/resources/z/exp/objects/Baseline.java deleted file mode 100644 index 9ae536c6..00000000 --- a/src/resources/z/exp/objects/Baseline.java +++ /dev/null @@ -1,747 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -import java.io.UnsupportedEncodingException; -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.buffer.SimpleBufferAllocator; - -import resources.common.AString; -import resources.common.Opcodes; -import resources.common.UString; -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.resources.objects.SWGObject; - -@Persistent -public class Baseline implements List { - - private List list = new CopyOnWriteArrayList(); - private Map definition = new TreeMap(); - private BaseObject object; - private byte viewType; - @NotPersistent - protected final Object objectMutex = new Object(); - @NotPersistent - private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); - @NotPersistent - private Map baselineBuilders; - @NotPersistent - private Map deltaBuilders; - - public Baseline() { } - - public Baseline(BaseObject object, int viewType) { - this.viewType = (byte) viewType; - this.object = object; - } - - public boolean add(Object e) { - synchronized(objectMutex) { - if (list.add(e)) { - definition.put(Integer.toString(list.size() - 1), list.size() - 1); - return true; - } else { - return false; - } - } - } - - public void add(int index, Object element) { - synchronized(objectMutex) { - return; - } - } - - public boolean addAll(Collection c) { - synchronized(objectMutex) { - return false; - } - } - - public boolean addAll(int index, Collection c) { - synchronized(objectMutex) { - return false; - } - } - - public void clear() { - synchronized(objectMutex) { - list.clear(); - definition.clear(); - } - } - - public boolean contains(Object o) { - synchronized(objectMutex) { - return list.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized(objectMutex) { - return list.containsAll(c); - } - } - - private boolean compareTypes(Object o1, Object o2) { - if ((o1 instanceof IDelta && o2 instanceof IDelta) || - (o1 instanceof AString && o2 instanceof AString) || - (o1 instanceof UString && o2 instanceof UString) || - (o1 instanceof Byte[] && o2 instanceof Byte[]) || - (o1 instanceof Byte && o2 instanceof Byte) || - (o1 instanceof Boolean && o2 instanceof Boolean) || - (o1 instanceof Short && o2 instanceof Short) || - (o1 instanceof Integer && o2 instanceof Integer) || - (o1 instanceof Float && o2 instanceof Float) || - (o1 instanceof Long && o2 instanceof Long) || - (o1 instanceof SWGObject && o2 instanceof SWGObject) || - (o1 instanceof SWGList && o2 instanceof SWGList) || - (o1 instanceof SWGSet && o2 instanceof SWGSet) || - (o1 instanceof SWGMap && o2 instanceof SWGMap) || - (o1 instanceof SWGMultiMap && o2 instanceof SWGMultiMap) || - (o1 instanceof ArrayList && o2 instanceof ArrayList)) { - return true; - } - - return false; - } - - public IoBuffer createBaseline() { - byte[] objects = { }; - int size = 0; - - for (Object o : list) { - byte[] object; - - if (baselineBuilders != null && baselineBuilders.containsKey(o)) { - object = baselineBuilders.get(o).build(); - } else { - object = toBytes(o); - } - - size += object.length; - - IoBuffer buffer = createBuffer(size); - buffer.put(objects); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = createBuffer(25 + size); - buffer.putShort((short) 5); - buffer.putInt(Opcodes.BaselinesMessage); - buffer.putLong(object.getObjectID()); - try { - buffer.put(reverse(getShortTemplate()).getBytes("US-ASCII")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - buffer.put(viewType); - buffer.putInt(size); - buffer.putShort((short) list.size()); - buffer.put(objects); - buffer.flip(); - - return buffer; - } - - public static IoBuffer createBuffer(int size) { - return bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - } - - public IoBuffer createDelta() { - List objectQueue = new ArrayList(); - - synchronized(objectMutex) { - for (int i = 0; i < list.size(); i++) { - objectQueue.add(i); - } - } - - return createDelta(objectQueue, null); - } - - public IoBuffer createDelta(int object) { - List objectQueue = new ArrayList(); - objectQueue.add(object); - return createDelta(objectQueue, null); - } - - public IoBuffer createDelta(int object, byte[] data) { - List objectQueue = new ArrayList(); - objectQueue.add(object); - return createDelta(objectQueue, data); - } - - public IoBuffer createDelta(List objectQueue, byte[] data) { - byte[] objects = { }; - int size = 0; - - for (Integer o : objectQueue) { - byte[] object; - - if (deltaBuilders != null && deltaBuilders.containsKey(o)) { - object = deltaBuilders.get(o).build(); - } else if (data != null) { - object = data; - } else { - object = toBytes(get(o)); - } - - size += 2 + object.length; - - IoBuffer buffer = createBuffer(size); - buffer.put(objects); - buffer.putShort(o.shortValue()); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = createBuffer(27 + size); - buffer.putShort((short) 5); - buffer.putInt(Opcodes.DeltasMessage); - buffer.putLong(object.getObjectID()); - try { - buffer.put(reverse(getShortTemplate()).getBytes("US-ASCII")); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - buffer.put(viewType); - buffer.putInt(size); - buffer.putShort((short) objectQueue.size()); - buffer.put(objects); - buffer.flip(); - - return buffer; - } - - public Object get(int index) { - synchronized(objectMutex) { - return list.get(index); - } - } - - public Object get(String name) { - synchronized(objectMutex) { - return list.get(definition.get(name)); - } - } - - public IoBuffer getBaseline() { - return createBaseline(); - } - - public Map getBaselineBuilders() { - synchronized(objectMutex) { - return baselineBuilders; - } - } - - public static byte getBoolean(boolean condition) { - return ((byte) ((condition) ? 1 : 0)); - } - - public byte[] getBytes() { - synchronized(objectMutex) { - int size = 0; - - for (Object o : list) { - size += toBytes(o).length; - } - - IoBuffer buffer = createBuffer(size); - - for (Object o : list) { - buffer.put(toBytes(o)); - } - - buffer.flip(); - - return buffer.array(); - } - } - - public byte[] getBytes(int index) { - synchronized(objectMutex) { - return toBytes(list.get(index)); - } - } - - public byte[] getBytes(String name) { - synchronized(objectMutex) { - return toBytes(list.get(definition.get(name))); - } - } - - private String getDefinition(int index) { - for (Entry entry : definition.entrySet()) { - if (entry.getValue() == index) { - return entry.getKey(); - } - } - - return null; - } - - public Map getDefinitions() { - synchronized(objectMutex) { - return definition; - } - } - - public IoBuffer getDelta(int index) { - return createDelta(index); - } - - public IoBuffer getDelta(String name) { - return createDelta(definition.get(name)); - } - - public Map getDeltaBuilders() { - synchronized(objectMutex) { - return deltaBuilders; - } - } - - public Object getMutex() { - return objectMutex; - } - - public String getShortTemplate() throws Exception { - String Template = object.getTemplate(); - - if (Template.startsWith("object/battlefield_marker")) { - return "BMRK"; - } else if(Template.startsWith("object/building")){ - return "BUIO"; - } else if(Template.startsWith("object/cell")) { - return "SCLT"; - } else if (Template.startsWith("object/construction_contract")) { - throw new Exception(); - } else if (Template.startsWith("object/counting")) { - throw new Exception(); - } else if (Template.startsWith("object/creature")) { - return "CREO"; - } else if (Template.startsWith("object/draft_schematic")) { - throw new Exception(); - } else if (Template.startsWith("object/factory")) { - return "FCYT"; - } else if(Template.startsWith("object/group")) { - return "GRUP"; - } else if(Template.startsWith("object/guild")) { - return "GILD"; - } else if (Template.startsWith("object/installation")) { - return "INSO"; - } else if (Template.startsWith("object/installation/battlefield")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/faction_perk/covert_detector")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/faction_perk/minefield")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/faction_perk/turret")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/generators")) { - return "HINO"; - } else if (Template.startsWith("object/installation/manufacture")) { - return "MINO"; - } else if (Template.startsWith("object/installation/mining_gas")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_liquid")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_gas")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_ore")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/mining_organic")) { - throw new Exception(); - } else if (Template.startsWith("object/installation/turret")) { - throw new Exception(); - } else if (Template.startsWith("object/intangible")) { - return "ITNO"; - } else if (Template.startsWith("object/jedi_manager")) { - throw new Exception(); - } else if (Template.startsWith("object/manufacture_schematic")) { - return "MSCO"; - } else if (Template.startsWith("object/mission")) { - return "MISO"; - } else if (Template.startsWith("object/mobile")) { - throw new Exception(); - } else if (Template.startsWith("object/object")) { - throw new Exception(); - } else if (Template.startsWith("object/path_waypoint")) { - throw new Exception(); - } else if (Template.startsWith("object/player")) { - return "PLAY"; - } else if (Template.startsWith("object/player_quest")) { - return "PQOS"; - } else if (Template.startsWith("object/resource_container")) { - return "RCNO"; - } else if (Template.startsWith("object/ship")) { - return "SHIP"; - } else if (Template.startsWith("object/soundobject")) { - throw new Exception(); - } else if(Template.startsWith("object/static")) { - return "STAO"; - } else if (Template.startsWith("object/tangible")) { - return "TANO"; - } else if (Template.startsWith("object/token")) { - throw new Exception(); - } else if (Template.startsWith("object/universe")) { - throw new Exception(); - } else if(Template.startsWith("object/waypoint")) { - return "WAYP"; - } else if (Template.startsWith("object/weapon")) { - return "WEAO"; - } else { - throw new Exception(); - } - } - - public int indexOf(Object o) { - synchronized(objectMutex) { - return list.indexOf(o); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return list.isEmpty(); - } - } - - public Iterator iterator() { - synchronized(objectMutex) { - return list.iterator(); - } - } - - public int lastIndexOf(Object o) { - synchronized(objectMutex) { - return lastIndexOf(o); - } - } - - public ListIterator listIterator() { - synchronized(objectMutex) { - return list.listIterator(); - } - } - - public ListIterator listIterator(int index) { - synchronized(objectMutex) { - return listIterator(index); - } - } - - public void put(String name, Object o) { - synchronized(objectMutex) { - definition.put(name, list.size()); - list.add(o); - } - } - - public boolean remove(Object o) { - return false; - } - - public Object remove(int index) { - return null; - } - - public boolean removeAll(Collection c) { - return false; - } - - public boolean retainAll(Collection c) { - return false; - } - - private String reverse(String reverseString) { - if (reverseString.length() <= 1) { - return reverseString; - } - - return reverse(reverseString.substring(1, reverseString.length())) + reverseString.charAt(0); - } - - public Object set(int index, Object element) { - return null; - } - - public IoBuffer set(String name, Object o) { - synchronized(objectMutex) { - int index = definition.get(name); - - if (compareTypes(o, list.get(index)) && list.set(index, o) != null) { - return createDelta(index); - } else { - return null; - } - } - } - - public void setBaselineBuilders(Map baselineBuilders) { - synchronized(objectMutex) { - this.baselineBuilders = baselineBuilders; - } - } - - public void setDeltaBuilders(Map deltaBuilders) { - synchronized(objectMutex) { - this.deltaBuilders = deltaBuilders; - } - } - - public int size() { - synchronized(objectMutex) { - return list.size(); - } - } - - public List subList(int fromIndex, int toIndex) { - synchronized(objectMutex) { - return list.subList(fromIndex, toIndex); - } - } - - public Object[] toArray() { - synchronized(objectMutex) { - return list.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized(objectMutex) { - return list.toArray(a); - } - } - - public static byte[] toBytes(Object o) { - try { - if (o != null) { - if (o instanceof IDelta) { - return ((IDelta) o).getBytes(); - } else if (o instanceof String) { - return (new AString((String) o)).getBytes(); - } else if (o instanceof AString) { - return ((AString) o).getBytes(); - } else if (o instanceof UString) { - return ((UString) o).getBytes(); - } else if (o instanceof Byte[]) { - IoBuffer buffer = createBuffer(2 + ((Byte[]) o).length); - buffer.putShort((short) ((Byte[]) o).length); - for (Byte b : (Byte[]) o) buffer.put(b); - return buffer.array(); - } else if (o instanceof Byte) { - return createBuffer(1).put((Byte) o).array(); - } else if (o instanceof Boolean) { - return createBuffer(1).put(((((Boolean) o)) ? (byte) 1 : (byte) 0)).array(); - } else if (o instanceof Short) { - return createBuffer(2).putShort((Short) o).array(); - } else if (o instanceof Integer) { - return createBuffer(4).putInt((Integer) o).array(); - } else if (o instanceof Float) { - return createBuffer(4).putFloat((Float) o).array(); - } else if (o instanceof Long) { - return createBuffer(8).putLong((Long) o).array(); - } else if (o instanceof SWGObject) { - long objectId = ((((SWGObject) o) == null) ? (long) 0 : ((SWGObject) o).getObjectID()); - return createBuffer(8).putLong(objectId).array(); - } else if (o instanceof SWGList) { - return ((SWGList) o).getBytes(); - } else if (o instanceof SWGSet) { - return ((SWGSet) o).getBytes(); - } else if (o instanceof SWGMap) { - return ((SWGMap) o).getBytes(); - } else if (o instanceof SWGMultiMap) { - return ((SWGMultiMap) o).getBytes(); - } else if (o instanceof ArrayList) { - ArrayList list = ((ArrayList) o); - int size = 0; - byte[] objects = { }; - - for (int i = 0; i < list.size(); i++) { - byte[] object = toBytes(list.get(i)); - size += object.length; - - IoBuffer buffer = createBuffer(size); - buffer.put(objects); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - return createBuffer(size + 4).putInt(list.size()).array(); - } else { - System.out.println("ERROR: Unsupported type used in Baseline: " + (o.getClass()).getSimpleName()); - throw new Exception(); - //return new byte[] { }; - } - } else { - if (o instanceof IDelta) { - System.out.println("ERROR: a baseline object that implements IDelta is null. This could cause crashes! Make it at least a new instance with all fields set to 0."); - return new byte[] { }; - } else if (o instanceof String) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof AString) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof UString) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof Byte[]) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof Byte) { - return new byte[] { 0x00 }; - } else if (o instanceof Boolean) { - return new byte[] { 0x00 }; - } else if (o instanceof Short) { - return new byte[] { 0x00, 0x00 }; - } else if (o instanceof Integer) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof Float) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof Long) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGObject) { - return null; - } else if (o instanceof SWGList) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGSet) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGMap) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof SWGMultiMap) { - return new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - } else if (o instanceof ArrayList) { - return new byte[] { 0x00, 0x00, 0x00, 0x00 }; - } else { - System.out.println("ERROR: Unsupported type used in Baseline."); - System.out.println("~additionally, the type was null, which is dangerous."); - return new byte[] { }; - } - } - } catch (Exception e) { - e.printStackTrace(); - return new byte[] { }; - } - } - - public void transformStructure(Baseline defaults) { - synchronized(objectMutex) { - List oldStruct = list; - Baseline newStruct = defaults; - - for (int i = 0; i < newStruct.size(); i++) { - if (definition.containsKey(newStruct.getDefinition(i))) { - int oldIndex = definition.get(newStruct.getDefinition(i)); - Object newObject = newStruct.get(i); - Object oldObject = oldStruct.get(oldIndex); - - if (compareTypes(newObject, oldObject)) { - newStruct.set(i, oldObject); - } else { - if (newObject instanceof String) { - if (oldObject instanceof AString) { - newStruct.set(i, ((AString) oldObject).get()); - } else if (oldObject instanceof UString) { - newStruct.set(i, ((UString) oldObject).get()); - } - } else if (newObject instanceof AString) { - if (oldObject instanceof String) { - newStruct.set(i, new AString((String) oldObject)); - } else if (oldObject instanceof UString) { - newStruct.set(i, new AString(((UString) oldObject).get())); - } - } else if (newObject instanceof UString) { - if (oldObject instanceof String) { - newStruct.set(i, new UString((String) oldObject)); - } else if (oldObject instanceof AString) { - newStruct.set(i, new UString(((AString) oldObject).get())); - } - } else if (newObject instanceof Byte) { - if (oldObject instanceof Short && (Short) oldObject < 0xFF) { - newStruct.set(i, ((Short) oldObject).byteValue()); - } else if (oldObject instanceof Integer && (Integer) oldObject < 0xFF) { - newStruct.set(i, ((Integer) oldObject).byteValue()); - } else if (oldObject instanceof Long && (Long) oldObject < 0xFF) { - newStruct.set(i, ((Long) oldObject).byteValue()); - } - } else if (newObject instanceof Short) { - if (oldObject instanceof Byte) { - newStruct.set(i, ((Byte) oldObject).shortValue()); - } else if (oldObject instanceof Integer && (Integer) oldObject < 0xFFFF) { - newStruct.set(i, ((Integer) oldObject).shortValue()); - } else if (oldObject instanceof Long && (Long) oldObject < 0xFFFF) { - newStruct.set(i, ((Long) oldObject).shortValue()); - } - } else if (newObject instanceof Integer) { - if (oldObject instanceof Byte) { - newStruct.set(i, ((Byte) oldObject).intValue()); - } else if (oldObject instanceof Short) { - newStruct.set(i, ((Short) oldObject).intValue()); - } else if (oldObject instanceof Long && (Long) oldObject < 0xFFFFFFFF) { - newStruct.set(i, ((Long) oldObject).intValue()); - } - } else if (newObject instanceof Long) { - if (oldObject instanceof Byte) { - newStruct.set(i, ((Byte) oldObject).longValue()); - } else if (oldObject instanceof Short) { - newStruct.set(i, ((Short) oldObject).longValue()); - } else if (oldObject instanceof Integer) { - newStruct.set(i, ((Integer) oldObject).longValue()); - } else if (oldObject instanceof SWGObject) { - newStruct.set(i, ((SWGObject) oldObject).getObjectID()); - } - } - } - } - } - - list = newStruct.list; - } - } - -} diff --git a/src/resources/z/exp/objects/Builder.java b/src/resources/z/exp/objects/Builder.java deleted file mode 100644 index 8bc6b647..00000000 --- a/src/resources/z/exp/objects/Builder.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -public interface Builder { - - public byte[] build(); - -} diff --git a/src/resources/z/exp/objects/ObjectMessageBuilder.java b/src/resources/z/exp/objects/ObjectMessageBuilder.java deleted file mode 100644 index 0ef9564f..00000000 --- a/src/resources/z/exp/objects/ObjectMessageBuilder.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -import java.nio.ByteBuffer; -import java.util.Map; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.common.StringUtilities; -import resources.z.exp.objects.object.BaseObject; - -@Persistent -public class ObjectMessageBuilder { - - protected BaseObject object; - - public ObjectMessageBuilder(BaseObject object) { - setObject(object); - } - - public ObjectMessageBuilder() { - - } - - public void buildBaseline1(Map baselineBuilders, Map deltaBuilders) { - /* - baselineBuilders.put(5, new Builder { - public byte[] build() { - IoBuffer = Baseline.createBuffer(2); - buffer.putShort((short) 27); - return buffer.array(); - } - }); - - deltaBuilders.put(7, new Builder { - public byte[] build() { - IoBuffer = Baseline.createBuffer(4); - buffer.putInt(27); - return buffer.array(); - } - }); - */ - } - - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline4(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline7(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - - } - - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - - } - - public IoBuffer createBuffer(int size, boolean autoSize) { - return createBuffer(size).setAutoExpand(autoSize); - } - - public IoBuffer createBuffer(int size) { - return Baseline.createBuffer(size); - } - - public BaseObject getObject() { - return object; - } - - public void setObject(BaseObject object) { - this.object = object; - } - - protected byte getBoolean(boolean variable) { - return Baseline.getBoolean(variable); - } - - protected String getAsciiString(ByteBuffer buffer) { - return StringUtilities.getAsciiString(buffer); - } - - protected String getUnicodeString(ByteBuffer buffer) { - return StringUtilities.getUnicodeString(buffer); - } - - protected byte[] getAsciiString(String string) { - return StringUtilities.getAsciiString(string); - } - - protected byte[] getUnicodeString(String string) { - return StringUtilities.getUnicodeString(string); - } - -} diff --git a/src/resources/z/exp/objects/SWGList.java b/src/resources/z/exp/objects/SWGList.java deleted file mode 100644 index 5e1883ec..00000000 --- a/src/resources/z/exp/objects/SWGList.java +++ /dev/null @@ -1,410 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -/* A SWGList element should extend Delta or implement IDelta */ - -@Persistent -public class SWGList implements List { - - private List list = new CopyOnWriteArrayList(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGList() { } - - public SWGList(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public boolean add(E e) { - synchronized(objectMutex) { - if (valid(e) && list.add(e)) { - queue(item(1, list.lastIndexOf(e), Baseline.toBytes(e), true, true)); - return true; - } - - return false; - } - } - - public void add(int index, E element) { - synchronized(objectMutex) { - if (valid(element)) { - list.add(index, element); - queue(item(1, index, Baseline.toBytes(element), true, true)); - } - } - } - - public boolean addAll(Collection c) { - synchronized(objectMutex) { - if (!c.isEmpty()) { - List buffer = new ArrayList(); - boolean success = false; - - for (E element : c) { - if (valid(element)) { - if (list.add(element)) { - buffer.add(item(1, list.lastIndexOf(element), Baseline.toBytes(element), true, true)); - success = true; - } - } else { - return false; - } - } - - if (success == true) { - queue(buffer); - } else { - return false; - } - } - - return false; - } - } - - public boolean addAll(int index, Collection c) { - synchronized(objectMutex) { - if (!c.isEmpty()) { - List buffer = new ArrayList(); - - for (E element : c) { - if (valid(element)) { - list.add(index, element); - buffer.add(item(1, index, Baseline.toBytes(element), true, true)); - index++; - } else { - return false; - } - } - - queue(buffer); - - return true; - } - - return false; - } - } - - public void clear() { - synchronized(objectMutex) { - list.clear(); - queue(item(4, 0, null, false, false)); - } - } - - public boolean contains(Object o) { - synchronized(objectMutex) { - return list.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized(objectMutex) { - return list.containsAll(c); - } - } - - public E get(int index) { - synchronized(objectMutex) { - return list.get(index); - } - } - - public List get() { - return list; - } - - public int indexOf(Object o) { - synchronized(objectMutex) { - return list.indexOf(o); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return list.isEmpty(); - } - } - - public Iterator iterator() { - synchronized(objectMutex) { - return list.iterator(); - } - } - - public int lastIndexOf(Object o) { - synchronized(objectMutex) { - return list.lastIndexOf(o); - } - } - - public ListIterator listIterator() { - synchronized(objectMutex) { - return list.listIterator(); - } - } - - public ListIterator listIterator(int index) { - synchronized(objectMutex) { - return listIterator(index); - } - } - - public boolean remove(Object o) { - synchronized(objectMutex) { - int index = list.indexOf(o); - - if (list.remove(o)) { - queue(item(1, index, null, true, false)); - return true; - } else { - return false; - } - } - } - - public E remove(int index) { - synchronized(objectMutex) { - E element = list.remove(index); - - queue(item(1, index, null, true, false)); - - return (E) element; - } - } - - public boolean removeAll(Collection c) { - synchronized(objectMutex) { - if (!c.isEmpty()) { - List buffer = new ArrayList(); - int index; - boolean success = false; - - for (Object element : c) { - index = list.indexOf(element); - - if (list.remove(element)) { - buffer.add(item(0, index, null, true, false)); - success = true; - } - } - - if (success) { - queue(buffer); - } - - return success; - } - - return false; - } - } - - public boolean retainAll(Collection c) { - synchronized(objectMutex) { - return list.retainAll(c); - } - } - - public E set(int index, E element) { - synchronized(objectMutex) { - if (valid(element)) { - E previousElement = list.set(index, element); - - queue(item(2, index, Baseline.toBytes(element), true, true)); - - return previousElement; - } - - return null; - } - } - - public boolean set(List list) { - synchronized(objectMutex) { - byte[] newListData = { 0x03 }; - - if (!list.isEmpty()) { - for (E element : list) { - if (valid(element)) { - IoBuffer buffer = IoBuffer.allocate((newListData.length + Baseline.toBytes(element).length), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put(newListData); - buffer.put(Baseline.toBytes(element)); - newListData = buffer.array(); - } else { - return false; - } - } - - this.list = list; - - updateCounter++; - queue(newListData); - - return true; - } - - return false; - } - } - - public int size() { - synchronized(objectMutex) { - return list.size(); - } - } - - public List subList(int fromIndex, int toIndex) { - synchronized(objectMutex) { - return list.subList(fromIndex, toIndex); - } - } - - public Object[] toArray() { - synchronized(objectMutex) { - return list.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized(objectMutex) { - return list.toArray(a); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Object o : list) { - byte[] object = Baseline.toBytes(o); - size += object.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(list.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private boolean valid(Object o) { - if (o instanceof String || o instanceof Byte || o instanceof Short || - o instanceof Integer || o instanceof Float || o instanceof Long || - o instanceof IDelta) { - return true; - } else { - return false; - } - } - - private byte[] item(int type, int index, byte[] data, boolean useIndex, boolean useData) { - int size = 1 + ((useIndex) ? 2 : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) buffer.putShort((short) index); - if (useData) buffer.put(data); - buffer.flip(); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - buffer.flip(); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - buffer.flip(); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/SWGMap.java b/src/resources/z/exp/objects/SWGMap.java deleted file mode 100644 index 663d3fd3..00000000 --- a/src/resources/z/exp/objects/SWGMap.java +++ /dev/null @@ -1,279 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -/* A SWGMap element should extend Delta or implement IDelta */ - -@Persistent -public class SWGMap implements Map { - - private Map map = new TreeMap(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGMap() { } - - public SWGMap(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public SWGMap(Map m) { - if (m instanceof SWGMap) { - this.object = ((SWGMap) m).object; - this.viewType = ((SWGMap) m).viewType; - this.updateType = ((SWGMap) m).updateType; - map.putAll(m); - } - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean containsKey(Object key) { - synchronized(objectMutex) { - return map.containsKey(key); - } - } - - public boolean containsValue(Object value) { - synchronized(objectMutex) { - return map.containsValue(value); - } - } - - public Set> entrySet() { - synchronized(objectMutex) { - return map.entrySet(); - } - } - - public V get(Object key) { - return map.get(key); - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return map.isEmpty(); - } - } - - public Set keySet() { - synchronized(objectMutex) { - return map.keySet(); - } - } - - public V put(K key, V value) { - synchronized(objectMutex) { - if (valid(key) && valid(value)) { - if (map.containsKey(key)) { - V oldValue = map.put(key, value); - - queue(item(2, key, Baseline.toBytes(value), true, true)); - - return oldValue; - } else { - V oldValue = map.put(key, value); - - queue(item(0, key, Baseline.toBytes(value), true, true)); - - return oldValue; - } - } - - return null; - } - } - - public void putAll(Map m) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (Entry entry : m.entrySet()) { - K key = entry.getKey(); - V value = entry.getValue(); - - if (valid(key) && valid(value)) { - if (map.containsKey(key)) { - if (map.put(key, value) != null) { - buffer.add(item(2, key, Baseline.toBytes(value), true, true)); - } - } else { - if (map.put(key, value) != null) { - buffer.add(item(0, key, Baseline.toBytes(value), true, true)); - } - } - } - } - - if (buffer.size() > 0) { - queue(buffer); - } - } - } - - public V remove(Object key) { - synchronized(objectMutex) { - if (valid(key)) { - V value = map.remove(key); - - queue(item(1, key, Baseline.toBytes(map.get(key)), true, true)); - - return value; - } - - return null; - } - } - - public int size() { - synchronized(objectMutex) { - return map.size(); - } - } - - public Collection values() { - synchronized(objectMutex) { - return map.values(); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Entry entry : map.entrySet()) { - byte[] key = Baseline.toBytes(entry.getKey()); - byte[] value = Baseline.toBytes(entry.getValue()); - size += ((addByte) ? 1 : 0) + key.length + value.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(key); - buffer.put(value); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(map.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private boolean valid(Object o) { - if (o instanceof String || o instanceof Byte || o instanceof Short || - o instanceof Integer || o instanceof Float || o instanceof Long || - o instanceof IDelta) { - return true; - } else { - return false; - } - } - - private byte[] item(int type, Object index, byte[] data, boolean useIndex, boolean useData) { - if (useIndex && ((index instanceof IDelta) || !valid(index))) { - throw new IllegalArgumentException(); - } - - int size = 1 + ((useIndex) ? (2 + Baseline.toBytes(index).length) : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) buffer.put(Baseline.toBytes(index)); - if (useData) buffer.put(data); - buffer.flip(); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate(data.length + 8, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - buffer.flip(); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - buffer.flip(); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/SWGMultiMap.java b/src/resources/z/exp/objects/SWGMultiMap.java deleted file mode 100644 index 3a63d514..00000000 --- a/src/resources/z/exp/objects/SWGMultiMap.java +++ /dev/null @@ -1,382 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; - -import org.apache.mina.core.buffer.IoBuffer; -import org.python.google.common.collect.ArrayListMultimap; -import org.python.google.common.collect.Multimap; -import org.python.google.common.collect.Multiset; -import org.python.google.common.collect.Ordering; -import org.python.google.common.collect.TreeMultimap; - -import resources.common.StringUtilities; -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -@SuppressWarnings("unused") - -@Persistent -public class SWGMultiMap implements Multimap { - - private Multimap map = ArrayListMultimap.create(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGMultiMap() { } - - public SWGMultiMap(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public SWGMultiMap(Multimap m) { - if (m instanceof SWGMultiMap) { - this.object = ((SWGMultiMap) m).object; - this.viewType = ((SWGMultiMap) m).viewType; - this.updateType = ((SWGMultiMap) m).updateType; - map.putAll(m); - } - } - - public Map> asMap() { - synchronized(objectMutex) { - return map.asMap(); - } - } - - public void clear() { - throw new UnsupportedOperationException(); - } - - public boolean containsEntry(Object key, Object value) { - synchronized(objectMutex) { - return map.containsEntry(key, value); - } - } - - public boolean containsKey(Object key) { - synchronized(objectMutex) { - return map.containsKey(key); - } - } - - public boolean containsValue(Object value) { - synchronized(objectMutex) { - return map.containsValue(value); - } - } - - public Collection> entries() { - synchronized(objectMutex) { - return map.entries(); - } - } - - public Collection get(K key) { - synchronized(objectMutex) { - return map.get(key); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return map.isEmpty(); - } - } - - public Multiset keys() { - synchronized(objectMutex) { - return map.keys(); - } - } - - public Set keySet() { - synchronized(objectMutex) { - return map.keySet(); - } - } - - public boolean put(K key, V value) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long || - value instanceof IDelta) { - if (map.put(key, value)) { - queue(item(0, (String) key, ((IDelta) value).getBytes(), true, true)); - return true; - } - } - - return false; - } - } - - public boolean putAll(K key, Iterable values) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - List buffer = new ArrayList(); - - for (V value : values) { - if (value instanceof IDelta) { - if (map.put(key, value)) { - buffer.add(item(0, (String) key, ((IDelta) value).getBytes(), true, true)); - } - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } - } - - return false; - } - } - - public boolean putAll(Multimap map) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (Entry entry : map.entries()) { - K key = entry.getKey(); - V value = entry.getValue(); - - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long || - value instanceof IDelta) { - if (this.map.put(key, value)) { - buffer.add(item(0, (String) key, ((IDelta) value).getBytes(), true, true)); - } - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } - - return false; - } - } - - @SuppressWarnings("unchecked") - public boolean remove(Object key, Object value) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - if (map.remove(key, value)) { - queue(item(1, (String) key, ((IDelta) map.get((K) key)).getBytes(), true, true)); - - return true; - } - } - - return false; - } - } - - @SuppressWarnings("unchecked") - public Collection removeAll(Object key) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - Collection collection = map.get((K) key); - List buffer = new ArrayList(); - - for (V value : map.get((K) key)) { - if (map.remove(key, value)) { - buffer.add(item(1, (String) key, ((IDelta) map.get((K) key)).getBytes(), true, true)); - } - } - - if (buffer.size() > 0) { - queue(buffer); - return collection; - } - } - - return null; - } - } - - public Collection replaceValues(K key, Iterable values) { - synchronized(objectMutex) { - if (key instanceof String || key instanceof Byte || key instanceof Short || - key instanceof Integer || key instanceof Float || key instanceof Long) { - if (map.containsKey(key)) { - List buffer = new ArrayList(); - - for (V value : values) { - if (value instanceof IDelta) { - if (!map.get(key).contains(value)) { - buffer.add(item(2, (String) key, ((IDelta) value).getBytes(), true, true)); - } - } else { - return null; - } - } - - if (buffer.size() > 0) { - queue(buffer); - return map.replaceValues(key, values); - } - } - } - - return null; - } - } - - public int size() { - synchronized(objectMutex) { - return map.size(); - } - } - - public Collection values() { - synchronized(objectMutex) { - return map.values(); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Entry entry : map.entries()) { - byte[] key = Baseline.toBytes(entry.getKey()); - byte[] value = Baseline.toBytes(entry.getValue()); - size += ((addByte) ? 1 : 0) + key.length + value.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(key); - buffer.put(value); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(map.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private byte[] item(int type, Object index, byte[] data, boolean useIndex, boolean useData) { - if (useIndex && !(index instanceof Byte) && !(index instanceof Short) - && !(index instanceof Integer) && !(index instanceof Float) - && !(index instanceof Long) && !(index instanceof String)) { - throw new IllegalArgumentException(); - } - - int size = 1 + ((useIndex) ? (2 + index.toString().getBytes().length) : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate((size), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) { - if (index instanceof String) { - buffer.put(StringUtilities.getAsciiString((String) index)); - } else if (index instanceof Byte) { - buffer.put(((Byte) index).byteValue()); - } else if (index instanceof Short) { - buffer.putShort(((Short) index).shortValue()); - } else if (index instanceof Integer) { - buffer.putInt(((Integer) index).intValue()); - } else if (index instanceof Float) { - buffer.putFloat(((Float) index).floatValue()); - } else if (index instanceof Long) { - buffer.putLong(((Long) index).longValue()); - } else { - throw new IllegalArgumentException(); - } - } - if (useData) buffer.put(data); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/SWGSet.java b/src/resources/z/exp/objects/SWGSet.java deleted file mode 100644 index a960c0f2..00000000 --- a/src/resources/z/exp/objects/SWGSet.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects; - -import java.nio.ByteOrder; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.objects.IDelta; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -/* A SWGSet element should extend Delta or implement IDelta */ - -@Persistent -public class SWGSet implements Set { - - private TreeSet set = new TreeSet(); - @NotPersistent - private int updateCounter = 0; - private BaseObject object; - private byte viewType; - private short updateType; - private boolean addByte; - @NotPersistent - protected final Object objectMutex = new Object(); - - public SWGSet() { } - - public SWGSet(BaseObject object, int viewType, int updateType, boolean addByte) { - this.object = object; - this.viewType = (byte) viewType; - this.updateType = (short) updateType; - this.addByte = addByte; - } - - public SWGSet(Set s) { - if (s instanceof SWGSet) { - this.object = ((SWGSet) s).object; - this.viewType = ((SWGSet) s).viewType; - this.updateType = ((SWGSet) s).updateType; - set.addAll(s); - } - } - - public boolean add(E e) { - synchronized(objectMutex) { - if (valid(e)) { - if (set.add(e)) { - queue(item(1, e, null, true, false)); - return true; - } - } - - return false; - } - } - - public boolean addAll(Collection c) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (E e : c) { - if (valid(e) && set.add(e)) { - buffer.add(item(1, e, null, true, false)); - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } else { - return false; - } - } - } - - public void clear() { - synchronized(objectMutex) { - queue(item(2, null, null, false, false)); - } - } - - public boolean contains(Object o) { - synchronized(objectMutex) { - return set.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized(objectMutex) { - return set.containsAll(c); - } - } - - public boolean isEmpty() { - synchronized(objectMutex) { - return set.isEmpty(); - } - } - - public Iterator iterator() { - synchronized(objectMutex) { - return set.iterator(); - } - } - - public boolean remove(Object e) { - synchronized(objectMutex) { - if (valid(e) && set.remove(e)) { - queue(item(0, e, null, true, false)); - return true; - } - - return false; - } - } - - public boolean removeAll(Collection c) { - synchronized(objectMutex) { - List buffer = new ArrayList(); - - for (Object o : c) { - if (valid(o) && set.remove(o)) { - buffer.add(item(0, o, null, true, false)); - } - } - - if (buffer.size() > 0) { - queue(buffer); - return true; - } else { - return false; - } - } - } - - public boolean retainAll(Collection c) { - synchronized(objectMutex) { - return set.retainAll(c); - } - } - - public int size() { - synchronized(objectMutex) { - return set.size(); - } - } - - public Object[] toArray() { - synchronized(objectMutex) { - return set.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized(objectMutex) { - return set.toArray(a); - } - } - - public int getUpdateCounter() { - synchronized(objectMutex) { - return updateCounter; - } - } - - public Object getMutex() { - return objectMutex; - } - - public byte[] getBytes() { - synchronized(objectMutex) { - byte[] objects = { }; - int size = 0; - - for (Object o : set) { - byte[] object = Baseline.toBytes(o); - size += object.length; - - IoBuffer buffer = Baseline.createBuffer(size); - buffer.put(objects); - if (addByte) buffer.put((byte) 0); - buffer.put(object); - buffer.flip(); - - objects = buffer.array(); - } - - IoBuffer buffer = Baseline.createBuffer(8 + size); - buffer.putInt(set.size()); - buffer.putInt(updateCounter); - buffer.put(objects); - buffer.flip(); - - return buffer.array(); - } - } - - private boolean valid(Object o) { - if (o instanceof String || o instanceof Byte || o instanceof Short || - o instanceof Integer || o instanceof Float || o instanceof Long || - o instanceof IDelta) { - return true; - } else { - return false; - } - } - - private byte[] item(int type, Object index, byte[] data, boolean useIndex, boolean useData) { - if (useIndex && ((index instanceof IDelta) || !valid(index))) { - throw new IllegalArgumentException(); - } - - int size = 1 + ((useIndex) ? (2 + Baseline.toBytes(index).length) : 0) + ((useData) ? data.length : 0); - - IoBuffer buffer = IoBuffer.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); - buffer.put((byte) type); - if (useIndex) buffer.put(Baseline.toBytes(index)); - if (useData) buffer.put(data); - buffer.flip(); - - updateCounter++; - - return buffer.array(); - } - - private void queue(byte[] data) { - IoBuffer buffer = IoBuffer.allocate((data.length + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(1); - buffer.putInt(updateCounter); - buffer.put(data); - buffer.flip(); - object.sendListDelta(viewType, updateType, buffer); - } - - private void queue(List data) { - int size = 0; - - for (byte[] queued : data) { - size += queued.length; - } - - IoBuffer buffer = IoBuffer.allocate((size + 8), false).order(ByteOrder.LITTLE_ENDIAN); - buffer.putInt(data.size()); - buffer.putInt(updateCounter); - for (byte[] queued : data) buffer.put(queued); - buffer.flip(); - - object.sendListDelta(viewType, updateType, buffer); - } - -} diff --git a/src/resources/z/exp/objects/building/BuildingMessageBuilder.java b/src/resources/z/exp/objects/building/BuildingMessageBuilder.java deleted file mode 100644 index b6905d33..00000000 --- a/src/resources/z/exp/objects/building/BuildingMessageBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.building; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.tangible.TangibleMessageBuilder; - -public class BuildingMessageBuilder extends TangibleMessageBuilder { - - public BuildingMessageBuilder(BuildingObject object) { - super(object); - } - - public BuildingMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(deltaBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(deltaBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/building/BuildingObject.java b/src/resources/z/exp/objects/building/BuildingObject.java deleted file mode 100644 index 578c0dd7..00000000 --- a/src/resources/z/exp/objects/building/BuildingObject.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.building; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.tangible.TangibleObject; - -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Entity -public class BuildingObject extends TangibleObject { - - @NotPersistent - private BuildingMessageBuilder messageBuilder; - - public BuildingObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - setVolume(255); - setOptionsBitmask(256); - setMaximumCondition(4320); - toggleStatic(); - } - - public BuildingObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public BuildingMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new BuildingMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/cell/CellMessageBuilder.java b/src/resources/z/exp/objects/cell/CellMessageBuilder.java deleted file mode 100644 index 92e25457..00000000 --- a/src/resources/z/exp/objects/cell/CellMessageBuilder.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.cell; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -public class CellMessageBuilder extends ObjectMessageBuilder { - - public CellMessageBuilder(CellObject object) { - super(object); - } - - public CellMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/cell/CellObject.java b/src/resources/z/exp/objects/cell/CellObject.java deleted file mode 100644 index 059c8d3d..00000000 --- a/src/resources/z/exp/objects/cell/CellObject.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.cell; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class CellObject extends BaseObject { - - @NotPersistent - CellMessageBuilder messageBuilder; - - public CellObject(long objectID, Planet planet, int cellNumber) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff"); - setCellNumber(cellNumber); - } - - public CellObject(long objectID, Planet planet) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/cell/shared_cell.iff"); - } - - public CellObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("4", (byte) 1); // Unknown - baseline.put("cellNumber", 0); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("2", (long) 0); // Unknown - baseline.put("3", (long) 0); // Unknown - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getCellNumber() { - return (int) baseline3.get("cellNumber"); - } - - public void setCellNumber(int cellNumber) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("cellNumber", cellNumber); - } - - getContainer().notifyObservers(buffer, false); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - getContainer().notifyObservers(buffer, false); - } - - @Override - public CellMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new CellMessageBuilder(); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/creature/CreatureMessageBuilder.java b/src/resources/z/exp/objects/creature/CreatureMessageBuilder.java deleted file mode 100644 index d76e8383..00000000 --- a/src/resources/z/exp/objects/creature/CreatureMessageBuilder.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.creature; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.tangible.TangibleMessageBuilder; - -@Persistent -public class CreatureMessageBuilder extends TangibleMessageBuilder { - - public CreatureMessageBuilder(CreatureObject creatureObject) { - super(creatureObject); - } - - public CreatureMessageBuilder() { - super(); - } - - @Override - public void buildBaseline1(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline1(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline4(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline4(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/creature/CreatureObject.java b/src/resources/z/exp/objects/creature/CreatureObject.java deleted file mode 100644 index 511875ea..00000000 --- a/src/resources/z/exp/objects/creature/CreatureObject.java +++ /dev/null @@ -1,1086 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.creature; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map.Entry; - -import org.apache.mina.core.buffer.IoBuffer; - -import protocol.swg.ChatSystemMessage; -import protocol.swg.ObjControllerMessage; -import protocol.swg.UpdatePVPStatusMessage; -import protocol.swg.UpdatePostureMessage; -import protocol.swg.objectControllerObjects.Posture; - -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - -import engine.clients.Client; -import resources.z.exp.buffs.Buff; -import resources.common.StringUtilities; -import resources.z.exp.equipment.Equipment; -import resources.z.exp.group.GroupInviteInfo; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMap; -import resources.z.exp.objects.SWGSet; -import engine.resources.common.CRC; -import engine.resources.objects.IPersistent; -import engine.resources.objects.SWGObject; -import resources.z.exp.skills.SkillMod; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -import resources.z.exp.objects.player.PlayerObject; -import resources.z.exp.objects.tangible.TangibleObject; - -@Entity -public class CreatureObject extends TangibleObject implements IPersistent { - - @NotPersistent - private Transaction txn; - - @NotPersistent - private CreatureMessageBuilder messageBuilder; - - // non-baseline vars - @NotPersistent - private List duelList = Collections.synchronizedList(new ArrayList()); - - public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - getBaseHAMList().add(0x00002FF8); - getBaseHAMList().add(0x000003E8); - getBaseHAMList().add(0x0000245F); - getBaseHAMList().add(0x000001F4); - getBaseHAMList().add(0x0000012C); - getBaseHAMList().add(0x000003E8); - setVolume(0x000F4240); - getComponentCustomizationList().add(0); - setOptionsBitmask(0x80); - setMaximumCondition(0x3A98); - getHamList().add(20000); - getHamList().add(0); - getHamList().add(12500); - getHamList().add(0); - getHamList().add(0x2C01); - getHamList().add(0); - getMaxHamList().add(20000); - getMaxHamList().add(0); - getMaxHamList().add(12500); - getMaxHamList().add(0); - getMaxHamList().add(0x2C01); - getMaxHamList().add(0); - getBuffList().put(0, new Buff("", 0)); // Initial Default Buff - } - - public CreatureObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(1); - initializeBaseline(4); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline1() { - Baseline baseline = super.getBaseline1(); - baseline.put("bankCredits", 0); - baseline.put("cashCredits", 0); - baseline.put("baseHamList", new SWGList(this, 1, 2, false)); - baseline.put("skills", new SWGSet(this, 1, 3, false)); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("posture", (byte) 1); - baseline.put("factionRank", (byte) 0); // For NPCs probably - baseline.put("ownerId", (long) 0); - baseline.put("height", (float) 1); - baseline.put("battleFatigue", 0); - baseline.put("stateBitmask", (long) 0); - return baseline; - } - - @Override - public Baseline getBaseline4() { - Baseline baseline = super.getBaseline4(); - baseline.put("accelerationMultiplierBase", (float) 1); - baseline.put("accelerationMultiplierMod", (float) 1); - baseline.put("hamEncumberanceList", new SWGList(this, 4, 2, false)); - baseline.put("skillMods", new SWGMap(this, 4, 3, true)); - baseline.put("speedMultiplierBase", (float) 1); - baseline.put("speedMultiplierMod", (float) 1); - baseline.put("listenToId", (long) 0); - baseline.put("runSpeed", (float) 7.3); - baseline.put("slopeModAngle", (float) 1); - baseline.put("slopeModPercent", (float) 1); - baseline.put("turnRadius", (float) 1); - baseline.put("walkSpeed", (float) 2.75); - baseline.put("waterModPercent", (float) 1); - baseline.put("missionCriticalObjects", new SWGMap(this, 4, 13, false)); - baseline.put("abilities", new SWGMap(this, 4, 14, true)); - baseline.put("15", (byte) 0); // Unknown (been seen as 0xD4) - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("level", (short) 90); - baseline.put("9", (int) 0xD007); - baseline.put("currentAnimation", ""); - baseline.put("moodAnimation", "neutral"); - baseline.put("weaponId", (long) 0); - baseline.put("groupId", (long) 0); - baseline.put("groupInviteInfo", new GroupInviteInfo((long) 0, "")); - baseline.put("guildId", 0); - baseline.put("targetId", (long) 0); - baseline.put("moodId", (byte) 0); - baseline.put("performanceCounter", 0); - baseline.put("performanceId", 0); - baseline.put("20", new SWGList(this, 6, 20, false)); // Unknown List - baseline.put("hamList", new SWGList(this, 6, 21, false)); - baseline.put("maxHamList", new SWGList(this, 6, 22, false)); - baseline.put("equipmentList", new SWGList(this, 6, 23, false)); - baseline.put("costume", ""); - baseline.put("lockMovement", false); - baseline.put("buffList", new SWGMap(this, 6, 26, false)); - // need to build an 0x01 int after the bufflist - baseline.put("27", (short) 0); - baseline.put("hologramColor", -1); - baseline.put("29", (byte) 1); - baseline.put("30", (short) 0); - baseline.put("appearanceEquipmentList", new SWGList(this, 6, 31, false)); - baseline.put("32", 0); - baseline.put("33", (short) 0); - baseline.put("34", (short) 0); // there's 35 elements, so 2 of these = shorts - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getBankCredits() { - synchronized(objectMutex) { - return (int) baseline1.get("bankCredits"); - } - } - - public void setBankCredits(int bankCredits) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline1.set("bankCredits", bankCredits); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public int getCashCredits() { - synchronized(objectMutex) { - return (int) baseline1.get("cashCredits"); - } - } - - public void setCashCredits(int cashCredits) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline1.set("cashCredits", cashCredits); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGList getBaseHAMList() { - return (SWGList) baseline1.get("baseHamList"); - } - - @SuppressWarnings("unchecked") - public SWGSet getSkills() { - return (SWGSet) baseline3.get("skills"); - } - - public void addSkill(String skill) { - if (!getSkills().contains(skill)) { - getSkills().add(skill); - } - } - - public void removeSkill(String skill) { - if (getSkills().contains(skill)) { - getSkills().remove(skill); - } - } - - public byte getPosture() { - synchronized(objectMutex) { - return (byte) baseline3.get("posture"); - } - } - - public void setPosture(byte posture) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("posture", posture); - } - - notifyObservers(buffer, true); - notifyObservers(new ObjControllerMessage(0x1B, new Posture(getObjectID(), posture)), true); - } - - public byte getFactionRank() { - synchronized(objectMutex) { - return (byte) baseline3.get("factionRank"); - } - } - - public void setFactionRank(byte factionRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("factionRank", factionRank); - } - - notifyObservers(buffer, true); - } - - public long getOwnerId() { - synchronized(objectMutex) { - return (long) baseline3.get("ownerId"); - } - } - - public void setOwnerId(long ownerId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("ownerId", ownerId); - } - - notifyObservers(buffer, true); - } - - public float getHeight() { - synchronized(objectMutex) { - return (float) baseline3.get("height"); - } - } - - public void setHeight(float height) { - height = (((height < 0.7) || (height > 1.5)) ? 1 : height); - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("height", height); - } - - notifyObservers(buffer, true); - } - - public int getBattleFatigue() { - synchronized(objectMutex) { - return (int) baseline3.get("battleFatigue"); - } - } - - public void setBattleFatigue(int battleFatigue) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("battleFatigue", battleFatigue); - } - - notifyObservers(buffer, true); - } - - public long getStateBitmask() { - synchronized(objectMutex) { - return (long) baseline3.get("stateBitmask"); - } - } - - public void setStateBitmask(long stateBitmask) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("stateBitmask", stateBitmask); - } - - notifyObservers(buffer, true); - } - - public float getAccelerationMultiplierBase() { - synchronized(objectMutex) { - return (float) baseline4.get("accelerationMultiplierBase"); - } - } - - public void setAccelerationMultiplierBase(float accelerationMultiplierBase) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("accelerationMultiplierBase", accelerationMultiplierBase); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getAccelerationMultiplierMod() { - synchronized(objectMutex) { - return (float) baseline4.get("accelerationMultiplierMod"); - } - } - - public void setAccelerationMultiplierMod(float accelerationMultiplierMod) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("accelerationMultiplierMod", accelerationMultiplierMod); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGList getHamEncumberanceList() { - return (SWGList) baseline4.get("hamEncumberanceList"); - } - - @SuppressWarnings("unchecked") - public SWGMap getSkillMods() { - return (SWGMap) baseline4.get("skillMods"); - } - - public SkillMod getSkillMod(String name) { - synchronized(objectMutex) { - if (getSkillMods().containsKey(name) && getSkillMods().get(name) != null) { - return getSkillMods().get(name); - } - - return null; - } - } - - public void addSkillMod(String name, int base) { - if (!getSkillMods().containsKey(name)) { - getSkillMods().put(name, new SkillMod(base, 0)); - } else { - SkillMod mod = getSkillMods().get(name); - getSkillMods().put(name, new SkillMod(mod.getBase() + base, mod.getModifier())); - } - } - - public void deductSkillMod(String name, int base) { - if (getSkillMods().containsKey(name)) { - SkillMod mod = getSkillMods().get(name); - mod = new SkillMod(mod.getBase() - base, mod.getModifier()); - - if (mod.getBase() - base <= 0) { - removeSkillMod(name); - } else { - getSkillMods().put(name, mod); - } - } - } - - public void removeSkillMod(String name) { - getSkillMods().remove(name); - } - - public float getSpeedMultiplierBase() { - synchronized(objectMutex) { - return (float) baseline4.get("speedMultiplierBase"); - } - } - - public void setSpeedMultiplierBase(float speedMultiplierBase) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("speedMultiplierBase", speedMultiplierBase); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getSpeedMultiplierMod() { - synchronized(objectMutex) { - return (float) baseline4.get("speedMultiplierMod"); - } - } - - public void setSpeedMultiplierMod(float speedMultiplierMod) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("speedMultiplierMod", speedMultiplierMod); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public long getListenToId() { - synchronized(objectMutex) { - return (long) baseline4.get("listenToId"); - } - } - - public void setListenToId(long listenToId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("listenToId", listenToId); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getRunSpeed() { - synchronized(objectMutex) { - return (float) baseline4.get("runSpeed"); - } - } - - public void setRunSpeed(float runSpeed) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("runSpeed", runSpeed); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getSlopeModAngle() { - synchronized(objectMutex) { - return (float) baseline4.get("slopeModAngle"); - } - } - - public void setSlopeModAngle(float slopeModAngle) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("slopeModAngle", slopeModAngle); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getSlopeModPercent() { - synchronized(objectMutex) { - return (float) baseline4.get("slopeModPercent"); - } - } - - public void setSlopeModPercent(float slopeModPercent) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("slopeModPercent", slopeModPercent); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getTurnRadius() { - synchronized(objectMutex) { - return (float) baseline4.get("turnRadius"); - } - } - - public void setTurnRadius(float turnRadius) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("turnRadius", turnRadius); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getWalkSpeed() { - synchronized(objectMutex) { - return (float) baseline4.get("walkSpeed"); - } - } - - public void setWalkSpeed(float walkSpeed) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("walkSpeed", walkSpeed); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public float getWaterModPercent() { - synchronized(objectMutex) { - return (float) baseline4.get("waterModPercent"); - } - } - - public void setWaterModPercent(float waterModPercent) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline4.set("waterModPercent", waterModPercent); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGMap getMissionCriticalObjects() { - return (SWGMap) baseline4.get("missionCriticalObjects"); - } - - @SuppressWarnings("unchecked") - public SWGMap getAbilities() { - return (SWGMap) baseline4.get("abilities"); - } - - public void addAbility(String abilityName) { - if (!getAbilities().containsKey(abilityName)) { - getAbilities().put(abilityName, 1); - } - } - - public void removeAbility(String abilityName) { - if (getAbilities().containsKey(abilityName)) { - getAbilities().remove(abilityName); - } - } - - public short getLevel() { - synchronized(objectMutex) { - return (short) baseline6.get("level"); - } - } - - public void setLevel(short level) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("level", level); - } - - notifyObservers(buffer, true); - } - - public String getCurrentAnimation() { - synchronized(objectMutex) { - return (String) baseline6.get("currentAnimation"); - } - } - - public void setCurrentAnimation(String currentAnimation) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("currentAnimation", currentAnimation); - } - - notifyObservers(buffer, true); - } - - public String getMoodAnimation() { - synchronized(objectMutex) { - return (String) baseline6.get("moodAnimation"); - } - } - - public void setMoodAnimation(String moodAnimation) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("moodAnimation", moodAnimation); - } - - notifyObservers(buffer, true); - } - - public long getWeaponId() { - synchronized(objectMutex) { - return (long) baseline6.get("weaponId"); - } - } - - public void setWeaponId(long weaponId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("weaponId", weaponId); - } - - notifyObservers(buffer, true); - } - - public long getGroupId() { - synchronized(objectMutex) { - return (long) baseline6.get("groupId"); - } - } - - public void setGroupId(long groupId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupId", groupId); - } - - notifyObservers(buffer, true); - } - - public GroupInviteInfo getGroupInviteInfo() { - return (GroupInviteInfo) baseline6.get("groupInviteInfo"); - } - - public long getInviteSenderId() { - synchronized(objectMutex) { - return getGroupInviteInfo().getSenderId(); - } - } - - public void setInviteSenderId(long inviteSenderId) { - synchronized(objectMutex) { - getGroupInviteInfo().setSender(inviteSenderId, getInviteSenderName()); - } - } - - public String getInviteSenderName() { - synchronized(objectMutex) { - return getGroupInviteInfo().getSenderName(); - } - } - - public void setInviteSenderName(String inviteSenderName) { - synchronized(objectMutex) { - getGroupInviteInfo().setSender(getInviteSenderId(), inviteSenderName); - } - } - - public long getInviteCounter() { - return 0; - } - - public void setInviteCounter(long inviteCounter) { - - } - - public void updateGroupInviteInfo() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupInviteInfo", getGroupInviteInfo()); - } - - if (getClient() != null && getClient().getSession() != null) { - getClient().getSession().write(buffer); - } - } - - public int getGuildId() { - synchronized(objectMutex) { - return (int) baseline6.get("guildId"); - } - } - - public void setGuildId(int guildId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("guildId", guildId); - } - - notifyObservers(buffer, true); - } - - public long getTargetId() { - synchronized(objectMutex) { - return (long) baseline6.get("targetId"); - } - } - - public void setTargetId(long targetId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("targetId", targetId); - } - - notifyObservers(buffer, true); - } - - public byte getMoodId() { - synchronized(objectMutex) { - return (byte) baseline6.get("moodId"); - } - } - - public void setMoodId(byte moodId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("moodId", moodId); - } - - notifyObservers(buffer, true); - } - - public int getPerformanceCounter() { - synchronized(objectMutex) { - return (int) baseline6.get("performanceCounter"); - } - } - - public void setPerformanceCounter(int performanceCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("performanceCounter", performanceCounter); - } - - notifyObservers(buffer, true); - } - - public int getPerformanceId() { - synchronized(objectMutex) { - return (int) baseline6.get("performanceId"); - } - } - - public void setPerformanceId(int performanceId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("performanceId", performanceId); - } - - notifyObservers(buffer, true); - } - - @SuppressWarnings("unchecked") - public SWGList getHamList() { - return (SWGList) baseline6.get("hamList"); - } - - public int getHealth() { - synchronized(objectMutex) { - return getHamList().get(0); - } - } - - public void setHealth(int health) { - if (health > getMaxHealth()) { - health = getMaxHealth(); - } - - synchronized(objectMutex) { - getHamList().set(0, health); - } - } - - public int getAction() { - synchronized(objectMutex) { - return getHamList().get(2); - } - } - - public void setAction(int action) { - if (action > getMaxAction()) { - action = getMaxAction(); - } - - synchronized(objectMutex) { - getHamList().set(2, action); - } - } - - @SuppressWarnings("unchecked") - public SWGList getMaxHamList() { - return (SWGList) baseline6.get("maxHamList"); - } - - public int getMaxHealth() { - synchronized(objectMutex) { - return getMaxHamList().get(0); - } - } - - public void setMaxHealth(int maxHealth) { - synchronized(objectMutex) { - getMaxHamList().set(0, maxHealth); - } - } - - public int getMaxAction() { - synchronized(objectMutex) { - return getMaxHamList().get(2); - } - } - - public void setMaxAction(int maxAction) { - synchronized(objectMutex) { - getMaxHamList().set(2, maxAction); - } - } - - @SuppressWarnings("unchecked") - public SWGList getEquipmentList() { - return (SWGList) baseline6.get("equipmentList"); - } - - public void equipObject(SWGObject object) { - if (object instanceof TangibleObject) { - getEquipmentList().add(new Equipment(object)); - } - } - - public void unequipObject(SWGObject object) { - if (object instanceof TangibleObject) { - for (Equipment equipment : getEquipmentList()) { - if (equipment.getObjectId() == object.getObjectId()) { - getEquipmentList().remove(equipment); - } - } - } - } - - @SuppressWarnings("unchecked") - public SWGMap getBuffList() { - return (SWGMap) baseline6.get("buffList"); - } - - public void addBuff(Buff buff) { - synchronized(objectMutex) { - PlayerObject player = (PlayerObject) this.getSlottedObject("ghost"); - buff.setTotalPlayTime((int) (player.getTotalPlayTime() + (System.currentTimeMillis() - player.getLastPlayTimeUpdate()) / 1000)); - } - - getBuffList().put(CRC.StringtoCRC(buff.getBuffName()), buff); - - synchronized(objectMutex) { - buff.setStartTime(); - } - } - - public void removeBuff(Buff buff) { - getBuffList().remove(CRC.StringtoCRC(buff.getBuffName())); - } - - public Buff getBuffByName(String buffName) { - for (Entry entry : getBuffList().entrySet()) { - if (entry.getKey().equals(CRC.StringtoCRC(buffName))) { - return entry.getValue(); - } - } - - return null; - } - - @SuppressWarnings("unchecked") - public SWGList getAppearanceEquipmentList() { - return (SWGList) baseline6.get("appearanceEquipmentList"); - } - - public void equipAppearance(SWGObject object) { - if (object instanceof TangibleObject) { - getAppearanceEquipmentList().add(new Equipment(object)); - } - } - - public void unequipAppearance(SWGObject object) { - if (object instanceof TangibleObject) { - for (Equipment equipment : getAppearanceEquipmentList()) { - if (equipment.getObjectId() == object.getObjectId()) { - getAppearanceEquipmentList().remove(equipment); - } - } - } - } - - public List getDuelList() { - return duelList; - } - - public boolean isInDuelList(long objectId) { - if (duelList.contains(objectId)) { - return true; - } - - return false; - } - - public boolean isInDuelList(SWGObject object) { - return isInDuelList(object.getObjectId()); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public CreatureMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new CreatureMessageBuilder(this); - } - - return messageBuilder; - } - } - - @SuppressWarnings("unused") - @Override - public void sendBaselines(Client destination) { - if (destination == null || destination.getSession() == null) { - System.out.println("NULL session"); - return; - } - - System.out.println(StringUtilities.bytesToHex(baseline3.getBaseline().array())); - destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - if (destination == getClient()) { - //destination.getSession().write(baseline1.getBaseline()); - //destination.getSession().write(baseline4.getBaseline()); - } - //destination.getSession().write(baseline8().getBaseline()); - //destination.getSession().write(baseline9().getBaseline()); - - UpdatePostureMessage upm = new UpdatePostureMessage(getObjectID(), (byte) 0); - //destination.getSession().write(upm.serialize()); - - if (destination != getClient()) { - UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID()); - - int factionStatus = getFactionStatus(); - String faction = getFaction(); - - if (factionStatus == 1 && faction == "imperial") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); - upvpm.setStatus(16); - } - - if (factionStatus == 1 && faction == "rebel") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); - upvpm.setStatus(16); - } - - if (factionStatus == 2 && faction == "imperial") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial); - upvpm.setStatus(55); - } - - if (factionStatus == 2 && faction == "rebel") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel); - upvpm.setStatus(55); - } - - if (factionStatus == 0 && faction == "neutral") { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); - upvpm.setStatus(16); - } else { - upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral); - upvpm.setStatus(16); - } - - destination.getSession().write(upvpm.serialize()); - } - } - - public void sendSystemMessage(String message, byte displayType) { - if (getClient() != null && getClient().getSession() != null) { - ChatSystemMessage systemMsg = new ChatSystemMessage(message, displayType); - getClient().getSession().write(systemMsg.serialize()); - } - } - - public Transaction getTransaction() { - return txn; - } - - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); - } - -} diff --git a/src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java b/src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java deleted file mode 100644 index a3558047..00000000 --- a/src/resources/z/exp/objects/factorycrate/FactoryCrateMessageBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.factorycrate; - -public class FactoryCrateMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java b/src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java deleted file mode 100644 index e69c6c15..00000000 --- a/src/resources/z/exp/objects/factorycrate/FactoryCrateObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.factorycrate; - -public class FactoryCrateObject { - -} diff --git a/src/resources/z/exp/objects/group/GroupMessageBuilder.java b/src/resources/z/exp/objects/group/GroupMessageBuilder.java deleted file mode 100644 index 807b0a2a..00000000 --- a/src/resources/z/exp/objects/group/GroupMessageBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.group; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.universe.UniverseMessageBuilder; - -public class GroupMessageBuilder extends UniverseMessageBuilder { - - public GroupMessageBuilder(GroupObject groupObject) { - super(groupObject); - } - - public GroupMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/group/GroupObject.java b/src/resources/z/exp/objects/group/GroupObject.java deleted file mode 100644 index 30ddc659..00000000 --- a/src/resources/z/exp/objects/group/GroupObject.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.group; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.NotPersistent; - -import resources.z.exp.group.Member; -import resources.z.exp.group.MemberInfo; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.creature.CreatureObject; -import resources.z.exp.objects.universe.UniverseObject; - -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -public class GroupObject extends UniverseObject { - - @NotPersistent - private GroupMessageBuilder messageBuilder; - - public GroupObject(long objectId) { - super(objectId, null, new Point3D(0, 0, 0), new Quaternion(0, 0, 0, 1), "object/group/shared_group_object.iff"); - } - - public GroupObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("memberList", new SWGList(this, 6, 2, false)); - baseline.put("memberInfoList", new SWGList(this, 6, 3, false)); - baseline.put("4", ""); - baseline.put("groupLevel", (short) 0); - baseline.put("6", 0); - baseline.put("groupLeader", null); - baseline.put("lootMaster", null); - baseline.put("lootMode", 0); - return baseline; - } - - @SuppressWarnings("unchecked") - public SWGList getMemberList() { - return (SWGList) baseline6.get("memberList"); - } - - @SuppressWarnings("unchecked") - public SWGList getMemberInfoList() { - return (SWGList) baseline6.get("memberInfoList"); - } - - public void addMember(SWGObject member) { - if (member instanceof CreatureObject && member.getClient() != null) { - SWGList memberList = getMemberList(); - SWGList memberInfoList = getMemberInfoList(); - - if (memberList.size() >= 8) { - ((CreatureObject) member).sendSystemMessage("@group:join_full", (byte) 0); - } else { - Member newMember = new Member(member); - - if (memberList.add(newMember)) { - memberInfoList.add(new MemberInfo(memberList.indexOf(newMember), 0)); - - if (((CreatureObject) member).getLevel() > getGroupLevel()) { - setGroupLevel(((CreatureObject) member).getLevel()); - } - } - } - } - } - - public void removeMember(SWGObject member) { - if (member instanceof CreatureObject && member.getClient() != null) { - SWGList memberList = getMemberList(); - SWGList memberInfoList = getMemberInfoList(); - - if (!(memberList.size() <= 0)) { - int index = memberList.indexOf(member); - - if (memberList.remove(member)) { - memberInfoList.remove(index); - - synchronized(objectMutex) { - for (int i = 0; i < memberInfoList.size(); i++) { - if (memberInfoList.get(i).getMemberId() != i) { - memberInfoList.set(i, memberInfoList.get(i).setMemberId(i)); - } - } - } - } - - short maxLevel = 0; - - for (Member memberObject : getMemberList()) { - if (memberObject.getMember() instanceof CreatureObject) { - CreatureObject creature = (CreatureObject) memberObject.getMember(); - - if (creature.getLevel() > maxLevel) { - maxLevel = creature.getLevel(); - } - } - } - - if (maxLevel != getGroupLevel()) { - setGroupLevel(maxLevel); - } - } - } - } - - public boolean setMemberInfo(SWGObject object, long info) { - if (object instanceof CreatureObject && object.getClient() != null) { - for (Member member : getMemberList()) { - if (member.getMember().equals(member)) { - int id = getMemberList().indexOf(member); - getMemberInfoList().set(id, new MemberInfo(info, id)); - return true; - } - } - } - - return false; - } - - public short getGroupLevel() { - synchronized(objectMutex) { - return (short) baseline6.get("groupLevel"); - } - } - - public void setGroupLevel(short groupLevel) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupLevel", groupLevel); - } - - notifyObservers(buffer, false); - } - - public SWGObject getGroupLeader() { - synchronized(objectMutex) { - return (SWGObject) baseline6.get("groupLeader"); - } - } - - public void setGroupLeader(SWGObject groupLeader) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("groupLeader", groupLeader); - } - - notifyObservers(buffer, false); - } - - public SWGObject getLootMaster() { - synchronized(objectMutex) { - return (SWGObject) baseline6.get("lootMaster"); - } - } - - public void setLootMaster(SWGObject lootMaster) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("lootMaster", lootMaster); - } - - notifyObservers(buffer, false); - } - - public int getLootMode() { - synchronized(objectMutex) { - return (int) baseline6.get("lootMode"); - } - } - - public void setLootMode(int lootMode) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("lootMode", lootMode); - } - - notifyObservers(buffer, false); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public GroupMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new GroupMessageBuilder(); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/guild/GuildMessageBuilder.java b/src/resources/z/exp/objects/guild/GuildMessageBuilder.java deleted file mode 100644 index 21d64947..00000000 --- a/src/resources/z/exp/objects/guild/GuildMessageBuilder.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.guild; - -import java.util.Map; -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.universe.UniverseMessageBuilder; - -public class GuildMessageBuilder extends UniverseMessageBuilder { - - public GuildMessageBuilder(GuildObject guildObject) { - super(guildObject); - } - - public GuildMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/guild/GuildObject.java b/src/resources/z/exp/objects/guild/GuildObject.java deleted file mode 100644 index 7df685e4..00000000 --- a/src/resources/z/exp/objects/guild/GuildObject.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.guild; - -import java.util.Map; -import java.util.TreeMap; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.gcw.CurrentServerGCWZoneHistory; -import resources.gcw.CurrentServerGCWZonePercent; -import resources.gcw.OtherServerGCWZonePercent; -import resources.z.exp.guild.Guild; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMap; -import resources.z.exp.objects.SWGMultiMap; -import resources.z.exp.objects.universe.UniverseObject; - -import com.sleepycat.je.Environment; -import com.sleepycat.je.Transaction; -import com.sleepycat.persist.model.Entity; -import com.sleepycat.persist.model.NotPersistent; - -import engine.clients.Client; -import engine.resources.objects.IPersistent; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Entity -public class GuildObject extends UniverseObject implements IPersistent { - - @NotPersistent - private GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this); - - private Map> zoneMap = new TreeMap>(); - - @NotPersistent - private Transaction txn; - - public GuildObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public GuildObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("nextUpdateTime", 1321383613); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("guildList", new SWGList(this, 3, 4, false)); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("currentServerGCWZonePercentMap", new SWGMap(this, 6, 2, true)); - baseline.put("currentServerGCWTotalPercentMap", new SWGMap(this, 6, 3, true)); - baseline.put("currentServerGCWZoneHistoryMap", new SWGMultiMap(this, 6, 4, true)); - baseline.put("currentServerGCWTotalHistoryMap", new SWGMultiMap(this, 6, 5, true)); - baseline.put("otherServerGCWZonePercentMap", new SWGMultiMap(this, 6, 6, true)); - baseline.put("otherServerGCWTotalPercentMap", new SWGMultiMap(this, 6, 7, true)); - baseline.put("8", 5); - return baseline; - } - - @SuppressWarnings("unchecked") - public SWGList getGuildList() { - return (SWGList) baseline3.get("guildList"); - } - - @SuppressWarnings("unchecked") - public SWGMap getCurrentServerGCWZonePercentMap() { - return (SWGMap) baseline6.get("currentServerGCWZonePercentMap"); - } - - @SuppressWarnings("unchecked") - public SWGMap getCurrentServerGCWTotalPercentMap() { - return (SWGMap) baseline6.get("currentServerGCWTotalPercentMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getCurrentServerGCWZoneHistoryMap() { - return (SWGMultiMap) baseline6.get("currentServerGCWZoneHistoryMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getCurrentServerGCWTotalHistoryMap() { - return (SWGMultiMap) baseline6.get("currentServerGCWTotalHistoryMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getOtherServerGCWZonePercentMap() { - return (SWGMultiMap) baseline6.get("otherServerGCWZonePercentMap"); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getOtherServerGCWTotalPercentMap() { - return (SWGMultiMap) baseline6.get("otherServerGCWTotalPercentMap"); - } - - public Map> getZoneMap() { - synchronized(objectMutex) { - return zoneMap; - } - } - - public int getNextUpdateTime() { - synchronized(objectMutex) { - return (int) otherVariables.get("nextUpdateTime"); - } - } - - public int setNextUpdateTime(long nextUpdateTime) { - synchronized(objectMutex) { - otherVariables.set("nextUpdateTime", (int) nextUpdateTime); - return getNextUpdateTime(); - } - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public GuildMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new GuildMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - notifyClients(baseline6.createDelta(updateType, buffer.array()), false); - } - - public Transaction getTransaction() { - return txn; - } - - public void createTransaction(Environment env) { - txn = env.beginTransaction(null, null); - } - -} diff --git a/src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java b/src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java deleted file mode 100644 index 06f08e30..00000000 --- a/src/resources/z/exp/objects/harvester/HarvesterMessageBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.harvester; - -public class HarvesterMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/harvester/HarvesterObject.java b/src/resources/z/exp/objects/harvester/HarvesterObject.java deleted file mode 100644 index a09905cb..00000000 --- a/src/resources/z/exp/objects/harvester/HarvesterObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.harvester; - -public class HarvesterObject { - -} diff --git a/src/resources/z/exp/objects/installation/InstallationMessageBuilder.java b/src/resources/z/exp/objects/installation/InstallationMessageBuilder.java deleted file mode 100644 index 054ba875..00000000 --- a/src/resources/z/exp/objects/installation/InstallationMessageBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.installation; - -public class InstallationMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/installation/InstallationObject.java b/src/resources/z/exp/objects/installation/InstallationObject.java deleted file mode 100644 index e57c0460..00000000 --- a/src/resources/z/exp/objects/installation/InstallationObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.installation; - -public class InstallationObject { - -} diff --git a/src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java b/src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java deleted file mode 100644 index b069678a..00000000 --- a/src/resources/z/exp/objects/intangible/IntangibleMessageBuilder.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.intangible; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -@Persistent -public class IntangibleMessageBuilder extends ObjectMessageBuilder { - - public IntangibleMessageBuilder(IntangibleObject object) { - super(object); - } - - public IntangibleMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/intangible/IntangibleObject.java b/src/resources/z/exp/objects/intangible/IntangibleObject.java deleted file mode 100644 index d02b9ccf..00000000 --- a/src/resources/z/exp/objects/intangible/IntangibleObject.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.intangible; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class IntangibleObject extends BaseObject { - - @NotPersistent - private IntangibleMessageBuilder messageBuilder; - - public IntangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public IntangibleObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("genericInt", 0); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getGenericInt() { - synchronized(objectMutex) { - return (int) baseline3.get("genericInt"); - } - } - - public void setGenericInt(int genericInt) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("genericInt", genericInt); - } - - notifyClients(buffer, true); - } - - public void incrementGenericInt(int increase) { - setGenericInt((getGenericInt() + increase)); - } - - public void decrementGenericInt(int decrease) { - setGenericInt((((getGenericInt() - decrease) < 1) ? 0 : (getGenericInt() - decrease))); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public IntangibleMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new IntangibleMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java b/src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java deleted file mode 100644 index 97d20d8e..00000000 --- a/src/resources/z/exp/objects/manufacture/ManufactureSchematicMessageBuilder.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.manufacture; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.intangible.IntangibleMessageBuilder; - -public class ManufactureSchematicMessageBuilder extends IntangibleMessageBuilder { - - public ManufactureSchematicMessageBuilder(ManufactureSchematicObject object) { - super(object); - } - - public ManufactureSchematicMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline7(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline7(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java b/src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java deleted file mode 100644 index 88e49380..00000000 --- a/src/resources/z/exp/objects/manufacture/ManufactureSchematicObject.java +++ /dev/null @@ -1,603 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.manufacture; - -import java.util.ArrayList; -import java.util.Collection; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; -import resources.z.exp.manufacture.Property; -import resources.z.exp.manufacture.SubList; -import resources.z.exp.manufacture.TableAndKey; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMultiMap; -import resources.z.exp.objects.intangible.IntangibleObject; - -@Persistent -public class ManufactureSchematicObject extends IntangibleObject { - - @NotPersistent - private ManufactureSchematicMessageBuilder messageBuilder; - - public ManufactureSchematicObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - initializeBaseline(7); - } - - public ManufactureSchematicObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("totalSlots", (byte) 0); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("properties", new SWGMultiMap(this, 3, 5, true)); - baseline.put("schematicComplexity", 0); - baseline.put("schematicDataSize", (float) 1); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("schematicCustomization", new byte[] { }); - baseline.put("customizationTemplate", ""); - baseline.put("schematicPrototype", ""); - baseline.put("inUse", false); - baseline.put("filledSlots", (byte) 0); - return baseline; - } - - @Override - public Baseline getBaseline7() { - Baseline baseline = super.getBaseline7(); - baseline.put("slotNameList", new SWGList(this, 7, 0, false)); - baseline.put("slotContentsList", new SWGList(this, 7, 1, false)); - baseline.put("ingredientList", new SWGList>(this, 7, 2, false)); - baseline.put("quantityList", new SWGList>(this, 7, 3, false)); - baseline.put("qualityList", new SWGList(this, 7, 4, false)); - baseline.put("cleanSlotList", new SWGList(this, 7, 5, false)); - baseline.put("slotIndexList", new SWGList(this, 7, 6, false)); - baseline.put("ingredientsCounter", (byte) 0); - baseline.put("experimentationNameList", new SWGList(this, 7, 8, false)); - baseline.put("currentExperimentationValueList", new SWGList(this, 7, 9, false)); - baseline.put("experimentationOffsetList", new SWGList(this, 7, 10, false)); - baseline.put("bluebarList", new SWGList(this, 7, 11, false)); - baseline.put("maxExperimentationList", new SWGList(this, 7, 12, false)); - baseline.put("customizationNameList", new SWGList(this, 7, 13, false)); - baseline.put("palleteSelectionList", new SWGList(this, 7, 14, false)); - baseline.put("palleteStartIndexList", new SWGList(this, 7, 15, false)); - baseline.put("palleteEndIndexList", new SWGList(this, 7, 16, false)); - baseline.put("customizationCounter", (byte) 0); - baseline.put("riskFactor", (float) 0); - baseline.put("objectTemplateCustomizationList", new SWGList(this, 7, 19, false)); - baseline.put("ready", true); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public void setQuantity(int quantity) { - setGenericInt(quantity); - } - - public void incrementQuantity(int increase) { - incrementGenericInt(increase); - } - - public void decrementQuantity(int decrease) { - decrementGenericInt(decrease); - } - - @SuppressWarnings("unchecked") - public SWGMultiMap getPropertiesMap() { - return (SWGMultiMap) baseline3.get("properties"); - } - - public Collection getPropertiesForFile(String stfFile) { - synchronized(objectMutex) { - if (getPropertiesMap().containsKey(stfFile)) { - return getPropertiesMap().get(stfFile); - } else { - return new ArrayList(); - } - } - } - - public Collection getAllProperties() { - synchronized(objectMutex) { - return getPropertiesMap().values(); - } - } - - public boolean containsKey(String stfFile, String key) { - synchronized(objectMutex) { - for (Property property : getPropertiesMap().get(stfFile)) { - if (property.getKey().equals(key)) { - return true; - } - } - - return false; - } - } - - public boolean containsKey(String key) { - synchronized(objectMutex) { - for (Property property : getPropertiesMap().values()) { - if (property.getKey().equals(key)) { - return true; - } - } - - return false; - } - } - - public Property getProperty(String stfFile, String key) { - synchronized(objectMutex) { - for (Property property: getPropertiesMap().get(stfFile)) { - if (property.getKey().equals(key)) { - return property; - } - } - - return null; - } - } - - public Property getProperty(String key) { - synchronized(objectMutex) { - for (Property property: getPropertiesMap().values()) { - if (property.getKey().equals(key)) { - return property; - } - } - - return null; - } - } - - public void addProperty(String stfFile, String key, float value) { - if (!containsKey(stfFile, key)) { - getPropertiesMap().put(stfFile, new Property(key, value)); - } - } - - public void setProperty(String stfFile, String key, float value) { - if (getPropertiesMap().containsKey(stfFile)) { - for (Property property : getPropertiesMap().get(stfFile)) { - if (property.getKey().equals(key)) { - property.setValue(value); - getPropertiesMap().replaceValues(stfFile, getPropertiesMap().get(stfFile)); - return; - } - } - } - } - - public void removeProperty(String stfFile, String key) { - if (containsKey(stfFile, key)) { - getPropertiesMap().remove(stfFile, getProperty(key)); - } - } - - public void removeFile(String stfFile) { - getPropertiesMap().removeAll(stfFile); - } - - public int getSchematicComplexity() { - synchronized(objectMutex) { - return (int) baseline3.get("schematicComplexity"); - } - } - - public void setSchematicComplexity(int schematicComplexity) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("schematicComplexity", schematicComplexity); - } - - notifyClients(buffer, false); - } - - public float getSchematicDataSize() { - synchronized(objectMutex) { - return (float) baseline3.get("schematicDataSize"); - } - } - - public void setSchematicDataSize(float schematicDataSize) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("schematicDataSize", schematicDataSize); - } - - notifyClients(buffer, false); - } - - public byte[] getSchematicCustomization() { - synchronized(objectMutex) { - return (byte[]) baseline6.get("schematicCustomization"); - } - } - - public void setSchematicCustomization(byte[] schematicCustomization) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("schematicCustomization", schematicCustomization); - } - - notifyClients(buffer, false); - } - - public String getCustomizationTemplate() { - synchronized(objectMutex) { - return (String) baseline6.get("customizationTemplate"); - } - } - - public void setCustomizationTemplate(String customizationTemplate) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("customizationTemplate", customizationTemplate); - } - - notifyClients(buffer, false); - } - - public String getSchematicTemplate() { - synchronized(objectMutex) { - return (String) baseline6.get("schematicTemplate"); - } - } - - public void setSchematicTemplate(String schematicTemplate) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("schematicTemplate", schematicTemplate); - } - - notifyClients(buffer, false); - } - - public boolean inUse() { - synchronized(objectMutex) { - return (boolean) baseline6.get("inUse"); - } - } - - public void setInUse(boolean inUse) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("inUse", inUse); - } - - notifyClients(buffer, false); - } - - public void toggleInUse() { - setInUse(!inUse()); - } - - public byte getTotalSlots() { - synchronized(objectMutex) { - return (byte) otherVariables.get("totalSlots"); - } - } - - public void setTotalSlots(byte totalSlots) { - synchronized(objectMutex) { - otherVariables.set("totalSlots", totalSlots); - } - } - - public byte getFilledSlots() { - synchronized(objectMutex) { - return (byte) baseline6.get("filledSlots"); - } - } - - public void setFilledSlots(byte filledSlots) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("filledSlots", filledSlots); - } - - notifyClients(buffer, false); - } - - public void incrementFilledSlots(int increase) { - setFilledSlots(((byte) (getFilledSlots() + ((byte) increase)))); - } - - public void decrementFilledSlots(int decrease) { - setFilledSlots(((byte) (((getFilledSlots() - ((byte) decrease)) < 0) ? ((byte) 0) : (getFilledSlots() - ((byte) decrease))))); - } - - @SuppressWarnings("unchecked") - public SWGList getSlotNameList() { - return (SWGList) baseline7.get("slotNameList"); - } - - @SuppressWarnings("unchecked") - public SWGList getSlotContentsList() { - return (SWGList) baseline7.get("slotContentsList"); - } - - @SuppressWarnings("unchecked") - public SWGList> getIngredientList() { - return (SWGList>) baseline7.get("ingredientList"); - } - - @SuppressWarnings("unchecked") - public SWGList> getQuantityList() { - return (SWGList>) baseline7.get("quantityList"); - } - - @SuppressWarnings("unchecked") - public SWGList getQualityList() { - return (SWGList) baseline7.get("quantityList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCleanSlotList() { - return (SWGList) baseline7.get("cleanSlotList"); - } - - @SuppressWarnings("unchecked") - public SWGList getSlotIndexList() { - return (SWGList) baseline7.get("slotIndexList"); - } - - public byte getIngredientsCounter() { - return (byte) baseline7.get("ingredientsCounter"); - } - - public void setIngredientsCounter(byte ingredientsCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("ingredientsCounter", ingredientsCounter); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - public void incrementIngredientsCounter(int increase) { - setIngredientsCounter((byte) (getIngredientsCounter() + ((byte) increase))); - } - - public void decrementIngredientsCoutner(int decrease) { - byte ingredientsCounter = getIngredientsCounter(); - setIngredientsCounter(((ingredientsCounter < 0) ? 0 : ((byte) (ingredientsCounter - ((byte) decrease))))); - } - - @SuppressWarnings("unchecked") - public SWGList getExperimentationNameList() { - return (SWGList) baseline7.get("experimentationNameList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCurrentExperimentationValueList() { - return (SWGList) baseline7.get("currentExperimentationValueList"); - } - - @SuppressWarnings("unchecked") - public SWGList getExperimentationOffsetList() { - return (SWGList) baseline7.get("experimentationOffsetList"); - } - - @SuppressWarnings("unchecked") - public SWGList getBlueBarList() { - return (SWGList) baseline7.get("blueBarList"); - } - - @SuppressWarnings("unchecked") - public SWGList getMaxExperimentationList() { - return (SWGList) baseline7.get("maxExperimentationList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCustomizationNameList() { - return (SWGList) baseline7.get("customizationNameList"); - } - - @SuppressWarnings("unchecked") - public SWGList getPalleteSelectionList() { - return (SWGList) baseline7.get("palleteSelectionList"); - } - - @SuppressWarnings("unchecked") - public SWGList getPalleteStartIndexList() { - return (SWGList) baseline7.get("palleteStartIndexList"); - } - - @SuppressWarnings("unchecked") - public SWGList getPalleteEndIndexList() { - return (SWGList) baseline7.get("palleteEndIndexList"); - } - - public byte getCustomizationCounter() { - synchronized(objectMutex) { - return (byte) baseline7.get("customizationCounter"); - } - } - - public void setCustomizationCounter(byte customizationCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("customizationCounter", customizationCounter); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - public void incrementCustomizationCounter(int increase) { - - } - - public void decrementCustomizationCounter(int decrease) { - - } - - public float getRiskFactor() { - synchronized(objectMutex) { - return (float) baseline7.get("riskFactor"); - } - } - - public void setRiskFactor(float riskFactor) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("riskFactor", riskFactor); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - @SuppressWarnings("unchecked") - public SWGList getObjectTemplateCustomizationList() { - return (SWGList) baseline7.get("objectTemplateCustomizationList"); - } - - public boolean isReady() { - synchronized(objectMutex) { - return (boolean) baseline7.get("isReady"); - } - } - - public void setReady(boolean ready) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline7.set("ready", ready); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - public void toggleReady() { - setReady(!isReady()); - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public ManufactureSchematicMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new ManufactureSchematicMessageBuilder(this); - } - - return messageBuilder; - } - } - - public void sendBaseline7(Client destination) { - destination.getSession().write(baseline7.getBaseline()); - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - destination.getSession().write(baseline8.getBaseline()); - destination.getSession().write(baseline9.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 1: - case 4: - case 7: - if (getGrandparent().getClient() != null) { - buffer = getBaseline(viewType).createDelta(updateType, buffer.array()); - getGrandparent().getClient().getSession().write(buffer); - } - - return; - case 3: - case 6: - case 8: - case 9: - notifyObservers(getBaseline(viewType).createDelta(updateType, buffer.array()), true); - default: - return; - } - } - -} diff --git a/src/resources/z/exp/objects/mission/MissionMessageBuilder.java b/src/resources/z/exp/objects/mission/MissionMessageBuilder.java deleted file mode 100644 index b1626472..00000000 --- a/src/resources/z/exp/objects/mission/MissionMessageBuilder.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.mission; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.intangible.IntangibleMessageBuilder; - -public class MissionMessageBuilder extends IntangibleMessageBuilder { - - public MissionMessageBuilder(MissionObject object) { - super(object); - } - - public MissionMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/mission/MissionObject.java b/src/resources/z/exp/objects/mission/MissionObject.java deleted file mode 100644 index fdb43469..00000000 --- a/src/resources/z/exp/objects/mission/MissionObject.java +++ /dev/null @@ -1,329 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.mission; - -import org.apache.mina.core.buffer.IoBuffer; - -import main.NGECore; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -import resources.common.Stf; -import resources.common.UString; -import resources.z.exp.mission.MissionLocation; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.intangible.IntangibleObject; -import resources.z.exp.objects.waypoint.WaypointObject; - -@Persistent -public class MissionObject extends IntangibleObject { - - @NotPersistent - private MissionMessageBuilder messageBuilder; - - public MissionObject(NGECore core, long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - baseline3.set("waypoint", (WaypointObject) core.objectService.createObject("object/waypoint/base/shared_base_waypoint.iff", planet)); - } - - public MissionObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("difficultyLevel", 0); - baseline.put("startLocation", new MissionLocation(new Point3D(0, 0, 0), 0, "")); - baseline.put("creator", new UString()); - baseline.put("creditReward", 0); - baseline.put("targetObject", 0); - baseline.put("description", new Stf()); - baseline.put("title", new Stf()); - baseline.put("repeatCounter", 0); - baseline.put("missionType", ""); - baseline.put("targetName", ""); - baseline.put("waypoint", new WaypointObject()); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public int getDifficultyLevel() { - synchronized(objectMutex) { - return (int) baseline3.get("difficultyLevel"); - } - } - - public void setDifficultyLevel(int difficultyLevel) { - synchronized(objectMutex) { - baseline3.set("difficultyLevel", difficultyLevel); - } - } - - public MissionLocation getStartLocation() { - synchronized(objectMutex) { - return (MissionLocation) baseline3.get("startLocation"); - } - } - - public void setStartLocation(Point3D position, SWGObject object, Planet planet) { - setStartLocation(position, object, planet.getName()); - } - - public void setStartLocation(Point3D position, SWGObject object, String planet) { - synchronized(objectMutex) { - MissionLocation startLocation = new MissionLocation(position.clone(), object.getObjectID(), planet); - baseline3.set("startLocation", startLocation); - } - } - - public String getCreator() { - synchronized(objectMutex) { - return (String) baseline3.get("creator"); - } - } - - public void setCreator(String creator) { - synchronized(objectMutex) { - baseline3.set("creator", creator); - } - } - - public int getCreditReward() { - synchronized(objectMutex) { - return (int) baseline3.get("creditReward"); - } - } - - public void setCreditReward(int creditReward) { - synchronized(objectMutex) { - baseline3.set("creditReward", creditReward); - } - } - - public MissionLocation getDestination() { - synchronized(objectMutex) { - return (MissionLocation) baseline3.get("destination"); - } - } - - public void setDestination(Point3D position, SWGObject object, Planet planet) { - setDestination(position, object, planet.getName()); - } - - public void setDestination(Point3D position, SWGObject object, String planet) { - synchronized(objectMutex) { - MissionLocation destination = new MissionLocation(position.clone(), object.getObjectID(), planet); - baseline3.set("destination", destination); - } - } - - public int getTargetObject() { - synchronized(objectMutex) { - return (int) baseline3.get("targetObject"); - } - } - - public void setTargetObject(int targetObject) { - synchronized(objectMutex) { - baseline3.set("targetObject", targetObject); - } - } - - public Stf getDescription() { - synchronized(objectMutex) { - return (Stf) baseline3.get("description"); - } - } - - public void setDescription(String stfFilename, String string) { - synchronized(objectMutex) { - Stf description = new Stf(stfFilename, 0, string); - baseline3.set("description", description); - } - } - - public Stf getTitle() { - synchronized(objectMutex) { - return (Stf) baseline3.get("title"); - } - } - - public void setTitle(String stfFilename, String string) { - synchronized(objectMutex) { - Stf title = new Stf(stfFilename, 0, string); - baseline3.set("title", title); - } - } - - public int getRepeatCounter() { - synchronized(objectMutex) { - return (int) baseline3.get("repeatCounter"); - } - } - - public void setRepeatCounter(int repeatCounter) { - synchronized(objectMutex) { - baseline3.set("repeatCounter", repeatCounter); - } - } - - public void incrementRepeatCounter(int increase) { - setRepeatCounter(getRepeatCounter() + 1); - } - - public void decrementRepeatCounter(int decrease) { - int repeatCounter = getRepeatCounter() + 1; - setRepeatCounter((repeatCounter < 0) ? 0 : repeatCounter); - } - - public String getMissionType() { - synchronized(objectMutex) { - return (String) baseline3.get("missionType"); - } - } - - public void setMissionType(String missionType) { - synchronized(objectMutex) { - baseline3.set("missionType", missionType); - } - } - - public String getTargetName() { - synchronized(objectMutex) { - return (String) baseline3.get("targetName"); - } - } - - public void setTargetName(String targetName) { - synchronized(objectMutex) { - baseline3.set("targetName", targetName); - } - } - - public WaypointObject getWaypoint() { - synchronized(objectMutex) { - return (WaypointObject) baseline3.get("waypoint"); - } - } - - public void setWaypoint(WaypointObject waypoint) { - synchronized(objectMutex) { - baseline3.set("waypoint", waypoint); - } - } - - // A new mission listing is just one big delta to one of the player's - // empty, pre-existing MissionObjects - public void updateMission() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.createDelta(); - } - - if (getGrandparent().getClient() != null) { - getGrandparent().getClient().getSession().write(buffer); - } - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - getGrandparent().getClient().getSession().write(buffer); - } - - @Override - public MissionMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new MissionMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - destination.getSession().write(baseline8.getBaseline()); - destination.getSession().write(baseline9.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 1: - case 4: - case 3: - case 6: - case 7: - case 8: - case 9: - if (getGrandparent().getClient() != null) { - buffer = getBaseline(viewType).createDelta(updateType, buffer.array()); - getGrandparent().getClient().getSession().write(buffer); - } - default: - return; - } - } - -} diff --git a/src/resources/z/exp/objects/object/BaseObject.java b/src/resources/z/exp/objects/object/BaseObject.java deleted file mode 100644 index 37dc0f85..00000000 --- a/src/resources/z/exp/objects/object/BaseObject.java +++ /dev/null @@ -1,543 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.object; - -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.common.Stf; -import resources.common.UString; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.objects.SWGObject; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class BaseObject extends SWGObject { - - @NotPersistent - private ObjectMessageBuilder messageBuilder; - - protected Baseline baseline1; - protected Baseline baseline3; - protected Baseline baseline4; - protected Baseline baseline6; - protected Baseline baseline7; - protected Baseline baseline8; - protected Baseline baseline9; - protected Baseline otherVariables; - - @NotPersistent - private ScheduledExecutorService scheduler; - - private boolean ready = false; - - public BaseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - super.setCustomName(""); - if (super.getDetailFilename() == null) super.setDetailFilename(""); - if (super.getDetailName() == null) super.setDetailName(""); - initializeBaselines(); - otherVariables = getOtherVariables(); - ready = true; - } - - public BaseObject() { - super(); - - scheduler = Executors.newScheduledThreadPool(2); - - // Makes sure this runs after the baselines have been restored from DB - - scheduler.schedule(new Runnable() { - - public void run() { - while (!ready); - initializeBaselines(); - } - - }, 0, TimeUnit.NANOSECONDS); - } - - public void initializeBaselines() { - // Transform the structures of any baselines incase they've been altered - - if (otherVariables != null) { - otherVariables.transformStructure(getOtherVariables()); - } - - if (baseline1 != null) { - baseline1.transformStructure(getBaseline1()); - addBuilders(1); - } - - if (baseline3 != null) { - baseline3.transformStructure(getBaseline3()); - addBuilders(3); - } - - if (baseline4 != null) { - baseline4.transformStructure(getBaseline4()); - addBuilders(4); - } - - if (baseline6 != null) { - baseline6.transformStructure(getBaseline6()); - addBuilders(6); - } - - if (baseline7 != null) { - baseline7.transformStructure(getBaseline7()); - addBuilders(7); - } - - if (baseline8 != null) { - baseline8.transformStructure(getBaseline8()); - addBuilders(8); - } - - if (baseline9 != null) { - baseline9.transformStructure(getBaseline9()); - addBuilders(9); - } - - // Inheriting objects initialize these only if needed, for efficiency - - initializeBaseline(3); - initializeBaseline(6); - } - - public void initializeBaseline(int viewType) { - // Won't initialize any baselines if they've already been initialized - - switch (viewType) { - case 1: - if (baseline1 == null) { - baseline1 = getBaseline1(); - addBuilders(viewType); - getMessageBuilder().buildBaseline1(baseline1.getBaselineBuilders(), baseline1.getDeltaBuilders()); - } - - return; - case 3: - if (baseline3 == null) { - baseline3 = getBaseline3(); - addBuilders(viewType); - getMessageBuilder().buildBaseline3(baseline3.getBaselineBuilders(), baseline3.getDeltaBuilders()); - } - - return; - case 4: - if (baseline4 == null) { - baseline4 = getBaseline4(); - addBuilders(viewType); - getMessageBuilder().buildBaseline4(baseline4.getBaselineBuilders(), baseline4.getDeltaBuilders()); - } - - return; - case 6: - if (baseline6 == null) { - baseline6 = getBaseline6(); - addBuilders(viewType); - getMessageBuilder().buildBaseline6(baseline6.getBaselineBuilders(), baseline6.getDeltaBuilders()); - } - - return; - case 7: - if (baseline7 == null) { - baseline7 = getBaseline7(); - addBuilders(viewType); - getMessageBuilder().buildBaseline7(baseline7.getBaselineBuilders(), baseline7.getDeltaBuilders()); - } - - return; - case 8: - if (baseline8 == null) { - baseline8 = getBaseline8(); - addBuilders(viewType); - getMessageBuilder().buildBaseline8(baseline8.getBaselineBuilders(), baseline8.getDeltaBuilders()); - } - - return; - case 9: - if (baseline9 == null) { - baseline9 = getBaseline9(); - addBuilders(viewType); - getMessageBuilder().buildBaseline9(baseline9.getBaselineBuilders(), baseline9.getDeltaBuilders()); - } - default: - return; - } - } - - public void addBuilders(int viewType) { - Baseline baseline = getBaseline(viewType); - Map baselineBuilders = new HashMap(); - Map deltaBuilders = new HashMap(); - - switch (viewType) { - case 1: - getMessageBuilder().buildBaseline1(baselineBuilders, deltaBuilders); - break; - case 3: - getMessageBuilder().buildBaseline3(baselineBuilders, deltaBuilders); - break; - case 4: - getMessageBuilder().buildBaseline4(baselineBuilders, deltaBuilders); - break; - case 6: - getMessageBuilder().buildBaseline6(baselineBuilders, deltaBuilders); - break; - case 7: - getMessageBuilder().buildBaseline7(baselineBuilders, deltaBuilders); - break; - case 8: - getMessageBuilder().buildBaseline8(baselineBuilders, deltaBuilders); - break; - case 9: - getMessageBuilder().buildBaseline9(baselineBuilders, deltaBuilders); - break; - } - - if (baselineBuilders.size() > 0) { - baseline.setBaselineBuilders(baselineBuilders); - } - - if (deltaBuilders.size() > 0) { - baseline.setDeltaBuilders(deltaBuilders); - } - } - - public Baseline getOtherVariables() { - Baseline baseline = new Baseline(this, 0); - return baseline; - } - - public Baseline getBaseline1() { - Baseline baseline = new Baseline(this, 1); - return baseline; - } - - public Baseline getBaseline3() { - Baseline baseline = new Baseline(this, 3); - baseline.put("complexity", (float) 1); - baseline.put("stf", new Stf(getStfFilename(), 0, getStfName())); - baseline.put("customName", new UString("")); - baseline.put("volume", 1); - return baseline; - } - - public Baseline getBaseline4() { - Baseline baseline = new Baseline(this, 4); - return baseline; - } - - public Baseline getBaseline6() { - Baseline baseline = new Baseline(this, 6); - baseline.put("serverId", 0); - baseline.put("detail", new Stf(getDetailFilename(), 0, getDetailName())); - return baseline; - } - - public Baseline getBaseline7() { - Baseline baseline = new Baseline(this, 7); - return baseline; - } - - public Baseline getBaseline8() { - Baseline baseline = new Baseline(this, 8); - return baseline; - } - - public Baseline getBaseline9() { - Baseline baseline = new Baseline(this, 9); - return baseline; - } - - public float getComplexity() { - synchronized(objectMutex) { - return (float) baseline3.get("complexity"); - } - } - - public void setComplexity(float complexity) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("complexity", complexity); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public Stf getStf() { - return (Stf) baseline3.get("stf"); - } - - public void setStfFilename(String stfFilename) { - super.setStfFilename(stfFilename); - - if (baseline3 != null) { - IoBuffer buffer; - - getStf().setStfFilename(stfFilename); - - synchronized(objectMutex) { - buffer = baseline3.set("stf", getStf()); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - } - - public int getStfSpacer() { - synchronized(objectMutex) { - return ((Stf) baseline3.get("stf")).getSpacer(); - } - } - - public void setStfSpacer(int stfSpacer) { - IoBuffer buffer; - - getStf().setSpacer(stfSpacer); - - synchronized(objectMutex) { - buffer = baseline3.set("stf", getStf()); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public void setStfName(String stfName) { - super.setStfName(stfName); - - if (baseline3 != null) { - IoBuffer buffer; - - getStf().setStfName(stfName); - - synchronized(objectMutex) { - buffer = baseline3.set("stf", getStf()); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - } - - public void setCustomName(String customName) { - super.setCustomName(customName); - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("customName", customName); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public void setVolume(int volume) { - super.setVolume(volume); - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("volume", volume); - } - - if (baseline3 != null) { - notifyClients(buffer, true); - } - } - - public void incrementVolume(int increase) { - setVolume((getVolume() + increase)); - } - - public void decrementVolume(int decrease) { - setVolume((((getVolume() - decrease) < 1) ? 0 : (getVolume() - decrease))); - } - - public int getServerId() { - synchronized(objectMutex) { - return (int) baseline6.get("serverId"); - } - } - - public void setServerId(int serverId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("serverId", serverId); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - - public Stf getDetail() { - return (Stf) baseline3.get("detail"); - } - - public void setDetailFilename(String detailFilename) { - super.setDetailFilename(detailFilename); - - if (baseline6 != null) { - IoBuffer buffer; - - getDetail().setStfFilename(detailFilename); - - synchronized(objectMutex) { - buffer = baseline6.set("detail", getDetail()); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - } - - public int getDetailSpacer() { - synchronized(objectMutex) { - return ((Stf) baseline6.get("detail")).getSpacer(); - } - } - - public void setDetailSpacer(int detailSpacer) { - IoBuffer buffer; - - getDetail().setSpacer(detailSpacer); - - synchronized(objectMutex) { - buffer = baseline6.set("detail", getDetail()); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - - public void setDetailName(String detailName) { - super.setDetailName(detailName); - - if (baseline6 != null) { - IoBuffer buffer; - - getDetail().setStfName(detailName); - - synchronized(objectMutex) { - buffer = baseline6.set("detail", getDetail()); - } - - if (baseline6 != null) { - notifyClients(buffer, true); - } - } - } - - protected Baseline getBaseline(int viewType) { - switch (viewType) { - case 1: return baseline1; - case 3: return baseline3; - case 4: return baseline4; - case 6: return baseline6; - case 7: return baseline7; - case 8: return baseline8; - case 9: return baseline9; - default: return null; - } - } - - /* - This should contain the method of notifying observers, as - it tends to vary depending on the type of object, which is - a problem for inheritance when the master object uses a - different method (ie. ITNO and PLAY). - */ - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - public ObjectMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new ObjectMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - destination.getSession().write(baseline3.getBaseline()); - destination.getSession().write(baseline6.getBaseline()); - } - } - - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 1: - case 4: - case 7: - if (getClient() != null) { - buffer = getBaseline(viewType).createDelta(updateType, buffer.array()); - getClient().getSession().write(buffer); - } - - return; - case 3: - case 6: - case 8: - case 9: - notifyClients(getBaseline(viewType).createDelta(updateType, buffer.array()), true); - default: - return; - } - } - -} diff --git a/src/resources/z/exp/objects/player/PlayerMessageBuilder.java b/src/resources/z/exp/objects/player/PlayerMessageBuilder.java deleted file mode 100644 index f4886ec9..00000000 --- a/src/resources/z/exp/objects/player/PlayerMessageBuilder.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.player; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.intangible.IntangibleMessageBuilder; - -@Persistent -public class PlayerMessageBuilder extends IntangibleMessageBuilder { - - public PlayerMessageBuilder(PlayerObject playerObject) { - super(playerObject); - } - - public PlayerMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/player/PlayerObject.java b/src/resources/z/exp/objects/player/PlayerObject.java deleted file mode 100644 index df7284b0..00000000 --- a/src/resources/z/exp/objects/player/PlayerObject.java +++ /dev/null @@ -1,999 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.player; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; -import java.util.Locale; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.datatables.Professions; -import resources.z.exp.gcw.RegionDefender; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.SWGMap; -import resources.z.exp.objects.intangible.IntangibleObject; -import resources.z.exp.objects.waypoint.WaypointObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import resources.z.exp.craft.DraftSchematic; -import resources.z.exp.quest.Quest; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class PlayerObject extends IntangibleObject { - - @NotPersistent - private PlayerMessageBuilder messageBuilder; - - @NotPersistent - private long lastPlayTimeUpdate = System.currentTimeMillis(); - - public PlayerObject(long objectID, Planet planet) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 0, 0), "object/player/shared_player.iff"); - setServerId(0x8A); - } - - public PlayerObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - List flagsList = new ArrayList(); - flagsList.add(0); - flagsList.add(0); - flagsList.add(0); - flagsList.add(0); - baseline.put("flagsList", flagsList); - List profileFlagsList = new ArrayList(); - profileFlagsList.add(0); - profileFlagsList.add(0); - profileFlagsList.add(0); - profileFlagsList.add(0); - baseline.put("profileFlagsList", profileFlagsList); - baseline.put("title", ""); - baseline.put("bornDate", Integer.parseInt(new SimpleDateFormat("yyyymmdd", Locale.ENGLISH).format(Calendar.getInstance().getTime()))); - baseline.put("totalPlayTime", 0); - baseline.put("professionIcon", 0); - baseline.put("profession", "trader_1a"); - baseline.put("gcwPoints", 0); - baseline.put("pvpKills", 0); - baseline.put("lifetimeGcwPoints", (long) 0); - baseline.put("lifetimePvpKills", 0); - baseline.put("16", new SWGList(this, 3, 16, false)); // Misc data size (varies, 0 in tutorial) <- collections?) <- this isn't a SWGList, but it'll work until we need it - baseline.put("17", new SWGList(this, 3, 17, false)); // Misc ints (2 ints in tutorial, 5 bytes other times...) - baseline.put("18", (byte) 0); // Unknown Flag (regularly changed in tutorial) - baseline.put("19", (byte) 0); // Unknown Flag (regularly changed in tutorial) - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("adminFlags", (byte) 0); - baseline.put("currentRank", 0); - baseline.put("rankProgress", (float) 0); - baseline.put("highestRebelRank", 0); - baseline.put("highestImperialRank", 0); - baseline.put("nextUpdateTime", 0); // TODO set correctly - baseline.put("home", ""); - baseline.put("citizenship", (byte) 0); // Homeless/Citizen/Militia/Mayor? - baseline.put("cityRegionDefender", new RegionDefender()); - baseline.put("guildRegionDefender", new RegionDefender()); - baseline.put("12", 0); // General? - baseline.put("13", 0); // Guild Rank Title? - baseline.put("14", 0); // Citizen Rank Title? - baseline.put("15", 0); // All random guesses, always seem to be 0 - baseline.put("16", 0); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - baseline.put("xpList", new SWGMap(this, 8, 0, true)); - baseline.put("waypoints", new SWGMap(this, 8, 1, true)); - baseline.put("currentForcePower", 100); - baseline.put("maxForcePower", 100); - baseline.put("currentFSQuestList", new SWGList(this, 8, 4, false)); - baseline.put("completedFSQuestList", new SWGList(this, 8, 5, false)); - baseline.put("questJournal", new SWGList(this, 8, 6, false)); - baseline.put("professionWheelPosition", ""); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - baseline.put("experimentationFlag", 0); - baseline.put("craftingStage", 0); - baseline.put("nearestCraftingStation", 0); - baseline.put("draftSchematicList", new SWGList(this, 9, 3, true)); - baseline.put("4", new SWGList(this, 9, 4, false)); // Might or might not be a list, but at the very least it's two 0 ints that are part of the same delta. - baseline.put("experimentationPoints", 0); - baseline.put("accomplishmentCounter", 0); - baseline.put("friendList", new SWGList(this, 9, 7, false)); - baseline.put("ignoreList", new SWGList(this, 9, 8, false)); - baseline.put("languageId", 0); - baseline.put("currentStomach", 0); - baseline.put("maxStomach", 100); - baseline.put("currentDrink", 0); - baseline.put("maxDrink", 100); - baseline.put("currentConsumable", 0); - baseline.put("maxConsumable", 100); - // The others are unknown, commented below. - // it won't send the rest and won't have to by using a lower object count. - // If we figure all these structs out all we have to do is add them the - // same way as above - /* - buffer.putInt(0); // Related to stomach in CU - buffer.putInt(0); // Related to stomach in CU - buffer.putInt(0); // Been seen as 0x0A - buffer.putInt(3); // Also been seen as 0x0A and 0x02 and 0x18 - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); // Unused Waypoint List? - buffer.putInt(0); // Update Counter? - buffer.putInt(2); // Unknown, sometimes a number and sometimes 0 - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(0); - buffer.putInt(object.getJediState()); - buffer.putShort((short) 0); - */ - return baseline; - } - - @SuppressWarnings("unchecked") - public List getFlagsList() { - return (List) baseline3.get("flagsList"); - } - - public void setFlagsList(int flag1, int flag2, int flag3, int flag4) { - IoBuffer buffer; - - synchronized(objectMutex) { - List flagsList = getFlagsList(); - flagsList.set(0, flag1); - flagsList.set(1, flag2); - flagsList.set(2, flag3); - flagsList.set(3, flag4); - buffer = baseline3.set("flagsList", flagsList); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public List getProfileFlagsList() { - return (List) baseline3.get("profileFlagsList"); - } - - public void setProfileFlagsList(int flag1, int flag2, int flag3, int flag4) { - IoBuffer buffer; - - synchronized(objectMutex) { - List profileFlagsList = getProfileFlagsList(); - profileFlagsList.set(0, flag1); - profileFlagsList.set(1, flag2); - profileFlagsList.set(2, flag3); - profileFlagsList.set(3, flag4); - buffer = baseline3.set("profileFlagsList", profileFlagsList); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public String getTitle() { - synchronized(objectMutex) { - return (String) baseline3.get("title"); - } - } - - public void setTitle(String title) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("title", title); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getBornDate() { - synchronized(objectMutex) { - return (int) baseline3.get("bornDate"); - } - } - - public long getLastPlayTimeUpdate() { - synchronized(objectMutex) { - return (long) baseline3.get("lastPlayTimeUpdate"); - } - } - - public void setLastPlayTimeUpdate(long lastPlayTimeUpdate) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("lastPlayTimeUpdate", lastPlayTimeUpdate); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getTotalPlayTime() { - synchronized(objectMutex) { - return (int) baseline3.get("totalPlayTime"); - } - } - - public void setTotalPlayTime(int totalPlayTime) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("totalPlayTime", totalPlayTime); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getProfessionIcon() { - synchronized(objectMutex) { - return (int) baseline3.get("professionIcon"); - } - } - - public void setProfessionIcon(int professionIcon) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("professionIcon", professionIcon); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public String getProfession() { - synchronized(objectMutex) { - return (String) baseline3.get("profession"); - } - } - - public void setProfession(String profession) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("profession", profession); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - - setProfessionIcon(Professions.get(profession)); - } - - public int getGcwPoints() { - synchronized(objectMutex) { - return (int) baseline3.get("gcwPoints"); - } - } - - public void addGcwPoints(int gcwPoints) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("gcwPoints", (((int) baseline3.get("gcwPoints")) + gcwPoints)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public void resetGcwPoints() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("gcwPoints", 0); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getPvpKills() { - synchronized(objectMutex) { - return (int) baseline3.get("pvpKills"); - } - } - - public void addPvpKill() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("pvpKills", (((int) baseline3.get("pvpKills")) + 1)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public void resetPvpKills() { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("pvpKills", 0); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public long getLifetimeGcwPoints() { - synchronized(objectMutex) { - return (long) baseline3.get("lifetimeGcwPoints"); - } - } - - public void addLifetimeGcwPoints(long gcwPoints) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("lifetimeGcwPoints", (((long) baseline3.get("lifetimeGcwPoints")) + gcwPoints)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getLifetimePvpKills() { - synchronized(objectMutex) { - return (int) baseline3.get("lifetimePvpKills"); - } - } - - public void addLifetimePvpKills(int pvpKills) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("lifetimePvpKills", (((int) baseline3.get("lifetimePvpKills")) + pvpKills)); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public byte getAdminFlag() { - synchronized(objectMutex) { - return (byte) baseline6.get("adminFlag"); - } - } - - public void setAdminFlag(byte adminFlag) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("adminFlag", adminFlag); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentRank() { - synchronized(objectMutex) { - return (int) baseline6.get("currentRank"); - } - } - - public void setCurrentRank(int currentRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("currentRank", currentRank); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public float getRankProgress() { - synchronized(objectMutex) { - return (float) baseline6.get("rankProgress"); - } - } - - public void setRankProgress(float rankProgress) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("rankProgress", rankProgress); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getHighestRebelRank() { - synchronized(objectMutex) { - return (int) baseline6.get("highestRebelRank"); - } - } - - public void setHighestIRank(int highestRebelRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("highestRebelRank", highestRebelRank); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getHighestImperialRank() { - synchronized(objectMutex) { - return (int) baseline6.get("highestImperialRank"); - } - } - - public void setHighestImperialRank(int highestImperialRank) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("highestImperialRank", highestImperialRank); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getNextUpdateTime() { - synchronized(objectMutex) { - return (int) baseline6.get("nextUpdateTime"); - } - } - - public void setNextUpdateTime(int nextUpdateTime) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("nextUpdateTime", nextUpdateTime); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public String getHome() { - synchronized(objectMutex) { - return (String) baseline6.get("home"); - } - } - - public void setHome(String home) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("home", home); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public byte getCitizenship() { - synchronized(objectMutex) { - return (byte) baseline6.get("citizenship"); - } - } - - public void setCitizenship(byte citizenship) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("citizenship", citizenship); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public RegionDefender getCityRegionDefender() { - synchronized(objectMutex) { - return (RegionDefender) baseline6.get("cityRegionDefender"); - } - } - - public void setCityRegionDefender(RegionDefender cityRegionDefender) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("cityRegionDefender", cityRegionDefender); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public RegionDefender getGuildRegionDefender() { - synchronized(objectMutex) { - return (RegionDefender) baseline6.get("guildRegionDefender"); - } - } - - public void setGuildRegionDefender(RegionDefender guildRegionDefender) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("guildRegionDefender", guildRegionDefender); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGMap getXpList() { - return (SWGMap) baseline8.get("xpList"); - } - - @SuppressWarnings("unchecked") - public SWGMap getWaypoints() { - return (SWGMap) baseline8.get("waypoints"); - } - - public void waypointUpdate(WaypointObject waypoint) { - getWaypoints().put(waypoint.getObjectID(), waypoint); - } - - public void waypointRemove(WaypointObject waypoint) { - getWaypoints().remove(waypoint.getObjectID()); - } - - public void waypointAdd(WaypointObject waypoint) { - getWaypoints().put(waypoint.getObjectID(), waypoint); - } - - public WaypointObject getWaypointFromList(WaypointObject waypoint) { - synchronized(objectMutex) { - if (getWaypoints().containsKey(waypoint.getObjectID())) { - return getWaypoints().get(waypoint.getObjectID()); - } - } - - return null; - } - - public int getCurrentForcePower() { - synchronized(objectMutex) { - return (int) baseline8.get("currentForcePower"); - } - } - - public void setCurrentForcePower(int currentForcePower) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline8.set("currentForcePower", currentForcePower); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxForcePower() { - synchronized(objectMutex) { - return (int) baseline8.get("maxForcePower"); - } - } - - public void setMaxForcePower(int maxForcePower) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline8.set("maxForcePower", maxForcePower); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGList getCurrentFSQuestList() { - return (SWGList) baseline8.get("currentFSQuestList"); - } - - @SuppressWarnings("unchecked") - public SWGList getCompletedFSQuestList() { - return (SWGList) baseline8.get("completedFSQuestList"); - } - - @SuppressWarnings("unchecked") - public SWGList getQuestJournal() { - return (SWGList) baseline8.get("questJournal"); - } - - public String getProfessionWheelPosition() { - synchronized(objectMutex) { - return (String) baseline8.get("professionWheelPosition"); - } - } - - public void setProfessionWheelPosition(String professionWheelPosition) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline8.set("professionWheelPosition", professionWheelPosition); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getExperimentationFlag() { - synchronized(objectMutex) { - return (int) baseline9.get("experimentationFlag"); - } - } - - public void setExperimentationFlag(int experimentationFlag) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("experimentationFlag", experimentationFlag); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCraftingStage() { - synchronized(objectMutex) { - return (int) baseline9.get("craftingStage"); - } - } - - public void setCraftingStage(int craftingStage) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("craftingStage", craftingStage); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public long getNearestCraftingStation() { - synchronized(objectMutex) { - return (long) baseline9.get("nearestCraftingStation"); - } - } - - public void setNearestCraftingStation(long nearestCraftingStation) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("nearestCraftingStation", nearestCraftingStation); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGList getDraftSchematicList() { - return (SWGList) baseline9.get("draftSchematicList"); - } - - public int getExperimentationPoints() { - synchronized(objectMutex) { - return (int) baseline9.get("experimentationPoints"); - } - } - - public void setExperimentationPoints(int experimentationPoints) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("experimentationPoints", experimentationPoints); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getAccomplishmentCounter() { - synchronized(objectMutex) { - return (int) baseline9.get("accomplishmentCounter"); - } - } - - public void setAccomplishmentCounter(int accomplishmentCounter) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("accomplishmentCounter", accomplishmentCounter); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @SuppressWarnings("unchecked") - public SWGList getFriendList() { - return (SWGList) baseline9.get("friendList"); - } - - public void friendAdd(String friend) { - getFriendList().add(friend); - } - - public void friendRemove(String friend) { - getFriendList().remove(friend); - } - - @SuppressWarnings("unchecked") - public SWGList getIgnoreList() { - return (SWGList) baseline9.get("ignoreList"); - } - - public void ignoreAdd(String name) { - getIgnoreList().add(name); - } - - public void ignoreRemove(String name) { - getIgnoreList().remove(name); - } - - public int getLanguageId() { - synchronized(objectMutex) { - return (int) baseline9.get("languageId"); - } - } - - public void setLanguageId(int languageId) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("languageId", languageId); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentStomach() { - synchronized(objectMutex) { - return (int) baseline9.get("currentStomach"); - } - } - - public void setCurrentStomach(int currentStomach) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("currentStomach", currentStomach); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxStomach() { - synchronized(objectMutex) { - return (int) baseline9.get("maxStomach"); - } - } - - public void setMaxStomach(int maxStomach) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("maxStomach", maxStomach); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentDrink() { - synchronized(objectMutex) { - return (int) baseline9.get("currentDrink"); - } - } - - public void setCurrentDrink(int currentDrink) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("currentDrink", currentDrink); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxDrink() { - synchronized(objectMutex) { - return (int) baseline9.get("maxDrink"); - } - } - - public void setMaxDrink(int maxDrink) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("maxDrink", maxDrink); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getCurrentConsumable() { - synchronized(objectMutex) { - return (int) baseline9.get("currentConsumable"); - } - } - - public void setCurrentConsumable(int currentConsumable) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("currentConsumable", currentConsumable); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - public int getMaxConsumable() { - synchronized(objectMutex) { - return (int) baseline9.get("maxConsumable"); - } - } - - public void setMaxConsumable(int maxConsumable) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline9.set("maxConsumable", maxConsumable); - } - - if (getContainer() != null) { - getContainer().notifyObservers(buffer, true); - } - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - if (getContainer() != null) { - getContainer().notifyObservers(buffer, notifySelf); - } - } - - @Override - public PlayerMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new PlayerMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //if(destination.getParent().getObjectID() == getParentId()) { // only send to self - //destination.getSession().write(getBaseline(3).getBaseline()); - //destination.getSession().write(getBaseline(6).getBaseline()); - //destination.getSession().write(getBaseline(8).getBaseline()); - //destination.getSession().write(getBaseline(9).getBaseline()); - //} - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - if (getContainer() != null) { - getContainer().notifyObservers(getBaseline(viewType).createDelta(updateType, buffer.array()), true); - } - } - -} diff --git a/src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java b/src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java deleted file mode 100644 index 10450243..00000000 --- a/src/resources/z/exp/objects/resource/ResourceContainerMessageBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.resource; - -public class ResourceContainerMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/resource/ResourceContainerObject.java b/src/resources/z/exp/objects/resource/ResourceContainerObject.java deleted file mode 100644 index a3ef31ad..00000000 --- a/src/resources/z/exp/objects/resource/ResourceContainerObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.resource; - -public class ResourceContainerObject { - -} diff --git a/src/resources/z/exp/objects/ship/ShipMessageBuilder.java b/src/resources/z/exp/objects/ship/ShipMessageBuilder.java deleted file mode 100644 index a1a8de8e..00000000 --- a/src/resources/z/exp/objects/ship/ShipMessageBuilder.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.ship; - -public class ShipMessageBuilder { - -} diff --git a/src/resources/z/exp/objects/ship/ShipObject.java b/src/resources/z/exp/objects/ship/ShipObject.java deleted file mode 100644 index 5789f04d..00000000 --- a/src/resources/z/exp/objects/ship/ShipObject.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.ship; - -public class ShipObject { - -} diff --git a/src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java b/src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java deleted file mode 100644 index 5156390b..00000000 --- a/src/resources/z/exp/objects/staticobject/StaticMessageBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.staticobject; - -import java.util.Map; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -public class StaticMessageBuilder extends ObjectMessageBuilder { - - public StaticMessageBuilder(StaticObject object) { - super(object); - } - - public StaticMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/staticobject/StaticObject.java b/src/resources/z/exp/objects/staticobject/StaticObject.java deleted file mode 100644 index 309be323..00000000 --- a/src/resources/z/exp/objects/staticobject/StaticObject.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.staticobject; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class StaticObject extends BaseObject { - - @NotPersistent - private StaticMessageBuilder messageBuilder; - - public StaticObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public StaticObject() { - super(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - return baseline; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public StaticMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new StaticMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java b/src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java deleted file mode 100644 index 0575128c..00000000 --- a/src/resources/z/exp/objects/tangible/TangibleMessageBuilder.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* -` * 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.z.exp.objects.tangible; - -import java.util.Map; - -import com.sleepycat.persist.model.Persistent; - -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.ObjectMessageBuilder; - -@Persistent -public class TangibleMessageBuilder extends ObjectMessageBuilder { - - public TangibleMessageBuilder(TangibleObject object) { - super(object); - } - - public TangibleMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/tangible/TangibleObject.java b/src/resources/z/exp/objects/tangible/TangibleObject.java deleted file mode 100644 index 1a54abb6..00000000 --- a/src/resources/z/exp/objects/tangible/TangibleObject.java +++ /dev/null @@ -1,400 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.tangible; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.datatables.FactionStatus; -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.SWGList; -import resources.z.exp.objects.creature.CreatureObject; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.common.CRC; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class TangibleObject extends BaseObject { - - @NotPersistent - private TangibleMessageBuilder messageBuilder; - - @NotPersistent - private List defendersList = new ArrayList(); - - public TangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { - super(objectID, planet, position, orientation, template); - } - - public TangibleObject(long objectID, Planet planet, String template) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); - } - - public TangibleObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("faction", ""); - baseline.put("pvpBitmask", 0); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("faction", 0); - baseline.put("factionStatus", 0); - baseline.put("customization", new Byte[] { 0x00, 0x00 }); - baseline.put("componentCustomizationList", new SWGList(this, 3, 7, false)); - baseline.put("optionsBitmask", 0); - baseline.put("incapacityTimer", 0); - baseline.put("conditionDamage", 0); - baseline.put("maximumCondition", 0); - baseline.put("isStatic", false); - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("inCombat", false); - baseline.put("3", (long) 0); // Unknown - baseline.put("4", (long) 0); // Unknown - baseline.put("5", (long) 0); // Unknown - baseline.put("6", (long) 0); // Unknown - baseline.put("7", 0); // Unknown - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public String getFaction() { - synchronized(objectMutex) { - return (String) otherVariables.get("faction"); - } - } - - public void setFaction(String faction) { - IoBuffer buffer; - - synchronized(objectMutex) { - otherVariables.set("faction", faction); - buffer = baseline3.set("faction", CRC.StringtoCRC(faction)); - } - - notifyClients(buffer, true); - } - - public int getFactionStatus() { - synchronized(objectMutex) { - return (int) baseline3.get("factionStatus"); - } - } - - public void setFactionStatus(int factionStatus) { - switch (factionStatus) { - case FactionStatus.OnLeave: - case FactionStatus.Combatant: - case FactionStatus.SpecialForces: - break; - default: - factionStatus = 0; - } - - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("factionStatus", factionStatus); - } - - notifyClients(buffer, true); - } - - public byte[] getCustomization() { - synchronized(objectMutex) { - return (byte[]) baseline3.get("customization"); - } - } - - public void setCustomization(byte[] customization) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("customization", customization); - } - - notifyClients(buffer, true); - } - - @SuppressWarnings("unchecked") - public SWGList getComponentCustomizationList() { - return (SWGList) baseline3.get("componentCustomizationList"); - } - - public int getOptionsBitmask() { - synchronized(objectMutex) { - return (int) baseline3.get("optionsBitmask"); - } - } - - public void setOptionsBitmask(int optionsBitmask) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("optionsBitmask", optionsBitmask); - } - - notifyClients(buffer, true); - } - - public int getIncapacityTimer() { - synchronized(objectMutex) { - return (int) baseline3.get("incapacityTimer"); - } - } - - public void setIncapacityTimer(int incapacityTimer) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("incapacityTimer", incapacityTimer); - } - - notifyClients(buffer, true); - } - - public int getConditionDamage() { - synchronized(objectMutex) { - return (int) baseline3.get("conditionDamage"); - } - } - - public void setConditionDamage(int conditionDamage) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("conditionDamage", conditionDamage); - } - - notifyClients(buffer, true); - } - - public int getMaximumCondition() { - synchronized(objectMutex) { - return (int) baseline3.get("maximumCondition"); - } - } - - public void setMaximumCondition(int maximumCondition) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("maximumCondition", maximumCondition); - } - - notifyClients(buffer, true); - } - - public boolean isStatic() { - synchronized(objectMutex) { - return (boolean) baseline3.get("isStatic"); - } - } - - public void setStatic(boolean isStatic) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("isStatic", isStatic); - } - - notifyClients(buffer, true); - } - - public void toggleStatic() { - setStatic(!isStatic()); - } - - public boolean inCombat() { - synchronized(objectMutex) { - return (boolean) baseline6.get("inCombat"); - } - } - - public void setInCombat(boolean inCombat) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline6.set("inCombat", inCombat); - } - - notifyClients(buffer, true); - } - - public void toggleCombat() { - setInCombat(!inCombat()); - } - - public List getDefendersList() { - return defendersList; - } - - // All objects can be in combat (terminal mission flag bases, tutorial target box) - public void addDefender(TangibleObject defender) { - defendersList.add(defender); - - if (!inCombat()) { - setInCombat(true); - } - } - - public void removeDefender(TangibleObject defender) { - defendersList.remove(defender); - - if (defendersList.isEmpty() && inCombat()) { - setInCombat(false); - } - } - - public int getPvPBitmask() { - synchronized(objectMutex) { - return (int) otherVariables.get("pvpBitmask"); - } - } - - public void setPvPBitmask(int pvpBitmask) { - synchronized(objectMutex) { - otherVariables.set("pvpBitmask", pvpBitmask); - } - } - - public boolean isAttackableBy(CreatureObject attacker) { - CreatureObject creature; - - if (this instanceof CreatureObject) { - creature = (CreatureObject) this; - - if (creature.getDuelList().contains(attacker) && attacker.getDuelList().contains(this)) { - return true; - } - } - - if (getFaction().equals("rebel") && attacker.getFaction().equals("rebel")) { - return false; - } else if (getFaction().equals("imperial") && attacker.getFaction().equals("imperial")) { - return false; - } else if(attacker.getSlottedObject("ghost") != null) { - if (this instanceof CreatureObject && getSlottedObject("ghost") != null) { - creature = (CreatureObject) this; - - if (creature.getFactionStatus() == 2 && attacker.getFactionStatus() == 2) { - return true; - } else { - return false; - } - } - - if ((getFaction().equals("rebel") || getFaction().equals("imperial")) && attacker.getFactionStatus() >= 1) { - return true; - } else if ((getFaction().equals("rebel") || getFaction().equals("imperial")) && attacker.getFactionStatus() == 0) { - return false; - } - - return getPvPBitmask() == 1 || getPvPBitmask() == 2; - } - - return getPvPBitmask() == 1 || getPvPBitmask() == 2; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public TangibleMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new TangibleMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - - @Override - public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) { - switch (viewType) { - case 3: - { - switch (updateType) { - case 7: - { - buffer = baseline3.createDelta(7, buffer.array()); - notifyClients(buffer, true); - break; - } - } - } - } - } - -} diff --git a/src/resources/z/exp/objects/universe/UniverseMessageBuilder.java b/src/resources/z/exp/objects/universe/UniverseMessageBuilder.java deleted file mode 100644 index d318a313..00000000 --- a/src/resources/z/exp/objects/universe/UniverseMessageBuilder.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.universe; - -import resources.z.exp.objects.ObjectMessageBuilder; - -public class UniverseMessageBuilder extends ObjectMessageBuilder { - - public UniverseMessageBuilder(UniverseObject object) { - super(object); - } - - public UniverseMessageBuilder() { - super(); - } - -} diff --git a/src/resources/z/exp/objects/universe/UniverseObject.java b/src/resources/z/exp/objects/universe/UniverseObject.java deleted file mode 100644 index e01bbf1e..00000000 --- a/src/resources/z/exp/objects/universe/UniverseObject.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.universe; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.object.BaseObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class UniverseObject extends BaseObject { - - @NotPersistent - private UniverseMessageBuilder messageBuilder; - - public UniverseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) { - super(objectID, planet, position, orientation, Template); - } - - public UniverseObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - return baseline; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, false); - } - - @Override - public UniverseMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new UniverseMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - - } - -} diff --git a/src/resources/z/exp/objects/waypoint/WaypointObject.java b/src/resources/z/exp/objects/waypoint/WaypointObject.java deleted file mode 100644 index 6539e172..00000000 --- a/src/resources/z/exp/objects/waypoint/WaypointObject.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.waypoint; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.common.StringUtilities; -import resources.objects.IDelta; -import resources.z.exp.objects.intangible.IntangibleObject; -import resources.z.exp.objects.Baseline; - -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent(version=0) -public class WaypointObject extends IntangibleObject implements IDelta { - - public static final byte BLUE, GREEN, ORANGE, YELLOW, PURPLE, WHITE, MULTICOLOR; - - static { - BLUE = 1; - GREEN = 2; - ORANGE = 3; - YELLOW = 4; - PURPLE = 5; - WHITE = 6; - MULTICOLOR = 7; - }; - - // WAYP 3 - private int cellId; - //private Point3D position = new Point3D(0, 0, 0); - private long targetId = 0; - private int planetCrc = 0; - private String name = "Waypoint"; - //private long waypointId = 0; - private byte color = 1; - private boolean isActive = false; - - public WaypointObject(long objectID, Planet planet, Point3D position) { - super(objectID, planet, position, new Quaternion(0, 0, 0, 1), "object/waypoint/shared_waypoint.iff"); - } - - public WaypointObject() { - super(); - } - - public int getCellId() { - synchronized(objectMutex) { - return cellId; - } - } - - public void setCellId(int cellId) { - synchronized(objectMutex) { - this.cellId = cellId; - } - } - - public long getTargetId() { - synchronized(objectMutex) { - return targetId; - } - } - - public void setTargetId(long targetId) { - synchronized(objectMutex) { - this.targetId = targetId; - } - } - - public int getPlanetCrc() { - synchronized(objectMutex) { - return planetCrc; - } - } - - public void setPlanetCrc(int planetCrc) { - synchronized(objectMutex) { - this.planetCrc = planetCrc; - } - } - - public String getName() { - synchronized(objectMutex) { - return name; - } - } - - public void setName(String name) { - synchronized(objectMutex) { - this.name = name; - } - } - - public byte getColor() { - synchronized(objectMutex) { - return color; - } - } - - public void setColor(byte color) { - synchronized(objectMutex) { - this.color = color; - } - } - - public boolean isActive() { - synchronized(objectMutex) { - return isActive; - } - } - - public void setActive(boolean isActive) { - synchronized(objectMutex) { - this.isActive = isActive; - } - } - - public void toggleActive() { - setActive(!isActive()); - } - - @Override - public void sendBaselines(Client destination) { - - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = IoBuffer.allocate(42, false).order(ByteOrder.LITTLE_ENDIAN).setAutoExpand(true); - buffer.putInt(cellId); - buffer.putFloat(getPosition().x); - buffer.putFloat(getPosition().y); - buffer.putFloat(getPosition().z); - buffer.putLong(targetId); - buffer.putInt(planetCrc); - buffer.put(StringUtilities.getUnicodeString(name)); - buffer.putLong(getObjectID()); - buffer.put(color); - buffer.put(Baseline.getBoolean(isActive)); - buffer.flip(); - return buffer.array(); - } - } - -} diff --git a/src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java b/src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java deleted file mode 100644 index 860f5bd2..00000000 --- a/src/resources/z/exp/objects/weapon/WeaponMessageBuilder.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.weapon; - -import java.util.Map; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.Builder; -import resources.z.exp.objects.tangible.TangibleMessageBuilder; - -public class WeaponMessageBuilder extends TangibleMessageBuilder { - - public WeaponMessageBuilder(WeaponObject weaponObject) { - super(weaponObject); - } - - public WeaponMessageBuilder() { - super(); - } - - @Override - public void buildBaseline3(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline3(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline6(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline6(baselineBuilders, deltaBuilders); - - baselineBuilders.put(13, new Builder() { - - public byte[] build() { - return Baseline.createBuffer(4).putInt(((WeaponObject) object).getWeaponType()).array(); - } - - }); - - deltaBuilders.put(13, new Builder() { - - public byte[] build() { - return Baseline.createBuffer(4).putInt(((WeaponObject) object).getWeaponType()).array(); - } - - }); - - } - - @Override - public void buildBaseline8(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline8(baselineBuilders, deltaBuilders); - } - - @Override - public void buildBaseline9(Map baselineBuilders, Map deltaBuilders) { - super.buildBaseline9(baselineBuilders, deltaBuilders); - } - -} diff --git a/src/resources/z/exp/objects/weapon/WeaponObject.java b/src/resources/z/exp/objects/weapon/WeaponObject.java deleted file mode 100644 index d1b92a7b..00000000 --- a/src/resources/z/exp/objects/weapon/WeaponObject.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* - * 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.z.exp.objects.weapon; - -import org.apache.mina.core.buffer.IoBuffer; - -import resources.z.exp.objects.Baseline; -import resources.z.exp.objects.tangible.TangibleObject; - -import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; - -import engine.clients.Client; -import engine.resources.scene.Planet; -import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; - -@Persistent -public class WeaponObject extends TangibleObject { - - @NotPersistent - private WeaponMessageBuilder messageBuilder; - - public WeaponObject(long objectID, Planet planet, String template) { - super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template); - } - - public WeaponObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String template) { - super(objectID, planet, position, orientation, template); - } - - public WeaponObject() { - super(); - } - - @Override - public void initializeBaselines() { - super.initializeBaselines(); - initializeBaseline(8); - initializeBaseline(9); - } - - @Override - public Baseline getOtherVariables() { - Baseline baseline = super.getOtherVariables(); - baseline.put("maxDamage", 0); - return baseline; - } - - @Override - public Baseline getBaseline3() { - Baseline baseline = super.getBaseline3(); - baseline.put("attackSpeed", (float) 1); - baseline.put("14", 0); - baseline.put("15", 0); - baseline.put("maxRange", calculateRange()); - baseline.put("17", 0); // Could be lightsaber color? Seen as 2 on a saber - baseline.put("18", 0); // something to do with particle color - baseline.put("19", 0); // something to do with particle color - return baseline; - } - - @Override - public Baseline getBaseline6() { - Baseline baseline = super.getBaseline6(); - baseline.put("weaponType", 0); - return baseline; - } - - @Override - public Baseline getBaseline8() { - Baseline baseline = super.getBaseline8(); - return baseline; - } - - @Override - public Baseline getBaseline9() { - Baseline baseline = super.getBaseline9(); - return baseline; - } - - public float getAttackSpeed() { - synchronized(objectMutex) { - return (float) baseline3.get("attackSpeed"); - } - } - - public void setAttackSpeed(float attackSpeed) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("attackSpeed", attackSpeed); - } - - notifyClients(buffer, false); - } - - private float calculateRange() { - int weaponType = getWeaponType(); - - switch (weaponType) { - case 4: - case 5: - case 6: - case 7: - case 9: - case 10: - case 11: - return 5; - case 2: - return 35; - case 1: - return 50; - case 0: - case 3: - case 8: - return 64; - default: - return 0; - } - } - - public float getMaxRange() { - synchronized(objectMutex) { - return (float) baseline3.get("maxRange"); - } - } - - public void setMaxRange(float maxRange) { - IoBuffer buffer; - - synchronized(objectMutex) { - buffer = baseline3.set("maxRange", maxRange); - } - - notifyClients(buffer, false); - } - - public int getWeaponType() { - String template = getTemplate(); - int weaponType = -1; - - synchronized(objectMutex) { - if (template == null) { - return weaponType; - } - - if (template.contains("rifle")) weaponType = 0; - if (template.contains("carbine")) weaponType = 1; - if (template.contains("pistol")) weaponType = 2; - if (template.contains("heavy")) weaponType = 3; - if (template.contains("sword") || template.contains("baton")) weaponType = 4; - if (template.contains("2h_sword") || template.contains("axe")) weaponType = 5; - if (template.contains("unarmed")) weaponType = 6; - if (template.contains("polearm") || template.contains("lance")) weaponType = 7; - if (template.contains("thrown")) weaponType = 8; - if (template.contains("lightsaber_one_handed")) weaponType = 9; - if (template.contains("lightsaber_two_handed")) weaponType = 10; - if (template.contains("lightsaber_polearm")) weaponType = 11; - - if (weaponType == -1) { - weaponType = 6; - } - - return weaponType; - } - } - - public int getMaxDamage() { - synchronized(objectMutex) { - return (int) otherVariables.get("maxDamage"); - } - } - - public void setMaxDamage(int maxDamage) { - synchronized(objectMutex) { - otherVariables.set("maxDamage", maxDamage); - } - } - - public boolean isMelee() { - int weaponType = getWeaponType(); - - if ((weaponType > 4 && weaponType < 8) || (weaponType > 8 && weaponType < 12)) { - return true; - } - - return false; - } - - public boolean isRanged() { - int weaponType = getWeaponType(); - - if (weaponType == 0 || weaponType == 1 || weaponType == 2 || weaponType == 3) { - return true; - } - - return false; - } - - @Override - public void notifyClients(IoBuffer buffer, boolean notifySelf) { - notifyObservers(buffer, notifySelf); - } - - @Override - public WeaponMessageBuilder getMessageBuilder() { - synchronized(objectMutex) { - if (messageBuilder == null) { - messageBuilder = new WeaponMessageBuilder(this); - } - - return messageBuilder; - } - } - - @Override - public void sendBaselines(Client destination) { - if (destination != null && destination.getSession() != null) { - //destination.getSession().write(baseline3.getBaseline()); - //destination.getSession().write(baseline6.getBaseline()); - //destination.getSession().write(baseline8.getBaseline()); - //destination.getSession().write(baseline9.getBaseline()); - } - } - -} diff --git a/src/resources/z/exp/quest/Quest.java b/src/resources/z/exp/quest/Quest.java deleted file mode 100644 index 9dfc1ae4..00000000 --- a/src/resources/z/exp/quest/Quest.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * 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.z.exp.quest; - -import resources.objects.Delta; - -public class Quest extends Delta { - - public Quest() { - - } - - public byte[] getBytes() { - return new byte[] { }; - } - -} diff --git a/src/resources/z/exp/skills/SkillMod.java b/src/resources/z/exp/skills/SkillMod.java deleted file mode 100644 index 82cdb237..00000000 --- a/src/resources/z/exp/skills/SkillMod.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * 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.z.exp.skills; - -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; - -import com.sleepycat.persist.model.Persistent; - -import resources.objects.Delta; - -// Proxy for engine.resources.objects.SkillMod so it uses Delta - -@Persistent -public class SkillMod extends Delta { - - private int base = 0; - private int modifier = 0; - - public SkillMod(int base, int modifier) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - this.base = skillMod.getBase(); - this.modifier = skillMod.getModifier(); - } - - public SkillMod() { - - } - - public int getBase() { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - return skillMod.getBase(); - } - } - - public void setBase(int base) { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(this.base); - skillMod.setModifier(modifier); - skillMod.setBase(base); - this.base = skillMod.getBase(); - } - } - - public int getModifier() { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - return skillMod.getModifier(); - } - } - - public void setModifier(int modifier) { - synchronized(objectMutex) { - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(this.modifier); - skillMod.setModifier(modifier); - this.modifier = skillMod.getModifier(); - } - } - - public byte[] getBytes() { - synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN); - engine.resources.objects.SkillMod skillMod = new engine.resources.objects.SkillMod(); - skillMod.setBase(base); - skillMod.setModifier(modifier); - buffer.putInt(skillMod.getBase()); - buffer.putInt(skillMod.getModifier()); - return buffer.array(); - } - } - -} From 697f24a45edaf2ad6c0da453ebcce57c5cdec0a0 Mon Sep 17 00:00:00 2001 From: Treeku Date: Mon, 3 Mar 2014 13:15:22 +0000 Subject: [PATCH 7/7] Fixed warnings, improvements --- src/protocol/swg/ChatFriendsListUpdate.java | 3 --- src/protocol/swg/SetWaypointColor.java | 2 -- .../objectControllerObjects/Animation.java | 1 - .../ChangeRoleIconChoice.java | 4 --- src/resources/common/Stf.java | 3 +-- src/resources/common/StringUtilities.java | 26 ++++++++++++------- src/resources/common/UString.java | 5 +--- .../gcw/CurrentServerGCWZoneHistory.java | 10 ++++--- .../gcw/CurrentServerGCWZonePercent.java | 9 ++++--- .../gcw/OtherServerGCWZonePercent.java | 10 ++++--- src/resources/guild/Guild.java | 22 +++++++++++----- src/resources/objects/Delta.java | 10 ++++--- src/services/travel/TravelPoint.java | 1 - 13 files changed, 58 insertions(+), 48 deletions(-) diff --git a/src/protocol/swg/ChatFriendsListUpdate.java b/src/protocol/swg/ChatFriendsListUpdate.java index bd6debb0..962b2ad2 100644 --- a/src/protocol/swg/ChatFriendsListUpdate.java +++ b/src/protocol/swg/ChatFriendsListUpdate.java @@ -6,9 +6,6 @@ import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.config.Config; -import engine.resources.config.DefaultConfig; - public class ChatFriendsListUpdate extends SWGMessage { private String friendName; diff --git a/src/protocol/swg/SetWaypointColor.java b/src/protocol/swg/SetWaypointColor.java index bb53cd75..f7a418d9 100644 --- a/src/protocol/swg/SetWaypointColor.java +++ b/src/protocol/swg/SetWaypointColor.java @@ -26,8 +26,6 @@ import java.nio.ByteBuffer; import org.apache.mina.core.buffer.IoBuffer; -import resources.common.StringUtilities; - public class SetWaypointColor extends SWGMessage { private long objectId; diff --git a/src/protocol/swg/objectControllerObjects/Animation.java b/src/protocol/swg/objectControllerObjects/Animation.java index 0997a01f..957cf7d2 100644 --- a/src/protocol/swg/objectControllerObjects/Animation.java +++ b/src/protocol/swg/objectControllerObjects/Animation.java @@ -26,7 +26,6 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; import protocol.swg.ObjControllerMessage; -import protocol.swg.SWGMessage; public class Animation extends ObjControllerObject { diff --git a/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java b/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java index 2cb16f10..7a458ead 100644 --- a/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java +++ b/src/protocol/swg/objectControllerObjects/ChangeRoleIconChoice.java @@ -21,12 +21,8 @@ ******************************************************************************/ package protocol.swg.objectControllerObjects; -import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.Utilities; - public class ChangeRoleIconChoice extends ObjControllerObject { private long objectId = 0; diff --git a/src/resources/common/Stf.java b/src/resources/common/Stf.java index 191b2a60..1ebfc72a 100644 --- a/src/resources/common/Stf.java +++ b/src/resources/common/Stf.java @@ -23,7 +23,6 @@ package resources.common; import org.apache.mina.core.buffer.IoBuffer; -import resources.z.exp.objects.Baseline; import resources.objects.Delta; import com.sleepycat.persist.model.Persistent; @@ -85,7 +84,7 @@ public class Stf extends Delta { synchronized(objectMutex) { int size = stfFilename.getBytes().length + 4 + stfName.getBytes().length; - IoBuffer buffer = Baseline.createBuffer(size); + IoBuffer buffer = createBuffer(size); buffer.put(stfFilename.getBytes()); buffer.putInt(spacer); buffer.put(stfName.getBytes()); diff --git a/src/resources/common/StringUtilities.java b/src/resources/common/StringUtilities.java index a28bf368..e7d34d3a 100644 --- a/src/resources/common/StringUtilities.java +++ b/src/resources/common/StringUtilities.java @@ -27,6 +27,8 @@ import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import engine.resources.common.Utilities; + public class StringUtilities { final protected static char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; @@ -166,16 +168,20 @@ public class StringUtilities { } public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - int v; - - for ( int j = 0; j < bytes.length; j++ ) { - v = bytes[j] & 0xFF; - hexChars[j * 2] = hexArray[v >>> 4]; - hexChars[j * 2 + 1] = hexArray[v & 0x0F]; - } - - return new String(hexChars); + char[] hexChars = new char[bytes.length * 2]; + int v; + + for ( int j = 0; j < bytes.length; j++ ) { + v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + + return new String(hexChars); + } + + public static void printBytes(byte[] bytes) { + System.out.println(Utilities.getHexString(bytes)); } } diff --git a/src/resources/common/UString.java b/src/resources/common/UString.java index 5aa290dc..dec215af 100644 --- a/src/resources/common/UString.java +++ b/src/resources/common/UString.java @@ -22,9 +22,6 @@ package resources.common; import java.io.UnsupportedEncodingException; -import java.nio.ByteOrder; - -import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; @@ -64,7 +61,7 @@ public final class UString extends Delta { public byte[] getBytes() { synchronized(objectMutex) { try { - return IoBuffer.allocate(4 + string.length(), false).order(ByteOrder.LITTLE_ENDIAN).putInt(string.length()).put(string.getBytes("UTF-16LE")).flip().array(); + return createBuffer(4 + (string.length() * 2)).putInt(string.length()).put(string.getBytes("UTF-16LE")).flip().array(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return new byte[] { 0x00, 0x00, 0x00, 0x00 }; diff --git a/src/resources/gcw/CurrentServerGCWZoneHistory.java b/src/resources/gcw/CurrentServerGCWZoneHistory.java index a7a77e98..66874d64 100644 --- a/src/resources/gcw/CurrentServerGCWZoneHistory.java +++ b/src/resources/gcw/CurrentServerGCWZoneHistory.java @@ -21,15 +21,13 @@ ******************************************************************************/ package resources.gcw; -import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; -@Persistent +@Persistent(version=0) public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { private int lastUpdateTime; @@ -40,6 +38,10 @@ public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { this.lastUpdateTime = zone.getLastUpdateTime(); } + public CurrentServerGCWZoneHistory() { + + } + public int getLastUpdateTime() { synchronized(objectMutex) { return lastUpdateTime; @@ -54,7 +56,7 @@ public class CurrentServerGCWZoneHistory extends Delta implements Cloneable { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((8), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer(8); buffer.putInt(lastUpdateTime); buffer.putInt(percent); return buffer.array(); diff --git a/src/resources/gcw/CurrentServerGCWZonePercent.java b/src/resources/gcw/CurrentServerGCWZonePercent.java index 09034cf6..ea825d7a 100644 --- a/src/resources/gcw/CurrentServerGCWZonePercent.java +++ b/src/resources/gcw/CurrentServerGCWZonePercent.java @@ -23,7 +23,6 @@ package resources.gcw; import java.math.BigDecimal; import java.math.MathContext; -import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; @@ -33,7 +32,7 @@ import engine.resources.scene.Point2D; import resources.objects.Delta; -@Persistent +@Persistent(version=0) public class CurrentServerGCWZonePercent extends Delta implements Cloneable { private Point2D position; @@ -53,6 +52,10 @@ public class CurrentServerGCWZonePercent extends Delta implements Cloneable { this.percent = new BigDecimal("50.0", MathContext.DECIMAL128); } + public CurrentServerGCWZonePercent() { + + } + public Point2D getPosition() { synchronized(objectMutex) { return position.clone(); @@ -148,7 +151,7 @@ public class CurrentServerGCWZonePercent extends Delta implements Cloneable { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer(4); buffer.putInt(percent.intValue()); return buffer.array(); } diff --git a/src/resources/gcw/OtherServerGCWZonePercent.java b/src/resources/gcw/OtherServerGCWZonePercent.java index a006d7a8..ab8048eb 100644 --- a/src/resources/gcw/OtherServerGCWZonePercent.java +++ b/src/resources/gcw/OtherServerGCWZonePercent.java @@ -21,15 +21,13 @@ ******************************************************************************/ package resources.gcw; -import java.nio.ByteOrder; - import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import resources.objects.Delta; -@Persistent +@Persistent(version=0) public class OtherServerGCWZonePercent extends Delta implements Cloneable { private String zone = ""; @@ -39,6 +37,10 @@ public class OtherServerGCWZonePercent extends Delta implements Cloneable { this.zone = zone; } + public OtherServerGCWZonePercent() { + + } + public String getZone() { synchronized(objectMutex) { return zone; @@ -60,7 +62,7 @@ public class OtherServerGCWZonePercent extends Delta implements Cloneable { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((2 + zone.length() + 4), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer((2 + zone.length() + 4)); buffer.put(getAsciiString(zone)); buffer.putInt(percent); return buffer.array(); diff --git a/src/resources/guild/Guild.java b/src/resources/guild/Guild.java index 1cebf0f6..5651c2d0 100644 --- a/src/resources/guild/Guild.java +++ b/src/resources/guild/Guild.java @@ -21,15 +21,17 @@ ******************************************************************************/ package resources.guild; -import java.nio.ByteOrder; import java.util.List; import org.apache.mina.core.buffer.IoBuffer; +import com.sleepycat.persist.model.Persistent; + import resources.objects.Delta; import engine.resources.objects.SWGObject; +@Persistent(version=0) public class Guild extends Delta { private int id; @@ -46,6 +48,10 @@ public class Guild extends Delta { this.members.add(leader); } + public Guild() { + + } + public int getId() { synchronized(objectMutex) { return id; @@ -83,17 +89,19 @@ public class Guild extends Delta { } public String getString() { - synchronized(objectMutex) { - return (Integer.toString(id) + ":" + abbreviation); - } + return (Integer.toString(getId()) + ":" + getAbbreviation()); } public SWGObject getLeader() { - return leader; + synchronized(objectMutex) { + return leader; + } } public void setLeader(SWGObject leader) { - this.leader = leader; + synchronized(objectMutex) { + this.leader = leader; + } } public List getMembers() { @@ -102,7 +110,7 @@ public class Guild extends Delta { public byte[] getBytes() { synchronized(objectMutex) { - IoBuffer buffer = bufferPool.allocate((getString().length() + 2), false).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = createBuffer((getString().length() + 2)); buffer.put(getAsciiString(getString())); return buffer.array(); } diff --git a/src/resources/objects/Delta.java b/src/resources/objects/Delta.java index f33de22c..31782741 100644 --- a/src/resources/objects/Delta.java +++ b/src/resources/objects/Delta.java @@ -22,8 +22,10 @@ package resources.objects; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.buffer.SimpleBufferAllocator; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; @@ -34,10 +36,12 @@ import resources.common.StringUtilities; public abstract class Delta implements IDelta { @NotPersistent - protected final Object objectMutex; + protected final Object objectMutex = new Object(); + @NotPersistent + private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator(); public Delta() { - objectMutex = new Object(); + } protected String getAsciiString(ByteBuffer buffer) { @@ -61,7 +65,7 @@ public abstract class Delta implements IDelta { } public static IoBuffer createBuffer(int size) { - return Baseline.createBuffer(size); + return bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN); } } diff --git a/src/services/travel/TravelPoint.java b/src/services/travel/TravelPoint.java index 2d76137c..bf2977dc 100644 --- a/src/services/travel/TravelPoint.java +++ b/src/services/travel/TravelPoint.java @@ -23,7 +23,6 @@ package services.travel; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; import resources.common.Console; import resources.common.SpawnPoint;