123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- module.exports = class ZebedeeAdventurer1 {
- constructor() {
- this.id = 1;
- this.name = "an adventurer";
- this.description = "She is a human woman wearing mismatched leather armor and steel plate. Her hair is short and seems to have a leaf in it. She speaks loudly enough for everyone around to hear, and apparently only has good things to say about herself.";
- this.type = "mobile";
- this.roomId = 1;
- this.idleDelay = 30000;
- this.filename = "zebedee/adventurer1.js";
- this.lastIdle = 0;
- this.keywords = ["adventurer", "lady", "miss", "woman", "human"];
- this.items = [];
- this.commandQueue = [];
- this.memory = {};
- }
- mud_init(mobileName) {
- world.mud_addMobileToRoom("ZebedeeAdventurerGuild", this.id);
- this.mud_spawnThisMobile("PhandalinRoad6");
- }
- mud_spawnThisMobile(roomName) {
- var id = builder.mud_spawnMobile("ZebedeeAdventurer1").id;
- world.mud_addMobileToRoom(roomName, id);
- world.mud_addItemToMobile(id, builder.mud_spawnItem("WoodenSword").id);
- }
- mud_sendMessage(source, message) {
- message = message.replace(/\{.*?\}/g, "");
- var cleanMessage = message.trim();
- if(source == this) {
- return;
- }
- if(cleanMessage.indexOf("shout") != -1) {
- return;
- }
- if(libs.Conversation.basicDecency(source, cleanMessage, this)) {
- return;
- }
- if(this.commandQueue.length <= 0 && cleanMessage.indexOf("adventure") != -1 && cleanMessage.indexOf("lately") != -1 && !this.mud_checkMemory("storytelling", source.name)) {
- var sourceRefer = source.keywords[parseInt(Math.random() * source.keywords.length)];
- this.mud_addCommand(this, "smile");
- this.mud_addCommand(this, "say Ok, so... there I was, right?");
- this.mud_addCommand(this, "emote gestures with her hands.");
- this.mud_addCommand(this, "say And this HUGE group of goblins was right over here.");
- this.mud_addCommand(this, "emote gestures with her hands.");
- this.mud_addCommand(this, "say So we climbed up this cliff, see?");
- this.mud_addCommand(this, "emote gestures with her hands.");
- this.mud_addCommand(this, "say Then I screamed and leaped!");
- this.mud_addCommand(this, "say and those dirty gobboes screamed and shit their pants!");
- this.mud_addCommand(this, "laugh");
- this.mud_addCommand(this, "say then I stabbed one in the belly and");
- this.mud_addCommand(this, "emote lurches toward you with her sword drawn.");
- this.mud_addCommand(this, "say {red}spilled his guts all over the ground!{/red}");
- this.mud_addCommand(this, "laugh");
- this.mud_addCommand(this, "say How about you, " +sourceRefer +"? You got any good stories?");
- this.mud_addMemory("storytelling", source.name);
- return;
- }
- if(cleanMessage.indexOf("wipes some sweat from her brow") != -1 || cleanMessage.indexOf("wipes some sweat from his brow") != -1) {
- var sourceRefer = source.keywords[parseInt(Math.random() * source.keywords.length)];
- this.mud_addCommand(this, "say hey " + sourceRefer + ", it's hot in here, right?");
- this.mud_addCommand(this, "laugh " + sourceRefer);
- return;
- }
- if(cleanMessage.indexOf("strokes his beard and pulls out a chip of stone") != -1) {
- var sourceRefer = source.keywords[parseInt(Math.random() * source.keywords.length)];
- this.mud_addCommand(this, "say hey " + sourceRefer + ", you should hit the showers!");
- this.mud_addCommand(this, "laugh " + sourceRefer);
- return;
- }
-
- /*if(libs.Conversation.followsOrders(source, cleanMessage, this)) {
- return;
- }*/
- }
- mud_addMemory(section, newMemory) {
- if(!this.memory.hasOwnProperty(section)) {
- this.memory[section] = [];
- }
- if(!this.mud_checkMemory(section, newMemory)) {
- this.memory[section].push(newMemory);
- }
- }
- mud_checkMemory(section, memoryToCheck) {
- if(this.memory.hasOwnProperty(section)) {
- if(this.memory[section].indexOf(memoryToCheck) != -1) {
- return true;
- }
- }
- return false;
- }
- mud_addCommand(source, message) {
- this.commandQueue.push(message);
- }
- mud_reset(time) {
- var idleMessages = ["emote wipes some sweat from her brow.",
- "emote boasts loudly about some goblin she killed in a very {red}visceral{/red} way.",
- "emote shoves someone for standing too close to her.",
- "emote draws her gleaming sword and very obviously polishes it's perfectly clean blade."
- ];
- idleMessages = idleMessages.concat(libs.Conversation.getRoomExits(this));
- var randomIdle = idleMessages[parseInt(Math.random() * idleMessages.length)];
- this.mud_addCommand(this, randomIdle);
- this.memory = {};
- this.lastIdle = time + this.idleDelay;
- }
- mud_tick(time) {
- if(this.commandQueue.length <= 0 && this.roomId == "ZebedeeCormallenRoad4") {
- this.mud_addCommand(this, "emote stumbles out of the guild and looks around, confused.");
- this.mud_addCommand(this, "say Aaie, SHIT! You little");
- this.mud_addCommand(this, "south");
- return;
- }
- if(time >= this.lastIdle) {
- this.mud_reset(time);
- }
- if(this.commandQueue.length > 0 ) {
- world.mud_handleInput(this.roomId, this.id, this.commandQueue.shift().split(" "));
- this.lastIdle = time + this.idleDelay;
- }
- }
- mud_getName() {
- return "{mobile}" + this.name + "{/mobile}";
- }
- mud_getDescription() {
- return this.description;
- }
- mud_wearInSlot(itemId, slot) {
- if(this.itemSlots.hasOwnProperty(slot) && this.itemSlots[slot] != null) {
- return this.itemSlots[slot];
- }
- this.itemSlots[slot] = itemId;
- }
- mud_removeSlot(slot) {
- if(!this.itemSlots.hasOwnProperty(slot) || this.itemSlots[slot] == null) {
- return false;
- }
- this.itemSlots[slot] = null;
- }
- mud_addCurrency(amount) {
- this.account += amount;
- }
- mud_removeCurrency(amount) {
- this.account -= amount;
- this.account = Math.max(0, this.account);
- }
- };
|