Added new field to item configs for overriding alchemy flag

Fixed alchemy for Fremennik items
This commit is contained in:
Trident101 2023-05-27 12:57:04 +00:00 committed by Ryan
parent 6dcec3c42f
commit c3c836de4d
4 changed files with 33 additions and 6 deletions

View file

@ -35379,6 +35379,7 @@
"durability": null, "durability": null,
"name": "Sticky red goop", "name": "Sticky red goop",
"tradeable": "true", "tradeable": "true",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "3747" "id": "3747"
}, },
@ -35388,6 +35389,7 @@
"durability": null, "durability": null,
"name": "Fremennik helm", "name": "Fremennik helm",
"weight": "2.7", "weight": "2.7",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "3748", "id": "3748",
"absorb": "1,0,2", "absorb": "1,0,2",
@ -35512,6 +35514,7 @@
"durability": null, "durability": null,
"name": "Fremennik blade", "name": "Fremennik blade",
"weight": "1.8", "weight": "1.8",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"attack_speed": "4", "attack_speed": "4",
"weapon_interface": "6", "weapon_interface": "6",
@ -35526,6 +35529,7 @@
"name": "Fremennik shield", "name": "Fremennik shield",
"destroy": "true", "destroy": "true",
"weight": "2.2", "weight": "2.2",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "3758", "id": "3758",
"bonuses": "0,0,0,-8,-2,27,31,29,-1,29,30,0,0,0,0", "bonuses": "0,0,0,-8,-2,27,31,29,-1,29,30,0,0,0,0",
@ -38237,6 +38241,7 @@
"durability": null, "durability": null,
"name": "Arms", "name": "Arms",
"weight": "2", "weight": "2",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "4195" "id": "4195"
}, },
@ -38244,6 +38249,7 @@
"examine": "A pair of lifeless, rotting legs.", "examine": "A pair of lifeless, rotting legs.",
"durability": null, "durability": null,
"name": "Legs", "name": "Legs",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "4196" "id": "4196"
}, },
@ -38252,6 +38258,7 @@
"durability": null, "durability": null,
"name": "Decapitated head", "name": "Decapitated head",
"weight": "3", "weight": "3",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "4197" "id": "4197"
}, },
@ -38260,6 +38267,7 @@
"durability": null, "durability": null,
"name": "Decapitated head", "name": "Decapitated head",
"weight": "3", "weight": "3",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "4198" "id": "4198"
}, },
@ -38268,6 +38276,7 @@
"examine": "A pickled brain, submerged inside a jar of vinegar.", "examine": "A pickled brain, submerged inside a jar of vinegar.",
"durability": null, "durability": null,
"name": "Pickled brain", "name": "Pickled brain",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "4199" "id": "4199"
}, },
@ -92708,6 +92717,7 @@
{ {
"durability": null, "durability": null,
"name": "A jester stick", "name": "A jester stick",
"alchemizable": "true",
"archery_ticket_price": "0", "archery_ticket_price": "0",
"id": "10840", "id": "10840",
"bonuses": "0,0,0,0,0,0,0,0,5,-5,0,0,0,0,0", "bonuses": "0,0,0,0,0,0,0,0,5,-5,0,0,0,0,0",

View file

@ -223,7 +223,7 @@ class ModernListeners : SpellListener("modern"){
public fun alchemize(player: Player, item: Item, high: Boolean) : Boolean { public fun alchemize(player: Player, item: Item, high: Boolean) : Boolean {
if(item.name == "Coins") player.sendMessage("You can't alchemize something that's already gold!").also { return false } if(item.name == "Coins") player.sendMessage("You can't alchemize something that's already gold!").also { return false }
if(!item.definition.isTradeable) player.sendMessage("You can't cast this spell on something like that.").also { return false } if((!item.definition.isTradeable) && (!item.definition.isAlchemizable)) player.sendMessage("You can't cast this spell on something like that.").also { return false }
if(player.zoneMonitor.isInZone("Alchemists' Playground")){ if(player.zoneMonitor.isInZone("Alchemists' Playground")){
player.sendMessage("You can only alch items from the cupboards!") player.sendMessage("You can only alch items from the cupboards!")

View file

@ -1386,6 +1386,17 @@ public class ItemDefinition extends Definition<Item> {
return getConfiguration(ItemConfigParser.LOW_ALCHEMY, (int)Math.rint(value * 0.4)); return getConfiguration(ItemConfigParser.LOW_ALCHEMY, (int)Math.rint(value * 0.4));
} }
/**
* Checks if the item is alchemizable.
* @return {@code True} if so.
*/
public boolean isAlchemizable() {
if (!getConfiguration(ItemConfigParser.ALCHEMIZABLE, false)) {
return false;
}
return true;
}
/** /**
* Checks if the item is tradeable. * Checks if the item is tradeable.
* @return {@code True} if so. * @return {@code True} if so.

View file

@ -40,6 +40,11 @@ class ItemConfigParser {
*/ */
const val TWO_HANDED = "two_handed" const val TWO_HANDED = "two_handed"
/**
* The alchemisable configuration key.
*/
const val ALCHEMIZABLE = "alchemizable"
/** /**
* The high-alchemy price item configuration key. * The high-alchemy price item configuration key.
*/ */
@ -268,6 +273,7 @@ class ItemConfigParser {
"destroy", "destroy",
"lendable", "lendable",
"tradeable" -> configs.put(it.key.toString(),it.value.toString().toBoolean()) "tradeable" -> configs.put(it.key.toString(),it.value.toString().toBoolean())
"alchemizable", -> configs.put(it.key.toString(),it.value.toString().toBoolean())
//doubles //doubles
"weight" -> configs.put(it.key.toString(),it.value.toString().toDouble()) "weight" -> configs.put(it.key.toString(),it.value.toString().toDouble())