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
200 lines
7.8 KiB
Java
Executable File
200 lines
7.8 KiB
Java
Executable File
package script.systems.battlefield;
|
|
|
|
import script.library.battlefield;
|
|
import script.library.factions;
|
|
import script.library.utils;
|
|
import script.location;
|
|
import script.obj_id;
|
|
import script.region;
|
|
|
|
public class battlefield_utility extends script.base_script
|
|
{
|
|
public battlefield_utility()
|
|
{
|
|
}
|
|
public int OnSpeaking(obj_id self, String text) throws InterruptedException
|
|
{
|
|
location loc = getLocation(self);
|
|
if (text.startsWith("bfdestroy"))
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null)
|
|
{
|
|
loc = getLocation(target);
|
|
}
|
|
else
|
|
{
|
|
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
|
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
|
if (st.hasMoreTokens())
|
|
{
|
|
String target_str = st.nextToken();
|
|
LOG("LOG_CHANNEL", "target_str ->" + target_str);
|
|
target = utils.stringToObjId(target_str);
|
|
if (target != null)
|
|
{
|
|
loc = getLocation(target);
|
|
}
|
|
}
|
|
}
|
|
battlefield.destroyBattlefield(target);
|
|
}
|
|
if (text.startsWith("endbattle"))
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target == null || target == obj_id.NULL_ID)
|
|
{
|
|
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
|
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
|
if (st.hasMoreTokens())
|
|
{
|
|
String target_str = st.nextToken();
|
|
LOG("LOG_CHANNEL", "target_str ->" + target_str);
|
|
target = utils.stringToObjId(target_str);
|
|
}
|
|
}
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
battlefield.endBattlefield(target);
|
|
sendSystemMessageTestingOnly(self, "Battle ended.");
|
|
}
|
|
}
|
|
if (text.equals("battlefield"))
|
|
{
|
|
String area = getCurrentSceneName();
|
|
battlefield.createBattlefieldRegions(area);
|
|
sendSystemMessageTestingOnly(self, "Battlefields created.");
|
|
}
|
|
if (text.equals("destroyall"))
|
|
{
|
|
String area = getCurrentSceneName();
|
|
battlefield.destroyBattlefieldRegions(area);
|
|
sendSystemMessageTestingOnly(self, "Battlefields destroyed.");
|
|
}
|
|
if (text.startsWith("delta"))
|
|
{
|
|
obj_id target = obj_id.NULL_ID;
|
|
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
|
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
|
if (st.hasMoreTokens())
|
|
{
|
|
String target_str = st.nextToken();
|
|
LOG("LOG_CHANNEL", "target_str ->" + target_str);
|
|
target = utils.stringToObjId(target_str);
|
|
}
|
|
if (target == null)
|
|
{
|
|
target = getLookAtTarget(self);
|
|
}
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
location targ_loc = getLocation(target);
|
|
float delta_x = targ_loc.x - loc.x;
|
|
float delta_y = targ_loc.y - loc.y;
|
|
float delta_z = targ_loc.z - loc.z;
|
|
LOG("LOG_CHANNEL", "delta ->" + "(" + delta_x + ", " + delta_y + ", " + delta_z + ")");
|
|
sendSystemMessageTestingOnly(self, "(" + delta_x + ", " + delta_y + ", " + delta_z + ")");
|
|
}
|
|
}
|
|
if (text.equals("clearbattleobjs"))
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null && target != obj_id.NULL_ID)
|
|
{
|
|
if (hasObjVar(target, battlefield.VAR_BATTLEFIELD))
|
|
{
|
|
removeObjVar(target, battlefield.VAR_BATTLEFIELD);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (hasObjVar(self, battlefield.VAR_BATTLEFIELD))
|
|
{
|
|
removeObjVar(self, battlefield.VAR_BATTLEFIELD);
|
|
}
|
|
}
|
|
}
|
|
if (text.equals("nuke"))
|
|
{
|
|
obj_id[] objects = getObjectsInRange(loc, 20.0f);
|
|
for (obj_id object : objects) {
|
|
if (!isPlayer(object)) {
|
|
LOG("LOG_CHANNEL", "object deleted ->" + object);
|
|
destroyObject(object);
|
|
}
|
|
}
|
|
}
|
|
if (text.equals("meganuke"))
|
|
{
|
|
obj_id[] objects = getObjectsInRange(loc, 250.0f);
|
|
for (obj_id object : objects) {
|
|
if (!isPlayer(object)) {
|
|
LOG("LOG_CHANNEL", "object deleted ->" + object);
|
|
destroyObject(object);
|
|
}
|
|
}
|
|
}
|
|
if (text.equals("faction"))
|
|
{
|
|
obj_id target = getLookAtTarget(self);
|
|
if (target != null)
|
|
{
|
|
region bf = battlefield.getBattlefield(target);
|
|
int faction_id = pvpBattlefieldGetFaction(target, bf);
|
|
String faction = factions.getFactionNameByHashCode(faction_id);
|
|
sendSystemMessageTestingOnly(self, "faction ->" + faction);
|
|
factions.addFactionStanding(self, faction, 250.0f);
|
|
}
|
|
else
|
|
{
|
|
int faction_id = pvpGetAlignedFaction(self);
|
|
String faction = factions.getFactionNameByHashCode(faction_id);
|
|
sendSystemMessageTestingOnly(self, "faction ->" + faction);
|
|
factions.addFactionStanding(self, faction, 250.0f);
|
|
}
|
|
}
|
|
if (text.startsWith("warp"))
|
|
{
|
|
obj_id target = obj_id.NULL_ID;
|
|
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
|
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
|
if (st.hasMoreTokens())
|
|
{
|
|
String planet = st.nextToken();
|
|
LOG("LOG_CHANNEL", "planet ->" + planet);
|
|
float x = utils.stringToInt(st.nextToken());
|
|
float y = utils.stringToInt(st.nextToken());
|
|
float z = utils.stringToInt(st.nextToken());
|
|
LOG("LOG_CHANNEL", "loc ->" + x + "/" + y + "/" + z);
|
|
warpPlayer(self, planet, x, y, z, null, 0.0f, 0.0f, 0.0f);
|
|
}
|
|
}
|
|
if (text.equals("bfobject"))
|
|
{
|
|
region bf = battlefield.getBattlefield(self);
|
|
if (bf != null)
|
|
{
|
|
obj_id bf_object = battlefield.getMasterObjectFromRegion(bf);
|
|
sendSystemMessageTestingOnly(self, "bf_object ->" + bf_object);
|
|
}
|
|
}
|
|
if (text.startsWith("getposture"))
|
|
{
|
|
obj_id target = obj_id.NULL_ID;
|
|
java.util.StringTokenizer st = new java.util.StringTokenizer(text);
|
|
LOG("LOG_CHANNEL", "tokens -> " + st.countTokens() + " nextToken ->" + st.nextToken());
|
|
if (st.hasMoreTokens())
|
|
{
|
|
String target_str = st.nextToken();
|
|
LOG("LOG_CHANNEL", "target_str ->" + target_str);
|
|
target = utils.stringToObjId(target_str);
|
|
}
|
|
if (isIdValid(target))
|
|
{
|
|
sendSystemMessageTestingOnly(self, "posture ->" + getPosture(target));
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|