diff --git a/scripts/object/mobile/respec_seller_f_1.py b/scripts/object/mobile/respec_seller_f_1.py index 4facad13..1af596e0 100644 --- a/scripts/object/mobile/respec_seller_f_1.py +++ b/scripts/object/mobile/respec_seller_f_1.py @@ -5,4 +5,6 @@ def setup(core, object): object.setAttachment('radial_filename', 'object/conversation') object.setAttachment('conversationFile', 'respec') object.setOptionsBitmask(Options.CONVERSABLE | Options.INVULNERABLE) + object.setStfFilename('mob/creature_names') + object.setStfName('respec_seller') return \ No newline at end of file diff --git a/src/services/StaticService.java b/src/services/StaticService.java index 380ec762..ebd37de8 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -77,24 +77,19 @@ public class StaticService implements INetworkDispatch { return null; } + long buildingId = 0; int cellNumber = 0; SWGObject container = core.objectService.getObject(cellId); if (container != null && container.getContainer() != null && container.getContainer() instanceof BuildingObject) { + buildingId = container.getContainer().getObjectId(); cellNumber = ((BuildingObject) container.getContainer()).getCellNumberByObjectId(cellId); } - long objectId = core.objectService.getDOId(planetName, template, 0, cellId, cellNumber, x, y, z); + long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z); - SWGObject object; - - // Temp fix while objects with custom ids don't appear to spawn despite there being no errors... - if (template.contains("character_builder")) { - object = core.objectService.createObject(template, 0, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ)); - } else { - object = core.objectService.createObject(template, objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ)); - } + SWGObject object = core.objectService.createObject(template, objectId, planet, new Point3D(x, y, z), new Quaternion(qW, qX, qY, qZ), null, true, true); if (object == null) { System.err.println("Static object is null with id " + objectId + " and template " + template + "."); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 46f9fea9..3aba2e5f 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -221,7 +221,9 @@ public class ObjectService implements INetworkDispatch { } catch (InstantiationException | IllegalAccessException e) { e.printStackTrace(); } + boolean isSnapshot = false; + if(objectID == 0) objectID = generateObjectID(); else @@ -336,17 +338,10 @@ public class ObjectService implements INetworkDispatch { object.setAttachment("customServerTemplate", customServerTemplate); object.setisInSnapshot(isSnapshot); + if(!core.getObjectIdODB().contains(objectID, Long.class, ObjectId.class)) { core.getObjectIdODB().put(new ObjectId(objectID), Long.class, ObjectId.class); } - if(loadServerTemplate) - loadServerTemplate(object); - else { - final SWGObject pointer = object; - loadServerTemplateTasks.add(() -> loadServerTemplate(pointer)); - } - - objectList.put(objectID, object); // Set Options - easier to set them across the board here // because we'll be spawning them despite most of them being unscripted. @@ -382,6 +377,15 @@ public class ObjectService implements INetworkDispatch { } } + if(loadServerTemplate) + loadServerTemplate(object); + else { + final SWGObject pointer = object; + loadServerTemplateTasks.add(() -> loadServerTemplate(pointer)); + } + + objectList.put(objectID, object); + return object; } @@ -633,11 +637,11 @@ public class ObjectService implements INetworkDispatch { } - public long getDOId(String planet, String template, int type, long cellId, int cellNumber, float x1, float y, float z1) { - SWGObject container = getObject(cellId); + public long getDOId(String planet, String template, int type, long containerId, int cellNumber, float x1, float y, float z1) { + SWGObject container = getObject(containerId); float x = ((container == null) ? x1 : container.getPosition().x + x1); float z = ((container == null) ? z1 : container.getPosition().z + z1); - String key = "" + CRC.StringtoCRC(planet) + CRC.StringtoCRC(template) + type + cellId + cellNumber + x + y + z; + String key = "" + CRC.StringtoCRC(planet) + CRC.StringtoCRC(template) + type + containerId + cellNumber + x + y + z; long objectId = 0;