Files
dsrc/sku.0/sys.server/compiled/game/script/ai/smuggler_buddy.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

130 lines
4.3 KiB
Java
Executable File

package script.ai;
import script.dictionary;
import script.library.*;
import script.obj_id;
import script.prose_package;
import script.string_id;
public class smuggler_buddy extends script.base_script
{
public smuggler_buddy()
{
}
public static final float BUDDY_DURATION = 62.0f;
public int OnAttach(obj_id self) throws InterruptedException
{
messageTo(self, "handleGreeting", null, 2.0f, false);
messageTo(self, "handleRunAway", null, BUDDY_DURATION, false);
setObjVar(self, "ai.pet", true);
return SCRIPT_CONTINUE;
}
public int OnExitedCombat(obj_id self) throws InterruptedException
{
if (utils.hasScriptVar(self, "runningaway"))
{
return SCRIPT_CONTINUE;
}
messageTo(self, "handleNewTarget", null, 2.0f, false);
return SCRIPT_CONTINUE;
}
public int handleGreeting(obj_id self, dictionary params) throws InterruptedException
{
obj_id master = getMaster(self);
if (isIdValid(master))
{
String name = getFirstName(master);
prose_package pp = new prose_package();
pp = prose.setStringId(pp, new string_id("combat_effects", "smuggler_buddy_greeting"));
pp = prose.setTU(pp, name);
chat.chat(self, master, chat.CHAT_SAY, null, chat.ChatFlag_targetGroupOnly, pp);
}
return SCRIPT_CONTINUE;
}
public int handleNewTarget(obj_id self, dictionary params) throws InterruptedException
{
obj_id master = getMaster(self);
if (isIdValid(master))
{
obj_id newTarget = getHateTarget(master);
if (isIdValid(newTarget))
{
startCombat(self, newTarget);
}
else
{
messageTo(self, "handleRunAway", null, 2.0f, false);
}
}
else
{
messageTo(self, "handleRunAway", null, 2.0f, false);
}
return SCRIPT_CONTINUE;
}
public int handleRunAway(obj_id self, dictionary params) throws InterruptedException
{
if (isDead(self))
{
messageTo(self, "handleCleanUp", null, 15.0f, false);
return SCRIPT_CONTINUE;
}
if (utils.hasScriptVar(self, "runningaway"))
{
return SCRIPT_CONTINUE;
}
obj_id master = getMaster(self);
if (isIdValid(master))
{
String name = getFirstName(master);
prose_package pp = new prose_package();
pp = prose.setStringId(pp, new string_id("combat_effects", "smuggler_buddy_goodbye"));
pp = prose.setTU(pp, name);
chat.chat(self, master, chat.CHAT_SAY, null, chat.ChatFlag_targetGroupOnly, pp);
}
stopCombat(self);
setMaster(self, null);
setInvulnerable(self, true);
if (isIdValid(master))
{
ai_lib.pathAwayFrom(self, master);
}
utils.setScriptVar(self, "runningaway", 1);
messageTo(self, "handleCleanUp", null, 15.0f, false);
return SCRIPT_CONTINUE;
}
public int handleCleanUp(obj_id self, dictionary params) throws InterruptedException
{
destroyObject(self);
return SCRIPT_CONTINUE;
}
public int OnIncapacitated(obj_id self, obj_id attacker) throws InterruptedException
{
obj_id weapon = getCurrentWeapon(self);
if (isIdValid(weapon) && !isDefaultWeapon(weapon))
{
destroyObject(weapon);
}
obj_id cInv = utils.getInventoryContainer(self);
if (isIdValid(cInv))
{
utils.emptyContainerExceptStorytellerLoot(cInv);
}
ai_lib.clearCombatData();
setObjVar(self, xp.VAR_LANDED_DEATHBLOW, attacker);
if (!kill(self))
{
obj_id[] haters = getHateList(self);
if (haters.length > 0)
{
for (obj_id hater : haters) {
removeHateTarget(hater, self);
}
}
destroyObject(self);
}
clearCondition(self, CONDITION_INTERESTING);
return SCRIPT_CONTINUE;
}
}