Fixed inconsistent and inauthentic messages for fishing
Fixed item grinding consuming the whole stack sometimes Fixed incorrect Fremennik diary cheese task Fixed Seer's diary candle task
This commit is contained in:
@@ -1,24 +1,22 @@
|
||||
package core.game.shops
|
||||
|
||||
import core.ServerConstants
|
||||
import core.api.*
|
||||
import core.game.component.Component
|
||||
import core.game.container.*
|
||||
import core.game.container.Container
|
||||
import core.game.event.ItemShopPurchaseEvent
|
||||
import core.game.event.ItemShopSellEvent
|
||||
import core.game.component.Component
|
||||
import core.game.container.Container
|
||||
import core.game.container.ContainerEvent
|
||||
import core.game.container.ContainerListener
|
||||
import core.game.container.ContainerType
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import core.game.shops.Shops.Companion.logShop
|
||||
import core.game.system.config.ItemConfigParser
|
||||
import core.game.world.GameWorld
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.ContainerContext
|
||||
import core.net.packet.out.ContainerPacket
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import core.ServerConstants
|
||||
import core.game.shops.Shops.Companion.logShop
|
||||
import core.game.system.config.ItemConfigParser
|
||||
import core.game.world.GameWorld
|
||||
import java.lang.Integer.max
|
||||
import java.lang.Integer.min
|
||||
import kotlin.math.ceil
|
||||
@@ -78,8 +76,8 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
|
||||
}
|
||||
|
||||
val settings = IfaceSettingsBuilder()
|
||||
.enableOptions(0..9)
|
||||
.build()
|
||||
.enableOptions(0..9)
|
||||
.build()
|
||||
|
||||
player.packetDispatch.sendIfaceSettings(settings, if (main) 23 else 24, Components.SHOP_TEMPLATE_620, 0, cont.capacity())
|
||||
player.packetDispatch.sendRunScript(150, "IviiiIsssssssss", "", "", "", "", "Buy X", "Buy 10", "Buy 5", "Buy 1", "Value", -1, 0, 4, 10, 92, (620 shl 16) or if (main) 23 else 24)
|
||||
@@ -196,21 +194,21 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
|
||||
var (isPlayerStock, shopSlot) = getStockSlot(shopItemId)
|
||||
|
||||
val stockAmt =
|
||||
if(isPlayerStock)
|
||||
0
|
||||
else{
|
||||
if(shopSlot != -1) stock[shopSlot].amount
|
||||
else 0
|
||||
}
|
||||
val currentAmt =
|
||||
if(isPlayerStock) playerStock.getAmount(shopItemId)
|
||||
else {
|
||||
if(shopSlot != -1) shopCont[shopSlot].amount
|
||||
else {
|
||||
isPlayerStock = true
|
||||
if(isPlayerStock)
|
||||
0
|
||||
else{
|
||||
if(shopSlot != -1) stock[shopSlot].amount
|
||||
else 0
|
||||
}
|
||||
val currentAmt =
|
||||
if(isPlayerStock) playerStock.getAmount(shopItemId)
|
||||
else {
|
||||
if(shopSlot != -1) shopCont[shopSlot].amount
|
||||
else {
|
||||
isPlayerStock = true
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val price = when(currency)
|
||||
{
|
||||
@@ -240,9 +238,9 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
|
||||
|
||||
|
||||
val price: Int = ceil(item.definition.value * mod.toDouble() / 100.0).toInt()
|
||||
/* if(player.getVarp(532) == 6529){
|
||||
price = 3 * price / 2
|
||||
}*/
|
||||
/* if(player.getVarp(532) == 6529){
|
||||
price = 3 * price / 2
|
||||
}*/
|
||||
return max(price, 1)
|
||||
}
|
||||
|
||||
@@ -300,7 +298,7 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
|
||||
while(amt-- > 1)
|
||||
cost.amount += getGPCost(Item(item.id, 1), if (isMainStock) stock[slot].amount else playerStock[slot].amount, --inStockAmt)
|
||||
} else {
|
||||
cost.amount = cost.amount * item.amount
|
||||
cost.amount = cost.amount * item.amount
|
||||
}
|
||||
|
||||
if(inInventory(player, cost.id, cost.amount))
|
||||
@@ -338,7 +336,8 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
|
||||
}
|
||||
else
|
||||
{
|
||||
sendMessage(player, "You don't have enough ${cost.name.toLowerCase()} to buy that many.")
|
||||
sendMessage(player, "You don't have enough ${cost.name.lowercase()} to buy that many.")
|
||||
return TransactionStatus.Failure("Not enough money in inventory")
|
||||
}
|
||||
|
||||
player.dispatch(ItemShopPurchaseEvent(item.id, item.amount, cost))
|
||||
@@ -457,4 +456,4 @@ class Shop(val title: String, val stock: Array<ShopItem>, val general: Boolean =
|
||||
class Success : TransactionStatus()
|
||||
class Failure(val reason: String) : TransactionStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,25 @@
|
||||
package core.game.shops
|
||||
|
||||
import content.global.skill.crafting.TanningProduct
|
||||
import core.ServerConstants
|
||||
import core.api.*
|
||||
import core.game.ge.GrandExchange
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import content.global.skill.crafting.TanningProduct
|
||||
import core.game.system.command.Privilege
|
||||
import core.tools.END_DIALOGUE
|
||||
import core.tools.Log
|
||||
import core.tools.secondsToTicks
|
||||
import org.json.simple.JSONArray
|
||||
import org.json.simple.JSONObject
|
||||
import org.json.simple.parser.JSONParser
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import core.ServerConstants
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.system.command.Privilege
|
||||
import java.io.FileReader
|
||||
import core.tools.*
|
||||
import core.game.ge.*
|
||||
|
||||
/**
|
||||
* The "controller" class for shops. Handles opening shops from various NPC interactions and updating stock, etc.
|
||||
@@ -154,6 +156,15 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(NPCs.CANDLE_MAKER_562, IntType.NPC, "trade") { player, node ->
|
||||
if (getQuestStage(player, "Merlin's Crystal") > 60) {
|
||||
openId(player, 56)
|
||||
} else {
|
||||
shopsByNpc[node.id]?.openFor(player)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
override fun defineInterfaceListeners() {
|
||||
@@ -179,7 +190,7 @@ class Shops : StartupListener, TickListener, InteractionListener, InterfaceListe
|
||||
|
||||
when(opcode)
|
||||
{
|
||||
OP_VALUE -> sendMessage(player, "${getItemName(if (isMainStock) shop.stock[slot].itemId else shop.playerStock[slot].id)}: This item currently costs ${price.amount} ${price.name.toLowerCase()}.")
|
||||
OP_VALUE -> sendMessage(player, "${getItemName(if (isMainStock) shop.stock[slot].itemId else shop.playerStock[slot].id)}: This item currently costs ${price.amount} ${price.name.lowercase()}.")
|
||||
OP_BUY_1 -> shop.buy(player, slot, 1)
|
||||
OP_BUY_5 -> shop.buy(player, slot, 5)
|
||||
OP_BUY_10 -> shop.buy(player, slot, 10)
|
||||
|
||||
Reference in New Issue
Block a user