Refactored god item definitions to be more general purpose

This commit is contained in:
Ceikry
2022-03-10 05:17:07 +00:00
parent 03f944da3e
commit 9024987ed2
3 changed files with 36 additions and 27 deletions
+12
View File
@@ -261,6 +261,18 @@ fun inEquipment(player: Player, item: Int, amount: Int = 1): Boolean {
return player.equipment.contains(item, amount)
}
/**
* Check if a player has an item equipped which corresponds to the given God
* @param player the player to check
* @param god the God whose equipment we are checking for
* @return true if the player has an item corresponding to the given god, false otherwise
*/
fun hasGodItem(player: Player, god: God): Boolean
{
god.validItems.forEach { if(amountInEquipment(player, it) > 0) return true }
return false
}
/**
* Get number of free slots in a player's inventory
* @param player the player to check
+10
View File
@@ -0,0 +1,10 @@
package api
enum class God(vararg val validItems: Int) {
ARMADYL(87, 11694, 11718, 11720, 11722, 12670, 12671, 14671),
BANDOS(11061, 11696, 11724, 11726, 11728),
SARADOMIN(1718, 2412, 2415, 2661, 2663, 2665, 2667, 3479, 3675, 3489, 3840, 4682, 6762, 8055, 10384, 10386, 10388, 10390, 10440, 10446, 10452, 10458, 10464, 10470, 11181, 11698, 11730,542,544),
ZAMORAK(11716, 11700, 1724, 2414, 2417, 2653, 2655, 2657, 2659, 3478, 3674, 3841, 3842, 3852, 4683, 6764, 8056, 10368, 10370, 10372, 10374, 10444, 10450, 10456, 10460, 10468, 10474, 10776, 10786, 10790, 14662),
GUTHIX,
ZAROS
}