mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-07-28 23:15:53 -04:00
Changed duplicate id handling, static objids
- I noticed when targetting a client-spawned object (EK brazier), it sent a target packet to the client with all 8 bytes filled, instead of just the 4 stated in the buildout. It seems the same 4 digits get added to all buildout ids. As a result, all buildout int-objectIds now have the follow bytes added to them: FF FF 86 F9 Not sure about snapshot objects, but I imagine it's the same for them. - I had to allow duplicate objects to be spawned in order for heroics and instances to work. It gives every duplicate object a new objectId and also replaces the parentIds as well by storing the changes in a map on each buildout area cycle.
This commit is contained in:
@@ -30,6 +30,7 @@ import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -84,6 +85,7 @@ import engine.resources.scene.Quaternion;
|
||||
import engine.resources.service.INetworkDispatch;
|
||||
import engine.resources.service.INetworkRemoteEvent;
|
||||
import main.NGECore;
|
||||
import resources.objects.Delta;
|
||||
import resources.objects.building.BuildingObject;
|
||||
import resources.objects.cell.CellObject;
|
||||
import resources.objects.creature.CreatureObject;
|
||||
@@ -678,7 +680,12 @@ public class ObjectService implements INetworkDispatch {
|
||||
int counter = 0;
|
||||
for(SnapshotChunk chunk : visitor.getChunks()) {
|
||||
++counter;
|
||||
SWGObject obj = createObject(visitor.getName(chunk.nameId), chunk.id, planet, new Point3D(chunk.xPosition, chunk.yPosition, chunk.zPosition), new Quaternion(chunk.orientationW, chunk.orientationX, chunk.orientationY, chunk.orientationZ));
|
||||
// Since the ids are just ints, they append 0xFFFF86F9 to them
|
||||
// This is demonstated in the packet sent to the server when you /target client-spawned buildouts
|
||||
// This is done for buildouts; uncertain about snapshot objects so it's commented for now
|
||||
//long objectId = Delta.createBuffer(8).putInt(chunk.id).putInt(0xF986FFFF).flip().getLong(); // Not sure what extension they add to 4-byte-only snapshot objectIds. With buildouts they add 0xFFFF86F9. This is demonstated in the packet sent to the server when you /target client-spawned objects
|
||||
int objectId = chunk.id;
|
||||
SWGObject obj = createObject(visitor.getName(chunk.nameId), objectId, planet, new Point3D(chunk.xPosition, chunk.yPosition, chunk.zPosition), new Quaternion(chunk.orientationW, chunk.orientationX, chunk.orientationY, chunk.orientationZ));
|
||||
if(obj != null) {
|
||||
obj.setisInSnapshot(true);
|
||||
obj.setParentId(chunk.parentId);
|
||||
@@ -768,6 +775,8 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
CrcStringTableVisitor crcTable = ClientFileManager.loadFile("misc/object_template_crc_string_table.iff", CrcStringTableVisitor.class);
|
||||
List<SWGObject> quadtreeObjects = new ArrayList<SWGObject>();
|
||||
Map<Long, Long> duplicate = new HashMap<Long, Long>();
|
||||
|
||||
for (int i = 0; i < buildoutTable.getRowCount(); i++) {
|
||||
|
||||
String template;
|
||||
@@ -798,7 +807,9 @@ public class ObjectService implements INetworkDispatch {
|
||||
|
||||
} else {
|
||||
|
||||
objectId = (Integer) buildoutTable.getObject(i, 0);
|
||||
// Since the ids are just ints, they append 0xFFFF86F9 to them
|
||||
// This is demonstated in the packet sent to the server when you /target client-spawned objects
|
||||
objectId = Delta.createBuffer(8).putInt((Integer) buildoutTable.getObject(i, 0)).putInt(0xF986FFFF).flip().getLong();
|
||||
containerId = (Integer) buildoutTable.getObject(i, 1);
|
||||
type = (Integer) buildoutTable.getObject(i, 2);
|
||||
cellIndex = (Integer) buildoutTable.getObject(i, 4);
|
||||
@@ -814,12 +825,30 @@ public class ObjectService implements INetworkDispatch {
|
||||
portalCRC = (Integer) buildoutTable.getObject(i, 13);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Treeku - Refactored to work around duplicate objectIds
|
||||
// Required for instances/heroics which are duplicated ie. 10 times
|
||||
if(!template.equals("object/cell/shared_cell.iff") && objectId != 0 && getObject(objectId) != null) {
|
||||
//System.out.println("Duplicate buildout object: " + template);
|
||||
continue;
|
||||
SWGObject object = getObject(objectId);
|
||||
|
||||
// Same coordinates is a true duplicate
|
||||
if ((px + x1) == object.getPosition().x &&
|
||||
py == object.getPosition().y &&
|
||||
(pz + z1) == object.getPosition().z) {
|
||||
//System.out.println("Duplicate buildout object: " + template);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (objectId != 0 && getObject(objectId) != null) {
|
||||
duplicate.put(objectId, generateObjectID());
|
||||
objectId = duplicate.get(objectId);
|
||||
}
|
||||
|
||||
if (duplicate.containsKey(containerId)) {
|
||||
containerId = duplicate.get(containerId);
|
||||
}
|
||||
|
||||
List<Long> containers = new ArrayList<Long>();
|
||||
SWGObject object;
|
||||
if(objectId != 0 && containerId == 0) {
|
||||
|
||||
Reference in New Issue
Block a user