Quest Tracking Scale Setting

This commit is contained in:
Kam committed 2024-03-15 16:40:43 -04:00
1 parent 67d4b3bd15
commit 6fae016bcb
8 files changed
+113 -31

No files matched your search

@@ -320,6 +320,12 @@ public class NoppesUtilPlayer {
}
}
public static void clearTrackQuest(EntityPlayerMP player) throws IOException {
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
playerData.questData.untrackQuest();
}
public static void updatePartyQuestLogData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
String trackedQuestString = Server.readString(buffer);
@@ -94,6 +94,9 @@ public class PacketHandlerServer{
} else if (type == EnumPacketServer.PartyLogToServer) {
NoppesUtilPlayer.updatePartyQuestLogData(buffer, player);
return;
} else if (type == EnumPacketServer.UntrackQuest) {
NoppesUtilPlayer.clearTrackQuest(player);
return;
} else if(type == EnumPacketServer.DimensionsGet){
HashMap<String,Integer> map = new HashMap<String,Integer>();
for(int id : DimensionManager.getStaticDimensionIDs()){
@@ -55,4 +55,10 @@ public class ClientCacheHandler {
ClientCacheHandler.playerAnimations.clear();
ClientCacheHandler.playerData.animationData.clearCache();
}
public static void clearSkinCache() {
ClientCacheHandler.imageDataCache.clear();
ClientCacheHandler.customOverlays.clear();
ClientCacheHandler.skinOverlays.clear();
}
}
@@ -180,8 +180,11 @@ public class OverlayQuestTracking extends Gui {
public void renderGameOverlay(float partialTicks){
res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
scaledWidth = res.getScaledWidth();
scaledHeight = res.getScaledHeight();
float overallScale = (float) ConfigClient.TrackingScale / 100;
scaledWidth = (int) (res.getScaledWidth());
scaledHeight = (int) (res.getScaledHeight());
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
@@ -195,14 +198,13 @@ public class OverlayQuestTracking extends Gui {
float offsetY = ConfigClient.TrackingInfoAlignment < 3 ? 5 : 0;
offsetY = ConfigClient.TrackingInfoAlignment > 5 ? -5 : offsetY;
GL11.glTranslatef(ConfigClient.TrackingInfoX + offsetX, ConfigClient.TrackingInfoY + offsetY, 0.0F);
red = (color >> 16 & 255) / 255f;
green = (color >> 8 & 255) / 255f;
blue = (color & 255) / 255f;
float centerX = -60;
float centerX = (float) -overlayWidth /2 * overallScale;
if (ConfigClient.TrackingInfoAlignment % 3 == 1) { // For Center alignment
centerX = 0;
} else {
@@ -210,39 +212,39 @@ public class OverlayQuestTracking extends Gui {
}
float questTitleTop;
this.renderOffsetY = -40;
this.renderOffsetY = -40 * overallScale;
GL11.glPushMatrix();
GL11.glTranslatef(centerX, 0.0F, 0.0F);
this.renderStringLines(trackedQuestLines,1.2F, false, true, 0);
this.renderStringLines(trackedQuestLines,1.2F * overallScale, false, true, 0);
GL11.glPopMatrix();
questTitleTop = this.renderOffsetY;
this.renderOffsetY -= 10;
this.renderOffsetY -= 10 * overallScale;
GL11.glPushMatrix();
GL11.glTranslatef(centerX, 0.0F, 0.0F);
this.renderStringLines(categoryNameLines,0.85F, false, false, 0);
this.renderStringLines(categoryNameLines,0.85F * overallScale, false, false, 0);
GL11.glPopMatrix();
this.renderOffsetY = -10;
this.renderOffsetY = -10 * overallScale;
GL11.glPushMatrix();
this.renderStringLines(objectiveLines, 1F, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0));
this.renderStringLines(objectiveLines, 1F * overallScale, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0));
GL11.glPopMatrix();
this.renderOffsetY += 10;
this.renderOffsetY += 10 * overallScale;
GL11.glPushMatrix();
this.renderStringLines(turnInText, 1F, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0));
this.renderStringLines(turnInText, 1F * overallScale, true, false, ConfigClient.TrackingInfoAlignment % 3 == 0 ? 1 : (ConfigClient.TrackingInfoAlignment % 3 == 2 ? 2 : 0));
GL11.glPopMatrix();
this.renderOffsetY = -20;
this.renderOffsetY = -20 * overallScale;
GL11.glPushMatrix();
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+2), 0xFF777777);
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY+1), 0xFFA8A8A8);
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF);
this.drawHorizontalLine((int) (centerX - overlayWidth / 2), (int) (centerX + overlayWidth / 2), (int) (this.renderOffsetY), 0xFF777777);
this.drawHorizontalLine((int) (centerX - overlayWidth / 2), (int) (centerX + overlayWidth / 2), (int) ((this.renderOffsetY + 1)), 0xFFA8A8A8);
this.drawHorizontalLine((int) (centerX - overlayWidth / 2), (int) (centerX + overlayWidth / 2), (int) ((this.renderOffsetY + 2)), 0xFFFFFFFF);
GL11.glPopMatrix();
this.renderOffsetY = questTitleTop + 2;
GL11.glPushMatrix();
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY), 0xFFFFFFFF);
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-1), 0xFFA8A8A8);
this.drawHorizontalLine((int)(-overlayWidth/2 + centerX), (int)(overlayWidth/2 + centerX), (int) (this.renderOffsetY-2), 0xFF777777);
this.drawHorizontalLine((int) (centerX - overlayWidth / 2), (int) (centerX + overlayWidth / 2), (int) (this.renderOffsetY), 0xFFFFFFFF);
this.drawHorizontalLine((int) (centerX - overlayWidth / 2), (int) (centerX + overlayWidth / 2), (int) ((this.renderOffsetY - 1)), 0xFFA8A8A8);
this.drawHorizontalLine((int) (centerX - overlayWidth / 2), (int) (centerX + overlayWidth / 2), (int) ((this.renderOffsetY - 2)), 0xFF777777);
GL11.glPopMatrix();
GL11.glPopMatrix();
@@ -2,13 +2,19 @@ package noppes.npcs.client.gui.player.inventory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.Client;
import noppes.npcs.client.ClientCacheHandler;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.config.ConfigClient;
import noppes.npcs.constants.EnumPacketServer;
import org.lwjgl.opengl.GL11;
import tconstruct.client.tabs.AbstractTab;
public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener {
public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener, GuiYesNoCallback {
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
@@ -26,37 +32,48 @@ public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener
super.initGui();
int y = 0;
this.addLabel(new GuiNpcLabel(1, "Chat Bubbles", guiLeft + 8, guiTop + 14 + y));
this.addLabel(new GuiNpcLabel(1, "settings.chatBubbles", guiLeft + 8, guiTop + 14 + y));
this.addButton(new GuiNpcButton(1, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.EnableChatBubbles?1:0));
this.addLabel(new GuiNpcLabel(3, "Tracking Alignment", guiLeft + 8 + 155, guiTop + 14 + y));
this.addLabel(new GuiNpcLabel(3, "settings.trackAlignment", guiLeft + 8 + 155, guiTop + 14 + y));
this.addButton(new GuiNpcButton(3, guiLeft + 105 + 160, guiTop + 9 + y, 50, 20, new String[]{"TLeft", "TCenter", "TRight", "Left", "Center", "Right", "BLeft", "BCenter", "BRight"}, ConfigClient.TrackingInfoAlignment));
y += 22;
this.addLabel(new GuiNpcLabel(2, "Dialog Sound", guiLeft + 8, guiTop + 14 + y));
this.addLabel(new GuiNpcLabel(2, "settings.dialogSound", guiLeft + 8, guiTop + 14 + y));
this.addButton(new GuiNpcButton(2, guiLeft + 105, guiTop + 9 + y, 50, 20, new String[]{"gui.no", "gui.yes"}, ConfigClient.DialogSound?1:0));
this.addLabel(new GuiNpcLabel(12,"Alignment X", guiLeft + 8 + 155, guiTop + 14 + y));
this.addLabel(new GuiNpcLabel(12,"settings.alignmentX", guiLeft + 8 + 155, guiTop + 14 + y));
this.addTextField(new GuiNpcTextField(12, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingInfoX + ""));
getTextField(12).integersOnly = true;
getTextField(12).setMinMaxDefault(-2000, 2000, 0);
y += 22;
this.addLabel(new GuiNpcLabel(10,"Dialog Speed", guiLeft + 8, guiTop + 14 + y));
this.addLabel(new GuiNpcLabel(10,"settings.dialogSpeed", guiLeft + 8, guiTop + 14 + y));
this.addTextField(new GuiNpcTextField(10, this, this.fontRendererObj, guiLeft + 107, guiTop + 9 + y, 45, 20, ConfigClient.DialogSpeed + ""));
getTextField(10).integersOnly = true;
getTextField(10).setMinMaxDefault(1, 20, 10);
this.addLabel(new GuiNpcLabel(13,"Alignment Y", guiLeft + 8 + 155, guiTop + 14 + y));
this.addLabel(new GuiNpcLabel(13,"settings.alignmentY", guiLeft + 8 + 155, guiTop + 14 + y));
this.addTextField(new GuiNpcTextField(13, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingInfoY + ""));
getTextField(13).integersOnly = true;
getTextField(13).setMinMaxDefault(-2000, 2000, 0);
y += 22;
// Planned
// Clear Skin Cache
// Clear Tracked Quest
//
this.addLabel(new GuiNpcLabel(14,"settings.trackScale", guiLeft + 8 + 155, guiTop + 14 + y));
this.addTextField(new GuiNpcTextField(14, this, this.fontRendererObj, guiLeft + 107 + 160, guiTop + 9 + y, 45, 20, ConfigClient.TrackingScale + ""));
getTextField(14).integersOnly = true;
getTextField(14).setMinMaxDefault(0, 100, 100);
y += 22;
y += 22;
y += 22;
y += 22;
this.addButton(new GuiNpcButton(5, guiLeft + 8, guiTop + 9 + y, 150, 20, "settings.clearSkin"));
this.addButton(new GuiNpcButton(4, guiLeft + 8 + 155, guiTop + 9 + y, 150, 20, "settings.clearTrack"));
}
@Override
@@ -71,6 +88,24 @@ public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener
}
@Override
public void confirmClicked(boolean flag, int i) {
if (flag) {
switch (i) {
case 0:
// Untrack Quest
Client.sendData(EnumPacketServer.UntrackQuest);
break;
case 1:
// Clear Skin Cache
ClientCacheHandler.clearSkinCache();
break;
}
initGui();
}
displayGuiScreen(this);
}
@Override
protected void actionPerformed(GuiButton btn){
if(btn instanceof AbstractTab)
@@ -95,6 +130,14 @@ public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener
ConfigClient.TrackingInfoAlignment = button.getValue();
ConfigClient.TrackingInfoAlignmentProperty.set(ConfigClient.TrackingInfoAlignment);
}
if(button.id == 4){
GuiYesNo yesNoTrack = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("settings.confirmClearTrack"), 0);
displayGuiScreen(yesNoTrack);
}
if(button.id == 5){
GuiYesNo yesNoSkin = new GuiYesNo(this, "Confirm", StatCollector.translateToLocal("settings.confirmClearSkin"), 1);
displayGuiScreen(yesNoSkin);
}
}
@@ -128,5 +171,9 @@ public class GuiSettings extends GuiCNPCInventory implements ITextfieldListener
ConfigClient.TrackingInfoY = textfield.getInteger();
ConfigClient.TrackingInfoYProperty.set(ConfigClient.TrackingInfoY);
}
if(textfield.id == 14){
ConfigClient.TrackingScale = textfield.getInteger();
ConfigClient.TrackingScaleProperty.set(ConfigClient.TrackingScale);
}
}
}
@@ -54,6 +54,9 @@ public class ConfigClient
public static Property TrackingInfoYProperty;
public static int TrackingInfoY = 0;
public static Property TrackingScaleProperty;
public static int TrackingScale = 100;
public static Property DialogSpeedProperty;
public static int DialogSpeed = 10;
@@ -98,6 +101,9 @@ public class ConfigClient
TrackingInfoYProperty = config.get(QUESTING, "Tracking Info Y", 0, "Client sided! Offsets the tracking info GUI by this amount in the Y direction.");
TrackingInfoY = TrackingInfoYProperty.getInt(0);
TrackingScaleProperty = config.get(QUESTING, "Tracking Scale", 100, "Client sided! Adjusts the scaling of the Quest Tracking");
TrackingScale = TrackingScaleProperty.getInt(100);
DialogSpeedProperty = config.get(VISUAL, "Dialog Speed", 10, "Only set for gradual dialogs");
DialogSpeed = DialogSpeedProperty.getInt(10);
@@ -98,7 +98,7 @@ public enum EnumPacketServer {
AnimationsGet, AnimationGet,
AnimationRemove(CustomNpcsPermissions.GLOBAL_ANIMATION), AnimationSave(CustomNpcsPermissions.GLOBAL_ANIMATION),
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, QuestLogToServer, PartyLogToServer,
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, QuestLogToServer, PartyLogToServer, UntrackQuest,
RemoteNpcsGet(CustomNpcsPermissions.NPC_GUI),
RemoteTpToNpc(CustomNpcsPermissions.NPC_TELEPORT),