mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Big bass, shark, and swordfish are now obtainable from fishing
The message for catching shark now ends with an authentic exclamation mark The fishing skill cape perk now logs catching a second fish in player stats
This commit is contained in:
parent
4942ae0079
commit
a74583b13b
2 changed files with 23 additions and 3 deletions
|
|
@ -36,10 +36,14 @@ enum class Fish(val id: Int, val level: Int, val experience: Double, val lowChan
|
|||
|
||||
companion object {
|
||||
val fishMap: HashMap<Int, Fish> = HashMap()
|
||||
val bigFishMap: HashMap<Fish, Int> = HashMap()
|
||||
init {
|
||||
for(fish in values()) {
|
||||
fishMap[fish.id] = fish
|
||||
}
|
||||
bigFishMap[Fish.BASS] = Items.BIG_BASS_7989
|
||||
bigFishMap[Fish.SWORDFISH] = Items.BIG_SWORDFISH_7991
|
||||
bigFishMap[Fish.SHARK] = Items.BIG_SHARK_7993
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
|
|
@ -47,7 +51,10 @@ enum class Fish(val id: Int, val level: Int, val experience: Double, val lowChan
|
|||
return fishMap[item.id]
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun getBigFish(fish: Fish) : Int? {
|
||||
return bigFishMap[fish]
|
||||
}
|
||||
}
|
||||
|
||||
fun getSuccessChance(level: Int): Double {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import core.game.node.entity.skill.Skills
|
|||
import core.game.node.item.Item
|
||||
import core.game.system.command.sets.STATS_BASE
|
||||
import core.game.system.command.sets.STATS_FISH
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.tools.RandomFunction
|
||||
import core.tools.colorize
|
||||
|
|
@ -68,13 +69,25 @@ class FishingListener : InteractionListener{
|
|||
if (!hasSpaceFor(player, Item(fish.id)) || !op.removeBait(player)) return restartScript(player)
|
||||
player.dispatch(ResourceProducedEvent(fish.id, fish.getItem().amount, node))
|
||||
val item = fish.getItem()
|
||||
sendMessage(player, "You successfully catch some ${item.name.lowercase().replace("raw ", "")}.")
|
||||
val bigFishId = Fish.getBigFish(fish)
|
||||
val bigFishChance = if (GameWorld.settings?.isDevMode == true) 10 else 5000
|
||||
if (bigFishId != null && RandomFunction.roll(bigFishChance)) {
|
||||
sendMessage(player, "You catch an enormous" + getItemName(fish!!.id).lowercase().replace("raw", "") + "!")
|
||||
addItemOrDrop(player, bigFishId, 1)
|
||||
} else {
|
||||
var msg = if (fish == Fish.ANCHOVIE || fish == Fish.SHRIMP) "You catch some" else "You catch a"
|
||||
msg += getItemName(fish!!.id).lowercase().replace("raw", "").replace("big", "")
|
||||
msg += if (fish == Fish.SHARK) "!" else "."
|
||||
sendMessage(player, msg)
|
||||
addItemOrDrop(player, item.id, item.amount)
|
||||
}
|
||||
|
||||
if (isActive(SkillcapePerks.GREAT_AIM, player) && RandomFunction.roll(20)) {
|
||||
addItemOrDrop(player, item.id, item.amount)
|
||||
sendMessage(player, colorize("%RYour expert aim catches you a second fish."))
|
||||
player.incrementAttribute("$STATS_BASE:$STATS_FISH")
|
||||
}
|
||||
|
||||
addItemOrDrop(player, item.id, item.amount)
|
||||
player.incrementAttribute("$STATS_BASE:$STATS_FISH")
|
||||
var xp = fish.experience
|
||||
if ((item.id == Items.RAW_SWORDFISH_371 && inEquipment(player, Items.SWORDFISH_GLOVES_12860))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue