@Override public void run() { if (this.trophies == null) { super.run(); this.trophies = new ArrayList(); if (this.responseText == null) { return; } Matcher m = TrophyRequest.TROPHY_PATTERN.matcher(this.responseText); while (m.find()) { this.trophies.add( new Trophy( m.group(1), m.group(2), StringUtilities.parseInt(m.group(3)), m.group(4) != null)); } return; } this.addFormField("action", "Yup."); Iterator i = this.trophies.iterator(); while (i.hasNext()) { Trophy t = (Trophy) i.next(); if (t.visible) { this.addFormField("public" + t.id, "on"); } } super.run(); // Multiple trophy moving only works via GET, not POST. StringBuilder buf = new StringBuilder("trophies.php?moveall=yes"); i = this.trophies.iterator(); int pos = 1; while (i.hasNext()) { Trophy t = (Trophy) i.next(); buf.append("&trophy"); buf.append(t.id); buf.append("="); buf.append(pos++); } this.constructURLString("blah", false); // clear out cached URL data this.constructURLString(buf.toString(), false); super.run(); }
@Override public void run() { if (StandardRequest.running) { return; } StandardRequest.running = true; KoLmafia.updateDisplay("Seeing what's still unrestricted today..."); super.run(); StandardRequest.running = false; }