mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 06:52:21 +00:00
Quest Manual + Quest Objective Command
Quest Manual allows you to add manual quests that can only be completed via script or command. The command will essentially call the .setProgress or .setPlayerProgress (if the player is within a party) to set the progress for the objectives.
This commit is contained in:
1 parent
e56efadca2
commit
39d2b9227d
14 files changed
+773
-19
No files matched your search
@@ -392,7 +392,79 @@ public class QuestDialog extends QuestInterface implements IQuestDialog {
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxProgress() {
|
||||
@Override
|
||||
public void setPlayerProgress(String playerName, int progress) {
|
||||
if (progress >= 0 && progress <= 1) {
|
||||
EntityPlayer foundplayer = NoppesUtilServer.getPlayerByName(playerName);
|
||||
if(foundplayer != null && party == null){
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(foundplayer);
|
||||
boolean completed = data.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
data.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[1]);
|
||||
data.updateClient = true;
|
||||
data.save();
|
||||
}
|
||||
|
||||
if (progress == 1 && !completed) {
|
||||
data.dialogData.dialogsRead.add(this.dialog.id);
|
||||
data.questData.checkQuestCompletion(data, EnumQuestType.values()[1]);
|
||||
data.updateClient = true;
|
||||
data.save();
|
||||
}
|
||||
} else if (foundplayer != null){
|
||||
if(party.getObjectiveRequirement() != null){
|
||||
EnumPartyObjectives objectives = party.getObjectiveRequirement();
|
||||
if(objectives == EnumPartyObjectives.Leader){
|
||||
EntityPlayer leaderPlayer = NoppesUtilServer.getPlayer(party.getLeaderUUID());
|
||||
PlayerData leaderData;
|
||||
if(leaderPlayer != null){
|
||||
leaderData = PlayerDataController.Instance.getPlayerData(leaderPlayer);
|
||||
}
|
||||
else {
|
||||
leaderData = PlayerDataController.Instance.getPlayerDataCache(party.getLeaderUUID().toString());
|
||||
}
|
||||
if(leaderData == null)
|
||||
return;
|
||||
|
||||
boolean completed = leaderData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
leaderData.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
PartyController.Instance().checkQuestCompletion(party, EnumQuestType.values()[1]);
|
||||
leaderData.updateClient = true;
|
||||
leaderData.save();
|
||||
}
|
||||
if (progress == 1 && !completed) {
|
||||
leaderData.dialogData.dialogsRead.add(this.dialog.id);
|
||||
PartyController.Instance().checkQuestCompletion(party, EnumQuestType.values()[1]);
|
||||
leaderData.updateClient = true;
|
||||
leaderData.save();
|
||||
}
|
||||
} else {
|
||||
PlayerData individualData = PlayerDataController.Instance.getPlayerData(foundplayer);
|
||||
if(individualData != null){
|
||||
boolean completed = individualData.dialogData.dialogsRead.contains(this.dialog.id);
|
||||
if (progress == 0 && completed) {
|
||||
individualData.dialogData.dialogsRead.remove(this.dialog.id);
|
||||
individualData.save();
|
||||
individualData.updateClient = true;
|
||||
}
|
||||
if (progress == 1 && !completed) {
|
||||
individualData.dialogData.dialogsRead.add(this.dialog.id);
|
||||
individualData.save();
|
||||
individualData.updateClient = true;
|
||||
}
|
||||
}
|
||||
PartyController.Instance().checkQuestCompletion(party, EnumQuestType.values()[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new CustomNPCsException("Progress has to be 0 or 1", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxProgress() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user