Files
andors-trail/AndorsTrailEdit/Editor_Quest.js
2011-05-03 22:15:45 +00:00

22 lines
582 B
JavaScript

function createQuestEditor(obj) {
var div = $( "#templates #editQuest" ).clone(true);
applyCommonEditorBindings(div, obj, model.quests);
if (!obj.stages) obj.stages = [];
var array = obj.stages;
var createNewStage = function() {
var nextProgress;
if (array.length > 0) { nextProgress = parseInt(array[array.length - 1].progress) + 10; }
if (!nextProgress) { nextProgress = 10; }
return { progress: nextProgress };
};
applyTableEditor({
table: $( "#stages", div ),
dialog: questlogDialog,
array: array,
templateFunction: createNewStage
});
return div;
}