Files
TekaohandGitHub 5c2e112349 Java 11.0.2 migration (#32)
* Code compiles - execution NOT tested

* updating gitignore

* Removed intellij settings files

* Removed more intellij files

* Added exclusion for JDK classes.

* Fixed purchasing script for vendors that have listed coin types.

* Updated script to not kick off until the entire preload is complete.

* adds static name entry for Solo movie poster and tcg9 vendor entry

* clean up empty and orphaned object templates

* adds placeholder black market (static) spawns

* corrects entries for the video game table to correctly set it in tcg series 2 and remove series 1 console errors

* Updated gitignore and removed intellij project files

* Fixed appearance reference for thranta payroll and kashyyyk door, added skipLosCheck objvar due to cannit see issue. Requires updated src

* Fixed appearance and template for terminal (#2)

* Fixed appearance and template for terminal (#3)

* Fixed appearance and template for terminal (#4)

* Deleted another faulty/orphaned object template

* Fixed gcw ranks option on frog. Only issue is that it doesn't award the officer commands or badges.

* Fixed some unneeded java 11 changes
2019-04-18 18:31:52 -05:00

257 lines
10 KiB
Java
Executable File

package script.working;
import script.library.locations;
import script.library.utils;
import script.location;
import script.obj_id;
import java.util.Vector;
public class requestloctest extends script.base_script
{
public requestloctest()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
if (!isGod(self))
{
sendSystemMessage(self, "You are not authorized to use this script.", "");
detachScript(self, "working.requestloctest");
}
return SCRIPT_CONTINUE;
}
public int OnSpeaking(obj_id self, String text) throws InterruptedException
{
if (!isGod(self))
{
return SCRIPT_CONTINUE;
}
int stringCheck = text.indexOf("get_location_32");
if (stringCheck > -1)
{
boolean checkSlope = true;
boolean checkWater = true;
stringCheck = text.indexOf("allow_slope");
if (stringCheck > -1)
{
checkSlope = false;
}
stringCheck = text.indexOf("allow_water");
if (stringCheck > -1)
{
checkWater = false;
}
location here = getLocation(self);
requestLocation(self, "get_location_32", here, 500.0f, 32.0f, checkWater, checkSlope);
sendSystemMessage(self, "requestingLocation: get_location_32 - water: " + checkWater + ", slope: " + checkSlope, "");
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("get_location_48");
if (stringCheck > -1)
{
boolean checkSlope = true;
boolean checkWater = true;
stringCheck = text.indexOf("allow_slope");
if (stringCheck > -1)
{
checkSlope = false;
}
stringCheck = text.indexOf("allow_water");
if (stringCheck > -1)
{
checkWater = false;
}
location here = getLocation(self);
requestLocation(self, "get_location_48", here, 500.0f, 48.0f, checkWater, checkSlope);
sendSystemMessage(self, "requestingLocation: get_location_48 - water: " + checkWater + ", slope: " + checkSlope, "");
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("get_location_64");
if (stringCheck > -1)
{
boolean checkSlope = true;
boolean checkWater = true;
stringCheck = text.indexOf("allow_slope");
if (stringCheck > -1)
{
checkSlope = false;
}
stringCheck = text.indexOf("allow_water");
if (stringCheck > -1)
{
checkWater = false;
}
location here = getLocation(self);
requestLocation(self, "get_location_64", here, 500.0f, 64.0f, checkWater, checkSlope);
sendSystemMessage(self, "requestingLocation: get_location_64 - water: " + checkWater + ", slope: " + checkSlope, "");
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("get_location_80");
if (stringCheck > -1)
{
boolean checkSlope = true;
boolean checkWater = true;
stringCheck = text.indexOf("allow_slope");
if (stringCheck > -1)
{
checkSlope = false;
}
stringCheck = text.indexOf("allow_water");
if (stringCheck > -1)
{
checkWater = false;
}
location here = getLocation(self);
requestLocation(self, "get_location_80", here, 500.0f, 80.0f, checkWater, checkSlope);
sendSystemMessage(self, "requestingLocation: get_location_80 - water: " + checkWater + ", slope: " + checkSlope, "");
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("get_location_96");
if (stringCheck > -1)
{
boolean checkSlope = true;
boolean checkWater = true;
stringCheck = text.indexOf("allow_slope");
if (stringCheck > -1)
{
checkSlope = false;
}
stringCheck = text.indexOf("allow_water");
if (stringCheck > -1)
{
checkWater = false;
}
location here = getLocation(self);
requestLocation(self, "get_location_96", here, 500.0f, 96.0f, checkWater, checkSlope);
sendSystemMessage(self, "requestingLocation: get_location_96 - water: " + checkWater + ", slope: " + checkSlope, "");
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("clear_last_location");
if (stringCheck > -1)
{
if (hasObjVar(self, "locTest.objects"))
{
Vector locObjects = getResizeableObjIdArrayObjVar(self, "locTest.objects");
if (locObjects != null && locObjects.size() > 0)
{
int lastObjectIndx = locObjects.size() - 1;
obj_id locObject = ((obj_id)locObjects.get(lastObjectIndx));
utils.removeElementAt(locObjects, lastObjectIndx);
setObjVar(self, "locTest.objects", locObjects);
if (isIdValid(locObject))
{
locations.destroyLocationObject(locObject);
}
}
}
if (hasObjVar(self, "locTest.waypoints"))
{
Vector locWaypoints = getResizeableObjIdArrayObjVar(self, "locTest.waypoints");
if (locWaypoints != null && locWaypoints.size() > 0)
{
int lastWaypointIndx = locWaypoints.size() - 1;
obj_id locWaypoint = ((obj_id)locWaypoints.get(lastWaypointIndx));
utils.removeElementAt(locWaypoints, lastWaypointIndx);
setObjVar(self, "locTest.waypoints", locWaypoints);
if (isIdValid(locWaypoint))
{
destroyWaypointInDatapad(locWaypoint, self);
}
}
}
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("clear_all_locations");
if (stringCheck > -1)
{
getRidOfLocObjects(self);
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("detach_script");
if (stringCheck > -1)
{
getRidOfLocObjects(self);
detachScript(self, "working.requestloctest");
return SCRIPT_OVERRIDE;
}
stringCheck = text.indexOf("help");
if (stringCheck > -1)
{
String msg1 = "Type get_location_32, get_location_48, get_location_64, get_location_80, or get_location_96 to request a location.";
String msg1b = " Include allow_slope or allow_water to not block for slope or for water.";
String msg2 = " Type clear_last_location or clear_all_locations to clear reserved location objects.";
String msg3 = " Type detach_script to clear current reserved location objects and detach this script.";
sendSystemMessage(self, msg1 + msg1b + msg2 + msg3, "");
return SCRIPT_OVERRIDE;
}
return SCRIPT_CONTINUE;
}
public int OnLocationReceived(obj_id self, String locationId, obj_id locationObject, location locationLocation, float locationRadius) throws InterruptedException
{
if (!isIdValid(locationObject))
{
sendSystemMessage(self, "locationObject was invalid for search location: " + locationLocation + " locationId: " + locationId, "");
return SCRIPT_CONTINUE;
}
if (locationLocation == null)
{
sendSystemMessage(self, "locationLocation was null (??!!?) for search location: " + locationLocation + " locationId: " + locationId, "");
return SCRIPT_CONTINUE;
}
Vector locObjects = new Vector();
locObjects.setSize(0);
if (hasObjVar(self, "locTest.objects"))
{
locObjects = getResizeableObjIdArrayObjVar(self, "locTest.objects");
}
utils.addElement(locObjects, locationObject);
setObjVar(self, "locTest.objects", locObjects);
obj_id waypoint = createWaypointInDatapad(self, locationLocation);
setWaypointName(waypoint, locationId);
setWaypointActive(waypoint, true);
Vector locWaypoints = new Vector();
locWaypoints.setSize(0);
if (hasObjVar(self, "locTest.waypoints"))
{
locWaypoints = getResizeableObjIdArrayObjVar(self, "locTest.waypoints");
}
utils.addElement(locWaypoints, waypoint);
setObjVar(self, "locTest.waypoints", locWaypoints);
sendSystemMessage(self, "OnLocationReceived parameters - Id: " + locationId + ", location: " + locationLocation + ", object: " + locationObject + ", radius:" + locationRadius, "");
return SCRIPT_CONTINUE;
}
public void getRidOfLocObjects(obj_id self) throws InterruptedException
{
if (hasObjVar(self, "locTest.objects"))
{
Vector locObjects = getResizeableObjIdArrayObjVar(self, "locTest.objects");
removeObjVar(self, "locTest.objects");
if (locObjects != null && locObjects.size() > 0)
{
for (Object locObject1 : locObjects) {
obj_id locObject = ((obj_id) locObject1);
if (isIdValid(locObject)) {
locations.destroyLocationObject(locObject);
}
}
}
}
if (hasObjVar(self, "locTest.waypoints"))
{
Vector locWaypoints = getResizeableObjIdArrayObjVar(self, "locTest.waypoints");
removeObjVar(self, "locTest.waypoints");
if (locWaypoints != null && locWaypoints.size() > 0)
{
for (Object locWaypoint1 : locWaypoints) {
obj_id locWaypoint = ((obj_id) locWaypoint1);
if (isIdValid(locWaypoint)) {
destroyWaypointInDatapad(locWaypoint, self);
}
}
}
}
return;
}
}