mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-19 09:02:54 -04:00
Fixed #266 and added stealth for GM
This commit is contained in:
@@ -342,7 +342,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
buffer.putShort((short) 0); // costume
|
||||
//buffer.put(getAsciiString("appearance/gungan_m.sat"));
|
||||
buffer.put((byte) 1); // visible boolean. default: true. cloaked if false.
|
||||
buffer.put((byte) (creature.isInStealth() ? 0 : 1));
|
||||
|
||||
if(creature.getBuffList().isEmpty()) {
|
||||
buffer.putInt(0);
|
||||
@@ -385,7 +385,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
buffer.put((byte) 0); // performing? boolean
|
||||
buffer.put((byte) (creature.isStationary() ? 1 : 0)); // if the server accepts transforms from the object
|
||||
buffer.put(creature.getDifficulty());
|
||||
|
||||
if(creature.isHologram())
|
||||
@@ -393,7 +393,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
else
|
||||
buffer.putInt(0xFFFFFFFF);
|
||||
|
||||
buffer.put((byte) 1); // visibleOnRadar? boolean
|
||||
buffer.put((byte) (creature.isRadarVisible() ? 1 : 0));
|
||||
buffer.put((byte) 0); // no effect for 1?
|
||||
buffer.put((byte) 0); // no effect for 1?
|
||||
|
||||
@@ -1188,6 +1188,24 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer = createDelta("CREO", (byte) 3, (short) 1, (short) 0x0D, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildStealthFlagDelta(boolean flag) {
|
||||
IoBuffer buffer = bufferPool.allocate(8, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.put((byte) (flag ? 0 : 1));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x19, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildRadarVisibleFlagDelta(boolean flag) {
|
||||
IoBuffer buffer = bufferPool.allocate(1, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.put((byte) (flag ? 1 : 0));
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 6, (short) 1, (short) 0x1E, buffer, size + 4);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
switch (viewType) {
|
||||
|
||||
@@ -59,7 +59,7 @@ import engine.resources.scene.Quaternion;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
import resources.objects.weapon.WeaponObject;
|
||||
|
||||
@Entity(version=3)
|
||||
@Entity(version=4)
|
||||
public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
@NotPersistent
|
||||
@@ -147,7 +147,11 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
private SWGList<SWGObject> appearanceEquipmentList;
|
||||
@NotPersistent
|
||||
private int appearanceEquipmentListUpdateCounter = 0;
|
||||
|
||||
|
||||
private boolean inStealth = false;
|
||||
private boolean radarVisible = true; // radar
|
||||
private boolean stationary = false;
|
||||
|
||||
// non-baseline vars
|
||||
@NotPersistent
|
||||
private List<CreatureObject> duelList = Collections.synchronizedList(new ArrayList<CreatureObject>());
|
||||
@@ -1709,4 +1713,42 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.performingFlourish = performingFlourish;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInStealth() {
|
||||
synchronized(objectMutex) {
|
||||
return inStealth;
|
||||
}
|
||||
}
|
||||
|
||||
public void setInStealth(boolean inStealth) {
|
||||
synchronized(objectMutex) {
|
||||
this.inStealth = inStealth;
|
||||
}
|
||||
notifyObservers(messageBuilder.buildStealthFlagDelta(inStealth), false);
|
||||
}
|
||||
|
||||
public boolean isRadarVisible() {
|
||||
synchronized(objectMutex) {
|
||||
return radarVisible;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRadarVisible(boolean radarVisible) {
|
||||
synchronized(objectMutex) {
|
||||
this.radarVisible = radarVisible;
|
||||
}
|
||||
notifyObservers(messageBuilder.buildRadarVisibleFlagDelta(radarVisible), false);
|
||||
}
|
||||
|
||||
public boolean isStationary() {
|
||||
synchronized(objectMutex) {
|
||||
return stationary;
|
||||
}
|
||||
}
|
||||
|
||||
public void setStationary(boolean stationary) {
|
||||
synchronized(objectMutex) {
|
||||
this.stationary = stationary;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user