mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-31 00:15:54 -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
212 lines
8.0 KiB
Java
Executable File
212 lines
8.0 KiB
Java
Executable File
package script.poi.rabidbeast;
|
|
|
|
import script.dictionary;
|
|
import script.library.*;
|
|
import script.obj_id;
|
|
import script.string_id;
|
|
|
|
import java.util.Vector;
|
|
|
|
public class mediator extends script.poi.base.scenario_actor
|
|
{
|
|
public mediator()
|
|
{
|
|
}
|
|
public static final String SCRIPT_CONVERSE = "npc.converse.npc_converse_menu";
|
|
public static final String LOG_NAME = "poiRabidBeast Mediator";
|
|
public static final int CONV_GREET = 0;
|
|
public static final int CONV_SAVED = 1;
|
|
public static final int CONV_HELP = 2;
|
|
public static final int CONV_NOHELP = 3;
|
|
public static final String agitateEmotes[] =
|
|
{
|
|
"scratch",
|
|
"yawn",
|
|
"fidget",
|
|
"cough"
|
|
};
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
attachScript(self, SCRIPT_CONVERSE);
|
|
messageTo(self, "doAgitation", null, rand(40, 60), true);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
attachScript(self, SCRIPT_CONVERSE);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnStartNpcConversation(obj_id self, obj_id speaker) throws InterruptedException
|
|
{
|
|
if (ai_lib.isInCombat(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id poiMaster = poi.getBaseObject(self);
|
|
if ((poiMaster == null) || (poiMaster == obj_id.NULL_ID))
|
|
{
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
String convo = scenario.getConvo();
|
|
if (convo.equals(""))
|
|
{
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
string_id msg = new string_id(convo, "a_greet");
|
|
Vector responses = new Vector();
|
|
responses.setSize(0);
|
|
if (scenario.isComplete())
|
|
{
|
|
int idx = rand(1, 4);
|
|
poi.quickSay(self, "m_chatter_" + idx);
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else if (hasObjVar(self, "attacked"))
|
|
{
|
|
int idx = rand(1, 2);
|
|
poi.quickSay(self, "m_help_" + idx);
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else if (hasObjVar(self, "rescued"))
|
|
{
|
|
if (scenario.hasKillCredit(poiMaster, "antagonist", speaker))
|
|
{
|
|
removeObjVar(self, "rescued");
|
|
msg = new string_id(convo, "m_thanks");
|
|
npcStartConversation(speaker, self, convo, msg, responses);
|
|
scenario.complete();
|
|
if (group.isGroupObject(speaker))
|
|
{
|
|
obj_id[] members = getGroupMemberIds(speaker);
|
|
if ((members == null) || (members.length == 0))
|
|
{
|
|
}
|
|
else
|
|
{
|
|
for (obj_id member : members) {
|
|
if (scenario.hasKillCredit(poiMaster, "antagonist", member)) {
|
|
if (!badge.hasBadge(member, "poi_rabidbeast")) {
|
|
badge.grantBadge(member, "poi_rabidbeast");
|
|
} else {
|
|
badge.notifyHasBadge(member, "poi_rabidbeast");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!badge.hasBadge(speaker, "poi_rabidbeast"))
|
|
{
|
|
badge.grantBadge(speaker, "poi_rabidbeast");
|
|
}
|
|
else
|
|
{
|
|
badge.notifyHasBadge(speaker, "poi_rabidbeast");
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
else if (scenario.hasKillCredit(poiMaster, "antagonists", self))
|
|
{
|
|
removeObjVar(self, "rescued");
|
|
msg = new string_id(convo, "m_ididallthework");
|
|
npcStartConversation(speaker, self, convo, msg, responses);
|
|
scenario.complete(poi.getBaseObject(self));
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
int idx = rand(1, 4);
|
|
poi.quickSay(self, "m_chatter_" + idx);
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
msg = new string_id(convo, "m_greet");
|
|
responses = utils.addElement(responses, new string_id(convo, "r_m_greet"));
|
|
npcStartConversation(speaker, self, convo, msg, responses);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnNpcConversationResponse(obj_id self, String convoName, obj_id speaker, string_id response) throws InterruptedException
|
|
{
|
|
if (ai_lib.isInCombat(self))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id poiMaster = poi.getBaseObject(self);
|
|
if ((poiMaster == null) || (poiMaster == obj_id.NULL_ID))
|
|
{
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
String convo = scenario.getConvo();
|
|
if (convo.equals(""))
|
|
{
|
|
npcEndConversation(speaker);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (!convoName.equals(convo))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
String aId = response.getAsciiId();
|
|
Vector responses = new Vector();
|
|
responses.setSize(0);
|
|
npcSetConversationResponses(speaker, responses);
|
|
switch (aId) {
|
|
case "r_m_greet":
|
|
npcSpeak(speaker, new string_id(convo, "m_studying"));
|
|
responses = utils.addElement(responses, new string_id(convo, "r_m_studying"));
|
|
npcSetConversationResponses(speaker, responses);
|
|
break;
|
|
case "r_m_studying":
|
|
npcSpeak(speaker, new string_id(convo, "m_thebeast"));
|
|
responses = utils.addElement(responses, new string_id(convo, "r_m_thebeast_help"));
|
|
responses = utils.addElement(responses, new string_id(convo, "r_m_thebeast_nohelp"));
|
|
npcSetConversationResponses(speaker, responses);
|
|
break;
|
|
case "r_m_thebeast_help": {
|
|
npcEndConversation(speaker);
|
|
poi.quickSay(self, "m_hereitcomes_help");
|
|
setObjVar(self, "attacked", true);
|
|
dictionary params = new dictionary();
|
|
params.put("target", speaker);
|
|
messageTo(poiMaster, "startAttack", params, 2, true);
|
|
break;
|
|
}
|
|
case "r_m_thebeast_nohelp": {
|
|
npcEndConversation(speaker);
|
|
poi.quickSay(self, "m_hereitcomes_nohelp");
|
|
setObjVar(self, "attacked", true);
|
|
dictionary params = new dictionary();
|
|
params.put("target", speaker);
|
|
messageTo(poiMaster, "startAttack", params, 2, true);
|
|
break;
|
|
}
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int doAgitation(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
if (rand(1, 5) == 3)
|
|
{
|
|
int whichsocial = rand(0, 3);
|
|
queueCommand(self, (1780871594), null, agitateEmotes[whichsocial], COMMAND_PRIORITY_DEFAULT);
|
|
}
|
|
messageTo(self, "doAgitation", null, rand(40, 60), true);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int allDead(obj_id self, dictionary params) throws InterruptedException
|
|
{
|
|
stop(self);
|
|
queueCommand(self, (1780871594), null, "peptalk", COMMAND_PRIORITY_DEFAULT);
|
|
messageTo(self, "resumeDefaultCalmBehavior", null, 3, false);
|
|
poi.quickSay(self, chat.CHAT_EXCLAIM, chat.MOOD_EXUBERANT, "m_wesurvived");
|
|
removeObjVar(self, "attacked");
|
|
setObjVar(self, "rescued", true);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|