mirror of
https://github.com/raeleus/Hashtag-DnD.git
synced 2025-07-14 01:11:52 -04:00
Added #gonorth, #gosouth, #goeast, #gowest. Resolves #27
This commit is contained in:
parent
b7b460b541
commit
92fc206423
3 changed files with 76 additions and 4 deletions
66
Input.js
66
Input.js
|
@ -59,6 +59,10 @@ const showLocationsSynonyms = ["showlocations", "showplaces", "showtowns", "show
|
|||
const getLocationSynonyms = ["getlocation", "location", "getcoordinates", "coordinates", "getcoords", "coords", "showlocation"]
|
||||
const clearLocationsSynonyms = ["clearlocations", "eraselocations", "deletelocations", "resetlocations"]
|
||||
const mapSynonyms = ["map", "showmap"]
|
||||
const goNorthSynonyms = ["gonorth", "north", "goup", "up", "n"]
|
||||
const goSouthSynonyms = ["gosouth", "south", "godown", "down", "s"]
|
||||
const goEastSynonyms = ["goeast", "east", "goright", "right", "e"]
|
||||
const goWestSynonyms = ["gowest", "west", "goleft", "left", "w"]
|
||||
const helpSynonyms = ["help"]
|
||||
|
||||
const modifier = (text) => {
|
||||
|
@ -91,7 +95,7 @@ const modifier = (text) => {
|
|||
return { text }
|
||||
}
|
||||
|
||||
if (!found) found = processCommandSynonyms(command, commandName, helpSynonyms.concat(rollSynonyms, noteSynonyms, eraseNoteSynonyms, showNotesSynonyms, clearNotesSynonyms, showCharactersSynonyms, removeCharacterSynonyms, generateNameSynonyms, setDefaultDifficultySynonyms, showDefaultDifficultySynonyms, renameCharacterSynonyms, cloneCharacterSynonyms, createLocationSynonyms, showLocationsSynonyms, goToLocationSynonyms, removeLocationSynonyms, getLocationSynonyms, clearLocationsSynonyms, resetSynonyms), function () {return true})
|
||||
if (!found) found = processCommandSynonyms(command, commandName, helpSynonyms.concat(rollSynonyms, noteSynonyms, eraseNoteSynonyms, showNotesSynonyms, clearNotesSynonyms, showCharactersSynonyms, removeCharacterSynonyms, generateNameSynonyms, setDefaultDifficultySynonyms, showDefaultDifficultySynonyms, renameCharacterSynonyms, cloneCharacterSynonyms, createLocationSynonyms, showLocationsSynonyms, goToLocationSynonyms, removeLocationSynonyms, getLocationSynonyms, clearLocationsSynonyms, goNorthSynonyms, goSouthSynonyms, goEastSynonyms, goWestSynonyms, resetSynonyms), function () {return true})
|
||||
|
||||
if (found == null) {
|
||||
if (state.characterName == null) {
|
||||
|
@ -164,6 +168,10 @@ const modifier = (text) => {
|
|||
if (text == null) text = processCommandSynonyms(command, commandName, showLocationsSynonyms, doShowLocations)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, getLocationSynonyms, doGetLocation)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, mapSynonyms, doMap)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, goNorthSynonyms, doGoNorth)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, goSouthSynonyms, doGoSouth)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, goEastSynonyms, doGoEast)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, goWestSynonyms, doGoWest)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, renameCharacterSynonyms, doRenameCharacter)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, cloneCharacterSynonyms, doCloneCharacter)
|
||||
if (text == null) text = processCommandSynonyms(command, commandName, helpSynonyms, doHelp)
|
||||
|
@ -1208,6 +1216,62 @@ function doCreateLocation(command) {
|
|||
return `\n[Location ${toTitleCase(arg2)} has been created at (${location.x},${location.y})]\n`
|
||||
}
|
||||
|
||||
function doGoNorth(command) {
|
||||
var commandName = getCommandName(command)
|
||||
var arg0 = getArgument(command, 0)
|
||||
if (arg0 == null) arg0 = 1
|
||||
else {
|
||||
if (isNaN(arg0)) {
|
||||
state.show = none
|
||||
return "\n[Error: Expected a number. See #help]\n"
|
||||
}
|
||||
arg0 = parseInt(arg0)
|
||||
}
|
||||
return doGoToLocation(`${commandName} ${state.x} ${state.y - arg0}`)
|
||||
}
|
||||
|
||||
function doGoSouth(command) {
|
||||
var commandName = getCommandName(command)
|
||||
var arg0 = getArgument(command, 0)
|
||||
if (arg0 == null) arg0 = 1
|
||||
else {
|
||||
if (isNaN(arg0)) {
|
||||
state.show = none
|
||||
return "\n[Error: Expected a number. See #help]\n"
|
||||
}
|
||||
arg0 = parseInt(arg0)
|
||||
}
|
||||
return doGoToLocation(`${commandName} ${state.x} ${state.y + arg0}`)
|
||||
}
|
||||
|
||||
function doGoEast(command) {
|
||||
var commandName = getCommandName(command)
|
||||
var arg0 = getArgument(command, 0)
|
||||
if (arg0 == null) arg0 = 1
|
||||
else {
|
||||
if (isNaN(arg0)) {
|
||||
state.show = none
|
||||
return "\n[Error: Expected a number. See #help]\n"
|
||||
}
|
||||
arg0 = parseInt(arg0)
|
||||
}
|
||||
return doGoToLocation(`${commandName} ${state.x + arg0} ${state.y}`)
|
||||
}
|
||||
|
||||
function doGoWest(command) {
|
||||
var commandName = getCommandName(command)
|
||||
var arg0 = getArgument(command, 0)
|
||||
if (arg0 == null) arg0 = 1
|
||||
else {
|
||||
if (isNaN(arg0)) {
|
||||
state.show = none
|
||||
return "\n[Error: Expected a number. See #help]\n"
|
||||
}
|
||||
arg0 = parseInt(arg0)
|
||||
}
|
||||
return doGoToLocation(`${commandName} ${state.x - arg0} ${state.y}`)
|
||||
}
|
||||
|
||||
function doGoToLocation(command) {
|
||||
var character = getCharacter()
|
||||
var characterName = character == null ? "You" : character.name
|
||||
|
|
12
Output.js
12
Output.js
|
@ -330,9 +330,17 @@ const modifier = (text) => {
|
|||
|
||||
text += "\n\n--Locations--"
|
||||
text += "\n#createlocation (x) (y) location_name"
|
||||
text += "\n Creates a location at the given coordinates. If the coordinates are not provided, they are randomized within a range of 10 units from the player's current location. Multiple locations may exist at the same coordinates. A story card is created for the location. Quotes are not necessary."
|
||||
text += "\n Creates a location at the given coordinates. The coordinates must be integers. If the coordinates are not provided, they are randomized within a range of 10 units from the player's current location. Multiple locations may exist at the same coordinates. A story card is created for the location. Quotes are not necessary."
|
||||
text += "\n#goto (x) (y) or (location_name)"
|
||||
text += "\n Makes the characters travel to the location specified by the coordinates or location_name. You must provide at least one or the other. If the location does not exist, it is created at your current coordinates. If you only specify coordinates, you will go to the first location at those coordinates. Quotes are not necessary."
|
||||
text += "\n Makes the party travel to the location specified by the coordinates (as integers) or location_name. You must provide at least one or the other. If the location does not exist, it is created at your current coordinates. If you only specify coordinates, you will go to the first location at those coordinates. Quotes are not necessary."
|
||||
text += "\n#gonorth (distance)"
|
||||
text += "\n The party travels north the given distance (an integer). If distance is not specified, it is assumed to be 1."
|
||||
text += "\n#gosouth (distance)"
|
||||
text += "\n The party travels south the given distance (an integer). If distance is not specified, it is assumed to be 1."
|
||||
text += "\n#goeast (distance)"
|
||||
text += "\n The party travels east the given distance (an integer). If distance is not specified, it is assumed to be 1."
|
||||
text += "\n#gowest (distance)"
|
||||
text += "\n The party travels west the given distance (an integer). If distance is not specified, it is assumed to be 1."
|
||||
text += "\n#getlocation"
|
||||
text += "\n Returns the coordinates that the player's party is at. It will also list a location if a location was specified when using #goto."
|
||||
text += "\n#showlocations"
|
||||
|
|
|
@ -15,7 +15,7 @@ Personalized note system that does not take up context space<br>
|
|||
See the [user guide here](https://github.com/raeleus/Hashtag-DnD/wiki).
|
||||
|
||||
v. 0.1.0
|
||||
* Added `#createlocation`, `#goto`, `#removelocation`, `#clearlocations`, `#getlocation` and `#showlocations` to enable travelling.
|
||||
* Added `#createlocation`, `#goto`, `#gonorth`, `#gosouth`, `#goeast`, `#gowest`, `#removelocation`, `#clearlocations`, `#getlocation` and `#showlocations` to enable travelling.
|
||||
* Added `#map` to generate an ASCII map based on the locations and player location.
|
||||
* Added `#renameitem` to rename an existing item
|
||||
* Added `#renamecharacter` to rename an existing character
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue