mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-02 03:15:52 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
This commit is contained in:
@@ -26,63 +26,111 @@ import java.io.Serializable;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import resources.objects.ObjectMessageBuilder;
|
||||
|
||||
import com.sleepycat.persist.model.Persistent;
|
||||
|
||||
import engine.clients.Client;
|
||||
import engine.resources.objects.Baseline;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent(version=0)
|
||||
public class IntangibleObject extends SWGObject implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private transient IntangibleMessageBuilder messageBuilder;
|
||||
private int genericInt;
|
||||
|
||||
public IntangibleObject() {
|
||||
super();
|
||||
messageBuilder = new IntangibleMessageBuilder(this);
|
||||
}
|
||||
|
||||
private transient IntangibleMessageBuilder messageBuilder;
|
||||
|
||||
public IntangibleObject(long objectID, Planet planet, Point3D position, Quaternion orientation, String Template) {
|
||||
super(objectID, planet, position, orientation, Template);
|
||||
messageBuilder = new IntangibleMessageBuilder(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public IntangibleObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void initAfterDBLoad() {
|
||||
super.init();
|
||||
messageBuilder = new IntangibleMessageBuilder(this);
|
||||
}
|
||||
|
||||
|
||||
public Baseline getOtherVariables() {
|
||||
Baseline baseline = super.getOtherVariables();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline3() {
|
||||
Baseline baseline = super.getBaseline3();
|
||||
baseline.put("genericInt", 0);
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline6() {
|
||||
Baseline baseline = super.getBaseline6();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline8() {
|
||||
Baseline baseline = super.getBaseline8();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public Baseline getBaseline9() {
|
||||
Baseline baseline = super.getBaseline9();
|
||||
return baseline;
|
||||
}
|
||||
|
||||
public int getGenericInt() {
|
||||
synchronized(objectMutex) {
|
||||
return genericInt;
|
||||
return (int) getBaseline(3).get("genericInt");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setGenericInt(int genericInt) {
|
||||
synchronized(objectMutex) {
|
||||
this.genericInt = genericInt;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client client) {
|
||||
// TODO Auto-generated method stub
|
||||
IoBuffer buffer;
|
||||
|
||||
synchronized(objectMutex) {
|
||||
buffer = getBaseline(3).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)));
|
||||
}
|
||||
|
||||
public void notifyClients(IoBuffer buffer, boolean notifySelf) {
|
||||
notifyObservers(buffer, notifySelf);
|
||||
}
|
||||
|
||||
public ObjectMessageBuilder getMessageBuilder() {
|
||||
return messageBuilder;
|
||||
synchronized(objectMutex) {
|
||||
if (messageBuilder == null) {
|
||||
messageBuilder = new IntangibleMessageBuilder(this);
|
||||
}
|
||||
|
||||
return messageBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendBaselines(Client destination) {
|
||||
if (destination != null && destination.getSession() != null) {
|
||||
destination.getSession().write(getBaseline(3).getBaseline());
|
||||
destination.getSession().write(getBaseline(6).getBaseline());
|
||||
|
||||
// FIXME Check if destination has view permissions to this
|
||||
if (this.getContainer() == destination.getParent() || this.getGrandparent() == destination.getParent()) {
|
||||
destination.getSession().write(getBaseline(8).getBaseline()); getBaseline(9); // Temp fix due to minor mistake in engine
|
||||
destination.getSession().write(baseline9.getBaseline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user