Created
March 1, 2017 22:43
-
-
Save LucasAlfare/89086c40b1828a533e1ca5c42bcd1b58 to your computer and use it in GitHub Desktop.
Trapaceando novamente
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.aux; | |
import com.runemate.game.api.hybrid.local.Skill; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class Valores { | |
public static final String OSSOS = "Bones"; | |
public static final String OSSOES = "Big bones"; | |
public static final String OSSOS_DE_DRAGAO = "Dragon bones"; | |
public static final String OSSOS_DE_DRAGAO_GELADO = "Frost bones"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor; | |
import com.runemate.game.api.hybrid.local.Skill; | |
import com.runemate.game.api.script.framework.task.TaskBot; | |
import oferecedor.aux.Valores; | |
import oferecedor.tarefas.*; | |
/** | |
* Created by Lucas Sousa on 28/02/17. | |
*/ | |
public class BotMain extends TaskBot { | |
private static String status; | |
private String ossos = Valores.OSSOS_DE_DRAGAO; | |
private final int EXP_INICIAL = Skill.PRAYER.getExperience(); | |
@Override | |
public void onStart(String... strings) { | |
this.add( | |
new AbrirBanco(), | |
new PegarOssos(ossos), | |
new UsarOssoDaBag(ossos), | |
new UsarNoAltar(ossos), | |
new TeleportarParaWild(), | |
new CaminharParaAltar() | |
); | |
status = "Iniciando bot..."; | |
System.out.println("Iniciando bot..."); | |
setLoopDelay(800, 1200); | |
} | |
@Override | |
public void onStop() { | |
System.out.println("Upou " + (Skill.PRAYER.getExperience() - EXP_INICIAL) + " exp. Parabens!"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client. Current Thread=Thread[pool-5-thread-1,2,[t-g]7911 - Oferecedor] | |
at nul.IIIiiIiiiiii.void(cpb:56) | |
at com.runemate.game.api.hybrid.Environment.getBot(elb:159) | |
at nul.iIiIiIiIIIii.run(qgb:174) | |
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) | |
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) | |
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) | |
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) | |
at java.lang.Thread.run(Thread.java:745) | |
Exception: java.lang.NullPointerException thrown from the UncaughtExceptionHandler in thread "Thread-20" | |
Iniciando bot... | |
[Caution: Limited API usage] You're only using a small portion of the api, we recommend you look into some of our EventListeners such as the InventoryListener. | |
java.lang.UnsupportedOperationException: Only a Thread within a bot's ThreadGroup may eavesdrop on the game client. Current Thread=Thread[pool-6-thread-2,5,[t-g]7911 - Oferecedor] | |
at nul.IIIiiIiiiiii.void(cpb:56) | |
at com.runemate.game.api.hybrid.Environment.getGameType(elb:82) | |
at com.runemate.game.api.hybrid.Environment.isRS3(elb:211) | |
at nul.IIIIiIiiIIiI.void(fib:103) | |
at nul.IIIIiIiiIIiI.validate(fib:89) | |
at com.runemate.game.api.script.framework.LoopingBot.run(reb:177) | |
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) | |
at java.util.concurrent.FutureTask.run(FutureTask.java:266) | |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) | |
at java.lang.Thread.run(Thread.java:745) | |
[Biostatistics] An error of type FileNotFoundException occurred while trying to retrieve the movements of clouse pack dedJ | |
Process finished with exit code 130 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest> | |
<main-class>oferecedor.BotMain</main-class> | |
<name>Oferecedor</name> | |
<tag-line>TAGE_LINE</tag-line> | |
<description>Offers bones to Chaos Altar, at Wildness</description> | |
<version>0.0.1</version> | |
<compatibility> | |
<game>RS3</game> | |
</compatibility> | |
<categories> | |
<category>PRAYER</category> | |
</categories> | |
<internal-id></internal-id> | |
<open-source>true</open-source> | |
<hidden>false</hidden> | |
<access>public</access> | |
<tags> | |
<tag>Tag</tag> | |
</tags> | |
</manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.tarefas; | |
import com.runemate.game.api.hybrid.entities.Npc; | |
import com.runemate.game.api.hybrid.local.Camera; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Bank; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory; | |
import com.runemate.game.api.hybrid.region.GameObjects; | |
import com.runemate.game.api.hybrid.region.Npcs; | |
import com.runemate.game.api.hybrid.region.Players; | |
import com.runemate.game.api.script.Execution; | |
import com.runemate.game.api.script.framework.task.Task; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class AbrirBanco extends Task{ | |
@Override | |
public void execute() { | |
final Npc simon = Npcs.newQuery().names("Simon").results().nearest(); | |
//status = "Tentando abrir o banco..."; | |
System.out.println("Tentando abrir o banco..."); | |
if (simon != null){ | |
if (!simon.isVisible()){ | |
if (Camera.turnTo(simon)){ | |
//status = "Virando a camera pro Simon...."; | |
System.out.println("Virando a camera pro Simon...."); | |
} | |
} else { | |
if (simon.interact("Bank")){ | |
//status = "interagindo com Simon..."; | |
System.out.println("interagindo com Simon..."); | |
Execution.delayUntil(() -> Players.getLocal().getAnimationId() == -1, 1200); | |
} | |
} | |
} else { | |
System.out.println("Simon nulo!!!!"); | |
} | |
} | |
@Override | |
public boolean validate() { | |
return Inventory.isEmpty() && | |
!Bank.isOpen() && | |
Players.getLocal().getAnimationId() == -1 && | |
GameObjects.newQuery().names("Chaos altar").results().nearest() != null && | |
Npcs.newQuery().names("Simon").results().nearest() != null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.tarefas; | |
import com.runemate.game.api.hybrid.entities.GameObject; | |
import com.runemate.game.api.hybrid.entities.Npc; | |
import com.runemate.game.api.hybrid.location.Coordinate; | |
import com.runemate.game.api.hybrid.location.navigation.basic.PredefinedPath; | |
import com.runemate.game.api.hybrid.region.GameObjects; | |
import com.runemate.game.api.hybrid.region.Npcs; | |
import com.runemate.game.api.hybrid.region.Players; | |
import com.runemate.game.api.script.framework.task.Task; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class CaminharParaAltar extends Task{ | |
private final static Coordinate[] coords = { | |
new Coordinate(3154, 3639), | |
new Coordinate(3166, 3642), | |
new Coordinate(3178, 3644), | |
new Coordinate(3189, 3644), | |
new Coordinate(3203, 3643), | |
new Coordinate(3215, 3641), | |
new Coordinate(3226, 3637), | |
new Coordinate(3235, 3631), | |
new Coordinate(3234, 3620), | |
new Coordinate(3232, 3603) | |
}; | |
@Override | |
public void execute() { | |
System.out.println("Caminhando para o altar...."); | |
PredefinedPath.create(coords).step(); | |
} | |
@Override | |
public boolean validate() { | |
boolean visivel = false; | |
boolean visivel2 = false; | |
GameObject altar = GameObjects.newQuery().names("Chaos altar").results().nearest(); | |
Npc simon = Npcs.newQuery().names("Simon").results().nearest(); | |
if (altar != null){ | |
visivel = altar.isVisible(); | |
} | |
if (simon != null){ | |
visivel2 = simon.isVisible(); | |
} | |
return (precisaAndar() && | |
(GameObjects.newQuery().names("Chaos altar").results().nearest() == null || | |
Npcs.newQuery().names("Simon").results().nearest() == null)) || | |
!visivel || | |
!visivel2; | |
} | |
@Deprecated | |
private boolean emVoltaDoAltar(){ | |
int[][] redorAltarCoords = { | |
{3240, 3609}, {3239, 3609}, | |
{3238, 3609}, {3238, 3608}, | |
{3239, 3607}, {3240, 3607}, | |
{3241, 3607}, {3241, 3608}, | |
{3641, 3609}, {3240, 3609} | |
}; | |
for (int[] ab : redorAltarCoords){ | |
int[] xy = {Players.getLocal().getPosition().getX(), | |
Players.getLocal().getPosition().getY()}; | |
if (xy[0] == ab[0] && xy[1] == ab[1]){ | |
return true; | |
} | |
} | |
return false; | |
} | |
private boolean precisaAndar(){ | |
int[] xy = {Players.getLocal().getPosition().getX(), | |
Players.getLocal().getPosition().getY()}; | |
return xy[0] != coords[coords.length - 1].getX() && | |
xy[1] != coords[coords.length - 1].getY(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.tarefas; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Bank; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory; | |
import com.runemate.game.api.hybrid.region.GameObjects; | |
import com.runemate.game.api.script.Execution; | |
import com.runemate.game.api.script.framework.task.Task; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class PegarOssos extends Task { | |
private String ossosParaOferecer; | |
public PegarOssos(String ossosParaOferecer) { | |
this.ossosParaOferecer = ossosParaOferecer; | |
} | |
@Override | |
public void execute() { | |
//status = "Tentando pegar 28 ossos..."; | |
System.out.println("Tentando pegar 28 ossos..."); | |
if (Bank.withdraw(ossosParaOferecer, 28)) { | |
Execution.delay(1200); | |
} | |
if (Bank.isOpen() && Inventory.isFull()) { | |
if (Bank.close()) { | |
//status = "Fechando o banco..."; | |
System.out.println("Fechando o banco..."); | |
} | |
} | |
} | |
@Override | |
public boolean validate() { | |
return Inventory.isEmpty() && | |
Bank.isOpen() && | |
GameObjects.newQuery().names("Chaos altar").results().nearest() != null; | |
} | |
public String getOssosParaOferecer() { | |
return ossosParaOferecer; | |
} | |
public void setOssosParaOferecer(String ossosParaOferecer) { | |
this.ossosParaOferecer = ossosParaOferecer; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.tarefas; | |
import com.runemate.game.api.hybrid.region.GameObjects; | |
import com.runemate.game.api.hybrid.region.Npcs; | |
import com.runemate.game.api.hybrid.region.Players; | |
import com.runemate.game.api.rs3.local.hud.interfaces.Lodestone; | |
import com.runemate.game.api.script.Execution; | |
import com.runemate.game.api.script.framework.task.Task; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class TeleportarParaWild extends Task { | |
@Override | |
public void execute() { | |
System.out.println("Tentando teleportar para Wild..."); | |
if(Lodestone.isInterfaceOpen() || Lodestone.openInterface()) { | |
Execution.delayUntil(() -> Lodestone.isInterfaceOpen(), 5000); | |
if (Lodestone.WILDERNESS_VOLCANO.teleport()) { | |
Execution.delayUntil(() -> Npcs.newQuery().names("Goblin musician").results().nearest() != null, 15000); | |
} | |
} | |
} | |
@Override | |
public boolean validate() { | |
return Players.getLocal().getAnimationId() == -1 && | |
GameObjects.newQuery().names("Coffin").results().nearest() != null || | |
Players.getLocal().getWildernessDepth() == 0; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.tarefas; | |
import com.runemate.game.api.hybrid.entities.GameObject; | |
import com.runemate.game.api.hybrid.input.Mouse; | |
import com.runemate.game.api.hybrid.local.Camera; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Bank; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory; | |
import com.runemate.game.api.hybrid.region.GameObjects; | |
import com.runemate.game.api.hybrid.region.Players; | |
import com.runemate.game.api.script.Execution; | |
import com.runemate.game.api.script.framework.task.Task; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class UsarNoAltar extends Task{ | |
private String ossoParaUsar; | |
public UsarNoAltar(String ossoParaUsar){ | |
this.ossoParaUsar = ossoParaUsar; | |
} | |
@Override | |
public void execute() { | |
final GameObject altar = GameObjects.newQuery().names("Chaos altar").results().nearest(); | |
//status = "Tentando usar o osso selecionado no altar..."; | |
System.out.println("Tentando usar o osso selecionado no altar...."); | |
if (altar != null){ | |
if (!altar.isVisible()){ | |
if (Camera.turnTo(altar)){ | |
//status = "Altar encontrado! Virando a camera para ele..."; | |
System.out.println("Altar encontrado! Virando a camera para ele..."); | |
} | |
} else { | |
if (altar.click()){ | |
//status = "Usando o osso selecionado no altar...."; | |
System.out.println("Usando o osso selecionado no altar...."); | |
Execution.delayUntil(() -> Players.getLocal().getAnimationId() == -1, 1200); | |
} | |
} | |
} | |
} | |
@Override | |
public boolean validate() { | |
return (Inventory.isFull() || Inventory.contains(ossoParaUsar)) && | |
Players.getLocal().getAnimationId() == -1 && | |
!Bank.isOpen() && | |
Inventory.getSelectedItem() != null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package oferecedor.tarefas; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Bank; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory; | |
import com.runemate.game.api.hybrid.local.hud.interfaces.SpriteItem; | |
import com.runemate.game.api.hybrid.region.Players; | |
import com.runemate.game.api.script.Execution; | |
import com.runemate.game.api.script.framework.task.Task; | |
/** | |
* Created by Lucas Sousa on 01/03/17. | |
*/ | |
public class UsarOssoDaBag extends Task { | |
private String ossosParaUsar; | |
public UsarOssoDaBag(String ossosParaUsar){ | |
this.ossosParaUsar = ossosParaUsar; | |
} | |
@Override | |
public void execute() { | |
final SpriteItem osso = Inventory.getItems(ossosParaUsar).first(); | |
//status = "Tentando usar um osso da bag..."; | |
System.out.println("Tentando usar um osso da bag..."); | |
if (osso != null){ | |
if (osso.interact("Use")){ | |
//status = "Usando um osso da bag..."; | |
System.out.println("Usando um osso da bag..."); | |
//TODO continua "usando" o osso enquanto player esta em movimento | |
Execution.delayUntil(() -> Inventory.getSelectedItem() != null, 1200); | |
} | |
} | |
} | |
@Override | |
public boolean validate() { | |
return (Inventory.isFull() || Inventory.contains(ossosParaUsar)) && | |
Players.getLocal().getAnimationId() == -1 && | |
!Bank.isOpen() && | |
Inventory.getSelectedItem() == null; | |
} | |
public String getOssosParaUsar() { | |
return ossosParaUsar; | |
} | |
public void setOssosParaUsar(String ossosParaUsar) { | |
this.ossosParaUsar = ossosParaUsar; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment