mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-28 22:15:54 -04:00
1122 lines
31 KiB
Plaintext
1122 lines
31 KiB
Plaintext
include library.ai_lib;
|
|
include library.callable;
|
|
include library.combat;
|
|
include library.craftinglib;
|
|
include library.create;
|
|
include library.datatable;
|
|
include library.factions;
|
|
include library.gcw;
|
|
include library.hue;
|
|
include library.money;
|
|
include library.pet_lib;
|
|
include library.player_structure;
|
|
include library.regions;
|
|
include library.scheduled_drop;
|
|
include library.skill;
|
|
include library.space_crafting;
|
|
include library.space_create;
|
|
include library.space_transition;
|
|
include library.sui;
|
|
include library.xp;
|
|
include library.utils;
|
|
|
|
|
|
trigger OnSpeaking(string strText)
|
|
{
|
|
string[] strCommands = split(strText, ' ' );
|
|
|
|
if(strCommands[0].equalsIgnoreCase("cityschedule"))
|
|
{
|
|
int bSeconds = gcw.gcwGetNextInvasionTime("bestine");
|
|
int bHours = bSeconds / 3600;
|
|
int bMinutes = (bSeconds % 3600) / 60;
|
|
int bSecondsModded = bSeconds % 60;
|
|
|
|
debugSpeakMsg(self, "invasion bestine: " + bSeconds + "s (" + bHours + "h " + bMinutes + "m " + bSecondsModded + "s)");
|
|
|
|
bSeconds = gcw.gcwGetNextInvasionTime("dearic");
|
|
bHours = bSeconds / 3600;
|
|
bMinutes = (bSeconds % 3600) / 60;
|
|
bSecondsModded = bSeconds % 60;
|
|
|
|
debugSpeakMsg(self, "invasion dearic: " + bSeconds + "s (" + bHours + "h " + bMinutes + "m " + bSecondsModded + "s)");
|
|
|
|
bSeconds = gcw.gcwGetNextInvasionTime("keren");
|
|
bHours = bSeconds / 3600;
|
|
bMinutes = (bSeconds % 3600) / 60;
|
|
bSecondsModded = bSeconds % 60;
|
|
|
|
debugSpeakMsg(self, "invasion keren: " + bSeconds + "s (" + bHours + "h " + bMinutes + "m " + bSecondsModded + "s)");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("time"))
|
|
{
|
|
int gameTime = getGameTime();
|
|
int[] convertedGameTime = player_structure.convertSecondsTime(gameTime);
|
|
sendSystemMessageTestingOnly(self, "getGameTime() returns " + gameTime + " (" + (convertedGameTime[0] / 365) + "y:" + (convertedGameTime[0] % 365) + "d:" + convertedGameTime[1] + "h:" + convertedGameTime[2] + "m:" + convertedGameTime[3] + "s)");
|
|
|
|
int calendarTime = getCalendarTime();
|
|
int[] convertedCalendarTime = player_structure.convertSecondsTime(calendarTime);
|
|
sendSystemMessageTestingOnly(self, "getCalendarTime() returns " + calendarTime + " (" + (convertedCalendarTime[0] / 365) + "y:" + (convertedCalendarTime[0] % 365) + "d:" + convertedCalendarTime[1] + "h:" + convertedCalendarTime[2] + "m:" + convertedCalendarTime[3] + "s)");
|
|
|
|
sendSystemMessageTestingOnly(self, "getCalendarTimeStringGMT(" + calendarTime + ") returns " + getCalendarTimeStringGMT(calendarTime));
|
|
sendSystemMessageTestingOnly(self, "getCalendarTimeStringLocal(" + calendarTime + ") returns " + getCalendarTimeStringLocal(calendarTime));
|
|
}
|
|
if(strCommands[0].equalsIgnoreCase("gcwnear"))
|
|
{
|
|
obj_id near = gcw.getInvasionSequencerNearby(self);
|
|
|
|
sendSystemMessageTestingOnly(self, "GCW Sequencer: " + near);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("yaw"))
|
|
{
|
|
obj_id target = getTarget(self);
|
|
|
|
float yaw = getYaw(target);
|
|
|
|
sendSystemMessageTestingOnly(self, "Target's yaw: " + yaw);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("rotate"))
|
|
{
|
|
obj_id target = getTarget(self);
|
|
|
|
float yaw = getYaw(target);
|
|
|
|
setYaw(target, yaw + 5f);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("increment"))
|
|
{
|
|
obj_id target = getTarget(self);
|
|
incrementCount(target, 100);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("ismob"))
|
|
{
|
|
obj_id target = getTarget(self);
|
|
sendSystemMessageTestingOnly(self, "isMob: " + isMob(target));
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("gcwpoints"))
|
|
{
|
|
obj_id target = getTarget(self);
|
|
gcw._grantGcwPoints(target, self, 1000000, false, gcw.GCW_POINT_TYPE_GROUND_PVE, "");
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("seqloc"))
|
|
{
|
|
if (!hasObjVar(self, "record_table"))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "You do not have the record_table objvar defined");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
obj_id target = getTarget(self);
|
|
|
|
if (!isIdValid(target))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "You must target something first");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
//object spawn_id triggerId room loc_x loc_y loc_z yaw script spawn_objvar trigger_event isInvulnerable comment paths respawn mission_critical
|
|
//s[required] s[none] s[default] s[none] f[0.0] f[0.0] f[0.0] f[0.0] s[none] s[none] s[none] i[0] s s[none] i[-1] i[0]
|
|
|
|
string table = getStringObjVar(self, "record_table");
|
|
location objLoc = getLocation(target);
|
|
|
|
float x = objLoc.x;
|
|
float y = objLoc.y;
|
|
float z = objLoc.z;
|
|
|
|
string name = getTemplateName(target);
|
|
float yaw = getYaw(target);
|
|
sendSystemMessageTestingOnly(self, "Location("+x+", "+y+", "+z+") yaw("+yaw+")");
|
|
|
|
dictionary dctRow = new dictionary ();
|
|
dctRow.put("object", name);
|
|
dctRow.put("spawn_id", "");
|
|
dctRow.put("triggerId", "");
|
|
dctRow.put("room", "");
|
|
dctRow.put("loc_x", x);
|
|
dctRow.put("loc_y", y);
|
|
dctRow.put("loc_z", z);
|
|
dctRow.put("yaw", yaw);
|
|
dctRow.put("script", "");
|
|
dctRow.put("spawn_objvar", "");
|
|
dctRow.put("trigger_event", "");
|
|
dctRow.put("isInvulnerable", 0);
|
|
dctRow.put("comment", "");
|
|
dctRow.put("paths", "");
|
|
dctRow.put("respawn", -1);
|
|
dctRow.put("mission_critical", 0);
|
|
|
|
datatable.serverDataTableAddRow(table, dctRow);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("gcwc"))
|
|
{
|
|
location loc = getLocation(self);
|
|
|
|
createObject("object/tangible/destructible/gcw_kit_tower.iff", loc);
|
|
|
|
loc.x += 6.0f;
|
|
|
|
createObject("object/tangible/destructible/gcw_kit_barricade.iff", loc);
|
|
|
|
loc.x += 6.0f;
|
|
|
|
createObject("object/tangible/destructible/gcw_kit_turret.iff", loc);
|
|
|
|
loc.x += 6.0f;
|
|
|
|
createObject("object/tangible/destructible/gcw_kit_patrol.iff", loc);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("rebelgcw"))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "Rebel percentage: " + gcw.getRebelPercentileByRegion(self));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("rnd"))
|
|
{
|
|
obj_id resource = pickRandomNonDepeletedResource("gas_reactive");
|
|
|
|
// craftinglib.makeBestResource(self, "metal", 1000000);
|
|
|
|
if(isIdValid(resource))
|
|
{
|
|
location loc = getLocation(self);
|
|
oneTimeHarvest(resource, 1000000, loc);
|
|
sendSystemMessageTestingOnly(self, "gas_reactive resource: " + resource);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
resource = pickRandomNonDepeletedResource("steel");
|
|
|
|
if(isIdValid(resource))
|
|
{
|
|
location loc = getLocation(self);
|
|
oneTimeHarvest(resource, 1000000, loc);
|
|
sendSystemMessageTestingOnly(self, "steel resource: " + resource);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("ron"))
|
|
{
|
|
location whereIam = getLocation(self);
|
|
location lowerLeft = getLocation(self);
|
|
location topRight = getLocation(self);
|
|
|
|
float x = whereIam.x;
|
|
float z = whereIam.z;
|
|
|
|
lowerLeft.x = whereIam.x - 300;
|
|
lowerLeft.z = whereIam.x + 300;
|
|
|
|
topRight.x = whereIam.x + 300;
|
|
topRight.z = whereIam.z - 300;
|
|
|
|
createRectRegion(lowerLeft, topRight, "pvp_hanse", regions.PVP_REGION_TYPE_NORMAL, regions.BUILD_FALSE, regions.MUNI_FALSE, regions.GEO_BEACH, 0, 0, regions.SPAWN_FALSE, regions.MISSION_NONE, false, true);
|
|
//createCircleRegion(location center, float radius, String name, int pvp, int buildable, int municipal, int geography, int minDifficulty, int maxDifficulty, int spawnable, int mission, boolean visible, boolean notify);
|
|
//createCircleRegion(getLocation(self), 400, restuss_event.PVP_REGION_NAME, regions.PVP_REGION_TYPE_NORMAL, regions.BUILD_FALSE, regions.MUNI_TRUE, regions.GEO_CITY, 0, 0, regions.SPAWN_FALSE, regions.MISSION_NONE, false, true);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("roff"))
|
|
{
|
|
region pvpHanse = getRegion("yavin4", "pvp_hanse");
|
|
|
|
deleteRegion(pvpHanse);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("pvpcheck"))
|
|
{
|
|
obj_id target = getIntendedTarget(self);
|
|
|
|
if(!isIdValid(target))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
for(int i = 0, j = 10; i < j; i++)
|
|
{
|
|
int amount = gcw.distributeIndividualContribution(self, target, 0, gcw.GCW_POINT_TYPE_GROUND_PVP);
|
|
sendSystemMessageTestingOnly(self, "GCW: " + amount);
|
|
}
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("lreg"))
|
|
{
|
|
region [] regions = getRegionsAtPoint(getLocation(self));
|
|
|
|
if(regions == null || regions.length < 1)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "No regions here.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
for(int i = 0, j = regions.length; i < j; i++)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "Region: " + regions[i].getName());
|
|
}
|
|
}
|
|
if(strCommands[0].equalsIgnoreCase("top"))
|
|
{
|
|
obj_id topMost = getTopMostContainer(self);
|
|
|
|
sendSystemMessageTestingOnly(self, "Topmost: " + topMost);
|
|
}
|
|
if(strCommands[0].equalsIgnoreCase("resources"))
|
|
{
|
|
craftinglib.makeBestResource(self, "steel", 1000000);
|
|
craftinglib.makeBestResource(self, "iron", 1000000);
|
|
craftinglib.makeBestResource(self, "copper", 1000000);
|
|
craftinglib.makeBestResource(self, "fuel_petrochem_solid", 1000000);
|
|
craftinglib.makeBestResource(self, "radioactive", 1000000);
|
|
craftinglib.makeBestResource(self, "aluminum", 1000000);
|
|
craftinglib.makeBestResource(self, "ore_extrusive", 1000000);
|
|
craftinglib.makeBestResource(self, "petrochem_inert", 1000000);
|
|
craftinglib.makeBestResource(self, "fiberplast", 1000000);
|
|
craftinglib.makeBestResource(self, "gas_inert", 1000000);
|
|
craftinglib.makeBestResource(self, "gas_reactive", 1000000);
|
|
sendSystemMessageTestingOnly(self, "Completed.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("tcg"))
|
|
{
|
|
string [] promotions = scheduled_drop.validatePromotionsVersusCluster(scheduled_drop.getScheduledPromotions("item"));
|
|
|
|
if(promotions == null || promotions.length <= 0)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "All promotions empty.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
dictionary [] promotionalItems = scheduled_drop.getStaticItemsForAllPromotions(promotions);
|
|
|
|
if(promotionalItems == null || promotionalItems.length <= 0)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "Items in promotions empty.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
int index = scheduled_drop.getRandomStaticItem(promotionalItems);
|
|
|
|
if(index < 0)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "No promotion item chosen.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
sendSystemMessageTestingOnly(self, "promotions.length: " + promotions.length + "promotionalItems.length: " + promotionalItems.length + " random item: " + promotionalItems[index].getString("promotionItem"));
|
|
|
|
string [] promotionList = new string[promotionalItems.length];
|
|
|
|
for(int i = 0, j = promotionalItems.length; i < j; i++)
|
|
{
|
|
promotionList[i] = "[" + i + "] promo: " + promotionalItems[i].getString("promotionName") + " item: " + promotionalItems[i].getString("promotionItem") + " weight: " + promotionalItems[i].getInt("promotionWeight");
|
|
}
|
|
|
|
int pid = sui.listbox(self, self, "List of items", sui.OK_CANCEL, "Promotion List", promotionList, "noHandler", true, false);
|
|
}
|
|
|
|
// Do not use this command if you do not know what you're doing.
|
|
if(strCommands[0].equalsIgnoreCase("planet"))
|
|
{
|
|
location where = getLocation(self);
|
|
|
|
string serverName = toLower(getConfigSetting("CentralServer", "clusterName"));
|
|
sendSystemMessageTestingOnly(self, "Planet: " + getPlanetByName(where.area) + " serverName: " + serverName);
|
|
|
|
// scheduled_drop.removeClusterPromotions();
|
|
// scheduled_drop.removeLastClusterUpdateTime();
|
|
// scheduled_drop.instantiatePromotionsOnCluster();
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
// Do not use this command if you do not know what you're doing.
|
|
if(strCommands[0].equalsIgnoreCase("erasetcg"))
|
|
{
|
|
scheduled_drop.setClusterPromotions(null);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("reducetcg"))
|
|
{
|
|
dictionary params = new dictionary();
|
|
|
|
params.put("promotion", "tcg_swg_promo_1");
|
|
|
|
messageTo(getPlanetByName("tatooine"), "reducePromotion", params, 1.0f, true);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("slamtcg"))
|
|
{
|
|
int boosters = 0;
|
|
int starters = 0;
|
|
int cards = 0;
|
|
|
|
for(int i = 0; i < 50000; i++)
|
|
{
|
|
if(scheduled_drop.canDropCard(scheduled_drop.SYSTEM_CRAFTER))
|
|
{
|
|
obj_id temp = scheduled_drop.dropCard(scheduled_drop.SYSTEM_CRAFTER, self);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("cleani"))
|
|
{
|
|
obj_id inv = utils.getInventoryContainer(self);
|
|
|
|
obj_id [] contents = getContents(inv);
|
|
|
|
for(int i = 0, j = contents.length; i < j; i++)
|
|
{
|
|
if(!isIdValid(contents[i]))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
string temp = "" + contents[i];
|
|
int k = Integer.parseInt(temp);
|
|
|
|
if(k > 11000000)
|
|
{
|
|
destroyObject(contents[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("setup"))
|
|
{
|
|
obj_id building = getTopMostContainer(self);
|
|
setObjVar(building, "tester", self);
|
|
messageTo(building, "setupArea", null, 0, false);
|
|
}
|
|
if(strCommands[0].equalsIgnoreCase("start"))
|
|
{
|
|
obj_id building = getTopMostContainer(self);
|
|
setObjVar(building, "tester", self);
|
|
messageTo(building, "startEncounter", null, 0, false);
|
|
}
|
|
if(strCommands[0].equalsIgnoreCase("end"))
|
|
{
|
|
obj_id building = getTopMostContainer(self);
|
|
messageTo(building, "endEncounter", null, 0, false);
|
|
}
|
|
if(strCommands[0].equalsIgnoreCase("cleanup"))
|
|
{
|
|
obj_id building = getTopMostContainer(self);
|
|
messageTo(building, "cleanUpArea", null, 0, false);
|
|
}
|
|
|
|
if(strCommands[0]=="cleanUpYo")
|
|
{
|
|
sendSystemMessageTestingOnly(self, "Cleaning up encounters....");
|
|
obj_id[] objectsInRange = getObjectsInRange(getLocation(self), 200.0f);
|
|
for (int i = 0; i < objectsInRange.length; i++)
|
|
{
|
|
if(hasObjVar(objectsInRange[i], "grievous_encounter.active"))
|
|
{
|
|
obj_id powerCell = objectsInRange[i];
|
|
destroyObject(powerCell);
|
|
}
|
|
}
|
|
}
|
|
|
|
if(strCommands[0]=="checkPermissions")
|
|
{
|
|
obj_id dungeon = getTopMostContainer(self);
|
|
string cellName = strCommands[1];
|
|
|
|
obj_id cell = getCellId(dungeon, cellName);
|
|
|
|
sendSystemMessageTestingOnly(self, "Cell " + cell + " is public: " + permissionsIsPublic(cell));
|
|
|
|
}
|
|
|
|
if(strCommands[0] == "exp")
|
|
{
|
|
location here = getLocation(self);
|
|
|
|
obj_id room = here.cell;
|
|
obj_id top = getTopMostContainer(self);
|
|
|
|
string roomName = getCellName(room);
|
|
|
|
string table = "datatables/pvp/pvp_battlefield_building_bunker.tab";
|
|
|
|
dictionary dctRow = new dictionary();
|
|
|
|
string num = "";
|
|
|
|
if(strCommands.length > 1)
|
|
{
|
|
num = strCommands[1];
|
|
}
|
|
|
|
dctRow.put("name", "explosion" + num);
|
|
dctRow.put("loc_x", here.x);
|
|
dctRow.put("loc_y", here.y);
|
|
dctRow.put("loc_z", here.z);
|
|
dctRow.put("room", roomName);
|
|
dctRow.put("delay", 1.0f);
|
|
|
|
datatable.serverDataTableAddRow(table, dctRow);
|
|
|
|
sendSystemMessageTestingOnly(self, "Explosion added: " + here);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0]=="schematicTest")
|
|
{
|
|
grantSchematic(self, "object/draft_schematic/weapon/knife_naktra_crystal_false.iff");
|
|
}
|
|
|
|
if(strCommands[0]=="prtTest")
|
|
{
|
|
playClientEffectObj(self, "appearance/pt_grievious_powerup.prt", self, "");
|
|
}
|
|
|
|
if(strCommands[0]=="damageYou")
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
setHitpoints(target, 1);
|
|
}
|
|
|
|
if(strCommands[0]=="scene")
|
|
{
|
|
string scene = getCurrentSceneName();
|
|
debugSpeakMsg(self, "Scene is " + scene);
|
|
}
|
|
|
|
if(strCommands[0]=="id")
|
|
{
|
|
obj_id objPlayerShip = getPilotedShip(self);
|
|
debugSpeakMsg(self, "My ID is " + self + " and my inventory is " + utils.getInventoryContainer(self));
|
|
debugSpeakMsg(self, "Furthermore, my ship ID is " + objPlayerShip);
|
|
}
|
|
|
|
if(strCommands[0]=="cargoHoldYes")
|
|
{
|
|
obj_id objShip = getPilotedShip(self);
|
|
//sendSystemMessageTestingOnly(self, "Bool cargo hold: " + isShipSlotInstalled(objShip, ship_component_type.SCST_cargo_hold));
|
|
}
|
|
|
|
if(strCommands[0]=="clearCargo")
|
|
{
|
|
obj_id objPlayerShip = getPilotedShip(self);
|
|
|
|
obj_id objs[] = getShipCargoHoldContentsResourceTypes(objPlayerShip);
|
|
int amounts[] = getShipCargoHoldContentsAmounts(objPlayerShip);
|
|
|
|
for (int i = 0; i < objs.length; i++)
|
|
{
|
|
setShipCargoHoldContent(objPlayerShip, objs[i], 0);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
if(strCommands[0]=="cargoCheck")
|
|
{
|
|
obj_id objPlayerShip = getPilotedShip(self);
|
|
int contents = getShipCargoHoldContentsCurrent(objPlayerShip);
|
|
int max = getShipCargoHoldContentsMaximum(objPlayerShip);
|
|
sendSystemMessageTestingOnly(self, "CARGO: " + contents + " / " + max);
|
|
}
|
|
|
|
if(strCommands[0]=="stopRunning")
|
|
{
|
|
setLocomotion(self, 0);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("yt2400"))
|
|
{
|
|
debugSpeakMsg(self, " getting on board!" );
|
|
obj_id objShip = getLookAtTarget(self);
|
|
if(!isIdValid(objShip))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "No look at target");
|
|
return SCRIPT_CONTINUE;
|
|
|
|
}
|
|
obj_id[] objCells = getContents(objShip);
|
|
|
|
if((objCells==null)||(objCells.length==0))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "ship doesn't have an interior");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id objCell = objCells[0];
|
|
location locTest = new location();
|
|
locTest.cell = objCell;
|
|
setLocation(self, locTest);
|
|
}
|
|
|
|
if(strCommands[0].equalsIgnoreCase("leave"))
|
|
{
|
|
location locTest = new location();
|
|
locTest.area = "tatooine";
|
|
setLocation(self, locTest);
|
|
}
|
|
|
|
if(strCommands[0]=="nukeAll")
|
|
{
|
|
obj_id[] objTestObjects = getObjectsInRange(self, 1000);
|
|
if(objTestObjects!=null)
|
|
{
|
|
for(int intI = 0; intI < objTestObjects.length; intI++)
|
|
{
|
|
destroyObject(objTestObjects[intI]);
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0]=="loco")
|
|
{
|
|
int loco = getLocomotion(self);
|
|
sendSystemMessageTestingOnly(self, "Locomotion state = " + loco);
|
|
}
|
|
|
|
// Move to a cell in a pob in space. It will not reposition your XYZ coordinates, though.
|
|
if(strCommands[0]=="cellx")
|
|
{
|
|
obj_id objShip = getTopMostContainer(self);
|
|
obj_id[] objCells = getContents(objShip);
|
|
obj_id objCell = objCells[rand(0, objCells.length)];
|
|
|
|
if(strCommands.length == 2)
|
|
{
|
|
for(int i = 0; i < objCells.length; i++)
|
|
{
|
|
string cellName = getCellName(objCells[i]);
|
|
|
|
if(cellName.equals(strCommands[1]))
|
|
{
|
|
objCell = objCells[i];
|
|
}
|
|
}
|
|
}
|
|
|
|
location locTest = new location();
|
|
locTest.cell = objCell;
|
|
setLocation(self, locTest);
|
|
}
|
|
|
|
if(strCommands[0]=="bridgeMe")
|
|
{
|
|
obj_id objShip = getLookAtTarget(self);
|
|
|
|
if(!isIdValid(objShip))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "No look at target");
|
|
return SCRIPT_CONTINUE;
|
|
|
|
}
|
|
|
|
obj_id[] objCells = getContents(objShip);
|
|
|
|
obj_id objCell = objCells[13];
|
|
location locTest = new location();
|
|
locTest.cell = objCell;
|
|
setLocation(self, locTest);
|
|
}
|
|
|
|
if(strCommands[0]=="makeTutorial")
|
|
{
|
|
|
|
location locTest = getLocation(self);
|
|
locTest.z = locTest.z+250f;
|
|
obj_id[] objTestObjects = getAllObjectsWithTemplate(getLocation(self), 320000, "object/building/general/npe_hangar_1.iff");
|
|
obj_id objStation = null;
|
|
if((objTestObjects==null)||(objTestObjects.length==0))
|
|
{
|
|
objStation = createObject("object/building/general/npe_hangar_1.iff", getLocation(self));
|
|
persistObject(objStation);
|
|
}
|
|
else
|
|
{
|
|
objStation = objTestObjects[0];
|
|
}
|
|
obj_id[] objCells = getContents(objStation);
|
|
|
|
if((objCells==null)||(objCells.length==0))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "ship doesn't have an interior");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id objCell = objCells[0];
|
|
|
|
location locDestination = getGoodLocation (objStation, "hanger");
|
|
locDestination.x = -.5f;
|
|
locDestination.y = -3;
|
|
locDestination.z = -72.2f;
|
|
|
|
setLocation(self, locDestination);
|
|
sendSystemMessageTestingOnly(self, "station is " + objStation);
|
|
|
|
}
|
|
|
|
if(strCommands[0]=="loc")
|
|
{
|
|
location loc = getLocation(self);
|
|
sendSystemMessageTestingOnly(self, "X = " + loc.x + " Y = " + loc.y + "Z = " + loc.z + " AREA = " + loc.area + " CELL = " + loc.cell);
|
|
|
|
}
|
|
|
|
if(strCommands[0]=="teleport")
|
|
{
|
|
obj_id top = getTopMostContainer ( self );
|
|
string whereTo = strCommands[1];
|
|
location randomLoc = getGoodLocation (top, whereTo);
|
|
//location randomLoc = new location(0, 0, 0);
|
|
obj_id cell = getCellId (top, whereTo);
|
|
utils.warpPlayer (self, randomLoc);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0] == "beam")
|
|
{
|
|
obj_id objTarget = getTarget(self);
|
|
|
|
if(isIdValid(objTarget))
|
|
{
|
|
playClientEffectObj(self, "appearance/pt_ig88_electrify.prt", objTarget, "");
|
|
playClientEffectObj(objTarget, "appearance/pt_ig88_electrify_target.prt", self, "");
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0] == "rocket")
|
|
{
|
|
obj_id objTarget = getTarget(self);
|
|
|
|
if(isIdValid(objTarget))
|
|
{
|
|
queueCommand(self, ##"ig88_rocket_launch", objTarget, "", COMMAND_PRIORITY_DEFAULT);
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0] == "ig88")
|
|
{
|
|
location loc = new location(4260, 180, -3943);
|
|
utils.warpPlayer(self, loc);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0] == "teidsonfix")
|
|
{
|
|
int num_rows = dataTableGetNumRows("datatables/space_loot/ship_refire_fix/" + getClusterName() + "_ships.iff");
|
|
|
|
LOG("shipcontents", "Rows: " + num_rows);
|
|
|
|
for(int i = 0; i < num_rows; i++)
|
|
{
|
|
dictionary row = dataTableGetRow("datatables/space_loot/ship_refire_fix/" + getClusterName() + "_ships.iff", i);
|
|
|
|
if(row != null)
|
|
{
|
|
LOG("shipcontents", "Data: " + row.getString("id") + " / " + row.getInt("count"));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(strCommands[0] == "shipinfo")
|
|
{
|
|
obj_id[] scds = callable.getDatapadCallablesByType(self, callable.CALLABLE_TYPE_SHIP);
|
|
|
|
for(int i = 0; i < scds.length; i++)
|
|
{
|
|
if(isIdValid(scds[i]))
|
|
{
|
|
obj_id[] controlDeviceContents = getContents(scds[i]);
|
|
|
|
LOG("shipcontents", "Ship: " + controlDeviceContents[0]);
|
|
|
|
if(isIdValid(controlDeviceContents[0]))
|
|
{
|
|
int[] intRawSlots = getShipChassisSlots(controlDeviceContents[0]);
|
|
|
|
LOG("shipcontents", "Ship Control Device: " + getName(scds[i]) + " first content: " + getName(controlDeviceContents[0]) + " slots: " + intRawSlots.length + " chassisType: " + getShipChassisType(controlDeviceContents[0]));
|
|
|
|
for(int j = 0; j < intRawSlots.length; j++)
|
|
{
|
|
LOG("shipcontents", "" + getName(controlDeviceContents[0]) + " Slot: " + space_crafting.getShipComponentStringType(intRawSlots[j]));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(strCommands[0] == "shipplasma")
|
|
{
|
|
obj_id objShip = getPilotedShip(self);
|
|
|
|
if(!isIdValid(objShip))
|
|
{
|
|
objShip = getTopMostContainer(self);
|
|
|
|
if(!isIdValid(objShip))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
if(utils.hasScriptVar(objShip, "objPlasmaConduits"))
|
|
{
|
|
obj_id[] objPlasmaConduits = utils.getObjIdArrayScriptVar(objShip, "objPlasmaConduits");
|
|
|
|
sendSystemMessageTestingOnly(self, "objPlasmaCondiuts size: " + objPlasmaConduits.length);
|
|
|
|
for(int i = 0; i < objPlasmaConduits.length; i++)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "objPlasmaConduits[" + i + "]: " + objPlasmaConduits[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Play a flash particle effect on ship hardpoints
|
|
if(strCommands[0] == "shiphp")
|
|
{
|
|
obj_id objShip = getPilotedShip(self);
|
|
|
|
if(!isIdValid(objShip))
|
|
{
|
|
objShip = getTopMostContainer(self);
|
|
|
|
if(!isIdValid(objShip))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
|
|
if(strCommands[1] == null || strCommands[1].length() <= 0)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
playClientEffectObj(self, "appearance/pt_cmndo_flashbang.prt", objShip, strCommands[1]);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0]=="engineReadout")
|
|
{
|
|
|
|
string strDataTable = "datatables/ship/components/engine_balance_readout.tab";
|
|
string[] strHeaderTypes = { "f"};
|
|
string[] strHeaders = {"speed"};
|
|
|
|
boolean boolTest = datatable.createDataTable(strDataTable, strHeaders,strHeaderTypes);
|
|
|
|
if(!boolTest)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "No datatable made");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
dictionary dctRow = new dictionary(1);
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
{
|
|
float speed = space_crafting.getBellValue(58.8f, 0.1f);
|
|
dctRow.put("speed", speed);
|
|
datatable.serverDataTableAddRow(strDataTable,dctRow);
|
|
}
|
|
}
|
|
|
|
if(strCommands[0]=="topMostContainer")
|
|
{
|
|
debugSpeakMsg(self, "topmost is" + getTopMostContainer(self));
|
|
|
|
}
|
|
|
|
if(strCommands[0]=="fillInventory")
|
|
{
|
|
debugSpeakMsg(self, "AHH!");
|
|
for (int i = 0; i < 60; i++)
|
|
{
|
|
obj_id playerInv = utils.getInventoryContainer(self);
|
|
obj_id newComponent = create.object("object/tangible/ship/components/weapon/wpn_incom_light_blaster.iff", playerInv, false, false);
|
|
}
|
|
}
|
|
|
|
if(strCommands[0]=="noXp")
|
|
{
|
|
xp.grant(self, "shipwright", +23356);
|
|
}
|
|
|
|
if(strCommands[0]=="makeRebelPilot")
|
|
{
|
|
skill.grantSkill(self, "pilot_rebel_navy_novice");
|
|
skill.grantSkill(self, "pilot_rebel_navy_starships_01");
|
|
skill.grantSkill(self, "pilot_rebel_navy_starships_02");
|
|
skill.grantSkill(self, "pilot_rebel_navy_starships_03");
|
|
skill.grantSkill(self, "pilot_rebel_navy_starships_04");
|
|
skill.grantSkill(self, "pilot_rebel_navy_weapons_01");
|
|
skill.grantSkill(self, "pilot_rebel_navy_weapons_02");
|
|
skill.grantSkill(self, "pilot_rebel_navy_weapons_03");
|
|
skill.grantSkill(self, "pilot_rebel_navy_weapons_04");
|
|
skill.grantSkill(self, "pilot_rebel_navy_procedures_01");
|
|
skill.grantSkill(self, "pilot_rebel_navy_procedures_02");
|
|
skill.grantSkill(self, "pilot_rebel_navy_procedures_03");
|
|
skill.grantSkill(self, "pilot_rebel_navy_procedures_04");
|
|
skill.grantSkill(self, "pilot_rebel_navy_droid_01");
|
|
skill.grantSkill(self, "pilot_rebel_navy_droid_02");
|
|
skill.grantSkill(self, "pilot_rebel_navy_droid_03");
|
|
skill.grantSkill(self, "pilot_rebel_navy_droid_04");
|
|
skill.grantSkill(self, "pilot_rebel_navy_master");
|
|
|
|
}
|
|
|
|
if(strCommands[0]=="giveMeMass")
|
|
{
|
|
obj_id pcd[] = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
|
|
setChassisComponentMassMaximum(ship, 10000000.0f);
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0]=="colorShip")
|
|
{
|
|
obj_id pcd[] = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
if(isIdValid(ship))
|
|
{
|
|
string index = "/shared_owner/index_color_1";
|
|
sui.colorize(self, self, ship, index, "handleColorize");
|
|
|
|
string index2 = "/shared_owner/index_color_2";
|
|
sui.colorize(self, self, ship, index2, "handleColorize");
|
|
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(strCommands[0]=="stimpack")
|
|
{
|
|
obj_id playerInv = utils.getInventoryContainer(self);
|
|
obj_id newComponent = create.object("object/tangible/medicine/instant_stimpack/stimpack_a.iff", playerInv, false, false);
|
|
|
|
setObjVar(newComponent, "healing.power", 250);
|
|
setCount(newComponent, 5);
|
|
|
|
}
|
|
|
|
if(strCommands[0]=="hurtMyself")
|
|
{
|
|
int maxHealth = getMaxHealth(self);
|
|
int newHealth = maxHealth/2;
|
|
setHealth(self, newHealth);
|
|
}
|
|
|
|
if(strCommands[0]=="pattern0")
|
|
{
|
|
debugSpeakMsg(self, "Pattern 0");
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 0);
|
|
}
|
|
if(strCommands[0]=="pattern1")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 1);
|
|
}
|
|
if(strCommands[0]=="pattern2")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 2);
|
|
}
|
|
if(strCommands[0]=="pattern3")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 3);
|
|
}
|
|
if(strCommands[0]=="pattern4")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 4);
|
|
}
|
|
if(strCommands[0]=="pattern5")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 5);
|
|
}
|
|
if(strCommands[0]=="pattern6")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string index = "/shared_owner/index_texture_1";
|
|
hue.setRangedIntCustomVar(ship, index, 6);
|
|
}
|
|
if(strCommands[0]=="moveShip")
|
|
{
|
|
debugSpeakMsg(self, "Understood command");
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
location x = getLocation(self);
|
|
setLocation(ship, x);
|
|
|
|
debugSpeakMsg(self, "Ship ID = " + ship);
|
|
}
|
|
|
|
if(strCommands[0]=="unstickMe")
|
|
{
|
|
debugSpeakMsg(self, "Unsticking self.");
|
|
location x = getLocation(self);
|
|
x.x += -1;
|
|
x.y += -1;
|
|
x.z += -1;
|
|
setLocation(self, x);
|
|
}
|
|
|
|
if(strCommands[0]=="getShipId")
|
|
{
|
|
obj_id[] pcd = space_transition.findShipControlDevicesForPlayer(self);
|
|
obj_id ship = space_transition.getShipFromShipControlDevice(pcd[0]);
|
|
string chassis = getShipChassisType(ship);
|
|
debugSpeakMsg(self, "Ship ID = " + ship);
|
|
debugSpeakMsg(self, "Chassis = " + chassis);
|
|
}
|
|
|
|
if(strCommands[0]=="wwallaceValidateLoot")
|
|
{
|
|
string strDataTable = "datatables/ship/components/loot_validation.tab";
|
|
|
|
string[] strHeaderTypes = { "s","s","s"};
|
|
|
|
string[] strHeaders = {"objectTemplate","didItCreate","validStats"};
|
|
|
|
boolean boolTest = datatable.createDataTable(strDataTable, strHeaders,strHeaderTypes);
|
|
|
|
if(!boolTest)
|
|
{
|
|
sendSystemMessageTestingOnly(self, "No datatable made");
|
|
|
|
return SCRIPT_CONTINUE;
|
|
|
|
}
|
|
|
|
string[] strTables = new string[1];
|
|
|
|
|
|
strTables = new string[8];
|
|
|
|
strTables[0] = "armor";
|
|
strTables[1] = "booster";
|
|
strTables[2] = "capacitor";
|
|
strTables[3] = "droid_interface";
|
|
strTables[4] = "engine";
|
|
strTables[5] = "reactor";
|
|
strTables[6] = "shield";
|
|
strTables[7] = "weapon";
|
|
|
|
|
|
for(int intM = 0; intM < strTables.length; intM++)
|
|
{
|
|
debugSpeakMsg(self, "Now doing " + strTables[intM]);
|
|
string strFileName = "datatables/ship/components/"+strTables[intM]+".iff";
|
|
string[] strTemplates = dataTableGetStringColumn(strFileName, "strType");
|
|
for(int intI = 0; intI < strTemplates.length; intI++)
|
|
{
|
|
dictionary dctRow = new dictionary(2);
|
|
string created = "";
|
|
obj_id objTest = null;
|
|
try
|
|
{
|
|
objTest = createObject(strTemplates[intI], getLocation(self));
|
|
created = "yes";
|
|
}
|
|
catch(Throwable err)
|
|
{
|
|
LOG("space_error", "OBJECT "+strTemplates[intM]+" in "+strFileName+" does not create!!!");
|
|
created = "no";
|
|
}
|
|
|
|
destroyObject(objTest);
|
|
dctRow.put("objectTemplate", strTemplates[intI]);dctRow.put("didItCreate", created);
|
|
datatable.serverDataTableAddRow(strDataTable,dctRow);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
|
|
|
|
messageHandler handleColorize()
|
|
{
|
|
//utils.removeScriptVar(self, SCRIPTVAR_XWING_PID);
|
|
|
|
int bp = sui.getIntButtonPressed(params);
|
|
if( bp == sui.BP_CANCEL )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
obj_id player = sui.getPlayerId(params);
|
|
if( !isIdValid(player) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
string template = utils.getTemplateFilenameNoPath(self);
|
|
string index = "/shared_owner/index_color_1";
|
|
if( index != null && !index.equals("") && !index.equals("none") )
|
|
{
|
|
int idx = sui.getColorPickerIndex(params);
|
|
if( idx > -1 )
|
|
{
|
|
obj_id ship = getPilotedShip(player);
|
|
if(isIdValid(ship))
|
|
{
|
|
hue.setColor(ship, index, idx);
|
|
}
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler delayTeleport()
|
|
{
|
|
obj_id newbieHall = getObjIdObjVar(self, "newbieHallId");
|
|
location randomLoc = getGoodLocation (newbieHall, "r13");
|
|
utils.warpPlayer (self, randomLoc);
|
|
return SCRIPT_CONTINUE;
|
|
}
|