Reimplemented broken farming files

This commit is contained in:
Ceikry
2021-03-14 14:54:50 -05:00
parent 3e3835b4f5
commit 2c6fa3b63b
5 changed files with 66 additions and 61 deletions
@@ -1,24 +1,27 @@
package core.game.node.entity.npc.familiar;
import core.plugin.Initializable;
import core.game.content.dialogue.DialogueInterpreter;
import core.game.content.dialogue.DialoguePlugin;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.summoning.familiar.Familiar;
import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial;
import core.game.node.entity.skill.summoning.familiar.Forager;
import core.game.interaction.NodeUsageEvent;
import core.game.interaction.UseWithHandler;
import core.game.node.entity.combat.ImpactHandler.HitsplatType;
import core.game.node.entity.combat.equipment.WeaponInterface;
import core.game.node.entity.player.Player;
import core.game.node.entity.skill.Skills;
import core.game.node.entity.skill.summoning.familiar.Familiar;
import core.game.node.entity.skill.summoning.familiar.FamiliarSpecial;
import core.game.node.entity.skill.summoning.familiar.Forager;
import core.game.node.item.Item;
import core.game.node.object.GameObject;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
import rs09.plugin.PluginManager;
import core.tools.RandomFunction;
import org.rs09.consts.Items;
import rs09.game.node.entity.skill.farming.CompostBin;
import rs09.game.node.entity.skill.farming.CompostBins;
import rs09.plugin.PluginManager;
/**
* Represents the Compost Mound familiar.
@@ -74,15 +77,20 @@ public class CompostMoundNPC extends Forager {
owner.getPacketDispatch().sendMessage("This scroll can only be used on an empty compost bin.");
return false;
}
/*final CompostBin bin = owner.getFarmingManager().getCompostManager().getBin(object);
if (bin.getState(owner) != 0) {
owner.getPacketDispatch().sendMessage("This scroll can only be used on an empty compost bin.");
CompostBins cbin = CompostBins.forObject(special.getNode().asObject());
if(cbin == null){
return false;
}*/
}
CompostBin bin = cbin.getBinForPlayer(owner);
if(bin.isFinished() || bin.isFull() || bin.isClosed()){
return false;
}
final boolean superCompost = RandomFunction.random(10) == 1;
faceLocation(object.getLocation());
/*bin.getContainer().add(new Item(superCompost ? 6034 : 6032, 15));
bin.addConfigValue(owner, 31 << bin.getBitShift());*/
Item toAdd = new Item(superCompost ? Items.PINEAPPLE_2114 : Items.POTATO_1942);
toAdd.setAmount(15);
bin.addItem(toAdd);
bin.close();
animate(Animation.create(7775));
graphics(Graphics.create(1424));
return true;
@@ -14,6 +14,8 @@ import core.game.node.object.GameObject;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Plugin;
import rs09.game.node.entity.skill.farming.FarmingPatch;
import rs09.game.node.entity.skill.farming.Patch;
/**
* Cures a diseased plant.
@@ -53,36 +55,28 @@ public final class CurePlantSpell extends MagicSpell {
return false;
}
final GameObject object = ((GameObject) target);
/*if (FarmingPatch.forObject(object.getWrapper().getId()) == null) {
return false;
}*/
/*final PatchWrapper wrapper = player.getFarmingManager().getPatchWrapper(object.getWrapper().getId());
if (wrapper == null) {
player.getPacketDispatch().sendMessage("Umm... this spell won't cure that!");
FarmingPatch fPatch = FarmingPatch.forObject(object);
if(fPatch == null){
player.sendMessage("This spell is for plants... not whatever the heckies that is.");
return false;
}
if (!wrapper.getCycle().getDiseaseHandler().isDiseased() && (wrapper.getCycle().getGrowthHandler().isGrowing() || wrapper.getCycle().getWaterHandler().isWatered())) {
player.getPacketDispatch().sendMessage("It is growing just fine.");
Patch patch = fPatch.getPatchFor(player);
if(!patch.isDiseased() && !patch.isWeedy()){
player.sendMessage("It seems to be growing fine already, lad.");
return false;
}
if (wrapper.isWeedy()) {
player.getPacketDispatch().sendMessage("The weeds are healthy enough already.");
if(patch.isWeedy()){
player.sendMessage("Trust me lad, the weeds are healthy enough as is.");
return false;
}*/
/*if (wrapper.isEmpty()) {
player.getPacketDispatch().sendMessage("There's nothing there to cure.");
}
if(patch.isDead()){
player.sendMessage("It says 'Cure' not 'Resurrect'. Although death may arise from disease, it is not in itself a disease and hence cannot be cured. So there.");
return false;
}*/
/*if (wrapper.getCycle().getDeathHandler().isDead()) {
player.getPacketDispatch().sendMessage("It says 'Cure' not 'Resurrect'. Although death may arise from disease, it is not in itself a disease and hence cannot be cured. So there.");
return false;
}*/
}
if (!super.meetsRequirements(player, true, true)) {
return false;
}
/*
wrapper.getCycle().getDiseaseHandler().cure(player, true);
*/
patch.cureDisease();
player.animate(ANIMATION);
player.graphics(GRAPHIC);
player.getSkills().addExperience(Skills.FARMING, 91.5, true);
@@ -1,18 +1,21 @@
package core.game.node.entity.skill.magic.lunar;
import core.game.node.entity.skill.magic.MagicSpell;
import core.game.node.entity.skill.magic.Runes;
import core.game.node.Node;
import core.game.node.entity.Entity;
import core.game.node.entity.combat.equipment.SpellType;
import core.game.node.entity.player.Player;
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
import core.game.node.entity.skill.magic.MagicSpell;
import core.game.node.entity.skill.magic.Runes;
import core.game.node.item.Item;
import core.game.node.object.GameObject;
import core.game.world.update.flag.context.Animation;
import core.game.world.update.flag.context.Graphics;
import core.plugin.Initializable;
import core.plugin.Plugin;
import rs09.game.node.entity.skill.farming.CompostType;
import rs09.game.node.entity.skill.farming.FarmingPatch;
import rs09.game.node.entity.skill.farming.Patch;
/**
* Represents the fertile soil spell plugin.
@@ -49,17 +52,20 @@ public final class FertileSoilSpell extends MagicSpell {
public boolean cast(Entity entity, Node target) {
final Player player = ((Player) entity);
final GameObject object = (GameObject) target;
/*if (FarmingPatch.forObject(object.getWrapper().getId()) == null) {
final FarmingPatch fPatch = FarmingPatch.forObject(object);
if(fPatch == null){
return false;
}*/
/*final PatchWrapper wrapper = player.getFarmingManager().getPatchWrapper(object.getWrapper().getId());
if (!wrapper.isEmpty() && !wrapper.getCycle().getGrowthHandler().isGrowing()) {
player.getPacketDispatch().sendMessage("You can't fertilize the patch.");
}
final Patch patch = fPatch.getPatchFor(player);
if(patch.getCompost() != CompostType.NONE){
player.sendMessage("This patch has already been composted.");
return false;
}*/
}
if (!super.meetsRequirements(player, true, true)) {
return false;
}
patch.setCompost(CompostType.SUPER);
player.sendMessage("You fertilize the soil.");
player.graphics(GRAPHIC);
player.animate(ANIMATION);
return true;