Merge remote-tracking branch 'origin/master'

This commit is contained in:
Woah
2021-03-20 23:49:29 -04:00
16 changed files with 1178 additions and 1179 deletions
+4
View File
@@ -10578,6 +10578,10 @@
{ {
"npc_id": "487", "npc_id": "487",
"loc_data": "{1885,5029,0,0,6}" "loc_data": "{1885,5029,0,0,6}"
},
{
"npc_id": "555",
"loc_data": "{2657,3153,0,1,0}"
} }
] ]
File diff suppressed because it is too large Load Diff
@@ -1,30 +1,30 @@
package core.game.content.activity.tzhaar; package core.game.content.activity.tzhaar;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import core.game.content.activity.ActivityPlugin; import core.game.content.activity.ActivityPlugin;
import core.game.content.global.BossKillCounter; import core.game.content.global.BossKillCounter;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.slayer.Tasks;
import core.game.interaction.Option; import core.game.interaction.Option;
import core.game.node.Node; import core.game.node.Node;
import core.game.node.entity.Entity; import core.game.node.entity.Entity;
import core.game.node.entity.npc.NPC; import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player; import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.diary.DiaryType; import core.game.node.entity.player.link.diary.DiaryType;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.slayer.Tasks;
import core.game.node.item.GroundItemManager; import core.game.node.item.GroundItemManager;
import core.game.node.item.Item; import core.game.node.item.Item;
import core.game.node.object.GameObject; import core.game.node.object.GameObject;
import core.game.system.task.Pulse; import core.game.system.task.Pulse;
import rs09.game.world.GameWorld;
import core.game.world.map.Location; import core.game.world.map.Location;
import core.game.world.map.build.DynamicRegion; import core.game.world.map.build.DynamicRegion;
import core.game.world.map.zone.ZoneRestriction; import core.game.world.map.zone.ZoneRestriction;
import rs09.game.world.repository.Repository;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.tools.RandomFunction; import core.tools.RandomFunction;
import rs09.game.world.GameWorld;
import rs09.game.world.repository.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/** /**
* Handles the Tzhaar Fight caves plugin. * Handles the Tzhaar Fight caves plugin.
@@ -60,7 +60,7 @@ public final class TzhaarFightCavesPlugin extends ActivityPlugin {
* @param player The player. * @param player The player.
*/ */
public TzhaarFightCavesPlugin(Player player) { public TzhaarFightCavesPlugin(Player player) {
super("fight caves", true, true, true, ZoneRestriction.CANNON); super("fight caves", true, true, true, ZoneRestriction.CANNON, ZoneRestriction.RANDOM_EVENTS);
super.player = player; super.player = player;
} }
@@ -9,6 +9,8 @@ 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
import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
@PlayerCompatible @PlayerCompatible
@ScriptName("Falador Coal Miner") @ScriptName("Falador Coal Miner")
@@ -52,7 +54,7 @@ class CoalMiner() : Script() {
scriptAPI.walkTo(mine.randomLoc) scriptAPI.walkTo(mine.randomLoc)
} else { } else {
val rock = scriptAPI.getNearestNode("rocks",true) val rock = scriptAPI.getNearestNode("rocks",true)
rock?.interaction?.handle(bot,rock.interaction[0]) rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) }
} }
overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount) overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount)
} }
@@ -7,6 +7,8 @@ import core.game.node.entity.skill.Skills
import core.game.node.item.Item import core.game.node.item.Item
import core.game.world.map.zone.ZoneBorders import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import rs09.tools.stringtools.colorize import rs09.tools.stringtools.colorize
@PlayerCompatible @PlayerCompatible
@@ -39,7 +41,8 @@ class DraynorWillows : Script(){
scriptAPI.walkTo(willowZone.randomLoc) scriptAPI.walkTo(willowZone.randomLoc)
else { else {
val willowtree = scriptAPI.getNearestNode("willow", true) val willowtree = scriptAPI.getNearestNode("willow", true)
willowtree?.interaction?.handle(bot, willowtree.interaction[0]) willowtree?.let { InteractionListeners.run(willowtree.id,
InteractionListener.OBJECT,"chop",bot,willowtree) }
if (bot.inventory.isFull) if (bot.inventory.isFull)
state = State.BANKING state = State.BANKING
} }
@@ -13,6 +13,8 @@ import core.tools.RandomFunction
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.AIPlayer import rs09.game.ai.AIPlayer
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
import kotlin.random.Random import kotlin.random.Random
@@ -71,7 +73,7 @@ class LobsterCatcher : Script() {
if(spot == null){ if(spot == null){
state = State.IDLE state = State.IDLE
} else { } else {
spot!!.interaction.handle(bot, spot.interaction[0]) InteractionListeners.run(spot.id,InteractionListener.NPC,"cage",bot,spot)
} }
if(bot.inventory.isFull){ if(bot.inventory.isFull){
state = State.FIND_BANK state = State.FIND_BANK
@@ -10,6 +10,8 @@ import core.tools.RandomFunction
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
@PlayerCompatible @PlayerCompatible
@ScriptName("Seers Magics") @ScriptName("Seers Magics")
@@ -37,7 +39,7 @@ class SeersMagicTrees : Script(){
State.CHOPPING -> { State.CHOPPING -> {
val tree = scriptAPI.getNearestNode(1306,true) val tree = scriptAPI.getNearestNode(1306,true)
tree?.interaction?.handle(bot,tree.interaction[0]) tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) }
if(bot.inventory.isFull){ if(bot.inventory.isFull){
state = State.FIND_BANK state = State.FIND_BANK
} }
@@ -10,6 +10,8 @@ import org.rs09.consts.Items
import rs09.game.ai.AIPlayer import rs09.game.ai.AIPlayer
import rs09.game.ai.general.ScriptAPI import rs09.game.ai.general.ScriptAPI
import rs09.game.ge.OfferManager import rs09.game.ge.OfferManager
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
import kotlin.random.Random import kotlin.random.Random
/* /*
@@ -115,7 +117,7 @@ class SharkCatcher : Script() {
if (Random.nextBoolean()) { if (Random.nextBoolean()) {
tick = 0 tick = 0
val spot = scriptAPI.getNearestNode(334, false) val spot = scriptAPI.getNearestNode(334, false)
spot!!.interaction.handle(bot, spot.interaction[2]) spot?.let { InteractionListeners.run(spot.id, InteractionListener.NPC,"harpoon",bot,spot) }
if(bot.inventory.isFull){ if(bot.inventory.isFull){
state = State.FIND_BANK state = State.FIND_BANK
} else { } else {
@@ -6,6 +6,8 @@ import core.game.world.map.Location
import core.game.world.map.zone.ZoneBorders import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.Items import org.rs09.consts.Items
import rs09.game.ai.skillingbot.SkillingBotAssembler import rs09.game.ai.skillingbot.SkillingBotAssembler
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.InteractionListeners
@PlayerCompatible @PlayerCompatible
@ScriptDescription("Start in varrock bank with rune mysteries complete and a pickaxe equipped/in inventory") @ScriptDescription("Start in varrock bank with rune mysteries complete and a pickaxe equipped/in inventory")
@@ -47,7 +49,7 @@ class VarrockEssenceMiner : Script(){
State.MINING -> { State.MINING -> {
val essence = scriptAPI.getNearestNode(2491,true) val essence = scriptAPI.getNearestNode(2491,true)
essence?.interaction?.handle(bot,essence.interaction[0]) essence?.let { InteractionListeners.run(essence.id, InteractionListener.OBJECT,"mine",bot,essence) }
if(bot.inventory.isFull) if(bot.inventory.isFull)
state = State.TO_BANK state = State.TO_BANK
} }
@@ -1,6 +1,7 @@
package rs09.game.content.ame package rs09.game.content.ame
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.world.map.zone.ZoneRestriction
import rs09.game.system.SystemLogger import rs09.game.system.SystemLogger
import rs09.game.world.GameWorld import rs09.game.world.GameWorld
@@ -15,6 +16,9 @@ class RandomEventManager(val player: Player) {
} }
fun fireEvent(){ fun fireEvent(){
if(player.zoneMonitor.isRestricted(ZoneRestriction.RANDOM_EVENTS)){
return
}
val ame = RandomEvents.values().random() val ame = RandomEvents.values().random()
event = ame.npc.create(player,ame.loot,ame.type) event = ame.npc.create(player,ame.loot,ame.type)
event!!.init() event!!.init()
@@ -11,14 +11,14 @@ class CerterEventInterface : InterfaceListener() {
val OPTION_C_CHILD = 3 val OPTION_C_CHILD = 3
val ITEM_CHILD = 7 val ITEM_CHILD = 7
val items = mapOf( val items = mapOf(
Items.BRONZE_SCIMITAR_1321 to "a sword", Items.BLACK_SWORD_1283 to "a sword",
Items.BRONZE_SWORD_1277 to "a sword", Items.BRONZE_SWORD_1277 to "a sword",
Items.BRONZE_MED_HELM_1139 to "a helmet", Items.BRONZE_CHAINBODY_1103 to "a platebody",
Items.BRONZE_FULL_HELM_1155 to "a helmet", Items.BLACK_CHAINBODY_1107 to "a platebody",
Items.WOODEN_SHIELD_1171 to "a shield", Items.WOODEN_SHIELD_1171 to "a shield",
Items.BRONZE_KITESHIELD_1189 to "a shield", Items.BRONZE_KITESHIELD_1189 to "a shield",
) )
val falseOptions = arrayOf("a ring","a dragon","a cat","a chestplate","a pair of boots","a fish","a gun","a staff","a cannon","a dwarf","a bow","an arrow","a chinchompa","a chicken","a feather","a ninja","a bot") val falseOptions = arrayOf("a ring","a dragon","a cat","a helmet","a pair of boots","a fish","a gun","a staff","a cannon","a dwarf","a bow","an arrow","a chinchompa","a chicken","a feather","a ninja","a bot")
override fun defineListeners() { override fun defineListeners() {
on(CERTER_INTERFACE){player, _, _, buttonID, _, _ -> on(CERTER_INTERFACE){player, _, _, buttonID, _, _ ->
val answer = buttonID - 7 val answer = buttonID - 7
@@ -5,9 +5,11 @@ import core.game.node.entity.player.Player
import core.game.world.map.Location import core.game.world.map.Location
abstract class InteractionListener : Listener{ abstract class InteractionListener : Listener{
val ITEM = 0 companion object {
val OBJECT = 1 val ITEM = 0
val NPC = 2 val OBJECT = 1
val NPC = 2
}
fun on(id: Int, type: Int, vararg option: String,handler: (player: Player, node: Node) -> Boolean){ fun on(id: Int, type: Int, vararg option: String,handler: (player: Player, node: Node) -> Boolean){
InteractionListeners.add(id,type,option,handler) InteractionListeners.add(id,type,option,handler)
} }
@@ -9,7 +9,7 @@ import org.rs09.consts.Items
import rs09.game.node.entity.state.newsys.states.SeedlingState import rs09.game.node.entity.state.newsys.states.SeedlingState
private val cans = arrayListOf(Items.WATERING_CAN8_5340,Items.WATERING_CAN7_5339,Items.WATERING_CAN6_5338,Items.WATERING_CAN5_5337,Items.WATERING_CAN4_5336,Items.WATERING_CAN3_5335,Items.WATERING_CAN2_5334,Items.WATERING_CAN1_5333) private val cans = arrayListOf(Items.WATERING_CAN8_5340,Items.WATERING_CAN7_5339,Items.WATERING_CAN6_5338,Items.WATERING_CAN5_5337,Items.WATERING_CAN4_5336,Items.WATERING_CAN3_5335,Items.WATERING_CAN2_5334,Items.WATERING_CAN1_5333)
private val seedlings = arrayListOf(Items.OAK_SEEDLING_5358,Items.WILLOW_SEEDLING_5359,Items.MAPLE_SEEDLING_5360,Items.YEW_SEEDLING_5361,Items.MAGIC_SEEDLING_5362) private val seedlings = arrayListOf(Items.OAK_SEEDLING_5358,Items.WILLOW_SEEDLING_5359,Items.MAPLE_SEEDLING_5360,Items.YEW_SEEDLING_5361,Items.MAGIC_SEEDLING_5362,Items.APPLE_TREE_SEED_5283,Items.BANANA_TREE_SEED_5284,Items.ORANGE_TREE_SEED_5285,Items.CURRY_TREE_SEED_5286,Items.PINEAPPLE_SEED_5287,Items.PAPAYA_TREE_SEED_5288,Items.PALM_TREE_SEED_5289)
@Initializable @Initializable
class SeedlingWaterer : UseWithHandler(*cans.toIntArray()) { class SeedlingWaterer : UseWithHandler(*cans.toIntArray()) {
@@ -164,7 +164,7 @@ object UseWithPatchHandler{
return true return true
} }
} }
player.lock()
if(player.inventory.remove(plantItem)) { if(player.inventory.remove(plantItem)) {
player.animator.animate(Animation(2291)) player.animator.animate(Animation(2291))
player.pulseManager.run(object : Pulse(3) { player.pulseManager.run(object : Pulse(3) {
@@ -175,6 +175,7 @@ object UseWithPatchHandler{
if(p.patch.type == PatchType.TREE || p.patch.type == PatchType.FRUIT_TREE){ if(p.patch.type == PatchType.TREE || p.patch.type == PatchType.FRUIT_TREE){
player.inventory.add(Item(Items.PLANT_POT_5356)) player.inventory.add(Item(Items.PLANT_POT_5356))
} }
player.unlock()
return true return true
} }
}) })
@@ -51,16 +51,16 @@ class BarbFishingPulse(player: Player) : SkillPulse<NPC>(player,NPC(1176)) {
val stragiXP = arrayOf(5,6,7) val stragiXP = arrayOf(5,6,7)
val fishXP = arrayOf(50,70,80) val fishXP = arrayOf(50,70,80)
val reward = getRandomFish() val reward = getRandomFish()
val success = rollSuccess(when(reward){ val success = rollSuccess(when(reward.id){
Item(11328) -> 48 11328 -> 48
Item(11330) -> 58 11330 -> 58
Item(11332) -> 70 11332 -> 70
else -> 99 else -> 99
}) })
val index = (when(reward){ val index = (when(reward.id){
Item(11328) -> 0 11328 -> 0
Item(11330) -> 1 11330 -> 1
Item(11332) -> 2 11332 -> 2
else -> 0 else -> 0
}) })
if(success){ if(success){
@@ -41,7 +41,8 @@ enum class Pickpockets(val ids: IntArray, val requiredLevel: Int, val low: Doubl
WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5), WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5),
WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5), WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5),
WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2), WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2),
WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1) WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1),
WeightedItem(Items.BUTTONS_688,1,1,3.0)
).insertEasyClue(1.0)), ).insertEasyClue(1.0)),
FEMALE_HAM_MEMBER(intArrayOf(1715), 15, 135.0, 240.0, 18.5, 1,3,4, WeightBasedTable.create( FEMALE_HAM_MEMBER(intArrayOf(1715), 15, 135.0, 240.0, 18.5, 1,3,4, WeightBasedTable.create(
WeightedItem(Items.COINS_995,1,21,5.5), WeightedItem(Items.COINS_995,1,21,5.5),
@@ -67,7 +68,8 @@ enum class Pickpockets(val ids: IntArray, val requiredLevel: Int, val low: Doubl
WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5), WeightedItem(Items.RUSTY_SWORD_686,1,1,3.5),
WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5), WeightedItem(Items.BROKEN_ARMOUR_698,1,1,3.5),
WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2), WeightedItem(Items.BROKEN_STAFF_689,1,1,3.2),
WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1) WeightedItem(Items.BROKEN_ARROW_687,1,1,3.1),
WeightedItem(Items.BUTTONS_688,1,1,3.0)
).insertEasyClue(1.0)), ).insertEasyClue(1.0)),
WARRIOR(intArrayOf(15, 18), 25, 84.0, 240.0, 26.0, 2, 2, 5, WeightBasedTable.create( WARRIOR(intArrayOf(15, 18), 25, 84.0, 240.0, 26.0, 2, 2, 5, WeightBasedTable.create(
WeightedItem(Items.COINS_995,18,18,1.0,true) WeightedItem(Items.COINS_995,18,18,1.0,true)