mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Implemented party quest dropping in the party GUI.
Made party button always visible in the quest log if a quest can be partied with. Added drawTextBlock() function to GuiNPCInterface.
This commit is contained in:
1 parent
1044269f5e
commit
f84b16b29a
4 files changed
+63
-48
No files matched your search
@@ -65,14 +65,10 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
//
|
||||
//create party button
|
||||
//
|
||||
GuiNpcButton createPartyButton = new GuiNpcButton(200, guiLeft + xSize/2 + 45, guiTop + ySize/2 + 20, "party.createParty");
|
||||
GuiNpcButton createPartyButton = new GuiNpcButton(200, guiLeft + xSize/2 + 40, guiTop + ySize/2 + 20, "party.createParty");
|
||||
createPartyButton.width = 100;
|
||||
this.addButton(createPartyButton);
|
||||
|
||||
this.addLabel(new GuiNpcLabel(201, "party.partyInfo1", guiLeft + xSize/2 + 30, guiTop + ySize/2 - 30));
|
||||
this.addLabel(new GuiNpcLabel(202, "party.partyInfo2", guiLeft + xSize/2 + 30, guiTop + ySize/2 - 20));
|
||||
this.addLabel(new GuiNpcLabel(203, "party.partyInfo3", guiLeft + xSize/2 + 30, guiTop + ySize/2 - 10));
|
||||
|
||||
//party invites list
|
||||
//
|
||||
GuiCustomScroll inviteScroll = new GuiCustomScroll(this, 210, false);
|
||||
@@ -112,12 +108,36 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
this.addScroll(playerScroll);
|
||||
|
||||
if (party.getIsLocked()) {
|
||||
addButton(new GuiButtonNextPage(400, guiLeft + 144, guiTop + 176, false));
|
||||
getButton(400).visible = this.showQuestText;
|
||||
addButton(new GuiButtonNextPage(401, guiLeft + 286, guiTop + 176, true));
|
||||
getButton(401).visible = !getButton(400).visible;
|
||||
int arrowButtonsY = guiTop + ySize - 8 - 20;
|
||||
|
||||
addButton(new GuiButtonNextPage(400, guiLeft + 144, arrowButtonsY, false));
|
||||
addLabel(new GuiNpcLabel(401, "quest.objectives", guiLeft + 168, getButton(400).yPosition + 3));
|
||||
getButton(400).visible = getLabel(401).enabled = this.showQuestText;
|
||||
|
||||
addButton(new GuiButtonNextPage(405, guiLeft + 286, arrowButtonsY, true));
|
||||
String textString = StatCollector.translateToLocal("gui.text");
|
||||
addLabel(new GuiNpcLabel(406, textString,
|
||||
guiLeft + 284 - fontRendererObj.getStringWidth(textString), getButton(405).yPosition + 3));
|
||||
getButton(405).visible = getLabel(406).enabled = !getButton(400).visible;
|
||||
|
||||
GuiNpcButton disbandButton = new GuiNpcButton(410, guiLeft + 164, arrowButtonsY + 19, "party.dropQuest");
|
||||
disbandButton.width = 135;
|
||||
this.addButton(disbandButton);
|
||||
}
|
||||
|
||||
//toggle friendly fire
|
||||
//
|
||||
GuiNpcLabel friendlyFireLabel = new GuiNpcLabel(321, StatCollector.translateToLocal("party.friendlyFire") + ":",
|
||||
guiLeft + xSize / 2 + 10, guiTop + ySize / 2 + 5);
|
||||
if (party.getIsLocked()) {
|
||||
friendlyFireLabel.x = guiLeft + 5;
|
||||
friendlyFireLabel.y = guiTop + ySize - 8 - 15;
|
||||
}
|
||||
this.addLabel(friendlyFireLabel);
|
||||
GuiNpcButton friendlyFireButton = new GuiNpcButton(320, friendlyFireLabel.x + 70, friendlyFireLabel.y - 6, new String[]{"gui.on", "gui.off"}, party.friendlyFire() ? 0 : 1);
|
||||
friendlyFireButton.width = 40;
|
||||
this.addButton(friendlyFireButton);
|
||||
|
||||
if (this.isLeader) {
|
||||
if (!party.getIsLocked()) {
|
||||
//set leader button
|
||||
@@ -134,25 +154,13 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
|
||||
//send invite button (opens subgui)
|
||||
//
|
||||
GuiNpcTextField playerTextField = new GuiNpcTextField(325, this, guiLeft + xSize / 2 + 20, guiTop + ySize / 2 + 40, 100, 20, "");
|
||||
GuiNpcTextField playerTextField = new GuiNpcTextField(325, this, friendlyFireLabel.x, guiTop + ySize / 2 + 25, 100, 20, "");
|
||||
this.addTextField(playerTextField);
|
||||
GuiNpcButton inviteButton = new GuiNpcButton(330, guiLeft + xSize / 2 + 125, guiTop + ySize / 2 + 40, "party.invite");
|
||||
GuiNpcButton inviteButton = new GuiNpcButton(330, playerTextField.xPosition + 105, playerTextField.yPosition, "party.invite");
|
||||
inviteButton.width = 50;
|
||||
this.addButton(inviteButton);
|
||||
}
|
||||
|
||||
//toggle friendly fire
|
||||
//
|
||||
GuiNpcLabel friendlyFireLabel = new GuiNpcLabel(321, StatCollector.translateToLocal("party.friendlyFire") + ":", guiLeft + xSize / 2 + 20, guiTop + ySize / 2 + 5);
|
||||
if (party.getIsLocked()) {
|
||||
friendlyFireLabel.x = guiLeft + 5;
|
||||
friendlyFireLabel.y = guiTop + ySize - 8 - 15;
|
||||
}
|
||||
this.addLabel(friendlyFireLabel);
|
||||
GuiNpcButton friendlyFireButton = new GuiNpcButton(320, friendlyFireLabel.x + 70, friendlyFireLabel.y - 6, new String[]{"gui.on", "gui.off"}, party.friendlyFire() ? 0 : 1);
|
||||
friendlyFireButton.width = 40;
|
||||
this.addButton(friendlyFireButton);
|
||||
|
||||
//disband party
|
||||
//
|
||||
GuiNpcButton disbandButton = new GuiNpcButton(335, guiLeft + 5, guiTop + ySize - 9, "party.disbandParty");
|
||||
@@ -252,9 +260,12 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
case 400:
|
||||
this.showQuestText = false;
|
||||
break;
|
||||
case 401:
|
||||
case 405:
|
||||
this.showQuestText = true;
|
||||
break;
|
||||
case 410:
|
||||
Client.sendData(EnumPacketServer.SetPartyQuest, "", "");
|
||||
break;
|
||||
}
|
||||
initGui();
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
@@ -291,16 +302,14 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
return;
|
||||
}
|
||||
|
||||
if (ClientCacheHandler.party != null && ClientCacheHandler.party.getQuest() != null) {
|
||||
if (ClientCacheHandler.party == null) {
|
||||
drawTextBlock("party.messageNoParty", guiLeft + 155, guiTop + ySize/2 - 20, 160);
|
||||
} else if (ClientCacheHandler.party.getQuest() != null) {
|
||||
Quest quest = (Quest) ClientCacheHandler.party.getQuest();
|
||||
if (showQuestText) {
|
||||
drawQuestText(quest);
|
||||
String title = StatCollector.translateToLocal("quest.objectives");
|
||||
fontRendererObj.drawString(title, guiLeft + 168, guiTop + 179, CustomNpcResourceListener.DefaultTextColor);
|
||||
drawTextBlock(quest.getLogText(), guiLeft + 142, guiTop + 20, 174);
|
||||
} else {
|
||||
drawProgress();
|
||||
String title = StatCollector.translateToLocal("gui.text");
|
||||
fontRendererObj.drawString(title, guiLeft + 284 - fontRendererObj.getStringWidth(title), guiTop + 179, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -312,14 +321,6 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
}
|
||||
}
|
||||
|
||||
private void drawQuestText(Quest quest){
|
||||
TextBlockClient block = new TextBlockClient(quest.getLogText(), 174, true, player);
|
||||
for(int i = 0; i < block.lines.size(); i++){
|
||||
String text = block.lines.get(i).getFormattedText();
|
||||
fontRendererObj.drawString(text, guiLeft + 142, guiTop + 20 + (i * fontRendererObj.FONT_HEIGHT), CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawProgress() {
|
||||
String complete = this.questCompleteWith;
|
||||
if(complete != null && !complete.isEmpty())
|
||||
|
||||
@@ -87,15 +87,16 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
addButton(new GuiButtonNextPage(1, guiLeft + 286, guiTop + 176, true));
|
||||
addButton(new GuiButtonNextPage(2, guiLeft + 144, guiTop + 176, false));
|
||||
|
||||
if (ClientCacheHandler.party != null && data.hasSelectedQuest()
|
||||
&& data.partyAbleQuests.contains(data.selectedCategory + ":" + data.selectedQuest)
|
||||
&& ClientCacheHandler.party.getPartyLeaderName().equals(this.player.getCommandSenderName())) {
|
||||
String questName = ClientCacheHandler.party.getCurrentQuestName();
|
||||
if (data.partyAbleQuests.contains(data.selectedCategory + ":" + data.selectedQuest)) {
|
||||
String questName = ClientCacheHandler.party != null ? ClientCacheHandler.party.getCurrentQuestName() : null;
|
||||
GuiNpcButton partyButton = new GuiNpcButton(3, guiLeft + 150, guiTop + 151, 50, 20, new String[]{"party.party", "party.partying"}, Objects.equals(questName, data.selectedQuest) ? 1 : 0);
|
||||
if (Objects.equals(questName, data.selectedQuest)) {
|
||||
addButton(partyButton);
|
||||
|
||||
partyButton.enabled = ClientCacheHandler.party != null && data.hasSelectedQuest()
|
||||
&& ClientCacheHandler.party.getPartyLeaderName().equals(this.player.getCommandSenderName());
|
||||
if (partyButton.enabled && Objects.equals(questName, data.selectedQuest)) {
|
||||
partyButton.packedFGColour = 0x32CD32;
|
||||
}
|
||||
addButton(partyButton);
|
||||
}
|
||||
|
||||
GuiNpcButton trackingButton = new GuiNpcButton(4, guiLeft + 260, guiTop + 151, 50, 20, new String[]{"quest.track", "quest.tracking"}, data.trackedQuestKey.equals(data.selectedCategory + ":" + data.selectedQuest) ? 1 : 0);
|
||||
@@ -111,6 +112,9 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
getButton(2).visible = !questDetails && data.hasSelectedQuest();
|
||||
getButton(4).visible = !data.selectedQuest.isEmpty() && getButton(1).visible;
|
||||
getButton(5).visible = getButton(4).visible;
|
||||
if (getButton(3) != null) {
|
||||
getButton(3).visible = getButton(4).visible;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
@@ -317,5 +321,5 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
Client.sendData(EnumPacketServer.QuestLogToServer, compound, this.data.trackedQuestKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -9,6 +9,9 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.CustomNpcResourceListener;
|
||||
import noppes.npcs.client.TextBlockClient;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
@@ -269,6 +272,14 @@ public abstract class GuiNPCInterface extends GuiScreen
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected void drawTextBlock(String text, int x, int y, int lineWidth) {
|
||||
TextBlockClient block = new TextBlockClient(StatCollector.translateToLocal(text), lineWidth, true, player);
|
||||
for(int line = 0; line < block.lines.size(); line++){
|
||||
String lineText = block.lines.get(line).getFormattedText();
|
||||
fontRendererObj.drawString(lineText, x, y + (line * fontRendererObj.FONT_HEIGHT), CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
public FontRenderer getFontRenderer() {
|
||||
return this.fontRendererObj;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user