Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_datafiles/html/public/static/js/xterm.4.19.0.js
_datafiles/html/public/static/js/xterm-addon-fit.js
_datafiles/html/admin/static/js/htmx.2.0.3.js
4 changes: 4 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"esversion": 6
}

8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ coverage:
go tool cover -html=bin/covdatafiles/cover.out && \
rm -rf bin

.PHONY: js-lint
js-lint:
# Grep filtering it to remove errors reported by docker image around npm packages
# if "### errors" is found in the output, exits with an error code of 1
# This should allow us to use it in CI/CD
@docker run --rm -v "$(PWD)":/app -w /app node:20 npx jshint . \
2>&1 | grep -v "^npm " | tee /dev/stderr | grep -Eq "^[0-9]+ errors" && exit 1 || true

#
#
# Cert generation for testing
Expand Down
12 changes: 6 additions & 6 deletions _datafiles/sample-scripts/mobs/item-gold-quest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const REQUIRED_ITEM_ID = 10001;
const REQUIRED_GOLD_AMOUNT = 10;

// This corresponds to the quest defined in the _datafiles/quests/ folder.
const QUEST_START_ID = "1000000-start" // All quests begin with #-start
const QUEST_NEXT_STEP_ID = "1000000-givegold" // Quest steps can be called #-anything
const QUEST_END_ID = "1000000-end" // All quests end with #-end
const QUEST_START_ID = "1000000-start"; // All quests begin with #-start
const QUEST_NEXT_STEP_ID = "1000000-givegold"; // Quest steps can be called #-anything
const QUEST_END_ID = "1000000-end"; // All quests end with #-end


//
Expand Down Expand Up @@ -129,7 +129,7 @@ function onGive(mob, room, eventDetails) {
//
// Give them the next step of the quest
//
user.GiveQuest(QUEST_NEXT_STEP_ID)
user.GiveQuest(QUEST_NEXT_STEP_ID);

return true;
}
Expand Down Expand Up @@ -172,14 +172,14 @@ function onGive(mob, room, eventDetails) {
//
excessGold = eventDetails.gold - REQUIRED_GOLD_AMOUNT;
if ( excessGold > 0 ) {
mob.Command("say Here's your change.")
mob.Command("say Here's your change.");
mob.Command("give "+String(excessGold)+" gold " + user.ShorthandId()); // Give it to the player using shorthand
}

//
// They have now completed the entire quest, all steps are complete.
//
user.GiveQuest(QUEST_END_ID)
user.GiveQuest(QUEST_END_ID);

return true;
}
Expand Down
8 changes: 4 additions & 4 deletions _datafiles/sample-scripts/spells/harmarea.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

HARM_DICE_QTY = 1
HARM_DICE_SIDES = 2
SPELL_DESCRIPTION = '<ansi fg="222">sample harmful area spell</ansi>'
HARM_DICE_QTY = 1;
HARM_DICE_SIDES = 2;
SPELL_DESCRIPTION = '<ansi fg="222">sample harmful area spell</ansi>';

// Called when the casting is initialized (cast command)
// Return false if the casting should be ignored/aborted
function onCast(sourceActor, targetActors) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActors) {
Expand Down
8 changes: 4 additions & 4 deletions _datafiles/sample-scripts/spells/harmmulti.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

HARM_DICE_QTY = 1
HARM_DICE_SIDES = 2
SPELL_DESCRIPTION = '<ansi fg="222">sample harmful group spell</ansi>'
HARM_DICE_QTY = 1;
HARM_DICE_SIDES = 2;
SPELL_DESCRIPTION = '<ansi fg="222">sample harmful group spell</ansi>';

// Called when the casting is initialized (cast command)
// Return false if the casting should be ignored/aborted
function onCast(sourceActor, targetActors) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActors) {
Expand Down
8 changes: 4 additions & 4 deletions _datafiles/sample-scripts/spells/harmsingle.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

HARM_DICE_QTY = 1
HARM_DICE_SIDES = 2
SPELL_DESCRIPTION = '<ansi fg="222">sample harmful single target spell</ansi>'
HARM_DICE_QTY = 1;
HARM_DICE_SIDES = 2;
SPELL_DESCRIPTION = '<ansi fg="222">sample harmful single target spell</ansi>';

// Called when the casting is initialized (cast command)
// Return false if the casting should be ignored/aborted
function onCast(sourceActor, targetActor) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActor) {
Expand Down
8 changes: 4 additions & 4 deletions _datafiles/sample-scripts/spells/helparea.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

HEAL_DICE_QTY = 1
HEAL_DICE_SIDES = 2
SPELL_DESCRIPTION = '<ansi fg="222">sample helpful area spell</ansi>'
HEAL_DICE_QTY = 1;
HEAL_DICE_SIDES = 2;
SPELL_DESCRIPTION = '<ansi fg="222">sample helpful area spell</ansi>';


// Called when the casting is initialized (cast command)
Expand All @@ -10,7 +10,7 @@ function onCast(sourceActor, targetActors) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActors) {
Expand Down
8 changes: 4 additions & 4 deletions _datafiles/sample-scripts/spells/helpmulti.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

HEAL_DICE_QTY = 1
HEAL_DICE_SIDES = 2
SPELL_DESCRIPTION = '<ansi fg="222">sample helpful group spell</ansi>'
HEAL_DICE_QTY = 1;
HEAL_DICE_SIDES = 2;
SPELL_DESCRIPTION = '<ansi fg="222">sample helpful group spell</ansi>';


// Called when the casting is initialized (cast command)
Expand All @@ -10,7 +10,7 @@ function onCast(sourceActor, targetActors) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActors) {
Expand Down
8 changes: 4 additions & 4 deletions _datafiles/sample-scripts/spells/helpsingle.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

HEAL_DICE_QTY = 1
HEAL_DICE_SIDES = 2
SPELL_DESCRIPTION = '<ansi fg="222">sample helpful single target spell</ansi>'
HEAL_DICE_QTY = 1;
HEAL_DICE_SIDES = 2;
SPELL_DESCRIPTION = '<ansi fg="222">sample helpful single target spell</ansi>';

// Called when the casting is initialized (cast command)
// Return false if the casting should be ignored/aborted
function onCast(sourceActor, targetActor) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActor) {
Expand Down
2 changes: 1 addition & 1 deletion _datafiles/sample-scripts/spells/neutral.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function onCast(sourceActor, targetActor) {

SendUserMessage(sourceActor.UserId(), 'You begin to chant softly.');
SendRoomMessage(sourceActor.GetRoomId(), sourceActor.GetCharacterName(true)+' begins to chant softly.', sourceActor.UserId());
return true
return true;
}

function onWait(sourceActor, targetActor) {
Expand Down
10 changes: 5 additions & 5 deletions _datafiles/world/default/buffs/0-meditating.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You sit down and begin your meditation.' )
SendUserMessage(actor.UserId(), 'Your meditation must complete without interruption to quit gracefully.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' sits down a begins to meditate.', actor.UserId())
SendUserMessage(actor.UserId(), 'You sit down and begin your meditation.' );
SendUserMessage(actor.UserId(), 'Your meditation must complete without interruption to quit gracefully.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' sits down a begins to meditate.', actor.UserId());
}

// Invoked every time the buff is triggered (see roundinterval)
function onTrigger(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You continue your meditation. <ansi bg="blue"> *' + triggersLeft + ' rounds left* </ansi>' )
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' continues meditating.', actor.UserId() )
SendUserMessage(actor.UserId(), 'You continue your meditation. <ansi bg="blue"> *' + triggersLeft + ' rounds left* </ansi>' );
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' continues meditating.', actor.UserId() );
}
8 changes: 4 additions & 4 deletions _datafiles/world/default/buffs/1-illumination.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'A warm glow surrounds you.')
SendRoomMessage(actor.GetRoomId(), 'A warm glow surrounds '+actor.GetCharacterName(true)+ '.', actor.UserId())
SendUserMessage(actor.UserId(), 'A warm glow surrounds you.');
SendRoomMessage(actor.GetRoomId(), 'A warm glow surrounds '+actor.GetCharacterName(true)+ '.', actor.UserId());
}

// Invoked when the buff has run its course.
function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'Your glowing fades away.' )
SendRoomMessage(actor.GetRoomId(), 'The glow surrounding '+actor.GetCharacterName(true)+ ' fades away.', actor.UserId())
SendUserMessage(actor.UserId(), 'Your glowing fades away.' );
SendRoomMessage(actor.GetRoomId(), 'The glow surrounding '+actor.GetCharacterName(true)+ ' fades away.', actor.UserId());
}
10 changes: 5 additions & 5 deletions _datafiles/world/default/buffs/10-weakness.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'Weakness overtakes your body!')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks a little shakey.', actor.UserId())
SendUserMessage(actor.UserId(), 'Weakness overtakes your body!');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks a little shakey.', actor.UserId());
}

// Invoked every time the buff is triggered (see roundinterval)
function onTrigger(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You\'re feeling weak!')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks a little shakey.', actor.UserId())
SendUserMessage(actor.UserId(), 'You\'re feeling weak!');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks a little shakey.', actor.UserId());
}

// Invoked when the buff has run its course.
function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You feel a little more like yourself.')
SendUserMessage(actor.UserId(), 'You feel a little more like yourself.');
}
4 changes: 2 additions & 2 deletions _datafiles/world/default/buffs/11-touched.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You are touched by the gods.')
SendUserMessage(actor.UserId(), 'You are touched by the gods.');
}

// Invoked when the buff has run its course.
function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'The gods forget about you.')
SendUserMessage(actor.UserId(), 'The gods forget about you.');
}
12 changes: 6 additions & 6 deletions _datafiles/world/default/buffs/12-tackled.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You\'re on the ground.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is on the ground.', actor.UserId())
SendUserMessage(actor.UserId(), 'You\'re on the ground.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is on the ground.', actor.UserId());
}

// Invoked every time the buff is triggered (see roundinterval)
function onTrigger(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You\'re trying to get up.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is getting up.', actor.UserId())
SendUserMessage(actor.UserId(), 'You\'re trying to get up.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is getting up.', actor.UserId());
}

// Invoked when the buff has run its course.
function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You\'re standing again.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is standing again.', actor.UserId())
SendUserMessage(actor.UserId(), 'You\'re standing again.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is standing again.', actor.UserId());
}
14 changes: 7 additions & 7 deletions _datafiles/world/default/buffs/13-poisoned.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You begin to feel sick.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is looking sickly.', actor.UserId())
SendUserMessage(actor.UserId(), 'You begin to feel sick.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is looking sickly.', actor.UserId());
}

// Invoked every time the buff is triggered (see roundinterval)
function onTrigger(actor, triggersLeft) {
dmgAmt = Math.abs(Math.abs(actor.AddHealth(UtilDiceRoll(1, 8)*-1)))
dmgAmt = Math.abs(Math.abs(actor.AddHealth(UtilDiceRoll(1, 8)*-1)));

SendUserMessage(actor.UserId(), 'The poison hurts you for <ansi fg="damage">'+String(dmgAmt)+' damage</ansi>!')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' convulses under the effects of a poison.', actor.UserId())
SendUserMessage(actor.UserId(), 'The poison hurts you for <ansi fg="damage">'+String(dmgAmt)+' damage</ansi>!');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' convulses under the effects of a poison.', actor.UserId());
}

// Invoked when the buff has run its course.
function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'The poison wears off.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks a bit more normal.', actor.UserId())
SendUserMessage(actor.UserId(), 'The poison wears off.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks a bit more normal.', actor.UserId());
}
14 changes: 7 additions & 7 deletions _datafiles/world/default/buffs/14-minor_heal.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'A magical healing aura washes over you.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is surrounded by a healing glow.', actor.UserId())
SendUserMessage(actor.UserId(), 'A magical healing aura washes over you.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is surrounded by a healing glow.', actor.UserId());
}

// Invoked every time the buff is triggered (see roundinterval)
function onTrigger(actor, triggersLeft) {
healAmt = actor.AddHealth(UtilDiceRoll(1, 10))
healAmt = actor.AddHealth(UtilDiceRoll(1, 10));

SendUserMessage(actor.UserId(), 'You heal for <ansi fg="healing">'+String(healAmt)+' damage</ansi>!')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is healing from the effects of a heal spell.', actor.UserId())
SendUserMessage(actor.UserId(), 'You heal for <ansi fg="healing">'+String(healAmt)+' damage</ansi>!');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' is healing from the effects of a heal spell.', actor.UserId());
}

// Invoked when the buff has run its course.
function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'The healing aura fades.')
SendRoomMessage(actor.GetRoomId(), `The healing aura around `+actor.GetCharacterName(true)+' fades.', actor.UserId())
SendUserMessage(actor.UserId(), 'The healing aura fades.');
SendRoomMessage(actor.GetRoomId(), `The healing aura around `+actor.GetCharacterName(true)+' fades.', actor.UserId());
}

2 changes: 1 addition & 1 deletion _datafiles/world/default/buffs/15-sleeping.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ function onEnd(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You wake up!');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' wakes up.', actor.UserId());
actor.SetAdjective("sleeping", false);
actor.GiveBuff(16, "sleep") // Well Rested
actor.GiveBuff(16, "sleep"); // Well Rested
}
6 changes: 3 additions & 3 deletions _datafiles/world/default/buffs/16-well_rested.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You feel very well rested.')
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks very well rested.', actor.UserId())
SendUserMessage(actor.UserId(), 'You feel very well rested.');
SendRoomMessage(actor.GetRoomId(), actor.GetCharacterName(true)+' looks very well rested.', actor.UserId());
}

// Invoked every time the buff is triggered (see roundinterval)
function onTrigger(actor, triggersLeft) {
healAmt = actor.AddHealth(UtilDiceRoll(1, 2))
healAmt = actor.AddHealth(UtilDiceRoll(1, 2));
}
2 changes: 1 addition & 1 deletion _datafiles/world/default/buffs/17-well_fed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You feel well fed.')
SendUserMessage(actor.UserId(), 'You feel well fed.');
}

2 changes: 1 addition & 1 deletion _datafiles/world/default/buffs/18-very_well_fed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// Invoked when the buff is first applied to the player.
function onStart(actor, triggersLeft) {
SendUserMessage(actor.UserId(), 'You feel well fed.')
SendUserMessage(actor.UserId(), 'You feel well fed.');
}

Loading
Loading