mirror of
https://github.com/RussellChamp/Grimoire.git
synced 2026-10-27 16:12:33 +00:00
Added some "quick links", added Generate Spellbook, added some useless
libs to bower
This commit is contained in:
1 parent
34f8e9d532
commit
62cd506aee
4 files changed
+141
-13
No files matched your search
+4
-2
@@ -27,9 +27,11 @@
|
||||
"slimscroll": "~1.3.3",
|
||||
"angular-slimscroll": "~1.1.2",
|
||||
"zeroclipboard": "~2.2.0",
|
||||
"angular-zeroclipboard": "~0.4.0"
|
||||
"angular-zeroclipboard": "~0.4.0",
|
||||
"bootstrap-material-design": "~0.2.2",
|
||||
"angular-material": "~0.7.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular": ">=1 <1.3.0"
|
||||
"angular": "1.3.x"
|
||||
}
|
||||
}
|
||||
+92
-3
@@ -1,5 +1,5 @@
|
||||
/*global _:false */
|
||||
/*global Grimoire:false, Weapons:false, Potions:false, Rings:false, Scrolls:false, Wands:false, Rods:false, Staves:false, WondrousItems:false, Intelligence:false*/
|
||||
/*global Grimoire:false, Weapons:false, Potions:false, Rings:false, Scrolls:false, Wands:false, Rods:false, Staves:false, WondrousItems:false, Intelligence:false, Spells:false*/
|
||||
/*jshint forin: false */
|
||||
(function (angular) {
|
||||
'use strict';
|
||||
@@ -11,6 +11,10 @@
|
||||
var self = this;
|
||||
this.welcome = 'Welcome to the Grimoire App!';
|
||||
this.itemCount = [1,1,1];
|
||||
this.spellLevel = 0;
|
||||
this.spellType = "arcane";
|
||||
this.casterLevel = 1;
|
||||
this.baseCost = 1000;
|
||||
|
||||
this.sources = [
|
||||
{
|
||||
@@ -125,15 +129,100 @@
|
||||
|
||||
this.addItemList = function(list) {
|
||||
self.itemLists.push(list);
|
||||
self.scrollItemsBottom();
|
||||
setTimeout(function() { self.scrollItemsBottom(); }, 200);
|
||||
//otherwise the scroll will get ahead of the add
|
||||
};
|
||||
|
||||
this.scrollItemsBottom = function() {
|
||||
//BAD BAD ANGULAR FORM!
|
||||
//The slimscroll item didn't allow for a way to bind to an object
|
||||
//I'm not sure how to do this correctly
|
||||
$('#itemScroll').slimScroll({ scrollBy: 99999}); //just all the way
|
||||
//$('#itemScroll').slimScroll({ scrollBy: 99999}); //just all the way
|
||||
//I couldn't get {start: 'bottom'} to work right
|
||||
//$('#itemScroll').slimScroll({ start: 'bottom'});
|
||||
var height = $('#itemScroll').prop('scrollHeight') + 'px';
|
||||
$('#itemScroll').slimScroll({ scrollTo: height});
|
||||
};
|
||||
|
||||
this.getValue = function(list) {
|
||||
var sum = 0;
|
||||
_.forEach(list, function(item) { sum += item.cost;});
|
||||
return sum;
|
||||
};
|
||||
|
||||
this.getDeity = function() {
|
||||
self.itemLists.push({
|
||||
timestamp: new Date(),
|
||||
items: [
|
||||
{
|
||||
name: "Deity: " + Grimoire.getDeity()
|
||||
}
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
this.getEnergyType = function() {
|
||||
self.itemLists.push({
|
||||
timestamp: new Date(),
|
||||
items: [
|
||||
{
|
||||
name: "Energy Type: " + Grimoire.getEnergyResistance()
|
||||
}
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
this.getSpell = function(type, level) {
|
||||
//console.log(String(type) + " " + String(level));
|
||||
if(type && level > -1) {
|
||||
var itemList = {};
|
||||
itemList.spells = [];
|
||||
itemList.spells.push(Spells.getLevelSpell(level, type));
|
||||
itemList.timestamp = new Date();
|
||||
console.log(itemList);
|
||||
self.itemLists.push(itemList);
|
||||
}
|
||||
};
|
||||
|
||||
this.generateSpellbook = function(casterLevel) {
|
||||
if(casterLevel) {
|
||||
casterLevel = _.min([casterLevel, 20]);
|
||||
var itemList = {};
|
||||
itemList.spells = [];
|
||||
//there's really no precident for this.
|
||||
//I'm just going to assume Wizard only.
|
||||
//Assume ALL cantrips
|
||||
//Wizards know 3 + Int level 1 spells at level 1
|
||||
//Ever level, a wizard adds two new spells to his book
|
||||
//The minimum CL for a spell is (spell * 2 - 1)
|
||||
//We will just take a shot and say the following
|
||||
//Level 1 spells: 3 + 1/2 CL
|
||||
//Level 2 spells:
|
||||
var slvl = [2,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];
|
||||
//console.log("At Caster Level " + String(casterLevel) + " you get:");
|
||||
for(var spellLevel = 1; spellLevel <= 9; spellLevel++) {
|
||||
var numSpells = 0;
|
||||
if(casterLevel >= spellLevel * 2 - 1) { //minimum requirement
|
||||
numSpells = slvl[casterLevel - (spellLevel*2-1)];
|
||||
if(spellLevel === 1) {
|
||||
numSpells += 4; //since you start with 3 + Int first level spells
|
||||
}
|
||||
//console.log(String(numSpells) + " level " + String(spellLevel) + " spells");
|
||||
for(var i = 0; i < numSpells; i++) {
|
||||
var newSpell = {};
|
||||
do {
|
||||
newSpell = Spells.getLevelSpell(spellLevel, 'arcane');
|
||||
} while(itemList.spells.indexOf(newSpell) !== -1); //duplicate
|
||||
itemList.spells.push(newSpell);
|
||||
}
|
||||
}
|
||||
else
|
||||
break; //no point checking the higher levels
|
||||
}
|
||||
|
||||
itemList.timestamp = new Date();
|
||||
self.itemLists.push(itemList);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
+7
-3
@@ -26,7 +26,8 @@
|
||||
}
|
||||
|
||||
.itembar {
|
||||
height: 40em;
|
||||
height: 45em;
|
||||
padding-bottom:5em;
|
||||
}
|
||||
|
||||
.header {
|
||||
@@ -34,9 +35,8 @@
|
||||
}
|
||||
|
||||
.footer {
|
||||
height: 4em;
|
||||
height: 2em;
|
||||
white-space:nowrap;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
.list-header {
|
||||
@@ -46,4 +46,8 @@
|
||||
input.numberbox {
|
||||
width: 4em;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
.sourceItem {
|
||||
padding: .2em;
|
||||
}
|
||||
+38
-5
@@ -8,20 +8,21 @@
|
||||
<link href="bower_components/angular/angular-csp.css" rel="stylesheet" />
|
||||
<link href="bower_components/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
|
||||
<link href="bower_components/bootstrap/dist/css/bootstrap-theme.css" rel="stylesheet" />
|
||||
<!--<link href="bower_components/angular-material/angular-material.css" rel="stylesheet" />
|
||||
<link href="bower_components/angular-material/default-theme.css" rel="stylesheet" />-->
|
||||
|
||||
</head>
|
||||
<body ng-controller="GrimoireController as grimoire">
|
||||
|
||||
<div class="col-md-12 big menu header">{{grimoire.welcome}}</div>
|
||||
<div class="col-md-12">
|
||||
<!--LIST OF ITEM SOURCES-->
|
||||
<div class="col-md-3 sidebar">
|
||||
<div class="list-title menu">Sources:</div>
|
||||
<div class="list-title big menu">Sources:</div>
|
||||
<div slimscroll="{height:'auto', alwaysVisible:true, railVisible:true}" id="sourceScroll" class="menu">
|
||||
<ul>
|
||||
<li ng-repeat="source in grimoire.sources"><input type="checkbox" value={{source}} ng-model="source.selected" ng-change="grimoire.checkSource(source)">{{source.name}}
|
||||
<li ng-repeat="source in grimoire.sources" class="sourceItem"><input type="checkbox" value={{source}} ng-model="source.selected" ng-change="grimoire.checkSource(source)">{{source.name}}
|
||||
<ul>
|
||||
<li ng-repeat="item in source.sources"><input type="radio" name="source" ng-model="grimoire.radio" value={{source.shortName+'|'+item}} ng-change="grimoire.checkRadio()">{{item}}</li>
|
||||
<li ng-repeat="item in source.sources" class="sourceItem"><input type="radio" name="source" ng-model="grimoire.radio" value={{source.shortName+'|'+item}} ng-change="grimoire.checkRadio()">{{item}}</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -37,14 +38,20 @@
|
||||
</div>
|
||||
<!--LIST OF ITEM LISTS-->
|
||||
<div class="col-md-9 itembar">
|
||||
<div class="menu">History:</div>
|
||||
<div class="big menu">History:</div>
|
||||
<div slimscroll="{height:'auto', alwaysVisible:true, railVisible:true, start:'bottom'}" id="itemScroll" class="menu">
|
||||
<div class="item-list" ng-repeat="list in grimoire.itemLists">
|
||||
<span><strong>~~{{list.timestamp|date:'medium'}}~~</strong> <button ui-zeroclip zeroclip-text="grimoire.copyToClipboard(list)" class="copy" type="button">Copy to clipboard</button></span>
|
||||
<!--START ITEM LIST-->
|
||||
<br/>
|
||||
<span ng-if="grimoire.getValue(list.items) > 0"><strong>Total Value: </strong>{{grimoire.getValue(list.items)|number}}gp</span>
|
||||
<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>
|
||||
<ul ng-if="item.intelligence"><li>{{item.intelligence.print()}}</li></ul></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li ng-repeat="spell in list.spells track by $index">{{spell.name}} ({{spell.type}}, Level {{spell.level}}) {{spell.source}}</li>
|
||||
</ul>
|
||||
{{list.notes}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,7 +63,17 @@
|
||||
<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-3 menu"><input type="button" value="GO" ng-click="grimoire.generateItems()"></div>
|
||||
</div>
|
||||
<div class="col-md-12 footer">
|
||||
<strong>Quick Links:</strong>
|
||||
<button class="btn btn-default btn-md" ng-click="grimoire.getDeity()">Get Deity</button>
|
||||
<button class="btn btn-default btn-md" ng-click="grimoire.getEnergyType()">Get Energy Type</button>
|
||||
<button class="btn btn-default btn-md" ng-click="grimoire.getSpell(grimoire.spellType, grimoire.spellLevel)">Get Spell</button> (Level <input type="number" class="numberbox form-control" ng-model="grimoire.spellLevel"> <input type="radio" name="spellType" value="arcane" ng-model="grimoire.spellType">Arcane <input type="radio" name="spellType" value="divine" ng-model="grimoire.spellType">Divine)
|
||||
<button class="btn btn-default btn-md" ng-click="grimoire.generateSpellbook(grimoire.casterLevel)">Generate Spellbook</button>(Caster Level: <input type="number" class="numberbox form-control" ng-model="grimoire.casterLevel">)
|
||||
<button class="btn btn-default btn-md" ng-click="grimoire.generateIntelligence(grimoire.baseCost)">Generate Item Intelligence</button>(Base cost: <input type="number" class="numberbox form-control" ng-model="grimoire.baseCost">)
|
||||
|
||||
</div>
|
||||
|
||||
<!--GrimoireJS library-->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
|
||||
<script type="application/javascript" src="../GrimoireJS/grimoire.js"></script>
|
||||
<script type="application/javascript" src="../GrimoireJS/intelligence.js"></script>
|
||||
@@ -73,17 +90,33 @@
|
||||
<script type="application/javascript" src="../GrimoireJS/energy.js"></script>
|
||||
<script type="application/javascript" src="../GrimoireJS/armors.js"></script>
|
||||
<script type="application/javascript" src="../GrimoireJS/shields.js"></script>
|
||||
|
||||
<!--jquery-->
|
||||
<script type="application/javascript" src="bower_components/jquery/dist/jquery.js"></script>
|
||||
|
||||
<!--angular-->
|
||||
<script type="application/javascript" src="bower_components/angular/angular.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-route/angular-route.js"></script>
|
||||
<!--angular-material-->
|
||||
<!--
|
||||
<script type="application/javascript" src="bower_components/angular-aria/angular-aria.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-animate/angular-animate.js"></script>
|
||||
<script type="application/javascript" src="bower_components/hammerjs/hammer.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-material/angular-material.js"></script>-->
|
||||
|
||||
<!--bootstrap-->
|
||||
<script type="application/javascript" src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
|
||||
|
||||
<!--slimscroll-->
|
||||
<script type="application/javascript" src="bower_components/slimscroll/jquery.slimscroll.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-slimscroll/angular-slimscroll.js"></script>
|
||||
<!--zeroclipboard-->
|
||||
<script type="application/javascript" src="bower_components/zeroclipboard/dist/ZeroClipboard.js"></script>
|
||||
<script type="application/javascript" src="bower_components/angular-zeroclipboard/src/angular-zeroclipboard.js"></script>
|
||||
|
||||
<!--my app-->
|
||||
<script type="application/javascript" src="app.js"></script>
|
||||
<script type="application/javascript" src="grimoire-controller.js"></script>
|
||||
</body>
|
||||
|
||||
Reference in new issue
Block a user