PvP & OptionsBitmask refactor

These will need to be used in scripts to make NPCs invulnerable,
conversable, always aggressive, etc.
This commit is contained in:
Treeku
2013-12-03 16:29:17 +00:00
parent a68e679ebb
commit 0809361349
7 changed files with 209 additions and 90 deletions
@@ -67,6 +67,9 @@ public class TangibleObject extends SWGObject {
private int respawnTime = 0;
private Point3D spawnCoordinates = new Point3D(0, 0, 0);
@NotPersistent
private 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);
messageBuilder = new TangibleMessageBuilder(this);
@@ -153,6 +156,24 @@ public class TangibleObject extends SWGObject {
}
}
public boolean getPvpStatus(int pvpStatus) {
synchronized(objectMutex) {
return ((pvpBitmask & pvpStatus) != 0);
}
}
public void setPvpStatus(int pvpBitmask, boolean add) {
synchronized(objectMutex) {
if (pvpBitmask != 0) {
if (add) {
this.pvpBitmask |= pvpBitmask;
} else {
this.pvpBitmask &= ~pvpBitmask;
}
}
}
}
public String getFaction() {
synchronized(objectMutex) {
return faction;
@@ -278,6 +299,18 @@ public class TangibleObject extends SWGObject {
}
}
public TangibleObject getKiller() {
synchronized(objectMutex) {
return killer;
}
}
public void setKiller(TangibleObject killer) {
synchronized(objectMutex) {
this.killer = killer;
}
}
@Override
public void sendBaselines(Client destination) {