mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Max Party Size Config | for Quests | Read / Write NBTs
This commit is contained in:
1 parent
6a5464155b
commit
ae1bd4ba38
3 files changed
+60
-2
No files matched your search
@@ -63,6 +63,9 @@ public class ConfigMain
|
||||
public static Property DatFormatProperty;
|
||||
public static boolean DatFormat = false;
|
||||
|
||||
public static Property DefaultMaxPartySizetProperty;
|
||||
public static int DefaultMaxPartySize = 4;
|
||||
|
||||
/**
|
||||
* General NPC Properties
|
||||
**/
|
||||
@@ -149,6 +152,9 @@ public class ConfigMain
|
||||
DatFormatProperty = config.get(GENERAL, "Dat Format for PlayerData", false, "You need to use '/kamkeel config playerdata' to convert existing playerdata to new format.");
|
||||
DatFormat = DatFormatProperty.getBoolean(false);
|
||||
|
||||
DefaultMaxPartySizetProperty = config.get(GENERAL, "Default Max Party Size", 4, "When creating a new Quest sets the default max party size");
|
||||
DefaultMaxPartySize = DefaultMaxPartySizetProperty.getInt(4);
|
||||
|
||||
// NPC
|
||||
NpcNavRangeProperty = config.get(NPC, "NPC Navigation Range", 32, "Navigation search range for NPCs. Not recommended to increase if you have a slow pc or on a server. Minimum of 16, maximum of 96.");
|
||||
NpcNavRange = NpcNavRangeProperty.getInt(32);
|
||||
|
||||
@@ -10,6 +10,7 @@ import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.handler.data.IQuestCategory;
|
||||
import noppes.npcs.api.handler.data.IQuestInterface;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestCompletion;
|
||||
import noppes.npcs.constants.EnumQuestRepeat;
|
||||
@@ -39,6 +40,7 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
public boolean allowParty = false;
|
||||
public byte partyRequirements = 0; // 0 - Only Party Leaders, 1 - Everyone
|
||||
public byte rewardControl = 0; // 0 - Only Party Leaders, 1 - Everyone
|
||||
public int maxPartySize = 4;
|
||||
|
||||
public QuestInterface questInterface = new QuestItem();
|
||||
|
||||
@@ -80,6 +82,29 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
factionOptions.readFromNBT(compound.getCompoundTag("QuestFactionPoints"));
|
||||
|
||||
mail.readNBT(compound.getCompoundTag("QuestMail"));
|
||||
|
||||
// Party Management
|
||||
allowParty = compound.getBoolean("AllowParty");
|
||||
if(allowParty){
|
||||
partyRequirements = compound.getByte("PartyRequirements");
|
||||
rewardControl = compound.getByte("RewardControl");
|
||||
maxPartySize = compound.getInteger("MaxPartySize");
|
||||
}
|
||||
else {
|
||||
if(compound.hasKey("PartyRequirements")){
|
||||
compound.removeTag("PartyRequirements");
|
||||
}
|
||||
if(compound.hasKey("RewardControl")){
|
||||
compound.removeTag("RewardControl");
|
||||
}
|
||||
if(compound.hasKey("MaxPartySize")){
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
|
||||
partyRequirements = 0;
|
||||
rewardControl = 0;
|
||||
maxPartySize = ConfigMain.DefaultMaxPartySize;
|
||||
}
|
||||
}
|
||||
|
||||
public void setType(EnumQuestType questType) {
|
||||
@@ -121,7 +146,24 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
this.questInterface.writeEntityToNBT(compound);
|
||||
compound.setTag("QuestFactionPoints", factionOptions.writeToNBT(new NBTTagCompound()));
|
||||
compound.setTag("QuestMail", mail.writeNBT());
|
||||
|
||||
|
||||
compound.setBoolean("AllowParty", allowParty);
|
||||
if(allowParty){
|
||||
compound.setByte("PartyRequirements", partyRequirements);
|
||||
compound.setByte("RewardControl", rewardControl);
|
||||
compound.setInteger("MaxPartySize", maxPartySize);
|
||||
}
|
||||
else {
|
||||
if(compound.hasKey("PartyRequirements")){
|
||||
compound.removeTag("PartyRequirements");
|
||||
}
|
||||
if(compound.hasKey("RewardControl")){
|
||||
compound.removeTag("RewardControl");
|
||||
}
|
||||
if(compound.hasKey("MaxPartySize")){
|
||||
compound.removeTag("MaxPartySize");
|
||||
}
|
||||
}
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -301,4 +343,14 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
public void setRewardControl(byte rewardControl) {
|
||||
this.rewardControl = rewardControl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPartySize() {
|
||||
return maxPartySize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxPartySize(int newSize) {
|
||||
maxPartySize = newSize;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user