diff --git a/Makefile b/Makefile index 27324b72..b7939b27 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,9 @@ clean-instances: ### Deletes all room instance data. Starts the world fresh. run: generate ### Build and run server. @go run . +.PHONY: run-new +run-new: clean-instances generate run ### Deletes instance data and runs server + .PHONY: run-docker run-docker: ### Build and run server in docker. $(DOCKER_COMPOSE) up --build --remove-orphans server diff --git a/_datafiles/config.yaml b/_datafiles/config.yaml index 3d255622..5d6da5ca 100755 --- a/_datafiles/config.yaml +++ b/_datafiles/config.yaml @@ -455,10 +455,12 @@ SpecialRooms: # This should have some way of healing them and (eventually) # sending them back into the main world. DeathRecoveryRoom: 75 - # - TutorialStartRooms - - # RoomIds players will be put in when starting the game/tutorial - # RoomIds 900-999 are reserved for Tutorial rooms. - TutorialStartRooms: [900, 910, 920, 930, 940, 990] + # - TutorialRooms - + # This should be an array of all room id's for the pre-start tutorial. + # The first one on the list is the room they will be placed in when beginning + # Rooms 900-999 are a special range of RoomId's that tell GoMud the user is + # in a tutorial. + TutorialRooms: [900, 901, 902, 903] ################################################################################ # diff --git a/_datafiles/guides/building/scripting/FUNCTIONS_ROOMS.md b/_datafiles/guides/building/scripting/FUNCTIONS_ROOMS.md index e0066c3d..9f35c159 100644 --- a/_datafiles/guides/building/scripting/FUNCTIONS_ROOMS.md +++ b/_datafiles/guides/building/scripting/FUNCTIONS_ROOMS.md @@ -1,6 +1,8 @@ # Room Specific Functions - [Room Specific Functions](#room-specific-functions) + - [CreateInstancesFromRoomIds(RoomIds \[int, int...\]) Object ](#createinstancesfromroomidsroomids-int-int-object-) + - [CreateInstancesFromZone(zoneName string) Object ](#createinstancesfromzonezonename-string-object-) - [GetRoom(roomId int) RoomObject ](#getroomroomid-int-roomobject-) - [RoomObject.RoomId() int](#roomobjectroomid-int) - [RoomObject.SendText(msg string\[, excludeUserIds int\])](#roomobjectsendtextmsg-string-excludeuserids-int) @@ -27,6 +29,22 @@ - [RoomObject.RepeatSpawnItem(itemId int, roundInterval int \[, containerName\]](#roomobjectrepeatspawnitemitemid-int-roundinterval-int--containername) - [RoomObject.SetLocked(exitName string, lockIt bool)](#roomobjectsetlockedexitname-string-lockit-bool) +## [CreateInstancesFromRoomIds(RoomIds [int, int...]) Object ](/internal/scripting/room_func.go) +Returns an Object with key/value pairs of `ProvidedRoomId`=>`NewRoomId` +Creates ephemeral instances of the RoomId's provided. + +| Argument | Explanation | +| --- | --- | +| RoomIds | an array of integers containing RoomId's you want instanced | + +## [CreateInstancesFromZone(zoneName string) Object ](/internal/scripting/room_func.go) +Returns an Object with key/value pairs of `ProvidedRoomId`=>`NewRoomId` +Creates ephemeral instances of the RoomIds of the zone provided. + +| Argument | Explanation | +| --- | --- | +| zoneName | The name of the zone to create instances from the zone rooms | + ## [GetRoom(roomId int) RoomObject ](/internal/scripting/room_func.go) Retrieves a RoomObject for a given roomId. diff --git a/_datafiles/world/default/rooms/tutorial/900.js b/_datafiles/world/default/rooms/tutorial/900.js index 4962d844..3a6290a5 100644 --- a/_datafiles/world/default/rooms/tutorial/900.js +++ b/_datafiles/world/default/rooms/tutorial/900.js @@ -18,10 +18,12 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; // Make sure they are only doing stuff that's allowed. if ( cmd == "east" && !canGoEast ) { teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); + extraDelay = 1.0; ignoreCommand = true; } @@ -32,17 +34,21 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); + extraDelay = 1.0; + + if ( fullCommand == "look orb" ) { + teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.', 2.0); + extraDelay = 2.0; } - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); + if ( fullCommand == "look east" ) { + teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.', 2.0); + teacherMob.Command('say Later when you find objects, you can look at them in the same manner.', 3.0); + teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.', 4.0); + teacherMob.Command('emote considers for a moment.', 5.0); + extraDelay = 7.0; } commandNow++; @@ -57,28 +63,28 @@ function onCommand(cmd, rest, user, room) { switch (commandNow) { case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); + teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings', extraDelay+1.0); + teacherMob.Command('say type look and hit enter to see a description of the area you are in.', extraDelay+2.0); break; case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); + teacherMob.Command('say You can also look at creatures or people in the room.', extraDelay+1.0); + teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.', extraDelay+2.0); break; case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); + teacherMob.Command('say Try the look command again, but this time, pay attention to any exits.', extraDelay+1.0); break; case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); + teacherMob.Command('say Did you notice there is an exit to the east?', extraDelay+1.0); + teacherMob.Command('say type look east to look into the east room.', extraDelay+2.0); break; case 4: canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); + teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.', extraDelay+1.0); + teacherMob.Command('say type east to travel through the east exit.', extraDelay+2.0); break; default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); + teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.', extraDelay+1.0); + teacherMob.Command('say type east to travel through the east exit.', extraDelay+2.0); break; } @@ -98,10 +104,10 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); + teacherMob.Command('say Welcome to the Newbie School!', 1.0); + teacherMob.Command('say I\'ll give you some tips to help you get started.', 2.0); + teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.', 3.0); + teacherMob.Command('say type look and hit enter to see a description of the area you are in.', 5.0); } diff --git a/_datafiles/world/default/rooms/tutorial/901.js b/_datafiles/world/default/rooms/tutorial/901.js index a932ac79..712134f4 100644 --- a/_datafiles/world/default/rooms/tutorial/901.js +++ b/_datafiles/world/default/rooms/tutorial/901.js @@ -19,6 +19,7 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; // Make sure they are only doing stuff that's allowed. if ( cmd == "south" && !canGoSouth ) { @@ -33,16 +34,19 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); + extraDelay = 1.0; if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); + teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.', 2.0); + teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.', 3.0); + extraDelay = 3.0; } if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); + teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.', 2.0); + teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.', 3.0); + extraDelay = 3.0; } commandNow++; @@ -63,24 +67,24 @@ function onCommand(cmd, rest, user, room) { user.GiveItem(itm); } - teacherMob.Command('say To see all of your characters stats, type status.'); + teacherMob.Command('say To see all of your characters stats, type status.', extraDelay+1.0); break; case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); + teacherMob.Command('say To only peek at your inventory, type inventory.', extraDelay+1.0); break; case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); + teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".', extraDelay+1.0); + teacherMob.Command('say For quick look at your progress, type experience.', extraDelay+2.0); break; case 3: teacherMob.Command('emote touches you and you feel more focused.'); user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); + teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.',extraDelay+1.0); + teacherMob.Command('say type conditions to see any statuses affecting you.', extraDelay+2.0); break; case 4: user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); + teacherMob.Command('say head south for the next lesson.', extraDelay+1.0); canGoSouth = true; room.SetLocked("south", false); break; @@ -105,8 +109,8 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); + teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.', 1.0); + teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.', 2.0); } diff --git a/_datafiles/world/default/rooms/tutorial/902.js b/_datafiles/world/default/rooms/tutorial/902.js index f5029f89..6ef15b8a 100644 --- a/_datafiles/world/default/rooms/tutorial/902.js +++ b/_datafiles/world/default/rooms/tutorial/902.js @@ -17,6 +17,7 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; // Make sure they are only doing stuff that's allowed. if ( cmd == "south" && !canGoSouth ) { @@ -31,15 +32,19 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); + + extraDelay = 1.0; if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); + teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!', 2.0); + extraDelay = 2.0; } if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); + teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.', 2.0); + teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.', 3.0); + extraDelay = 3.0; } commandNow++; @@ -65,14 +70,14 @@ function onCommand(cmd, rest, user, room) { user.GiveItem(itm); } - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); + teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.', extraDelay+1.0); break; case 1: getDummy(room); - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); + teacherMob.Command('say You may have noticed the training dummy here.', extraDelay+1.0); + teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.', extraDelay+2.0); break; case 2: // teacherMob.Command('say Head west to complete your training.'); @@ -98,14 +103,14 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); + teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!', 1.0); if ( !user.HasItemId(firstItemId) ) { itm = CreateItem(firstItemId); user.GiveItem(itm); } - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); + teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.', 2.0); } diff --git a/_datafiles/world/default/rooms/tutorial/903.js b/_datafiles/world/default/rooms/tutorial/903.js index 05728084..a00574b8 100644 --- a/_datafiles/world/default/rooms/tutorial/903.js +++ b/_datafiles/world/default/rooms/tutorial/903.js @@ -16,6 +16,8 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; + fullCommand = cmd; if ( rest.length > 0 ) { fullCommand = cmd + ' ' + rest; @@ -28,11 +30,13 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); } else { - teacherMob.Command("say Good job! You earned it!"); + teacherMob.Command("say Good job! You earned it!", 1.0); } + extraDelay = 1.0; + commandNow++; } else { @@ -46,25 +50,24 @@ function onCommand(cmd, rest, user, room) { switch (commandNow) { case 0: - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); + teacherMob.Command('emote gestures to the graduation cap on the ground.', extraDelay+2.0); + teacherMob.Command('say type get cap to pick up the graduation cap.', extraDelay+3.0); break; case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); + teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.', extraDelay+2.0); break; case 2: - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); + teacherMob.Command('say It\'s time to say goodbye', extraDelay+1.0); + teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.', extraDelay+2.0); exits = room.GetExits(); if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); + teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!', extraDelay+3.0); room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room } - teacherMob.Command('say Enter the portal when you are ready.'); + teacherMob.Command('say Enter the portal by typing swirling portal (or just portal) when you are ready.', extraDelay+4.0); break; default: @@ -90,10 +93,10 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); + teacherMob.Command('say Congratulation on getting to the end of the training course!', 1.0); + teacherMob.Command('drop cap', 2.0); + teacherMob.Command('emote gestures to the graduation cap on the ground.', 3.0); + teacherMob.Command('say type get cap to pick up the graduation cap.', 4.0); } diff --git a/_datafiles/world/default/rooms/tutorial/910.js b/_datafiles/world/default/rooms/tutorial/910.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/default/rooms/tutorial/910.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/910.yaml b/_datafiles/world/default/rooms/tutorial/910.yaml deleted file mode 100755 index 4e712182..00000000 --- a/_datafiles/world/default/rooms/tutorial/910.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 910 -zone: Tutorial -zoneconfig: - roomid: 910 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 911 diff --git a/_datafiles/world/default/rooms/tutorial/911.js b/_datafiles/world/default/rooms/tutorial/911.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/default/rooms/tutorial/911.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/911.yaml b/_datafiles/world/default/rooms/tutorial/911.yaml deleted file mode 100755 index 642e3421..00000000 --- a/_datafiles/world/default/rooms/tutorial/911.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 911 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 912 - lock: - difficulty: 10 - west: - roomid: 910 diff --git a/_datafiles/world/default/rooms/tutorial/912.js b/_datafiles/world/default/rooms/tutorial/912.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/default/rooms/tutorial/912.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/912.yaml b/_datafiles/world/default/rooms/tutorial/912.yaml deleted file mode 100755 index 31d0f56b..00000000 --- a/_datafiles/world/default/rooms/tutorial/912.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 912 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 911 - lock: - difficulty: 10 - west: - roomid: 913 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/default/rooms/tutorial/913.js b/_datafiles/world/default/rooms/tutorial/913.js deleted file mode 100644 index 05728084..00000000 --- a/_datafiles/world/default/rooms/tutorial/913.js +++ /dev/null @@ -1,181 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/default/rooms/tutorial/913.yaml b/_datafiles/world/default/rooms/tutorial/913.yaml deleted file mode 100755 index 2fb5f553..00000000 --- a/_datafiles/world/default/rooms/tutorial/913.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 913 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/default/rooms/tutorial/920.js b/_datafiles/world/default/rooms/tutorial/920.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/default/rooms/tutorial/920.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/920.yaml b/_datafiles/world/default/rooms/tutorial/920.yaml deleted file mode 100755 index d94b8fa7..00000000 --- a/_datafiles/world/default/rooms/tutorial/920.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 920 -zone: Tutorial -zoneconfig: - roomid: 920 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 921 diff --git a/_datafiles/world/default/rooms/tutorial/921.js b/_datafiles/world/default/rooms/tutorial/921.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/default/rooms/tutorial/921.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/921.yaml b/_datafiles/world/default/rooms/tutorial/921.yaml deleted file mode 100755 index 0fcc9173..00000000 --- a/_datafiles/world/default/rooms/tutorial/921.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 921 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 922 - lock: - difficulty: 10 - west: - roomid: 920 diff --git a/_datafiles/world/default/rooms/tutorial/922.js b/_datafiles/world/default/rooms/tutorial/922.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/default/rooms/tutorial/922.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/922.yaml b/_datafiles/world/default/rooms/tutorial/922.yaml deleted file mode 100755 index 2025b989..00000000 --- a/_datafiles/world/default/rooms/tutorial/922.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 922 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 921 - lock: - difficulty: 10 - west: - roomid: 923 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/default/rooms/tutorial/923.js b/_datafiles/world/default/rooms/tutorial/923.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/default/rooms/tutorial/923.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/default/rooms/tutorial/923.yaml b/_datafiles/world/default/rooms/tutorial/923.yaml deleted file mode 100755 index be6f1f6f..00000000 --- a/_datafiles/world/default/rooms/tutorial/923.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 923 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/default/rooms/tutorial/930.js b/_datafiles/world/default/rooms/tutorial/930.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/default/rooms/tutorial/930.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/930.yaml b/_datafiles/world/default/rooms/tutorial/930.yaml deleted file mode 100755 index c95826f1..00000000 --- a/_datafiles/world/default/rooms/tutorial/930.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 930 -zone: Tutorial -zoneconfig: - roomid: 930 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 931 diff --git a/_datafiles/world/default/rooms/tutorial/931.js b/_datafiles/world/default/rooms/tutorial/931.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/default/rooms/tutorial/931.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/931.yaml b/_datafiles/world/default/rooms/tutorial/931.yaml deleted file mode 100755 index 4009a617..00000000 --- a/_datafiles/world/default/rooms/tutorial/931.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 931 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 932 - lock: - difficulty: 10 - west: - roomid: 930 diff --git a/_datafiles/world/default/rooms/tutorial/932.js b/_datafiles/world/default/rooms/tutorial/932.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/default/rooms/tutorial/932.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/932.yaml b/_datafiles/world/default/rooms/tutorial/932.yaml deleted file mode 100755 index 2f521f0b..00000000 --- a/_datafiles/world/default/rooms/tutorial/932.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 932 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 931 - lock: - difficulty: 10 - west: - roomid: 933 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/default/rooms/tutorial/933.js b/_datafiles/world/default/rooms/tutorial/933.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/default/rooms/tutorial/933.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/default/rooms/tutorial/933.yaml b/_datafiles/world/default/rooms/tutorial/933.yaml deleted file mode 100755 index a3d99689..00000000 --- a/_datafiles/world/default/rooms/tutorial/933.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 933 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/default/rooms/tutorial/940.js b/_datafiles/world/default/rooms/tutorial/940.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/default/rooms/tutorial/940.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/940.yaml b/_datafiles/world/default/rooms/tutorial/940.yaml deleted file mode 100755 index 3e85805f..00000000 --- a/_datafiles/world/default/rooms/tutorial/940.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 940 -zone: Tutorial -zoneconfig: - roomid: 940 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 941 diff --git a/_datafiles/world/default/rooms/tutorial/941.js b/_datafiles/world/default/rooms/tutorial/941.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/default/rooms/tutorial/941.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/941.yaml b/_datafiles/world/default/rooms/tutorial/941.yaml deleted file mode 100755 index 72d20bd8..00000000 --- a/_datafiles/world/default/rooms/tutorial/941.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 941 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 942 - lock: - difficulty: 10 - west: - roomid: 940 diff --git a/_datafiles/world/default/rooms/tutorial/942.js b/_datafiles/world/default/rooms/tutorial/942.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/default/rooms/tutorial/942.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/942.yaml b/_datafiles/world/default/rooms/tutorial/942.yaml deleted file mode 100755 index 1642802a..00000000 --- a/_datafiles/world/default/rooms/tutorial/942.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 942 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 941 - lock: - difficulty: 10 - west: - roomid: 943 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/default/rooms/tutorial/943.js b/_datafiles/world/default/rooms/tutorial/943.js deleted file mode 100644 index 05728084..00000000 --- a/_datafiles/world/default/rooms/tutorial/943.js +++ /dev/null @@ -1,181 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/default/rooms/tutorial/943.yaml b/_datafiles/world/default/rooms/tutorial/943.yaml deleted file mode 100755 index c6b4dce1..00000000 --- a/_datafiles/world/default/rooms/tutorial/943.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 943 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/default/rooms/tutorial/990.js b/_datafiles/world/default/rooms/tutorial/990.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/default/rooms/tutorial/990.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/990.yaml b/_datafiles/world/default/rooms/tutorial/990.yaml deleted file mode 100755 index 15cfb99e..00000000 --- a/_datafiles/world/default/rooms/tutorial/990.yaml +++ /dev/null @@ -1,10 +0,0 @@ -roomid: 990 -zone: Tutorial -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 991 diff --git a/_datafiles/world/default/rooms/tutorial/991.js b/_datafiles/world/default/rooms/tutorial/991.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/default/rooms/tutorial/991.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/991.yaml b/_datafiles/world/default/rooms/tutorial/991.yaml deleted file mode 100755 index b923ec64..00000000 --- a/_datafiles/world/default/rooms/tutorial/991.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 991 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 992 - lock: - difficulty: 10 - west: - roomid: 990 diff --git a/_datafiles/world/default/rooms/tutorial/992.js b/_datafiles/world/default/rooms/tutorial/992.js deleted file mode 100644 index ee24ac62..00000000 --- a/_datafiles/world/default/rooms/tutorial/992.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - //teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/default/rooms/tutorial/992.yaml b/_datafiles/world/default/rooms/tutorial/992.yaml deleted file mode 100755 index 59ebb444..00000000 --- a/_datafiles/world/default/rooms/tutorial/992.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 992 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 991 - lock: - difficulty: 10 - west: - roomid: 993 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/default/rooms/tutorial/993.js b/_datafiles/world/default/rooms/tutorial/993.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/default/rooms/tutorial/993.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/default/rooms/tutorial/993.yaml b/_datafiles/world/default/rooms/tutorial/993.yaml deleted file mode 100755 index 3c48843a..00000000 --- a/_datafiles/world/default/rooms/tutorial/993.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 993 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/default/users/1.yaml b/_datafiles/world/default/users/1.yaml index 62d41b9b..c8474524 100755 --- a/_datafiles/world/default/users/1.yaml +++ b/_datafiles/world/default/users/1.yaml @@ -19,7 +19,7 @@ character: the balance of the world, swiftly and decisively. adjectives: - zombie - roomid: 1 + roomid: 2 zone: Frostfang raceid: 2 stats: @@ -39,7 +39,7 @@ character: perception: training: 2 level: 5 - experience: 17470 + experience: 17509 trainingpoints: 44 statpoints: 6 health: 60 @@ -60,28 +60,32 @@ character: - itemid: 30002 uses: 1 - itemid: 10012 + - itemid: 10001 buffs: list: - buffid: 28 - onstartevent: true permabuff: true - roundcounter: 28 + roundcounter: 3 triggersleft: 1000000000 - buffid: 29 - onstartevent: true permabuff: true - roundcounter: 6 + roundcounter: 11 triggersleft: 1000000000 - buffid: 39 - onstartevent: false permabuff: true - roundcounter: 10 triggersleft: 1000000000 + - buffid: 32 + roundcounter: 79 + triggersleft: 1 equipment: weapon: itemid: 10004 offhand: itemid: 20004 + head: + itemid: 20043 + neck: {} + body: {} belt: itemid: 20011 gloves: @@ -89,6 +93,8 @@ character: ring: itemid: 20015 uncursed: true + legs: {} + feet: {} skills: brawling: 4 cast: 4 @@ -109,12 +115,12 @@ character: 784-chest: DUU key-110-west: "3" kd: - totalkills: 20 + totalkills: 22 kills: 1: 5 2: 6 18: 1 - 58: 8 + 58: 10 totaldeaths: 1 totalpvpkills: 0 playerkills: {} diff --git a/_datafiles/world/empty/rooms/tutorial/900.js b/_datafiles/world/empty/rooms/tutorial/900.js index 4962d844..3a6290a5 100644 --- a/_datafiles/world/empty/rooms/tutorial/900.js +++ b/_datafiles/world/empty/rooms/tutorial/900.js @@ -18,10 +18,12 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; // Make sure they are only doing stuff that's allowed. if ( cmd == "east" && !canGoEast ) { teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); + extraDelay = 1.0; ignoreCommand = true; } @@ -32,17 +34,21 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); + extraDelay = 1.0; + + if ( fullCommand == "look orb" ) { + teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.', 2.0); + extraDelay = 2.0; } - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); + if ( fullCommand == "look east" ) { + teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.', 2.0); + teacherMob.Command('say Later when you find objects, you can look at them in the same manner.', 3.0); + teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.', 4.0); + teacherMob.Command('emote considers for a moment.', 5.0); + extraDelay = 7.0; } commandNow++; @@ -57,28 +63,28 @@ function onCommand(cmd, rest, user, room) { switch (commandNow) { case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); + teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings', extraDelay+1.0); + teacherMob.Command('say type look and hit enter to see a description of the area you are in.', extraDelay+2.0); break; case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); + teacherMob.Command('say You can also look at creatures or people in the room.', extraDelay+1.0); + teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.', extraDelay+2.0); break; case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); + teacherMob.Command('say Try the look command again, but this time, pay attention to any exits.', extraDelay+1.0); break; case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); + teacherMob.Command('say Did you notice there is an exit to the east?', extraDelay+1.0); + teacherMob.Command('say type look east to look into the east room.', extraDelay+2.0); break; case 4: canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); + teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.', extraDelay+1.0); + teacherMob.Command('say type east to travel through the east exit.', extraDelay+2.0); break; default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); + teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.', extraDelay+1.0); + teacherMob.Command('say type east to travel through the east exit.', extraDelay+2.0); break; } @@ -98,10 +104,10 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); + teacherMob.Command('say Welcome to the Newbie School!', 1.0); + teacherMob.Command('say I\'ll give you some tips to help you get started.', 2.0); + teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.', 3.0); + teacherMob.Command('say type look and hit enter to see a description of the area you are in.', 5.0); } diff --git a/_datafiles/world/empty/rooms/tutorial/901.js b/_datafiles/world/empty/rooms/tutorial/901.js index a932ac79..712134f4 100644 --- a/_datafiles/world/empty/rooms/tutorial/901.js +++ b/_datafiles/world/empty/rooms/tutorial/901.js @@ -19,6 +19,7 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; // Make sure they are only doing stuff that's allowed. if ( cmd == "south" && !canGoSouth ) { @@ -33,16 +34,19 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); + extraDelay = 1.0; if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); + teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.', 2.0); + teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.', 3.0); + extraDelay = 3.0; } if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); + teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.', 2.0); + teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.', 3.0); + extraDelay = 3.0; } commandNow++; @@ -63,24 +67,24 @@ function onCommand(cmd, rest, user, room) { user.GiveItem(itm); } - teacherMob.Command('say To see all of your characters stats, type status.'); + teacherMob.Command('say To see all of your characters stats, type status.', extraDelay+1.0); break; case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); + teacherMob.Command('say To only peek at your inventory, type inventory.', extraDelay+1.0); break; case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); + teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".', extraDelay+1.0); + teacherMob.Command('say For quick look at your progress, type experience.', extraDelay+2.0); break; case 3: teacherMob.Command('emote touches you and you feel more focused.'); user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); + teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.',extraDelay+1.0); + teacherMob.Command('say type conditions to see any statuses affecting you.', extraDelay+2.0); break; case 4: user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); + teacherMob.Command('say head south for the next lesson.', extraDelay+1.0); canGoSouth = true; room.SetLocked("south", false); break; @@ -105,8 +109,8 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); + teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.', 1.0); + teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.', 2.0); } diff --git a/_datafiles/world/empty/rooms/tutorial/902.js b/_datafiles/world/empty/rooms/tutorial/902.js index f5029f89..6ef15b8a 100644 --- a/_datafiles/world/empty/rooms/tutorial/902.js +++ b/_datafiles/world/empty/rooms/tutorial/902.js @@ -17,6 +17,7 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; // Make sure they are only doing stuff that's allowed. if ( cmd == "south" && !canGoSouth ) { @@ -31,15 +32,19 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); + + extraDelay = 1.0; if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); + teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!', 2.0); + extraDelay = 2.0; } if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); + teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.', 2.0); + teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.', 3.0); + extraDelay = 3.0; } commandNow++; @@ -65,14 +70,14 @@ function onCommand(cmd, rest, user, room) { user.GiveItem(itm); } - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); + teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.', extraDelay+1.0); break; case 1: getDummy(room); - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); + teacherMob.Command('say You may have noticed the training dummy here.', extraDelay+1.0); + teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.', extraDelay+2.0); break; case 2: // teacherMob.Command('say Head west to complete your training.'); @@ -98,14 +103,14 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); + teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!', 1.0); if ( !user.HasItemId(firstItemId) ) { itm = CreateItem(firstItemId); user.GiveItem(itm); } - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); + teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.', 2.0); } diff --git a/_datafiles/world/empty/rooms/tutorial/903.js b/_datafiles/world/empty/rooms/tutorial/903.js index 05728084..bf3dd1c3 100644 --- a/_datafiles/world/empty/rooms/tutorial/903.js +++ b/_datafiles/world/empty/rooms/tutorial/903.js @@ -16,6 +16,8 @@ function onCommand(cmd, rest, user, room) { teacherMob = getTeacher(room); + var extraDelay = 0; + fullCommand = cmd; if ( rest.length > 0 ) { fullCommand = cmd + ' ' + rest; @@ -28,11 +30,13 @@ function onCommand(cmd, rest, user, room) { if ( teach_commands[commandNow] == fullCommand ) { if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); + teacherMob.Command("say Good job!", 1.0); } else { - teacherMob.Command("say Good job! You earned it!"); + teacherMob.Command("say Good job! You earned it!", 1.0); } + extraDelay = 1.0; + commandNow++; } else { @@ -46,25 +50,24 @@ function onCommand(cmd, rest, user, room) { switch (commandNow) { case 0: - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); + teacherMob.Command('emote gestures to the graduation cap on the ground.', extraDelay+2.0); + teacherMob.Command('say type get cap to pick up the graduation cap.', extraDelay+3.0); break; case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); + teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.', extraDelay+2.0); break; case 2: - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); + teacherMob.Command('say It\'s time to say goodbye', extraDelay+1.0); + teacherMob.Command('say I\ll summon a portal to send you to where your adventure begins.', extraDelay+2.0); exits = room.GetExits(); if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); + teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!', extraDelay+3.0); room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room } - teacherMob.Command('say Enter the portal when you are ready.'); + teacherMob.Command('say Enter the portal by typing swirling portal (or just portal) when you are ready.', extraDelay+4.0); break; default: @@ -90,10 +93,10 @@ function onEnter(user, room) { teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); + teacherMob.Command('say Congratulation on getting to the end of the training course!', 1.0); + teacherMob.Command('drop cap', 2.0); + teacherMob.Command('emote gestures to the graduation cap on the ground.', 3.0); + teacherMob.Command('say type get cap to pick up the graduation cap.', 4.0); } diff --git a/_datafiles/world/empty/rooms/tutorial/910.js b/_datafiles/world/empty/rooms/tutorial/910.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/empty/rooms/tutorial/910.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/910.yaml b/_datafiles/world/empty/rooms/tutorial/910.yaml deleted file mode 100755 index 4e712182..00000000 --- a/_datafiles/world/empty/rooms/tutorial/910.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 910 -zone: Tutorial -zoneconfig: - roomid: 910 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 911 diff --git a/_datafiles/world/empty/rooms/tutorial/911.js b/_datafiles/world/empty/rooms/tutorial/911.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/empty/rooms/tutorial/911.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/911.yaml b/_datafiles/world/empty/rooms/tutorial/911.yaml deleted file mode 100755 index 642e3421..00000000 --- a/_datafiles/world/empty/rooms/tutorial/911.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 911 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 912 - lock: - difficulty: 10 - west: - roomid: 910 diff --git a/_datafiles/world/empty/rooms/tutorial/912.js b/_datafiles/world/empty/rooms/tutorial/912.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/empty/rooms/tutorial/912.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/912.yaml b/_datafiles/world/empty/rooms/tutorial/912.yaml deleted file mode 100755 index 31d0f56b..00000000 --- a/_datafiles/world/empty/rooms/tutorial/912.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 912 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 911 - lock: - difficulty: 10 - west: - roomid: 913 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/empty/rooms/tutorial/913.js b/_datafiles/world/empty/rooms/tutorial/913.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/empty/rooms/tutorial/913.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/empty/rooms/tutorial/913.yaml b/_datafiles/world/empty/rooms/tutorial/913.yaml deleted file mode 100755 index 2fb5f553..00000000 --- a/_datafiles/world/empty/rooms/tutorial/913.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 913 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/empty/rooms/tutorial/920.js b/_datafiles/world/empty/rooms/tutorial/920.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/empty/rooms/tutorial/920.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/920.yaml b/_datafiles/world/empty/rooms/tutorial/920.yaml deleted file mode 100755 index d94b8fa7..00000000 --- a/_datafiles/world/empty/rooms/tutorial/920.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 920 -zone: Tutorial -zoneconfig: - roomid: 920 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 921 diff --git a/_datafiles/world/empty/rooms/tutorial/921.js b/_datafiles/world/empty/rooms/tutorial/921.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/empty/rooms/tutorial/921.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/921.yaml b/_datafiles/world/empty/rooms/tutorial/921.yaml deleted file mode 100755 index 0fcc9173..00000000 --- a/_datafiles/world/empty/rooms/tutorial/921.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 921 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 922 - lock: - difficulty: 10 - west: - roomid: 920 diff --git a/_datafiles/world/empty/rooms/tutorial/922.js b/_datafiles/world/empty/rooms/tutorial/922.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/empty/rooms/tutorial/922.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/922.yaml b/_datafiles/world/empty/rooms/tutorial/922.yaml deleted file mode 100755 index 2025b989..00000000 --- a/_datafiles/world/empty/rooms/tutorial/922.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 922 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 921 - lock: - difficulty: 10 - west: - roomid: 923 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/empty/rooms/tutorial/923.js b/_datafiles/world/empty/rooms/tutorial/923.js deleted file mode 100644 index 05728084..00000000 --- a/_datafiles/world/empty/rooms/tutorial/923.js +++ /dev/null @@ -1,181 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/empty/rooms/tutorial/923.yaml b/_datafiles/world/empty/rooms/tutorial/923.yaml deleted file mode 100755 index be6f1f6f..00000000 --- a/_datafiles/world/empty/rooms/tutorial/923.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 923 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/empty/rooms/tutorial/930.js b/_datafiles/world/empty/rooms/tutorial/930.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/empty/rooms/tutorial/930.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/930.yaml b/_datafiles/world/empty/rooms/tutorial/930.yaml deleted file mode 100755 index c95826f1..00000000 --- a/_datafiles/world/empty/rooms/tutorial/930.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 930 -zone: Tutorial -zoneconfig: - roomid: 930 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 931 diff --git a/_datafiles/world/empty/rooms/tutorial/931.js b/_datafiles/world/empty/rooms/tutorial/931.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/empty/rooms/tutorial/931.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/931.yaml b/_datafiles/world/empty/rooms/tutorial/931.yaml deleted file mode 100755 index 4009a617..00000000 --- a/_datafiles/world/empty/rooms/tutorial/931.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 931 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 932 - lock: - difficulty: 10 - west: - roomid: 930 diff --git a/_datafiles/world/empty/rooms/tutorial/932.js b/_datafiles/world/empty/rooms/tutorial/932.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/empty/rooms/tutorial/932.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/932.yaml b/_datafiles/world/empty/rooms/tutorial/932.yaml deleted file mode 100755 index 2f521f0b..00000000 --- a/_datafiles/world/empty/rooms/tutorial/932.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 932 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 931 - lock: - difficulty: 10 - west: - roomid: 933 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/empty/rooms/tutorial/933.js b/_datafiles/world/empty/rooms/tutorial/933.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/empty/rooms/tutorial/933.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/empty/rooms/tutorial/933.yaml b/_datafiles/world/empty/rooms/tutorial/933.yaml deleted file mode 100755 index a3d99689..00000000 --- a/_datafiles/world/empty/rooms/tutorial/933.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 933 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/empty/rooms/tutorial/940.js b/_datafiles/world/empty/rooms/tutorial/940.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/empty/rooms/tutorial/940.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/940.yaml b/_datafiles/world/empty/rooms/tutorial/940.yaml deleted file mode 100755 index 3e85805f..00000000 --- a/_datafiles/world/empty/rooms/tutorial/940.yaml +++ /dev/null @@ -1,12 +0,0 @@ -roomid: 940 -zone: Tutorial -zoneconfig: - roomid: 940 -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 941 diff --git a/_datafiles/world/empty/rooms/tutorial/941.js b/_datafiles/world/empty/rooms/tutorial/941.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/empty/rooms/tutorial/941.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/941.yaml b/_datafiles/world/empty/rooms/tutorial/941.yaml deleted file mode 100755 index 72d20bd8..00000000 --- a/_datafiles/world/empty/rooms/tutorial/941.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 941 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 942 - lock: - difficulty: 10 - west: - roomid: 940 diff --git a/_datafiles/world/empty/rooms/tutorial/942.js b/_datafiles/world/empty/rooms/tutorial/942.js deleted file mode 100644 index f5029f89..00000000 --- a/_datafiles/world/empty/rooms/tutorial/942.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - // teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/942.yaml b/_datafiles/world/empty/rooms/tutorial/942.yaml deleted file mode 100755 index 1642802a..00000000 --- a/_datafiles/world/empty/rooms/tutorial/942.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 942 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 941 - lock: - difficulty: 10 - west: - roomid: 943 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/empty/rooms/tutorial/943.js b/_datafiles/world/empty/rooms/tutorial/943.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/empty/rooms/tutorial/943.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/empty/rooms/tutorial/943.yaml b/_datafiles/world/empty/rooms/tutorial/943.yaml deleted file mode 100755 index c6b4dce1..00000000 --- a/_datafiles/world/empty/rooms/tutorial/943.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 943 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/_datafiles/world/empty/rooms/tutorial/990.js b/_datafiles/world/empty/rooms/tutorial/990.js deleted file mode 100644 index 4962d844..00000000 --- a/_datafiles/world/empty/rooms/tutorial/990.js +++ /dev/null @@ -1,175 +0,0 @@ - - -const allowed_commands = ["help", "broadcast"]; -const teach_commands = ["look", "look orb", "look", "look east", "east"]; -const teacherMobId = 57; -const teacherName = "Orb of Vision"; - -var commandNow = 0; // Which command they are on -var canGoEast = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "east" && !canGoEast ) { - teacherMob.Command("say Not so hasty! Lets finish the basics before you leave this area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "look orb" ) { - teacherMob.Command('say As you can see, looking at me shows you a description and some information about what I\'m carrying.'); - } - - if ( cmd == "look east" ) { - teacherMob.Command('say Looking into exits like that shows you what (or who) is in a room before you visit it.'); - teacherMob.Command('say Later when you find objects, you can look at them in the same manner.'); - teacherMob.Command('say It\'s always worth trying to look at something you\'re curious about, just in case.'); - teacherMob.Command('emote considers for a moment.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - teacherMob.Command('say The first thing you need to learn is how to inspect your surroundings'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); - break; - case 1: - teacherMob.Command('say You can also look at creatures or people in the room.'); - teacherMob.Command('say type look orb to look at me, ' + teacherMob.GetCharacterName(true) + '.'); - break; - case 2: - teacherMob.Command('say Try the look command again, but this time, pay attention to any Exits.'); - break; - case 3: - teacherMob.Command('say Did you notice there is an exit to the east?'); - teacherMob.Command('say type look east to look into the east room.'); - break; - case 4: - canGoEast = true; - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - default: - teacherMob.Command('say It\'s time to move on to the next thing you\'ll learn about.'); - teacherMob.Command('say type east to travel through the east exit.'); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - teacherMob = getTeacher(room); - canGoEast = false; - commandNow = 0; - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Welcome to the Newbie School!'); - teacherMob.Command('say I\'ll give you some tips to help you get started.'); - teacherMob.Command('say In this area you\'ll learn the basics of inspecting your environment with the look command.'); - teacherMob.Command('say type look and hit enter to see a description of the area you are in.'); -} - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); -} - - - -function onLoad(room) { - canGoEast = false; - commandNow = 0; -} - - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/990.yaml b/_datafiles/world/empty/rooms/tutorial/990.yaml deleted file mode 100755 index 15cfb99e..00000000 --- a/_datafiles/world/empty/rooms/tutorial/990.yaml +++ /dev/null @@ -1,10 +0,0 @@ -roomid: 990 -zone: Tutorial -title: Learning to Look -description: You are at the Newbie School. Here you will learn the very basics of - how to navigate and interact with the world. Pay attention, because once you complete - this area, you will be all on your own. Currently you are learning about looking - around. -exits: - east: - roomid: 991 diff --git a/_datafiles/world/empty/rooms/tutorial/991.js b/_datafiles/world/empty/rooms/tutorial/991.js deleted file mode 100644 index a932ac79..00000000 --- a/_datafiles/world/empty/rooms/tutorial/991.js +++ /dev/null @@ -1,181 +0,0 @@ - - -const allowed_commands = ["help", "broadcast", "look"]; -const teach_commands = ["status", "inventory", "experience", "conditions", "south"]; -const teacherMobId = 57; -const teacherName = "Orb of Reflection"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on -var canGoSouth = false; - - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "status" ) { - teacherMob.Command('say You can see how much gold you carry, your Level, and even attributes like Strength and Smarts.'); - teacherMob.Command('say It\'s a lot of information, but you quickly learn to only pay attention to the important stuff.'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say To see all of your characters stats, type status.'); - break; - case 1: - teacherMob.Command('say To only peek at your inventory, type inventory.'); - break; - case 2: - teacherMob.Command('say As you solve quests and defeat enemies in combat, you\'ll gain experience points and your character will "Level up".'); - teacherMob.Command('say For quick look at your progress, type experience.'); - break; - case 3: - teacherMob.Command('emote touches you and you feel more focused.'); - user.GiveBuff(32, "training"); - teacherMob.Command('say Sometimes you might become afflicted with a condition. Conditions can have good or bad effects.'); - teacherMob.Command('say type conditions to see any statuses affecting you.'); - break; - case 4: - user.GiveBuff(-32, "training"); - teacherMob.Command('say head south for the next lesson.'); - canGoSouth = true; - room.SetLocked("south", false); - break; - default: - room.SetLocked("south", false); - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("west", true); - - sendWorkingCommands(user); - - teacherMob = getTeacher(room); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Hi! I\'m here to teach you about inspecting your characters information.'); - teacherMob.Command('say To get a detailed view of a LOT of information all at once, type status and hit enter.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/991.yaml b/_datafiles/world/empty/rooms/tutorial/991.yaml deleted file mode 100755 index b923ec64..00000000 --- a/_datafiles/world/empty/rooms/tutorial/991.yaml +++ /dev/null @@ -1,13 +0,0 @@ -roomid: 991 -zone: Tutorial -title: Learning about You -description: In this room you will learn how to inspect your character. Your status, - conditions, and a few other useful bits of information are only a few keystrokes - away. -exits: - south: - roomid: 992 - lock: - difficulty: 10 - west: - roomid: 990 diff --git a/_datafiles/world/empty/rooms/tutorial/992.js b/_datafiles/world/empty/rooms/tutorial/992.js deleted file mode 100644 index ee24ac62..00000000 --- a/_datafiles/world/empty/rooms/tutorial/992.js +++ /dev/null @@ -1,213 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions"]; -const teach_commands = ["equip stick", "attack dummy", "west"]; -const teacherMobId = 57; -const dummyMobId = 58; -const teacherName = "Orb of Violence"; -const firstItemId = 10001; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - // Make sure they are only doing stuff that's allowed. - - if ( cmd == "south" && !canGoSouth ) { - teacherMob.Command("say Not so hasty! Lets finish up here before you leave the area."); - ignoreCommand = true; - } - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - teacherMob.Command("say Good job!"); - - if ( cmd == "equip stick" ) { - teacherMob.Command('say Check it out! If you type status you\'ll see the stick is equipped!'); - } - - if ( cmd == "inventory" ) { - teacherMob.Command('say Hmm, it doesn\'t look like you\'re carrying much other than that sharp stick.'); - teacherMob.Command('say Remember, you can look at stuff you\'re carrying any time you want.'); - } - - commandNow++; - - if ( cmd == "attack dummy" ) { - return false; - } - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); - break; - case 1: - - getDummy(room); - - teacherMob.Command('say You may have noticed the training dummy here.'); - teacherMob.Command('say Go ahead and engage in combat by typing attack dummy.'); - break; - case 2: - //teacherMob.Command('say Head west to complete your training.'); - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - room.SetLocked("north", true); - - teacherMob = getTeacher(room); - getDummy(room); - - sendWorkingCommands(user); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say It looks like it\'s time for the most dangerous part of your lesson!'); - - if ( !user.HasItemId(firstItemId) ) { - itm = CreateItem(firstItemId); - user.GiveItem(itm); - } - - teacherMob.Command('say Go ahead and equip that sharp stick you\'ve got. Type equip stick.'); -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - destroyDummy(room); - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function getDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - return mobActor; - } - } - - return room.SpawnMob(dummyMobId); -} - -function destroyDummy(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == dummyMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} diff --git a/_datafiles/world/empty/rooms/tutorial/992.yaml b/_datafiles/world/empty/rooms/tutorial/992.yaml deleted file mode 100755 index 59ebb444..00000000 --- a/_datafiles/world/empty/rooms/tutorial/992.yaml +++ /dev/null @@ -1,14 +0,0 @@ -roomid: 992 -zone: Tutorial -title: Learning to Fight -description: This is a room for basic fight training. Here you can learn how to engage - in combat. -exits: - north: - roomid: 991 - lock: - difficulty: 10 - west: - roomid: 993 -mutators: -- mutatorid: training-combat diff --git a/_datafiles/world/empty/rooms/tutorial/993.js b/_datafiles/world/empty/rooms/tutorial/993.js deleted file mode 100644 index a674cbed..00000000 --- a/_datafiles/world/empty/rooms/tutorial/993.js +++ /dev/null @@ -1,182 +0,0 @@ - -const allowed_commands = ["help", "broadcast", "look", "status", "inventory", "experience", "conditions", "equip"]; -const teach_commands = ["get cap", "equip cap", "portal"]; -const teacherMobId = 57; -const teacherName = "Orb of Graduation"; -const capItemId = 20043; - -var commandNow = 0; // Which command they are on - - - -// Generic Command Handler -function onCommand(cmd, rest, user, room) { - - ignoreCommand = false; - - teacherMob = getTeacher(room); - - fullCommand = cmd; - if ( rest.length > 0 ) { - fullCommand = cmd + ' ' + rest; - } - - if ( commandNow >= 2 ) { - return false; - } - - if ( teach_commands[commandNow] == fullCommand ) { - - if ( fullCommand == "equip cap" ) { - teacherMob.Command("say Good job!"); - } else { - teacherMob.Command("say Good job! You earned it!"); - } - - commandNow++; - - } else { - - if ( allowed_commands.includes(cmd) || teach_commands.slice(0, commandNow).includes(cmd) ) { - return false; - } - - ignoreCommand = true; - } - - switch (commandNow) { - case 0: - - teacherMob.Command('emote gestures to the graduation cap on the ground.'); - teacherMob.Command('say type get cap to pick up the graduation cap.'); - break; - case 1: - - teacherMob.Command('say Go ahead and wear the graduation cap by typing equip cap.'); - break; - case 2: - - teacherMob.Command('say It\'s time to say goodbye'); - teacherMob.Command('say I\ll summon a portal to send you to the heart of Frostfang city, where your adventure begins.'); - - exits = room.GetExits(); - if ( !exits.portal ) { - teacherMob.Command('emote glows intensely, and a ' + UtilApplyColorPattern('swirling portal', 'pink') + ' appears!'); - room.AddTemporaryExit('swirling portal', ':pink', 0, 9000); // RoomId 0 is an alias for start room - } - - teacherMob.Command('say Enter the portal when you are ready.'); - - break; - default: - break; - } - - return ignoreCommand; -} - - - - -// If there is no book here, add the book item -function onEnter(user, room) { - - teacherMob = getTeacher(room); - clearGroundItems(room); - - sendWorkingCommands(user); - - itm = CreateItem(capItemId); - teacherMob.GiveItem(itm); - - teacherMob.Command('emote appears in a ' + UtilApplyColorPattern("flash of light!", "glowing")); - - teacherMob.Command('say Congratulation on getting to the end of the training course!'); - teacherMob.Command('drop cap'); - teacherMob.Command('emote gestures to the graduation cap on the ground.', 15); - teacherMob.Command('say type get cap to pick up the graduation cap.', 15); - -} - - - -function onExit(user , room) { - // Destroy the guide (cleanup) - destroyTeacher(room); - - canGoSouth = false; - commandNow = 0; -} - - - -function onLoad(room) { - canGoSouth = false; - commandNow = 0; -} - - -function getTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - return mobActor; - } - } - - mobActor = room.SpawnMob(teacherMobId); - mobActor.SetCharacterName(teacherName); - - return mobActor; -} - -function destroyTeacher(room) { - - var mobActor = null; - - mobIds = room.GetMobs(); - - for ( var i in mobIds ) { - mobActor = GetMob(mobIds[i]); - if ( mobActor.MobTypeId() == teacherMobId ) { - mobActor.Command(`suicide vanish`); - } - } -} - - -function sendWorkingCommands(user) { - - ac = []; - unlockedCommands = teach_commands.slice(0, commandNow); - - for (var i in allowed_commands ) { - ac.push(allowed_commands[i]); - } - - for ( i in unlockedCommands ) { - ac.push(unlockedCommands[i]); - } - - user.SendText(""); - user.SendText(""); - user.SendText(' NOTE: Most commands have been DISABLED and WILL NOT WORK until you COMPLETE THIS TUTORIAL!'); - //user.SendText(' The commands currently available are: '+ac.join(', ')+''); - user.SendText(""); - user.SendText(""); - -} - -function clearGroundItems(room) { - - allGroundItems = room.GetItems(); - for ( var i in allGroundItems ) { - room.DestroyItem(allGroundItems[i]); - } - -} \ No newline at end of file diff --git a/_datafiles/world/empty/rooms/tutorial/993.yaml b/_datafiles/world/empty/rooms/tutorial/993.yaml deleted file mode 100755 index 3c48843a..00000000 --- a/_datafiles/world/empty/rooms/tutorial/993.yaml +++ /dev/null @@ -1,6 +0,0 @@ -roomid: 993 -zone: Tutorial -title: Training Complete -description: Welcome to the graduation room! You've completed the basic training and - are ready to embark into the wide world. -exits: {} diff --git a/internal/configs/config.specialrooms.go b/internal/configs/config.specialrooms.go index 1989e29e..8e7ac34f 100644 --- a/internal/configs/config.specialrooms.go +++ b/internal/configs/config.specialrooms.go @@ -1,16 +1,16 @@ package configs type SpecialRooms struct { - StartRoom ConfigInt `yaml:"StartRoom"` // Default starting room. - DeathRecoveryRoom ConfigInt `yaml:"DeathRecoveryRoom"` // Recovery room after dying. - TutorialStartRooms ConfigSliceString `yaml:"TutorialStartRooms"` // List of all rooms that can be used to begin the tutorial process + StartRoom ConfigInt `yaml:"StartRoom"` // Default starting room. + DeathRecoveryRoom ConfigInt `yaml:"DeathRecoveryRoom"` // Recovery room after dying. + TutorialRooms ConfigSliceString `yaml:"TutorialRooms"` // List of all rooms that can be used to begin the tutorial process } func (s *SpecialRooms) Validate() { // Ignore StartRoom // Ignore DeathRecoveryRoom - // Ignore TutorialStartRooms + // Ignore TutorialRooms } diff --git a/internal/hooks/PlayerDespawn_HandleLeave.go b/internal/hooks/PlayerDespawn_HandleLeave.go index fbac5f97..a894e5c4 100644 --- a/internal/hooks/PlayerDespawn_HandleLeave.go +++ b/internal/hooks/PlayerDespawn_HandleLeave.go @@ -2,7 +2,9 @@ package hooks import ( "fmt" + "strconv" + "github.com/GoMudEngine/GoMud/internal/configs" "github.com/GoMudEngine/GoMud/internal/connections" "github.com/GoMudEngine/GoMud/internal/events" "github.com/GoMudEngine/GoMud/internal/mobs" @@ -65,5 +67,17 @@ func HandleLeave(e events.Event) events.ListenerReturn { } connections.Remove(connId) + specialRooms := configs.GetSpecialRoomsConfig() + testRoomId := rooms.GetOriginalRoom(user.Character.RoomId) + for i := range specialRooms.TutorialRooms { + roomId, _ := strconv.Atoi(specialRooms.TutorialRooms[i]) + if roomId == testRoomId { + user.Character.RoomId = -1 + break + } + } + + users.SaveUser(*user) + return events.Continue } diff --git a/internal/hooks/RoomChange_CleanupEphemeralRooms.go b/internal/hooks/RoomChange_CleanupEphemeralRooms.go new file mode 100644 index 00000000..5cd3f63d --- /dev/null +++ b/internal/hooks/RoomChange_CleanupEphemeralRooms.go @@ -0,0 +1,31 @@ +package hooks + +import ( + "github.com/GoMudEngine/GoMud/internal/events" + "github.com/GoMudEngine/GoMud/internal/rooms" + "github.com/GoMudEngine/GoMud/internal/scripting" +) + +// +// RoomChangeHandler waits for RoomChange events +// Also sends music changes out +// + +func CleanupEphemeralRooms(e events.Event) events.ListenerReturn { + + evt := e.(events.RoomChange) + + // If this isn't a user changing rooms, just pass it along. + if evt.UserId == 0 { + return events.Continue + } + + if rooms.IsEphemeralRoomId(evt.FromRoomId) { + removedRoomIds := rooms.TryEphemeralCleanup(evt.FromRoomId) + if len(removedRoomIds) > 0 { + scripting.PruneRoomVMs(removedRoomIds...) + } + } + + return events.Continue +} diff --git a/internal/hooks/RoomChange_SpawnGuide.go b/internal/hooks/RoomChange_SpawnGuide.go new file mode 100644 index 00000000..53fb97cb --- /dev/null +++ b/internal/hooks/RoomChange_SpawnGuide.go @@ -0,0 +1,96 @@ +package hooks + +import ( + "fmt" + + "github.com/GoMudEngine/GoMud/internal/characters" + "github.com/GoMudEngine/GoMud/internal/configs" + "github.com/GoMudEngine/GoMud/internal/events" + "github.com/GoMudEngine/GoMud/internal/mobs" + "github.com/GoMudEngine/GoMud/internal/rooms" + "github.com/GoMudEngine/GoMud/internal/users" + "github.com/GoMudEngine/GoMud/internal/util" +) + +// +// RoomChangeHandler waits for RoomChange events +// Also sends music changes out +// + +const guideMobId = 38 + +func SpawnGuide(e events.Event) events.ListenerReturn { + + evt := e.(events.RoomChange) + + // If this isn't a user changing rooms, just pass it along. + if evt.UserId == 0 { + return events.Continue + } + + if evt.ToRoomId < 1 { + return events.Continue + } + + user := users.GetByUserId(evt.UserId) + if user.Character.Level > 5 { + return events.Continue + } + + fromRoomOriginal := rooms.GetOriginalRoom(evt.FromRoomId) + if fromRoomOriginal >= 900 || fromRoomOriginal <= 999 { + return events.Continue + } + + toRoomOriginal := rooms.GetOriginalRoom(evt.FromRoomId) + if toRoomOriginal >= 900 || toRoomOriginal <= 999 { + return events.Continue + } + + roundNow := util.GetRoundCount() + + var lastGuideRound uint64 = 0 + tmpLGR := user.GetTempData(`lastGuideRound`) + if tmpLGRUint, ok := tmpLGR.(uint64); ok { + lastGuideRound = tmpLGRUint + } + + if (roundNow - lastGuideRound) < uint64(configs.GetTimingConfig().SecondsToRounds(300)) { + return events.Continue + } + + for _, miid := range user.Character.GetCharmIds() { + if testMob := mobs.GetInstance(miid); testMob != nil && testMob.MobId == guideMobId { + return events.Continue // already have the mob, we can skip this. + } + } + + // Get the new room + room := rooms.LoadRoom(evt.ToRoomId) + + // Create the mob + guideMob := mobs.NewMobById(guideMobId, 1) + + // Give them a clearly identifying (however long) name + guideMob.Character.Name = fmt.Sprintf(`%s's Guide`, user.Character.Name) + + // Add the guide to the room + room.AddMob(guideMob.InstanceId) + + // Charm the mob + guideMob.Character.Charm(evt.UserId, characters.CharmPermanent, characters.CharmExpiredDespawn) + + // Track it + user.Character.TrackCharmed(guideMob.InstanceId, true) + + room.SendText(`` + guideMob.Character.Name + ` appears in a shower of sparks!`) + + guideMob.Command(`sayto ` + user.ShorthandId() + ` I'll be here to help protect you while you learn the ropes.`) + guideMob.Command(`sayto ` + user.ShorthandId() + ` I can create a portal to take us back to Town Square any time. Just ask me about it.`) + + user.SendText(`Your guide will try and stick around until you reach level 5.`) + + user.SetTempData(`lastGuideRound`, roundNow) + + return events.Continue +} diff --git a/internal/hooks/hooks.go b/internal/hooks/hooks.go index 1171d772..3061c397 100644 --- a/internal/hooks/hooks.go +++ b/internal/hooks/hooks.go @@ -12,6 +12,8 @@ func RegisterListeners() { // RoomChange Listeners events.RegisterListener(events.RoomChange{}, LocationMusicChange) + events.RegisterListener(events.RoomChange{}, CleanupEphemeralRooms) + events.RegisterListener(events.RoomChange{}, SpawnGuide) // NewRound Listeners events.RegisterListener(events.NewRound{}, PruneVMs) diff --git a/internal/mapper/mapper.go b/internal/mapper/mapper.go index 1e6d9bc1..57668cbc 100644 --- a/internal/mapper/mapper.go +++ b/internal/mapper/mapper.go @@ -877,7 +877,7 @@ func GetMapper(roomId int, forceRefresh ...bool) *mapper { } m.Start() - mudlog.Info("New Mapper", "zone", zoneName, "time taken", time.Since(tStart)) + mudlog.Info("New Mapper", "zone", zoneName, "size", len(m.crawledRooms), "time taken", time.Since(tStart)) roomIdToMapperCache[roomId] = zoneName @@ -903,3 +903,101 @@ func PreCacheMaps() { GetMapper(roomId) } } + +///////////////////////////////////////////// +// EXPERIMENTAL +///////////////////////////////////////////// + +/* +replacements, _ := rooms.CreateEphemeralRoomIds(64, 65, 66) + +m := mapper.GetMapper(64) + +mNew := m.GetCopy() +mNew.OverrideRoomIds(replacements) +mapper.AddMapper(mNew, replacements[64]) +*/ + +func AddMapper(m *mapper, lookupRoomId int) { + + if zoneName, ok := roomIdToMapperCache[lookupRoomId]; ok { + mapperZoneCache[zoneName] = m + return + } + + room := rooms.LoadRoom(lookupRoomId) + zoneName := room.Zone + `-` + strconv.Itoa(lookupRoomId) + + for _, crawledRoomId := range m.CrawledRoomIds() { + if _, ok := roomIdToMapperCache[crawledRoomId]; !ok { + + roomIdToMapperCache[crawledRoomId] = zoneName + } + } + + mapperZoneCache[zoneName] = m + +} + +func (m *mapper) GetCopy() *mapper { + + mNew := &mapper{ + rootRoomId: m.rootRoomId, + crawledRooms: make(map[int]*mapNode, len(m.crawledRooms)), + roomGrid: RoomGrid{ + rooms: [][][]*mapNode{}, + }, + } + + mNew.roomGrid.size = m.roomGrid.size + mNew.roomGrid.roomOffset = m.roomGrid.roomOffset + mNew.roomGrid.rooms = make([][][]*mapNode, len(m.roomGrid.rooms)) + for z := 0; z < len(m.roomGrid.rooms); z++ { + mNew.roomGrid.rooms[z] = make([][]*mapNode, len(m.roomGrid.rooms[z])) + for y := 0; y < len(m.roomGrid.rooms[z]); y++ { + mNew.roomGrid.rooms[z][y] = make([]*mapNode, len(m.roomGrid.rooms[z][y])) + for x := 0; x < len(m.roomGrid.rooms[z][y]); x++ { + if m.roomGrid.rooms[z][y][x] == nil { + continue + } + nodeCopy := *(m.roomGrid.rooms[z][y][x]) + mNew.roomGrid.rooms[z][y][x] = &nodeCopy + mNew.crawledRooms[nodeCopy.RoomId] = &nodeCopy + } + } + } + + return mNew +} + +func (m *mapper) OverrideRoomIds(replacements map[int]int) { + + for oldRoomId, newRoomId := range replacements { + if m.rootRoomId == oldRoomId { + m.rootRoomId = newRoomId + } + + currentNode, ok := m.crawledRooms[oldRoomId] + if !ok { + continue + } + + for _, node := range m.crawledRooms { + + for exitName, exitInfo := range node.Exits { + if exitInfo.RoomId == oldRoomId { + exitInfo.RoomId = newRoomId + node.Exits[exitName] = exitInfo + } + } + + if node.RoomId == oldRoomId { + node.RoomId = newRoomId + } + } + + delete(m.crawledRooms, oldRoomId) + m.crawledRooms[newRoomId] = currentNode + } + +} diff --git a/internal/rooms/ephemeral.go b/internal/rooms/ephemeral.go new file mode 100644 index 00000000..dfd163bb --- /dev/null +++ b/internal/rooms/ephemeral.go @@ -0,0 +1,232 @@ +package rooms + +import ( + "errors" + "fmt" + "math" + "time" + "unsafe" + + "github.com/GoMudEngine/GoMud/internal/mudlog" + "github.com/GoMudEngine/GoMud/internal/util" +) + +const ( + ephemeralChunksLimit = 100 // The maximum number of ephemeral chunks that can be created + ephemeralChunkSize = 250 // The maximum quantity of ephemeral room's that can be copied/created in a given chunk. + roomIdMin32 = 1000000000 // 1,000,000,000 + roomIdMin64 = 1000000000000 // 1,000,000,000,000 +) + +var ( + ephemeralRoomIdMinimum = roomIdMin32 // 1,000,000,000 is assuming 32 bit. the init() function may override this value. + ephemeralRoomChunks = [ephemeralChunksLimit][]int{} // map of ranges to actual rooms. If empty, slot is available. + originalRoomIdLookups = map[int]int{} // a map of ephemeralId's to their original RoomId's, for special purposes + // errors + errNoRoomIdsProvided = errors.New(`no RoomId's were provided`) + errRoomNotFound = errors.New(`the requested RoomId wasn't found`) + errEphemeralChunkLimit = fmt.Errorf(`the ephemeral chunk limit of %d has been reached.`, ephemeralChunksLimit) + errEphemeralRoomLimit = fmt.Errorf(`the ephemeral room request limit of %d is exceeded.`, ephemeralChunkSize) + errNonUniqueRoomId = errors.New(`a RoomId has been provided more than once. they must all be unique`) +) + +func GetChunkCount() int { + result := 0 + for i := 0; i < ephemeralChunksLimit; i++ { + if len(ephemeralRoomChunks[i]) > 0 { + result++ + } + } + return result +} + +// accepts RoomId's as arguments, and creates ephemeral copies of them, returning the new ID's of the copies. +func CreateEphemeralRoomIds(roomIds ...int) (map[int]int, error) { + + ephemeralRooms := map[int]int{} + + if len(roomIds) == 0 { + return ephemeralRooms, errNoRoomIdsProvided + } + + if len(roomIds) > ephemeralChunkSize { + return ephemeralRooms, errEphemeralRoomLimit + } + + // Make sure that all values in the roomIds slice are unique. + roomIdReplacements := map[int]int{} // original=>ephemeral replacements + for _, roomId := range roomIds { + if _, ok := roomIdReplacements[roomId]; ok { + return ephemeralRooms, errNonUniqueRoomId + } + roomIdReplacements[roomId] = 0 + } + + // First reserve the chunk + chunkId := -1 + for i := 0; i < ephemeralChunksLimit; i++ { + if len(ephemeralRoomChunks[i]) == 0 { + chunkId = i + break + } + } + + ephemeralRoomIds := []int{} + for idx, roomId := range roomIds { + // Load only data from the template + + if roomId == 0 { + continue + } + + room := LoadRoomTemplate(roomId) + if room == nil { + continue + } + + // Don't allow an ephemeral copy to identify as a zone root. + if room.ZoneConfig.RoomId == room.RoomId { + room.ZoneConfig = ZoneConfig{} + } + + room.RoomId = ephemeralRoomIdMinimum + (chunkId * ephemeralChunkSize) + idx + + // Save the original room ID in case we need it at some point + originalRoomIdLookups[room.RoomId] = roomId + + // Temporarily track what the original room has been copied to. + roomIdReplacements[roomId] = room.RoomId + + addRoomToMemory(room) + + ephemeralRooms[roomId] = room.RoomId + ephemeralRoomIds = append(ephemeralRoomIds, room.RoomId) + } + + // Replace references to original RoomId's with new Ephemeral ones + for _, roomId := range ephemeralRoomIds { + room := LoadRoom(roomId) + if room == nil { + continue + } + + for exitName, exitInfo := range room.Exits { + if replacementRoomId, ok := roomIdReplacements[exitInfo.RoomId]; ok { + exitInfo.RoomId = replacementRoomId + room.Exits[exitName] = exitInfo + } + } + + } + + ephemeralRoomChunks[chunkId] = ephemeralRoomIds + + mudlog.Info("CreateEphemeral...()", + "created", len(ephemeralRoomIds), + "chunkId", chunkId, + "Ephemeral RoomIds", fmt.Sprintf("%d - %d", ephemeralRoomIds[0], ephemeralRoomIds[len(ephemeralRoomIds)-1]), + "Chunks Remaining", GetChunkCount()) + + return ephemeralRooms, nil +} + +// accepts RoomId's as arguments, and creates ephemeral copies of them, returning the new ID's of the copies. +func CreateEphemeralZone(zoneName string) (map[int]int, error) { + + roomIds := make([]int, len(roomManager.zones[zoneName].RoomIds)) + + idx := 0 + for roomId, _ := range roomManager.zones[zoneName].RoomIds { + roomIds[idx] = roomId + idx++ + } + + return CreateEphemeralRoomIds(roomIds...) +} + +func IsEphemeralRoomId(roomId int) bool { + return roomId >= ephemeralRoomIdMinimum +} + +func TryEphemeralCleanup(ephemeralRoomId int) []int { + + chunkId := int(math.Floor(float64(ephemeralRoomId-ephemeralRoomIdMinimum) / ephemeralChunkSize)) + + for _, ephemeralRoomId := range ephemeralRoomChunks[chunkId] { + + room := LoadRoom(ephemeralRoomId) + if room == nil { + continue + } + + if len(room.players) > 0 { + return []int{} + } + } + + deletedMin := 0 + deletedMax := 0 + + deletedRoomIds := make([]int, len(ephemeralRoomChunks[chunkId])) + + for i, ephemeralRoomId := range ephemeralRoomChunks[chunkId] { + + deletedRoomIds[i] = ephemeralRoomId + + if deletedMin == 0 || ephemeralRoomId < deletedMin { + deletedMin = ephemeralRoomId + } + if deletedMax == 0 || ephemeralRoomId > deletedMax { + deletedMax = ephemeralRoomId + } + + room := LoadRoom(ephemeralRoomId) + if room == nil { + continue + } + + delete(originalRoomIdLookups, room.RoomId) + removeRoomFromMemory(room) + } + + ephemeralRoomChunks[chunkId] = []int{} + + mudlog.Info("TryEphemeralCleanup", "deleted", len(deletedRoomIds), "chunkId", chunkId, "RoomIds", fmt.Sprintf("%d - %d", deletedMin, deletedMax), "Chunks Remaining", GetChunkCount()) + + return deletedRoomIds +} + +// All this does is unload chunks with no players in them. +func EphemeralRoomMaintenance() []int { + start := time.Now() + defer func() { + util.TrackTime(`EphemeralRoomMaintenance()`, time.Since(start).Seconds()) + }() + + // If no lookups are stored, then there can't be anything in the chunks (unless we messed up) + if len(originalRoomIdLookups) == 0 { + return []int{} + } + + for i := 0; i < ephemeralChunksLimit; i++ { + if len(ephemeralRoomChunks[i]) > 0 { + return TryEphemeralCleanup(ephemeralRoomChunks[i][0]) + } + } + return []int{} +} + +func GetOriginalRoom(roomId int) int { + if roomId < ephemeralRoomIdMinimum { + return roomId + } + return originalRoomIdLookups[roomId] +} + +func init() { + if unsafe.Sizeof(int(0))*8 == 64 { + ephemeralRoomIdMinimum = roomIdMin64 + } else { + ephemeralRoomIdMinimum = roomIdMin32 + } +} diff --git a/internal/rooms/roommanager.go b/internal/rooms/roommanager.go index d3aad38d..ab799c10 100644 --- a/internal/rooms/roommanager.go +++ b/internal/rooms/roommanager.go @@ -11,7 +11,6 @@ import ( "time" "github.com/GoMudEngine/GoMud/internal/buffs" - "github.com/GoMudEngine/GoMud/internal/characters" "github.com/GoMudEngine/GoMud/internal/configs" "github.com/GoMudEngine/GoMud/internal/events" "github.com/GoMudEngine/GoMud/internal/exit" @@ -153,7 +152,7 @@ func GetZonesWithMutators() ([]string, []int) { return zNames, rootRoomIds } -func RoomMaintenance() bool { +func RoomMaintenance() []int { start := time.Now() defer func() { util.TrackTime(`RoomMaintenance()`, time.Since(start).Seconds()) @@ -171,16 +170,12 @@ func RoomMaintenance() bool { allowedUnloadCt = 0 } - roomsUpdated := false for _, room := range roomManager.rooms { - if visitorCt := room.PruneVisitors(); visitorCt > 0 { - roomsUpdated = true - } + room.PruneVisitors() // Notify that room that something happened to the sign? if prunedSigns := room.PruneSigns(); len(prunedSigns) > 0 { - roomsUpdated = true if roomPlayers := room.GetPlayers(); len(roomPlayers) > 0 { for _, userId := range roomPlayers { @@ -201,7 +196,6 @@ func RoomMaintenance() bool { // Notify the room that the temp exits disappeared? if prunedExits := room.PruneTemporaryExits(); len(prunedExits) > 0 { - roomsUpdated = true if roomPlayers := room.GetPlayers(); len(roomPlayers) > 0 { for _, exit := range prunedExits { @@ -215,7 +209,7 @@ func RoomMaintenance() bool { } // Consider unloading rooms from memory? - if allowedUnloadCt > 0 { + if allowedUnloadCt > 0 && !room.IsEphemeral() { if room.lastVisited < unloadRoundThreshold { unloadRooms = append(unloadRooms, room) allowedUnloadCt-- @@ -224,14 +218,15 @@ func RoomMaintenance() bool { } + removedRoomIds := make([]int, len(unloadRooms)) if len(unloadRooms) > 0 { - for _, room := range unloadRooms { + for i, room := range unloadRooms { removeRoomFromMemory(room) + removedRoomIds[i] = room.RoomId } - roomsUpdated = true } - return roomsUpdated + return removedRoomIds } func GetAllZoneNames() []string { @@ -330,62 +325,12 @@ func MoveToRoom(userId int, toRoomId int, isSpawn ...bool) error { // Done adding mutator buffs // - playerCt := newRoom.AddPlayer(userId) - roomManager.roomsWithUsers[newRoom.RoomId] = playerCt - - formerRoomId := user.Character.RoomId user.Character.RoomId = newRoom.RoomId user.Character.Zone = newRoom.Zone user.Character.RememberRoom(newRoom.RoomId) // Mark this room as remembered. - roundNow := util.GetRoundCount() - - if user.Character.Level < 5 && toRoomId > -1 { - - if formerRoomId > 0 && (formerRoomId < 900 || formerRoomId > 999) { - - var lastGuideRound uint64 = 0 - tmpLGR := user.GetTempData(`lastGuideRound`) - if tmpLGRUint, ok := tmpLGR.(uint64); ok { - lastGuideRound = tmpLGRUint - } - - spawnGuide := false - if (roundNow - lastGuideRound) > uint64(configs.GetTimingConfig().SecondsToRounds(300)) { - spawnGuide = true - } - - if spawnGuide { - for _, miid := range user.Character.GetCharmIds() { - if testMob := mobs.GetInstance(miid); testMob != nil && testMob.MobId == 38 { - spawnGuide = false - break - } - } - } - - if spawnGuide { - - room := LoadRoom(toRoomId) - guideMob := mobs.NewMobById(38, 1) - guideMob.Character.Name = fmt.Sprintf(`%s's Guide`, user.Character.Name) - room.AddMob(guideMob.InstanceId) - guideMob.Character.Charm(userId, characters.CharmPermanent, characters.CharmExpiredDespawn) - // Track it - user.Character.TrackCharmed(guideMob.InstanceId, true) - - room.SendText(`` + guideMob.Character.Name + ` appears in a shower of sparks!`) - - guideMob.Command(`sayto ` + user.ShorthandId() + ` I'll be here to help protect you while you learn the ropes.`) - guideMob.Command(`sayto ` + user.ShorthandId() + ` I can create a portal to take us back to Town Square any time. Just ask me about it.`) - - user.SendText(`Your guide will try and stick around until you reach level 5.`) - - user.SetTempData(`lastGuideRound`, roundNow) - - } - } - } + playerCt := newRoom.AddPlayer(userId) + roomManager.roomsWithUsers[newRoom.RoomId] = playerCt events.AddToQueue(events.RoomChange{ UserId: userId, @@ -521,6 +466,7 @@ func removeRoomFromMemory(r *Room) { } SaveRoomInstance(*room) + delete(roomManager.rooms, r.RoomId) } @@ -551,7 +497,7 @@ func addRoomToMemory(room *Room, forceOverWrite ...bool) error { } // Track whatever the last room id created is so we know what to number the next one. - if room.RoomId >= GetNextRoomId() { + if room.RoomId < ephemeralRoomIdMinimum && room.RoomId >= GetNextRoomId() { SetNextRoomId(room.RoomId + 1) } @@ -598,7 +544,6 @@ func GetZoneConfig(zone string) *ZoneConfig { } func IsRoomLoaded(roomId int) bool { - _, ok := roomManager.rooms[roomId] return ok } diff --git a/internal/rooms/rooms.go b/internal/rooms/rooms.go index 3e255b05..9c5c09f8 100644 --- a/internal/rooms/rooms.go +++ b/internal/rooms/rooms.go @@ -122,6 +122,10 @@ func NewRoom(zone string) *Room { return r } +func (r *Room) IsEphemeral() bool { + return r.RoomId >= ephemeralRoomIdMinimum +} + // 0 = none (darkness). 1 = can see this room. 2 = can see this room and all exits func (r *Room) GetVisibility() int { @@ -388,7 +392,6 @@ func (r *Room) GetScript() string { } func (r *Room) GetScriptPath() string { - // Load any script for the room return strings.Replace(configs.GetFilePathsConfig().DataFiles.String()+`/rooms/`+r.Filepath(), `.yaml`, `.js`, 1) } @@ -2240,12 +2243,12 @@ func (r *Room) GetMapSymbol() string { } func (r *Room) Filename() string { - return fmt.Sprintf("%d.yaml", r.RoomId) + return fmt.Sprintf("%d.yaml", GetOriginalRoom(r.RoomId)) } func (r *Room) Filepath() string { zone := ZoneNameSanitize(r.Zone) - return util.FilePath(zone, `/`, fmt.Sprintf("%d.yaml", r.RoomId)) + return util.FilePath(zone, `/`, r.Filename()) } func (r *Room) GetBiome() BiomeInfo { diff --git a/internal/rooms/save_and_load.go b/internal/rooms/save_and_load.go index 5f1eadc1..b76676e5 100644 --- a/internal/rooms/save_and_load.go +++ b/internal/rooms/save_and_load.go @@ -1,6 +1,7 @@ package rooms import ( + "errors" "fmt" "os" "reflect" @@ -123,6 +124,10 @@ func LoadRoomInstance(roomId int) *Room { // Only loads the template data, ignores instance data. func LoadRoomTemplate(roomId int) *Room { + if roomId >= ephemeralRoomIdMinimum { + return nil + } + filename := roomManager.GetFilePath(roomId) if len(filename) == 0 { @@ -139,6 +144,10 @@ func LoadRoomTemplate(roomId int) *Room { // See C. UPDATING EXISTING ROOM TEMPLATES func SaveRoomTemplate(roomTpl Room) error { + if roomTpl.IsEphemeral() { + return errors.New(`ephemeral rooms are not saved`) + } + // Do not accept a RoomId of zero. if roomTpl.RoomId == 0 { roomTpl.RoomId = GetNextRoomId() @@ -234,6 +243,10 @@ type SaveEqualityChecker interface { // See: D. SAVING ROOMS INSTANCES func SaveRoomInstance(r Room) error { + if r.IsEphemeral() { + return errors.New(`ephemeral rooms are not saved`) + } + rTpl := LoadRoomTemplate(r.RoomId) // This is also a Room{} if rTpl == nil { return fmt.Errorf(`could not load template for room %d`, r.RoomId) @@ -323,6 +336,10 @@ func SaveAllRooms() error { errCt := 0 for _, r := range roomManager.rooms { + if r.IsEphemeral() { + continue + } + if SaveRoomInstance(*r) != nil { errCt++ continue diff --git a/internal/scripting/room.go b/internal/scripting/room.go index a56ce197..a6fbd282 100644 --- a/internal/scripting/room.go +++ b/internal/scripting/room.go @@ -22,14 +22,25 @@ func ClearRoomVMs() { } func PruneRoomVMs(roomIds ...int) { + pruneCt := 0 + defer func() { + if pruneCt > 0 { + mudlog.Info("PruneRoomVMs", "Removed VM Count", pruneCt) + } + }() + if len(roomIds) > 0 { for _, roomId := range roomIds { - delete(roomVMCache, roomId) + if _, ok := roomVMCache[roomId]; ok { + pruneCt++ + delete(roomVMCache, roomId) + } } return } for roomId, _ := range roomVMCache { if !rooms.IsRoomLoaded(roomId) { + pruneCt++ delete(roomVMCache, roomId) } } diff --git a/internal/scripting/room_func.go b/internal/scripting/room_func.go index ac8c6a86..17d7992a 100644 --- a/internal/scripting/room_func.go +++ b/internal/scripting/room_func.go @@ -25,6 +25,8 @@ import ( func setRoomFunctions(vm *goja.Runtime) { vm.Set(`GetRoom`, GetRoom) vm.Set(`GetMap`, GetMap) + vm.Set(`CreateInstancesFromRoomIds`, CreateInstancesFromRoomIds) + vm.Set(`CreateInstancesFromZone`, CreateInstancesFromZone) } type ScriptRoom struct { @@ -307,6 +309,16 @@ func (r ScriptRoom) RemoveMutator(mutName string) { // # These functions get exported to the scripting engine // // //////////////////////////////////////////////////////// +func CreateInstancesFromRoomIds(roomList []int) map[int]int { + ret, _ := rooms.CreateEphemeralRoomIds(roomList...) + return ret +} + +func CreateInstancesFromZone(zoneName string) map[int]int { + ret, _ := rooms.CreateEphemeralZone(zoneName) + return ret +} + func GetRoom(roomId int) *ScriptRoom { if room := rooms.LoadRoom(roomId); room != nil { return &ScriptRoom{roomId, room} diff --git a/internal/usercommands/admin.room.go b/internal/usercommands/admin.room.go index 694a2c33..9dc7c44f 100644 --- a/internal/usercommands/admin.room.go +++ b/internal/usercommands/admin.room.go @@ -38,6 +38,7 @@ func Room(rest string, user *users.UserRecord, liveRoom *rooms.Room, flags event // args should look like one of the following: // info // + args := util.SplitButRespectQuotes(rest) if len(args) == 0 { @@ -48,7 +49,19 @@ func Room(rest string, user *users.UserRecord, liveRoom *rooms.Room, flags event return handled, nil } - room := rooms.LoadRoomTemplate(liveRoom.RoomId) + var room *rooms.Room + + if liveRoom.IsEphemeral() { + room = liveRoom + } else { + room = rooms.LoadRoomTemplate(liveRoom.RoomId) + } + + if room == nil { + err := fmt.Errorf(`Something went wrong for RoomId: %d`, liveRoom.RoomId) + user.SendText(err.Error()) + return true, err + } var roomId int = 0 roomCmd := strings.ToLower(args[0]) diff --git a/internal/usercommands/look.go b/internal/usercommands/look.go index 521045b6..05d86ac6 100644 --- a/internal/usercommands/look.go +++ b/internal/usercommands/look.go @@ -490,6 +490,13 @@ func lookRoom(user *users.UserRecord, roomId int, secretLook bool) { tinyMap = append(tinyMap, `║`+string(mapLine)+`║`) } tinyMap = append(tinyMap, `╚═════╝`) + // This additional check is for ephemeral room copies, + // which can slightly mess with the map render of the @ + if tinyMap[3][3] != '@' { + youLine := []rune(tinyMap[3]) + youLine[3] = '@' + tinyMap[3] = string(youLine) + } legend := output.GetLegend(keywords.GetAllLegendAliases(room.Zone)) diff --git a/internal/usercommands/start.go b/internal/usercommands/start.go index ef2c35cd..e66c7bed 100644 --- a/internal/usercommands/start.go +++ b/internal/usercommands/start.go @@ -233,46 +233,29 @@ func Start(rest string, user *users.UserRecord, room *rooms.Room, flags events.E user.ClearPrompt() - for _, ridStr := range configs.GetSpecialRoomsConfig().TutorialStartRooms { - - rid, _ := strconv.ParseInt(ridStr, 10, 64) - skip := false - - for _, populatedRoomId := range rooms.GetRoomsWithPlayers() { - - for i := 0; i < 10; i++ { - - if int(rid)+i == populatedRoomId { - skip = true - break - } - - } - - if skip { - break - } - - } - - if skip { - continue + tutorialRoomIds := []int{} + startRoom := 0 + for i, roomIdStr := range configs.GetSpecialRoomsConfig().TutorialRooms { + roomId, _ := strconv.ParseInt(roomIdStr, 10, 64) + tutorialRoomIds = append(tutorialRoomIds, int(roomId)) + + if i == 0 { + startRoom = int(roomId) } + } - scripting.TryRoomScriptEvent(`onEnter`, user.UserId, int(rid)) - - user.SendText(fmt.Sprintf(`Suddenly, a vortex appears before you, drawing you in before you have any chance to react!%s`, term.CRLFStr)) - - rooms.MoveToRoom(user.UserId, int(rid)) - + createdRoomIds, err := rooms.CreateEphemeralRoomIds(tutorialRoomIds...) + if err != nil { + user.SendText(`The Tutorial zone is fully occupied right now. Please try again in a few minutes`) return true, nil - } - user.SendText(`Someone else is currently utilizing the tutorial, please try again in a few minutes.`) + ephemeralStartRoomId := createdRoomIds[startRoom] + scripting.TryRoomScriptEvent(`onEnter`, user.UserId, ephemeralStartRoomId) + + user.SendText(fmt.Sprintf(`Suddenly, a vortex appears before you, drawing you in before you have any chance to react!%s`, term.CRLFStr)) - //rooms.MoveToRoom(user.UserId, 1) - //user.SendText(`Welcome to Frostfang. You can look at the sign here!`) + rooms.MoveToRoom(user.UserId, ephemeralStartRoomId) return true, nil } diff --git a/internal/users/users.go b/internal/users/users.go index ab915d8e..269340ea 100644 --- a/internal/users/users.go +++ b/internal/users/users.go @@ -481,17 +481,6 @@ func SaveUser(u UserRecord, isAutoSave ...bool) error { mudlog.Info("SaveUser()", "username", u.Username, "wrote-file", fileWritten, "tmp-file", tmpSaved, "tmp-copied", tmpCopied, "completed", completed) }() - // Don't save if they haven't entered the real game world yet. - //if u.Character.RoomId < 0 { - //return errors.New("Has not started game.") - //} - - if u.Character.RoomId >= 900 && u.Character.RoomId <= 999 { - if len(isAutoSave) == 0 || !isAutoSave[0] { - u.Character.RoomId = -1 - } - } - data, err := yaml.Marshal(&u) if err != nil { return err diff --git a/main.go b/main.go index 7404d83a..162ed16d 100644 --- a/main.go +++ b/main.go @@ -289,7 +289,7 @@ func main() { // Final plugin save before shutting down plugins.Save() - // Just an ephemeral goroutine that spins its wheels until the program shuts down") + // Just a goroutine that spins its wheels until the program shuts down") go func() { for { mudlog.Warn("Waiting on workers") diff --git a/world.go b/world.go index 08571d30..2e037965 100644 --- a/world.go +++ b/world.go @@ -20,6 +20,7 @@ import ( "github.com/GoMudEngine/GoMud/internal/mudlog" "github.com/GoMudEngine/GoMud/internal/prompt" "github.com/GoMudEngine/GoMud/internal/rooms" + "github.com/GoMudEngine/GoMud/internal/scripting" "github.com/GoMudEngine/GoMud/internal/templates" "github.com/GoMudEngine/GoMud/internal/term" "github.com/GoMudEngine/GoMud/internal/usercommands" @@ -219,7 +220,21 @@ func (w *World) HandleSystemEvents(e events.Event) events.ListenerReturn { } } else if sys.Command == `logoff` { - w.logOff(sys.Data.(int)) + + if user := users.GetByUserId(sys.Data.(int)); user != nil { + + user.EventLog.Add(`conn`, `Logged off`) + + events.AddToQueue(events.PlayerDespawn{ + UserId: user.UserId, + RoomId: user.Character.RoomId, + Username: user.Username, + CharacterName: user.Character.Name, + TimeOnline: user.GetOnlineInfo().OnlineTimeStr, + }) + + } + } return events.Continue @@ -751,7 +766,8 @@ loop: // TODO: Move this to events util.LockMud() - rooms.RoomMaintenance() + scripting.PruneRoomVMs(rooms.RoomMaintenance()...) + scripting.PruneRoomVMs(rooms.EphemeralRoomMaintenance()...) util.UnlockMud() roomUpdateTimer.Reset(roomMaintenancePeriod) @@ -1060,26 +1076,6 @@ func (w *World) Kick(userId int, reason string) { connections.Kick(user.ConnectionId(), reason) } -func (w *World) logOff(userId int) { - - if user := users.GetByUserId(userId); user != nil { - - user.EventLog.Add(`conn`, `Logged off`) - - users.SaveUser(*user) - - events.AddToQueue(events.PlayerDespawn{ - UserId: user.UserId, - RoomId: user.Character.RoomId, - Username: user.Username, - CharacterName: user.Character.Name, - TimeOnline: user.GetOnlineInfo().OnlineTimeStr, - }) - - } - -} - // Handle dropped players func (w *World) HandleDroppedPlayers(droppedPlayers []int) {