mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
568 lines
23 KiB
Java
Executable File
568 lines
23 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 reelo_baruk extends script.base_script
|
|
{
|
|
public reelo_baruk()
|
|
{
|
|
}
|
|
public static String c_stringFile = "conversation/reelo_baruk";
|
|
public boolean reelo_baruk_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return true;
|
|
}
|
|
public boolean reelo_baruk_condition_completedReelosQuests(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.hasCompletedQuest(player, "quest/jabba_reelo_baruk"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_AlkharanQuest_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_reelo_baruk", "killAlkharanBandits"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_AlkharanQuest_finished(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.hasCompletedTask(player, "quest/jabba_reelo_baruk", "killAlkharanBandits"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_ValarianSoldiers_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_reelo_baruk", "killingValarians"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_ValariansSoldiers_finished(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.hasCompletedTask(player, "quest/jabba_reelo_baruk", "killingValarians"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_DebtCollection_active(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_reelo_baruk", "collectingDebts"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_DebtCollection_finished(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.hasCompletedTask(player, "quest/jabba_reelo_baruk", "collectingDebts"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean reelo_baruk_condition_reeloQuestActive(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return groundquests.isQuestActive(player, "quest/jabba_reelo_baruk");
|
|
}
|
|
public void reelo_baruk_action_grantReeloQuest(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
groundquests.grantQuest(player, "quest/jabba_reelo_baruk");
|
|
return;
|
|
}
|
|
public void reelo_baruk_action_sendDoneSignal(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
groundquests.sendSignal(player, "completelyFinished");
|
|
groundquests.grantQuest(player, "pointer_ree_yees");
|
|
faceTo(npc, player);
|
|
return;
|
|
}
|
|
public void reelo_baruk_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
public int reelo_baruk_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_51"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_53");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_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_55");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 7);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int reelo_baruk_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_55"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_57");
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int reelo_baruk_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_65"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_67");
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_69"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_71");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (reelo_baruk_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_73");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_75");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 12);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_100"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
reelo_baruk_action_grantReeloQuest(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_102");
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int reelo_baruk_handleBranch12(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_73"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
reelo_baruk_action_grantReeloQuest(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_102");
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_75"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_77");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_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_79");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 13);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int reelo_baruk_handleBranch13(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_79"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_81");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_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_83");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 14);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int reelo_baruk_handleBranch14(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_83"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_94");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_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_96");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 15);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int reelo_baruk_handleBranch15(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_96"))
|
|
{
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
reelo_baruk_action_grantReeloQuest(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_98");
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.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.reelo_baruk");
|
|
}
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
setCondition(self, CONDITION_INTERESTING);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
public int OnAttach(obj_id self) throws InterruptedException
|
|
{
|
|
setCondition(self, CONDITION_CONVERSABLE);
|
|
setCondition(self, CONDITION_INTERESTING);
|
|
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.reelo_baruk");
|
|
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 (reelo_baruk_condition_completedReelosQuests(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_4");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition_DebtCollection_finished(player, npc))
|
|
{
|
|
reelo_baruk_action_sendDoneSignal(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_44");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition_DebtCollection_active(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_35");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition_ValariansSoldiers_finished(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_34");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition_ValarianSoldiers_active(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_33");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition_AlkharanQuest_finished(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_29");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_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_51");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 6);
|
|
npcStartConversation(player, npc, "reelo_baruk", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition_AlkharanQuest_active(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_17");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
reelo_baruk_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_63");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (reelo_baruk_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse1 = true;
|
|
}
|
|
boolean hasResponse2 = false;
|
|
if (reelo_baruk_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_65");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_69");
|
|
}
|
|
if (hasResponse2)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_100");
|
|
}
|
|
utils.setScriptVar(player, "conversation.reelo_baruk.branchId", 10);
|
|
npcStartConversation(player, npc, "reelo_baruk", 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("reelo_baruk"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id npc = self;
|
|
int branchId = utils.getIntScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
if (branchId == 6 && reelo_baruk_handleBranch6(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 7 && reelo_baruk_handleBranch7(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 10 && reelo_baruk_handleBranch10(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 12 && reelo_baruk_handleBranch12(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 13 && reelo_baruk_handleBranch13(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 14 && reelo_baruk_handleBranch14(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 15 && reelo_baruk_handleBranch15(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
|
|
utils.removeScriptVar(player, "conversation.reelo_baruk.branchId");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|