Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/tatooine_espa_pilot.java
T
2018-06-07 00:32:29 +01:00

728 lines
31 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_espa_pilot extends script.base_script
{
public tatooine_espa_pilot()
{
}
public static String c_stringFile = "conversation/tatooine_espa_pilot";
public boolean tatooine_espa_pilot_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
{
return true;
}
public boolean tatooine_espa_pilot_condition_pilotOnTask(obj_id player, obj_id npc) throws InterruptedException
{
return (groundquests.isTaskActive(player, "quest/tatooine_espa_leg_work", "tat_espa_leg_work_e2") || groundquests.isTaskActive(player, "quest/tatooine_espa_leg_work_2", "tat_espa_leg_work_e2"));
}
public boolean tatooine_espa_pilot_condition_pilotPastTask(obj_id player, obj_id npc) throws InterruptedException
{
return (groundquests.hasCompletedQuest(player, "quest/tatooine_espa_leg_work") || groundquests.hasCompletedQuest(player, "quest/tatooine_espa_leg_work_2"));
}
public void tatooine_espa_pilot_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException
{
faceTo(npc, player);
}
public void tatooine_espa_pilot_action_signalPilotTask(obj_id player, obj_id npc) throws InterruptedException
{
groundquests.sendSignal(player, "tat_espa_leg_work_e2");
}
public int tatooine_espa_pilot_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_27"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_28");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_29");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 2);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_29"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_30");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_31");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 3);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_31"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_32");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_33");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 4);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_33"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_34");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_35");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 5);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_35"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_36");
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_17"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_19");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_21");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 8);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_21"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_24");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
boolean hasResponse1 = false;
if (tatooine_espa_pilot_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_26");
}
if (hasResponse1)
{
responses[responseIndex++] = new string_id(c_stringFile, "s_48");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 9);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch9(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_26"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_38");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_40");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 10);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
if (response.equals("s_48"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "laugh");
string_id message = new string_id(c_stringFile, "s_50");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_52");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 13);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_40"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_42");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_44");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 11);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_44"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
tatooine_espa_pilot_action_signalPilotTask(player, npc);
string_id message = new string_id(c_stringFile, "s_46");
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_52"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_54");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_espa_pilot.branchId", 14);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_56"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_58");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_60");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 15);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
}
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_60"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
tatooine_espa_pilot_action_signalPilotTask(player, npc);
string_id message = new string_id(c_stringFile, "s_62");
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int tatooine_espa_pilot_handleBranch17(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_66"))
{
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_68");
utils.removeScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
npcEndConversationWithMessage(player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int OnInitialize(obj_id self) throws InterruptedException
{
if ((!isMob(self)) || (isPlayer(self)))
{
detachScript(self, "conversation.tatooine_espa_pilot");
}
setCondition(self, CONDITION_CONVERSABLE);
setCondition(self, CONDITION_INTERESTING);
setInvulnerable(self, true);
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
return SCRIPT_CONTINUE;
}
public int OnAttach(obj_id self) throws InterruptedException
{
setCondition(self, CONDITION_CONVERSABLE);
setCondition(self, CONDITION_INTERESTING);
setInvulnerable(self, true);
ai_lib.setDefaultCalmBehavior(self, ai_lib.BEHAVIOR_SENTINEL);
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.tatooine_espa_pilot");
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_espa_pilot_condition_pilotPastTask(player, npc))
{
tatooine_espa_pilot_action_facePlayer(player, npc);
string_id message = new string_id(c_stringFile, "s_23");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_27");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 1);
npcStartConversation(player, npc, "tatooine_espa_pilot", message, responses);
}
else
{
chat.chat(npc, player, message);
}
return SCRIPT_CONTINUE;
}
if (tatooine_espa_pilot_condition_pilotOnTask(player, npc))
{
tatooine_espa_pilot_action_facePlayer(player, npc);
string_id message = new string_id(c_stringFile, "s_15");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_17");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 7);
npcStartConversation(player, npc, "tatooine_espa_pilot", message, responses);
}
else
{
chat.chat(npc, player, message);
}
return SCRIPT_CONTINUE;
}
if (tatooine_espa_pilot_condition__defaultCondition(player, npc))
{
tatooine_espa_pilot_action_facePlayer(player, npc);
string_id message = new string_id(c_stringFile, "s_64");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (tatooine_espa_pilot_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_66");
}
utils.setScriptVar(player, "conversation.tatooine_espa_pilot.branchId", 17);
npcStartConversation(player, npc, "tatooine_espa_pilot", 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_espa_pilot"))
{
return SCRIPT_CONTINUE;
}
obj_id npc = self;
int branchId = utils.getIntScriptVar(player, "conversation.tatooine_espa_pilot.branchId");
if (branchId == 1 && tatooine_espa_pilot_handleBranch1(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 2 && tatooine_espa_pilot_handleBranch2(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 3 && tatooine_espa_pilot_handleBranch3(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 4 && tatooine_espa_pilot_handleBranch4(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 5 && tatooine_espa_pilot_handleBranch5(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 7 && tatooine_espa_pilot_handleBranch7(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 8 && tatooine_espa_pilot_handleBranch8(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 9 && tatooine_espa_pilot_handleBranch9(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 10 && tatooine_espa_pilot_handleBranch10(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 11 && tatooine_espa_pilot_handleBranch11(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 13 && tatooine_espa_pilot_handleBranch13(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 14 && tatooine_espa_pilot_handleBranch14(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 15 && tatooine_espa_pilot_handleBranch15(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 17 && tatooine_espa_pilot_handleBranch17(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_espa_pilot.branchId");
return SCRIPT_CONTINUE;
}
}