diff --git a/src/resources/objects/tool/SurveyTool.java b/src/resources/objects/tool/SurveyTool.java index 7010fd4b..fbbae469 100644 --- a/src/resources/objects/tool/SurveyTool.java +++ b/src/resources/objects/tool/SurveyTool.java @@ -21,6 +21,8 @@ ******************************************************************************/ package resources.objects.tool; +import java.util.Vector; + import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; @@ -29,6 +31,7 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; import resources.objects.creature.CreatureObject; import resources.objects.resource.GalacticResource; +import resources.objects.resource.ResourceConcentration; import resources.objects.tangible.TangibleObject; /** @@ -295,4 +298,36 @@ public class SurveyTool extends TangibleObject{ public void setSurveyRangeSetting(byte surveyRangeSetting) { SurveyRangeSetting = surveyRangeSetting; } + + public void sendConstructSurveyMapMessage(){ + float surveyRadius = 64.0f; + int surveyToolRangeSetting = this.getSurveyRangeSetting(); + //surveyToolRangeSetting = 4; + int divisor = 0; + if (surveyToolRangeSetting==0) { + divisor = 2; + surveyRadius = 64.0f; + } else if (surveyToolRangeSetting==1) { + divisor = 3; + surveyRadius = 128.0f; + } else if (surveyToolRangeSetting==2) { + divisor = 3; + surveyRadius = 192.0f; + } else if (surveyToolRangeSetting==3) { + divisor = 4; + surveyRadius = 256.0f; + } else if (surveyToolRangeSetting==4) { + divisor = 4; + surveyRadius = 320.0f; + } else { + divisor = 5; + surveyRadius = 3072.0f; + } + + float differential = surveyRadius / (float) divisor; + GalacticResource resourceToSurvey = this.getSurveyResource(); + Vector concentrationMap = resourceToSurvey.buildConcentrationsCollection(this.getUser().getPosition(),resourceToSurvey, surveyRadius, differential, this.getUser().getPlanetId()); + this.getSurveyResource().constructSurveyMapMessage(this.getUser(), concentrationMap, surveyRadius); + this.getUser().sendSystemMessage("Distance to nearest Deposit : " + this.getSurveyResource().getHelperMinDist(), (byte) 0); + } } \ No newline at end of file diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index c1938286..8b6b353b 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -85,6 +85,7 @@ public class SurveyService implements INetworkDispatch { } public void ServiceProcessing(){ + // All tools sampling SurveyTool removeTool=null; for (SurveyTool surveyTool : activeSurveyTools){ if (surveyTool.getCurrentlySurveying()){ @@ -92,6 +93,7 @@ public class SurveyService implements INetworkDispatch { if (System.currentTimeMillis()>surveyTool.getLastSurveyTime()+3000){ removeTool = surveyTool; surveyTool.setCurrentlySurveying(false); + surveyTool.sendConstructSurveyMapMessage(); } } if (surveyTool.getCurrentlySampling()){ @@ -123,6 +125,8 @@ public class SurveyService implements INetworkDispatch { if (removeTool!=null) activeSurveyTools.remove(removeTool); // remove after notification + + } public void handleSamplingStages(SurveyTool surveyTool){ @@ -247,6 +251,12 @@ public class SurveyService implements INetworkDispatch { return; } + // QA tool lockup countermeasure + if(surveyTool.getCurrentlySurveying() && surveyTool.getLastSurveyTime() concentrationMap = resourceToSurvey.buildConcentrationsCollection(crafter.getPosition(),resourceToSurvey, surveyRadius, differential, crafter.getPlanetId()); - resourceToSurvey.constructSurveyMapMessage(crafter, concentrationMap, surveyRadius); - crafter.sendSystemMessage("Distance to nearest Deposit : " + resourceToSurvey.getHelperMinDist(), (byte) 0); +// float surveyRadius = 64.0f; +// int surveyToolRangeSetting = surveyTool.getSurveyRangeSetting(); +// //surveyToolRangeSetting = 4; +// int divisor = 0; +// if (surveyToolRangeSetting==0) { +// divisor = 2; +// surveyRadius = 64.0f; +// } else if (surveyToolRangeSetting==1) { +// divisor = 3; +// surveyRadius = 128.0f; +// } else if (surveyToolRangeSetting==2) { +// divisor = 3; +// surveyRadius = 192.0f; +// } else if (surveyToolRangeSetting==3) { +// divisor = 4; +// surveyRadius = 256.0f; +// } else if (surveyToolRangeSetting==4) { +// divisor = 4; +// surveyRadius = 320.0f; +// } else { +// divisor = 5; +// surveyRadius = 3072.0f; +// } +// +// float differential = surveyRadius / (float) divisor; +// GalacticResource resourceToSurvey = surveyTool.getSurveyResource(); +// Vector concentrationMap = resourceToSurvey.buildConcentrationsCollection(crafter.getPosition(),resourceToSurvey, surveyRadius, differential, crafter.getPlanetId()); +// resourceToSurvey.constructSurveyMapMessage(crafter, concentrationMap, surveyRadius); +// crafter.sendSystemMessage("Distance to nearest Deposit : " + resourceToSurvey.getHelperMinDist(), (byte) 0); } public void requestSampling(CreatureObject crafter, SWGObject target, SurveyCommand command, int actionCounter, String commandArgs){ @@ -309,6 +319,11 @@ public class SurveyService implements INetworkDispatch { PlayerObject player = (PlayerObject) crafter.getSlottedObject("ghost"); SurveyTool surveyTool = player.getLastUsedSurveyTool(); + if (surveyTool.getCurrentlySurveying()){ + crafter.sendSystemMessage("@survey:sample_survey", (byte) 0); + return; + } + if (crafter.getPosture()!=1) // QA surveyTool.setCurrentlySampling(false); @@ -351,11 +366,11 @@ public class SurveyService implements INetworkDispatch { crafter.sendSystemMessage("You will be able to sample again in " + remaining + " seconds.", (byte) 0); // "@survey:tool_recharge_time" } else { - // ToDo: - if (sampleResource.getResourceRoot().getResourceClass().equals("Radioactive")){ //resourceRoot.getResourceClass("Radioactive"); - createRadioactivityWarningSUIWindow(crafter, surveyTool); - return; - } + // ToDo: Find out if NGE really still did this +// if (sampleResource.getResourceRoot().getResourceClass().equals("Radioactive")){ //resourceRoot.getResourceClass("Radioactive"); +// createRadioactivityWarningSUIWindow(crafter, surveyTool); +// return; +// } crafter.setPosture((byte) 1); crafter.sendSystemMessage("You kneel", (byte) 0); @@ -544,7 +559,8 @@ public class SurveyService implements INetworkDispatch { } public void addActiveSurveyTool(SurveyTool tool){ - activeSurveyTools.add(tool); + if (! activeSurveyTools.contains(tool)) + activeSurveyTools.add(tool); } public Vector getActiveSurveyTools(){