Removed non-green-d'hide-bodies from the restricted items list for dragon slayer

Merged the dragon slayer equip checks into the existing file for quest requirement checks
Updated item equip checks to use new api methods
This commit is contained in:
Ceikry
2022-12-22 10:15:31 +00:00
committed by Ryan
parent c1b1bcc80d
commit c9a6bf2f61
2 changed files with 30 additions and 85 deletions
@@ -1,39 +0,0 @@
package rs09.game.content.quest.free.dragonslayer
import api.*
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
import rs09.game.interaction.IntType
class DSEquipListeners : InteractionListener {
private val restrictedItems = intArrayOf(
Items.RUNE_PLATEBODY_1127,
Items.RUNE_PLATEBODY_G_10798,
Items.RUNE_PLATEBODY_G_2615,
Items.RUNE_PLATEBODY_G_13800,
Items.RUNE_PLATEBODY_T_10800,
Items.RUNE_PLATEBODY_T_13805,
Items.RUNE_PLATEBODY_T_2623,
Items.ZAMORAK_PLATEBODY_2653,
Items.SARADOMIN_PLATEBODY_2661,
Items.GUTHIX_PLATEBODY_2669,
Items.GREEN_DHIDE_BODY_1135,
Items.DHIDE_BODYG_7370,
Items.DHIDE_BODY_G_7374,
Items.DHIDE_BODY_T_7372,
Items.DHIDE_BODY_T_7376
)
override fun defineListeners() {
for(id in restrictedItems){
onEquip(id){ player, _ ->
if(!player.questRepository.isComplete("Dragon Slayer")){
sendMessage(player, "You must have completed Dragon Slayer to equip this.")
return@onEquip false
}
return@onEquip true
}
}
}
}
@@ -70,6 +70,22 @@ class ItemQuestRequirementListener : InteractionListener {
Items.CRYSTAL_SHIELD_1_10_4234 Items.CRYSTAL_SHIELD_1_10_4234
) )
//As per the source (https://runescape.wiki/w/Dragon_Slayer?oldid=895396),
//dragon slayer should only restrict green d'hide bodies, not the higher tiers.
private val dragonSlayerEquipment = intArrayOf(
Items.RUNE_PLATEBODY_1127,
Items.RUNE_PLATEBODY_G_10798,
Items.RUNE_PLATEBODY_G_2615,
Items.RUNE_PLATEBODY_G_13800,
Items.RUNE_PLATEBODY_T_10800,
Items.RUNE_PLATEBODY_T_13805,
Items.RUNE_PLATEBODY_T_2623,
Items.ZAMORAK_PLATEBODY_2653,
Items.SARADOMIN_PLATEBODY_2661,
Items.GUTHIX_PLATEBODY_2669,
Items.GREEN_DHIDE_BODY_1135
)
private val questCapes = intArrayOf(9813,9814) private val questCapes = intArrayOf(9813,9814)
override fun defineListeners() { override fun defineListeners() {
@@ -93,35 +109,19 @@ class ItemQuestRequirementListener : InteractionListener {
*/ */
onEquip(fremennikTrialsEquipment.plus(fremennikIslesEquipment)) { player, _ -> onEquip(fremennikTrialsEquipment.plus(fremennikIslesEquipment)) { player, _ ->
if (!isQuestComplete(player, "Fremennik Trials")) { return@onEquip requireQuest(player, "Fremennik Trials", "to equip this.")
sendMessage(player, "You must have completed The Fremennik Trials to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(avasBackpacks){ player, _ -> onEquip(avasBackpacks){ player, _ ->
if (!isQuestComplete(player, "Animal Magnetism")) { return@onEquip requireQuest(player, "Animal Magnetism", "to equip this.")
sendMessage(player, "You must have completed Animal Magnetism to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(lostCityWeapons){ player, _ -> onEquip(lostCityWeapons){ player, _ ->
if (!isQuestComplete(player, "Lost City")) { return@onEquip requireQuest(player, "Lost City", "to equip this.")
sendMessage(player, "You must have completed Lost City to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(Items.CAPE_OF_LEGENDS_1052) { player, _ -> onEquip(Items.CAPE_OF_LEGENDS_1052) { player, _ ->
if(!isQuestComplete(player, "Legends' Quest")) { return@onEquip requireQuest(player, "Legends' Quest", "to equip this.")
player.packetDispatch.sendMessage("You must have completed Legends' Quest to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(questCapes) { player, _ -> onEquip(questCapes) { player, _ ->
@@ -134,43 +134,27 @@ class ItemQuestRequirementListener : InteractionListener {
} }
onEquip(Items.WOLFBANE_2952){ player, _ -> onEquip(Items.WOLFBANE_2952){ player, _ ->
if(!isQuestComplete(player, "Priest in Peril")) { return@onEquip requireQuest(player, "Priest in Peril", "to equip this.")
sendMessage(player, "You must have completed Priest in Peril to equip this.") }
return@onEquip false
}
return@onEquip true
}
onEquip(Items.ANCIENT_MACE_11061){ player, _ -> onEquip(Items.ANCIENT_MACE_11061){ player, _ ->
if(!isQuestComplete(player, "Another Slice of H.A.M.")) { return@onEquip requireQuest(player, "Another Slice of H.A.M.", "to equip this.")
sendMessage(player, "You must have completed Another Slice of H.A.M. to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(Items.ANCIENT_STAFF_4675){ player, _ -> onEquip(Items.ANCIENT_STAFF_4675){ player, _ ->
if(!isQuestComplete(player, "Desert Treasure")) { return@onEquip requireQuest(player, "Desert Treasure", "to equip this.")
sendMessage(player, "You must have completed Desert Treasure to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(Items.ELEMENTAL_SHIELD_2890) { player, _ -> onEquip(Items.ELEMENTAL_SHIELD_2890) { player, _ ->
if (!isQuestComplete(player, "Elemental Workshop I")) { return@onEquip requireQuest(player, "Elemental Workshop I", "to equip this.")
sendMessage(player, "You must have completed Elemental Workshop I to equip this.")
return@onEquip false
}
return@onEquip true
} }
onEquip(crystalEquipment){ player, _ -> onEquip(crystalEquipment){ player, _ ->
if (!isQuestComplete(player, "Roving Elves")) { return@onEquip requireQuest(player, "Roving Elves", "to equip this.")
sendMessage(player, "You must have completed Roving Elves to equip this.") }
return@onEquip false
} onEquip(dragonSlayerEquipment) {player, _ ->
return@onEquip true return@onEquip requireQuest(player, "Dragon Slayer", "to equip this.")
} }
} }
} }