diff --git a/.gitignore b/.gitignore index 89882a7e..3b0a4c33 100644 --- a/.gitignore +++ b/.gitignore @@ -52,10 +52,6 @@ clientdata/quest/ # PSWG Object Databases odb/building/je.info.* odb/creature/je.info.* -odb/doids/je.info.* -odb/guild/je.info.* -odb/mails/je.info.* -odb/oids/je.info.* odb/chatRooms/je.info.* odb/resourcehistory/je.info.* odb/resourceroots/je.info.* diff --git a/odb/building/placeholder.txt b/odb/building/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/odb/chatRooms/placeholder.txt b/odb/chatRooms/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/odb/creature/placeholder.txt b/odb/creature/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/odb/doids/placeholder.txt b/odb/doids/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/odb/guild/placeholder.txt b/odb/guild/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/odb/mails/placeholder.txt b/odb/mails/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/odb/oids/placeholder.txt b/odb/oids/placeholder.txt new file mode 100644 index 00000000..e69de29b diff --git a/scripts/radial/resourceContainer.py b/scripts/radial/resourceContainer.py index 4994f1cb..fb6fa586 100644 --- a/scripts/radial/resourceContainer.py +++ b/scripts/radial/resourceContainer.py @@ -2,14 +2,17 @@ from resources.common import RadialOptions import sys def createRadial(core, owner, target, radials): - #radials.add(RadialOptions(0, 21, 1, '')) - #radials.add(RadialOptions(0, 7, 1, '')) - radials.add(RadialOptions(0, 15, 1, '')) + radials.add(RadialOptions(0, 49, 0, 'Split')) + radials.add(RadialOptions(0, 7, 0, 'Examine')) + radials.add(RadialOptions(0, 15, 0, 'Destroy')) return def handleSelection(core, owner, target, option): #if option == 21 and target: #core.objectService.useObject(owner, target) if option == 15 and target: + if target == player.getRecentContainer(): + player.setRecentContainer(None) + core.objectService.destroyObject(target) return \ No newline at end of file diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index 949c5d39..1620a6cc 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -29,6 +29,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; + import protocol.swg.PlayClientEffectLocMessage; import protocol.swg.SceneCreateObjectByCrc; import protocol.swg.SceneEndBaselines; @@ -49,6 +50,7 @@ import services.sui.SUIWindow.SUICallback; import services.sui.SUIWindow.Trigger; import main.NGECore; import engine.resources.common.CRC; +import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; import engine.resources.service.INetworkDispatch; @@ -138,7 +140,14 @@ public class SurveyService implements INetworkDispatch { GalacticResource sampleResource = surveyTool.getSurveyResource(); int stackCount = 0; boolean gamblingwon = false; - ResourceContainerObject container = player.getRecentContainer(); + //ResourceContainerObject container = player.getRecentContainer(); + ResourceContainerObject container = null; + // Attempt to find container with the currently sampled resource in + // player inventory tree + ResourceContainerObject foundContainer = findResourceContainerInInventory(crafter,sampleResource); + if (foundContainer!=null) + container = foundContainer; + if (! surveyTool.isRecoveryMode()) stackCount = core.resourceService.getResourceSampleQuantity(crafter, sampleResource); else { // handle particularly rich case @@ -150,7 +159,7 @@ public class SurveyService implements INetworkDispatch { } surveyTool.setRecoveryMode(false); } - + if (container!=null) { if (container.getReferenceID()==sampleResource.getId()) { int stackCountToUpdate = container.getStackCount(); @@ -177,11 +186,13 @@ public class SurveyService implements INetworkDispatch { } } else { // Mismatch -> new container + String resourceContainerIFF = ResourceRoot.CONTAINER_TYPE_IFF_SIGNIFIER[sampleResource.getResourceRoot().getContainerType()]; if ((stackCount > 0) && (!surveyTool.isRecoveryMode())) { ResourceContainerObject containerObject = (ResourceContainerObject) core.objectService.createObject(resourceContainerIFF, crafter.getPlanet()); containerObject.initializeStats(sampleResource); containerObject.setProprietor(crafter); + container.setStackCount(stackCount,crafter); SWGObject crafterInventory = crafter.getSlottedObject("inventory"); crafterInventory.add(containerObject); player.setRecentContainer(containerObject); @@ -189,16 +200,19 @@ public class SurveyService implements INetworkDispatch { } } else { // create new container, first sample + if ((stackCount > 0) && (!surveyTool.isRecoveryMode())) { + String resourceContainerIFF = ResourceRoot.CONTAINER_TYPE_IFF_SIGNIFIER[sampleResource.getResourceRoot().getContainerType()]; ResourceContainerObject containerObject = (ResourceContainerObject) core.objectService.createObject(resourceContainerIFF, crafter.getPlanet()); containerObject.initializeStats(sampleResource); containerObject.setProprietor(crafter); - stackCount = core.resourceService.getResourceSampleQuantity(crafter, sampleResource); + //stackCount = core.resourceService.getResourceSampleQuantity(crafter, sampleResource); containerObject.setStackCount(stackCount,crafter); SWGObject crafterInventory = crafter.getSlottedObject("inventory"); crafterInventory.add(containerObject); player.setRecentContainer(containerObject); + } } @@ -227,6 +241,29 @@ public class SurveyService implements INetworkDispatch { } } + + public ResourceContainerObject findResourceContainerInInventory(CreatureObject owner, GalacticResource resource){ + ResourceContainerObject foundContainer = null; + final Vector found = new Vector(); + TangibleObject playerInventory = (TangibleObject) owner.getSlottedObject("inventory"); + playerInventory.viewChildren(owner, false, false, new Traverser() { + @Override + public void process(SWGObject obj) { + + if (obj instanceof ResourceContainerObject){ + ResourceContainerObject container = (ResourceContainerObject) obj; + if (container.getReferenceID()==resource.getId() + && container.getStackCount()0) + foundContainer = found.get(0); + return foundContainer; + } + public void requestSurvey(CreatureObject crafter, SWGObject target, String commandArgs){ // Check if crafter has survey skill