From 224d07914b8fd82a703e48337e2436817ab898d1 Mon Sep 17 00:00:00 2001 From: GregHib Date: Wed, 7 Aug 2024 14:38:47 +0100 Subject: [PATCH] Add event variable field to holiday items --- data/definitions/diango-codes.yml | 2 +- data/definitions/items.yml | 1 + data/definitions/variables-custom.yml | 2 +- .../gregs/voidps/world/map/draynor/DiangoItemRetrieval.kts | 5 ++++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/data/definitions/diango-codes.yml b/data/definitions/diango-codes.yml index e1901b361..1c29f564a 100644 --- a/data/definitions/diango-codes.yml +++ b/data/definitions/diango-codes.yml @@ -1,2 +1,2 @@ -flagstaff: +flagstaff_runefest: add: [ flagstaff_of_festivities ] \ No newline at end of file diff --git a/data/definitions/items.yml b/data/definitions/items.yml index f886594a1..e265fda9c 100644 --- a/data/definitions/items.yml +++ b/data/definitions/items.yml @@ -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." diff --git a/data/definitions/variables-custom.yml b/data/definitions/variables-custom.yml index 2c4c41d1a..77a67f4a8 100644 --- a/data/definitions/variables-custom.yml +++ b/data/definitions/variables-custom.yml @@ -474,6 +474,6 @@ equip_longbow: equip_crossbow: persist: true format: boolean -flagstaff: +flagstaff_runefest: persist: true format: boolean \ No newline at end of file diff --git a/game/src/main/kotlin/world/gregs/voidps/world/map/draynor/DiangoItemRetrieval.kts b/game/src/main/kotlin/world/gregs/voidps/world/map/draynor/DiangoItemRetrieval.kts index 91a7b4deb..c77f55c82 100644 --- a/game/src/main/kotlin/world/gregs/voidps/world/map/draynor/DiangoItemRetrieval.kts +++ b/game/src/main/kotlin/world/gregs/voidps/world/map/draynor/DiangoItemRetrieval.kts @@ -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 @@ -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] @@ -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