mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-08 23:12:57 -04:00
Merge branch 'master' into darkk_ent
This commit is contained in:
@@ -31,7 +31,6 @@ import main.NGECore;
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
import org.apache.mina.core.buffer.SimpleBufferAllocator;
|
||||
|
||||
import resources.common.BuffBuilder;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
|
||||
import com.sleepycat.persist.model.NotPersistent;
|
||||
@@ -41,7 +40,7 @@ import engine.clientdata.ClientFileManager;
|
||||
import engine.clientdata.visitors.DatatableVisitor;
|
||||
import engine.resources.common.CRC;
|
||||
|
||||
@Persistent(version=7)
|
||||
@Persistent(version=8)
|
||||
public class Buff implements IListObject {
|
||||
|
||||
@NotPersistent
|
||||
@@ -53,6 +52,7 @@ public class Buff implements IListObject {
|
||||
private long ownerId;
|
||||
private String effect1Name, effect2Name, effect3Name, effect4Name, effect5Name;
|
||||
private float effect1Value, effect2Value, effect3Value, effect4Value, effect5Value;
|
||||
private String callback;
|
||||
private String particleEffect;
|
||||
private boolean isDebuff;
|
||||
private boolean removeOnDeath;
|
||||
@@ -98,6 +98,7 @@ public class Buff implements IListObject {
|
||||
effect4Value = (Float) visitor.getObject(i, 14);
|
||||
effect5Name = (String) visitor.getObject(i, 15);
|
||||
effect5Value = (Float) visitor.getObject(i, 16);
|
||||
callback = (String) visitor.getObject(i, 18);
|
||||
particleEffect = (String) visitor.getObject(i, 19);
|
||||
isDebuff = (Boolean) visitor.getObject(i, 22);
|
||||
removeOnDeath = (Integer) visitor.getObject(i, 25) != 0;
|
||||
@@ -266,6 +267,14 @@ public class Buff implements IListObject {
|
||||
public void setEffect5Value(float effect5Value) {
|
||||
this.effect5Value = effect5Value;
|
||||
}
|
||||
|
||||
public String getCallback() {
|
||||
return callback;
|
||||
}
|
||||
|
||||
public void setCallback(String callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public String getParticleEffect() {
|
||||
return particleEffect;
|
||||
|
||||
@@ -97,14 +97,8 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.put(getAsciiString(creature.getStfName()));
|
||||
if (creature.getCustomName() == null) { creature.setCustomName(""); }//Not all CreatureObjects have CustomName (Shuttles)
|
||||
buffer.put(getUnicodeString(creature.getCustomName()));
|
||||
buffer.putInt(0x000F4240); // unk
|
||||
String factionCRC = creature.getFaction();
|
||||
if(factionCRC == null)
|
||||
buffer.putInt(0);
|
||||
else if(factionCRC.equals("neutral"))
|
||||
buffer.putInt(0);
|
||||
else
|
||||
buffer.putInt(CRC.StringtoCRC(factionCRC));
|
||||
buffer.putInt(0x000F4240); // volume
|
||||
buffer.putInt(CRC.StringtoCRC(creature.getFaction()));
|
||||
|
||||
buffer.putInt(creature.getFactionStatus());
|
||||
|
||||
@@ -545,7 +539,7 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildSpeedModDelta(float speed) {
|
||||
public IoBuffer buildSpeedModBaseDelta(float speed) {
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putFloat(speed);
|
||||
@@ -556,6 +550,19 @@ public class CreatureMessageBuilder extends ObjectMessageBuilder {
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
public IoBuffer buildSpeedModDelta(float speedModifier) {
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putFloat(speedModifier);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("CREO", (byte) 4, (short) 1, (short) 5, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IoBuffer buildTurnRadiusDelta(float turnRadius) {
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ import org.apache.mina.core.buffer.IoBuffer;
|
||||
import protocol.swg.ChatSystemMessage;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayMusicMessage;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.UpdatePostureMessage;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.objectControllerObjects.Animation;
|
||||
import protocol.swg.objectControllerObjects.Posture;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
// CREO6
|
||||
private byte combatFlag = 0;
|
||||
private short level = 1;
|
||||
private short level = -1;
|
||||
private int grantedHealth = 0;
|
||||
private String currentAnimation;
|
||||
private String moodAnimation;
|
||||
@@ -261,7 +261,14 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getOptionsBitmask() {
|
||||
synchronized(objectMutex) {
|
||||
return optionsBitmask;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOptionsBitmask(int optionBitmask) {
|
||||
synchronized(objectMutex) {
|
||||
@@ -273,6 +280,14 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
notifyObservers(optionDelta, true);
|
||||
|
||||
}
|
||||
|
||||
public void addOption(int option) {
|
||||
setOptionsBitmask(getOptionsBitmask() & option);
|
||||
}
|
||||
|
||||
public void removeOption(int option) {
|
||||
setOptionsBitmask(getOptionsBitmask() |~ option);
|
||||
}
|
||||
|
||||
public byte getPosture() {
|
||||
synchronized(objectMutex) {
|
||||
@@ -298,10 +313,8 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.faction = faction;
|
||||
}
|
||||
|
||||
IoBuffer factionDelta = messageBuilder.buildFactionDelta(faction);
|
||||
|
||||
notifyObservers(factionDelta, true);
|
||||
|
||||
notifyObservers(messageBuilder.buildFactionDelta(faction), true);
|
||||
setPvpStatus(0, true);
|
||||
}
|
||||
|
||||
public int getFactionStatus() {
|
||||
@@ -315,10 +328,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
this.factionStatus = factionStatus;
|
||||
}
|
||||
|
||||
IoBuffer factionStatusDelta = messageBuilder.buildFactionStatusDelta(factionStatus);
|
||||
|
||||
notifyObservers(factionStatusDelta, true);
|
||||
|
||||
notifyObservers(messageBuilder.buildFactionStatusDelta(factionStatus), true);
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
@@ -495,7 +505,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
synchronized(objectMutex) {
|
||||
this.speedMultiplierBase = speedMultiplierBase;
|
||||
}
|
||||
IoBuffer speedDelta = messageBuilder.buildSpeedModDelta(speedMultiplierBase);
|
||||
IoBuffer speedDelta = messageBuilder.buildSpeedModBaseDelta(speedMultiplierBase);
|
||||
|
||||
notifyObservers(speedDelta, true);
|
||||
|
||||
@@ -511,6 +521,9 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
synchronized(objectMutex) {
|
||||
this.speedMultiplierMod = speedMultiplierMod;
|
||||
}
|
||||
IoBuffer speedDelta = messageBuilder.buildSpeedModDelta(speedMultiplierMod);
|
||||
|
||||
notifyObservers(speedDelta, true);
|
||||
}
|
||||
|
||||
public long getListenToId() {
|
||||
@@ -929,26 +942,48 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
//destination.getSession().write(upm.serialize());
|
||||
|
||||
if(destination != getClient()) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
|
||||
if (factionStatus == 1 && faction.equals("imperial")) {
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction());
|
||||
|
||||
/*
|
||||
if (factionStatus == 1 && faction == "imperial") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial);
|
||||
upvpm.setStatus(16);
|
||||
} else if (factionStatus == 1 && faction.equals("rebel")) {
|
||||
if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0);
|
||||
if (getOwnerId() != 0) upvpm.setStatus(256);
|
||||
}
|
||||
|
||||
if (factionStatus == 1 && faction == "rebel") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel);
|
||||
upvpm.setStatus(16);
|
||||
} else if (factionStatus == 2 && faction.equals("imperial")) {
|
||||
if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0);
|
||||
if (getOwnerId() != 0) upvpm.setStatus(256);
|
||||
}
|
||||
|
||||
if (factionStatus == 2 && faction == "imperial") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Imperial);
|
||||
upvpm.setStatus(55);
|
||||
} else if (factionStatus == 2 && faction.equals("rebel")) {
|
||||
if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(39);
|
||||
if (getOwnerId() != 0) upvpm.setStatus(295);
|
||||
}
|
||||
if (factionStatus == 2 && faction == "rebel") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Rebel);
|
||||
upvpm.setStatus(55);
|
||||
} else if(getSlottedObject("ghost") != null) {
|
||||
upvpm.setFaction(CRC.StringtoCRC(faction));
|
||||
if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(39);
|
||||
if (getOwnerId() != 0) upvpm.setStatus(295);
|
||||
}
|
||||
if(factionStatus == 0 && faction == "neutral") {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
|
||||
upvpm.setStatus(16);
|
||||
if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0);
|
||||
if (getOwnerId() != 0) upvpm.setStatus(256);
|
||||
} else {
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
|
||||
upvpm.setStatus(0);
|
||||
}
|
||||
upvpm.setStatus(16);
|
||||
if ((getOptionsBitmask() & 128) == 128) upvpm.setStatus(0);
|
||||
if (getOwnerId() != 0) upvpm.setStatus(256);
|
||||
}
|
||||
*/
|
||||
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
}
|
||||
}
|
||||
@@ -1309,4 +1344,16 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setPvPBitmask(int pvpBitmask) {
|
||||
super.setPvPBitmask(pvpBitmask);
|
||||
notifyObservers(new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction()), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPvpStatus(int pvpBitmask, boolean add) {
|
||||
super.setPvpStatus(pvpBitmask, add);
|
||||
notifyObservers(new UpdatePVPStatusMessage(getObjectID(), getPvPBitmask(), getFaction()), false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
******************************************************************************/
|
||||
package resources.objects.guild;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@@ -35,6 +36,7 @@ import resources.guild.Guild;
|
||||
import resources.objects.SWGList;
|
||||
import resources.objects.SWGMap;
|
||||
import resources.objects.SWGMultiMap;
|
||||
import services.collections.ServerFirst;
|
||||
|
||||
import com.sleepycat.je.Environment;
|
||||
import com.sleepycat.je.Transaction;
|
||||
@@ -54,7 +56,8 @@ public class GuildObject extends SWGObject implements IPersistent {
|
||||
protected NGECore core;
|
||||
@NotPersistent
|
||||
private 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;
|
||||
@@ -260,6 +263,20 @@ public class GuildObject extends SWGObject implements IPersistent {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, ServerFirst> getServerFirst() {
|
||||
synchronized(objectMutex) {
|
||||
return serverFirst;
|
||||
}
|
||||
}
|
||||
|
||||
public void addServerFirst(String collectionName, ServerFirst player) {
|
||||
synchronized(objectMutex) {
|
||||
if (!serverFirst.containsKey(collectionName)) {
|
||||
serverFirst.put(collectionName, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
destination.getSession().write(messageBuilder.buildBaseline3());
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -22,9 +22,11 @@
|
||||
package resources.objects.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import resources.objects.waypoint.WaypointObject;
|
||||
|
||||
@@ -39,7 +41,7 @@ import engine.resources.scene.Planet;
|
||||
import engine.resources.scene.Point3D;
|
||||
import engine.resources.scene.Quaternion;
|
||||
|
||||
@Persistent
|
||||
@Persistent(version=1)
|
||||
public class PlayerObject extends SWGObject {
|
||||
|
||||
// PLAY 3
|
||||
@@ -51,6 +53,8 @@ public class PlayerObject extends SWGObject {
|
||||
private List<String> titleList = new ArrayList<String>();
|
||||
private int bornDate = 0;
|
||||
private int totalPlayTime = 0;
|
||||
private byte[] collections = new byte[] { };
|
||||
private int highestSetBit = 0;
|
||||
|
||||
// PLAY 6
|
||||
|
||||
@@ -116,7 +120,7 @@ public class PlayerObject extends SWGObject {
|
||||
@NotPersistent
|
||||
private long lastPlayTimeUpdate = System.currentTimeMillis();
|
||||
|
||||
|
||||
private Map<String, Integer> factionStandingMap = new TreeMap<String, Integer>();
|
||||
|
||||
public PlayerObject() {
|
||||
super();
|
||||
@@ -136,12 +140,13 @@ public class PlayerObject extends SWGObject {
|
||||
|
||||
public void setTitle(String title) {
|
||||
synchronized(objectMutex) {
|
||||
|
||||
if(!getTitleList().isEmpty() && getTitleList().contains(title)) {
|
||||
this.title = title;
|
||||
notifyObservers(messageBuilder.buildTitleDelta(title), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
notifyObservers(messageBuilder.buildTitleDelta(title), true);
|
||||
}
|
||||
|
||||
public String getProfession() {
|
||||
@@ -551,7 +556,30 @@ public class PlayerObject extends SWGObject {
|
||||
this.jediState = jediState;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Map<String, Integer> getFactionStandingMap() {
|
||||
return factionStandingMap;
|
||||
}
|
||||
|
||||
public void setFactionStanding(String faction, int factionStanding) {
|
||||
synchronized(objectMutex) {
|
||||
factionStandingMap.put(faction, ((factionStanding < -5000) ? -5000 : ((factionStanding > 5000) ? 5000 : factionStanding)));
|
||||
}
|
||||
}
|
||||
|
||||
public void modifyFactionStanding(String faction, int modifier) {
|
||||
synchronized(objectMutex) {
|
||||
int factionStanding = (((factionStandingMap.containsKey(faction)) ? factionStandingMap.get(faction) : 0) + modifier);
|
||||
factionStandingMap.put(faction, ((factionStanding < -5000) ? -5000 : ((factionStanding > 5000) ? 5000 : factionStanding)));
|
||||
}
|
||||
}
|
||||
|
||||
public int getFactionStanding(String faction) {
|
||||
synchronized(objectMutex) {
|
||||
return ((factionStandingMap.containsKey(faction)) ? factionStandingMap.get(faction) : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaselines(Client destination) {
|
||||
|
||||
@@ -583,9 +611,30 @@ public class PlayerObject extends SWGObject {
|
||||
public List<String> getTitleList() {
|
||||
return titleList;
|
||||
}
|
||||
|
||||
|
||||
public void setTitleList(List<String> titleList) {
|
||||
this.titleList = titleList;
|
||||
}
|
||||
|
||||
public void setCollections(byte[] collections) {
|
||||
synchronized(objectMutex) {
|
||||
this.collections = collections;
|
||||
this.highestSetBit = BitSet.valueOf(collections).length();
|
||||
}
|
||||
|
||||
notifyObservers(messageBuilder.buildCollectionsDelta(collections, getHighestSetBit()), true);
|
||||
}
|
||||
|
||||
public byte[] getCollections() {
|
||||
synchronized(objectMutex) {
|
||||
return collections;
|
||||
}
|
||||
}
|
||||
|
||||
public int getHighestSetBit() {
|
||||
synchronized(objectMutex) {
|
||||
return highestSetBit;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.put(getUnicodeString(object.getCustomName()));
|
||||
buffer.putInt(object.getVolume());
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0); // unknowns
|
||||
buffer.putInt(0); // faction vars
|
||||
|
||||
if(tangible.getCustomization() == null || tangible.getCustomization().length < 1)
|
||||
buffer.putShort((short) 0);
|
||||
@@ -59,12 +59,14 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder {
|
||||
buffer.putShort((short) tangible.getCustomization().length);
|
||||
buffer.put(tangible.getCustomization());
|
||||
}
|
||||
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0);
|
||||
|
||||
buffer.putInt(tangible.getOptionsBitmask());
|
||||
buffer.putInt(tangible.getIncapTimer());
|
||||
buffer.putInt(0); // number of item uses
|
||||
buffer.putInt(tangible.getConditionDamage());
|
||||
buffer.putInt(tangible.getMaxDamage());
|
||||
buffer.putInt(0);
|
||||
buffer.putInt(0x64);
|
||||
buffer.put((byte) (tangible.isStaticObject() ? 1 : 0));
|
||||
|
||||
int size = buffer.position();
|
||||
@@ -123,6 +125,18 @@ public class TangibleMessageBuilder extends ObjectMessageBuilder {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public IoBuffer buildConditionDamageDelta(int conditionDamage) {
|
||||
|
||||
IoBuffer buffer = bufferPool.allocate(4, false).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putInt(conditionDamage);
|
||||
int size = buffer.position();
|
||||
buffer.flip();
|
||||
buffer = createDelta("TANO", (byte) 3, (short) 1, (short) 0x0A, buffer, size + 4);
|
||||
|
||||
return buffer;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendListDelta(byte viewType, short updateType, IoBuffer buffer) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.Vector;
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import protocol.swg.PlayClientEffectObjectMessage;
|
||||
import protocol.swg.StopClientEffectObjectByLabel;
|
||||
import protocol.swg.UpdatePVPStatusMessage;
|
||||
import protocol.swg.objectControllerObjects.ShowFlyText;
|
||||
|
||||
import resources.common.RGB;
|
||||
@@ -48,7 +49,6 @@ import engine.resources.scene.Quaternion;
|
||||
@Persistent
|
||||
public class TangibleObject extends SWGObject {
|
||||
|
||||
|
||||
// TODO: Thread safety
|
||||
|
||||
protected int incapTimer = 10;
|
||||
@@ -57,9 +57,9 @@ public class TangibleObject extends SWGObject {
|
||||
protected byte[] customization;
|
||||
private List<Integer> componentCustomizations = new ArrayList<Integer>();
|
||||
protected int optionsBitmask = 0;
|
||||
private int maxDamage = 0;
|
||||
private int maxDamage = 1000;
|
||||
private boolean staticObject = false;
|
||||
protected String faction = "";
|
||||
protected String faction = "neutral"; // Says you're "Imperial Special Forces" if it's 0 for some reason
|
||||
@NotPersistent
|
||||
private Vector<TangibleObject> defendersList = new Vector<TangibleObject>(); // unused in packets but useful for the server
|
||||
@NotPersistent
|
||||
@@ -68,15 +68,20 @@ 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);
|
||||
if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1);
|
||||
}
|
||||
|
||||
public TangibleObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) {
|
||||
super(objectID, planet, position, orientation, template);
|
||||
messageBuilder = new TangibleMessageBuilder(this);
|
||||
spawnCoordinates = position.clone();
|
||||
if (this.getClass().getSimpleName().equals("TangibleObject")) setIntAttribute("volume", 1);
|
||||
}
|
||||
|
||||
public TangibleObject() {
|
||||
@@ -92,12 +97,20 @@ public class TangibleObject extends SWGObject {
|
||||
this.incapTimer = incapTimer;
|
||||
}
|
||||
|
||||
public int getConditionDamage() {
|
||||
public synchronized int getConditionDamage() {
|
||||
return conditionDamage;
|
||||
}
|
||||
|
||||
public void setConditionDamage(int conditionDamage) {
|
||||
public synchronized void setConditionDamage(int conditionDamage) {
|
||||
if(conditionDamage < 0)
|
||||
conditionDamage = 0;
|
||||
else if(conditionDamage > getMaxDamage())
|
||||
conditionDamage = getMaxDamage();
|
||||
this.conditionDamage = conditionDamage;
|
||||
notifyObservers(messageBuilder.buildConditionDamageDelta(conditionDamage), false);
|
||||
if (maxDamage > 0) {
|
||||
this.setStringAttribute("condition", (maxDamage + "/" + (maxDamage - conditionDamage)));
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] getCustomization() {
|
||||
@@ -123,13 +136,15 @@ public class TangibleObject extends SWGObject {
|
||||
public void setOptionsBitmask(int optionsBitmask) {
|
||||
this.optionsBitmask = optionsBitmask;
|
||||
}
|
||||
|
||||
|
||||
public int getMaxDamage() {
|
||||
return maxDamage;
|
||||
}
|
||||
|
||||
public void setMaxDamage(int maxDamage) {
|
||||
this.maxDamage = maxDamage;
|
||||
|
||||
this.setStringAttribute("condition", (maxDamage + "/" + (maxDamage - conditionDamage)));
|
||||
}
|
||||
|
||||
public boolean isStaticObject() {
|
||||
@@ -142,7 +157,7 @@ public class TangibleObject extends SWGObject {
|
||||
|
||||
public int getPvPBitmask() {
|
||||
synchronized(objectMutex) {
|
||||
return optionsBitmask;
|
||||
return pvpBitmask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +167,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;
|
||||
@@ -245,15 +278,15 @@ public class TangibleObject extends SWGObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void showFlyText(String stfFile, String stfString, int xp, float scale, RGB color, int displayType) {
|
||||
public void showFlyText(String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType) {
|
||||
Set<Client> observers = getObservers();
|
||||
|
||||
if (getClient() != null) {
|
||||
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, xp, scale, color, displayType))).serialize());
|
||||
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
|
||||
}
|
||||
|
||||
for (Client client : observers) {
|
||||
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, xp, scale, color, displayType))).serialize());
|
||||
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), 56, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,6 +310,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) {
|
||||
|
||||
@@ -291,6 +336,11 @@ public class TangibleObject extends SWGObject {
|
||||
destination.getSession().write(messageBuilder.buildBaseline8());
|
||||
destination.getSession().write(messageBuilder.buildBaseline9());
|
||||
|
||||
UpdatePVPStatusMessage upvpm = new UpdatePVPStatusMessage(getObjectID());
|
||||
upvpm.setFaction(UpdatePVPStatusMessage.factionCRC.Neutral);
|
||||
upvpm.setStatus(1);
|
||||
destination.getSession().write(upvpm.serialize());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ public class WeaponObject extends SWGObject {
|
||||
public WeaponObject(long objectID, Planet planet, String template) {
|
||||
super(objectID, planet, new Point3D(0, 0, 0), new Quaternion(1, 0, 1, 0), template);
|
||||
messageBuilder = new WeaponMessageBuilder(this);
|
||||
if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1);
|
||||
calculateRange();
|
||||
calculateAttackSpeed();
|
||||
}
|
||||
@@ -61,6 +62,7 @@ public class WeaponObject extends SWGObject {
|
||||
public WeaponObject(long objectID, Planet planet, String template, Point3D position, Quaternion orientation) {
|
||||
super(objectID, planet, position, orientation, template);
|
||||
messageBuilder = new WeaponMessageBuilder(this);
|
||||
if (this.getClass().getSimpleName().equals("WeaponObject")) setIntAttribute("volume", 1);
|
||||
calculateRange();
|
||||
calculateAttackSpeed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user