mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-10-18 09:02:56 -04:00
who isn't sick of converting the freaking scripts? this negates the need
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
package script.planet_map;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.planetary_map;
|
||||
|
||||
public class active_registered extends script.base_script
|
||||
{
|
||||
public active_registered()
|
||||
{
|
||||
}
|
||||
public static final string_id SID_LOCATION_REGISTRATION_CANCELLED = new string_id("travel", "location_registration_cancelled");
|
||||
public int OnLostItem(obj_id self, obj_id destContainer, obj_id transferer, obj_id item) throws InterruptedException
|
||||
{
|
||||
if (utils.isNestedWithin(destContainer, self))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
removeRegistrant(self, item);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnTriggerVolumeExited(obj_id self, String volName, obj_id who) throws InterruptedException
|
||||
{
|
||||
if (who == self)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (volName.equals("camp_" + self))
|
||||
{
|
||||
removeRegistrant(self, who);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int removeRegistrant(obj_id self, dictionary params) throws InterruptedException
|
||||
{
|
||||
obj_id objItem = params.getObjId("objItem");
|
||||
removeRegistrant(self, objItem);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public void removeRegistrant(obj_id self, obj_id item) throws InterruptedException
|
||||
{
|
||||
if (!isIdValid(self) || !isIdValid(item) || !isPlayer(item))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Vector registrants = utils.getResizeableObjIdBatchScriptVar(self, "registrants");
|
||||
if (registrants != null && registrants.size() > 0)
|
||||
{
|
||||
int idx = utils.getElementPositionInArray(registrants, item);
|
||||
if (idx > -1)
|
||||
{
|
||||
registrants = utils.removeElementAt(registrants, idx);
|
||||
if (registrants == null || registrants.size() == 0)
|
||||
{
|
||||
utils.removeBatchScriptVar(self, "registrants");
|
||||
if (planetary_map.updateFacilityActive(self, false))
|
||||
{
|
||||
detachScript(self, "planet_map.active_registered");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
utils.setBatchScriptVar(self, "registrants", registrants);
|
||||
}
|
||||
if (item.isLoaded())
|
||||
{
|
||||
sendSystemMessage(item, SID_LOCATION_REGISTRATION_CANCELLED);
|
||||
utils.removeScriptVar(item, "registerWithLocation");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
*
|
||||
* Title: temporary_structure.script
|
||||
* Description: script that handles the temporary player structure
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.utils;
|
||||
include library.planetary_map;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
const string_id SID_LOCATION_REGISTRATION_CANCELLED = new string_id("travel", "location_registration_cancelled");
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
trigger OnLostItem(obj_id destContainer, obj_id transferer, obj_id item)
|
||||
{
|
||||
if ( utils.isNestedWithin(destContainer, self) )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
removeRegistrant(self, item);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnTriggerVolumeExited( string volName, obj_id who )
|
||||
{
|
||||
if ( who == self )
|
||||
return SCRIPT_CONTINUE;
|
||||
|
||||
if ( volName.equals("camp_" + self) )
|
||||
removeRegistrant(self, who);
|
||||
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
messageHandler removeRegistrant()
|
||||
{
|
||||
obj_id objItem = params.getObjId("objItem");
|
||||
removeRegistrant(self, objItem);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/***** COMMANDHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** FUNCTIONS **************************************************/
|
||||
void removeRegistrant(obj_id self, obj_id item)
|
||||
{
|
||||
if ( !isIdValid(self) || !isIdValid(item) || !isPlayer(item) )
|
||||
return;
|
||||
|
||||
resizeable obj_id[] registrants = utils.getResizeableObjIdBatchScriptVar(self, "registrants");
|
||||
if ( registrants != null && registrants.length > 0 )
|
||||
{
|
||||
int idx = utils.getElementPositionInArray(registrants, item);
|
||||
if ( idx > -1 )
|
||||
{
|
||||
registrants = utils.removeElementAt(registrants, idx);
|
||||
if ( registrants == null || registrants.length == 0 )
|
||||
{
|
||||
utils.removeBatchScriptVar(self, "registrants");
|
||||
|
||||
if ( planetary_map.updateFacilityActive(self, false) )
|
||||
detachScript(self, "planet_map.active_registered");
|
||||
}
|
||||
else
|
||||
{
|
||||
utils.setBatchScriptVar(self, "registrants", registrants);
|
||||
}
|
||||
|
||||
if ( item.isLoaded() )
|
||||
{
|
||||
sendSystemMessage(item, SID_LOCATION_REGISTRATION_CANCELLED);
|
||||
utils.removeScriptVar(item, "registerWithLocation");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package script.planet_map;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.planetary_map;
|
||||
|
||||
public class map_loc extends script.planet_map.map_loc_base
|
||||
{
|
||||
public map_loc()
|
||||
{
|
||||
}
|
||||
public int OnInitialize(obj_id self) throws InterruptedException
|
||||
{
|
||||
String template = getTemplateName(self);
|
||||
if ((template != null) || (!template.equals("")))
|
||||
{
|
||||
if (template.indexOf("object/building/player/city/garden_") != -1)
|
||||
{
|
||||
detachScript(self, "planet_map.map_loc_both");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
if (!planetary_map.addMapLocation(self))
|
||||
{
|
||||
location here = getLocation(self);
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
LOG("planetaryMapLocation", "trigger OnInitialize()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
*
|
||||
* Title: temporary_structure.script
|
||||
* Description: script that handles the temporary player structure
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.planetary_map;
|
||||
|
||||
inherits planet_map.map_loc_base;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnInitialize()
|
||||
{
|
||||
string template = getTemplateName(self);
|
||||
if ( (template != null) || (!template.equals("")))
|
||||
{
|
||||
if ( template.indexOf ("object/building/player/city/garden_") != -1 ) //Don't register player city gardens on the planetary map
|
||||
{
|
||||
detachScript(self, "planet_map.map_loc_both");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
if ( !planetary_map.addMapLocation(self) )
|
||||
{
|
||||
location here = getLocation(self);
|
||||
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
|
||||
LOG("planetaryMapLocation", "trigger OnInitialize()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/********** debug triggers ***************
|
||||
trigger OnAttach()
|
||||
{
|
||||
if ( !planetary_map.addMapLocation(self) )
|
||||
{
|
||||
string template = getTemplateName(self);
|
||||
location here = getLocation(self);
|
||||
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
|
||||
LOG("planetaryMapLocation", "trigger OnAttach()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDetach()
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
/********** end debug triggers ***************/
|
||||
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** COMMANDHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** FUNCTIONS **************************************************/
|
||||
@@ -0,0 +1,38 @@
|
||||
package script.planet_map;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.planetary_map;
|
||||
|
||||
public class map_loc_attach extends script.planet_map.map_loc_base
|
||||
{
|
||||
public map_loc_attach()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
if (!planetary_map.addMapLocation(self))
|
||||
{
|
||||
String template = getTemplateName(self);
|
||||
location here = getLocation(self);
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
LOG("planetaryMapLocation", "trigger OnAttach()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDetach(obj_id self) throws InterruptedException
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
*
|
||||
* Title: temporary_structure.script
|
||||
* Description: script that handles the temporary player structure
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.planetary_map;
|
||||
|
||||
inherits planet_map.map_loc_base;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
if ( !planetary_map.addMapLocation(self) )
|
||||
{
|
||||
string template = getTemplateName(self);
|
||||
location here = getLocation(self);
|
||||
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
|
||||
LOG("planetaryMapLocation", "trigger OnAttach()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDetach()
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** COMMANDHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** FUNCTIONS **************************************************/
|
||||
@@ -0,0 +1,28 @@
|
||||
package script.planet_map;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.planetary_map;
|
||||
|
||||
public class map_loc_base extends script.base_script
|
||||
{
|
||||
public map_loc_base()
|
||||
{
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnObjectDisabled(obj_id self, obj_id killer) throws InterruptedException
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
include library.planetary_map;
|
||||
|
||||
trigger OnDestroy()
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnObjectDisabled(obj_id killer)
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
/*trigger OnUnloaded()
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}*/
|
||||
@@ -0,0 +1,51 @@
|
||||
package script.planet_map;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.planetary_map;
|
||||
|
||||
public class map_loc_both extends script.planet_map.map_loc
|
||||
{
|
||||
public map_loc_both()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
String template = getTemplateName(self);
|
||||
if ((template != null) || (!template.equals("")))
|
||||
{
|
||||
if (template.indexOf("object/building/player/city/garden_") != -1)
|
||||
{
|
||||
detachScript(self, "planet_map.map_loc_both");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
if (!planetary_map.addMapLocation(self))
|
||||
{
|
||||
location here = getLocation(self);
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
LOG("planetaryMapLocation", "trigger OnAttach()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDetach(obj_id self) throws InterruptedException
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
public int OnDestroy(obj_id self) throws InterruptedException
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/**********************************************************************
|
||||
|
||||
*
|
||||
* Title: temporary_structure.script
|
||||
* Description: script that handles the temporary player structure
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
/***** INCLUDES ********************************************************/
|
||||
include library.planetary_map;
|
||||
|
||||
inherits planet_map.map_loc;
|
||||
|
||||
/***** CONSTANTS *******************************************************/
|
||||
|
||||
/***** TRIGGERS ********************************************************/
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
string template = getTemplateName(self);
|
||||
if ( (template != null) || (!template.equals("")))
|
||||
{
|
||||
if ( template.indexOf ("object/building/player/city/garden_") != -1 ) //Don't register player city gardens on the planetary map
|
||||
{
|
||||
detachScript(self, "planet_map.map_loc_both");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
if ( !planetary_map.addMapLocation(self) )
|
||||
{
|
||||
location here = getLocation(self);
|
||||
|
||||
debugServerConsoleMsg(self, "WARNING: unable to add self as planetary map location!");
|
||||
debugServerConsoleMsg(self, "template = " + template + " here = " + here.toString());
|
||||
|
||||
LOG("planetaryMapLocation", "trigger OnAttach()");
|
||||
LOG("planetaryMapLocation", "WARNING: unable to add self (" + self + ") as planetary map location!");
|
||||
LOG("planetaryMapLocation", "template = " + template);
|
||||
LOG("planetaryMapLocation", "here = " + here.toString());
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDetach()
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
trigger OnDestroy()
|
||||
{
|
||||
planetary_map.removeMapLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
/***** MESSAGEHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** COMMANDHANDLERS *************************************************/
|
||||
|
||||
|
||||
/***** FUNCTIONS **************************************************/
|
||||
@@ -0,0 +1,24 @@
|
||||
package script.planet_map;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.utils;
|
||||
import script.library.planetary_map;
|
||||
|
||||
public class map_loc_creature extends script.planet_map.map_loc_base
|
||||
{
|
||||
public map_loc_creature()
|
||||
{
|
||||
}
|
||||
public int OnAttach(obj_id self) throws InterruptedException
|
||||
{
|
||||
planetary_map.addCreatureLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
include library.utils;
|
||||
include library.planetary_map;
|
||||
|
||||
inherits planet_map.map_loc_base;
|
||||
|
||||
trigger OnAttach()
|
||||
{
|
||||
planetary_map.addCreatureLocation(self);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
Reference in New Issue
Block a user