Skip to content

Commit 4e72a04

Browse files
committed
Merge remote-tracking branch 'Roll20/master'
2 parents 2104ed0 + b85f6ae commit 4e72a04

File tree

33 files changed

+27305
-5729
lines changed

33 files changed

+27305
-5729
lines changed

5th Edition OGL by Roll20 Companion/1.3/5th Edition OGL by Roll20 Companion.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,6 @@ var longrest = function(msg) {
325325
});
326326
var maxhp = getAttrByName(character.id, "hp", "max");
327327
var hp = findObjs({type: 'attribute', characterid: character.id, name: "hp"}, {caseInsensitive: true})[0];
328-
log(maxhp);
329-
log(hp);
330328
if(hp && maxhp) {
331329
hp.set({current: maxhp});
332330
}
@@ -400,10 +398,14 @@ var handleammo = function (msg,character,player) {
400398
ammoitemid = getAttrByName(character.id, ammoresource.get("name") + "_itemid");
401399
if(ammoitemid) {
402400
ammoitem = findObjs({type: 'attribute', characterid: character.id, name: "repeating_inventory_" + ammoitemid + "_itemcount"}, {caseInsensitive: true})[0];
403-
ammoitem.set({current: ammoitem.get("current") - 1});
401+
if(ammoitem) {
402+
ammoitem.set({current: ammoitem.get("current") - 1});
403+
}
404404
ammoweight = findObjs({type: 'attribute', characterid: character.id, name: "repeating_inventory_" + ammoitemid + "_itemweight"}, {caseInsensitive: true})[0];
405405
totalweight = findObjs({type: 'attribute', characterid: character.id, name: "weighttotal"}, {caseInsensitive: true})[0];
406-
totalweight.set({current: totalweight.get("current") - ammoweight.get("current")});
406+
if(ammoweight && totalweight) {
407+
totalweight.set({current: totalweight.get("current") - ammoweight.get("current")});
408+
}
407409
}
408410
if(ammoresource.get("current") < 0) {
409411
if(getAttrByName(character.id, "wtype") === "") {

0 commit comments

Comments
 (0)