Skip to content

Commit

Permalink
DBC Stat sheet form colors are back
Browse files Browse the repository at this point in the history
  • Loading branch information
bigguy345 committed Apr 23, 2024
1 parent d40bfc1 commit 99b11e2
Showing 1 changed file with 32 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

import JinRyuu.JRMCore.JRMCoreGuiScreen;
import JinRyuu.JRMCore.JRMCoreH;
import kamkeel.npcdbc.constants.DBCForm;
import kamkeel.npcdbc.data.PlayerFormData;
import kamkeel.npcdbc.data.form.Form;
import kamkeel.npcdbc.data.DBCData;
import kamkeel.npcdbc.util.DBCUtils;
import kamkeel.npcdbc.util.Utility;
import net.minecraft.client.Minecraft;
Expand All @@ -24,23 +22,25 @@

public class MixinJRMCoreGuiScreen extends GuiScreen {

@Shadow
public static String name;
@Shadow
protected static List<Object[]> detailList;


@Unique
private static String getFormName() {
boolean ui = JRMCoreH.StusEfctsMe(19);
// REMOVED FOR NOW
// boolean ui = JRMCoreH.StusEfctsMe(19);
String name = null;
PlayerFormData formData = Utility.getSelfData();
if (formData != null && formData.isInCustomForm())
name = formData.getCurrentForm().getMenuName();
else {
DBCData d = DBCData.get(Minecraft.getMinecraft().thePlayer);
if (d != null) {
name = DBCUtils.getCurrentFormFullName(d.Race, d.State, d.isForm(DBCForm.Legendary), d.isForm(DBCForm.Divine), JRMCoreH.StusEfctsMe(13), ui, DBCUtils.isUIWhite(ui, JRMCoreH.State2), JRMCoreH.StusEfctsMe(20));
}
}
// else {
// DBCData d = DBCData.get(Minecraft.getMinecraft().thePlayer);
// if (d != null) {
// name = DBCUtils.getCurrentFormFullName(d.Race, d.State, d.isForm(DBCForm.Legendary), d.isForm(DBCForm.Divine), JRMCoreH.StusEfctsMe(13), ui, DBCUtils.isUIWhite(ui, JRMCoreH.State2), JRMCoreH.StusEfctsMe(20));
// }
// }

return name;
}
Expand All @@ -49,22 +49,28 @@ private static String getFormName() {
private static void onDrawDetails(String s1, String s2, int xpos, int ypos, int x, int y, FontRenderer var8, CallbackInfo ci) {
if (s1.contains(JRMCoreH.trl("jrmc", "TRState") + ":")) {
final String TRState2 = JRMCoreH.trl("jrmc", "TRState"); // "Form : SS4"
s1 = TRState2 + ":" + getFormName();
String[] e = s1.split(":");
String e0 = e[0] + ": ";
int pos = var8.getStringWidth(e0);
var8.drawString(e0, xpos, ypos, 0);
var8.drawString(e[1], xpos + pos, ypos, DBCUtils.getCurrentFormColor());
int wpos = var8.getStringWidth(s1);
if (xpos < x && xpos + wpos > x && ypos - 3 < y && ypos + 10 > y) {
int ll = 200;
Object[] txt = new Object[]{s2, "§8", 0, true, x + 5, y + 5, ll};
detailList.add(txt);
PlayerFormData formData = Utility.getSelfData();
if (formData != null && formData.isInCustomForm()) {
String name = formData.getCurrentForm().getMenuName();
s1 = TRState2 + ":" + name;

String[] e = s1.split(":");
String e0 = e[0] + ": ";
int pos = var8.getStringWidth(e0);
var8.drawString(e0, xpos, ypos, 0);
var8.drawString(e[1], xpos + pos, ypos, DBCUtils.getCurrentFormColor());
int wpos = var8.getStringWidth(s1);
if (xpos < x && xpos + wpos > x && ypos - 3 < y && ypos + 10 > y) {
int ll = 200;
Object[] txt = new Object[]{s2, "§8", 0, true, x + 5, y + 5, ll};
detailList.add(txt);
}
ci.cancel();

}
ci.cancel();
} else if (Utility.getSelfData() != null && Utility.getSelfData().isInCustomForm()) {
Form form = Utility.getSelfData().getCurrentForm();
int color = 0;
PlayerFormData formData = Utility.getSelfData();
if ((s1.contains("STR:") || s1.contains("DEX:") || s1.contains("WIL:")) && s1.contains("§")) { //adds the form color to STR,DEX and WIL attribute values
int secondIndex = 0;
for (int i = 0; i < s1.length(); i++) {
Expand All @@ -75,16 +81,15 @@ private static void onDrawDetails(String s1, String s2, int xpos, int ypos, int
}

String originalColor = s1.substring(secondIndex, secondIndex + 2);
s1 = s1.replace(originalColor, "");
color = form.display.getNameColor();
s1 = s1.replace(originalColor, formData.getFormColorCode(formData.getCurrentForm()));
} else if (s1.contains("CON:")) { // adds the "xMulti" after CON: AttributeValue
float multi = (float) DBCUtils.getCurFormMulti(Minecraft.getMinecraft().thePlayer);
if (s1.contains("x"))
s1 = s1.substring(0, s1.indexOf("x") - 1);
s1 = s1 + (JRMCoreH.round(multi, 1) != 1.0 ? " x" + JRMCoreH.round(multi, 1) : "");
s1 = s1 + (JRMCoreH.round(multi, 1) != 1.0 ? formData.getFormColorCode(formData.getCurrentForm()) + " x" + JRMCoreH.round(multi, 1) : "");
}
int wpos = var8.getStringWidth(s1);
var8.drawString(s1, xpos, ypos, color);
var8.drawString(s1, xpos, ypos, 0);
if (xpos < x && xpos + wpos > x && ypos - 3 < y && ypos + 10 > y) {
int ll = 200;
Object[] txt = new Object[]{s2, "§8", 0, true, x + 5, y + 5, ll};
Expand Down

0 comments on commit 99b11e2

Please sign in to comment.