diff --git a/src/services/StaticService.java b/src/services/StaticService.java index ebd37de8..732bc657 100644 --- a/src/services/StaticService.java +++ b/src/services/StaticService.java @@ -69,6 +69,10 @@ public class StaticService implements INetworkDispatch { return spawnObject(template, planetName, cellId, x, y, z, qW, 0, qY, 0); } + public SWGObject spawnObject(String template, String planetName, SWGObject cell, float x, float y, float z, float qW, float qX, float qY, float qZ) { + return spawnObject(template, planetName, ((cell == null) ? 0L : cell.getObjectID()), x, y, z, qW, qX, qY, qZ); + } + public SWGObject spawnObject(String template, String planetName, long cellId, float x, float y, float z, float qW, float qX, float qY, float qZ) { Planet planet = core.terrainService.getPlanetByName(planetName); @@ -80,11 +84,11 @@ public class StaticService implements INetworkDispatch { long buildingId = 0; int cellNumber = 0; - SWGObject container = core.objectService.getObject(cellId); + SWGObject cell = core.objectService.getObject(cellId); - if (container != null && container.getContainer() != null && container.getContainer() instanceof BuildingObject) { - buildingId = container.getContainer().getObjectId(); - cellNumber = ((BuildingObject) container.getContainer()).getCellNumberByObjectId(cellId); + if (cell != null && cell.getContainer() != null && cell.getContainer() instanceof BuildingObject) { + buildingId = cell.getContainer().getObjectId(); + cellNumber = ((BuildingObject) cell.getContainer()).getCellNumberByObjectId(cellId); } long objectId = core.objectService.getDOId(planetName, template, 0, buildingId, cellNumber, x, y, z); @@ -109,14 +113,12 @@ public class StaticService implements INetworkDispatch { System.err.println("StaticService: Quadtree insert failed for: " + template); } } else { - SWGObject parent = core.objectService.getObject(cellId); - - if (parent == null) { + if (cell == null) { System.err.println("StaticService: Cell not found"); return object; } - parent.add(object); + cell.add(object); } return object; diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java index 4342ff12..d0b43268 100644 --- a/src/services/collections/CollectionService.java +++ b/src/services/collections/CollectionService.java @@ -142,7 +142,7 @@ public class CollectionService implements INetworkDispatch { int bits = 0; boolean noScriptOnModify = false; boolean clearOnComplete = false; - boolean noMessage = true; + boolean noMessage = false; boolean grantIfPreReqMet = true; boolean buddyCollection = false; int numAltTitles = 0; @@ -308,13 +308,21 @@ public class CollectionService implements INetworkDispatch { collections.set(beginSlotId); } - player.setCollections(collections.toByteArray()); - - if (!hidden && !noMessage) { - creature.sendSystemMessage(OutOfBand.ProsePackage("@collection_n:" + collection), DisplayType.Broadcast); + if (hidden && !(getCollection(creature, collectionName) > 0)) { + creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_hidden_slot_added", "TO", collectionName), DisplayType.Broadcast); } - if (!music.equals("")) { + player.setCollections(collections.toByteArray()); + + if (!noMessage) { + if (!bookName.equals("crafting_book")) { + creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_slot_added", "TU", slotName, "TO", collectionName), DisplayType.Broadcast); + } else { + creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_slot_increment", "TU", slotName, "TO", collectionName), DisplayType.Broadcast); + } + } + + if (!music.equals("") && !music.equalsIgnoreCase("none")) { creature.playMusic(music); } @@ -346,7 +354,9 @@ public class CollectionService implements INetworkDispatch { } } - if (!isComplete(creature, collectionName)) { + if (isComplete(creature, collectionName)) { + creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_collection_complete", "TO", collectionName), DisplayType.Broadcast); + if (!noReward) { if (FileUtilities.doesFileExist("scripts/collections/" + collectionName + ".py")) { PyObject method = core.scriptService.getMethod("scripts/collections/", collectionName, "complete"); @@ -364,6 +374,7 @@ public class CollectionService implements INetworkDispatch { if (trackServerFirst) { if (core.guildService.getGuildObject().addServerFirst(collectionName, new ServerFirst(creature.getCustomName(), creature.getObjectId(), collectionName, System.currentTimeMillis()))) { addCollection(creature, "bdg_server_first_01"); + creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_server_first", "TT", core.getGalaxyName(), "TO", collectionName), DisplayType.Broadcast); } } @@ -735,6 +746,10 @@ public class CollectionService implements INetworkDispatch { player.getTitleList().remove(slotName); } + if (collection.equals(collectionName)) { + creature.sendSystemMessage(OutOfBand.ProsePackage("@collection:player_collection_reset", "TO", collectionName), DisplayType.Broadcast); + } + continue; } }