mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-03 03:15:55 -04:00
who isn't sick of converting the freaking scripts? this negates the need
This commit is contained in:
@@ -0,0 +1,287 @@
|
||||
package script.conversation;
|
||||
|
||||
import script.*;
|
||||
import script.base_class.*;
|
||||
import script.combat_engine.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
import script.base_script;
|
||||
|
||||
import script.library.ai_lib;
|
||||
import script.library.chat;
|
||||
import script.library.jedi_trials;
|
||||
import script.library.utils;
|
||||
|
||||
public class padawan_architect_02 extends script.base_script
|
||||
{
|
||||
public padawan_architect_02()
|
||||
{
|
||||
}
|
||||
public static String c_stringFile = "conversation/padawan_architect_02";
|
||||
public boolean padawan_architect_02_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public boolean padawan_architect_02_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("architect"))
|
||||
{
|
||||
return !hasObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void padawan_architect_02_action_spokeToNpc(obj_id player, obj_id npc) throws InterruptedException
|
||||
{
|
||||
setObjVar(player, "jedi_trials.padawan_trials.temp.spokeToTarget_01", true);
|
||||
stopCombat(npc);
|
||||
setInvulnerable(npc, true);
|
||||
messageTo(player, "handleSetBeginLoc", null, 1, false);
|
||||
return;
|
||||
}
|
||||
public void padawan_architect_02_action_npcAttacks(obj_id player, obj_id npc) throws InterruptedException
|
||||
{
|
||||
dictionary webster = new dictionary();
|
||||
webster.put("player", player);
|
||||
messageTo(npc, "handleQuestStartAttack", webster, 1, false);
|
||||
return;
|
||||
}
|
||||
public int padawan_architect_02_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
||||
{
|
||||
if (response.equals("s_17f3f71f"))
|
||||
{
|
||||
if (padawan_architect_02_condition__defaultCondition(player, npc))
|
||||
{
|
||||
doAnimationAction(npc, "shake_head_no");
|
||||
string_id message = new string_id(c_stringFile, "s_a7079eee");
|
||||
int numberOfResponses = 0;
|
||||
boolean hasResponse = false;
|
||||
boolean hasResponse0 = false;
|
||||
if (padawan_architect_02_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_55ff5c74");
|
||||
}
|
||||
utils.setScriptVar(player, "conversation.padawan_architect_02.branchId", 2);
|
||||
npcSpeak(player, message);
|
||||
npcSetConversationResponses(player, responses);
|
||||
}
|
||||
else
|
||||
{
|
||||
utils.removeScriptVar(player, "conversation.padawan_architect_02.branchId");
|
||||
chat.chat(npc, player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
return SCRIPT_DEFAULT;
|
||||
}
|
||||
public int padawan_architect_02_handleBranch2(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
||||
{
|
||||
if (response.equals("s_55ff5c74"))
|
||||
{
|
||||
if (padawan_architect_02_condition__defaultCondition(player, npc))
|
||||
{
|
||||
doAnimationAction(npc, "wave_on_dismissing");
|
||||
string_id message = new string_id(c_stringFile, "s_d7cc9593");
|
||||
int numberOfResponses = 0;
|
||||
boolean hasResponse = false;
|
||||
boolean hasResponse0 = false;
|
||||
if (padawan_architect_02_condition__defaultCondition(player, npc))
|
||||
{
|
||||
++numberOfResponses;
|
||||
hasResponse = true;
|
||||
hasResponse0 = true;
|
||||
}
|
||||
boolean hasResponse1 = false;
|
||||
if (padawan_architect_02_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_5e71d8b7");
|
||||
}
|
||||
if (hasResponse1)
|
||||
{
|
||||
responses[responseIndex++] = new string_id(c_stringFile, "s_7280c4d8");
|
||||
}
|
||||
utils.setScriptVar(player, "conversation.padawan_architect_02.branchId", 3);
|
||||
npcSpeak(player, message);
|
||||
npcSetConversationResponses(player, responses);
|
||||
}
|
||||
else
|
||||
{
|
||||
utils.removeScriptVar(player, "conversation.padawan_architect_02.branchId");
|
||||
chat.chat(npc, player, message);
|
||||
npcEndConversation(player);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
return SCRIPT_DEFAULT;
|
||||
}
|
||||
public int padawan_architect_02_handleBranch3(obj_id player, obj_id npc, string_id response) throws InterruptedException
|
||||
{
|
||||
if (response.equals("s_5e71d8b7"))
|
||||
{
|
||||
doAnimationAction(player, "standing_placate");
|
||||
if (padawan_architect_02_condition__defaultCondition(player, npc))
|
||||
{
|
||||
doAnimationAction(npc, "nod_head_multiple");
|
||||
padawan_architect_02_action_spokeToNpc(player, npc);
|
||||
string_id message = new string_id(c_stringFile, "s_20c05fd8");
|
||||
utils.removeScriptVar(player, "conversation.padawan_architect_02.branchId");
|
||||
chat.chat(npc, player, message);
|
||||
npcEndConversation(player);
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
if (response.equals("s_7280c4d8"))
|
||||
{
|
||||
doAnimationAction(player, "point_accusingly");
|
||||
if (padawan_architect_02_condition__defaultCondition(player, npc))
|
||||
{
|
||||
doAnimationAction(npc, "threaten_combat");
|
||||
padawan_architect_02_action_npcAttacks(player, npc);
|
||||
string_id message = new string_id(c_stringFile, "s_56dcc3ba");
|
||||
utils.removeScriptVar(player, "conversation.padawan_architect_02.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_architect_02");
|
||||
}
|
||||
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
|
||||
{
|
||||
if (!isIncapacitated(self))
|
||||
{
|
||||
int menu = menuInfo.addRootMenu(menu_info_types.CONVERSE_START, null);
|
||||
menu_info_data menuInfoData = menuInfo.getMenuItemById(menu);
|
||||
menuInfoData.setServerNotify(false);
|
||||
setCondition(self, CONDITION_CONVERSABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
clearCondition(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_architect_02");
|
||||
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_architect_02_condition_isTrialPlayer(player, npc))
|
||||
{
|
||||
string_id message = new string_id(c_stringFile, "s_c8e2f57a");
|
||||
int numberOfResponses = 0;
|
||||
boolean hasResponse = false;
|
||||
boolean hasResponse0 = false;
|
||||
if (padawan_architect_02_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_17f3f71f");
|
||||
}
|
||||
utils.setScriptVar(player, "conversation.padawan_architect_02.branchId", 1);
|
||||
npcStartConversation(player, npc, "padawan_architect_02", message, responses);
|
||||
}
|
||||
else
|
||||
{
|
||||
chat.chat(npc, player, message);
|
||||
}
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (padawan_architect_02_condition__defaultCondition(player, npc))
|
||||
{
|
||||
string_id message = new string_id(c_stringFile, "s_26b9a00f");
|
||||
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_architect_02"))
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
obj_id npc = self;
|
||||
int branchId = utils.getIntScriptVar(player, "conversation.padawan_architect_02.branchId");
|
||||
if (branchId == 1 && padawan_architect_02_handleBranch1(player, npc, response) == SCRIPT_CONTINUE)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (branchId == 2 && padawan_architect_02_handleBranch2(player, npc, response) == SCRIPT_CONTINUE)
|
||||
{
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
if (branchId == 3 && padawan_architect_02_handleBranch3(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_architect_02.branchId");
|
||||
return SCRIPT_CONTINUE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user