mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-14 23:07:51 -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
202 lines
7.7 KiB
Java
Executable File
202 lines
7.7 KiB
Java
Executable File
package script.item.entertainer_console;
|
|
|
|
import script.library.*;
|
|
import script.location;
|
|
import script.obj_id;
|
|
|
|
import java.util.Vector;
|
|
|
|
public class props extends script.base_script
|
|
{
|
|
public props()
|
|
{
|
|
}
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
obj_id container = getLocation(self).cell;
|
|
if (isIdValid(container))
|
|
{
|
|
boolean check = registerSelf(container);
|
|
if (check)
|
|
{
|
|
String templateString = getTemplateName(self);
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_backdrop_generator.iff"))
|
|
{
|
|
if (hasObjVar(self, "paintingId"))
|
|
{
|
|
obj_id oldBackdrop = getObjIdObjVar(self, "paintingId");
|
|
if (isIdValid(oldBackdrop))
|
|
{
|
|
destroyObject(oldBackdrop);
|
|
}
|
|
removeObjVar(self, "paintingId");
|
|
location backdropLocation = getLocation(self);
|
|
float myYaw = getYaw(self);
|
|
backdropLocation.y += 0.3f;
|
|
String staticString = getStringObjVar(self, "paintingType");
|
|
obj_id backdropId = static_item.createNewItemFunction(staticString, container, backdropLocation);
|
|
if (!isIdValid(backdropId) || isIdNull(backdropId))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else
|
|
{
|
|
setYaw(backdropId, myYaw);
|
|
setObjVar(self, "paintingId", backdropId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnAboutToBeTransferred(obj_id self, obj_id destContainer, obj_id transferer) throws InterruptedException
|
|
{
|
|
obj_id topContainer = getTopMostContainer(self);
|
|
String templateString = getTemplateName(self);
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_backdrop_generator.iff"))
|
|
{
|
|
if (hasObjVar(self, "paintingId"))
|
|
{
|
|
obj_id oldBackdrop = getObjIdObjVar(self, "paintingId");
|
|
destroyObject(oldBackdrop);
|
|
removeObjVar(self, "paintingId");
|
|
}
|
|
}
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_fog_machine.iff"))
|
|
{
|
|
if (hasObjVar(self, "fogId"))
|
|
{
|
|
obj_id oldFog = getObjIdObjVar(self, "fogId");
|
|
if (isIdValid(oldFog))
|
|
{
|
|
destroyObject(oldFog);
|
|
}
|
|
removeObjVar(self, "fogId");
|
|
}
|
|
}
|
|
obj_id container = getLocation(self).cell;
|
|
if (isIdValid(container) && checkArray(container))
|
|
{
|
|
boolean unreg = unregisterSelf();
|
|
}
|
|
if (isIdValid(destContainer))
|
|
{
|
|
boolean reg = registerSelf(destContainer);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public boolean checkLocation(obj_id cell) throws InterruptedException
|
|
{
|
|
if (getCellName(cell) == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (!utils.isNestedWithinAPlayer(cell))
|
|
{
|
|
obj_id house = getTopMostContainer(cell);
|
|
obj_id ship = space_transition.getContainingShip(getSelf());
|
|
String templateName = "";
|
|
if (isIdValid(ship))
|
|
{
|
|
templateName = getTemplateName(ship);
|
|
}
|
|
if (isIdValid(house) && (player_structure.isBuilding(house) || space_utils.isPobType(templateName)))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public boolean registerSelf(obj_id cell) throws InterruptedException
|
|
{
|
|
obj_id self = getSelf();
|
|
if (isIdValid(cell) && !checkArray(cell) && checkLocation(cell))
|
|
{
|
|
String template = getTemplate();
|
|
Vector objectList = new Vector();
|
|
obj_id topContainer = getTopMostContainer(cell);
|
|
if (utils.hasScriptVar(topContainer, template))
|
|
{
|
|
Vector list = utils.getResizeableObjIdArrayScriptVar(topContainer, template);
|
|
for (Object o : list) {
|
|
objectList.addElement(((obj_id) o));
|
|
}
|
|
}
|
|
objectList.addElement(self);
|
|
utils.setScriptVar(topContainer, template, objectList);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean unregisterSelf() throws InterruptedException
|
|
{
|
|
obj_id topContainer = getTopMostContainer(getSelf());
|
|
obj_id self = getSelf();
|
|
String template = getTemplate();
|
|
if (isIdValid(topContainer) && utils.hasScriptVar(topContainer, template))
|
|
{
|
|
Vector objectList = utils.getResizeableObjIdArrayScriptVar(topContainer, template);
|
|
for (int i = 0; i < objectList.size(); i++)
|
|
{
|
|
if (((obj_id)objectList.get(i)).equals(self))
|
|
{
|
|
objectList.removeElement(self);
|
|
if (objectList.size() > 0)
|
|
{
|
|
utils.setScriptVar(topContainer, template, objectList);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(topContainer, template);
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public boolean checkArray(obj_id cell) throws InterruptedException
|
|
{
|
|
obj_id self = getSelf();
|
|
obj_id topContainer = getTopMostContainer(self);
|
|
String item = getTemplate();
|
|
if (isIdValid(topContainer) && utils.hasScriptVar(topContainer, item))
|
|
{
|
|
Vector objectList = utils.getResizeableObjIdArrayScriptVar(topContainer, item);
|
|
for (Object o : objectList) {
|
|
if (((obj_id) o) == self) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public String getTemplate() throws InterruptedException
|
|
{
|
|
String templateString = getTemplateName(getSelf());
|
|
String template = "";
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_backdrop_generator.iff"))
|
|
{
|
|
template = "entertainer_console.backdrop";
|
|
}
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_pyro_machine.iff"))
|
|
{
|
|
template = "entertainer_console.pyrotechnic";
|
|
}
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_smoke_machine.iff"))
|
|
{
|
|
template = "entertainer_console.smoke";
|
|
}
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_fog_machine.iff"))
|
|
{
|
|
template = "entertainer_console.fog";
|
|
}
|
|
if (templateString != null && templateString.equals("object/tangible/item/entertainer_console/stage_light.iff"))
|
|
{
|
|
template = "entertainer_console.light";
|
|
}
|
|
return template;
|
|
}
|
|
}
|