Fixes #100 See merge request !58tags/v0.1.2^2
@@ -30,7 +30,12 @@ define([ | |||||
quest.active = (this.obj.zoneName == quest.zoneName); | quest.active = (this.obj.zoneName == quest.zoneName); | ||||
this.quests.push(quest); | this.quests.push(quest); | ||||
quest.init(hideMessage); | |||||
if (!quest.init(hideMessage)) { | |||||
this.quests.spliceWhere(q => (q == quest)); | |||||
return false; | |||||
} | |||||
else | |||||
return true; | |||||
}, | }, | ||||
complete: function(id) { | complete: function(id) { | ||||
@@ -61,7 +61,8 @@ define([ | |||||
quest.obj = obj; | quest.obj = obj; | ||||
quest.zoneName = zoneName; | quest.zoneName = zoneName; | ||||
oQuests.obtain(quest, !!template); | |||||
if (!oQuests.obtain(quest, !!template)) | |||||
this.obtain(obj, template); | |||||
} | } | ||||
}; | }; | ||||
}); | }); |
@@ -15,6 +15,8 @@ define([ | |||||
} | } | ||||
this.description = 'Gather ' + this.have + '/' + this.need + ' herbs'; | this.description = 'Gather ' + this.have + '/' + this.need + ' herbs'; | ||||
return true; | |||||
}, | }, | ||||
events: { | events: { | ||||
@@ -37,6 +37,11 @@ define([ | |||||
(mobBlueprint.level <= ~~(this.obj.stats.values.level * 1.35)) | (mobBlueprint.level <= ~~(this.obj.stats.values.level * 1.35)) | ||||
); | ); | ||||
}, this); | }, this); | ||||
//No level appropriate mobs found | |||||
if (keys.length == 0) | |||||
return false; | |||||
this.mobType = keys[~~(Math.random() * keys.length)]; | this.mobType = keys[~~(Math.random() * keys.length)]; | ||||
var needMax = 8; | var needMax = 8; | ||||
this.mobName = this.mobType.replace(/\w\S*/g, function(txt) { | this.mobName = this.mobType.replace(/\w\S*/g, function(txt) { | ||||
@@ -48,6 +53,8 @@ define([ | |||||
} | } | ||||
this.description = 'Kill ' + this.have + '/' + this.need + ' ' + this.mobName; | this.description = 'Kill ' + this.have + '/' + this.need + ' ' + this.mobName; | ||||
return true; | |||||
}, | }, | ||||
events: { | events: { | ||||
@@ -17,6 +17,8 @@ define([ | |||||
} | } | ||||
this.description = 'Loot 1x ' + this.slotName + ' slot item'; | this.description = 'Loot 1x ' + this.slotName + ' slot item'; | ||||
return true; | |||||
}, | }, | ||||
events: { | events: { | ||||
@@ -26,6 +26,11 @@ define([ | |||||
(mobBlueprint.level <= (this.obj.stats.values.level * 1.35)) | (mobBlueprint.level <= (this.obj.stats.values.level * 1.35)) | ||||
); | ); | ||||
}, this); | }, this); | ||||
//No level appropriate mobs found | |||||
if (keys.length == 0) | |||||
return false; | |||||
this.mobType = keys[~~(Math.random() * keys.length)]; | this.mobType = keys[~~(Math.random() * keys.length)]; | ||||
var needMax = 8; | var needMax = 8; | ||||
this.mobName = this.mobType.replace(/\w\S*/g, function(txt) { | this.mobName = this.mobType.replace(/\w\S*/g, function(txt) { | ||||
@@ -39,6 +44,8 @@ define([ | |||||
this.name = this.item.name + ' Gatherer'; | this.name = this.item.name + ' Gatherer'; | ||||
this.description = 'Loot ' + this.have + '/' + this.need + ' ' + this.item.name + ' from ' + this.mobName; | this.description = 'Loot ' + this.have + '/' + this.need + ' ' + this.item.name + ' from ' + this.mobName; | ||||
return true; | |||||
}, | }, | ||||
oComplete: function() { | oComplete: function() { | ||||
@@ -5,7 +5,9 @@ define([ | |||||
) { | ) { | ||||
return { | return { | ||||
init: function(hideMessage) { | init: function(hideMessage) { | ||||
this.build(); | |||||
if (!this.build()) | |||||
return false; | |||||
this.obj.syncer.setArray(true, 'quests', 'obtainQuests', this.simplify(true)); | this.obj.syncer.setArray(true, 'quests', 'obtainQuests', this.simplify(true)); | ||||
if (!hideMessage) { | if (!hideMessage) { | ||||
@@ -17,6 +19,8 @@ define([ | |||||
}] | }] | ||||
}, [this.obj.serverId]); | }, [this.obj.serverId]); | ||||
} | } | ||||
return true; | |||||
}, | }, | ||||
ready: function() { | ready: function() { | ||||