point to latest OPRS version
UtilsScript: add chatOptionalNPC() function
This commit is contained in:
parent
5c9a5afb39
commit
d8e5e482f0
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
object ProjectVersions {
|
||||
const val openosrsVersion = "4.6.0"
|
||||
const val openosrsVersion = "4.8.1"
|
||||
const val apiVersion = "^1.0.0"
|
||||
}
|
||||
|
||||
|
|
|
@ -307,6 +307,16 @@ public abstract class UtilsScript extends Plugin {
|
|||
game.tick();
|
||||
}
|
||||
|
||||
protected void chatOptionalNpc(Area area, String npcName, String... chatOptions) {
|
||||
if (area != null && !area.contains(game.localPlayer().position())) {
|
||||
walking.walkTo(area);
|
||||
}
|
||||
|
||||
game.npcs().withName(npcName).nearest().interact("Talk-to");
|
||||
chatbox.chats(Arrays.asList(chatOptions));
|
||||
game.tick();
|
||||
}
|
||||
|
||||
protected void unequip(String item, EquipmentSlot slot) {
|
||||
if (game.equipment().withName(item).exists()) {
|
||||
game.widget(slot.widgetID, slot.widgetChild).interact(0);
|
||||
|
|
|
@ -50,6 +50,9 @@ public class Chatbox {
|
|||
continueChats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose chat option in order of given chat options. Will fail if chat option isn't found.
|
||||
*/
|
||||
public void chat(String... options) {
|
||||
game.waitUntil(() -> chatState() != ChatState.CLOSED, 100);
|
||||
|
||||
|
@ -72,6 +75,9 @@ public class Chatbox {
|
|||
continueChats();
|
||||
}
|
||||
|
||||
/**
|
||||
* Choose chat option from any given chat options
|
||||
*/
|
||||
public void chats(Collection<String> options) {
|
||||
game.waitUntil(() -> chatState() != ChatState.CLOSED);
|
||||
|
||||
|
@ -195,7 +201,7 @@ public class Chatbox {
|
|||
|
||||
public String findFromOptions(Collection<String> options) {
|
||||
if (chatState() == ChatState.CLOSED || chatState() != ChatState.OPTIONS_CHAT) {
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
for (var i = 0; i < game.widget(219, 1).items().size(); i++) {
|
||||
|
|
Loading…
Reference in New Issue