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.rscdaemon.server.model.*;
import org.rscdaemon.server.event.*;
import org.moparscape.msc.gs.event.SingleEvent;
import org.moparscape.msc.gs.model.GameObject;
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)
* Status: INCOMPLETE
* Start: 304, 1507
* Stage1: 269, 441
* Items: -
* Rewards: -
*
* Quest: Black Knight's Fortress (v1.0) Status: INCOMPLETE Start: 304, 1507
* Stage1: 269, 441 Items: - Rewards: -
*
* @author youKnowWho
*/
public class BlackKnightFortress extends Quest
{
public class BlackKnightFortress extends Quest {
private static final int QUEST_POINTS = 1;
private static final int NPC_VARZE = 110;
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_Y = -1;
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[] SECOND_MENU = new String[]{"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"};
private static final String[] FIRST_MENU = new String[] {
"Well what's the problem?", "Well, ah.. good luck with that" };
private static final String[] SECOND_MENU = new String[] {
"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
*/
public boolean loadQuest()
{
public boolean loadQuest() {
return false;
}
public void init()
{
public void init() {
associateNpc(NPC_VARZE);
associateObject(WALL_ID, WALL_X, WALL_Y);
}
public BlackKnightFortress()
{
public BlackKnightFortress() {
}
public String getName()
{
public String getName() {
return "Black Knight's Fortress";
}
public int getUniqueID()
{
public int getUniqueID() {
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);
if(action == action.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
if (action == QuestAction.TALKED_NPC) {
if (!(args[0] instanceof Npc))
return;
final Npc npc = (Npc)args[0];
if(npc.getID() != NPC_VARZE)
final Npc npc = (Npc) args[0];
if (npc.getID() != NPC_VARZE)
return;
player.setBusy(true);
npc.blockedBy(player);
// handle quest complete chat?
if(stage == -1)
if (stage == -1)
startQuest(player, npc);
else
handleTalk(player, npc);
} else
if(action == action.USED_OBJECT)
{
if(!(args[0] instanceof GameObject))
} else if (action == QuestAction.USED_OBJECT) {
if (!(args[0] instanceof GameObject))
return;
final GameObject obj = (GameObject)args[0];
if(obj.getID() != WALL_ID && obj.getID() != GRILL_ID)
final GameObject obj = (GameObject) args[0];
if (obj.getID() != WALL_ID && obj.getID() != GRILL_ID)
return;
player.setBusy(true);
if(obj.getID() == WALL_ID)
{
if(player.getY() < 435 || stage >= 1)
{
player.getActionSender().sendMessage("You push on the wall...");
if (obj.getID() == WALL_ID) {
if (player.getY() < 435 || stage >= 1) {
player.getActionSender().sendMessage(
"You push on the wall...");
player.getActionSender().sendSound("secretdoor");
world.unregisterGameObject(obj);
world.delayedSpawnObject(obj.getLoc(), 1000);
if(player.getY() < 435)
if (player.getY() < 435)
player.teleport(273, 435, false);
else
player.teleport(273, 434, false);
addDelayedMessage("It slides out of the way!", player, 1000);
} else
player.getActionSender().sendMessage("You see no reason to push on the wall");
} else
if(obj.getID() == GRILL_ID)
{
player.getActionSender().sendMessage(
"You see no reason to push on the wall");
} else if (obj.getID() == GRILL_ID) {
// listen
}
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);
if(stage >= 1 && stage <= 5)
{
if (stage >= 1 && stage <= 5) {
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);
npc.unblock();
}
}
private void startQuest(final Player player, final Npc npc)
{
sendChat("Good day to you, " + (player.isMale() ? "sir" : "miss"), npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Hello sir. I've heard rumours that you're going to war with the black knights", player, npc);
addSingleEvent(new SingleEvent(player, 4000)
{
public void action()
{
private void startQuest(final Player player, final Npc npc) {
sendChat("Good day to you, " + (player.isMale() ? "sir" : "miss"), npc,
player);
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
sendChat(
"Hello sir. I've heard rumours that you're going to war with the black knights",
player, npc);
addSingleEvent(new SingleEvent(player, 4000) {
public void action() {
sendChat("Is this true?", player, npc);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
if(player.getQuestPoints() >= REQUIRED_QPOINTS) // Confirm rumour
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
if (player.getQuestPoints() >= REQUIRED_QPOINTS) // Confirm
// rumour
{
sendChat("Who told you that?", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Oh, it makes no difference. Yes, the rumours are true.", npc, player);
addSingleEvent(new SingleEvent(player, 3000)
{
public void action()
{
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
sendChat(
"Oh, it makes no difference. Yes, the rumours are true.",
npc, player);
addSingleEvent(new SingleEvent(
player, 3000) {
public void action() {
npc.blockedBy(player);
player.setBusy(false);
player.setMenuHandler(new MenuHandler(FIRST_MENU)
{
public void handleReply(final int option, final String reply)
{
player.setMenuHandler(new MenuHandler(
FIRST_MENU) {
public void handleReply(
final int option,
final String reply) {
npc.blockedBy(player);
player.setBusy(true);
sendChat(reply + (option == 0 ? " Surely you'll defeat them easily?" : ""), player, npc);
addSingleEvent(new SingleEvent(player, 3000)
{
public void action()
{
sendChat(
reply
+ (option == 0 ? " Surely you'll defeat them easily?"
: ""),
player, npc);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
npc.blockedBy(player);
switch(option)
{
case 0:
sendChat("Yeah, well.. You're lucky you've earned yourself a good reputation", npc, player);
addSingleEvent(new SingleEvent(player, 4000)
{
public void action()
{
sendChat("Or I wouldn't tell you.", 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);
addSingleEvent(new SingleEvent(player, 4000)
{
public void action()
{
player.setBusy(false);
player.setMenuHandler(new MenuHandler(SECOND_MENU)
{
public void handleReply(final int option, final String reply)
{
npc.blockedBy(player);
player.setBusy(true);
if(option == 1)
sendChat("Well it just so happens that I'm an expert in secret weapon thwarting.", player, npc);
else
sendChat(reply, player, npc);
addSingleEvent(new SingleEvent(player, 3000)
{
public void action()
{
npc.blockedBy(player);
switch(option)
{
case 0:
sendChat("What kind of sissy talk is that? Get out of my sight!", npc, player);
player.setBusy(false);
npc.unblock();
break;
case 1:
sendChat("I like your spirit, young warrior!", npc, player);
addSingleEvent(new SingleEvent(player, 3000)
{
public void action()
{
sendChat("Do you think you could help us?", npc, player);
npc.blockedBy(player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
player.setBusy(false);
player.setMenuHandler(new MenuHandler(THIRD_MENU)
{
public void handleReply(final int option, final String reply)
{
sendChat(reply, player, npc);
npc.blockedBy(player);
player.setBusy(true);
addSingleEvent(new SingleEvent(player, 3000)
{
public void action()
{
npc.blockedBy(player);
switch(option)
{
case 0:
sendChat("Money won't be a problem, assuming you can do the job.", npc, player);
addSingleEvent(new SingleEvent(player, 3000)
{
public void action()
{
sendChat("Well then, what do you want me to do?", player, npc);
addSingleEvent(new SingleEvent(player, 3000)
{
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);
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;
}
}
});
switch (option) {
case 0:
sendChat(
"Yeah, well.. You're lucky you've earned yourself a good reputation",
npc,
player);
addSingleEvent(new SingleEvent(
player,
4000) {
public void action() {
sendChat(
"Or I wouldn't tell you.",
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);
addSingleEvent(new SingleEvent(
player,
4000) {
public void action() {
player.setBusy(false);
player.setMenuHandler(new MenuHandler(
SECOND_MENU) {
public void handleReply(
final int option,
final String reply) {
npc.blockedBy(player);
player.setBusy(true);
if (option == 1)
sendChat(
"Well it just so happens that I'm an expert in secret weapon thwarting.",
player,
npc);
else
sendChat(
reply,
player,
npc);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
npc.blockedBy(player);
switch (option) {
case 0:
sendChat(
"What kind of sissy talk is that? Get out of my sight!",
npc,
player);
player.setBusy(false);
npc.unblock();
break;
case 1:
sendChat(
"I like your spirit, young warrior!",
npc,
player);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
sendChat(
"Do you think you could help us?",
npc,
player);
npc.blockedBy(player);
addSingleEvent(new SingleEvent(
player,
2000) {
public void action() {
player.setBusy(false);
player.setMenuHandler(new MenuHandler(
THIRD_MENU) {
public void handleReply(
final int option,
final String reply) {
sendChat(
reply,
player,
npc);
npc.blockedBy(player);
player.setBusy(true);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
npc.blockedBy(player);
switch (option) {
case 0:
sendChat(
"Money won't be a problem, assuming you can do the job.",
npc,
player);
addSingleEvent(new SingleEvent(
player,
3000) {
public void action() {
sendChat(
"Well then, what do you want me to do?",
player,
npc);
addSingleEvent(new SingleEvent(
player,
3000) {
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);
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);
}
});
}
});
}
});
break;
case 1:
addDelayedChat("Don't waste my time " + player.getUsername() + "!", npc, player);
default:
player.setBusy(false);
npc.unblock();
break;
}
});
}
});
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;
}
}
});
player.getActionSender().sendMenu(THIRD_MENU);
player.setBusy(false);
}
});
player.getActionSender()
.sendMenu(
THIRD_MENU);
player.setBusy(false);
}
});
break;
default:
player.setBusy(false);
npc.unblock();
break;
}
}
});
break;
default:
player.setBusy(false);
npc.unblock();
break;
}
});
}
});
player.getActionSender().sendMenu(SECOND_MENU);
player.setBusy(false);
}
});
}
});
}
});
break;
case 1:
sendChat("Um, thanks. I guess...", npc, player);
default:
player.setBusy(false);
npc.unblock();
break;
}
});
}
});
player.getActionSender()
.sendMenu(
SECOND_MENU);
player.setBusy(false);
}
});
}
});
}
});
break;
case 1:
sendChat(
"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);
}
});
});
}
});
} 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);
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.rscdaemon.server.model.*;
import org.rscdaemon.server.event.*;
import org.rscdaemon.server.entityhandling.EntityHandler;
import org.rscdaemon.server.entityhandling.defs.extras.ItemDropDef;
import org.rscdaemon.server.util.DataConversions;
import org.moparscape.msc.gs.external.EntityHandler;
import org.moparscape.msc.gs.external.ItemDropDef;
import org.moparscape.msc.gs.model.ActiveTile;
import org.moparscape.msc.gs.model.InvItem;
import org.moparscape.msc.gs.model.Item;
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
@ -36,7 +41,6 @@ public class Christmas extends Quest
private static final int TOY4_ID = 1320;
private static final int GIFT_ID = 1321;
private static final int DEFAULT_DELAY = 3200;
private static final int QUEST_POINTS = 0;
private World world = World.getWorld();
private static final ItemDropDef[] BOX_ITEMS = new ItemDropDef[]
{
@ -184,7 +188,7 @@ public class Christmas extends Quest
{
int stage = player.getQuestStage(this);
if(action == action.USED_ITEM)
if(action == QuestAction.USED_ITEM)
{
if(!(args[0] instanceof InvItem))
return;
@ -193,7 +197,7 @@ public class Christmas extends Quest
handleUseItem(item, player);
} else
if(action == action.TALKED_NPC)
if(action == QuestAction.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
return;
@ -226,7 +230,7 @@ public class Christmas extends Quest
handleWizardTalk(player, npc);
}
} else
if(action == action.KILLED_NPC)
if(action == QuestAction.KILLED_NPC)
{
if(!(args[0] instanceof Npc))
return;

View File

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

View File

@ -1,7 +1,11 @@
import org.rscdaemon.server.quest.*;
import org.rscdaemon.server.model.*;
import org.rscdaemon.server.event.*;
import org.rscdaemon.server.entityhandling.EntityHandler;
import org.moparscape.msc.gs.event.SingleEvent;
import org.moparscape.msc.gs.external.EntityHandler;
import org.moparscape.msc.gs.model.InvItem;
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
@ -57,7 +61,7 @@ public class ImpCatcher extends Quest
{
int stage = player.getQuestStage(this);
if(action == action.TALKED_NPC)
if(action == QuestAction.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
return;

View File

@ -1,163 +1,177 @@
import org.rscdaemon.server.quest.*;
import org.rscdaemon.server.model.*;
import org.rscdaemon.server.event.*;
import org.moparscape.msc.gs.event.SingleEvent;
import org.moparscape.msc.gs.model.InvItem;
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)
* Status: COMPLETE
* Start: Fred the farmer (id 77), 159, 619
* Items: 207x20
* Reward: 1 quest point, 60 gold, Crafting 350 xp
*
* Quest: Sheep Shearer (v1.0) Status: COMPLETE Start: Fred the farmer (id 77),
* 159, 619 Items: 207x20 Reward: 1 quest point, 60 gold, Crafting 350 xp
*
* @author Konijn
*/
public class SheepShearer extends Quest
{
public class SheepShearer extends Quest {
private final int FRED_ID = 77;
private final int ITEM_WOOL = 207;
private final int REWARD_XP = 350;
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[] SECOND_MENU = new String[]{"Sorry, I don't like the sound of that.", "I'd be happy to help."};
public void init()
{
private final String[] FIRST_MENU = new String[] {
"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() {
associateNpc(FRED_ID);
}
public SheepShearer()
{
public SheepShearer() {
}
public String getName()
{
public String getName() {
return "Sheep Shearer";
}
public int getUniqueID()
{
public int getUniqueID() {
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);
if(stage == -1) // Quest hasn't been started
if (stage == -1) // Quest hasn't been started
{
if(action == action.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
if (action == QuestAction.TALKED_NPC) {
if (!(args[0] instanceof Npc))
return;
final Npc npc = (Npc)args[0];
if(npc.getID() != FRED_ID)
final Npc npc = (Npc) args[0];
if (npc.getID() != FRED_ID)
return;
player.setBusy(true);
npc.blockedBy(player);
sendChat("Hi there, traveller. Care to make some money?", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Hi there, traveller. Care to make some money?", npc,
player);
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
player.setBusy(false);
player.setMenuHandler(new MenuHandler(FIRST_MENU)
{
public void handleReply(final int option, final String reply)
{
player.setMenuHandler(new MenuHandler(FIRST_MENU) {
public void handleReply(final int option,
final String reply) {
player.setBusy(true);
switch(option)
{
case 1:
player.setBusy(false);
npc.unblock();
sendChat("No thanks, I'm good.", player, npc);
break;
case 0:
sendChat("Sure, what do I need to do?", player, npc);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("If you collect 20 balls of wool for me, I'll pay you 500 coins.", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Maybe I'll teach you a thing or two about crafting, too.", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("I'm afraid you'll have to find your own shears, but the sheep are outside.", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
player.setBusy(false);
player.setMenuHandler(new MenuHandler(SECOND_MENU)
{
public void handleReply(final int option, final String reply)
{
player.setBusy(true);
switch(option)
{
case 1:
sendChat("I'd be happy to help.", player, npc);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Great! Come back and see me when you're done.", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
player.setQuestStage(getUniqueID(), 1);
player.setBusy(false);
npc.unblock();
}
});
}
});
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);
switch (option) {
case 1:
player.setBusy(false);
npc.unblock();
sendChat("No thanks, I'm good.", player,
npc);
break;
case 0:
sendChat("Sure, what do I need to do?",
player, npc);
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
sendChat(
"If you collect 20 balls of wool for me, I'll pay you 500 coins.",
npc, player);
addSingleEvent(new SingleEvent(
player, 2000) {
public void action() {
sendChat(
"Maybe I'll teach you a thing or two about crafting, too.",
npc, player);
addSingleEvent(new SingleEvent(
player, 2000) {
public void action() {
sendChat(
"I'm afraid you'll have to find your own shears, but the sheep are outside.",
npc, player);
addSingleEvent(new SingleEvent(
player,
2000) {
public void action() {
player.setBusy(false);
player.setMenuHandler(new MenuHandler(
SECOND_MENU) {
public void handleReply(
final int option,
final String reply) {
player.setBusy(true);
switch (option) {
case 1:
sendChat(
"I'd be happy to help.",
player,
npc);
addSingleEvent(new SingleEvent(
player,
2000) {
public void action() {
sendChat(
"Great! Come back and see me when you're done.",
npc,
player);
addSingleEvent(new SingleEvent(
player,
2000) {
public void action() {
player.setQuestStage(
getUniqueID(),
1);
player.setBusy(false);
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);
npc.unblock();
break;
}
}
});
break;
default:
player.setBusy(false);
npc.unblock();
break;
}
});
owner.getActionSender().sendMenu(SECOND_MENU);
}
});
}
});
}
});
}
});
break;
default:
player.setBusy(false);
npc.unblock();
break;
}
});
owner.getActionSender()
.sendMenu(
SECOND_MENU);
}
});
}
});
}
});
}
});
break;
default:
player.setBusy(false);
npc.unblock();
break;
}
}
});
@ -166,115 +180,107 @@ public class SheepShearer extends Quest
});
} else
return;
} else
if(stage == 1)
{
if(action == action.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
} else if (stage == 1) {
if (action == QuestAction.TALKED_NPC) {
if (!(args[0] instanceof Npc))
return;
final Npc npc = (Npc)args[0];
if(npc.getID() != FRED_ID)
final Npc npc = (Npc) args[0];
if (npc.getID() != FRED_ID)
return;
player.setBusy(true);
npc.blockedBy(player);
sendChat("Ahh, you've returned! Do you have my wool?", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Ahh, you've returned! Do you have my wool?", npc,
player);
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
player.setBusy(false);
player.setMenuHandler(new MenuHandler(new String[]{"I'm afraid not.", "Yes, I do."})
{
public void handleReply(final int option, final String reply)
{
player.setMenuHandler(new MenuHandler(new String[] {
"I'm afraid not.", "Yes, I do." }) {
public void handleReply(final int option,
final String reply) {
player.setBusy(true);
sendChat(reply, player, npc);
if(option == 0)
{
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
sendChat("Well, come and see me when you do. The offer still stands", npc, player);
if (option == 0) {
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
sendChat(
"Well, come and see me when you do. The offer still stands",
npc, player);
player.setBusy(false);
npc.unblock();
}
});
} else
if(option == 1)
{
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
//check items
if(player.getInventory().hasItemId(ITEM_WOOL) && player.getInventory().countId(ITEM_WOOL) >= 20)
{
} else if (option == 1) {
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
// check items
if (player.getInventory()
.hasItemId(ITEM_WOOL)
&& player.getInventory()
.countId(ITEM_WOOL) >= 20) {
finishQuest(player, npc);
} else
{
sendChat("Um, no you don't. Get back to me when you do. The reward still stands!", npc, player);
} else {
sendChat(
"Um, no you don't. Get back to me when you do. The reward still stands!",
npc, player);
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
if (stage == 0) {
if(action == action.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
return;
final Npc npc = (Npc)args[0];
if(npc.getID() != FRED_ID)
return;
player.setBusy(true);
npc.blockedBy(player);
sendChat("Hello " + player.getUsername() + "!", npc, player);
} else if (stage == 0) {
if (action == QuestAction.TALKED_NPC) {
if (!(args[0] instanceof Npc))
return;
final Npc npc = (Npc) args[0];
if (npc.getID() != FRED_ID)
return;
player.setBusy(true);
npc.blockedBy(player);
sendChat("Hello " + player.getUsername() + "!", npc, player);
player.setBusy(false);
npc.unblock();
}
}
}
private void finishQuest(final Player player, final Npc npc)
{
sendChat("Thank you very much! As promised, here's your reward.", npc, player);
addSingleEvent(new SingleEvent(player, 2000)
{
public void action()
{
player.incExp(12, REWARD_XP, false);
player.getActionSender().sendStat(12);
player.setQuestStage(getUniqueID(), Quest.COMPLETE);
for(int i=0; i < 20; i++)
player.getInventory().remove(ITEM_WOOL, 1);
player.getInventory().add(new InvItem(10, REWARD_GP));
player.getActionSender().sendInventory();
player.incQuestPoints(1);
player.setBusy(false);
npc.unblock();
}
});
private void finishQuest(final Player player, final Npc npc) {
sendChat("Thank you very much! As promised, here's your reward.", npc,
player);
addSingleEvent(new SingleEvent(player, 2000) {
public void action() {
player.incExp(12, REWARD_XP, false);
player.getActionSender().sendStat(12);
player.setQuestStage(getUniqueID(), Quest.COMPLETE);
for (int i = 0; i < 20; i++)
player.getInventory().remove(ITEM_WOOL, 1);
player.getInventory().add(new InvItem(10, REWARD_GP));
player.getActionSender().sendInventory();
player.incQuestPoints(1);
player.setBusy(false);
npc.unblock();
}
});
}
}

View File

@ -1,7 +1,9 @@
import org.rscdaemon.server.quest.*;
import org.rscdaemon.server.model.*;
import org.rscdaemon.server.event.*;
import org.rscdaemon.server.entityhandling.EntityHandler;
import org.moparscape.msc.gs.event.SingleEvent;
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: 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 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 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[] 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);
if(action == action.TALKED_NPC)
if(action == QuestAction.TALKED_NPC)
{
if(!(args[0] instanceof Npc))
return;
@ -305,13 +307,6 @@ public class VampireSlayer extends Quest
player.getActionSender().sendMenu(SECOND_MENU);
}
/**
* Finishes the quest
*/
private void finishQuest(final Player player, final Npc npc)
{
}
/**
* Construct the quest (empty)
*/