Files
dsrc/sku.0/sys.server/compiled/game/script/space/quest_logic/rescue.java
T
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

268 lines
12 KiB
Java
Executable File

package script.space.quest_logic;
import script.dictionary;
import script.library.*;
import script.obj_id;
import script.prose_package;
import script.string_id;
public class rescue extends script.space.quest_logic.recovery
{
public rescue()
{
}
public static final string_id SID_ABANDONED_RESCUE = new string_id("space/quest", "rescue_abandoned");
public int OnAttach(obj_id self) throws InterruptedException
{
String questName = getStringObjVar(self, space_quest.QUEST_NAME);
String questType = getStringObjVar(self, space_quest.QUEST_TYPE);
obj_id player = getObjIdObjVar(self, space_quest.QUEST_OWNER);
if ((questName == null) || (questType == null))
{
return SCRIPT_OVERRIDE;
}
String qTable = "datatables/spacequest/" + questType + "/" + questName + ".iff";
dictionary questInfo = dataTableGetRow(qTable, 0);
if (questInfo == null)
{
sendSystemMessageTestingOnly(player, "Debug: Failed to open quest table " + qTable);
return SCRIPT_OVERRIDE;
}
setObjVar(self, "targetArrivalDelay", questInfo.getInt("targetArrivalDelay"));
setObjVar(self, "targetRecoverTime", questInfo.getInt("targetRecoverTime"));
String targetShip = questInfo.getString("targetShipType");
if (targetShip != null)
{
setObjVar(self, "targetShipType", targetShip);
}
int numAttackShipLists = questInfo.getInt("numAttackShipLists");
setObjVar(self, "numAttackShipLists", numAttackShipLists);
for (int i = 0; i < numAttackShipLists; i++)
{
String[] attackShips = dataTableGetStringColumn(qTable, "attackShips" + (i + 1));
space_quest.cleanArray(self, "attackShips" + (i + 1), attackShips);
}
setObjVar(self, "attackPeriod", questInfo.getInt("attackPeriod"));
setObjVar(self, "numResponses", questInfo.getInt("numResponses"));
String[] recoveryPath = dataTableGetStringColumn(qTable, "recoveryPath");
space_quest.cleanArray(self, "recoveryPath", recoveryPath);
setObjVar(self, "damageMultiplier", questInfo.getInt("damageMultiplier"));
String rescueApp = questInfo.getString("rescueAppearance");
if (rescueApp != null)
{
setObjVar(self, "rescueAppearance", rescueApp);
}
String questZone = getStringObjVar(self, space_quest.QUEST_ZONE);
if ((getCurrentSceneName()).startsWith(questZone))
{
dictionary outparams = new dictionary();
outparams.put("player", player);
messageTo(self, "initializedQuestPlayer", outparams, 1.0f, false);
}
int questid = questGetQuestId("spacequest/" + questType + "/" + questName);
if (questid != 0)
{
questActivateTask(questid, 0, player);
}
return SCRIPT_OVERRIDE;
}
public int initializedQuestPlayer(obj_id self, dictionary params) throws InterruptedException
{
if (params == null)
{
return SCRIPT_OVERRIDE;
}
String questZone = getStringObjVar(self, space_quest.QUEST_ZONE);
obj_id player = params.getObjId("player");
obj_id containing_ship = space_transition.getContainingShip(player);
if (isIdValid(containing_ship))
{
String strChassisType = getShipChassisType(containing_ship);
if ((strChassisType != null) && strChassisType.equals("player_sorosuub_space_yacht"))
{
return SCRIPT_CONTINUE;
}
}
if (!(getCurrentSceneName()).startsWith(questZone))
{
if (space_quest.isQuestInProgress(self))
{
clearMissionWaypoint(self);
space_quest.showQuestUpdate(self, SID_ABANDONED_RESCUE);
space_quest.setQuestFailed(player, self, false);
}
return SCRIPT_OVERRIDE;
}
if (hasObjVar(self, "initialized"))
{
return SCRIPT_OVERRIDE;
}
String[] recoveryPoints = getStringArrayObjVar(self, "recoveryPath");
if (recoveryPoints == null)
{
return SCRIPT_OVERRIDE;
}
String destPoint = recoveryPoints[0];
java.util.StringTokenizer st = new java.util.StringTokenizer(destPoint, ":");
String scene = st.nextToken();
destPoint = st.nextToken();
if ((getCurrentSceneName()).startsWith(scene))
{
findTargetStart(self, player, destPoint);
}
String questName = getStringObjVar(self, space_quest.QUEST_NAME);
String questType = getStringObjVar(self, space_quest.QUEST_TYPE);
int questid = questGetQuestId("spacequest/" + questType + "/" + questName);
if (questid != 0)
{
setObjVar(self, "taskId", 1);
questActivateTask(questid, 1, player);
if (questIsTaskActive(questid, 0, player))
{
questCompleteTask(questid, 0, player);
}
}
return SCRIPT_OVERRIDE;
}
public int warpInTarget(obj_id self, dictionary params) throws InterruptedException
{
obj_id player = getObjIdObjVar(self, space_quest.QUEST_OWNER);
String questZone = getStringObjVar(self, space_quest.QUEST_ZONE);
if (!(getCurrentSceneName()).startsWith(questZone))
{
return SCRIPT_OVERRIDE;
}
int squad = ship_ai.squadCreateSquadId();
obj_id ship = createTargetShip(self);
space_quest._addMissionCriticalShip(player, self, ship);
ship_ai.unitSetSquadId(ship, squad);
setObjVar(self, "target", ship);
setObjVar(ship, "noNotifyDisable", 1);
utils.setScriptVar(ship, "dockable", 1);
setLookAtTarget(player, ship);
setObjVar(ship, "quest", self);
attachScript(ship, "space.quest_logic.rescue_target");
ship_ai.unitSetAttackOrders(ship, ship_ai.ATTACK_ORDERS_HOLD_FIRE);
setObjVar(ship, "objMissionOwner", player);
ship_ai.unitAddExclusiveAggro(ship, player);
int dmult = getIntObjVar(self, "damageMultiplier");
if (dmult < 1)
{
dmult = 1;
}
setObjVar(ship, "damageMultiplier", dmult);
float maxspeed = getShipEngineSpeedMaximum(ship);
if (maxspeed < 15.0f)
{
setShipEngineSpeedMaximum(ship, 15.0f + rand() * 10.0f);
}
else if (maxspeed > 25.0f)
{
setShipEngineSpeedMaximum(ship, 23.0f + rand() * 5.0f);
}
dictionary outp = new dictionary();
outp.put("objShip", space_transition.getContainingShip(player));
messageTo(ship, "disableSelf", outp, 1.0f, false);
String rescueAppearance = getStringObjVar(self, "rescueAppearance");
if (rescueAppearance != null)
{
setObjVar(ship, "convo.appearance", rescueAppearance);
}
messageTo(self, "updateTargetWaypoint", null, 1.0f, false);
String questName = getStringObjVar(self, space_quest.QUEST_NAME);
String questType = getStringObjVar(self, space_quest.QUEST_TYPE);
string_id status_update = new string_id("spacequest/" + questType + "/" + questName, "arrival_phase_2");
questUpdate(self, status_update);
return SCRIPT_OVERRIDE;
}
public int recoverShipDisabled(obj_id self, dictionary params) throws InterruptedException
{
obj_id ship = getObjIdObjVar(self, "target");
utils.setScriptVar(ship, "dockable", 1);
return SCRIPT_OVERRIDE;
}
public int dockingStarted(obj_id self, dictionary params) throws InterruptedException
{
obj_id target = params.getObjId("target");
obj_id ship = getObjIdObjVar(self, "target");
if (target != ship)
{
return SCRIPT_CONTINUE;
}
obj_id player = getObjIdObjVar(self, space_quest.QUEST_OWNER);
String questName = getStringObjVar(self, space_quest.QUEST_NAME);
String questType = getStringObjVar(self, space_quest.QUEST_TYPE);
string_id status_update = new string_id("spacequest/" + questType + "/" + questName, "docking_started");
questUpdate(self, status_update);
status_update = new string_id("spacequest/" + questType + "/" + questName, getCapturePhrase1(self));
prose_package pp = prose.getPackage(status_update, 0);
space_quest.groupTaunt(ship, player, pp);
return SCRIPT_OVERRIDE;
}
public String getCapturePhrase1(obj_id self) throws InterruptedException
{
return "rescue_phase_1";
}
public int dockingComplete(obj_id self, dictionary params) throws InterruptedException
{
obj_id target = params.getObjId("target");
obj_id ship = getObjIdObjVar(self, "target");
if (target != ship)
{
return SCRIPT_CONTINUE;
}
obj_id player = getObjIdObjVar(self, space_quest.QUEST_OWNER);
String questName = getStringObjVar(self, space_quest.QUEST_NAME);
String questType = getStringObjVar(self, space_quest.QUEST_TYPE);
string_id status_update = new string_id("spacequest/" + questType + "/" + questName, "docking_complete");
questUpdate(self, status_update);
status_update = new string_id("spacequest/" + questType + "/" + questName, getCapturePhrase2(self));
prose_package pp = prose.getPackage(status_update, 0);
space_quest.groupTaunt(ship, player, pp);
int questid = questGetQuestId("spacequest/" + questType + "/" + questName);
if (questid != 0)
{
setObjVar(self, "taskId", 2);
questActivateTask(questid, 2, player);
if (questIsTaskActive(questid, 1, player))
{
questCompleteTask(questid, 1, player);
}
}
utils.removeScriptVar(ship, "dockable");
messageTo(self, "startCapturedShipPathing", null, 10.0f, false);
return SCRIPT_OVERRIDE;
}
public String getCapturePhrase2(obj_id self) throws InterruptedException
{
return "rescue_phase_2";
}
public int recoveryComplete(obj_id self, dictionary params) throws InterruptedException
{
if (params == null)
{
return SCRIPT_OVERRIDE;
}
String questName = getStringObjVar(self, space_quest.QUEST_NAME);
String questType = getStringObjVar(self, space_quest.QUEST_TYPE);
obj_id player = getObjIdObjVar(self, space_quest.QUEST_OWNER);
obj_id ship = params.getObjId("ship");
string_id update = new string_id("spacequest/" + questType + "/" + questName, "recovery_success");
questUpdate(self, update);
int questid = questGetQuestId("spacequest/" + questType + "/" + questName);
if (questid != 0)
{
if (questIsTaskActive(questid, 2, player))
{
questCompleteTask(questid, 2, player);
}
}
string_id abort = new string_id("spacequest/" + questType + "/" + questName, getCompletePhrase(self));
prose_package pp = prose.getPackage(abort, 0);
space_quest.groupTaunt(ship, player, pp);
messageTo(self, "cleanupShipsMsg", null, 2.0f, false);
messageTo(self, "completeQuestMsg", null, 3.0f, false);
return SCRIPT_OVERRIDE;
}
}