mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
496 lines
22 KiB
Java
Executable File
496 lines
22 KiB
Java
Executable File
package script.conversation;
|
|
|
|
import script.library.ai_lib;
|
|
import script.library.chat;
|
|
import script.library.groundquests;
|
|
import script.library.utils;
|
|
import script.*;
|
|
|
|
public class tatooine_wald_customer extends script.base_script
|
|
{
|
|
public tatooine_wald_customer()
|
|
{
|
|
}
|
|
public static String c_stringFile = "conversation/tatooine_wald_customer";
|
|
public boolean tatooine_wald_customer_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return true;
|
|
}
|
|
public boolean tatooine_wald_customer_condition_task_2_3_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_task_two_and_three_complete_WFT");
|
|
}
|
|
public boolean tatooine_wald_customer_condition_task2_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_laserflits_DML");
|
|
}
|
|
public boolean tatooine_wald_customer_condition_del_swp_pts_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_deliver_swoop_parts_WFS");
|
|
}
|
|
public boolean tatooine_wald_customer_condition_task3_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return groundquests.isTaskActive(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_engineparts_WFS");
|
|
}
|
|
public boolean tatooine_wald_customer_condition_quest_complete(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return groundquests.hasCompletedTask(player, "tatooine_wald_firstquest", "tatooine_wald_firstquest_task_two_and_three_complete_WFT");
|
|
}
|
|
public void tatooine_wald_customer_action_send_signal_3(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
groundquests.sendSignal(player, "tatooine_wald_firstquest_engineparts_aquired");
|
|
}
|
|
public void tatooine_wald_customer_action_send_signal_2(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
groundquests.sendSignal(player, "tatooine_wald_firstquest_engineparts_aquired");
|
|
}
|
|
public void tatooine_wald_customer_action_send_signal_4(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
groundquests.sendSignal(player, "swoop_parts_delivered");
|
|
}
|
|
public int tatooine_wald_customer_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_11"))
|
|
{
|
|
doAnimationAction(player, "explain");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "nod");
|
|
string_id message = new string_id(c_stringFile, "s_14");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (tatooine_wald_customer_condition_del_swp_pts_active(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (tatooine_wald_customer_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_42");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_26");
|
|
}
|
|
utils.setScriptVar(player, "conversation.tatooine_wald_customer.branchId", 3);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_48"))
|
|
{
|
|
doAnimationAction(player, "explain");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "fakepunch");
|
|
doAnimationAction(player, "taken_aback");
|
|
tatooine_wald_customer_action_send_signal_2(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_50");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (tatooine_wald_customer_condition_del_swp_pts_active(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (tatooine_wald_customer_condition_task2_active(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_52");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_60");
|
|
}
|
|
utils.setScriptVar(player, "conversation.tatooine_wald_customer.branchId", 5);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_68"))
|
|
{
|
|
doAnimationAction(player, "dismiss");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "shrug_hands");
|
|
string_id message = new string_id(c_stringFile, "s_70");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int tatooine_wald_customer_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_42"))
|
|
{
|
|
doAnimationAction(player, "explain");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "strut");
|
|
doAnimationAction(player, "listen");
|
|
tatooine_wald_customer_action_send_signal_4(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_54");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (tatooine_wald_customer_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_56");
|
|
}
|
|
utils.setScriptVar(player, "conversation.tatooine_wald_customer.branchId", 6);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_26"))
|
|
{
|
|
doAnimationAction(player, "dismiss");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "thank");
|
|
string_id message = new string_id(c_stringFile, "s_28");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int tatooine_wald_customer_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_52"))
|
|
{
|
|
doAnimationAction(player, "explain");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "strut");
|
|
doAnimationAction(player, "listen");
|
|
tatooine_wald_customer_action_send_signal_4(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_54");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (tatooine_wald_customer_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_56");
|
|
}
|
|
utils.setScriptVar(player, "conversation.tatooine_wald_customer.branchId", 6);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_60"))
|
|
{
|
|
doAnimationAction(player, "shake_head_no");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "nod");
|
|
string_id message = new string_id(c_stringFile, "s_62");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int tatooine_wald_customer_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_56"))
|
|
{
|
|
doAnimationAction(player, "nod_head_once");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "wave2");
|
|
doAnimationAction(player, "salute2");
|
|
string_id message = new string_id(c_stringFile, "s_58");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int tatooine_wald_customer_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_36"))
|
|
{
|
|
doAnimationAction(player, "huh");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "explain");
|
|
string_id message = new string_id(c_stringFile, "s_38");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_44"))
|
|
{
|
|
doAnimationAction(player, "shake_head_no");
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "apologize");
|
|
string_id message = new string_id(c_stringFile, "s_46");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int OnInitialize(obj_id self) throws InterruptedException
|
|
{
|
|
if ((!isTangible(self)) || (isPlayer(self)))
|
|
{
|
|
detachScript(self, "conversation.tatooine_wald_customer");
|
|
}
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
setCondition(self, CONDITION_INTERESTING);
|
|
setInvulnerable(self, true);
|
|
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);
|
|
faceTo(self, player);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnIncapacitated(obj_id self, obj_id killer) throws InterruptedException
|
|
{
|
|
clearCondition(self, CONDITION_CONVERSABLE);
|
|
detachScript(self, "conversation.tatooine_wald_customer");
|
|
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 (tatooine_wald_customer_condition_quest_complete(player, npc))
|
|
{
|
|
doAnimationAction(npc, "thank");
|
|
string_id message = new string_id(c_stringFile, "s_4");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (tatooine_wald_customer_condition_task_2_3_active(player, npc))
|
|
{
|
|
doAnimationAction(npc, "greet");
|
|
string_id message = new string_id(c_stringFile, "s_7");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (tatooine_wald_customer_condition_del_swp_pts_active(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (tatooine_wald_customer_condition_task3_active(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
boolean hasResponse2 = false;
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse2 = true;
|
|
}
|
|
if (hasResponse)
|
|
{
|
|
int responseIndex = 0;
|
|
string_id responses[] = new string_id[numberOfResponses];
|
|
if (hasResponse0)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_11");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_48");
|
|
}
|
|
if (hasResponse2)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_68");
|
|
}
|
|
utils.setScriptVar(player, "conversation.tatooine_wald_customer.branchId", 2);
|
|
npcStartConversation(player, npc, "tatooine_wald_customer", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
doAnimationAction(npc, "check_wrist_device");
|
|
string_id message = new string_id(c_stringFile, "s_34");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (tatooine_wald_customer_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (tatooine_wald_customer_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_36");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_44");
|
|
}
|
|
utils.setScriptVar(player, "conversation.tatooine_wald_customer.branchId", 10);
|
|
npcStartConversation(player, npc, "tatooine_wald_customer", message, responses);
|
|
}
|
|
else
|
|
{
|
|
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("tatooine_wald_customer"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id npc = self;
|
|
int branchId = utils.getIntScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
if (branchId == 2 && tatooine_wald_customer_handleBranch2(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 3 && tatooine_wald_customer_handleBranch3(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 5 && tatooine_wald_customer_handleBranch5(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 6 && tatooine_wald_customer_handleBranch6(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 10 && tatooine_wald_customer_handleBranch10(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
utils.removeScriptVar(player, "conversation.tatooine_wald_customer.branchId");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|