Skip to content
Open
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
23,207 changes: 23,207 additions & 0 deletions data/cfg/NpcSpawns/NPCSpawns-OSRS.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import gg.rsmod.plugins.api.Skills
* The child id of the chat box in the gameframe interface. This can change
* with revision.
*/
const val CHATBOX_CHILD = 562
const val CHATBOX_CHILD = 559

/**
* The id for the appearance interface.
Expand Down Expand Up @@ -153,6 +153,23 @@ suspend fun QueueTask.searchItemInput(message: String): Int {
return requestReturnValue as? Int ?: -1
}

/**
* Prompts the player with a chatbox interface that allows them to search
* for an item.
* Difference from [QueueTask.searchItemInput] It let's you choose untradeable items too.
*
* @return
* The selected item's id.
*/
suspend fun QueueTask.searchItemInputT(message: String): Int {
player.runClientScript(750, message, 0, -1)

terminateAction = closeInput
waitReturnValue()

return requestReturnValue as? Int ?: -1
}

/**
* Sends a normal message dialog.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package gg.rsmod.plugins.content.cmd.itemspawn

import gg.rsmod.game.model.priv.Privilege

/**
* For tradable items only
*
*/
on_command("spawn", Privilege.ADMIN_POWER) {
player.queue(TaskPriority.STRONG) {
val item = spawn() ?: return@queue
Expand All @@ -12,6 +16,19 @@ on_command("spawn", Privilege.ADMIN_POWER) {
}
}
}
/**
* For untradable items
*/
on_command("spawn2", Privilege.ADMIN_POWER) {
player.queue(TaskPriority.STRONG) {
val item = spawn2() ?: return@queue
if (item.amount > 0) {
player.message("You have spawned ${item.amount} x ${item.getName(world.definitions)}.")
} else {
player.message("You don't have enough inventory space.")
}
}
}

suspend fun QueueTask.spawn(): Item? {
val item = searchItemInput("Select an item to spawn:")
Expand All @@ -27,4 +44,20 @@ suspend fun QueueTask.spawn(): Item? {
}
val add = player.inventory.add(item, amount, assureFullInsertion = false)
return Item(item, add.completed)
}
}

suspend fun QueueTask.spawn2(): Item? {
val item = searchItemInputT("Select an item to spawn:")
if (item == -1) {
return null
}
val amount = when (options("1", "5", "X", "Max", title = "How many would you like to spawn?")) {
1 -> 1
2 -> 5
3 -> inputInt("Enter amount to spawn")
4 -> Int.MAX_VALUE
else -> return null
}
val add = player.inventory.add(item, amount, assureFullInsertion = false)
return Item(item, add.completed)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package gg.rsmod.plugins.content.inter.tournament_supplies

import gg.rsmod.game.model.attr.INTERACTING_ITEM_ID
import gg.rsmod.game.model.priv.Privilege

var TOURNAMENT_SUPPLIES_INTERFACE = 100

on_interface_open(interfaceId = TOURNAMENT_SUPPLIES_INTERFACE) p@ {
if (!player.privilege.equals(Privilege.DEV_POWER)) {
player.setInterfaceEvents(TOURNAMENT_SUPPLIES_INTERFACE, component = 4, range = 0..443, setting = 1086)
} else {
player.message("Dafuq? You are going to naughty list!")
World.logger.warn("${player.username} : X: ${player.tile.x} Z: ${player.tile.z} : was able to open Tournament Supplies Interface.")
}
}
on_button(interfaceId = TOURNAMENT_SUPPLIES_INTERFACE, component = 4) {
val itemid = player.attr[INTERACTING_ITEM_ID]!!
val option = player.getInteractingOption()

if (world.definitions.getCount(ItemDef::class.java) < itemid) {
player.message("[Unhandled item] - $itemid")
World.logger.warn("[Unhandled item] - $itemid")
} else {
var amount = when(option) {
1 -> 1
2 -> 5
3 -> 10
4 -> -1
else -> return@on_button
}
if (amount == -1) {
player.queue(TaskPriority.WEAK) {
amount = inputInt("How many would you like to withdraw?")
if (amount > 0) {
if (player.inventory.freeSlotCount < amount && !world.definitions.get(ItemDef::class.java, itemid).stackable) {
amount = player.inventory.freeSlotCount
}
player.inventory.add(itemid, amount)
}
}
} else {
player.inventory.add(itemid, amount)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gg.rsmod.plugins.content.inter.worldmap.WorldMap.WORLD_MAP_FULLSCREEN_INT
import gg.rsmod.plugins.content.inter.worldmap.WorldMap.LAST_TILE
import gg.rsmod.plugins.content.inter.worldmap.WorldMap.UPDATE_TIMER

on_button(interfaceId = 160, component = 46) {
on_button(interfaceId = 160, component = 48) {
if (!player.lock.canInterfaceInteract()) {
return@on_button
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ for (equipment in EquipmentType.values) {
}
}

bind_unequip(EquipmentType.HEAD, child = 14)
bind_unequip(EquipmentType.CAPE, child = 15)
bind_unequip(EquipmentType.AMULET, child = 16)
bind_unequip(EquipmentType.WEAPON, child = 17)
bind_unequip(EquipmentType.CHEST, child = 18)
bind_unequip(EquipmentType.SHIELD, child = 19)
bind_unequip(EquipmentType.LEGS, child = 20)
bind_unequip(EquipmentType.GLOVES, child = 21)
bind_unequip(EquipmentType.BOOTS, child = 22)
bind_unequip(EquipmentType.RING, child = 23)
bind_unequip(EquipmentType.AMMO, child = 24)
bind_unequip(EquipmentType.HEAD, child = 15)
bind_unequip(EquipmentType.CAPE, child = 16)
bind_unequip(EquipmentType.AMULET, child = 17)
bind_unequip(EquipmentType.WEAPON, child = 18)
bind_unequip(EquipmentType.CHEST, child = 19)
bind_unequip(EquipmentType.SHIELD, child = 20)
bind_unequip(EquipmentType.LEGS, child = 21)
bind_unequip(EquipmentType.GLOVES, child = 22)
bind_unequip(EquipmentType.BOOTS, child = 23)
bind_unequip(EquipmentType.RING, child = 24)
bind_unequip(EquipmentType.AMMO, child = 25)
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ on_timer(RunEnergy.RUN_DRAIN) {
/**
* Button by minimap.
*/
on_button(interfaceId = 160, component = 22) {
on_button(interfaceId = 160, component = 23) {
RunEnergy.toggle(player)
}

/**
* Settings button.
*/
on_button(interfaceId = 116, component = 27) {
on_button(interfaceId = 116, component = 71) {
RunEnergy.toggle(player)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AddLocalNpcSegment(val player: Player, val npc: Npc, private val requiresB
override fun encode(buf: GamePacketBuilder) {
var dx = npc.tile.x - player.tile.x
var dz = npc.tile.z - player.tile.z

if (!largeScene) {
if (dx < Player.NORMAL_VIEW_DISTANCE) {
dx += 32
Expand All @@ -35,11 +36,12 @@ class AddLocalNpcSegment(val player: Player, val npc: Npc, private val requiresB
val facing = if (npc.lastFacingDirection != Direction.NONE) npc.lastFacingDirection else Direction.SOUTH

buf.putBits(15, npc.index)
buf.putBits(14, id)
buf.putBits(1, if (requiresBlockUpdate) 1 else 0)
buf.putBits(if (largeScene) 8 else 5, dx)
buf.putBits(3, facing.npcWalkValue)
buf.putBits(1, if (requiresBlockUpdate) 1 else 0)
buf.putBits(if (largeScene) 8 else 5, dx)
buf.putBits(if (largeScene) 8 else 5, dz)
buf.putBits(1, if (requiresBlockUpdate) 1 else 0)
buf.putBits(14, id)
buf.putBits(1, if (requiresBlockUpdate) 1 else 0)
}
}