From fad311e741e98f6cba52ca1c13ea5ffb0b599080 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 02:58:11 -0400 Subject: [PATCH 01/15] Allow custom prospect ore names --- game/plugin/skills/mining/src/Ore.kt | 7 ++++++- game/plugin/skills/mining/src/ProspectingAction.kt | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index 1f4a94ff9..0e313361e 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -17,7 +17,8 @@ enum class Ore( val exp: Double, val respawn: Int, val chance: Double, - val chanceOffset: Double = 0.0 + val chanceOffset: Double = 0.0, + val prospectOreName: String? = null ) { CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), @@ -150,4 +151,8 @@ val RUNITE_OBJECTS = mapOf( 14859 to 14832, 14860 to 14833, 14861 to 14834 +) + +val ESSENCE_OBJECTS = mapOf( + 2491 to -1 ) \ No newline at end of file diff --git a/game/plugin/skills/mining/src/ProspectingAction.kt b/game/plugin/skills/mining/src/ProspectingAction.kt index 10bf83a11..2101b9477 100644 --- a/game/plugin/skills/mining/src/ProspectingAction.kt +++ b/game/plugin/skills/mining/src/ProspectingAction.kt @@ -1,4 +1,4 @@ -import java.util.Objects + import org.apollo.game.action.ActionBlock import org.apollo.game.action.AsyncDistancedAction import org.apollo.game.message.impl.ObjectActionMessage @@ -7,6 +7,7 @@ import org.apollo.game.model.entity.Player import org.apollo.game.plugin.api.Definitions import org.apollo.game.plugin.skills.mining.Ore import org.apollo.net.message.Message +import java.util.Objects class ProspectingAction( player: Player, @@ -35,7 +36,7 @@ class ProspectingAction( wait() - val oreName = Definitions.item(ore.id)?.name?.toLowerCase() + val oreName = ore.prospectOreName ?: Definitions.item(ore.id).name?.toLowerCase() mob.sendMessage("This rock contains $oreName.") stop() From 1a0f82508e6201c73083526add9bbacce108a7f1 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 02:58:26 -0400 Subject: [PATCH 02/15] Add rune essence Ore --- game/plugin/skills/mining/src/Ore.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index 0e313361e..b46784661 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -20,6 +20,7 @@ enum class Ore( val chanceOffset: Double = 0.0, val prospectOreName: String? = null ) { + RUNE_ESSENCE(ESSENCE_OBJECTS, id = 1436, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectOreName = "Rune Stone essence"), CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), TIN(TIN_OBJECTS, id = 438, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), From ae661c54c5004903452ab2d99c8fc0227b098f40 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 03:01:33 -0400 Subject: [PATCH 03/15] Rename Ore.prospectName --- game/plugin/skills/mining/src/Ore.kt | 4 ++-- game/plugin/skills/mining/src/ProspectingAction.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index b46784661..531c283ba 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -18,9 +18,9 @@ enum class Ore( val respawn: Int, val chance: Double, val chanceOffset: Double = 0.0, - val prospectOreName: String? = null + val prospectName: String? = null ) { - RUNE_ESSENCE(ESSENCE_OBJECTS, id = 1436, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectOreName = "Rune Stone essence"), + RUNE_ESSENCE(ESSENCE_OBJECTS, id = 1436, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence"), CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), TIN(TIN_OBJECTS, id = 438, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), diff --git a/game/plugin/skills/mining/src/ProspectingAction.kt b/game/plugin/skills/mining/src/ProspectingAction.kt index 2101b9477..a8db96708 100644 --- a/game/plugin/skills/mining/src/ProspectingAction.kt +++ b/game/plugin/skills/mining/src/ProspectingAction.kt @@ -36,7 +36,7 @@ class ProspectingAction( wait() - val oreName = ore.prospectOreName ?: Definitions.item(ore.id).name?.toLowerCase() + val oreName = ore.prospectName ?: Definitions.item(ore.id).name?.toLowerCase() mob.sendMessage("This rock contains $oreName.") stop() From 3fbc0335cf3f0ed2653db3cd6185b9903efb8dd7 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 03:02:15 -0400 Subject: [PATCH 04/15] Do not call MiningTarget.target under certain conditions --- game/plugin/skills/mining/src/MiningAction.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/game/plugin/skills/mining/src/MiningAction.kt b/game/plugin/skills/mining/src/MiningAction.kt index 0f159b388..e6e824ff7 100644 --- a/game/plugin/skills/mining/src/MiningAction.kt +++ b/game/plugin/skills/mining/src/MiningAction.kt @@ -1,12 +1,13 @@ -import java.util.* + import org.apollo.game.action.ActionBlock import org.apollo.game.action.AsyncDistancedAction import org.apollo.game.message.impl.ObjectActionMessage import org.apollo.game.model.entity.Player -import org.apollo.game.plugin.api.* +import org.apollo.game.plugin.api.rand import org.apollo.game.plugin.skills.mining.Ore import org.apollo.game.plugin.skills.mining.Pickaxe import org.apollo.net.message.Message +import java.util.Objects class MiningAction( player: Player, @@ -64,9 +65,11 @@ class MiningAction( if (target.reward(mob)) { mob.sendMessage("You manage to mine some ${target.oreName()}") - target.deplete(mob.world) - stop() + if (target.ore.respawn != -1) { + target.deplete(mob.world) + stop() + } } } } From b6bb90e810b57199c44166daeb7f3e0fced4e267 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:02:07 -0400 Subject: [PATCH 05/15] Fix bug with skill requirement --- game/plugin/skills/mining/src/MiningTarget.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/game/plugin/skills/mining/src/MiningTarget.kt b/game/plugin/skills/mining/src/MiningTarget.kt index 5bbe1b4a1..cea2a9678 100644 --- a/game/plugin/skills/mining/src/MiningTarget.kt +++ b/game/plugin/skills/mining/src/MiningTarget.kt @@ -1,3 +1,4 @@ + import org.apollo.game.model.Position import org.apollo.game.model.World import org.apollo.game.model.entity.Player @@ -54,5 +55,5 @@ data class MiningTarget(val objectId: Int, val position: Position, val ore: Ore) * Check if the [mob] has met the skill requirements to mine te [Ore] represented by * this [MiningTarget]. */ - fun skillRequirementsMet(mob: Player) = mob.mining.current < ore.level + fun skillRequirementsMet(mob: Player) = mob.mining.current >= ore.level } \ No newline at end of file From 5a1fc191034dfd746d8f78798086a8bd0afdf41f Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:24:36 -0400 Subject: [PATCH 06/15] Set default ore id to -1 for rune essence --- game/plugin/skills/mining/src/Ore.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index 531c283ba..00f7fd550 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -20,7 +20,7 @@ enum class Ore( val chanceOffset: Double = 0.0, val prospectName: String? = null ) { - RUNE_ESSENCE(ESSENCE_OBJECTS, id = 1436, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence"), + RUNE_ESSENCE(ESSENCE_OBJECTS, id = -1, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence"), CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), TIN(TIN_OBJECTS, id = 438, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), @@ -41,6 +41,9 @@ enum class Ore( } } +const val RUNE_ESSENCE = 1436 +const val PURE_ESSENCE = 7936 + // Maps from regular rock id to expired rock id. val CLAY_OBJECTS = mapOf( From 1ba4fd60679ce207d43e6c3f04724d3304768c71 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:29:50 -0400 Subject: [PATCH 07/15] Add method to get the ore reward item id --- game/plugin/skills/mining/src/MiningAction.kt | 2 +- game/plugin/skills/mining/src/MiningTarget.kt | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/game/plugin/skills/mining/src/MiningAction.kt b/game/plugin/skills/mining/src/MiningAction.kt index e6e824ff7..37b5bfb10 100644 --- a/game/plugin/skills/mining/src/MiningAction.kt +++ b/game/plugin/skills/mining/src/MiningAction.kt @@ -64,7 +64,7 @@ class MiningAction( } if (target.reward(mob)) { - mob.sendMessage("You manage to mine some ${target.oreName()}") + mob.sendMessage("You manage to mine some ${target.oreName(mob)}") if (target.ore.respawn != -1) { target.deplete(mob.world) diff --git a/game/plugin/skills/mining/src/MiningTarget.kt b/game/plugin/skills/mining/src/MiningTarget.kt index cea2a9678..a8ad71abd 100644 --- a/game/plugin/skills/mining/src/MiningTarget.kt +++ b/game/plugin/skills/mining/src/MiningTarget.kt @@ -1,4 +1,3 @@ - import org.apollo.game.model.Position import org.apollo.game.model.World import org.apollo.game.model.entity.Player @@ -7,6 +6,8 @@ import org.apollo.game.plugin.api.findObject import org.apollo.game.plugin.api.mining import org.apollo.game.plugin.api.replaceObject import org.apollo.game.plugin.skills.mining.Ore +import org.apollo.game.plugin.skills.mining.PURE_ESSENCE +import org.apollo.game.plugin.skills.mining.RUNE_ESSENCE data class MiningTarget(val objectId: Int, val position: Position, val ore: Ore) { @@ -36,13 +37,22 @@ data class MiningTarget(val objectId: Int, val position: Position, val ore: Ore) /** * Get the normalized name of the [Ore] represented by this target. */ - fun oreName() = Definitions.item(ore.id).name.toLowerCase() + fun oreName(mob: Player) = Definitions.item(oreReward(mob)).name.toLowerCase() + + /** + * Get the item id for the [Ore]. + */ + fun oreReward(mob: Player): Int = when (ore) { + Ore.RUNE_ESSENCE -> if (mob.isMembers && mob.mining.current >= 30) PURE_ESSENCE else RUNE_ESSENCE + else -> ore.id + } /** * Reward a [player] with experience and ore if they have the inventory capacity to take a new ore. */ fun reward(player: Player): Boolean { - val hasInventorySpace = player.inventory.add(ore.id) + val itemId = oreReward(player) + val hasInventorySpace = player.inventory.add(itemId) if (hasInventorySpace) { player.mining.experience += ore.exp From dc441b1889a07664f1f2a7252e311265b6b04328 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:36:03 -0400 Subject: [PATCH 08/15] Add objectSize property --- game/plugin/skills/mining/src/Ore.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index 00f7fd550..629d8fcaa 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -18,9 +18,10 @@ enum class Ore( val respawn: Int, val chance: Double, val chanceOffset: Double = 0.0, - val prospectName: String? = null + val prospectName: String? = null, + val objectSize: Int = 1 ) { - RUNE_ESSENCE(ESSENCE_OBJECTS, id = -1, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence"), + RUNE_ESSENCE(ESSENCE_OBJECTS, id = -1, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence", objectSize = 7), CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), TIN(TIN_OBJECTS, id = 438, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), From ea0e225e8cdf0192a950d18c9d3159c7a1aba62b Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:45:01 -0400 Subject: [PATCH 09/15] Implement Ore.objectSize --- game/plugin/skills/mining/src/MiningAction.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/game/plugin/skills/mining/src/MiningAction.kt b/game/plugin/skills/mining/src/MiningAction.kt index 37b5bfb10..155e27e68 100644 --- a/game/plugin/skills/mining/src/MiningAction.kt +++ b/game/plugin/skills/mining/src/MiningAction.kt @@ -13,11 +13,10 @@ class MiningAction( player: Player, private val tool: Pickaxe, private val target: MiningTarget -) : AsyncDistancedAction(PULSES, true, player, target.position, ORE_SIZE) { +) : AsyncDistancedAction(PULSES, true, player, target.position, target.ore.objectSize) { companion object { private const val PULSES = 0 - private const val ORE_SIZE = 1 /** * Starts a [MiningAction] for the specified [Player], terminating the [Message] that triggered it. From 67ea88f5bc4ada95819af1b217a7269e1168ef73 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:45:52 -0400 Subject: [PATCH 10/15] Implement Ore.objectSize for prospect action --- game/plugin/skills/mining/src/ProspectingAction.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/game/plugin/skills/mining/src/ProspectingAction.kt b/game/plugin/skills/mining/src/ProspectingAction.kt index a8db96708..34de4a294 100644 --- a/game/plugin/skills/mining/src/ProspectingAction.kt +++ b/game/plugin/skills/mining/src/ProspectingAction.kt @@ -13,11 +13,10 @@ class ProspectingAction( player: Player, position: Position, private val ore: Ore -) : AsyncDistancedAction(DELAY, true, player, position, ORE_SIZE) { +) : AsyncDistancedAction(DELAY, true, player, position, ore.objectSize) { companion object { private const val DELAY = 3 - private const val ORE_SIZE = 1 /** * Starts a [MiningAction] for the specified [Player], terminating the [Message] that triggered it. From d1b4e2e40865c3e9f5a619d7bba7b2a956975c4d Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:45:59 -0400 Subject: [PATCH 11/15] Make mining action continuous until depletion or inventory full --- game/plugin/skills/mining/src/MiningAction.kt | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/game/plugin/skills/mining/src/MiningAction.kt b/game/plugin/skills/mining/src/MiningAction.kt index 155e27e68..92e047e50 100644 --- a/game/plugin/skills/mining/src/MiningAction.kt +++ b/game/plugin/skills/mining/src/MiningAction.kt @@ -46,29 +46,32 @@ class MiningAction( } mob.sendMessage("You swing your pick at the rock.") - mob.playAnimation(tool.animation) - wait(tool.pulses) + while (isRunning) { + mob.playAnimation(tool.animation) - if (!target.isValid(mob.world)) { - stop() - } - - val successChance = rand(100) + wait(tool.pulses) - if (target.isSuccessful(mob, successChance)) { - if (mob.inventory.freeSlots() == 0) { - mob.inventory.forceCapacityExceeded() + if (!target.isValid(mob.world)) { stop() } - if (target.reward(mob)) { - mob.sendMessage("You manage to mine some ${target.oreName(mob)}") + val successChance = rand(100) - if (target.ore.respawn != -1) { - target.deplete(mob.world) + if (target.isSuccessful(mob, successChance)) { + if (mob.inventory.freeSlots() == 0) { + mob.inventory.forceCapacityExceeded() stop() } + + if (target.reward(mob)) { + mob.sendMessage("You manage to mine some ${target.oreName(mob)}") + + if (target.ore.respawn != -1) { + target.deplete(mob.world) + stop() + } + } } } } From 5857c2fb3ada7ee75614725e02773c66a803e0d2 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 04:52:12 -0400 Subject: [PATCH 12/15] Fix incorrect distance for "no pickaxe" player message The message sent when player does not have a pickaxe they can use should be sent only after the player has reached the rock. --- game/plugin/skills/mining/src/MiningAction.kt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/game/plugin/skills/mining/src/MiningAction.kt b/game/plugin/skills/mining/src/MiningAction.kt index 92e047e50..e19f6a476 100644 --- a/game/plugin/skills/mining/src/MiningAction.kt +++ b/game/plugin/skills/mining/src/MiningAction.kt @@ -11,7 +11,7 @@ import java.util.Objects class MiningAction( player: Player, - private val tool: Pickaxe, + private val tool: Pickaxe?, private val target: MiningTarget ) : AsyncDistancedAction(PULSES, true, player, target.position, target.ore.objectSize) { @@ -24,14 +24,10 @@ class MiningAction( fun start(message: ObjectActionMessage, player: Player, ore: Ore) { val pickaxe = Pickaxe.bestFor(player) - if (pickaxe == null) { - player.sendMessage("You do not have a pickaxe for which you have the level to use.") - } else { - val target = MiningTarget(message.id, message.position, ore) - val action = MiningAction(player, pickaxe, target) + val target = MiningTarget(message.id, message.position, ore) + val action = MiningAction(player, pickaxe, target) - player.startAction(action) - } + player.startAction(action) message.terminate() } @@ -40,6 +36,11 @@ class MiningAction( override fun action(): ActionBlock = { mob.turnTo(position) + if (tool == null) { + mob.sendMessage("You do not have a pickaxe for which you have the level to use.") + stop() + } + if (!target.skillRequirementsMet(mob)) { mob.sendMessage("You do not have the required level to mine this rock.") stop() From 07e37255e03471408f349ee3f92218e0b7cce1d8 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 06:29:39 -0400 Subject: [PATCH 13/15] Rename Ore.RUNE_ESSENCE to ESSENCE Renamed to avoid conflict between the const and enum declaration --- game/plugin/skills/mining/src/MiningTarget.kt | 2 +- game/plugin/skills/mining/src/Ore.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/game/plugin/skills/mining/src/MiningTarget.kt b/game/plugin/skills/mining/src/MiningTarget.kt index a8ad71abd..48c34825b 100644 --- a/game/plugin/skills/mining/src/MiningTarget.kt +++ b/game/plugin/skills/mining/src/MiningTarget.kt @@ -43,7 +43,7 @@ data class MiningTarget(val objectId: Int, val position: Position, val ore: Ore) * Get the item id for the [Ore]. */ fun oreReward(mob: Player): Int = when (ore) { - Ore.RUNE_ESSENCE -> if (mob.isMembers && mob.mining.current >= 30) PURE_ESSENCE else RUNE_ESSENCE + Ore.ESSENCE -> if (mob.isMembers && mob.mining.current >= 30) PURE_ESSENCE else RUNE_ESSENCE else -> ore.id } diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index 629d8fcaa..c5117f514 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -21,7 +21,7 @@ enum class Ore( val prospectName: String? = null, val objectSize: Int = 1 ) { - RUNE_ESSENCE(ESSENCE_OBJECTS, id = -1, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence", objectSize = 7), + ESSENCE(ESSENCE_OBJECTS, id = RUNE_ESSENCE, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence", objectSize = 7), CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), TIN(TIN_OBJECTS, id = 438, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), From a46d53e903530ffc439de753b33391265ac75f4f Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 06:43:20 -0400 Subject: [PATCH 14/15] Set ESSENCE.id back to -1 --- game/plugin/skills/mining/src/Ore.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/plugin/skills/mining/src/Ore.kt b/game/plugin/skills/mining/src/Ore.kt index c5117f514..e130a3d6f 100644 --- a/game/plugin/skills/mining/src/Ore.kt +++ b/game/plugin/skills/mining/src/Ore.kt @@ -21,7 +21,7 @@ enum class Ore( val prospectName: String? = null, val objectSize: Int = 1 ) { - ESSENCE(ESSENCE_OBJECTS, id = RUNE_ESSENCE, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence", objectSize = 7), + ESSENCE(ESSENCE_OBJECTS, id = -1, level = 1, exp = 5.0, respawn = -1, chance = 0.0085, chanceOffset = 0.45, prospectName = "Rune Stone essence", objectSize = 7), CLAY(CLAY_OBJECTS, id = 434, level = 1, exp = 5.0, respawn = 1, chance = 0.0085, chanceOffset = 0.45), COPPER(COPPER_OBJECTS, id = 436, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), TIN(TIN_OBJECTS, id = 438, level = 1, exp = 17.5, respawn = 4, chance = 0.0085, chanceOffset = 0.45), From a5f436b4ab4d400335e4fe7e39f08b6f30517c98 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 25 Apr 2019 06:50:23 -0400 Subject: [PATCH 15/15] Filter data Ores that do not contain an item id or do not deplete will never pass the current tests --- game/plugin/skills/mining/test/TestData.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game/plugin/skills/mining/test/TestData.kt b/game/plugin/skills/mining/test/TestData.kt index aa798d24a..022f7adaf 100644 --- a/game/plugin/skills/mining/test/TestData.kt +++ b/game/plugin/skills/mining/test/TestData.kt @@ -1,13 +1,15 @@ -import java.util.stream.Stream + import org.apollo.game.plugin.skills.mining.Ore import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.ArgumentsProvider +import java.util.stream.Stream data class MiningTestData(val rockId: Int, val expiredRockId: Int, val ore: Ore) fun miningTestData(): Collection = Ore.values() - .flatMap { ore -> ore.objects.map { MiningTestData(it.key, it.value, ore) } } + .filter { it.id != -1 } + .flatMap { ore -> ore.objects.filter { it.value != -1 }.map { MiningTestData(it.key, it.value, ore) } } .toList() class MiningTestDataProvider : ArgumentsProvider {