From 4edab9accfbc7a43dfa0f4379f5fcedf3b85847a Mon Sep 17 00:00:00 2001 From: "Aaron C. Meadows" Date: Wed, 18 Feb 2015 21:36:15 -0600 Subject: [PATCH 1/4] Squashed 'Emas/' content from commit 52076d6 git-subtree-dir: Emas git-subtree-split: 52076d62ca1f603e3beef6bd472cb5966dfe98fe --- Emas.js | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 13 +++++++ 2 files changed, 121 insertions(+) create mode 100644 Emas.js create mode 100644 package.json diff --git a/Emas.js b/Emas.js new file mode 100644 index 0000000000..5083d2af5c --- /dev/null +++ b/Emas.js @@ -0,0 +1,108 @@ +// GIST: https://gist.github.com/shdwjk/42f34ecfd167ec56c9f7 + +var Emas = Emas || (function() { + 'use strict'; + + var version = 0.4, + + ch = function (c) { + var entities = { + '<' : 'lt', + '>' : 'gt', + "'" : '#39', + '@' : '#64', + '{' : '#123', + '|' : '#124', + '}' : '#125', + '[' : '#91', + ']' : '#93', + '"' : 'quot', + '-' : 'mdash', + ' ' : 'nbsp' + }; + + if(_.has(entities,c) ){ + return ('&'+entities[c]+';'); + } + return ''; + }, + + + showHelp = function(who) { + sendChat('', + '/w '+who+' ' ++'
' + +'
' + +'Emas v'+version + +'
' + +'
' + +'

Emas provides the !emas command, which looks like /emas but works for everyone, as well as the !as command, which looks like /as but works for everyone.

' + +'
' + +'Commands' + +'
' + +'!emas '+ch('<')+'message'+ch('>')+'' + +'
' + +'

Sends a message in the same manner as /emas does for GMs.

' + +'
    ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +'
  • ' + +'
' + +'
' + +'
' + +'
' + +'!as '+ch('<')+'message'+ch('>')+'' + +'
' + +'

Sends a message in the same manner as /as does for GMs.

' + +'
    ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +'
  • ' + +'
' + +'
' + +'
' ++'
' + ); + }, + + handleInput = function(msg) { + var args, who; + + if (msg.type !== "api") { + return; + } + + args = msg.content.split(/\s+/); + who=getObj('player',msg.playerid).get('_displayname').split(' ')[0]; + switch(args[0]) { + case '!emas': + if(1 === args.length) { + showHelp(who); + } else { + sendChat('','/emas '+_.rest(args).join(' ')); + } + break; + case '!as': + if(1 === args.length) { + showHelp(who); + } else { + sendChat('','/as '+_.rest(args).join(' ')); + } + break; + } + }, + + registerEventHandlers = function() { + on('chat:message', handleInput); + }; + + return { + RegisterEventHandlers: registerEventHandlers + }; +}()); + +on("ready",function(){ + 'use strict'; + + Emas.RegisterEventHandlers(); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000000..c6fe624982 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "emas", + "version": "0.4", + "description": "Provides player !emas and !as commands.", + "authors": "The Aaron", + "roll20userid": "104025", + "dependencies": { + }, + "modifies": { + }, + "conflicts": [ + ] +} From 7062785c35a552cf902542012704833326561423 Mon Sep 17 00:00:00 2001 From: "Aaron C. Meadows" Date: Wed, 18 Feb 2015 22:36:38 -0600 Subject: [PATCH 2/4] Squashed 'Emas/' changes from 52076d6..be3707a be3707a prod-Emas: Updated prod version of Emas at version 0.5. git-subtree-dir: Emas git-subtree-split: be3707afe538b7825f4240acb711e4ebf498e5db --- Emas.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-- package.json | 2 +- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/Emas.js b/Emas.js index 5083d2af5c..df73fa3052 100644 --- a/Emas.js +++ b/Emas.js @@ -3,7 +3,7 @@ var Emas = Emas || (function() { 'use strict'; - var version = 0.4, + var version = 0.5, ch = function (c) { var entities = { @@ -36,7 +36,10 @@ var Emas = Emas || (function() { +'Emas v'+version +'' +'
' - +'

Emas provides the !emas command, which looks like /emas but works for everyone, as well as the !as command, which looks like /as but works for everyone.

' + +'

Emas provides the !emas command, which looks like /emas but ' + +'works for everyone, as well as the !as command, which looks like ' + +'/as but works for everyone. !w, !r, !gr as ' + +'well.

' +'
' +'Commands' +'
' @@ -61,6 +64,39 @@ var Emas = Emas || (function() { +'' +'
' +'' + +'
' + +'!w '+ch('<')+'message'+ch('>')+'' + +'
' + +'

Sends a message in the same manner as /w does.

' + +'
    ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +'
  • ' + +'
' + +'
' + +'
' + +'
' + +'!r '+ch('<')+'message'+ch('>')+'' + +'
' + +'

Sends a message in the same manner as /r does.

' + +'
    ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +'
  • ' + +'
' + +'
' + +'
' + +'
' + +'!gr '+ch('<')+'message'+ch('>')+'' + +'
' + +'

Sends a message in the same manner as /gr does.

' + +'
    ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +'
  • ' + +'
' + +'
' + +'
' +'' ); }, @@ -89,6 +125,28 @@ var Emas = Emas || (function() { sendChat('','/as '+_.rest(args).join(' ')); } break; + case '!w': + if(1 === args.length) { + showHelp(who); + } else { + sendChat(msg.who,'/w '+who+' '+_.rest(args,2).join(' ')); + sendChat(msg.who,'/w '+_.rest(args).join(' ')); + } + break; + case '!r': + if(1 === args.length) { + showHelp(who); + } else { + sendChat('','/r '+_.rest(args).join(' ')); + } + break; + case '!gr': + if(1 === args.length) { + showHelp(who); + } else { + sendChat('','/gr '+_.rest(args).join(' ')); + } + break; } }, diff --git a/package.json b/package.json index c6fe624982..bceaee54ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emas", - "version": "0.4", + "version": "0.5", "description": "Provides player !emas and !as commands.", "authors": "The Aaron", "roll20userid": "104025", From 09be0fa6bebf9f3658fc6a7ce53038e1e85de6fa Mon Sep 17 00:00:00 2001 From: "Aaron C. Meadows" Date: Thu, 19 Feb 2015 08:53:51 -0600 Subject: [PATCH 3/4] Squashed 'Emas/' changes from be3707a..90bf421 90bf421 prod-Emas: Updated prod version of Emas at version 0.6. git-subtree-dir: Emas git-subtree-split: 90bf421bf1ebf30e68d48fd229a10a88391630e6 --- Emas.js | 42 +++++++++++++++++++++++++++++++++--------- package.json | 2 +- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Emas.js b/Emas.js index df73fa3052..f9fa7bb949 100644 --- a/Emas.js +++ b/Emas.js @@ -3,7 +3,7 @@ var Emas = Emas || (function() { 'use strict'; - var version = 0.5, + var version = 0.6, ch = function (c) { var entities = { @@ -54,10 +54,13 @@ var Emas = Emas || (function() { +'' +'' +'
' - +'!as '+ch('<')+'message'+ch('>')+'' + +'!as '+ch('<')+'target'+ch('>')+' '+ch('<')+'message'+ch('>')+'' +'
' +'

Sends a message in the same manner as /as does for GMs.

' +'
    ' + +'
  • ' + +''+ch('<')+'target'+ch('>')+' '+ch('-')+' The person to speak as.' + +'
  • ' +'
  • ' +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' +'
  • ' @@ -65,34 +68,48 @@ var Emas = Emas || (function() { +'
' +'
' +'
' - +'!w '+ch('<')+'message'+ch('>')+'' + +'!w '+ch('<')+'target'+ch('>')+' '+ch('<')+'message'+ch('>')+'' +'
' +'

Sends a message in the same manner as /w does.

' +'
    ' +'
  • ' - +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +''+ch('<')+'target'+ch('>')+' '+ch('-')+' The target of the whisper.' + +'
  • ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to whisper.' +'
  • ' +'
' +'
' +'
' +'
' - +'!r '+ch('<')+'message'+ch('>')+'' + +'!r '+ch('<')+'expression'+ch('>')+'' +'
' - +'

Sends a message in the same manner as /r does.

' + +'

Sends a expression in the same manner as /r does.

' +'
    ' +'
  • ' - +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +''+ch('<')+'expression'+ch('>')+' '+ch('-')+' The dice expression to output.' +'
  • ' +'
' +'
' +'
' +'
' - +'!gr '+ch('<')+'message'+ch('>')+'' + +'!gr '+ch('<')+'expression'+ch('>')+'' +'
' +'

Sends a message in the same manner as /gr does.

' +'
    ' +'
  • ' - +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the emote.' + +''+ch('<')+'expression'+ch('>')+' '+ch('-')+' The dice expression to whisper to the GM (blindly).' + +'
  • ' + +'
' + +'
' + +'
' + +'
' + +'!desc '+ch('<')+'message'+ch('>')+'' + +'
' + +'

Sends a message in the same manner as /desc does.

' + +'
    ' + +'
  • ' + +''+ch('<')+'message'+ch('>')+' '+ch('-')+' The message to output as part of the description.' +'
  • ' +'
' +'
' @@ -147,6 +164,13 @@ var Emas = Emas || (function() { sendChat('','/gr '+_.rest(args).join(' ')); } break; + case '!desc': + if(1 === args.length) { + showHelp(who); + } else { + sendChat('','/desc '+_.rest(args).join(' ')); + } + break; } }, diff --git a/package.json b/package.json index bceaee54ba..f4da197a67 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emas", - "version": "0.5", + "version": "0.6", "description": "Provides player !emas and !as commands.", "authors": "The Aaron", "roll20userid": "104025", From 553d4355df73573d68c4f7a2f4a107d326339d68 Mon Sep 17 00:00:00 2001 From: "Aaron C. Meadows" Date: Sat, 21 Feb 2015 16:22:31 -0600 Subject: [PATCH 4/4] Squashed 'Emas/' changes from 90bf421..bbc71f5 bbc71f5 prod-Emas: Updated prod version of Emas at version 0.7. git-subtree-dir: Emas git-subtree-split: bbc71f547b84369ab2e7f36b9ded0c6622e44412 --- Emas.js | 19 ++++++++++++++++--- package.json | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Emas.js b/Emas.js index f9fa7bb949..431517680a 100644 --- a/Emas.js +++ b/Emas.js @@ -3,7 +3,7 @@ var Emas = Emas || (function() { 'use strict'; - var version = 0.6, + var version = 0.7, ch = function (c) { var entities = { @@ -118,13 +118,26 @@ var Emas = Emas || (function() { ); }, - handleInput = function(msg) { - var args, who; + handleInput = function(msg_orig) { + var args, who, msg = _.clone(msg_orig); if (msg.type !== "api") { return; } + if(_.has(msg,'inlinerolls')){ + msg.content = _.chain(msg.inlinerolls) + .reduce(function(m,v,k){ + m['$[['+k+']]']="[["+v.expression+"]]"; + return m; + },{}) + .reduce(function(m,v,k){ + return m.replace(k,v); + },msg.content) + .value(); + } + + args = msg.content.split(/\s+/); who=getObj('player',msg.playerid).get('_displayname').split(' ')[0]; switch(args[0]) { diff --git a/package.json b/package.json index f4da197a67..f01e566fa9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emas", - "version": "0.6", + "version": "0.7", "description": "Provides player !emas and !as commands.", "authors": "The Aaron", "roll20userid": "104025",