Skip to content

Commit

Permalink
Add event variable field to holiday items
Browse files Browse the repository at this point in the history
  • Loading branch information
GregHib committed Aug 7, 2024
1 parent dde3738 commit 224d079
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data/definitions/diango-codes.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
flagstaff:
flagstaff_runefest:
add: [ flagstaff_of_festivities ]
1 change: 1 addition & 0 deletions data/definitions/items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79510,6 +79510,7 @@ flagstaff_of_festivities:
id: 18667
tradeable: false
weight: 1.0
event: flagstaff_runefest
slot: "Weapon"
destroy: "You can replace this by speaking to Diango in Draynor."
examine: "A flagstaff celebrating Runefest '10."
Expand Down
2 changes: 1 addition & 1 deletion data/definitions/variables-custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,6 @@ equip_longbow:
equip_crossbow:
persist: true
format: boolean
flagstaff:
flagstaff_runefest:
persist: true
format: boolean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import world.gregs.voidps.engine.client.ui.event.interfaceClose
import world.gregs.voidps.engine.client.ui.event.interfaceOpen
import world.gregs.voidps.engine.client.ui.interfaceOption
import world.gregs.voidps.engine.data.definition.InventoryDefinitions
import world.gregs.voidps.engine.data.definition.ItemDefinitions
import world.gregs.voidps.engine.entity.character.player.Player
import world.gregs.voidps.engine.entity.character.player.chat.inventoryFull
import world.gregs.voidps.engine.entity.playerDespawn
Expand Down Expand Up @@ -41,6 +42,7 @@ interfaceOption("Claim", "items", "diangos_item_retrieval") {
}

val inventoryDefinitions: InventoryDefinitions by inject()
val itemDefinitions: ItemDefinitions by inject()

fun refreshItems(player: Player) {
val more: Boolean = player["retrieve_more", false]
Expand All @@ -58,7 +60,8 @@ fun refreshItems(player: Player) {
for (index in 0 until inventory.size) {
val map = defaults.getOrNull(index) ?: continue
val id = map.keys.firstOrNull() ?: continue
if (!player.ownsItem(id)) {
val event: String? = itemDefinitions.get(id).getOrNull("event")
if ((event == null || player[event, false]) && !player.ownsItem(id)) {
// Add second screen if itemLimit is reached
if (!more && inventory.count >= itemLimit) {
displayMore = true
Expand Down

0 comments on commit 224d079

Please sign in to comment.