mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Fixes for 'perfect gold' smelting, mining and a prospecting bug for depleted rocks
This commit is contained in:
parent
051d6d09ec
commit
0812cfa0c7
4 changed files with 41 additions and 24 deletions
|
|
@ -107,7 +107,7 @@ public final class FurnaceOptionPlugin extends OptionHandler {
|
|||
/**
|
||||
* Represents the ids.
|
||||
*/
|
||||
private static final int[] IDS = new int[] { 4304, 6189, 11010, 11666, 12100, 12809, 14921, 18497, 26814, 30021, 30510, 36956, 37651 };
|
||||
public static final int[] furnaceIDS = new int[] { 4304, 6189, 11010, 11666, 12100, 12809, 14921, 18497, 26814, 30021, 30510, 36956, 37651 };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SmeltUseWithHandler} {@code Object}.
|
||||
|
|
@ -118,7 +118,7 @@ public final class FurnaceOptionPlugin extends OptionHandler {
|
|||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int i : IDS) {
|
||||
for (int i : furnaceIDS) {
|
||||
addHandler(i, OBJECT_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
package plugin.quest.members.familycrest
|
||||
|
||||
|
||||
import api.addItem
|
||||
import api.animate;
|
||||
import api.removeItem
|
||||
import core.game.interaction.NodeUsageEvent
|
||||
import core.game.interaction.UseWithHandler
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.node.entity.skill.smithing.FurnaceOptionPlugin
|
||||
import core.game.system.task.Pulse
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
|
@ -15,11 +18,12 @@ import rs09.game.world.GameWorld.Pulser
|
|||
@Initializable
|
||||
class PerfectGoldSmeltingHandler : UseWithHandler(Items.PERFECT_GOLD_ORE_446){
|
||||
|
||||
val furnaceIDs = listOf(2349, 2351, 2353, 2359, 2361, 2363, 2366, 2368, 9467, 11286, 1540, 11710, 11712, 11714, 11666, 11686, 11688, 11692)
|
||||
|
||||
private val furnaceIDs: IntArray = FurnaceOptionPlugin.SmeltUseWithHandler.furnaceIDS;
|
||||
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
for(furnaces in furnaceIDs){
|
||||
addHandler(furnaces, OBJECT_TYPE, this)
|
||||
for(furnace in furnaceIDs){
|
||||
addHandler(furnace, OBJECT_TYPE, this)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
|
@ -27,16 +31,18 @@ class PerfectGoldSmeltingHandler : UseWithHandler(Items.PERFECT_GOLD_ORE_446){
|
|||
override fun handle(event: NodeUsageEvent?): Boolean {
|
||||
|
||||
event ?: return false
|
||||
val player = event.player
|
||||
|
||||
Pulser.submit(object : Pulse(2, event.player) {
|
||||
Pulser.submit(object : Pulse(2, player) {
|
||||
override fun pulse(): Boolean {
|
||||
event.player.inventory.remove(Item(446))
|
||||
event.player.inventory.add(Item(2365))
|
||||
event.player.skills.addExperience(Skills.SMITHING,22.5)
|
||||
if(removeItem(player,Items.PERFECT_GOLD_ORE_446)){
|
||||
animate(player,3243)
|
||||
addItem(player,Items.PERFECT_GOLD_BAR_2365)
|
||||
player.skills.addExperience(Skills.SMITHING,22.5)
|
||||
}
|
||||
return true
|
||||
}
|
||||
})
|
||||
return true
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import core.game.container.impl.EquipmentContainer
|
|||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.content.global.SkillingPets
|
||||
import core.game.node.Node
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.node.entity.impl.Animator
|
||||
import core.game.node.entity.npc.drop.DropFrequency
|
||||
import core.game.node.entity.player.Player
|
||||
|
|
@ -18,7 +16,10 @@ import core.game.node.entity.skill.gather.SkillingTool
|
|||
import core.game.node.entity.skill.gather.mining.MiningNode
|
||||
import core.game.node.item.ChanceItem
|
||||
import core.game.node.item.Item
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.tools.RandomFunction
|
||||
import core.tools.StringUtils
|
||||
|
|
@ -37,6 +38,15 @@ class MiningSkillPulse(private val player: Player, private val node: Node) : Pul
|
|||
private var isMiningGems = false
|
||||
private var ticks = 0
|
||||
protected var resetAnimation = true
|
||||
|
||||
// Perfect Gold Ore in Witchhaven Dungeon (Family Crest)
|
||||
private val perfectGoldOreLocations = listOf(
|
||||
Location(2735, 9695, 0),
|
||||
Location(2737, 9689, 0),
|
||||
Location(2740, 9684, 0),
|
||||
Location(2737, 9683, 0),
|
||||
)
|
||||
|
||||
fun message(type: Int) {
|
||||
if (type == 0) {
|
||||
player.packetDispatch.sendMessage("You swing your pickaxe at the rock...")
|
||||
|
|
@ -67,6 +77,12 @@ class MiningSkillPulse(private val player: Player, private val node: Node) : Pul
|
|||
if (resource == null) {
|
||||
return
|
||||
}
|
||||
if (resource!!.id == 2099 &&
|
||||
!perfectGoldOreLocations.contains(node.location) ) {
|
||||
// Perfect Gold Ore Id's outside of Witchhaven
|
||||
// are replaced with a normal gold rock.
|
||||
resource = MiningNode.forId(2098)
|
||||
}
|
||||
if (resource!!.id == 2491) {
|
||||
isMiningEssence = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package rs09.game.interaction.`object`
|
||||
package rs09.game.node.entity.skill.gather.mining
|
||||
|
||||
import api.*
|
||||
import core.game.node.entity.skill.gather.SkillingResource
|
||||
|
|
@ -14,13 +14,13 @@ class ProspectListener : InteractionListener {
|
|||
|
||||
override fun defineListeners() {
|
||||
on(SCENERY, "prospect") { player, node ->
|
||||
val rock = SkillingResource.forId(node.id)
|
||||
if(rock == null) {
|
||||
sendMessage(player, "There is no ore currently available in this rock.")
|
||||
return@on true
|
||||
}
|
||||
/** Check if the rock contains gems */
|
||||
if(MiningNode.forId(node.id).identifier == 13.toByte()) {
|
||||
val rock = SkillingResource.forId(node.asScenery().id)
|
||||
if(rock == null) {
|
||||
sendMessage(player, "There is no ore currently available in this rock.")
|
||||
return@on true
|
||||
}
|
||||
sendMessage(player,"You examine the rock for ores...")
|
||||
/** Send a simple text string saying it's a gem rock */
|
||||
player.pulseManager.run(object : Pulse(3) {
|
||||
|
|
@ -32,11 +32,6 @@ class ProspectListener : InteractionListener {
|
|||
}
|
||||
/** If it doesn't contain gems */
|
||||
else {
|
||||
val rock = SkillingResource.forId(node.id)
|
||||
if(rock == null) {
|
||||
sendMessage(player, "There is no ore currently available in this rock.")
|
||||
return@on true
|
||||
}
|
||||
sendMessage(player,"You examine the rock for ores...")
|
||||
/** Get the name of the rock's reward and sends a message to the player */
|
||||
player.pulseManager.run(object : Pulse(3) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue