Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deobfuscate a lot more lobby code, remove TrackDumper #118

Merged
merged 5 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/src/main/java/agolf/lobby/LobbyChatPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.aapeli.multiuser.ChatLobby;
import com.aapeli.multiuser.GlobalChatListener;
import com.aapeli.multiuser.Languages;
import com.aapeli.multiuser.UserListItem;
import com.aapeli.multiuser.User;

class LobbyChatPanel extends ChatLobby implements GlobalChatListener {

Expand Down Expand Up @@ -205,7 +205,7 @@ protected boolean handlePacket(String[] args) {
super.chatTextArea.addPlainMessage(message);
}

super.chatTextArea.addLine();
super.chatTextArea.addText();
return true;
}
else if(args[1].equals("users")) {
Expand Down Expand Up @@ -293,7 +293,7 @@ else if (args[1].equals("nc")) {
}

protected void getUser(String name, boolean var2) {
UserListItem var3;
User var3;
if (name != null) {
var3 = super.userList.getUser(name);
if (var3 == null) {
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/java/agolf/lobby/LobbyPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import agolf.GameApplet;
import agolf.GameContainer;
import com.aapeli.colorgui.Choicer;
import com.aapeli.multiuser.UserListItem;
import com.aapeli.multiuser.User;
import org.moparforia.client.Launcher;

import java.awt.Graphics;
Expand Down Expand Up @@ -225,7 +225,7 @@ protected void getUser(String name, boolean var2) {
}

protected boolean isNotAcceptingChallenges(String user) {
UserListItem userItem = this.lobbyChatPanelDual.userList.getUser(user);
User userItem = this.lobbyChatPanelDual.userList.getUser(user);
return userItem != null ? userItem.isNotAcceptingChallenges() : true;
}

Expand Down
84 changes: 0 additions & 84 deletions client/src/main/java/com/aapeli/client/Class79.java

This file was deleted.

35 changes: 0 additions & 35 deletions client/src/main/java/com/aapeli/client/Class80.java

This file was deleted.

84 changes: 84 additions & 0 deletions client/src/main/java/com/aapeli/client/HtmlLine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package com.aapeli.client;

import java.awt.Font;
import java.awt.Graphics;
import java.util.Vector;

class HtmlLine {

private int anInt1366;
private boolean aBoolean1367;
private Vector<HtmlWord> words;
private int nextWordStart;
private int height;
private final HtmlText aHtmlText1371;


protected HtmlLine(HtmlText htmlText, Graphics graphics, int var3, boolean var4) {
this.aHtmlText1371 = htmlText;
this.anInt1366 = var3;
this.aBoolean1367 = var4;
this.words = new Vector<>();
this.nextWordStart = 0;
this.height = graphics.getFont().getSize();
}

public String toString() {
int wordsLength = this.words.size();
String s = "[HtmlLine: words.size=" + wordsLength + "\n";

for (int i = 0; i < wordsLength; ++i) {
s = s + " " + this.words.elementAt(i).toString() + "\n";
}

s = s + "'relatx'=" + this.nextWordStart + " 'height'=" + this.height + "]";
return s;
}

protected boolean method1604(int var1) {
return this.nextWordStart + var1 <= this.anInt1366;
}

protected void addWord(String text, Font font, int length) {
if (!this.isEmpty() || text.trim().length() != 0) {
HtmlWord word = new HtmlWord(this, text, font, this.nextWordStart, length);
this.words.addElement(word);
this.nextWordStart += length;
int fontSize = font.getSize();
if (fontSize > this.height) {
this.height = fontSize;
}

}
}

protected boolean isEmpty() {
return this.words.isEmpty();
}

protected int getHeight() {
return this.height;
}

protected void draw(Graphics graphics, int x, int y) {
int wordsCount = this.words.size();
HtmlWord word;
int wordsLength;
if (this.aBoolean1367) {
wordsLength = 0;

for (int i = 0; i < wordsCount; ++i) {
word = this.words.elementAt(i);
wordsLength += word.getLength();
}

x += (this.anInt1366 - wordsLength) / 2;
}

for (wordsLength = 0; wordsLength < wordsCount; ++wordsLength) {
word = this.words.elementAt(wordsLength);
word.draw(graphics, x, y);
}

}
}
50 changes: 25 additions & 25 deletions client/src/main/java/com/aapeli/client/HtmlText.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,79 @@

public class HtmlText {

private Vector<Class79> aVector1348;
public HtmlText(Graphics var1, int var2, String var3) {
this.aVector1348 = this.method1589(var1, var2, var3);
private Vector<HtmlLine> lines;
public HtmlText(Graphics graphics, int var2, String var3) {
this.lines = this.method1589(graphics, var2, var3);
}

public String toString() {
int var1 = this.aVector1348.size();
int var1 = this.lines.size();
String var2 = "[HtmlText: lines.size=" + var1 + "\n";

for (int var3 = 0; var3 < var1; ++var3) {
var2 = var2 + " " + this.aVector1348.elementAt(var3).toString() + "\n";
var2 = var2 + " " + this.lines.elementAt(var3).toString() + "\n";
}

var2 = var2 + "]";
return var2;
}

public int print(Graphics var1, int var2, int var3) {
int var4 = this.aVector1348.size();
int var4 = this.lines.size();
int var5 = 0;

for (int var7 = 0; var7 < var4; ++var7) {
Class79 var6 = this.aVector1348.elementAt(var7);
var5 = var6.method1607() + 5;
HtmlLine var6 = this.lines.elementAt(var7);
var5 = var6.getHeight() + 5;
if (var7 > 0) {
var3 += var5;
}

var6.method1608(var1, var2, var3);
var6.draw(var1, var2, var3);
}

return var3 + var5;
}

private Vector<Class79> method1589(Graphics var1, int var2, String var3) {
private Vector<HtmlLine> method1589(Graphics var1, int var2, String var3) {
Class81 var4 = new Class81(this, var3, var1);
Vector<Class79> var5 = new Vector<>();
Vector<HtmlLine> var5 = new Vector<>();
boolean var6 = false;
Class79 var7 = new Class79(this, var1, var2, var6);
HtmlLine line = new HtmlLine(this, var1, var2, var6);

String var8;
while ((var8 = var4.method1611()) != null) {
if (var8.equals("<br>")) {
var5.addElement(var7);
var7 = new Class79(this, var1, var2, var6);
var5.addElement(line);
line = new HtmlLine(this, var1, var2, var6);
} else if (var8.equals("<center>")) {
var6 = true;
var7 = this.method1590(var7, var5, var1, var2, var6);
line = this.method1590(line, var5, var1, var2, var6);
} else if (var8.equals("</center>")) {
var6 = false;
var7 = this.method1590(var7, var5, var1, var2, var6);
line = this.method1590(line, var5, var1, var2, var6);
} else {
int var9 = var1.getFontMetrics().stringWidth(var8);
if (!var7.method1604(var9)) {
var5.addElement(var7);
var7 = new Class79(this, var1, var2, var6);
if (!line.method1604(var9)) {
var5.addElement(line);
line = new HtmlLine(this, var1, var2, var6);
}

var7.method1605(var8, var1.getFont(), var9);
line.addWord(var8, var1.getFont(), var9);
}
}

this.method1591(var7, var5);
this.method1591(line, var5);
return var5;
}

private Class79 method1590(Class79 var1, Vector<Class79> var2, Graphics var3, int var4, boolean var5) {
private HtmlLine method1590(HtmlLine var1, Vector<HtmlLine> var2, Graphics var3, int var4, boolean var5) {
this.method1591(var1, var2);
return new Class79(this, var3, var4, var5);
return new HtmlLine(this, var3, var4, var5);
}

private void method1591(Class79 var1, Vector<Class79> var2) {
if (!var1.method1606()) {
private void method1591(HtmlLine var1, Vector<HtmlLine> var2) {
if (!var1.isEmpty()) {
var2.addElement(var1);
}

Expand Down
35 changes: 35 additions & 0 deletions client/src/main/java/com/aapeli/client/HtmlWord.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.aapeli.client;

import java.awt.Font;
import java.awt.Graphics;

class HtmlWord {

private String word;
private Font font;
private int start;
private int length;
private final HtmlLine htmlLine;


protected HtmlWord(HtmlLine htmlLine, String word, Font font, int start, int length) {
this.htmlLine = htmlLine;
this.word = word;
this.font = font;
this.start = start;
this.length = length;
}

public String toString() {
return "[HtmlWord: 'word'=\"" + this.word + "\" 'font'=\"" + this.font.toString() + "\" 'relx'=" + this.start + "]";
}

protected int getLength() {
return this.length;
}

protected void draw(Graphics graphics, int x, int y) {
graphics.setFont(this.font);
graphics.drawString(this.word, x + this.start, y);
}
}
Loading
Loading