Reimplemented broken farming files
This commit is contained in:
@@ -1,24 +1,27 @@
|
|||||||
package core.game.node.entity.npc.familiar;
|
package core.game.node.entity.npc.familiar;
|
||||||
|
|
||||||
import core.plugin.Initializable;
|
|
||||||
import core.game.content.dialogue.DialogueInterpreter;
|
import core.game.content.dialogue.DialogueInterpreter;
|
||||||
import core.game.content.dialogue.DialoguePlugin;
|
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.NodeUsageEvent;
|
||||||
import core.game.interaction.UseWithHandler;
|
import core.game.interaction.UseWithHandler;
|
||||||
import core.game.node.entity.combat.ImpactHandler.HitsplatType;
|
import core.game.node.entity.combat.ImpactHandler.HitsplatType;
|
||||||
import core.game.node.entity.combat.equipment.WeaponInterface;
|
import core.game.node.entity.combat.equipment.WeaponInterface;
|
||||||
import core.game.node.entity.player.Player;
|
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.item.Item;
|
||||||
import core.game.node.object.GameObject;
|
import core.game.node.object.GameObject;
|
||||||
import core.game.world.update.flag.context.Animation;
|
import core.game.world.update.flag.context.Animation;
|
||||||
import core.game.world.update.flag.context.Graphics;
|
import core.game.world.update.flag.context.Graphics;
|
||||||
|
import core.plugin.Initializable;
|
||||||
import core.plugin.Plugin;
|
import core.plugin.Plugin;
|
||||||
import rs09.plugin.PluginManager;
|
|
||||||
import core.tools.RandomFunction;
|
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.
|
* 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.");
|
owner.getPacketDispatch().sendMessage("This scroll can only be used on an empty compost bin.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*final CompostBin bin = owner.getFarmingManager().getCompostManager().getBin(object);
|
CompostBins cbin = CompostBins.forObject(special.getNode().asObject());
|
||||||
if (bin.getState(owner) != 0) {
|
if(cbin == null){
|
||||||
owner.getPacketDispatch().sendMessage("This scroll can only be used on an empty compost bin.");
|
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
|
CompostBin bin = cbin.getBinForPlayer(owner);
|
||||||
|
if(bin.isFinished() || bin.isFull() || bin.isClosed()){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
final boolean superCompost = RandomFunction.random(10) == 1;
|
final boolean superCompost = RandomFunction.random(10) == 1;
|
||||||
faceLocation(object.getLocation());
|
faceLocation(object.getLocation());
|
||||||
/*bin.getContainer().add(new Item(superCompost ? 6034 : 6032, 15));
|
Item toAdd = new Item(superCompost ? Items.PINEAPPLE_2114 : Items.POTATO_1942);
|
||||||
bin.addConfigValue(owner, 31 << bin.getBitShift());*/
|
toAdd.setAmount(15);
|
||||||
|
bin.addItem(toAdd);
|
||||||
|
bin.close();
|
||||||
animate(Animation.create(7775));
|
animate(Animation.create(7775));
|
||||||
graphics(Graphics.create(1424));
|
graphics(Graphics.create(1424));
|
||||||
return true;
|
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.Animation;
|
||||||
import core.game.world.update.flag.context.Graphics;
|
import core.game.world.update.flag.context.Graphics;
|
||||||
import core.plugin.Plugin;
|
import core.plugin.Plugin;
|
||||||
|
import rs09.game.node.entity.skill.farming.FarmingPatch;
|
||||||
|
import rs09.game.node.entity.skill.farming.Patch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cures a diseased plant.
|
* Cures a diseased plant.
|
||||||
@@ -53,36 +55,28 @@ public final class CurePlantSpell extends MagicSpell {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final GameObject object = ((GameObject) target);
|
final GameObject object = ((GameObject) target);
|
||||||
/*if (FarmingPatch.forObject(object.getWrapper().getId()) == null) {
|
FarmingPatch fPatch = FarmingPatch.forObject(object);
|
||||||
return false;
|
if(fPatch == null){
|
||||||
}*/
|
player.sendMessage("This spell is for plants... not whatever the heckies that is.");
|
||||||
/*final PatchWrapper wrapper = player.getFarmingManager().getPatchWrapper(object.getWrapper().getId());
|
|
||||||
if (wrapper == null) {
|
|
||||||
player.getPacketDispatch().sendMessage("Umm... this spell won't cure that!");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!wrapper.getCycle().getDiseaseHandler().isDiseased() && (wrapper.getCycle().getGrowthHandler().isGrowing() || wrapper.getCycle().getWaterHandler().isWatered())) {
|
Patch patch = fPatch.getPatchFor(player);
|
||||||
player.getPacketDispatch().sendMessage("It is growing just fine.");
|
if(!patch.isDiseased() && !patch.isWeedy()){
|
||||||
|
player.sendMessage("It seems to be growing fine already, lad.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (wrapper.isWeedy()) {
|
if(patch.isWeedy()){
|
||||||
player.getPacketDispatch().sendMessage("The weeds are healthy enough already.");
|
player.sendMessage("Trust me lad, the weeds are healthy enough as is.");
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
/*if (wrapper.isEmpty()) {
|
if(patch.isDead()){
|
||||||
player.getPacketDispatch().sendMessage("There's nothing there to cure.");
|
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;
|
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)) {
|
if (!super.meetsRequirements(player, true, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*
|
patch.cureDisease();
|
||||||
wrapper.getCycle().getDiseaseHandler().cure(player, true);
|
|
||||||
*/
|
|
||||||
player.animate(ANIMATION);
|
player.animate(ANIMATION);
|
||||||
player.graphics(GRAPHIC);
|
player.graphics(GRAPHIC);
|
||||||
player.getSkills().addExperience(Skills.FARMING, 91.5, true);
|
player.getSkills().addExperience(Skills.FARMING, 91.5, true);
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
package core.game.node.entity.skill.magic.lunar;
|
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.Node;
|
||||||
import core.game.node.entity.Entity;
|
import core.game.node.entity.Entity;
|
||||||
import core.game.node.entity.combat.equipment.SpellType;
|
import core.game.node.entity.combat.equipment.SpellType;
|
||||||
import core.game.node.entity.player.Player;
|
import core.game.node.entity.player.Player;
|
||||||
import core.game.node.entity.player.link.SpellBookManager.SpellBook;
|
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.item.Item;
|
||||||
import core.game.node.object.GameObject;
|
import core.game.node.object.GameObject;
|
||||||
import core.game.world.update.flag.context.Animation;
|
import core.game.world.update.flag.context.Animation;
|
||||||
import core.game.world.update.flag.context.Graphics;
|
import core.game.world.update.flag.context.Graphics;
|
||||||
import core.plugin.Initializable;
|
import core.plugin.Initializable;
|
||||||
import core.plugin.Plugin;
|
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.
|
* Represents the fertile soil spell plugin.
|
||||||
@@ -49,17 +52,20 @@ public final class FertileSoilSpell extends MagicSpell {
|
|||||||
public boolean cast(Entity entity, Node target) {
|
public boolean cast(Entity entity, Node target) {
|
||||||
final Player player = ((Player) entity);
|
final Player player = ((Player) entity);
|
||||||
final GameObject object = (GameObject) target;
|
final GameObject object = (GameObject) target;
|
||||||
/*if (FarmingPatch.forObject(object.getWrapper().getId()) == null) {
|
final FarmingPatch fPatch = FarmingPatch.forObject(object);
|
||||||
|
if(fPatch == null){
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
/*final PatchWrapper wrapper = player.getFarmingManager().getPatchWrapper(object.getWrapper().getId());
|
final Patch patch = fPatch.getPatchFor(player);
|
||||||
if (!wrapper.isEmpty() && !wrapper.getCycle().getGrowthHandler().isGrowing()) {
|
if(patch.getCompost() != CompostType.NONE){
|
||||||
player.getPacketDispatch().sendMessage("You can't fertilize the patch.");
|
player.sendMessage("This patch has already been composted.");
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
if (!super.meetsRequirements(player, true, true)) {
|
if (!super.meetsRequirements(player, true, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
patch.setCompost(CompostType.SUPER);
|
||||||
|
player.sendMessage("You fertilize the soil.");
|
||||||
player.graphics(GRAPHIC);
|
player.graphics(GRAPHIC);
|
||||||
player.animate(ANIMATION);
|
player.animate(ANIMATION);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -87,7 +87,13 @@ class CompostBin(val player: Player, val bin: CompostBins) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun addItem(item: Item){
|
fun addItem(item: Item){
|
||||||
addItem(item.id)
|
val remaining = 15 - items.size
|
||||||
|
val amount = if(item.amount > remaining){
|
||||||
|
remaining
|
||||||
|
} else item.amount
|
||||||
|
for(i in 0 until amount) {
|
||||||
|
addItem(item.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateBit(){
|
fun updateBit(){
|
||||||
|
|||||||
+10
-19
@@ -46,26 +46,17 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
|
|||||||
SEED_ATTRACTION("cape_perks:seed_attract",{player ->
|
SEED_ATTRACTION("cape_perks:seed_attract",{player ->
|
||||||
val time = player.getAttribute("cape_perks:seed_attract_timer",0L)
|
val time = player.getAttribute("cape_perks:seed_attract_timer",0L)
|
||||||
if(System.currentTimeMillis() > time){
|
if(System.currentTimeMillis() > time){
|
||||||
/*for(i in 0 until 10) {
|
val possibleSeeds = rs09.game.node.entity.skill.farming.Plantable.values()
|
||||||
when (core.tools.RandomFunction.random(100) % 4) {
|
for(i in 0 until 10){
|
||||||
0 -> {
|
var seed = possibleSeeds.random()
|
||||||
val seedID = core.game.node.entity.skill.farming.patch.Allotments.values().random().farmingNode.seed.id
|
while(seed == rs09.game.node.entity.skill.farming.Plantable.SCARECROW || seed.applicablePatch == rs09.game.node.entity.skill.farming.PatchType.FRUIT_TREE || seed.applicablePatch == rs09.game.node.entity.skill.farming.PatchType.TREE || seed.applicablePatch == rs09.game.node.entity.skill.farming.PatchType.SPIRIT_TREE){
|
||||||
player.inventory.add(core.game.node.item.Item(seedID,1))
|
seed = possibleSeeds.random()
|
||||||
}
|
|
||||||
1 -> {
|
|
||||||
val seedID = core.game.node.entity.skill.farming.patch.Herbs.values().random().farmingNode.seed.id
|
|
||||||
player.inventory.add(core.game.node.item.Item(seedID, 1))
|
|
||||||
}
|
|
||||||
2 -> {
|
|
||||||
val seedID = core.game.node.entity.skill.farming.patch.Hops.values().random().farmingNode.seed.id
|
|
||||||
player.inventory.add(core.game.node.item.Item(seedID, 1))
|
|
||||||
}
|
|
||||||
3 -> {
|
|
||||||
val seedID = core.game.node.entity.skill.farming.patch.Flowers.values().random().farmingNode.seed.id
|
|
||||||
player.inventory.add(core.game.node.item.Item(seedID, 1))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}*/
|
val reward = core.game.node.item.Item(seed.itemID)
|
||||||
|
if(!player.inventory.add(reward)){
|
||||||
|
core.game.node.item.GroundItemManager.create(reward,player)
|
||||||
|
}
|
||||||
|
}
|
||||||
player.dialogueInterpreter.sendDialogue("You pluck off the seeds that were stuck to your cape.")
|
player.dialogueInterpreter.sendDialogue("You pluck off the seeds that were stuck to your cape.")
|
||||||
player.setAttribute("/save:cape_perks:seed_attract_timer",System.currentTimeMillis() + java.util.concurrent.TimeUnit.DAYS.toMillis(1))
|
player.setAttribute("/save:cape_perks:seed_attract_timer",System.currentTimeMillis() + java.util.concurrent.TimeUnit.DAYS.toMillis(1))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user