Updates to content editor

* Do not reset store prices on items when changing between manual and automatic pricing.
* Correct urls on import/export pages to where the files are placed.
* Show indications in item table editor on effects that cause actor conditions.
This commit is contained in:
Oskar Wiksten
2013-03-27 19:35:56 +01:00
parent 5cb762113d
commit dd51f5de6c
5 changed files with 31 additions and 14 deletions

View File

@@ -6,6 +6,14 @@ var ATEditor = (function(ATEditor, model, importExport, settings, ATModelFunctio
}
}
function setItemPriceSuggestion(item) {
if (item.hasManualPrice == 1) {
item.baseMarketCost = ATModelFunctions.itemFunctions.calculateItemCost(item);
} else {
item.baseMarketCost = 0;
}
}
function ItemController($scope, $routeParams) {
$scope.obj = model.items.findById($routeParams.id) || {};
$scope.itemCategories = model.itemCategories.items;
@@ -24,10 +32,8 @@ var ATEditor = (function(ATEditor, model, importExport, settings, ATModelFunctio
$scope.obj.hasKillEffect = false;
}
});
$scope.$watch('obj.hasManualPrice', function(hasManualPrice) {
$scope.obj.baseMarketCost = hasManualPrice ? ATModelFunctions.itemFunctions.calculateItemCost($scope.obj) : 0;
});
$scope.updateCost = setItemPriceSuggestion;
$scope.getItemCost = ATModelFunctions.itemFunctions.getItemCost;
$scope.getItemSellingCost = ATModelFunctions.itemFunctions.getItemSellingCost;
$scope.getItemBuyingCost = ATModelFunctions.itemFunctions.getItemBuyingCost;
@@ -49,16 +55,14 @@ var ATEditor = (function(ATEditor, model, importExport, settings, ATModelFunctio
_.each($scope.items, function(item) {
setCategoryToObject(item, model.itemCategories);
});
$scope.getItemCost = ATModelFunctions.itemFunctions.getItemCost;
$scope.edit = function(item) {
window.location = "#/" + section.id + "/edit/" + item.id;
};
$scope.addObj = function() {
importExport.prepareObjectsForEditor(section, [ section.addNew() ]);
};
$scope.updateCost = function(item) {
item.baseMarketCost = ATModelFunctions.itemFunctions.getItemCost(item);
};
$scope.updateCost = setItemPriceSuggestion;
$scope.getItemCost = ATModelFunctions.itemFunctions.getItemCost;
if (!settings.itemTableEditorVisibleColumns) {
settings.itemTableEditorVisibleColumns = {

View File

@@ -51,7 +51,7 @@
<fieldset>
<legend>Price</legend>
<div class="fieldWithLabel">
<label class="checkbox"><input type="checkbox" id="hasManualPrice" ng-model="obj.hasManualPrice" ng-true-value="1" ng-false-value="0" />Item has manually specified store price</label>
<label class="checkbox"><input type="checkbox" id="hasManualPrice" ng-model="obj.hasManualPrice" ng-true-value="1" ng-false-value="0" ng-change="updateCost(obj)" />Item has manually specified store price</label>
</div>
<div class="fieldWithLabel">
<label for="baseMarketCost">Base market cost (gold):</label>

View File

@@ -11,6 +11,6 @@
<div ng-ds-fade="content">
<textarea id="importExportTextArea" rows="9" cols="80" ng-model="content"></textarea>
<br /><br />
<p>Exported data should be placed in the files named <a href="http://code.google.com/p/andors-trail/source/browse/#git%2FAndorsTrail%2Fres">res/raw/*.json</a> in the source code.</p>
<p>Exported data should be placed in the files named <a href="http://code.google.com/p/andors-trail/source/browse/#git%2FAndorsTrail%2Fres%2Fraw">res/raw/*.json</a> in the source code.</p>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<h3>Import</h3>
<fieldset>
<p>Data to import can be found in the files named <a href="http://code.google.com/p/andors-trail/source/browse/#git%2FAndorsTrail%2Fres">res/raw/*.json</a> in the source code.</p>
<p>Data to import can be found in the files named <a href="http://code.google.com/p/andors-trail/source/browse/#git%2FAndorsTrail%2Fres%2Fraw">res/raw/*.json</a> in the source code.</p>
Import as
<select ng-model="selectedSection" ng-options="s.name for s in sections"></select>

View File

@@ -136,7 +136,10 @@
<input type="text" ng-show="item.hasManualPrice == 0" value="{{getItemCost(item)}}" readonly="readonly" class="at-input-gold" />
<input type="text" ng-show="item.hasManualPrice == 1" ng-model="item.baseMarketCost" class="at-input-gold" />
</td>
<td ng-ds-fade="settings.hasEquipEffect"><input type="checkbox" ng-model="item.hasEquipEffect" title="Has effect when equipping item?" /></td>
<td ng-ds-fade="settings.hasEquipEffect">
<input type="checkbox" ng-model="item.hasEquipEffect" title="Has effect when equipping item?" />
<span ng-show="item.equipEffect.addedConditions.length > 0">*</span>
</td>
<td ng-ds-fade="settings.equipEffect_increaseMaxHP"><input type="text" ng-model="item.equipEffect.increaseMaxHP" class="at-input-stat" /></td>
<td ng-ds-fade="settings.equipEffect_increaseMaxAP"><input type="text" ng-model="item.equipEffect.increaseMaxAP" class="at-input-stat" /></td>
<td ng-ds-fade="settings.equipEffect_increaseMoveCost"><input type="text" ng-model="item.equipEffect.increaseMoveCost" class="at-input-stat" /></td>
@@ -154,7 +157,10 @@
<td ng-ds-fade="settings.equipEffect_increaseBlockChance"><input type="text" ng-model="item.equipEffect.increaseBlockChance" class="at-input-stat" /></td>
<td ng-ds-fade="settings.equipEffect_increaseDamageResistance"><input type="text" ng-model="item.equipEffect.increaseDamageResistance" class="at-input-stat" /></td>
<td ng-ds-fade="settings.useEffect"><input type="checkbox" ng-model="item.hasUseEffect" title="Has effect when using item?" /></td>
<td ng-ds-fade="settings.useEffect">
<input type="checkbox" ng-model="item.hasUseEffect" title="Has effect when using item?" />
<span ng-show="item.useEffect.conditionsSource.length > 0">*</span>
</td>
<td ng-ds-fade="settings.useEffect">
<input type="text" ng-model="item.useEffect.increaseCurrentHP.min" class="at-input-stat-minmax" />
-
@@ -166,7 +172,11 @@
<input type="text" ng-model="item.useEffect.increaseCurrentAP.max" class="at-input-stat-minmax" />
</td>
<td ng-ds-fade="settings.hitEffect"><input type="checkbox" ng-model="item.hasHitEffect" title="Has effect when hitting a target in combat?" /></td>
<td ng-ds-fade="settings.hitEffect">
<input type="checkbox" ng-model="item.hasHitEffect" title="Has effect when hitting a target in combat?" />
<span ng-show="item.hitEffect.conditionsSource.length > 0">S</span>
<span ng-show="item.hitEffect.conditionsTarget.length > 0">T</span>
</td>
<td ng-ds-fade="settings.hitEffect">
<input type="text" ng-model="item.hitEffect.increaseCurrentHP.min" class="at-input-stat-minmax" />
-
@@ -178,7 +188,10 @@
<input type="text" ng-model="item.hitEffect.increaseCurrentAP.max" class="at-input-stat-minmax" />
</td>
<td ng-ds-fade="settings.killEffect"><input type="checkbox" ng-model="item.hasKillEffect" title="Has effect when killing a target in combat?" /></td>
<td ng-ds-fade="settings.killEffect">
<input type="checkbox" ng-model="item.hasKillEffect" title="Has effect when killing a target in combat?" />
<span ng-show="item.killEffect.conditionsSource.length > 0">*</span>
</td>
<td ng-ds-fade="settings.killEffect">
<input type="text" ng-model="item.killEffect.increaseCurrentHP.min" class="at-input-stat-minmax" />
-