mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
* 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
197 lines
8.0 KiB
Java
Executable File
197 lines
8.0 KiB
Java
Executable File
package script.test;
|
|
|
|
import script.dictionary;
|
|
import script.library.*;
|
|
import script.obj_id;
|
|
|
|
import java.util.Vector;
|
|
|
|
public class qadna extends script.base_script
|
|
{
|
|
public qadna()
|
|
{
|
|
}
|
|
public static final String INCUBATOR_TEMPLATES = "datatables/beast/incubator_templates.iff";
|
|
public static final String SCRIPTVAR = "qadna";
|
|
public static final String DNA_PROMPT = "Choose the creature you want to get DNA from. \nThe chosen DNA will be created in your inventory.";
|
|
public static final String DNA_TITLE = "QA DNA Tool";
|
|
public static final String[] QATOOL_MAIN_MENU = dataTableGetStringColumn("datatables/test/qa_tool_menu.iff", "main_tool");
|
|
public static final String QATOOL_TITLE = "QA Tools";
|
|
public static final String QATOOL_PROMPT = "Choose the tool you want to use";
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
if (!isGod(self))
|
|
{
|
|
detachScript(self, "test.qadna");
|
|
}
|
|
else if (isGod(self))
|
|
{
|
|
if (getGodLevel(self) < 10)
|
|
{
|
|
detachScript(self, "test.qadna");
|
|
sendSystemMessage(self, "You do not have the appropriate access level to use this script.", null);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
|
{
|
|
if (isGod(self))
|
|
{
|
|
if ((toLower(text)).equals("qadna"))
|
|
{
|
|
getCreatureList(self);
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int handlePetOptionsTool(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
if (!isGod(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
|
|
{
|
|
qa.checkParams(params, SCRIPTVAR);
|
|
obj_id player = sui.getPlayerId(params);
|
|
int idx = sui.getListboxSelectedRow(params);
|
|
int btn = sui.getIntButtonPressed(params);
|
|
if (btn == sui.BP_CANCEL)
|
|
{
|
|
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
|
|
utils.removeScriptVarTree(player, "qadna");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (btn == sui.BP_REVERT)
|
|
{
|
|
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
|
|
utils.removeScriptVarTree(player, "qadna");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
switch (idx)
|
|
{
|
|
case 0:
|
|
getCreatureList(self);
|
|
break;
|
|
case 1:
|
|
sendSystemMessageTestingOnly(self, "These pet options are not yet available.");
|
|
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
|
|
utils.removeScriptVarTree(player, "qadna");
|
|
break;
|
|
default:
|
|
removePlayer(player, "Default Option on Switch");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int handleDnaOptions(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
if (!isGod(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (utils.hasScriptVar(self, SCRIPTVAR + ".pid"))
|
|
{
|
|
qa.checkParams(params, SCRIPTVAR);
|
|
obj_id player = sui.getPlayerId(params);
|
|
int idx = sui.getListboxSelectedRow(params);
|
|
int btn = sui.getIntButtonPressed(params);
|
|
if (btn == sui.BP_CANCEL)
|
|
{
|
|
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
|
|
utils.removeScriptVarTree(player, "qadna");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else if (btn == sui.BP_REVERT)
|
|
{
|
|
qa.refreshMenu(self, QATOOL_PROMPT, QATOOL_TITLE, QATOOL_MAIN_MENU, "toolMainMenu", true, "qatool.pid");
|
|
utils.removeScriptVarTree(player, "qadna");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else if (idx < 0)
|
|
{
|
|
removePlayer(player, "Index less than zero");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
String chosenDnaItem = dataTableGetString(INCUBATOR_TEMPLATES, idx, "initial_template");
|
|
String creature = getDisplayName(chosenDnaItem);
|
|
setUpDnaWithDummyData(self, chosenDnaItem, creature);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public void toolMainMenu(obj_id self, String[] dnaCreatureArray) throws InterruptedException
|
|
{
|
|
qa.refreshMenu(self, DNA_PROMPT, DNA_TITLE, dnaCreatureArray, "handleDnaOptions", SCRIPTVAR + ".pid", SCRIPTVAR + ".mainMenu", sui.OK_CANCEL_REFRESH);
|
|
}
|
|
public void getCreatureList(obj_id self) throws InterruptedException
|
|
{
|
|
Vector dnaCreatures = new Vector();
|
|
String[] dnaCreatureStringColumn = dataTableGetStringColumn(INCUBATOR_TEMPLATES, "initial_template");
|
|
if (dnaCreatureStringColumn.length > -1)
|
|
{
|
|
for (String s : dnaCreatureStringColumn) {
|
|
String creatureDisplayName = getDisplayName(s);
|
|
dnaCreatures.add(creatureDisplayName);
|
|
}
|
|
if (dnaCreatures.size() >= 1)
|
|
{
|
|
String[] dnaCreatureArray = new String[dnaCreatures.size()];
|
|
dnaCreatures.toArray(dnaCreatureArray);
|
|
toolMainMenu(self, dnaCreatureArray);
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "There is an error with this tool, if the issue persists, please contact the tool team.");
|
|
removePlayer(self, "");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sendSystemMessageTestingOnly(self, "There is an error with this tool, if the issue persists, please contact the tool team.");
|
|
removePlayer(self, "");
|
|
}
|
|
}
|
|
public String getDisplayName(String creatureName) throws InterruptedException
|
|
{
|
|
if (creatureName.contains("/"))
|
|
{
|
|
String[] splitType = split(creatureName, '/');
|
|
creatureName = splitType[3];
|
|
}
|
|
if (creatureName.contains("."))
|
|
{
|
|
String[] splitAtDot = split(creatureName, '.');
|
|
creatureName = splitAtDot[0];
|
|
}
|
|
creatureName = beast_lib.stripBmFromType(creatureName);
|
|
return creatureName;
|
|
}
|
|
public void setUpDnaWithDummyData(obj_id self, String creatureTemplate, String creature) throws InterruptedException
|
|
{
|
|
obj_id pInv = utils.getInventoryContainer(self);
|
|
obj_id dnaContainer = createObjectOverloaded("object/tangible/loot/beast/dna_container.iff", pInv);
|
|
incubator.initializeDna(dnaContainer, self);
|
|
setObjVar(dnaContainer, incubator.DNA_PARENT_TEMPLATE, creature);
|
|
int row = dataTableSearchColumnForString(creatureTemplate, "initial_template", INCUBATOR_TEMPLATES);
|
|
int hashTemplate = dataTableGetInt(INCUBATOR_TEMPLATES, row, "hash_initial_template");
|
|
setObjVar(dnaContainer, incubator.DNA_TEMPLATE_OBJVAR, hashTemplate);
|
|
sendSystemMessageTestingOnly(self, "A " + creature + " DNA sample has been placed in your inventory.");
|
|
removePlayer(self, "");
|
|
}
|
|
public void removePlayer(obj_id self, String err) throws InterruptedException
|
|
{
|
|
sendSystemMessageTestingOnly(self, err);
|
|
qa.removeScriptVars(self, SCRIPTVAR);
|
|
utils.removeScriptVarTree(self, SCRIPTVAR);
|
|
}
|
|
}
|