mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-13 22:01:04 -04:00
514 lines
20 KiB
Java
Executable File
514 lines
20 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 romo_vax extends script.base_script
|
|
{
|
|
public romo_vax()
|
|
{
|
|
}
|
|
public static String c_stringFile = "conversation/romo_vax";
|
|
public boolean romo_vax_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
return true;
|
|
}
|
|
public boolean romo_vax_condition_isOnBibsQuest(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "speakToRomo"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean romo_vax_condition_completedRomosQuest(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "returnToRomo"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean romo_vax_condition_gettingRomosDisks(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "getRomosDisks"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean romo_vax_condition_doneWithRomo(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.hasCompletedTask(player, "quest/jabba_bib_fortuna_v2", "getRomosDisks"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public boolean romo_vax_condition_doingRomosQuest(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
if (groundquests.isTaskActive(player, "quest/jabba_bib_fortuna_v2", "killingValariansForRomo"))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
public void romo_vax_action_grantRomoQuest(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
groundquests.sendSignal(player, "spokenToRomo");
|
|
}
|
|
public void romo_vax_action_sendBiddingSignal(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
faceTo(npc, player);
|
|
groundquests.sendSignal(player, "completedRomosQuest");
|
|
}
|
|
public void romo_vax_action_sendDiskSignal(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
faceTo(npc, player);
|
|
groundquests.sendSignal(player, "romosDisksReturned");
|
|
}
|
|
public void romo_vax_action_facePlayer(obj_id player, obj_id npc) throws InterruptedException
|
|
{
|
|
faceTo(npc, player);
|
|
}
|
|
public int romo_vax_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_21"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_24");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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_25");
|
|
}
|
|
utils.setScriptVar(player, "conversation.romo_vax.branchId", 4);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
if (response.equals("s_23"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_44");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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_45");
|
|
}
|
|
utils.setScriptVar(player, "conversation.romo_vax.branchId", 8);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int romo_vax_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_25"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_27");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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.romo_vax.branchId", 5);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int romo_vax_handleBranch5(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_29"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_31");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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.romo_vax.branchId", 6);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int romo_vax_handleBranch6(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_33"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_35");
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int romo_vax_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_45"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_24");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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_25");
|
|
}
|
|
utils.setScriptVar(player, "conversation.romo_vax.branchId", 4);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int romo_vax_handleBranch10(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_36"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
string_id message = new string_id(c_stringFile, "s_38");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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.romo_vax.branchId", 11);
|
|
npcSpeak(player, message);
|
|
npcSetConversationResponses(player, responses);
|
|
}
|
|
else
|
|
{
|
|
utils.removeScriptVar(player, "conversation.romo_vax.branchId");
|
|
npcEndConversationWithMessage(player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|
|
return SCRIPT_DEFAULT;
|
|
}
|
|
public int romo_vax_handleBranch11(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
|
{
|
|
if (response.equals("s_40"))
|
|
{
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
romo_vax_action_grantRomoQuest(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_42");
|
|
utils.removeScriptVar(player, "conversation.romo_vax.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.romo_vax");
|
|
}
|
|
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.romo_vax");
|
|
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 (romo_vax_condition_doneWithRomo(player, npc))
|
|
{
|
|
romo_vax_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_16");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (romo_vax_condition_gettingRomosDisks(player, npc))
|
|
{
|
|
romo_vax_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_10");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (romo_vax_condition_completedRomosQuest(player, npc))
|
|
{
|
|
romo_vax_action_sendBiddingSignal(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_7");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
++numberOfResponses;
|
|
hasResponse = true;
|
|
hasResponse0 = true;
|
|
}
|
|
boolean hasResponse1 = false;
|
|
if (romo_vax_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_21");
|
|
}
|
|
if (hasResponse1)
|
|
{
|
|
responses[responseIndex++] = new string_id(c_stringFile, "s_23");
|
|
}
|
|
utils.setScriptVar(player, "conversation.romo_vax.branchId", 3);
|
|
npcStartConversation(player, npc, "romo_vax", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (romo_vax_condition_doingRomosQuest(player, npc))
|
|
{
|
|
romo_vax_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_28");
|
|
chat.chat(npc, player, message);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (romo_vax_condition_isOnBibsQuest(player, npc))
|
|
{
|
|
romo_vax_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_32");
|
|
int numberOfResponses = 0;
|
|
boolean hasResponse = false;
|
|
boolean hasResponse0 = false;
|
|
if (romo_vax_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_36");
|
|
}
|
|
utils.setScriptVar(player, "conversation.romo_vax.branchId", 10);
|
|
npcStartConversation(player, npc, "romo_vax", message, responses);
|
|
}
|
|
else
|
|
{
|
|
chat.chat(npc, player, message);
|
|
}
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (romo_vax_condition__defaultCondition(player, npc))
|
|
{
|
|
romo_vax_action_facePlayer(player, npc);
|
|
string_id message = new string_id(c_stringFile, "s_46");
|
|
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("romo_vax"))
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
obj_id npc = self;
|
|
int branchId = utils.getIntScriptVar(player, "conversation.romo_vax.branchId");
|
|
if (branchId == 3 && romo_vax_handleBranch3(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 4 && romo_vax_handleBranch4(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 5 && romo_vax_handleBranch5(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 6 && romo_vax_handleBranch6(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 8 && romo_vax_handleBranch8(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 10 && romo_vax_handleBranch10(player, npc, response) == SCRIPT_CONTINUE)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
if (branchId == 11 && romo_vax_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.romo_vax.branchId");
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
}
|