From 050225cc243202065a9dc4b5b95d48f9e45edf02 Mon Sep 17 00:00:00 2001 From: qahowers Date: Wed, 4 Mar 2020 19:58:12 -0500 Subject: [PATCH] Adds attack bonus to cup of tea Adds ability to remove-legs on swamp toads --- .../plugin/consumable/CupofTeaPlugin.class | Bin 1666 -> 2155 bytes RS-2009.iml | 2 + .../src/plugin/consumable/CupofTeaPlugin.java | 16 +++++++- .../skill/herblore/SwampToadPlugin.java | 36 ++++++++++++++++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Server/src/plugin/skill/herblore/SwampToadPlugin.java diff --git a/CompiledServer/production/RS-2009/plugin/consumable/CupofTeaPlugin.class b/CompiledServer/production/RS-2009/plugin/consumable/CupofTeaPlugin.class index 87060dc60d0c2db6b51d3ebcdda85a219e17fe1c..cab20e2ce1a5661f865df1b580c59ac3b50b9b87 100644 GIT binary patch delta 838 zcmZ`%&u8MM};hfllhE<^H8)vd`f ztGoK3(@EEbofCJ(wOoU7)?#q}Q{cW}ZOg1bY2IJ0H6JfETb;HB%iUsSHs@xfj{kyz zd0b>DxuZ(SG%$us!dzxZ2*}~RkOqRV7$)}e>58r^?v_*yR}3uRs(~tM1{QJ6Kp2sC z3v!gHJYJcvxXa3t>1(d6csnrMj=Re&>3&l}?p@h8v=_0MxZ%E0?m2!^2c)GW7*I5V z5Qe~Tz{~1TC?+7XQFmI6_J%1hvd;nj4jmjkmzz{(Jaq_(cq1f~}9?dNuGRbVyl@KdKUP#Psr;or}igtA1m=zjY|Lp!pb%*leUnQwD O9gNi@is_`^d-Yyb*Xz$jFV=YbdUyuVz>$p-$`&d%Bvx$L@GVp$sM%P>ny%Mv z7^qv===VB8#pIQ`ku9;QUgULj%b~=!Kudjy8C5e%wgV44`r1|Rp_9a(gMA!0I7HKd zi}?L<*c0l~I8_<*qG(Va5XfQz4r7d!go!Y74)ac^Thr?%iEDqr40~Cmm`w+@i8Llz zfvhQFg2zKfGl{i{3dXdbl&_DF9V2Ny4G|h5+$StC7S2<&5D04{q>O|GpX_EwdS?jn z0B$X14q%=8wdxR&v6LHhOR!MpE|owo_rv(}>0%ah!4od#u>hH9bJs + + diff --git a/Server/src/plugin/consumable/CupofTeaPlugin.java b/Server/src/plugin/consumable/CupofTeaPlugin.java index 845a70680..6532529ca 100644 --- a/Server/src/plugin/consumable/CupofTeaPlugin.java +++ b/Server/src/plugin/consumable/CupofTeaPlugin.java @@ -3,6 +3,8 @@ package plugin.consumable; import org.crandor.game.content.global.consumable.ConsumableProperties; import org.crandor.game.content.global.consumable.Consumables; import org.crandor.game.content.global.consumable.Drink; +import org.crandor.game.content.skill.SkillBonus; +import org.crandor.game.content.skill.Skills; import org.crandor.game.node.entity.player.Player; import org.crandor.plugin.InitializablePlugin; import org.crandor.game.node.item.Item; @@ -15,6 +17,11 @@ import org.crandor.game.node.item.Item; @InitializablePlugin public final class CupofTeaPlugin extends Drink { + /** + * Represents the skill bonuses for each beer. + */ + private SkillBonus[] bonuses; + /** * Represents the force chat to use. */ @@ -30,12 +37,19 @@ public final class CupofTeaPlugin extends Drink { * Constructs a new {@code CupofTeaPlugin} {@code Object}. */ public CupofTeaPlugin() { - super(712, new ConsumableProperties(2, 1980)); + super(712, new ConsumableProperties(3, 1980)); + this.bonuses = new SkillBonus[1]; + this.bonuses[0] = new SkillBonus(Skills.ATTACK, 0, 3); } @Override public void consume(final Item item, final Player player) { player.sendChat(CHAT); + if (this.bonuses != null) { + for (SkillBonus b : bonuses) { + addBonus(player, b); + } + } super.remove(player, item); } diff --git a/Server/src/plugin/skill/herblore/SwampToadPlugin.java b/Server/src/plugin/skill/herblore/SwampToadPlugin.java new file mode 100644 index 000000000..56c9443e9 --- /dev/null +++ b/Server/src/plugin/skill/herblore/SwampToadPlugin.java @@ -0,0 +1,36 @@ +package plugin.skill.herblore; + + +import org.crandor.cache.def.impl.ItemDefinition; +import org.crandor.game.interaction.OptionHandler; +import org.crandor.game.node.Node; +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.item.Item; +import org.crandor.plugin.InitializablePlugin; +import org.crandor.plugin.Plugin; + +/** + * Represents the swamp toad plugin. + * @author Zombiemode + * @version 1.0 + */ +@InitializablePlugin +public final class SwampToadPlugin extends OptionHandler { + @Override + public Plugin newInstance(Object arg) throws Throwable { + ItemDefinition.setOptionHandler("remove-legs", this); + return this; + } + + @Override + public boolean handle(Player player, Node node, String option) { + if (player.getInventory().replace(new Item(2152), ((Item) node).getSlot()) != null) { + player.getPacketDispatch().sendMessage("You pull the legs off the toad. Poor toad. At least they'll grow back."); + } + return true; + } + + @Override + public boolean isWalk() { return false; } +} +