Files
dsrc/sku.0/sys.server/compiled/game/script/conversation/wod_first_sister.java
2021-10-06 06:37:39 -04:00

149 lines
6.1 KiB
Java

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.conversation;
import script.library.groundquests;
import script.library.utils;
public class wod_first_sister extends script.base_script {
public wod_first_sister() {
}
public static String c_stringFile = "conversation/wod_first_sister";
public boolean wod_first_sister_condition__defaultCondition(obj_id player, obj_id npc) throws InterruptedException {
return true;
}
public boolean wod_first_sister_condition_talkTaskActive(obj_id player, obj_id npc) throws InterruptedException {
return groundquests.isTaskActive(player, "wod_sister1", "killSister1");
}
public void wod_first_sister_action_sendSignalTPSister1(obj_id player, obj_id npc) throws InterruptedException {
groundquests.sendSignal(player, "wod_first_sister_aggro");
}
public void wod_first_sister_action_aggroSister(obj_id player, obj_id npc) throws InterruptedException {
setInvulnerable(npc, false);
startCombat(npc, player);
clearCondition(npc, CONDITION_CONVERSABLE);
}
public int wod_first_sister_handleBranch1(obj_id player, obj_id npc, string_id response) throws InterruptedException {
if (response.equals("s_8")) {
wod_first_sister_action_sendSignalTPSister1(player, npc);
if (wod_first_sister_condition__defaultCondition(player, npc)) {
wod_first_sister_action_aggroSister(player, npc);
string_id message = new string_id(c_stringFile, "s_10");
utils.removeScriptVar(player, "conversation.wod_first_sister.branchId");
npcEndConversationWithMessage(player, message);
return SCRIPT_CONTINUE;
}
}
return SCRIPT_CONTINUE;
}
public int OnInitialize(obj_id self) throws InterruptedException {
if ((!isTangible(self)) || (isPlayer(self))) {
detachScript(self, "conversation.wod_first_sister");
}
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.wod_first_sister");
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 (wod_first_sister_condition_talkTaskActive(player, npc)) {
string_id message = new string_id(c_stringFile, "s_6");
int numberOfResponses = 0;
boolean hasResponse = false;
boolean hasResponse0 = false;
if (wod_first_sister_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_8");
}
utils.setScriptVar(player, "conversation.wod_first_sister.branchId", 1);
npcStartConversation(player, npc, "wod_first_sister", message, responses);
} else {
chat.chat(npc, player, message);
}
return SCRIPT_CONTINUE;
}
if (wod_first_sister_condition__defaultCondition(player, npc)) {
string_id message = new string_id(c_stringFile, "s_9");
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("wod_first_sister")) {
return SCRIPT_CONTINUE;
}
obj_id npc = self;
int branchId = utils.getIntScriptVar(player, "conversation.wod_first_sister.branchId");
if (branchId == 1 && wod_first_sister_handleBranch1(player, npc, response) == SCRIPT_CONTINUE) {
return SCRIPT_CONTINUE;
}
chat.chat(npc, "Error: Fell through all branches and responses for OnNpcConversationResponse.");
utils.removeScriptVar(player, "conversation.wod_first_sister.branchId");
return SCRIPT_CONTINUE;
}
public int OnDeath(obj_id self, obj_id killer, obj_id corpseId) throws InterruptedException
{
final obj_id altar = utils.getObjIdScriptVar(self, "wod_altar");
if(isIdValid(altar) && exists(altar))
{
messageTo(altar, "firstSisterDeath", null, 0f, false);
}
return SCRIPT_CONTINUE;
}
}