Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions game/src/main/kotlin/content/skill/slayer/EnchantedGem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import net.pearx.kasechange.toSentenceCase
import world.gregs.voidps.engine.Script
import world.gregs.voidps.engine.client.message
import world.gregs.voidps.engine.data.definition.SlayerTaskDefinitions
import world.gregs.voidps.engine.queue.strongQueue
import world.gregs.voidps.engine.entity.character.player.name
import world.gregs.voidps.engine.queue.queue

class EnchantedGem(val slayerDefinitions: SlayerTaskDefinitions) : Script {

Expand All @@ -22,9 +23,9 @@ class EnchantedGem(val slayerDefinitions: SlayerTaskDefinitions) : Script {
}

itemOption("Activate", "enchanted_gem") {
strongQueue("enchanted_gem_activate") {
queue("enchanted_gem_activate") {
val master = slayerMaster
npc<Happy>(master, "Hello there $name, what can I help you with?")
npc<Happy>(master, "Hello there ${this@itemOption.name}, what can I help you with?")
choice {
howAmIDoing()
whoAreYou()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ class GrandExchange(
// Find the highest buyer
val buying = offers.buying(offer.item)
val entry = buying.lastEntry()
if (Settings["grandExchange.instantOffer", false]) {
val percent = Settings["grandExchange.instantSellUnderMarketPrice", 0.0]
val marketPrice = history.marketPrice(offer.item)
val instantPrice = marketPrice - (marketPrice * percent).toInt()
if (offer.price <= instantPrice) {
exchange(offer, pending.account, offer.price, mutableListOf(OpenOffer(remaining = offer.amount, lastActive = 0)))
break
}
}
if (entry == null || entry.key < offer.price || !exchange(offer, pending.account, entry.key, entry.value)) {
offers.sell(pending.account, offer)
break
Expand All @@ -191,6 +200,15 @@ class GrandExchange(
// Find the cheapest seller
val selling = offers.selling(offer.item)
val entry = selling.firstEntry()
if (Settings["grandExchange.instantOffer", false]) {
val percent = Settings["grandExchange.instantBuyOverMarketPrice", 0.0]
val marketPrice = history.marketPrice(offer.item)
val instantPrice = marketPrice + (marketPrice * percent).toInt()
if (offer.price >= instantPrice) {
exchange(offer, pending.account, instantPrice, mutableListOf(OpenOffer(remaining = offer.amount, lastActive = 0)))
break
}
}
if (entry == null || entry.key > offer.price || !exchange(offer, pending.account, entry.key, entry.value)) {
offers.buy(pending.account, offer)
break
Expand Down
16 changes: 16 additions & 0 deletions game/src/main/resources/game.properties
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ grandExchange.tax.limit=5000000
# Require the tutorial before accessing the grand exchange
grandExchange.tutorial.required=false

# Allow players to buy and sell instantly at .instantBuy/SellMarketPrice
# Note: just for fun - spawns items and can allow infinite item/gold abuse.
grandExchange.instantOffer=false

# Instantly sells if X percentage under market price e.g.
# 0.0 = 0% - anything can be sold at or under the market price.
# 0.1 = 10% - 100gp item instantly sells for 90gp or under
# -2.0 = -200% - allows selling 100gp item for up to 200gp.
grandExchange.instantSellUnderMarketPrice=0.0

# Instantly buys if X percentage over market price e.g.
# 0.0 = 0% - anything can be bought at or over the market price.
# 0.1 = 10% - instantly buys a 100gp item over 110gp.
# -1.0 = -100% - allows buying anything at any price over 1gp.
grandExchange.instantBuyOverMarketPrice=0.0

# Wave to start all fight caves on (63 for jad)
fightCave.startWave = 1

Expand Down
Loading