ruler
2007-04-11 07:19:00
I dont think SRL has a public Evil Bob
Bascially the solution is to take a screenshot about 2 seconds or so after the camera is moving. Then make a array of booleans, set each element to true if it is gold colored. Remove gold points that are not near other points. Then crop this zone. Calculate the ratio of height/width. From the ratio you will have a pretty accurate idea which it is.
Happy convertings
Bascially the solution is to take a screenshot about 2 seconds or so after the camera is moving. Then make a array of booleans, set each element to true if it is gold colored. Remove gold points that are not near other points. Then crop this zone. Calculate the ratio of height/width. From the ratio you will have a pretty accurate idea which it is.
Happy convertings
import impsoft.nexus.bots.color.constants.Areas;
import impsoft.nexus.bots.color.methods.ColorRandom;
import impsoft.nexus.bots.color.methods.GameScreenMethods;
import impsoft.nexus.bots.color.scriptobjects.NPCChat;
import impsoft.nexus.bots.color.scriptobjects.RGB;
import impsoft.nexus.bots.color.scriptobjects.RGBCluster;
import impsoft.nexus.bots.color.scriptobjects.Timer;
import impsoft.nexus.bots.paint.SimplePaintJob;
import impsoft.nexus.bots.reflection.scriptobjects.walking.AryanTile;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
public class EvilBob extends ColorRandom {
private AryanTile center = new AryanTile(2524, 4777, this);
private AryanTile catScard = new AryanTile(2528, 4790, this);
private AryanTile catPraying = new AryanTile(2542, 4777, this);
private AryanTile catAttacking = new AryanTile(2536, 4765, this);
private AryanTile catDead = new AryanTile(2512, 4775, this);
public boolean inIsland() {
return center.distanceTo() < 30;
}
@Override
public boolean startUp() throws InterruptedException {
setNextCheck(6000);
return isLoggedin() && inIsland();
}
public void paint(final int xOff, final int yOff, boolean[][] diffs, Color color, final int time) {
final BufferedImage bf = new BufferedImage(diffs.length, diffs[0].length,
BufferedImage.TYPE_INT_ARGB);
color = new Color(color.getRed(), color.getGreen(), color.getBlue(), 127);
Color blank = new Color(color.getRed(), color.getGreen(), color.getBlue(), 0);
for (int x = 0; x < diffs.length; x++) {
boolean xSlice[] = diffs[x];
for (int y = 0; y < diffs[0].length; y++) {
if (xSlice[y]) {
bf.setRGB(x, y, color.getRGB());
} else {
bf.setRGB(x, y, blank.getRGB());
}
}
}
addPaintJob(new SimplePaintJob(time) {
@Override
public void paint(Graphics g) {
g.drawImage(bf, xOff, yOff, null);
}
});
}
private RGB[] goldRGBS = new RGB[] { new RGB(234, 203, 114), new RGB(213, 180, 77),
new RGB(155, 131, 55), new RGB(222, 188, 80), new RGB(73, 61, 25), new RGB(105, 89, 37) };
@Override
public void random() throws InterruptedException {
log("We are at Evil Bob's Island");
while (true) {
final int goldRGBSLength = goldRGBS.length;
short[][] goldPixel = new short[goldRGBSLength][3];
int[][] goldPixeltolerances = new int[goldRGBSLength][3];
for (int i = 0; i < goldRGBSLength; i++) {
goldPixel[i] = goldRGBS[i].toPixle();
goldPixeltolerances[i][0] = GameScreenMethods.getGameScreenTolerance(goldPixel[i][0]);
goldPixeltolerances[i][1] = GameScreenMethods.getGameScreenTolerance(goldPixel[i][1]);
goldPixeltolerances[i][2] = GameScreenMethods.getGameScreenTolerance(goldPixel[i][2]);
}
boolean[][] golds = new boolean[Areas.GAME.width][Areas.GAME.height];
if (!TalkToServant()) {
return;
}
sleep(2000);
short[][][] colorMap = getColorArray2d();
for (int x = 15; x < Areas.GAME.width - 30; x++) {
short[][] xPiece = colorMap[x + Areas.GAME.x];
for (int y = 15; y < Areas.GAME.height - 30; y++) {
short[] yPiece = xPiece[y + Areas.GAME.y];
for (int i = 0; i < goldRGBSLength; i++) {
if (matching(yPiece, goldPixel[i], goldPixeltolerances[i][0],
goldPixeltolerances[i][1], goldPixeltolerances[i][2])) {
golds[x][y] = true;
}
}
}
}
for (int x = 15; x < golds.length - 30; x++) {
for (int y = 15; y < golds[0].length - 30; y++) {
if (golds[x][y]) {
int matches = 0;
for (int xSmall = -4; xSmall < 9; xSmall++) {
for (int ySmall = -4; ySmall < 9; ySmall++) {
if (golds[x + xSmall][y + ySmall]) {
matches++;
}
}
}
golds[x][y] = matches > 10;
}
}
}
int minX = -1;
int maxX = -1;
int minY = -1;
int maxY = -1;
for (int x = 0; x < golds.length; x++) {
for (int y = 0; y < golds[0].length; y++) {
if (golds[x][y]) {
if (minX == -1) {
minX = x;
}
maxX = x;
if (minY == -1 || y < minY) {
minY = y;
}
if (maxY == -1 || y > maxY) {
maxY = y;
}
}
}
}
if (minX != -1 && maxX != -1 && minY != -1 && maxY != -1) {
Rectangle rec = new Rectangle(0, 0, maxX - minX, maxY - minY);
boolean[][] reduced = new boolean[rec.width][rec.height];
for (int x = 0; x < reduced.length; x++) {
for (int y = 0; y < reduced[0].length; y++) {
reduced[x][y] = golds[x + minX][y + minY];
}
}
paintRectangle(rec, Color.WHITE, 10000);
paint(0, 0, reduced, Color.BLACK, 10000);
log(rec.height);
log(rec.width);
double ratio = (double) rec.height / rec.width;
log(ratio);
sleep(10000);
if (rec.height < 100) {
double options[] = new double[] { 2.46, 2.23, 1.45, 1.2 };
int winner = 0;
for (int i = 0; i < options.length; i++) {
if (Math.abs(ratio - options[winner]) > Math.abs(ratio - options[i])) {
winner = i;
}
}
switch (winner) {
case 0:
log("Praying?");
catPraying.walkTo();
break;
case 1:
log("Attacking?");
catAttacking.walkTo();
break;
case 2:
log("Dead?");
catDead.walkTo();
break;
case 3:
log("Scard?");
catScard.walkTo();
break;
}
fish();
unCook();
TalkToBob();
}
}
// paint(Areas.GAME.x, Areas.GAME.y, golds, Color.BLACK, 10000);
sleep(10000);
}
}
public static final boolean matching(short rgb[], short rgb2[], int redTolerance,
int greenTolerance, int blueTolerance) {
int redChange = rgb[0] - rgb2[0];
if ((redChange >= 0 ? redChange : -redChange) > redTolerance) {
return false;
}
int greenChange = rgb[1] - rgb2[1];
if ((greenChange >= 0 ? greenChange : -greenChange) > greenTolerance) {
return false;
}
int blueChange = rgb[2] - rgb2[2];
if ((blueChange >= 0 ? blueChange : -blueChange) > blueTolerance) {
return false;
}
return true;
}
public void TalkToBob() throws InterruptedException {
doActionAtInventory("fishlike", "Use", 1);
center.walkTo();
Timer t = new Timer(20000);
while (!t.isUp()) {
RGBCluster cluster = new RGBCluster(new RGB[] { new RGB(21, 17, 17) }, this);
cluster.gatherNewPoints(10);
if (cluster.doTopTextAndMenu("Evil", "Use")) {
break;
}
sleep(defaultmaxAgeInMillisecs);
}
NPCChat chat = getNPCChat(6000);
if (chat != null) {
}
}
public boolean TalkToServant() throws InterruptedException {
center.walkTo();
Timer t = new Timer(20000);
while (!t.isUp()) {
RGBCluster cluster = new RGBCluster(new RGB[] { new RGB(183, 141, 104) }, this);
cluster.gatherNewPoints(10);
cluster.doTopTextAndMenu("Ser", "alk");
NPCChat chat = getNPCChat(2000);
if (chat != null) {
if (chat.contains("asleep")) {
exit();
return false;
}
chat.selectContains("Click");
break;
}
}
return true;
}
public void exit() throws InterruptedException {
doActionAtRGBCluster(new RGB(191, 191, 122), "Portal", "Portal");
}
public void fish() throws InterruptedException {
log("Fishing");
Timer t = new Timer(20000);
while (!t.isUp()) {
if (doActionAtRGBCluster(new RGB[] { new RGB(196, 143, 113), new RGB(136, 176, 233),
new RGB(112, 152, 204), new RGB(144, 184, 236) }, "Net", "Net")) {
NPCChat chat = getNPCChat(15000);
if (chat != null) {
chat.selectContains("here");
break;
}
}
sleep(defaultmaxAgeInMillisecs);
}
}
public void unCook() throws InterruptedException {
log("Going to unCook");
center.walkTo();
Timer t = new Timer(20000);
while (!t.isUp()) {
if (doActionAtInventory("Fishlike", "Use", 1)) {
RGBCluster cluster = new RGBCluster(new RGB[] { new RGB(59, 96, 156) }, this);
cluster.gatherNewPoints(10);
if (cluster.doTopTextAndMenu("cook", "Use")) {
break;
}
}
}
sleep(4000);
}
}