@@ -325,8 +325,6 @@ var longrest = function(msg) {
325
325
} ) ;
326
326
var maxhp = getAttrByName ( character . id , "hp" , "max" ) ;
327
327
var hp = findObjs ( { type : 'attribute' , characterid : character . id , name : "hp" } , { caseInsensitive : true } ) [ 0 ] ;
328
- log ( maxhp ) ;
329
- log ( hp ) ;
330
328
if ( hp && maxhp ) {
331
329
hp . set ( { current : maxhp } ) ;
332
330
}
@@ -400,10 +398,14 @@ var handleammo = function (msg,character,player) {
400
398
ammoitemid = getAttrByName ( character . id , ammoresource . get ( "name" ) + "_itemid" ) ;
401
399
if ( ammoitemid ) {
402
400
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
+ }
404
404
ammoweight = findObjs ( { type : 'attribute' , characterid : character . id , name : "repeating_inventory_" + ammoitemid + "_itemweight" } , { caseInsensitive : true } ) [ 0 ] ;
405
405
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
+ }
407
409
}
408
410
if ( ammoresource . get ( "current" ) < 0 ) {
409
411
if ( getAttrByName ( character . id , "wtype" ) === "" ) {
0 commit comments