Merge remote-tracking branch 'upstream/master'

This commit is contained in:
CharonInferar
2014-04-13 02:11:17 +02:00
26 changed files with 480 additions and 416 deletions
Binary file not shown.
+3 -4
View File
@@ -5,7 +5,7 @@ from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobileTemplate.setCreatureName('tuskenraider')
mobileTemplate.setCreatureName('tusken_raider')
mobileTemplate.setLevel(90)
mobileTemplate.setDifficulty(0)
mobileTemplate.setAttackRange(24)
@@ -15,8 +15,7 @@ def addTemplate(core):
mobileTemplate.setTemplates(templates)
weaponTemplates = Vector()
weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_e11.iff')
weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_t21.iff')
weaponTemplates.add('object/weapon/ranged/rifle/shared_rifle_tusken.iff')
mobileTemplate.setWeaponTemplates(weaponTemplates)
@@ -24,5 +23,5 @@ def addTemplate(core):
mobileTemplate.setDefaultAttack('rangedShot')
mobileTemplate.setAttacks(attacks)
core.spawnService.addMobileTemplate('tuskenraider', mobileTemplate)
core.spawnService.addMobileTemplate('tusken_raider', mobileTemplate)
+5 -5
View File
@@ -686,17 +686,17 @@ public class NGECore {
try {
for(int minutes = 15; minutes > 1; minutes--) {
simulationService.notifyAllClients(new ChatSystemMessage("The server will be shutting down soon. Please find a safe place to logout. (" + minutes + " minutes left)", (byte) 0 ).serialize());
chatService.broadcastGalaxy("The server will be shutting down soon. Please find a safe place to logout. (" + minutes + " minutes left)");
Thread.sleep(60000);
}
setGalaxyStatus(3);
simulationService.notifyAllClients(new ChatSystemMessage("The server will be shutting down soon. Please find a safe place to logout. (" + 1 + " minutes left)", (byte) 0 ).serialize());
chatService.broadcastGalaxy("The server will be shutting down soon. Please find a safe place to logout. (" + 1 + " minutes left)");
Thread.sleep(30000);
simulationService.notifyAllClients(new ChatSystemMessage("You will be disconnected in 30 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.", (byte) 0 ).serialize());
chatService.broadcastGalaxy("You will be disconnected in 30 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.");
Thread.sleep(20000);
simulationService.notifyAllClients(new ChatSystemMessage("You will be disconnected in 10 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.", (byte) 0 ).serialize());
chatService.broadcastGalaxy("You will be disconnected in 10 seconds so the server can perform a final save before shutting down. Please find a safe place to logout now.");
Thread.sleep(10000);
simulationService.notifyAllClients(new ChatSystemMessage("You will now be disconnected so the server can perform a final save before shutting down.", (byte) 0 ).serialize());
chatService.broadcastGalaxy("You will now be disconnected so the server can perform a final save before shutting down.");
synchronized(getActiveConnectionsMap()) {
for(Client client : getActiveConnectionsMap().values()) {
+7 -32
View File
@@ -26,14 +26,17 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.OutOfBand;
import resources.common.StringUtilities;
public class CommPlayerMessage extends SWGMessage {
private long objectId;
private OutOfBand outOfBand;
public CommPlayerMessage(long objectId) {
public CommPlayerMessage(long objectId, OutOfBand outOfBand) {
this.objectId = objectId;
this.outOfBand = outOfBand;
}
@Override
@@ -44,52 +47,24 @@ public class CommPlayerMessage extends SWGMessage {
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(200).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 2);
buffer.putInt(0x594AD258);
buffer.put((byte) 0); // aurebesh borders on comm, space version? Can cause crashes
buffer.putLong(objectId);
/*Seen numbers:
/* Seen numbers:
* 52 (Starting Station Comms)
* 54 (Tansarii Comms)
* 57 (Supply Drops)
* 58 (Faction Covert->Overt)
* 68 (Imperial stop)
*
*/
buffer.putInt(57); // unknown, changes for each comm message (counter?)
buffer.putShort((short) 0); // unknonw flag, seems to do nothing
buffer.put((byte) 0); // unknown, always 0 except for imperial stop message
buffer.putInt(0xFFFFFFFF);
buffer.put(getAsciiString("stormtrooper")); // StfFile
buffer.putInt(0); // stf spacer
buffer.put(getAsciiString("u11")); // StfName
buffer.putInt(0); // stf spacer
buffer.putLong(0);
buffer.putLong(0);
buffer.putLong(0);
buffer.putLong(0); // 70 bytes
buffer.putLong(0);
buffer.putLong(0);
buffer.putLong(0);
buffer.putLong(0);
buffer.put((byte) 0);
buffer.put(outOfBand.serialize().array());
// Officer Supply Drop: 0x3E894347
// Rebel Faction Dude: 0x528CB3D7
buffer.putInt(0x528CB3D7); // model crc, can be anything w/o crashing
buffer.putInt(0); // sound
buffer.putShort((short) 0); // unk
buffer.putShort((short) 16576); // comm display time, unsure on how it's calculated
buffer.putShort((short) 16576); // comm display time, unsure on how it's calculated (probably milliseconds)
buffer.flip();
Console.println("CPM: " + StringUtilities.bytesToHex(buffer.array()));
return buffer;
+13 -46
View File
@@ -27,25 +27,18 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.common.Opcodes;
import resources.common.OutOfBand;
public class ChatSystemMessage extends SWGMessage{
public class ChatSystemMessage extends SWGMessage {
private String stfFilename;
private String stfName;
private int stat;
private String message;
private byte displayType;
private OutOfBand outOfBand;
public ChatSystemMessage(String message, byte displayType) {
public ChatSystemMessage(String message, OutOfBand outOfBand, byte displayType) {
this.message = message;
this.displayType = displayType;
}
public ChatSystemMessage(String stfFilename, String stfName, int stat, byte displayType) {
this.stfFilename = stfFilename;
this.stfName = stfName;
this.stat = stat;
this.displayType = displayType;
this.outOfBand = outOfBand;
}
public void deserialize(IoBuffer data) {
@@ -53,40 +46,14 @@ public class ChatSystemMessage extends SWGMessage{
}
public IoBuffer serialize() {
if (message != null) {
IoBuffer result = IoBuffer.allocate(15 + message.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
result.putShort((short) 2);
result.putInt(Opcodes.ChatSystemMessage);
result.put(displayType); // 0x00 = Chat and Screen // 0x02 = Chat only
result.put(getUnicodeString(message));
result.putInt(0);
return result.flip();
} else {
IoBuffer result = IoBuffer.allocate(99 + stfFilename.length() + stfName.length()).order(ByteOrder.LITTLE_ENDIAN);
result.putShort((short) 4);
result.putInt(Opcodes.ChatSystemMessage);
result.put((byte) 0); //result.put((byte) displayType); // 0x00 = Chat and Screen // 0x02 = Chat only
result.putInt(0);
result.putInt(54);
result.putShort((short) 0);
result.put((byte) 1);
result.putInt(-1);
result.put(getAsciiString(stfFilename));
result.putInt(0);
result.put(getAsciiString(stfName));
result.putInt(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putInt(stat);
result.putInt(0);
result.put((byte) 0);
return result.flip();
}
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer result = IoBuffer.allocate(7 + getUnicodeString(message).length + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
result.putShort((short) 2);
result.putInt(Opcodes.ChatSystemMessage);
result.put(displayType);
result.put(getUnicodeString(message));
result.put(outOfBandBuffer.array());
return result.flip();
}
}
@@ -36,6 +36,7 @@ public class NpcConversationMessage extends ObjControllerObject {
public NpcConversationMessage(long objectId, OutOfBand outOfBand) {
this.objectId = objectId;
this.outOfBand = outOfBand;
outOfBand.setHeaderBytes(2);
}
@Override
@@ -47,12 +48,10 @@ public class NpcConversationMessage extends ObjControllerObject {
public IoBuffer serialize() {
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer buffer = IoBuffer.allocate(16 + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.CONVERSATION_MESSAGE);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.put(outOfBandBuffer.array());
System.out.println(buffer.getInt(16));
return buffer.flip();
}
@@ -28,6 +28,7 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ConversationOption;
import resources.objects.Delta;
public class NpcConversationOptions extends ObjControllerObject {
@@ -52,16 +53,13 @@ public class NpcConversationOptions extends ObjControllerObject {
buffer.setAutoExpand(true);
buffer.putInt(ObjControllerMessage.CONVERSATION_OPTIONS);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.put((byte) conversationOptions.size());
for(ConversationOption option : conversationOptions) {
buffer.put(option.getOutOfBand().serialize());
for (ConversationOption option : conversationOptions) {
option.getOutOfBand().setHeaderBytes(2);
buffer.put(option.getOutOfBand().serialize().array());
}
int size = buffer.position();
buffer.flip();
return IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN).put(buffer.array(), 0, size).flip();
return Delta.resizeBuffer(buffer);
}
}
@@ -26,51 +26,28 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.OutOfBand;
import resources.common.RGB;
import resources.common.Stf;
public class ShowFlyText extends ObjControllerObject {
private long recieverId;
private long receiverId;
private long objectId;
private int unknownInt1;
private short unknownShort1;
private byte unknownByte1;
private int unknownInt2;
private String stfFile;
private String stfString;
private short xp;
private Stf stf;
private OutOfBand outOfBand;
private float scale;
private RGB color;
private int displayType;
private boolean alternativeStructure;
private String customText;
public ShowFlyText(long recieverId, long objectId, String stfFile, String stfString, float scale, RGB color, int displayType) {
this.recieverId = recieverId;
public ShowFlyText(long receiverId, long objectId, String stf, OutOfBand outOfBand, float scale, RGB color, int displayType) {
this.receiverId = receiverId;
this.objectId = objectId;
this.stfFile = stfFile;
this.stfString = stfString;
this.stf = new Stf(stf);
this.outOfBand = outOfBand;
this.scale = scale;
this.color = color;
this.displayType = displayType;
this.alternativeStructure = false;
}
public ShowFlyText(long recieverId, long objectId, int unknownInt1, int unknownShort1, int unknownByte1, int unknownInt2, String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType) {
this.recieverId = recieverId;
this.objectId = objectId;
this.unknownInt1 = unknownInt1;
this.unknownShort1 = (short) unknownShort1;
this.unknownByte1 = (byte) unknownByte1;
this.unknownInt2 = unknownInt2;
this.stfFile = stfFile;
this.stfString = stfString;
this.customText = customText;
this.xp = (short) xp;
this.scale = scale;
this.color = color;
this.alternativeStructure = true;
this.displayType = displayType;
}
@Override
@@ -81,54 +58,20 @@ public class ShowFlyText extends ObjControllerObject {
@Override
public IoBuffer serialize() {
if (!alternativeStructure) {
IoBuffer result = IoBuffer.allocate(47 + stfFile.length() + stfString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(recieverId);
result.putInt(0);
result.putLong(objectId);
result.put(getAsciiString(stfFile));
result.putInt(0);
result.put(getAsciiString(stfString));
result.putInt(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
return result.flip();
} else {
IoBuffer result = IoBuffer.allocate(124 + stfFile.length() + stfString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(recieverId);
result.putInt(0);
result.putLong(objectId);
result.putLong(0);
result.putInt(unknownInt1);
result.putShort(unknownShort1);
result.put(unknownByte1);
result.putInt(unknownInt2);
result.put(getAsciiString(stfFile));
result.putInt(0);
result.put(getAsciiString(stfString));
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.put(getUnicodeString(customText)); // %TO?
result.putShort(xp); // %DI ?
result.putLong(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
result.flip();
//StringUtilities.printBytes(result.array());
return result;
}
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer result = IoBuffer.allocate(35 + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(receiverId);
result.putInt(0);
result.putLong(objectId);
result.put(stf.getBytes());
result.put(outOfBandBuffer.array());
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
result.flip();
return result;
}
}
+55 -47
View File
@@ -23,13 +23,20 @@ package resources.common;
import java.nio.ByteOrder;
import java.util.Vector;
import resources.common.StringUtilities;
import resources.objects.Delta;
import org.apache.mina.core.buffer.IoBuffer;
public class OutOfBand {
private short count;
private Vector<ProsePackage> prosePackages = new Vector<ProsePackage>();
private int headerBytes = 0;
public OutOfBand(Vector<ProsePackage> prosePackages) {
setProsePackages(prosePackages);
}
public OutOfBand(ProsePackage prosePackage) {
addProsePackage(prosePackage);
@@ -39,85 +46,86 @@ public class OutOfBand {
}
public static OutOfBand ProsePackage(Object ... objects) {
return new OutOfBand(new ProsePackage(objects));
}
public void addProsePackage(ProsePackage prosePackage) {
prosePackages.add(prosePackage);
setCount((short) (getCount() + 1));
}
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(50).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
buffer.putInt(4);
buffer.putShort((short) 0); // unk
buffer.putShort(getCount());
// The short that was here is only in conversation OutOfBands.
// Count doesn't seem to be count. It seems to be indicating if there's an extra byte.
for(ProsePackage prosePackage : prosePackages) {
for (ProsePackage prosePackage : prosePackages) {
buffer.put((byte) 1);
buffer.putInt(-1);
buffer.put(StringUtilities.getAsciiString(prosePackage.getStfFile()));
buffer.putInt(0);
buffer.put(StringUtilities.getAsciiString(prosePackage.getStfLabel()));
buffer.put(prosePackage.getStf().getBytes());
buffer.putLong(prosePackage.getTuObjectId());
buffer.put(StringUtilities.getAsciiString(prosePackage.getTuStfFile()));
buffer.putInt(0);
buffer.put(StringUtilities.getAsciiString(prosePackage.getTuStfLabel()));
buffer.put(prosePackage.getTuStf().getBytes());
buffer.put(StringUtilities.getUnicodeString(prosePackage.getTuCustomString()));
buffer.putLong(prosePackage.getTtObjectId());
buffer.put(StringUtilities.getAsciiString(prosePackage.getTtStfFile()));
buffer.putInt(0);
buffer.put(StringUtilities.getAsciiString(prosePackage.getTtStfLabel()));
buffer.put(prosePackage.getTtStf().getBytes());
buffer.put(StringUtilities.getUnicodeString(prosePackage.getTtCustomString()));
buffer.putLong(prosePackage.getToObjectId());
buffer.put(StringUtilities.getAsciiString(prosePackage.getToStfFile()));
buffer.putInt(0);
buffer.put(StringUtilities.getAsciiString(prosePackage.getToStfLabel()));
buffer.put(prosePackage.getToStf().getBytes());
buffer.put(StringUtilities.getUnicodeString(prosePackage.getToCustomString()));
buffer.putInt(prosePackage.getDiInteger());
buffer.putFloat(prosePackage.getDfFloat());
//buffer.put(prosePackage.getDisplayFlag());
buffer.put((byte) 0);
int stfLength = prosePackage.getStfFile().length() + prosePackage.getStfLabel().length() +
prosePackage.getTuStfFile().length() + prosePackage.getTuStfLabel().length() +
prosePackage.getTtStfFile().length() + prosePackage.getTtStfLabel().length() +
prosePackage.getToStfFile().length() + prosePackage.getToStfLabel().length();
//if(stfLength % 2 == 1) {
buffer.put((byte) 0);
//}
}
setLength(buffer);
int size = buffer.position();
buffer.flip();
return IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN).put(buffer.array(), 0, size).flip();
if (size > 0) {
if ((size % 2) == 1) {
size++;
buffer.put((byte) 0);
buffer = Delta.createBuffer(size + 2).putShort((short) 1).put(buffer.flip().array(), 0, size);
} else {
buffer = Delta.createBuffer(size + 2).putShort((short) 0).put(buffer.flip().array(), 0, size);
}
size += 2;
} else {
return Delta.createBuffer(4).putInt(size);
}
if (headerBytes > 0) {
IoBuffer result = Delta.createBuffer(size + headerBytes);
for (int i = 0; i < headerBytes; i++) {
result.put((byte) 0);
}
buffer = result.put(buffer.flip().array(), 0, size);
size += headerBytes;
}
return Delta.resizeBuffer(Delta.createBuffer(size + 4).putInt(size / 2).put(buffer.flip().array()));
}
public void setLength(IoBuffer buffer) {
buffer.putInt(0, (buffer.position() - 4) / 2);
/*
* No idea what the extra short in conversation OutOfBands is.
* It's not in any of the other packets that use OutOfBand.
*/
public void setHeaderBytes(int headerBytes) {
this.headerBytes = headerBytes;
}
public short getCount() {
return count;
}
public void setCount(short count) {
this.count = count;
}
public Vector<ProsePackage> getProsePackages() {
return prosePackages;
}
public void setProsePackages(Vector<ProsePackage> prosePackages) {
this.prosePackages = prosePackages;
}
+126 -100
View File
@@ -24,183 +24,209 @@ package resources.common;
public class ProsePackage {
/*
* TU = Text You
* TU = Text User
* TT = Text Target
* TO = Text Object
* DI/DF = Decimal Value
* DI = Decimal Integer
* DF = Decimal Float
*/
private byte displayFlag = 1;
private Stf stf = new Stf();
private String stfFile = "";
private String stfLabel = "";
private long tuObjectId;
private String tuStfFile = "";
private String tuStfLabel = "";
private long tuObjectId = 0;
private Stf tuStf = new Stf();
private String tuCustomString = "";
private long ttObjectId;
private String ttStfFile = "";
private String ttStfLabel = "";
private long ttObjectId = 0;
private Stf ttStf = new Stf();
private String ttCustomString = "";
private long toObjectId;
private String toStfFile = "";
private String toStfLabel = "";
private long toObjectId = 0;
private Stf toStf = new Stf();
private String toCustomString = "";
private int diInteger;
private float dfFloat;
private int diInteger = 0;
private float dfFloat = 0;
// TODO: Add more constructors
public ProsePackage(String stfFile, String stfLabel) {
this.stfFile = stfFile;
this.stfLabel = stfLabel;
stf.setStfFilename(stfFile);
stf.setStfName(stfLabel);
}
public ProsePackage(String stfFile, String stfLabel, long tuObjectId, String tuStfFile, String tuStfLabel, String tuCustomString) {
this.stfFile = stfFile;
this.stfLabel = stfLabel;
stf.setStfFilename(stfFile);
stf.setStfName(stfLabel);
this.tuObjectId = tuObjectId;
this.tuStfFile = tuStfFile;
this.tuStfLabel = tuStfLabel;
tuStf.setStfFilename(tuStfFile);
tuStf.setStfName(tuStfLabel);
this.tuCustomString = tuCustomString;
}
public byte getDisplayFlag() {
return displayFlag;
/*
* Any parameters can be entered.
*
* Any integers set diInteger
* Any floats set dfFloat
* Any "@stfFile:label" sets the default stf
* "TU" followed by objectId, "@stfFile:label" or customString
* "TT" followed by objectId, "@stfFile:label" or customString
* "TO" followed by objectId, "@stfFile:label" or customString
*/
public ProsePackage(Object ... objects) {
for (Object object: objects) {
if (object instanceof Object[]) {
objects = (Object[]) object;
break;
}
}
for (int i = 0; i < objects.length; i++) {
Object object = objects[i];
if (object instanceof String) {
String string = (String) object;
if ((i + 1) < objects.length) {
long objectId = 0;
Stf stf = null;
String customString = null;
if (objects[i + 1] instanceof Long) {
objectId = (Long) objects[i + 1];
} else if (objects[i + 1] instanceof String) {
String str = (String) objects[i + 1];
if (str.startsWith("@") && str.contains(":") && !str.contains(" ")) {
stf = new Stf(str);
} else {
customString = str;
}
}
switch (string.toUpperCase()) {
case "TU":
tuObjectId = (objectId == 0) ? tuObjectId : objectId;
tuStf = (stf == null) ? tuStf : stf;
tuCustomString = (customString == null) ? tuCustomString : customString;
continue;
case "TT":
ttObjectId = (objectId == 0) ? ttObjectId : objectId;
ttStf = (stf == null) ? ttStf : stf;
ttCustomString = (customString == null) ? ttCustomString : customString;
continue;
case "TO":
toObjectId = (objectId == 0) ? toObjectId : objectId;
toStf = (stf == null) ? toStf : stf;
toCustomString = (customString == null) ? toCustomString : customString;
continue;
default:
//
}
}
stf.setString((String) object);
} else if (object instanceof Integer) {
diInteger = (Integer) object;
} else if (object instanceof Float) {
dfFloat = (Float) object;
}
}
}
public void setDisplayFlag(byte displayFlag) {
this.displayFlag = displayFlag;
public Stf getStf() {
return stf;
}
public String getStfFile() {
return stfFile;
public void setStf(Stf stf) {
this.stf = stf;
}
public void setStfFile(String stfFile) {
this.stfFile = stfFile;
}
public String getStfLabel() {
return stfLabel;
}
public void setStfLabel(String stfLabel) {
this.stfLabel = stfLabel;
}
public long getTuObjectId() {
return tuObjectId;
}
public void setTuObjectId(long tuObjectId) {
this.tuObjectId = tuObjectId;
}
public String getTuStfFile() {
return tuStfFile;
public Stf getTuStf() {
return tuStf;
}
public void setTuStfFile(String tuStfFile) {
this.tuStfFile = tuStfFile;
public void setTuStf(Stf tuStf) {
this.tuStf = tuStf;
}
public String getTuStfLabel() {
return tuStfLabel;
}
public void setTuStfLabel(String tuStfLabel) {
this.tuStfLabel = tuStfLabel;
}
public String getTuCustomString() {
return tuCustomString;
}
public void setTuCustomString(String tuCustomString) {
this.tuCustomString = tuCustomString;
}
public long getTtObjectId() {
return ttObjectId;
}
public void setTtObjectId(long ttObjectId) {
this.ttObjectId = ttObjectId;
}
public String getTtStfFile() {
return ttStfFile;
public Stf getTtStf() {
return ttStf;
}
public void setTtStfFile(String ttStfFile) {
this.ttStfFile = ttStfFile;
public void setTtStf(Stf ttStf) {
this.ttStf = ttStf;
}
public String getTtStfLabel() {
return ttStfLabel;
}
public void setTtStfLabel(String ttStfLabel) {
this.ttStfLabel = ttStfLabel;
}
public String getTtCustomString() {
return ttCustomString;
}
public void setTtCustomString(String ttCustomString) {
this.ttCustomString = ttCustomString;
}
public long getToObjectId() {
return toObjectId;
}
public void setToObjectId(long toObjectId) {
this.toObjectId = toObjectId;
}
public String getToStfFile() {
return toStfFile;
public Stf getToStf() {
return toStf;
}
public void setToStfFile(String toStfFile) {
this.toStfFile = toStfFile;
public void setToStf(Stf toStf) {
this.toStf = toStf;
}
public String getToStfLabel() {
return toStfLabel;
}
public void setToStfLabel(String toStfLabel) {
this.toStfLabel = toStfLabel;
}
public String getToCustomString() {
return toCustomString;
}
public void setToCustomString(String toCustomString) {
this.toCustomString = toCustomString;
}
public int getDiInteger() {
return diInteger;
}
public void setDiInteger(int diInteger) {
this.diInteger = diInteger;
}
public float getDfFloat() {
return dfFloat;
}
public void setDfFloat(float dfFloat) {
this.dfFloat = dfFloat;
}
+15 -6
View File
@@ -30,9 +30,9 @@ import com.sleepycat.persist.model.Persistent;
@Persistent
public class Stf extends Delta {
private AString stfFilename;
private AString stfFilename = new AString("");
private int spacer = 0;
private AString stfName;
private AString stfName = new AString("");
public Stf(String stfFilename, int spacer, String stfName) {
this.stfFilename = new AString(stfFilename);
@@ -40,6 +40,10 @@ public class Stf extends Delta {
this.stfName = new AString(stfName);
}
public Stf(String stf) {
setString(stf);
}
public Stf() {
}
@@ -82,15 +86,20 @@ public class Stf extends Delta {
public String getString() {
synchronized(objectMutex) {
return ("@" + stfFilename + ":" + stfName);
return ("@" + stfFilename.get() + ":" + stfName.get());
}
}
public void setString(String stf) {
synchronized(objectMutex) {
stf = stf.replace("@", "");
stfFilename.set(stf.split(":")[0]);
stfName.set(stf.split(":")[1]);
if (stf == null || stf.equals("")) {
stfFilename.set("");
stfName.set("");
} else if (stf.contains(":")) {
stf = stf.replace("@", "");
stfFilename.set(stf.split(":")[0]);
stfName.set(stf.split(":")[1]);
}
}
}
+35
View File
@@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package resources.datatables;
public class DisplayType {
public static byte Broadcast = 0; // Level up. combatspam/skill_up
//public static byte Screen = 1; // Screen? XP gain
public static byte Chat = 2;
//public static byte Overhead = 3; // Flytext? Seen on ent duration
//public static byte Combat = 4; // CombatSpam?
//public static byte Combat = 5; // Seen in combat flytext
//public static byte Combat = 11; // Seen when blocking
}
+6 -1
View File
@@ -65,7 +65,12 @@ public abstract class Delta implements IDelta {
}
public static IoBuffer createBuffer(int size) {
return bufferPool.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN);
return IoBuffer.allocate(size, false).order(ByteOrder.LITTLE_ENDIAN);
}
public static IoBuffer resizeBuffer(IoBuffer buffer) {
int size = buffer.position();
return buffer == null ? createBuffer(0) : createBuffer(size).put(buffer.flip().array(), 0, size).flip();
}
}
@@ -151,7 +151,7 @@ public class BuildingObject extends TangibleObject implements IPersistent {
public Vector<TangibleObject> getItemsList() {
Vector<TangibleObject> items = new Vector<TangibleObject>();
getCells().forEach(c -> c.viewChildren(c, true, false, (item) -> {
if(!(item instanceof CreatureObject))
if(!(item instanceof CreatureObject) && item.getTemplate() != "object/tangible/terminal/shared_terminal_player_structure.iff")
items.add((TangibleObject) item);
}));
return items;
@@ -39,6 +39,7 @@ import protocol.swg.UpdatePVPStatusMessage;
import protocol.swg.chat.ChatSystemMessage;
import protocol.swg.objectControllerObjects.Animation;
import protocol.swg.objectControllerObjects.Posture;
import protocol.swg.objectControllerObjects.StartTask;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
@@ -48,11 +49,13 @@ import com.sleepycat.persist.model.NotPersistent;
import main.NGECore;
import engine.clients.Client;
import resources.common.Cooldown;
import resources.common.OutOfBand;
import resources.objects.Buff;
import resources.objects.DamageOverTime;
import resources.objects.SWGList;
import resources.objects.SWGMap;
import resources.objects.SkillMod;
import engine.resources.common.CRC;
import engine.resources.objects.IPersistent;
import engine.resources.objects.MissionCriticalObject;
import engine.resources.objects.SWGObject;
@@ -61,6 +64,7 @@ import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
import resources.objects.player.PlayerObject;
import resources.objects.tangible.TangibleObject;
import services.command.BaseSWGCommand;
@Entity(version=6)
public class CreatureObject extends TangibleObject implements IPersistent {
@@ -1113,18 +1117,17 @@ public class CreatureObject extends TangibleObject implements IPersistent {
}
public void sendSystemMessage(String message, byte displayType) {
if(getClient() != null && getClient().getSession() != null) {
ChatSystemMessage systemMsg = new ChatSystemMessage(message, displayType);
getClient().getSession().write(systemMsg.serialize());
}
sendSystemMessage(message, new OutOfBand(), displayType);
}
public void sendSystemMessage(String stfFilename, String stfName, int stat, int displayType) {
public void sendSystemMessage(OutOfBand outOfBand, byte displayType) {
sendSystemMessage("", outOfBand, displayType);
}
public void sendSystemMessage(String message, OutOfBand outOfBand, byte displayType) {
if(getClient() != null && getClient().getSession() != null) {
ChatSystemMessage systemMsg = new ChatSystemMessage(stfFilename, stfName, stat, (byte) displayType);
ChatSystemMessage systemMsg = new ChatSystemMessage(message, outOfBand, displayType);
getClient().getSession().write(systemMsg.serialize());
}
@@ -1740,16 +1743,17 @@ public class CreatureObject extends TangibleObject implements IPersistent {
if (System.currentTimeMillis() < cooldowns.get(cooldownGroup)) {
return true;
} else {
removeCooldown(cooldownGroup);
cooldowns.remove(cooldownGroup);
}
}
return false;
}
public boolean removeCooldown(String cooldownGroup) {
if (cooldowns.containsKey(cooldownGroup)) {
cooldowns.remove(cooldownGroup);
public boolean removeCooldown(int actionCounter, BaseSWGCommand command) {
if (cooldowns.containsKey(command.getCooldownGroup())) {
cooldowns.remove(command.getCooldownGroup());
getClient().getSession().write(new ObjControllerMessage(0x0B, new StartTask(actionCounter, getObjectID(), command.getCommandCRC(), CRC.StringtoCRC(command.getCooldownGroup()), -1)).serialize());
return true;
}
@@ -1765,7 +1769,7 @@ public class CreatureObject extends TangibleObject implements IPersistent {
if (System.currentTimeMillis() < cooldowns.get(cooldownGroup)) {
return (long) (cooldowns.get(cooldownGroup) - System.currentTimeMillis());
} else {
removeCooldown(cooldownGroup);
cooldowns.remove(cooldownGroup);
}
}
@@ -37,6 +37,7 @@ import protocol.swg.PlayClientEffectObjectMessage;
import protocol.swg.StopClientEffectObjectByLabel;
import protocol.swg.UpdatePVPStatusMessage;
import protocol.swg.objectControllerObjects.ShowFlyText;
import resources.common.OutOfBand;
import resources.common.RGB;
import resources.objects.creature.CreatureObject;
import resources.objects.loot.LootGroup;
@@ -375,45 +376,40 @@ public class TangibleObject extends SWGObject {
return getPvPBitmask() == 1 || getPvPBitmask() == 2;
}
} else if(attacker.getSlottedObject("ghost") == null)
return true;
return getPvPBitmask() == 1 || getPvPBitmask() == 2;
}
public void showFlyText(String stfFile, String stfString, float scale, RGB color, int displayType) {
Set<Client> observers = getObservers();
if (getClient() != null) {
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), stfFile, stfString, scale, color, displayType))).serialize());
}
for (Client client : observers) {
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), stfFile, stfString, scale, color, displayType))).serialize());
}
public void showFlyText(OutOfBand outOfBand, float scale, RGB color, int displayType, boolean notifyObservers) {
showFlyText("", outOfBand, scale, color, displayType, notifyObservers);
}
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, 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, customText, xp, scale, color, displayType))).serialize());
}
public void showFlyText(String stf, float scale, RGB color, int displayType, boolean notifyObservers) {
showFlyText(stf, new OutOfBand(), scale, color, displayType, notifyObservers);
}
public void showFlyText(String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType, int unkInt) {
//Set<Client> observers = getObservers();
if (getClient() != null) {
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
public void showFlyText(String stf, OutOfBand outOfBand, float scale, RGB color, int displayType, boolean notifyObservers) {
if (outOfBand == null) {
outOfBand = new OutOfBand();
}
/*for (Client client : observers) {
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), unkInt, 1, 1, -1, stfFile, stfString, customText, xp, scale, color, displayType))).serialize());
}*/
if (color == null) {
color = new RGB(255, 255, 255);
}
if (getClient() != null) {
getClient().getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(getObjectID(), getObjectID(), stf, outOfBand, scale, color, displayType))).serialize());
}
if (notifyObservers) {
Set<Client> observers = getObservers();
for (Client client : observers) {
client.getSession().write((new ObjControllerMessage(0x0000000B, new ShowFlyText(client.getParent().getObjectID(), getObjectID(), stf, outOfBand, scale, color, displayType))).serialize());
}
}
}
public void playEffectObject(String effectFile, String commandString) {
+2 -1
View File
@@ -24,6 +24,7 @@ import resources.common.BuffBuilder;
import resources.common.IDAttribute;
import resources.common.MathUtilities;
import resources.common.ObjControllerOpcodes;
import resources.common.OutOfBand;
import resources.common.Performance;
import resources.common.PerformanceEffect;
import resources.common.RGB;
@@ -821,7 +822,7 @@ public class EntertainmentService implements INetworkDispatch {
int hMinutes = MathUtilities.secondsToHourMinutes(duration * 60);
int hours = MathUtilities.secondsToWholeHours(duration * 60);
spectator.showFlyText("spam", "buff_duration_tick_observer", String.valueOf(hours) + " hours , " + hMinutes + " minutes ", 0, (float) 0.66, new RGB(255, 182, 193), 3, 78);
spectator.showFlyText(OutOfBand.ProsePackage("@spam:buff_duration_tick_observer", "TO", hours + " hours , " + hMinutes + " minutes "), 0.66f, new RGB(255, 182, 193), 3, false);
spectator.setAttachment("inspireDuration", duration);
//System.out.println("Inspire Duration: " + spectator.getAttachment("inspireDuration") + " on " + spectator.getCustomName());
+1 -1
View File
@@ -410,7 +410,7 @@ public class LootService implements INetworkDispatch {
if (lootedObject instanceof CreatureObject){
CreatureObject lootedCreature = (CreatureObject) lootedObject;
int creatureCL = lootedCreature.getLevel();
creatureCL = 90;
//creatureCL = 90;
int maximalCredits = (int)Math.floor(4*creatureCL + creatureCL*creatureCL*4/100);
int minimalCredits = (int)Math.floor(creatureCL*2 + maximalCredits/2);
int spanOfCredits = maximalCredits - minimalCredits;
+15 -12
View File
@@ -61,9 +61,12 @@ import protocol.swg.objectControllerObjects.ShowLootBox;
import resources.common.FileUtilities;
import resources.common.ObjControllerOpcodes;
import resources.common.Opcodes;
import resources.common.OutOfBand;
import resources.common.ProsePackage;
import resources.common.RGB;
import resources.common.SpawnPoint;
import resources.common.StringUtilities;
import resources.datatables.DisplayType;
import resources.datatables.PlayerFlags;
import resources.datatables.Professions;
import resources.guild.Guild;
@@ -807,7 +810,7 @@ public class PlayerService implements INetworkDispatch {
creature.setLevel((short) level);
core.scriptService.callScript("scripts/collections/", "master_" + player.getProfession(), "addMasterBadge", core, creature);
creature.showFlyText("cbt_spam", "skill_up", (float) 2.5, new RGB(154, 205, 50), 0);
creature.showFlyText(OutOfBand.ProsePackage("@cbt_spam:skill_up"), 2.5f, new RGB(154, 205, 50), 0, true);
creature.playEffectObject("clienteffect/skill_granted.cef", "");
creature.playMusic("sound/music_acq_bountyhunter.snd");
} catch (InstantiationException | IllegalAccessException e) {
@@ -846,7 +849,7 @@ public class PlayerService implements INetworkDispatch {
// 1. Add the experience.
if (experience > 0 && !creature.isStationary()) {
creature.showFlyText("base_player", "prose_flytext_xp", "", experience, (float) 2.5, new RGB(180, 60, 240), 1);
creature.showFlyText(OutOfBand.ProsePackage("@base_player:prose_flytext_xp", experience), 2.5f, new RGB(180, 60, 240), 1, true);
}
String xpType = ((player.getProfession().contains("entertainer")) ? "entertainer" : ((player.getProfession().contains("trader")) ? "crafting" : "combat_general"));
@@ -881,49 +884,49 @@ public class PlayerService implements INetworkDispatch {
if (luck >= 1) {
core.skillModService.addSkillMod(creature, "luck", (int) luck);
creature.sendSystemMessage("spam", "level_up_stat_gain_0", (int) luck, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_0", (int) luck), DisplayType.Broadcast);
}
if (precision >= 1) {
core.skillModService.addSkillMod(creature, "precision", (int) precision);
creature.sendSystemMessage("spam", "level_up_stat_gain_1", (int) precision, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_1", (int) precision), DisplayType.Broadcast);
}
if (strength >= 1) {
core.skillModService.addSkillMod(creature, "strength", (int) strength);
creature.sendSystemMessage("spam", "level_up_stat_gain_2", (int) strength, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_2", (int) strength), DisplayType.Broadcast);
}
if (constitution >= 1) {
core.skillModService.addSkillMod(creature, "constitution", (int) constitution);
creature.sendSystemMessage("spam", "level_up_stat_gain_3", (int) constitution, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_3", (int) constitution), DisplayType.Broadcast);
}
if (stamina >= 1) {
core.skillModService.addSkillMod(creature, "stamina", (int) stamina);
creature.sendSystemMessage("spam", "level_up_stat_gain_4", (int) stamina, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_4", (int) stamina), DisplayType.Broadcast);
}
if (agility >= 1) {
core.skillModService.addSkillMod(creature, "agility", (int) agility);
creature.sendSystemMessage("spam", "level_up_stat_gain_5", (int) agility, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_5", (int) agility), DisplayType.Broadcast);
}
if (health >= 1) {
creature.setMaxHealth((creature.getMaxHealth() + (int) health + (healthGranted - creature.getGrantedHealth())));
creature.setHealth(creature.getMaxHealth());
creature.sendSystemMessage("spam", "level_up_stat_gain_6", (((int) health) + (((int) constitution) * 8) + (((int) stamina) * 2)), 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_6", (((int) health) + (((int) constitution) * 8) + (((int) stamina) * 2))), DisplayType.Broadcast);
}
if (action >= 1) {
creature.setMaxAction((creature.getMaxAction() + (int) action));
creature.setAction(creature.getMaxAction());
creature.sendSystemMessage("spam", "level_up_stat_gain_7", (((int) action) + (((int) stamina) * 8) + (((int) constitution) * 2)), 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@spam:level_up_stat_gain_7", (((int) action) + (((int) stamina) * 8) + (((int) constitution) * 2))), DisplayType.Broadcast);
}
creature.setGrantedHealth(((Integer) experienceTable.getObject(i, 4)));
// -> Expertise point added automatically by client
creature.showFlyText("cbt_spam", "level_up", (float) 2.5, new RGB(100, 149, 237), 0);
creature.showFlyText(OutOfBand.ProsePackage("@cbt_spam:level_up"), 2.5f, new RGB(100, 149, 237), 0, true);
// 4. Adds roadmap rewards
int level = creature.getLevel();
@@ -946,7 +949,7 @@ public class PlayerService implements INetworkDispatch {
}
}
creature.showFlyText("cbt_spam", "skill_up", (float) 2.5, new RGB(154, 205, 50), 0);
creature.showFlyText(OutOfBand.ProsePackage("@cbt_spam:skill_up"), 2.5f, new RGB(154, 205, 50), 0, true);
creature.playEffectObject("clienteffect/skill_granted.cef", "");
creature.playMusic("sound/music_acq_bountyhunter.snd");
core.skillService.addSkill(creature, roadmapSkillName);
+2 -1
View File
@@ -813,7 +813,7 @@ public class SimulationService implements INetworkDispatch {
//core.chatService.joinChatRoom(object.getCustomName().toLowerCase(), "SWG." + core.getGalaxyName() + "." + object.getPlanet().getName());
if (!object.hasSkill(ghost.getProfessionWheelPosition())) {
object.showFlyText("cbt_spam", "skill_up", (float) 2.5, new RGB(154, 205, 50), 0);
object.showFlyText(OutOfBand.ProsePackage("@cbt_spam:skill_up"), 2.5f, new RGB(154, 205, 50), 0, true);
object.playEffectObject("clienteffect/skill_granted.cef", "");
object.playMusic("sound/music_acq_bountyhunter.snd");
core.skillService.addSkill(object, ghost.getProfessionWheelPosition());
@@ -824,6 +824,7 @@ public class SimulationService implements INetworkDispatch {
if(object.getPosture() == Posture.Dead)
core.playerService.sendCloningWindow(object, false);
}
public void transferToPlanet(SWGObject object, Planet planet, Point3D newPos, Quaternion newOrientation, SWGObject newParent) {
+2 -1
View File
@@ -46,6 +46,7 @@ import engine.resources.scene.Point3D;
import engine.resources.service.INetworkDispatch;
import engine.resources.service.INetworkRemoteEvent;
import resources.common.*;
import resources.datatables.DisplayType;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import protocol.swg.AddIgnoreMessage;
@@ -726,7 +727,7 @@ public class ChatService implements INetworkDispatch {
}
public void broadcastGalaxy(String message) {
core.simulationService.notifyAllClients(new ChatSystemMessage(message, (byte) 0).serialize());
core.simulationService.notifyAllClients(new ChatSystemMessage(message, new OutOfBand(), DisplayType.Broadcast).serialize());
}
private void loadChatRooms() {
@@ -30,11 +30,11 @@ import org.python.core.Py;
import org.python.core.PyObject;
import resources.common.FileUtilities;
import resources.common.OutOfBand;
import resources.datatables.DisplayType;
import resources.objects.creature.CreatureObject;
import resources.objects.player.PlayerObject;
import main.NGECore;
import engine.clientdata.ClientFileManager;
import engine.clientdata.visitors.DatatableVisitor;
import engine.resources.scene.Point3D;
@@ -311,7 +311,7 @@ public class CollectionService implements INetworkDispatch {
player.setCollections(collections.toByteArray());
if (!hidden && !noMessage) {
creature.sendSystemMessage("collection_n", collection, 0, 0);
creature.sendSystemMessage(OutOfBand.ProsePackage("@collection_n:" + collection), DisplayType.Broadcast);
}
if (!music.equals("")) {
+86 -16
View File
@@ -45,7 +45,6 @@ import resources.common.*;
import protocol.swg.ObjControllerMessage;
import protocol.swg.objectControllerObjects.CommandEnqueue;
import protocol.swg.objectControllerObjects.CommandEnqueueRemove;
import protocol.swg.objectControllerObjects.ShowFlyText;
import protocol.swg.objectControllerObjects.StartTask;
import resources.objects.creature.CreatureObject;
import resources.objects.harvester.HarvesterObject;
@@ -76,7 +75,7 @@ public class CommandService implements INetworkDispatch {
return false;
}
if (command.getCharacterAbility().length() > 0 && !actor.hasAbility(command.getCharacterAbility()) && !command.getCharacterAbility().equals("admin")) {
if (command.getCharacterAbility().length() > 0 && !actor.hasAbility(command.getCharacterAbility()) && !command.getCharacterAbility().equals("admin") && actor.getClient() != null) {
return false;
}
@@ -115,8 +114,18 @@ public class CommandService implements INetworkDispatch {
switch (command.getTargetType()) {
case 0: // Target Not Used For This Command
break;
case 1: // Other Only
if (target == null || target == actor) {
case 1: // Other Only (objectId/targetName)
if (target == null) {
if (commandArgs != null && !commandArgs.equals("")) {
String name = commandArgs.split(" ")[0];
target = core.objectService.getObjectByFirstName(name);
}
break;
}
if (target == actor) {
return false;
}
@@ -129,16 +138,36 @@ public class CommandService implements INetworkDispatch {
}
if (!core.simulationService.checkLineOfSight(actor, target)) {
actor.showFlyText("@combat_effects:cant_see", 1.5f, new RGB(72, 209, 204), 1, true);
return false;
}
break;
case 2: // Self Only
if (target == null) {
target = actor;
case 2: // Anyone (objectId/targetName)
if (actor.getClient() == null) {
break;
}
if (target != actor && target instanceof CreatureObject && actor.getClient() != null) {
if (target == null) {
if (commandArgs != null && !commandArgs.equals("")) {
String name = commandArgs.split(" ")[0];
target = core.objectService.getObjectByFirstName(name);
}
break;
}
if (target.getContainer() == actor || target.getGrandparent() == actor) {
break;
}
if (command.getMaxRangeToTarget() != 0 && actor.getPosition().getDistance(target.getPosition()) > command.getMaxRangeToTarget()) {
return false;
}
if (!core.simulationService.checkLineOfSight(actor, target)) {
actor.showFlyText("@combat_effects:cant_see", 1.5f, new RGB(72, 209, 204), 1, true);
return false;
}
@@ -146,13 +175,45 @@ public class CommandService implements INetworkDispatch {
case 3: // Free Target Mode (rally points, group waypoints)
target = null;
if (commandArgs == null) {
break;
}
String[] args = commandArgs.split(" ");
float x = 0, y = 0, z = 0;
try {
if (args.length == 2) {
x = Integer.valueOf(args[0]);
z = Integer.valueOf(args[1]);
} else if (args.length > 2) {
x = Integer.valueOf(args[0]);
y = Integer.valueOf(args[1]);
z = Integer.valueOf(args[2]);
}
} catch (NumberFormatException e) {
return false;
}
Point3D position = new Point3D(x, y, z);
if (command.getMaxRangeToTarget() != 0 && actor.getPosition().getDistance(position) > command.getMaxRangeToTarget()) {
return false;
}
break;
case 4: // Anyone
case 4: // Any object
if (target == null) {
target = actor;
break;
}
if (command.getMaxRangeToTarget() != 0 && actor.getPosition().getDistance(target.getPosition()) > command.getMaxRangeToTarget()) {
return false;
}
if (!core.simulationService.checkLineOfSight(actor, target)) {
actor.showFlyText("@combat_effects:cant_see", 1.5f, new RGB(72, 209, 204), 1, true);
return false;
}
@@ -173,7 +234,10 @@ public class CommandService implements INetworkDispatch {
TangibleObject object = (TangibleObject) target;
if (object.isAttackableBy(actor) || actor.getFactionStatus() < ((CreatureObject) object).getFactionStatus() || (!object.getFaction().equals("") && !object.getFaction().equals(actor.getFaction()))) {
if(object instanceof CreatureObject && actor.getFactionStatus() < ((CreatureObject) object).getFactionStatus())
return false;
if (object.isAttackableBy(actor) || (!object.getFaction().equals("") && !object.getFaction().equals(actor.getFaction()))) {
return false;
}
@@ -432,12 +496,8 @@ public class CommandService implements INetworkDispatch {
if(target != attacker && success && !core.simulationService.checkLineOfSight(attacker, target)) {
ShowFlyText los = new ShowFlyText(attacker.getObjectID(), attacker.getObjectID(), "combat_effects", "cant_see", (float) 1.5, new RGB(72, 209, 204), 1);
ObjControllerMessage objController = new ObjControllerMessage(0x1B, los);
attacker.getClient().getSession().write(objController.serialize());
attacker.showFlyText("@combat_effects:cant_see", 1.5f, new RGB(72, 209, 204), 1, true);
success = false;
}
if(!success && attacker.getClient() != null) {
@@ -470,6 +530,15 @@ public class CommandService implements INetworkDispatch {
}
public void removeCommand(CreatureObject actor, int actionCounter, BaseSWGCommand command) {
if (actor == null || actor.getClient() == null || command == null) {
return;
}
actor.getClient().getSession().write(new ObjControllerMessage(0x0B, new CommandEnqueueRemove(actor.getObjectId(), actionCounter)).serialize());
actor.removeCooldown(actionCounter, command);
}
@Override
public void insertOpcodes(Map<Integer, INetworkRemoteEvent> swgOpcodes, Map<Integer, INetworkRemoteEvent> objControllerOpcodes) {
@@ -512,6 +581,7 @@ public class CommandService implements INetworkDispatch {
if (!callCommand(actor, target, command, commandEnqueue.getActionCounter(), commandEnqueue.getCommandArguments())) {
// Call failScriptHook
removeCommand(actor, commandEnqueue.getActionCounter(), command);
}
}
+2 -7
View File
@@ -456,7 +456,8 @@ public class HousingService implements INetworkDispatch {
Vector<TangibleObject> itemList = building.getItemsList();
for (int i=0;i<itemList.size();i++){
window.addListBoxMenuItem("#"+(i+1)+": " + itemList.get(i).getTemplate(), i);
String itemName = (itemList.get(i).getCustomName() != null) ? itemList.get(i).getCustomName() : "@" + itemList.get(i).getStfFilename() + ":" + itemList.get(i).getStfName();
window.addListBoxMenuItem(itemName, i);
}
window.setProperty("btnOk:visible", "True");
@@ -739,12 +740,6 @@ public class HousingService implements INetworkDispatch {
}
public void addItemToHouseItemList(TangibleObject item, SWGObject container){
BuildingObject building = (BuildingObject) container.getContainer();
building.getItemsList().add(item);
}
public String fetchPrivacyString(TangibleObject object){
final BuildingObject building = (BuildingObject) object.getAttachment("housing_parentstruct");
return building.getPrivacyString();
+28
View File
@@ -35,6 +35,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
@@ -73,6 +74,7 @@ import protocol.swg.chat.ChatOnConnectAvatar;
import protocol.swg.chat.ChatOnGetFriendsList;
import protocol.swg.chat.ChatRoomList;
import protocol.swg.chat.ChatServerStatus;
import protocol.swg.objectControllerObjects.ShowFlyText;
import protocol.swg.chat.VoiceChatStatus;
import protocol.swg.objectControllerObjects.UiPlayEffect;
import engine.clientdata.ClientFileManager;
@@ -619,6 +621,32 @@ public class ObjectService implements INetworkDispatch {
}
public SWGObject getObjectByFirstName(String customName) {
synchronized(objectList) {
for(SWGObject obj : objectList.values()) {
if(obj.getCustomName() == null)
continue;
if(obj.getCustomName().startsWith(customName))
return obj;
}
}
EntityCursor<CreatureObject> cursor = core.getCreatureODB().getCursor(Long.class, CreatureObject.class);
Iterator<CreatureObject> it = cursor.iterator();
while(it.hasNext()) {
if(it.next().getCustomName().startsWith(customName))
return it.next();
}
return null;
}
public CreatureObject getCreatureFromDB(long objectId) {
return core.getCreatureODB().get(new Long(objectId), Long.class, CreatureObject.class);
}
+2 -1
View File
@@ -48,6 +48,7 @@ import resources.objects.weapon.WeaponObject;
import services.ai.AIActor;
import services.ai.LairActor;
import engine.resources.container.CreatureContainerPermissions;
import engine.resources.container.StaticContainerPermissions;
import engine.resources.scene.Planet;
import engine.resources.scene.Point3D;
import engine.resources.scene.Quaternion;
@@ -90,7 +91,7 @@ public class SpawnService {
return null;
TangibleObject inventory = (TangibleObject) core.objectService.createObject("object/tangible/inventory/shared_character_inventory.iff", creature.getPlanet());
inventory.setContainerPermissions(CreatureContainerPermissions.CREATURE_CONTAINER_PERMISSIONS);
inventory.setContainerPermissions(StaticContainerPermissions.STATIC_CONTAINER_PERMISSIONS);
/*if(mobileTemplate.getCustomWeapon() != null) {