This commit is contained in:
Ceikry 2020-03-27 15:35:17 -05:00
parent 0c78ae3b9d
commit 80744b709a
14 changed files with 288 additions and 10 deletions

View file

@ -296,8 +296,13 @@ public final class DoorActionHandler {
secondDir = (secondDir + 2) % 4;
}
Location secondLoc = firstLoc.transform((int) p.getX(), (int) p.getY(), 0);
ObjectBuilder.replace(object, object.transform(replaceId, firstDir, firstLoc), restoreTicks, clip);
ObjectBuilder.replace(second, second.transform(secondReplaceId, secondDir, secondLoc), restoreTicks, clip);
if(object.getId() == 36917 || object.getId() == 36919){
ObjectBuilder.replace(object, object.transform(36919, firstDir, firstLoc), restoreTicks, true);
ObjectBuilder.replace(second, second.transform(36917, secondDir, secondLoc), restoreTicks, true);
} else {
ObjectBuilder.replace(object, object.transform(replaceId, firstDir, firstLoc), restoreTicks, clip);
ObjectBuilder.replace(second, second.transform(secondReplaceId, secondDir, secondLoc), restoreTicks, clip);
}
}
/**

View file

@ -12,7 +12,7 @@ import java.util.List;
*/
public enum Consumables {
/** meats */
CHICKEN(new Food(2140, 2138, 2144, new ConsumableProperties(3), new CookingProperties(1, 30, 30))), UGTHANKI(new Food(1861, 1859, 2146, new ConsumableProperties(2), new CookingProperties(1, 40, 40))), RABBIT(new Food(3228, 3226, 7222, new ConsumableProperties(5), new CookingProperties(1, 30, 30))), YAK(new Food(2142, 10816, 2146, new ConsumableProperties(2), new CookingProperties(1, 30, 30))),
CHICKEN(new Food(2140, 2138, 2144, new ConsumableProperties(3), new CookingProperties(1, 30, 30))), UGTHANKI(new Food(1861, 1859, 2146, new ConsumableProperties(2), new CookingProperties(1, 40, 40))), RABBIT(new Food(3228, 3226, 7222, new ConsumableProperties(5), new CookingProperties(1, 30, 30))),
DARK_CRAB(new Food(14939, 14937, 14941, new ConsumableProperties(22), new CookingProperties(90, 215, 100))),
CRAB(new Food(7521, 7518, 7520, new ConsumableProperties(10), new CookingProperties(21, 100, 100))),
/** fish */

View file

@ -113,6 +113,10 @@ public final class JulietDialogue extends DialoguePlugin {
interpreter.sendDialogues(npc, null, "Quickly! Go and tell Romeo the plan!");
stage = 1002;
break;
default:
npc(FacialExpression.ANGRY,"Oh, Romeo, that no good scoundrel!");
stage = 22;
break;
}
return true;
}

View file

@ -757,6 +757,7 @@ public final class RJCutscenePlugin extends CutscenePlugin {
case 751:
end();
cutscene.stop(true);
quest.finish(player);
break;
}
return true;

View file

@ -51,6 +51,6 @@ public class SmithingApparenticeDialogue extends DialoguePlugin {
@Override
public int[] getIds() {
return new int[] { 4904 };
return new int[] { 7959,4904 };
}
}

View file

@ -0,0 +1,54 @@
package plugin.interaction.city.lumbridge;
import org.crandor.cache.def.impl.ObjectDefinition;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.player.Player;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Cow field sign manager
* @author ceik
*/
@InitializablePlugin
public class CowFieldSign extends OptionHandler {
private int DIALOGUE_KEY = 87905733;
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable{
new SignDialogue().init();
ObjectDefinition.forId(31297).getConfigurations().put("option:read",this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option){
if(node.getId() == 31297){
player.getDialogueInterpreter().open(DIALOGUE_KEY);
}
return true;
}
public final class SignDialogue extends DialoguePlugin{
public SignDialogue(){
/**
* Empty
*/
}
public SignDialogue(Player player){super(player);}
@Override
public DialoguePlugin newInstance(Player player){return new SignDialogue(player);}
@Override
public boolean open(Object... args){
interpreter.sendPlainMessage(false,"Wandering adventurers have killed " + CowPenZone.CowDeaths + " cows in this field.", "Local farmers call it an epidemic.");
return true;
}
@Override
public boolean handle(int componentId, int buttonId){
end();
return true;
}
public int[] getIds() {return new int[] {DIALOGUE_KEY};}
}
}

View file

@ -0,0 +1,52 @@
package plugin.interaction.city.lumbridge;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.item.GroundItemManager;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.map.zone.MapZone;
import org.crandor.game.world.map.zone.ZoneBorders;
import org.crandor.game.world.map.zone.ZoneBuilder;
import org.crandor.game.world.map.zone.ZoneRestriction;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
import org.crandor.tools.RandomFunction;
/**
* Zone for the lumbridge cow pen
* @author ceik
*/
@InitializablePlugin
public class CowPenZone extends MapZone implements Plugin<Object> {
public static int CowDeaths;
@Override
public Object fireEvent(String identifier, Object... args) {
return null;
}
public CowPenZone() {
super("lumbridge cows", true);
}
@Override
public void configure() {
super.register(new ZoneBorders(3242, 3255, 3265, 3297));
}
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ZoneBuilder.configure(this);
return this;
}
@Override
public boolean death(Entity e, Entity killer) {
if (killer instanceof Player && e instanceof NPC) {
CowDeaths++;
}
return false;
}
}

View file

@ -0,0 +1,38 @@
package plugin.interaction.city.lumbridge;
import org.crandor.cache.def.impl.ObjectDefinition;
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.object.GameObject;
import org.crandor.game.node.object.ObjectBuilder;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
/**
* Handles the chest in farmer fred's house
*
* @author ceik
*/
@InitializablePlugin
public class FredChest extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable{
ObjectDefinition.forId(37009).getConfigurations().put("option:open",this);
ObjectDefinition.forId(37010).getConfigurations().put("option:shut",this);
ObjectDefinition.forId(37010).getConfigurations().put("option:search",this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option){
if(option.equals("open")){
ObjectBuilder.replace(node.asObject(),new GameObject(37010,node.asObject().getLocation(),node.asObject().getRotation()));
} else if (option.equals("shut")){
ObjectBuilder.replace(node.asObject(),new GameObject(37009,node.asObject().getLocation(),node.asObject().getRotation()));
} else if (option.equals("search")){
player.getPacketDispatch().sendMessage("You search the chest but find nothing.");
}
return true;
}
}

View file

@ -0,0 +1,52 @@
package plugin.interaction.city.lumbridge;
import org.crandor.cache.def.impl.ObjectDefinition;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.player.Player;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
@InitializablePlugin
public class GnomeCopterSign extends OptionHandler {
public int DIALOGUE_ID = 989769182;
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
new SignDialogue().init();
ObjectDefinition.forId(30037).getConfigurations().put("option:read",this);
return this;
}
@Override
public boolean handle(Player player, Node node, String string) {
if (node.getId() == 30037) {
player.getDialogueInterpreter().open(DIALOGUE_ID);
}
return true;
}
public final class SignDialogue extends DialoguePlugin{
public SignDialogue(){
/**
* Empty
*/
}
public SignDialogue(Player player){super(player);}
@Override
public DialoguePlugin newInstance(Player player){ return new SignDialogue(player);}
@Override
public boolean open(Object... args){
interpreter.sendPlainMessage(false,"Come check out our gnome copters up north!","Disclaimer: EXTREMELY WIP");
stage = 0;
return true;
}
@Override
public boolean handle(int componentId, int buttonId){
end();
return true;
}
@Override
public int[] getIds(){return new int[] {DIALOGUE_ID};}
}
}

View file

@ -72,6 +72,7 @@ public final class FlourMakingPlugin extends OptionHandler {
extension.emptyChute();
player.getPacketDispatch().sendMessage("You operate the hopper. The grain slides down the chute.");
player.getConfigManager().set(CONFIG, 1);
player.setAttribute("/save:milling:grain",player.getAttribute("milling:grain",0) + 1);
}
break;
case "empty":
@ -98,6 +99,7 @@ public final class FlourMakingPlugin extends OptionHandler {
player.getInventory().add(FLOUR);
extension.decrement(1);
player.getPacketDispatch().sendMessage(!extension.isEmpty() ? "You fill a pot with flour from the bin." : "You fill a pot with the last of the flour in the bin.");
if (extension.getCharges() < 1) {
player.getConfigManager().set(CONFIG, 0);
}
@ -150,10 +152,13 @@ public final class FlourMakingPlugin extends OptionHandler {
* @param increment the increment.
*/
public final void increment(final int increment, boolean semi) {
if (semi) {
semiCharges += increment;
} else {
charges += increment;
if(player.getAttribute("milling:grain",0) < 30) {
if (semi) {
semiCharges += increment;
} else {
charges += increment;
}
player.setAttribute("/save:milling:grain",player.getAttribute("milling:grain",0) + 1);
}
}
@ -163,6 +168,9 @@ public final class FlourMakingPlugin extends OptionHandler {
*/
public final void decrement(final int increment) {
charges -= increment;
if(!(player.getAttribute("milling:grain",0) <= 0)){
player.setAttribute("/save:milling:grain",player.getAttribute("milling:grain",0) + 1);
}
}
/**

View file

@ -105,7 +105,6 @@ public class ReadSignPostPlugin extends OptionHandler {
ObjectDefinition.forId(30039).getConfigurations().put("option:read", this);
ObjectDefinition.forId(30040).getConfigurations().put("option:read", this);
ObjectDefinition.forId(31296).getConfigurations().put("option:read", this);
ObjectDefinition.forId(31297).getConfigurations().put("option:read", this);
ObjectDefinition.forId(31298).getConfigurations().put("option:read", this);
ObjectDefinition.forId(31299).getConfigurations().put("option:read", this);
ObjectDefinition.forId(31300).getConfigurations().put("option:read", this);

View file

@ -0,0 +1,64 @@
package plugin.npc.city.lumbridge;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.item.Item;
import org.crandor.plugin.InitializablePlugin;
/**
* @author ceik
*/
@InitializablePlugin
public class MilleMiller extends DialoguePlugin {
public MilleMiller(){
/**
* Empty
*/
}
public MilleMiller(Player player){ super(player);}
@Override
public DialoguePlugin newInstance(Player player){return new MilleMiller(player);}
@Override
public boolean open(Object... args){
player("Hello, there. Can you teach me how","to make wheat?");
return true;
}
@Override
public boolean handle(int componentId, int buttonId){
switch(stage){
case 0:
npc("Certainly! You first need to gather wheat from","the field nearby, then you go on up","to the top, put it in the hopper, and","flip those levers!");
stage++;
break;
case 1:
npc("Afterwords, you need to make sure you have","a pot, and come down and grab your wheat!");
stage++;
break;
case 2:
if(!player.getInventory().containsItem(new Item(1931))){
player("Could you give me one of those?");
stage = 4;
} else {
player("Thanks!");
stage++;
}
break;
case 3:
end();
break;
case 4:
npc("Sure thing!");
stage++;
break;
case 5:
end();
player.getInventory().add(new Item(1931));
break;
}
return true;
}
@Override
public int[] getIds() {return new int[] {3806};}
}

View file

@ -41,7 +41,7 @@ public final class JulietNPC extends AbstractNPC {
@Override
public boolean isHidden(final Player player) {
return player.getQuestRepository().getQuest("Romeo & Juliet").getStage(player) > 60;
return player.getQuestRepository().getQuest("Romeo & Juliet").getStage(player) > 60 && player.getQuestRepository().getQuest("Romeo & Juliet").getStage(player) < 100;
}
@Override

View file

@ -1,5 +1,6 @@
package plugin.quest;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.game.node.entity.player.link.quest.Quest;