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,350 +22,418 @@ 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;
final Npc npc = (Npc)args[0]; final Npc npc = (Npc) args[0];
if(npc.getID() != NPC_VARZE) if (npc.getID() != NPC_VARZE)
return; return;
player.setBusy(true); player.setBusy(true);
npc.blockedBy(player); npc.blockedBy(player);
// handle quest complete chat? // handle quest complete chat?
if(stage == -1) if (stage == -1)
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;
final GameObject obj = (GameObject)args[0]; final GameObject obj = (GameObject) args[0];
if(obj.getID() != WALL_ID && obj.getID() != GRILL_ID) if (obj.getID() != WALL_ID && obj.getID() != GRILL_ID)
return; return;
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);
if(player.getY() < 435) if (player.getY() < 435)
player.teleport(273, 435, false); player.teleport(273, 435, false);
else else
player.teleport(273, 434, false); player.teleport(273, 434, false);
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
} }
player.setBusy(false); player.setBusy(false);
} }
} }
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(
sendChat("Yeah, well.. You're lucky you've earned yourself a good reputation", npc, player); "Yeah, well.. You're lucky you've earned yourself a good reputation",
addSingleEvent(new SingleEvent(player, 4000) npc,
{ player);
public void action() addSingleEvent(new SingleEvent(
{ player,
sendChat("Or I wouldn't tell you.", npc, player); 4000) {
addSingleEvent(new SingleEvent(player, 4000) public void action() {
{ sendChat(
public void action() "Or I wouldn't tell you.",
{ npc,
sendChat("The black knights have a secret weapon, and they say it will destroy us.", npc, player); player);
npc.blockedBy(player); addSingleEvent(new SingleEvent(
addSingleEvent(new SingleEvent(player, 4000) player,
{ 4000) {
public void action() public void action() {
{ sendChat(
player.setBusy(false); "The black knights have a secret weapon, and they say it will destroy us.",
player.setMenuHandler(new MenuHandler(SECOND_MENU) npc,
{ player);
public void handleReply(final int option, final String reply) npc.blockedBy(player);
{ addSingleEvent(new SingleEvent(
npc.blockedBy(player); player,
player.setBusy(true); 4000) {
public void action() {
if(option == 1) player.setBusy(false);
sendChat("Well it just so happens that I'm an expert in secret weapon thwarting.", player, npc); player.setMenuHandler(new MenuHandler(
else SECOND_MENU) {
sendChat(reply, player, npc); public void handleReply(
final int option,
addSingleEvent(new SingleEvent(player, 3000) final String reply) {
{ npc.blockedBy(player);
public void action() player.setBusy(true);
{
npc.blockedBy(player); if (option == 1)
switch(option) sendChat(
{ "Well it just so happens that I'm an expert in secret weapon thwarting.",
case 0: player,
sendChat("What kind of sissy talk is that? Get out of my sight!", npc, player); npc);
player.setBusy(false); else
npc.unblock(); sendChat(
break; reply,
case 1: player,
sendChat("I like your spirit, young warrior!", npc, player); npc);
addSingleEvent(new SingleEvent(player, 3000)
{ addSingleEvent(new SingleEvent(
public void action() player,
{ 3000) {
sendChat("Do you think you could help us?", npc, player); public void action() {
npc.blockedBy(player); npc.blockedBy(player);
addSingleEvent(new SingleEvent(player, 2000) switch (option) {
{ case 0:
public void action() sendChat(
{ "What kind of sissy talk is that? Get out of my sight!",
player.setBusy(false); npc,
player.setMenuHandler(new MenuHandler(THIRD_MENU) player);
{ player.setBusy(false);
public void handleReply(final int option, final String reply) npc.unblock();
{ break;
sendChat(reply, player, npc); case 1:
npc.blockedBy(player); sendChat(
player.setBusy(true); "I like your spirit, young warrior!",
addSingleEvent(new SingleEvent(player, 3000) npc,
{ player);
public void action() addSingleEvent(new SingleEvent(
{ player,
npc.blockedBy(player); 3000) {
public void action() {
switch(option) sendChat(
{ "Do you think you could help us?",
case 0: npc,
sendChat("Money won't be a problem, assuming you can do the job.", npc, player); player);
addSingleEvent(new SingleEvent(player, 3000) npc.blockedBy(player);
{ addSingleEvent(new SingleEvent(
public void action() player,
{ 2000) {
sendChat("Well then, what do you want me to do?", player, npc); public void action() {
addSingleEvent(new SingleEvent(player, 3000) player.setBusy(false);
{ player.setMenuHandler(new MenuHandler(
public void action() THIRD_MENU) {
{ public void handleReply(
sendChat("First of all, you'll need to find out what the weapon is... then destroy it!", npc, player); final int option,
addSingleEvent(new SingleEvent(player, 4500) final String reply) {
{ sendChat(
public void action() reply,
{ player,
sendChat("Head north and search the black knight's castle.", npc, player); npc);
npc.blockedBy(player); npc.blockedBy(player);
player.setBusy(false); player.setBusy(true);
player.setMenuHandler(new MenuHandler(FOURTH_MENU) addSingleEvent(new SingleEvent(
{ player,
public void handleReply(final int option, final String reply) 3000) {
{ public void action() {
sendChat(reply, player, npc); npc.blockedBy(player);
player.setBusy(true);
npc.blockedBy(player); switch (option) {
addSingleEvent(new SingleEvent(player, 3000) case 0:
{ sendChat(
public void action() "Money won't be a problem, assuming you can do the job.",
{ npc,
npc.blockedBy(player); player);
addSingleEvent(new SingleEvent(
switch(option) player,
{ 3000) {
case 0: public void action() {
player.setBusy(false); sendChat(
npc.unblock(); "Well then, what do you want me to do?",
addDelayedChat("Good luck, " + player.getUsername() + ".", npc, player); player,
player.setQuestStage(getUniqueID(), 1); npc);
break; addSingleEvent(new SingleEvent(
case 1: player,
addDelayedChat("Don't waste my time! Every valuable second, doom draws nearer!", npc, player); 3000) {
default: public void action() {
player.setBusy(false); sendChat(
npc.unblock(); "First of all, you'll need to find out what the weapon is... then destroy it!",
break; 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);
player.setBusy(false);
player.setMenuHandler(new MenuHandler(
FOURTH_MENU) {
public void handleReply(
final int option,
final String reply) {
sendChat(
reply,
player,
npc);
player.setBusy(true);
npc.blockedBy(player);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
npc.blockedBy(player);
switch (option) {
case 0:
player.setBusy(false);
npc.unblock();
addDelayedChat(
"Good luck, "
+ player.getUsername()
+ ".",
npc,
player);
player.setQuestStage(
getUniqueID(),
1);
break;
case 1:
addDelayedChat(
"Don't waste my time! Every valuable second, doom draws nearer!",
npc,
player);
default:
player.setBusy(false);
npc.unblock();
break;
} }
}); }
player.getActionSender().sendMenu(FOURTH_MENU); });
player.setBusy(false); }
} });
}); player.getActionSender()
} .sendMenu(
}); FOURTH_MENU);
} player.setBusy(false);
}); }
break; });
case 1: }
addDelayedChat("Don't waste my time " + player.getUsername() + "!", npc, player); });
default:
player.setBusy(false);
npc.unblock();
break;
} }
} });
}); break;
case 1:
addDelayedChat(
"Don't waste my time "
+ player.getUsername()
+ "!",
npc,
player);
default:
player.setBusy(false);
npc.unblock();
break;
}
} }
}); });
player.getActionSender().sendMenu(THIRD_MENU);
player.setBusy(false);
} }
}); });
player.getActionSender()
.sendMenu(
THIRD_MENU);
player.setBusy(false);
} }
}); });
break; }
default: });
player.setBusy(false); break;
npc.unblock(); default:
break; player.setBusy(false);
} npc.unblock();
break;
} }
}); }
} });
}); }
player.getActionSender().sendMenu(SECOND_MENU); });
player.setBusy(false); player.getActionSender()
} .sendMenu(
}); SECOND_MENU);
} player.setBusy(false);
}); }
} });
}); }
break; });
case 1: }
sendChat("Um, thanks. I guess...", npc, player); });
default: break;
player.setBusy(false); case 1:
npc.unblock(); sendChat(
break; "Um, thanks. I guess...",
npc,
player);
default:
player.setBusy(false);
npc.unblock();
break;
} }
} }
}); });
} }
}); });
player.getActionSender().sendMenu(FIRST_MENU); player.getActionSender()
.sendMenu(
FIRST_MENU);
player.setBusy(false); player.setBusy(false);
} }
}); });
} }
}); });
} 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,163 +1,177 @@
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[] {
public void init() "Sorry, I don't like the sound of that.", "I'd be happy to help." };
{
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;
final Npc npc = (Npc)args[0]; final Npc npc = (Npc) args[0];
if(npc.getID() != FRED_ID) if (npc.getID() != FRED_ID)
return; return;
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,
sendChat("No thanks, I'm good.", player, npc); 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.setBusy(false); player,
player.setMenuHandler(new MenuHandler(SECOND_MENU) 2000) {
{ public void action() {
public void handleReply(final int option, final String reply) player.setBusy(false);
{ player.setMenuHandler(new MenuHandler(
player.setBusy(true); SECOND_MENU) {
switch(option) public void handleReply(
{ final int option,
case 1: final String reply) {
sendChat("I'd be happy to help.", player, npc); player.setBusy(true);
addSingleEvent(new SingleEvent(player, 2000) switch (option) {
{ case 1:
public void action() sendChat(
{ "I'd be happy to help.",
sendChat("Great! Come back and see me when you're done.", npc, player); player,
addSingleEvent(new SingleEvent(player, 2000) npc);
{ addSingleEvent(new SingleEvent(
public void action() player,
{ 2000) {
player.setQuestStage(getUniqueID(), 1); public void action() {
player.setBusy(false); sendChat(
npc.unblock(); "Great! Come back and see me when you're done.",
} npc,
}); player);
} addSingleEvent(new SingleEvent(
}); player,
break; 2000) {
case 0: public void action() {
sendChat("Sorry, I don't like the sound of that.", player, npc); player.setQuestStage(
addSingleEvent(new SingleEvent(player, 2000) getUniqueID(),
{ 1);
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();
} }
}); });
break; }
default: });
break;
case 0:
sendChat(
"Sorry, I don't like the sound of that.",
player,
npc);
addSingleEvent(new SingleEvent(
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();
break; }
} });
break;
default:
player.setBusy(false);
npc.unblock();
break;
} }
}); }
owner.getActionSender().sendMenu(SECOND_MENU); });
} owner.getActionSender()
}); .sendMenu(
} SECOND_MENU);
}); }
} });
}); }
} });
}); }
break; });
default: }
player.setBusy(false); });
npc.unblock(); break;
break; default:
player.setBusy(false);
npc.unblock();
break;
} }
} }
}); });
@ -166,115 +180,107 @@ public class SheepShearer extends Quest
}); });
} else } else
return; return;
} else } else if (stage == 1) {
if(stage == 1) if (action == QuestAction.TALKED_NPC) {
{ if (!(args[0] instanceof Npc))
if(action == action.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
return; return;
final Npc npc = (Npc)args[0]; final Npc npc = (Npc) args[0];
if(npc.getID() != FRED_ID) if (npc.getID() != FRED_ID)
return; return;
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) // check items
{ if (player.getInventory()
public void action() .hasItemId(ITEM_WOOL)
{ && player.getInventory()
//check items .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();
} }
} }
}); });
} }
} }
}); });
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))
{ return;
if(!(args[0] instanceof Npc))
return; final Npc npc = (Npc) args[0];
final Npc npc = (Npc)args[0]; if (npc.getID() != FRED_ID)
return;
if(npc.getID() != FRED_ID)
return; player.setBusy(true);
npc.blockedBy(player);
player.setBusy(true); sendChat("Hello " + player.getUsername() + "!", npc, player);
npc.blockedBy(player);
sendChat("Hello " + player.getUsername() + "!", npc, player);
player.setBusy(false); player.setBusy(false);
npc.unblock(); npc.unblock();
} }
} }
} }
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.getActionSender().sendStat(12);
player.incExp(12, REWARD_XP, false); player.setQuestStage(getUniqueID(), Quest.COMPLETE);
player.getActionSender().sendStat(12); for (int i = 0; i < 20; i++)
player.setQuestStage(getUniqueID(), Quest.COMPLETE); player.getInventory().remove(ITEM_WOOL, 1);
for(int i=0; i < 20; i++) player.getInventory().add(new InvItem(10, REWARD_GP));
player.getInventory().remove(ITEM_WOOL, 1); player.getActionSender().sendInventory();
player.getInventory().add(new InvItem(10, REWARD_GP)); player.incQuestPoints(1);
player.getActionSender().sendInventory(); player.setBusy(false);
player.incQuestPoints(1); npc.unblock();
player.setBusy(false); }
npc.unblock(); });
}
});
} }
} }

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)
*/ */