Refactored odb system (read extended), added implementation of Dynamic World Spawns

ODB no longer uses DPL layer of Berkeley DB, persistent classes have to
implement the Serializable interface, annotations are no longer used,
use transient modifier for variables that should not be persistent.
Entity reference errors will no longer occur, however it is better to
use ids if the entity that is being referenced is stored in the db too!
(or you will have two different objects). DB is cached for 5 minutes
then it will write its log/cache to disk, transactions are no longer
used.
This commit is contained in:
Light2
2014-05-01 20:33:38 +02:00
parent 97743da840
commit 7d457101f3
68 changed files with 650 additions and 375 deletions
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledFuture;
@@ -39,10 +40,11 @@ import com.sleepycat.persist.model.Persistent;
import engine.resources.common.CRC;
@Persistent(version=10)
public class Buff implements IDelta {
public class Buff implements IDelta, Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
private SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
private transient SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
private String group1, group2;
private int priority;
private float duration;
@@ -64,7 +66,7 @@ public class Buff implements IDelta {
private int totalPlayTime;
private byte decayCounter = 0;
@NotPersistent
private ScheduledFuture<?> removalTask;
private transient ScheduledFuture<?> removalTask;
private int stacks = 1;
private long groupBufferId;
private int buffCRC;
+5 -1
View File
@@ -21,10 +21,14 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
@Persistent
public class BuffItem {
public class BuffItem implements Serializable {
private static final long serialVersionUID = 1L;
private int affectAmount;
private int entertainerBonus;
private int invested;
+4 -2
View File
@@ -21,20 +21,22 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.util.concurrent.ScheduledFuture;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
@Persistent(version=1)
public class DamageOverTime {
public class DamageOverTime implements Serializable {
private static final long serialVersionUID = 1L;
private Buff buff;
private String type;
private int duration;
private int intensity;
@NotPersistent
private ScheduledFuture<?> task;
private transient ScheduledFuture<?> task;
private long startTime;
private String commandName;
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -33,12 +34,13 @@ import com.sleepycat.persist.model.Persistent;
import resources.common.StringUtilities;
@Persistent
public abstract class Delta implements IDelta {
public abstract class Delta implements IDelta, Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
@NotPersistent
private static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
private transient static SimpleBufferAllocator bufferPool = new SimpleBufferAllocator();
public Delta() {
+3 -1
View File
@@ -21,10 +21,12 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
@Persistent
public interface IDelta {
public interface IDelta {
public byte[] getBytes();
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,16 +44,17 @@ import com.sleepycat.persist.model.Persistent;
/* A SWGList element MUST implement IDelta, or it will refuse to work with it */
@Persistent
public class SWGList<E> implements List<E> {
public class SWGList<E> implements List<E>, Serializable {
private static final long serialVersionUID = 1L;
private List<E> list = new ArrayList<E>();
@NotPersistent
private int updateCounter = 1;
private transient int updateCounter = 1;
private ObjectMessageBuilder messageBuilder;
private byte viewType;
private short updateType;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
public SWGList() { }
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collection;
@@ -43,16 +44,17 @@ import com.sleepycat.persist.model.Persistent;
@SuppressWarnings("unused")
@Persistent
public class SWGMap<K, V> implements Map<K, V> {
public class SWGMap<K, V> implements Map<K, V>, Serializable {
private static final long serialVersionUID = 1L;
private Map<K, V> map = new TreeMap<K, V>();
@NotPersistent
private int updateCounter = 0;
private transient int updateCounter = 0;
private ObjectMessageBuilder messageBuilder;
private byte viewType;
private short updateType;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
public SWGMap() { }
+5 -3
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collection;
@@ -46,16 +47,17 @@ import com.sleepycat.persist.model.Persistent;
@SuppressWarnings("unused")
@Persistent
public class SWGMultiMap<K, V> implements Multimap<K, V> {
public class SWGMultiMap<K, V> implements Multimap<K, V>, Serializable {
private static final long serialVersionUID = 1L;
private Multimap<K, V> map = ArrayListMultimap.create();
@NotPersistent
private int updateCounter = 0;
private transient int updateCounter = 0;
private ObjectMessageBuilder messageBuilder;
private byte viewType;
private short updateType;
@NotPersistent
protected final Object objectMutex = new Object();
protected transient final Object objectMutex = new Object();
public SWGMultiMap() { }
+5 -1
View File
@@ -21,13 +21,17 @@
******************************************************************************/
package resources.objects;
import java.io.Serializable;
import org.apache.mina.core.buffer.IoBuffer;
import com.sleepycat.persist.model.Persistent;
@Persistent(version=0)
public class SkillMod extends Delta {
public class SkillMod extends Delta implements Serializable {
private static final long serialVersionUID = 1L;
private int base;
private int modifier;
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.building;
import java.io.Serializable;
import java.util.Vector;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -44,12 +45,13 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Entity(version=6)
public class BuildingObject extends TangibleObject implements IPersistent {
public class BuildingObject extends TangibleObject implements IPersistent, Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
private BuildingMessageBuilder messageBuilder;
private transient BuildingMessageBuilder messageBuilder;
@NotPersistent
private Transaction txn;
private transient Transaction txn;
private float maintenanceAmount = 0;
private int BMR = 0;
+6 -2
View File
@@ -21,10 +21,13 @@
******************************************************************************/
package resources.objects.cell;
import java.io.Serializable;
import protocol.swg.UpdateCellPermissionMessage;
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;
@@ -32,11 +35,12 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class CellObject extends SWGObject {
public class CellObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
private int cellNumber = 0;
@NotPersistent
private CellMessageBuilder messageBuilder;
private transient CellMessageBuilder messageBuilder;
public CellObject() {
super();
@@ -21,7 +21,10 @@
******************************************************************************/
package resources.objects.craft;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
@@ -29,9 +32,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent
public class DraftSchematic extends SWGObject {
public class DraftSchematic extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
public DraftSchematic(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
super(objectID, planet, position, orientation, template);
}
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.creature;
import java.io.Serializable;
import java.lang.System;
import java.util.ArrayList;
import java.util.Collections;
@@ -68,17 +69,16 @@ import resources.objects.tangible.TangibleObject;
import services.command.BaseSWGCommand;
@Entity(version=9)
public class CreatureObject extends TangibleObject implements IPersistent {
public class CreatureObject extends TangibleObject implements Serializable {
@NotPersistent
private Transaction txn;
private static final long serialVersionUID = 1L;
// CREO 1
private int bankCredits = 0;
private int cashCredits = 0;
private List<String> skills;
@NotPersistent
private int skillsUpdateCounter = 0;
private transient int skillsUpdateCounter = 0;
// CREO 3
private byte posture = 0;
@@ -105,7 +105,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private SWGList<MissionCriticalObject> missionCriticalObjects;
@NotPersistent
private int missionCriticalObjectsUpdateCounter = 0;
private transient int missionCriticalObjectsUpdateCounter = 0;
// CREO6
@@ -130,30 +130,30 @@ public class CreatureObject extends TangibleObject implements IPersistent {
private boolean acceptBandflourishes = true;
private boolean groupDance = true;
@NotPersistent
private CreatureObject performanceWatchee;
private transient CreatureObject performanceWatchee;
@NotPersistent
private CreatureObject performanceListenee;
private transient CreatureObject performanceListenee;
@NotPersistent
private Vector<CreatureObject> performanceAudience = new Vector<CreatureObject>();
private transient Vector<CreatureObject> performanceAudience = new Vector<CreatureObject>();
private int health = 1000;
private int action = 300;
@NotPersistent
private int HAMListCounter = 0;
private transient int HAMListCounter = 0;
private int maxHealth = 1000;
private int maxAction = 300;
@NotPersistent
private int maxHAMListCounter = 0;
private transient int maxHAMListCounter = 0;
private SWGList<SWGObject> equipmentList;
@NotPersistent
private int equipmentListUpdateCounter = 0;
private transient int equipmentListUpdateCounter = 0;
private SWGList<Buff> buffList = new SWGList<Buff>();
@NotPersistent
private int buffListUpdateCounter = 0;
private transient int buffListUpdateCounter = 0;
private byte difficulty = 0;
private SWGList<SWGObject> appearanceEquipmentList;
@NotPersistent
private int appearanceEquipmentListUpdateCounter = 0;
private transient int appearanceEquipmentListUpdateCounter = 0;
private boolean inStealth = false;
private boolean radarVisible = true; // radar
@@ -161,34 +161,34 @@ public class CreatureObject extends TangibleObject implements IPersistent {
// non-baseline vars
@NotPersistent
private List<CreatureObject> duelList = Collections.synchronizedList(new ArrayList<CreatureObject>());
private transient List<CreatureObject> duelList = Collections.synchronizedList(new ArrayList<CreatureObject>());
@NotPersistent
private CreatureMessageBuilder messageBuilder;
private transient CreatureMessageBuilder messageBuilder;
private SWGList<DamageOverTime> dotList = new SWGList<DamageOverTime>();
@NotPersistent
private ScheduledFuture<?> incapTask;
private transient ScheduledFuture<?> incapTask;
@NotPersistent
private ScheduledFuture<?> entertainerExperience;
private transient ScheduledFuture<?> entertainerExperience;
@NotPersistent
private ScheduledFuture<?> inspirationTick;
private transient ScheduledFuture<?> inspirationTick;
@NotPersistent
private ScheduledFuture<?> spectatorTask;
private transient ScheduledFuture<?> spectatorTask;
private boolean staticNPC = false; // temp
@NotPersistent
private int flourishCount = 0;
private transient int flourishCount = 0;
@NotPersistent
private boolean performingEffect;
private transient boolean performingEffect;
@NotPersistent
private boolean performingFlourish;
private transient boolean performingFlourish;
private int coverCharge;
@NotPersistent
private TangibleObject conversingNpc;
private transient TangibleObject conversingNpc;
@NotPersistent
private ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
private transient ConcurrentHashMap<String, Long> cooldowns = new ConcurrentHashMap<String, Long>();
@NotPersistent
private long tefTime = System.currentTimeMillis();
private transient long tefTime = System.currentTimeMillis();
public CreatureObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
super(objectID, planet, Template, position, orientation);
@@ -226,10 +226,6 @@ public class CreatureObject extends TangibleObject implements IPersistent {
notifyObservers(messageBuilder.buildCustomNameDelta(customName), true);
}
public Transaction getTransaction() { return txn; }
public void createTransaction(Environment env) { txn = env.beginTransaction(null, null); }
public int getBankCredits() {
synchronized(objectMutex) {
@@ -21,11 +21,11 @@
******************************************************************************/
package resources.objects.factorycrate;
import java.io.Serializable;
import java.util.Map;
import java.util.Vector;
import main.NGECore;
import protocol.swg.SceneCreateObjectByCrc;
import protocol.swg.SceneDestroyObject;
import protocol.swg.SceneEndBaselines;
@@ -41,7 +41,6 @@ import engine.resources.objects.SWGObject;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.creature.CreatureObject;
import resources.objects.tangible.TangibleObject;
@@ -50,8 +49,10 @@ import resources.objects.tangible.TangibleObject;
*/
@Persistent(version=0)
public class FactoryCrateObject extends TangibleObject {
public class FactoryCrateObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private Vector<TangibleObject> contents;
private byte capacity;
private byte contentObjectQuantity;
@@ -59,7 +60,7 @@ public class FactoryCrateObject extends TangibleObject {
private TangibleObject contentObjectType;
@NotPersistent
private FactoryCrateMessageBuilder messageBuilder;
private transient FactoryCrateMessageBuilder messageBuilder;
public FactoryCrateObject() {
+1 -1
View File
@@ -21,10 +21,10 @@
******************************************************************************/
package resources.objects.group;
import java.io.Serializable;
import java.util.Vector;
import resources.objects.universe.UniverseObject;
import engine.clients.Client;
import engine.resources.objects.SWGObject;
import engine.resources.scene.Point3D;
+4 -12
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.guild;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
@@ -28,7 +29,6 @@ import java.util.TreeMap;
import org.apache.mina.core.buffer.IoBuffer;
import main.NGECore;
import resources.gcw.CurrentServerGCWZoneHistory;
import resources.gcw.CurrentServerGCWZonePercent;
import resources.gcw.OtherServerGCWZonePercent;
@@ -51,16 +51,15 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Entity(version=1)
public class GuildObject extends UniverseObject implements IPersistent {
public class GuildObject extends UniverseObject implements Serializable {
private static final long serialVersionUID = 1L;
protected NGECore core;
@NotPersistent
private GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this);
private transient GuildMessageBuilder messageBuilder = new GuildMessageBuilder(this);
private Map<String, ServerFirst> serverFirst = new HashMap<String, ServerFirst>();
private Map<String, Map<String, CurrentServerGCWZonePercent>> zoneMap = new TreeMap<String, Map<String, CurrentServerGCWZonePercent>>();
@NotPersistent
private Transaction txn;
private long nextInstanceId = 0;
@@ -302,12 +301,5 @@ public class GuildObject extends UniverseObject implements IPersistent {
}
}
public Transaction getTransaction() {
return txn;
}
public void createTransaction(Environment env) {
txn = env.beginTransaction(null, null);
}
}
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.harvester;
import java.io.Serializable;
import java.util.Vector;
import main.NGECore;
@@ -42,8 +43,10 @@ import resources.objects.resource.ResourceContainerObject;
*/
@Persistent(version=0)
public class HarvesterObject extends InstallationObject {
public class HarvesterObject extends InstallationObject implements Serializable {
private static final long serialVersionUID = 1L;
private HarvesterMessageBuilder messageBuilder;
private InstallationMessageBuilder installationMessageBuilder;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.installation;
import java.io.Serializable;
import com.sleepycat.persist.model.Entity;
import engine.clients.Client;
@@ -30,8 +32,10 @@ import engine.resources.scene.Quaternion;
import resources.objects.tangible.TangibleObject;
@Entity(version=0)
public class InstallationObject extends TangibleObject {
public class InstallationObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
public InstallationObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation){
super(objectID, planet, template, position, orientation);
}
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.intangible;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
@@ -30,8 +32,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class IntangibleObject extends SWGObject {
public class IntangibleObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
private int genericInt;
public IntangibleObject() {
+5 -1
View File
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.loot;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
/**
@@ -28,8 +30,10 @@ import com.sleepycat.persist.model.Persistent;
*/
@Persistent(version=0)
public class LootGroup {
public class LootGroup implements Serializable {
private static final long serialVersionUID = 1L;
private String[] lootPoolNames;
private double[] lootPoolChances;
private double lootGroupChance;
@@ -22,8 +22,12 @@
package resources.objects.manufacture;
import java.io.Serializable;
import resources.objects.intangible.IntangibleObject;
import com.sleepycat.persist.model.Persistent;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@@ -34,8 +38,9 @@ import engine.resources.scene.Quaternion;
*/
@Persistent(version=0)
public class ManufactureSchematicObject extends IntangibleObject{
public class ManufactureSchematicObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
//@NotPersistent
//private ManufactureSchematicMessageBuilder messageBuilder;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.mission;
import java.io.Serializable;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.model.NotPersistent;
@@ -36,8 +38,9 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=1)
public class MissionObject extends IntangibleObject implements IPersistent {
public class MissionObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private Point3D destination;
private Point3D startLocation;
private String startPlanet = "";
@@ -56,11 +59,8 @@ public class MissionObject extends IntangibleObject implements IPersistent {
private MissionObjective objective;
@NotPersistent
MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this);
@NotPersistent
private Transaction txn;
private transient MissionMessageBuilder messageBuilder = new MissionMessageBuilder(this);
public MissionObject() {
super();
}
@@ -286,14 +286,6 @@ public class MissionObject extends IntangibleObject implements IPersistent {
this.missionId = missionId;
}
public Transaction getTransaction() {
return txn;
}
public void createTransaction(Environment env) {
txn = env.beginTransaction(null, null);
}
@Override
public void sendBaselines(Client destination) {
+12 -10
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.player;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.HashMap;
@@ -45,8 +46,9 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=13)
public class PlayerObject extends IntangibleObject {
public class PlayerObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
// PLAY 3
private String title;
@@ -71,11 +73,11 @@ public class PlayerObject extends IntangibleObject {
private Map<String, Integer> xpList = new HashMap<String, Integer>();
@NotPersistent
private int xpListUpdateCounter = 0;
private transient int xpListUpdateCounter = 0;
private List<WaypointObject> waypoints = new ArrayList<WaypointObject>();
@NotPersistent
private int waypointListUpdateCounter = 0;
private transient int waypointListUpdateCounter = 0;
private int currentForcePower = 0; // unused in NGE
private int maxForcePower = 0; // unused in NGE
@@ -85,7 +87,7 @@ public class PlayerObject extends IntangibleObject {
private List<Quest> questJournal = new ArrayList<Quest>();
@NotPersistent
private int questJournalUpdateCounter = 0;
private transient int questJournalUpdateCounter = 0;
private String professionWheelPosition;
@@ -97,17 +99,17 @@ public class PlayerObject extends IntangibleObject {
private List<DraftSchematic> draftSchematicList = new ArrayList<DraftSchematic>();
@NotPersistent
private int draftSchematicListUpdateCounter = 0;
private transient int draftSchematicListUpdateCounter = 0;
private int experimentationPoints = 0;
private int accomplishmentCounter = 0;
private List<String> friendList = new ArrayList<String>();
@NotPersistent
private int friendListUpdateCounter = 0;
private transient int friendListUpdateCounter = 0;
private List<String> ignoreList = new ArrayList<String>();
@NotPersistent
private int ignoreListUpdateCounter = 0;
private transient int ignoreListUpdateCounter = 0;
private int languageId = 0; // unused in NGE
private int currentStomach = 0; // unused in NGE
@@ -129,10 +131,10 @@ public class PlayerObject extends IntangibleObject {
private int lotsRemaining = 10;
@NotPersistent
private PlayerMessageBuilder messageBuilder;
private transient PlayerMessageBuilder messageBuilder;
@NotPersistent
private long lastPlayTimeUpdate = System.currentTimeMillis();
private transient long lastPlayTimeUpdate = System.currentTimeMillis();
private Map<String, Integer> factionStandingMap = new TreeMap<String, Integer>();
@@ -145,7 +147,7 @@ public class PlayerObject extends IntangibleObject {
private List<Integer> chatChannels = new ArrayList<Integer>();
@NotPersistent
private boolean callingCompanion = false;
private transient boolean callingCompanion = false;
public PlayerObject() {
super();
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.resource;
import java.io.Serializable;
import java.util.List;
import java.util.Random;
import java.util.Vector;
@@ -48,10 +49,9 @@ import engine.resources.scene.Quaternion;
*/
@Entity(version=0)
public class GalacticResource extends SWGObject implements IPersistent {
public class GalacticResource extends SWGObject implements Serializable {
@NotPersistent
private Transaction txn;
private static final long serialVersionUID = 1L;
private String name;
private String fileName;
@@ -63,30 +63,30 @@ public class GalacticResource extends SWGObject implements IPersistent {
@NotPersistent
public static final int INT_COLDRESISTANCE = 0;
public transient static final int INT_COLDRESISTANCE = 0;
@NotPersistent
public static final int INT_CONDUCTIVITY = 1;
public transient static final int INT_CONDUCTIVITY = 1;
@NotPersistent
public static final int INT_DECAYRESISTANCE = 2;
public transient static final int INT_DECAYRESISTANCE = 2;
@NotPersistent
public static final int INT_HEATRESISTANCE = 3;
public transient static final int INT_HEATRESISTANCE = 3;
@NotPersistent
public static final int INT_MALLEABILITY = 4;
public transient static final int INT_MALLEABILITY = 4;
@NotPersistent
public static final int INT_SHOCKRESISTANCE = 5;
public transient static final int INT_SHOCKRESISTANCE = 5;
@NotPersistent
public static final int INT_UNITTOUGHNESS = 6;
public transient static final int INT_UNITTOUGHNESS = 6;
@NotPersistent
public static final int INT_ENTANGLERESISTANCE = 7;
public transient static final int INT_ENTANGLERESISTANCE = 7;
@NotPersistent
public static final int INT_POTENTIALENERGY = 8;
public transient static final int INT_POTENTIALENERGY = 8;
@NotPersistent
public static final int INT_OVERALLQUALITY = 9;
public transient static final int INT_OVERALLQUALITY = 9;
@NotPersistent
public static final int INT_FLAVOR = 10;
public transient static final int INT_FLAVOR = 10;
@NotPersistent
public static final String[] statNamesLookup = {"Cold Resistance",
public transient static final String[] statNamesLookup = {"Cold Resistance",
"Conductivity",
"Decay Resistance",
"Heat Resistance",
@@ -117,16 +117,16 @@ public class GalacticResource extends SWGObject implements IPersistent {
short[] resourceStats = new short[11];
@NotPersistent
private static int RES_CAT_HI = 1; // Up to 99%, easy to find spots over 90%
private transient static int RES_CAT_HI = 1; // Up to 99%, easy to find spots over 90%
@NotPersistent
private static int RES_CAT_MID = 2; // Up to 90%, often have to settle at around 80%
private transient static int RES_CAT_MID = 2; // Up to 90%, often have to settle at around 80%
@NotPersistent
private static int RES_CAT_LO = 3; // Up to 70%, often have to settle around 60%
private transient static int RES_CAT_LO = 3; // Up to 70%, often have to settle around 60%
@NotPersistent
private static int RES_CAT_CRE = 4; // Creature resource
private transient static int RES_CAT_CRE = 4; // Creature resource
@NotPersistent // Direct Persistence Layer entity reference restriction
private ResourceRoot resourceRoot;
private transient ResourceRoot resourceRoot;
private int resourceRootID; // This is for re-referencing the resourceRoot in the reloaded resourceRoot collection
// due to the DPL entity reference restriction
@@ -633,13 +633,6 @@ public class GalacticResource extends SWGObject implements IPersistent {
"zau"};
@Override
public void createTransaction(Environment env) { txn = env.beginTransaction(null, null);}
@Override
public Transaction getTransaction() { return txn; }
@Override
public void sendBaselines(Client arg0) {
}
@@ -1,12 +1,14 @@
package resources.objects.resource;
import java.io.Serializable;
import java.util.List;
import com.sleepycat.persist.model.Persistent;
@Persistent(version=0)
public class PlanetDeposits {
public class PlanetDeposits implements Serializable {
private static final long serialVersionUID = 1L;
private int planetId;
private List<ResourceDeposit> depositList;
@@ -22,6 +22,8 @@
package resources.objects.resource;
import java.io.Serializable;
import main.NGECore;
import com.sleepycat.persist.model.NotPersistent;
@@ -40,8 +42,9 @@ import resources.objects.tangible.TangibleObject;
*/
@Persistent(version=0)
public class ResourceContainerObject extends TangibleObject {
public class ResourceContainerObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
// Unique ID
private long containerID;
@@ -131,10 +134,10 @@ public class ResourceContainerObject extends TangibleObject {
*/
@NotPersistent
public static int maximalStackCapacity = 100000;
public transient static int maximalStackCapacity = 100000;
@NotPersistent
private ResourceContainerMessageBuilder messageBuilder;
private transient ResourceContainerMessageBuilder messageBuilder;
public ResourceContainerObject(){
@@ -1,5 +1,7 @@
package resources.objects.resource;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
/**
@@ -7,7 +9,9 @@ import com.sleepycat.persist.model.Persistent;
*/
@Persistent(version=0)
public class ResourceDeposit {
public class ResourceDeposit implements Serializable {
private static final long serialVersionUID = 1L;
private float spawnCoordsX;
private float spawnCoordsZ;
private float spawnRadius;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.resource;
import java.io.Serializable;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.persist.model.Entity;
@@ -32,8 +34,9 @@ import com.sleepycat.persist.model.PrimaryKey;
*/
@Entity(version=0)
public class ResourceRoot {
public class ResourceRoot implements Serializable {
private static final long serialVersionUID = 1L;
// Publish 15:
// - Total: 61, Minimum pool: 15, Random pool: 24 (3 was removed), Fixed pool: 22.
@@ -84,7 +87,7 @@ public class ResourceRoot {
// All 38 Organic types for each planet
@NotPersistent
private Transaction txn;
private transient Transaction txn;
private static int highestID = 0;
+5 -2
View File
@@ -21,11 +21,14 @@
******************************************************************************/
package resources.objects.ship;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
import resources.objects.tangible.TangibleObject;
@Persistent(version=0)
public class ShipObject extends TangibleObject {
public class ShipObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
}
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.staticobject;
import java.io.Serializable;
import com.sleepycat.persist.model.NotPersistent;
import com.sleepycat.persist.model.Persistent;
@@ -31,10 +33,11 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class StaticObject extends SWGObject {
public class StaticObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
@NotPersistent
private StaticMessageBuilder messageBuilder;
private transient StaticMessageBuilder messageBuilder;
public StaticObject() {
super();
@@ -22,6 +22,7 @@
package resources.objects.tangible;
import java.io.ByteArrayOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -55,8 +56,9 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=12)
public class TangibleObject extends SWGObject {
public class TangibleObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
// TODO: Thread safety
protected int incapTimer = 10;
@@ -72,9 +74,9 @@ public class TangibleObject extends SWGObject {
protected String faction = ""; // Says you're "Imperial Special Forces" if it's 0 for some reason
protected int factionStatus = 0;
@NotPersistent
private Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
private transient Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
@NotPersistent
private TangibleMessageBuilder messageBuilder;
private transient TangibleMessageBuilder messageBuilder;
private int respawnTime = 0;
private Point3D spawnCoordinates = new Point3D(0, 0, 0);
@@ -83,13 +85,13 @@ public class TangibleObject extends SWGObject {
private List<LootGroup> lootGroups = new ArrayList<LootGroup>();
@NotPersistent
private boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart
private transient boolean looted = false; // These 4 should not need to be persisted, since a looted corpse will get wiped with server restart
@NotPersistent
private boolean lootLock = false;
private transient boolean lootLock = false;
@NotPersistent
private boolean creditRelieved = false;
private transient boolean creditRelieved = false;
@NotPersistent
private boolean lootItem = false;
private transient boolean lootItem = false;
private boolean stackable = false;
private int stackCount = 1;
@@ -101,7 +103,7 @@ public class TangibleObject extends SWGObject {
private String serialNumber;
@NotPersistent
private TangibleObject killer = null;
private transient TangibleObject killer = null;
public TangibleObject(long objectID, Planet planet, String template) {
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template);
+13 -11
View File
@@ -21,6 +21,7 @@
******************************************************************************/
package resources.objects.tool;
import java.io.Serializable;
import java.util.Vector;
import main.NGECore;
@@ -41,8 +42,9 @@ import resources.objects.tangible.TangibleObject;
*/
@Persistent(version=0)
public class SurveyTool extends TangibleObject{
public class SurveyTool extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private byte toolType=0;
private long surveyResourceID;
private long userID=0;
@@ -50,25 +52,25 @@ public class SurveyTool extends TangibleObject{
private byte SurveyRangeSetting=0;
@NotPersistent
private String surveyEffectString="";
private transient String surveyEffectString="";
@NotPersistent
private String sampleEffectString="";
private transient String sampleEffectString="";
@NotPersistent
private boolean currentlySurveying=false;
private transient boolean currentlySurveying=false;
@NotPersistent
private boolean currentlySampling=false;
private transient boolean currentlySampling=false;
@NotPersistent
private boolean currentlyCoolingDown=false;
private transient boolean currentlyCoolingDown=false;
@NotPersistent
private boolean exceptionalState=false;
private transient boolean exceptionalState=false;
@NotPersistent
private boolean recoveryMode=false;
private transient boolean recoveryMode=false;
@NotPersistent
private Long lastSurveyTime=0L;
private transient Long lastSurveyTime=0L;
@NotPersistent
private Long lastSampleTime=0L;
private transient Long lastSampleTime=0L;
@NotPersistent
private Long recoveryTime=10L;
private transient Long recoveryTime=10L;
public static byte MineralSurveyDevice = 1;
public static byte ChemicalSurveyDevice = 2;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.universe;
import java.io.Serializable;
import com.sleepycat.persist.model.Persistent;
import engine.clients.Client;
@@ -30,8 +32,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class UniverseObject extends SWGObject {
public class UniverseObject extends SWGObject implements Serializable {
private static final long serialVersionUID = 1L;
public UniverseObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
super(objectID, planet, position, orientation, Template);
}
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.waypoint;
import java.io.Serializable;
import resources.objects.intangible.IntangibleObject;
import com.sleepycat.persist.model.Persistent;
@@ -31,8 +33,10 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=0)
public class WaypointObject extends IntangibleObject {
public class WaypointObject extends IntangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
private int cellId; // ???
private long locationNetworkId;
private int planetCRC;
@@ -21,6 +21,8 @@
******************************************************************************/
package resources.objects.weapon;
import java.io.Serializable;
import resources.datatables.WeaponType;
import resources.objects.tangible.TangibleObject;
@@ -33,12 +35,14 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@Persistent(version=1)
public class WeaponObject extends TangibleObject {
public class WeaponObject extends TangibleObject implements Serializable {
private static final long serialVersionUID = 1L;
// TODO: Thread safety
@NotPersistent
private WeaponMessageBuilder messageBuilder;
private transient WeaponMessageBuilder messageBuilder;
public WeaponObject(long objectID, Planet planet, String template) {
super(objectID, planet, template, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0));