Rogue's Den Safe Cracker (Manifest | Strategies)
Rogue's Den Safe Cracker cracks safes within Rogue's Den in Taverly. You can start this script from virtually anywhere (but within Taverly, or even better, within Rogue's Den is highly encouraged). Cracking safes requires a minimum of level 25 thieving.
Cracking safes produces a small sum of money, but also produces a large quantity of rubies, sapphires, and emeralds. Cracking safes is a net positive experience gaining method, with food being the only required cost.
Slick (source)
Slick aims for very simple (both in implementation and understanding) dependency injection via inversion of control. Modeled after Guice and Dagger 2, Slick provides simple constructor injection with none of the type checking, and all of the errors.
Yay! Constructor injection! This is the brunt of the idea behind Slick. Instead of messy new Objects(with, a, lot, of, dependencies) everywhere in the code, it's a simple slick.get(WhatIWant.class).
Example
public class ScriptName {
public ScriptName() {
Slick slick = new Slick();
// It's as easy as this:
TheThing myThing = slick.get(TheThing.class);
myThing.doStuff();
...
}
}
public class TheThing {
@Inject
public TheThing(Dependency A a, DependencyC c) { ... }
public void doStuff() { ... }
...
}
public class DependencyA {
@Inject
public DependencyA(DependencyB b) { ... }
...
}
public class DependencyB {
@Inject
public DependencyB() { ... }
...
}
public class DependencyC { ... }via an inline #provide method (versus using module binding)
Say there's an external API you need to use and you can't wrap the class you need (cough cough powerbot). Use the #provide method to pass it as a singleton to Slick!
Example
public class ScriptName extends Script<TextClientCon> {
public ScriptName() {
Slick slick = new Slick();
TextClientCon xtc = getXtc(); // Inherited via Script
slick.provide(xtc);
TheThing myThing = slick.get(TheThing.class);
myThing.doStuff();
}
}
public class TheThing {
@Inject
public TheThing(@Singleton TextClientCon xtc) { ... }
...
}note: TheThing in the example has an @Singleton annotation. Slick enforces singleton policies throughout the code to not only verify constructor-slick contracts, but to also prevent unexpected behavior.
If a class instance needs to be shared throughout the program, there are two options: #provide the instance beforehand (see the #provide example above), or simply mark it as @Singleton.
Example
public class ScriptName {
public ScriptName() {
Slick slick = new Slick();
Thing1 one = slick.get(Thing1.class); // Prints: 0
Thing2 two = slick.get(Thing2.class); // Prints: 1
}
}
public class Thing1 {
@Inject
public Thing1(@Singleton DependencyA a) {
a.doSomething();
}
}
public class Thing2 {
@Inject
public Thing2(@Singleton DependencyA a) {
a.doSomething();
}
}
@Singleton
public class DependencyA {
private int i;
@Inject
public DependencyA() {
this.i = 0;
}
public void doSomething() {
System.out.println(i++);
}
}Persona^tm (source)
Persona aims to emulate how a person might interact with the game over time. Where a static bot may, without fail, interact with an object, Persona may, over time, become less and less accurate in interaction until an event which may pull the attention back up. While the Persona engine doesn't do this automatically, it provides methods for very easily implementing these types of human responses throughout a script.