mirror of
https://github.com/RussellChamp/Grimoire.git
synced 2026-10-28 00:22:32 +00:00
Updated the printing of intelligent items; added minimum value threshold
This commit is contained in:
1 parent
2219b0d69b
commit
c6b80fb7d4
3 files changed
+45
-31
No files matched your search
+29
-19
@@ -15,6 +15,7 @@
|
|||||||
this.spellType = "arcane";
|
this.spellType = "arcane";
|
||||||
this.casterLevel = 1;
|
this.casterLevel = 1;
|
||||||
this.baseCost = 1000;
|
this.baseCost = 1000;
|
||||||
|
this.minimumTotalCost = 0;
|
||||||
|
|
||||||
this.sources = [
|
this.sources = [
|
||||||
{
|
{
|
||||||
@@ -80,8 +81,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.generateItems = function() {
|
this.generateItems = function() {
|
||||||
|
var tries = 10;
|
||||||
var itemList = {};
|
var itemList = {};
|
||||||
|
do {
|
||||||
itemList.items = [];
|
itemList.items = [];
|
||||||
|
if(tries === 0) {
|
||||||
|
itemList.notes = "ERROR: Could not generate items over " + self.minimumTotalCost + "gp after 10 tries";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(self.radio) {
|
if(self.radio) {
|
||||||
//console.log("Generating item from " + self.radio);
|
//console.log("Generating item from " + self.radio);
|
||||||
@@ -109,12 +116,21 @@
|
|||||||
console.log("Error: No sources selected");
|
console.log("Error: No sources selected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
itemList.timestamp = new Date();
|
tries--;
|
||||||
|
} while(self.minimumTotalCost && self.getValue(itemList.items) < self.minimumTotalCost);
|
||||||
self.addItemList(itemList);
|
self.addItemList(itemList);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.generateIntelligence = function(cost) {
|
this.generateIntelligence = function(cost) {
|
||||||
var list = {};
|
var itemInt = Intelligence.getItemIntelligence(cost);
|
||||||
|
var list = {
|
||||||
|
items: [{
|
||||||
|
name: "Intelligent Item",
|
||||||
|
intelligence: itemInt,
|
||||||
|
cost: cost + itemInt.cost,
|
||||||
|
}],
|
||||||
|
};
|
||||||
|
/*
|
||||||
var stats = Intelligence.getItemIntelligence(cost).print().split(";");
|
var stats = Intelligence.getItemIntelligence(cost).print().split(";");
|
||||||
list.notes = "";
|
list.notes = "";
|
||||||
for(var s in stats) {
|
for(var s in stats) {
|
||||||
@@ -124,10 +140,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
list.timestamp = new Date();
|
list.timestamp = new Date();
|
||||||
self.itemLists.push(list);
|
*/
|
||||||
|
self.addItemList(list);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.addItemList = function(list) {
|
this.addItemList = function(list) {
|
||||||
|
if(!list.timestamp) {
|
||||||
|
list.timestamp = new Date();
|
||||||
|
}
|
||||||
self.itemLists.push(list);
|
self.itemLists.push(list);
|
||||||
setTimeout(function() { self.scrollItemsBottom(); }, 200);
|
setTimeout(function() { self.scrollItemsBottom(); }, 200);
|
||||||
//otherwise the scroll will get ahead of the add
|
//otherwise the scroll will get ahead of the add
|
||||||
@@ -151,24 +171,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.getDeity = function() {
|
this.getDeity = function() {
|
||||||
self.itemLists.push({
|
self.addItemList({
|
||||||
timestamp: new Date(),
|
notes: "Deity: " + Grimoire.getDeity(),
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: "Deity: " + Grimoire.getDeity()
|
|
||||||
}
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getEnergyType = function() {
|
this.getEnergyType = function() {
|
||||||
self.itemLists.push({
|
self.addItemList({
|
||||||
timestamp: new Date(),
|
notes: "Energy Type: " + Grimoire.getEnergyResistance()
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: "Energy Type: " + Grimoire.getEnergyResistance()
|
|
||||||
}
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -180,7 +190,7 @@
|
|||||||
itemList.spells.push(Spells.getLevelSpell(level, type));
|
itemList.spells.push(Spells.getLevelSpell(level, type));
|
||||||
itemList.timestamp = new Date();
|
itemList.timestamp = new Date();
|
||||||
console.log(itemList);
|
console.log(itemList);
|
||||||
self.itemLists.push(itemList);
|
self.addItemList(itemList);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -221,7 +231,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
itemList.timestamp = new Date();
|
itemList.timestamp = new Date();
|
||||||
self.itemLists.push(itemList);
|
self.addItemList(itemList);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
.footer {
|
.footer {
|
||||||
height: 2em;
|
height: 2em;
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
|
padding-bottom:4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-header {
|
.list-header {
|
||||||
@@ -47,6 +48,10 @@ input.numberbox {
|
|||||||
width: 4em;
|
width: 4em;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
}
|
}
|
||||||
|
input.largecount {
|
||||||
|
width: 10em;
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.sourceItem {
|
.sourceItem {
|
||||||
padding: .2em;
|
padding: .2em;
|
||||||
|
|||||||
+11
-12
@@ -32,12 +32,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
QUICK BUTTONS
|
QUICK BUTTONS OR ADS?
|
||||||
Get Deity
|
|
||||||
Get Energy Type
|
|
||||||
Get Spell (level)
|
|
||||||
Generate Spell Book (caster level)
|
|
||||||
Generate Item Intelligence (price)
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--LIST OF ITEM LISTS-->
|
<!--LIST OF ITEM LISTS-->
|
||||||
@@ -51,9 +46,11 @@
|
|||||||
<span ng-if="grimoire.getValue(list.items) > 0"><strong>Total Value: </strong>{{grimoire.getValue(list.items)|number}}gp</span>
|
<span ng-if="grimoire.getValue(list.items) > 0"><strong>Total Value: </strong>{{grimoire.getValue(list.items)|number}}gp</span>
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="item in list.items track by $index">{{item.name}}<span ng-if="item.description"> {{item.description}}</span><span ng-if="item.cost > 0"> {{item.cost|number}}gp</span><a class="super" target="_blank" ng-if="item.url" href={{item.url}}>link</a>
|
<li ng-repeat="item in list.items track by $index">{{item.name}}<span ng-if="item.description"> {{item.description}}</span><span ng-if="item.cost > 0"> {{item.cost|number}}gp</span><a class="super" target="_blank" ng-if="item.url" href={{item.url}}>link</a>
|
||||||
<ul ng-if="item.intelligence"><li>{{item.intelligence.print()}}</li></ul></li>
|
<!--PRINT ITEM INTELLIGENCE-->
|
||||||
|
<ul ng-if="item.intelligence"><li ng-repeat="stat in item.intelligence.print().split(';')" ng-if="stat.split(':')[0] != 'Cost'"><strong>{{stat.split(':')[0]}}:</strong>{{stat.split(':')[1]}}</li></ul></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
|
<!--START SPELLS LIST-->
|
||||||
<li ng-repeat="spell in list.spells track by $index">{{spell.name}} ({{spell.type}}, Level {{spell.level}}) {{spell.source}}</li>
|
<li ng-repeat="spell in list.spells track by $index">{{spell.name}} ({{spell.type}}, Level {{spell.level}}) {{spell.source}}</li>
|
||||||
</ul>
|
</ul>
|
||||||
{{list.notes}}
|
{{list.notes}}
|
||||||
@@ -61,11 +58,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 big footer">
|
<div class="col-md-12 footer">
|
||||||
<div class="col-md-3 menu">Minor Item <input type="number" class="numberbox form-control" ng-model="grimoire.itemCount[0]"></div>
|
<div class="col-md-7">
|
||||||
<div class="col-md-3 menu">Medium Item <input type="number" class="numberbox form-control" ng-model="grimoire.itemCount[1]"></div>
|
<div class="col-md-4 big menu">Minor Item <input type="number" class="numberbox form-control" ng-model="grimoire.itemCount[0]"></div>
|
||||||
<div class="col-md-3 menu">Major Item <input type="number" class="numberbox form-control" ng-model="grimoire.itemCount[2]"></div>
|
<div class="col-md-4 big menu">Medium Item <input type="number" class="numberbox form-control" ng-model="grimoire.itemCount[1]"></div>
|
||||||
<div class="col-md-3 menu"><input type="button" value="GO" ng-click="grimoire.generateItems()"></div>
|
<div class="col-md-4 big menu">Major Item <input type="number" class="numberbox form-control" ng-model="grimoire.itemCount[2]"></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5 menu"><input type="button" value="GO" class="big" ng-click="grimoire.generateItems()">(Minimum Total Cost: <input type="number" class="largecount form-control" ng-model="grimoire.minimumTotalCost">gp)</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12 footer">
|
<div class="col-md-12 footer">
|
||||||
<strong>Quick Links:</strong>
|
<strong>Quick Links:</strong>
|
||||||
|
|||||||
Reference in new issue
Block a user