mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
319 lines
13 KiB
Java
Executable File
319 lines
13 KiB
Java
Executable File
package script.conversation;
|
|
|
|
import script.library.ai_lib;
|
|
import script.library.chat;
|
|
import script.library.jedi_trials;
|
|
import script.library.utils;
|
|
import script.*;
|
|
|
|
public class padawan_architect_01 extends script.base_script
|
|
{
|
|
public padawan_architect_01()
|
|
{
|
|
}
|
|
public static String c_stringFile = "conversation/padawan_architect_01";
|
|
public boolean padawan_architect_01_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return true;
|
|
}
|
|
public boolean padawan_architect_01_condition_isTrialPlayer(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if (player == trialPlayer)
|
|
{
|
|
String trialName = jedi_trials.getJediTrialName(player);
|
|
if (trialName != null && trialName.equals("architect"))
|
|
{
|
|
return !hasObjVar(npc, "padawan_trials.playerFailed");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public boolean padawan_architect_01_condition_wasTargetEliminated(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if (player == trialPlayer)
|
|
{
|
|
return hasObjVar(player, "jedi_trials.padawan_trials.temp.killedTarget");
|
|
}
|
|
return false;
|
|
}
|
|
public boolean padawan_architect_01_condition_wasTargetSpokenTo(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if (player == trialPlayer)
|
|
{
|
|
if (hasObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01"))
|
|
{
|
|
if (!hasObjVar(player, "jedi_trials.padawan_trials.temp.killedTarget"))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public boolean padawan_architect_01_condition_isOnNextStep(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if (player == trialPlayer)
|
|
{
|
|
return hasObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask");
|
|
}
|
|
return false;
|
|
}
|
|
public boolean padawan_architect_01_condition_completedSuccess(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
obj_id trialPlayer = getObjIdObjVar(npc, jedi_trials.PADAWAN_TRIAL_PLAYER_OBJVAR);
|
|
if (player == trialPlayer)
|
|
{
|
|
String trialName = jedi_trials.getJediTrialName(player);
|
|
if (trialName != null && !trialName.equals("architect"))
|
|
{
|
|
return hasObjVar(npc, "padawan_trials.playerSucceeded");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public void padawan_architect_01_action_questFailure(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerFailed", true);
|
|
messageTo(player, "handleQuestFailure", null, 1, false);
|
|
return;
|
|
}
|
|
public void padawan_architect_01_action_questSuccess(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerSucceeded", true);
|
|
messageTo(player, "handleTrialComplete", null, 1, false);
|
|
return;
|
|
}
|
|
public void padawan_architect_01_action_sendToNextNpc(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
setObjVar(npc, "padawan_trials.playerAccepted", true);
|
|
setObjVar(player, "jedi_trials.padawan_trials.temp.acceptedTask", true);
|
|
messageTo(player, "handleSetSecondLoc", null, 1, false);
|
|
return;
|
|
}
|
|
public int padawan_architect_01_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_f0d9878f"))
|
|
{
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "laugh_cackle");
|
|
padawan_architect_01_action_questFailure(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_50bf04b1");
|
|
utils.removeScriptVar(player, "conversation.padawan_architect_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_88ac3394"))
|
|
{
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "shake_head_disgust");
|
|
padawan_architect_01_action_questSuccess(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_8bf180e7");
|
|
utils.removeScriptVar(player, "conversation.padawan_architect_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int padawan_architect_01_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_a1ef941b"))
|
|
{
|
|
doAnimationAction(player, "nod_head_once");
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "pose_proudly");
|
|
padawan_architect_01_action_sendToNextNpc(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_ea2c487d");
|
|
utils.removeScriptVar(player, "conversation.padawan_architect_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_cc9db25e"))
|
|
{
|
|
doAnimationAction(player, "slow_down");
|
|
padawan_architect_01_action_questFailure(player, npc);
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "wave_finger_warning");
|
|
padawan_architect_01_action_questFailure(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_f2d3daf1");
|
|
utils.removeScriptVar(player, "conversation.padawan_architect_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
if ((!isMob(self)) || (isPlayer(self)))
|
|
{
|
|
detachScript(self, "conversation.padawan_architect_01");
|
|
}
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnObjectMenuRequest(obj_id self, obj_id player, menu_info menuInfo) throws InterruptedException
|
|
{
|
|
int menu = menuInfo.addRootMenu(menu_info_types.CONVERSE_START, null);
|
|
menu_info_data menuInfoData = menuInfo.getMenuItemById(menu);
|
|
menuInfoData.setServerNotify(false);
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException
|
|
{
|
|
clearCondition(self, CONDITION_CONVERSABLE);
|
|
detachScript(self, "conversation.padawan_architect_01");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public boolean npcStartConversation(obj_id player, obj_id npc, String convoName, string_id greetingId, prose_package greetingProse, string_id[] responses) throws InterruptedException
|
|
{
|
|
Object[] objects = new Object[responses.length];
|
|
System.arraycopy(responses, 0, objects, 0, responses.length);
|
|
return npcStartConversation(player, npc, convoName, greetingId, greetingProse, objects);
|
|
}
|
|
public int OnStartNpcConversation(obj_id self, obj_id player) throws InterruptedException
|
|
{
|
|
obj_id npc = self;
|
|
if (ai_lib.isInCombat(npc) || ai_lib.isInCombat(player))
|
|
{
|
|
return SCRIPT_OVERRIDE;
|
|
}
|
|
if (padawan_architect_01_condition_completedSuccess(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_ac5709b0");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_architect_01_condition_isOnNextStep(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_91e6aa00");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_architect_01_condition_wasTargetEliminated(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (padawan_architect_01_condition_wasTargetSpokenTo(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses[] = new string_id[numberOfResponses];
|
|
if (hasResponse0)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_f0d9878f");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_88ac3394");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_architect_01.branchId", 2);
|
|
npcStartConversation(player, npc, "padawan_architect_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_architect_01_condition_isTrialPlayer(player, npc))
|
|
{
|
|
doAnimationAction(npc, "beckon");
|
|
string_id message = new string_id(c_stringFile, "s_7637308a");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses[] = new string_id[numberOfResponses];
|
|
if (hasResponse0)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_a1ef941b");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_cc9db25e");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_architect_01.branchId", 5);
|
|
npcStartConversation(player, npc, "padawan_architect_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_architect_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "check_wrist_device");
|
|
string_id message = new string_id(c_stringFile, "s_25d34a1e");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
chat.chat(npc, "Error: All conditions for OnStartNpcConversation were false.");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnNpcConversationResponse(obj_id self, String conversationId, obj_id player, string_id response) throws InterruptedException
|
|
{
|
|
if (!conversationId.equals("padawan_architect_01"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id npc = self;
|
|
int branchId = utils.getIntScriptVar(player, "conversation.padawan_architect_01.branchId");
|
|
if (branchId == 2 && padawan_architect_01_handleBranch2(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 5 && padawan_architect_01_handleBranch5(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
utils.removeScriptVar(player, "conversation.padawan_architect_01.branchId");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|