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

View file

@ -221,9 +221,9 @@ class ModernListeners : SpellListener("modern"){
setDelay(player,false)
}
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.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")){
player.sendMessage("You can only alch items from the cupboards!")

View file

@ -276,7 +276,7 @@ public class ItemDefinition extends Definition<Item> {
}
if(itemId == 14958)
def.setStackable(true);
ItemDefinition.getDefinitions().put(itemId, def);
}
ItemDefinition.defineTemplates();
@ -717,7 +717,7 @@ public class ItemDefinition extends Definition<Item> {
Integer level = requirements.get(skillId);
return level == null ? 0 : level;
}
/**
* Gets the wielding animation id (render animation id).
* @return The wield animation id.
@ -1386,6 +1386,17 @@ public class ItemDefinition extends Definition<Item> {
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.
* @return {@code True} if so.
@ -1547,7 +1558,7 @@ public class ItemDefinition extends Definition<Item> {
player.getPacketDispatch().sendString(BONUS_NAMES[index++] + bonusValue, 667, i);
}
player.getPacketDispatch().sendString("Attack bonus", 667, 34);
DecimalFormat dec = new DecimalFormat("#.#");
DecimalFormat dec = new DecimalFormat("#.#");
player.getPacketDispatch().sendString(dec.format(player.getSettings().getWeight())+" kg", 667, 32);
}
@ -1621,7 +1632,7 @@ public class ItemDefinition extends Definition<Item> {
public void setItemType(int itemType) {
this.itemType = itemType;
}
/**
* Gets the femaleWornModelId3 value.
* @return The femaleWornModelId3.

View file

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