mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-01-08 12:37:24 +01:00
Refactor content editor - Add table editor for items.
This commit is contained in:
@@ -9,6 +9,7 @@ var ATEditor = (function(ATEditor, controllers) {
|
||||
.when('/actorcondition/edit/:id', {templateUrl: htmldir+'edit_actorcondition.html', controller: controllers.ActorConditionController})
|
||||
.when('/quest/edit/:id', {templateUrl: htmldir+'edit_quest.html', controller: controllers.QuestController})
|
||||
.when('/item/edit/:id', {templateUrl: htmldir+'edit_item.html', controller: controllers.ItemController})
|
||||
.when('/item/table', {templateUrl: htmldir+'table_item.html', controller: controllers.ItemTableController})
|
||||
.when('/droplist/edit/:id', {templateUrl: htmldir+'edit_droplist.html', controller: controllers.DropListController})
|
||||
.when('/dialogue/edit/:id', {templateUrl: htmldir+'edit_dialogue.html', controller: controllers.DialogueController})
|
||||
.when('/monster/edit/:id', {templateUrl: htmldir+'edit_monster.html', controller: controllers.MonsterController})
|
||||
|
||||
@@ -73,13 +73,16 @@ var ATEditor = (function(ATEditor, model) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function setCategoryToObject(item, itemCategories) {
|
||||
if (_.isString(item.category)) {
|
||||
item.category = itemCategories.findById(item.category);
|
||||
}
|
||||
}
|
||||
|
||||
function ItemController($scope, $routeParams) {
|
||||
$scope.obj = model.items.findById($routeParams.id) || {};
|
||||
if (_.isString($scope.obj.category)) {
|
||||
$scope.obj.category = model.itemCategories.findById($scope.obj.category);
|
||||
}
|
||||
$scope.itemCategories = model.itemCategories.items;
|
||||
setCategoryToObject($scope.obj, model.itemCategories);
|
||||
|
||||
$scope.$watch('obj.category', function(val) {
|
||||
$scope.isWeapon = isWeaponCategory(val);
|
||||
@@ -108,8 +111,28 @@ var ATEditor = (function(ATEditor, model) {
|
||||
};
|
||||
}
|
||||
|
||||
function ItemTableController($scope, $routeParams) {
|
||||
$scope.items = model.items.items;
|
||||
$scope.itemCategories = model.itemCategories.items;
|
||||
_.each($scope.items, function(item) {
|
||||
setCategoryToObject(item, model.itemCategories);
|
||||
});
|
||||
$scope.getItemCost = getItemCost;
|
||||
$scope.edit = function(item) {
|
||||
window.location = "#/" + model.items.id + "/edit/" + item.id;
|
||||
};
|
||||
$scope.updateCost = function(item) {
|
||||
item.baseMarketCost = item.hasManualPrice ? calculateItemCost(item) : 0;
|
||||
};
|
||||
|
||||
$scope.iconID = true;
|
||||
$scope.id = true;
|
||||
$scope.cost = true;
|
||||
}
|
||||
|
||||
ATEditor.controllers = ATEditor.controllers || {};
|
||||
ATEditor.controllers.ItemController = ItemController;
|
||||
ATEditor.controllers.ItemTableController = ItemTableController;
|
||||
|
||||
return ATEditor;
|
||||
})(ATEditor, ATEditor.model);
|
||||
|
||||
@@ -38,6 +38,7 @@ var ATEditor = (function(ATEditor, model, importExport, exampleData) {
|
||||
};
|
||||
$scope.supportsTableEdit = function(section) {
|
||||
if (section.id == ATEditor.model.monsters.id) { return true; }
|
||||
if (section.id == ATEditor.model.items.id) { return true; }
|
||||
return false;
|
||||
};
|
||||
$scope.editAsTable = function(section) {
|
||||
|
||||
150
AndorsTrailEdit/partials/table_item.html
Normal file
150
AndorsTrailEdit/partials/table_item.html
Normal file
@@ -0,0 +1,150 @@
|
||||
<h3>Items</h3>
|
||||
|
||||
<label class="checkbox"><input type="checkbox" ng-model="iconID" />Icon</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="id" />Id</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="name" />Name</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="category" />Category</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="displaytype" />Display type</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="hasManualPrice" />Has manual price</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="price" />Base market cost</label>
|
||||
|
||||
<label class="checkbox"><input type="checkbox" ng-model="hasEquipEffect" />Has equip effect</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseMaxHP" />MaxHP</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseMaxAP" />MaxAP</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseMoveCost" />Increase move cost</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseUseItemCost" />Increase use item cost</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseReequipCost" />Increase re-equip cost</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseAttackCost" />Attack cost</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseAttackChance" />Attack chance</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseAttackDamage" />Attack damage</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseCriticalSkill" />Critical skill</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_setCriticalMultiplier" />Critical multiplier</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseBlockChance" />Block chance</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="equipEffect_increaseDamageResistance" />Damage resistance</label>
|
||||
|
||||
<label class="checkbox"><input type="checkbox" ng-model="useEffect" />Use effect</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="hitEffect" />Hit effect</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="killEffect" />Kill effect</label>
|
||||
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th ng-ds-fade="iconID">Icon</th>
|
||||
<th ng-ds-fade="id">Id</th>
|
||||
<th ng-ds-fade="name">Name</th>
|
||||
<th ng-ds-fade="category">Category</th>
|
||||
<th ng-ds-fade="displaytype">Type</th>
|
||||
<th ng-ds-fade="hasManualPrice">Manual price?</th>
|
||||
<th ng-ds-fade="price">Price</th>
|
||||
|
||||
<th ng-ds-fade="hasEquipEffect">Equip?</th>
|
||||
<th ng-ds-fade="equipEffect_increaseMaxHP">MaxHP</th>
|
||||
<th ng-ds-fade="equipEffect_increaseMaxAP">MaxAP</th>
|
||||
<th ng-ds-fade="equipEffect_increaseMoveCost">+MoveCost</th>
|
||||
<th ng-ds-fade="equipEffect_increaseUseItemCost">+UseItemCost</th>
|
||||
<th ng-ds-fade="equipEffect_increaseReequipCost">+ReequipCost</th>
|
||||
<th ng-ds-fade="equipEffect_increaseAttackCost">AtkCost</th>
|
||||
<th ng-ds-fade="equipEffect_increaseAttackChance">AC</th>
|
||||
<th ng-ds-fade="equipEffect_increaseAttackDamage">AD</th>
|
||||
<th ng-ds-fade="equipEffect_increaseCriticalSkill">CS</th>
|
||||
<th ng-ds-fade="equipEffect_setCriticalMultiplier">CM</th>
|
||||
<th ng-ds-fade="equipEffect_increaseBlockChance">BC</th>
|
||||
<th ng-ds-fade="equipEffect_increaseDamageResistance">DR</th>
|
||||
|
||||
<th ng-ds-fade="useEffect">Use?</th>
|
||||
<th ng-ds-fade="useEffect">+HP</th>
|
||||
<th ng-ds-fade="useEffect">+AP</th>
|
||||
<th ng-ds-fade="hitEffect">Hit?</th>
|
||||
<th ng-ds-fade="hitEffect">+HP</th>
|
||||
<th ng-ds-fade="hitEffect">+AP</th>
|
||||
<th ng-ds-fade="killEffect">Kill?</th>
|
||||
<th ng-ds-fade="killEffect">+HP</th>
|
||||
<th ng-ds-fade="killEffect">+AP</th>
|
||||
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="item in items">
|
||||
<td ng-ds-fade="iconID"><div ng-tile-image="item.iconID" class="at-input-icon" ng-select-image="item" ng-select-image-dest="item.iconID"></div></td>
|
||||
<td ng-ds-fade="id"><input type="text" ng-model="item.id" class="at-input-id" /></td>
|
||||
<td ng-ds-fade="name"><input type="text" ng-model="item.name" class="at-input-name" /></td>
|
||||
<td ng-ds-fade="category">
|
||||
<select ng-model="item.category" ng-options="s.name for s in itemCategories"></select>
|
||||
</td>
|
||||
<td ng-ds-fade="displaytype">
|
||||
<select ng-model="item.displaytype">
|
||||
<option value="0">Ordinary item</option>
|
||||
<option value="1">Quest item (yellow)</option>
|
||||
<option value="2">Legendary (green)</option>
|
||||
<option value="3">Extraordinary (blue)</option>
|
||||
<option value="4">Rare (purple)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td ng-ds-fade="name"><input type="text" ng-model="item.name" class="at-input-name" /></td>
|
||||
<td ng-ds-fade="hasManualPrice"><input type="checkbox" ng-model="item.hasManualPrice" ng-true-value="1" ng-false-value="0" ng-change="updateCost(item)" /></td>
|
||||
<td ng-ds-fade="price">
|
||||
<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="hasEquipEffect"><input type="checkbox" ng-model="item.hasEquipEffect" title="Has effect when equipping item?" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseMaxHP"><input type="text" ng-model="item.equipEffect.increaseMaxHP" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseMaxAP"><input type="text" ng-model="item.equipEffect.increaseMaxAP" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseMoveCost"><input type="text" ng-model="item.equipEffect.increaseMoveCost" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseUseItemCost"><input type="text" ng-model="item.equipEffect.increaseUseItemCost" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseReequipCost"><input type="text" ng-model="item.equipEffect.increaseReequipCost" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseAttackCost"><input type="text" ng-model="item.equipEffect.increaseAttackCost" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseAttackChance"><input type="text" ng-model="item.equipEffect.increaseAttackChance" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseAttackDamage">
|
||||
<input type="text" ng-model="item.equipEffect.increaseAttackDamage.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.equipEffect.increaseAttackDamage.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
<td ng-ds-fade="equipEffect_increaseCriticalSkill"><input type="text" ng-model="item.equipEffect.increaseCriticalSkill" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_setCriticalMultiplier"><input type="text" ng-model="item.equipEffect.setCriticalMultiplier" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseBlockChance"><input type="text" ng-model="item.equipEffect.increaseBlockChance" class="at-input-stat" /></td>
|
||||
<td ng-ds-fade="equipEffect_increaseDamageResistance"><input type="text" ng-model="item.equipEffect.increaseDamageResistance" class="at-input-stat" /></td>
|
||||
|
||||
<td ng-ds-fade="useEffect"><input type="checkbox" ng-model="item.hasUseEffect" title="Has effect when using item?" /></td>
|
||||
<td ng-ds-fade="useEffect">
|
||||
<input type="text" ng-model="item.useEffect.increaseCurrentHP.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.useEffect.increaseCurrentHP.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
<td ng-ds-fade="useEffect">
|
||||
<input type="text" ng-model="item.useEffect.increaseCurrentAP.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.useEffect.increaseCurrentAP.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
|
||||
<td ng-ds-fade="hitEffect"><input type="checkbox" ng-model="item.hasHitEffect" title="Has effect when hitting a target in combat?" /></td>
|
||||
<td ng-ds-fade="hitEffect">
|
||||
<input type="text" ng-model="item.hitEffect.increaseCurrentHP.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.hitEffect.increaseCurrentHP.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
<td ng-ds-fade="hitEffect">
|
||||
<input type="text" ng-model="item.hitEffect.increaseCurrentAP.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.hitEffect.increaseCurrentAP.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
|
||||
<td ng-ds-fade="killEffect"><input type="checkbox" ng-model="item.hasKillEffect" title="Has effect when killing a target in combat?" /></td>
|
||||
<td ng-ds-fade="killEffect">
|
||||
<input type="text" ng-model="item.killEffect.increaseCurrentHP.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.killEffect.increaseCurrentHP.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
<td ng-ds-fade="killEffect">
|
||||
<input type="text" ng-model="item.killEffect.increaseCurrentAP.min" class="at-input-stat-minmax" />
|
||||
-
|
||||
<input type="text" ng-model="item.killEffect.increaseCurrentAP.max" class="at-input-stat-minmax" />
|
||||
</td>
|
||||
|
||||
<td><a ng-click="edit(item)" class="btn"><i class="icon-forward"></i> Edit</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="endSets"> </div>
|
||||
@@ -1,9 +1,10 @@
|
||||
<h3>Monster / NPC</h3>
|
||||
<h3>Monsters / NPCs</h3>
|
||||
|
||||
<label class="checkbox"><input type="checkbox" ng-model="iconID" />Icon</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="id" />Id</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="name" />Name</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="spawnGroup" />Spawngroup</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="unique" />Unique</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="monsterClass" />Class</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="phraseID" />Phrase</label>
|
||||
<label class="checkbox"><input type="checkbox" ng-model="droplistID" />Droplist</label>
|
||||
@@ -27,6 +28,7 @@
|
||||
<th ng-ds-fade="id">Id</th>
|
||||
<th ng-ds-fade="name">Name</th>
|
||||
<th ng-ds-fade="spawnGroup">Spawngroup</th>
|
||||
<th ng-ds-fade="unique">Unique</th>
|
||||
<th ng-ds-fade="monsterClass">Class</th>
|
||||
<th ng-ds-fade="phraseID">Phrase</th>
|
||||
<th ng-ds-fade="droplistID">Droplist</th>
|
||||
@@ -51,8 +53,9 @@
|
||||
<td ng-ds-fade="id"><input type="text" ng-model="monster.id" class="at-input-id" /></td>
|
||||
<td ng-ds-fade="name"><input type="text" ng-model="monster.name" class="at-input-name" /></td>
|
||||
<td ng-ds-fade="spawnGroup"><input type="text" ng-model="monster.spawnGroup" class="at-input-id" /></td>
|
||||
<td ng-ds-fade="unique"><input type="checkbox" ng-model="monster.unique" ng-true-value="1" ng-false-value="0" /></td>
|
||||
<td ng-ds-fade="monsterClass">
|
||||
<select class="field" id="monsterClass" ng-model="monster.monsterClass">
|
||||
<select ng-model="monster.monsterClass">
|
||||
<option value="0">Humanoid</option>
|
||||
<option value="1">Insect</option>
|
||||
<option value="2">Demon</option>
|
||||
|
||||
Reference in New Issue
Block a user