mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Dialog Availability Command
This commit is contained in:
1 parent
c51db5e893
commit
5b7ae0615e
1 file changed
+78
-5
@@ -9,14 +9,13 @@ import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.constants.EnumAvailabilityDialog;
|
||||
import noppes.npcs.constants.EnumAvailabilityQuest;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.Quest;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
|
||||
public class DialogCommand extends CommandKamkeelBase {
|
||||
@@ -126,7 +125,7 @@ public class DialogCommand extends CommandKamkeelBase {
|
||||
|
||||
@SubCommand(
|
||||
desc = "Find dialog id number by its name",
|
||||
usage = "<dialog name>"
|
||||
usage = "<dialogName>"
|
||||
)
|
||||
public void id(ICommandSender sender, String args[]) throws CommandException {
|
||||
if(args.length == 0){
|
||||
@@ -147,4 +146,78 @@ public class DialogCommand extends CommandKamkeelBase {
|
||||
sendResult(sender, String.format("No Dialog found with name: \u00A7c'%s'", dialogName));
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand(
|
||||
desc = "List a dialogs availability options",
|
||||
usage = "<dialogId>"
|
||||
)
|
||||
public void availability(ICommandSender sender, String args[]) throws CommandException {
|
||||
if(args.length == 0){
|
||||
sendError(sender, "Please provide an id for the dialog");
|
||||
return;
|
||||
}
|
||||
|
||||
int diagid;
|
||||
try {
|
||||
diagid = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException ex) {
|
||||
sendError(sender, "DialogID must be an integer: " + args[1]);
|
||||
return;
|
||||
}
|
||||
Dialog dialog = DialogController.instance.dialogs.get(diagid);
|
||||
if(dialog == null){
|
||||
sendError(sender, "Unknown dialog id: " + args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
Availability avail = dialog.availability;
|
||||
if(avail != null){
|
||||
sendResult(sender, String.format("Availability Options for Dialog: \u00A7c%d", dialog.id));
|
||||
sendResult(sender, "--------------------");
|
||||
boolean diagFound = false;
|
||||
if(avail.dialogId != -1 && avail.dialogAvailable != EnumAvailabilityDialog.Always){
|
||||
sendResult(sender, String.format("%s Dialog: \u00A7c%d", avail.dialogAvailable.toString(), avail.dialogId));
|
||||
diagFound = true;
|
||||
}
|
||||
if(avail.dialog2Id != -1 && avail.dialog2Available != EnumAvailabilityDialog.Always){
|
||||
sendResult(sender, String.format("%s Dialog: \u00A7c%d", avail.dialog2Available.toString(), avail.dialog2Id));
|
||||
diagFound = true;
|
||||
}
|
||||
if(avail.dialog3Id != -1 && avail.dialog3Available != EnumAvailabilityDialog.Always){
|
||||
sendResult(sender, String.format("%s Dialog: \u00A7c%d", avail.dialog3Available.toString(), avail.dialog3Id));
|
||||
diagFound = true;
|
||||
}
|
||||
if(avail.dialog4Id != -1 && avail.dialog4Available != EnumAvailabilityDialog.Always){
|
||||
sendResult(sender, String.format("%s Dialog: \u00A7c%d", avail.dialog4Available.toString(), avail.dialog4Id));
|
||||
diagFound = true;
|
||||
}
|
||||
|
||||
if(!diagFound){
|
||||
sendResult(sender, "No Dialog Availability Options");
|
||||
}
|
||||
sendResult(sender, "--------------------");
|
||||
|
||||
boolean questFound = false;
|
||||
if(avail.questId != -1 && avail.questAvailable != EnumAvailabilityQuest.Always){
|
||||
sendResult(sender, String.format("%s Quest: \u00A7c%d", avail.questAvailable.toString(), avail.questId));
|
||||
questFound = true;
|
||||
}
|
||||
if(avail.quest2Id != -1 && avail.quest2Available != EnumAvailabilityQuest.Always){
|
||||
sendResult(sender, String.format("%s Quest: \u00A7c%d", avail.quest2Available.toString(), avail.quest2Id));
|
||||
questFound = true;
|
||||
}
|
||||
if(avail.quest3Id != -1 && avail.quest3Available != EnumAvailabilityQuest.Always){
|
||||
sendResult(sender, String.format("%s Quest: \u00A7c%d", avail.quest3Available.toString(), avail.quest3Id));
|
||||
questFound = true;
|
||||
}
|
||||
if(avail.quest4Id != -1 && avail.quest4Available != EnumAvailabilityQuest.Always){
|
||||
sendResult(sender, String.format("%s Quest: \u00A7c%d", avail.quest4Available.toString(), avail.quest4Id));
|
||||
questFound = true;
|
||||
}
|
||||
if(!questFound){
|
||||
sendResult(sender, "No Quest Availability Options");
|
||||
}
|
||||
sendResult(sender, "--------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user