Files
dsrc/sku.0/sys.server/compiled/game/script/city/bestine/terminal_items.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

120 lines
4.7 KiB
Java
Executable File

package script.city.bestine;
import script.library.utils;
import script.menu_info;
import script.menu_info_types;
import script.obj_id;
import script.string_id;
public class terminal_items extends script.base_script
{
public terminal_items()
{
}
public static final String CONVO = "city/bestine/terminal_items";
public static final String DATATABLE_NAME = "datatables/city/bestine/terminal_items.iff";
public static final String GET_QUEST_ITEM_VOLUME_NAME = "getQuestItemTriggerVolume";
public int OnInitialize(obj_id self) throws InterruptedException
{
createTriggerVolume(GET_QUEST_ITEM_VOLUME_NAME, 2.0f, true);
return SCRIPT_CONTINUE;
}
public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id breacher) throws InterruptedException
{
if (volumeName.equals(GET_QUEST_ITEM_VOLUME_NAME))
{
String template = getStringObjVar(self, "disk");
if ((template != null) && (!template.equals("")) && template.contains("history") && isPlayer(breacher) && canSearch(self, breacher))
{
if (hasObjVar(breacher, "bestine.searched"))
{
sendSystemMessage(breacher, new string_id(CONVO, "history_disk_found_already"));
return SCRIPT_CONTINUE;
}
obj_id playerInv = utils.getInventoryContainer(breacher);
if (isIdValid(playerInv))
{
int free_space = getVolumeFree(playerInv);
if (free_space > 0)
{
obj_id objectReceived = createObject(template, playerInv, "");
if (isIdValid(objectReceived))
{
sendSystemMessage(breacher, new string_id(CONVO, "history_disk_found"));
setObjVar(breacher, "bestine.searched", 1);
}
}
else
{
sendSystemMessage(breacher, new string_id(CONVO, "inv_full"));
}
}
}
}
return SCRIPT_CONTINUE;
}
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info mi) throws InterruptedException
{
String template = getStringObjVar(self, "disk");
if(template != null && template.contains("history")){
return SCRIPT_CONTINUE;
}
if (canSearch(self, player))
{
mi.addRootMenu(menu_info_types.ITEM_USE, new string_id(CONVO, "download"));
}
return SCRIPT_CONTINUE;
}
public int OnObjectMenuSelect(obj_id self, obj_id player, int item) throws InterruptedException
{
if (item == menu_info_types.ITEM_USE)
{
if (canSearch(self, player))
{
if (hasObjVar(player, "bestine.searched"))
{
sendSystemMessage(player, new string_id(CONVO, "searched"));
return SCRIPT_CONTINUE;
}
String template = getStringObjVar(self, "disk");
if ((template != null) && (!template.equals("")))
{
obj_id playerInv = utils.getInventoryContainer(player);
if (isIdValid(playerInv))
{
int free_space = getVolumeFree(playerInv);
if (free_space > 0)
{
obj_id objectReceived = createObject(template, playerInv, "");
if (isIdValid(objectReceived))
{
sendSystemMessage(player, new string_id(CONVO, "download_complete"));
setObjVar(player, "bestine.searched", 1);
}
return SCRIPT_CONTINUE;
}
else
{
sendSystemMessage(player, new string_id(CONVO, "inv_full"));
}
}
}
}
}
return SCRIPT_CONTINUE;
}
public boolean canSearch(obj_id self, obj_id player) throws InterruptedException
{
boolean result = false;
if (hasObjVar(self, "disk"))
{
String gatingObjVar = dataTableGetRow(DATATABLE_NAME, getStringObjVar(self, "disk")).getString("gatingObjVar");
if (hasObjVar(player, gatingObjVar))
{
result = true;
}
}
return result;
}
}