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
47 changes: 1 addition & 46 deletions MonsterHitDice5e/MonsterHitDice5e.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,7 @@
// Github: https://github.com/shdwjk/Roll20API/blob/master/MonsterHitDice/MonsterHitDice5e.js
// Github: https://github.com/shdwjk/Roll20API/blob/master/MonsterHitDice5e/MonsterHitDice5e.js
// By: The Aaron, Arcane Scriptomancer
// Contact: https://app.roll20.net/users/104025/the-aaron

on('ready', function(){
on('add:graphic',function(obj){
if(
'graphic' == obj.get('type')
&& 'token' == obj.get('subtype')
&& '' != obj.get('represents')
)
{
setTimeout(_.bind(function(id){
var obj=getObj('graphic',id)

if(
undefined != obj
&& '' == obj.get('bar2_link')
)
{
var attrib = findObjs({
_type: 'attribute',
_characterid:obj.get('represents'),
name: 'npc_HP_hit_dice'
})
if( attrib.length )
{
sendChat('','/r '+attrib[0].get('current'),function(r){
var hp=0;
_.each(r,function(subr){
var val=JSON.parse(subr.content);
if(_.has(val,'total'))
{
hp+=val.total;
}
});
obj.set({
bar2_value: hp,
bar2_max: hp
})
});
}
}

},this,obj.id), 100);
}
});
});/ GIST: https://gist.github.com/shdwjk/7377de58100f4e813432

on('ready', function(){
on('add:graphic',function(obj){
if(
Expand Down
2 changes: 1 addition & 1 deletion MonsterHitDice5e/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "MonsterHitDice5e",
"version": "0.1",
"version": "0.2",
"description": "Set Monster hit dice on add, usually via drag from journal. Configured for Dungeons and Dragons 5e Character Sheet",
"authors": "The Aaron",
"roll20userid": "104025",
Expand Down