Implemented proper functionality for the quest party options GUI.

This commit is contained in:
luisc committed 2024-02-13 17:30:01 -06:00
1 parent 71a272a08b
commit 680fc98d51
5 files changed
+91 -23

No files matched your search

@@ -5,16 +5,17 @@ import net.minecraft.util.StatCollector;
import noppes.npcs.client.Client;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.constants.EnumPartyExchange;
import noppes.npcs.constants.EnumPartyRequirements;
import noppes.npcs.controllers.data.FactionOptions;
import noppes.npcs.controllers.data.PartyOptions;
import java.util.HashMap;
import java.util.Vector;
public class SubGuiNpcPartyOptions extends SubGuiInterface
public class SubGuiNpcPartyOptions extends SubGuiInterface implements ITextfieldListener
{
private final PartyOptions options;
private HashMap<String,Integer> data = new HashMap<>();
public SubGuiNpcPartyOptions(PartyOptions options)
{
@@ -29,16 +30,66 @@ public class SubGuiNpcPartyOptions extends SubGuiInterface
{
super.initGui();
//Allow party - T/F button
addButton(new GuiNpcButton(0, guiLeft + 90, guiTop + 10, 60, 20,
new String[]{"gui.no", "gui.yes"}, options.allowParty ? 1 : 0));
addLabel(new GuiNpcLabel(1, "party.allowParty", guiLeft + 10, guiTop + 17));
if (options.allowParty) {
//Party requirements - enum button
addButton(new GuiNpcButton(5, guiLeft + 110, guiTop + 35, 60, 20,
EnumPartyRequirements.values(), options.partyRequirements.ordinal()));
addLabel(new GuiNpcLabel(6, "party.partyRequirements", guiLeft + 10, guiTop + 42));
//Party rewards - enum button
addButton(new GuiNpcButton(10, guiLeft + 110, guiTop + 60, 60, 20,
EnumPartyExchange.values(), options.rewardControl.ordinal()));
addLabel(new GuiNpcLabel(11, "party.partyRewards", guiLeft + 10, guiTop + 67));
//Complete for - enum button
addButton(new GuiNpcButton(15, guiLeft + 110, guiTop + 85, 60, 20,
EnumPartyExchange.values(), options.completeFor.ordinal()));
addLabel(new GuiNpcLabel(16, "party.completeFor", guiLeft + 10, guiTop + 92));
//max party size - number field
GuiNpcTextField textField = new GuiNpcTextField(20, this, guiLeft + 110, guiTop + 110,
40, 20, String.valueOf(options.maxPartySize));
textField.integersOnly = true;
textField.setMinMaxDefault(1, Integer.MAX_VALUE, 4);
addTextField(textField);
addLabel(new GuiNpcLabel(20, "party.maxPartySize", guiLeft + 10, guiTop + 117));
}
addButton(new GuiNpcButton(66, guiLeft + 20, guiTop + 192, 90, 20, "gui.done"));
}
protected void actionPerformed(GuiButton guibutton)
{
int id = guibutton.id;
switch (id) {
case 0:
options.allowParty = !options.allowParty;
break;
case 5:
options.partyRequirements = EnumPartyRequirements.valueOf(guibutton.displayString);
break;
case 10:
options.rewardControl = EnumPartyExchange.valueOf(guibutton.displayString);
break;
case 15:
options.completeFor = EnumPartyExchange.valueOf(guibutton.displayString);
break;
case 66:
close();
break;
}
initGui();
}
if(id == 66)
{
close();
@Override
public void unFocused(GuiNpcTextField textfield) {
if (textfield.id == 20) {
options.maxPartySize = textfield.getInteger();
}
}
}