Updated quests. BlackKnightFortress has some errors due to a missing method.

This commit is contained in:
CodeForFame 2011-06-25 00:59:47 -05:00
parent d7e4583d3b
commit 07876364da
6 changed files with 610 additions and 531 deletions

View File

@ -1,19 +1,18 @@
import org.rscdaemon.server.quest.*; import org.moparscape.msc.gs.event.SingleEvent;
import org.rscdaemon.server.model.*; import org.moparscape.msc.gs.model.GameObject;
import org.rscdaemon.server.event.*; import org.moparscape.msc.gs.model.MenuHandler;
import org.moparscape.msc.gs.model.Npc;
import org.moparscape.msc.gs.model.Player;
import org.moparscape.msc.gs.quest.Quest;
import org.moparscape.msc.gs.quest.QuestAction;
/** /**
* Quest: Black Knight's Fortress (v1.0) * Quest: Black Knight's Fortress (v1.0) Status: INCOMPLETE Start: 304, 1507
* Status: INCOMPLETE * Stage1: 269, 441 Items: - Rewards: -
* Start: 304, 1507
* Stage1: 269, 441
* Items: -
* Rewards: -
* *
* @author youKnowWho * @author youKnowWho
*/ */
public class BlackKnightFortress extends Quest public class BlackKnightFortress extends Quest {
{
private static final int QUEST_POINTS = 1; private static final int QUEST_POINTS = 1;
private static final int NPC_VARZE = 110; private static final int NPC_VARZE = 110;
private static final int WALL_ID = 22; private static final int WALL_ID = 22;
@ -23,45 +22,44 @@ public class BlackKnightFortress extends Quest
private static final int GRILL_X = -1; private static final int GRILL_X = -1;
private static final int GRILL_Y = -1; private static final int GRILL_Y = -1;
private static final int REQUIRED_QPOINTS = 0; // 13 private static final int REQUIRED_QPOINTS = 0; // 13
private static final String[] FIRST_MENU = new String[]{"Well what's the problem?","Well, ah.. good luck with that"}; private static final String[] FIRST_MENU = new String[] {
private static final String[] SECOND_MENU = new String[]{"Secret weapon? That sounds really scary!","I can take care of that"}; "Well what's the problem?", "Well, ah.. good luck with that" };
private static final String[] THIRD_MENU = new String[]{"Sure, but it'll cost you","No, actually, I lied."}; private static final String[] SECOND_MENU = new String[] {
private static final String[] FOURTH_MENU = new String[]{"I'll get right on it then","Sorry, I can't be bothered"}; "Secret weapon? That sounds really scary!",
"I can take care of that" };
private static final String[] THIRD_MENU = new String[] {
"Sure, but it'll cost you", "No, actually, I lied." };
private static final String[] FOURTH_MENU = new String[] {
"I'll get right on it then", "Sorry, I can't be bothered" };
/** /**
* Don't load this quest yet it's incomplete * Don't load this quest yet it's incomplete
*/ */
public boolean loadQuest() public boolean loadQuest() {
{
return false; return false;
} }
public void init() public void init() {
{
associateNpc(NPC_VARZE); associateNpc(NPC_VARZE);
associateObject(WALL_ID, WALL_X, WALL_Y); associateObject(WALL_ID, WALL_X, WALL_Y);
} }
public BlackKnightFortress() public BlackKnightFortress() {
{
} }
public String getName() public String getName() {
{
return "Black Knight's Fortress"; return "Black Knight's Fortress";
} }
public int getUniqueID() public int getUniqueID() {
{
return 2; return 2;
} }
public void handleAction(QuestAction action, Object[] args, final Player player) public void handleAction(QuestAction action, Object[] args,
{ final Player player) {
int stage = player.getQuestStage(this); int stage = player.getQuestStage(this);
if(action == action.TALKED_NPC) if (action == QuestAction.TALKED_NPC) {
{
if (!(args[0] instanceof Npc)) if (!(args[0] instanceof Npc))
return; return;
@ -79,9 +77,7 @@ public class BlackKnightFortress extends Quest
startQuest(player, npc); startQuest(player, npc);
else else
handleTalk(player, npc); handleTalk(player, npc);
} else } else if (action == QuestAction.USED_OBJECT) {
if(action == action.USED_OBJECT)
{
if (!(args[0] instanceof GameObject)) if (!(args[0] instanceof GameObject))
return; return;
@ -92,11 +88,10 @@ public class BlackKnightFortress extends Quest
player.setBusy(true); player.setBusy(true);
if(obj.getID() == WALL_ID) if (obj.getID() == WALL_ID) {
{ if (player.getY() < 435 || stage >= 1) {
if(player.getY() < 435 || stage >= 1) player.getActionSender().sendMessage(
{ "You push on the wall...");
player.getActionSender().sendMessage("You push on the wall...");
player.getActionSender().sendSound("secretdoor"); player.getActionSender().sendSound("secretdoor");
world.unregisterGameObject(obj); world.unregisterGameObject(obj);
world.delayedSpawnObject(obj.getLoc(), 1000); world.delayedSpawnObject(obj.getLoc(), 1000);
@ -108,10 +103,9 @@ public class BlackKnightFortress extends Quest
addDelayedMessage("It slides out of the way!", player, 1000); addDelayedMessage("It slides out of the way!", player, 1000);
} else } else
player.getActionSender().sendMessage("You see no reason to push on the wall"); player.getActionSender().sendMessage(
} else "You see no reason to push on the wall");
if(obj.getID() == GRILL_ID) } else if (obj.getID() == GRILL_ID) {
{
// listen // listen
} }
@ -119,177 +113,228 @@ public class BlackKnightFortress extends Quest
} }
} }
private void handleTalk(final Player player, final Npc npc) private void handleTalk(final Player player, final Npc npc) {
{
int stage = player.getQuestStage(this); int stage = player.getQuestStage(this);
if(stage >= 1 && stage <= 5) if (stage >= 1 && stage <= 5) {
{
sendChat("I don't have time to talk right now", npc, player); sendChat("I don't have time to talk right now", npc, player);
addDelayedChat("Come back when you've destroyed that weapon!", npc, player); addDelayedChat("Come back when you've destroyed that weapon!", npc,
player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
} }
} }
private void startQuest(final Player player, final Npc npc) private void startQuest(final Player player, final Npc npc) {
{ sendChat("Good day to you, " + (player.isMale() ? "sir" : "miss"), npc,
sendChat("Good day to you, " + (player.isMale() ? "sir" : "miss"), npc, player); player);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
public void action() sendChat(
{ "Hello sir. I've heard rumours that you're going to war with the black knights",
sendChat("Hello sir. I've heard rumours that you're going to war with the black knights", player, npc); player, npc);
addSingleEvent(new SingleEvent(player, 4000) addSingleEvent(new SingleEvent(player, 4000) {
{ public void action() {
public void action()
{
sendChat("Is this true?", player, npc); sendChat("Is this true?", player, npc);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
public void action() if (player.getQuestPoints() >= REQUIRED_QPOINTS) // Confirm
{ // rumour
if(player.getQuestPoints() >= REQUIRED_QPOINTS) // Confirm rumour
{ {
sendChat("Who told you that?", npc, player); sendChat("Who told you that?", npc, player);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
public void action() sendChat(
{ "Oh, it makes no difference. Yes, the rumours are true.",
sendChat("Oh, it makes no difference. Yes, the rumours are true.", npc, player); npc, player);
addSingleEvent(new SingleEvent(player, 3000) addSingleEvent(new SingleEvent(
{ player, 3000) {
public void action() public void action() {
{
npc.blockedBy(player); npc.blockedBy(player);
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(FIRST_MENU) player.setMenuHandler(new MenuHandler(
{ FIRST_MENU) {
public void handleReply(final int option, final String reply) public void handleReply(
{ final int option,
final String reply) {
npc.blockedBy(player); npc.blockedBy(player);
player.setBusy(true); player.setBusy(true);
sendChat(reply + (option == 0 ? " Surely you'll defeat them easily?" : ""), player, npc); sendChat(
addSingleEvent(new SingleEvent(player, 3000) reply
{ + (option == 0 ? " Surely you'll defeat them easily?"
public void action() : ""),
{ player, npc);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
npc.blockedBy(player); npc.blockedBy(player);
switch(option) switch (option) {
{
case 0: case 0:
sendChat("Yeah, well.. You're lucky you've earned yourself a good reputation", npc, player); sendChat(
addSingleEvent(new SingleEvent(player, 4000) "Yeah, well.. You're lucky you've earned yourself a good reputation",
{ npc,
public void action() player);
{ addSingleEvent(new SingleEvent(
sendChat("Or I wouldn't tell you.", npc, player); player,
addSingleEvent(new SingleEvent(player, 4000) 4000) {
{ public void action() {
public void action() sendChat(
{ "Or I wouldn't tell you.",
sendChat("The black knights have a secret weapon, and they say it will destroy us.", npc, player); npc,
player);
addSingleEvent(new SingleEvent(
player,
4000) {
public void action() {
sendChat(
"The black knights have a secret weapon, and they say it will destroy us.",
npc,
player);
npc.blockedBy(player); npc.blockedBy(player);
addSingleEvent(new SingleEvent(player, 4000) addSingleEvent(new SingleEvent(
{ player,
public void action() 4000) {
{ public void action() {
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(SECOND_MENU) player.setMenuHandler(new MenuHandler(
{ SECOND_MENU) {
public void handleReply(final int option, final String reply) public void handleReply(
{ final int option,
final String reply) {
npc.blockedBy(player); npc.blockedBy(player);
player.setBusy(true); player.setBusy(true);
if (option == 1) if (option == 1)
sendChat("Well it just so happens that I'm an expert in secret weapon thwarting.", player, npc); sendChat(
"Well it just so happens that I'm an expert in secret weapon thwarting.",
player,
npc);
else else
sendChat(reply, player, npc); sendChat(
reply,
player,
npc);
addSingleEvent(new SingleEvent(player, 3000) addSingleEvent(new SingleEvent(
{ player,
public void action() 3000) {
{ public void action() {
npc.blockedBy(player); npc.blockedBy(player);
switch(option) switch (option) {
{
case 0: case 0:
sendChat("What kind of sissy talk is that? Get out of my sight!", npc, player); sendChat(
"What kind of sissy talk is that? Get out of my sight!",
npc,
player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
break; break;
case 1: case 1:
sendChat("I like your spirit, young warrior!", npc, player); sendChat(
addSingleEvent(new SingleEvent(player, 3000) "I like your spirit, young warrior!",
{ npc,
public void action() player);
{ addSingleEvent(new SingleEvent(
sendChat("Do you think you could help us?", npc, player); player,
3000) {
public void action() {
sendChat(
"Do you think you could help us?",
npc,
player);
npc.blockedBy(player); npc.blockedBy(player);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(
{ player,
public void action() 2000) {
{ public void action() {
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(THIRD_MENU) player.setMenuHandler(new MenuHandler(
{ THIRD_MENU) {
public void handleReply(final int option, final String reply) public void handleReply(
{ final int option,
sendChat(reply, player, npc); final String reply) {
sendChat(
reply,
player,
npc);
npc.blockedBy(player); npc.blockedBy(player);
player.setBusy(true); player.setBusy(true);
addSingleEvent(new SingleEvent(player, 3000) addSingleEvent(new SingleEvent(
{ player,
public void action() 3000) {
{ public void action() {
npc.blockedBy(player); npc.blockedBy(player);
switch(option) switch (option) {
{
case 0: case 0:
sendChat("Money won't be a problem, assuming you can do the job.", npc, player); sendChat(
addSingleEvent(new SingleEvent(player, 3000) "Money won't be a problem, assuming you can do the job.",
{ npc,
public void action() player);
{ addSingleEvent(new SingleEvent(
sendChat("Well then, what do you want me to do?", player, npc); player,
addSingleEvent(new SingleEvent(player, 3000) 3000) {
{ public void action() {
public void action() sendChat(
{ "Well then, what do you want me to do?",
sendChat("First of all, you'll need to find out what the weapon is... then destroy it!", npc, player); player,
addSingleEvent(new SingleEvent(player, 4500) npc);
{ addSingleEvent(new SingleEvent(
public void action() player,
{ 3000) {
sendChat("Head north and search the black knight's castle.", npc, player); public void action() {
sendChat(
"First of all, you'll need to find out what the weapon is... then destroy it!",
npc,
player);
addSingleEvent(new SingleEvent(
player,
4500) {
public void action() {
sendChat(
"Head north and search the black knight's castle.",
npc,
player);
npc.blockedBy(player); npc.blockedBy(player);
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(FOURTH_MENU) player.setMenuHandler(new MenuHandler(
{ FOURTH_MENU) {
public void handleReply(final int option, final String reply) public void handleReply(
{ final int option,
sendChat(reply, player, npc); final String reply) {
sendChat(
reply,
player,
npc);
player.setBusy(true); player.setBusy(true);
npc.blockedBy(player); npc.blockedBy(player);
addSingleEvent(new SingleEvent(player, 3000) addSingleEvent(new SingleEvent(
{ player,
public void action() 3000) {
{ public void action() {
npc.blockedBy(player); npc.blockedBy(player);
switch(option) switch (option) {
{
case 0: case 0:
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
addDelayedChat("Good luck, " + player.getUsername() + ".", npc, player); addDelayedChat(
player.setQuestStage(getUniqueID(), 1); "Good luck, "
+ player.getUsername()
+ ".",
npc,
player);
player.setQuestStage(
getUniqueID(),
1);
break; break;
case 1: case 1:
addDelayedChat("Don't waste my time! Every valuable second, doom draws nearer!", npc, player); addDelayedChat(
"Don't waste my time! Every valuable second, doom draws nearer!",
npc,
player);
default: default:
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
@ -299,7 +344,9 @@ public class BlackKnightFortress extends Quest
}); });
} }
}); });
player.getActionSender().sendMenu(FOURTH_MENU); player.getActionSender()
.sendMenu(
FOURTH_MENU);
player.setBusy(false); player.setBusy(false);
} }
}); });
@ -309,7 +356,12 @@ public class BlackKnightFortress extends Quest
}); });
break; break;
case 1: case 1:
addDelayedChat("Don't waste my time " + player.getUsername() + "!", npc, player); addDelayedChat(
"Don't waste my time "
+ player.getUsername()
+ "!",
npc,
player);
default: default:
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
@ -319,7 +371,9 @@ public class BlackKnightFortress extends Quest
}); });
} }
}); });
player.getActionSender().sendMenu(THIRD_MENU); player.getActionSender()
.sendMenu(
THIRD_MENU);
player.setBusy(false); player.setBusy(false);
} }
}); });
@ -335,7 +389,9 @@ public class BlackKnightFortress extends Quest
}); });
} }
}); });
player.getActionSender().sendMenu(SECOND_MENU); player.getActionSender()
.sendMenu(
SECOND_MENU);
player.setBusy(false); player.setBusy(false);
} }
}); });
@ -345,7 +401,10 @@ public class BlackKnightFortress extends Quest
}); });
break; break;
case 1: case 1:
sendChat("Um, thanks. I guess...", npc, player); sendChat(
"Um, thanks. I guess...",
npc,
player);
default: default:
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
@ -355,7 +414,9 @@ public class BlackKnightFortress extends Quest
}); });
} }
}); });
player.getActionSender().sendMenu(FIRST_MENU); player.getActionSender()
.sendMenu(
FIRST_MENU);
player.setBusy(false); player.setBusy(false);
} }
}); });
@ -363,10 +424,16 @@ public class BlackKnightFortress extends Quest
}); });
} else // Deny rumour } else // Deny rumour
{ {
sendChat("Most certainly not. The Black Knights are no threat to us!", npc, player); sendChat(
"Most certainly not. The Black Knights are no threat to us!",
npc, player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
addDelayedMessage("You need " + REQUIRED_QPOINTS + " quest points before " + npc.getDef().getName() + " will trust you", player); addDelayedMessage("You need "
+ REQUIRED_QPOINTS
+ " quest points before "
+ npc.getDef().getName()
+ " will trust you", player);
} }
} }
}); });

View File

@ -1,9 +1,14 @@
import org.rscdaemon.server.quest.*; import org.moparscape.msc.gs.external.EntityHandler;
import org.rscdaemon.server.model.*; import org.moparscape.msc.gs.external.ItemDropDef;
import org.rscdaemon.server.event.*; import org.moparscape.msc.gs.model.ActiveTile;
import org.rscdaemon.server.entityhandling.EntityHandler; import org.moparscape.msc.gs.model.InvItem;
import org.rscdaemon.server.entityhandling.defs.extras.ItemDropDef; import org.moparscape.msc.gs.model.Item;
import org.rscdaemon.server.util.DataConversions; import org.moparscape.msc.gs.model.Npc;
import org.moparscape.msc.gs.model.Player;
import org.moparscape.msc.gs.model.World;
import org.moparscape.msc.gs.quest.Quest;
import org.moparscape.msc.gs.quest.QuestAction;
import org.moparscape.msc.gs.tools.DataConversions;
/** /**
* Quest: Christmas! (v1.0) 8/1/2009 * Quest: Christmas! (v1.0) 8/1/2009
@ -36,7 +41,6 @@ public class Christmas extends Quest
private static final int TOY4_ID = 1320; private static final int TOY4_ID = 1320;
private static final int GIFT_ID = 1321; private static final int GIFT_ID = 1321;
private static final int DEFAULT_DELAY = 3200; private static final int DEFAULT_DELAY = 3200;
private static final int QUEST_POINTS = 0;
private World world = World.getWorld(); private World world = World.getWorld();
private static final ItemDropDef[] BOX_ITEMS = new ItemDropDef[] private static final ItemDropDef[] BOX_ITEMS = new ItemDropDef[]
{ {
@ -184,7 +188,7 @@ public class Christmas extends Quest
{ {
int stage = player.getQuestStage(this); int stage = player.getQuestStage(this);
if(action == action.USED_ITEM) if(action == QuestAction.USED_ITEM)
{ {
if(!(args[0] instanceof InvItem)) if(!(args[0] instanceof InvItem))
return; return;
@ -193,7 +197,7 @@ public class Christmas extends Quest
handleUseItem(item, player); handleUseItem(item, player);
} else } else
if(action == action.TALKED_NPC) if(action == QuestAction.TALKED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;
@ -226,7 +230,7 @@ public class Christmas extends Quest
handleWizardTalk(player, npc); handleWizardTalk(player, npc);
} }
} else } else
if(action == action.KILLED_NPC) if(action == QuestAction.KILLED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;

View File

@ -1,6 +1,9 @@
import org.rscdaemon.server.quest.*; import org.moparscape.msc.gs.event.SingleEvent;
import org.rscdaemon.server.model.*; import org.moparscape.msc.gs.model.MenuHandler;
import org.rscdaemon.server.event.*; import org.moparscape.msc.gs.model.Npc;
import org.moparscape.msc.gs.model.Player;
import org.moparscape.msc.gs.quest.Quest;
import org.moparscape.msc.gs.quest.QuestAction;
/** /**
* Quest: Cook's Assistant (v1.0) * Quest: Cook's Assistant (v1.0)
@ -47,7 +50,7 @@ public class CooksAssistant extends Quest
if(stage == -1) // Quest hasn't been started if(stage == -1) // Quest hasn't been started
{ {
if(action == action.TALKED_NPC) if(action == QuestAction.TALKED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;
@ -172,7 +175,7 @@ public class CooksAssistant extends Quest
} else } else
if(stage == 1) if(stage == 1)
{ {
if(action == action.TALKED_NPC) if(action == QuestAction.TALKED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;
@ -249,7 +252,7 @@ public class CooksAssistant extends Quest
} }
} else } else
if (stage == 0) { if (stage == 0) {
if(action == action.TALKED_NPC) if(action == QuestAction.TALKED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;

View File

@ -1,7 +1,11 @@
import org.rscdaemon.server.quest.*; import org.moparscape.msc.gs.event.SingleEvent;
import org.rscdaemon.server.model.*; import org.moparscape.msc.gs.external.EntityHandler;
import org.rscdaemon.server.event.*; import org.moparscape.msc.gs.model.InvItem;
import org.rscdaemon.server.entityhandling.EntityHandler; import org.moparscape.msc.gs.model.MenuHandler;
import org.moparscape.msc.gs.model.Npc;
import org.moparscape.msc.gs.model.Player;
import org.moparscape.msc.gs.quest.Quest;
import org.moparscape.msc.gs.quest.QuestAction;
/** /**
* Quest: Imp Catcher (v1.0) 5/1/2009 * Quest: Imp Catcher (v1.0) 5/1/2009
@ -57,7 +61,7 @@ public class ImpCatcher extends Quest
{ {
int stage = player.getQuestStage(this); int stage = player.getQuestStage(this);
if(action == action.TALKED_NPC) if(action == QuestAction.TALKED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;

View File

@ -1,52 +1,49 @@
import org.rscdaemon.server.quest.*; import org.moparscape.msc.gs.event.SingleEvent;
import org.rscdaemon.server.model.*; import org.moparscape.msc.gs.model.InvItem;
import org.rscdaemon.server.event.*; import org.moparscape.msc.gs.model.MenuHandler;
import org.moparscape.msc.gs.model.Npc;
import org.moparscape.msc.gs.model.Player;
import org.moparscape.msc.gs.quest.Quest;
import org.moparscape.msc.gs.quest.QuestAction;
/** /**
* Quest: Sheep Shearer (v1.0) * Quest: Sheep Shearer (v1.0) Status: COMPLETE Start: Fred the farmer (id 77),
* Status: COMPLETE * 159, 619 Items: 207x20 Reward: 1 quest point, 60 gold, Crafting 350 xp
* Start: Fred the farmer (id 77), 159, 619
* Items: 207x20
* Reward: 1 quest point, 60 gold, Crafting 350 xp
* *
* @author Konijn * @author Konijn
*/ */
public class SheepShearer extends Quest public class SheepShearer extends Quest {
{
private final int FRED_ID = 77; private final int FRED_ID = 77;
private final int ITEM_WOOL = 207; private final int ITEM_WOOL = 207;
private final int REWARD_XP = 350; private final int REWARD_XP = 350;
private final int REWARD_GP = 330; private final int REWARD_GP = 330;
private final String[] FIRST_MENU = new String[]{"Sure, what do I need to do?", "No thanks, I'm good."}; private final String[] FIRST_MENU = new String[] {
private final String[] SECOND_MENU = new String[]{"Sorry, I don't like the sound of that.", "I'd be happy to help."}; "Sure, what do I need to do?", "No thanks, I'm good." };
private final String[] SECOND_MENU = new String[] {
"Sorry, I don't like the sound of that.", "I'd be happy to help." };
public void init() public void init() {
{
associateNpc(FRED_ID); associateNpc(FRED_ID);
} }
public SheepShearer() public SheepShearer() {
{
} }
public String getName() public String getName() {
{
return "Sheep Shearer"; return "Sheep Shearer";
} }
public int getUniqueID() public int getUniqueID() {
{
return 1; return 1;
} }
public void handleAction(QuestAction action, Object[] args, final Player player) public void handleAction(QuestAction action, Object[] args,
{ final Player player) {
int stage = player.getQuestStage(this); int stage = player.getQuestStage(this);
if (stage == -1) // Quest hasn't been started if (stage == -1) // Quest hasn't been started
{ {
if(action == action.TALKED_NPC) if (action == QuestAction.TALKED_NPC) {
{
if (!(args[0] instanceof Npc)) if (!(args[0] instanceof Npc))
return; return;
@ -58,66 +55,75 @@ public class SheepShearer extends Quest
player.setBusy(true); player.setBusy(true);
npc.blockedBy(player); npc.blockedBy(player);
sendChat("Hi there, traveller. Care to make some money?", npc, player); sendChat("Hi there, traveller. Care to make some money?", npc,
player);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
public void action()
{
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(FIRST_MENU) player.setMenuHandler(new MenuHandler(FIRST_MENU) {
{ public void handleReply(final int option,
public void handleReply(final int option, final String reply) final String reply) {
{
player.setBusy(true); player.setBusy(true);
switch(option) switch (option) {
{
case 1: case 1:
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
sendChat("No thanks, I'm good.", player, npc); sendChat("No thanks, I'm good.", player,
npc);
break; break;
case 0: case 0:
sendChat("Sure, what do I need to do?", player, npc); sendChat("Sure, what do I need to do?",
addSingleEvent(new SingleEvent(player, 2000) player, npc);
{ addSingleEvent(new SingleEvent(player, 2000) {
public void action() public void action() {
{ sendChat(
sendChat("If you collect 20 balls of wool for me, I'll pay you 500 coins.", npc, player); "If you collect 20 balls of wool for me, I'll pay you 500 coins.",
addSingleEvent(new SingleEvent(player, 2000) npc, player);
{ addSingleEvent(new SingleEvent(
public void action() player, 2000) {
{ public void action() {
sendChat("Maybe I'll teach you a thing or two about crafting, too.", npc, player); sendChat(
addSingleEvent(new SingleEvent(player, 2000) "Maybe I'll teach you a thing or two about crafting, too.",
{ npc, player);
public void action() addSingleEvent(new SingleEvent(
{ player, 2000) {
sendChat("I'm afraid you'll have to find your own shears, but the sheep are outside.", npc, player); public void action() {
addSingleEvent(new SingleEvent(player, 2000) sendChat(
{ "I'm afraid you'll have to find your own shears, but the sheep are outside.",
public void action() npc, player);
{ addSingleEvent(new SingleEvent(
player,
2000) {
public void action() {
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(SECOND_MENU) player.setMenuHandler(new MenuHandler(
{ SECOND_MENU) {
public void handleReply(final int option, final String reply) public void handleReply(
{ final int option,
final String reply) {
player.setBusy(true); player.setBusy(true);
switch(option) switch (option) {
{
case 1: case 1:
sendChat("I'd be happy to help.", player, npc); sendChat(
addSingleEvent(new SingleEvent(player, 2000) "I'd be happy to help.",
{ player,
public void action() npc);
{ addSingleEvent(new SingleEvent(
sendChat("Great! Come back and see me when you're done.", npc, player); player,
addSingleEvent(new SingleEvent(player, 2000) 2000) {
{ public void action() {
public void action() sendChat(
{ "Great! Come back and see me when you're done.",
player.setQuestStage(getUniqueID(), 1); npc,
player);
addSingleEvent(new SingleEvent(
player,
2000) {
public void action() {
player.setQuestStage(
getUniqueID(),
1);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
} }
@ -126,12 +132,18 @@ public class SheepShearer extends Quest
}); });
break; break;
case 0: case 0:
sendChat("Sorry, I don't like the sound of that.", player, npc); sendChat(
addSingleEvent(new SingleEvent(player, 2000) "Sorry, I don't like the sound of that.",
{ player,
public void action() npc);
{ addSingleEvent(new SingleEvent(
sendChat("Suit yourself. Come and see me if you change your mind.", npc, player); player,
2000) {
public void action() {
sendChat(
"Suit yourself. Come and see me if you change your mind.",
npc,
player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
} }
@ -144,7 +156,9 @@ public class SheepShearer extends Quest
} }
} }
}); });
owner.getActionSender().sendMenu(SECOND_MENU); owner.getActionSender()
.sendMenu(
SECOND_MENU);
} }
}); });
} }
@ -166,11 +180,8 @@ public class SheepShearer extends Quest
}); });
} else } else
return; return;
} else } else if (stage == 1) {
if(stage == 1) if (action == QuestAction.TALKED_NPC) {
{
if(action == action.TALKED_NPC)
{
if (!(args[0] instanceof Npc)) if (!(args[0] instanceof Npc))
return; return;
@ -181,45 +192,42 @@ public class SheepShearer extends Quest
player.setBusy(true); player.setBusy(true);
npc.blockedBy(player); npc.blockedBy(player);
sendChat("Ahh, you've returned! Do you have my wool?", npc, player); sendChat("Ahh, you've returned! Do you have my wool?", npc,
player);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
public void action()
{
player.setBusy(false); player.setBusy(false);
player.setMenuHandler(new MenuHandler(new String[]{"I'm afraid not.", "Yes, I do."}) player.setMenuHandler(new MenuHandler(new String[] {
{ "I'm afraid not.", "Yes, I do." }) {
public void handleReply(final int option, final String reply) public void handleReply(final int option,
{ final String reply) {
player.setBusy(true); player.setBusy(true);
sendChat(reply, player, npc); sendChat(reply, player, npc);
if(option == 0) if (option == 0) {
{ addSingleEvent(new SingleEvent(player, 2000) {
addSingleEvent(new SingleEvent(player, 2000) public void action() {
{ sendChat(
public void action() "Well, come and see me when you do. The offer still stands",
{ npc, player);
sendChat("Well, come and see me when you do. The offer still stands", npc, player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
} }
}); });
} else } else if (option == 1) {
if(option == 1) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
// check items // check items
if(player.getInventory().hasItemId(ITEM_WOOL) && player.getInventory().countId(ITEM_WOOL) >= 20) if (player.getInventory()
{ .hasItemId(ITEM_WOOL)
&& player.getInventory()
.countId(ITEM_WOOL) >= 20) {
finishQuest(player, npc); finishQuest(player, npc);
} else } else {
{ sendChat(
sendChat("Um, no you don't. Get back to me when you do. The reward still stands!", npc, player); "Um, no you don't. Get back to me when you do. The reward still stands!",
npc, player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
} }
@ -229,14 +237,15 @@ public class SheepShearer extends Quest
} }
}); });
owner.getActionSender().sendMenu(new String[]{"I'm afraid not.", "Yes, I do."}); owner.getActionSender()
.sendMenu(
new String[] { "I'm afraid not.",
"Yes, I do." });
} }
}); });
} }
} else } else if (stage == 0) {
if (stage == 0) { if (action == QuestAction.TALKED_NPC) {
if(action == action.TALKED_NPC)
{
if (!(args[0] instanceof Npc)) if (!(args[0] instanceof Npc))
return; return;
@ -255,14 +264,12 @@ public class SheepShearer extends Quest
} }
private void finishQuest(final Player player, final Npc npc) private void finishQuest(final Player player, final Npc npc) {
{ sendChat("Thank you very much! As promised, here's your reward.", npc,
sendChat("Thank you very much! As promised, here's your reward.", npc, player); player);
addSingleEvent(new SingleEvent(player, 2000) addSingleEvent(new SingleEvent(player, 2000) {
{ public void action() {
public void action()
{
player.incExp(12, REWARD_XP, false); player.incExp(12, REWARD_XP, false);
player.getActionSender().sendStat(12); player.getActionSender().sendStat(12);
player.setQuestStage(getUniqueID(), Quest.COMPLETE); player.setQuestStage(getUniqueID(), Quest.COMPLETE);
@ -277,4 +284,3 @@ public class SheepShearer extends Quest
}); });
} }
} }

View File

@ -1,7 +1,9 @@
import org.rscdaemon.server.quest.*; import org.moparscape.msc.gs.event.SingleEvent;
import org.rscdaemon.server.model.*; import org.moparscape.msc.gs.model.MenuHandler;
import org.rscdaemon.server.event.*; import org.moparscape.msc.gs.model.Npc;
import org.rscdaemon.server.entityhandling.EntityHandler; import org.moparscape.msc.gs.model.Player;
import org.moparscape.msc.gs.quest.Quest;
import org.moparscape.msc.gs.quest.QuestAction;
/** /**
* Quest: Vampire Slayer (v1.0) 6/1/2009 * Quest: Vampire Slayer (v1.0) 6/1/2009
@ -17,9 +19,9 @@ public class VampireSlayer extends Quest
{ {
private static final int MORGAN_ID = 97; private static final int MORGAN_ID = 97;
private static final int HARLOW_ID = 98; private static final int HARLOW_ID = 98;
private static final int REWARD_XP = 1000; //private static final int REWARD_XP = 1000;
private static final int DEFAULT_EVENT_DELAY = 3200; private static final int DEFAULT_EVENT_DELAY = 3200;
private static final int QUEST_POINTS = 3; //private static final int QUEST_POINTS = 3;
private static final String[] FIRST_MENU = new String[] { "No. Vampires are scary", "Ok I'm up for an adventure", "I tried fighting him. He wouldn't die" }; private static final String[] FIRST_MENU = new String[] { "No. Vampires are scary", "Ok I'm up for an adventure", "I tried fighting him. He wouldn't die" };
private static final String[] SECOND_MENU = new String[] { "No, you've had enough", "Ok mate", "Morgan needs your help" }; private static final String[] SECOND_MENU = new String[] { "No, you've had enough", "Ok mate", "Morgan needs your help" };
@ -63,7 +65,7 @@ public class VampireSlayer extends Quest
{ {
int stage = player.getQuestStage(this); int stage = player.getQuestStage(this);
if(action == action.TALKED_NPC) if(action == QuestAction.TALKED_NPC)
{ {
if(!(args[0] instanceof Npc)) if(!(args[0] instanceof Npc))
return; return;
@ -305,13 +307,6 @@ public class VampireSlayer extends Quest
player.getActionSender().sendMenu(SECOND_MENU); player.getActionSender().sendMenu(SECOND_MENU);
} }
/**
* Finishes the quest
*/
private void finishQuest(final Player player, final Npc npc)
{
}
/** /**
* Construct the quest (empty) * Construct the quest (empty)
*/ */