Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
2.1 kB · 48 lines
Java
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import java.util.Iterator;
import TemplateCompiler.JevBridge;import TemplateCompiler.JevDialogueLog;import TemplateCompiler.Preprocessor;import jess.Rete;
/** * Runs the patch on the game's own JVM, outside the game. Not installed. * tools/test_patch.py launches it with the game's flags and working directory. */public class JevHarness { public static void main(String[] args) throws Exception { String text = args.length > 0 ? args[0] : "hello"; System.out.println(new StringBuffer("java ").append(System.getProperty("java.version")).toString());
// Loads and verifies the renamed original class on this JVM. System.out.println(new StringBuffer("original parser reachable: ") .append(Preprocessor.replaceAll("a(b", "(", "[")).toString());
// Pretend Trip just spoke script line 1304 ("how does a martini sound"), // the way the patched PushTripDialogAnimation would record it. JevDialogueLog.record(1, new Object[] { new Integer(1304), new Integer(-1), new Integer(-1), new Integer(-1) }); System.out.println(new StringBuffer("recent dialogue: ").append(JevDialogueLog.recent()).toString());
int[][] acts = JevBridge.classify(text); if (acts == null) { System.out.println("bridge: no answer (sidecar down?)"); } else { for (int i = 0; i < acts.length; i++) { StringBuffer line = new StringBuffer("bridge act:"); for (int j = 0; j < acts[i].length; j++) { line.append(' ').append(acts[i][j]); } System.out.println(line.toString()); } }
// The shim end to end against a bare rule engine: the DA facts it // asserts are what the game's FactListener turns into DAWMEs. Rete rete = new Rete(); Preprocessor.Process(text, rete); Iterator facts = rete.listFacts(); while (facts.hasNext()) { System.out.println(new StringBuffer("engine fact: ").append(facts.next()).toString()); } }}