Files
dsrc/sku.0/sys.server/compiled/game/script/theme_park/warren/trooper.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

126 lines
4.1 KiB
Java
Executable File

package script.theme_park.warren;
import script.library.ai_lib;
import script.library.chat;
import script.library.utils;
import script.modifiable_float;
import script.obj_id;
import script.string_id;
public class trooper extends script.base_script
{
public trooper()
{
}
public static final String CONVO_FILE = "theme_park/warren/warren";
public static final String ALERT_VOLUME_NAME = "alertVolume";
public static final String ACTION_ALERT = "alert";
public static final String ACTION_THREATEN = "threaten";
public int OnAttach(obj_id self) throws InterruptedException
{
if (!hasObjVar(self, "ai.diction"))
{
setObjVar(self, "ai.diction", "military");
}
if (getConfigSetting("GameServer", "disableAITriggerVolumes") == null)
{
createTriggerVolume(ALERT_VOLUME_NAME, 15.0f, true);
}
setObjVar(self, "ai.rangedOnly", true);
if (!hasObjVar(self, "ai.grenadeType"))
{
setObjVar(self, "ai.grenadeType", "object/weapon/ranged/grenade/grenade_fragmentation");
}
return SCRIPT_CONTINUE;
}
public int OnTriggerVolumeEntered(obj_id self, String volumeName, obj_id breacher) throws InterruptedException
{
if (hasObjVar(breacher, "gm"))
{
return SCRIPT_CONTINUE;
}
if (ai_lib.isInCombat(self) || ai_lib.isInCombat(breacher))
{
return SCRIPT_CONTINUE;
}
if (breacher == self)
{
return SCRIPT_CONTINUE;
}
if (isIncapacitated(self) || ai_lib.isAiDead(breacher))
{
return SCRIPT_CONTINUE;
}
if (!isPlayer(breacher))
{
return SCRIPT_CONTINUE;
}
if (utils.hasScriptVar(breacher, "warren.flaggedImperial"))
{
return SCRIPT_CONTINUE;
}
if (volumeName.equals(ALERT_VOLUME_NAME) && !ai_lib.isInCombat(self))
{
if (rand(1, 10) == 1)
{
int yourGender = getGender(breacher);
if (yourGender == GENDER_MALE)
{
chat.chat(self, new string_id(CONVO_FILE, "trooper_greeting_m"));
}
else
{
chat.chat(self, new string_id(CONVO_FILE, "trooper_greeting_f"));
}
}
startCombat(self, breacher);
return SCRIPT_CONTINUE;
}
return SCRIPT_CONTINUE;
}
public int OnSawAttack(obj_id self, obj_id defender, obj_id[] attackers) throws InterruptedException
{
if (getConfigSetting("GameServer", "disableAICombat") != null)
{
setWantSawAttackTriggers(self, false);
return SCRIPT_OVERRIDE;
}
if (ai_lib.isAiDead(self) || isInvulnerable(self))
{
setWantSawAttackTriggers(self, false);
return SCRIPT_OVERRIDE;
}
if (ai_lib.isInCombat(self))
{
return SCRIPT_CONTINUE;
}
if (hasScript(defender, "theme_park.warren.trooper"))
{
startCombat(self, attackers[rand(0, attackers.length - 1)]);
return SCRIPT_CONTINUE;
}
for (obj_id attacker : attackers) {
if (hasScript(attacker, "theme_park.warren.trooper")) {
startCombat(self, defender);
return SCRIPT_OVERRIDE;
}
}
return SCRIPT_CONTINUE;
}
public int OnMoveMoving(obj_id self) throws InterruptedException
{
aiEquipPrimaryWeapon(self);
return SCRIPT_CONTINUE;
}
public int OnMovePathComplete(obj_id self) throws InterruptedException
{
aiEquipPrimaryWeapon(self);
return SCRIPT_CONTINUE;
}
public int OnLoiterWaiting(obj_id self, modifiable_float time) throws InterruptedException
{
aiEquipPrimaryWeapon(self);
return SCRIPT_CONTINUE;
}
}