mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
503 lines
21 KiB
Java
Executable File
503 lines
21 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_artist_01 extends script.base_script
|
|
{
|
|
public padawan_artist_01()
|
|
{
|
|
}
|
|
public static String c_stringFile = "conversation/padawan_artist_01";
|
|
public boolean padawan_artist_01_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return true;
|
|
}
|
|
public boolean padawan_artist_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("artist"))
|
|
{
|
|
return !hasObjVar(npc, "padawan_trials.playerFailed");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public boolean padawan_artist_01_condition_spokeToTarget(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.spokeToTarget_01");
|
|
}
|
|
return false;
|
|
}
|
|
public boolean padawan_artist_01_condition_acceptedQuest(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_artist_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("artist"))
|
|
{
|
|
return hasObjVar(npc, "padawan_trials.playerSucceeded");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public void padawan_artist_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_artist_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_artist_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_artist_01_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_705f9dd1"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_cc45360d");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses[] = new string_id[numberOfResponses];
|
|
if (hasResponse0)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_d21432e3");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_artist_01.branchId", 3);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_a2c41722"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "wave_on_dismissing");
|
|
padawan_artist_01_action_questSuccess(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_4f3396fb");
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int padawan_artist_01_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_d21432e3"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "rub_chin_thoughtful");
|
|
padawan_artist_01_action_questSuccess(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_ec321028");
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int padawan_artist_01_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_593d8ed6"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_78bd6c2");
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_a0e28661"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "refuse_offer_affection");
|
|
padawan_artist_01_action_questFailure(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_a95dd416");
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int padawan_artist_01_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_a51658ea"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_76f9d659");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses[] = new string_id[numberOfResponses];
|
|
if (hasResponse0)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_bdf1fbc8");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_artist_01.branchId", 10);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int padawan_artist_01_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_bdf1fbc8"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_5e1dfbcd");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (padawan_artist_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_f9a16624");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_81192d80");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_artist_01.branchId", 11);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int padawan_artist_01_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_f9a16624"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
padawan_artist_01_action_sendToNextNpc(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_8bed149");
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
chat.chat(npc, player, message);
|
|
npcEndConversation(player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_81192d80"))
|
|
{
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "shake_head_disgust");
|
|
padawan_artist_01_action_questFailure(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_a8a01106");
|
|
utils.removeScriptVar(player, "conversation.padawan_artist_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_artist_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_artist_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_artist_01_condition_completedSuccess(player, npc))
|
|
{
|
|
doAnimationAction(npc, "bow2");
|
|
string_id message = new string_id(c_stringFile, "s_35c6bce6");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_artist_01_condition_spokeToTarget(player, npc))
|
|
{
|
|
doAnimationAction(npc, "wave2");
|
|
string_id message = new string_id(c_stringFile, "s_aad1f131");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (padawan_artist_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_705f9dd1");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_a2c41722");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_artist_01.branchId", 2);
|
|
npcStartConversation(player, npc, "padawan_artist_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_artist_01_condition_acceptedQuest(player, npc))
|
|
{
|
|
doAnimationAction(npc, "greet");
|
|
string_id message = new string_id(c_stringFile, "s_a1ae198d");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (padawan_artist_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_593d8ed6");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_a0e28661");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_artist_01.branchId", 6);
|
|
npcStartConversation(player, npc, "padawan_artist_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_artist_01_condition_isTrialPlayer(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_c4960c85");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses[] = new string_id[numberOfResponses];
|
|
if (hasResponse0)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_a51658ea");
|
|
}
|
|
utils.setScriptVar(player, "conversation.padawan_artist_01.branchId", 9);
|
|
npcStartConversation(player, npc, "padawan_artist_01", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (padawan_artist_01_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "tap_foot");
|
|
string_id message = new string_id(c_stringFile, "s_28225432");
|
|
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_artist_01"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id npc = self;
|
|
int branchId = utils.getIntScriptVar(player, "conversation.padawan_artist_01.branchId");
|
|
if (branchId == 2 && padawan_artist_01_handleBranch2(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 3 && padawan_artist_01_handleBranch3(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 6 && padawan_artist_01_handleBranch6(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 9 && padawan_artist_01_handleBranch9(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 10 && padawan_artist_01_handleBranch10(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 11 && padawan_artist_01_handleBranch11(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_artist_01.branchId");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|