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

122 lines
6.1 KiB
Java
Executable File

package script.quest.task.ground;
import script.dictionary;
import script.library.groundquests;
import script.library.utils;
import script.obj_id;
public class timer extends script.quest.task.ground.base_task
{
public timer()
{
}
public static final String dataTableColumnMinTime = "MIN_TIME";
public static final String dataTableColumnMaxTime = "MAX_TIME";
public static final String dataTableColumnVisible = "IS_VISIBLE";
public static final String timeObjVar = "playedTimeEnd";
public static final String taskType = "timer";
public static final String dot = ".";
public int OnTaskActivated(obj_id self, int questCrc, int taskId) throws InterruptedException
{
groundquests.questOutputDebugInfo(self, questCrc, taskId, taskType, "OnTaskActivated", taskType + "task activated.");
float minTime = groundquests.getTaskIntDataEntry(questCrc, taskId, dataTableColumnMinTime);
float maxTime = groundquests.getTaskIntDataEntry(questCrc, taskId, dataTableColumnMaxTime);
int isVisible = groundquests.getTaskIntDataEntry(questCrc, taskId, dataTableColumnVisible);
if (minTime > maxTime)
{
float temp = minTime;
minTime = maxTime;
maxTime = temp;
}
float timerLength = rand(minTime, maxTime);
float playerPlayedTimeWhenTimerEnds = getPlayerPlayedTime(self) + timerLength;
groundquests.questOutputDebugInfo(self, questCrc, taskId, taskType, "OnTaskActivated", "Setting timer for " + timerLength + " seconds.");
dictionary params = new dictionary();
params.put("questcrc", questCrc);
params.put("taskid", taskId);
messageTo(self, "QuestTimerTaskCompleted", params, timerLength, true);
String baseObjVar = groundquests.setBaseObjVar(self, taskType, questGetQuestName(questCrc), taskId);
setObjVar(self, baseObjVar + dot + timeObjVar, playerPlayedTimeWhenTimerEnds);
if (isVisible != 0)
{
questSetQuestTaskTimer(self, questGetQuestName(questCrc), taskId, "quest/groundquests:timer_timertext", (int)playerPlayedTimeWhenTimerEnds);
}
return super.OnTaskActivated(self, questCrc, taskId);
}
public int QuestTimerTaskCompleted(obj_id self, dictionary params) throws InterruptedException
{
int questCrc = params.getInt("questcrc");
int taskId = params.getInt("taskid");
if (questIsTaskActive(questCrc, taskId, self))
{
String baseObjVar = groundquests.getBaseObjVar(self, taskType, questGetQuestName(questCrc), taskId);
float playerPlayedTimeWhenTimerEnds = getFloatObjVar(self, baseObjVar + dot + timeObjVar);
float timeLeft = playerPlayedTimeWhenTimerEnds - getPlayerPlayedTime(self);
if (timeLeft <= 0)
{
questCompleteTask(questCrc, taskId, self);
}
else
{
dictionary newParams = new dictionary();
newParams.put("questcrc", questCrc);
newParams.put("taskid", taskId);
messageTo(self, "QuestTimerTaskCompleted", newParams, timeLeft, true);
}
}
return SCRIPT_CONTINUE;
}
public int OnTaskCompleted(obj_id self, int questCrc, int taskId) throws InterruptedException
{
cleanup(self, questCrc, taskId);
groundquests.questOutputDebugInfo(self, questCrc, taskId, taskType, "OnTaskCompleted", taskType + "task completed.");
return super.OnTaskCompleted(self, questCrc, taskId);
}
public int OnTaskFailed(obj_id self, int questCrc, int taskId) throws InterruptedException
{
cleanup(self, questCrc, taskId);
groundquests.questOutputDebugInfo(self, questCrc, taskId, taskType, "OnTaskFailed", taskType + "task failed.");
return super.OnTaskFailed(self, questCrc, taskId);
}
public int OnTaskCleared(obj_id self, int questCrc, int taskId) throws InterruptedException
{
cleanup(self, questCrc, taskId);
groundquests.questOutputDebugInfo(self, questCrc, taskId, taskType, "OnTaskCleared", taskType + "task cleared.");
return super.OnTaskCleared(self, questCrc, taskId);
}
public int OnDetach(obj_id self) throws InterruptedException
{
removeObjVar(self, groundquests.getTaskTypeObjVar(self, taskType));
return SCRIPT_CONTINUE;
}
public void cleanup(obj_id player, int questCrc, int taskId) throws InterruptedException
{
groundquests.clearBaseObjVar(player, taskType, questGetQuestName(questCrc), taskId);
}
public int handleClientLogin(obj_id self, obj_id target, String params, float defaultTime) throws InterruptedException
{
dictionary tasks = groundquests.getActiveTasksForTaskType(self, taskType);
if ((tasks != null) && !tasks.isEmpty())
{
java.util.Enumeration keys = tasks.keys();
while (keys.hasMoreElements())
{
String questCrcString = (String)keys.nextElement();
int questCrc = utils.stringToInt(questCrcString);
int[] tasksForCurrentQuest = tasks.getIntArray(questCrcString);
for (int taskId : tasksForCurrentQuest) {
String baseObjVar = groundquests.getBaseObjVar(self, taskType, questGetQuestName(questCrc), taskId);
float playerPlayedTimeWhenTimerEnds = getFloatObjVar(self, baseObjVar + dot + timeObjVar);
if (getPlayerPlayedTime(self) < playerPlayedTimeWhenTimerEnds) {
int isVisible = groundquests.getTaskIntDataEntry(questCrc, taskId, dataTableColumnVisible);
if (isVisible != 0) {
questSetQuestTaskTimer(self, questGetQuestName(questCrc), taskId, "quest/groundquests:timer_timertext", (int) playerPlayedTimeWhenTimerEnds);
}
}
}
}
}
return SCRIPT_CONTINUE;
}
}