forked from 2009Scape/Server
Merge pull request 'Update Master' (#6) from dev into master
Reviewed-on: #6
This commit is contained in:
commit
30113613e0
3 changed files with 66 additions and 6 deletions
|
|
@ -82,9 +82,17 @@ class CropHarvester : OptionHandler() {
|
|||
sendMessage(player, "You lack the needed tool to harvest these crops.")
|
||||
return true
|
||||
}
|
||||
val necklace = getItemFromEquipment(player, EquipmentSlot.NECK)
|
||||
var amulet = false
|
||||
if (necklace != null && (necklace.name.lowercase().contains("amulet of farming") || necklace.name.lowercase().contains("amulet of nature"))) {
|
||||
amulet = true
|
||||
}
|
||||
val sendHarvestMessages = if (fPatch.type == PatchType.FLOWER_PATCH) false else true
|
||||
if (sendHarvestMessages && firstHarvest) {
|
||||
sendMessage(player, "You begin to harvest the $patchName.")
|
||||
if (amulet) {
|
||||
sendMessage(player, "The leprechaun exchanges your produce for banknotes.")
|
||||
}
|
||||
firstHarvest = false
|
||||
}
|
||||
animate(player, anim)
|
||||
|
|
@ -92,7 +100,11 @@ class CropHarvester : OptionHandler() {
|
|||
// TODO: If a flower patch is being harvested, delay the clearing of the
|
||||
// patch until after the animation has played - https://youtu.be/lg4GktlVNUY?t=75
|
||||
delay = 2
|
||||
addItem(player, reward.id)
|
||||
if (amulet) {
|
||||
addItem(player, note(reward).id)
|
||||
} else {
|
||||
addItem(player, reward.id)
|
||||
}
|
||||
rewardXP(player, Skills.FARMING, plantable.harvestXP)
|
||||
if (patch.patch.type in livesBased) {
|
||||
patch.rollLivesDecrement(
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class ModernListeners : SpellListener("modern"){
|
|||
onCast(Modern.LOW_ALCHEMY, ITEM){ player, node ->
|
||||
val item = node?.asItem() ?: return@onCast
|
||||
requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561)))
|
||||
alchemize(player,item,high = false)
|
||||
notespell(player,item)
|
||||
}
|
||||
|
||||
onCast(Modern.HIGH_ALCHEMY, ITEM){ player, node ->
|
||||
|
|
@ -214,7 +214,52 @@ class ModernListeners : SpellListener("modern"){
|
|||
player.pulseManager.run(SmeltingPulse(player, item, bar, 1, true))
|
||||
setDelay(player,false)
|
||||
}
|
||||
|
||||
//Snowscape custom: Low Alch spell replaced with Note spell. This spell charges 10% of the items converted to notes as a tax.
|
||||
public fun notespell(player: Player, item: Item) : Boolean {
|
||||
if (item.definition.isUnnoted) {
|
||||
if (item.definition.noteId < 0) {
|
||||
player.sendMessage("This item cannot be noted.")
|
||||
return false
|
||||
}
|
||||
val amount = player.inventory.getAmount(item.id)
|
||||
player.inventory.remove(Item(item.id, amount))
|
||||
player.inventory.add(note(Item(item.id, kotlin.math.ceil(amount*0.9).toInt())))
|
||||
player.sendMessage("The Bank of Gielinor appreciates your business.")
|
||||
} else {
|
||||
player.sendMessage("This item is already noted!")
|
||||
return false
|
||||
/* Unnoting is too strong, allowing runecrafting to happen at breakneck speeds and allowing infinite food to be brought along. Leaving the code here in case we want to enable it again someday.
|
||||
val startingamount = player.inventory.getAmount(item.id)
|
||||
val freespace = player.inventory.freeSlots()
|
||||
var amount = minOf(startingamount, freespace)
|
||||
if (startingamount - amount == 1) amount++
|
||||
if (amount == 0) {
|
||||
player.sendMessage("You do not have enough inventory space to unnote this item.")
|
||||
return false
|
||||
}
|
||||
player.inventory.remove(Item(item.id, amount))
|
||||
player.inventory.add(unnote(Item(item.id, amount)))
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
val weapon = player.equipment.getItem(getItemFromEquipment(player, EquipmentSlot.WEAPON))
|
||||
if (weapon != null && !weapon.equals(MagicStaff.FIRE_RUNE)) {
|
||||
player.animate(Animation(9625))
|
||||
player.graphics(Graphics(1692))
|
||||
} else {
|
||||
player.animate(Animation(712))
|
||||
player.graphics(Graphics(112))
|
||||
}
|
||||
playAudio(player,Sounds.LOW_ALCHEMY_98)
|
||||
|
||||
removeRunes(player)
|
||||
addXP(player, 31.0)
|
||||
showMagicTab(player)
|
||||
setDelay(player, 5)
|
||||
return true
|
||||
}
|
||||
fun alchemize(player: Player, item: Item, high: Boolean, explorersRing: Boolean = false): Boolean {
|
||||
if(item.name == "Coins") player.sendMessage("You can't alchemize something that's already gold!").also { return false }
|
||||
if((!item.definition.isTradeable) && (!item.definition.isAlchemizable)) player.sendMessage("You can't cast this spell on something like that.").also { return false }
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ open class RangeSwingHandler (vararg flags: SwingHandlerFlag)
|
|||
dropLocation = null
|
||||
}
|
||||
if (dropLocation != null && state.rangeWeapon.isDropAmmo) {
|
||||
val rate = 5 * (1.0 + e.skills.getLevel(Skills.RANGE) * 0.01) * dropRate
|
||||
val rate = 5 * dropRate
|
||||
if (RandomFunction.randomize(rate.toInt()) != 0) {
|
||||
val drop = GroundItemManager.increase(Item(ammo.id, amount), dropLocation, e)
|
||||
if (drop != null) {
|
||||
|
|
@ -367,20 +367,23 @@ open class RangeSwingHandler (vararg flags: SwingHandlerFlag)
|
|||
*/
|
||||
private fun getDropRate(e: Entity?): Double {
|
||||
if (e is Player) {
|
||||
val cape = e.equipment[EquipmentContainer.SLOT_CAPE]
|
||||
//val cape = e.equipment[EquipmentContainer.SLOT_CAPE]
|
||||
val weapon = e.equipment[EquipmentContainer.SLOT_WEAPON]
|
||||
if (cape != null && (cape.id == 10498 || cape.id == 10499) && weapon != null && weapon.id != 10034 && weapon.id != 10033) {
|
||||
//if (cape != null && (cape.id == 10498 || cape.id == 10499) && weapon != null && weapon.id != 10034 && weapon.id != 10033) {
|
||||
if (hasRequirement(e, "Animal Magnetism", false) && weapon != null && weapon.id != 10034 && weapon.id != 10033) {
|
||||
val rate = 80
|
||||
if (RandomFunction.random(100) < rate) {
|
||||
/*
|
||||
val torso = e.equipment[EquipmentContainer.SLOT_CHEST]
|
||||
val modelId = torso?.definition?.maleWornModelId1 ?: -1
|
||||
if (modelId == 301 || modelId == 306 || modelId == 3379) {
|
||||
e.packetDispatch.sendMessage("Your armour interferes with Ava's device.")
|
||||
return 1.0
|
||||
}
|
||||
*/
|
||||
return (-1).toDouble()
|
||||
}
|
||||
return 0.33
|
||||
return 0.0
|
||||
}
|
||||
}
|
||||
return 1.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue