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

418 lines
18 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_politician_01 extends script.base_script
{
public padawan_politician_01()
{
}
public static String c_stringFile = "conversation/padawan_politician_01";
public boolean padawan_politician_01_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
{
return true;
}
public boolean padawan_politician_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_politician_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("politician"))
{
return !hasObjVar(npc, "padawan_trials.playerFailed");
}
}
return false;
}
public boolean padawan_politician_01_condition_targetWasEliminated(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.killedTarget");
}
return false;
}
public boolean padawan_politician_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("politician"))
{
return hasObjVar(npc, "padawan_trials.playerSucceeded");
}
}
return false;
}
public void padawan_politician_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_politician_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_politician_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_politician_01_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_dc3b8fc5"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "applause_polite");
padawan_politician_01_action_questSuccess(player, npc);
string_id message = new string_id(c_stringFile, "s_4fc89968");
utils.removeScriptVar(player, "conversation.padawan_politician_01.branchId");
chat.chat(npc, player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int padawan_politician_01_handleBranch4(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_d30e03d9"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "nod_head_multiple");
string_id message = new string_id(c_stringFile, "s_e6b7fdc0");
utils.removeScriptVar(player, "conversation.padawan_politician_01.branchId");
chat.chat(npc, player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
}
if (response.equals("s_99bdf01"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "shake_head_no");
padawan_politician_01_action_questFailure(player, npc);
string_id message = new string_id(c_stringFile, "s_59b59b84");
utils.removeScriptVar(player, "conversation.padawan_politician_01.branchId");
chat.chat(npc, player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int padawan_politician_01_handleBranch7(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_60ba5013"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "explain");
string_id message = new string_id(c_stringFile, "s_10204c5e");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
boolean hasResponse1 = false;
if (padawan_politician_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_6299309e");
}
if (hasResponse1)
{
responses[responseIndex++] = new string_id(c_stringFile, "s_de8ec7cf");
}
utils.setScriptVar(player, "conversation.padawan_politician_01.branchId", 8);
npcSpeak(player, message);
npcSetConversationResponses(player, responses);
}
else
{
utils.removeScriptVar(player, "conversation.padawan_politician_01.branchId");
chat.chat(npc, player, message);
npcEndConversation(player);
}
return SCRIPT_CONTINUE;
}
}
if (response.equals("s_82367ff2"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "shake_head_no");
padawan_politician_01_action_questFailure(player, npc);
string_id message = new string_id(c_stringFile, "s_c61129a3");
utils.removeScriptVar(player, "conversation.padawan_politician_01.branchId");
chat.chat(npc, player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_DEFAULT;
}
public int padawan_politician_01_handleBranch8(obj_id player, obj_id npc, string_id response) throws InterruptedException
{
if (response.equals("s_6299309e"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "nod_head_multiple");
padawan_politician_01_action_sendToNextNpc(player, npc);
string_id message = new string_id(c_stringFile, "s_e01d17e1");
utils.removeScriptVar(player, "conversation.padawan_politician_01.branchId");
chat.chat(npc, player, message);
npcEndConversation(player);
return SCRIPT_CONTINUE;
}
}
if (response.equals("s_de8ec7cf"))
{
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
doAnimationAction(npc, "shake_head_no");
padawan_politician_01_action_questFailure(player, npc);
string_id message = new string_id(c_stringFile, "s_18");
utils.removeScriptVar(player, "conversation.padawan_politician_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_politician_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_politician_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_politician_01_condition_completedSuccess(player, npc))
{
doAnimationAction(npc, "pose_proudly");
string_id message = new string_id(c_stringFile, "s_dbf5765a");
chat.chat(npc, player, message);
return SCRIPT_CONTINUE;
}
if (padawan_politician_01_condition_targetWasEliminated(player, npc))
{
string_id message = new string_id(c_stringFile, "s_59b6aab3");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (padawan_politician_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_dc3b8fc5");
}
utils.setScriptVar(player, "conversation.padawan_politician_01.branchId", 2);
npcStartConversation(player, npc, "padawan_politician_01", message, responses);
}
else
{
chat.chat(npc, player, message);
}
return SCRIPT_CONTINUE;
}
if (padawan_politician_01_condition_acceptedQuest(player, npc))
{
string_id message = new string_id(c_stringFile, "s_4eb51131");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
boolean hasResponse1 = false;
if (padawan_politician_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_d30e03d9");
}
if (hasResponse1)
{
responses[responseIndex++] = new string_id(c_stringFile, "s_99bdf01");
}
utils.setScriptVar(player, "conversation.padawan_politician_01.branchId", 4);
npcStartConversation(player, npc, "padawan_politician_01", message, responses);
}
else
{
chat.chat(npc, player, message);
}
return SCRIPT_CONTINUE;
}
if (padawan_politician_01_condition_isTrialPlayer(player, npc))
{
doAnimationAction(npc, "wave1");
string_id message = new string_id(c_stringFile, "s_e16a4410");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
++numberOfResponses;
hasResponse = true;
hasResponse0 = true;
}
boolean hasResponse1 = false;
if (padawan_politician_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_60ba5013");
}
if (hasResponse1)
{
responses[responseIndex++] = new string_id(c_stringFile, "s_82367ff2");
}
utils.setScriptVar(player, "conversation.padawan_politician_01.branchId", 7);
npcStartConversation(player, npc, "padawan_politician_01", message, responses);
}
else
{
chat.chat(npc, player, message);
}
return SCRIPT_CONTINUE;
}
if (padawan_politician_01_condition__defaultCondition(player, npc))
{
string_id message = new string_id(c_stringFile, "s_badba8f2");
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_politician_01"))
{
return SCRIPT_CONTINUE;
}
obj_id npc = self;
int branchId = utils.getIntScriptVar(player, "conversation.padawan_politician_01.branchId");
if (branchId == 2 && padawan_politician_01_handleBranch2(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 4 && padawan_politician_01_handleBranch4(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 7 && padawan_politician_01_handleBranch7(player, npc, response) == SCRIPT_CONTINUE)
{
return SCRIPT_CONTINUE;
}
if (branchId == 8 && padawan_politician_01_handleBranch8(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_politician_01.branchId");
return SCRIPT_CONTINUE;
}
}