diff --git a/AndorsTrailEdit/controllers.js b/AndorsTrailEdit/controllers.js index ad7896d36..6efc5520c 100644 --- a/AndorsTrailEdit/controllers.js +++ b/AndorsTrailEdit/controllers.js @@ -47,6 +47,13 @@ var ATEditor = (function(ATEditor, model, importExport) { controllers.QuestController = function($scope, $routeParams) { $scope.datasource = model.quests; $scope.obj = $scope.datasource.findById($routeParams.id); + $scope.addQuestStage = function() { + $scope.obj.stages.push({}); + }; + $scope.removeQuestStage = function(stage) { + var idx = $scope.obj.stages.indexOf(stage); + $scope.obj.stages.splice(idx, 1); + }; }; controllers.ItemController = function($scope, $routeParams) { $scope.datasource = model.items; diff --git a/AndorsTrailEdit/defaults.js b/AndorsTrailEdit/defaults.js index 8592fcb96..c15a4ae71 100644 --- a/AndorsTrailEdit/defaults.js +++ b/AndorsTrailEdit/defaults.js @@ -1,7 +1,33 @@ var ATEditor = (function(ATEditor, _) { var defaults = { - monster: { + actorcondition: { + isStacking: 0 + ,isPositive: 0 + ,roundEffect: { visualEffectID: -1, increaseCurrentHP: {}, increaseCurrentAP: {} } + ,fullRoundEffect: { visualEffectID: -1, increaseCurrentHP: {}, increaseCurrentAP: {} } + ,abilityEffect: { increaseAttackDamage: {} } + } + ,quest: { + showInLog: 0 + ,stages: [] + } + ,item: { + displaytype: 0 + ,hasManualPrice: 0 + ,equipEffect: { increaseAttackDamage: {}, addedConditions: [] } + ,useEffect: { increaseCurrentHP: {}, increaseCurrentAP: {}, conditionsSource: [], conditionsTarget: [] } + ,hitEffect: { increaseCurrentHP: {}, increaseCurrentAP: {}, conditionsSource: [], conditionsTarget: [] } + ,killEffect: { increaseCurrentHP: {}, increaseCurrentAP: {}, conditionsSource: [], conditionsTarget: [] } + } + ,droplist: { + quantity: {} + } + ,dialogue: { + rewards: [] + ,replies: [] + } + ,monster: { size: "1x1" ,maxHP: 1 ,maxAP: 10 @@ -11,6 +37,11 @@ var ATEditor = (function(ATEditor, _) { ,attackDamage: {} ,hitEffect: { increaseCurrentHP: {}, increaseCurrentAP: {}, conditionsSource: [], conditionsTarget: [] } } + ,itemcategory: { + actionType: 0 + ,inventorySlot: -1 + ,size: 0 + } }; ATEditor.defaults = { @@ -21,7 +52,7 @@ var ATEditor = (function(ATEditor, _) { } }, removeDefaults: function(type, o) { - return ATEditor.utils.cleanCopy(o, defaults[type]); + return ATEditor.utils.removeDefaults(o, defaults[type]); } }; diff --git a/AndorsTrailEdit/edit_actorcondition.html b/AndorsTrailEdit/edit_actorcondition.html index 5ebda8664..1be6446a8 100644 --- a/AndorsTrailEdit/edit_actorcondition.html +++ b/AndorsTrailEdit/edit_actorcondition.html @@ -1,5 +1,156 @@ -
-

id: {{obj.id}}

-
-
-
+

Actor condition

+
+ General +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
Positive effect
+
+
+
Allow stacked effects
+
+
+
Has effect every round (every 6s)
+
+
+
Has effect every full round (every 25:th s)
+
+
+
Has constant ability effect
+
+
+
+ Every round (6s) +
+ + +
+
+ +
+ + - + +
+
+
+ +
+ + - + +
+
+
+
+ Every full round (25s) +
+ + +
+
+ +
+ + - + +
+
+
+ +
+ + - + +
+
+
+
+ Constant ability effect +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
%
+
+
+ +
+ + - + +
+
+
+
Has critical chance
+
+
+
+ +
%
+
+
+ + +
+
+
+ +
%
+
+
+ + +
+
+
\ No newline at end of file diff --git a/AndorsTrailEdit/edit_quest.html b/AndorsTrailEdit/edit_quest.html index 5ebda8664..3a627db60 100644 --- a/AndorsTrailEdit/edit_quest.html +++ b/AndorsTrailEdit/edit_quest.html @@ -1,5 +1,40 @@ -
-

id: {{obj.id}}

-
-
-
+

Quest

+
+ General +
+ + +
+
+ + +
+
+
Show in quest log
+
+
+
+ Stages +
+ + + + + + + + + + + + + + + + + +
ProgressLogtextExperienceFinishes quest
X
+ +
+
+
diff --git a/AndorsTrailEdit/editor.html b/AndorsTrailEdit/editor.html index 923cd15ca..2b484f7b7 100644 --- a/AndorsTrailEdit/editor.html +++ b/AndorsTrailEdit/editor.html @@ -397,66 +397,6 @@ - - - -
-

Quest

-
- General -
- - -
-
- - -
-
-
Show in quest log
-
-
-
- Stages -
- - - - - - - - - - - -
ProgressLogtextExperienceFinishes quest
-
Add
-
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
-
Finishes quest
-
-
- - - @@ -599,223 +539,8 @@ + - - - - - -
-

Actor condition

-
- General -
-
-
-
- - -
-
- - -
-
- - -
-
-
Positive effect
-
-
-
Allow stacked effects
-
-
-
Has effect every round (every 6s)
-
-
-
Has effect every full round (every 25:th s)
-
-
-
Has constant ability effect
-
-
-
- Every round (6s) -
- - -
-
- -
-
-
-
- -
-
-
-
-
- Every full round (25s) -
- - -
-
- -
-
-
-
- -
-
-
-
-
- Constant ability effect -
- - -
-
- - -
-
- - -
-
- - -
-
- -
%
-
-
- -
-
-
-
-
Has critical chance
-
-
-
- -
%
-
-
- - -
-
-
- -
%
-
-
- - -
-
-
-
- - - - - -
-
This data corresponds to the files named res/values/content_*.xml in the source code.
-
-

Actor conditions

-
-
-
Import
-
- -

Quests

-
-
-
Import
-
- -

Items

-
-
-
Import
-
- -

Droplists

-
-
-
Import
-
- -

Dialogue

-
-
-
Import
-
- -

Monsters

-
-
-
Import
-
-
-
- -
-
This data corresponds to the files named res/values/content_*.xml in the source code.
-
-

Actor conditions

-
-
-
- -

Quests

-
-
-
- -

Items

-
-
-
- -

Droplists

-
-
-
- -

Dialogue

-
-
-
- -

Monsters

-
-
-
-
-
- diff --git a/AndorsTrailEdit/importexport.js b/AndorsTrailEdit/importexport.js index 24bc31f6a..cd9128623 100644 --- a/AndorsTrailEdit/importexport.js +++ b/AndorsTrailEdit/importexport.js @@ -2,6 +2,10 @@ var ATEditor = (function(ATEditor, _) { var prep = {}; prep.actorcondition = function(o) { + o.hasRoundEffect = ATEditor.utils.hasValues(_.omit(o.roundEffect, 'visualEffectID')); + o.hasFullRoundEffect = ATEditor.utils.hasValues(_.omit(o.fullRoundEffect, 'visualEffectID')); + o.abilityEffect.hasCritical = o.abilityEffect.increaseCriticalSkill || o.abilityEffect.setCriticalMultiplier; + o.hasAbilityEffect = ATEditor.utils.hasValues(o.abilityEffect); }; prep.quest = function(o) { }; @@ -24,11 +28,19 @@ var ATEditor = (function(ATEditor, _) { _.each(objs, function(o) { ATEditor.defaults.addDefaults(section.id, o); if (p) { p(o); } + ATEditor.utils.convertIntegersToStrings(o); }); } var unprep = {}; unprep.actorcondition = function(o) { + if (!o.hasRoundEffect) { delete o.roundEffect; } + if (!o.hasFullRoundEffect) { delete o.fullRoundEffect; } + if (!o.hasAbilityEffect) { delete o.abilityEffect; } + delete o.hasRoundEffect; + delete o.hasFullRoundEffect; + if (o.abilityEffect) { delete o.abilityEffect.hasCritical; } + delete o.hasAbilityEffect; }; unprep.quest = function(o) { }; @@ -49,8 +61,12 @@ var ATEditor = (function(ATEditor, _) { function prepareObjectsForExport(section, objs) { var p = unprep[section.id]; return _.map(objs, function(o) { - o = ATEditor.defaults.removeDefaults(section.id, o); + o = ATEditor.utils.deepClone(o); + ATEditor.utils.removeAngularFields(o); if (p) { p(o); } + ATEditor.utils.convertStringsToIntegers(o); + ATEditor.defaults.removeDefaults(section.id, o); + ATEditor.utils.compact(o); return o; }); } diff --git a/AndorsTrailEdit/model.js b/AndorsTrailEdit/model.js index a8b8bc144..d3130e16f 100644 --- a/AndorsTrailEdit/model.js +++ b/AndorsTrailEdit/model.js @@ -60,21 +60,21 @@ var ATEditor = (function(ATEditor, DataStore, FieldList, _) { }; _import(model.actorConditions, [ - {id: "bless", name: "Bless", isPositive: true, iconID: "actorconditions_1:38", category: 0, hasAbilityEffect: 1, attackChance: 15, blockChance: 5} - ,{id: "poison_weak", name: "Weak Poison", iconID: "actorconditions_1:60", category: 3, hasRoundEffect: 1, round_visualEffectID: 2, round_boostHP_Min: -1, round_boostHP_Max: -1} + {id: "bless", name: "Bless", isPositive: 1, iconID: "actorconditions_1:38", category: 0, abilityEffect: { increaseAttackChance: 15, increaseBlockChance: 5} } + ,{id: "poison_weak", name: "Weak Poison", iconID: "actorconditions_1:60", category: 3, roundEffect: { visualEffectID: 2, increaseCurrentHP: { min: -1, max: -1} } } ]); _import(model.quests, [ - {id: "testQuest", name: "Test quest", stages: [ { progress: 10, logText: "Stage 10"} , { progress: 20, logText: "Stage 20", finishesQuest: 1 } ] } + {id: "testQuest", name: "Test quest", showInLog: 1, stages: [ { progress: 10, logText: "Stage 10"} , { progress: 20, logText: "Stage 20", finishesQuest: 1 } ] } ]); _import(model.items, [ - {id: "item0", iconID: "items_weapons:0", name: "Longsword", category: 'lsword', baseMarketCost: 51, hasEquipEffect: 1, equip_attackChance: 10, equip_attackDamage_Min: 2, equip_attackDamage_Max: 4, equip_attackCost: 4} - ,{id: "dmg_ring1", iconID: "items_jewelry:0", name: "Ring of damage +1", category: 'ring', baseMarketCost: 62, hasEquipEffect: 1, equip_attackDamage_Min: 1, equip_attackDamage_Max: 1} + {id: "item0", iconID: "items_weapons:0", name: "Longsword", category: 'lsword', baseMarketCost: 51, equipEffect: { increaseAttackChance: 10, increaseAttackDamage: { min: 2, max: 4 }, increaseAttackCost: 4 } } + ,{id: "dmg_ring1", iconID: "items_jewelry:0", name: "Ring of damage +1", category: 'ring', baseMarketCost: 62, equipEffect: { increaseAttackDamage: { min: 1, max: 1 } } } ]); _import(model.droplists, [ - {id: "merchant1", items: [ { itemID: 'dmg_ring1', quantity_Min: 4, quantity_Max: 5, chance: 100 } , { itemID: 'item0', quantity_Min: 1, quantity_Max: 1, chance: 100 } ] } + {id: "merchant1", items: [ { itemID: 'dmg_ring1', quantity: { min: 4, max: 5 }, chance: 100 } , { itemID: 'item0', quantity: { min: 1, max: 1 }, chance: 100 } ] } ]); _import(model.dialogue, [ @@ -91,6 +91,6 @@ var ATEditor = (function(ATEditor, DataStore, FieldList, _) { } addExampleModelItems(model); - ATEditor.model = model; + ATEditor.model = ATEditor.model || model; return ATEditor; })(ATEditor, ATEditor.DataStore, ATEditor.FieldList, _); diff --git a/AndorsTrailEdit/utils.js b/AndorsTrailEdit/utils.js index 4484a767e..e3564db57 100644 --- a/AndorsTrailEdit/utils.js +++ b/AndorsTrailEdit/utils.js @@ -12,43 +12,91 @@ var ATEditor = (function(ATEditor, _) { } } } - function cleanCopy(o, defaults) { - if (!o) { return null; } - o = _.clone(o); - if (defaults) { - removeDefaults(o, defaults); - } - for (var key in o) { + function removeAngularFields(o) { + var key; + for (key in o) { + var v = o[key]; if (key.charAt(0) === '$') { delete o[key]; + } else if (_.isArray(v) || _.isObject(v)) { + removeAngularFields(v); } } - for (var key in o) { + } + function compact(o) { + if (!o) { return null; } + var key; + for (key in o) { var v = o[key]; - if (!v) { - delete o[key]; - } else if (_.isArray(v)) { - if (!_.some(v)) { - delete o[key]; - } else { - o[key] = _.map(v, function(o) { cleanCopy(o); }); - } + if (_.isArray(v)) { + v = _.map(v, compact); } else if (_.isObject(v)) { - v = cleanCopy(v); - if (v) { - o[key] = v; - } else { - delete o[key]; - } + v = compact(v); + } + if (!hasValues(v)) { + delete o[key]; + } else { + o[key] = v; } } - if (!_.some(_.keys(o))) { return null; } + if (!hasValues(o)) { return null; } return o; } + function hasValues(o) { + if (_.isArray(o)) { + return _.some(o, hasValues); + } else if (_.isObject(o)) { + var key; + for (key in o) { + if (hasValues(o[key])) { + return true; + } + } + return false; + } + return o; + } + + function convertStringsToIntegers(o) { + var key; + for (key in o) { + var v = o[key]; + if (_.isString(v)) { + v = parseInt(v); + if (!_.isNaN(v)) { + o[key] = v; + } + } else if (_.isArray(v)) { + convertStringsToIntegers(v); + } else if (_.isObject(v)) { + convertStringsToIntegers(v); + } + } + } + + function convertIntegersToStrings(o) { + var key; + for (key in o) { + var v = o[key]; + if (_.isNumber(v)) { + o[key] = String(v); + } else if (_.isArray(v)) { + convertIntegersToStrings(v); + } else if (_.isObject(v)) { + convertIntegersToStrings(v); + } + } + } + ATEditor.utils = { deepClone: deepClone - ,cleanCopy: cleanCopy + ,removeDefaults: removeDefaults + ,removeAngularFields: removeAngularFields + ,compact: compact + ,hasValues: hasValues + ,convertStringsToIntegers: convertStringsToIntegers + ,convertIntegersToStrings: convertIntegersToStrings }; return ATEditor;