mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 21:35:10 +00:00
Party Options in Quest Log!
This commit is contained in:
1 parent
313eaf7eb5
commit
db7ae50f95
7 files changed
+62
-7
No files matched your search
@@ -22,6 +22,7 @@ public class QuestLogData {
|
||||
public HashMap<String,Vector<String>> questStatus = new HashMap<>();
|
||||
public HashMap<String,String> finish = new HashMap<>();
|
||||
public HashMap<String, Integer> partyQuests = new HashMap<>();
|
||||
public HashMap<String,Vector<String>> partyOptions = new HashMap<>();
|
||||
|
||||
public NBTTagCompound writeNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -32,6 +33,7 @@ public class QuestLogData {
|
||||
compound.setTag("QuestFinisher", NBTTags.nbtStringStringMap(finish));
|
||||
compound.setString("TrackedQuestID", trackedQuestKey);
|
||||
compound.setTag("PartyQuests", NBTTags.nbtStringIntegerMap(partyQuests));
|
||||
compound.setTag("PartyOptions", NBTTags.nbtVectorMap(partyOptions));
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -43,6 +45,7 @@ public class QuestLogData {
|
||||
finish = NBTTags.getStringStringMap(compound.getTagList("QuestFinisher", 10));
|
||||
trackedQuestKey = compound.getString("TrackedQuestID");
|
||||
partyQuests = NBTTags.getStringIntegerMap(compound.getTagList("PartyQuests", 10));
|
||||
partyOptions = NBTTags.getVectorMap(compound.getTagList("PartyOptions", 10));
|
||||
}
|
||||
public void setData(EntityPlayer player){
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
@@ -70,6 +73,7 @@ public class QuestLogData {
|
||||
|
||||
if (quest.partyOptions.allowParty) {
|
||||
partyQuests.put(key, quest.id);
|
||||
partyOptions.put(key, quest.partyOptions.getPartyOptionsList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,4 +101,8 @@ public class QuestLogData {
|
||||
public String getComplete() {
|
||||
return finish.get(selectedCategory + ":" + selectedQuest);
|
||||
}
|
||||
|
||||
public Vector<String> getPartyOptions() {
|
||||
return partyOptions.get(selectedCategory + ":" + selectedQuest);
|
||||
}
|
||||
}
|
||||
@@ -68,9 +68,6 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
List<String> categories = new ArrayList<String>();
|
||||
categories.addAll(data.categories.keySet());
|
||||
Collections.sort(categories,String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
addButton(new GuiNpcButton(100,guiLeft - 68, this.guiTop, 68,12, "UP"));
|
||||
|
||||
int i = 0;
|
||||
for(String category : categories){
|
||||
if(data.selectedCategory.isEmpty())
|
||||
@@ -95,7 +92,20 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
// Objectives Back--
|
||||
addButton(new GuiButtonNextPage(2, guiLeft + 144, guiTop + 176, false));
|
||||
|
||||
if (data.partyQuests.containsKey(data.selectedCategory + ":" + data.selectedQuest)) {
|
||||
boolean showParty = false;
|
||||
boolean showTrackAlerts = true;
|
||||
if(data.partyQuests.containsKey(data.selectedCategory + ":" + data.selectedQuest)){
|
||||
showParty = true;
|
||||
if(data.partyOptions.containsKey(data.selectedCategory + ":" + data.selectedQuest)){
|
||||
if(data.partyOptions.get(data.selectedCategory + ":" + data.selectedQuest).get(0).contains("only")){
|
||||
showTrackAlerts = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (showParty) {
|
||||
// Objectives Forward--
|
||||
addButton(new GuiButtonNextPage(11, guiLeft + 286, guiTop + 176, true));
|
||||
|
||||
@@ -132,6 +142,9 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
if (getButton(3) != null) {
|
||||
getButton(3).visible = getButton(4).visible;
|
||||
}
|
||||
|
||||
getButton(4).enabled = showTrackAlerts;
|
||||
getButton(5).enabled = showTrackAlerts;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,6 +271,7 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
fontRendererObj.drawString(title, guiLeft + 170, guiTop + 179, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
} else if (questPages == 0) {
|
||||
drawPartyOptions();
|
||||
String title = StatCollector.translateToLocal("quest.objectives");
|
||||
fontRendererObj.drawString(title, guiLeft + 284 - fontRendererObj.getStringWidth(title), guiTop + 179, CustomNpcResourceListener.DefaultTextColor);
|
||||
} else {
|
||||
@@ -307,6 +321,16 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
}
|
||||
}
|
||||
|
||||
private void drawPartyOptions() {
|
||||
int yoffset = guiTop + 22;
|
||||
for(String process : data.getPartyOptions()){
|
||||
List<String> parts = Arrays.asList(process.split(":"));
|
||||
String drawString = StatCollector.translateToLocal(parts.get(0)) + ": " + StatCollector.translateToLocal(parts.get(1));
|
||||
fontRendererObj.drawString("- " + drawString, guiLeft + 144, yoffset , CustomNpcResourceListener.DefaultTextColor);
|
||||
yoffset += 10;
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public enum EnumPartyExchange {
|
||||
Enrolled("party.enrolled"),
|
||||
Valid("party.valid");
|
||||
|
||||
final String name;
|
||||
public final String name;
|
||||
|
||||
EnumPartyExchange(String name){
|
||||
this.name = name;
|
||||
|
||||
@@ -7,7 +7,7 @@ public enum EnumPartyObjectives {
|
||||
All("party.all"),
|
||||
Leader("party.leader");
|
||||
|
||||
final String name;
|
||||
public final String name;
|
||||
|
||||
EnumPartyObjectives(String name){
|
||||
this.name = name;
|
||||
|
||||
@@ -7,7 +7,7 @@ public enum EnumPartyRequirements {
|
||||
All("party.all"),
|
||||
Valid("party.valid");
|
||||
|
||||
String name;
|
||||
public final String name;
|
||||
|
||||
EnumPartyRequirements(String name){
|
||||
this.name = name;
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.api.handler.data.IPartyOptions;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.constants.EnumPartyExchange;
|
||||
import noppes.npcs.constants.EnumPartyObjectives;
|
||||
import noppes.npcs.constants.EnumPartyRequirements;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class PartyOptions implements IPartyOptions {
|
||||
public boolean allowParty = false;
|
||||
@@ -229,4 +235,18 @@ public class PartyOptions implements IPartyOptions {
|
||||
|
||||
maxPartySize = newSize;
|
||||
}
|
||||
|
||||
public Vector<String> getPartyOptionsList() {
|
||||
Vector<String> vec = new Vector<String>();
|
||||
if(onlyParty){
|
||||
vec.add("party.only" + ":" + "gui.yes");
|
||||
}
|
||||
vec.add("party.partyRequirements" + ":" + partyRequirements.name);
|
||||
vec.add("quest.objectives" + ":" + objectiveRequirement.name);
|
||||
vec.add("party.completeFor" + ":" + completeFor.name);
|
||||
vec.add("quest.reward" + ":" + rewardControl.name);
|
||||
vec.add("party.minPartySize" + ":" + minPartySize);
|
||||
vec.add("party.maxPartySize" + ":" + maxPartySize);
|
||||
return vec;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user