Fixed crash caused by buildings, fixed weapon object superclass, added equipment and appearance equipment deltas

This commit is contained in:
Light2
2013-12-14 21:25:31 +01:00
parent 3fc02b8f1f
commit 896b342972
22 changed files with 298 additions and 109 deletions
+39 -28
View File
@@ -140,6 +140,10 @@ public class ObjectService implements INetworkDispatch {
}
public SWGObject createObject(String Template, long objectID, Planet planet, Point3D position, Quaternion orientation, String customServerTemplate) {
return createObject(Template, objectID, planet, position, orientation, customServerTemplate, false);
}
public SWGObject createObject(String Template, long objectID, Planet planet, Point3D position, Quaternion orientation, String customServerTemplate, boolean overrideSnapshot) {
SWGObject object = null;
CrcStringTableVisitor crcTable;
try {
@@ -155,7 +159,7 @@ public class ObjectService implements INetworkDispatch {
if(objectID == 0)
objectID = generateObjectID();
else
isSnapshot = true;
isSnapshot = !overrideSnapshot;
if(Template.startsWith("object/creature")) {
@@ -173,10 +177,10 @@ public class ObjectService implements INetworkDispatch {
object = new WeaponObject(objectID, planet, Template, position, orientation);
} else if(Template.startsWith("object/building") || Template.startsWith("object/static/worldbuilding/structures")){
} else if(Template.startsWith("object/building") || Template.startsWith("object/static/worldbuilding/structures") || Template.startsWith("object/static/structure")){
object = new BuildingObject(objectID, planet, position, orientation, Template);
if(!isSnapshot && object.getPortalVisitor() != null) {
if(!isSnapshot && !overrideSnapshot && object.getPortalVisitor() != null) {
int cellCount = object.getPortalVisitor().cells.size() - 1; // -1 for index 0 cell which is outside the building and used for ai pathfinding
for (int i = 0; i < cellCount; i++) {
CellObject cell = (CellObject) createObject("object/cell/shared_cell.iff", planet);
@@ -535,31 +539,26 @@ public class ObjectService implements INetworkDispatch {
}
Point3D position = creature.getPosition();
UnkByteFlag unkByteFlag = new UnkByteFlag();
session.write(unkByteFlag.serialize());
ParametersMessage parameters = new ParametersMessage();
session.write(parameters.serialize());
core.buffService.clearBuffs(creature);
core.chatService.loadMailHeaders(client);
HeartBeatMessage heartBeat = new HeartBeatMessage();
session.write(heartBeat.serialize());
UnkByteFlag unkByteFlag = new UnkByteFlag();
session.write(unkByteFlag.serialize());
core.buffService.clearBuffs(creature);
CmdStartScene startScene = new CmdStartScene((byte) 0, objectId, creature.getPlanet().getPath(), creature.getTemplate(), position.x, position.y, position.z, System.currentTimeMillis() / 1000, 0);
session.write(startScene.serialize());
creature.makeAware(core.guildService.getGuildObject());
creature.makeAware(creature);
core.simulationService.handleZoneIn(client);
ParametersMessage parameters = new ParametersMessage();
session.write(parameters.serialize());
CmdSceneReady sceneReady = new CmdSceneReady();
client.getSession().write(sceneReady.serialize());
creature.makeAware(core.guildService.getGuildObject());
core.chatService.loadMailHeaders(client);
core.simulationService.handleZoneIn(client);
creature.makeAware(creature);
PlayerObject ghost = (PlayerObject) creature.getSlottedObject("ghost");
@@ -731,7 +730,7 @@ public class ObjectService implements INetworkDispatch {
qz = (Float) buildoutTable.getObject(i, 8);
radius = (Float) buildoutTable.getObject(i, 9);
portalCRC = (Integer) buildoutTable.getObject(i, 10);
} else {
objectId = (Integer) buildoutTable.getObject(i, 0);
@@ -751,20 +750,32 @@ public class ObjectService implements INetworkDispatch {
}
if(!template.equals("object/cell/shared_cell.iff") && objectId != 0 && getObject(objectId) != null) {
//System.out.println("Duplicate buildout object: " + template);
continue;
}
List<Long> containers = new ArrayList<Long>();
SWGObject object;
if(objectId != 0 && containerId == 0) {
if(portalCRC != 0)
objectId = 0;
object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz));
if(portalCRC != 0) {
containers.add(objectId);
object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz), null, true);
} else {
object = createObject(template, objectId, planet, new Point3D(px + x1, py, pz + z1), new Quaternion(qw, qx, qy, qz));
}
if(object == null)
continue;
if(radius > 256)
object.setAttachment("bigSpawnRange", new Boolean(true));
core.simulationService.add(object, object.getPosition().x, object.getPosition().z);
} else if(objectId != 0 && containerId != 0 && cellIndex != 0) {
object = createObject(template, objectId, planet, new Point3D(px, py, pz), new Quaternion(qw, qx, qy, qz));
if(object instanceof CellObject)
} else if(containerId != 0) {
object = createObject(template, 0, planet, new Point3D(px, py, pz), new Quaternion(qw, qx, qy, qz));
if(containers.contains(containerId)) {
object.setisInSnapshot(false);
containers.add(objectId);
}
if(object instanceof CellObject && cellIndex != 0)
((CellObject) object).setCellNumber(cellIndex);
SWGObject parent = getObject(containerId);