Fixed many small bugs.

Fixed the small stuff for the big picture.
This commit is contained in:
jamix77 2020-03-29 18:07:38 +01:00
parent b739673807
commit 9efcb103f1
9 changed files with 352 additions and 7 deletions

View file

@ -0,0 +1,144 @@
package plugin.dialogue;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.content.dialogue.FacialExpression;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.map.RegionManager;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.RandomFunction;
/**
* Represents the dialogue plugin used for the anja npc.
* @author jamix77
*/
@InitializablePlugin
public final class AnjaDialoguePlugin extends DialoguePlugin {
/**
*
* Constructs a new @{Code AnjaDialoguePlugin} object.
*/
public AnjaDialoguePlugin() {
/**
* empty.
*/
}
/**
* Constructs a new {@code AjjatDialoguePlugin} {@code Object}.
* @param player the player.
*/
public AnjaDialoguePlugin(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new AnjaDialoguePlugin(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
player("Hello.");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
npc("Hello sir. What are you doing in my house?");
stage = 1;
break;
case 1:
interpreter.sendOptions("Select an Option", "I'm just wandering around.", "I was hoping you'd give me some free stuff.", "I've come to kill you.");
stage = 2;
break;
case 2:
if (buttonId == 1) {
player("I'm just wondering around.");
stage = 3;
} else if (buttonId == 2) {
player("I was hoping you'd give me some free stuff.");
stage = 10;
} else if (buttonId == 3) {
player("I've come to kill you.");
stage = 13;
}
break;
case 3:
npc("Oh dear are you lost?");
stage++;
break;
case 4:
interpreter.sendOptions("Select an Option.", "Yes, I'm lost.", "No, I know where I am.");
stage++;
break;
case 5:
switch (buttonId) {
case 1:
player("Yes, I'm lost.");
stage =6;
break;
case 2:
player("No I know where I am.");
stage = 8;
break;
}
break;
case 6:
npc("Okay, just walk north-east when you leave this house,","and soon you'll reach the big city of Falador.");
stage++;
break;
case 7:
player("Thanks a lot.");
stage = 605;
break;
case 8:
npc("Oh? Well, would you mind wandering somewhere else?", "This is my house.");
stage++;
break;
case 9:
player("Meh!");
stage = 605;
break;
case 10:
String[] dialogues = {"Do you REALLY need it","I don't have much on me...", "I don't know..."};
npc(dialogues[RandomFunction.random(0, 2)]);
stage++;
break;
case 11:
interpreter.sendDialogues(player, FacialExpression.ASKING, "I promise I'll stop bothering you!", "Pleeease!","Pwetty pleathe wiv thugar on top!");
stage++;
break;
case 12:
npc("Oh, alright. Here you go.");
player.getInventory().add(new Item(995,RandomFunction.random(1, 3)));
stage = 605;
break;
case 13:
npc.sendChat("Eeeek!");
for (NPC npc1 : RegionManager.getLocalNpcs(player)) {
if (npc1.getName().equalsIgnoreCase("Hengel")) {
npc1.sendChat("Aaaaarrgh!");
break;
}
}
end();
break;
case 605:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 2684 };
}
}

View file

@ -0,0 +1,77 @@
package plugin.dialogue;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.plugin.InitializablePlugin;
/**
* Represents the dialogue plugin used for the goblin village guard npc.
* @author jamix77
*/
@InitializablePlugin
public final class GoblinVillageGuardDialogue extends DialoguePlugin {
/**
*
* Constructs a new @{Code HengelDialoguePlugin} object.
*/
public GoblinVillageGuardDialogue() {
/**
* empty.
*/
}
/**
*
* Constructs a new @{Code GoblinVillageGuardDialogue} object.
* @param player
*/
public GoblinVillageGuardDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new GoblinVillageGuardDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
player("You're a long way out from the city.");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
npc("I know. We guards uaully stay by banks and shops,", "but I got sent all the way out here to keep an eye on","the brigands loitering just south of here.");
stage = 1;
break;
case 1:
player("Sounds more exciting than standing", "around guarding banks and shops.");
stage = 2;
break;
case 2:
npc("It's not too bad. At least I don't get attacked so often", "out here. Guards in the cities get killed all the time.");
stage++;
break;
case 3:
player("Honestly people these days just don't know how to behave!");
stage++;
break;
case 4:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 3241 };
}
}

View file

@ -0,0 +1,115 @@
package plugin.dialogue;
import org.crandor.game.content.dialogue.DialoguePlugin;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.map.RegionManager;
import org.crandor.plugin.InitializablePlugin;
/**
* Represents the dialogue plugin used for the hengel npc.
* @author jamix77
*/
@InitializablePlugin
public final class HengelDialoguePlugin extends DialoguePlugin {
/**
*
* Constructs a new @{Code HengelDialoguePlugin} object.
*/
public HengelDialoguePlugin() {
/**
* empty.
*/
}
/**
* Constructs a new {@code AjjatDialoguePlugin} {@code Object}.
* @param player the player.
*/
public HengelDialoguePlugin(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new HengelDialoguePlugin(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
player("Hello.");
stage = 0;
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case 0:
npc("What are you doing here?");
stage = 1;
break;
case 1:
interpreter.sendOptions("Select an Option", "I'm just wandering around.", "I was hoping you'd give me some free stuff.", "I've come to kill you.");
stage = 2;
break;
case 2:
if (buttonId == 1) {
player("I'm just wondering around.");
stage = 3;
} else if (buttonId == 2) {
player("I was hoping you'd give me some free stuff.");
stage = 7;
} else if (buttonId == 3) {
player("I've come to kill you.");
stage = 9;
}
break;
case 3:
npc("You do realise you're wandering around in my house?");
stage++;
break;
case 4:
player("Yep.");
stage++;
break;
case 5:
npc("Well please get out!");
stage++;
break;
case 6:
player("Sheesh, keep your wig on!");
stage = 605;
break;
case 7:
npc("No, I jolly well wouldn't!","Get out of my house");
stage++;
break;
case 8:
player("Meanie!");
stage = 605;
break;
case 9:
npc.sendChat("Aaaaarrgh!");
for (NPC npc1 : RegionManager.getLocalNpcs(player)) {
if (npc1.getName().equalsIgnoreCase("anja")) {
npc1.sendChat("Eeeek!");
break;
}
}
end();
break;
case 605:
end();
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 2683 };
}
}

View file

@ -305,7 +305,7 @@ public final class LeelaDialogue extends DialoguePlugin {
stage = 21;
break;
case 21:
interpreter.sendDialogues(npc, null, "Get some soft clay and get her to sho you the key", "somehow. Then take the print, with bronze, to my", "father.");
interpreter.sendDialogues(npc, null, "Get some soft clay and get her to show you the key", "somehow. Then take the print, with bronze, to my", "father.");
stage = 22;
break;
case 22:

View file

@ -58,7 +58,7 @@ public class NarfsDialogue extends DialoguePlugin {
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "That's a funny name you've got.");
interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "That's a funny name you've got.");
stage = 1;
return true;
}

View file

@ -25,7 +25,7 @@ public class ReadSignPostPlugin extends OptionHandler {
* @author 'Vexia
*/
public enum Signs {
NEAR_LUMBRIDGE(18493, "North to farms and<br> Varrock.", "The River Lum lies to<br> the south.", "West to<br>Lumbridge.", "East to Al<br>Kharid - toll<br>gate; bring some<br>money."), NEAR_VARROCK(24263, "Varrock", "Lumbridge", "Draynor Manor", "Dig Site");
NEAR_LUMBRIDGE(18493, "North to farms and<br> Varrock.", "The River Lum lies to<br> the south.", "West to<br>Lumbridge.", "East to Al<br>Kharid - toll<br>gate; bring some<br>money."), NEAR_VARROCK(24263, "Sheep lay this way.", "South through farms<br> to Al Kharid and<br> Lumbridge", "West to Champion's Guild<br> and Varrock south<br> gate.", "East to Al Kharid mine and<br> follow the path north to<br> Varrock east gate.");
public static Signs forId(int id) {
for (Signs sign : Signs.values()) {
@ -76,10 +76,17 @@ public class ReadSignPostPlugin extends OptionHandler {
if (sign == null) {
return false;
}
player.getPacketDispatch().sendString(sign.directions[0], 135, 3); // North
player.getPacketDispatch().sendString(sign.directions[1], 135, 9); // South
player.getPacketDispatch().sendString(sign.directions[2], 135, 12); // West
player.getPacketDispatch().sendString(sign.directions[3], 135, 8); // East
String[] dirs = sign.directions;
if (object.getLocation().getX() == 3107 && object.getLocation().getY() == 3296) {
dirs[0] = "North to Draynor<br> Manor";
dirs[1] = "South to Draynor<br> Village";
dirs[2] = "West to Port<br> Sarim";
dirs[3] = "East to<br> Lumbridge";
}
player.getPacketDispatch().sendString(dirs[0], 135, 3); // North
player.getPacketDispatch().sendString(dirs[1], 135, 9); // South
player.getPacketDispatch().sendString(dirs[2], 135, 12); // West
player.getPacketDispatch().sendString(dirs[3], 135, 8); // East
return true;
}

View file

@ -22,6 +22,7 @@ public final class GuardNPC extends AbstractNPC {
*/
public GuardNPC() {
super(0, null, true);
this.setAggressive(false);
}
/**
@ -31,6 +32,7 @@ public final class GuardNPC extends AbstractNPC {
*/
private GuardNPC(int id, Location location) {
super(id, location, true);
this.setAggressive(false);
}
@Override