Merge remote-tracking branch 'upstream/master'

This commit is contained in:
skelsoft
2021-07-19 10:24:48 +10:00
3 changed files with 154 additions and 80 deletions
+106 -70
View File
@@ -2213,123 +2213,159 @@
"main": [ "main": [
{ {
"minAmount": "1", "minAmount": "1",
"weight": "125.0", "weight": "50.0",
"id": "1369",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "50.0",
"id": "1315",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "25.0",
"id": "1357",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "25.0",
"id": "1317",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "50.0",
"id": "1303", "id": "1303",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "100.0", "weight": "50.0",
"id": "1123", "id": "1123",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "105",
"weight": "125.0", "weight": "25.0",
"id": "1199",
"maxAmount": "1"
},
{
"minAmount": "300",
"weight": "125.0",
"id": "554",
"maxAmount": "300"
},
{
"minAmount": "300",
"weight": "125.0",
"id": "556", "id": "556",
"maxAmount": "300" "maxAmount": "105"
}, },
{ {
"minAmount": "30", "minAmount": "105",
"weight": "50.0", "weight": "25.0",
"id": "565", "id": "554",
"maxAmount": "30" "maxAmount": "105"
}, },
{ {
"minAmount": "50", "minAmount": "7",
"weight": "50.0", "weight": "8.0",
"id": "560", "id": "560",
"maxAmount": "50" "maxAmount": "7"
}, },
{ {
"minAmount": "30", "minAmount": "15",
"weight": "75.0", "weight": "8.0",
"id": "565",
"maxAmount": "15"
},
{
"minAmount": "15",
"weight": "8.0",
"id": "563", "id": "563",
"maxAmount": "50" "maxAmount": "15"
}, },
{ {
"minAmount": "690", "minAmount": "690",
"weight": "100.0", "weight": "25.0",
"id": "884", "id": "884",
"maxAmount": "690" "maxAmount": "690"
}, },
{ {
"minAmount": "10", "minAmount": "1",
"weight": "50.0", "weight": "8.0",
"id": "9144", "id": "9144",
"maxAmount": "25" "maxAmount": "12"
},
{
"minAmount": "5",
"weight": "100.0",
"id": "11232",
"maxAmount": "14"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "75.0", "weight": "50.0",
"id": "11237", "id": "1725",
"maxAmount": "14"
},
{
"minAmount": "1",
"weight": "75.0",
"id": "1737",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "150", "minAmount": "100",
"weight": "75.0", "weight": "25.0",
"id": "441",
"maxAmount": "100"
},
{
"minAmount": "100",
"weight": "25.0",
"id": "454",
"maxAmount": "100"
},
{
"minAmount": "100",
"weight": "25.0",
"id": "1516", "id": "1516",
"maxAmount": "150" "maxAmount": "100"
},
{
"minAmount": "1",
"weight": "50.0",
"id": "9431",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "25.0",
"id": "2361",
"maxAmount": "1"
}, },
{ {
"minAmount": "4", "minAmount": "4",
"weight": "125.0", "weight": "25.0",
"id": "385", "id": "385",
"maxAmount": "4" "maxAmount": "4"
}, },
{
"minAmount": "100",
"weight": "100.0",
"id": "445",
"maxAmount": "100"
},
{
"minAmount": "3",
"weight": "50.0",
"id": "9431",
"maxAmount": "3"
},
{
"minAmount": "3",
"weight": "50.0",
"id": "2361",
"maxAmount": "3"
},
{ {
"minAmount": "1", "minAmount": "1",
"weight": "20.0", "weight": "8.0",
"id": "2677", "id": "407",
"maxAmount": "1" "maxAmount": "1"
}, },
{ {
"minAmount": "1", "minAmount": "1",
"weight": "0.3", "weight": "8.0",
"id": "12070",
"maxAmount": "1"
},
{
"minAmount": "30",
"weight": "50.0",
"id": "995",
"maxAmount": "690"
},
{
"minAmount": "1",
"weight": "0.18",
"id": "11286", "id": "11286",
"maxAmount": "1" "maxAmount": "1"
},
{
"minAmount": "1",
"weight": "100.0",
"id": "0",
"maxAmount": "1"
},
{
"minAmount": "1",
"weight": "23.15",
"id": "31",
"maxAmount": "1"
} }
] ]
}, },
@@ -213,10 +213,13 @@ class ScriptAPI(private val bot: Player) {
* @param id the id to look for * @param id the id to look for
* @author Ceikry * @author Ceikry
*/ */
fun takeNearestGroundItem(id: Int){ fun takeNearestGroundItem(id: Int) : Boolean{
val item = getNearestGroundItem(id) val item = getNearestGroundItem(id)
if(item != null) if(item != null){
item.interaction?.handle(bot, item.interaction[2]) item.interaction?.handle(bot, item.interaction[2])
return true
}
else return false
} }
/** /**
@@ -1,6 +1,8 @@
package rs09.game.ai.general.scriptrepository package rs09.game.ai.general.scriptrepository
import core.game.node.item.Item
import core.game.world.map.Location import core.game.world.map.Location
import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
@@ -15,10 +17,12 @@ class ChickenKiller : Script(){
var startLocation = Location(0,0,0) var startLocation = Location(0,0,0)
var timer = 3 var timer = 3
var lootFeathers = false var lootFeathers = false
var featherNearby = false
var currentFeathers = 0
val chickenPen = ZoneBorders(3231,3300,3235,3287)
override fun tick() { override fun tick() {
when(state){ when(state){
State.INIT -> { State.INIT -> {
overlay = scriptAPI.getOverlay() overlay = scriptAPI.getOverlay()
overlay!!.init() overlay!!.init()
@@ -26,7 +30,7 @@ class ChickenKiller : Script(){
overlay!!.setTaskLabel("Chickens KO'd:") overlay!!.setTaskLabel("Chickens KO'd:")
overlay!!.setAmount(0) overlay!!.setAmount(0)
state = State.CONFIG state = State.CONFIG
bot.dialogueInterpreter.sendOptions("Loot Feathers?","Yes","No") bot.dialogueInterpreter.sendOptions("Loot Feathers and bury bones?","Yes","No")
bot.dialogueInterpreter.addAction{player,button -> bot.dialogueInterpreter.addAction{player,button ->
lootFeathers = button == 2 lootFeathers = button == 2
state = State.KILLING state = State.KILLING
@@ -51,15 +55,43 @@ class ChickenKiller : Script(){
State.IDLE -> { State.IDLE -> {
if(timer-- <= 0){ if(timer-- <= 0){
state = State.LOOTING featherNearby = scriptAPI.takeNearestGroundItem(Items.FEATHER_314)
currentFeathers = 0
if (featherNearby) {
state = State.LOOTFEATHER
}else{
state = State.LOOTBONES
}
} }
} }
State.LOOTING -> { State.LOOTFEATHER -> {
timer = 1
if(timer-- >= 0) {
currentFeathers = bot.inventory.getAmount(Items.FEATHER_314)
scriptAPI.takeNearestGroundItem(Items.FEATHER_314) scriptAPI.takeNearestGroundItem(Items.FEATHER_314)
featherNearby = false
}
state = State.LOOTBONES
}
State.LOOTBONES -> {
timer = 1
if(timer-- >= 0){
scriptAPI.takeNearestGroundItem(Items.BONES_526)
}
state = State.BURYBONES
}
State.BURYBONES -> {
timer = 1
var hasBone = bot.hasItem(Item(Items.BONES_526))
var bone = bot.inventory.getItem(Item(Items.BONES_526))
if (hasBone) {
bone.interaction.handleItemOption(bot,bone.interaction.get(0),bot.inventory)
}
state = State.KILLING state = State.KILLING
} }
} }
} }
@@ -73,6 +105,9 @@ class ChickenKiller : Script(){
KILLING, KILLING,
LOOTING, LOOTING,
RETURN, RETURN,
CONFIG CONFIG,
LOOTFEATHER,
LOOTBONES,
BURYBONES
} }
} }