|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.properties.PList wyvern.lib.properties.ProximityProperty wyvern.lib.properties.QuestInfo
Lets a monster or NPC be part of a quest. The NPC will give you something, do something, or say something, if you give them the right item or say the right passphrase. The configuration properties are all required unless otherwise specified.
The NPC with a QuestInfo object can be "activated" by a phrase the player says, an item the player gives, or both. Activating the NPC can do one of four things: say a message, give a gift, perform a command, and/or solve a quest.
Activation properties: (note that they're all optional, but you have to either set "item-id", "item-arch", or "password" for the NPC to have a way to be activated.
Action properties: Things the NPC can do, on activation, that aren't related to solving a quest.
Field Summary | |
static java.lang.String[] |
hookNames_
|
static Rectangle |
proxRect_
|
Fields inherited from class wyvern.kernel.properties.PList |
readOnly_ |
Fields inherited from interface wyvern.lib.PropertyList |
PROPERTY_PACKAGE |
Constructor Summary | |
QuestInfo()
Constructs a new QuestInfo |
Method Summary | |
void |
activate(Player agent,
GameObject item)
Performs our post-activation actions: gives presents, optionally solves a quest, and performs any commands. |
java.lang.String |
getActivationMsg()
Returns the activation message, in "activation-msg" property. |
java.lang.String |
getGiftArch()
Returns "gift-arch" string property: optional item to give player when activated. |
java.lang.String |
getGiftMsg()
Returns the "gift-msg": the message to print when giving a present to the player. |
int |
getGiveCount()
Returns value of the give-count int property. |
java.lang.String[] |
getHookNames()
Returns the hooks we're registered on ("givePostHook", etc.) |
java.lang.String |
getItemArch()
Returns the item that the NPC must receive to be activated. |
java.lang.String |
getItemID()
Returns the "item-id" property - the optional unique identifier for the item to activate the NPC. |
java.lang.String |
getLongName()
Returns quest long-name, in "long-name" property. |
java.lang.String |
getNoMapMsg()
Returns string property "no-map-msg": what to say if NPC is in wrong map when activated. |
java.lang.String |
getPassword()
Returns the string stored in the "password" property. |
java.lang.String |
getPerformCommand()
Returns "perform-cmd" property. |
int |
getPerformCount()
Returns perform-count property. |
Rectangle |
getProximityRect()
|
int |
getQP()
Returns number of quest points to give |
java.lang.String |
getQuestPath()
Returns "quest-path" string property: where the NPC has to be in order for activation to work. |
java.lang.String |
getShortName()
Returns quest short-name, in "short-name" property. |
boolean |
getShoutOnSolve()
Returns whether to shout on solving the quest. |
java.lang.String |
getSolveMsg()
Returns message to pring when solving the quest. |
java.lang.String |
getWrongItemMsg()
Returns the wrong-item message, in "wrong-item-msg" property. |
void |
giveGifts(Monster agent)
Handles giving the player a present on activation. |
void |
handleGive(CommandEvent event)
Handles giving the NPC something. |
void |
handleSay(java.lang.String hookName,
CommandEvent event)
Handles a player saying something near the NPC. |
void |
hookEvent(java.lang.String hookName,
GameObject npc,
CommandEvent event)
The desired event has taken place within the specified range of the target that was passed to GameMap.addProximityHook(). |
boolean |
isCaseSensitive()
Returns true if the password is case-sensitive. |
boolean |
keepItem()
Returns true if we keep the item after receiving it. |
java.lang.String |
mangleMessage(java.lang.String msg,
Monster player,
Monster speaker)
Replaces %t and %n in the message. |
void |
performCommands()
Performs any commands we might be required to do. |
void |
setActivationMsg(java.lang.String msg)
Sets activation-msg property. |
void |
setCaseSensitive(boolean sensitive)
Sets the case-sensitive property. |
void |
setGiftArch(java.lang.String arch)
Sets "gift-arch" property. |
void |
setGiftMsg(java.lang.String msg)
Sets "gift-msg" property. |
void |
setGiveCount(int count)
Sets "give-count" property. |
void |
setItemArch(java.lang.String arch)
Sets item-arch property. |
void |
setItemID(java.lang.String id)
Sets item-id property. |
void |
setKeepItem(boolean keep)
Sets "keep-item" property. |
void |
setLongName(java.lang.String name)
Sets quest long-name. |
void |
setNoMapMsg(java.lang.String msg)
Sets "no-map-msg" property. |
void |
setPassword(java.lang.String password)
Sets password |
void |
setPerformCommand(java.lang.String cmd)
Sets the "perform-cmd" property. |
void |
setPerformCount(int count)
Sets "perform-count" property. |
void |
setQP(int qp)
Sets "qp" property. |
void |
setQuestPath(java.lang.String path)
Sets quest-path property. |
void |
setShortName(java.lang.String name)
Sets quest short name. |
void |
setShoutOnSolve(boolean shout)
Sets shout-on-solve property. |
void |
setSolveMsg(java.lang.String msg)
Sets solve-msg property. |
void |
setSolvesQuest(boolean solves)
Sets "solves-quest" property. |
void |
setWrongItemMsg(java.lang.String msg)
Sets wrong-item-msg property. |
boolean |
solveQuest(Commandable c,
GameObject questItem)
Solves the quest (maybe). |
boolean |
solvesQuest()
Returns true if the NPC is a quest-solver. |
java.lang.String |
toString()
Returns a debugging string. |
Methods inherited from class wyvern.lib.properties.ProximityProperty |
createClone, getTarget, notifyAdd, notifyRemove, targetEnteredMap, targetLeftMap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static Rectangle proxRect_
public static java.lang.String[] hookNames_
Constructor Detail |
public QuestInfo()
Method Detail |
public java.lang.String[] getHookNames()
getHookNames
in class ProximityProperty
public Rectangle getProximityRect()
getProximityRect
in class ProximityProperty
public void hookEvent(java.lang.String hookName, GameObject npc, CommandEvent event)
hookEvent
in interface ProximityCallback
hookEvent
in class ProximityProperty
hookName
- the name of the hook (e.g. "sayPostHook") that's
being run.npc
- the object near which the event took place.event
- the eventpublic void handleGive(CommandEvent event)
public void handleSay(java.lang.String hookName, CommandEvent event)
hookName
- sayPostHook or talkPostHookevent
- the say evetnpublic void activate(Player agent, GameObject item)
agent
- the player who activated the NPCitem
- the item that was given to solves the quest -
can be null if the quest was voice-activatedpublic void giveGifts(Monster agent)
agent
- the player to give the item topublic void performCommands()
public boolean solveQuest(Commandable c, GameObject questItem)
public java.lang.String toString()
toString
in class PList
public java.lang.String getShortName()
public java.lang.String getLongName()
public java.lang.String getItemID()
public java.lang.String getWrongItemMsg()
public java.lang.String getActivationMsg()
public java.lang.String getQuestPath()
public java.lang.String getNoMapMsg()
public java.lang.String getSolveMsg()
public boolean getShoutOnSolve()
public int getQP()
public java.lang.String getGiftArch()
public java.lang.String getGiftMsg()
public java.lang.String getPerformCommand()
public int getPerformCount()
public int getGiveCount()
public java.lang.String getItemArch()
public java.lang.String getPassword()
public boolean isCaseSensitive()
public boolean solvesQuest()
public boolean keepItem()
public void setPassword(java.lang.String password)
public void setShortName(java.lang.String name)
public void setLongName(java.lang.String name)
public void setItemID(java.lang.String id)
public void setWrongItemMsg(java.lang.String msg)
public void setActivationMsg(java.lang.String msg)
public void setQuestPath(java.lang.String path)
public void setNoMapMsg(java.lang.String msg)
public void setSolveMsg(java.lang.String msg)
public void setShoutOnSolve(boolean shout)
public void setQP(int qp)
public void setGiftArch(java.lang.String arch)
public void setGiftMsg(java.lang.String msg)
public void setPerformCommand(java.lang.String cmd)
public void setPerformCount(int count)
public void setGiveCount(int count)
public void setItemArch(java.lang.String arch)
public void setCaseSensitive(boolean sensitive)
public void setSolvesQuest(boolean solves)
public void setKeepItem(boolean keep)
public java.lang.String mangleMessage(java.lang.String msg, Monster player, Monster speaker)
speaker
- the monster saying the messagemsg
- the messageplayer
- the player to say it to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |