RkShaRkz / Starsector-IntelliJ-Template

Starsector mod template with pre-configured IntelliJ project files and instructions.
The Unlicense
0 stars 1 forks source link

Get rid of VayraTags #6

Closed RkShaRkz closed 3 months ago

RkShaRkz commented 3 months ago

This is a trivial but non-trivial issue.

Trivial in a sense, just one file and all of it's usages have to be deleted. Nontrivial in a sense, it's used in like 20 different places.

For what it matters, VayraTags is some stupid file full of bullshit repetitive code that extracts different letters from some words to form certain words.

Here is teh VayraTags code:

public class VayraTags {
    public static final String PREFIX = "_";

    public static final String ROUND = "cartridge";

    public static final String EWAR = "ew";

    public static final String DIST = "nearby";

    public static final String OBSOLETE = "coal";

    public static final String LETTER = "ZZZzZZ";

    public static String de(String q) {
        String u = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
        q = q.replaceAll("[^" + u + "=]", "");
        String t = (q.charAt(q.length() - 1) == '=') ? ((q.charAt(q.length() - 2) == '=') ? "AA" : "A") : "";
        String r = "";
        q = q.substring(0, q.length() - t.length()) + t;
        for (int v = 0; v < q.length(); v += 4) {
            int s = (u.indexOf(q.charAt(v)) << 18) + (u.indexOf(q.charAt(v + 1)) << 12) + (u.indexOf(q.charAt(v + 2)) << 6) + u.indexOf(q.charAt(v + 3));
            r = r + (char) (s >>> 16 & 0xFF) + (char) (s >>> 8 & 0xFF) + (char) (s & 0xFF);
        }
        return r.substring(0, r.length() - t.length());
    }

    private static final String TEST = "nearby".charAt(0) + "ew" + "_" + "cartridge".charAt(7) + "nearby".charAt(2) + "coal".substring(3) + "cartridge".substring(1).charAt(0) + "coal".substring(0, 1) + "cartridge".charAt(3) + "cartridge".charAt(5) + "cartridge".substring(0, 1) + "_" + "coal".charAt(1) + "nearby".charAt(3) + "cartridge".charAt(6) + "nearby".substring(1).charAt(0) + "cartridge".substring(2).substring(2).charAt(0);

    private static final String TEST2 = "cartridge".substring(1).charAt(0) + "ew".charAt(0) + "si" + "nearby".charAt(3);

    public static final List<String> E = new ArrayList<>(Arrays.asList(TEST, "diableavionics", "sindrian_diktat", "nearby".charAt(2) + "r" + "i" + "array".charAt(0), "fpe", "legioinfernalis"));

    public static boolean readSpecial() {
        return (Global.getSector().getStarSystem(TEST2) != null);
    }
}

Here's what it actually maps out to:

TEST = new_galactic_order
TEST2 = 198sir //it's really  "aesir" ideone just crapped out
E = [new_galactic_order, diableavionics, sindrian_diktat, aria, fpe, legioinfernalis]

So, this VayraTags.readSpecial() is used in 20 places. It checks for existance of a starsystem called "198sir". But that thing might be irrelevant too.

KadurBlueprintStocker has a method doSpecial() that uses this readSpecial() and then supposedly turns everyone super-hostile to you. VayraColonialManager does the exact same thing in it's advance(), pickNextUpgrade() and pickExpeditionFP() methods. VayraPopularFrontManager uses it for an early-return in it's advance() method.

Just nuke this thing out of existence and release a new version.

RkShaRkz commented 3 months ago

Nuked out of existence in commit b5ac7d64